UNPKG

stimulsoft-dashboards-js-angular

Version:

Stimulsoft Dashboards.JS is a dashboards tool for Angular

7 lines 770 kB
/* Stimulsoft.Reports.JS Version: 2025.4.1 Build date: 2025.10.06 License: https://www.stimulsoft.com/en/licensing/reports */ import{Stimulsoft}from"./stimulsoft.designer.mjs";(t=>{var e,o;o=e=t.ExternalLibrary||(t.ExternalLibrary={})})(Stimulsoft),((t,e)=>{t.Blockly=e(),Stimulsoft.ExternalLibrary.Blockly=t.Blockly})(this||window,function(){var T={connectionTypes:{INPUT_VALUE:1,OUTPUT_VALUE:2,NEXT_STATEMENT:3,PREVIOUS_STATEMENT:4}},t,e;function o(t){return-1!=e.indexOf(t.toUpperCase())}return T.spritesBase64="data:image/png;base64,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",T.constants={},T.LINE_MODE_MULTIPLIER=40,T.PAGE_MODE_MULTIPLIER=125,T.DRAG_RADIUS=5,T.FLYOUT_DRAG_RADIUS=10,T.SNAP_RADIUS=28,T.CONNECTING_SNAP_RADIUS=T.SNAP_RADIUS,T.CURRENT_CONNECTION_PREFERENCE=8,T.BUMP_DELAY=250,T.BUMP_RANDOMNESS=10,T.COLLAPSE_CHARS=30,T.LONGPRESS=750,T.SOUND_LIMIT=100,T.DRAG_STACK=!0,T.HSV_SATURATION=.45,T.HSV_VALUE=.65,T.SPRITE={width:96,height:124,url:"sprites.png"},T.constants.ALIGN={LEFT:-1,CENTRE:0,RIGHT:1},T.DRAG_NONE=0,T.DRAG_STICKY=1,T.DRAG_BEGIN=1,T.DRAG_FREE=2,T.OPPOSITE_TYPE=[],T.OPPOSITE_TYPE[T.connectionTypes.INPUT_VALUE]=T.connectionTypes.OUTPUT_VALUE,T.OPPOSITE_TYPE[T.connectionTypes.OUTPUT_VALUE]=T.connectionTypes.INPUT_VALUE,T.OPPOSITE_TYPE[T.connectionTypes.NEXT_STATEMENT]=T.connectionTypes.PREVIOUS_STATEMENT,T.OPPOSITE_TYPE[T.connectionTypes.PREVIOUS_STATEMENT]=T.connectionTypes.NEXT_STATEMENT,T.DELETE_AREA_NONE=null,T.DELETE_AREA_TRASH=1,T.DELETE_AREA_TOOLBOX=2,T.VARIABLE_CATEGORY_NAME="VARIABLE",T.VARIABLE_DYNAMIC_CATEGORY_NAME="VARIABLE_DYNAMIC",T.PROCEDURE_CATEGORY_NAME="PROCEDURE",T.RENAME_VARIABLE_ID="RENAME_VARIABLE_ID",T.DELETE_VARIABLE_ID="DELETE_VARIABLE_ID",T.constants.COLLAPSED_INPUT_NAME="_TEMP_COLLAPSED_INPUT",T.constants.COLLAPSED_FIELD_NAME="_TEMP_COLLAPSED_FIELD",T.utils={},T.utils.global=function(){return"object"==typeof self?self:"object"==typeof window?window:"object"==typeof global?global:this}(),T.Msg={},T.utils.global.Blockly||(T.utils.global.Blockly={}),T.utils.global.Blockly.Msg||(T.utils.global.Blockly.Msg=T.Msg),T.utils.colour={},T.utils.colour.parse=function(t){t=String(t).toLowerCase().trim();var e=T.utils.colour.names[t];if(e)return e;if(e="#"==(e="0x"==t.substring(0,2)?"#"+t.substring(2):t)[0]?e:"#"+e,/^#[0-9a-f]{6}$/.test(e))return e;if(/^#[0-9a-f]{3}$/.test(e))return["#",e[1],e[1],e[2],e[2],e[3],e[3]].join("");var o=t.match(/^(?:rgb)?\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/);return o&&(t=Number(o[1]),e=Number(o[2]),o=Number(o[3]),0<=t)&&t<256&&0<=e&&e<256&&0<=o&&o<256?T.utils.colour.rgbToHex(t,e,o):null},T.utils.colour.rgbToHex=function(t,e,o){return e=t<<16|e<<8|o,t<16?"#"+(16777216|e).toString(16).substr(1):"#"+e.toString(16)},T.utils.colour.hexToRgb=function(t){if(!(t=T.utils.colour.parse(t)))return[0,0,0];return[(t=parseInt(t.substr(1),16))>>16,t>>8&255,255&t]},T.utils.colour.hsvToHex=function(t,e,o){var i=0,s=0,n=0;if(0==e)n=s=i=o;else{var r=Math.floor(t/60),l=t/60-r,a=(t=o*(1-e),o*(1-e*l));switch(e=o*(1-e*(1-l)),r){case 1:i=a,s=o,n=t;break;case 2:i=t,s=o,n=e;break;case 3:i=t,s=a,n=o;break;case 4:i=e,s=t,n=o;break;case 5:i=o,s=t,n=a;break;case 6:case 0:i=o,s=e,n=t}}return T.utils.colour.rgbToHex(Math.floor(i),Math.floor(s),Math.floor(n))},T.utils.colour.blend=function(t,e,o){if(!(t=T.utils.colour.parse(t)))return null;if(!(e=T.utils.colour.parse(e)))return null;return t=T.utils.colour.hexToRgb(t),e=T.utils.colour.hexToRgb(e),T.utils.colour.rgbToHex(Math.round(e[0]+o*(t[0]-e[0])),Math.round(e[1]+o*(t[1]-e[1])),Math.round(e[2]+o*(t[2]-e[2])))},T.utils.colour.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00"},T.utils.Coordinate=function(t,e){this.x=t,this.y=e},T.utils.Coordinate.equals=function(t,e){return t==e||!(!t||!e)&&t.x==e.x&&t.y==e.y},T.utils.Coordinate.distance=function(t,e){var o=t.x-e.x;return t=t.y-e.y,Math.sqrt(o*o+t*t)},T.utils.Coordinate.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},T.utils.Coordinate.difference=function(t,e){return new T.utils.Coordinate(t.x-e.x,t.y-e.y)},T.utils.Coordinate.sum=function(t,e){return new T.utils.Coordinate(t.x+e.x,t.y+e.y)},T.utils.Coordinate.prototype.scale=function(t){return this.x*=t,this.y*=t,this},T.utils.Coordinate.prototype.translate=function(t,e){return this.x+=t,this.y+=e,this},T.utils.Rect=function(t,e,o,i){this.top=t,this.bottom=e,this.left=o,this.right=i},T.utils.Rect.prototype.contains=function(t,e){return t>=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},T.utils.Rect.prototype.intersects=function(t){return!(this.left>t.right||this.right<t.left||this.top>t.bottom||this.bottom<t.top)},T.utils.string={},T.utils.string.startsWith=function(t,e){return 0==t.lastIndexOf(e,0)},T.utils.string.shortestStringLength=function(t){return t.length?t.reduce(function(t,e){return t.length<e.length?t:e}).length:0},T.utils.string.commonWordPrefix=function(t,e){if(!t.length)return 0;if(1==t.length)return t[0].length;var o=0;e=e||T.utils.string.shortestStringLength(t);for(var i=0;i<e;i++){for(var s=t[0][i],n=1;n<t.length;n++)if(s!=t[n][i])return o;" "==s&&(o=i+1)}for(n=1;n<t.length;n++)if((s=t[n][i])&&" "!=s)return o;return e},T.utils.string.commonWordSuffix=function(t,e){if(!t.length)return 0;if(1==t.length)return t[0].length;var o=0;e=e||T.utils.string.shortestStringLength(t);for(var i=0;i<e;i++){for(var s=t[0].substr(-i-1,1),n=1;n<t.length;n++)if(s!=t[n].substr(-i-1,1))return o;" "==s&&(o=i+1)}for(n=1;n<t.length;n++)if((s=t[n].charAt(t[n].length-i-1))&&" "!=s)return o;return e},T.utils.string.wrap=function(t,e){t=t.split("\n");for(var o=0;o<t.length;o++)t[o]=T.utils.string.wrapLine_(t[o],e);return t.join("\n")},T.utils.string.wrapLine_=function(t,e){if(t.length<=e)return t;for(var o=t.trim().split(/\s+/),i=0;i<o.length;i++)o[i].length>e&&(e=o[i].length);i=-(1/0);var s=1;do{for(var n=i,r=t,l=(t=[],o.length/s),a=1,i=0;i<o.length-1;i++)a<(i+1.5)/l?(a++,t[i]=!0):t[i]=!1;t=T.utils.string.wrapMutate_(o,t,e),i=T.utils.string.wrapScore_(o,t,e),t=T.utils.string.wrapToText_(o,t),s++}while(n<i);return r},T.utils.string.wrapScore_=function(t,e,o){for(var i=[0],s=[],n=0;n<t.length;n++)i[i.length-1]+=t[n].length,!0===e[n]?(i.push(0),s.push(t[n].charAt(t[n].length-1))):!1===e[n]&&i[i.length-1]++;for(t=Math.max.apply(Math,i),n=e=0;n<i.length;n++)e=(e-=2*Math.pow(Math.abs(o-i[n]),1.5))-Math.pow(t-i[n],1.5),-1!=".?!".indexOf(s[n])?e+=o/3:-1!=",;)]}".indexOf(s[n])&&(e+=o/4);return 1<i.length&&i[i.length-1]<=i[i.length-2]&&(e+=.5),e},T.utils.string.wrapMutate_=function(t,e,o){for(var i=T.utils.string.wrapScore_(t,e,o),s,n=0,r,l;n<e.length-1;n++){e[n]!=e[n+1]&&((r=[].concat(e))[n]=!r[n],r[n+1]=!r[n+1],i<(l=T.utils.string.wrapScore_(t,r,o)))&&(i=l,s=r)}return s?T.utils.string.wrapMutate_(t,s,o):e},T.utils.string.wrapToText_=function(t,e){for(var o=[],i=0;i<t.length;i++)o.push(t[i]),void 0!==e[i]&&o.push(e[i]?"\n":" ");return o.join("")},T.utils.Size=function(t,e){this.width=t,this.height=e},T.utils.Size.equals=function(t,e){return t==e||!(!t||!e)&&t.width==e.width&&t.height==e.height},T.utils.style={},T.utils.style.getSize=function(t){if("none"!=T.utils.style.getStyle_(t,"display"))return T.utils.style.getSizeWithDisplay_(t);var e=t.style,o=e.display,i=e.visibility,s=e.position,n=(e.visibility="hidden",e.position="absolute",e.display="inline",t.offsetWidth);return t=t.offsetHeight,e.display=o,e.position=s,e.visibility=i,new T.utils.Size(n,t)},T.utils.style.getSizeWithDisplay_=function(t){return new T.utils.Size(t.offsetWidth,t.offsetHeight)},T.utils.style.getStyle_=function(t,e){return T.utils.style.getComputedStyle(t,e)||T.utils.style.getCascadedStyle(t,e)||t.style&&t.style[e]},T.utils.style.getComputedStyle=function(t,e){return document.defaultView&&document.defaultView.getComputedStyle&&(t=document.defaultView.getComputedStyle(t,null))&&(t[e]||t.getPropertyValue(e))||""},T.utils.style.getCascadedStyle=function(t,e){return t.currentStyle?t.currentStyle[e]:null},T.utils.style.getPageOffset=function(t){var e=new T.utils.Coordinate(0,0),o=(t=t.getBoundingClientRect(),document.documentElement),o=new T.utils.Coordinate(window.pageXOffset||o.scrollLeft,window.pageYOffset||o.scrollTop);return e.x=t.left+o.x,e.y=t.top+o.y,e},T.utils.style.getViewportPageOffset=function(){var t=document.body,e=document.documentElement;return new T.utils.Coordinate(t.scrollLeft||e.scrollLeft,t.scrollTop||e.scrollTop)},T.utils.style.setElementShown=function(t,e){t.style.display=e?"":"none"},T.utils.style.isRightToLeft=function(t){return"rtl"==T.utils.style.getStyle_(t,"direction")},T.utils.style.getBorderBox=function(t){var e=T.utils.style.getComputedStyle(t,"borderLeftWidth"),o=T.utils.style.getComputedStyle(t,"borderRightWidth"),i=T.utils.style.getComputedStyle(t,"borderTopWidth");return t=T.utils.style.getComputedStyle(t,"borderBottomWidth"),{top:parseFloat(i),right:parseFloat(o),bottom:parseFloat(t),left:parseFloat(e)}},T.utils.style.scrollIntoContainerView=function(t,e,o){t=T.utils.style.getContainerOffsetToScrollInto(t,e,o),e.scrollLeft=t.x,e.scrollTop=t.y},T.utils.style.getContainerOffsetToScrollInto=function(t,e,o){var i=T.utils.style.getPageOffset(t),s=T.utils.style.getPageOffset(e),n=T.utils.style.getBorderBox(e),r=i.x-s.x-n.left,i=i.y-s.y-n.top,s=T.utils.style.getSizeWithDisplay_(t);return t=e.clientWidth-s.width,s=e.clientHeight-s.height,n=e.scrollLeft,e=e.scrollTop,o?(n+=r-t/2,e+=i-s/2):(n+=Math.min(r,Math.max(r-t,0)),e+=Math.min(i,Math.max(i-s,0))),new T.utils.Coordinate(n,e)},T.utils.userAgent={},t=T.utils.global.navigator&&T.utils.global.navigator.userAgent||"",T.utils.userAgent.raw=t,e=T.utils.userAgent.raw.toUpperCase(),T.utils.userAgent.IE=o("Trident")||o("MSIE"),T.utils.userAgent.EDGE=o("Edge"),T.utils.userAgent.JAVA_FX=o("JavaFX"),T.utils.userAgent.CHROME=(o("Chrome")||o("CriOS"))&&!T.utils.userAgent.EDGE,T.utils.userAgent.WEBKIT=o("WebKit")&&!T.utils.userAgent.EDGE,T.utils.userAgent.GECKO=o("Gecko")&&!T.utils.userAgent.WEBKIT&&!T.utils.userAgent.IE&&!T.utils.userAgent.EDGE,T.utils.userAgent.ANDROID=o("Android"),T.utils.userAgent.IPAD=o("iPad"),T.utils.userAgent.IPOD=o("iPod"),T.utils.userAgent.IPHONE=o("iPhone")&&!T.utils.userAgent.IPAD&&!T.utils.userAgent.IPOD,T.utils.userAgent.MAC=o("Macintosh"),T.utils.userAgent.TABLET=T.utils.userAgent.IPAD||T.utils.userAgent.ANDROID&&!o("Mobile")||o("Silk"),T.utils.userAgent.MOBILE=!T.utils.userAgent.TABLET&&(T.utils.userAgent.IPOD||T.utils.userAgent.IPHONE||T.utils.userAgent.ANDROID||o("IEMobile")),T.utils.noEvent=function(t){t.preventDefault(),t.stopPropagation()},T.utils.isTargetInput=function(t){return"textarea"==t.target.type||"text"==t.target.type||"number"==t.target.type||"email"==t.target.type||"password"==t.target.type||"search"==t.target.type||"tel"==t.target.type||"url"==t.target.type||t.target.isContentEditable||t.target.dataset&&"true"==t.target.dataset.isTextInput},T.utils.getRelativeXY=function(t){var e=new T.utils.Coordinate(0,0),o=t.getAttribute("x");return o&&(e.x=parseInt(o,10)),(o=t.getAttribute("y"))&&(e.y=parseInt(o,10)),(o=(o=t.getAttribute("transform"))&&o.match(T.utils.getRelativeXY.XY_REGEX_))&&(e.x+=Number(o[1]),o[3])&&(e.y+=Number(o[3])),(t=t.getAttribute("style"))&&-1<t.indexOf("translate")&&(t=t.match(T.utils.getRelativeXY.XY_STYLE_REGEX_))&&(e.x+=Number(t[1]),t[3])&&(e.y+=Number(t[3])),e},T.utils.getInjectionDivXY_=function(t){for(var e=0,o=0;t;){var i=T.utils.getRelativeXY(t);if(e+=i.x,o+=i.y,-1!=(" "+(t.getAttribute("class")||"")+" ").indexOf(" injectionDiv "))break;t=t.parentNode}return new T.utils.Coordinate(e,o)},T.utils.getRelativeXY.XY_REGEX_=/translate\(\s*([-+\d.e]+)([ ,]\s*([-+\d.e]+)\s*)?/,T.utils.getRelativeXY.XY_STYLE_REGEX_=/transform:\s*translate(?:3d)?\(\s*([-+\d.e]+)\s*px([ ,]\s*([-+\d.e]+)\s*px)?/,T.utils.isRightButton=function(t){return!(!t.ctrlKey||!T.utils.userAgent.MAC)||2==t.button},T.utils.mouseToSvg=function(t,e,o){var i=e.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,o=o||e.getScreenCTM().inverse(),i.matrixTransform(o)},T.utils.getScrollDeltaPixels=function(t){switch(t.deltaMode){default:return{x:t.deltaX,y:t.deltaY};case 1:return{x:t.deltaX*T.LINE_MODE_MULTIPLIER,y:t.deltaY*T.LINE_MODE_MULTIPLIER};case 2:return{x:t.deltaX*T.PAGE_MODE_MULTIPLIER,y:t.deltaY*T.PAGE_MODE_MULTIPLIER}}},T.utils.tokenizeInterpolation=function(t){return T.utils.tokenizeInterpolation_(t,!0)},T.utils.replaceMessageReferences=function(t){if("string"!=typeof t)return t;return(t=T.utils.tokenizeInterpolation_(t,!1)).length?String(t[0]):""},T.utils.checkMessageReferences=function(t){for(var e=!0,o=T.Msg,i=t.match(/%{BKY_[A-Z]\w*}/gi),s=0,n;s<i.length;s++){null==o[i[s].toUpperCase().slice(6,-1)]&&(console.warn("No message string for "+i[s]+" in "+t),e=!1)}return e},T.utils.tokenizeInterpolation_=function(t,e){var o=[],i=t.split(""),s=(i.push(""),0);t=[];for(var n=null,r=0;r<i.length;r++){var l=i[r];0==s?"%"==l?((l=t.join(""))&&o.push(l),t.length=0,s=1):t.push(l):1==s?"%"==l?(t.push(l),s=0):e&&"0"<=l&&l<="9"?(s=2,n=l,(l=t.join(""))&&o.push(l),t.length=0):s="{"==l?3:(t.push("%",l),0):2==s?"0"<=l&&l<="9"?n+=l:(o.push(parseInt(n,10)),r--,s=0):3==s&&(""==l?(t.splice(0,0,"%{"),r--,s=0):"}"!=l?t.push(l):(s=t.join(""),/[A-Z]\w*/i.test(s)&&(l=s.toUpperCase(),l=T.utils.string.startsWith(l,"BKY_")?l.substring(4):null)&&l in T.Msg?"string"==typeof(s=T.Msg[l])?Array.prototype.push.apply(o,T.utils.tokenizeInterpolation_(s,e)):o.push(e?String(s):s):o.push("%{"+s+"}"),s=t.length=0))}for((l=t.join(""))&&o.push(l),e=[],r=t.length=0;r<o.length;++r)("string"==typeof o[r]?t:((l=t.join(""))&&e.push(l),t.length=0,e)).push(o[r]);return(l=t.join(""))&&e.push(l),t.length=0,e},T.utils.genUid=function(){for(var t=T.utils.genUid.soup_.length,e=[],o=0;o<20;o++)e[o]=T.utils.genUid.soup_.charAt(Math.random()*t);return e.join("")},T.utils.genUid.soup_="!#$%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",T.utils.is3dSupported=function(){if(void 0!==T.utils.is3dSupported.cached_)return T.utils.is3dSupported.cached_;if(!T.utils.global.getComputedStyle)return!1;var t=document.createElement("p"),e="none",o={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"},i;for(i in document.body.insertBefore(t,null),o)if(void 0!==t.style[i]){if(t.style[i]="translate3d(1px,1px,1px)",!(e=T.utils.global.getComputedStyle(t)))return document.body.removeChild(t),!1;e=e.getPropertyValue(o[i])}return document.body.removeChild(t),T.utils.is3dSupported.cached_="none"!==e,T.utils.is3dSupported.cached_},T.utils.runAfterPageLoad=function(t){if("object"!=typeof document)throw Error("Blockly.utils.runAfterPageLoad() requires browser document.");var e=setInterval(function(){clearInterval(e),t()},10)},T.utils.getViewportBBox=function(){var t=T.utils.style.getViewportPageOffset();return new T.utils.Rect(t.y,document.documentElement.clientHeight+t.y,t.x,document.documentElement.clientWidth+t.x)},T.utils.arrayRemove=function(t,e){if(-1==(e=t.indexOf(e)))return!1;return t.splice(e,1),!0},T.utils.getDocumentScroll=function(){var t=document.documentElement,e=window;return T.utils.userAgent.IE&&e.pageYOffset!=t.scrollTop?new T.utils.Coordinate(t.scrollLeft,t.scrollTop):new T.utils.Coordinate(e.pageXOffset||t.scrollLeft,e.pageYOffset||t.scrollTop)},T.utils.getBlockTypeCounts=function(t,e){var o=Object.create(null),i=t.getDescendants(!0);for(e&&(t=t.getNextBlock())&&(t=i.indexOf(t),i.splice(t,i.length-t)),t=0;e=i[t];t++)o[e.type]?o[e.type]++:o[e.type]=1;return o},T.utils.screenToWsCoordinates=function(t,e){var o=e.x,i=(e=e.y,t.getInjectionDiv().getBoundingClientRect()),o=new T.utils.Coordinate(o-i.left,e-i.top);return e=t.getOriginOffsetInPixels(),T.utils.Coordinate.difference(o,e).scale(1/t.scale)},T.utils.parseBlockColour=function(t){var e="string"==typeof t?T.utils.replaceMessageReferences(t):t,o=Number(e);if(!isNaN(o)&&0<=o&&o<=360)return{hue:o,hex:T.utils.colour.hsvToHex(o,T.HSV_SATURATION,255*T.HSV_VALUE)};if(o=T.utils.colour.parse(e))return{hue:null,hex:o};throw o='Invalid colour: "'+e+'"',t!=e&&(o+=' (from "'+t+'")'),Error(o)},T.Touch={},T.Touch.TOUCH_ENABLED="ontouchstart"in T.utils.global||!!(T.utils.global.document&&document.documentElement&&"ontouchstart"in document.documentElement)||!(!T.utils.global.navigator||!T.utils.global.navigator.maxTouchPoints&&!T.utils.global.navigator.msMaxTouchPoints),T.Touch.touchIdentifier_=null,T.Touch.TOUCH_MAP={},T.utils.global.PointerEvent?T.Touch.TOUCH_MAP={mousedown:["pointerdown"],mouseenter:["pointerenter"],mouseleave:["pointerleave"],mousemove:["pointermove"],mouseout:["pointerout"],mouseover:["pointerover"],mouseup:["pointerup","pointercancel"],touchend:["pointerup"],touchcancel:["pointercancel"]}:T.Touch.TOUCH_ENABLED&&(T.Touch.TOUCH_MAP={mousedown:["touchstart"],mousemove:["touchmove"],mouseup:["touchend","touchcancel"]}),T.longPid_=0,T.longStart=function(t,e){T.longStop_(),t.changedTouches&&1!=t.changedTouches.length||(T.longPid_=setTimeout(function(){t.changedTouches&&(t.button=2,t.clientX=t.changedTouches[0].clientX,t.clientY=t.changedTouches[0].clientY),e&&e.handleRightClick(t)},T.LONGPRESS))},T.longStop_=function(){T.longPid_&&(clearTimeout(T.longPid_),T.longPid_=0)},T.Touch.clearTouchIdentifier=function(){T.Touch.touchIdentifier_=null},T.Touch.shouldHandleEvent=function(t){return!T.Touch.isMouseOrTouchEvent(t)||T.Touch.checkTouchIdentifier(t)},T.Touch.getTouchIdentifierFromEvent=function(t){return null!=t.pointerId?t.pointerId:t.changedTouches&&t.changedTouches[0]&&null!=t.changedTouches[0].identifier?t.changedTouches[0].identifier:"mouse"},T.Touch.checkTouchIdentifier=function(t){var e=T.Touch.getTouchIdentifierFromEvent(t);return null!=T.Touch.touchIdentifier_?T.Touch.touchIdentifier_==e:("mousedown"==t.type||"touchstart"==t.type||"pointerdown"==t.type)&&(T.Touch.touchIdentifier_=e,!0)},T.Touch.setClientFromTouch=function(t){var e;T.utils.string.startsWith(t.type,"touch")&&(e=t.changedTouches[0],t.clientX=e.clientX,t.clientY=e.clientY)},T.Touch.isMouseOrTouchEvent=function(t){return T.utils.string.startsWith(t.type,"touch")||T.utils.string.startsWith(t.type,"mouse")||T.utils.string.startsWith(t.type,"pointer")},T.Touch.isTouchEvent=function(t){return T.utils.string.startsWith(t.type,"touch")||T.utils.string.startsWith(t.type,"pointer")},T.Touch.splitEventByTouches=function(t){var e=[];if(t.changedTouches)for(var o=0;o<t.changedTouches.length;o++)e[o]={type:t.type,changedTouches:[t.changedTouches[o]],target:t.target,stopPropagation:function(){t.stopPropagation()},preventDefault:function(){t.preventDefault()}};else e.push(t);return e},T.browserEvents={},T.browserEvents.conditionalBind=function(t,e,s,n,r,o){var l=!1,i=function(t){var e=!r;t=T.Touch.splitEventByTouches(t);for(var o=0,i;i=t[o];o++)e&&!T.Touch.shouldHandleEvent(i)||(T.Touch.setClientFromTouch(i),s?n.call(s,i):n(i),l=!0)},a=[];if(T.utils.global.PointerEvent&&e in T.Touch.TOUCH_MAP)for(var c=0,h;h=T.Touch.TOUCH_MAP[e][c];c++)t.addEventListener(h,i,!1),a.push([t,h,i]);else if(t.addEventListener(e,i,!1),a.push([t,e,i]),e in T.Touch.TOUCH_MAP)for(var u=function(t){var e;i(t),l&&!o&&t.preventDefault()},c=0;h=T.Touch.TOUCH_MAP[e][c];c++)t.addEventListener(h,u,!1),a.push([t,h,u]);return a},T.browserEvents.bind=function(t,e,o,i){var s=function(t){o?i.call(o,t):i(t)},n=[];if(T.utils.global.PointerEvent&&e in T.Touch.TOUCH_MAP)for(var r=0,l;l=T.Touch.TOUCH_MAP[e][r];r++)t.addEventListener(l,s,!1),n.push([t,l,s]);else if(t.addEventListener(e,s,!1),n.push([t,e,s]),e in T.Touch.TOUCH_MAP)for(var a=function(t){var e;t.changedTouches&&1==t.changedTouches.length&&(e=t.changedTouches[0],t.clientX=e.clientX,t.clientY=e.clientY),s(t),t.preventDefault()},r=0;l=T.Touch.TOUCH_MAP[e][r];r++)t.addEventListener(l,a,!1),n.push([t,l,a]);return n},T.browserEvents.unbind=function(t){for(;t.length;){var e=t.pop(),o=e[2];e[0].removeEventListener(e[1],o,!1)}return o},T.registry={},T.registry.typeMap_={},T.registry.DEFAULT="default",T.registry.Type=function(t){this.name_=t},T.registry.Type.prototype.toString=function(){return this.name_},T.registry.Type.CONNECTION_CHECKER=new T.registry.Type("connectionChecker"),T.registry.Type.CURSOR=new T.registry.Type("cursor"),T.registry.Type.EVENT=new T.registry.Type("event"),T.registry.Type.FIELD=new T.registry.Type("field"),T.registry.Type.RENDERER=new T.registry.Type("renderer"),T.registry.Type.TOOLBOX=new T.registry.Type("toolbox"),T.registry.Type.THEME=new T.registry.Type("theme"),T.registry.Type.TOOLBOX_ITEM=new T.registry.Type("toolboxItem"),T.registry.Type.FLYOUTS_VERTICAL_TOOLBOX=new T.registry.Type("flyoutsVerticalToolbox"),T.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX=new T.registry.Type("flyoutsHorizontalToolbox"),T.registry.Type.METRICS_MANAGER=new T.registry.Type("metricsManager"),T.registry.register=function(t,e,o,i){if(!(t instanceof T.registry.Type)&&"string"!=typeof t||""==String(t).trim())throw Error('Invalid type "'+t+'". The type must be a non-empty string or a Blockly.registry.Type.');if(t=String(t).toLowerCase(),"string"!=typeof e||""==e.trim())throw Error('Invalid name "'+e+'". The name must be a non-empty string.');if(e=e.toLowerCase(),!o)throw Error("Can not register a null value");var s,s=(s=T.registry.typeMap_[t])||(T.registry.typeMap_[t]={});if(T.registry.validate_(t,o),!i&&s[e])throw Error('Name "'+e+'" with type "'+t+'" already registered.');s[e]=o},T.registry.validate_=function(t,e){switch(t){case String(T.registry.Type.FIELD):if("function"!=typeof e.fromJson)throw Error('Type "'+t+'" must have a fromJson function')}},T.registry.unregister=function(t,e){t=String(t).toLowerCase(),e=e.toLowerCase();var o=T.registry.typeMap_[t];o&&o[e]?delete T.registry.typeMap_[t][e]:console.warn("Unable to unregister ["+e+"]["+t+"] from the registry.")},T.registry.getItem_=function(t,e,o){t=String(t).toLowerCase(),e=e.toLowerCase();var i=T.registry.typeMap_[t];if(!i||!i[e]){if(e="Unable to find ["+e+"]["+t+"] in the registry.",o)throw Error(e+" You must require or register a "+t+" plugin.");return console.warn(e),null}return i[e]},T.registry.hasItem=function(t,e){return t=String(t).toLowerCase(),e=e.toLowerCase(),!!(t=T.registry.typeMap_[t])&&!!t[e]},T.registry.getClass=function(t,e,o){return T.registry.getItem_(t,e,o)},T.registry.getObject=function(t,e,o){return T.registry.getItem_(t,e,o)},T.registry.getClassFromOptions=function(t,e,o){return"function"==typeof(e=e.plugins[t.toString()]||T.registry.DEFAULT)?e:T.registry.getClass(t,e,o)},T.Events={},T.Events.group_="",T.Events.recordUndo=!0,T.Events.disabled_=0,T.Events.CREATE="create",T.Events.BLOCK_CREATE=T.Events.CREATE,T.Events.DELETE="delete",T.Events.BLOCK_DELETE=T.Events.DELETE,T.Events.CHANGE="change",T.Events.BLOCK_CHANGE=T.Events.CHANGE,T.Events.MOVE="move",T.Events.BLOCK_MOVE=T.Events.MOVE,T.Events.VAR_CREATE="var_create",T.Events.VAR_DELETE="var_delete",T.Events.VAR_RENAME="var_rename",T.Events.UI="ui",T.Events.BLOCK_DRAG="drag",T.Events.SELECTED="selected",T.Events.CLICK="click",T.Events.MARKER_MOVE="marker_move",T.Events.BUBBLE_OPEN="bubble_open",T.Events.TRASHCAN_OPEN="trashcan_open",T.Events.TOOLBOX_ITEM_SELECT="toolbox_item_select",T.Events.THEME_CHANGE="theme_change",T.Events.VIEWPORT_CHANGE="viewport_change",T.Events.COMMENT_CREATE="comment_create",T.Events.COMMENT_DELETE="comment_delete",T.Events.COMMENT_CHANGE="comment_change",T.Events.COMMENT_MOVE="comment_move",T.Events.FINISHED_LOADING="finished_loading",T.Events.BUMP_EVENTS=[T.Events.BLOCK_CREATE,T.Events.BLOCK_MOVE,T.Events.COMMENT_CREATE,T.Events.COMMENT_MOVE],T.Events.FIRE_QUEUE_=[],T.Events.fire=function(t){T.Events.isEnabled()&&(T.Events.FIRE_QUEUE_.length||setTimeout(T.Events.fireNow_,0),T.Events.FIRE_QUEUE_.push(t))},T.Events.fireNow_=function(){for(var t=T.Events.filter(T.Events.FIRE_QUEUE_,!0),e=T.Events.FIRE_QUEUE_.length=0,o,i;o=t[e];e++){o.workspaceId&&(i=T.Workspace.getById(o.workspaceId))&&i.fireChangeListener(o)}},T.Events.filter=function(t,e){t=t.slice(),e||t.reverse();for(var o=[],i=Object.create(null),s=0,n,r,l,a;n=t[s];s++){n.isNull()||(a=(l=i[r=[n.isUiEvent?T.Events.UI:n.type,n.blockId,n.workspaceId].join(" ")])?l.event:null,l?n.type==T.Events.MOVE&&l.index==s-1?(a.newParentId=n.newParentId,a.newInputName=n.newInputName,a.newCoordinate=n.newCoordinate,l.index=s):n.type==T.Events.CHANGE&&n.element==a.element&&n.name==a.name?a.newValue=n.newValue:n.type==T.Events.CLICK&&a.type==T.Events.BUBBLE_OPEN||(i[r]={event:n,index:s},o.push(n)):(i[r]={event:n,index:s},o.push(n)))}for(t=o.filter(function(t){return!t.isNull()}),e||t.reverse(),s=1;n=t[s];s++)n.type==T.Events.CHANGE&&"mutation"==n.element&&t.unshift(t.splice(s,1)[0]);return t},T.Events.clearPendingUndo=function(){for(var t=0,e;e=T.Events.FIRE_QUEUE_[t];t++)e.recordUndo=!1},T.Events.disable=function(){T.Events.disabled_++},T.Events.enable=function(){T.Events.disabled_--},T.Events.isEnabled=function(){return 0==T.Events.disabled_},T.Events.getGroup=function(){return T.Events.group_},T.Events.setGroup=function(t){T.Events.group_="boolean"==typeof t?t?T.utils.genUid():"":t},T.Events.getDescendantIds=function(t){var e=[];t=t.getDescendants(!1);for(var o=0,i;i=t[o];o++)e[o]=i.id;return e},T.Events.fromJson=function(t,e){var o=T.Events.get(t.type);if(!o)throw Error("Unknown event type.");return(o=new o).fromJson(t),o.workspaceId=e.id,o},T.Events.get=function(t){return T.registry.getClass(T.registry.Type.EVENT,t)},T.Events.disableOrphans=function(t){if((t.type==T.Events.MOVE||t.type==T.Events.CREATE)&&t.workspaceId){var e,o=(e=T.Workspace.getById(t.workspaceId)).getBlockById(t.blockId);if(o){t=T.Events.recordUndo;try{T.Events.recordUndo=!1;var i=o.getParent();if(i&&i.isEnabled())for(var s=o.getDescendants(!1),e=0,n;n=s[e];e++)n.setEnabled(!0);else if((o.outputConnection||o.previousConnection)&&!e.isDragging())do{o.setEnabled(!1),o=o.getNextBlock()}while(o)}finally{T.Events.recordUndo=t}}}},T.Events.Abstract=function(){this.isBlank=null,this.workspaceId=void 0,this.group=T.Events.getGroup(),this.recordUndo=T.Events.recordUndo},T.Events.Abstract.prototype.isUiEvent=!1,T.Events.Abstract.prototype.toJson=function(){var t={type:this.type};return this.group&&(t.group=this.group),t},T.Events.Abstract.prototype.fromJson=function(t){this.isBlank=!1,this.group=t.group},T.Events.Abstract.prototype.isNull=function(){return!1},T.Events.Abstract.prototype.run=function(t){},T.Events.Abstract.prototype.getEventWorkspace_=function(){var t;if(!(t=this.workspaceId?T.Workspace.getById(this.workspaceId):t))throw Error("Workspace is null. Event must have been generated from real Blockly events.");return t},T.utils.object={},T.utils.object.inherits=function(t,e){t.superClass_=e.prototype,t.prototype=Object.create(e.prototype),t.prototype.constructor=t},T.utils.object.mixin=function(t,e){for(var o in e)t[o]=e[o]},T.utils.object.deepMerge=function(t,e){for(var o in e)t[o]=null!=e[o]&&"object"==typeof e[o]?T.utils.object.deepMerge(t[o]||Object.create(null),e[o]):e[o];return t},T.utils.object.values=function(e){return Object.values?Object.values(e):Object.keys(e).map(function(t){return e[t]})},T.utils.xml={},T.utils.xml.NAME_SPACE="https://developers.google.com/blockly/xml",T.utils.xml.document=function(){return document},T.utils.xml.createElement=function(t){return T.utils.xml.document().createElementNS(T.utils.xml.NAME_SPACE,t)},T.utils.xml.createTextNode=function(t){return T.utils.xml.document().createTextNode(t)},T.utils.xml.textToDomDocument=function(t){return(new DOMParser).parseFromString(t,"text/xml")},T.utils.xml.domToText=function(t){return(new XMLSerializer).serializeToString(t)},T.inputTypes={VALUE:T.connectionTypes.INPUT_VALUE,STATEMENT:T.connectionTypes.NEXT_STATEMENT,DUMMY:5},T.utils.Svg=function(t){this.tagName_=t},T.utils.Svg.prototype.toString=function(){return this.tagName_},T.utils.Svg.ANIMATE=new T.utils.Svg("animate"),T.utils.Svg.CIRCLE=new T.utils.Svg("circle"),T.utils.Svg.CLIPPATH=new T.utils.Svg("clipPath"),T.utils.Svg.DEFS=new T.utils.Svg("defs"),T.utils.Svg.FECOMPOSITE=new T.utils.Svg("feComposite"),T.utils.Svg.FECOMPONENTTRANSFER=new T.utils.Svg("feComponentTransfer"),T.utils.Svg.FEFLOOD=new T.utils.Svg("feFlood"),T.utils.Svg.FEFUNCA=new T.utils.Svg("feFuncA"),T.utils.Svg.FEGAUSSIANBLUR=new T.utils.Svg("feGaussianBlur"),T.utils.Svg.FEPOINTLIGHT=new T.utils.Svg("fePointLight"),T.utils.Svg.FESPECULARLIGHTING=new T.utils.Svg("feSpecularLighting"),T.utils.Svg.FILTER=new T.utils.Svg("filter"),T.utils.Svg.FOREIGNOBJECT=new T.utils.Svg("foreignObject"),T.utils.Svg.G=new T.utils.Svg("g"),T.utils.Svg.IMAGE=new T.utils.Svg("image"),T.utils.Svg.LINE=new T.utils.Svg("line"),T.utils.Svg.PATH=new T.utils.Svg("path"),T.utils.Svg.PATTERN=new T.utils.Svg("pattern"),T.utils.Svg.POLYGON=new T.utils.Svg("polygon"),T.utils.Svg.RECT=new T.utils.Svg("rect"),T.utils.Svg.SVG=new T.utils.Svg("svg"),T.utils.Svg.TEXT=new T.utils.Svg("text"),T.utils.Svg.TSPAN=new T.utils.Svg("tspan"),T.utils.dom={},T.utils.dom.SVG_NS="http://www.w3.org/2000/svg",T.utils.dom.HTML_NS="http://www.w3.org/1999/xhtml",T.utils.dom.XLINK_NS="http://www.w3.org/1999/xlink",T.utils.dom.NodeType={ELEMENT_NODE:1,TEXT_NODE:3,COMMENT_NODE:8,DOCUMENT_POSITION_CONTAINED_BY:16},T.utils.dom.cacheWidths_=null,T.utils.dom.cacheReference_=0,T.utils.dom.canvasContext_=null,T.utils.dom.createSvgElement=function(t,e,o){for(var i in t=document.createElementNS(T.utils.dom.SVG_NS,String(t)),e)t.setAttribute(i,e[i]);return document.body.runtimeStyle&&(t.runtimeStyle=t.currentStyle=t.style),o&&o.appendChild(t),t},T.utils.dom.addClass=function(t,e){var o=t.getAttribute("class")||"";if(-1!=(" "+o+" ").indexOf(" "+e+" "))return!1;return o&&(o+=" "),t.setAttribute("class",o+e),!0},T.utils.dom.removeClasses=function(t,e){e=e.split(" ");for(var o=0;o<e.length;o++)T.utils.dom.removeClass(t,e[o])},T.utils.dom.removeClass=function(t,e){var o;if(-1==(" "+(o=t.getAttribute("class"))+" ").indexOf(" "+e+" "))return!1;for(var o=o.split(/\s+/),i=0;i<o.length;i++)o[i]&&o[i]!=e||(o.splice(i,1),i--);return o.length?t.setAttribute("class",o.join(" ")):t.removeAttribute("class"),!0},T.utils.dom.hasClass=function(t,e){return-1!=(" "+t.getAttribute("class")+" ").indexOf(" "+e+" ")},T.utils.dom.removeNode=function(t){return t&&t.parentNode?t.parentNode.removeChild(t):null},T.utils.dom.insertAfter=function(t,e){var o=e.nextSibling;if(!(e=e.parentNode))throw Error("Reference node has no parent.");o?e.insertBefore(t,o):e.appendChild(t)},T.utils.dom.containsNode=function(t,e){return!!(t.compareDocumentPosition(e)&T.utils.dom.NodeType.DOCUMENT_POSITION_CONTAINED_BY)},T.utils.dom.setCssTransform=function(t,e){t.style.transform=e,t.style["-webkit-transform"]=e},T.utils.dom.startTextWidthCache=function(){T.utils.dom.cacheReference_++,T.utils.dom.cacheWidths_||(T.utils.dom.cacheWidths_={})},T.utils.dom.stopTextWidthCache=function(){T.utils.dom.cacheReference_--,T.utils.dom.cacheReference_||(T.utils.dom.cacheWidths_=null)},T.utils.dom.getTextWidth=function(e){var t=e.textContent+"\n"+e.className.baseVal,o;if(T.utils.dom.cacheWidths_&&(o=T.utils.dom.cacheWidths_[t]))return o;try{o=T.utils.userAgent.IE||T.utils.userAgent.EDGE?e.getBBox().width:e.getComputedTextLength()}catch(t){return 8*e.textContent.length}return T.utils.dom.cacheWidths_&&(T.utils.dom.cacheWidths_[t]=o),o},T.utils.dom.getFastTextWidth=function(t,e,o,i){return T.utils.dom.getFastTextWidthWithSizeString(t,e+"pt",o,i)},T.utils.dom.getFastTextWidthWithSizeString=function(t,e,o,i){var s=t.textContent,n;if(t=s+"\n"+t.className.baseVal,T.utils.dom.cacheWidths_&&(n=T.utils.dom.cacheWidths_[t]))return n;return T.utils.dom.canvasContext_||((n=document.createElement("canvas")).className="blocklyComputeCanvas",document.body.appendChild(n),T.utils.dom.canvasContext_=n.getContext("2d")),T.utils.dom.canvasContext_.font=o+" "+e+" "+i,n=T.utils.dom.canvasContext_.measureText(s).width,T.utils.dom.cacheWidths_&&(T.utils.dom.cacheWidths_[t]=n),n},T.utils.dom.measureFontMetrics=function(t,e,o,i){var s=document.createElement("span");s.style.font=o+" "+e+" "+i,s.textContent=t,(t=document.createElement("div")).style.width="1px",t.style.height="0px",(e=document.createElement("div")).setAttribute("style","position: fixed; top: 0; left: 0; display: flex;"),e.appendChild(s),e.appendChild(t),document.body.appendChild(e);try{o={},e.style.alignItems="baseline",o.baseline=t.offsetTop-s.offsetTop,e.style.alignItems="flex-end",o.height=t.offsetTop-s.offsetTop}finally{document.body.removeChild(e)}return o},T.Xml={},T.Xml.workspaceToDom=function(t,e){for(var o=T.utils.xml.createElement("xml"),i,s=((i=T.Xml.variablesToDom(T.Variables.allUsedVarModels(t))).hasChildNodes()&&o.appendChild(i),t.getTopComments(!0)),i=0,n;n=s[i];i++)o.appendChild(n.toXmlWithXY(e));for(t=t.getTopBlocks(!0),i=0;s=t[i];i++)o.appendChild(T.Xml.blockToDomWithXY(s,e));return o},T.Xml.variablesToDom=function(t){for(var e=T.utils.xml.createElement("variables"),o=0,i;i=t[o];o++){var s=T.utils.xml.createElement("variable");s.appendChild(T.utils.xml.createTextNode(i.name)),i.type&&s.setAttribute("type",i.type),s.id=i.getId(),e.appendChild(s)}return e},T.Xml.blockToDomWithXY=function(t,e){if(t.isInsertionMarker()&&!(t=t.getChildren(!1)[0]))return new DocumentFragment;var o,i=(t.workspace.RTL&&(o=t.workspace.getWidth()),e=T.Xml.blockToDom(t,e),t.getRelativeToSurfaceXY());return e.setAttribute("x",Math.round(t.workspace.RTL?o-i.x:i.x)),e.setAttribute("y",Math.round(i.y)),e},T.Xml.fieldToDom_=function(t){var e;if(t.isSerializable())return(e=T.utils.xml.createElement("field")).setAttribute("name",t.name||""),t.toXml(e);return null},T.Xml.allFieldsToDom_=function(t,e){for(var o=0,i;i=t.inputList[o];o++)for(var s=0,n;n=i.fieldRow[s];s++)(n=T.Xml.fieldToDom_(n))&&e.appendChild(n)},T.Xml.blockToDom=function(t,e){if(t.isInsertionMarker())return(t=t.getChildren(!1)[0])?T.Xml.blockToDom(t):new DocumentFragment;var o=T.utils.xml.createElement(t.isShadow()?"shadow":"block"),i,s,n,r;for(o.setAttribute("type",t.type),e||o.setAttribute("id",t.id),t.mutationToDom&&(i=t.mutationToDom())&&(i.hasChildNodes()||i.hasAttributes())&&o.appendChild(i),T.Xml.allFieldsToDom_(t,o),(i=t.getCommentText())&&(s=t.commentModel.size,n=t.commentModel.pinned,(r=T.utils.xml.createElement("comment")).appendChild(T.utils.xml.createTextNode(i)),r.setAttribute("pinned",n),r.setAttribute("h",s.height),r.setAttribute("w",s.width),o.appendChild(r)),t.data&&((i=T.utils.xml.createElement("data")).appendChild(T.utils.xml.createTextNode(t.data)),o.appendChild(i)),i=0;s=t.inputList[i];i++){var l,a,n=!0;s.type!=T.inputTypes.DUMMY&&(a=s.connection.targetBlock(),s.type==T.inputTypes.VALUE?l=T.utils.xml.createElement("value"):s.type==T.inputTypes.STATEMENT&&(l=T.utils.xml.createElement("statement")),!(r=s.connection.getShadowDom())||a&&a.isShadow()||l.appendChild(T.Xml.cloneShadow_(r,e)),a&&(r=T.Xml.blockToDom(a,e)).nodeType==T.utils.dom.NodeType.ELEMENT_NODE&&(l.appendChild(r),n=!1),l.setAttribute("name",s.name),n||o.appendChild(l))}return null!=t.inputsInline&&t.inputsInline!=t.inputsInlineDefault&&o.setAttribute("inline",t.inputsInline),t.isCollapsed()&&o.setAttribute("collapsed",!0),t.isEnabled()||o.setAttribute("disabled",!0),t.isDeletable()||t.isShadow()||o.setAttribute("deletable",!1),t.isMovable()||t.isShadow()||o.setAttribute("movable",!1),t.isEditable()||o.setAttribute("editable",!1),(i=t.getNextBlock())&&(r=T.Xml.blockToDom(i,e)).nodeType==T.utils.dom.NodeType.ELEMENT_NODE&&((l=T.utils.xml.createElement("next")).appendChild(r),o.appendChild(l)),!(r=t.nextConnection&&t.nextConnection.getShadowDom())||i&&i.isShadow()||l.appendChild(T.Xml.cloneShadow_(r,e)),o},T.Xml.cloneShadow_=function(t,e){for(var o=t=t.cloneNode(!0),i;o;)if(e&&"shadow"==o.nodeName&&o.removeAttribute("id"),o.firstChild)o=o.firstChild;else{for(;o&&!o.nextSibling;)o=(i=o).parentNode,i.nodeType==T.utils.dom.NodeType.TEXT_NODE&&""==i.data.trim()&&o.firstChild!=i&&T.utils.dom.removeNode(i);o&&(o=(i=o).nextSibling,i.nodeType==T.utils.dom.NodeType.TEXT_NODE)&&""==i.data.trim()&&T.utils.dom.removeNode(i)}return t},T.Xml.domToText=function(t){return T.utils.xml.domToText(t).replace(/<(\w+)([^<]*)\/>/g,"<$1$2></$1>")},T.Xml.domToPrettyText=function(t){t=T.Xml.domToText(t).split("<");for(var e="",o=1;o<t.length;o++){var i=t[o];"/"==i[0]&&(e=e.substring(2)),t[o]=e+"<"+i,"/"!=i[0]&&"/>"!=i.slice(-2)&&(e+=" ")}return(t=(t=t.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1</$2>")).replace(/^\n/,"")},T.Xml.textToDom=function(t){var e=T.utils.xml.textToDomDocument(t);if(!e||!e.documentElement||e.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+t);return e.documentElement},T.Xml.clearWorkspaceAndLoadFromXml=function(t,e){return e.setResizesEnabled(!1),e.clear(),t=T.Xml.domToWorkspace(t,e),e.setResizesEnabled(!0),t},T.Xml.domToWorkspace=function(t,e){var o,i,s=(t instanceof T.Workspace&&(o=t,t=e,e=o,console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")),e.RTL&&(i=e.getWidth()),o=[],T.utils.dom.startTextWidthCache(),T.Events.getGroup()),n=(s||T.Events.setGroup(!0),e.setResizesEnabled&&e.setResizesEnabled(!1),!0);try{for(var r=0,l;l=t.childNodes[r];r++){var a=l.nodeName.toLowerCase(),c=l;if("block"==a||"shadow"==a&&!T.Events.recordUndo){var h=T.Xml.domToBlock(c,e),u=(o.push(h.id),c.hasAttribute("x")?parseInt(c.getAttribute("x"),10):10),g=c.hasAttribute("y")?parseInt(c.getAttribute("y"),10):10;isNaN(u)||isNaN(g)||h.moveBy(e.RTL?i-u:u,g),n=!1}else{if("shadow"==a)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==a)e.rendered?T.WorkspaceCommentSvg?T.WorkspaceCommentSvg.fromXml(c,e,i):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):T.WorkspaceComment?T.WorkspaceComment.fromXml(c,e):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==a){if(!n)throw Error("'variables' tag must exist once before block and shadow tag elements in the workspace XML, but it was found in another location.");T.Xml.domToVariables(c,e),n=!1}}}}finally{s||T.Events.setGroup(!1),T.utils.dom.stopTextWidthCache()}return e.setResizesEnabled&&e.setResizesEnabled(!0),T.Events.fire(new(T.Events.get(T.Events.FINISHED_LOADING))(e)),o},T.Xml.appendDomToWorkspace=function(t,e){var o;if(Object.prototype.hasOwnProperty.call(e,"scale")&&(o=e.getBlocksBoundingBox()),t=T.Xml.domToWorkspace(t,e),o&&o.top!=o.bottom){for(var i=o.bottom,s=e.RTL?o.right:o.left,n=1/0,r=-(1/0),l=1/0,o=0;o<t.length;o++){var a=e.getBlockById(t[o]).getRelativeToSurfaceXY();a.y<l&&(l=a.y),a.x<n&&(n=a.x),r<a.x&&(r=a.x)}for(i=i-l+10,s=e.RTL?s-r:s-n,o=0;o<t.length;o++)e.getBlockById(t[o]).moveBy(s,i)}return t},T.Xml.domToBlock=function(t,e){var o;t instanceof T.Workspace&&(o=t,t=e,e=o,console.warn("Deprecated call to Blockly.Xml.domToBlock, swap the arguments.")),T.Events.disable(),o=e.getAllVariables();try{var i=T.Xml.domToBlockHeadless_(t,e),s=i.getDescendants(!1);if(e.rendered){i.setConnectionTracking(!1);for(var n=s.length-1;0<=n;n--)s[n].initSvg();for(n=s.length-1;0<=n;n--)s[n].render(!1);setTimeout(function(){i.disposed||i.setConnectionTracking(!0)},1),i.updateDisabled(),e.resizeContents()}else for(n=s.length-1;0<=n;n--)s[n].initModel()}finally{T.Events.enable()}if(T.Events.isEnabled()){for(t=T.Variables.getAddedVariables(e,o),n=0;n<t.length;n++)e=t[n],T.Events.fire(new(T.Events.get(T.Events.VAR_CREATE))(e));T.Events.fire(new(T.Events.get(T.Events.CREATE))(i))}return i},T.Xml.domToVariables=function(t,e){for(var o=0,i,s,n;i=t.childNodes[o];o++){i.nodeType==T.utils.dom.NodeType.ELEMENT_NODE&&(s=i.getAttribute("type"),n=i.getAttribute("id"),e.createVariable(i.textContent,s,n))}},T.Xml.mapSupportedXmlTags_=function(t){for(var e={mutation:[],comment:[],data:[],field:[],input:[],next:[]},o=0,i;i=t.childNodes[o];o++)if(i.nodeType!=T.utils.dom.NodeType.TEXT_NODE)switch(i.nodeName.toLowerCase()){case"mutation":e.mutation.push(i);break;case"comment":if(!T.Comment){console.warn("Missing require for Blockly.Comment, ignoring block comment.");break}e.comment.push(i);break;case"data":e.data.push(i);break;case"title":case"field":e.field.push(i);break;case"value":case"statement":e.input.push(i);break;case"next":e.next.push(i);break;default:console.warn("Ignoring unknown tag: "+i.nodeName)}return e},T.Xml.applyMutationTagNodes_=function(t,e){for(var o=!1,i=0,s;s=t[i];i++)e.domToMutation&&(e.domToMutation(s),e.initSvg)&&(o=!0);return o},T.Xml.applyCommentTagNodes_=function(t,e){for(var o=0,i;i=t[o];o++){var s=i.textContent,n="true"==i.getAttribute("pinned"),r=parseInt(i.getAttribute("w"),10),i=parseInt(i.getAttribute("h"),10);e.setCommentText(s),e.commentModel.pinned=n,isNaN(r)||isNaN(i)||(e.commentModel.size=new T.utils.Size(r,i)),n&&e.getCommentIcon&&!e.isInFlyout&&setTimeout(function(){e.getCommentIcon().setVisible(!0)},1)}},T.Xml.applyDataTagNodes_=function(t,e){for(var o=0,i;i=t[o];o++)e.data=i.textContent},T.Xml.applyFieldTagNodes_=function(t,e){for(var o=0,i;i=t[o];o++){var s=i.getAttribute("name");T.Xml.domToField_(e,s,i)}},T.Xml.findChildBlocks_=function(t){for(var e={childBlockElement:null,childShadowElement:null},o=0,i;i=t.childNodes[o];o++)i.nodeType==T.utils.dom.NodeType.ELEMENT_NODE&&("block"==i.nodeName.toLowerCase()?e.childBlockElement=i:"shadow"==i.nodeName.toLowerCase()&&(e.childShadowElement=i));return e},T.Xml.applyInputTagNodes_=function(t,e,o,i){for(var s=0,n;n=t[s];s++){var r=n.getAttribute("name"),l=o.getInput(r);if(!l){console.warn("Ignoring non-existent input "+r+" in block "+i);break}if((n=T.Xml.findChildBlocks_(n)).childBlockElement){if(!l.connection)throw TypeError("Input connection does not exist.");T.Xml.domToBlockHeadless_(n.childBlockElement,e,l.connection,!1)}n.childShadowElement&&l.connection.setShadowDom(n.childShadowElement)}},T.Xml.applyNextTagNodes_=function(t,e,o){for(var i=0,s;s=t[i];i++){if((s=T.Xml.findChildBlocks_(s)).childBlockElement){if(!o.nextConnection)throw TypeError("Next statement does not exist.");if(o.nextConnection.isConnected())throw TypeError("Next statement is already connected.");T.Xml.domToBlockHeadless_(s.childBlockElement,e,o.nextConnection,!0)}s.childShadowElement&&o.nextConnection&&o.nextConnection.setShadowDom(s.childShadowElement)}},T.Xml.domToBlockHeadless_=function(t,e,o,i){var s=t.getAttribute("type");if(!s)throw TypeError("Block type unspecified: "+t.outerHTML);var n=t.getAttribute("id"),n=e.newBlock(s,n),r=T.Xml.mapSupportedXmlTags_(t),l=T.Xml.applyMutationTagNodes_(r.mutation,n);if(T.Xml.applyCommentTagNodes_(r.comment,n),T.Xml.applyDataTagNodes_(r.data,n),o)if(i){if(!n.previousConnection)throw TypeError("Next block does not have previous statement.");o.connect(n.previousConnection)}else if(n.outputConnection)o.connect(n.outputConnection);else{if(!n.previousConnection)throw TypeError("Child block does not have output or previous statement.");o.connect(n.previousConnection)}if(T.Xml.applyFieldTagNodes_(r.field,n),T.Xml.applyInputTagNodes_(r.input,e,n,s),T.Xml.applyNextTagNodes_(r.next,e,n),l&&n.initSvg(),(e=t.getAttribute("inline"))&&n.setInputsInline("true"==e),(e=t.getAttribute("disabled"))&&n.setEnabled("true"!=e&&"disabled"!=e),(e=t.getAttribute("deletable"))&&n.setDeletable("true"==e),(e=t.getAttribute("movable"))&&n.setMovable("true"==e),(e=t.getAttribute("editable"))&&n.setEditable("true"==e),(e=t.getAttribute("collapsed"))&&n.setCollapsed("true"==e),"shadow"==t.nodeName.toLowerCase()){for(t=n.getChildren(!1),e=0;o=t[e];e++)if(!o.isShadow())throw TypeError("Shadow block not allowed non-shadow child.");if(n.getVarModels().length)throw TypeError("Shadow blocks cannot have variable references.");n.setShadow(!0)}return n},T.Xml.domToField_=function(t,e,o){var i=t.getField(e);i?i.fromXml(o):console.warn("Ignoring non-existent field "+e+" in block "+t.type)},T.Xml.deleteNext=function(t){for(var e=0,o;o=t.childNodes[e];e++)if("next"==o.nodeName.toLowerCase()){t.removeChild(o);break}},T.Events.BlockBase=function(t){T.Events.BlockBase.superClass_.constructor.call(this),this.blockId=(this.isBlank=void 0===t)?"":t.id,this.workspaceId=this.isBlank?"":t.workspace.id},T.utils.object.inherits(T.Events.BlockBase,T.Events.Abstract),T.Events.BlockBase.prototype.toJson=function(){var t=T.Events.BlockBase.superClass_.toJson.call(this);return t.blockId=this.blockId,t},T.Events.BlockBase.prototype.fromJson=function(t){T.Events.BlockBase.superClass_.fromJson.call(this,t),this.blockId=t.blockId},T.Events.Change=function(t,e,o,i,s){T.Events.Change.superClass_.constructor.call(this,t),t&&(this.element=void 0===e?"":e,this.name=void 0===o?"":o,this.oldValue=void 0===i?"":i,this.newValue=void 0===s?"":s)},T.utils.object.inherits(T.Events.Change,T.Events.BlockBase),T.Events.BlockChange=T.Events.Change,T.Events.Change.prototype.type=T.Events.CHANGE,T.Events.Change.prototype.toJson=function(){var t=T.Events.Change.superClass_.toJson.call(this);return t.element=this.element,this.name&&(t.name=this.name),t.oldValue=this.oldValue,t.newValue=this.newValue,t},T.Events.Change.prototype.fromJson=function(t){T.Events.Change.superClass_.fromJson.call(this,t),this.element=t.element,this.name=t.name,this.oldValue=t.oldValue,this.newValue=t.newValue},T.Events.Change.prototype.isNull=function(){return this.oldValue==this.newValue},T.Events.Change.prototype.run=function(t){var e=this.getEventWorkspace_().getBlockById(this.blockId);if(e)switch(e.mutator&&e.mutator.setVisible(!1),t=t?this.newValue:this.oldValue,this.element){case"field":(e=e.getField(this.name))?e.setValue(t):console.warn("Can't set non-existent field: "+this.name);break;case"comment":e.setCommentText(t||null);break;case"collapsed":e.setCollapsed(!!t);break;case"disabled":e.setEnabled(!t);break;case"inline":e.setInputsInline(!!t);break;case"mutation":var o="",i;e.mutationToDom&&(o=(o=e.mutationToDom())&&T.Xml.domToText(o)),e.domToMutation&&(i=T.Xml.textToDom(t||"<mutation/>"),e.domToMutation(i)),T.Events.fire(new(T.Events.get(T.Events.CHANGE))(e,"mutation",null,o,t));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.blockId)},T.Events.Create=function(t){T.Events.Create.superClass_.constructor.call(this,t),t&&(t.isShadow()&&(this.recordUndo=!1),this.xml=t.workspace.rendered?T.Xml.blockToDomWithXY(t):T.Xml.blockToDom(t),this.ids=T.Events.getDescendantIds(t))},T.utils.object.inherits(T.Events.Create,T.Events.BlockBase),T.Events.BlockCreate=T.Events.Create,T.Eve