// Automatically generated file. Do not edit! 'use strict';var b,h={g:{}};h.g.global=function(){return"object"===typeof self?self:"object"===typeof window?window:"object"===typeof global?global:this}(); h.h={};h.g.global.Blockly||(h.g.global.Blockly={});h.g.global.Blockly.Msg||(h.g.global.Blockly.Msg=h.h);h.g.O=function(a,c){this.x=a;this.y=c};h.g.O.me=function(a,c){return a==c?!0:a&&c?a.x==c.x&&a.y==c.y:!1};h.g.O.Pt=function(a,c){var d=a.x-c.x;a=a.y-c.y;return Math.sqrt(d*d+a*a)};h.g.O.HA=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};h.g.O.Mj=function(a,c){return new h.g.O(a.x-c.x,a.y-c.y)};h.g.O.sum=function(a,c){return new h.g.O(a.x+c.x,a.y+c.y)};h.g.O.prototype.scale=function(a){this.x*=a;this.y*=a;return this};h.g.O.prototype.translate=function(a,c){this.x+=a;this.y+=c;return this};h.g.Da={};h.g.Da.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};h.g.Da.Rq=function(a){return a.length?a.reduce(function(c,d){return c.lengthc&&(c=d[e].length);e=-Infinity;var f=1;do{var g=e;var k=a;a=[];var l=d.length/f,m=1;for(e=0;eg);return k}; h.g.Da.jr=function(a,c,d){for(var e=[0],f=[],g=0;ge&&(e=l,f=k)}return f?h.g.Da.gw(a,f,d):c};h.g.Da.aC=function(a,c){for(var d=[],e=0;e=l?(f=2,g=l,(l=a.join(""))&&d.push(l),a.length=0):"{"==l?f=3:(a.push("%",l),f=0):2==f?"0"<=l&&"9">=l?g+=l:(d.push(parseInt(g,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=h.g.Da.startsWith(l,"BKY_")? l.substring(4):null)&&l in h.h?(f=h.h[l],"string"==typeof f?Array.prototype.push.apply(d,h.g.cr(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;kd;d++)c[d]=h.g.Ve.Rv.charAt(Math.random()*a);return c.join("")}; h.g.Ve.Rv="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; h.g.Mg=function(){if(void 0!==h.g.Mg.Go)return h.g.Mg.Go;if(!h.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=h.g.global.getComputedStyle(a);if(!c)return document.body.removeChild(a),!1;c=c.getPropertyValue(d[e])}document.body.removeChild(a); h.g.Mg.Go="none"!==c;return h.g.Mg.Go};h.g.Gv=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)};h.g.Zz=function(){var a=h.g.style.vu();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}}; h.g.Rl=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};h.g.Tz=function(){var a=document.documentElement,c=window;return h.g.userAgent.hf&&c.pageYOffset!=a.scrollTop?new h.g.O(a.scrollLeft,a.scrollTop):new h.g.O(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};h.g.pp=function(a,c){var d=Object.create(null),e=p(a,!0);c&&(a=u(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}; h.g.xB=function(a,c){var d=c.x;c=c.y;var e=aa(a).getBoundingClientRect();d=new h.g.O(d-e.left,c-e.top);c=h.g.Sj(a.$a);return h.g.O.Mj(d,c).scale(1/a.scale)}; h.i={};h.i.zu="";h.i.$b=!0;h.i.Vo=0;h.i.ml="create";h.i.xr=h.i.ml;h.i.aj="delete";h.i.xw=h.i.aj;h.i.Zi="change";h.i.nC=h.i.Zi;h.i.ij="move";h.i.yr=h.i.ij;h.i.Ps="var_create";h.i.Qs="var_delete";h.i.Rs="var_rename";h.i.Nl="ui";h.i.kl="comment_create";h.i.Er="comment_delete";h.i.Dr="comment_change";h.i.ll="comment_move";h.i.Vw="finished_loading";h.i.yw=[h.i.xr,h.i.yr,h.i.kl,h.i.ll];h.i.bj=[];h.i.Na=function(a){h.i.isEnabled()&&(h.i.bj.length||setTimeout(h.i.Bz,0),h.i.bj.push(a))}; h.i.Bz=function(){for(var a=h.i.filter(h.i.bj,!0),c=h.i.bj.length=0,d;d=a[c];c++)if(d.Ub){var e=h.hb.qp(d.Ub);if(e){var f=d;if(f.$b)for(e.nh.push(f),e.zk.length=0;e.nh.length>e.fs&&0<=e.fs;)e.nh.shift();for(var g=0;d=e.zc[g];g++)d(f)}}}; h.i.filter=function(a,c){a=a.slice();c||a.reverse();for(var d=[],e=Object.create(null),f=0,g;g=a[f];f++)if(!g.si()){var k=[g.type,g.gc,g.Ub].join(" "),l=e[k],m=l?l.event:null;if(!l)e[k]={event:g,index:f},d.push(g);else if(g.type==h.i.ij&&l.index==f-1)m.Vg=g.Vg,m.Ug=g.Ug,m.Rf=g.Rf,l.index=f;else if(g.type==h.i.Zi&&g.element==m.element&&g.name==m.name)m.newValue=g.newValue;else if(g.type!=h.i.Nl||"click"!=g.element||"commentOpen"!=m.element&&"mutatorOpen"!=m.element&&"warningOpen"!=m.element)e[k]={event:g, index:1},d.push(g)}a=d.filter(function(n){return!n.si()});c||a.reverse();for(f=1;g=a[f];f++)g.type==h.i.Zi&&"mutation"==g.element&&a.unshift(a.splice(f,1)[0]);return a};h.i.Ty=function(){for(var a=0,c;c=h.i.bj[a];a++)c.$b=!1};h.i.disable=function(){h.i.Vo++};h.i.enable=function(){h.i.Vo--};h.i.isEnabled=function(){return 0==h.i.Vo};h.i.Db=function(){return h.i.zu};h.i.ga=function(a){h.i.zu="boolean"==typeof a?a?h.g.Ve():"":a}; h.i.iu=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++)c[d]=e.id;return c}; h.i.pa=function(a){switch(a.type){case h.i.ml:var c=new h.i.wd(null);break;case h.i.aj:c=new h.i.Vd(null);break;case h.i.Zi:c=new h.i.gf(null,"","","","");break;case h.i.ij:c=new h.i.lg(null);break;case h.i.Ps:c=new h.i.cd(null);break;case h.i.Qs:c=new h.i.Ed(null);break;case h.i.Rs:c=new h.i.ce(null,"");break;case h.i.Nl:c=new h.i.bd(null,"","","");break;case h.i.kl:c=new h.i.Fe(null);break;case h.i.Dr:c=new h.i.xh(null,"","");break;case h.i.ll:c=new h.i.fg(null);break;case h.i.Er:c=new h.i.Ge(null); break;default:throw Error("Unknown event type.");}c.pa(a);c.Ub=(void 0).id;return c};h.i.NG=function(a){if((a.type==h.i.ij||a.type==h.i.ml)&&a.Ub){var c=h.hb.qp(a.Ub);if(a=v(c,a.gc)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.we(!0);else if((a.M||a.R)&&!c.yc()){do a.we(!1),a=u(a);while(a)}}}}; h.i.Abstract=function(){this.Ub=void 0;this.group=h.i.Db();this.$b=h.i.$b};h.i.Abstract.prototype.Ia=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};h.i.Abstract.prototype.pa=function(a){this.group=a.group};h.i.Abstract.prototype.si=function(){return!1};h.i.Abstract.prototype.run=function(){};function w(a){if(a.Ub)var c=h.hb.qp(a.Ub);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};h.g.object={};h.g.object.S=function(a,c){a.w=c.prototype;a.prototype=Object.create(c.prototype);a.prototype.constructor=a};h.g.object.yi=function(a,c){for(var d in c)a[d]=c[d]};h.g.object.values=function(a){return Object.values?Object.values(a):Object.keys(a).map(function(c){return a[c]})};h.g.xml={};h.g.xml.Ex="https://developers.google.com/blockly/xml";h.g.xml.document=function(){return document};h.g.xml.createElement=function(a){return h.g.xml.document().createElementNS(h.g.xml.Ex,a)};h.g.xml.createTextNode=function(a){return h.g.xml.document().createTextNode(a)};h.g.xml.NB=function(a){return(new DOMParser).parseFromString(a,"text/xml")};h.g.xml.Mc=function(a){return(new XMLSerializer).serializeToString(a)};h.i.Ud=function(a){h.i.Ud.w.constructor.call(this);this.gc=a.id;this.Ub=a.C.id};h.g.object.S(h.i.Ud,h.i.Abstract);h.i.Ud.prototype.Ia=function(){var a=h.i.Ud.w.Ia.call(this);a.blockId=this.gc;return a};h.i.Ud.prototype.pa=function(a){h.i.Ud.w.pa.call(this,a);this.gc=a.blockId};h.i.gf=function(a,c,d,e,f){a&&(h.i.gf.w.constructor.call(this,a),this.element=c,this.name=d,this.oldValue=e,this.newValue=f)};h.g.object.S(h.i.gf,h.i.Ud);h.i.uh=h.i.gf;b=h.i.gf.prototype;b.type=h.i.Zi; b.Ia=function(){var a=h.i.gf.w.Ia.call(this);a.element=this.element;this.name&&(a.name=this.name);a.newValue=this.newValue;return a};b.pa=function(a){h.i.gf.w.pa.call(this,a);this.element=a.element;this.name=a.name;this.newValue=a.newValue};b.si=function(){return this.oldValue==this.newValue}; b.run=function(a){var c=v(w(this),this.gc);if(c)switch(c.Qf&&c.Qf.Eb(!1),a=a?this.newValue:this.oldValue,this.element){case "field":(c=ba(c,this.name))?c.setValue(a):console.warn("Can't set non-existent field: "+this.name);break;case "comment":c.Hi(a||null);break;case "collapsed":c.Zf(!!a);break;case "disabled":c.we(!a);break;case "inline":c.Ii(!!a);break;case "mutation":var d="";c.qd&&(d=(d=c.qd())&&h.K.Mc(d));if(c.Ue){var e=h.K.$f(a||"");c.Ue(e)}h.i.Na(new h.i.gf(c,"mutation",null,d, a));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.gc)};h.i.wd=function(a){a&&(h.i.wd.w.constructor.call(this,a),this.xml=a.C.ca?h.K.Bo(a):h.K.sf(a),this.Lg=h.i.iu(a))};h.g.object.S(h.i.wd,h.i.Ud);h.i.il=h.i.wd;h.i.wd.prototype.type=h.i.ml;h.i.wd.prototype.Ia=function(){var a=h.i.wd.w.Ia.call(this);a.xml=h.K.Mc(this.xml);a.ids=this.Lg;return a}; h.i.wd.prototype.pa=function(a){h.i.wd.w.pa.call(this,a);this.xml=h.K.$f(a.xml);this.Lg=a.ids};h.i.wd.prototype.run=function(a){var c=w(this);if(a)a=h.g.xml.createElement("xml"),a.appendChild(this.xml),h.K.Eg(a,c);else{a=0;for(var d;d=this.Lg[a];a++){var e=v(c,d);e?e.I(!1):d==this.gc&&console.warn("Can't uncreate non-existent block: "+d)}}}; h.i.Vd=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");h.i.Vd.w.constructor.call(this,a);this.pq=a.C.ca?h.K.Bo(a):h.K.sf(a);this.Lg=h.i.iu(a)}};h.g.object.S(h.i.Vd,h.i.Ud);h.i.zw=h.i.Vd;h.i.Vd.prototype.type=h.i.aj;h.i.Vd.prototype.Ia=function(){var a=h.i.Vd.w.Ia.call(this);a.ids=this.Lg;return a};h.i.Vd.prototype.pa=function(a){h.i.Vd.w.pa.call(this,a);this.Lg=a.ids}; h.i.Vd.prototype.run=function(a){var c=w(this);if(a){a=0;for(var d;d=this.Lg[a];a++){var e=v(c,d);e?e.I(!1):d==this.gc&&console.warn("Can't delete non-existent block: "+d)}}else a=h.g.xml.createElement("xml"),a.appendChild(this.pq),h.K.Eg(a,c)};h.i.lg=function(a){a&&(h.i.lg.w.constructor.call(this,a),a=ca(this),this.kv=a.qv,this.jv=a.Lu,this.mq=a.Bt)};h.g.object.S(h.i.lg,h.i.Ud);h.i.Xi=h.i.lg;b=h.i.lg.prototype;b.type=h.i.ij; b.Ia=function(){var a=h.i.lg.w.Ia.call(this);this.Vg&&(a.newParentId=this.Vg);this.Ug&&(a.newInputName=this.Ug);this.Rf&&(a.newCoordinate=Math.round(this.Rf.x)+","+Math.round(this.Rf.y));return a};b.pa=function(a){h.i.lg.w.pa.call(this,a);this.Vg=a.newParentId;this.Ug=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.Rf=new h.g.O(Number(a[0]),Number(a[1])))};b.$g=function(){var a=ca(this);this.Vg=a.qv;this.Ug=a.Lu;this.Rf=a.Bt}; function ca(a){var c=v(w(a),a.gc);a={};var d=c.getParent();if(d){a.qv=d.id;a:{for(var e=0,f;f=d.N[e];e++)if(f.connection&&x(f.connection)==c){c=f;break a}c=null}c&&(a.Lu=c.name)}else a.Bt=c.Ha();return a}b.si=function(){return this.kv==this.Vg&&this.jv==this.Ug&&h.g.O.me(this.mq,this.Rf)}; b.run=function(a){var c=w(this),d=v(c,this.gc);if(d){var e=a?this.Vg:this.kv,f=a?this.Ug:this.jv;a=a?this.Rf:this.mq;var g=null;if(e&&(g=v(c,e),!g)){console.warn("Can't connect to non-existent block: "+e);return}d.getParent()&&y(d);if(a)f=d.Ha(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.M||d.R;if(f){if(c=da(g,f))var k=c.connection}else d.type==h.Bd&&(k=g.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.gc)};h.g.m={};h.g.m.qc="http://www.w3.org/2000/svg";h.g.m.Hn="http://www.w3.org/1999/xhtml";h.g.m.dd="http://www.w3.org/1999/xlink";h.g.m.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};h.g.m.vg=null;h.g.m.Fo=0;h.g.m.L=function(a,c,d){a=document.createElementNS(h.g.m.qc,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}; h.g.m.Ib=function(a,c){var d=a.getAttribute("class")||"";if(-1!=(" "+d+" ").indexOf(" "+c+" "))return!1;d&&(d+=" ");a.setAttribute("class",d+c);return!0};h.g.m.Sc=function(a,c){var d=a.getAttribute("class");if(-1==(" "+d+" ").indexOf(" "+c+" "))return!1;d=d.split(/\s+/);for(var e=0;ed)){var e=ea(c,a.Y());a.M?(e.x+=(a.H?3:-3)*d,e.y+=13*d):a.R&&(e.x+=(a.H?-23:23)*d,e.y+=3*d);a=h.g.m.L("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},z(c));h.Qa.xt(a,new Date,d)}};h.Qa.xt=function(a,c,d){var e=(new Date-c)/150;1a.C.scale)){var c=A(a).height;c=Math.atan(10/c)/Math.PI*180;a.H||(c*=-1);h.Qa.Nt(a.Y(),c,new Date)}};h.Qa.Nt=function(a,c,d){var e=(new Date-d)/200;1a-h.Gw)}if(a.Nb||a.bb)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Nb||!a.bb);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0} function ia(a){a.bb&&(h.g.m.removeNode(h.ea.Ku),delete h.ea.Ku);if(a.Gp){var c=a.bb;c.type!=h.Oa||c.isConnected()?ja(a.ji,!1):a.ji.jA(c,!1);a.ji=null;a.Gp=!1}else if(a.Sg)if(a.Sg){c=a.Sg;var d=c.D,e=d.V,f=d.R,g=d.M;g=c.type==h.Oa&&!(g&&g.la);!(c!=e||f&&f.la)||g?y(x(c),!1):c.type==h.Ca&&c!=e?(e=c.la,y(e.D,!1),f=f?f.la:null,y(d,!0),f&&f.connect(e)):y(d,!0);if(c.la)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.Sg=null;d.Y().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")} h.xl.prototype.bi=function(){var a=[];this.ai&&a.push(this.ai);this.Qg&&a.push(this.Qg);return a};h.eg=function(a,c){this.cb=a;this.s=c;this.le=new h.xl(this.cb);this.Dg=null;this.De=!1;this.ze=this.cb.Ha();this.im=h.eg.qA(a)};h.eg.prototype.I=function(){this.Fb=this.s=this.cb=null;this.im.length=0;this.le&&(this.le.I(),this.le=null)};h.eg.qA=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=ka(e);for(var f=0;f=d+this.Ef&&(e+=f);wa(this,Ea(this,e));Ca(this);a.stopPropagation();a.preventDefault()}}; b.aB=function(a){Ga(this.s);xa();h.g.ui(a)?a.stopPropagation():(this.IB=this.Vj,Ia(this.s),this.Uv=this.Kg?a.clientX:a.clientY,h.za.Uf=h.ra(document,"mouseup",this,this.fB),h.za.Tf=h.ra(document,"mousemove",this,this.bB),a.stopPropagation(),a.preventDefault())};b.bB=function(a){wa(this,Ea(this,this.IB+((this.Kg?a.clientX:a.clientY)-this.Uv)));Ca(this)};b.fB=function(){Ja(this.s);h.Touch.Ul();xa()};function xa(){h.jc(!0);h.za.Uf&&(h.fb(h.za.Uf),h.za.Uf=null);h.za.Tf&&(h.fb(h.za.Tf),h.za.Tf=null)} function Ea(a,c){return c=0>=c||isNaN(c)||a.tdc)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.jn.splice(c,1);this.Tb.unsubscribe(this.Sb);this.options.Ac||(this.Tb.I(),this.Tb=null)}};h.hb.Es=3;b=h.hb.prototype; b.ye=function(a,c){a=a.Ha();c=c.Ha();return a.y+h.hb.prototype.ye.offset*a.x-(c.y+h.hb.prototype.ye.offset*c.x)};function Oa(a,c){if(!h.g.Rl(a.Ui,c))throw Error("Block not present in workspace's list of top-most blocks.");}function G(a,c){var d=[].concat(a.Ui);c&&1g)return!1;d+=c[e]}return d>Ra(a)?!1:!0} function Ta(a){return Infinity!=a.options.cq||!!a.options.eq}b.hr=function(a){var c=a?this.zk:this.nh,d=a?this.nh:this.zk,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=h.i.filter(f,a);h.i.$b=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{h.i.$b=!0}}};function Ua(a,c){a.zc.push(c)}function Va(a,c){h.g.Rl(a.zc,c)}function v(a,c){return a.Ao[c]||null}h.hb.oj=Object.create(null);h.hb.qp=function(a){return h.hb.oj[a]||null}; h.hb.getAll=function(){var a=[],c;for(c in h.hb.oj)a.push(h.hb.oj[c]);return a};h.oa=function(a,c,d,e,f,g){this.s=a;this.wf=c;this.Pv=d;d=h.oa.tw;this.s.H&&(d=-d);this.Ay=h.g.pd.Zq(d);a.ef.appendChild(this.Fj(c,!(!f||!g)));this.xb=e;this.Eq&&Wa(this);f&&g||(c=this.wf.getBBox(),f=c.width+2*h.oa.Td,g=c.height+2*h.oa.Td);Xa(this,f,g);Wa(this);Ya(this);this.Eq=!0;a.options.readOnly||(h.ra(this.tj,"mousedown",this,this.Hy),this.ve&&h.ra(this.ve,"mousedown",this,this.sB))};h.oa.Td=6;h.oa.uw=5;h.oa.tw=20;h.oa.rr=4;h.oa.rw=8;h.oa.Uf=null;h.oa.Tf=null;h.oa.prototype.Ev=null; h.oa.gr=function(){h.oa.Uf&&(h.fb(h.oa.Uf),h.oa.Uf=null);h.oa.Tf&&(h.fb(h.oa.Tf),h.oa.Tf=null)};h.oa.Iy=function(){h.Touch.Ul();h.oa.gr()};b=h.oa.prototype;b.Eq=!1;b.xb=null;b.bf=0;b.Xf=0;b.Xa=0;b.Zb=0;b.wo=!0; b.Fj=function(a,c){this.Lc=h.g.m.L("g",{},null);var d={filter:"url(#"+this.s.options.Tt+")"};h.g.userAgent.px&&(d={});d=h.g.m.L("g",d,this.Lc);this.Eo=h.g.m.L("path",{},d);this.tj=h.g.m.L("rect",{"class":"blocklyDraggable",x:0,y:0,rx:h.oa.Td,ry:h.oa.Td},d);c?(this.ve=h.g.m.L("g",{"class":this.s.H?"blocklyResizeSW":"blocklyResizeSE"},this.Lc),c=2*h.oa.Td,h.g.m.L("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.ve),h.g.m.L("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/ 3},this.ve),h.g.m.L("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.ve)):this.ve=null;this.Lc.appendChild(a);return this.Lc};b.Y=function(){return this.Lc};b.Hy=function(a){var c=this.s.Af(a);if(c){if(c.Jg)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.Tc||(c.Tc=this);c.Od=a}};b.Hk=function(){};b.Pc=function(){return!1}; b.sB=function(a){var c=this.Lc.parentNode;c.lastChild!==this.Lc&&c.appendChild(this.Lc);h.oa.gr();h.g.ui(a)||(this.s.Uq(a,new h.g.O(this.s.H?-this.Xa:this.Xa,this.Zb)),h.oa.Uf=h.ra(document,"mouseup",this,h.oa.Iy),h.oa.Tf=h.ra(document,"mousemove",this,this.tB),h.jc());a.stopPropagation()};b.tB=function(a){this.wo=!1;var c=this.s;a=h.g.qk(a,z(c),Ha(c));a.x/=c.scale;a.y/=c.scale;c=h.g.O.sum(c.Qt,a);Xa(this,this.s.H?-c.x:c.x,c.y);this.s.H&&Wa(this)}; function Za(a,c,d){var e=a.s.H?a.xb.x-c.x-a.Xa:c.x+a.xb.x;c=c.y+a.xb.y;return Math.max(0,Math.min(1,(Math.min(e+a.Xa,d.wb+d.lb)-Math.max(e,d.wb))*(Math.min(c+a.Zb,d.Bb+d.vb)-Math.max(c,d.Bb))/(a.Xa*a.Zb)))}function Wa(a){var c=a.xb.x;c=a.s.H?c-(a.bf+a.Xa):c+a.bf;a.moveTo(c,a.Xf+a.xb.y)}b.moveTo=function(a,c){this.Lc.setAttribute("transform","translate("+a+","+c+")")}; function Xa(a,c,d){var e=2*h.oa.Td;c=Math.max(c,e+45);d=Math.max(d,e+20);a.Xa=c;a.Zb=d;a.tj.setAttribute("width",c);a.tj.setAttribute("height",d);a.ve&&(a.s.H?a.ve.setAttribute("transform","translate("+2*h.oa.Td+","+(d-e)+") scale(-1 1)"):a.ve.setAttribute("transform","translate("+(c-e)+","+(d-e)+")"));if(a.wo){c=a.s.vc();c.wb/=a.s.scale;c.lb/=a.s.scale;c.Bb/=a.s.scale;c.vb/=a.s.scale;d=-a.Xa/4;if(!(a.Xa>c.lb)){if(a.s.H){e=a.xb.x-d;var f=e-a.Xa;var g=c.wb+c.lb,k=c.wb+h.za.ac/a.s.scale}else f=d+a.xb.x, e=f+a.Xa,k=c.wb,g=c.wb+c.lb-h.za.ac/a.s.scale;a.s.H?fg&&(d=-(g-a.xb.x)):fg&&(d=g-a.xb.x-a.Xa)}f=d;d=-a.Zb/4;if(!(a.Zb>c.vb)){e=a.xb.y+d;g=e+a.Zb;k=c.Bb;var l=c.Bb+c.vb-h.za.ac/a.s.scale,m=a.xb.y;el&&(d=l-m-a.Zb)}k=d;g=a.Pv.getBBox();d={x:f,y:-a.Zb-h.ma.hs};e={x:-a.Xa-30,y:k};k={x:g.width,y:k};l={x:f,y:g.height};f=g.widthg&&(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=new h.g.Cd(a.Xa,a.Zb);m=(r.width+r.height)/h.oa.uw;m=Math.min(m,r.width,r.height)/4;r=1-h.oa.rw/k;f=d+r*f;g=e+r*g;r=d+m*q;var t=e+m*n;d-=m*q;e-=m*n;n=l+a.Ay;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/h.oa.rr;k=Math.cos(n)*k/h.oa.rr;c.push("M"+ r+","+t);c.push("C"+(r+k)+","+(t+l)+" "+f+","+g+" "+f+","+g);c.push("C"+f+","+g+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.Eo.setAttribute("d",c.join(" "))}b.ud=function(a){this.tj.setAttribute("fill",a);this.Eo.setAttribute("fill",a)};b.I=function(){h.oa.gr();h.g.m.removeNode(this.Lc);this.Pv=this.wf=this.s=this.ve=this.tj=this.Eo=this.Lc=null};b.hq=function(a,c){a?a.mh(c.x,c.y):this.moveTo(c.x,c.y);this.bf=this.s.H?this.xb.x-c.x-this.Xa:c.x-this.xb.x;this.Xf=c.y-this.xb.y;Ya(this)}; b.Ha=function(){return new h.g.O(this.xb.x+this.bf,this.xb.y+this.Xf)};h.i.Ee=function(a){this.ge=a.id;this.Ub=a.C.id;this.group=h.i.Db();this.$b=h.i.$b};h.g.object.S(h.i.Ee,h.i.Abstract);h.i.Ee.prototype.Ia=function(){var a=h.i.Ee.w.Ia.call(this);this.ge&&(a.commentId=this.ge);return a};h.i.Ee.prototype.pa=function(a){h.i.Ee.w.pa.call(this,a);this.ge=a.commentId};h.i.xh=function(a,c,d){a&&(h.i.xh.w.constructor.call(this,a),this.iv=c,this.Tm=d)};h.g.object.S(h.i.xh,h.i.Ee);b=h.i.xh.prototype;b.type=h.i.Dr; b.Ia=function(){var a=h.i.xh.w.Ia.call(this);a.newContents=this.Tm;return a};b.pa=function(a){h.i.xh.w.pa.call(this,a);this.Tm=a.newValue};b.si=function(){return this.iv==this.Tm};b.run=function(a){var c;(c=w(this).Xl[this.ge]||null)?c.zH(a?this.Tm:this.iv):console.warn("Can't change non-existent comment: "+this.ge)};h.i.Fe=function(a){a&&(h.i.Fe.w.constructor.call(this,a),this.xml=a.$q())};h.g.object.S(h.i.Fe,h.i.Ee);h.i.Fe.prototype.type=h.i.kl; h.i.Fe.prototype.Ia=function(){var a=h.i.Fe.w.Ia.call(this);a.xml=h.K.Mc(this.xml);return a};h.i.Fe.prototype.pa=function(a){h.i.Fe.w.pa.call(this,a);this.xml=h.K.$f(a.xml)};h.i.Fe.prototype.run=function(a){h.i.Gr(this,a)};h.i.Gr=function(a,c){var d=w(a);c?(c=h.g.xml.createElement("xml"),c.appendChild(a.xml),h.K.Eg(c,d)):(d=d.Xl[a.ge]||null)?d.I(!1,!1):console.warn("Can't uncreate non-existent comment: "+a.ge)};h.i.Ge=function(a){a&&(h.i.Ge.w.constructor.call(this,a),this.xml=a.$q())}; h.g.object.S(h.i.Ge,h.i.Ee);h.i.Ge.prototype.type=h.i.Er;h.i.Ge.prototype.Ia=function(){return h.i.Ge.w.Ia.call(this)};h.i.Ge.prototype.pa=function(a){h.i.Ge.w.pa.call(this,a)};h.i.Ge.prototype.run=function(a){h.i.Gr(this,!a)};h.i.fg=function(a){a&&(h.i.fg.w.constructor.call(this,a),this.Ko=a,this.nq=a.wu(),this.Tg=null)};h.g.object.S(h.i.fg,h.i.Ee);b=h.i.fg.prototype; b.$g=function(){if(!this.Ko)throw Error("Tried to record the new position of a comment on the same event twice.");this.Tg=this.Ko.wu();this.Ko=null};b.type=h.i.ll;b.Ia=function(){var a=h.i.fg.w.Ia.call(this);this.Tg&&(a.newCoordinate=Math.round(this.Tg.x)+","+Math.round(this.Tg.y));return a};b.pa=function(a){h.i.fg.w.pa.call(this,a);a.newCoordinate&&(a=a.newCoordinate.split(","),this.Tg=new h.g.O(Number(a[0]),Number(a[1])))};b.si=function(){return h.g.O.me(this.nq,this.Tg)}; b.run=function(a){var c;if(c=w(this).Xl[this.ge]||null){a=a?this.Tg:this.nq;var d=c.wu();c.moveBy(a.x-d.x,a.y-d.y)}else console.warn("Can't move non-existent comment: "+this.ge)};h.Yi=function(a,c){this.Cb=a;this.s=c;this.Dg=null;this.rn=!1;this.ze=this.Cb.Ha();this.Fg=h.g.Mg()&&c.Kc?c.Kc:null};h.Yi.prototype.I=function(){this.Fg=this.s=this.Cb=null};function $a(a,c,d){d=a.Bi(d);d=h.g.O.sum(a.ze,d);a.Cb.hq(a.Fg,d);a.Cb.Pc()&&(a.Dg=oa(a.s,c),a.rn=a.Dg!=h.Jr,c=a.s.bc,a.rn?(pa(a.Cb,!0),a.Dg==h.En&&c&&qa(c,!0)):(pa(a.Cb,!1),c&&qa(c,!1)))} function ab(a,c,d){$a(a,c,d);c=a.Bi(d);c=h.g.O.sum(a.ze,c);a.Cb.moveTo(c.x,c.y);c=a.s.bc;a.rn?(c&&setTimeout(c.close.bind(c),100),a.Qj(),a.Cb.I(!1,!0)):c&&c.close();a.rn||(a.Fg&&a.Fg.Tl(a.s.ef),a.Cb.dh&&a.Cb.dh(!1),a.Qj());a.s.Rb(!0);a.s.sa&&a.s.sa.qB(a.Cb.Pc()?"blocklyToolboxDelete":"blocklyToolboxGrab");h.i.ga(!1)}h.Yi.prototype.Qj=function(){if(this.Cb.Pu){var a=new h.i.fg(this.Cb);a.nq=this.ze;a.$g();h.i.Na(a)}}; h.Yi.prototype.Bi=function(a){a=new h.g.O(a.x/this.s.scale,a.y/this.s.scale);this.s.ri&&a.scale(1/this.s.options.Ac.scale);return a};h.Yi.prototype.iq=function(){this.Cb.moveTo(0,0);this.Fg.mh(this.ze.x,this.ze.y);bb(this.Fg,this.Cb.Y())};h.LG={};h.bs=40;h.vs=125;h.Nw=5;h.Ww=10;h.ec=28;h.Fr=h.ec;h.Gw=8;h.lx="#000000";h.zn=250;h.An=10;h.Cw=30;h.tx=750;h.Rx=100;h.Ow=!0;h.gx=.45;h.hx=.65;h.Kh={width:96,height:124,url:"sprites.png"};h.Oa=1;h.zd=2;h.Ca=3;h.Bd=4;h.He=5;h.vn=-1;h.nr=0;h.pr=1;h.PC=0;h.QC=1;h.NC=1;h.OC=2;h.Ih=[];h.Ih[h.Oa]=h.zd;h.Ih[h.zd]=h.Oa;h.Ih[h.Ca]=h.Bd;h.Ih[h.Bd]=h.Ca;h.qg=0;h.lj=1;h.Dd=2;h.pg=3;h.Jr=null;h.En=1;h.Kr=2;h.Os="VARIABLE";h.gy="VARIABLE_DYNAMIC";h.xs="PROCEDURE";h.DF="RENAME_VARIABLE_ID";h.HC="DELETE_VARIABLE_ID";h.i.bd=function(a,c,d,e){h.i.bd.w.constructor.call(this);this.gc=a?a.id:null;this.Ub=a?a.C.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.$b=!1};h.g.object.S(h.i.bd,h.i.Abstract);h.i.bd.prototype.type=h.i.Nl;h.i.bd.prototype.Ia=function(){var a=h.i.bd.w.Ia.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.gc&&(a.blockId=this.gc);return a}; h.i.bd.prototype.pa=function(a){h.i.bd.w.pa.call(this,a);this.element=a.element;this.newValue=a.newValue;this.gc=a.blockId};h.pj=function(a){this.s=a;this.Vv=new h.g.O(a.scrollX,a.scrollY)};h.pj.prototype.I=function(){this.s=null};h.pj.prototype.Uq=function(){h.selected&&cb(h.selected);Ia(this.s)};h.pj.prototype.xf=function(a){a=h.g.O.sum(this.Vv,a);this.s.scroll(a.x,a.y)};h.vl=function(a){h.vl.w.constructor.call(this,a.ei());this.Qb=a.Qb;this.ki=a.ki};h.g.object.S(h.vl,h.pj);h.vl.prototype.xf=function(a){a=h.g.O.sum(this.Vv,a);this.ki?this.Qb.set(-a.x):this.Qb.set(-a.y)};h.F={};h.F.visible=!1;h.F.Sh=!1;h.F.sx=50;h.F.ev=0;h.F.Jk=0;h.F.Rp=0;h.F.Sp=0;h.F.$=null;h.F.an=null;h.F.ks=0;h.F.ls=10;h.F.Lx=10;h.F.ex=750;h.F.Pn=5;h.F.ya=null;h.F.La=function(){h.F.ya||(h.F.ya=document.createElement("div"),h.F.ya.className="blocklyTooltipDiv",document.body.appendChild(h.F.ya))};h.F.Rh=function(a){h.Xb(a,"mouseover",null,h.F.eB);h.Xb(a,"mouseout",null,h.F.dB);a.addEventListener("mousemove",h.F.cB,!1)}; h.F.eB=function(a){if(!h.F.Sh){for(a=a.currentTarget;"string"!=typeof a.Qd&&"function"!=typeof a.Qd;)a=a.Qd;h.F.$!=a&&(h.F.va(),h.F.an=null,h.F.$=a);clearTimeout(h.F.ev)}};h.F.dB=function(){h.F.Sh||(h.F.ev=setTimeout(function(){h.F.$=null;h.F.an=null;h.F.va()},1),clearTimeout(h.F.Jk))}; h.F.cB=function(a){if(h.F.$&&h.F.$.Qd&&!h.F.Sh)if(h.F.visible){var c=h.F.Rp-a.pageX;a=h.F.Sp-a.pageY;Math.sqrt(c*c+a*a)>h.F.Lx&&h.F.va()}else h.F.an!=h.F.$&&(clearTimeout(h.F.Jk),h.F.Rp=a.pageX,h.F.Sp=a.pageY,h.F.Jk=setTimeout(h.F.EB,h.F.ex))};h.F.va=function(){h.F.visible&&(h.F.visible=!1,h.F.ya&&(h.F.ya.style.display="none"));h.F.Jk&&clearTimeout(h.F.Jk)};h.F.block=function(){h.F.va();h.F.Sh=!0};h.F.WB=function(){h.F.Sh=!1}; h.F.EB=function(){if(!h.F.Sh&&(h.F.an=h.F.$,h.F.ya)){h.F.ya.innerHTML="";for(var a=h.F.$.Qd;"function"==typeof a;)a=a();a=h.g.Da.fw(a,h.F.sx);a=a.split("\n");for(var c=0;cd+window.scrollY&&(f-=h.F.ya.offsetHeight+2*h.F.ls);a?e=Math.max(h.F.Pn-window.scrollX,e):e+h.F.ya.offsetWidth>c+window.scrollX-2*h.F.Pn&&(e=c-h.F.ya.offsetWidth-2*h.F.Pn);h.F.ya.style.top=f+"px";h.F.ya.style.left=e+"px"}};h.Ah=function(a,c){this.Fb=this.Gb=this.gh=this.hh=this.Tc=this.uc=this.dv=null;this.Po=c;this.ck=this.Og=this.dk=this.Hg=!1;this.Od=a;this.P=this.dg=this.Gd=this.Oe=this.Xm=this.Wm=null;this.Hm=this.Jg=this.ht=!1;this.Gu=!h.Ow};b=h.Ah.prototype;b.I=function(){h.Touch.Ul();h.F.WB();this.Po.Lb=null;this.Wm&&h.fb(this.Wm);this.Xm&&h.fb(this.Xm);this.P=this.Fb=this.Gb=this.gh=this.hh=null;this.Gd&&(this.Gd.I(),this.Gd=null);this.dg&&(this.dg.I(),this.dg=null);this.Oe&&(this.Oe.I(),this.Oe=null)}; function db(a,c){a.uc=h.g.O.Mj(new h.g.O(c.clientX,c.clientY),a.dv);if(a.Hg)var d=!1;else a.Hg=h.g.O.HA(a.uc)>(a.P?h.Ww:h.Nw),d=a.Hg;if(d){if(a.ht)throw Error("updateIsDragging_ should only be called once per gesture.");a.ht=!0;if(a.Tc){a.ck=!0;a.Oe=new h.Yi(a.Tc,a.Fb);d=a.Oe;h.i.Db()||h.i.ga(!0);d.s.Rb(!1);d.Cb.wo=!1;d.Fg&&d.iq();d.Cb.dh&&d.Cb.dh(!0);var e=d.s.sa;e&&e.uy(d.Cb.Pc()?"blocklyToolboxDelete":"blocklyToolboxGrab");$a(a.Oe,a.Od,a.uc);d=!0}else d=!1;if(!d){if(a.Gb)if(a.P?(a.P.Ou(a.Gb)?((d= !eb(a.P))||(d=a.uc,d=Math.atan2(d.y,d.x)/Math.PI*180,e=a.P.uz,d=d-e||d<-180+e||d>180-e?!0:!1),d?(a.Fb=a.P.kb,fb(a.Fb),h.i.Db()||h.i.ga(!0),a.gh=null,a.Gb=gb(a.P,a.Gb),a.Gb.select(),d=!0):d=!1):d=!1,a.Og=d):a.Gb.Dc()&&(a.Og=!0),a.Og){a.Gd=new h.eg(a.Gb,a.Fb);d=a.Gd;e=a.uc;var f=a.Gu;h.i.Db()||h.i.ga(!0);d.s.ri&&ta(d.cb);h.g.m.Lk();d.s.Rb(!1);h.Qa.Yo();if(d.cb.getParent()||f&&d.cb.V&&x(d.cb.V))y(d.cb,f),e=d.Bi(e),e=h.g.O.sum(d.ze,e),d.cb.translate(e.x,e.y),h.Qa.nz(d.cb);d.cb.dh(!0);d.cb.iq(); (e=d.s.sa)&&e.uy(d.cb.Pc()?"blocklyToolboxDelete":"blocklyToolboxGrab");ma(a.Gd,a.Od,a.uc);d=!0}else d=!1;else d=!1;if(d=!d)if(a.P)d=eb(a.P);else if(d=a.Fb)d=a.Fb,d=d.options.Ob&&d.options.Ob.xf;d&&(a.dg=a.P?new h.vl(a.P):new h.pj(a.Fb),a.dk=!0,a.dg.Uq())}h.Pf()}a.Od=c} b.$o=function(a){h.g.Km(a)?this.cancel():(this.Jg=!0,h.Qa.Yo(),fb(this.Fb),this.Fb.ri&&this.Fb.resize(),Ga(this.Fb),this.Od=a,h.jc(!!this.P),h.F.block(),this.Gb&&(!this.Gb.Rc&&a.shiftKey?(h.navigation.jp(),E(this.Po.Ga,h.navigation.Ap(this.Gb))):this.Gb.select()),h.g.ui(a)?va(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||h.GA(a,this),this.dv=new h.g.O(a.clientX,a.clientY),this.Gu=a.altKey||a.ctrlKey||a.metaKey,this.Rh(a)))}; b.Rh=function(a){this.Wm=h.ra(document,"mousemove",null,this.Uj.bind(this));this.Xm=h.ra(document,"mouseup",null,this.xm.bind(this));a.preventDefault();a.stopPropagation()};b.Uj=function(a){db(this,a);this.dk?this.dg.xf(this.uc):this.Og?ma(this.Gd,this.Od,this.uc):this.ck&&$a(this.Oe,this.Od,this.uc);a.preventDefault();a.stopPropagation()}; b.xm=function(a){db(this,a);h.Pf();if(this.Hm)console.log("Trying to end a gesture recursively.");else{this.Hm=!0;if(this.ck)ab(this.Oe,a,this.uc);else if(this.Og)ra(this.Gd,a,this.uc);else if(this.dk){var c=this.dg;c.xf(this.uc);Ja(c.s)}else if(this.Tc&&!this.Hg)this.Tc.AB&&this.Tc.AB(),this.Tc.select&&this.Tc.select();else if(hb(this))this.hh.Ik(),ib(this);else if(this.gh&&!this.Hg&&!hb(this))this.P&&this.P.Qh?this.Gb.isEnabled()&&(h.i.Db()||h.i.ga(!0),ua(gb(this.P,this.Gb))):h.i.Na(new h.i.bd(this.gh, "click",void 0,void 0)),ib(this),h.i.ga(!1);else if(!(this.gh||this.Tc||this.hh||this.Hg))if(c=this.Po,a.shiftKey){h.navigation.jp();var d=h.g.xB(c,new h.g.O(a.clientX,a.clientY));d=h.B.Ij(c,d);E(c.Ga,d)}else h.selected&&cb(h.selected);a.preventDefault();a.stopPropagation();this.I()}};b.cancel=function(){if(!this.Hm){h.Pf();if(this.ck)ab(this.Oe,this.Od,this.uc);else if(this.Og)ra(this.Gd,this.Od,this.uc);else if(this.dk){var a=this.dg;a.xf(this.uc);Ja(a.s)}this.I()}}; function va(a,c){a.Gb?(ib(a),h.jc(a.P),a.Gb.Hk(c)):a.Tc?a.Tc.Hk(c):a.Fb&&!a.P&&(h.jc(),a.Fb.Hk(c));c.preventDefault();c.stopPropagation();a.I()}function jb(a,c,d){if(a.Jg)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");a.Fb||(a.Fb=d);a.Od=c;a.$o(c);h.$e&&h.navigation.Mi(h.navigation.Kl)}function kb(a,c,d){if(a.Jg)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");a.P||(a.P=d);jb(a,c,d.ei())} function ib(a){a.Gb&&!a.P&&ta(a.Gb)}function lb(a,c){a.gh||a.Tc||(a.gh=c,c.Rc&&c!=D(c)?mb(a,D(c)):mb(a,c))}function mb(a,c){c.Ua?mb(a,c.getParent()):a.Gb=c}function hb(a){if(a.hh){var c=a.hh;c=!!c.D&&c.D.Qc()&&!!c.Ik&&"function"===typeof c.Ik}else c=!1;return c&&!a.Hg&&(!a.P||!a.P.Qh)}b.yc=function(){return this.dk||this.Og||this.ck};b.bi=function(){return this.Gd?this.Gd.bi():[]};h.Ah.Hp=function(){for(var a=h.hb.getAll(),c=0,d;d=a[c];c++)if(d.Lb)return!0;return!1};h.Ea=function(a,c,d){this.Zv=this.bw=this.Be=null;this.ub=new h.g.Cd(0,0);this.Yb=null;d&&this.Aj(d);this.setValue(a);c&&(this.bw=c)};h.Ea.Ar=16;h.Ea.Ls=12.5;h.Ea.qj=10;h.Ea.Xs=10;h.Ea.zh=h.Ea.qj/2;b=h.Ea.prototype;b.name=void 0;b.av=50;b.D=null;b.If=!0;b.cg=!0;b.Vl=null;h.Ea.js="\u00a0";b=h.Ea.prototype;b.Wd=!0;b.Fs=!1;b.Aj=function(a){var c=a.tooltip;"string"==typeof c&&(c=h.g.Fc(a.tooltip));c&&this.Pd(c)}; b.wa=function(){this.jd||(this.jd=h.g.m.L("g",{},null),this.isVisible()||(this.jd.style.display="none"),this.D.Y().appendChild(this.jd),this.$j(),this.Xk(),this.Pd(this.Zv),h.F.Rh(this.Vl||this.Y()),this.cv=h.ra(this.Vl||this.Y(),"mousedown",this,this.Sf))};b.$j=function(){this.ub.height=Math.max(this.ub.height,h.Ea.Ar);this.ub.width=Math.max(this.ub.width,h.Ea.qj);this.sj=h.g.m.L("rect",{rx:4,ry:4,x:0,y:0,height:this.ub.height,width:this.ub.width},this.jd);nb(this)}; function nb(a){a.Vc=h.g.m.L("text",{"class":"blocklyText",y:h.Ea.Ls,x:a.sj?h.Ea.zh:0},a.jd);a.Ri=document.createTextNode("");a.Vc.appendChild(a.Ri)}b.I=function(){h.A.Wj(this);h.W.Wj(this);this.cv&&h.fb(this.cv);h.g.m.removeNode(this.jd)};b.Xk=function(){var a=this.Vl||this.Y();this.Wd&&a&&(this.D.Qc()?(h.g.m.Ib(a,"blocklyEditableText"),h.g.m.Sc(a,"blocklyNonEditableText"),a.style.cursor=this.Hw):(h.g.m.Ib(a,"blocklyNonEditableText"),h.g.m.Sc(a,"blocklyEditableText"),a.style.cursor=""))}; b.isVisible=function(){return this.cg};b.Eb=function(a){if(this.cg!=a){this.cg=a;var c=this.Y();c&&(c.style.display=a?"block":"none")}};b.Y=function(){return this.jd};b.Ae=function(){};b.Di=function(){if(this.Ri){this.Ri.nodeValue=ob(this);var a=h.g.m.xp(this.Vc);this.sj&&(a+=h.Ea.qj,this.sj.setAttribute("width",a));this.ub.width=a}}; b.We=function(){if(!this.isVisible())return new h.g.Cd(0,0);this.If?(this.Di(),this.If=!1):this.cg&&0==this.ub.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.Di());return this.ub};function ob(a){var c=a.Bf();if(!c)return h.Ea.js;c.length>a.av&&(c=c.substring(0,a.av-2)+"\u2026");c=c.replace(/\s/g,h.Ea.js);a.D&&a.D.H&&(c+="\u200f");return c}b.Bf=function(){if(this.yp){var a=this.yp.call(this);if(null!==a)return String(a)}return String(this.getValue())}; b.gn=function(){throw Error("setText method is deprecated");};b.mk=function(){this.If=!0};function pb(a){a.If=!0;a.D&&a.D.ca&&(a.D.Ba(),a.D.Cc())}b.setValue=function(a){if(null!==a){var c=this.gm(a);a=qb(this,a,c);if(!(a instanceof Error)){if(c=this.bw)if(c=c.call(this,a),a=qb(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.D&&h.i.isEnabled()&&h.i.Na(new h.i.uh(this.D,"field",this.name||null,c,a)),this.hm(a),this.If&&pb(this))}}}; function qb(a,c,d){if(null===d)return a.If&&pb(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.Be};b.gm=function(a){return null===a||void 0===a?null:a};b.hm=function(a){this.Be=a;this.If=!0};b.Sf=function(a){if(this.D&&this.D.C&&(a=this.D.C.Af(a))){if(a.Jg)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.hh||(a.hh=this)}};b.Pd=function(a){var c=this.Vl||this.Y();c?c.Qd=a||""===a?a:this.D:this.Zv=a}; b.ne=function(){for(var a=null,c=this.D,d=c.N,e=0;ed||d>a.Kb.length)throw Error(h.nc.Error.Bw);a.Io[c.ob()]=c;if(c.getParent()==a){var e=a.Kb.indexOf(c);-1c?d-1:c},a.Ye)}function zb(a,c,d){var e=a.Kb.length;d=c.call(a,0>d?-1:d,e);for(var f=0;f<=e;){var g=a.Kb[d]||null;if(g&&g.isEnabled()){vb(a,d);break}f++;d=c.call(a,d,e)}}b.eA=function(a){(a=wb(this,a.target))&&a.isEnabled()&&(this.Kb[this.Ye]||null)!==a&&(xb(this),this.df(a))}; b.$z=function(a){var c=wb(this,a.target),d;if(d=c)c.isEnabled()&&(c.df(!0),Bb(c)),d=void 0;d&&a.preventDefault()};b.cA=function(){this.focus()};b.dA=function(){this.$&&(this.blur(),xb(this),vb(this,-1))};b.Cp=function(a){return 0!=this.Kb.length&&Cb(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1}; function Cb(a,c){var d=a.Kb[a.Ye]||null;if(d&&"function"==typeof d.Cp&&d.Cp(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case h.g.rb.Mr:d&&Bb(d);break;case h.g.rb.by:Ab(a);break;case h.g.rb.Mw:yb(a);break;default:return!1}return!0};h.zl=function(a,c){h.nc.call(this);this.wf=a;this.setValue(c);this.jm=!0};h.g.object.S(h.zl,h.nc);b=h.zl.prototype; b.La=function(){var a=document.createElement("div");a.id=this.ob();this.$=a;a.className="goog-menuitem goog-option "+(this.jm?"":"goog-menuitem-disabled ")+(this.Ho?"goog-option-selected ":"")+(this.Ru()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.vj){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(Db(this));h.g.Pa.Li(a,this.Jq||(this.vj?h.g.Pa.co.Ax: h.g.Pa.co.zx));h.g.Pa.Mi(a,h.g.Pa.State.fo,this.vj&&this.Ho||!1)};function Db(a){a=a.wf;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.Be=a};b.getValue=function(){return this.Be};b.Li=function(a){this.Jq=a};function Eb(a,c){if(a.vj){a.Ho=c;var d=a.$;d&&a.isEnabled()&&(c?(h.g.m.Ib(d,"goog-option-selected"),h.g.Pa.Mi(d,h.g.Pa.State.fo,!0)):(h.g.m.Sc(d,"goog-option-selected"),h.g.Pa.Mi(d,h.g.Pa.State.fo,!1)))}} b.df=function(a){var c=this.$;c&&this.isEnabled()&&(a?h.g.m.Ib(c,"goog-menuitem-highlight"):h.g.m.Sc(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.jm};b.we=function(a){this.jm=a;(a=this.$)&&(this.jm?h.g.m.Sc(a,"goog-menuitem-disabled"):h.g.m.Ib(a,"goog-menuitem-disabled"))};function Bb(a){a.vj&&Eb(a,!a.Ho);a.$s&&a.$s.call(a.sy,a)}function Fb(a,c,d){a.$s=c;a.sy=d};h.Sd=function(a){this.name=a};h.B=function(a,c,d){if(!c)throw Error("Cannot create a node without a location.");this.Vk=a;this.bk=h.B.wA(a);this.ba=c;(a=d||null)&&a.hw&&(this.iw=a.hw)};h.B.types={Zc:"field",Ic:"block",Ie:"input",Jh:"output",xd:"next",Ad:"previous",$d:"stack",sg:"workspace"};h.B.Kw=-20;h.B.wA=function(a){switch(a){case h.B.types.Ad:case h.B.types.xd:case h.B.types.Ie:case h.B.types.Jh:return!0}return!1};h.B.Gj=function(a){return new h.B(h.B.types.Zc,a)}; h.B.je=function(a){return a?a.type==h.Oa||a.type==h.Ca&&a.ne()?h.B.Ag(a.ne()):a.type==h.Ca?new h.B(h.B.types.xd,a):a.type==h.zd?new h.B(h.B.types.Jh,a):a.type==h.Bd?new h.B(h.B.types.Ad,a):null:null};h.B.Ag=function(a){return a?new h.B(h.B.types.Ie,a.connection):null};h.B.Te=function(a){return new h.B(h.B.types.Ic,a)};h.B.Hj=function(a){return new h.B(h.B.types.$d,a)};h.B.Ij=function(a,c){return new h.B(h.B.types.sg,a,{hw:c})};b=h.B.prototype;b.jb=function(){return this.Vk}; function Gb(a,c){a=a.ba;a instanceof h.hl||(a=a.D);if(!a||!a.C)return null;var d=D(a);a=G(d.C,!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:h.B.Hj(a[c]);throw Error("Couldn't find "+(c?"next":"previous")+" stack?!");}function Hb(a){if(!a)return null;do var c=a.R&&x(a.R);while(c&&u(c)==a&&(a=c));return(c=a.R||a.M)&&c.la&&c.la.ne()?h.B.Ag(c.la.ne()):h.B.Hj(a)} b.next=function(){switch(this.Vk){case h.B.types.$d:return Gb(this,!0);case h.B.types.Jh:return h.B.Te(this.ba.D);case h.B.types.Zc:a:{var a=this.ba,c=a.ne();var d=a.D;a=c.Ma.indexOf(a)+1;c=d.N.indexOf(c);for(var e;e=d.N[c];c++){for(var f=e.Ma;aa.length)){e=[];for(f=0;fthis.Ck)return null;var a=this.getOptions(!0)[this.Ck][0];return"object"==typeof a?a.alt:a}; h.Fa.aw=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=this.left&&a<=this.right&&c>=this.top&&c<=this.bottom};h.i.cj=function(a){this.Ub=a.id;this.group=h.i.Db();this.$b=!1};h.g.object.S(h.i.cj,h.i.Abstract);h.i.cj.prototype.type=h.i.Vw;h.i.cj.prototype.Ia=function(){var a={type:this.type};this.group&&(a.group=this.group);this.Ub&&(a.workspaceId=this.Ub);return a};h.i.cj.prototype.pa=function(a){this.Ub=a.workspaceId;this.group=a.group};h.K={};h.K.qn=function(a){var c=H,d=h.g.xml.createElement("xml"),e=h.K.XB(h.Z.bt(c));e.hasChildNodes()&&d.appendChild(e);var f=Pa(c,!0);e=0;for(var g;g=f[e];e++)d.appendChild(g.$q(a));c=G(c,!0);for(e=0;f=c[e];e++)d.appendChild(h.K.Bo(f,a));return d};h.K.XB=function(a){for(var c=h.g.xml.createElement("variables"),d=0,e;e=a[d];d++){var f=h.g.xml.createElement("variable");f.appendChild(h.g.xml.createTextNode(e.name));e.type&&f.setAttribute("type",e.type);f.id=e.ob();c.appendChild(f)}return c}; h.K.Bo=function(a,c){var d;a.C.H&&(d=a.C.di());c=h.K.sf(a,c);var e=a.Ha();c.setAttribute("x",Math.round(a.C.H?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c}; h.K.zz=function(a){var c=!1;a.name&&(a.Fs?c=!0:a.Wd&&(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=h.g.xml.createElement("field"),c.setAttribute("name",a.name),c.textContent=a.getValue(),c):null};h.K.xy=function(a,c){for(var d=0,e;e=a.N[d];d++)for(var f=0,g;g=e.Ma[f];f++)(g=h.K.zz(g))&&c.appendChild(g)}; h.K.sf=function(a,c){var d=h.g.xml.createElement(a.Ua?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.qd){var e=a.qd();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}h.K.xy(a,d);if(e=a.Hd.text){var f=a.Hd.size,g=a.Hd.tv,k=h.g.xml.createElement("comment");k.appendChild(h.g.xml.createTextNode(e));k.setAttribute("pinned",g);k.setAttribute("h",f.height);k.setAttribute("w",f.width);d.appendChild(k)}a.data&&(e=h.g.xml.createElement("data"),e.appendChild(h.g.xml.createTextNode(a.data)), d.appendChild(e));for(f=0;g=a.N[f];f++){var l;k=!0;if(g.type!=h.He){var m=x(g.connection);g.type==h.Oa?l=h.g.xml.createElement("value"):g.type==h.Ca&&(l=h.g.xml.createElement("statement"));e=g.connection.xe;!e||m&&m.Ua||l.appendChild(h.K.nt(e,c));m&&(l.appendChild(h.K.sf(m,c)),k=!1);l.setAttribute("name",g.name);k||d.appendChild(l)}}void 0!=a.Ze&&a.Ze!=a.uA&&d.setAttribute("inline",a.Ze);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.Pc()||a.Ua||d.setAttribute("deletable", !1);a.Dc()||a.Ua||d.setAttribute("movable",!1);a.Qc()||d.setAttribute("editable",!1);if(f=u(a))l=h.g.xml.createElement("next"),l.appendChild(h.K.sf(f,c)),d.appendChild(l);e=a.V&&a.V.xe;!e||f&&f.Ua||l.appendChild(h.K.nt(e,c));return d}; h.K.nt=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==h.g.m.Node.TEXT_NODE&&""==e.data.trim()&&d.firstChild!=e&&h.g.m.removeNode(e);d&&(e=d,d=d.nextSibling,e.nodeType==h.g.m.Node.TEXT_NODE&&""==e.data.trim()&&h.g.m.removeNode(e))}return a}; h.K.Mc=function(a){a=h.g.xml.Mc(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1 $2")}while(a!=d);return a};h.K.OG=function(a){a=h.K.Mc(a).split("<");for(var c="",d=1;d"!=e.slice(-2)&&(c+=" ")}a=a.join("\n");a=a.replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1");return a.replace(/^\n/,"")}; h.K.$f=function(a){var c=h.g.xml.NB(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};h.K.IG=function(a,c){c.Rb(!1);c.clear();a=h.K.Eg(a,c);c.Rb(!0);return a}; h.K.Eg=function(a,c){if(a instanceof h.hb){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var e;c.H&&(e=c.di());d=[];h.g.m.Lk();var f=a.childNodes.length,g=h.i.Db();g||h.i.ga(!0);c.Rb&&c.Rb(!1);var k=!0;try{for(var l=0;l=this.s.options.Rm)){a={scrollbars:!0,Nj:this.s.options.Nj,Ac:this.s,H:this.s.H,zi:this.s.options.zi,Bk:this.s.options.Bk};if(this.s.Ff){a.Va=this.s.Va==h.qg?h.lj:h.qg;if(!h.Jn)throw Error("Missing require for Blockly.HorizontalFlyout");this.P=new h.Jn(a)}else{a.Va=this.s.Va==h.pg?h.Dd:h.pg;if(!h.rg)throw Error("Missing require for Blockly.VerticalFlyout");this.P=new h.rg(a)}Ua(this.s,this.XA.bind(this))}};b=h.oo.prototype;b.nj=47;b.fl=44;b.Eh=16;b.vx=20; b.ds=20;b.yl=10;b.io=0;b.jo=32;b.ax=.1;b.Np=!1;b.Sm=0;b.J=null;b.kn=null;b.Tp=0;b.Of=0;b.Vu=0;b.$v=0; b.La=function(){this.J=h.g.m.L("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var c=h.g.m.L("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.J);h.g.m.L("rect",{width:this.nj,height:this.fl,y:this.Eh},c);var d=h.g.m.L("image",{width:h.Kh.width,x:-this.io,height:h.Kh.height,y:-this.jo,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.J);d.setAttributeNS(h.g.m.dd,"xlink:href",this.s.options.$m+h.Kh.url);c=h.g.m.L("clipPath",{id:"blocklyTrashLidClipPath"+a},this.J); h.g.m.L("rect",{width:this.nj,height:this.Eh},c);this.kn=h.g.m.L("image",{width:h.Kh.width,x:-this.io,height:h.Kh.height,y:-this.jo,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.J);this.kn.setAttributeNS(h.g.m.dd,"xlink:href",this.s.options.$m+h.Kh.url);h.ra(this.J,"mouseup",this,this.click);h.Xb(d,"mouseover",this,this.OA);h.Xb(d,"mouseout",this,this.MA);this.so();return this.J}; b.wa=function(a){0this.Sm&&1>this.Of&&(this.Tp=setTimeout(this.so.bind(this),20))};function Rb(a,c){var d=a.s.Va==h.pg||a.s.Ff&&a.s.H;a.kn.setAttribute("transform","rotate("+(d?-c:c)+","+(d?4:a.nj-4)+","+(a.Eh-2)+")")}b.close=function(){qa(this,!1)}; b.click=function(){if(this.zg.length){for(var a=[],c=0,d;d=this.zg[c];c++)a[c]=h.K.$f(d);this.P.show(a)}};b.OA=function(){this.zg.length&&qa(this,!0)};b.MA=function(){qa(this,!1)}; b.XA=function(a){if(!(0>=this.s.options.Rm)&&a.type==h.i.xw&&"shadow"!=a.pq.tagName.toLowerCase()){for(var c=a=a.pq.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=h.K.Mc(a);if(-1==this.zg.indexOf(a)){for(this.zg.unshift(a);this.zg.length>this.s.options.Rm;)this.zg.pop();this.Sm=this.ax;Rb(this,45*this.Sm)}}};h.Hb=Object.create(null);h.ea=function(a,c){this.D=a;this.type=c};h.ea.jl=0;h.ea.As=1;h.ea.Ds=2;h.ea.Cs=3;h.ea.ys=4;h.ea.zs=5;h.ea.Bs=6;b=h.ea.prototype;b.la=null;b.Qe=null;b.xe=null;b.qb=0;b.Ka=0; b.Id=function(a){var c=this,d=c.D,e=a.D;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=x(c),g=c.xe;c.xe=null;if(f.Ua)g=h.K.sf(f),f.I(),f=null;else if(c.type==h.Oa){if(!f.M)throw Error("Orphan block does not have an output connection.");var k=h.ea.Tu(e,f);k&&(f.M.connect(k),f=null)}else if(c.type==h.Ca){if(!f.R)throw Error("Orphan block does not have a previous connection.");for(k=e;k.V;){var l=u(k);if(l&&!l.Ua)k=l;else{Sb(f.R,k.V)&&(k.V.connect(f.R),f=null);break}}}if(f&&(c.disconnect(), h.i.$b)){var m=h.i.Db();setTimeout(function(){f.C&&!f.getParent()&&(h.i.ga(m),f.M?f.M.Vm(c):f.R&&f.R.Vm(c),h.i.ga(!1))},h.zn)}c.xe=g}var n;h.i.isEnabled()&&(n=new h.i.Xi(e));h.ea.Yy(c,a);e.Ki(d);n&&(n.$g(),h.i.Na(n))};b.I=function(){if(this.isConnected()){this.xe=null;var a=x(this);a.Ua?a.I():y(a)}};function C(a){return a.type==h.Oa||a.type==h.Ca}b.isConnected=function(){return!!this.la}; function Kb(a,c){if(!c)return h.ea.Cs;if(C(a))var d=a.D,e=c.D;else e=a.D,d=c.D;return d&&d==e?h.ea.As:c.type!=h.Ih[a.type]?h.ea.Ds:d&&e&&d.C!==e.C?h.ea.zs:Sb(a,c)?d.Ua&&!e.Ua?h.ea.Bs:h.ea.jl:h.ea.ys} function Lb(a,c){switch(Kb(a,c)){case h.ea.jl:break;case h.ea.As:throw Error("Attempted to connect a block to itself.");case h.ea.zs:throw Error("Blocks not on same workspace.");case h.ea.Ds:throw Error("Attempt to connect incompatible types.");case h.ea.Cs:throw Error("Target connection is null.");case h.ea.ys:throw Error("Connection checks failed. "+(a+" expected "+a.Qe+", found "+c.Qe));case h.ea.Bs:throw Error("Connecting non-shadow to shadow block.");default:throw Error("Unknown connection failure: this should never happen!"); }}b.Fm=function(a){if(a.D.Kf()||Kb(this,a)!=h.ea.jl)return!1;switch(a.type){case h.Bd:return this.la||-1!=h.Oj.indexOf(a)?a=!1:a.la?(a=x(a),a=a.Kf()?!(a.R&&x(a.R)):!1):a=!0,a;case h.zd:if(a.isConnected()&&!x(a).Kf()||this.isConnected())return!1;break;case h.Oa:if(a.isConnected()&&!x(a).Dc()&&!x(a).Ua)return!1;break;case h.Ca:if(a.isConnected()&&!this.D.V&&!x(a).Ua&&x(a).V)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=h.Oj.indexOf(a)?!1:!0};b.Vm=function(){}; b.connect=function(a){if(this.la!=a){Lb(this,a);var c=h.i.Db();c||h.i.ga(!0);C(this)?this.Id(a):a.Id(this);c||h.i.ga(!1)}};h.ea.Yy=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.la=c;c.la=a};h.ea.FB=function(a,c){for(var d=!1,e=0;ec||c>a.Ma.length)throw Error("index "+c+" out of bounds.");if(!(d||""==d&&e))return c;"string"==typeof d&&(d=new h.$c(d));if(d.D)throw Error("Field already bound to a block.");d.D=a.D;a.D.ca&&d.wa();d.name=e;d.yq&&(c=Ub(a,c,d.yq));a.Ma.splice(c,0,d);++c;d.Wq&&(c=Ub(a,c,d.Wq));a.D.ca&&(a.D.Ba(),a.D.Cc());return c}b.isVisible=function(){return this.cg}; b.Eb=function(a){var c=[];if(this.cg==a)return c;for(var d=(this.cg=a)?"block":"none",e=0,f;f=this.Ma[e];e++)f.Eb(a);if(this.connection){if(a)c=Vb(this.connection);else if(e=this.connection,Wb(e,!0),e.la)for(e=p(x(e),!1),f=0;fa&&0<=c&&256>c&&0<=d&&256>d)?h.g.yb.Iq(a,c,d):null}; h.g.yb.Iq=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};h.g.yb.Hu=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; h.g.yb.kA=function(a){var c=h.gx,d=255*h.hx,e=0,f=0,g=0;if(0==c)g=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;g=a;break;case 2:e=a;f=d;g=c;break;case 3:e=a;f=m;g=d;break;case 4:e=c;f=a;g=d;break;case 5:e=d;f=a;g=m;break;case 6:case 0:e=d,f=c,g=a}}return h.g.yb.Iq(Math.floor(e),Math.floor(f),Math.floor(g))}; h.g.yb.zo=function(a,c,d){a=h.g.yb.Hu(h.g.yb.parse(a));c=h.g.yb.Hu(h.g.yb.parse(c));return h.g.yb.Iq(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])))};h.g.yb.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"};h.hl=function(a,c,d){if(h.Generator&&"undefined"!=typeof h.Generator.prototype[c])throw Error('Block prototypeName "'+c+'" conflicts with Blockly.Generator members.');this.id=d&&!v(a,d)?d:h.g.Ve();a.Ao[this.id]=this;this.R=this.V=this.M=null;this.N=[];this.Ze=void 0;this.disabled=!1;this.Qd="";this.contextMenu=!0;this.se=null;this.Re=[];this.St=this.fv=this.Gt=!0;this.Se=this.Ua=!1;this.zj=null;this.Hd={text:null,tv:!1,size:new h.g.Cd(160,80)};this.jw=new h.g.O(0,0);this.C=a;this.Rc=a.qe;this.H=a.H; this.gk=!1;this.Xe=void 0;if(c){this.type=c;d=h.Hb[c];if(!d||"object"!=typeof d)throw TypeError("Unknown block type: "+c);h.g.object.yi(this,d)}a.Ui.push(this);a.ff[this.type]||(a.ff[this.type]=[]);a.ff[this.type].push(this);"function"==typeof this.wa&&this.wa();this.uA=this.Ze;if(h.i.isEnabled()){(a=h.i.Db())||h.i.ga(!0);try{h.i.Na(new h.i.il(this))}finally{a||h.i.ga(!1)}}if("function"==typeof this.onchange){if((a=this.onchange)&&"function"!=typeof a)throw Error("onchange must be a function.");this.rk&& Va(this.C,this.rk);if(this.onchange=a)this.rk=a.bind(this),Ua(this.C,this.rk)}};b=h.hl.prototype;b.data=null;b.wg="#000000";b.qt=null;b.rt=null; b.I=function(a){if(this.C){this.rk&&Va(this.C,this.rk);h.$e&&h.navigation.gv(this);y(this,a);h.i.isEnabled()&&h.i.Na(new h.i.zw(this));h.i.disable();try{if(this.C){Oa(this.C,this);var c=this.C;c.ff[this.type].splice(c.ff[this.type].indexOf(this),1);c.ff[this.type].length||delete c.ff[this.type];delete this.C.Ao[this.id];this.C=null}h.selected==this&&(h.selected=null);for(var d=this.Re.length-1;0<=d;d--)this.Re[d].I(!1);d=0;for(var e;e=this.N[d];d++)e.I();this.N.length=0;var f=this.kd(!0);d=0;for(var g;g= f[d];d++)g.I()}finally{h.i.enable()}}};function y(a,c){if(a.M){var d=null;a.M.isConnected()&&(d=a.M.la,a.M.disconnect());if(d&&c){a:{c=null;for(var e=0;e=d)this.wg=h.lA(d);else if(d=h.g.yb.parse(c))this.wg=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);}; function ba(a,c){for(var d=0,e;e=a.N[d];d++)for(var f=0,g;g=e.Ma[f];f++)if(g.name==c)return g;return null}function Na(a){for(var c=0,d;d=a.N[c];c++)for(var e=0;d.Ma[e];e++);return[]}function Ma(a,c){return(a=ba(a,c))?a.getValue():null} b.fh=function(a,c){if(a){void 0===c&&(c=null);if(!this.R){if(this.M)throw Error("Remove output connection prior to adding previous connection.");this.R=this.lk(h.Bd)}this.R.Gi(c)}else if(this.R){if(this.R.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.R.I();this.R=null}}; b.Ji=function(a,c){if(a)void 0===c&&(c=null),this.V||(this.V=this.lk(h.Ca)),this.V.Gi(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.Oq=function(a,c){if(a){void 0===c&&(c=null);if(!this.M){if(this.R)throw Error("Remove previous connection prior to adding output connection.");this.M=this.lk(h.zd)}this.M.Gi(c)}else if(this.M){if(this.M.isConnected())throw Error("Must disconnect output value before removing connection.");this.M.I();this.M=null}};b.Ii=function(a){this.Ze!=a&&(h.i.Na(new h.i.uh(this,"inline",null,this.Ze,a)),this.Ze=a)}; function Tb(a){if(void 0!=a.Ze)return a.Ze;for(var c=1;ca&&(d=d.substring(0,a-3)+"...");return d};function Zb(a,c){return a.Ne(h.He,c||"")} function $b(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.Xe&&(a.Xe=c.style.Xe,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{var f=a.C.zp().Gy[e];if(f)a.qt=f.colourSecondary,a.rt=f.colourTertiary,a.Xe=f.Xe,a.ud(f.colourPrimary);else throw Error("Invalid style name: "+e);}catch(B){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.ud(e)}catch(B){console.warn(d+"Illegal colour value: ",e)}}for(e=0;void 0!==c["message"+e];){f=a;for(var g=c["args"+e]||[],k=c["lastDummyAlign"+e],l=h.g.RB(c["message"+e]),m=[],n=0,q=[],r=0;r=t||t>g.length)throw Error('Block "'+f.type+'": Message index %'+t+" out of range.");if(m[t])throw Error('Block "'+f.type+'": Message index %'+t+" duplicated."); m[t]=!0;n++;q.push(g[t-1])}else(t=t.trim())&&q.push(t)}if(n!=g.length)throw Error('Block "'+f.type+'": Message does not reference all '+g.length+" arg(s).");q.length&&("string"==typeof q[q.length-1]||h.g.Da.startsWith(q[q.length-1].type,"field_"))&&(r={type:"input_dummy"},k&&(r.align=k),q.push(r));k={LEFT:h.vn,RIGHT:h.pr,CENTRE:h.nr};g=[];for(r=0;rc?!1:h.Ke.w.Fm.call(this,a)};b.Vm=function(a){Mb(this,a)};b.Wo=function(a,c){h.Ke.w.Wo.call(this,a,c);a.ca&&a.Ba();c.ca&&(Pb(c),c.Ba())}; b.Hq=function(){var a=this.D,c=this.xe;if(a.C&&c&&h.i.$b){h.Ke.w.Hq.call(this);c=x(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.mi();c.Ba(!1);a.ca&&a.Ba()}};b.hv=function(a){return ic(this.Dt,this,a)};b.Id=function(a){h.Ke.w.Id.call(this,a);var c=this.D;a=a.D;c.ca&&Pb(c);a.ca&&Pb(a);c.ca&&a.ca&&(this.type==h.Ca||this.type==h.Bd?a.Ba():c.Ba())};b.mv=function(){this.isConnected()&&!Sb(this,this.la)&&(y(C(this)?x(this):this.D),this.D.Cc())};h.Je=function(a){this.ka=a};b=h.Je.prototype;b.ot=!0;b.Gl=17;b.ug=null;b.Am=null; function jc(a){if(!a.pe){a.pe=h.g.m.L("g",{"class":"blocklyIconGroup"},null);a.ka.Rc&&h.g.m.Ib(a.pe,"blocklyIconGroupReadonly");var c=a.pe;h.g.m.L("path",{"class":"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},c);h.g.m.L("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},c);h.g.m.L("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},c);a.ka.Y().appendChild(a.pe);h.ra(a.pe,"mouseup",a,a.mA);a.Xk()}} b.I=function(){h.g.m.removeNode(this.pe);this.pe=null;this.Eb(!1);this.ka=null};b.Xk=function(){};b.isVisible=function(){return!!this.ug};b.mA=function(a){this.ka.C.yc()||this.ka.Rc||h.g.ui(a)||this.Eb(!this.isVisible())};b.Ae=function(){this.isVisible()&&this.ug.ud(this.ka.wg)};function na(a,c){a.Am=c;a.isVisible()&&(a=a.ug,a.xb=c,a.Eq&&Wa(a))}function kc(a){var c=a.ka.Ha(),d=h.g.ld(a.pe);c=new h.g.O(c.x+d.x+a.Gl/2,c.y+d.y+a.Gl/2);h.g.O.me(a.Am,c)||na(a,c)};h.ee=function(a){h.ee.w.constructor.call(this,a);jc(this);this.Si={}};h.g.object.S(h.ee,h.Je);h.ee.prototype.ot=!1;h.ee.OB=function(a){var c=h.g.m.L("text",{"class":"blocklyText blocklyBubbleText",y:h.oa.Td},null);a=a.split("\n");for(var d=0;d=a.zb.length)return-1;for(var e=c.Ka,f=d;0<=f&&a.zb[f].Ka==e;){if(a.zb[f]==c)return f;f--}for(;dc.Ka)e=f;else{d=f;break}}return d}function bc(a,c){if(!c.Gf)throw Error("Connection not in database.");var d=pc(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.Gf=!1;a.zb.splice(d,1)} function ic(a,c,d){function e(n){var q=g-f[n].qb,r=k-f[n].Ka;Math.sqrt(q*q+r*r)<=d&&m.push(f[n]);return r document.");}else a=null;return a};h.Jc=function(a,c){h.Jc.w.constructor.call(this,a,c);this.Jm=!1;this.ed={};this.Tv=this.xk=0;this.qq=null};h.g.object.S(h.Jc,h.Ah);h.Jc.oy=5;h.Jc.py=6;b=h.Jc.prototype;b.$o=function(a){h.Jc.w.$o.call(this,a);!this.Hm&&h.Touch.Mm(a)&&rc(this,a)};b.Rh=function(a){this.qq=h.ra(document,"mousedown",null,this.fA.bind(this),!0);this.Wm=h.ra(document,"mousemove",null,this.Uj.bind(this),!0);this.Xm=h.ra(document,"mouseup",null,this.xm.bind(this),!0);a.preventDefault();a.stopPropagation()}; b.fA=function(a){!this.yc()&&h.Touch.Mm(a)&&(rc(this,a),this.Jm&&h.Pf())};b.Uj=function(a){if(this.yc())h.Touch.Sq(a)&&h.Jc.w.Uj.call(this,a);else if(this.Jm){if(h.Touch.Mm(a)){this.ed[h.Touch.vm(a)]=sc(this,a);var c=Object.keys(this.ed);if(2==c.length){c=h.g.O.Pt(this.ed[c[0]],this.ed[c[1]])/this.Tv;if(0this.xk){var d=c-this.xk;d=0Object.keys(this.ed).length&&(this.ed={},this.xk=0)}!this.Jm||this.yc()?h.Touch.Sq(a)&&h.Jc.w.xm.call(this,a):(a.preventDefault(),a.stopPropagation(),this.I())};b.I=function(){h.Jc.w.I.call(this);this.qq&&h.fb(this.qq)};function rc(a,c){a.ed[h.Touch.vm(c)]=sc(a,c);var d=Object.keys(a.ed);2==d.length&&(a.Tv=h.g.O.Pt(a.ed[d[0]],a.ed[d[1]]),a.Jm=!0,c.preventDefault())} function sc(a,c){return a.Fb?new h.g.O(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};h.Us=function(a){this.uq=a;this.jj=Object.create(null)};b=h.Us.prototype;b.Qp=null;b.I=function(){this.jj=this.uq=null};b.load=function(a,c){if(a.length){try{var d=new h.g.global.Audio}catch(l){return}for(var e,f=0;f=Ra(a)))if(a.Lb&&a.Lb.cancel(),"comment"==c.tagName.toLowerCase()){h.i.disable();try{h.Oh.setValue(c.textContent);var d=void 0;var e=parseInt(c.getAttribute("x"),10),f=parseInt(c.getAttribute("y"),10);isNaN(e)||isNaN(f)||(a.H&&(e=-e),d.moveBy(e+50,f+50))}finally{h.i.enable()}d.select()}else a:{h.i.disable();try{var g=h.K.Zh(c,a),k=a.tb.mb;if(h.$e&&k){h.navigation.Mu(g,k.ba);break a}var l=parseInt(c.getAttribute("x"),10),m= parseInt(c.getAttribute("y"),10);if(!isNaN(l)&&!isNaN(m)){a.H&&(l=-l);do{c=!1;var n=F(a,!1);d=0;for(var q;q=n[d];d++){var r=q.Ha();if(1>=Math.abs(l-r.x)&&1>=Math.abs(m-r.y)){c=!0;break}}if(!c){var t=g.kd(!1);d=0;for(var B;B=t[d];d++)if(B.closest(h.ec,new h.g.O(l,m)).connection){c=!0;break}}c&&(l=a.H?l-h.ec:l+h.ec,m+=2*h.ec)}while(c);g.moveBy(l,m)}}finally{h.i.enable()}h.i.isEnabled()&&!g.Ua&&h.i.Na(new h.i.il(g));g.select()}}function Ac(a){(a=a.qe?a.lh:a)&&!a.Lb&&a.sa&&a.sa.P&&a.sa.oH()} b.ah=function(a,c){h.Sa.w.ah.call(this,a,c);Ac(this)};b.Xh=function(a){h.Sa.w.Xh.call(this,a);Ac(this)};b.Jd=function(a,c,d){a=h.Sa.w.Jd.call(this,a,c,d);Ac(this);return a};function uc(a){a.It=a.bc&&a.J.parentNode?a.bc.rm():null;a.Ht=a.P?a.P.rm():a.sa?a.sa.rm():null}function oa(a,c){return a.It&&a.It.contains(c.clientX,c.clientY)?h.En:a.Ht&&a.Ht.contains(c.clientX,c.clientY)?h.Kr:h.Jr}b.Sf=function(a){var c=this.Af(a);c&&jb(c,a,this)}; b.Uq=function(a,c){a=h.g.qk(a,z(this),Ha(this));a.x/=this.scale;a.y/=this.scale;this.Qt=h.g.O.Mj(c,a)};b.yc=function(){return null!=this.Lb&&this.Lb.yc()};function Bc(a){return a.options.Ob&&a.options.Ob.scrollbars||a.options.Ob&&a.options.Ob.qh||a.options.Ob&&a.options.Ob.xf||a.options.gb&&a.options.gb.controls||a.options.gb&&a.options.gb.qh} b.Dc=function(){return this.options.Ob&&this.options.Ob.scrollbars||this.options.Ob&&this.options.Ob.qh||this.options.Ob&&this.options.Ob.xf||this.options.gb&&this.options.gb.qh}; b.gB=function(a){if(h.Ah.Hp())a.preventDefault(),a.stopPropagation();else{var c=this.options.gb&&this.options.gb.qh,d=this.options.Ob&&this.options.Ob.qh;if(c||d){var e=h.g.pu(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=h.g.qk(a,z(this),Ha(this)),this.zoom(c.x,c.y,e));a.preventDefault()}}}; function Ob(a){var c=G(a,!1);a=Pa(a,!1);c=c.concat(a);if(!c.length)return new h.g.Rect(0,0,0,0);a=nc(c[0]);for(var d=1;da.bottom&&(a.bottom=e.bottom);e.lefta.right&&(a.right=e.right)}return a}b.Ry=function(){this.Rb(!1);h.i.ga(!0);for(var a=G(this,!0),c=0,d=0,e;e=a[d];d++)if(e.Dc()){var f=e.Ha();e.moveBy(-f.x,c-f.y);mc(e);c=e.Ha().y+A(e).height+h.ma.hs}h.i.ga(!1);this.Rb(!0)}; b.Hk=function(a){function c(B){if(B.Pc())t=t.concat(p(B,!1));else{B=Qa(B,!1);for(var R=0;Rt.length?d():h.confirm(h.h.DELETE_ALL_BLOCKS.replace("%1",t.length),function(B){B&&d()})}};e.push(l);this.ut&&this.ut(e);h.ua.show(a,e,this.H)}};function Ga(a){if(a.options.Ac)Ga(a.options.Ac);else{h.kk=a;document.activeElement&&document.activeElement.blur();try{z(a).focus()}catch(c){try{z(a).parentNode.setActive()}catch(d){z(a).parentNode.focus()}}}} b.zoom=function(a,c,d){if(!this.qe&&!this.ri){d=Math.pow(this.options.gb.wB,d);var e=this.scale*d;if(this.scale!=e){e>this.options.gb.nk?d=this.options.gb.nk/this.scale:ethis.options.gb.nk?a=this.options.gb.nk:this.options.gb.pk&&af?h.W.wk(a,0,d.height+f):h.W.wk(a,f,d.height)};h.W.Jy=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)}; h.W.Ky=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};h.rg=function(a){a.vc=this.um.bind(this);a.eh=this.Nv.bind(this);h.rg.w.constructor.call(this,a);this.ki=!1};h.g.object.S(h.rg,h.dj);b=h.rg.prototype;b.um=function(){if(!this.isVisible())return null;try{var a=this.s.$a.getBBox()}catch(f){a={height:0,y:0,width:0,x:0}}var c=this.eo,d=this.Zb-2*this.eo,e=this.Xa;this.H||(e-=this.eo);return{vb:d,lb:e,gd:a.height*this.s.scale+2*this.kf,ie:a.width*this.s.scale+2*this.kf,Bb:-this.s.scrollY+a.y,wb:-this.s.scrollX,ic:a.y,tc:a.x,rc:c,fc:0}}; b.Nv=function(a){var c=this.um();c&&("number"==typeof a.y&&(this.s.scrollY=-c.gd*a.y),this.s.translate(this.s.scrollX+c.fc,this.s.scrollY+c.rc))}; b.position=function(){if(this.isVisible()){var a=this.kb.vc();if(a){this.Zb=a.vb;var c=this.Xa-this.ab,d=a.vb-2*this.ab,e=this.Ti==h.pg,f=c+this.ab;f=["M "+(e?f:0)+",0"];f.push("h",e?-c:c);f.push("a",this.ab,this.ab,0,0,e?0:1,e?-this.ab:this.ab,this.ab);f.push("v",Math.max(0,d));f.push("a",this.ab,this.ab,0,0,e?0:1,e?this.ab:-this.ab,this.ab);f.push("h",e?c:-c);f.push("z");this.Sb.setAttribute("d",f.join(" "));c=this.Zb;a=this.kb.Va==this.Ti?a.Yv?this.Ti==h.Dd?a.Yv:a.lb-this.Xa:this.Ti==h.Dd?0:a.lb: this.Ti==h.Dd?0:a.lb+a.fc-this.Xa;this.J.setAttribute("width",this.Xa);this.J.setAttribute("height",c);"svg"==this.J.tagName?h.g.m.Dk(this.J,"translate("+a+"px,0px)"):this.J.setAttribute("transform","translate("+a+",0)");this.Qb&&(this.Qb.rq=new h.g.O(a,0),this.Qb.resize(),za(this.Qb,this.Qb.te.x,this.Qb.te.y))}}};b.YB=function(a){var c=h.g.pu(a);if(c.y){var d=this.um();c=d.Bb-d.ic+c.y;c=Math.min(c,d.gd-d.vb);c=Math.max(c,0);this.Qb.set(c);h.W.va()}a.preventDefault();a.stopPropagation()}; function Ec(a,c,d){a.s.scale=a.kb.scale;for(var e=a.kf,f=a.H?e:e+a.Qi,g=0,k;k=c[g];g++)if("block"==k.type){k=k.block;for(var l=p(k,!1),m=0,n;n=l[m];m++)n.Rc=!0;k.Ba();n=k.Y();l=A(k);m=k.M?f-a.Qi:f;k.moveBy(m,e);var q=a,r=k,t=g;m=h.g.m.L("rect",{"fill-opacity":0,x:a.H?m-l.width:m,y:e,height:l.height,width:l.width},null);m.Qd=r;h.F.Rh(m);q.s.$a.insertBefore(m,r.Y());r.Zt=m;q.Qm[t]=m;q=a;q.zc.push(h.ra(n,"mousedown",null,Fc(q,k)));q.zc.push(h.ra(m,"mousedown",null,Fc(q,k)));q.zc.push(h.Xb(n,"mouseover", k,k.Pl));q.zc.push(h.Xb(n,"mouseout",k,k.Ak));q.zc.push(h.Xb(m,"mouseover",k,k.Pl));q.zc.push(h.Xb(m,"mouseout",k,k.Ak));e+=l.height+d[g]}else"button"==k.type&&(l=a,m=k.button,n=f,q=e,r=m.La(),m.moveTo(n,q),m.show(),l.zc.push(h.ra(r,"mousedown",l,l.Sf)),l.uj.push(m),e+=k.button.height+d[g])} b.rm=function(){if(!this.J)return null;var a=this.J.getBoundingClientRect(),c=a.left;if(this.Ti==h.Dd)return new h.g.Rect(-1E9,1E9,-1E9,c+a.width);h.g.userAgent.$w&&this.kb&&this.kb.ri&&(a=this.kb.J.getBoundingClientRect().x,10>Math.abs(a-c)&&(c+=this.jH*this.kb.options.Ac.scale));return new h.g.Rect(-1E9,1E9,c,1E9)};h.Cr=function(a){this.Dj=a;this.La()};b=h.Cr.prototype;b.Ya=null;b.Kd=null;b.Dj=null;b.Yf=1;b.Nk=null;b.La=function(){this.Ya||(this.Ya=h.g.m.L("svg",{xmlns:h.g.m.qc,"xmlns:html":h.g.m.Hn,"xmlns:xlink":h.g.m.dd,version:"1.1","class":"blocklyBlockDragSurface"},this.Dj),this.Kd=h.g.m.L("g",{},this.Ya))};function bb(a,c){if(a.Kd.childNodes.length)throw Error("Already dragging a block.");a.Kd.appendChild(c);a.Ya.style.display="block";a.Nk=new h.g.O(0,0)} b.mh=function(a,c){this.Nk=new h.g.O(a*this.Yf,c*this.Yf);a=this.Nk.x;c=this.Nk.y;a=a.toFixed(0);c=c.toFixed(0);this.Ya.style.display="block";h.g.m.Dk(this.Ya,"translate3d("+a+"px, "+c+"px, 0px)")};b.wp=function(){var a=h.g.ld(this.Ya);return new h.g.O(a.x/this.Yf,a.y/this.Yf)};b.Db=function(){return this.Kd}; b.Tl=function(a){a?a.appendChild(this.Kd.firstChild):this.Kd.removeChild(this.Kd.firstChild);this.Ya.style.display="none";if(this.Kd.childNodes.length)throw Error("Drag group was not cleared.");this.Nk=null};h.Xc={};h.Xc.Ip=!1;h.Xc.register=function(a){if(h.Xc.Ip)throw Error("CSS already injected");Array.prototype.push.apply(h.Xc.Cn,a);a.length=0};h.Xc.Hf=function(a,c){if(!h.Xc.Ip){h.Xc.Ip=!0;var d=h.Xc.Cn.join("\n");h.Xc.Cn.length=0;a&&(a=c.replace(/[\\/]$/,""),d=d.replace(/<<>>/g,a),a=document.createElement("style"),d=document.createTextNode(d),a.appendChild(d),document.head.insertBefore(a,document.head.firstChild))}};h.Xc.Lq=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")}; h.Xc.Cn=[".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("<<>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;", "}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<>>/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(<<>>/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;","}"]; h.A=function(){};h.A.Yc=null;h.A.Do=null;h.A.lc=null;h.A.cn=null;h.A.dl=16;h.A.Br=1;h.A.vr=12;h.A.us=16;h.A.xn=.25;h.A.Hr="#dadce0";h.A.Ir="#fff";h.A.to=null;h.A.Yg=null; h.A.La=function(){if(!h.A.Yc){var a=document.createElement("div");a.className="blocklyDropDownDiv";a.style.backgroundColor=h.A.Ir;a.style.borderColor=h.A.Hr;document.body.appendChild(a);h.A.Yc=a;var c=document.createElement("div");c.className="blocklyDropDownContent";a.appendChild(c);h.A.wf=c;c=document.createElement("div");c.className="blocklyDropDownArrow";a.appendChild(c);h.A.Fd=c;h.A.Yc.style.opacity=0;h.A.Yc.style.transition="transform "+h.A.xn+"s, opacity "+h.A.xn+"s";a.addEventListener("focusin", function(){h.g.m.Ib(a,"focused")});a.addEventListener("focusout",function(){h.g.m.Sc(a,"focused")})}};h.A.Jv=function(a){h.A.Do=a};h.A.Rz=function(){return h.A.wf};h.A.Sy=function(){h.A.wf.innerHTML="";h.A.wf.style.width=""};h.A.ud=function(a){h.A.Yc.style.backgroundColor=a;h.A.Yc.style.borderColor=void 0};h.A.yH=function(a){h.A.Yc.setAttribute("data-category",a)}; h.A.BH=function(a,c,d,e){var f=c.C.scale,g=c.width,k=c.height;g*=f;k*=f;f=c.Y().getBoundingClientRect();g=f.left+g/2;k=f.top+k;f=f.top;e&&(f+=e);h.A.Jv(z(c.C).parentNode);return h.A.show(a,c.H,g,k,g,f,d)};h.A.DB=function(a,c){var d=a.Y().getBoundingClientRect(),e=d.left+d.width/2,f=d.bottom;d=d.top;var g=a.D;h.A.cn=!0;h.A.Jv(z(g.C).parentNode);h.A.show(a,g.H,e,f,e,d,c)}; h.A.show=function(a,c,d,e,f,g,k){h.A.lc=a;h.A.Yg=k||null;a=h.A.ou(d,e,f,g);a.vo?(h.A.Fd.style.display="",h.A.Fd.style.transform="translate("+a.rj+"px,"+a.ct+"px) rotate(45deg)",h.A.Fd.setAttribute("class",a.uo?"blocklyDropDownArrow arrowTop":"blocklyDropDownArrow arrowBottom")):h.A.Fd.style.display="none";h.A.Yc.style.direction=c?"rtl":"ltr";h.A.wk(a.Bm,a.Cm,a.nm,a.om);return a.uo}; h.A.Kz=function(){var a=h.A.Do.getBoundingClientRect(),c=h.g.style.We(h.A.Do);return{left:a.left,right:a.left+c.width,top:a.top,bottom:a.top+c.height,width:c.width,height:c.height}};h.A.ou=function(a,c,d,e){var f=h.A.Kz(),g=h.g.style.We(h.A.Yc);return c+g.heightf.top?h.A.mu(d,e,f,g):c+g.heightdocument.documentElement.clientTop?h.A.mu(d,e,f,g):h.A.Wz(a,f,g)}; h.A.nu=function(a,c,d,e){a=h.A.up(a,d.left,d.right,e.width);return{Bm:a.Yh,Cm:c,nm:a.Yh,om:c+h.A.us,rj:a.rj,ct:-(h.A.dl/2+h.A.Br),uo:!0,vo:!0}};h.A.mu=function(a,c,d,e){a=h.A.up(a,d.left,d.right,e.width);return{Bm:a.Yh,Cm:c-e.height,nm:a.Yh,om:c-e.height-h.A.us,rj:a.rj,ct:e.height-2*h.A.Br-h.A.dl/2,uo:!1,vo:!0}};h.A.Wz=function(a,c,d){a=h.A.up(a,c.left,c.right,d.width);return{Bm:a.Yh,Cm:0,nm:a.Yh,om:0,vo:!1}}; h.A.up=function(a,c,d,e){var f=a;a=h.g.pd.wj(c,a-e/2,d-e);f-=h.A.dl/2;c=h.g.pd.wj(h.A.vr,f-a,e-h.A.vr-h.A.dl);return{rj:c,Yh:a}};h.A.isVisible=function(){return!!h.A.lc};h.A.Wj=function(a,c){h.A.lc===a&&(c?h.A.Fp():h.A.va())};h.A.va=function(){var a=h.A.Yc;a.style.transform="translate(0, 0)";a.style.opacity=0;h.A.to=setTimeout(function(){h.A.Fp()},1E3*h.A.xn);h.A.Yg&&(h.A.Yg(),h.A.Yg=null)}; h.A.Fp=function(){if(h.A.isVisible()){h.A.to&&clearTimeout(h.A.to);var a=h.A.Yc;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=h.A.Ir;a.style.borderColor=h.A.Hr;h.A.Yg&&(h.A.Yg(),h.A.Yg=null);h.A.Sy();h.A.lc=null}}; h.A.wk=function(a,c,d,e){a=Math.floor(a);c=Math.floor(c);d=Math.floor(d);e=Math.floor(e);var f=h.A.Yc;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)"}; h.A.sH=function(){if(h.A.lc){var a=h.A.lc.D,c=a.C.scale,d=h.A.cn?h.A.lc.ub.width:a.width,e=h.A.cn?h.A.lc.ub.height:a.height;d*=c;e*=c;a=h.A.cn?h.A.lc.jd.getBoundingClientRect():a.Y().getBoundingClientRect();d=a.left+d/2;e=h.A.ou(d,a.top+e,d,a.top);h.A.wk(e.Bm,e.Cm,e.nm,e.om)}else h.A.va()};h.Hf=function(a,c){h.My();"string"==typeof a&&(a=document.getElementById(a)||document.querySelector(a));if(!h.g.m.containsNode(document,a))throw Error("Error: container is not in current document.");c=new h.ad(c||{});var d=document.createElement("div");d.className="injectionDiv";a.appendChild(d);a=h.Fj(d,c);var e=new h.Cr(d);d=new h.Vs(d);d=h.bz(a,c,e,d);h.Wa.Ra.BB(c.Ra);h.rA(d);h.kk=d;h.Rk(d);return d}; h.Fj=function(a,c){a.setAttribute("dir","LTR");h.nc.Ft=c.H;h.Xc.Hf(c.gA,c.$m);a=h.g.m.L("svg",{xmlns:h.g.m.qc,"xmlns:html":h.g.m.Hn,"xmlns:xlink":h.g.m.dd,version:"1.1","class":"blocklySvg"},a);var d=h.g.m.L("defs",{},a),e=String(Math.random()).substring(2),f=h.g.m.L("filter",{id:"blocklyEmbossFilter"+e},d);h.g.m.L("feGaussianBlur",{"in":"SourceAlpha",stdDeviation:1,result:"blur"},f);var g=h.g.m.L("feSpecularLighting",{"in":"blur",surfaceScale:1,specularConstant:.5,specularExponent:10,"lighting-color":"white", result:"specOut"},f);h.g.m.L("fePointLight",{x:-5E3,y:-1E4,z:2E4},g);h.g.m.L("feComposite",{"in":"specOut",in2:"SourceAlpha",operator:"in",result:"specOut"},f);h.g.m.L("feComposite",{"in":"SourceGraphic",in2:"specOut",operator:"arithmetic",k1:0,k2:1,k3:1,k4:0},f);c.Tt=f.id;f=h.g.m.L("pattern",{id:"blocklyDisabledPattern"+e,patternUnits:"userSpaceOnUse",width:10,height:10},d);h.g.m.L("rect",{width:10,height:10,fill:"#aaa"},f);h.g.m.L("path",{d:"M 0 0 L 10 10 M 10 0 L 0 10",stroke:"#cc0"},f);c.Nj=f.id; c.yu=h.jg.La(e,c.xu,d);return a}; h.bz=function(a,c,d,e){c.Ac=null;var f=new h.Sa(c,d,e);f.scale=c.gb.KB;a.appendChild(f.La("blocklyMainBackground"));!c.Bu&&c.Op&&(d=xc(f),h.g.m.ni(d,a));c.Fu&&vc(f);c.gb&&c.gb.controls&&wc(f);f.Tb.subscribe(a,"workspace","background-color");f.translate(0,0);h.kk=f;c.readOnly||f.Dc()||Ua(f,function(g){if(!f.yc()&&!f.Dc()&&-1!=h.i.yw.indexOf(g.type)){var k=Object.create(null),l=f.vc(),m=f.scale;k.H=f.H;k.wb=l.wb/m;k.Bb=l.Bb/m;k.ew=(l.wb+l.lb)/m;k.dw=(l.Bb+l.vb)/m;Bc(f)?(l=Ob(f),k.tc=l.left,k.ic=l.top, k.At=l.right,k.yt=l.bottom):(k.tc=l.tc/m,k.ic=l.ic/m,k.At=(l.tc+l.ie)/m,k.yt=(l.ic+l.gd)/m);if(k.ick.dw||k.tck.ew){l=null;g&&(l=h.i.Db(),h.i.ga(g.group));switch(g.type){case h.i.xr:case h.i.yr:var n=v(f,g.gc);n=D(n);break;case h.i.kl:case h.i.ll:n=f.Xl[g.ge]||null}if(n){m=nc(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var q=k.Bb,r=k.dw-m.height;r=Math.max(q,r);q=h.g.pd.wj(q,m.top,r)-m.top;r=k.wb;var t=k.ew-m.width;k.H?r=Math.min(t,r):t=Math.max(r,t);n.moveBy(h.g.pd.wj(r, m.left,t)-m.left,q)}g&&(g.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&h.i.ga(l))}}});h.Rk(f);h.W.La();h.A.La();h.F.La();return f}; h.rA=function(a){var c=a.options,d=z(a);h.ra(d.parentNode,"contextmenu",null,function(e){h.g.Km(e)||e.preventDefault()});d=h.ra(window,"resize",null,function(){h.jc(!0);h.Rk(a)});a.fn=d;h.Hf.By();c.Op&&(a.sa?a.sa.wa(a):a.P&&(a.P.wa(a),a.P.show(c.Op.childNodes),a.P.Qb.set(0)));d=h.za.ac;c.Fu&&(d=a.bc.wa(d));c.gb&&c.gb.controls&&a.sh.wa(d);c.Ob&&c.Ob.scrollbars?(a.pb=new h.Lh(a),a.pb.resize()):a.eh({x:.5,y:.5});c.iA&&h.Hf.FA(c.$m,a)}; h.Hf.By=function(){h.qz||(h.ra(document,"scroll",null,function(){for(var a=h.hb.getAll(),c=0,d;d=a[c];c++)d.Yk&&d.Yk()}),h.ra(document,"keydown",null,h.ZA),h.Xb(document,"touchend",null,h.Pf),h.Xb(document,"touchcancel",null,h.Pf),h.g.userAgent.gj&&h.ra(window,"orientationchange",document,function(){h.Rk(h.Za())}));h.qz=!0}; h.Hf.FA=function(a,c){function d(){for(;f.length;)h.fb(f.pop());e.preload()}var e=c.Bc;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(h.ra(document,"mousemove",null,d,!0));f.push(h.ra(document,"touchstart",null,d,!0))};h.yd=function(a,c){this.cw=c||"";this.Cv=Object.create(null);if(a)for(a=a.split(","),c=0;c1'), e.appendChild(d),c.push(e));if(h.Hb.variables_get){a.sort(h.Ol.Vy);d=0;for(var f;f=a[d];d++)e=h.g.xml.createElement("block"),e.setAttribute("type","variables_get"),e.setAttribute("gap",8),e.appendChild(h.Z.op(f)),c.push(e)}}return c}; h.Z.Gz=function(a){a=a.yf();var c="";if(a.length)for(var d=1,e=0,f="ijkmnopqrstuvwxyzabcdefgh".charAt(e);!c;){for(var g=!1,k=0;kk[0]?1:g[0]=a.options.length&&(a.style.display="none")}for(d= 1;10>=d;d++)a=document.getElementById("level"+d),c=!!Nc(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(Oc,1)}function Nc(a){var c=Pc;try{var d=window.localStorage[c+a]}catch(e){}return d}function L(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 Qc(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 Oc(){if(!Kc){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")}};h.g.u={};h.g.u.Aa=function(a,c){return" "+a+","+c+" "};h.g.u.curve=function(a,c){return" "+a+c.join("")};h.g.u.moveTo=function(a,c){return" M "+a+","+c+" "};h.g.u.moveBy=function(a,c){return" m "+a+","+c+" "};h.g.u.lineTo=function(a,c){return" l "+a+","+c+" "};h.g.u.line=function(a){return" l"+a.join("")};h.g.u.T=function(a,c){return" "+a+" "+c+" "};h.g.u.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};h.j.gg=function(){this.Zd=0;this.Qx=3;this.Yd=5;this.gs=8;this.pc=10;this.Ks=this.Yd;this.lo=15;this.kj=5;this.rf=8;this.Gx=15;this.Fx=4;this.Cx=12;this.Qw=16;this.ab=8;this.Al=15;this.Vx=0;this.Wx=20;this.ww=4;this.Tx=15;this.Ux=100;this.Sx=15;this.Rn=24;this.Sw=14.5;this.Rw=this.lo+11;this.Uw=2;this.Tw=this.Rn;this.Gs=h.g.u.moveBy(0,0);this.nx=12;this.ox=6};b=h.j.gg.prototype; b.wa=function(){this.Dh=this.Yp();this.Gh=this.Zp();this.Le=this.aq();this.mg=this.$p();var a=this.ab,c=h.g.u.arc("a","0 0,0",a,h.g.u.Aa(-a,a)),d=h.g.u.arc("a","0 0,0",a,h.g.u.Aa(a,a));this.fj={width:a,height:a,vq:c,Zm:d};c=this.ab;a=h.g.u.moveBy(0,c)+h.g.u.arc("a","0 0,1",c,h.g.u.Aa(c,-c));c=h.g.u.arc("a","0 0,1",c,h.g.u.Aa(-c,-c));this.ts={er:a,Co:c}};b.Yp=function(){var a=this.nx,c=this.ox,d=h.g.u.line([h.g.u.Aa(6,3),h.g.u.Aa(-12,6),h.g.u.Aa(6,3)]);return{height:a,width:c,path:d}}; b.aq=function(){var a=this.Tx,c=this.Ux,d=h.g.u.curve("c",[h.g.u.Aa(30,-a),h.g.u.Aa(70,-a),h.g.u.Aa(c,0)]);return{height:a,width:c,path:d}};b.$p=function(){function a(g){g=g?-1:1;var k=-g,l=d/2,m=h.g.u.Aa(c,g*l);return h.g.u.curve("c",[h.g.u.Aa(0,g*(l+2.5)),h.g.u.Aa(-c,k*(l+.5)),h.g.u.Aa(-c,g*l)])+h.g.u.curve("s",[h.g.u.Aa(c,2.5*k),m])}var c=this.rf,d=this.lo,e=a(!0),f=a(!1);return{width:c,height:d,sd:f,vk:e}}; b.Zp=function(){function a(k){return h.g.u.line([h.g.u.Aa(k*e,d),h.g.u.Aa(3*k,0),h.g.u.Aa(k*e,-d)])}var c=this.Gx,d=this.Fx,e=(c-3)/2,f=a(1),g=a(-1);return{width:c,height:d,Vf:f,rv:g}};h.j.o={NONE:0,Zc:1,Pr:2,Rr:4,ho:8,wr:16,Wr:32,Or:64,Ie:128,Ur:256,Hs:512,Ew:1024,Wn:2048,Sn:4096,Jx:8192,Dn:16384,On:32768,Nn:65536,$n:131072,Zn:262144,$r:524288,bo:1048576,no:2097152,yn:4194304,Vr:8388608};h.j.o.OD=h.j.o.On|h.j.o.Nn;h.j.o.GF=h.j.o.$n|h.j.o.Zn;h.j.o.lq=16777216;h.j.o.jb=function(){h.j.o.hasOwnProperty(void 0)||(h.j.o[void 0]=h.j.o.lq,h.j.o.lq<<=1);return h.j.o[void 0]};h.j.o.fk=function(a){return a.type&h.j.o.Zc};h.j.o.Pg=function(a){return a.type&h.j.o.Pr}; h.j.o.pi=function(a){return a.type&h.j.o.Rr};h.j.o.Nd=function(a){return a.type&h.j.o.ho};h.j.o.cH=function(a){return a.type&h.j.o.Wr};h.j.o.Md=function(a){return a.type&h.j.o.Ie};h.j.o.ek=function(a){return a.type&h.j.o.Or};h.j.o.Jf=function(a){return a.type&h.j.o.Ur};h.j.o.ik=function(a){return a.type&h.j.o.Hs};h.j.o.ti=function(a){return a.type&h.j.o.Wn};h.j.o.Mf=function(a){return a.type&h.j.o.Sn};h.j.o.BA=function(a){return a.type&(h.j.o.Wn|h.j.o.Sn)};h.j.o.Lf=function(a){return a.type&h.j.o.Nn}; h.j.o.eH=function(a){return a.type&h.j.o.Zn};h.j.o.hk=function(a){return a.type&h.j.o.On};h.j.o.fH=function(a){return a.type&h.j.o.$n};h.j.o.bH=function(a){return a.type&h.j.o.Dn};h.j.o.Qu=function(a){return a.type&h.j.o.$r};h.j.o.gH=function(a){return a.type&h.j.o.bo};h.j.o.aH=function(a){return a.type&h.j.o.wr};h.j.o.Lm=function(a){return a.type&h.j.o.no};h.j.o.Em=function(a){return a.type&h.j.o.yn};h.j.o.hH=function(a){return a.type&(h.j.o.no|h.j.o.yn)};h.j.o.dH=function(a){return a.type&h.j.o.Vr};h.j.mf=function(a){this.height=this.width=0;this.type=h.j.o.NONE;this.tf=this.xa=0;this.v=a;this.rd=this.v.Al};h.j.ea=function(a,c){h.j.ea.w.constructor.call(this,a);this.Mo=c;a:switch(a=this.v,c.type){case h.Oa:case h.zd:c=a.mg;break a;case h.Bd:case h.Ca:c=a.Gh;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=h.j.o.Ew};h.g.object.S(h.j.ea,h.j.mf);h.j.Vn=function(a,c){h.j.Vn.w.constructor.call(this,a,c);this.type|=h.j.o.Jx;this.height=this.shape.height;this.width=this.shape.width;this.fd=this.v.kj;this.Uc=this.width};h.g.object.S(h.j.Vn,h.j.ea); h.j.Xn=function(a,c){h.j.Xn.w.constructor.call(this,a,c);this.type|=h.j.o.Wn;this.height=this.shape.height;this.width=this.shape.width};h.g.object.S(h.j.Xn,h.j.ea);h.j.Tn=function(a,c){h.j.Tn.w.constructor.call(this,a,c);this.type|=h.j.o.Sn;this.height=this.shape.height;this.width=this.shape.width};h.g.object.S(h.j.Tn,h.j.ea);h.j.hj=function(a,c){h.j.hj.w.constructor.call(this,a,c.connection);this.type|=h.j.o.Ie;this.input=c;this.align=c.align;(this.xg=c.connection&&x(c.connection)?x(c.connection):null)?(a=A(this.xg),this.Bj=a.width,this.Yl=a.height):this.Yl=this.Bj=0;this.connection=c.connection;this.fd=0};h.g.object.S(h.j.hj,h.j.ea); h.j.jf=function(a,c){h.j.jf.w.constructor.call(this,a,c);this.type|=h.j.o.Ur;this.xg?(this.width=this.Bj,this.height=this.Yl):(this.height=this.v.Rw,this.width=this.shape.width+this.v.Sw);this.fd=this.v.kj;this.Cj=this.shape.height;this.vf=this.shape.width};h.g.object.S(h.j.jf,h.j.hj);h.j.qf=function(a,c){h.j.qf.w.constructor.call(this,a,c);this.type|=h.j.o.Hs;this.height=this.xg?this.Yl+this.v.Vx:this.v.Tw;this.width=this.v.Al+this.shape.width};h.g.object.S(h.j.qf,h.j.hj); h.j.ul=function(a,c){h.j.ul.w.constructor.call(this,a,c);this.type|=h.j.o.Or;this.height=this.xg?this.Yl-2*this.v.kj:this.shape.height;this.width=this.shape.width+this.v.Uw;this.fd=this.v.kj;this.Cj=this.shape.height;this.vf=this.shape.width};h.g.object.S(h.j.ul,h.j.hj);h.j.Je=function(a,c){h.j.Je.w.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=h.j.o.Rr;a=new h.g.Cd(h.Je.prototype.Gl,h.Je.prototype.Gl-2);this.height=a.height;this.width=a.width};h.g.object.S(h.j.Je,h.j.mf);h.j.Mn=function(a){h.j.Mn.w.constructor.call(this,a);this.type|=h.j.o.$r;this.height=this.v.Dh.height;this.width=this.v.Dh.width};h.g.object.S(h.j.Mn,h.j.mf); h.j.Ea=function(a,c){h.j.Ea.w.constructor.call(this,a);this.Wt=c;this.Qc=c.Wd&&!!c.D&&c.D.Qc();this.Cz=c.lu();this.type|=h.j.o.Zc;a=this.Wt.We();this.height=a.height;this.width=a.width};h.g.object.S(h.j.Ea,h.j.mf);h.j.In=function(a){h.j.In.w.constructor.call(this,a);this.type|=h.j.o.Pr;this.height=this.v.Le.height;this.width=this.v.Le.width;this.Ph=this.height};h.g.object.S(h.j.In,h.j.mf); h.j.Ml=function(a,c){h.j.Ml.w.constructor.call(this,a);this.type=(c&&"left"!=c?h.j.o.$n:h.j.o.On)|h.j.o.Dn;this.width=this.height=this.v.Zd};h.g.object.S(h.j.Ml,h.j.mf);h.j.Fl=function(a,c){h.j.Fl.w.constructor.call(this,a);this.type=(c&&"left"!=c?h.j.o.Zn:h.j.o.Nn)|h.j.o.Dn;this.width=this.v.ab;this.height=this.v.ab/2};h.g.object.S(h.j.Fl,h.j.mf);h.j.Bh=function(a,c){h.j.Bh.w.constructor.call(this,a);this.type=this.type|h.j.o.ho|h.j.o.Wr;this.width=c;this.height=this.v.Sx};h.g.object.S(h.j.Bh,h.j.mf);h.j.og=function(a){this.type=h.j.o.bo;this.elements=[];this.xa=this.Vb=this.Ce=this.minWidth=this.minHeight=this.width=this.height=0;this.Du=this.ym=this.Dp=this.wc=this.Ig=!1;this.v=a;this.rd=this.v.Al};h.j.og.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function M(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(h.j.o.Md(d))return d;return null}h.j.og.prototype.Vq=function(){return!0};h.j.og.prototype.Ut=function(){return!0}; function Rc(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(h.j.o.Nd(d))return d;return null}h.j.Nh=function(a){h.j.Nh.w.constructor.call(this,a);this.type|=h.j.o.no;this.Ph=this.Pe=0;this.hA=!1;this.connection=null};h.g.object.S(h.j.Nh,h.j.og);h.j.Nh.prototype.Ep=function(a){var c=a.Xe?"cap"===a.Xe:h.ma.Le,d=a.R&&x(a.R);return!!a.M||c||(d?u(d)==a:!1)}; h.j.Nh.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,h.j.o.Nd(f)||(h.j.o.Pg(f)?d=Math.max(d,f.Ph):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.Pe=this.Ph=d;this.Ce=this.width};h.j.Nh.prototype.Vq=function(){return!1};h.j.vh=function(a){h.j.vh.w.constructor.call(this,a);this.type|=h.j.o.yn;this.Eu=!1;this.connection=null;this.tg=this.Lj=0};h.g.object.S(h.j.vh,h.j.og); h.j.vh.prototype.Ep=function(a){return!!a.M||!!u(a)};h.j.vh.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,h.j.o.Nd(f)||(h.j.o.Mf(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.Lj=d;this.Ce=this.width};h.j.vh.prototype.Vq=function(){return!1}; h.j.Ll=function(a,c,d){h.j.Ll.w.constructor.call(this,a);this.type=this.type|h.j.o.ho|h.j.o.wr;this.width=d;this.height=c;this.bu=!1;this.Ce=0;this.elements=[new h.j.Bh(this.v,d)]};h.g.object.S(h.j.Ll,h.j.og);h.j.Ll.prototype.measure=function(){};h.j.Ch=function(a){h.j.Ch.w.constructor.call(this,a);this.type|=h.j.o.Vr;this.wt=0};h.g.object.S(h.j.Ch,h.j.og); h.j.Ch.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,h.j.o.Md(d)&&(h.j.o.ik(d)?a+=d.Bj:h.j.o.ek(d)&&0!=d.Bj&&(a+=d.Bj-d.vf)),h.j.o.Nd(d)||(this.height=Math.max(this.height,d.height));this.wt=a;this.Ce=this.width+a};h.j.Ch.prototype.Ut=function(){return!this.Ig&&!this.wc};h.j.nf=function(a,c){this.ka=c;this.cf=a;this.v=this.cf.v;this.M=c.M?new h.j.Vn(this.v,c.M):null;this.Mp=Tb(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.Kf=c.Kf();this.H=c.H;this.ih=this.width=this.Vi=this.height=0;this.rows=[];this.Iu=[];this.Ab=new h.j.Nh(this.v);this.ib=new h.j.vh(this.v);this.hn=this.Uc=0};b=h.j.nf.prototype; b.measure=function(){var a=this.ka.Xe?"cap"===this.ka.Xe:h.ma.Le,c=!!this.ka.R;this.Ab.Ep(this.ka)?this.Ab.elements.push(new h.j.Ml(this.v)):this.Ab.elements.push(new h.j.Fl(this.v));a?(a=new h.j.In(this.v),this.Ab.elements.push(a),this.Ab.Pe=a.Ph):c&&(this.Ab.hA=!0,this.Ab.connection=new h.j.Xn(this.v,this.ka.R),this.Ab.elements.push(this.Ab.connection));this.ka.N.length&&this.ka.N[0].type==h.Ca&&!this.ka.isCollapsed()?this.Ab.minHeight=this.v.pc:this.Ab.minHeight=this.v.Yd;this.rows.push(this.Ab); a=new h.j.Ch(this.v);var d=ka(this.ka);if(d.length){c=0;for(var e;e=d[c];c++){var f=new h.j.Je(this.v,e);this.isCollapsed&&e.ot?this.Iu.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.ka.N[c];c++)if(d.isVisible()){!e||d.type!=h.Ca&&e.type!=h.Ca&&(d.type!=h.Oa&&d.type!=h.He||this.Mp)||(this.rows.push(a),a=new h.j.Ch(this.v));for(e=0;f=d.Ma[e];e++)a.elements.push(new h.j.Ea(this.v,f,d));this.at(d,a);e=d}this.isCollapsed&&(a.Du=!0,a.elements.push(new h.j.Mn(this.v)));(a.elements.length||a.ym)&&this.rows.push(a); this.ib.Eu=!!this.ka.V;this.ib.minHeight=this.ka.N.length&&this.ka.N[this.ka.N.length-1].type==h.Ca?this.v.pc:this.v.Yd-1;this.ib.Ep(this.ka)?this.ib.elements.push(new h.j.Ml(this.v)):this.ib.elements.push(new h.j.Fl(this.v));this.ib.Eu&&(this.ib.connection=new h.j.Tn(this.v,this.ka.V),this.ib.elements.push(this.ib.connection));this.rows.push(this.ib);for(a=0;c=this.rows[a];a++){d=c.elements;c.elements=[];c.Vq()&&c.elements.push(new h.j.Bh(this.v,this.sm(null,d[0])));for(e=0;ea.xc&&(a.U+=h.g.u.T("V",c.Vb+c.height-a.xc)))};h.X.ng=function(a){this.kh=a;this.Ok=h.g.m.L("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.kh);this.Pi=h.g.m.L("path",{"class":"blocklyPath"},this.kh);this.Qk=h.g.m.L("path",{"class":"blocklyPathLight"},this.kh)};h.X.ng.prototype.Pq=function(a,c){this.Pi.setAttribute("d",a);this.Ok.setAttribute("d",a);this.Qk.setAttribute("d",c)}; h.X.ng.prototype.mp=function(){this.Pi.setAttribute("transform","scale(-1 1)");this.Qk.setAttribute("transform","scale(-1 1)");this.Ok.setAttribute("transform","translate(1,1) scale(-1 1)")};h.X.jf=function(a,c){h.X.jf.w.constructor.call(this,a,c);this.xg&&(this.width+=this.v.oc,this.height+=this.v.oc)};h.g.object.S(h.X.jf,h.j.jf);h.X.qf=function(a,c){h.X.qf.w.constructor.call(this,a,c);this.xg&&(this.height+=this.v.oc)};h.g.object.S(h.X.qf,h.j.qf);h.X.nf=function(a,c){h.X.nf.w.constructor.call(this,a,c)};h.g.object.S(h.X.nf,h.j.nf);b=h.X.nf.prototype;b.at=function(a,c){this.Mp&&a.type==h.Oa?(c.elements.push(new h.X.jf(this.v,a)),c.Dp=!0):a.type==h.Ca?(c.elements.push(new h.X.qf(this.v,a)),c.wc=!0):a.type==h.Oa?(c.elements.push(new h.j.ul(this.v,a)),c.Ig=!0):a.type==h.He&&(c.ym=!0)}; b.sm=function(a,c){if(!a)return c&&h.j.o.fk(c)&&c.Qc?this.v.Yd:c&&h.j.o.Jf(c)?this.v.gs:c&&h.j.o.ik(c)?this.v.Wx:this.v.pc;if(!h.j.o.Md(a)&&!c)return h.j.o.fk(a)&&a.Qc?this.v.Yd:h.j.o.pi(a)?2*this.v.pc+1:h.j.o.Pg(a)?this.v.Zd:h.j.o.BA(a)?this.v.pc:h.j.o.Lf(a)?this.v.Cx:h.j.o.Qu(a)?this.v.Zd:this.v.pc;if(h.j.o.Md(a)&&!c){if(h.j.o.ek(a))return this.v.Zd;if(h.j.o.Jf(a))return this.v.pc;if(h.j.o.ik(a))return this.v.Zd}if(!h.j.o.Md(a)&&c&&h.j.o.Md(c)){if(a.Qc){if(h.j.o.Jf(c)||h.j.o.ek(c))return this.v.Qx}else{if(h.j.o.Jf(c)|| h.j.o.ek(c))return this.v.gs;if(h.j.o.ik(c))return this.v.pc}return this.v.pc-1}if(h.j.o.pi(a)&&c&&!h.j.o.Md(c))return this.v.pc;if(h.j.o.Jf(a)&&c&&!h.j.o.Md(c))return c.Qc?this.v.Yd:this.v.pc;if(h.j.o.hk(a)&&c){if(h.j.o.Pg(c))return this.v.Zd;if(h.j.o.ti(c))return c.rd;if(h.j.o.Mf(c))return a=(this.H?1:-1)*this.v.oc/2,c.rd+a}if(h.j.o.Lf(a)&&c){if(h.j.o.ti(c))return c.rd-this.v.ab;if(h.j.o.Mf(c))return a=(this.H?1:-1)*this.v.oc/2,c.rd-this.v.ab+a}return!h.j.o.Md(a)&&c&&!h.j.o.Md(c)&&a.Qc==c.Qc||c&& h.j.o.Qu(c)?this.v.pc:this.v.Yd};b.qo=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(h.j.o.Nd(e)){d=e;break a}d=null}e=Rc(a);if(a.Ig||a.wc)a.Ce+=c;var f=M(a);f?f.align==h.vn?e.width+=c:f.align==h.nr?(d.width+=c/2,e.width+=c/2):f.align==h.pr&&(d.width+=c):e.width+=c;a.width+=c};b.su=function(a,c){return h.j.o.Lm(a)&&h.j.o.Em(c)?this.v.Qw:h.j.o.Lm(a)||h.j.o.Em(c)?this.v.Zd:a.Ig&&c.Ig?this.v.pc:!a.wc&&c.wc?this.v.ww:a.wc&&c.wc||!a.wc&&c.ym?this.v.pc:this.v.Yd}; b.ku=function(a,c){if(h.j.o.Nd(c))return a.Vb+c.height/2;if(h.j.o.Em(a))return a=a.Vb+a.height-a.Lj,h.j.o.Mf(c)?a+c.height/2:a-c.height/2;if(h.j.o.Lm(a))return h.j.o.Pg(c)?a.Pe-c.height/2:a.Pe+c.height/2;var d=a.Vb;h.j.o.fk(c)||h.j.o.pi(c)?(d+=c.height/2,(a.Dp||a.wc)&&c.height+this.v.Ks<=a.height&&(d+=this.v.Ks)):d=h.j.o.Jf(c)?d+c.height/2:d+a.height/2;return d}; b.Xt=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.Vb=c;e.xa=this.Uc;c+=e.height;a=Math.max(a,e.Ce);var f=c-this.Ab.Ph;e==this.ib&&f=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},Um:function(){10>K?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+J+"&level="+(K+1):O.Zj()},zm:function(a,c){if(a){var d=a.match(/^block_id_([^']+)$/);d&&(a=d[1])}yc(a,c)},tA:function(a,c){a=document.getElementById(a); a.firstChild||(a=h.Hf(a,{rtl:-1!=Ic.indexOf(J),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),h.K.Eg(h.K.$f(c),a))},LB:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},hd:function(a){if("click"==a.type&&"touchend"==O.hd.Bq&&O.hd.zq+2E3>Date.now()||O.hd.Bq==a.type&&O.hd.zq+400>Date.now())return a.preventDefault(),a.stopPropagation(),!0;O.hd.Bq=a.type;O.hd.zq=Date.now();return!1}};O.hd.Bq=null;O.hd.zq=0; O.oA=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};O.pA=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=O;O.setCode=O.Kv;O.getCode=O.rp;O.getWorkspace=O.ei;var N={Ng:!1,Kt:null,dm:null,Ni:function(a,c,d,e,f,g){function k(){N.Ng&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);N.Ng&&N.kc(!1);h.Za()&&h.jc(!0);N.Ng=!0;N.Kt=c;N.dm=g;var l=document.getElementById("dialog");g=document.getElementById("dialogShadow");var m=document.getElementById("dialogBorder"),n;for(n in f)l.style[n]=f[n];e&&(g.style.visibility="visible",g.style.opacity=.3,g.style.zIndex=9,e=document.createElement("div"), e.id="dialogHeader",l.appendChild(e),N.Ro=h.Xb(e,"mousedown",null,N.iz));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(N.Pm(c,!1,.2),N.Pm(l,!0,.8),setTimeout(k,175)):k()},Lt:0,Mt:0,iz:function(a){N.Uo();if(!h.g.ui(a)){var c=document.getElementById("dialog");N.Lt=c.offsetLeft-a.clientX;N.Mt=c.offsetTop-a.clientY;N.To=h.Xb(document,"mouseup",null,N.Uo);N.So=h.Xb(document,"mousemove",null,N.jz);a.stopPropagation()}},jz:function(a){var c=document.getElementById("dialog"), d=N.Lt+a.clientX;a=N.Mt+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"},Uo:function(){N.To&&(h.fb(N.To),N.To=null);N.So&&(h.fb(N.So),N.So=null)},kc:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(N.Ng){N.Uo();N.Ro&&(h.fb(N.Ro),N.Ro=null);N.Ng=!1;N.dm&&N.dm();N.dm=null;var d=!1===a? null:N.Kt;a=document.getElementById("dialog");var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(N.Pm(a,!1,.8),N.Pm(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)}},Pm:function(a,c,d){function e(){f.style.width=g.width+"px";f.style.height=g.height+"px";f.style.left=g.x+"px";f.style.top= g.y+"px";f.style.opacity=d}if(a){var f=document.getElementById("dialogBorder"),g=N.fu(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},fu:function(a){var c=h.g.style.tp(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},Xv:function(a,c){var d=document.getElementById("containerStorage");d.textContent="";c=c.split("\n");for(var e=0;eK?L("Games_nextLevel").replace("%1",String(K+1)):L("Games_finalLevel");c=document.getElementById("doneCancel");c.addEventListener("click", N.kc,!0);c.addEventListener("touchend",N.kc,!0);c=document.getElementById("doneOk");c.addEventListener("click",O.Um,!0);c.addEventListener("touchend",O.Um,!0);N.Ni(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",N.vt,!0)});document.body.addEventListener("keydown",N.vt,!0);document.getElementById("dialogDoneText").textContent=d},Jt:function(a){!N.Ng||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(N.kc(!0),a.stopPropagation(),a.preventDefault())}, Sv:function(){document.body.addEventListener("keydown",N.Jt,!0)},Wv:function(){document.body.removeEventListener("keydown",N.Jt,!0)},vt:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)N.kc(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&O.Um()},Ys:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)N.kc(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&O.Zj()},cu:function(a){27==a.keyCode?N.kc(!0):13==a.keyCode&&N.np()},np: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 g=200==f.status?L("Games_submitted"):L("Games_httpRequestError")+"\nStatus: "+f.status;N.Xv(null,g)}};f.send(c.join("&"));N.kc(!0)}else a.value="",a.focus()}}; window.BlocklyDialogs=N;N.hideDialog=N.kc;h.Generator=function(a){this.TA=a};h.Generator.Fh="generated_function";b=h.Generator.prototype;b.Tr=null;b.Il=null;b.Jl=null;b.kx=" ";b.Dw=60;b.El=[]; function fd(){var a=h.G,c=H;c||(console.warn("No workspace specified in workspaceToCode call. Guessing."),c=h.Za());var d=[];a.wa(c);c=G(c,!0);for(var e=0,f;f=c[e];e++){var g=gd(a,f);Array.isArray(g)&&(g=g[0]);g&&(f.M&&(g=a.Iv(g),a.Il&&!f.Xq&&(g=hd(a.Il,f)+g),a.Jl&&!f.Xq&&(g+=hd(a.Jl,f))),d.push(g))}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 id(a,c){return c+a.replace(/(?!\n$)\n/g,"\n"+c)} function gd(a,c){if(!c)return"";if(!c.isEnabled())return gd(a,u(c));var d=a[c.type];if("function"!=typeof d)throw Error('Language "'+a.TA+'" does not know how to generate code for block type "'+c.type+'".');d=d.call(c,c);if(Array.isArray(d)){if(!c.M)throw TypeError("Expecting string from statement block: "+c.type);return[a.Kq(c,d[0],void 0),d[1]]}if("string"==typeof d)return a.Il&&!c.Xq&&(d=hd(a.Il,c)+d),a.Jl&&!c.Xq&&(d+=hd(a.Jl,c)),a.Kq(c,d,void 0);if(null===d)return"";throw SyntaxError("Invalid code generated: "+ d);} function jd(a,c,d){var e=h.G;if(isNaN(d))throw TypeError("Expecting valid order from block: "+a.type);var f=ac(a,c);if(!f)return"";c=gd(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 g=Math.floor(d),k=Math.floor(c);if(g<=k&&(g!=k||0!=g&&99!=g))for(f=!0,g=0;gd?jd(a,c,h.G.rs)||g:e?jd(a,c,h.G.ss)||g:jd(a,c,f)||g;if(h.AA(a))a=Number(a)+d,e&&(a=-a);else{if(0d&&(a=a+" - "+-d,k=h.G.rs);e&&(a=d?"-("+a+")":"-"+a,k=h.G.ss);k=Math.floor(k);f=Math.floor(f);k&&f>=k&&(a="("+a+")")}return a};h.Xd=function(a,c,d,e,f,g,k){if(!a)throw Error("Src value of an image field is required");a=h.g.Fc(a);d=Number(h.g.Fc(d));c=Number(h.g.Fc(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.Rj=!1;this.Ql="";h.Xd.w.constructor.call(this,a||"",null,k);k||(this.Rj=!!g,this.Ql=h.g.Fc(e)||"");this.ub=new h.g.Cd(c,d+h.Xd.Xs);this.nA=d;this.xj=null;"function"== typeof f&&(this.xj=f)};h.g.object.S(h.Xd,h.Ea);h.Xd.pa=function(a){return new h.Xd(a.src,a.width,a.height,void 0,void 0,void 0,a)};h.Xd.Xs=1;b=h.Xd.prototype;b.Wd=!1;b.If=!1;b.Aj=function(a){h.Xd.w.Aj.call(this,a);this.Rj=!!a.flipRtl;this.Ql=h.g.Fc(a.alt)||""};b.$j=function(){this.nd=h.g.m.L("image",{height:this.nA+"px",width:this.ub.width+"px",alt:this.Ql},this.jd);this.nd.setAttributeNS(h.g.m.dd,"xlink:href",this.Be)};b.gm=function(a){return"string"!=typeof a?null:a}; b.hm=function(a){this.Be=a;this.nd&&this.nd.setAttributeNS(h.g.m.dd,"xlink:href",this.Be||"")};b.lu=function(){return this.Rj};b.Ik=function(){this.xj&&this.xj(this)};b.yp=function(){return this.Ql};h.Nc.register("field_image",h.Xd);var md={},P,nd,od,Q,S,T,pd;h.Hb.maze_moveForward={wa:function(){$b(this,{message0:L("Maze_moveForward"),previousStatement:null,nextStatement:null,colour:290,tooltip:L("Maze_moveForwardTooltip")})}};h.G.maze_moveForward=function(a){return"moveForward('block_id_"+a.id+"');\n"};h.Hb.maze_turn={wa:function(){var a=[[L("Maze_turnLeft"),"turnLeft"],[L("Maze_turnRight"),"turnRight"]];a[0][0]+=" \u21ba";a[1][0]+=" \u21bb";this.ud(290);I(Zb(this),new h.Fa(a),"DIR");this.fh(!0);this.Ji(!0);this.Pd(L("Maze_turnTooltip"))}}; h.G.maze_turn=function(a){return Ma(a,"DIR")+"('block_id_"+a.id+"');\n"};h.Hb.maze_if={wa:function(){var a=[[L("Maze_pathAhead"),"isPathForward"],[L("Maze_pathLeft"),"isPathLeft"],[L("Maze_pathRight"),"isPathRight"]];a[1][0]+=" \u21ba";a[2][0]+=" \u21bb";this.ud(210);I(Zb(this),new h.Fa(a),"DIR");I(this.Ne(h.Ca,"DO"),L("Maze_doCode"));this.Pd(L("Maze_ifTooltip"));this.fh(!0);this.Ji(!0)}};h.G.maze_if=function(a){var c=Ma(a,"DIR")+"('block_id_"+a.id+"')";a=kd(a,"DO");return"if ("+c+") {\n"+a+"}\n"}; h.Hb.maze_ifElse={wa:function(){var a=[[L("Maze_pathAhead"),"isPathForward"],[L("Maze_pathLeft"),"isPathLeft"],[L("Maze_pathRight"),"isPathRight"]];a[1][0]+=" \u21ba";a[2][0]+=" \u21bb";this.ud(210);I(Zb(this),new h.Fa(a),"DIR");I(this.Ne(h.Ca,"DO"),L("Maze_doCode"));I(this.Ne(h.Ca,"ELSE"),L("Maze_elseCode"));this.Pd(L("Maze_ifelseTooltip"));this.fh(!0);this.Ji(!0)}}; h.G.maze_ifElse=function(a){var c=Ma(a,"DIR")+"('block_id_"+a.id+"')",d=kd(a,"DO");a=kd(a,"ELSE");return"if ("+c+") {\n"+d+"} else {\n"+a+"}\n"};h.Hb.maze_forever={wa:function(){this.ud(120);I(I(Zb(this),L("Maze_repeatUntil")),new h.Xd(U.Om,12,16));I(this.Ne(h.Ca,"DO"),L("Maze_doCode"));this.fh(!0);this.Pd(L("Maze_whileTooltip"))}};h.G.maze_forever=function(a){var c=kd(a,"DO");h.G.Tr&&(c=h.G.Tr.replace(/%1/g,"'block_id_"+a.id+"'")+c);return"while (notDone()) {\n"+c+"}\n"};var qd=qd||{};function rd(a,c){function d(){}d.prototype=c.prototype;a.w=c.prototype;a.prototype=new d;a.prototype.constructor=a;a.BG=function(e,f,g){return c.prototype[f].apply(e,Array.prototype.slice.call(arguments,2))}}if(!sd){var sd,td="";"undefined"!==typeof navigator&&navigator&&"string"==typeof navigator.userAgent&&(td=navigator.userAgent);var ud=0==td.indexOf("Opera");sd={iH:{zD:"ScriptEngine"in window},HE:ud,hf:!ud&&-1!=td.indexOf("MSIE"),Ts:!ud&&-1!=td.indexOf("WebKit")}}if(!vd)var vd={}; if(!wd)var wd={};if(!xd)var xd={};if(!yd)var yd={};if(!zd)var zd={};if(!Ad)var Ad={};var Bd=qd.FC?{vH:!0}:{};function Cd(){throw Error("Do not instantiate directly");}Cd.prototype.zt=null;Cd.prototype.toString=function(){return this.content};function Dd(a){if(null!=a)switch(a.zt){case 1:return 1;case -1:return-1;case 0:return 0}return null}function Ed(){Cd.call(this)}rd(Ed,Cd);Ed.prototype.$y=Bd;function V(a){return null!=a&&a.$y===Bd?a:Fd(String(String(a)).replace(Gd,Hd),Dd(a))} var Fd=function(a){function c(){}c.prototype=a.prototype;return function(d,e){var f=new c;f.content=String(d);void 0!==e&&(f.zt=e);return f}}(Ed),Id={"\x00":"�",'"':""","&":"&","'":"'","<":"<",">":">","\t":" ","\n":" ","\x0B":" ","\f":" ","\r":" "," ":" ","-":"-","/":"/","=":"=","`":"`","\u0085":"…","\u00a0":" ","\u2028":"
","\u2029":"
"};function Hd(a){return Id[a]}var Gd=/[\x00\x22\x26\x27\x3c\x3e]/g;function Ld(){return'
'};function Md(){var a=Nd,c='
Jogos do BlocklyQuebra-Cabe\u00e7aLabirintoP\u00e1ssaroTartarugaFilmeM\u00fasicaTutor de LagoaLagoaGen\u00e9ticasVoc\u00ea solucionou esse n\u00edvel com uma linha de JavaScript:Voc\u00ea solucionou esse n\u00edvel com %1 linhas de JavaScript:Voc\u00ea esta preparado para o n\u00edvel %1?Voc\u00ea esta preparado para o pr\u00f3ximo desafio?T\u00edtulo:Salvar e ligar aos blocos.Rodar o programa que voc\u00ea escreveu.Executar o programaParar a execu\u00e7\u00e3o do programa e resetar o nivel.ReiniciarAjudaOKCancelarL\u00f3gicaLa\u00e7osMatem\u00e1ticaTextoListasCorVari\u00e1veisFun\u00e7\u00f5esHouve um problema com a requisi\u00e7\u00e3o.Compartilhe seus blocos com este link:\n\n%1Desculpe, \'%1\' n\u00e3o corresponde a um programa salvo.N\u00e3o foi poss\u00edvel carregar seu arquivo salvo. Talvez ele tenha sido criado com uma vers\u00e3o diferente do Blockly?Agradecemos pelo programa! Se a nossa equipa gostar dele, este ser\u00e1 publicado na galeria por n\u00f3s dentro de alguns dias.listatextoQuando voc\u00ea come\u00e7ar a editar o JavaScript, voc\u00ea n\u00e3o poder\u00e1 mais voltar a editar os blocos. Voc\u00ea tem certeza?Blocos
avan\u00e7arvire \u00e0 esquerdavire \u00e0 direitafa\u00e7asen\u00e3oBlocos se-sen\u00e3o far\u00e3o uma coisa ou outra.se caminho \u00e0 frentese caminho \u00e0 esquerdase caminho \u00e0 direitarepetir at\u00e9Move o jogador um espa\u00e7o para frente.Vira o jogador 90 graus para esquerda ou direita.Se h\u00e1 um caminho na dire\u00e7\u00e3o especificada, \\nent\u00e3o fa\u00e7a algumas a\u00e7\u00f5es. Se h\u00e1 um caminho na dire\u00e7\u00e3o especificada, \\nent\u00e3o fa\u00e7a o primeiro bloco de a\u00e7\u00f5es. \\nCaso contr\u00e1rio, fa\u00e7a o segundo bloco de \\na\u00e7\u00f5es. Repetir as a\u00e7\u00f5es inclusas at\u00e9 que o ponto final \\nseja alcan\u00e7ado. Restam %0 blocos.Resta %1 bloco.Restam %2 blocos.

