v-blockly
Version:
Blockly wrapped in a vue component
1 lines • 929 kB
JavaScript
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t(require("vue")):"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["VBlockly"]=t(require("vue")):e["VBlockly"]=t(e["Vue"])})("undefined"!==typeof self?self:this,function(__WEBPACK_EXTERNAL_MODULE__8bbf__){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,o),i.l=!0,i.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)o.d(n,i,function(t){return e[t]}.bind(null,i));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s="fb15")}({"046a":function(e,t,o){},"117c":function(e,t,o){},1991:function(e,t,o){var n,i,r,s=o("9b43"),l=o("31f4"),a=o("fab2"),g=o("230e"),c=o("7726"),u=c.process,h=c.setImmediate,p=c.clearImmediate,d=c.MessageChannel,_=c.Dispatch,y=0,f={},m="onreadystatechange",E=function(){var e=+this;if(f.hasOwnProperty(e)){var t=f[e];delete f[e],t()}},T=function(e){E.call(e.data)};h&&p||(h=function(e){var t=[],o=1;while(arguments.length>o)t.push(arguments[o++]);return f[++y]=function(){l("function"==typeof e?e:Function(e),t)},n(y),y},p=function(e){delete f[e]},"process"==o("2d95")(u)?n=function(e){u.nextTick(s(E,e,1))}:_&&_.now?n=function(e){_.now(s(E,e,1))}:d?(i=new d,r=i.port2,i.port1.onmessage=T,n=s(r.postMessage,r,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(n=function(e){c.postMessage(e+"","*")},c.addEventListener("message",T,!1)):n=m in g("script")?function(e){a.appendChild(g("script"))[m]=function(){a.removeChild(this),E.call(e)}}:function(e){setTimeout(s(E,e,1),0)}),e.exports={set:h,clear:p}},"1fa8":function(e,t,o){var n=o("cb7c");e.exports=function(e,t,o,i){try{return i?t(n(o)[0],o[1]):t(o)}catch(s){var r=e["return"];throw void 0!==r&&n(r.call(e)),s}}},"230e":function(e,t,o){var n=o("d3f4"),i=o("7726").document,r=n(i)&&n(i.createElement);e.exports=function(e){return r?i.createElement(e):{}}},"23c6":function(e,t,o){var n=o("2d95"),i=o("2b4c")("toStringTag"),r="Arguments"==n(function(){return arguments}()),s=function(e,t){try{return e[t]}catch(o){}};e.exports=function(e){var t,o,l;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(o=s(t=Object(e),i))?o:r?n(t):"Object"==(l=n(t))&&"function"==typeof t.callee?"Arguments":l}},"27ee":function(e,t,o){var n=o("23c6"),i=o("2b4c")("iterator"),r=o("84f2");e.exports=o("8378").getIteratorMethod=function(e){if(void 0!=e)return e[i]||e["@@iterator"]||r[n(e)]}},"2aba":function(e,t,o){var n=o("7726"),i=o("32e9"),r=o("69a8"),s=o("ca5a")("src"),l=o("fa5b"),a="toString",g=(""+l).split(a);o("8378").inspectSource=function(e){return l.call(e)},(e.exports=function(e,t,o,l){var a="function"==typeof o;a&&(r(o,"name")||i(o,"name",t)),e[t]!==o&&(a&&(r(o,s)||i(o,s,e[t]?""+e[t]:g.join(String(t)))),e===n?e[t]=o:l?e[t]?e[t]=o:i(e,t,o):(delete e[t],i(e,t,o)))})(Function.prototype,a,function(){return"function"==typeof this&&this[s]||l.call(this)})},"2b4c":function(e,t,o){var n=o("5537")("wks"),i=o("ca5a"),r=o("7726").Symbol,s="function"==typeof r,l=e.exports=function(e){return n[e]||(n[e]=s&&r[e]||(s?r:i)("Symbol."+e))};l.store=n},"2d00":function(e,t){e.exports=!1},"2d95":function(e,t){var o={}.toString;e.exports=function(e){return o.call(e).slice(8,-1)}},"31f4":function(e,t){e.exports=function(e,t,o){var n=void 0===o;switch(t.length){case 0:return n?e():e.call(o);case 1:return n?e(t[0]):e.call(o,t[0]);case 2:return n?e(t[0],t[1]):e.call(o,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(o,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(o,t[0],t[1],t[2],t[3])}return e.apply(o,t)}},"32e9":function(e,t,o){var n=o("86cc"),i=o("4630");e.exports=o("9e1e")?function(e,t,o){return n.f(e,t,i(1,o))}:function(e,t,o){return e[t]=o,e}},"33a4":function(e,t,o){var n=o("84f2"),i=o("2b4c")("iterator"),r=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||r[i]===e)}},4588:function(e,t){var o=Math.ceil,n=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?n:o)(e)}},4630:function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},"4a59":function(e,t,o){var n=o("9b43"),i=o("1fa8"),r=o("33a4"),s=o("cb7c"),l=o("9def"),a=o("27ee"),g={},c={};t=e.exports=function(e,t,o,u,h){var p,d,_,y,f=h?function(){return e}:a(e),m=n(o,u,t?2:1),E=0;if("function"!=typeof f)throw TypeError(e+" is not iterable!");if(r(f)){for(p=l(e.length);p>E;E++)if(y=t?m(s(d=e[E])[0],d[1]):m(e[E]),y===g||y===c)return y}else for(_=f.call(e);!(d=_.next()).done;)if(y=i(_,m,d.value,t),y===g||y===c)return y};t.BREAK=g,t.RETURN=c},"551c":function(e,t,o){"use strict";var n,i,r,s,l=o("2d00"),a=o("7726"),g=o("9b43"),c=o("23c6"),u=o("5ca1"),h=o("d3f4"),p=o("d8e8"),d=o("f605"),_=o("4a59"),y=o("ebd6"),f=o("1991").set,m=o("8079")(),E=o("a5b8"),T=o("9c80"),k=o("a25f"),v=o("bcaa"),B="Promise",S=a.TypeError,b=a.process,C=b&&b.versions,A=C&&C.v8||"",I=a[B],R="process"==c(b),O=function(){},L=i=E.f,N=!!function(){try{var e=I.resolve(1),t=(e.constructor={})[o("2b4c")("species")]=function(e){e(O,O)};return(R||"function"==typeof PromiseRejectionEvent)&&e.then(O)instanceof t&&0!==A.indexOf("6.6")&&-1===k.indexOf("Chrome/66")}catch(n){}}(),D=function(e){var t;return!(!h(e)||"function"!=typeof(t=e.then))&&t},M=function(e,t){if(!e._n){e._n=!0;var o=e._c;m(function(){var n=e._v,i=1==e._s,r=0,s=function(t){var o,r,s,l=i?t.ok:t.fail,a=t.resolve,g=t.reject,c=t.domain;try{l?(i||(2==e._h&&x(e),e._h=1),!0===l?o=n:(c&&c.enter(),o=l(n),c&&(c.exit(),s=!0)),o===t.promise?g(S("Promise-chain cycle")):(r=D(o))?r.call(o,a,g):a(o)):g(n)}catch(u){c&&!s&&c.exit(),g(u)}};while(o.length>r)s(o[r++]);e._c=[],e._n=!1,t&&!e._h&&w(e)})}},w=function(e){f.call(a,function(){var t,o,n,i=e._v,r=P(e);if(r&&(t=T(function(){R?b.emit("unhandledRejection",i,e):(o=a.onunhandledrejection)?o({promise:e,reason:i}):(n=a.console)&&n.error&&n.error("Unhandled promise rejection",i)}),e._h=R||P(e)?2:1),e._a=void 0,r&&t.e)throw t.v})},P=function(e){return 1!==e._h&&0===(e._a||e._c).length},x=function(e){f.call(a,function(){var t;R?b.emit("rejectionHandled",e):(t=a.onrejectionhandled)&&t({promise:e,reason:e._v})})},U=function(e){var t=this;t._d||(t._d=!0,t=t._w||t,t._v=e,t._s=2,t._a||(t._a=t._c.slice()),M(t,!0))},H=function(e){var t,o=this;if(!o._d){o._d=!0,o=o._w||o;try{if(o===e)throw S("Promise can't be resolved itself");(t=D(e))?m(function(){var n={_w:o,_d:!1};try{t.call(e,g(H,n,1),g(U,n,1))}catch(i){U.call(n,i)}}):(o._v=e,o._s=1,M(o,!1))}catch(n){U.call({_w:o,_d:!1},n)}}};N||(I=function(e){d(this,I,B,"_h"),p(e),n.call(this);try{e(g(H,this,1),g(U,this,1))}catch(t){U.call(this,t)}},n=function(e){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1},n.prototype=o("dcbc")(I.prototype,{then:function(e,t){var o=L(y(this,I));return o.ok="function"!=typeof e||e,o.fail="function"==typeof t&&t,o.domain=R?b.domain:void 0,this._c.push(o),this._a&&this._a.push(o),this._s&&M(this,!1),o.promise},catch:function(e){return this.then(void 0,e)}}),r=function(){var e=new n;this.promise=e,this.resolve=g(H,e,1),this.reject=g(U,e,1)},E.f=L=function(e){return e===I||e===s?new r(e):i(e)}),u(u.G+u.W+u.F*!N,{Promise:I}),o("7f20")(I,B),o("7a56")(B),s=o("8378")[B],u(u.S+u.F*!N,B,{reject:function(e){var t=L(this),o=t.reject;return o(e),t.promise}}),u(u.S+u.F*(l||!N),B,{resolve:function(e){return v(l&&this===s?I:this,e)}}),u(u.S+u.F*!(N&&o("5cc5")(function(e){I.all(e)["catch"](O)})),B,{all:function(e){var t=this,o=L(t),n=o.resolve,i=o.reject,r=T(function(){var o=[],r=0,s=1;_(e,!1,function(e){var l=r++,a=!1;o.push(void 0),s++,t.resolve(e).then(function(e){a||(a=!0,o[l]=e,--s||n(o))},i)}),--s||n(o)});return r.e&&i(r.v),o.promise},race:function(e){var t=this,o=L(t),n=o.reject,i=T(function(){_(e,!1,function(e){t.resolve(e).then(o.resolve,n)})});return i.e&&n(i.v),o.promise}})},5537:function(e,t,o){var n=o("8378"),i=o("7726"),r="__core-js_shared__",s=i[r]||(i[r]={});(e.exports=function(e,t){return s[e]||(s[e]=void 0!==t?t:{})})("versions",[]).push({version:n.version,mode:o("2d00")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},"5ca1":function(e,t,o){var n=o("7726"),i=o("8378"),r=o("32e9"),s=o("2aba"),l=o("9b43"),a="prototype",g=function(e,t,o){var c,u,h,p,d=e&g.F,_=e&g.G,y=e&g.S,f=e&g.P,m=e&g.B,E=_?n:y?n[t]||(n[t]={}):(n[t]||{})[a],T=_?i:i[t]||(i[t]={}),k=T[a]||(T[a]={});for(c in _&&(o=t),o)u=!d&&E&&void 0!==E[c],h=(u?E:o)[c],p=m&&u?l(h,n):f&&"function"==typeof h?l(Function.call,h):h,E&&s(E,c,h,e&g.U),T[c]!=h&&r(T,c,p),f&&k[c]!=h&&(k[c]=h)};n.core=i,g.F=1,g.G=2,g.S=4,g.P=8,g.B=16,g.W=32,g.U=64,g.R=128,e.exports=g},"5cc5":function(e,t,o){var n=o("2b4c")("iterator"),i=!1;try{var r=[7][n]();r["return"]=function(){i=!0},Array.from(r,function(){throw 2})}catch(s){}e.exports=function(e,t){if(!t&&!i)return!1;var o=!1;try{var r=[7],l=r[n]();l.next=function(){return{done:o=!0}},r[n]=function(){return l},e(r)}catch(s){}return o}},"69a8":function(e,t){var o={}.hasOwnProperty;e.exports=function(e,t){return o.call(e,t)}},"6a99":function(e,t,o){var n=o("d3f4");e.exports=function(e,t){if(!n(e))return e;var o,i;if(t&&"function"==typeof(o=e.toString)&&!n(i=o.call(e)))return i;if("function"==typeof(o=e.valueOf)&&!n(i=o.call(e)))return i;if(!t&&"function"==typeof(o=e.toString)&&!n(i=o.call(e)))return i;throw TypeError("Can't convert object to primitive value")}},7082:function(e,t,o){"use strict";var n=o("e98f"),i=n.Blockly,r=n.goog;console.log("Blockly, goog",i,r),window.Blockly=i,window.goog=r,o("f8e9"),o("75da"),t["a"]=i},"75da":function(e,t){var o=window.Blockly;window.goog;o.Blocks.colour={},o.Constants={},o.Constants.Colour={},o.Constants.Colour.HUE=20,o.defineBlocksWithJsonArray([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]),o.Blocks.lists={},o.Constants.Lists={},o.Constants.Lists.HUE=260,o.defineBlocksWithJsonArray([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]),o.Blocks.lists_create_with={init:function(){this.setHelpUrl(o.Msg.LISTS_CREATE_WITH_HELPURL),this.setStyle("list_blocks"),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new o.Mutator(["lists_create_with_item"])),this.setTooltip(o.Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(e){this.itemCount_=parseInt(e.getAttribute("items"),10),this.updateShape_()},decompose:function(e){var t=e.newBlock("lists_create_with_container");t.initSvg();for(var o=t.getInput("STACK").connection,n=0;n<this.itemCount_;n++){var i=e.newBlock("lists_create_with_item");i.initSvg(),o.connect(i.previousConnection),o=i.nextConnection}return t},compose:function(e){var t=e.getInputTargetBlock("STACK");for(e=[];t;)e.push(t.valueConnection_),t=t.nextConnection&&t.nextConnection.targetBlock();for(t=0;t<this.itemCount_;t++){var n=this.getInput("ADD"+t).connection.targetConnection;n&&-1==e.indexOf(n)&&n.disconnect()}for(this.itemCount_=e.length,this.updateShape_(),t=0;t<this.itemCount_;t++)o.Mutator.reconnect(e[t],this,"ADD"+t)},saveConnections:function(e){e=e.getInputTargetBlock("STACK");for(var t=0;e;){var o=this.getInput("ADD"+t);e.valueConnection_=o&&o.connection.targetConnection,t++,e=e.nextConnection&&e.nextConnection.targetBlock()}},updateShape_:function(){this.itemCount_&&this.getInput("EMPTY")?this.removeInput("EMPTY"):this.itemCount_||this.getInput("EMPTY")||this.appendDummyInput("EMPTY").appendField(o.Msg.LISTS_CREATE_EMPTY_TITLE);for(var e=0;e<this.itemCount_;e++)if(!this.getInput("ADD"+e)){var t=this.appendValueInput("ADD"+e);0==e&&t.appendField(o.Msg.LISTS_CREATE_WITH_INPUT_WITH)}for(;this.getInput("ADD"+e);)this.removeInput("ADD"+e),e++}},o.Blocks.lists_create_with_container={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(o.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD),this.appendStatementInput("STACK"),this.setTooltip(o.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP),this.contextMenu=!1}},o.Blocks.lists_create_with_item={init:function(){this.setStyle("list_blocks"),this.appendDummyInput().appendField(o.Msg.LISTS_CREATE_WITH_ITEM_TITLE),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(o.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP),this.contextMenu=!1}},o.Blocks.lists_indexOf={init:function(){var e=[[o.Msg.LISTS_INDEX_OF_FIRST,"FIRST"],[o.Msg.LISTS_INDEX_OF_LAST,"LAST"]];this.setHelpUrl(o.Msg.LISTS_INDEX_OF_HELPURL),this.setStyle("list_blocks"),this.setOutput(!0,"Number"),this.appendValueInput("VALUE").setCheck("Array").appendField(o.Msg.LISTS_INDEX_OF_INPUT_IN_LIST),this.appendValueInput("FIND").appendField(new o.FieldDropdown(e),"END"),this.setInputsInline(!0);var t=this;this.setTooltip(function(){return o.Msg.LISTS_INDEX_OF_TOOLTIP.replace("%1",t.workspace.options.oneBasedIndex?"0":"-1")})}},o.Blocks.lists_getIndex={init:function(){var e=[[o.Msg.LISTS_GET_INDEX_GET,"GET"],[o.Msg.LISTS_GET_INDEX_GET_REMOVE,"GET_REMOVE"],[o.Msg.LISTS_GET_INDEX_REMOVE,"REMOVE"]];this.WHERE_OPTIONS=[[o.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[o.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[o.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[o.Msg.LISTS_GET_INDEX_LAST,"LAST"],[o.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(o.Msg.LISTS_GET_INDEX_HELPURL),this.setStyle("list_blocks"),e=new o.FieldDropdown(e,function(e){this.sourceBlock_.updateStatement_("REMOVE"==e)}),this.appendValueInput("VALUE").setCheck("Array").appendField(o.Msg.LISTS_GET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(e,"MODE").appendField("","SPACE"),this.appendDummyInput("AT"),o.Msg.LISTS_GET_INDEX_TAIL&&this.appendDummyInput("TAIL").appendField(o.Msg.LISTS_GET_INDEX_TAIL),this.setInputsInline(!0),this.setOutput(!0),this.updateAt_(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("MODE"),n=t.getFieldValue("WHERE"),i="";switch(e+" "+n){case"GET FROM_START":case"GET FROM_END":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM;break;case"GET FIRST":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST;break;case"GET LAST":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST;break;case"GET RANDOM":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM;break;case"GET_REMOVE FROM_START":case"GET_REMOVE FROM_END":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM;break;case"GET_REMOVE FIRST":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST;break;case"GET_REMOVE LAST":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST;break;case"GET_REMOVE RANDOM":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM;break;case"REMOVE FROM_START":case"REMOVE FROM_END":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM;break;case"REMOVE FIRST":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST;break;case"REMOVE LAST":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST;break;case"REMOVE RANDOM":i=o.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM}return"FROM_START"!=n&&"FROM_END"!=n||(i+=" "+("FROM_START"==n?o.Msg.LISTS_INDEX_FROM_START_TOOLTIP:o.Msg.LISTS_INDEX_FROM_END_TOOLTIP).replace("%1",t.workspace.options.oneBasedIndex?"#1":"#0")),i})},mutationToDom:function(){var e=document.createElement("mutation");e.setAttribute("statement",!this.outputConnection);var t=this.getInput("AT").type==o.INPUT_VALUE;return e.setAttribute("at",t),e},domToMutation:function(e){var t="true"==e.getAttribute("statement");this.updateStatement_(t),e="false"!=e.getAttribute("at"),this.updateAt_(e)},updateStatement_:function(e){e!=!this.outputConnection&&(this.unplug(!0,!0),e?(this.setOutput(!1),this.setPreviousStatement(!0),this.setNextStatement(!0)):(this.setPreviousStatement(!1),this.setNextStatement(!1),this.setOutput(!0)))},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),o.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(o.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var t=new o.FieldDropdown(this.WHERE_OPTIONS,function(t){var o="FROM_START"==t||"FROM_END"==t;if(o!=e){var n=this.sourceBlock_;return n.updateAt_(o),n.setFieldValue(t,"WHERE"),null}});this.getInput("AT").appendField(t,"WHERE"),o.Msg.LISTS_GET_INDEX_TAIL&&this.moveInputBefore("TAIL",null)}},o.Blocks.lists_setIndex={init:function(){var e=[[o.Msg.LISTS_SET_INDEX_SET,"SET"],[o.Msg.LISTS_SET_INDEX_INSERT,"INSERT"]];this.WHERE_OPTIONS=[[o.Msg.LISTS_GET_INDEX_FROM_START,"FROM_START"],[o.Msg.LISTS_GET_INDEX_FROM_END,"FROM_END"],[o.Msg.LISTS_GET_INDEX_FIRST,"FIRST"],[o.Msg.LISTS_GET_INDEX_LAST,"LAST"],[o.Msg.LISTS_GET_INDEX_RANDOM,"RANDOM"]],this.setHelpUrl(o.Msg.LISTS_SET_INDEX_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(o.Msg.LISTS_SET_INDEX_INPUT_IN_LIST),this.appendDummyInput().appendField(new o.FieldDropdown(e),"MODE").appendField("","SPACE"),this.appendDummyInput("AT"),this.appendValueInput("TO").appendField(o.Msg.LISTS_SET_INDEX_INPUT_TO),this.setInputsInline(!0),this.setPreviousStatement(!0),this.setNextStatement(!0),this.setTooltip(o.Msg.LISTS_SET_INDEX_TOOLTIP),this.updateAt_(!0);var t=this;this.setTooltip(function(){var e=t.getFieldValue("MODE"),n=t.getFieldValue("WHERE"),i="";switch(e+" "+n){case"SET FROM_START":case"SET FROM_END":i=o.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM;break;case"SET FIRST":i=o.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST;break;case"SET LAST":i=o.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST;break;case"SET RANDOM":i=o.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM;break;case"INSERT FROM_START":case"INSERT FROM_END":i=o.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM;break;case"INSERT FIRST":i=o.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST;break;case"INSERT LAST":i=o.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST;break;case"INSERT RANDOM":i=o.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM}return"FROM_START"!=n&&"FROM_END"!=n||(i+=" "+o.Msg.LISTS_INDEX_FROM_START_TOOLTIP.replace("%1",t.workspace.options.oneBasedIndex?"#1":"#0")),i})},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT").type==o.INPUT_VALUE;return e.setAttribute("at",t),e},domToMutation:function(e){e="false"!=e.getAttribute("at"),this.updateAt_(e)},updateAt_:function(e){this.removeInput("AT"),this.removeInput("ORDINAL",!0),e?(this.appendValueInput("AT").setCheck("Number"),o.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL").appendField(o.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT");var t=new o.FieldDropdown(this.WHERE_OPTIONS,function(t){var o="FROM_START"==t||"FROM_END"==t;if(o!=e){var n=this.sourceBlock_;return n.updateAt_(o),n.setFieldValue(t,"WHERE"),null}});this.moveInputBefore("AT","TO"),this.getInput("ORDINAL")&&this.moveInputBefore("ORDINAL","TO"),this.getInput("AT").appendField(t,"WHERE")}},o.Blocks.lists_getSublist={init:function(){this.WHERE_OPTIONS_1=[[o.Msg.LISTS_GET_SUBLIST_START_FROM_START,"FROM_START"],[o.Msg.LISTS_GET_SUBLIST_START_FROM_END,"FROM_END"],[o.Msg.LISTS_GET_SUBLIST_START_FIRST,"FIRST"]],this.WHERE_OPTIONS_2=[[o.Msg.LISTS_GET_SUBLIST_END_FROM_START,"FROM_START"],[o.Msg.LISTS_GET_SUBLIST_END_FROM_END,"FROM_END"],[o.Msg.LISTS_GET_SUBLIST_END_LAST,"LAST"]],this.setHelpUrl(o.Msg.LISTS_GET_SUBLIST_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("LIST").setCheck("Array").appendField(o.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST),this.appendDummyInput("AT1"),this.appendDummyInput("AT2"),o.Msg.LISTS_GET_SUBLIST_TAIL&&this.appendDummyInput("TAIL").appendField(o.Msg.LISTS_GET_SUBLIST_TAIL),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.updateAt_(1,!0),this.updateAt_(2,!0),this.setTooltip(o.Msg.LISTS_GET_SUBLIST_TOOLTIP)},mutationToDom:function(){var e=document.createElement("mutation"),t=this.getInput("AT1").type==o.INPUT_VALUE;return e.setAttribute("at1",t),t=this.getInput("AT2").type==o.INPUT_VALUE,e.setAttribute("at2",t),e},domToMutation:function(e){var t="true"==e.getAttribute("at1");e="true"==e.getAttribute("at2"),this.updateAt_(1,t),this.updateAt_(2,e)},updateAt_:function(e,t){this.removeInput("AT"+e),this.removeInput("ORDINAL"+e,!0),t?(this.appendValueInput("AT"+e).setCheck("Number"),o.Msg.ORDINAL_NUMBER_SUFFIX&&this.appendDummyInput("ORDINAL"+e).appendField(o.Msg.ORDINAL_NUMBER_SUFFIX)):this.appendDummyInput("AT"+e);var n=new o.FieldDropdown(this["WHERE_OPTIONS_"+e],function(o){var n="FROM_START"==o||"FROM_END"==o;if(n!=t){var i=this.sourceBlock_;return i.updateAt_(e,n),i.setFieldValue(o,"WHERE"+e),null}});this.getInput("AT"+e).appendField(n,"WHERE"+e),1==e&&(this.moveInputBefore("AT1","AT2"),this.getInput("ORDINAL1")&&this.moveInputBefore("ORDINAL1","AT2")),o.Msg.LISTS_GET_SUBLIST_TAIL&&this.moveInputBefore("TAIL",null)}},o.Blocks.lists_sort={init:function(){this.jsonInit({message0:o.Msg.LISTS_SORT_TITLE,args0:[{type:"field_dropdown",name:"TYPE",options:[[o.Msg.LISTS_SORT_TYPE_NUMERIC,"NUMERIC"],[o.Msg.LISTS_SORT_TYPE_TEXT,"TEXT"],[o.Msg.LISTS_SORT_TYPE_IGNORECASE,"IGNORE_CASE"]]},{type:"field_dropdown",name:"DIRECTION",options:[[o.Msg.LISTS_SORT_ORDER_ASCENDING,"1"],[o.Msg.LISTS_SORT_ORDER_DESCENDING,"-1"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Array",style:"list_blocks",tooltip:o.Msg.LISTS_SORT_TOOLTIP,helpUrl:o.Msg.LISTS_SORT_HELPURL})}},o.Blocks.lists_split={init:function(){var e=this,t=new o.FieldDropdown([[o.Msg.LISTS_SPLIT_LIST_FROM_TEXT,"SPLIT"],[o.Msg.LISTS_SPLIT_TEXT_FROM_LIST,"JOIN"]],function(t){e.updateType_(t)});this.setHelpUrl(o.Msg.LISTS_SPLIT_HELPURL),this.setStyle("list_blocks"),this.appendValueInput("INPUT").setCheck("String").appendField(t,"MODE"),this.appendValueInput("DELIM").setCheck("String").appendField(o.Msg.LISTS_SPLIT_WITH_DELIMITER),this.setInputsInline(!0),this.setOutput(!0,"Array"),this.setTooltip(function(){var t=e.getFieldValue("MODE");if("SPLIT"==t)return o.Msg.LISTS_SPLIT_TOOLTIP_SPLIT;if("JOIN"==t)return o.Msg.LISTS_SPLIT_TOOLTIP_JOIN;throw Error("Unknown mode: "+t)})},updateType_:function(e){if(this.getFieldValue("MODE")!=e){this.setFieldValue(e,"MODE");var t=this.getInput("INPUT").connection;t.setShadowDom(null);var o=t.targetBlock();o&&(t.disconnect(),o.isShadow()?o.dispose():this.bumpNeighbours_())}"SPLIT"==e?(this.outputConnection.setCheck("Array"),this.getInput("INPUT").setCheck("String")):(this.outputConnection.setCheck("String"),this.getInput("INPUT").setCheck("Array"))},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("mode",this.getFieldValue("MODE")),e},domToMutation:function(e){this.updateType_(e.getAttribute("mode"))}},o.Blocks.logic={},o.Constants.Logic={},o.Constants.Logic.HUE=210,o.defineBlocksWithJsonArray([{type:"logic_boolean",message0:"%1",args0:[{type:"field_dropdown",name:"BOOL",options:[["%{BKY_LOGIC_BOOLEAN_TRUE}","TRUE"],["%{BKY_LOGIC_BOOLEAN_FALSE}","FALSE"]]}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_BOOLEAN_TOOLTIP}",helpUrl:"%{BKY_LOGIC_BOOLEAN_HELPURL}"},{type:"controls_if",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],previousStatement:null,nextStatement:null,style:"logic_blocks",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",mutator:"controls_if_mutator",extensions:["controls_if_tooltip"]},{type:"controls_ifelse",message0:"%{BKY_CONTROLS_IF_MSG_IF} %1",args0:[{type:"input_value",name:"IF0",check:"Boolean"}],message1:"%{BKY_CONTROLS_IF_MSG_THEN} %1",args1:[{type:"input_statement",name:"DO0"}],message2:"%{BKY_CONTROLS_IF_MSG_ELSE} %1",args2:[{type:"input_statement",name:"ELSE"}],previousStatement:null,nextStatement:null,style:"logic_blocks",tooltip:"%{BKYCONTROLS_IF_TOOLTIP_2}",helpUrl:"%{BKY_CONTROLS_IF_HELPURL}",extensions:["controls_if_tooltip"]},{type:"logic_compare",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A"},{type:"field_dropdown",name:"OP",options:[["=","EQ"],["≠","NEQ"],["<","LT"],["≤","LTE"],[">","GT"],["≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]),o.defineBlocksWithJsonArray([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]),o.Constants.Logic.TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"},o.Extensions.register("logic_op_tooltip",o.Extensions.buildTooltipForDropdown("OP",o.Constants.Logic.TOOLTIPS_BY_OP)),o.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var e=document.createElement("mutation");return this.elseifCount_&&e.setAttribute("elseif",this.elseifCount_),this.elseCount_&&e.setAttribute("else",1),e},domToMutation:function(e){this.elseifCount_=parseInt(e.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(e.getAttribute("else"),10)||0,this.rebuildShape_()},decompose:function(e){var t=e.newBlock("controls_if_if");t.initSvg();for(var o=t.nextConnection,n=1;n<=this.elseifCount_;n++){var i=e.newBlock("controls_if_elseif");i.initSvg(),o.connect(i.previousConnection),o=i.nextConnection}return this.elseCount_&&(e=e.newBlock("controls_if_else"),e.initSvg(),o.connect(e.previousConnection)),t},compose:function(e){e=e.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;for(var t=[null],o=[null],n=null;e;){switch(e.type){case"controls_if_elseif":this.elseifCount_++,t.push(e.valueConnection_),o.push(e.statementConnection_);break;case"controls_if_else":this.elseCount_++,n=e.statementConnection_;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.nextConnection&&e.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(t,o,n)},saveConnections:function(e){e=e.nextConnection.targetBlock();for(var t=1;e;){switch(e.type){case"controls_if_elseif":var o=this.getInput("IF"+t),n=this.getInput("DO"+t);e.valueConnection_=o&&o.connection.targetConnection,e.statementConnection_=n&&n.connection.targetConnection,t++;break;case"controls_if_else":n=this.getInput("ELSE"),e.statementConnection_=n&&n.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+e.type)}e=e.nextConnection&&e.nextConnection.targetBlock()}},rebuildShape_:function(){var e=[null],t=[null],o=null;this.getInput("ELSE")&&(o=this.getInput("ELSE").connection.targetConnection);for(var n=1;this.getInput("IF"+n);){var i=this.getInput("IF"+n),r=this.getInput("DO"+n);e.push(i.connection.targetConnection),t.push(r.connection.targetConnection),n++}this.updateShape_(),this.reconnectChildBlocks_(e,t,o)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);)this.removeInput("IF"+e),this.removeInput("DO"+e),e++;for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck("Boolean").appendField(o.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(o.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(o.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(e,t,n){for(var i=1;i<=this.elseifCount_;i++)o.Mutator.reconnect(e[i],this,"IF"+i),o.Mutator.reconnect(t[i],this,"DO"+i);o.Mutator.reconnect(n,this,"ELSE")}},o.Extensions.registerMutator("controls_if_mutator",o.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN,null,["controls_if_elseif","controls_if_else"]),o.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){return this.elseifCount_||this.elseCount_?!this.elseifCount_&&this.elseCount_?o.Msg.CONTROLS_IF_TOOLTIP_2:this.elseifCount_&&!this.elseCount_?o.Msg.CONTROLS_IF_TOOLTIP_3:this.elseifCount_&&this.elseCount_?o.Msg.CONTROLS_IF_TOOLTIP_4:"":o.Msg.CONTROLS_IF_TOOLTIP_1}.bind(this))},o.Extensions.register("controls_if_tooltip",o.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION),o.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN={onchange:function(e){this.prevBlocks_||(this.prevBlocks_=[null,null]);var t=this.getInputTargetBlock("A"),n=this.getInputTargetBlock("B");t&&n&&!t.outputConnection.checkType_(n.outputConnection)&&(o.Events.setGroup(e.group),e=this.prevBlocks_[0],e!==t&&(t.unplug(),e&&!e.isShadow()&&this.getInput("A").connection.connect(e.outputConnection)),t=this.prevBlocks_[1],t!==n&&(n.unplug(),t&&!t.isShadow()&&this.getInput("B").connection.connect(t.outputConnection)),this.bumpNeighbours_(),o.Events.setGroup(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},o.Constants.Logic.LOGIC_COMPARE_EXTENSION=function(){this.mixin(o.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN)},o.Extensions.register("logic_compare",o.Constants.Logic.LOGIC_COMPARE_EXTENSION),o.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(e){var t=this.getInputTargetBlock("THEN"),n=this.getInputTargetBlock("ELSE"),i=this.outputConnection.targetConnection;if((t||n)&&i)for(var r=0;2>r;r++){var s=1==r?t:n;s&&!s.outputConnection.checkType_(i)&&(o.Events.setGroup(e.group),i===this.prevParentConnection_?(this.unplug(),i.getSourceBlock().bumpNeighbours_()):(s.unplug(),s.bumpNeighbours_()),o.Events.setGroup(!1))}this.prevParentConnection_=i}},o.Extensions.registerMixin("logic_ternary",o.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN),o.Blocks.loops={},o.Constants.Loops={},o.Constants.Loops.HUE=120,o.defineBlocksWithJsonArray([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]),o.Constants.Loops.WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"},o.Extensions.register("controls_whileUntil_tooltip",o.Extensions.buildTooltipForDropdown("MODE",o.Constants.Loops.WHILE_UNTIL_TOOLTIPS)),o.Constants.Loops.BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"},o.Extensions.register("controls_flow_tooltip",o.Extensions.buildTooltipForDropdown("FLOW",o.Constants.Loops.BREAK_CONTINUE_TOOLTIPS)),o.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(e){if(!this.isInFlyout){var t=this.getField("VAR").getVariable(),n=t.name;if(!this.isCollapsed()&&null!=n){var i={enabled:!0};i.text=o.Msg.VARIABLES_SET_CREATE_GET.replace("%1",n),t=o.Variables.generateVariableFieldDom(t),n=document.createElement("block"),n.setAttribute("type","variables_get"),n.appendChild(t),i.callback=o.ContextMenu.callbackFactory(this,n),e.push(i)}}}},o.Extensions.registerMixin("contextMenu_newGetVariableBlock",o.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN),o.Extensions.register("controls_for_tooltip",o.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),o.Extensions.register("controls_forEach_tooltip",o.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR")),o.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],onchange:function(){if(this.workspace.isDragging&&!this.workspace.isDragging()){var e=!1,t=this;do{if(-1!=this.LOOP_TYPES.indexOf(t.type)){e=!0;break}t=t.getSurroundParent()}while(t);e?(this.setWarningText(null),this.isInFlyout||this.setDisabled(!1)):(this.setWarningText(o.Msg.CONTROLS_FLOW_STATEMENTS_WARNING),this.isInFlyout||this.getInheritedDisabled()||this.setDisabled(!0))}}},o.Extensions.registerMixin("controls_flow_in_loop_check",o.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN),o.Blocks.math={},o.Constants.Math={},o.Constants.Math.HUE=230,o.defineBlocksWithJsonArray([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]),o.Constants.Math.TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"},o.Extensions.register("math_op_tooltip",o.Extensions.buildTooltipForDropdown("OP",o.Constants.Math.TOOLTIPS_BY_OP)),o.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var e=document.createElement("mutation"),t="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");return e.setAttribute("divisor_input",t),e},domToMutation:function(e){e="true"==e.getAttribute("divisor_input"),this.updateShape_(e)},updateShape_:function(e){var t=this.getInput("DIVISOR");e?t||this.appendValueInput("DIVISOR").setCheck("Number"):t&&this.removeInput("DIVISOR")}},o.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION=function(){this.getField("PROPERTY").setValidator(function(e){this.sourceBlock_.updateShape_("DIVISIBLE_BY"==e)})},o.Extensions.registerMutator("math_is_divisibleby_mutator",o.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN,o.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION),o.Extensions.register("math_change_tooltip",o.Extensions.buildTooltipWithFieldText("%{BKY_MATH_CHANGE_TOOLTIP}","VAR")),o.Constants.Math.LIST_MODES_MUTATOR_MIXIN={updateType_:function(e){"MODE"==e?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var e=document.createElement("mutation");return e.setAttribute("op",this.getFieldValue("OP")),e},domToMutation:function(e){this.updateType_(e.getAttribute("op"))}},o.Constants.Math.LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(e){this.updateType_(e)}.bind(this))},o.Extensions.registerMutator("math_modes_of_list_mutator",o.Constants.Math.LIST_MODES_MUTATOR_MIXIN,o.Constants.Math.LIST_MODES_MUTATOR_EXTENSION),o.Blocks.procedures={},o.Blocks.procedures_defnoreturn={init:function(){var e=new o.FieldTextInput("",o.Procedures.rename);e.setSpellcheck(!1),this.appendDummyInput().appendField(o.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.setMutator(new o.Mutator(["procedures_mutatorarg"])),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&o.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(o.Msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(o.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(o.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:function(e){this.hasStatements_!==e&&(e?(this.appendStatementInput("STACK").appendField(o.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=e)},updateParams_:function(){var e="";this.arguments_.length&&(e=o.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),o.Events.disable();try{this.setFieldValue(e,"PARAMS")}finally{o.Events.enable()}},mutationToDom:function(e){var t=document.createElement("mutation");e&&t.setAttribute("name",this.getFieldValue("NAME"));for(var o=0;o<this.argumentVarModels_.length;o++){var n=document.createElement("arg"),i=this.argumentVarModels_[o];n.setAttribute("name",i.name),n.setAttribute("varid",i.getId()),e&&this.paramIds_&&n.setAttribute("paramId",this.paramIds_[o]),t.appendChild(n)}return this.hasStatements_||t.setAttribute("statements","false"),t},domToMutation:function(e){this.arguments_=[],this.argumentVarModels_=[];for(var t,n=0;t=e.childNodes[n];n++)if("arg"==t.nodeName.toLowerCase()){var i=t.getAttribute("name");t=t.getAttribute("varid")||t.getAttribute("varId"),this.arguments_.push(i),t=o.Variables.getOrCreateVariablePackage(this.workspace,t,i,""),null!=t?this.argumentVarModels_.push(t):console.log("Failed to create a variable with name "+i+", ignoring.")}this.updateParams_(),o.Procedures.mutateCallers(this),this.setStatements_("false"!==e.getAttribute("statements"))},decompose:function(e){var t=e.newBlock("procedures_mutatorcontainer");t.initSvg(),this.getInput("RETURN")?t.setFieldValue(this.hasStatements_?"TRUE":"FALSE","STATEMENTS"):t.getInput("STATEMENT_INPUT").setVisible(!1);for(var n=t.getInput("STACK").connection,i=0;i<this.arguments_.length;i++){var r=e.newBlock("procedures_mutatorarg");r.initSvg(),r.setFieldValue(this.arguments_[i],"NAME"),r.oldLocation=i,n.connect(r.previousConnection),n=r.nextConnection}return o.Procedures.mutateCallers(this),t},compose:function(e){this.arguments_=[],this.paramIds_=[],this.argumentVarModels_=[];for(var t=e.getInputTargetBlock("STACK");t;){var n=t.getFieldValue("NAME");this.arguments_.push(n);var i=this.workspace.getVariable(n,"");null!=i?this.argumentVarModels_.push(i):console.log("Failed to get variable named "+n+", ignoring."),this.paramIds_.push(t.id),t=t.nextConnection&&t.nextConnection.targetBlock()}this.updateParams_(),o.Procedures.mutateCallers(this),e=e.getFie