// Automatically generated file. Do not edit! 'use strict';var b,h={g:{}};h.g.K=function(a,c){this.x=a;this.y=c};h.g.K.Ee=function(a,c){return a==c?!0:a&&c?a.x==c.x&&a.y==c.y:!1};h.g.K.bp=function(a,c){var d=a.x-c.x;a=a.y-c.y;return Math.sqrt(d*d+a*a)};h.g.K.QF=function(a){return Math.sqrt(a.x*a.x+a.y*a.y)};h.g.K.um=function(a,c){return new h.g.K(a.x-c.x,a.y-c.y)};h.g.K.sum=function(a,c){return new h.g.K(a.x+c.x,a.y+c.y)};h.g.K.prototype.scale=function(a){this.x*=a;this.y*=a;return this}; h.g.K.prototype.translate=function(a,c){this.x+=a;this.y+=c;return this}; h.NL={};h.Sv=40;h.dw=125;h.mB=5;h.vB=10;h.td=28;h.bB=h.td;h.eB=8;h.LB="#000000";h.Yn=250;h.Bq=10;h.ZA=30;h.$B=750;h.FC=100;h.nB=!0;h.HB=.45;h.IB=.65;h.ik={width:96,height:124,url:"sprites.png"};h.Wa=1;h.Te=2;h.jb=3;h.Ue=4;h.mg=5;h.xq=-1;h.jv=0;h.tl=1;h.rI=0;h.sI=1;h.pI=1;h.qI=2;h.fk=[];h.fk[h.Wa]=h.Te;h.fk[h.Te]=h.Wa;h.fk[h.jb]=h.Ue;h.fk[h.Ue]=h.jb;h.wg=0;h.kk=1;h.Yd=2;h.vg=3;h.Cv=null;h.Iq=1;h.Dv=2;h.vw="VARIABLE";h.WC="VARIABLE_DYNAMIC";h.ew="PROCEDURE";h.lw="RENAME_VARIABLE_ID";h.Ev="DELETE_VARIABLE_ID";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.fb={};h.g.fb.startsWith=function(a,c){return 0==a.lastIndexOf(c,0)};h.g.fb.Mu=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.fb.dv=function(a,c,d){for(var e=[0],f=[],g=0;ge&&(e=l,f=k)}return f?h.g.fb.xA(a,f,d):c};h.g.fb.DH=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.fb.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.Wu(f,c)):c?d.push(String(f)):d.push(f)):d.push("%{"+f+"}")):d.push("%{"+f+"}"),f=a.length=0))}(l=a.join(""))&&d.push(l);c=[];for(k=a.length=0;kd;d++)c[d]=h.g.Jg.cA.charAt(Math.random()*a);return c.join("")}; h.g.Jg.cA="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; h.g.hj=function(){if(void 0!==h.g.hj.Zr)return h.g.hj.Zr;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.hj.Zr="none"!==c;return h.g.hj.Zr};h.g.Tz=function(a){if("object"!=typeof document)throw Error("Blockly.utils.runAfterPageLoad() requires browser document.");if("complete"==document.readyState)a();else var c=setInterval(function(){"complete"==document.readyState&&(clearInterval(c),a())},10)};h.g.bF=function(){var a=h.g.style.ty();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}}; h.g.Ko=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};h.g.VE=function(){var a=document.documentElement,c=window;return h.g.userAgent.og&&c.pageYOffset!=a.scrollTop?new h.g.K(a.scrollLeft,a.scrollTop):new h.g.K(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};h.g.Us=function(a,c){var d=Object.create(null),e=p(a,!0);c&&(a=q(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.QG=function(a,c){var d=c.x;c=c.y;var e=ba(a).getBoundingClientRect();d=new h.g.K(d-e.left,c-e.top);c=h.g.Gm(a.pb);return h.g.K.um(d,c).scale(1/a.scale)};h.i={};h.i.xy="";h.i.Dc=!0;h.i.ws=0;h.i.fo="create";h.i.vl=h.i.fo;h.i.yl="delete";h.i.Wn=h.i.yl;h.i.si="change";h.i.QH=h.i.si;h.i.Hl="move";h.i.qv=h.i.Hl;h.i.ww="var_create";h.i.xw="var_delete";h.i.yw="var_rename";h.i.Io="ui";h.i.bo="comment_create";h.i.xv="comment_delete";h.i.wv="comment_change";h.i.co="comment_move";h.i.uB="finished_loading";h.i.RA=[h.i.vl,h.i.qv,h.i.bo,h.i.co];h.i.Al=[];h.i.Ka=function(a){h.i.isEnabled()&&(h.i.Al.length||setTimeout(h.i.FE,0),h.i.Al.push(a))}; h.i.FE=function(){for(var a=h.i.filter(h.i.Al,!0),c=h.i.Al.length=0,d;d=a[c];c++)if(d.tc){var e=h.Ib.Ws(d.tc);if(e){var f=d;if(f.Dc)for(e.Nj.push(f),e.on.length=0;e.Nj.length>e.Uv&&0<=e.Uv;)e.Nj.shift();for(var g=0;d=e.zd[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.Pk()){var k=[g.type,g.wc,g.tc].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.Hl&&l.index==f-1)m.uj=g.uj,m.tj=g.tj,m.Vh=g.Vh,l.index=f;else if(g.type==h.i.si&&g.element==m.element&&g.name==m.name)m.newValue=g.newValue;else if(g.type!=h.i.Io||"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.Pk()});c||a.reverse();for(f=1;g=a[f];f++)g.type==h.i.si&&"mutation"==g.element&&a.unshift(a.splice(f,1)[0]);return a};h.i.LD=function(){for(var a=0,c;c=h.i.Al[a];a++)c.Dc=!1};h.i.disable=function(){h.i.ws++};h.i.enable=function(){h.i.ws--};h.i.isEnabled=function(){return 0==h.i.ws};h.i.Zb=function(){return h.i.xy};h.i.$=function(a){h.i.xy="boolean"==typeof a?a?h.g.Jg():"":a}; h.i.$x=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.va=function(a){switch(a.type){case h.i.fo:var c=new h.i.Re(null);break;case h.i.yl:c=new h.i.wf(null);break;case h.i.si:c=new h.i.bh(null,"","","","");break;case h.i.Hl:c=new h.i.Bi(null);break;case h.i.ww:c=new h.i.ze(null);break;case h.i.xw:c=new h.i.We(null);break;case h.i.yw:c=new h.i.Bf(null,"");break;case h.i.Io:c=new h.i.ud(null,"","","");break;case h.i.bo:c=new h.i.kg(null);break;case h.i.wv:c=new h.i.Xj(null,"","");break;case h.i.co:c=new h.i.ti(null);break;case h.i.xv:c=new h.i.lg(null); break;default:throw Error("Unknown event type.");}c.va(a);c.tc=(void 0).id;return c};h.i.oE=function(a){if((a.type==h.i.Hl||a.type==h.i.fo)&&a.tc){var c=h.Ib.Ws(a.tc);if(a=r(c,a.wc)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.md(!0);else if((a.M||a.Z)&&!c.gc()){do a.md(!1),a=q(a);while(a)}}}}; h.i.Abstract=function(){this.tc=void 0;this.group=h.i.Zb();this.Dc=h.i.Dc};h.i.Abstract.prototype.Za=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};h.i.Abstract.prototype.va=function(a){this.group=a.group};h.i.Abstract.prototype.Pk=function(){return!1};h.i.Abstract.prototype.run=function(){};function v(a){if(a.tc)var c=h.Ib.Ws(a.tc);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};h.g.object={};h.g.object.W=function(a,c){a.w=c.prototype;a.prototype=Object.create(c.prototype);a.prototype.constructor=a};h.g.object.rj=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.i.ud=function(a,c,d,e){h.i.ud.w.constructor.call(this);this.wc=a?a.id:null;this.tc=a?a.v.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.Dc=!1};h.g.object.W(h.i.ud,h.i.Abstract);h.i.ud.prototype.type=h.i.Io;h.i.ud.prototype.Za=function(){var a=h.i.ud.w.Za.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.wc&&(a.blockId=this.wc);return a}; h.i.ud.prototype.va=function(a){h.i.ud.w.va.call(this,a);this.element=a.element;this.newValue=a.newValue;this.wc=a.blockId};h.g.o={};h.g.o.Ql="http://www.w3.org/2000/svg";h.g.o.zi="http://www.w3.org/1999/xhtml";h.g.o.Mi="http://www.w3.org/1999/xlink";h.g.o.Node={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16};h.g.o.Pi=null;h.g.o.Xr=0;h.g.o.L=function(a,c,d){a=document.createElementNS(h.g.o.Ql,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.o.Cb=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.o.Ec=function(a,c){var d=a.getAttribute("class");if(-1==(" "+d+" ").indexOf(" "+c+" "))return!1;d=d.split(/\s+/);for(var e=0;ec||c>this.kb.length)throw Error(h.uc.Error.XA);this.bs[a.ua()]=a;if(a.getParent()==this){var e=this.kb.indexOf(a);-1>>/g,a),a=document.createElement("style"),d=document.createTextNode(d),a.appendChild(d),document.head.insertBefore(a,document.head.firstChild))}};h.Ed.Fu=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")}; h.Ed.Eq=[".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.g.Ha={};h.g.Ha.nd=function(a){return a*Math.PI/180};h.g.Ha.ll=function(a){return 180*a/Math.PI};h.g.Ha.Ef=function(a,c,d){if(df.top?h.D.gy(d,e,f,g):c+g.heightdocument.documentElement.clientTop?h.D.gy(d,e,f,g):h.D.$E(a,f,g)}; h.D.iy=function(a,c,d,e){a=h.D.$s(a,d.left,d.right,e.width);return{yp:a.Ak,zp:c,hp:a.Ak,ip:c+h.D.cw,am:a.am,Hw:-(h.D.Vn/2+h.D.uv),Lr:!0,Mr:!0}};h.D.gy=function(a,c,d,e){a=h.D.$s(a,d.left,d.right,e.width);return{yp:a.Ak,zp:c-e.height,hp:a.Ak,ip:c-e.height-h.D.cw,am:a.am,Hw:e.height-2*h.D.uv-h.D.Vn/2,Lr:!1,Mr:!0}};h.D.$E=function(a,c,d){a=h.D.$s(a,c.left,c.right,d.width);return{yp:a.Ak,zp:0,hp:a.Ak,ip:0,Mr:!1}}; h.D.$s=function(a,c,d,e){var f=a;a=h.g.Ha.Ef(c,a-e/2,d-e);f-=h.D.Vn/2;c=h.g.Ha.Ef(h.D.ov,f-a,e-h.D.ov-h.D.Vn);return{am:c,Ak:a}};h.D.isVisible=function(){return!!h.D.ld};h.D.Hk=function(a,c){h.D.ld===a&&(c?h.D.Ik():h.D.Ca())};h.D.Ca=function(){var a=h.D.se;a.style.transform="translate(0, 0)";a.style.opacity=0;h.D.Kr=setTimeout(function(){h.D.Ik()},1E3*h.D.zq);h.D.xj&&(h.D.xj(),h.D.xj=null)}; h.D.Ik=function(){if(h.D.isVisible()){h.D.Kr&&clearTimeout(h.D.Kr);var a=h.D.se;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=h.D.Bv;a.style.borderColor=h.D.Av;h.D.xj&&(h.D.xj(),h.D.xj=null);h.D.KD();h.D.ld=null}}; h.D.ln=function(a,c,d,e){a=Math.floor(a);c=Math.floor(c);d=Math.floor(d);e=Math.floor(e);var f=h.D.se;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.D.kM=function(){if(h.D.ld){var a=h.D.ld.B,c=a.v.scale,d=h.D.Up?h.D.ld.bc.width:a.width,e=h.D.Up?h.D.ld.bc.height:a.height;d*=c;e*=c;a=h.D.Up?h.D.ld.gf.getBoundingClientRect():a.ya().getBoundingClientRect();d=a.left+d/2;e=h.D.jy(d,a.top+e,d,a.top);h.D.ln(e.yp,e.zp,e.hp,e.ip)}else h.D.Ca()}; h.yi=function(a,c){this.Fk=a;this.Ou=c.spacing;this.Xy=c.length;this.LF=(this.Gt=a.firstChild)&&this.Gt.nextSibling;this.ZG=c.snap};h.yi.prototype.gi=1;h.yi.prototype.I=function(){this.Fk=null};h.yi.prototype.update=function(a){this.gi=a;var c=this.Ou*a||100;this.Fk.setAttribute("width",c);this.Fk.setAttribute("height",c);c=Math.floor(this.Ou/2)+.5;var d=c-this.Xy/2,e=c+this.Xy/2;c*=a;d*=a;e*=a;ha(this.Gt,a,d,e,c,c);ha(this.LF,a,c,c,d,e)}; function ha(a,c,d,e,f,g){a&&(a.setAttribute("stroke-width",c),a.setAttribute("x1",d),a.setAttribute("y1",f),a.setAttribute("x2",e),a.setAttribute("y2",g))}h.yi.prototype.moveTo=function(a,c){this.Fk.setAttribute("x",a);this.Fk.setAttribute("y",c);(h.g.userAgent.og||h.g.userAgent.lo)&&this.update(this.gi)}; h.yi.Oa=function(a,c,d){a=h.g.o.L("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},d);0");c.zb(e)}h.i.Ka(new h.i.bh(c,"mutation",null,d,a)); break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.wc)};h.i.Re=function(a){a&&(h.i.Re.w.constructor.call(this,a),this.xml=a.v.ba?h.R.Sr(a):h.R.qh(a),this.Gh=h.i.$x(a))};h.g.object.W(h.i.Re,h.i.vf);h.i.$n=h.i.Re;h.i.Re.prototype.type=h.i.fo;h.i.Re.prototype.Za=function(){var a=h.i.Re.w.Za.call(this);a.xml=h.R.Md(this.xml);a.ids=this.Gh;return a}; h.i.Re.prototype.va=function(a){h.i.Re.w.va.call(this,a);this.xml=h.R.li(a.xml);this.Gh=a.ids};h.i.Re.prototype.run=function(a){var c=v(this);if(a)a=h.g.xml.createElement("xml"),a.appendChild(this.xml),h.R.xh(a,c);else{a=0;for(var d;d=this.Gh[a];a++){var e=r(c,d);e?e.I(!1):d==this.wc&&console.warn("Can't uncreate non-existent block: "+d)}}}; h.i.wf=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");h.i.wf.w.constructor.call(this,a);this.bu=a.v.ba?h.R.Sr(a):h.R.qh(a);this.Gh=h.i.$x(a)}};h.g.object.W(h.i.wf,h.i.vf);h.i.SA=h.i.wf;h.i.wf.prototype.type=h.i.yl;h.i.wf.prototype.Za=function(){var a=h.i.wf.w.Za.call(this);a.ids=this.Gh;return a};h.i.wf.prototype.va=function(a){h.i.wf.w.va.call(this,a);this.Gh=a.ids}; h.i.wf.prototype.run=function(a){var c=v(this);if(a){a=0;for(var d;d=this.Gh[a];a++){var e=r(c,d);e?e.I(!1):d==this.wc&&console.warn("Can't delete non-existent block: "+d)}}else a=h.g.xml.createElement("xml"),a.appendChild(this.bu),h.R.xh(a,c)};h.i.Bi=function(a){a&&(h.i.Bi.w.constructor.call(this,a),a=ia(this),this.oz=a.Cz,this.nz=a.My,this.Zt=a.jx)};h.g.object.W(h.i.Bi,h.i.vf);h.i.wl=h.i.Bi;b=h.i.Bi.prototype;b.type=h.i.Hl; b.Za=function(){var a=h.i.Bi.w.Za.call(this);this.uj&&(a.newParentId=this.uj);this.tj&&(a.newInputName=this.tj);this.Vh&&(a.newCoordinate=Math.round(this.Vh.x)+","+Math.round(this.Vh.y));return a};b.va=function(a){h.i.Bi.w.va.call(this,a);this.uj=a.newParentId;this.tj=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.Vh=new h.g.K(Number(a[0]),Number(a[1])))};b.Aj=function(){var a=ia(this);this.uj=a.Cz;this.tj=a.My;this.Vh=a.jx}; function ia(a){var c=r(v(a),a.wc);a={};var d=c.getParent();if(d){a.Cz=d.id;a:{for(var e=0,f;f=d.T[e];e++)if(f.connection&&z(f.connection)==c){c=f;break a}c=null}c&&(a.My=c.name)}else a.jx=c.Qa();return a}b.Pk=function(){return this.oz==this.uj&&this.nz==this.tj&&h.g.K.Ee(this.Zt,this.Vh)}; b.run=function(a){var c=v(this),d=r(c,this.wc);if(d){var e=a?this.uj:this.oz,f=a?this.tj:this.nz;a=a?this.Vh:this.Zt;var g=null;if(e&&(g=r(c,e),!g)){console.warn("Can't connect to non-existent block: "+e);return}d.getParent()&&A(d);if(a)f=d.Qa(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.M||d.Z;if(f){if(c=B(g,f))var k=c.connection}else d.type==h.Ue&&(k=g.X);k?d.connect(k):console.warn("Can't connect to non-existent input: "+f)}}else console.warn("Can't move non-existent block: "+this.wc)};h.i.Bl=function(a){this.tc=a.id;this.group=h.i.Zb();this.Dc=!1};h.g.object.W(h.i.Bl,h.i.Abstract);h.i.Bl.prototype.type=h.i.uB;h.i.Bl.prototype.Za=function(){var a={type:this.type};this.group&&(a.group=this.group);this.tc&&(a.workspaceId=this.tc);return a};h.i.Bl.prototype.va=function(a){this.tc=a.workspaceId;this.group=a.group};h.i.xg=function(a){h.i.xg.w.constructor.call(this);this.mi=a.ua();this.tc=a.v.id};h.g.object.W(h.i.xg,h.i.Abstract);h.i.xg.prototype.Za=function(){var a=h.i.xg.w.Za.call(this);a.varId=this.mi;return a};h.i.xg.prototype.va=function(a){h.i.xg.w.Za.call(this);this.mi=a.varId};h.i.ze=function(a){a&&(h.i.ze.w.constructor.call(this,a),this.Qj=a.type,this.Pj=a.name)};h.g.object.W(h.i.ze,h.i.xg);h.i.ze.prototype.type=h.i.ww; h.i.ze.prototype.Za=function(){var a=h.i.ze.w.Za.call(this);a.varType=this.Qj;a.varName=this.Pj;return a};h.i.ze.prototype.va=function(a){h.i.ze.w.va.call(this,a);this.Qj=a.varType;this.Pj=a.varName};h.i.ze.prototype.run=function(a){var c=v(this);a?c.Ld(this.Pj,this.Qj,this.mi):c.Kf(this.mi)};h.i.We=function(a){a&&(h.i.We.w.constructor.call(this,a),this.Qj=a.type,this.Pj=a.name)};h.g.object.W(h.i.We,h.i.xg);h.i.We.prototype.type=h.i.xw; h.i.We.prototype.Za=function(){var a=h.i.We.w.Za.call(this);a.varType=this.Qj;a.varName=this.Pj;return a};h.i.We.prototype.va=function(a){h.i.We.w.va.call(this,a);this.Qj=a.varType;this.Pj=a.varName};h.i.We.prototype.run=function(a){var c=v(this);a?c.Kf(this.mi):c.Ld(this.Pj,this.Qj,this.mi)};h.i.Bf=function(a,c){a&&(h.i.Bf.w.constructor.call(this,a),this.au=a.name,this.Vt=c)};h.g.object.W(h.i.Bf,h.i.xg);h.i.Bf.prototype.type=h.i.yw; h.i.Bf.prototype.Za=function(){var a=h.i.Bf.w.Za.call(this);a.oldName=this.au;a.newName=this.Vt;return a};h.i.Bf.prototype.va=function(a){h.i.Bf.w.va.call(this,a);this.au=a.oldName;this.Vt=a.newName};h.i.Bf.prototype.run=function(a){var c=v(this);a?c.ei(this.mi,this.Vt):c.ei(this.mi,this.au)};h.R={};h.R.vA=function(a){var c=C,d=h.g.xml.createElement("xml"),e=h.R.wH(h.O.Gw(c));e.hasChildNodes()&&d.appendChild(e);var f=ja(c,!0);e=0;for(var g;g=f[e];e++)d.appendChild(g.Vu(a));c=D(c,!0);for(e=0;f=c[e];e++)d.appendChild(h.R.Sr(f,a));return d};h.R.wH=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.ua();c.appendChild(f)}return c}; h.R.Sr=function(a,c){var d;a.v.G&&(d=a.v.Qf());c=h.R.qh(a,c);var e=a.Qa();c.setAttribute("x",Math.round(a.v.G?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c};h.R.DE=function(a){var c=!1;a.name&&(a.Hi?c=!0:a.ng&&(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),a.kA(c)):null}; h.R.mD=function(a,c){for(var d=0,e;e=a.T[d];d++)for(var f=0,g;g=e.Pa[f];f++)(g=h.R.DE(g))&&c.appendChild(g)}; h.R.qh=function(a,c){var d=h.g.xml.createElement(a.cb?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.eb){var e=a.eb();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}h.R.mD(a,d);if(e=a.Be.text){var f=a.Be.size,g=a.Be.pu,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.T[f];f++){var l;k=!0;if(g.type!=h.mg){var m=z(g.connection);g.type==h.Wa?l=h.g.xml.createElement("value"):g.type==h.jb&&(l=h.g.xml.createElement("statement"));e=g.connection.pf;!e||m&&m.cb||l.appendChild(h.R.Sw(e,c));m&&(l.appendChild(h.R.qh(m,c)),k=!1);l.setAttribute("name",g.name);k||d.appendChild(l)}}void 0!=a.Pg&&a.Pg!=a.CF&&d.setAttribute("inline",a.Pg);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.je()||a.cb||d.setAttribute("deletable", !1);a.kd()||a.cb||d.setAttribute("movable",!1);a.jd()||d.setAttribute("editable",!1);if(f=q(a))l=h.g.xml.createElement("next"),l.appendChild(h.R.qh(f,c)),d.appendChild(l);e=a.X&&a.X.pf;!e||f&&f.cb||l.appendChild(h.R.Sw(e,c));return d}; h.R.Sw=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.o.Node.TEXT_NODE&&""==e.data.trim()&&d.firstChild!=e&&h.g.o.removeNode(e);d&&(e=d,d=d.nextSibling,e.nodeType==h.g.o.Node.TEXT_NODE&&""==e.data.trim()&&h.g.o.removeNode(e))}return a}; h.R.Md=function(a){a=h.g.xml.Md(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1 $2")}while(a!=d);return a};h.R.OL=function(a){a=h.R.Md(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.R.li=function(a){var c=h.g.xml.hH(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};h.R.KL=function(a,c){c.Gc(!1);c.clear();a=h.R.xh(a,c);c.Gc(!0);return a}; h.R.xh=function(a,c){if(a instanceof h.Ib){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var e;c.G&&(e=c.Qf());d=[];h.g.o.Dn();var f=a.childNodes.length,g=h.i.Zb();g||h.i.$(!0);c.Gc&&c.Gc(!1);var k=!0;try{for(var l=0;l document.");}else a=null;return a};h.Touch={};h.Touch.uw="ontouchstart"in h.g.global||!!(h.g.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!h.g.global.navigator||!h.g.global.navigator.maxTouchPoints&&!h.g.global.navigator.msMaxTouchPoints);h.Touch.Kn=null;h.Touch.Af={}; h.g.global.PointerEvent?h.Touch.Af={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:h.Touch.uw&&(h.Touch.Af={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});h.Kp=0; h.OF=function(a,c){h.Sh();a.changedTouches&&1!=a.changedTouches.length||(h.Kp=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);c&&oa(c,a)},h.$B))};h.Sh=function(){h.Kp&&(clearTimeout(h.Kp),h.Kp=0)};h.Touch.em=function(){h.Touch.Kn=null};h.Touch.Nu=function(a){return!h.Touch.HF(a)||h.Touch.ID(a)}; h.Touch.sp=function(a){return void 0!=a.pointerId?a.pointerId:a.changedTouches&&a.changedTouches[0]&&void 0!==a.changedTouches[0].identifier&&null!==a.changedTouches[0].identifier?a.changedTouches[0].identifier:"mouse"};h.Touch.ID=function(a){var c=h.Touch.sp(a);return void 0!==h.Touch.Kn&&null!==h.Touch.Kn?h.Touch.Kn==c:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(h.Touch.Kn=c,!0):!1}; h.Touch.TG=function(a){if(h.g.fb.startsWith(a.type,"touch")){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY}};h.Touch.HF=function(a){return h.g.fb.startsWith(a.type,"touch")||h.g.fb.startsWith(a.type,"mouse")||h.g.fb.startsWith(a.type,"pointer")};h.Touch.Jp=function(a){return h.g.fb.startsWith(a.type,"touch")||h.g.fb.startsWith(a.type,"pointer")}; h.Touch.$G=function(a){var c=[];if(a.changedTouches)for(var d=0;d=d+this.Eh&&(e+=f);pa(this,xa(this,e));va(this);a.stopPropagation();a.preventDefault()}}; b.tG=function(a){Aa(this.s);qa();h.g.mj(a)?a.stopPropagation():(this.bH=this.Km,Ca(this.s),this.eA=this.ej?a.clientX:a.clientY,h.Ua.Zh=h.ma(document,"mouseup",this,this.yG),h.Ua.Yh=h.ma(document,"mousemove",this,this.uG),a.stopPropagation(),a.preventDefault())};b.uG=function(a){pa(this,xa(this,this.bH+((this.ej?a.clientX:a.clientY)-this.eA)));va(this)};b.yG=function(){Da(this.s);h.Touch.em();qa()};function qa(){h.oc(!0);h.Ua.Zh&&(h.$a(h.Ua.Zh),h.Ua.Zh=null);h.Ua.Yh&&(h.$a(h.Ua.Yh),h.Ua.Yh=null)} function xa(a,c){return c=0>=c||isNaN(c)||a.Peh.H.vC&&h.H.Ca()}else h.H.Tp!=h.H.hb&&(clearTimeout(h.H.zn),h.H.Dt=a.pageX,h.H.Et=a.pageY,h.H.zn=setTimeout(h.H.XG,h.H.GB))};h.H.Ca=function(){h.H.visible&&(h.H.visible=!1,h.H.Fa&&(h.H.Fa.style.display="none"));h.H.zn&&clearTimeout(h.H.zn)};h.H.block=function(){h.H.Ca();h.H.rk=!0};h.H.pH=function(){h.H.rk=!1}; h.H.XG=function(){if(!h.H.rk&&(h.H.Tp=h.H.hb,h.H.Fa)){h.H.Fa.innerHTML="";for(var a=h.H.hb.sf;"function"==typeof a;)a=a();a=h.g.fb.wA(a,h.H.UB);a=a.split("\n");for(var c=0;cd+window.scrollY&&(f-=h.H.Fa.offsetHeight+2*h.H.$v);a?e=Math.max(h.H.Vq-window.scrollX,e):e+h.H.Fa.offsetWidth>c+window.scrollX-2*h.H.Vq&&(e=c-h.H.Fa.offsetWidth-2*h.H.Vq);h.H.Fa.style.top=f+"px";h.H.Fa.style.left=e+"px"}};h.Bw=function(a){this.km=a;this.Oa()};b=h.Bw.prototype;b.tb=null;b.df=null;b.km=null;b.Oa=function(){this.tb||(this.tb=h.g.o.L("svg",{xmlns:h.g.o.Ql,"xmlns:html":h.g.o.zi,"xmlns:xlink":h.g.o.Mi,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.km.appendChild(this.tb))};b.Mj=function(a,c){a=a.toFixed(0);c=c.toFixed(0);this.tb.style.display="block";h.g.o.vn(this.tb,"translate3d("+a+"px, "+c+"px, 0px)")};b.bt=function(){return h.g.He(this.tb)}; b.Oo=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var c=this.tb.childNodes[0],d=this.tb.childNodes[1];if(!(c&&d&&h.g.o.Ay(c,"blocklyBlockCanvas")&&h.g.o.Ay(d,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!=this.Zk?h.g.o.gj(c,this.Zk):a.insertBefore(c,a.firstChild);h.g.o.gj(d,c);this.tb.style.display="none";if(this.tb.childNodes.length)throw Error("Drag surface was not cleared.");h.g.o.vn(this.tb, "");this.Zk=null};h.J=Object.create(null);h.sa=function(a,c){this.B=a;this.type=c};h.sa.ao=0;h.sa.hw=1;h.sa.kw=2;h.sa.jw=3;h.sa.fw=4;h.sa.gw=5;h.sa.iw=6;b=h.sa.prototype;b.ca=null;b.Ze=null;b.pf=null;b.Wb=0;b.ab=0; b.$e=function(a){var c=this,d=c.B,e=a.B;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=z(c),g=c.pf;c.pf=null;if(f.cb)g=h.R.qh(f),f.I(),f=null;else if(c.type==h.Wa){if(!f.M)throw Error("Orphan block does not have an output connection.");var k=h.sa.Uy(e,f);k&&(f.M.connect(k),f=null)}else if(c.type==h.jb){if(!f.Z)throw Error("Orphan block does not have a previous connection.");for(k=e;k.X;){var l=q(k);if(l&&!l.cb)k=l;else{Ea(f.Z,k.X)&&(k.X.connect(f.Z),f=null);break}}}if(f&&(c.disconnect(), h.i.Dc)){var m=h.i.Zb();setTimeout(function(){f.v&&!f.getParent()&&(h.i.$(m),f.M?f.M.Pp(c):f.Z&&f.Z.Pp(c),h.i.$(!1))},h.Yn)}c.pf=g}var n;h.i.isEnabled()&&(n=new h.i.wl(e));h.sa.TD(c,a);e.cl(d);n&&(n.Aj(),h.i.Ka(n))};b.I=function(){if(this.isConnected()){this.pf=null;var a=z(this);a.cb?a.I():A(a)}};function E(a){return a.type==h.Wa||a.type==h.jb}b.isConnected=function(){return!!this.ca}; function Fa(a,c){if(!c)return h.sa.jw;if(E(a))var d=a.B,e=c.B;else e=a.B,d=c.B;return d&&d==e?h.sa.hw:c.type!=h.fk[a.type]?h.sa.kw:d&&e&&d.v!==e.v?h.sa.gw:Ea(a,c)?d.cb&&!e.cb?h.sa.iw:h.sa.ao:h.sa.fw} function Ga(a,c){switch(Fa(a,c)){case h.sa.ao:break;case h.sa.hw:throw Error("Attempted to connect a block to itself.");case h.sa.gw:throw Error("Blocks not on same workspace.");case h.sa.kw:throw Error("Attempt to connect incompatible types.");case h.sa.jw:throw Error("Target connection is null.");case h.sa.fw:throw Error("Connection checks failed. "+(a+" expected "+a.Ze+", found "+c.Ze));case h.sa.iw:throw Error("Connecting non-shadow to shadow block.");default:throw Error("Unknown connection failure: this should never happen!"); }}b.Cp=function(a){if(a.B.Mh()||Fa(this,a)!=h.sa.ao)return!1;switch(a.type){case h.Ue:return this.ca||-1!=h.wm.indexOf(a)?a=!1:a.ca?(a=z(a),a=a.Mh()?!(a.Z&&z(a.Z)):!1):a=!0,a;case h.Te:if(a.isConnected()&&!z(a).Mh()||this.isConnected())return!1;break;case h.Wa:if(a.isConnected()&&!z(a).kd()&&!z(a).cb)return!1;break;case h.jb:if(a.isConnected()&&!this.B.X&&!z(a).cb&&z(a).X)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=h.wm.indexOf(a)?!1:!0};b.Pp=function(){}; b.connect=function(a){if(this.ca!=a){Ga(this,a);var c=h.i.Zb();c||h.i.$(!0);E(this)?this.$e(a):a.$e(this);c||h.i.$(!1)}};h.sa.TD=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.ca=c;c.ca=a};h.sa.YG=function(a,c){for(var d=!1,e=0;ed)){var e=Ia(c,a.ya());a.M?(e.x+=(a.G?3:-3)*d,e.y+=13*d):a.Z&&(e.x+=(a.G?-23:23)*d,e.y+=3*d);a=h.g.o.L("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},x(c));h.mb.ex(a,new Date,d)}};h.mb.ex=function(a,c,d){var e=(new Date-c)/150;1a.v.scale)){var c=H(a).height;c=Math.atan(10/c)/Math.PI*180;a.G||(c*=-1);h.mb.zx(a.ya(),c,new Date)}};h.mb.zx=function(a,c,d){var e=(new Date-d)/200;1a-h.eB)}if(a.Ac||a.Db)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Ac||!a.Db);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0} function La(a){a.Db&&(h.g.o.removeNode(h.sa.Jy),delete h.sa.Jy);if(a.ot){var c=a.Db;c.type!=h.Wa||c.isConnected()?Ma(a.Jk,!1):a.Jk.uF(c,!1);a.Jk=null;a.ot=!1}else if(a.pj)if(a.pj){c=a.pj;var d=c.B,e=d.X,f=d.Z,g=d.M;g=c.type==h.Wa&&!(g&&g.ca);!(c!=e||f&&f.ca)||g?A(z(c),!1):c.type==h.jb&&c!=e?(e=c.ca,A(e.B,!1),f=f?f.ca:null,A(d,!0),f&&f.connect(e)):A(d,!0);if(c.ca)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.pj=null;d.ya().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")} h.to.prototype.Dk=function(){var a=[];this.Bk&&a.push(this.Bk);this.nj&&a.push(this.nj);return a};h.ri=function(a,c){this.Eb=a;this.s=c;this.Mf=new h.to(this.Eb);this.Xi=null;this.gg=!1;this.eg=this.Eb.Qa();this.cp=h.ri.zF(a)};h.ri.prototype.I=function(){this.qc=this.s=this.Eb=null;this.cp.length=0;this.Mf&&(this.Mf.I(),this.Mf=null)};h.ri.zF=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=Na(e);for(var f=0;fc)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.jq.splice(c,1);this.jc.unsubscribe(this.Hc);this.options.Nb||(this.jc.I(),this.jc=null)}};h.Ib.mw=3;b=h.Ib.prototype; b.dg=function(a,c){a=a.Qa();c=c.Qa();return a.y+h.Ib.prototype.dg.offset*a.x-(c.y+h.Ib.prototype.dg.offset*c.x)};function Za(a,c){if(!h.g.Ko(a.ol,c))throw Error("Block not present in workspace's list of top-most blocks.");}function D(a,c){var d=[].concat(a.ol);c&&1g)return!1;d+=c[e]}return d>$a(a)?!1:!0} function bb(a){return Infinity!=a.options.Ot||!!a.options.Pt}b.$u=function(a){var c=a?this.on:this.Nj,d=a?this.Nj:this.on,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.Dc=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{h.i.Dc=!0}}};function cb(a,c){a.zd.push(c)}function db(a,c){h.g.Ko(a.zd,c)}function r(a,c){return a.Rr[c]||null}h.Ib.Wl=Object.create(null);h.Ib.Ws=function(a){return h.Ib.Wl[a]||null}; h.Ib.getAll=function(){var a=[],c;for(c in h.Ib.Wl)a.push(h.Ib.Wl[c]);return a};h.oa=function(a,c,d,e,f,g){this.s=a;this.af=c;this.$z=d;d=h.oa.KA;this.s.G&&(d=-d);this.pD=h.g.Ha.nd(d);a.Zg.appendChild(this.mm(c,!(!f||!g)));this.ec=e;this.xu&&eb(this);f&&g||(c=this.af.getBBox(),f=c.width+2*h.oa.cd,g=c.height+2*h.oa.cd);this.un(f,g);eb(this);fb(this);this.xu=!0;a.options.readOnly||(h.ma(this.bm,"mousedown",this,this.xD),this.Zf&&h.ma(this.Zf,"mousedown",this,this.LG))};h.oa.cd=6;h.oa.LA=5;h.oa.KA=20;h.oa.mv=4;h.oa.IA=8;h.oa.Zh=null;h.oa.Yh=null;h.oa.prototype.zu=null; h.oa.Zu=function(){h.oa.Zh&&(h.$a(h.oa.Zh),h.oa.Zh=null);h.oa.Yh&&(h.$a(h.oa.Yh),h.oa.Yh=null)};h.oa.yD=function(){h.Touch.em();h.oa.Zu()};b=h.oa.prototype;b.xu=!1;b.ec=null;b.Sg=0;b.di=0;b.rb=0;b.Wc=0;b.Or=!0; b.mm=function(a,c){this.ae=h.g.o.L("g",{},null);var d={filter:"url(#"+this.s.options.Ix+")"};h.g.userAgent.RB&&(d={});d=h.g.o.L("g",d,this.ae);this.Vr=h.g.o.L("path",{},d);this.bm=h.g.o.L("rect",{"class":"blocklyDraggable",x:0,y:0,rx:h.oa.cd,ry:h.oa.cd},d);c?(this.Zf=h.g.o.L("g",{"class":this.s.G?"blocklyResizeSW":"blocklyResizeSE"},this.ae),c=2*h.oa.cd,h.g.o.L("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.Zf),h.g.o.L("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/ 3},this.Zf),h.g.o.L("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.Zf)):this.Zf=null;this.ae.appendChild(a);return this.ae};b.ya=function(){return this.ae};function gb(a,c){a.ae.dataset&&(a.ae.dataset.blockId=c)}b.xD=function(a){var c=this.s.Ch(a);if(c){if(c.dj)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.oe||(c.oe=this);c.nf=a}};b.yn=function(){};b.je=function(){return!1}; b.LG=function(a){hb(this);h.oa.Zu();h.g.mj(a)||(this.s.Qu(a,new h.g.K(this.s.G?-this.rb:this.rb,this.Wc)),h.oa.Zh=h.ma(document,"mouseup",this,h.oa.yD),h.oa.Yh=h.ma(document,"mousemove",this,this.MG),h.oc());a.stopPropagation()};b.MG=function(a){this.Or=!1;var c=this.s;a=h.g.fn(a,x(c),Ba(c));a.x/=c.scale;a.y/=c.scale;c=h.g.K.sum(c.Fx,a);this.un(this.s.G?-c.x:c.x,c.y);this.s.G&&eb(this)};function hb(a){var c=a.ae.parentNode;return c.lastChild!==a.ae?(c.appendChild(a.ae),!0):!1} function ib(a,c,d){var e=a.s.G?a.ec.x-c.x-a.rb:c.x+a.ec.x;c=c.y+a.ec.y;return Math.max(0,Math.min(1,(Math.min(e+a.rb,d.dc+d.Bb)-Math.max(e,d.dc))*(Math.min(c+a.Wc,d.lc+d.Pb)-Math.max(c,d.lc))/(a.rb*a.Wc)))}function eb(a){var c=a.ec.x;c=a.s.G?c-(a.Sg+a.rb):c+a.Sg;a.moveTo(c,a.di+a.ec.y)}b.moveTo=function(a,c){this.ae.setAttribute("transform","translate("+a+","+c+")")};b.Vs=function(){return new h.g.Ve(this.rb,this.Wc)}; b.un=function(a,c){var d=2*h.oa.cd;a=Math.max(a,d+45);c=Math.max(c,d+20);this.rb=a;this.Wc=c;this.bm.setAttribute("width",a);this.bm.setAttribute("height",c);this.Zf&&(this.s.G?this.Zf.setAttribute("transform","translate("+2*h.oa.cd+","+(c-d)+") scale(-1 1)"):this.Zf.setAttribute("transform","translate("+(a-d)+","+(c-d)+")"));if(this.Or){a=this.s.Uc();a.dc/=this.s.scale;a.Bb/=this.s.scale;a.lc/=this.s.scale;a.Pb/=this.s.scale;c=-this.rb/4;if(!(this.rb>a.Bb)){if(this.s.G){d=this.ec.x-c;var e=d-this.rb; var f=a.dc+a.Bb,g=a.dc+h.Ua.Zc/this.s.scale}else e=c+this.ec.x,d=e+this.rb,g=a.dc,f=a.dc+a.Bb-h.Ua.Zc/this.s.scale;this.s.G?ef&&(c=-(f-this.ec.x)):ef&&(c=f-this.ec.x-this.rb)}e=c;c=-this.Wc/4;if(!(this.Wc>a.Pb)){d=this.ec.y+c;f=d+this.Wc;g=a.lc;var k=a.lc+a.Pb-h.Ua.Zc/this.s.scale,l=this.ec.y;dk&&(c=k-l-this.Wc)}g=c;f=this.$z.getBBox();c={x:e,y:-this.Wc-h.wa.Yq};d={x:-this.rb-30,y:g};g={x:f.width,y:g};k={x:e,y:f.height};e=f.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),t=Math.cos(m),u=a.Vs();m=(u.width+u.height)/h.oa.LA;m=Math.min(m,u.width,u.height)/4;u=1-h.oa.IA/k;f=d+u*f;g=e+u*g;u=d+m*t;var w=e+m*n;d-=m*t;e-=m*n;n=l+a.pD;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/h.oa.mv;k=Math.cos(n)*k/h.oa.mv;c.push("M"+u+","+ w);c.push("C"+(u+k)+","+(w+l)+" "+f+","+g+" "+f+","+g);c.push("C"+f+","+g+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.Vr.setAttribute("d",c.join(" "))}b.Fc=function(a){this.bm.setAttribute("fill",a);this.Vr.setAttribute("fill",a)};b.I=function(){h.oa.Zu();h.g.o.removeNode(this.ae);this.$z=this.af=this.s=this.Zf=this.bm=this.Vr=this.ae=null};b.St=function(a,c){a?a.Mj(c.x,c.y):this.moveTo(c.x,c.y);this.Sg=this.s.G?this.ec.x-c.x-this.rb:c.x-this.ec.x;this.di=c.y-this.ec.y;fb(this)}; b.Qa=function(){return new h.g.K(this.ec.x+this.Sg,this.ec.y+this.di)};h.i.jg=function(a){this.Gf=a.id;this.tc=a.v.id;this.group=h.i.Zb();this.Dc=h.i.Dc};h.g.object.W(h.i.jg,h.i.Abstract);h.i.jg.prototype.Za=function(){var a=h.i.jg.w.Za.call(this);this.Gf&&(a.commentId=this.Gf);return a};h.i.jg.prototype.va=function(a){h.i.jg.w.va.call(this,a);this.Gf=a.commentId};h.i.Xj=function(a,c,d){a&&(h.i.Xj.w.constructor.call(this,a),this.mz=c,this.Op=d)};h.g.object.W(h.i.Xj,h.i.jg);b=h.i.Xj.prototype;b.type=h.i.wv; b.Za=function(){var a=h.i.Xj.w.Za.call(this);a.newContents=this.Op;return a};b.va=function(a){h.i.Xj.w.va.call(this,a);this.Op=a.newValue};b.Pk=function(){return this.mz==this.Op};b.run=function(a){var c;(c=v(this).So[this.Gf]||null)?c.qM(a?this.Op:this.mz):console.warn("Can't change non-existent comment: "+this.Gf)};h.i.kg=function(a){a&&(h.i.kg.w.constructor.call(this,a),this.xml=a.Vu())};h.g.object.W(h.i.kg,h.i.jg);h.i.kg.prototype.type=h.i.bo; h.i.kg.prototype.Za=function(){var a=h.i.kg.w.Za.call(this);a.xml=h.R.Md(this.xml);return a};h.i.kg.prototype.va=function(a){h.i.kg.w.va.call(this,a);this.xml=h.R.li(a.xml)};h.i.kg.prototype.run=function(a){h.i.zv(this,a)};h.i.zv=function(a,c){var d=v(a);c?(c=h.g.xml.createElement("xml"),c.appendChild(a.xml),h.R.xh(c,d)):(d=d.So[a.Gf]||null)?d.I(!1,!1):console.warn("Can't uncreate non-existent comment: "+a.Gf)};h.i.lg=function(a){a&&(h.i.lg.w.constructor.call(this,a),this.xml=a.Vu())}; h.g.object.W(h.i.lg,h.i.jg);h.i.lg.prototype.type=h.i.xv;h.i.lg.prototype.Za=function(){return h.i.lg.w.Za.call(this)};h.i.lg.prototype.va=function(a){h.i.lg.w.va.call(this,a)};h.i.lg.prototype.run=function(a){h.i.zv(this,!a)};h.i.ti=function(a){a&&(h.i.ti.w.constructor.call(this,a),this.gs=a,this.$t=a.uy(),this.sj=null)};h.g.object.W(h.i.ti,h.i.jg);b=h.i.ti.prototype; b.Aj=function(){if(!this.gs)throw Error("Tried to record the new position of a comment on the same event twice.");this.sj=this.gs.uy();this.gs=null};b.type=h.i.co;b.Za=function(){var a=h.i.ti.w.Za.call(this);this.sj&&(a.newCoordinate=Math.round(this.sj.x)+","+Math.round(this.sj.y));return a};b.va=function(a){h.i.ti.w.va.call(this,a);a.newCoordinate&&(a=a.newCoordinate.split(","),this.sj=new h.g.K(Number(a[0]),Number(a[1])))};b.Pk=function(){return h.g.K.Ee(this.$t,this.sj)}; b.run=function(a){var c;if(c=v(this).So[this.Gf]||null){a=a?this.sj:this.$t;var d=c.uy();c.moveBy(a.x-d.x,a.y-d.y)}else console.warn("Can't move non-existent comment: "+this.Gf)};h.xl=function(a,c){this.nc=a;this.s=c;this.Xi=null;this.tq=!1;this.eg=this.nc.Qa();this.$i=h.g.hj()&&c.$d?c.$d:null};h.xl.prototype.I=function(){this.$i=this.s=this.nc=null};function jb(a,c,d){d=a.Wk(d);d=h.g.K.sum(a.eg,d);a.nc.St(a.$i,d);a.nc.je()&&(a.Xi=Qa(a.s,c),a.tq=a.Xi!=h.Cv,c=a.s.ad,a.tq?(Ra(a.nc,!0),a.Xi==h.Iq&&c&&Sa(c,!0)):(Ra(a.nc,!1),c&&Sa(c,!1)))} function kb(a,c,d){jb(a,c,d);c=a.Wk(d);c=h.g.K.sum(a.eg,c);a.nc.moveTo(c.x,c.y);c=a.s.ad;a.tq?(c&&setTimeout(c.close.bind(c),100),a.Am(),a.nc.I(!1,!0)):c&&c.close();a.tq||(a.$i&&a.$i.Oo(a.s.Zg),a.nc.Cj&&a.nc.Cj(!1),a.Am());a.s.Gc(!0);a.s.ra&&h.g.o.Ec(a.s.ra.vc,a.nc.je()?"blocklyToolboxDelete":"blocklyToolboxGrab");h.i.$(!1)}h.xl.prototype.Am=function(){if(this.nc.Qy){var a=new h.i.ti(this.nc);a.$t=this.eg;a.Aj();h.i.Ka(a)}}; h.xl.prototype.Wk=function(a){a=new h.g.K(a.x/this.s.scale,a.y/this.s.scale);this.s.lj&&a.scale(1/this.s.options.Nb.scale);return a};h.xl.prototype.Ut=function(){this.nc.moveTo(0,0);this.$i.Mj(this.eg.x,this.eg.y);ca(this.$i,this.nc.ya())};h.Xl=function(a){this.s=a;this.gA=new h.g.K(a.scrollX,a.scrollY)};h.Xl.prototype.I=function(){this.s=null};h.Xl.prototype.Qu=function(){h.selected&&lb(h.selected);Ca(this.s)};h.Xl.prototype.yh=function(a){a=h.g.K.sum(this.gA,a);this.s.scroll(a.x,a.y)};h.no=function(a){h.no.w.constructor.call(this,a.Ek());this.pc=a.pc;this.kf=a.kf};h.g.object.W(h.no,h.Xl);h.no.prototype.yh=function(a){a=h.g.K.sum(this.gA,a);this.kf?this.pc.set(-a.x):this.pc.set(-a.y)};h.Zj=function(a,c){this.qc=this.rc=this.Ej=this.Fj=this.oe=this.vd=this.hz=null;this.ls=c;this.Pm=this.jj=this.Qm=this.bj=!1;this.nf=a;this.P=this.oi=this.Ye=this.zg=this.Rp=this.Qp=null;this.Ep=this.dj=this.Nw=!1;this.Ey=!h.nB};b=h.Zj.prototype;b.I=function(){h.Touch.em();h.H.pH();this.ls.yc=null;this.Qp&&h.$a(this.Qp);this.Rp&&h.$a(this.Rp);this.P=this.qc=this.rc=this.Ej=this.Fj=null;this.Ye&&(this.Ye.I(),this.Ye=null);this.oi&&(this.oi.I(),this.oi=null);this.zg&&(this.zg.I(),this.zg=null)}; function mb(a,c){a.vd=h.g.K.um(new h.g.K(c.clientX,c.clientY),a.hz);if(a.bj)var d=!1;else a.bj=h.g.K.QF(a.vd)>(a.P?h.vB:h.mB),d=a.bj;if(d){if(a.Nw)throw Error("updateIsDragging_ should only be called once per gesture.");a.Nw=!0;if(a.oe){a.Pm=!0;a.zg=new h.xl(a.oe,a.qc);d=a.zg;h.i.Zb()||h.i.$(!0);d.s.Gc(!1);d.nc.Or=!1;d.$i&&d.Ut();d.nc.Cj&&d.nc.Cj(!0);var e=d.s.ra;e&&h.g.o.Cb(e.vc,d.nc.je()?"blocklyToolboxDelete":"blocklyToolboxGrab");jb(a.zg,a.nf,a.vd);d=!0}else d=!1;if(!d){if(a.rc)if(a.P?(a.P.Py(a.rc)? ((d=!nb(a.P))||(d=a.vd,d=Math.atan2(d.y,d.x)/Math.PI*180,e=a.P.xE,d=d-e||d<-180+e||d>180-e?!0:!1),d?(a.qc=a.P.Ob,ob(a.qc),h.i.Zb()||h.i.$(!0),a.Ej=null,a.rc=pb(a.P,a.rc),a.rc.select(),d=!0):d=!1):d=!1,a.jj=d):a.rc.kd()&&(a.jj=!0),a.jj){a.Ye=new h.ri(a.rc,a.qc);d=a.Ye;e=a.vd;var f=a.Ey;h.i.Zb()||h.i.$(!0);d.s.lj&&Va(d.Eb);h.g.o.Dn();d.s.Gc(!1);h.mb.zs();if(d.Eb.getParent()||f&&d.Eb.X&&z(d.Eb.X))A(d.Eb,f),e=d.Wk(e),e=h.g.K.sum(d.eg,e),d.Eb.translate(e.x,e.y),h.mb.rE(d.Eb);d.Eb.Cj(!0);d.Eb.Ut(); (e=d.s.ra)&&h.g.o.Cb(e.vc,d.Eb.je()?"blocklyToolboxDelete":"blocklyToolboxGrab");Oa(a.Ye,a.nf,a.vd);d=!0}else d=!1;else d=!1;if(d=!d)if(a.P)d=nb(a.P);else if(d=a.qc)d=a.qc,d=d.options.Bc&&d.options.Bc.yh;d&&(a.oi=a.P?new h.no(a.P):new h.Xl(a.qc),a.Qm=!0,a.oi.Qu())}h.Sh()}a.nf=c} b.As=function(a){h.g.Hp(a)?this.cancel():(this.dj=!0,h.mb.zs(),ob(this.qc),this.qc.lj&&this.qc.resize(),Aa(this.qc),this.nf=a,h.oc(!!this.P),h.H.block(),this.rc&&(!this.rc.$b&&a.shiftKey?(h.navigation.Ns(),J(this.ls.Xa,h.navigation.et(this.rc))):this.rc.select()),h.g.mj(a)?oa(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||h.OF(a,this),this.hz=new h.g.K(a.clientX,a.clientY),this.Ey=a.altKey||a.ctrlKey||a.metaKey,this.qk(a)))}; b.qk=function(a){this.Qp=h.ma(document,"mousemove",null,this.Jm.bind(this));this.Rp=h.ma(document,"mouseup",null,this.tp.bind(this));a.preventDefault();a.stopPropagation()};b.Jm=function(a){mb(this,a);this.Qm?this.oi.yh(this.vd):this.jj?Oa(this.Ye,this.nf,this.vd):this.Pm&&jb(this.zg,this.nf,this.vd);a.preventDefault();a.stopPropagation()}; b.tp=function(a){mb(this,a);h.Sh();if(this.Ep)console.log("Trying to end a gesture recursively.");else{this.Ep=!0;if(this.Pm)kb(this.zg,a,this.vd);else if(this.jj)Ta(this.Ye,a,this.vd);else if(this.Qm){var c=this.oi;c.yh(this.vd);Da(c.s)}else if(this.oe&&!this.bj)this.oe.UG&&this.oe.UG(),this.oe.select&&this.oe.select();else if(qb(this))this.Fj.qf(),rb(this);else if(this.Ej&&!this.bj&&!qb(this))this.P&&this.P.pk?this.rc.isEnabled()&&(h.i.Zb()||h.i.$(!0),Wa(pb(this.P,this.rc))):h.i.Ka(new h.i.ud(this.Ej, "click",void 0,void 0)),rb(this),h.i.$(!1);else if(!(this.Ej||this.oe||this.Fj||this.bj))if(c=this.ls,a.shiftKey){h.navigation.Ns();var d=h.g.QG(c,new h.g.K(a.clientX,a.clientY));d=h.F.pm(c,d);J(c.Xa,d)}else h.selected&&lb(h.selected);a.preventDefault();a.stopPropagation();this.I()}};b.cancel=function(){if(!this.Ep){h.Sh();if(this.Pm)kb(this.zg,this.nf,this.vd);else if(this.jj)Ta(this.Ye,this.nf,this.vd);else if(this.Qm){var a=this.oi;a.yh(this.vd);Da(a.s)}this.I()}}; function oa(a,c){a.rc?(rb(a),h.oc(a.P),a.rc.yn(c)):a.oe?a.oe.yn(c):a.qc&&!a.P&&(h.oc(),a.qc.yn(c));c.preventDefault();c.stopPropagation();a.I()}function sb(a,c,d){if(a.dj)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");a.qc||(a.qc=d);a.nf=c;a.As(c);h.Le&&h.navigation.Gb(h.navigation.Pl)}function tb(a,c,d){if(a.dj)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");a.P||(a.P=d);sb(a,c,d.Ek())} function rb(a){a.rc&&!a.P&&Va(a.rc)}function ub(a,c){a.Ej||a.oe||(a.Ej=c,c.$b&&c!=I(c)?vb(a,I(c)):vb(a,c))}function vb(a,c){c.cb?vb(a,c.getParent()):a.rc=c}function qb(a){if(a.Fj){var c=a.Fj;c=!!c.B&&c.B.jd()&&!!c.qf&&"function"===typeof c.qf}else c=!1;return c&&!a.bj&&(!a.P||!a.P.pk)}b.gc=function(){return this.Qm||this.jj||this.Pm};b.Dk=function(){return this.Ye?this.Ye.Dk():[]};h.Zj.rt=function(){for(var a=h.Ib.getAll(),c=0,d;d=a[c];c++)if(d.yc)return!0;return!1};h.Na=function(a,c,d){this.mA=this.Oj=this.cc=null;this.bc=new h.g.Ve(0,0);this.Sc=null;d&&this.Kd(d);this.setValue(a);c&&(this.Oj=c)};h.Na.tv=16;h.Na.sw=12.5;h.Na.Yl=10;h.Na.FL=10;h.Na.wi=h.Na.Yl/2;b=h.Na.prototype;b.name=void 0;b.ez=50;b.B=null;b.Sf=!0;b.ni=!0;b.Po=null;h.Na.Yv="\u00a0";b=h.Na.prototype;b.ng=!0;b.Hi=!1;b.Kd=function(a){var c=a.tooltip;"string"==typeof c&&(c=h.g.le(a.tooltip));c&&this.Ra(c)};b.Lu=function(a){if(this.B)throw Error("Field already bound to a block.");this.B=a}; b.S=function(){this.gf||(this.gf=h.g.o.L("g",{},null),this.isVisible()||(this.gf.style.display="none"),this.B.ya().appendChild(this.gf),this.Jh(),this.ah(),this.Ra(this.mA),h.H.qk(this.Po||this.ya()),this.gz=h.ma(this.Po||this.ya(),"mousedown",this,this.Xh),this.fj())};b.Jh=function(){this.bc.height=Math.max(this.bc.height,h.Na.tv);this.bc.width=Math.max(this.bc.width,h.Na.Yl);this.Oi=h.g.o.L("rect",{rx:4,ry:4,x:0,y:0,height:this.bc.height,width:this.bc.width},this.gf);wb(this)};b.fj=function(){}; function wb(a){a.ic=h.g.o.L("text",{"class":"blocklyText",y:h.Na.sw,x:a.Oi?h.Na.wi:0},a.gf);a.Kj=document.createTextNode("");a.ic.appendChild(a.Kj)}b.Cm=function(a){this.setValue(a.textContent)};b.kA=function(a){a.textContent=this.getValue();return a};b.I=function(){h.D.Hk(this);h.aa.Hk(this);this.gz&&h.$a(this.gz);h.g.o.removeNode(this.gf)}; b.ah=function(){var a=this.Po||this.ya();this.ng&&a&&(this.B.jd()?(h.g.o.Cb(a,"blocklyEditableText"),h.g.o.Ec(a,"blocklyNonEditableText"),a.style.cursor=this.Hq):(h.g.o.Cb(a,"blocklyNonEditableText"),h.g.o.Ec(a,"blocklyEditableText"),a.style.cursor=""))};b.isVisible=function(){return this.ni};b.Vb=function(a){if(this.ni!=a){this.ni=a;var c=this.ya();c&&(c.style.display=a?"block":"none")}};function xb(a,c){a.Oj=c}b.sy=function(){return this.Oj};b.ya=function(){return this.gf};b.Qe=function(){}; b.Yf=function(){if(this.Kj){this.Kj.nodeValue=yb(this);var a=h.g.o.ct(this.ic);this.Oi&&(a+=h.Na.Yl,this.Oi.setAttribute("width",a));this.bc.width=a}};b.Lg=function(){if(!this.isVisible())return new h.g.Ve(0,0);this.Sf?(this.Yf(),this.Sf=!1):this.ni&&0==this.bc.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.Yf());return this.bc}; function yb(a){var c=a.Tb();if(!c)return h.Na.Yv;c.length>a.ez&&(c=c.substring(0,a.ez-2)+"\u2026");c=c.replace(/\s/g,h.Na.Yv);a.B&&a.B.G&&(c+="\u200f");return c}b.Tb=function(){if(this.dt){var a=this.dt.call(this);if(null!==a)return String(a)}return String(this.getValue())};b.dl=function(){throw Error("setText method is deprecated");};b.Zm=function(){this.Sf=!0};function zb(a){a.Sf=!0;a.B&&a.B.ba&&(a.B.za(),a.B.Kb())} b.setValue=function(a){if(null!==a){var c=this.wh(a);a=Ab(this,a,c);if(!(a instanceof Error)){if(c=this.sy())if(c=c.call(this,a),a=Ab(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.B&&h.i.isEnabled()&&h.i.Ka(new h.i.hg(this.B,"field",this.name||null,c,a)),this.Yi(a),this.Sf&&zb(this))}}};function Ab(a,c,d){if(null===d)return a.Ex(),a.Sf&&zb(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.cc};b.wh=function(a){return null===a||void 0===a?null:a}; b.Yi=function(a){this.cc=a;this.Sf=!0};b.Ex=function(){};b.Xh=function(a){if(this.B&&this.B.v&&(a=this.B.v.Ch(a))){if(a.dj)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.Fj||(a.Fj=this)}};b.Ra=function(a){var c=this.Po||this.ya();c?c.sf=a||""===a?a:this.B:this.mA=a};b.pn=function(){return!1};b.Pf=function(){for(var a=null,c=this.B,d=c.T,e=0;ec||c>a.Pa.length)throw Error("index "+c+" out of bounds.");if(!(d||""==d&&e))return c;"string"==typeof d&&(d=new h.Fd(d));d.Lu(a.B);a.B.ba&&d.S();d.name=e;d.qu&&(c=Bb(a,c,d.qu));a.Pa.splice(c,0,d);++c;d.Tu&&(c=Bb(a,c,d.Tu));a.B.ba&&(a.B.za(),a.B.Kb());return c}function Cb(a,c){for(var d=0,e;e=a.Pa[d];d++)if(e.name===c){e.I();a.Pa.splice(d,1);a.B.ba&&(a.B.za(),a.B.Kb());return}throw Error('Field "%s" not found.',c);}b.isVisible=function(){return this.ni}; b.Vb=function(a){var c=[];if(this.ni==a)return c;for(var d=(this.ni=a)?"block":"none",e=0,f;f=this.Pa[e];e++)f.Vb(a);if(this.connection){if(a)c=Db(this.connection);else if(e=this.connection,Eb(e,!0),e.ca)for(e=p(z(e),!1),f=0;fa&&0<=c&&256>c&&0<=d&&256>d)?h.g.Lb.Cu(a,c,d):null}; h.g.Lb.Cu=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};h.g.Lb.Fy=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; h.g.Lb.vF=function(a){var c=h.HB,d=255*h.IB,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.Lb.Cu(Math.floor(e),Math.floor(f),Math.floor(g))}; h.g.Lb.Qr=function(a,c,d){a=h.g.Lb.Fy(h.g.Lb.parse(a));c=h.g.Lb.Fy(h.g.Lb.parse(c));return h.g.Lb.Cu(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.Lb.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.Zn=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&&!r(a,d)?d:h.g.Jg();a.Rr[this.id]=this;this.Z=this.X=this.M=null;this.T=[];this.Pg=void 0;this.disabled=!1;this.sf="";this.contextMenu=!0;this.Uf=null;this.Bg=[];this.Hx=this.jz=this.ps=!0;this.Cg=this.cb=!1;this.vk=null;this.Be={text:null,pu:!1,size:new h.g.Ve(160,80)};this.BA=new h.g.K(0,0);this.v=a;this.$b=a.ke;this.G=a.G; this.Tm=!1;this.Ng=void 0;if(c){this.type=c;d=h.J[c];if(!d||"object"!=typeof d)throw TypeError("Unknown block type: "+c);h.g.object.rj(this,d)}a.ol.push(this);a.$g[this.type]||(a.$g[this.type]=[]);a.$g[this.type].push(this);"function"==typeof this.S&&this.S();this.CF=this.Pg;if(h.i.isEnabled()){(a=h.i.Zb())||h.i.$(!0);try{h.i.Ka(new h.i.$n(this))}finally{a||h.i.$(!1)}}if("function"==typeof this.onchange){if((a=this.onchange)&&"function"!=typeof a)throw Error("onchange must be a function.");this.hn&& db(this.v,this.hn);if(this.onchange=a)this.hn=a.bind(this),cb(this.v,this.hn)}};b=h.Zn.prototype;b.data=null;b.sh="#000000";b.Xw=null;b.Yw=null; b.I=function(a){if(this.v){this.hn&&db(this.v,this.hn);h.Le&&h.navigation.kz(this);A(this,a);h.i.isEnabled()&&h.i.Ka(new h.i.SA(this));h.i.disable();try{if(this.v){Za(this.v,this);var c=this.v;c.$g[this.type].splice(c.$g[this.type].indexOf(this),1);c.$g[this.type].length||delete c.$g[this.type];delete this.v.Rr[this.id];this.v=null}h.selected==this&&(h.selected=null);for(var d=this.Bg.length-1;0<=d;d--)this.Bg[d].I(!1);d=0;for(var e;e=this.T[d];d++)e.I();this.T.length=0;var f=this.Fe(!0);d=0;for(var g;g= f[d];d++)g.I()}finally{h.i.enable()}}};b.fj=function(){for(var a=0,c;c=this.T[a];a++)for(var d=0,e;e=c.Pa[d];d++)e.fj&&e.fj()}; function A(a,c){if(a.M){var d=null;a.M.isConnected()&&(d=a.M.ca,a.M.disconnect());if(d&&c){a:{c=null;for(var e=0;e=d)this.sh=h.Ky(d);else if(d=h.g.Lb.parse(c))this.sh=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);};function M(a,c){var d=a.v.rp().wD[c];if(d)a.Xw=d.colourSecondary,a.Yw=d.colourTertiary,a.Ng=d.Ng,a.Fc(d.colourPrimary);else throw Error("Invalid style name: "+c);}function y(a,c){for(var d=0,e;e=a.T[d];d++)for(var f=0,g;g=e.Pa[f];f++)if(g.name==c)return g;return null} b.ht=function(){for(var a=[],c=0,d;d=this.T[c];c++)for(var e=0,f;f=d.Pa[e];e++)f.pn()&&a.push(f.getValue());return a};b.Mg=function(){for(var a=[],c=0,d;d=this.T[c];c++)for(var e=0,f;f=d.Pa[e];e++)f.pn()&&(f=this.v.hf(f.getValue()))&&a.push(f);return a};b.pq=function(a){for(var c=0,d;d=this.T[c];c++)for(var e=0,f;f=d.Pa[e];e++)f.pn()&&a.ua()==f.getValue()&&zb(f)};b.Zp=function(a,c){for(var d=0,e;e=this.T[d];d++)for(var f=0,g;g=e.Pa[f];f++)g.pn()&&a==g.getValue()&&g.setValue(c)}; function G(a,c){return(a=y(a,c))?a.getValue():null}function Jb(a,c,d){a=y(a,d);if(!a)throw Error('Field "'+d+'" not found.');a.setValue(c)}b.ne=function(a,c){if(a){void 0===c&&(c=null);if(!this.Z){if(this.M)throw Error("Remove output connection prior to adding previous connection.");this.Z=this.Ym(h.Ue)}this.Z.vb(c)}else if(this.Z){if(this.Z.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.Z.I();this.Z=null}}; b.me=function(a,c){if(a)void 0===c&&(c=null),this.X||(this.X=this.Ym(h.jb)),this.X.vb(c);else if(this.X){if(this.X.isConnected())throw Error("Must disconnect next statement before removing connection.");this.X.I();this.X=null}}; b.Ad=function(a,c){if(a){void 0===c&&(c=null);if(!this.M){if(this.Z)throw Error("Remove previous connection prior to adding output connection.");this.M=this.Ym(h.Te)}this.M.vb(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.$c=function(a){this.Pg!=a&&(h.i.Ka(new h.i.hg(this,"inline",null,this.Pg,a)),this.Pg=a)}; function Ha(a){if(void 0!=a.Pg)return a.Pg;for(var c=1;ca&&(d=d.substring(0,a-3)+"...");return d};function N(a,c){return a.$l(h.Wa,c)} function Lb(a,c){return a.$l(h.jb,c)}function O(a,c){return a.$l(h.mg,c||"")} function P(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.Ng&&(a.Ng=c.style.Ng,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{M(a,e)}catch(F){console.warn(d+"Style does not exist: ",e)}}else if("colour"in c)if(void 0===c.colour)console.warn(d+"Undefined colour value.");else{e=c.colour;try{a.Fc(e)}catch(F){console.warn(d+ "Illegal colour value: ",e)}}for(e=0;void 0!==c["message"+e];){for(var f=a,g=c["args"+e]||[],k=c["lastDummyAlign"+e],l=h.g.kH(c["message"+e]),m=[],n=0,t=[],u=0;u=w||w>g.length)throw Error('Block "'+f.type+'": Message index %'+w+" out of range.");if(m[w])throw Error('Block "'+f.type+'": Message index %'+w+" duplicated.");m[w]=!0;n++;t.push(g[w-1])}else(w=w.trim())&&t.push(w)}if(n!=g.length)throw Error('Block "'+f.type+'": Message does not reference all '+ g.length+" arg(s).");t.length&&("string"==typeof t[t.length-1]||h.g.fb.startsWith(t[t.length-1].type,"field_"))&&(u={type:"input_dummy"},k&&(u.align=k),t.push(u));k={LEFT:h.xq,RIGHT:h.tl,CENTRE:h.jv};g=[];for(u=0;u=this.T.length)throw RangeError("Input index "+a+" out of bounds.");if(c>this.T.length)throw RangeError("Reference input "+c+" out of bounds.");var d=this.T[a];this.T.splice(a,1);ac?d-1:c},a.Og)}function Sb(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()){Ob(a,d);break}f++;d=c.call(a,d,e)}}b.nF=function(a){(a=Pb(this,a.target))&&a.isEnabled()&&(this.kb[this.Og]||null)!==a&&(Qb(this),this.Xg(a))};b.fF=function(a){var c=Pb(this,a.target),d;if(d=c)c.isEnabled()&&(c.Xg(!0),Ub(c)),d=void 0;d&&a.preventDefault()}; b.kF=function(){this.focus()};b.mF=function(){this.ta()&&(this.blur(),Qb(this),Ob(this,-1))};b.jt=function(a){return 0!=this.kb.length&&Vb(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1};function Vb(a,c){var d=a.kb[a.Og]||null;if(d&&"function"==typeof d.jt&&d.jt(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case h.g.Ba.Kq:d&&Ub(d);break;case h.g.Ba.Tl:Tb(a);break;case h.g.Ba.zl:Rb(a);break;default:return!1}return!0};h.wo=function(a,c){h.uc.call(this);this.af=a;this.setValue(c);this.ep=!0};h.g.object.W(h.wo,h.uc);b=h.wo.prototype; b.Oa=function(){var a=document.createElement("div");a.id=this.ua();this.hb=a;a.className="goog-menuitem goog-option "+(this.ep?"":"goog-menuitem-disabled ")+(this.$r?"goog-option-selected ":"")+(this.Rk()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.dm){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(Wb(this));h.g.V.ag(a,this.Du||(this.dm?h.g.V.Fi.iC: h.g.V.Fi.hC));h.g.V.Gb(a,h.g.V.State.Nl,this.dm&&this.$r||!1)};function Wb(a){a=a.af;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.cc=a};b.getValue=function(){return this.cc};b.ag=function(a){this.Du=a};function Xb(a,c){if(a.dm){a.$r=c;var d=a.ta();d&&a.isEnabled()&&(c?(h.g.o.Cb(d,"goog-option-selected"),h.g.V.Gb(d,h.g.V.State.Nl,!0)):(h.g.o.Ec(d,"goog-option-selected"),h.g.V.Gb(d,h.g.V.State.Nl,!1)))}} b.Xg=function(a){var c=this.ta();c&&this.isEnabled()&&(a?h.g.o.Cb(c,"goog-menuitem-highlight"):h.g.o.Ec(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.ep};b.md=function(a){this.ep=a;(a=this.ta())&&(this.ep?h.g.o.Ec(a,"goog-menuitem-disabled"):h.g.o.Cb(a,"goog-menuitem-disabled"))};function Ub(a){a.dm&&Xb(a,!a.$r);a.Ew&&a.Ew.call(a.iD,a)}function Yb(a,c,d){a.Ew=c;a.iD=d};h.g.nq={};h.g.nq.Lg=function(a){a=a.ta();var c=h.g.style.Lg(a);c.height=a.scrollHeight;return c};h.g.nq.kD=function(a,c,d){c.left+=d.width;c.right+=d.width;a.left+=d.width;a.right+=d.width};h.Ea={};h.Ea.Wo=null;h.Ea.Kx=null;h.Ea.show=function(a,c,d){h.aa.show(h.Ea,d,null);if(c.length){var e=h.Ea.EG(c,d);h.Ea.Vf(e,a,d);setTimeout(function(){e.ta().focus()},1);h.Ea.Wo=null}else h.Ea.Ca()};h.Ea.EG=function(a,c){var d=new h.Ai;ea(d,c);for(var e=0,f;f=a[e];e++){var g=new h.wo(f.text);ea(g,c);d.Zl(g,d.kb.length,!0);g.md(f.enabled);f.enabled&&Yb(g,function(){h.Ea.Ca();this.yb()},f)}return d}; h.Ea.Vf=function(a,c,d){var e=h.g.bF();c={top:c.clientY+e.top,bottom:c.clientY+e.top,left:c.clientX+e.left,right:c.clientX+e.left};h.Ea.$D(a);var f=h.g.nq.Lg(a);d&&h.g.nq.kD(e,c,f);h.aa.FG(e,c,f,d);a.ta().focus()};h.Ea.$D=function(a){a.za(h.aa.Fa);var c=a.ta();h.g.o.Cb(c,"blocklyContextMenu");h.ma(c,"contextmenu",null,h.g.fG);a.focus()};h.Ea.Ca=function(){h.aa.Hk(h.Ea);h.Ea.Wo=null;h.Ea.Kx&&h.$a(h.Ea.Kx)}; h.Ea.Mo=function(a,c){return function(){h.i.disable();try{var d=h.R.Zi(c,a.v),e=a.Qa();e.x=a.G?e.x-h.td:e.x+h.td;e.y+=2*h.td;d.moveBy(e.x,e.y)}finally{h.i.enable()}h.i.isEnabled()&&!d.cb&&h.i.Ka(new h.i.$n(d));d.select()}};h.Ea.tD=function(a){var c=p(a,!1).length,d=q(a);d&&(c-=p(d,!1).length);return{text:1==c?h.h.DELETE_BLOCK:h.h.DELETE_X_BLOCKS.replace("%1",String(c)),enabled:!0,yb:function(){h.i.$(!0);a.I(!0,!0);h.i.$(!1)}}}; h.Ea.vD=function(a){return{enabled:!("function"==typeof a.ub?!a.ub():!a.ub),text:h.h.HELP,yb:function(){var c="function"==typeof a.ub?a.ub():a.ub;c&&window.open(c)}}};h.Ea.uD=function(a){var c=bb(a.v)?ab(a.v,h.g.Us(a,!0)):!0;return{text:h.h.DUPLICATE_BLOCK,enabled:c,yb:function(){h.Gx(a)}}};h.Ea.sD=function(a){var c={enabled:!h.g.userAgent.og};a.vk?(c.text=h.h.REMOVE_COMMENT,c.yb=function(){a.$f(null)}):(c.text=h.h.ADD_COMMENT,c.yb=function(){a.$f("")});return c}; h.Ea.LL=function(a){return{text:h.h.OK,enabled:!0,yb:function(){h.i.$(!0);a.I(!0,!0);h.i.$(!1)}}};h.Ea.ML=function(a){return{text:h.h.uI,enabled:!0,yb:function(){h.Gx(a)}}}; h.Ea.zM=function(a,c){if(!h.mk)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!h.g.userAgent.og};d.text=h.h.EH;d.yb=function(){var e=new h.mk(a,h.h.DL,h.mk.kB,h.mk.kB),f=ba(a).getBoundingClientRect();f=new h.g.K(c.clientX-f.left,c.clientY-f.top);var g=h.g.Gm(a.pb);f=h.g.K.um(f,g);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.ba&&(e.Ke(),e.za(),e.select())};return d};h.tg=function(a,c){h.tg.w.constructor.call(this,a,c);this.Jf=a.v.Uo[c];this.px=a.v.Uo[h.fk[c]];this.vj=new h.g.K(0,0);this.Ih=!1;this.Hy=!this.Jf};h.g.object.W(h.tg,h.sa);b=h.tg.prototype;b.I=function(){h.tg.w.I.call(this);this.Ih&&Zb(this.Jf,this)};function $b(a,c){var d=a.Wb-c.Wb;a=a.ab-c.ab;return Math.sqrt(d*d+a*a)} function ac(a,c){if(!a.B.v.gc()){var d=I(a.B);if(!d.$b){var e=!1;if(!d.kd()){d=I(c.B);if(!d.kd())return;c=a;e=!0}var f=h.selected==d;f||d.Jo();var g=c.Wb+h.td+Math.floor(Math.random()*h.Bq)-a.Wb,k=c.ab+h.td+Math.floor(Math.random()*h.Bq)-a.ab;e&&(k=-k);d.G&&(g=c.Wb-h.td-Math.floor(Math.random()*h.Bq)-a.Wb);d.moveBy(g,k);f||d.qn()}}}b.moveTo=function(a,c){this.Ih&&Zb(this.Jf,this);this.Wb=a;this.ab=c;this.Hy||bc(this.Jf,this)};b.moveBy=function(a,c){this.moveTo(this.Wb+a,this.ab+c)}; function cc(a,c){a.moveTo(c.x+a.vj.x,c.y+a.vj.y)}function dc(a,c,d){a.vj.x=c;a.vj.y=d}function ec(a){var c=a.ca.Wb-a.Wb,d=a.ca.ab-a.ab;if(0!=c||0!=d){a=z(a);var e=a.ya();if(!e)throw Error("block is not rendered.");e=h.g.He(e);a.ya().setAttribute("transform","translate("+(e.x-c)+","+(e.y-d)+")");Ua(a,-c,-d)}} b.closest=function(a,c){var d=this.px;if(d.fc.length){var e=this.ab,f=this.Wb;this.Wb=f+c.x;this.ab=e+c.y;var g=fc(d,this);c=null;for(var k=a,l,m=g-1;0<=m&&Math.abs(d.fc[m].ab-this.ab)<=a;)l=d.fc[m],this.Cp(l,k)&&(c=l,k=$b(l,this)),m--;for(;gc?!1:h.tg.w.Cp.call(this,a)};b.Pp=function(a){ac(this,a)};b.xs=function(a,c){h.tg.w.xs.call(this,a,c);a.ba&&a.za();c.ba&&(ma(c),c.za())}; b.Bu=function(){var a=this.B,c=this.pf;if(a.v&&c&&h.i.Dc){h.tg.w.Bu.call(this);c=z(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.Ke();c.za(!1);a.ba&&a.za()}};b.lz=function(a){return gc(this.px,this,a)};b.$e=function(a){h.tg.w.$e.call(this,a);var c=this.B;a=a.B;c.ba&&ma(c);a.ba&&ma(a);c.ba&&a.ba&&(this.type==h.jb||this.type==h.Ue?a.za():c.za())};b.sz=function(){this.isConnected()&&!Ea(this,this.ca)&&(A(E(this)?z(this):this.B),this.B.Kb())};h.g.Rect=function(a,c,d,e){this.top=a;this.bottom=c;this.left=d;this.right=e};h.g.Rect.prototype.contains=function(a,c){return a>=this.left&&a<=this.right&&c>=this.top&&c<=this.bottom};h.Id=function(a){this.U=a};b=h.Id.prototype;b.Vw=!0;b.Eo=17;b.Yb=null;b.Kk=null;function hc(a){a.Od||(a.Od=h.g.o.L("g",{"class":"blocklyIconGroup"},null),a.U.$b&&h.g.o.Cb(a.Od,"blocklyIconGroupReadonly"),a.Es(a.Od),a.U.ya().appendChild(a.Od),h.ma(a.Od,"mouseup",a,a.qt),a.ah())}b.I=function(){h.g.o.removeNode(this.Od);this.Od=null;this.Vb(!1);this.U=null};b.ah=function(){};b.isVisible=function(){return!!this.Yb};b.qt=function(a){this.U.v.gc()||this.U.$b||h.g.mj(a)||this.Vb(!this.isVisible())}; b.Qe=function(){this.isVisible()&&this.Yb.Fc(this.U.sh)};function Pa(a,c){a.Kk=c;a.isVisible()&&(a=a.Yb,a.ec=c,a.xu&&eb(a))}function ic(a){var c=a.U.Qa(),d=h.g.He(a.Od);c=new h.g.K(c.x+d.x+a.Eo/2,c.y+d.y+a.Eo/2);h.g.K.Ee(a.Kk,c)||Pa(a,c)};h.Cf=function(a){h.Cf.w.constructor.call(this,a);hc(this);this.kl={}};h.g.object.W(h.Cf,h.Id);h.Cf.prototype.Vw=!1;h.Cf.prototype.Es=function(a){h.g.o.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"},a);h.g.o.L("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},a);h.g.o.L("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},a)}; h.Cf.iH=function(a){var c=h.g.o.L("text",{"class":"blocklyText blocklyBubbleText",y:h.oa.cd},null);a=a.split("\n");for(var d=0;d=a.fc.length)return-1;for(var e=c.ab,f=d;0<=f&&a.fc[f].ab==e;){if(a.fc[f]==c)return f;f--}for(;dc.ab)e=f;else{d=f;break}}return d}function Zb(a,c){if(!c.Ih)throw Error("Connection not in database.");var d=pc(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.Ih=!1;a.fc.splice(d,1)} function gc(a,c,d){function e(n){var t=g-f[n].Wb,u=k-f[n].ab;Math.sqrt(t*t+u*u)<=d&&m.push(f[n]);return uthis.mn){var d=c-this.mn;d=0Object.keys(this.Ae).length&&(this.Ae={},this.mn=0)}!this.Gp||this.gc()?h.Touch.Nu(a)&&h.Zd.w.tp.call(this,a):(a.preventDefault(),a.stopPropagation(),this.I())};b.I=function(){h.Zd.w.I.call(this);this.iu&&h.$a(this.iu)};function qc(a,c){a.Ae[h.Touch.sp(c)]=rc(a,c);var d=Object.keys(a.Ae);2==d.length&&(a.dA=h.g.K.bp(a.Ae[d[0]],a.Ae[d[1]]),a.Gp=!0,c.preventDefault())} function rc(a,c){return a.qc?new h.g.K(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};h.Aw=function(a){this.mu=a;this.Ol=Object.create(null)};b=h.Aw.prototype;b.Ct=null;b.I=function(){this.Ol=this.mu=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=$a(a)))if(a.yc&&a.yc.cancel(),"comment"==c.tagName.toLowerCase()){h.i.disable();try{var d=h.mk.Cm(c),e=parseInt(c.getAttribute("x"),10),f=parseInt(c.getAttribute("y"),10);isNaN(e)||isNaN(f)||(a.G&&(e=-e),d.moveBy(e+50,f+50))}finally{h.i.enable()}d.select()}else a:{h.i.disable();try{var g=h.R.Zi(c,a),k=a.ac.Sb;if(h.Le&&k){h.navigation.Ny(g,k.qa);break a}var l=parseInt(c.getAttribute("x"),10),m=parseInt(c.getAttribute("y"), 10);if(!isNaN(l)&&!isNaN(m)){a.G&&(l=-l);do{c=!1;var n=K(a,!1);d=0;for(var t;t=n[d];d++){var u=t.Qa();if(1>=Math.abs(l-u.x)&&1>=Math.abs(m-u.y)){c=!0;break}}if(!c){var w=g.Fe(!1);d=0;for(var F;F=w[d];d++)if(F.closest(h.td,new h.g.K(l,m)).connection){c=!0;break}}c&&(l=a.G?l-h.td:l+h.td,m+=2*h.td)}while(c);g.moveBy(l,m)}}finally{h.i.enable()}h.i.isEnabled()&&!g.cb&&h.i.Ka(new h.i.$n(g));g.select()}} function zc(a){if((a=a.ke?a.Jj:a)&&!a.yc&&a.ra&&a.ra.P){a=a.ra;var c=a.Bd.Rd;c&&c.Df&&a.P.show(c.Df)}}b.ei=function(a,c){h.lb.w.ei.call(this,a,c);zc(this)};b.Kf=function(a){h.lb.w.Kf.call(this,a);zc(this)};b.Ld=function(a,c,d){a=h.lb.w.Ld.call(this,a,c,d);zc(this);return a};function tc(a){a.ux=a.ad&&a.N.parentNode?a.ad.Em():null;a.tx=a.P?a.P.Em():a.ra?a.ra.Em():null}function Qa(a,c){return a.ux&&a.ux.contains(c.clientX,c.clientY)?h.Iq:a.tx&&a.tx.contains(c.clientX,c.clientY)?h.Dv:h.Cv} b.Xh=function(a){var c=this.Ch(a);c&&sb(c,a,this)};b.Qu=function(a,c){a=h.g.fn(a,x(this),Ba(this));a.x/=this.scale;a.y/=this.scale;this.Fx=h.g.K.um(c,a)};b.gc=function(){return null!=this.yc&&this.yc.gc()};function Ac(a){return a.options.Bc&&a.options.Bc.scrollbars||a.options.Bc&&a.options.Bc.Rj||a.options.Bc&&a.options.Bc.yh||a.options.Hb&&a.options.Hb.controls||a.options.Hb&&a.options.Hb.Rj} b.kd=function(){return this.options.Bc&&this.options.Bc.scrollbars||this.options.Bc&&this.options.Bc.Rj||this.options.Bc&&this.options.Bc.yh||this.options.Hb&&this.options.Hb.Rj}; b.zG=function(a){if(h.Zj.rt())a.preventDefault(),a.stopPropagation();else{var c=this.options.Hb&&this.options.Hb.Rj,d=this.options.Bc&&this.options.Bc.Rj;if(c||d){var e=h.g.ky(a);!c||!a.ctrlKey&&d?(c=this.scrollX-e.x,d=this.scrollY-e.y,a.shiftKey&&!e.x&&(c=this.scrollX-e.y,d=this.scrollY),this.scroll(c,d)):(e=-e.y/50,c=h.g.fn(a,x(this),Ba(this)),this.zoom(c.x,c.y,e));a.preventDefault()}}}; function ka(a){var c=D(a,!1);a=ja(a,!1);c=c.concat(a);if(!c.length)return new h.g.Rect(0,0,0,0);a=lc(c[0]);for(var d=1;da.bottom&&(a.bottom=e.bottom);e.lefta.right&&(a.right=e.right)}return a}b.JD=function(){this.Gc(!1);h.i.$(!0);for(var a=D(this,!0),c=0,d=0,e;e=a[d];d++)if(e.kd()){var f=e.Qa();e.moveBy(-f.x,c-f.y);kc(e);c=e.Qa().y+H(e).height+h.wa.Yq}h.i.$(!1);this.Gc(!0)}; b.yn=function(a){function c(F){if(F.je())w=w.concat(p(F,!1));else{F=F.Ah(!1);for(var U=0;Uw.length?d():h.confirm(h.h.DELETE_ALL_BLOCKS.replace("%1",w.length),function(F){F&&d()})}};e.push(l);this.$w&&this.$w(e);h.Ea.show(a,e,this.G)}};function Aa(a){if(a.options.Nb)Aa(a.options.Nb);else{h.Xm=a;document.activeElement&&document.activeElement.blur();try{x(a).focus()}catch(c){try{x(a).parentNode.setActive()}catch(d){x(a).parentNode.focus()}}}} b.zoom=function(a,c,d){if(!this.ke&&!this.lj){d=Math.pow(this.options.Hb.PG,d);var e=this.scale*d;if(this.scale!=e){e>this.options.Hb.$m?d=this.options.Hb.$m/this.scale:ethis.options.Hb.$m?a=this.options.Hb.$m:this.options.Hb.cn&&ak.sA||k.Rck.tA){l=null;g&&(l=h.i.Zb(),h.i.$(g.group));switch(g.type){case h.i.vl:case h.i.qv:var n=r(f,g.wc);n=I(n);break;case h.i.bo:case h.i.co:n=f.So[g.Gf]||null}if(n){m=lc(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var t=k.lc,u=k.sA-m.height;u=Math.max(t,u);t=h.g.Ha.Ef(t,m.top,u)-m.top;u=k.dc;var w=k.tA-m.width;k.G?u=Math.min(w,u):w=Math.max(u,w);n.moveBy(h.g.Ha.Ef(u, m.left,w)-m.left,t)}g&&(g.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&h.i.$(l))}}});h.il(f);h.aa.Oa();h.D.Oa();h.H.Oa();return f}; h.BF=function(a){var c=a.options,d=x(a);h.ma(d.parentNode,"contextmenu",null,function(e){h.g.Hp(e)||e.preventDefault()});d=h.ma(window,"resize",null,function(){h.oc(!0);h.il(a)});a.bq=d;h.Kh.rD();c.Sk&&(a.ra?a.ra.S(a):a.P&&(a.P.S(a),a.P.show(c.Sk.childNodes),a.P.pc.set(0)));d=h.Ua.Zc;c.Dy&&(d=a.ad.S(d));c.Hb&&c.Hb.controls&&a.Tj.S(d);c.Bc&&c.Bc.scrollbars?(a.Ub=new h.jk(a),a.Ub.resize()):a.ii({x:.5,y:.5});c.sF&&h.Kh.MF(c.ai,a)}; h.Kh.rD=function(){h.uE||(h.ma(document,"scroll",null,function(){for(var a=h.Ib.getAll(),c=0,d;d=a[c];c++)d.Pn&&d.Pn()}),h.ma(document,"keydown",null,h.pG),h.gd(document,"touchend",null,h.Sh),h.gd(document,"touchcancel",null,h.Sh),h.g.userAgent.qg&&h.ma(window,"orientationchange",document,function(){h.il(h.Ab())}));h.uE=!0}; h.Kh.MF=function(a,c){function d(){for(;f.length;)h.$a(f.pop());e.preload()}var e=c.oh;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.ma(document,"mousemove",null,d,!0));f.push(h.ma(document,"touchstart",null,d,!0))};h.uf=function(a){this.name=a};h.F=function(a,c,d){if(!c)throw Error("Cannot create a node without a location.");this.Nn=a;this.Om=h.F.FF(a);this.qa=c;(a=d||null)&&a.zA&&(this.AA=a.zA)};h.F.types={te:"field",Wd:"block",pg:"input",hk:"output",we:"next",ye:"previous",zf:"stack",Li:"workspace"};h.F.jB=-20;h.F.FF=function(a){switch(a){case h.F.types.ye:case h.F.types.we:case h.F.types.pg:case h.F.types.hk:return!0}return!1};h.F.nm=function(a){return new h.F(h.F.types.te,a)}; h.F.If=function(a){return a?a.type==h.Wa||a.type==h.jb&&a.Pf()?h.F.Ti(a.Pf()):a.type==h.jb?new h.F(h.F.types.we,a):a.type==h.Te?new h.F(h.F.types.hk,a):a.type==h.Ue?new h.F(h.F.types.ye,a):null:null};h.F.Ti=function(a){return a?new h.F(h.F.types.pg,a.connection):null};h.F.Eg=function(a){return new h.F(h.F.types.Wd,a)};h.F.om=function(a){return new h.F(h.F.types.zf,a)};h.F.pm=function(a,c){return new h.F(h.F.types.Li,a,{zA:c})};b=h.F.prototype;b.Mb=function(){return this.Nn}; function Cc(a,c){a=a.qa;a instanceof h.Zn||(a=a.B);if(!a||!a.v)return null;var d=I(a);a=D(d.v,!0);for(var e=0,f;f=a[e];e++)if(d.id==f.id)return c=e+(c?1:-1),-1==c||c==a.length?null:h.F.om(a[c]);throw Error("Couldn't find "+(c?"next":"previous")+" stack?!");}function Dc(a){if(!a)return null;do var c=a.Z&&z(a.Z);while(c&&q(c)==a&&(a=c));return(c=a.Z||a.M)&&c.ca&&c.ca.Pf()?h.F.Ti(c.ca.Pf()):h.F.om(a)} b.next=function(){switch(this.Nn){case h.F.types.zf:return Cc(this,!0);case h.F.types.hk:return h.F.Eg(this.qa.B);case h.F.types.te:a:{var a=this.qa,c=a.Pf();var d=a.B;a=c.Pa.indexOf(a)+1;c=d.T.indexOf(c);for(var e;e=d.T[c];c++){for(var f=e.Pa;a1'), e.appendChild(d),c.push(e));if(h.J.variables_get){a.sort(h.Ul.Zw);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.O.Dm(f)),c.push(e)}}return c}; h.O.Wx=function(a){a=a.Kg();var c="";if(a.length)for(var d=1,e=0,f="ijkmnopqrstuvwxyzabcdefgh".charAt(e);!c;){for(var g=!1,k=0;kf?h.aa.ln(a,0,d.height+f):h.aa.ln(a,f,d.height)}; h.aa.zD=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.aa.AD=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};h.VERSION="uncompiled";h.Xm=null;h.selected=null;h.cursor=null;h.Le=!1;h.wm=[];h.fm=null;h.Qo=null;h.ds=null;h.JL=null;h.iA=function(a){return{width:a.Lw,height:a.Jw}};h.lM=function(a){na(a)};h.il=function(a){for(;a.options.Nb;)a=a.options.Nb;var c=x(a),d=c.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.Lw!=e&&(c.setAttribute("width",e+"px"),c.Lw=e);c.Jw!=d&&(c.setAttribute("height",d+"px"),c.Jw=d);a.resize()}}; h.pG=function(a){var c=h.Xm;if(!(h.g.Hp(a)||c.ba&&!c.isVisible()))if(c.options.readOnly)h.navigation.wz(a);else{var d=!1;if(a.keyCode==h.g.Ba.Lq)h.oc(),h.navigation.Wh(h.navigation.uq);else{if(h.navigation.wz(a))return;if(a.keyCode==h.g.Ba.NA||a.keyCode==h.g.Ba.yl){a.preventDefault();if(h.Zj.rt())return;h.selected&&h.selected.je()&&(d=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(h.Zj.rt())return;h.selected&&h.selected.je()&&h.selected.kd()&&(a.keyCode==h.g.Ba.TA?(h.oc(),h.js(h.selected)):a.keyCode!= h.g.Ba.Cw||h.selected.v.ke||(h.js(h.selected),d=!0));a.keyCode==h.g.Ba.TC?h.fm&&(a=h.Qo,a.ke&&(a=a.Jj),h.ds&&ab(a,h.ds)&&(h.i.$(!0),yc(a),h.i.$(!1))):a.keyCode==h.g.Ba.dD&&(h.oc(),c.$u(a.shiftKey))}}d&&!h.selected.v.ke&&(h.i.$(!0),h.oc(),h.selected.I(!0,!0),h.i.$(!1))}};h.js=function(a){if(a.Qy)var c=a.Vu();else{c=h.R.qh(a,!0);h.R.kE(c);var d=a.Qa();c.setAttribute("x",a.G?-d.x:d.x);c.setAttribute("y",d.y)}h.fm=c;h.Qo=a.v;h.ds=a.Qy?null:h.g.Us(a,!0)}; h.Gx=function(a){var c=h.fm,d=h.Qo;h.js(a);yc(a.v);h.fm=c;h.Qo=d};h.jM=function(a){h.g.Hp(a)||a.preventDefault()};h.oc=function(a){h.H.Ca();h.aa.Ca();h.D.Ik();a||(a=h.Ab(),a.ad&&a.ad.P&&a.ad.P.Ca(),a.ra&&a.ra.P&&a.ra.P.pk&&Ec(a.ra.Bd,null))};h.Ab=function(){return h.Xm};h.alert=function(a,c){alert(a);c&&c()};h.confirm=function(a,c){c(confirm(a))};h.prompt=function(a,c,d){d(prompt(a,c))};h.KF=function(a){return function(){P(this,a)}}; h.zk=function(a){for(var c=0;ck[0]?1:g[0]=a.options.length&&(a.style.display= "none")}for(d=1;10>=d;d++)a=document.getElementById("level"+d),c=!!Qc(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(Rc,1)}function Qc(a){var c=Sc;try{var d=window.localStorage[c+a]}catch(e){}return d}function S(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 Tc(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 Uc(a){a%=360;0>a&&(a+=360);return a} function Rc(){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.A={};h.g.A.Va=function(a,c){return" "+a+","+c+" "};h.g.A.curve=function(a,c){return" "+a+c.join("")};h.g.A.moveTo=function(a,c){return" M "+a+","+c+" "};h.g.A.moveBy=function(a,c){return" m "+a+","+c+" "};h.g.A.lineTo=function(a,c){return" l "+a+","+c+" "};h.g.A.line=function(a){return" l"+a.join("")};h.g.A.ea=function(a,c){return" "+a+" "+c+" "};h.g.A.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};h.m.ui=function(){this.yf=0;this.EC=3;this.xf=5;this.Vv=8;this.sd=10;this.rw=this.xf;this.yr=15;this.Rl=5;this.mh=8;this.nC=15;this.mC=4;this.kC=12;this.pB=16;this.wb=8;this.xo=15;this.LC=0;this.MC=20;this.OA=4;this.HC=15;this.IC=100;this.GC=15;this.Xq=24;this.rB=14.5;this.qB=this.yr+11;this.tB=2;this.sB=this.Xq;this.nw=h.g.A.moveBy(0,0);this.PB=12;this.QB=6};b=h.m.ui.prototype; b.S=function(){this.bk=this.Jt();this.ek=this.Kt();this.ug=this.Mt();this.Di=this.Lt();var a=this.wb,c=h.g.A.arc("a","0 0,0",a,h.g.A.Va(-a,a)),d=h.g.A.arc("a","0 0,0",a,h.g.A.Va(a,a));this.Fl={width:a,height:a,nu:c,Sp:d};c=this.wb;a=h.g.A.moveBy(0,c)+h.g.A.arc("a","0 0,1",c,h.g.A.Va(c,-c));c=h.g.A.arc("a","0 0,1",c,h.g.A.Va(-c,-c));this.bw={Yu:a,Tr:c}};b.Jt=function(){var a=this.PB,c=this.QB,d=h.g.A.line([h.g.A.Va(6,3),h.g.A.Va(-12,6),h.g.A.Va(6,3)]);return{height:a,width:c,path:d}}; b.Mt=function(){var a=this.HC,c=this.IC,d=h.g.A.curve("c",[h.g.A.Va(30,-a),h.g.A.Va(70,-a),h.g.A.Va(c,0)]);return{height:a,width:c,path:d}};b.Lt=function(){function a(g){g=g?-1:1;var k=-g,l=d/2,m=h.g.A.Va(c,g*l);return h.g.A.curve("c",[h.g.A.Va(0,g*(l+2.5)),h.g.A.Va(-c,k*(l+.5)),h.g.A.Va(-c,g*l)])+h.g.A.curve("s",[h.g.A.Va(c,2.5*k),m])}var c=this.mh,d=this.yr,e=a(!0),f=a(!1);return{width:c,height:d,Oe:f,kn:e}}; b.Kt=function(){function a(k){return h.g.A.line([h.g.A.Va(k*e,d),h.g.A.Va(3*k,0),h.g.A.Va(k*e,-d)])}var c=this.nC,d=this.mC,e=(c-3)/2,f=a(1),g=a(-1);return{width:c,height:d,$h:f,Dz:g}};h.m.u={NONE:0,te:1,Hv:2,Jv:4,rr:8,pv:16,Nv:32,Gv:64,pg:128,Lv:256,ow:512,cB:1024,ir:2048,Zq:4096,rC:8192,Gq:16384,Uq:32768,Tq:65536,mr:131072,lr:262144,Qv:524288,pr:1048576,Br:2097152,Aq:4194304,Mv:8388608};h.m.u.mJ=h.m.u.Uq|h.m.u.Tq;h.m.u.RK=h.m.u.mr|h.m.u.lr;h.m.u.Yt=16777216;h.m.u.Mb=function(){h.m.u.hasOwnProperty(void 0)||(h.m.u[void 0]=h.m.u.Yt,h.m.u.Yt<<=1);return h.m.u[void 0]};h.m.u.Sm=function(a){return a.type&h.m.u.te};h.m.u.kj=function(a){return a.type&h.m.u.Hv}; h.m.u.Ok=function(a){return a.type&h.m.u.Jv};h.m.u.mf=function(a){return a.type&h.m.u.rr};h.m.u.$L=function(a){return a.type&h.m.u.Nv};h.m.u.lf=function(a){return a.type&h.m.u.pg};h.m.u.Rm=function(a){return a.type&h.m.u.Gv};h.m.u.Lh=function(a){return a.type&h.m.u.Lv};h.m.u.Vm=function(a){return a.type&h.m.u.ow};h.m.u.Qk=function(a){return a.type&h.m.u.ir};h.m.u.Oh=function(a){return a.type&h.m.u.Zq};h.m.u.JF=function(a){return a.type&(h.m.u.ir|h.m.u.Zq)};h.m.u.Nh=function(a){return a.type&h.m.u.Tq}; h.m.u.bM=function(a){return a.type&h.m.u.lr};h.m.u.Um=function(a){return a.type&h.m.u.Uq};h.m.u.cM=function(a){return a.type&h.m.u.mr};h.m.u.ZL=function(a){return a.type&h.m.u.Gq};h.m.u.Ry=function(a){return a.type&h.m.u.Qv};h.m.u.dM=function(a){return a.type&h.m.u.pr};h.m.u.YL=function(a){return a.type&h.m.u.pv};h.m.u.Ip=function(a){return a.type&h.m.u.Br};h.m.u.Bp=function(a){return a.type&h.m.u.Aq};h.m.u.eM=function(a){return a.type&(h.m.u.Br|h.m.u.Aq)};h.m.u.aM=function(a){return a.type&h.m.u.Mv};h.m.gh=function(a){this.height=this.width=0;this.type=h.m.u.NONE;this.rh=this.Ta=0;this.C=a;this.Me=this.C.xo};h.m.sa=function(a,c){h.m.sa.w.constructor.call(this,a);this.hs=c;a:switch(a=this.C,c.type){case h.Wa:case h.Te:c=a.Di;break a;case h.Ue:case h.jb:c=a.ek;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=h.m.u.cB};h.g.object.W(h.m.sa,h.m.gh);h.m.gr=function(a,c){h.m.gr.w.constructor.call(this,a,c);this.type|=h.m.u.rC;this.height=this.shape.height;this.width=this.shape.width;this.Ce=this.C.Rl;this.pe=this.width};h.g.object.W(h.m.gr,h.m.sa); h.m.jr=function(a,c){h.m.jr.w.constructor.call(this,a,c);this.type|=h.m.u.ir;this.height=this.shape.height;this.width=this.shape.width};h.g.object.W(h.m.jr,h.m.sa);h.m.$q=function(a,c){h.m.$q.w.constructor.call(this,a,c);this.type|=h.m.u.Zq;this.height=this.shape.height;this.width=this.shape.width};h.g.object.W(h.m.$q,h.m.sa);h.m.Gl=function(a,c){h.m.Gl.w.constructor.call(this,a,c.connection);this.type|=h.m.u.pg;this.input=c;this.align=c.align;(this.Qi=c.connection&&z(c.connection)?z(c.connection):null)?(a=H(this.Qi),this.im=a.width,this.To=a.height):this.To=this.im=0;this.connection=c.connection;this.Ce=0};h.g.object.W(h.m.Gl,h.m.sa); h.m.dh=function(a,c){h.m.dh.w.constructor.call(this,a,c);this.type|=h.m.u.Lv;this.Qi?(this.width=this.im,this.height=this.To):(this.height=this.C.qB,this.width=this.shape.width+this.C.rB);this.Ce=this.C.Rl;this.jm=this.shape.height;this.vh=this.shape.width};h.g.object.W(h.m.dh,h.m.Gl);h.m.lh=function(a,c){h.m.lh.w.constructor.call(this,a,c);this.type|=h.m.u.ow;this.height=this.Qi?this.To+this.C.LC:this.C.sB;this.width=this.C.xo+this.shape.width};h.g.object.W(h.m.lh,h.m.Gl); h.m.mo=function(a,c){h.m.mo.w.constructor.call(this,a,c);this.type|=h.m.u.Gv;this.height=this.Qi?this.To-2*this.C.Rl:this.shape.height;this.width=this.shape.width+this.C.tB;this.Ce=this.C.Rl;this.jm=this.shape.height;this.vh=this.shape.width};h.g.object.W(h.m.mo,h.m.Gl);h.m.Id=function(a,c){h.m.Id.w.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=h.m.u.Jv;a=new h.g.Ve(h.Id.prototype.Eo,h.Id.prototype.Eo-2);this.height=a.height;this.width=a.width};h.g.object.W(h.m.Id,h.m.gh);h.m.Sq=function(a){h.m.Sq.w.constructor.call(this,a);this.type|=h.m.u.Qv;this.height=this.C.bk.height;this.width=this.C.bk.width};h.g.object.W(h.m.Sq,h.m.gh); h.m.Na=function(a,c){h.m.Na.w.constructor.call(this,a);this.Lx=c;this.jd=c.ng&&!!c.B&&c.B.jd();this.GE=!1;this.type|=h.m.u.te;a=this.Lx.Lg();this.height=a.height;this.width=a.width};h.g.object.W(h.m.Na,h.m.gh);h.m.Pq=function(a){h.m.Pq.w.constructor.call(this,a);this.type|=h.m.u.Hv;this.height=this.C.ug.height;this.width=this.C.ug.width;this.nk=this.height};h.g.object.W(h.m.Pq,h.m.gh); h.m.Ho=function(a,c){h.m.Ho.w.constructor.call(this,a);this.type=(c&&"left"!=c?h.m.u.mr:h.m.u.Uq)|h.m.u.Gq;this.width=this.height=this.C.yf};h.g.object.W(h.m.Ho,h.m.gh);h.m.Do=function(a,c){h.m.Do.w.constructor.call(this,a);this.type=(c&&"left"!=c?h.m.u.lr:h.m.u.Tq)|h.m.u.Gq;this.width=this.C.wb;this.height=this.C.wb/2};h.g.object.W(h.m.Do,h.m.gh);h.m.$j=function(a,c){h.m.$j.w.constructor.call(this,a);this.type=this.type|h.m.u.rr|h.m.u.Nv;this.width=c;this.height=this.C.GC};h.g.object.W(h.m.$j,h.m.gh);h.m.Gi=function(a){this.type=h.m.u.pr;this.elements=[];this.Ta=this.Jc=this.fg=this.minWidth=this.minHeight=this.width=this.height=0;this.By=this.up=this.mt=this.wd=this.cj=!1;this.C=a;this.Me=this.C.xo};h.m.Gi.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function Vc(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(h.m.u.lf(d))return d;return null}h.m.Gi.prototype.Ru=function(){return!0};h.m.Gi.prototype.Jx=function(){return!0}; function Wc(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(h.m.u.mf(d))return d;return null}h.m.lk=function(a){h.m.lk.w.constructor.call(this,a);this.type|=h.m.u.Br;this.nk=this.Ag=0;this.rF=!1;this.connection=null};h.g.object.W(h.m.lk,h.m.Gi);h.m.lk.prototype.nt=function(a){var c=a.Ng?"cap"===a.Ng:h.wa.ug,d=a.Z&&z(a.Z);return!!a.M||c||(d?q(d)==a:!1)}; h.m.lk.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,h.m.u.mf(f)||(h.m.u.kj(f)?d=Math.max(d,f.nk):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.Ag=this.nk=d;this.fg=this.width};h.m.lk.prototype.Ru=function(){return!1};h.m.Uj=function(a){h.m.Uj.w.constructor.call(this,a);this.type|=h.m.u.Aq;this.Cy=!1;this.connection=null;this.Ni=this.tm=0};h.g.object.W(h.m.Uj,h.m.Gi); h.m.Uj.prototype.nt=function(a){return!!a.M||!!q(a)};h.m.Uj.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,h.m.u.mf(f)||(h.m.u.Oh(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.tm=d;this.fg=this.width};h.m.Uj.prototype.Ru=function(){return!1}; h.m.Go=function(a,c,d){h.m.Go.w.constructor.call(this,a);this.type=this.type|h.m.u.rr|h.m.u.pv;this.width=d;this.height=c;this.Ux=!1;this.fg=0;this.elements=[new h.m.$j(this.C,d)]};h.g.object.W(h.m.Go,h.m.Gi);h.m.Go.prototype.measure=function(){};h.m.ak=function(a){h.m.ak.w.constructor.call(this,a);this.type|=h.m.u.Mv;this.bx=0};h.g.object.W(h.m.ak,h.m.Gi); h.m.ak.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.m.u.lf(d)&&(h.m.u.Vm(d)?a+=d.im:h.m.u.Rm(d)&&0!=d.im&&(a+=d.im-d.vh)),h.m.u.mf(d)||(this.height=Math.max(this.height,d.height));this.bx=a;this.fg=this.width+a};h.m.ak.prototype.Jx=function(){return!this.cj&&!this.wd};h.m.jh=function(a,c){this.U=c;this.Ug=a;this.C=this.Ug.C;this.M=c.M?new h.m.gr(this.C,c.M):null;this.wt=Ha(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.Mh=c.Mh();this.G=c.G;this.Gj=this.width=this.ql=this.height=0;this.rows=[];this.Gy=[];this.kc=new h.m.lk(this.C);this.Jb=new h.m.Uj(this.C);this.iq=this.pe=0};b=h.m.jh.prototype; b.measure=function(){var a=this.U.Ng?"cap"===this.U.Ng:h.wa.ug,c=!!this.U.Z;this.kc.nt(this.U)?this.kc.elements.push(new h.m.Ho(this.C)):this.kc.elements.push(new h.m.Do(this.C));a?(a=new h.m.Pq(this.C),this.kc.elements.push(a),this.kc.Ag=a.nk):c&&(this.kc.rF=!0,this.kc.connection=new h.m.jr(this.C,this.U.Z),this.kc.elements.push(this.kc.connection));this.U.T.length&&this.U.T[0].type==h.jb&&!this.U.isCollapsed()?this.kc.minHeight=this.C.sd:this.kc.minHeight=this.C.xf;this.rows.push(this.kc);a=new h.m.ak(this.C); var d=Na(this.U);if(d.length){c=0;for(var e;e=d[c];c++){var f=new h.m.Id(this.C,e);this.isCollapsed&&e.Vw?this.Gy.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.U.T[c];c++)if(d.isVisible()){!e||d.type!=h.jb&&e.type!=h.jb&&(d.type!=h.Wa&&d.type!=h.mg||this.wt)||(this.rows.push(a),a=new h.m.ak(this.C));for(e=0;f=d.Pa[e];e++)a.elements.push(new h.m.Na(this.C,f,d));this.Fw(d,a);e=d}this.isCollapsed&&(a.By=!0,a.elements.push(new h.m.Sq(this.C)));(a.elements.length||a.up)&&this.rows.push(a);this.Jb.Cy= !!this.U.X;this.Jb.minHeight=this.U.T.length&&this.U.T[this.U.T.length-1].type==h.jb?this.C.sd:this.C.xf-1;this.Jb.nt(this.U)?this.Jb.elements.push(new h.m.Ho(this.C)):this.Jb.elements.push(new h.m.Do(this.C));this.Jb.Cy&&(this.Jb.connection=new h.m.$q(this.C,this.U.X),this.Jb.elements.push(this.Jb.connection));this.rows.push(this.Jb);for(a=0;c=this.rows[a];a++){d=c.elements;c.elements=[];c.Ru()&&c.elements.push(new h.m.$j(this.C,this.mp(null,d[0])));for(e=0;ea.xd&&(a.ga+=h.g.A.ea("V",c.Jc+c.height-a.xd)))};h.na.Ei=function(a){this.Ij=a;this.Hn=h.g.o.L("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Ij);this.hl=h.g.o.L("path",{"class":"blocklyPath"},this.Ij);this.Jn=h.g.o.L("path",{"class":"blocklyPathLight"},this.Ij)};h.na.Ei.prototype.Iu=function(a,c){this.hl.setAttribute("d",a);this.Hn.setAttribute("d",a);this.Jn.setAttribute("d",c)}; h.na.Ei.prototype.Qs=function(){this.hl.setAttribute("transform","scale(-1 1)");this.Jn.setAttribute("transform","scale(-1 1)");this.Hn.setAttribute("transform","translate(1,1) scale(-1 1)")};h.na.dh=function(a,c){h.na.dh.w.constructor.call(this,a,c);this.Qi&&(this.width+=this.C.qd,this.height+=this.C.qd)};h.g.object.W(h.na.dh,h.m.dh);h.na.lh=function(a,c){h.na.lh.w.constructor.call(this,a,c);this.Qi&&(this.height+=this.C.qd)};h.g.object.W(h.na.lh,h.m.lh);h.na.jh=function(a,c){h.na.jh.w.constructor.call(this,a,c)};h.g.object.W(h.na.jh,h.m.jh);b=h.na.jh.prototype;b.Fw=function(a,c){this.wt&&a.type==h.Wa?(c.elements.push(new h.na.dh(this.C,a)),c.mt=!0):a.type==h.jb?(c.elements.push(new h.na.lh(this.C,a)),c.wd=!0):a.type==h.Wa?(c.elements.push(new h.m.mo(this.C,a)),c.cj=!0):a.type==h.mg&&(c.up=!0)}; b.mp=function(a,c){if(!a)return c&&h.m.u.Sm(c)&&c.jd?this.C.xf:c&&h.m.u.Lh(c)?this.C.Vv:c&&h.m.u.Vm(c)?this.C.MC:this.C.sd;if(!h.m.u.lf(a)&&!c)return h.m.u.Sm(a)&&a.jd?this.C.xf:h.m.u.Ok(a)?2*this.C.sd+1:h.m.u.kj(a)?this.C.yf:h.m.u.JF(a)?this.C.sd:h.m.u.Nh(a)?this.C.kC:h.m.u.Ry(a)?this.C.yf:this.C.sd;if(h.m.u.lf(a)&&!c){if(h.m.u.Rm(a))return this.C.yf;if(h.m.u.Lh(a))return this.C.sd;if(h.m.u.Vm(a))return this.C.yf}if(!h.m.u.lf(a)&&c&&h.m.u.lf(c)){if(a.jd){if(h.m.u.Lh(c)||h.m.u.Rm(c))return this.C.EC}else{if(h.m.u.Lh(c)|| h.m.u.Rm(c))return this.C.Vv;if(h.m.u.Vm(c))return this.C.sd}return this.C.sd-1}if(h.m.u.Ok(a)&&c&&!h.m.u.lf(c))return this.C.sd;if(h.m.u.Lh(a)&&c&&!h.m.u.lf(c))return c.jd?this.C.xf:this.C.sd;if(h.m.u.Um(a)&&c){if(h.m.u.kj(c))return this.C.yf;if(h.m.u.Qk(c))return c.Me;if(h.m.u.Oh(c))return a=(this.G?1:-1)*this.C.qd/2,c.Me+a}if(h.m.u.Nh(a)&&c){if(h.m.u.Qk(c))return c.Me-this.C.wb;if(h.m.u.Oh(c))return a=(this.G?1:-1)*this.C.qd/2,c.Me-this.C.wb+a}return!h.m.u.lf(a)&&c&&!h.m.u.lf(c)&&a.jd==c.jd||c&& h.m.u.Ry(c)?this.C.sd:this.C.xf};b.Hr=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(h.m.u.mf(e)){d=e;break a}d=null}e=Wc(a);if(a.cj||a.wd)a.fg+=c;var f=Vc(a);f?f.align==h.xq?e.width+=c:f.align==h.jv?(d.width+=c/2,e.width+=c/2):f.align==h.tl&&(d.width+=c):e.width+=c;a.width+=c};b.ny=function(a,c){return h.m.u.Ip(a)&&h.m.u.Bp(c)?this.C.pB:h.m.u.Ip(a)||h.m.u.Bp(c)?this.C.yf:a.cj&&c.cj?this.C.sd:!a.wd&&c.wd?this.C.OA:a.wd&&c.wd||!a.wd&&c.up?this.C.sd:this.C.xf}; b.by=function(a,c){if(h.m.u.mf(c))return a.Jc+c.height/2;if(h.m.u.Bp(a))return a=a.Jc+a.height-a.tm,h.m.u.Oh(c)?a+c.height/2:a-c.height/2;if(h.m.u.Ip(a))return h.m.u.kj(c)?a.Ag-c.height/2:a.Ag+c.height/2;var d=a.Jc;h.m.u.Sm(c)||h.m.u.Ok(c)?(d+=c.height/2,(a.mt||a.wd)&&c.height+this.C.rw<=a.height&&(d+=this.C.rw)):d=h.m.u.Lh(c)?d+c.height/2:d+a.height/2;return d}; b.Mx=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.Jc=c;e.Ta=this.pe;c+=e.height;a=Math.max(a,e.fg);var f=c-this.kc.nk;e==this.Jb&&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},Wt:function(){10>R?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+Ic+"&level="+(R+1):V.wp()},Iy:function(a,c){if(a){var d=a.match(/^block_id_([^']+)$/);d&&(a=d[1])}var e=a;a=C;if(void 0===c){for(var f=0;d= a.Lm[f];f++)d.Xg(!1);a.Lm.length=0}if(d=e?r(a,e):null)(c=void 0===c||c)?-1==a.Lm.indexOf(d)&&a.Lm.push(d):h.g.Ko(a.Lm,d),d.Xg(c)},XL:function(a,c){a=document.getElementById(a);a.firstChild||(a=h.Kh(a,{rtl:-1!=Hc.indexOf(Ic),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),h.R.xh(h.R.li(c),a))},gH:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},Nf:function(a){if("click"==a.type&&"touchend"==V.Nf.uu&&V.Nf.su+2E3>Date.now()||V.Nf.uu==a.type&&V.Nf.su+400>Date.now())return a.preventDefault(), a.stopPropagation(),!0;V.Nf.uu=a.type;V.Nf.su=Date.now();return!1}};V.Nf.uu=null;V.Nf.su=0;V.xF=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};V.yF=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=V;V.setCode=V.Wz;V.getCode=V.Xs;V.getWorkspace=V.Ek;var T={ij:!1,wx:null,Yo:null,fl:function(a,c,d,e,f,g){function k(){T.ij&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);T.ij&&T.ge(!1);h.Ab()&&h.oc(!0);T.ij=!0;T.wx=c;T.Yo=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),T.ss=h.gd(e,"mousedown",null,T.lE));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(T.Th(c,!1,.2),T.Th(l,!0,.8),setTimeout(k,175)):k()},xx:0,yx:0,lE:function(a){T.vs();if(!h.g.mj(a)){var c=document.getElementById("dialog");T.xx=c.offsetLeft-a.clientX;T.yx=c.offsetTop-a.clientY;T.us=h.gd(document,"mouseup",null,T.vs);T.ts=h.gd(document,"mousemove",null,T.mE);a.stopPropagation()}},mE:function(a){var c=document.getElementById("dialog"), d=T.xx+a.clientX;a=T.yx+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"},vs:function(){T.us&&(h.$a(T.us),T.us=null);T.ts&&(h.$a(T.ts),T.ts=null)},ge:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(T.ij){T.vs();T.ss&&(h.$a(T.ss),T.ss=null);T.ij=!1;T.Yo&&T.Yo();T.Yo=null;var d=!1===a? null:T.wx;a=document.getElementById("dialog");var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(T.Th(a,!1,.8),T.Th(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)}},Th: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=T.LE(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},LE:function(a){var c=h.g.style.pp(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},hA:function(a,c){var d=document.getElementById("containerStorage");d.textContent="";c=c.split("\n");for(var e=0;eR?S("Games_nextLevel").replace("%1",String(R+1)):S("Games_finalLevel");c=document.getElementById("doneCancel");c.addEventListener("click", T.ge,!0);c.addEventListener("touchend",T.ge,!0);c=document.getElementById("doneOk");c.addEventListener("click",V.Wt,!0);c.addEventListener("touchend",V.Wt,!0);T.fl(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",T.ax,!0)});document.body.addEventListener("keydown",T.ax,!0);document.getElementById("dialogDoneText").textContent=d},vx:function(a){!T.ij||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(T.ge(!0),a.stopPropagation(),a.preventDefault())}, Pu:function(){document.body.addEventListener("keydown",T.vx,!0)},Su:function(){document.body.removeEventListener("keydown",T.vx,!0)},ax:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)T.ge(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&V.Wt()},Dw:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)T.ge(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&V.wp()},Vx:function(a){27==a.keyCode?T.ge(!0):13==a.keyCode&&T.Ss()},Ss: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?S("Games_submitted"):S("Games_httpRequestError")+"\nStatus: "+f.status;T.hA(null,g)}};f.send(c.join("&"));T.ge(!0)}else a.value="",a.focus()}}; window.BlocklyDialogs=T;T.hideDialog=T.ge;h.Comment=function(a){h.Comment.w.constructor.call(this,a);this.hc=a.Be;this.hc.text=this.hc.text||"";this.Yr="";hc(this)};h.g.object.W(h.Comment,h.Id);b=h.Comment.prototype; b.Es=function(a){h.g.o.L("circle",{"class":"blocklyIconShape",r:"8",cx:"8",cy:"8"},a);h.g.o.L("path",{"class":"blocklyIconSymbol",d:"m6.8,10h2c0.003,-0.617 0.271,-0.962 0.633,-1.266 2.875,-2.4050.607,-5.534 -3.765,-3.874v1.7c3.12,-1.657 3.698,0.118 2.336,1.25-1.201,0.998 -1.201,1.528 -1.204,2.19z"},a);h.g.o.L("rect",{"class":"blocklyIconSymbol",x:"6.8",y:"10.78",height:"2",width:"2"},a)}; b.ks=function(){this.Bm=h.g.o.L("foreignObject",{x:h.oa.cd,y:h.oa.cd},null);var a=document.createElementNS(h.g.o.zi,"body");a.setAttribute("xmlns",h.g.o.zi);a.className="blocklyMinimalBody";var c=this.Lj=document.createElementNS(h.g.o.zi,"textarea");c.className="blocklyCommentTextarea";c.setAttribute("dir",this.U.G?"RTL":"LTR");c.value=this.hc.text;ld(this);a.appendChild(c);this.Bm.appendChild(a);h.ma(c,"mouseup",this,this.cH,!0,!0);h.ma(c,"wheel",this,function(d){d.stopPropagation()});h.ma(c,"change", this,function(){this.Yr!=this.hc.text&&h.i.Ka(new h.i.hg(this.U,"comment",null,this.Yr,this.hc.text))});h.ma(c,"input",this,function(){this.hc.text=c.value});setTimeout(c.focus.bind(c),0);return this.Bm};b.ah=function(){h.Comment.w.ah.call(this);this.isVisible()&&(md(this),nd(this))};b.kG=function(){this.isVisible()&&(this.hc.size=this.Yb.Vs(),ld(this))}; function ld(a){var c=a.hc.size,d=2*h.oa.cd,e=c.width-d;c=c.height-d;a.Bm.setAttribute("width",e);a.Bm.setAttribute("height",c);a.Lj.style.width=e-4+"px";a.Lj.style.height=c-4+"px"}b.Vb=function(a){a!=this.isVisible()&&(h.i.Ka(new h.i.ud(this.U,"commentOpen",!a,a)),(this.hc.pu=a)?nd(this):md(this))}; function nd(a){if(!a.U.jd()||h.g.userAgent.og)h.Cf.prototype.kx.call(a);else{a.Yb=new h.oa(a.U.v,a.ks(),a.U.Td,a.Kk,a.hc.size.width,a.hc.size.height);gb(a.Yb,a.U.id);var c=a.kG.bind(a);a.Yb.zu=c;a.Qe()}}function md(a){a.yj?h.Cf.prototype.Ax.call(a):(a.Yb.I(),a.Yb=null,a.Lj=null,a.Bm=null)}b.cH=function(){hb(this.Yb)&&this.Lj.focus();this.Yr=this.hc.text};b.Vs=function(){return this.hc.size};b.un=function(a,c){this.Yb?this.Yb.un(a,c):(this.hc.size.width=a,this.hc.size.height=c)}; b.Tb=function(){return this.hc.text||""};b.dl=function(a){this.hc.text!=a&&(this.hc.text=a,oc(this))};function oc(a){a.Lj?a.Lj.value=a.hc.text:a.yj&&(a.yj.firstChild.textContent=a.hc.text)}b.I=function(){this.U.vk=null;h.Id.prototype.I.call(this)};h.Da={};h.Da.pd=function(a,c){h.uc.call(this);this.Qc=c;this.af=a;this.zm=this.fq=!1;this.zt=!0;this.qs=-1};h.g.object.W(h.Da.pd,h.uc);h.Da.pd.Ir={};b=h.Da.pd.prototype;b.vm=function(){h.Da.pd.w.vm.call(this);this.Da&&(this.Da=null);this.hb=null}; b.xp=function(){var a=this.ta();if(a){var c=od(this);c&&!c.id&&(c.id=this.ua()+".label");h.g.V.ag(a,h.g.V.Fi.RC);h.g.V.Gb(a,h.g.V.State.Nl,!1);h.g.V.Gb(a,h.g.V.State.TB,this.Ck());c&&h.g.V.Gb(a,h.g.V.State.Rv,c.id);(c=this.Ys())&&h.g.V.ag(c,h.g.V.Fi.uC);if(c=pd(this))if(h.g.V.ag(c,h.g.V.Fi.DB),c.hasChildNodes())for(h.g.V.Gb(a,h.g.V.State.Nq,!1),a=this.kb.length,c=1;c<=a;c++){var d=(this.kb[c-1]||null).ta();h.g.V.Gb(d,h.g.V.State.CC,a);h.g.V.Gb(d,h.g.V.State.tC,c)}}}; b.Oa=function(){var a=document.createElement("div");a.appendChild(qd(this));this.hb=a};b.ff=function(){h.Da.pd.w.ff.call(this);h.Da.pd.Ir[this.ua()]=this;this.xp()};b.zh=function(){h.Da.pd.w.zh.call(this);delete h.Da.pd.Ir[this.ua()]}; b.Zl=function(a,c){var d=this.kb[c-1]||null,e=this.kb[c]||null;h.Da.pd.w.Zl.call(this,a,c);a.Zk=d;a.Xt=e;d?d.Xt=a:this.Ox=a;e&&(e.Zk=a);(c=this.Ie())&&rd(a,c);sd(a,this.Ck()+1);if(c=this.ta())if(this.oq(),h.g.V.Gb(c,h.g.V.State.Nq,this.Ge()),this.Ge()){c=pd(this);a.ta()||a.Oa();var f=a.ta(),g=e&&e.ta();c.insertBefore(f,g);this.Yc&&a.ff();e||(d?d.oq():(h.g.style.Hu(c,!0),this.Dj(this.Ge())))}};b.add=function(a){if(a.getParent())throw Error(h.uc.Error.hr);this.Zl(a,this.kb.length)};b.Ie=function(){return null}; b.Ck=function(){var a=this.qs;0>a&&(a=(a=this.getParent())?a.Ck()+1:0,sd(this,a));return a};function sd(a,c){if(c!=a.qs){a.qs=c;var d=td(a);if(d){var e=ud(a)+"px";a.Rk()?d.style.paddingRight=e:d.style.paddingLeft=e}da(a,function(f){sd(f,c+1)})}}b.contains=function(a){for(;a;){if(a==this)return!0;a=a.getParent()}return!1};b.Ah=function(){var a=[];da(this,function(c){a.push(c)});return a};b.select=function(){var a=this.Ie();a&&Ec(a,this)}; function vd(a,c){if(a.fq!=c){a.fq=c;wd(a);var d=a.ta();d&&(h.g.V.Gb(d,h.g.V.State.Nl,c),c&&(c=a.Ie().ta(),h.g.V.Gb(c,h.g.V.State.iv,a.ua())))}}b.Ge=function(){return this.zm}; b.Dj=function(a){var c=a!=this.zm,d;this.zm=a;var e=this.Ie(),f=this.ta();if(fa(this)){if(!a&&e&&this.contains(e.Rd)&&this.select(),f){if(d=pd(this))h.g.style.Hu(d,a),h.g.V.Gb(f,h.g.V.State.Nq,a),a&&this.Yc&&!d.hasChildNodes()&&(da(this,function(g){d.appendChild(qd(g))}),da(this,function(g){g.ff()}));this.oq()}}else(d=pd(this))&&h.g.style.Hu(d,!1);f&&(this.Ys().className=this.lp());c&&(a?this.Dx():this.Cx())};b.Dx=function(){};b.Cx=function(){};b.toggle=function(){this.Dj(!this.Ge())}; function qd(a){var c=a.Ge()&&fa(a),d=document.createElement("div");d.style.backgroundPosition=xd(a);c||(d.style.display="none");c&&da(a,function(e){d.appendChild(qd(e))});c=document.createElement("div");c.id=a.ua();c.appendChild(yd(a));c.appendChild(d);return c}function ud(a){return Math.max(0,(a.Ck()-1)*a.Qc.Ly)}function yd(a){var c=document.createElement("div");c.className=a.qp();c.style["padding-"+(a.Rk()?"right":"left")]=ud(a)+"px";c.appendChild(zd(a));c.appendChild(Ad(a));return c} b.qp=function(){var a="";this.fq&&(a=" "+(this.Qc.fE||""));return this.Qc.ox+a};function Ad(a){var c=document.createElement("span");c.className=a.Qc.dE||"";c.textContent=a.Tb();return c}function zd(a){var c=document.createElement("span");c.style.display="inline-block";c.className=a.lp();return c}b.lp=function(){throw Error("unimplemented abstract method");};function xd(a){return(a.Xt?(a.Ck()-1)*a.Qc.Ly:"-100")+"px 0"} b.ta=function(){var a=h.Da.pd.w.ta.call(this);a||(this.hb=a=document.getElementById(this.ua()));return a};function td(a){return(a=a.ta())?a.firstChild:null}b.Ys=function(){var a=td(this);return a?a.firstChild:null};function od(a){return(a=td(a))&&a.lastChild?a.lastChild.previousSibling:null}function pd(a){return(a=a.ta())?a.lastChild:null}b.dl=function(a){this.af=a};b.Tb=function(){return this.af};function wd(a){var c=td(a);c&&(c.className=a.qp())} b.oq=function(){var a=pd(this);a&&(a.style.backgroundPosition=xd(this))};b.xz=function(a){"expand"==a.target.getAttribute("type")&&fa(this)?this.zt&&this.toggle():(this.select(),wd(this))};b.uz=function(a){a.preventDefault()};b.fu=function(a){var c=!0;switch(a.keyCode){case h.g.Ba.Co:if(a.altKey)break;c=Bd(this);break;case h.g.Ba.uo:if(a.altKey)break;c=Cd(this);break;case h.g.Ba.zl:c=Dd(this);break;case h.g.Ba.Tl:c=Ed(this);break;default:c=!1}c&&a.preventDefault();return c}; function Dd(a){a:if(fa(a)&&a.Ge())a=a.kb[0]||null;else{for(var c=a,d;c!=a.Ie();){d=c.Xt;if(null!=d){a=d;break a}c=c.getParent()}a=null}a&&a.select();return!0}function Ed(a){var c=a.Zk;if(null!=c)a=Fd(c);else{c=a.getParent();var d=a.Ie();a=c==d||a==d?null:c}a&&a.select();return!0}function Cd(a){if(fa(a)&&a.Ge()&&a.zt)a.Dj(!1);else{var c=a.getParent();a=a.Ie();c&&c!=a&&c.select()}return!0}function Bd(a){return fa(a)?(a.Ge()?(a.kb[0]||null).select():a.Dj(!0),!0):!1} function Fd(a){return a.Ge()&&fa(a)?Fd(a.kb[a.kb.length-1]||null):a}function rd(a,c){a.Da!=c&&(a.Da=c,da(a,function(d){rd(d,c)}))};h.Da.nh=function(a,c,d){this.ra=a;h.Da.pd.call(this,c,d)};h.g.object.W(h.Da.nh,h.Da.pd);b=h.Da.nh.prototype;b.Ie=function(){if(this.Da)return this.Da;var a=this.getParent();return a&&(a=a.Ie())?(rd(this,a),a):null};b.lp=function(){var a=this.Ge(),c=this.BE;if(a&&c)return c;c=this.wF;if(!a&&c)return c;c=this.Qc;if(fa(this)){if(a&&c.mx)return c.Vo+" "+c.mx;if(!a&&c.aE)return c.Vo+" "+c.aE}else if(c.nx)return c.Vo+" "+c.nx;return""}; b.uz=function(){fa(this)&&this.zt?(this.toggle(),this.select()):this.fq?Ec(this.Ie(),null):this.select();wd(this)};b.xz=function(){};b.fu=function(a){if(this.Da.ra.kf){var c={},d=h.g.Ba.zl,e=h.g.Ba.Tl;c[h.g.Ba.Co]=this.Rk()?e:d;c[h.g.Ba.uo]=this.Rk()?d:e;c[h.g.Ba.Tl]=h.g.Ba.uo;c[h.g.Ba.zl]=h.g.Ba.Co;Object.defineProperties(a,{keyCode:{value:c[a.keyCode]||a.keyCode}})}return h.Da.nh.w.fu.call(this,a)};b.Rz=function(){this.Bz&&this.Bz.call(this.ra)};b.Dx=h.Da.nh.prototype.Rz;b.Cx=h.Da.nh.prototype.Rz;h.Da.Ki=function(a,c){this.ra=a;h.Da.pd.call(this,"",c);this.zm=!0;vd(this,!0);this.Rd=this};h.g.object.W(h.Da.Ki,h.Da.pd);b=h.Da.Ki.prototype;b.Ie=function(){return this};b.Ck=function(){return 0};b.hF=function(){this.Tx=!0;var a=this.ta();h.g.o.Cb(a,"focused");this.Rd&&this.Rd.select()};b.eF=function(){this.Tx=!1;var a=this.ta();h.g.o.Ec(a,"focused")};b.hasFocus=function(){return this.Tx};b.Ge=function(){return!0};b.Dj=function(a){this.zm=a}; b.Ys=function(){var a=td(this);return a?a.firstChild:null};b.oq=function(){};b.qp=function(){return h.Da.Ki.w.qp.call(this)+" "+this.Qc.cE};b.lp=function(){var a=this.Ge(),c=this.BE;if(a&&c)return c;c=this.wF;if(!a&&c)return c;c=this.Qc;return a&&c.bE?c.Vo+" "+c.bE:""};function Ec(a,c){if(c!=a.Rd&&(!a.rz||a.rz.call(a.ra,c))){var d=a.Rd;a.Rd&&vd(a.Rd,!1);(a.Rd=c)&&vd(c,!0);a.qz&&a.qz.call(a.ra,d,c)}} b.xp=function(){h.Da.Ki.w.xp.call(this);var a=this.ta();h.g.V.ag(a,h.g.V.Fi.QC);h.g.V.Gb(a,h.g.V.State.Rv,od(this).id)};b.ff=function(){h.Da.Ki.w.ff.call(this);var a=this.ta();a.className=this.Qc.eE;a.setAttribute("hideFocus","true");this.Nr();this.xp()};b.zh=function(){h.Da.Ki.w.zh.call(this);this.rs()};b.Nr=function(){var a=this.ta();a.tabIndex=0;this.nG=h.gd(a,"focus",this,this.hF);this.jG=h.gd(a,"blur",this,this.eF);this.lG=h.ma(a,"click",this,this.lF);this.rG=h.gd(a,"keydown",this,this.iF)}; b.rs=function(){h.$a(this.nG);h.$a(this.jG);h.$a(this.lG);h.$a(this.rG)};b.lF=function(a){var c;a:{for(var d=a.target;null!=d;){if(c=h.Da.pd.Ir[d.id])break a;if(d==this.ta())break;d=d.parentNode}c=null}if(c)switch(a.type){case "mousedown":c.xz(a);break;case "click":c.uz(a)}};b.iF=function(a){var c=!1;if(c=this.Rd&&this.Rd.fu(a)||c)h.g.style.Eu(this.Rd.ta(),this.ta().parentNode),a.preventDefault();return c};b.createNode=function(a){return new h.Da.nh(this.ra,a||"",this.Qc)};h.Ji=function(a){this.s=a;this.G=a.options.G;this.kf=a.options.ie;this.Ia=a.options.Ia;this.Qc={Ly:19,eE:"blocklyTreeRoot",cE:"blocklyHidden",ox:"blocklyTreeRow",dE:"blocklyTreeLabel",Vo:"blocklyTreeIcon",mx:"blocklyTreeIconOpen",nx:"blocklyTreeIconNone",fE:"blocklyTreeSelected"};this.oA={ox:"blocklyTreeSeparator"};this.kf&&(this.Qc.cssTreeRow+=a.G?" blocklyHorizontalTreeRtl":" blocklyHorizontalTree",this.oA.cssTreeRow="blocklyTreeSeparatorHorizontal "+(a.G?"blocklyHorizontalTreeRtl":"blocklyHorizontalTree"), this.Qc.cssTreeIcon="")};b=h.Ji.prototype;b.width=0;b.height=0;b.Tk=null; b.S=function(){var a=this.s,c=x(this.s);this.vc=document.createElement("div");this.vc.className="blocklyToolboxDiv blocklyNonSelectable";this.vc.setAttribute("dir",a.G?"RTL":"LTR");c.parentNode.insertBefore(this.vc,c);c=a.jc;c.subscribe(this.vc,"toolbox","background-color");c.subscribe(this.vc,"toolboxText","color");h.ma(this.vc,"mousedown",this,function(d){h.g.mj(d)||d.target==this.vc?h.oc(!1):h.oc(!0);h.Touch.em()},!1,!0);c={Ig:a.options.Ig,Nb:a,G:a.G,Ne:a.options.Ne,ie:a.ie,Ia:a.options.Ia,Tg:a.options.Tg}; this.P=null;if(a.ie){if(!h.El)throw Error("Missing require for Blockly.HorizontalFlyout");this.P=new h.El(c)}else{if(!h.yg)throw Error("Missing require for Blockly.VerticalFlyout");this.P=new h.yg(c)}h.g.o.gj(this.P.Oa("svg"),x(this.s));this.P.S(a);this.Qc.cleardotPath=a.options.ai+"1x1.gif";this.Qc.cssCollapsedFolderIcon="blocklyTreeIconClosed"+(a.G?"Rtl":"Ltr");Gd(this,a.options.Sk)}; function Gd(a,c){a.Bd&&(a.Bd.I(),a.Tk=null);var d=new h.Da.Ki(a,a.Qc);a.Bd=d;Ec(d,null);d.rz=a.dF;d.qz=a.cF;var e=null;if(c){a.Bd.Df=[];a.kt=!1;e=Hd(a,c,a.Bd,a.s.options.ai);if(a.Bd.Df.length)throw Error("Toolbox cannot have both blocks and categories in the root level.");na(a.s)}d.za(a.vc);e&&Ec(d,e);Id(a);a.position();a.kf&&h.g.V.Gb(a.Bd.ta(),h.g.V.State.qC,"horizontal")} b.dF=function(a){if(a==this.Bd)return!1;this.Tk&&(td(this.Tk).style.backgroundColor="");if(a){var c=a.Gk||"#57e";td(a).style.backgroundColor=c;Id(this,a)}return!0};b.cF=function(a,c){c&&c.Df&&c.Df.length?(this.P.show(c.Df),this.Tk!=c&&this.P.pc.set(0),h.Le&&h.navigation.Gb(h.navigation.xr)):(this.P.Ca(),!h.Le||c instanceof h.Ji.Dr||h.navigation.Gb(h.navigation.Pl));a!=c&&a!=this&&(a=new h.i.ud(null,"category",a&&a.Tb(),c&&c.Tb()),a.tc=this.s.id,h.i.Ka(a));c&&(this.Tk=c)};b.oF=function(){h.il(this.s)}; b.Wh=function(a){var c=this.Bd.Rd;if(!c)return!1;switch(a.name){case h.navigation.bb.ye:return Ed(c);case h.navigation.bb.Bo:return Cd(c);case h.navigation.bb.we:return Dd(c);case h.navigation.bb.po:return Bd(c);default:return!1}};b.I=function(){this.P.I();this.Bd.I();this.s.jc.unsubscribe(this.vc);h.g.o.removeNode(this.vc);this.Tk=this.s=null};b.Qf=function(){return this.width};b.ey=function(){return this.height}; b.position=function(){var a=this.vc;if(a){var c=x(this.s);c=h.iA(c);this.kf?(a.style.left="0",a.style.height="auto",a.style.width=c.width+"px",this.height=a.offsetHeight,this.Ia==h.wg?a.style.top="0":a.style.bottom="0"):(this.Ia==h.vg?a.style.right="0":a.style.left="0",a.style.height=c.height+"px",this.width=a.offsetWidth);this.P.position()}}; function Hd(a,c,d,e){for(var f=null,g=null,k=0,l;l=c.childNodes[k];k++)if(l.tagName)switch(l.tagName.toUpperCase()){case "CATEGORY":var m=h.g.le(l.getAttribute("name"));g=a.Bd.createNode(m);g.Bz=a.oF;g.Df=[];d.add(g);var n=l.getAttribute("custom");n?g.Df=n:(n=Hd(a,l,g,e))&&(f=n);var t=l.getAttribute("categorystyle");if((n=l.getAttribute("colour"))&&t)g.Gk="",console.warn('Toolbox category "'+m+'" can not have both a style and a colour');else if(t){n=a;var u=g;u.vM=t;var w=n.s.rp();t&&w&&((w=w.CD[t])&& w.Lb?Jd(n,w.Lb,u,m):console.warn('Style "'+t+'" must exist and contain a colour value'))}else Jd(a,n,g,m);"true"==l.getAttribute("expanded")?(g.Df.length&&(f=g),g.Dj(!0)):g.Dj(!1);g=l;break;case "SEP":if(g&&"CATEGORY"==g.tagName.toUpperCase()){d.add(new h.Ji.Dr(a.oA));break}case "BLOCK":case "SHADOW":case "LABEL":case "BUTTON":d.Df.push(l),g=l}return f} function Jd(a,c,d,e){c=h.g.le(c);if(null===c||""===c)d.Gk="";else{var f=Number(c);isNaN(f)?(f=h.g.Lb.parse(c))?(d.Gk=f,a.kt=!0):(d.Gk="",console.warn('Toolbox category "'+e+'" has unrecognized colour attribute: '+c)):(d.Gk=h.Ky(f),a.kt=!0)}}function Id(a,c){c=(c||a.Bd).Ah(!1);for(var d=0,e;e=c[d];d++){var f=td(e);if(f){var g=a.kt?"8px solid "+(e.Gk||"#ddd"):"none";a.s.G?f.style.borderRight=g:f.style.borderLeft=g}Id(a,e)}} b.Em=function(){if(!this.vc)return null;var a=this.vc.getBoundingClientRect(),c=a.top,d=c+a.height,e=a.left;a=e+a.width;return this.Ia==h.wg?new h.g.Rect(-1E7,d,-1E7,1E7):this.Ia==h.kk?new h.g.Rect(c,1E7,-1E7,1E7):this.Ia==h.Yd?new h.g.Rect(-1E7,1E7,-1E7,a):new h.g.Rect(-1E7,1E7,e,1E7)};h.Ji.Dr=function(a){h.Da.nh.call(this,null,"",a)};h.g.object.W(h.Ji.Dr,h.Da.nh); h.Ed.register([".blocklyToolboxDelete {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyTreeRoot {","padding: 4px 0;","}",".blocklyTreeRoot:focus {","outline: none;","}",".blocklyTreeRow {", "height: 22px;","line-height: 22px;","margin-bottom: 3px;","padding-right: 8px;","white-space: nowrap;","}",".blocklyHorizontalTree {","float: left;","margin: 1px 5px 8px 0;","}",".blocklyHorizontalTreeRtl {","float: right;","margin: 1px 0 8px 5px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeRow {',"margin-left: 8px;","}",".blocklyTreeRow:not(.blocklyTreeSelected):hover {","background-color: #e4e4e4;","}",".blocklyTreeSeparator {","border-bottom: solid #e5e5e5 1px;","height: 0;","margin: 5px 0;", "}",".blocklyTreeSeparatorHorizontal {","border-right: solid #e5e5e5 1px;","width: 0;","padding: 5px 0;","margin: 0 5px;","}",".blocklyTreeIcon {","background-image: url(<<>>/sprites.png);","height: 16px;","vertical-align: middle;","width: 16px;","}",".blocklyTreeIconClosedLtr {","background-position: -32px -1px;","}",".blocklyTreeIconClosedRtl {","background-position: 0 -1px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedLtr {", "background-position: -32px -17px;","}",".blocklyTreeSelected>.blocklyTreeIconClosedRtl {","background-position: 0 -17px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeIconNone,",".blocklyTreeSelected>.blocklyTreeIconNone {","background-position: -48px -1px;","}",".blocklyTreeLabel {","cursor: default;","font-family: sans-serif;","font-size: 16px;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {", 'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]);h.Cr=function(a){this.s=a;this.Si=[];if(!(0>=this.s.options.Mp)){a={scrollbars:!0,Ig:this.s.options.Ig,Nb:this.s,G:this.s.G,Ne:this.s.options.Ne,Tg:this.s.options.Tg};if(this.s.ie){a.Ia=this.s.Ia==h.wg?h.kk:h.wg;if(!h.El)throw Error("Missing require for Blockly.HorizontalFlyout");this.P=new h.El(a)}else{a.Ia=this.s.Ia==h.vg?h.Yd:h.vg;if(!h.yg)throw Error("Missing require for Blockly.VerticalFlyout");this.P=new h.yg(a)}cb(this.s,this.mG.bind(this))}};b=h.Cr.prototype;b.Vl=47;b.Xn=44;b.ck=16;b.dC=20; b.Tv=20;b.vo=10;b.vr=0;b.wr=32;b.EB=.1;b.xt=!1;b.Np=0;b.N=null;b.kq=null;b.Ft=0;b.Rh=0;b.Wy=0;b.nA=0; b.Oa=function(){this.N=h.g.o.L("g",{"class":"blocklyTrash"},null);var a=String(Math.random()).substring(2);var c=h.g.o.L("clipPath",{id:"blocklyTrashBodyClipPath"+a},this.N);h.g.o.L("rect",{width:this.Vl,height:this.Xn,y:this.ck},c);var d=h.g.o.L("image",{width:h.ik.width,x:-this.vr,height:h.ik.height,y:-this.wr,"clip-path":"url(#blocklyTrashBodyClipPath"+a+")"},this.N);d.setAttributeNS(h.g.o.Mi,"xlink:href",this.s.options.ai+h.ik.url);c=h.g.o.L("clipPath",{id:"blocklyTrashLidClipPath"+a},this.N); h.g.o.L("rect",{width:this.Vl,height:this.ck},c);this.kq=h.g.o.L("image",{width:h.ik.width,x:-this.vr,height:h.ik.height,y:-this.wr,"clip-path":"url(#blocklyTrashLidClipPath"+a+")"},this.N);this.kq.setAttributeNS(h.g.o.Mi,"xlink:href",this.s.options.ai+h.ik.url);h.ma(this.N,"mouseup",this,this.click);h.gd(d,"mouseover",this,this.XF);h.gd(d,"mouseout",this,this.VF);this.Jr();return this.N}; b.S=function(a){0this.Np&&1>this.Rh&&(this.Ft=setTimeout(this.Jr.bind(this),20))};function Kd(a,c){var d=a.s.Ia==h.vg||a.s.ie&&a.s.G;a.kq.setAttribute("transform","rotate("+(d?-c:c)+","+(d?4:a.Vl-4)+","+(a.ck-2)+")")}b.close=function(){Sa(this,!1)}; b.click=function(){if(this.Si.length){for(var a=[],c=0,d;d=this.Si[c];c++)a[c]=h.R.li(d);this.P.show(a)}};b.XF=function(){this.Si.length&&Sa(this,!0)};b.VF=function(){Sa(this,!1)}; b.mG=function(a){if(!(0>=this.s.options.Mp)&&a.type==h.i.Wn&&"shadow"!=a.bu.tagName.toLowerCase()){for(var c=a=a.bu.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.R.Md(a);if(-1==this.Si.indexOf(a)){for(this.Si.unshift(a);this.Si.length>this.s.options.Mp;)this.Si.pop();this.Np=this.EB;Kd(this,45*this.Np)}}};h.xi=function(){h.xi.w.constructor.call(this)};h.g.object.W(h.xi,h.jo);h.xi.prototype.next=function(){var a=this.Sb;if(!a)return null;(a=a.next())&&J(this,a);return a};h.xi.prototype.Mm=function(){return null};h.xi.prototype.Wf=function(){var a=this.Sb;if(!a)return null;(a=a.Wf())&&J(this,a);return a};h.xi.prototype.jn=function(){return null};h.Cl=function(a){a.Uc=this.Hm.bind(this);a.ii=this.Zz.bind(this);this.s=new h.lb(a);this.s.ke=!0;this.s.Fu(new h.xi);this.s.Yz(new h.fh);this.G=!!a.G;this.ml=a.Ia;this.Os=[];this.Lp=[];this.cm=[];this.zd=[];this.ou=[];this.jl=this.s.Ug.C.mh};b=h.Cl.prototype;b.pk=!0;b.Qh=!1;b.Ri=!0;b.wb=8;b.eh=h.Cl.prototype.wb;b.BB=3*h.Cl.prototype.eh;b.CB=3*h.Cl.prototype.eh;b.qr=2;b.rb=0;b.Wc=0;b.xE=70; b.Oa=function(a){this.N=h.g.o.L(a,{"class":"blocklyFlyout",style:"display: none"},null);this.Hc=h.g.o.L("path",{"class":"blocklyFlyoutBackground"},this.N);this.N.appendChild(this.s.Oa());this.s.jc.subscribe(this.Hc,"flyout","fill");this.s.jc.subscribe(this.Hc,"flyoutOpacity","fill-opacity");return this.N}; b.S=function(a){this.Ob=a;this.s.Jj=a;this.pc=new h.Ua(this.s,this.kf,!1,"blocklyFlyoutScrollbar");this.Ca();Array.prototype.push.apply(this.Os,h.ma(this.N,"wheel",this,this.yH));this.pk||(this.gp=this.Ps.bind(this),cb(this.Ob,this.gp));Array.prototype.push.apply(this.Os,h.ma(this.Hc,"mousedown",this,this.Xh));this.s.Ch=this.Ob.Ch.bind(this.Ob);this.s.Sa=this.Ob.Sa;a=this.s;a.bi=new h.Er(a)}; b.I=function(){this.Ca();h.$a(this.Os);this.gp&&(db(this.Ob,this.gp),this.gp=null);this.pc&&(this.pc.I(),this.pc=null);this.s&&(this.s.jc.unsubscribe(this.Hc),this.s.Jj=null,this.s.I(),this.s=null);this.N&&(h.g.o.removeNode(this.N),this.N=null);this.Ob=this.Hc=null};b.Qf=function(){return this.rb};b.ey=function(){return this.Wc};b.Ek=function(){return this.s};b.isVisible=function(){return this.Qh};b.Vb=function(a){var c=a!=this.isVisible();this.Qh=a;c&&this.On()}; b.Bj=function(a){var c=a!=this.Ri;this.Ri=a;c&&this.On()};b.On=function(){var a=this.Ri?this.isVisible():!1;this.N.style.display=a?"block":"none";this.pc.Bj(a)};b.Ca=function(){if(this.isVisible()){this.Vb(!1);for(var a=0,c;c=this.zd[a];a++)h.$a(c);this.zd.length=0;this.ci&&(db(this.s,this.ci),this.ci=null)}}; b.show=function(a){this.s.Gc(!1);this.Ca();Ld(this);if("string"==typeof a){a=this.s.Jj.Xu[a]||null;if("function"!=typeof a)throw TypeError("Couldn't find a callback function when opening a toolbox category.");a=a(this.s.Jj);if(!Array.isArray(a))throw TypeError("Result of toolbox category callback must be an array.");}this.Vb(!0);var c=[],d=[];this.ou.length=0;for(var e=this.kf?this.BB:this.CB,f=0,g;g=a[f];f++)if(g.tagName)switch(g.tagName.toUpperCase()){case "BLOCK":var k=h.R.Zi(g,this.s);k.isEnabled()|| this.ou.push(k);c.push({type:"block",block:k});g=parseInt(g.getAttribute("gap"),10);d.push(isNaN(g)?e:g);break;case "SEP":g=parseInt(g.getAttribute("gap"),10);!isNaN(g)&&0Math.abs(a-c)&&(c+=this.gM*this.Ob.options.Nb.scale));return new h.g.Rect(-1E9,1E9,c,1E9)};function Od(a,c,d,e){var f=W;this.name=a;this.Uw=c;this.fA=d;this.aH=e||0;this.ph=f;this.La=new h.g.K;this.reset();console.log(this+" loaded.")}b=Od.prototype;b.fH=!1;b.cf=!1;b.Ya=0;b.Hg=0;b.facing=0;b.speed=0;b.Lf=0;b.La=null;b.At=0;b.toString=function(){return"["+this.name+"]"}; b.reset=function(){delete this.fH;delete this.cf;delete this.speed;delete this.Lf;delete this.At;this.Ya=this.aH;this.La.x=this.fA.x;this.La.y=this.fA.y;this.facing=this.Hg=Uc(h.g.Ha.ll(Math.atan2(50-this.La.y,50-this.La.x)));var a=this.Uw;if("function"==typeof a)a=a();else if("string"!=typeof a)throw Error("Avatar "+this.name+" has invalid code: "+a);this.EF="Interpreter"in window?new Interpreter(a,this.ph.AF):null};function Pd(a,c){a.Ya+=c;100<=a.Ya&&Qd(a)} function Qd(a){a.speed=0;a.cf=!0;a.Ya=100;a.ph.Ml.unshift(a);a.ph.Se.push({type:"DIE",avatar:a});console.log(a+" sinks.")}b.stop=function(){this.Lf=0};var W={Dd:[],Ml:[],Se:[],dk:[],AB:50,KC:100,xC:.5,bf:null,MA:1,Wv:3,ev:5,$A:5,Dq:3,Ez:0,fp:0,Uu:0,PC:3E5,Cs:null};W.JC=[new h.g.K(10,90),new h.g.K(90,10),new h.g.K(10,10),new h.g.K(90,90),new h.g.K(50,99),new h.g.K(50,1),new h.g.K(1,50),new h.g.K(99,50),new h.g.K(50,49)];W.reset=function(){clearTimeout(W.Ez);W.Se.length=0;W.dk.length=0;W.Ml.length=0;for(var a=W.Uu=0,c;c=W.Dd[a];a++)c.reset()};W.jD=function(a,c,d,e){d||(d=W.JC[W.Dd.length]);a=new Od(a,c,d,e);W.Dd.push(a)}; W.start=function(a){W.Cs=a;W.fp=Date.now()+W.PC;console.log("Starting battle with "+W.Dd.length+" avatars.");W.update()};W.update=function(){W.sH();W.tH();W.rH();W.Dd.length<=W.Ml.length+1&&(W.fp=Math.min(W.fp,Date.now()+1E3));Date.now()>W.fp?W.stop():W.Ez=setTimeout(W.update,1E3/W.AB)};W.stop=function(){for(var a=[],c=0,d;d=W.Dd[c];c++)d.cf||a.push(d);c=a.length;for(a.sort(function(e,f){return e.Ya-f.Ya});a.length;)W.Ml.unshift(a.pop());W.Cs&&W.Cs(c)}; W.tH=function(){for(var a=W.dk.length-1;0<=a;a--){var c=W.dk[a];c.progress+=W.Wv;var d=0;if(c.Wp-c.progressc.Lf&&(c.speed=Math.max(c.speed-W.ev,c.Lf)),0c.La.x||100c.La.y||100d&&(c.La.x-=k,c.La.y-=g,e=Math.max(c.speed,f.speed)/100*W.Dq,Pd(c,e),c.speed=0,c.Lf=0,Pd(f,e),f.speed=0,f.Lf=0,W.Se.push({type:"CRASH",avatar:c,damage:e}),W.Se.push({type:"CRASH",avatar:f,damage:e})))}};W.sH=function(){for(var a=0;ag&&(g+=360);k=e.La.x;for(var l=e.La.y,m=Infinity,n=0,t;t=e.ph.Dd[n];n++)if(t!=e&&!t.cf){var u=t.La.x,w=t.La.y;t=Math.sqrt((w-l)*(w-l)+(u-k)*(u-k));t>=m||(u=Math.atan2(w-l,u-k),u=Uc(h.g.Ha.ll(u)),uk?e=!1:(f.At=k,k=new h.g.K(f.La.x,f.La.y),e=Uc(e),f.facing=e,g=h.g.Ha.Ef(g,0,70),e={qD:f,Cn:k,Hg:e,Wp:g,ym:new h.g.K(k.x+g*Math.cos(h.g.Ha.nd(e)),k.y+g*Math.sin(h.g.Ha.nd(e))),progress:0},f.ph.dk.push(e),f.ph.Se.push({type:"BANG",avatar:f,degree:e.Hg}),e=!0);return e};a.setProperty(c,"cannon", a.createNativeFunction(d));d=function(e,f){var g=W.bf;f=void 0===f||null===f?50:f;if("number"!=typeof e||isNaN(e)||"number"!=typeof f||isNaN(f))throw TypeError;g.Hg!=Uc(e)&&(50>=g.speed?(g.Hg=Uc(e),g.facing=g.Hg):f=0);0==g.speed&&0a.length)){e=[];for(f=0;fthis.tn)return null;var a=this.getOptions(!0)[this.tn][0];return"object"==typeof a?a.alt:a}; h.Ja.qA=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;dthis.an&&h.g.V.Gb(a,h.g.V.State.UC,this.an);return a};h.Tc.register("field_number",h.Gd);h.Hd=function(a,c,d,e,f){this.qj=h.Hd.zE;this.iE=a||"";this.bc=new h.g.Ve(0,h.wa.Yq);f&&this.Kd(f);c&&(this.Oj=c);f||xe(this,d,e)};h.g.object.W(h.Hd,h.Ja);h.Hd.va=function(a){var c=h.g.le(a.variable);return new h.Hd(c,void 0,void 0,void 0,a)};b=h.Hd.prototype;b.s=null;b.Hi=!0;b.Kd=function(a){h.Hd.w.Kd.call(this,a);xe(this,a.variableTypes,a.defaultType)};b.fj=function(){if(!this.Ud){var a=h.O.op(this.B.v,null,this.iE,this.hE);h.i.disable();this.setValue(a.ua());h.i.enable()}}; b.Cm=function(a){var c=a.getAttribute("id"),d=a.textContent,e=a.getAttribute("variabletype")||a.getAttribute("variableType")||"";c=h.O.op(this.B.v,c,d,e);if(null!=e&&e!==c.type)throw Error("Serialized variable type with id '"+c.ua()+"' had type "+c.type+", and does not match variable field that references it: "+h.R.Md(a)+".");this.setValue(c.ua())};b.kA=function(a){this.fj();a.id=this.Ud.ua();a.textContent=this.Ud.name;this.Ud.type&&a.setAttribute("variabletype",this.Ud.type);return a}; b.Lu=function(a){if(a.cb)throw Error("Variable fields are not allowed to exist on shadow blocks.");h.Hd.w.Lu.call(this,a)};b.getValue=function(){return this.Ud?this.Ud.ua():null};b.Tb=function(){return this.Ud?this.Ud.name:""};b.Vc=function(){return this.Ud};b.sy=function(){return this.Ud?this.Oj:null}; b.wh=function(a){if(null===a)return null;var c=h.O.Vc(this.B.v,a);if(!c)return console.warn("Variable id doesn't point to a real variable! ID was "+a),null;c=c.type;var d;a:if(d=ye(this)){for(var e=0;ed;d+=15)h.g.o.L("line",{x1:h.ka.mc+h.ka.sg,y1:h.ka.mc,x2:h.ka.mc+h.ka.sg-(0==d% 45?10:5),y2:h.ka.mc,"class":"blocklyAngleMarks",transform:"rotate("+d+","+h.ka.mc+","+h.ka.mc+")"},a);this.OD=h.ma(a,"click",this,this.tF);this.ND=h.ma(c,"click",this,this.Az,!0,!0);this.$F=h.ma(c,"mousemove",this,this.Az,!0,!0);return a};b.Ms=function(){h.$a(this.OD);h.$a(this.ND);h.$a(this.$F)};b.tF=function(){h.D.Hk(this);h.aa.Ca()}; b.Az=function(a){var c=this.Ts.ownerSVGElement.getBoundingClientRect(),d=a.clientX-c.left-h.ka.mc;a=a.clientY-c.top-h.ka.mc;c=Math.atan(-a/d);isNaN(c)||(c=h.g.Ha.ll(c),0>d?c+=180:0c&&(c+=360);c>a.yA&&(c-=360);return c}h.Ed.register(".blocklyAngleCircle {,stroke: #444;,stroke-width: 1;,fill: #ddd;,fill-opacity: .8;,},.blocklyAngleMarks {,stroke: #444;,stroke-width: 1;,},.blocklyAngleGauge {,fill: #f88;,fill-opacity: .8;,pointer-events: none;,},.blocklyAngleLine {,stroke: #f00;,stroke-width: 2;,stroke-linecap: round;,pointer-events: none;,}".split(",")); h.Tc.register("field_angle",h.ka);h.Generator=function(a){this.dG=a;this.xB=new RegExp(this.ue,"g")};h.Generator.sb="generated_function";b=h.Generator.prototype;b.qo=null;b.Jd=null;b.Oc=null;b.rd=" ";b.aB=60;b.Ao=[]; function kd(){var a=h.j,c=C;c||(console.warn("No workspace specified in workspaceToCode call. Guessing."),c=h.Ab());var d=[];a.S(c);c=D(c,!0);for(var e=0,f;f=c[e];e++){var g=Ce(a,f);Array.isArray(g)&&(g=g[0]);g&&(f.M&&(g=a.Uz(g),a.Jd&&!f.ki&&(g=X(a.Jd,f)+g),a.Oc&&!f.ki&&(g+=X(a.Oc,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 De(a,c){return c+a.replace(/(?!\n$)\n/g,"\n"+c)} function Ce(a,c){if(!c)return"";if(!c.isEnabled())return Ce(a,q(c));var d=a[c.type];if("function"!=typeof d)throw Error('Language "'+a.dG+'" 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.eq(c,d[0],void 0),d[1]]}if("string"==typeof d)return a.Jd&&!c.ki&&(d=X(a.Jd,c)+d),a.Oc&&!c.ki&&(d+=X(a.Oc,c)),a.eq(c,d,void 0);if(null===d)return"";throw SyntaxError("Invalid code generated: "+ d);} function Y(a,c,d){var e=h.j;if(isNaN(d))throw TypeError("Expecting valid order from block: "+a.type);var f=Nb(a,c);if(!f)return"";c=Ce(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?Y(a,c,h.j.gk)||g:e?Y(a,c,h.j.Ll)||g:Y(a,c,f)||g;if(h.Ph(a))a=Number(a)+d,e&&(a=-a);else{if(0d&&(a=a+" - "+-d,k=h.j.gk);e&&(a=d?"-("+a+")":"-"+a,k=h.j.Ll);k=Math.floor(k);f=Math.floor(f);k&&f>=k&&(a="("+a+")")}return a};h.j.Ha={};h.j.math_number=function(a){a=Number(G(a,"NUM"));return[a,0<=a?h.j.Ci:h.j.Ll]};h.j.math_arithmetic=function(a){var c={ADD:[" + ",h.j.ih],MINUS:[" - ",h.j.gk],MULTIPLY:[" * ",h.j.er],DIVIDE:[" / ",h.j.Il],POWER:[null,h.j.Lc]}[G(a,"OP")],d=c[0];c=c[1];var e=Y(a,"A",c)||"0";a=Y(a,"B",c)||"0";return d?[e+d+a,c]:["Math.pow("+e+", "+a+")",h.j.gb]}; h.j.math_single=function(a){var c=G(a,"OP");if("NEG"==c)return a=Y(a,"NUM",h.j.Ll)||"0","-"==a[0]&&(a=" "+a),["-"+a,h.j.Ll];a="SIN"==c||"COS"==c||"TAN"==c?Y(a,"NUM",h.j.Il)||"0":Y(a,"NUM",h.j.Mc)||"0";switch(c){case "ABS":var d="Math.abs("+a+")";break;case "ROOT":d="Math.sqrt("+a+")";break;case "LN":d="Math.log("+a+")";break;case "EXP":d="Math.exp("+a+")";break;case "POW10":d="Math.pow(10,"+a+")";break;case "ROUND":d="Math.round("+a+")";break;case "ROUNDUP":d="Math.ceil("+a+")";break;case "ROUNDDOWN":d= "Math.floor("+a+")";break;case "SIN":d="Math.sin("+a+" / 180 * Math.PI)";break;case "COS":d="Math.cos("+a+" / 180 * Math.PI)";break;case "TAN":d="Math.tan("+a+" / 180 * Math.PI)"}if(d)return[d,h.j.gb];switch(c){case "LOG10":d="Math.log("+a+") / Math.log(10)";break;case "ASIN":d="Math.asin("+a+") / Math.PI * 180";break;case "ACOS":d="Math.acos("+a+") / Math.PI * 180";break;case "ATAN":d="Math.atan("+a+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,h.j.Il]}; h.j.math_constant=function(a){return{PI:["Math.PI",h.j.Rb],E:["Math.E",h.j.Rb],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",h.j.Il],SQRT2:["Math.SQRT2",h.j.Rb],SQRT1_2:["Math.SQRT1_2",h.j.Rb],INFINITY:["Infinity",h.j.Ci]}[G(a,"CONSTANT")]}; h.j.math_number_property=function(a){var c=Y(a,"NUMBER_TO_CHECK",h.j.Kl)||"0",d=G(a,"PROPERTY");if("PRIME"==d){var e=He("mathIsPrime",["function "+h.j.ue+"(n) {"," // https://en.wikipedia.org/wiki/Primality_test#Naive_methods"," if (n == 2 || n == 3) {"," return true;"," }"," // False if n is NaN, negative, is 1, or not whole."," // And false if n is divisible by 2 or 3."," if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {"," return false;"," }"," // Check all the numbers of form 6k +/- 1, up to sqrt(n).", " for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {"," if (n % (x - 1) == 0 || n % (x + 1) == 0) {"," return false;"," }"," }"," return true;","}"])+"("+c+")";return[e,h.j.gb]}switch(d){case "EVEN":e=c+" % 2 == 0";break;case "ODD":e=c+" % 2 == 1";break;case "WHOLE":e=c+" % 1 == 0";break;case "POSITIVE":e=c+" > 0";break;case "NEGATIVE":e=c+" < 0";break;case "DIVISIBLE_BY":a=Y(a,"DIVISOR",h.j.Kl)||"0",e=c+" % "+a+" == 0"}return[e,h.j.aw]}; h.j.math_change=function(a){var c=Y(a,"DELTA",h.j.ih)||"0";a=Q(G(a,"VAR"),h.O.sb);return a+" = (typeof "+a+" == 'number' ? "+a+" : 0) + "+c+";\n"};h.j.math_round=h.j.math_single;h.j.math_trig=h.j.math_single; h.j.math_on_list=function(a){var c=G(a,"OP");switch(c){case "SUM":a=Y(a,"LIST",h.j.Rb)||"[]";a+=".reduce(function(x, y) {return x + y;})";break;case "MIN":a=Y(a,"LIST",h.j.Lc)||"[]";a="Math.min.apply(null, "+a+")";break;case "MAX":a=Y(a,"LIST",h.j.Lc)||"[]";a="Math.max.apply(null, "+a+")";break;case "AVERAGE":c=He("mathMean",["function "+h.j.ue+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]);a=Y(a,"LIST",h.j.Mc)||"[]";a=c+"("+a+")";break;case "MEDIAN":c= He("mathMedian",["function "+h.j.ue+"(myList) {"," var localList = myList.filter(function (x) {return typeof x == 'number';});"," if (!localList.length) return null;"," localList.sort(function(a, b) {return b - a;});"," if (localList.length % 2 == 0) {"," return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;"," } else {"," return localList[(localList.length - 1) / 2];"," }","}"]);a=Y(a,"LIST",h.j.Mc)||"[]";a=c+"("+a+")";break;case "MODE":c=He("mathModes", ["function "+h.j.ue+"(values) {"," var modes = [];"," var counts = [];"," var maxCount = 0;"," for (var i = 0; i < values.length; i++) {"," var value = values[i];"," var found = false;"," var thisCount;"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][0] === value) {"," thisCount = ++counts[j][1];"," found = true;"," break;"," }"," }"," if (!found) {"," counts.push([value, 1]);"," thisCount = 1;"," }"," maxCount = Math.max(thisCount, maxCount);", " }"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][1] == maxCount) {"," modes.push(counts[j][0]);"," }"," }"," return modes;","}"]);a=Y(a,"LIST",h.j.Mc)||"[]";a=c+"("+a+")";break;case "STD_DEV":c=He("mathStandardDeviation",["function "+h.j.ue+"(numbers) {"," var n = numbers.length;"," if (!n) return null;"," var mean = numbers.reduce(function(x, y) {return x + y;}) / n;"," var variance = 0;"," for (var j = 0; j < n; j++) {"," variance += Math.pow(numbers[j] - mean, 2);", " }"," variance = variance / n;"," return Math.sqrt(variance);","}"]);a=Y(a,"LIST",h.j.Mc)||"[]";a=c+"("+a+")";break;case "RANDOM":c=He("mathRandomList",["function "+h.j.ue+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]);a=Y(a,"LIST",h.j.Mc)||"[]";a=c+"("+a+")";break;default:throw Error("Unknown operator: "+c);}return[a,h.j.gb]};h.j.math_modulo=function(a){var c=Y(a,"DIVIDEND",h.j.Kl)||"0";a=Y(a,"DIVISOR",h.j.Kl)||"0";return[c+" % "+a,h.j.Kl]}; h.j.math_constrain=function(a){var c=Y(a,"VALUE",h.j.Lc)||"0",d=Y(a,"LOW",h.j.Lc)||"0";a=Y(a,"HIGH",h.j.Lc)||"Infinity";return["Math.min(Math.max("+c+", "+d+"), "+a+")",h.j.gb]}; h.j.math_random_int=function(a){var c=Y(a,"FROM",h.j.Lc)||"0";a=Y(a,"TO",h.j.Lc)||"0";return[He("mathRandomInt",["function "+h.j.ue+"(a, b) {"," if (a > b) {"," // Swap a and b to ensure a is smaller."," var c = a;"," a = b;"," b = c;"," }"," return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+c+", "+a+")",h.j.gb]};h.j.math_random_float=function(){return["Math.random()",h.j.gb]}; h.j.math_atan2=function(a){var c=Y(a,"X",h.j.Lc)||"0";return["Math.atan2("+(Y(a,"Y",h.j.Lc)||"0")+", "+c+") / Math.PI * 180",h.j.Il]};h.Qb=function(a){h.Qb.w.constructor.call(this,null);this.Nz=a};h.g.object.W(h.Qb,h.Id);b=h.Qb.prototype;b.rl=0;b.Un=0; b.Es=function(a){h.g.o.L("rect",{"class":"blocklyIconShape",rx:"4",ry:"4",height:"16",width:"16"},a);h.g.o.L("path",{"class":"blocklyIconSymbol",d:"m4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 -0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z"},a); h.g.o.L("circle",{"class":"blocklyIconShape",r:"2.7",cx:"8",cy:"8"},a)};b.qt=function(a){this.U.jd()&&h.Id.prototype.qt.call(this,a)}; b.ks=function(){this.Gn=h.g.o.L("svg",{x:h.oa.cd,y:h.oa.cd},null);if(this.Nz.length)for(var a=h.g.xml.createElement("xml"),c=0,d;d=this.Nz[c];c++){var e=h.g.xml.createElement("block");e.setAttribute("type",d);a.appendChild(e)}else a=null;a={disable:!1,Ig:this.U.v.options.Ig,Sk:a,Nb:this.U.v,ai:this.U.v.options.ai,G:this.U.G,Ia:this.U.G?h.vg:h.Yd,ie:!1,Uc:this.WE.bind(this),ii:null,Tg:this.U.v.options.Tg};this.s=new h.lb(a);this.s.lj=!0;cb(this.s,h.i.oE);a=wc(this.s,"g");c=this.s.Oa("blocklyMutatorBackground"); c.insertBefore(a,this.s.pb);this.Gn.appendChild(c);return this.Gn};b.ah=function(){h.Qb.w.ah.call(this);this.U.$b||(this.U.jd()?this.Od&&h.g.o.Ec(this.Od,"blocklyIconGroupReadonly"):(this.Vb(!1),this.Od&&h.g.o.Cb(this.Od,"blocklyIconGroupReadonly")))}; function Ie(a){var c=2*h.oa.cd,d=a.s.pb.getBBox();var e=a.U.G?-d.x:d.width+d.x;d=d.height+3*c;if(a.s.P){var f=a.s.P.Hm();d=Math.max(d,f.ce+20)}e+=3*c;if(Math.abs(a.rl-e)>c||Math.abs(a.Un-d)>c)a.rl=e,a.Un=d,a.Yb.un(e+c,d+c),a.Gn.setAttribute("width",a.rl),a.Gn.setAttribute("height",a.Un);a.U.G&&a.s.pb.setAttribute("transform","translate("+a.rl+",0)");a.s.resize()} b.Vb=function(a){if(a!=this.isVisible())if(h.i.Ka(new h.i.ud(this.U,"mutatorOpen",!a,a)),a){this.Yb=new h.oa(this.U.v,this.ks(),this.U.Td,this.Kk,null,null);gb(this.Yb,this.U.id);if(a=this.s.options.Sk)this.s.P.S(this.s),this.s.P.show(a.childNodes);this.Vg=this.U.Gg(this.s);a=p(this.Vg,!1);for(var c=0,d;d=a[c];c++)d.za();this.Vg.gq(!1);this.Vg.ps=!1;this.s.P?(a=2*this.s.P.wb,c=xc(this.s).Qf()+a):c=a=16;this.U.G&&(c=-c);this.Vg.moveBy(c,a);if(this.U.cq){var e=this;this.U.cq(this.Vg);this.hq=function(){e.U.cq(e.Vg)}; cb(this.U.v,this.hq)}Ie(this);cb(this.s,this.AH.bind(this));this.Qe()}else this.Gn=null,this.s.I(),this.Vg=this.s=null,this.Yb.I(),this.Yb=null,this.Un=this.rl=0,this.hq&&(db(this.U.v,this.hq),this.hq=null)}; b.AH=function(a){if(a.type!=h.i.Io&&(a.type!=h.i.si||"disabled"!=a.element)){if(!this.s.gc()){a=D(this.s,!1);for(var c=0,d;d=a[c];c++){var e=d.Qa(),f=H(d);20>e.y+f.height&&d.moveBy(0,20-f.height-e.y)}}if(this.Vg.v==this.s){h.i.$(!0);d=this.U;a=(a=d.eb())&&h.R.Md(a);c=d.ba;d.ba=!1;d.Dg(this.Vg);d.ba=c;d.Ke();c=(c=d.eb())&&h.R.Md(c);if(a!=c){h.i.Ka(new h.i.hg(d,"mutation",null,a,c));var g=h.i.Zb();setTimeout(function(){h.i.$(g);d.Kb();h.i.$(!1)},h.Yn)}d.ba&&d.za();a!=c&&h.Le&&h.navigation.ZF(d);this.s.gc()|| Ie(this);h.i.$(!1)}}};b.WE=function(){return{Pb:this.Un,Bb:this.rl-xc(this.s).Qf(),fd:0,Pc:this.s.G?0:xc(this.s).Qf()}};b.I=function(){this.U.Pd=null;h.Id.prototype.I.call(this)};h.Qb.$k=function(a,c,d){if(!a||!a.B.v)return!1;d=B(c,d).connection;var e=z(a);return e&&e!=c||d.ca==a?!1:(d.isConnected()&&d.disconnect(),d.connect(a),!0)};h.Qb.Nx=function(a){var c=null;if(a&&a.options){var d=a.options.Nb;a.ke?d&&d.options&&(c=d.options.Nb):d&&(c=d)}return c};h.J.Ht={};h.la.bC={};h.la.bC.oo=260; h.zk([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}", args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value", name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]); h.J.lists_create_with={S:function(){this.ub=h.h.LISTS_CREATE_WITH_HELPURL;M(this,"list_blocks");this.yd=3;this.Ic();this.Ad(!0,"Array");this.ji(new h.Qb(["lists_create_with_item"]));this.Ra(h.h.LISTS_CREATE_WITH_TOOLTIP)},eb:function(){var a=h.g.xml.createElement("mutation");a.setAttribute("items",this.yd);return a},zb:function(a){this.yd=parseInt(a.getAttribute("items"),10);this.Ic()},Gg:function(a){var c=a.Uh("lists_create_with_container");c.Ke();for(var d=B(c,"STACK").connection,e=0;e","GT"],["\u200f\u2265","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation", message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks", tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value", name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]); h.zk([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks", tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]);h.la.ed.Ar={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"};h.Y.register("logic_op_tooltip",h.Y.Lo("OP",h.la.ed.Ar)); h.la.ed.Fq={Nd:0,De:0,ki:!0,eb:function(){if(!this.Nd&&!this.De)return null;var a=h.g.xml.createElement("mutation");this.Nd&&a.setAttribute("elseif",this.Nd);this.De&&a.setAttribute("else",1);return a},zb:function(a){this.Nd=parseInt(a.getAttribute("elseif"),10)||0;this.De=parseInt(a.getAttribute("else"),10)||0;this.IG()},Gg:function(a){var c=a.Uh("controls_if_if");c.Ke();for(var d=c.X,e=1;e<=this.Nd;e++){var f=a.Uh("controls_if_elseif");f.Ke();d.connect(f.Z);d=f.X}this.De&&(a=a.Uh("controls_if_else"), a.Ke(),d.connect(a.Z));return c},Dg:function(a){a=z(a.X);this.De=this.Nd=0;for(var c=[null],d=[null],e=null;a;){switch(a.type){case "controls_if_elseif":this.Nd++;c.push(a.bv);d.push(a.rf);break;case "controls_if_else":this.De++;e=a.rf;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.X&&z(a.X)}this.Ic();this.Oz(c,d,e)},cq:function(a){a=z(a.X);for(var c=1;a;){switch(a.type){case "controls_if_elseif":var d=B(this,"IF"+c),e=B(this,"DO"+c);a.bv=d&&d.connection.ca;a.rf=e&&e.connection.ca; c++;break;case "controls_if_else":e=B(this,"ELSE");a.rf=e&&e.connection.ca;break;default:throw TypeError("Unknown block type: "+a.type);}a=a.X&&z(a.X)}},IG:function(){var a=[null],c=[null],d=null;B(this,"ELSE")&&(d=B(this,"ELSE").connection.ca);for(var e=1;B(this,"IF"+e);){var f=B(this,"DO"+e);a.push(B(this,"IF"+e).connection.ca);c.push(f.connection.ca);e++}this.Ic();this.Oz(a,c,d)},Ic:function(){B(this,"ELSE")&&this.ib("ELSE");for(var a=1;B(this,"IF"+a);)this.ib("IF"+a),this.ib("DO"+a),a++;for(a= 1;a<=this.Nd;a++)L(N(this,"IF"+a).vb("Boolean"),h.h.CONTROLS_IF_MSG_ELSEIF),L(Lb(this,"DO"+a),h.h.CONTROLS_IF_MSG_THEN);this.De&&L(Lb(this,"ELSE"),h.h.CONTROLS_IF_MSG_ELSE)},Oz:function(a,c,d){for(var e=1;e<=this.Nd;e++)h.Qb.$k(a[e],this,"IF"+e),h.Qb.$k(c[e],this,"DO"+e);h.Qb.$k(d,this,"ELSE")}};h.Y.wu("controls_if_mutator",h.la.ed.Fq,null,["controls_if_elseif","controls_if_else"]); h.la.ed.yv=function(){this.Ra(function(){if(this.Nd||this.De){if(!this.Nd&&this.De)return h.h.CONTROLS_IF_TOOLTIP_2;if(this.Nd&&!this.De)return h.h.CONTROLS_IF_TOOLTIP_3;if(this.Nd&&this.De)return h.h.CONTROLS_IF_TOOLTIP_4}else return h.h.CONTROLS_IF_TOOLTIP_1;return""}.bind(this))};h.Y.register("controls_if_tooltip",h.la.ed.yv); h.la.ed.YB={onchange:function(a){this.Yk||(this.Yk=[null,null]);var c=Nb(this,"A"),d=Nb(this,"B");c&&d&&!Ea(c.M,d.M)&&(h.i.$(a.group),a=this.Yk[0],a!==c&&(A(c),a&&!a.cb&&B(this,"A").connection.connect(a.M)),c=this.Yk[1],c!==d&&(A(d),c&&!c.cb&&B(this,"B").connection.connect(c.M)),this.Kb(),h.i.$(!1));this.Yk[0]=Nb(this,"A");this.Yk[1]=Nb(this,"B")}};h.la.ed.XB=function(){this.rj(h.la.ed.YB)};h.Y.register("logic_compare",h.la.ed.XB); h.la.ed.ZB={Kz:null,onchange:function(a){var c=Nb(this,"THEN"),d=Nb(this,"ELSE"),e=this.M.ca;if((c||d)&&e)for(var f=0;2>f;f++){var g=1==f?c:d;g&&!Ea(g.M,e)&&(h.i.$(a.group),e===this.Kz?(A(this),e.B.Kb()):(A(g),g.Kb()),h.i.$(!1))}this.Kz=e}};h.Y.Xp("logic_ternary",h.la.ed.ZB);h.J.PF={};h.la.ve={};h.la.ve.oo=120; h.zk([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1", args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement", name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1", args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null, nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip", "controls_flow_in_loop_check"]}]);h.la.ve.YC={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"};h.Y.register("controls_whileUntil_tooltip",h.Y.Lo("MODE",h.la.ve.YC));h.la.ve.QA={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"};h.Y.register("controls_flow_tooltip",h.Y.Lo("FLOW",h.la.ve.QA)); h.la.ve.gB={Fg:function(a){if(!this.$b){var c=y(this,"VAR").Vc(),d=c.name;if(!this.isCollapsed()&&null!=d){var e={enabled:!0};e.text=h.h.VARIABLES_SET_CREATE_GET.replace("%1",d);c=h.O.Dm(c);d=h.g.xml.createElement("block");d.setAttribute("type","variables_get");d.appendChild(c);e.yb=h.Ea.Mo(this,d);a.push(e)}}}};h.Y.Xp("contextMenu_newGetVariableBlock",h.la.ve.gB);h.Y.register("controls_for_tooltip",h.Y.Wr("%{BKY_CONTROLS_FOR_TOOLTIP}"));h.Y.register("controls_forEach_tooltip",h.Y.Wr("%{BKY_CONTROLS_FOREACH_TOOLTIP}")); h.la.ve.eo={aC:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],ki:!0,qy:function(a){do{if(-1!=h.la.ve.eo.aC.indexOf(a.type))return a;a=Gb(a)}while(a);return null},onchange:function(){this.v.gc&&!this.v.gc()&&(h.la.ve.eo.qy(this)?(this.Yg(null),this.$b||this.md(!0)):(this.Yg(h.h.CONTROLS_FLOW_STATEMENTS_WARNING),this.$b||Kb(this)||this.md(!1)))}};h.Y.Xp("controls_flow_in_loop_check",h.la.ve.eo);h.Kc=function(a,c,d){this.Ow=null;null==a&&(a="FALSE");h.Kc.w.constructor.call(this,a,c,d);this.bc.width=h.Kc.ZC};h.g.object.W(h.Kc,h.Na);h.Kc.va=function(a){return new h.Kc(a.checked,void 0,a)};h.Kc.ZC=15;h.Kc.UA="\u2713";h.Kc.VA=h.Na.wi-3;h.Kc.WA=14;b=h.Kc.prototype;b.Hi=!0;b.Hq="default";b.Sf=!1;b.Kd=function(a){h.Kc.w.Kd.call(this,a);a.checkCharacter&&(this.Ow=a.checkCharacter)}; b.Jh=function(){h.Kc.w.Jh.call(this);this.ic.setAttribute("x",h.Kc.VA);this.ic.setAttribute("y",h.Kc.WA);h.g.o.Cb(this.ic,"blocklyCheckbox");this.Kj.nodeValue=this.Ow||h.Kc.UA;this.ic.style.display=this.cc?"block":"none"};b.qf=function(){this.setValue(!this.cc)};b.wh=function(a){return!0===a||"TRUE"===a?"TRUE":!1===a||"FALSE"===a?"FALSE":null};b.Yi=function(a){this.cc=Je(a);this.ic&&(this.ic.style.display=this.cc?"block":"none")};b.getValue=function(){return this.cc?"TRUE":"FALSE"};b.Tb=function(){return String(Je(this.cc))}; function Je(a){return"string"==typeof a?"TRUE"==a:!!a}h.Tc.register("field_checkbox",h.Kc);h.J.GG={}; h.J.procedures_defnoreturn={S:function(){var a=new h.xb("",h.Ga.Yp);se(a);L(L(L(O(this),h.h.PROCEDURES_DEFNORETURN_TITLE),a,"NAME"),"","PARAMS");this.ji(new h.Qb(["procedures_mutatorarg"]));(this.v.options.hm||this.v.options.Nb&&this.v.options.Nb.options.hm)&&h.h.PROCEDURES_DEFNORETURN_COMMENT&&this.$f(h.h.PROCEDURES_DEFNORETURN_COMMENT);M(this,"procedure_blocks");this.Ra(h.h.PROCEDURES_DEFNORETURN_TOOLTIP);this.ub=h.h.PROCEDURES_DEFNORETURN_HELPURL;this.xa=[];this.Xb=[];this.cg(!0);this.rf=null}, cg:function(a){this.vp!==a&&(a?(L(Lb(this,"STACK"),h.h.PROCEDURES_DEFNORETURN_DO),B(this,"RETURN")&&Mb(this,"STACK","RETURN")):this.ib("STACK",!0),this.vp=a)},Qn:function(){var a="";this.xa.length&&(a=h.h.PROCEDURES_BEFORE_PARAMS+" "+this.xa.join(", "));h.i.disable();try{Jb(this,a,"PARAMS")}finally{h.i.enable()}},eb:function(a){var c=h.g.xml.createElement("mutation");a&&c.setAttribute("name",G(this,"NAME"));for(var d=0;d b.toString() ? 1 : -1; },",' "IGNORE_CASE": function(a, b) {'," return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },"," };"," var compare = compareFuncs[type];", " return function(a, b) { return compare(a, b) * direction; }","}"]);return[c+".slice().sort("+e+'("'+a+'", '+d+"))",h.j.gb]};h.j.lists_split=function(a){var c=Y(a,"INPUT",h.j.Rb),d=Y(a,"DELIM",h.j.Mc)||"''";a=G(a,"MODE");if("SPLIT"==a)c||(c="''"),a="split";else if("JOIN"==a)c||(c="[]"),a="join";else throw Error("Unknown mode: "+a);return[c+"."+a+"("+d+")",h.j.gb]};h.j.lists_reverse=function(a){return[(Y(a,"LIST",h.j.gb)||"[]")+".slice().reverse()",h.j.gb]};h.j.NF={};h.j.controls_if=function(a){var c=0,d="";h.j.Jd&&(d+=X(h.j.Jd,a));do{var e=Y(a,"IF"+c,h.j.Mc)||"false";var f=Ee(a,"DO"+c);h.j.Oc&&(f=De(X(h.j.Oc,a),h.j.rd)+f);d+=(0",GTE:">="}[G(a,"OP")],d="=="==c||"!="==c?h.j.aw:h.j.pC,e=Y(a,"A",d)||"0";a=Y(a,"B",d)||"0";return[e+" "+c+" "+a,d]};h.j.logic_operation=function(a){var c="AND"==G(a,"OP")?"&&":"||",d="&&"==c?h.j.cr:h.j.dr,e=Y(a,"A",d);a=Y(a,"B",d);if(e||a){var f="&&"==c?"true":"false";e||(e=f);a||(a=f)}else a=e="false";return[e+" "+c+" "+a,d]};h.j.logic_negate=function(a){var c=h.j.Jl;return["!"+(Y(a,"BOOL",c)||"true"),c]}; h.j.logic_boolean=function(a){return["TRUE"==G(a,"BOOL")?"true":"false",h.j.Ci]};h.j.logic_null=function(){return["null",h.j.Ci]};h.j.logic_ternary=function(a){var c=Y(a,"IF",h.j.zo)||"false",d=Y(a,"THEN",h.j.zo)||"null";a=Y(a,"ELSE",h.j.zo)||"null";return[c+" ? "+d+" : "+a,h.j.zo]};h.j.PF={};h.j.controls_repeat_ext=function(a){var c=y(a,"TIMES")?String(Number(G(a,"TIMES"))):Y(a,"TIMES",h.j.rg)||"0",d=Ee(a,"DO");d=Fe(d,a);a="";var e=Fc(h.j.Cd,"count",h.O.sb),f=c;c.match(/^\w+$/)||h.Ph(c)||(f=Fc(h.j.Cd,"repeat_end",h.O.sb),a+="var "+f+" = "+c+";\n");return a+("for (var "+e+" = 0; "+e+" < "+f+"; "+e+"++) {\n"+d+"}\n")};h.j.controls_repeat=h.j.controls_repeat_ext; h.j.controls_whileUntil=function(a){var c="UNTIL"==G(a,"MODE"),d=Y(a,"BOOL",c?h.j.Jl:h.j.Mc)||"false",e=Ee(a,"DO");e=Fe(e,a);c&&(d="!"+d);return"while ("+d+") {\n"+e+"}\n"}; h.j.controls_for=function(a){var c=Q(G(a,"VAR"),h.O.sb),d=Y(a,"FROM",h.j.rg)||"0",e=Y(a,"TO",h.j.rg)||"0",f=Y(a,"BY",h.j.rg)||"1",g=Ee(a,"DO");g=Fe(g,a);if(h.Ph(d)&&h.Ph(e)&&h.Ph(f)){var k=Number(d)<=Number(e);a="for ("+c+" = "+d+"; "+c+(k?" <= ":" >= ")+e+"; "+c;c=Math.abs(Number(f));a=(1==c?a+(k?"++":"--"):a+((k?" += ":" -= ")+c))+(") {\n"+g+"}\n")}else a="",k=d,d.match(/^\w+$/)||h.Ph(d)||(k=Fc(h.j.Cd,c+"_start",h.O.sb),a+="var "+k+" = "+d+";\n"),d=e,e.match(/^\w+$/)||h.Ph(e)||(d=Fc(h.j.Cd,c+"_end", h.O.sb),a+="var "+d+" = "+e+";\n"),e=Fc(h.j.Cd,c+"_inc",h.O.sb),a+="var "+e+" = ",a=h.Ph(f)?a+(Math.abs(f)+";\n"):a+("Math.abs("+f+");\n"),a=a+("if ("+k+" > "+d+") {\n")+(h.j.rd+e+" = -"+e+";\n"),a+="}\n",a+="for ("+c+" = "+k+"; "+e+" >= 0 ? "+c+" <= "+d+" : "+c+" >= "+d+"; "+c+" += "+e+") {\n"+g+"}\n";return a}; h.j.controls_forEach=function(a){var c=Q(G(a,"VAR"),h.O.sb),d=Y(a,"LIST",h.j.rg)||"[]",e=Ee(a,"DO");e=Fe(e,a);a="";var f=d;d.match(/^\w+$/)||(f=Fc(h.j.Cd,c+"_list",h.O.sb),a+="var "+f+" = "+d+";\n");d=Fc(h.j.Cd,c+"_index",h.O.sb);e=h.j.rd+c+" = "+f+"["+d+"];\n"+e;return a+("for (var "+d+" in "+f+") {\n"+e+"}\n")}; h.j.controls_flow_statements=function(a){var c="";h.j.Jd&&(c+=X(h.j.Jd,a));h.j.Oc&&(c+=X(h.j.Oc,a));if(h.j.Jd){var d=h.la.ve.eo.qy(a);d&&!d.ki&&(c+=X(h.j.Jd,d))}switch(G(a,"FLOW")){case "BREAK":return c+"break;\n";case "CONTINUE":return c+"continue;\n"}throw Error("Unknown flow statement.");};h.j.GG={};h.j.procedures_defreturn=function(a){var c=Q(G(a,"NAME"),h.Ga.sb),d="";h.j.Jd&&(d+=X(h.j.Jd,a));h.j.Oc&&(d+=X(h.j.Oc,a));d&&(d=De(d,h.j.rd));var e="";h.j.qo&&(e=De(X(h.j.qo,a),h.j.rd));var f=Ee(a,"STACK"),g=Y(a,"RETURN",h.j.Mc)||"",k="";f&&g&&(k=d);g&&(g=h.j.rd+"return "+g+";\n");for(var l=[],m=0;m","GT"],[">=","GTE"]]),"OP");this.$c(!0);var a=this;this.Ra(function(){var c=G(a,"OP");return{EQ:h.h.LOGIC_COMPARE_TOOLTIP_EQ,NEQ:h.h.LOGIC_COMPARE_TOOLTIP_NEQ,LT:h.h.LOGIC_COMPARE_TOOLTIP_LT,LTE:h.h.LOGIC_COMPARE_TOOLTIP_LTE,GT:h.h.LOGIC_COMPARE_TOOLTIP_GT,GTE:h.h.LOGIC_COMPARE_TOOLTIP_GTE}[c]});this.Yk= [null,null]};h.h.LOGIC_OPERATION_AND="&&";h.h.LOGIC_OPERATION_OR="||";h.h.LOGIC_NEGATE_TITLE="! %1";h.h.LOGIC_BOOLEAN_TRUE="true";h.h.LOGIC_BOOLEAN_FALSE="false";h.J.controls_whileUntil.S=function(){P(this,{message0:"while ( %1 ) { %2 %3 }",args0:[{type:"input_value",name:"BOOL",check:"Boolean"},{type:"input_dummy"},{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:h.h.LOOPS_HUE,tooltip:h.h.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE,helpUrl:h.h.CONTROLS_WHILEUNTIL_HELPURL})}; h.J.controls_for.S=function(){P(this,{message0:"for (var %1 = %2; %3 < %4; %5 += 1) { %6 %7 }",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"field_label",name:"VAR1",text:"?"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"field_label",name:"VAR2",text:"?"},{type:"input_dummy"},{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:h.h.LOOPS_HUE,helpUrl:h.h.CONTROLS_FOR_HELPURL}); var a=this;this.Ra(function(){return h.h.CONTROLS_FOR_TOOLTIP.replace("%1",G(a,"VAR"))})};h.J.controls_for.onchange=function(){var a=y(this,"VAR").Tb();Jb(this,a,"VAR1");Jb(this,a,"VAR2")};h.j.controls_for=function(a){var c=Q(G(a,"VAR"),h.O.sb),d=Y(a,"FROM",h.j.rg)||"0",e=Y(a,"TO",h.j.rg)||"0",f=Ee(a,"DO");f=Fe(f,a.id);return"for (var "+c+" = "+d+"; "+c+" < "+e+"; "+c+" += 1) {\n"+f+"}\n"};h.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="break ;";h.h.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="continue ;"; h.J.math_arithmetic.S=function(){P(this,{message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["+","ADD"],["-","MINUS"],["*","MULTIPLY"],["/","DIVIDE"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",colour:h.h.MATH_HUE,helpUrl:h.h.MATH_ARITHMETIC_HELPURL});var a=this;this.Ra(function(){var c=G(a,"OP");return{ADD:h.h.MATH_ARITHMETIC_TOOLTIP_ADD,MINUS:h.h.MATH_ARITHMETIC_TOOLTIP_MINUS,MULTIPLY:h.h.MATH_ARITHMETIC_TOOLTIP_MULTIPLY, DIVIDE:h.h.MATH_ARITHMETIC_TOOLTIP_DIVIDE}[c]})};h.J.math_change.S=function(){P(this,{message0:"%1 += %2;",args0:[{type:"field_variable",name:"VAR",variable:"name"},{type:"input_value",name:"DELTA",check:"Number"}],inputsInline:!0,previousStatement:null,nextStatement:null,colour:h.h.VARIABLES_HUE,helpUrl:h.h.MATH_CHANGE_HELPURL});var a=this;this.Ra(function(){return h.h.MATH_CHANGE_TOOLTIP.replace("%1",G(a,"VAR"))})}; h.j.math_change=function(a){var c=Y(a,"DELTA",h.j.ih)||"0";return Q(G(a,"VAR"),h.O.sb)+" += "+c+";\n"};h.J.math_random_int.S=function(){P(this,{message0:"%1(%2,%3)",args0:["Math.randomInt",{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",colour:h.h.MATH_HUE,tooltip:h.h.MATH_RANDOM_INT_TOOLTIP,helpUrl:h.h.MATH_RANDOM_INT_HELPURL})};h.h.MATH_RANDOM_FLOAT_TITLE_RANDOM="Math.random ( )";h.h.LISTS_CREATE_EMPTY_TITLE="[ ]"; h.h.LISTS_CREATE_WITH_INPUT_WITH="[";h.J.lists_create_with.Ic=function(){B(this,"TAIL")&&this.ib("TAIL");this.yd&&B(this,"EMPTY")?this.ib("EMPTY"):this.yd||B(this,"EMPTY")||L(O(this,"EMPTY"),h.h.LISTS_CREATE_EMPTY_TITLE);for(var a=0;a":">","\t":" ","\n":" ","\x0B":" ","\f":" ","\r":" "," ":" ","-":"-","/":"/","=":"=","`":"`","\u0085":"…","\u00a0":" ","\u2028":"
","\u2029":"
"};function bf(a){return cf[a]}var af=/[\x00\x22\x26\x27\x3c\x3e]/g;function df(){return'
'};function ef(){for(var a=Ic,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
Busque inimigos. Especifique uma dire\u00e7\u00e3o(0-360). \\nRetorna a distancia do inimigo mais proximo \\nnaquela dire\u00e7\u00e3o. Retorna infinito se nenhum \\ninimigo for encontrado. Dispare o canh\u00e3o. Especifique uma dire\u00e7\u00e3o \\n(0-360) e o alcance (0-70). Nadar para a frente. Especifique uma dire\u00e7\u00e3o \\n(0-360). Parar de nadar. O jogador fara uma parada lenta. Retorna a saude atual do jogador (0 esta morto, \\n100 esta saud\u00e1vel). Retorna a velocidade atual do jogador (0 esta \\npar\u00e1do, 100 esta na velocidade maxima) Retorna a coordenada X do jogador (0 \u00e9 a margem \\nesquerda, 100 \u00e9 a margem direita). Retorna a coordenada Y do jogador (0 \u00e9 a borda \\ninferior, 100 \u00e9 a borda superior).
JogadorAlvoPenduloAssustado

