// Automatically generated file.  Do not edit!

'use strict';var b,g={g:{}};g.g.global=function(){return"object"===typeof self?self:"object"===typeof window?window:"object"===typeof global?global:this}();
g.h={};g.g.global.Blockly||(g.g.global.Blockly={});g.g.global.Blockly.Msg||(g.g.global.Blockly.Msg=g.h);g.g.S=function(a,c){this.x=a;this.y=c};g.g.S.ve=function(a,c){return a==c?!0:a&&c?a.x==c.x&&a.y==c.y:!1};g.g.S.Bx=function(a,c){var d=a.x-c.x;a=a.y-c.y;return Math.sqrt(d*d+a*a)};g.g.S.yF=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};g.g.S.hm=function(a,c){return new g.g.S(a.x-c.x,a.y-c.y)};g.g.S.sum=function(a,c){return new g.g.S(a.x+c.x,a.y+c.y)};g.g.S.prototype.scale=function(a){this.x*=a;this.y*=a;return this};g.g.S.prototype.translate=function(a,c){this.x+=a;this.y+=c;return this};g.g.ab={};g.g.ab.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};g.g.ab.Lu=function(a){return a.length?a.reduce(function(c,d){return c.length<d.length?c:d}).length:0};g.g.ab.xD=function(a,c){if(!a.length)return 0;if(1==a.length)return a[0].length;var d=0;c=c||g.g.ab.Lu(a);for(var e=0;e<c;e++){for(var f=a[0][e],h=1;h<a.length;h++)if(f!=a[h][e])return d;" "==f&&(d=e+1)}for(h=1;h<a.length;h++)if((f=a[h][e])&&" "!=f)return d;return c};
g.g.ab.yD=function(a,c){if(!a.length)return 0;if(1==a.length)return a[0].length;var d=0;c=c||g.g.ab.Lu(a);for(var e=0;e<c;e++){for(var f=a[0].substr(-e-1,1),h=1;h<a.length;h++)if(f!=a[h].substr(-e-1,1))return d;" "==f&&(d=e+1)}for(h=1;h<a.length;h++)if((f=a[h].charAt(a[h].length-e-1))&&" "!=f)return d;return c};g.g.ab.sA=function(a,c){a=a.split("\n");for(var d=0;d<a.length;d++)a[d]=g.g.ab.iH(a[d],c);return a.join("\n")};
g.g.ab.iH=function(a,c){if(a.length<=c)return a;for(var d=a.trim().split(/\s+/),e=0;e<d.length;e++)d[e].length>c&&(c=d[e].length);e=-Infinity;var f=1;do{var h=e;var k=a;a=[];var l=d.length/f,m=1;for(e=0;e<d.length-1;e++)m<(e+1.5)/l?(m++,a[e]=!0):a[e]=!1;a=g.g.ab.tA(d,a,c);e=g.g.ab.cv(d,a,c);a=g.g.ab.jH(d,a);f++}while(e>h);return k};
g.g.ab.cv=function(a,c,d){for(var e=[0],f=[],h=0;h<a.length;h++)e[e.length-1]+=a[h].length,!0===c[h]?(e.push(0),f.push(a[h].charAt(a[h].length-1))):!1===c[h]&&e[e.length-1]++;a=Math.max.apply(Math,e);for(h=c=0;h<e.length;h++)c-=2*Math.pow(Math.abs(d-e[h]),1.5),c-=Math.pow(a-e[h],1.5),-1!=".?!".indexOf(f[h])?c+=d/3:-1!=",;)]}".indexOf(f[h])&&(c+=d/4);1<e.length&&e[e.length-1]<=e[e.length-2]&&(c+=.5);return c};
g.g.ab.tA=function(a,c,d){for(var e=g.g.ab.cv(a,c,d),f,h=0;h<c.length-1;h++)if(c[h]!=c[h+1]){var k=[].concat(c);k[h]=!k[h];k[h+1]=!k[h+1];var l=g.g.ab.cv(a,k,d);l>e&&(e=l,f=k)}return f?g.g.ab.tA(a,f,d):c};g.g.ab.jH=function(a,c){for(var d=[],e=0;e<a.length;e++)d.push(a[e]),void 0!==c[e]&&d.push(c[e]?"\n":" ");return d.join("")};g.g.qe=function(a,c){this.width=a;this.height=c};g.g.qe.ve=function(a,c){return a==c?!0:a&&c?a.width==c.width&&a.height==c.height:!1};g.g.style={};g.g.style.Hg=function(a){if("none"!=g.g.style.oy(a,"display"))return g.g.style.ly(a);var c=a.style,d=c.display,e=c.visibility,f=c.position;c.visibility="hidden";c.position="absolute";c.display="inline";var h=a.offsetWidth;a=a.offsetHeight;c.display=d;c.position=f;c.visibility=e;return new g.g.qe(h,a)};g.g.style.ly=function(a){return new g.g.qe(a.offsetWidth,a.offsetHeight)};g.g.style.oy=function(a,c){return g.g.style.getComputedStyle(a,c)||g.g.style.xE(a,c)||a.style&&a.style[c]};
g.g.style.getComputedStyle=function(a,c){return document.defaultView&&document.defaultView.getComputedStyle&&(a=document.defaultView.getComputedStyle(a,null))?a[c]||a.getPropertyValue(c)||"":""};g.g.style.xE=function(a,c){return a.currentStyle?a.currentStyle[c]:null};g.g.style.hp=function(a){var c=new g.g.S(0,0);a=a.getBoundingClientRect();var d=document.documentElement;d=new g.g.S(window.pageXOffset||d.scrollLeft,window.pageYOffset||d.scrollTop);c.x=a.left+d.x;c.y=a.top+d.y;return c};
g.g.style.uy=function(){var a=document.body,c=document.documentElement;return new g.g.S(a.scrollLeft||c.scrollLeft,a.scrollTop||c.scrollTop)};g.g.style.Gu=function(a,c){a.style.display=c?"":"none"};g.g.style.Nk=function(){return"rtl"==g.g.style.oy(void 0,"direction")};
g.g.style.uE=function(a){var c=g.g.style.getComputedStyle(a,"borderLeftWidth"),d=g.g.style.getComputedStyle(a,"borderRightWidth"),e=g.g.style.getComputedStyle(a,"borderTopWidth");a=g.g.style.getComputedStyle(a,"borderBottomWidth");return{top:parseFloat(e),right:parseFloat(d),bottom:parseFloat(a),left:parseFloat(c)}};g.g.style.Cu=function(a,c){a=g.g.style.zE(a,c);c.scrollLeft=a.x;c.scrollTop=a.y};
g.g.style.zE=function(a,c){var d=g.g.style.hp(a),e=g.g.style.hp(c),f=g.g.style.uE(c),h=d.x-e.x-f.left;d=d.y-e.y-f.top;a=g.g.style.ly(a);e=c.clientHeight-a.height;f=c.scrollLeft;var k=c.scrollTop;f+=Math.min(h,Math.max(h-(c.clientWidth-a.width),0));k+=Math.min(d,Math.max(d-e,0));return new g.g.S(f,k)};g.g.userAgent={};
(function(a){function c(e){return-1!=d.indexOf(e.toUpperCase())}g.g.userAgent.raw=a;var d=g.g.userAgent.raw.toUpperCase();g.g.userAgent.lg=c("Trident")||c("MSIE");g.g.userAgent.ao=c("Edge");g.g.userAgent.JB=c("JavaFX");g.g.userAgent.Dr=c("WebKit")&&!g.g.userAgent.ao;g.g.userAgent.Jq=c("Gecko")&&!g.g.userAgent.Dr&&!g.g.userAgent.lg&&!g.g.userAgent.ao;g.g.userAgent.jl=c("Android");g.g.userAgent.Wj=c("iPad");g.g.userAgent.Ov=c("iPod");g.g.userAgent.Nv=c("iPhone")&&!g.g.userAgent.Wj&&!g.g.userAgent.Ov;
g.g.userAgent.WB=c("Macintosh");g.g.userAgent.DC=g.g.userAgent.Wj||g.g.userAgent.jl&&!c("Mobile")||c("Silk");g.g.userAgent.dC=!g.g.userAgent.DC&&(g.g.userAgent.Ov||g.g.userAgent.Nv||g.g.userAgent.jl||c("IEMobile"))})(g.g.global.navigator&&g.g.global.navigator.userAgent||"");
g.g.OF=function(a){a.preventDefault();a.stopPropagation()};g.g.Ap=function(a){return"textarea"==a.target.type||"text"==a.target.type||"number"==a.target.type||"email"==a.target.type||"password"==a.target.type||"search"==a.target.type||"tel"==a.target.type||"url"==a.target.type||a.target.isContentEditable};
g.g.ze=function(a){var c=new g.g.S(0,0),d=a.getAttribute("x");d&&(c.x=parseInt(d,10));if(d=a.getAttribute("y"))c.y=parseInt(d,10);if(d=(d=a.getAttribute("transform"))&&d.match(g.g.ze.PC))c.x+=Number(d[1]),d[3]&&(c.y+=Number(d[3]));(a=a.getAttribute("style"))&&-1<a.indexOf("translate")&&(a=a.match(g.g.ze.QC))&&(c.x+=Number(a[1]),a[3]&&(c.y+=Number(a[3])));return c};
g.g.tm=function(a){for(var c=0,d=0;a;){var e=g.g.ze(a);c+=e.x;d+=e.y;if(-1!=(" "+(a.getAttribute("class")||"")+" ").indexOf(" injectionDiv "))break;a=a.parentNode}return new g.g.S(c,d)};g.g.ze.PC=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/;g.g.ze.QC=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/;g.g.fj=function(a){return a.ctrlKey&&g.g.userAgent.WB?!0:2==a.button};
g.g.Um=function(a,c,d){var e=c.createSVGPoint();e.x=a.clientX;e.y=a.clientY;d||(d=c.getScreenCTM().inverse());return e.matrixTransform(d)};g.g.ky=function(a){switch(a.deltaMode){case 0:return{x:a.deltaX,y:a.deltaY};case 1:return{x:a.deltaX*g.Sv,y:a.deltaY*g.Sv};case 2:return{x:a.deltaX*g.aw,y:a.deltaY*g.aw}}};g.g.UG=function(a){return g.g.Wu(a,!0)};g.g.nc=function(a){if("string"!=typeof a)return a;a=g.g.Wu(a,!1);return a.length?a[0]:""};
g.g.Pw=function(a){for(var c=g.h,d=a.match(/%{BKY_[A-Z]\w*}/ig),e=0;e<d.length;e++)void 0==c[d[e].toUpperCase().slice(6,-1)]&&console.log("WARNING: No message string for "+d[e]+" in "+a)};
g.g.Wu=function(a,c){var d=[],e=a.split("");e.push("");var f=0;a=[];for(var h=null,k=0;k<e.length;k++){var l=e[k];0==f?"%"==l?((l=a.join(""))&&d.push(l),a.length=0,f=1):a.push(l):1==f?"%"==l?(a.push(l),f=0):c&&"0"<=l&&"9">=l?(f=2,h=l,(l=a.join(""))&&d.push(l),a.length=0):"{"==l?f=3:(a.push("%",l),f=0):2==f?"0"<=l&&"9">=l?h+=l:(d.push(parseInt(h,10)),k--,f=0):3==f&&(""==l?(a.splice(0,0,"%{"),k--,f=0):"}"!=l?a.push(l):(f=a.join(""),/[A-Z]\w*/i.test(f)?(l=f.toUpperCase(),(l=g.g.ab.startsWith(l,"BKY_")?
l.substring(4):null)&&l in g.h?(f=g.h[l],"string"==typeof f?Array.prototype.push.apply(d,g.g.Wu(f,c)):c?d.push(String(f)):d.push(f)):d.push("%{"+f+"}")):d.push("%{"+f+"}"),f=a.length=0))}(l=a.join(""))&&d.push(l);c=[];for(k=a.length=0;k<d.length;++k)"string"==typeof d[k]?a.push(d[k]):((l=a.join(""))&&c.push(l),a.length=0,c.push(d[k]));(l=a.join(""))&&c.push(l);a.length=0;return c};g.g.Eg=function(){for(var a=g.g.Eg.bA.length,c=[],d=0;20>d;d++)c[d]=g.g.Eg.bA.charAt(Math.random()*a);return c.join("")};
g.g.Eg.bA="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
g.g.$i=function(){if(void 0!==g.g.$i.Zr)return g.g.$i.Zr;if(!g.g.global.getComputedStyle)return!1;var a=document.createElement("p"),c="none",d={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};document.body.insertBefore(a,null);for(var e in d)if(void 0!==a.style[e]){a.style[e]="translate3d(1px,1px,1px)";c=g.g.global.getComputedStyle(a);if(!c)return document.body.removeChild(a),!1;c=c.getPropertyValue(d[e])}document.body.removeChild(a);
g.g.$i.Zr="none"!==c;return g.g.$i.Zr};g.g.Tz=function(a){if("object"!=typeof document)throw Error("Blockly.utils.runAfterPageLoad() requires browser document.");if("complete"==document.readyState)a();else var c=setInterval(function(){"complete"==document.readyState&&(clearInterval(c),a())},10)};g.g.KE=function(){var a=g.g.style.uy();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}};
g.g.Co=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};g.g.DE=function(){var a=document.documentElement,c=window;return g.g.userAgent.lg&&c.pageYOffset!=a.scrollTop?new g.g.S(a.scrollLeft,a.scrollTop):new g.g.S(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};g.g.Ss=function(a,c){var d=Object.create(null),e=p(a,!0);c&&(a=t(a))&&(a=e.indexOf(a),e.splice(a,e.length-a));for(a=0;c=e[a];a++)d[c.type]?d[c.type]++:d[c.type]=1;return d};
g.g.AG=function(a,c){var d=c.x;c=c.y;var e=aa(a).getBoundingClientRect();d=new g.g.S(d-e.left,c-e.top);c=g.g.tm(a.bb);return g.g.S.hm(d,c).scale(1/a.scale)};
g.Touch={};g.Touch.rw="ontouchstart"in g.g.global||!!(g.g.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!g.g.global.navigator||!g.g.global.navigator.maxTouchPoints&&!g.g.global.navigator.msMaxTouchPoints);g.Touch.An=null;g.Touch.yf={};
g.g.global.PointerEvent?g.Touch.yf={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:g.Touch.rw&&(g.Touch.yf={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});g.Dp=0;
g.wF=function(a,c){g.Kh();a.changedTouches&&1!=a.changedTouches.length||(g.Dp=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);c&&ba(c,a)},g.TB))};g.Kh=function(){g.Dp&&(clearTimeout(g.Dp),g.Dp=0)};g.Touch.nh=function(){g.Touch.An=null};g.Touch.Mu=function(a){return!g.Touch.oF(a)||g.Touch.sD(a)};
g.Touch.lp=function(a){return void 0!=a.pointerId?a.pointerId:a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?a.changedTouches[0].identifier:"mouse"};g.Touch.sD=function(a){var c=g.Touch.lp(a);return void 0!==g.Touch.An&&null!==g.Touch.An?g.Touch.An==c:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(g.Touch.An=c,!0):!1};
g.Touch.CG=function(a){if(g.g.ab.startsWith(a.type,"touch")){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY}};g.Touch.oF=function(a){return g.g.ab.startsWith(a.type,"touch")||g.g.ab.startsWith(a.type,"mouse")||g.g.ab.startsWith(a.type,"pointer")};g.Touch.Cp=function(a){return g.g.ab.startsWith(a.type,"touch")||g.g.ab.startsWith(a.type,"pointer")};
g.Touch.JG=function(a){var c=[];if(a.changedTouches)for(var d=0;d<a.changedTouches.length;d++)c[d]={type:a.type,changedTouches:[a.changedTouches[d]],target:a.target,stopPropagation:function(){a.stopPropagation()},preventDefault:function(){a.preventDefault()}};else c.push(a);return c};g.g.o={};g.g.o.Hl="http://www.w3.org/2000/svg";g.g.o.Vj="http://www.w3.org/1999/xhtml";g.g.o.Ue="http://www.w3.org/1999/xlink";g.g.o.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};g.g.o.Fi=null;g.g.o.Xr=0;g.g.o.K=function(a,c,d){a=document.createElementNS(g.g.o.Hl,a);for(var e in c)a.setAttribute(e,c[e]);document.body.runtimeStyle&&(a.runtimeStyle=a.currentStyle=a.style);d&&d.appendChild(a);return a};
g.g.o.qb=function(a,c){var d=a.getAttribute("class")||"";if(-1!=(" "+d+" ").indexOf(" "+c+" "))return!1;d&&(d+=" ");a.setAttribute("class",d+c);return!0};g.g.o.fc=function(a,c){var d=a.getAttribute("class");if(-1==(" "+d+" ").indexOf(" "+c+" "))return!1;d=d.split(/\s+/);for(var e=0;e<d.length;e++)d[e]&&d[e]!=c||(d.splice(e,1),e--);d.length?a.setAttribute("class",d.join(" ")):a.removeAttribute("class");return!0};g.g.o.By=function(a,c){return-1!=(" "+a.getAttribute("class")+" ").indexOf(" "+c+" ")};
g.g.o.removeNode=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null};g.g.o.Zi=function(a,c){var d=c.nextSibling;c=c.parentNode;if(!c)throw Error("Reference node has no parent.");d?c.insertBefore(a,d):c.appendChild(a)};g.g.o.containsNode=function(a,c){return!!(a.compareDocumentPosition(c)&g.g.o.Node.DOCUMENT_POSITION_CONTAINED_BY)};g.g.o.ln=function(a,c){a.style.transform=c;a.style["-webkit-transform"]=c};g.g.o.tn=function(){g.g.o.Xr++;g.g.o.Fi||(g.g.o.Fi={})};
g.g.o.un=function(){g.g.o.Xr--;g.g.o.Xr||(g.g.o.Fi=null)};g.g.o.jp=function(a){var c=a.textContent+"\n"+a.className.baseVal,d;if(g.g.o.Fi&&(d=g.g.o.Fi[c]))return d;try{d=g.g.userAgent.lg||g.g.userAgent.ao?a.getBBox().width:a.getComputedTextLength()}catch(e){return 8*a.textContent.length}g.g.o.Fi&&(g.g.o.Fi[c]=d);return d};
g.hk=function(a){this.s=a;this.Xd=new g.Ja(a,!0,!0,"blocklyMainWorkspaceScrollbar");this.ge=new g.Ja(a,!1,!0,"blocklyMainWorkspaceScrollbar");this.Zl=g.g.o.K("rect",{height:g.Ja.oc,width:g.Ja.oc,"class":"blocklyScrollbarBackground"},null);g.g.o.Zi(this.Zl,a.pf)};g.hk.prototype.Cb=null;g.hk.prototype.I=function(){g.g.o.removeNode(this.Zl);this.Cb=this.s=this.Zl=null;this.Xd.I();this.Xd=null;this.ge.I();this.ge=null};
g.hk.prototype.resize=function(){var a=this.s.bc();if(a){var c=!1,d=!1;this.Cb&&this.Cb.lb==a.lb&&this.Cb.rb==a.rb&&this.Cb.xc==a.xc&&this.Cb.jc==a.jc?(this.Cb&&this.Cb.Ye==a.Ye&&this.Cb.Zb==a.Zb&&this.Cb.Ac==a.Ac||(c=!0),this.Cb&&this.Cb.Bd==a.Bd&&this.Cb.hc==a.hc&&this.Cb.kc==a.kc||(d=!0)):d=c=!0;c&&this.Xd.resize(a);d&&this.ge.resize(a);this.Cb&&this.Cb.lb==a.lb&&this.Cb.jc==a.jc||this.Zl.setAttribute("x",this.ge.ed.x);this.Cb&&this.Cb.rb==a.rb&&this.Cb.xc==a.xc||this.Zl.setAttribute("y",this.Xd.ed.y);
this.Cb=a}};g.hk.prototype.set=function(a,c){var d={};a*=this.Xd.Ic;c*=this.ge.Ic;var e=this.ge.Ie,f=a/this.Xd.Ie;d.x=isNaN(f)?0:f;e=c/e;d.y=isNaN(e)?0:e;this.s.Xh(d);ca(this.Xd,a);ca(this.ge,c)};
g.Ja=function(a,c,d,e){this.s=a;this.Qk=d||!1;this.Vi=c;this.Cb=null;this.$l(e);this.ed=new g.g.S(0,0);a=g.Ja.oc;c?(this.Mc.setAttribute("height",a),this.Pf.setAttribute("height",a),this.Jd.setAttribute("height",a-5),this.Jd.setAttribute("y",2.5),this.Mm="width",this.Ez="x"):(this.Mc.setAttribute("width",a),this.Pf.setAttribute("width",a),this.Jd.setAttribute("width",a-5),this.Jd.setAttribute("x",2.5),this.Mm="height",this.Ez="y");this.yz=g.ka(this.Mc,"mousedown",this,this.bG);this.zz=g.ka(this.Jd,
"mousedown",this,this.cG)};b=g.Ja.prototype;b.fu=new g.g.S(0,0);b.dA=0;b.Ie=0;b.Ah=0;b.xm=0;b.Ih=!0;b.Ii=!0;g.Ja.oc=15;g.Touch.rw&&(g.Ja.oc=25);g.Ja.zF=function(a,c){return a&&c&&a.lb==c.lb&&a.rb==c.rb&&a.Zb==c.Zb&&a.hc==c.hc&&a.xc==c.xc&&a.jc==c.jc&&a.Ye==c.Ye&&a.Bd==c.Bd&&a.Ac==c.Ac&&a.kc==c.kc?!0:!1};
g.Ja.prototype.I=function(){da();g.Xa(this.yz);this.yz=null;g.Xa(this.zz);this.zz=null;g.g.o.removeNode(this.Pf);this.Mc=this.H=this.Pf=null;this.Jd&&(this.s.Rb.unsubscribe(this.Jd),this.Jd=null);this.s=null};function ca(a,c){a.xm=c;a.Jd.setAttribute(a.Ez,a.xm)}function fa(a,c){a.Ie=c;a.Pf.setAttribute(a.Mm,a.Ie);a.Mc.setAttribute(a.Mm,a.Ie)}g.hk.prototype.uj=function(a){this.Xd.uj(a);this.ge.uj(a)};
function ha(a,c,d){a.ed.x=c;a.ed.y=d;g.g.o.ln(a.Pf,"translate("+(a.ed.x+a.fu.x)+"px,"+(a.ed.y+a.fu.y)+"px)")}b=g.Ja.prototype;b.resize=function(a){if(!a&&(a=this.s.bc(),!a))return;g.Ja.zF(a,this.Cb)||(this.Cb=a,this.Vi?ia(this,a):ja(this,a),ka(this))};function ia(a,c){var d=c.lb-1;a.Qk&&(d-=g.Ja.oc);fa(a,Math.max(0,d));d=c.jc+.5;a.Qk&&a.s.G&&(d+=g.Ja.oc);ha(a,d,c.xc+c.rb-g.Ja.oc-.5);la(a,c)}
function la(a,c){a.Qk||a.Qb(a.Ie<c.Ye);a.Ic=a.Ie/c.Ye;if(-Infinity==a.Ic||Infinity==a.Ic||isNaN(a.Ic))a.Ic=0;a.Ah=Math.max(0,c.lb*a.Ic);a.Jd.setAttribute(a.Mm,a.Ah);ca(a,ma(a,(c.Zb-c.Ac)*a.Ic))}function ja(a,c){var d=c.rb-1;a.Qk&&(d-=g.Ja.oc);fa(a,Math.max(0,d));d=c.jc+.5;a.s.G||(d+=c.lb-g.Ja.oc-1);ha(a,d,c.xc+.5);na(a,c)}
function na(a,c){a.Qk||a.Qb(a.Ie<c.Bd);a.Ic=a.Ie/c.Bd;if(-Infinity==a.Ic||Infinity==a.Ic||isNaN(a.Ic))a.Ic=0;a.Ah=Math.max(0,c.rb*a.Ic);a.Jd.setAttribute(a.Mm,a.Ah);ca(a,ma(a,(c.hc-c.kc)*a.Ic))}
b.$l=function(a){var c="blocklyScrollbar"+(this.Vi?"Horizontal":"Vertical");a&&(c+=" "+a);this.Pf=g.g.o.K("svg",{"class":c},null);this.H=g.g.o.K("g",{},this.Pf);this.Mc=g.g.o.K("rect",{"class":"blocklyScrollbarBackground"},this.H);a=Math.floor((g.Ja.oc-5)/2);this.Jd=g.g.o.K("rect",{"class":"blocklyScrollbarHandle",rx:a,ry:a},this.H);this.s.Rb.subscribe(this.Jd,"scrollbar","fill");this.s.Rb.subscribe(this.Jd,"scrollbarOpacity","fill-opacity");g.g.o.Zi(this.Pf,v(this.s))};b.isVisible=function(){return this.Ih};
b.uj=function(a){var c=a!=this.Ii;this.Ii=a;c&&this.En()};b.Qb=function(a){var c=a!=this.isVisible();if(this.Qk)throw Error("Unable to toggle visibility of paired scrollbars.");this.Ih=a;c&&this.En()};b.En=function(){this.Ii&&this.isVisible()?this.Pf.setAttribute("display","block"):this.Pf.setAttribute("display","none")};
b.bG=function(a){oa(this.s);g.Touch.nh();da();if(g.g.fj(a))a.stopPropagation();else{var c=g.g.Um(a,v(this.s),pa(this.s));c=this.Vi?c.x:c.y;var d=g.g.tm(this.Jd);d=this.Vi?d.x:d.y;var e=this.xm,f=.95*this.Ah;c<=d?e-=f:c>=d+this.Ah&&(e+=f);ca(this,ma(this,e));ka(this);a.stopPropagation();a.preventDefault()}};
b.cG=function(a){oa(this.s);da();g.g.fj(a)?a.stopPropagation():(this.KG=this.xm,qa(this.s),this.dA=this.Vi?a.clientX:a.clientY,g.Ja.Fe=g.ka(document,"mouseup",this,this.iG),g.Ja.Ph=g.ka(document,"mousemove",this,this.eG),a.stopPropagation(),a.preventDefault())};b.eG=function(a){ca(this,ma(this,this.KG+((this.Vi?a.clientX:a.clientY)-this.dA)));ka(this)};b.iG=function(){ra(this.s);g.Touch.nh();da()};function da(){g.mc(!0);g.Ja.Fe&&(g.Xa(g.Ja.Fe),g.Ja.Fe=null);g.Ja.Ph&&(g.Xa(g.Ja.Ph),g.Ja.Ph=null)}
function ma(a,c){return c=0>=c||isNaN(c)||a.Ie<a.Ah?0:Math.min(c,a.Ie-a.Ah)}function ka(a){var c=a.xm/a.Ie;isNaN(c)&&(c=0);var d={};a.Vi?d.x=c:d.y=c;a.s.Xh(d)}b.set=function(a){ca(this,ma(this,a*this.Ic));ka(this)};g.g.td={};g.g.td.Uu=function(a){return a*Math.PI/180};g.g.td.ZL=function(a){return 180*a/Math.PI};g.g.td.Gi=function(a,c,d){if(d<a){var e=d;d=a;a=e}return Math.max(a,Math.min(c,d))};g.Zn=function(){this.Cc=this.Ob=null};function w(a,c){a.Ob=c;a.Cc&&a.Cc.draw(a.Ob)}b=g.Zn.prototype;b.ya=function(){this.Cc&&this.Cc.ya()};b.next=function(){var a=this.Ob;if(!a)return null;for(a=a.next();a&&a.next()&&(a.Jb()==g.F.types.oe||a.Jb()==g.F.types.Nd);)a=a.next();a&&w(this,a);return a};b.Bm=function(){var a=this.Ob;if(!a)return null;if(a.Jb()==g.F.types.pe||a.Jb()==g.F.types.fk)a=a.next();(a=a.Bm())&&w(this,a);return a};
b.Rf=function(){var a=this.Ob;if(!a)return null;for(a=a.Rf();a&&a.Rf()&&(a.Jb()==g.F.types.oe||a.Jb()==g.F.types.Nd);)a=a.Rf();a&&w(this,a);return a};b.Xm=function(){var a=this.Ob;if(!a)return null;(a=a.Xm())&&a.Jb()==g.F.types.Nd&&(a=a.Rf()||a);a&&w(this,a);return a};g.g.object={};g.g.object.T=function(a,c){a.w=c.prototype;a.prototype=Object.create(c.prototype);a.prototype.constructor=a};g.g.object.kj=function(a,c){for(var d in c)a[d]=c[d]};g.g.object.values=function(a){return Object.values?Object.values(a):Object.keys(a).map(function(c){return a[c]})};g.bh=function(){g.bh.w.constructor.call(this)};g.g.object.T(g.bh,g.Zn);g.bh.prototype.next=function(){return null};g.bh.prototype.Bm=function(){return null};g.bh.prototype.Rf=function(){return null};g.bh.prototype.Xm=function(){return null};g.i={};g.i.yy="";g.i.Jc=!0;g.i.vs=0;g.i.Wn="create";g.i.kl=g.i.Wn;g.i.ol="delete";g.i.Nn=g.i.ol;g.i.ei="change";g.i.wH=g.i.ei;g.i.zl="move";g.i.pv=g.i.zl;g.i.tw="var_create";g.i.uw="var_delete";g.i.vw="var_rename";g.i.xo="ui";g.i.Tn="comment_create";g.i.wv="comment_delete";g.i.vv="comment_change";g.i.Un="comment_move";g.i.oB="finished_loading";g.i.LA=[g.i.kl,g.i.pv,g.i.Tn,g.i.Un];g.i.ql=[];g.i.Ka=function(a){g.i.isEnabled()&&(g.i.ql.length||setTimeout(g.i.nE,0),g.i.ql.push(a))};
g.i.nE=function(){for(var a=g.i.filter(g.i.ql,!0),c=g.i.ql.length=0,d;d=a[c];c++)if(d.uc){var e=g.Fb.Us(d.uc);if(e){var f=d;if(f.Jc)for(e.Hj.push(f),e.dn.length=0;e.Hj.length>e.Tv&&0<=e.Tv;)e.Hj.shift();for(var h=0;d=e.sd[h];h++)d(f)}}};
g.i.filter=function(a,c){a=a.slice();c||a.reverse();for(var d=[],e=Object.create(null),f=0,h;h=a[f];f++)if(!h.Lk()){var k=[h.type,h.zc,h.uc].join(" "),l=e[k],m=l?l.event:null;if(!l)e[k]={event:h,index:f},d.push(h);else if(h.type==g.i.zl&&l.index==f-1)m.nj=h.nj,m.mj=h.mj,m.Mh=h.Mh,l.index=f;else if(h.type==g.i.ei&&h.element==m.element&&h.name==m.name)m.newValue=h.newValue;else if(h.type!=g.i.xo||"click"!=h.element||"commentOpen"!=m.element&&"mutatorOpen"!=m.element&&"warningOpen"!=m.element)e[k]={event:h,
index:1},d.push(h)}a=d.filter(function(n){return!n.Lk()});c||a.reverse();for(f=1;h=a[f];f++)h.type==g.i.ei&&"mutation"==h.element&&a.unshift(a.splice(f,1)[0]);return a};g.i.vD=function(){for(var a=0,c;c=g.i.ql[a];a++)c.Jc=!1};g.i.disable=function(){g.i.vs++};g.i.enable=function(){g.i.vs--};g.i.isEnabled=function(){return 0==g.i.vs};g.i.Ub=function(){return g.i.yy};g.i.Z=function(a){g.i.yy="boolean"==typeof a?a?g.g.Eg():"":a};
g.i.Zx=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++)c[d]=e.id;return c};
g.i.sa=function(a){switch(a.type){case g.i.Wn:var c=new g.i.ie(null);break;case g.i.ol:c=new g.i.Oe(null);break;case g.i.ei:c=new g.i.$g(null,"","","","");break;case g.i.zl:c=new g.i.ni(null);break;case g.i.tw:c=new g.i.re(null);break;case g.i.uw:c=new g.i.Te(null);break;case g.i.vw:c=new g.i.zf(null,"");break;case g.i.xo:c=new g.i.od(null,"","","");break;case g.i.Tn:c=new g.i.gg(null);break;case g.i.vv:c=new g.i.Rj(null,"","");break;case g.i.Un:c=new g.i.gi(null);break;case g.i.wv:c=new g.i.hg(null);
break;default:throw Error("Unknown event type.");}c.sa(a);c.uc=(void 0).id;return c};g.i.xx=function(a){if((a.type==g.i.zl||a.type==g.i.Wn)&&a.uc){var c=g.Fb.Us(a.uc);if(a=x(c,a.zc)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.Kc(!0);else if((a.L||a.Y)&&!c.dc()){do a.Kc(!1),a=t(a);while(a)}}}};
g.GC=function(){var a=g.yi.Qj.lD;this.gD=g.yi.Qj.PD;this.mD=a;this.zD=Object.create(null)};function sa(a,c){return(c=a.zD[c])&&"string"==typeof propertyValue&&sa(a,c)?sa(a,c):c?String(c):null};g.Jl=function(a){this.hq=a;this.fq=[];this.ph=Object.create(null)};g.Jl.prototype.kp=function(){return this.hq};g.Jl.prototype.subscribe=function(a,c,d){this.ph[c]||(this.ph[c]=[]);this.ph[c].push({element:a,propertyName:d});a.style[d]=this.hq&&sa(this.hq,c)||""};g.Jl.prototype.unsubscribe=function(a){if(a)for(var c=Object.keys(this.ph),d=0,e;e=c[d];d++){for(var f=this.ph[e],h=f.length-1;0<=h;h--)f[h].element===a&&f.splice(h,1);this.ph[e].length||delete this.ph[e]}};
g.Jl.prototype.I=function(){this.ph=this.fq=this.hq=this.dd=null};g.yi={};g.yi.Qj={};g.yi.Qj.PD={colour_blocks:{colourPrimary:"20"},list_blocks:{colourPrimary:"260"},logic_blocks:{colourPrimary:"210"},loop_blocks:{colourPrimary:"120"},math_blocks:{colourPrimary:"230"},procedure_blocks:{colourPrimary:"290"},text_blocks:{colourPrimary:"160"},variable_blocks:{colourPrimary:"330"},variable_dynamic_blocks:{colourPrimary:"310"},hat_blocks:{colourPrimary:"330",hat:"cap"}};
g.yi.Qj.lD={colour_category:{colour:"20"},list_category:{colour:"260"},logic_category:{colour:"210"},loop_category:{colour:"120"},math_category:{colour:"230"},procedure_category:{colour:"290"},text_category:{colour:"160"},variable_category:{colour:"330"},variable_dynamic_category:{colour:"310"}};g.yi.Qj=new g.GC;g.i.Abstract=function(){this.uc=void 0;this.group=g.i.Ub();this.Jc=g.i.Jc};g.i.Abstract.prototype.Wa=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};g.i.Abstract.prototype.sa=function(a){this.group=a.group};g.i.Abstract.prototype.Lk=function(){return!1};g.i.Abstract.prototype.run=function(){};function ta(a){if(a.uc)var c=g.Fb.Us(a.uc);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};g.i.rg=function(a){g.i.rg.w.constructor.call(this);this.ai=a.ua();this.uc=a.v.id};g.g.object.T(g.i.rg,g.i.Abstract);g.i.rg.prototype.Wa=function(){var a=g.i.rg.w.Wa.call(this);a.varId=this.ai;return a};g.i.rg.prototype.sa=function(a){g.i.rg.w.Wa.call(this);this.ai=a.varId};g.i.re=function(a){a&&(g.i.re.w.constructor.call(this,a),this.Kj=a.type,this.Jj=a.name)};g.g.object.T(g.i.re,g.i.rg);g.i.re.prototype.type=g.i.tw;
g.i.re.prototype.Wa=function(){var a=g.i.re.w.Wa.call(this);a.varType=this.Kj;a.varName=this.Jj;return a};g.i.re.prototype.sa=function(a){g.i.re.w.sa.call(this,a);this.Kj=a.varType;this.Jj=a.varName};g.i.re.prototype.run=function(a){var c=ta(this);a?c.Cd(this.Jj,this.Kj,this.ai):c.Hf(this.ai)};g.i.Te=function(a){a&&(g.i.Te.w.constructor.call(this,a),this.Kj=a.type,this.Jj=a.name)};g.g.object.T(g.i.Te,g.i.rg);g.i.Te.prototype.type=g.i.uw;
g.i.Te.prototype.Wa=function(){var a=g.i.Te.w.Wa.call(this);a.varType=this.Kj;a.varName=this.Jj;return a};g.i.Te.prototype.sa=function(a){g.i.Te.w.sa.call(this,a);this.Kj=a.varType;this.Jj=a.varName};g.i.Te.prototype.run=function(a){var c=ta(this);a?c.Hf(this.ai):c.Cd(this.Jj,this.Kj,this.ai)};g.i.zf=function(a,c){a&&(g.i.zf.w.constructor.call(this,a),this.Zt=a.name,this.Tt=c)};g.g.object.T(g.i.zf,g.i.rg);g.i.zf.prototype.type=g.i.vw;
g.i.zf.prototype.Wa=function(){var a=g.i.zf.w.Wa.call(this);a.oldName=this.Zt;a.newName=this.Tt;return a};g.i.zf.prototype.sa=function(a){g.i.zf.w.sa.call(this,a);this.Zt=a.oldName;this.Tt=a.newName};g.i.zf.prototype.run=function(a){var c=ta(this);a?c.Uh(this.ai,this.Tt):c.Uh(this.ai,this.Zt)};
g.Cr=function(a){this.Pa=Object.create(null);this.v=a};b=g.Cr.prototype;b.clear=function(){this.Pa=Object.create(null)};b.Tp=function(a,c){var d=this.Tc(c,a.type),e=y(this.v,!1);g.i.Z(!0);try{if(d&&d.ua()!=a.ua()){var f=a.type;c!=d.name&&ua(d,c,e);for(c=0;c<e.length;c++)e[c].Sp(a.ua(),d.ua());g.i.Ka(new g.i.Te(a));this.Pa[f].splice(this.vm(f).indexOf(a),1)}else ua(a,c,e)}finally{g.i.Z(!1)}};
b.Uh=function(a,c){var d=this.cf(a);if(!d)throw Error("Tried to rename a variable that didn't exist. ID: "+a);this.Tp(d,c)};function ua(a,c,d){g.i.Ka(new g.i.zf(a,c));a.name=c;for(c=0;c<d.length;c++)d[c].lq(a)}
b.Cd=function(a,c,d){var e=this.Tc(a,c);if(e){if(d&&e.ua()!=d)throw Error('Variable "'+a+'" is already in use and its id is "'+e.ua()+'" which conflicts with the passed in id, "'+d+'".');return e}if(d&&this.cf(d))throw Error('Variable id, "'+d+'", is already in use.');e=d||g.g.Eg();c=c||"";e=new g.Kl(this.v,a,c,e);a=this.Pa[c]||[];a.push(e);delete this.Pa[c];this.Pa[c]=a;return e};
b.Hf=function(a){var c=this.cf(a);if(c){var d=c.name,e=this.dt(a);a=0;for(var f;f=e[a];a++)if("procedures_defnoreturn"==f.type||"procedures_defreturn"==f.type){a=z(f,"NAME");d=g.h.CANNOT_DELETE_VARIABLE_PROCEDURE.replace("%1",d).replace("%2",a);g.alert(d);return}var h=this;1<e.length?(d=g.h.DELETE_VARIABLE_CONFIRMATION.replace("%1",String(e.length)).replace("%2",d),g.confirm(d,function(k){k&&h.Ro(c,e)})):h.Ro(c,e)}else console.warn("Can't delete non-existent variable: "+a)};
b.Ro=function(a,c){var d=g.i.Ub();d||g.i.Z(!0);try{for(var e=0;e<c.length;e++)c[e].I(!0,!1);var f=this.Pa[a.type];c=0;for(var h;h=f[c];c++)if(h.ua()==a.ua()){f.splice(c,1);g.i.Ka(new g.i.Te(a));break}}finally{d||g.i.Z(!1)}};b.Tc=function(a,c){if(c=this.Pa[c||""])for(var d=0,e;e=c[d];d++)if(g.Qd.ve(e.name,a))return e;return null};b.cf=function(a){for(var c=Object.keys(this.Pa),d=0;d<c.length;d++)for(var e=c[d],f=0,h;h=this.Pa[e][f];f++)if(h.ua()==a)return h;return null};
b.vm=function(a){return(a=this.Pa[a||""])?a.slice():[]};b.ct=function(a){var c=[];a&&a.Rh&&(c=Object.keys(a.Rh.Pa));a=Object.keys(this.Pa).concat(c);c=!1;for(var d=0;d<a.length;d++)""==a[d]&&(c=!0);c||a.push("");return a};b.Fg=function(){var a=[],c;for(c in this.Pa)a=a.concat(this.Pa[c]);return a};b.dt=function(a){for(var c=[],d=y(this.v,!1),e=0;e<d.length;e++){var f=d[e].Ig();if(f)for(var h=0;h<f.length;h++)f[h].ua()==a&&c.push(d[e])}return c};g.Fb=function(a){this.id=g.g.Eg();g.Fb.Ll[this.id]=this;this.options=a||{};this.G=!!this.options.G;this.Ed=!!this.options.Ed;this.Da=this.options.Da;this.cl=[];this.iq=[];this.Lo=Object.create(null);this.sd=[];this.Hj=[];this.dn=[];this.Rr=Object.create(null);this.Xg=Object.create(null);this.Pa=new g.Cr(this);this.Rh=null;this.Va=new g.Zn;this.Xb=new g.bh;this.Rb=this.options.Kb?this.options.Kb.Rb:new g.Jl(this.options.TG||g.yi.Qj);this.Rb.fq.push(this)};b=g.Fb.prototype;b.ca=!1;b.tt=!1;b.Tv=1024;
b.No=null;b.Du=function(a){this.Va=a};b.Yz=function(a){this.Xb=a};b.kp=function(){return this.Rb.kp()};b.I=function(){this.sd.length=0;this.clear();delete g.Fb.Ll[this.id];if(this.Rb){var a=this.Rb,c=a.fq.indexOf(this);if(0>c)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.fq.splice(c,1);this.Rb.unsubscribe(this.Mc);this.options.Kb||(this.Rb.I(),this.Rb=null)}};g.Fb.jw=3;b=g.Fb.prototype;
b.Yf=function(a,c){a=a.Oa();c=c.Oa();return a.y+g.Fb.prototype.Yf.offset*a.x-(c.y+g.Fb.prototype.Yf.offset*c.x)};function va(a,c){if(!g.g.Co(a.cl,c))throw Error("Block not present in workspace's list of top-most blocks.");}function A(a,c){var d=[].concat(a.cl);c&&1<d.length&&(a.Yf.offset=Math.sin(g.g.td.Uu(g.Fb.jw)),a.G&&(a.Yf.offset*=-1),d.sort(a.Yf));return d}
function wa(a,c){var d=[].concat(a.iq);c&&1<d.length&&(a.Yf.offset=Math.sin(g.g.td.Uu(g.Fb.jw)),a.G&&(a.Yf.offset*=-1),d.sort(a.Yf));return d}function y(a,c){if(c){a=A(a,!0);c=[];for(var d=0;d<a.length;d++)c.push.apply(c,p(a[d],!0))}else for(c=A(a,!1),d=0;d<c.length;d++)c.push.apply(c,c[d].xh(!1));return c.filter(function(e){return!e.Ng()})}
b.clear=function(){this.tt=!0;try{var a=g.i.Ub();for(a||g.i.Z(!0);this.cl.length;)this.cl[0].I();for(;this.iq.length;)this.iq[this.iq.length-1].I();a||g.i.Z(!1);this.Pa.clear();this.Rh&&this.Rh.clear()}finally{this.tt=!1}};b.Uh=function(a,c){this.Pa.Uh(a,c)};b.Cd=function(a,c,d){return this.Pa.Cd(a,c,d)};b.dt=function(a){return this.Pa.dt(a)};b.Hf=function(a){this.Pa.Hf(a)};b.Ro=function(a,c){this.Pa.Ro(a,c)};b.Tc=function(a,c){return this.Pa.Tc(a,c)};b.cf=function(a){return this.Pa.cf(a)};b.vm=function(a){return this.Pa.vm(a)};
b.ct=function(){return this.Pa.ct(this)};b.Fg=function(){return this.Pa.Fg()};b.Mf=function(){return 0};b.Lh=function(a,c){return new g.Qn(this,a,c)};function xa(a){return isNaN(a.options.Mt)?Infinity:a.options.Mt-y(a).length}function ya(a,c){if(!za(a))return!0;var d=0,e;for(e in c){var f=c[e];if(a.options.Nt){var h=a.options.Nt[e]||Infinity;var k=a.Xg[e]?a.Xg[e].slice(0):[];h-=k.length}else h=Infinity;if(f>h)return!1;d+=c[e]}return d>xa(a)?!1:!0}
function za(a){return Infinity!=a.options.Mt||!!a.options.Nt}b.$u=function(a){var c=a?this.dn:this.Hj,d=a?this.Hj:this.dn,e=c.pop();if(e){for(var f=[e];c.length&&e.group&&e.group==c[c.length-1].group;)f.push(c.pop());for(c=0;e=f[c];c++)d.push(e);f=g.i.filter(f,a);g.i.Jc=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{g.i.Jc=!0}}};function Aa(a,c){a.sd.push(c)}function Ba(a,c){g.g.Co(a.sd,c)}function x(a,c){return a.Rr[c]||null}g.Fb.Ll=Object.create(null);g.Fb.Us=function(a){return g.Fb.Ll[a]||null};
g.Fb.getAll=function(){var a=[],c;for(c in g.Fb.Ll)a.push(g.Fb.Ll[c]);return a};g.na=function(a,c,d,e,f,h){this.s=a;this.Ze=c;this.$z=d;d=g.na.FA;this.s.G&&(d=-d);this.aD=g.g.td.Uu(d);a.pf.appendChild(this.$l(c,!(!f||!h)));this.Tb=e;this.Up&&Ca(this);f&&h||(c=this.Ze.getBBox(),f=c.width+2*g.na.Zc,h=c.height+2*g.na.Zc);this.kn(f,h);Ca(this);Da(this);this.Up=!0;a.options.readOnly||(g.ka(this.Ql,"mousedown",this,this.hD),this.Uf&&g.ka(this.Uf,"mousedown",this,this.vG))};g.na.Zc=6;g.na.GA=5;g.na.FA=20;g.na.kv=4;g.na.DA=8;g.na.Fe=null;g.na.Ph=null;g.na.prototype.wu=null;
g.na.Zu=function(){g.na.Fe&&(g.Xa(g.na.Fe),g.na.Fe=null);g.na.Ph&&(g.Xa(g.na.Ph),g.na.Ph=null)};g.na.iD=function(){g.Touch.nh();g.na.Zu()};b=g.na.prototype;b.Up=!1;b.Tb=null;b.Qg=0;b.Th=0;b.ob=0;b.Uc=0;b.Or=!0;
b.$l=function(a,c){this.Ud=g.g.o.K("g",{},null);var d={filter:"url(#"+this.s.options.Ix+")"};g.g.userAgent.JB&&(d={});d=g.g.o.K("g",d,this.Ud);this.Vr=g.g.o.K("path",{},d);this.Ql=g.g.o.K("rect",{"class":"blocklyDraggable",x:0,y:0,rx:g.na.Zc,ry:g.na.Zc},d);c?(this.Uf=g.g.o.K("g",{"class":this.s.G?"blocklyResizeSW":"blocklyResizeSE"},this.Ud),c=2*g.na.Zc,g.g.o.K("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.Uf),g.g.o.K("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/
3},this.Uf),g.g.o.K("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.Uf)):this.Uf=null;this.Ud.appendChild(a);return this.Ud};b.wa=function(){return this.Ud};function Fa(a,c){a.Ud.dataset&&(a.Ud.dataset.blockId=c)}b.hD=function(a){var c=this.s.Gg(a);if(c){if(c.Ti)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.ae||(c.ae=this);c.kf=a}};b.pn=function(){};b.Zd=function(){return!1};
b.vG=function(a){Ga(this);g.na.Zu();g.g.fj(a)||(this.s.Qu(a,new g.g.S(this.s.G?-this.ob:this.ob,this.Uc)),g.na.Fe=g.ka(document,"mouseup",this,g.na.iD),g.na.Ph=g.ka(document,"mousemove",this,this.wG),g.mc());a.stopPropagation()};b.wG=function(a){this.Or=!1;var c=this.s;a=g.g.Um(a,v(c),pa(c));a.x/=c.scale;a.y/=c.scale;c=g.g.S.sum(c.Fx,a);this.kn(this.s.G?-c.x:c.x,c.y);this.s.G&&Ca(this)};function Ga(a){var c=a.Ud.parentNode;return c.lastChild!==a.Ud?(c.appendChild(a.Ud),!0):!1}
function Ha(a,c,d){var e=a.s.G?a.Tb.x-c.x-a.ob:c.x+a.Tb.x;c=c.y+a.Tb.y;return Math.max(0,Math.min(1,(Math.min(e+a.ob,d.Zb+d.lb)-Math.max(e,d.Zb))*(Math.min(c+a.Uc,d.hc+d.rb)-Math.max(c,d.hc))/(a.ob*a.Uc)))}function Ca(a){var c=a.Tb.x;c=a.s.G?c-(a.Qg+a.ob):c+a.Qg;a.moveTo(c,a.Th+a.Tb.y)}b.moveTo=function(a,c){this.Ud.setAttribute("transform","translate("+a+","+c+")")};b.Ts=function(){return new g.g.qe(this.ob,this.Uc)};
b.kn=function(a,c){var d=2*g.na.Zc;a=Math.max(a,d+45);c=Math.max(c,d+20);this.ob=a;this.Uc=c;this.Ql.setAttribute("width",a);this.Ql.setAttribute("height",c);this.Uf&&(this.s.G?this.Uf.setAttribute("transform","translate("+2*g.na.Zc+","+(c-d)+") scale(-1 1)"):this.Uf.setAttribute("transform","translate("+(a-d)+","+(c-d)+")"));if(this.Or){a=this.s.bc();a.Zb/=this.s.scale;a.lb/=this.s.scale;a.hc/=this.s.scale;a.rb/=this.s.scale;c=-this.ob/4;if(!(this.ob>a.lb)){if(this.s.G){d=this.Tb.x-c;var e=d-this.ob;
var f=a.Zb+a.lb,h=a.Zb+g.Ja.oc/this.s.scale}else e=c+this.Tb.x,d=e+this.ob,h=a.Zb,f=a.Zb+a.lb-g.Ja.oc/this.s.scale;this.s.G?e<h?c=-(h-this.Tb.x+this.ob):d>f&&(c=-(f-this.Tb.x)):e<h?c=h-this.Tb.x:d>f&&(c=f-this.Tb.x-this.ob)}e=c;c=-this.Uc/4;if(!(this.Uc>a.rb)){d=this.Tb.y+c;f=d+this.Uc;h=a.hc;var k=a.hc+a.rb-g.Ja.oc/this.s.scale,l=this.Tb.y;d<h?c=h-l:f>k&&(c=k-l-this.Uc)}h=c;f=this.$z.getBBox();c={x:e,y:-this.Uc-g.va.Vq};d={x:-this.ob-30,y:h};h={x:f.width,y:h};k={x:e,y:f.height};e=f.width<f.height?
h:k;f=f.width<f.height?k:h;h=Ha(this,c,a);k=Ha(this,d,a);l=Ha(this,e,a);a=Math.max(h,k,l,Ha(this,f,a));h==a?(this.Qg=c.x,this.Th=c.y):k==a?(this.Qg=d.x,this.Th=d.y):l==a?(this.Qg=e.x,this.Th=e.y):(this.Qg=f.x,this.Th=f.y)}Ca(this);Da(this);this.wu&&this.wu()};
function Da(a){var c=[],d=a.ob/2,e=a.Uc/2,f=-a.Qg,h=-a.Th;if(d==f&&e==h)c.push("M "+d+","+e);else{h-=e;f-=d;a.s.G&&(f*=-1);var k=Math.sqrt(h*h+f*f),l=Math.acos(f/k);0>h&&(l=2*Math.PI-l);var m=l+Math.PI/2;m>2*Math.PI&&(m-=2*Math.PI);var n=Math.sin(m),q=Math.cos(m),r=a.Ts();m=(r.width+r.height)/g.na.GA;m=Math.min(m,r.width,r.height)/4;r=1-g.na.DA/k;f=d+r*f;h=e+r*h;r=d+m*q;var u=e+m*n;d-=m*q;e-=m*n;n=l+a.aD;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/g.na.kv;k=Math.cos(n)*k/g.na.kv;c.push("M"+r+","+
u);c.push("C"+(r+k)+","+(u+l)+" "+f+","+h+" "+f+","+h);c.push("C"+f+","+h+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.Vr.setAttribute("d",c.join(" "))}b.mf=function(a){this.Ql.setAttribute("fill",a);this.Vr.setAttribute("fill",a)};b.I=function(){g.na.Zu();g.g.o.removeNode(this.Ud);this.$z=this.Ze=this.s=this.Uf=this.Ql=this.Vr=this.Ud=null};b.Qt=function(a,c){a?a.Gj(c.x,c.y):this.moveTo(c.x,c.y);this.Qg=this.s.G?this.Tb.x-c.x-this.ob:c.x-this.Tb.x;this.Th=c.y-this.Tb.y;Da(this)};
b.Oa=function(){return new g.g.S(this.Tb.x+this.Qg,this.Tb.y+this.Th)};g.g.xml={};g.g.xml.eC="https://developers.google.com/blockly/xml";g.g.xml.document=function(){return document};g.g.xml.createElement=function(a){return g.g.xml.document().createElementNS(g.g.xml.eC,a)};g.g.xml.createTextNode=function(a){return g.g.xml.document().createTextNode(a)};g.g.xml.QG=function(a){return(new DOMParser).parseFromString(a,"text/xml")};g.g.xml.Dd=function(a){return(new XMLSerializer).serializeToString(a)};g.i.tf=function(a){g.i.tf.w.constructor.call(this);this.zc=a.id;this.uc=a.v.id};g.g.object.T(g.i.tf,g.i.Abstract);g.i.tf.prototype.Wa=function(){var a=g.i.tf.w.Wa.call(this);a.blockId=this.zc;return a};g.i.tf.prototype.sa=function(a){g.i.tf.w.sa.call(this,a);this.zc=a.blockId};g.i.$g=function(a,c,d,e,f){a&&(g.i.$g.w.constructor.call(this,a),this.element=c,this.name=d,this.oldValue=e,this.newValue=f)};g.g.object.T(g.i.$g,g.i.tf);g.i.eg=g.i.$g;b=g.i.$g.prototype;b.type=g.i.ei;
b.Wa=function(){var a=g.i.$g.w.Wa.call(this);a.element=this.element;this.name&&(a.name=this.name);a.newValue=this.newValue;return a};b.sa=function(a){g.i.$g.w.sa.call(this,a);this.element=a.element;this.name=a.name;this.newValue=a.newValue};b.Lk=function(){return this.oldValue==this.newValue};
b.run=function(a){var c=x(ta(this),this.zc);if(c)switch(c.Gd&&c.Gd.Qb(!1),a=a?this.newValue:this.oldValue,this.element){case "field":(c=B(c,this.name))?c.setValue(a):console.warn("Can't set non-existent field: "+this.name);break;case "comment":c.Wh(a||null);break;case "collapsed":c.Ug(!!a);break;case "disabled":c.Kc(!a);break;case "inline":c.Je(!!a);break;case "mutation":var d="";c.eb&&(d=(d=c.eb())&&g.O.Dd(d));if(c.Ab){var e=g.O.$h(a||"<mutation/>");c.Ab(e)}g.i.Ka(new g.i.$g(c,"mutation",null,d,
a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.zc)};g.i.ie=function(a){a&&(g.i.ie.w.constructor.call(this,a),this.xml=a.v.ca?g.O.Sr(a):g.O.lh(a),this.Lg=g.i.Zx(a))};g.g.object.T(g.i.ie,g.i.tf);g.i.Rn=g.i.ie;g.i.ie.prototype.type=g.i.Wn;g.i.ie.prototype.Wa=function(){var a=g.i.ie.w.Wa.call(this);a.xml=g.O.Dd(this.xml);a.ids=this.Lg;return a};
g.i.ie.prototype.sa=function(a){g.i.ie.w.sa.call(this,a);this.xml=g.O.$h(a.xml);this.Lg=a.ids};g.i.ie.prototype.run=function(a){var c=ta(this);if(a)a=g.g.xml.createElement("xml"),a.appendChild(this.xml),g.O.uh(a,c);else{a=0;for(var d;d=this.Lg[a];a++){var e=x(c,d);e?e.I(!1):d==this.zc&&console.warn("Can't uncreate non-existent block: "+d)}}};
g.i.Oe=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");g.i.Oe.w.constructor.call(this,a);this.$t=a.v.ca?g.O.Sr(a):g.O.lh(a);this.Lg=g.i.Zx(a)}};g.g.object.T(g.i.Oe,g.i.tf);g.i.MA=g.i.Oe;g.i.Oe.prototype.type=g.i.ol;g.i.Oe.prototype.Wa=function(){var a=g.i.Oe.w.Wa.call(this);a.ids=this.Lg;return a};g.i.Oe.prototype.sa=function(a){g.i.Oe.w.sa.call(this,a);this.Lg=a.ids};
g.i.Oe.prototype.run=function(a){var c=ta(this);if(a){a=0;for(var d;d=this.Lg[a];a++){var e=x(c,d);e?e.I(!1):d==this.zc&&console.warn("Can't delete non-existent block: "+d)}}else a=g.g.xml.createElement("xml"),a.appendChild(this.$t),g.O.uh(a,c)};g.i.ni=function(a){a&&(g.i.ni.w.constructor.call(this,a),a=Ia(this),this.oz=a.Bz,this.nz=a.My,this.Xt=a.gx)};g.g.object.T(g.i.ni,g.i.tf);g.i.ll=g.i.ni;b=g.i.ni.prototype;b.type=g.i.zl;
b.Wa=function(){var a=g.i.ni.w.Wa.call(this);this.nj&&(a.newParentId=this.nj);this.mj&&(a.newInputName=this.mj);this.Mh&&(a.newCoordinate=Math.round(this.Mh.x)+","+Math.round(this.Mh.y));return a};b.sa=function(a){g.i.ni.w.sa.call(this,a);this.nj=a.newParentId;this.mj=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.Mh=new g.g.S(Number(a[0]),Number(a[1])))};b.tj=function(){var a=Ia(this);this.nj=a.Bz;this.mj=a.My;this.Mh=a.gx};
function Ia(a){var c=x(ta(a),a.zc);a={};var d=c.getParent();if(d){a.Bz=d.id;a:{for(var e=0,f;f=d.P[e];e++)if(f.connection&&C(f.connection)==c){c=f;break a}c=null}c&&(a.My=c.name)}else a.gx=c.Oa();return a}b.Lk=function(){return this.oz==this.nj&&this.nz==this.mj&&g.g.S.ve(this.Xt,this.Mh)};
b.run=function(a){var c=ta(this),d=x(c,this.zc);if(d){var e=a?this.nj:this.oz,f=a?this.mj:this.nz;a=a?this.Mh:this.Xt;var h=null;if(e&&(h=x(c,e),!h)){console.warn("Can't connect to non-existent block: "+e);return}d.getParent()&&D(d);if(a)f=d.Oa(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.L||d.Y;if(f){if(c=E(h,f))var k=c.connection}else d.type==g.Se&&(k=h.V);k?d.connect(k):console.warn("Can't connect to non-existent input: "+f)}}else console.warn("Can't move non-existent block: "+this.zc)};g.i.od=function(a,c,d,e){g.i.od.w.constructor.call(this);this.zc=a?a.id:null;this.uc=a?a.v.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.Jc=!1};g.g.object.T(g.i.od,g.i.Abstract);g.i.od.prototype.type=g.i.xo;g.i.od.prototype.Wa=function(){var a=g.i.od.w.Wa.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.zc&&(a.blockId=this.zc);return a};
g.i.od.prototype.sa=function(a){g.i.od.w.sa.call(this,a);this.element=a.element;this.newValue=a.newValue;this.zc=a.blockId};g.wd=function(a){this.R=a};b=g.wd.prototype;b.Sw=!0;b.to=17;b.Nb=null;b.Wi=null;function Ja(a){a.Fd||(a.Fd=g.g.o.K("g",{"class":"blocklyIconGroup"},null),a.R.Wb&&g.g.o.qb(a.Fd,"blocklyIconGroupReadonly"),a.Cs(a.Fd),a.R.wa().appendChild(a.Fd),g.ka(a.Fd,"mouseup",a,a.mt),a.Yg())}b.I=function(){g.g.o.removeNode(this.Fd);this.Fd=null;this.Qb(!1);this.R=null};b.Yg=function(){};b.isVisible=function(){return!!this.Nb};b.mt=function(a){this.R.v.dc()||this.R.Wb||g.g.fj(a)||this.Qb(!this.isVisible())};
b.Ne=function(){this.isVisible()&&this.Nb.mf(this.R.oh)};function Ka(a){var c=a.R.Oa(),d=g.g.ze(a.Fd);c=new g.g.S(c.x+d.x+a.to/2,c.y+d.y+a.to/2);g.g.S.ve(a.Wi,c)||(a.Wi=c,a.isVisible()&&(a=a.Nb,a.Tb=c,a.Up&&Ca(a)))};g.Af=function(a){g.Af.w.constructor.call(this,a);Ja(this);this.ag={}};g.g.object.T(g.Af,g.wd);g.Af.prototype.Sw=!1;g.Af.prototype.Cs=function(a){g.g.o.K("path",{"class":"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},a);g.g.o.K("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);g.g.o.K("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)};
g.Af.SG=function(a){var c=g.g.o.K("text",{"class":"blocklyText blocklyBubbleText",y:g.na.Zc},null);a=a.split("\n");for(var d=0;d<a.length;d++){var e=g.g.o.K("tspan",{dy:"1em",x:g.na.Zc},c),f=document.createTextNode(a[d]);e.appendChild(f)}return c};b=g.Af.prototype;b.Qb=function(a){a!=this.isVisible()&&(g.i.Ka(new g.i.od(this.R,"warningOpen",!a,a)),a?this.hx():this.zx())};
b.hx=function(){this.qj=g.Af.SG(this.cc());this.Nb=new g.na(this.R.v,this.qj,this.R.Kd,this.Wi,null,null);Fa(this.Nb,this.R.id);if(this.R.G)for(var a=this.qj.getBBox().width,c=0,d;d=this.qj.childNodes[c];c++)d.setAttribute("text-anchor","end"),d.setAttribute("x",a+g.na.Zc);this.Ne()};b.zx=function(){this.Nb.I();this.qj=this.Nb=null};b.Yk=function(a,c){this.ag[c]!=a&&(a?this.ag[c]=a:delete this.ag[c],this.isVisible()&&(this.Qb(!1),this.Qb(!0)))};
b.cc=function(){var a=[],c;for(c in this.ag)a.push(this.ag[c]);return a.join("\n")};b.I=function(){this.R.Yc=null;g.wd.prototype.I.call(this)};g.Comment=function(a){g.Comment.w.constructor.call(this,a);this.ec=a.te;this.ec.text=this.ec.text||"";this.Yr="";Ja(this)};g.g.object.T(g.Comment,g.wd);b=g.Comment.prototype;
b.Cs=function(a){g.g.o.K("circle",{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},a);g.g.o.K("path",{"class":"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},a);g.g.o.K("rect",{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},a)};
b.ks=function(){this.om=g.g.o.K("foreignObject",{x:g.na.Zc,y:g.na.Zc},null);var a=document.createElementNS(g.g.o.Vj,"body");a.setAttribute("xmlns",g.g.o.Vj);a.className="blocklyMinimalBody";var c=this.Fj=document.createElementNS(g.g.o.Vj,"textarea");c.className="blocklyCommentTextarea";c.setAttribute("dir",this.R.G?"RTL":"LTR");c.value=this.ec.text;La(this);a.appendChild(c);this.om.appendChild(a);g.ka(c,"mouseup",this,this.LG,!0,!0);g.ka(c,"wheel",this,function(d){d.stopPropagation()});g.ka(c,"change",
this,function(){this.Yr!=this.ec.text&&g.i.Ka(new g.i.eg(this.R,"comment",null,this.Yr,this.ec.text))});g.ka(c,"input",this,function(){this.ec.text=c.value});setTimeout(c.focus.bind(c),0);return this.om};b.Yg=function(){g.Comment.w.Yg.call(this);this.isVisible()&&(Ma(this),Na(this))};b.TF=function(){this.isVisible()&&(this.ec.size=this.Nb.Ts(),La(this))};
function La(a){var c=a.ec.size,d=2*g.na.Zc,e=c.width-d;c=c.height-d;a.om.setAttribute("width",e);a.om.setAttribute("height",c);a.Fj.style.width=e-4+"px";a.Fj.style.height=c-4+"px"}b.Qb=function(a){a!=this.isVisible()&&(g.i.Ka(new g.i.od(this.R,"commentOpen",!a,a)),(this.ec.mu=a)?Na(this):Ma(this))};
function Na(a){if(!a.R.cd()||g.g.userAgent.lg)g.Af.prototype.hx.call(a);else{a.Nb=new g.na(a.R.v,a.ks(),a.R.Kd,a.Wi,a.ec.size.width,a.ec.size.height);Fa(a.Nb,a.R.id);var c=a.TF.bind(a);a.Nb.wu=c;a.Ne()}}function Ma(a){a.qj?g.Af.prototype.zx.call(a):(a.Nb.I(),a.Nb=null,a.Fj=null,a.om=null)}b.LG=function(){Ga(this.Nb)&&this.Fj.focus();this.Yr=this.ec.text};b.Ts=function(){return this.ec.size};b.kn=function(a,c){this.Nb?this.Nb.kn(a,c):(this.ec.size.width=a,this.ec.size.height=c)};
b.cc=function(){return this.ec.text||""};b.Yk=function(a){this.ec.text!=a&&(this.ec.text=a,Oa(this))};function Oa(a){a.Fj?a.Fj.value=a.ec.text:a.qj&&(a.qj.firstChild.textContent=a.ec.text)}b.I=function(){this.R.qk=null;g.wd.prototype.I.call(this)};g.hd={};g.hd.qt=!1;g.hd.register=function(a){if(g.hd.qt)throw Error("CSS already injected");Array.prototype.push.apply(g.hd.Aq,a);a.length=0};g.hd.Dh=function(a,c){if(!g.hd.qt){g.hd.qt=!0;var d=g.hd.Aq.join("\n");g.hd.Aq.length=0;a&&(a=c.replace(/[\\/]$/,""),d=d.replace(/<<<PATH>>>/g,a),a=document.createElement("style"),d=document.createTextNode(d),a.appendChild(d),document.head.insertBefore(a,document.head.firstChild))}};g.hd.Du=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")};
g.hd.Aq=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;",
"}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);",
"color: #000;","display: none;","font-family: sans-serif;","font-size: 9pt;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: fixed;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-radius: 2px;","padding: 4px;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;",
"overflow-x: hidden;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;","cursor: pointer;","}",".arrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;",
"border-color: inherit;","}",".arrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;",
"stroke-width: 1;","}",".blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<<PATH>>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;",
"}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;",
"}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none","}",".blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",".blocklyReplaceable .blocklyPathLight,",".blocklyReplaceable .blocklyPathDark {","display: none;","}",".blocklyText {","cursor: default;","fill: #fff;","font-family: sans-serif;",
"font-size: 11pt;","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyNonEditableText>rect,",".blocklyEditableText>rect {","fill: #fff;","fill-opacity: .6;","}",".blocklyNonEditableText>text,",".blocklyEditableText>text {","fill: #000;","}",".blocklyEditableText:hover>rect {","stroke: #fff;","stroke-width: 2;","}",".blocklyBubbleText {","fill: #000;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklySvg text, .blocklyBlockDragSurface text {",
"user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;",
"}",".blocklyCommentForeignObject {","position: relative;","z-index: 0;","}",".blocklyCommentRect {","fill: #E7DE8E;","stroke: #bcA903;","stroke-width: 1px","}",".blocklyCommentTarget {","fill: transparent;","stroke: #bcA903;","}",".blocklyCommentTargetFocused {","fill: none;","}",".blocklyCommentHandleTarget {","fill: none;","}",".blocklyCommentHandleTargetFocused {","fill: transparent;","}",".blocklyFocused>.blocklyCommentRect {","fill: #B9B272;","stroke: #B9B272;","}",".blocklySelected>.blocklyCommentTarget {",
"stroke: #fc3;","stroke-width: 3px;","}",".blocklyCommentTextarea {","background-color: #fef49c;","border: 0;","outline: 0;","margin: 0;","padding: 3px;","resize: none;","display: block;","overflow: hidden;","}",".blocklyCommentDeleteIcon {","cursor: pointer;","fill: #000;","display: none","}",".blocklySelected > .blocklyCommentDeleteIcon {","display: block","}",".blocklyDeleteIconShape {","fill: #000;","stroke: #000;","stroke-width: 1px;","}",".blocklyDeleteIconShape.blocklyDeleteIconHighlighted {",
"stroke: #fc3;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","font-family: sans-serif;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {",
"z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal, .blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",
".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem {","padding-left: 28px;","}",".blocklyWidgetDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl,",".blocklyDropDownDiv .blocklyDropdownMenu .goog-menuitem.goog-menuitem-rtl {",
"padding-left: 5px;","padding-right: 28px;","}",".blocklyVerticalCursor {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","background: url(<<<PATH>>>/sprites.png) no-repeat -48px -16px;","}",".blocklyWidgetDiv .goog-menu {","background: #fff;",
"border-color: transparent;","border-style: solid;","border-width: 1px;","cursor: default;","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","box-shadow: 0px 0px 3px 1px rgba(0,0,0,.3);","}",".blocklyWidgetDiv .goog-menu.focused {","box-shadow: 0px 0px 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .goog-menu {","cursor: default;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',
"outline: none;","z-index: 20000;","}",".blocklyWidgetDiv .goog-menuitem,",".blocklyDropDownDiv .goog-menuitem {","color: #000;","font: normal 13px Arial, sans-serif;","list-style: none;","margin: 0;","min-width: 7em;","border: none;","padding: 6px 15px;","white-space: nowrap;","cursor: pointer;","}",".blocklyWidgetDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyWidgetDiv .goog-menu-noicon .goog-menuitem,",".blocklyDropDownDiv .goog-menu-nocheckbox .goog-menuitem,",".blocklyDropDownDiv .goog-menu-noicon .goog-menuitem {",
"padding-left: 12px;","}",".blocklyWidgetDiv .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-content {","font: normal 13px Arial, sans-serif;","}",".blocklyWidgetDiv .goog-menuitem-content {","color: #000;","}",".blocklyDropDownDiv .goog-menuitem-content {","color: #000;","}",".blocklyWidgetDiv .goog-menuitem-disabled,",".blocklyDropDownDiv .goog-menuitem-disabled {","cursor: inherit;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-content,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-content {",
"color: #ccc !important;","}",".blocklyWidgetDiv .goog-menuitem-disabled .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-disabled .goog-menuitem-icon {","opacity: .3;","filter: alpha(opacity=30);","}",".blocklyWidgetDiv .goog-menuitem-highlight ,",".blocklyDropDownDiv .goog-menuitem-highlight {","background-color: rgba(0,0,0,.1);","}",".blocklyWidgetDiv .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-icon {",
"background-repeat: no-repeat;","height: 16px;","left: 6px;","position: absolute;","right: auto;","vertical-align: middle;","width: 16px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","left: auto;","right: 6px;","}",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-option-selected .goog-menuitem-icon,",
".blocklyDropDownDiv .goog-option-selected .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-option-selected .goog-menuitem-icon {","position: static;","float: left;","margin-left: -24px;","}",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyWidgetDiv .goog-menuitem-rtl .goog-menuitem-icon,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-checkbox,",".blocklyDropDownDiv .goog-menuitem-rtl .goog-menuitem-icon {","float: right;","margin-right: -24px;","}"];g.Tj=function(a,c,d,e){this.s=a;this.jb=c;this.ag=d.getAttribute("text");this.ed=new g.g.S(0,0);this.Og=e;this.Fo=d.getAttribute("callbackKey")||d.getAttribute("callbackkey");this.jx=d.getAttribute("web-class")||null};g.Tj.Qe=5;b=g.Tj.prototype;b.width=0;b.height=0;b.Fe=null;
b.Ga=function(){var a=this.Og?"blocklyFlyoutLabel":"blocklyFlyoutButton";this.jx&&(a+=" "+this.jx);this.H=g.g.o.K("g",{"class":a},this.s.bb);if(!this.Og)var c=g.g.o.K("rect",{"class":"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.H);a=g.g.o.K("rect",{"class":this.Og?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.H);var d=g.g.o.K("text",{"class":this.Og?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.H);d.textContent=g.g.nc(this.ag);
this.Og&&(this.Tu=d,this.s.Rb.subscribe(this.Tu,"flyoutText","fill"));this.width=g.g.o.jp(d);this.height=20;this.Og||(this.width+=2*g.Tj.Qe,c.setAttribute("width",this.width),c.setAttribute("height",this.height));a.setAttribute("width",this.width);a.setAttribute("height",this.height);d.setAttribute("x",this.width/2);d.setAttribute("y",this.height-g.Tj.Qe);Pa(this);this.Fe=g.ka(this.H,"mouseup",this,this.jG);return this.H};b.show=function(){Pa(this);this.H.setAttribute("display","block")};
function Pa(a){a.H.setAttribute("transform","translate("+a.ed.x+","+a.ed.y+")")}b.moveTo=function(a,c){this.ed.x=a;this.ed.y=c;Pa(this)};b.I=function(){this.Fe&&g.Xa(this.Fe);this.H&&g.g.o.removeNode(this.H);this.Tu&&this.s.Rb.unsubscribe(this.Tu)};
b.jG=function(a){(a=this.jb.Gg(a))&&a.cancel();this.Og&&this.Fo?console.warn("Labels should not have callbacks. Label text: "+this.ag):this.Og||this.Fo&&Qa(this.jb,this.Fo)?this.Og||Qa(this.jb,this.Fo)(this):console.warn("Buttons should have callbacks. Button text: "+this.ag)};g.hd.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,},.blocklyFlyoutLabelText {,fill: #000;,}".split(","));g.sf=function(a){this.name=a};g.F=function(a,c,d){if(!c)throw Error("Cannot create a node without a location.");this.Dn=a;this.Dm=g.F.mF(a);this.qa=c;(a=d||null)&&a.uA&&(this.vA=a.uA)};g.F.types={ke:"field",Nd:"block",mg:"input",fk:"output",oe:"next",pe:"previous",xf:"stack",Ci:"workspace"};g.F.dB=-20;g.F.mF=function(a){switch(a){case g.F.types.pe:case g.F.types.oe:case g.F.types.mg:case g.F.types.fk:return!0}return!1};g.F.am=function(a){return new g.F(g.F.types.ke,a)};
g.F.Ff=function(a){return a?a.type==g.Ua||a.type==g.Ra&&a.Lf()?g.F.Ki(a.Lf()):a.type==g.Ra?new g.F(g.F.types.oe,a):a.type==g.Re?new g.F(g.F.types.fk,a):a.type==g.Se?new g.F(g.F.types.pe,a):null:null};g.F.Ki=function(a){return a?new g.F(g.F.types.mg,a.connection):null};g.F.zg=function(a){return new g.F(g.F.types.Nd,a)};g.F.bm=function(a){return new g.F(g.F.types.xf,a)};g.F.cm=function(a,c){return new g.F(g.F.types.Ci,a,{uA:c})};b=g.F.prototype;b.Jb=function(){return this.Dn};
function Ra(a,c){a=a.qa;a instanceof g.Qn||(a=a.B);if(!a||!a.v)return null;var d=G(a);a=A(d.v,!0);for(var e=0,f;f=a[e];e++)if(d.id==f.id)return c=e+(c?1:-1),-1==c||c==a.length?null:g.F.bm(a[c]);throw Error("Couldn't find "+(c?"next":"previous")+" stack?!");}function Sa(a){if(!a)return null;do var c=a.Y&&C(a.Y);while(c&&t(c)==a&&(a=c));return(c=a.Y||a.L)&&c.ga&&c.ga.Lf()?g.F.Ki(c.ga.Lf()):g.F.bm(a)}
b.next=function(){switch(this.Dn){case g.F.types.xf:return Ra(this,!0);case g.F.types.fk:return g.F.zg(this.qa.B);case g.F.types.ke:a:{var a=this.qa,c=a.Lf();var d=a.B;a=c.Na.indexOf(a)+1;c=d.P.indexOf(c);for(var e;e=d.P[c];c++){for(var f=e.Na;a<f.length;){if(f[a].uf){d=g.F.am(f[a]);break a}a++}a=0;if(e.connection){d=g.F.Ki(e);break a}}d=null}return d;case g.F.types.mg:a:{a=this.qa.Lf();d=a.B;for(a=d.P.indexOf(a)+1;c=d.P[a];a++){e=c.Na;f=0;for(var h;h=e[f];f++)if(h.uf){d=g.F.am(h);break a}if(c.connection){d=
g.F.Ki(c);break a}}d=null}return d;case g.F.types.Nd:if(d=this.qa.V)return g.F.Ff(d);break;case g.F.types.pe:return g.F.zg(this.qa.B);case g.F.types.oe:if(d=this.qa.ga)return g.F.Ff(d)}return null};
b.Bm=function(){switch(this.Dn){case g.F.types.Ci:var a=A(this.qa,!0);if(0<a.length)return g.F.bm(a[0]);break;case g.F.types.xf:a=this.qa;var c=a.Y||a.L;return c?g.F.Ff(c):g.F.zg(a);case g.F.types.Nd:a:{a=this.qa.P;c=0;for(var d;d=a[c];c++){for(var e=d.Na,f=0,h;h=e[f];f++)if(h.uf){a=g.F.am(h);break a}if(d.connection){a=g.F.Ki(d);break a}}a=null}return a;case g.F.types.mg:if(a=this.qa.ga)return g.F.Ff(a)}return null};
b.Rf=function(){switch(this.Dn){case g.F.types.xf:return Ra(this,!1);case g.F.types.ke:a:{var a=this.qa;var c=a.Lf();var d=a.B;a=c.Na.indexOf(a)-1;for(var e=d.P.indexOf(c),f;f=d.P[e];e--){if(f.connection&&f!==c){c=g.F.Ki(f);break a}for(f=f.Na;-1<a;){if(f[a].uf){c=g.F.am(f[a]);break a}a--}0<=e-1&&(a=d.P[e-1].Na.length-1)}c=null}return c;case g.F.types.mg:a:{c=this.qa.Lf();d=c.B;for(a=d.P.indexOf(c);e=d.P[a];a--){if(e.connection&&e!==c){c=g.F.Ki(e);break a}e=e.Na;f=e.length-1;for(var h;h=e[f];f--)if(h.uf){c=
g.F.am(h);break a}}c=null}return c;case g.F.types.Nd:c=this.qa.L;if(c=this.qa.Y||c)return g.F.Ff(c);break;case g.F.types.pe:if((c=this.qa.ga)&&!c.Lf())return g.F.Ff(c);break;case g.F.types.oe:return g.F.zg(this.qa.B)}return null};
b.Xm=function(){switch(this.Dn){case g.F.types.xf:var a=this.qa.Oa();return g.F.cm(this.qa.v,new g.g.S(a.x,a.y+g.F.dB));case g.F.types.fk:return(a=this.qa.ga)?g.F.Ff(a):g.F.bm(this.qa.B);case g.F.types.ke:return g.F.zg(this.qa.B);case g.F.types.mg:return g.F.zg(this.qa.B);case g.F.types.Nd:return Sa(this.qa);case g.F.types.pe:return Sa(this.qa.B);case g.F.types.oe:return Sa(this.qa.B)}return null};g.g.Ia={hL:0,aJ:3,HA:8,nw:9,sJ:12,Fq:13,uC:16,MH:17,CA:18,gK:19,zH:20,Gq:27,MK:32,fK:33,eK:34,cI:35,JI:36,Oq:37,zo:38,ir:39,$n:40,jK:43,lK:44,Lq:45,ol:46,ZERO:48,ONE:49,$K:50,UK:51,zI:52,wI:53,IK:54,GK:55,bI:56,oJ:57,uI:59,sI:61,rI:173,tI:163,nK:63,rH:64,xA:65,tH:66,NA:67,cB:68,E:69,eI:70,AI:71,EI:72,BB:73,OI:74,KB:75,QI:76,$I:77,mJ:78,IJ:79,dK:80,Q:81,oK:82,rC:83,CC:84,aL:85,HC:86,LC:87,zw:88,kL:89,RC:90,bC:91,iL:92,KH:93,HJ:96,AJ:97,GJ:98,FJ:99,wJ:100,vJ:101,EJ:102,DJ:103,uJ:104,zJ:105,yJ:106,CJ:107,
xJ:109,BJ:110,tJ:111,fI:112,jI:113,kI:114,lI:115,mI:116,nI:117,oI:118,pI:119,qI:120,gI:121,hI:122,iI:123,rJ:144,CK:145,vI:166,SI:183,EK:186,NH:189,dI:187,HH:188,hK:190,JK:191,nH:192,VK:192,HK:222,JJ:219,uH:220,DH:221,gL:224,bJ:224,cJ:91,dJ:93,fL:229,eL:252,iK:255};g.mb={};g.mb.ib={};g.mb.ib.hj={};g.mb.ib.Ot={uC:"Shift",WA:"Control",CA:"Alt",bC:"Meta"};g.mb.ib.RL=function(a,c){var d=g.mb.ib.GE(c);d&&delete g.mb.ib.hj[d];g.mb.ib.hj[a]=c};g.mb.ib.EG=function(a){g.mb.ib.hj=a};g.mb.ib.yL=function(){var a={};g.g.object.kj(a,g.mb.ib.hj);return a};g.mb.ib.rE=function(a){return g.mb.ib.hj[a]};g.mb.ib.GE=function(a){for(var c=Object.keys(g.mb.ib.hj),d=0,e;e=c[d];d++)if(g.mb.ib.hj[e].name===a.name)return e;return null};
g.mb.ib.BG=function(a){for(var c=g.g.object.values(g.mb.ib.Ot),d="",e=0,f;f=c[e];e++)a.getModifierState(f)&&(d+=f);return d+=a.keyCode};g.mb.ib.GD=function(){for(var a=g.g.Ia.KB,c=[g.mb.ib.Ot.WA],d="",e=g.g.object.values(g.mb.ib.Ot),f=0,h;h=c[f];f++)if(-1<e.indexOf(h))d+=h;else throw Error(h+" is not a valid modifier key.");return d+a};
g.mb.ib.ED=function(){var a={},c=g.mb.ib.GD();a[g.g.Ia.LC]=g.navigation.tq;a[g.g.Ia.xA]=g.navigation.fv;a[g.g.Ia.rC]=g.navigation.rq;a[g.g.Ia.cB]=g.navigation.ev;a[g.g.Ia.BB]=g.navigation.zA;a[g.g.Ia.Fq]=g.navigation.AA;a[g.g.Ia.zw]=g.navigation.yA;a[g.g.Ia.CC]=g.navigation.BA;a[g.g.Ia.E]=g.navigation.qq;a[g.g.Ia.Gq]=g.navigation.qq;a[c]=g.navigation.gv;return a};g.navigation={};g.navigation.Pk=null;g.navigation.mw=1;g.navigation.Gl=2;g.navigation.vr=3;g.navigation.Li=g.navigation.Gl;g.navigation.Za={pe:"previous",oe:"next",fo:"in",qo:"out",Lq:"insert",Tq:"mark",Dv:"disconnect",qw:"toolbox",Hq:"exit",xr:"toggle_keyboard_nav"};g.navigation.Rx=function(){var a=g.ub(),c=a.oa;c&&(g.navigation.Li=g.navigation.vr,g.navigation.Qz(!1),a.Xb.Ob||g.navigation.Lt(),c.ud.Id||(a=c.ud,(c=a.Ae())&&a.Ox&&Ta(c,a.Ox)))};
g.navigation.Qx=function(){g.navigation.Li=g.navigation.mw;var a=g.ub();var c=a.oa;c=c?c.M:Ua(a);a.Xb.Ob||g.navigation.Lt();c&&c.Dk()&&(a=A(c.Dk(),!0),0<a.length&&(a=a[0],a=g.F.bm(a),w(g.navigation.yh(),a)))};g.navigation.ap=function(){g.mc();var a=g.ub(),c=a.Va,d=!!a.oa,e=A(a,!0);g.navigation.Qz(d);g.navigation.Li=g.navigation.Gl;0<e.length?w(c,g.navigation.bt(e[0])):(a=g.F.cm(a,new g.g.S(100,100)),w(c,a))};
g.navigation.yh=function(){var a=g.ub(),c=null;a.ca&&(c=(a=(c=a.oa)?c.M:Ua(a))?a.s.Va:null);return c};g.navigation.lF=function(){var a=g.ub(),c=Ua(a);if(c&&c.isVisible()){var d=g.navigation.yh().Ob.qa;d.isEnabled()?(c=Va(c,d),c.za(),Wa(c,!1),w(a.Va,g.F.zg(c)),g.navigation.fz()||g.navigation.fd("Something went wrong while inserting a block from the flyout."),g.navigation.ap(),w(a.Va,g.navigation.bt(c)),g.navigation.tG()):g.navigation.fd("Can't insert a disabled block.")}else g.navigation.fd("Trying to insert from the flyout when the flyout does not  exist or is not visible")};
g.navigation.Qz=function(a){g.navigation.yh()&&(g.navigation.yh().ya(),a&&Ua(g.ub()).ya())};
g.navigation.AF=function(){var a=g.ub().Xb.Ob,c=g.ub().Va.Ob;if(!a)return g.navigation.fd("Cannot insert with no marked node."),!1;if(!c)return g.navigation.fd("Cannot insert with no cursor node."),!1;a=a.Jb();c=c.Jb();return a==g.F.types.ke?(g.navigation.fd("Should not have been able to mark a field."),!1):a==g.F.types.Nd?(g.navigation.fd("Should not have been able to mark a block."),!1):a==g.F.types.xf?(g.navigation.fd("Should not have been able to mark a stack."),!1):c==g.F.types.ke?(g.navigation.fd("Cannot attach a field to anything else."),
!1):c==g.F.types.Ci?(g.navigation.fd("Cannot attach a workspace to anything else."),!1):!0};g.navigation.GF=function(a,c){if(a.$a)return g.navigation.fd("Cannot move a shadow block to the workspace."),!1;a.getParent()&&D(a,!1);a.moveTo(c.vA);return!0};
g.navigation.fz=function(){var a=g.ub().Xb.Ob,c=g.ub().Va.Ob;if(!g.navigation.AF())return!1;var d=a.Jb(),e=c.Jb(),f=c.qa,h=a.qa;if(a.Dm&&c.Dm)return g.navigation.Xe(f,h);if(a.Dm&&(e==g.F.types.Nd||e==g.F.types.xf))return g.navigation.Ny(f,h);if(d==g.F.types.Ci)return c=g.navigation.$s(c),g.navigation.GF(c,a);g.navigation.fd("Unexpected state in Blockly.navigation.modify_.");return!1};g.navigation.YD=function(a,c){var d=a.B,e=c.B;G(d)==G(e)&&(-1<p(d,!1).indexOf(e)?g.navigation.fp(c).disconnect():g.navigation.fp(a).disconnect())};
g.navigation.Pt=function(a,c){if(!a||!c)return!1;var d=a.B;return Xa(c,a)==g.ra.Sn?(g.navigation.YD(a,c),H(c)||a.type!=g.Ra&&a.type!=g.Ua||G(d).moveBy(c.Sb-a.Sb,c.Ya-a.Ya),c.connect(a),!0):!1};g.navigation.fp=function(a){var c=a.B;return H(a)?c.Y?c.Y:c.L?c.L:null:a};g.navigation.py=function(a){return H(a)?a:a.ga?a.ga:null};
g.navigation.Xe=function(a,c){if(!a||!c)return!1;var d=g.navigation.fp(a),e=g.navigation.py(c),f=g.navigation.py(a),h=g.navigation.fp(c);if(d&&e&&g.navigation.Pt(d,e)||f&&h&&g.navigation.Pt(f,h)||g.navigation.Pt(a,c))return!0;try{Ya(c,a)}catch(k){g.navigation.fd("Connection failed with error: "+k)}return!1};
g.navigation.Ny=function(a,c){switch(c.type){case g.Se:if(g.navigation.Xe(a.V,c))return!0;break;case g.Ra:if(g.navigation.Xe(a.Y,c))return!0;break;case g.Ua:if(g.navigation.Xe(a.L,c))return!0;break;case g.Re:for(var d=0;d<a.P.length;d++){var e=a.P[d].connection;if(e&&e.type===g.Ua&&g.navigation.Xe(e,c))return!0}if(a.L&&g.navigation.Xe(a.L,c))return!0}g.navigation.fd("This block can not be inserted at the marked location.");return!1};
g.navigation.XD=function(){var a=g.ub(),c=a.Va.Ob;if(c.Dm){var d=c.qa;d.isConnected()?(c=H(d)?d:d.ga,d=H(d)?d.ga:d,d.B.$a?g.navigation.Gt("Cannot disconnect a shadow block"):(c.disconnect(),Za(d,c),$a(G(c.B)),c=g.F.Ff(c),w(a.Va,c))):g.navigation.Gt("Cannot disconnect unconnected connection")}else g.navigation.Gt("Cannot disconnect blocks when the cursor is not on a connection")};g.navigation.Lt=function(){var a=g.ub();w(a.Xb,a.Va.Ob)};g.navigation.tG=function(){var a=g.ub();w(a.Xb,null);a.Xb.ya()};
g.navigation.Eb=function(a){g.navigation.Li=a};g.navigation.$s=function(a){return a?a.Jb()===g.F.types.Nd?a.qa:a.Jb()===g.F.types.xf?a.qa:a.Jb()===g.F.types.Ci?null:a.qa.B:null};g.navigation.bt=function(a){var c=a.Y||a.L;return c?g.F.Ff(c):g.F.zg(a)};g.navigation.kz=function(a){var c=g.ub();if(c&&(c=c.Va)){var d=g.navigation.$s(c.Ob);d===a?d.getParent()?(a=d.Y||d.L)&&w(c,g.F.Ff(a.ga)):w(c,g.F.cm(d.v,d.Oa())):-1<a.xh(!1).indexOf(d)&&w(c,g.F.cm(d.v,d.Oa()))}};
g.navigation.HF=function(a){var c=g.ub().Va;if(c){var d=g.navigation.$s(c.Ob);d===a&&w(c,g.F.zg(d))}};g.navigation.Ls=function(){g.De||(g.De=!0,g.navigation.ap())};g.navigation.WD=function(){if(g.De){var a=g.ub();g.De=!1;a.Va.ya();a.Xb.ya();g.navigation.yh()&&g.navigation.yh().ya()}};g.navigation.Gt=function(a){g.navigation.Pk?g.navigation.Pk("log",a):console.log(a)};g.navigation.fd=function(a){g.navigation.Pk?g.navigation.Pk("warn",a):console.warn(a)};
g.navigation.uL=function(a){g.navigation.Pk?g.navigation.Pk("error",a):console.error(a)};g.navigation.wz=function(a){a=g.mb.ib.BG(a);return(a=g.mb.ib.rE(a))?g.navigation.Nh(a):!1};g.navigation.Nh=function(a){var c=g.ub().options.readOnly,d=!1;g.De?c?-1<g.navigation.pC.indexOf(a)&&(d=g.navigation.zy(a)):d=g.navigation.zy(a):a.name===g.navigation.Za.xr&&(g.navigation.Ls(),d=!0);return d};
g.navigation.zy=function(a){var c=g.ub();if(a.name===g.navigation.Za.xr)return g.navigation.WD(),!0;if(a.name===g.navigation.Za.qw)return c.oa?g.navigation.Rx():g.navigation.Qx(),!0;if(g.navigation.Li===g.navigation.Gl){c=c.Va.Ob;var d=!1;c&&c.Jb()===g.F.types.ke&&(d=c.qa.Nh(a));d||(d=g.navigation.hH(a));return d}return g.navigation.Li===g.navigation.mw?g.navigation.qE(a):g.navigation.Li===g.navigation.vr?g.navigation.VG(a):!1};
g.navigation.hH=function(a){var c=g.ub();switch(a.name){case g.navigation.Za.pe:return c.Va.Rf(),!0;case g.navigation.Za.qo:return c.Va.Xm(),!0;case g.navigation.Za.oe:return c.Va.next(),!0;case g.navigation.Za.fo:return c.Va.Bm(),!0;case g.navigation.Za.Lq:return g.navigation.fz(),!0;case g.navigation.Za.Tq:return g.navigation.PE(),!0;case g.navigation.Za.Dv:return g.navigation.XD(),!0;default:return!1}};
g.navigation.qE=function(a){switch(a.name){case g.navigation.Za.pe:return g.navigation.yh().Rf(),!0;case g.navigation.Za.qo:return g.navigation.Rx(),!0;case g.navigation.Za.oe:return g.navigation.yh().next(),!0;case g.navigation.Za.Tq:return g.navigation.lF(),!0;case g.navigation.Za.Hq:return g.navigation.ap(),!0;default:return!1}};
g.navigation.VG=function(a){if(a.name===g.navigation.Za.Hq)return g.navigation.ap(),!0;var c=g.ub().oa.Nh(a);return c||a.name!==g.navigation.Za.fo?c:(g.navigation.Qx(),!0)};g.navigation.PE=function(){var a=g.ub().Va.Ob,c=a.Jb();c==g.F.types.ke?a.qa.Le():a.Dm||c==g.F.types.Ci?g.navigation.Lt():c==g.F.types.Nd?g.navigation.fd("Cannot mark a block."):c==g.F.types.xf&&g.navigation.fd("Cannot mark a stack.")};g.navigation.tq=new g.sf(g.navigation.Za.pe);g.navigation.fv=new g.sf(g.navigation.Za.qo);
g.navigation.rq=new g.sf(g.navigation.Za.oe);g.navigation.ev=new g.sf(g.navigation.Za.fo);g.navigation.zA=new g.sf(g.navigation.Za.Lq);g.navigation.AA=new g.sf(g.navigation.Za.Tq);g.navigation.yA=new g.sf(g.navigation.Za.Dv);g.navigation.BA=new g.sf(g.navigation.Za.qw);g.navigation.qq=new g.sf(g.navigation.Za.Hq);g.navigation.gv=new g.sf(g.navigation.Za.xr);g.navigation.pC=[g.navigation.tq,g.navigation.fv,g.navigation.ev,g.navigation.rq,g.navigation.gv];g.g.io={};g.g.io.NF=0;g.g.io.HE=function(){return"blockly:"+(g.g.io.NF++).toString(36)};g.vc=function(){this.Sz=g.vc.px;this.Ik=null;this.Wc=!1;this.Hd=this.cb=null;this.fb=[];this.bs={}};g.vc.px=!1;g.vc.Error={vq:"Component already rendered",dr:"Unable to set parent component",RA:"Child component index out of bounds"};b=g.vc.prototype;b.ua=function(){return this.Ik||(this.Ik=g.g.io.HE())};b.ta=function(){return this.cb};
b.Xk=function(a){if(this==a)throw Error(g.vc.Error.dr);var c;if(c=a&&this.Hd&&this.Ik)c=(c=this.Ik)?this.Hd.bs[c]||null:null;if(c&&this.Hd!=a)throw Error(g.vc.Error.dr);this.Hd=a};b.getParent=function(){return this.Hd};b.Ga=function(){this.cb=document.createElement("div")};b.za=function(a){this.Tf(a)};b.Tf=function(a,c){if(this.Wc)throw Error(g.vc.Error.vq);this.cb||this.Ga();a?a.insertBefore(this.cb,c||null):document.body.appendChild(this.cb);this.Hd&&!this.Hd.Wc||this.bf()};
b.bf=function(){this.Wc=!0;ab(this,function(a){!a.Wc&&a.ta()&&a.bf()})};b.wh=function(){ab(this,function(a){a.Wc&&a.wh()});this.Wc=!1};b.I=function(){this.aE||(this.aE=!0,this.im())};b.im=function(){this.Wc&&this.wh();ab(this,function(a){a.I()});this.cb&&g.g.o.removeNode(this.cb);this.Hd=this.cb=this.bs=this.fb=null};
b.Ol=function(a,c,d){if(a.Wc&&(d||!this.Wc))throw Error(g.vc.Error.vq);if(0>c||c>this.fb.length)throw Error(g.vc.Error.RA);this.bs[a.ua()]=a;if(a.getParent()==this){var e=this.fb.indexOf(a);-1<e&&this.fb.splice(e,1)}a.Xk(this);this.fb.splice(c,0,a);a.Wc&&this.Wc&&a.getParent()==this?(d=this.cb,c=d.childNodes[c]||null,c!=a.ta()&&d.insertBefore(a.ta(),c)):d?(this.cb||this.Ga(),c=this.fb[c+1]||null,a.Tf(this.cb,c?c.cb:null)):this.Wc&&!a.Wc&&a.cb&&a.cb.parentNode&&a.cb.parentNode.nodeType==g.g.o.Node.ELEMENT_NODE&&
a.bf()};b.Nk=function(){return this.Sz};function bb(a,c){if(a.Wc)throw Error(g.vc.Error.vq);a.Sz=c}function cb(a){return 0!=a.fb.length}function ab(a,c,d){for(var e=0;e<a.fb.length;e++)c.call(d,a.fb[e],e)};g.g.U={};g.g.U.EA="aria-";g.g.U.lr="role";
g.g.U.ti={lH:"alert",mH:"alertdialog",oH:"application",pH:"article",vH:"banner",yH:"button",AH:"checkbox",FH:"columnheader",GH:"combobox",IH:"complementary",JH:"contentinfo",PH:"definition",SH:"dialog",TH:"directory",VH:"document",yI:"form",CI:"grid",DI:"gridcell",vB:"group",HI:"heading",KI:"img",UI:"link",VI:"list",WI:"listbox",XI:"listitem",ZI:"log",eJ:"main",fJ:"marquee",gJ:"math",ZB:"menu",iJ:"menubar",$B:"menuitem",aC:"menuitemcheckbox",jJ:"menuitemradio",nJ:"navigation",qJ:"note",LJ:"option",
nC:"presentation",mK:"progressbar",pK:"radio",qK:"radiogroup",sK:"region",mr:"row",yK:"rowgroup",zK:"rowheader",BK:"scrollbar",DK:"search",FK:"separator",KK:"slider",NK:"spinbutton",OK:"status",nw:"tab",PK:"table",QK:"tablist",RK:"tabpanel",SK:"textbox",TK:"textinfo",WK:"timer",XK:"toolbar",YK:"tooltip",EC:"tree",ZK:"treegrid",FC:"treeitem"};
g.g.U.State={hv:"activedescendant",qH:"atomic",sH:"autocomplete",xH:"busy",BH:"checked",EH:"colindex",LH:"controls",RH:"describedby",UH:"disabled",$H:"dropeffect",Iq:"expanded",xI:"flowto",BI:"grabbed",FI:"haspopup",II:"hidden",MI:"invalid",RI:"label",Rv:"labelledby",MB:"level",YI:"live",kJ:"multiline",lJ:"multiselectable",jC:"orientation",cK:"owns",mC:"posinset",kK:"pressed",rK:"readonly",tK:"relevant",wK:"required",AK:"rowindex",El:"selected",tC:"setsize",LK:"sort",IC:"valuemax",JC:"valuemin",bL:"valuenow",
cL:"valuetext"};g.g.U.Xf=function(a,c){c?a.setAttribute(g.g.U.lr,c):g.g.U.uG(a)};g.g.U.zL=function(a){return a.getAttribute(g.g.U.lr)||null};g.g.U.uG=function(a){a.removeAttribute(g.g.U.lr)};g.g.U.Eb=function(a,c,d){Array.isArray(d)&&(d=d.join(" "));a.setAttribute(g.g.U.sE(c),d)};g.g.U.sE=function(a){return g.g.U.EA+a};g.Aa={};g.Aa.gd=function(a,c){g.vc.call(this);this.Rc=c;this.Ze=a;this.lm=this.Zp=!1;this.xt=!0;this.ps=-1};g.g.object.T(g.Aa.gd,g.vc);g.Aa.gd.Hr={};b=g.Aa.gd.prototype;b.im=function(){g.Aa.gd.w.im.call(this);this.Aa&&(this.Aa=null);this.cb=null};
b.qp=function(){var a=this.ta();if(a){var c=db(this);c&&!c.id&&(c.id=this.ua()+".label");g.g.U.Xf(a,g.g.U.ti.FC);g.g.U.Eb(a,g.g.U.State.El,!1);g.g.U.Eb(a,g.g.U.State.MB,this.Ak());c&&g.g.U.Eb(a,g.g.U.State.Rv,c.id);(c=this.Xs())&&g.g.U.Xf(c,g.g.U.ti.nC);if(c=eb(this))if(g.g.U.Xf(c,g.g.U.ti.vB),c.hasChildNodes())for(g.g.U.Eb(a,g.g.U.State.Iq,!1),a=this.fb.length,c=1;c<=a;c++){var d=(this.fb[c-1]||null).ta();g.g.U.Eb(d,g.g.U.State.tC,a);g.g.U.Eb(d,g.g.U.State.mC,c)}}};
b.Ga=function(){var a=document.createElement("div");a.appendChild(fb(this));this.cb=a};b.bf=function(){g.Aa.gd.w.bf.call(this);g.Aa.gd.Hr[this.ua()]=this;this.qp()};b.wh=function(){g.Aa.gd.w.wh.call(this);delete g.Aa.gd.Hr[this.ua()]};
b.Ol=function(a,c){var d=this.fb[c-1]||null,e=this.fb[c]||null;g.Aa.gd.w.Ol.call(this,a,c);a.Tk=d;a.Vt=e;d?d.Vt=a:this.Ox=a;e&&(e.Tk=a);(c=this.Ae())&&gb(a,c);hb(a,this.Ak()+1);if(c=this.ta())if(this.kq(),g.g.U.Eb(c,g.g.U.State.Iq,this.ye()),this.ye()){c=eb(this);a.ta()||a.Ga();var f=a.ta(),h=e&&e.ta();c.insertBefore(f,h);this.Wc&&a.bf();e||(d?d.kq():(g.g.style.Gu(c,!0),this.wj(this.ye())))}};b.add=function(a){if(a.getParent())throw Error(g.vc.Error.dr);this.Ol(a,this.fb.length)};b.Ae=function(){return null};
b.Ak=function(){var a=this.ps;0>a&&(a=(a=this.getParent())?a.Ak()+1:0,hb(this,a));return a};function hb(a,c){if(c!=a.ps){a.ps=c;var d=ib(a);if(d){var e=jb(a)+"px";a.Nk()?d.style.paddingRight=e:d.style.paddingLeft=e}ab(a,function(f){hb(f,c+1)})}}b.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1};b.xh=function(){var a=[];ab(this,function(c){a.push(c)});return a};b.select=function(){var a=this.Ae();a&&Ta(a,this)};
function kb(a,c){if(a.Zp!=c){a.Zp=c;lb(a);var d=a.ta();d&&(g.g.U.Eb(d,g.g.U.State.El,c),c&&(c=a.Ae().ta(),g.g.U.Eb(c,g.g.U.State.hv,a.ua())))}}b.ye=function(){return this.lm};
b.wj=function(a){var c=a!=this.lm,d;this.lm=a;var e=this.Ae(),f=this.ta();if(cb(this)){if(!a&&e&&this.contains(e.Id)&&this.select(),f){if(d=eb(this))g.g.style.Gu(d,a),g.g.U.Eb(f,g.g.U.State.Iq,a),a&&this.Wc&&!d.hasChildNodes()&&(ab(this,function(h){d.appendChild(fb(h))}),ab(this,function(h){h.bf()}));this.kq()}}else(d=eb(this))&&g.g.style.Gu(d,!1);f&&(this.Xs().className=this.cp());c&&(a?this.Dx():this.Cx())};b.Dx=function(){};b.Cx=function(){};b.toggle=function(){this.wj(!this.ye())};
function fb(a){var c=a.ye()&&cb(a),d=document.createElement("div");d.style.backgroundPosition=mb(a);c||(d.style.display="none");c&&ab(a,function(e){d.appendChild(fb(e))});c=document.createElement("div");c.id=a.ua();c.appendChild(nb(a));c.appendChild(d);return c}function jb(a){return Math.max(0,(a.Ak()-1)*a.Rc.Ly)}function nb(a){var c=document.createElement("div");c.className=a.ip();c.style["padding-"+(a.Nk()?"right":"left")]=jb(a)+"px";c.appendChild(ob(a));c.appendChild(pb(a));return c}
b.ip=function(){var a="";this.Zp&&(a=" "+(this.Rc.OD||""));return this.Rc.mx+a};function pb(a){var c=document.createElement("span");c.className=a.Rc.MD||"";c.textContent=a.cc();return c}function ob(a){var c=document.createElement("span");c.style.display="inline-block";c.className=a.cp();return c}b.cp=function(){throw Error("unimplemented abstract method");};function mb(a){return(a.Vt?(a.Ak()-1)*a.Rc.Ly:"-100")+"px 0"}
b.ta=function(){var a=g.Aa.gd.w.ta.call(this);a||(this.cb=a=document.getElementById(this.ua()));return a};function ib(a){return(a=a.ta())?a.firstChild:null}b.Xs=function(){var a=ib(this);return a?a.firstChild:null};function db(a){return(a=ib(a))&&a.lastChild?a.lastChild.previousSibling:null}function eb(a){return(a=a.ta())?a.lastChild:null}b.Yk=function(a){this.Ze=a};b.cc=function(){return this.Ze};function lb(a){var c=ib(a);c&&(c.className=a.ip())}
b.kq=function(){var a=eb(this);a&&(a.style.backgroundPosition=mb(this))};b.xz=function(a){"expand"==a.target.getAttribute("type")&&cb(this)?this.xt&&this.toggle():(this.select(),lb(this))};b.uz=function(a){a.preventDefault()};b.bu=function(a){var c=!0;switch(a.keyCode){case g.g.Ia.ir:if(a.altKey)break;c=qb(this);break;case g.g.Ia.Oq:if(a.altKey)break;c=rb(this);break;case g.g.Ia.$n:c=sb(this);break;case g.g.Ia.zo:c=tb(this);break;default:c=!1}c&&a.preventDefault();return c};
function sb(a){a:if(cb(a)&&a.ye())a=a.fb[0]||null;else{for(var c=a,d;c!=a.Ae();){d=c.Vt;if(null!=d){a=d;break a}c=c.getParent()}a=null}a&&a.select();return!0}function tb(a){var c=a.Tk;if(null!=c)a=ub(c);else{c=a.getParent();var d=a.Ae();a=c==d||a==d?null:c}a&&a.select();return!0}function rb(a){if(cb(a)&&a.ye()&&a.xt)a.wj(!1);else{var c=a.getParent();a=a.Ae();c&&c!=a&&c.select()}return!0}function qb(a){return cb(a)?(a.ye()?(a.fb[0]||null).select():a.wj(!0),!0):!1}
function ub(a){return a.ye()&&cb(a)?ub(a.fb[a.fb.length-1]||null):a}function gb(a,c){a.Aa!=c&&(a.Aa=c,ab(a,function(d){gb(d,c)}))};g.Aa.jh=function(a,c,d){this.oa=a;g.Aa.gd.call(this,c,d)};g.g.object.T(g.Aa.jh,g.Aa.gd);b=g.Aa.jh.prototype;b.Ae=function(){if(this.Aa)return this.Aa;var a=this.getParent();return a&&(a=a.Ae())?(gb(this,a),a):null};b.cp=function(){var a=this.ye(),c=this.jE;if(a&&c)return c;c=this.eF;if(!a&&c)return c;c=this.Rc;if(cb(this)){if(a&&c.kx)return c.Oo+" "+c.kx;if(!a&&c.JD)return c.Oo+" "+c.JD}else if(c.lx)return c.Oo+" "+c.lx;return""};
b.uz=function(){cb(this)&&this.xt?(this.toggle(),this.select()):this.Zp?Ta(this.Ae(),null):this.select();lb(this)};b.xz=function(){};b.bu=function(a){if(this.Aa.oa.ef){var c={},d=g.g.Ia.$n,e=g.g.Ia.zo;c[g.g.Ia.ir]=this.Nk()?e:d;c[g.g.Ia.Oq]=this.Nk()?d:e;c[g.g.Ia.zo]=g.g.Ia.Oq;c[g.g.Ia.$n]=g.g.Ia.ir;Object.defineProperties(a,{keyCode:{value:c[a.keyCode]||a.keyCode}})}return g.Aa.jh.w.bu.call(this,a)};b.Rz=function(){this.Az&&this.Az.call(this.oa)};b.Dx=g.Aa.jh.prototype.Rz;b.Cx=g.Aa.jh.prototype.Rz;g.Aa.Ai=function(a,c){this.oa=a;g.Aa.gd.call(this,"",c);this.lm=!0;kb(this,!0);this.Id=this};g.g.object.T(g.Aa.Ai,g.Aa.gd);b=g.Aa.Ai.prototype;b.Ae=function(){return this};b.Ak=function(){return 0};b.QE=function(){this.Sx=!0;var a=this.ta();g.g.o.qb(a,"focused");this.Id&&this.Id.select()};b.NE=function(){this.Sx=!1;var a=this.ta();g.g.o.fc(a,"focused")};b.hasFocus=function(){return this.Sx};b.ye=function(){return!0};b.wj=function(a){this.lm=a};
b.Xs=function(){var a=ib(this);return a?a.firstChild:null};b.kq=function(){};b.ip=function(){return g.Aa.Ai.w.ip.call(this)+" "+this.Rc.LD};b.cp=function(){var a=this.ye(),c=this.jE;if(a&&c)return c;c=this.eF;if(!a&&c)return c;c=this.Rc;return a&&c.KD?c.Oo+" "+c.KD:""};function Ta(a,c){if(c!=a.Id&&(!a.rz||a.rz.call(a.oa,c))){var d=a.Id;a.Id&&kb(a.Id,!1);(a.Id=c)&&kb(c,!0);a.qz&&a.qz.call(a.oa,d,c)}}
b.qp=function(){g.Aa.Ai.w.qp.call(this);var a=this.ta();g.g.U.Xf(a,g.g.U.ti.EC);g.g.U.Eb(a,g.g.U.State.Rv,db(this).id)};b.bf=function(){g.Aa.Ai.w.bf.call(this);var a=this.ta();a.className=this.Rc.ND;a.setAttribute("hideFocus","true");this.Nr();this.qp()};b.wh=function(){g.Aa.Ai.w.wh.call(this);this.qs()};b.Nr=function(){var a=this.ta();a.tabIndex=0;this.WF=g.yc(a,"focus",this,this.QE);this.SF=g.yc(a,"blur",this,this.NE);this.UF=g.ka(a,"click",this,this.UE);this.aG=g.yc(a,"keydown",this,this.RE)};
b.qs=function(){g.Xa(this.WF);g.Xa(this.SF);g.Xa(this.UF);g.Xa(this.aG)};b.UE=function(a){var c;a:{for(var d=a.target;null!=d;){if(c=g.Aa.gd.Hr[d.id])break a;if(d==this.ta())break;d=d.parentNode}c=null}if(c)switch(a.type){case "mousedown":c.xz(a);break;case "click":c.uz(a)}};b.RE=function(a){var c=!1;if(c=this.Id&&this.Id.bu(a)||c)g.g.style.Cu(this.Id.ta(),this.ta().parentNode),a.preventDefault();return c};b.createNode=function(a){return new g.Aa.jh(this.oa,a||"",this.Rc)};g.g.Ib={};g.g.Ib.parse=function(a){a=String(a).toLowerCase().trim();var c=g.g.Ib.names[a];if(c)return c;c="#"==a[0]?a:"#"+a;if(/^#[0-9a-f]{6}$/.test(c))return c;if(/^#[0-9a-f]{3}$/.test(c))return["#",c[1],c[1],c[2],c[2],c[3],c[3]].join("");var d=a.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return d&&(a=Number(d[1]),c=Number(d[2]),d=Number(d[3]),0<=a&&256>a&&0<=c&&256>c&&0<=d&&256>d)?g.g.Ib.Au(a,c,d):null};
g.g.Ib.Au=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};g.g.Ib.Gy=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]};
g.g.Ib.dF=function(a){var c=g.zB,d=255*g.AB,e=0,f=0,h=0;if(0==c)h=f=e=d;else{var k=Math.floor(a/60),l=a/60-k;a=d*(1-c);var m=d*(1-c*l);c=d*(1-c*(1-l));switch(k){case 1:e=m;f=d;h=a;break;case 2:e=a;f=d;h=c;break;case 3:e=a;f=m;h=d;break;case 4:e=c;f=a;h=d;break;case 5:e=d;f=a;h=m;break;case 6:case 0:e=d,f=c,h=a}}return g.g.Ib.Au(Math.floor(e),Math.floor(f),Math.floor(h))};
g.g.Ib.Qr=function(a,c,d){a=g.g.Ib.Gy(g.g.Ib.parse(a));c=g.g.Ib.Gy(g.g.Ib.parse(c));return g.g.Ib.Au(Math.round(c[0]+d*(a[0]-c[0])),Math.round(c[1]+d*(a[1]-c[1])),Math.round(c[2]+d*(a[2]-c[2])))};g.g.Ib.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"};g.g.Rect=function(a,c,d,e){this.top=a;this.bottom=c;this.left=d;this.right=e};g.g.Rect.prototype.contains=function(a,c){return a>=this.left&&a<=this.right&&c>=this.top&&c<=this.bottom};g.zi=function(a){this.s=a;this.G=a.options.G;this.ef=a.options.Ed;this.Da=a.options.Da;this.Rc={Ly:19,ND:"blocklyTreeRoot",LD:"blocklyHidden",mx:"blocklyTreeRow",MD:"blocklyTreeLabel",Oo:"blocklyTreeIcon",kx:"blocklyTreeIconOpen",lx:"blocklyTreeIconNone",OD:"blocklyTreeSelected"};this.lA={mx:"blocklyTreeSeparator"};this.ef&&(this.Rc.cssTreeRow+=a.G?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.lA.cssTreeRow="blocklyTreeSeparatorHorizontal "+(a.G?"blocklyHorizontalTreeRtl":"blocklyHorizontalTree"),
this.Rc.cssTreeIcon="")};b=g.zi.prototype;b.width=0;b.height=0;b.Ok=null;
b.aa=function(){var a=this.s,c=v(this.s);this.wc=document.createElement("div");this.wc.className="blocklyToolboxDiv blocklyNonSelectable";this.wc.setAttribute("dir",a.G?"RTL":"LTR");c.parentNode.insertBefore(this.wc,c);c=a.Rb;c.subscribe(this.wc,"toolbox","background-color");c.subscribe(this.wc,"toolboxText","color");g.ka(this.wc,"mousedown",this,function(d){g.g.fj(d)||d.target==this.wc?g.mc(!1):g.mc(!0);g.Touch.nh()},!1,!0);c={Cg:a.options.Cg,Kb:a,G:a.G,Ge:a.options.Ge,Ed:a.Ed,Da:a.options.Da,Rg:a.options.Rg};
this.M=null;if(a.Ed){if(!g.vl)throw Error("Missing require for Blockly.HorizontalFlyout");this.M=new g.vl(c)}else{if(!g.sg)throw Error("Missing require for Blockly.VerticalFlyout");this.M=new g.sg(c)}g.g.o.Zi(this.M.Ga("svg"),v(this.s));this.M.aa(a);this.Rc.cleardotPath=a.options.lf+"1x1.gif";this.Rc.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.G?"Rtl":"Ltr");vb(this,a.options.Of)};
function vb(a,c){a.ud&&(a.ud.I(),a.Ok=null);var d=new g.Aa.Ai(a,a.Rc);a.ud=d;Ta(d,null);d.rz=a.ME;d.qz=a.LE;var e=null;if(c){a.ud.Cf=[];a.gt=!1;e=wb(a,c,a.ud,a.s.options.lf);if(a.ud.Cf.length)throw Error("Toolbox cannot have both blocks and categories in the root level.");xb(a.s)}d.za(a.wc);e&&Ta(d,e);yb(a);a.position();a.ef&&g.g.U.Eb(a.ud.ta(),g.g.U.State.jC,"horizontal")}
b.ME=function(a){if(a==this.ud)return!1;this.Ok&&(ib(this.Ok).style.backgroundColor="");if(a){var c=a.Fk||"#57e";ib(a).style.backgroundColor=c;yb(this,a)}return!0};b.LE=function(a,c){c&&c.Cf&&c.Cf.length?(this.M.show(c.Cf),this.Ok!=c&&this.M.pc.set(0),g.De&&g.navigation.Eb(g.navigation.vr)):(this.M.ya(),!g.De||c instanceof g.zi.Br||g.navigation.Eb(g.navigation.Gl));a!=c&&a!=this&&(a=new g.i.od(null,"category",a&&a.cc(),c&&c.cc()),a.uc=this.s.id,g.i.Ka(a));c&&(this.Ok=c)};b.XE=function(){g.$k(this.s)};
b.Nh=function(a){var c=this.ud.Id;if(!c)return!1;switch(a.name){case g.navigation.Za.pe:return tb(c);case g.navigation.Za.qo:return rb(c);case g.navigation.Za.oe:return sb(c);case g.navigation.Za.fo:return qb(c);default:return!1}};b.I=function(){this.M.I();this.ud.I();this.s.Rb.unsubscribe(this.wc);g.g.o.removeNode(this.wc);this.Ok=this.s=null};b.Mf=function(){return this.width};b.ey=function(){return this.height};
b.position=function(){var a=this.wc;if(a){var c=v(this.s);c=g.hA(c);this.ef?(a.style.left="0",a.style.height="auto",a.style.width=c.width+"px",this.height=a.offsetHeight,this.Da==g.qg?a.style.top="0":a.style.bottom="0"):(this.Da==g.pg?a.style.right="0":a.style.left="0",a.style.height=c.height+"px",this.width=a.offsetWidth);this.M.position()}};
function wb(a,c,d,e){for(var f=null,h=null,k=0,l;l=c.childNodes[k];k++)if(l.tagName)switch(l.tagName.toUpperCase()){case "CATEGORY":var m=g.g.nc(l.getAttribute("name"));h=a.ud.createNode(m);h.Az=a.XE;h.Cf=[];d.add(h);var n=l.getAttribute("custom");n?h.Cf=n:(n=wb(a,l,h,e))&&(f=n);var q=l.getAttribute("categorystyle");if((n=l.getAttribute("colour"))&&q)h.Fk="",console.warn('Toolbox category "'+m+'" can not have both a style and a colour');else if(q){n=a;var r=h;r.YL=q;var u=n.s.kp();q&&u&&((u=u.mD[q])&&
u.Ib?zb(n,u.Ib,r,m):console.warn('Style "'+q+'" must exist and contain a colour value'))}else zb(a,n,h,m);"true"==l.getAttribute("expanded")?(h.Cf.length&&(f=h),h.wj(!0)):h.wj(!1);h=l;break;case "SEP":if(h&&"CATEGORY"==h.tagName.toUpperCase()){d.add(new g.zi.Br(a.lA));break}case "BLOCK":case "SHADOW":case "LABEL":case "BUTTON":d.Cf.push(l),h=l}return f}
function zb(a,c,d,e){c=g.g.nc(c);if(null===c||""===c)d.Fk="";else{var f=Number(c);isNaN(f)?(f=g.g.Ib.parse(c))?(d.Fk=f,a.gt=!0):(d.Fk="",console.warn('Toolbox category "'+e+'" has unrecognized colour attribute: '+c)):(d.Fk=g.Ky(f),a.gt=!0)}}function yb(a,c){c=(c||a.ud).xh(!1);for(var d=0,e;e=c[d];d++){var f=ib(e);if(f){var h=a.gt?"8px solid "+(e.Fk||"#ddd"):"none";a.s.G?f.style.borderRight=h:f.style.borderLeft=h}yb(a,e)}}
b.rm=function(){if(!this.wc)return null;var a=this.wc.getBoundingClientRect(),c=a.top,d=c+a.height,e=a.left;a=e+a.width;return this.Da==g.qg?new g.g.Rect(-1E7,d,-1E7,1E7):this.Da==g.xi?new g.g.Rect(c,1E7,-1E7,1E7):this.Da==g.zd?new g.g.Rect(-1E7,1E7,-1E7,a):new g.g.Rect(-1E7,1E7,e,1E7)};g.zi.Br=function(a){g.Aa.jh.call(this,null,"",a)};g.g.object.T(g.zi.Br,g.Aa.jh);
g.hd.register([".blocklyToolboxDelete {",'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<<PATH>>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {",
"height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;",
"}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<<PATH>>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {",
"background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",
'cursor: url("<<<PATH>>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]);g.i.rl=function(a){this.uc=a.id;this.group=g.i.Ub();this.Jc=!1};g.g.object.T(g.i.rl,g.i.Abstract);g.i.rl.prototype.type=g.i.oB;g.i.rl.prototype.Wa=function(){var a={type:this.type};this.group&&(a.group=this.group);this.uc&&(a.workspaceId=this.uc);return a};g.i.rl.prototype.sa=function(a){this.uc=a.workspaceId;this.group=a.group};g.O={};g.O.rA=function(a){var c=I,d=g.g.xml.createElement("xml"),e=g.O.dH(g.N.Ew(c));e.hasChildNodes()&&d.appendChild(e);var f=wa(c,!0);e=0;for(var h;h=f[e];e++)d.appendChild(h.Vu(a));c=A(c,!0);for(e=0;f=c[e];e++)d.appendChild(g.O.Sr(f,a));return d};g.O.dH=function(a){for(var c=g.g.xml.createElement("variables"),d=0,e;e=a[d];d++){var f=g.g.xml.createElement("variable");f.appendChild(g.g.xml.createTextNode(e.name));e.type&&f.setAttribute("type",e.type);f.id=e.ua();c.appendChild(f)}return c};
g.O.Sr=function(a,c){var d;a.v.G&&(d=a.v.Mf());c=g.O.lh(a,c);var e=a.Oa();c.setAttribute("x",Math.round(a.v.G?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c};g.O.lE=function(a){var c=!1;a.name&&(a.gk?c=!0:a.uf&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),c=!0));return c?(c=g.g.xml.createElement("field"),c.setAttribute("name",a.name),a.iA(c)):null};
g.O.YC=function(a,c){for(var d=0,e;e=a.P[d];d++)for(var f=0,h;h=e.Na[f];f++)(h=g.O.lE(h))&&c.appendChild(h)};
g.O.lh=function(a,c){var d=g.g.xml.createElement(a.$a?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.eb){var e=a.eb();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}g.O.YC(a,d);if(e=a.te.text){var f=a.te.size,h=a.te.mu,k=g.g.xml.createElement("comment");k.appendChild(g.g.xml.createTextNode(e));k.setAttribute("pinned",h);k.setAttribute("h",f.height);k.setAttribute("w",f.width);d.appendChild(k)}a.data&&(e=g.g.xml.createElement("data"),e.appendChild(g.g.xml.createTextNode(a.data)),
d.appendChild(e));for(f=0;h=a.P[f];f++){var l;k=!0;if(h.type!=g.jg){var m=C(h.connection);h.type==g.Ua?l=g.g.xml.createElement("value"):h.type==g.Ra&&(l=g.g.xml.createElement("statement"));e=h.connection.nf;!e||m&&m.$a||l.appendChild(g.O.Rw(e,c));m&&(l.appendChild(g.O.lh(m,c)),k=!1);l.setAttribute("name",h.name);k||d.appendChild(l)}}void 0!=a.Mg&&a.Mg!=a.kF&&d.setAttribute("inline",a.Mg);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.Zd()||a.$a||d.setAttribute("deletable",
!1);a.Fc()||a.$a||d.setAttribute("movable",!1);a.cd()||d.setAttribute("editable",!1);if(f=t(a))l=g.g.xml.createElement("next"),l.appendChild(g.O.lh(f,c)),d.appendChild(l);e=a.V&&a.V.nf;!e||f&&f.$a||l.appendChild(g.O.Rw(e,c));return d};
g.O.Rw=function(a,c){for(var d=a=a.cloneNode(!0),e;d;)if(c&&"shadow"==d.nodeName&&d.removeAttribute("id"),d.firstChild)d=d.firstChild;else{for(;d&&!d.nextSibling;)e=d,d=d.parentNode,e.nodeType==g.g.o.Node.TEXT_NODE&&""==e.data.trim()&&d.firstChild!=e&&g.g.o.removeNode(e);d&&(e=d,d=d.nextSibling,e.nodeType==g.g.o.Node.TEXT_NODE&&""==e.data.trim()&&g.g.o.removeNode(e))}return a};
g.O.Dd=function(a){a=g.g.xml.Dd(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1&#10;$2")}while(a!=d);return a};g.O.tL=function(a){a=g.O.Dd(a).split("<");for(var c="",d=1;d<a.length;d++){var e=a[d];"/"==e[0]&&(c=c.substring(2));a[d]=c+"<"+e;"/"!=e[0]&&"/>"!=e.slice(-2)&&(c+="  ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>");return a.replace(/^\n/,"")};
g.O.$h=function(a){var c=g.g.xml.QG(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};g.O.pL=function(a,c){c.Lc(!1);c.clear();a=g.O.uh(a,c);c.Lc(!0);return a};
g.O.uh=function(a,c){if(a instanceof g.Fb){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var e;c.G&&(e=c.Mf());d=[];g.g.o.tn();var f=a.childNodes.length,h=g.i.Ub();h||g.i.Z(!0);c.Lc&&c.Lc(!1);var k=!0;try{for(var l=0;l<f;l++){var m=a.childNodes[l],n=m.nodeName.toLowerCase();if("block"==n||"shadow"==n&&!g.i.Jc){var q=g.O.Oi(m,c);d.push(q.id);var r=m.hasAttribute("x")?parseInt(m.getAttribute("x"),10):10,u=m.hasAttribute("y")?parseInt(m.getAttribute("y"),
10):10;isNaN(r)||isNaN(u)||q.moveBy(c.G?e-r:r,u);k=!1}else{if("shadow"==n)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==n)c.ca?g.jk?g.jk.pm(m):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):g.OC?g.OC.pm(m):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==n){if(k)g.O.dE(m,c);else throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");
k=!1}}}}finally{h||g.i.Z(!1),g.g.o.un()}c.Lc&&c.Lc(!0);g.i.Ka(new g.i.rl(c));return d};g.O.mL=function(a,c){if(c.hasOwnProperty("scale")){var d=g.va.ih;try{g.va.ih=0;var e=Ab(c)}finally{g.va.ih=d}}a=g.O.uh(a,c);if(e&&e.top!=e.bottom){d=e.bottom;var f=e.left;var h=Infinity,k=Infinity;for(e=0;e<a.length;e++){var l=x(c,a[e]).Oa();l.y<k&&(k=l.y);l.x<h&&(h=l.x)}d=d-k+g.va.sC;f-=h;var m;c.G&&(m=c.Mf());for(e=0;e<a.length;e++)x(c,a[e]).moveBy(c.G?m-f:f,d)}return a};
g.O.Oi=function(a,c){if(a instanceof g.Fb){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")}g.i.disable();d=c.Fg();try{var e=g.O.As(a,c),f=p(e,!1);if(c.ca){Wa(e,!0);for(var h=f.length-1;0<=h;h--)f[h].Ce();for(h=f.length-1;0<=h;h--)f[h].za(!1);setTimeout(function(){e.v&&Wa(e,!1)},1);Bb(e);xb(c)}else for(h=f.length-1;0<=h;h--)f[h].Xi()}finally{g.i.enable()}if(g.i.isEnabled()){a=g.N.Wx(c,d);for(h=0;h<a.length;h++)g.i.Ka(new g.i.re(a[h]));g.i.Ka(new g.i.Rn(e))}return e};
g.O.dE=function(a,c){for(var d=0,e;e=a.childNodes[d];d++)if(e.nodeType==g.g.o.Node.ELEMENT_NODE){var f=e.getAttribute("type"),h=e.getAttribute("id");c.Cd(e.textContent,f,h)}};
g.O.As=function(a,c){var d=null,e=a.getAttribute("type");if(!e)throw TypeError("Block type unspecified: "+a.outerHTML);var f=a.getAttribute("id");d=c.Lh(e,f);var h=null;f=0;for(var k;k=a.childNodes[f];f++)if(k.nodeType!=g.g.o.Node.TEXT_NODE){for(var l=h=null,m=0,n;n=k.childNodes[m];m++)n.nodeType==g.g.o.Node.ELEMENT_NODE&&("block"==n.nodeName.toLowerCase()?h=n:"shadow"==n.nodeName.toLowerCase()&&(l=n));!h&&l&&(h=l);m=k.getAttribute("name");switch(k.nodeName.toLowerCase()){case "mutation":d.Ab&&(d.Ab(k),
d.Ce&&d.Ce());break;case "comment":if(!g.Comment){console.warn("Missing require for Blockly.Comment, ignoring block comment.");break}h=k.textContent;l="true"==k.getAttribute("pinned");m=parseInt(k.getAttribute("w"),10);k=parseInt(k.getAttribute("h"),10);d.Wh(h);d.te.mu=l;isNaN(m)||isNaN(k)||(d.te.size=new g.g.qe(m,k));l&&d.yE&&!d.Wb&&setTimeout(function(){d.Df.Qb(!0)},1);break;case "data":d.data=k.textContent;break;case "title":case "field":g.O.cE(d,m,k);break;case "value":case "statement":k=E(d,
m);if(!k){console.warn("Ignoring non-existent input "+m+" in block "+e);break}l&&(k.connection.nf=l);if(h)if(h=g.O.As(h,c),h.L)k.connection.connect(h.L);else if(h.Y)k.connection.connect(h.Y);else throw TypeError("Child block does not have output or previous statement.");break;case "next":l&&d.V&&(d.V.nf=l);if(h){if(!d.V)throw TypeError("Next statement does not exist.");if(d.V.isConnected())throw TypeError("Next statement is already connected.");h=g.O.As(h,c);if(!h.Y)throw TypeError("Next block does not have previous statement.");
d.V.connect(h.Y)}break;default:console.warn("Ignoring unknown tag: "+k.nodeName)}}(f=a.getAttribute("inline"))&&d.Je("true"==f);(f=a.getAttribute("disabled"))&&d.Kc("true"!=f&&"disabled"!=f);if(f=a.getAttribute("deletable"))d.Qo="true"==f;(f=a.getAttribute("movable"))&&d.$p("true"==f);(f=a.getAttribute("editable"))&&d.Fu("true"==f);(f=a.getAttribute("collapsed"))&&d.Ug("true"==f);if("shadow"==a.nodeName.toLowerCase()){a=d.xh(!1);for(f=0;c=a[f];f++)if(!c.$a)throw TypeError("Shadow block not allowed non-shadow child.");
if(d.Ig().length)throw TypeError("Shadow blocks cannot have variable references.");d.Ju(!0)}return d};g.O.cE=function(a,c,d){var e=B(a,c);e?e.pm(d):console.warn("Ignoring non-existent field "+c+" in block "+a.type)};g.O.TD=function(a){for(var c=0,d;d=a.childNodes[c];c++)if("next"==d.nodeName.toLowerCase()){a.removeChild(d);break}};g.Ar=function(a){this.s=a;this.Ji=[];if(!(0>=this.s.options.Gp)){a={scrollbars:!0,Cg:this.s.options.Cg,Kb:this.s,G:this.s.G,Ge:this.s.options.Ge,Rg:this.s.options.Rg};if(this.s.Ed){a.Da=this.s.Da==g.qg?g.xi:g.qg;if(!g.vl)throw Error("Missing require for Blockly.HorizontalFlyout");this.M=new g.vl(a)}else{a.Da=this.s.Da==g.pg?g.zd:g.pg;if(!g.sg)throw Error("Missing require for Blockly.VerticalFlyout");this.M=new g.sg(a)}Aa(this.s,this.VF.bind(this))}};b=g.Ar.prototype;b.Bi=47;b.On=44;b.ak=16;b.Sq=20;
b.yl=20;b.lo=10;b.qr=0;b.rr=32;b.wB=.1;b.vt=!1;b.Hp=0;b.H=null;b.gq=null;b.Dt=0;b.Jh=0;b.Lm=0;b.dl=0;
b.Ga=function(){this.H=g.g.o.K("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var c=g.g.o.K("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.H);g.g.o.K("rect",{width:this.Bi,height:this.On,y:this.ak},c);var d=g.g.o.K("image",{width:g.nd.width,x:-this.qr,height:g.nd.height,y:-this.rr,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.H);d.setAttributeNS(g.g.o.Ue,"xlink:href",this.s.options.lf+g.nd.url);c=g.g.o.K("clipPath",{id:"blocklyTrashLidClipPath"+a},this.H);
g.g.o.K("rect",{width:this.Bi,height:this.ak},c);this.gq=g.g.o.K("image",{width:g.nd.width,x:-this.qr,height:g.nd.height,y:-this.rr,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.H);this.gq.setAttributeNS(g.g.o.Ue,"xlink:href",this.s.options.lf+g.nd.url);g.ka(this.H,"mouseup",this,this.click);g.yc(d,"mouseover",this,this.FF);g.yc(d,"mouseout",this,this.DF);this.Ir();return this.H};
b.aa=function(a){0<this.s.options.Gp&&(g.g.o.Zi(this.M.Ga("svg"),v(this.s)),this.M.aa(this.s),this.M.Qy=function(){return!0});this.Zg=this.Sq+a;Cb(this,!1);return this.Zg+this.On+this.ak};b.I=function(){this.H&&(g.g.o.removeNode(this.H),this.H=null);this.s=this.gq=null;clearTimeout(this.Dt)};
b.position=function(){if(this.Zg){var a=this.s.bc();a&&(this.Lm=a.Da==g.zd||this.s.Ed&&!this.s.G?a.lb+a.jc-this.Bi-this.yl-g.Ja.oc:this.yl+g.Ja.oc,this.dl=a.Da==g.xi?this.Zg:a.rb+a.xc-(this.On+this.ak)-this.Zg,this.H.setAttribute("transform","translate("+this.Lm+","+this.dl+")"))}};b.rm=function(){if(!this.H)return null;var a=this.H.getBoundingClientRect(),c=a.top+this.rr-this.lo;a=a.left+this.qr-this.lo;return new g.g.Rect(c,c+this.ak+this.On+2*this.lo,a,a+this.Bi+2*this.lo)};
function Cb(a,c){a.vt!=c&&(clearTimeout(a.Dt),a.vt=c,a.Ir())}b.Ir=function(){this.Jh+=this.vt?.2:-.2;this.Jh=Math.min(Math.max(this.Jh,this.Hp),1);Db(this,45*this.Jh);this.H.style.opacity=.4+.4*this.Jh;this.Jh>this.Hp&&1>this.Jh&&(this.Dt=setTimeout(this.Ir.bind(this),20))};function Db(a,c){var d=a.s.Da==g.pg||a.s.Ed&&a.s.G;a.gq.setAttribute("transform","rotate("+(d?-c:c)+","+(d?4:a.Bi-4)+","+(a.ak-2)+")")}b.close=function(){Cb(this,!1)};
b.click=function(){if(this.Ji.length){for(var a=[],c=0,d;d=this.Ji[c];c++)a[c]=g.O.$h(d);this.M.show(a)}};b.FF=function(){this.Ji.length&&Cb(this,!0)};b.DF=function(){Cb(this,!1)};
b.VF=function(a){if(!(0>=this.s.options.Gp)&&a.type==g.i.Nn&&"shadow"!=a.$t.tagName.toLowerCase()){for(var c=a=a.$t.cloneNode(!0);c;){c.removeAttribute&&(c.removeAttribute("x"),c.removeAttribute("y"),c.removeAttribute("id"));var d=c.firstChild||c.nextSibling;if(!d)for(d=c.parentNode;d;){if(d.nextSibling){d=d.nextSibling;break}d=d.parentNode}c=d}a=g.O.Dd(a);if(-1==this.Ji.indexOf(a)){for(this.Ji.unshift(a);this.Ji.length>this.s.options.Gp;)this.Ji.pop();this.Hp=this.wB;Db(this,45*this.Hp)}}};g.W=Object.create(null);g.ra=function(a,c){this.B=a;this.type=c};g.ra.Sn=0;g.ra.ew=1;g.ra.hw=2;g.ra.gw=3;g.ra.cw=4;g.ra.dw=5;g.ra.fw=6;b=g.ra.prototype;b.ga=null;b.vg=null;b.nf=null;b.Sb=0;b.Ya=0;
b.Xe=function(a){var c=this,d=c.B,e=a.B;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=C(c),h=c.nf;c.nf=null;if(f.$a)h=g.O.lh(f),f.I(),f=null;else if(c.type==g.Ua){if(!f.L)throw Error("Orphan block does not have an output connection.");var k=g.ra.Xy(e,f);k&&(f.L.connect(k),f=null)}else if(c.type==g.Ra){if(!f.Y)throw Error("Orphan block does not have a previous connection.");for(k=e;k.V;){var l=t(k);if(l&&!l.$a)k=l;else{Eb(f.Y,k.V)&&(k.V.connect(f.Y),f=null);break}}}if(f&&(c.disconnect(),
g.i.Jc)){var m=g.i.Ub();setTimeout(function(){f.v&&!f.getParent()&&(g.i.Z(m),f.L?f.L.Jp(c):f.Y&&f.Y.Jp(c),g.i.Z(!1))},g.Pn)}c.nf=h}var n;g.i.isEnabled()&&(n=new g.i.ll(e));g.ra.BD(c,a);e.Xk(d);n&&(n.tj(),g.i.Ka(n))};b.I=function(){if(this.isConnected()){this.nf=null;var a=C(this);a.$a?a.I():D(a)}};function H(a){return a.type==g.Ua||a.type==g.Ra}b.isConnected=function(){return!!this.ga};
function Xa(a,c){if(!c)return g.ra.gw;if(H(a))var d=a.B,e=c.B;else e=a.B,d=c.B;return d&&d==e?g.ra.ew:c.type!=g.dk[a.type]?g.ra.hw:d&&e&&d.v!==e.v?g.ra.dw:Eb(a,c)?d.$a&&!e.$a?g.ra.fw:g.ra.Sn:g.ra.cw}
function Ya(a,c){switch(Xa(a,c)){case g.ra.Sn:break;case g.ra.ew:throw Error("Attempted to connect a block to itself.");case g.ra.dw:throw Error("Blocks not on same workspace.");case g.ra.hw:throw Error("Attempt to connect incompatible types.");case g.ra.gw:throw Error("Target connection is null.");case g.ra.cw:throw Error("Connection checks failed. "+(a+" expected "+a.vg+", found "+c.vg));case g.ra.fw:throw Error("Connecting non-shadow to shadow block.");default:throw Error("Unknown connection failure: this should never happen!");
}}b.vp=function(a){if(a.B.Ng()||Xa(this,a)!=g.ra.Sn)return!1;switch(a.type){case g.Se:return this.ga||-1!=g.jm.indexOf(a)?a=!1:a.ga?(a=C(a),a=a.Ng()?!(a.Y&&C(a.Y)):!1):a=!0,a;case g.Re:if(a.isConnected()&&!C(a).Ng()||this.isConnected())return!1;break;case g.Ua:if(a.isConnected()&&!C(a).Fc()&&!C(a).$a)return!1;break;case g.Ra:if(a.isConnected()&&!this.B.V&&!C(a).$a&&C(a).V)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=g.jm.indexOf(a)?!1:!0};b.Jp=function(){};
b.connect=function(a){if(this.ga!=a){Ya(this,a);var c=g.i.Ub();c||g.i.Z(!0);H(this)?this.Xe(a):a.Xe(this);c||g.i.Z(!1)}};g.ra.BD=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.ga=c;c.ga=a};g.ra.HG=function(a,c){for(var d=!1,e=0;e<a.P.length;e++){var f=a.P[e].connection;if(f&&f.type==g.Ua&&Eb(c.L,f)){if(d)return null;d=f}}return d};g.ra.Xy=function(a,c){for(var d;d=g.ra.HG(a,c);)if(a=C(d),!a||a.$a)return d;return null};b=g.ra.prototype;
b.disconnect=function(){var a=this.ga;if(!a)throw Error("Source connection not connected.");if(a.ga!=this)throw Error("Target connection not connected to source connection.");if(H(this)){var c=this.B;var d=a.B;a=this}else c=a.B,d=this.B;var e=g.i.Ub();e||g.i.Z(!0);this.ws(c,d);a.yu();e||g.i.Z(!1)};b.ws=function(a,c){var d;g.i.isEnabled()&&(d=new g.i.ll(c));this.ga=this.ga.ga=null;c.Xk(null);d&&(d.tj(),g.i.Ka(d))};
b.yu=function(){var a=this.B,c=this.nf;if(a.v&&c&&g.i.Jc)if(a=g.O.Oi(c,a.v),a.L)this.connect(a.L);else if(a.Y)this.connect(a.Y);else throw Error("Child block does not have output or previous statement.");};function C(a){return a.isConnected()?a.ga.B:null}function Eb(a,c){if(!a.vg||!c.vg)return!0;for(var d=0;d<a.vg.length;d++)if(-1!=c.vg.indexOf(a.vg[d]))return!0;return!1}b.sz=function(){this.isConnected()&&!Eb(this,this.ga)&&D(H(this)?C(this):this.B)};
b.Db=function(a){a?(Array.isArray(a)||(a=[a]),this.vg=a,this.sz()):this.vg=null;return this};b.lz=function(){return[]};b.Lf=function(){for(var a=null,c=this.B,d=c.P,e=0;e<c.P.length;e++)if(d[e].connection===this){a=d[e];break}return a};
b.toString=function(){var a=this.B;if(a)if(a.L==this)var c="Output Connection of ";else if(a.Y==this)c="Previous Connection of ";else if(a.V==this)c="Next Connection of ";else{c=null;for(var d=0,e;e=a.P[d];d++)if(e.connection==this){c=e;break}if(c)c='Input "'+c.name+'" connection on ';else return console.warn("Connection not actually connected to sourceBlock_"),"Orphan Connection"}else return"Orphan Connection";d=a.type?'"'+a.type+'" block':"Block";a.id&&(d+=' (id="'+a.id+'")');return c+d};g.X={};g.X.il={};g.X.register=function(a,c){if("string"!=typeof a||""==a.trim())throw Error('Error: Invalid extension name "'+a+'"');if(g.X.il[a])throw Error('Error: Extension "'+a+'" is already registered.');if("function"!=typeof c)throw Error('Error: Extension "'+a+'" must be a function');g.X.il[a]=c};g.X.Rp=function(a,c){if(!c||"object"!=typeof c)throw Error('Error: Mixin "'+a+'" must be a object');g.X.register(a,function(){this.kj(c)})};
g.X.tu=function(a,c,d,e){var f='Error when registering mutator "'+a+'": ';g.X.Ow(f,c.Ab,"domToMutation");g.X.Ow(f,c.eb,"mutationToDom");var h=g.X.Qw(c,f);if(d&&"function"!=typeof d)throw Error('Extension "'+a+'" is not a function');g.X.register(a,function(){if(h){if(!g.ic)throw Error(f+"Missing require for Blockly.Mutator");this.on(new g.ic(e))}this.kj(c);d&&d.apply(this)})};g.X.unregister=function(a){g.X.il[a]?delete g.X.il[a]:console.warn('No extension mapping for name "'+a+'" found to unregister')};
g.X.apply=function(a,c,d){var e=g.X.il[a];if("function"!=typeof e)throw Error('Error: Extension "'+a+'" not found.');if(d)g.X.rD(a,c);else var f=g.X.Ys(c);e.apply(c);if(d)g.X.pD('Error after applying mutator "'+a+'": ',c);else if(!g.X.JF(f,c))throw Error('Error when applying extension "'+a+'": mutation properties changed when applying a non-mutator extension.');};
g.X.Ow=function(a,c,d){if(!c)throw Error(a+'missing required property "'+d+'"');if("function"!=typeof c)throw Error(a+'" required property "'+d+'" must be a function');};g.X.rD=function(a,c){if(g.X.Ys(c).length)throw Error('Error: tried to apply mutation "'+a+'" to a block that already has mutator functions.  Block id: '+c.id);};
g.X.Qw=function(a,c){var d=void 0!==a.yg,e=void 0!==a.Bg;if(d&&e){if("function"!=typeof a.yg)throw Error(c+"compose must be a function.");if("function"!=typeof a.Bg)throw Error(c+"decompose must be a function.");return!0}if(d||e)throw Error(c+'Must have both or neither of "compose" and "decompose"');return!1};
g.X.pD=function(a,c){if("function"!=typeof c.Ab)throw Error(a+'Applying a mutator didn\'t add "domToMutation"');if("function"!=typeof c.eb)throw Error(a+'Applying a mutator didn\'t add "mutationToDom"');g.X.Qw(c,a)};g.X.Ys=function(a){var c=[];void 0!==a.Ab&&c.push(a.Ab);void 0!==a.eb&&c.push(a.eb);void 0!==a.yg&&c.push(a.yg);void 0!==a.Bg&&c.push(a.Bg);return c};g.X.JF=function(a,c){c=g.X.Ys(c);if(c.length!=a.length)return!1;for(var d=0;d<c.length;d++)if(a[d]!=c[d])return!1;return!0};
g.X.Do=function(a,c){var d=[];"object"==typeof document&&g.g.Tz(function(){for(var e in c)g.g.Pw(c[e])});return function(){this.type&&-1==d.indexOf(this.type)&&(g.X.qD(this,a,c),d.push(this.type));this.vb(function(){var e=z(this,a),f=c[e];null==f?-1==d.indexOf(this.type)&&(e="No tooltip mapping for value "+e+" of field "+a,null!=this.type&&(e+=" of block type "+this.type),console.warn(e+".")):f=g.g.nc(f);return f}.bind(this))}};
g.X.qD=function(a,c,d){var e=B(a,c);if("function"!=typeof e.jj){e=e.getOptions();for(var f=0;f<e.length;++f){var h=e[f][1];null==d[h]&&console.warn("No tooltip mapping for value "+h+" of field "+c+" of block type "+a.type)}}};g.X.Wr=function(a){"object"==typeof document&&g.g.Tz(function(){g.g.Pw(a)});return function(){this.vb(function(){var c=B(this,"VAR");return g.g.nc(a).replace("%1",c?c.cc():"")}.bind(this))}};
g.X.kE=function(){this.WG=this.qf;this.vb(function(){var a=this.getParent();return a&&Fb(a)&&a.qf||this.WG}.bind(this))};g.X.register("parent_tooltip_when_inline",g.X.kE);g.hb={};g.hb.xs=0;g.hb.To=null;g.hb.$D=function(a){var c=a.v,d=a.wa();c.kh.play("delete");a=Gb(c,d);d=d.cloneNode(!0);d.YG=a.x;d.ZG=a.y;d.setAttribute("transform","translate("+a.x+","+a.y+")");v(c).appendChild(d);d.Gw=d.getBBox();g.hb.Ax(d,c.G,new Date,c.scale)};g.hb.Ax=function(a,c,d,e){var f=(new Date-d)/150;1<f?g.g.o.removeNode(a):(a.setAttribute("transform","translate("+(a.YG+(c?-1:1)*a.Gw.width*e/2*f)+","+(a.ZG+a.Gw.height*e*f)+") scale("+(1-f)*e+")"),setTimeout(g.hb.Ax,10,a,c,d,e))};
g.hb.CD=function(a){var c=a.v,d=c.scale;c.kh.play("click");if(!(1>d)){var e=Gb(c,a.wa());a.L?(e.x+=(a.G?3:-3)*d,e.y+=13*d):a.Y&&(e.x+=(a.G?-23:23)*d,e.y+=3*d);a=g.g.o.K("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},v(c));g.hb.$w(a,new Date,d)}};g.hb.$w=function(a,c,d){var e=(new Date-c)/150;1<e?g.g.o.removeNode(a):(a.setAttribute("r",25*e*d),a.style.opacity=1-e,g.hb.xs=setTimeout(g.hb.$w,10,a,c,d))};
g.hb.ZD=function(a){a.v.kh.play("disconnect");if(!(1>a.v.scale)){var c=J(a).height;c=Math.atan(10/c)/Math.PI*180;a.G||(c*=-1);g.hb.yx(a.wa(),c,new Date)}};g.hb.yx=function(a,c,d){var e=(new Date-d)/200;1<e?a.rn="":(a.rn="skewX("+Math.round(Math.sin(e*Math.PI*3)*(1-e)*c)+")",g.hb.To=a,g.hb.xs=setTimeout(g.hb.yx,10,a,c,d));a.setAttribute("transform",a.Bn+a.rn)};g.hb.ys=function(){if(g.hb.To){clearTimeout(g.hb.xs);var a=g.hb.To;a.rn="";a.setAttribute("transform",a.Bn);g.hb.To=null}};g.jo=function(a){this.rf=g.selected=a;this.s=a.v;this.gj=this.zt=null;this.zk=Hb(this,this.rf);this.Gc=this.zb=null;this.dg=!1;this.ij=null;this.kt=!1;this.Hk=null;a=this.rf.xe(!1);var c;a:{for(c=this.rf.V;c;){var d=C(c);if(!d)break a;c=d.V}c=null}c&&c!=this.rf.V&&(a.push(c),this.zt=c,this.gj=Hb(this,c.B));this.Pr=a};
g.jo.prototype.I=function(){this.s=this.rf=null;this.Pr.length=0;this.Gc=this.zb=null;g.i.disable();try{this.zk&&(this.zk.I(),this.zk=null),this.gj&&(this.gj.I(),this.gj=null)}finally{g.i.enable()}this.Hk=null};
g.jo.prototype.update=function(a,c){var d=this.zb&&this.Gc?g.UA:g.md;for(var e=null,f=null,h=0;h<this.Pr.length;h++){var k=this.Pr[h],l=k.closest(d,a);l.connection&&(e=l.connection,f=k,d=l.Qp)}e=(d={closest:e,local:f,Qp:d},!!d.closest)&&c!=g.Bv;if((this.dg=!!c&&!this.rf.getParent()&&this.rf.Zd()&&!e)||Ib(this,d,a)){g.i.disable();d.closest?(a=this.zb!=d.closest,c=this.Gc!=d.local,this.zb&&this.Gc&&(a||c||this.dg)&&Jb(this)):Jb(this);this.Gc=this.zb=this.ij=null;if(!this.dg&&(a=d.closest,c=d.local,
a))if(a==this.zb||a.B.Ng())console.log("Trying to connect to an insertion marker");else{this.zb=a;this.Gc=c;a=this.zb;c=this.Gc;if(c.type==g.Re)a=a.isConnected()&&!g.ra.Xy(this.rf,a.ga.B);else{a:{for(d=0;e=c.B.P[d];d++)if(e.connection&&e.connection.type==g.Ra){d=e.connection;break a}d=null}a=c==d?0:!this.rf.V&&c.type==g.Se&&a.isConnected()}if(a)a=this.zb,c=this.Gc,C(a)?(this.Hk=C(a),Kb(C(a),!0)):c.type==g.Re&&(this.Hk=a.B,a.B.cF(a,!0)),this.kt=!0;else{d=this.Gc;a=this.zb;c=this.zt&&d==this.zt?this.gj:
this.zk;a:{f=d.B;e=c.xe(!0);f=f.xe(!0);if(e.length!=f.length)throw Error("Connection lists did not match in length.");for(h=0;h<f.length;h++)if(f[h]==d){d=e[h];break a}d=null}if(d==this.ij)throw Error("Made it to connectMarker_ even though the marker isn't changing");c.za();c.ca=!0;c.wa().setAttribute("visibility","visible");d.type!=g.Ra&&d.type!=g.Ua||c.moveBy(a.Sb-d.Sb,a.Ya-d.Ya);d.connect(a);this.ij=d}this.zb&&this.zb.zm()}g.i.enable()}};
function Hb(a,c){var d=c.type;g.i.disable();try{var e=a.s.Lh(d);e.Xz(!0);e.Ug(c.isCollapsed());if(c.eb){var f=c.eb();f&&e.Ab(f)}for(a=0;a<c.P.length;a++){var h=c.P[a],k=e.P[a];for(d=0;d<h.Na.length;d++)k.Na[d].setValue(h.Na[d].getValue())}e.Ce();e.wa().setAttribute("visibility","hidden")}finally{g.i.enable()}return e}
function Ib(a,c,d){var e=c.local,f=c.closest;c=c.Qp;if(e&&f){if(a.Gc&&a.zb){if(a.zb==f&&a.Gc==e)return!1;e=a.Gc.Sb+d.x-a.zb.Sb;a=a.Gc.Ya+d.y-a.zb.Ya;a=Math.sqrt(e*e+a*a);return!(f&&c>a-g.ZA)}if(a.Gc||a.zb)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Gc||!a.zb);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0}
function Jb(a){a.zb&&(g.g.o.removeNode(g.ra.Jy),delete g.ra.Jy);if(a.kt){var c=a.zb;c.type!=g.Ua||c.isConnected()?Kb(a.Hk,!1):a.Hk.cF(c,!1);a.Hk=null;a.kt=!1}else if(a.ij)if(a.ij){c=a.ij;var d=c.B,e=d.V,f=d.Y,h=d.L;h=c.type==g.Ua&&!(h&&h.ga);!(c!=e||f&&f.ga)||h?D(C(c),!1):c.type==g.Ra&&c!=e?(e=c.ga,D(e.B,!1),f=f?f.ga:null,D(d,!0),f&&f.connect(e)):D(d,!0);if(c.ga)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.ij=null;d.wa().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")}
g.jo.prototype.Bk=function(){var a=[];this.zk&&a.push(this.zk);this.gj&&a.push(this.gj);return a};g.di=function(a,c){this.Bb=a;this.s=c;this.If=new g.jo(this.Bb);this.Ni=null;this.dg=!1;this.Zf=this.Bb.Oa();this.Wo=g.di.iF(a)};g.di.prototype.I=function(){this.qc=this.s=this.Bb=null;this.Wo.length=0;this.If&&(this.If.I(),this.If=null)};g.di.iF=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=Lb(e);for(var f=0;f<e.length;f++)c.push({location:e[f].Wi,icon:e[f]})}return c};
function Mb(a,c,d){d=a.Rk(d);var e=g.g.S.sum(a.Zf,d);a.Bb.Qt(e);for(e=0;e<a.Wo.length;e++){var f=a.Wo[e],h=f.icon;f=g.g.S.sum(f.location,d);h.Wi=f;h.isVisible()&&(h=h.Nb,h.Tb=f,h.Up&&Ca(h))}a.Ni=Nb(a.s,c);a.If.update(d,a.Ni);a.dg=a.If.dg;c=a.s.Xc;a.dg?(Ob(a.Bb,!0),a.Ni==g.Dq&&c&&Cb(c,!0)):(Ob(a.Bb,!1),c&&Cb(c,!1))}
function Pb(a,c,d){Mb(a,c,d);a.Wo=[];g.g.o.un();g.hb.ys();c=a.Rk(d);d=g.g.S.sum(a.Zf,c);var e=a.Bb;e.Jn&&(e.translate(d.x,d.y),e.v.Td.Ho(e.v.bb));d=a.s.Xc;a.dg?(d&&setTimeout(d.close.bind(d),100),a.mm(),a.Bb.I(!1,!0)):d&&d.close();a.dg||(Qb(a.Bb,c.x,c.y),a.Bb.vj(!1),a.mm(),a.If.zb?(c=a.If,c.zb&&(g.i.disable(),Jb(c),g.i.enable(),c.Gc.connect(c.zb),c.rf.ca&&(g.hb.CD((H(c.Gc)?c.zb:c.Gc).B),$a(G(c.rf))))):a.Bb.za(),Rb(a.Bb));a.s.Lc(!0);(c=a.s.oa)&&g.g.o.fc(c.wc,a.Bb.Zd()?"blocklyToolboxDelete":"blocklyToolboxGrab");
g.i.Z(!1)}g.di.prototype.mm=function(){var a=new g.i.ll(this.Bb);a.Xt=this.Zf;a.tj();g.i.Ka(a)};g.di.prototype.Rk=function(a){a=new g.g.S(a.x/this.s.scale,a.y/this.s.scale);this.s.ej&&a.scale(1/this.s.options.Kb.scale);return a};g.di.prototype.Bk=function(){return this.If&&this.If.Bk?this.If.Bk():[]};g.i.fg=function(a){this.Ef=a.id;this.uc=a.v.id;this.group=g.i.Ub();this.Jc=g.i.Jc};g.g.object.T(g.i.fg,g.i.Abstract);g.i.fg.prototype.Wa=function(){var a=g.i.fg.w.Wa.call(this);this.Ef&&(a.commentId=this.Ef);return a};g.i.fg.prototype.sa=function(a){g.i.fg.w.sa.call(this,a);this.Ef=a.commentId};g.i.Rj=function(a,c,d){a&&(g.i.Rj.w.constructor.call(this,a),this.mz=c,this.Ip=d)};g.g.object.T(g.i.Rj,g.i.fg);b=g.i.Rj.prototype;b.type=g.i.vv;
b.Wa=function(){var a=g.i.Rj.w.Wa.call(this);a.newContents=this.Ip;return a};b.sa=function(a){g.i.Rj.w.sa.call(this,a);this.Ip=a.newValue};b.Lk=function(){return this.mz==this.Ip};b.run=function(a){var c;(c=ta(this).Lo[this.Ef]||null)?c.TL(a?this.Ip:this.mz):console.warn("Can't change non-existent comment: "+this.Ef)};g.i.gg=function(a){a&&(g.i.gg.w.constructor.call(this,a),this.xml=a.Vu())};g.g.object.T(g.i.gg,g.i.fg);g.i.gg.prototype.type=g.i.Tn;
g.i.gg.prototype.Wa=function(){var a=g.i.gg.w.Wa.call(this);a.xml=g.O.Dd(this.xml);return a};g.i.gg.prototype.sa=function(a){g.i.gg.w.sa.call(this,a);this.xml=g.O.$h(a.xml)};g.i.gg.prototype.run=function(a){g.i.xv(this,a)};g.i.xv=function(a,c){var d=ta(a);c?(c=g.g.xml.createElement("xml"),c.appendChild(a.xml),g.O.uh(c,d)):(d=d.Lo[a.Ef]||null)?d.I(!1,!1):console.warn("Can't uncreate non-existent comment: "+a.Ef)};g.i.hg=function(a){a&&(g.i.hg.w.constructor.call(this,a),this.xml=a.Vu())};
g.g.object.T(g.i.hg,g.i.fg);g.i.hg.prototype.type=g.i.wv;g.i.hg.prototype.Wa=function(){return g.i.hg.w.Wa.call(this)};g.i.hg.prototype.sa=function(a){g.i.hg.w.sa.call(this,a)};g.i.hg.prototype.run=function(a){g.i.xv(this,!a)};g.i.gi=function(a){a&&(g.i.gi.w.constructor.call(this,a),this.gs=a,this.Yt=a.vy(),this.lj=null)};g.g.object.T(g.i.gi,g.i.fg);b=g.i.gi.prototype;
b.tj=function(){if(!this.gs)throw Error("Tried to record the new position of a comment on the same event twice.");this.lj=this.gs.vy();this.gs=null};b.type=g.i.Un;b.Wa=function(){var a=g.i.gi.w.Wa.call(this);this.lj&&(a.newCoordinate=Math.round(this.lj.x)+","+Math.round(this.lj.y));return a};b.sa=function(a){g.i.gi.w.sa.call(this,a);a.newCoordinate&&(a=a.newCoordinate.split(","),this.lj=new g.g.S(Number(a[0]),Number(a[1])))};b.Lk=function(){return g.g.S.ve(this.Yt,this.lj)};
b.run=function(a){var c;if(c=ta(this).Lo[this.Ef]||null){a=a?this.lj:this.Yt;var d=c.vy();c.moveBy(a.x-d.x,a.y-d.y)}else console.warn("Can't move non-existent comment: "+this.Ef)};g.ml=function(a,c){this.lc=a;this.s=c;this.Ni=null;this.nq=!1;this.Zf=this.lc.Oa();this.Pi=g.g.$i()&&c.Td?c.Td:null};g.ml.prototype.I=function(){this.Pi=this.s=this.lc=null};function Sb(a,c,d){d=a.Rk(d);d=g.g.S.sum(a.Zf,d);a.lc.Qt(a.Pi,d);a.lc.Zd()&&(a.Ni=Nb(a.s,c),a.nq=a.Ni!=g.Av,c=a.s.Xc,a.nq?(Ob(a.lc,!0),a.Ni==g.Dq&&c&&Cb(c,!0)):(Ob(a.lc,!1),c&&Cb(c,!1)))}
function Tb(a,c,d){Sb(a,c,d);c=a.Rk(d);c=g.g.S.sum(a.Zf,c);a.lc.moveTo(c.x,c.y);c=a.s.Xc;a.nq?(c&&setTimeout(c.close.bind(c),100),a.mm(),a.lc.I(!1,!0)):c&&c.close();a.nq||(a.Pi&&a.Pi.Ho(a.s.pf),a.lc.vj&&a.lc.vj(!1),a.mm());a.s.Lc(!0);a.s.oa&&g.g.o.fc(a.s.oa.wc,a.lc.Zd()?"blocklyToolboxDelete":"blocklyToolboxGrab");g.i.Z(!1)}g.ml.prototype.mm=function(){if(this.lc.Ry){var a=new g.i.gi(this.lc);a.Yt=this.Zf;a.tj();g.i.Ka(a)}};
g.ml.prototype.Rk=function(a){a=new g.g.S(a.x/this.s.scale,a.y/this.s.scale);this.s.ej&&a.scale(1/this.s.options.Kb.scale);return a};g.ml.prototype.St=function(){this.lc.moveTo(0,0);this.Pi.Gj(this.Zf.x,this.Zf.y);Ub(this.Pi,this.lc.wa())};g.sL={};g.Sv=40;g.aw=125;g.gB=5;g.pB=10;g.md=28;g.UA=g.md;g.ZA=8;g.DB="#000000";g.Pn=250;g.yq=10;g.SA=30;g.TB=750;g.wC=100;g.hB=!0;g.zB=.45;g.AB=.65;g.nd={width:96,height:124,url:"sprites.png"};g.Ua=1;g.Re=2;g.Ra=3;g.Se=4;g.jg=5;g.uq=-1;g.iv=0;g.Ln=1;g.YH=0;g.ZH=1;g.WH=1;g.XH=2;g.dk=[];g.dk[g.Ua]=g.Re;g.dk[g.Re]=g.Ua;g.dk[g.Ra]=g.Se;g.dk[g.Se]=g.Ra;g.qg=0;g.xi=1;g.zd=2;g.pg=3;g.Av=null;g.Dq=1;g.Bv=2;g.sw="VARIABLE";g.KC="VARIABLE_DYNAMIC";g.bw="PROCEDURE";g.iw="RENAME_VARIABLE_ID";g.Cv="DELETE_VARIABLE_ID";g.Ml=function(a){this.s=a;this.fA=new g.g.S(a.scrollX,a.scrollY)};g.Ml.prototype.I=function(){this.s=null};g.Ml.prototype.Qu=function(){g.selected&&Vb(g.selected);qa(this.s)};g.Ml.prototype.vh=function(a){a=g.g.S.sum(this.fA,a);this.s.scroll(a.x,a.y)};g.co=function(a){g.co.w.constructor.call(this,a.Dk());this.pc=a.pc;this.ef=a.ef};g.g.object.T(g.co,g.Ml);g.co.prototype.vh=function(a){a=g.g.S.sum(this.fA,a);this.ef?this.pc.set(-a.x):this.pc.set(-a.y)};g.J={};g.J.visible=!1;g.J.nk=!1;g.J.NB=50;g.J.iz=0;g.J.qn=0;g.J.Bt=0;g.J.Ct=0;g.J.cb=null;g.J.Op=null;g.J.Wv=0;g.J.Xv=10;g.J.oC=10;g.J.yB=750;g.J.Rq=5;g.J.Ca=null;g.J.Ga=function(){g.J.Ca||(g.J.Ca=document.createElement("div"),g.J.Ca.className="blocklyTooltipDiv",document.body.appendChild(g.J.Ca))};g.J.mk=function(a){g.yc(a,"mouseover",null,g.J.hG);g.yc(a,"mouseout",null,g.J.gG);a.addEventListener("mousemove",g.J.fG,!1)};
g.J.hG=function(a){if(!g.J.nk){for(a=a.currentTarget;"string"!=typeof a.qf&&"function"!=typeof a.qf;)a=a.qf;g.J.cb!=a&&(g.J.ya(),g.J.Op=null,g.J.cb=a);clearTimeout(g.J.iz)}};g.J.gG=function(){g.J.nk||(g.J.iz=setTimeout(function(){g.J.cb=null;g.J.Op=null;g.J.ya()},1),clearTimeout(g.J.qn))};
g.J.fG=function(a){if(g.J.cb&&g.J.cb.qf&&!g.J.nk)if(g.J.visible){var c=g.J.Bt-a.pageX;a=g.J.Ct-a.pageY;Math.sqrt(c*c+a*a)>g.J.oC&&g.J.ya()}else g.J.Op!=g.J.cb&&(clearTimeout(g.J.qn),g.J.Bt=a.pageX,g.J.Ct=a.pageY,g.J.qn=setTimeout(g.J.GG,g.J.yB))};g.J.ya=function(){g.J.visible&&(g.J.visible=!1,g.J.Ca&&(g.J.Ca.style.display="none"));g.J.qn&&clearTimeout(g.J.qn)};g.J.block=function(){g.J.ya();g.J.nk=!0};g.J.$G=function(){g.J.nk=!1};
g.J.GG=function(){if(!g.J.nk&&(g.J.Op=g.J.cb,g.J.Ca)){g.J.Ca.innerHTML="";for(var a=g.J.cb.qf;"function"==typeof a;)a=a();a=g.g.ab.sA(a,g.J.NB);a=a.split("\n");for(var c=0;c<a.length;c++){var d=document.createElement("div");d.appendChild(document.createTextNode(a[c]));g.J.Ca.appendChild(d)}a=g.J.cb.G;c=document.documentElement.clientWidth;d=document.documentElement.clientHeight;g.J.Ca.style.direction=a?"rtl":"ltr";g.J.Ca.style.display="block";g.J.visible=!0;var e=g.J.Bt;e=a?e-(g.J.Wv+g.J.Ca.offsetWidth):
e+g.J.Wv;var f=g.J.Ct+g.J.Xv;f+g.J.Ca.offsetHeight>d+window.scrollY&&(f-=g.J.Ca.offsetHeight+2*g.J.Xv);a?e=Math.max(g.J.Rq-window.scrollX,e):e+g.J.Ca.offsetWidth>c+window.scrollX-2*g.J.Rq&&(e=c-g.J.Ca.offsetWidth-2*g.J.Rq);g.J.Ca.style.top=f+"px";g.J.Ca.style.left=e+"px"}};g.Uj=function(a,c){this.qc=this.rc=this.yj=this.zj=this.ae=this.pd=this.hz=null;this.ls=c;this.Em=this.cj=this.Fm=this.Ri=!1;this.kf=a;this.M=this.ci=this.We=this.tg=this.Lp=this.Kp=null;this.xp=this.Ti=this.Lw=!1;this.Fy=!g.hB};b=g.Uj.prototype;b.I=function(){g.Touch.nh();g.J.$G();this.ls.Bc=null;this.Kp&&g.Xa(this.Kp);this.Lp&&g.Xa(this.Lp);this.M=this.qc=this.rc=this.yj=this.zj=null;this.We&&(this.We.I(),this.We=null);this.ci&&(this.ci.I(),this.ci=null);this.tg&&(this.tg.I(),this.tg=null)};
function Wb(a,c){a.pd=g.g.S.hm(new g.g.S(c.clientX,c.clientY),a.hz);if(a.Ri)var d=!1;else a.Ri=g.g.S.yF(a.pd)>(a.M?g.pB:g.gB),d=a.Ri;if(d){if(a.Lw)throw Error("updateIsDragging_ should only be called once per gesture.");a.Lw=!0;if(a.ae){a.Em=!0;a.tg=new g.ml(a.ae,a.qc);d=a.tg;g.i.Ub()||g.i.Z(!0);d.s.Lc(!1);d.lc.Or=!1;d.Pi&&d.St();d.lc.vj&&d.lc.vj(!0);var e=d.s.oa;e&&g.g.o.qb(e.wc,d.lc.Zd()?"blocklyToolboxDelete":"blocklyToolboxGrab");Sb(a.tg,a.kf,a.pd);d=!0}else d=!1;if(!d){if(a.rc)if(a.M?(a.M.Qy(a.rc)?
((d=!Xb(a.M))||(d=a.pd,d=Math.atan2(d.y,d.x)/Math.PI*180,e=a.M.eE,d=d<e&&d>-e||d<-180+e||d>180-e?!0:!1),d?(a.qc=a.M.jb,Yb(a.qc),g.i.Ub()||g.i.Z(!0),a.yj=null,a.rc=Va(a.M,a.rc),a.rc.select(),d=!0):d=!1):d=!1,a.cj=d):a.rc.Fc()&&(a.cj=!0),a.cj){a.We=new g.di(a.rc,a.qc);d=a.We;e=a.pd;var f=a.Fy;g.i.Ub()||g.i.Z(!0);d.s.ej&&$a(d.Bb);g.g.o.tn();d.s.Lc(!1);g.hb.ys();if(d.Bb.getParent()||f&&d.Bb.V&&C(d.Bb.V))D(d.Bb,f),e=d.Rk(e),e=g.g.S.sum(d.Zf,e),d.Bb.translate(e.x,e.y),g.hb.ZD(d.Bb);d.Bb.vj(!0);d.Bb.St();
(e=d.s.oa)&&g.g.o.qb(e.wc,d.Bb.Zd()?"blocklyToolboxDelete":"blocklyToolboxGrab");Mb(a.We,a.kf,a.pd);d=!0}else d=!1;else d=!1;if(d=!d)if(a.M)d=Xb(a.M);else if(d=a.qc)d=a.qc,d=d.options.Hc&&d.options.Hc.vh;d&&(a.ci=a.M?new g.co(a.M):new g.Ml(a.qc),a.Fm=!0,a.ci.Qu())}g.Kh()}a.kf=c}
b.zs=function(a){g.g.Ap(a)?this.cancel():(this.Ti=!0,g.hb.ys(),Yb(this.qc),this.qc.ej&&this.qc.resize(),oa(this.qc),this.kf=a,g.mc(!!this.M),g.J.block(),this.rc&&(!this.rc.Wb&&a.shiftKey?(g.navigation.Ls(),w(this.ls.Va,g.navigation.bt(this.rc))):this.rc.select()),g.g.fj(a)?ba(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||g.wF(a,this),this.hz=new g.g.S(a.clientX,a.clientY),this.Fy=a.altKey||a.ctrlKey||a.metaKey,this.mk(a)))};
b.mk=function(a){this.Kp=g.ka(document,"mousemove",null,this.wm.bind(this));this.Lp=g.ka(document,"mouseup",null,this.mp.bind(this));a.preventDefault();a.stopPropagation()};b.wm=function(a){Wb(this,a);this.Fm?this.ci.vh(this.pd):this.cj?Mb(this.We,this.kf,this.pd):this.Em&&Sb(this.tg,this.kf,this.pd);a.preventDefault();a.stopPropagation()};
b.mp=function(a){Wb(this,a);g.Kh();if(this.xp)console.log("Trying to end a gesture recursively.");else{this.xp=!0;if(this.Em)Tb(this.tg,a,this.pd);else if(this.cj)Pb(this.We,a,this.pd);else if(this.Fm){var c=this.ci;c.vh(this.pd);ra(c.s)}else if(this.ae&&!this.Ri)this.ae.DG&&this.ae.DG(),this.ae.select&&this.ae.select();else if(Zb(this))this.zj.Le(),$b(this);else if(this.yj&&!this.Ri&&!Zb(this))this.M&&this.M.lk?this.rc.isEnabled()&&(g.i.Ub()||g.i.Z(!0),Rb(Va(this.M,this.rc))):g.i.Ka(new g.i.od(this.yj,
"click",void 0,void 0)),$b(this),g.i.Z(!1);else if(!(this.yj||this.ae||this.zj||this.Ri))if(c=this.ls,a.shiftKey){g.navigation.Ls();var d=g.g.AG(c,new g.g.S(a.clientX,a.clientY));d=g.F.cm(c,d);w(c.Va,d)}else g.selected&&Vb(g.selected);a.preventDefault();a.stopPropagation();this.I()}};b.cancel=function(){if(!this.xp){g.Kh();if(this.Em)Tb(this.tg,this.kf,this.pd);else if(this.cj)Pb(this.We,this.kf,this.pd);else if(this.Fm){var a=this.ci;a.vh(this.pd);ra(a.s)}this.I()}};
function ba(a,c){a.rc?($b(a),g.mc(a.M),a.rc.pn(c)):a.ae?a.ae.pn(c):a.qc&&!a.M&&(g.mc(),a.qc.pn(c));c.preventDefault();c.stopPropagation();a.I()}function ac(a,c,d){if(a.Ti)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");a.qc||(a.qc=d);a.kf=c;a.zs(c);g.De&&g.navigation.Eb(g.navigation.Gl)}function bc(a,c,d){if(a.Ti)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");a.M||(a.M=d);ac(a,c,d.Dk())}
function $b(a){a.rc&&!a.M&&$a(a.rc)}function cc(a,c){a.yj||a.ae||(a.yj=c,c.Wb&&c!=G(c)?dc(a,G(c)):dc(a,c))}function dc(a,c){c.$a?dc(a,c.getParent()):a.rc=c}function Zb(a){if(a.zj){var c=a.zj;c=!!c.B&&c.B.cd()&&!!c.Le&&"function"===typeof c.Le}else c=!1;return c&&!a.Ri&&(!a.M||!a.M.lk)}b.dc=function(){return this.Fm||this.cj||this.Em};b.Bk=function(){return this.We?this.We.Bk():[]};g.Uj.nt=function(){for(var a=g.Fb.getAll(),c=0,d;d=a[c];c++)if(d.Bc)return!0;return!1};g.Ha=function(a,c,d){this.kA=this.Ij=this.kb=null;this.Lb=new g.g.qe(0,0);this.Sc=null;d&&this.Ad(d);this.setValue(a);c&&(this.Ij=c)};g.Ha.rv=16;g.Ha.pw=12.5;g.Ha.Nl=10;g.Ha.Aw=10;g.Ha.ji=g.Ha.Nl/2;b=g.Ha.prototype;b.name=void 0;b.ez=50;b.B=null;b.ff=!0;b.bi=!0;b.Io=null;g.Ha.Vv="\u00a0";b=g.Ha.prototype;b.uf=!0;b.gk=!1;b.Ad=function(a){var c=a.tooltip;"string"==typeof c&&(c=g.g.nc(a.tooltip));c&&this.vb(c)};b.Ku=function(a){if(this.B)throw Error("Field already bound to a block.");this.B=a};
b.aa=function(){this.we||(this.we=g.g.o.K("g",{},null),this.isVisible()||(this.we.style.display="none"),this.B.wa().appendChild(this.we),this.Yi(),this.Yg(),this.vb(this.kA),g.J.mk(this.Io||this.wa()),this.gz=g.ka(this.Io||this.wa(),"mousedown",this,this.Oh),this.Xi())};b.Yi=function(){this.Lb.height=Math.max(this.Lb.height,g.Ha.rv);this.Lb.width=Math.max(this.Lb.width,g.Ha.Nl);this.Ei=g.g.o.K("rect",{rx:4,ry:4,x:0,y:0,height:this.Lb.height,width:this.Lb.width},this.we);ec(this)};b.Xi=function(){};
function ec(a){a.tc=g.g.o.K("text",{"class":"blocklyText",y:g.Ha.pw,x:a.Ei?g.Ha.ji:0},a.we);a.Ej=document.createTextNode("");a.tc.appendChild(a.Ej)}b.pm=function(a){this.setValue(a.textContent)};b.iA=function(a){a.textContent=this.getValue();return a};b.I=function(){g.D.ym(this);g.$.ym(this);this.gz&&g.Xa(this.gz);g.g.o.removeNode(this.we)};
b.Yg=function(){var a=this.Io||this.wa();this.uf&&a&&(this.B.cd()?(g.g.o.qb(a,"blocklyEditableText"),g.g.o.fc(a,"blocklyNonEditableText"),a.style.cursor=this.Cq):(g.g.o.qb(a,"blocklyNonEditableText"),g.g.o.fc(a,"blocklyEditableText"),a.style.cursor=""))};b.isVisible=function(){return this.bi};b.Qb=function(a){if(this.bi!=a){this.bi=a;var c=this.wa();c&&(c.style.display=a?"block":"none")}};function fc(a,c){a.Ij=c}b.sy=function(){return this.Ij};b.wa=function(){return this.we};b.Ne=function(){};
b.Tf=function(){if(this.Ej){this.Ej.nodeValue=gc(this);var a=g.g.o.jp(this.tc);this.Ei&&(a+=g.Ha.Nl,this.Ei.setAttribute("width",a));this.Lb.width=a}};b.Hg=function(){if(!this.isVisible())return new g.g.qe(0,0);this.ff?(this.Tf(),this.ff=!1):this.bi&&0==this.Lb.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.Tf());return this.Lb};
function gc(a){var c=a.cc();if(!c)return g.Ha.Vv;c.length>a.ez&&(c=c.substring(0,a.ez-2)+"\u2026");c=c.replace(/\s/g,g.Ha.Vv);a.B&&a.B.G&&(c+="\u200f");return c}b.cc=function(){if(this.Ck){var a=this.Ck.call(this);if(null!==a)return String(a)}return String(this.getValue())};b.Yk=function(){throw Error("setText method is deprecated");};b.Pm=function(){this.ff=!0};function hc(a){a.ff=!0;a.B&&a.B.ca&&(a.B.za(),a.B.Hb())}
b.setValue=function(a){if(null!==a){var c=this.Dg(a);a=ic(this,a,c);if(!(a instanceof Error)){if(c=this.sy())if(c=c.call(this,a),a=ic(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.B&&g.i.isEnabled()&&g.i.Ka(new g.i.eg(this.B,"field",this.name||null,c,a)),this.sh(a),this.ff&&hc(this))}}};function ic(a,c,d){if(null===d)return a.Ex(),a.ff&&hc(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.kb};b.Dg=function(a){return null===a||void 0===a?null:a};
b.sh=function(a){this.kb=a;this.ff=!0};b.Ex=function(){};b.Oh=function(a){if(this.B&&this.B.v&&(a=this.B.v.Gg(a))){if(a.Ti)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.zj||(a.zj=this)}};b.vb=function(a){var c=this.Io||this.wa();c?c.qf=a||""===a?a:this.B:this.kA=a};b.fn=function(){return!1};b.Lf=function(){for(var a=null,c=this.B,d=c.P,e=0;e<c.P.length;e++)for(var f=d[e],h=f.Na,k=0;k<h.length;k++)if(h[k]===this){a=f;break}return a};b.by=function(){return!1};
b.Ty=function(){return!1};b.Nh=function(){return!1};b.mn=function(a){a?(this.we.appendChild(a),this.Sc=a):this.Sc=null};b.nn=function(a){a&&this.we.appendChild(a)};g.Dc={};g.Dc.Cn={};g.Dc.register=function(a,c){if("string"!=typeof a||""==a.trim())throw Error('Invalid field type "'+a+'". The type must be a non-empty string.');if(g.Dc.Cn[a])throw Error('Error: Field "'+a+'" is already registered.');if(!c||"function"!=typeof c.sa)throw Error('Field "'+c+'" must have a fromJson function');a=a.toLowerCase();g.Dc.Cn[a]=c};g.Dc.unregister=function(a){g.Dc.Cn[a]?delete g.Dc.Cn[a]:console.warn('No field mapping for type "'+a+'" found to unregister')};
g.Dc.sa=function(a){var c=g.Dc.Cn[a.type.toLowerCase()];return c?c.sa(a):(console.warn("Blockly could not create a field of type "+a.type+". The field is probably not being registered. This could be because the file is not loaded, the field does not register itself (Issue #1584), or the registration is not being reached."),null)};g.Od=function(a,c,d){this.Go=null;null==a&&(a="");g.Od.w.constructor.call(this,a,null,d);d||(this.Go=c||null);this.Lb=new g.g.qe(0,g.Ha.pw)};g.g.object.T(g.Od,g.Ha);g.Od.sa=function(a){var c=g.g.nc(a.text);return new g.Od(c,void 0,a)};g.Od.prototype.uf=!1;g.Od.prototype.Ad=function(a){g.Od.w.Ad.call(this,a);this.Go=a["class"]};g.Od.prototype.Yi=function(){ec(this);this.tc.setAttribute("y",this.Lb.height);this.Go&&g.g.o.qb(this.tc,this.Go)};
g.Od.prototype.Dg=function(a){return null===a||void 0===a?null:String(a)};g.Dc.register("field_label",g.Od);g.Pv=function(a,c,d,e){if(a!=g.jg&&!c)throw Error("Value inputs and statement inputs must have non-empty name.");this.type=a;this.name=c;this.B=d;this.connection=e;this.Na=[]};b=g.Pv.prototype;b.align=g.uq;b.bi=!0;function K(a,c,d){jc(a,a.Na.length,c,d);return a}
function jc(a,c,d,e){if(0>c||c>a.Na.length)throw Error("index "+c+" out of bounds.");if(!(d||""==d&&e))return c;"string"==typeof d&&(d=new g.Od(d));d.Ku(a.B);a.B.ca&&d.aa();d.name=e;d.nu&&(c=jc(a,c,d.nu));a.Na.splice(c,0,d);++c;d.Su&&(c=jc(a,c,d.Su));a.B.ca&&(a.B.za(),a.B.Hb());return c}b.isVisible=function(){return this.bi};
b.Qb=function(a){var c=[];if(this.bi==a)return c;for(var d=(this.bi=a)?"block":"none",e=0,f;f=this.Na[e];e++)f.Qb(a);if(this.connection){if(a)c=kc(this.connection);else if(e=this.connection,lc(e,!0),e.ga)for(e=p(C(e),!1),f=0;f<e.length;f++){for(var h=e[f],k=h.xe(!0),l=0;l<k.length;l++)lc(k[l],!0);h=Lb(h);for(l=0;l<h.length;l++)h[l].Qb(!1)}if(e=C(this.connection))e.wa().style.display=d,a||(e.ca=!1)}return c};b.Pm=function(){for(var a=0,c;c=this.Na[a];a++)c.Pm()};
b.Db=function(a){if(!this.connection)throw Error("This input does not have a connection.");this.connection.Db(a);return this};function mc(a,c){a.align=c;a.B.ca&&a.B.za();return a}b.aa=function(){if(this.B.v.ca)for(var a=0;a<this.Na.length;a++)this.Na[a].aa()};b.I=function(){for(var a=0,c;c=this.Na[a];a++)c.I();this.connection&&this.connection.I();this.B=null};g.Qn=function(a,c,d){if(g.Generator&&"undefined"!=typeof g.Generator.prototype[c])throw Error('Block prototypeName "'+c+'" conflicts with Blockly.Generator members.');this.id=d&&!x(a,d)?d:g.g.Eg();a.Rr[this.id]=this;this.Y=this.V=this.L=null;this.P=[];this.Mg=void 0;this.disabled=!1;this.qf="";this.contextMenu=!0;this.Qf=null;this.wg=[];this.Hx=this.jz=this.Qo=!0;this.xg=this.$a=!1;this.qk=null;this.te={text:null,mu:!1,size:new g.g.qe(160,80)};this.wA=new g.g.S(0,0);this.v=a;this.Wb=a.$d;this.G=a.G;
this.Im=!1;this.Jg=void 0;if(c){this.type=c;d=g.W[c];if(!d||"object"!=typeof d)throw TypeError("Unknown block type: "+c);g.g.object.kj(this,d)}a.cl.push(this);a.Xg[this.type]||(a.Xg[this.type]=[]);a.Xg[this.type].push(this);"function"==typeof this.aa&&this.aa();this.kF=this.Mg;if(g.i.isEnabled()){(a=g.i.Ub())||g.i.Z(!0);try{g.i.Ka(new g.i.Rn(this))}finally{a||g.i.Z(!1)}}if("function"==typeof this.onchange){if((a=this.onchange)&&"function"!=typeof a)throw Error("onchange must be a function.");this.Wm&&
Ba(this.v,this.Wm);if(this.onchange=a)this.Wm=a.bind(this),Aa(this.v,this.Wm)}};b=g.Qn.prototype;b.data=null;b.oh="#000000";b.Uw=null;b.Vw=null;
b.I=function(a){if(this.v){this.Wm&&Ba(this.v,this.Wm);g.De&&g.navigation.kz(this);D(this,a);g.i.isEnabled()&&g.i.Ka(new g.i.MA(this));g.i.disable();try{if(this.v){va(this.v,this);var c=this.v;c.Xg[this.type].splice(c.Xg[this.type].indexOf(this),1);c.Xg[this.type].length||delete c.Xg[this.type];delete this.v.Rr[this.id];this.v=null}g.selected==this&&(g.selected=null);for(var d=this.wg.length-1;0<=d;d--)this.wg[d].I(!1);d=0;for(var e;e=this.P[d];d++)e.I();this.P.length=0;var f=this.xe(!0);d=0;for(var h;h=
f[d];d++)h.I()}finally{g.i.enable()}}};b.Xi=function(){for(var a=0,c;c=this.P[a];a++)for(var d=0,e;e=c.Na[d];d++)e.Xi&&e.Xi()};
function D(a,c){if(a.L){var d=null;a.L.isConnected()&&(d=a.L.ga,a.L.disconnect());if(d&&c){a:{c=null;for(var e=0;e<a.P.length;e++){var f=a.P[e].connection;if(f&&f.type==g.Ua&&f.ga){if(c){a=null;break a}c=f}}a=c}a&&a.isConnected()&&!C(a).$a&&(a=a.ga,a.disconnect(),Eb(a,d)?d.connect(a):a.Jp(d))}}else a.Y&&(d=null,a.Y.isConnected()&&(d=a.Y.ga,a.Y.disconnect()),e=t(a),c&&e&&!e.$a&&(a=a.V.ga,a.disconnect(),d&&Eb(d,a)&&d.connect(a)))}
b.xe=function(){var a=[];this.L&&a.push(this.L);this.Y&&a.push(this.Y);this.V&&a.push(this.V);for(var c=0,d;d=this.P[c];c++)d.connection&&a.push(d.connection);return a};b.Hb=function(){console.warn("Not expected to reach Block.bumpNeighbours function. BlockSvg.bumpNeighbours was expected to be called instead.")};b.getParent=function(){return this.Qf};function nc(a){do{var c=a;a=a.getParent();if(!a)return null}while(t(a)==c);return a}function t(a){return a.V&&C(a.V)}
function G(a){var c=a;do a=c,c=a.Qf;while(c);return a}b.xh=function(a){if(!a)return this.wg;a=[];for(var c=0,d;d=this.P[c];c++)d.connection&&(d=C(d.connection))&&a.push(d);(c=t(this))&&a.push(c);return a};b.Xk=function(a){if(a!=this.Qf){if(this.Qf){g.g.Co(this.Qf.wg,this);if(this.Y&&this.Y.isConnected())throw Error("Still connected to previous block.");if(this.L&&this.L.isConnected())throw Error("Still connected to parent block.");this.Qf=null}else va(this.v,this);(this.Qf=a)?a.wg.push(this):this.v.cl.push(this)}};
function p(a,c){var d=[a];a=a.xh(c);for(var e,f=0;e=a[f];f++)d.push.apply(d,p(e,c));return d}b.Zd=function(){return this.Qo&&!this.$a&&!(this.v&&this.v.options.readOnly)};b.Fc=function(){return this.jz&&!this.$a&&!(this.v&&this.v.options.readOnly)};b.$p=function(a){this.jz=a};b.Ju=function(a){this.$a=a};b.Ng=function(){return this.Im};b.Xz=function(a){this.Im=a};b.cd=function(){return this.Hx&&!(this.v&&this.v.options.readOnly)};
b.Fu=function(a){this.Hx=a;a=0;for(var c;c=this.P[a];a++)for(var d=0,e;e=c.Na[d];d++)e.Yg()};b.vb=function(a){this.qf=a};function oc(a){var c=a.Uw;return c?c:g.g.Ib.Qr("#fff",a.oh,.6)}function pc(a){var c=a.Vw;if(c)return{Ko:c,fs:null,Tw:null};a=a.oh;return{Ko:null,fs:g.g.Ib.Qr("#fff",a,.3),Tw:g.g.Ib.Qr("#000",a,.2)}}
b.mf=function(a){var c="string"==typeof a?g.g.nc(a):a,d=Number(c);if(!isNaN(d)&&0<=d&&360>=d)this.oh=g.Ky(d);else if(d=g.g.Ib.parse(c))this.oh=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);};function L(a,c){var d=a.v.kp().gD[c];if(d)a.Uw=d.colourSecondary,a.Vw=d.colourTertiary,a.Jg=d.Jg,a.mf(d.colourPrimary);else throw Error("Invalid style name: "+c);}function B(a,c){for(var d=0,e;e=a.P[d];d++)for(var f=0,h;h=e.Na[f];f++)if(h.name==c)return h;return null}
b.et=function(){for(var a=[],c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)f.fn()&&a.push(f.getValue());return a};b.Ig=function(){for(var a=[],c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)f.fn()&&(f=this.v.cf(f.getValue()))&&a.push(f);return a};b.lq=function(a){for(var c=0,d;d=this.P[c];c++)for(var e=0,f;f=d.Na[e];e++)f.fn()&&a.ua()==f.getValue()&&hc(f)};b.Sp=function(a,c){for(var d=0,e;e=this.P[d];d++)for(var f=0,h;h=e.Na[f];f++)h.fn()&&a==h.getValue()&&h.setValue(c)};
function z(a,c){return(a=B(a,c))?a.getValue():null}function qc(a,c,d){a=B(a,d);if(!a)throw Error('Field "'+d+'" not found.');a.setValue(c)}b.Wf=function(a,c){if(a){void 0===c&&(c=null);if(!this.Y){if(this.L)throw Error("Remove output connection prior to adding previous connection.");this.Y=this.Om(g.Se)}this.Y.Db(c)}else if(this.Y){if(this.Y.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.Y.I();this.Y=null}};
b.Vf=function(a,c){if(a)void 0===c&&(c=null),this.V||(this.V=this.Om(g.Ra)),this.V.Db(c);else if(this.V){if(this.V.isConnected())throw Error("Must disconnect next statement before removing connection.");this.V.I();this.V=null}};
b.Ke=function(a,c){if(a){void 0===c&&(c=null);if(!this.L){if(this.Y)throw Error("Remove previous connection prior to adding output connection.");this.L=this.Om(g.Re)}this.L.Db(c)}else if(this.L){if(this.L.isConnected())throw Error("Must disconnect output value before removing connection.");this.L.I();this.L=null}};b.Je=function(a){this.Mg!=a&&(g.i.Ka(new g.i.eg(this,"inline",null,this.Mg,a)),this.Mg=a)};
function Fb(a){if(void 0!=a.Mg)return a.Mg;for(var c=1;c<a.P.length;c++)if(a.P[c-1].type==g.jg&&a.P[c].type==g.jg)return!1;for(c=1;c<a.P.length;c++)if(a.P[c-1].type==g.Ua&&a.P[c].type==g.jg)return!0;return!1}b.Eu=function(a){console.warn("Deprecated call to Blockly.Block.prototype.setDisabled, use Blockly.Block.prototype.setEnabled instead.");this.Kc(!a)};b.isEnabled=function(){return!this.disabled};
b.Kc=function(a){this.isEnabled()!=a&&(g.i.Ka(new g.i.eg(this,"disabled",null,this.disabled,!a)),this.disabled=!a)};function rc(a){for(a=nc(a);a;){if(a.disabled)return!0;a=nc(a)}return!1}b.isCollapsed=function(){return this.xg};b.Ug=function(a){this.xg!=a&&(g.i.Ka(new g.i.eg(this,"collapsed",null,this.xg,a)),this.xg=a)};
b.toString=function(a,c){var d=[],e=c||"?";if(this.xg)d.push(E(this,"_TEMP_COLLAPSED_INPUT").Na[0].cc());else for(var f=0,h;h=this.P[f];f++){for(var k=0,l;l=h.Na[k];k++)d.push(l.cc());h.connection&&((h=C(h.connection))?d.push(h.toString(void 0,c)):d.push(e))}d=d.join(" ").trim()||"???";a&&d.length>a&&(d=d.substring(0,a-3)+"...");return d};function M(a,c){return a.Bf(g.Ua,c)}function N(a,c){return a.Bf(g.jg,c||"")}
function sc(a,c){var d=c.type?'Block "'+c.type+'": ':"";if(c.output&&c.previousStatement)throw Error(d+"Must not have both an output and a previousStatement.");c.style&&c.style.Jg&&(a.Jg=c.style.Jg,c.style=null);if(c.style&&c.colour)throw Error(d+"Must not have both a colour and a style.");if(c.style){var e=c.style;try{L(a,e)}catch(F){console.warn(d+"Style does not exist: ",e)}}else if("colour"in c)if(void 0===c.colour)console.warn(d+"Undefined colour value.");else{e=c.colour;try{a.mf(e)}catch(F){console.warn(d+
"Illegal colour value: ",e)}}for(e=0;void 0!==c["message"+e];){for(var f=a,h=c["args"+e]||[],k=c["lastDummyAlign"+e],l=g.g.UG(c["message"+e]),m=[],n=0,q=[],r=0;r<l.length;r++){var u=l[r];if("number"==typeof u){if(0>=u||u>h.length)throw Error('Block "'+f.type+'": Message index %'+u+" out of range.");if(m[u])throw Error('Block "'+f.type+'": Message index %'+u+" duplicated.");m[u]=!0;n++;q.push(h[u-1])}else(u=u.trim())&&q.push(u)}if(n!=h.length)throw Error('Block "'+f.type+'": Message does not reference all '+
h.length+" arg(s).");q.length&&("string"==typeof q[q.length-1]||g.g.ab.startsWith(q[q.length-1].type,"field_"))&&(r={type:"input_dummy"},k&&(r.align=k),q.push(r));k={LEFT:g.uq,RIGHT:g.Ln,CENTRE:g.iv};h=[];for(r=0;r<q.length;r++)if(m=q[r],"string"==typeof m)h.push([m,void 0]);else{l=n=null;do if(u=!1,"string"==typeof m)n=new g.Od(m);else switch(m.type){case "input_value":l=M(f,m.name);break;case "input_statement":l=f.Bf(g.Ra,m.name);break;case "input_dummy":l=N(f,m.name);break;default:n=g.Dc.sa(m),
!n&&m.alt&&(m=m.alt,u=!0)}while(u);if(n)h.push([n,m.name]);else if(l){m.check&&l.Db(m.check);m.align&&mc(l,k[m.align]);for(m=0;m<h.length;m++)K(l,h[m][0],h[m][1]);h.length=0}}e++}void 0!==c.inputsInline&&a.Je(c.inputsInline);void 0!==c.output&&a.Ke(!0,c.output);void 0!==c.previousStatement&&a.Wf(!0,c.previousStatement);void 0!==c.nextStatement&&a.Vf(!0,c.nextStatement);void 0!==c.tooltip&&(e=c.tooltip,e=g.g.nc(e),a.vb(e));void 0!==c.enableContextMenu&&(e=c.enableContextMenu,a.contextMenu=!!e);void 0!==
c.helpUrl&&(e=c.helpUrl,e=g.g.nc(e),a.Ec=e);"string"==typeof c.extensions&&(console.warn(d+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+c.type+"' block."),c.extensions=[c.extensions]);void 0!==c.mutator&&g.X.apply(c.mutator,a,!0);if(Array.isArray(c.extensions))for(c=c.extensions,d=0;d<c.length;++d)g.X.apply(c[d],a,!1)}
b.kj=function(a,c){if(void 0!==c&&"boolean"!=typeof c)throw Error("opt_disableCheck must be a boolean if provided");if(!c){c=[];for(var d in a)void 0!==this[d]&&c.push(d);if(c.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(c));}g.g.object.kj(this,a)};b.Bf=function(a,c){var d=null;if(a==g.Ua||a==g.Ra)d=this.Om(a);a=new g.Pv(a,c,this,d);this.P.push(a);return a};
function tc(a,c,d){if(c!=d){for(var e=-1,f=d?-1:a.P.length,h=0,k;k=a.P[h];h++)if(k.name==c){if(e=h,-1!=f)break}else if(d&&k.name==d&&(f=h,-1!=e))break;if(-1==e)throw Error('Named input "'+c+'" not found.');if(-1==f)throw Error('Reference input "'+d+'" not found.');a.Rt(e,f)}}
b.Rt=function(a,c){if(a==c)throw Error("Can't move input to itself.");if(a>=this.P.length)throw RangeError("Input index "+a+" out of bounds.");if(c>this.P.length)throw RangeError("Reference input "+c+" out of bounds.");var d=this.P[a];this.P.splice(a,1);a<c&&c--;this.P.splice(c,0,d)};b.Yb=function(a,c){for(var d=0,e;e=this.P[d];d++)if(e.name==a){e.I();this.P.splice(d,1);return}if(!c)throw Error("Input not found: "+a);};function E(a,c){for(var d=0,e;e=a.P[d];d++)if(e.name==c)return e;return null}
function uc(a,c){return(a=E(a,c))&&a.connection&&C(a.connection)}b.Wh=function(a){this.te.text!=a&&(g.i.Ka(new g.i.eg(this,"comment",null,this.te.text,a)),this.qk=this.te.text=a)};b.Wg=function(){};b.on=function(){};b.Oa=function(){return this.wA};b.moveBy=function(a,c){if(this.Qf)throw Error("Block has parent.");var d=new g.i.ll(this);this.wA.translate(a,c);d.tj();g.i.Ka(d)};b.Om=function(a){return new g.ra(this,a)};g.j={};g.j.Vk={};g.j.In=!1;g.j.register=function(a,c){if(g.j.Vk[a])throw Error("Renderer has already been registered.");g.j.Vk[a]=c};g.j.unregister=function(a){g.j.Vk[a]?delete g.j.Vk[a]:console.warn('No renderer mapping for name "'+a+'" found to unregister')};g.j.WL=function(){g.j.In=!0};g.j.XL=function(){g.j.In=!1};g.j.aa=function(a){function c(){c.w.constructor.call(this)}if(!g.j.Vk[a])throw Error("Renderer not registered: ",a);g.g.object.T(c,g.j.Vk[a]);a=new c;a.aa();return a};g.ki=function(){g.ki.w.constructor.call(this)};g.g.object.T(g.ki,g.Zn);g.ki.prototype.next=function(){var a=this.Ob;if(!a)return null;(a=a.next())&&w(this,a);return a};g.ki.prototype.Bm=function(){return null};g.ki.prototype.Rf=function(){var a=this.Ob;if(!a)return null;(a=a.Rf())&&w(this,a);return a};g.ki.prototype.Xm=function(){return null};g.j.NI=function(){};g.j.si=function(a){this.Cj=a;this.Zk=g.g.o.K("path",{"class":"blocklyPath"},this.Cj);this.zn=g.g.o.K("path",{"class":"blocklyPathLight"},this.Cj);this.xn=g.g.o.K("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Cj)};g.j.si.prototype.Hu=function(a){this.Zk.setAttribute("d",a);this.zn.style.display="none";this.xn.style.display="none"};g.j.si.prototype.Os=function(){this.Zk.setAttribute("transform","scale(-1 1)")};g.mi=function(){g.vc.call(this);this.Kg=-1};g.g.object.T(g.mi,g.vc);b=g.mi.prototype;b.Ga=function(){var a=document.createElement("div");a.id=this.ua();this.cb=a;a.className="goog-menu goog-menu-vertical blocklyNonSelectable";a.tabIndex=0;g.g.U.Xf(a,this.Bu||g.g.U.ti.ZB)};b.focus=function(){var a=this.ta();a&&(a.focus(),g.g.o.qb(a,"focused"))};b.blur=function(){var a=this.ta();a&&(a.blur(),g.g.o.fc(a,"focused"))};b.Xf=function(a){this.Bu=a};
b.bf=function(){g.mi.w.bf.call(this);ab(this,function(a){if(a.Wc){var c=a.ta();c=c.id||(c.id=a.ua());this.pk||(this.pk={});this.pk[c]=a}},this);this.Nr()};b.wh=function(){vc(this,-1);g.mi.w.wh.call(this)};b.im=function(){g.mi.w.im.call(this);this.qs()};b.Nr=function(){var a=this.ta();this.EF=g.ka(a,"mouseover",this,this.WE,!0);this.Tl=g.ka(a,"click",this,this.OE,!0);this.BF=g.ka(a,"mouseenter",this,this.TE,!0);this.CF=g.ka(a,"mouseleave",this,this.VE,!0);this.cu=g.ka(a,"keydown",this,this.ft)};
b.qs=function(){g.Xa(this.EF);g.Xa(this.Tl);g.Xa(this.BF);g.Xa(this.CF);g.Xa(this.cu)};b.pk=null;function wc(a,c){if(a.pk)for(var d=a.ta();c&&c!==d;){var e=c.id;if(e in a.pk)return a.pk[e];c=c.parentNode}return null}function xc(a){(a=a.fb[a.Kg]||null)&&a.Vg(!1)}function vc(a,c){var d=a.fb[c]||null;d?(d.Vg(!0),a.Kg=c):-1<a.Kg&&((a.fb[a.Kg]||null).Vg(!1),a.Kg=-1);d&&g.g.style.Cu(d.ta(),a.ta())}b.Vg=function(a){vc(this,this.fb.indexOf(a))};
function yc(a){xc(a);zc(a,function(c,d){return(c+1)%d},a.Kg)}function Ac(a){xc(a);zc(a,function(c,d){c--;return 0>c?d-1:c},a.Kg)}function zc(a,c,d){var e=a.fb.length;d=c.call(a,0>d?-1:d,e);for(var f=0;f<=e;){var h=a.fb[d]||null;if(h&&h.isEnabled()){vc(a,d);break}f++;d=c.call(a,d,e)}}b.WE=function(a){(a=wc(this,a.target))&&a.isEnabled()&&(this.fb[this.Kg]||null)!==a&&(xc(this),this.Vg(a))};b.OE=function(a){var c=wc(this,a.target),d;if(d=c)c.isEnabled()&&(c.Vg(!0),Bc(c)),d=void 0;d&&a.preventDefault()};
b.TE=function(){this.focus()};b.VE=function(){this.ta()&&(this.blur(),xc(this),vc(this,-1))};b.ft=function(a){return 0!=this.fb.length&&Cc(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1};function Cc(a,c){var d=a.fb[a.Kg]||null;if(d&&"function"==typeof d.ft&&d.ft(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case g.g.Ia.Fq:d&&Bc(d);break;case g.g.Ia.zo:Ac(a);break;case g.g.Ia.$n:yc(a);break;default:return!1}return!0};g.mo=function(a,c){g.vc.call(this);this.Ze=a;this.setValue(c);this.Xo=!0};g.g.object.T(g.mo,g.vc);b=g.mo.prototype;
b.Ga=function(){var a=document.createElement("div");a.id=this.ua();this.cb=a;a.className="goog-menuitem goog-option "+(this.Xo?"":"goog-menuitem-disabled ")+(this.$r?"goog-option-selected ":"")+(this.Nk()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.Sl){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(Dc(this));g.g.U.Xf(a,this.Bu||(this.Sl?g.g.U.ti.aC:
g.g.U.ti.$B));g.g.U.Eb(a,g.g.U.State.El,this.Sl&&this.$r||!1)};function Dc(a){a=a.Ze;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.kb=a};b.getValue=function(){return this.kb};b.Xf=function(a){this.Bu=a};function Ec(a,c){if(a.Sl){a.$r=c;var d=a.ta();d&&a.isEnabled()&&(c?(g.g.o.qb(d,"goog-option-selected"),g.g.U.Eb(d,g.g.U.State.El,!0)):(g.g.o.fc(d,"goog-option-selected"),g.g.U.Eb(d,g.g.U.State.El,!1)))}}
b.Vg=function(a){var c=this.ta();c&&this.isEnabled()&&(a?g.g.o.qb(c,"goog-menuitem-highlight"):g.g.o.fc(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.Xo};b.Kc=function(a){this.Xo=a;(a=this.ta())&&(this.Xo?g.g.o.fc(a,"goog-menuitem-disabled"):g.g.o.qb(a,"goog-menuitem-disabled"))};function Bc(a){a.Sl&&Ec(a,!a.$r);a.Cw&&a.Cw.call(a.VC,a)}function Fc(a,c,d){a.Cw=c;a.VC=d};g.g.jq={};g.g.jq.Hg=function(a){a=a.ta();var c=g.g.style.Hg(a);c.height=a.scrollHeight;return c};g.g.jq.WC=function(a,c,d){c.left+=d.width;c.right+=d.width;a.left+=d.width;a.right+=d.width};g.Ba={};g.Ba.Po=null;g.Ba.Kx=null;g.Ba.show=function(a,c,d){g.$.show(g.Ba,d,null);if(c.length){var e=g.Ba.oG(c,d);g.Ba.ed(e,a,d);setTimeout(function(){e.ta().focus()},1);g.Ba.Po=null}else g.Ba.ya()};g.Ba.oG=function(a,c){var d=new g.mi;bb(d,c);for(var e=0,f;f=a[e];e++){var h=new g.mo(f.text);bb(h,c);d.Ol(h,d.fb.length,!0);h.Kc(f.enabled);f.enabled&&Fc(h,function(){g.Ba.ya();this.tb()},f)}return d};
g.Ba.ed=function(a,c,d){var e=g.g.KE();c={top:c.clientY+e.top,bottom:c.clientY+e.top,left:c.clientX+e.left,right:c.clientX+e.left};g.Ba.ID(a);var f=g.g.jq.Hg(a);d&&g.g.jq.WC(e,c,f);g.$.pG(e,c,f,d);a.ta().focus()};g.Ba.ID=function(a){a.za(g.$.Ca);var c=a.ta();g.g.o.qb(c,"blocklyContextMenu");g.ka(c,"contextmenu",null,g.g.OF);a.focus()};g.Ba.ya=function(){g.$.ym(g.Ba);g.Ba.Po=null;g.Ba.Kx&&g.Xa(g.Ba.Kx)};
g.Ba.Eo=function(a,c){return function(){g.i.disable();try{var d=g.O.Oi(c,a.v),e=a.Oa();e.x=a.G?e.x-g.md:e.x+g.md;e.y+=2*g.md;d.moveBy(e.x,e.y)}finally{g.i.enable()}g.i.isEnabled()&&!d.$a&&g.i.Ka(new g.i.Rn(d));d.select()}};g.Ba.dD=function(a){var c=p(a,!1).length,d=t(a);d&&(c-=p(d,!1).length);return{text:1==c?g.h.DELETE_BLOCK:g.h.DELETE_X_BLOCKS.replace("%1",String(c)),enabled:!0,tb:function(){g.i.Z(!0);a.I(!0,!0);g.i.Z(!1)}}};
g.Ba.fD=function(a){return{enabled:!("function"==typeof a.Ec?!a.Ec():!a.Ec),text:g.h.HELP,tb:function(){var c="function"==typeof a.Ec?a.Ec():a.Ec;c&&window.open(c)}}};g.Ba.eD=function(a){var c=za(a.v)?ya(a.v,g.g.Ss(a,!0)):!0;return{text:g.h.DUPLICATE_BLOCK,enabled:c,tb:function(){g.Gx(a)}}};g.Ba.cD=function(a){var c={enabled:!g.g.userAgent.lg};a.qk?(c.text=g.h.REMOVE_COMMENT,c.tb=function(){a.Wh(null)}):(c.text=g.h.ADD_COMMENT,c.tb=function(){a.Wh("")});return c};
g.Ba.qL=function(a){return{text:g.h.uK,enabled:!0,tb:function(){g.i.Z(!0);a.I(!0,!0);g.i.Z(!1)}}};g.Ba.rL=function(a){return{text:g.h.aI,enabled:!0,tb:function(){g.Gx(a)}}};
g.Ba.aM=function(a,c){if(!g.jk)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!g.g.userAgent.lg};d.text=g.h.kH;d.tb=function(){var e=new g.jk(a,g.h.jL,g.jk.eB,g.jk.eB),f=aa(a).getBoundingClientRect();f=new g.g.S(c.clientX-f.left,c.clientY-f.top);var h=g.g.tm(a.bb);f=g.g.S.hm(f,h);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.ca&&(e.Ce(),e.za(),e.select())};return d};g.ng=function(a,c){g.ng.w.constructor.call(this,a,c);this.Gf=a.v.No[c];this.nx=a.v.No[g.dk[c]];this.oj=new g.g.S(0,0);this.Ch=!1;this.Iy=!this.Gf};g.g.object.T(g.ng,g.ra);b=g.ng.prototype;b.I=function(){g.ng.w.I.call(this);this.Ch&&Gc(this.Gf,this)};function Hc(a,c){var d=a.Sb-c.Sb;a=a.Ya-c.Ya;return Math.sqrt(d*d+a*a)}
function Za(a,c){if(!a.B.v.dc()){var d=G(a.B);if(!d.Wb){var e=!1;if(!d.Fc()){d=G(c.B);if(!d.Fc())return;c=a;e=!0}var f=g.selected==d;f||d.Ao();var h=c.Sb+g.md+Math.floor(Math.random()*g.yq)-a.Sb,k=c.Ya+g.md+Math.floor(Math.random()*g.yq)-a.Ya;e&&(k=-k);d.G&&(h=c.Sb-g.md-Math.floor(Math.random()*g.yq)-a.Sb);d.moveBy(h,k);f||d.gn()}}}b.moveTo=function(a,c){this.Ch&&Gc(this.Gf,this);this.Sb=a;this.Ya=c;this.Iy||Ic(this.Gf,this)};b.moveBy=function(a,c){this.moveTo(this.Sb+a,this.Ya+c)};
function Jc(a,c){a.moveTo(c.x+a.oj.x,c.y+a.oj.y)}function Kc(a,c,d){a.oj.x=c;a.oj.y=d}function Lc(a){var c=a.ga.Sb-a.Sb,d=a.ga.Ya-a.Ya;if(0!=c||0!=d){a=C(a);var e=a.wa();if(!e)throw Error("block is not rendered.");e=g.g.ze(e);a.wa().setAttribute("transform","translate("+(e.x-c)+","+(e.y-d)+")");Qb(a,-c,-d)}}
b.closest=function(a,c){var d=this.nx;if(d.ac.length){var e=this.Ya,f=this.Sb;this.Sb=f+c.x;this.Ya=e+c.y;var h=Mc(d,this);c=null;for(var k=a,l,m=h-1;0<=m&&Math.abs(d.ac[m].Ya-this.Ya)<=a;)l=d.ac[m],this.vp(l,k)&&(c=l,k=Hc(l,this)),m--;for(;h<d.ac.length&&Math.abs(d.ac[h].Ya-this.Ya)<=a;)l=d.ac[h],this.vp(l,k)&&(c=l,k=Hc(l,this)),h++;this.Sb=f;this.Ya=e;a={connection:c,Qp:k}}else a={connection:null,Qp:a};return a};
b.zm=function(){var a=this.B.v.Sg.C;a=this.type==g.Ua||this.type==g.Re?g.g.A.moveBy(0,-5)+g.g.A.ba("v",5)+a.ri.He+g.g.A.ba("v",5):g.g.A.moveBy(-5,0)+g.g.A.ba("h",5)+a.bk.Qh+g.g.A.ba("h",5);var c=this.B.Oa();g.ra.Jy=g.g.o.K("path",{"class":"blocklyHighlightedConnectionPath",d:a,transform:"translate("+(this.Sb-c.x)+","+(this.Ya-c.y)+")"+(this.B.G?" scale(-1 1)":"")},this.B.wa())};
function kc(a){lc(a,!1);var c=[];if(a.type!=g.Ua&&a.type!=g.Ra)return c;if(a=C(a)){if(a.isCollapsed()){var d=[];a.L&&d.push(a.L);a.V&&d.push(a.V);a.Y&&d.push(a.Y)}else d=a.xe(!0);for(var e=0;e<d.length;e++)c.push.apply(c,kc(d[e]));c.length||(c[0]=a)}return c}function lc(a,c){(a.Iy=c)&&a.Ch?Gc(a.Gf,a):c||a.Ch||Ic(a.Gf,a)}b.vp=function(a,c){return Hc(this,a)>c?!1:g.ng.w.vp.call(this,a)};b.Jp=function(a){Za(this,a)};b.ws=function(a,c){g.ng.w.ws.call(this,a,c);a.ca&&a.za();c.ca&&(Bb(c),c.za())};
b.yu=function(){var a=this.B,c=this.nf;if(a.v&&c&&g.i.Jc){g.ng.w.yu.call(this);c=C(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.Ce();c.za(!1);a.ca&&a.za()}};b.lz=function(a){return Nc(this.nx,this,a)};b.Xe=function(a){g.ng.w.Xe.call(this,a);var c=this.B;a=a.B;c.ca&&Bb(c);a.ca&&Bb(a);c.ca&&a.ca&&(this.type==g.Ra||this.type==g.Se?a.za():c.za())};b.sz=function(){this.isConnected()&&!Eb(this,this.ga)&&(D(H(this)?C(this):this.B),this.B.Hb())};g.va=function(a,c,d){this.H=g.g.o.K("g",{},null);this.H.Bn="";this.rj=a.Sg.cz(this.H);this.yn=this.rj.xn||null;this.Kd=this.rj.Zk||null;this.Bj=this.rj.zn||null;this.Kd.qf=this;this.ca=!1;this.Jn=g.g.$i()&&!!a.Td;g.J.mk(this.Kd);g.va.w.constructor.call(this,a,c,d);this.H.dataset&&(this.H.dataset.id=this.id);this.Sc=null};g.g.object.T(g.va,g.Qn);g.va.prototype.height=0;g.va.prototype.width=0;g.va.prototype.Md=null;g.va.LI=-1;g.va.zq="TEMP_COLLAPSED_WARNING_";g.va.sC=10;g.va.Vq=25;g.va.ih=8;
g.va.og=!1;b=g.va.prototype;b.Ce=function(){if(!this.v.ca)throw TypeError("Workspace is headless.");for(var a=0,c;c=this.P[a];a++)c.aa();c=Lb(this);for(a=0;a<c.length;a++)Ja(c[a]);this.Ne();Oc(this);this.v.options.readOnly||this.iE||g.ka(this.wa(),"mousedown",this,this.Oh);this.iE=!0;this.wa().parentNode||this.v.bb.appendChild(this.wa())};
b.select=function(){if(this.$a&&this.getParent())this.getParent().select();else if(g.selected!=this){var a=null;if(g.selected){a=g.selected.id;g.i.disable();try{Vb(g.selected)}finally{g.i.enable()}}a=new g.i.od(null,"selected",a,this.id);a.uc=this.v.id;g.i.Ka(a);g.selected=this;this.Ao()}};function Vb(a){if(g.selected==a){var c=new g.i.od(null,"selected",a.id,null);c.uc=a.v.id;g.i.Ka(c);g.selected=null;a.gn()}}b.Gd=null;b.qk=null;b.Df=null;b.Yc=null;
function Lb(a){var c=[];a.Gd&&c.push(a.Gd);a.Df&&c.push(a.Df);a.Yc&&c.push(a.Yc);return c}b.Xk=function(a){var c=this.Qf;if(a!=c){g.g.o.tn();g.va.w.Xk.call(this,a);g.g.o.un();var d=this.wa();if(!this.v.tt&&d){var e=this.Oa();a?(a.wa().appendChild(d),a=this.Oa(),Qb(this,a.x-e.x,a.y-e.y)):c&&(this.v.bb.appendChild(d),this.translate(e.x,e.y))}}};
b.Oa=function(){var a=0,c=0,d=this.Jn?this.v.Td.Ub():null,e=this.wa();if(e){do{var f=g.g.ze(e);a+=f.x;c+=f.y;this.Jn&&this.v.Td.$e.firstChild==e&&(f=this.v.Td.at(),a+=f.x,c+=f.y);e=e.parentNode}while(e&&e!=this.v.bb&&e!=d)}return new g.g.S(a,c)};b.moveBy=function(a,c){if(this.Qf)throw Error("Block has parent.");var d=g.i.isEnabled();if(d)var e=new g.i.ll(this);var f=this.Oa();this.translate(f.x+a,f.y+c);Qb(this,a,c);d&&(e.tj(),g.i.Ka(e));xb(this.v)};
b.translate=function(a,c){this.wa().setAttribute("transform","translate("+a+","+c+")")};b.St=function(){if(this.Jn){var a=this.Oa();this.wa().removeAttribute("transform");this.v.Td.Gj(a.x,a.y);Ub(this.v.Td,this.wa())}};b.moveTo=function(a){var c=this.Oa();this.moveBy(a.x-c.x,a.y-c.y)};b.Qt=function(a){this.Jn?this.v.Td.Gj(a.x,a.y):(this.H.Bn="translate("+a.x+","+a.y+")",this.H.setAttribute("transform",this.H.Bn+this.H.rn))};
function Pc(a){if(a.v&&!a.v.dc()&&!a.getParent()&&!a.Wb){var c=a.v.Be;if(c&&c.IG){var d=c.Pu,e=d/2,f=a.Oa();c=Math.round((f.x-e)/d)*d+e-f.x;d=Math.round((f.y-e)/d)*d+e-f.y;c=Math.round(c);d=Math.round(d);0==c&&0==d||a.moveBy(c,d)}}}function Qc(a){var c=a.Oa(),d=a.L?g.va.ih:0,e=J(a),f=c.y,h=c.y+e.height;a.G?(a=c.x-(e.width-d),c=c.x+d):(a=c.x-d,c=c.x+e.width-d);return new g.g.Rect(f,h,a,c)}b.Pm=function(){for(var a=0,c;c=this.P[a];a++)c.Pm()};
b.Ug=function(a){if(this.xg!=a){for(var c=[],d=0,e;e=this.P[d];d++)c.push.apply(c,e.Qb(!a));if(a){e=Lb(this);for(d=0;d<e.length;d++)e[d].Qb(!1);d=this.toString(g.SA);K(N(this,"_TEMP_COLLAPSED_INPUT"),d).aa();e=p(this,!0);if(d=t(this))d=e.indexOf(d),e.splice(d,e.length-d);d=1;for(var f;f=e[d];d++)if(f.Yc){this.Wg(g.h.COLLAPSED_WARNINGS_WARNING,g.va.zq);break}}else this.Yb("_TEMP_COLLAPSED_INPUT"),this.Yc&&(this.Yc.Yk("",g.va.zq),Object.keys(this.Yc.ag).length||this.Wg(null));g.va.w.Ug.call(this,a);
c.length||(c[0]=this);if(this.ca)for(d=0;f=c[d];d++)f.za()}};function Rc(a,c,d){for(var e=[],f=0,h;h=a.P[f];f++){for(var k=0,l;l=h.Na[k];k++)l.Ty()&&l.isVisible()&&e.push(l);h.connection&&(h=C(h.connection))&&e.push(h)}c=e.indexOf(c);-1==c&&(c=d?-1:e.length);(e=e[d?c+1:c-1])?e instanceof g.Ha?e.Le():Rc(e,null,d):(e=a.getParent())&&Rc(e,a,d)}
b.Oh=function(a){var c=this.v&&this.v.Gg(a);if(c){if(c.Ti)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");cc(c,this);c.kf=a}};
function Sc(a){if(a.v.options.readOnly||!a.contextMenu)return null;var c=[];if(!a.Wb){a.Zd()&&a.Fc()&&c.push(g.Ba.eD(a));a.v.options.Vl&&!a.xg&&a.cd()&&c.push(g.Ba.cD(a));if(a.Fc())if(a.xg)a.v.options.collapse&&(d={enabled:!0},d.text=g.h.EXPAND_BLOCK,d.tb=function(){a.Ug(!1)},c.push(d));else{for(var d=1;d<a.P.length;d++)if(a.P[d-1].type!=g.Ra&&a.P[d].type!=g.Ra){d={enabled:!0};var e=Fb(a);d.text=e?g.h.EXTERNAL_INPUTS:g.h.INLINE_INPUTS;d.tb=function(){a.Je(!e)};c.push(d);break}a.v.options.collapse&&
(d={enabled:!0},d.text=g.h.COLLAPSE_BLOCK,d.tb=function(){a.Ug(!0)},c.push(d))}a.v.options.disable&&a.cd()&&(d={text:a.isEnabled()?g.h.DISABLE_BLOCK:g.h.ENABLE_BLOCK,enabled:!rc(a),tb:function(){var f=g.i.Ub();f||g.i.Z(!0);a.Kc(!a.isEnabled());f||g.i.Z(!1)}},c.push(d));a.Zd()&&c.push(g.Ba.dD(a))}c.push(g.Ba.fD(a));a.Ag&&a.Ag(c);return c}b.pn=function(a){var c=Sc(this);c&&c.length&&(g.Ba.show(a,c,this.G),g.Ba.Po=this)};
function Qb(a,c,d){if(a.ca){for(var e=a.xe(!1),f=0;f<e.length;f++)e[f].moveBy(c,d);e=Lb(a);for(f=0;f<e.length;f++)Ka(e[f]);for(f=0;f<a.wg.length;f++)Qb(a.wg[f],c,d)}}b.vj=function(a){if(a){var c=this.wa();c.Bn="";c.rn="";g.jm=g.jm.concat(this.xe(!0));g.g.o.qb(this.H,"blocklyDragging")}else g.jm=[],g.g.o.fc(this.H,"blocklyDragging");for(c=0;c<this.wg.length;c++)this.wg[c].vj(a)};function Oc(a){a.Fc()?g.g.o.qb(a.H,"blocklyDraggable"):g.g.o.fc(a.H,"blocklyDraggable")}
b.$p=function(a){g.va.w.$p.call(this,a);Oc(this)};b.Fu=function(a){g.va.w.Fu.call(this,a);a=Lb(this);for(var c=0;c<a.length;c++)a[c].Yg()};b.Ju=function(a){g.va.w.Ju.call(this,a);this.Ne()};b.Xz=function(a){this.Im!=a&&(this.Im=a)&&(this.mf(g.DB),g.g.o.qb(this.H,"blocklyInsertionMarker"))};b.wa=function(){return this.H};
b.I=function(a,c){if(this.v){g.J.ya();g.g.o.tn();var d=this.v;if(g.selected==this){Vb(this);var e=this.v;e.Bc&&e.Bc.cancel()}g.Ba.Po==this&&g.Ba.ya();g.De&&g.navigation.kz(this);c&&this.ca&&(D(this,a),g.hb.$D(this));this.ca=!1;if(this.Md){for(var f in this.Md)clearTimeout(this.Md[f]);this.Md=null}c=Lb(this);for(e=0;e<c.length;e++)c[e].I();g.va.w.I.call(this,a);g.g.o.removeNode(this.H);xb(d);this.yn=this.Bj=this.Kd=this.H=null;g.g.o.un()}};
b.Ne=function(){if(this.isEnabled()){if(this.$a){var a=oc(this);this.Bj.style.display="none";this.yn.setAttribute("fill",a);this.Kd.setAttribute("stroke","none");this.Kd.setAttribute("fill",a)}else a=pc(this),a.Ko?(this.Bj.style.display="none",this.yn.style.display="none",this.Kd.setAttribute("stroke",a.Ko)):(this.Bj.style.display="",this.yn.style.display="",this.Kd.setAttribute("stroke","none"),this.Bj.setAttribute("stroke",a.fs),this.yn.setAttribute("fill",a.Tw)),this.Kd.setAttribute("fill",this.oh);
a=Lb(this);for(var c=0;c<a.length;c++)a[c].Ne();for(a=0;c=this.P[a];a++)for(var d=0,e;e=c.Na[d];d++)e.Ne()}};function Bb(a){!a.isEnabled()||rc(a)?g.g.o.qb(a.H,"blocklyDisabled")&&a.Kd.setAttribute("fill","url(#"+a.v.options.Cg+")"):g.g.o.fc(a.H,"blocklyDisabled")&&a.Ne();a=a.xh(!1);for(var c=0,d;d=a[c];c++)Bb(d)}b.yE=function(){return this.Df};
b.Wh=function(a){if(!g.Comment)throw Error("Missing require for Blockly.Comment");this.te.text!=a&&(g.va.w.Wh.call(this,a),a=null!=a,!!this.Df==a?Oa(this.Df):(a?this.qk=this.Df=new g.Comment(this):(this.Df.I(),this.qk=this.Df=null),this.ca&&(this.za(),this.Hb())))};
b.Wg=function(a,c){this.Md||(this.Md=Object.create(null));var d=c||"";if(d)this.Md[d]&&(clearTimeout(this.Md[d]),delete this.Md[d]);else for(var e in this.Md)clearTimeout(this.Md[e]),delete this.Md[e];if(this.v.dc()){var f=this;this.Md[d]=setTimeout(function(){f.v&&(delete f.Md[d],f.Wg(a,d))},100)}else{this.Wb&&(a=null);c=nc(this);for(e=null;c;)c.isCollapsed()&&(e=c),c=nc(c);e&&e.Wg(g.h.COLLAPSED_WARNINGS_WARNING,g.va.zq);c=!1;"string"==typeof a?(this.Yc||(this.Yc=new g.Af(this),c=!0),this.Yc.Yk(a,
d)):this.Yc&&!d?(this.Yc.I(),c=!0):this.Yc&&(c=this.Yc.cc(),this.Yc.Yk("",d),(e=this.Yc.cc())||this.Yc.I(),c=c!=e);c&&this.ca&&(this.za(),this.Hb())}};b.on=function(a){this.Gd&&this.Gd!==a&&this.Gd.I();a&&(a.R=this,this.Gd=a,Ja(a))};b.Eu=function(a){console.warn("Deprecated call to Blockly.BlockSvg.prototype.setDisabled, use Blockly.BlockSvg.prototype.setEnabled instead.");this.Kc(!a)};b.Kc=function(a){this.isEnabled()!=a&&(g.va.w.Kc.call(this,a),this.ca&&Bb(this))};
b.Vg=function(a){this.ca&&(a?(this.Kd.setAttribute("filter","url(#"+this.v.options.Ix+")"),this.Bj.style.display="none"):(this.Kd.setAttribute("filter","none"),this.Bj.style.display="inline"))};b.Ao=function(){g.g.o.qb(this.H,"blocklySelected")};b.gn=function(){g.g.o.fc(this.H,"blocklySelected")};function Ob(a,c){c?g.g.o.qb(a.H,"blocklyDraggingDelete"):g.g.o.fc(a.H,"blocklyDraggingDelete")}b.mf=function(a){g.va.w.mf.call(this,a);this.ca&&this.Ne()};
function $a(a){do{var c=a.wa();c.parentNode.appendChild(c);a=a.getParent()}while(a)}b.Wf=function(a,c){g.va.w.Wf.call(this,a,c);this.ca&&(this.za(),this.Hb())};b.Vf=function(a,c){g.va.w.Vf.call(this,a,c);this.ca&&(this.za(),this.Hb())};b.Ke=function(a,c){g.va.w.Ke.call(this,a,c);this.ca&&(this.za(),this.Hb())};b.Je=function(a){g.va.w.Je.call(this,a);this.ca&&(this.za(),this.Hb())};b.Yb=function(a,c){g.va.w.Yb.call(this,a,c);this.ca&&(this.za(),this.Hb())};
b.Rt=function(a,c){g.va.w.Rt.call(this,a,c);this.ca&&(this.za(),this.Hb())};b.Bf=function(a,c){a=g.va.w.Bf.call(this,a,c);this.ca&&(this.za(),this.Hb());return a};function Wa(a,c){if(!c&&a.isCollapsed()){if(a.L&&lc(a.L,c),a.Y&&lc(a.Y,c),a.V){lc(a.V,c);var d=C(a.V);d&&Wa(d,c)}}else{a=a.xe(!0);for(var e=0;d=a[e];e++)lc(d,c),H(d)&&(d=C(d))&&Wa(d,c)}}
b.xe=function(a){var c=[];if(a||this.ca)if(this.L&&c.push(this.L),this.Y&&c.push(this.Y),this.V&&c.push(this.V),a||!this.xg){a=0;for(var d;d=this.P[a];a++)d.connection&&c.push(d.connection)}return c};b.Om=function(a){return new g.ng(this,a)};b.Hb=function(){if(this.v&&!this.v.dc()){var a=G(this);if(!a.Wb)for(var c=this.xe(!1),d=0,e;e=c[d];d++){e.isConnected()&&H(e)&&C(e).Hb();for(var f=e.lz(g.md),h=0,k;k=f[h];h++)e.isConnected()&&k.isConnected()||G(k.B)!=a&&(H(e)?Za(k,e):Za(e,k))}}};
function Rb(a){var c=g.i.Ub();setTimeout(function(){g.i.Z(c);Pc(a);g.i.Z(!1)},g.Pn/2);setTimeout(function(){g.i.Z(c);a.Hb();g.i.Z(!1)},g.Pn)}b.za=function(a){g.g.o.tn();this.ca=!0;this.v.Sg.za(this);var c=this.Oa();this.Y&&Jc(this.Y,c);this.L&&Jc(this.L,c);for(var d=0;d<this.P.length;d++){var e=this.P[d].connection;e&&(Jc(e,c),e.isConnected()&&Lc(e))}this.V&&(Jc(this.V,c),this.V.isConnected()&&Lc(this.V));!1!==a&&((a=this.getParent())?a.za(!0):xb(this.v));g.g.o.un()};
b.mn=function(a){a?(this.H.appendChild(a),this.Sc=a):this.Sc=null};b.nn=function(a){a&&(this.Sc?this.H.insertBefore(a,this.Sc):this.H.appendChild(a))};function J(a){var c=a.height,d=a.width;if(a=t(a))a=J(a),c+=a.height-4,d=Math.max(d,a.width);return{height:c,width:d}}function Kb(a,c){c?g.g.o.qb(a.H,"blocklyReplaceable"):g.g.o.fc(a.H,"blocklyReplaceable")};g.Sj=function(){this.ac=[]};function Ic(a,c){if(c.Ch)throw Error("Connection already in database.");c.B.Wb||(a.ac.splice(Mc(a,c),0,c),c.Ch=!0)}function Tc(a,c){if(!a.ac.length)return-1;var d=Mc(a,c);if(d>=a.ac.length)return-1;for(var e=c.Ya,f=d;0<=f&&a.ac[f].Ya==e;){if(a.ac[f]==c)return f;f--}for(;d<a.ac.length&&a.ac[d].Ya==e;){if(a.ac[d]==c)return d;d++}return-1}
function Mc(a,c){if(!a.ac.length)return 0;for(var d=0,e=a.ac.length;d<e;){var f=Math.floor((d+e)/2);if(a.ac[f].Ya<c.Ya)d=f+1;else if(a.ac[f].Ya>c.Ya)e=f;else{d=f;break}}return d}function Gc(a,c){if(!c.Ch)throw Error("Connection not in database.");var d=Tc(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.Ch=!1;a.ac.splice(d,1)}
function Nc(a,c,d){function e(n){var q=h-f[n].Sb,r=k-f[n].Ya;Math.sqrt(q*q+r*r)<=d&&m.push(f[n]);return r<d}var f=a.ac,h=c.Sb,k=c.Ya;a=0;for(var l=c=f.length-2;a<l;)f[l].Ya<k?a=l:c=l,l=Math.floor((a+c)/2);var m=[];c=a=l;if(f.length){for(;0<=a&&e(a);)a--;do c++;while(c<f.length&&e(c))}return m}g.Sj.aa=function(){var a=[];a[g.Ua]=new g.Sj;a[g.Re]=new g.Sj;a[g.Ra]=new g.Sj;a[g.Se]=new g.Sj;return a};g.li=function(a,c){this.Ek=a;this.Pu=c.spacing;this.Zy=c.length;this.sF=(this.Et=a.firstChild)&&this.Et.nextSibling;this.IG=c.snap};g.li.prototype.Vh=1;g.li.prototype.I=function(){this.Ek=null};g.li.prototype.update=function(a){this.Vh=a;var c=this.Pu*a||100;this.Ek.setAttribute("width",c);this.Ek.setAttribute("height",c);c=Math.floor(this.Pu/2)+.5;var d=c-this.Zy/2,e=c+this.Zy/2;c*=a;d*=a;e*=a;Uc(this.Et,a,d,e,c,c);Uc(this.sF,a,c,c,d,e)};
function Uc(a,c,d,e,f,h){a&&(a.setAttribute("stroke-width",c),a.setAttribute("x1",d),a.setAttribute("y1",f),a.setAttribute("x2",e),a.setAttribute("y2",h))}g.li.prototype.moveTo=function(a,c){this.Ek.setAttribute("x",a);this.Ek.setAttribute("y",c);(g.g.userAgent.lg||g.g.userAgent.ao)&&this.update(this.Vh)};
g.li.Ga=function(a,c,d){a=g.g.o.K("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},d);0<c.length&&0<c.spacing?(g.g.o.K("line",{stroke:c.colour},a),1<c.length&&g.g.o.K("line",{stroke:c.colour},a)):g.g.o.K("line",{},a);return a};g.Rd=function(a){var c=!!a.readOnly;if(c)var d=null,e=!1,f=!1,h=!1,k=!1,l=!1,m=!1;else{d=g.Rd.Cz(a.toolbox||null);e=!(!d||!d.getElementsByTagName("category").length);f=a.trashcan;void 0===f&&(f=e);var n=a.maxTrashcanContents;f?void 0===n&&(n=32):n=0;h=a.collapse;void 0===h&&(h=e);k=a.comments;void 0===k&&(k=e);l=a.disable;void 0===l&&(l=e);m=a.sounds;void 0===m&&(m=!0)}var q=!!a.rtl,r=a.horizontalLayout;void 0===r&&(r=!1);var u=a.toolboxPosition;u="end"===u?!1:!0;u=r?u?g.qg:g.xi:u==q?g.pg:g.zd;var F=
a.css;void 0===F&&(F=!0);var X="https://blockly-demo.appspot.com/static/media/";a.media?X=a.media:a.path&&(X=a.path+"media/");var ea=void 0===a.oneBasedIndex?!0:!!a.oneBasedIndex,Ea=a.theme,Ge=a.keyMap||g.mb.ib.ED(),He=a.renderer||"geras";this.G=q;this.Ge=ea;this.collapse=h;this.Vl=k;this.disable=l;this.readOnly=c;this.Mt=a.maxBlocks||Infinity;this.Nt=a.maxInstances;this.lf=X;this.Ay=e;this.Hc=g.Rd.mG(a,e);this.Ey=f;this.Gp=n;this.aF=m;this.ZE=F;this.Ed=r;this.Of=d;this.wy=g.Rd.lG(a);this.wb=g.Rd.nG(a);
this.Da=u;this.TG=Ea;this.ib=Ge;this.Rg=He};g.Rd.prototype.Kb=null;g.Rd.prototype.Xh=null;g.Rd.prototype.bc=null;g.Rd.mG=function(a,c){var d=a.move||{},e={};e.scrollbars=void 0===d.scrollbars&&void 0===a.scrollbars?c:!!d.scrollbars||!!a.scrollbars;e.Lj=e.scrollbars&&void 0!==d.wheel?!!d.wheel:!1;e.vh=e.scrollbars?void 0===d.drag?!0:!!d.drag:!1;return e};
g.Rd.nG=function(a){a=a.zoom||{};var c={};c.controls=void 0===a.controls?!1:!!a.controls;c.Lj=void 0===a.wheel?!1:!!a.wheel;c.eA=void 0===a.startScale?1:Number(a.startScale);c.Qm=void 0===a.maxScale?3:Number(a.maxScale);c.Sm=void 0===a.minScale?.3:Number(a.minScale);c.zG=void 0===a.scaleSpeed?1.2:Number(a.scaleSpeed);return c};g.Rd.lG=function(a){a=a.grid||{};var c={};c.spacing=Number(a.spacing)||0;c.Ib=a.colour||"#888";c.length=Number(a.length)||1;c.VL=0<c.spacing&&!!a.snap;return c};
g.Rd.Cz=function(a){if(a){if("string"!=typeof a&&(g.g.userAgent.lg&&a.outerHTML?a=a.outerHTML:a instanceof Element||(a=null)),"string"==typeof a&&(a=g.O.$h(a),"xml"!=a.nodeName.toLowerCase()))throw TypeError("Toolbox should be an <xml> document.");}else a=null;return a};g.Sd=function(a,c){g.Sd.w.constructor.call(this,a,c);this.zp=!1;this.se={};this.cA=this.an=0;this.du=null};g.g.object.T(g.Sd,g.Uj);g.Sd.SC=5;g.Sd.TC=6;b=g.Sd.prototype;b.zs=function(a){g.Sd.w.zs.call(this,a);!this.xp&&g.Touch.Cp(a)&&Vc(this,a)};b.mk=function(a){this.du=g.ka(document,"mousedown",null,this.YE.bind(this),!0);this.Kp=g.ka(document,"mousemove",null,this.wm.bind(this),!0);this.Lp=g.ka(document,"mouseup",null,this.mp.bind(this),!0);a.preventDefault();a.stopPropagation()};
b.YE=function(a){!this.dc()&&g.Touch.Cp(a)&&(Vc(this,a),this.zp&&g.Kh())};b.wm=function(a){if(this.dc())g.Touch.Mu(a)&&g.Sd.w.wm.call(this,a);else if(this.zp){if(g.Touch.Cp(a)){this.se[g.Touch.lp(a)]=Wc(this,a);var c=Object.keys(this.se);if(2==c.length){c=g.g.S.Bx(this.se[c[0]],this.se[c[1]])/this.cA;if(0<this.an&&Infinity>this.an){var d=c-this.an;d=0<d?d*g.Sd.SC:d*g.Sd.TC;var e=this.qc,f=g.g.Um(a,v(e),pa(e));e.zoom(f.x,f.y,d)}this.an=c;a.preventDefault()}}g.Kh()}else g.Sd.w.wm.call(this,a)};
b.mp=function(a){if(g.Touch.Cp(a)&&!this.dc()){var c=g.Touch.lp(a);this.se[c]&&delete this.se[c];2>Object.keys(this.se).length&&(this.se={},this.an=0)}!this.zp||this.dc()?g.Touch.Mu(a)&&g.Sd.w.mp.call(this,a):(a.preventDefault(),a.stopPropagation(),this.I())};b.I=function(){g.Sd.w.I.call(this);this.du&&g.Xa(this.du)};function Vc(a,c){a.se[g.Touch.lp(c)]=Wc(a,c);var d=Object.keys(a.se);2==d.length&&(a.cA=g.g.S.Bx(a.se[d[0]],a.se[d[1]]),a.zp=!0,c.preventDefault())}
function Wc(a,c){return a.qc?new g.g.S(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};g.xw=function(a){this.ju=a;this.Fl=Object.create(null)};b=g.xw.prototype;b.At=null;b.I=function(){this.Fl=this.ju=null};b.load=function(a,c){if(a.length){try{var d=new g.g.global.Audio}catch(l){return}for(var e,f=0;f<a.length;f++){var h=a[f],k=h.match(/\.(\w+)$/);if(k&&d.canPlayType("audio/"+k[1])){e=new g.g.global.Audio(h);break}}e&&e.play&&(this.Fl[c]=e)}};
b.preload=function(){for(var a in this.Fl){var c=this.Fl[a];c.volume=.01;var d=c.play();void 0!==d?d.then(c.pause).catch(function(){}):c.pause();if(g.g.userAgent.Wj||g.g.userAgent.Nv)break}};b.play=function(a,c){var d=this.Fl[a];d?(a=new Date,null!=this.At&&a-this.At<g.wC||(this.At=a,d=g.g.userAgent.Wj||g.g.userAgent.jl?d:d.cloneNode(),d.volume=void 0===c?1:c,d.play())):this.ju&&this.ju.kh.play(a,c)};g.yw=function(a){this.Yl=a;this.Ga()};b=g.yw.prototype;b.Sa=null;b.$e=null;b.Yl=null;b.Ga=function(){this.Sa||(this.Sa=g.g.o.K("svg",{xmlns:g.g.o.Hl,"xmlns:html":g.g.o.Vj,"xmlns:xlink":g.g.o.Ue,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.Yl.appendChild(this.Sa))};b.Gj=function(a,c){a=a.toFixed(0);c=c.toFixed(0);this.Sa.style.display="block";g.g.o.ln(this.Sa,"translate3d("+a+"px, "+c+"px, 0px)")};b.at=function(){return g.g.ze(this.Sa)};
b.Ho=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var c=this.Sa.childNodes[0],d=this.Sa.childNodes[1];if(!(c&&d&&g.g.o.By(c,"blocklyBlockCanvas")&&g.g.o.By(d,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!=this.Tk?g.g.o.Zi(c,this.Tk):a.insertBefore(c,a.firstChild);g.g.o.Zi(d,c);this.Sa.style.display="none";if(this.Sa.childNodes.length)throw Error("Drag surface was not cleared.");g.g.o.ln(this.Sa,
"");this.Tk=null};
g.gb=function(a,c,d){g.gb.w.constructor.call(this,a);this.bc=a.bc||g.gb.JE;this.Xh=a.Xh||g.gb.FG;this.No=g.Sj.aa();c&&(this.Td=c);d&&(this.Mj=d);this.mq=this.Mj&&g.g.$i();this.Am=[];this.kh=new g.xw(a.Kb);this.Be=this.options.xy?new g.li(a.xy,a.wy):null;this.Sc=null;g.N&&g.N.Qi&&Xc(this,g.sw,g.N.Qi);g.ww&&g.ww.Qi&&Xc(this,g.KC,g.ww.Qi);g.Ea&&g.Ea.Qi&&Xc(this,g.bw,g.Ea.Qi);this.Sg=g.j.aa(this.options.Rg||"geras")};g.g.object.T(g.gb,g.Fb);b=g.gb.prototype;b.Wp=null;b.ca=!0;b.Ih=!0;b.$d=!1;b.ej=!1;
b.xu=!0;b.scrollX=0;b.scrollY=0;b.Fx=null;b.scale=1;b.Xc=null;b.Pb=null;b.M=null;b.oa=null;b.Bc=null;b.Td=null;b.Mj=null;b.mq=!1;b.wp=!1;b.rt=null;b.Yy=null;b.Ps={};b.Xu={};b.Xw=null;b.Dj=null;b.Py=null;b.st=!0;b.Du=function(a){this.Va&&this.Va.Cc&&this.Va.Cc.I();if(this.Va=a)this.Va.Cc=new g.xa(this,!1),this.mn(this.Va.Cc.Ga())};b.Yz=function(a){this.Xb&&this.Xb.Cc&&this.Xb.Cc.I();if(this.Xb=a)this.Xb.Cc=new g.xa(this,!0),this.nn(this.Xb.Cc.Ga())};
b.mn=function(a){a?this.bb&&(this.bb.appendChild(a),this.Sc=a):this.Sc=null};b.nn=function(a){a&&this.bb&&(this.Sc?this.bb.insertBefore(a,this.Sc):this.bb.appendChild(a))};function pa(a){if(a.st){var c=v(a).getScreenCTM();c&&(a.Py=c.inverse(),a.st=!1)}return a.Py}b.Fn=function(){this.st=!0};b.isVisible=function(){return this.Ih};
function Gb(a,c){var d=0,e=0,f=1;if(g.g.o.containsNode(a.bb,c)||g.g.o.containsNode(a.pf,c))f=a.scale;do{var h=g.g.ze(c);if(c==a.bb||c==a.pf)f=1;d+=h.x*f;e+=h.y*f;c=c.parentNode}while(c&&c!=v(a));return new g.g.S(d,e)}function aa(a){if(!a.rt)for(var c=a.H;c;){if(-1!=(" "+(c.getAttribute("class")||"")+" ").indexOf(" injectionDiv ")){a.rt=c;break}c=c.parentNode}return a.rt}
b.Ga=function(a){this.H=g.g.o.K("g",{"class":"blocklyWorkspace"},null);a&&(this.Mc=g.g.o.K("rect",{height:"100%",width:"100%","class":a},this.H),"blocklyMainBackground"==a&&this.Be?this.Mc.style.fill="url(#"+this.Be.Ek.id+")":this.Rb.subscribe(this.Mc,"workspace","fill"));this.bb=g.g.o.K("g",{"class":"blocklyBlockCanvas"},this.H);this.pf=g.g.o.K("g",{"class":"blocklyBubbleCanvas"},this.H);this.$d||(g.ka(this.H,"mousedown",this,this.Oh,!1,!0),g.ka(this.H,"wheel",this,this.kG));if(this.options.Ay){if(!g.zi)throw Error("Missing require for Blockly.Toolbox");
this.oa=new g.zi(this)}this.Be&&this.Be.update(this.scale);Yc(this);this.Va.Cc=new g.xa(this,!1);a=this.Va.Cc.Ga();this.H.appendChild(a);this.Xb.Cc=new g.xa(this,!0);a=this.Xb.Cc.Ga();this.H.appendChild(a);return this.H};
b.I=function(){this.ca=!1;this.Bc&&this.Bc.cancel();this.H&&(g.g.o.removeNode(this.H),this.H=null);this.pf=this.bb=null;this.oa&&(this.oa.I(),this.oa=null);this.M&&(this.M.I(),this.M=null);this.Xc&&(this.Xc.I(),this.Xc=null);this.Pb&&(this.Pb.I(),this.Pb=null);this.Nj&&(this.Nj.I(),this.Nj=null);this.Xb&&this.Xb.Cc.I();this.Va&&this.Va.Cc.I();this.kh&&(this.kh.I(),this.kh=null);this.Be&&(this.Be.I(),this.Be=null);this.Rb&&this.Rb.unsubscribe(this.Mc);g.gb.w.I.call(this);this.Ps=this.Xu=this.No=null;
if(!this.options.Kb){var a=v(this).parentNode;a&&g.g.o.removeNode(a)}this.Wp&&(g.Xa(this.Wp),this.Wp=null)};b.Lh=function(a,c){return new g.va(this,a,c)};function Zc(a){if(!g.Ar)throw Error("Missing require for Blockly.Trashcan");a.Xc=new g.Ar(a);var c=a.Xc.Ga();a.H.insertBefore(c,a.bb)}function $c(a){if(!g.Fr)throw Error("Missing require for Blockly.ZoomControls");a.Nj=new g.Fr(a);var c=a.Nj.Ga();a.H.appendChild(c)}
function ad(a,c){var d={Cg:a.options.Cg,Kb:a,G:a.G,Ge:a.options.Ge,Ed:a.Ed,Da:a.options.Da,Rg:a.options.Rg};if(a.Ed){if(!g.vl)throw Error("Missing require for Blockly.HorizontalFlyout");a.M=new g.vl(d)}else{if(!g.sg)throw Error("Missing require for Blockly.VerticalFlyout");a.M=new g.sg(d)}a.M.lk=!1;return a.M.Ga(c)}function Ua(a){return a.M?a.M:a.oa?a.oa.M:null}function xb(a){if(a.xu&&a.ca){if(a.Pb){var c=a.bc();la(a.Pb.Xd,c);na(a.Pb.ge,c)}a.Fn()}}
b.resize=function(){this.oa&&this.oa.position();this.M&&this.M.position();this.Xc&&this.Xc.position();this.Nj&&this.Nj.position();this.Pb&&this.Pb.resize();this.Fn();Yc(this)};function Yb(a){var c=g.g.DE();g.g.S.ve(a.Yy,c)||(a.Yy=c,a.Fn(),Yc(a))}function v(a){if(a.Iw)return a.Iw;for(var c=a.H;c;){if("svg"==c.tagName)return a.Iw=c;c=c.parentNode}return null}
b.translate=function(a,c){if(this.mq&&this.wp)this.Mj.Gj(a,c);else{var d="translate("+a+","+c+") scale("+this.scale+")";this.bb.setAttribute("transform",d);this.pf.setAttribute("transform",d)}if(this.Td){d=this.Td;var e=this.scale;d.Vh=e;d.$e.setAttribute("transform","translate("+a.toFixed(0)+","+c.toFixed(0)+") scale("+e+")")}this.Be&&this.Be.moveTo(a,c)};
function ra(a){if(a.mq){a.wp=!1;var c=a.Mj.at();a.Mj.Ho(a.H);c="translate("+c.x+","+c.y+") scale("+a.scale+")";a.bb.setAttribute("transform",c);a.pf.setAttribute("transform",c)}}
function qa(a){if(a.mq&&!a.wp){a.wp=!0;var c=a.bb.previousSibling,d=parseInt(v(a).getAttribute("width"),10),e=parseInt(v(a).getAttribute("height"),10),f=g.g.ze(a.bb),h=a.Mj,k=a.bb,l=a.pf,m=a.scale;if(h.Sa.childNodes.length)throw Error("Already dragging a block.");h.Tk=c;k.setAttribute("transform","translate(0, 0) scale("+m+")");l.setAttribute("transform","translate(0, 0) scale("+m+")");h.Sa.setAttribute("width",d);h.Sa.setAttribute("height",e);h.Sa.appendChild(k);h.Sa.appendChild(l);h.Sa.style.display=
"block";a.Mj.Gj(f.x,f.y)}}b.Mf=function(){var a=this.bc();return a?a.lb/this.scale:0};b.Qb=function(a){this.Pb&&this.Pb.uj(a);Ua(this)&&Ua(this).uj(a);v(this).style.display=a?"block":"none";this.oa&&(this.oa.wc.style.display=a?"block":"none");if(a){for(var c=y(this,!1),d=c.length-1;0<=d;d--)c[d].Pm();this.za();this.oa&&this.oa.position()}else g.mc(!0);this.Ih=a};b.za=function(){for(var a=y(this,!1),c=a.length-1;0<=c;c--)a[c].za(!1);if(this.Bc)for(a=this.Bc.Bk(),c=0;c<a.length;c++)a[c].za(!1)};
function bd(a,c){var d=I;if(void 0===c){for(var e=0,f;f=d.Am[e];e++)f.Vg(!1);d.Am.length=0}if(f=a?x(d,a):null)(a=void 0===c||c)?-1==d.Am.indexOf(f)&&d.Am.push(f):g.g.Co(d.Am,f),f.Vg(a)}
function cd(a){var c=g.Ul;if(a.ca&&!(c.getElementsByTagName("block").length>=xa(a)))if(a.Bc&&a.Bc.cancel(),"comment"==c.tagName.toLowerCase()){g.i.disable();try{var d=g.jk.pm(c),e=parseInt(c.getAttribute("x"),10),f=parseInt(c.getAttribute("y"),10);isNaN(e)||isNaN(f)||(a.G&&(e=-e),d.moveBy(e+50,f+50))}finally{g.i.enable()}d.select()}else a:{g.i.disable();try{var h=g.O.Oi(c,a),k=a.Xb.Ob;if(g.De&&k){g.navigation.Ny(h,k.qa);break a}var l=parseInt(c.getAttribute("x"),10),m=parseInt(c.getAttribute("y"),
10);if(!isNaN(l)&&!isNaN(m)){a.G&&(l=-l);do{c=!1;var n=y(a,!1);d=0;for(var q;q=n[d];d++){var r=q.Oa();if(1>=Math.abs(l-r.x)&&1>=Math.abs(m-r.y)){c=!0;break}}if(!c){var u=h.xe(!1);d=0;for(var F;F=u[d];d++)if(F.closest(g.md,new g.g.S(l,m)).connection){c=!0;break}}c&&(l=a.G?l-g.md:l+g.md,m+=2*g.md)}while(c);h.moveBy(l,m)}}finally{g.i.enable()}g.i.isEnabled()&&!h.$a&&g.i.Ka(new g.i.Rn(h));h.select()}}
function dd(a){if((a=a.$d?a.Dj:a)&&!a.Bc&&a.oa&&a.oa.M){a=a.oa;var c=a.ud.Id;c&&c.Cf&&a.M.show(c.Cf)}}b.Uh=function(a,c){g.gb.w.Uh.call(this,a,c);dd(this)};b.Hf=function(a){g.gb.w.Hf.call(this,a);dd(this)};b.Cd=function(a,c,d){a=g.gb.w.Cd.call(this,a,c,d);dd(this);return a};function Yc(a){a.sx=a.Xc&&a.H.parentNode?a.Xc.rm():null;a.qx=a.M?a.M.rm():a.oa?a.oa.rm():null}function Nb(a,c){return a.sx&&a.sx.contains(c.clientX,c.clientY)?g.Dq:a.qx&&a.qx.contains(c.clientX,c.clientY)?g.Bv:g.Av}
b.Oh=function(a){var c=this.Gg(a);c&&ac(c,a,this)};b.Qu=function(a,c){a=g.g.Um(a,v(this),pa(this));a.x/=this.scale;a.y/=this.scale;this.Fx=g.g.S.hm(c,a)};b.dc=function(){return null!=this.Bc&&this.Bc.dc()};function ed(a){return a.options.Hc&&a.options.Hc.scrollbars||a.options.Hc&&a.options.Hc.Lj||a.options.Hc&&a.options.Hc.vh||a.options.wb&&a.options.wb.controls||a.options.wb&&a.options.wb.Lj}
b.Fc=function(){return this.options.Hc&&this.options.Hc.scrollbars||this.options.Hc&&this.options.Hc.Lj||this.options.Hc&&this.options.Hc.vh||this.options.wb&&this.options.wb.Lj};
b.kG=function(a){if(g.Uj.nt())a.preventDefault(),a.stopPropagation();else{var c=this.options.wb&&this.options.wb.Lj,d=this.options.Hc&&this.options.Hc.Lj;if(c||d){var e=g.g.ky(a);!c||!a.ctrlKey&&d?(c=this.scrollX-e.x,d=this.scrollY-e.y,a.shiftKey&&!e.x&&(c=this.scrollX-e.y,d=this.scrollY),this.scroll(c,d)):(e=-e.y/50,c=g.g.Um(a,v(this),pa(this)),this.zoom(c.x,c.y,e));a.preventDefault()}}};
function Ab(a){var c=A(a,!1);a=wa(a,!1);c=c.concat(a);if(!c.length)return new g.g.Rect(0,0,0,0);a=Qc(c[0]);for(var d=1;d<c.length;d++){var e=Qc(c[d]);e.top<a.top&&(a.top=e.top);e.bottom>a.bottom&&(a.bottom=e.bottom);e.left<a.left&&(a.left=e.left);e.right>a.right&&(a.right=e.right)}return a}b.tD=function(){this.Lc(!1);g.i.Z(!0);for(var a=A(this,!0),c=0,d=0,e;e=a[d];d++)if(e.Fc()){var f=e.Oa();e.moveBy(-f.x,c-f.y);Pc(e);c=e.Oa().y+J(e).height+g.va.Vq}g.i.Z(!1);this.Lc(!0)};
b.pn=function(a){function c(F){if(F.Zd())u=u.concat(p(F,!1));else{F=F.xh(!1);for(var X=0;X<F.length;X++)c(F[X])}}function d(){g.i.Z(h);var F=u.shift();F&&(F.v?(F.I(!1,!0),setTimeout(d,10)):d());g.i.Z(!1)}if(!this.options.readOnly&&!this.$d){var e=[],f=A(this,!0),h=g.g.Eg(),k=this,l={};l.text=g.h.UNDO;l.enabled=0<this.Hj.length;l.tb=this.$u.bind(this,!1);e.push(l);l={};l.text=g.h.REDO;l.enabled=0<this.dn.length;l.tb=this.$u.bind(this,!0);e.push(l);this.Fc()&&(l={},l.text=g.h.CLEAN_UP,l.enabled=1<f.length,
l.tb=this.tD.bind(this),e.push(l));if(this.options.collapse){for(var m=l=!1,n=0;n<f.length;n++)for(var q=f[n];q;)q.isCollapsed()?l=!0:m=!0,q=t(q);var r=function(F){for(var X=0,ea=0;ea<f.length;ea++)for(var Ea=f[ea];Ea;)setTimeout(Ea.Ug.bind(Ea,F),X),Ea=t(Ea),X+=10};m={enabled:m};m.text=g.h.COLLAPSE_ALL;m.tb=function(){r(!0)};e.push(m);l={enabled:l};l.text=g.h.EXPAND_ALL;l.tb=function(){r(!1)};e.push(l)}var u=[];for(n=0;n<f.length;n++)c(f[n]);l={text:1==u.length?g.h.DELETE_BLOCK:g.h.DELETE_X_BLOCKS.replace("%1",
String(u.length)),enabled:0<u.length,tb:function(){k.Bc&&k.Bc.cancel();2>u.length?d():g.confirm(g.h.DELETE_ALL_BLOCKS.replace("%1",u.length),function(F){F&&d()})}};e.push(l);this.Xw&&this.Xw(e);g.Ba.show(a,e,this.G)}};
function fd(a){var c=I;if(a=g.Rd.Cz(a)){if(!c.options.Of)throw Error("Existing toolbox is null.  Can't create new toolbox.");if(a.getElementsByTagName("category").length){if(!c.oa)throw Error("Existing toolbox has no categories.  Can't change mode.");c.options.Of=a;vb(c.oa,a)}else{if(!c.M)throw Error("Existing toolbox has categories.  Can't change mode.");c.options.Of=a;c.M.show(a.childNodes)}}else if(c.options.Of)throw Error("Can't nullify an existing toolbox.");}
function oa(a){if(a.options.Kb)oa(a.options.Kb);else{g.Nm=a;document.activeElement&&document.activeElement.blur();try{v(a).focus()}catch(c){try{v(a).parentNode.setActive()}catch(d){v(a).parentNode.focus()}}}}
b.zoom=function(a,c,d){if(!this.$d&&!this.ej){d=Math.pow(this.options.wb.zG,d);var e=this.scale*d;if(this.scale!=e){e>this.options.wb.Qm?d=this.options.wb.Qm/this.scale:e<this.options.wb.Sm&&(d=this.options.wb.Sm/this.scale);var f=this.bb.getCTM(),h=v(this).createSVGPoint();h.x=a;h.y=c;h=h.matrixTransform(f.inverse());a=h.x;c=h.y;f=f.translate(a*(1-d),c*(1-d)).scale(d);this.scrollX=f.e;this.scrollY=f.f;this.setScale(e)}}};
function gd(a,c){var d=a.bc();if(a.M){var e=d.PG/2;d=d.OG/2}else e=d.lb/2+d.jc,d=d.rb/2+d.xc;a.zoom(e,d,c)}b.hE=function(){g.g.o.fc(this.bb,"blocklyCanvasTransitioning");g.g.o.fc(this.pf,"blocklyCanvasTransitioning")};
b.setScale=function(a){this.options.wb.Qm&&a>this.options.wb.Qm?a=this.options.wb.Qm:this.options.wb.Sm&&a<this.options.wb.Sm&&(a=this.options.wb.Sm);this.scale=a;g.mc(!1);this.M&&(this.M.su(),Yc(this));this.Be&&this.Be.update(this.scale);a=this.bc();this.scrollX-=a.jc;this.scrollY-=a.xc;a.Zb+=a.jc;a.hc+=a.xc;this.scroll(this.scrollX,this.scrollY);this.Pb&&(this.M?(ia(this.Pb.Xd,a),ja(this.Pb.ge,a)):(la(this.Pb.Xd,a),na(this.Pb.ge,a)))};
b.scroll=function(a,c){g.mc(!0);var d=this.bc(),e=d.Ye+d.Ac-d.lb,f=d.Bd+d.kc-d.rb;a=Math.min(a,-d.Ac);c=Math.min(c,-d.kc);a=Math.max(a,-e);c=Math.max(c,-f);this.scrollX=a;this.scrollY=c;this.Pb&&(ca(this.Pb.Xd,-(a+d.Ac)*this.Pb.Xd.Ic),ca(this.Pb.ge,-(c+d.kc)*this.Pb.ge.Ic));a+=d.jc;c+=d.xc;this.translate(a,c)};g.gb.$x=function(a){var c=0,d=0;a&&(c=a.Mf(),d=a.ey());return{width:c,height:d}};g.gb.BE=function(a,c){return ed(a)?g.gb.AE(a,c):g.gb.Xx(a)};
g.gb.Xx=function(a){var c=Ab(a),d=a.scale;a=c.top*d;var e=c.bottom*d,f=c.left*d;c=c.right*d;return{top:a,bottom:e,left:f,right:c,width:c-f,height:e-a}};g.gb.AE=function(a,c){a=g.gb.Xx(a);var d=c.width;c=c.height;var e=d/2,f=c/2,h=Math.min(a.left-e,a.right-d),k=Math.min(a.top-f,a.bottom-c);return{left:h,top:k,height:Math.max(a.bottom+f,a.top+c)-k,width:Math.max(a.right+e,a.left+d)-h}};
g.gb.JE=function(){var a=g.gb.$x(this.oa),c=g.gb.$x(this.M),d=g.hA(v(this)),e={height:d.height,width:d.width};if(this.oa)if(this.Da==g.qg||this.Da==g.xi)e.height-=a.height;else{if(this.Da==g.zd||this.Da==g.pg)e.width-=a.width}else if(this.M)if(this.Da==g.qg||this.Da==g.xi)e.height-=c.height;else if(this.Da==g.zd||this.Da==g.pg)e.width-=c.width;var f=g.gb.BE(this,e),h=0;this.oa&&this.Da==g.zd?h=a.width:this.M&&this.Da==g.zd&&(h=c.width);var k=0;this.oa&&this.Da==g.qg?k=a.height:this.M&&this.Da==g.qg&&
(k=c.height);return{Bd:f.height,Ye:f.width,kc:f.top,Ac:f.left,rb:e.height,lb:e.width,hc:-this.scrollY,Zb:-this.scrollX,xc:k,jc:h,OG:d.height,PG:d.width,jA:a.width,$L:a.height,wL:c.width,vL:c.height,Da:this.Da}};g.gb.FG=function(a){var c=this.bc();"number"==typeof a.x&&(this.scrollX=-c.Ye*a.x-c.Ac);"number"==typeof a.y&&(this.scrollY=-c.Bd*a.y-c.kc);this.translate(this.scrollX+c.jc,this.scrollY+c.xc)};g.gb.prototype.Lc=function(a){var c=!this.xu&&a;this.xu=a;c&&xb(this)};
g.gb.prototype.clear=function(){this.Lc(!1);g.gb.w.clear.call(this);this.Lc(!0)};function hd(a,c){if("function"!=typeof c)throw TypeError("Button callbacks must be functions.");a.Ps.CREATE_VARIABLE=c}function Qa(a,c){return(a=a.Ps[c])?a:null}function Xc(a,c,d){if("function"!=typeof d)throw TypeError("Toolbox category callbacks must be functions.");a.Xu[c]=d}
g.gb.prototype.Gg=function(a){var c="mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type,d=this.Bc;return d?c&&d.Ti?(console.warn("Tried to start the same gesture twice."),d.cancel(),null):d:c?this.Bc=new g.Sd(a,this):null};g.tl=function(a){a.bc=this.um.bind(this);a.Xh=this.Zz.bind(this);this.s=new g.gb(a);this.s.$d=!0;this.s.Du(new g.ki);this.s.Yz(new g.bh);this.G=!!a.G;this.bl=a.Da;this.Ms=[];this.Fp=[];this.Rl=[];this.sd=[];this.lu=[];this.al=this.s.Sg.C.ih};b=g.tl.prototype;b.lk=!0;b.Ih=!1;b.Ii=!0;b.sb=8;b.Qe=g.tl.prototype.sb;b.tB=3*g.tl.prototype.Qe;b.uB=3*g.tl.prototype.Qe;b.nr=2;b.ob=0;b.Uc=0;b.eE=70;
b.Ga=function(a){this.H=g.g.o.K(a,{"class":"blocklyFlyout",style:"display: none"},null);this.Mc=g.g.o.K("path",{"class":"blocklyFlyoutBackground"},this.H);this.H.appendChild(this.s.Ga());this.s.Rb.subscribe(this.Mc,"flyout","fill");this.s.Rb.subscribe(this.Mc,"flyoutOpacity","fill-opacity");return this.H};
b.aa=function(a){this.jb=a;this.s.Dj=a;this.pc=new g.Ja(this.s,this.ef,!1,"blocklyFlyoutScrollbar");this.ya();Array.prototype.push.apply(this.Ms,g.ka(this.H,"wheel",this,this.eH));this.lk||(this.Yo=this.Ns.bind(this),Aa(this.jb,this.Yo));Array.prototype.push.apply(this.Ms,g.ka(this.Mc,"mousedown",this,this.Oh));this.s.Gg=this.jb.Gg.bind(this.jb);this.s.Pa=this.jb.Pa;a=this.s;a.Rh=new g.Cr(a)};
b.I=function(){this.ya();g.Xa(this.Ms);this.Yo&&(Ba(this.jb,this.Yo),this.Yo=null);this.pc&&(this.pc.I(),this.pc=null);this.s&&(this.s.Rb.unsubscribe(this.Mc),this.s.Dj=null,this.s.I(),this.s=null);this.H&&(g.g.o.removeNode(this.H),this.H=null);this.jb=this.Mc=null};b.Mf=function(){return this.ob};b.ey=function(){return this.Uc};b.Dk=function(){return this.s};b.isVisible=function(){return this.Ih};b.Qb=function(a){var c=a!=this.isVisible();this.Ih=a;c&&this.En()};
b.uj=function(a){var c=a!=this.Ii;this.Ii=a;c&&this.En()};b.En=function(){var a=this.Ii?this.isVisible():!1;this.H.style.display=a?"block":"none";this.pc.uj(a)};b.ya=function(){if(this.isVisible()){this.Qb(!1);for(var a=0,c;c=this.sd[a];a++)g.Xa(c);this.sd.length=0;this.Sh&&(Ba(this.s,this.Sh),this.Sh=null)}};
b.show=function(a){this.s.Lc(!1);this.ya();id(this);if("string"==typeof a){a=this.s.Dj.Xu[a]||null;if("function"!=typeof a)throw TypeError("Couldn't find a callback function when opening a toolbox category.");a=a(this.s.Dj);if(!Array.isArray(a))throw TypeError("Result of toolbox category callback must be an array.");}this.Qb(!0);var c=[],d=[];this.lu.length=0;for(var e=this.ef?this.tB:this.uB,f=0,h;h=a[f];f++)if(h.tagName)switch(h.tagName.toUpperCase()){case "BLOCK":var k=g.O.Oi(h,this.s);k.isEnabled()||
this.lu.push(k);c.push({type:"block",block:k});h=parseInt(h.getAttribute("gap"),10);d.push(isNaN(h)?e:h);break;case "SEP":h=parseInt(h.getAttribute("gap"),10);!isNaN(h)&&0<d.length?d[d.length-1]=h:d.push(e);break;case "LABEL":case "BUTTON":k="LABEL"==h.tagName.toUpperCase();if(!g.Tj)throw Error("Missing require for Blockly.FlyoutButton");h=new g.Tj(this.s,this.jb,h,k);c.push({type:"button",button:h});d.push(e)}jd(this,c,d);this.sd.push(g.ka(this.Mc,"mouseover",this,function(){for(var l=A(this.s,!1),
m=0,n;n=l[m];m++)n.gn()}));this.ef?this.Uc=0:this.ob=0;this.s.Lc(!0);this.su();this.Ns();this.position();this.Sh=this.su.bind(this);Aa(this.s,this.Sh)};function id(a){for(var c=A(a.s,!1),d=0,e;e=c[d];d++)e.v==a.s&&e.I(!1,!1);for(d=0;d<a.Fp.length;d++)(c=a.Fp[d])&&g.g.o.removeNode(c);for(d=a.Fp.length=0;c=a.Rl[d];d++)c.I();a.Rl.length=0;a.s.Rh.clear()}function kd(a,c){return function(d){var e=a.jb.Gg(d);e&&(cc(e,c),bc(e,d,a))}}b.Oh=function(a){var c=this.jb.Gg(a);c&&bc(c,a,this)};b.Qy=function(a){return a.isEnabled()};
function Va(a,c){var d=null;g.i.disable();var e=a.jb.Fg();a.jb.Lc(!1);try{var f=a.jb;if(!c.wa())throw Error("oldBlock is not rendered.");var h=g.O.lh(c,!0);f.Lc(!1);var k=g.O.Oi(h,f);if(!k.wa())throw Error("block is not rendered.");var l=g.g.tm(f.bb),m=g.g.tm(a.s.bb),n=c.Oa();n.scale(a.s.scale);var q=g.g.S.sum(m,n),r=g.g.S.hm(q,l);r.scale(1/f.scale);k.moveBy(r.x,r.y);d=k;g.mc()}finally{g.i.enable()}c=g.N.Wx(a.jb,e);if(g.i.isEnabled())for(g.i.Z(!0),g.i.Ka(new g.i.ie(d)),e=0;e<c.length;e++)g.i.Ka(new g.i.re(c[e]));
a.lk?a.ya():a.Ns();return d}b.Ns=function(){for(var a=A(this.s,!1),c=0,d;d=a[c];c++)if(-1==this.lu.indexOf(d))for(var e=ya(this.jb,g.g.Ss(d));d;)d.Kc(e),d=t(d)};
b.su=function(){this.Sh&&Ba(this.s,this.Sh);this.s.scale=this.jb.scale;for(var a=0,c=A(this.s,!1),d=0,e;e=c[d];d++){var f=J(e).width;e.L&&(f-=this.al);a=Math.max(a,f)}for(d=0;e=this.Rl[d];d++)a=Math.max(a,e.width);a+=1.5*this.Qe+this.al;a*=this.s.scale;a+=g.Ja.oc;if(this.ob!=a){for(d=0;e=c[d];d++){if(this.G){f=e.Oa().x;var h=a/this.s.scale-this.Qe;e.L||(h-=this.al);e.moveBy(h-f,0)}e.Px&&(f=e.Px,h=e,e=J(h),f.setAttribute("width",e.width),f.setAttribute("height",e.height),h=h.Oa(),f.setAttribute("y",
h.y),f.setAttribute("x",this.G?h.x-e.width:h.x))}if(this.G)for(d=0;e=this.Rl[d];d++)e.moveTo(a/this.s.scale-e.width-this.Qe-this.al,e.ed.y);this.ob=a;this.position()}this.Sh&&Aa(this.s,this.Sh)};function Xb(a){return a.pc?a.pc.isVisible():!1};g.$={};g.$.Ca=null;g.$.dd=null;g.$.Vo=null;g.$.Ga=function(){g.$.Ca||(g.$.Ca=document.createElement("div"),g.$.Ca.className="blocklyWidgetDiv",document.body.appendChild(g.$.Ca))};g.$.show=function(a,c,d){g.$.ya();g.$.dd=a;g.$.Vo=d;g.$.Ca.style.top=g.g.style.uy().y+"px";g.$.Ca.style.direction=c?"rtl":"ltr";g.$.Ca.style.display="block"};g.$.ya=function(){g.$.dd&&(g.$.dd=null,g.$.Ca.style.display="none",g.$.Ca.style.left="",g.$.Ca.style.top="",g.$.Vo&&g.$.Vo(),g.$.Vo=null,g.$.Ca.innerHTML="")};
g.$.isVisible=function(){return!!g.$.dd};g.$.ym=function(a){g.$.dd==a&&g.$.ya()};g.$.Zm=function(a,c,d){g.$.Ca.style.left=a+"px";g.$.Ca.style.top=c+"px";g.$.Ca.style.height=d+"px"};g.$.pG=function(a,c,d,e){var f=g.$.kD(a,c,d);a=g.$.jD(a,c,d,e);0>f?g.$.Zm(a,0,d.height+f):g.$.Zm(a,f,d.height)};g.$.jD=function(a,c,d,e){if(e)return c=Math.max(c.right-d.width,a.left),Math.min(c,a.right-d.width);c=Math.min(c.left,a.right-d.width);return Math.max(c,a.left)};
g.$.kD=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};g.sg=function(a){a.bc=this.um.bind(this);a.Xh=this.Zz.bind(this);g.sg.w.constructor.call(this,a);this.ef=!1};g.g.object.T(g.sg,g.tl);b=g.sg.prototype;b.um=function(){if(!this.isVisible())return null;try{var a=this.s.bb.getBBox()}catch(f){a={height:0,y:0,width:0,x:0}}var c=this.nr,d=this.Uc-2*this.nr,e=this.ob;this.G||(e-=this.nr);return{rb:d,lb:e,Bd:a.height*this.s.scale+2*this.Qe,Ye:a.width*this.s.scale+2*this.Qe,hc:-this.s.scrollY+a.y,Zb:-this.s.scrollX,kc:a.y,Ac:a.x,xc:c,jc:0}};
b.Zz=function(a){var c=this.um();c&&("number"==typeof a.y&&(this.s.scrollY=-c.Bd*a.y),this.s.translate(this.s.scrollX+c.jc,this.s.scrollY+c.xc))};
b.position=function(){if(this.isVisible()){var a=this.jb.bc();if(a){this.Uc=a.rb;var c=this.ob-this.sb,d=a.rb-2*this.sb,e=this.bl==g.pg,f=c+this.sb;f=["M "+(e?f:0)+",0"];f.push("h",e?-c:c);f.push("a",this.sb,this.sb,0,0,e?0:1,e?-this.sb:this.sb,this.sb);f.push("v",Math.max(0,d));f.push("a",this.sb,this.sb,0,0,e?0:1,e?this.sb:-this.sb,this.sb);f.push("h",e?c:-c);f.push("z");this.Mc.setAttribute("d",f.join(" "));c=this.Uc;a=this.jb.Da==this.bl?a.jA?this.bl==g.zd?a.jA:a.lb-this.ob:this.bl==g.zd?0:a.lb:
this.bl==g.zd?0:a.lb+a.jc-this.ob;this.H.setAttribute("width",this.ob);this.H.setAttribute("height",c);"svg"==this.H.tagName?g.g.o.ln(this.H,"translate("+a+"px,0px)"):this.H.setAttribute("transform","translate("+a+",0)");this.pc&&(this.pc.fu=new g.g.S(a,0),this.pc.resize(),ha(this.pc,this.pc.ed.x,this.pc.ed.y))}}};b.eH=function(a){var c=g.g.ky(a);if(c.y){var d=this.um();c=d.hc-d.kc+c.y;c=Math.min(c,d.Bd-d.rb);c=Math.max(c,0);this.pc.set(c);g.$.ya()}a.preventDefault();a.stopPropagation()};
function jd(a,c,d){a.s.scale=a.jb.scale;for(var e=a.Qe,f=a.G?e:e+a.al,h=0,k;k=c[h];h++)if("block"==k.type){k=k.block;for(var l=p(k,!1),m=0,n;n=l[m];m++)n.Wb=!0;k.za();n=k.wa();l=J(k);m=k.L?f-a.al:f;k.moveBy(m,e);var q=a,r=k,u=h;m=g.g.o.K("rect",{"fill-opacity":0,x:a.G?m-l.width:m,y:e,height:l.height,width:l.width},null);m.qf=r;g.J.mk(m);q.s.bb.insertBefore(m,r.wa());r.Px=m;q.Fp[u]=m;q=a;q.sd.push(g.ka(n,"mousedown",null,kd(q,k)));q.sd.push(g.ka(m,"mousedown",null,kd(q,k)));q.sd.push(g.yc(n,"mouseover",
k,k.Ao));q.sd.push(g.yc(n,"mouseout",k,k.gn));q.sd.push(g.yc(m,"mouseover",k,k.Ao));q.sd.push(g.yc(m,"mouseout",k,k.gn));e+=l.height+d[h]}else"button"==k.type&&(l=a,m=k.button,n=f,q=e,r=m.Ga(),m.moveTo(n,q),m.show(),l.sd.push(g.ka(r,"mousedown",l,l.Oh)),l.Rl.push(m),e+=k.button.height+d[h])}
b.rm=function(){if(!this.H)return null;var a=this.H.getBoundingClientRect(),c=a.left;if(this.bl==g.zd)return new g.g.Rect(-1E9,1E9,-1E9,c+a.width);g.g.userAgent.Jq&&this.jb&&this.jb.ej&&(a=this.jb.H.getBoundingClientRect().x,10>Math.abs(a-c)&&(c+=this.JL*this.jb.options.Kb.scale));return new g.g.Rect(-1E9,1E9,c,1E9)};
g.Fr=function(a){this.s=a};b=g.Fr.prototype;b.Bi=32;b.Gv=110;b.Sq=20;b.yl=20;b.H=null;b.Lm=0;b.dl=0;b.Ga=function(){this.H=g.g.o.K("g",{},null);var a=String(Math.random()).substring(2);ld(this,a);md(this,a);this.s.Fc()&&nd(this,a);return this.H};b.aa=function(a){this.Zg=this.Sq+a;return this.Zg+this.Gv};b.I=function(){this.H&&g.g.o.removeNode(this.H)};
b.position=function(){if(this.Zg){var a=this.s.bc();a&&(this.Lm=a.Da==g.zd||this.s.Ed&&!this.s.G?a.lb+a.jc-this.Bi-this.yl-g.Ja.oc:this.yl+g.Ja.oc,a.Da==g.xi?(this.dl=this.Zg,this.oq.setAttribute("transform","translate(0, 34)"),this.pq&&this.pq.setAttribute("transform","translate(0, 77)")):(this.dl=a.rb+a.xc-this.Gv-this.Zg,this.oq.setAttribute("transform","translate(0, 43)"),this.dv.setAttribute("transform","translate(0, 77)")),this.H.setAttribute("transform","translate("+this.Lm+","+this.dl+")"))}};
function ld(a,c){var d=a.s;a.dv=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoomoutClipPath"+c},a.dv);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.nd.width,height:g.nd.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+c+")"},a.dv);a.setAttributeNS(g.g.o.Ue,"xlink:href",d.options.lf+g.nd.url);g.ka(a,"mousedown",null,function(f){oa(d);gd(d,-1);g.Touch.nh();f.stopPropagation();f.preventDefault()})}
function md(a,c){var d=a.s;a.oq=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoominClipPath"+c},a.oq);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.nd.width,height:g.nd.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+c+")"},a.oq);a.setAttributeNS(g.g.o.Ue,"xlink:href",d.options.lf+g.nd.url);g.ka(a,"mousedown",null,function(f){oa(d);gd(d,1);g.Touch.nh();f.stopPropagation();f.preventDefault()})}
function nd(a,c){var d=a.s;a.pq=g.g.o.K("g",{"class":"blocklyZoom"},a.H);var e=g.g.o.K("clipPath",{id:"blocklyZoomresetClipPath"+c},a.pq);g.g.o.K("rect",{width:32,height:32},e);a=g.g.o.K("image",{width:g.nd.width,height:g.nd.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+c+")"},a.pq);a.setAttributeNS(g.g.o.Ue,"xlink:href",d.options.lf+g.nd.url);g.ka(a,"mousedown",null,function(f){oa(d);d.setScale(d.options.wb.eA);g.g.o.qb(d.bb,"blocklyCanvasTransitioning");g.g.o.qb(d.pf,"blocklyCanvasTransitioning");
if(d.Fc()){var h=d.bc(),k=(h.Ye-h.lb)/2,l=(h.Bd-h.rb)/2;k=-k-h.Ac;l=-l-h.kc;d.scroll(k,l)}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.");setTimeout(d.hE.bind(d),500);g.Touch.nh();f.stopPropagation();f.preventDefault()})}
g.hd.register([".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]);g.uv=function(a){this.Yl=a;this.Ga()};b=g.uv.prototype;b.Sa=null;b.$e=null;b.Yl=null;b.Vh=1;b.vn=null;b.Ga=function(){this.Sa||(this.Sa=g.g.o.K("svg",{xmlns:g.g.o.Hl,"xmlns:html":g.g.o.Vj,"xmlns:xlink":g.g.o.Ue,version:"1.1","class":"blocklyBlockDragSurface"},this.Yl),this.$e=g.g.o.K("g",{},this.Sa))};function Ub(a,c){if(a.$e.childNodes.length)throw Error("Already dragging a block.");a.$e.appendChild(c);a.Sa.style.display="block";a.vn=new g.g.S(0,0)}
b.Gj=function(a,c){this.vn=new g.g.S(a*this.Vh,c*this.Vh);a=this.vn.x;c=this.vn.y;a=a.toFixed(0);c=c.toFixed(0);this.Sa.style.display="block";g.g.o.ln(this.Sa,"translate3d("+a+"px, "+c+"px, 0px)")};b.at=function(){var a=g.g.ze(this.Sa);return new g.g.S(a.x/this.Vh,a.y/this.Vh)};b.Ub=function(){return this.$e};
b.Ho=function(a){a?a.appendChild(this.$e.firstChild):this.$e.removeChild(this.$e.firstChild);this.Sa.style.display="none";if(this.$e.childNodes.length)throw Error("Drag group was not cleared.");this.vn=null};
g.D=function(){};g.D.je=null;g.D.Ur=null;g.D.dd=null;g.D.Pp=null;g.D.Mn=16;g.D.tv=1;g.D.nv=12;g.D.$v=16;g.D.wq=.25;g.D.yv="#dadce0";g.D.zv="#fff";g.D.Jr=null;g.D.pj=null;
g.D.Ga=function(){if(!g.D.je){var a=document.createElement("div");a.className="blocklyDropDownDiv";a.style.backgroundColor=g.D.zv;a.style.borderColor=g.D.yv;document.body.appendChild(a);g.D.je=a;var c=document.createElement("div");c.className="blocklyDropDownContent";a.appendChild(c);g.D.Ze=c;c=document.createElement("div");c.className="blocklyDropDownArrow";a.appendChild(c);g.D.Ve=c;g.D.je.style.opacity=0;g.D.je.style.transition="transform "+g.D.wq+"s, opacity "+g.D.wq+"s";a.addEventListener("focusin",
function(){g.g.o.qb(a,"focused")});a.addEventListener("focusout",function(){g.g.o.fc(a,"focused")})}};g.D.Vz=function(a){g.D.Ur=a};g.D.Yx=function(){return g.D.Ze};g.D.uD=function(){g.D.Ze.innerHTML="";g.D.Ze.style.width=""};g.D.mf=function(a,c){g.D.je.style.backgroundColor=a;g.D.je.style.borderColor=c};g.D.SL=function(a){g.D.je.setAttribute("data-category",a)};
g.D.UL=function(a,c,d,e){var f=c.v.scale,h=c.width,k=c.height;h*=f;k*=f;f=c.wa().getBoundingClientRect();h=f.left+h/2;k=f.top+k;f=f.top;e&&(f+=e);g.D.Vz(v(c.v).parentNode);return g.D.show(a,c.G,h,k,h,f,d)};g.D.aA=function(a,c){var d=a.wa().getBoundingClientRect(),e=d.left+d.width/2,f=d.bottom;d=d.top;var h=a.B;g.D.Pp=!0;g.D.Vz(v(h.v).parentNode);g.D.show(a,h.G,e,f,e,d,c)};
g.D.show=function(a,c,d,e,f,h,k){g.D.dd=a;g.D.pj=k||null;a=g.D.jy(d,e,f,h);a.Mr?(g.D.Ve.style.display="",g.D.Ve.style.transform="translate("+a.Pl+"px,"+a.Fw+"px) rotate(45deg)",g.D.Ve.setAttribute("class",a.Lr?"blocklyDropDownArrow arrowTop":"blocklyDropDownArrow arrowBottom")):g.D.Ve.style.display="none";g.D.je.style.direction=c?"rtl":"ltr";g.D.Zm(a.rp,a.sp,a.Zo,a.$o);return a.Lr};
g.D.vE=function(){var a=g.D.Ur.getBoundingClientRect(),c=g.g.style.Hg(g.D.Ur);return{left:a.left,right:a.left+c.width,top:a.top,bottom:a.top+c.height,width:c.width,height:c.height}};g.D.jy=function(a,c,d,e){var f=g.D.vE(),h=g.g.style.Hg(g.D.je);return c+h.height<f.bottom?g.D.iy(a,c,f,h):e-h.height>f.top?g.D.gy(d,e,f,h):c+h.height<document.documentElement.clientHeight?g.D.iy(a,c,f,h):e-h.height>document.documentElement.clientTop?g.D.gy(d,e,f,h):g.D.IE(a,f,h)};
g.D.iy=function(a,c,d,e){a=g.D.Zs(a,d.left,d.right,e.width);return{rp:a.xk,sp:c,Zo:a.xk,$o:c+g.D.$v,Pl:a.Pl,Fw:-(g.D.Mn/2+g.D.tv),Lr:!0,Mr:!0}};g.D.gy=function(a,c,d,e){a=g.D.Zs(a,d.left,d.right,e.width);return{rp:a.xk,sp:c-e.height,Zo:a.xk,$o:c-e.height-g.D.$v,Pl:a.Pl,Fw:e.height-2*g.D.tv-g.D.Mn/2,Lr:!1,Mr:!0}};g.D.IE=function(a,c,d){a=g.D.Zs(a,c.left,c.right,d.width);return{rp:a.xk,sp:0,Zo:a.xk,$o:0,Mr:!1}};
g.D.Zs=function(a,c,d,e){var f=a;a=g.g.td.Gi(c,a-e/2,d-e);f-=g.D.Mn/2;c=g.g.td.Gi(g.D.nv,f-a,e-g.D.nv-g.D.Mn);return{Pl:c,xk:a}};g.D.isVisible=function(){return!!g.D.dd};g.D.ym=function(a,c){g.D.dd===a&&(c?g.D.Ui():g.D.ya())};g.D.ya=function(){var a=g.D.je;a.style.transform="translate(0, 0)";a.style.opacity=0;g.D.Jr=setTimeout(function(){g.D.Ui()},1E3*g.D.wq);g.D.pj&&(g.D.pj(),g.D.pj=null)};
g.D.Ui=function(){if(g.D.isVisible()){g.D.Jr&&clearTimeout(g.D.Jr);var a=g.D.je;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=g.D.zv;a.style.borderColor=g.D.yv;g.D.pj&&(g.D.pj(),g.D.pj=null);g.D.uD();g.D.dd=null}};
g.D.Zm=function(a,c,d,e){a=Math.floor(a);c=Math.floor(c);d=Math.floor(d);e=Math.floor(e);var f=g.D.je;f.style.left=a+"px";f.style.top=c+"px";f.style.display="block";f.style.opacity=1;f.style.transform="translate("+(d-a)+"px,"+(e-c)+"px)"};
g.D.NL=function(){if(g.D.dd){var a=g.D.dd.B,c=a.v.scale,d=g.D.Pp?g.D.dd.Lb.width:a.width,e=g.D.Pp?g.D.dd.Lb.height:a.height;d*=c;e*=c;a=g.D.Pp?g.D.dd.we.getBoundingClientRect():a.wa().getBoundingClientRect();d=a.left+d/2;e=g.D.jy(d,a.top+e,d,a.top);g.D.Zm(e.rp,e.sp,e.Zo,e.$o)}else g.D.ya()};g.Dh=function(a,c){g.oD();"string"==typeof a&&(a=document.getElementById(a)||document.querySelector(a));if(!g.g.o.containsNode(document,a))throw Error("Error: container is not in current document.");c=new g.Rd(c||{});var d=document.createElement("div");d.className="injectionDiv";a.appendChild(d);a=g.$l(d,c);var e=new g.uv(d);d=new g.yw(d);d=g.FD(a,c,e,d);g.mb.ib.EG(c.ib);g.jF(d);g.Nm=d;g.$k(d);return d};
g.$l=function(a,c){a.setAttribute("dir","LTR");g.vc.px=c.G;g.hd.Dh(c.ZE,c.lf);a=g.g.o.K("svg",{xmlns:g.g.o.Hl,"xmlns:html":g.g.o.Vj,"xmlns:xlink":g.g.o.Ue,version:"1.1","class":"blocklySvg"},a);var d=g.g.o.K("defs",{},a),e=String(Math.random()).substring(2),f=g.g.o.K("filter",{id:"blocklyEmbossFilter"+e},d);g.g.o.K("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:1,result:"blur"},f);var h=g.g.o.K("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white",
result:"specOut"},f);g.g.o.K("fePointLight",{x:-5E3,y:-1E4,z:2E4},h);g.g.o.K("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},f);g.g.o.K("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},f);c.Ix=f.id;f=g.g.o.K("pattern",{id:"blocklyDisabledPattern"+e,patternUnits:"userSpaceOnUse",width:10,height:10},d);g.g.o.K("rect",{width:10,height:10,fill:"#aaa"},f);g.g.o.K("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},f);c.Cg=f.id;
c.xy=g.li.Ga(e,c.wy,d);return a};
g.FD=function(a,c,d,e){c.Kb=null;var f=new g.gb(c,d,e);f.scale=c.wb.eA;a.appendChild(f.Ga("blocklyMainBackground"));!c.Ay&&c.Of&&(d=ad(f,"svg"),g.g.o.Zi(d,a));c.Ey&&Zc(f);c.wb&&c.wb.controls&&$c(f);f.Rb.subscribe(a,"workspace","background-color");f.translate(0,0);g.Nm=f;c.readOnly||f.Fc()||Aa(f,function(h){if(!f.dc()&&!f.Fc()&&-1!=g.i.LA.indexOf(h.type)){var k=Object.create(null),l=f.bc(),m=f.scale;k.G=f.G;k.Zb=l.Zb/m;k.hc=l.hc/m;k.qA=(l.Zb+l.lb)/m;k.pA=(l.hc+l.rb)/m;ed(f)?(l=Ab(f),k.Ac=l.left,k.kc=
l.top,k.ex=l.right,k.ax=l.bottom):(k.Ac=l.Ac/m,k.kc=l.kc/m,k.ex=(l.Ac+l.Ye)/m,k.ax=(l.kc+l.Bd)/m);if(k.kc<k.hc||k.ax>k.pA||k.Ac<k.Zb||k.ex>k.qA){l=null;h&&(l=g.i.Ub(),g.i.Z(h.group));switch(h.type){case g.i.kl:case g.i.pv:var n=x(f,h.zc);n=G(n);break;case g.i.Tn:case g.i.Un:n=f.Lo[h.Ef]||null}if(n){m=Qc(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var q=k.hc,r=k.pA-m.height;r=Math.max(q,r);q=g.g.td.Gi(q,m.top,r)-m.top;r=k.Zb;var u=k.qA-m.width;k.G?r=Math.min(u,r):u=Math.max(r,u);n.moveBy(g.g.td.Gi(r,
m.left,u)-m.left,q)}h&&(h.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&g.i.Z(l))}}});g.$k(f);g.$.Ga();g.D.Ga();g.J.Ga();return f};
g.jF=function(a){var c=a.options,d=v(a);g.ka(d.parentNode,"contextmenu",null,function(e){g.g.Ap(e)||e.preventDefault()});d=g.ka(window,"resize",null,function(){g.mc(!0);g.$k(a)});a.Wp=d;g.Dh.bD();c.Of&&(a.oa?a.oa.aa(a):a.M&&(a.M.aa(a),a.M.show(c.Of.childNodes),a.M.pc.set(0)));d=g.Ja.oc;c.Ey&&(d=a.Xc.aa(d));c.wb&&c.wb.controls&&a.Nj.aa(d);c.Hc&&c.Hc.scrollbars?(a.Pb=new g.hk(a),a.Pb.resize()):a.Xh({x:.5,y:.5});c.aF&&g.Dh.uF(c.lf,a)};
g.Dh.bD=function(){g.bE||(g.ka(document,"scroll",null,function(){for(var a=g.Fb.getAll(),c=0,d;d=a[c];c++)d.Fn&&d.Fn()}),g.ka(document,"keydown",null,g.ZF),g.yc(document,"touchend",null,g.Kh),g.yc(document,"touchcancel",null,g.Kh),g.g.userAgent.Wj&&g.ka(window,"orientationchange",document,function(){g.$k(g.ub())}));g.bE=!0};
g.Dh.uF=function(a,c){function d(){for(;f.length;)g.Xa(f.pop());e.preload()}var e=c.kh;e.load([a+"click.mp3",a+"click.wav",a+"click.ogg"],"click");e.load([a+"disconnect.wav",a+"disconnect.mp3",a+"disconnect.ogg"],"disconnect");e.load([a+"delete.mp3",a+"delete.ogg",a+"delete.wav"],"delete");var f=[];f.push(g.ka(document,"mousemove",null,d,!0));f.push(g.ka(document,"touchstart",null,d,!0))};g.Qd=function(a,c){this.oA=c||"";this.Pz=Object.create(null);if(a)for(a=a.split(","),c=0;c<a.length;c++)this.Pz[a[c]]=!0;this.reset()};g.Qd.Eq="DEVELOPER_VARIABLE";g.Qd.prototype.reset=function(){this.Gf=Object.create(null);this.ox=Object.create(null);this.Pa=null};
function od(a,c){var d=g.m.vd;if(c==g.N.xb){var e=a;d.Pa?e=(e=d.Pa.cf(e))?e.name:null:(console.log("Deprecated call to Blockly.Names.prototype.getName without defining a variable map. To fix, add the folowing code in your generator's init() function:\nBlockly.YourGeneratorName.variableDB_.setVariableMap(workspace.getVariableMap());"),e=null);e&&(a=e)}e=a.toLowerCase()+"_"+c;var f=c==g.N.xb||c==g.Qd.Eq?d.oA:"";if(e in d.Gf)return f+d.Gf[e];a=pd(d,a,c);d.Gf[e]=a.substr(f.length);return a}
function pd(a,c,d){c?(c=encodeURI(c.replace(/ /g,"_")).replace(/[^\w]/g,"_"),-1!="0123456789".indexOf(c[0])&&(c="my_"+c)):c=g.h.UNNAMED_KEY||"unnamed";for(var e="";a.ox[c+e]||c+e in a.Pz;)e=e?e+1:2;c+=e;a.ox[c]=!0;return(d==g.N.xb||d==g.Qd.Eq?a.oA:"")+c}g.Qd.ve=function(a,c){return a.toLowerCase()==c.toLowerCase()};g.Ea={};g.Ea.xb=g.bw;g.Ea.ZC=function(a){a=y(a,!1);for(var c=[],d=[],e=0;e<a.length;e++)if(a[e].zh){var f=a[e].zh();f&&(f[2]?c.push(f):d.push(f))}d.sort(g.Ea.Kz);c.sort(g.Ea.Kz);return[d,c]};g.Ea.Kz=function(a,c){return a[0].toLowerCase().localeCompare(c[0].toLowerCase())};g.Ea.mE=function(a,c){if(c.Wb)return a;for(a=a||g.h.UNNAMED_KEY||"unnamed";!g.Ea.nF(a,c.v,c);){var d=a.match(/^(.*?)(\d+)$/);a=d?d[1]+(parseInt(d[2],10)+1):a+"2"}return a};g.Ea.nF=function(a,c,d){return!g.Ea.pF(a,c,d)};
g.Ea.pF=function(a,c,d){c=y(c,!1);for(var e=0;e<c.length;e++)if(c[e]!=d&&c[e].zh){var f=c[e].zh();if(g.Qd.ve(f[0],a))return!0}return!1};g.Ea.uu=function(a){a=a.trim();var c=g.Ea.mE(a,this.B),d=this.getValue();if(d!=a&&d!=c){a=y(this.B.v,!1);for(var e=0;e<a.length;e++)a[e].hn&&a[e].hn(d,c)}return c};
g.Ea.Qi=function(a){function c(h,k){for(var l=0;l<h.length;l++){var m=h[l][0],n=h[l][1],q=g.g.xml.createElement("block");q.setAttribute("type",k);q.setAttribute("gap",16);var r=g.g.xml.createElement("mutation");r.setAttribute("name",m);q.appendChild(r);for(m=0;m<n.length;m++){var u=g.g.xml.createElement("arg");u.setAttribute("name",n[m]);r.appendChild(u)}d.push(q)}}var d=[];if(g.W.procedures_defnoreturn){var e=g.g.xml.createElement("block");e.setAttribute("type","procedures_defnoreturn");e.setAttribute("gap",
16);var f=g.g.xml.createElement("field");f.setAttribute("name","NAME");f.appendChild(g.g.xml.createTextNode(g.h.PROCEDURES_DEFNORETURN_PROCEDURE));e.appendChild(f);d.push(e)}g.W.procedures_defreturn&&(e=g.g.xml.createElement("block"),e.setAttribute("type","procedures_defreturn"),e.setAttribute("gap",16),f=g.g.xml.createElement("field"),f.setAttribute("name","NAME"),f.appendChild(g.g.xml.createTextNode(g.h.PROCEDURES_DEFRETURN_PROCEDURE)),e.appendChild(f),d.push(e));g.W.procedures_ifreturn&&(e=g.g.xml.createElement("block"),
e.setAttribute("type","procedures_ifreturn"),e.setAttribute("gap",16),d.push(e));d.length&&d[d.length-1].setAttribute("gap",24);a=g.Ea.ZC(a);c(a[0],"procedures_callnoreturn");c(a[1],"procedures_callreturn");return d};g.Ea.wE=function(a,c){var d=[];c=y(c,!1);for(var e=0;e<c.length;e++)if(c[e].Wd){var f=c[e].Wd();f&&g.Qd.ve(f,a)&&d.push(c[e])}return d};
g.Ea.Vm=function(a){var c=g.i.Jc,d=a.zh()[0],e=a.eb(!0);a=g.Ea.wE(d,a.v);d=0;for(var f;f=a[d];d++){var h=f.eb();h=h&&g.O.Dd(h);f.Ab(e);var k=f.eb();k=k&&g.O.Dd(k);h!=k&&(g.i.Jc=!1,g.i.Ka(new g.i.eg(f,"mutation",null,h,k)),g.i.Jc=c)}};g.Ea.sm=function(a,c){c=A(c,!1);for(var d=0;d<c.length;d++)if(c[d].zh){var e=c[d].zh();if(e&&g.Qd.ve(e[0],a))return c[d]}return null};g.Kl=function(a,c,d,e){this.v=a;this.name=c;this.type=d||"";this.Ik=e||g.g.Eg();g.i.Ka(new g.i.re(this))};g.Kl.prototype.ua=function(){return this.Ik};g.Kl.Ww=function(a,c){a=a.name.toLowerCase();c=c.name.toLowerCase();return a<c?-1:a==c?0:1};g.N={};g.N.xb=g.sw;g.N.Ew=function(a){var c=y(a,!1);a=Object.create(null);for(var d=0;d<c.length;d++){var e=c[d].Ig();if(e)for(var f=0;f<e.length;f++){var h=e[f],k=h.ua();k&&(a[k]=h)}}c=[];for(k in a)c.push(a[k]);return c};g.N.lL=function(){console.warn("Deprecated call to Blockly.Variables.allUsedVariables. Use Blockly.Variables.allUsedVarModels instead.\nIf this is a major issue please file a bug on GitHub.")};g.N.jv={};
g.N.XC=function(a){a=y(a,!1);for(var c=Object.create(null),d=0,e;e=a[d];d++){var f=e.xL;!f&&e.CE&&(f=e.CE,g.N.jv[e.type]||(console.warn("Function getDeveloperVars() deprecated. Use getDeveloperVariables() (block type '"+e.type+"')"),g.N.jv[e.type]=!0));if(f)for(e=f(),f=0;f<e.length;f++)c[e[f]]=!0}return Object.keys(c)};
g.N.Qi=function(a){var c=[],d=document.createElement("button");d.setAttribute("text","%{BKY_NEW_VARIABLE}");d.setAttribute("callbackKey","CREATE_VARIABLE");hd(a,function(e){g.N.ix(e.jb)});c.push(d);a=g.N.pE(a);return c=c.concat(a)};
g.N.pE=function(a){a=a.vm("");var c=[];if(0<a.length){var d=a[a.length-1];if(g.W.variables_set){var e=g.g.xml.createElement("block");e.setAttribute("type","variables_set");e.setAttribute("gap",g.W.math_change?8:24);e.appendChild(g.N.qm(d));c.push(e)}g.W.math_change&&(e=g.g.xml.createElement("block"),e.setAttribute("type","math_change"),e.setAttribute("gap",g.W.variables_get?20:8),e.appendChild(g.N.qm(d)),d=g.O.$h('<value name="DELTA"><shadow type="math_number"><field name="NUM">1</field></shadow></value>'),
e.appendChild(d),c.push(e));if(g.W.variables_get){a.sort(g.Kl.Ww);d=0;for(var f;f=a[d];d++)e=g.g.xml.createElement("block"),e.setAttribute("type","variables_get"),e.setAttribute("gap",8),e.appendChild(g.N.qm(f)),c.push(e)}}return c};
g.N.Vx=function(a){a=a.Fg();var c="";if(a.length)for(var d=1,e=0,f="ijkmnopqrstuvwxyzabcdefgh".charAt(e);!c;){for(var h=!1,k=0;k<a.length;k++)if(a[k].name.toLowerCase()==f){h=!0;break}h?(e++,25==e&&(e=0,d++),f="ijkmnopqrstuvwxyzabcdefgh".charAt(e),1<d&&(f+=d)):c=f}else c="i";return c};
g.N.ix=function(a,c,d){function e(h){g.N.Lz(g.h.NEW_VARIABLE_TITLE,h,function(k){if(k){var l=g.N.KF(k,a);if(l){var m=k.toLowerCase();if(l.type==f)var n=g.h.VARIABLE_ALREADY_EXISTS.replace("%1",m);else n=g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE,n=n.replace("%1",m).replace("%2",l.type);g.alert(n,function(){e(k)})}else a.Cd(k,f),c&&c(k)}else c&&c(null)})}var f=d||"";e("")};g.N.Cd=g.N.ix;
g.N.Tp=function(a,c){function d(e){var f=g.h.RENAME_VARIABLE_TITLE.replace("%1",c.name);g.N.Lz(f,e,function(h){if(h){var k=g.N.LF(h,c.type,a);k?(k=g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE.replace("%1",h.toLowerCase()).replace("%2",k.type),g.alert(k,function(){d(h)})):a.Uh(c.ua(),h)}})}d("")};g.N.Lz=function(a,c,d){g.prompt(a,c,function(e){e&&(e=e.replace(/[\s\xa0]+/g," ").trim(),e==g.h.RENAME_VARIABLE||e==g.h.NEW_VARIABLE)&&(e=null);d(e)})};
g.N.LF=function(a,c,d){d=d.Pa.Fg();a=a.toLowerCase();for(var e=0,f;f=d[e];e++)if(f.name.toLowerCase()==a&&f.type!=c)return f;return null};g.N.KF=function(a,c){c=c.Pa.Fg();a=a.toLowerCase();for(var d=0,e;e=c[d];d++)if(e.name.toLowerCase()==a)return e;return null};g.N.qm=function(a){var c=g.g.xml.createElement("field");c.setAttribute("name","VAR");c.setAttribute("id",a.ua());c.setAttribute("variabletype",a.type);a=g.g.xml.createTextNode(a.name);c.appendChild(a);return c};
g.N.gp=function(a,c,d,e){var f=g.N.Tc(a,c,d,e);f||(f=g.N.HD(a,c,d,e));return f};g.N.Tc=function(a,c,d,e){var f=a.Rh;if(c){var h=a.cf(c);!h&&f&&(h=f.cf(c));if(h)return h}if(d){if(void 0==e)throw Error("Tried to look up a variable by name without a type");h=a.Tc(d,e);!h&&f&&(h=f.Tc(d,e))}return h};g.N.HD=function(a,c,d,e){var f=a.Rh;d||(d=g.N.Vx(a.$d?a.Dj:a));return f?f.Cd(d,e,c):a.Cd(d,e,c)};
g.N.Wx=function(a,c){a=a.Fg();var d=[];if(c.length!=a.length)for(var e=0;e<a.length;e++){var f=a[e];-1==c.indexOf(f)&&d.push(f)}return d};g.VERSION="uncompiled";g.Nm=null;g.selected=null;g.cursor=null;g.De=!1;g.jm=[];g.Ul=null;g.Jo=null;g.ds=null;g.oL=null;g.hA=function(a){return{width:a.Jw,height:a.Hw}};g.OL=function(a){xb(a)};g.$k=function(a){for(;a.options.Kb;)a=a.options.Kb;var c=v(a),d=c.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.Jw!=e&&(c.setAttribute("width",e+"px"),c.Jw=e);c.Hw!=d&&(c.setAttribute("height",d+"px"),c.Hw=d);a.resize()}};
g.ZF=function(a){var c=g.Nm;if(!(g.g.Ap(a)||c.ca&&!c.isVisible()))if(c.options.readOnly)g.navigation.wz(a);else{var d=!1;if(a.keyCode==g.g.Ia.Gq)g.mc(),g.navigation.Nh(g.navigation.qq);else{if(g.navigation.wz(a))return;if(a.keyCode==g.g.Ia.HA||a.keyCode==g.g.Ia.ol){a.preventDefault();if(g.Uj.nt())return;g.selected&&g.selected.Zd()&&(d=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(g.Uj.nt())return;g.selected&&g.selected.Zd()&&g.selected.Fc()&&(a.keyCode==g.g.Ia.NA?(g.mc(),g.js(g.selected)):a.keyCode!=
g.g.Ia.zw||g.selected.v.$d||(g.js(g.selected),d=!0));a.keyCode==g.g.Ia.HC?g.Ul&&(a=g.Jo,a.$d&&(a=a.Dj),g.ds&&ya(a,g.ds)&&(g.i.Z(!0),cd(a),g.i.Z(!1))):a.keyCode==g.g.Ia.RC&&(g.mc(),c.$u(a.shiftKey))}}d&&!g.selected.v.$d&&(g.i.Z(!0),g.mc(),g.selected.I(!0,!0),g.i.Z(!1))}};g.js=function(a){if(a.Ry)var c=a.Vu();else{c=g.O.lh(a,!0);g.O.TD(c);var d=a.Oa();c.setAttribute("x",a.G?-d.x:d.x);c.setAttribute("y",d.y)}g.Ul=c;g.Jo=a.v;g.ds=a.Ry?null:g.g.Ss(a,!0)};
g.Gx=function(a){var c=g.Ul,d=g.Jo;g.js(a);cd(a.v);g.Ul=c;g.Jo=d};g.ML=function(a){g.g.Ap(a)||a.preventDefault()};g.mc=function(a){g.J.ya();g.$.ya();g.D.Ui();a||(a=g.ub(),a.Xc&&a.Xc.M&&a.Xc.M.ya(),a.oa&&a.oa.M&&a.oa.M.lk&&Ta(a.oa.ud,null))};g.ub=function(){return g.Nm};g.alert=function(a,c){alert(a);c&&c()};g.confirm=function(a,c){c(confirm(a))};g.prompt=function(a,c,d){d(prompt(a,c))};g.rF=function(a){return function(){sc(this,a)}};
g.wk=function(a){for(var c=0;c<a.length;c++){var d=a[c];if(d){var e=d.type;null==e||""===e?console.warn("Block definition #"+c+" in JSON array is missing a type attribute. Skipping."):(g.W[e]&&console.warn("Block definition #"+c+' in JSON array overwrites prior definition of "'+e+'".'),g.W[e]={aa:g.rF(d)})}else console.warn("Block definition #"+c+" in JSON array is "+d+". Skipping.")}};
g.ka=function(a,c,d,e,f,h){function k(u){var F=!f;u=g.Touch.JG(u);for(var X=0,ea;ea=u[X];X++)if(!F||g.Touch.Mu(ea))g.Touch.CG(ea),d?e.call(d,ea):e(ea),l=!0}var l=!1,m=[];if(g.g.global.PointerEvent&&c in g.Touch.yf)for(var n=0,q;q=g.Touch.yf[c][n];n++)a.addEventListener(q,k,!1),m.push([a,q,k]);else if(a.addEventListener(c,k,!1),m.push([a,c,k]),c in g.Touch.yf){var r=function(u){k(u);var F=!h;l&&F&&u.preventDefault()};for(n=0;q=g.Touch.yf[c][n];n++)a.addEventListener(q,r,!1),m.push([a,q,r])}return m};
g.yc=function(a,c,d,e){function f(n){d?e.call(d,n):e(n)}var h=[];if(g.g.global.PointerEvent&&c in g.Touch.yf)for(var k=0,l;l=g.Touch.yf[c][k];k++)a.addEventListener(l,f,!1),h.push([a,l,f]);else if(a.addEventListener(c,f,!1),h.push([a,c,f]),c in g.Touch.yf){var m=function(n){if(n.changedTouches&&1==n.changedTouches.length){var q=n.changedTouches[0];n.clientX=q.clientX;n.clientY=q.clientY}f(n);n.preventDefault()};for(k=0;l=g.Touch.yf[c][k];k++)a.addEventListener(l,m,!1),h.push([a,l,m])}return h};
g.Xa=function(a){for(;a.length;){var c=a.pop();c[0].removeEventListener(c[1],c[2],!1)}};g.Hh=function(a){return/^\s*-?\d+(\.\d+)?\s*$/.test(a)};g.Ky=function(a){return g.g.Ib.dF(a)};
g.oD=function(){g.bd("LOGIC_HUE",["Blocks","logic","HUE"],void 0);g.bd("LOGIC_HUE",["Constants","Logic","HUE"],210);g.bd("LOOPS_HUE",["Blocks","loops","HUE"],void 0);g.bd("LOOPS_HUE",["Constants","Loops","HUE"],120);g.bd("MATH_HUE",["Blocks","math","HUE"],void 0);g.bd("MATH_HUE",["Constants","Math","HUE"],230);g.bd("TEXTS_HUE",["Blocks","texts","HUE"],void 0);g.bd("TEXTS_HUE",["Constants","Text","HUE"],160);g.bd("LISTS_HUE",["Blocks","lists","HUE"],void 0);g.bd("LISTS_HUE",["Constants","Lists","HUE"],
260);g.bd("COLOUR_HUE",["Blocks","colour","HUE"],void 0);g.bd("COLOUR_HUE",["Constants","Colour","HUE"],20);g.bd("VARIABLES_HUE",["Blocks","variables","HUE"],void 0);g.bd("VARIABLES_HUE",["Constants","Variables","HUE"],330);g.bd("VARIABLES_DYNAMIC_HUE",["Constants","VariablesDynamic","HUE"],310);g.bd("PROCEDURES_HUE",["Blocks","procedures","HUE"],void 0)};
g.bd=function(a,c,d){for(var e="Blockly",f=g,h=0;h<c.length;++h)e+="."+c[h],f&&(f=f[c[h]]);f&&f!==d&&(a=(void 0===d?'%1 has been removed. Use Blockly.Msg["%2"].':'%1 is deprecated and unused. Override Blockly.Msg["%2"].').replace("%1",e).replace("%2",a),console.warn(a))};var qd={ar:"\u0627\u0644\u0639\u0631\u0628\u064a\u0629",be:"\u0431\u0435\u043b\u0430\u0440\u0443\u0441\u043a\u0456","be-tarask":"Tara\u0161kievica",bg:"\u0431\u044a\u043b\u0433\u0430\u0440\u0441\u043a\u0438 \u0435\u0437\u0438\u043a",bn:"\u09ac\u09be\u0982\u09b2\u09be",br:"Brezhoneg",cs:"\u010cesky",da:"Dansk",de:"Deutsch",el:"\u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03ac",en:"English",es:"Espa\u00f1ol",eu:"Euskara",fa:"\u0641\u0627\u0631\u0633\u06cc",fi:"Suomi",fr:"Fran\u00e7ais",gl:"Galego",ha:"Hausa",
he:"\u05e2\u05d1\u05e8\u05d9\u05ea",hi:"\u0939\u093f\u0928\u094d\u0926\u0940",hu:"Magyar",hy:"\u0570\u0561\u0575\u0565\u0580\u0567\u0576",ia:"Interlingua",id:"Bahasa Indonesia",ig:"As\u1ee5s\u1ee5 Igbo",is:"\u00cdslenska",it:"Italiano",ja:"\u65e5\u672c\u8a9e",kab:"Taqbaylit",ko:"\ud55c\uad6d\uc5b4",lt:"Lietuvi\u0173",lv:"Latvie\u0161u",ms:"Bahasa Melayu",my:"\u1019\u103c\u1014\u103a\u1019\u102c\u1005\u102c",nb:"Norsk Bokm\u00e5l",nl:"Nederlands, Vlaams",pl:"Polski",pms:"Piemont\u00e8is",pt:"Portugu\u00eas",
"pt-br":"Portugu\u00eas Brasileiro",ro:"Rom\u00e2n\u0103",ru:"\u0420\u0443\u0441\u0441\u043a\u0438\u0439",sc:"Sardu",sk:"Sloven\u010dina",sl:"Sloven\u0161\u010dina",sq:"Shqip",sr:"\u0421\u0440\u043f\u0441\u043a\u0438",sv:"Svenska",th:"\u0e20\u0e32\u0e29\u0e32\u0e44\u0e17\u0e22",tr:"T\u00fcrk\u00e7e",uk:"\u0423\u043a\u0440\u0430\u0457\u043d\u0441\u044c\u043a\u0430",ur:"\u0627\u064f\u0631\u062f\u064f\u0648\u202c",vi:"Ti\u1ebfng Vi\u1ec7t",yo:"\u00c8d\u00e8 Yor\u00f9b\u00e1","zh-hans":"\u7b80\u4f53\u4e2d\u6587",
"zh-hant":"\u6b63\u9ad4\u4e2d\u6587"},rd="ace ar fa he mzn ps ur".split(" "),sd=window.BlocklyGamesLang,td=window.BlocklyGamesLanguages,ud=".html"==window.location.pathname.substr(-5),I=null,O,vd=Number,wd,xd=window.location.search.match(/[?&]level=([^&]+)/);wd=xd?decodeURIComponent(xd[1].replace(/\+/g,"%20")):"NaN";var yd=vd(wd);O=isNaN(yd)?1:g.g.td.Gi(1,yd,10);
function zd(){document.title=document.getElementById("title").textContent;document.dir=-1!=rd.indexOf(sd)?"rtl":"ltr";document.head.parentElement.setAttribute("lang",sd);var a=document.getElementById("languageMenu");if(a){for(var c=[],d=0;d<td.length;d++){var e=td[d];c.push([qd[e],e])}c.sort(function(h,k){return h[0]>k[0]?1:h[0]<k[0]?-1:0});for(d=a.options.length=0;d<c.length;d++){var f=c[d];e=f[1];f=new Option(f[0],e);e==sd&&(f.selected=!0);a.options.add(f)}1>=a.options.length&&(a.style.display=
"none")}for(d=1;10>=d;d++)a=document.getElementById("level"+d),c=!!Ad(d),a&&c&&(a.className+=" level_done");(d=document.querySelector('meta[name="viewport"]'))&&725>screen.availWidth&&d.setAttribute("content","width=725, initial-scale=.35, user-scalable=no");setTimeout(Bd,1)}function Ad(a){var c=Cd;try{var d=window.localStorage[c+a]}catch(e){}return d}function P(a){var c;(c=document.getElementById(a))?(c=c.textContent,c=c.replace(/\\n/g,"\n")):c=null;return null===c?"[Unknown message: "+a+"]":c}
function Dd(a,c){if(!a)throw TypeError("Element not found: "+a);"string"==typeof a&&(a=document.getElementById(a));a.addEventListener("click",c,!0);a.addEventListener("touchend",c,!0)}
function Bd(){if(!ud){window.GoogleAnalyticsObject="GoogleAnalyticsFunction";var a=function(d){(a.q=a.q||[]).push(arguments)};window.GoogleAnalyticsFunction=a;a.l=1*new Date;var c=document.createElement("script");c.async=1;c.src="//www.google-analytics.com/analytics.js";document.head.appendChild(c);a("create","UA-50448074-1","auto");a("send","pageview")}};g.g.A={};g.g.A.Ta=function(a,c){return" "+a+","+c+" "};g.g.A.curve=function(a,c){return" "+a+c.join("")};g.g.A.moveTo=function(a,c){return" M "+a+","+c+" "};g.g.A.moveBy=function(a,c){return" m "+a+","+c+" "};g.g.A.lineTo=function(a,c){return" l "+a+","+c+" "};g.g.A.line=function(a){return" l"+a.join("")};g.g.A.ba=function(a,c){return" "+a+" "+c+" "};g.g.A.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};g.j.ii=function(){this.wf=0;this.vC=3;this.vf=5;this.Uv=8;this.ld=10;this.ow=this.vf;this.wr=15;this.Il=5;this.ih=8;this.gC=15;this.fC=4;this.cC=12;this.jB=16;this.sb=8;this.no=15;this.AC=0;this.BC=20;this.IA=4;this.yC=15;this.zC=100;this.xC=15;this.Uq=24;this.lB=14.5;this.kB=this.wr+11;this.nB=2;this.mB=this.Uq;this.kw=g.g.A.moveBy(0,0);this.HB=12;this.IB=6};b=g.j.ii.prototype;
b.aa=function(){this.Zj=this.Ht();this.bk=this.It();this.og=this.Kt();this.ri=this.Jt();var a=this.sb,c=g.g.A.arc("a","0 0,0",a,g.g.A.Ta(-a,a)),d=g.g.A.arc("a","0 0,0",a,g.g.A.Ta(a,a));this.wl={width:a,height:a,ku:c,Mp:d};c=this.sb;a=g.g.A.moveBy(0,c)+g.g.A.arc("a","0 0,1",c,g.g.A.Ta(c,-c));c=g.g.A.arc("a","0 0,1",c,g.g.A.Ta(-c,-c));this.Zv={Yu:a,Tr:c}};b.Ht=function(){var a=this.HB,c=this.IB,d=g.g.A.line([g.g.A.Ta(6,3),g.g.A.Ta(-12,6),g.g.A.Ta(6,3)]);return{height:a,width:c,path:d}};
b.Kt=function(){var a=this.yC,c=this.zC,d=g.g.A.curve("c",[g.g.A.Ta(30,-a),g.g.A.Ta(70,-a),g.g.A.Ta(c,0)]);return{height:a,width:c,path:d}};b.Jt=function(){function a(h){h=h?-1:1;var k=-h,l=d/2,m=g.g.A.Ta(c,h*l);return g.g.A.curve("c",[g.g.A.Ta(0,h*(l+2.5)),g.g.A.Ta(-c,k*(l+.5)),g.g.A.Ta(-c,h*l)])+g.g.A.curve("s",[g.g.A.Ta(c,2.5*k),m])}var c=this.ih,d=this.wr,e=a(!0),f=a(!1);return{width:c,height:d,He:f,Ym:e}};
b.It=function(){function a(k){return g.g.A.line([g.g.A.Ta(k*e,d),g.g.A.Ta(3*k,0),g.g.A.Ta(k*e,-d)])}var c=this.gC,d=this.fC,e=(c-3)/2,f=a(1),h=a(-1);return{width:c,height:d,Qh:f,Dz:h}};g.j.u={NONE:0,ke:1,Fv:2,Iv:4,pr:8,ov:16,Mv:32,Ev:64,mg:128,Kv:256,lw:512,VA:1024,er:2048,Wq:4096,kC:8192,Bq:16384,Qq:32768,Pq:65536,kr:131072,jr:262144,Qv:524288,mr:1048576,zr:2097152,xq:4194304,Lv:8388608};g.j.u.TI=g.j.u.Qq|g.j.u.Pq;g.j.u.xK=g.j.u.kr|g.j.u.jr;g.j.u.Wt=16777216;g.j.u.Jb=function(){g.j.u.hasOwnProperty(void 0)||(g.j.u[void 0]=g.j.u.Wt,g.j.u.Wt<<=1);return g.j.u[void 0]};g.j.u.Hm=function(a){return a.type&g.j.u.ke};g.j.u.dj=function(a){return a.type&g.j.u.Fv};
g.j.u.Kk=function(a){return a.type&g.j.u.Iv};g.j.u.hf=function(a){return a.type&g.j.u.pr};g.j.u.CL=function(a){return a.type&g.j.u.Mv};g.j.u.gf=function(a){return a.type&g.j.u.mg};g.j.u.Gm=function(a){return a.type&g.j.u.Ev};g.j.u.Eh=function(a){return a.type&g.j.u.Kv};g.j.u.Km=function(a){return a.type&g.j.u.lw};g.j.u.Mk=function(a){return a.type&g.j.u.er};g.j.u.Gh=function(a){return a.type&g.j.u.Wq};g.j.u.qF=function(a){return a.type&(g.j.u.er|g.j.u.Wq)};g.j.u.Fh=function(a){return a.type&g.j.u.Pq};
g.j.u.EL=function(a){return a.type&g.j.u.jr};g.j.u.Jm=function(a){return a.type&g.j.u.Qq};g.j.u.FL=function(a){return a.type&g.j.u.kr};g.j.u.BL=function(a){return a.type&g.j.u.Bq};g.j.u.Sy=function(a){return a.type&g.j.u.Qv};g.j.u.GL=function(a){return a.type&g.j.u.mr};g.j.u.AL=function(a){return a.type&g.j.u.ov};g.j.u.Bp=function(a){return a.type&g.j.u.zr};g.j.u.up=function(a){return a.type&g.j.u.xq};g.j.u.HL=function(a){return a.type&(g.j.u.zr|g.j.u.xq)};g.j.u.DL=function(a){return a.type&g.j.u.Lv};g.j.dh=function(a){this.height=this.width=0;this.type=g.j.u.NONE;this.mh=this.Qa=0;this.C=a;this.Ee=this.C.no};g.j.ra=function(a,c){g.j.ra.w.constructor.call(this,a);this.hs=c;a:switch(a=this.C,c.type){case g.Ua:case g.Re:c=a.ri;break a;case g.Se:case g.Ra:c=a.bk;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=g.j.u.VA};g.g.object.T(g.j.ra,g.j.dh);g.j.cr=function(a,c){g.j.cr.w.constructor.call(this,a,c);this.type|=g.j.u.kC;this.height=this.shape.height;this.width=this.shape.width;this.ue=this.C.Il;this.ce=this.width};g.g.object.T(g.j.cr,g.j.ra);
g.j.gr=function(a,c){g.j.gr.w.constructor.call(this,a,c);this.type|=g.j.u.er;this.height=this.shape.height;this.width=this.shape.width};g.g.object.T(g.j.gr,g.j.ra);g.j.Xq=function(a,c){g.j.Xq.w.constructor.call(this,a,c);this.type|=g.j.u.Wq;this.height=this.shape.height;this.width=this.shape.width};g.g.object.T(g.j.Xq,g.j.ra);g.j.xl=function(a,c){g.j.xl.w.constructor.call(this,a,c.connection);this.type|=g.j.u.mg;this.input=c;this.align=c.align;(this.Hi=c.connection&&C(c.connection)?C(c.connection):null)?(a=J(this.Hi),this.Wl=a.width,this.Mo=a.height):this.Mo=this.Wl=0;this.connection=c.connection;this.ue=0};g.g.object.T(g.j.xl,g.j.ra);
g.j.ah=function(a,c){g.j.ah.w.constructor.call(this,a,c);this.type|=g.j.u.Kv;this.Hi?(this.width=this.Wl,this.height=this.Mo):(this.height=this.C.kB,this.width=this.shape.width+this.C.lB);this.ue=this.C.Il;this.Xl=this.shape.height;this.qh=this.shape.width};g.g.object.T(g.j.ah,g.j.xl);g.j.hh=function(a,c){g.j.hh.w.constructor.call(this,a,c);this.type|=g.j.u.lw;this.height=this.Hi?this.Mo+this.C.AC:this.C.mB;this.width=this.C.no+this.shape.width};g.g.object.T(g.j.hh,g.j.xl);
g.j.bo=function(a,c){g.j.bo.w.constructor.call(this,a,c);this.type|=g.j.u.Ev;this.height=this.Hi?this.Mo-2*this.C.Il:this.shape.height;this.width=this.shape.width+this.C.nB;this.ue=this.C.Il;this.Xl=this.shape.height;this.qh=this.shape.width};g.g.object.T(g.j.bo,g.j.xl);g.j.wd=function(a,c){g.j.wd.w.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=g.j.u.Iv;a=new g.g.qe(g.wd.prototype.to,g.wd.prototype.to-2);this.height=a.height;this.width=a.width};g.g.object.T(g.j.wd,g.j.dh);g.j.Mq=function(a){g.j.Mq.w.constructor.call(this,a);this.type|=g.j.u.Qv;this.height=this.C.Zj.height;this.width=this.C.Zj.width};g.g.object.T(g.j.Mq,g.j.dh);
g.j.Ha=function(a,c){g.j.Ha.w.constructor.call(this,a);this.Lx=c;this.cd=c.uf&&!!c.B&&c.B.cd();this.oE=c.by();this.type|=g.j.u.ke;a=this.Lx.Hg();this.height=a.height;this.width=a.width};g.g.object.T(g.j.Ha,g.j.dh);g.j.Kq=function(a){g.j.Kq.w.constructor.call(this,a);this.type|=g.j.u.Fv;this.height=this.C.og.height;this.width=this.C.og.width;this.kk=this.height};g.g.object.T(g.j.Kq,g.j.dh);
g.j.wo=function(a,c){g.j.wo.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.j.u.kr:g.j.u.Qq)|g.j.u.Bq;this.width=this.height=this.C.wf};g.g.object.T(g.j.wo,g.j.dh);g.j.so=function(a,c){g.j.so.w.constructor.call(this,a);this.type=(c&&"left"!=c?g.j.u.jr:g.j.u.Pq)|g.j.u.Bq;this.width=this.C.sb;this.height=this.C.sb/2};g.g.object.T(g.j.so,g.j.dh);g.j.Xj=function(a,c){g.j.Xj.w.constructor.call(this,a);this.type=this.type|g.j.u.pr|g.j.u.Mv;this.width=c;this.height=this.C.xC};g.g.object.T(g.j.Xj,g.j.dh);g.j.ui=function(a){this.type=g.j.u.mr;this.elements=[];this.Qa=this.Nc=this.cg=this.minWidth=this.minHeight=this.width=this.height=0;this.Cy=this.np=this.ht=this.qd=this.Si=!1;this.C=a;this.Ee=this.C.no};g.j.ui.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function Ed(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.j.u.gf(d))return d;return null}g.j.ui.prototype.Ru=function(){return!0};g.j.ui.prototype.Jx=function(){return!0};
function Fd(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(g.j.u.hf(d))return d;return null}g.j.ik=function(a){g.j.ik.w.constructor.call(this,a);this.type|=g.j.u.zr;this.kk=this.ug=0;this.$E=!1;this.connection=null};g.g.object.T(g.j.ik,g.j.ui);g.j.ik.prototype.jt=function(a){var c=a.Jg?"cap"===a.Jg:g.va.og,d=a.Y&&C(a.Y);return!!a.L||c||(d?t(d)==a:!1)};
g.j.ik.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.j.u.hf(f)||(g.j.u.dj(f)?d=Math.max(d,f.kk):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.ug=this.kk=d;this.cg=this.width};g.j.ik.prototype.Ru=function(){return!1};g.j.Oj=function(a){g.j.Oj.w.constructor.call(this,a);this.type|=g.j.u.xq;this.Dy=!1;this.connection=null;this.Di=this.gm=0};g.g.object.T(g.j.Oj,g.j.ui);
g.j.Oj.prototype.jt=function(a){return!!a.L||!!t(a)};g.j.Oj.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,g.j.u.hf(f)||(g.j.u.Gh(f)?d=Math.max(d,f.height):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.gm=d;this.cg=this.width};g.j.Oj.prototype.Ru=function(){return!1};
g.j.vo=function(a,c,d){g.j.vo.w.constructor.call(this,a);this.type=this.type|g.j.u.pr|g.j.u.ov;this.width=d;this.height=c;this.Tx=!1;this.cg=0;this.elements=[new g.j.Xj(this.C,d)]};g.g.object.T(g.j.vo,g.j.ui);g.j.vo.prototype.measure=function(){};g.j.Yj=function(a){g.j.Yj.w.constructor.call(this,a);this.type|=g.j.u.Lv;this.Zw=0};g.g.object.T(g.j.Yj,g.j.ui);
g.j.Yj.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,c=0,d;d=this.elements[c];c++)this.width+=d.width,g.j.u.gf(d)&&(g.j.u.Km(d)?a+=d.Wl:g.j.u.Gm(d)&&0!=d.Wl&&(a+=d.Wl-d.qh)),g.j.u.hf(d)||(this.height=Math.max(this.height,d.height));this.Zw=a;this.cg=this.width+a};g.j.Yj.prototype.Jx=function(){return!this.Si&&!this.qd};g.j.fh=function(a,c){this.R=c;this.Sg=a;this.C=this.Sg.C;this.L=c.L?new g.j.cr(this.C,c.L):null;this.ut=Fb(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.Ng=c.Ng();this.G=c.G;this.Aj=this.width=this.fl=this.height=0;this.rows=[];this.Hy=[];this.gc=new g.j.ik(this.C);this.Gb=new g.j.Oj(this.C);this.cq=this.ce=0};b=g.j.fh.prototype;
b.measure=function(){var a=this.R.Jg?"cap"===this.R.Jg:g.va.og,c=!!this.R.Y;this.gc.jt(this.R)?this.gc.elements.push(new g.j.wo(this.C)):this.gc.elements.push(new g.j.so(this.C));a?(a=new g.j.Kq(this.C),this.gc.elements.push(a),this.gc.ug=a.kk):c&&(this.gc.$E=!0,this.gc.connection=new g.j.gr(this.C,this.R.Y),this.gc.elements.push(this.gc.connection));this.R.P.length&&this.R.P[0].type==g.Ra&&!this.R.isCollapsed()?this.gc.minHeight=this.C.ld:this.gc.minHeight=this.C.vf;this.rows.push(this.gc);a=new g.j.Yj(this.C);
var d=Lb(this.R);if(d.length){c=0;for(var e;e=d[c];c++){var f=new g.j.wd(this.C,e);this.isCollapsed&&e.Sw?this.Hy.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.R.P[c];c++)if(d.isVisible()){!e||d.type!=g.Ra&&e.type!=g.Ra&&(d.type!=g.Ua&&d.type!=g.jg||this.ut)||(this.rows.push(a),a=new g.j.Yj(this.C));for(e=0;f=d.Na[e];e++)a.elements.push(new g.j.Ha(this.C,f,d));this.Dw(d,a);e=d}this.isCollapsed&&(a.Cy=!0,a.elements.push(new g.j.Mq(this.C)));(a.elements.length||a.np)&&this.rows.push(a);this.Gb.Dy=
!!this.R.V;this.Gb.minHeight=this.R.P.length&&this.R.P[this.R.P.length-1].type==g.Ra?this.C.ld:this.C.vf-1;this.Gb.jt(this.R)?this.Gb.elements.push(new g.j.wo(this.C)):this.Gb.elements.push(new g.j.so(this.C));this.Gb.Dy&&(this.Gb.connection=new g.j.Xq(this.C,this.R.V),this.Gb.elements.push(this.Gb.connection));this.rows.push(this.Gb);for(a=0;c=this.rows[a];a++){d=c.elements;c.elements=[];c.Ru()&&c.elements.push(new g.j.Xj(this.C,this.ep(null,d[0])));for(e=0;e<d.length-1;e++)c.elements.push(d[e]),
c.elements.push(new g.j.Xj(this.C,this.ep(d[e],d[e+1])));c.elements.push(d[d.length-1]);c.Jx()&&c.elements.push(new g.j.Xj(this.C,this.ep(d[d.length-1],null)))}for(e=d=c=a=0;f=this.rows[e];e++)f.measure(),c=Math.max(c,f.width),f.qd&&(a=Math.max(a,f.width-Ed(f).width)),d=Math.max(d,f.cg);this.Aj=a;this.width=c;for(e=0;f=this.rows[e];e++)f.qd&&(f.Aj=this.Aj);this.fl=Math.max(c,d);this.L&&(this.ce=this.L.width,this.width+=this.L.width,this.fl+=this.L.width);for(a=0;c=this.rows[a];a++)c.qd?(d=Ed(c),e=
c.width-d.width,f=this.Aj-this.ce,(e=f-e)&&this.Gr(c,e),e=c.width,f=this.width-this.ce-(this.C.wl.PL||0),d.width+=f-e,c.width+=f-e,c.cg=Math.max(c.width,this.Aj+c.Zw)):(d=this.width-this.ce-c.width)&&this.Gr(c,d);a=this.rows;this.rows=[];for(c=0;c<a.length;c++)this.rows.push(a[c]),c!=a.length-1&&this.rows.push(Gd(this,a[c],a[c+1]));this.Mx()};
b.Dw=function(a,c){this.ut&&a.type==g.Ua?(c.elements.push(new g.j.ah(this.C,a)),c.ht=!0):a.type==g.Ra?(c.elements.push(new g.j.hh(this.C,a)),c.qd=!0):a.type==g.Ua?(c.elements.push(new g.j.bo(this.C,a)),c.Si=!0):a.type==g.jg&&(c.np=!0)};b.ep=function(a,c){if(a&&g.j.u.gf(a)&&!c){if(g.j.u.Gm(a))return this.C.wf;if(g.j.u.Eh(a))return this.C.ld;if(g.j.u.Km(a))return this.C.wf}return a&&g.j.u.Jm(a)&&c&&(g.j.u.Mk(c)||g.j.u.Gh(c))?c.Ee:a&&g.j.u.Fh(a)&&c&&(g.j.u.Mk(c)||g.j.u.Gh(c))?c.Ee-this.C.sb:this.C.vf};
b.Gr=function(a,c){var d=Fd(a);d&&(d.width+=c,a.width+=c)};function Gd(a,c,d){a=new g.j.vo(a.C,a.ny(c,d),a.width-a.ce);c.qd&&(a.Tx=!0);return a}b.ny=function(){return this.C.vf};b.ay=function(a,c){return g.j.u.hf(c)?a.Nc+c.height/2:g.j.u.up(a)?(a=a.Nc+a.height-a.gm,g.j.u.Gh(c)?a+c.height/2:a-c.height/2):g.j.u.Bp(a)?g.j.u.dj(c)?a.ug-c.height/2:a.ug+c.height/2:a.Nc+a.height/2};
function Hd(a,c){for(var d=c.Qa,e=0,f;f=c.elements[e];e++)g.j.u.hf(f)&&(f.height=c.height),f.Qa=d,f.mh=a.ay(c,f),d+=f.width}b.Mx=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++)e.Nc=c,e.Qa=this.ce,c+=e.height,a=Math.max(a,e.cg),Hd(this,e);this.fl=a+this.ce;this.height=c;this.cq=this.gc.ug;this.Gb.Di=c-this.Gb.gm};g.j.$c=function(a,c){this.R=a;this.pa=c;a.Oa();this.tp=this.La="";this.C=c.Sg.C};b=g.j.$c.prototype;b.draw=function(){Id(this);Jd(this);Kd(this);this.R.rj.Hu(this.La+"\n"+this.tp);this.pa.G&&this.R.rj.Os();g.j.In&&this.R.vu.fE(this.R,this.pa);Ld(this)};function Ld(a){a.R.height=a.pa.height;a.R.width=a.pa.fl}function Id(a){for(var c=0,d;d=a.pa.Hy[c];c++)d.icon.Fd.setAttribute("display","none")}
function Jd(a){a.Hs();for(var c=1;c<a.pa.rows.length-1;c++){var d=a.pa.rows[c];d.Cy?a.km(d):d.qd?a.Gs(d):d.Si?a.Is(d):a.Fs(d)}a.Bs();a.Es()}b.Hs=function(){var a=this.pa.gc,c=a.elements,d=this.pa.gc;if(d.connection){var e=d.Qa+d.Ee;Kc(d.connection.hs,this.pa.G?-e:e,0)}this.La+=g.g.A.moveBy(a.Qa,this.pa.cq);for(d=0;e=c[d];d++)g.j.u.Fh(e)?this.La+=this.C.Zv.Yu:g.j.u.Mk(e)?this.La+=e.shape.Qh:g.j.u.dj(e)?this.La+=this.C.og.path:g.j.u.hf(e)&&(this.La+=g.g.A.ba("h",e.width));this.La+=g.g.A.ba("v",a.height)};
b.km=function(a){this.La+=this.C.Zj.path+g.g.A.ba("v",a.height-this.C.Zj.height)};b.Is=function(a){var c=Ed(a);this.Fz(a);var d="function"==typeof c.shape.He?c.shape.He(c.height):c.shape.He;this.La+=g.g.A.ba("H",c.Qa+c.width)+d+g.g.A.ba("v",a.height-c.Xl)};b.Gs=function(a){var c=Ed(a);this.La+=g.g.A.ba("H",c.Qa+c.Ee+c.shape.width)+(c.shape.Dz+g.g.A.ba("h",-(c.Ee-this.C.wl.width))+this.C.wl.ku)+g.g.A.ba("v",a.height-2*this.C.wl.height)+this.C.wl.Mp+g.g.A.ba("H",a.Qa+a.width);this.Iz(a)};
b.Fs=function(a){this.La+=g.g.A.ba("V",a.Nc+a.height)};b.Bs=function(){var a=this.pa.Gb,c=a.elements;this.Hz();this.La+=g.g.A.ba("V",a.Di);for(var d=c.length-1,e;e=c[d];d--)g.j.u.Gh(e)?this.La+=e.shape.Dz:g.j.u.Jm(e)?this.La+=g.g.A.ba("H",a.Qa):g.j.u.Fh(e)?this.La+=this.C.Zv.Tr:g.j.u.hf(e)&&(this.La+=g.g.A.ba("h",-1*e.width))};
b.Es=function(){var a=this.pa.L;if(this.pa.L){var c=this.pa.ce;Kc(this.R.L,this.pa.G?-c:c,this.pa.L.ue)}a&&(c=a.ue+a.height,a="function"==typeof a.shape.Ym?a.shape.Ym(a.height):a.shape.Ym,this.La+=g.g.A.ba("V",c)+a);this.La+="z"};
function Kd(a){for(var c=0,d;d=a.pa.rows[c];c++)for(var e=0,f;f=d.elements[e];e++)if(g.j.u.Eh(f))a.Ds(f);else if(g.j.u.Kk(f)||g.j.u.Hm(f)){var h=a;if(g.j.u.Hm(f))var k=f.Lx.wa();else g.j.u.Kk(f)&&(k=f.icon.Fd);var l=f.mh-f.height/2,m=f.Qa,n="";h.pa.G&&(m=-(m+f.width),f.oE&&(m+=f.width,n="scale(-1 1)"));g.j.u.Kk(f)?(k.setAttribute("display","block"),k.setAttribute("transform","translate("+m+","+l+")"),Ka(f.icon)):k.setAttribute("transform","translate("+m+","+l+")"+n);h.pa.Ng&&k.setAttribute("display",
"none")}}b.Ds=function(a){var c=a.width,d=a.height,e=a.ue,f=a.Xl+e;this.tp+=g.g.A.moveTo(a.Qa+a.qh,a.mh-d/2)+g.g.A.ba("v",e)+a.shape.He+g.g.A.ba("v",d-f)+g.g.A.ba("h",c-a.qh)+g.g.A.ba("v",-d)+"z";this.Gz(a)};b.Gz=function(a){var c=a.mh-a.height/2;if(a.connection){var d=a.Qa+a.qh;this.pa.G&&(d*=-1);Kc(a.connection,d,c+a.ue)}};b.Iz=function(a){var c=Ed(a);if(c.connection){var d=a.Qa+a.Aj+c.Ee;this.pa.G&&(d*=-1);Kc(c.connection,d,a.Nc)}};
b.Fz=function(a){var c=Ed(a);if(c.connection){var d=a.Qa+a.width;this.pa.G&&(d*=-1);Kc(c.connection,d,a.Nc)}};b.Hz=function(){var a=this.pa.Gb;if(a.connection){a=a.connection;var c=a.Qa;Kc(a.hs,this.pa.G?-c:c,a.mh-a.height/2)}};g.xa=function(a,c){this.s=a;this.yp=c;this.Hd=null;this.C=a.Sg.C};g.xa.Yn=5;g.xa.Pj=100;g.xa.pJ=24;g.xa.dL=5;g.xa.uo=10;g.xa.qv=2;g.xa.xB=.75;g.xa.Xn="#cc0a0a";g.xa.YB="#4286f4";g.xa.$A="blocklyCursor";g.xa.XB="blocklyMarker";b=g.xa.prototype;b.em=null;b.wa=function(){return this.H};
b.Ga=function(){this.H=g.g.o.K("g",{"class":this.yp?g.xa.XB:g.xa.$A},null);var a=this.yp?g.xa.YB:g.xa.Xn;this.Sc=g.g.o.K("g",{width:g.xa.Pj,height:g.xa.Yn},this.H);this.tk=g.g.o.K("rect",{x:"0",y:"0",fill:a,width:g.xa.Pj,height:g.xa.Yn,style:"display: none;"},this.Sc);this.vk=g.g.o.K("rect",{"class":"blocklyVerticalCursor",x:"0",y:"0",rx:"10",ry:"10",style:"display: none;",stroke:a},this.Sc);this.fm=g.g.o.K("path",{width:g.xa.Pj,height:g.xa.Yn,transform:"",style:"display: none;",fill:a},this.Sc);
this.Mi=g.g.o.K("path",{width:g.xa.Pj,height:g.xa.Yn,transform:"",style:"display: none;",fill:"none",stroke:a,"stroke-width":"4"},this.Sc);this.yp||(g.g.o.K("animate",{attributeType:"XML",attributeName:"fill",dur:"1s",values:g.xa.Xn+";transparent;transparent;",repeatCount:"indefinite"},this.tk),g.g.o.K("animate",{attributeType:"XML",attributeName:"fill",dur:"1s",values:g.xa.Xn+";transparent;transparent;",repeatCount:"indefinite"},this.fm),g.g.o.K("animate",{attributeType:"XML",attributeName:"stroke",
dur:"1s",values:g.xa.Xn+";transparent;transparent;",repeatCount:"indefinite"},this.Mi));return this.H};function Md(a,c){a.yp?(a.Hd&&a.Hd.nn(null),c.nn(a.wa())):(a.Hd&&a.Hd.mn(null),c.mn(a.wa()));a.Hd=c}
function Nd(a,c){if(c){var d=c.width,e=c.height,f=e*g.xa.xB;c.Y?(e=g.xa.qv,d=g.g.A.moveBy(-1*e,f)+g.g.A.ba("V",-1*e)+g.g.A.ba("H",a.C.no)+a.C.bk.Qh+g.g.A.ba("H",d+2*e)+g.g.A.ba("V",f),a.Mi.setAttribute("d",d)):c.L?(d=g.g.A.moveBy(d,0)+g.g.A.ba("h",-1*(d-a.C.ri.width))+g.g.A.ba("v",a.C.Il)+a.C.ri.He+g.g.A.ba("V",e)+g.g.A.ba("H",d),a.Mi.setAttribute("d",d)):(e=g.xa.qv,d=g.g.A.moveBy(-1*e,f)+g.g.A.ba("V",-1*e)+g.g.A.ba("H",d+2*e)+g.g.A.ba("V",f),a.Mi.setAttribute("d",d));a.s.G&&a.nm(a.Mi);a.em=a.Mi;
Md(a,c);Od(a)}}function Od(a){a.ya();a.em.style.display=""}function Pd(a,c,d,e){a.tk.setAttribute("x",c);a.tk.setAttribute("y",d);a.tk.setAttribute("width",e);a.em=a.tk}function Qd(a,c,d,e,f){a.vk.setAttribute("x",c);a.vk.setAttribute("y",d);a.vk.setAttribute("width",e);a.vk.setAttribute("height",f);a.em=a.vk}b.nm=function(a){a.setAttribute("transform","scale(-1 1)")};b.ya=function(){this.tk.style.display="none";this.vk.style.display="none";this.fm.style.display="none";this.Mi.style.display="none"};
b.draw=function(a){if(a)if(a.Jb()===g.F.types.Nd)Nd(this,a.qa);else if(a.Jb()===g.F.types.fk)Nd(this,a.qa.B);else if(a.qa.type===g.Ua){var c=a.qa;a=c.B;var d=c.oj.x;c=c.oj.y;var e=g.g.A.moveTo(0,0)+this.C.ri.He;this.fm.setAttribute("d",e);this.fm.setAttribute("transform","translate("+d+","+c+")"+(this.s.G?" scale(-1 1)":""));this.em=this.fm;Md(this,a);Od(this)}else if(a.qa.type===g.Ra)c=a.qa,a=c.B,d=0,c=c.oj.y,e=J(a).width,this.s.G&&(d=-e),Pd(this,d,c,e),Md(this,a),Od(this);else if(a.Jb()===g.F.types.pe)Nd(this,
a.qa.B);else if(a.Jb()===g.F.types.ke)a=a.qa,d=a.Hg().width,c=a.Hg().height,Qd(this,0,0,d,c),Md(this,a),Od(this);else if(a.Jb()===g.F.types.Ci)d=a.vA,a=d.x,d=d.y,this.s.G&&(a-=g.xa.Pj),Pd(this,a,d,g.xa.Pj),Md(this,this.s),Od(this);else{if(a.Jb()===g.F.types.xf){a=a.qa;c=J(a);d=c.width+g.xa.uo;c=c.height+g.xa.uo;var f=e=-1*g.xa.uo/2,h=-1*g.xa.uo/2;this.s.G&&(f=-(d+e));Qd(this,f,h,d,c);Md(this,a);Od(this)}}else this.ya()};b.I=function(){this.H&&g.g.o.removeNode(this.H)};g.j.gh=function(){this.C=null};b=g.j.gh.prototype;b.aa=function(){this.C=this.az();this.C.aa()};b.az=function(){return new g.j.ii};b.dz=function(a){return new g.j.fh(this,a)};b.bz=function(a,c){return new g.j.$c(a,c)};b.cz=function(a){return new g.j.si(a)};b.za=function(a){if(g.j.In&&!a.vu){if(!g.j.iB)throw Error("Missing require for Blockly.blockRendering.Debug");var c=new g.j.iB;a.vu=c}c=this.dz(a);c.measure();this.bz(a,c).draw()};g.ma={};g.ma.ii=function(){g.ma.ii.w.constructor.call(this);this.jd=1};g.g.object.T(g.ma.ii,g.j.ii);g.ma.Hv=function(a){this.pa=a;this.Cm=this.ea="";this.Pc=this.pa.G;a=a.Sg;this.C=a.C;this.df=a.df;this.rd=this.df.ck;this.gu=this.df.lC;this.Jk=this.df.EB;this.cn=this.df.ri;this.PF=this.df.bk;this.MG=this.df.og;this.Uy=this.df.Zj};g.ma.Hv.prototype.km=function(a){this.pa.G&&(this.ea+=g.g.A.ba("H",a.width-this.rd),this.ea+=this.Uy.Qh,this.ea+=g.g.A.ba("v",a.height-this.Uy.height-this.rd))};
function Rd(a,c){var d=c.Qa+c.width-a.rd;c.Tx&&(a.ea+=g.g.A.ba("H",d));a.Pc&&(a.ea+=g.g.A.ba("H",d),c.height>a.rd&&(a.ea+=g.g.A.ba("V",c.Nc+c.height-a.rd)))};g.ma.si=function(a){this.Cj=a;this.xn=g.g.o.K("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Cj);this.Zk=g.g.o.K("path",{"class":"blocklyPath"},this.Cj);this.zn=g.g.o.K("path",{"class":"blocklyPathLight"},this.Cj)};g.ma.si.prototype.Hu=function(a,c){this.Zk.setAttribute("d",a);this.xn.setAttribute("d",a);this.zn.setAttribute("d",c)};
g.ma.si.prototype.Os=function(){this.Zk.setAttribute("transform","scale(-1 1)");this.zn.setAttribute("transform","scale(-1 1)");this.xn.setAttribute("transform","translate(1,1) scale(-1 1)")};g.ma.ah=function(a,c){g.ma.ah.w.constructor.call(this,a,c);this.Hi&&(this.width+=this.C.jd,this.height+=this.C.jd)};g.g.object.T(g.ma.ah,g.j.ah);g.ma.hh=function(a,c){g.ma.hh.w.constructor.call(this,a,c);this.Hi&&(this.height+=this.C.jd)};g.g.object.T(g.ma.hh,g.j.hh);g.ma.fh=function(a,c){g.ma.fh.w.constructor.call(this,a,c)};g.g.object.T(g.ma.fh,g.j.fh);b=g.ma.fh.prototype;b.Dw=function(a,c){this.ut&&a.type==g.Ua?(c.elements.push(new g.ma.ah(this.C,a)),c.ht=!0):a.type==g.Ra?(c.elements.push(new g.ma.hh(this.C,a)),c.qd=!0):a.type==g.Ua?(c.elements.push(new g.j.bo(this.C,a)),c.Si=!0):a.type==g.jg&&(c.np=!0)};
b.ep=function(a,c){if(!a)return c&&g.j.u.Hm(c)&&c.cd?this.C.vf:c&&g.j.u.Eh(c)?this.C.Uv:c&&g.j.u.Km(c)?this.C.BC:this.C.ld;if(!g.j.u.gf(a)&&!c)return g.j.u.Hm(a)&&a.cd?this.C.vf:g.j.u.Kk(a)?2*this.C.ld+1:g.j.u.dj(a)?this.C.wf:g.j.u.qF(a)?this.C.ld:g.j.u.Fh(a)?this.C.cC:g.j.u.Sy(a)?this.C.wf:this.C.ld;if(g.j.u.gf(a)&&!c){if(g.j.u.Gm(a))return this.C.wf;if(g.j.u.Eh(a))return this.C.ld;if(g.j.u.Km(a))return this.C.wf}if(!g.j.u.gf(a)&&c&&g.j.u.gf(c)){if(a.cd){if(g.j.u.Eh(c)||g.j.u.Gm(c))return this.C.vC}else{if(g.j.u.Eh(c)||
g.j.u.Gm(c))return this.C.Uv;if(g.j.u.Km(c))return this.C.ld}return this.C.ld-1}if(g.j.u.Kk(a)&&c&&!g.j.u.gf(c))return this.C.ld;if(g.j.u.Eh(a)&&c&&!g.j.u.gf(c))return c.cd?this.C.vf:this.C.ld;if(g.j.u.Jm(a)&&c){if(g.j.u.dj(c))return this.C.wf;if(g.j.u.Mk(c))return c.Ee;if(g.j.u.Gh(c))return a=(this.G?1:-1)*this.C.jd/2,c.Ee+a}if(g.j.u.Fh(a)&&c){if(g.j.u.Mk(c))return c.Ee-this.C.sb;if(g.j.u.Gh(c))return a=(this.G?1:-1)*this.C.jd/2,c.Ee-this.C.sb+a}return!g.j.u.gf(a)&&c&&!g.j.u.gf(c)&&a.cd==c.cd||c&&
g.j.u.Sy(c)?this.C.ld:this.C.vf};b.Gr=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(g.j.u.hf(e)){d=e;break a}d=null}e=Fd(a);if(a.Si||a.qd)a.cg+=c;var f=Ed(a);f?f.align==g.uq?e.width+=c:f.align==g.iv?(d.width+=c/2,e.width+=c/2):f.align==g.Ln&&(d.width+=c):e.width+=c;a.width+=c};b.ny=function(a,c){return g.j.u.Bp(a)&&g.j.u.up(c)?this.C.jB:g.j.u.Bp(a)||g.j.u.up(c)?this.C.wf:a.Si&&c.Si?this.C.ld:!a.qd&&c.qd?this.C.IA:a.qd&&c.qd||!a.qd&&c.np?this.C.ld:this.C.vf};
b.ay=function(a,c){if(g.j.u.hf(c))return a.Nc+c.height/2;if(g.j.u.up(a))return a=a.Nc+a.height-a.gm,g.j.u.Gh(c)?a+c.height/2:a-c.height/2;if(g.j.u.Bp(a))return g.j.u.dj(c)?a.ug-c.height/2:a.ug+c.height/2;var d=a.Nc;g.j.u.Hm(c)||g.j.u.Kk(c)?(d+=c.height/2,(a.ht||a.qd)&&c.height+this.C.ow<=a.height&&(d+=this.C.ow)):d=g.j.u.Eh(c)?d+c.height/2:d+a.height/2;return d};
b.Mx=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.Nc=c;e.Qa=this.ce;c+=e.height;a=Math.max(a,e.cg);var f=c-this.gc.kk;e==this.Gb&&f<this.C.Uq&&(f=this.C.Uq-f,this.Gb.height+=f,c+=f);Hd(this,e)}this.Gb.Di=c-this.Gb.gm;this.fl=a+this.ce+this.C.jd;this.width+=this.C.jd;this.height=c+this.C.jd;this.cq=this.gc.ug};g.ma.$c=function(a,c){g.ma.$c.w.constructor.call(this,a,c);this.Nf=new g.ma.Hv(c)};g.g.object.T(g.ma.$c,g.j.$c);b=g.ma.$c.prototype;b.draw=function(){Id(this);Jd(this);Kd(this);var a=this.Nf;this.R.rj.Hu(this.La+"\n"+this.tp,a.ea+"\n"+a.Cm);this.pa.G&&this.R.rj.Os();g.j.In&&this.R.vu.fE(this.R,this.pa);Ld(this)};
b.Hs=function(){var a=this.Nf,c=this.pa.gc;a.ea+=g.g.A.moveBy(c.Qa,a.pa.cq);for(var d=0,e;e=c.elements[d];d++)g.j.u.Jm(e)?a.ea+=a.df.kw:g.j.u.Fh(e)?a.ea+=a.gu.Yu(a.Pc):g.j.u.Mk(e)?a.ea+=a.PF.Qh:g.j.u.dj(e)?a.ea+=a.MG.path(a.Pc):g.j.u.hf(e)&&0!=e.width&&(a.ea+=g.g.A.ba("H",e.Qa+e.width-a.rd));a.ea+=g.g.A.ba("H",c.Qa+c.width-a.rd);Rd(this.Nf,this.pa.gc);g.ma.$c.w.Hs.call(this)};b.km=function(a){this.Nf.km(a);g.ma.$c.w.km.call(this,a)};
b.Is=function(a){var c=this.Nf,d=Ed(a);if(c.Pc){var e=a.height-d.Xl;c.ea+=g.g.A.moveTo(d.Qa+d.width-c.rd,a.Nc)+c.cn.He(c.Pc)+g.g.A.ba("v",e)}else c.ea+=g.g.A.moveTo(d.Qa+d.width,a.Nc)+c.cn.He(c.Pc);g.ma.$c.w.Is.call(this,a)};
b.Gs=function(a){var c=this.Nf,d=Ed(a);if(c.Pc){var e=a.height-2*c.Jk.height;c.ea+=g.g.A.moveTo(d.Qa,a.Nc)+c.Jk.ku(c.Pc)+g.g.A.ba("v",e)+c.Jk.Mp(c.Pc)+g.g.A.lineTo(a.width-d.Qa-c.Jk.width,0)}else c.ea+=g.g.A.moveTo(d.Qa,a.Nc+a.height)+c.Jk.Mp(c.Pc)+g.g.A.lineTo(a.width-d.Qa-c.Jk.width,0);g.ma.$c.w.Gs.call(this,a)};b.Fs=function(a){Rd(this.Nf,a);g.ma.$c.w.Fs.call(this,a)};
b.Bs=function(){var a=this.Nf,c=this.pa.Gb;if(a.Pc)a.ea+=g.g.A.ba("V",c.Di-a.rd);else{var d=a.pa.Gb.elements[0];g.j.u.Jm(d)?a.ea+=g.g.A.moveTo(c.Qa+a.rd,c.Di-a.rd):g.j.u.Fh(d)&&(a.ea+=g.g.A.moveTo(c.Qa,c.Di),a.ea+=a.gu.Tr())}g.ma.$c.w.Bs.call(this)};
b.Es=function(){var a=this.Nf,c=a.pa.L;c&&(c=c.ue+c.height,a.Pc?a.ea+=g.g.A.moveTo(a.pa.ce,c):(a.ea+=g.g.A.moveTo(a.pa.ce+a.rd,a.pa.Gb.Di-a.rd),a.ea+=g.g.A.ba("V",c)),a.ea+=a.cn.Ym(a.Pc));a.Pc||(c=a.pa.gc,a.ea=g.j.u.Fh(c.elements[0])?a.ea+g.g.A.ba("V",a.gu.height):a.ea+g.g.A.ba("V",c.ug+a.rd));g.ma.$c.w.Es.call(this)};
b.Ds=function(a){var c=this.Nf,d=c.rd,e=a.Qa+a.qh,f=a.mh-a.height/2,h=a.width-a.qh,k=f+d;if(c.Pc){f=a.ue-d;var l=a.height-(a.ue+a.Xl)+d;c.Cm+=g.g.A.moveTo(e-d,k)+g.g.A.ba("v",f)+c.cn.He(c.Pc)+g.g.A.ba("v",l)+g.g.A.ba("h",h)}else c.Cm+=g.g.A.moveTo(a.Qa+a.width+d,k)+g.g.A.ba("v",a.height)+g.g.A.ba("h",-h)+g.g.A.moveTo(e,f+a.ue)+c.cn.He(c.Pc);g.ma.$c.w.Ds.call(this,a)};b.Gz=function(a){var c=a.mh-a.height/2;if(a.connection){var d=a.Qa+a.qh+this.C.jd;this.pa.G&&(d*=-1);Kc(a.connection,d,c+a.ue+this.C.jd)}};
b.Iz=function(a){var c=Ed(a);if(c.connection){var d=a.Qa+a.Aj+c.Ee;d=this.pa.G?-1*d:d+this.C.jd;Kc(c.connection,d,a.Nc+this.C.jd)}};b.Fz=function(a){var c=Ed(a);if(c.connection){var d=a.Qa+a.width+this.C.jd;this.pa.G&&(d*=-1);Kc(c.connection,d,a.Nc)}};b.Hz=function(){var a=this.pa.Gb;if(a.connection){a=a.connection;var c=a.Qa;Kc(a.hs,(this.pa.G?-c:c)+this.C.jd/2,a.mh-a.height/2+this.C.jd)}};g.ma.ul=function(a){this.rk=a;this.ck=.5;this.kw=g.g.A.moveBy(this.ck,this.ck);this.EB=Sd(this);this.lC=Td(this);this.ri=this.Jt();this.bk=this.It();this.Zj=this.Ht();this.og=this.Kt()};
function Sd(a){var c=a.rk.sb;a=a.ck;var d=(1-Math.SQRT1_2)*(c+a)-a,e=g.g.A.moveBy(d,d)+g.g.A.arc("a","0 0,0",c,g.g.A.Ta(-d-a,c-d)),f=g.g.A.arc("a","0 0,0",c+a,g.g.A.Ta(c+a,c+a)),h=g.g.A.moveBy(d,-d)+g.g.A.arc("a","0 0,0",c+a,g.g.A.Ta(c-d,d+a));return{width:c+a,height:c,ku:function(k){return k?e:""},Mp:function(k){return k?f:h}}}
function Td(a){var c=a.rk.sb;a=a.ck;var d=(1-Math.SQRT1_2)*(c-a)+a,e=g.g.A.moveBy(d,d)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Ta(c-d,-d+a)),f=g.g.A.moveBy(a,c)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Ta(c,-c+a)),h=-d,k=g.g.A.moveBy(d,h)+g.g.A.arc("a","0 0,1",c-a,g.g.A.Ta(-d+a,-h-c));return{height:c,Yu:function(l){return l?e:f},Tr:function(){return k}}}
g.ma.ul.prototype.Jt=function(){var a=this.rk.ih,c=this.rk.wr,d=g.g.A.moveBy(-2,-c+3.4)+g.g.A.lineTo(-.45*a,-2.1),e=g.g.A.ba("v",2.5)+g.g.A.moveBy(.97*-a,2.5)+g.g.A.curve("q",[g.g.A.Ta(.05*-a,10),g.g.A.Ta(.3*a,9.5)])+g.g.A.moveBy(.67*a,-1.9)+g.g.A.ba("v",2.5),f=g.g.A.ba("v",-1.5)+g.g.A.moveBy(-.92*a,-.5)+g.g.A.curve("q",[g.g.A.Ta(-.19*a,-5.5),g.g.A.Ta(0,-11)])+g.g.A.moveBy(.92*a,1),h=g.g.A.moveBy(-5,c-.7)+g.g.A.lineTo(.46*a,-2.1);return{width:a,height:c,Ym:function(k){return k?d:f},He:function(k){return k?
e:h}}};g.ma.ul.prototype.It=function(){return{Qh:g.g.A.ba("h",this.ck)+this.rk.bk.Qh}};g.ma.ul.prototype.Ht=function(){return{Qh:g.g.A.lineTo(5.1,2.6)+g.g.A.moveBy(-10.2,6.8)+g.g.A.lineTo(5.1,2.6)}};g.ma.ul.prototype.Kt=function(){var a=this.rk.og.height,c=g.g.A.moveBy(25,-8.7)+g.g.A.curve("c",[g.g.A.Ta(29.7,-6.2),g.g.A.Ta(57.2,-.5),g.g.A.Ta(75,8.7)]),d=g.g.A.curve("c",[g.g.A.Ta(17.8,-9.2),g.g.A.Ta(45.3,-14.9),g.g.A.Ta(75,-8.7)])+g.g.A.moveTo(100.5,a+.5);return{path:function(e){return e?c:d}}};g.ma.gh=function(){g.ma.gh.w.constructor.call(this);this.df=null};g.g.object.T(g.ma.gh,g.j.gh);b=g.ma.gh.prototype;b.aa=function(){g.ma.gh.w.aa.call(this);this.df=new g.ma.ul(this.C)};b.az=function(){return new g.ma.ii};b.dz=function(a){return new g.ma.fh(this,a)};b.bz=function(a,c){return new g.ma.$c(a,c)};b.cz=function(a){return new g.ma.si(a)};g.j.register("geras",g.ma.gh);g.h.ADD_COMMENT="Adicionar coment\u00e1rio";g.h.CANNOT_DELETE_VARIABLE_PROCEDURE="N\u00e3o se pode deletar a vari\u00e1vel '%1' porque \u00e9 parte da defini\u00e7\u00e3o da fun\u00e7\u00e3o '%2'";g.h.CHANGE_VALUE_TITLE="Mudar valor:";g.h.CLEAN_UP="Limpar blocos";g.h.COLLAPSED_WARNINGS_WARNING="Bloqueios recolhidos cont\u00eam avisos.";g.h.COLLAPSE_ALL="Colapsar Blocos";g.h.COLLAPSE_BLOCK="Colapsar Bloco";g.h.COLOUR_BLEND_COLOUR1="cor 1";g.h.COLOUR_BLEND_COLOUR2="cor 2";g.h.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp";
g.h.COLOUR_BLEND_RATIO="propor\u00e7\u00e3o";g.h.COLOUR_BLEND_TITLE="misturar";g.h.COLOUR_BLEND_TOOLTIP="Mistura duas cores em uma dada propor\u00e7\u00e3o (0,0 - 1,0).";g.h.COLOUR_PICKER_HELPURL="https://pt.wikipedia.org/wiki/Cor";g.h.COLOUR_PICKER_TOOLTIP="Escolher uma cor da palheta de cores.";g.h.COLOUR_RANDOM_HELPURL="http://randomcolour.com";g.h.COLOUR_RANDOM_TITLE="cor aleat\u00f3ria";g.h.COLOUR_RANDOM_TOOLTIP="Escolher cor de forma aleat\u00f3ria.";g.h.COLOUR_RGB_BLUE="azul";
g.h.COLOUR_RGB_GREEN="verde";g.h.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html";g.h.COLOUR_RGB_RED="vermelho";g.h.COLOUR_RGB_TITLE="colorir com";g.h.COLOUR_RGB_TOOLTIP="Criar uma cor com a quantidade especificada de vermelho, verde e azul. Todos os valores devem estar entre 0 e 100.";g.h.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/google/blockly/wiki/Loops#loop-termination-blocks";g.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="encerra o la\u00e7o";
g.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continua com a pr\u00f3xima itera\u00e7\u00e3o do la\u00e7o";g.h.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="Encerra o la\u00e7o.";g.h.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="Ignora o resto deste la\u00e7o, e continua com a pr\u00f3xima itera\u00e7\u00e3o.";g.h.CONTROLS_FLOW_STATEMENTS_WARNING="Aten\u00e7\u00e3o: Este bloco s\u00f3 pode ser usado dentro de um la\u00e7o.";g.h.CONTROLS_FOREACH_HELPURL="https://github.com/google/blockly/wiki/Loops#for-each";
g.h.CONTROLS_FOREACH_TITLE="para cada item %1 na lista %2";g.h.CONTROLS_FOREACH_TOOLTIP="Para cada item em uma lista, atribua o item \u00e0 vari\u00e1vel '%1' e ent\u00e3o realize algumas instru\u00e7\u00f5es.";g.h.CONTROLS_FOR_HELPURL="https://github.com/google/blockly/wiki/Loops#count-with";g.h.CONTROLS_FOR_TITLE="contar com %1 de %2 at\u00e9 %3 por %4";g.h.CONTROLS_FOR_TOOLTIP="Fa\u00e7a com que a vari\u00e1vel '%1' assuma os valores do n\u00famero inicial ao n\u00famero final, contando de acordo com o intervalo especificado e execute os blocos especificados.";
g.h.CONTROLS_IF_ELSEIF_TOOLTIP="Acrescente uma condi\u00e7\u00e3o para o bloco se.";g.h.CONTROLS_IF_ELSE_TOOLTIP="Acrescente uma condi\u00e7\u00e3o final para o bloco se.";g.h.CONTROLS_IF_HELPURL="https://github.com/google/blockly/wiki/IfElse";g.h.CONTROLS_IF_IF_TOOLTIP="Acrescente, remova ou reordene se\u00e7\u00f5es para reconfigurar este bloco.";g.h.CONTROLS_IF_MSG_ELSE="sen\u00e3o";g.h.CONTROLS_IF_MSG_ELSEIF="sen\u00e3o se";g.h.CONTROLS_IF_MSG_IF="se";g.h.CONTROLS_IF_TOOLTIP_1="Se um valor for verdadeiro, ent\u00e3o realize algumas instru\u00e7\u00f5es.";
g.h.CONTROLS_IF_TOOLTIP_2="Se um valor for verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es. Sen\u00e3o, realize o segundo bloco de instru\u00e7\u00f5es.";g.h.CONTROLS_IF_TOOLTIP_3="Se o primeiro valor \u00e9 verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es.  Sen\u00e3o, se o segundo valor \u00e9 verdadeiro, realize o segundo bloco de instru\u00e7\u00f5es.";g.h.CONTROLS_IF_TOOLTIP_4="Se o primeiro valor for verdadeiro, ent\u00e3o realize o primeiro bloco de instru\u00e7\u00f5es. Sen\u00e3o, se o segundo valor \u00e9 verdadeiro, realize o segundo bloco de instru\u00e7\u00f5es. Se nenhum dos blocos for verdadeiro, realize o \u00faltimo bloco de instru\u00e7\u00f5es.";
g.h.CONTROLS_REPEAT_HELPURL="https://pt.wikipedia.org/wiki/Estrutura_de_repeti%C3%A7%C3%A3o#Repeti.C3.A7.C3.A3o_com_vari.C3.A1vel_de_controle";g.h.CONTROLS_REPEAT_INPUT_DO="fa\u00e7a";g.h.CONTROLS_REPEAT_TITLE="repita %1 vezes";g.h.CONTROLS_REPEAT_TOOLTIP="Fa\u00e7a algumas instru\u00e7\u00f5es v\u00e1rias vezes.";g.h.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat";g.h.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="repita at\u00e9";g.h.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="repita enquanto";
g.h.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="Enquanto um valor for falso, ent\u00e3o fa\u00e7a algumas instru\u00e7\u00f5es.";g.h.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="Enquanto um valor for verdadeiro, ent\u00e3o fa\u00e7a algumas instru\u00e7\u00f5es.";g.h.DELETE_ALL_BLOCKS="Deletar todos os blocos %1?";g.h.DELETE_BLOCK="Deletar bloco";g.h.DELETE_VARIABLE="Deletar a vari\u00e1vel '%1'";g.h.DELETE_VARIABLE_CONFIRMATION="Deletar %1 usos da vari\u00e1vel '%2'?";g.h.DELETE_X_BLOCKS="Deletar %1 blocos";
g.h.DISABLE_BLOCK="Desabilitar bloco";g.h.DUPLICATE_BLOCK="Duplicar";g.h.DUPLICATE_COMMENT="Duplicar coment\u00e1rio";g.h.ENABLE_BLOCK="Habilitar bloco";g.h.EXPAND_ALL="Expandir blocos";g.h.EXPAND_BLOCK="Expandir bloco";g.h.EXTERNAL_INPUTS="Entradas externas";g.h.HELP="Ajuda";g.h.INLINE_INPUTS="Entradas incorporadas";g.h.IOS_CANCEL="blockly:IOS Cancelar/pt-br";g.h.IOS_ERROR="Erro";g.h.IOS_OK="Ok";g.h.IOS_PROCEDURES_ADD_INPUT="+ Adicionar Entrada";g.h.IOS_PROCEDURES_ALLOW_STATEMENTS="Permitir declara\u00e7\u00f5es";
g.h.IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR="Essa fun\u00e7\u00e3o tem entradas duplicadas.";g.h.IOS_PROCEDURES_INPUTS="ENTRADAS";g.h.IOS_VARIABLES_ADD_BUTTON="Adicionar";g.h.IOS_VARIABLES_ADD_VARIABLE="+ Adicionar Vari\u00e1vel";g.h.IOS_VARIABLES_DELETE_BUTTON="Deletar";g.h.IOS_VARIABLES_EMPTY_NAME_ERROR="Voc\u00ea n\u00e3o pode usar um nome de vari\u00e1vel vazio.";g.h.IOS_VARIABLES_RENAME_BUTTON="Blockly:Renomear varioas botoens/pt-br";g.h.IOS_VARIABLES_VARIABLE_NAME="Nome variavel";
g.h.LISTS_CREATE_EMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#create-empty-list";g.h.LISTS_CREATE_EMPTY_TITLE="criar lista vazia";g.h.LISTS_CREATE_EMPTY_TOOLTIP="Retorna uma lista, de tamanho 0, contendo nenhum registro";g.h.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="lista";g.h.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="Acrescenta, remove ou reordena se\u00e7\u00f5es para reconfigurar este bloco de lista.";g.h.LISTS_CREATE_WITH_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with";
g.h.LISTS_CREATE_WITH_INPUT_WITH="criar lista com";g.h.LISTS_CREATE_WITH_ITEM_TOOLTIP="Acrescenta um item \u00e0 lista.";g.h.LISTS_CREATE_WITH_TOOLTIP="Cria uma lista com a quantidade de itens informada.";g.h.LISTS_GET_INDEX_FIRST="primeiro";g.h.LISTS_GET_INDEX_FROM_END="n\u00ba a partir do final";g.h.LISTS_GET_INDEX_FROM_START="n\u00ba";g.h.LISTS_GET_INDEX_GET="obter";g.h.LISTS_GET_INDEX_GET_REMOVE="obter e remover";g.h.LISTS_GET_INDEX_LAST="\u00faltimo";g.h.LISTS_GET_INDEX_RANDOM="aleat\u00f3rio";
g.h.LISTS_GET_INDEX_REMOVE="remover";g.h.LISTS_GET_INDEX_TAIL="";g.h.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="Retorna o primeiro item em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_FROM="Retorna o item da lista na posi\u00e7\u00e3o especificada.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_LAST="Retorna o \u00faltimo item em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="Retorna um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="Remove e retorna o primeiro item de uma lista.";
g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="Remove e retorna o item na posi\u00e7\u00e3o especificada em uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="Remove e retorna o \u00faltimo item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="Remove e retorna um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="Remove o primeiro item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="Remove o item na posi\u00e7\u00e3o especificada em uma lista.";
g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="Remove o \u00faltimo item de uma lista.";g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="Remove um item aleat\u00f3rio de uma lista.";g.h.LISTS_GET_SUBLIST_END_FROM_END="at\u00e9 n\u00ba a partir do final";g.h.LISTS_GET_SUBLIST_END_FROM_START="at\u00e9 n\u00ba";g.h.LISTS_GET_SUBLIST_END_LAST="at\u00e9 \u00faltimo";g.h.LISTS_GET_SUBLIST_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-a-sublist";g.h.LISTS_GET_SUBLIST_START_FIRST="obt\u00e9m sublista a partir do primeiro";
g.h.LISTS_GET_SUBLIST_START_FROM_END="obt\u00e9m sublista de n\u00ba a partir do final";g.h.LISTS_GET_SUBLIST_START_FROM_START="obt\u00e9m sublista de n\u00ba";g.h.LISTS_GET_SUBLIST_TAIL="";g.h.LISTS_GET_SUBLIST_TOOLTIP="Cria uma c\u00f3pia da por\u00e7\u00e3o especificada de uma lista.";g.h.LISTS_INDEX_FROM_END_TOOLTIP="%1 \u00e9 o \u00faltimo item.";g.h.LISTS_INDEX_FROM_START_TOOLTIP="%1 \u00e9 o primeiro item.";g.h.LISTS_INDEX_OF_FIRST="encontre a primeira ocorr\u00eancia do item";
g.h.LISTS_INDEX_OF_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list";g.h.LISTS_INDEX_OF_LAST="encontre a \u00faltima ocorr\u00eancia do item";g.h.LISTS_INDEX_OF_TOOLTIP="Retorna o \u00edndice da primeira/\u00faltima ocorr\u00eancia do item na lista.  Retorna %1 se o item n\u00e3o for encontrado.";g.h.LISTS_INLIST="na lista";g.h.LISTS_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#is-empty";g.h.LISTS_ISEMPTY_TITLE="%1 \u00e9 vazia";
g.h.LISTS_ISEMPTY_TOOLTIP="Retorna ao verdadeiro se a lista estiver vazia.";g.h.LISTS_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Lists#length-of";g.h.LISTS_LENGTH_TITLE="tamanho de %1";g.h.LISTS_LENGTH_TOOLTIP="Retorna o tamanho de uma lista.";g.h.LISTS_REPEAT_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with";g.h.LISTS_REPEAT_TITLE="criar lista com item %1 repetido %2 vezes";g.h.LISTS_REPEAT_TOOLTIP="Cria uma lista consistindo no valor informado repetido o n\u00famero de vezes especificado.";
g.h.LISTS_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Listas#invertendo-uma-lista";g.h.LISTS_REVERSE_MESSAGE0="inverter %1";g.h.LISTS_REVERSE_TOOLTIP="Inverter uma c\u00f3pia da lista.";g.h.LISTS_SET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#in-list--set";g.h.LISTS_SET_INDEX_INPUT_TO="como";g.h.LISTS_SET_INDEX_INSERT="inserir em";g.h.LISTS_SET_INDEX_SET="definir";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="Insere o item no in\u00edcio de uma lista.";
g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="Insere o item na posi\u00e7\u00e3o especificada em uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="Insere o item no final de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="Insere o item em uma posi\u00e7\u00e3o qualquer de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="Define o primeiro item de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_FROM="Define o item da posi\u00e7\u00e3o especificada de uma lista.";
g.h.LISTS_SET_INDEX_TOOLTIP_SET_LAST="Define o \u00faltimo item de uma lista.";g.h.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="Define um item aleat\u00f3rio de uma lista.";g.h.LISTS_SORT_HELPURL="https://github.com/google/blockly/wiki/Lists#sorting-a-list";g.h.LISTS_SORT_ORDER_ASCENDING="ascendente";g.h.LISTS_SORT_ORDER_DESCENDING="descendente";g.h.LISTS_SORT_TITLE="ordenar %1 %2 %3";g.h.LISTS_SORT_TOOLTIP="Ordenar uma c\u00f3pia de uma lista.";g.h.LISTS_SORT_TYPE_IGNORECASE="alfab\u00e9tico, ignorar mai\u00fascula/min\u00fascula";
g.h.LISTS_SORT_TYPE_NUMERIC="num\u00e9rico";g.h.LISTS_SORT_TYPE_TEXT="alfab\u00e9tico";g.h.LISTS_SPLIT_HELPURL="https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists";g.h.LISTS_SPLIT_LIST_FROM_TEXT="Fazer uma lista a partir do texto";g.h.LISTS_SPLIT_TEXT_FROM_LIST="fazer um texto a partir da lista";g.h.LISTS_SPLIT_TOOLTIP_JOIN="Juntar uma lista de textos em um \u00fanico texto, separado por um delimitador.";g.h.LISTS_SPLIT_TOOLTIP_SPLIT="Dividir o texto em uma lista de textos, separando-o em cada delimitador.";
g.h.LISTS_SPLIT_WITH_DELIMITER="com delimitador";g.h.LOGIC_BOOLEAN_FALSE="falso";g.h.LOGIC_BOOLEAN_HELPURL="https://github.com/google/blockly/wiki/Logic#values";g.h.LOGIC_BOOLEAN_TOOLTIP="Retorna verdadeiro ou falso.";g.h.LOGIC_BOOLEAN_TRUE="verdadeiro";g.h.LOGIC_COMPARE_HELPURL="https://pt.wikipedia.org/wiki/Inequa%C3%A7%C3%A3o";g.h.LOGIC_COMPARE_TOOLTIP_EQ="Retorna verdadeiro se ambas as entradas forem iguais.";g.h.LOGIC_COMPARE_TOOLTIP_GT="Retorna verdadeiro se a primeira entrada for maior que a segunda entrada.";
g.h.LOGIC_COMPARE_TOOLTIP_GTE="Retorna verdadeiro se a primeira entrada for maior ou igual \u00e0 segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_LT="Retorna verdadeiro se a primeira entrada for menor que a segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_LTE="Retorna verdadeiro se a primeira entrada for menor ou igual \u00e0 segunda entrada.";g.h.LOGIC_COMPARE_TOOLTIP_NEQ="Retorna verdadeiro se ambas as entradas forem diferentes.";g.h.LOGIC_NEGATE_HELPURL="https://github.com/google/blockly/wiki/Logic#not";
g.h.LOGIC_NEGATE_TITLE="n\u00e3o %1";g.h.LOGIC_NEGATE_TOOLTIP="Retorna verdadeiro se a entrada for falsa.  Retorna falsa se a entrada for verdadeira.";g.h.LOGIC_NULL="nulo";g.h.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type";g.h.LOGIC_NULL_TOOLTIP="Retorna nulo.";g.h.LOGIC_OPERATION_AND="e";g.h.LOGIC_OPERATION_HELPURL="https://github.com/google/blockly/wiki/Logic#logical-operations";g.h.LOGIC_OPERATION_OR="ou";g.h.LOGIC_OPERATION_TOOLTIP_AND="Retorna verdadeiro se ambas as entradas forem verdadeiras.";
g.h.LOGIC_OPERATION_TOOLTIP_OR="Retorna verdadeiro se uma das estradas for verdadeira.";g.h.LOGIC_TERNARY_CONDITION="teste";g.h.LOGIC_TERNARY_HELPURL="https://en.wikipedia.org/wiki/%3F:";g.h.LOGIC_TERNARY_IF_FALSE="se falso";g.h.LOGIC_TERNARY_IF_TRUE="se verdadeiro";g.h.LOGIC_TERNARY_TOOLTIP='Avalia a condi\u00e7\u00e3o em "teste". Se a condi\u00e7\u00e3o for verdadeira retorna o valor "se verdadeiro", sen\u00e3o retorna o valor "se falso".';g.h.MATH_ADDITION_SYMBOL="+";
g.h.MATH_ARITHMETIC_HELPURL="https://pt.wikipedia.org/wiki/Aritm%C3%A9tica";g.h.MATH_ARITHMETIC_TOOLTIP_ADD="Retorna a soma dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_DIVIDE="Retorna o quociente da divis\u00e3o dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_MINUS="Retorna a diferen\u00e7a entre os dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="Retorna o produto dos dois n\u00fameros.";g.h.MATH_ARITHMETIC_TOOLTIP_POWER="Retorna o primeiro n\u00famero elevado \u00e0 pot\u00eancia do segundo n\u00famero.";
g.h.MATH_ATAN2_HELPURL="https://en.wikipedia.org/wiki/Atan2";g.h.MATH_ATAN2_TITLE="atan2 de X:%1 Y:%2";g.h.MATH_ATAN2_TOOLTIP="Retorne o arco tangente do ponto (X, Y) em graus de -180 a 180.";g.h.MATH_CHANGE_HELPURL="https://pt.wikipedia.org/wiki/Adi%C3%A7%C3%A3o";g.h.MATH_CHANGE_TITLE="alterar %1 por %2";g.h.MATH_CHANGE_TOOLTIP='Soma um n\u00famero \u00e0 vari\u00e1vel "%1".';g.h.MATH_CONSTANT_HELPURL="https://pt.wikipedia.org/wiki/Anexo:Lista_de_constantes_matem%C3%A1ticas";
g.h.MATH_CONSTANT_TOOLTIP="Retorna uma das constantes comuns: \u03c0 (3.141\u2026), e (2.718\u2026), \u03c6 (1.618\u2026), sqrt(2) (1.414\u2026), sqrt(\u00bd) (0.707\u2026), ou \u221e (infinito).";g.h.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)";g.h.MATH_CONSTRAIN_TITLE="restringe %1 inferior %2 superior %3";g.h.MATH_CONSTRAIN_TOOLTIP="Restringe um n\u00famero entre os limites especificados (inclusivo).";g.h.MATH_DIVISION_SYMBOL="\u00f7";g.h.MATH_IS_DIVISIBLE_BY="\u00e9 divis\u00edvel por";
g.h.MATH_IS_EVEN="\u00e9 par";g.h.MATH_IS_NEGATIVE="\u00e9 negativo";g.h.MATH_IS_ODD="\u00e9 \u00edmpar";g.h.MATH_IS_POSITIVE="\u00e9 positivo";g.h.MATH_IS_PRIME="\u00e9 primo";g.h.MATH_IS_TOOLTIP="Verifica se um n\u00famero \u00e9 par, \u00edmpar, inteiro, positivo, negativo, ou se \u00e9 divis\u00edvel por outro n\u00famero.  Retorna verdadeiro ou falso.";g.h.MATH_IS_WHOLE="\u00e9 inteiro";g.h.MATH_MODULO_HELPURL="https://pt.wikipedia.org/wiki/Opera%C3%A7%C3%A3o_m%C3%B3dulo";
g.h.MATH_MODULO_TITLE="resto da divis\u00e3o de %1 \u00f7 %2";g.h.MATH_MODULO_TOOLTIP="Retorna o resto da divis\u00e3o de dois n\u00fameros.";g.h.MATH_MULTIPLICATION_SYMBOL="\u00d7";g.h.MATH_NUMBER_HELPURL="https://pt.wikipedia.org/wiki/N%C3%BAmero";g.h.MATH_NUMBER_TOOLTIP="Um n\u00famero.";g.h.MATH_ONLIST_HELPURL="";g.h.MATH_ONLIST_OPERATOR_AVERAGE="m\u00e9dia da lista";g.h.MATH_ONLIST_OPERATOR_MAX="maior da lista";g.h.MATH_ONLIST_OPERATOR_MEDIAN="mediana da lista";g.h.MATH_ONLIST_OPERATOR_MIN="menor da lista";
g.h.MATH_ONLIST_OPERATOR_MODE="moda da lista";g.h.MATH_ONLIST_OPERATOR_RANDOM="item aleat\u00f3rio da lista";g.h.MATH_ONLIST_OPERATOR_STD_DEV="desvio padr\u00e3o da lista";g.h.MATH_ONLIST_OPERATOR_SUM="soma de uma lista";g.h.MATH_ONLIST_TOOLTIP_AVERAGE="Retorna a m\u00e9dia aritm\u00e9tica dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_MAX="Retorna o maior n\u00famero da lista.";g.h.MATH_ONLIST_TOOLTIP_MEDIAN="Retorna a mediana dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_MIN="Retorna o menor n\u00famero da lista.";
g.h.MATH_ONLIST_TOOLTIP_MODE="Retorna uma lista do(s) item(ns) mais comum(ns) da lista.";g.h.MATH_ONLIST_TOOLTIP_RANDOM="Retorna um elemento aleat\u00f3rio da lista.";g.h.MATH_ONLIST_TOOLTIP_STD_DEV="Retorna o desvio padr\u00e3o dos n\u00fameros da lista.";g.h.MATH_ONLIST_TOOLTIP_SUM="Retorna a soma de todos os n\u00fameros na lista.";g.h.MATH_POWER_SYMBOL="^";g.h.MATH_RANDOM_FLOAT_HELPURL="https://pt.wikipedia.org/wiki/Gerador_de_n%C3%BAmeros_pseudoaleat%C3%B3rios";
g.h.MATH_RANDOM_FLOAT_TITLE_RANDOM="fra\u00e7\u00e3o aleat\u00f3ria";g.h.MATH_RANDOM_FLOAT_TOOLTIP="Retorna uma fra\u00e7\u00e3o aleat\u00f3ria entre 0.0 (inclusivo) e 1.0 (exclusivo).";g.h.MATH_RANDOM_INT_HELPURL="https://pt.wikipedia.org/wiki/Gerador_de_n%C3%BAmeros_pseudoaleat%C3%B3rios";g.h.MATH_RANDOM_INT_TITLE="inteiro aleat\u00f3rio entre %1 e %2";g.h.MATH_RANDOM_INT_TOOLTIP="Retorna um n\u00famero inteiro entre os dois limites informados, inclusivo.";g.h.MATH_ROUND_HELPURL="https://pt.wikipedia.org/wiki/Arredondamento";
g.h.MATH_ROUND_OPERATOR_ROUND="arredonda";g.h.MATH_ROUND_OPERATOR_ROUNDDOWN="arredonda para baixo";g.h.MATH_ROUND_OPERATOR_ROUNDUP="arredonda para cima";g.h.MATH_ROUND_TOOLTIP="Arredonda um n\u00famero para cima ou para baixo.";g.h.MATH_SINGLE_HELPURL="https://pt.wikipedia.org/wiki/Raiz_quadrada";g.h.MATH_SINGLE_OP_ABSOLUTE="absoluto";g.h.MATH_SINGLE_OP_ROOT="raiz quadrada";g.h.MATH_SINGLE_TOOLTIP_ABS="Retorna o valor absoluto de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_EXP="Retorna o n\u00famero e elevado \u00e0 pot\u00eancia de um n\u00famero.";
g.h.MATH_SINGLE_TOOLTIP_LN="Retorna o logaritmo natural de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_LOG10="Retorna o logaritmo em base 10 de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_NEG="Retorna o oposto de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_POW10="Retorna 10 elevado \u00e0 pot\u00eancia de um n\u00famero.";g.h.MATH_SINGLE_TOOLTIP_ROOT="Retorna a raiz quadrada de um n\u00famero.";g.h.MATH_SUBTRACTION_SYMBOL="-";g.h.MATH_TRIG_ACOS="acos";g.h.MATH_TRIG_ASIN="asin";g.h.MATH_TRIG_ATAN="atan";
g.h.MATH_TRIG_COS="cos";g.h.MATH_TRIG_HELPURL="https://pt.wikipedia.org/wiki/Fun%C3%A7%C3%A3o_trigonom%C3%A9trica";g.h.MATH_TRIG_SIN="sin";g.h.MATH_TRIG_TAN="tan";g.h.MATH_TRIG_TOOLTIP_ACOS="Retorna o arco cosseno de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_ASIN="Retorna o arco seno de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_ATAN="Retorna o arco tangente de um n\u00famero.";g.h.MATH_TRIG_TOOLTIP_COS="Retorna o cosseno de um grau (n\u00e3o radiano).";g.h.MATH_TRIG_TOOLTIP_SIN="Retorna o seno de um grau (n\u00e3o radiano).";
g.h.MATH_TRIG_TOOLTIP_TAN="Retorna a tangente de um grau (n\u00e3o radiano).";g.h.NEW_COLOUR_VARIABLE="Criar vari\u00e1vel colorida...";g.h.NEW_NUMBER_VARIABLE="Criar vari\u00e1vel num\u00e9rica...";g.h.NEW_STRING_VARIABLE="Criar vari\u00e1vel de segmentos de texto...";g.h.NEW_VARIABLE="Criar vari\u00e1vel...";g.h.NEW_VARIABLE_TITLE="Nome da nova vari\u00e1vel:";g.h.NEW_VARIABLE_TYPE_TITLE="Tipo da nova vari\u00e1vel:";g.h.ORDINAL_NUMBER_SUFFIX="";g.h.PROCEDURES_ALLOW_STATEMENTS="permitir declara\u00e7\u00f5es";
g.h.PROCEDURES_BEFORE_PARAMS="com:";g.h.PROCEDURES_CALLNORETURN_HELPURL="https://pt.wikipedia.org/wiki/Sub-rotina";g.h.PROCEDURES_CALLNORETURN_TOOLTIP='Executa a fun\u00e7\u00e3o definida pelo usu\u00e1rio "%1".';g.h.PROCEDURES_CALLRETURN_HELPURL="https://pt.wikipedia.org/wiki/Sub-rotina";g.h.PROCEDURES_CALLRETURN_TOOLTIP='Executa a fun\u00e7\u00e3o definida pelo usu\u00e1rio "%1" e usa seu retorno.';g.h.PROCEDURES_CALL_BEFORE_PARAMS="com:";g.h.PROCEDURES_CREATE_DO='Criar "%1"';
g.h.PROCEDURES_DEFNORETURN_COMMENT="Descreva esta fun\u00e7\u00e3o...";g.h.PROCEDURES_DEFNORETURN_DO="";g.h.PROCEDURES_DEFNORETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine";g.h.PROCEDURES_DEFNORETURN_PROCEDURE="fa\u00e7a algo";g.h.PROCEDURES_DEFNORETURN_TITLE="para";g.h.PROCEDURES_DEFNORETURN_TOOLTIP="Cria uma fun\u00e7\u00e3o que n\u00e3o tem retorno.";g.h.PROCEDURES_DEFRETURN_HELPURL="https://en.wikipedia.org/wiki/Subroutine";g.h.PROCEDURES_DEFRETURN_RETURN="retorna";
g.h.PROCEDURES_DEFRETURN_TOOLTIP="Cria uma fun\u00e7\u00e3o que possui um valor de retorno.";g.h.PROCEDURES_DEF_DUPLICATE_WARNING="Aten\u00e7\u00e3o: Esta fun\u00e7\u00e3o tem par\u00e2metros duplicados.";g.h.PROCEDURES_HIGHLIGHT_DEF="Destacar defini\u00e7\u00e3o da fun\u00e7\u00e3o";g.h.PROCEDURES_IFRETURN_HELPURL="http://c2.com/cgi/wiki?GuardClause";g.h.PROCEDURES_IFRETURN_TOOLTIP="Se um valor \u00e9 verdadeiro, ent\u00e3o retorna um valor.";g.h.PROCEDURES_IFRETURN_WARNING="Aten\u00e7\u00e3o: Este bloco s\u00f3 pode ser utilizado dentro da defini\u00e7\u00e3o de uma fun\u00e7\u00e3o.";
g.h.PROCEDURES_MUTATORARG_TITLE="nome da entrada:";g.h.PROCEDURES_MUTATORARG_TOOLTIP="Adiciona uma entrada para esta fun\u00e7\u00e3o";g.h.PROCEDURES_MUTATORCONTAINER_TITLE="entradas";g.h.PROCEDURES_MUTATORCONTAINER_TOOLTIP="Adiciona, remove, ou reordena as entradas para esta fun\u00e7\u00e3o.";g.h.REDO="Refazer";g.h.REMOVE_COMMENT="Remover coment\u00e1rio";g.h.RENAME_VARIABLE="Renomear vari\u00e1vel...";g.h.RENAME_VARIABLE_TITLE="Renomear todas as vari\u00e1veis '%1' para:";
g.h.TEXT_APPEND_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification";g.h.TEXT_APPEND_TITLE="para %1 anexar texto %2";g.h.TEXT_APPEND_TOOLTIP='Acrescentar um peda\u00e7o de texto \u00e0 vari\u00e1vel "%1".';g.h.TEXT_CHANGECASE_HELPURL="https://github.com/google/blockly/wiki/Text#adjusting-text-case";g.h.TEXT_CHANGECASE_OPERATOR_LOWERCASE="para min\u00fasculas";g.h.TEXT_CHANGECASE_OPERATOR_TITLECASE="para Nomes Pr\u00f3prios";g.h.TEXT_CHANGECASE_OPERATOR_UPPERCASE="para MAI\u00daSCULAS";
g.h.TEXT_CHANGECASE_TOOLTIP="Retorna uma c\u00f3pia do texto em um formato diferente.";g.h.TEXT_CHARAT_FIRST="obter primeira letra";g.h.TEXT_CHARAT_FROM_END="obter letra # a partir do final";g.h.TEXT_CHARAT_FROM_START="obter letra n\u00ba";g.h.TEXT_CHARAT_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-text";g.h.TEXT_CHARAT_LAST="obter \u00faltima letra";g.h.TEXT_CHARAT_RANDOM="obter letra aleat\u00f3ria";g.h.TEXT_CHARAT_TAIL="";g.h.TEXT_CHARAT_TITLE="no texto %1 %2";
g.h.TEXT_CHARAT_TOOLTIP="Retorna a letra na posi\u00e7\u00e3o especificada.";g.h.TEXT_COUNT_HELPURL="https://github.com/google/blockly/wiki/Text#counting-substrings";g.h.TEXT_COUNT_MESSAGE0="Contar %1 em %2";g.h.TEXT_COUNT_TOOLTIP="Calcule quantas vezes algum texto aparece centro de algum outro texto.";g.h.TEXT_CREATE_JOIN_ITEM_TOOLTIP="Acrescentar um item ao texto.";g.h.TEXT_CREATE_JOIN_TITLE_JOIN="unir";g.h.TEXT_CREATE_JOIN_TOOLTIP="Acrescenta, remove ou reordena se\u00e7\u00f5es para reconfigurar este bloco de texto.";
g.h.TEXT_GET_SUBSTRING_END_FROM_END="at\u00e9 letra n\u00ba a partir do final";g.h.TEXT_GET_SUBSTRING_END_FROM_START="at\u00e9 letra n\u00ba";g.h.TEXT_GET_SUBSTRING_END_LAST="at\u00e9 \u00faltima letra";g.h.TEXT_GET_SUBSTRING_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text";g.h.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="no texto";g.h.TEXT_GET_SUBSTRING_START_FIRST="obter trecho de primeira letra";g.h.TEXT_GET_SUBSTRING_START_FROM_END="obter trecho de letra n\u00ba a partir do final";
g.h.TEXT_GET_SUBSTRING_START_FROM_START="obter trecho de letra n\u00ba";g.h.TEXT_GET_SUBSTRING_TAIL="";g.h.TEXT_GET_SUBSTRING_TOOLTIP="Retorna o trecho de texto especificado.";g.h.TEXT_INDEXOF_HELPURL="https://github.com/google/blockly/wiki/Text#finding-text";g.h.TEXT_INDEXOF_OPERATOR_FIRST="encontre a primeira ocorr\u00eancia do item";g.h.TEXT_INDEXOF_OPERATOR_LAST="encontre a \u00faltima ocorr\u00eancia do texto";g.h.TEXT_INDEXOF_TITLE="no texto %1 %2 %3";g.h.TEXT_INDEXOF_TOOLTIP="Retorna a posi\u00e7\u00e3o da primeira/\u00faltima ocorr\u00eancia do primeiro texto no segundo texto.  Retorna %1 se o texto n\u00e3o for encontrado.";
g.h.TEXT_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Text#checking-for-empty-text";g.h.TEXT_ISEMPTY_TITLE="%1 \u00e9 vazio";g.h.TEXT_ISEMPTY_TOOLTIP="Retorna verdadeiro se o texto fornecido for vazio.";g.h.TEXT_JOIN_HELPURL="https://github.com/google/blockly/wiki/Text#text-creation";g.h.TEXT_JOIN_TITLE_CREATEWITH="criar texto com";g.h.TEXT_JOIN_TOOLTIP="Criar um peda\u00e7o de texto juntando qualquer n\u00famero de itens.";g.h.TEXT_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification";
g.h.TEXT_LENGTH_TITLE="tamanho de %1";g.h.TEXT_LENGTH_TOOLTIP="Retorna o n\u00famero de letras (incluindo espa\u00e7os) no texto fornecido.";g.h.TEXT_PRINT_HELPURL="https://github.com/google/blockly/wiki/Text#printing-text";g.h.TEXT_PRINT_TITLE="imprime %1";g.h.TEXT_PRINT_TOOLTIP="Imprime o texto, n\u00famero ou valor especificado.";g.h.TEXT_PROMPT_HELPURL="https://github.com/google/blockly/wiki/Text#getting-input-from-the-user";g.h.TEXT_PROMPT_TOOLTIP_NUMBER="Pede ao usu\u00e1rio um n\u00famero.";
g.h.TEXT_PROMPT_TOOLTIP_TEXT="Pede ao usu\u00e1rio um texto.";g.h.TEXT_PROMPT_TYPE_NUMBER="Pede um n\u00famero com uma mensagem";g.h.TEXT_PROMPT_TYPE_TEXT="Pede um texto com uma mensagem";g.h.TEXT_REPLACE_HELPURL="https://github.com/google/blockly/wiki/Texto#substituindo-substrings";g.h.TEXT_REPLACE_MESSAGE0="substituir %1 por %2 em %3";g.h.TEXT_REPLACE_TOOLTIP="Substitua todas as ocorr\u00eancias de algum texto dentro de algum outro texto.";g.h.TEXT_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Texto#invertendo-texto";
g.h.TEXT_REVERSE_MESSAGE0="inverter %1";g.h.TEXT_REVERSE_TOOLTIP="Inverter a ordem dos caracteres no texto.";g.h.TEXT_TEXT_HELPURL="https://pt.wikipedia.org/wiki/Cadeia_de_caracteres";g.h.TEXT_TEXT_TOOLTIP="Uma letra, palavra ou linha de texto.";g.h.TEXT_TRIM_HELPURL="https://github.com/google/blockly/wiki/Text#trimming-removing-spaces";g.h.TEXT_TRIM_OPERATOR_BOTH="remover espa\u00e7os de ambos os lados de";g.h.TEXT_TRIM_OPERATOR_LEFT="remover espa\u00e7os \u00e0 esquerda de";
g.h.TEXT_TRIM_OPERATOR_RIGHT="remover espa\u00e7os \u00e0 direita de";g.h.TEXT_TRIM_TOOLTIP="Retorna uma c\u00f3pia do texto com os espa\u00e7os removidos de uma ou ambas extremidades.";g.h.TODAY="Hoje";g.h.UNDO="Desfazer";g.h.UNNAMED_KEY="Sem t\u00edtulo";g.h.VARIABLES_DEFAULT_NAME="item";g.h.VARIABLES_GET_CREATE_SET='Criar "definir %1"';g.h.VARIABLES_GET_HELPURL="https://github.com/google/blockly/wiki/Variables#get";g.h.VARIABLES_GET_TOOLTIP="Retorna o valor desta vari\u00e1vel.";
g.h.VARIABLES_SET="definir %1 para %2";g.h.VARIABLES_SET_CREATE_GET='Criar "obter %1"';g.h.VARIABLES_SET_HELPURL="https://github.com/google/blockly/wiki/Variables#set";g.h.VARIABLES_SET_TOOLTIP="Define esta vari\u00e1vel para o valor da entrada.";g.h.VARIABLE_ALREADY_EXISTS="A vari\u00e1vel chamada '%1' j\u00e1 existe.";g.h.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="J\u00e1 existe uma vari\u00e1vel chamada '%1' para outra do tipo: '%2'.";g.h.WORKSPACE_COMMENT_DEFAULT_TEXT="Diz algo...";
g.h.CONTROLS_FOREACH_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_FOR_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=g.h.CONTROLS_IF_MSG_ELSEIF;g.h.CONTROLS_IF_ELSE_TITLE_ELSE=g.h.CONTROLS_IF_MSG_ELSE;g.h.CONTROLS_IF_IF_TITLE_IF=g.h.CONTROLS_IF_MSG_IF;g.h.CONTROLS_IF_MSG_THEN=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.CONTROLS_WHILEUNTIL_INPUT_DO=g.h.CONTROLS_REPEAT_INPUT_DO;g.h.LISTS_CREATE_WITH_ITEM_TITLE=g.h.VARIABLES_DEFAULT_NAME;g.h.LISTS_GET_INDEX_HELPURL=g.h.LISTS_INDEX_OF_HELPURL;
g.h.LISTS_GET_INDEX_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_GET_SUBLIST_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_INDEX_OF_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.LISTS_SET_INDEX_INPUT_IN_LIST=g.h.LISTS_INLIST;g.h.MATH_CHANGE_TITLE_ITEM=g.h.VARIABLES_DEFAULT_NAME;g.h.PROCEDURES_DEFRETURN_COMMENT=g.h.PROCEDURES_DEFNORETURN_COMMENT;g.h.PROCEDURES_DEFRETURN_DO=g.h.PROCEDURES_DEFNORETURN_DO;g.h.PROCEDURES_DEFRETURN_PROCEDURE=g.h.PROCEDURES_DEFNORETURN_PROCEDURE;g.h.PROCEDURES_DEFRETURN_TITLE=g.h.PROCEDURES_DEFNORETURN_TITLE;
g.h.TEXT_APPEND_VARIABLE=g.h.VARIABLES_DEFAULT_NAME;g.h.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=g.h.VARIABLES_DEFAULT_NAME;g.h.MATH_HUE="230";g.h.LOOPS_HUE="120";g.h.LISTS_HUE="260";g.h.LOGIC_HUE="210";g.h.VARIABLES_HUE="330";g.h.TEXTS_HUE="160";g.h.PROCEDURES_HUE="290";g.h.COLOUR_HUE="20";g.h.VARIABLES_DYNAMIC_HUE="310";var R={yk:null,aa:function(){zd();var a=document.getElementById("linkButton");"BlocklyStorage"in window?(BlocklyStorage.HTTPREQUEST_ERROR=P("Games_httpRequestError"),BlocklyStorage.LINK_ALERT=P("Games_linkAlert"),BlocklyStorage.HASH_ERROR=P("Games_hashError"),BlocklyStorage.XML_ERROR=P("Games_xmlError"),BlocklyStorage.alert=Q.gA.bind(Q,a),a&&Dd(a,BlocklyStorage.link)):a&&(a.style.display="none");(a=document.getElementById("languageMenu"))&&a.addEventListener("change",R.nD,!0);g.W&&(g.W.hC=!1);g.m&&
(g.m.hC=!1)},tF:function(a,c){if("BlocklyStorage"in window&&1<window.location.hash.length)BlocklyStorage.retrieveXml(window.location.hash.substring(1));else{var d=null;try{d=window.sessionStorage.$y}catch(h){}d&&delete window.sessionStorage.$y;var e=Ad(O),f=c&&Ad(O-1);f&&"function"==typeof c&&(f=c(f));(a=d||e||f||a)&&R.Wz(a)}},Wz:function(a){R.yk?R.yk.setValue(a,-1):(a=g.O.$h(a),I.clear(),g.O.uh(a,I),a=I,a.Hj.length=0,a.dn.length=0,g.i.vD())},Vs:function(){if(R.yk)var a=R.yk.getValue();else{a=g.O.rA(!0);
if(1==A(I,!1).length&&a.querySelector){var c=a.querySelector("block");c&&(c.removeAttribute("x"),c.removeAttribute("y"))}a=g.O.Dd(a)}return a},Dk:function(){return I},yG:function(){window.localStorage&&(window.localStorage[Cd+O]=R.Vs())},pp:function(){window.location=(ud?"index.html":"./")+"?lang="+sd},nD:function(){if(window.sessionStorage){if(R.yk)var a=R.yk.getValue();else a=g.O.rA(),a=g.O.Dd(a);window.sessionStorage.$y=a}a=document.getElementById("languageMenu");a=encodeURIComponent(a.options[a.selectedIndex].value);
var c=window.location.search;c=1>=c.length?"?lang="+a:c.match(/[?&]lang=[^&]*/)?c.replace(/([?&]lang=)[^&]*/,"$1"+a):c.replace(/\?/,"?lang="+a+"&");window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+c},Ut:function(){10>O?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+sd+"&level="+(O+1):R.pp()},zm:function(a,c){if(a){var d=a.match(/^block_id_([^']+)$/);d&&(a=d[1])}bd(a,c)},ot:function(a,c){a=document.getElementById(a);
a.firstChild||(a=g.Dh(a,{rtl:-1!=rd.indexOf(sd),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),g.O.uh(g.O.$h(c),a))},NG:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},Jf:function(a){if("click"==a.type&&"touchend"==R.Jf.qu&&R.Jf.ou+2E3>Date.now()||R.Jf.qu==a.type&&R.Jf.ou+400>Date.now())return a.preventDefault(),a.stopPropagation(),!0;R.Jf.qu=a.type;R.Jf.ou=Date.now();return!1}};R.Jf.qu=null;R.Jf.ou=0;
R.gF=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};R.hF=function(){var a=document.createElement("link");a.rel="stylesheet";a.type="text/css";a.href="common/prettify.css";document.head.appendChild(a);a=document.createElement("script");a.type="text/javascript";a.src="common/prettify.js";document.head.appendChild(a)};window.BlocklyInterface=R;R.setCode=R.Wz;R.getCode=R.Vs;R.getWorkspace=R.Dk;var Q={bj:!1,ux:null,So:null,xj:function(a,c,d,e,f,h){function k(){Q.bj&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);Q.bj&&Q.Yd(!1);g.ub()&&g.mc(!0);Q.bj=!0;Q.ux=c;Q.So=h;var l=document.getElementById("dialog");h=document.getElementById("dialogShadow");var m=document.getElementById("dialogBorder"),n;for(n in f)l.style[n]=f[n];e&&(h.style.visibility="visible",h.style.opacity=.3,h.style.zIndex=9,e=document.createElement("div"),
e.id="dialogHeader",l.appendChild(e),Q.rs=g.yc(e,"mousedown",null,Q.UD));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(Q.Ep(c,!1,.2),Q.Ep(l,!0,.8),setTimeout(k,175)):k()},vx:0,wx:0,UD:function(a){Q.us();if(!g.g.fj(a)){var c=document.getElementById("dialog");Q.vx=c.offsetLeft-a.clientX;Q.wx=c.offsetTop-a.clientY;Q.ts=g.yc(document,"mouseup",null,Q.us);Q.ss=g.yc(document,"mousemove",null,Q.VD);a.stopPropagation()}},VD:function(a){var c=document.getElementById("dialog"),
d=Q.vx+a.clientX;a=Q.wx+a.clientY;a=Math.max(a,0);a=Math.min(a,window.innerHeight-c.offsetHeight);d=Math.max(d,0);d=Math.min(d,window.innerWidth-c.offsetWidth);c.style.left=d+"px";c.style.top=a+"px"},us:function(){Q.ts&&(g.Xa(Q.ts),Q.ts=null);Q.ss&&(g.Xa(Q.ss),Q.ss=null)},Yd:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(Q.bj){Q.us();Q.rs&&(g.Xa(Q.rs),Q.rs=null);Q.bj=!1;Q.So&&Q.So();Q.So=null;var d=!1===a?
null:Q.ux;a=document.getElementById("dialog");var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(Q.Ep(a,!1,.8),Q.Ep(d,!0,.2),setTimeout(c,175)):c();a.style.visibility="hidden";a.style.zIndex=-1;for((d=document.getElementById("dialogHeader"))&&d.parentNode.removeChild(d);a.firstChild;)d=a.firstChild,d.className+=" dialogHiddenContent",document.body.appendChild(d)}},Ep:function(a,c,d){function e(){f.style.width=h.width+"px";f.style.height=h.height+"px";f.style.left=h.x+"px";f.style.top=
h.y+"px";f.style.opacity=d}if(a){var f=document.getElementById("dialogBorder"),h=Q.tE(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},tE:function(a){var c=g.g.style.hp(a);c={x:c.x,y:c.y};a.getBBox?(a=a.getBBox(),c.height=a.height,c.width=a.width):(c.height=a.offsetHeight,c.width=a.offsetWidth);return c},gA:function(a,c){var d=document.getElementById("containerStorage");d.textContent="";c=c.split("\n");for(var e=0;e<c.length;e++){var f=document.createElement("p");
f.appendChild(document.createTextNode(c[e]));d.appendChild(f)}d=document.getElementById("dialogStorage");Q.xj(d,a,!0,!0,{width:"50%",left:"25%",top:"5em"},Q.eq);Q.bq()},UC:function(){if(!Ad(O))if(Q.bj||I.dc())setTimeout(Q.UC,15E3);else{var a=document.getElementById("dialogAbort"),c=document.getElementById("abortCancel");c.addEventListener("click",Q.Yd,!0);c.addEventListener("touchend",Q.Yd,!0);c=document.getElementById("abortOk");c.addEventListener("click",R.pp,!0);c.addEventListener("touchend",R.pp,
!0);Q.xj(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",Q.Bw,!0)});document.body.addEventListener("keydown",Q.Bw,!0)}},Nu:function(){document.getElementById("galleryXml").value=R.Vs();var a=document.getElementById("galleryDialog");if(!Q.Nu.xG){var c=document.getElementById("galleryCancel");c.addEventListener("click",Q.Yd,!0);c.addEventListener("touchend",Q.Yd,!0);c=document.getElementById("galleryOk");c.addEventListener("click",Q.Rs,!0);c.addEventListener("touchend",
Q.Rs,!0);Q.Nu.xG=!0}c=document.getElementById("submitButton");Q.xj(a,c,!0,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",Q.Ux,!0)});document.body.addEventListener("keydown",Q.Ux,!0);setTimeout(function(){document.getElementById("galleryTitle").focus()},250)},AD:function(){var a=document.getElementById("dialogDone");if(I){var c=document.getElementById("dialogLinesText");c.textContent="";var d=Ud();d=R.NG(d);var e=d.replace(/\/\/[^\n]*/g,"");e=e.replace(/\/\*.*\*\//g,
"");e=e.replace(/[ \t]+\n/g,"\n");e=e.replace(/\n+/g,"\n");e=e.trim();e=e.split("\n").length;var f=document.getElementById("containerCode");f.textContent=d;"function"==typeof prettyPrintOne&&(d=f.innerHTML,d=prettyPrintOne(d,"js"),f.innerHTML=d);d=1==e?P("Games_linesOfCode1"):P("Games_linesOfCode2").replace("%1",String(e));c.appendChild(document.createTextNode(d))}d=10>O?P("Games_nextLevel").replace("%1",String(O+1)):P("Games_finalLevel");c=document.getElementById("doneCancel");c.addEventListener("click",
Q.Yd,!0);c.addEventListener("touchend",Q.Yd,!0);c=document.getElementById("doneOk");c.addEventListener("click",R.Ut,!0);c.addEventListener("touchend",R.Ut,!0);Q.xj(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",Q.Yw,!0)});document.body.addEventListener("keydown",Q.Yw,!0);document.getElementById("dialogDoneText").textContent=d},tx:function(a){!Q.bj||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(Q.Yd(!0),a.stopPropagation(),a.preventDefault())},
bq:function(){document.body.addEventListener("keydown",Q.tx,!0)},eq:function(){document.body.removeEventListener("keydown",Q.tx,!0)},Yw:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)Q.Yd(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&R.Ut()},Bw:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)Q.Yd(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&R.pp()},Ux:function(a){27==a.keyCode?Q.Yd(!0):13==a.keyCode&&Q.Rs()},Rs:function(){var a=document.getElementById("galleryTitle");
if(a.value.trim()){a=document.getElementById("galleryForm");for(var c=[],d=0,e;e=a.elements[d];d++)e.name&&(c[d]=encodeURIComponent(e.name)+"="+encodeURIComponent(e.value));var f=new XMLHttpRequest;f.open("POST",a.action);f.setRequestHeader("Content-type","application/x-www-form-urlencoded");f.onload=function(){if(4==f.readyState){var h=200==f.status?P("Games_submitted"):P("Games_httpRequestError")+"\nStatus: "+f.status;Q.gA(null,h)}};f.send(c.join("&"));Q.Yd(!0)}else a.value="",a.focus()}};
window.BlocklyDialogs=Q;Q.hideDialog=Q.Yd;g.pb=function(a,c,d){this.sn=!0;null==a&&(a="");g.pb.w.constructor.call(this,a,c,d)};g.g.object.T(g.pb,g.Ha);g.pb.sa=function(a){var c=g.g.nc(a.text);return new g.pb(c,void 0,a)};g.pb.prototype.gk=!0;g.pb.qB=11;g.pb.JA=4;b=g.pb.prototype;b.Cq="text";b.Ad=function(a){g.pb.w.Ad.call(this,a);"boolean"==typeof a.spellcheck&&(this.sn=a.spellcheck)};b.Dg=function(a){return null===a||void 0===a?null:String(a)};
b.Ex=function(){if(this.aj){this.wt=!1;var a=this.kb;this.kb=this.Vc.aH;this.B&&g.i.isEnabled()&&g.i.Ka(new g.i.eg(this.B,"field",this.name||null,a,this.kb))}};b.sh=function(a){this.wt=!0;this.kb=a;this.aj||(this.ff=!0)};b.Tf=function(){g.pb.w.Tf.call(this);this.aj&&(this.B.G?setTimeout(this.Vp.bind(this),0):this.Vp(),this.wt?(g.g.o.fc(this.Vc,"blocklyInvalidInput"),g.g.U.Eb(this.Vc,"invalid",!1)):(g.g.o.qb(this.Vc,"blocklyInvalidInput"),g.g.U.Eb(this.Vc,"invalid",!0)))};
function Vd(a){0!=a.sn&&(a.sn=!1,a.Vc&&a.Vc.setAttribute("spellcheck",a.sn))}b.Le=function(a){this.s=this.B.v;a=a||!1;!a&&(g.g.userAgent.dC||g.g.userAgent.jl||g.g.userAgent.Wj)?Wd(this):(g.$.show(this,this.B.G,this.fH.bind(this)),this.Vc=this.bv(),this.aj=!0,a||(this.Vc.focus(),this.Vc.select()))};function Wd(a){g.prompt(g.h.CHANGE_VALUE_TITLE,a.cc(),function(c){a.setValue(c)})}
b.bv=function(){var a=g.$.Ca,c=document.createElement("input");c.className="blocklyHtmlInput";c.setAttribute("spellcheck",this.sn);var d=g.pb.qB*this.s.scale+"pt";a.style.fontSize=d;c.style.fontSize=d;c.style.borderRadius=g.pb.JA*this.s.scale+"px";a.appendChild(c);c.value=c.defaultValue=this.Ws(this.kb);c.aH=this.kb;c.pz=null;g.g.userAgent.Jq?setTimeout(this.Vp.bind(this),0):this.Vp();this.cu=g.ka(c,"keydown",this,this.YF);this.$F=g.ka(c,"input",this,this.XF);return c};
b.fH=function(){this.aj=!1;this.wt=!0;hc(this);this.au&&this.au(this.kb);g.Xa(this.cu);g.Xa(this.$F);var a=g.$.Ca.style;a.width="auto";a.height="auto";a.fontSize=""};b.YF=function(a){a.keyCode==g.g.Ia.Fq?(g.$.ya(),g.D.Ui()):a.keyCode==g.g.Ia.Gq?(this.Vc.value=this.Vc.defaultValue,g.$.ya(),g.D.Ui()):a.keyCode==g.g.Ia.nw&&(g.$.ya(),g.D.Ui(),Rc(this.B,this,!a.shiftKey),a.preventDefault())};
b.XF=function(){var a=this.Vc.value;a!==this.Vc.pz&&(this.Vc.pz=a,g.i.Z(!0),this.setValue(this.ty(a)),hc(this),g.i.Z(!1))};
b.Vp=function(){var a=g.$.Ca;var c=this.Ei.getBBox();var d=c.height*this.B.v.scale;var e=c.width*this.B.v.scale;var f=g.g.style.hp(this.Ei);c=f.y;d=f.y+d;var h=f.x;e=f.x+e;a.style.width=e-h+"px";a.style.height=d-c+"px";c=new g.g.S(this.B.G?e-a.offsetWidth:h,c);c.y+=1;g.g.userAgent.Jq&&g.$.Ca.style.top&&(--c.x,--c.y);g.g.userAgent.Dr&&(c.y-=3);a.style.left=c.x+"px";a.style.top=c.y+"px"};
g.pb.QF=function(a){console.warn("Blockly.FieldTextInput.numberValidator is deprecated. Use Blockly.FieldNumber instead.");if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);return isNaN(a)?null:String(a)};g.pb.LL=function(a){(a=g.pb.QF(a))&&(a=String(Math.max(0,Math.floor(a))));return a};g.pb.prototype.Ty=function(){return!0};g.pb.prototype.Ck=function(){return this.aj&&this.Vc?this.Vc.value:null};g.pb.prototype.Ws=function(a){return String(a)};
g.pb.prototype.ty=function(a){return a};g.Dc.register("field_input",g.pb);function Xd(a){Xd.w.constructor.call(this,a)}g.g.object.T(Xd,g.pb);Xd.sa=function(a){return new Xd(a.pitch)};var Yd="C3 D3 E3 F3 G3 A3 B3 C4 D4 E4 F4 G4 A4".split(/ /);b=Xd.prototype;b.Le=function(){Xd.w.Le.call(this);if(g.$.Ca.firstChild){var a=this.Js();g.D.Yx().appendChild(a);a=pc(this.B);a=a.Ko||a.fs;g.D.mf(this.B.oh,a);g.D.aA(this,this.Ks.bind(this));this.wD=g.yc(this.Vb,"click",this,this.bF);this.IF=g.yc(this.Vb,"mousemove",this,this.dG);Zd(this)}};
b.Js=function(){this.Vb=document.createElement("div");this.Vb.id="notePicker";return this.Vb};b.Ks=function(){g.Xa(this.wD);g.Xa(this.IF)};b.bF=function(){g.$.ya();g.D.Ui()};b.dG=function(a){var c=this.Vb.getBoundingClientRect();a=g.g.td.Gi(Math.round(13.5-(a.clientY-c.top)/7.5),0,12);this.Vb.style.backgroundPosition=37*-a+"px 0";this.ff=!0;this.aj&&(this.Vc.value=this.Ws(a));this.setValue(a)};b.Ck=function(){if(this.aj)var a=Xd.w.Ck.call(this);else a=this.getValue(),a=Yd[Number(a)]||null;return a};
b.Ws=function(a){return Yd[Number(a)]};b.ty=function(a){a=Yd.indexOf(a.trim().toUpperCase());return-1<a?a:void 0};b.Tf=function(){Xd.w.Tf.call(this);Zd(this)};function Zd(a){if(a.Vb){var c=a.getValue();a.Vb.style.backgroundPosition=37*-c+"px 0"}}b.Dg=function(a){return null===a||void 0===a?null:Yd[Number(a)]?a:null};g.Dc.register("field_pitch",Xd);g.Ma=function(a,c,d){"function"!=typeof a&&g.Ma.nA(a);this.jj=a;this.bp=null;this.jn=0;this.Su=this.nu=null;a=this.jj;if(Array.isArray(a)){for(var e=!1,f=0;f<a.length;f++){var h=a[f][0];"string"==typeof h?a[f][0]=g.g.nc(h):(null!=h.alt&&(a[f][0].alt=g.g.nc(h.alt)),e=!0)}if(!(e||2>a.length)){e=[];for(f=0;f<a.length;f++)e.push(a[f][0]);f=g.g.ab.Lu(e);h=g.g.ab.xD(e,f);var k=g.g.ab.yD(e,f);!h&&!k||f<=h+k||(h&&(this.nu=e[0].substring(0,h-1)),k&&(this.Su=e[0].substr(1-k)),this.jj=g.Ma.$C(a,h,k))}}a=this.getOptions(!1)[0];
g.Ma.w.constructor.call(this,a[1],c,d);this.Wk=this.Vb=null};g.g.object.T(g.Ma,g.Ha);g.Ma.sa=function(a){return new g.Ma(a.options,void 0,a)};g.Ma.prototype.gk=!0;g.Ma.CH=25;g.Ma.hJ=.45;g.Ma.Jv=5;g.Ma.CB=2*g.Ma.Jv;g.Ma.mv=g.g.userAgent.jl?"\u25bc":"\u25be";b=g.Ma.prototype;b.Cq="default";
b.Yi=function(){g.Ma.w.Yi.call(this);this.Vb=g.g.o.K("image",{y:g.Ma.Jv},this.we);this.Ve=g.g.o.K("tspan",{},this.tc);this.Ve.appendChild(document.createTextNode(this.B.G?g.Ma.mv+" ":" "+g.Ma.mv));this.B.G?this.tc.insertBefore(this.Ve,this.Ej):this.tc.appendChild(this.Ve)};b.Le=function(){this.Pg=this.Js();this.Pg.za(g.D.Yx());g.g.o.qb(this.Pg.ta(),"blocklyDropdownMenu");g.D.aA(this,this.Ks.bind(this));this.Pg.focus();this.Wk&&g.g.style.Cu(this.Wk.ta(),this.Pg.ta())};
b.Js=function(){var a=new g.mi;bb(a,this.B.G);a.Xf("listbox");var c=this.getOptions(!1);this.Wk=null;for(var d=0;d<c.length;d++){var e=c[d][0],f=c[d][1];if("object"==typeof e){var h=new Image(e.width,e.height);h.src=e.src;h.alt=e.alt||"";e=h}e=new g.mo(e);e.Xf("option");bb(e,this.B.G);e.setValue(f);e.Sl=!0;a.Ol(e,a.fb.length,!0);Ec(e,f==this.kb);f==this.kb&&(this.Wk=e);Fc(e,this.SE,this)}g.g.U.Eb(a.ta(),g.g.U.State.hv,this.Wk?this.Wk.ua():"");return a};b.Ks=function(){this.Pg.I();this.Pg=null};
b.SE=function(a){g.D.ym(this,!0);this.vz(a)};b.vz=function(a){this.setValue(a.getValue())};g.Ma.$C=function(a,c,d){for(var e=[],f=0;f<a.length;f++){var h=a[f][0],k=a[f][1];h=h.substring(c,h.length-d);e[f]=[h,k]}return e};b=g.Ma.prototype;b.getOptions=function(a){return"function"==typeof this.jj?(this.bp&&a||(this.bp=this.jj.call(this),g.Ma.nA(this.bp)),this.bp):this.jj};
b.Dg=function(a){for(var c=!1,d=this.getOptions(!0),e=0,f;f=d[e];e++)if(f[1]==a){c=!0;break}return c?a:(this.B&&console.warn("Cannot set the dropdown's value to an unavailable option. Block type: "+this.B.type+", Field name: "+this.name+", Value: "+a),null)};b.sh=function(a){g.Ma.w.sh.call(this,a);a=this.getOptions(!0);for(var c=0,d;d=a[c];c++)d[1]==this.kb&&(this.jn=c)};b.Ne=function(){this.B&&this.Ve&&(this.Ve.style.fill=this.B.$a?oc(this.B):this.B.oh)};
b.Tf=function(){this.Ej.nodeValue="";this.Vb.style.display="none";var a=this.getOptions(!0),c=0<=this.jn&&a[this.jn][0];if(c&&"object"==typeof c){this.Vb.style.display="";this.Vb.setAttributeNS(g.g.o.Ue,"xlink:href",c.src);this.Vb.setAttribute("height",c.height);this.Vb.setAttribute("width",c.width);a=g.g.o.jp(this.Ve);var d=Number(c.width);this.Lb.height=Number(c.height)+g.Ma.CB;this.Lb.width=d+a+g.Ha.Nl;this.B.G?(c=g.Ha.ji-1,this.Vb.setAttribute("x",g.Ha.ji+a),this.tc.setAttribute("x",c)):(c=d+
a+g.Ha.ji+1,this.tc.setAttribute("text-anchor","end"),this.tc.setAttribute("x",c),this.Vb.setAttribute("x",g.Ha.ji))}else this.Ej.nodeValue=gc(this),this.tc.setAttribute("text-anchor","start"),this.tc.setAttribute("x",g.Ha.ji),this.Lb.height=g.Ha.rv,this.Lb.width=g.g.o.jp(this.tc)+g.Ha.Nl;this.Ei.setAttribute("height",this.Lb.height);this.Ei.setAttribute("width",this.Lb.width)};b.Ck=function(){if(0>this.jn)return null;var a=this.getOptions(!0)[this.jn][0];return"object"==typeof a?a.alt:a};
g.Ma.nA=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");if(!a.length)throw TypeError("FieldDropdown options must not be an empty array.");for(var c=!1,d=0;d<a.length;++d){var e=a[d];Array.isArray(e)?"string"!=typeof e[1]?(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option id must be a string. Found "+e[1]+" in: ",e)):e[0]&&"string"!=typeof e[0]&&"string"!=typeof e[0].src&&(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option must have a string label or image description. Found"+
e[0]+" in: ",e)):(c=!0,console.error("Invalid option["+d+"]: Each FieldDropdown option must be an array. Found: ",e))}if(c)throw TypeError("Found invalid FieldDropdown options.");};g.Ma.prototype.Nh=function(a){if(this.Pg){if(a===g.navigation.tq)return Ac(this.Pg),!0;if(a===g.navigation.rq)return yc(this.Pg),!0}return g.Ma.w.Nh.call(this,a)};g.Dc.register("field_dropdown",g.Ma);g.ic=function(a){g.ic.w.constructor.call(this,null);this.Mz=a};g.g.object.T(g.ic,g.wd);b=g.ic.prototype;b.hl=0;b.Kn=0;
b.Cs=function(a){g.g.o.K("rect",{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);g.g.o.K("path",{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},a);
g.g.o.K("circle",{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};b.mt=function(a){this.R.cd()&&g.wd.prototype.mt.call(this,a)};
b.ks=function(){this.wn=g.g.o.K("svg",{x:g.na.Zc,y:g.na.Zc},null);if(this.Mz.length)for(var a=g.g.xml.createElement("xml"),c=0,d;d=this.Mz[c];c++){var e=g.g.xml.createElement("block");e.setAttribute("type",d);a.appendChild(e)}else a=null;a={disable:!1,Cg:this.R.v.options.Cg,Of:a,Kb:this.R.v,lf:this.R.v.options.lf,G:this.R.G,Da:this.R.G?g.pg:g.zd,Ed:!1,bc:this.EE.bind(this),Xh:null,Rg:this.R.v.options.Rg};this.s=new g.gb(a);this.s.ej=!0;Aa(this.s,g.i.xx);a=ad(this.s,"g");c=this.s.Ga("blocklyMutatorBackground");
c.insertBefore(a,this.s.bb);this.wn.appendChild(c);return this.wn};b.Yg=function(){g.ic.w.Yg.call(this);this.R.Wb||(this.R.cd()?this.Fd&&g.g.o.fc(this.Fd,"blocklyIconGroupReadonly"):(this.Qb(!1),this.Fd&&g.g.o.qb(this.Fd,"blocklyIconGroupReadonly")))};
function $d(a){var c=2*g.na.Zc,d=a.s.bb.getBBox();var e=a.R.G?-d.x:d.width+d.x;d=d.height+3*c;if(a.s.M){var f=a.s.M.um();d=Math.max(d,f.Bd+20)}e+=3*c;if(Math.abs(a.hl-e)>c||Math.abs(a.Kn-d)>c)a.hl=e,a.Kn=d,a.Nb.kn(e+c,d+c),a.wn.setAttribute("width",a.hl),a.wn.setAttribute("height",a.Kn);a.R.G&&a.s.bb.setAttribute("transform","translate("+a.hl+",0)");a.s.resize()}
b.Qb=function(a){if(a!=this.isVisible())if(g.i.Ka(new g.i.od(this.R,"mutatorOpen",!a,a)),a){this.Nb=new g.na(this.R.v,this.ks(),this.R.Kd,this.Wi,null,null);Fa(this.Nb,this.R.id);if(a=this.s.options.Of)this.s.M.aa(this.s),this.s.M.show(a.childNodes);this.Tg=this.R.Bg(this.s);a=p(this.Tg,!1);for(var c=0,d;d=a[c];c++)d.za();this.Tg.$p(!1);this.Tg.Qo=!1;this.s.M?(a=2*this.s.M.sb,c=Ua(this.s).Mf()+a):c=a=16;this.R.G&&(c=-c);this.Tg.moveBy(c,a);if(this.R.Xp){var e=this;this.R.Xp(this.Tg);this.aq=function(){e.R.Xp(e.Tg)};
Aa(this.R.v,this.aq)}$d(this);Aa(this.s,this.gH.bind(this));this.Ne()}else this.wn=null,this.s.I(),this.Tg=this.s=null,this.Nb.I(),this.Nb=null,this.Kn=this.hl=0,this.aq&&(Ba(this.R.v,this.aq),this.aq=null)};
b.gH=function(a){if(a.type!=g.i.xo&&(a.type!=g.i.ei||"disabled"!=a.element)){if(!this.s.dc()){a=A(this.s,!1);for(var c=0,d;d=a[c];c++){var e=d.Oa(),f=J(d);20>e.y+f.height&&d.moveBy(0,20-f.height-e.y)}}if(this.Tg.v==this.s){g.i.Z(!0);d=this.R;a=(a=d.eb())&&g.O.Dd(a);c=d.ca;d.ca=!1;d.yg(this.Tg);d.ca=c;d.Ce();c=(c=d.eb())&&g.O.Dd(c);if(a!=c){g.i.Ka(new g.i.eg(d,"mutation",null,a,c));var h=g.i.Ub();setTimeout(function(){g.i.Z(h);d.Hb();g.i.Z(!1)},g.Pn)}d.ca&&d.za();a!=c&&g.De&&g.navigation.HF(d);this.s.dc()||
$d(this);g.i.Z(!1)}}};b.EE=function(){return{rb:this.Kn,lb:this.hl-Ua(this.s).Mf(),xc:0,jc:this.s.G?0:Ua(this.s).Mf()}};b.I=function(){this.R.Gd=null;g.wd.prototype.I.call(this)};g.ic.Uk=function(a,c,d){if(!a||!a.B.v)return!1;d=E(c,d).connection;var e=C(a);return e&&e!=c||d.ga==a?!1:(d.isConnected()&&d.disconnect(),d.connect(a),!0)};g.ic.Nx=function(a){var c=null;if(a&&a.options){var d=a.options.Kb;a.$d?d&&d.options&&(c=d.options.Kb):d&&(c=d)}return c};g.W.Ft={};g.la={};g.la.VB={};g.la.VB.eo=260;
g.wk([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",
args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",
name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]);
g.W.lists_create_with={aa:function(){this.Ec=g.h.LISTS_CREATE_WITH_HELPURL;L(this,"list_blocks");this.jf=3;this.fe();this.Ke(!0,"Array");this.on(new g.ic(["lists_create_with_item"]));this.vb(g.h.LISTS_CREATE_WITH_TOOLTIP)},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("items",this.jf);return a},Ab:function(a){this.jf=parseInt(a.getAttribute("items"),10);this.fe()},Bg:function(a){var c=a.Lh("lists_create_with_container");c.Ce();for(var d=E(c,"STACK").connection,e=0;e<this.jf;e++){var f=
a.Lh("lists_create_with_item");f.Ce();d.connect(f.Y);d=f.V}return c},yg:function(a){var c=uc(a,"STACK");for(a=[];c;)a.push(c.av),c=c.V&&C(c.V);for(c=0;c<this.jf;c++){var d=E(this,"ADD"+c).connection.ga;d&&-1==a.indexOf(d)&&d.disconnect()}this.jf=a.length;this.fe();for(c=0;c<this.jf;c++)g.ic.Uk(a[c],this,"ADD"+c)},Xp:function(a){a=uc(a,"STACK");for(var c=0;a;){var d=E(this,"ADD"+c);a.av=d&&d.connection.ga;c++;a=a.V&&C(a.V)}},fe:function(){this.jf&&E(this,"EMPTY")?this.Yb("EMPTY"):this.jf||E(this,"EMPTY")||
K(N(this,"EMPTY"),g.h.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a<this.jf;a++)if(!E(this,"ADD"+a)){var c=M(this,"ADD"+a);0==a&&K(c,g.h.LISTS_CREATE_WITH_INPUT_WITH)}for(;E(this,"ADD"+a);)this.Yb("ADD"+a),a++}};g.W.lists_create_with_container={aa:function(){L(this,"list_blocks");K(N(this),g.h.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD);this.Bf(g.Ra,"STACK");this.vb(g.h.LISTS_CREATE_WITH_CONTAINER_TOOLTIP);this.contextMenu=!1}};
g.W.lists_create_with_item={aa:function(){L(this,"list_blocks");K(N(this),g.h.LISTS_CREATE_WITH_ITEM_TITLE);this.Wf(!0);this.Vf(!0);this.vb(g.h.LISTS_CREATE_WITH_ITEM_TOOLTIP);this.contextMenu=!1}};
g.W.lists_indexOf={aa:function(){var a=[[g.h.LISTS_INDEX_OF_FIRST,"FIRST"],[g.h.LISTS_INDEX_OF_LAST,"LAST"]];this.Ec=g.h.LISTS_INDEX_OF_HELPURL;L(this,"list_blocks");this.Ke(!0,"Number");K(M(this,"VALUE").Db("Array"),g.h.LISTS_INDEX_OF_INPUT_IN_LIST);K(M(this,"FIND"),new g.Ma(a),"END");this.Je(!0);var c=this;this.vb(function(){return g.h.LISTS_INDEX_OF_TOOLTIP.replace("%1",c.v.options.Ge?"0":"-1")})}};
g.W.lists_getIndex={aa:function(){var a=[[g.h.LISTS_GET_INDEX_GET,"GET"],[g.h.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[g.h.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.Er=[[g.h.LISTS_GET_INDEX_FROM_START,"FROM_START"],[g.h.LISTS_GET_INDEX_FROM_END,"FROM_END"],[g.h.LISTS_GET_INDEX_FIRST,"FIRST"],[g.h.LISTS_GET_INDEX_LAST,"LAST"],[g.h.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.Ec=g.h.LISTS_GET_INDEX_HELPURL;L(this,"list_blocks");a=new g.Ma(a,function(d){this.B.mA("REMOVE"==d)});K(M(this,"VALUE").Db("Array"),
g.h.LISTS_GET_INDEX_INPUT_IN_LIST);K(K(N(this),a,"MODE"),"","SPACE");N(this,"AT");g.h.LISTS_GET_INDEX_TAIL&&K(N(this,"TAIL"),g.h.LISTS_GET_INDEX_TAIL);this.Je(!0);this.Ke(!0);this.ee(!0);var c=this;this.vb(function(){var d=z(c,"MODE"),e=z(c,"WHERE"),f="";switch(d+" "+e){case "GET FROM_START":case "GET FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case "GET FIRST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case "GET LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case "GET RANDOM":f=
g.h.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case "GET_REMOVE FROM_START":case "GET_REMOVE FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case "GET_REMOVE FIRST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case "GET_REMOVE LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case "GET_REMOVE RANDOM":f=g.h.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case "REMOVE FROM_START":case "REMOVE FROM_END":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case "REMOVE FIRST":f=
g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case "REMOVE LAST":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case "REMOVE RANDOM":f=g.h.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}if("FROM_START"==e||"FROM_END"==e)f+="  "+("FROM_START"==e?g.h.LISTS_INDEX_FROM_START_TOOLTIP:g.h.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",c.v.options.Ge?"#1":"#0");return f})},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("statement",!this.L);a.setAttribute("at",E(this,"AT").type==g.Ua);return a},
Ab:function(a){var c="true"==a.getAttribute("statement");this.mA(c);a="false"!=a.getAttribute("at");this.ee(a)},mA:function(a){a!=!this.L&&(D(this,!0),a?(this.Ke(!1),this.Wf(!0),this.Vf(!0)):(this.Wf(!1),this.Vf(!1),this.Ke(!0)))},ee:function(a){this.Yb("AT");this.Yb("ORDINAL",!0);a?(M(this,"AT").Db("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&K(N(this,"ORDINAL"),g.h.ORDINAL_NUMBER_SUFFIX)):N(this,"AT");var c=new g.Ma(this.Er,function(d){var e="FROM_START"==d||"FROM_END"==d;if(e!=a){var f=this.B;f.ee(e);
qc(f,d,"WHERE");return null}});K(E(this,"AT"),c,"WHERE");g.h.LISTS_GET_INDEX_TAIL&&tc(this,"TAIL",null)}};
g.W.lists_setIndex={aa:function(){var a=[[g.h.LISTS_SET_INDEX_SET,"SET"],[g.h.LISTS_SET_INDEX_INSERT,"INSERT"]];this.Er=[[g.h.LISTS_GET_INDEX_FROM_START,"FROM_START"],[g.h.LISTS_GET_INDEX_FROM_END,"FROM_END"],[g.h.LISTS_GET_INDEX_FIRST,"FIRST"],[g.h.LISTS_GET_INDEX_LAST,"LAST"],[g.h.LISTS_GET_INDEX_RANDOM,"RANDOM"]];this.Ec=g.h.LISTS_SET_INDEX_HELPURL;L(this,"list_blocks");K(M(this,"LIST").Db("Array"),g.h.LISTS_SET_INDEX_INPUT_IN_LIST);K(K(N(this),new g.Ma(a),"MODE"),"","SPACE");N(this,"AT");K(M(this,
"TO"),g.h.LISTS_SET_INDEX_INPUT_TO);this.Je(!0);this.Wf(!0);this.Vf(!0);this.vb(g.h.LISTS_SET_INDEX_TOOLTIP);this.ee(!0);var c=this;this.vb(function(){var d=z(c,"MODE"),e=z(c,"WHERE"),f="";switch(d+" "+e){case "SET FROM_START":case "SET FROM_END":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case "SET FIRST":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case "SET LAST":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case "SET RANDOM":f=g.h.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case "INSERT FROM_START":case "INSERT FROM_END":f=
g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case "INSERT FIRST":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case "INSERT LAST":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case "INSERT RANDOM":f=g.h.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}if("FROM_START"==e||"FROM_END"==e)f+="  "+g.h.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",c.v.options.Ge?"#1":"#0");return f})},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at",E(this,"AT").type==g.Ua);return a},Ab:function(a){a=
"false"!=a.getAttribute("at");this.ee(a)},ee:function(a){this.Yb("AT");this.Yb("ORDINAL",!0);a?(M(this,"AT").Db("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&K(N(this,"ORDINAL"),g.h.ORDINAL_NUMBER_SUFFIX)):N(this,"AT");var c=new g.Ma(this.Er,function(d){var e="FROM_START"==d||"FROM_END"==d;if(e!=a){var f=this.B;f.ee(e);qc(f,d,"WHERE");return null}});tc(this,"AT","TO");E(this,"ORDINAL")&&tc(this,"ORDINAL","TO");K(E(this,"AT"),c,"WHERE")}};
g.W.lists_getSublist={aa:function(){this.WHERE_OPTIONS_1=[[g.h.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[g.h.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[g.h.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]];this.WHERE_OPTIONS_2=[[g.h.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[g.h.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[g.h.LISTS_GET_SUBLIST_END_LAST,"LAST"]];this.Ec=g.h.LISTS_GET_SUBLIST_HELPURL;L(this,"list_blocks");K(M(this,"LIST").Db("Array"),g.h.LISTS_GET_SUBLIST_INPUT_IN_LIST);N(this,
"AT1");N(this,"AT2");g.h.LISTS_GET_SUBLIST_TAIL&&K(N(this,"TAIL"),g.h.LISTS_GET_SUBLIST_TAIL);this.Je(!0);this.Ke(!0,"Array");this.ee(1,!0);this.ee(2,!0);this.vb(g.h.LISTS_GET_SUBLIST_TOOLTIP)},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("at1",E(this,"AT1").type==g.Ua);a.setAttribute("at2",E(this,"AT2").type==g.Ua);return a},Ab:function(a){var c="true"==a.getAttribute("at1");a="true"==a.getAttribute("at2");this.ee(1,c);this.ee(2,a)},ee:function(a,c){this.Yb("AT"+a);this.Yb("ORDINAL"+
a,!0);c?(M(this,"AT"+a).Db("Number"),g.h.ORDINAL_NUMBER_SUFFIX&&K(N(this,"ORDINAL"+a),g.h.ORDINAL_NUMBER_SUFFIX)):N(this,"AT"+a);var d=new g.Ma(this["WHERE_OPTIONS_"+a],function(e){var f="FROM_START"==e||"FROM_END"==e;if(f!=c){var h=this.B;h.ee(a,f);qc(h,e,"WHERE"+a);return null}});K(E(this,"AT"+a),d,"WHERE"+a);1==a&&(tc(this,"AT1","AT2"),E(this,"ORDINAL1")&&tc(this,"ORDINAL1","AT2"));g.h.LISTS_GET_SUBLIST_TAIL&&tc(this,"TAIL",null)}};
g.W.lists_sort={aa:function(){sc(this,{message0:g.h.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[g.h.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[g.h.LISTS_SORT_TYPE_TEXT,"TEXT"],[g.h.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[g.h.LISTS_SORT_ORDER_ASCENDING,"1"],[g.h.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:g.h.LISTS_SORT_TOOLTIP,helpUrl:g.h.LISTS_SORT_HELPURL})}};
g.W.lists_split={aa:function(){var a=this,c=new g.Ma([[g.h.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[g.h.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(d){a.Hn(d)});this.Ec=g.h.LISTS_SPLIT_HELPURL;L(this,"list_blocks");K(M(this,"INPUT").Db("String"),c,"MODE");K(M(this,"DELIM").Db("String"),g.h.LISTS_SPLIT_WITH_DELIMITER);this.Je(!0);this.Ke(!0,"Array");this.vb(function(){var d=z(a,"MODE");if("SPLIT"==d)return g.h.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"==d)return g.h.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+
d);})},Hn:function(a){if(z(this,"MODE")!=a){var c=E(this,"INPUT").connection;c.nf=null;var d=C(c);d&&(c.disconnect(),d.$a?d.I():this.Hb())}"SPLIT"==a?(this.L.Db("Array"),E(this,"INPUT").Db("String")):(this.L.Db("String"),E(this,"INPUT").Db("Array"))},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("mode",z(this,"MODE"));return a},Ab:function(a){this.Hn(a.getAttribute("mode"))}};g.W.vF={};g.la.Pd={};g.la.Pd.eo=210;
g.wk([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,
nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",
helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["\u2260","NEQ"],["\u200f<","LT"],["\u200f\u2264","LTE"],["\u200f>","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",
message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",
tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",
name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]);
g.wk([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",
tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);g.la.Pd.yr={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};g.X.register("logic_op_tooltip",g.X.Do("OP",g.la.Pd.yr));
g.la.Pd.XA={Vd:0,af:0,Zh:!0,eb:function(){if(!this.Vd&&!this.af)return null;var a=g.g.xml.createElement("mutation");this.Vd&&a.setAttribute("elseif",this.Vd);this.af&&a.setAttribute("else",1);return a},Ab:function(a){this.Vd=parseInt(a.getAttribute("elseif"),10)||0;this.af=parseInt(a.getAttribute("else"),10)||0;this.rG()},Bg:function(a){var c=a.Lh("controls_if_if");c.Ce();for(var d=c.V,e=1;e<=this.Vd;e++){var f=a.Lh("controls_if_elseif");f.Ce();d.connect(f.Y);d=f.V}this.af&&(a=a.Lh("controls_if_else"),
a.Ce(),d.connect(a.Y));return c},yg:function(a){a=C(a.V);this.af=this.Vd=0;for(var c=[null],d=[null],e=null;a;){switch(a.type){case "controls_if_elseif":this.Vd++;c.push(a.av);d.push(a.$f);break;case "controls_if_else":this.af++;e=a.$f;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.V&&C(a.V)}this.fe();this.Oz(c,d,e)},Xp:function(a){a=C(a.V);for(var c=1;a;){switch(a.type){case "controls_if_elseif":var d=E(this,"IF"+c),e=E(this,"DO"+c);a.av=d&&d.connection.ga;a.$f=e&&e.connection.ga;
c++;break;case "controls_if_else":e=E(this,"ELSE");a.$f=e&&e.connection.ga;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.V&&C(a.V)}},rG:function(){var a=[null],c=[null],d=null;E(this,"ELSE")&&(d=E(this,"ELSE").connection.ga);for(var e=1;E(this,"IF"+e);){var f=E(this,"DO"+e);a.push(E(this,"IF"+e).connection.ga);c.push(f.connection.ga);e++}this.fe();this.Oz(a,c,d)},fe:function(){E(this,"ELSE")&&this.Yb("ELSE");for(var a=1;E(this,"IF"+a);)this.Yb("IF"+a),this.Yb("DO"+a),a++;for(a=
1;a<=this.Vd;a++)K(M(this,"IF"+a).Db("Boolean"),g.h.CONTROLS_IF_MSG_ELSEIF),K(this.Bf(g.Ra,"DO"+a),g.h.CONTROLS_IF_MSG_THEN);this.af&&K(this.Bf(g.Ra,"ELSE"),g.h.CONTROLS_IF_MSG_ELSE)},Oz:function(a,c,d){for(var e=1;e<=this.Vd;e++)g.ic.Uk(a[e],this,"IF"+e),g.ic.Uk(c[e],this,"DO"+e);g.ic.Uk(d,this,"ELSE")}};g.X.tu("controls_if_mutator",g.la.Pd.XA,null,["controls_if_elseif","controls_if_else"]);
g.la.Pd.YA=function(){this.vb(function(){if(this.Vd||this.af){if(!this.Vd&&this.af)return g.h.CONTROLS_IF_TOOLTIP_2;if(this.Vd&&!this.af)return g.h.CONTROLS_IF_TOOLTIP_3;if(this.Vd&&this.af)return g.h.CONTROLS_IF_TOOLTIP_4}else return g.h.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};g.X.register("controls_if_tooltip",g.la.Pd.YA);
g.la.Pd.RB={onchange:function(a){this.$m||(this.$m=[null,null]);var c=uc(this,"A"),d=uc(this,"B");c&&d&&!Eb(c.L,d.L)&&(g.i.Z(a.group),a=this.$m[0],a!==c&&(D(c),a&&!a.$a&&E(this,"A").connection.connect(a.L)),c=this.$m[1],c!==d&&(D(d),c&&!c.$a&&E(this,"B").connection.connect(c.L)),this.Hb(),g.i.Z(!1));this.$m[0]=uc(this,"A");this.$m[1]=uc(this,"B")}};g.la.Pd.QB=function(){this.kj(g.la.Pd.RB)};g.X.register("logic_compare",g.la.Pd.QB);
g.la.Pd.SB={Jz:null,onchange:function(a){var c=uc(this,"THEN"),d=uc(this,"ELSE"),e=this.L.ga;if((c||d)&&e)for(var f=0;2>f;f++){var h=1==f?c:d;h&&!Eb(h.L,e)&&(g.i.Z(a.group),e===this.Jz?(D(this),e.B.Hb()):(D(h),h.Hb()),g.i.Z(!1))}this.Jz=e}};g.X.Rp("logic_ternary",g.la.Pd.SB);g.Pe=function(a,c,d,e,f,h){this.Tm=-Infinity;this.Rm=Infinity;this.Sk=0;this.ns=null;g.Pe.w.constructor.call(this,a||0,f,h);h||(ae(this,c),be(this,d),ce(this,e),this.setValue(this.getValue()))};g.g.object.T(g.Pe,g.pb);g.Pe.sa=function(a){return new g.Pe(a.value,void 0,void 0,void 0,void 0,a)};g.Pe.prototype.gk=!0;g.Pe.prototype.Ad=function(a){g.Pe.w.Ad.call(this,a);ae(this,a.min);be(this,a.max);ce(this,a.precision)};function ae(a,c){null==c?a.Tm=-Infinity:(c=Number(c),isNaN(c)||(a.Tm=c))}
function be(a,c){null==c?a.Rm=Infinity:(c=Number(c),isNaN(c)||(a.Rm=c))}function ce(a,c){null==c?a.Sk=0:(c=Number(c),isNaN(c)||(a.Sk=c));var d=a.Sk.toString(),e=d.indexOf(".");a.ns=-1==e?c?0:null:d.length-e-1}g.Pe.prototype.Dg=function(a){if(null===a)return null;a=String(a);a=a.replace(/O/ig,"0");a=a.replace(/,/g,"");a=Number(a||0);if(isNaN(a))return null;a=Math.min(Math.max(a,this.Tm),this.Rm);this.Sk&&isFinite(a)&&(a=Math.round(a/this.Sk)*this.Sk);null!=this.ns&&(a=Number(a.toFixed(this.ns)));return a};
g.Pe.prototype.bv=function(){var a=g.Pe.w.bv.call(this);-Infinity<this.Tm&&g.g.U.Eb(a,g.g.U.State.JC,this.Tm);Infinity>this.Rm&&g.g.U.Eb(a,g.g.U.State.IC,this.Rm);return a};g.Dc.register("field_number",g.Pe);g.me=function(a,c,d,e,f){this.jj=g.me.gE;this.RD=a||"";this.Lb=new g.g.qe(0,g.va.Vq);f&&this.Ad(f);c&&(this.Ij=c);f||de(this,d,e)};g.g.object.T(g.me,g.Ma);g.me.sa=function(a){var c=g.g.nc(a.variable);return new g.me(c,void 0,void 0,void 0,a)};b=g.me.prototype;b.s=null;b.gk=!0;b.Ad=function(a){g.me.w.Ad.call(this,a);de(this,a.variableTypes,a.defaultType)};b.Xi=function(){if(!this.Ld){var a=g.N.gp(this.B.v,null,this.RD,this.QD);g.i.disable();this.setValue(a.ua());g.i.enable()}};
b.pm=function(a){var c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";c=g.N.gp(this.B.v,c,d,e);if(null!=e&&e!==c.type)throw Error("Serialized variable type with id '"+c.ua()+"' had type "+c.type+", and does not match variable field that references it: "+g.O.Dd(a)+".");this.setValue(c.ua())};b.iA=function(a){this.Xi();a.id=this.Ld.ua();a.textContent=this.Ld.name;this.Ld.type&&a.setAttribute("variabletype",this.Ld.type);return a};
b.Ku=function(a){if(a.$a)throw Error("Variable fields are not allowed to exist on shadow blocks.");g.me.w.Ku.call(this,a)};b.getValue=function(){return this.Ld?this.Ld.ua():null};b.cc=function(){return this.Ld?this.Ld.name:""};b.Tc=function(){return this.Ld};b.sy=function(){return this.Ld?this.Ij:null};
b.Dg=function(a){if(null===a)return null;var c=g.N.Tc(this.B.v,a);if(!c)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;c=c.type;var d;a:if(d=ee(this)){for(var e=0;e<d.length;e++)if(c==d[e]){d=!0;break a}d=!1}else d=!0;return d?a:(console.warn("Variable type doesn't match this field!  Type was "+c),null)};b.sh=function(a){this.Ld=g.N.Tc(this.B.v,a);g.me.w.sh.call(this,a)};
function ee(a){var c=a.bH;if(null===c&&a.B&&a.B.v)return a.B.v.ct();c=c||[""];if(0==c.length)throw a=a.cc(),Error("'variableTypes' of field variable "+a+" was an empty list");return c}
function de(a,c,d){d=d||"";if(null==c||void 0==c)c=null;else if(Array.isArray(c)){for(var e=!1,f=0;f<c.length;f++)c[f]==d&&(e=!0);if(!e)throw Error("Invalid default type '"+d+"' in the definition of a FieldVariable");}else throw Error("'variableTypes' was not an array in the definition of a FieldVariable");a.QD=d;a.bH=c}
g.me.gE=function(){if(!this.Ld)throw Error("Tried to call dropdownCreate on a variable field with no variable selected.");var a=this.cc(),c=[];if(this.B&&this.B.v)for(var d=ee(this),e=0;e<d.length;e++)c=c.concat(this.B.v.vm(d[e]));c.sort(g.Kl.Ww);d=[];for(e=0;e<c.length;e++)d[e]=[c[e].name,c[e].ua()];d.push([g.h.RENAME_VARIABLE,g.iw]);g.h.DELETE_VARIABLE&&d.push([g.h.DELETE_VARIABLE.replace("%1",a),g.Cv]);return d};
g.me.prototype.vz=function(a){a=a.getValue();if(this.B&&this.B.v){if(a==g.iw){g.N.Tp(this.B.v,this.Ld);return}if(a==g.Cv){this.B.v.Hf(this.Ld.ua());return}}this.setValue(a)};g.me.prototype.fn=function(){return!0};g.Dc.register("field_variable",g.me);g.W.xF={};g.la.ne={};g.la.ne.eo=120;
g.wk([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",
args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",
name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",
args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,
nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip",
"controls_flow_in_loop_check"]}]);g.la.ne.MC={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};g.X.register("controls_whileUntil_tooltip",g.X.Do("MODE",g.la.ne.MC));g.la.ne.KA={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};g.X.register("controls_flow_tooltip",g.X.Do("FLOW",g.la.ne.KA));
g.la.ne.aB={Ag:function(a){if(!this.Wb){var c=B(this,"VAR").Tc(),d=c.name;if(!this.isCollapsed()&&null!=d){var e={enabled:!0};e.text=g.h.VARIABLES_SET_CREATE_GET.replace("%1",d);c=g.N.qm(c);d=g.g.xml.createElement("block");d.setAttribute("type","variables_get");d.appendChild(c);e.tb=g.Ba.Eo(this,d);a.push(e)}}}};g.X.Rp("contextMenu_newGetVariableBlock",g.la.ne.aB);g.X.register("controls_for_tooltip",g.X.Wr("%{BKY_CONTROLS_FOR_TOOLTIP}"));g.X.register("controls_forEach_tooltip",g.X.Wr("%{BKY_CONTROLS_FOREACH_TOOLTIP}"));
g.la.ne.Vn={UB:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],Zh:!0,qy:function(a){do{if(-1!=g.la.ne.Vn.UB.indexOf(a.type))return a;a=nc(a)}while(a);return null},onchange:function(){this.v.dc&&!this.v.dc()&&(g.la.ne.Vn.qy(this)?(this.Wg(null),this.Wb||this.Kc(!0)):(this.Wg(g.h.CONTROLS_FLOW_STATEMENTS_WARNING),this.Wb||rc(this)||this.Kc(!1)))}};g.X.Rp("controls_flow_in_loop_check",g.la.ne.Vn);g.W.td={};g.la.Math={};g.la.Math.eo=230;
g.wk([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],
["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",
name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",
extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["\u03c0","PI"],["e","E"],["\u03c6","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(\u00bd)","SQRT1_2"],["\u221e","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",
options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},
{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",
helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}",
"RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",
message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,
output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",
style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]);
g.la.Math.yr={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",
SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"};
g.X.register("math_op_tooltip",g.X.Do("OP",g.la.Math.yr));g.la.Math.FB={eb:function(){var a=g.g.xml.createElement("mutation"),c="DIVISIBLE_BY"==z(this,"PROPERTY");a.setAttribute("divisor_input",c);return a},Ab:function(a){a="true"==a.getAttribute("divisor_input");this.fe(a)},fe:function(a){var c=E(this,"DIVISOR");a?c||M(this,"DIVISOR").Db("Number"):c&&this.Yb("DIVISOR")}};g.la.Math.GB=function(){fc(B(this,"PROPERTY"),function(a){this.B.fe("DIVISIBLE_BY"==a)})};
g.X.tu("math_is_divisibleby_mutator",g.la.Math.FB,g.la.Math.GB);g.X.register("math_change_tooltip",g.X.Wr("%{BKY_MATH_CHANGE_TOOLTIP}"));g.la.Math.PB={Hn:function(a){"MODE"==a?this.L.Db("Array"):this.L.Db("Number")},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("op",z(this,"OP"));return a},Ab:function(a){this.Hn(a.getAttribute("op"))}};g.la.Math.OB=function(){fc(B(this,"OP"),function(a){this.Hn(a)}.bind(this))};g.X.tu("math_modes_of_list_mutator",g.la.Math.PB,g.la.Math.OB);g.Oc=function(a,c,d){this.Nw=null;null==a&&(a="FALSE");g.Oc.w.constructor.call(this,a,c,d);this.Lb.width=g.Oc.NC};g.g.object.T(g.Oc,g.Ha);g.Oc.sa=function(a){return new g.Oc(a.checked,void 0,a)};g.Oc.NC=15;g.Oc.OA="\u2713";g.Oc.PA=g.Ha.ji-3;g.Oc.QA=14;b=g.Oc.prototype;b.gk=!0;b.Cq="default";b.ff=!1;b.Ad=function(a){g.Oc.w.Ad.call(this,a);a.checkCharacter&&(this.Nw=a.checkCharacter)};
b.Yi=function(){g.Oc.w.Yi.call(this);this.tc.setAttribute("x",g.Oc.PA);this.tc.setAttribute("y",g.Oc.QA);g.g.o.qb(this.tc,"blocklyCheckbox");this.Ej.nodeValue=this.Nw||g.Oc.OA;this.tc.style.display=this.kb?"block":"none"};b.Le=function(){this.setValue(!this.kb)};b.Dg=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};b.sh=function(a){this.kb=fe(a);this.tc&&(this.tc.style.display=this.kb?"block":"none")};b.getValue=function(){return this.kb?"TRUE":"FALSE"};b.cc=function(){return String(fe(this.kb))};
function fe(a){return"string"==typeof a?"TRUE"==a:!!a}g.Dc.register("field_checkbox",g.Oc);g.W.qG={};
g.W.procedures_defnoreturn={aa:function(){var a=new g.pb("",g.Ea.uu);Vd(a);K(K(K(N(this),g.h.PROCEDURES_DEFNORETURN_TITLE),a,"NAME"),"","PARAMS");this.on(new g.ic(["procedures_mutatorarg"]));(this.v.options.Vl||this.v.options.Kb&&this.v.options.Kb.options.Vl)&&g.h.PROCEDURES_DEFNORETURN_COMMENT&&this.Wh(g.h.PROCEDURES_DEFNORETURN_COMMENT);L(this,"procedure_blocks");this.vb(g.h.PROCEDURES_DEFNORETURN_TOOLTIP);this.Ec=g.h.PROCEDURES_DEFNORETURN_HELPURL;this.Fa=[];this.$b=[];this.Yh(!0);this.$f=null},
Yh:function(a){this.op!==a&&(a?(K(this.Bf(g.Ra,"STACK"),g.h.PROCEDURES_DEFNORETURN_DO),E(this,"RETURN")&&tc(this,"STACK","RETURN")):this.Yb("STACK",!0),this.op=a)},Gn:function(){var a="";this.Fa.length&&(a=g.h.PROCEDURES_BEFORE_PARAMS+" "+this.Fa.join(", "));g.i.disable();try{qc(this,a,"PARAMS")}finally{g.i.enable()}},eb:function(a){var c=g.g.xml.createElement("mutation");a&&c.setAttribute("name",z(this,"NAME"));for(var d=0;d<this.$b.length;d++){var e=g.g.xml.createElement("arg"),f=this.$b[d];e.setAttribute("name",
f.name);e.setAttribute("varid",f.ua());a&&this.iu&&e.setAttribute("paramId",this.iu[d]);c.appendChild(e)}this.op||c.setAttribute("statements","false");return c},Ab:function(a){this.Fa=[];this.$b=[];for(var c=0,d;d=a.childNodes[c];c++)if("arg"==d.nodeName.toLowerCase()){var e=d.getAttribute("name");d=d.getAttribute("varid")||d.getAttribute("varId");this.Fa.push(e);d=g.N.gp(this.v,d,e,"");null!=d?this.$b.push(d):console.log("Failed to create a variable with name "+e+", ignoring.")}this.Gn();g.Ea.Vm(this);
this.Yh("false"!==a.getAttribute("statements"))},Bg:function(a){var c=g.g.xml.createElement("block");c.setAttribute("type","procedures_mutatorcontainer");var d=g.g.xml.createElement("statement");d.setAttribute("name","STACK");c.appendChild(d);for(var e=0;e<this.Fa.length;e++){var f=g.g.xml.createElement("block");f.setAttribute("type","procedures_mutatorarg");var h=g.g.xml.createElement("field");h.setAttribute("name","NAME");var k=g.g.xml.createTextNode(this.Fa[e]);h.appendChild(k);f.appendChild(h);
h=g.g.xml.createElement("next");f.appendChild(h);d.appendChild(f);d=h}a=g.O.Oi(c,a);"procedures_defreturn"==this.type?qc(a,this.op,"STATEMENTS"):a.Yb("STATEMENT_INPUT");g.Ea.Vm(this);return a},yg:function(a){this.Fa=[];this.iu=[];this.$b=[];for(var c=uc(a,"STACK");c;){var d=z(c,"NAME");this.Fa.push(d);d=this.v.Tc(d,"");this.$b.push(d);this.iu.push(c.id);c=c.V&&C(c.V)}this.Gn();g.Ea.Vm(this);a=z(a,"STATEMENTS");if(null!==a&&(a="TRUE"==a,this.op!=a))if(a)this.Yh(!0),g.ic.Uk(this.$f,this,"STACK"),this.$f=
null;else{a=E(this,"STACK").connection;if(this.$f=a.ga)a=C(a),D(a),a.Hb();this.Yh(!1)}},zh:function(){return[z(this,"NAME"),this.Fa,!1]},et:function(){return this.Fa},Ig:function(){return this.$b},Sp:function(a,c){var d=this.v.cf(a);if(""==d.type){d=d.name;c=this.v.cf(c);for(var e=!1,f=0;f<this.$b.length;f++)this.$b[f].ua()==a&&(this.Fa[f]=c.name,this.$b[f]=c,e=!0);e&&(this.Uo(d,c.name),g.Ea.Vm(this))}},lq:function(a){for(var c=a.name,d=!1,e=0;e<this.$b.length;e++)if(this.$b[e].ua()==a.ua()){var f=
this.Fa[e];this.Fa[e]=c;d=!0}d&&(this.Uo(f,c),g.Ea.Vm(this))},Uo:function(a,c){this.Gn();if(this.Gd&&this.Gd.isVisible())for(var d=y(this.Gd.s,!1),e=0,f;f=d[e];e++)"procedures_mutatorarg"==f.type&&g.Qd.ve(a,z(f,"NAME"))&&qc(f,c,"NAME")},Ag:function(a){if(!this.Wb){var c={enabled:!0},d=z(this,"NAME");c.text=g.h.PROCEDURES_CREATE_DO.replace("%1",d);var e=g.g.xml.createElement("mutation");e.setAttribute("name",d);for(d=0;d<this.Fa.length;d++){var f=g.g.xml.createElement("arg");f.setAttribute("name",
this.Fa[d]);e.appendChild(f)}d=g.g.xml.createElement("block");d.setAttribute("type",this.Kw);d.appendChild(e);c.tb=g.Ba.Eo(this,d);a.push(c);if(!this.isCollapsed())for(d=0;d<this.$b.length;d++)c={enabled:!0},e=this.$b[d],c.text=g.h.VARIABLES_SET_CREATE_GET.replace("%1",e.name),e=g.N.qm(e),f=g.g.xml.createElement("block"),f.setAttribute("type","variables_get"),f.appendChild(e),c.tb=g.Ba.Eo(this,f),a.push(c)}},Kw:"procedures_callnoreturn"};
g.W.procedures_defreturn={aa:function(){var a=new g.pb("",g.Ea.uu);Vd(a);K(K(K(N(this),g.h.PROCEDURES_DEFRETURN_TITLE),a,"NAME"),"","PARAMS");K(mc(M(this,"RETURN"),g.Ln),g.h.PROCEDURES_DEFRETURN_RETURN);this.on(new g.ic(["procedures_mutatorarg"]));(this.v.options.Vl||this.v.options.Kb&&this.v.options.Kb.options.Vl)&&g.h.PROCEDURES_DEFRETURN_COMMENT&&this.Wh(g.h.PROCEDURES_DEFRETURN_COMMENT);L(this,"procedure_blocks");this.vb(g.h.PROCEDURES_DEFRETURN_TOOLTIP);this.Ec=g.h.PROCEDURES_DEFRETURN_HELPURL;
this.Fa=[];this.$b=[];this.Yh(!0);this.$f=null},Yh:g.W.procedures_defnoreturn.Yh,Gn:g.W.procedures_defnoreturn.Gn,eb:g.W.procedures_defnoreturn.eb,Ab:g.W.procedures_defnoreturn.Ab,Bg:g.W.procedures_defnoreturn.Bg,yg:g.W.procedures_defnoreturn.yg,zh:function(){return[z(this,"NAME"),this.Fa,!0]},et:g.W.procedures_defnoreturn.et,Ig:g.W.procedures_defnoreturn.Ig,Sp:g.W.procedures_defnoreturn.Sp,lq:g.W.procedures_defnoreturn.lq,Uo:g.W.procedures_defnoreturn.Uo,Ag:g.W.procedures_defnoreturn.Ag,Kw:"procedures_callreturn"};
g.W.procedures_mutatorcontainer={aa:function(){K(N(this),g.h.PROCEDURES_MUTATORCONTAINER_TITLE);this.Bf(g.Ra,"STACK");K(K(N(this,"STATEMENT_INPUT"),g.h.PROCEDURES_ALLOW_STATEMENTS),new g.Oc("TRUE"),"STATEMENTS");L(this,"procedure_blocks");this.vb(g.h.PROCEDURES_MUTATORCONTAINER_TOOLTIP);this.contextMenu=!1},onchange:function(a){if(this.v&&!this.v.$d&&(a.type==g.i.Nn||a.type==g.i.kl)){var c=y(this.v),d=this.v.Fg();if(a.type==g.i.Nn){a=[];for(var e=0;e<c.length;e+=1)z(c[e],"NAME")&&a.push(z(c[e],"NAME"));
for(c=0;c<d.length;c+=1)-1==a.indexOf(d[c].name)&&this.v.Hf(d[c].ua())}else if(a.type==g.i.kl&&(d=x(this.v,a.zc),B(d,"NAME")&&(e=z(d,"NAME"),(a=this.v.Tc(e))||(a=this.v.Cd(e)),!d.Y.isConnected()&&!d.V.isConnected())))for(e=0;e<c.length;e+=1)if(d.id!=c[e].id&&z(c[e],"NAME")==a.name){e=g.N.Vx(this.v);a=this.v.Cd(e);qc(d,a.name,"NAME");break}}}};
g.W.procedures_mutatorarg={aa:function(){var a=new g.pb("x",this.Ij);a.RF=a.Le;a.Le=function(){this.dm=[];this.RF()};K(K(N(this),g.h.PROCEDURES_MUTATORARG_TITLE),a,"NAME");this.Wf(!0);this.Vf(!0);L(this,"procedure_blocks");this.vb(g.h.PROCEDURES_MUTATORARG_TOOLTIP);this.contextMenu=!1;a.au=this.SD;a.dm=[];a.au("x")},Ij:function(a){var c=this.B,d=g.ic.Nx(c.v);a=a.replace(/[\s\xa0]+/g," ").replace(/^ | $/g,"");if(!a)return null;c=y(c.v);for(var e=0;e<c.length;e++)if(c[e].id!=this.B.id&&z(c[e],"NAME")==
a)return null;(c=d.Tc(a,""))&&c.name!=a&&d.Uh(c.ua(),a);c||(c=d.Cd(a,""))&&this.dm&&this.dm.push(c);return a},SD:function(a){var c=g.ic.Nx(this.B.v);if(c)for(var d=0;d<this.dm.length;d++){var e=this.dm[d];e.name!=a&&c.Hf(e.ua())}}};
g.W.procedures_callnoreturn={aa:function(){K(N(this,"TOPROW"),this.id,"NAME");this.Wf(!0);this.Vf(!0);L(this,"procedure_blocks");this.Ec=g.h.PROCEDURES_CALLNORETURN_HELPURL;this.Fa=[];this.$b=[];this.sj={};this.Sf=null;this.pu=!0},Wd:function(){return z(this,"NAME")},hn:function(a,c){g.Qd.ve(a,this.Wd())&&(qc(this,c,"NAME"),this.vb((this.L?g.h.PROCEDURES_CALLRETURN_TOOLTIP:g.h.PROCEDURES_CALLNORETURN_TOOLTIP).replace("%1",c)))},Iu:function(a,c){var d=g.Ea.sm(this.Wd(),this.v),e=d&&d.Gd&&d.Gd.isVisible();
e||(this.sj={},this.Sf=null);if(c)if(a.join("\n")==this.Fa.join("\n"))this.Sf=c;else{if(c.length!=a.length)throw RangeError("paramNames and paramIds must be the same length.");this.Ug(!1);this.Sf||(this.sj={},this.Sf=[]);d=this.ca;this.ca=!1;for(var f=0;f<this.Fa.length;f++){var h=E(this,"ARG"+f);h&&(h=h.connection.ga,this.sj[this.Sf[f]]=h,e&&h&&-1==c.indexOf(this.Sf[f])&&(h.disconnect(),h.B.Hb()))}this.Fa=[].concat(a);this.$b=[];for(f=0;f<this.Fa.length;f++)a=g.N.gp(this.v,null,this.Fa[f],""),this.$b.push(a);
this.fe();if(this.Sf=c)for(f=0;f<this.Fa.length;f++)c=this.Sf[f],c in this.sj&&(h=this.sj[c],g.ic.Uk(h,this,"ARG"+f)||delete this.sj[c]);(this.ca=d)&&this.za()}},fe:function(){for(var a=0;a<this.Fa.length;a++){var c=B(this,"ARGNAME"+a);if(c){g.i.disable();try{c.setValue(this.Fa[a])}finally{g.i.enable()}}else c=new g.Od(this.Fa[a]),K(mc(M(this,"ARG"+a),g.Ln),c,"ARGNAME"+a).aa()}for(;E(this,"ARG"+a);)this.Yb("ARG"+a),a++;if(a=E(this,"TOPROW"))if(this.Fa.length)B(this,"WITH")||(K(a,g.h.PROCEDURES_CALL_BEFORE_PARAMS,
"WITH"),a.aa());else if(B(this,"WITH"))a:{c=0;for(var d;d=a.Na[c];c++)if("WITH"===d.name){d.I();a.Na.splice(c,1);a.B.ca&&(a.B.za(),a.B.Hb());break a}throw Error('Field "%s" not found.',"WITH");}},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("name",this.Wd());for(var c=0;c<this.Fa.length;c++){var d=g.g.xml.createElement("arg");d.setAttribute("name",this.Fa[c]);a.appendChild(d)}return a},Ab:function(a){var c=a.getAttribute("name");this.hn(this.Wd(),c);c=[];for(var d=[],e=0,f;f=
a.childNodes[e];e++)"arg"==f.nodeName.toLowerCase()&&(c.push(f.getAttribute("name")),d.push(f.getAttribute("paramId")));this.Iu(c,d)},Ig:function(){return this.$b},onchange:function(a){if(this.v&&!this.v.$d&&a.Jc)if(a.type==g.i.kl&&-1!=a.Lg.indexOf(this.id)){var c=this.Wd();c=g.Ea.sm(c,this.v);!c||c.type==this.os&&JSON.stringify(c.Fa)==JSON.stringify(this.Fa)||(c=null);if(!c){g.i.Z(a.group);a=g.g.xml.createElement("xml");c=g.g.xml.createElement("block");c.setAttribute("type",this.os);var d=this.Oa(),
e=d.y+2*g.md;c.setAttribute("x",d.x+g.md*(this.G?-1:1));c.setAttribute("y",e);d=this.eb();c.appendChild(d);d=g.g.xml.createElement("field");d.setAttribute("name","NAME");d.appendChild(g.g.xml.createTextNode(this.Wd()));c.appendChild(d);a.appendChild(c);g.O.uh(a,this.v);g.i.Z(!1)}}else a.type==g.i.Nn?(c=this.Wd(),c=g.Ea.sm(c,this.v),c||(g.i.Z(a.group),this.I(!0,!1),g.i.Z(!1))):a.type==g.i.ei&&"disabled"==a.element&&(c=this.Wd(),(c=g.Ea.sm(c,this.v))&&c.id==a.zc&&((c=g.i.Ub())&&console.log("Saw an existing group while responding to a definition change"),
g.i.Z(a.group),a.newValue?(this.pu=this.isEnabled(),this.Kc(!1)):this.Kc(this.pu),g.i.Z(c)))},Ag:function(a){if(this.v.Fc()){var c={enabled:!0};c.text=g.h.PROCEDURES_HIGHLIGHT_DEF;var d=this.Wd(),e=this.v;c.tb=function(){var f=g.Ea.sm(d,e);if(f){if(e.Fc()){var h=x(e,f.id);if(h){var k=h.Oa(),l=J(h),m=e.scale;h=(k.x+(e.G?-1:1)*l.width/2)*m;k=(k.y+l.height/2)*m;l=e.bc();h=-(h-l.Ac-l.lb/2)-l.Ac;k=-(k-l.kc-l.rb/2)-l.kc;g.mc();e.scroll(h,k)}}else console.warn("Tried to move a non-movable workspace. This could result in blocks becoming inaccessible.");
f.select()}};a.push(c)}},os:"procedures_defnoreturn"};
g.W.procedures_callreturn={aa:function(){K(N(this,"TOPROW"),"","NAME");this.Ke(!0);L(this,"procedure_blocks");this.Ec=g.h.PROCEDURES_CALLRETURN_HELPURL;this.Fa=[];this.sj={};this.Sf=null;this.pu=!0},Wd:g.W.procedures_callnoreturn.Wd,hn:g.W.procedures_callnoreturn.hn,Iu:g.W.procedures_callnoreturn.Iu,fe:g.W.procedures_callnoreturn.fe,eb:g.W.procedures_callnoreturn.eb,Ab:g.W.procedures_callnoreturn.Ab,Ig:g.W.procedures_callnoreturn.Ig,onchange:g.W.procedures_callnoreturn.onchange,Ag:g.W.procedures_callnoreturn.Ag,
os:"procedures_defreturn"};
g.W.procedures_ifreturn={aa:function(){K(M(this,"CONDITION").Db("Boolean"),g.h.CONTROLS_IF_MSG_IF);K(M(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN);this.Je(!0);this.Wf(!0);this.Vf(!0);L(this,"procedure_blocks");this.vb(g.h.PROCEDURES_IFRETURN_TOOLTIP);this.Ec=g.h.PROCEDURES_IFRETURN_HELPURL;this.Bh=!0},eb:function(){var a=g.g.xml.createElement("mutation");a.setAttribute("value",Number(this.Bh));return a},Ab:function(a){this.Bh=1==a.getAttribute("value");this.Bh||(this.Yb("VALUE"),K(N(this,"VALUE"),
g.h.PROCEDURES_DEFRETURN_RETURN))},onchange:function(){if(this.v.dc&&!this.v.dc()){var a=!1,c=this;do{if(-1!=this.sB.indexOf(c.type)){a=!0;break}c=nc(c)}while(c);a?("procedures_defnoreturn"==c.type&&this.Bh?(this.Yb("VALUE"),K(N(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN),this.Bh=!1):"procedures_defreturn"!=c.type||this.Bh||(this.Yb("VALUE"),K(M(this,"VALUE"),g.h.PROCEDURES_DEFRETURN_RETURN),this.Bh=!0),this.Wg(null),this.Wb||this.Kc(!0)):(this.Wg(g.h.PROCEDURES_IFRETURN_WARNING),this.Wb||rc(this)||
this.Kc(!1))}},sB:["procedures_defnoreturn","procedures_defreturn"]};g.W.cH={};g.la.N={};g.la.N.eo=330;
g.wk([{type:"variables_get",message0:"%1",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"}],output:null,style:"variable_blocks",helpUrl:"%{BKY_VARIABLES_GET_HELPURL}",tooltip:"%{BKY_VARIABLES_GET_TOOLTIP}",extensions:["contextMenu_variableSetterGetter"]},{type:"variables_set",message0:"%{BKY_VARIABLES_SET}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_VARIABLES_DEFAULT_NAME}"},{type:"input_value",name:"VALUE"}],previousStatement:null,nextStatement:null,
style:"variable_blocks",tooltip:"%{BKY_VARIABLES_SET_TOOLTIP}",helpUrl:"%{BKY_VARIABLES_SET_HELPURL}",extensions:["contextMenu_variableSetterGetter"]}]);
g.la.N.bB={Ag:function(a){if(!this.Wb){if("variables_get"==this.type)var c="variables_set",d=g.h.VARIABLES_GET_CREATE_SET;else c="variables_get",d=g.h.VARIABLES_SET_CREATE_GET;var e={enabled:0<xa(this.v)},f=B(this,"VAR").cc();e.text=d.replace("%1",f);d=g.g.xml.createElement("field");d.setAttribute("name","VAR");d.appendChild(g.g.xml.createTextNode(f));f=g.g.xml.createElement("block");f.setAttribute("type",c);f.appendChild(d);e.tb=g.Ba.Eo(this,f);a.push(e)}else if("variables_get"==this.type||"variables_get_reporter"==
this.type)c={text:g.h.vK,enabled:!0,tb:g.la.N.qC(this)},f=B(this,"VAR").cc(),e={text:g.h.QH.replace("%1",f),enabled:!0,tb:g.la.N.fB(this)},a.unshift(c),a.unshift(e)}};g.la.N.qC=function(a){return function(){var c=a.v,d=B(a,"VAR").Tc();g.N.Tp(c,d)}};g.la.N.fB=function(a){return function(){var c=a.v,d=B(a,"VAR").Tc();c.Hf(d.ua());dd(c)}};g.X.Rp("contextMenu_variableSetterGetter",g.la.N.bB);g.kg=function(a,c,d,e,f,h,k){if(!a)throw Error("Src value of an image field is required");a=g.g.nc(a);d=Number(g.g.nc(d));c=Number(g.g.nc(c));if(isNaN(d)||isNaN(c))throw Error("Height and width values of an image field must cast to numbers.");if(0>=d||0>=c)throw Error("Height and width values of an image field must be greater than 0.");this.nm=!1;this.Bo="";g.kg.w.constructor.call(this,a||"",null,k);k||(this.nm=!!h,this.Bo=g.g.nc(e)||"");this.Lb=new g.g.qe(c,d+g.kg.Aw);this.fF=d;this.Tl=null;"function"==
typeof f&&(this.Tl=f)};g.g.object.T(g.kg,g.Ha);g.kg.sa=function(a){return new g.kg(a.src,a.width,a.height,void 0,void 0,void 0,a)};g.kg.Aw=1;b=g.kg.prototype;b.uf=!1;b.ff=!1;b.Ad=function(a){g.kg.w.Ad.call(this,a);this.nm=!!a.flipRtl;this.Bo=g.g.nc(a.alt)||""};b.Yi=function(){this.Vb=g.g.o.K("image",{height:this.fF+"px",width:this.Lb.width+"px",alt:this.Bo},this.we);this.Vb.setAttributeNS(g.g.o.Ue,"xlink:href",this.kb)};b.Dg=function(a){return"string"!=typeof a?null:a};
b.sh=function(a){this.kb=a;this.Vb&&this.Vb.setAttributeNS(g.g.o.Ue,"xlink:href",this.kb||"")};b.by=function(){return this.nm};b.Le=function(){this.Tl&&this.Tl(this)};b.Ck=function(){return this.Bo};g.Dc.register("field_image",g.kg);g.Generator=function(a){this.MF=a;this.rB=new RegExp(this.le,"g")};g.Generator.xb="generated_function";b=g.Generator.prototype;b.ho=null;b.yd=null;b.Qc=null;b.kd="  ";b.TA=60;b.po=[];
function Ud(){var a=g.m,c=I;c||(console.warn("No workspace specified in workspaceToCode call.  Guessing."),c=g.ub());var d=[];a.aa(c);c=A(c,!0);for(var e=0,f;f=c[e];e++){var h=ge(a,f);Array.isArray(h)&&(h=h[0]);h&&(f.L&&(h=a.Uz(h),a.yd&&!f.Zh&&(h=S(a.yd,f)+h),a.Qc&&!f.Zh&&(h+=S(a.Qc,f))),d.push(h))}d=d.join("\n");d=a.finish(d);d=d.replace(/^\s+\n/,"");d=d.replace(/\n\s+$/,"\n");return d=d.replace(/[ \t]+\n/g,"\n")}function he(a,c){return c+a.replace(/(?!\n$)\n/g,"\n"+c)}
function ge(a,c){if(!c)return"";if(!c.isEnabled())return ge(a,t(c));var d=a[c.type];if("function"!=typeof d)throw Error('Language "'+a.MF+'" does not know how to generate  code for block type "'+c.type+'".');d=d.call(c,c);if(Array.isArray(d)){if(!c.L)throw TypeError("Expecting string from statement block: "+c.type);return[a.Yp(c,d[0],void 0),d[1]]}if("string"==typeof d)return a.yd&&!c.Zh&&(d=S(a.yd,c)+d),a.Qc&&!c.Zh&&(d+=S(a.Qc,c)),a.Yp(c,d,void 0);if(null===d)return"";throw SyntaxError("Invalid code generated: "+
d);}
function T(a,c,d){var e=g.m;if(isNaN(d))throw TypeError("Expecting valid order from block: "+a.type);var f=uc(a,c);if(!f)return"";c=ge(e,f);if(""===c)return"";if(!Array.isArray(c))throw TypeError("Expecting tuple from value block: "+f.type);a=c[0];c=c[1];if(isNaN(c))throw TypeError("Expecting valid order from value block: "+f.type);if(!a)return"";f=!1;var h=Math.floor(d),k=Math.floor(c);if(h<=k&&(h!=k||0!=h&&99!=h))for(f=!0,h=0;h<e.po.length;h++)if(e.po[h][0]==d&&e.po[h][1]==c){f=!1;break}f&&(a="("+
a+")");return a}function ie(a,c){var d=g.m;a=uc(a,c);c=ge(d,a);if("string"!=typeof c)throw TypeError("Expecting code from statement block: "+(a&&a.type));c&&(c=he(c,d.kd));return c}function je(a,c){var d=g.m;d.ho&&(a=he(S(d.ho,c),d.kd)+a);d.Qc&&!c.Zh&&(a=he(S(d.Qc,c),d.kd)+a);d.yd&&!c.Zh&&(a+=he(S(d.yd,c),d.kd));return a}function S(a,c){c=c.id.replace(/\$/g,"$$$$");return a.replace(/%1/g,"'"+c+"'")}b.hr="";function ke(a){var c=g.m;c.hr+=a+","}b.le="{leCUI8hutHZI4480Dc}";
function le(a,c){var d=g.m;if(!d.rh[a]){var e=pd(d.vd,a,g.Ea.xb);d.Qs[a]=e;c=c.join("\n").replace(d.rB,e);for(var f;f!=c;)f=c,c=c.replace(/^(( {2})*) {2}/gm,"$1\x00");c=c.replace(/\0/g,d.kd);d.rh[a]=c}return d.Qs[a]}b.aa=function(){};b.Yp=function(a,c){return c};b.finish=function(a){return a};b.Uz=function(a){return a};g.m=new g.Generator("JavaScript");ke("Blockly,break,case,catch,continue,debugger,default,delete,do,else,finally,for,function,if,in,instanceof,new,return,switch,this,throw,try,typeof,var,void,while,with,class,enum,export,extends,import,super,implements,interface,let,package,private,protected,public,static,yield,const,null,true,false,Array,ArrayBuffer,Boolean,Date,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Error,eval,EvalError,Float32Array,Float64Array,Function,Infinity,Int16Array,Int32Array,Int8Array,isFinite,isNaN,Iterator,JSON,Math,NaN,Number,Object,parseFloat,parseInt,RangeError,ReferenceError,RegExp,StopIteration,String,SyntaxError,TypeError,Uint16Array,Uint32Array,Uint8Array,Uint8ClampedArray,undefined,uneval,URIError,applicationCache,closed,Components,content,_content,controllers,crypto,defaultStatus,dialogArguments,directories,document,frameElement,frames,fullScreen,globalStorage,history,innerHeight,innerWidth,length,location,locationbar,localStorage,menubar,messageManager,mozAnimationStartTime,mozInnerScreenX,mozInnerScreenY,mozPaintCount,name,navigator,opener,outerHeight,outerWidth,pageXOffset,pageYOffset,parent,performance,personalbar,pkcs11,returnValue,screen,screenX,screenY,scrollbars,scrollMaxX,scrollMaxY,scrollX,scrollY,self,sessionStorage,sidebar,status,statusbar,toolbar,top,URL,window,addEventListener,alert,atob,back,blur,btoa,captureEvents,clearImmediate,clearInterval,clearTimeout,close,confirm,disableExternalCapture,dispatchEvent,dump,enableExternalCapture,escape,find,focus,forward,GeckoActiveXObject,getAttention,getAttentionWithCycleCount,getComputedStyle,getSelection,home,matchMedia,maximize,minimize,moveBy,moveTo,mozRequestAnimationFrame,open,openDialog,postMessage,print,prompt,QueryInterface,releaseEvents,removeEventListener,resizeBy,resizeTo,restore,routeEvent,scroll,scrollBy,scrollByLines,scrollByPages,scrollTo,setCursor,setImmediate,setInterval,setResizable,setTimeout,showModalDialog,sizeToContent,stop,unescape,updateCommands,XPCNativeWrapper,XPCSafeJSObjectWrapper,onabort,onbeforeunload,onblur,onchange,onclick,onclose,oncontextmenu,ondevicemotion,ondeviceorientation,ondragdrop,onerror,onfocus,onhashchange,onkeydown,onkeypress,onkeyup,onload,onmousedown,onmousemove,onmouseout,onmouseover,onmouseup,onmozbeforepaint,onpaint,onpopstate,onreset,onresize,onscroll,onselect,onsubmit,onunload,onpageshow,onpagehide,Image,Option,Worker,Event,Range,File,FileReader,Blob,BlobBuilder,Attr,CDATASection,CharacterData,Comment,console,DocumentFragment,DocumentType,DomConfiguration,DOMError,DOMErrorHandler,DOMException,DOMImplementation,DOMImplementationList,DOMImplementationRegistry,DOMImplementationSource,DOMLocator,DOMObject,DOMString,DOMStringList,DOMTimeStamp,DOMUserData,Entity,EntityReference,MediaQueryList,MediaQueryListListener,NameList,NamedNodeMap,Node,NodeFilter,NodeIterator,NodeList,Notation,Plugin,PluginArray,ProcessingInstruction,SharedWorker,Text,TimeRanges,Treewalker,TypeInfo,UserDataHandler,Worker,WorkerGlobalScope,HTMLDocument,HTMLElement,HTMLAnchorElement,HTMLAppletElement,HTMLAudioElement,HTMLAreaElement,HTMLBaseElement,HTMLBaseFontElement,HTMLBodyElement,HTMLBRElement,HTMLButtonElement,HTMLCanvasElement,HTMLDirectoryElement,HTMLDivElement,HTMLDListElement,HTMLEmbedElement,HTMLFieldSetElement,HTMLFontElement,HTMLFormElement,HTMLFrameElement,HTMLFrameSetElement,HTMLHeadElement,HTMLHeadingElement,HTMLHtmlElement,HTMLHRElement,HTMLIFrameElement,HTMLImageElement,HTMLInputElement,HTMLKeygenElement,HTMLLabelElement,HTMLLIElement,HTMLLinkElement,HTMLMapElement,HTMLMenuElement,HTMLMetaElement,HTMLModElement,HTMLObjectElement,HTMLOListElement,HTMLOptGroupElement,HTMLOptionElement,HTMLOutputElement,HTMLParagraphElement,HTMLParamElement,HTMLPreElement,HTMLQuoteElement,HTMLScriptElement,HTMLSelectElement,HTMLSourceElement,HTMLSpanElement,HTMLStyleElement,HTMLTableElement,HTMLTableCaptionElement,HTMLTableCellElement,HTMLTableDataCellElement,HTMLTableHeaderCellElement,HTMLTableColElement,HTMLTableRowElement,HTMLTableSectionElement,HTMLTextAreaElement,HTMLTimeElement,HTMLTitleElement,HTMLTrackElement,HTMLUListElement,HTMLUnknownElement,HTMLVideoElement,HTMLCanvasElement,CanvasRenderingContext2D,CanvasGradient,CanvasPattern,TextMetrics,ImageData,CanvasPixelArray,HTMLAudioElement,HTMLVideoElement,NotifyAudioAvailableEvent,HTMLCollection,HTMLAllCollection,HTMLFormControlsCollection,HTMLOptionsCollection,HTMLPropertiesCollection,DOMTokenList,DOMSettableTokenList,DOMStringMap,RadioNodeList,SVGDocument,SVGElement,SVGAElement,SVGAltGlyphElement,SVGAltGlyphDefElement,SVGAltGlyphItemElement,SVGAnimationElement,SVGAnimateElement,SVGAnimateColorElement,SVGAnimateMotionElement,SVGAnimateTransformElement,SVGSetElement,SVGCircleElement,SVGClipPathElement,SVGColorProfileElement,SVGCursorElement,SVGDefsElement,SVGDescElement,SVGEllipseElement,SVGFilterElement,SVGFilterPrimitiveStandardAttributes,SVGFEBlendElement,SVGFEColorMatrixElement,SVGFEComponentTransferElement,SVGFECompositeElement,SVGFEConvolveMatrixElement,SVGFEDiffuseLightingElement,SVGFEDisplacementMapElement,SVGFEDistantLightElement,SVGFEFloodElement,SVGFEGaussianBlurElement,SVGFEImageElement,SVGFEMergeElement,SVGFEMergeNodeElement,SVGFEMorphologyElement,SVGFEOffsetElement,SVGFEPointLightElement,SVGFESpecularLightingElement,SVGFESpotLightElement,SVGFETileElement,SVGFETurbulenceElement,SVGComponentTransferFunctionElement,SVGFEFuncRElement,SVGFEFuncGElement,SVGFEFuncBElement,SVGFEFuncAElement,SVGFontElement,SVGFontFaceElement,SVGFontFaceFormatElement,SVGFontFaceNameElement,SVGFontFaceSrcElement,SVGFontFaceUriElement,SVGForeignObjectElement,SVGGElement,SVGGlyphElement,SVGGlyphRefElement,SVGGradientElement,SVGLinearGradientElement,SVGRadialGradientElement,SVGHKernElement,SVGImageElement,SVGLineElement,SVGMarkerElement,SVGMaskElement,SVGMetadataElement,SVGMissingGlyphElement,SVGMPathElement,SVGPathElement,SVGPatternElement,SVGPolylineElement,SVGPolygonElement,SVGRectElement,SVGScriptElement,SVGStopElement,SVGStyleElement,SVGSVGElement,SVGSwitchElement,SVGSymbolElement,SVGTextElement,SVGTextPathElement,SVGTitleElement,SVGTRefElement,SVGTSpanElement,SVGUseElement,SVGViewElement,SVGVKernElement,SVGAngle,SVGColor,SVGICCColor,SVGElementInstance,SVGElementInstanceList,SVGLength,SVGLengthList,SVGMatrix,SVGNumber,SVGNumberList,SVGPaint,SVGPoint,SVGPointList,SVGPreserveAspectRatio,SVGRect,SVGStringList,SVGTransform,SVGTransformList,SVGAnimatedAngle,SVGAnimatedBoolean,SVGAnimatedEnumeration,SVGAnimatedInteger,SVGAnimatedLength,SVGAnimatedLengthList,SVGAnimatedNumber,SVGAnimatedNumberList,SVGAnimatedPreserveAspectRatio,SVGAnimatedRect,SVGAnimatedString,SVGAnimatedTransformList,SVGPathSegList,SVGPathSeg,SVGPathSegArcAbs,SVGPathSegArcRel,SVGPathSegClosePath,SVGPathSegCurvetoCubicAbs,SVGPathSegCurvetoCubicRel,SVGPathSegCurvetoCubicSmoothAbs,SVGPathSegCurvetoCubicSmoothRel,SVGPathSegCurvetoQuadraticAbs,SVGPathSegCurvetoQuadraticRel,SVGPathSegCurvetoQuadraticSmoothAbs,SVGPathSegCurvetoQuadraticSmoothRel,SVGPathSegLinetoAbs,SVGPathSegLinetoHorizontalAbs,SVGPathSegLinetoHorizontalRel,SVGPathSegLinetoRel,SVGPathSegLinetoVerticalAbs,SVGPathSegLinetoVerticalRel,SVGPathSegMovetoAbs,SVGPathSegMovetoRel,ElementTimeControl,TimeEvent,SVGAnimatedPathData,SVGAnimatedPoints,SVGColorProfileRule,SVGCSSRule,SVGExternalResourcesRequired,SVGFitToViewBox,SVGLangSpace,SVGLocatable,SVGRenderingIntent,SVGStylable,SVGTests,SVGTextContentElement,SVGTextPositioningElement,SVGTransformable,SVGUnitTypes,SVGURIReference,SVGViewSpec,SVGZoomAndPan");
g.m.eh=0;g.m.YJ=1.1;g.m.Mb=1.2;g.m.yb=2;g.m.WJ=3;g.m.SJ=3;g.m.OJ=4.1;g.m.$J=4.2;g.m.Dl=4.3;g.m.Bl=4.4;g.m.ZJ=4.5;g.m.aK=4.6;g.m.TJ=4.7;g.m.MJ=4.8;g.m.UJ=5;g.m.$q=5.1;g.m.Al=5.2;g.m.Cl=5.3;g.m.ek=6.1;g.m.oi=6.2;g.m.QJ=7;g.m.iC=8;g.m.VJ=8;g.m.XJ=8;g.m.Yv=9;g.m.NJ=10;g.m.RJ=11;g.m.PJ=12;g.m.Yq=13;g.m.Zq=14;g.m.oo=15;g.m.pi=16;g.m.bK=17;g.m.ad=18;g.m.xd=99;g.m.po=[[g.m.yb,g.m.Mb],[g.m.yb,g.m.yb],[g.m.Mb,g.m.Mb],[g.m.Mb,g.m.yb],[g.m.Bl,g.m.Bl],[g.m.$q,g.m.$q],[g.m.oi,g.m.oi],[g.m.Yq,g.m.Yq],[g.m.Zq,g.m.Zq]];
g.m.aa=function(a){g.m.rh=Object.create(null);g.m.Qs=Object.create(null);g.m.vd?g.m.vd.reset():g.m.vd=new g.Qd(g.m.hr);g.m.vd.Pa=a.Pa;for(var c=[],d=g.N.XC(a),e=0;e<d.length;e++)c.push(od(d[e],g.Qd.Eq));a=g.N.Ew(a);for(e=0;e<a.length;e++)c.push(od(a[e].ua(),g.N.xb));c.length&&(g.m.rh.variables="var "+c.join(", ")+";")};g.m.finish=function(a){var c=[],d;for(d in g.m.rh)c.push(g.m.rh[d]);delete g.m.rh;delete g.m.Qs;g.m.vd.reset();return c.join("\n\n")+"\n\n\n"+a};g.m.Uz=function(a){return a+";\n"};
g.m.Nz=function(a){a=a.replace(/\\/g,"\\\\").replace(/\n/g,"\\\n").replace(/'/g,"\\'");return"'"+a+"'"};g.m.KL=function(a){return a.split(/\n/g).map(g.m.Nz).join(" + '\\n' +\n")};
g.m.Yp=function(a,c,d){var e="";if(!a.L||!a.L.ga){var f=a.te.text;f&&(f=g.g.ab.sA(f,g.m.TA-3),e+=he(f+"\n","// "));for(var h=0;h<a.P.length;h++)if(a.P[h].type==g.Ua){var k=C(a.P[h].connection);if(k){f=[];k=p(k,!0);for(var l=0;l<k.length;l++){var m=k[l].te.text;m&&f.push(m)}f.length&&f.push("");(f=f.join("\n"))&&(e+=he(f,"// "))}}}a=a.V&&C(a.V);d=d?"":ge(g.m,a);return e+c+d};
g.m.Kf=function(a,c,d,e,f){d=d||0;f=f||g.m.xd;a.v.options.Ge&&d--;var h=a.v.options.Ge?"1":"0";a=0<d?T(a,c,g.m.oi)||h:0>d?T(a,c,g.m.ek)||h:e?T(a,c,g.m.Dl)||h:T(a,c,f)||h;if(g.Hh(a))a=Number(a)+d,e&&(a=-a);else{if(0<d){a=a+" + "+d;var k=g.m.oi}else 0>d&&(a=a+" - "+-d,k=g.m.ek);e&&(a=d?"-("+a+")":"-"+a,k=g.m.Dl);k=Math.floor(k);f=Math.floor(f);k&&f>=k&&(a="("+a+")")}return a};g.m.Ft={};g.m.lists_create_empty=function(){return["[]",g.m.eh]};g.m.lists_create_with=function(a){for(var c=Array(a.jf),d=0;d<a.jf;d++)c[d]=T(a,"ADD"+d,g.m.ad)||"null";return["["+c.join(", ")+"]",g.m.eh]};g.m.lists_repeat=function(a){var c=le("listsRepeat",["function "+g.m.le+"(value, n) {","  var array = [];","  for (var i = 0; i < n; i++) {","    array[i] = value;","  }","  return array;","}"]),d=T(a,"ITEM",g.m.ad)||"null";a=T(a,"NUM",g.m.ad)||"0";return[c+"("+d+", "+a+")",g.m.yb]};
g.m.lists_length=function(a){return[(T(a,"VALUE",g.m.Mb)||"[]")+".length",g.m.Mb]};g.m.lists_isEmpty=function(a){return["!"+(T(a,"VALUE",g.m.Mb)||"[]")+".length",g.m.Bl]};g.m.lists_indexOf=function(a){var c="FIRST"==z(a,"END")?"indexOf":"lastIndexOf",d=T(a,"FIND",g.m.xd)||"''";c=(T(a,"VALUE",g.m.Mb)||"[]")+"."+c+"("+d+")";return a.v.options.Ge?[c+" + 1",g.m.oi]:[c,g.m.yb]};
g.m.lists_getIndex=function(a){var c=z(a,"MODE")||"GET",d=z(a,"WHERE")||"FROM_START",e=T(a,"VALUE","RANDOM"==d?g.m.ad:g.m.Mb)||"[]";switch(d){case "FIRST":if("GET"==c)return[e+"[0]",g.m.Mb];if("GET_REMOVE"==c)return[e+".shift()",g.m.Mb];if("REMOVE"==c)return e+".shift();\n";break;case "LAST":if("GET"==c)return[e+".slice(-1)[0]",g.m.Mb];if("GET_REMOVE"==c)return[e+".pop()",g.m.Mb];if("REMOVE"==c)return e+".pop();\n";break;case "FROM_START":a=g.m.Kf(a,"AT");if("GET"==c)return[e+"["+a+"]",g.m.Mb];if("GET_REMOVE"==
c)return[e+".splice("+a+", 1)[0]",g.m.yb];if("REMOVE"==c)return e+".splice("+a+", 1);\n";break;case "FROM_END":a=g.m.Kf(a,"AT",1,!0);if("GET"==c)return[e+".slice("+a+")[0]",g.m.yb];if("GET_REMOVE"==c)return[e+".splice("+a+", 1)[0]",g.m.yb];if("REMOVE"==c)return e+".splice("+a+", 1);";break;case "RANDOM":e=le("listsGetRandomItem",["function "+g.m.le+"(list, remove) {","  var x = Math.floor(Math.random() * list.length);","  if (remove) {","    return list.splice(x, 1)[0];","  } else {","    return list[x];",
"  }","}"])+"("+e+", "+("GET"!=c)+")";if("GET"==c||"GET_REMOVE"==c)return[e,g.m.yb];if("REMOVE"==c)return e+";\n"}throw Error("Unhandled combination (lists_getIndex).");};
g.m.lists_setIndex=function(a){function c(){if(d.match(/^\w+$/))return"";var k=pd(g.m.vd,"tmpList",g.N.xb),l="var "+k+" = "+d+";\n";d=k;return l}var d=T(a,"LIST",g.m.Mb)||"[]",e=z(a,"MODE")||"GET",f=z(a,"WHERE")||"FROM_START",h=T(a,"TO",g.m.pi)||"null";switch(f){case "FIRST":if("SET"==e)return d+"[0] = "+h+";\n";if("INSERT"==e)return d+".unshift("+h+");\n";break;case "LAST":if("SET"==e)return a=c(),a+(d+"["+d+".length - 1] = "+h+";\n");if("INSERT"==e)return d+".push("+h+");\n";break;case "FROM_START":f=
g.m.Kf(a,"AT");if("SET"==e)return d+"["+f+"] = "+h+";\n";if("INSERT"==e)return d+".splice("+f+", 0, "+h+");\n";break;case "FROM_END":f=g.m.Kf(a,"AT",1,!1,g.m.ek);a=c();if("SET"==e)return a+(d+"["+d+".length - "+f+"] = "+h+";\n");if("INSERT"==e)return a+(d+".splice("+d+".length - "+f+", 0, "+h+");\n");break;case "RANDOM":a=c();f=pd(g.m.vd,"tmpX",g.N.xb);a+="var "+f+" = Math.floor(Math.random() * "+d+".length);\n";if("SET"==e)return a+(d+"["+f+"] = "+h+";\n");if("INSERT"==e)return a+(d+".splice("+f+
", 0, "+h+");\n")}throw Error("Unhandled combination (lists_setIndex).");};g.m.Ft.FE=function(a,c,d){return"FIRST"==c?"0":"FROM_END"==c?a+".length - 1 - "+d:"LAST"==c?a+".length - 1":d};
g.m.lists_getSublist=function(a){var c=T(a,"LIST",g.m.Mb)||"[]",d=z(a,"WHERE1"),e=z(a,"WHERE2");if("FIRST"==d&&"LAST"==e)c+=".slice(0)";else if(c.match(/^\w+$/)||"FROM_END"!=d&&"FROM_START"==e){switch(d){case "FROM_START":var f=g.m.Kf(a,"AT1");break;case "FROM_END":f=g.m.Kf(a,"AT1",1,!1,g.m.ek);f=c+".length - "+f;break;case "FIRST":f="0";break;default:throw Error("Unhandled option (lists_getSublist).");}switch(e){case "FROM_START":a=g.m.Kf(a,"AT2",1);break;case "FROM_END":a=g.m.Kf(a,"AT2",0,!1,g.m.ek);
a=c+".length - "+a;break;case "LAST":a=c+".length";break;default:throw Error("Unhandled option (lists_getSublist).");}c=c+".slice("+f+", "+a+")"}else{f=g.m.Kf(a,"AT1");a=g.m.Kf(a,"AT2");var h=g.m.Ft.FE,k={FIRST:"First",LAST:"Last",FROM_START:"FromStart",FROM_END:"FromEnd"};c=le("subsequence"+k[d]+k[e],["function "+g.m.le+"(sequence"+("FROM_END"==d||"FROM_START"==d?", at1":"")+("FROM_END"==e||"FROM_START"==e?", at2":"")+") {","  var start = "+h("sequence",d,"at1")+";","  var end = "+h("sequence",e,
"at2")+" + 1;","  return sequence.slice(start, end);","}"])+"("+c+("FROM_END"==d||"FROM_START"==d?", "+f:"")+("FROM_END"==e||"FROM_START"==e?", "+a:"")+")"}return[c,g.m.yb]};
g.m.lists_sort=function(a){var c=T(a,"LIST",g.m.yb)||"[]",d="1"===z(a,"DIRECTION")?1:-1;a=z(a,"TYPE");var e=le("listsGetSortCompare",["function "+g.m.le+"(type, direction) {","  var compareFuncs = {",'    "NUMERIC": function(a, b) {',"        return Number(a) - Number(b); },",'    "TEXT": function(a, b) {',"        return a.toString() > b.toString() ? 1 : -1; },",'    "IGNORE_CASE": function(a, b) {',"        return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },","  };","  var compare = compareFuncs[type];",
"  return function(a, b) { return compare(a, b) * direction; }","}"]);return[c+".slice().sort("+e+'("'+a+'", '+d+"))",g.m.yb]};g.m.lists_split=function(a){var c=T(a,"INPUT",g.m.Mb),d=T(a,"DELIM",g.m.xd)||"''";a=z(a,"MODE");if("SPLIT"==a)c||(c="''"),a="split";else if("JOIN"==a)c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+d+")",g.m.yb]};g.m.lists_reverse=function(a){return[(T(a,"LIST",g.m.yb)||"[]")+".slice().reverse()",g.m.yb]};g.m.vF={};g.m.controls_if=function(a){var c=0,d="";g.m.yd&&(d+=S(g.m.yd,a));do{var e=T(a,"IF"+c,g.m.xd)||"false";var f=ie(a,"DO"+c);g.m.Qc&&(f=he(S(g.m.Qc,a),g.m.kd)+f);d+=(0<c?" else ":"")+"if ("+e+") {\n"+f+"}";++c}while(E(a,"IF"+c));if(E(a,"ELSE")||g.m.Qc)f=ie(a,"ELSE"),g.m.Qc&&(f=he(S(g.m.Qc,a),g.m.kd)+f),d+=" else {\n"+f+"}";return d+"\n"};g.m.controls_ifelse=g.m.controls_if;
g.m.logic_compare=function(a){var c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[z(a,"OP")],d="=="==c||"!="==c?g.m.Yv:g.m.iC,e=T(a,"A",d)||"0";a=T(a,"B",d)||"0";return[e+" "+c+" "+a,d]};g.m.logic_operation=function(a){var c="AND"==z(a,"OP")?"&&":"||",d="&&"==c?g.m.Yq:g.m.Zq,e=T(a,"A",d);a=T(a,"B",d);if(e||a){var f="&&"==c?"true":"false";e||(e=f);a||(a=f)}else a=e="false";return[e+" "+c+" "+a,d]};g.m.logic_negate=function(a){var c=g.m.Bl;return["!"+(T(a,"BOOL",c)||"true"),c]};
g.m.logic_boolean=function(a){return["TRUE"==z(a,"BOOL")?"true":"false",g.m.eh]};g.m.logic_null=function(){return["null",g.m.eh]};g.m.logic_ternary=function(a){var c=T(a,"IF",g.m.oo)||"false",d=T(a,"THEN",g.m.oo)||"null";a=T(a,"ELSE",g.m.oo)||"null";return[c+" ? "+d+" : "+a,g.m.oo]};g.m.xF={};g.m.controls_repeat_ext=function(a){var c=B(a,"TIMES")?String(Number(z(a,"TIMES"))):T(a,"TIMES",g.m.pi)||"0",d=ie(a,"DO");d=je(d,a);a="";var e=pd(g.m.vd,"count",g.N.xb),f=c;c.match(/^\w+$/)||g.Hh(c)||(f=pd(g.m.vd,"repeat_end",g.N.xb),a+="var "+f+" = "+c+";\n");return a+("for (var "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")};g.m.controls_repeat=g.m.controls_repeat_ext;
g.m.controls_whileUntil=function(a){var c="UNTIL"==z(a,"MODE"),d=T(a,"BOOL",c?g.m.Bl:g.m.xd)||"false",e=ie(a,"DO");e=je(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"};
g.m.controls_for=function(a){var c=od(z(a,"VAR"),g.N.xb),d=T(a,"FROM",g.m.pi)||"0",e=T(a,"TO",g.m.pi)||"0",f=T(a,"BY",g.m.pi)||"1",h=ie(a,"DO");h=je(h,a);if(g.Hh(d)&&g.Hh(e)&&g.Hh(f)){var k=Number(d)<=Number(e);a="for ("+c+" = "+d+"; "+c+(k?" <= ":" >= ")+e+"; "+c;c=Math.abs(Number(f));a=(1==c?a+(k?"++":"--"):a+((k?" += ":" -= ")+c))+(") {\n"+h+"}\n")}else a="",k=d,d.match(/^\w+$/)||g.Hh(d)||(k=pd(g.m.vd,c+"_start",g.N.xb),a+="var "+k+" = "+d+";\n"),d=e,e.match(/^\w+$/)||g.Hh(e)||(d=pd(g.m.vd,c+"_end",
g.N.xb),a+="var "+d+" = "+e+";\n"),e=pd(g.m.vd,c+"_inc",g.N.xb),a+="var "+e+" = ",a=g.Hh(f)?a+(Math.abs(f)+";\n"):a+("Math.abs("+f+");\n"),a=a+("if ("+k+" > "+d+") {\n")+(g.m.kd+e+" = -"+e+";\n"),a+="}\n",a+="for ("+c+" = "+k+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+h+"}\n";return a};
g.m.controls_forEach=function(a){var c=od(z(a,"VAR"),g.N.xb),d=T(a,"LIST",g.m.pi)||"[]",e=ie(a,"DO");e=je(e,a);a="";var f=d;d.match(/^\w+$/)||(f=pd(g.m.vd,c+"_list",g.N.xb),a+="var "+f+" = "+d+";\n");d=pd(g.m.vd,c+"_index",g.N.xb);e=g.m.kd+c+" = "+f+"["+d+"];\n"+e;return a+("for (var "+d+" in "+f+") {\n"+e+"}\n")};
g.m.controls_flow_statements=function(a){var c="";g.m.yd&&(c+=S(g.m.yd,a));g.m.Qc&&(c+=S(g.m.Qc,a));if(g.m.yd){var d=g.la.ne.Vn.qy(a);d&&!d.Zh&&(c+=S(g.m.yd,d))}switch(z(a,"FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");};g.m.td={};g.m.math_number=function(a){a=Number(z(a,"NUM"));return[a,0<=a?g.m.eh:g.m.Dl]};g.m.math_arithmetic=function(a){var c={ADD:[" + ",g.m.oi],MINUS:[" - ",g.m.ek],MULTIPLY:[" * ",g.m.$q],DIVIDE:[" / ",g.m.Al],POWER:[null,g.m.ad]}[z(a,"OP")],d=c[0];c=c[1];var e=T(a,"A",c)||"0";a=T(a,"B",c)||"0";return d?[e+d+a,c]:["Math.pow("+e+", "+a+")",g.m.yb]};
g.m.math_single=function(a){var c=z(a,"OP");if("NEG"==c)return a=T(a,"NUM",g.m.Dl)||"0","-"==a[0]&&(a=" "+a),["-"+a,g.m.Dl];a="SIN"==c||"COS"==c||"TAN"==c?T(a,"NUM",g.m.Al)||"0":T(a,"NUM",g.m.xd)||"0";switch(c){case "ABS":var d="Math.abs("+a+")";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+a+")";break;case "POW10":d="Math.pow(10,"+a+")";break;case "ROUND":d="Math.round("+a+")";break;case "ROUNDUP":d="Math.ceil("+a+")";break;case "ROUNDDOWN":d=
"Math.floor("+a+")";break;case "SIN":d="Math.sin("+a+" / 180 * Math.PI)";break;case "COS":d="Math.cos("+a+" / 180 * Math.PI)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.PI)"}if(d)return[d,g.m.yb];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.PI * 180";break;case "ACOS":d="Math.acos("+a+") / Math.PI * 180";break;case "ATAN":d="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,g.m.Al]};
g.m.math_constant=function(a){return{PI:["Math.PI",g.m.Mb],E:["Math.E",g.m.Mb],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",g.m.Al],SQRT2:["Math.SQRT2",g.m.Mb],SQRT1_2:["Math.SQRT1_2",g.m.Mb],INFINITY:["Infinity",g.m.eh]}[z(a,"CONSTANT")]};
g.m.math_number_property=function(a){var c=T(a,"NUMBER_TO_CHECK",g.m.Cl)||"0",d=z(a,"PROPERTY");if("PRIME"==d){var e=le("mathIsPrime",["function "+g.m.le+"(n) {","  // https://en.wikipedia.org/wiki/Primality_test#Naive_methods","  if (n == 2 || n == 3) {","    return true;","  }","  // False if n is NaN, negative, is 1, or not whole.","  // And false if n is divisible by 2 or 3.","  if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {","    return false;","  }","  // Check all the numbers of form 6k +/- 1, up to sqrt(n).",
"  for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {","    if (n % (x - 1) == 0 || n % (x + 1) == 0) {","      return false;","    }","  }","  return true;","}"])+"("+c+")";return[e,g.m.yb]}switch(d){case "EVEN":e=c+" % 2 == 0";break;case "ODD":e=c+" % 2 == 1";break;case "WHOLE":e=c+" % 1 == 0";break;case "POSITIVE":e=c+" > 0";break;case "NEGATIVE":e=c+" < 0";break;case "DIVISIBLE_BY":a=T(a,"DIVISOR",g.m.Cl)||"0",e=c+" % "+a+" == 0"}return[e,g.m.Yv]};
g.m.math_change=function(a){var c=T(a,"DELTA",g.m.oi)||"0";a=od(z(a,"VAR"),g.N.xb);return a+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+c+";\n"};g.m.math_round=g.m.math_single;g.m.math_trig=g.m.math_single;
g.m.math_on_list=function(a){var c=z(a,"OP");switch(c){case "SUM":a=T(a,"LIST",g.m.Mb)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=T(a,"LIST",g.m.ad)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=T(a,"LIST",g.m.ad)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":c=le("mathMean",["function "+g.m.le+"(myList) {","  return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]);a=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;case "MEDIAN":c=
le("mathMedian",["function "+g.m.le+"(myList) {","  var localList = myList.filter(function (x) {return typeof x == 'number';});","  if (!localList.length) return null;","  localList.sort(function(a, b) {return b - a;});","  if (localList.length % 2 == 0) {","    return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;","  } else {","    return localList[(localList.length - 1) / 2];","  }","}"]);a=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;case "MODE":c=le("mathModes",
["function "+g.m.le+"(values) {","  var modes = [];","  var counts = [];","  var maxCount = 0;","  for (var i = 0; i < values.length; i++) {","    var value = values[i];","    var found = false;","    var thisCount;","    for (var j = 0; j < counts.length; j++) {","      if (counts[j][0] === value) {","        thisCount = ++counts[j][1];","        found = true;","        break;","      }","    }","    if (!found) {","      counts.push([value, 1]);","      thisCount = 1;","    }","    maxCount = Math.max(thisCount, maxCount);",
"  }","  for (var j = 0; j < counts.length; j++) {","    if (counts[j][1] == maxCount) {","        modes.push(counts[j][0]);","    }","  }","  return modes;","}"]);a=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=le("mathStandardDeviation",["function "+g.m.le+"(numbers) {","  var n = numbers.length;","  if (!n) return null;","  var mean = numbers.reduce(function(x, y) {return x + y;}) / n;","  var variance = 0;","  for (var j = 0; j < n; j++) {","    variance += Math.pow(numbers[j] - mean, 2);",
"  }","  variance = variance / n;","  return Math.sqrt(variance);","}"]);a=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;case "RANDOM":c=le("mathRandomList",["function "+g.m.le+"(list) {","  var x = Math.floor(Math.random() * list.length);","  return list[x];","}"]);a=T(a,"LIST",g.m.xd)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,g.m.yb]};g.m.math_modulo=function(a){var c=T(a,"DIVIDEND",g.m.Cl)||"0";a=T(a,"DIVISOR",g.m.Cl)||"0";return[c+" % "+a,g.m.Cl]};
g.m.math_constrain=function(a){var c=T(a,"VALUE",g.m.ad)||"0",d=T(a,"LOW",g.m.ad)||"0";a=T(a,"HIGH",g.m.ad)||"Infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",g.m.yb]};
g.m.math_random_int=function(a){var c=T(a,"FROM",g.m.ad)||"0";a=T(a,"TO",g.m.ad)||"0";return[le("mathRandomInt",["function "+g.m.le+"(a, b) {","  if (a > b) {","    // Swap a and b to ensure a is smaller.","    var c = a;","    a = b;","    b = c;","  }","  return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+c+", "+a+")",g.m.yb]};g.m.math_random_float=function(){return["Math.random()",g.m.yb]};
g.m.math_atan2=function(a){var c=T(a,"X",g.m.ad)||"0";return["Math.atan2("+(T(a,"Y",g.m.ad)||"0")+", "+c+") / Math.PI * 180",g.m.Al]};g.m.qG={};g.m.procedures_defreturn=function(a){var c=od(z(a,"NAME"),g.Ea.xb),d="";g.m.yd&&(d+=S(g.m.yd,a));g.m.Qc&&(d+=S(g.m.Qc,a));d&&(d=he(d,g.m.kd));var e="";g.m.ho&&(e=he(S(g.m.ho,a),g.m.kd));var f=ie(a,"STACK"),h=T(a,"RETURN",g.m.xd)||"",k="";f&&h&&(k=d);h&&(h=g.m.kd+"return "+h+";\n");for(var l=[],m=0;m<a.Fa.length;m++)l[m]=od(a.Fa[m],g.N.xb);d="function "+c+"("+l.join(", ")+") {\n"+d+e+f+k+h+"}";d=g.m.Yp(a,d);g.m.rh["%"+c]=d;return null};g.m.procedures_defnoreturn=g.m.procedures_defreturn;
g.m.procedures_callreturn=function(a){for(var c=od(z(a,"NAME"),g.Ea.xb),d=[],e=0;e<a.Fa.length;e++)d[e]=T(a,"ARG"+e,g.m.ad)||"null";return[c+"("+d.join(", ")+")",g.m.yb]};g.m.procedures_callnoreturn=function(a){return g.m.procedures_callreturn(a)[0]+";\n"};g.m.procedures_ifreturn=function(a){var c="if ("+(T(a,"CONDITION",g.m.xd)||"false")+") {\n";g.m.Qc&&(c+=he(S(g.m.Qc,a),g.m.kd));a.Bh?(a=T(a,"VALUE",g.m.xd)||"null",c+=g.m.kd+"return "+a+";\n"):c+=g.m.kd+"return;\n";return c+"}\n"};g.m.cH={};g.m.variables_get=function(a){return[od(z(a,"VAR"),g.N.xb),g.m.eh]};g.m.variables_set=function(a){var c=T(a,"VALUE",g.m.pi)||"0";return od(z(a,"VAR"),g.N.xb)+" = "+c+";\n"};var me;g.W.music_pitch={aa:function(){K(N(this),new Xd("7"),"PITCH");this.Ke(!0,"Number");this.mf(g.h.MATH_HUE);this.vb(P("Music_pitchTooltip"))}};g.m.music_pitch=function(a){return[Number(z(a,"PITCH")),g.m.eh]};
g.W.music_note={aa:function(){var a=[[{src:"music/note1.png",width:9,height:19,alt:"whole"},"1"],[{src:"music/note0.5.png",width:9,height:19,alt:"half"},"0.5"],[{src:"music/note0.25.png",width:9,height:19,alt:"quarter"},"0.25"],[{src:"music/note0.125.png",width:9,height:19,alt:"eighth"},"0.125"],[{src:"music/note0.0625.png",width:9,height:19,alt:"sixteenth"},"0.0625"]];10>O&&(a.shift(),a.pop());sc(this,{message0:P("Music_playNote"),args0:[{type:"field_dropdown",name:"DURATION",options:a},{type:"input_value",
name:"PITCH",check:"Number"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:160,tooltip:P("Music_playNoteTooltip")})}};g.m.music_note=function(a){var c=T(a,"PITCH",g.m.ad)||"7";return"play("+Number(z(a,"DURATION"))+", "+c+", 'block_id_"+a.id+"');\n"};g.W.music_rest_whole={aa:function(){sc(this,{message0:P("Music_rest"),args0:[{type:"field_image",src:"music/rest1.png",width:10,height:20,alt:"-"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:160,tooltip:P("Music_restWholeTooltip")})}};
g.m.music_rest_whole=function(a){return"rest(1, 'block_id_"+a.id+"');\n"};
g.W.music_rest={aa:function(){sc(this,{message0:P("Music_rest"),args0:[{type:"field_dropdown",name:"DURATION",options:[[{src:"music/rest1.png",width:10,height:20,alt:"whole"},"1"],[{src:"music/rest0.5.png",width:10,height:20,alt:"half"},"0.5"],[{src:"music/rest0.25.png",width:10,height:20,alt:"quarter"},"0.25"],[{src:"music/rest0.125.png",width:10,height:20,alt:"eighth"},"0.125"],[{src:"music/rest0.0625.png",width:10,height:20,alt:"sixteenth"},"0.0625"]]}],inputsInline:!0,previousStatement:null,nextStatement:null,
colour:160,tooltip:P("Music_restTooltip")})}};g.m.music_rest=function(a){return"rest("+Number(z(a,"DURATION"))+", 'block_id_"+a.id+"');\n"};
g.W.music_instrument={aa:function(){sc(this,{message0:P("Music_setInstrument"),args0:[{type:"field_dropdown",name:"INSTRUMENT",options:[[P("Music_piano"),"piano"],[P("Music_trumpet"),"trumpet"],[P("Music_banjo"),"banjo"],[P("Music_violin"),"violin"],[P("Music_guitar"),"guitar"],[P("Music_flute"),"flute"],[P("Music_drum"),"drum"],[P("Music_choir"),"choir"]]}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:160,tooltip:P("Music_setInstrumentTooltip")})}};
g.m.music_instrument=function(a){return"setInstrument("+g.m.Nz(z(a,"INSTRUMENT"))+", 'block_id_"+a.id+"');\n"};g.W.music_start={aa:function(){sc(this,{message0:P("Music_start"),args0:[{type:"field_image",src:"music/play.png",width:17,height:17,alt:"\u25b6"}],message1:"%1",args1:[{type:"input_statement",name:"STACK"}],colour:0,tooltip:P("Music_startTooltip")})}};g.m.music_start=function(a){U++;a=ie(a,"STACK");g.m.rh["%start"+U]="function start"+U+"() {\n"+a+"}\n";return null};
10>O&&(g.W.procedures_defnoreturn.aa=function(){var a=new g.pb("",g.Ea.uu);Vd(a);K(K(K(N(this),g.h.PROCEDURES_DEFNORETURN_TITLE),a,"NAME"),"","PARAMS");this.mf(g.h.PROCEDURES_HUE);this.vb(g.h.PROCEDURES_DEFNORETURN_TOOLTIP);this.Ec=g.h.PROCEDURES_DEFNORETURN_HELPURL;this.Fa=[];this.$b=[];this.Yh(!0);this.$f=null},delete g.W.procedures_defreturn,delete g.W.procedures_ifreturn);var ne=ne||{};function oe(a,c){function d(){}d.prototype=c.prototype;a.w=c.prototype;a.prototype=new d;a.prototype.constructor=a;a.nL=function(e,f,h){return c.prototype[f].apply(e,Array.prototype.slice.call(arguments,2))}}if(!pe){var pe,qe="";"undefined"!==typeof navigator&&navigator&&"string"==typeof navigator.userAgent&&(qe=navigator.userAgent);var re=0==qe.indexOf("Opera");pe={IL:{GI:"ScriptEngine"in window},KJ:re,lg:!re&&-1!=qe.indexOf("MSIE"),Dr:!re&&-1!=qe.indexOf("WebKit")}}if(!se)var se={};
if(!te)var te={};if(!ue)var ue={};if(!ve)var ve={};if(!we)var we={};if(!xe)var xe={};var ye=ne.OH?{QL:!0}:{};function ze(){throw Error("Do not instantiate directly");}ze.prototype.bx=null;ze.prototype.toString=function(){return this.content};function Ae(a){if(null!=a)switch(a.bx){case 1:return 1;case -1:return-1;case 0:return 0}return null}function Be(){ze.call(this)}oe(Be,ze);Be.prototype.DD=ye;function V(a){return null!=a&&a.DD===ye?a:Ce(String(String(a)).replace(De,Ee),Ae(a))}
var Ce=function(a){function c(){}c.prototype=a.prototype;return function(d,e){var f=new c;f.content=String(d);void 0!==e&&(f.bx=e);return f}}(Be),Fe={"\x00":"&#0;",'"':"&quot;","&":"&amp;","'":"&#39;","<":"&lt;",">":"&gt;","\t":"&#9;","\n":"&#10;","\x0B":"&#11;","\f":"&#12;","\r":"&#13;"," ":"&#32;","-":"&#45;","/":"&#47;","=":"&#61;","`":"&#96;","\u0085":"&#133;","\u00a0":"&#160;","\u2028":"&#8232;","\u2029":"&#8233;"};function Ee(a){return Fe[a]}var De=/[\x00\x22\x26\x27\x3c\x3e]/g;function Ie(){return'<div class="farSide" style="padding: 1ex 3ex 0"><button class="secondary" onclick="BlocklyDialogs.hideDialog(true)">OK</button></div>'};function Je(){for(var a='<div style="display: none"><span id="Games_name">Jogos do Blockly</span><span id="Games_puzzle">Quebra-Cabe\u00e7a</span><span id="Games_maze">Labirinto</span><span id="Games_bird">P\u00e1ssaro</span><span id="Games_turtle">Tartaruga</span><span id="Games_movie">Filme</span><span id="Games_music">M\u00fasica</span><span id="Games_pondTutor">Tutor de Lagoa</span><span id="Games_pond">Lagoa</span><span id="Games_genetics">Gen\u00e9ticas</span><span id="Games_linesOfCode1">Voc\u00ea solucionou esse n\u00edvel com uma linha de JavaScript:</span><span id="Games_linesOfCode2">Voc\u00ea solucionou esse n\u00edvel com %1 linhas de JavaScript:</span><span id="Games_nextLevel">Voc\u00ea esta preparado para o n\u00edvel %1?</span><span id="Games_finalLevel">Voc\u00ea esta preparado para o pr\u00f3ximo desafio?</span><span id="Games_submitTitle">T\u00edtulo:</span><span id="Games_linkTooltip">Salvar e ligar aos blocos.</span><span id="Games_runTooltip">Rodar o programa que voc\u00ea escreveu.</span><span id="Games_runProgram">Executar o programa</span><span id="Games_resetTooltip">Parar a execu\u00e7\u00e3o do programa e resetar o nivel.</span><span id="Games_resetProgram">Reiniciar</span><span id="Games_help">Ajuda</span><span id="Games_dialogOk">OK</span><span id="Games_dialogCancel">Cancelar</span><span id="Games_catLogic">L\u00f3gica</span><span id="Games_catLoops">La\u00e7os</span><span id="Games_catMath">Matem\u00e1tica</span><span id="Games_catText">Texto</span><span id="Games_catLists">Listas</span><span id="Games_catColour">Cor</span><span id="Games_catVariables">Vari\u00e1veis</span><span id="Games_catProcedures">Fun\u00e7\u00f5es</span><span id="Games_httpRequestError">Houve um problema com a requisi\u00e7\u00e3o.</span><span id="Games_linkAlert">Compartilhe seus blocos com este link:\n\n%1</span><span id="Games_hashError">Desculpe, \'%1\' n\u00e3o corresponde a um programa salvo.</span><span id="Games_xmlError">N\u00e3o foi poss\u00edvel carregar seu arquivo salvo. Talvez ele tenha sido criado com uma vers\u00e3o diferente do Blockly?</span><span id="Games_submitted">Agradecemos pelo programa! Se a nossa equipa gostar dele, este ser\u00e1 publicado na galeria por n\u00f3s dentro de alguns dias.</span><span id="Games_listVariable">lista</span><span id="Games_textVariable">texto</span><span id="Games_breakLink">Quando voc\u00ea come\u00e7ar a editar o JavaScript, voc\u00ea n\u00e3o poder\u00e1 mais voltar a editar os blocos. Voc\u00ea tem certeza?</span><span id="Games_blocks">Blocos</div></div><div style="display: none"><span id="Music_playNoteTooltip">Toque uma nota musical com a dura\u00e7\u00e3o e altura \\nespec\u00edficas. </span><span id="Music_playNote">tocar %1 nota %2</span><span id="Music_restTooltip">Aguarde pela dura\u00e7\u00e3o especificada.</span><span id="Music_restWholeTooltip">Aguarde por uma semibreve.</span><span id="Music_rest">resta %1</span><span id="Music_setInstrumentTooltip">Alterne para o instrumento espec\u00edfico ao tocar \\nas notas musicais posteriores. </span><span id="Music_setInstrument">ajustar o instrumento para %1</span><span id="Music_startTooltip">Execute os blocos dentro quando o bot\u00e3o de \\n\'Executar programa\' for clicado. </span><span id="Music_start">quando %1 \u00e9 clicado</span><span id="Music_pitchTooltip">Uma nota (C4 \u00e9 7).</span><span id="Music_firstPart">primeira parte</span><span id="Music_piano">piano</span><span id="Music_trumpet">trompete</span><span id="Music_banjo">banjo</span><span id="Music_violin">violino</span><span id="Music_guitar">guitarra</span><span id="Music_flute">flauta</span><span id="Music_drum">tambor</span><span id="Music_choir">coro</span><span id="Music_submitDisabled">Execute o seu programa at\u00e9 ele parar. Ent\u00e3o poder\u00e1 enviar a sua m\u00fasica para a galeria.</span></div><table width="100%"><tr><td><h1><span id="title">'+
((ud?'<a href="index.html?lang='+V(sd)+'">':'<a href="./?lang='+V(sd)+'">')+"Jogos do Blockly</a> : "+V({appName:"M\u00fasica"}.appName)+"</span>"),c=" &nbsp; ",d=1;11>d;d++)c+=" "+(d==O?'<span class="level_number level_done" id="level'+V(d)+'">'+V(d)+"</span>":10==d?'<a class="level_number" id="level'+V(d)+'" href="?lang='+V(sd)+"&level="+V(d)+V("")+'">'+V(d)+"</a>":'<a class="level_dot" id="level'+V(d)+'" href="?lang='+V(sd)+"&level="+V(d)+V("")+'"></a>');return a+c+'</h1></td><td class="farSide"><select id="languageMenu"></select>&nbsp;<button id="linkButton" title="Salvar e ligar aos blocos."><img src="common/1x1.gif" class="link icon21"></button>&nbsp;<button id="helpButton">Ajuda</button></td></tr></table><div id="paddingBox"></div><div id="staveBox"></div><div id="musicBox"><div id="musicContainer"></div></div><table style="padding-top: 1em;"><tr><td style="width: 190px; text-align: center; vertical-align: top;"><svg id="slider" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="150" height="50">\x3c!-- Slow icon. --\x3e<clipPath id="slowClipPath"><rect width=26 height=12 x=5 y=14 /></clipPath><image xlink:href="music/icons.png" height=42 width=84 x=-21 y=-10 clip-path="url(#slowClipPath)" />\x3c!-- Fast icon. --\x3e<clipPath id="fastClipPath"><rect width=26 height=16 x=120 y=10 /></clipPath><image xlink:href="music/icons.png" height=42 width=84 x=120 y=-11 clip-path="url(#fastClipPath)" /></svg></td><td style="width: 15px;"><img id="spinner" style="visibility: hidden;" src="common/loading.gif" height=15 width=15></td><td style="width: 190px; text-align: center"><button id="runButton" class="primary" title="Rodar o programa que voc\u00ea escreveu."><img src="common/1x1.gif" class="run icon21"> Executar o programa</button><button id="resetButton" class="primary" style="display: none" title="Parar a execu\u00e7\u00e3o do programa e resetar o nivel."><img src="common/1x1.gif" class="stop icon21"> Reiniciar</button></td></tr></table>'+
(10!=O||ud?"":'<table style="padding-top: 1em; width: 400px;"><tr><td style="text-align: center;"><form action="/gallery" target="music-gallery"><input type="hidden" name="app" value="music"><input type="hidden" name="lang" value="'+V(sd)+'"><button type="submit" title="Abrir a galeria da m\u00fasica."><img src="common/1x1.gif" class="gallery icon21"> Ver a galeria</button></form></td><td style="text-align: center;"><button id="submitButton" title="Envie sua m\u00fasica para a galeria."><img src="common/1x1.gif" class="camera icon21"> Enviar para a galeria</button></td></tr></table><div id="galleryDialog" class="dialogHiddenContent"><form id="galleryForm" action="/gallery-api/submit" method="post" onsubmit="return false"><header>Envie sua m\u00fasica para a galeria.</header><canvas id="thumbnail" width="200" height="200"></canvas><input type="hidden" name="app" value="music"><input id="galleryThumb" type="hidden" name="thumb"><input id="galleryXml" type="hidden" name="xml"><div>T\u00edtulo: <input id="galleryTitle" type="text" name="title" required></div><footer>\x3c!--Legal disclaimer goes here if needed.--\x3e</footer><div class="farSide"><button id="galleryCancel" type="button">Cancelar</button><button id="galleryOk" class="secondary" type="submit">OK</button></div></form></div>')+
('<xml id="toolbox" style="display: none" xmlns="https://developers.google.com/blockly/xml">'+(10==O?'<category name="M\u00fasica"><block type="music_pitch"><field name="PITCH">7</field></block><block type="music_note"><field name="DURATION">0.25</field><value name="PITCH"><shadow type="music_pitch"><field name="PITCH">7</field></shadow></value></block><block type="music_rest"></block><block type="music_instrument"></block><block type="music_start" id="music_start"></block></category><category name="L\u00f3gica"><block type="controls_if"></block><block type="logic_compare"></block><block type="logic_operation"></block><block type="logic_negate"></block><block type="logic_boolean"></block><block type="logic_ternary"></block></category><category name="La\u00e7os"><block type="controls_repeat_ext"><value name="TIMES"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="controls_whileUntil"></block><block type="controls_for"><value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="TO"><shadow type="math_number"><field name="NUM">10</field></shadow></value><value name="BY"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="controls_forEach"></block><block type="controls_flow_statements"></block></category><category name="Matem\u00e1tica"><block type="math_number"></block><block type="math_arithmetic"><value name="A"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="B"><shadow type="math_number"><field name="NUM">1</field></shadow></value></block><block type="math_single"><value name="NUM"><shadow type="math_number"><field name="NUM">9</field></shadow></value></block><block type="math_number_property"><value name="NUMBER_TO_CHECK"><shadow type="math_number"><field name="NUM">0</field></shadow></value></block><block type="math_round"><value name="NUM"><shadow type="math_number"><field name="NUM">3.1</field></shadow></value></block><block type="math_modulo"><value name="DIVIDEND"><shadow type="math_number"><field name="NUM">64</field></shadow></value><value name="DIVISOR"><shadow type="math_number"><field name="NUM">10</field></shadow></value></block><block type="math_constrain"><value name="VALUE"><shadow type="math_number"><field name="NUM">50</field></shadow></value><value name="LOW"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="HIGH"><shadow type="math_number"><field name="NUM">100</field></shadow></value></block><block type="math_random_int"><value name="FROM"><shadow type="math_number"><field name="NUM">1</field></shadow></value><value name="TO"><shadow type="math_number"><field name="NUM">100</field></shadow></value></block><block type="math_random_float"></block></category><category name="Listas"><block type="lists_create_with"><mutation items="0"></mutation></block><block type="lists_create_with"></block><block type="lists_repeat"><value name="NUM"><shadow type="math_number"><field name="NUM">5</field></shadow></value></block><block type="lists_length"></block><block type="lists_isEmpty"></block><block type="lists_indexOf"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_getIndex"><value name="VALUE"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_setIndex"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_getSublist"><value name="LIST"><block type="variables_get"><field name="VAR">list</field></block></value></block><block type="lists_sort"></block><block type="lists_reverse"></block></category><sep></sep><category name="Vari\u00e1veis" custom="VARIABLE"></category><category name="Fun\u00e7\u00f5es" custom="PROCEDURE"></category>':
'<category name="M\u00fasica"><block type="music_note"><field name="DURATION">0.25</field><value name="PITCH"><shadow type="music_pitch"><field name="PITCH">7</field></shadow></value></block>'+(6<O?'<block type="music_rest_whole"></block>':"")+(5<O?'<block type="music_instrument"></block>':"")+(6<O?'<block type="music_start" id="music_start"></block>':"")+"</category>"+(1<O?'<category name="Fun\u00e7\u00f5es" custom="PROCEDURE"></category>':""))+'</xml><div id="blockly"></div><div id="dialogShadow" class="dialogAnimate"></div><div id="dialogBorder"></div><div id="dialog"></div><div id="dialogDone" class="dialogHiddenContent"><div style="font-size: large; margin: 1em;">Parab\u00e9ns!</div><div id="dialogLinesText" style="font-size: large; margin: 1em;"></div><pre id="containerCode"></pre><div id="dialogDoneText" style="font-size: large; margin: 1em;"></div><div id="dialogDoneButtons" class="farSide" style="padding: 1ex 3ex 0"><button id="doneCancel">Cancelar</button><button id="doneOk" class="secondary">OK</button></div></div><div id="dialogAbort" class="dialogHiddenContent">Este n\u00edvel \u00e9 extremamente dif\u00edcil. Voc\u00ea deseja pul\u00e1-lo e ir ao pr\u00f3ximo jogo? Voc\u00ea sempre pode voltar mais tarde.<div class="farSide" style="padding: 1ex 3ex 0"><button id="abortCancel">Cancelar</button><button id="abortOk" class="secondary">OK</button></div></div><div id="dialogStorage" class="dialogHiddenContent"><div id="containerStorage"></div>')+
(Ie()+'</div><div id="helpUseFunctions" class="dialogHiddenContent"><div style="padding-bottom: 0.7ex">A sua solu\u00e7\u00e3o funcionou, mas pode fazer melhor. Utilize as fun\u00e7\u00f5es para reduzir a quantidade de c\u00f3digo repetido.</div>')+Ie()+'</div><div id="helpUseInstruments" class="dialogHiddenContent"><div style="padding-bottom: 0.7ex">A m\u00fasica soar\u00e1 melhor se usar um instrumento diferente em cada bloco inicial.</div>'+Ie()+'</div><div id="help" class="dialogHiddenContent"><div style="padding-bottom: 0.7ex">'+
(1==O?"Componha as primeiras quatro notas de 'Fr\u00e8re Jacques'.<p>C4 - D4 - E4 - C4</p>":2==O?"Uma 'fun\u00e7\u00e3o' permite agrupar os blocos, e depois execut\u00e1-los mais de uma vez.<div id=\"sampleHelp2\" class=\"readonly\"></div>Crie uma fun\u00e7\u00e3o para tocar as quatro primeiras notas de 'Fr\u00e8re Jacques'. Execute essa fun\u00e7\u00e3o duas vezes. N\u00e3o acrescente novos blocos de notas.":3==O?'Crie uma segunda fun\u00e7\u00e3o para a pr\u00f3xima parte de \'Fr\u00e8re Jacques\'. A \u00faltima nota \u00e9 mais longa.<br><img src="music/note0.5.png" class="sampleNote">':
4==O?'Crie uma terceira fun\u00e7\u00e3o para a pr\u00f3xima parte de \'Fr\u00e8re Jacques\'. As quatro primeiras notas s\u00e3o mais curtas.<br><img src="music/note0.125.png" class="sampleNote">':5==O?"Complete toda a cantiga de 'Fr\u00e8re Jacques'.":6==O?'Este bloco novo permite que mude para outro instrumento.<div id="sampleHelp6" class="readonly"></div>Tocar a sua \u00e1ria com um violino.':7==O?'Este novo bloco acrescenta um temporizador silencioso.<div id="sampleHelp7" class="readonly"></div>Crie um segundo bloco inicial que tenha dois blocos silenciosos, e ent\u00e3o toque \'Fr\u00e8re Jacques\'.':
8==O?"Cada bloco inicial deve tocar 'Fr\u00e8re Jacques' duas vezes.":9==O?"Crie quatro blocos iniciais que toquem 'Fr\u00e8re Jacques' duas vezes. Acrescente o n\u00famero correto dos blocos silenciosos.":10==O?"Componha o que o que voc\u00ea quiser. Voc\u00ea tem uma grande quantidade de blocos novos que pode explorar. Divirta-se!"+(ud?"":'<br><br>Utilize o bot\u00e3o "Ver Galeria" para ver o que as outras pessoas compuseram. Se compor algo interessante, use o bot\u00e3o "Enviar para a Galeria" para publicar.'):
"")+"</div>"+Ie()+"</div>"};function Ke(a){var c=Le;this.LB=23;this.$j=18;this.Nq=132;this.wi=20;this.kb=.5;this.Mw=c;this.Kr=[];c=g.g.o.Hl;var d=document.createElementNS(c,"line");d.setAttribute("class","sliderTrack");d.setAttribute("x1",10);d.setAttribute("y1",35);d.setAttribute("x2",140);d.setAttribute("y2",35);a.appendChild(d);d=document.createElementNS(c,"rect");d.setAttribute("style","opacity: 0");d.setAttribute("x",10-this.wi);d.setAttribute("y",35-this.wi);d.setAttribute("width",130+2*this.wi);d.setAttribute("height",
2*this.wi);d.setAttribute("rx",this.wi);d.setAttribute("ry",this.wi);a.appendChild(d);this.XG=d;d=document.createElementNS(c,"path");d.setAttribute("class","sliderKnob");d.setAttribute("d","m 0,0 l -8,8 v 12 h 16 v -12 z");a.appendChild(d);this.Wy=d;c=document.createElementNS(c,"circle");c.setAttribute("style","opacity: 0");c.setAttribute("r",this.wi);c.setAttribute("cy",35);a.appendChild(c);this.yt=c;for(this.setValue(.5);a&&"svg"!=a.nodeName.toLowerCase();)a=a.parentNode;this.Sa=a;Me(this.yt,"mousedown",
this,this.Vy);Me(this.yt,"touchstart",this,this.Vy);Me(this.XG,"mousedown",this,this.sG);Me(this.Sa,"mouseup",null,Ne);Me(this.Sa,"touchend",null,Ne);Me(this.Sa,"mousemove",null,Oe);Me(this.Sa,"touchmove",null,Oe);Me(document,"mouseover",null,Pe)}var Qe=null,Re=0,Se=0;Ke.prototype.Vy=function(a){if("touchstart"==a.type){if(1!=a.changedTouches.length)return;Te(a)}Qe=this;Re=Ue(this,a).x;Se=0;var c=this.Wy.getAttribute("transform");c&&(c=c.match(/translate\(\s*([-\d.]+)/))&&(Se=Number(c[1]));a.preventDefault()};
function Ne(){Qe=null}function Pe(a){if(Qe){a=a.target;do if(a==Qe.Sa)return;while(a=a.parentNode);Qe=null}}function Oe(a){var c=Qe;if(c){if("touchmove"==a.type){if(1!=a.changedTouches.length)return;Te(a)}a=Ue(c,a).x-Re+Se;c.setValue((a-c.$j)/(c.Nq-c.$j))}}Ke.prototype.sG=function(a){if("touchstart"==a.type){if(1!=a.changedTouches.length)return;Te(a)}a=Ue(this,a).x;Ve(this,(a-this.$j)/(this.Nq-this.$j))};Ke.prototype.getValue=function(){return this.kb};
function Ve(a,c){function d(h){return function(){a.setValue(h*(c-e)/9+e)}}for(;a.Kr.length;)clearTimeout(a.Kr.pop());for(var e=a.getValue(),f=0;10>f;f++)a.Kr.push(setTimeout(d(f),200*f/10))}Ke.prototype.setValue=function(a){this.kb=g.g.td.Gi(a,0,1);a=this.$j+(this.Nq-this.$j)*this.kb;this.Wy.setAttribute("transform","translate("+a+","+this.LB+")");this.yt.setAttribute("cx",a);this.Mw&&this.Mw(this.kb)};
function Ue(a,c){var d=a.Sa.createSVGPoint();d.x=c.clientX;d.y=c.clientY;a=a.Sa.getScreenCTM().inverse();return d.matrixTransform(a)}function Me(a,c,d,e){a.addEventListener(c,function(f){e.apply(d,arguments)},!1)}function Te(a){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY};var Cd="music",We=0,U=0,Xe=0,Ye=0,Ze=null,$e=[],af=0,W=0,Y=null,bf=!1;
window.addEventListener("load",function(){function a(){var n=e.offsetTop;f.style.top=n+"px";h.style.top=n+"px";d.style.top=Math.max(10,n-window.pageYOffset)+"px";d.style.left=c?"10px":"420px";d.style.width=window.innerWidth-440+"px"}document.body.innerHTML=Je();R.aa();var c=-1!=rd.indexOf(sd),d=document.getElementById("blockly"),e=document.getElementById("paddingBox"),f=document.getElementById("staveBox"),h=document.getElementById("musicBox");window.addEventListener("scroll",function(){a(null);g.$k(I)});
window.addEventListener("resize",a);a(null);var k=1.03333-.0333333*O,l=document.getElementById("toolbox");I=g.Dh("blockly",{disable:!1,media:"third-party/blockly/media/",rtl:c,toolbox:l,zoom:{maxScale:2,controls:!0,wheel:!0,startScale:k}});Aa(I,g.i.xx);Aa(I,cf);ke("play,rest,setInstrument,start0,start1,start2,start3,start4,start5,start6,start7,start8,start9");document.getElementById("submitButton")&&Dd("submitButton",df);k=document.getElementById("slider");me=new Ke(k);R.tF('<xml><block type="music_start" deletable="'+
(6<O)+'" x="180" y="50"></block></xml>',10!=O||ef);if(6<O){k=A(I,!1);l=0;for(var m;m=k[l];l++)m.Qo=!0}ff();gf();Dd("runButton",hf);Dd("resetButton",jf);setTimeout(R.gF,1);setTimeout(R.hF,1);setTimeout(kf,1);Dd("helpButton",lf);2>location.hash.length&&!Ad(O)&&setTimeout(lf,1E3)});function kf(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/SoundJS/soundjs.min.js";a.onload=mf;document.head.appendChild(a)}
function mf(){for(var a="piano trumpet violin drum flute banjo guitar choir".split(" "),c=[],d=0;d<a.length;d++)for(var e=0;e<Yd.length;e++)c.push({src:a[d]+"/"+Yd[e]+".mp3",id:a[d]+e});createjs.Sound.registerSounds(c,"third-party/soundfonts/")}function Le(){af=0}function nf(a){Xe=a;for(var c=document.getElementById("staveBox"),d=1;d<=a;d++){var e=of(d,a),f=document.createElement("img");f.src="music/stave.png";f.className="stave";f.style.top=Math.round(e)+"px";c.appendChild(f)}}
function of(a,c){return a=(2*a-1)/(2*c)*385-34.5+5}
function pf(a,c,d,e,f){for(;1<e;)pf(a,c,d,1,f),c+=1,--e;a=of(a,Xe);a=-1==d?Math.round(a+21):Math.floor(a+(-4.5*d+32));c=Math.round(256*c+10);var h=document.getElementById("musicContainer"),k=document.createElement("img"),l=-1==d?"rest":"note";k.src="music/"+l+e+".png";k.className=f+" "+l;k.style.top=a+"px";k.style.left=c+"px";-1!=d&&(k.title=Yd[d]);h.appendChild(k);if(!f){var m=k.cloneNode();h.appendChild(m);setTimeout(function(){m.className="splash "+l},0);setTimeout(function(){g.g.o.removeNode(m)},
1E3)}if("0"==d||"12"==d)d=document.createElement("img"),d.src="music/black1x1.gif",d.className=f+(1==e?" ledgerLineWide":" ledgerLine"),d.style.top=a+32+"px",d.style.left=c-5+"px",h.appendChild(d)}
function lf(){var a=document.getElementById("help"),c=document.getElementById("helpButton");if(2==O){var d='<xml><block type="procedures_defnoreturn" x="5" y="10"><field name="NAME">%1</field></block><block type="procedures_callnoreturn" x="5" y="85"><mutation name="%1"></mutation><next><block type="procedures_callnoreturn"><mutation name="%1"></mutation></block></next></block></xml>',e=P("Music_firstPart");e=e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");d=d.replace(/%1/g,e);R.ot("sampleHelp2",
d)}else 6==O?R.ot("sampleHelp6",'<xml><block type="music_instrument" x="5" y="10"></block></xml>'):7==O&&R.ot("sampleHelp7",'<xml><block type="music_rest_whole" x="5" y="10"></block></xml>');Q.xj(a,c,!0,!0,{width:"50%",left:"25%",top:"5em"},qf);Q.bq()}function qf(){Q.eq()}
function cf(a){var c=document.getElementById("toolbox"),d=document.getElementById("music_start");if(d){var e=Z?Z.length:4,f=U;if(a instanceof g.i.ie){for(var h=[],k=A(I,!1),l=0,m;m=k[l];l++)"music_start"!=m.type||m.Ng()||h.push(m);if(e<h.length)for(l=0;k=a.Lg[l];l++){m=0;for(var n;n=h[m];m++)n.id==k&&n.Eu(!0)}e<=h.length?(d.setAttribute("disabled","true"),fd(c),U=e):U=h.length}else if(a instanceof g.i.Oe){a=[];h=[];k=A(I,!0);for(l=0;m=k[l];l++)"music_start"==m.type&&(m.isEnabled()?a:h).push(m);for(;e>
a.length&&h.length;)m=h.shift(),m.Eu(!1),a.push(m);e>a.length&&(d.setAttribute("disabled","false"),fd(c));U=a.length}U!=f&&jf()}}
function gf(){clearTimeout(We);for(var a=0,c;c=$e[a];a++)rf(c);Y=Ze=null;af=W=$e.length=0;bf=!1;document.getElementById("staveBox").innerHTML="";a=document.getElementById("musicContainer");a.innerHTML="";Ye=0;c=document.createElement("img");c.id="musicContainerWidth";c.src="common/1x1.gif";a.appendChild(c);if(Z){nf(Z.length);for(a=0;a<Z.length;a++){c=Z[a];for(var d=0,e=0;e<c.length;e+=2){var f=c[e+1];pf(a+1,d,String(c[e]),f,"goal");d+=f}}setTimeout(sf,0)}else nf(U||1)}
function hf(a){if(!R.Jf(a)){a=document.getElementById("runButton");var c=document.getElementById("resetButton");c.style.minWidth||(c.style.minWidth=a.offsetWidth+"px");a.style.display="none";c.style.display="inline";document.getElementById("spinner").style.visibility="visible";tf()}}
function jf(a){a&&R.Jf(a)||(document.getElementById("runButton").style.display="inline",document.getElementById("resetButton").style.display="none",document.getElementById("spinner").style.visibility="hidden",bd(null),gf())}
function uf(a,c){var d=function(e,f,h){if(Y.zu){for(var k=Infinity,l=0,m;m=$e[l];l++)m.zu&&m.Me<k&&(k=m.Me);for(l=0;m=$e[l];l++)if(k==m.Me){l=Y.Me;Y.Me=k;m.Me=l;break}Y.zu=!1}rf(Y);Y.Ou=createjs.Sound.play(Y.Oy+f);Y.Np=64*e+W;Y.transcript.push(f);Y.transcript.push(e);k=!1;if(10>O){m=Z[Y.Me-1];var n=Y.transcript;l=n.length-2;if(m[l]!=n[l]||m[l+1]!=n[l+1])k=!0}pf(Y.Me,W/64,String(f),e,k?"wrong":"");vf(h)};a.setProperty(c,"play",a.createNativeFunction(d));d=function(e,f){rf(Y);Y.Np=64*e+W;1<Y.transcript.length&&
-1==Y.transcript[Y.transcript.length-2]?Y.transcript[Y.transcript.length-1]+=e:(Y.transcript.push(-1),Y.transcript.push(e));var h=!1;if(10>O){var k=Z[Y.Me-1],l=Y.transcript,m=l.length-2;if(k[m]!=l[m]||k[m+1]<l[m+1])h=!0}pf(Y.Me,W/64,"-1",e,h?"wrong":"");vf(f)};a.setProperty(c,"rest",a.createNativeFunction(d));d=function(e){Y.Oy=e};a.setProperty(c,"setInstrument",a.createNativeFunction(d))}
function tf(){if("Interpreter"in window)if("createjs"in window&&createjs.Sound.isReady()){gf();g.selected&&Vb(g.selected);U=0;var a=Ud();0==U&&jf();Ze=new Interpreter(a,uf);for(a=1;a<=U;a++){var c=new Interpreter("");c.stateStack[0].scope=Ze.global;c.appendCode("start"+a+"();\n");$e.push(new wf(a,c.stateStack))}setTimeout(xf,100)}else setTimeout(tf,250);else setTimeout(tf,250)}
function xf(){var a=1E3*(2.5-2*me.getValue())/64;af||(af=Date.now()-W*a);for(var c=!0,d=0,e;e=$e[d];d++)if(!e.done&&(c=!1,e.Np<=W))a:{var f=void 0;Y=e;Ze.stateStack=e.stateStack;Ze.stateStack=e.stateStack;var h=1E4;do{try{f=Ze.step()}catch(k){alert(k),f=!1}if(0==h--){console.warn("Thread "+e.Me+" is running slowly.");break a}if(e.Np>W)break a}while(f);rf(e);e.Gk&&(R.zm(e.Gk,!1),e.Gk=null);e.done=!0}c?(yf()&&(R.yG(),10>O&&(U=0,Q.AD())),document.getElementById("spinner").style.visibility="hidden",bd(null),
bf=!0):(sf(),W++,We=setTimeout(xf,af+W*a-Date.now()))}function rf(a){var c=a.Ou;c&&(setTimeout(c.stop.bind(c),100),a.Ou=null)}
function sf(){var a=document.getElementById("musicBox"),c=document.getElementById("musicContainer"),d=document.getElementById("musicContainerWidth"),e=10>O?200:100;e=W?Math.round(W/64*256+10+e):a.scrollWidth+e;for(d.width=e;Ye<Math.floor(e/256);)for(Ye++,d=1;d<=Xe;d++){var f=of(d,Xe),h=document.createElement("img");h.src="music/black1x1.gif";h.className="barLine";h.style.top=f+18+"px";h.style.left=256*Ye+10-5+"px";c.appendChild(h)}a.scrollLeft=4*W-182}
function vf(a){a&&(Y.Gk&&R.zm(Y.Gk,!1),R.zm(a,!0),Y.Gk=a)}var Z=void 0;function ff(){function a(m){return c=c.concat(m).concat(m)}var c=[],d=[a([7,.25,8,.25,9,.25,7,.25])],e=[a([9,.25,10,.25,11,.5])],f=[a([11,.125,12,.125,11,.125,10,.125,9,.25,7,.25])],h=[a([7,.25,4,.25,7,.5])],k=[c],l=[c,[-1,2].concat(c)];c=c.concat(c);Z=[void 0,[[7,.25,8,.25,9,.25,7,.25]],d,e,f,h,k,l,[c,[-1,2].concat(c)],[c,[-1,2].concat(c),[-1,4].concat(c),[-1,6].concat(c)],void 0][O]}
function yf(){if(!Z)return!0;if(Z.length!=$e.length)return console.log("Expected "+Z.length+" voices, found "+$e.length),!1;for(var a=0;a<Z.length;a++)if($e[a].Me==a+1&&String(Z[a])!=String($e[a].transcript))return!1;if(6<=O){var c=Ud().match(/setInstrument\('\w+'/g)||[],d={};for(a=0;a<c.length;a++)d[c[a]]=!0;delete d["setInstrument('piano'"];a=Object.keys(d).length;if(6==O&&1>a)return!1;if((7==O||8==O)&&1>a||9==O&&3>a)return console.log("Not enough instruments.  Found: "+a),a=document.getElementById("helpUseInstruments"),
c={width:"30%",left:"35%",top:"12em"},Q.xj(a,null,!1,!0,c,Q.eq),Q.bq(),!1}c=[void 0,void 0,16,23,38,47,47,53,55,71,void 0][O];d=0;var e=y(I);a=0;for(var f;f=e[a];a++)"music_instrument"!=f.type&&f.isEnabled()&&!rc(f)&&d++;return c&&d>c?(console.log("Too many blocks.  Found: "+d+" Max: "+c),a=document.getElementById("helpUseFunctions"),c={width:"30%",left:"35%",top:"12em"},Q.xj(a,null,!1,!0,c,Q.eq),Q.bq(),!1):!0}function ef(a){return a.replace(/"music_rest_whole"/g,'"music_rest"')}
function df(){if(bf&&U){var a="data:image/png;base64,"+[void 0,"iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAAAAmJLR0QA/4ePzL8AAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfhDAQXCQ8DSgv8AAACEklEQVRo3mP8z0B7wMQwasmoJaOWjFoyasmoJaOWjFpCR0samV3p4JN/IqNxMjIt+UsPS248oIMll3fRI04WvKeDJcfX0yN1TaaHJRd66JFP+n7SwZLnsfTI8dtW09gSRlYGhq/Vn2lrSdACVgaGR620tYQvqp6N4efcczS15DtDdRgzw5sptI74xS4MDAu20zp1zZVl+D+B1pZIb+Fl2LWF1jWjXgwDQz/Nq99KXYZ9p2ltiWwKA8NMmjck/PUY9tDcEvkAhte7aG0Jg6/gt4M0t8SEi+EC7Rt3dgxvaW/Jf4Zf9Gim/qeHJay0t4SRgY32ljxn4KW9JfcZNGluyeefDLI0t2T3Nx4tmlty+hOTO80t2c9gQPNS+PAD1nCaW3LiJUMArS15sZ3JVorWlvyTlMkkSiELBZZIdb3XobolV7afu8bMZRyCaHpJE1tUEws22/NCCkMuOYaI/yQBYn1yqmY3jPntEanhSqQlTRPfURB5xFlSOPU3A60tKUZvvf+j/gDOHIyRAXHqWzIZPay4jUltbRAE3Rh6FH6QloSJ8MlSdAH2Cnaq+4QHXUvwfxIBI+HGGQfaKIrjTlYGqkc8WlJy2k6qHcRYkoTM4Sncy056biQcok8cECGnsvs/GYCYUvhxoSoDAwMDk1bK0v9kAUai1kjcvPCAQVBOSY3cFvPoQoxRS0YtGbVk1JLhbgkATHAP6cDyYR8AAAAASUVORK5CYII=",
"iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAAB8klEQVRo3u3aO0/CUBQA4FMjJsaBTg4uxcHEzZLowlLG3on6CwyDM/EXgLMD8AuAXyDbrYvt4uojTg4GBgc10dY4OZg6FHld0tflOJhzN3pP79f7OL20oASAX1aAEEIIIYQQTGTYj6pVlnGrv7TPNl8i6ldlgTdu8/eYGDnknttOgjAJ5ILbD8kiMyLPnNufiaOzINecX6U6IS3yzTkfpL2qdMix8/SVoevpkNfHRUcPGLNdQMyTNcZMDcDGy5MCM1kONU9KzNwHzDzZYCbbAsw82TEZA9Q8MUy2h7yE10su/qa1mwN8hL5IEEIIIYQQQgghhBBCyB8ivWpRUZRi24+JC9KUujH1wWuov42olhF1Wvae9LYb4w74fZyn32oX9cEUAMA/dPEn/sTFX10tYawKSxgu/w5AGzfknwoBliwybLu3AAB6fXSgK+SFZsnlyaA8CVbDdDCEVpzIJmKRxuwLifCk+XIUyCDe3DAsRmKMGMTTYRFSSWfEIMJ0hsjMC+f8eSCFNIXBr4xulJMjNS+QQjxVQDqjKiccMaPpJbl5RyEdwdCmah1nkHSHiEIqKdMh034i5HWtjL/9HrUQ9vi56653s25wkasrPz3nGecjNk9utDHRCSRKzA9nLdf9yOu6VQaZotAfMQghhBBC/jvyA6C+2c6ogwZuAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAAB4ElEQVRo3u2aPVKDUBCAl4ytA7U6k1hZQio7SUorMuMBoicgOQG5AXKC4AGcxMoyuQFJaQWeAGbsXYvEwPuBBxkZR2e3y9t979tfMnlEQ2hfOkAQghCEIASRyonS4vXjSq54Oz0rU9xyK6iSYXPPHe4IKjxBfnNO4PxOvv58cV2iaA65+Qzkiu1gVqKwqPAEIQhBCEIQghCEIAQhCEEIQpA/DcmeHi41TesH2Y/+jmcQ0+Xu8M3ksS1IMMv9T9qBZNPwuJo0gGTDTfuFP5rRADI5mlGVrmwLYBqHOovXOCN+IXkHsBtAkmCZAAAMvP2C2LE2exn0Eq4zADBGnnia9Jo2GuQGPRsREXvCzqi4I8z1Rs/jjpNCJqzHO0Ne/BKnAKAGJOXuxOSQcZFhQCWkU3ccuuxHtzCXy77qOSYEYgkFRkTEeXFJX1XEUSNdYm/sEzPOEV5a6RUsFJBYjPXb64UDAADOnEGwIe4yiwqIL2wxC9rVKhbSK/a2p4LY1eMgSlzpVc1XG3OrWi98rehh4weke68w4FtLX1vKFna5OJQvipAdoK4su0J36cXsRmoG211uijUgGB0o3RphsJPllDglTnzq2wC67UVYV2LXBDAdPy4z0OiPGAQhCEEI8t8hX5wfXfFkGIkcAAAAAElFTkSuQmCC",
"iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAAAAABVicqIAAACU0lEQVRo3u2aTY7aQBCFnyMWkRLJZjkrs8rWzlwAcwLgBMAJ4AYWJwBOYOYEkBPYXCD2Ohs7J7AjJcomUmXhAf90N+OMbWmkVG2A6nZ/7q56JSijEfq3d2AIQxjy/0AGUu/w93v59B8fBooBXe7/84sATVq7hll32yAOPKdw1R4e5P6vnz4qBh7l/p/fAIBkNnZJbvBVAwq/DyLiwDOEIQxhCEMYwhCGMIQhDGEIQ97iT+ymdgkCwJhNjd4g2eGYAADOxq4vyHZ/a1hlq34g2STqPfDR5xoj6R6STOqL9gCZC/3DUeeQvRAPszUkOUyGmqbNn66OgzBlc3eBl1tR4ew22clbUb6wipnea0W9mMLZdl98CCovJTsabXQSrZrIwXPaiDGayNrQ9SB7yzZiTKQMLCs9c9NftlL8XNFOPxdvdTdy/rHUJ9+BcRFOIR56vqATbi75LjYzlUAuhXjKkC/HIANgONfCvVXKwQ6SIIEzUhCSp3MEAPbSqurkVFxgjFwiori5HCqWlmJko9TPTasH68o1FzZheEZd7YN7qSrIwW4waXVUlJWwLljZcemnJvtYSgAgIoqFopDXrkXZZcVNGGuoIGKi5zedWkXIvSYISRitZ4gnjOjXLHItADAXjU6KiMSUdp8hDuSnle/G91Nqar78dkFEr5SDxFxhqR0pHm3oZ6OrL6iLjaJA6nu7K8Z4f8sws8oI6dVWS6FF6THRqTwwTamFWVLxonoDU59aWaEs001rD7zitQWY011Mrc2b6tDH64qwNP5zDEMYwpBu7S/9DO5PRs/ScgAAAABJRU5ErkJggg=="][U],
c=document.getElementById("thumbnail").getContext("2d");c.globalCompositeOperation="copy";var d=new Image;d.onload=function(){c.drawImage(d,0,0,200,200)};d.src=a;document.getElementById("galleryThumb").value=a;Q.Nu()}else alert(P("Music_submitDisabled"))}function wf(a,c){this.Me=a;this.stateStack=c;this.transcript=[];this.Oy="piano";this.Np=0;this.Ou=this.Gk=null;this.zu=10>O;this.done=!1};