'+ ((Kc?'':'')+"Jogos do Blockly : "+V({appName:"Labirinto"}.appName)+"");a="&skin="+V(a);for(var d="   ",e=1;11>e;e++)d+=" "+(e==K?''+V(e)+"":10==e?''+V(e)+"":'');return c+d+'

  
Parab\u00e9ns!
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.
')+ (Ld()+"
")+(1==K?'
 Empilhe alguns blocos \'avan\u00e7ar\' juntos para me ajudar a alcan\u00e7ar o objetivo.
 Neste n\u00edvel, voc\u00ea deve empilhar todos os blocos na \u00e1rea de trabalho branca.
Execute seu programa para ver o que acontece.
': 2==K?'
Seu programa n\u00e3o resolveu o labirinto. Aperte \'Reiniciar\' e tente novamente.
':3==K||4==K?(3==K?'
Alcance o fim deste caminho usando apenas dois blocos. Use \'repetir\' para executar um bloco mais de uma vez.
': "")+'
 Voc\u00ea usou todos os blocos para este n\u00edvel. Para criar um novo bloco, voc\u00ea primeiro deve deletar um bloco existente.
Voc\u00ea pode encaixar mais de um bloco dentro de um bloco \'repetir\'.
': 5==K?'
Escolha o seu jogador favorito neste menu.
':6==K?'
Um bloco \'se\' far\u00e1 alguma coisa apenas se a condi\u00e7\u00e3o for verdadeira. Tente virar \u00e0 esquerda se houver um caminho para a esquerda.
': 7==K?'
Clique em %1 no bloco \'se\' para mudar sua condi\u00e7\u00e3o.
':9==K?'
Blocos se-sen\u00e3o far\u00e3o uma coisa ou outra.
':10==K?'
 Voc\u00ea consegue resolver este labirinto complicado? Tente seguir a parede da m\u00e3o esquerda. Apenas para programadores avan\u00e7ados!'+ Ld()+"