'+ ((Kc?'':'')+"Jogos do Blockly : "+Z({appName:"Tutor de Lagoa"}.appName)+""),d="   ",e=1;11>e;e++)d+=" "+(e==R?''+Z(e)+"":10==e?''+Z(e)+"":'');a=c+d+'

  
'; switch(R){case 1:case 3:case 5:case 7:case 9:a+='
';break;case 2:case 4:case 6:case 8:case 10:a+='
'}return a+='\n\n\n\n\n\n
Parab\u00e9ns!
'+ (df()+"
")+(5==R||6==R?'
Sua solu\u00e7\u00e3o funciona, mas voc\u00ea pode fazer melhor. Use \'scan\' para mostrar ao canh\u00e3o o qu\u00e3o longe atirar.
'+df()+"
":"")+'
'+(1==R||2==R?"Use o comando 'cannon' para atingir o alvo. O primeiro par\u00e2metro \u00e9 o \u00e2ngulo, o segundo \u00e9 o alcance. Ache a combina\u00e7\u00e3o correta."+ (1==R?'

0\u00b070cannon(,);': 2==R?"
cannon(0, 70);
":""):3==R||4==R?"Este alvo deve ser acertado v\u00e1rias vezes. Use o ciclo 'while (true)' para fazer algo indefinidamente."+(3==R?'

