Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blockly/block-test

Package Overview
Dependencies
Maintainers
2
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockly/block-test - npm Package Compare versions

Comparing version 5.0.4 to 5.1.0

src/chameleon.js

2

./dist/index.js
/*! For license information please see index.js.LICENSE.txt */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("blockly/core"));else if("function"==typeof define&&define.amd)define(["blockly/core"],e);else{var n="object"==typeof exports?e(require("blockly/core")):e(t.Blockly);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(t=>(()=>{"use strict";var e={573:e=>{e.exports=t}},n={};function o(t){var l=n[t];if(void 0!==l)return l.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,o),s.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var l={};return(()=>{o.r(l),o.d(l,{toolboxTestBlocks:()=>f,toolboxTestBlocksInit:()=>x});var t=o(573),e=o.n(t);t.defineBlocksWithJsonArray([{type:"test_align_dummy_right",message0:"text right %1 long text right %2",args0:[{type:"input_dummy",align:"RIGHT"},{type:"input_dummy",align:"RIGHT"}],style:"math_blocks"},{type:"test_align_all",message0:"text %1 long text left %2 text centre %3 much longer text right %4",args0:[{type:"input_dummy"},{type:"input_dummy",align:"LEFT"},{type:"input_dummy",align:"CENTRE"},{type:"input_dummy",align:"RIGHT"}],style:"math_blocks"},{type:"test_align_with_external_input",message0:"text right %1 long text centre %2 text left %3 much longer text %4",args0:[{type:"input_dummy",align:"RIGHT"},{type:"input_dummy",align:"CENTRE"},{type:"input_dummy",align:"LEFT"},{type:"input_value",name:"VALUE"}],inputsInline:!1,style:"math_blocks"}]),t.defineBlocksWithJsonArray([{type:"test_basic_empty",message0:"",args0:[]},{type:"test_basic_stack",message0:"stack block",previousStatement:null,nextStatement:null,colour:"120"},{type:"test_basic_dummy",message0:"dummy input %1",args0:[{type:"input_dummy"}],style:"math_blocks"},{type:"test_basic_multiple_dummy",message0:"first dummy %1 second dummy %2",args0:[{type:"input_dummy"},{type:"input_dummy"}],style:"math_blocks"},{type:"test_basic_row",message0:"row block %1",args0:[{type:"input_value",name:"INPUT"}],output:null,style:"math_blocks"},{type:"test_basic_value_to_stack",message0:"value to stack",nextStatement:null,output:null,style:"math_blocks"},{type:"test_basic_value_to_statement",message0:"value to statement %1",args0:[{type:"input_statement",name:"STATEMENT"}],output:null,style:"math_blocks"},{type:"test_basic_limit_instances",message0:"limit 3 instances %1 %2",args0:[{type:"input_dummy"},{type:"input_statement",name:"STATEMENT"}],previousStatement:null,nextStatement:null,style:"math_blocks"},{type:"test_basic_tooltips",message0:"%1 %2 %3",args0:[{type:"field_label",name:"NAME",text:"field tooltip",tooltip:"This is a JSON tooltip for the *field*."},{type:"input_dummy"},{type:"field_label",name:"NAME",text:"block tooltip"}],tooltip:"This is a JSON tooltip for the *block*.",style:"math_blocks"},{type:"test_basic_javascript",message0:"function %1(%2) { %3 %4 return %5 }",args0:["foo","args",{type:"input_dummy"},{type:"input_statement",name:"STACK"},{type:"input_value",check:"number",align:"right",name:"RETURN"}],inputsInline:!0,colour:200,tooltip:"Hello world."}]),t.Blocks.test_basic_empty_with_mutator={init:function(){this.setMutator(new t.icons.MutatorIcon(["math_number"],this))},decompose:function(t){const e=t.newBlock("math_number");return e.initSvg(),e},compose:function(){}},t.defineBlocksWithJsonArray([{type:"test_connections_row_input",message0:"%1",args0:[{type:"input_value",name:"NAME"}],colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any output connection."},{type:"test_connections_row_blue",message0:"%1",args0:[{type:"input_value",name:"NAME",check:"greenRel"}],output:"noneOut",colour:230,tooltip:"Output: noneOut\nInput: greenRel\nInput connection can accept yellow blocks but not red blocks."},{type:"test_connections_row_yellow",message0:"%1",args0:[{type:"input_value",name:"NAME",check:["orangeRel","yellowRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nInput can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_row_red",message0:"%1",args0:[{type:"input_value",name:"NAME",check:"noneIn"}],output:"orangeRel",colour:0,tooltip:"Output: orangeRel\nInput: noneIn\nOutput can connect to yellow blocks, but not blue blocks."},{type:"test_connections_row_output",message0:"",output:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any input connection."},{type:"test_connections_multivalue_1valid",message0:"none %1 both %2",args0:[{type:"input_value",name:"NAME1",align:"RIGHT",check:"noneIn"},{type:"input_value",name:"NAME2",align:"RIGHT",check:["yellowRel","orangeRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput Top: noneIn\nInput Bottom: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nTop Input can connect to nothing, except grey blocks.\nBottom Input can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_multivalue_2valid",message0:"both %1 both %2",args0:[{type:"input_value",name:"NAME1",align:"RIGHT",check:["yellowRel","orangeRel"]},{type:"input_value",name:"NAME2",align:"RIGHT",check:["yellowRel","orangeRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput Top: yellowRel, orangeRel\nInput Bottom: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nTop Input can connect to yellow blocks and red blocks, but not blue blocks.\nBottom Input can connect to yellow blocks and red blocks, but not blue blocks."}]);const n=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_row_input">\n <value name="NAME">\n <block type="test_connections_row_blue">\n <value name="NAME">\n <block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_red">\n <value name="NAME">\n <block type="test_connections_row_output"/>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n</xml>'),n)};t.defineBlocksWithJsonArray([{type:"test_connections_stack_next",message0:"",nextStatement:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any previous connection."},{type:"test_connections_stack_blue",message0:"",previousStatement:"nonePrev",nextStatement:"greenRel",colour:230,tooltip:"Prev: nonePrev\nNext: greenRel\nNext connection can accept yellow blocks but not red blocks."},{type:"test_connections_stack_yellow",message0:"",previousStatement:["greenRel","yellowRel"],nextStatement:["yellowRel","orangeRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nNext can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_stack_red",message0:"",previousStatement:"orangeRel",nextStatement:"noneNext",colour:0,tooltip:"Prev: orangeRel\nNext: noneNext\nPrev can connect to yellow blocks, but not blue blocks."},{type:"test_connections_stack_prev",message0:"",previousStatement:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any input connection."}]);const s=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_stack_next">\n <next>\n <block type="test_connections_stack_blue">\n <next>\n <block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_red">\n <next>\n <block type="test_connections_stack_prev"/>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n</xml>'),n)};t.defineBlocksWithJsonArray([{type:"test_connections_statement_blue",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:"greenRel"}],previousStatement:"nonePrev",nextStatement:"greenRel",colour:230,tooltip:"Prev: nonePrev\nNext: greenRel\nStatement: greenRel\nNext connection can accept yellow blocks but not red blocks.\nStatement connection can accept yellow blocks but not red blocks."},{type:"test_connections_statement_yellow",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],nextStatement:["yellowRel","orangeRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nNext can connect to yellow blocks and red blocks, but not blue blocks.\nStatement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_statement_red",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:"noneNext"}],previousStatement:"orangeRel",nextStatement:"noneNext",colour:0,tooltip:"Prev: orangeRel\nNext: noneNext\nStatement: noneNext\nPrev connection can accept yellow blocks but not blue blocks.\nStatement connection accepts none."},{type:"test_connections_statement_nonext",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nStatement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_multistatement_1valid",message0:"none %1 both %2",args0:[{type:"input_statement",name:"NAME",check:"noneNext"},{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nTop Statement cannot connect to anything, except grey blocks.\nBottom Statement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_multistatement_2valid",message0:"both %1 both %2",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]},{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nTop Statement connection can accept yellow blocks and red blocks but not blue blocks.\nBottom Statement connection can accept yellow blocks and red blocks but not blue blocks.\n"}]);const i=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_statement_blue">\n <statement name="NAME">\n <block type="test_connections_statement_yellow">\n <statement name="NAME">\n <block type="test_connections_statement_yellow">\n <statement name="NAME">\n <block type="test_connections_statement_red"/>\n </statement>\n </block>\n </statement>\n </block>\n </statement>\n </block>\n</xml>'),n)},a={kind:"CATEGORY",name:"Connections",expanded:"true",contents:[{kind:"CATEGORY",name:"Row",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionRows"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_input"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_red"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_output"},{kind:"BLOCK",blockxml:'\n<block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_yellow" movable="false">\n </block>\n </value>\n</block>'},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multivalue_1valid"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multivalue_2valid"}]},{kind:"CATEGORY",name:"Stack",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionStacks"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_next"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_red"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_prev"},{kind:"BLOCK",blockxml:'\n<block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_yellow" movable="false"></block>\n </next>\n</block>'}]},{kind:"CATEGORY",name:"Statement",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionStatements"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_red"},{kind:"BLOCK",type:"test_connections_statement_nonext"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multistatement_1valid"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multistatement_2valid"}]}]};t.defineBlocksWithJsonArray([{type:"test_fields_angle",message0:"angle: %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:"90",alt:{type:"field_label",text:"NO ANGLE FIELD"}}],style:"math_blocks"},{type:"test_fields_text_input",message0:"text input %1",args0:[{type:"field_input",name:"TEXT_INPUT",text:"default"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_only_text_input",message0:"%1",args0:[{type:"field_input",name:"TEXT_INPUT",text:"default"}],style:"textInput",tooltip:"",helpUrl:"",output:"String"},{type:"test_fields_multilinetext",message0:"code %1",args0:[{type:"field_multilinetext",name:"CODE",text:"default1\ndefault2"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_fields_checkbox",message0:"checkbox %1",args0:[{type:"field_checkbox",name:"CHECKBOX",checked:!0}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_colour",message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_colour_options",message0:"colour options %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff4040",colourOptions:["#ff4040","#ff8080","#ffc0c0","#4040ff","#8080ff","#c0c0ff"],colourTitles:["dark pink","pink","light pink","dark blue","blue","light blue"],columns:3}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_fields_variable",message0:"variable %1",args0:[{type:"field_variable",name:"VARIABLE",variable:"item"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_label_serializable",message0:"label serializable %1",args0:[{type:"field_label_serializable",name:"LABEL",text:"default"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_image",message0:"image %1",args0:[{type:"field_image",name:"IMAGE",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"}],colour:230}]),t.defineBlocksWithJsonArray([{type:"test_numbers_float",message0:"float %1",args0:[{type:"field_number",name:"NUM",text:"0"}],style:"math_blocks",output:"Number",tooltip:"A number."},{type:"test_numbers_whole",message0:"precision 1 %1",args0:[{type:"field_number",name:"NUM",precision:1,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 1"},{type:"test_numbers_hundredths",message0:"precision 0.01 %1",args0:[{type:"field_number",name:"NUM",precision:.01,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 0.01"},{type:"test_numbers_halves",message0:"precision 0.5 %1",args0:[{type:"field_number",name:"NUM",precision:.5,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 0.5"},{type:"test_numbers_three_halves",message0:"precision 1.5 %1",args0:[{type:"field_number",name:"NUM",precision:1.5,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 1.5"},{type:"test_numbers_whole_bounded",message0:"midi note %1",args0:[{type:"field_number",name:"NOTE",precision:1,min:1,max:127,text:"0"}],style:"math_blocks",output:"Note",tooltip:"A midi note."}]);t.defineBlocksWithJsonArray([{type:"test_angles_protractor",message0:"protractor %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,mode:"protractor"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_compass",message0:"compass %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,mode:"compass"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_clockwise",message0:"clockwise %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,clockwise:!0}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_offset",message0:"offset 90 %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,offset:90}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_wrap",message0:"wrap %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,wrap:180}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_round_30",message0:"round 30 %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,round:30}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_round_0",message0:"no round %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,round:0}],style:"math_blocks",tooltip:"test tooltip"}]),t.defineBlocksWithJsonArray([{type:"test_dropdowns_long",message0:"long: %1",args0:[{type:"field_dropdown",name:"FIELDNAME",options:[["first item","ITEM1"],["second item","ITEM2"],["third item","ITEM3"],["fourth item","ITEM4"],["fifth item","ITEM5"],["sixth item","ITEM6"],["seventh item","ITEM7"],["eighth item","ITEM8"],["ninth item","ITEM9"],["tenth item","ITEM10"],["eleventh item","ITEM11"],["twelfth item","ITEM12"],["thirteenth item","ITEM13"],["fourteenth item","ITEM14"],["fifteenth item","ITEM15"],["sixteenth item","ITEM16"],["seventeenth item","ITEM17"],["eighteenth item","ITEM18"],["nineteenth item","ITEM19"],["twentieth item","ITEM20"],["twenty-first item","ITEM21"],["twenty-second item","ITEM22"],["twenty-third item","ITEM23"],["twenty-fourth item","ITEM24"],["twenty-fifth item","ITEM25"],["twenty-sixth item","ITEM26"],["twenty-seventh item","ITEM27"],["twenty-eighth item","ITEM28"],["twenty-ninth item","ITEM29"],["thirtieth item","ITEM30"],["thirty-first item","ITEM31"],["thirty-second item","ITEM32"]]}]},{type:"test_dropdowns_images",message0:"%1",args0:[{NOTE:"The following paths are relative to playground.html",type:"field_dropdown",name:"FIELDNAME",options:[[{src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},"A"],[{src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},"B"],[{src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},"C"],[{src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},"D"],[{src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},"E"],[{src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},"F"],[{src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},"G"],[{src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},"H"],[{src:"https://blockly-demo.appspot.com/static/tests/media/i.png",width:32,height:32,alt:"I"},"I"],[{src:"https://blockly-demo.appspot.com/static/tests/media/j.png",width:32,height:32,alt:"J"},"J"],[{src:"https://blockly-demo.appspot.com/static/tests/media/k.png",width:32,height:32,alt:"K"},"K"],[{src:"https://blockly-demo.appspot.com/static/tests/media/l.png",width:32,height:32,alt:"L"},"L"],[{src:"https://blockly-demo.appspot.com/static/tests/media/m.png",width:32,height:32,alt:"M"},"M"]]}]},{type:"test_dropdowns_images_and_text",message0:"%1",args0:[{type:"field_dropdown",name:"FIELDNAME",options:[["images and text","IMAGES AND TEXT"],[{src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},"A"],[{src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},"B"],[{src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},"C"],[{src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},"D"],[{src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},"E"],[{src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},"F"],[{src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},"G"],[{src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},"H"],["xyz","LMNOP"],[{src:"https://blockly-demo.appspot.com/static/tests/media/i.png",width:32,height:32,alt:"I"},"I"],[{src:"https://blockly-demo.appspot.com/static/tests/media/j.png",width:32,height:32,alt:"J"},"J"],[{src:"https://blockly-demo.appspot.com/static/tests/media/k.png",width:32,height:32,alt:"K"},"K"],[{src:"https://blockly-demo.appspot.com/static/tests/media/l.png",width:32,height:32,alt:"L"},"L"],[{src:"https://blockly-demo.appspot.com/static/tests/media/m.png",width:32,height:32,alt:"M"},"M"]]}]},{type:"test_dropdowns_in_mutator",message0:"dropdown mutator",mutator:"test_dropdown_mutator"},{type:"test_dropdowns_in_mutator_block",message0:"dropdown %1",args0:[{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]}]}]);const c=[],d=function(){t.prompt("Add an option?","option "+c.length,(function(t){t&&(console.log("Adding option: "+t),c.push([t,"OPTION"+c.length]))}))},p=function(){const e=c[0]?c[0][0]:"";t.prompt("Remove an option?",e,(function(t){for(let e,n=0;e=c[n];n++)e[0]==t&&(console.log("Removing option: "+t),c.splice(n,1))}))};t.Blocks.test_dropdowns_dynamic_random={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic random").appendField(e,"OPTIONS")},dynamicOptions:function(){const t=Math.floor(10*Math.random())+1,e=[];for(let n=0;n<t;n++)e.push([String(n),String(n)]);return e}},t.Blocks.test_dropdowns_dynamic_connect_dependant={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic connect-dependant").appendField(e,"OPTIONS"),this.setNextStatement(!0),this.setPreviousStatement(!0)},dynamicOptions:function(){if(this.sourceBlock_&&this.sourceBlock_.getSurroundParent()){const t=this.sourceBlock_.getSurroundParent(),e=[["connected","CONNECTED_KEY"],[`surroundParent: ${t.type}`,`${t.id}_type_key`],[`surroundParent: ${t.id}`,`${t.id}_key`]],n=this.sourceBlock_.getTopStackBlock();return n.id!==t.id&&(e.push([`topStack: ${n.type}`,`${n.id}_type_key`]),e.push([`topStack: ${n.id}`,`${n.id}_key`])),e}return[["unconnected","UNCONNECTED_KEY"]]}};const r={mutationToDom:function(){return t.utils.xml.createElement("mutation")},domToMutation:function(t){},saveExtraState:function(){return{}},loadExtraState:function(t){},decompose:function(t){const e=t.newBlock("test_dropdowns_in_mutator_block");return e.initSvg(),e},compose:function(t){}};t.Extensions.registerMutator("test_dropdown_mutator",r,null,["test_dropdowns_in_mutator_block"]),t.Blocks.test_dropdowns_dynamic={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic").appendField(e,"OPTIONS")},dynamicOptions:function(){return c.length?c:[["","OPTION0"]]}},t.defineBlocksWithJsonArray([{type:"test_images_datauri",message0:"Image data: URI %1",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAABHZJREFUaAXtmEuPDFEUx8cwJIx4jQjxSGYt4pWQiGSIz4A1O2FtLyx8B4+MxIKEtQkRsZBIEF/AAgki3gzjNfx/Xfc/rkpVd1dXdU13OMm/z73ndc+5r6rqgYHu01wNAfqa5kTZx+1I3PtNJ35Aqe4P6VrW+9mnEl6o/g/hu0Ab6koxg0nsjn+dVF6c+Yr8SZgUaGeRfR0ry6alzEFaGuYY/AryafFODjQ++EKOlfRq+nXSxzTeY2FHGHcocM/uIvXZWoA2ZJ1td0pGjKMoRY6d9Nr8ndemXdrMyayVYr1wQ9gn3BVIhNklNluKg06fNslTFDacG4q4LgwLxIIcO+nV+HtOY5HoF2FbgXG3y3ZKwPdsAb/KTeOZIxESOhRG2SB+SrgvfBDeC/cEZKwgdFjA5wydQHFMy2rh8WWxOYx4UJybiiTBR+Fzqu/nin2kHohj0a+dmEWfNYpwAefV3iSMCiMC5+GSYD0PSgjfWVkJDmoaJLRO8EocUXulMC68EW4KpuNqUAy2+EDpePRnjdj/JMhKUASH37N/S+0FgrePV+akZLWTl3+jRt4j7BbGhCUC9EAgcbbThdC+KL5aMA2Fxi5xbLkMoKXCmEBMYjMG5DGTXgW/XuqtiuVZNr8S4nM7cbBHBbYTehcxqDZJOTGv2DvJoKuC45lvaWiSbRea+cyHNN8i0UwHgyfilwUS+SYsFkiCmSYWD7tXwkOB5J8H7uRcCL48EPEDTMYqgYngneyl8FSAPHbSq+DXSWSFYmuwIhzg4WDgSYr93GY7kjQ++OaR7fP0M3IPNiNo0mBWCcxMm+izCtbBHRM5emR5FOvxi21ZibifF6Mh96BNjSIlgX9GfRJJkwen4CLbgrj2Tcds2Y9nt6VxQYOOkyo4TsO86IrkjRGvjNvmsQ8yCox1cTu2LdQuW4gT4wYyuZ21rbxKtsHHbcdynEK8TCEM7GS5jp3k8pAB16plQdRYCRLHxjp8JwVilSpG/h0TA08IXwUSAyTFNdwM2Nge32sCsTqmTp09c8zsM4H3KB6EJMcqW5+Oj946X88jklHMGoE3AuvVbJ/KbC1G4crkW4Ptsld4KzimZ1yiGSJJF0chy4Q7Av7xta5uMfKgxbz+WPMOxv9VrMhtwcmTJDqADKIAkgVeNWS8CbAi2M4akciEMCXwusFrB0WQPJy+z0qWDh98S58RxeiYvEXgnJUVIdIJcQqBQ8ib6fCNY+FTmMpsLZIlATiH1MQHFWT+Oun+JcvSOVZk3n5zsH3TTEuKgEjCf4k6pjnyZjqvhmMRrzCVWZF4MJLwwzGW086TW1eqAA/mWXO/b/n/Qnpt6f6vyL++Ir6hzCubj7q3lscz79tC/DVoXlkhVT0QWyXkV/TxYGhueSv/lvq6CuFM8CryQjgdsqJf2VmpfK+GJLOYi+FbvtIiGKwbK+JZNo+LQlb5+WCAbqyIY5rHhXSt3Y3BPOPmXUs+Dlzld7K30iMNwD8q3Ex85lquZv8QhzimdD/W9Xyb5H0z1Zbsb+OT/8HoqhrfAAAAAElFTkSuQmCC",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_small",message0:"Image too small %1",args0:[{type:"field_image",src:"media/30px.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_large",message0:"Image too large %1",args0:[{type:"field_image",src:"media/200px.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_fliprtl",message0:"Image flipped RTL %1",args0:[{type:"field_image",src:"media/arrow.png",width:50,height:50,alt:"*",flipRtl:!0}],colour:160},{type:"test_images_missing",message0:"Image missing %1",args0:[{type:"field_image",src:"missing.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_many_icons",message0:"Lots of network icons: %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16 %17 %18",args0:[{type:"input_dummy"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},{type:"input_dummy"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"}],style:"text_blocks"}]),t.Blocks.test_images_clickhandler={init:function(){this.appendDummyInput().appendField("Image click handler").appendField(new t.FieldImage("https://blockly-demo.appspot.com/static/tests/media/a.png",32,32,"image with click handler",this.onClick_),"IMAGE"),this.setStyle("text_blocks")},onClick_:function(){alert("Image clicked")}};t.Blocks.test_validators_dispose_block={init:function(){this.appendDummyInput().appendField("dispose block").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("Any changes to the text cause the block to be disposed")},validate:function(t){"default"!=t&&this.getSourceBlock().dispose(!0)}},t.Blocks.test_validators_text_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The display text will remain the input text, but the value should be the default text. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_text_A={init:function(){this.appendDummyInput().appendField("remove 'a'").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All 'a' characters are removed from field value. The display text will include invalid 'a' characters while the field is being edited, but the value will not.")},validate:function(t){return t.replace(/a/g,"")}},t.Blocks.test_validators_text_B={init:function(){this.appendDummyInput().appendField("'b' -> null").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("Upon detecting a 'b' character the input will validated to null (invalid). Upon removal it should revert to being valid. The display text will remain the input text, but if the input text is invalid the value should be the default text.")},validate:function(t){return-1!==t.indexOf("b")?null:t}},t.Blocks.test_validators_angle_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The field will display the input while the field is being edited (this includes the text and the graphic), but the value should be the default value. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_angle_mult30_force={init:function(){this.appendDummyInput().appendField("force mult of 30").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input value will be rounded to the nearest multiple of 30. The field will display the input while the field is being edited (this includes the text and the graphic), but the value will be the validated (rounded) value. Note: If you want to do rounding this is not the proper way, use the ROUND property of the field angle instead.")},validate:function(t){return 30*Math.round(t/30)}},t.Blocks.test_validators_angle_mult30_null={init:function(){this.appendDummyInput().appendField("not mult of 30 -> null").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input value is not a multiple of 30, the input will validated to null (invalid). The field will display the input while the field is being edited (this includes the text and the graphic), but if the input value is invalid the value should be the default value.")},validate:function(t){return t%30!=0?null:t}},t.Blocks.test_validators_checkbox_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The new input always validates to null (invalid). This means that the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_checkbox_match={init:function(){this.appendDummyInput().appendField("force match").appendField(new t.FieldCheckbox(!0),"MATCH").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The validator for this block only works on the end-most checkbox. The validator will always return the value of the start-most checkbox. Therefore they should always match.")},validate:function(t){return this.sourceBlock_.getFieldValue("MATCH")}},t.Blocks.test_validators_checkbox_not_match_null={init:function(){this.appendDummyInput().appendField("not match -> null").appendField(new t.FieldCheckbox(!0),"MATCH").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The validator for this block only works on the end-most checkbox. If the new value does not match the value of the start-most checkbox, it will return null (invalid), which means the field value should not change. Therefore they should always match.")},validate:function(t){return this.sourceBlock_.getFieldValue("MATCH")!=t?null:t}},t.Blocks.test_validators_colour_null={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("always null").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). This means the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_colour_force_red={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("force full red").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("The input will have its red value replaced with full red.")},validate:function(t){return"#ff"+t.substr(3,4)}},t.Blocks.test_validators_colour_red_null={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("not red -> null").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("If the input does not have full red, the input will validate to null (invalid). Otherwise it will return the input value")},validate:function(t){return"ff"!=t.substr(1,2)?null:t}},t.Blocks.test_validators_dropdown_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). This means the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_dropdown_force_1s={init:function(){this.appendDummyInput().appendField("force 1s").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input's value will always change to start with 1.")},validate:function(t){return"1"+t.charAt(1)}},t.Blocks.test_validators_dropdown_1s_null={init:function(){this.appendDummyInput().appendField("not 1s -> null").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input does not start with 1, the input will validate to null (invalid). Otherwise it will return the input value.")},validate:function(t){return"1"!=t.charAt(0)?null:t}},t.Blocks.test_validators_number_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The field will display the input while the field is being edited, but the value should be the default value. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_number_mult10_force={init:function(){this.appendDummyInput().appendField("force mult of 10").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input value will be rounded to the nearest multiple of 10. The field will display the input while the field is being edited, but the value should be the validated (rounded) value. Note: If you want to do rounding this is not the proper way, use the precision option of the number field constructor instead.")},validate:function(t){return 10*Math.round(t/10)}},t.Blocks.test_validators_number_mult10_null={init:function(){this.appendDummyInput().appendField("not mult of 10 -> null").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input value is not a multiple of 10, the input will validate to null (invalid). The field will display the input while the field is being edited, but if the input value is invalid the value should be the default value.")},validate:function(t){return t%10!=0?null:t}},t.Blocks.test_validators_variable_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All ids validate to null (invalid). This means the variable should not change.")},validate:function(t){return null}},t.Blocks.test_validators_variable_force_1s={init:function(){this.appendDummyInput().appendField("force 1s").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("The id will always change to start with 1.")},validate:function(t){return"1"+t.charAt(1)}},t.Blocks.test_validators_variable_1s_null={init:function(){this.appendDummyInput().appendField("not 1s -> null").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the id does not start with 1, the id will validate to null (invalid). Otherwise it will return the id.")},validate:function(t){return"1"!=t.charAt(0)?null:t}};const u={kind:"CATEGORY",name:"Fields",expanded:"true",contents:[{kind:"CATEGORY",name:"Defaults",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"set random style",callbackkey:"setRandomStyle"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle enabled",callbackkey:"toggleEnabled"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle shadow",callbackkey:"toggleShadow"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle collapsed",callbackkey:"toggleCollapsed"},{kind:"BLOCK",type:"test_fields_angle"},{kind:"BLOCK",type:"test_fields_checkbox"},{kind:"BLOCK",type:"test_fields_colour"},{kind:"BLOCK",type:"test_fields_colour_options"},{kind:"BLOCK",type:"test_fields_text_input"},{kind:"BLOCK",type:"test_fields_only_text_input"},{kind:"BLOCK",type:"test_fields_multilinetext"},{kind:"BLOCK",type:"test_fields_variable"},{kind:"BUTTON",text:"randomize label text",callbackkey:"randomizeLabelText"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_fields_label_serializable"},{kind:"BUTTON",text:"change image",callbackkey:"changeImage"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_fields_image"}]},{kind:"CATEGORY",name:"Numbers",contents:[{kind:"BLOCK",blockxml:'\n<block type="test_numbers_float">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_hundredths">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_halves">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_whole">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_three_halves">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_whole_bounded">\n <field name="NOTE">60</field>\n</block>'}]},{kind:"CATEGORY",name:"Angles",contents:[{kind:"BLOCK",type:"test_angles_clockwise"},{kind:"BLOCK",type:"test_angles_offset"},{kind:"BLOCK",type:"test_angles_wrap"},{kind:"BLOCK",type:"test_angles_round_30"},{kind:"BLOCK",type:"test_angles_round_0"},{kind:"BLOCK",type:"test_angles_protractor"},{kind:"BLOCK",type:"test_angles_compass"}]},{kind:"CATEGORY",name:"Drop-downs",contents:[{kind:"LABEL",text:"Dynamic"},{kind:"BLOCK",type:"test_dropdowns_dynamic"},{kind:"BUTTON",text:"Add option",callbackkey:"addDynamicOption"},{kind:"BUTTON",text:"Remove option",callbackkey:"removeDynamicOption"},{kind:"BLOCK",type:"test_dropdowns_dynamic_random"},{kind:"BLOCK",type:"test_dropdowns_dynamic_connect_dependant"},{kind:"LABEL",text:"Other"},{kind:"BLOCK",type:"test_dropdowns_long"},{kind:"BLOCK",type:"test_dropdowns_images"},{kind:"BLOCK",type:"test_dropdowns_images_and_text"}]},{kind:"CATEGORY",name:"Images",contents:[{kind:"BLOCK",type:"test_images_datauri"},{kind:"BLOCK",type:"test_images_small"},{kind:"BLOCK",type:"test_images_large"},{kind:"BLOCK",type:"test_images_fliprtl"},{kind:"BLOCK",type:"test_images_missing"},{kind:"BLOCK",type:"test_images_many_icons"},{kind:"BLOCK",type:"test_images_clickhandler"}]},{kind:"CATEGORY",name:"Emoji! o((*^ᴗ^*))o",contents:[{kind:"LABEL",text:"Unicode & Emojis"},{kind:"BLOCK",type:"test_style_emoji"},{kind:"BLOCK",blockxml:'\n<block type="text">\n <field name="TEXT">Robot face in text field:🤖</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text">\n <field name="TEXT">Zalgo in text field:B̛̻̦̬̘̰͎̥̈̔͊͞ͅl̡͖̫̺̬̖̣̳̃̀́͑͑̕͟͠͝o̢̹͙̮̫͔͋̉̊̑̿̽̚c̸̹̹̜͙̹̠͋̒͑̊̇͝k̡͉̫͇̖̳͖̊͒́̆̄̎̂̔̕͜͞l̰̙̞̳̩̠͖̯̀̆̈́̿̈̓͗y̨̡̟͇̮͈̬̙̲̏̅̀͘͠</field>\n</block>'}]},{kind:"CATEGORY",name:"Validators",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"set input",callbackkey:"setInput"},{kind:"LABEL",text:"Dispose block"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dispose_block"},{kind:"LABEL",text:"Angles"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_mult30_force"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_mult30_null"},{kind:"LABEL",text:"Checkboxes"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_match"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_not_match_null"},{kind:"LABEL",text:"Colours"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_force_red"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_red_null"},{kind:"LABEL",text:"Dropdowns"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_force_1s"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_1s_null"},{kind:"LABEL",text:"Numbers"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_mult10_force"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_mult10_null"},{kind:"LABEL",text:"Text"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_A"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_B"},{kind:"LABEL",text:"Variables"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"add test variables",callbackkey:"addVariables","web-class":"modifiesWorkspace"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_force_1s"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_1s_null"}]}]};t.defineBlocksWithJsonArray([{type:"test_mutator_colorChange",message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"colour_blocks"}]);const m={mutationToDom:function(){const e=t.utils.xml.createElement("mutation");return e.setAttribute("colour",this.getColour()),e},domToMutation:function(t){this.setColour(t.getAttribute("colour"))},saveExtraState:function(){return{colour:this.getColour()}},loadExtraState:function(t){this.setColour(t.colour)},decompose:function(e){const n=t.serialization.blocks.append({type:"test_mutator_colorChange"},e);return n.getField("COLOUR").setValue(this.getColour()),n},compose:function(t){this.setColour(t.getFieldValue("COLOUR"))}},_=[];for(let t=0;t<20;t++)_.push(`test_mutator_category_${t}`);const h=_.map((t=>({type:t,message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"colour_blocks"})));t.defineBlocksWithJsonArray([{type:"test_mutators_many",message0:"test many blocks mutator",mutator:"test_many_blocks_mutator",colour:"#000000"},...h]),t.Extensions.registerMutator("test_many_blocks_mutator",m,null,[..._]),t.defineBlocksWithJsonArray([{type:"test_mutators_noflyout",message0:"noflyout mutator",mutator:"test_noflyout_mutator",colour:"#000000"}]),t.Extensions.registerMutator("test_noflyout_mutator",m,null,[]),t.defineBlocksWithJsonArray([{type:"test_mutators_changeableFlyout",message0:"changeable flyout mutator",mutator:"test_changeableFlyout_mutator",colour:"#000000"}]),t.Extensions.registerMutator("test_changeableFlyout_mutator",m,null,["text"]),t.defineBlocksWithJsonArray([{type:"test_style_hat",message0:"Hat block (event)",nextStatement:null,style:"hat_blocks"},{type:"test_style_hex1",message0:"Block color: Bright purple %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#992aff"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#992aff"},{type:"test_style_hex2",message0:"Block color: White %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#fefefe"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#fefefe"},{type:"test_style_hex3",message0:"Block color: Black %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#010101"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#010101"},{type:"test_style_no_colour",message0:"Block color: unset"},{type:"test_style_hex4",message0:"Block color: #RRGGBBAA (invalid)",colour:"#992aff99"},{type:"test_style_hex5",message0:"Block color: #RRGGBB (invalid)",colour:"#NotHex"},{type:"test_style_emoji",message0:"Robot Face: 🤖",colour:"#AAAAAA"}]);class k extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}}k.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_no_overrides",k);class y extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}toXml(t){return t.setAttribute("value",this.getValue()),t}fromXml(t){this.setValue(t.getAttribute("value"))}}y.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_xml",y);class g extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}saveState(){return{value:this.getValue()}}loadState(t){this.setValue(t.value)}}g.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_jso",g);class b extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}toXml(t){return t.setAttribute("value",this.getValue()),t}fromXml(t){this.setValue(t.getAttribute("value"))}saveState(){return{value:this.getValue()}}loadState(t){this.setValue(t.value)}}b.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_both",b),e().defineBlocksWithJsonArray([{type:"test_field_serialization_no_overrides",message0:"no overrides: %1",args0:[{type:"field_no_overrides",name:"LABEL",text:"test"}],colour:0,output:null},{type:"test_field_serialization_xml",message0:"xml: %1",args0:[{type:"field_xml",name:"LABEL",text:"test"}],colour:30,output:null},{type:"test_field_serialization_jso",message0:"jso: %1",args0:[{type:"field_jso",name:"LABEL",text:"test"}],colour:90,output:null},{type:"test_field_serialization_both",message0:"both: %1",args0:[{type:"field_both",name:"LABEL",text:"test"}],colour:150,output:null}]),e().Blocks.test_extra_state_xml=Object.assign({},e().Blocks.lists_create_with),delete e().Blocks.test_extra_state_xml.saveExtraState,delete e().Blocks.test_extra_state_xml.loadExtraState,e().Blocks.test_extra_state_xml.init=function(){this.setColour(30),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))},e().Blocks.test_extra_state_jso=Object.assign({},e().Blocks.lists_create_with),delete e().Blocks.test_extra_state_jso.mutationToDom,delete e().Blocks.test_extra_state_jso.domToMutation,e().Blocks.test_extra_state_jso.init=function(){this.setColour(90),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))},e().Blocks.test_extra_state_both=Object.assign({},e().Blocks.lists_create_with),e().Blocks.test_extra_state_both.init=function(){this.setColour(150),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))};const f={contents:[{kind:"CATEGORY",name:"Align",contents:[{kind:"BLOCK",type:"test_align_dummy_right"},{kind:"BLOCK",type:"test_align_all"},{kind:"BLOCK",type:"test_align_with_external_input"}]},{kind:"CATEGORY",name:"Basic",contents:[{kind:"BLOCK",type:"test_basic_empty"},{kind:"BLOCK",type:"test_basic_empty_with_mutator"},{kind:"BLOCK",type:"test_basic_dummy"},{kind:"BLOCK",type:"test_basic_multiple_dummy"},{kind:"BLOCK",type:"test_basic_stack"},{kind:"BLOCK",type:"test_basic_row"},{kind:"BLOCK",type:"test_basic_value_to_stack"},{kind:"BLOCK",type:"test_basic_value_to_statement"},{kind:"BLOCK",type:"test_basic_limit_instances"},{kind:"BLOCK",type:"test_basic_tooltips"},{kind:"BLOCK",type:"test_basic_javascript"}]},a,{kind:"CATEGORY",name:"Drag",contents:[{kind:"LABEL",text:"Drag each to the workspace"},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <block type="text">\n <field name="TEXT">Drag me by this child</field>\n </block>\n </value>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Drag me by this shadow</field>\n </shadow>\n </value>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Shadow value</field>\n </shadow>\n </value>\n <next>\n <shadow type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Shadow statement</field>\n </shadow>\n </value>\n </shadow>\n </next>\n</block>'},{kind:"LABEL",text:"Multiple Variable Refs"},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <block type="variables_get">\n <field name="VAR" id="item">item</field>\n </block>\n </value>\n <next>\n <block type="text_print">\n <value name="TEXT">\n <block type="variables_get">\n <field name="VAR" id="item">item</field>\n </block>\n </value>\n </block>\n </next>\n</block>'},{kind:"LABEL",text:"Procedure Definitions"},{kind:"BLOCK",blockxml:'\n<block type="procedures_defnoreturn">\n <field name="NAME">without arguments</field>\n <statement name="STACK">\n <block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">No argument reference.</field>\n </shadow>\n </value>\n </block>\n </statement>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="procedures_defnoreturn">\n <mutation><arg name="fnArgument"></arg></mutation>\n <field name="NAME">with one argument</field>\n <statement name="STACK">\n <block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Expected an argument reference here.</field>\n </shadow>\n <block type="variables_get">\n <field name="VAR">fnArgument</field>\n </block>\n </value>\n </block>\n </statement>\n</block>'}]},u,{kind:"CATEGORY",name:"Mutators",contents:[{kind:"LABEL",text:"logic_compare"},{kind:"BLOCK",type:"logic_compare",inputs:{A:{shadow:{type:"math_number",fields:{NUM:10}}},B:{shadow:{type:"math_number",fields:{NUM:10}}}}},{kind:"BLOCK",type:"logic_compare",inputs:{A:{block:{type:"math_number",fields:{NUM:10}}},B:{block:{type:"math_number",fields:{NUM:10}}}}},{kind:"BLOCK",type:"test_mutators_noflyout"},{kind:"BLOCK",type:"test_mutators_many"},{kind:"BLOCK",type:"test_mutators_changeableFlyout"}]},{kind:"CATEGORY",name:"Style",contents:[{kind:"LABEL",text:"Hats"},{kind:"BLOCK",type:"test_style_hat"},{kind:"LABEL",text:"Colour"},{kind:"BLOCK",type:"test_style_hex1"},{kind:"BLOCK",type:"test_style_hex2"},{kind:"BLOCK",type:"test_style_hex3"},{kind:"BLOCK",type:"test_style_no_colour"},{kind:"BLOCK",type:"test_style_hex4"},{kind:"BLOCK",type:"test_style_hex5",gap:"40"},{kind:"BLOCK",type:"test_style_hex5",disabled:"true"}]},{kind:"CATEGORY",name:"Serialization",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"randomize text",callbackkey:"randomizeText"},{kind:"BLOCK",type:"test_field_serialization_no_overrides"},{kind:"BLOCK",type:"test_field_serialization_xml"},{kind:"BLOCK",type:"test_field_serialization_jso"},{kind:"BLOCK",type:"test_field_serialization_both"},{kind:"SEP",gap:30},{kind:"BLOCK",blockxml:'<block type="test_extra_state_xml"><mutation items="2"></mutation></block>'},{kind:"BLOCK",type:"test_extra_state_jso",extraState:{itemCount:2}},{kind:"BLOCK",type:"test_extra_state_both",extraState:{itemCount:2}},{kind:"SEP",gap:30},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_no_overrides"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_xml"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_jso"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_both"}}}},{kind:"SEP",gap:30},{kind:"BLOCK",blockxml:'<block type="text_print"><value name="TEXT"><shadow type="test_extra_state_xml"><mutation items="2"></mutation></shadow></value></block>'},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_extra_state_jso",extraState:{itemCount:2}}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_extra_state_both",extraState:{itemCount:2}}}}}]}]};function x(e){(function(t){!function(t){t.registerButtonCallback("insertConnectionRows",n)}(t),function(t){t.registerButtonCallback("insertConnectionStacks",s)}(t),function(t){t.registerButtonCallback("insertConnectionStatements",i)}(t)})(e),function(e){!function(t){t.registerButtonCallback("randomizeLabelText",(function(t){const e=t.getTargetWorkspace().getBlocksByType("test_fields_label_serializable");for(let t,n=0;t=e[n];n++){let e="";for(let t=0;t<4;t++)e+="AB".charAt(Math.floor(Math.random()*"AB".length));t.setFieldValue(e,"LABEL")}})),t.registerButtonCallback("setRandomStyle",(function(e){const n=e.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1),o=Object.keys(t.getRenderer().getConstants().blockStyles);o.splice(o.indexOf(n[0].getStyleName()),1);const l=o[Math.floor(Math.random()*o.length)];for(let t,e=0;t=n[e];e++)t.setStyle(l)})),t.registerButtonCallback("toggleEnabled",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setEnabled(!t.isEnabled())})),t.registerButtonCallback("toggleShadow",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setShadow(!t.isShadow())})),t.registerButtonCallback("toggleCollapsed",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setCollapsed(!t.isCollapsed())})),t.registerButtonCallback("changeImage",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getBlocksByType("test_fields_image"),n="abcdefghijklm",o="https://blockly-demo.appspot.com/static/tests/media/"+n.charAt(Math.floor(Math.random()*n.length))+".png";for(let t,n=0;t=e[n];n++)t.getField("IMAGE").setValue(o)}))}(e),function(t){t.registerButtonCallback("addDynamicOption",d),t.registerButtonCallback("removeDynamicOption",p)}(e),function(e){e.registerButtonCallback("addVariables",(function(t){e.createVariable("1b","","1B"),e.createVariable("1c","","1C"),e.createVariable("2a","","2A"),e.createVariable("2b","","2B"),e.createVariable("2c","","2C")})),e.registerButtonCallback("setInput",(function(e){t.prompt("Input text to set.","ab",(function(t){const n=e.getTargetWorkspace().getAllBlocks(!1);for(let e,o=0;e=n[o];o++)e.getField("INPUT")&&e.setFieldValue(t,"INPUT")}))}))}(e)}(e),function(t){t.registerButtonCallback("randomizeText",(function(t){const e=t.getTargetWorkspace(),n=[...e.getBlocksByType("test_field_serialization_no_overrides"),...e.getBlocksByType("test_field_serialization_xml"),...e.getBlocksByType("test_field_serialization_jso"),...e.getBlocksByType("test_field_serialization_both")],o="ABCDEF";for(let t,e=0;t=n[e];e++){let e="";for(let t=0;t<4;t++)e+=o.charAt(Math.floor(Math.random()*o.length));t.setFieldValue(e,"LABEL")}}))}(e),e.registerButtonCallback("addAllBlocksToWorkspace",(function(e){const n=e.getTargetWorkspace(),o=n.getFlyout().getWorkspace().getTopBlocks();for(let e,l=0;e=o[l];l++){const o=t.serialization.blocks.save(e,{addCoordinates:!0});t.serialization.blocks.append(o,n)}}))}})(),l})()));
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("blockly/core"));else if("function"==typeof define&&define.amd)define(["blockly/core"],e);else{var n="object"==typeof exports?e(require("blockly/core")):e(t.Blockly);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(t=>(()=>{"use strict";var e={573:e=>{e.exports=t}},n={};function o(t){var l=n[t];if(void 0!==l)return l.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,o),s.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var l={};return(()=>{o.r(l),o.d(l,{toolboxTestBlocks:()=>f,toolboxTestBlocksInit:()=>x});var t=o(573),e=o.n(t);t.defineBlocksWithJsonArray([{type:"test_align_dummy_right",message0:"text right %1 long text right %2",args0:[{type:"input_dummy",align:"RIGHT"},{type:"input_dummy",align:"RIGHT"}],style:"math_blocks"},{type:"test_align_all",message0:"text %1 long text left %2 text centre %3 much longer text right %4",args0:[{type:"input_dummy"},{type:"input_dummy",align:"LEFT"},{type:"input_dummy",align:"CENTRE"},{type:"input_dummy",align:"RIGHT"}],style:"math_blocks"},{type:"test_align_with_external_input",message0:"text right %1 long text centre %2 text left %3 much longer text %4",args0:[{type:"input_dummy",align:"RIGHT"},{type:"input_dummy",align:"CENTRE"},{type:"input_dummy",align:"LEFT"},{type:"input_value",name:"VALUE"}],inputsInline:!1,style:"math_blocks"}]),t.defineBlocksWithJsonArray([{type:"test_basic_empty",message0:"",args0:[]},{type:"test_basic_stack",message0:"stack block",previousStatement:null,nextStatement:null,colour:"120"},{type:"test_basic_dummy",message0:"dummy input %1",args0:[{type:"input_dummy"}],style:"math_blocks"},{type:"test_basic_multiple_dummy",message0:"first dummy %1 second dummy %2",args0:[{type:"input_dummy"},{type:"input_dummy"}],style:"math_blocks"},{type:"test_basic_row",message0:"row block %1",args0:[{type:"input_value",name:"INPUT"}],output:null,style:"math_blocks"},{type:"test_basic_value_to_stack",message0:"value to stack",nextStatement:null,output:null,style:"math_blocks"},{type:"test_basic_value_to_statement",message0:"value to statement %1",args0:[{type:"input_statement",name:"STATEMENT"}],output:null,style:"math_blocks"},{type:"test_basic_limit_instances",message0:"limit 3 instances %1 %2",args0:[{type:"input_dummy"},{type:"input_statement",name:"STATEMENT"}],previousStatement:null,nextStatement:null,style:"math_blocks"},{type:"test_basic_tooltips",message0:"%1 %2 %3",args0:[{type:"field_label",name:"NAME",text:"field tooltip",tooltip:"This is a JSON tooltip for the *field*."},{type:"input_dummy"},{type:"field_label",name:"NAME",text:"block tooltip"}],tooltip:"This is a JSON tooltip for the *block*.",style:"math_blocks"},{type:"test_basic_javascript",message0:"function %1(%2) { %3 %4 return %5 }",args0:["foo","args",{type:"input_dummy"},{type:"input_statement",name:"STACK"},{type:"input_value",check:"number",align:"right",name:"RETURN"}],inputsInline:!0,colour:200,tooltip:"Hello world."}]),t.Blocks.test_basic_empty_with_mutator={init:function(){this.setMutator(new t.icons.MutatorIcon(["math_number"],this))},decompose:function(t){const e=t.newBlock("math_number");return e.initSvg(),e},compose:function(){}},t.Blocks.test_chameleon={hasOutput:!0,hasPrevious:!0,init:function(){this.appendDummyInput().appendField("chameleon"),this.setColour(120),this.updateShape()},onchange:function(e){e.type===t.Events.BLOCK_DRAG&&(console.log("got drag event"),this.hasPrevious=!this.outputConnection||!this.outputConnection.targetBlock(),this.hasOutput=!this.getPreviousBlock(),this.updateShape())},updateShape:function(){this.setPreviousStatement(this.hasPrevious),this.setOutput(this.hasOutput)}},t.defineBlocksWithJsonArray([{type:"test_connections_row_input",message0:"%1",args0:[{type:"input_value",name:"NAME"}],colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any output connection."},{type:"test_connections_row_blue",message0:"%1",args0:[{type:"input_value",name:"NAME",check:"greenRel"}],output:"noneOut",colour:230,tooltip:"Output: noneOut\nInput: greenRel\nInput connection can accept yellow blocks but not red blocks."},{type:"test_connections_row_yellow",message0:"%1",args0:[{type:"input_value",name:"NAME",check:["orangeRel","yellowRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nInput can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_row_red",message0:"%1",args0:[{type:"input_value",name:"NAME",check:"noneIn"}],output:"orangeRel",colour:0,tooltip:"Output: orangeRel\nInput: noneIn\nOutput can connect to yellow blocks, but not blue blocks."},{type:"test_connections_row_output",message0:"",output:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any input connection."},{type:"test_connections_multivalue_1valid",message0:"none %1 both %2",args0:[{type:"input_value",name:"NAME1",align:"RIGHT",check:"noneIn"},{type:"input_value",name:"NAME2",align:"RIGHT",check:["yellowRel","orangeRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput Top: noneIn\nInput Bottom: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nTop Input can connect to nothing, except grey blocks.\nBottom Input can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_multivalue_2valid",message0:"both %1 both %2",args0:[{type:"input_value",name:"NAME1",align:"RIGHT",check:["yellowRel","orangeRel"]},{type:"input_value",name:"NAME2",align:"RIGHT",check:["yellowRel","orangeRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput Top: yellowRel, orangeRel\nInput Bottom: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nTop Input can connect to yellow blocks and red blocks, but not blue blocks.\nBottom Input can connect to yellow blocks and red blocks, but not blue blocks."}]);const n=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_row_input">\n <value name="NAME">\n <block type="test_connections_row_blue">\n <value name="NAME">\n <block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_red">\n <value name="NAME">\n <block type="test_connections_row_output"/>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n</xml>'),n)};t.defineBlocksWithJsonArray([{type:"test_connections_stack_next",message0:"",nextStatement:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any previous connection."},{type:"test_connections_stack_blue",message0:"",previousStatement:"nonePrev",nextStatement:"greenRel",colour:230,tooltip:"Prev: nonePrev\nNext: greenRel\nNext connection can accept yellow blocks but not red blocks."},{type:"test_connections_stack_yellow",message0:"",previousStatement:["greenRel","yellowRel"],nextStatement:["yellowRel","orangeRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nNext can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_stack_red",message0:"",previousStatement:"orangeRel",nextStatement:"noneNext",colour:0,tooltip:"Prev: orangeRel\nNext: noneNext\nPrev can connect to yellow blocks, but not blue blocks."},{type:"test_connections_stack_prev",message0:"",previousStatement:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any input connection."}]);const s=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_stack_next">\n <next>\n <block type="test_connections_stack_blue">\n <next>\n <block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_red">\n <next>\n <block type="test_connections_stack_prev"/>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n</xml>'),n)};t.defineBlocksWithJsonArray([{type:"test_connections_statement_blue",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:"greenRel"}],previousStatement:"nonePrev",nextStatement:"greenRel",colour:230,tooltip:"Prev: nonePrev\nNext: greenRel\nStatement: greenRel\nNext connection can accept yellow blocks but not red blocks.\nStatement connection can accept yellow blocks but not red blocks."},{type:"test_connections_statement_yellow",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],nextStatement:["yellowRel","orangeRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nNext can connect to yellow blocks and red blocks, but not blue blocks.\nStatement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_statement_red",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:"noneNext"}],previousStatement:"orangeRel",nextStatement:"noneNext",colour:0,tooltip:"Prev: orangeRel\nNext: noneNext\nStatement: noneNext\nPrev connection can accept yellow blocks but not blue blocks.\nStatement connection accepts none."},{type:"test_connections_statement_nonext",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nStatement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_multistatement_1valid",message0:"none %1 both %2",args0:[{type:"input_statement",name:"NAME",check:"noneNext"},{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nTop Statement cannot connect to anything, except grey blocks.\nBottom Statement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_multistatement_2valid",message0:"both %1 both %2",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]},{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nTop Statement connection can accept yellow blocks and red blocks but not blue blocks.\nBottom Statement connection can accept yellow blocks and red blocks but not blue blocks.\n"}]);const i=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_statement_blue">\n <statement name="NAME">\n <block type="test_connections_statement_yellow">\n <statement name="NAME">\n <block type="test_connections_statement_yellow">\n <statement name="NAME">\n <block type="test_connections_statement_red"/>\n </statement>\n </block>\n </statement>\n </block>\n </statement>\n </block>\n</xml>'),n)},a={kind:"CATEGORY",name:"Connections",expanded:"true",contents:[{kind:"CATEGORY",name:"Row",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionRows"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_input"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_red"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_output"},{kind:"BLOCK",blockxml:'\n<block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_yellow" movable="false">\n </block>\n </value>\n</block>'},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multivalue_1valid"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multivalue_2valid"}]},{kind:"CATEGORY",name:"Stack",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionStacks"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_next"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_red"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_prev"},{kind:"BLOCK",blockxml:'\n<block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_yellow" movable="false"></block>\n </next>\n</block>'}]},{kind:"CATEGORY",name:"Statement",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionStatements"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_red"},{kind:"BLOCK",type:"test_connections_statement_nonext"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multistatement_1valid"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multistatement_2valid"}]}]};t.defineBlocksWithJsonArray([{type:"test_fields_angle",message0:"angle: %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:"90",alt:{type:"field_label",text:"NO ANGLE FIELD"}}],style:"math_blocks"},{type:"test_fields_text_input",message0:"text input %1",args0:[{type:"field_input",name:"TEXT_INPUT",text:"default"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_only_text_input",message0:"%1",args0:[{type:"field_input",name:"TEXT_INPUT",text:"default"}],style:"textInput",tooltip:"",helpUrl:"",output:"String"},{type:"test_fields_multilinetext",message0:"code %1",args0:[{type:"field_multilinetext",name:"CODE",text:"default1\ndefault2"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_fields_checkbox",message0:"checkbox %1",args0:[{type:"field_checkbox",name:"CHECKBOX",checked:!0}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_colour",message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_colour_options",message0:"colour options %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff4040",colourOptions:["#ff4040","#ff8080","#ffc0c0","#4040ff","#8080ff","#c0c0ff"],colourTitles:["dark pink","pink","light pink","dark blue","blue","light blue"],columns:3}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_fields_variable",message0:"variable %1",args0:[{type:"field_variable",name:"VARIABLE",variable:"item"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_label_serializable",message0:"label serializable %1",args0:[{type:"field_label_serializable",name:"LABEL",text:"default"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_image",message0:"image %1",args0:[{type:"field_image",name:"IMAGE",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"}],colour:230}]),t.defineBlocksWithJsonArray([{type:"test_numbers_float",message0:"float %1",args0:[{type:"field_number",name:"NUM",text:"0"}],style:"math_blocks",output:"Number",tooltip:"A number."},{type:"test_numbers_whole",message0:"precision 1 %1",args0:[{type:"field_number",name:"NUM",precision:1,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 1"},{type:"test_numbers_hundredths",message0:"precision 0.01 %1",args0:[{type:"field_number",name:"NUM",precision:.01,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 0.01"},{type:"test_numbers_halves",message0:"precision 0.5 %1",args0:[{type:"field_number",name:"NUM",precision:.5,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 0.5"},{type:"test_numbers_three_halves",message0:"precision 1.5 %1",args0:[{type:"field_number",name:"NUM",precision:1.5,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 1.5"},{type:"test_numbers_whole_bounded",message0:"midi note %1",args0:[{type:"field_number",name:"NOTE",precision:1,min:1,max:127,text:"0"}],style:"math_blocks",output:"Note",tooltip:"A midi note."}]);t.defineBlocksWithJsonArray([{type:"test_angles_protractor",message0:"protractor %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,mode:"protractor"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_compass",message0:"compass %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,mode:"compass"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_clockwise",message0:"clockwise %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,clockwise:!0}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_offset",message0:"offset 90 %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,offset:90}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_wrap",message0:"wrap %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,wrap:180}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_round_30",message0:"round 30 %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,round:30}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_round_0",message0:"no round %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,round:0}],style:"math_blocks",tooltip:"test tooltip"}]),t.defineBlocksWithJsonArray([{type:"test_dropdowns_long",message0:"long: %1",args0:[{type:"field_dropdown",name:"FIELDNAME",options:[["first item","ITEM1"],["second item","ITEM2"],["third item","ITEM3"],["fourth item","ITEM4"],["fifth item","ITEM5"],["sixth item","ITEM6"],["seventh item","ITEM7"],["eighth item","ITEM8"],["ninth item","ITEM9"],["tenth item","ITEM10"],["eleventh item","ITEM11"],["twelfth item","ITEM12"],["thirteenth item","ITEM13"],["fourteenth item","ITEM14"],["fifteenth item","ITEM15"],["sixteenth item","ITEM16"],["seventeenth item","ITEM17"],["eighteenth item","ITEM18"],["nineteenth item","ITEM19"],["twentieth item","ITEM20"],["twenty-first item","ITEM21"],["twenty-second item","ITEM22"],["twenty-third item","ITEM23"],["twenty-fourth item","ITEM24"],["twenty-fifth item","ITEM25"],["twenty-sixth item","ITEM26"],["twenty-seventh item","ITEM27"],["twenty-eighth item","ITEM28"],["twenty-ninth item","ITEM29"],["thirtieth item","ITEM30"],["thirty-first item","ITEM31"],["thirty-second item","ITEM32"]]}]},{type:"test_dropdowns_images",message0:"%1",args0:[{NOTE:"The following paths are relative to playground.html",type:"field_dropdown",name:"FIELDNAME",options:[[{src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},"A"],[{src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},"B"],[{src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},"C"],[{src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},"D"],[{src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},"E"],[{src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},"F"],[{src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},"G"],[{src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},"H"],[{src:"https://blockly-demo.appspot.com/static/tests/media/i.png",width:32,height:32,alt:"I"},"I"],[{src:"https://blockly-demo.appspot.com/static/tests/media/j.png",width:32,height:32,alt:"J"},"J"],[{src:"https://blockly-demo.appspot.com/static/tests/media/k.png",width:32,height:32,alt:"K"},"K"],[{src:"https://blockly-demo.appspot.com/static/tests/media/l.png",width:32,height:32,alt:"L"},"L"],[{src:"https://blockly-demo.appspot.com/static/tests/media/m.png",width:32,height:32,alt:"M"},"M"]]}]},{type:"test_dropdowns_images_and_text",message0:"%1",args0:[{type:"field_dropdown",name:"FIELDNAME",options:[["images and text","IMAGES AND TEXT"],[{src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},"A"],[{src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},"B"],[{src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},"C"],[{src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},"D"],[{src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},"E"],[{src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},"F"],[{src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},"G"],[{src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},"H"],["xyz","LMNOP"],[{src:"https://blockly-demo.appspot.com/static/tests/media/i.png",width:32,height:32,alt:"I"},"I"],[{src:"https://blockly-demo.appspot.com/static/tests/media/j.png",width:32,height:32,alt:"J"},"J"],[{src:"https://blockly-demo.appspot.com/static/tests/media/k.png",width:32,height:32,alt:"K"},"K"],[{src:"https://blockly-demo.appspot.com/static/tests/media/l.png",width:32,height:32,alt:"L"},"L"],[{src:"https://blockly-demo.appspot.com/static/tests/media/m.png",width:32,height:32,alt:"M"},"M"]]}]},{type:"test_dropdowns_in_mutator",message0:"dropdown mutator",mutator:"test_dropdown_mutator"},{type:"test_dropdowns_in_mutator_block",message0:"dropdown %1",args0:[{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]}]}]);const c=[],d=function(){t.prompt("Add an option?","option "+c.length,(function(t){t&&(console.log("Adding option: "+t),c.push([t,"OPTION"+c.length]))}))},p=function(){const e=c[0]?c[0][0]:"";t.prompt("Remove an option?",e,(function(t){for(let e,n=0;e=c[n];n++)e[0]==t&&(console.log("Removing option: "+t),c.splice(n,1))}))};t.Blocks.test_dropdowns_dynamic_random={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic random").appendField(e,"OPTIONS")},dynamicOptions:function(){const t=Math.floor(10*Math.random())+1,e=[];for(let n=0;n<t;n++)e.push([String(n),String(n)]);return e}},t.Blocks.test_dropdowns_dynamic_connect_dependant={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic connect-dependant").appendField(e,"OPTIONS"),this.setNextStatement(!0),this.setPreviousStatement(!0)},dynamicOptions:function(){if(this.sourceBlock_&&this.sourceBlock_.getSurroundParent()){const t=this.sourceBlock_.getSurroundParent(),e=[["connected","CONNECTED_KEY"],[`surroundParent: ${t.type}`,`${t.id}_type_key`],[`surroundParent: ${t.id}`,`${t.id}_key`]],n=this.sourceBlock_.getTopStackBlock();return n.id!==t.id&&(e.push([`topStack: ${n.type}`,`${n.id}_type_key`]),e.push([`topStack: ${n.id}`,`${n.id}_key`])),e}return[["unconnected","UNCONNECTED_KEY"]]}};const r={mutationToDom:function(){return t.utils.xml.createElement("mutation")},domToMutation:function(t){},saveExtraState:function(){return{}},loadExtraState:function(t){},decompose:function(t){const e=t.newBlock("test_dropdowns_in_mutator_block");return e.initSvg(),e},compose:function(t){}};t.Extensions.registerMutator("test_dropdown_mutator",r,null,["test_dropdowns_in_mutator_block"]),t.Blocks.test_dropdowns_dynamic={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic").appendField(e,"OPTIONS")},dynamicOptions:function(){return c.length?c:[["","OPTION0"]]}},t.defineBlocksWithJsonArray([{type:"test_images_datauri",message0:"Image data: URI %1",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAABHZJREFUaAXtmEuPDFEUx8cwJIx4jQjxSGYt4pWQiGSIz4A1O2FtLyx8B4+MxIKEtQkRsZBIEF/AAgki3gzjNfx/Xfc/rkpVd1dXdU13OMm/z73ndc+5r6rqgYHu01wNAfqa5kTZx+1I3PtNJ35Aqe4P6VrW+9mnEl6o/g/hu0Ab6koxg0nsjn+dVF6c+Yr8SZgUaGeRfR0ry6alzEFaGuYY/AryafFODjQ++EKOlfRq+nXSxzTeY2FHGHcocM/uIvXZWoA2ZJ1td0pGjKMoRY6d9Nr8ndemXdrMyayVYr1wQ9gn3BVIhNklNluKg06fNslTFDacG4q4LgwLxIIcO+nV+HtOY5HoF2FbgXG3y3ZKwPdsAb/KTeOZIxESOhRG2SB+SrgvfBDeC/cEZKwgdFjA5wydQHFMy2rh8WWxOYx4UJybiiTBR+Fzqu/nin2kHohj0a+dmEWfNYpwAefV3iSMCiMC5+GSYD0PSgjfWVkJDmoaJLRO8EocUXulMC68EW4KpuNqUAy2+EDpePRnjdj/JMhKUASH37N/S+0FgrePV+akZLWTl3+jRt4j7BbGhCUC9EAgcbbThdC+KL5aMA2Fxi5xbLkMoKXCmEBMYjMG5DGTXgW/XuqtiuVZNr8S4nM7cbBHBbYTehcxqDZJOTGv2DvJoKuC45lvaWiSbRea+cyHNN8i0UwHgyfilwUS+SYsFkiCmSYWD7tXwkOB5J8H7uRcCL48EPEDTMYqgYngneyl8FSAPHbSq+DXSWSFYmuwIhzg4WDgSYr93GY7kjQ++OaR7fP0M3IPNiNo0mBWCcxMm+izCtbBHRM5emR5FOvxi21ZibifF6Mh96BNjSIlgX9GfRJJkwen4CLbgrj2Tcds2Y9nt6VxQYOOkyo4TsO86IrkjRGvjNvmsQ8yCox1cTu2LdQuW4gT4wYyuZ21rbxKtsHHbcdynEK8TCEM7GS5jp3k8pAB16plQdRYCRLHxjp8JwVilSpG/h0TA08IXwUSAyTFNdwM2Nge32sCsTqmTp09c8zsM4H3KB6EJMcqW5+Oj946X88jklHMGoE3AuvVbJ/KbC1G4crkW4Ptsld4KzimZ1yiGSJJF0chy4Q7Av7xta5uMfKgxbz+WPMOxv9VrMhtwcmTJDqADKIAkgVeNWS8CbAi2M4akciEMCXwusFrB0WQPJy+z0qWDh98S58RxeiYvEXgnJUVIdIJcQqBQ8ib6fCNY+FTmMpsLZIlATiH1MQHFWT+Oun+JcvSOVZk3n5zsH3TTEuKgEjCf4k6pjnyZjqvhmMRrzCVWZF4MJLwwzGW086TW1eqAA/mWXO/b/n/Qnpt6f6vyL++Ir6hzCubj7q3lscz79tC/DVoXlkhVT0QWyXkV/TxYGhueSv/lvq6CuFM8CryQjgdsqJf2VmpfK+GJLOYi+FbvtIiGKwbK+JZNo+LQlb5+WCAbqyIY5rHhXSt3Y3BPOPmXUs+Dlzld7K30iMNwD8q3Ex85lquZv8QhzimdD/W9Xyb5H0z1Zbsb+OT/8HoqhrfAAAAAElFTkSuQmCC",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_small",message0:"Image too small %1",args0:[{type:"field_image",src:"media/30px.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_large",message0:"Image too large %1",args0:[{type:"field_image",src:"media/200px.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_fliprtl",message0:"Image flipped RTL %1",args0:[{type:"field_image",src:"media/arrow.png",width:50,height:50,alt:"*",flipRtl:!0}],colour:160},{type:"test_images_missing",message0:"Image missing %1",args0:[{type:"field_image",src:"missing.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_many_icons",message0:"Lots of network icons: %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16 %17 %18",args0:[{type:"input_dummy"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},{type:"input_dummy"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"}],style:"text_blocks"}]),t.Blocks.test_images_clickhandler={init:function(){this.appendDummyInput().appendField("Image click handler").appendField(new t.FieldImage("https://blockly-demo.appspot.com/static/tests/media/a.png",32,32,"image with click handler",this.onClick_),"IMAGE"),this.setStyle("text_blocks")},onClick_:function(){alert("Image clicked")}};t.Blocks.test_validators_dispose_block={init:function(){this.appendDummyInput().appendField("dispose block").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("Any changes to the text cause the block to be disposed")},validate:function(t){"default"!=t&&this.getSourceBlock().dispose(!0)}},t.Blocks.test_validators_text_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The display text will remain the input text, but the value should be the default text. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_text_A={init:function(){this.appendDummyInput().appendField("remove 'a'").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All 'a' characters are removed from field value. The display text will include invalid 'a' characters while the field is being edited, but the value will not.")},validate:function(t){return t.replace(/a/g,"")}},t.Blocks.test_validators_text_B={init:function(){this.appendDummyInput().appendField("'b' -> null").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("Upon detecting a 'b' character the input will validated to null (invalid). Upon removal it should revert to being valid. The display text will remain the input text, but if the input text is invalid the value should be the default text.")},validate:function(t){return-1!==t.indexOf("b")?null:t}},t.Blocks.test_validators_angle_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The field will display the input while the field is being edited (this includes the text and the graphic), but the value should be the default value. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_angle_mult30_force={init:function(){this.appendDummyInput().appendField("force mult of 30").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input value will be rounded to the nearest multiple of 30. The field will display the input while the field is being edited (this includes the text and the graphic), but the value will be the validated (rounded) value. Note: If you want to do rounding this is not the proper way, use the ROUND property of the field angle instead.")},validate:function(t){return 30*Math.round(t/30)}},t.Blocks.test_validators_angle_mult30_null={init:function(){this.appendDummyInput().appendField("not mult of 30 -> null").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input value is not a multiple of 30, the input will validated to null (invalid). The field will display the input while the field is being edited (this includes the text and the graphic), but if the input value is invalid the value should be the default value.")},validate:function(t){return t%30!=0?null:t}},t.Blocks.test_validators_checkbox_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The new input always validates to null (invalid). This means that the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_checkbox_match={init:function(){this.appendDummyInput().appendField("force match").appendField(new t.FieldCheckbox(!0),"MATCH").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The validator for this block only works on the end-most checkbox. The validator will always return the value of the start-most checkbox. Therefore they should always match.")},validate:function(t){return this.sourceBlock_.getFieldValue("MATCH")}},t.Blocks.test_validators_checkbox_not_match_null={init:function(){this.appendDummyInput().appendField("not match -> null").appendField(new t.FieldCheckbox(!0),"MATCH").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The validator for this block only works on the end-most checkbox. If the new value does not match the value of the start-most checkbox, it will return null (invalid), which means the field value should not change. Therefore they should always match.")},validate:function(t){return this.sourceBlock_.getFieldValue("MATCH")!=t?null:t}},t.Blocks.test_validators_colour_null={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("always null").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). This means the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_colour_force_red={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("force full red").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("The input will have its red value replaced with full red.")},validate:function(t){return"#ff"+t.substr(3,4)}},t.Blocks.test_validators_colour_red_null={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("not red -> null").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("If the input does not have full red, the input will validate to null (invalid). Otherwise it will return the input value")},validate:function(t){return"ff"!=t.substr(1,2)?null:t}},t.Blocks.test_validators_dropdown_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). This means the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_dropdown_force_1s={init:function(){this.appendDummyInput().appendField("force 1s").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input's value will always change to start with 1.")},validate:function(t){return"1"+t.charAt(1)}},t.Blocks.test_validators_dropdown_1s_null={init:function(){this.appendDummyInput().appendField("not 1s -> null").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input does not start with 1, the input will validate to null (invalid). Otherwise it will return the input value.")},validate:function(t){return"1"!=t.charAt(0)?null:t}},t.Blocks.test_validators_number_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The field will display the input while the field is being edited, but the value should be the default value. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_number_mult10_force={init:function(){this.appendDummyInput().appendField("force mult of 10").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input value will be rounded to the nearest multiple of 10. The field will display the input while the field is being edited, but the value should be the validated (rounded) value. Note: If you want to do rounding this is not the proper way, use the precision option of the number field constructor instead.")},validate:function(t){return 10*Math.round(t/10)}},t.Blocks.test_validators_number_mult10_null={init:function(){this.appendDummyInput().appendField("not mult of 10 -> null").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input value is not a multiple of 10, the input will validate to null (invalid). The field will display the input while the field is being edited, but if the input value is invalid the value should be the default value.")},validate:function(t){return t%10!=0?null:t}},t.Blocks.test_validators_variable_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All ids validate to null (invalid). This means the variable should not change.")},validate:function(t){return null}},t.Blocks.test_validators_variable_force_1s={init:function(){this.appendDummyInput().appendField("force 1s").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("The id will always change to start with 1.")},validate:function(t){return"1"+t.charAt(1)}},t.Blocks.test_validators_variable_1s_null={init:function(){this.appendDummyInput().appendField("not 1s -> null").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the id does not start with 1, the id will validate to null (invalid). Otherwise it will return the id.")},validate:function(t){return"1"!=t.charAt(0)?null:t}};const u={kind:"CATEGORY",name:"Fields",expanded:"true",contents:[{kind:"CATEGORY",name:"Defaults",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"set random style",callbackkey:"setRandomStyle"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle enabled",callbackkey:"toggleEnabled"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle shadow",callbackkey:"toggleShadow"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle collapsed",callbackkey:"toggleCollapsed"},{kind:"BLOCK",type:"test_fields_angle"},{kind:"BLOCK",type:"test_fields_checkbox"},{kind:"BLOCK",type:"test_fields_colour"},{kind:"BLOCK",type:"test_fields_colour_options"},{kind:"BLOCK",type:"test_fields_text_input"},{kind:"BLOCK",type:"test_fields_only_text_input"},{kind:"BLOCK",type:"test_fields_multilinetext"},{kind:"BLOCK",type:"test_fields_variable"},{kind:"BUTTON",text:"randomize label text",callbackkey:"randomizeLabelText"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_fields_label_serializable"},{kind:"BUTTON",text:"change image",callbackkey:"changeImage"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_fields_image"}]},{kind:"CATEGORY",name:"Numbers",contents:[{kind:"BLOCK",blockxml:'\n<block type="test_numbers_float">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_hundredths">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_halves">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_whole">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_three_halves">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_whole_bounded">\n <field name="NOTE">60</field>\n</block>'}]},{kind:"CATEGORY",name:"Angles",contents:[{kind:"BLOCK",type:"test_angles_clockwise"},{kind:"BLOCK",type:"test_angles_offset"},{kind:"BLOCK",type:"test_angles_wrap"},{kind:"BLOCK",type:"test_angles_round_30"},{kind:"BLOCK",type:"test_angles_round_0"},{kind:"BLOCK",type:"test_angles_protractor"},{kind:"BLOCK",type:"test_angles_compass"}]},{kind:"CATEGORY",name:"Drop-downs",contents:[{kind:"LABEL",text:"Dynamic"},{kind:"BLOCK",type:"test_dropdowns_dynamic"},{kind:"BUTTON",text:"Add option",callbackkey:"addDynamicOption"},{kind:"BUTTON",text:"Remove option",callbackkey:"removeDynamicOption"},{kind:"BLOCK",type:"test_dropdowns_dynamic_random"},{kind:"BLOCK",type:"test_dropdowns_dynamic_connect_dependant"},{kind:"LABEL",text:"Other"},{kind:"BLOCK",type:"test_dropdowns_long"},{kind:"BLOCK",type:"test_dropdowns_images"},{kind:"BLOCK",type:"test_dropdowns_images_and_text"}]},{kind:"CATEGORY",name:"Images",contents:[{kind:"BLOCK",type:"test_images_datauri"},{kind:"BLOCK",type:"test_images_small"},{kind:"BLOCK",type:"test_images_large"},{kind:"BLOCK",type:"test_images_fliprtl"},{kind:"BLOCK",type:"test_images_missing"},{kind:"BLOCK",type:"test_images_many_icons"},{kind:"BLOCK",type:"test_images_clickhandler"}]},{kind:"CATEGORY",name:"Emoji! o((*^ᴗ^*))o",contents:[{kind:"LABEL",text:"Unicode & Emojis"},{kind:"BLOCK",type:"test_style_emoji"},{kind:"BLOCK",blockxml:'\n<block type="text">\n <field name="TEXT">Robot face in text field:🤖</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text">\n <field name="TEXT">Zalgo in text field:B̛̻̦̬̘̰͎̥̈̔͊͞ͅl̡͖̫̺̬̖̣̳̃̀́͑͑̕͟͠͝o̢̹͙̮̫͔͋̉̊̑̿̽̚c̸̹̹̜͙̹̠͋̒͑̊̇͝k̡͉̫͇̖̳͖̊͒́̆̄̎̂̔̕͜͞l̰̙̞̳̩̠͖̯̀̆̈́̿̈̓͗y̨̡̟͇̮͈̬̙̲̏̅̀͘͠</field>\n</block>'}]},{kind:"CATEGORY",name:"Validators",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"set input",callbackkey:"setInput"},{kind:"LABEL",text:"Dispose block"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dispose_block"},{kind:"LABEL",text:"Angles"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_mult30_force"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_mult30_null"},{kind:"LABEL",text:"Checkboxes"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_match"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_not_match_null"},{kind:"LABEL",text:"Colours"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_force_red"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_red_null"},{kind:"LABEL",text:"Dropdowns"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_force_1s"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_1s_null"},{kind:"LABEL",text:"Numbers"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_mult10_force"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_mult10_null"},{kind:"LABEL",text:"Text"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_A"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_B"},{kind:"LABEL",text:"Variables"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"add test variables",callbackkey:"addVariables","web-class":"modifiesWorkspace"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_force_1s"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_1s_null"}]}]};t.defineBlocksWithJsonArray([{type:"test_mutator_colorChange",message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"colour_blocks"}]);const m={mutationToDom:function(){const e=t.utils.xml.createElement("mutation");return e.setAttribute("colour",this.getColour()),e},domToMutation:function(t){this.setColour(t.getAttribute("colour"))},saveExtraState:function(){return{colour:this.getColour()}},loadExtraState:function(t){this.setColour(t.colour)},decompose:function(e){const n=t.serialization.blocks.append({type:"test_mutator_colorChange"},e);return n.getField("COLOUR").setValue(this.getColour()),n},compose:function(t){this.setColour(t.getFieldValue("COLOUR"))}},_=[];for(let t=0;t<20;t++)_.push(`test_mutator_category_${t}`);const h=_.map((t=>({type:t,message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"colour_blocks"})));t.defineBlocksWithJsonArray([{type:"test_mutators_many",message0:"test many blocks mutator",mutator:"test_many_blocks_mutator",colour:"#000000"},...h]),t.Extensions.registerMutator("test_many_blocks_mutator",m,null,[..._]),t.defineBlocksWithJsonArray([{type:"test_mutators_noflyout",message0:"noflyout mutator",mutator:"test_noflyout_mutator",colour:"#000000"}]),t.Extensions.registerMutator("test_noflyout_mutator",m,null,[]),t.defineBlocksWithJsonArray([{type:"test_mutators_changeableFlyout",message0:"changeable flyout mutator",mutator:"test_changeableFlyout_mutator",colour:"#000000"}]),t.Extensions.registerMutator("test_changeableFlyout_mutator",m,null,["text"]),t.defineBlocksWithJsonArray([{type:"test_style_hat",message0:"Hat block (event)",nextStatement:null,style:"hat_blocks"},{type:"test_style_hex1",message0:"Block color: Bright purple %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#992aff"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#992aff"},{type:"test_style_hex2",message0:"Block color: White %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#fefefe"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#fefefe"},{type:"test_style_hex3",message0:"Block color: Black %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#010101"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#010101"},{type:"test_style_no_colour",message0:"Block color: unset"},{type:"test_style_hex4",message0:"Block color: #RRGGBBAA (invalid)",colour:"#992aff99"},{type:"test_style_hex5",message0:"Block color: #RRGGBB (invalid)",colour:"#NotHex"},{type:"test_style_emoji",message0:"Robot Face: 🤖",colour:"#AAAAAA"}]);class k extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}}k.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_no_overrides",k);class y extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}toXml(t){return t.setAttribute("value",this.getValue()),t}fromXml(t){this.setValue(t.getAttribute("value"))}}y.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_xml",y);class g extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}saveState(){return{value:this.getValue()}}loadState(t){this.setValue(t.value)}}g.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_jso",g);class b extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}toXml(t){return t.setAttribute("value",this.getValue()),t}fromXml(t){this.setValue(t.getAttribute("value"))}saveState(){return{value:this.getValue()}}loadState(t){this.setValue(t.value)}}b.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_both",b),e().defineBlocksWithJsonArray([{type:"test_field_serialization_no_overrides",message0:"no overrides: %1",args0:[{type:"field_no_overrides",name:"LABEL",text:"test"}],colour:0,output:null},{type:"test_field_serialization_xml",message0:"xml: %1",args0:[{type:"field_xml",name:"LABEL",text:"test"}],colour:30,output:null},{type:"test_field_serialization_jso",message0:"jso: %1",args0:[{type:"field_jso",name:"LABEL",text:"test"}],colour:90,output:null},{type:"test_field_serialization_both",message0:"both: %1",args0:[{type:"field_both",name:"LABEL",text:"test"}],colour:150,output:null}]),e().Blocks.test_extra_state_xml=Object.assign({},e().Blocks.lists_create_with),delete e().Blocks.test_extra_state_xml.saveExtraState,delete e().Blocks.test_extra_state_xml.loadExtraState,e().Blocks.test_extra_state_xml.init=function(){this.setColour(30),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))},e().Blocks.test_extra_state_jso=Object.assign({},e().Blocks.lists_create_with),delete e().Blocks.test_extra_state_jso.mutationToDom,delete e().Blocks.test_extra_state_jso.domToMutation,e().Blocks.test_extra_state_jso.init=function(){this.setColour(90),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))},e().Blocks.test_extra_state_both=Object.assign({},e().Blocks.lists_create_with),e().Blocks.test_extra_state_both.init=function(){this.setColour(150),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))};const f={contents:[{kind:"CATEGORY",name:"Align",contents:[{kind:"BLOCK",type:"test_align_dummy_right"},{kind:"BLOCK",type:"test_align_all"},{kind:"BLOCK",type:"test_align_with_external_input"}]},{kind:"CATEGORY",name:"Basic",contents:[{kind:"BLOCK",type:"test_basic_empty"},{kind:"BLOCK",type:"test_basic_empty_with_mutator"},{kind:"BLOCK",type:"test_basic_dummy"},{kind:"BLOCK",type:"test_basic_multiple_dummy"},{kind:"BLOCK",type:"test_basic_stack"},{kind:"BLOCK",type:"test_basic_row"},{kind:"BLOCK",type:"test_basic_value_to_stack"},{kind:"BLOCK",type:"test_basic_value_to_statement"},{kind:"BLOCK",type:"test_basic_limit_instances"},{kind:"BLOCK",type:"test_basic_tooltips"},{kind:"BLOCK",type:"test_basic_javascript"}]},{kind:"CATEGORY",name:"Chameleon",contents:[{kind:"BLOCK",type:"test_chameleon"}]},a,{kind:"CATEGORY",name:"Drag",contents:[{kind:"LABEL",text:"Drag each to the workspace"},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <block type="text">\n <field name="TEXT">Drag me by this child</field>\n </block>\n </value>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Drag me by this shadow</field>\n </shadow>\n </value>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Shadow value</field>\n </shadow>\n </value>\n <next>\n <shadow type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Shadow statement</field>\n </shadow>\n </value>\n </shadow>\n </next>\n</block>'},{kind:"LABEL",text:"Multiple Variable Refs"},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <block type="variables_get">\n <field name="VAR" id="item">item</field>\n </block>\n </value>\n <next>\n <block type="text_print">\n <value name="TEXT">\n <block type="variables_get">\n <field name="VAR" id="item">item</field>\n </block>\n </value>\n </block>\n </next>\n</block>'},{kind:"LABEL",text:"Procedure Definitions"},{kind:"BLOCK",blockxml:'\n<block type="procedures_defnoreturn">\n <field name="NAME">without arguments</field>\n <statement name="STACK">\n <block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">No argument reference.</field>\n </shadow>\n </value>\n </block>\n </statement>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="procedures_defnoreturn">\n <mutation><arg name="fnArgument"></arg></mutation>\n <field name="NAME">with one argument</field>\n <statement name="STACK">\n <block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Expected an argument reference here.</field>\n </shadow>\n <block type="variables_get">\n <field name="VAR">fnArgument</field>\n </block>\n </value>\n </block>\n </statement>\n</block>'}]},u,{kind:"CATEGORY",name:"Mutators",contents:[{kind:"LABEL",text:"logic_compare"},{kind:"BLOCK",type:"logic_compare",inputs:{A:{shadow:{type:"math_number",fields:{NUM:10}}},B:{shadow:{type:"math_number",fields:{NUM:10}}}}},{kind:"BLOCK",type:"logic_compare",inputs:{A:{block:{type:"math_number",fields:{NUM:10}}},B:{block:{type:"math_number",fields:{NUM:10}}}}},{kind:"BLOCK",type:"test_mutators_noflyout"},{kind:"BLOCK",type:"test_mutators_many"},{kind:"BLOCK",type:"test_mutators_changeableFlyout"}]},{kind:"CATEGORY",name:"Style",contents:[{kind:"LABEL",text:"Hats"},{kind:"BLOCK",type:"test_style_hat"},{kind:"LABEL",text:"Colour"},{kind:"BLOCK",type:"test_style_hex1"},{kind:"BLOCK",type:"test_style_hex2"},{kind:"BLOCK",type:"test_style_hex3"},{kind:"BLOCK",type:"test_style_no_colour"},{kind:"BLOCK",type:"test_style_hex4"},{kind:"BLOCK",type:"test_style_hex5",gap:"40"},{kind:"BLOCK",type:"test_style_hex5",disabled:"true"}]},{kind:"CATEGORY",name:"Serialization",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"randomize text",callbackkey:"randomizeText"},{kind:"BLOCK",type:"test_field_serialization_no_overrides"},{kind:"BLOCK",type:"test_field_serialization_xml"},{kind:"BLOCK",type:"test_field_serialization_jso"},{kind:"BLOCK",type:"test_field_serialization_both"},{kind:"SEP",gap:30},{kind:"BLOCK",blockxml:'<block type="test_extra_state_xml"><mutation items="2"></mutation></block>'},{kind:"BLOCK",type:"test_extra_state_jso",extraState:{itemCount:2}},{kind:"BLOCK",type:"test_extra_state_both",extraState:{itemCount:2}},{kind:"SEP",gap:30},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_no_overrides"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_xml"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_jso"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_both"}}}},{kind:"SEP",gap:30},{kind:"BLOCK",blockxml:'<block type="text_print"><value name="TEXT"><shadow type="test_extra_state_xml"><mutation items="2"></mutation></shadow></value></block>'},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_extra_state_jso",extraState:{itemCount:2}}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_extra_state_both",extraState:{itemCount:2}}}}}]}]};function x(e){(function(t){!function(t){t.registerButtonCallback("insertConnectionRows",n)}(t),function(t){t.registerButtonCallback("insertConnectionStacks",s)}(t),function(t){t.registerButtonCallback("insertConnectionStatements",i)}(t)})(e),function(e){!function(t){t.registerButtonCallback("randomizeLabelText",(function(t){const e=t.getTargetWorkspace().getBlocksByType("test_fields_label_serializable");for(let t,n=0;t=e[n];n++){let e="";for(let t=0;t<4;t++)e+="AB".charAt(Math.floor(Math.random()*"AB".length));t.setFieldValue(e,"LABEL")}})),t.registerButtonCallback("setRandomStyle",(function(e){const n=e.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1),o=Object.keys(t.getRenderer().getConstants().blockStyles);o.splice(o.indexOf(n[0].getStyleName()),1);const l=o[Math.floor(Math.random()*o.length)];for(let t,e=0;t=n[e];e++)t.setStyle(l)})),t.registerButtonCallback("toggleEnabled",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setEnabled(!t.isEnabled())})),t.registerButtonCallback("toggleShadow",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setShadow(!t.isShadow())})),t.registerButtonCallback("toggleCollapsed",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setCollapsed(!t.isCollapsed())})),t.registerButtonCallback("changeImage",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getBlocksByType("test_fields_image"),n="abcdefghijklm",o="https://blockly-demo.appspot.com/static/tests/media/"+n.charAt(Math.floor(Math.random()*n.length))+".png";for(let t,n=0;t=e[n];n++)t.getField("IMAGE").setValue(o)}))}(e),function(t){t.registerButtonCallback("addDynamicOption",d),t.registerButtonCallback("removeDynamicOption",p)}(e),function(e){e.registerButtonCallback("addVariables",(function(t){e.createVariable("1b","","1B"),e.createVariable("1c","","1C"),e.createVariable("2a","","2A"),e.createVariable("2b","","2B"),e.createVariable("2c","","2C")})),e.registerButtonCallback("setInput",(function(e){t.prompt("Input text to set.","ab",(function(t){const n=e.getTargetWorkspace().getAllBlocks(!1);for(let e,o=0;e=n[o];o++)e.getField("INPUT")&&e.setFieldValue(t,"INPUT")}))}))}(e)}(e),function(t){t.registerButtonCallback("randomizeText",(function(t){const e=t.getTargetWorkspace(),n=[...e.getBlocksByType("test_field_serialization_no_overrides"),...e.getBlocksByType("test_field_serialization_xml"),...e.getBlocksByType("test_field_serialization_jso"),...e.getBlocksByType("test_field_serialization_both")],o="ABCDEF";for(let t,e=0;t=n[e];e++){let e="";for(let t=0;t<4;t++)e+=o.charAt(Math.floor(Math.random()*o.length));t.setFieldValue(e,"LABEL")}}))}(e),e.registerButtonCallback("addAllBlocksToWorkspace",(function(e){const n=e.getTargetWorkspace(),o=n.getFlyout().getWorkspace().getTopBlocks();for(let e,l=0;e=o[l];l++){const o=t.serialization.blocks.save(e,{addCoordinates:!0});t.serialization.blocks.append(o,n)}}))}})(),l})()));
//# sourceMappingURL=index.js.map
/*! For license information please see index.js.LICENSE.txt */
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("blockly/core"));else if("function"==typeof define&&define.amd)define(["blockly/core"],e);else{var n="object"==typeof exports?e(require("blockly/core")):e(t.Blockly);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(t=>(()=>{"use strict";var e={573:e=>{e.exports=t}},n={};function o(t){var l=n[t];if(void 0!==l)return l.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,o),s.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var l={};return(()=>{o.r(l),o.d(l,{toolboxTestBlocks:()=>f,toolboxTestBlocksInit:()=>x});var t=o(573),e=o.n(t);t.defineBlocksWithJsonArray([{type:"test_align_dummy_right",message0:"text right %1 long text right %2",args0:[{type:"input_dummy",align:"RIGHT"},{type:"input_dummy",align:"RIGHT"}],style:"math_blocks"},{type:"test_align_all",message0:"text %1 long text left %2 text centre %3 much longer text right %4",args0:[{type:"input_dummy"},{type:"input_dummy",align:"LEFT"},{type:"input_dummy",align:"CENTRE"},{type:"input_dummy",align:"RIGHT"}],style:"math_blocks"},{type:"test_align_with_external_input",message0:"text right %1 long text centre %2 text left %3 much longer text %4",args0:[{type:"input_dummy",align:"RIGHT"},{type:"input_dummy",align:"CENTRE"},{type:"input_dummy",align:"LEFT"},{type:"input_value",name:"VALUE"}],inputsInline:!1,style:"math_blocks"}]),t.defineBlocksWithJsonArray([{type:"test_basic_empty",message0:"",args0:[]},{type:"test_basic_stack",message0:"stack block",previousStatement:null,nextStatement:null,colour:"120"},{type:"test_basic_dummy",message0:"dummy input %1",args0:[{type:"input_dummy"}],style:"math_blocks"},{type:"test_basic_multiple_dummy",message0:"first dummy %1 second dummy %2",args0:[{type:"input_dummy"},{type:"input_dummy"}],style:"math_blocks"},{type:"test_basic_row",message0:"row block %1",args0:[{type:"input_value",name:"INPUT"}],output:null,style:"math_blocks"},{type:"test_basic_value_to_stack",message0:"value to stack",nextStatement:null,output:null,style:"math_blocks"},{type:"test_basic_value_to_statement",message0:"value to statement %1",args0:[{type:"input_statement",name:"STATEMENT"}],output:null,style:"math_blocks"},{type:"test_basic_limit_instances",message0:"limit 3 instances %1 %2",args0:[{type:"input_dummy"},{type:"input_statement",name:"STATEMENT"}],previousStatement:null,nextStatement:null,style:"math_blocks"},{type:"test_basic_tooltips",message0:"%1 %2 %3",args0:[{type:"field_label",name:"NAME",text:"field tooltip",tooltip:"This is a JSON tooltip for the *field*."},{type:"input_dummy"},{type:"field_label",name:"NAME",text:"block tooltip"}],tooltip:"This is a JSON tooltip for the *block*.",style:"math_blocks"},{type:"test_basic_javascript",message0:"function %1(%2) { %3 %4 return %5 }",args0:["foo","args",{type:"input_dummy"},{type:"input_statement",name:"STACK"},{type:"input_value",check:"number",align:"right",name:"RETURN"}],inputsInline:!0,colour:200,tooltip:"Hello world."}]),t.Blocks.test_basic_empty_with_mutator={init:function(){this.setMutator(new t.icons.MutatorIcon(["math_number"],this))},decompose:function(t){const e=t.newBlock("math_number");return e.initSvg(),e},compose:function(){}},t.defineBlocksWithJsonArray([{type:"test_connections_row_input",message0:"%1",args0:[{type:"input_value",name:"NAME"}],colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any output connection."},{type:"test_connections_row_blue",message0:"%1",args0:[{type:"input_value",name:"NAME",check:"greenRel"}],output:"noneOut",colour:230,tooltip:"Output: noneOut\nInput: greenRel\nInput connection can accept yellow blocks but not red blocks."},{type:"test_connections_row_yellow",message0:"%1",args0:[{type:"input_value",name:"NAME",check:["orangeRel","yellowRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nInput can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_row_red",message0:"%1",args0:[{type:"input_value",name:"NAME",check:"noneIn"}],output:"orangeRel",colour:0,tooltip:"Output: orangeRel\nInput: noneIn\nOutput can connect to yellow blocks, but not blue blocks."},{type:"test_connections_row_output",message0:"",output:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any input connection."},{type:"test_connections_multivalue_1valid",message0:"none %1 both %2",args0:[{type:"input_value",name:"NAME1",align:"RIGHT",check:"noneIn"},{type:"input_value",name:"NAME2",align:"RIGHT",check:["yellowRel","orangeRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput Top: noneIn\nInput Bottom: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nTop Input can connect to nothing, except grey blocks.\nBottom Input can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_multivalue_2valid",message0:"both %1 both %2",args0:[{type:"input_value",name:"NAME1",align:"RIGHT",check:["yellowRel","orangeRel"]},{type:"input_value",name:"NAME2",align:"RIGHT",check:["yellowRel","orangeRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput Top: yellowRel, orangeRel\nInput Bottom: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nTop Input can connect to yellow blocks and red blocks, but not blue blocks.\nBottom Input can connect to yellow blocks and red blocks, but not blue blocks."}]);const n=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_row_input">\n <value name="NAME">\n <block type="test_connections_row_blue">\n <value name="NAME">\n <block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_red">\n <value name="NAME">\n <block type="test_connections_row_output"/>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n</xml>'),n)};t.defineBlocksWithJsonArray([{type:"test_connections_stack_next",message0:"",nextStatement:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any previous connection."},{type:"test_connections_stack_blue",message0:"",previousStatement:"nonePrev",nextStatement:"greenRel",colour:230,tooltip:"Prev: nonePrev\nNext: greenRel\nNext connection can accept yellow blocks but not red blocks."},{type:"test_connections_stack_yellow",message0:"",previousStatement:["greenRel","yellowRel"],nextStatement:["yellowRel","orangeRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nNext can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_stack_red",message0:"",previousStatement:"orangeRel",nextStatement:"noneNext",colour:0,tooltip:"Prev: orangeRel\nNext: noneNext\nPrev can connect to yellow blocks, but not blue blocks."},{type:"test_connections_stack_prev",message0:"",previousStatement:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any input connection."}]);const s=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_stack_next">\n <next>\n <block type="test_connections_stack_blue">\n <next>\n <block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_red">\n <next>\n <block type="test_connections_stack_prev"/>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n</xml>'),n)};t.defineBlocksWithJsonArray([{type:"test_connections_statement_blue",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:"greenRel"}],previousStatement:"nonePrev",nextStatement:"greenRel",colour:230,tooltip:"Prev: nonePrev\nNext: greenRel\nStatement: greenRel\nNext connection can accept yellow blocks but not red blocks.\nStatement connection can accept yellow blocks but not red blocks."},{type:"test_connections_statement_yellow",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],nextStatement:["yellowRel","orangeRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nNext can connect to yellow blocks and red blocks, but not blue blocks.\nStatement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_statement_red",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:"noneNext"}],previousStatement:"orangeRel",nextStatement:"noneNext",colour:0,tooltip:"Prev: orangeRel\nNext: noneNext\nStatement: noneNext\nPrev connection can accept yellow blocks but not blue blocks.\nStatement connection accepts none."},{type:"test_connections_statement_nonext",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nStatement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_multistatement_1valid",message0:"none %1 both %2",args0:[{type:"input_statement",name:"NAME",check:"noneNext"},{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nTop Statement cannot connect to anything, except grey blocks.\nBottom Statement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_multistatement_2valid",message0:"both %1 both %2",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]},{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nTop Statement connection can accept yellow blocks and red blocks but not blue blocks.\nBottom Statement connection can accept yellow blocks and red blocks but not blue blocks.\n"}]);const i=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_statement_blue">\n <statement name="NAME">\n <block type="test_connections_statement_yellow">\n <statement name="NAME">\n <block type="test_connections_statement_yellow">\n <statement name="NAME">\n <block type="test_connections_statement_red"/>\n </statement>\n </block>\n </statement>\n </block>\n </statement>\n </block>\n</xml>'),n)},a={kind:"CATEGORY",name:"Connections",expanded:"true",contents:[{kind:"CATEGORY",name:"Row",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionRows"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_input"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_red"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_output"},{kind:"BLOCK",blockxml:'\n<block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_yellow" movable="false">\n </block>\n </value>\n</block>'},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multivalue_1valid"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multivalue_2valid"}]},{kind:"CATEGORY",name:"Stack",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionStacks"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_next"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_red"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_prev"},{kind:"BLOCK",blockxml:'\n<block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_yellow" movable="false"></block>\n </next>\n</block>'}]},{kind:"CATEGORY",name:"Statement",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionStatements"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_red"},{kind:"BLOCK",type:"test_connections_statement_nonext"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multistatement_1valid"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multistatement_2valid"}]}]};t.defineBlocksWithJsonArray([{type:"test_fields_angle",message0:"angle: %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:"90",alt:{type:"field_label",text:"NO ANGLE FIELD"}}],style:"math_blocks"},{type:"test_fields_text_input",message0:"text input %1",args0:[{type:"field_input",name:"TEXT_INPUT",text:"default"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_only_text_input",message0:"%1",args0:[{type:"field_input",name:"TEXT_INPUT",text:"default"}],style:"textInput",tooltip:"",helpUrl:"",output:"String"},{type:"test_fields_multilinetext",message0:"code %1",args0:[{type:"field_multilinetext",name:"CODE",text:"default1\ndefault2"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_fields_checkbox",message0:"checkbox %1",args0:[{type:"field_checkbox",name:"CHECKBOX",checked:!0}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_colour",message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_colour_options",message0:"colour options %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff4040",colourOptions:["#ff4040","#ff8080","#ffc0c0","#4040ff","#8080ff","#c0c0ff"],colourTitles:["dark pink","pink","light pink","dark blue","blue","light blue"],columns:3}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_fields_variable",message0:"variable %1",args0:[{type:"field_variable",name:"VARIABLE",variable:"item"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_label_serializable",message0:"label serializable %1",args0:[{type:"field_label_serializable",name:"LABEL",text:"default"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_image",message0:"image %1",args0:[{type:"field_image",name:"IMAGE",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"}],colour:230}]),t.defineBlocksWithJsonArray([{type:"test_numbers_float",message0:"float %1",args0:[{type:"field_number",name:"NUM",text:"0"}],style:"math_blocks",output:"Number",tooltip:"A number."},{type:"test_numbers_whole",message0:"precision 1 %1",args0:[{type:"field_number",name:"NUM",precision:1,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 1"},{type:"test_numbers_hundredths",message0:"precision 0.01 %1",args0:[{type:"field_number",name:"NUM",precision:.01,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 0.01"},{type:"test_numbers_halves",message0:"precision 0.5 %1",args0:[{type:"field_number",name:"NUM",precision:.5,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 0.5"},{type:"test_numbers_three_halves",message0:"precision 1.5 %1",args0:[{type:"field_number",name:"NUM",precision:1.5,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 1.5"},{type:"test_numbers_whole_bounded",message0:"midi note %1",args0:[{type:"field_number",name:"NOTE",precision:1,min:1,max:127,text:"0"}],style:"math_blocks",output:"Note",tooltip:"A midi note."}]);t.defineBlocksWithJsonArray([{type:"test_angles_protractor",message0:"protractor %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,mode:"protractor"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_compass",message0:"compass %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,mode:"compass"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_clockwise",message0:"clockwise %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,clockwise:!0}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_offset",message0:"offset 90 %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,offset:90}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_wrap",message0:"wrap %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,wrap:180}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_round_30",message0:"round 30 %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,round:30}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_round_0",message0:"no round %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,round:0}],style:"math_blocks",tooltip:"test tooltip"}]),t.defineBlocksWithJsonArray([{type:"test_dropdowns_long",message0:"long: %1",args0:[{type:"field_dropdown",name:"FIELDNAME",options:[["first item","ITEM1"],["second item","ITEM2"],["third item","ITEM3"],["fourth item","ITEM4"],["fifth item","ITEM5"],["sixth item","ITEM6"],["seventh item","ITEM7"],["eighth item","ITEM8"],["ninth item","ITEM9"],["tenth item","ITEM10"],["eleventh item","ITEM11"],["twelfth item","ITEM12"],["thirteenth item","ITEM13"],["fourteenth item","ITEM14"],["fifteenth item","ITEM15"],["sixteenth item","ITEM16"],["seventeenth item","ITEM17"],["eighteenth item","ITEM18"],["nineteenth item","ITEM19"],["twentieth item","ITEM20"],["twenty-first item","ITEM21"],["twenty-second item","ITEM22"],["twenty-third item","ITEM23"],["twenty-fourth item","ITEM24"],["twenty-fifth item","ITEM25"],["twenty-sixth item","ITEM26"],["twenty-seventh item","ITEM27"],["twenty-eighth item","ITEM28"],["twenty-ninth item","ITEM29"],["thirtieth item","ITEM30"],["thirty-first item","ITEM31"],["thirty-second item","ITEM32"]]}]},{type:"test_dropdowns_images",message0:"%1",args0:[{NOTE:"The following paths are relative to playground.html",type:"field_dropdown",name:"FIELDNAME",options:[[{src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},"A"],[{src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},"B"],[{src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},"C"],[{src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},"D"],[{src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},"E"],[{src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},"F"],[{src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},"G"],[{src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},"H"],[{src:"https://blockly-demo.appspot.com/static/tests/media/i.png",width:32,height:32,alt:"I"},"I"],[{src:"https://blockly-demo.appspot.com/static/tests/media/j.png",width:32,height:32,alt:"J"},"J"],[{src:"https://blockly-demo.appspot.com/static/tests/media/k.png",width:32,height:32,alt:"K"},"K"],[{src:"https://blockly-demo.appspot.com/static/tests/media/l.png",width:32,height:32,alt:"L"},"L"],[{src:"https://blockly-demo.appspot.com/static/tests/media/m.png",width:32,height:32,alt:"M"},"M"]]}]},{type:"test_dropdowns_images_and_text",message0:"%1",args0:[{type:"field_dropdown",name:"FIELDNAME",options:[["images and text","IMAGES AND TEXT"],[{src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},"A"],[{src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},"B"],[{src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},"C"],[{src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},"D"],[{src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},"E"],[{src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},"F"],[{src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},"G"],[{src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},"H"],["xyz","LMNOP"],[{src:"https://blockly-demo.appspot.com/static/tests/media/i.png",width:32,height:32,alt:"I"},"I"],[{src:"https://blockly-demo.appspot.com/static/tests/media/j.png",width:32,height:32,alt:"J"},"J"],[{src:"https://blockly-demo.appspot.com/static/tests/media/k.png",width:32,height:32,alt:"K"},"K"],[{src:"https://blockly-demo.appspot.com/static/tests/media/l.png",width:32,height:32,alt:"L"},"L"],[{src:"https://blockly-demo.appspot.com/static/tests/media/m.png",width:32,height:32,alt:"M"},"M"]]}]},{type:"test_dropdowns_in_mutator",message0:"dropdown mutator",mutator:"test_dropdown_mutator"},{type:"test_dropdowns_in_mutator_block",message0:"dropdown %1",args0:[{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]}]}]);const c=[],d=function(){t.prompt("Add an option?","option "+c.length,(function(t){t&&(console.log("Adding option: "+t),c.push([t,"OPTION"+c.length]))}))},p=function(){const e=c[0]?c[0][0]:"";t.prompt("Remove an option?",e,(function(t){for(let e,n=0;e=c[n];n++)e[0]==t&&(console.log("Removing option: "+t),c.splice(n,1))}))};t.Blocks.test_dropdowns_dynamic_random={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic random").appendField(e,"OPTIONS")},dynamicOptions:function(){const t=Math.floor(10*Math.random())+1,e=[];for(let n=0;n<t;n++)e.push([String(n),String(n)]);return e}},t.Blocks.test_dropdowns_dynamic_connect_dependant={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic connect-dependant").appendField(e,"OPTIONS"),this.setNextStatement(!0),this.setPreviousStatement(!0)},dynamicOptions:function(){if(this.sourceBlock_&&this.sourceBlock_.getSurroundParent()){const t=this.sourceBlock_.getSurroundParent(),e=[["connected","CONNECTED_KEY"],[`surroundParent: ${t.type}`,`${t.id}_type_key`],[`surroundParent: ${t.id}`,`${t.id}_key`]],n=this.sourceBlock_.getTopStackBlock();return n.id!==t.id&&(e.push([`topStack: ${n.type}`,`${n.id}_type_key`]),e.push([`topStack: ${n.id}`,`${n.id}_key`])),e}return[["unconnected","UNCONNECTED_KEY"]]}};const r={mutationToDom:function(){return t.utils.xml.createElement("mutation")},domToMutation:function(t){},saveExtraState:function(){return{}},loadExtraState:function(t){},decompose:function(t){const e=t.newBlock("test_dropdowns_in_mutator_block");return e.initSvg(),e},compose:function(t){}};t.Extensions.registerMutator("test_dropdown_mutator",r,null,["test_dropdowns_in_mutator_block"]),t.Blocks.test_dropdowns_dynamic={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic").appendField(e,"OPTIONS")},dynamicOptions:function(){return c.length?c:[["","OPTION0"]]}},t.defineBlocksWithJsonArray([{type:"test_images_datauri",message0:"Image data: URI %1",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAABHZJREFUaAXtmEuPDFEUx8cwJIx4jQjxSGYt4pWQiGSIz4A1O2FtLyx8B4+MxIKEtQkRsZBIEF/AAgki3gzjNfx/Xfc/rkpVd1dXdU13OMm/z73ndc+5r6rqgYHu01wNAfqa5kTZx+1I3PtNJ35Aqe4P6VrW+9mnEl6o/g/hu0Ab6koxg0nsjn+dVF6c+Yr8SZgUaGeRfR0ry6alzEFaGuYY/AryafFODjQ++EKOlfRq+nXSxzTeY2FHGHcocM/uIvXZWoA2ZJ1td0pGjKMoRY6d9Nr8ndemXdrMyayVYr1wQ9gn3BVIhNklNluKg06fNslTFDacG4q4LgwLxIIcO+nV+HtOY5HoF2FbgXG3y3ZKwPdsAb/KTeOZIxESOhRG2SB+SrgvfBDeC/cEZKwgdFjA5wydQHFMy2rh8WWxOYx4UJybiiTBR+Fzqu/nin2kHohj0a+dmEWfNYpwAefV3iSMCiMC5+GSYD0PSgjfWVkJDmoaJLRO8EocUXulMC68EW4KpuNqUAy2+EDpePRnjdj/JMhKUASH37N/S+0FgrePV+akZLWTl3+jRt4j7BbGhCUC9EAgcbbThdC+KL5aMA2Fxi5xbLkMoKXCmEBMYjMG5DGTXgW/XuqtiuVZNr8S4nM7cbBHBbYTehcxqDZJOTGv2DvJoKuC45lvaWiSbRea+cyHNN8i0UwHgyfilwUS+SYsFkiCmSYWD7tXwkOB5J8H7uRcCL48EPEDTMYqgYngneyl8FSAPHbSq+DXSWSFYmuwIhzg4WDgSYr93GY7kjQ++OaR7fP0M3IPNiNo0mBWCcxMm+izCtbBHRM5emR5FOvxi21ZibifF6Mh96BNjSIlgX9GfRJJkwen4CLbgrj2Tcds2Y9nt6VxQYOOkyo4TsO86IrkjRGvjNvmsQ8yCox1cTu2LdQuW4gT4wYyuZ21rbxKtsHHbcdynEK8TCEM7GS5jp3k8pAB16plQdRYCRLHxjp8JwVilSpG/h0TA08IXwUSAyTFNdwM2Nge32sCsTqmTp09c8zsM4H3KB6EJMcqW5+Oj946X88jklHMGoE3AuvVbJ/KbC1G4crkW4Ptsld4KzimZ1yiGSJJF0chy4Q7Av7xta5uMfKgxbz+WPMOxv9VrMhtwcmTJDqADKIAkgVeNWS8CbAi2M4akciEMCXwusFrB0WQPJy+z0qWDh98S58RxeiYvEXgnJUVIdIJcQqBQ8ib6fCNY+FTmMpsLZIlATiH1MQHFWT+Oun+JcvSOVZk3n5zsH3TTEuKgEjCf4k6pjnyZjqvhmMRrzCVWZF4MJLwwzGW086TW1eqAA/mWXO/b/n/Qnpt6f6vyL++Ir6hzCubj7q3lscz79tC/DVoXlkhVT0QWyXkV/TxYGhueSv/lvq6CuFM8CryQjgdsqJf2VmpfK+GJLOYi+FbvtIiGKwbK+JZNo+LQlb5+WCAbqyIY5rHhXSt3Y3BPOPmXUs+Dlzld7K30iMNwD8q3Ex85lquZv8QhzimdD/W9Xyb5H0z1Zbsb+OT/8HoqhrfAAAAAElFTkSuQmCC",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_small",message0:"Image too small %1",args0:[{type:"field_image",src:"media/30px.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_large",message0:"Image too large %1",args0:[{type:"field_image",src:"media/200px.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_fliprtl",message0:"Image flipped RTL %1",args0:[{type:"field_image",src:"media/arrow.png",width:50,height:50,alt:"*",flipRtl:!0}],colour:160},{type:"test_images_missing",message0:"Image missing %1",args0:[{type:"field_image",src:"missing.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_many_icons",message0:"Lots of network icons: %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16 %17 %18",args0:[{type:"input_dummy"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},{type:"input_dummy"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"}],style:"text_blocks"}]),t.Blocks.test_images_clickhandler={init:function(){this.appendDummyInput().appendField("Image click handler").appendField(new t.FieldImage("https://blockly-demo.appspot.com/static/tests/media/a.png",32,32,"image with click handler",this.onClick_),"IMAGE"),this.setStyle("text_blocks")},onClick_:function(){alert("Image clicked")}};t.Blocks.test_validators_dispose_block={init:function(){this.appendDummyInput().appendField("dispose block").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("Any changes to the text cause the block to be disposed")},validate:function(t){"default"!=t&&this.getSourceBlock().dispose(!0)}},t.Blocks.test_validators_text_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The display text will remain the input text, but the value should be the default text. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_text_A={init:function(){this.appendDummyInput().appendField("remove 'a'").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All 'a' characters are removed from field value. The display text will include invalid 'a' characters while the field is being edited, but the value will not.")},validate:function(t){return t.replace(/a/g,"")}},t.Blocks.test_validators_text_B={init:function(){this.appendDummyInput().appendField("'b' -> null").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("Upon detecting a 'b' character the input will validated to null (invalid). Upon removal it should revert to being valid. The display text will remain the input text, but if the input text is invalid the value should be the default text.")},validate:function(t){return-1!==t.indexOf("b")?null:t}},t.Blocks.test_validators_angle_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The field will display the input while the field is being edited (this includes the text and the graphic), but the value should be the default value. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_angle_mult30_force={init:function(){this.appendDummyInput().appendField("force mult of 30").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input value will be rounded to the nearest multiple of 30. The field will display the input while the field is being edited (this includes the text and the graphic), but the value will be the validated (rounded) value. Note: If you want to do rounding this is not the proper way, use the ROUND property of the field angle instead.")},validate:function(t){return 30*Math.round(t/30)}},t.Blocks.test_validators_angle_mult30_null={init:function(){this.appendDummyInput().appendField("not mult of 30 -> null").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input value is not a multiple of 30, the input will validated to null (invalid). The field will display the input while the field is being edited (this includes the text and the graphic), but if the input value is invalid the value should be the default value.")},validate:function(t){return t%30!=0?null:t}},t.Blocks.test_validators_checkbox_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The new input always validates to null (invalid). This means that the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_checkbox_match={init:function(){this.appendDummyInput().appendField("force match").appendField(new t.FieldCheckbox(!0),"MATCH").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The validator for this block only works on the end-most checkbox. The validator will always return the value of the start-most checkbox. Therefore they should always match.")},validate:function(t){return this.sourceBlock_.getFieldValue("MATCH")}},t.Blocks.test_validators_checkbox_not_match_null={init:function(){this.appendDummyInput().appendField("not match -> null").appendField(new t.FieldCheckbox(!0),"MATCH").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The validator for this block only works on the end-most checkbox. If the new value does not match the value of the start-most checkbox, it will return null (invalid), which means the field value should not change. Therefore they should always match.")},validate:function(t){return this.sourceBlock_.getFieldValue("MATCH")!=t?null:t}},t.Blocks.test_validators_colour_null={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("always null").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). This means the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_colour_force_red={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("force full red").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("The input will have its red value replaced with full red.")},validate:function(t){return"#ff"+t.substr(3,4)}},t.Blocks.test_validators_colour_red_null={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("not red -> null").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("If the input does not have full red, the input will validate to null (invalid). Otherwise it will return the input value")},validate:function(t){return"ff"!=t.substr(1,2)?null:t}},t.Blocks.test_validators_dropdown_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). This means the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_dropdown_force_1s={init:function(){this.appendDummyInput().appendField("force 1s").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input's value will always change to start with 1.")},validate:function(t){return"1"+t.charAt(1)}},t.Blocks.test_validators_dropdown_1s_null={init:function(){this.appendDummyInput().appendField("not 1s -> null").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input does not start with 1, the input will validate to null (invalid). Otherwise it will return the input value.")},validate:function(t){return"1"!=t.charAt(0)?null:t}},t.Blocks.test_validators_number_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The field will display the input while the field is being edited, but the value should be the default value. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_number_mult10_force={init:function(){this.appendDummyInput().appendField("force mult of 10").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input value will be rounded to the nearest multiple of 10. The field will display the input while the field is being edited, but the value should be the validated (rounded) value. Note: If you want to do rounding this is not the proper way, use the precision option of the number field constructor instead.")},validate:function(t){return 10*Math.round(t/10)}},t.Blocks.test_validators_number_mult10_null={init:function(){this.appendDummyInput().appendField("not mult of 10 -> null").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input value is not a multiple of 10, the input will validate to null (invalid). The field will display the input while the field is being edited, but if the input value is invalid the value should be the default value.")},validate:function(t){return t%10!=0?null:t}},t.Blocks.test_validators_variable_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All ids validate to null (invalid). This means the variable should not change.")},validate:function(t){return null}},t.Blocks.test_validators_variable_force_1s={init:function(){this.appendDummyInput().appendField("force 1s").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("The id will always change to start with 1.")},validate:function(t){return"1"+t.charAt(1)}},t.Blocks.test_validators_variable_1s_null={init:function(){this.appendDummyInput().appendField("not 1s -> null").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the id does not start with 1, the id will validate to null (invalid). Otherwise it will return the id.")},validate:function(t){return"1"!=t.charAt(0)?null:t}};const u={kind:"CATEGORY",name:"Fields",expanded:"true",contents:[{kind:"CATEGORY",name:"Defaults",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"set random style",callbackkey:"setRandomStyle"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle enabled",callbackkey:"toggleEnabled"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle shadow",callbackkey:"toggleShadow"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle collapsed",callbackkey:"toggleCollapsed"},{kind:"BLOCK",type:"test_fields_angle"},{kind:"BLOCK",type:"test_fields_checkbox"},{kind:"BLOCK",type:"test_fields_colour"},{kind:"BLOCK",type:"test_fields_colour_options"},{kind:"BLOCK",type:"test_fields_text_input"},{kind:"BLOCK",type:"test_fields_only_text_input"},{kind:"BLOCK",type:"test_fields_multilinetext"},{kind:"BLOCK",type:"test_fields_variable"},{kind:"BUTTON",text:"randomize label text",callbackkey:"randomizeLabelText"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_fields_label_serializable"},{kind:"BUTTON",text:"change image",callbackkey:"changeImage"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_fields_image"}]},{kind:"CATEGORY",name:"Numbers",contents:[{kind:"BLOCK",blockxml:'\n<block type="test_numbers_float">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_hundredths">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_halves">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_whole">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_three_halves">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_whole_bounded">\n <field name="NOTE">60</field>\n</block>'}]},{kind:"CATEGORY",name:"Angles",contents:[{kind:"BLOCK",type:"test_angles_clockwise"},{kind:"BLOCK",type:"test_angles_offset"},{kind:"BLOCK",type:"test_angles_wrap"},{kind:"BLOCK",type:"test_angles_round_30"},{kind:"BLOCK",type:"test_angles_round_0"},{kind:"BLOCK",type:"test_angles_protractor"},{kind:"BLOCK",type:"test_angles_compass"}]},{kind:"CATEGORY",name:"Drop-downs",contents:[{kind:"LABEL",text:"Dynamic"},{kind:"BLOCK",type:"test_dropdowns_dynamic"},{kind:"BUTTON",text:"Add option",callbackkey:"addDynamicOption"},{kind:"BUTTON",text:"Remove option",callbackkey:"removeDynamicOption"},{kind:"BLOCK",type:"test_dropdowns_dynamic_random"},{kind:"BLOCK",type:"test_dropdowns_dynamic_connect_dependant"},{kind:"LABEL",text:"Other"},{kind:"BLOCK",type:"test_dropdowns_long"},{kind:"BLOCK",type:"test_dropdowns_images"},{kind:"BLOCK",type:"test_dropdowns_images_and_text"}]},{kind:"CATEGORY",name:"Images",contents:[{kind:"BLOCK",type:"test_images_datauri"},{kind:"BLOCK",type:"test_images_small"},{kind:"BLOCK",type:"test_images_large"},{kind:"BLOCK",type:"test_images_fliprtl"},{kind:"BLOCK",type:"test_images_missing"},{kind:"BLOCK",type:"test_images_many_icons"},{kind:"BLOCK",type:"test_images_clickhandler"}]},{kind:"CATEGORY",name:"Emoji! o((*^ᴗ^*))o",contents:[{kind:"LABEL",text:"Unicode & Emojis"},{kind:"BLOCK",type:"test_style_emoji"},{kind:"BLOCK",blockxml:'\n<block type="text">\n <field name="TEXT">Robot face in text field:🤖</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text">\n <field name="TEXT">Zalgo in text field:B̛̻̦̬̘̰͎̥̈̔͊͞ͅl̡͖̫̺̬̖̣̳̃̀́͑͑̕͟͠͝o̢̹͙̮̫͔͋̉̊̑̿̽̚c̸̹̹̜͙̹̠͋̒͑̊̇͝k̡͉̫͇̖̳͖̊͒́̆̄̎̂̔̕͜͞l̰̙̞̳̩̠͖̯̀̆̈́̿̈̓͗y̨̡̟͇̮͈̬̙̲̏̅̀͘͠</field>\n</block>'}]},{kind:"CATEGORY",name:"Validators",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"set input",callbackkey:"setInput"},{kind:"LABEL",text:"Dispose block"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dispose_block"},{kind:"LABEL",text:"Angles"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_mult30_force"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_mult30_null"},{kind:"LABEL",text:"Checkboxes"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_match"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_not_match_null"},{kind:"LABEL",text:"Colours"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_force_red"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_red_null"},{kind:"LABEL",text:"Dropdowns"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_force_1s"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_1s_null"},{kind:"LABEL",text:"Numbers"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_mult10_force"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_mult10_null"},{kind:"LABEL",text:"Text"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_A"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_B"},{kind:"LABEL",text:"Variables"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"add test variables",callbackkey:"addVariables","web-class":"modifiesWorkspace"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_force_1s"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_1s_null"}]}]};t.defineBlocksWithJsonArray([{type:"test_mutator_colorChange",message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"colour_blocks"}]);const m={mutationToDom:function(){const e=t.utils.xml.createElement("mutation");return e.setAttribute("colour",this.getColour()),e},domToMutation:function(t){this.setColour(t.getAttribute("colour"))},saveExtraState:function(){return{colour:this.getColour()}},loadExtraState:function(t){this.setColour(t.colour)},decompose:function(e){const n=t.serialization.blocks.append({type:"test_mutator_colorChange"},e);return n.getField("COLOUR").setValue(this.getColour()),n},compose:function(t){this.setColour(t.getFieldValue("COLOUR"))}},_=[];for(let t=0;t<20;t++)_.push(`test_mutator_category_${t}`);const h=_.map((t=>({type:t,message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"colour_blocks"})));t.defineBlocksWithJsonArray([{type:"test_mutators_many",message0:"test many blocks mutator",mutator:"test_many_blocks_mutator",colour:"#000000"},...h]),t.Extensions.registerMutator("test_many_blocks_mutator",m,null,[..._]),t.defineBlocksWithJsonArray([{type:"test_mutators_noflyout",message0:"noflyout mutator",mutator:"test_noflyout_mutator",colour:"#000000"}]),t.Extensions.registerMutator("test_noflyout_mutator",m,null,[]),t.defineBlocksWithJsonArray([{type:"test_mutators_changeableFlyout",message0:"changeable flyout mutator",mutator:"test_changeableFlyout_mutator",colour:"#000000"}]),t.Extensions.registerMutator("test_changeableFlyout_mutator",m,null,["text"]),t.defineBlocksWithJsonArray([{type:"test_style_hat",message0:"Hat block (event)",nextStatement:null,style:"hat_blocks"},{type:"test_style_hex1",message0:"Block color: Bright purple %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#992aff"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#992aff"},{type:"test_style_hex2",message0:"Block color: White %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#fefefe"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#fefefe"},{type:"test_style_hex3",message0:"Block color: Black %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#010101"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#010101"},{type:"test_style_no_colour",message0:"Block color: unset"},{type:"test_style_hex4",message0:"Block color: #RRGGBBAA (invalid)",colour:"#992aff99"},{type:"test_style_hex5",message0:"Block color: #RRGGBB (invalid)",colour:"#NotHex"},{type:"test_style_emoji",message0:"Robot Face: 🤖",colour:"#AAAAAA"}]);class k extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}}k.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_no_overrides",k);class y extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}toXml(t){return t.setAttribute("value",this.getValue()),t}fromXml(t){this.setValue(t.getAttribute("value"))}}y.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_xml",y);class g extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}saveState(){return{value:this.getValue()}}loadState(t){this.setValue(t.value)}}g.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_jso",g);class b extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}toXml(t){return t.setAttribute("value",this.getValue()),t}fromXml(t){this.setValue(t.getAttribute("value"))}saveState(){return{value:this.getValue()}}loadState(t){this.setValue(t.value)}}b.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_both",b),e().defineBlocksWithJsonArray([{type:"test_field_serialization_no_overrides",message0:"no overrides: %1",args0:[{type:"field_no_overrides",name:"LABEL",text:"test"}],colour:0,output:null},{type:"test_field_serialization_xml",message0:"xml: %1",args0:[{type:"field_xml",name:"LABEL",text:"test"}],colour:30,output:null},{type:"test_field_serialization_jso",message0:"jso: %1",args0:[{type:"field_jso",name:"LABEL",text:"test"}],colour:90,output:null},{type:"test_field_serialization_both",message0:"both: %1",args0:[{type:"field_both",name:"LABEL",text:"test"}],colour:150,output:null}]),e().Blocks.test_extra_state_xml=Object.assign({},e().Blocks.lists_create_with),delete e().Blocks.test_extra_state_xml.saveExtraState,delete e().Blocks.test_extra_state_xml.loadExtraState,e().Blocks.test_extra_state_xml.init=function(){this.setColour(30),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))},e().Blocks.test_extra_state_jso=Object.assign({},e().Blocks.lists_create_with),delete e().Blocks.test_extra_state_jso.mutationToDom,delete e().Blocks.test_extra_state_jso.domToMutation,e().Blocks.test_extra_state_jso.init=function(){this.setColour(90),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))},e().Blocks.test_extra_state_both=Object.assign({},e().Blocks.lists_create_with),e().Blocks.test_extra_state_both.init=function(){this.setColour(150),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))};const f={contents:[{kind:"CATEGORY",name:"Align",contents:[{kind:"BLOCK",type:"test_align_dummy_right"},{kind:"BLOCK",type:"test_align_all"},{kind:"BLOCK",type:"test_align_with_external_input"}]},{kind:"CATEGORY",name:"Basic",contents:[{kind:"BLOCK",type:"test_basic_empty"},{kind:"BLOCK",type:"test_basic_empty_with_mutator"},{kind:"BLOCK",type:"test_basic_dummy"},{kind:"BLOCK",type:"test_basic_multiple_dummy"},{kind:"BLOCK",type:"test_basic_stack"},{kind:"BLOCK",type:"test_basic_row"},{kind:"BLOCK",type:"test_basic_value_to_stack"},{kind:"BLOCK",type:"test_basic_value_to_statement"},{kind:"BLOCK",type:"test_basic_limit_instances"},{kind:"BLOCK",type:"test_basic_tooltips"},{kind:"BLOCK",type:"test_basic_javascript"}]},a,{kind:"CATEGORY",name:"Drag",contents:[{kind:"LABEL",text:"Drag each to the workspace"},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <block type="text">\n <field name="TEXT">Drag me by this child</field>\n </block>\n </value>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Drag me by this shadow</field>\n </shadow>\n </value>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Shadow value</field>\n </shadow>\n </value>\n <next>\n <shadow type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Shadow statement</field>\n </shadow>\n </value>\n </shadow>\n </next>\n</block>'},{kind:"LABEL",text:"Multiple Variable Refs"},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <block type="variables_get">\n <field name="VAR" id="item">item</field>\n </block>\n </value>\n <next>\n <block type="text_print">\n <value name="TEXT">\n <block type="variables_get">\n <field name="VAR" id="item">item</field>\n </block>\n </value>\n </block>\n </next>\n</block>'},{kind:"LABEL",text:"Procedure Definitions"},{kind:"BLOCK",blockxml:'\n<block type="procedures_defnoreturn">\n <field name="NAME">without arguments</field>\n <statement name="STACK">\n <block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">No argument reference.</field>\n </shadow>\n </value>\n </block>\n </statement>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="procedures_defnoreturn">\n <mutation><arg name="fnArgument"></arg></mutation>\n <field name="NAME">with one argument</field>\n <statement name="STACK">\n <block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Expected an argument reference here.</field>\n </shadow>\n <block type="variables_get">\n <field name="VAR">fnArgument</field>\n </block>\n </value>\n </block>\n </statement>\n</block>'}]},u,{kind:"CATEGORY",name:"Mutators",contents:[{kind:"LABEL",text:"logic_compare"},{kind:"BLOCK",type:"logic_compare",inputs:{A:{shadow:{type:"math_number",fields:{NUM:10}}},B:{shadow:{type:"math_number",fields:{NUM:10}}}}},{kind:"BLOCK",type:"logic_compare",inputs:{A:{block:{type:"math_number",fields:{NUM:10}}},B:{block:{type:"math_number",fields:{NUM:10}}}}},{kind:"BLOCK",type:"test_mutators_noflyout"},{kind:"BLOCK",type:"test_mutators_many"},{kind:"BLOCK",type:"test_mutators_changeableFlyout"}]},{kind:"CATEGORY",name:"Style",contents:[{kind:"LABEL",text:"Hats"},{kind:"BLOCK",type:"test_style_hat"},{kind:"LABEL",text:"Colour"},{kind:"BLOCK",type:"test_style_hex1"},{kind:"BLOCK",type:"test_style_hex2"},{kind:"BLOCK",type:"test_style_hex3"},{kind:"BLOCK",type:"test_style_no_colour"},{kind:"BLOCK",type:"test_style_hex4"},{kind:"BLOCK",type:"test_style_hex5",gap:"40"},{kind:"BLOCK",type:"test_style_hex5",disabled:"true"}]},{kind:"CATEGORY",name:"Serialization",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"randomize text",callbackkey:"randomizeText"},{kind:"BLOCK",type:"test_field_serialization_no_overrides"},{kind:"BLOCK",type:"test_field_serialization_xml"},{kind:"BLOCK",type:"test_field_serialization_jso"},{kind:"BLOCK",type:"test_field_serialization_both"},{kind:"SEP",gap:30},{kind:"BLOCK",blockxml:'<block type="test_extra_state_xml"><mutation items="2"></mutation></block>'},{kind:"BLOCK",type:"test_extra_state_jso",extraState:{itemCount:2}},{kind:"BLOCK",type:"test_extra_state_both",extraState:{itemCount:2}},{kind:"SEP",gap:30},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_no_overrides"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_xml"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_jso"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_both"}}}},{kind:"SEP",gap:30},{kind:"BLOCK",blockxml:'<block type="text_print"><value name="TEXT"><shadow type="test_extra_state_xml"><mutation items="2"></mutation></shadow></value></block>'},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_extra_state_jso",extraState:{itemCount:2}}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_extra_state_both",extraState:{itemCount:2}}}}}]}]};function x(e){(function(t){!function(t){t.registerButtonCallback("insertConnectionRows",n)}(t),function(t){t.registerButtonCallback("insertConnectionStacks",s)}(t),function(t){t.registerButtonCallback("insertConnectionStatements",i)}(t)})(e),function(e){!function(t){t.registerButtonCallback("randomizeLabelText",(function(t){const e=t.getTargetWorkspace().getBlocksByType("test_fields_label_serializable");for(let t,n=0;t=e[n];n++){let e="";for(let t=0;t<4;t++)e+="AB".charAt(Math.floor(Math.random()*"AB".length));t.setFieldValue(e,"LABEL")}})),t.registerButtonCallback("setRandomStyle",(function(e){const n=e.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1),o=Object.keys(t.getRenderer().getConstants().blockStyles);o.splice(o.indexOf(n[0].getStyleName()),1);const l=o[Math.floor(Math.random()*o.length)];for(let t,e=0;t=n[e];e++)t.setStyle(l)})),t.registerButtonCallback("toggleEnabled",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setEnabled(!t.isEnabled())})),t.registerButtonCallback("toggleShadow",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setShadow(!t.isShadow())})),t.registerButtonCallback("toggleCollapsed",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setCollapsed(!t.isCollapsed())})),t.registerButtonCallback("changeImage",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getBlocksByType("test_fields_image"),n="abcdefghijklm",o="https://blockly-demo.appspot.com/static/tests/media/"+n.charAt(Math.floor(Math.random()*n.length))+".png";for(let t,n=0;t=e[n];n++)t.getField("IMAGE").setValue(o)}))}(e),function(t){t.registerButtonCallback("addDynamicOption",d),t.registerButtonCallback("removeDynamicOption",p)}(e),function(e){e.registerButtonCallback("addVariables",(function(t){e.createVariable("1b","","1B"),e.createVariable("1c","","1C"),e.createVariable("2a","","2A"),e.createVariable("2b","","2B"),e.createVariable("2c","","2C")})),e.registerButtonCallback("setInput",(function(e){t.prompt("Input text to set.","ab",(function(t){const n=e.getTargetWorkspace().getAllBlocks(!1);for(let e,o=0;e=n[o];o++)e.getField("INPUT")&&e.setFieldValue(t,"INPUT")}))}))}(e)}(e),function(t){t.registerButtonCallback("randomizeText",(function(t){const e=t.getTargetWorkspace(),n=[...e.getBlocksByType("test_field_serialization_no_overrides"),...e.getBlocksByType("test_field_serialization_xml"),...e.getBlocksByType("test_field_serialization_jso"),...e.getBlocksByType("test_field_serialization_both")],o="ABCDEF";for(let t,e=0;t=n[e];e++){let e="";for(let t=0;t<4;t++)e+=o.charAt(Math.floor(Math.random()*o.length));t.setFieldValue(e,"LABEL")}}))}(e),e.registerButtonCallback("addAllBlocksToWorkspace",(function(e){const n=e.getTargetWorkspace(),o=n.getFlyout().getWorkspace().getTopBlocks();for(let e,l=0;e=o[l];l++){const o=t.serialization.blocks.save(e,{addCoordinates:!0});t.serialization.blocks.append(o,n)}}))}})(),l})()));
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("blockly/core"));else if("function"==typeof define&&define.amd)define(["blockly/core"],e);else{var n="object"==typeof exports?e(require("blockly/core")):e(t.Blockly);for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(this,(t=>(()=>{"use strict";var e={573:e=>{e.exports=t}},n={};function o(t){var l=n[t];if(void 0!==l)return l.exports;var s=n[t]={exports:{}};return e[t](s,s.exports,o),s.exports}o.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return o.d(e,{a:e}),e},o.d=(t,e)=>{for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),o.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var l={};return(()=>{o.r(l),o.d(l,{toolboxTestBlocks:()=>f,toolboxTestBlocksInit:()=>x});var t=o(573),e=o.n(t);t.defineBlocksWithJsonArray([{type:"test_align_dummy_right",message0:"text right %1 long text right %2",args0:[{type:"input_dummy",align:"RIGHT"},{type:"input_dummy",align:"RIGHT"}],style:"math_blocks"},{type:"test_align_all",message0:"text %1 long text left %2 text centre %3 much longer text right %4",args0:[{type:"input_dummy"},{type:"input_dummy",align:"LEFT"},{type:"input_dummy",align:"CENTRE"},{type:"input_dummy",align:"RIGHT"}],style:"math_blocks"},{type:"test_align_with_external_input",message0:"text right %1 long text centre %2 text left %3 much longer text %4",args0:[{type:"input_dummy",align:"RIGHT"},{type:"input_dummy",align:"CENTRE"},{type:"input_dummy",align:"LEFT"},{type:"input_value",name:"VALUE"}],inputsInline:!1,style:"math_blocks"}]),t.defineBlocksWithJsonArray([{type:"test_basic_empty",message0:"",args0:[]},{type:"test_basic_stack",message0:"stack block",previousStatement:null,nextStatement:null,colour:"120"},{type:"test_basic_dummy",message0:"dummy input %1",args0:[{type:"input_dummy"}],style:"math_blocks"},{type:"test_basic_multiple_dummy",message0:"first dummy %1 second dummy %2",args0:[{type:"input_dummy"},{type:"input_dummy"}],style:"math_blocks"},{type:"test_basic_row",message0:"row block %1",args0:[{type:"input_value",name:"INPUT"}],output:null,style:"math_blocks"},{type:"test_basic_value_to_stack",message0:"value to stack",nextStatement:null,output:null,style:"math_blocks"},{type:"test_basic_value_to_statement",message0:"value to statement %1",args0:[{type:"input_statement",name:"STATEMENT"}],output:null,style:"math_blocks"},{type:"test_basic_limit_instances",message0:"limit 3 instances %1 %2",args0:[{type:"input_dummy"},{type:"input_statement",name:"STATEMENT"}],previousStatement:null,nextStatement:null,style:"math_blocks"},{type:"test_basic_tooltips",message0:"%1 %2 %3",args0:[{type:"field_label",name:"NAME",text:"field tooltip",tooltip:"This is a JSON tooltip for the *field*."},{type:"input_dummy"},{type:"field_label",name:"NAME",text:"block tooltip"}],tooltip:"This is a JSON tooltip for the *block*.",style:"math_blocks"},{type:"test_basic_javascript",message0:"function %1(%2) { %3 %4 return %5 }",args0:["foo","args",{type:"input_dummy"},{type:"input_statement",name:"STACK"},{type:"input_value",check:"number",align:"right",name:"RETURN"}],inputsInline:!0,colour:200,tooltip:"Hello world."}]),t.Blocks.test_basic_empty_with_mutator={init:function(){this.setMutator(new t.icons.MutatorIcon(["math_number"],this))},decompose:function(t){const e=t.newBlock("math_number");return e.initSvg(),e},compose:function(){}},t.Blocks.test_chameleon={hasOutput:!0,hasPrevious:!0,init:function(){this.appendDummyInput().appendField("chameleon"),this.setColour(120),this.updateShape()},onchange:function(e){e.type===t.Events.BLOCK_DRAG&&(console.log("got drag event"),this.hasPrevious=!this.outputConnection||!this.outputConnection.targetBlock(),this.hasOutput=!this.getPreviousBlock(),this.updateShape())},updateShape:function(){this.setPreviousStatement(this.hasPrevious),this.setOutput(this.hasOutput)}},t.defineBlocksWithJsonArray([{type:"test_connections_row_input",message0:"%1",args0:[{type:"input_value",name:"NAME"}],colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any output connection."},{type:"test_connections_row_blue",message0:"%1",args0:[{type:"input_value",name:"NAME",check:"greenRel"}],output:"noneOut",colour:230,tooltip:"Output: noneOut\nInput: greenRel\nInput connection can accept yellow blocks but not red blocks."},{type:"test_connections_row_yellow",message0:"%1",args0:[{type:"input_value",name:"NAME",check:["orangeRel","yellowRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nInput can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_row_red",message0:"%1",args0:[{type:"input_value",name:"NAME",check:"noneIn"}],output:"orangeRel",colour:0,tooltip:"Output: orangeRel\nInput: noneIn\nOutput can connect to yellow blocks, but not blue blocks."},{type:"test_connections_row_output",message0:"",output:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any input connection."},{type:"test_connections_multivalue_1valid",message0:"none %1 both %2",args0:[{type:"input_value",name:"NAME1",align:"RIGHT",check:"noneIn"},{type:"input_value",name:"NAME2",align:"RIGHT",check:["yellowRel","orangeRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput Top: noneIn\nInput Bottom: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nTop Input can connect to nothing, except grey blocks.\nBottom Input can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_multivalue_2valid",message0:"both %1 both %2",args0:[{type:"input_value",name:"NAME1",align:"RIGHT",check:["yellowRel","orangeRel"]},{type:"input_value",name:"NAME2",align:"RIGHT",check:["yellowRel","orangeRel"]}],output:["yellowRel","greenRel"],colour:60,tooltip:"Output: yellowRel, greenRel\nInput Top: yellowRel, orangeRel\nInput Bottom: yellowRel, orangeRel\nOutput can connect to yellow blocks and blue blocks, but not red blocks.\nTop Input can connect to yellow blocks and red blocks, but not blue blocks.\nBottom Input can connect to yellow blocks and red blocks, but not blue blocks."}]);const n=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_row_input">\n <value name="NAME">\n <block type="test_connections_row_blue">\n <value name="NAME">\n <block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_red">\n <value name="NAME">\n <block type="test_connections_row_output"/>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n </value>\n </block>\n</xml>'),n)};t.defineBlocksWithJsonArray([{type:"test_connections_stack_next",message0:"",nextStatement:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any previous connection."},{type:"test_connections_stack_blue",message0:"",previousStatement:"nonePrev",nextStatement:"greenRel",colour:230,tooltip:"Prev: nonePrev\nNext: greenRel\nNext connection can accept yellow blocks but not red blocks."},{type:"test_connections_stack_yellow",message0:"",previousStatement:["greenRel","yellowRel"],nextStatement:["yellowRel","orangeRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nNext can connect to yellow blocks and red blocks, but not blue blocks."},{type:"test_connections_stack_red",message0:"",previousStatement:"orangeRel",nextStatement:"noneNext",colour:0,tooltip:"Prev: orangeRel\nNext: noneNext\nPrev can connect to yellow blocks, but not blue blocks."},{type:"test_connections_stack_prev",message0:"",previousStatement:null,colour:"#aaaaaa",tooltip:"No Checks\nCan connect to any input connection."}]);const s=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_stack_next">\n <next>\n <block type="test_connections_stack_blue">\n <next>\n <block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_red">\n <next>\n <block type="test_connections_stack_prev"/>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n </next>\n </block>\n</xml>'),n)};t.defineBlocksWithJsonArray([{type:"test_connections_statement_blue",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:"greenRel"}],previousStatement:"nonePrev",nextStatement:"greenRel",colour:230,tooltip:"Prev: nonePrev\nNext: greenRel\nStatement: greenRel\nNext connection can accept yellow blocks but not red blocks.\nStatement connection can accept yellow blocks but not red blocks."},{type:"test_connections_statement_yellow",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],nextStatement:["yellowRel","orangeRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nNext can connect to yellow blocks and red blocks, but not blue blocks.\nStatement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_statement_red",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:"noneNext"}],previousStatement:"orangeRel",nextStatement:"noneNext",colour:0,tooltip:"Prev: orangeRel\nNext: noneNext\nStatement: noneNext\nPrev connection can accept yellow blocks but not blue blocks.\nStatement connection accepts none."},{type:"test_connections_statement_nonext",message0:"%1",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nStatement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_multistatement_1valid",message0:"none %1 both %2",args0:[{type:"input_statement",name:"NAME",check:"noneNext"},{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nTop Statement cannot connect to anything, except grey blocks.\nBottom Statement connection can accept yellow blocks and red blocks but not blue blocks.\n"},{type:"test_connections_multistatement_2valid",message0:"both %1 both %2",args0:[{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]},{type:"input_statement",name:"NAME",check:["yellowRel","orangeRel"]}],previousStatement:["greenRel","yellowRel"],colour:60,tooltip:"Prev: yellowRel, greenRel\nNext: yellowRel, orangeRel\nStatement: orangeRel\nPrev can connect to yellow blocks and blue blocks, but not red blocks.\nTop Statement connection can accept yellow blocks and red blocks but not blue blocks.\nBottom Statement connection can accept yellow blocks and red blocks but not blue blocks.\n"}]);const i=function(e){const n=e.getTargetWorkspace();t.Xml.domToWorkspace(t.utils.xml.textToDom('<xml xmlns="https://developers.google.com/blockly/xml">\n <block type="test_connections_statement_blue">\n <statement name="NAME">\n <block type="test_connections_statement_yellow">\n <statement name="NAME">\n <block type="test_connections_statement_yellow">\n <statement name="NAME">\n <block type="test_connections_statement_red"/>\n </statement>\n </block>\n </statement>\n </block>\n </statement>\n </block>\n</xml>'),n)},a={kind:"CATEGORY",name:"Connections",expanded:"true",contents:[{kind:"CATEGORY",name:"Row",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionRows"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_input"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_red"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_row_output"},{kind:"BLOCK",blockxml:'\n<block type="test_connections_row_yellow">\n <value name="NAME">\n <block type="test_connections_row_yellow" movable="false">\n </block>\n </value>\n</block>'},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multivalue_1valid"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multivalue_2valid"}]},{kind:"CATEGORY",name:"Stack",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionStacks"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_next"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_red"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_stack_prev"},{kind:"BLOCK",blockxml:'\n<block type="test_connections_stack_yellow">\n <next>\n <block type="test_connections_stack_yellow" movable="false"></block>\n </next>\n</block>'}]},{kind:"CATEGORY",name:"Statement",contents:[{kind:"LABEL",text:"blocks have"},{kind:"SEP",gap:"-1"},{kind:"LABEL",text:"tooltips"},{kind:"BUTTON",text:"insert",callbackkey:"insertConnectionStatements"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_blue"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_yellow"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_statement_red"},{kind:"BLOCK",type:"test_connections_statement_nonext"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multistatement_1valid"},{kind:"SEP",gap:"7"},{kind:"BLOCK",type:"test_connections_multistatement_2valid"}]}]};t.defineBlocksWithJsonArray([{type:"test_fields_angle",message0:"angle: %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:"90",alt:{type:"field_label",text:"NO ANGLE FIELD"}}],style:"math_blocks"},{type:"test_fields_text_input",message0:"text input %1",args0:[{type:"field_input",name:"TEXT_INPUT",text:"default"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_only_text_input",message0:"%1",args0:[{type:"field_input",name:"TEXT_INPUT",text:"default"}],style:"textInput",tooltip:"",helpUrl:"",output:"String"},{type:"test_fields_multilinetext",message0:"code %1",args0:[{type:"field_multilinetext",name:"CODE",text:"default1\ndefault2"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_fields_checkbox",message0:"checkbox %1",args0:[{type:"field_checkbox",name:"CHECKBOX",checked:!0}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_colour",message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_colour_options",message0:"colour options %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff4040",colourOptions:["#ff4040","#ff8080","#ffc0c0","#4040ff","#8080ff","#c0c0ff"],colourTitles:["dark pink","pink","light pink","dark blue","blue","light blue"],columns:3}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_fields_variable",message0:"variable %1",args0:[{type:"field_variable",name:"VARIABLE",variable:"item"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_label_serializable",message0:"label serializable %1",args0:[{type:"field_label_serializable",name:"LABEL",text:"default"}],style:"math_blocks",tooltip:"",helpUrl:""},{type:"test_fields_image",message0:"image %1",args0:[{type:"field_image",name:"IMAGE",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"}],colour:230}]),t.defineBlocksWithJsonArray([{type:"test_numbers_float",message0:"float %1",args0:[{type:"field_number",name:"NUM",text:"0"}],style:"math_blocks",output:"Number",tooltip:"A number."},{type:"test_numbers_whole",message0:"precision 1 %1",args0:[{type:"field_number",name:"NUM",precision:1,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 1"},{type:"test_numbers_hundredths",message0:"precision 0.01 %1",args0:[{type:"field_number",name:"NUM",precision:.01,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 0.01"},{type:"test_numbers_halves",message0:"precision 0.5 %1",args0:[{type:"field_number",name:"NUM",precision:.5,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 0.5"},{type:"test_numbers_three_halves",message0:"precision 1.5 %1",args0:[{type:"field_number",name:"NUM",precision:1.5,text:"0"}],style:"math_blocks",output:"Number",tooltip:"The number should be rounded to multiples of 1.5"},{type:"test_numbers_whole_bounded",message0:"midi note %1",args0:[{type:"field_number",name:"NOTE",precision:1,min:1,max:127,text:"0"}],style:"math_blocks",output:"Note",tooltip:"A midi note."}]);t.defineBlocksWithJsonArray([{type:"test_angles_protractor",message0:"protractor %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,mode:"protractor"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_compass",message0:"compass %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,mode:"compass"}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_clockwise",message0:"clockwise %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,clockwise:!0}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_offset",message0:"offset 90 %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,offset:90}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_wrap",message0:"wrap %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,wrap:180}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_round_30",message0:"round 30 %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,round:30}],style:"math_blocks",tooltip:"test tooltip"},{type:"test_angles_round_0",message0:"no round %1",args0:[{type:"field_angle",name:"FIELDNAME",angle:0,round:0}],style:"math_blocks",tooltip:"test tooltip"}]),t.defineBlocksWithJsonArray([{type:"test_dropdowns_long",message0:"long: %1",args0:[{type:"field_dropdown",name:"FIELDNAME",options:[["first item","ITEM1"],["second item","ITEM2"],["third item","ITEM3"],["fourth item","ITEM4"],["fifth item","ITEM5"],["sixth item","ITEM6"],["seventh item","ITEM7"],["eighth item","ITEM8"],["ninth item","ITEM9"],["tenth item","ITEM10"],["eleventh item","ITEM11"],["twelfth item","ITEM12"],["thirteenth item","ITEM13"],["fourteenth item","ITEM14"],["fifteenth item","ITEM15"],["sixteenth item","ITEM16"],["seventeenth item","ITEM17"],["eighteenth item","ITEM18"],["nineteenth item","ITEM19"],["twentieth item","ITEM20"],["twenty-first item","ITEM21"],["twenty-second item","ITEM22"],["twenty-third item","ITEM23"],["twenty-fourth item","ITEM24"],["twenty-fifth item","ITEM25"],["twenty-sixth item","ITEM26"],["twenty-seventh item","ITEM27"],["twenty-eighth item","ITEM28"],["twenty-ninth item","ITEM29"],["thirtieth item","ITEM30"],["thirty-first item","ITEM31"],["thirty-second item","ITEM32"]]}]},{type:"test_dropdowns_images",message0:"%1",args0:[{NOTE:"The following paths are relative to playground.html",type:"field_dropdown",name:"FIELDNAME",options:[[{src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},"A"],[{src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},"B"],[{src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},"C"],[{src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},"D"],[{src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},"E"],[{src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},"F"],[{src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},"G"],[{src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},"H"],[{src:"https://blockly-demo.appspot.com/static/tests/media/i.png",width:32,height:32,alt:"I"},"I"],[{src:"https://blockly-demo.appspot.com/static/tests/media/j.png",width:32,height:32,alt:"J"},"J"],[{src:"https://blockly-demo.appspot.com/static/tests/media/k.png",width:32,height:32,alt:"K"},"K"],[{src:"https://blockly-demo.appspot.com/static/tests/media/l.png",width:32,height:32,alt:"L"},"L"],[{src:"https://blockly-demo.appspot.com/static/tests/media/m.png",width:32,height:32,alt:"M"},"M"]]}]},{type:"test_dropdowns_images_and_text",message0:"%1",args0:[{type:"field_dropdown",name:"FIELDNAME",options:[["images and text","IMAGES AND TEXT"],[{src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},"A"],[{src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},"B"],[{src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},"C"],[{src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},"D"],[{src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},"E"],[{src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},"F"],[{src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},"G"],[{src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},"H"],["xyz","LMNOP"],[{src:"https://blockly-demo.appspot.com/static/tests/media/i.png",width:32,height:32,alt:"I"},"I"],[{src:"https://blockly-demo.appspot.com/static/tests/media/j.png",width:32,height:32,alt:"J"},"J"],[{src:"https://blockly-demo.appspot.com/static/tests/media/k.png",width:32,height:32,alt:"K"},"K"],[{src:"https://blockly-demo.appspot.com/static/tests/media/l.png",width:32,height:32,alt:"L"},"L"],[{src:"https://blockly-demo.appspot.com/static/tests/media/m.png",width:32,height:32,alt:"M"},"M"]]}]},{type:"test_dropdowns_in_mutator",message0:"dropdown mutator",mutator:"test_dropdown_mutator"},{type:"test_dropdowns_in_mutator_block",message0:"dropdown %1",args0:[{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]}]}]);const c=[],d=function(){t.prompt("Add an option?","option "+c.length,(function(t){t&&(console.log("Adding option: "+t),c.push([t,"OPTION"+c.length]))}))},p=function(){const e=c[0]?c[0][0]:"";t.prompt("Remove an option?",e,(function(t){for(let e,n=0;e=c[n];n++)e[0]==t&&(console.log("Removing option: "+t),c.splice(n,1))}))};t.Blocks.test_dropdowns_dynamic_random={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic random").appendField(e,"OPTIONS")},dynamicOptions:function(){const t=Math.floor(10*Math.random())+1,e=[];for(let n=0;n<t;n++)e.push([String(n),String(n)]);return e}},t.Blocks.test_dropdowns_dynamic_connect_dependant={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic connect-dependant").appendField(e,"OPTIONS"),this.setNextStatement(!0),this.setPreviousStatement(!0)},dynamicOptions:function(){if(this.sourceBlock_&&this.sourceBlock_.getSurroundParent()){const t=this.sourceBlock_.getSurroundParent(),e=[["connected","CONNECTED_KEY"],[`surroundParent: ${t.type}`,`${t.id}_type_key`],[`surroundParent: ${t.id}`,`${t.id}_key`]],n=this.sourceBlock_.getTopStackBlock();return n.id!==t.id&&(e.push([`topStack: ${n.type}`,`${n.id}_type_key`]),e.push([`topStack: ${n.id}`,`${n.id}_key`])),e}return[["unconnected","UNCONNECTED_KEY"]]}};const r={mutationToDom:function(){return t.utils.xml.createElement("mutation")},domToMutation:function(t){},saveExtraState:function(){return{}},loadExtraState:function(t){},decompose:function(t){const e=t.newBlock("test_dropdowns_in_mutator_block");return e.initSvg(),e},compose:function(t){}};t.Extensions.registerMutator("test_dropdown_mutator",r,null,["test_dropdowns_in_mutator_block"]),t.Blocks.test_dropdowns_dynamic={init:function(){const e=new t.FieldDropdown(this.dynamicOptions);this.appendDummyInput().appendField("dynamic").appendField(e,"OPTIONS")},dynamicOptions:function(){return c.length?c:[["","OPTION0"]]}},t.defineBlocksWithJsonArray([{type:"test_images_datauri",message0:"Image data: URI %1",args0:[{type:"field_image",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAABHZJREFUaAXtmEuPDFEUx8cwJIx4jQjxSGYt4pWQiGSIz4A1O2FtLyx8B4+MxIKEtQkRsZBIEF/AAgki3gzjNfx/Xfc/rkpVd1dXdU13OMm/z73ndc+5r6rqgYHu01wNAfqa5kTZx+1I3PtNJ35Aqe4P6VrW+9mnEl6o/g/hu0Ab6koxg0nsjn+dVF6c+Yr8SZgUaGeRfR0ry6alzEFaGuYY/AryafFODjQ++EKOlfRq+nXSxzTeY2FHGHcocM/uIvXZWoA2ZJ1td0pGjKMoRY6d9Nr8ndemXdrMyayVYr1wQ9gn3BVIhNklNluKg06fNslTFDacG4q4LgwLxIIcO+nV+HtOY5HoF2FbgXG3y3ZKwPdsAb/KTeOZIxESOhRG2SB+SrgvfBDeC/cEZKwgdFjA5wydQHFMy2rh8WWxOYx4UJybiiTBR+Fzqu/nin2kHohj0a+dmEWfNYpwAefV3iSMCiMC5+GSYD0PSgjfWVkJDmoaJLRO8EocUXulMC68EW4KpuNqUAy2+EDpePRnjdj/JMhKUASH37N/S+0FgrePV+akZLWTl3+jRt4j7BbGhCUC9EAgcbbThdC+KL5aMA2Fxi5xbLkMoKXCmEBMYjMG5DGTXgW/XuqtiuVZNr8S4nM7cbBHBbYTehcxqDZJOTGv2DvJoKuC45lvaWiSbRea+cyHNN8i0UwHgyfilwUS+SYsFkiCmSYWD7tXwkOB5J8H7uRcCL48EPEDTMYqgYngneyl8FSAPHbSq+DXSWSFYmuwIhzg4WDgSYr93GY7kjQ++OaR7fP0M3IPNiNo0mBWCcxMm+izCtbBHRM5emR5FOvxi21ZibifF6Mh96BNjSIlgX9GfRJJkwen4CLbgrj2Tcds2Y9nt6VxQYOOkyo4TsO86IrkjRGvjNvmsQ8yCox1cTu2LdQuW4gT4wYyuZ21rbxKtsHHbcdynEK8TCEM7GS5jp3k8pAB16plQdRYCRLHxjp8JwVilSpG/h0TA08IXwUSAyTFNdwM2Nge32sCsTqmTp09c8zsM4H3KB6EJMcqW5+Oj946X88jklHMGoE3AuvVbJ/KbC1G4crkW4Ptsld4KzimZ1yiGSJJF0chy4Q7Av7xta5uMfKgxbz+WPMOxv9VrMhtwcmTJDqADKIAkgVeNWS8CbAi2M4akciEMCXwusFrB0WQPJy+z0qWDh98S58RxeiYvEXgnJUVIdIJcQqBQ8ib6fCNY+FTmMpsLZIlATiH1MQHFWT+Oun+JcvSOVZk3n5zsH3TTEuKgEjCf4k6pjnyZjqvhmMRrzCVWZF4MJLwwzGW086TW1eqAA/mWXO/b/n/Qnpt6f6vyL++Ir6hzCubj7q3lscz79tC/DVoXlkhVT0QWyXkV/TxYGhueSv/lvq6CuFM8CryQjgdsqJf2VmpfK+GJLOYi+FbvtIiGKwbK+JZNo+LQlb5+WCAbqyIY5rHhXSt3Y3BPOPmXUs+Dlzld7K30iMNwD8q3Ex85lquZv8QhzimdD/W9Xyb5H0z1Zbsb+OT/8HoqhrfAAAAAElFTkSuQmCC",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_small",message0:"Image too small %1",args0:[{type:"field_image",src:"media/30px.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_large",message0:"Image too large %1",args0:[{type:"field_image",src:"media/200px.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_fliprtl",message0:"Image flipped RTL %1",args0:[{type:"field_image",src:"media/arrow.png",width:50,height:50,alt:"*",flipRtl:!0}],colour:160},{type:"test_images_missing",message0:"Image missing %1",args0:[{type:"field_image",src:"missing.png",width:50,height:50,alt:"*"}],style:"text_blocks"},{type:"test_images_many_icons",message0:"Lots of network icons: %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16 %17 %18",args0:[{type:"input_dummy"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"},{type:"input_dummy"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/a.png",width:32,height:32,alt:"A"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/b.png",width:32,height:32,alt:"B"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/c.png",width:32,height:32,alt:"C"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/d.png",width:32,height:32,alt:"D"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/e.png",width:32,height:32,alt:"E"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/f.png",width:32,height:32,alt:"F"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/g.png",width:32,height:32,alt:"G"},{type:"field_image",src:"https://blockly-demo.appspot.com/static/tests/media/h.png",width:32,height:32,alt:"H"}],style:"text_blocks"}]),t.Blocks.test_images_clickhandler={init:function(){this.appendDummyInput().appendField("Image click handler").appendField(new t.FieldImage("https://blockly-demo.appspot.com/static/tests/media/a.png",32,32,"image with click handler",this.onClick_),"IMAGE"),this.setStyle("text_blocks")},onClick_:function(){alert("Image clicked")}};t.Blocks.test_validators_dispose_block={init:function(){this.appendDummyInput().appendField("dispose block").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("Any changes to the text cause the block to be disposed")},validate:function(t){"default"!=t&&this.getSourceBlock().dispose(!0)}},t.Blocks.test_validators_text_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The display text will remain the input text, but the value should be the default text. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_text_A={init:function(){this.appendDummyInput().appendField("remove 'a'").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All 'a' characters are removed from field value. The display text will include invalid 'a' characters while the field is being edited, but the value will not.")},validate:function(t){return t.replace(/a/g,"")}},t.Blocks.test_validators_text_B={init:function(){this.appendDummyInput().appendField("'b' -> null").appendField(new t.FieldTextInput("default",this.validate),"INPUT"),this.setColour(230),this.setCommentText("Upon detecting a 'b' character the input will validated to null (invalid). Upon removal it should revert to being valid. The display text will remain the input text, but if the input text is invalid the value should be the default text.")},validate:function(t){return-1!==t.indexOf("b")?null:t}},t.Blocks.test_validators_angle_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The field will display the input while the field is being edited (this includes the text and the graphic), but the value should be the default value. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_angle_mult30_force={init:function(){this.appendDummyInput().appendField("force mult of 30").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input value will be rounded to the nearest multiple of 30. The field will display the input while the field is being edited (this includes the text and the graphic), but the value will be the validated (rounded) value. Note: If you want to do rounding this is not the proper way, use the ROUND property of the field angle instead.")},validate:function(t){return 30*Math.round(t/30)}},t.Blocks.test_validators_angle_mult30_null={init:function(){this.appendDummyInput().appendField("not mult of 30 -> null").appendField(new t.FieldAngle(90,this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input value is not a multiple of 30, the input will validated to null (invalid). The field will display the input while the field is being edited (this includes the text and the graphic), but if the input value is invalid the value should be the default value.")},validate:function(t){return t%30!=0?null:t}},t.Blocks.test_validators_checkbox_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The new input always validates to null (invalid). This means that the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_checkbox_match={init:function(){this.appendDummyInput().appendField("force match").appendField(new t.FieldCheckbox(!0),"MATCH").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The validator for this block only works on the end-most checkbox. The validator will always return the value of the start-most checkbox. Therefore they should always match.")},validate:function(t){return this.sourceBlock_.getFieldValue("MATCH")}},t.Blocks.test_validators_checkbox_not_match_null={init:function(){this.appendDummyInput().appendField("not match -> null").appendField(new t.FieldCheckbox(!0),"MATCH").appendField(new t.FieldCheckbox(!0,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The validator for this block only works on the end-most checkbox. If the new value does not match the value of the start-most checkbox, it will return null (invalid), which means the field value should not change. Therefore they should always match.")},validate:function(t){return this.sourceBlock_.getFieldValue("MATCH")!=t?null:t}},t.Blocks.test_validators_colour_null={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("always null").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). This means the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_colour_force_red={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("force full red").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("The input will have its red value replaced with full red.")},validate:function(t){return"#ff"+t.substr(3,4)}},t.Blocks.test_validators_colour_red_null={init:function(){const e=new t.FieldColour("#ff0000",this.validate);e.setColours(["#ffffff","#ffdcdc","#ffb4b4","#ff8c8c","#ff6464","#ff3c3c","#ff1414","#00ffff","#00dcdc","#00b4b4","#008c8c","#006464","#003c3c","#001414"]),this.appendDummyInput().appendField("not red -> null").appendField(e,"INPUT"),this.setColour(230),this.setCommentText("If the input does not have full red, the input will validate to null (invalid). Otherwise it will return the input value")},validate:function(t){return"ff"!=t.substr(1,2)?null:t}},t.Blocks.test_validators_dropdown_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). This means the field value should not change.")},validate:function(t){return null}},t.Blocks.test_validators_dropdown_force_1s={init:function(){this.appendDummyInput().appendField("force 1s").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input's value will always change to start with 1.")},validate:function(t){return"1"+t.charAt(1)}},t.Blocks.test_validators_dropdown_1s_null={init:function(){this.appendDummyInput().appendField("not 1s -> null").appendField(new t.FieldDropdown([["1a","1A"],["1b","1B"],["1c","1C"],["2a","2A"],["2b","2B"],["2c","2C"]],this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input does not start with 1, the input will validate to null (invalid). Otherwise it will return the input value.")},validate:function(t){return"1"!=t.charAt(0)?null:t}},t.Blocks.test_validators_number_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("All input validates to null (invalid). The field will display the input while the field is being edited, but the value should be the default value. The input should be red after the first keystroke.")},validate:function(t){return null}},t.Blocks.test_validators_number_mult10_force={init:function(){this.appendDummyInput().appendField("force mult of 10").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("The input value will be rounded to the nearest multiple of 10. The field will display the input while the field is being edited, but the value should be the validated (rounded) value. Note: If you want to do rounding this is not the proper way, use the precision option of the number field constructor instead.")},validate:function(t){return 10*Math.round(t/10)}},t.Blocks.test_validators_number_mult10_null={init:function(){this.appendDummyInput().appendField("not mult of 10 -> null").appendField(new t.FieldNumber(123,null,null,null,this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the input value is not a multiple of 10, the input will validate to null (invalid). The field will display the input while the field is being edited, but if the input value is invalid the value should be the default value.")},validate:function(t){return t%10!=0?null:t}},t.Blocks.test_validators_variable_null={init:function(){this.appendDummyInput().appendField("always null").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("All ids validate to null (invalid). This means the variable should not change.")},validate:function(t){return null}},t.Blocks.test_validators_variable_force_1s={init:function(){this.appendDummyInput().appendField("force 1s").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("The id will always change to start with 1.")},validate:function(t){return"1"+t.charAt(1)}},t.Blocks.test_validators_variable_1s_null={init:function(){this.appendDummyInput().appendField("not 1s -> null").appendField(new t.FieldVariable("1a",this.validate),"INPUT"),this.setColour(230),this.setCommentText("If the id does not start with 1, the id will validate to null (invalid). Otherwise it will return the id.")},validate:function(t){return"1"!=t.charAt(0)?null:t}};const u={kind:"CATEGORY",name:"Fields",expanded:"true",contents:[{kind:"CATEGORY",name:"Defaults",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"set random style",callbackkey:"setRandomStyle"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle enabled",callbackkey:"toggleEnabled"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle shadow",callbackkey:"toggleShadow"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"toggle collapsed",callbackkey:"toggleCollapsed"},{kind:"BLOCK",type:"test_fields_angle"},{kind:"BLOCK",type:"test_fields_checkbox"},{kind:"BLOCK",type:"test_fields_colour"},{kind:"BLOCK",type:"test_fields_colour_options"},{kind:"BLOCK",type:"test_fields_text_input"},{kind:"BLOCK",type:"test_fields_only_text_input"},{kind:"BLOCK",type:"test_fields_multilinetext"},{kind:"BLOCK",type:"test_fields_variable"},{kind:"BUTTON",text:"randomize label text",callbackkey:"randomizeLabelText"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_fields_label_serializable"},{kind:"BUTTON",text:"change image",callbackkey:"changeImage"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_fields_image"}]},{kind:"CATEGORY",name:"Numbers",contents:[{kind:"BLOCK",blockxml:'\n<block type="test_numbers_float">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_hundredths">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_halves">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_whole">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_three_halves">\n <field name="NUM">123.456</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="test_numbers_whole_bounded">\n <field name="NOTE">60</field>\n</block>'}]},{kind:"CATEGORY",name:"Angles",contents:[{kind:"BLOCK",type:"test_angles_clockwise"},{kind:"BLOCK",type:"test_angles_offset"},{kind:"BLOCK",type:"test_angles_wrap"},{kind:"BLOCK",type:"test_angles_round_30"},{kind:"BLOCK",type:"test_angles_round_0"},{kind:"BLOCK",type:"test_angles_protractor"},{kind:"BLOCK",type:"test_angles_compass"}]},{kind:"CATEGORY",name:"Drop-downs",contents:[{kind:"LABEL",text:"Dynamic"},{kind:"BLOCK",type:"test_dropdowns_dynamic"},{kind:"BUTTON",text:"Add option",callbackkey:"addDynamicOption"},{kind:"BUTTON",text:"Remove option",callbackkey:"removeDynamicOption"},{kind:"BLOCK",type:"test_dropdowns_dynamic_random"},{kind:"BLOCK",type:"test_dropdowns_dynamic_connect_dependant"},{kind:"LABEL",text:"Other"},{kind:"BLOCK",type:"test_dropdowns_long"},{kind:"BLOCK",type:"test_dropdowns_images"},{kind:"BLOCK",type:"test_dropdowns_images_and_text"}]},{kind:"CATEGORY",name:"Images",contents:[{kind:"BLOCK",type:"test_images_datauri"},{kind:"BLOCK",type:"test_images_small"},{kind:"BLOCK",type:"test_images_large"},{kind:"BLOCK",type:"test_images_fliprtl"},{kind:"BLOCK",type:"test_images_missing"},{kind:"BLOCK",type:"test_images_many_icons"},{kind:"BLOCK",type:"test_images_clickhandler"}]},{kind:"CATEGORY",name:"Emoji! o((*^ᴗ^*))o",contents:[{kind:"LABEL",text:"Unicode & Emojis"},{kind:"BLOCK",type:"test_style_emoji"},{kind:"BLOCK",blockxml:'\n<block type="text">\n <field name="TEXT">Robot face in text field:🤖</field>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text">\n <field name="TEXT">Zalgo in text field:B̛̻̦̬̘̰͎̥̈̔͊͞ͅl̡͖̫̺̬̖̣̳̃̀́͑͑̕͟͠͝o̢̹͙̮̫͔͋̉̊̑̿̽̚c̸̹̹̜͙̹̠͋̒͑̊̇͝k̡͉̫͇̖̳͖̊͒́̆̄̎̂̔̕͜͞l̰̙̞̳̩̠͖̯̀̆̈́̿̈̓͗y̨̡̟͇̮͈̬̙̲̏̅̀͘͠</field>\n</block>'}]},{kind:"CATEGORY",name:"Validators",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"set input",callbackkey:"setInput"},{kind:"LABEL",text:"Dispose block"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dispose_block"},{kind:"LABEL",text:"Angles"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_mult30_force"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_angle_mult30_null"},{kind:"LABEL",text:"Checkboxes"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_match"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_checkbox_not_match_null"},{kind:"LABEL",text:"Colours"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_force_red"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_colour_red_null"},{kind:"LABEL",text:"Dropdowns"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_force_1s"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_dropdown_1s_null"},{kind:"LABEL",text:"Numbers"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_mult10_force"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_number_mult10_null"},{kind:"LABEL",text:"Text"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_A"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_text_B"},{kind:"LABEL",text:"Variables"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"add test variables",callbackkey:"addVariables","web-class":"modifiesWorkspace"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_null"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_force_1s"},{kind:"SEP",gap:"12"},{kind:"BLOCK",type:"test_validators_variable_1s_null"}]}]};t.defineBlocksWithJsonArray([{type:"test_mutator_colorChange",message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"colour_blocks"}]);const m={mutationToDom:function(){const e=t.utils.xml.createElement("mutation");return e.setAttribute("colour",this.getColour()),e},domToMutation:function(t){this.setColour(t.getAttribute("colour"))},saveExtraState:function(){return{colour:this.getColour()}},loadExtraState:function(t){this.setColour(t.colour)},decompose:function(e){const n=t.serialization.blocks.append({type:"test_mutator_colorChange"},e);return n.getField("COLOUR").setValue(this.getColour()),n},compose:function(t){this.setColour(t.getFieldValue("COLOUR"))}},_=[];for(let t=0;t<20;t++)_.push(`test_mutator_category_${t}`);const h=_.map((t=>({type:t,message0:"colour %1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],style:"colour_blocks"})));t.defineBlocksWithJsonArray([{type:"test_mutators_many",message0:"test many blocks mutator",mutator:"test_many_blocks_mutator",colour:"#000000"},...h]),t.Extensions.registerMutator("test_many_blocks_mutator",m,null,[..._]),t.defineBlocksWithJsonArray([{type:"test_mutators_noflyout",message0:"noflyout mutator",mutator:"test_noflyout_mutator",colour:"#000000"}]),t.Extensions.registerMutator("test_noflyout_mutator",m,null,[]),t.defineBlocksWithJsonArray([{type:"test_mutators_changeableFlyout",message0:"changeable flyout mutator",mutator:"test_changeableFlyout_mutator",colour:"#000000"}]),t.Extensions.registerMutator("test_changeableFlyout_mutator",m,null,["text"]),t.defineBlocksWithJsonArray([{type:"test_style_hat",message0:"Hat block (event)",nextStatement:null,style:"hat_blocks"},{type:"test_style_hex1",message0:"Block color: Bright purple %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#992aff"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#992aff"},{type:"test_style_hex2",message0:"Block color: White %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#fefefe"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#fefefe"},{type:"test_style_hex3",message0:"Block color: Black %1 %2 %3 %4",args0:[{type:"field_input",name:"TEXT",text:"#010101"},{type:"field_dropdown",name:"DROPDOWN",options:[["option","ONE"],["option","TWO"]]},{type:"field_checkbox",name:"NAME",checked:!0},{type:"input_value",name:"NAME"}],previousStatement:null,nextStatement:null,colour:"#010101"},{type:"test_style_no_colour",message0:"Block color: unset"},{type:"test_style_hex4",message0:"Block color: #RRGGBBAA (invalid)",colour:"#992aff99"},{type:"test_style_hex5",message0:"Block color: #RRGGBB (invalid)",colour:"#NotHex"},{type:"test_style_emoji",message0:"Robot Face: 🤖",colour:"#AAAAAA"}]);class k extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}}k.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_no_overrides",k);class y extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}toXml(t){return t.setAttribute("value",this.getValue()),t}fromXml(t){this.setValue(t.getAttribute("value"))}}y.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_xml",y);class g extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}saveState(){return{value:this.getValue()}}loadState(t){this.setValue(t.value)}}g.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_jso",g);class b extends e().FieldLabel{constructor(t,e,n){super(t,e,n),this.EDITABLE=!1,this.SERIALIZABLE=!0}toXml(t){return t.setAttribute("value",this.getValue()),t}fromXml(t){this.setValue(t.getAttribute("value"))}saveState(){return{value:this.getValue()}}loadState(t){this.setValue(t.value)}}b.fromJson=function(t){return new this(e().utils.parsing.replaceMessageReferences(t.text),void 0,t)},e().fieldRegistry.register("field_both",b),e().defineBlocksWithJsonArray([{type:"test_field_serialization_no_overrides",message0:"no overrides: %1",args0:[{type:"field_no_overrides",name:"LABEL",text:"test"}],colour:0,output:null},{type:"test_field_serialization_xml",message0:"xml: %1",args0:[{type:"field_xml",name:"LABEL",text:"test"}],colour:30,output:null},{type:"test_field_serialization_jso",message0:"jso: %1",args0:[{type:"field_jso",name:"LABEL",text:"test"}],colour:90,output:null},{type:"test_field_serialization_both",message0:"both: %1",args0:[{type:"field_both",name:"LABEL",text:"test"}],colour:150,output:null}]),e().Blocks.test_extra_state_xml=Object.assign({},e().Blocks.lists_create_with),delete e().Blocks.test_extra_state_xml.saveExtraState,delete e().Blocks.test_extra_state_xml.loadExtraState,e().Blocks.test_extra_state_xml.init=function(){this.setColour(30),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))},e().Blocks.test_extra_state_jso=Object.assign({},e().Blocks.lists_create_with),delete e().Blocks.test_extra_state_jso.mutationToDom,delete e().Blocks.test_extra_state_jso.domToMutation,e().Blocks.test_extra_state_jso.init=function(){this.setColour(90),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))},e().Blocks.test_extra_state_both=Object.assign({},e().Blocks.lists_create_with),e().Blocks.test_extra_state_both.init=function(){this.setColour(150),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new(e().icons.MutatorIcon)(["lists_create_with_item"],this))};const f={contents:[{kind:"CATEGORY",name:"Align",contents:[{kind:"BLOCK",type:"test_align_dummy_right"},{kind:"BLOCK",type:"test_align_all"},{kind:"BLOCK",type:"test_align_with_external_input"}]},{kind:"CATEGORY",name:"Basic",contents:[{kind:"BLOCK",type:"test_basic_empty"},{kind:"BLOCK",type:"test_basic_empty_with_mutator"},{kind:"BLOCK",type:"test_basic_dummy"},{kind:"BLOCK",type:"test_basic_multiple_dummy"},{kind:"BLOCK",type:"test_basic_stack"},{kind:"BLOCK",type:"test_basic_row"},{kind:"BLOCK",type:"test_basic_value_to_stack"},{kind:"BLOCK",type:"test_basic_value_to_statement"},{kind:"BLOCK",type:"test_basic_limit_instances"},{kind:"BLOCK",type:"test_basic_tooltips"},{kind:"BLOCK",type:"test_basic_javascript"}]},{kind:"CATEGORY",name:"Chameleon",contents:[{kind:"BLOCK",type:"test_chameleon"}]},a,{kind:"CATEGORY",name:"Drag",contents:[{kind:"LABEL",text:"Drag each to the workspace"},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <block type="text">\n <field name="TEXT">Drag me by this child</field>\n </block>\n </value>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Drag me by this shadow</field>\n </shadow>\n </value>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Shadow value</field>\n </shadow>\n </value>\n <next>\n <shadow type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Shadow statement</field>\n </shadow>\n </value>\n </shadow>\n </next>\n</block>'},{kind:"LABEL",text:"Multiple Variable Refs"},{kind:"BLOCK",blockxml:'\n<block type="text_print">\n <value name="TEXT">\n <block type="variables_get">\n <field name="VAR" id="item">item</field>\n </block>\n </value>\n <next>\n <block type="text_print">\n <value name="TEXT">\n <block type="variables_get">\n <field name="VAR" id="item">item</field>\n </block>\n </value>\n </block>\n </next>\n</block>'},{kind:"LABEL",text:"Procedure Definitions"},{kind:"BLOCK",blockxml:'\n<block type="procedures_defnoreturn">\n <field name="NAME">without arguments</field>\n <statement name="STACK">\n <block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">No argument reference.</field>\n </shadow>\n </value>\n </block>\n </statement>\n</block>'},{kind:"BLOCK",blockxml:'\n<block type="procedures_defnoreturn">\n <mutation><arg name="fnArgument"></arg></mutation>\n <field name="NAME">with one argument</field>\n <statement name="STACK">\n <block type="text_print">\n <value name="TEXT">\n <shadow type="text">\n <field name="TEXT">Expected an argument reference here.</field>\n </shadow>\n <block type="variables_get">\n <field name="VAR">fnArgument</field>\n </block>\n </value>\n </block>\n </statement>\n</block>'}]},u,{kind:"CATEGORY",name:"Mutators",contents:[{kind:"LABEL",text:"logic_compare"},{kind:"BLOCK",type:"logic_compare",inputs:{A:{shadow:{type:"math_number",fields:{NUM:10}}},B:{shadow:{type:"math_number",fields:{NUM:10}}}}},{kind:"BLOCK",type:"logic_compare",inputs:{A:{block:{type:"math_number",fields:{NUM:10}}},B:{block:{type:"math_number",fields:{NUM:10}}}}},{kind:"BLOCK",type:"test_mutators_noflyout"},{kind:"BLOCK",type:"test_mutators_many"},{kind:"BLOCK",type:"test_mutators_changeableFlyout"}]},{kind:"CATEGORY",name:"Style",contents:[{kind:"LABEL",text:"Hats"},{kind:"BLOCK",type:"test_style_hat"},{kind:"LABEL",text:"Colour"},{kind:"BLOCK",type:"test_style_hex1"},{kind:"BLOCK",type:"test_style_hex2"},{kind:"BLOCK",type:"test_style_hex3"},{kind:"BLOCK",type:"test_style_no_colour"},{kind:"BLOCK",type:"test_style_hex4"},{kind:"BLOCK",type:"test_style_hex5",gap:"40"},{kind:"BLOCK",type:"test_style_hex5",disabled:"true"}]},{kind:"CATEGORY",name:"Serialization",contents:[{kind:"BUTTON",text:"add blocks to workspace",callbackkey:"addAllBlocksToWorkspace"},{kind:"SEP",gap:"8"},{kind:"BUTTON",text:"randomize text",callbackkey:"randomizeText"},{kind:"BLOCK",type:"test_field_serialization_no_overrides"},{kind:"BLOCK",type:"test_field_serialization_xml"},{kind:"BLOCK",type:"test_field_serialization_jso"},{kind:"BLOCK",type:"test_field_serialization_both"},{kind:"SEP",gap:30},{kind:"BLOCK",blockxml:'<block type="test_extra_state_xml"><mutation items="2"></mutation></block>'},{kind:"BLOCK",type:"test_extra_state_jso",extraState:{itemCount:2}},{kind:"BLOCK",type:"test_extra_state_both",extraState:{itemCount:2}},{kind:"SEP",gap:30},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_no_overrides"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_xml"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_jso"}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_field_serialization_both"}}}},{kind:"SEP",gap:30},{kind:"BLOCK",blockxml:'<block type="text_print"><value name="TEXT"><shadow type="test_extra_state_xml"><mutation items="2"></mutation></shadow></value></block>'},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_extra_state_jso",extraState:{itemCount:2}}}}},{kind:"BLOCK",type:"text_print",inputs:{TEXT:{shadow:{type:"test_extra_state_both",extraState:{itemCount:2}}}}}]}]};function x(e){(function(t){!function(t){t.registerButtonCallback("insertConnectionRows",n)}(t),function(t){t.registerButtonCallback("insertConnectionStacks",s)}(t),function(t){t.registerButtonCallback("insertConnectionStatements",i)}(t)})(e),function(e){!function(t){t.registerButtonCallback("randomizeLabelText",(function(t){const e=t.getTargetWorkspace().getBlocksByType("test_fields_label_serializable");for(let t,n=0;t=e[n];n++){let e="";for(let t=0;t<4;t++)e+="AB".charAt(Math.floor(Math.random()*"AB".length));t.setFieldValue(e,"LABEL")}})),t.registerButtonCallback("setRandomStyle",(function(e){const n=e.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1),o=Object.keys(t.getRenderer().getConstants().blockStyles);o.splice(o.indexOf(n[0].getStyleName()),1);const l=o[Math.floor(Math.random()*o.length)];for(let t,e=0;t=n[e];e++)t.setStyle(l)})),t.registerButtonCallback("toggleEnabled",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setEnabled(!t.isEnabled())})),t.registerButtonCallback("toggleShadow",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setShadow(!t.isShadow())})),t.registerButtonCallback("toggleCollapsed",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getAllBlocks(!1);for(let t,n=0;t=e[n];n++)t.setCollapsed(!t.isCollapsed())})),t.registerButtonCallback("changeImage",(function(t){const e=t.getTargetWorkspace().getFlyout().getWorkspace().getBlocksByType("test_fields_image"),n="abcdefghijklm",o="https://blockly-demo.appspot.com/static/tests/media/"+n.charAt(Math.floor(Math.random()*n.length))+".png";for(let t,n=0;t=e[n];n++)t.getField("IMAGE").setValue(o)}))}(e),function(t){t.registerButtonCallback("addDynamicOption",d),t.registerButtonCallback("removeDynamicOption",p)}(e),function(e){e.registerButtonCallback("addVariables",(function(t){e.createVariable("1b","","1B"),e.createVariable("1c","","1C"),e.createVariable("2a","","2A"),e.createVariable("2b","","2B"),e.createVariable("2c","","2C")})),e.registerButtonCallback("setInput",(function(e){t.prompt("Input text to set.","ab",(function(t){const n=e.getTargetWorkspace().getAllBlocks(!1);for(let e,o=0;e=n[o];o++)e.getField("INPUT")&&e.setFieldValue(t,"INPUT")}))}))}(e)}(e),function(t){t.registerButtonCallback("randomizeText",(function(t){const e=t.getTargetWorkspace(),n=[...e.getBlocksByType("test_field_serialization_no_overrides"),...e.getBlocksByType("test_field_serialization_xml"),...e.getBlocksByType("test_field_serialization_jso"),...e.getBlocksByType("test_field_serialization_both")],o="ABCDEF";for(let t,e=0;t=n[e];e++){let e="";for(let t=0;t<4;t++)e+=o.charAt(Math.floor(Math.random()*o.length));t.setFieldValue(e,"LABEL")}}))}(e),e.registerButtonCallback("addAllBlocksToWorkspace",(function(e){const n=e.getTargetWorkspace(),o=n.getFlyout().getWorkspace().getTopBlocks();for(let e,l=0;e=o[l];l++){const o=t.serialization.blocks.save(e,{addCoordinates:!0});t.serialization.blocks.append(o,n)}}))}})(),l})()));
//# sourceMappingURL=index.js.map

@@ -12,1 +12,7 @@ /**

*/
/**
* @license
* Copyright 2024 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
{
"name": "@blockly/block-test",
"version": "5.0.4",
"version": "5.1.0",
"description": "A group of Blockly test blocks.",

@@ -55,3 +55,3 @@ "scripts": {

},
"gitHead": "89dbf0c0eeba25828bac038e40e0ecddc081dcc3"
"gitHead": "7954a8fff50e41fa7c0f891e957bf9ed616361d6"
}

@@ -18,2 +18,6 @@ /**

import {
category as chameleonCategory,
onInit as initChameleon,
} from './chameleon';
import {
category as connectionsCategory,

@@ -38,2 +42,3 @@ onInit as initConnections,

basicCategory,
chameleonCategory,
connectionsCategory,

@@ -55,2 +60,3 @@ dragCategory,

initBasic(workspace);
initChameleon(workspace);
initConnections(workspace);

@@ -57,0 +63,0 @@ initDrag(workspace);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc