import{i as r,g as c,a as e,b}from"./blockUtils-Dh4GyFRv.js";function p(l){if(!l)return!1;const i=b(l);if(!i||b(i))return!1;const u=[l,i],o={rgbOff:!1,ledOff:!1};for(const t of u){if(r(t,"led_rgb_abcd_set")){if(e(t,"ledMaterial")==="A"&&e(t,"ledColor")==="off"){if(o.rgbOff)return!1;o.rgbOff=!0;continue}return!1}if(r(t,"led_set")){if(e(t,"ledMaterial")==="A"&&e(t,"ledState")==="off"){if(o.ledOff)return!1;o.ledOff=!0;continue}return!1}return!1}return o.rgbOff&&o.ledOff}function O(l){if(!r(l,"custom_repeat_ext"))return!1;const i=c(l,"TIMES");if(Number(e(i,"NUM"))!==4)return!1;const o=c(l,"DO");if(!o)return!1;const t=[];let n=o;for(;n;)t.push(n),n=b(n);if(t.length!==3)return!1;const[a,d,k]=t;if(!r(k,"time_set")||Number(e(k,"timeValue"))!==2)return!1;const f={rgbRandom:!1,ledOn:!1};for(const s of[a,d]){if(r(s,"led_rgb_abcd_set")){if(e(s,"ledMaterial")==="A"&&e(s,"ledColor")==="random"){if(f.rgbRandom)return!1;f.rgbRandom=!0;continue}return!1}if(r(s,"led_set")){if(e(s,"ledMaterial")==="A"&&e(s,"ledState")==="on"){if(f.ledOn)return!1;f.ledOn=!0;continue}return!1}return!1}return f.rgbRandom&&f.ledOn}const w={checkpoints:[{id:"checkpoint1",checkCondition:(l,i={})=>{const u=i?.blocklyWorkspaceRef?.current;if(!u)return!1;let n=(u?.getTopBlocks?.(!0)??[])[0],a=null;for(;n&&typeof n.getNextBlock=="function";)if(n=n.getNextBlock(),r(n,"controls_if")){a=n;break}if(!a)return!1;const d=c(a,"IF0");if(!r(d,"switch_condition")||e(d,"switchState")!=="on")return!1;const k=c(a,"DO0");if(!O(k))return!1;let f=!1;const s=c(a,"ELSE");if(s&&p(s)&&(f=!0),!f){const m=b(a);if(r(m,"controls_if")){const g=c(m,"IF0"),h=c(m,"DO0");r(g,"switch_condition")&&e(g,"switchState")==="off"&&h&&p(h)&&(f=!0)}}return!!f},dialogues:[{speaker:"Rob",message:"Tekan butang 'Switch OFF' untuk mematikan semua lampu dan selesaikan misi!",characterDirection:"left",dialogType:"checkpoint"}]}]};export{w as checkpointConfig};