while () {}true \u25be': 4==R?"
while (true) {\n  ...\n}
":""):5==R||6==R?"Esse oponente move-se para frente e para tr\u00e1s, fazendo ficar dif\u00edcil acert\u00e1-lo. A Express\u00e3o 'scan' retorna o alcance exato do oponente naquela dire\u00e7\u00e3o."+(5==R?'

0\u00b0scan()

': 6==R?"
scan(0)
":"")+"Este alcance \u00e9 exatamente o que o comando 'cannon' precisa para atirar precisamente.":7==R||8==R?"Esse oponente est\u00e1 muito longe para usar o canh\u00e3o (que tem um alcance de 70 metros). Inv\u00e9s disso, use o comando 'swim' para come\u00e7ar a nadar at\u00e9 o oponente e trombar nele."+(7==R?'

0\u00b0swim();': 8==R?"
swim(0);
":""):9==R?"Este oponente tamb\u00e9m est\u00e1 muito longe para usar o canh\u00e3o. Mas voc\u00ea est\u00e1 muito fraco para sobreviver \u00e0 uma colis\u00e3o. Nade at\u00e9 o oponente enquanto sua posi\u00e7\u00e3o horizontal for menor que 50. Ent\u00e3o 'pare' e use o canh\u00e3o."+(9==R?'