":"")};var Pc="maze";O.Um=function(){10>K?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+J+"&level="+(K+1)+"&skin="+Nd:O.Zj()}; var Od=[void 0,Infinity,Infinity,2,5,5,5,5,10,7,10][K],Pd=[{Oi:"maze/pegman.png",Yq:"maze/tiles_pegman.png",Om:"maze/marker.png",background:!1,Tj:!1,Xp:"#000",ir:["maze/win.mp3","maze/win.ogg"],Oo:["maze/fail_pegman.mp3","maze/fail_pegman.ogg"],$l:1},{Oi:"maze/astro.png",Yq:"maze/tiles_astro.png",Om:"maze/marker.png",background:"maze/bg_astro.jpg",Tj:!1,Xp:"#fff",ir:["maze/win.mp3","maze/win.ogg"],Oo:["maze/fail_astro.mp3","maze/fail_astro.ogg"],$l:2},{Oi:"maze/panda.png",Yq:"maze/tiles_panda.png", Om:"maze/marker.png",background:"maze/bg_panda.jpg",Tj:!1,Xp:"#000",ir:["maze/win.mp3","maze/win.ogg"],Oo:["maze/fail_panda.mp3","maze/fail_panda.ogg"],$l:3}],Nd=Lc("skin",0,Pd.length),U=Pd[Nd],X=[void 0,[[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,2,1,3,0,0],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,1,3,0,0,0],[0,0,2,1,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,2,1,1,1,1,3,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,1],[0,0,0,0,0,0,1,1],[0,0,0,0,0,3,1,0],[0,0,0,0,1,1,0,0],[0,0,0,1,1,0,0,0],[0,0,1,1,0,0,0,0],[0,2,1,0,0,0,0,0],[1,1,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0],[0,0,0,0,0,3,0,0],[0,0,0,0,0,1,0,0],[0,0,0,0,0,1,0,0],[0,0,0,0,0,1,0,0],[0,0,0,0,0,1,0,0],[0,0,0,2,1,1,0,0],[0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,1,1,1,1,1,0,0],[0,1,0,0,0,1,0,0],[0,1,1,3,0,1,0,0],[0,0,0,0, 0,1,0,0],[0,2,1,1,1,1,0,0],[0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0],[0,0,0,0,0,1,1,0],[0,2,1,1,1,1,0,0],[0,0,0,0,0,1,1,0],[0,1,1,3,0,1,0,0],[0,1,0,1,0,1,0,0],[0,1,1,1,1,1,1,0],[0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0],[0,1,1,1,1,0,0,0],[0,1,0,0,1,1,0,0],[0,1,1,1,0,1,0,0],[0,0,0,1,0,1,0,0],[0,2,1,1,0,3,0,0],[0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0],[0,1,1,1,1,1,0,0],[0,0,1,0,0,0,0,0],[3,1,1,1,1,1,1,0],[0,1,0,1,0,1,1,0],[1,1,1,1,1,0,1,0],[0,1,0,1,0,2,1,0],[0,0,0,0,0,0,0,0]],[[0,0,0,0,0,0,0,0], [0,1,1,0,3,0,1,0],[0,1,1,0,1,1,1,0],[0,1,0,1,0,1,0,0],[0,1,1,1,1,1,1,0],[0,0,0,1,0,0,1,0],[0,2,1,1,1,0,1,0],[0,0,0,0,0,0,0,0]]][K],Qd=X.length,Rd=X[0].length,Sd=50*Rd,Td=50*Qd,Ud=0,Y=[],Vd={10010:[4,0],10001:[3,3],11E3:[0,1],10100:[0,2],11010:[4,1],10101:[3,2],10110:[0,0],10011:[2,0],11001:[4,2],11100:[2,3],11110:[1,1],10111:[1,0],11011:[2,1],11101:[1,2],11111:[2,2],null0:[4,3],null1:[3,0],null2:[3,1],null3:[0,3],null4:[1,3]}; function Wd(){function a(n,q){return 0>n||n>=Rd||0>q||q>=Qd?"0":0==X[q][n]?"0":"1"}var c=document.getElementById("svgMaze"),d=50*Math.max(Qd,Rd);c.setAttribute("viewBox","0 0 "+d+" "+d);d=document.createElementNS(h.g.m.qc,"rect");d.setAttribute("width",Sd);d.setAttribute("height",Td);d.setAttribute("fill","#F1EEE7");d.setAttribute("stroke-width",1);d.setAttribute("stroke","#CCB");c.appendChild(d);if(U.background){var e=document.createElementNS(h.g.m.qc,"image");e.setAttributeNS(h.g.m.dd,"xlink:href", U.background);e.setAttribute("height",Td);e.setAttribute("width",Sd);e.setAttribute("x",0);e.setAttribute("y",0);c.appendChild(e)}if(U.Tj){for(d=0;dF(H).length?(e=document.getElementById("dialogHelpStack"),g={width:"370px",top:"130px"},g[a?"right":"left"]="215px",f=d[0].Y()):(d=G(H,!0),1;;;;;;'.split(";")),e=document.getElementById("dialogHelpOneTopBlock"), g={width:"360px",top:"120px"},g[a?"right":"left"]="225px",f=d[0].Y()):0==Ud&&(e=document.getElementById("dialogHelpRun"),g={width:"360px",top:"410px"},g[a?"right":"left"]="400px",f=document.getElementById("runButton")));else if(2==K)0!=Ud&&"none"==document.getElementById("runButton").style.display&&(e=document.getElementById("dialogHelpReset"),g={width:"360px",top:"410px"},g[a?"right":"left"]="400px",f=document.getElementById("resetButton"));else if(3==K)-1==c.indexOf("maze_forever")&&(0==Ra(H)?(e= document.getElementById("dialogHelpCapacity"),g={width:"430px",top:"310px"},g[a?"right":"left"]="50px",f=document.getElementById("capacityBubble")):(e=document.getElementById("dialogHelpRepeat"),g={width:"360px",top:"360px"},g[a?"right":"left"]="425px",f=d[3].Y()));else if(4==K)if(0==Ra(H)&&(-1==c.indexOf("maze_forever")||1l;l++)Y.push(setTimeout(a(l),P*l/2))}}function ae(a){var c=oe(4*T);Z(Q,S,16);a&&H.Bc.play("win",.5);P=150;Y.push(setTimeout(function(){Z(Q,S,18)},P));Y.push(setTimeout(function(){Z(Q,S,16)},2*P));Y.push(setTimeout(function(){Z(Q,S,c)},3*P))} function Z(a,c,d,e){var f=document.getElementById("pegman");f.setAttribute("x",50*a-49*d+1);f.setAttribute("y",50*(c+.5)-26-8);e?f.setAttribute("transform","rotate("+e+", "+(50*a+25)+", "+(50*c+25)+")"):f.setAttribute("transform","rotate(0, 0, 0)");c=document.getElementById("clipRect");c.setAttribute("x",50*a+1);c.setAttribute("y",f.getAttribute("y"))} function ke(a){var c=Q,d=S;switch(a){case 0:c+=.5;break;case 1:c+=1;d+=.5;break;case 2:c+=.5;d+=1;break;case 3:d+=.5}c*=50;d*=50;var e=90*a-45;a=document.getElementById("look");a.setAttribute("transform","translate("+c+", "+d+") rotate("+e+" 0 0) scale(.4)");c=a.getElementsByTagName("path");a.style.display="inline";for(d=0;a=c[d];d++)pe(a,P*d)}function pe(a,c){Y.push(setTimeout(function(){a.style.display="inline";setTimeout(function(){a.style.display="none"},2*P)},c))} function me(a){a=Math.round(a)%4;0>a&&(a+=4);return a}function oe(a){a=Math.round(a)%16;0>a&&(a+=16);return a}function ge(a,c){if(!ie(a,null))throw pd.push(["fail_"+(a?"backward":"forward"),c]),!1;switch(me(T+a)){case 0:S--;var d="north";break;case 1:Q++;d="east";break;case 2:S++;d="south";break;case 3:Q--,d="west"}pd.push([d,c])}function he(a,c){a?(T++,pd.push(["right",c])):(T--,pd.push(["left",c]));T=me(T)} function ie(a,c){switch(me(T+a)){case 0:var d=X[S-1]&&X[S-1][Q];var e="look_north";break;case 1:d=X[S][Q+1];e="look_east";break;case 2:d=X[S+1]&&X[S+1][Q];e="look_south";break;case 3:d=X[S][Q-1],e="look_west"}c&&pd.push([e,c]);return 0!==d&&void 0!==d} window.addEventListener("load",function(){function a(){l.style.top=Math.max(10,m.offsetTop-window.pageYOffset)+"px";l.style.left=k?"10px":"420px";l.style.width=window.innerWidth-440+"px"}function c(n){return function(){if(window.sessionStorage){var q=h.K.qn();q=h.K.Mc(q);window.sessionStorage.Vp=q}window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+J+"&level="+K+"&skin="+n}}document.body.innerHTML=Md();O.wa();document.querySelector("#pegmanButton>img").style.backgroundImage= "url("+U.Oi+")";for(var d=document.getElementById("pegmanMenu"),e=0;e',!1);for(d=0;d