// Automatically generated file. Do not edit! 'use strict';var b,h={g:{}};h.g.Vb={};h.g.Vb.Sg=function(a){return a*Math.PI/180};h.g.Vb.cA=function(a){return 180*a/Math.PI};h.g.Vb.Ni=function(a,c,d){if(dc&&(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.Ga.Rp=function(a,c,d){for(var e=[0],f=[],g=0;ge&&(e=l,f=k)}return f?h.g.Ga.Du(a,f,d):c};h.g.Ga.nA=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.Ga.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.Np(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.He.ou.charAt(Math.random()*a);return c.join("")}; h.g.He.ou="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; h.g.vg=function(){if(void 0!==h.g.vg.yn)return h.g.vg.yn;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.vg.yn="none"!==c;return h.g.vg.yn};h.g.du=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.sy=function(){var a=h.g.style.Qs();return{right:document.documentElement.clientWidth+a.x,bottom:document.documentElement.clientHeight+a.y,top:a.y,left:a.x}}; h.g.Hi=function(a,c){c=a.indexOf(c);if(-1==c)return!1;a.splice(c,1);return!0};h.g.jy=function(){var a=document.documentElement,c=window;return h.g.userAgent.Xe&&c.pageYOffset!=a.scrollTop?new h.g.M(a.scrollLeft,a.scrollTop):new h.g.M(c.pageXOffset||a.scrollLeft,c.pageYOffset||a.scrollTop)};h.g.Cs=function(a){var c=Object.create(null),d=p(a,!0);if(a=t(a))a=d.indexOf(a),d.splice(a,d.length-a);a=0;for(var e;e=d[a];a++)c[e.type]?c[e.type]++:c[e.type]=1;return c}; h.g.Lz=function(a,c){var d=c.x;c=c.y;var e=aa(a).getBoundingClientRect();d=new h.g.M(d-e.left,c-e.top);c=h.g.lo(a.kb);return h.g.M.bl(d,c).scale(1/a.scale)};h.i={};h.i.Us="";h.i.Mb=!0;h.i.Pn=0;h.i.yk="create";h.i.aq=h.i.yk;h.i.pi="delete";h.i.BA=h.i.pi;h.i.ni="change";h.i.AA=h.i.ni;h.i.yi="move";h.i.bq=h.i.yi;h.i.lr="var_create";h.i.mr="var_delete";h.i.nr="var_rename";h.i.jn="ui";h.i.wk="comment_create";h.i.iq="comment_delete";h.i.hq="comment_change";h.i.xk="comment_move";h.i.qv="finished_loading";h.i.Uu=[h.i.aq,h.i.bq,h.i.wk,h.i.xk];h.i.ri=[];h.i.Ma=function(a){h.i.isEnabled()&&(h.i.ri.length||setTimeout(h.i.Nx,0),h.i.ri.push(a))}; h.i.Nx=function(){for(var a=h.i.filter(h.i.ri,!0),c=h.i.ri.length=0,d;d=a[c];c++)if(d.Ib){var e=h.ab.io(d.Ib);if(e){var f=d;if(f.Mb)for(e.Ug.push(f),e.Pj.length=0;e.Ug.length>e.Hq&&0<=e.Hq;)e.Ug.shift();for(var g=0;d=e.Bj[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.Mh()){var k=[g.type,g.Tb,g.Ib].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.yi&&l.index==f-1)m.Dg=g.Dg,m.Cg=g.Cg,m.wf=g.wf,l.index=f;else if(g.type==h.i.ni&&g.element==m.element&&g.name==m.name)m.newValue=g.newValue;else if(g.type!=h.i.jn||"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.Mh()});c||a.reverse();for(f=1;g=a[f];f++)g.type==h.i.ni&&"mutation"==g.element&&a.unshift(a.splice(f,1)[0]);return a};h.i.bx=function(){for(var a=0,c;c=h.i.ri[a];a++)c.Mb=!1};h.i.disable=function(){h.i.Pn++};h.i.enable=function(){h.i.Pn--};h.i.isEnabled=function(){return 0==h.i.Pn};h.i.ub=function(){return h.i.Us};h.i.ca=function(a){h.i.Us="boolean"==typeof a?a?h.g.He():"":a}; h.i.Fs=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.oa=function(a){switch(a.type){case h.i.yk:var c=new h.i.Ed(null);break;case h.i.pi:c=new h.i.Fd(null);break;case h.i.ni:c=new h.i.We(null,"","","","");break;case h.i.yi:c=new h.i.Qf(null);break;case h.i.lr:c=new h.i.nd(null);break;case h.i.mr:c=new h.i.od(null);break;case h.i.nr:c=new h.i.Md(null,"");break;case h.i.jn:c=new h.i.Qc(null,"","","");break;case h.i.wk:c=new h.i.oe(null);break;case h.i.hq:c=new h.i.dh(null,"","");break;case h.i.xk:c=new h.i.Lf(null);break;case h.i.iq:c=new h.i.pe(null); break;default:throw Error("Unknown event type.");}c.oa(a);c.Ib=(void 0).id;return c};h.i.JE=function(a){if((a.type==h.i.yi||a.type==h.i.yk)&&a.Ib){var c=h.ab.io(a.Ib);if(a=u(c,a.Tb)){var d=a.getParent();if(d&&d.isEnabled())for(c=p(a,!1),a=0;d=c[a];a++)d.Re(!0);else if((a.L||a.N)&&!c.lc()){do a.Re(!1),a=t(a);while(a)}}}}; h.i.Abstract=function(){this.Ib=void 0;this.group=h.i.ub();this.Mb=h.i.Mb};h.i.Abstract.prototype.za=function(){var a={type:this.type};this.group&&(a.group=this.group);return a};h.i.Abstract.prototype.oa=function(a){this.group=a.group};h.i.Abstract.prototype.Mh=function(){return!1};h.i.Abstract.prototype.run=function(){};function x(a){if(a.Ib)var c=h.ab.io(a.Ib);if(!c)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return c};h.g.object={};h.g.object.S=function(a,c){a.v=c.prototype;a.prototype=Object.create(c.prototype);a.prototype.constructor=a};h.g.object.Rh=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.Qc=function(a,c,d,e){h.i.Qc.v.constructor.call(this);this.Tb=a?a.id:null;this.Ib=a?a.C.id:void 0;this.element=c;this.oldValue=d;this.newValue=e;this.Mb=!1};h.g.object.S(h.i.Qc,h.i.Abstract);h.i.Qc.prototype.type=h.i.jn;h.i.Qc.prototype.za=function(){var a=h.i.Qc.v.za.call(this);a.element=this.element;void 0!==this.newValue&&(a.newValue=this.newValue);this.Tb&&(a.blockId=this.Tb);return a}; h.i.Qc.prototype.oa=function(a){h.i.Qc.v.oa.call(this,a);this.element=a.element;this.newValue=a.newValue;this.Tb=a.blockId};h.g.o={};h.g.o.Mk="http://www.w3.org/2000/svg";h.g.o.Fm="http://www.w3.org/1999/xhtml";h.g.o.sh="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.cg=null;h.g.o.xn=0;h.g.o.J=function(a,c,d){a=document.createElementNS(h.g.o.Mk,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.Ab=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.Gc=function(a,c){var d=a.getAttribute("class");if(-1==(" "+d+" ").indexOf(" "+c+" "))return!1;d=d.split(/\s+/);for(var e=0;ed||d>a.Cb.length)throw Error(h.$b.Error.Xu);a.An[c.ib()]=c;if(c.getParent()==a){var e=a.Cb.indexOf(c);-1>>/g,a),a=document.createElement("style"),d=document.createTextNode(d),a.appendChild(d),document.head.insertBefore(a,document.head.firstChild))}};h.Lc.ju=function(){console.warn("Deprecated call to Blockly.Css.setCursor. See https://github.com/google/blockly/issues/981 for context")}; h.Lc.Am=[".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.w=function(){};h.w.Mc=null;h.w.vn=null;h.w.Xb=null;h.w.$l=null;h.w.qk=16;h.w.fq=1;h.w.Zp=12;h.w.Oq=16;h.w.vm=.25;h.w.lq="#dadce0";h.w.mq="#fff";h.w.ln=null;h.w.Gg=null; h.w.Va=function(){if(!h.w.Mc){var a=document.createElement("div");a.className="blocklyDropDownDiv";a.style.backgroundColor=h.w.mq;a.style.borderColor=h.w.lq;document.body.appendChild(a);h.w.Mc=a;var c=document.createElement("div");c.className="blocklyDropDownContent";a.appendChild(c);h.w.ff=c;c=document.createElement("div");c.className="blocklyDropDownArrow";a.appendChild(c);h.w.pd=c;h.w.Mc.style.opacity=0;h.w.Mc.style.transition="transform "+h.w.vm+"s, opacity "+h.w.vm+"s";a.addEventListener("focusin", function(){h.g.o.Ab(a,"focused")});a.addEventListener("focusout",function(){h.g.o.Gc(a,"focused")})}};h.w.gu=function(a){h.w.vn=a};h.w.gy=function(){return h.w.ff};h.w.ax=function(){h.w.ff.innerHTML="";h.w.ff.style.width=""};h.w.zd=function(a){h.w.Mc.style.backgroundColor=a;h.w.Mc.style.borderColor=void 0};h.w.yF=function(a){h.w.Mc.setAttribute("data-category",a)}; h.w.BF=function(a,c,d,e){var f=c.C.scale,g=c.width,k=c.height;g*=f;k*=f;f=c.ga().getBoundingClientRect();g=f.left+g/2;k=f.top+k;f=f.top;e&&(f+=e);h.w.gu(y(c.C).parentNode);return h.w.show(a,c.H,g,k,g,f,d)};h.w.Rz=function(a,c){var d=a.ga().getBoundingClientRect(),e=d.left+d.width/2,f=d.bottom;d=d.top;var g=a.B;h.w.$l=!0;h.w.gu(y(g.C).parentNode);h.w.show(a,g.H,e,f,e,d,c)}; h.w.show=function(a,c,d,e,f,g,k){h.w.Xb=a;h.w.Gg=k||null;a=h.w.Ls(d,e,f,g);a.nn?(h.w.pd.style.display="",h.w.pd.style.transform="translate("+a.Ii+"px,"+a.Cr+"px) rotate(45deg)",h.w.pd.setAttribute("class",a.mn?"blocklyDropDownArrow arrowTop":"blocklyDropDownArrow arrowBottom")):h.w.pd.style.display="none";h.w.Mc.style.direction=c?"rtl":"ltr";h.w.Mj(a.Dl,a.El,a.ol,a.ql);return a.mn}; h.w.Xx=function(){var a=h.w.vn.getBoundingClientRect(),c=h.g.style.Ie(h.w.vn);return{left:a.left,right:a.left+c.width,top:a.top,bottom:a.top+c.height,width:c.width,height:c.height}};h.w.Ls=function(a,c,d,e){var f=h.w.Xx(),g=h.g.style.Ie(h.w.Mc);return c+g.heightf.top?h.w.Js(d,e,f,g):c+g.heightdocument.documentElement.clientTop?h.w.Js(d,e,f,g):h.w.ny(a,f,g)}; h.w.Ks=function(a,c,d,e){a=h.w.oo(a,d.left,d.right,e.width);return{Dl:a.Bh,El:c,ol:a.Bh,ql:c+h.w.Oq,Ii:a.Ii,Cr:-(h.w.qk/2+h.w.fq),mn:!0,nn:!0}};h.w.Js=function(a,c,d,e){a=h.w.oo(a,d.left,d.right,e.width);return{Dl:a.Bh,El:c-e.height,ol:a.Bh,ql:c-e.height-h.w.Oq,Ii:a.Ii,Cr:e.height-2*h.w.fq-h.w.qk/2,mn:!1,nn:!0}};h.w.ny=function(a,c,d){a=h.w.oo(a,c.left,c.right,d.width);return{Dl:a.Bh,El:0,ol:a.Bh,ql:0,nn:!1}}; h.w.oo=function(a,c,d,e){var f=a;a=h.g.Vb.Ni(c,a-e/2,d-e);f-=h.w.qk/2;c=h.g.Vb.Ni(h.w.Zp,f-a,e-h.w.Zp-h.w.qk);return{Ii:c,Bh:a}};h.w.isVisible=function(){return!!h.w.Xb};h.w.jj=function(a,c){h.w.Xb===a&&(c?h.w.Bo():h.w.Ia())};h.w.Ia=function(){var a=h.w.Mc;a.style.transform="translate(0, 0)";a.style.opacity=0;h.w.ln=setTimeout(function(){h.w.Bo()},1E3*h.w.vm);h.w.Gg&&(h.w.Gg(),h.w.Gg=null)}; h.w.Bo=function(){if(h.w.isVisible()){h.w.ln&&clearTimeout(h.w.ln);var a=h.w.Mc;a.style.transform="";a.style.left="";a.style.top="";a.style.opacity=0;a.style.display="none";a.style.backgroundColor=h.w.mq;a.style.borderColor=h.w.lq;h.w.Gg&&(h.w.Gg(),h.w.Gg=null);h.w.ax();h.w.Xb=null}}; h.w.Mj=function(a,c,d,e){a=Math.floor(a);c=Math.floor(c);d=Math.floor(d);e=Math.floor(e);var f=h.w.Mc;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.w.rF=function(){if(h.w.Xb){var a=h.w.Xb.B,c=a.C.scale,d=h.w.$l?h.w.Xb.jb.width:a.width,e=h.w.$l?h.w.Xb.jb.height:a.height;d*=c;e*=c;a=h.w.$l?h.w.Xb.Wc.getBoundingClientRect():a.ga().getBoundingClientRect();d=a.left+d/2;e=h.w.Ls(d,a.top+e,d,a.top);h.w.Mj(e.Dl,e.El,e.ol,e.ql)}else h.w.Ia()}; h.Nf=function(a,c){this.Gh=a;this.Fp=c.spacing;this.tt=c.length;this.Uy=(this.Po=a.firstChild)&&this.Po.nextSibling;this.Uz=c.snap};h.Nf.prototype.Ef=1;h.Nf.prototype.G=function(){this.Gh=null};h.Nf.prototype.update=function(a){this.Ef=a;var c=this.Fp*a||100;this.Gh.setAttribute("width",c);this.Gh.setAttribute("height",c);c=Math.floor(this.Fp/2)+.5;var d=c-this.tt/2,e=c+this.tt/2;c*=a;d*=a;e*=a;fa(this.Po,a,d,e,c,c);fa(this.Uy,a,c,c,d,e)}; function fa(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.Nf.prototype.moveTo=function(a,c){this.Gh.setAttribute("x",a);this.Gh.setAttribute("y",c);(h.g.userAgent.Xe||h.g.userAgent.Bk)&&this.update(this.Ef)}; h.Nf.Va=function(a,c,d){a=h.g.o.J("pattern",{id:"blocklyGridPattern"+a,patternUnits:"userSpaceOnUse"},d);0");c.yc(e)}h.i.Ma(new h.i.We(c,"mutation",null,d,a)); break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.Tb)};h.i.Ed=function(a){a&&(h.i.Ed.v.constructor.call(this,a),this.xml=a.C.$?h.I.tn(a):h.I.$f(a),this.tg=h.i.Fs(a))};h.g.object.S(h.i.Ed,h.i.Dd);h.i.tk=h.i.Ed;h.i.Ed.prototype.type=h.i.yk;h.i.Ed.prototype.za=function(){var a=h.i.Ed.v.za.call(this);a.xml=h.I.Sd(this.xml);a.ids=this.tg;return a}; h.i.Ed.prototype.oa=function(a){h.i.Ed.v.oa.call(this,a);this.xml=h.I.Ue(a.xml);this.tg=a.ids};h.i.Ed.prototype.run=function(a){var c=x(this);if(a)a=h.g.xml.createElement("xml"),a.appendChild(this.xml),h.I.Fe(a,c);else{a=0;for(var d;d=this.tg[a];a++){var e=u(c,d);e?e.G(!1):d==this.Tb&&console.warn("Can't uncreate non-existent block: "+d)}}}; h.i.Fd=function(a){if(a){if(a.getParent())throw Error("Connected blocks cannot be deleted.");h.i.Fd.v.constructor.call(this,a);this.jz=a.C.$?h.I.tn(a):h.I.$f(a);this.tg=h.i.Fs(a)}};h.g.object.S(h.i.Fd,h.i.Dd);h.i.Vu=h.i.Fd;h.i.Fd.prototype.type=h.i.pi;h.i.Fd.prototype.za=function(){var a=h.i.Fd.v.za.call(this);a.ids=this.tg;return a};h.i.Fd.prototype.oa=function(a){h.i.Fd.v.oa.call(this,a);this.tg=a.ids}; h.i.Fd.prototype.run=function(a){var c=x(this);if(a){a=0;for(var d;d=this.tg[a];a++){var e=u(c,d);e?e.G(!1):d==this.Tb&&console.warn("Can't delete non-existent block: "+d)}}else a=h.g.xml.createElement("xml"),a.appendChild(this.jz),h.I.Fe(a,c)};h.i.Qf=function(a){a&&(h.i.Qf.v.constructor.call(this,a),a=ha(this),this.It=a.Pt,this.Ht=a.ht,this.ep=a.Xr)};h.g.object.S(h.i.Qf,h.i.Dd);h.i.li=h.i.Qf;b=h.i.Qf.prototype;b.type=h.i.yi; b.za=function(){var a=h.i.Qf.v.za.call(this);this.Dg&&(a.newParentId=this.Dg);this.Cg&&(a.newInputName=this.Cg);this.wf&&(a.newCoordinate=Math.round(this.wf.x)+","+Math.round(this.wf.y));return a};b.oa=function(a){h.i.Qf.v.oa.call(this,a);this.Dg=a.newParentId;this.Cg=a.newInputName;a.newCoordinate&&(a=a.newCoordinate.split(","),this.wf=new h.g.M(Number(a[0]),Number(a[1])))};b.Jg=function(){var a=ha(this);this.Dg=a.Pt;this.Cg=a.ht;this.wf=a.Xr}; function ha(a){var c=u(x(a),a.Tb);a={};var d=c.getParent();if(d){a.Pt=d.id;a:{for(var e=0,f;f=d.K[e];e++)if(f.connection&&A(f.connection)==c){c=f;break a}c=null}c&&(a.ht=c.name)}else a.Xr=c.Fa();return a}b.Mh=function(){return this.It==this.Dg&&this.Ht==this.Cg&&h.g.M.Ud(this.ep,this.wf)}; b.run=function(a){var c=x(this),d=u(c,this.Tb);if(d){var e=a?this.Dg:this.It,f=a?this.Cg:this.Ht;a=a?this.wf:this.ep;var g=null;if(e&&(g=u(c,e),!g)){console.warn("Can't connect to non-existent block: "+e);return}d.getParent()&&B(d);if(a)f=d.Fa(),d.moveBy(a.x-f.x,a.y-f.y);else{d=d.L||d.N;if(f){if(c=ia(g,f))var k=c.connection}else d.type==h.ld&&(k=g.W);k?d.connect(k):console.warn("Can't connect to non-existent input: "+f)}}else console.warn("Can't move non-existent block: "+this.Tb)};h.i.si=function(a){this.Ib=a.id;this.group=h.i.ub();this.Mb=!1};h.g.object.S(h.i.si,h.i.Abstract);h.i.si.prototype.type=h.i.qv;h.i.si.prototype.za=function(){var a={type:this.type};this.group&&(a.group=this.group);this.Ib&&(a.workspaceId=this.Ib);return a};h.i.si.prototype.oa=function(a){this.Ib=a.workspaceId;this.group=a.group};h.i.ve=function(a){h.i.ve.v.constructor.call(this);this.Hf=a.ib();this.Ib=a.C.id};h.g.object.S(h.i.ve,h.i.Abstract);h.i.ve.prototype.za=function(){var a=h.i.ve.v.za.call(this);a.varId=this.Hf;return a};h.i.ve.prototype.oa=function(a){h.i.ve.v.za.call(this);this.Hf=a.varId};h.i.nd=function(a){a&&(h.i.nd.v.constructor.call(this,a),this.Wg=a.type,this.Vg=a.name)};h.g.object.S(h.i.nd,h.i.ve);h.i.nd.prototype.type=h.i.lr; h.i.nd.prototype.za=function(){var a=h.i.nd.v.za.call(this);a.varType=this.Wg;a.varName=this.Vg;return a};h.i.nd.prototype.oa=function(a){h.i.nd.v.oa.call(this,a);this.Wg=a.varType;this.Vg=a.varName};h.i.nd.prototype.run=function(a){var c=x(this);a?c.sd(this.Vg,this.Wg,this.Hf):c.Ah(this.Hf)};h.i.od=function(a){a&&(h.i.od.v.constructor.call(this,a),this.Wg=a.type,this.Vg=a.name)};h.g.object.S(h.i.od,h.i.ve);h.i.od.prototype.type=h.i.mr; h.i.od.prototype.za=function(){var a=h.i.od.v.za.call(this);a.varType=this.Wg;a.varName=this.Vg;return a};h.i.od.prototype.oa=function(a){h.i.od.v.oa.call(this,a);this.Wg=a.varType;this.Vg=a.varName};h.i.od.prototype.run=function(a){var c=x(this);a?c.Ah(this.Hf):c.sd(this.Vg,this.Wg,this.Hf)};h.i.Md=function(a,c){a&&(h.i.Md.v.constructor.call(this,a),this.gp=a.name,this.ap=c)};h.g.object.S(h.i.Md,h.i.ve);h.i.Md.prototype.type=h.i.nr; h.i.Md.prototype.za=function(){var a=h.i.Md.v.za.call(this);a.oldName=this.gp;a.newName=this.ap;return a};h.i.Md.prototype.oa=function(a){h.i.Md.v.oa.call(this,a);this.gp=a.oldName;this.ap=a.newName};h.i.Md.prototype.run=function(a){var c=x(this);a?c.Kg(this.Hf,this.ap):c.Kg(this.Hf,this.gp)};h.I={};h.I.Cu=function(a){var c=C,d=h.g.xml.createElement("xml"),e=h.I.jA(h.na.Hw(c));e.hasChildNodes()&&d.appendChild(e);var f=ja(c,!0);e=0;for(var g;g=f[e];e++)d.appendChild(g.Mp(a));c=D(c,!0);for(e=0;f=c[e];e++)d.appendChild(h.I.tn(f,a));return d};h.I.jA=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.ib();c.appendChild(f)}return c}; h.I.tn=function(a,c){var d;a.C.H&&(d=a.C.gj());c=h.I.$f(a,c);var e=a.Fa();c.setAttribute("x",Math.round(a.C.H?d-e.x:e.x));c.setAttribute("y",Math.round(e.y));return c}; h.I.Lx=function(a){var c=!1;a.name&&(a.Zq?c=!0:a.Gd&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),c=!0));return c?(c=h.g.xml.createElement("field"),c.setAttribute("name",a.name),c.textContent=a.getValue(),c):null};h.I.Fw=function(a,c){for(var d=0,e;e=a.K[d];d++)for(var f=0,g;g=e.Ea[f];f++)(g=h.I.Lx(g))&&c.appendChild(g)}; h.I.$f=function(a,c){var d=h.g.xml.createElement(a.Qa?"shadow":"block");d.setAttribute("type",a.type);c||(d.id=a.id);if(a.Wb){var e=a.Wb();e&&(e.hasChildNodes()||e.hasAttributes())&&d.appendChild(e)}h.I.Fw(a,d);if(e=a.Be.text){var f=a.Be.size,g=a.Be.St,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.K[f];f++){var l;k=!0;if(g.type!=h.qe){var m=A(g.connection);g.type==h.Ha?l=h.g.xml.createElement("value"):g.type==h.Ca&&(l=h.g.xml.createElement("statement"));e=g.connection.ae;!e||m&&m.Qa||l.appendChild(h.I.Mr(e,c));m&&(l.appendChild(h.I.$f(m,c)),k=!1);l.setAttribute("name",g.name);k||d.appendChild(l)}}void 0!=a.Le&&a.Le!=a.Ly&&d.setAttribute("inline",a.Le);a.isCollapsed()&&d.setAttribute("collapsed",!0);a.isEnabled()||d.setAttribute("disabled",!0);a.Cc()||a.Qa||d.setAttribute("deletable", !1);a.mc()||a.Qa||d.setAttribute("movable",!1);a.Dc()||d.setAttribute("editable",!1);if(f=t(a))l=h.g.xml.createElement("next"),l.appendChild(h.I.$f(f,c)),d.appendChild(l);e=a.W&&a.W.ae;!e||f&&f.Qa||l.appendChild(h.I.Mr(e,c));return d}; h.I.Mr=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.I.Sd=function(a){a=h.g.xml.Sd(a);var c=/(<[^/](?:[^>]*[^/])?>[^<]*)\n([^<]*<\/)/;do{var d=a;a=a.replace(c,"$1 $2")}while(a!=d);return a};h.I.KE=function(a){a=h.I.Sd(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.I.Ue=function(a){var c=h.g.xml.$z(a);if(!c||!c.documentElement||c.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+a);return c.documentElement};h.I.DE=function(a,c){c.qc(!1);c.clear();a=h.I.Fe(a,c);c.qc(!0);return a}; h.I.Fe=function(a,c){if(a instanceof h.ab){var d=a;a=c;c=d;console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var e;c.H&&(e=c.gj());d=[];h.g.o.Zj();var f=a.childNodes.length,g=h.i.ub();g||h.i.ca(!0);c.qc&&c.qc(!1);var k=!0;try{for(var l=0;l document.");}else a=null;return a};h.Touch={};h.Touch.jr="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.fk=null;h.Touch.Ld={}; h.g.global.PointerEvent?h.Touch.Ld={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:h.Touch.jr&&(h.Touch.Ld={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]});h.Ql=0; h.Wy=function(a,c){h.uf();a.changedTouches&&1!=a.changedTouches.length||(h.Ql=setTimeout(function(){a.changedTouches&&(a.button=2,a.clientX=a.changedTouches[0].clientX,a.clientY=a.changedTouches[0].clientY);c&&oa(c,a)},h.Hv))};h.uf=function(){h.Ql&&(clearTimeout(h.Ql),h.Ql=0)};h.Touch.Tk=function(){h.Touch.fk=null};h.Touch.Ep=function(a){return!h.Touch.Py(a)||h.Touch.Zw(a)}; h.Touch.wl=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.Zw=function(a){var c=h.Touch.wl(a);return void 0!==h.Touch.fk&&null!==h.Touch.fk?h.Touch.fk==c:"mousedown"==a.type||"touchstart"==a.type||"pointerdown"==a.type?(h.Touch.fk=c,!0):!1}; h.Touch.Nz=function(a){if(h.g.Ga.startsWith(a.type,"touch")){var c=a.changedTouches[0];a.clientX=c.clientX;a.clientY=c.clientY}};h.Touch.Py=function(a){return h.g.Ga.startsWith(a.type,"touch")||h.g.Ga.startsWith(a.type,"mouse")||h.g.Ga.startsWith(a.type,"pointer")};h.Touch.Ol=function(a){return h.g.Ga.startsWith(a.type,"touch")||h.g.Ga.startsWith(a.type,"pointer")}; h.Touch.Vz=function(a){var c=[];if(a.changedTouches)for(var d=0;d=d+this.lf&&(e+=f);G(this,wa(this,e));ua(this);a.stopPropagation();a.preventDefault()}}; b.nz=function(a){za(this.F);pa();h.g.Oh(a)?a.stopPropagation():(this.Wz=this.ij,Ba(this.F),this.qu=this.sg?a.clientX:a.clientY,h.Da.yf=h.Ba(document,"mouseup",this,this.sz),h.Da.xf=h.Ba(document,"mousemove",this,this.oz),a.stopPropagation(),a.preventDefault())};b.oz=function(a){G(this,wa(this,this.Wz+((this.sg?a.clientX:a.clientY)-this.qu)));ua(this)};b.sz=function(){Ca(this.F);h.Touch.Tk();pa()};function pa(){h.ec(!0);h.Da.yf&&(h.lb(h.Da.yf),h.Da.yf=null);h.Da.xf&&(h.lb(h.Da.xf),h.Da.xf=null)} function wa(a,c){return c=0>=c||isNaN(c)||a.fdh.D.Yv&&h.D.Ia()}else h.D.Zl!=h.D.X&&(clearTimeout(h.D.Xj),h.D.No=a.pageX,h.D.Oo=a.pageY,h.D.Xj=setTimeout(h.D.Sz,h.D.uv))};h.D.Ia=function(){h.D.visible&&(h.D.visible=!1,h.D.ua&&(h.D.ua.style.display="none"));h.D.Xj&&clearTimeout(h.D.Xj)};h.D.block=function(){h.D.Ia();h.D.vh=!0};h.D.iA=function(){h.D.vh=!1}; h.D.Sz=function(){if(!h.D.vh&&(h.D.Zl=h.D.X,h.D.ua)){h.D.ua.innerHTML="";for(var a=h.D.X.ge;"function"==typeof a;)a=a();a=h.g.Ga.lA(a);a=a.split("\n");for(var c=0;cd+window.scrollY&&(f-=h.D.ua.offsetHeight+2*h.D.Mq);a?e=Math.max(h.D.Mm-window.scrollX,e):e+h.D.ua.offsetWidth>c+window.scrollX-2*h.D.Mm&&(e=c-h.D.ua.offsetWidth-2*h.D.Mm);h.D.ua.style.top=f+"px";h.D.ua.style.left=e+"px"}};h.wr=function(a){this.Ui=a;this.Va()};b=h.wr.prototype;b.Sa=null;b.td=null;b.Ui=null;b.Va=function(){this.Sa||(this.Sa=h.g.o.J("svg",{xmlns:h.g.o.Mk,"xmlns:html":h.g.o.Fm,"xmlns:xlink":h.g.o.sh,version:"1.1","class":"blocklyWsDragSurface blocklyOverflowVisible"},null),this.Ui.appendChild(this.Sa))};b.Tg=function(a,c){a=a.toFixed(0);c=c.toFixed(0);this.Sa.style.display="block";h.g.o.dm(this.Sa,"translate3d("+a+"px, "+c+"px, 0px)")};b.qo=function(){return h.g.Zc(this.Sa)}; b.Sk=function(a){if(!a)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var c=this.Sa.childNodes[0],d=this.Sa.childNodes[1];if(!(c&&d&&h.g.o.Xs(c,"blocklyBlockCanvas")&&h.g.o.Xs(d,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");null!=this.np?h.g.o.pj(c,this.np):a.insertBefore(c,a.firstChild);h.g.o.pj(d,c);this.Sa.style.display="none";if(this.Sa.childNodes.length)throw Error("Drag surface was not cleared.");h.g.o.dm(this.Sa, "");this.np=null};h.zb=Object.create(null);h.aa=function(a,c){this.B=a;this.type=c};h.aa.vk=0;h.aa.Uq=1;h.aa.Xq=2;h.aa.Wq=3;h.aa.Sq=4;h.aa.Tq=5;h.aa.Vq=6;b=h.aa.prototype;b.ka=null;b.ye=null;b.ae=null;b.fb=0;b.Aa=0; b.rd=function(a){var c=this,d=c.B,e=a.B;a.isConnected()&&a.disconnect();if(c.isConnected()){var f=A(c),g=c.ae;c.ae=null;if(f.Qa)g=h.I.$f(f),f.G(),f=null;else if(c.type==h.Ha){if(!f.L)throw Error("Orphan block does not have an output connection.");var k=h.aa.rt(e,f);k&&(f.L.connect(k),f=null)}else if(c.type==h.Ca){if(!f.N)throw Error("Orphan block does not have a previous connection.");for(k=e;k.W;){var l=t(k);if(l&&!l.Qa)k=l;else{H(f.N,k.W)&&(k.W.connect(f.N),f=null);break}}}if(f&&(c.disconnect(), h.i.Mb)){var m=h.i.ub();setTimeout(function(){f.C&&!f.getParent()&&(h.i.ca(m),f.L?f.L.Tl(c):f.N&&f.N.Tl(c),h.i.ca(!1))},h.xm)}c.ae=g}var n;h.i.isEnabled()&&(n=new h.i.li(e));h.aa.kx(c,a);e.$h(d);n&&(n.Jg(),h.i.Ma(n))};b.G=function(){if(this.isConnected()){this.ae=null;var a=A(this);a.Qa?a.G():B(a)}};function I(a){return a.type==h.Ha||a.type==h.Ca}b.isConnected=function(){return!!this.ka}; function Da(a,c){if(!c)return h.aa.Wq;if(I(a))var d=a.B,e=c.B;else e=a.B,d=c.B;return d&&d==e?h.aa.Uq:c.type!=h.mh[a.type]?h.aa.Xq:d&&e&&d.C!==e.C?h.aa.Tq:H(a,c)?d.Qa&&!e.Qa?h.aa.Vq:h.aa.vk:h.aa.Sq} function Ea(a,c){switch(Da(a,c)){case h.aa.vk:break;case h.aa.Uq:throw Error("Attempted to connect a block to itself.");case h.aa.Tq:throw Error("Blocks not on same workspace.");case h.aa.Xq:throw Error("Attempt to connect incompatible types.");case h.aa.Wq:throw Error("Target connection is null.");case h.aa.Sq:throw Error("Connection checks failed. "+(a+" expected "+a.ye+", found "+c.ye));case h.aa.Vq:throw Error("Connecting non-shadow to shadow block.");default:throw Error("Unknown connection failure: this should never happen!"); }}b.Hl=function(a){if(a.B.rf()||Da(this,a)!=h.aa.vk)return!1;switch(a.type){case h.ld:return this.ka||-1!=h.cj.indexOf(a)?a=!1:a.ka?(a=A(a),a=a.rf()?!(a.N&&A(a.N)):!1):a=!0,a;case h.jd:if(a.isConnected()&&!A(a).rf()||this.isConnected())return!1;break;case h.Ha:if(a.isConnected()&&!A(a).mc()&&!A(a).Qa)return!1;break;case h.Ca:if(a.isConnected()&&!this.B.W&&!A(a).Qa&&A(a).W)return!1;break;default:throw Error("Unknown connection type in isConnectionAllowed");}return-1!=h.cj.indexOf(a)?!1:!0};b.Tl=function(){}; b.connect=function(a){if(this.ka!=a){Ea(this,a);var c=h.i.ub();c||h.i.ca(!0);I(this)?this.rd(a):a.rd(this);c||h.i.ca(!1)}};h.aa.kx=function(a,c){if(!a||!c)throw Error("Cannot connect null connections.");a.ka=c;c.ka=a};h.aa.Tz=function(a,c){for(var d=!1,e=0;ed)){var e=Ha(c,a.ga());a.L?(e.x+=(a.H?3:-3)*d,e.y+=13*d):a.N&&(e.x+=(a.H?-23:23)*d,e.y+=3*d);a=h.g.o.J("circle",{cx:e.x,cy:e.y,r:0,fill:"none",stroke:"#888","stroke-width":10},y(c));h.La.Tr(a,new Date,d)}};h.La.Tr=function(a,c,d){var e=(new Date-c)/150;1a.C.scale)){var c=J(a).height;c=Math.atan(10/c)/Math.PI*180;a.H||(c*=-1);h.La.ls(a.ga(),c,new Date)}};h.La.ls=function(a,c,d){var e=(new Date-d)/200;1a-h.av)}if(a.Eb||a.Wa)console.error("Only one of localConnection_ and closestConnection_ was set.");else return!0}else return!(!a.Eb||!a.Wa);console.error("Returning true from shouldUpdatePreviews, but it's not clear why.");return!0} function Ka(a){a.Wa&&(h.g.o.removeNode(h.aa.ft),delete h.aa.ft);if(a.Co){var c=a.Wa;c.type!=h.Ha||c.isConnected()?La(a.Ih,!1):a.Ih.Dy(c,!1);a.Ih=null;a.Co=!1}else if(a.Ag)if(a.Ag){c=a.Ag;var d=c.B,e=d.W,f=d.N,g=d.L;g=c.type==h.Ha&&!(g&&g.ka);!(c!=e||f&&f.ka)||g?B(A(c),!1):c.type==h.Ca&&c!=e?(e=c.ka,B(e.B,!1),f=f?f.ka:null,B(d,!0),f&&f.connect(e)):B(d,!0);if(c.ka)throw Error("markerConnection_ still connected at the end of disconnectInsertionMarker");a.Ag=null;d.ga().setAttribute("visibility","hidden")}else console.log("No insertion marker connection to disconnect")} h.Fk.prototype.Eh=function(){var a=[];this.Dh&&a.push(this.Dh);this.yg&&a.push(this.yg);return a};h.Kf=function(a,c){this.Xa=a;this.F=c;this.Td=new h.Fk(this.Xa);this.kg=null;this.le=!1;this.ee=this.Xa.Fa();this.jl=h.Kf.Iy(a)};h.Kf.prototype.G=function(){this.wb=this.F=this.Xa=null;this.jl.length=0;this.Td&&(this.Td.G(),this.Td=null)};h.Kf.Iy=function(a){var c=[];a=p(a,!1);for(var d=0,e;e=a[d];d++){e=M(e);for(var f=0;fc)throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");a.km.splice(c,1);this.gc.unsubscribe(this.fe);this.options.Fc||(this.gc.G(),this.gc=null)}};h.ab.Yq=3;b=h.ab.prototype;b.ce=function(a,c){a=a.Fa();c=c.Fa();return a.y+h.ab.prototype.ce.offset*a.x-(c.y+h.ab.prototype.ce.offset*c.x)}; function Wa(a,c){if(!h.g.Hi(a.ii,c))throw Error("Block not present in workspace's list of top-most blocks.");}function D(a,c){var d=[].concat(a.ii);c&&1g)return!1;d+=c[e]}return d>(isNaN(a.options.Fj)?Infinity:a.options.Fj-P(a).length)?!1:!0}function Ya(a){return Infinity!=a.options.Fj||!!a.options.Wo} b.Qp=function(a){var c=a?this.Pj:this.Ug,d=a?this.Ug:this.Pj,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.Mb=!1;try{for(c=0;e=f[c];c++)e.run(a)}finally{h.i.Mb=!0}}};function Za(){var a=C;a.Ug.length=0;a.Pj.length=0;h.i.bx()}function $a(a,c){a.Bj.push(c)}function u(a,c){return a.sn[c]||null}h.ab.Ei=Object.create(null);h.ab.io=function(a){return h.ab.Ei[a]||null}; h.ab.getAll=function(){var a=[],c;for(c in h.ab.Ei)a.push(h.ab.Ei[c]);return a};h.la=function(a,c,d,e,f,g){this.F=a;this.ff=c;this.mu=d;d=h.la.Qu;this.F.H&&(d=-d);this.Jw=h.g.Vb.Sg(d);a.Te.appendChild(this.Wi(c,!(!f||!g)));this.mb=e;this.qp&&ab(this);f&&g||(c=this.ff.getBBox(),f=c.width+2*h.la.Cd,g=c.height+2*h.la.Cd);bb(this,f,g);ab(this);cb(this);this.qp=!0;a.options.readOnly||(h.Ba(this.Li,"mousedown",this,this.Qw),this.$d&&h.Ba(this.$d,"mousedown",this,this.Gz))};h.la.Cd=6;h.la.Ru=5;h.la.Qu=20;h.la.Xp=4;h.la.Ou=8;h.la.yf=null;h.la.xf=null;h.la.prototype.bu=null; h.la.Pp=function(){h.la.yf&&(h.lb(h.la.yf),h.la.yf=null);h.la.xf&&(h.lb(h.la.xf),h.la.xf=null)};h.la.Rw=function(){h.Touch.Tk();h.la.Pp()};b=h.la.prototype;b.qp=!1;b.mb=null;b.Qe=0;b.Cf=0;b.Qb=0;b.ud=0;b.pn=!0; b.Wi=function(a,c){this.xc=h.g.o.J("g",{},null);var d={filter:"url(#"+this.F.options.ss+")"};h.g.userAgent.Ev&&(d={});d=h.g.o.J("g",d,this.xc);this.wn=h.g.o.J("path",{},d);this.Li=h.g.o.J("rect",{"class":"blocklyDraggable",x:0,y:0,rx:h.la.Cd,ry:h.la.Cd},d);c?(this.$d=h.g.o.J("g",{"class":this.F.H?"blocklyResizeSW":"blocklyResizeSE"},this.xc),c=2*h.la.Cd,h.g.o.J("polygon",{points:"0,x x,x x,0".replace(/x/g,c.toString())},this.$d),h.g.o.J("line",{"class":"blocklyResizeLine",x1:c/3,y1:c-1,x2:c-1,y2:c/ 3},this.$d),h.g.o.J("line",{"class":"blocklyResizeLine",x1:2*c/3,y1:c-1,x2:c-1,y2:2*c/3},this.$d)):this.$d=null;this.xc.appendChild(a);return this.xc};b.ga=function(){return this.xc};b.Qw=function(a){var c=db(this.F,a);if(c){if(c.Hh)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");c.Hc||(c.Hc=this);c.yd=a}};b.Vj=function(){};b.Cc=function(){return!1}; b.Gz=function(a){var c=this.xc.parentNode;c.lastChild!==this.xc&&c.appendChild(this.xc);h.la.Pp();h.g.Oh(a)||(this.F.Hp(a,new h.g.M(this.F.H?-this.Qb:this.Qb,this.ud)),h.la.yf=h.Ba(document,"mouseup",this,h.la.Rw),h.la.xf=h.Ba(document,"mousemove",this,this.Hz),h.ec());a.stopPropagation()};b.Hz=function(a){this.pn=!1;var c=this.F;a=h.g.Ij(a,y(c),Aa(c));a.x/=c.scale;a.y/=c.scale;c=h.g.M.sum(c.ps,a);bb(this,this.F.H?-c.x:c.x,c.y);this.F.H&&ab(this)}; function eb(a,c,d){var e=a.F.H?a.mb.x-c.x-a.Qb:c.x+a.mb.x;c=c.y+a.mb.y;return Math.max(0,Math.min(1,(Math.min(e+a.Qb,d.sb+d.yb)-Math.max(e,d.sb))*(Math.min(c+a.ud,d.Hb+d.Ob)-Math.max(c,d.Hb))/(a.Qb*a.ud)))}function ab(a){var c=a.mb.x;c=a.F.H?c-(a.Qe+a.Qb):c+a.Qe;a.moveTo(c,a.Cf+a.mb.y)}b.moveTo=function(a,c){this.xc.setAttribute("transform","translate("+a+","+c+")")}; function bb(a,c,d){var e=2*h.la.Cd;c=Math.max(c,e+45);d=Math.max(d,e+20);a.Qb=c;a.ud=d;a.Li.setAttribute("width",c);a.Li.setAttribute("height",d);a.$d&&(a.F.H?a.$d.setAttribute("transform","translate("+2*h.la.Cd+","+(d-e)+") scale(-1 1)"):a.$d.setAttribute("transform","translate("+(c-e)+","+(d-e)+")"));if(a.pn){c=a.F.Yc();c.sb/=a.F.scale;c.yb/=a.F.scale;c.Hb/=a.F.scale;c.Ob/=a.F.scale;d=-a.Qb/4;if(!(a.Qb>c.yb)){if(a.F.H){e=a.mb.x-d;var f=e-a.Qb;var g=c.sb+c.yb,k=c.sb+h.Da.pc/a.F.scale}else f=d+a.mb.x, e=f+a.Qb,k=c.sb,g=c.sb+c.yb-h.Da.pc/a.F.scale;a.F.H?fg&&(d=-(g-a.mb.x)):fg&&(d=g-a.mb.x-a.Qb)}f=d;d=-a.ud/4;if(!(a.ud>c.Ob)){e=a.mb.y+d;g=e+a.ud;k=c.Hb;var l=c.Hb+c.Ob-h.Da.pc/a.F.scale,m=a.mb.y;el&&(d=l-m-a.ud)}k=d;g=a.mu.getBBox();d={x:f,y:-a.ud-h.ea.Jq};e={x:-a.Qb-30,y:k};k={x:g.width,y:k};l={x:f,y:g.height};f=g.widthg&&(l=2*Math.PI-l);var m=l+Math.PI/2;m>2*Math.PI&&(m-=2*Math.PI);var n=Math.sin(m),q=Math.cos(m),r=new h.g.md(a.Qb,a.ud);m=(r.width+r.height)/h.la.Ru;m=Math.min(m,r.width,r.height)/4;r=1-h.la.Ou/k;f=d+r*f;g=e+r*g;r=d+m*q;var v=e+m*n;d-=m*q;e-=m*n;n=l+a.Jw;n>2*Math.PI&&(n-=2*Math.PI);l=Math.sin(n)*k/h.la.Xp;k=Math.cos(n)*k/h.la.Xp;c.push("M"+ r+","+v);c.push("C"+(r+k)+","+(v+l)+" "+f+","+g+" "+f+","+g);c.push("C"+f+","+g+" "+(d+k)+","+(e+l)+" "+d+","+e)}c.push("z");a.wn.setAttribute("d",c.join(" "))}b.zd=function(a){this.Li.setAttribute("fill",a);this.wn.setAttribute("fill",a)};b.G=function(){h.la.Pp();h.g.o.removeNode(this.xc);this.mu=this.ff=this.F=this.$d=this.Li=this.wn=this.xc=null};b.Zo=function(a,c){a?a.Tg(c.x,c.y):this.moveTo(c.x,c.y);this.Qe=this.F.H?this.mb.x-c.x-this.Qb:c.x-this.mb.x;this.Cf=c.y-this.mb.y;cb(this)}; b.Fa=function(){return new h.g.M(this.mb.x+this.Qe,this.mb.y+this.Cf)};h.i.ne=function(a){this.Qd=a.id;this.Ib=a.C.id;this.group=h.i.ub();this.Mb=h.i.Mb};h.g.object.S(h.i.ne,h.i.Abstract);h.i.ne.prototype.za=function(){var a=h.i.ne.v.za.call(this);this.Qd&&(a.commentId=this.Qd);return a};h.i.ne.prototype.oa=function(a){h.i.ne.v.oa.call(this,a);this.Qd=a.commentId};h.i.dh=function(a,c,d){a&&(h.i.dh.v.constructor.call(this,a),this.Gt=c,this.Sl=d)};h.g.object.S(h.i.dh,h.i.ne);b=h.i.dh.prototype;b.type=h.i.hq; b.za=function(){var a=h.i.dh.v.za.call(this);a.newContents=this.Sl;return a};b.oa=function(a){h.i.dh.v.oa.call(this,a);this.Sl=a.newValue};b.Mh=function(){return this.Gt==this.Sl};b.run=function(a){var c;(c=x(this).Wk[this.Qd]||null)?c.zF(a?this.Sl:this.Gt):console.warn("Can't change non-existent comment: "+this.Qd)};h.i.oe=function(a){a&&(h.i.oe.v.constructor.call(this,a),this.xml=a.Mp())};h.g.object.S(h.i.oe,h.i.ne);h.i.oe.prototype.type=h.i.wk; h.i.oe.prototype.za=function(){var a=h.i.oe.v.za.call(this);a.xml=h.I.Sd(this.xml);return a};h.i.oe.prototype.oa=function(a){h.i.oe.v.oa.call(this,a);this.xml=h.I.Ue(a.xml)};h.i.oe.prototype.run=function(a){h.i.kq(this,a)};h.i.kq=function(a,c){var d=x(a);c?(c=h.g.xml.createElement("xml"),c.appendChild(a.xml),h.I.Fe(c,d)):(d=d.Wk[a.Qd]||null)?d.G(!1,!1):console.warn("Can't uncreate non-existent comment: "+a.Qd)};h.i.pe=function(a){a&&(h.i.pe.v.constructor.call(this,a),this.xml=a.Mp())}; h.g.object.S(h.i.pe,h.i.ne);h.i.pe.prototype.type=h.i.iq;h.i.pe.prototype.za=function(){return h.i.pe.v.za.call(this)};h.i.pe.prototype.oa=function(a){h.i.pe.v.oa.call(this,a)};h.i.pe.prototype.run=function(a){h.i.kq(this,!a)};h.i.Lf=function(a){a&&(h.i.Lf.v.constructor.call(this,a),this.Cn=a,this.fp=a.Rs(),this.Bg=null)};h.g.object.S(h.i.Lf,h.i.ne);b=h.i.Lf.prototype; b.Jg=function(){if(!this.Cn)throw Error("Tried to record the new position of a comment on the same event twice.");this.Bg=this.Cn.Rs();this.Cn=null};b.type=h.i.xk;b.za=function(){var a=h.i.Lf.v.za.call(this);this.Bg&&(a.newCoordinate=Math.round(this.Bg.x)+","+Math.round(this.Bg.y));return a};b.oa=function(a){h.i.Lf.v.oa.call(this,a);a.newCoordinate&&(a=a.newCoordinate.split(","),this.Bg=new h.g.M(Number(a[0]),Number(a[1])))};b.Mh=function(){return h.g.M.Ud(this.fp,this.Bg)}; b.run=function(a){var c;if(c=x(this).Wk[this.Qd]||null){a=a?this.Bg:this.fp;var d=c.Rs();c.moveBy(a.x-d.x,a.y-d.y)}else console.warn("Can't move non-existent comment: "+this.Qd)};h.mi=function(a,c){this.tb=a;this.F=c;this.kg=null;this.pm=!1;this.ee=this.tb.Fa();this.lg=h.g.vg()&&c.wc?c.wc:null};h.mi.prototype.G=function(){this.lg=this.F=this.tb=null};function fb(a,c,d){d=a.Uh(d);d=h.g.M.sum(a.ee,d);a.tb.Zo(a.lg,d);a.tb.Cc()&&(a.kg=Oa(a.F,c),a.pm=a.kg!=h.nq,c=a.F.Nb,a.pm?(Pa(a.tb,!0),a.kg==h.Dm&&c&&c.Ap(!0)):(Pa(a.tb,!1),c&&c.Ap(!1)))} function gb(a,c,d){fb(a,c,d);c=a.Uh(d);c=h.g.M.sum(a.ee,c);a.tb.moveTo(c.x,c.y);c=a.F.Nb;a.pm?(c&&setTimeout(c.close.bind(c),100),a.ej(),a.tb.G(!1,!0)):c&&c.close();a.pm||(a.lg&&a.lg.Sk(a.F.Te),a.tb.Lg&&a.tb.Lg(!1),a.ej());a.F.qc(!0);a.F.qa&&a.F.qa.Dz(a.tb.Cc()?"blocklyToolboxDelete":"blocklyToolboxGrab");h.i.ca(!1)}h.mi.prototype.ej=function(){if(this.tb.mt){var a=new h.i.Lf(this.tb);a.fp=this.ee;a.Jg();h.i.Ma(a)}}; h.mi.prototype.Uh=function(a){a=new h.g.M(a.x/this.F.scale,a.y/this.F.scale);this.F.xj&&a.scale(1/this.F.options.Fc.scale);return a};h.mi.prototype.$o=function(){this.tb.moveTo(0,0);this.lg.Tg(this.ee.x,this.ee.y);ba(this.lg,this.tb.ga())};h.Fi=function(a){this.F=a;this.su=new h.g.M(a.scrollX,a.scrollY)};h.Fi.prototype.G=function(){this.F=null};h.Fi.prototype.Hp=function(){h.selected&&hb(h.selected);Ba(this.F)};h.Fi.prototype.Ge=function(a){a=h.g.M.sum(this.su,a);this.F.scroll(a.x,a.y)};h.Dk=function(a){h.Dk.v.constructor.call(this,a.yl());this.xp=a.xp;this.gt=a.gt};h.g.object.S(h.Dk,h.Fi);h.Dk.prototype.Ge=function(a){a=h.g.M.sum(this.su,a);this.gt?this.xp.set(-a.x):this.xp.set(-a.y)};h.gh=function(a,c){this.wb=this.xb=this.Ng=this.Og=this.Hc=this.cc=this.Bt=null;this.Hn=c;this.rj=this.wg=this.sj=this.pg=!1;this.yd=a;this.R=this.Jf=this.qd=this.we=this.Vl=this.Ul=null;this.Jl=this.Hh=this.Ir=!1;this.at=!h.iv};b=h.gh.prototype;b.G=function(){h.Touch.Tk();h.D.iA();this.Hn.Db=null;this.Ul&&h.lb(this.Ul);this.Vl&&h.lb(this.Vl);this.R=this.wb=this.xb=this.Ng=this.Og=null;this.qd&&(this.qd.G(),this.qd=null);this.Jf&&(this.Jf.G(),this.Jf=null);this.we&&(this.we.G(),this.we=null)}; function ib(a,c){a.cc=h.g.M.bl(new h.g.M(c.clientX,c.clientY),a.Bt);if(a.pg)var d=!1;else a.pg=h.g.M.Xy(a.cc)>(a.R?h.rv:h.hv),d=a.pg;if(d){if(a.Ir)throw Error("updateIsDragging_ should only be called once per gesture.");a.Ir=!0;if(a.Hc){a.rj=!0;a.we=new h.mi(a.Hc,a.wb);d=a.we;h.i.ub()||h.i.ca(!0);d.F.qc(!1);d.tb.pn=!1;d.lg&&d.$o();d.tb.Lg&&d.tb.Lg(!0);var e=d.F.qa;e&&e.Dw(d.tb.Cc()?"blocklyToolboxDelete":"blocklyToolboxGrab");fb(a.we,a.yd,a.cc);d=!0}else d=!1;if(!d){if(a.xb)if(a.R?(a.R.YE(a.xb)?!a.R.Sy()|| a.R.$E(a.cc)?(a.wb=a.R.HF,jb(a.wb),h.i.ub()||h.i.ca(!0),a.Ng=null,a.xb=a.R.Yr(a.xb),a.xb.select(),d=!0):d=!1:d=!1,a.wg=d):a.xb.mc()&&(a.wg=!0),a.wg){a.qd=new h.Kf(a.xb,a.wb);d=a.qd;e=a.cc;var f=a.at;h.i.ub()||h.i.ca(!0);d.F.xj&&Sa(d.Xa);h.g.o.Zj();d.F.qc(!1);h.La.Sn();if(d.Xa.getParent()||f&&d.Xa.W&&A(d.Xa.W))B(d.Xa,f),e=d.Uh(e),e=h.g.M.sum(d.ee,e),d.Xa.translate(e.x,e.y),h.La.Bx(d.Xa);d.Xa.Lg(!0);d.Xa.$o();(e=d.F.qa)&&e.Dw(d.Xa.Cc()?"blocklyToolboxDelete":"blocklyToolboxGrab");Ma(a.qd,a.yd,a.cc); d=!0}else d=!1;else d=!1;if(d=!d)if(a.R)d=a.R.Sy();else if(d=a.wb)d=a.wb,d=d.options.vb&&d.options.vb.Ge;d&&(a.Jf=a.R?new h.Dk(a.R):new h.Fi(a.wb),a.sj=!0,a.Jf.Hp())}h.uf()}a.yd=c} b.Un=function(a){h.g.Ml(a)?this.cancel():(this.Hh=!0,h.La.Sn(),jb(this.wb),this.wb.xj&&this.wb.resize(),za(this.wb),this.yd=a,h.ec(!!this.R),h.D.block(),this.xb&&(!this.xb.cd&&a.shiftKey?(h.navigation.co(),O(this.Hn.ya,h.navigation.vo(this.xb))):this.xb.select()),h.g.Oh(a)?oa(this,a):("touchstart"!=a.type.toLowerCase()&&"pointerdown"!=a.type.toLowerCase()||"mouse"==a.pointerType||h.Wy(a,this),this.Bt=new h.g.M(a.clientX,a.clientY),this.at=a.altKey||a.ctrlKey||a.metaKey,this.Ji(a)))}; b.Ji=function(a){this.Ul=h.Ba(document,"mousemove",null,this.hj.bind(this));this.Vl=h.Ba(document,"mouseup",null,this.zl.bind(this));a.preventDefault();a.stopPropagation()};b.hj=function(a){ib(this,a);this.sj?this.Jf.Ge(this.cc):this.wg?Ma(this.qd,this.yd,this.cc):this.rj&&fb(this.we,this.yd,this.cc);a.preventDefault();a.stopPropagation()}; b.zl=function(a){ib(this,a);h.uf();if(this.Jl)console.log("Trying to end a gesture recursively.");else{this.Jl=!0;if(this.rj)gb(this.we,a,this.cc);else if(this.wg)Qa(this.qd,a,this.cc);else if(this.sj){var c=this.Jf;c.Ge(this.cc);Ca(c.F)}else if(this.Hc&&!this.pg)this.Hc.Oz&&this.Hc.Oz(),this.Hc.select&&this.Hc.select();else if(kb(this))this.Og.Wj(),lb(this);else if(this.Ng&&!this.pg&&!kb(this))this.R&&this.R.on?this.xb.isEnabled()&&(h.i.ub()||h.i.ca(!0),Ta(this.R.Yr(this.xb))):h.i.Ma(new h.i.Qc(this.Ng, "click",void 0,void 0)),lb(this),h.i.ca(!1);else if(!(this.Ng||this.Hc||this.Og||this.pg))if(c=this.Hn,a.shiftKey){h.navigation.co();var d=h.g.Lz(c,new h.g.M(a.clientX,a.clientY));d=h.A.Zi(c,d);O(c.ya,d)}else h.selected&&hb(h.selected);a.preventDefault();a.stopPropagation();this.G()}};b.cancel=function(){if(!this.Jl){h.uf();if(this.rj)gb(this.we,this.yd,this.cc);else if(this.wg)Qa(this.qd,this.yd,this.cc);else if(this.sj){var a=this.Jf;a.Ge(this.cc);Ca(a.F)}this.G()}}; function oa(a,c){a.xb?(lb(a),h.ec(a.R),a.xb.Vj(c)):a.Hc?a.Hc.Vj(c):a.wb&&!a.R&&(h.ec(),a.wb.Vj(c));c.preventDefault();c.stopPropagation();a.G()}function lb(a){a.xb&&!a.R&&Sa(a.xb)}function mb(a,c){c.Qa?mb(a,c.getParent()):a.xb=c}function kb(a){if(a.Og){var c=a.Og;c=!!c.B&&c.B.Dc()&&!!c.Wj&&"function"===typeof c.Wj}else c=!1;return c&&!a.pg&&(!a.R||!a.R.on)}b.lc=function(){return this.sj||this.wg||this.rj};b.Eh=function(){return this.qd?this.qd.Eh():[]}; h.gh.Do=function(){for(var a=h.ab.getAll(),c=0,d;d=a[c];c++)if(d.Db)return!0;return!1};h.xa=function(a,c,d){this.wu=this.zu=this.je=null;this.jb=new h.g.md(0,0);this.Lb=null;d&&this.Ri(d);this.setValue(a);c&&(this.zu=c)};h.xa.eq=16;h.xa.hr=12.5;h.xa.Gi=10;h.xa.yr=10;h.xa.fh=h.xa.Gi/2;b=h.xa.prototype;b.name=void 0;b.yt=50;b.B=null;b.pf=!0;b.If=!0;b.Uk=null;h.xa.Kq="\u00a0";b=h.xa.prototype;b.Gd=!0;b.Zq=!1;b.Ri=function(a){var c=a.tooltip;"string"==typeof c&&(c=h.g.oc(a.tooltip));c&&this.Gf(c)}; b.Pa=function(){this.Wc||(this.Wc=h.g.o.J("g",{},null),this.isVisible()||(this.Wc.style.display="none"),this.B.ga().appendChild(this.Wc),this.nj(),this.jk(),this.Gf(this.wu),h.D.Ji(this.Uk||this.ga()),this.At=h.Ba(this.Uk||this.ga(),"mousedown",this,this.Jj))};b.nj=function(){this.jb.height=Math.max(this.jb.height,h.xa.eq);this.jb.width=Math.max(this.jb.width,h.xa.Gi);this.Ki=h.g.o.J("rect",{rx:4,ry:4,x:0,y:0,height:this.jb.height,width:this.jb.width},this.Wc);nb(this)}; function nb(a){a.Jc=h.g.o.J("text",{"class":"blocklyText",y:h.xa.hr,x:a.Ki?h.xa.fh:0},a.Wc);a.ei=document.createTextNode("");a.Jc.appendChild(a.ei)}b.G=function(){h.w.jj(this);h.V.jj(this);this.At&&h.lb(this.At);h.g.o.removeNode(this.Wc)};b.jk=function(){var a=this.Uk||this.ga();this.Gd&&a&&(this.B.Dc()?(h.g.o.Ab(a,"blocklyEditableText"),h.g.o.Gc(a,"blocklyNonEditableText"),a.style.cursor=this.bv):(h.g.o.Ab(a,"blocklyNonEditableText"),h.g.o.Gc(a,"blocklyEditableText"),a.style.cursor=""))}; b.isVisible=function(){return this.If};b.Yb=function(a){if(this.If!=a){this.If=a;var c=this.ga();c&&(c.style.display=a?"block":"none")}};b.ga=function(){return this.Wc};b.ie=function(){};b.Vh=function(){if(this.ei){this.ei.nodeValue=ob(this);var a=h.g.o.so(this.Jc);this.Ki&&(a+=h.xa.Gi,this.Ki.setAttribute("width",a));this.jb.width=a}}; b.Ie=function(){if(!this.isVisible())return new h.g.md(0,0);this.pf?(this.Vh(),this.pf=!1):this.If&&0==this.jb.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.Vh());return this.jb};function ob(a){var c=a.jf();if(!c)return h.xa.Kq;c.length>a.yt&&(c=c.substring(0,a.yt-2)+"\u2026");c=c.replace(/\s/g,h.xa.Kq);a.B&&a.B.H&&(c+="\u200f");return c}b.jf=function(){if(this.to){var a=this.to.call(this);if(null!==a)return String(a)}return String(this.getValue())}; b.im=function(){throw Error("setText method is deprecated");};b.Ej=function(){this.pf=!0};function pb(a){a.pf=!0;a.B&&a.B.$&&(a.B.wa(),a.B.hc())}b.setValue=function(a){if(null!==a){var c=this.fl(a);a=qb(this,a,c);if(!(a instanceof Error)){if(c=this.zu)if(c=c.call(this,a),a=qb(this,a,c),a instanceof Error)return;c=this.getValue();c!==a&&(this.B&&h.i.isEnabled()&&h.i.Ma(new h.i.$g(this.B,"field",this.name||null,c,a)),this.hl(a),this.pf&&pb(this))}}}; function qb(a,c,d){if(null===d)return a.pf&&pb(a),Error();void 0!==d&&(c=d);return c}b.getValue=function(){return this.je};b.fl=function(a){return null===a||void 0===a?null:a};b.hl=function(a){this.je=a;this.pf=!0};b.Jj=function(a){if(this.B&&this.B.C&&(a=db(this.B.C,a))){if(a.Hh)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");a.Og||(a.Og=this)}};b.Gf=function(a){var c=this.Uk||this.ga();c?c.ge=a||""===a?a:this.B:this.wu=a}; b.Vd=function(){for(var a=null,c=this.B,d=c.K,e=0;ec||c>a.Ea.length)throw Error("index "+c+" out of bounds.");if(!(d||""==d&&e))return c;"string"==typeof d&&(d=new h.Oc(d));if(d.B)throw Error("Field already bound to a block.");d.B=a.B;a.B.$&&d.Pa();d.name=e;d.lp&&(c=rb(a,c,d.lp));a.Ea.splice(c,0,d);++c;d.Kp&&(c=rb(a,c,d.Kp));a.B.$&&(a.B.wa(),a.B.hc());return c}b.isVisible=function(){return this.If}; b.Yb=function(a){var c=[];if(this.If==a)return c;for(var d=(this.If=a)?"block":"none",e=0,f;f=this.Ea[e];e++)f.Yb(a);if(this.connection){if(a)c=sb(this.connection);else if(e=this.connection,R(e,!0),e.ka)for(e=p(A(e),!1),f=0;fa&&0<=c&&256>c&&0<=d&&256>d)?h.g.ob.vp(a,c,d):null}; h.g.ob.vp=function(a,c,d){c=a<<16|c<<8|d;return 16>a?"#"+(16777216|c).toString(16).substr(1):"#"+c.toString(16)};h.g.ob.bt=function(a){a=parseInt(a.substr(1),16);return[a>>16,a>>8&255,a&255]}; h.g.ob.Ey=function(a){var c=h.vv,d=255*h.wv,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.ob.vp(Math.floor(e),Math.floor(f),Math.floor(g))}; h.g.ob.rn=function(a,c,d){a=h.g.ob.bt(h.g.ob.parse(a));c=h.g.ob.bt(h.g.ob.parse(c));return h.g.ob.vp(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.ob.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.rk=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&&!u(a,d)?d:h.g.He();a.sn[this.id]=this;this.N=this.W=this.L=null;this.K=[];this.Le=void 0;this.disabled=!1;this.ge="";this.contextMenu=!0;this.Zd=null;this.ze=[];this.rs=this.Dt=this.Jn=!0;this.Ae=this.Qa=!1;this.Qi=null;this.Be={text:null,St:!1,size:new h.g.md(160,80)};this.Gu=new h.g.M(0,0);this.C=a;this.cd=a.Ne;this.H=a.H; this.vj=!1;this.Je=void 0;if(c){this.type=c;d=h.zb[c];if(!d||"object"!=typeof d)throw TypeError("Unknown block type: "+c);h.g.object.Rh(this,d)}a.ii.push(this);a.Ve[this.type]||(a.Ve[this.type]=[]);a.Ve[this.type].push(this);"function"==typeof this.Pa&&this.Pa();this.Ly=this.Le;if(h.i.isEnabled()){(a=h.i.ub())||h.i.ca(!0);try{h.i.Ma(new h.i.tk(this))}finally{a||h.i.ca(!1)}}if("function"==typeof this.onchange){if((a=this.onchange)&&"function"!=typeof a)throw Error("onchange must be a function.");this.Kj&& h.g.Hi(this.C.Bj,this.Kj);if(this.onchange=a)this.Kj=a.bind(this),$a(this.C,this.Kj)}};b=h.rk.prototype;b.data=null;b.dg="#000000";b.Or=null;b.Pr=null; b.G=function(a){if(this.C){this.Kj&&h.g.Hi(this.C.Bj,this.Kj);h.Oe&&h.navigation.Et(this);B(this,a);h.i.isEnabled()&&h.i.Ma(new h.i.Vu(this));h.i.disable();try{if(this.C){Wa(this.C,this);var c=this.C;c.Ve[this.type].splice(c.Ve[this.type].indexOf(this),1);c.Ve[this.type].length||delete c.Ve[this.type];delete this.C.sn[this.id];this.C=null}h.selected==this&&(h.selected=null);for(var d=this.ze.length-1;0<=d;d--)this.ze[d].G(!1);d=0;for(var e;e=this.K[d];d++)e.G();this.K.length=0;var f=this.Xc(!0);d= 0;for(var g;g=f[d];d++)g.G()}finally{h.i.enable()}}};function B(a,c){if(a.L){var d=null;a.L.isConnected()&&(d=a.L.ka,a.L.disconnect());if(d&&c){a:{c=null;for(var e=0;e=d)this.dg=h.Fy(d);else if(d=h.g.ob.parse(c))this.dg=d;else throw d='Invalid colour: "'+c+'"',a!=c&&(d+=' (from "'+a+'")'),Error(d);}; function z(a,c){for(var d=0,e;e=a.K[d];d++)for(var f=0,g;g=e.Ea[f];f++)if(g.name==c)return g;return null}function na(a){for(var c=0,d;d=a.K[c];c++)for(var e=0;d.Ea[e];e++);return[]}function Fa(a,c){return(a=z(a,c))?a.getValue():null}function wb(a,c){a=z(a,"NAME");if(!a)throw Error('Field "NAME" not found.');a.setValue(c)} b.hm=function(a,c){if(a){void 0===c&&(c=null);if(!this.N){if(this.L)throw Error("Remove output connection prior to adding previous connection.");this.N=this.Dj(h.ld)}this.N.Yh(c)}else if(this.N){if(this.N.isConnected())throw Error("Must disconnect previous statement before removing connection.");this.N.G();this.N=null}}; b.fm=function(a,c){if(a)void 0===c&&(c=null),this.W||(this.W=this.Dj(h.Ca)),this.W.Yh(c);else if(this.W){if(this.W.isConnected())throw Error("Must disconnect next statement before removing connection.");this.W.G();this.W=null}}; b.gm=function(a,c){if(a){void 0===c&&(c=null);if(!this.L){if(this.N)throw Error("Remove previous connection prior to adding output connection.");this.L=this.Dj(h.jd)}this.L.Yh(c)}else if(this.L){if(this.L.isConnected())throw Error("Must disconnect output value before removing connection.");this.L.G();this.L=null}};b.Mg=function(a){this.Le!=a&&(h.i.Ma(new h.i.$g(this,"inline",null,this.Le,a)),this.Le=a)}; function Ga(a){if(void 0!=a.Le)return a.Le;for(var c=1;ca&&(d=d.substring(0,a-3)+"...");return d};function yb(a,c){return a.Xf(h.qe,c||"")} b.Rh=function(a,c){if(void 0!==c&&"boolean"!=typeof c)throw Error("opt_disableCheck must be a boolean if provided");if(!c){c=[];for(var d in a)void 0!==this[d]&&c.push(d);if(c.length)throw Error("Mixin will overwrite block members: "+JSON.stringify(c));}h.g.object.Rh(this,a)};b.Xf=function(a,c){var d=null;if(a==h.Ha||a==h.Ca)d=this.Dj(a);a=new h.Dq(a,c,this,d);this.K.push(a);return a}; b.pp=function(a,c){for(var d=0,e;e=this.K[d];d++)if(e.name==a){e.G();this.K.splice(d,1);return}if(!c)throw Error("Input not found: "+a);};function ia(a,c){for(var d=0,e;e=a.K[d];d++)if(e.name==c)return e;return null}b.Zh=function(a){this.Be.text!=a&&(h.i.Ma(new h.i.$g(this,"comment",null,this.Be.text,a)),this.Qi=this.Be.text=a)};b.Uj=function(){};b.lu=function(){};b.Fa=function(){return this.Gu}; b.moveBy=function(a,c){if(this.Zd)throw Error("Block has parent.");var d=new h.i.li(this);this.Gu.translate(a,c);d.Jg();h.i.Ma(d)};b.Dj=function(a){return new h.aa(this,a)};h.j={};h.j.XB=function(){};h.j.Tf=function(a){this.Rg=a;this.di=h.g.o.J("path",{"class":"blocklyPath"},this.Rg);this.dk=h.g.o.J("path",{"class":"blocklyPathLight"},this.Rg);this.bk=h.g.o.J("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Rg)};h.j.Tf.prototype.Bp=function(a){this.di.setAttribute("d",a);this.dk.style.display="none";this.bk.style.display="none"};h.j.Tf.prototype.eo=function(){this.di.setAttribute("transform","scale(-1 1)")};h.g.Ka={};h.g.Ka.Pu="aria-";h.g.Ka.Xm="role"; h.g.Ka.Zm={pA:"alert",qA:"alertdialog",sA:"application",tA:"article",zA:"banner",DA:"button",FA:"checkbox",KA:"columnheader",LA:"combobox",NA:"complementary",OA:"contentinfo",UA:"definition",YA:"dialog",ZA:"directory",aB:"document",FB:"form",KB:"grid",LB:"gridcell",MB:"group",QB:"heading",UB:"img",fC:"link",gC:"list",hC:"listbox",iC:"listitem",kC:"log",qC:"main",rC:"marquee",sC:"math",Lv:"menu",uC:"menubar",Mv:"menuitem",Nv:"menuitemcheckbox",vC:"menuitemradio",AC:"navigation",DC:"note",YC:"option", iD:"presentation",lD:"progressbar",oD:"radio",pD:"radiogroup",rD:"region",Ym:"row",yD:"rowgroup",zD:"rowheader",BD:"scrollbar",DD:"search",FD:"separator",LD:"slider",OD:"spinbutton",QD:"status",kw:"tab",RD:"table",SD:"tablist",TD:"tabpanel",UD:"textbox",VD:"textinfo",YD:"timer",ZD:"toolbar",$D:"tooltip",aE:"tree",bE:"treegrid",cE:"treeitem"}; h.g.Ka.State={Mu:"activedescendant",uA:"atomic",wA:"autocomplete",CA:"busy",GA:"checked",JA:"colindex",QA:"controls",WA:"describedby",$A:"disabled",fB:"dropeffect",kB:"expanded",EB:"flowto",JB:"grabbed",OB:"haspopup",RB:"hidden",WB:"invalid",$B:"label",aC:"labelledby",eC:"level",jC:"live",xC:"multiline",yC:"multiselectable",ZC:"orientation",$C:"owns",hD:"posinset",jD:"pressed",qD:"readonly",sD:"relevant",vD:"required",AD:"rowindex",$m:"selected",GD:"setsize",MD:"sort",fE:"valuemax",gE:"valuemin", hE:"valuenow",iE:"valuetext"};h.g.Ka.ai=function(a,c){c?a.setAttribute(h.g.Ka.Xm,c):h.g.Ka.Cz(a)};h.g.Ka.TE=function(a){return a.getAttribute(h.g.Ka.Xm)||null};h.g.Ka.Cz=function(a){a.removeAttribute(h.g.Ka.Xm)};h.g.Ka.bi=function(a,c,d){Array.isArray(d)&&(d=d.join(" "));a.setAttribute(h.g.Ka.Ux(c),d)};h.g.Ka.Ux=function(a){return h.g.Ka.Pu+a};h.Pf=function(){h.$b.call(this);this.Ke=-1};h.g.object.S(h.Pf,h.$b);b=h.Pf.prototype;b.Va=function(){var a=document.createElement("div");a.id=this.ib();this.X=a;a.className="goog-menu goog-menu-vertical blocklyNonSelectable";a.tabIndex=0;h.g.Ka.ai(a,this.wp||h.g.Ka.Zm.Lv)};b.focus=function(){var a=this.X;a&&(a.focus(),h.g.o.Ab(a,"focused"))};b.blur=function(){var a=this.X;a&&(a.blur(),h.g.o.Gc(a,"focused"))};b.ai=function(a){this.wp=a}; b.ll=function(){h.Pf.v.ll.call(this);ca(this,function(a){if(a.bd){var c=a.X;c=c.id||(c.id=a.ib());this.wh||(this.wh={});this.wh[c]=a}},this);zb(this)};b.ml=function(){Ab(this,-1);h.Pf.v.ml.call(this)};b.Tn=function(){h.Pf.v.Tn.call(this);h.lb(this.bz);h.lb(this.Oi);h.lb(this.$y);h.lb(this.az);h.lb(this.kz)}; function zb(a){var c=a.X;a.bz=h.Ba(c,"mouseover",a,a.yy,!0);a.Oi=h.Ba(c,"click",a,a.ty,!0);a.$y=h.Ba(c,"mouseenter",a,a.wy,!0);a.az=h.Ba(c,"mouseleave",a,a.xy,!0);a.kz=h.Ba(c,"keydown",a,a.xo)}b.wh=null;function Bb(a,c){if(a.wh)for(var d=a.X;c&&c!==d;){var e=c.id;if(e in a.wh)return a.wh[e];c=c.parentNode}return null}function Cb(a){(a=a.Cb[a.Ke]||null)&&a.Se(!1)}function Ab(a,c){var d=a.Cb[c]||null;d?(d.Se(!0),a.Ke=c):-1c?d-1:c},a.Ke)}function Eb(a,c,d){var e=a.Cb.length;d=c.call(a,0>d?-1:d,e);for(var f=0;f<=e;){var g=a.Cb[d]||null;if(g&&g.isEnabled()){Ab(a,d);break}f++;d=c.call(a,d,e)}}b.yy=function(a){(a=Bb(this,a.target))&&a.isEnabled()&&(this.Cb[this.Ke]||null)!==a&&(Cb(this),this.Se(a))}; b.ty=function(a){var c=Bb(this,a.target),d;if(d=c)c.isEnabled()&&(c.Se(!0),Gb(c)),d=void 0;d&&a.preventDefault()};b.wy=function(){this.focus()};b.xy=function(){this.X&&(this.blur(),Cb(this),Ab(this,-1))};b.xo=function(a){return 0!=this.Cb.length&&Hb(this,a)?(a.preventDefault(),a.stopPropagation(),!0):!1}; function Hb(a,c){var d=a.Cb[a.Ke]||null;if(d&&"function"==typeof d.xo&&d.xo(c))return!0;if(c.shiftKey||c.ctrlKey||c.metaKey||c.altKey)return!1;switch(c.keyCode){case h.g.gb.qq:d&&Gb(d);break;case h.g.gb.pw:Fb(a);break;case h.g.gb.gv:Db(a);break;default:return!1}return!0};h.Gk=function(a,c){h.$b.call(this);this.ff=a;this.setValue(c);this.kl=!0};h.g.object.S(h.Gk,h.$b);b=h.Gk.prototype; b.Va=function(){var a=document.createElement("div");a.id=this.ib();this.X=a;a.className="goog-menuitem goog-option "+(this.kl?"":"goog-menuitem-disabled ")+(this.zn?"goog-option-selected ":"")+(this.ot()?"goog-menuitem-rtl ":"");var c=document.createElement("div");c.className="goog-menuitem-content";a.appendChild(c);if(this.Mi){var d=document.createElement("div");d.className="goog-menuitem-checkbox"}else d=null;d&&c.appendChild(d);c.appendChild(Ib(this));h.g.Ka.ai(a,this.wp||(this.Mi?h.g.Ka.Zm.Nv: h.g.Ka.Zm.Mv));h.g.Ka.bi(a,h.g.Ka.State.$m,this.Mi&&this.zn||!1)};function Ib(a){a=a.ff;"string"===typeof a&&(a=document.createTextNode(a));return a}b.setValue=function(a){this.je=a};b.getValue=function(){return this.je};b.ai=function(a){this.wp=a};function Jb(a,c){if(a.Mi){a.zn=c;var d=a.X;d&&a.isEnabled()&&(c?(h.g.o.Ab(d,"goog-option-selected"),h.g.Ka.bi(d,h.g.Ka.State.$m,!0)):(h.g.o.Gc(d,"goog-option-selected"),h.g.Ka.bi(d,h.g.Ka.State.$m,!1)))}} b.Se=function(a){var c=this.X;c&&this.isEnabled()&&(a?h.g.o.Ab(c,"goog-menuitem-highlight"):h.g.o.Gc(c,"goog-menuitem-highlight"))};b.isEnabled=function(){return this.kl};b.Re=function(a){this.kl=a;(a=this.X)&&(this.kl?h.g.o.Gc(a,"goog-menuitem-disabled"):h.g.o.Ab(a,"goog-menuitem-disabled"))};function Gb(a){a.Mi&&Jb(a,!a.zn);a.Ar&&a.Ar.call(a.Cw,a)}function Kb(a,c,d){a.Ar=c;a.Cw=d};h.g.nm={};h.g.nm.Ie=function(a){a=a.X;var c=h.g.style.Ie(a);c.height=a.scrollHeight;return c};h.g.nm.Ew=function(a,c,d){c.left+=d.width;c.right+=d.width;a.left+=d.width;a.right+=d.width};h.sa={};h.sa.Zk=null;h.sa.us=null;h.sa.show=function(a,c,d){h.V.show(h.sa,d,null);if(c.length){var e=h.sa.zz(c,d);h.sa.Af(e,a,d);setTimeout(function(){e.X.focus()},1);h.sa.Zk=null}else h.sa.Ia()};h.sa.zz=function(a,c){var d=new h.Pf;ea(d,c);for(var e=0,f;f=a[e];e++){var g=new h.Gk(f.text);ea(g,c);da(d,g);g.Re(f.enabled);f.enabled&&Kb(g,function(){h.sa.Ia();this.Bb()},f)}return d}; h.sa.Af=function(a,c,d){var e=h.g.sy();c={top:c.clientY+e.top,bottom:c.clientY+e.top,left:c.clientX+e.left,right:c.clientX+e.left};h.sa.sx(a);var f=h.g.nm.Ie(a);d&&h.g.nm.Ew(e,c,f);h.V.Az(e,c,f,d);a.X.focus()};h.sa.sx=function(a){a.wa(h.V.ua);var c=a.X;h.g.o.Ab(c,"blocklyContextMenu");h.Ba(c,"contextmenu",null,h.g.hz);a.focus()};h.sa.Ia=function(){h.V.jj(h.sa);h.sa.Zk=null;h.sa.us&&h.lb(h.sa.us)}; h.sa.AE=function(a,c){return function(){h.i.disable();try{var d=h.I.il(c,a.C),e=a.Fa();e.x=a.H?e.x-h.Sb:e.x+h.Sb;e.y+=2*h.Sb;d.moveBy(e.x,e.y)}finally{h.i.enable()}h.i.isEnabled()&&!d.Qa&&h.i.Ma(new h.i.tk(d));d.select()}};h.sa.Mw=function(a){var c=p(a,!1).length,d=t(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,Bb:function(){h.i.ca(!0);a.G(!0,!0);h.i.ca(!1)}}}; h.sa.Ow=function(a){return{enabled:!("function"==typeof a.rg?!a.rg():!a.rg),text:h.h.HELP,Bb:function(){var c="function"==typeof a.rg?a.rg():a.rg;c&&window.open(c)}}};h.sa.Nw=function(a){var c=Ya(a.C)?Xa(a.C,h.g.Cs(a)):!0;return{text:h.h.DUPLICATE_BLOCK,enabled:c,Bb:function(){h.qs(a)}}};h.sa.Lw=function(a){var c={enabled:!h.g.userAgent.Xe};a.Qi?(c.text=h.h.REMOVE_COMMENT,c.Bb=function(){a.Zh(null)}):(c.text=h.h.ADD_COMMENT,c.Bb=function(){a.Zh("")});return c}; h.sa.EE=function(a){return{text:h.h.tD,enabled:!0,Bb:function(){h.i.ca(!0);a.G(!0,!0);h.i.ca(!1)}}};h.sa.FE=function(a){return{text:h.h.gB,enabled:!0,Bb:function(){h.qs(a)}}}; h.sa.LF=function(a,c){if(!h.rh)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var d={enabled:!h.g.userAgent.Xe};d.text=h.h.oA;d.Bb=function(){var e=new h.rh(a,h.h.pE,h.rh.fv,h.rh.fv),f=aa(a).getBoundingClientRect();f=new h.g.M(c.clientX-f.left,c.clientY-f.top);var g=h.g.lo(a.kb);f=h.g.M.bl(f,g);f.scale(1/a.scale);e.moveBy(f.x,f.y);a.$&&(e.ug(),e.wa(),e.select())};return d};h.te=function(a,c){h.te.v.constructor.call(this,a,c);this.jg=a.C.Yk[c];this.$r=a.C.Yk[h.mh[c]];this.Eg=new h.g.M(0,0);this.mf=!1;this.dt=!this.jg};h.g.object.S(h.te,h.aa);b=h.te.prototype;b.G=function(){h.te.v.G.call(this);this.mf&&Lb(this.jg,this)};function Mb(a,c){var d=a.fb-c.fb;a=a.Aa-c.Aa;return Math.sqrt(d*d+a*a)} function Nb(a,c){if(!a.B.C.lc()){var d=N(a.B);if(!d.cd){var e=!1;if(!d.mc()){d=N(c.B);if(!d.mc())return;c=a;e=!0}var f=h.selected==d;f||Ob(d);var g=c.fb+h.Sb+Math.floor(Math.random()*h.ym)-a.fb,k=c.Aa+h.Sb+Math.floor(Math.random()*h.ym)-a.Aa;e&&(k=-k);d.H&&(g=c.fb-h.Sb-Math.floor(Math.random()*h.ym)-a.fb);d.moveBy(g,k);f||Pb(d)}}}b.moveTo=function(a,c){this.mf&&Lb(this.jg,this);this.fb=a;this.Aa=c;this.dt||Qb(this.jg,this)};b.moveBy=function(a,c){this.moveTo(this.fb+a,this.Aa+c)}; function Rb(a,c){a.moveTo(c.x+a.Eg.x,c.y+a.Eg.y)}function S(a,c,d){a.Eg.x=c;a.Eg.y=d}function Sb(a){var c=a.ka.fb-a.fb,d=a.ka.Aa-a.Aa;if(0!=c||0!=d){a=A(a);var e=a.ga();if(!e)throw Error("block is not rendered.");e=h.g.Zc(e);a.ga().setAttribute("transform","translate("+(e.x-c)+","+(e.y-d)+")");Ra(a,-c,-d)}} b.closest=function(a,c){var d=this.$r;if(d.pb.length){var e=this.Aa,f=this.fb;this.fb=f+c.x;this.Aa=e+c.y;var g=Tb(d,this);c=null;for(var k=a,l,m=g-1;0<=m&&Math.abs(d.pb[m].Aa-this.Aa)<=a;)l=d.pb[m],this.Hl(l,k)&&(c=l,k=Mb(l,this)),m--;for(;gc?!1:h.te.v.Hl.call(this,a)};b.Tl=function(a){Nb(this,a)};b.Qn=function(a,c){h.te.v.Qn.call(this,a,c);a.$&&a.wa();c.$&&(E(c),c.wa())}; b.up=function(){var a=this.B,c=this.ae;if(a.C&&c&&h.i.Mb){h.te.v.up.call(this);c=A(this);if(!c)throw Error("Couldn't respawn the shadow block that should exist here.");c.ug();c.wa(!1);a.$&&a.wa()}};b.Ft=function(a){return Ub(this.$r,this,a)};b.rd=function(a){h.te.v.rd.call(this,a);var c=this.B;a=a.B;c.$&&E(c);a.$&&E(a);c.$&&a.$&&(this.type==h.Ca||this.type==h.ld?a.wa():c.wa())};b.Jt=function(){this.isConnected()&&!H(this,this.ka)&&(B(I(this)?A(this):this.B),this.B.hc())};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.se=function(a){this.ba=a};b=h.se.prototype;b.Nr=!0;b.Jk=17;b.ag=null;b.Bl=null; function Vb(a){if(!a.Xd){a.Xd=h.g.o.J("g",{"class":"blocklyIconGroup"},null);a.ba.cd&&h.g.o.Ab(a.Xd,"blocklyIconGroupReadonly");var c=a.Xd;h.g.o.J("path",{"class":"blocklyIconShape",d:"M2,15Q-1,15 0.5,12L6.5,1.7Q8,-1 9.5,1.7L15.5,12Q17,15 14,15z"},c);h.g.o.J("path",{"class":"blocklyIconSymbol",d:"m7,4.8v3.16l0.27,2.27h1.46l0.27,-2.27v-3.16z"},c);h.g.o.J("rect",{"class":"blocklyIconSymbol",x:"7",y:"11",height:"2",width:"2"},c);a.ba.ga().appendChild(a.Xd);h.Ba(a.Xd,"mouseup",a,a.Gy);a.jk()}} b.G=function(){h.g.o.removeNode(this.Xd);this.Xd=null;this.Yb(!1);this.ba=null};b.jk=function(){};b.isVisible=function(){return!!this.ag};b.Gy=function(a){this.ba.C.lc()||this.ba.cd||h.g.Oh(a)||this.Yb(!this.isVisible())};b.ie=function(){this.isVisible()&&this.ag.zd(this.ba.dg)};function Na(a,c){a.Bl=c;a.isVisible()&&(a=a.ag,a.mb=c,a.qp&&ab(a))}function Wb(a){var c=a.ba.Fa(),d=h.g.Zc(a.Xd);c=new h.g.M(c.x+d.x+a.Jk/2,c.y+d.y+a.Jk/2);h.g.M.Ud(a.Bl,c)||Na(a,c)};h.Nd=function(a){h.Nd.v.constructor.call(this,a);Vb(this);this.gi={}};h.g.object.S(h.Nd,h.se);h.Nd.prototype.Nr=!1;h.Nd.aA=function(a){var c=h.g.o.J("text",{"class":"blocklyText blocklyBubbleText",y:h.la.Cd},null);a=a.split("\n");for(var d=0;d=a.pb.length)return-1;for(var e=c.Aa,f=d;0<=f&&a.pb[f].Aa==e;){if(a.pb[f]==c)return f;f--}for(;dc.Aa)e=f;else{d=f;break}}return d}function Lb(a,c){if(!c.mf)throw Error("Connection not in database.");var d=ac(a,c);if(-1==d)throw Error("Unable to find connection in connectionDB.");c.mf=!1;a.pb.splice(d,1)} function Ub(a,c,d){function e(n){var q=g-f[n].fb,r=k-f[n].Aa;Math.sqrt(q*q+r*r)<=d&&m.push(f[n]);return rthis.Nj){var d=c-this.Nj;d=0Object.keys(this.Uc).length&&(this.Uc={},this.Nj=0)}!this.Ll||this.lc()?h.Touch.Ep(a)&&h.vc.v.zl.call(this,a):(a.preventDefault(),a.stopPropagation(),this.G())};b.G=function(){h.vc.v.G.call(this);this.hp&&h.lb(this.hp)};function bc(a,c){a.Uc[h.Touch.wl(c)]=cc(a,c);var d=Object.keys(a.Uc);2==d.length&&(a.pu=h.g.M.os(a.Uc[d[0]],a.Uc[d[1]]),a.Ll=!0,c.preventDefault())} function cc(a,c){return a.wb?new h.g.M(c.pageX?c.pageX:c.changedTouches[0].pageX,c.pageY?c.pageY:c.changedTouches[0].pageY):null};h.vr=function(a){this.jp=a;this.zi=Object.create(null)};b=h.vr.prototype;b.Mo=null;b.G=function(){this.zi=this.jp=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=(isNaN(a.options.Fj)?Infinity:a.options.Fj-P(a).length)))if(a.Db&&a.Db.cancel(),"comment"==c.tagName.toLowerCase()){h.i.disable();try{h.rh.setValue(c.textContent);var d=void 0;var e=parseInt(c.getAttribute("x"),10),f=parseInt(c.getAttribute("y"),10);isNaN(e)||isNaN(f)||(a.H&&(e=-e),d.moveBy(e+50,f+50))}finally{h.i.enable()}d.select()}else a:{h.i.disable();try{var g=h.I.il(c,a),k=a.Ec.qb;if(h.Oe&&k){h.navigation.jt(g,k.Z); break a}var l=parseInt(c.getAttribute("x"),10),m=parseInt(c.getAttribute("y"),10);if(!isNaN(l)&&!isNaN(m)){a.H&&(l=-l);do{c=!1;var n=P(a,!1);d=0;for(var q;q=n[d];d++){var r=q.Fa();if(1>=Math.abs(l-r.x)&&1>=Math.abs(m-r.y)){c=!0;break}}if(!c){var v=g.Xc(!1);d=0;for(var w;w=v[d];d++)if(w.closest(h.Sb,new h.g.M(l,m)).connection){c=!0;break}}c&&(l=a.H?l-h.Sb:l+h.Sb,m+=2*h.Sb)}while(c);g.moveBy(l,m)}}finally{h.i.enable()}h.i.isEnabled()&&!g.Qa&&h.i.Ma(new h.i.tk(g));g.select()}} function kc(a){(a=a.Ne?a.Lp:a)&&!a.Db&&a.qa&&a.qa.R&&a.qa.nF()}b.Kg=function(a,c){h.Ua.v.Kg.call(this,a,c);kc(this)};b.Ah=function(a){h.Ua.v.Ah.call(this,a);kc(this)};b.sd=function(a,c,d){a=h.Ua.v.sd.call(this,a,c,d);kc(this);return a};function ec(a){a.fs=a.Nb&&a.P.parentNode?a.Nb.Ds():null;a.ds=a.R?a.R.Ds():a.qa?a.qa.Ds():null}function Oa(a,c){return a.fs&&a.fs.contains(c.clientX,c.clientY)?h.Dm:a.ds&&a.ds.contains(c.clientX,c.clientY)?h.oq:h.nq} b.Jj=function(a){var c=db(this,a);if(c){if(c.Hh)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");c.wb||(c.wb=this);c.yd=a;c.Un(a);h.Oe&&h.navigation.bi(h.navigation.Lk)}};b.Hp=function(a,c){a=h.g.Ij(a,y(this),Aa(this));a.x/=this.scale;a.y/=this.scale;this.ps=h.g.M.bl(c,a)};b.lc=function(){return null!=this.Db&&this.Db.lc()}; function lc(a){return a.options.vb&&a.options.vb.scrollbars||a.options.vb&&a.options.vb.Xg||a.options.vb&&a.options.vb.Ge||a.options.$a&&a.options.$a.controls||a.options.$a&&a.options.$a.Xg}b.mc=function(){return this.options.vb&&this.options.vb.scrollbars||this.options.vb&&this.options.vb.Xg||this.options.vb&&this.options.vb.Ge||this.options.$a&&this.options.$a.Xg}; b.uz=function(a){if(h.gh.Do())a.preventDefault(),a.stopPropagation();else{var c=this.options.$a&&this.options.$a.Xg,d=this.options.vb&&this.options.vb.Xg;if(c||d){var e=h.g.py(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.Ij(a,y(this),Aa(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=Zb(c[0]);for(var d=1;da.bottom&&(a.bottom=e.bottom);e.lefta.right&&(a.right=e.right)}return a}b.$w=function(){this.qc(!1);h.i.ca(!0);for(var a=D(this,!0),c=0,d=0,e;e=a[d];d++)if(e.mc()){var f=e.Fa();e.moveBy(-f.x,c-f.y);Yb(e);c=e.Fa().y+J(e).height+h.ea.Jq}h.i.ca(!1);this.qc(!0)}; b.Vj=function(a){function c(w){if(w.Cc())v=v.concat(p(w,!1));else{w=ma(w,!1);for(var K=0;Kv.length?d():h.confirm(h.h.DELETE_ALL_BLOCKS.replace("%1",v.length),function(w){w&&d()})}};e.push(l);this.Qr&&this.Qr(e);h.sa.show(a,e,this.H)}};function za(a){if(a.options.Fc)za(a.options.Fc);else{h.Cj=a;document.activeElement&&document.activeElement.blur();try{y(a).focus()}catch(c){try{y(a).parentNode.setActive()}catch(d){y(a).parentNode.focus()}}}} b.zoom=function(a,c,d){if(!this.Ne&&!this.xj){d=Math.pow(this.options.$a.Kz,d);var e=this.scale*d;if(this.scale!=e){e>this.options.$a.Gj?d=this.options.$a.Gj/this.scale:ethis.options.$a.Gj?a=this.options.$a.Gj:this.options.$a.Hj&&ak.Au||k.ick.Bu){l=null;g&&(l=h.i.ub(),h.i.ca(g.group));switch(g.type){case h.i.aq:case h.i.bq:var n=u(f,g.Tb);n=N(n);break;case h.i.wk:case h.i.xk:n=f.Wk[g.Qd]||null}if(n){m=Zb(n);m.height=m.bottom-m.top;m.width=m.right-m.left;var q=k.Hb,r=k.Au-m.height;r=Math.max(q,r);q=h.g.Vb.Ni(q,m.top,r)-m.top;r=k.sb;var v=k.Bu-m.width;k.H?r=Math.min(v,r):v=Math.max(r,v);n.moveBy(h.g.Vb.Ni(r, m.left,v)-m.left,q)}g&&(g.group||console.log("WARNING: Moved object in bounds but there was no event group. This may break undo."),null!==l&&h.i.ca(l))}}});h.ek(f);h.V.Va();h.w.Va();h.D.Va();return f}; h.Jy=function(a){var c=a.options,d=y(a);h.Ba(d.parentNode,"contextmenu",null,function(e){h.g.Ml(e)||e.preventDefault()});d=h.Ba(window,"resize",null,function(){h.ec(!0);h.ek(a)});a.cm=d;h.nf.Kw();c.Ko&&(a.qa?a.qa.Pa(a):a.R&&(a.R.Pa(a),a.R.show(c.Ko.childNodes),a.R.vF()));d=h.Da.pc;c.$s&&(d=a.Nb.Pa(d));c.$a&&c.$a.controls&&a.Zg.Pa(d);c.vb&&c.vb.scrollbars?(a.eb=new h.oh(a),a.eb.resize()):a.Tj({x:.5,y:.5});c.Cy&&h.nf.Vy(c.Rt,a)}; h.nf.Kw=function(){h.Ex||(h.Ba(document,"scroll",null,function(){for(var a=h.ab.getAll(),c=0,d;d=a[c];c++)d.kk&&d.kk()}),h.Ba(document,"keydown",null,h.lz),h.Zf(document,"touchend",h.uf),h.Zf(document,"touchcancel",h.uf),h.g.userAgent.wi&&h.Ba(window,"orientationchange",document,function(){h.ek(h.Ya())}));h.Ex=!0}; h.nf.Vy=function(a,c){function d(){for(;f.length;)h.lb(f.pop());e.preload()}var e=c.Od;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.Ba(document,"mousemove",null,d,!0));f.push(h.Ba(document,"touchstart",null,d,!0))};h.Bd=function(a){this.name=a};h.A=function(a,c,d){if(!c)throw Error("Cannot create a node without a location.");this.ik=a;this.qj=h.A.Ny(a);this.Z=c;(a=d||null)&&a.Eu&&(this.Fu=a.Eu)};h.A.types={Nc:"field",uc:"block",re:"input",nh:"output",hd:"next",kd:"previous",Kd:"stack",Wf:"workspace"};h.A.ev=-20;h.A.Ny=function(a){switch(a){case h.A.types.kd:case h.A.types.hd:case h.A.types.re:case h.A.types.nh:return!0}return!1};h.A.Xi=function(a){return new h.A(h.A.types.Nc,a)}; h.A.Rd=function(a){return a?a.type==h.Ha||a.type==h.Ca&&a.Vd()?h.A.fg(a.Vd()):a.type==h.Ca?new h.A(h.A.types.hd,a):a.type==h.jd?new h.A(h.A.types.nh,a):a.type==h.ld?new h.A(h.A.types.kd,a):null:null};h.A.fg=function(a){return a?new h.A(h.A.types.re,a.connection):null};h.A.Ee=function(a){return new h.A(h.A.types.uc,a)};h.A.Yi=function(a){return new h.A(h.A.types.Kd,a)};h.A.Zi=function(a,c){return new h.A(h.A.types.Wf,a,{Eu:c})};b=h.A.prototype;b.cb=function(){return this.ik}; function nc(a,c){a=a.Z;a instanceof h.rk||(a=a.B);if(!a||!a.C)return null;var d=N(a);a=D(d.C,!0);for(var e=0,f;f=a[e];e++)if(d.id==f.id)return c=e+(c?1:-1),-1==c||c==a.length?null:h.A.Yi(a[c]);throw Error("Couldn't find "+(c?"next":"previous")+" stack?!");}function oc(a){if(!a)return null;do var c=a.N&&A(a.N);while(c&&t(c)==a&&(a=c));return(c=a.N||a.L)&&c.ka&&c.ka.Vd()?h.A.fg(c.ka.Vd()):h.A.Yi(a)} b.next=function(){switch(this.ik){case h.A.types.Kd:return nc(this,!0);case h.A.types.nh:return h.A.Ee(this.Z.B);case h.A.types.Nc:a:{var a=this.Z,c=a.Vd();var d=a.B;a=c.Ea.indexOf(a)+1;c=d.K.indexOf(c);for(var e;e=d.K[c];c++){for(var f=e.Ea;a1'), e.appendChild(d),c.push(e));if(h.zb.variables_get){a.sort(h.Pk.ix);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.na.ho(f)),c.push(e)}}return c}; h.na.Rx=function(a){a=a.ng();var c="";if(a.length)for(var d=1,e=0,f="ijkmnopqrstuvwxyzabcdefgh".charAt(e);!c;){for(var g=!1,k=0;kf?h.V.Mj(a,0,d.height+f):h.V.Mj(a,f,d.height)};h.V.Sw=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.V.Tw=function(a,c,d){return c.bottom+d.height>=a.bottom?c.top-d.height:c.bottom};h.VERSION="uncompiled";h.Cj=null;h.selected=null;h.cursor=null;h.Oe=!1;h.cj=[];h.Pi=null;h.Vk=null;h.Bn=null;h.xE=null;h.uu=function(a){return{width:a.Gr,height:a.Er}};h.sF=function(a){F(a)};h.ek=function(a){for(;a.options.Fc;)a=a.options.Fc;var c=y(a),d=c.parentNode;if(d){var e=d.offsetWidth;d=d.offsetHeight;c.Gr!=e&&(c.setAttribute("width",e+"px"),c.Gr=e);c.Er!=d&&(c.setAttribute("height",d+"px"),c.Er=d);a.resize()}}; h.lz=function(a){var c=h.Cj;if(!(h.g.Ml(a)||c.$&&!c.isVisible()))if(c.options.readOnly)h.navigation.Kt(a);else{var d=!1;if(a.keyCode==h.g.gb.rq)h.ec(),h.navigation.Fg(h.navigation.qm);else{if(h.navigation.Kt(a))return;if(a.keyCode==h.g.gb.Su||a.keyCode==h.g.gb.pi){a.preventDefault();if(h.gh.Do())return;h.selected&&h.selected.Cc()&&(d=!0)}else if(a.altKey||a.ctrlKey||a.metaKey){if(h.gh.Do())return;h.selected&&h.selected.Cc()&&h.selected.mc()&&(a.keyCode==h.g.gb.Wu?(h.ec(),h.Gn(h.selected)):a.keyCode!= h.g.gb.xr||h.selected.C.Ne||(h.Gn(h.selected),d=!0));a.keyCode==h.g.gb.qw?h.Pi&&(a=h.Vk,a.Ne&&(a=a.Lp),h.Bn&&Xa(a,h.Bn)&&(h.i.ca(!0),jc(a),h.i.ca(!1))):a.keyCode==h.g.gb.xw&&(h.ec(),c.Qp(a.shiftKey))}}d&&!h.selected.C.Ne&&(h.i.ca(!0),h.ec(),h.selected.G(!0,!0),h.i.ca(!1))}};h.Gn=function(a){if(a.mt)var c=a.Mp();else{c=h.I.$f(a,!0);h.I.vx(c);var d=a.Fa();c.setAttribute("x",a.H?-d.x:d.x);c.setAttribute("y",d.y)}h.Pi=c;h.Vk=a.C;h.Bn=a.mt?null:h.g.Cs(a)}; h.qs=function(a){var c=h.Pi,d=h.Vk;h.Gn(a);jc(a.C);h.Pi=c;h.Vk=d};h.lF=function(a){h.g.Ml(a)||a.preventDefault()};h.ec=function(a){h.D.Ia();h.V.Ia();h.w.Bo();a||(a=h.Ya(),a.Nb&&a.Nb.R&&a.Nb.R.Ia(),a.qa&&a.qa.R&&a.qa.R.on&&a.qa.CE())};h.Ya=function(){return h.Cj};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.Ty=function(a){return function(){var c=a.type?'Block "'+a.type+'": ':"";if(a.output&&a.previousStatement)throw Error(c+"Must not have both an output and a previousStatement.");a.style&&a.style.Je&&(this.Je=a.style.Je,a.style=null);if(a.style&&a.colour)throw Error(c+"Must not have both a colour and a style.");if(a.style){var d=a.style;try{var e=this.C.uo().Pw[d];if(e)this.Or=e.colourSecondary,this.Pr=e.colourTertiary,this.Je=e.Je,this.zd(e.colourPrimary);else throw Error("Invalid style name: "+d); }catch(r){console.warn(c+"Style does not exist: ",d)}}else if("colour"in a)if(void 0===a.colour)console.warn(c+"Undefined colour value.");else{d=a.colour;try{this.zd(d)}catch(r){console.warn(c+"Illegal colour value: ",d)}}for(d=0;void 0!==a["message"+d];){var f=a["args"+d]||[],g=a["lastDummyAlign"+d],k=h.g.dA(a["message"+d]),l=[],m=0;e=[];for(var n=0;n=q||q>f.length)throw Error('Block "'+this.type+'": Message index %'+q+" out of range.");if(l[q])throw Error('Block "'+ this.type+'": Message index %'+q+" duplicated.");l[q]=!0;m++;e.push(f[q-1])}else(q=q.trim())&&e.push(q)}if(m!=f.length)throw Error('Block "'+this.type+'": Message does not reference all '+f.length+" arg(s).");e.length&&("string"==typeof e[e.length-1]||h.g.Ga.startsWith(e[e.length-1].type,"field_"))&&(n={type:"input_dummy"},g&&(n.align=g),e.push(n));g={LEFT:h.tm,RIGHT:h.nk,CENTRE:h.Vp};f=[];for(n=0;nk[0]?1:g[0]=a.options.length&&(a.style.display="none")}for(d=1;10>= d;d++)a=document.getElementById("level"+d),c=!!zc(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(Ac,1)}function zc(a){var c=Bc;try{var d=window.localStorage[c+a]}catch(e){}return d}function W(a){var c=Cc(a);return null===c?"[Unknown message: "+a+"]":c} function Cc(a){return(a=document.getElementById(a))?(a=a.textContent,a=a.replace(/\\n/g,"\n")):null}function Dc(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 Ac(){if(!sc){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.s={};h.g.s.va=function(a,c){return" "+a+","+c+" "};h.g.s.curve=function(a,c){return" "+a+c.join("")};h.g.s.moveTo=function(a,c){return" M "+a+","+c+" "};h.g.s.moveBy=function(a,c){return" m "+a+","+c+" "};h.g.s.lineTo=function(a,c){return" l "+a+","+c+" "};h.g.s.line=function(a){return" l"+a.join("")};h.g.s.O=function(a,c){return" "+a+" "+c+" "};h.g.s.arc=function(a,c,d,e){return a+" "+d+" "+d+" "+c+e};h.j.Mf=function(){this.Jd=0;this.cw=3;this.Id=5;this.Iq=8;this.bc=10;this.gr=this.Id;this.cn=15;this.Ai=5;this.Vf=8;this.Uv=15;this.Tv=4;this.Pv=12;this.kv=16;this.me=8;this.Hk=15;this.hw=0;this.iw=20;this.Tu=4;this.fw=15;this.gw=100;this.ew=15;this.Om=24;this.nv=14.5;this.mv=this.cn+11;this.pv=2;this.ov=this.Om;this.$q=h.g.s.moveBy(0,0);this.Cv=12;this.Dv=6};b=h.j.Mf.prototype; b.Pa=function(){this.jh=this.Ro();this.kh=this.So();this.ue=this.Uo();this.Sf=this.To();var a=this.me,c=h.g.s.arc("a","0 0,0",a,h.g.s.va(-a,a)),d=h.g.s.arc("a","0 0,0",a,h.g.s.va(a,a));this.ui={width:a,height:a,kp:c,Yl:d};c=this.me;a=h.g.s.moveBy(0,c)+h.g.s.arc("a","0 0,1",c,h.g.s.va(c,-c));c=h.g.s.arc("a","0 0,1",c,h.g.s.va(-c,-c));this.Nq={Op:a,un:c}};b.Ro=function(){var a=this.Cv,c=this.Dv,d=h.g.s.line([h.g.s.va(6,3),h.g.s.va(-12,6),h.g.s.va(6,3)]);return{height:a,width:c,path:d}}; b.Uo=function(){var a=this.fw,c=this.gw,d=h.g.s.curve("c",[h.g.s.va(30,-a),h.g.s.va(70,-a),h.g.s.va(c,0)]);return{height:a,width:c,path:d}};b.To=function(){function a(g){g=g?-1:1;var k=-g,l=d/2,m=h.g.s.va(c,g*l);return h.g.s.curve("c",[h.g.s.va(0,g*(l+2.5)),h.g.s.va(-c,k*(l+.5)),h.g.s.va(-c,g*l)])+h.g.s.curve("s",[h.g.s.va(c,2.5*k),m])}var c=this.Vf,d=this.cn,e=a(!0),f=a(!1);return{width:c,height:d,ed:f,Lj:e}}; b.So=function(){function a(k){return h.g.s.line([h.g.s.va(k*e,d),h.g.s.va(3*k,0),h.g.s.va(k*e,-d)])}var c=this.Uv,d=this.Tv,e=(c-3)/2,f=a(1),g=a(-1);return{width:c,height:d,zf:f,Qt:g}};h.j.m={NONE:0,Nc:1,uq:2,wq:4,an:8,$p:16,Aq:32,tq:64,re:128,yq:256,cr:512,Zu:1024,Tm:2048,Pm:4096,Wv:8192,Bm:16384,Lm:32768,Km:65536,Wm:131072,Vm:262144,Eq:524288,Ym:1048576,hn:2097152,wm:4194304,zq:8388608};h.j.m.dC=h.j.m.Lm|h.j.m.Km;h.j.m.xD=h.j.m.Wm|h.j.m.Vm;h.j.m.cp=16777216;h.j.m.cb=function(){h.j.m.hasOwnProperty(void 0)||(h.j.m[void 0]=h.j.m.cp,h.j.m.cp<<=1);return h.j.m[void 0]};h.j.m.uj=function(a){return a.type&h.j.m.Nc};h.j.m.xg=function(a){return a.type&h.j.m.uq}; h.j.m.Lh=function(a){return a.type&h.j.m.wq};h.j.m.xd=function(a){return a.type&h.j.m.an};h.j.m.aF=function(a){return a.type&h.j.m.Aq};h.j.m.wd=function(a){return a.type&h.j.m.re};h.j.m.tj=function(a){return a.type&h.j.m.tq};h.j.m.qf=function(a){return a.type&h.j.m.yq};h.j.m.yj=function(a){return a.type&h.j.m.cr};h.j.m.Nh=function(a){return a.type&h.j.m.Tm};h.j.m.tf=function(a){return a.type&h.j.m.Pm};h.j.m.Ry=function(a){return a.type&(h.j.m.Tm|h.j.m.Pm)};h.j.m.sf=function(a){return a.type&h.j.m.Km}; h.j.m.dF=function(a){return a.type&h.j.m.Vm};h.j.m.wj=function(a){return a.type&h.j.m.Lm};h.j.m.eF=function(a){return a.type&h.j.m.Wm};h.j.m.ZE=function(a){return a.type&h.j.m.Bm};h.j.m.nt=function(a){return a.type&h.j.m.Eq};h.j.m.fF=function(a){return a.type&h.j.m.Ym};h.j.m.XE=function(a){return a.type&h.j.m.$p};h.j.m.Nl=function(a){return a.type&h.j.m.hn};h.j.m.Gl=function(a){return a.type&h.j.m.wm};h.j.m.gF=function(a){return a.type&(h.j.m.hn|h.j.m.wm)};h.j.m.bF=function(a){return a.type&h.j.m.zq};h.j.Ze=function(a){this.height=this.width=0;this.type=h.j.m.NONE;this.cf=this.ta=0;this.u=a;this.dd=this.u.Hk};h.j.aa=function(a,c){h.j.aa.v.constructor.call(this,a);this.En=c;a:switch(a=this.u,c.type){case h.Ha:case h.jd:c=a.Sf;break a;case h.ld:case h.Ca:c=a.kh;break a;default:throw Error("Unknown connection type");}this.shape=c;this.type|=h.j.m.Zu};h.g.object.S(h.j.aa,h.j.Ze);h.j.Sm=function(a,c){h.j.Sm.v.constructor.call(this,a,c);this.type|=h.j.m.Wv;this.height=this.shape.height;this.width=this.shape.width;this.Vc=this.u.Ai;this.Ic=this.width};h.g.object.S(h.j.Sm,h.j.aa); h.j.Um=function(a,c){h.j.Um.v.constructor.call(this,a,c);this.type|=h.j.m.Tm;this.height=this.shape.height;this.width=this.shape.width};h.g.object.S(h.j.Um,h.j.aa);h.j.Qm=function(a,c){h.j.Qm.v.constructor.call(this,a,c);this.type|=h.j.m.Pm;this.height=this.shape.height;this.width=this.shape.width};h.g.object.S(h.j.Qm,h.j.aa);h.j.xi=function(a,c){h.j.xi.v.constructor.call(this,a,c.connection);this.type|=h.j.m.re;this.input=c;this.align=c.align;(this.eg=c.connection&&A(c.connection)?A(c.connection):null)?(a=J(this.eg),this.Si=a.width,this.Xk=a.height):this.Xk=this.Si=0;this.connection=c.connection;this.Vc=0};h.g.object.S(h.j.xi,h.j.aa); h.j.Ye=function(a,c){h.j.Ye.v.constructor.call(this,a,c);this.type|=h.j.m.yq;this.eg?(this.width=this.Si,this.height=this.Xk):(this.height=this.u.mv,this.width=this.shape.width+this.u.nv);this.Vc=this.u.Ai;this.Ti=this.shape.height;this.ef=this.shape.width};h.g.object.S(h.j.Ye,h.j.xi);h.j.bf=function(a,c){h.j.bf.v.constructor.call(this,a,c);this.type|=h.j.m.cr;this.height=this.eg?this.Xk+this.u.hw:this.u.ov;this.width=this.u.Hk+this.shape.width};h.g.object.S(h.j.bf,h.j.xi); h.j.Ck=function(a,c){h.j.Ck.v.constructor.call(this,a,c);this.type|=h.j.m.tq;this.height=this.eg?this.Xk-2*this.u.Ai:this.shape.height;this.width=this.shape.width+this.u.pv;this.Vc=this.u.Ai;this.Ti=this.shape.height;this.ef=this.shape.width};h.g.object.S(h.j.Ck,h.j.xi);h.j.se=function(a,c){h.j.se.v.constructor.call(this,a);this.icon=c;this.isVisible=c.isVisible();this.type|=h.j.m.wq;a=new h.g.md(h.se.prototype.Jk,h.se.prototype.Jk-2);this.height=a.height;this.width=a.width};h.g.object.S(h.j.se,h.j.Ze);h.j.Jm=function(a){h.j.Jm.v.constructor.call(this,a);this.type|=h.j.m.Eq;this.height=this.u.jh.height;this.width=this.u.jh.width};h.g.object.S(h.j.Jm,h.j.Ze); h.j.xa=function(a,c){h.j.xa.v.constructor.call(this,a);this.vs=c;this.Dc=c.Gd&&!!c.B&&c.B.Dc();this.Ox=c.Is();this.type|=h.j.m.Nc;a=this.vs.Ie();this.height=a.height;this.width=a.width};h.g.object.S(h.j.xa,h.j.Ze);h.j.Gm=function(a){h.j.Gm.v.constructor.call(this,a);this.type|=h.j.m.uq;this.height=this.u.ue.height;this.width=this.u.ue.width;this.uh=this.height};h.g.object.S(h.j.Gm,h.j.Ze); h.j.Ok=function(a,c){h.j.Ok.v.constructor.call(this,a);this.type=(c&&"left"!=c?h.j.m.Wm:h.j.m.Lm)|h.j.m.Bm;this.width=this.height=this.u.Jd};h.g.object.S(h.j.Ok,h.j.Ze);h.j.Ik=function(a,c){h.j.Ik.v.constructor.call(this,a);this.type=(c&&"left"!=c?h.j.m.Vm:h.j.m.Km)|h.j.m.Bm;this.width=this.u.me;this.height=this.u.me/2};h.g.object.S(h.j.Ik,h.j.Ze);h.j.hh=function(a,c){h.j.hh.v.constructor.call(this,a);this.type=this.type|h.j.m.an|h.j.m.Aq;this.width=c;this.height=this.u.ew};h.g.object.S(h.j.hh,h.j.Ze);h.j.Uf=function(a){this.type=h.j.m.Ym;this.elements=[];this.ta=this.Jb=this.ke=this.minWidth=this.minHeight=this.width=this.height=0;this.Ys=this.Al=this.zo=this.dc=this.qg=!1;this.u=a;this.dd=this.u.Hk};h.j.Uf.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.");};function X(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(h.j.m.wd(d))return d;return null}h.j.Uf.prototype.Ip=function(){return!0};h.j.Uf.prototype.ts=function(){return!0}; function Ec(a){for(var c=a.elements.length-1,d;d=a.elements[c];c--)if(h.j.m.xd(d))return d;return null}h.j.qh=function(a){h.j.qh.v.constructor.call(this,a);this.type|=h.j.m.hn;this.uh=this.xe=0;this.By=!1;this.connection=null};h.g.object.S(h.j.qh,h.j.Uf);h.j.qh.prototype.Ao=function(a){var c=a.Je?"cap"===a.Je:h.ea.ue,d=a.N&&A(a.N);return!!a.L||c||(d?t(d)==a:!1)}; h.j.qh.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,h.j.m.xd(f)||(h.j.m.xg(f)?d=Math.max(d,f.uh):a=Math.max(a,f.height));this.width=Math.max(this.minWidth,c);this.height=Math.max(this.minHeight,a)+d;this.xe=this.uh=d;this.ke=this.width};h.j.qh.prototype.Ip=function(){return!1};h.j.ah=function(a){h.j.ah.v.constructor.call(this,a);this.type|=h.j.m.wm;this.Zs=!1;this.connection=null;this.Yf=this.bj=0};h.g.object.S(h.j.ah,h.j.Uf); h.j.ah.prototype.Ao=function(a){return!!a.L||!!t(a)};h.j.ah.prototype.measure=function(){for(var a=0,c=0,d=0,e=0,f;f=this.elements[e];e++)c+=f.width,h.j.m.xd(f)||(h.j.m.tf(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.bj=d;this.ke=this.width};h.j.ah.prototype.Ip=function(){return!1}; h.j.Nk=function(a,c,d){h.j.Nk.v.constructor.call(this,a);this.type=this.type|h.j.m.an|h.j.m.$p;this.width=d;this.height=c;this.As=!1;this.ke=0;this.elements=[new h.j.hh(this.u,d)]};h.g.object.S(h.j.Nk,h.j.Uf);h.j.Nk.prototype.measure=function(){};h.j.ih=function(a){h.j.ih.v.constructor.call(this,a);this.type|=h.j.m.zq;this.Sr=0};h.g.object.S(h.j.ih,h.j.Uf); h.j.ih.prototype.measure=function(){this.width=this.minWidth;this.height=this.minHeight;for(var a=0,c=0,d;d=this.elements[c];c++)this.width+=d.width,h.j.m.wd(d)&&(h.j.m.yj(d)?a+=d.Si:h.j.m.tj(d)&&0!=d.Si&&(a+=d.Si-d.ef)),h.j.m.xd(d)||(this.height=Math.max(this.height,d.height));this.Sr=a;this.ke=this.width+a};h.j.ih.prototype.ts=function(){return!this.qg&&!this.dc};h.j.$e=function(a,c){this.ba=c;this.Df=a;this.u=this.Df.u;this.L=c.L?new h.j.Sm(this.u,c.L):null;this.Jo=Ga(c)&&!c.isCollapsed();this.isCollapsed=c.isCollapsed();this.rf=c.rf();this.H=c.H;this.Pg=this.width=this.ji=this.height=0;this.rows=[];this.ct=[];this.rb=new h.j.qh(this.u);this.bb=new h.j.ah(this.u);this.jm=this.Ic=0};b=h.j.$e.prototype; b.measure=function(){var a=this.ba.Je?"cap"===this.ba.Je:h.ea.ue,c=!!this.ba.N;this.rb.Ao(this.ba)?this.rb.elements.push(new h.j.Ok(this.u)):this.rb.elements.push(new h.j.Ik(this.u));a?(a=new h.j.Gm(this.u),this.rb.elements.push(a),this.rb.xe=a.uh):c&&(this.rb.By=!0,this.rb.connection=new h.j.Um(this.u,this.ba.N),this.rb.elements.push(this.rb.connection));this.ba.K.length&&this.ba.K[0].type==h.Ca&&!this.ba.isCollapsed()?this.rb.minHeight=this.u.bc:this.rb.minHeight=this.u.Id;this.rows.push(this.rb); a=new h.j.ih(this.u);var d=M(this.ba);if(d.length){c=0;for(var e;e=d[c];c++){var f=new h.j.se(this.u,e);this.isCollapsed&&e.Nr?this.ct.push(f):a.elements.push(f)}}e=null;for(c=0;d=this.ba.K[c];c++)if(d.isVisible()){!e||d.type!=h.Ca&&e.type!=h.Ca&&(d.type!=h.Ha&&d.type!=h.qe||this.Jo)||(this.rows.push(a),a=new h.j.ih(this.u));for(e=0;f=d.Ea[e];e++)a.elements.push(new h.j.xa(this.u,f,d));this.Br(d,a);e=d}this.isCollapsed&&(a.Ys=!0,a.elements.push(new h.j.Jm(this.u)));(a.elements.length||a.Al)&&this.rows.push(a); this.bb.Zs=!!this.ba.W;this.bb.minHeight=this.ba.K.length&&this.ba.K[this.ba.K.length-1].type==h.Ca?this.u.bc:this.u.Id-1;this.bb.Ao(this.ba)?this.bb.elements.push(new h.j.Ok(this.u)):this.bb.elements.push(new h.j.Ik(this.u));this.bb.Zs&&(this.bb.connection=new h.j.Qm(this.u,this.ba.W),this.bb.elements.push(this.bb.connection));this.rows.push(this.bb);for(a=0;c=this.rows[a];a++){d=c.elements;c.elements=[];c.Ip()&&c.elements.push(new h.j.hh(this.u,this.ul(null,d[0])));for(e=0;ea.fc&&(a.T+=h.g.s.O("V",c.Jb+c.height-a.fc)))};h.U.Tf=function(a){this.Rg=a;this.bk=h.g.o.J("path",{"class":"blocklyPathDark",transform:"translate(1,1)"},this.Rg);this.di=h.g.o.J("path",{"class":"blocklyPath"},this.Rg);this.dk=h.g.o.J("path",{"class":"blocklyPathLight"},this.Rg)};h.U.Tf.prototype.Bp=function(a,c){this.di.setAttribute("d",a);this.bk.setAttribute("d",a);this.dk.setAttribute("d",c)}; h.U.Tf.prototype.eo=function(){this.di.setAttribute("transform","scale(-1 1)");this.dk.setAttribute("transform","scale(-1 1)");this.bk.setAttribute("transform","translate(1,1) scale(-1 1)")};h.U.Ye=function(a,c){h.U.Ye.v.constructor.call(this,a,c);this.eg&&(this.width+=this.u.ac,this.height+=this.u.ac)};h.g.object.S(h.U.Ye,h.j.Ye);h.U.bf=function(a,c){h.U.bf.v.constructor.call(this,a,c);this.eg&&(this.height+=this.u.ac)};h.g.object.S(h.U.bf,h.j.bf);h.U.$e=function(a,c){h.U.$e.v.constructor.call(this,a,c)};h.g.object.S(h.U.$e,h.j.$e);b=h.U.$e.prototype;b.Br=function(a,c){this.Jo&&a.type==h.Ha?(c.elements.push(new h.U.Ye(this.u,a)),c.zo=!0):a.type==h.Ca?(c.elements.push(new h.U.bf(this.u,a)),c.dc=!0):a.type==h.Ha?(c.elements.push(new h.j.Ck(this.u,a)),c.qg=!0):a.type==h.qe&&(c.Al=!0)}; b.ul=function(a,c){if(!a)return c&&h.j.m.uj(c)&&c.Dc?this.u.Id:c&&h.j.m.qf(c)?this.u.Iq:c&&h.j.m.yj(c)?this.u.iw:this.u.bc;if(!h.j.m.wd(a)&&!c)return h.j.m.uj(a)&&a.Dc?this.u.Id:h.j.m.Lh(a)?2*this.u.bc+1:h.j.m.xg(a)?this.u.Jd:h.j.m.Ry(a)?this.u.bc:h.j.m.sf(a)?this.u.Pv:h.j.m.nt(a)?this.u.Jd:this.u.bc;if(h.j.m.wd(a)&&!c){if(h.j.m.tj(a))return this.u.Jd;if(h.j.m.qf(a))return this.u.bc;if(h.j.m.yj(a))return this.u.Jd}if(!h.j.m.wd(a)&&c&&h.j.m.wd(c)){if(a.Dc){if(h.j.m.qf(c)||h.j.m.tj(c))return this.u.cw}else{if(h.j.m.qf(c)|| h.j.m.tj(c))return this.u.Iq;if(h.j.m.yj(c))return this.u.bc}return this.u.bc-1}if(h.j.m.Lh(a)&&c&&!h.j.m.wd(c))return this.u.bc;if(h.j.m.qf(a)&&c&&!h.j.m.wd(c))return c.Dc?this.u.Id:this.u.bc;if(h.j.m.wj(a)&&c){if(h.j.m.xg(c))return this.u.Jd;if(h.j.m.Nh(c))return c.dd;if(h.j.m.tf(c))return a=(this.H?1:-1)*this.u.ac/2,c.dd+a}if(h.j.m.sf(a)&&c){if(h.j.m.Nh(c))return c.dd-this.u.me;if(h.j.m.tf(c))return a=(this.H?1:-1)*this.u.ac/2,c.dd-this.u.me+a}return!h.j.m.wd(a)&&c&&!h.j.m.wd(c)&&a.Dc==c.Dc||c&& h.j.m.nt(c)?this.u.bc:this.u.Id};b.kn=function(a,c){a:{var d=0;for(var e;e=a.elements[d];d++)if(h.j.m.xd(e)){d=e;break a}d=null}e=Ec(a);if(a.qg||a.dc)a.ke+=c;var f=X(a);f?f.align==h.tm?e.width+=c:f.align==h.Vp?(d.width+=c/2,e.width+=c/2):f.align==h.nk&&(d.width+=c):e.width+=c;a.width+=c};b.Ns=function(a,c){return h.j.m.Nl(a)&&h.j.m.Gl(c)?this.u.kv:h.j.m.Nl(a)||h.j.m.Gl(c)?this.u.Jd:a.qg&&c.qg?this.u.bc:!a.dc&&c.dc?this.u.Tu:a.dc&&c.dc||!a.dc&&c.Al?this.u.bc:this.u.Id}; b.Hs=function(a,c){if(h.j.m.xd(c))return a.Jb+c.height/2;if(h.j.m.Gl(a))return a=a.Jb+a.height-a.bj,h.j.m.tf(c)?a+c.height/2:a-c.height/2;if(h.j.m.Nl(a))return h.j.m.xg(c)?a.xe-c.height/2:a.xe+c.height/2;var d=a.Jb;h.j.m.uj(c)||h.j.m.Lh(c)?(d+=c.height/2,(a.zo||a.dc)&&c.height+this.u.gr<=a.height&&(d+=this.u.gr)):d=h.j.m.qf(c)?d+c.height/2:d+a.height/2;return d}; b.ws=function(){for(var a=0,c=0,d=0,e;e=this.rows[d];d++){e.Jb=c;e.ta=this.Ic;c+=e.height;a=Math.max(a,e.ke);var f=c-this.rb.uh;e==this.bb&&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},bp:function(){10>V?window.location=window.location.protocol+"//"+window.location.host+window.location.pathname+"?lang="+U+"&level="+(V+1):Z.mj()},et: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.kj[f];f++)d.Se(!1);a.kj.length= 0}if(d=e?u(a,e):null)(c=void 0===c||c)?-1==a.kj.indexOf(d)&&a.kj.push(d):h.g.Hi(a.kj,d),d.Se(c)},Ky:function(a,c){a=document.getElementById(a);a.firstChild||(a=h.nf(a,{rtl:tc(),readOnly:!0}),"string"!=typeof c&&(c=c.join("")),h.I.Fe(h.I.Ue(c),a))},Zz:function(a){a=a.replace(/(,\s*)?'block_id_[^']+'\)/g,")");return a.replace(/\s+$/,"")},gf:function(a){if("click"==a.type&&"touchend"==Z.gf.op&&Z.gf.mp+2E3>Date.now()||Z.gf.op==a.type&&Z.gf.mp+400>Date.now())return a.preventDefault(),a.stopPropagation(), !0;Z.gf.op=a.type;Z.gf.mp=Date.now();return!1}};Z.gf.op=null;Z.gf.mp=0;Z.VE=function(){var a=document.createElement("script");a.type="text/javascript";a.src="third-party/JS-Interpreter/compressed.js";document.head.appendChild(a)};Z.WE=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=Z;Z.setCode=Z.iu;Z.getCode=Z.jo;Z.getWorkspace=Z.yl;var Y={Me:!1,hs:null,al:null,ci:function(a,c,d,e,f,g){function k(){Y.Me&&(l.style.visibility="visible",l.style.zIndex=10,m.style.visibility="hidden")}if(!a)throw TypeError("Content not found: "+a);Y.Me&&Y.Bc(!1);h.Ya()&&h.ec(!0);Y.Me=!0;Y.hs=c;Y.al=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),Y.Kn=h.Zf(e,"mousedown",Y.wx));l.appendChild(a);a.className=a.className.replace("dialogHiddenContent","");d&&c?(Y.Rl(c,!1,.2),Y.Rl(l,!0,.8),setTimeout(k,175)):k()},js:0,ks:0,wx:function(a){Y.Nn();if(!h.g.Oh(a)){var c=document.getElementById("dialog");Y.js=c.offsetLeft-a.clientX;Y.ks=c.offsetTop-a.clientY;Y.Mn=h.Zf(document,"mouseup",Y.Nn);Y.Ln=h.Zf(document,"mousemove",Y.xx);a.stopPropagation()}},xx:function(a){var c=document.getElementById("dialog"),d=Y.js+a.clientX; a=Y.ks+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"},Nn:function(){Y.Mn&&(h.lb(Y.Mn),Y.Mn=null);Y.Ln&&(h.lb(Y.Ln),Y.Ln=null)},Bc:function(a){function c(){e.style.zIndex=-1;e.style.visibility="hidden";document.getElementById("dialogBorder").style.visibility="hidden"}if(Y.Me){Y.Nn();Y.Kn&&(h.lb(Y.Kn),Y.Kn=null);Y.Me=!1;Y.al&&Y.al();Y.al=null;var d=!1===a?null:Y.hs;a=document.getElementById("dialog"); var e=document.getElementById("dialogShadow");e.style.opacity=0;d&&a?(Y.Rl(a,!1,.8),Y.Rl(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)}},Rl: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=Y.Vx(a);c?(f.className="dialogAnimate",setTimeout(e,1)):(f.className="",e());f.style.visibility="visible"}},Vx:function(a){var c=h.g.style.no(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},tu:function(a,c){var d=document.getElementById("containerStorage");d.textContent="";c=c.split("\n");for(var e=0;eV?W("Games_nextLevel").replace("%1",String(V+1)):W("Games_finalLevel");c=document.getElementById("doneCancel");c.addEventListener("click", Y.Bc,!0);c.addEventListener("touchend",Y.Bc,!0);c=document.getElementById("doneOk");c.addEventListener("click",Z.bp,!0);c.addEventListener("touchend",Z.bp,!0);Y.ci(a,null,!1,!0,{width:"40%",left:"30%",top:"3em"},function(){document.body.removeEventListener("keydown",Y.Rr,!0)});document.body.addEventListener("keydown",Y.Rr,!0);document.getElementById("dialogDoneText").textContent=d},gs:function(a){!Y.Me||13!=a.keyCode&&27!=a.keyCode&&32!=a.keyCode||(Y.Bc(!0),a.stopPropagation(),a.preventDefault())}, Gp:function(){document.body.addEventListener("keydown",Y.gs,!0)},Jp:function(){document.body.removeEventListener("keydown",Y.gs,!0)},Rr:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)Y.Bc(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&Z.bp()},zr:function(a){if(13==a.keyCode||27==a.keyCode||32==a.keyCode)Y.Bc(!0),a.stopPropagation(),a.preventDefault(),27!=a.keyCode&&Z.mj()},Bs:function(a){27==a.keyCode?Y.Bc(!0):13==a.keyCode&&Y.fo()},fo: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?W("Games_submitted"):W("Games_httpRequestError")+"\nStatus: "+f.status;Y.tu(null,g)}};f.send(c.join("&"));Y.Bc(!0)}else a.value="",a.focus()}}; window.BlocklyDialogs=Y;Y.hideDialog=Y.Bc;var Uc=Uc||{};function Vc(a,c){function d(){}d.prototype=c.prototype;a.v=c.prototype;a.prototype=new d;a.prototype.constructor=a;a.uE=function(e,f,g){return c.prototype[f].apply(e,Array.prototype.slice.call(arguments,2))}}if(!Wc){var Wc,Xc="";"undefined"!==typeof navigator&&navigator&&"string"==typeof navigator.userAgent&&(Xc=navigator.userAgent);var Yc=0==Xc.indexOf("Opera");Wc={hF:{PB:"ScriptEngine"in window},XC:Yc,Xe:!Yc&&-1!=Xc.indexOf("MSIE"),rr:!Yc&&-1!=Xc.indexOf("WebKit")}}if(!Zc)var Zc={}; if(!$c)var $c={};if(!ad)var ad={};if(!bd)var bd={};if(!cd)var cd={};if(!dd)var dd={};var ed=Uc.TA?{uF:!0}:{};function fd(){throw Error("Do not instantiate directly");}fd.prototype.Vr=null;fd.prototype.toString=function(){return this.content};function gd(a){if(null!=a)switch(a.Vr){case 1:return 1;case -1:return-1;case 0:return 0}return null}function hd(){fd.call(this)}Vc(hd,fd);hd.prototype.mx=ed;function id(a){return null!=a&&a.mx===ed?a:jd(String(String(a)).replace(kd,ld),gd(a))} var jd=function(a){function c(){}c.prototype=a.prototype;return function(d,e){var f=new c;f.content=String(d);void 0!==e&&(f.Vr=e);return f}}(hd),md={"\x00":"�",'"':""","&":"&","'":"'","<":"<",">":">","\t":" ","\n":" ","\x0B":" ","\f":" ","\r":" "," ":" ","-":"-","/":"/","=":"=","`":"`","\u0085":"…","\u00a0":" ","\u2028":"
","\u2029":"
"};function ld(a){return md[a]}var kd=/[\x00\x22\x26\x27\x3c\x3e]/g;function nd(){return'
'};h.Ja=function(a,c,d){"function"!=typeof a&&h.Ja.yu(a);this.Qh=a;this.tl=null;this.Qj=0;this.Kp=this.lp=null;a=this.Qh;if(Array.isArray(a)){for(var e=!1,f=0;fa.length)){e=[];for(f=0;fthis.Qj)return null;var a=this.getOptions(!0)[this.Qj][0];return"object"==typeof a?a.alt:a}; h.Ja.yu=function(a){if(!Array.isArray(a))throw TypeError("FieldDropdown options must be an array.");if(!a.length)throw TypeError("FieldDropdown options must not be an empty array.");for(var c=!1,d=0;d=d||0>=c)throw Error("Height and width values of an image field must be greater than 0.");this.fj=!1;this.Qk="";h.Hd.v.constructor.call(this,a||"",null,k);k||(this.fj=!!g,this.Qk=h.g.oc(e)||"");this.jb=new h.g.md(c,d+h.Hd.yr);this.Hy=d;this.Oi=null;"function"== typeof f&&(this.Oi=f)};h.g.object.S(h.Hd,h.xa);h.Hd.oa=function(a){return new h.Hd(a.src,a.width,a.height,void 0,void 0,void 0,a)};h.Hd.yr=1;b=h.Hd.prototype;b.Gd=!1;b.pf=!1;b.Ri=function(a){h.Hd.v.Ri.call(this,a);this.fj=!!a.flipRtl;this.Qk=h.g.oc(a.alt)||""};b.nj=function(){this.ad=h.g.o.J("image",{height:this.Hy+"px",width:this.jb.width+"px",alt:this.Qk},this.Wc);this.ad.setAttributeNS(h.g.o.sh,"xlink:href",this.je)};b.fl=function(a){return"string"!=typeof a?null:a}; b.hl=function(a){this.je=a;this.ad&&this.ad.setAttributeNS(h.g.o.sh,"xlink:href",this.je||"")};b.Is=function(){return this.fj};b.Wj=function(){this.Oi&&this.Oi(this)};b.to=function(){return this.Qk};h.zc.register("field_image",h.Hd);h.zb.animal={Pa:function(){this.zd(120);Q(yb(this),"","NAME");Q(tb(this.Xf(h.Ha,"PIC"),h.nk),W("Puzzle_picture"));Q(Q(tb(yb(this),h.nk),W("Puzzle_legs")),new h.Ja(od),"LEGS");Q(this.Xf(h.Ca,"TRAITS"),W("Puzzle_traits"));this.Mg(!1)},Wb:function(){var a=document.createElement("mutation");a.setAttribute("animal",this.Tc);return a},yc:function(a){this.Ig(parseInt(a.getAttribute("animal"),10))},Tc:0,Ig:function(a){this.Tc=a;wb(this,W("Puzzle_animal"+a));this.rg=W("Puzzle_animal"+a+"HelpUrl")},Io:function(){return Fa(this, "LEGS")==this.Tc}};h.zb.picture={Pa:function(){this.zd(30);yb(this,"PIC");this.gm(!0);this.Gf("")},Wb:h.zb.animal.Wb,yc:h.zb.animal.yc,Tc:0,Ig:function(a){this.Tc=a;var c="puzzle/"+W("Puzzle_animal"+a+"Pic"),d=W("Puzzle_animal"+a+"PicHeight");a=W("Puzzle_animal"+a+"PicWidth");Q(ia(this,"PIC"),new h.Hd(c,a,d))},Io:function(){var a=this.getParent();return a&&a.Tc==this.Tc}}; h.zb.trait={Pa:function(){this.zd(290);Q(yb(this),"","NAME");this.hm(!0);this.fm(!0)},Wb:function(){var a=document.createElement("mutation");a.setAttribute("animal",this.Tc);a.setAttribute("trait",this.xu);return a},yc:function(a){this.Ig(parseInt(a.getAttribute("animal"),10),parseInt(a.getAttribute("trait"),10))},Tc:0,xu:0,Ig:function(a,c){this.Tc=a;this.xu=c;wb(this,W("Puzzle_animal"+a+"Trait"+c))},Io:function(){var a=ub(this);return a&&a.Tc==this.Tc}};var Bc="puzzle";function pd(a){for(var c=a.length-1;0Math.sqrt(Math.pow(f-d.x,2)+Math.pow(g-d.y,2))?(e=f-d.x,d=g-d.y):(d=h.g.Vb.cA(Math.atan2(g-d.y,f-d.x)),d%=360,0>d&&(d+=360),e=Math.round(5*Math.cos(h.g.Vb.Sg(d))),d=Math.round(5*Math.sin(h.g.Vb.Sg(d)))); a.moveBy(e,d);setTimeout(sd.bind(null,a,c),50)}} function td(a){Z.Ky("sample",';;;1;;;;;;;;;;;;;;;;;'.split(";"));var c=document.getElementById("help"),d=document.getElementById("helpButton"); Y.ci(c,d,a,!0,{width:"50%",left:"25%",top:"5em"},Y.Jp);Y.Gp()} window.addEventListener("load",function(){function a(){d.style.width=window.innerWidth-20+"px";d.style.height=window.innerHeight-d.offsetTop-15+"px"}document.body.innerHTML='
Patoduck.jpg70100  2  PenasBicohttp://pt.wikipedia.org/wiki/PatoGatocat.jpg70100  4  BigodesPelohttp://pt.wikipedia.org/wiki/GatoAbelhabee.jpg70100  6  MelFerr\u00e3ohttp://pt.wikipedia.org/wiki/AbelhaCaracolsnail.jpg70100  0  ConchaGosmahttp://pt.wikipedia.org/wiki/Caracolimagem:patas:escolha...tra\u00e7os:Perfeito!\nTodos os %1 blocos est\u00e3o corretos.Quase! Um bloco est\u00e1 incorreto.%1 blocos est\u00e3o incorretos.O bloco destacado est\u00e1 incorreto. Continue tentando.
Para cada animal (verde), anexe sua imagem, escolha seu numero de pernas, e fa\u00e7a uma lista de seus tra\u00e7os.
')+ nd()+'
'+nd()+"
";Z.Pa();var c=tc(),d=document.getElementById("blockly");a(null);window.addEventListener("resize",a);C=h.nf("blockly",{media:"third-party/blockly/media/",rtl:c,scrollbars:!1,trashcan:!1});var e=zc(V);try{var f=window.sessionStorage.Pl}catch(v){f=null}if(f)delete window.sessionStorage.Pl,c=h.I.Ue(f),h.I.Fe(c,C);else if(e)c=h.I.Ue(e),h.I.Fe(c,C);else{var g= [],k=[],l=[];f=1;for(var m;Cc("Puzzle_animal"+f);){m=C.Sh("animal");m.Ig(f);g.push(m);m=C.Sh("picture");m.Ig(f);k.push(m);for(var n=1;Cc("Puzzle_animal"+f+"Trait"+n);)m=C.Sh("trait"),m.Ig(f,n),l.push(m),n++;f++}pd(g);pd(k);pd(l);g=[].concat(g,k,l);c&&g.reverse();for(f=0;m=g[f];f++)m.Jn=!1,m.ug(),m.wa();for(f=k=0;m=g[f];f++)l=m.ga().getBBox(),m.zE=l.width,m.yE=l.height,m.Hr=l.width*l.height,k+=m.Hr;h.ek(C);n=h.uu(y(C));n.width-=50;n.height-=50;var q=0;for(f=0;m=g[f];f++){l=m.ga().getBBox();var r=c? l.width+q/k*n.width:q/k*(n.width-l.width);r=Math.round(r+50*Math.random());m.moveBy(r,Math.round(Math.random()*(n.height-l.height)));q+=m.Hr}}Za();Dc("checkButton",qd);Dc("helpButton",function(){td(!0)});e||td(!1);h.Sb*=2;h.jq=h.Sb;C.Od.load(["puzzle/win.mp3","puzzle/win.ogg"],"win")});