< \u25be50getX()

stop();': 10==R?"
getX() < 50
stop();
":""):10==R?"Este oponente ir\u00e1 se mover para longe quando golpeado. Nade at\u00e9 ele se est\u00e1 fora do alcance (70 metros).":"")+"
"+df()+"
"};var Sc="pond-tutor"; window.addEventListener("load",function(){document.body.innerHTML=ef();V.S();$d();Tc("runButton",me);Tc("resetButton",oe);Tc("docsButton",ke);Tc("closeDocs",le);setTimeout(V.xF,1);setTimeout(V.yF,1);Tc("helpButton",re);2>location.hash.length&&!Qc(R)&&setTimeout(re,1E3);var a=-1!=Hc.indexOf(Ic),c=document.getElementById("blockly"),d=document.getElementById("editor"),e=document.getElementById("visualization");if(c){var f=function(){c.style.top=Math.max(10,e.offsetTop-window.pageYOffset)+"px";c.style.left= a?"10px":"420px";c.style.width=window.innerWidth-440+"px"};window.addEventListener("scroll",function(){f(null);h.il(C)});f(null);var g=document.getElementById("toolbox");C=h.Kh("blockly",{media:"third-party/blockly/media/",rtl:!1,toolbox:g,trashcan:!0});Ge("scan,cannon,drive,swim,stop,speed,damage,health,loc_x,getX,loc_y,getY,");V.Zy(7==R?'0': '070')}if(d){g=document.getElementById("containerCode");g.parentNode.removeChild(g);g=8==R?"swim(0);":"cannon(0, 70);";V.ef=window.ace.edit("editor");V.ef.setTheme("ace/theme/chrome"); V.ef.setShowPrintMargin(!1);var k=V.ef.getSession();k.setMode("ace/mode/javascript");k.setTabSize(2);k.setUseSoftTabs(!0);V.Zy(g+"\n");f=function(){d.style.top=Math.max(10,e.offsetTop-window.pageYOffset)+"px";d.style.left=a?"10px":"420px";d.style.width=window.innerWidth-440+"px"};window.addEventListener("scroll",f)}window.addEventListener("resize",f);f(null);for(k=0;g=ff[k];k++){var l=g.code?document.getElementById(g.code).textContent:c?function(){return kd()}:function(){return V.ef.getValue()},m= S(g.name);W.jD(m,l,g.start,g.Ya)}W.reset();be()}); var ff=[void 0,[{start:new h.g.K(50,30),Ya:0,name:"Pond_playerName",code:null},{start:new h.g.K(50,70),Ya:99,name:"Pond_targetName",code:"playerTarget"}],[{start:new h.g.K(70,50),Ya:0,name:"Pond_playerName",code:null},{start:new h.g.K(20,50),Ya:99,name:"Pond_targetName",code:"playerTarget"}],[{start:new h.g.K(20,20),Ya:0,name:"Pond_playerName",code:null},{start:new h.g.K(62.4264,62.4264),Ya:0,name:"Pond_targetName",code:"playerTarget"}],[{start:new h.g.K(50,80),Ya:0,name:"Pond_playerName",code:null}, {start:new h.g.K(50,20),Ya:0,name:"Pond_targetName",code:"playerTarget"}],[{start:new h.g.K(90,50),Ya:0,name:"Pond_playerName",code:null},{start:new h.g.K(50,50),Ya:0,name:"Pond_pendulumName",code:"playerPendulum"}],[{start:new h.g.K(10,50),Ya:0,name:"Pond_playerName",code:null},{start:new h.g.K(50,50),Ya:0,name:"Pond_pendulumName",code:"playerPendulum"}],[{start:new h.g.K(20,80),Ya:0,name:"Pond_playerName",code:null},{start:new h.g.K(80,20),Ya:99,name:"Pond_targetName",code:"playerTarget"}],[{start:new h.g.K(50, 90),Ya:0,name:"Pond_playerName",code:null},{start:new h.g.K(50,10),Ya:99,name:"Pond_pendulumName",code:"playerPendulum"}],[{start:new h.g.K(5,50),Ya:99,name:"Pond_playerName",code:null},{start:new h.g.K(95,50),Ya:0,name:"Pond_targetName",code:"playerTarget"}],[{start:new h.g.K(10,10),Ya:50,name:"Pond_playerName",code:null},{start:new h.g.K(40,40),Ya:0,name:"Pond_scaredName",code:"playerScared"}]][R]; ie=function(a){clearTimeout(Yd);0!=a&&1==a&&"function"==typeof W.Ml[0].Uw&&((5==R||6==R)&&2E5