text: export class BlockWriter{static initConstants(){this.COMPONENT_EVENT="component_event",this.COMPONENT_METHOD="component_method",this.COMPONENT_SET_GET="component_set_get",this.GLOBAL_DECLARATION="global_declaration",this.LOGIC_FALSE="logic_false",this.LOGIC_TRUE="logic_true",this.COMPONENT_COMPONENT_BLOCK="component_component_block"}static writeBlock(t){switch(BlockWriter.initConstants(),t.getAttribute("type")){case this.COMPONENT_EVENT:return this.writeComponentEvent(t);case this.COMPONENT_SET_GET:return this.writeComponentSetGet(t);case this.COMPONENT_METHOD:return this.writeComponentMethod(t);case this.GLOBAL_DECLARATION:return this.writeGlobalDeclaration(t);case this.LOGIC_FALSE:case this.LOGIC_TRUE:return this.writeLogic(t);case this.COMPONENT_COMPONENT_BLOCK:return this.writeComponentComponentBlock(t)}}static validGlobalBlock(t){switch(t.getAttribute("type")){case this.COMPONENT_EVENT:case this.GLOBAL_DECLARATION:return!0}return!1}static next(t){var e=t.children[t.children.length-1],n="";return"next"==e.tagName&&(n+=this.writeBlock(e.children[0])),n}static writeComponentEvent(t){return'<span class="block--event">when '+t.children[0].getAttribute("instance_name")+"."+t.children[0].getAttribute("event_name")+" do:</span>"+this.writeBlock(t.children[2].children[0])}static writeComponentSetGet(t){var e='<span class="block--set-get">'+t.children[0].getAttribute("instance_name")+"."+t.children[0].getAttribute("property_name");return"set"==t.children[0].getAttribute("set_or_get")&&(e+=" = "+this.writeBlock(t.children[3].children[0])),e+="</span>",e+=this.next(t)}static writeComponentMethod(t){var e='<span class="block--method">'+t.children[0].getAttribute("instance_name")+"."+t.children[0].getAttribute("method_name")+"(",n=!1;for(let i of t.children)"value"==i.tagName&&(e+=this.writeBlock(i.children[0])+", ",n=!0);return n&&(e=e.replace(/.$/,"")),e+=")</span>"+this.next(t)}static writeGlobalDeclaration(t){return'<span class="block--global">'+t.children[0].innerHTML+" = "+this.writeBlock(t.children[1].children[0])+"</span>"}static writeLogic(t){return'<span class="block--logic">'+t.children[0].innerHTML.toLowerCase()+"</span>"}static writeComponentComponentBlock(t){return'<span class="block--component">'+t.children[0].getAttribute("instance_name")+"</span>"}}