webpackJsonp([0],{"++K3":function(t,e){var n,r,i,o,s,a,l,u,c,h,d,p,f,g,m,v=!1;function b(){if(!v){v=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),b=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if(p=/\b(iPhone|iP[ao]d)/.exec(t),f=/\b(iP[ao]d)/.exec(t),h=/Android/i.exec(t),g=/FBAN\/\w+;/i.exec(t),m=/Mobile/i.exec(t),d=!!/Win64/.exec(t),e){(n=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN)&&document&&document.documentMode&&(n=document.documentMode);var _=/(?:Trident\/(\d+.\d+))/.exec(t);a=_?parseFloat(_[1])+4:n,r=e[2]?parseFloat(e[2]):NaN,i=e[3]?parseFloat(e[3]):NaN,(o=e[4]?parseFloat(e[4]):NaN)?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),s=e&&e[1]?parseFloat(e[1]):NaN):s=NaN}else n=r=i=s=o=NaN;if(b){if(b[1]){var y=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);l=!y||parseFloat(y[1].replace("_","."))}else l=!1;u=!!b[2],c=!!b[3]}else l=u=c=!1}}var _={ie:function(){return b()||n},ieCompatibilityMode:function(){return b()||a>n},ie64:function(){return _.ie()&&d},firefox:function(){return b()||r},opera:function(){return b()||i},webkit:function(){return b()||o},safari:function(){return _.webkit()},chrome:function(){return b()||s},windows:function(){return b()||u},osx:function(){return b()||l},linux:function(){return b()||c},iphone:function(){return b()||p},mobile:function(){return b()||p||f||h||m},nativeApp:function(){return b()||g},android:function(){return b()||h},ipad:function(){return b()||f}};t.exports=_},"+E39":function(t,e,n){t.exports=!n("S82l")(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},"+ZMJ":function(t,e,n){var r=n("lOnJ");t.exports=function(t,e,n){if(r(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}}},"+gIa":function(t,e,n){"use strict"; /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * ============================================================================= */ var r,i;n.d(e,"a",function(){return r}),function(t){t[t.DT_INVALID=0]="DT_INVALID",t[t.DT_FLOAT=1]="DT_FLOAT",t[t.DT_DOUBLE=2]="DT_DOUBLE",t[t.DT_INT32=3]="DT_INT32",t[t.DT_UINT8=4]="DT_UINT8",t[t.DT_INT16=5]="DT_INT16",t[t.DT_INT8=6]="DT_INT8",t[t.DT_STRING=7]="DT_STRING",t[t.DT_COMPLEX64=8]="DT_COMPLEX64",t[t.DT_INT64=9]="DT_INT64",t[t.DT_BOOL=10]="DT_BOOL",t[t.DT_QINT8=11]="DT_QINT8",t[t.DT_QUINT8=12]="DT_QUINT8",t[t.DT_QINT32=13]="DT_QINT32",t[t.DT_BFLOAT16=14]="DT_BFLOAT16",t[t.DT_QINT16=15]="DT_QINT16",t[t.DT_QUINT16=16]="DT_QUINT16",t[t.DT_UINT16=17]="DT_UINT16",t[t.DT_COMPLEX128=18]="DT_COMPLEX128",t[t.DT_HALF=19]="DT_HALF",t[t.DT_RESOURCE=20]="DT_RESOURCE",t[t.DT_VARIANT=21]="DT_VARIANT",t[t.DT_UINT32=22]="DT_UINT32",t[t.DT_UINT64=23]="DT_UINT64",t[t.DT_FLOAT_REF=101]="DT_FLOAT_REF",t[t.DT_DOUBLE_REF=102]="DT_DOUBLE_REF",t[t.DT_INT32_REF=103]="DT_INT32_REF",t[t.DT_UINT8_REF=104]="DT_UINT8_REF",t[t.DT_INT16_REF=105]="DT_INT16_REF",t[t.DT_INT8_REF=106]="DT_INT8_REF",t[t.DT_STRING_REF=107]="DT_STRING_REF",t[t.DT_COMPLEX64_REF=108]="DT_COMPLEX64_REF",t[t.DT_INT64_REF=109]="DT_INT64_REF",t[t.DT_BOOL_REF=110]="DT_BOOL_REF",t[t.DT_QINT8_REF=111]="DT_QINT8_REF",t[t.DT_QUINT8_REF=112]="DT_QUINT8_REF",t[t.DT_QINT32_REF=113]="DT_QINT32_REF",t[t.DT_BFLOAT16_REF=114]="DT_BFLOAT16_REF",t[t.DT_QINT16_REF=115]="DT_QINT16_REF",t[t.DT_QUINT16_REF=116]="DT_QUINT16_REF",t[t.DT_UINT16_REF=117]="DT_UINT16_REF",t[t.DT_COMPLEX128_REF=118]="DT_COMPLEX128_REF",t[t.DT_HALF_REF=119]="DT_HALF_REF",t[t.DT_RESOURCE_REF=120]="DT_RESOURCE_REF",t[t.DT_VARIANT_REF=121]="DT_VARIANT_REF",t[t.DT_UINT32_REF=122]="DT_UINT32_REF",t[t.DT_UINT64_REF=123]="DT_UINT64_REF"}(r||(r={})),function(t){let e;!function(t){t[t.LEGACY=0]="LEGACY",t[t.V1=1]="V1",t[t.V2=2]="V2"}(e=t.CheckpointFormatVersion||(t.CheckpointFormatVersion={}))}(i||(i={}))},"+tPU":function(t,e,n){n("xGkn");for(var r=n("7KvD"),i=n("hJx8"),o=n("/bQp"),s=n("dSzd")("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),l=0;l>>0)+"_",i=0;return function t(r){if(this instanceof t)throw new TypeError("Symbol is not a constructor");return new e(n+(r||"")+"_"+i++,r)}}),o("Symbol.iterator",function(t){if(t)return t;t=Symbol("Symbol.iterator");for(var e="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),o=0;o(e=e||0)&&(e=Math.max(e+r,0));e>2];s=e[(3&s)<<4|a>>4],a=e[(15&a)<<2|l>>6],l=e[63&l],n[o++]=u+s+a+l}switch(u=0,l=r,t.length-i){case 2:l=e[(15&(u=t[i+1]))<<2]||r;case 1:t=t[i],n[o]=e[t>>2]+e[(3&t)<<4|u>>4]+l+r}return n.join("")}function L(t){var e=t.length,n=3*e/4;n%3?n=Math.floor(n):-1!="=.".indexOf(t[e-1])&&(n=-1!="=.".indexOf(t[e-2])?n-2:n-1);var r=new Uint8Array(n),i=0;return function(t,e){function n(e){for(;r>4),64!=s&&(e(o<<4&240|s>>2),64!=a&&e(s<<6&192|a))}}(t,function(t){r[i++]=t}),i!==n?r.subarray(0,i):r}function P(){if(!D){D={};for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),e=["+/=","+/","-_=","-_.","-_"],n=0;5>n;n++){var r=t.concat(e[n].split(""));N[n]=r;for(var i=0;it.i)throw Error("Tried to read past the end of the data "+t.g+" > "+t.i)}function K(t){var e=t.h,n=e[t.g],r=127&n;if(128>n)return t.g+=1,X(t),r;if(r|=(127&(n=e[t.g+1]))<<7,128>n)return t.g+=2,X(t),r;if(r|=(127&(n=e[t.g+2]))<<14,128>n)return t.g+=3,X(t),r;if(r|=(127&(n=e[t.g+3]))<<21,128>n)return t.g+=4,X(t),r;if(n=e[t.g+4],t.g+=5,r|=(15&n)<<28,128>n)return X(t),r;if(128<=e[t.g++]&&128<=e[t.g++]&&128<=e[t.g++]&&128<=e[t.g++]&&128<=e[t.g++])throw H();return X(t),r}G.prototype.reset=function(){this.g=this.j};var Y=[];function q(){this.g=[]}function J(t,e){for(;127>>=7;t.g.push(e)}function Z(t){var e={},n=void 0!==e.W&&e.W;this.l={v:void 0!==e.v&&e.v},this.W=n,e=this.l,Y.length?(n=Y.pop(),e&&(n.v=e.v),t&&z(n,t),t=n):t=new G(t,e),this.g=t,this.j=this.g.g,this.h=this.i=-1}function Q(t){var e=t.g;if(e.g==e.i)return!1;t.j=t.g.g;var n=K(t.g)>>>0;if(e=n>>>3,!(0<=(n&=7)&&5>=n))throw W(n,t.j);if(1>e)throw Error("Invalid field number: "+e+" (at position "+t.j+")");return t.i=e,t.h=n,!0}function tt(t){switch(t.h){case 0:if(0!=t.h)tt(t);else t:{for(var e=(t=t.g).g,n=e+10;e>>0,(t=t.g).g+=e,X(t));break;case 5:(t=t.g).g+=4,X(t);break;case 3:for(e=t.i;;){if(!Q(t))throw Error("Unmatched start-group tag: stream EOF");if(4==t.h){if(t.i!=e)throw Error("Unmatched end-group tag");break}tt(t)}break;default:throw W(t.h,t.j)}}q.prototype.length=function(){return this.g.length},q.prototype.end=function(){var t=this.g;return this.g=[],t},Z.prototype.reset=function(){this.g.reset(),this.j=this.g.g,this.h=this.i=-1};var et=[];function nt(t,e){0!==e.length&&(t.i.push(e),t.h+=e.length)}var rt="function"==typeof Symbol&&"symbol"==typeof Symbol()?Symbol(void 0):void 0;function it(t,e){Object.isFrozen(t)||(rt?t[rt]|=e:void 0!==t.N?t.N|=e:Object.defineProperties(t,{N:{value:e,configurable:!0,writable:!0,enumerable:!1}}))}function ot(t){var e;return null==(e=rt?t[rt]:t.N)?0:e}function st(t){return it(t,1),t}function at(t){return!!Array.isArray(t)&&!!(2&ot(t))}function lt(t){if(!Array.isArray(t))throw Error("cannot mark non-array as immutable");it(t,2)}function ut(t){return null!==t&&"object"==typeof t&&!Array.isArray(t)&&t.constructor===Object}var ct=Object.freeze(st([]));function ht(t){if(at(t.m))throw Error("Cannot mutate an immutable Message")}var dt,pt="undefined"!=typeof Symbol&&void 0!==Symbol.hasInstance;function ft(t){return{value:t,configurable:!1,writable:!1,enumerable:!1}}function gt(t,e,n){return-1===e?null:e>=t.i?t.g?t.g[e]:void 0:void 0!==n&&n&&t.g&&null!=(n=t.g[e])?n:t.m[e+t.h]}function mt(t,e,n,r){r=void 0!==r&&r,ht(t),eet.length&&et.push(t)}}function te(t,e,n){for(var r=n.length,i=1==r%2,o=i?1:0;o>>0)>>31)+1,r=i>>>23&255,i&=8388607,mt(e,n,255==r?i?NaN:1/0*t:0==r?t*Math.pow(2,-149)*i:t*Math.pow(2,r-150)*(i+Math.pow(2,23))),!0},function(t,e,n){if(null!=(e=gt(e,n))){J(t.g,8*n+5),t=t.g;var r=e;0===(r=(n=0>r?1:0)?-r:r)?0<1/r?V=0:(0,V=2147483648):isNaN(r)?(0,V=2147483647):3.4028234663852886e38>>0):1.1754943508222875e-38>r?(r=Math.round(r/Math.pow(2,-149)),0,V=(n<<31|r)>>>0):(e=Math.floor(Math.log(r)/Math.LN2),r*=Math.pow(2,-e),16777216<=(r=Math.round(8388608*r))&&++e,0,V=(n<<31|e+127<<23|8388607&r)>>>0),n=V,t.g.push(n>>>0&255),t.g.push(n>>>8&255),t.g.push(n>>>16&255),t.g.push(n>>>24&255)}}),ie=ne(function(t,e,n){if(0!==t.h)return!1;for(var r=t.g,i=128,o=0,s=t=0;4>s&&128<=i;s++)i=r.h[r.g++],X(r),o|=(127&i)<<7*s;if(128<=i&&(i=r.h[r.g++],X(r),o|=(127&i)<<28,t|=(127&i)>>4),128<=i)for(s=0;5>s&&128<=i;s++)i=r.h[r.g++],X(r),t|=(127&i)<<7*s+3;if(!(128>i))throw H();return r=o>>>0,(t=2147483648&(i=t>>>0))&&(i=~i>>>0,0==(r=1+~r>>>0)&&(i=i+1>>>0)),r=4294967296*i+(r>>>0),mt(e,n,t?-r:r),!0},function(t,e,n){if(null!=(e=gt(e,n))&&null!=e){J(t.g,8*n),t=t.g;var r=e;for(n=0>r,e=(r=Math.abs(r))>>>0,r=Math.floor((r-e)/4294967296),r>>>=0,n&&(r=~r>>>0,4294967295<(e=1+(~e>>>0))&&(e=0,4294967295<++r&&(r=0))),n=V=e,e=r;0>>7|e<<25)>>>0,e>>>=7;t.g.push(n)}}),oe=ne(function(t,e,n){return 0===t.h&&(mt(e,n,K(t.g)),!0)},function(t,e,n){if(null!=(e=gt(e,n))&&null!=e)if(J(t.g,8*n),t=t.g,0<=(n=e))J(t,n);else{for(e=0;9>e;e++)t.g.push(127&n|128),n>>=7;t.g.push(1)}}),se=ne(function(t,e,n){if(2!==t.h)return!1;var r,i=K(t.g)>>>0,o=(t=t.g).g;if(t.g+=i,X(t),t=t.h,R)(r=O)||(r=O=new TextDecoder("utf-8",{fatal:!0})),r=r.decode(t.subarray(o,o+i));else{i=o+i;for(var s,a,l,u=[],c=null;o(s=t[o++])?u.push(s):224>s?o>=i?S():(a=t[o++],194>s||128!=(192&a)?(o--,S()):u.push((31&s)<<6|63&a)):240>s?o>=i-1?S():128!=(192&(a=t[o++]))||224===s&&160>a||237===s&&160<=a||128!=(192&(r=t[o++]))?(o--,S()):u.push((15&s)<<12|(63&a)<<6|63&r):244>=s?o>=i-2?S():128!=(192&(a=t[o++]))||0!=a-144+(s<<28)>>30||128!=(192&(r=t[o++]))||128!=(192&(l=t[o++]))?(o--,S()):(s=(7&s)<<18|(63&a)<<12|(63&r)<<6|63&l,s-=65536,u.push(55296+(s>>10&1023),56320+(1023&s))):S(),8192<=u.length&&(c=k(c,u),u.length=0);r=k(c,u)}return mt(e,n,r),!0},function(t,e,n){if(null!=(e=gt(e,n))){var r=!1;if(r=void 0!==r&&r,A){if(r&&/(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])/.test(e))throw Error("Found an unpaired surrogate");e=(I||(I=new TextEncoder)).encode(e)}else{for(var i=0,o=new Uint8Array(3*e.length),s=0;sa)o[i++]=a;else{if(2048>a)o[i++]=a>>6|192;else{if(55296<=a&&57343>=a){if(56319>=a&&s=l){a=1024*(a-55296)+l-56320+65536,o[i++]=a>>18|240,o[i++]=a>>12&63|128,o[i++]=a>>6&63|128,o[i++]=63&a|128;continue}s--}if(r)throw Error("Found an unpaired surrogate");a=65533}o[i++]=a>>12|224,o[i++]=a>>6&63|128}o[i++]=63&a|128}}e=o.subarray(0,i)}J(t.g,8*n+2),J(t.g,e.length),nt(t,t.g.end()),nt(t,e)}}),ae=ne(function(t,e,n,r,i){if(2!==t.h)return!1;e=yt(e,n,r),n=t.g.i,r=K(t.g)>>>0;var o=t.g.g+r,s=o-n;if(0>=s&&(t.g.i=o,i(e,t),s=o-t.g.g),s)throw Error("Message parsing ended unexpectedly. Expected to read "+r+" bytes, instead read "+(r-s)+" bytes, either the data ended unexpectedly or the message misreported its own length");return t.g.g=o,t.g.i=n,!0},function(t,e,n,r,i){if(null!=(e=_t(e,r,n)))for(r=0;r>>=7,s.h++;o.push(a),s.h++}});function le(){It.apply(this,arguments)}if(f(le,It),pt){var ue={};Object.defineProperties(le,(ue[Symbol.hasInstance]=ft(Object[Symbol.hasInstance]),ue))}function ce(t){le.call(this,t)}function he(){return[1,oe,2,re,3,se,4,se]}function de(t){le.call(this,t,-1,fe)}function pe(){return[1,ae,ce,he]}f(ce,le),f(de,le),de.prototype.addClassification=function(t,e){return yt(this,1,ce,t,e),this};var fe=[1];function ge(t){le.call(this,t)}function me(){return[1,re,2,re,3,re,4,re,5,re]}function ve(t){le.call(this,t,-1,_e)}function be(){return[1,ae,ge,me]}f(ge,le),f(ve,le);var _e=[1];function ye(t){le.call(this,t)}function Te(){return[1,re,2,re,3,re,4,re,5,re,6,ie]}function Ee(t,e,n){if(n=t.createShader(0===n?t.VERTEX_SHADER:t.FRAGMENT_SHADER),t.shaderSource(n,e),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))throw Error("Could not compile WebGL shader.\n\n"+t.getShaderInfoLog(n));return n}function xe(t){return _t(t,ce,1).map(function(t){return{index:Tt(t,1),score:bt(t,2),label:null!=gt(t,3)?Et(t,3):void 0,displayName:null!=gt(t,4)?Et(t,4):void 0}})}function we(t){return{x:bt(t,1),y:bt(t,2),z:bt(t,3),visibility:null!=gt(t,4)?bt(t,4):void 0}}function Ce(t){return t.map(function(t){return _t(Qt(t,ve,be),ge,1).map(we)})}function Se(t,e){this.h=t,this.g=e,this.l=0}function ke(t,e,n){return function(t,e){var n=t.g;if(void 0===t.o){var r=Ee(n,"\n attribute vec2 aVertex;\n attribute vec2 aTex;\n varying vec2 vTex;\n void main(void) {\n gl_Position = vec4(aVertex, 0.0, 1.0);\n vTex = aTex;\n }",0),i=Ee(n,"\n precision mediump float;\n varying vec2 vTex;\n uniform sampler2D sampler0;\n void main(){\n gl_FragColor = texture2D(sampler0, vTex);\n }",1),o=n.createProgram();if(n.attachShader(o,r),n.attachShader(o,i),n.linkProgram(o),!n.getProgramParameter(o,n.LINK_STATUS))throw Error("Could not compile WebGL program.\n\n"+n.getProgramInfoLog(o));r=t.o=o,n.useProgram(r),i=n.getUniformLocation(r,"sampler0"),t.j={K:n.getAttribLocation(r,"aVertex"),J:n.getAttribLocation(r,"aTex"),qa:i},t.u=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,t.u),n.enableVertexAttribArray(t.j.K),n.vertexAttribPointer(t.j.K,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([-1,-1,-1,1,1,1,1,-1]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),t.s=n.createBuffer(),n.bindBuffer(n.ARRAY_BUFFER,t.s),n.enableVertexAttribArray(t.j.J),n.vertexAttribPointer(t.j.J,2,n.FLOAT,!1,0,0),n.bufferData(n.ARRAY_BUFFER,new Float32Array([0,1,0,0,1,0,1,1]),n.STATIC_DRAW),n.bindBuffer(n.ARRAY_BUFFER,null),n.uniform1i(i,0)}r=t.j,n.useProgram(t.o),n.canvas.width=e.width,n.canvas.height=e.height,n.viewport(0,0,e.width,e.height),n.activeTexture(n.TEXTURE0),t.h.bindTexture2d(e.glName),n.enableVertexAttribArray(r.K),n.bindBuffer(n.ARRAY_BUFFER,t.u),n.vertexAttribPointer(r.K,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(r.J),n.bindBuffer(n.ARRAY_BUFFER,t.s),n.vertexAttribPointer(r.J,2,n.FLOAT,!1,0,0),n.bindFramebuffer(n.DRAW_FRAMEBUFFER?n.DRAW_FRAMEBUFFER:n.FRAMEBUFFER,null),n.clearColor(0,0,0,0),n.clear(n.COLOR_BUFFER_BIT),n.colorMask(!0,!0,!0,!0),n.drawArrays(n.TRIANGLE_FAN,0,4),n.disableVertexAttribArray(r.K),n.disableVertexAttribArray(r.J),n.bindBuffer(n.ARRAY_BUFFER,null),t.h.bindTexture2d(0)}(t,e),"function"==typeof t.g.canvas.transferToImageBitmap?Promise.resolve(t.g.canvas.transferToImageBitmap()):n?Promise.resolve(t.g.canvas):"function"==typeof createImageBitmap?createImageBitmap(t.g.canvas):(void 0===t.i&&(t.i=document.createElement("canvas")),new Promise(function(e){t.i.height=t.g.canvas.height,t.i.width=t.g.canvas.width,t.i.getContext("2d",{}).drawImage(t.g.canvas,0,0,t.g.canvas.width,t.g.canvas.height),e(t.i)}))}function Oe(t){this.g=t}f(ye,le);var Ie=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,9,1,7,0,65,0,253,15,26,11]);function Re(t,e){return e+t}function Ae(t,e){window[t]=e}function Ne(t){if(this.g=t,this.listeners={},this.j={},this.H={},this.o={},this.u={},this.I=this.s=this.$=!0,this.D=Promise.resolve(),this.Z="",this.C={},this.locateFile=t&&t.locateFile||Re,"object"==typeof window)var e=window.location.pathname.toString().substring(0,window.location.pathname.toString().lastIndexOf("/"))+"/";else{if("undefined"==typeof location)throw Error("solutions can only be loaded on a web page or in a web worker");e=location.pathname.toString().substring(0,location.pathname.toString().lastIndexOf("/"))+"/"}if(this.aa=e,t.options)for(var n=(e=a(Object.keys(t.options))).next();!n.done;n=e.next()){n=n.value;var r=t.options[n].default;void 0!==r&&(this.j[n]="function"==typeof r?r():r)}}function De(t){var e,n,r,i,o,s,a,u,c,h,d;return E(function(p){switch(p.g){case 1:return t.$?(e=void 0===t.g.files?[]:"function"==typeof t.g.files?t.g.files(t.j):t.g.files,b(p,E(function(t){switch(t.g){case 1:return t.o=2,b(t,WebAssembly.instantiate(Ie),4);case 4:t.g=3,t.o=0;break;case 2:return t.o=0,t.j=null,t.return(!1);case 3:return t.return(!0)}}),2)):p.return();case 2:if(n=p.h,"object"==typeof window)return Ae("createMediapipeSolutionsWasm",{locateFile:t.locateFile}),Ae("createMediapipeSolutionsPackedAssets",{locateFile:t.locateFile}),s=e.filter(function(t){return void 0!==t.data}),a=e.filter(function(t){return void 0===t.data}),u=Promise.all(s.map(function(e){var n=Me(t,e.url);if(void 0!==e.path){var r=e.path;n=n.then(function(e){return t.overrideFile(r,e),Promise.resolve(e)})}return n})),c=Promise.all(a.map(function(e){return void 0===e.simd||e.simd&&n||!e.simd&&!n?function(t){var e=document.createElement("script");return e.setAttribute("src",t),e.setAttribute("crossorigin","anonymous"),new Promise(function(t){e.addEventListener("load",function(){t()},!1),e.addEventListener("error",function(){t()},!1),document.body.appendChild(e)})}(t.locateFile(e.url,t.aa)):Promise.resolve()})).then(function(){var e,n,r;return E(function(i){if(1==i.g)return e=window.createMediapipeSolutionsWasm,n=window.createMediapipeSolutionsPackedAssets,r=t,b(i,e(n),2);r.h=i.h,i.g=0})}),h=E(function(e){return t.g.graph&&t.g.graph.url?e=b(e,Me(t,t.g.graph.url),0):(e.g=0,e=void 0),e}),b(p,Promise.all([c,u,h]),7);if("function"!=typeof importScripts)throw Error("solutions can only be loaded on a web page or in a web worker");return r=e.filter(function(t){return void 0===t.simd||t.simd&&n||!t.simd&&!n}).map(function(e){return t.locateFile(e.url,t.aa)}),importScripts.apply(null,l(r)),i=t,b(p,createMediapipeSolutionsWasm(Module),6);case 6:i.h=p.h,t.l=new OffscreenCanvas(1,1),t.h.canvas=t.l,o=t.h.GL.createContext(t.l,{antialias:!1,alpha:!1,na:"undefined"!=typeof WebGL2RenderingContext?2:1}),t.h.GL.makeContextCurrent(o),p.g=4;break;case 7:if(t.l=document.createElement("canvas"),!(d=t.l.getContext("webgl2",{}))&&!(d=t.l.getContext("webgl",{})))return alert("Failed to create WebGL canvas context when passing video frame."),p.return();t.G=d,t.h.canvas=t.l,t.h.createContext(t.l,!0,!0,{});case 4:t.i=new t.h.SolutionWasm,t.$=!1,p.g=0}})}function Me(t,e){var n,r;return E(function(i){return e in t.H?i.return(t.H[e]):(n=t.locateFile(e,""),r=fetch(n).then(function(t){return t.arrayBuffer()}),t.H[e]=r,i.return(r))})}function Le(t,e,n){var r,i,o,s,l,u,c,h,d,p,f,g,m,v;return E(function(_){switch(_.g){case 1:if(!n)return _.return(e);for(r={},i=0,o=a(Object.keys(n)),s=o.next();!s.done;s=o.next())l=s.value,"string"!=typeof(u=n[l])&&"texture"===u.type&&void 0!==e[u.stream]&&++i;1=0&&(e=t.slice(r),t=t.slice(0,r));var i=t.indexOf("?");return i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),{path:t,query:n,hash:e}}(o.path||""),d=e&&e.path||"/",p=u.path?x(u.path,d,n||o.append):d,f=function(t,e,n){void 0===e&&(e={});var r,i=n||h;try{r=i(t||"")}catch(t){r={}}for(var o in e){var s=e[o];r[o]=Array.isArray(s)?s.map(c):c(s)}return r}(u.query,o.query,r&&r.options.parseQuery),g=o.hash||u.hash;return g&&"#"!==g.charAt(0)&&(g="#"+g),{_normalized:!0,path:p,query:f,hash:g}}var H,G=[String,Object],z=[String,Array],X=function(){},K={name:"RouterLink",props:{to:{type:G,required:!0},tag:{type:String,default:"a"},custom:Boolean,exact:Boolean,exactPath:Boolean,append:Boolean,replace:Boolean,activeClass:String,exactActiveClass:String,ariaCurrentValue:{type:String,default:"page"},event:{type:z,default:"click"}},render:function(t){var e=this,n=this.$router,r=this.$route,o=n.resolve(this.to,r,this.append),s=o.location,a=o.route,l=o.href,u={},c=n.options.linkActiveClass,h=n.options.linkExactActiveClass,d=null==c?"router-link-active":c,g=null==h?"router-link-exact-active":h,m=null==this.activeClass?d:this.activeClass,v=null==this.exactActiveClass?g:this.exactActiveClass,_=a.redirectedFrom?f(null,W(a.redirectedFrom),null,n):a;u[v]=b(r,_,this.exactPath),u[m]=this.exact||this.exactPath?u[v]:function(t,e){return 0===t.path.replace(p,"/").indexOf(e.path.replace(p,"/"))&&(!e.hash||t.hash===e.hash)&&function(t,e){for(var n in e)if(!(n in t))return!1;return!0}(t.query,e.query)}(r,_);var y=u[v]?this.ariaCurrentValue:null,T=function(t){Y(t)&&(e.replace?n.replace(s,X):n.push(s,X))},E={click:Y};Array.isArray(this.event)?this.event.forEach(function(t){E[t]=T}):E[this.event]=T;var x={class:u},w=!this.$scopedSlots.$hasNormal&&this.$scopedSlots.default&&this.$scopedSlots.default({href:l,route:a,navigate:T,isActive:u[m],isExactActive:u[v]});if(w){if(1===w.length)return w[0];if(w.length>1||!w.length)return 0===w.length?t():t("span",{},w)}if("a"===this.tag)x.on=E,x.attrs={href:l,"aria-current":y};else{var C=function t(e){if(e)for(var n,r=0;r-1&&(a.params[d]=n.params[d]);return a.path=V(c.path,a.params),l(c,a,s)}if(a.path){a.params={};for(var p=0;p=t.length?n():t[i]?e(t[i],function(){r(i+1)}):r(i+1)};r(0)}var Tt={redirected:2,aborted:4,cancelled:8,duplicated:16};function Et(t,e){return wt(t,e,Tt.redirected,'Redirected when going from "'+t.fullPath+'" to "'+function(t){if("string"==typeof t)return t;if("path"in t)return t.path;var e={};return Ct.forEach(function(n){n in t&&(e[n]=t[n])}),JSON.stringify(e,null,2)}(e)+'" via a navigation guard.')}function xt(t,e){return wt(t,e,Tt.cancelled,'Navigation cancelled from "'+t.fullPath+'" to "'+e.fullPath+'" with a new navigation.')}function wt(t,e,n,r){var i=new Error(r);return i._isRouter=!0,i.from=t,i.to=e,i.type=n,i}var Ct=["params","query","hash"];function St(t){return Object.prototype.toString.call(t).indexOf("Error")>-1}function kt(t,e){return St(t)&&t._isRouter&&(null==e||t.type===e)}function Ot(t){return function(e,n,r){var i=!1,o=0,s=null;It(t,function(t,e,n,a){if("function"==typeof t&&void 0===t.cid){i=!0,o++;var l,u=Nt(function(e){var i;((i=e).__esModule||At&&"Module"===i[Symbol.toStringTag])&&(e=e.default),t.resolved="function"==typeof e?e:H.extend(e),n.components[a]=e,--o<=0&&r()}),c=Nt(function(t){var e="Failed to resolve async component "+a+": "+t;s||(s=St(t)?t:new Error(e),r(s))});try{l=t(u,c)}catch(t){c(t)}if(l)if("function"==typeof l.then)l.then(u,c);else{var h=l.component;h&&"function"==typeof h.then&&h.then(u,c)}}}),i||r()}}function It(t,e){return Rt(t.map(function(t){return Object.keys(t.components).map(function(n){return e(t.components[n],t.instances[n],t,n)})}))}function Rt(t){return Array.prototype.concat.apply([],t)}var At="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;function Nt(t){var e=!1;return function(){for(var n=[],r=arguments.length;r--;)n[r]=arguments[r];if(!e)return e=!0,t.apply(this,n)}}var Dt=function(t,e){this.router=t,this.base=function(t){if(!t)if(J){var e=document.querySelector("base");t=(t=e&&e.getAttribute("href")||"/").replace(/^https?:\/\/[^\/]+/,"")}else t="/";"/"!==t.charAt(0)&&(t="/"+t);return t.replace(/\/$/,"")}(e),this.current=m,this.pending=null,this.ready=!1,this.readyCbs=[],this.readyErrorCbs=[],this.errorCbs=[],this.listeners=[]};function Mt(t,e,n,r){var i=It(t,function(t,r,i,o){var s=function(t,e){"function"!=typeof t&&(t=H.extend(t));return t.options[e]}(t,e);if(s)return Array.isArray(s)?s.map(function(t){return n(t,r,i,o)}):n(s,r,i,o)});return Rt(r?i.reverse():i)}function Lt(t,e){if(e)return function(){return t.apply(e,arguments)}}Dt.prototype.listen=function(t){this.cb=t},Dt.prototype.onReady=function(t,e){this.ready?t():(this.readyCbs.push(t),e&&this.readyErrorCbs.push(e))},Dt.prototype.onError=function(t){this.errorCbs.push(t)},Dt.prototype.transitionTo=function(t,e,n){var r,i=this;try{r=this.router.match(t,this.current)}catch(t){throw this.errorCbs.forEach(function(e){e(t)}),t}var o=this.current;this.confirmTransition(r,function(){i.updateRoute(r),e&&e(r),i.ensureURL(),i.router.afterHooks.forEach(function(t){t&&t(r,o)}),i.ready||(i.ready=!0,i.readyCbs.forEach(function(t){t(r)}))},function(t){n&&n(t),t&&!i.ready&&(kt(t,Tt.redirected)&&o===m||(i.ready=!0,i.readyErrorCbs.forEach(function(e){e(t)})))})},Dt.prototype.confirmTransition=function(t,e,n){var i=this,o=this.current;this.pending=t;var s,a,l=function(t){!kt(t)&&St(t)&&(i.errorCbs.length?i.errorCbs.forEach(function(e){e(t)}):(r(),console.error(t))),n&&n(t)},u=t.matched.length-1,c=o.matched.length-1;if(b(t,o)&&u===c&&t.matched[u]===o.matched[c])return this.ensureURL(),l(((a=wt(s=o,t,Tt.duplicated,'Avoided redundant navigation to current location: "'+s.fullPath+'".')).name="NavigationDuplicated",a));var h=function(t,e){var n,r=Math.max(t.length,e.length);for(n=0;n0)){var e=this.router,n=e.options.scrollBehavior,r=vt&&n;r&&this.listeners.push(at());var i=function(){var n=t.current,i=Ft(t.base);t.current===m&&i===t._startLocation||t.transitionTo(i,function(t){r&<(e,t,n,!0)})};window.addEventListener("popstate",i),this.listeners.push(function(){window.removeEventListener("popstate",i)})}},e.prototype.go=function(t){window.history.go(t)},e.prototype.push=function(t,e,n){var r=this,i=this.current;this.transitionTo(t,function(t){bt(w(r.base+t.fullPath)),lt(r.router,t,i,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,i=this.current;this.transitionTo(t,function(t){_t(w(r.base+t.fullPath)),lt(r.router,t,i,!1),e&&e(t)},n)},e.prototype.ensureURL=function(t){if(Ft(this.base)!==this.current.fullPath){var e=w(this.base+this.current.fullPath);t?bt(e):_t(e)}},e.prototype.getCurrentLocation=function(){return Ft(this.base)},e}(Dt);function Ft(t){var e=window.location.pathname,n=e.toLowerCase(),r=t.toLowerCase();return!t||n!==r&&0!==n.indexOf(w(r+"/"))||(e=e.slice(t.length)),(e||"/")+window.location.search+window.location.hash}var Bt=function(t){function e(e,n,r){t.call(this,e,n),r&&function(t){var e=Ft(t);if(!/^\/#/.test(e))return window.location.replace(w(t+"/#"+e)),!0}(this.base)||jt()}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.setupListeners=function(){var t=this;if(!(this.listeners.length>0)){var e=this.router.options.scrollBehavior,n=vt&&e;n&&this.listeners.push(at());var r=function(){var e=t.current;jt()&&t.transitionTo($t(),function(r){n&<(t.router,r,e,!0),vt||Wt(r.fullPath)})},i=vt?"popstate":"hashchange";window.addEventListener(i,r),this.listeners.push(function(){window.removeEventListener(i,r)})}},e.prototype.push=function(t,e,n){var r=this,i=this.current;this.transitionTo(t,function(t){Vt(t.fullPath),lt(r.router,t,i,!1),e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this,i=this.current;this.transitionTo(t,function(t){Wt(t.fullPath),lt(r.router,t,i,!1),e&&e(t)},n)},e.prototype.go=function(t){window.history.go(t)},e.prototype.ensureURL=function(t){var e=this.current.fullPath;$t()!==e&&(t?Vt(e):Wt(e))},e.prototype.getCurrentLocation=function(){return $t()},e}(Dt);function jt(){var t=$t();return"/"===t.charAt(0)||(Wt("/"+t),!1)}function $t(){var t=window.location.href,e=t.indexOf("#");return e<0?"":t=t.slice(e+1)}function Ut(t){var e=window.location.href,n=e.indexOf("#");return(n>=0?e.slice(0,n):e)+"#"+t}function Vt(t){vt?bt(Ut(t)):window.location.hash=t}function Wt(t){vt?_t(Ut(t)):window.location.replace(Ut(t))}var Ht=function(t){function e(e,n){t.call(this,e,n),this.stack=[],this.index=-1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.push=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index+1).concat(t),r.index++,e&&e(t)},n)},e.prototype.replace=function(t,e,n){var r=this;this.transitionTo(t,function(t){r.stack=r.stack.slice(0,r.index).concat(t),e&&e(t)},n)},e.prototype.go=function(t){var e=this,n=this.index+t;if(!(n<0||n>=this.stack.length)){var r=this.stack[n];this.confirmTransition(r,function(){var t=e.current;e.index=n,e.updateRoute(r),e.router.afterHooks.forEach(function(e){e&&e(r,t)})},function(t){kt(t,Tt.duplicated)&&(e.index=n)})}},e.prototype.getCurrentLocation=function(){var t=this.stack[this.stack.length-1];return t?t.fullPath:"/"},e.prototype.ensureURL=function(){},e}(Dt),Gt=function(t){void 0===t&&(t={}),this.app=null,this.apps=[],this.options=t,this.beforeHooks=[],this.resolveHooks=[],this.afterHooks=[],this.matcher=Q(t.routes||[],this);var e=t.mode||"hash";switch(this.fallback="history"===e&&!vt&&!1!==t.fallback,this.fallback&&(e="hash"),J||(e="abstract"),this.mode=e,e){case"history":this.history=new Pt(this,t.base);break;case"hash":this.history=new Bt(this,t.base,this.fallback);break;case"abstract":this.history=new Ht(this,t.base);break;default:0}},zt={currentRoute:{configurable:!0}};function Xt(t,e){return t.push(e),function(){var n=t.indexOf(e);n>-1&&t.splice(n,1)}}Gt.prototype.match=function(t,e,n){return this.matcher.match(t,e,n)},zt.currentRoute.get=function(){return this.history&&this.history.current},Gt.prototype.init=function(t){var e=this;if(this.apps.push(t),t.$once("hook:destroyed",function(){var n=e.apps.indexOf(t);n>-1&&e.apps.splice(n,1),e.app===t&&(e.app=e.apps[0]||null),e.app||e.history.teardown()}),!this.app){this.app=t;var n=this.history;if(n instanceof Pt||n instanceof Bt){var r=function(t){n.setupListeners(),function(t){var r=n.current,i=e.options.scrollBehavior;vt&&i&&"fullPath"in t&<(e,t,r,!1)}(t)};n.transitionTo(n.getCurrentLocation(),r,r)}n.listen(function(t){e.apps.forEach(function(e){e._route=t})})}},Gt.prototype.beforeEach=function(t){return Xt(this.beforeHooks,t)},Gt.prototype.beforeResolve=function(t){return Xt(this.resolveHooks,t)},Gt.prototype.afterEach=function(t){return Xt(this.afterHooks,t)},Gt.prototype.onReady=function(t,e){this.history.onReady(t,e)},Gt.prototype.onError=function(t){this.history.onError(t)},Gt.prototype.push=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise(function(e,n){r.history.push(t,e,n)});this.history.push(t,e,n)},Gt.prototype.replace=function(t,e,n){var r=this;if(!e&&!n&&"undefined"!=typeof Promise)return new Promise(function(e,n){r.history.replace(t,e,n)});this.history.replace(t,e,n)},Gt.prototype.go=function(t){this.history.go(t)},Gt.prototype.back=function(){this.go(-1)},Gt.prototype.forward=function(){this.go(1)},Gt.prototype.getMatchedComponents=function(t){var e=t?t.matched?t:this.resolve(t).route:this.currentRoute;return e?[].concat.apply([],e.matched.map(function(t){return Object.keys(t.components).map(function(e){return t.components[e]})})):[]},Gt.prototype.resolve=function(t,e,n){var r=W(t,e=e||this.history.current,n,this),i=this.match(r,e),o=i.redirectedFrom||i.fullPath;return{location:r,route:i,href:function(t,e,n){var r="hash"===n?"#"+e:e;return t?w(t+"/"+r):r}(this.history.base,o,this.mode),normalizedTo:r,resolved:i}},Gt.prototype.getRoutes=function(){return this.matcher.getRoutes()},Gt.prototype.addRoute=function(t,e){this.matcher.addRoute(t,e),this.history.current!==m&&this.history.transitionTo(this.history.getCurrentLocation())},Gt.prototype.addRoutes=function(t){this.matcher.addRoutes(t),this.history.current!==m&&this.history.transitionTo(this.history.getCurrentLocation())},Object.defineProperties(Gt.prototype,zt),Gt.install=q,Gt.version="3.5.2",Gt.isNavigationFailure=kt,Gt.NavigationFailureType=Tt,Gt.START_LOCATION=m,J&&window.Vue&&window.Vue.use(Gt),e.a=Gt},"0+0a":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.json=[{tfOpName:"HashTable",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"HashTableV2",category:"hash_table",inputs:[],attrs:[{tfName:"shared_name",name:"sharedName",type:"string"},{tfName:"use_node_name_sharing",name:"useNodeNameSharing",type:"bool"},{tfName:"key_dtype",name:"keyDType",type:"dtype"},{tfName:"value_dtype",name:"valueDType",type:"dtype"}]},{tfOpName:"LookupTableImport",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableImportV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"values",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFind",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableFindV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"},{start:1,name:"keys",type:"tensor"},{start:2,name:"defaultValue",type:"tensor"}],attrs:[{tfName:"Tin",name:"tIn",type:"dtype",notSupported:!0},{tfName:"Tout",name:"tOut",type:"dtype",notSupported:!0}]},{tfOpName:"LookupTableSize",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]},{tfOpName:"LookupTableSizeV2",category:"hash_table",inputs:[{start:0,name:"tableHandle",type:"tensor"}]}]},"02w1":function(t,e,n){"use strict";e.__esModule=!0,e.removeResizeListener=e.addResizeListener=void 0;var r,i=n("z+gd"),o=(r=i)&&r.__esModule?r:{default:r};var s="undefined"==typeof window,a=function(t){var e=t,n=Array.isArray(e),r=0;for(e=n?e:e[Symbol.iterator]();;){var i;if(n){if(r>=e.length)break;i=e[r++]}else{if((r=e.next()).done)break;i=r.value}var o=i.target.__resizeListeners__||[];o.length&&o.forEach(function(t){t()})}};e.addResizeListener=function(t,e){s||(t.__resizeListeners__||(t.__resizeListeners__=[],t.__ro__=new o.default(a),t.__ro__.observe(t)),t.__resizeListeners__.push(e))},e.removeResizeListener=function(t,e){t&&t.__resizeListeners__&&(t.__resizeListeners__.splice(t.__resizeListeners__.indexOf(e),1),t.__resizeListeners__.length||t.__ro__.disconnect())}},"06OY":function(t,e,n){var r=n("3Eo+")("meta"),i=n("EqjI"),o=n("D2L2"),s=n("evD5").f,a=0,l=Object.isExtensible||function(){return!0},u=!n("S82l")(function(){return l(Object.preventExtensions({}))}),c=function(t){s(t,r,{value:{i:"O"+ ++a,w:{}}})},h=t.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!i(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!o(t,r)){if(!l(t))return"F";if(!e)return"E";c(t)}return t[r].i},getWeak:function(t,e){if(!o(t,r)){if(!l(t))return!0;if(!e)return!1;c(t)}return t[r].w},onFreeze:function(t){return u&&h.NEED&&l(t)&&!o(t,r)&&c(t),t}}},"0FNO":function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("35G1");const a=Object(s.a)({oneHot_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e,n=1,s=0){if(e<2)throw new Error(`Error in oneHot: depth must be >=2, but it is ${e}`);const a={indices:Object(o.a)(t,"indices","oneHot","int32")},l={depth:e,onValue:n,offValue:s};return r.a.runKernel(i._50,a,l)}});e.a=a},"0KS2":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.json=[{tfOpName:"StringNGrams",category:"string",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"dataSplits",type:"tensor"}],attrs:[{tfName:"separator",name:"separator",type:"string"},{tfName:"ngram_widths",name:"nGramWidths",type:"number[]"},{tfName:"left_pad",name:"leftPad",type:"string"},{tfName:"right_pad",name:"rightPad",type:"string"},{tfName:"pad_width",name:"padWidth",type:"number"},{tfName:"preserve_short_sequences",name:"preserveShortSequences",type:"bool"}],outputs:["ngrams","ngrams_splits"]},{tfOpName:"StringSplit",category:"string",inputs:[{start:0,name:"input",type:"tensor"},{start:1,name:"delimiter",type:"tensor"}],attrs:[{tfName:"skip_empty",name:"skipEmpty",type:"bool"}],outputs:["indices","values","shape"]},{tfOpName:"StringToHashBucketFast",category:"string",inputs:[{start:0,name:"input",type:"tensor"}],attrs:[{tfName:"num_buckets",name:"numBuckets",type:"number"}]}]},"0kY3":function(t,e,n){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=102)}({0:function(t,e,n){"use strict";function r(t,e,n,r,i,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):i&&(l=a?function(){i.call(this,this.$root.$options.shadowRoot)}:i),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return r})},10:function(t,e){t.exports=n("HJMx")},102:function(t,e,n){"use strict";n.r(e);var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{class:["el-input-number",t.inputNumberSize?"el-input-number--"+t.inputNumberSize:"",{"is-disabled":t.inputNumberDisabled},{"is-without-controls":!t.controls},{"is-controls-right":t.controlsAtRight}],on:{dragstart:function(t){t.preventDefault()}}},[t.controls?n("span",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.decrease,expression:"decrease"}],staticClass:"el-input-number__decrease",class:{"is-disabled":t.minDisabled},attrs:{role:"button"},on:{keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.decrease(e):null}}},[n("i",{class:"el-icon-"+(t.controlsAtRight?"arrow-down":"minus")})]):t._e(),t.controls?n("span",{directives:[{name:"repeat-click",rawName:"v-repeat-click",value:t.increase,expression:"increase"}],staticClass:"el-input-number__increase",class:{"is-disabled":t.maxDisabled},attrs:{role:"button"},on:{keydown:function(e){return"button"in e||!t._k(e.keyCode,"enter",13,e.key,"Enter")?t.increase(e):null}}},[n("i",{class:"el-icon-"+(t.controlsAtRight?"arrow-up":"plus")})]):t._e(),n("el-input",{ref:"input",attrs:{value:t.displayValue,placeholder:t.placeholder,disabled:t.inputNumberDisabled,size:t.inputNumberSize,max:t.max,min:t.min,name:t.name,label:t.label},on:{blur:t.handleBlur,focus:t.handleFocus,input:t.handleInput,change:t.handleInputChange},nativeOn:{keydown:[function(e){return"button"in e||!t._k(e.keyCode,"up",38,e.key,["Up","ArrowUp"])?(e.preventDefault(),t.increase(e)):null},function(e){return"button"in e||!t._k(e.keyCode,"down",40,e.key,["Down","ArrowDown"])?(e.preventDefault(),t.decrease(e)):null}]}})],1)};r._withStripped=!0;var i=n(10),o=n.n(i),s=n(22),a=n.n(s),l=n(30),u={name:"ElInputNumber",mixins:[a()("input")],inject:{elForm:{default:""},elFormItem:{default:""}},directives:{repeatClick:l.a},components:{ElInput:o.a},props:{step:{type:Number,default:1},stepStrictly:{type:Boolean,default:!1},max:{type:Number,default:1/0},min:{type:Number,default:-1/0},value:{},disabled:Boolean,size:String,controls:{type:Boolean,default:!0},controlsPosition:{type:String,default:""},name:String,label:String,placeholder:String,precision:{type:Number,validator:function(t){return t>=0&&t===parseInt(t,10)}}},data:function(){return{currentValue:0,userInput:null}},watch:{value:{immediate:!0,handler:function(t){var e=void 0===t?t:Number(t);if(void 0!==e){if(isNaN(e))return;if(this.stepStrictly){var n=this.getPrecision(this.step),r=Math.pow(10,n);e=Math.round(e/this.step)*r*this.step/r}void 0!==this.precision&&(e=this.toPrecision(e,this.precision))}e>=this.max&&(e=this.max),e<=this.min&&(e=this.min),this.currentValue=e,this.userInput=null,this.$emit("input",e)}}},computed:{minDisabled:function(){return this._decrease(this.value,this.step)this.max},numPrecision:function(){var t=this.value,e=this.step,n=this.getPrecision,r=this.precision,i=n(e);return void 0!==r?(i>r&&console.warn("[Element Warn][InputNumber]precision should not be less than the decimal places of step"),r):Math.max(n(t),i)},controlsAtRight:function(){return this.controls&&"right"===this.controlsPosition},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},inputNumberSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},inputNumberDisabled:function(){return this.disabled||!!(this.elForm||{}).disabled},displayValue:function(){if(null!==this.userInput)return this.userInput;var t=this.currentValue;if("number"==typeof t){if(this.stepStrictly){var e=this.getPrecision(this.step),n=Math.pow(10,e);t=Math.round(t/this.step)*n*this.step/n}void 0!==this.precision&&(t=t.toFixed(this.precision))}return t}},methods:{toPrecision:function(t,e){return void 0===e&&(e=this.numPrecision),parseFloat(Math.round(t*Math.pow(10,e))/Math.pow(10,e))},getPrecision:function(t){if(void 0===t)return 0;var e=t.toString(),n=e.indexOf("."),r=0;return-1!==n&&(r=e.length-n-1),r},_increase:function(t,e){if("number"!=typeof t&&void 0!==t)return this.currentValue;var n=Math.pow(10,this.numPrecision);return this.toPrecision((n*t+n*e)/n)},_decrease:function(t,e){if("number"!=typeof t&&void 0!==t)return this.currentValue;var n=Math.pow(10,this.numPrecision);return this.toPrecision((n*t-n*e)/n)},increase:function(){if(!this.inputNumberDisabled&&!this.maxDisabled){var t=this.value||0,e=this._increase(t,this.step);this.setCurrentValue(e)}},decrease:function(){if(!this.inputNumberDisabled&&!this.minDisabled){var t=this.value||0,e=this._decrease(t,this.step);this.setCurrentValue(e)}},handleBlur:function(t){this.$emit("blur",t)},handleFocus:function(t){this.$emit("focus",t)},setCurrentValue:function(t){var e=this.currentValue;"number"==typeof t&&void 0!==this.precision&&(t=this.toPrecision(t,this.precision)),t>=this.max&&(t=this.max),t<=this.min&&(t=this.min),e!==t&&(this.userInput=null,this.$emit("input",t),this.$emit("change",t,e),this.currentValue=t)},handleInput:function(t){this.userInput=t},handleInputChange:function(t){var e=""===t?void 0:Number(t);isNaN(e)&&""!==t||this.setCurrentValue(e),this.userInput=null},select:function(){this.$refs.input.select()}},mounted:function(){var t=this.$refs.input.$refs.input;t.setAttribute("role","spinbutton"),t.setAttribute("aria-valuemax",this.max),t.setAttribute("aria-valuemin",this.min),t.setAttribute("aria-valuenow",this.currentValue),t.setAttribute("aria-disabled",this.inputNumberDisabled)},updated:function(){this.$refs&&this.$refs.input&&this.$refs.input.$refs.input.setAttribute("aria-valuenow",this.currentValue)}},c=n(0),h=Object(c.a)(u,r,[],!1,null,null,null);h.options.__file="packages/input-number/src/input-number.vue";var d=h.exports;d.install=function(t){t.component(d.name,d)};e.default=d},2:function(t,e){t.exports=n("2kvA")},22:function(t,e){t.exports=n("1oZe")},30:function(t,e,n){"use strict";var r=n(2);e.a={bind:function(t,e,n){var i=null,o=void 0,s=function(){return n.context[e.expression].apply()},a=function(){Date.now()-o<100&&s(),clearInterval(i),i=null};Object(r.on)(t,"mousedown",function(t){0===t.button&&(o=Date.now(),Object(r.once)(document,"mouseup",a),clearInterval(i),i=setInterval(s,100))})}}}})},"1kS7":function(t,e){e.f=Object.getOwnPropertySymbols},"1oZe":function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t){return{methods:{focus:function(){this.$refs[t].focus()}}}}},"21It":function(t,e,n){"use strict";var r=n("FtD3");t.exports=function(t,e,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?e(r("Request failed with status code "+n.status,n.config,null,n.request,n)):t(n)}},"2KxR":function(t,e){t.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},"2kvA":function(t,e,n){"use strict";e.__esModule=!0,e.isInContainer=e.getScrollContainer=e.isScroll=e.getStyle=e.once=e.off=e.on=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.hasClass=f,e.addClass=function(t,e){if(!t)return;for(var n=t.className,r=(e||"").split(" "),i=0,o=r.length;i-1}var g=e.getStyle=u<9?function(t,e){if(!s){if(!t||!e)return null;"float"===(e=h(e))&&(e="styleFloat");try{switch(e){case"opacity":try{return t.filters.item("alpha").opacity/100}catch(t){return 1}default:return t.style[e]||t.currentStyle?t.currentStyle[e]:null}}catch(n){return t.style[e]}}}:function(t,e){if(!s){if(!t||!e)return null;"float"===(e=h(e))&&(e="cssFloat");try{var n=document.defaultView.getComputedStyle(t,"");return t.style[e]||n?n[e]:null}catch(n){return t.style[e]}}};var m=e.isScroll=function(t,e){if(!s)return g(t,null!==e&&void 0!==e?e?"overflow-y":"overflow-x":"overflow").match(/(scroll|auto)/)};e.getScrollContainer=function(t,e){if(!s){for(var n=t;n;){if([window,document,document.documentElement].includes(n))return window;if(m(n,e))return n;n=n.parentNode}return n}},e.isInContainer=function(t,e){if(s||!t||!e)return!1;var n=t.getBoundingClientRect(),r=void 0;return r=[window,document,document.documentElement,null,void 0].includes(e)?{top:0,right:window.innerWidth,bottom:window.innerHeight,left:0}:e.getBoundingClientRect(),n.topr.top&&n.right>r.left&&n.left{r.a.startScope(n);try{const e=s(...t);return Object(i.isPromise)(e)&&console.error("Cannot return a Promise inside of tidy."),r.a.endScope(e),e}catch(t){throw r.a.endScope(null),t}};return Object.defineProperty(a,"name",{value:n,configurable:!0}),a};var r=n("Kkag"),i=n("XFvI"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ const o="__op"},"3Eo+":function(t,e){var n=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++n+r).toString(36))}},"3IRH":function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},"3fo+":function(t,e,n){t.exports=n("YAhB")},"3fs2":function(t,e,n){var r=n("RY/4"),i=n("dSzd")("iterator"),o=n("/bQp");t.exports=n("FeBl").getIteratorMethod=function(t){if(void 0!=t)return t[i]||t["@@iterator"]||o[r(t)]}},"3goy":function(t,e,n){"use strict"; /** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ var r,i,o,s,a;e.b=u,e.a=function(t){return u(t,"int32")},function(t){t.R0="R0",t.R1="R1",t.R2="R2",t.R3="R3",t.R4="R4",t.R5="R5",t.R6="R6"}(r||(r={})),function(t){t.float32="float32",t.int32="int32",t.bool="int32",t.complex64="complex64"}(i||(i={})),function(t){t.float32="float32",t.int32="int32",t.bool="bool",t.complex64="complex64"}(o||(o={})),function(t){t.float32="float32",t.int32="float32",t.bool="float32",t.complex64="complex64"}(s||(s={})),function(t){t.float32="complex64",t.int32="complex64",t.bool="complex64",t.complex64="complex64"}(a||(a={}));const l={float32:s,int32:i,bool:o,complex64:a};function u(t,e){if("string"===t||"string"===e){if("string"===t&&"string"===e)return"string";throw new Error(`Can not upcast ${t} with ${e}`)}return l[t][e]}},"4Ute":function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("jb1O"),s=n("xMQ1"),a=n("35G1");const l=Object(a.a)({matMul_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e,n=!1,a=!1){let l=Object(s.a)(t,"a","matMul"),u=Object(s.a)(e,"b","matMul");[l,u]=Object(o.c)(l,u);const c={a:l,b:u},h={transposeA:n,transposeB:a};return r.a.runKernel(i.s,c,h)}});e.a=l},"4dK1":function(t,e,n){(function(t){var r;!function(t,i,o){function s(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function a(t,e){var n=new function(t){var e=this,n="";e.next=function(){var t=e.b,n=e.c,r=e.d,i=e.a;return t=t<<25^t>>>7^n,n=n-r|0,r=r<<24^r>>>8^i,i=i-t|0,e.b=t=t<<20^t>>>12^n,e.c=n=n-r|0,e.d=r<<16^n>>>16^i,e.a=i-t|0},e.a=0,e.b=0,e.c=-1640531527,e.d=1367130551,t===Math.floor(t)?(e.a=t/4294967296|0,e.b=0|t):n+=t;for(var r=0;r>>0)/4294967296};return i.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},i.int32=n.next,i.quick=i,r&&("object"==typeof r&&s(r,n),i.state=function(){return s(n,{})}),i}i&&i.exports?i.exports=a:n("LGuY")&&n("nErl")?void 0===(r=function(){return a}.call(e,n,e,i))||(i.exports=r):this.tychei=a}(0,"object"==typeof t&&t,n("LGuY"))}).call(e,n("3IRH")(t))},"4mcu":function(t,e){t.exports=function(){}},"52gC":function(t,e){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},"5PlU":function(t,e,n){var r=n("RY/4"),i=n("dSzd")("iterator"),o=n("/bQp");t.exports=n("FeBl").isIterable=function(t){var e=Object(t);return void 0!==e[i]||"@@iterator"in e||o.hasOwnProperty(r(e))}},"5QVw":function(t,e,n){t.exports={default:n("BwfY"),__esModule:!0}},"5VQ+":function(t,e,n){"use strict";var r=n("cGG2");t.exports=function(t,e){r.forEach(t,function(n,r){r!==e&&r.toUpperCase()===e.toUpperCase()&&(t[e]=n,delete t[r])})}},"6Ppv":function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("35G1");const a=Object(s.a)({leakyRelu_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e=.2){const n={x:Object(o.a)(t,"x","leakyRelu")},s={alpha:e};return r.a.runKernel(i._22,n,s)}});e.a=a},"6Twh":function(t,e,n){"use strict";e.__esModule=!0,e.default=function(){if(o.default.prototype.$isServer)return 0;if(void 0!==s)return s;var t=document.createElement("div");t.className="el-scrollbar__wrap",t.style.visibility="hidden",t.style.width="100px",t.style.position="absolute",t.style.top="-9999px",document.body.appendChild(t);var e=t.offsetWidth;t.style.overflow="scroll";var n=document.createElement("div");n.style.width="100%",t.appendChild(n);var r=n.offsetWidth;return t.parentNode.removeChild(t),s=e-r};var r,i=n("7+uW"),o=(r=i)&&r.__esModule?r:{default:r};var s=void 0},"6kjP":function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("jb1O"),s=n("xMQ1"),a=n("35G1");const l=Object(a.a)({sub_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e){let n=Object(s.a)(t,"a","sub"),a=Object(s.a)(e,"b","sub");[n,a]=Object(o.c)(n,a);const l={a:n,b:a};return r.a.runKernel(i._97,l)}});e.a=l},"7+uW":function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){ /*! * Vue.js v2.6.14 * (c) 2014-2021 Evan You * Released under the MIT License. */ var n=Object.freeze({});function r(t){return void 0===t||null===t}function i(t){return void 0!==t&&null!==t}function o(t){return!0===t}function s(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function a(t){return null!==t&&"object"==typeof t}var l=Object.prototype.toString;function u(t){return"[object Object]"===l.call(t)}function c(t){return"[object RegExp]"===l.call(t)}function h(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function d(t){return i(t)&&"function"==typeof t.then&&"function"==typeof t.catch}function p(t){return null==t?"":Array.isArray(t)||u(t)&&t.toString===l?JSON.stringify(t,null,2):String(t)}function f(t){var e=parseFloat(t);return isNaN(e)?t:e}function g(t,e){for(var n=Object.create(null),r=t.split(","),i=0;i-1)return t.splice(n,1)}}var _=Object.prototype.hasOwnProperty;function y(t,e){return _.call(t,e)}function T(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}var E=/-(\w)/g,x=T(function(t){return t.replace(E,function(t,e){return e?e.toUpperCase():""})}),w=T(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),C=/\B([A-Z])/g,S=T(function(t){return t.replace(C,"-$1").toLowerCase()});var k=Function.prototype.bind?function(t,e){return t.bind(e)}:function(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n};function O(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function I(t,e){for(var n in e)t[n]=e[n];return t}function R(t){for(var e={},n=0;n0,Q=q&&q.indexOf("edge/")>0,tt=(q&&q.indexOf("android"),q&&/iphone|ipad|ipod|ios/.test(q)||"ios"===Y),et=(q&&/chrome\/\d+/.test(q),q&&/phantomjs/.test(q),q&&q.match(/firefox\/(\d+)/)),nt={}.watch,rt=!1;if(X)try{var it={};Object.defineProperty(it,"passive",{get:function(){rt=!0}}),window.addEventListener("test-passive",null,it)}catch(t){}var ot=function(){return void 0===G&&(G=!X&&!K&&void 0!==t&&(t.process&&"server"===t.process.env.VUE_ENV)),G},st=X&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__;function at(t){return"function"==typeof t&&/native code/.test(t.toString())}var lt,ut="undefined"!=typeof Symbol&&at(Symbol)&&"undefined"!=typeof Reflect&&at(Reflect.ownKeys);lt="undefined"!=typeof Set&&at(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var ct=A,ht=0,dt=function(){this.id=ht++,this.subs=[]};dt.prototype.addSub=function(t){this.subs.push(t)},dt.prototype.removeSub=function(t){b(this.subs,t)},dt.prototype.depend=function(){dt.target&&dt.target.addDep(this)},dt.prototype.notify=function(){var t=this.subs.slice();for(var e=0,n=t.length;e-1)if(o&&!y(i,"default"))s=!1;else if(""===s||s===S(t)){var l=Wt(String,i.type);(l<0||a0&&(de((u=t(u,(n||"")+"_"+l))[0])&&de(h)&&(a[c]=_t(h.text+u[0].text),u.shift()),a.push.apply(a,u)):s(u)?de(h)?a[c]=_t(h.text+u):""!==u&&a.push(_t(u)):de(u)&&de(h)?a[c]=_t(h.text+u.text):(o(e._isVList)&&i(u.tag)&&r(u.key)&&i(n)&&(u.key="__vlist"+n+"_"+l+"__"),a.push(u)));return a}(t):void 0}function de(t){return i(t)&&i(t.text)&&!1===t.isComment}function pe(t,e){if(t){for(var n=Object.create(null),r=ut?Reflect.ownKeys(t):Object.keys(t),i=0;i0,s=t?!!t.$stable:!o,a=t&&t.$key;if(t){if(t._normalized)return t._normalized;if(s&&r&&r!==n&&a===r.$key&&!o&&!r.$hasNormal)return r;for(var l in i={},t)t[l]&&"$"!==l[0]&&(i[l]=be(e,l,t[l]))}else i={};for(var u in e)u in i||(i[u]=_e(e,u));return t&&Object.isExtensible(t)&&(t._normalized=i),W(i,"$stable",s),W(i,"$key",a),W(i,"$hasNormal",o),i}function be(t,e,n){var r=function(){var t=arguments.length?n.apply(null,arguments):n({}),e=(t=t&&"object"==typeof t&&!Array.isArray(t)?[t]:he(t))&&t[0];return t&&(!e||1===t.length&&e.isComment&&!me(e))?void 0:t};return n.proxy&&Object.defineProperty(t,e,{get:r,enumerable:!0,configurable:!0}),r}function _e(t,e){return function(){return t[e]}}function ye(t,e){var n,r,o,s,l;if(Array.isArray(t)||"string"==typeof t)for(n=new Array(t.length),r=0,o=t.length;rdocument.createEvent("Event").timeStamp&&(dn=function(){return pn.now()})}function fn(){var t,e;for(hn=dn(),un=!0,on.sort(function(t,e){return t.id-e.id}),cn=0;cncn&&on[n].id>t.id;)n--;on.splice(n+1,0,t)}else on.push(t);ln||(ln=!0,re(fn))}}(this)},mn.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||a(t)||this.deep){var e=this.value;if(this.value=t,this.user){var n='callback for watcher "'+this.expression+'"';Gt(this.cb,this.vm,[t,e],this.vm,n)}else this.cb.call(this.vm,t,e)}}},mn.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},mn.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},mn.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||b(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var vn={enumerable:!0,configurable:!0,get:A,set:A};function bn(t,e,n){vn.get=function(){return this[e][n]},vn.set=function(t){this[e][n]=t},Object.defineProperty(t,n,vn)}function _n(t){t._watchers=[];var e=t.$options;e.props&&function(t,e){var n=t.$options.propsData||{},r=t._props={},i=t.$options._propKeys=[],o=!t.$parent;o||Ct(!1);var s=function(o){i.push(o);var s=jt(o,e,n,t);Ot(r,o,s),o in t||bn(t,"_props",o)};for(var a in e)s(a);Ct(!0)}(t,e.props),e.methods&&function(t,e){t.$options.props;for(var n in e)t[n]="function"!=typeof e[n]?A:k(e[n],t)}(t,e.methods),e.data?function(t){var e=t.$options.data;u(e=t._data="function"==typeof e?function(t,e){ft();try{return t.call(e,e)}catch(t){return Ht(t,e,"data()"),{}}finally{gt()}}(e,t):e||{})||(e={});var n=Object.keys(e),r=t.$options.props,i=(t.$options.methods,n.length);for(;i--;){var o=n[i];0,r&&y(r,o)||V(o)||bn(t,"_data",o)}kt(e,!0)}(t):kt(t._data={},!0),e.computed&&function(t,e){var n=t._computedWatchers=Object.create(null),r=ot();for(var i in e){var o=e[i],s="function"==typeof o?o:o.get;0,r||(n[i]=new mn(t,s||A,A,yn)),i in t||Tn(t,i,o)}}(t,e.computed),e.watch&&e.watch!==nt&&function(t,e){for(var n in e){var r=e[n];if(Array.isArray(r))for(var i=0;i-1:"string"==typeof t?t.split(",").indexOf(e)>-1:!!c(t)&&t.test(e)}function An(t,e){var n=t.cache,r=t.keys,i=t._vnode;for(var o in n){var s=n[o];if(s){var a=s.name;a&&!e(a)&&Nn(n,o,r,i)}}}function Nn(t,e,n,r){var i=t[e];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),t[e]=null,b(n,e)}!function(t){t.prototype._init=function(t){var e=this;e._uid=Cn++,e._isVue=!0,t&&t._isComponent?function(t,e){var n=t.$options=Object.create(t.constructor.options),r=e._parentVnode;n.parent=e.parent,n._parentVnode=r;var i=r.componentOptions;n.propsData=i.propsData,n._parentListeners=i.listeners,n._renderChildren=i.children,n._componentTag=i.tag,e.render&&(n.render=e.render,n.staticRenderFns=e.staticRenderFns)}(e,t):e.$options=Ft(Sn(e.constructor),t||{},e),e._renderProxy=e,e._self=e,function(t){var e=t.$options,n=e.parent;if(n&&!e.abstract){for(;n.$options.abstract&&n.$parent;)n=n.$parent;n.$children.push(t)}t.$parent=n,t.$root=n?n.$root:t,t.$children=[],t.$refs={},t._watcher=null,t._inactive=null,t._directInactive=!1,t._isMounted=!1,t._isDestroyed=!1,t._isBeingDestroyed=!1}(e),function(t){t._events=Object.create(null),t._hasHookEvent=!1;var e=t.$options._parentListeners;e&&Ze(t,e)}(e),function(t){t._vnode=null,t._staticTrees=null;var e=t.$options,r=t.$vnode=e._parentVnode,i=r&&r.context;t.$slots=fe(e._renderChildren,i),t.$scopedSlots=n,t._c=function(e,n,r,i){return He(t,e,n,r,i,!1)},t.$createElement=function(e,n,r,i){return He(t,e,n,r,i,!0)};var o=r&&r.data;Ot(t,"$attrs",o&&o.attrs||n,null,!0),Ot(t,"$listeners",e._parentListeners||n,null,!0)}(e),rn(e,"beforeCreate"),function(t){var e=pe(t.$options.inject,t);e&&(Ct(!1),Object.keys(e).forEach(function(n){Ot(t,n,e[n])}),Ct(!0))}(e),_n(e),function(t){var e=t.$options.provide;e&&(t._provided="function"==typeof e?e.call(t):e)}(e),rn(e,"created"),e.$options.el&&e.$mount(e.$options.el)}}(kn),function(t){var e={get:function(){return this._data}},n={get:function(){return this._props}};Object.defineProperty(t.prototype,"$data",e),Object.defineProperty(t.prototype,"$props",n),t.prototype.$set=It,t.prototype.$delete=Rt,t.prototype.$watch=function(t,e,n){if(u(e))return wn(this,t,e,n);(n=n||{}).user=!0;var r=new mn(this,t,e,n);if(n.immediate){var i='callback for immediate watcher "'+r.expression+'"';ft(),Gt(e,this,[r.value],this,i),gt()}return function(){r.teardown()}}}(kn),function(t){var e=/^hook:/;t.prototype.$on=function(t,n){var r=this;if(Array.isArray(t))for(var i=0,o=t.length;i1?O(n):n;for(var r=O(arguments,1),i='event handler for "'+t+'"',o=0,s=n.length;oparseInt(this.max)&&Nn(t,e[0],e,this._vnode),this.vnodeToCache=null}}},created:function(){this.cache=Object.create(null),this.keys=[]},destroyed:function(){for(var t in this.cache)Nn(this.cache,t,this.keys)},mounted:function(){var t=this;this.cacheVNode(),this.$watch("include",function(e){An(t,function(t){return Rn(e,t)})}),this.$watch("exclude",function(e){An(t,function(t){return!Rn(e,t)})})},updated:function(){this.cacheVNode()},render:function(){var t=this.$slots.default,e=Ke(t),n=e&&e.componentOptions;if(n){var r=In(n),i=this.include,o=this.exclude;if(i&&(!r||!Rn(i,r))||o&&r&&Rn(o,r))return e;var s=this.cache,a=this.keys,l=null==e.key?n.Ctor.cid+(n.tag?"::"+n.tag:""):e.key;s[l]?(e.componentInstance=s[l].componentInstance,b(a,l),a.push(l)):(this.vnodeToCache=e,this.keyToCache=l),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={get:function(){return $}};Object.defineProperty(t,"config",e),t.util={warn:ct,extend:I,mergeOptions:Ft,defineReactive:Ot},t.set=It,t.delete=Rt,t.nextTick=re,t.observable=function(t){return kt(t),t},t.options=Object.create(null),B.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,I(t.options.components,Mn),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=O(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=Ft(this.options,t),this}}(t),On(t),function(t){B.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&u(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(kn),Object.defineProperty(kn.prototype,"$isServer",{get:ot}),Object.defineProperty(kn.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Object.defineProperty(kn,"FunctionalRenderContext",{value:Le}),kn.version="2.6.14";var Ln=g("style,class"),Pn=g("input,textarea,option,select,progress"),Fn=function(t,e,n){return"value"===n&&Pn(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},Bn=g("contenteditable,draggable,spellcheck"),jn=g("events,caret,typing,plaintext-only"),$n=function(t,e){return Gn(e)||"false"===e?"false":"contenteditable"===t&&jn(e)?e:"true"},Un=g("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,truespeed,typemustmatch,visible"),Vn="http://www.w3.org/1999/xlink",Wn=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},Hn=function(t){return Wn(t)?t.slice(6,t.length):""},Gn=function(t){return null==t||!1===t};function zn(t){for(var e=t.data,n=t,r=t;i(r.componentInstance);)(r=r.componentInstance._vnode)&&r.data&&(e=Xn(r.data,e));for(;i(n=n.parent);)n&&n.data&&(e=Xn(e,n.data));return function(t,e){if(i(t)||i(e))return Kn(t,Yn(e));return""}(e.staticClass,e.class)}function Xn(t,e){return{staticClass:Kn(t.staticClass,e.staticClass),class:i(t.class)?[t.class,e.class]:e.class}}function Kn(t,e){return t?e?t+" "+e:t:e||""}function Yn(t){return Array.isArray(t)?function(t){for(var e,n="",r=0,o=t.length;r-1?yr(t,e,n):Un(e)?Gn(n)?t.removeAttribute(e):(n="allowfullscreen"===e&&"EMBED"===t.tagName?"true":e,t.setAttribute(e,n)):Bn(e)?t.setAttribute(e,$n(e,n)):Wn(e)?Gn(n)?t.removeAttributeNS(Vn,Hn(e)):t.setAttributeNS(Vn,e,n):yr(t,e,n)}function yr(t,e,n){if(Gn(n))t.removeAttribute(e);else{if(J&&!Z&&"TEXTAREA"===t.tagName&&"placeholder"===e&&""!==n&&!t.__ieph){var r=function(e){e.stopImmediatePropagation(),t.removeEventListener("input",r)};t.addEventListener("input",r),t.__ieph=!0}t.setAttribute(e,n)}}var Tr={create:br,update:br};function Er(t,e){var n=e.elm,o=e.data,s=t.data;if(!(r(o.staticClass)&&r(o.class)&&(r(s)||r(s.staticClass)&&r(s.class)))){var a=zn(e),l=n._transitionClasses;i(l)&&(a=Kn(a,Yn(l))),a!==n._prevClass&&(n.setAttribute("class",a),n._prevClass=a)}}var xr,wr,Cr,Sr,kr,Or,Ir={create:Er,update:Er},Rr=/[\w).+\-_$\]]/;function Ar(t){var e,n,r,i,o,s=!1,a=!1,l=!1,u=!1,c=0,h=0,d=0,p=0;for(r=0;r=0&&" "===(g=t.charAt(f));f--);g&&Rr.test(g)||(u=!0)}}else void 0===i?(p=r+1,i=t.slice(0,r).trim()):m();function m(){(o||(o=[])).push(t.slice(p,r).trim()),p=r+1}if(void 0===i?i=t.slice(0,r).trim():0!==p&&m(),o)for(r=0;r-1?{exp:t.slice(0,Sr),key:'"'+t.slice(Sr+1)+'"'}:{exp:t,key:null};wr=t,Sr=kr=Or=0;for(;!Yr();)qr(Cr=Kr())?Zr(Cr):91===Cr&&Jr(Cr);return{exp:t.slice(0,kr),key:t.slice(kr+1,Or)}}(t);return null===n.key?t+"="+e:"$set("+n.exp+", "+n.key+", "+e+")"}function Kr(){return wr.charCodeAt(++Sr)}function Yr(){return Sr>=xr}function qr(t){return 34===t||39===t}function Jr(t){var e=1;for(kr=Sr;!Yr();)if(qr(t=Kr()))Zr(t);else if(91===t&&e++,93===t&&e--,0===e){Or=Sr;break}}function Zr(t){for(var e=t;!Yr()&&(t=Kr())!==e;);}var Qr,ti="__r",ei="__c";function ni(t,e,n){var r=Qr;return function i(){null!==e.apply(null,arguments)&&oi(t,i,n,r)}}var ri=Yt&&!(et&&Number(et[1])<=53);function ii(t,e,n,r){if(ri){var i=hn,o=e;e=o._wrapper=function(t){if(t.target===t.currentTarget||t.timeStamp>=i||t.timeStamp<=0||t.target.ownerDocument!==document)return o.apply(this,arguments)}}Qr.addEventListener(t,e,rt?{capture:n,passive:r}:n)}function oi(t,e,n,r){(r||Qr).removeEventListener(t,e._wrapper||e,n)}function si(t,e){if(!r(t.data.on)||!r(e.data.on)){var n=e.data.on||{},o=t.data.on||{};Qr=e.elm,function(t){if(i(t[ti])){var e=J?"change":"input";t[e]=[].concat(t[ti],t[e]||[]),delete t[ti]}i(t[ei])&&(t.change=[].concat(t[ei],t.change||[]),delete t[ei])}(n),le(n,o,ii,oi,ni,e.context),Qr=void 0}}var ai,li={create:si,update:si};function ui(t,e){if(!r(t.data.domProps)||!r(e.data.domProps)){var n,o,s=e.elm,a=t.data.domProps||{},l=e.data.domProps||{};for(n in i(l.__ob__)&&(l=e.data.domProps=I({},l)),a)n in l||(s[n]="");for(n in l){if(o=l[n],"textContent"===n||"innerHTML"===n){if(e.children&&(e.children.length=0),o===a[n])continue;1===s.childNodes.length&&s.removeChild(s.childNodes[0])}if("value"===n&&"PROGRESS"!==s.tagName){s._value=o;var u=r(o)?"":String(o);ci(s,u)&&(s.value=u)}else if("innerHTML"===n&&Zn(s.tagName)&&r(s.innerHTML)){(ai=ai||document.createElement("div")).innerHTML=""+o+"";for(var c=ai.firstChild;s.firstChild;)s.removeChild(s.firstChild);for(;c.firstChild;)s.appendChild(c.firstChild)}else if(o!==a[n])try{s[n]=o}catch(t){}}}}function ci(t,e){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,e)||function(t,e){var n=t.value,r=t._vModifiers;if(i(r)){if(r.number)return f(n)!==f(e);if(r.trim)return n.trim()!==e.trim()}return n!==e}(t,e))}var hi={create:ui,update:ui},di=T(function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e});function pi(t){var e=fi(t.style);return t.staticStyle?I(t.staticStyle,e):e}function fi(t){return Array.isArray(t)?R(t):"string"==typeof t?di(t):t}var gi,mi=/^--/,vi=/\s*!important$/,bi=function(t,e,n){if(mi.test(e))t.style.setProperty(e,n);else if(vi.test(n))t.style.setProperty(S(e),n.replace(vi,""),"important");else{var r=yi(e);if(Array.isArray(n))for(var i=0,o=n.length;i-1?e.split(xi).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Ci(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(xi).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function Si(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&I(e,ki(t.name||"v")),I(e,t),e}return"string"==typeof t?ki(t):void 0}}var ki=T(function(t){return{enterClass:t+"-enter",enterToClass:t+"-enter-to",enterActiveClass:t+"-enter-active",leaveClass:t+"-leave",leaveToClass:t+"-leave-to",leaveActiveClass:t+"-leave-active"}}),Oi=X&&!Z,Ii="transition",Ri="animation",Ai="transition",Ni="transitionend",Di="animation",Mi="animationend";Oi&&(void 0===window.ontransitionend&&void 0!==window.onwebkittransitionend&&(Ai="WebkitTransition",Ni="webkitTransitionEnd"),void 0===window.onanimationend&&void 0!==window.onwebkitanimationend&&(Di="WebkitAnimation",Mi="webkitAnimationEnd"));var Li=X?window.requestAnimationFrame?window.requestAnimationFrame.bind(window):setTimeout:function(t){return t()};function Pi(t){Li(function(){Li(t)})}function Fi(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),wi(t,e))}function Bi(t,e){t._transitionClasses&&b(t._transitionClasses,e),Ci(t,e)}function ji(t,e,n){var r=Ui(t,e),i=r.type,o=r.timeout,s=r.propCount;if(!i)return n();var a=i===Ii?Ni:Mi,l=0,u=function(){t.removeEventListener(a,c),n()},c=function(e){e.target===t&&++l>=s&&u()};setTimeout(function(){l0&&(n=Ii,c=s,h=o.length):e===Ri?u>0&&(n=Ri,c=u,h=l.length):h=(n=(c=Math.max(s,u))>0?s>u?Ii:Ri:null)?n===Ii?o.length:l.length:0,{type:n,timeout:c,propCount:h,hasTransform:n===Ii&&$i.test(r[Ai+"Property"])}}function Vi(t,e){for(;t.length1}function Ki(t,e){!0!==e.data.show&&Hi(e)}var Yi=function(t){var e,n,a={},l=t.modules,u=t.nodeOps;for(e=0;ef?_(t,r(n[v+1])?null:n[v+1].elm,n,p,v,o):p>v&&T(e,d,f)}(d,g,v,n,c):i(v)?(i(t.text)&&u.setTextContent(d,""),_(d,null,v,0,v.length-1,n)):i(g)?T(g,0,g.length-1):i(t.text)&&u.setTextContent(d,""):t.text!==e.text&&u.setTextContent(d,e.text),i(f)&&i(p=f.hook)&&i(p=p.postpatch)&&p(t,e)}}}function C(t,e,n){if(o(n)&&i(t.parent))t.parent.data.pendingInsert=e;else for(var r=0;r-1,s.selected!==o&&(s.selected=o);else if(M(to(s),r))return void(t.selectedIndex!==a&&(t.selectedIndex=a));i||(t.selectedIndex=-1)}}function Qi(t,e){return e.every(function(e){return!M(e,t)})}function to(t){return"_value"in t?t._value:t.value}function eo(t){t.target.composing=!0}function no(t){t.target.composing&&(t.target.composing=!1,ro(t.target,"input"))}function ro(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function io(t){return!t.componentInstance||t.data&&t.data.transition?t:io(t.componentInstance._vnode)}var oo={model:qi,show:{bind:function(t,e,n){var r=e.value,i=(n=io(n)).data&&n.data.transition,o=t.__vOriginalDisplay="none"===t.style.display?"":t.style.display;r&&i?(n.data.show=!0,Hi(n,function(){t.style.display=o})):t.style.display=r?o:"none"},update:function(t,e,n){var r=e.value;!r!=!e.oldValue&&((n=io(n)).data&&n.data.transition?(n.data.show=!0,r?Hi(n,function(){t.style.display=t.__vOriginalDisplay}):Gi(n,function(){t.style.display="none"})):t.style.display=r?t.__vOriginalDisplay:"none")},unbind:function(t,e,n,r,i){i||(t.style.display=t.__vOriginalDisplay)}}},so={name:String,appear:Boolean,css:Boolean,mode:String,type:String,enterClass:String,leaveClass:String,enterToClass:String,leaveToClass:String,enterActiveClass:String,leaveActiveClass:String,appearClass:String,appearActiveClass:String,appearToClass:String,duration:[Number,String,Object]};function ao(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?ao(Ke(e.children)):t}function lo(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var i=n._parentListeners;for(var o in i)e[x(o)]=i[o];return e}function uo(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}var co=function(t){return t.tag||me(t)},ho=function(t){return"show"===t.name},po={name:"transition",props:so,abstract:!0,render:function(t){var e=this,n=this.$slots.default;if(n&&(n=n.filter(co)).length){0;var r=this.mode;0;var i=n[0];if(function(t){for(;t=t.parent;)if(t.data.transition)return!0}(this.$vnode))return i;var o=ao(i);if(!o)return i;if(this._leaving)return uo(t,i);var a="__transition-"+this._uid+"-";o.key=null==o.key?o.isComment?a+"comment":a+o.tag:s(o.key)?0===String(o.key).indexOf(a)?o.key:a+o.key:o.key;var l=(o.data||(o.data={})).transition=lo(this),u=this._vnode,c=ao(u);if(o.data.directives&&o.data.directives.some(ho)&&(o.data.show=!0),c&&c.data&&!function(t,e){return e.key===t.key&&e.tag===t.tag}(o,c)&&!me(c)&&(!c.componentInstance||!c.componentInstance._vnode.isComment)){var h=c.data.transition=I({},l);if("out-in"===r)return this._leaving=!0,ue(h,"afterLeave",function(){e._leaving=!1,e.$forceUpdate()}),uo(t,i);if("in-out"===r){if(me(o))return u;var d,p=function(){d()};ue(l,"afterEnter",p),ue(l,"enterCancelled",p),ue(h,"delayLeave",function(t){d=t})}}return i}}},fo=I({tag:String,moveClass:String},so);function go(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function mo(t){t.data.newPos=t.elm.getBoundingClientRect()}function vo(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,i=e.top-n.top;if(r||i){t.data.moved=!0;var o=t.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}delete fo.mode;var bo={Transition:po,TransitionGroup:{props:fo,beforeMount:function(){var t=this,e=this._update;this._update=function(n,r){var i=tn(t);t.__patch__(t._vnode,t.kept,!1,!0),t._vnode=t.kept,i(),e.call(t,n,r)}},render:function(t){for(var e=this.tag||this.$vnode.data.tag||"span",n=Object.create(null),r=this.prevChildren=this.children,i=this.$slots.default||[],o=this.children=[],s=lo(this),a=0;a-1?er[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:er[t]=/HTMLUnknownElement/.test(e.toString())},I(kn.options.directives,oo),I(kn.options.components,bo),kn.prototype.__patch__=X?Yi:A,kn.prototype.$mount=function(t,e){return function(t,e,n){return t.$el=e,t.$options.render||(t.$options.render=bt),rn(t,"beforeMount"),new mn(t,function(){t._update(t._render(),n)},A,{before:function(){t._isMounted&&!t._isDestroyed&&rn(t,"beforeUpdate")}},!0),n=!1,null==t.$vnode&&(t._isMounted=!0,rn(t,"mounted")),t}(this,t=t&&X?rr(t):void 0,e)},X&&setTimeout(function(){$.devtools&&st&&st.emit("init",kn)},0);var _o=/\{\{((?:.|\r?\n)+?)\}\}/g,yo=/[-.*+?^${}()|[\]\/\\]/g,To=T(function(t){var e=t[0].replace(yo,"\\$&"),n=t[1].replace(yo,"\\$&");return new RegExp(e+"((?:.|\\n)+?)"+n,"g")});function Eo(t,e){var n=e?To(e):_o;if(n.test(t)){for(var r,i,o,s=[],a=[],l=n.lastIndex=0;r=n.exec(t);){(i=r.index)>l&&(a.push(o=t.slice(l,i)),s.push(JSON.stringify(o)));var u=Ar(r[1].trim());s.push("_s("+u+")"),a.push({"@binding":u}),l=i+r[0].length}return l\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,Ao=/^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,No="[a-zA-Z_][\\-\\.0-9_a-zA-Z"+U.source+"]*",Do="((?:"+No+"\\:)?"+No+")",Mo=new RegExp("^<"+Do),Lo=/^\s*(\/?)>/,Po=new RegExp("^<\\/"+Do+"[^>]*>"),Fo=/^]+>/i,Bo=/^",""":'"',"&":"&"," ":"\n"," ":"\t","'":"'"},Wo=/&(?:lt|gt|quot|amp|#39);/g,Ho=/&(?:lt|gt|quot|amp|#39|#10|#9);/g,Go=g("pre,textarea",!0),zo=function(t,e){return t&&Go(t)&&"\n"===e[0]};function Xo(t,e){var n=e?Ho:Wo;return t.replace(n,function(t){return Vo[t]})}var Ko,Yo,qo,Jo,Zo,Qo,ts,es,ns=/^@|^v-on:/,rs=/^v-|^@|^:|^#/,is=/([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/,os=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,ss=/^\(|\)$/g,as=/^\[.*\]$/,ls=/:(.*)$/,us=/^:|^\.|^v-bind:/,cs=/\.[^.\]]+(?=[^\]]*$)/g,hs=/^v-slot(:|$)|^#/,ds=/[\r\n]/,ps=/[ \f\t\r\n]+/g,fs=T(So),gs="_empty_";function ms(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:function(t){for(var e={},n=0,r=t.length;n]*>)","i")),d=t.replace(h,function(t,n,r){return u=r.length,$o(c)||"noscript"===c||(n=n.replace(//g,"$1").replace(//g,"$1")),zo(c,n)&&(n=n.slice(1)),e.chars&&e.chars(n),""});l+=t.length-d.length,t=d,S(c,l-u,l)}else{var p=t.indexOf("<");if(0===p){if(Bo.test(t)){var f=t.indexOf("--\x3e");if(f>=0){e.shouldKeepComment&&e.comment(t.substring(4,f),l,l+f+3),x(f+3);continue}}if(jo.test(t)){var g=t.indexOf("]>");if(g>=0){x(g+2);continue}}var m=t.match(Fo);if(m){x(m[0].length);continue}var v=t.match(Po);if(v){var b=l;x(v[0].length),S(v[1],b,l);continue}var _=w();if(_){C(_),zo(_.tagName,t)&&x(1);continue}}var y=void 0,T=void 0,E=void 0;if(p>=0){for(T=t.slice(p);!(Po.test(T)||Mo.test(T)||Bo.test(T)||jo.test(T)||(E=T.indexOf("<",1))<0);)p+=E,T=t.slice(p);y=t.substring(0,p)}p<0&&(y=t),y&&x(y.length),e.chars&&y&&e.chars(y,l-y.length,l)}if(t===n){e.chars&&e.chars(t);break}}function x(e){l+=e,t=t.substring(e)}function w(){var e=t.match(Mo);if(e){var n,r,i={tagName:e[1],attrs:[],start:l};for(x(e[0].length);!(n=t.match(Lo))&&(r=t.match(Ao)||t.match(Ro));)r.start=l,x(r[0].length),r.end=l,i.attrs.push(r);if(n)return i.unarySlash=n[1],x(n[0].length),i.end=l,i}}function C(t){var n=t.tagName,l=t.unarySlash;o&&("p"===r&&Io(n)&&S(r),a(n)&&r===n&&S(n));for(var u=s(n)||!!l,c=t.attrs.length,h=new Array(c),d=0;d=0&&i[s].lowerCasedTag!==a;s--);else s=0;if(s>=0){for(var u=i.length-1;u>=s;u--)e.end&&e.end(i[u].tag,n,o);i.length=s,r=s&&i[s-1].tag}else"br"===a?e.start&&e.start(t,[],!0,n,o):"p"===a&&(e.start&&e.start(t,[],!1,n,o),e.end&&e.end(t,n,o))}S()}(t,{warn:Ko,expectHTML:e.expectHTML,isUnaryTag:e.isUnaryTag,canBeLeftOpenTag:e.canBeLeftOpenTag,shouldDecodeNewlines:e.shouldDecodeNewlines,shouldDecodeNewlinesForHref:e.shouldDecodeNewlinesForHref,shouldKeepComment:e.comments,outputSourceRange:e.outputSourceRange,start:function(t,n,s,a,h){var d=i&&i.ns||es(t);J&&"svg"===d&&(n=function(t){for(var e=[],n=0;n-1"+("true"===o?":("+e+")":":_q("+e+","+o+")")),$r(t,"change","var $$a="+e+",$$el=$event.target,$$c=$$el.checked?("+o+"):("+s+");if(Array.isArray($$a)){var $$v="+(r?"_n("+i+")":i)+",$$i=_i($$a,$$v);if($$el.checked){$$i<0&&("+Xr(e,"$$a.concat([$$v])")+")}else{$$i>-1&&("+Xr(e,"$$a.slice(0,$$i).concat($$a.slice($$i+1))")+")}}else{"+Xr(e,"$$c")+"}",null,!0)}(t,r,i);else if("input"===o&&"radio"===s)!function(t,e,n){var r=n&&n.number,i=Vr(t,"value")||"null";Lr(t,"checked","_q("+e+","+(i=r?"_n("+i+")":i)+")"),$r(t,"change",Xr(e,i),null,!0)}(t,r,i);else if("input"===o||"textarea"===o)!function(t,e,n){var r=t.attrsMap.type,i=n||{},o=i.lazy,s=i.number,a=i.trim,l=!o&&"range"!==r,u=o?"change":"range"===r?ti:"input",c="$event.target.value";a&&(c="$event.target.value.trim()"),s&&(c="_n("+c+")");var h=Xr(e,c);l&&(h="if($event.target.composing)return;"+h),Lr(t,"value","("+e+")"),$r(t,u,h,null,!0),(a||s)&&$r(t,"blur","$forceUpdate()")}(t,r,i);else if(!$.isReservedTag(o))return zr(t,r,i),!1;return!0},text:function(t,e){e.value&&Lr(t,"textContent","_s("+e.value+")",e)},html:function(t,e){e.value&&Lr(t,"innerHTML","_s("+e.value+")",e)}},isPreTag:function(t){return"pre"===t},isUnaryTag:ko,mustUseProp:Fn,canBeLeftOpenTag:Oo,isReservedTag:Qn,getTagNamespace:tr,staticKeys:function(t){return t.reduce(function(t,e){return t.concat(e.staticKeys||[])},[]).join(",")}(Ss)},Rs=T(function(t){return g("type,tag,attrsList,attrsMap,plain,parent,children,attrs,start,end,rawAttrsMap"+(t?","+t:""))});function As(t,e){t&&(ks=Rs(e.staticKeys||""),Os=e.isReservedTag||N,function t(e){e.static=function(t){if(2===t.type)return!1;if(3===t.type)return!0;return!(!t.pre&&(t.hasBindings||t.if||t.for||m(t.tag)||!Os(t.tag)||function(t){for(;t.parent;){if("template"!==(t=t.parent).tag)return!1;if(t.for)return!0}return!1}(t)||!Object.keys(t).every(ks)))}(e);if(1===e.type){if(!Os(e.tag)&&"slot"!==e.tag&&null==e.attrsMap["inline-template"])return;for(var n=0,r=e.children.length;n|^function(?:\s+[\w$]+)?\s*\(/,Ds=/\([^)]*?\);*$/,Ms=/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/,Ls={esc:27,tab:9,enter:13,space:32,up:38,left:37,right:39,down:40,delete:[8,46]},Ps={esc:["Esc","Escape"],tab:"Tab",enter:"Enter",space:[" ","Spacebar"],up:["Up","ArrowUp"],left:["Left","ArrowLeft"],right:["Right","ArrowRight"],down:["Down","ArrowDown"],delete:["Backspace","Delete","Del"]},Fs=function(t){return"if("+t+")return null;"},Bs={stop:"$event.stopPropagation();",prevent:"$event.preventDefault();",self:Fs("$event.target !== $event.currentTarget"),ctrl:Fs("!$event.ctrlKey"),shift:Fs("!$event.shiftKey"),alt:Fs("!$event.altKey"),meta:Fs("!$event.metaKey"),left:Fs("'button' in $event && $event.button !== 0"),middle:Fs("'button' in $event && $event.button !== 1"),right:Fs("'button' in $event && $event.button !== 2")};function js(t,e){var n=e?"nativeOn:":"on:",r="",i="";for(var o in t){var s=$s(t[o]);t[o]&&t[o].dynamic?i+=o+","+s+",":r+='"'+o+'":'+s+","}return r="{"+r.slice(0,-1)+"}",i?n+"_d("+r+",["+i.slice(0,-1)+"])":n+r}function $s(t){if(!t)return"function(){}";if(Array.isArray(t))return"["+t.map(function(t){return $s(t)}).join(",")+"]";var e=Ms.test(t.value),n=Ns.test(t.value),r=Ms.test(t.value.replace(Ds,""));if(t.modifiers){var i="",o="",s=[];for(var a in t.modifiers)if(Bs[a])o+=Bs[a],Ls[a]&&s.push(a);else if("exact"===a){var l=t.modifiers;o+=Fs(["ctrl","shift","alt","meta"].filter(function(t){return!l[t]}).map(function(t){return"$event."+t+"Key"}).join("||"))}else s.push(a);return s.length&&(i+=function(t){return"if(!$event.type.indexOf('key')&&"+t.map(Us).join("&&")+")return null;"}(s)),o&&(i+=o),"function($event){"+i+(e?"return "+t.value+".apply(null, arguments)":n?"return ("+t.value+").apply(null, arguments)":r?"return "+t.value:t.value)+"}"}return e||n?t.value:"function($event){"+(r?"return "+t.value:t.value)+"}"}function Us(t){var e=parseInt(t,10);if(e)return"$event.keyCode!=="+e;var n=Ls[t],r=Ps[t];return"_k($event.keyCode,"+JSON.stringify(t)+","+JSON.stringify(n)+",$event.key,"+JSON.stringify(r)+")"}var Vs={on:function(t,e){t.wrapListeners=function(t){return"_g("+t+","+e.value+")"}},bind:function(t,e){t.wrapData=function(n){return"_b("+n+",'"+t.tag+"',"+e.value+","+(e.modifiers&&e.modifiers.prop?"true":"false")+(e.modifiers&&e.modifiers.sync?",true":"")+")"}},cloak:A},Ws=function(t){this.options=t,this.warn=t.warn||Dr,this.transforms=Mr(t.modules,"transformCode"),this.dataGenFns=Mr(t.modules,"genData"),this.directives=I(I({},Vs),t.directives);var e=t.isReservedTag||N;this.maybeComponent=function(t){return!!t.component||!e(t.tag)},this.onceId=0,this.staticRenderFns=[],this.pre=!1};function Hs(t,e){var n=new Ws(e);return{render:"with(this){return "+(t?"script"===t.tag?"null":Gs(t,n):'_c("div")')+"}",staticRenderFns:n.staticRenderFns}}function Gs(t,e){if(t.parent&&(t.pre=t.pre||t.parent.pre),t.staticRoot&&!t.staticProcessed)return zs(t,e);if(t.once&&!t.onceProcessed)return Xs(t,e);if(t.for&&!t.forProcessed)return Ys(t,e);if(t.if&&!t.ifProcessed)return Ks(t,e);if("template"!==t.tag||t.slotTarget||e.pre){if("slot"===t.tag)return function(t,e){var n=t.slotName||'"default"',r=Qs(t,e),i="_t("+n+(r?",function(){return "+r+"}":""),o=t.attrs||t.dynamicAttrs?na((t.attrs||[]).concat(t.dynamicAttrs||[]).map(function(t){return{name:x(t.name),value:t.value,dynamic:t.dynamic}})):null,s=t.attrsMap["v-bind"];!o&&!s||r||(i+=",null");o&&(i+=","+o);s&&(i+=(o?"":",null")+","+s);return i+")"}(t,e);var n;if(t.component)n=function(t,e,n){var r=e.inlineTemplate?null:Qs(e,n,!0);return"_c("+t+","+qs(e,n)+(r?","+r:"")+")"}(t.component,t,e);else{var r;(!t.plain||t.pre&&e.maybeComponent(t))&&(r=qs(t,e));var i=t.inlineTemplate?null:Qs(t,e,!0);n="_c('"+t.tag+"'"+(r?","+r:"")+(i?","+i:"")+")"}for(var o=0;o>>0}(s):"")+")"}(t,t.scopedSlots,e)+","),t.model&&(n+="model:{value:"+t.model.value+",callback:"+t.model.callback+",expression:"+t.model.expression+"},"),t.inlineTemplate){var o=function(t,e){var n=t.children[0];0;if(n&&1===n.type){var r=Hs(n,e.options);return"inlineTemplate:{render:function(){"+r.render+"},staticRenderFns:["+r.staticRenderFns.map(function(t){return"function(){"+t+"}"}).join(",")+"]}"}}(t,e);o&&(n+=o+",")}return n=n.replace(/,$/,"")+"}",t.dynamicAttrs&&(n="_b("+n+',"'+t.tag+'",'+na(t.dynamicAttrs)+")"),t.wrapData&&(n=t.wrapData(n)),t.wrapListeners&&(n=t.wrapListeners(n)),n}function Js(t){return 1===t.type&&("slot"===t.tag||t.children.some(Js))}function Zs(t,e){var n=t.attrsMap["slot-scope"];if(t.if&&!t.ifProcessed&&!n)return Ks(t,e,Zs,"null");if(t.for&&!t.forProcessed)return Ys(t,e,Zs);var r=t.slotScope===gs?"":String(t.slotScope),i="function("+r+"){return "+("template"===t.tag?t.if&&n?"("+t.if+")?"+(Qs(t,e)||"undefined")+":undefined":Qs(t,e)||"undefined":Gs(t,e))+"}",o=r?"":",proxy:true";return"{key:"+(t.slotTarget||'"default"')+",fn:"+i+o+"}"}function Qs(t,e,n,r,i){var o=t.children;if(o.length){var s=o[0];if(1===o.length&&s.for&&"template"!==s.tag&&"slot"!==s.tag){var a=n?e.maybeComponent(s)?",1":",0":"";return""+(r||Gs)(s,e)+a}var l=n?function(t,e){for(var n=0,r=0;r':'
',aa.innerHTML.indexOf(" ")>0}var ha=!!X&&ca(!1),da=!!X&&ca(!0),pa=T(function(t){var e=rr(t);return e&&e.innerHTML}),fa=kn.prototype.$mount;kn.prototype.$mount=function(t,e){if((t=t&&rr(t))===document.body||t===document.documentElement)return this;var n=this.$options;if(!n.render){var r=n.template;if(r)if("string"==typeof r)"#"===r.charAt(0)&&(r=pa(r));else{if(!r.nodeType)return this;r=r.innerHTML}else t&&(r=function(t){if(t.outerHTML)return t.outerHTML;var e=document.createElement("div");return e.appendChild(t.cloneNode(!0)),e.innerHTML}(t));if(r){0;var i=ua(r,{outputSourceRange:!1,shouldDecodeNewlines:ha,shouldDecodeNewlinesForHref:da,delimiters:n.delimiters,comments:n.comments},this),o=i.render,s=i.staticRenderFns;n.render=o,n.staticRenderFns=s}}return fa.call(this,t,e)},kn.compile=ua,e.default=kn}.call(e,n("DuR2"))},"77Pl":function(t,e,n){var r=n("EqjI");t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},"7GwW":function(t,e,n){"use strict";var r=n("cGG2"),i=n("21It"),o=n("p1b6"),s=n("DQCr"),a=n("Oi+a"),l=n("oJlt"),u=n("GHBc"),c=n("FtD3");t.exports=function(t){return new Promise(function(e,n){var h=t.data,d=t.headers;r.isFormData(h)&&delete d["Content-Type"];var p=new XMLHttpRequest;if(t.auth){var f=t.auth.username||"",g=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";d.Authorization="Basic "+btoa(f+":"+g)}var m=a(t.baseURL,t.url);if(p.open(t.method.toUpperCase(),s(m,t.params,t.paramsSerializer),!0),p.timeout=t.timeout,p.onreadystatechange=function(){if(p&&4===p.readyState&&(0!==p.status||p.responseURL&&0===p.responseURL.indexOf("file:"))){var r="getAllResponseHeaders"in p?l(p.getAllResponseHeaders()):null,o={data:t.responseType&&"text"!==t.responseType?p.response:p.responseText,status:p.status,statusText:p.statusText,headers:r,config:t,request:p};i(e,n,o),p=null}},p.onabort=function(){p&&(n(c("Request aborted",t,"ECONNABORTED",p)),p=null)},p.onerror=function(){n(c("Network Error",t,null,p)),p=null},p.ontimeout=function(){var e="timeout of "+t.timeout+"ms exceeded";t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),n(c(e,t,"ECONNABORTED",p)),p=null},r.isStandardBrowserEnv()){var v=(t.withCredentials||u(m))&&t.xsrfCookieName?o.read(t.xsrfCookieName):void 0;v&&(d[t.xsrfHeaderName]=v)}if("setRequestHeader"in p&&r.forEach(d,function(t,e){void 0===h&&"content-type"===e.toLowerCase()?delete d[e]:p.setRequestHeader(e,t)}),r.isUndefined(t.withCredentials)||(p.withCredentials=!!t.withCredentials),t.responseType)try{p.responseType=t.responseType}catch(e){if("json"!==t.responseType)throw e}"function"==typeof t.onDownloadProgress&&p.addEventListener("progress",t.onDownloadProgress),"function"==typeof t.onUploadProgress&&p.upload&&p.upload.addEventListener("progress",t.onUploadProgress),t.cancelToken&&t.cancelToken.promise.then(function(t){p&&(p.abort(),n(t),p=null)}),h||(h=null),p.send(h)})}},"7J9s":function(t,e,n){"use strict";e.__esModule=!0,e.PopupManager=void 0;var r=l(n("7+uW")),i=l(n("jmaC")),o=l(n("OAzY")),s=l(n("6Twh")),a=n("2kvA");function l(t){return t&&t.__esModule?t:{default:t}}var u=1,c=void 0;e.default={props:{visible:{type:Boolean,default:!1},openDelay:{},closeDelay:{},zIndex:{},modal:{type:Boolean,default:!1},modalFade:{type:Boolean,default:!0},modalClass:{},modalAppendToBody:{type:Boolean,default:!1},lockScroll:{type:Boolean,default:!0},closeOnPressEscape:{type:Boolean,default:!1},closeOnClickModal:{type:Boolean,default:!1}},beforeMount:function(){this._popupId="popup-"+u++,o.default.register(this._popupId,this)},beforeDestroy:function(){o.default.deregister(this._popupId),o.default.closeModal(this._popupId),this.restoreBodyStyle()},data:function(){return{opened:!1,bodyPaddingRight:null,computedBodyPaddingRight:0,withoutHiddenClass:!0,rendered:!1}},watch:{visible:function(t){var e=this;if(t){if(this._opening)return;this.rendered?this.open():(this.rendered=!0,r.default.nextTick(function(){e.open()}))}else this.close()}},methods:{open:function(t){var e=this;this.rendered||(this.rendered=!0);var n=(0,i.default)({},this.$props||this,t);this._closeTimer&&(clearTimeout(this._closeTimer),this._closeTimer=null),clearTimeout(this._openTimer);var r=Number(n.openDelay);r>0?this._openTimer=setTimeout(function(){e._openTimer=null,e.doOpen(n)},r):this.doOpen(n)},doOpen:function(t){if(!this.$isServer&&(!this.willOpen||this.willOpen())&&!this.opened){this._opening=!0;var e=this.$el,n=t.modal,r=t.zIndex;if(r&&(o.default.zIndex=r),n&&(this._closing&&(o.default.closeModal(this._popupId),this._closing=!1),o.default.openModal(this._popupId,o.default.nextZIndex(),this.modalAppendToBody?void 0:e,t.modalClass,t.modalFade),t.lockScroll)){this.withoutHiddenClass=!(0,a.hasClass)(document.body,"el-popup-parent--hidden"),this.withoutHiddenClass&&(this.bodyPaddingRight=document.body.style.paddingRight,this.computedBodyPaddingRight=parseInt((0,a.getStyle)(document.body,"paddingRight"),10)),c=(0,s.default)();var i=document.documentElement.clientHeight0&&(i||"scroll"===l)&&this.withoutHiddenClass&&(document.body.style.paddingRight=this.computedBodyPaddingRight+c+"px"),(0,a.addClass)(document.body,"el-popup-parent--hidden")}"static"===getComputedStyle(e).position&&(e.style.position="absolute"),e.style.zIndex=o.default.nextZIndex(),this.opened=!0,this.onOpen&&this.onOpen(),this.doAfterOpen()}},doAfterOpen:function(){this._opening=!1},close:function(){var t=this;if(!this.willClose||this.willClose()){null!==this._openTimer&&(clearTimeout(this._openTimer),this._openTimer=null),clearTimeout(this._closeTimer);var e=Number(this.closeDelay);e>0?this._closeTimer=setTimeout(function(){t._closeTimer=null,t.doClose()},e):this.doClose()}},doClose:function(){this._closing=!0,this.onClose&&this.onClose(),this.lockScroll&&setTimeout(this.restoreBodyStyle,200),this.opened=!1,this.doAfterClose()},doAfterClose:function(){o.default.closeModal(this._popupId),this._closing=!1},restoreBodyStyle:function(){this.modal&&this.withoutHiddenClass&&(document.body.style.paddingRight=this.bodyPaddingRight,(0,a.removeClass)(document.body,"el-popup-parent--hidden")),this.withoutHiddenClass=!0}}},e.PopupManager=o.default},"7KvD":function(t,e){var n=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},"7Mdl":function(t,e,n){"use strict"; /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function r(t,e,n){const r=function(t,e,n){return function(t,e,n){let r=0,i=t.length,o=0,s=!1;for(;r>>1)]);a>0?r=o+1:(i=o,s=!a)}return s?r:-r-1}(t,e,n||i)}(t,e,n),o=r<0?-(r+1):r;t.splice(o,0,e)}function i(t,e){return t>e?1:to&&p.push({score:e[t],boxIndex:t,suppressBeginIndex:0});p.sort(l);const f=u>0?-.5/u:0,g=[],m=[];for(;g.length0;){const e=p.pop(),{score:n,boxIndex:u,suppressBeginIndex:c}=e;if(n=c;--n){const r=s(t,u,g[n]);if(r>=i){h=!0;break}if(e.score=e.score*a(i,f,r),e.score<=o)break}e.suppressBeginIndex=g.length,h||(e.score===n?(g.push(u),m.push(e.score)):e.score>o&&r(p,e,l))}const v=g.length,b=n-v;h&&b>0&&(g.push(...new Array(b).fill(0)),m.push(...new Array(b).fill(0)));const _={selectedIndices:g};return c&&(_.selectedScores=m),d&&(_.validOutputs=v),_}function s(t,e,n){const r=t.subarray(4*e,4*e+4),i=t.subarray(4*n,4*n+4),o=Math.min(r[0],r[2]),s=Math.min(r[1],r[3]),a=Math.max(r[0],r[2]),l=Math.max(r[1],r[3]),u=Math.min(i[0],i[2]),c=Math.min(i[1],i[3]),h=Math.max(i[0],i[2]),d=Math.max(i[1],i[3]),p=(a-o)*(l-s),f=(h-u)*(d-c);if(p<=0||f<=0)return 0;const g=Math.max(o,u),m=Math.max(s,c),v=Math.min(a,h),b=Math.min(l,d),_=Math.max(v-g,0)*Math.max(b-m,0);return _/(p+f-_)}function a(t,e,n){const r=Math.exp(e*n*n);return n<=t?r:0}function l(t,e){return t.score-e.score||t.score===e.score&&e.boxIndex-t.boxIndex}e.a= /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e,n,r,i){return o(t,e,n,r,i,0)},e.b=function(t,e,n,r,i,s){return o(t,e,n,r,i,0,!1,s,!0)},e.c=function(t,e,n,r,i,s){return o(t,e,n,r,i,s,!0)}},"7UMu":function(t,e,n){var r=n("R9M2");t.exports=Array.isArray||function(t){return"Array"==r(t)}},"82Mu":function(t,e,n){var r=n("7KvD"),i=n("L42u").set,o=r.MutationObserver||r.WebKitMutationObserver,s=r.process,a=r.Promise,l="process"==n("R9M2")(s);t.exports=function(){var t,e,n,u=function(){var r,i;for(l&&(r=s.domain)&&r.exit();t;){i=t.fn,t=t.next;try{i()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(l)n=function(){s.nextTick(u)};else if(!o||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var c=a.resolve(void 0);n=function(){c.then(u)}}else n=function(){i.call(r,u)};else{var h=!0,d=document.createTextNode("");new o(u).observe(d,{characterData:!0}),n=function(){d.data=h=!h}}return function(r){var i={fn:r,next:void 0};e&&(e.next=i),t||(t=i,n()),e=i}}},"835U":function(t,e,n){"use strict";e.__esModule=!0,e.isDefined=e.isUndefined=e.isFunction=void 0;var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};e.isString=function(t){return"[object String]"===Object.prototype.toString.call(t)},e.isObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)},e.isHtmlElement=function(t){return t&&t.nodeType===Node.ELEMENT_NODE};var i,o=n("7+uW"),s=(i=o)&&i.__esModule?i:{default:i};var a=function(t){return t&&"[object Function]"==={}.toString.call(t)};"function"==typeof/./||"object"===("undefined"==typeof Int8Array?"undefined":r(Int8Array))||!s.default.prototype.$isServer&&"function"==typeof document.childNodes||(e.isFunction=a=function(t){return"function"==typeof t||!1}),e.isFunction=a;e.isUndefined=function(t){return void 0===t},e.isDefined=function(t){return void 0!==t&&null!==t}},"880/":function(t,e,n){t.exports=n("hJx8")},"94VQ":function(t,e,n){"use strict";var r=n("Yobk"),i=n("X8DO"),o=n("e6n0"),s={};n("hJx8")(s,n("dSzd")("iterator"),function(){return this}),t.exports=function(t,e,n){t.prototype=r(s,{next:i(1,n)}),o(t,e+" Iterator")}},"9Nf/":function(t,e,n){"use strict";n.d(e,"a",function(){return a}),n.d(e,"b",function(){return s});var r=n("Kkag"),i=n("XPNO"),o=(n("xMQ1"),n("XFvI"));function s(t,e){o.assert(o.isFunction(t),()=>"The f passed in variableGrads(f) must be a function"),o.assert(null==e||Array.isArray(e)&&e.every(t=>t instanceof i.c),()=>"The varList passed in variableGrads(f, varList) must be an array of variables");const n=null!=e;if(!n){e=[];for(const t in r.a.registeredVariables)e.push(r.a.registeredVariables[t])}const s=n?e.filter(t=>!t.trainable):null,a=e.length;e=e.filter(t=>t.trainable),o.assert(e.length>0,()=>"variableGrads() expects at least one of the input variables to "+`be trainable, but none of the ${a} variables is `+"trainable.");const{value:l,grads:u}=r.a.gradients(t,e,null,!0);o.assert(u.some(t=>null!=t),()=>"Cannot find a connection between any variable and the result of the loss function y=f(x). Please make sure the operations that use variables are inside the function f passed to minimize()."),o.assert(0===l.rank,()=>"The f passed in variableGrads(f) must return a scalar, but it "+`returned a rank-${l.rank} tensor`);const c={};return e.forEach((t,e)=>{null!=u[e]&&(c[t.name]=u[e])}),null!=s&&s.forEach(t=>c[t.name]=null),{value:l,grads:c}}function a(t){return r.a.customGrad(t)}},"9g4f":function(t,e,n){(function(t){var r;!function(t,i,o){function s(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function a(t,e){null==t&&(t=+new Date);var n=new function(t){var e=this;e.next=function(){var t,n,r=e.w,i=e.X,o=e.i;return e.w=r=r+1640531527|0,n=i[o+34&127],t=i[o=o+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>12,n=i[o]=n^t,e.i=o,n+(r^r>>>16)|0},function(t,e){var n,r,i,o,s,a=[],l=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,l=Math.max(l,e.length)),i=0,o=-32;o>>15,r^=r<<4,r^=r>>>13,o>=0&&(s=s+1640531527|0,i=0==(n=a[127&o]^=r+s)?i+1:0);for(i>=128&&(a[127&(e&&e.length||0)]=-1),i=127,o=512;o>0;--o)r=a[i+34&127],n=a[i=i+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,a[i]=r^n;t.w=s,t.X=a,t.i=i}(e,t)}(t),r=e&&e.state,i=function(){return(n.next()>>>0)/4294967296};return i.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},i.int32=n.next,i.quick=i,r&&(r.X&&s(r,n),i.state=function(){return s(n,{})}),i}i&&i.exports?i.exports=a:n("LGuY")&&n("nErl")?void 0===(r=function(){return a}.call(e,n,e,i))||(i.exports=r):this.xor4096=a}(0,"object"==typeof t&&t,n("LGuY"))}).call(e,n("3IRH")(t))},AMCD:function(t,e,n){"use strict";e.__esModule=!0,e.validateRangeInOneMonth=e.extractTimeFormat=e.extractDateFormat=e.nextYear=e.prevYear=e.nextMonth=e.prevMonth=e.changeYearMonthAndClampDate=e.timeWithinRange=e.limitTimeRange=e.clearMilliseconds=e.clearTime=e.modifyWithTimeString=e.modifyTime=e.modifyDate=e.range=e.getRangeMinutes=e.getMonthDays=e.getPrevMonthLastDays=e.getRangeHours=e.getWeekNumber=e.getStartDateOfMonth=e.nextDate=e.prevDate=e.getFirstDayOfMonth=e.getDayCountOfYear=e.getDayCountOfMonth=e.parseDate=e.formatDate=e.isDateObject=e.isDate=e.toDate=e.getI18nSettings=void 0;var r,i=n("eNfa"),o=(r=i)&&r.__esModule?r:{default:r},s=n("urW8");var a=["sun","mon","tue","wed","thu","fri","sat"],l=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],u=e.getI18nSettings=function(){return{dayNamesShort:a.map(function(t){return(0,s.t)("el.datepicker.weeks."+t)}),dayNames:a.map(function(t){return(0,s.t)("el.datepicker.weeks."+t)}),monthNamesShort:l.map(function(t){return(0,s.t)("el.datepicker.months."+t)}),monthNames:l.map(function(t,e){return(0,s.t)("el.datepicker.month"+(e+1))}),amPm:["am","pm"]}},c=e.toDate=function(t){return h(t)?new Date(t):null},h=e.isDate=function(t){return null!==t&&void 0!==t&&(!isNaN(new Date(t).getTime())&&!Array.isArray(t))},d=(e.isDateObject=function(t){return t instanceof Date},e.formatDate=function(t,e){return(t=c(t))?o.default.format(t,e||"yyyy-MM-dd",u()):""},e.parseDate=function(t,e){return o.default.parse(t,e||"yyyy-MM-dd",u())}),p=e.getDayCountOfMonth=function(t,e){return 3===e||5===e||8===e||10===e?30:1===e?t%4==0&&t%100!=0||t%400==0?29:28:31},f=(e.getDayCountOfYear=function(t){return t%400==0||t%100!=0&&t%4==0?366:365},e.getFirstDayOfMonth=function(t){var e=new Date(t.getTime());return e.setDate(1),e.getDay()},e.prevDate=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Date(t.getFullYear(),t.getMonth(),t.getDate()-e)});e.nextDate=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Date(t.getFullYear(),t.getMonth(),t.getDate()+e)},e.getStartDateOfMonth=function(t,e){var n=new Date(t,e,1),r=n.getDay();return f(n,0===r?7:r)},e.getWeekNumber=function(t){if(!h(t))return null;var e=new Date(t.getTime());e.setHours(0,0,0,0),e.setDate(e.getDate()+3-(e.getDay()+6)%7);var n=new Date(e.getFullYear(),0,4);return 1+Math.round(((e.getTime()-n.getTime())/864e5-3+(n.getDay()+6)%7)/7)},e.getRangeHours=function(t){var e=[],n=[];if((t||[]).forEach(function(t){var e=t.map(function(t){return t.getHours()});n=n.concat(function(t,e){for(var n=[],r=t;r<=e;r++)n.push(r);return n}(e[0],e[1]))}),n.length)for(var r=0;r<24;r++)e[r]=-1===n.indexOf(r);else for(var i=0;i<24;i++)e[i]=!1;return e},e.getPrevMonthLastDays=function(t,e){if(e<=0)return[];var n=new Date(t.getTime());n.setDate(0);var r=n.getDate();return m(e).map(function(t,n){return r-(e-n-1)})},e.getMonthDays=function(t){var e=new Date(t.getFullYear(),t.getMonth()+1,0).getDate();return m(e).map(function(t,e){return e+1})};function g(t,e,n,r){for(var i=e;i0?t.forEach(function(t){var r=t[0],i=t[1],o=r.getHours(),s=r.getMinutes(),a=i.getHours(),l=i.getMinutes();o===e&&a!==e?g(n,s,60,!0):o===e&&a===e?g(n,s,l+1,!0):o!==e&&a===e?g(n,0,l+1,!0):oe&&g(n,0,60,!0)}):g(n,0,60,!0),n};var m=e.range=function(t){return Array.apply(null,{length:t}).map(function(t,e){return e})},v=e.modifyDate=function(t,e,n,r){return new Date(e,n,r,t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds())},b=e.modifyTime=function(t,e,n,r){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),e,n,r,t.getMilliseconds())},_=(e.modifyWithTimeString=function(t,e){return null!=t&&e?(e=d(e,"HH:mm:ss"),b(t,e.getHours(),e.getMinutes(),e.getSeconds())):t},e.clearTime=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate())},e.clearMilliseconds=function(t){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),0)},e.limitTimeRange=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"HH:mm:ss";if(0===e.length)return t;var r=function(t){return o.default.parse(o.default.format(t,n),n)},i=r(t),s=e.map(function(t){return t.map(r)});if(s.some(function(t){return i>=t[0]&&i<=t[1]}))return t;var a=s[0][0],l=s[0][0];return s.forEach(function(t){a=new Date(Math.min(t[0],a)),l=new Date(Math.max(t[1],a))}),v(i1&&void 0!==arguments[1]?arguments[1]:1,n=t.getFullYear(),r=t.getMonth();return y(t,n-e,r)},e.nextYear=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=t.getFullYear(),r=t.getMonth();return y(t,n+e,r)},e.extractDateFormat=function(t){return t.replace(/\W?m{1,2}|\W?ZZ/g,"").replace(/\W?h{1,2}|\W?s{1,3}|\W?a/gi,"").trim()},e.extractTimeFormat=function(t){return t.replace(/\W?D{1,2}|\W?Do|\W?d{1,4}|\W?M{1,4}|\W?y{2,4}/g,"").trim()},e.validateRangeInOneMonth=function(t,e){return t.getMonth()===e.getMonth()&&t.getFullYear()===e.getFullYear()}},"BJf/":function(t,e){t.exports=r;var n=null;try{n=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(t){}function r(t,e,n){this.low=0|t,this.high=0|e,this.unsigned=!!n}function i(t){return!0===(t&&t.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=i;var o={},s={};function a(t,e){var n,r,i;return e?(i=0<=(t>>>=0)&&t<256)&&(r=s[t])?r:(n=u(t,(0|t)<0?-1:0,!0),i&&(s[t]=n),n):(i=-128<=(t|=0)&&t<128)&&(r=o[t])?r:(n=u(t,t<0?-1:0,!1),i&&(o[t]=n),n)}function l(t,e){if(isNaN(t))return e?b:v;if(e){if(t<0)return b;if(t>=f)return x}else{if(t<=-g)return w;if(t+1>=g)return E}return t<0?l(-t,e).neg():u(t%p|0,t/p|0,e)}function u(t,e,n){return new r(t,e,n)}r.fromInt=a,r.fromNumber=l,r.fromBits=u;var c=Math.pow;function h(t,e,n){if(0===t.length)throw Error("empty string");if("NaN"===t||"Infinity"===t||"+Infinity"===t||"-Infinity"===t)return v;if("number"==typeof e?(n=e,e=!1):e=!!e,(n=n||10)<2||360)throw Error("interior hyphen");if(0===r)return h(t.substring(1),e,n).neg();for(var i=l(c(n,8)),o=v,s=0;s>>0:this.low},C.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},C.toString=function(t){if((t=t||10)<2||36>>0).toString(t);if((o=a).isZero())return u+s;for(;u.length<6;)u="0"+u;s=""+u+s}},C.getHighBits=function(){return this.high},C.getHighBitsUnsigned=function(){return this.high>>>0},C.getLowBits=function(){return this.low},C.getLowBitsUnsigned=function(){return this.low>>>0},C.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?64:this.neg().getNumBitsAbs();for(var t=0!=this.high?this.high:this.low,e=31;e>0&&0==(t&1<=0},C.isOdd=function(){return 1==(1&this.low)},C.isEven=function(){return 0==(1&this.low)},C.equals=function(t){return i(t)||(t=d(t)),(this.unsigned===t.unsigned||this.high>>>31!=1||t.high>>>31!=1)&&(this.high===t.high&&this.low===t.low)},C.eq=C.equals,C.notEquals=function(t){return!this.eq(t)},C.neq=C.notEquals,C.ne=C.notEquals,C.lessThan=function(t){return this.comp(t)<0},C.lt=C.lessThan,C.lessThanOrEqual=function(t){return this.comp(t)<=0},C.lte=C.lessThanOrEqual,C.le=C.lessThanOrEqual,C.greaterThan=function(t){return this.comp(t)>0},C.gt=C.greaterThan,C.greaterThanOrEqual=function(t){return this.comp(t)>=0},C.gte=C.greaterThanOrEqual,C.ge=C.greaterThanOrEqual,C.compare=function(t){if(i(t)||(t=d(t)),this.eq(t))return 0;var e=this.isNegative(),n=t.isNegative();return e&&!n?-1:!e&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1},C.comp=C.compare,C.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(_)},C.neg=C.negate,C.add=function(t){i(t)||(t=d(t));var e=this.high>>>16,n=65535&this.high,r=this.low>>>16,o=65535&this.low,s=t.high>>>16,a=65535&t.high,l=t.low>>>16,c=0,h=0,p=0,f=0;return p+=(f+=o+(65535&t.low))>>>16,h+=(p+=r+l)>>>16,c+=(h+=n+a)>>>16,c+=e+s,u((p&=65535)<<16|(f&=65535),(c&=65535)<<16|(h&=65535),this.unsigned)},C.subtract=function(t){return i(t)||(t=d(t)),this.add(t.neg())},C.sub=C.subtract,C.multiply=function(t){if(this.isZero())return v;if(i(t)||(t=d(t)),n)return u(n.mul(this.low,this.high,t.low,t.high),n.get_high(),this.unsigned);if(t.isZero())return v;if(this.eq(w))return t.isOdd()?w:v;if(t.eq(w))return this.isOdd()?w:v;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(m)&&t.lt(m))return l(this.toNumber()*t.toNumber(),this.unsigned);var e=this.high>>>16,r=65535&this.high,o=this.low>>>16,s=65535&this.low,a=t.high>>>16,c=65535&t.high,h=t.low>>>16,p=65535&t.low,f=0,g=0,b=0,_=0;return b+=(_+=s*p)>>>16,g+=(b+=o*p)>>>16,b&=65535,g+=(b+=s*h)>>>16,f+=(g+=r*p)>>>16,g&=65535,f+=(g+=o*h)>>>16,g&=65535,f+=(g+=s*c)>>>16,f+=e*p+r*h+o*c+s*a,u((b&=65535)<<16|(_&=65535),(f&=65535)<<16|(g&=65535),this.unsigned)},C.mul=C.multiply,C.divide=function(t){if(i(t)||(t=d(t)),t.isZero())throw Error("division by zero");var e,r,o;if(n)return this.unsigned||-2147483648!==this.high||-1!==t.low||-1!==t.high?u((this.unsigned?n.div_u:n.div_s)(this.low,this.high,t.low,t.high),n.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?b:v;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return b;if(t.gt(this.shru(1)))return y;o=b}else{if(this.eq(w))return t.eq(_)||t.eq(T)?w:t.eq(w)?_:(e=this.shr(1).div(t).shl(1)).eq(v)?t.isNegative()?_:T:(r=this.sub(t.mul(e)),o=e.add(r.div(t)));else if(t.eq(w))return this.unsigned?b:v;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();o=v}for(r=this;r.gte(t);){e=Math.max(1,Math.floor(r.toNumber()/t.toNumber()));for(var s=Math.ceil(Math.log(e)/Math.LN2),a=s<=48?1:c(2,s-48),h=l(e),p=h.mul(t);p.isNegative()||p.gt(r);)p=(h=l(e-=a,this.unsigned)).mul(t);h.isZero()&&(h=_),o=o.add(h),r=r.sub(p)}return o},C.div=C.divide,C.modulo=function(t){return i(t)||(t=d(t)),n?u((this.unsigned?n.rem_u:n.rem_s)(this.low,this.high,t.low,t.high),n.get_high(),this.unsigned):this.sub(this.div(t).mul(t))},C.mod=C.modulo,C.rem=C.modulo,C.not=function(){return u(~this.low,~this.high,this.unsigned)},C.and=function(t){return i(t)||(t=d(t)),u(this.low&t.low,this.high&t.high,this.unsigned)},C.or=function(t){return i(t)||(t=d(t)),u(this.low|t.low,this.high|t.high,this.unsigned)},C.xor=function(t){return i(t)||(t=d(t)),u(this.low^t.low,this.high^t.high,this.unsigned)},C.shiftLeft=function(t){return i(t)&&(t=t.toInt()),0==(t&=63)?this:t<32?u(this.low<>>32-t,this.unsigned):u(0,this.low<>>t|this.high<<32-t,this.high>>t,this.unsigned):u(this.high>>t-32,this.high>=0?0:-1,this.unsigned)},C.shr=C.shiftRight,C.shiftRightUnsigned=function(t){if(i(t)&&(t=t.toInt()),0===(t&=63))return this;var e=this.high;return t<32?u(this.low>>>t|e<<32-t,e>>>t,this.unsigned):u(32===t?e:e>>>t-32,0,this.unsigned)},C.shru=C.shiftRightUnsigned,C.shr_u=C.shiftRightUnsigned,C.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},C.toUnsigned=function(){return this.unsigned?this:u(this.low,this.high,!0)},C.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()},C.toBytesLE=function(){var t=this.high,e=this.low;return[255&e,e>>>8&255,e>>>16&255,e>>>24,255&t,t>>>8&255,t>>>16&255,t>>>24]},C.toBytesBE=function(){var t=this.high,e=this.low;return[t>>>24,t>>>16&255,t>>>8&255,255&t,e>>>24,e>>>16&255,e>>>8&255,255&e]},r.fromBytes=function(t,e,n){return n?r.fromBytesLE(t,e):r.fromBytesBE(t,e)},r.fromBytesLE=function(t,e){return new r(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,e)},r.fromBytesBE=function(t,e){return new r(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],e)}},BO1k:function(t,e,n){t.exports={default:n("fxRn"),__esModule:!0}},BVpN:function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("35G1");const a=Object(s.a)({abs_: /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t){const e=Object(o.a)(t,"x","abs");if("complex64"===e.dtype){const t={x:e};return r.a.runKernel(i.A,t)}{const t={x:e};return r.a.runKernel(i.a,t)}}});e.a=a},Bf2p:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.json=[{tfOpName:"_FusedMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"},{start:2,end:0,name:"args",type:"tensors"}],attrs:[{tfName:"num_args",name:"numArgs",type:"number"},{tfName:"fused_ops",name:"fusedOps",type:"string[]",defaultValue:[]},{tfName:"epsilon",name:"epsilon",type:"number",defaultValue:1e-4},{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"MatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"transpose_a",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"transpose_b",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMul",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"BatchMatMulV2",category:"matrices",inputs:[{start:0,name:"a",type:"tensor"},{start:1,name:"b",type:"tensor"}],attrs:[{tfName:"adj_x",name:"transposeA",type:"bool",defaultValue:!1},{tfName:"adj_y",name:"transposeB",type:"bool",defaultValue:!1},{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Transpose",category:"matrices",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"perm",type:"number[]"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"Einsum",category:"matrices",inputs:[{start:0,end:0,name:"tensors",type:"tensors"}],attrs:[{tfName:"equation",name:"equation",type:"string"},{tfName:"N",name:"n",type:"number",defaultValue:2},{tfName:"T",name:"dtype",type:"dtype"}]}]},BwfY:function(t,e,n){n("fWfb"),n("M6a0"),n("OYls"),n("QWe/"),t.exports=n("FeBl").Symbol},CXw9:function(t,e,n){"use strict";var r,i,o,s,a=n("O4g8"),l=n("7KvD"),u=n("+ZMJ"),c=n("RY/4"),h=n("kM2E"),d=n("EqjI"),p=n("lOnJ"),f=n("2KxR"),g=n("NWt+"),m=n("t8x9"),v=n("L42u").set,b=n("82Mu")(),_=n("qARP"),y=n("dNDb"),T=n("iUbK"),E=n("fJUb"),x=l.TypeError,w=l.process,C=w&&w.versions,S=C&&C.v8||"",k=l.Promise,O="process"==c(w),I=function(){},R=i=_.f,A=!!function(){try{var t=k.resolve(1),e=(t.constructor={})[n("dSzd")("species")]=function(t){t(I,I)};return(O||"function"==typeof PromiseRejectionEvent)&&t.then(I)instanceof e&&0!==S.indexOf("6.6")&&-1===T.indexOf("Chrome/66")}catch(t){}}(),N=function(t){var e;return!(!d(t)||"function"!=typeof(e=t.then))&&e},D=function(t,e){if(!t._n){t._n=!0;var n=t._c;b(function(){for(var r=t._v,i=1==t._s,o=0,s=function(e){var n,o,s,a=i?e.ok:e.fail,l=e.resolve,u=e.reject,c=e.domain;try{a?(i||(2==t._h&&P(t),t._h=1),!0===a?n=r:(c&&c.enter(),n=a(r),c&&(c.exit(),s=!0)),n===e.promise?u(x("Promise-chain cycle")):(o=N(n))?o.call(n,l,u):l(n)):u(r)}catch(t){c&&!s&&c.exit(),u(t)}};n.length>o;)s(n[o++]);t._c=[],t._n=!1,e&&!t._h&&M(t)})}},M=function(t){v.call(l,function(){var e,n,r,i=t._v,o=L(t);if(o&&(e=y(function(){O?w.emit("unhandledRejection",i,t):(n=l.onunhandledrejection)?n({promise:t,reason:i}):(r=l.console)&&r.error&&r.error("Unhandled promise rejection",i)}),t._h=O||L(t)?2:1),t._a=void 0,o&&e.e)throw e.v})},L=function(t){return 1!==t._h&&0===(t._a||t._c).length},P=function(t){v.call(l,function(){var e;O?w.emit("rejectionHandled",t):(e=l.onrejectionhandled)&&e({promise:t,reason:t._v})})},F=function(t){var e=this;e._d||(e._d=!0,(e=e._w||e)._v=t,e._s=2,e._a||(e._a=e._c.slice()),D(e,!0))},B=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw x("Promise can't be resolved itself");(e=N(t))?b(function(){var r={_w:n,_d:!1};try{e.call(t,u(B,r,1),u(F,r,1))}catch(t){F.call(r,t)}}):(n._v=t,n._s=1,D(n,!1))}catch(t){F.call({_w:n,_d:!1},t)}}};A||(k=function(t){f(this,k,"Promise","_h"),p(t),r.call(this);try{t(u(B,this,1),u(F,this,1))}catch(t){F.call(this,t)}},(r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=n("xH/j")(k.prototype,{then:function(t,e){var n=R(m(this,k));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=O?w.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&D(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),o=function(){var t=new r;this.promise=t,this.resolve=u(B,t,1),this.reject=u(F,t,1)},_.f=R=function(t){return t===k||t===s?new o(t):i(t)}),h(h.G+h.W+h.F*!A,{Promise:k}),n("e6n0")(k,"Promise"),n("bRrM")("Promise"),s=n("FeBl").Promise,h(h.S+h.F*!A,"Promise",{reject:function(t){var e=R(this);return(0,e.reject)(t),e.promise}}),h(h.S+h.F*(a||!A),"Promise",{resolve:function(t){return E(a&&this===s?k:this,t)}}),h(h.S+h.F*!(A&&n("dY0y")(function(t){k.all(t).catch(I)})),"Promise",{all:function(t){var e=this,n=R(e),r=n.resolve,i=n.reject,o=y(function(){var n=[],o=0,s=1;g(t,!1,function(t){var a=o++,l=!1;n.push(void 0),s++,e.resolve(t).then(function(t){l||(l=!0,n[a]=t,--s||r(n))},i)}),--s||r(n)});return o.e&&i(o.v),n.promise},race:function(t){var e=this,n=R(e),r=n.reject,i=y(function(){g(t,!1,function(t){e.resolve(t).then(n.resolve,r)})});return i.e&&r(i.v),n.promise}})},Cdx3:function(t,e,n){var r=n("sB3e"),i=n("lktj");n("uqUo")("keys",function(){return function(t){return i(r(t))}})},"Cp+6":function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("MlK1"),a=n("35G1");const l=Object(a.a)({sum_: /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e=null,n=!1){let a=Object(o.a)(t,"x","sum");"bool"===a.dtype&&(a=Object(s.a)(a,"int32"));const l={x:a},u={axis:e,keepDims:n};return r.a.runKernel(i._98,l,u)}});e.a=l},Cr6W:function(t,e,n){var r,i,o,s;s=function(t,e){ /** * @license * Copyright 2020 Google LLC * SPDX-License-Identifier: Apache-2.0 */ "use strict";return t.JavaScript=e,e},i=[n("xnUL"),n("JMbB")],void 0===(o="function"==typeof(r=s)?r.apply(e,i):r)||(t.exports=o)},CwSZ:function(t,e,n){"use strict";var r=n("p8xL"),i=n("XgCd"),o=Object.prototype.hasOwnProperty,s={brackets:function(t){return t+"[]"},comma:"comma",indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},a=Array.isArray,l=Array.prototype.push,u=function(t,e){l.apply(t,a(e)?e:[e])},c=Date.prototype.toISOString,h={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:r.encode,encodeValuesOnly:!1,formatter:i.formatters[i.default],indices:!1,serializeDate:function(t){return c.call(t)},skipNulls:!1,strictNullHandling:!1},d=function t(e,n,i,o,s,l,c,d,p,f,g,m,v){var b=e;if("function"==typeof c?b=c(n,b):b instanceof Date?b=f(b):"comma"===i&&a(b)&&(b=b.join(",")),null===b){if(o)return l&&!m?l(n,h.encoder,v):n;b=""}if("string"==typeof b||"number"==typeof b||"boolean"==typeof b||r.isBuffer(b))return l?[g(m?n:l(n,h.encoder,v))+"="+g(l(b,h.encoder,v))]:[g(n)+"="+g(String(b))];var _,y=[];if(void 0===b)return y;if(a(c))_=c;else{var T=Object.keys(b);_=d?T.sort(d):T}for(var E=0;E<_.length;++E){var x=_[E];s&&null===b[x]||(a(b)?u(y,t(b[x],"function"==typeof i?i(n,x):n,i,o,s,l,c,d,p,f,g,m,v)):u(y,t(b[x],n+(p?"."+x:"["+x+"]"),i,o,s,l,c,d,p,f,g,m,v)))}return y};t.exports=function(t,e){var n,r=t,l=function(t){if(!t)return h;if(null!==t.encoder&&void 0!==t.encoder&&"function"!=typeof t.encoder)throw new TypeError("Encoder has to be a function.");var e=t.charset||h.charset;if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=i.default;if(void 0!==t.format){if(!o.call(i.formatters,t.format))throw new TypeError("Unknown format option provided.");n=t.format}var r=i.formatters[n],s=h.filter;return("function"==typeof t.filter||a(t.filter))&&(s=t.filter),{addQueryPrefix:"boolean"==typeof t.addQueryPrefix?t.addQueryPrefix:h.addQueryPrefix,allowDots:void 0===t.allowDots?h.allowDots:!!t.allowDots,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:h.charsetSentinel,delimiter:void 0===t.delimiter?h.delimiter:t.delimiter,encode:"boolean"==typeof t.encode?t.encode:h.encode,encoder:"function"==typeof t.encoder?t.encoder:h.encoder,encodeValuesOnly:"boolean"==typeof t.encodeValuesOnly?t.encodeValuesOnly:h.encodeValuesOnly,filter:s,formatter:r,serializeDate:"function"==typeof t.serializeDate?t.serializeDate:h.serializeDate,skipNulls:"boolean"==typeof t.skipNulls?t.skipNulls:h.skipNulls,sort:"function"==typeof t.sort?t.sort:null,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:h.strictNullHandling}}(e);"function"==typeof l.filter?r=(0,l.filter)("",r):a(l.filter)&&(n=l.filter);var c,p=[];if("object"!=typeof r||null===r)return"";c=e&&e.arrayFormat in s?e.arrayFormat:e&&"indices"in e?e.indices?"indices":"repeat":"indices";var f=s[c];n||(n=Object.keys(r)),l.sort&&n.sort(l.sort);for(var g=0;g0?b+v:""}},"Cwm/":function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("35G1");const a=Object(s.a)({zerosLike_: /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t){const e={x:Object(o.a)(t,"x","zerosLike")};return r.a.runKernel(i._108,e)}});e.a=a},D2L2:function(t,e){var n={}.hasOwnProperty;t.exports=function(t,e){return n.call(t,e)}},DDCP:function(t,e,n){"use strict";var r=n("p8xL"),i=Object.prototype.hasOwnProperty,o={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:r.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},s=function(t){return t.replace(/&#(\d+);/g,function(t,e){return String.fromCharCode(parseInt(e,10))})},a=function(t,e,n){if(t){var r=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,o=/(\[[^[\]]*])/g,s=/(\[[^[\]]*])/.exec(r),a=s?r.slice(0,s.index):r,l=[];if(a){if(!n.plainObjects&&i.call(Object.prototype,a)&&!n.allowPrototypes)return;l.push(a)}for(var u=0;null!==(s=o.exec(r))&&u=0;--i){var o,s=t[i];if("[]"===s&&n.parseArrays)o=[].concat(r);else{o=n.plainObjects?Object.create(null):{};var a="["===s.charAt(0)&&"]"===s.charAt(s.length-1)?s.slice(1,-1):s,l=parseInt(a,10);n.parseArrays||""!==a?!isNaN(l)&&s!==a&&String(l)===a&&l>=0&&n.parseArrays&&l<=n.arrayLimit?(o=[])[l]=r:o[a]=r:o={0:r}}r=o}return r}(l,e,n)}};t.exports=function(t,e){var n=function(t){if(!t)return o;if(null!==t.decoder&&void 0!==t.decoder&&"function"!=typeof t.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==t.charset&&"utf-8"!==t.charset&&"iso-8859-1"!==t.charset)throw new Error("The charset option must be either utf-8, iso-8859-1, or undefined");var e=void 0===t.charset?o.charset:t.charset;return{allowDots:void 0===t.allowDots?o.allowDots:!!t.allowDots,allowPrototypes:"boolean"==typeof t.allowPrototypes?t.allowPrototypes:o.allowPrototypes,arrayLimit:"number"==typeof t.arrayLimit?t.arrayLimit:o.arrayLimit,charset:e,charsetSentinel:"boolean"==typeof t.charsetSentinel?t.charsetSentinel:o.charsetSentinel,comma:"boolean"==typeof t.comma?t.comma:o.comma,decoder:"function"==typeof t.decoder?t.decoder:o.decoder,delimiter:"string"==typeof t.delimiter||r.isRegExp(t.delimiter)?t.delimiter:o.delimiter,depth:"number"==typeof t.depth?t.depth:o.depth,ignoreQueryPrefix:!0===t.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof t.interpretNumericEntities?t.interpretNumericEntities:o.interpretNumericEntities,parameterLimit:"number"==typeof t.parameterLimit?t.parameterLimit:o.parameterLimit,parseArrays:!1!==t.parseArrays,plainObjects:"boolean"==typeof t.plainObjects?t.plainObjects:o.plainObjects,strictNullHandling:"boolean"==typeof t.strictNullHandling?t.strictNullHandling:o.strictNullHandling}}(e);if(""===t||null===t||void 0===t)return n.plainObjects?Object.create(null):{};for(var l="string"==typeof t?function(t,e){var n,a={},l=e.ignoreQueryPrefix?t.replace(/^\?/,""):t,u=e.parameterLimit===1/0?void 0:e.parameterLimit,c=l.split(e.delimiter,u),h=-1,d=e.charset;if(e.charsetSentinel)for(n=0;n-1&&(f=f.split(",")),i.call(a,p)?a[p]=r.combine(a[p],f):a[p]=f}return a}(t,n):t,u=n.plainObjects?Object.create(null):{},c=Object.keys(l),h=0;h0;)n=Math.random()*e|0,i(t,--e,n)}function i(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function o(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function s(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(t.length!==e.length)return!1;for(let n=0;ne):[].concat(t)).every(t=>t>=-n&&t`All values in axis param must be in range [-${n}, ${n}) but `+`got axis ${t}`),o(t.every(t=>a(t)),()=>"All values in axis param must be integers but "+`got axis ${t}`),t.map(t=>t<0?n+t:t)}function u(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray}function c(t){return"string"==typeof t||t instanceof String}function h(t){return"boolean"==typeof t}function d(t){return"number"==typeof t}function p(t,e,n=!1){if(0===t.length)return e[0];const r=t.reduce((t,e)=>t*e)*(n?2:1);if(0===r)return[];if(r!==e.length)throw new Error(`[${t}] does not match the input size ${e.length}${n?" for a complex tensor":""}.`);return function t(e,n,r,i=!1){const o=new Array;if(1===n.length){const t=n[0]*(i?2:1);for(let n=0;nt*e)*(i?2:1);for(let n=0;n0;)r=Math.random()*n|0,i(t,--n,r),i(e,n,r)},e.i=function(t,e,n){return Math.max(t,Math.min(e,n))},e.H=function(t){return t%2==0?t:t+1},e.S=i,e.R=function(t){let e=0;for(let n=0;nn+` Shapes ${t} and ${e} must match`)},e.d=function(t){o(null!=t,()=>"The input to the tensor constructor must be a non-null value.")},e.m=function t(e,n=[],r=!1){null==n&&(n=[]);if(Array.isArray(e)||u(e)&&!r)for(let i=0;i0),n){return new Promise((r,i)=>{let o=0;const s=()=>{if(t())return void r();const a=e(++o);null!=n&&o>=n?i():setTimeout(s,a)};s()})},e.s=function(t,e){let n=1,r=-1;for(let e=0;e=0)n*=t[e];else if(-1===t[e]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. "+`Found -1 at dim ${r} and dim ${e}`);r=e}else if(t[e]<0)throw Error(`Shapes can not be < 0. Found ${t[e]} at dim ${e}`);if(-1===r){if(e>0&&e!==n)throw Error(`Size(${e}) must match the product of shape ${t}`);return t}if(0===n)throw Error(`Cannot infer the missing size in [${t}] when `+"there are 0 elements");if(e%n!=0)throw Error("The implicit shape can't be a fractional number. "+`Got ${e} / ${n}`);const i=t.slice();return i[r]=e/n,i},e.I=l,e.Q=function(t,e){const n=[],r=[],i=null!=e&&Array.isArray(e)&&0===e.length,o=null==e||i?null:l(e,t).sort();let s=0;for(let e=0;ee)&&1===t[e]&&(n.push(t[e]),r.push(e)),o[s]<=e&&s++}1!==t[e]&&(n.push(t[e]),r.push(e))}return{newShape:n,keptDims:r}},e.o=function(t,e){let n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else{if("bool"!==t)throw new Error(`Unknown data type ${t}`);n=new Uint8Array(e)}return n},e.n=function(t,e){let n=null;if(null==t||"float32"===t)n=new Float32Array(e);else if("int32"===t)n=new Int32Array(e);else if("bool"===t)n=new Uint8Array(e);else{if("string"!==t)throw new Error(`Unknown data type ${t}`);n=new Array(e)}return n},e.h=function(t,e){for(let n=0;ne+=t.length),e},e.z=c,e.t=h,e.w=d,e.r=function t(e){if(Array.isArray(e))return t(e[0]);if(e instanceof Float32Array)return"float32";if(e instanceof Int32Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray)return"int32";if(d(e))return"float32";if(c(e))return"string";if(h(e))return"bool";return"float32"},e.u=function(t){return!!(t&&t.constructor&&t.call&&t.apply)},e.G=function(t,e){for(let n=e;n=0;--r)n[r]=n[r+1]*t[r+1];return n},e.U=p,e.D=function(t,e){const n=f(t,e);for(let t=0;tt*e,1);if(null==e||"float32"===e)return p(t,new Float32Array(n));if("int32"===e)return p(t,new Int32Array(n));if("bool"===e)return p(t,new Uint8Array(n));throw new Error(`Unknown data type ${e}`)},e.c=function(t){t.forEach(e=>{o(Number.isInteger(e)&&e>=0,()=>"Tensor must have a shape comprised of positive integers but got "+`shape [${t}].`)})},e.C=function(t,e,n){if(0===e)return 0;if(1===e)return t[0];let r=t[t.length-1];for(let e=0;et[e]);return[n,i]},e.e=function(t,e){const n=e.map(t=>1);return o(t,n,e)},e.a=function(t,e,n){r.assert(i(e,n),()=>`${t} supports only inner-most axes for now. `+`Got axes ${e} and rank-${n} input.`)},e.f=function(t,e){if(i(t,e))return null;const n=[];for(let r=0;rn.push(t)),n},e.h=function(t){return t.map((t,e)=>[e,t]).sort((t,e)=>t[1]-e[1]).map(t=>t[0])},e.g=function(t,e){const n=[];for(let r=e-t;r-1:t._q(t.model,t.trueLabel)},on:{change:[function(e){var n=t.model,r=e.target,i=r.checked?t.trueLabel:t.falseLabel;if(Array.isArray(n)){var o=t._i(n,null);r.checked?o<0&&(t.model=n.concat([null])):o>-1&&(t.model=n.slice(0,o).concat(n.slice(o+1)))}else t.model=i},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}}):n("input",{directives:[{name:"model",rawName:"v-model",value:t.model,expression:"model"}],staticClass:"el-checkbox__original",attrs:{type:"checkbox","aria-hidden":t.indeterminate?"true":"false",disabled:t.isDisabled,name:t.name},domProps:{value:t.label,checked:Array.isArray(t.model)?t._i(t.model,t.label)>-1:t.model},on:{change:[function(e){var n=t.model,r=e.target,i=!!r.checked;if(Array.isArray(n)){var o=t.label,s=t._i(n,o);r.checked?s<0&&(t.model=n.concat([o])):s>-1&&(t.model=n.slice(0,s).concat(n.slice(s+1)))}else t.model=i},t.handleChange],focus:function(e){t.focus=!0},blur:function(e){t.focus=!1}}})]),t.$slots.default||t.label?n("span",{staticClass:"el-checkbox__label"},[t._t("default"),t.$slots.default?t._e():[t._v(t._s(t.label))]],2):t._e()])};r._withStripped=!0;var i=n(4),o={name:"ElCheckbox",mixins:[n.n(i).a],inject:{elForm:{default:""},elFormItem:{default:""}},componentName:"ElCheckbox",data:function(){return{selfModel:!1,focus:!1,isLimitExceeded:!1}},computed:{model:{get:function(){return this.isGroup?this.store:void 0!==this.value?this.value:this.selfModel},set:function(t){this.isGroup?(this.isLimitExceeded=!1,void 0!==this._checkboxGroup.min&&t.lengththis._checkboxGroup.max&&(this.isLimitExceeded=!0),!1===this.isLimitExceeded&&this.dispatch("ElCheckboxGroup","input",[t])):(this.$emit("input",t),this.selfModel=t)}},isChecked:function(){return"[object Boolean]"==={}.toString.call(this.model)?this.model:Array.isArray(this.model)?this.model.indexOf(this.label)>-1:null!==this.model&&void 0!==this.model?this.model===this.trueLabel:void 0},isGroup:function(){for(var t=this.$parent;t;){if("ElCheckboxGroup"===t.$options.componentName)return this._checkboxGroup=t,!0;t=t.$parent}return!1},store:function(){return this._checkboxGroup?this._checkboxGroup.value:this.value},isLimitDisabled:function(){var t=this._checkboxGroup,e=t.max,n=t.min;return!(!e&&!n)&&this.model.length>=e&&!this.isChecked||this.model.length<=n&&this.isChecked},isDisabled:function(){return this.isGroup?this._checkboxGroup.disabled||this.disabled||(this.elForm||{}).disabled||this.isLimitDisabled:this.disabled||(this.elForm||{}).disabled},_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},checkboxSize:function(){var t=this.size||this._elFormItemSize||(this.$ELEMENT||{}).size;return this.isGroup&&this._checkboxGroup.checkboxGroupSize||t}},props:{value:{},label:{},indeterminate:Boolean,disabled:Boolean,checked:Boolean,name:String,trueLabel:[String,Number],falseLabel:[String,Number],id:String,controls:String,border:Boolean,size:String},methods:{addToStore:function(){Array.isArray(this.model)&&-1===this.model.indexOf(this.label)?this.model.push(this.label):this.model=this.trueLabel||!0},handleChange:function(t){var e=this;if(!this.isLimitExceeded){var n=void 0;n=t.target.checked?void 0===this.trueLabel||this.trueLabel:void 0!==this.falseLabel&&this.falseLabel,this.$emit("change",n,t),this.$nextTick(function(){e.isGroup&&e.dispatch("ElCheckboxGroup","change",[e._checkboxGroup.value])})}}},created:function(){this.checked&&this.addToStore()},mounted:function(){this.indeterminate&&this.$el.setAttribute("aria-controls",this.controls)},watch:{value:function(t){this.dispatch("ElFormItem","el.form.change",t)}}},s=n(0),a=Object(s.a)(o,r,[],!1,null,null,null);a.options.__file="packages/checkbox/src/checkbox.vue";var l=a.exports;l.install=function(t){t.component(l.name,l)};e.default=l},4:function(t,e){t.exports=n("fPll")}})},EKta:function(t,e,n){"use strict";e.byteLength=function(t){var e=u(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=u(t),s=r[0],a=r[1],l=new o(function(t,e,n){return 3*(e+n)/4-n}(0,s,a)),c=0,h=a>0?s-4:s;for(n=0;n>16&255,l[c++]=e>>8&255,l[c++]=255&e;2===a&&(e=i[t.charCodeAt(n)]<<2|i[t.charCodeAt(n+1)]>>4,l[c++]=255&e);1===a&&(e=i[t.charCodeAt(n)]<<10|i[t.charCodeAt(n+1)]<<4|i[t.charCodeAt(n+2)]>>2,l[c++]=e>>8&255,l[c++]=255&e);return l},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,o=[],s=0,a=n-i;sa?a:s+16383));1===i?(e=t[n-1],o.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],o.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,l=s.length;a0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,n){for(var i,o,s=[],a=e;a>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return s.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},EqBC:function(t,e,n){"use strict";var r=n("kM2E"),i=n("FeBl"),o=n("7KvD"),s=n("t8x9"),a=n("fJUb");r(r.P+r.R,"Promise",{finally:function(t){var e=s(this,i.Promise||o.Promise),n="function"==typeof t;return this.then(n?function(n){return a(e,t()).then(function(){return n})}:t,n?function(n){return a(e,t()).then(function(){throw n})}:t)}})},EqjI:function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},EuP9:function(t,e,n){"use strict";(function(t){ /*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT */ var r=n("EKta"),i=n("ujcs"),o=n("sOR5");function s(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(t,e){if(s()=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function f(t,e){if(l.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return U(t).length;default:if(r)return $(t).length;e=(""+e).toLowerCase(),r=!0}}function g(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function m(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=l.from(e,r)),l.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,l.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){var o,s=1,a=t.length,l=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;s=2,a/=2,l/=2,n/=2}function u(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(i){var c=-1;for(o=n;oa&&(n=a-l),o=n;o>=0;o--){for(var h=!0,d=0;di&&(r=i):r=i;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var s=0;s>8,i=n%256,o.push(i),o.push(r);return o}(e,t.length-n),t,n,r)}function w(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function C(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i239?4:u>223?3:u>191?2:1;if(i+h<=n)switch(h){case 1:u<128&&(c=u);break;case 2:128==(192&(o=t[i+1]))&&(l=(31&u)<<6|63&o)>127&&(c=l);break;case 3:o=t[i+1],s=t[i+2],128==(192&o)&&128==(192&s)&&(l=(15&u)<<12|(63&o)<<6|63&s)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:o=t[i+1],s=t[i+2],a=t[i+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(l=(15&u)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=h}return function(t){var e=t.length;if(e<=S)return String.fromCharCode.apply(String,t);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,n);case"utf8":case"utf-8":return C(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return w(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return R(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},l.prototype.equals=function(t){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===l.compare(this,t)},l.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),""},l.prototype.compare=function(t,e,n,r,i){if(!l.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(e>>>=0,n>>>=0,r>>>=0,i>>>=0,this===t)return 0;for(var o=i-r,s=n-e,a=Math.min(o,s),u=this.slice(r,i),c=t.slice(e,n),h=0;hi)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return _(this,t,e,n);case"ascii":return y(this,t,e,n);case"latin1":case"binary":return T(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var S=4096;function k(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;ir)&&(n=r);for(var i="",o=e;on)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,n,r,i,o){if(!l.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function D(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,o=Math.min(t.length-n,2);i>>8*(r?i:1-i)}function M(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,o=Math.min(t.length-n,4);i>>8*(r?i:3-i)&255}function L(t,e,n,r,i,o){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function P(t,e,n,r,o){return o||L(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,o){return o||L(t,0,n,8),i.write(t,e,n,r,52,8),n+8}l.prototype.slice=function(t,e){var n,r=this.length;if(t=~~t,e=void 0===e?r:~~e,t<0?(t+=r)<0&&(t=0):t>r&&(t=r),e<0?(e+=r)<0&&(e=0):e>r&&(e=r),e0&&(i*=256);)r+=this[t+--e]*i;return r},l.prototype.readUInt8=function(t,e){return e||A(t,1,this.length),this[t]},l.prototype.readUInt16LE=function(t,e){return e||A(t,2,this.length),this[t]|this[t+1]<<8},l.prototype.readUInt16BE=function(t,e){return e||A(t,2,this.length),this[t]<<8|this[t+1]},l.prototype.readUInt32LE=function(t,e){return e||A(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},l.prototype.readUInt32BE=function(t,e){return e||A(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},l.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=this[t],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*e)),r},l.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=e,i=1,o=this[t+--r];r>0&&(i*=256);)o+=this[t+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*e)),o},l.prototype.readInt8=function(t,e){return e||A(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},l.prototype.readInt16LE=function(t,e){e||A(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt16BE=function(t,e){e||A(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},l.prototype.readInt32LE=function(t,e){return e||A(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},l.prototype.readInt32BE=function(t,e){return e||A(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},l.prototype.readFloatLE=function(t,e){return e||A(t,4,this.length),i.read(this,t,!0,23,4)},l.prototype.readFloatBE=function(t,e){return e||A(t,4,this.length),i.read(this,t,!1,23,4)},l.prototype.readDoubleLE=function(t,e){return e||A(t,8,this.length),i.read(this,t,!0,52,8)},l.prototype.readDoubleBE=function(t,e){return e||A(t,8,this.length),i.read(this,t,!1,52,8)},l.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||N(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[e]=255&t;++o=0&&(o*=256);)this[e+i]=t/o&255;return e+n},l.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,1,255,0),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},l.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},l.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},l.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):M(this,t,e,!0),e+4},l.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},l.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);N(this,t,e,n,i-1,-i)}var o=0,s=1,a=0;for(this[e]=255&t;++o>0)-a&255;return e+n},l.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);N(this,t,e,n,i-1,-i)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},l.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,1,127,-128),l.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},l.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):D(this,t,e,!0),e+2},l.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):D(this,t,e,!1),e+2},l.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):M(this,t,e,!0),e+4},l.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||N(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),l.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):M(this,t,e,!1),e+4},l.prototype.writeFloatLE=function(t,e,n){return P(this,t,e,!0,n)},l.prototype.writeFloatBE=function(t,e,n){return P(this,t,e,!1,n)},l.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},l.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},l.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e=0;--i)t[i+e]=this[i+n];else if(o<1e3||!l.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(o=e;o55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function U(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function V(t,e,n,r){for(var i=0;i=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(e,n("DuR2"))},Ew4t:function(t,e,n){var r,i,o,s;s=function(t,e,n,r){ /** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */ "use strict";return t.setLocale(e),t.Blocks=t.Blocks||{},Object.keys(n).forEach(function(e){t.Blocks[e]=n[e]}),t.JavaScript=r,t},i=[n("xnUL"),n("yUki"),n("wTUY"),n("Cr6W")],void 0===(o="function"==typeof(r=s)?r.apply(e,i):r)||(t.exports=o)},F08B:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.json=[{tfOpName:"SparseFillEmptyRows",category:"sparse",inputs:[{start:0,name:"indices",type:"tensor"},{start:1,name:"values",type:"tensor"},{start:2,name:"denseShape",type:"tensor"},{start:3,name:"defaultValue",type:"tensor"}]},{tfOpName:"SparseReshape",category:"sparse",inputs:[{start:0,name:"inputIndices",type:"tensor"},{start:1,name:"inputShape",type:"tensor"},{start:2,name:"newShape",type:"tensor"}],attrs:[{tfName:"T",name:"dtype",type:"dtype",notSupported:!0}]},{tfOpName:"SparseSegmentMean",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]},{tfOpName:"SparseSegmentSum",category:"sparse",inputs:[{start:0,name:"data",type:"tensor"},{start:1,name:"indices",type:"tensor"},{start:2,name:"segmentIds",type:"tensor"}]}]},F6Ex:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.json=[{tfOpName:"Cast",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"SrcT",name:"sdtype",type:"dtype",notSupported:!0},{tfName:"DstT",name:"dtype",type:"dtype"}]},{tfOpName:"ExpandDims",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"axis",type:"number"}]},{tfOpName:"MirrorPad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"mode",name:"mode",type:"string"}]},{tfOpName:"Pad",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"}],attrs:[{tfName:"constant_value",name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"PadV2",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"padding",type:"number[]"},{start:2,name:"constantValue",type:"number",defaultValue:0}]},{tfOpName:"Reshape",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}]},{tfOpName:"Squeeze",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"axis",tfDeprecatedName:"squeeze_dims",name:"axis",type:"number[]"}]},{tfOpName:"SpaceToBatchND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"paddings",type:"number[]"}]},{tfOpName:"BatchToSpaceND",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"blockShape",type:"number[]"},{start:2,name:"crops",type:"number[]"}]},{tfOpName:"DepthToSpace",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"}],attrs:[{tfName:"block_size",name:"blockSize",type:"number"},{tfName:"data_format",name:"dataFormat",type:"string"}]},{tfOpName:"BroadcastTo",category:"transformation",inputs:[{start:0,name:"x",type:"tensor"},{start:1,name:"shape",type:"number[]"}],attrs:[]},{tfOpName:"BroadcastArgs",category:"transformation",inputs:[{start:0,name:"s0",type:"tensor"},{start:1,name:"s1",type:"tensor"}],attrs:[]}]},FUmq:function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("35G1");const a=Object(s.a)({sqrt_: /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t){const e={x:Object(o.a)(t,"x","sqrt","float32")};return r.a.runKernel(i._89,e)}});e.a=a},FeBl:function(t,e){var n=t.exports={version:"2.6.12"};"number"==typeof __e&&(__e=n)},FtD3:function(t,e,n){"use strict";var r=n("t8qj");t.exports=function(t,e,n,i,o){var s=new Error(t);return r(s,e,n,i,o)}},G6fb:function(t,e,n){"use strict";e.c=i,e.b=function(t,e,n){if(e.rank<1)throw new Error("tf.scatterND() expects the indices to be rank 1 or higher,"+` but the rank was ${e.rank}.`);if(t.rank<1)throw new Error("tf.scatterND() expects the updates to be rank 1 or higher,"+` but the rank was ${t.rank}.`);if("int32"!==e.dtype)throw new Error(`The dtype of 'indices' should be int32, but got dtype: ${e.dtype}`);if(n.length<1)throw new Error(`Output rank must be greater or equal to 1, but got shape: ${n}`);if(0===n.length){if(0===e.size)throw new Error(`Indices specified for empty output. indices shape: ${e.shape}`);if(0===t.size)throw new Error(`Updates specified for empty output. updates shape: ${t.shape}`)}i(n,e,t)},e.a=function(t,e,n){const i=e.shape.length,o=i>1?e.shape[i-1]:1,s=n.length;let a=1;for(let t=o;t1?e.shape[e.rank-1]:1,i=e.rank>1?e.rank-1:1,o="Must have updates.shape = indices.shape[:batchDim] + "+`shape[sliceDim:], got updates.shape: ${n.shape}`+`, indices.shape: ${e.shape}, shape: ${t}`+`, sliceDim: ${r}, and batchDim: ${i}.`;if(n.ranke&&0<=n&&256>n&&0<=r&&256>r)?t.utils.colour.rgbToHex(e,n,r):null},t.utils.colour.rgbToHex=function(t,e,n){return e=t<<16|e<<8|n,16>t?"#"+(16777216|e).toString(16).substr(1):"#"+e.toString(16)},t.utils.colour.hexToRgb=function(e){return(e=t.utils.colour.parse(e))?[(e=parseInt(e.substr(1),16))>>16,e>>8&255,255&e]:[0,0,0]},t.utils.colour.hsvToHex=function(e,n,r){var i=0,o=0,s=0;if(0==n)s=o=i=r;else{var a=Math.floor(e/60),l=e/60-a;e=r*(1-n);var u=r*(1-n*l);switch(n=r*(1-n*(1-l)),a){case 1:i=u,o=r,s=e;break;case 2:i=e,o=r,s=n;break;case 3:i=e,o=u,s=r;break;case 4:i=n,o=e,s=r;break;case 5:i=r,o=e,s=u;break;case 6:case 0:i=r,o=n,s=e}}return t.utils.colour.rgbToHex(Math.floor(i),Math.floor(o),Math.floor(s))},t.utils.colour.blend=function(e,n,r){return(e=t.utils.colour.parse(e))&&(n=t.utils.colour.parse(n))?(e=t.utils.colour.hexToRgb(e),n=t.utils.colour.hexToRgb(n),t.utils.colour.rgbToHex(Math.round(n[0]+r*(e[0]-n[0])),Math.round(n[1]+r*(e[1]-n[1])),Math.round(n[2]+r*(e[2]-n[2])))):null},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 n=t.x-e.x;return t=t.y-e.y,Math.sqrt(n*n+t*t)},t.utils.Coordinate.magnitude=function(t){return Math.sqrt(t.x*t.x+t.y*t.y)},t.utils.Coordinate.difference=function(e,n){return new t.utils.Coordinate(e.x-n.x,e.y-n.y)},t.utils.Coordinate.sum=function(e,n){return new t.utils.Coordinate(e.x+n.x,e.y+n.y)},t.utils.Coordinate.prototype.clone=function(){return new t.utils.Coordinate(this.x,this.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,n,r){this.top=t,this.bottom=e,this.left=n,this.right=r},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.rightt.bottom||this.bottomn&&(n=r[i].length);i=-1/0;var o=1;do{var s=i,a=e;e=[];var l=r.length/o,u=1;for(i=0;is);return a},t.utils.string.wrapScore_=function(t,e,n){for(var r=[0],i=[],o=0;oo&&(o=l,i=a)}return i?t.utils.string.wrapMutate_(e,i,r):n},t.utils.string.wrapToText_=function(t,e){for(var n=[],r=0;r=l?(o=2,s=l,(l=e.join(""))&&r.push(l),e.length=0):"{"==l?o=3:(e.push("%",l),o=0):2==o?"0"<=l&&"9">=l?s+=l:(r.push(parseInt(s,10)),a--,o=0):3==o&&(""==l?(e.splice(0,0,"%{"),a--,o=0):"}"!=l?e.push(l):(o=e.join(""),/[A-Z]\w*/i.test(o)?(l=o.toUpperCase(),(l=t.utils.string.startsWith(l,"BKY_")?l.substring(4):null)&&l in t.Msg?"string"==typeof(o=t.Msg[l])?Array.prototype.push.apply(r,t.utils.tokenizeInterpolation_(o,n)):n?r.push(String(o)):r.push(o):r.push("%{"+o+"}")):r.push("%{"+o+"}"),o=e.length=0))}for((l=e.join(""))&&r.push(l),n=[],a=e.length=0;ar;r++)n[r]=t.utils.genUid.soup_.charAt(Math.random()*e);return n.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 e=document.createElement("p"),n="none",r={webkitTransform:"-webkit-transform",OTransform:"-o-transform",msTransform:"-ms-transform",MozTransform:"-moz-transform",transform:"transform"};for(var i in document.body.insertBefore(e,null),r)if(void 0!==e.style[i]){if(e.style[i]="translate3d(1px,1px,1px)",!(n=t.utils.global.getComputedStyle(e)))return document.body.removeChild(e),!1;n=n.getPropertyValue(r[i])}return document.body.removeChild(e),t.utils.is3dSupported.cached_="none"!==n,t.utils.is3dSupported.cached_},t.utils.runAfterPageLoad=function(t){if("object"!=typeof document)throw Error("Blockly.utils.runAfterPageLoad() requires browser document.");if("complete"==document.readyState)t();else var e=setInterval(function(){"complete"==document.readyState&&(clearInterval(e),t())},10)},t.utils.getViewportBBox=function(){var e=t.utils.style.getViewportPageOffset();return new t.utils.Rect(e.y,document.documentElement.clientHeight+e.y,e.x,document.documentElement.clientWidth+e.x)},t.utils.arrayRemove=function(t,e){return-1!=(e=t.indexOf(e))&&(t.splice(e,1),!0)},t.utils.getDocumentScroll=function(){var e=document.documentElement,n=window;return t.utils.userAgent.IE&&n.pageYOffset!=e.scrollTop?new t.utils.Coordinate(e.scrollLeft,e.scrollTop):new t.utils.Coordinate(n.pageXOffset||e.scrollLeft,n.pageYOffset||e.scrollTop)},t.utils.getBlockTypeCounts=function(t,e){var n=Object.create(null),r=t.getDescendants(!0);for(e&&(t=t.getNextBlock())&&(t=r.indexOf(t),r.splice(t,r.length-t)),t=0;e=r[t];t++)n[e.type]?n[e.type]++:n[e.type]=1;return n},t.utils.screenToWsCoordinates=function(e,n){var r=n.x;n=n.y;var i=e.getInjectionDiv().getBoundingClientRect();return r=new t.utils.Coordinate(r-i.left,n-i.top),n=e.getOriginOffsetInPixels(),t.utils.Coordinate.difference(r,n).scale(1/e.scale)},t.utils.parseBlockColour=function(e){var n="string"==typeof e?t.utils.replaceMessageReferences(e):e,r=Number(n);if(!isNaN(r)&&0<=r&&360>=r)return{hue:r,hex:t.utils.colour.hsvToHex(r,t.HSV_SATURATION,255*t.HSV_VALUE)};if(r=t.utils.colour.parse(n))return{hue:null,hex:r};throw r='Invalid colour: "'+n+'"',e!=n&&(r+=' (from "'+e+'")'),Error(r)},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(e,n){t.longStop_(),e.changedTouches&&1!=e.changedTouches.length||(t.longPid_=setTimeout(function(){e.changedTouches&&(e.button=2,e.clientX=e.changedTouches[0].clientX,e.clientY=e.changedTouches[0].clientY),n&&n.handleRightClick(e)},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(e){return!t.Touch.isMouseOrTouchEvent(e)||t.Touch.checkTouchIdentifier(e)},t.Touch.getTouchIdentifierFromEvent=function(t){return void 0!=t.pointerId?t.pointerId:t.changedTouches&&t.changedTouches[0]&&void 0!==t.changedTouches[0].identifier&&null!==t.changedTouches[0].identifier?t.changedTouches[0].identifier:"mouse"},t.Touch.checkTouchIdentifier=function(e){var n=t.Touch.getTouchIdentifierFromEvent(e);return void 0!==t.Touch.touchIdentifier_&&null!==t.Touch.touchIdentifier_?t.Touch.touchIdentifier_==n:("mousedown"==e.type||"touchstart"==e.type||"pointerdown"==e.type)&&(t.Touch.touchIdentifier_=n,!0)},t.Touch.setClientFromTouch=function(e){if(t.utils.string.startsWith(e.type,"touch")){var n=e.changedTouches[0];e.clientX=n.clientX,e.clientY=n.clientY}},t.Touch.isMouseOrTouchEvent=function(e){return t.utils.string.startsWith(e.type,"touch")||t.utils.string.startsWith(e.type,"mouse")||t.utils.string.startsWith(e.type,"pointer")},t.Touch.isTouchEvent=function(e){return t.utils.string.startsWith(e.type,"touch")||t.utils.string.startsWith(e.type,"pointer")},t.Touch.splitEventByTouches=function(t){var e=[];if(t.changedTouches)for(var n=0;no.top?t.DropDownDiv.getPositionAboveMetrics_(r,i,o,s):n+s.heightdocument.documentElement.clientTop?t.DropDownDiv.getPositionAboveMetrics_(r,i,o,s):t.DropDownDiv.getPositionTopOfPageMetrics_(e,o,s)},t.DropDownDiv.getPositionBelowMetrics_=function(e,n,r,i){return{initialX:(e=t.DropDownDiv.getPositionX(e,r.left,r.right,i.width)).divX,initialY:n,finalX:e.divX,finalY:n+t.DropDownDiv.PADDING_Y,arrowX:e.arrowX,arrowY:-(t.DropDownDiv.ARROW_SIZE/2+t.DropDownDiv.BORDER_SIZE),arrowAtTop:!0,arrowVisible:!0}},t.DropDownDiv.getPositionAboveMetrics_=function(e,n,r,i){return{initialX:(e=t.DropDownDiv.getPositionX(e,r.left,r.right,i.width)).divX,initialY:n-i.height,finalX:e.divX,finalY:n-i.height-t.DropDownDiv.PADDING_Y,arrowX:e.arrowX,arrowY:i.height-2*t.DropDownDiv.BORDER_SIZE-t.DropDownDiv.ARROW_SIZE/2,arrowAtTop:!1,arrowVisible:!0}},t.DropDownDiv.getPositionTopOfPageMetrics_=function(e,n,r){return{initialX:(e=t.DropDownDiv.getPositionX(e,n.left,n.right,r.width)).divX,initialY:0,finalX:e.divX,finalY:0,arrowAtTop:null,arrowX:null,arrowY:null,arrowVisible:!1}},t.DropDownDiv.getPositionX=function(e,n,r,i){var o=e;return e=t.utils.math.clamp(n,e-i/2,r-i),o-=t.DropDownDiv.ARROW_SIZE/2,n=t.DropDownDiv.ARROW_HORIZONTAL_PADDING,{arrowX:i=t.utils.math.clamp(n,o-e,i-n-t.DropDownDiv.ARROW_SIZE),divX:e}},t.DropDownDiv.isVisible=function(){return!!t.DropDownDiv.owner_},t.DropDownDiv.hideIfOwner=function(e,n){return t.DropDownDiv.owner_===e&&(n?t.DropDownDiv.hideWithoutAnimation():t.DropDownDiv.hide(),!0)},t.DropDownDiv.hide=function(){var e=t.DropDownDiv.DIV_;e.style.transform="translate(0, 0)",e.style.opacity=0,t.DropDownDiv.animateOutTimer_=setTimeout(function(){t.DropDownDiv.hideWithoutAnimation()},1e3*t.DropDownDiv.ANIMATION_TIME),t.DropDownDiv.onHide_&&(t.DropDownDiv.onHide_(),t.DropDownDiv.onHide_=null)},t.DropDownDiv.hideWithoutAnimation=function(){if(t.DropDownDiv.isVisible()){t.DropDownDiv.animateOutTimer_&&clearTimeout(t.DropDownDiv.animateOutTimer_);var e=t.DropDownDiv.DIV_;e.style.transform="",e.style.left="",e.style.top="",e.style.opacity=0,e.style.display="none",e.style.backgroundColor="",e.style.borderColor="",t.DropDownDiv.onHide_&&(t.DropDownDiv.onHide_(),t.DropDownDiv.onHide_=null),t.DropDownDiv.clearContent(),t.DropDownDiv.owner_=null,t.DropDownDiv.rendererClassName_&&(t.utils.dom.removeClass(e,t.DropDownDiv.rendererClassName_),t.DropDownDiv.rendererClassName_=""),t.DropDownDiv.themeClassName_&&(t.utils.dom.removeClass(e,t.DropDownDiv.themeClassName_),t.DropDownDiv.themeClassName_=""),t.getMainWorkspace().markFocused()}},t.DropDownDiv.positionInternal_=function(e,n,r,i){(e=t.DropDownDiv.getPositionMetrics_(e,n,r,i)).arrowVisible?(t.DropDownDiv.arrow_.style.display="",t.DropDownDiv.arrow_.style.transform="translate("+e.arrowX+"px,"+e.arrowY+"px) rotate(45deg)",t.DropDownDiv.arrow_.setAttribute("class",e.arrowAtTop?"blocklyDropDownArrow blocklyArrowTop":"blocklyDropDownArrow blocklyArrowBottom")):t.DropDownDiv.arrow_.style.display="none",n=Math.floor(e.initialX),r=Math.floor(e.initialY),i=Math.floor(e.finalX);var o=Math.floor(e.finalY),s=t.DropDownDiv.DIV_;return s.style.left=n+"px",s.style.top=r+"px",s.style.display="block",s.style.opacity=1,s.style.transform="translate("+(i-n)+"px,"+(o-r)+"px)",!!e.arrowAtTop},t.DropDownDiv.repositionForWindowResize=function(){if(t.DropDownDiv.owner_){var e=t.DropDownDiv.owner_,n=e.getSourceBlock();n=(e=t.DropDownDiv.positionToField_?t.DropDownDiv.getScaledBboxOfField_(e):t.DropDownDiv.getScaledBboxOfBlock_(n)).left+(e.right-e.left)/2,t.DropDownDiv.positionInternal_(n,e.bottom,n,e.top)}else t.DropDownDiv.hide()},t.registry={},t.registry.typeMap_=Object.create(null),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.Type.BLOCK_DRAGGER=new t.registry.Type("blockDragger"),t.registry.register=function(e,n,r,i){if(!(e instanceof t.registry.Type)&&"string"!=typeof e||""==String(e).trim())throw Error('Invalid type "'+e+'". The type must be a non-empty string or a Blockly.registry.Type.');if(e=String(e).toLowerCase(),"string"!=typeof n||""==n.trim())throw Error('Invalid name "'+n+'". The name must be a non-empty string.');if(n=n.toLowerCase(),!r)throw Error("Can not register a null value");var o=t.registry.typeMap_[e];if(o||(o=t.registry.typeMap_[e]=Object.create(null)),t.registry.validate_(e,r),!i&&o[n])throw Error('Name "'+n+'" with type "'+e+'" already registered.');o[n]=r},t.registry.validate_=function(e,n){switch(e){case String(t.registry.Type.FIELD):if("function"!=typeof n.fromJson)throw Error('Type "'+e+'" must have a fromJson function')}},t.registry.unregister=function(e,n){e=String(e).toLowerCase(),n=n.toLowerCase();var r=t.registry.typeMap_[e];r&&r[n]?delete t.registry.typeMap_[e][n]:console.warn("Unable to unregister ["+n+"]["+e+"] from the registry.")},t.registry.getItem_=function(e,n,r){e=String(e).toLowerCase(),n=n.toLowerCase();var i=t.registry.typeMap_[e];if(!i||!i[n]){if(n="Unable to find ["+n+"]["+e+"] in the registry.",r)throw Error(n+" You must require or register a "+e+" plugin.");return console.warn(n),null}return i[n]},t.registry.hasItem=function(e,n){return e=String(e).toLowerCase(),n=n.toLowerCase(),!!(e=t.registry.typeMap_[e])&&!!e[n]},t.registry.getClass=function(e,n,r){return t.registry.getItem_(e,n,r)},t.registry.getObject=function(e,n,r){return t.registry.getItem_(e,n,r)},t.registry.getClassFromOptions=function(e,n,r){return"function"==typeof(n=n.plugins[e.toString()]||t.registry.DEFAULT)?n:t.registry.getClass(e,n,r)},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(e){t.Events.isEnabled()&&(t.Events.FIRE_QUEUE_.length||setTimeout(t.Events.fireNow_,0),t.Events.FIRE_QUEUE_.push(e))},t.Events.fireNow_=function(){for(var e,n=t.Events.filter(t.Events.FIRE_QUEUE_,!0),r=t.Events.FIRE_QUEUE_.length=0;e=n[r];r++)if(e.workspaceId){var i=t.Workspace.getById(e.workspaceId);i&&i.fireChangeListener(e)}},t.Events.filter=function(e,n){e=e.slice(),n||e.reverse();for(var r,i=[],o=Object.create(null),s=0;r=e[s];s++)if(!r.isNull()){var a=[r.isUiEvent?t.Events.UI:r.type,r.blockId,r.workspaceId].join(" "),l=o[a],u=l?l.event:null;l?r.type==t.Events.MOVE&&l.index==s-1?(u.newParentId=r.newParentId,u.newInputName=r.newInputName,u.newCoordinate=r.newCoordinate,l.index=s):r.type==t.Events.CHANGE&&r.element==u.element&&r.name==u.name?u.newValue=r.newValue:r.type==t.Events.VIEWPORT_CHANGE?(u.viewTop=r.viewTop,u.viewLeft=r.viewLeft,u.scale=r.scale,u.oldScale=r.oldScale):r.type==t.Events.CLICK&&u.type==t.Events.BUBBLE_OPEN||(o[a]={event:r,index:s},i.push(r)):(o[a]={event:r,index:s},i.push(r))}for(e=i.filter(function(t){return!t.isNull()}),n||e.reverse(),s=1;r=e[s];s++)r.type==t.Events.CHANGE&&"mutation"==r.element&&e.unshift(e.splice(s,1)[0]);return e},t.Events.clearPendingUndo=function(){for(var e,n=0;e=t.Events.FIRE_QUEUE_[n];n++)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(e){t.Events.group_="boolean"==typeof e?e?t.utils.genUid():"":e},t.Events.getDescendantIds=function(t){var e=[];t=t.getDescendants(!1);for(var n,r=0;n=t[r];r++)e[r]=n.id;return e},t.Events.fromJson=function(e,n){var r=t.Events.get(e.type);if(!r)throw Error("Unknown event type.");return(r=new r).fromJson(e),r.workspaceId=n.id,r},t.Events.get=function(e){return t.registry.getClass(t.registry.Type.EVENT,e)},t.Events.disableOrphans=function(e){if((e.type==t.Events.MOVE||e.type==t.Events.CREATE)&&e.workspaceId){var n=t.Workspace.getById(e.workspaceId),r=n.getBlockById(e.blockId);if(r){e=t.Events.recordUndo;try{t.Events.recordUndo=!1;var i=r.getParent();if(i&&i.isEnabled()){var o,s=r.getDescendants(!1);for(n=0;o=s[n];n++)o.setEnabled(!0)}else if((r.outputConnection||r.previousConnection)&&!n.isDragging())do{r.setEnabled(!1),r=r.getNextBlock()}while(r)}finally{t.Events.recordUndo=e}}}},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(){if(this.workspaceId)var e=t.Workspace.getById(this.workspaceId);if(!e)throw Error("Workspace is null. Event must have been generated from real Blockly events.");return e},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 n in e)t[n]=e[n]},t.utils.object.deepMerge=function(e,n){for(var r in n)e[r]=null!=n[r]&&"object"==typeof n[r]?t.utils.object.deepMerge(e[r]||Object.create(null),n[r]):n[r];return e},t.utils.object.values=function(t){return Object.values?Object.values(t):Object.keys(t).map(function(e){return t[e]})},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(e){return t.utils.xml.document().createElementNS(t.utils.xml.NAME_SPACE,e)},t.utils.xml.createTextNode=function(e){return t.utils.xml.document().createTextNode(e)},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.Xml={},t.Xml.workspaceToDom=function(e,n){var r=t.utils.xml.createElement("xml"),i=t.Xml.variablesToDom(t.Variables.allUsedVarModels(e));i.hasChildNodes()&&r.appendChild(i);var o,s=e.getTopComments(!0);for(i=0;o=s[i];i++)r.appendChild(o.toXmlWithXY(n));for(e=e.getTopBlocks(!0),i=0;s=e[i];i++)r.appendChild(t.Xml.blockToDomWithXY(s,n));return r},t.Xml.variablesToDom=function(e){for(var n,r=t.utils.xml.createElement("variables"),i=0;n=e[i];i++){var o=t.utils.xml.createElement("variable");o.appendChild(t.utils.xml.createTextNode(n.name)),n.type&&o.setAttribute("type",n.type),o.id=n.getId(),r.appendChild(o)}return r},t.Xml.blockToDomWithXY=function(e,n){if(e.isInsertionMarker()&&!(e=e.getChildren(!1)[0]))return new DocumentFragment;var r;e.workspace.RTL&&(r=e.workspace.getWidth()),n=t.Xml.blockToDom(e,n);var i=e.getRelativeToSurfaceXY();return n.setAttribute("x",Math.round(e.workspace.RTL?r-i.x:i.x)),n.setAttribute("y",Math.round(i.y)),n},t.Xml.fieldToDom_=function(e){if(e.isSerializable()){var n=t.utils.xml.createElement("field");return n.setAttribute("name",e.name||""),e.toXml(n)}return null},t.Xml.allFieldsToDom_=function(e,n){for(var r,i=0;r=e.inputList[i];i++)for(var o,s=0;o=r.fieldRow[s];s++)(o=t.Xml.fieldToDom_(o))&&n.appendChild(o)},t.Xml.blockToDom=function(e,n){if(e.isInsertionMarker())return(e=e.getChildren(!1)[0])?t.Xml.blockToDom(e):new DocumentFragment;var r=t.utils.xml.createElement(e.isShadow()?"shadow":"block");if(r.setAttribute("type",e.type),n||r.setAttribute("id",e.id),e.mutationToDom){var i=e.mutationToDom();i&&(i.hasChildNodes()||i.hasAttributes())&&r.appendChild(i)}if(t.Xml.allFieldsToDom_(e,r),i=e.getCommentText()){var o=e.commentModel.size,s=e.commentModel.pinned,a=t.utils.xml.createElement("comment");a.appendChild(t.utils.xml.createTextNode(i)),a.setAttribute("pinned",s),a.setAttribute("h",o.height),a.setAttribute("w",o.width),r.appendChild(a)}for(e.data&&((i=t.utils.xml.createElement("data")).appendChild(t.utils.xml.createTextNode(e.data)),r.appendChild(i)),i=0;o=e.inputList[i];i++){var l;if(s=!0,o.type!=t.inputTypes.DUMMY){var u=o.connection.targetBlock();o.type==t.inputTypes.VALUE?l=t.utils.xml.createElement("value"):o.type==t.inputTypes.STATEMENT&&(l=t.utils.xml.createElement("statement")),!(a=o.connection.getShadowDom())||u&&u.isShadow()||l.appendChild(t.Xml.cloneShadow_(a,n)),u&&((a=t.Xml.blockToDom(u,n)).nodeType==t.utils.dom.NodeType.ELEMENT_NODE&&(l.appendChild(a),s=!1)),l.setAttribute("name",o.name),s||r.appendChild(l)}}return void 0!=e.inputsInline&&e.inputsInline!=e.inputsInlineDefault&&r.setAttribute("inline",e.inputsInline),e.isCollapsed()&&r.setAttribute("collapsed",!0),e.isEnabled()||r.setAttribute("disabled",!0),e.isDeletable()||e.isShadow()||r.setAttribute("deletable",!1),e.isMovable()||e.isShadow()||r.setAttribute("movable",!1),e.isEditable()||r.setAttribute("editable",!1),(i=e.getNextBlock())&&((a=t.Xml.blockToDom(i,n)).nodeType==t.utils.dom.NodeType.ELEMENT_NODE&&((l=t.utils.xml.createElement("next")).appendChild(a),r.appendChild(l))),!(a=e.nextConnection&&e.nextConnection.getShadowDom())||i&&i.isShadow()||l.appendChild(t.Xml.cloneShadow_(a,n)),r},t.Xml.cloneShadow_=function(e,n){for(var r,i=e=e.cloneNode(!0);i;)if(n&&"shadow"==i.nodeName&&i.removeAttribute("id"),i.firstChild)i=i.firstChild;else{for(;i&&!i.nextSibling;)r=i,i=i.parentNode,r.nodeType==t.utils.dom.NodeType.TEXT_NODE&&""==r.data.trim()&&i.firstChild!=r&&t.utils.dom.removeNode(r);i&&(r=i,i=i.nextSibling,r.nodeType==t.utils.dom.NodeType.TEXT_NODE&&""==r.data.trim()&&t.utils.dom.removeNode(r))}return e},t.Xml.domToText=function(e){return t.utils.xml.domToText(e).replace(/<(\w+)([^<]*)\/>/g,"<$1$2>")},t.Xml.domToPrettyText=function(e){e=t.Xml.domToText(e).split("<");for(var n="",r=1;r"!=i.slice(-2)&&(n+=" ")}return(e=(e=e.join("\n")).replace(/(<(\w+)\b[^>]*>[^\n]*)\n *<\/\2>/g,"$1")).replace(/^\n/,"")},t.Xml.textToDom=function(e){var n=t.utils.xml.textToDomDocument(e);if(!n||!n.documentElement||n.getElementsByTagName("parsererror").length)throw Error("textToDom was unable to parse: "+e);return n.documentElement},t.Xml.clearWorkspaceAndLoadFromXml=function(e,n){return n.setResizesEnabled(!1),n.clear(),e=t.Xml.domToWorkspace(e,n),n.setResizesEnabled(!0),e},t.Xml.domToWorkspace=function(e,n){if(e instanceof t.Workspace){var r=e;e=n,n=r,console.warn("Deprecated call to Blockly.Xml.domToWorkspace, swap the arguments.")}var i;n.RTL&&(i=n.getWidth()),r=[],t.utils.dom.startTextWidthCache();var o=t.Events.getGroup();o||t.Events.setGroup(!0),n.setResizesEnabled&&n.setResizesEnabled(!1);var s=!0;try{for(var a,l=0;a=e.childNodes[l];l++){var u=a.nodeName.toLowerCase(),c=a;if("block"==u||"shadow"==u&&!t.Events.recordUndo){var h=t.Xml.domToBlock(c,n);r.push(h.id);var d=c.hasAttribute("x")?parseInt(c.getAttribute("x"),10):10,p=c.hasAttribute("y")?parseInt(c.getAttribute("y"),10):10;isNaN(d)||isNaN(p)||h.moveBy(n.RTL?i-d:d,p),s=!1}else{if("shadow"==u)throw TypeError("Shadow block cannot be a top-level block.");if("comment"==u)n.rendered?t.WorkspaceCommentSvg?t.WorkspaceCommentSvg.fromXml(c,n,i):console.warn("Missing require for Blockly.WorkspaceCommentSvg, ignoring workspace comment."):t.WorkspaceComment?t.WorkspaceComment.fromXml(c,n):console.warn("Missing require for Blockly.WorkspaceComment, ignoring workspace comment.");else if("variables"==u){if(!s)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,n),s=!1}}}}finally{o||t.Events.setGroup(!1),t.utils.dom.stopTextWidthCache()}return n.setResizesEnabled&&n.setResizesEnabled(!0),t.Events.fire(new(t.Events.get(t.Events.FINISHED_LOADING))(n)),r},t.Xml.appendDomToWorkspace=function(e,n){var r;if(Object.prototype.hasOwnProperty.call(n,"scale")&&(r=n.getBlocksBoundingBox()),e=t.Xml.domToWorkspace(e,n),r&&r.top!=r.bottom){var i=r.bottom,o=n.RTL?r.right:r.left,s=1/0,a=-1/0,l=1/0;for(r=0;ra&&(a=u.x)}for(i=i-l+10,o=n.RTL?o-a:o-s,r=0;r");n.domToMutation(i)}t.Events.fire(new t.Events.BlockChange(n,"mutation",null,r,e));break;default:console.warn("Unknown change type: "+this.element)}else console.warn("Can't change non-existent block: "+this.blockId)},t.Events.Create=function(e){t.Events.Create.superClass_.constructor.call(this,e),e&&(e.isShadow()&&(this.recordUndo=!1),this.xml=e.workspace.rendered?t.Xml.blockToDomWithXY(e):t.Xml.blockToDom(e),this.ids=t.Events.getDescendantIds(e))},t.utils.object.inherits(t.Events.Create,t.Events.BlockBase),t.Events.BlockCreate=t.Events.Create,t.Events.Create.prototype.type=t.Events.CREATE,t.Events.Create.prototype.toJson=function(){var e=t.Events.Create.superClass_.toJson.call(this);return e.xml=t.Xml.domToText(this.xml),e.ids=this.ids,this.recordUndo||(e.recordUndo=this.recordUndo),e},t.Events.Create.prototype.fromJson=function(e){t.Events.Create.superClass_.fromJson.call(this,e),this.xml=t.Xml.textToDom(e.xml),this.ids=e.ids,void 0!==e.recordUndo&&(this.recordUndo=e.recordUndo)},t.Events.Create.prototype.run=function(e){var n=this.getEventWorkspace_();if(e)(e=t.utils.xml.createElement("xml")).appendChild(this.xml),t.Xml.domToWorkspace(e,n);else{e=0;for(var r;r=this.ids[e];e++){var i=n.getBlockById(r);i?i.dispose(!1):r==this.blockId&&console.warn("Can't uncreate non-existent block: "+r)}}},t.Events.Delete=function(e){if(t.Events.Delete.superClass_.constructor.call(this,e),e){if(e.getParent())throw Error("Connected blocks cannot be deleted.");e.isShadow()&&(this.recordUndo=!1),this.oldXml=e.workspace.rendered?t.Xml.blockToDomWithXY(e):t.Xml.blockToDom(e),this.ids=t.Events.getDescendantIds(e)}},t.utils.object.inherits(t.Events.Delete,t.Events.BlockBase),t.Events.BlockDelete=t.Events.Delete,t.Events.Delete.prototype.type=t.Events.DELETE,t.Events.Delete.prototype.toJson=function(){var e=t.Events.Delete.superClass_.toJson.call(this);return e.oldXml=t.Xml.domToText(this.oldXml),e.ids=this.ids,this.recordUndo||(e.recordUndo=this.recordUndo),e},t.Events.Delete.prototype.fromJson=function(e){t.Events.Delete.superClass_.fromJson.call(this,e),this.oldXml=t.Xml.textToDom(e.oldXml),this.ids=e.ids,void 0!==e.recordUndo&&(this.recordUndo=e.recordUndo)},t.Events.Delete.prototype.run=function(e){var n=this.getEventWorkspace_();if(e){e=0;for(var r;r=this.ids[e];e++){var i=n.getBlockById(r);i?i.dispose(!1):r==this.blockId&&console.warn("Can't delete non-existent block: "+r)}}else(e=t.utils.xml.createElement("xml")).appendChild(this.oldXml),t.Xml.domToWorkspace(e,n)},t.Events.Move=function(e){t.Events.Move.superClass_.constructor.call(this,e),e&&(e.isShadow()&&(this.recordUndo=!1),e=this.currentLocation_(),this.oldParentId=e.parentId,this.oldInputName=e.inputName,this.oldCoordinate=e.coordinate)},t.utils.object.inherits(t.Events.Move,t.Events.BlockBase),t.Events.BlockMove=t.Events.Move,t.Events.Move.prototype.type=t.Events.MOVE,t.Events.Move.prototype.toJson=function(){var e=t.Events.Move.superClass_.toJson.call(this);return this.newParentId&&(e.newParentId=this.newParentId),this.newInputName&&(e.newInputName=this.newInputName),this.newCoordinate&&(e.newCoordinate=Math.round(this.newCoordinate.x)+","+Math.round(this.newCoordinate.y)),this.recordUndo||(e.recordUndo=this.recordUndo),e},t.Events.Move.prototype.fromJson=function(e){if(t.Events.Move.superClass_.fromJson.call(this,e),this.newParentId=e.newParentId,this.newInputName=e.newInputName,e.newCoordinate){var n=e.newCoordinate.split(",");this.newCoordinate=new t.utils.Coordinate(Number(n[0]),Number(n[1]))}void 0!==e.recordUndo&&(this.recordUndo=e.recordUndo)},t.Events.Move.prototype.recordNew=function(){var t=this.currentLocation_();this.newParentId=t.parentId,this.newInputName=t.inputName,this.newCoordinate=t.coordinate},t.Events.Move.prototype.currentLocation_=function(){var t=this.getEventWorkspace_().getBlockById(this.blockId),e={},n=t.getParent();return n?(e.parentId=n.id,(t=n.getInputWithBlock(t))&&(e.inputName=t.name)):e.coordinate=t.getRelativeToSurfaceXY(),e},t.Events.Move.prototype.isNull=function(){return this.oldParentId==this.newParentId&&this.oldInputName==this.newInputName&&t.utils.Coordinate.equals(this.oldCoordinate,this.newCoordinate)},t.Events.Move.prototype.run=function(e){var n=this.getEventWorkspace_(),r=n.getBlockById(this.blockId);if(r){var i=e?this.newParentId:this.oldParentId,o=e?this.newInputName:this.oldInputName,s=e?this.newCoordinate:this.oldCoordinate;if(e=null,i&&!(e=n.getBlockById(i)))return void console.warn("Can't connect to non-existent block: "+i);if(r.getParent()&&r.unplug(),s)o=r.getRelativeToSurfaceXY(),r.moveBy(s.x-o.x,s.y-o.y);else{if(n=(r=r.outputConnection||r.previousConnection).type,o){if(e=e.getInput(o))var a=e.connection}else n==t.connectionTypes.PREVIOUS_STATEMENT&&(a=e.nextConnection);a?r.connect(a):console.warn("Can't connect to non-existent input: "+o)}}else console.warn("Can't move non-existent block: "+this.blockId)},t.registry.register(t.registry.Type.EVENT,t.Events.CREATE,t.Events.Create),t.registry.register(t.registry.Type.EVENT,t.Events.DELETE,t.Events.Delete),t.registry.register(t.registry.Type.EVENT,t.Events.CHANGE,t.Events.BlockChange),t.registry.register(t.registry.Type.EVENT,t.Events.MOVE,t.Events.Move),t.Events.FinishedLoading=function(e){this.isBlank=void 0===e,this.workspaceId=e?e.id:"",this.group=t.Events.getGroup(),this.recordUndo=!1},t.utils.object.inherits(t.Events.FinishedLoading,t.Events.Abstract),t.Events.FinishedLoading.prototype.type=t.Events.FINISHED_LOADING,t.Events.FinishedLoading.prototype.toJson=function(){var t={type:this.type};return this.group&&(t.group=this.group),this.workspaceId&&(t.workspaceId=this.workspaceId),t},t.Events.FinishedLoading.prototype.fromJson=function(t){this.isBlank=!1,this.workspaceId=t.workspaceId,this.group=t.group},t.registry.register(t.registry.Type.EVENT,t.Events.FINISHED_LOADING,t.Events.FinishedLoading),t.Events.UiBase=function(e){t.Events.UiBase.superClass_.constructor.call(this),this.isBlank=void 0===e,this.workspaceId=e||"",this.recordUndo=!1},t.utils.object.inherits(t.Events.UiBase,t.Events.Abstract),t.Events.UiBase.prototype.isUiEvent=!0,t.Events.Ui=function(e,n,r,i){t.Events.Ui.superClass_.constructor.call(this,e?e.workspace.id:void 0),this.blockId=e?e.id:null,this.element=void 0===n?"":n,this.oldValue=void 0===r?"":r,this.newValue=void 0===i?"":i},t.utils.object.inherits(t.Events.Ui,t.Events.UiBase),t.Events.Ui.prototype.type=t.Events.UI,t.Events.Ui.prototype.toJson=function(){var e=t.Events.Ui.superClass_.toJson.call(this);return e.element=this.element,void 0!==this.newValue&&(e.newValue=this.newValue),this.blockId&&(e.blockId=this.blockId),e},t.Events.Ui.prototype.fromJson=function(e){t.Events.Ui.superClass_.fromJson.call(this,e),this.element=e.element,this.newValue=e.newValue,this.blockId=e.blockId},t.registry.register(t.registry.Type.EVENT,t.Events.UI,t.Events.Ui),t.Events.VarBase=function(e){t.Events.VarBase.superClass_.constructor.call(this),this.varId=(this.isBlank=void 0===e)?"":e.getId(),this.workspaceId=this.isBlank?"":e.workspace.id},t.utils.object.inherits(t.Events.VarBase,t.Events.Abstract),t.Events.VarBase.prototype.toJson=function(){var e=t.Events.VarBase.superClass_.toJson.call(this);return e.varId=this.varId,e},t.Events.VarBase.prototype.fromJson=function(e){t.Events.VarBase.superClass_.toJson.call(this),this.varId=e.varId},t.Events.VarCreate=function(e){t.Events.VarCreate.superClass_.constructor.call(this,e),e&&(this.varType=e.type,this.varName=e.name)},t.utils.object.inherits(t.Events.VarCreate,t.Events.VarBase),t.Events.VarCreate.prototype.type=t.Events.VAR_CREATE,t.Events.VarCreate.prototype.toJson=function(){var e=t.Events.VarCreate.superClass_.toJson.call(this);return e.varType=this.varType,e.varName=this.varName,e},t.Events.VarCreate.prototype.fromJson=function(e){t.Events.VarCreate.superClass_.fromJson.call(this,e),this.varType=e.varType,this.varName=e.varName},t.Events.VarCreate.prototype.run=function(t){var e=this.getEventWorkspace_();t?e.createVariable(this.varName,this.varType,this.varId):e.deleteVariableById(this.varId)},t.Events.VarDelete=function(e){t.Events.VarDelete.superClass_.constructor.call(this,e),e&&(this.varType=e.type,this.varName=e.name)},t.utils.object.inherits(t.Events.VarDelete,t.Events.VarBase),t.Events.VarDelete.prototype.type=t.Events.VAR_DELETE,t.Events.VarDelete.prototype.toJson=function(){var e=t.Events.VarDelete.superClass_.toJson.call(this);return e.varType=this.varType,e.varName=this.varName,e},t.Events.VarDelete.prototype.fromJson=function(e){t.Events.VarDelete.superClass_.fromJson.call(this,e),this.varType=e.varType,this.varName=e.varName},t.Events.VarDelete.prototype.run=function(t){var e=this.getEventWorkspace_();t?e.deleteVariableById(this.varId):e.createVariable(this.varName,this.varType,this.varId)},t.Events.VarRename=function(e,n){t.Events.VarRename.superClass_.constructor.call(this,e),e&&(this.oldName=e.name,this.newName=void 0===n?"":n)},t.utils.object.inherits(t.Events.VarRename,t.Events.VarBase),t.Events.VarRename.prototype.type=t.Events.VAR_RENAME,t.Events.VarRename.prototype.toJson=function(){var e=t.Events.VarRename.superClass_.toJson.call(this);return e.oldName=this.oldName,e.newName=this.newName,e},t.Events.VarRename.prototype.fromJson=function(e){t.Events.VarRename.superClass_.fromJson.call(this,e),this.oldName=e.oldName,this.newName=e.newName},t.Events.VarRename.prototype.run=function(t){var e=this.getEventWorkspace_();t?e.renameVariableById(this.varId,this.newName):e.renameVariableById(this.varId,this.oldName)},t.registry.register(t.registry.Type.EVENT,t.Events.VAR_CREATE,t.Events.VarCreate),t.registry.register(t.registry.Type.EVENT,t.Events.VAR_DELETE,t.Events.VarDelete),t.registry.register(t.registry.Type.EVENT,t.Events.VAR_RENAME,t.Events.VarRename),t.BlockDragSurfaceSvg=function(t){this.container_=t,this.createDom()},t.BlockDragSurfaceSvg.prototype.SVG_=null,t.BlockDragSurfaceSvg.prototype.dragGroup_=null,t.BlockDragSurfaceSvg.prototype.container_=null,t.BlockDragSurfaceSvg.prototype.scale_=1,t.BlockDragSurfaceSvg.prototype.surfaceXY_=null,t.BlockDragSurfaceSvg.prototype.childSurfaceXY_=new t.utils.Coordinate(0,0),t.BlockDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{xmlns:t.utils.dom.SVG_NS,"xmlns:html":t.utils.dom.HTML_NS,"xmlns:xlink":t.utils.dom.XLINK_NS,version:"1.1",class:"blocklyBlockDragSurface"},this.container_),this.dragGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},this.SVG_))},t.BlockDragSurfaceSvg.prototype.setBlocksAndShow=function(e){if(this.dragGroup_.childNodes.length)throw Error("Already dragging a block.");this.dragGroup_.appendChild(e),this.SVG_.style.display="block",this.surfaceXY_=new t.utils.Coordinate(0,0)},t.BlockDragSurfaceSvg.prototype.translateAndScaleGroup=function(t,e,n){this.scale_=n,t=t.toFixed(0),e=e.toFixed(0),this.childSurfaceXY_.x=parseInt(t,10),this.childSurfaceXY_.y=parseInt(e,10),this.dragGroup_.setAttribute("transform","translate("+t+","+e+") scale("+n+")")},t.BlockDragSurfaceSvg.prototype.translateSurfaceInternal_=function(){var e=this.surfaceXY_.x,n=this.surfaceXY_.y;e=e.toFixed(0),n=n.toFixed(0),this.SVG_.style.display="block",t.utils.dom.setCssTransform(this.SVG_,"translate3d("+e+"px, "+n+"px, 0px)")},t.BlockDragSurfaceSvg.prototype.translateBy=function(e,n){this.surfaceXY_=new t.utils.Coordinate(this.surfaceXY_.x+e,this.surfaceXY_.y+n),this.translateSurfaceInternal_()},t.BlockDragSurfaceSvg.prototype.translateSurface=function(e,n){this.surfaceXY_=new t.utils.Coordinate(e*this.scale_,n*this.scale_),this.translateSurfaceInternal_()},t.BlockDragSurfaceSvg.prototype.getSurfaceTranslation=function(){var e=t.utils.getRelativeXY(this.SVG_);return new t.utils.Coordinate(e.x/this.scale_,e.y/this.scale_)},t.BlockDragSurfaceSvg.prototype.getGroup=function(){return this.dragGroup_},t.BlockDragSurfaceSvg.prototype.getSvgRoot=function(){return this.SVG_},t.BlockDragSurfaceSvg.prototype.getCurrentBlock=function(){return this.dragGroup_.firstChild},t.BlockDragSurfaceSvg.prototype.getWsTranslation=function(){return this.childSurfaceXY_.clone()},t.BlockDragSurfaceSvg.prototype.clearAndHide=function(t){if(t?t.appendChild(this.getCurrentBlock()):this.dragGroup_.removeChild(this.getCurrentBlock()),this.SVG_.style.display="none",this.dragGroup_.childNodes.length)throw Error("Drag group was not cleared.");this.surfaceXY_=null},t.Css={},t.Css.injected_=!1,t.Css.register=function(e){if(t.Css.injected_)throw Error("CSS already injected");Array.prototype.push.apply(t.Css.CONTENT,e),e.length=0},t.Css.inject=function(e,n){if(!t.Css.injected_){t.Css.injected_=!0;var r=t.Css.CONTENT.join("\n");t.Css.CONTENT.length=0,e&&(e=n.replace(/[\\/]$/,""),r=r.replace(/<<>>/g,e),(e=document.createElement("style")).id="blockly-common-style",r=document.createTextNode(r),e.appendChild(r),document.head.insertBefore(e,document.head.firstChild))}},t.Css.CONTENT=[".blocklySvg {","background-color: #fff;","outline: none;","overflow: hidden;","position: absolute;","display: block;","}",".blocklyWidgetDiv {","display: none;","position: absolute;","z-index: 99999;","}",".injectionDiv {","height: 100%;","position: relative;","overflow: hidden;","touch-action: none;","}",".blocklyNonSelectable {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","}",".blocklyWsDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","}",".blocklyWsDragSurface.blocklyOverflowVisible {","overflow: visible;","}",".blocklyBlockDragSurface {","display: none;","position: absolute;","top: 0;","left: 0;","right: 0;","bottom: 0;","overflow: visible !important;","z-index: 50;","}",".blocklyBlockCanvas.blocklyCanvasTransitioning,",".blocklyBubbleCanvas.blocklyCanvasTransitioning {","transition: transform .5s;","}",".blocklyTooltipDiv {","background-color: #ffffc7;","border: 1px solid #ddc;","box-shadow: 4px 4px 20px 1px rgba(0,0,0,.15);","color: #000;","display: none;","font: 9pt sans-serif;","opacity: .9;","padding: 2px;","position: absolute;","z-index: 100000;","}",".blocklyDropDownDiv {","position: absolute;","left: 0;","top: 0;","z-index: 1000;","display: none;","border: 1px solid;","border-color: #dadce0;","background-color: #fff;","border-radius: 2px;","padding: 4px;","box-shadow: 0 0 3px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv.blocklyFocused {","box-shadow: 0 0 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownContent {","max-height: 300px;","overflow: auto;","overflow-x: hidden;","position: relative;","}",".blocklyDropDownArrow {","position: absolute;","left: 0;","top: 0;","width: 16px;","height: 16px;","z-index: -1;","background-color: inherit;","border-color: inherit;","}",".blocklyDropDownButton {","display: inline-block;","float: left;","padding: 0;","margin: 4px;","border-radius: 4px;","outline: none;","border: 1px solid;","transition: box-shadow .1s;","cursor: pointer;","}",".blocklyArrowTop {","border-top: 1px solid;","border-left: 1px solid;","border-top-left-radius: 4px;","border-color: inherit;","}",".blocklyArrowBottom {","border-bottom: 1px solid;","border-right: 1px solid;","border-bottom-right-radius: 4px;","border-color: inherit;","}",".blocklyResizeSE {","cursor: se-resize;","fill: #aaa;","}",".blocklyResizeSW {","cursor: sw-resize;","fill: #aaa;","}",".blocklyResizeLine {","stroke: #515A5A;","stroke-width: 1;","}",".blocklyHighlightedConnectionPath {","fill: none;","stroke: #fc3;","stroke-width: 4px;","}",".blocklyPathLight {","fill: none;","stroke-linecap: round;","stroke-width: 1;","}",".blocklySelected>.blocklyPathLight {","display: none;","}",".blocklyDraggable {",'cursor: url("<<>>/handopen.cur"), auto;',"cursor: grab;","cursor: -webkit-grab;","}",".blocklyDragging {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDraggable:active {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyBlockDragSurface .blocklyDraggable {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyDragging.blocklyDraggingDelete {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyDragging>.blocklyPath,",".blocklyDragging>.blocklyPathLight {","fill-opacity: .8;","stroke-opacity: .8;","}",".blocklyDragging>.blocklyPathDark {","display: none;","}",".blocklyDisabled>.blocklyPath {","fill-opacity: .5;","stroke-opacity: .5;","}",".blocklyDisabled>.blocklyPathLight,",".blocklyDisabled>.blocklyPathDark {","display: none;","}",".blocklyInsertionMarker>.blocklyPath,",".blocklyInsertionMarker>.blocklyPathLight,",".blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: .2;","stroke: none;","}",".blocklyMultilineText {","font-family: monospace;","}",".blocklyNonEditableText>text {","pointer-events: none;","}",".blocklyFlyout {","position: absolute;","z-index: 20;","}",".blocklyText text {","cursor: default;","}",".blocklySvg text,",".blocklyBlockDragSurface text {","user-select: none;","-ms-user-select: none;","-webkit-user-select: none;","cursor: inherit;","}",".blocklyHidden {","display: none;","}",".blocklyFieldDropdown:not(.blocklyHidden) {","display: block;","}",".blocklyIconGroup {","cursor: default;","}",".blocklyIconGroup:not(:hover),",".blocklyIconGroupReadonly {","opacity: .6;","}",".blocklyIconShape {","fill: #00f;","stroke: #fff;","stroke-width: 1px;","}",".blocklyIconSymbol {","fill: #fff;","}",".blocklyMinimalBody {","margin: 0;","padding: 0;","}",".blocklyHtmlInput {","border: none;","border-radius: 4px;","height: 100%;","margin: 0;","outline: none;","padding: 0;","width: 100%;","text-align: center;","display: block;","box-sizing: border-box;","}",".blocklyHtmlInput::-ms-clear {","display: none;","}",".blocklyMainBackground {","stroke-width: 1;","stroke: #c6c6c6;","}",".blocklyMutatorBackground {","fill: #fff;","stroke: #ddd;","stroke-width: 1;","}",".blocklyFlyoutBackground {","fill: #ddd;","fill-opacity: .8;","}",".blocklyMainWorkspaceScrollbar {","z-index: 20;","}",".blocklyFlyoutScrollbar {","z-index: 30;","}",".blocklyScrollbarHorizontal,",".blocklyScrollbarVertical {","position: absolute;","outline: none;","}",".blocklyScrollbarBackground {","opacity: 0;","}",".blocklyScrollbarHandle {","fill: #ccc;","}",".blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyScrollbarHandle:hover {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarHandle {","fill: #bbb;","}",".blocklyFlyout .blocklyScrollbarBackground:hover+.blocklyScrollbarHandle,",".blocklyFlyout .blocklyScrollbarHandle:hover {","fill: #aaa;","}",".blocklyInvalidInput {","background: #faa;","}",".blocklyVerticalMarker {","stroke-width: 3px;","fill: rgba(255,255,255,.5);","pointer-events: none;","}",".blocklyComputeCanvas {","position: absolute;","width: 0;","height: 0;","}",".blocklyNoPointerEvents {","pointer-events: none;","}",".blocklyContextMenu {","border-radius: 4px;","max-height: 100%;","}",".blocklyDropdownMenu {","border-radius: 2px;","padding: 0 !important;","}",".blocklyDropdownMenu .blocklyMenuItem {","padding-left: 28px;","}",".blocklyDropdownMenu .blocklyMenuItemRtl {","padding-left: 5px;","padding-right: 28px;","}",".blocklyWidgetDiv .blocklyMenu {","background: #fff;","border: 1px solid transparent;","box-shadow: 0 0 3px 1px rgba(0,0,0,.3);","font: normal 13px Arial, sans-serif;","margin: 0;","outline: none;","padding: 4px 0;","position: absolute;","overflow-y: auto;","overflow-x: hidden;","max-height: 100%;","z-index: 20000;","}",".blocklyWidgetDiv .blocklyMenu.blocklyFocused {","box-shadow: 0 0 6px 1px rgba(0,0,0,.3);","}",".blocklyDropDownDiv .blocklyMenu {","background: inherit;","border: inherit;",'font: normal 13px "Helvetica Neue", Helvetica, sans-serif;',"outline: none;","position: relative;","z-index: 20000;","}",".blocklyMenuItem {","border: none;","color: #000;","cursor: pointer;","list-style: none;","margin: 0;","min-width: 7em;","padding: 6px 15px;","white-space: nowrap;","}",".blocklyMenuItemDisabled {","color: #ccc;","cursor: inherit;","}",".blocklyMenuItemHighlight {","background-color: rgba(0,0,0,.1);","}",".blocklyMenuItemCheckbox {","height: 16px;","position: absolute;","width: 16px;","}",".blocklyMenuItemSelected .blocklyMenuItemCheckbox {","background: url(<<>>/sprites.png) no-repeat -48px -16px;","float: left;","margin-left: -24px;","position: static;","}",".blocklyMenuItemRtl .blocklyMenuItemCheckbox {","float: right;","margin-right: -24px;","}"],t.Grid=function(t,e){this.gridPattern_=t,this.spacing_=e.spacing,this.length_=e.length,this.line2_=(this.line1_=t.firstChild)&&this.line1_.nextSibling,this.snapToGrid_=e.snap},t.Grid.prototype.scale_=1,t.Grid.prototype.dispose=function(){this.gridPattern_=null},t.Grid.prototype.shouldSnap=function(){return this.snapToGrid_},t.Grid.prototype.getSpacing=function(){return this.spacing_},t.Grid.prototype.getPatternId=function(){return this.gridPattern_.id},t.Grid.prototype.update=function(t){this.scale_=t;var e=this.spacing_*t||100;this.gridPattern_.setAttribute("width",e),this.gridPattern_.setAttribute("height",e);var n=(e=Math.floor(this.spacing_/2)+.5)-this.length_/2,r=e+this.length_/2;e*=t,n*=t,r*=t,this.setLineAttributes_(this.line1_,t,n,r,e,e),this.setLineAttributes_(this.line2_,t,e,e,n,r)},t.Grid.prototype.setLineAttributes_=function(t,e,n,r,i,o){t&&(t.setAttribute("stroke-width",e),t.setAttribute("x1",n),t.setAttribute("y1",i),t.setAttribute("x2",r),t.setAttribute("y2",o))},t.Grid.prototype.moveTo=function(e,n){this.gridPattern_.setAttribute("x",e),this.gridPattern_.setAttribute("y",n),(t.utils.userAgent.IE||t.utils.userAgent.EDGE)&&this.update(this.scale_)},t.Grid.createDom=function(e,n,r){return e=t.utils.dom.createSvgElement(t.utils.Svg.PATTERN,{id:"blocklyGridPattern"+e,patternUnits:"userSpaceOnUse"},r),0 document.")}else e=null;return e},t.Options=function(e){var n=!!e.readOnly;if(n)var r=null,i=!1,o=!1,s=!1,a=!1,l=!1,u=!1;else{r=t.utils.toolbox.convertToolboxDefToJson(e.toolbox),i=t.utils.toolbox.hasCategories(r),void 0===(o=e.trashcan)&&(o=i);var c=e.maxTrashcanContents;o?void 0===c&&(c=32):c=0,void 0===(s=e.collapse)&&(s=i),void 0===(a=e.comments)&&(a=i),void 0===(l=e.disable)&&(l=i),void 0===(u=e.sounds)&&(u=!0)}var h=!!e.rtl,d=e.horizontalLayout;void 0===d&&(d=!1);var p=e.toolboxPosition;p="end"!==p,p=d?p?t.utils.toolbox.Position.TOP:t.utils.toolbox.Position.BOTTOM:p==h?t.utils.toolbox.Position.RIGHT:t.utils.toolbox.Position.LEFT;var f=e.css;void 0===f&&(f=!0);var g="https://blockly-demo.appspot.com/static/media/";e.media?g=e.media:e.path&&(g=e.path+"media/");var m=void 0===e.oneBasedIndex||!!e.oneBasedIndex,v=e.renderer||"geras",b=e.plugins||{};this.RTL=h,this.oneBasedIndex=m,this.collapse=s,this.comments=a,this.disable=l,this.readOnly=n,this.maxBlocks=e.maxBlocks||1/0,this.maxInstances=e.maxInstances,this.pathToMedia=g,this.hasCategories=i,this.moveOptions=t.Options.parseMoveOptions_(e,i),this.hasScrollbars=!!this.moveOptions.scrollbars,this.hasTrashcan=o,this.maxTrashcanContents=c,this.hasSounds=u,this.hasCss=f,this.horizontalLayout=d,this.languageTree=r,this.gridOptions=t.Options.parseGridOptions_(e),this.zoomOptions=t.Options.parseZoomOptions_(e),this.toolboxPosition=p,this.theme=t.Options.parseThemeOptions_(e),this.renderer=v,this.rendererOverrides=e.rendererOverrides,this.gridPattern=null,this.parentWorkspace=e.parentWorkspace,this.plugins=b},t.BlocklyOptions=function(){},t.Options.parseMoveOptions_=function(t,e){var n=t.move||{},r={};return void 0===n.scrollbars&&void 0===t.scrollbars?r.scrollbars=e:"object"==typeof n.scrollbars?(r.scrollbars={},r.scrollbars.horizontal=!!n.scrollbars.horizontal,r.scrollbars.vertical=!!n.scrollbars.vertical,r.scrollbars.horizontal&&r.scrollbars.vertical?r.scrollbars=!0:r.scrollbars.horizontal||r.scrollbars.vertical||(r.scrollbars=!1)):r.scrollbars=!!n.scrollbars||!!t.scrollbars,r.wheel=r.scrollbars&&void 0!==n.wheel?!!n.wheel:"object"==typeof r.scrollbars,r.drag=!!r.scrollbars&&(void 0===n.drag||!!n.drag),r},t.Options.parseZoomOptions_=function(t){t=t.zoom||{};var e={};return e.controls=void 0!==t.controls&&!!t.controls,e.wheel=void 0!==t.wheel&&!!t.wheel,e.startScale=void 0===t.startScale?1:Number(t.startScale),e.maxScale=void 0===t.maxScale?3:Number(t.maxScale),e.minScale=void 0===t.minScale?.3:Number(t.minScale),e.scaleSpeed=void 0===t.scaleSpeed?1.2:Number(t.scaleSpeed),e.pinch=void 0===t.pinch?e.wheel||e.controls:!!t.pinch,e},t.Options.parseGridOptions_=function(t){t=t.grid||{};var e={};return e.spacing=Number(t.spacing)||0,e.colour=t.colour||"#888",e.length=void 0===t.length?1:Number(t.length),e.snap=0=t||isNaN(t)?0:Math.min(t,this.scrollbarLength_)},t.Scrollbar.prototype.setHandleLength_=function(t){this.handleLength_=t,this.svgHandle_.setAttribute(this.lengthAttribute_,this.handleLength_)},t.Scrollbar.prototype.constrainHandlePosition_=function(t){return 0>=t||isNaN(t)?0:Math.min(t,this.scrollbarLength_-this.handleLength_)},t.Scrollbar.prototype.setHandlePosition=function(t){this.handlePosition_=t,this.svgHandle_.setAttribute(this.positionAttribute_,this.handlePosition_)},t.Scrollbar.prototype.setScrollbarLength_=function(t){this.scrollbarLength_=t,this.outerSvg_.setAttribute(this.lengthAttribute_,this.scrollbarLength_),this.svgBackground_.setAttribute(this.lengthAttribute_,this.scrollbarLength_)},t.Scrollbar.prototype.setPosition=function(e,n){this.position.x=e,this.position.y=n,t.utils.dom.setCssTransform(this.outerSvg_,"translate("+(this.position.x+this.origin_.x)+"px,"+(this.position.y+this.origin_.y)+"px)")},t.Scrollbar.prototype.resize=function(e){(e||(e=this.workspace_.getMetrics()))&&(this.oldHostMetrics_&&t.Scrollbar.metricsAreEquivalent_(e,this.oldHostMetrics_)||(this.horizontal_?this.resizeHorizontal_(e):this.resizeVertical_(e),this.oldHostMetrics_=e,this.updateMetrics_()))},t.Scrollbar.prototype.requiresViewResize_=function(t){return!this.oldHostMetrics_||(this.oldHostMetrics_.viewWidth!==t.viewWidth||this.oldHostMetrics_.viewHeight!==t.viewHeight||this.oldHostMetrics_.absoluteLeft!==t.absoluteLeft||this.oldHostMetrics_.absoluteTop!==t.absoluteTop)},t.Scrollbar.prototype.resizeHorizontal_=function(t){this.requiresViewResize_(t)?this.resizeViewHorizontal(t):this.resizeContentHorizontal(t)},t.Scrollbar.prototype.resizeViewHorizontal=function(e){var n=e.viewWidth-2*this.margin_;this.pair_&&(n-=t.Scrollbar.scrollbarThickness),this.setScrollbarLength_(Math.max(0,n)),n=e.absoluteLeft+this.margin_,this.pair_&&this.workspace_.RTL&&(n+=t.Scrollbar.scrollbarThickness),this.setPosition(n,e.absoluteTop+e.viewHeight-t.Scrollbar.scrollbarThickness-this.margin_),this.resizeContentHorizontal(e)},t.Scrollbar.prototype.resizeContentHorizontal=function(t){if(t.viewWidth>=t.scrollWidth)this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1);else{this.pair_||this.setVisible(!0);var e=this.scrollbarLength_*t.viewWidth/t.scrollWidth;e=this.constrainHandleLength_(e),this.setHandleLength_(e),e=t.scrollWidth-t.viewWidth;var n=this.scrollbarLength_-this.handleLength_;t=(t.viewLeft-t.scrollLeft)/e*n,t=this.constrainHandlePosition_(t),this.setHandlePosition(t),this.ratio=n/e}},t.Scrollbar.prototype.resizeVertical_=function(t){this.requiresViewResize_(t)?this.resizeViewVertical(t):this.resizeContentVertical(t)},t.Scrollbar.prototype.resizeViewVertical=function(e){var n=e.viewHeight-2*this.margin_;this.pair_&&(n-=t.Scrollbar.scrollbarThickness),this.setScrollbarLength_(Math.max(0,n)),this.setPosition(this.workspace_.RTL?e.absoluteLeft+this.margin_:e.absoluteLeft+e.viewWidth-t.Scrollbar.scrollbarThickness-this.margin_,e.absoluteTop+this.margin_),this.resizeContentVertical(e)},t.Scrollbar.prototype.resizeContentVertical=function(t){if(t.viewHeight>=t.scrollHeight)this.setHandleLength_(this.scrollbarLength_),this.setHandlePosition(0),this.pair_||this.setVisible(!1);else{this.pair_||this.setVisible(!0);var e=this.scrollbarLength_*t.viewHeight/t.scrollHeight;e=this.constrainHandleLength_(e),this.setHandleLength_(e),e=t.scrollHeight-t.viewHeight;var n=this.scrollbarLength_-this.handleLength_;t=(t.viewTop-t.scrollTop)/e*n,t=this.constrainHandlePosition_(t),this.setHandlePosition(t),this.ratio=n/e}},t.Scrollbar.prototype.createDom_=function(e){var n="blocklyScrollbar"+(this.horizontal_?"Horizontal":"Vertical");e&&(n+=" "+e),this.outerSvg_=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{class:n},null),this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},this.outerSvg_),this.svgBackground_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyScrollbarBackground"},this.svgGroup_),e=Math.floor((t.Scrollbar.scrollbarThickness-5)/2),this.svgHandle_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyScrollbarHandle",rx:e,ry:e},this.svgGroup_),this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarColour","fill"),this.workspace_.getThemeManager().subscribe(this.svgHandle_,"scrollbarOpacity","fill-opacity"),t.utils.dom.insertAfter(this.outerSvg_,this.workspace_.getParentSvg())},t.Scrollbar.prototype.isVisible=function(){return this.isVisible_},t.Scrollbar.prototype.setContainerVisible=function(t){var e=t!=this.containerVisible_;this.containerVisible_=t,e&&this.updateDisplay_()},t.Scrollbar.prototype.setVisible=function(t){var e=t!=this.isVisible();if(this.pair_)throw Error("Unable to toggle visibility of paired scrollbars.");this.isVisible_=t,e&&this.updateDisplay_()},t.Scrollbar.prototype.updateDisplay_=function(){this.containerVisible_&&this.isVisible()?this.outerSvg_.setAttribute("display","block"):this.outerSvg_.setAttribute("display","none")},t.Scrollbar.prototype.onMouseDownBar_=function(e){if(this.workspace_.markFocused(),t.Touch.clearTouchIdentifier(),this.cleanUp_(),t.utils.isRightButton(e))e.stopPropagation();else{var n=t.utils.mouseToSvg(e,this.workspace_.getParentSvg(),this.workspace_.getInverseScreenCTM());n=this.horizontal_?n.x:n.y;var r=t.utils.getInjectionDivXY_(this.svgHandle_);r=this.horizontal_?r.x:r.y;var i=this.handlePosition_,o=.95*this.handleLength_;n<=r?i-=o:n>=r+this.handleLength_&&(i+=o),this.setHandlePosition(this.constrainHandlePosition_(i)),this.updateMetrics_(),e.stopPropagation(),e.preventDefault()}},t.Scrollbar.prototype.onMouseDownHandle_=function(e){this.workspace_.markFocused(),this.cleanUp_(),t.utils.isRightButton(e)?e.stopPropagation():(this.startDragHandle=this.handlePosition_,this.workspace_.setupDragSurface(),this.startDragMouse_=this.horizontal_?e.clientX:e.clientY,t.Scrollbar.onMouseUpWrapper_=t.browserEvents.conditionalBind(document,"mouseup",this,this.onMouseUpHandle_),t.Scrollbar.onMouseMoveWrapper_=t.browserEvents.conditionalBind(document,"mousemove",this,this.onMouseMoveHandle_),e.stopPropagation(),e.preventDefault())},t.Scrollbar.prototype.onMouseMoveHandle_=function(t){this.setHandlePosition(this.constrainHandlePosition_(this.startDragHandle+((this.horizontal_?t.clientX:t.clientY)-this.startDragMouse_))),this.updateMetrics_()},t.Scrollbar.prototype.onMouseUpHandle_=function(){this.workspace_.resetDragSurface(),t.Touch.clearTouchIdentifier(),this.cleanUp_()},t.Scrollbar.prototype.cleanUp_=function(){t.hideChaff(!0),t.Scrollbar.onMouseUpWrapper_&&(t.browserEvents.unbind(t.Scrollbar.onMouseUpWrapper_),t.Scrollbar.onMouseUpWrapper_=null),t.Scrollbar.onMouseMoveWrapper_&&(t.browserEvents.unbind(t.Scrollbar.onMouseMoveWrapper_),t.Scrollbar.onMouseMoveWrapper_=null)},t.Scrollbar.prototype.getRatio_=function(){var t=this.handlePosition_/(this.scrollbarLength_-this.handleLength_);return isNaN(t)&&(t=0),t},t.Scrollbar.prototype.updateMetrics_=function(){var t=this.getRatio_(),e={};this.horizontal_?e.x=t:e.y=t,this.workspace_.setMetrics(e)},t.Scrollbar.prototype.set=function(t,e){this.setHandlePosition(this.constrainHandlePosition_(t*this.ratio)),(e||void 0===e)&&this.updateMetrics_()},t.Scrollbar.prototype.setOrigin=function(e,n){this.origin_=new t.utils.Coordinate(e,n)},t.Tooltip={},t.Tooltip.visible=!1,t.Tooltip.blocked_=!1,t.Tooltip.LIMIT=50,t.Tooltip.mouseOutPid_=0,t.Tooltip.showPid_=0,t.Tooltip.lastX_=0,t.Tooltip.lastY_=0,t.Tooltip.element_=null,t.Tooltip.poisonedElement_=null,t.Tooltip.OFFSET_X=0,t.Tooltip.OFFSET_Y=10,t.Tooltip.RADIUS_OK=10,t.Tooltip.HOVER_MS=750,t.Tooltip.MARGINS=5,t.Tooltip.DIV=null,t.Tooltip.getTooltipOfObject=function(e){if(e=t.Tooltip.getTargetObject_(e)){for(e=e.tooltip;"function"==typeof e;)e=e();if("string"!=typeof e)throw Error("Tooltip function must return a string.");return e}return""},t.Tooltip.getTargetObject_=function(t){for(;t&&t.tooltip;){if("string"==typeof t.tooltip||"function"==typeof t.tooltip)return t;t=t.tooltip}return null},t.Tooltip.createDom=function(){t.Tooltip.DIV||(t.Tooltip.DIV=document.createElement("div"),t.Tooltip.DIV.className="blocklyTooltipDiv",(t.parentContainer||document.body).appendChild(t.Tooltip.DIV))},t.Tooltip.bindMouseEvents=function(e){e.mouseOverWrapper_=t.browserEvents.bind(e,"mouseover",null,t.Tooltip.onMouseOver_),e.mouseOutWrapper_=t.browserEvents.bind(e,"mouseout",null,t.Tooltip.onMouseOut_),e.addEventListener("mousemove",t.Tooltip.onMouseMove_,!1)},t.Tooltip.unbindMouseEvents=function(e){e&&(t.browserEvents.unbind(e.mouseOverWrapper_),t.browserEvents.unbind(e.mouseOutWrapper_),e.removeEventListener("mousemove",t.Tooltip.onMouseMove_))},t.Tooltip.onMouseOver_=function(e){t.Tooltip.blocked_||(e=t.Tooltip.getTargetObject_(e.currentTarget),t.Tooltip.element_!=e&&(t.Tooltip.hide(),t.Tooltip.poisonedElement_=null,t.Tooltip.element_=e),clearTimeout(t.Tooltip.mouseOutPid_))},t.Tooltip.onMouseOut_=function(e){t.Tooltip.blocked_||(t.Tooltip.mouseOutPid_=setTimeout(function(){t.Tooltip.element_=null,t.Tooltip.poisonedElement_=null,t.Tooltip.hide()},1),clearTimeout(t.Tooltip.showPid_))},t.Tooltip.onMouseMove_=function(e){if(t.Tooltip.element_&&t.Tooltip.element_.tooltip&&!t.Tooltip.blocked_)if(t.Tooltip.visible){var n=t.Tooltip.lastX_-e.pageX;e=t.Tooltip.lastY_-e.pageY,Math.sqrt(n*n+e*e)>t.Tooltip.RADIUS_OK&&t.Tooltip.hide()}else t.Tooltip.poisonedElement_!=t.Tooltip.element_&&(clearTimeout(t.Tooltip.showPid_),t.Tooltip.lastX_=e.pageX,t.Tooltip.lastY_=e.pageY,t.Tooltip.showPid_=setTimeout(t.Tooltip.show_,t.Tooltip.HOVER_MS))},t.Tooltip.dispose=function(){t.Tooltip.element_=null,t.Tooltip.poisonedElement_=null,t.Tooltip.hide()},t.Tooltip.hide=function(){t.Tooltip.visible&&(t.Tooltip.visible=!1,t.Tooltip.DIV&&(t.Tooltip.DIV.style.display="none")),t.Tooltip.showPid_&&clearTimeout(t.Tooltip.showPid_)},t.Tooltip.block=function(){t.Tooltip.hide(),t.Tooltip.blocked_=!0},t.Tooltip.unblock=function(){t.Tooltip.blocked_=!1},t.Tooltip.show_=function(){if(!t.Tooltip.blocked_&&(t.Tooltip.poisonedElement_=t.Tooltip.element_,t.Tooltip.DIV)){t.Tooltip.DIV.textContent="";var e=t.Tooltip.getTooltipOfObject(t.Tooltip.element_);e=(e=t.utils.string.wrap(e,t.Tooltip.LIMIT)).split("\n");for(var n=0;nr+window.scrollY&&(o-=t.Tooltip.DIV.offsetHeight+2*t.Tooltip.OFFSET_Y),e?i=Math.max(t.Tooltip.MARGINS-window.scrollX,i):i+t.Tooltip.DIV.offsetWidth>n+window.scrollX-2*t.Tooltip.MARGINS&&(i=n-t.Tooltip.DIV.offsetWidth-2*t.Tooltip.MARGINS),t.Tooltip.DIV.style.top=o+"px",t.Tooltip.DIV.style.left=i+"px"}},t.utils.aria={},t.utils.aria.ARIA_PREFIX_="aria-",t.utils.aria.ROLE_ATTRIBUTE_="role",t.utils.aria.Role={GRID:"grid",GRIDCELL:"gridcell",GROUP:"group",LISTBOX:"listbox",MENU:"menu",MENUITEM:"menuitem",MENUITEMCHECKBOX:"menuitemcheckbox",OPTION:"option",PRESENTATION:"presentation",ROW:"row",TREE:"tree",TREEITEM:"treeitem"},t.utils.aria.State={ACTIVEDESCENDANT:"activedescendant",COLCOUNT:"colcount",DISABLED:"disabled",EXPANDED:"expanded",INVALID:"invalid",LABEL:"label",LABELLEDBY:"labelledby",LEVEL:"level",ORIENTATION:"orientation",POSINSET:"posinset",ROWCOUNT:"rowcount",SELECTED:"selected",SETSIZE:"setsize",VALUEMAX:"valuemax",VALUEMIN:"valuemin"},t.utils.aria.setRole=function(e,n){e.setAttribute(t.utils.aria.ROLE_ATTRIBUTE_,n)},t.utils.aria.setState=function(e,n,r){Array.isArray(r)&&(r=r.join(" ")),e.setAttribute(t.utils.aria.ARIA_PREFIX_+n,r)},t.IASTNodeLocation=function(){},t.IASTNodeLocationSvg=function(){},t.IASTNodeLocationWithBlock=function(){},t.IKeyboardAccessible=function(){},t.utils.deprecation={},t.utils.deprecation.warn=function(t,e,n,r){t=t+" was deprecated on "+e+" and will be deleted on "+n+".",r&&(t+="\nUse "+r+" instead."),console.warn(t)},t.Connection=function(t,e){this.sourceBlock_=t,this.type=e},t.Connection.CAN_CONNECT=0,t.Connection.REASON_SELF_CONNECTION=1,t.Connection.REASON_WRONG_TYPE=2,t.Connection.REASON_TARGET_NULL=3,t.Connection.REASON_CHECKS_FAILED=4,t.Connection.REASON_DIFFERENT_WORKSPACES=5,t.Connection.REASON_SHADOW_PARENT=6,t.Connection.REASON_DRAG_CHECKS_FAILED=7,t.Connection.prototype.targetConnection=null,t.Connection.prototype.disposed=!1,t.Connection.prototype.check_=null,t.Connection.prototype.shadowDom_=null,t.Connection.prototype.x=0,t.Connection.prototype.y=0,t.Connection.prototype.connect_=function(e){var n,r=t.connectionTypes.INPUT_VALUE,i=this.getSourceBlock(),o=e.getSourceBlock();if(e.isConnected()&&e.disconnect(),this.isConnected()){var s=this.getShadowDom(!0);this.shadowDom_=null;var a=this.targetBlock();if(a.isShadow())a.dispose(!1);else{this.disconnect();var l=a}this.shadowDom_=s}t.Events.isEnabled()&&(n=new(t.Events.get(t.Events.BLOCK_MOVE))(o)),t.Connection.connectReciprocally_(this,e),o.setParent(i),n&&(n.recordNew(),t.Events.fire(n)),l&&(e=this.type===r?l.outputConnection:l.previousConnection,(o=t.Connection.getConnectionForOrphanedConnection(o,e))?e.connect(o):e.onFailedConnect(this))},t.Connection.prototype.dispose=function(){if(this.isConnected()){this.setShadowDom(null);var t=this.targetBlock();t&&t.unplug()}this.disposed=!0},t.Connection.prototype.getSourceBlock=function(){return this.sourceBlock_},t.Connection.prototype.isSuperior=function(){return this.type==t.connectionTypes.INPUT_VALUE||this.type==t.connectionTypes.NEXT_STATEMENT},t.Connection.prototype.isConnected=function(){return!!this.targetConnection},t.Connection.prototype.canConnectWithReason=function(e){return t.utils.deprecation.warn("Connection.prototype.canConnectWithReason","July 2020","July 2021","the workspace's connection checker"),this.getConnectionChecker().canConnectWithReason(this,e,!1)},t.Connection.prototype.checkConnection=function(e){t.utils.deprecation.warn("Connection.prototype.checkConnection","July 2020","July 2021","the workspace's connection checker");var n=this.getConnectionChecker(),r=n.canConnectWithReason(this,e,!1);if(r!=t.Connection.CAN_CONNECT)throw Error(n.getErrorMessage(r,this,e))},t.Connection.prototype.getConnectionChecker=function(){return this.sourceBlock_.workspace.connectionChecker},t.Connection.prototype.isConnectionAllowed=function(e){return t.utils.deprecation.warn("Connection.prototype.isConnectionAllowed","July 2020","July 2021","the workspace's connection checker"),this.getConnectionChecker().canConnect(this,e,!0)},t.Connection.prototype.onFailedConnect=function(t){},t.Connection.prototype.connect=function(e){if(this.targetConnection!=e&&this.getConnectionChecker().canConnect(this,e,!1)){var n=t.Events.getGroup();n||t.Events.setGroup(!0),this.isSuperior()?this.connect_(e):e.connect_(this),n||t.Events.setGroup(!1)}},t.Connection.connectReciprocally_=function(t,e){if(!t||!e)throw Error("Cannot connect null connections.");t.targetConnection=e,e.targetConnection=t},t.Connection.getSingleConnection_=function(t,e){for(var n,r=null,i=(e=e.outputConnection).getConnectionChecker(),o=0;n=t.inputList[o];o++)if((n=n.connection)&&i.canConnect(e,n,!1)){if(r)return null;r=n}return r},t.Connection.getConnectionForOrphanedOutput_=function(e,n){for(var r;r=t.Connection.getSingleConnection_(e,n);)if(!(e=r.targetBlock())||e.isShadow())return r;return null},t.Connection.getConnectionForOrphanedConnection=function(e,n){if(n.type===t.connectionTypes.OUTPUT_VALUE)return t.Connection.getConnectionForOrphanedOutput_(e,n.getSourceBlock());e=e.lastConnectionInStack(!0);var r=n.getConnectionChecker();return e&&r.canConnect(n,e,!1)?e:null},t.Connection.prototype.disconnect=function(){var e=this.targetConnection;if(!e)throw Error("Source connection not connected.");if(e.targetConnection!=this)throw Error("Target connection not connected to source connection.");if(this.isSuperior()){var n=this.sourceBlock_,r=e.getSourceBlock();e=this}else n=e.getSourceBlock(),r=this.sourceBlock_;var i=t.Events.getGroup();i||t.Events.setGroup(!0),this.disconnectInternal_(n,r),r.isShadow()||e.respawnShadow_(),i||t.Events.setGroup(!1)},t.Connection.prototype.disconnectInternal_=function(e,n){var r;t.Events.isEnabled()&&(r=new(t.Events.get(t.Events.BLOCK_MOVE))(n)),this.targetConnection=this.targetConnection.targetConnection=null,n.setParent(null),r&&(r.recordNew(),t.Events.fire(r))},t.Connection.prototype.respawnShadow_=function(){var e=this.getSourceBlock(),n=this.getShadowDom();if(e.workspace&&n)if((e=t.Xml.domToBlock(n,e.workspace)).outputConnection)this.connect(e.outputConnection);else{if(!e.previousConnection)throw Error("Child block does not have output or previous statement.");this.connect(e.previousConnection)}},t.Connection.prototype.targetBlock=function(){return this.isConnected()?this.targetConnection.getSourceBlock():null},t.Connection.prototype.checkType=function(e){return t.utils.deprecation.warn("Connection.prototype.checkType","October 2019","January 2021","the workspace's connection checker"),this.getConnectionChecker().canConnect(this,e,!1)},t.Connection.prototype.checkType_=function(e){return t.utils.deprecation.warn("Connection.prototype.checkType_","October 2019","January 2021","the workspace's connection checker"),this.checkType(e)},t.Connection.prototype.onCheckChanged_=function(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||(this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug()},t.Connection.prototype.setCheck=function(t){return t?(Array.isArray(t)||(t=[t]),this.check_=t,this.onCheckChanged_()):this.check_=null,this},t.Connection.prototype.getCheck=function(){return this.check_},t.Connection.prototype.setShadowDom=function(t){this.shadowDom_=t,(t=this.targetBlock())?t.isShadow()&&(t.dispose(!1),this.respawnShadow_()):this.respawnShadow_()},t.Connection.prototype.getShadowDom=function(e){return e&&this.targetBlock().isShadow()?t.Xml.blockToDom(this.targetBlock()):this.shadowDom_},t.Connection.prototype.neighbours=function(t){return[]},t.Connection.prototype.getParentInput=function(){for(var t=null,e=this.sourceBlock_.inputList,n=0;nr||n.getSourceBlock().isInsertionMarker())return!1;switch(n.type){case t.connectionTypes.PREVIOUS_STATEMENT:return this.canConnectToPrevious_(e,n);case t.connectionTypes.OUTPUT_VALUE:if(n.isConnected()&&!n.targetBlock().isInsertionMarker()||e.isConnected())return!1;break;case t.connectionTypes.INPUT_VALUE:if(n.isConnected()&&!n.targetBlock().isMovable()&&!n.targetBlock().isShadow())return!1;break;case t.connectionTypes.NEXT_STATEMENT:if(n.isConnected()&&!e.getSourceBlock().nextConnection&&!n.targetBlock().isShadow()&&n.targetBlock().nextConnection)return!1;break;default:return!1}return-1==t.draggingConnections.indexOf(n)},t.ConnectionChecker.prototype.canConnectToPrevious_=function(e,n){return!e.targetConnection&&-1==t.draggingConnections.indexOf(n)&&(!n.targetConnection||!!(e=n.targetBlock()).isInsertionMarker()&&!e.getPreviousBlock())},t.registry.register(t.registry.Type.CONNECTION_CHECKER,t.registry.DEFAULT,t.ConnectionChecker),t.VariableMap=function(t){this.variableMap_=Object.create(null),this.workspace=t},t.VariableMap.prototype.clear=function(){this.variableMap_=Object.create(null)},t.VariableMap.prototype.renameVariable=function(e,n){var r=this.getVariable(n,e.type),i=this.workspace.getAllBlocks(!1);t.Events.setGroup(!0);try{r&&r.getId()!=e.getId()?this.renameVariableWithConflict_(e,n,r,i):this.renameVariableAndUses_(e,n,i)}finally{t.Events.setGroup(!1)}},t.VariableMap.prototype.renameVariableById=function(t,e){var n=this.getVariableById(t);if(!n)throw Error("Tried to rename a variable that didn't exist. ID: "+t);this.renameVariable(n,e)},t.VariableMap.prototype.renameVariableAndUses_=function(e,n,r){for(t.Events.fire(new(t.Events.get(t.Events.VAR_RENAME))(e,n)),e.name=n,n=0;nthis.remainingCapacityOfType(e))return!1;n+=t[e]}return!(n>this.remainingCapacity())},t.Workspace.prototype.hasBlockLimits=function(){return 1/0!=this.options.maxBlocks||!!this.options.maxInstances},t.Workspace.prototype.getUndoStack=function(){return this.undoStack_},t.Workspace.prototype.getRedoStack=function(){return this.redoStack_},t.Workspace.prototype.undo=function(e){var n=e?this.redoStack_:this.undoStack_,r=e?this.undoStack_:this.redoStack_,i=n.pop();if(i){for(var o=[i];n.length&&i.group&&i.group==n[n.length-1].group;)o.push(n.pop());for(n=0;i=o[n];n++)r.push(i);o=t.Events.filter(o,e),t.Events.recordUndo=!1;try{for(n=0;i=o[n];n++)i.run(e)}finally{t.Events.recordUndo=!0}}},t.Workspace.prototype.clearUndo=function(){this.undoStack_.length=0,this.redoStack_.length=0,t.Events.clearPendingUndo()},t.Workspace.prototype.addChangeListener=function(t){return this.listeners_.push(t),t},t.Workspace.prototype.removeChangeListener=function(e){t.utils.arrayRemove(this.listeners_,e)},t.Workspace.prototype.fireChangeListener=function(t){if(t.recordUndo)for(this.undoStack_.push(t),this.redoStack_.length=0;this.undoStack_.length>this.MAX_UNDO&&0<=this.MAX_UNDO;)this.undoStack_.shift();for(var e,n=0;e=this.listeners_[n];n++)e(t)},t.Workspace.prototype.getBlockById=function(t){return this.blockDB_[t]||null},t.Workspace.prototype.setBlockById=function(t,e){this.blockDB_[t]=e},t.Workspace.prototype.removeBlockById=function(t){delete this.blockDB_[t]},t.Workspace.prototype.getCommentById=function(t){return this.commentDB_[t]||null},t.Workspace.prototype.allInputsFilled=function(t){for(var e,n=this.getTopBlocks(!1),r=0;e=n[r];r++)if(!e.allInputsFilled(t))return!1;return!0},t.Workspace.prototype.getPotentialVariableMap=function(){return this.potentialVariableMap_},t.Workspace.prototype.createPotentialVariableMap=function(){this.potentialVariableMap_=new t.VariableMap(this)},t.Workspace.prototype.getVariableMap=function(){return this.variableMap_},t.Workspace.prototype.setVariableMap=function(t){this.variableMap_=t},t.Workspace.WorkspaceDB_=Object.create(null),t.Workspace.getById=function(e){return t.Workspace.WorkspaceDB_[e]||null},t.Workspace.getAll=function(){var e,n=[];for(e in t.Workspace.WorkspaceDB_)n.push(t.Workspace.WorkspaceDB_[e]);return n},t.WorkspaceDragSurfaceSvg=function(t){this.container_=t,this.createDom()},t.WorkspaceDragSurfaceSvg.prototype.SVG_=null,t.WorkspaceDragSurfaceSvg.prototype.container_=null,t.WorkspaceDragSurfaceSvg.prototype.createDom=function(){this.SVG_||(this.SVG_=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{xmlns:t.utils.dom.SVG_NS,"xmlns:html":t.utils.dom.HTML_NS,"xmlns:xlink":t.utils.dom.XLINK_NS,version:"1.1",class:"blocklyWsDragSurface blocklyOverflowVisible"},null),this.container_.appendChild(this.SVG_))},t.WorkspaceDragSurfaceSvg.prototype.translateSurface=function(e,n){e=e.toFixed(0),n=n.toFixed(0),this.SVG_.style.display="block",t.utils.dom.setCssTransform(this.SVG_,"translate3d("+e+"px, "+n+"px, 0px)")},t.WorkspaceDragSurfaceSvg.prototype.getSurfaceTranslation=function(){return t.utils.getRelativeXY(this.SVG_)},t.WorkspaceDragSurfaceSvg.prototype.clearAndHide=function(e){if(!e)throw Error("Couldn't clear and hide the drag surface: missing new surface.");var n=this.SVG_.childNodes[0],r=this.SVG_.childNodes[1];if(!(n&&r&&t.utils.dom.hasClass(n,"blocklyBlockCanvas")&&t.utils.dom.hasClass(r,"blocklyBubbleCanvas")))throw Error("Couldn't clear and hide the drag surface. A node was missing.");if(null!=this.previousSibling_?t.utils.dom.insertAfter(n,this.previousSibling_):e.insertBefore(n,e.firstChild),t.utils.dom.insertAfter(r,n),this.SVG_.style.display="none",this.SVG_.childNodes.length)throw Error("Drag surface was not cleared.");t.utils.dom.setCssTransform(this.SVG_,""),this.previousSibling_=null},t.WorkspaceDragSurfaceSvg.prototype.setContentsAndShow=function(t,e,n,r,i,o){if(this.SVG_.childNodes.length)throw Error("Already dragging a block.");this.previousSibling_=n,t.setAttribute("transform","translate(0, 0) scale("+o+")"),e.setAttribute("transform","translate(0, 0) scale("+o+")"),this.SVG_.setAttribute("width",r),this.SVG_.setAttribute("height",i),this.SVG_.appendChild(t),this.SVG_.appendChild(e),this.SVG_.style.display="block"},t.blockRendering={},t.blockRendering.useDebugger=!1,t.blockRendering.register=function(e,n){t.registry.register(t.registry.Type.RENDERER,e,n)},t.blockRendering.unregister=function(e){t.registry.unregister(t.registry.Type.RENDERER,e)},t.blockRendering.startDebugger=function(){t.blockRendering.useDebugger=!0},t.blockRendering.stopDebugger=function(){t.blockRendering.useDebugger=!1},t.blockRendering.init=function(e,n,r){return(e=new(t.registry.getClass(t.registry.Type.RENDERER,e))(e)).init(n,r),e},t.ASTNode=function(e,n,r){if(!n)throw Error("Cannot create a node without a location.");this.type_=e,this.isConnection_=t.ASTNode.isConnectionType_(e),this.location_=n,this.wsCoordinate_=null,this.processParams_(r||null)},t.ASTNode.types={FIELD:"field",BLOCK:"block",INPUT:"input",OUTPUT:"output",NEXT:"next",PREVIOUS:"previous",STACK:"stack",WORKSPACE:"workspace"},t.ASTNode.NAVIGATE_ALL_FIELDS=!1,t.ASTNode.DEFAULT_OFFSET_Y=-20,t.ASTNode.isConnectionType_=function(e){switch(e){case t.ASTNode.types.PREVIOUS:case t.ASTNode.types.NEXT:case t.ASTNode.types.INPUT:case t.ASTNode.types.OUTPUT:return!0}return!1},t.ASTNode.createFieldNode=function(e){return e?new t.ASTNode(t.ASTNode.types.FIELD,e):null},t.ASTNode.createConnectionNode=function(e){if(!e)return null;var n=e.type;return n==t.connectionTypes.INPUT_VALUE||n==t.connectionTypes.NEXT_STATEMENT&&e.getParentInput()?t.ASTNode.createInputNode(e.getParentInput()):n==t.connectionTypes.NEXT_STATEMENT?new t.ASTNode(t.ASTNode.types.NEXT,e):n==t.connectionTypes.OUTPUT_VALUE?new t.ASTNode(t.ASTNode.types.OUTPUT,e):n==t.connectionTypes.PREVIOUS_STATEMENT?new t.ASTNode(t.ASTNode.types.PREVIOUS,e):null},t.ASTNode.createInputNode=function(e){return e&&e.connection?new t.ASTNode(t.ASTNode.types.INPUT,e.connection):null},t.ASTNode.createBlockNode=function(e){return e?new t.ASTNode(t.ASTNode.types.BLOCK,e):null},t.ASTNode.createStackNode=function(e){return e?new t.ASTNode(t.ASTNode.types.STACK,e):null},t.ASTNode.createWorkspaceNode=function(e,n){return n&&e?new t.ASTNode(t.ASTNode.types.WORKSPACE,e,{wsCoordinate:n}):null},t.ASTNode.createTopNode=function(e){var n=e.previousConnection||e.outputConnection;return n?t.ASTNode.createConnectionNode(n):t.ASTNode.createBlockNode(e)},t.ASTNode.prototype.processParams_=function(t){t&&t.wsCoordinate&&(this.wsCoordinate_=t.wsCoordinate)},t.ASTNode.prototype.getLocation=function(){return this.location_},t.ASTNode.prototype.getType=function(){return this.type_},t.ASTNode.prototype.getWsCoordinate=function(){return this.wsCoordinate_},t.ASTNode.prototype.isConnection=function(){return this.isConnection_},t.ASTNode.prototype.findNextForInput_=function(){var e,n=this.location_.getParentInput(),r=n.getSourceBlock();for(n=r.inputList.indexOf(n)+1;e=r.inputList[n];n++){for(var i,o=e.fieldRow,s=0;i=o[s];s++)if(i.isClickable()||t.ASTNode.NAVIGATE_ALL_FIELDS)return t.ASTNode.createFieldNode(i);if(e.connection)return t.ASTNode.createInputNode(e)}return null},t.ASTNode.prototype.findNextForField_=function(){var e=this.location_,n=e.getParentInput(),r=e.getSourceBlock(),i=r.inputList.indexOf(n);for(e=n.fieldRow.indexOf(e)+1;n=r.inputList[i];i++){for(var o=n.fieldRow;er)){var i=n.getSvgXY(e.getSvgRoot());e.outputConnection?(i.x+=(e.RTL?3:-3)*r,i.y+=13*r):e.previousConnection&&(i.x+=(e.RTL?-23:23)*r,i.y+=3*r),e=t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{cx:i.x,cy:i.y,r:0,fill:"none",stroke:"#888","stroke-width":10},n.getParentSvg()),t.blockAnimations.connectionUiStep_(e,new Date,r)}},t.blockAnimations.connectionUiStep_=function(e,n,r){var i=(new Date-n)/150;1e.workspace.scale)){var n=e.getHeightWidth().height;n=Math.atan(10/n)/Math.PI*180,e.RTL||(n*=-1),t.blockAnimations.disconnectUiStep_(e.getSvgRoot(),n,new Date)}},t.blockAnimations.disconnectUiStep_=function(e,n,r){var i=(new Date-r)/200;1n-t.CURRENT_CONNECTION_PREFERENCE)):!this.localConnection_&&!this.closestConnection_||(console.error("Only one of localConnection_ and closestConnection_ was set."),console.error("Returning true from shouldUpdatePreviews, but it's not clear why."),!0):!(!this.localConnection_||!this.closestConnection_)},t.InsertionMarkerManager.prototype.getCandidate_=function(t){for(var e=this.getStartRadius_(),n=null,r=null,i=0;ie.width)return n;if(this.workspace_.RTL)var r=this.anchorXY_.x-n,i=r-this.width_,o=e.left+e.width,s=e.left+t.Scrollbar.scrollbarThickness/this.workspace_.scale;else r=(i=n+this.anchorXY_.x)+this.width_,s=e.left,o=e.left+e.width-t.Scrollbar.scrollbarThickness/this.workspace_.scale;return this.workspace_.RTL?io&&(n=-(o-this.anchorXY_.x)):io&&(n=o-this.anchorXY_.x-this.width_),n},t.Bubble.prototype.getOptimalRelativeTop_=function(e){var n=-this.height_/4;if(this.height_>e.height)return n;var r=this.anchorXY_.y+n,i=r+this.height_,o=e.top;e=e.top+e.height-t.Scrollbar.scrollbarThickness/this.workspace_.scale;var s=this.anchorXY_.y;return re&&(n=e-s-this.height_),n},t.Bubble.prototype.positionBubble_=function(){var t=this.anchorXY_.x;t=this.workspace_.RTL?t-(this.relativeLeft_+this.width_):t+this.relativeLeft_,this.moveTo(t,this.relativeTop_+this.anchorXY_.y)},t.Bubble.prototype.moveTo=function(t,e){this.bubbleGroup_.setAttribute("transform","translate("+t+","+e+")")},t.Bubble.prototype.setDragging=function(t){!t&&this.moveCallback_&&this.moveCallback_()},t.Bubble.prototype.getBubbleSize=function(){return new t.utils.Size(this.width_,this.height_)},t.Bubble.prototype.setBubbleSize=function(e,n){var r=2*t.Bubble.BORDER_WIDTH;e=Math.max(e,r+45),n=Math.max(n,r+20),this.width_=e,this.height_=n,this.bubbleBack_.setAttribute("width",e),this.bubbleBack_.setAttribute("height",n),this.resizeGroup_&&(this.workspace_.RTL?this.resizeGroup_.setAttribute("transform","translate("+2*t.Bubble.BORDER_WIDTH+","+(n-r)+") scale(-1 1)"):this.resizeGroup_.setAttribute("transform","translate("+(e-r)+","+(n-r)+")")),this.autoLayout_&&this.layoutBubble_(),this.positionBubble_(),this.renderArrow_(),this.resizeCallback_&&this.resizeCallback_()},t.Bubble.prototype.renderArrow_=function(){var e=[],n=this.width_/2,r=this.height_/2,i=-this.relativeLeft_,o=-this.relativeTop_;if(n==i&&r==o)e.push("M "+n+","+r);else{o-=r,i-=n,this.workspace_.RTL&&(i*=-1);var s=Math.sqrt(o*o+i*i),a=Math.acos(i/s);0>o&&(a=2*Math.PI-a);var l=a+Math.PI/2;l>2*Math.PI&&(l-=2*Math.PI);var u=Math.sin(l),c=Math.cos(l),h=this.getBubbleSize();l=(h.width+h.height)/t.Bubble.ARROW_THICKNESS,l=Math.min(l,h.width,h.height)/4,i=n+(h=1-t.Bubble.ANCHOR_RADIUS/s)*i,o=r+h*o,h=n+l*c;var d=r+l*u;n-=l*c,r-=l*u,(u=a+this.arrow_radians_)>2*Math.PI&&(u-=2*Math.PI),a=Math.sin(u)*s/t.Bubble.ARROW_BEND,s=Math.cos(u)*s/t.Bubble.ARROW_BEND,e.push("M"+h+","+d),e.push("C"+(h+s)+","+(d+a)+" "+i+","+o+" "+i+","+o),e.push("C"+i+","+o+" "+(n+s)+","+(r+a)+" "+n+","+r)}e.push("z"),this.bubbleArrow_.setAttribute("d",e.join(" "))},t.Bubble.prototype.setColour=function(t){this.bubbleBack_.setAttribute("fill",t),this.bubbleArrow_.setAttribute("fill",t)},t.Bubble.prototype.dispose=function(){this.onMouseDownBubbleWrapper_&&t.browserEvents.unbind(this.onMouseDownBubbleWrapper_),this.onMouseDownResizeWrapper_&&t.browserEvents.unbind(this.onMouseDownResizeWrapper_),t.Bubble.unbindDragEvents_(),t.utils.dom.removeNode(this.bubbleGroup_),this.disposed=!0},t.Bubble.prototype.moveDuringDrag=function(t,e){t?t.translateSurface(e.x,e.y):this.moveTo(e.x,e.y),this.relativeLeft_=this.workspace_.RTL?this.anchorXY_.x-e.x-this.width_:e.x-this.anchorXY_.x,this.relativeTop_=e.y-this.anchorXY_.y,this.renderArrow_()},t.Bubble.prototype.getRelativeToSurfaceXY=function(){return new t.utils.Coordinate(this.workspace_.RTL?-this.relativeLeft_+this.anchorXY_.x-this.width_:this.anchorXY_.x+this.relativeLeft_,this.anchorXY_.y+this.relativeTop_)},t.Bubble.prototype.setAutoLayout=function(t){this.autoLayout_=t},t.Bubble.textToDom=function(e){var n=t.utils.dom.createSvgElement(t.utils.Svg.TEXT,{class:"blocklyText blocklyBubbleText blocklyNoPointerEvents",y:t.Bubble.BORDER_WIDTH},null);e=e.split("\n");for(var r=0;r(this.flyout_?t.FLYOUT_DRAG_RADIUS:t.DRAG_RADIUS))},t.Gesture.prototype.updateIsDraggingFromFlyout_=function(){return!(!this.targetBlock_||!this.flyout_.isBlockCreatable_(this.targetBlock_))&&(!(this.flyout_.isScrollable()&&!this.flyout_.isDragTowardWorkspace(this.currentDragDeltaXY_))&&(this.startWorkspace_=this.flyout_.targetWorkspace,this.startWorkspace_.updateScreenCalculationsIfScrolled(),t.Events.getGroup()||t.Events.setGroup(!0),this.startBlock_=null,this.targetBlock_=this.flyout_.createBlock(this.targetBlock_),this.targetBlock_.select(),!0))},t.Gesture.prototype.updateIsDraggingBubble_=function(){return!!this.startBubble_&&(this.isDraggingBubble_=!0,this.startDraggingBubble_(),!0)},t.Gesture.prototype.updateIsDraggingBlock_=function(){return!!this.targetBlock_&&(this.flyout_?this.isDraggingBlock_=this.updateIsDraggingFromFlyout_():this.targetBlock_.isMovable()&&(this.isDraggingBlock_=!0),!!this.isDraggingBlock_&&(this.startDraggingBlock_(),!0))},t.Gesture.prototype.updateIsDraggingWorkspace_=function(){(this.flyout_?this.flyout_.isScrollable():this.startWorkspace_&&this.startWorkspace_.isDraggable())&&(this.workspaceDragger_=new t.WorkspaceDragger(this.startWorkspace_),this.isDraggingWorkspace_=!0,this.workspaceDragger_.startDrag())},t.Gesture.prototype.updateIsDragging_=function(){if(this.calledUpdateIsDragging_)throw Error("updateIsDragging_ should only be called once per gesture.");this.calledUpdateIsDragging_=!0,this.updateIsDraggingBubble_()||this.updateIsDraggingBlock_()||this.updateIsDraggingWorkspace_()},t.Gesture.prototype.startDraggingBlock_=function(){this.blockDragger_=new(t.registry.getClassFromOptions(t.registry.Type.BLOCK_DRAGGER,this.creatorWorkspace_.options,!0))(this.targetBlock_,this.startWorkspace_),this.blockDragger_.startDrag(this.currentDragDeltaXY_,this.healStack_),this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_)},t.Gesture.prototype.startDraggingBubble_=function(){this.bubbleDragger_=new t.BubbleDragger(this.startBubble_,this.startWorkspace_),this.bubbleDragger_.startBubbleDrag(),this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_)},t.Gesture.prototype.doStart=function(e){t.utils.isTargetInput(e)?this.cancel():(this.hasStarted_=!0,t.blockAnimations.disconnectUiStop(),this.startWorkspace_.updateScreenCalculationsIfScrolled(),this.startWorkspace_.isMutator&&this.startWorkspace_.resize(),t.hideChaff(!!this.flyout_),this.startWorkspace_.markFocused(),this.mostRecentEvent_=e,t.Tooltip.block(),this.targetBlock_&&this.targetBlock_.select(),t.utils.isRightButton(e)?this.handleRightClick(e):("touchstart"!=e.type.toLowerCase()&&"pointerdown"!=e.type.toLowerCase()||"mouse"==e.pointerType||t.longStart(e,this),this.mouseDownXY_=new t.utils.Coordinate(e.clientX,e.clientY),this.healStack_=e.altKey||e.ctrlKey||e.metaKey,this.bindMouseEvents(e)))},t.Gesture.prototype.bindMouseEvents=function(e){this.onMoveWrapper_=t.browserEvents.conditionalBind(document,"mousemove",null,this.handleMove.bind(this)),this.onUpWrapper_=t.browserEvents.conditionalBind(document,"mouseup",null,this.handleUp.bind(this)),e.preventDefault(),e.stopPropagation()},t.Gesture.prototype.handleMove=function(t){this.updateFromEvent_(t),this.isDraggingWorkspace_?this.workspaceDragger_.drag(this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.drag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBubble_&&this.bubbleDragger_.dragBubble(this.mostRecentEvent_,this.currentDragDeltaXY_),t.preventDefault(),t.stopPropagation()},t.Gesture.prototype.handleUp=function(e){this.updateFromEvent_(e),t.longStop_(),this.isEnding_?console.log("Trying to end a gesture recursively."):(this.isEnding_=!0,this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(e,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endDrag(e,this.currentDragDeltaXY_):this.isDraggingWorkspace_?this.workspaceDragger_.endDrag(this.currentDragDeltaXY_):this.isBubbleClick_()?this.doBubbleClick_():this.isFieldClick_()?this.doFieldClick_():this.isBlockClick_()?this.doBlockClick_():this.isWorkspaceClick_()&&this.doWorkspaceClick_(e),e.preventDefault(),e.stopPropagation(),this.dispose())},t.Gesture.prototype.cancel=function(){this.isEnding_||(t.longStop_(),this.isDraggingBubble_?this.bubbleDragger_.endBubbleDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingBlock_?this.blockDragger_.endDrag(this.mostRecentEvent_,this.currentDragDeltaXY_):this.isDraggingWorkspace_&&this.workspaceDragger_.endDrag(this.currentDragDeltaXY_),this.dispose())},t.Gesture.prototype.handleRightClick=function(e){this.targetBlock_?(this.bringBlockToFront_(),t.hideChaff(!!this.flyout_),this.targetBlock_.showContextMenu(e)):this.startBubble_?this.startBubble_.showContextMenu(e):this.startWorkspace_&&!this.flyout_&&(t.hideChaff(),this.startWorkspace_.showContextMenu(e)),e.preventDefault(),e.stopPropagation(),this.dispose()},t.Gesture.prototype.handleWsStart=function(t,e){if(this.hasStarted_)throw Error("Tried to call gesture.handleWsStart, but the gesture had already been started.");this.setStartWorkspace_(e),this.mostRecentEvent_=t,this.doStart(t)},t.Gesture.prototype.fireWorkspaceClick_=function(e){t.Events.fire(new(t.Events.get(t.Events.CLICK))(null,e.id,"workspace"))},t.Gesture.prototype.handleFlyoutStart=function(t,e){if(this.hasStarted_)throw Error("Tried to call gesture.handleFlyoutStart, but the gesture had already been started.");this.setStartFlyout_(e),this.handleWsStart(t,e.getWorkspace())},t.Gesture.prototype.handleBlockStart=function(t,e){if(this.hasStarted_)throw Error("Tried to call gesture.handleBlockStart, but the gesture had already been started.");this.setStartBlock(e),this.mostRecentEvent_=t},t.Gesture.prototype.handleBubbleStart=function(t,e){if(this.hasStarted_)throw Error("Tried to call gesture.handleBubbleStart, but the gesture had already been started.");this.setStartBubble(e),this.mostRecentEvent_=t},t.Gesture.prototype.doBubbleClick_=function(){this.startBubble_.setFocus&&this.startBubble_.setFocus(),this.startBubble_.select&&this.startBubble_.select()},t.Gesture.prototype.doFieldClick_=function(){this.startField_.showEditor(this.mostRecentEvent_),this.bringBlockToFront_()},t.Gesture.prototype.doBlockClick_=function(){if(this.flyout_&&this.flyout_.autoClose)this.targetBlock_.isEnabled()&&(t.Events.getGroup()||t.Events.setGroup(!0),this.flyout_.createBlock(this.targetBlock_).scheduleSnapAndBump());else{var e=new(t.Events.get(t.Events.CLICK))(this.startBlock_,this.startWorkspace_.id,"block");t.Events.fire(e)}this.bringBlockToFront_(),t.Events.setGroup(!1)},t.Gesture.prototype.doWorkspaceClick_=function(e){e=this.creatorWorkspace_,t.selected&&t.selected.unselect(),this.fireWorkspaceClick_(this.startWorkspace_||e)},t.Gesture.prototype.bringBlockToFront_=function(){this.targetBlock_&&!this.flyout_&&this.targetBlock_.bringToFront()},t.Gesture.prototype.setStartField=function(t){if(this.hasStarted_)throw Error("Tried to call gesture.setStartField, but the gesture had already been started.");this.startField_||(this.startField_=t)},t.Gesture.prototype.setStartBubble=function(t){this.startBubble_||(this.startBubble_=t)},t.Gesture.prototype.setStartBlock=function(t){this.startBlock_||this.startBubble_||(this.startBlock_=t,t.isInFlyout&&t!=t.getRootBlock()?this.setTargetBlock_(t.getRootBlock()):this.setTargetBlock_(t))},t.Gesture.prototype.setTargetBlock_=function(t){t.isShadow()?this.setTargetBlock_(t.getParent()):this.targetBlock_=t},t.Gesture.prototype.setStartWorkspace_=function(t){this.startWorkspace_||(this.startWorkspace_=t)},t.Gesture.prototype.setStartFlyout_=function(t){this.flyout_||(this.flyout_=t)},t.Gesture.prototype.isBubbleClick_=function(){return!!this.startBubble_&&!this.hasExceededDragRadius_},t.Gesture.prototype.isBlockClick_=function(){return!!this.startBlock_&&!this.hasExceededDragRadius_&&!this.isFieldClick_()},t.Gesture.prototype.isFieldClick_=function(){return!!this.startField_&&this.startField_.isClickable()&&!this.hasExceededDragRadius_&&(!this.flyout_||!this.flyout_.autoClose)},t.Gesture.prototype.isWorkspaceClick_=function(){return!(this.startBlock_||this.startBubble_||this.startField_||this.hasExceededDragRadius_)},t.Gesture.prototype.isDragging=function(){return this.isDraggingWorkspace_||this.isDraggingBlock_||this.isDraggingBubble_},t.Gesture.prototype.hasStarted=function(){return this.hasStarted_},t.Gesture.prototype.getInsertionMarkers=function(){return this.blockDragger_?this.blockDragger_.getInsertionMarkers():[]},t.Gesture.prototype.getCurrentDragger=function(){return this.isDraggingBlock_?this.blockDragger_:this.isDraggingWorkspace_?this.workspaceDragger_:this.isDraggingBubble_?this.bubbleDragger_:null},t.Gesture.inProgress=function(){for(var e,n=t.Workspace.getAll(),r=0;e=n[r];r++)if(e.currentGesture_)return!0;return!1},t.IRegistrable=function(){},t.Marker=function(){this.drawer_=this.curNode_=this.colour=null,this.type="marker"},t.Marker.prototype.setDrawer=function(t){this.drawer_=t},t.Marker.prototype.getDrawer=function(){return this.drawer_},t.Marker.prototype.getCurNode=function(){return this.curNode_},t.Marker.prototype.setCurNode=function(t){var e=this.curNode_;this.curNode_=t,this.drawer_&&this.drawer_.draw(e,this.curNode_)},t.Marker.prototype.draw=function(){this.drawer_&&this.drawer_.draw(this.curNode_,this.curNode_)},t.Marker.prototype.hide=function(){this.drawer_&&this.drawer_.hide()},t.Marker.prototype.dispose=function(){this.getDrawer()&&this.getDrawer().dispose()},t.Cursor=function(){t.Cursor.superClass_.constructor.call(this),this.type="cursor"},t.utils.object.inherits(t.Cursor,t.Marker),t.Cursor.prototype.next=function(){var e=this.getCurNode();if(!e)return null;for(e=e.next();e&&e.next()&&(e.getType()==t.ASTNode.types.NEXT||e.getType()==t.ASTNode.types.BLOCK);)e=e.next();return e&&this.setCurNode(e),e},t.Cursor.prototype.in=function(){var e=this.getCurNode();return e?(e.getType()!=t.ASTNode.types.PREVIOUS&&e.getType()!=t.ASTNode.types.OUTPUT||(e=e.next()),(e=e.in())&&this.setCurNode(e),e):null},t.Cursor.prototype.prev=function(){var e=this.getCurNode();if(!e)return null;for(e=e.prev();e&&e.prev()&&(e.getType()==t.ASTNode.types.NEXT||e.getType()==t.ASTNode.types.BLOCK);)e=e.prev();return e&&this.setCurNode(e),e},t.Cursor.prototype.out=function(){var e=this.getCurNode();return e?((e=e.out())&&e.getType()==t.ASTNode.types.BLOCK&&(e=e.prev()||e),e&&this.setCurNode(e),e):null},t.registry.register(t.registry.Type.CURSOR,t.registry.DEFAULT,t.Cursor),t.MarkerManager=function(t){this.cursorSvg_=this.cursor_=null,this.markers_=Object.create(null),this.workspace_=t},t.MarkerManager.LOCAL_MARKER="local_marker_1",t.MarkerManager.prototype.registerMarker=function(t,e){this.markers_[t]&&this.unregisterMarker(t),e.setDrawer(this.workspace_.getRenderer().makeMarkerDrawer(this.workspace_,e)),this.setMarkerSvg(e.getDrawer().createDom()),this.markers_[t]=e},t.MarkerManager.prototype.unregisterMarker=function(t){var e=this.markers_[t];if(!e)throw Error("Marker with ID "+t+" does not exist. Can only unregister markers that exist.");e.dispose(),delete this.markers_[t]},t.MarkerManager.prototype.getCursor=function(){return this.cursor_},t.MarkerManager.prototype.getMarker=function(t){return this.markers_[t]||null},t.MarkerManager.prototype.setCursor=function(t){this.cursor_&&this.cursor_.getDrawer()&&this.cursor_.getDrawer().dispose(),(this.cursor_=t)&&(t=this.workspace_.getRenderer().makeMarkerDrawer(this.workspace_,this.cursor_),this.cursor_.setDrawer(t),this.setCursorSvg(this.cursor_.getDrawer().createDom()))},t.MarkerManager.prototype.setCursorSvg=function(t){t?(this.workspace_.getBlockCanvas().appendChild(t),this.cursorSvg_=t):this.cursorSvg_=null},t.MarkerManager.prototype.setMarkerSvg=function(t){t?this.workspace_.getBlockCanvas()&&(this.cursorSvg_?this.workspace_.getBlockCanvas().insertBefore(t,this.cursorSvg_):this.workspace_.getBlockCanvas().appendChild(t)):this.markerSvg_=null},t.MarkerManager.prototype.updateMarkers=function(){this.workspace_.keyboardAccessibilityMode&&this.cursorSvg_&&this.workspace_.getCursor().draw()},t.MarkerManager.prototype.dispose=function(){for(var t,e=Object.keys(this.markers_),n=0;t=e[n];n++)this.unregisterMarker(t);this.markers_=null,this.cursor_&&(this.cursor_.dispose(),this.cursor_=null)},t.WidgetDiv={},t.WidgetDiv.owner_=null,t.WidgetDiv.dispose_=null,t.WidgetDiv.rendererClassName_="",t.WidgetDiv.themeClassName_="",t.WidgetDiv.createDom=function(){t.WidgetDiv.DIV||(t.WidgetDiv.DIV=document.createElement("div"),t.WidgetDiv.DIV.className="blocklyWidgetDiv",(t.parentContainer||document.body).appendChild(t.WidgetDiv.DIV))},t.WidgetDiv.show=function(e,n,r){t.WidgetDiv.hide(),t.WidgetDiv.owner_=e,t.WidgetDiv.dispose_=r,(e=t.WidgetDiv.DIV).style.direction=n?"rtl":"ltr",e.style.display="block",n=t.getMainWorkspace(),t.WidgetDiv.rendererClassName_=n.getRenderer().getClassName(),t.WidgetDiv.themeClassName_=n.getTheme().getClassName(),t.utils.dom.addClass(e,t.WidgetDiv.rendererClassName_),t.utils.dom.addClass(e,t.WidgetDiv.themeClassName_)},t.WidgetDiv.hide=function(){if(t.WidgetDiv.isVisible()){t.WidgetDiv.owner_=null;var e=t.WidgetDiv.DIV;e.style.display="none",e.style.left="",e.style.top="",t.WidgetDiv.dispose_&&t.WidgetDiv.dispose_(),t.WidgetDiv.dispose_=null,e.textContent="",t.WidgetDiv.rendererClassName_&&(t.utils.dom.removeClass(e,t.WidgetDiv.rendererClassName_),t.WidgetDiv.rendererClassName_=""),t.WidgetDiv.themeClassName_&&(t.utils.dom.removeClass(e,t.WidgetDiv.themeClassName_),t.WidgetDiv.themeClassName_=""),t.getMainWorkspace().markFocused()}},t.WidgetDiv.isVisible=function(){return!!t.WidgetDiv.owner_},t.WidgetDiv.hideIfOwner=function(e){t.WidgetDiv.owner_==e&&t.WidgetDiv.hide()},t.WidgetDiv.positionInternal_=function(e,n,r){t.WidgetDiv.DIV.style.left=e+"px",t.WidgetDiv.DIV.style.top=n+"px",t.WidgetDiv.DIV.style.height=r+"px"},t.WidgetDiv.positionWithAnchor=function(e,n,r,i){var o=t.WidgetDiv.calculateY_(e,n,r);e=t.WidgetDiv.calculateX_(e,n,r,i),0>o?t.WidgetDiv.positionInternal_(e,0,r.height+o):t.WidgetDiv.positionInternal_(e,o,r.height)},t.WidgetDiv.calculateX_=function(t,e,n,r){return r?(e=Math.max(e.right-n.width,t.left),Math.min(e,t.right-n.width)):(e=Math.min(e.left,t.right-n.width),Math.max(e,t.left))},t.WidgetDiv.calculateY_=function(t,e,n){return e.bottom+n.height>=t.bottom?e.top-n.height:e.bottom},t.Field=function(e,n,r){this.value_=this.DEFAULT_VALUE,this.tooltip_=this.validator_=null,this.size_=new t.utils.Size(0,0),this.constants_=this.mouseDownWrapper_=this.textContent_=this.textElement_=this.borderRect_=this.fieldGroup_=this.markerSvg_=this.cursorSvg_=null,r&&this.configure_(r),this.setValue(e),n&&this.setValidator(n)},t.Field.prototype.DEFAULT_VALUE=null,t.Field.prototype.name=void 0,t.Field.prototype.disposed=!1,t.Field.prototype.maxDisplayLength=50,t.Field.prototype.sourceBlock_=null,t.Field.prototype.isDirty_=!0,t.Field.prototype.visible_=!0,t.Field.prototype.clickTarget_=null,t.Field.NBSP=" ",t.Field.prototype.EDITABLE=!0,t.Field.prototype.SERIALIZABLE=!1,t.Field.prototype.configure_=function(e){var n=e.tooltip;"string"==typeof n&&(n=t.utils.replaceMessageReferences(e.tooltip)),n&&this.setTooltip(n)},t.Field.prototype.setSourceBlock=function(t){if(this.sourceBlock_)throw Error("Field already bound to a block.");this.sourceBlock_=t},t.Field.prototype.getConstants=function(){return!this.constants_&&this.sourceBlock_&&this.sourceBlock_.workspace&&this.sourceBlock_.workspace.rendered&&(this.constants_=this.sourceBlock_.workspace.getRenderer().getConstants()),this.constants_},t.Field.prototype.getSourceBlock=function(){return this.sourceBlock_},t.Field.prototype.init=function(){this.fieldGroup_||(this.fieldGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},null),this.isVisible()||(this.fieldGroup_.style.display="none"),this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_),this.initView(),this.updateEditable(),this.setTooltip(this.tooltip_),this.bindEvents_(),this.initModel())},t.Field.prototype.initView=function(){this.createBorderRect_(),this.createTextElement_()},t.Field.prototype.initModel=function(){},t.Field.prototype.createBorderRect_=function(){this.borderRect_=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{rx:this.getConstants().FIELD_BORDER_RECT_RADIUS,ry:this.getConstants().FIELD_BORDER_RECT_RADIUS,x:0,y:0,height:this.size_.height,width:this.size_.width,class:"blocklyFieldRect"},this.fieldGroup_)},t.Field.prototype.createTextElement_=function(){this.textElement_=t.utils.dom.createSvgElement(t.utils.Svg.TEXT,{class:"blocklyText"},this.fieldGroup_),this.getConstants().FIELD_TEXT_BASELINE_CENTER&&this.textElement_.setAttribute("dominant-baseline","central"),this.textContent_=document.createTextNode(""),this.textElement_.appendChild(this.textContent_)},t.Field.prototype.bindEvents_=function(){t.Tooltip.bindMouseEvents(this.getClickTarget_()),this.mouseDownWrapper_=t.browserEvents.conditionalBind(this.getClickTarget_(),"mousedown",this,this.onMouseDown_)},t.Field.prototype.fromXml=function(t){this.setValue(t.textContent)},t.Field.prototype.toXml=function(t){return t.textContent=this.getValue(),t},t.Field.prototype.dispose=function(){t.DropDownDiv.hideIfOwner(this),t.WidgetDiv.hideIfOwner(this),t.Tooltip.unbindMouseEvents(this.getClickTarget_()),this.mouseDownWrapper_&&t.browserEvents.unbind(this.mouseDownWrapper_),t.utils.dom.removeNode(this.fieldGroup_),this.disposed=!0},t.Field.prototype.updateEditable=function(){var e=this.fieldGroup_;this.EDITABLE&&e&&(this.sourceBlock_.isEditable()?(t.utils.dom.addClass(e,"blocklyEditableText"),t.utils.dom.removeClass(e,"blocklyNonEditableText"),e.style.cursor=this.CURSOR):(t.utils.dom.addClass(e,"blocklyNonEditableText"),t.utils.dom.removeClass(e,"blocklyEditableText"),e.style.cursor=""))},t.Field.prototype.isClickable=function(){return!!this.sourceBlock_&&this.sourceBlock_.isEditable()&&!!this.showEditor_&&"function"==typeof this.showEditor_},t.Field.prototype.isCurrentlyEditable=function(){return this.EDITABLE&&!!this.sourceBlock_&&this.sourceBlock_.isEditable()},t.Field.prototype.isSerializable=function(){var t=!1;return this.name&&(this.SERIALIZABLE?t=!0:this.EDITABLE&&(console.warn("Detected an editable field that was not serializable. Please define SERIALIZABLE property as true on all editable custom fields. Proceeding with serialization."),t=!0)),t},t.Field.prototype.isVisible=function(){return this.visible_},t.Field.prototype.setVisible=function(t){if(this.visible_!=t){this.visible_=t;var e=this.getSvgRoot();e&&(e.style.display=t?"block":"none")}},t.Field.prototype.setValidator=function(t){this.validator_=t},t.Field.prototype.getValidator=function(){return this.validator_},t.Field.prototype.getSvgRoot=function(){return this.fieldGroup_},t.Field.prototype.applyColour=function(){},t.Field.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_()},t.Field.prototype.showEditor=function(t){this.isClickable()&&this.showEditor_(t)},t.Field.prototype.updateSize_=function(e){var n=this.getConstants(),r=2*(e=void 0!=e?e:this.borderRect_?this.getConstants().FIELD_BORDER_RECT_X_PADDING:0),i=n.FIELD_TEXT_HEIGHT,o=0;this.textElement_&&(r+=o=t.utils.dom.getFastTextWidth(this.textElement_,n.FIELD_TEXT_FONTSIZE,n.FIELD_TEXT_FONTWEIGHT,n.FIELD_TEXT_FONTFAMILY)),this.borderRect_&&(i=Math.max(i,n.FIELD_BORDER_RECT_HEIGHT)),this.size_.height=i,this.size_.width=r,this.positionTextElement_(e,o),this.positionBorderRect_()},t.Field.prototype.positionTextElement_=function(t,e){if(this.textElement_){var n=this.getConstants(),r=this.size_.height/2;this.textElement_.setAttribute("x",this.sourceBlock_.RTL?this.size_.width-e-t:t),this.textElement_.setAttribute("y",n.FIELD_TEXT_BASELINE_CENTER?r:r-n.FIELD_TEXT_HEIGHT/2+n.FIELD_TEXT_BASELINE)}},t.Field.prototype.positionBorderRect_=function(){this.borderRect_&&(this.borderRect_.setAttribute("width",this.size_.width),this.borderRect_.setAttribute("height",this.size_.height),this.borderRect_.setAttribute("rx",this.getConstants().FIELD_BORDER_RECT_RADIUS),this.borderRect_.setAttribute("ry",this.getConstants().FIELD_BORDER_RECT_RADIUS))},t.Field.prototype.getSize=function(){return this.isVisible()?(this.isDirty_?(this.render_(),this.isDirty_=!1):this.visible_&&0==this.size_.width&&(console.warn("Deprecated use of setting size_.width to 0 to rerender a field. Set field.isDirty_ to true instead."),this.render_()),this.size_):new t.utils.Size(0,0)},t.Field.prototype.getScaledBBox=function(){if(this.borderRect_)e=this.borderRect_.getBoundingClientRect(),r=t.utils.style.getPageOffset(this.borderRect_),i=e.width,e=e.height;else{var e=this.sourceBlock_.getHeightWidth(),n=this.sourceBlock_.workspace.scale,r=this.getAbsoluteXY_(),i=e.width*n;e=e.height*n,t.utils.userAgent.GECKO?(r.x+=1.5*n,r.y+=1.5*n):t.utils.userAgent.EDGE||t.utils.userAgent.IE||(r.x-=.5*n,r.y-=.5*n),i+=1*n,e+=1*n}return new t.utils.Rect(r.y,r.y+e,r.x,r.x+i)},t.Field.prototype.getDisplayText_=function(){var e=this.getText();return e?(e.length>this.maxDisplayLength&&(e=e.substring(0,this.maxDisplayLength-2)+"…"),e=e.replace(/\s/g,t.Field.NBSP),this.sourceBlock_&&this.sourceBlock_.RTL&&(e+="‏"),e):t.Field.NBSP},t.Field.prototype.getText=function(){if(this.getText_){var t=this.getText_.call(this);if(null!==t)return String(t)}return String(this.getValue())},t.Field.prototype.markDirty=function(){this.isDirty_=!0,this.constants_=null},t.Field.prototype.forceRerender=function(){this.isDirty_=!0,this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours(),this.updateMarkers_())},t.Field.prototype.setValue=function(e){if(null!==e){var n=this.doClassValidation_(e);if(!((e=this.processValidation_(e,n))instanceof Error)){if((n=this.getValidator())&&(n=n.call(this,e),(e=this.processValidation_(e,n))instanceof Error))return;if(!(n=this.sourceBlock_)||!n.disposed){var r=this.getValue();r===e?this.doValueUpdate_(e):(n&&t.Events.isEnabled()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(n,"field",this.name||null,r,e)),this.doValueUpdate_(e),this.isDirty_&&this.forceRerender())}}}},t.Field.prototype.processValidation_=function(t,e){return null===e?(this.doValueInvalid_(t),this.isDirty_&&this.forceRerender(),Error()):(void 0!==e&&(t=e),t)},t.Field.prototype.getValue=function(){return this.value_},t.Field.prototype.doClassValidation_=function(t){return null===t||void 0===t?null:t},t.Field.prototype.doValueUpdate_=function(t){this.value_=t,this.isDirty_=!0},t.Field.prototype.doValueInvalid_=function(t){},t.Field.prototype.onMouseDown_=function(t){this.sourceBlock_&&this.sourceBlock_.workspace&&(t=this.sourceBlock_.workspace.getGesture(t))&&t.setStartField(this)},t.Field.prototype.setTooltip=function(t){t||""===t||(t=this.sourceBlock_);var e=this.getClickTarget_();e?e.tooltip=t:this.tooltip_=t},t.Field.prototype.getTooltip=function(){var e=this.getClickTarget_();return e?t.Tooltip.getTooltipOfObject(e):t.Tooltip.getTooltipOfObject({tooltip:this.tooltip_})},t.Field.prototype.getClickTarget_=function(){return this.clickTarget_||this.getSvgRoot()},t.Field.prototype.getAbsoluteXY_=function(){return t.utils.style.getPageOffset(this.getClickTarget_())},t.Field.prototype.referencesVariables=function(){return!1},t.Field.prototype.getParentInput=function(){for(var t=null,e=this.sourceBlock_,n=e.inputList,r=0;re||e>this.fieldRow.length)throw Error("index "+e+" out of bounds.");return n||""==n&&r?("string"==typeof n&&(n=t.fieldRegistry.fromJson({type:"field_label",text:n})),n.setSourceBlock(this.sourceBlock_),this.sourceBlock_.rendered&&(n.init(),n.applyColour()),n.name=r,n.setVisible(this.isVisible()),n.prefixField&&(e=this.insertFieldAt(e,n.prefixField)),this.fieldRow.splice(e,0,n),++e,n.suffixField&&(e=this.insertFieldAt(e,n.suffixField)),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours()),e):e},t.Input.prototype.removeField=function(t,e){for(var n,r=0;n=this.fieldRow[r];r++)if(n.name===t)return n.dispose(),this.fieldRow.splice(r,1),this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render(),this.sourceBlock_.bumpNeighbours()),!0;if(e)return!1;throw Error('Field "'+t+'" not found.')},t.Input.prototype.isVisible=function(){return this.visible_},t.Input.prototype.setVisible=function(t){var e=[];if(this.visible_==t)return e;this.visible_=t;for(var n,r=0;n=this.fieldRow[r];r++)n.setVisible(t);return this.connection&&(this.connection=this.connection,t?e=this.connection.startTrackingAll():this.connection.stopTrackingAll(),r=this.connection.targetBlock())&&(r.getSvgRoot().style.display=t?"block":"none"),e},t.Input.prototype.markDirty=function(){for(var t,e=0;t=this.fieldRow[e];e++)t.markDirty()},t.Input.prototype.setCheck=function(t){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setCheck(t),this},t.Input.prototype.setAlign=function(t){return this.align=t,this.sourceBlock_.rendered&&(this.sourceBlock_=this.sourceBlock_,this.sourceBlock_.render()),this},t.Input.prototype.setShadowDom=function(t){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.setShadowDom(t),this},t.Input.prototype.getShadowDom=function(){if(!this.connection)throw Error("This input does not have a connection.");return this.connection.getShadowDom()},t.Input.prototype.init=function(){if(this.sourceBlock_.workspace.rendered)for(var t=0;te&&(o=o.substring(0,e-3)+"..."),o},t.Block.prototype.appendValueInput=function(e){return this.appendInput_(t.inputTypes.VALUE,e)},t.Block.prototype.appendStatementInput=function(e){return this.appendInput_(t.inputTypes.STATEMENT,e)},t.Block.prototype.appendDummyInput=function(e){return this.appendInput_(t.inputTypes.DUMMY,e||"")},t.Block.prototype.jsonInit=function(e){var n=e.type?'Block "'+e.type+'": ':"";if(e.output&&e.previousStatement)throw Error(n+"Must not have both an output and a previousStatement.");if(e.style&&e.style.hat&&(this.hat=e.style.hat,e.style=null),e.style&&e.colour)throw Error(n+"Must not have both a colour and a style.");e.style?this.jsonInitStyle_(e,n):this.jsonInitColour_(e,n);for(var r=0;void 0!==e["message"+r];)this.interpolate_(e["message"+r],e["args"+r]||[],e["lastDummyAlign"+r],n),r++;if(void 0!==e.inputsInline&&this.setInputsInline(e.inputsInline),void 0!==e.output&&this.setOutput(!0,e.output),void 0!==e.outputShape&&this.setOutputShape(e.outputShape),void 0!==e.previousStatement&&this.setPreviousStatement(!0,e.previousStatement),void 0!==e.nextStatement&&this.setNextStatement(!0,e.nextStatement),void 0!==e.tooltip&&(r=e.tooltip,r=t.utils.replaceMessageReferences(r),this.setTooltip(r)),void 0!==e.enableContextMenu&&(r=e.enableContextMenu,this.contextMenu=!!r),void 0!==e.helpUrl&&(r=e.helpUrl,r=t.utils.replaceMessageReferences(r),this.setHelpUrl(r)),"string"==typeof e.extensions&&(console.warn(n+"JSON attribute 'extensions' should be an array of strings. Found raw string in JSON for '"+e.type+"' block."),e.extensions=[e.extensions]),void 0!==e.mutator&&t.Extensions.apply(e.mutator,this,!0),e=e.extensions,Array.isArray(e))for(n=0;no||o>e)throw Error('Block "'+this.type+'": Message index %'+o+" out of range.");if(n[o])throw Error('Block "'+this.type+'": Message index %'+o+" duplicated.");n[o]=!0,r++}}if(r!=e)throw Error('Block "'+this.type+'": Message does not reference all '+e+" arg(s).")},t.Block.prototype.interpolateArguments_=function(t,e,n){for(var r=[],i=0;i=this.inputList.length)throw RangeError("Input index "+t+" out of bounds.");if(e>this.inputList.length)throw RangeError("Reference input "+e+" out of bounds.");var n=this.inputList[t];this.inputList.splice(t,1),tt?this.menuItems_.length:t,-1)},t.Menu.prototype.highlightFirst_=function(){this.highlightHelper_(-1,1)},t.Menu.prototype.highlightLast_=function(){this.highlightHelper_(this.menuItems_.length,-1)},t.Menu.prototype.highlightHelper_=function(t,e){t+=e;for(var n;n=this.menuItems_[t];){if(n.isEnabled()){this.setHighlighted(n);break}t+=e}},t.Menu.prototype.handleMouseOver_=function(t){(t=this.getMenuItem_(t.target))&&(t.isEnabled()?this.highlightedItem_!=t&&this.setHighlighted(t):this.setHighlighted(null))},t.Menu.prototype.handleClick_=function(e){var n=this.openingCoords;if(this.openingCoords=null,n&&"number"==typeof e.clientX){var r=new t.utils.Coordinate(e.clientX,e.clientY);if(1>t.utils.Coordinate.distance(n,r))return}(e=this.getMenuItem_(e.target))&&e.performAction()},t.Menu.prototype.handleMouseEnter_=function(t){this.focus()},t.Menu.prototype.handleMouseLeave_=function(t){this.getElement()&&(this.blur_(),this.setHighlighted(null))},t.Menu.prototype.handleKeyEvent_=function(e){if(this.menuItems_.length&&!(e.shiftKey||e.ctrlKey||e.metaKey||e.altKey)){var n=this.highlightedItem_;switch(e.keyCode){case t.utils.KeyCodes.ENTER:case t.utils.KeyCodes.SPACE:n&&n.performAction();break;case t.utils.KeyCodes.UP:this.highlightPrevious();break;case t.utils.KeyCodes.DOWN:this.highlightNext();break;case t.utils.KeyCodes.PAGE_UP:case t.utils.KeyCodes.HOME:this.highlightFirst_();break;case t.utils.KeyCodes.PAGE_DOWN:case t.utils.KeyCodes.END:this.highlightLast_();break;default:return}e.preventDefault(),e.stopPropagation()}},t.Menu.prototype.getSize=function(){var e=this.getElement(),n=t.utils.style.getSize(e);return n.height=e.scrollHeight,n},t.MenuItem=function(t,e){this.content_=t,this.value_=e,this.enabled_=!0,this.element_=null,this.rightToLeft_=!1,this.roleName_=null,this.highlight_=this.checked_=this.checkable_=!1,this.actionHandler_=null},t.MenuItem.prototype.createDom=function(){var e=document.createElement("div");e.id=t.utils.IdGenerator.getNextUniqueId(),this.element_=e,e.className="blocklyMenuItem goog-menuitem "+(this.enabled_?"":"blocklyMenuItemDisabled goog-menuitem-disabled ")+(this.checked_?"blocklyMenuItemSelected goog-option-selected ":"")+(this.highlight_?"blocklyMenuItemHighlight goog-menuitem-highlight ":"")+(this.rightToLeft_?"blocklyMenuItemRtl goog-menuitem-rtl ":"");var n=document.createElement("div");if(n.className="blocklyMenuItemContent goog-menuitem-content",this.checkable_){var r=document.createElement("div");r.className="blocklyMenuItemCheckbox goog-menuitem-checkbox",n.appendChild(r)}return r=this.content_,"string"==typeof this.content_&&(r=document.createTextNode(this.content_)),n.appendChild(r),e.appendChild(n),this.roleName_&&t.utils.aria.setRole(e,this.roleName_),t.utils.aria.setState(e,t.utils.aria.State.SELECTED,this.checkable_&&this.checked_||!1),t.utils.aria.setState(e,t.utils.aria.State.DISABLED,!this.enabled_),e},t.MenuItem.prototype.dispose=function(){this.element_=null},t.MenuItem.prototype.getElement=function(){return this.element_},t.MenuItem.prototype.getId=function(){return this.element_.id},t.MenuItem.prototype.getValue=function(){return this.value_},t.MenuItem.prototype.setRightToLeft=function(t){this.rightToLeft_=t},t.MenuItem.prototype.setRole=function(t){this.roleName_=t},t.MenuItem.prototype.setCheckable=function(t){this.checkable_=t},t.MenuItem.prototype.setChecked=function(t){this.checked_=t},t.MenuItem.prototype.setHighlighted=function(e){this.highlight_=e;var n=this.getElement();n&&this.isEnabled()&&(e?(t.utils.dom.addClass(n,"blocklyMenuItemHighlight"),t.utils.dom.addClass(n,"goog-menuitem-highlight")):(t.utils.dom.removeClass(n,"blocklyMenuItemHighlight"),t.utils.dom.removeClass(n,"goog-menuitem-highlight")))},t.MenuItem.prototype.isEnabled=function(){return this.enabled_},t.MenuItem.prototype.setEnabled=function(t){this.enabled_=t},t.MenuItem.prototype.performAction=function(){this.isEnabled()&&this.actionHandler_&&this.actionHandler_(this)},t.MenuItem.prototype.onAction=function(t,e){this.actionHandler_=t.bind(e)},t.ContextMenu={},t.ContextMenu.currentBlock=null,t.ContextMenu.menu_=null,t.ContextMenu.show=function(e,n,r){if(t.WidgetDiv.show(t.ContextMenu,r,t.ContextMenu.dispose),n.length){var i=t.ContextMenu.populate_(n,r);t.ContextMenu.menu_=i,t.ContextMenu.position_(i,e,r),setTimeout(function(){i.focus()},1),t.ContextMenu.currentBlock=null}else t.ContextMenu.hide()},t.ContextMenu.populate_=function(e,n){var r=new t.Menu;r.setRole(t.utils.aria.Role.MENU);for(var i,o=0;i=e[o];o++){var s=new t.MenuItem(i.text);s.setRightToLeft(n),s.setRole(t.utils.aria.Role.MENUITEM),r.addChild(s),s.setEnabled(i.enabled),i.enabled&&s.onAction(function(e){t.ContextMenu.hide(),this.callback(this.scope)},i)}return r},t.ContextMenu.position_=function(e,n,r){var i=t.utils.getViewportBBox();n=new t.utils.Rect(n.clientY+i.top,n.clientY+i.top,n.clientX+i.left,n.clientX+i.left),t.ContextMenu.createWidget_(e);var o=e.getSize();r&&(n.left+=o.width,n.right+=o.width,i.left+=o.width,i.right+=o.width),t.WidgetDiv.positionWithAnchor(i,n,o,r),e.focus()},t.ContextMenu.createWidget_=function(e){e.render(t.WidgetDiv.DIV);var n=e.getElement();t.utils.dom.addClass(n,"blocklyContextMenu"),t.browserEvents.conditionalBind(n,"contextmenu",null,t.utils.noEvent),e.focus()},t.ContextMenu.hide=function(){t.WidgetDiv.hideIfOwner(t.ContextMenu),t.ContextMenu.currentBlock=null},t.ContextMenu.dispose=function(){t.ContextMenu.menu_&&(t.ContextMenu.menu_.dispose(),t.ContextMenu.menu_=null)},t.ContextMenu.callbackFactory=function(e,n){return function(){t.Events.disable();try{var r=t.Xml.domToBlock(n,e.workspace),i=e.getRelativeToSurfaceXY();i.x=e.RTL?i.x-t.SNAP_RADIUS:i.x+t.SNAP_RADIUS,i.y+=2*t.SNAP_RADIUS,r.moveBy(i.x,i.y)}finally{t.Events.enable()}t.Events.isEnabled()&&!r.isShadow()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CREATE))(r)),r.select()}},t.ContextMenu.commentDeleteOption=function(e){return{text:t.Msg.REMOVE_COMMENT,enabled:!0,callback:function(){t.Events.setGroup(!0),e.dispose(!0,!0),t.Events.setGroup(!1)}}},t.ContextMenu.commentDuplicateOption=function(e){return{text:t.Msg.DUPLICATE_COMMENT,enabled:!0,callback:function(){t.duplicate(e)}}},t.ContextMenu.workspaceCommentOption=function(e,n){if(!t.WorkspaceCommentSvg)throw Error("Missing require for Blockly.WorkspaceCommentSvg");var r={enabled:!t.utils.userAgent.IE};return r.text=t.Msg.ADD_COMMENT,r.callback=function(){var r=new t.WorkspaceCommentSvg(e,t.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT,t.WorkspaceCommentSvg.DEFAULT_SIZE,t.WorkspaceCommentSvg.DEFAULT_SIZE),i=e.getInjectionDiv().getBoundingClientRect();i=new t.utils.Coordinate(n.clientX-i.left,n.clientY-i.top);var o=e.getOriginOffsetInPixels();(i=t.utils.Coordinate.difference(i,o)).scale(1/e.scale),r.moveBy(i.x,i.y),e.rendered&&(r.initSvg(),r.render(),r.select())},r},t.ContextMenuRegistry=function(){t.ContextMenuRegistry.registry=this,this.registry_=Object.create(null)},t.ContextMenuRegistry.ScopeType={BLOCK:"block",WORKSPACE:"workspace"},t.ContextMenuRegistry.registry=null,t.ContextMenuRegistry.prototype.register=function(t){if(this.registry_[t.id])throw Error('Menu item with ID "'+t.id+'" is already registered.');this.registry_[t.id]=t},t.ContextMenuRegistry.prototype.unregister=function(t){if(!this.registry_[t])throw Error('Menu item with ID "'+t+'" not found.');delete this.registry_[t]},t.ContextMenuRegistry.prototype.getItem=function(t){return this.registry_[t]||null},t.ContextMenuRegistry.prototype.getContextMenuOptions=function(t,e){var n=[],r=this.registry_;return Object.keys(r).forEach(function(i){if(i=r[i],t==i.scopeType){var o=i.preconditionFn(e);"hidden"!=o&&(i={text:"function"==typeof i.displayText?i.displayText(e):i.displayText,enabled:"enabled"==o,callback:i.callback,scope:e,weight:i.weight},n.push(i))}}),n.sort(function(t,e){return t.weight-e.weight}),n},new t.ContextMenuRegistry,t.Events.Selected=function(e,n,r){t.Events.Selected.superClass_.constructor.call(this,r),this.oldElementId=e,this.newElementId=n},t.utils.object.inherits(t.Events.Selected,t.Events.UiBase),t.Events.Selected.prototype.type=t.Events.SELECTED,t.Events.Selected.prototype.toJson=function(){var e=t.Events.Selected.superClass_.toJson.call(this);return e.oldElementId=this.oldElementId,e.newElementId=this.newElementId,e},t.Events.Selected.prototype.fromJson=function(e){t.Events.Selected.superClass_.fromJson.call(this,e),this.oldElementId=e.oldElementId,this.newElementId=e.newElementId},t.registry.register(t.registry.Type.EVENT,t.Events.SELECTED,t.Events.Selected),t.IBoundedElement=function(){},t.ICopyable=function(){},t.RenderedConnection=function(e,n){t.RenderedConnection.superClass_.constructor.call(this,e,n),this.db_=e.workspace.connectionDBList[n],this.dbOpposite_=e.workspace.connectionDBList[t.OPPOSITE_TYPE[n]],this.offsetInBlock_=new t.utils.Coordinate(0,0),this.trackedState_=t.RenderedConnection.TrackedState.WILL_TRACK,this.targetConnection=null},t.utils.object.inherits(t.RenderedConnection,t.Connection),t.RenderedConnection.TrackedState={WILL_TRACK:-1,UNTRACKED:0,TRACKED:1},t.RenderedConnection.prototype.dispose=function(){t.RenderedConnection.superClass_.dispose.call(this),this.trackedState_==t.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y)},t.RenderedConnection.prototype.getSourceBlock=function(){return t.RenderedConnection.superClass_.getSourceBlock.call(this)},t.RenderedConnection.prototype.targetBlock=function(){return t.RenderedConnection.superClass_.targetBlock.call(this)},t.RenderedConnection.prototype.distanceFrom=function(t){var e=this.x-t.x;return t=this.y-t.y,Math.sqrt(e*e+t*t)},t.RenderedConnection.prototype.bumpAwayFrom=function(e){if(!this.sourceBlock_.workspace.isDragging()){var n=this.sourceBlock_.getRootBlock();if(!n.isInFlyout){var r=!1;if(!n.isMovable()){if(!(n=e.getSourceBlock().getRootBlock()).isMovable())return;e=this,r=!0}var i=t.selected==n;i||n.addSelect();var o=e.x+t.SNAP_RADIUS+Math.floor(Math.random()*t.BUMP_RANDOMNESS)-this.x,s=e.y+t.SNAP_RADIUS+Math.floor(Math.random()*t.BUMP_RANDOMNESS)-this.y;r&&(s=-s),n.RTL&&(o=e.x-t.SNAP_RADIUS-Math.floor(Math.random()*t.BUMP_RANDOMNESS)-this.x),n.moveBy(o,s),i||n.removeSelect()}}},t.RenderedConnection.prototype.moveTo=function(e,n){this.trackedState_==t.RenderedConnection.TrackedState.WILL_TRACK?(this.db_.addConnection(this,n),this.trackedState_=t.RenderedConnection.TrackedState.TRACKED):this.trackedState_==t.RenderedConnection.TrackedState.TRACKED&&(this.db_.removeConnection(this,this.y),this.db_.addConnection(this,n)),this.x=e,this.y=n},t.RenderedConnection.prototype.moveBy=function(t,e){this.moveTo(this.x+t,this.y+e)},t.RenderedConnection.prototype.moveToOffset=function(t){this.moveTo(t.x+this.offsetInBlock_.x,t.y+this.offsetInBlock_.y)},t.RenderedConnection.prototype.setOffsetInBlock=function(t,e){this.offsetInBlock_.x=t,this.offsetInBlock_.y=e},t.RenderedConnection.prototype.getOffsetInBlock=function(){return this.offsetInBlock_},t.RenderedConnection.prototype.tighten=function(){var e=this.targetConnection.x-this.x,n=this.targetConnection.y-this.y;if(0!=e||0!=n){var r=this.targetBlock(),i=r.getSvgRoot();if(!i)throw Error("block is not rendered.");i=t.utils.getRelativeXY(i),r.getSvgRoot().setAttribute("transform","translate("+(i.x-e)+","+(i.y-n)+")"),r.moveConnections(-e,-n)}},t.RenderedConnection.prototype.closest=function(t,e){return this.dbOpposite_.searchForClosest(this,t,e)},t.RenderedConnection.prototype.highlight=function(){var e=this.sourceBlock_.workspace.getRenderer().getConstants(),n=e.shapeFor(this);this.type==t.connectionTypes.INPUT_VALUE||this.type==t.connectionTypes.OUTPUT_VALUE?(e=e.TAB_OFFSET_FROM_TOP,n=t.utils.svgPaths.moveBy(0,-e)+t.utils.svgPaths.lineOnAxis("v",e)+n.pathDown+t.utils.svgPaths.lineOnAxis("v",e)):(e=e.NOTCH_OFFSET_LEFT-e.CORNER_RADIUS,n=t.utils.svgPaths.moveBy(-e,0)+t.utils.svgPaths.lineOnAxis("h",e)+n.pathLeft+t.utils.svgPaths.lineOnAxis("h",e)),e=this.sourceBlock_.getRelativeToSurfaceXY(),t.Connection.highlightedPath_=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyHighlightedConnectionPath",d:n,transform:"translate("+(this.x-e.x)+","+(this.y-e.y)+")"+(this.sourceBlock_.RTL?" scale(-1 1)":"")},this.sourceBlock_.getSvgRoot())},t.RenderedConnection.prototype.unhighlight=function(){t.utils.dom.removeNode(t.Connection.highlightedPath_),delete t.Connection.highlightedPath_},t.RenderedConnection.prototype.setTracking=function(e){e&&this.trackedState_==t.RenderedConnection.TrackedState.TRACKED||!e&&this.trackedState_==t.RenderedConnection.TrackedState.UNTRACKED||this.sourceBlock_.isInFlyout||(e?(this.db_.addConnection(this,this.y),this.trackedState_=t.RenderedConnection.TrackedState.TRACKED):(this.trackedState_==t.RenderedConnection.TrackedState.TRACKED&&this.db_.removeConnection(this,this.y),this.trackedState_=t.RenderedConnection.TrackedState.UNTRACKED))},t.RenderedConnection.prototype.stopTrackingAll=function(){if(this.setTracking(!1),this.targetConnection)for(var t=this.targetBlock().getDescendants(!1),e=0;en)&&t.RenderedConnection.superClass_.isConnectionAllowed.call(this,e)},t.RenderedConnection.prototype.onFailedConnect=function(e){var n=this.getSourceBlock();if(t.Events.recordUndo){var r=t.Events.getGroup();setTimeout(function(){n.isDisposed()||n.getParent()||(t.Events.setGroup(r),this.bumpAwayFrom(e),t.Events.setGroup(!1))}.bind(this),t.BUMP_DELAY)}},t.RenderedConnection.prototype.disconnectInternal_=function(e,n){t.RenderedConnection.superClass_.disconnectInternal_.call(this,e,n),e.rendered&&e.render(),n.rendered&&(n.updateDisabled(),n.render(),n.getSvgRoot().style.display="block")},t.RenderedConnection.prototype.respawnShadow_=function(){t.RenderedConnection.superClass_.respawnShadow_.call(this);var e=this.targetBlock();e&&(e.initSvg(),e.render(!1),(e=this.getSourceBlock()).rendered&&e.render())},t.RenderedConnection.prototype.neighbours=function(t){return this.dbOpposite_.getNeighbours(this,t)},t.RenderedConnection.prototype.connect_=function(e){t.RenderedConnection.superClass_.connect_.call(this,e);var n=this.getSourceBlock();e=e.getSourceBlock();var r=n.rendered,i=e.rendered;r&&n.updateDisabled(),i&&e.updateDisabled(),r&&i&&(this.type==t.connectionTypes.NEXT_STATEMENT||this.type==t.connectionTypes.PREVIOUS_STATEMENT?e.render():n.render()),(n=n.getInputWithBlock(e))&&(n=n.isVisible(),e.getSvgRoot().style.display=n?"block":"none")},t.RenderedConnection.prototype.onCheckChanged_=function(){!this.isConnected()||this.targetConnection&&this.getConnectionChecker().canConnect(this,this.targetConnection,!1)||((this.isSuperior()?this.targetBlock():this.sourceBlock_).unplug(),this.sourceBlock_.bumpNeighbours())},t.BasicCursor=function(){t.BasicCursor.superClass_.constructor.call(this)},t.utils.object.inherits(t.BasicCursor,t.Cursor),t.BasicCursor.registrationName="basicCursor",t.BasicCursor.prototype.next=function(){var t=this.getCurNode();return t?((t=this.getNextNode_(t,this.validNode_))&&this.setCurNode(t),t):null},t.BasicCursor.prototype.in=function(){return this.next()},t.BasicCursor.prototype.prev=function(){var t=this.getCurNode();return t?((t=this.getPreviousNode_(t,this.validNode_))&&this.setCurNode(t),t):null},t.BasicCursor.prototype.out=function(){return this.prev()},t.BasicCursor.prototype.getNextNode_=function(t,e){if(!t)return null;var n=t.in()||t.next();return e(n)?n:n?this.getNextNode_(n,e):e(t=this.findSiblingOrParent_(t.out()))?t:t?this.getNextNode_(t,e):null},t.BasicCursor.prototype.getPreviousNode_=function(t,e){if(!t)return null;var n=t.prev();return e(n=n?this.getRightMostChild_(n):t.out())?n:n?this.getPreviousNode_(n,e):null},t.BasicCursor.prototype.validNode_=function(e){var n=!1;return(e=e&&e.getType())!=t.ASTNode.types.OUTPUT&&e!=t.ASTNode.types.INPUT&&e!=t.ASTNode.types.FIELD&&e!=t.ASTNode.types.NEXT&&e!=t.ASTNode.types.PREVIOUS&&e!=t.ASTNode.types.WORKSPACE||(n=!0),n},t.BasicCursor.prototype.findSiblingOrParent_=function(t){if(!t)return null;var e=t.next();return e||this.findSiblingOrParent_(t.out())},t.BasicCursor.prototype.getRightMostChild_=function(t){if(!t.in())return t;for(t=t.in();t.next();)t=t.next();return this.getRightMostChild_(t)},t.registry.register(t.registry.Type.CURSOR,t.BasicCursor.registrationName,t.BasicCursor),t.TabNavigateCursor=function(){t.TabNavigateCursor.superClass_.constructor.call(this)},t.utils.object.inherits(t.TabNavigateCursor,t.BasicCursor),t.TabNavigateCursor.prototype.validNode_=function(e){var n=!1,r=e&&e.getType();return e&&(e=e.getLocation(),r==t.ASTNode.types.FIELD&&e&&e.isTabNavigable()&&e.isClickable()&&(n=!0)),n},t.BlockSvg=function(e,n,r){this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},null),this.svgGroup_.translate_="",this.style=e.getRenderer().getConstants().getBlockStyle(null),this.pathObject=e.getRenderer().makePathObject(this.svgGroup_,this.style),this.renderIsInProgress_=this.rendered=!1,this.workspace=e,this.previousConnection=this.nextConnection=this.outputConnection=null,this.useDragSurface_=t.utils.is3dSupported()&&!!e.getBlockDragSurface();var i=this.pathObject.svgPath;i.tooltip=this,t.Tooltip.bindMouseEvents(i),t.BlockSvg.superClass_.constructor.call(this,e,n,r),this.svgGroup_.dataset?this.svgGroup_.dataset.id=this.id:t.utils.userAgent.IE&&this.svgGroup_.setAttribute("data-id",this.id)},t.utils.object.inherits(t.BlockSvg,t.Block),t.BlockSvg.prototype.height=0,t.BlockSvg.prototype.width=0,t.BlockSvg.prototype.warningTextDb_=null,t.BlockSvg.INLINE=-1,t.BlockSvg.COLLAPSED_WARNING_ID="TEMP_COLLAPSED_WARNING_",t.BlockSvg.prototype.initSvg=function(){if(!this.workspace.rendered)throw TypeError("Workspace is headless.");for(var e,n=0;e=this.inputList[n];n++)e.init();for(e=this.getIcons(),n=0;n=this.connections_.length)return-1;e=t.y;for(var r=n;0<=r&&this.connections_[r].y==e;){if(this.connections_[r]==t)return r;r--}for(r=n;rt)){e=r;break}n=r}}return e},t.ConnectionDB.prototype.removeConnection=function(t,e){if(-1==(t=this.findIndexOfConnection_(t,e)))throw Error("Unable to find connection in connectionDB.");this.connections_.splice(t,1)},t.ConnectionDB.prototype.getNeighbours=function(t,e){function n(t){var n=i-r[t].x,s=o-r[t].y;return Math.sqrt(n*n+s*s)<=e&&l.push(r[t]),s(t=this.subscribedWorkspaces_.indexOf(t)))throw Error("Cannot unsubscribe a workspace that hasn't been subscribed.");this.subscribedWorkspaces_.splice(t,1)},t.ThemeManager.prototype.subscribe=function(t,e,n){this.componentDB_[e]||(this.componentDB_[e]=[]),this.componentDB_[e].push({element:t,propertyName:n}),e=this.theme_&&this.theme_.getComponentStyle(e),t.style[n]=e||""},t.ThemeManager.prototype.unsubscribe=function(t){if(t)for(var e,n=Object.keys(this.componentDB_),r=0;e=n[r];r++){for(var i=this.componentDB_[e],o=i.length-1;0<=o;o--)i[o].element===t&&i.splice(o,1);this.componentDB_[e].length||delete this.componentDB_[e]}},t.ThemeManager.prototype.dispose=function(){this.componentDB_=this.subscribedWorkspaces_=this.theme_=this.owner_=null},t.TouchGesture=function(e,n){t.TouchGesture.superClass_.constructor.call(this,e,n),this.isMultiTouch_=!1,this.cachedPoints_=Object.create(null),this.startDistance_=this.previousScale_=0,this.isPinchZoomEnabled_=this.onStartWrapper_=null},t.utils.object.inherits(t.TouchGesture,t.Gesture),t.TouchGesture.ZOOM_IN_MULTIPLIER=5,t.TouchGesture.ZOOM_OUT_MULTIPLIER=6,t.TouchGesture.prototype.doStart=function(e){this.isPinchZoomEnabled_=this.startWorkspace_.options.zoomOptions&&this.startWorkspace_.options.zoomOptions.pinch,t.TouchGesture.superClass_.doStart.call(this,e),!this.isEnding_&&t.Touch.isTouchEvent(e)&&this.handleTouchStart(e)},t.TouchGesture.prototype.bindMouseEvents=function(e){this.onStartWrapper_=t.browserEvents.conditionalBind(document,"mousedown",null,this.handleStart.bind(this),!0),this.onMoveWrapper_=t.browserEvents.conditionalBind(document,"mousemove",null,this.handleMove.bind(this),!0),this.onUpWrapper_=t.browserEvents.conditionalBind(document,"mouseup",null,this.handleUp.bind(this),!0),e.preventDefault(),e.stopPropagation()},t.TouchGesture.prototype.handleStart=function(e){!this.isDragging()&&t.Touch.isTouchEvent(e)&&(this.handleTouchStart(e),this.isMultiTouch()&&t.longStop_())},t.TouchGesture.prototype.handleMove=function(e){this.isDragging()?t.Touch.shouldHandleEvent(e)&&t.TouchGesture.superClass_.handleMove.call(this,e):this.isMultiTouch()?(t.Touch.isTouchEvent(e)&&this.handleTouchMove(e),t.longStop_()):t.TouchGesture.superClass_.handleMove.call(this,e)},t.TouchGesture.prototype.handleUp=function(e){t.Touch.isTouchEvent(e)&&!this.isDragging()&&this.handleTouchEnd(e),!this.isMultiTouch()||this.isDragging()?t.Touch.shouldHandleEvent(e)&&t.TouchGesture.superClass_.handleUp.call(this,e):(e.preventDefault(),e.stopPropagation(),this.dispose())},t.TouchGesture.prototype.isMultiTouch=function(){return this.isMultiTouch_},t.TouchGesture.prototype.dispose=function(){t.TouchGesture.superClass_.dispose.call(this),this.onStartWrapper_&&t.browserEvents.unbind(this.onStartWrapper_)},t.TouchGesture.prototype.handleTouchStart=function(e){var n=t.Touch.getTouchIdentifierFromEvent(e);this.cachedPoints_[n]=this.getTouchPoint(e),2==(n=Object.keys(this.cachedPoints_)).length&&(this.startDistance_=t.utils.Coordinate.distance(this.cachedPoints_[n[0]],this.cachedPoints_[n[1]]),this.isMultiTouch_=!0,e.preventDefault())},t.TouchGesture.prototype.handleTouchMove=function(e){var n=t.Touch.getTouchIdentifierFromEvent(e);this.cachedPoints_[n]=this.getTouchPoint(e),n=Object.keys(this.cachedPoints_),this.isPinchZoomEnabled_&&2===n.length?this.handlePinch_(e):t.TouchGesture.superClass_.handleMove.call(this,e)},t.TouchGesture.prototype.handlePinch_=function(e){var n=Object.keys(this.cachedPoints_);if(n=t.utils.Coordinate.distance(this.cachedPoints_[n[0]],this.cachedPoints_[n[1]])/this.startDistance_,0this.previousScale_){var r=n-this.previousScale_;r=0Object.keys(this.cachedPoints_).length&&(this.cachedPoints_=Object.create(null),this.previousScale_=0)},t.TouchGesture.prototype.getTouchPoint=function(e){return this.startWorkspace_?new t.utils.Coordinate(e.pageX?e.pageX:e.changedTouches[0].pageX,e.pageY?e.pageY:e.changedTouches[0].pageY):null},t.WorkspaceAudio=function(t){this.parentWorkspace_=t,this.SOUNDS_=Object.create(null)},t.WorkspaceAudio.prototype.lastSound_=null,t.WorkspaceAudio.prototype.dispose=function(){this.SOUNDS_=this.parentWorkspace_=null},t.WorkspaceAudio.prototype.load=function(e,n){if(e.length){try{var r=new t.utils.global.Audio}catch(t){return}for(var i,o=0;oMath.abs(n-this.oldTop_)&&1>Math.abs(r-this.oldLeft_))){var i=new(t.Events.get(t.Events.VIEWPORT_CHANGE))(n,r,e,this.id,this.oldScale_);this.oldScale_=e,this.oldTop_=n,this.oldLeft_=r,t.Events.fire(i)}}},t.WorkspaceSvg.prototype.translate=function(t,e){if(this.useWorkspaceDragSurface_&&this.isDragSurfaceActive_)this.workspaceDragSurface_.translateSurface(t,e);else{var n="translate("+t+","+e+") scale("+this.scale+")";this.svgBlockCanvas_.setAttribute("transform",n),this.svgBubbleCanvas_.setAttribute("transform",n)}this.blockDragSurface_&&this.blockDragSurface_.translateAndScaleGroup(t,e,this.scale),this.grid_&&this.grid_.moveTo(t,e),this.maybeFireViewportChangeEvent()},t.WorkspaceSvg.prototype.resetDragSurface=function(){if(this.useWorkspaceDragSurface_){this.isDragSurfaceActive_=!1;var t=this.workspaceDragSurface_.getSurfaceTranslation();this.workspaceDragSurface_.clearAndHide(this.svgGroup_),t="translate("+t.x+","+t.y+") scale("+this.scale+")",this.svgBlockCanvas_.setAttribute("transform",t),this.svgBubbleCanvas_.setAttribute("transform",t)}},t.WorkspaceSvg.prototype.setupDragSurface=function(){if(this.useWorkspaceDragSurface_&&!this.isDragSurfaceActive_){this.isDragSurfaceActive_=!0;var e=this.svgBlockCanvas_.previousSibling,n=parseInt(this.getParentSvg().getAttribute("width"),10),r=parseInt(this.getParentSvg().getAttribute("height"),10),i=t.utils.getRelativeXY(this.getCanvas());this.workspaceDragSurface_.setContentsAndShow(this.getCanvas(),this.getBubbleCanvas(),e,n,r,this.scale),this.workspaceDragSurface_.translateSurface(i.x,i.y)}},t.WorkspaceSvg.prototype.getBlockDragSurface=function(){return this.blockDragSurface_},t.WorkspaceSvg.prototype.getWidth=function(){var t=this.getMetrics();return t?t.viewWidth/this.scale:0},t.WorkspaceSvg.prototype.setVisible=function(e){if(this.isVisible_=e,this.svgGroup_)if(this.scrollbar&&this.scrollbar.setContainerVisible(e),this.getFlyout()&&this.getFlyout().setContainerVisible(e),this.getParentSvg().style.display=e?"block":"none",this.toolbox_&&this.toolbox_.setVisible(e),e){for(var n=(e=this.getAllBlocks(!1)).length-1;0<=n;n--)e[n].markDirty();this.render(),this.toolbox_&&this.toolbox_.position()}else t.hideChaff(!0)},t.WorkspaceSvg.prototype.render=function(){for(var t=this.getAllBlocks(!1),e=t.length-1;0<=e;e--)t[e].render(!1);if(this.currentGesture_)for(t=this.currentGesture_.getInsertionMarkers(),e=0;e=this.remainingCapacity()||(this.currentGesture_&&this.currentGesture_.cancel(),"comment"==t.tagName.toLowerCase()?this.pasteWorkspaceComment_(t):this.pasteBlock_(t))},t.WorkspaceSvg.prototype.pasteBlock_=function(e){t.Events.disable();try{var n=t.Xml.domToBlock(e,this),r=parseInt(e.getAttribute("x"),10),i=parseInt(e.getAttribute("y"),10);if(!isNaN(r)&&!isNaN(i)){this.RTL&&(r=-r);do{e=!1;for(var o,s=this.getAllBlocks(!1),a=0;o=s[a];a++){var l=o.getRelativeToSurfaceXY();if(1>=Math.abs(r-l.x)&&1>=Math.abs(i-l.y)){e=!0;break}}if(!e){var u,c=n.getConnections_(!1);for(a=0;u=c[a];a++)if(u.closest(t.SNAP_RADIUS,new t.utils.Coordinate(r,i)).connection){e=!0;break}}e&&(r=this.RTL?r-t.SNAP_RADIUS:r+t.SNAP_RADIUS,i+=2*t.SNAP_RADIUS)}while(e);n.moveBy(r,i)}}finally{t.Events.enable()}t.Events.isEnabled()&&!n.isShadow()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CREATE))(n)),n.select()},t.WorkspaceSvg.prototype.pasteWorkspaceComment_=function(e){t.Events.disable();try{var n=t.WorkspaceCommentSvg.fromXml(e,this),r=parseInt(e.getAttribute("x"),10),i=parseInt(e.getAttribute("y"),10);isNaN(r)||isNaN(i)||(this.RTL&&(r=-r),n.moveBy(r+50,i+50))}finally{t.Events.enable()}t.Events.isEnabled()&&t.WorkspaceComment.fireCreateEvent(n),n.select()},t.WorkspaceSvg.prototype.refreshToolboxSelection=function(){var t=this.isFlyout?this.targetWorkspace:this;t&&!t.currentGesture_&&t.toolbox_&&t.toolbox_.getFlyout()&&t.toolbox_.refreshSelection()},t.WorkspaceSvg.prototype.renameVariableById=function(e,n){t.WorkspaceSvg.superClass_.renameVariableById.call(this,e,n),this.refreshToolboxSelection()},t.WorkspaceSvg.prototype.deleteVariableById=function(e){t.WorkspaceSvg.superClass_.deleteVariableById.call(this,e),this.refreshToolboxSelection()},t.WorkspaceSvg.prototype.createVariable=function(e,n,r){return e=t.WorkspaceSvg.superClass_.createVariable.call(this,e,n,r),this.refreshToolboxSelection(),e},t.WorkspaceSvg.prototype.recordDeleteAreas=function(){t.utils.deprecation.warn("WorkspaceSvg.prototype.recordDeleteAreas","June 2021","June 2022","WorkspaceSvg.prototype.recordDragTargets"),this.recordDragTargets()},t.WorkspaceSvg.prototype.recordDragTargets=function(){var e=this.componentManager_.getComponents(t.ComponentManager.Capability.DRAG_TARGET,!0);this.dragTargetAreas_=[];for(var n,r=0;n=e[r];r++){var i=n.getClientRect();i&&this.dragTargetAreas_.push({component:n,clientRect:i})}},t.WorkspaceSvg.prototype.getDragTarget=function(t){for(var e,n=0;e=this.dragTargetAreas_[n];n++)if(e.clientRect.contains(t.clientX,t.clientY))return e.component;return null},t.WorkspaceSvg.prototype.onMouseDown_=function(t){var e=this.getGesture(t);e&&e.handleWsStart(t,this)},t.WorkspaceSvg.prototype.startDrag=function(e,n){(e=t.utils.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,e.y/=this.scale,this.dragDeltaXY_=t.utils.Coordinate.difference(n,e)},t.WorkspaceSvg.prototype.moveDrag=function(e){return(e=t.utils.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM())).x/=this.scale,e.y/=this.scale,t.utils.Coordinate.sum(this.dragDeltaXY_,e)},t.WorkspaceSvg.prototype.isDragging=function(){return null!=this.currentGesture_&&this.currentGesture_.isDragging()},t.WorkspaceSvg.prototype.isDraggable=function(){return this.options.moveOptions&&this.options.moveOptions.drag},t.WorkspaceSvg.prototype.isMovable=function(){return this.options.moveOptions&&!!this.options.moveOptions.scrollbars||this.options.moveOptions&&this.options.moveOptions.wheel||this.options.moveOptions&&this.options.moveOptions.drag||this.options.zoomOptions&&this.options.zoomOptions.wheel||this.options.zoomOptions&&this.options.zoomOptions.pinch},t.WorkspaceSvg.prototype.isMovableHorizontally=function(){var t=!!this.scrollbar;return this.isMovable()&&(!t||t&&this.scrollbar.canScrollHorizontally())},t.WorkspaceSvg.prototype.isMovableVertically=function(){var t=!!this.scrollbar;return this.isMovable()&&(!t||t&&this.scrollbar.canScrollVertically())},t.WorkspaceSvg.prototype.onMouseWheel_=function(e){if(t.Gesture.inProgress())e.preventDefault(),e.stopPropagation();else{var n=this.options.zoomOptions&&this.options.zoomOptions.wheel,r=this.options.moveOptions&&this.options.moveOptions.wheel;if(n||r){var i=t.utils.getScrollDeltaPixels(e);!n||!e.ctrlKey&&r?(n=this.scrollX-i.x,r=this.scrollY-i.y,e.shiftKey&&!i.x&&(n=this.scrollX-i.y,r=this.scrollY),this.scroll(n,r)):(i=-i.y/50,n=t.utils.mouseToSvg(e,this.getParentSvg(),this.getInverseScreenCTM()),this.zoom(n.x,n.y,i)),e.preventDefault()}}},t.WorkspaceSvg.prototype.getBlocksBoundingBox=function(){var e=this.getTopBoundedElements();if(!e.length)return new t.utils.Rect(0,0,0,0);for(var n=e[0].getBoundingRectangle(),r=1;rn.bottom&&(n.bottom=i.bottom),i.leftn.right&&(n.right=i.right))}return n},t.WorkspaceSvg.prototype.cleanUp=function(){this.setResizesEnabled(!1),t.Events.setGroup(!0);for(var e,n=this.getTopBlocks(!0),r=0,i=0;e=n[i];i++)if(e.isMovable()){var o=e.getRelativeToSurfaceXY();e.moveBy(-o.x,r-o.y),e.snapToGrid(),r=e.getRelativeToSurfaceXY().y+e.getHeightWidth().height+this.renderer_.getConstants().MIN_BLOCK_HEIGHT}t.Events.setGroup(!1),this.setResizesEnabled(!0)},t.WorkspaceSvg.prototype.showContextMenu=function(e){if(!this.options.readOnly&&!this.isFlyout){var n=t.ContextMenuRegistry.registry.getContextMenuOptions(t.ContextMenuRegistry.ScopeType.WORKSPACE,{workspace:this});this.configureContextMenu&&this.configureContextMenu(n,e),t.ContextMenu.show(e,n,this.RTL)}},t.WorkspaceSvg.prototype.updateToolbox=function(e){if(e=t.utils.toolbox.convertToolboxDefToJson(e)){if(!this.options.languageTree)throw Error("Existing toolbox is null. Can't create new toolbox.");if(t.utils.toolbox.hasCategories(e)){if(!this.toolbox_)throw Error("Existing toolbox has no categories. Can't change mode.");this.options.languageTree=e,this.toolbox_.render(e)}else{if(!this.flyout_)throw Error("Existing toolbox has categories. Can't change mode.");this.options.languageTree=e,this.flyout_.show(e)}}else if(this.options.languageTree)throw Error("Can't nullify an existing toolbox.")},t.WorkspaceSvg.prototype.markFocused=function(){this.options.parentWorkspace?this.options.parentWorkspace.markFocused():(t.mainWorkspace=this,this.setBrowserFocus())},t.WorkspaceSvg.prototype.setBrowserFocus=function(){document.activeElement&&document.activeElement.blur&&document.activeElement.blur();try{this.getParentSvg().focus({preventScroll:!0})}catch(t){try{this.getParentSvg().parentNode.setActive()}catch(t){this.getParentSvg().parentNode.focus({preventScroll:!0})}}},t.WorkspaceSvg.prototype.zoom=function(t,e,n){n=Math.pow(this.options.zoomOptions.scaleSpeed,n);var r=this.scale*n;if(this.scale!=r){r>this.options.zoomOptions.maxScale?n=this.options.zoomOptions.maxScale/this.scale:rthis.options.zoomOptions.maxScale?e=this.options.zoomOptions.maxScale:this.options.zoomOptions.minScale&&en.oldScale&&t.bumpTopObjectsIntoBounds_(e)}},t.bumpObjectIntoBounds_=function(e,n,r){var i=r.getBoundingRectangle(),o=i.right-i.left,s=t.utils.math.clamp(n.top,i.top,n.top+n.height-(i.bottom-i.top))-i.top,a=n.left;return n=n.left+n.width-o,e.RTL?a=Math.min(n,a):n=Math.max(a,n),!(!(e=t.utils.math.clamp(a,i.left,n)-i.left)&&!s)&&(r.moveBy(e,s),!0)},t.init_=function(e){var n=e.options,r=e.getParentSvg();if(t.browserEvents.conditionalBind(r.parentNode,"contextmenu",null,function(e){t.utils.isTargetInput(e)||e.preventDefault()}),r=t.browserEvents.conditionalBind(window,"resize",null,function(){t.hideChaff(!0),t.svgResize(e),t.bumpTopObjectsIntoBounds_(e)}),e.setResizeHandlerWrapper(r),t.inject.bindDocumentEvents_(),n.languageTree){r=e.getToolbox();var i=e.getFlyout(!0);r?r.init():i&&(i.init(e),i.show(n.languageTree),"function"==typeof i.scrollToStart&&i.scrollToStart())}n.hasTrashcan&&e.trashcan.init(),n.zoomOptions&&n.zoomOptions.controls&&e.zoomControls_.init(),n.moveOptions&&n.moveOptions.scrollbars?(e.scrollbar=new t.ScrollbarPair(e,!0===n.moveOptions.scrollbars||!!n.moveOptions.scrollbars.horizontal,!0===n.moveOptions.scrollbars||!!n.moveOptions.scrollbars.vertical,"blocklyMainWorkspaceScrollbar"),e.scrollbar.resize()):e.setMetrics({x:.5,y:.5}),n.hasSounds&&t.inject.loadSounds_(n.pathToMedia,e)},t.inject.bindDocumentEvents_=function(){t.documentEventsBound_||(t.browserEvents.conditionalBind(document,"scroll",null,function(){for(var e,n=t.Workspace.getAll(),r=0;e=n[r];r++)e.updateInverseScreenCTM&&e.updateInverseScreenCTM()}),t.browserEvents.conditionalBind(document,"keydown",null,t.onKeyDown),t.browserEvents.bind(document,"touchend",null,t.longStop_),t.browserEvents.bind(document,"touchcancel",null,t.longStop_),t.utils.userAgent.IPAD&&t.browserEvents.conditionalBind(window,"orientationchange",document,function(){t.svgResize(t.getMainWorkspace())})),t.documentEventsBound_=!0},t.inject.loadSounds_=function(e,n){var r=n.getAudioManager();r.load([e+"click.mp3",e+"click.wav",e+"click.ogg"],"click"),r.load([e+"disconnect.wav",e+"disconnect.mp3",e+"disconnect.ogg"],"disconnect"),r.load([e+"delete.mp3",e+"delete.ogg",e+"delete.wav"],"delete");var i=[];e=function(){for(;i.length;)t.browserEvents.unbind(i.pop());r.preload()},i.push(t.browserEvents.conditionalBind(document,"mousemove",null,e,!0)),i.push(t.browserEvents.conditionalBind(document,"touchstart",null,e,!0))},t.Names=function(t,e){if(this.variablePrefix_=e||"",this.reservedDict_=Object.create(null),t)for(t=t.split(","),e=0;er.indexOf(n))throw Error(n+" is not a valid modifier key.")},t.ShortcutRegistry.prototype.createSerializedKey=function(e,n){var r="";if(n)for(var i in this.checkModifiers_(n),t.ShortcutRegistry.modifierKeys)-11'),i.appendChild(r),n.push(i)),t.Blocks.variables_get){e.sort(t.VariableModel.compareByName),r=0;for(var o;o=e[r];r++)(i=t.utils.xml.createElement("block")).setAttribute("type","variables_get"),i.setAttribute("gap",8),i.appendChild(t.Variables.generateVariableFieldDom(o)),n.push(i)}}return n},t.Variables.VAR_LETTER_OPTIONS="ijkmnopqrstuvwxyzabcdefgh",t.Variables.generateUniqueName=function(e){return t.Variables.generateUniqueNameFromOptions(t.Variables.VAR_LETTER_OPTIONS.charAt(0),e.getAllVariableNames())},t.Variables.generateUniqueNameFromOptions=function(e,n){if(!n.length)return e;for(var r=t.Variables.VAR_LETTER_OPTIONS,i="",o=r.indexOf(e);;){for(var s=!1,a=0;a90-e||t>-90-e&&t<-90+e},t.HorizontalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;var e=this.svgGroup_.getBoundingClientRect(),n=e.top;return this.toolboxPosition_==t.utils.toolbox.Position.TOP?new t.utils.Rect(-1e9,n+e.height,-1e9,1e9):new t.utils.Rect(n,1e9,-1e9,1e9)},t.HorizontalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.getFlyoutScale();for(var e,n=0,r=this.workspace_.getTopBlocks(!1),i=0;e=r[i];i++)n=Math.max(n,e.getHeightWidth().height);if(n+=1.5*this.MARGIN,n*=this.workspace_.scale,n+=t.Scrollbar.scrollbarThickness,this.height_!=n){for(i=0;e=r[i];i++)e.flyoutRect_&&this.moveRectToBlock_(e.flyoutRect_,e);this.targetWorkspace.toolboxPosition!=this.toolboxPosition_||this.toolboxPosition_!=t.utils.toolbox.Position.TOP||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX,this.targetWorkspace.scrollY+n),this.height_=n,this.position(),this.targetWorkspace.recordDragTargets()}},t.registry.register(t.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,t.registry.DEFAULT,t.HorizontalFlyout),t.VerticalFlyout=function(e){t.VerticalFlyout.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.VerticalFlyout,t.Flyout),t.VerticalFlyout.registryName="verticalFlyout",t.VerticalFlyout.prototype.setMetrics_=function(t){if(this.isVisible()){var e=this.workspace_.getMetricsManager(),n=e.getScrollMetrics(),r=e.getViewMetrics();e=e.getAbsoluteMetrics(),"number"==typeof t.y&&(this.workspace_.scrollY=-(n.top+(n.height-r.height)*t.y)),this.workspace_.translate(this.workspace_.scrollX+e.left,this.workspace_.scrollY+e.top)}},t.VerticalFlyout.prototype.getX=function(){if(!this.isVisible())return 0;var e=this.targetWorkspace.getMetricsManager(),n=e.getAbsoluteMetrics(),r=e.getViewMetrics();return e=e.getToolboxMetrics(),this.targetWorkspace.toolboxPosition==this.toolboxPosition_?this.targetWorkspace.getToolbox()?this.toolboxPosition_==t.utils.toolbox.Position.LEFT?e.width:r.width-this.width_:this.toolboxPosition_==t.utils.toolbox.Position.LEFT?0:r.width:this.toolboxPosition_==t.utils.toolbox.Position.LEFT?0:r.width+n.left-this.width_},t.VerticalFlyout.prototype.getY=function(){return 0},t.VerticalFlyout.prototype.position=function(){if(this.isVisible()&&this.targetWorkspace.isVisible()){var t=this.targetWorkspace.getMetricsManager().getViewMetrics();this.height_=t.height,this.setBackgroundPath_(this.width_-this.CORNER_RADIUS,t.height-2*this.CORNER_RADIUS),t=this.getX();var e=this.getY();this.positionAt_(this.width_,this.height_,t,e)}},t.VerticalFlyout.prototype.setBackgroundPath_=function(e,n){var r=this.toolboxPosition_==t.utils.toolbox.Position.RIGHT,i=e+this.CORNER_RADIUS;(i=["M "+(r?i:0)+",0"]).push("h",r?-e:e),i.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,r?0:1,r?-this.CORNER_RADIUS:this.CORNER_RADIUS,this.CORNER_RADIUS),i.push("v",Math.max(0,n)),i.push("a",this.CORNER_RADIUS,this.CORNER_RADIUS,0,0,r?0:1,r?this.CORNER_RADIUS:-this.CORNER_RADIUS,this.CORNER_RADIUS),i.push("h",r?e:-e),i.push("z"),this.svgBackground_.setAttribute("d",i.join(" "))},t.VerticalFlyout.prototype.scrollToStart=function(){this.workspace_.scrollbar.setY(0)},t.VerticalFlyout.prototype.wheel_=function(e){var n=t.utils.getScrollDeltaPixels(e);if(n.y){var r=this.workspace_.getMetricsManager(),i=r.getScrollMetrics();n=r.getViewMetrics().top-i.top+n.y,this.workspace_.scrollbar.setY(n),t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation()}e.preventDefault(),e.stopPropagation()},t.VerticalFlyout.prototype.layout_=function(t,e){this.workspace_.scale=this.targetWorkspace.scale;for(var n,r=this.MARGIN,i=this.RTL?r:r+this.tabWidth_,o=0;n=t[o];o++)if("block"==n.type){for(var s,a=(n=n.block).getDescendants(!1),l=0;s=a[l];l++)s.isInFlyout=!0;n.render(),a=n.getSvgRoot(),l=n.getHeightWidth(),s=n.outputConnection?i-this.tabWidth_:i,n.moveBy(s,r),s=this.createRect_(n,this.RTL?s-l.width:s,r,l,o),this.addBlockListeners_(a,n,s),r+=l.height+e[o]}else"button"==n.type&&(this.initFlyoutButton_(n.button,i,r),r+=n.button.height+e[o])},t.VerticalFlyout.prototype.isDragTowardWorkspace=function(t){t=Math.atan2(t.y,t.x)/Math.PI*180;var e=this.dragAngleRange_;return t-e||t<-180+e||t>180-e},t.VerticalFlyout.prototype.getClientRect=function(){if(!this.svgGroup_||this.autoClose||!this.isVisible())return null;var e=this.svgGroup_.getBoundingClientRect(),n=e.left;return this.toolboxPosition_==t.utils.toolbox.Position.LEFT?new t.utils.Rect(-1e9,1e9,-1e9,n+e.width):new t.utils.Rect(-1e9,1e9,n,1e9)},t.VerticalFlyout.prototype.reflowInternal_=function(){this.workspace_.scale=this.getFlyoutScale();for(var e,n=0,r=this.workspace_.getTopBlocks(!1),i=0;e=r[i];i++){var o=e.getHeightWidth().width;e.outputConnection&&(o-=this.tabWidth_),n=Math.max(n,o)}for(i=0;e=this.buttons_[i];i++)n=Math.max(n,e.width);if(n+=1.5*this.MARGIN+this.tabWidth_,n*=this.workspace_.scale,n+=t.Scrollbar.scrollbarThickness,this.width_!=n){for(i=0;e=r[i];i++){if(this.RTL){o=e.getRelativeToSurfaceXY().x;var s=n/this.workspace_.scale-this.MARGIN;e.outputConnection||(s-=this.tabWidth_),e.moveBy(s-o,0)}e.flyoutRect_&&this.moveRectToBlock_(e.flyoutRect_,e)}if(this.RTL)for(i=0;e=this.buttons_[i];i++)r=e.getPosition().y,e.moveTo(n/this.workspace_.scale-e.width-this.MARGIN-this.tabWidth_,r);this.targetWorkspace.toolboxPosition!=this.toolboxPosition_||this.toolboxPosition_!=t.utils.toolbox.Position.LEFT||this.targetWorkspace.getToolbox()||this.targetWorkspace.translate(this.targetWorkspace.scrollX+n,this.targetWorkspace.scrollY),this.width_=n,this.position(),this.targetWorkspace.recordDragTargets()}},t.registry.register(t.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,t.registry.DEFAULT,t.VerticalFlyout),t.FlyoutButton=function(e,n,r,i){this.workspace_=e,this.targetWorkspace_=n,this.text_=r.text,this.position_=new t.utils.Coordinate(0,0),this.isLabel_=i,this.callbackKey_=r.callbackKey||r.callbackkey,this.cssClass_=r["web-class"]||null,this.onMouseUpWrapper_=null,this.info=r},t.FlyoutButton.MARGIN_X=5,t.FlyoutButton.MARGIN_Y=2,t.FlyoutButton.prototype.width=0,t.FlyoutButton.prototype.height=0,t.FlyoutButton.prototype.createDom=function(){var e=this.isLabel_?"blocklyFlyoutLabel":"blocklyFlyoutButton";if(this.cssClass_&&(e+=" "+this.cssClass_),this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:e},this.workspace_.getCanvas()),!this.isLabel_)var n=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"blocklyFlyoutButtonShadow",rx:4,ry:4,x:1,y:1},this.svgGroup_);e=t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:this.isLabel_?"blocklyFlyoutLabelBackground":"blocklyFlyoutButtonBackground",rx:4,ry:4},this.svgGroup_);var r=t.utils.dom.createSvgElement(t.utils.Svg.TEXT,{class:this.isLabel_?"blocklyFlyoutLabelText":"blocklyText",x:0,y:0,"text-anchor":"middle"},this.svgGroup_),i=t.utils.replaceMessageReferences(this.text_);this.workspace_.RTL&&(i+="‏"),r.textContent=i,this.isLabel_&&(this.svgText_=r,this.workspace_.getThemeManager().subscribe(this.svgText_,"flyoutForegroundColour","fill"));var o=t.utils.style.getComputedStyle(r,"fontSize"),s=t.utils.style.getComputedStyle(r,"fontWeight"),a=t.utils.style.getComputedStyle(r,"fontFamily");return this.width=t.utils.dom.getFastTextWidthWithSizeString(r,o,s,a),i=t.utils.dom.measureFontMetrics(i,o,s,a),this.height=i.height,this.isLabel_||(this.width+=2*t.FlyoutButton.MARGIN_X,this.height+=2*t.FlyoutButton.MARGIN_Y,n.setAttribute("width",this.width),n.setAttribute("height",this.height)),e.setAttribute("width",this.width),e.setAttribute("height",this.height),r.setAttribute("x",this.width/2),r.setAttribute("y",this.height/2-i.height/2+i.baseline),this.updateTransform_(),this.onMouseUpWrapper_=t.browserEvents.conditionalBind(this.svgGroup_,"mouseup",this,this.onMouseUp_),this.svgGroup_},t.FlyoutButton.prototype.show=function(){this.updateTransform_(),this.svgGroup_.setAttribute("display","block")},t.FlyoutButton.prototype.updateTransform_=function(){this.svgGroup_.setAttribute("transform","translate("+this.position_.x+","+this.position_.y+")")},t.FlyoutButton.prototype.moveTo=function(t,e){this.position_.x=t,this.position_.y=e,this.updateTransform_()},t.FlyoutButton.prototype.isLabel=function(){return this.isLabel_},t.FlyoutButton.prototype.getPosition=function(){return this.position_},t.FlyoutButton.prototype.getButtonText=function(){return this.text_},t.FlyoutButton.prototype.getTargetWorkspace=function(){return this.targetWorkspace_},t.FlyoutButton.prototype.dispose=function(){this.onMouseUpWrapper_&&t.browserEvents.unbind(this.onMouseUpWrapper_),this.svgGroup_&&t.utils.dom.removeNode(this.svgGroup_),this.svgText_&&this.workspace_.getThemeManager().unsubscribe(this.svgText_)},t.FlyoutButton.prototype.onMouseUp_=function(t){(t=this.targetWorkspace_.getGesture(t))&&t.cancel(),this.isLabel_&&this.callbackKey_?console.warn("Labels should not have callbacks. Label text: "+this.text_):this.isLabel_||this.callbackKey_&&this.targetWorkspace_.getButtonCallback(this.callbackKey_)?this.isLabel_||this.targetWorkspace_.getButtonCallback(this.callbackKey_)(this):console.warn("Buttons should have callbacks. Button text: "+this.text_)},t.Css.register(".blocklyFlyoutButton {,fill: #888;,cursor: default;,},.blocklyFlyoutButtonShadow {,fill: #666;,},.blocklyFlyoutButton:hover {,fill: #aaa;,},.blocklyFlyoutLabel {,cursor: default;,},.blocklyFlyoutLabelBackground {,opacity: 0;,}".split(",")),t.Generator=function(t){this.name_=t,this.FUNCTION_NAME_PLACEHOLDER_REGEXP_=new RegExp(this.FUNCTION_NAME_PLACEHOLDER_,"g")},t.Generator.prototype.INFINITE_LOOP_TRAP=null,t.Generator.prototype.STATEMENT_PREFIX=null,t.Generator.prototype.STATEMENT_SUFFIX=null,t.Generator.prototype.INDENT=" ",t.Generator.prototype.COMMENT_WRAP=60,t.Generator.prototype.ORDER_OVERRIDES=[],t.Generator.prototype.isInitialized=null,t.Generator.prototype.workspaceToCode=function(e){e||(console.warn("No workspace specified in workspaceToCode call. Guessing."),e=t.getMainWorkspace());var n=[];this.init(e),e=e.getTopBlocks(!0);for(var r,i=0;r=e[i];i++){var o=this.blockToCode(r);Array.isArray(o)&&(o=o[0]),o&&(r.outputConnection&&(o=this.scrubNakedValue(o),this.STATEMENT_PREFIX&&!r.suppressPrefixSuffix&&(o=this.injectId(this.STATEMENT_PREFIX,r)+o),this.STATEMENT_SUFFIX&&!r.suppressPrefixSuffix&&(o+=this.injectId(this.STATEMENT_SUFFIX,r))),n.push(o))}return n=n.join("\n"),(n=(n=(n=this.finish(n)).replace(/^\s+\n/,"")).replace(/\n\s+$/,"\n")).replace(/[ \t]+\n/g,"\n")},t.Generator.prototype.prefixLines=function(t,e){return e+t.replace(/(?!\n$)\n/g,"\n"+e)},t.Generator.prototype.allNestedComments=function(t){var e=[];t=t.getDescendants(!0);for(var n=0;n>>/sprites.png);","height: 16px;","vertical-align: middle;","visibility: hidden;","width: 16px;","}",".blocklyTreeIconClosed {","background-position: -32px -1px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeIconClosed {',"background-position: 0 -1px;","}",".blocklyTreeSelected>.blocklyTreeIconClosed {","background-position: -32px -17px;","}",'.blocklyToolboxDiv[dir="RTL"] .blocklyTreeSelected>.blocklyTreeIconClosed {',"background-position: 0 -17px;","}",".blocklyTreeIconOpen {","background-position: -16px -1px;","}",".blocklyTreeSelected>.blocklyTreeIconOpen {","background-position: -16px -17px;","}",".blocklyTreeLabel {","cursor: default;","font: 16px sans-serif;","padding: 0 3px;","vertical-align: middle;","}",".blocklyToolboxDelete .blocklyTreeLabel {",'cursor: url("<<>>/handdelete.cur"), auto;',"}",".blocklyTreeSelected .blocklyTreeLabel {","color: #fff;","}"]),t.registry.register(t.registry.Type.TOOLBOX_ITEM,t.ToolboxCategory.registrationName,t.ToolboxCategory),t.ToolboxSeparator=function(e,n){t.ToolboxSeparator.superClass_.constructor.call(this,e,n),this.cssConfig_={container:"blocklyTreeSeparator"},t.utils.object.mixin(this.cssConfig_,e.cssconfig||e.cssConfig)},t.utils.object.inherits(t.ToolboxSeparator,t.ToolboxItem),t.ToolboxSeparator.registrationName="sep",t.ToolboxSeparator.prototype.init=function(){this.createDom_()},t.ToolboxSeparator.prototype.createDom_=function(){var e=document.createElement("div");return t.utils.dom.addClass(e,this.cssConfig_.container),this.htmlDiv_=e},t.ToolboxSeparator.prototype.getDiv=function(){return this.htmlDiv_},t.ToolboxSeparator.prototype.dispose=function(){t.utils.dom.removeNode(this.htmlDiv_)},t.Css.register('.blocklyTreeSeparator {,border-bottom: solid #e5e5e5 1px;,height: 0;,margin: 5px 0;,},.blocklyToolboxDiv[layout="h"] .blocklyTreeSeparator {,border-right: solid #e5e5e5 1px;,border-bottom: none;,height: auto;,margin: 0 5px 0 5px;,padding: 5px 0;,width: 0;,}'.split(",")),t.registry.register(t.registry.Type.TOOLBOX_ITEM,t.ToolboxSeparator.registrationName,t.ToolboxSeparator),t.CollapsibleToolboxCategory=function(e,n,r){this.subcategoriesDiv_=null,this.expanded_=!1,this.toolboxItems_=[],t.CollapsibleToolboxCategory.superClass_.constructor.call(this,e,n,r)},t.utils.object.inherits(t.CollapsibleToolboxCategory,t.ToolboxCategory),t.CollapsibleToolboxCategory.registrationName="collapsibleCategory",t.CollapsibleToolboxCategory.prototype.makeDefaultCssConfig_=function(){var e=t.CollapsibleToolboxCategory.superClass_.makeDefaultCssConfig_.call(this);return e.contents="blocklyToolboxContents",e},t.CollapsibleToolboxCategory.prototype.parseContents_=function(e){var n=e.contents,r=!0;if(e.custom)this.flyoutItems_=e.custom;else if(n){e=0;for(var i;i=n[e];e++)!t.registry.hasItem(t.registry.Type.TOOLBOX_ITEM,i.kind)||i.kind.toLowerCase()==t.ToolboxSeparator.registrationName&&r?(this.flyoutItems_.push(i),r=!0):(this.createToolboxItem_(i),r=!1)}},t.CollapsibleToolboxCategory.prototype.createToolboxItem_=function(e){var n=e.kind;"CATEGORY"==n.toUpperCase()&&t.utils.toolbox.isCategoryCollapsible(e)&&(n=t.CollapsibleToolboxCategory.registrationName),e=new(t.registry.getClass(t.registry.Type.TOOLBOX_ITEM,n))(e,this.parentToolbox_,this),this.toolboxItems_.push(e)},t.CollapsibleToolboxCategory.prototype.init=function(){t.CollapsibleToolboxCategory.superClass_.init.call(this),this.setExpanded("true"==this.toolboxItemDef_.expanded||this.toolboxItemDef_.expanded)},t.CollapsibleToolboxCategory.prototype.createDom_=function(){t.CollapsibleToolboxCategory.superClass_.createDom_.call(this);var e=this.getChildToolboxItems();return this.subcategoriesDiv_=this.createSubCategoriesDom_(e),t.utils.aria.setRole(this.subcategoriesDiv_,t.utils.aria.Role.GROUP),this.htmlDiv_.appendChild(this.subcategoriesDiv_),this.htmlDiv_},t.CollapsibleToolboxCategory.prototype.createIconDom_=function(){var e=document.createElement("span");return this.parentToolbox_.isHorizontal()||(t.utils.dom.addClass(e,this.cssConfig_.icon),e.style.visibility="visible"),e.style.display="inline-block",e},t.CollapsibleToolboxCategory.prototype.createSubCategoriesDom_=function(e){var n=document.createElement("div");t.utils.dom.addClass(n,this.cssConfig_.contents);for(var r=0;r>>/handdelete.cur"), auto;',"}",".blocklyToolboxGrab {",'cursor: url("<<>>/handclosed.cur"), auto;',"cursor: grabbing;","cursor: -webkit-grabbing;","}",".blocklyToolboxDiv {","background-color: #ddd;","overflow-x: visible;","overflow-y: auto;","padding: 4px 0 4px 0;","position: absolute;","z-index: 70;","-webkit-tap-highlight-color: transparent;","}",".blocklyToolboxContents {","display: flex;","flex-wrap: wrap;","flex-direction: column;","}",".blocklyToolboxContents:focus {","outline: none;","}"]),t.registry.register(t.registry.Type.TOOLBOX,t.registry.DEFAULT,t.Toolbox),t.Events.TrashcanOpen=function(e,n){t.Events.TrashcanOpen.superClass_.constructor.call(this,n),this.isOpen=e},t.utils.object.inherits(t.Events.TrashcanOpen,t.Events.UiBase),t.Events.TrashcanOpen.prototype.type=t.Events.TRASHCAN_OPEN,t.Events.TrashcanOpen.prototype.toJson=function(){var e=t.Events.TrashcanOpen.superClass_.toJson.call(this);return e.isOpen=this.isOpen,e},t.Events.TrashcanOpen.prototype.fromJson=function(e){t.Events.TrashcanOpen.superClass_.fromJson.call(this,e),this.isOpen=e.isOpen},t.registry.register(t.registry.Type.EVENT,t.Events.TRASHCAN_OPEN,t.Events.TrashcanOpen),t.IPositionable=function(){},t.uiPosition={},t.uiPosition.verticalPosition={TOP:0,BOTTOM:1},t.uiPosition.horizontalPosition={LEFT:0,RIGHT:1},t.uiPosition.bumpDirection={UP:0,DOWN:1},t.uiPosition.getStartPositionRect=function(e,n,r,i,o,s){var a=s.scrollbar&&s.scrollbar.canScrollVertically();return e.horizontal===t.uiPosition.horizontalPosition.LEFT?(r=o.absoluteMetrics.left+r,a&&s.RTL&&(r+=t.Scrollbar.scrollbarThickness)):(r=o.absoluteMetrics.left+o.viewMetrics.width-n.width-r,a&&!s.RTL&&(r-=t.Scrollbar.scrollbarThickness)),e.vertical===t.uiPosition.verticalPosition.TOP?e=o.absoluteMetrics.top+i:(e=o.absoluteMetrics.top+o.viewMetrics.height-n.height-i,s.scrollbar&&s.scrollbar.canScrollHorizontally()&&(e-=t.Scrollbar.scrollbarThickness)),new t.utils.Rect(e,e+n.height,r,r+n.width)},t.uiPosition.getCornerOppositeToolbox=function(e,n){return{horizontal:n.toolboxMetrics.position===t.utils.toolbox.Position.LEFT||e.horizontalLayout&&!e.RTL?t.uiPosition.horizontalPosition.RIGHT:t.uiPosition.horizontalPosition.LEFT,vertical:n.toolboxMetrics.position===t.utils.toolbox.Position.BOTTOM?t.uiPosition.verticalPosition.TOP:t.uiPosition.verticalPosition.BOTTOM}},t.uiPosition.bumpPositionRect=function(e,n,r,i){for(var o,s=e.left,a=e.right-e.left,l=e.bottom-e.top,u=0;o=i[u];u++)e.intersects(o)&&(e=r===t.uiPosition.bumpDirection.UP?o.top-l-n:o.bottom+n,e=new t.utils.Rect(e,e+l,s,s+a),u=-1);return e},t.Trashcan=function(e){t.Trashcan.superClass_.constructor.call(this),this.workspace_=e,this.id="trashcan",this.contents_=[],this.flyout=null,0>=this.workspace_.options.maxTrashcanContents||(e=new t.Options({scrollbars:!0,parentWorkspace:this.workspace_,rtl:this.workspace_.RTL,oneBasedIndex:this.workspace_.options.oneBasedIndex,renderer:this.workspace_.options.renderer,rendererOverrides:this.workspace_.options.rendererOverrides,move:{scrollbars:!0}}),this.workspace_.horizontalLayout?(e.toolboxPosition=this.workspace_.toolboxPosition==t.utils.toolbox.Position.TOP?t.utils.toolbox.Position.BOTTOM:t.utils.toolbox.Position.TOP,this.flyout=new(t.registry.getClassFromOptions(t.registry.Type.FLYOUTS_HORIZONTAL_TOOLBOX,this.workspace_.options,!0))(e)):(e.toolboxPosition=this.workspace_.toolboxPosition==t.utils.toolbox.Position.RIGHT?t.utils.toolbox.Position.LEFT:t.utils.toolbox.Position.RIGHT,this.flyout=new(t.registry.getClassFromOptions(t.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,this.workspace_.options,!0))(e)),this.workspace_.addChangeListener(this.onDelete_.bind(this)))},t.utils.object.inherits(t.Trashcan,t.DeleteArea),t.Trashcan.prototype.WIDTH_=47,t.Trashcan.prototype.BODY_HEIGHT_=44,t.Trashcan.prototype.LID_HEIGHT_=16,t.Trashcan.prototype.MARGIN_VERTICAL_=20,t.Trashcan.prototype.MARGIN_HORIZONTAL_=20,t.Trashcan.prototype.MARGIN_HOTSPOT_=10,t.Trashcan.prototype.SPRITE_LEFT_=0,t.Trashcan.prototype.SPRITE_TOP_=32,t.Trashcan.prototype.HAS_BLOCKS_LID_ANGLE_=.1,t.Trashcan.ANIMATION_LENGTH_=80,t.Trashcan.ANIMATION_FRAMES_=4,t.Trashcan.OPACITY_MIN_=.4,t.Trashcan.OPACITY_MAX_=.8,t.Trashcan.MAX_LID_ANGLE_=45,t.Trashcan.prototype.isLidOpen=!1,t.Trashcan.prototype.minOpenness_=0,t.Trashcan.prototype.svgGroup_=null,t.Trashcan.prototype.svgLid_=null,t.Trashcan.prototype.lidTask_=0,t.Trashcan.prototype.lidOpen_=0,t.Trashcan.prototype.left_=0,t.Trashcan.prototype.top_=0,t.Trashcan.prototype.initialized_=!1,t.Trashcan.prototype.createDom=function(){this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyTrash"},null);var e=String(Math.random()).substring(2),n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyTrashBodyClipPath"+e},this.svgGroup_);t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:this.WIDTH_,height:this.BODY_HEIGHT_,y:this.LID_HEIGHT_},n);var r=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,x:-this.SPRITE_LEFT_,height:t.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashBodyClipPath"+e+")"},this.svgGroup_);return r.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyTrashLidClipPath"+e},this.svgGroup_),t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:this.WIDTH_,height:this.LID_HEIGHT_},n),this.svgLid_=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,x:-this.SPRITE_LEFT_,height:t.SPRITE.height,y:-this.SPRITE_TOP_,"clip-path":"url(#blocklyTrashLidClipPath"+e+")"},this.svgGroup_),this.svgLid_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),t.browserEvents.bind(this.svgGroup_,"mousedown",this,this.blockMouseDownWhenOpenable_),t.browserEvents.bind(this.svgGroup_,"mouseup",this,this.click),t.browserEvents.bind(r,"mouseover",this,this.mouseOver_),t.browserEvents.bind(r,"mouseout",this,this.mouseOut_),this.animateLid_(),this.svgGroup_},t.Trashcan.prototype.init=function(){0this.minOpenness_&&1>this.lidOpen_&&(this.lidTask_=setTimeout(this.animateLid_.bind(this),t.Trashcan.ANIMATION_LENGTH_/e))},t.Trashcan.prototype.setLidAngle_=function(e){var n=this.workspace_.toolboxPosition==t.utils.toolbox.Position.RIGHT||this.workspace_.horizontalLayout&&this.workspace_.RTL;this.svgLid_.setAttribute("transform","rotate("+(n?-e:e)+","+(n?4:this.WIDTH_-4)+","+(this.LID_HEIGHT_-2)+")")},t.Trashcan.prototype.setMinOpenness_=function(e){this.minOpenness_=e,this.isLidOpen||this.setLidAngle_(e*t.Trashcan.MAX_LID_ANGLE_)},t.Trashcan.prototype.closeLid=function(){this.setLidOpen(!1)},t.Trashcan.prototype.click=function(){this.hasContents_()&&this.openFlyout()},t.Trashcan.prototype.fireUiEvent_=function(e){e=new(t.Events.get(t.Events.TRASHCAN_OPEN))(e,this.workspace_.id),t.Events.fire(e)},t.Trashcan.prototype.blockMouseDownWhenOpenable_=function(t){!this.contentsIsOpen()&&this.hasContents_()&&t.stopPropagation()},t.Trashcan.prototype.mouseOver_=function(){this.hasContents_()&&this.setLidOpen(!0)},t.Trashcan.prototype.mouseOut_=function(){this.setLidOpen(!1)},t.Trashcan.prototype.onDelete_=function(e){if(!(0>=this.workspace_.options.maxTrashcanContents)&&e.type==t.Events.BLOCK_DELETE&&e.oldXml.tagName&&"shadow"!=e.oldXml.tagName.toLowerCase()&&(e=this.cleanBlockXML_(e.oldXml),-1==this.contents_.indexOf(e))){for(this.contents_.unshift(e);this.contents_.length>this.workspace_.options.maxTrashcanContents;)this.contents_.pop();this.setMinOpenness_(this.HAS_BLOCKS_LID_ANGLE_)}},t.Trashcan.prototype.cleanBlockXML_=function(e){for(var n=e=e.cloneNode(!0);n;){n.removeAttribute&&(n.removeAttribute("x"),n.removeAttribute("y"),n.removeAttribute("id"),n.removeAttribute("disabled"),"comment"==n.nodeName&&(n.removeAttribute("h"),n.removeAttribute("w"),n.removeAttribute("pinned")));var r=n.firstChild||n.nextSibling;if(!r)for(r=n.parentNode;r;){if(r.nextSibling){r=r.nextSibling;break}r=r.parentNode}n=r}return t.Xml.domToText(e)},t.VariablesDynamic={},t.VariablesDynamic.onCreateVariableButtonClick_String=function(e){t.Variables.createVariableButtonHandler(e.getTargetWorkspace(),void 0,"String")},t.VariablesDynamic.onCreateVariableButtonClick_Number=function(e){t.Variables.createVariableButtonHandler(e.getTargetWorkspace(),void 0,"Number")},t.VariablesDynamic.onCreateVariableButtonClick_Colour=function(e){t.Variables.createVariableButtonHandler(e.getTargetWorkspace(),void 0,"Colour")},t.VariablesDynamic.flyoutCategory=function(e){var n=[],r=document.createElement("button");return r.setAttribute("text",t.Msg.NEW_STRING_VARIABLE),r.setAttribute("callbackKey","CREATE_VARIABLE_STRING"),n.push(r),(r=document.createElement("button")).setAttribute("text",t.Msg.NEW_NUMBER_VARIABLE),r.setAttribute("callbackKey","CREATE_VARIABLE_NUMBER"),n.push(r),(r=document.createElement("button")).setAttribute("text",t.Msg.NEW_COLOUR_VARIABLE),r.setAttribute("callbackKey","CREATE_VARIABLE_COLOUR"),n.push(r),e.registerButtonCallback("CREATE_VARIABLE_STRING",t.VariablesDynamic.onCreateVariableButtonClick_String),e.registerButtonCallback("CREATE_VARIABLE_NUMBER",t.VariablesDynamic.onCreateVariableButtonClick_Number),e.registerButtonCallback("CREATE_VARIABLE_COLOUR",t.VariablesDynamic.onCreateVariableButtonClick_Colour),e=t.VariablesDynamic.flyoutCategoryBlocks(e),n.concat(e)},t.VariablesDynamic.flyoutCategoryBlocks=function(e){var n=[];if(0<(e=e.getAllVariables()).length){if(t.Blocks.variables_set_dynamic){var r=e[e.length-1],i=t.utils.xml.createElement("block");i.setAttribute("type","variables_set_dynamic"),i.setAttribute("gap",24),i.appendChild(t.Variables.generateVariableFieldDom(r)),n.push(i)}if(t.Blocks.variables_get_dynamic){e.sort(t.VariableModel.compareByName),r=0;for(var o;o=e[r];r++)(i=t.utils.xml.createElement("block")).setAttribute("type","variables_get_dynamic"),i.setAttribute("gap",8),i.appendChild(t.Variables.generateVariableFieldDom(o)),n.push(i)}}return n},t.ZoomControls=function(t){this.workspace_=t,this.id="zoomControls",this.zoomResetGroup_=this.zoomOutGroup_=this.zoomInGroup_=this.onZoomOutWrapper_=this.onZoomInWrapper_=this.onZoomResetWrapper_=null},t.ZoomControls.prototype.WIDTH_=32,t.ZoomControls.prototype.HEIGHT_=32,t.ZoomControls.prototype.SMALL_SPACING_=2,t.ZoomControls.prototype.LARGE_SPACING_=11,t.ZoomControls.prototype.MARGIN_VERTICAL_=20,t.ZoomControls.prototype.MARGIN_HORIZONTAL_=20,t.ZoomControls.prototype.svgGroup_=null,t.ZoomControls.prototype.left_=0,t.ZoomControls.prototype.top_=0,t.ZoomControls.prototype.initialized_=!1,t.ZoomControls.prototype.createDom=function(){this.svgGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{},null);var e=String(Math.random()).substring(2);return this.createZoomOutSvg_(e),this.createZoomInSvg_(e),this.workspace_.isMovable()&&this.createZoomResetSvg_(e),this.svgGroup_},t.ZoomControls.prototype.init=function(){this.workspace_.getComponentManager().addComponent({component:this,weight:2,capabilities:[t.ComponentManager.Capability.POSITIONABLE]}),this.initialized_=!0},t.ZoomControls.prototype.dispose=function(){this.workspace_.getComponentManager().removeComponent("zoomControls"),this.svgGroup_&&t.utils.dom.removeNode(this.svgGroup_),this.onZoomResetWrapper_&&t.browserEvents.unbind(this.onZoomResetWrapper_),this.onZoomInWrapper_&&t.browserEvents.unbind(this.onZoomInWrapper_),this.onZoomOutWrapper_&&t.browserEvents.unbind(this.onZoomOutWrapper_)},t.ZoomControls.prototype.getBoundingRectangle=function(){var e=this.SMALL_SPACING_+2*this.HEIGHT_;return this.zoomResetGroup_&&(e+=this.LARGE_SPACING_+this.HEIGHT_),new t.utils.Rect(this.top_,this.top_+e,this.left_,this.left_+this.WIDTH_)},t.ZoomControls.prototype.position=function(e,n){if(this.initialized_){var r=t.uiPosition.getCornerOppositeToolbox(this.workspace_,e),i=this.SMALL_SPACING_+2*this.HEIGHT_;this.zoomResetGroup_&&(i+=this.LARGE_SPACING_+this.HEIGHT_),e=t.uiPosition.getStartPositionRect(r,new t.utils.Size(this.WIDTH_,i),this.MARGIN_HORIZONTAL_,this.MARGIN_VERTICAL_,e,this.workspace_),r=r.vertical,n=t.uiPosition.bumpPositionRect(e,this.MARGIN_VERTICAL_,r===t.uiPosition.verticalPosition.TOP?t.uiPosition.bumpDirection.DOWN:t.uiPosition.bumpDirection.UP,n),r===t.uiPosition.verticalPosition.TOP?(r=this.SMALL_SPACING_+this.HEIGHT_,this.zoomInGroup_.setAttribute("transform","translate(0, "+r+")"),this.zoomResetGroup_&&this.zoomResetGroup_.setAttribute("transform","translate(0, "+(r+this.LARGE_SPACING_+this.HEIGHT_)+")")):(r=this.zoomResetGroup_?this.LARGE_SPACING_+this.HEIGHT_:0,this.zoomInGroup_.setAttribute("transform","translate(0, "+r+")"),this.zoomOutGroup_.setAttribute("transform","translate(0, "+(r+this.SMALL_SPACING_+this.HEIGHT_)+")")),this.top_=n.top,this.left_=n.left,this.svgGroup_.setAttribute("transform","translate("+this.left_+","+this.top_+")")}},t.ZoomControls.prototype.createZoomOutSvg_=function(e){this.zoomOutGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyZoom"},this.svgGroup_);var n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyZoomoutClipPath"+e},this.zoomOutGroup_);t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:32,height:32},n),t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,height:t.SPRITE.height,x:-64,y:-92,"clip-path":"url(#blocklyZoomoutClipPath"+e+")"},this.zoomOutGroup_).setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),this.onZoomOutWrapper_=t.browserEvents.conditionalBind(this.zoomOutGroup_,"mousedown",null,this.zoom_.bind(this,-1))},t.ZoomControls.prototype.createZoomInSvg_=function(e){this.zoomInGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyZoom"},this.svgGroup_);var n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyZoominClipPath"+e},this.zoomInGroup_);t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:32,height:32},n),t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,height:t.SPRITE.height,x:-32,y:-92,"clip-path":"url(#blocklyZoominClipPath"+e+")"},this.zoomInGroup_).setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),this.onZoomInWrapper_=t.browserEvents.conditionalBind(this.zoomInGroup_,"mousedown",null,this.zoom_.bind(this,1))},t.ZoomControls.prototype.zoom_=function(e,n){this.workspace_.markFocused(),this.workspace_.zoomCenter(e),this.fireZoomEvent_(),t.Touch.clearTouchIdentifier(),n.stopPropagation(),n.preventDefault()},t.ZoomControls.prototype.createZoomResetSvg_=function(e){this.zoomResetGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyZoom"},this.svgGroup_);var n=t.utils.dom.createSvgElement(t.utils.Svg.CLIPPATH,{id:"blocklyZoomresetClipPath"+e},this.zoomResetGroup_);t.utils.dom.createSvgElement(t.utils.Svg.RECT,{width:32,height:32},n),t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{width:t.SPRITE.width,height:t.SPRITE.height,y:-92,"clip-path":"url(#blocklyZoomresetClipPath"+e+")"},this.zoomResetGroup_).setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.workspace_.options.pathToMedia+t.SPRITE.url),this.onZoomResetWrapper_=t.browserEvents.conditionalBind(this.zoomResetGroup_,"mousedown",null,this.resetZoom_.bind(this))},t.ZoomControls.prototype.resetZoom_=function(e){this.workspace_.markFocused();var n=Math.log(this.workspace_.options.zoomOptions.startScale/this.workspace_.scale)/Math.log(this.workspace_.options.zoomOptions.scaleSpeed);this.workspace_.beginCanvasTransition(),this.workspace_.zoomCenter(n),this.workspace_.scrollCenter(),setTimeout(this.workspace_.endCanvasTransition.bind(this.workspace_),500),this.fireZoomEvent_(),t.Touch.clearTouchIdentifier(),e.stopPropagation(),e.preventDefault()},t.ZoomControls.prototype.fireZoomEvent_=function(){var e=new(t.Events.get(t.Events.CLICK))(null,this.workspace_.id,"zoom_controls");t.Events.fire(e)},t.Css.register([".blocklyZoom>image, .blocklyZoom>svg>image {","opacity: .4;","}",".blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {","opacity: .6;","}",".blocklyZoom>image:active, .blocklyZoom>svg>image:active {","opacity: .8;","}"]),t.ShortcutItems={},t.ShortcutItems.names={ESCAPE:"escape",DELETE:"delete",COPY:"copy",CUT:"cut",PASTE:"paste",UNDO:"undo",REDO:"redo"},t.ShortcutItems.registerEscape=function(){var e={name:t.ShortcutItems.names.ESCAPE,preconditionFn:function(t){return!t.options.readOnly},callback:function(){return t.hideChaff(),!0}};t.ShortcutRegistry.registry.register(e),t.ShortcutRegistry.registry.addKeyMapping(t.utils.KeyCodes.ESC,e.name)},t.ShortcutItems.registerDelete=function(){var e={name:t.ShortcutItems.names.DELETE,preconditionFn:function(e){return!e.options.readOnly&&t.selected&&t.selected.isDeletable()},callback:function(e,n){return n.preventDefault(),!t.Gesture.inProgress()&&(t.deleteBlock(t.selected),!0)}};t.ShortcutRegistry.registry.register(e),t.ShortcutRegistry.registry.addKeyMapping(t.utils.KeyCodes.DELETE,e.name),t.ShortcutRegistry.registry.addKeyMapping(t.utils.KeyCodes.BACKSPACE,e.name)},t.ShortcutItems.registerCopy=function(){var e={name:t.ShortcutItems.names.COPY,preconditionFn:function(e){return!e.options.readOnly&&!t.Gesture.inProgress()&&t.selected&&t.selected.isDeletable()&&t.selected.isMovable()},callback:function(e,n){return n.preventDefault(),t.hideChaff(),t.copy(t.selected),!0}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.C,[t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.C,[t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.C,[t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerCut=function(){var e={name:t.ShortcutItems.names.CUT,preconditionFn:function(e){return!e.options.readOnly&&!t.Gesture.inProgress()&&t.selected&&t.selected.isDeletable()&&t.selected.isMovable()&&!t.selected.workspace.isFlyout},callback:function(){return t.copy(t.selected),t.deleteBlock(t.selected),!0}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.X,[t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.X,[t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.X,[t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerPaste=function(){var e={name:t.ShortcutItems.names.PASTE,preconditionFn:function(e){return!e.options.readOnly&&!t.Gesture.inProgress()},callback:function(){return t.paste()}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.V,[t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.V,[t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.V,[t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerUndo=function(){var e={name:t.ShortcutItems.names.UNDO,preconditionFn:function(e){return!e.options.readOnly&&!t.Gesture.inProgress()},callback:function(e){return t.hideChaff(),e.undo(!1),!0}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerRedo=function(){var e={name:t.ShortcutItems.names.REDO,preconditionFn:function(e){return!t.Gesture.inProgress()&&!e.options.readOnly},callback:function(e){return t.hideChaff(),e.undo(!0),!0}};t.ShortcutRegistry.registry.register(e);var n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.SHIFT,t.utils.KeyCodes.CTRL]);t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.SHIFT,t.utils.KeyCodes.ALT]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Z,[t.utils.KeyCodes.SHIFT,t.utils.KeyCodes.META]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name),n=t.ShortcutRegistry.registry.createSerializedKey(t.utils.KeyCodes.Y,[t.utils.KeyCodes.CTRL]),t.ShortcutRegistry.registry.addKeyMapping(n,e.name)},t.ShortcutItems.registerDefaultShortcuts=function(){t.ShortcutItems.registerEscape(),t.ShortcutItems.registerDelete(),t.ShortcutItems.registerCopy(),t.ShortcutItems.registerCut(),t.ShortcutItems.registerPaste(),t.ShortcutItems.registerUndo(),t.ShortcutItems.registerRedo()},t.ShortcutItems.registerDefaultShortcuts(),t.ContextMenuItems={},t.ContextMenuItems.registerUndo=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.UNDO},preconditionFn:function(t){return 0n.length?t.ContextMenuItems.deleteNext_(n,r):t.confirm(t.Msg.DELETE_ALL_BLOCKS.replace("%1",n.length),function(e){e&&t.ContextMenuItems.deleteNext_(n,r)})}},scopeType:t.ContextMenuRegistry.ScopeType.WORKSPACE,id:"workspaceDelete",weight:6})},t.ContextMenuItems.registerWorkspaceOptions_=function(){t.ContextMenuItems.registerUndo(),t.ContextMenuItems.registerRedo(),t.ContextMenuItems.registerCleanup(),t.ContextMenuItems.registerCollapse(),t.ContextMenuItems.registerExpand(),t.ContextMenuItems.registerDeleteAll()},t.ContextMenuItems.registerDuplicate=function(){t.ContextMenuRegistry.registry.register({displayText:function(){return t.Msg.DUPLICATE_BLOCK},preconditionFn:function(t){return!(t=t.block).isInFlyout&&t.isDeletable()&&t.isMovable()?t.isDuplicatable()?"enabled":"disabled":"hidden"},callback:function(e){e.block&&t.duplicate(e.block)},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockDuplicate",weight:1})},t.ContextMenuItems.registerComment=function(){t.ContextMenuRegistry.registry.register({displayText:function(e){return e.block.getCommentIcon()?t.Msg.REMOVE_COMMENT:t.Msg.ADD_COMMENT},preconditionFn:function(e){return e=e.block,t.utils.userAgent.IE||e.isInFlyout||!e.workspace.options.comments||e.isCollapsed()||!e.isEditable()?"hidden":"enabled"},callback:function(t){(t=t.block).getCommentIcon()?t.setCommentText(null):t.setCommentText("")},scopeType:t.ContextMenuRegistry.ScopeType.BLOCK,id:"blockComment",weight:2})},t.ContextMenuItems.registerInline=function(){t.ContextMenuRegistry.registry.register({displayText:function(e){return e.block.getInputsInline()?t.Msg.EXTERNAL_INPUTS:t.Msg.INLINE_INPUTS},preconditionFn:function(e){if(!(e=e.block).isInFlyout&&e.isMovable()&&!e.isCollapsed())for(var n=1;ne||Math.abs(this.workspaceHeight_-i)>e)&&(this.workspaceWidth_=r,this.workspaceHeight_=i,this.bubble_.setBubbleSize(r+e,i+e),this.svgDialog_.setAttribute("width",this.workspaceWidth_),this.svgDialog_.setAttribute("height",this.workspaceHeight_),this.workspace_.setCachedParentSvgSize(this.workspaceWidth_,this.workspaceHeight_)),this.block_.RTL&&(e="translate("+this.workspaceWidth_+",0)",this.workspace_.getCanvas().setAttribute("transform",e)),this.workspace_.resize()},t.Mutator.prototype.onBubbleMove_=function(){this.workspace_&&this.workspace_.recordDragTargets()},t.Mutator.prototype.setVisible=function(e){if(e!=this.isVisible())if(t.Events.fire(new(t.Events.get(t.Events.BUBBLE_OPEN))(this.block_,e,"mutator")),e){this.bubble_=new t.Bubble(this.block_.workspace,this.createEditor_(),this.block_.pathObject.svgPath,this.iconXY_,null,null),this.bubble_.setSvgId(this.block_.id),this.bubble_.registerMoveEvent(this.onBubbleMove_.bind(this));var n=this.workspace_.options.languageTree;e=this.workspace_.getFlyout(),n&&(e.init(this.workspace_),e.show(n)),this.rootBlock_=this.block_.decompose(this.workspace_),n=this.rootBlock_.getDescendants(!1);for(var r,i=0;r=n[i];i++)r.render();if(this.rootBlock_.setMovable(!1),this.rootBlock_.setDeletable(!1),e?(n=2*e.CORNER_RADIUS,e=this.rootBlock_.RTL?e.getWidth()+n:n):e=n=16,this.block_.RTL&&(e=-e),this.rootBlock_.moveBy(e,n),this.block_.saveConnections){var o=this,s=this.block_;s.saveConnections(this.rootBlock_),this.sourceListener_=function(){s.saveConnections(o.rootBlock_)},this.block_.workspace.addChangeListener(this.sourceListener_)}this.resizeBubble_(),this.workspace_.addChangeListener(this.workspaceChanged_.bind(this)),this.applyColour()}else this.svgDialog_=null,this.workspace_.dispose(),this.rootBlock_=this.workspace_=null,this.bubble_.dispose(),this.bubble_=null,this.workspaceHeight_=this.workspaceWidth_=0,this.sourceListener_&&(this.block_.workspace.removeChangeListener(this.sourceListener_),this.sourceListener_=null)},t.Mutator.prototype.workspaceChanged_=function(e){if(!(e.isUiEvent||e.type==t.Events.CHANGE&&"disabled"==e.element)){if(!this.workspace_.isDragging()){e=this.workspace_.getTopBlocks(!1);for(var n,r=0;n=e[r];r++){var i=n.getRelativeToSurfaceXY();if(20>i.y&&n.moveBy(0,20-i.y),n.RTL){var o=-20,s=this.workspace_.getFlyout();s&&(o-=s.getWidth()),i.x>o&&n.moveBy(o-i.x,0)}else 20>i.x&&n.moveBy(20-i.x,0)}}if(this.rootBlock_.workspace==this.workspace_){if(t.Events.setGroup(!0),e=(e=(n=this.block_).mutationToDom())&&t.Xml.domToText(e),r=n.rendered,n.rendered=!1,n.compose(this.rootBlock_),n.rendered=r,n.initSvg(),n.rendered&&n.render(),e!=(r=(r=n.mutationToDom())&&t.Xml.domToText(r))){t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(n,"mutation",null,e,r));var a=t.Events.getGroup();setTimeout(function(){t.Events.setGroup(a),n.bumpNeighbours(),t.Events.setGroup(!1)},t.BUMP_DELAY)}this.workspace_.isDragging()||this.resizeBubble_(),t.Events.setGroup(!1)}}},t.Mutator.prototype.dispose=function(){this.block_.mutator=null,t.Icon.prototype.dispose.call(this)},t.Mutator.prototype.updateBlockStyle=function(){var t=this.workspace_;if(t&&t.getAllBlocks(!1)){for(var e,n=t.getAllBlocks(!1),r=0;e=n[r];r++)e.setStyle(e.getStyleName());if(r=t.getFlyout())for(t=r.workspace_.getAllBlocks(!1),r=0;e=t[r];r++)e.setStyle(e.getStyleName())}},t.Mutator.reconnect=function(t,e,n){if(!t||!t.getSourceBlock().workspace)return!1;n=e.getInput(n).connection;var r=t.targetBlock();return!(r&&r!=e||n.targetConnection==t)&&(n.isConnected()&&n.disconnect(),n.connect(t),!0)},t.Mutator.findParentWs=function(t){var e=null;if(t&&t.options){var n=t.options.parentWorkspace;t.isFlyout?n&&n.options&&(e=n.options.parentWorkspace):n&&(e=n)}return e},t.FieldTextInput=function(e,n,r){this.spellcheck_=!0,t.FieldTextInput.superClass_.constructor.call(this,e,n,r),this.onKeyInputWrapper_=this.onKeyDownWrapper_=this.htmlInput_=null,this.fullBlockClickTarget_=!1,this.workspace_=null},t.utils.object.inherits(t.FieldTextInput,t.Field),t.FieldTextInput.prototype.DEFAULT_VALUE="",t.FieldTextInput.fromJson=function(e){var n=t.utils.replaceMessageReferences(e.text);return new t.FieldTextInput(n,void 0,e)},t.FieldTextInput.prototype.SERIALIZABLE=!0,t.FieldTextInput.BORDERRADIUS=4,t.FieldTextInput.prototype.CURSOR="text",t.FieldTextInput.prototype.configure_=function(e){t.FieldTextInput.superClass_.configure_.call(this,e),"boolean"==typeof e.spellcheck&&(this.spellcheck_=e.spellcheck)},t.FieldTextInput.prototype.initView=function(){if(this.getConstants().FULL_BLOCK_FIELDS){for(var t,e=0,n=0,r=0;t=this.sourceBlock_.inputList[r];r++){for(var i=0;t.fieldRow[i];i++)e++;t.connection&&n++}this.fullBlockClickTarget_=1>=e&&this.sourceBlock_.outputConnection&&!n}else this.fullBlockClickTarget_=!1;this.fullBlockClickTarget_?this.clickTarget_=this.sourceBlock_.getSvgRoot():this.createBorderRect_(),this.createTextElement_()},t.FieldTextInput.prototype.doClassValidation_=function(t){return null===t||void 0===t?null:String(t)},t.FieldTextInput.prototype.doValueInvalid_=function(e){this.isBeingEdited_&&(this.isTextValid_=!1,e=this.value_,this.value_=this.htmlInput_.untypedDefaultValue_,this.sourceBlock_&&t.Events.isEnabled()&&t.Events.fire(new(t.Events.get(t.Events.BLOCK_CHANGE))(this.sourceBlock_,"field",this.name||null,e,this.value_)))},t.FieldTextInput.prototype.doValueUpdate_=function(t){this.isTextValid_=!0,this.value_=t,this.isBeingEdited_||(this.isDirty_=!0)},t.FieldTextInput.prototype.applyColour=function(){this.sourceBlock_&&this.getConstants().FULL_BLOCK_FIELDS&&(this.borderRect_?this.borderRect_.setAttribute("stroke",this.sourceBlock_.style.colourTertiary):this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getConstants().FIELD_BORDER_RECT_COLOUR))},t.FieldTextInput.prototype.render_=function(){if(t.FieldTextInput.superClass_.render_.call(this),this.isBeingEdited_){this.resizeEditor_();var e=this.htmlInput_;this.isTextValid_?(t.utils.dom.removeClass(e,"blocklyInvalidInput"),t.utils.aria.setState(e,t.utils.aria.State.INVALID,!1)):(t.utils.dom.addClass(e,"blocklyInvalidInput"),t.utils.aria.setState(e,t.utils.aria.State.INVALID,!0))}},t.FieldTextInput.prototype.setSpellcheck=function(t){t!=this.spellcheck_&&(this.spellcheck_=t,this.htmlInput_&&this.htmlInput_.setAttribute("spellcheck",this.spellcheck_))},t.FieldTextInput.prototype.showEditor_=function(e,n){this.workspace_=this.sourceBlock_.workspace,!(e=n||!1)&&(t.utils.userAgent.MOBILE||t.utils.userAgent.ANDROID||t.utils.userAgent.IPAD)?this.showPromptEditor_():this.showInlineEditor_(e)},t.FieldTextInput.prototype.showPromptEditor_=function(){t.prompt(t.Msg.CHANGE_VALUE_TITLE,this.getText(),function(t){this.setValue(this.getValueFromEditorText_(t))}.bind(this))},t.FieldTextInput.prototype.showInlineEditor_=function(e){t.WidgetDiv.show(this,this.sourceBlock_.RTL,this.widgetDispose_.bind(this)),this.htmlInput_=this.widgetCreate_(),this.isBeingEdited_=!0,e||(this.htmlInput_.focus({preventScroll:!0}),this.htmlInput_.select())},t.FieldTextInput.prototype.widgetCreate_=function(){var e=t.WidgetDiv.DIV;t.utils.dom.addClass(this.getClickTarget_(),"editing");var n=document.createElement("input");n.className="blocklyHtmlInput",n.setAttribute("spellcheck",this.spellcheck_);var r=this.workspace_.getScale(),i=this.getConstants().FIELD_TEXT_FONTSIZE*r+"pt";if(e.style.fontSize=i,n.style.fontSize=i,i=t.FieldTextInput.BORDERRADIUS*r+"px",this.fullBlockClickTarget_){i=((i=this.getScaledBBox()).bottom-i.top)/2+"px";var o=this.sourceBlock_.getParent()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;n.style.border=1*r+"px solid "+o,e.style.borderRadius=i,e.style.transition="box-shadow 0.25s ease 0s",this.getConstants().FIELD_TEXTINPUT_BOX_SHADOW&&(e.style.boxShadow="rgba(255, 255, 255, 0.3) 0px 0px 0px "+4*r+"px")}return n.style.borderRadius=i,e.appendChild(n),n.value=n.defaultValue=this.getEditorText_(this.value_),n.untypedDefaultValue_=this.value_,n.oldValue_=null,this.resizeEditor_(),this.bindInputEvents_(n),n},t.FieldTextInput.prototype.widgetDispose_=function(){this.isBeingEdited_=!1,this.isTextValid_=!0,this.forceRerender(),this.onFinishEditing_&&this.onFinishEditing_(this.value_),this.unbindInputEvents_();var e=t.WidgetDiv.DIV.style;e.width="auto",e.height="auto",e.fontSize="",e.transition="",e.boxShadow="",this.htmlInput_=null,t.utils.dom.removeClass(this.getClickTarget_(),"editing")},t.FieldTextInput.prototype.bindInputEvents_=function(e){this.onKeyDownWrapper_=t.browserEvents.conditionalBind(e,"keydown",this,this.onHtmlInputKeyDown_),this.onKeyInputWrapper_=t.browserEvents.conditionalBind(e,"input",this,this.onHtmlInputChange_)},t.FieldTextInput.prototype.unbindInputEvents_=function(){this.onKeyDownWrapper_&&(t.browserEvents.unbind(this.onKeyDownWrapper_),this.onKeyDownWrapper_=null),this.onKeyInputWrapper_&&(t.browserEvents.unbind(this.onKeyInputWrapper_),this.onKeyInputWrapper_=null)},t.FieldTextInput.prototype.onHtmlInputKeyDown_=function(e){e.keyCode==t.utils.KeyCodes.ENTER?(t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation()):e.keyCode==t.utils.KeyCodes.ESC?(this.setValue(this.htmlInput_.untypedDefaultValue_),t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation()):e.keyCode==t.utils.KeyCodes.TAB&&(t.WidgetDiv.hide(),t.DropDownDiv.hideWithoutAnimation(),this.sourceBlock_.tab(this,!e.shiftKey),e.preventDefault())},t.FieldTextInput.prototype.onHtmlInputChange_=function(e){(e=this.htmlInput_.value)!==this.htmlInput_.oldValue_&&(this.htmlInput_.oldValue_=e,t.Events.setGroup(!0),e=this.getValueFromEditorText_(e),this.setValue(e),this.forceRerender(),this.resizeEditor_(),t.Events.setGroup(!1))},t.FieldTextInput.prototype.setEditorValue_=function(t){this.isDirty_=!0,this.isBeingEdited_&&(this.htmlInput_.value=this.getEditorText_(t)),this.setValue(t)},t.FieldTextInput.prototype.resizeEditor_=function(){var e=t.WidgetDiv.DIV,n=this.getScaledBBox();e.style.width=n.right-n.left+"px",e.style.height=n.bottom-n.top+"px",n=new t.utils.Coordinate(this.sourceBlock_.RTL?n.right-e.offsetWidth:n.left,n.top),e.style.left=n.x+"px",e.style.top=n.y+"px"},t.FieldTextInput.prototype.isTabNavigable=function(){return!0},t.FieldTextInput.prototype.getText_=function(){return this.isBeingEdited_&&this.htmlInput_?this.htmlInput_.value:null},t.FieldTextInput.prototype.getEditorText_=function(t){return String(t)},t.FieldTextInput.prototype.getValueFromEditorText_=function(t){return t},t.fieldRegistry.register("field_input",t.FieldTextInput),t.FieldAngle=function(e,n,r){this.clockwise_=t.FieldAngle.CLOCKWISE,this.offset_=t.FieldAngle.OFFSET,this.wrap_=t.FieldAngle.WRAP,this.round_=t.FieldAngle.ROUND,t.FieldAngle.superClass_.constructor.call(this,e,n,r),this.moveSurfaceWrapper_=this.clickSurfaceWrapper_=this.clickWrapper_=this.line_=this.gauge_=this.editor_=null},t.utils.object.inherits(t.FieldAngle,t.FieldTextInput),t.FieldAngle.prototype.DEFAULT_VALUE=0,t.FieldAngle.fromJson=function(e){return new t.FieldAngle(e.angle,void 0,e)},t.FieldAngle.prototype.SERIALIZABLE=!0,t.FieldAngle.ROUND=15,t.FieldAngle.HALF=50,t.FieldAngle.CLOCKWISE=!1,t.FieldAngle.OFFSET=0,t.FieldAngle.WRAP=360,t.FieldAngle.RADIUS=t.FieldAngle.HALF-1,t.FieldAngle.prototype.configure_=function(e){switch(t.FieldAngle.superClass_.configure_.call(this,e),e.mode){case"compass":this.clockwise_=!0,this.offset_=90;break;case"protractor":this.clockwise_=!1,this.offset_=0}var n=e.clockwise;"boolean"==typeof n&&(this.clockwise_=n),null!=(n=e.offset)&&(n=Number(n),isNaN(n)||(this.offset_=n)),null!=(n=e.wrap)&&(n=Number(n),isNaN(n)||(this.wrap_=n)),null!=(e=e.round)&&(e=Number(e),isNaN(e)||(this.round_=e))},t.FieldAngle.prototype.initView=function(){t.FieldAngle.superClass_.initView.call(this),this.symbol_=t.utils.dom.createSvgElement(t.utils.Svg.TSPAN,{},null),this.symbol_.appendChild(document.createTextNode("°")),this.textElement_.appendChild(this.symbol_)},t.FieldAngle.prototype.render_=function(){t.FieldAngle.superClass_.render_.call(this),this.updateGraph_()},t.FieldAngle.prototype.showEditor_=function(e){t.FieldAngle.superClass_.showEditor_.call(this,e,t.utils.userAgent.MOBILE||t.utils.userAgent.ANDROID||t.utils.userAgent.IPAD),this.dropdownCreate_(),t.DropDownDiv.getContentDiv().appendChild(this.editor_),t.DropDownDiv.setColour(this.sourceBlock_.style.colourPrimary,this.sourceBlock_.style.colourTertiary),t.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.updateGraph_()},t.FieldAngle.prototype.dropdownCreate_=function(){var e=t.utils.dom.createSvgElement(t.utils.Svg.SVG,{xmlns:t.utils.dom.SVG_NS,"xmlns:html":t.utils.dom.HTML_NS,"xmlns:xlink":t.utils.dom.XLINK_NS,version:"1.1",height:2*t.FieldAngle.HALF+"px",width:2*t.FieldAngle.HALF+"px",style:"touch-action: none"},null),n=t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{cx:t.FieldAngle.HALF,cy:t.FieldAngle.HALF,r:t.FieldAngle.RADIUS,class:"blocklyAngleCircle"},e);this.gauge_=t.utils.dom.createSvgElement(t.utils.Svg.PATH,{class:"blocklyAngleGauge"},e),this.line_=t.utils.dom.createSvgElement(t.utils.Svg.LINE,{x1:t.FieldAngle.HALF,y1:t.FieldAngle.HALF,class:"blocklyAngleLine"},e);for(var r=0;360>r;r+=15)t.utils.dom.createSvgElement(t.utils.Svg.LINE,{x1:t.FieldAngle.HALF+t.FieldAngle.RADIUS,y1:t.FieldAngle.HALF,x2:t.FieldAngle.HALF+t.FieldAngle.RADIUS-(0==r%45?10:5),y2:t.FieldAngle.HALF,class:"blocklyAngleMarks",transform:"rotate("+r+","+t.FieldAngle.HALF+","+t.FieldAngle.HALF+")"},e);this.clickWrapper_=t.browserEvents.conditionalBind(e,"click",this,this.hide_),this.clickSurfaceWrapper_=t.browserEvents.conditionalBind(n,"click",this,this.onMouseMove_,!0,!0),this.moveSurfaceWrapper_=t.browserEvents.conditionalBind(n,"mousemove",this,this.onMouseMove_,!0,!0),this.editor_=e},t.FieldAngle.prototype.dropdownDispose_=function(){this.clickWrapper_&&(t.browserEvents.unbind(this.clickWrapper_),this.clickWrapper_=null),this.clickSurfaceWrapper_&&(t.browserEvents.unbind(this.clickSurfaceWrapper_),this.clickSurfaceWrapper_=null),this.moveSurfaceWrapper_&&(t.browserEvents.unbind(this.moveSurfaceWrapper_),this.moveSurfaceWrapper_=null),this.line_=this.gauge_=null},t.FieldAngle.prototype.hide_=function(){t.DropDownDiv.hideIfOwner(this),t.WidgetDiv.hide()},t.FieldAngle.prototype.onMouseMove_=function(e){var n=this.gauge_.ownerSVGElement.getBoundingClientRect(),r=e.clientX-n.left-t.FieldAngle.HALF;e=e.clientY-n.top-t.FieldAngle.HALF,n=Math.atan(-e/r),isNaN(n)||(n=t.utils.math.toDegrees(n),0>r?n+=180:0(t%=360)&&(t+=360),t>this.wrap_&&(t-=360),t},t.Css.register(".blocklyAngleCircle {,stroke: #444;,stroke-width: 1;,fill: #ddd;,fill-opacity: .8;,},.blocklyAngleMarks {,stroke: #444;,stroke-width: 1;,},.blocklyAngleGauge {,fill: #f88;,fill-opacity: .8;,pointer-events: none;,},.blocklyAngleLine {,stroke: #f00;,stroke-width: 2;,stroke-linecap: round;,pointer-events: none;,}".split(",")),t.fieldRegistry.register("field_angle",t.FieldAngle),t.FieldCheckbox=function(e,n,r){this.checkChar_=null,t.FieldCheckbox.superClass_.constructor.call(this,e,n,r)},t.utils.object.inherits(t.FieldCheckbox,t.Field),t.FieldCheckbox.prototype.DEFAULT_VALUE=!1,t.FieldCheckbox.fromJson=function(e){return new t.FieldCheckbox(e.checked,void 0,e)},t.FieldCheckbox.CHECK_CHAR="✓",t.FieldCheckbox.prototype.SERIALIZABLE=!0,t.FieldCheckbox.prototype.CURSOR="default",t.FieldCheckbox.prototype.configure_=function(e){t.FieldCheckbox.superClass_.configure_.call(this,e),e.checkCharacter&&(this.checkChar_=e.checkCharacter)},t.FieldCheckbox.prototype.initView=function(){t.FieldCheckbox.superClass_.initView.call(this),t.utils.dom.addClass(this.textElement_,"blocklyCheckbox"),this.textElement_.style.display=this.value_?"block":"none"},t.FieldCheckbox.prototype.render_=function(){this.textContent_&&(this.textContent_.nodeValue=this.getDisplayText_()),this.updateSize_(this.getConstants().FIELD_CHECKBOX_X_OFFSET)},t.FieldCheckbox.prototype.getDisplayText_=function(){return this.checkChar_||t.FieldCheckbox.CHECK_CHAR},t.FieldCheckbox.prototype.setCheckCharacter=function(t){this.checkChar_=t,this.forceRerender()},t.FieldCheckbox.prototype.showEditor_=function(){this.setValue(!this.value_)},t.FieldCheckbox.prototype.doClassValidation_=function(t){return!0===t||"TRUE"===t?"TRUE":!1===t||"FALSE"===t?"FALSE":null},t.FieldCheckbox.prototype.doValueUpdate_=function(t){this.value_=this.convertValueToBool_(t),this.textElement_&&(this.textElement_.style.display=this.value_?"block":"none")},t.FieldCheckbox.prototype.getValue=function(){return this.value_?"TRUE":"FALSE"},t.FieldCheckbox.prototype.getValueBoolean=function(){return this.value_},t.FieldCheckbox.prototype.getText=function(){return String(this.convertValueToBool_(this.value_))},t.FieldCheckbox.prototype.convertValueToBool_=function(t){return"string"==typeof t?"TRUE"==t:!!t},t.fieldRegistry.register("field_checkbox",t.FieldCheckbox),t.FieldColour=function(e,n,r){t.FieldColour.superClass_.constructor.call(this,e,n,r),this.onKeyDownWrapper_=this.onMouseLeaveWrapper_=this.onMouseEnterWrapper_=this.onMouseMoveWrapper_=this.onClickWrapper_=this.highlightedIndex_=this.picker_=null},t.utils.object.inherits(t.FieldColour,t.Field),t.FieldColour.fromJson=function(e){return new t.FieldColour(e.colour,void 0,e)},t.FieldColour.prototype.SERIALIZABLE=!0,t.FieldColour.prototype.CURSOR="default",t.FieldColour.prototype.isDirty_=!1,t.FieldColour.prototype.colours_=null,t.FieldColour.prototype.titles_=null,t.FieldColour.prototype.columns_=0,t.FieldColour.prototype.configure_=function(e){t.FieldColour.superClass_.configure_.call(this,e),e.colourOptions&&(this.colours_=e.colourOptions,this.titles_=e.colourTitles),e.columns&&(this.columns_=e.columns)},t.FieldColour.prototype.initView=function(){this.size_=new t.utils.Size(this.getConstants().FIELD_COLOUR_DEFAULT_WIDTH,this.getConstants().FIELD_COLOUR_DEFAULT_HEIGHT),this.getConstants().FIELD_COLOUR_FULL_BLOCK?this.clickTarget_=this.sourceBlock_.getSvgRoot():(this.createBorderRect_(),this.borderRect_.style.fillOpacity="1")},t.FieldColour.prototype.applyColour=function(){this.getConstants().FIELD_COLOUR_FULL_BLOCK?(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",this.getValue()),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff")):this.borderRect_&&(this.borderRect_.style.fill=this.getValue())},t.FieldColour.prototype.doClassValidation_=function(e){return"string"!=typeof e?null:t.utils.colour.parse(e)},t.FieldColour.prototype.doValueUpdate_=function(t){this.value_=t,this.borderRect_?this.borderRect_.style.fill=t:this.sourceBlock_&&this.sourceBlock_.rendered&&(this.sourceBlock_.pathObject.svgPath.setAttribute("fill",t),this.sourceBlock_.pathObject.svgPath.setAttribute("stroke","#fff"))},t.FieldColour.prototype.getText=function(){var t=this.value_;return/^#(.)\1(.)\2(.)\3$/.test(t)&&(t="#"+t[1]+t[3]+t[5]),t},t.FieldColour.COLOURS="#ffffff #cccccc #c0c0c0 #999999 #666666 #333333 #000000 #ffcccc #ff6666 #ff0000 #cc0000 #990000 #660000 #330000 #ffcc99 #ff9966 #ff9900 #ff6600 #cc6600 #993300 #663300 #ffff99 #ffff66 #ffcc66 #ffcc33 #cc9933 #996633 #663333 #ffffcc #ffff33 #ffff00 #ffcc00 #999900 #666600 #333300 #99ff99 #66ff99 #33ff33 #33cc00 #009900 #006600 #003300 #99ffff #33ffff #66cccc #00cccc #339999 #336666 #003333 #ccffff #66ffff #33ccff #3366ff #3333ff #000099 #000066 #ccccff #9999ff #6666cc #6633ff #6600cc #333399 #330099 #ffccff #ff99ff #cc66cc #cc33cc #993399 #663366 #330033".split(" "),t.FieldColour.prototype.DEFAULT_VALUE=t.FieldColour.COLOURS[0],t.FieldColour.TITLES=[],t.FieldColour.COLUMNS=7,t.FieldColour.prototype.setColours=function(t,e){return this.colours_=t,e&&(this.titles_=e),this},t.FieldColour.prototype.setColumns=function(t){return this.columns_=t,this},t.FieldColour.prototype.showEditor_=function(){this.dropdownCreate_(),t.DropDownDiv.getContentDiv().appendChild(this.picker_),t.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.picker_.focus({preventScroll:!0})},t.FieldColour.prototype.onClick_=function(e){null!==(e=(e=e.target)&&e.label)&&(this.setValue(e),t.DropDownDiv.hideIfOwner(this))},t.FieldColour.prototype.onKeyDown_=function(e){var n=!1;e.keyCode===t.utils.KeyCodes.UP?(this.moveHighlightBy_(0,-1),n=!0):e.keyCode===t.utils.KeyCodes.DOWN?(this.moveHighlightBy_(0,1),n=!0):e.keyCode===t.utils.KeyCodes.LEFT?(this.moveHighlightBy_(-1,0),n=!0):e.keyCode===t.utils.KeyCodes.RIGHT?(this.moveHighlightBy_(1,0),n=!0):e.keyCode===t.utils.KeyCodes.ENTER&&((n=this.getHighlighted_())&&(null!==(n=n&&n.label)&&this.setValue(n)),t.DropDownDiv.hideWithoutAnimation(),n=!0),n&&e.stopPropagation()},t.FieldColour.prototype.moveHighlightBy_=function(e,n){var r=this.colours_||t.FieldColour.COLOURS,i=this.columns_||t.FieldColour.COLUMNS,o=this.highlightedIndex_%i,s=Math.floor(this.highlightedIndex_/i);o+=e,s+=n,0>e?0>o&&0o&&(o=0):0i-1&&si-1&&o--:0>n?0>s&&(s=0):0Math.floor(r.length/i)-1&&(s=Math.floor(r.length/i)-1),this.setHighlightedCell_(this.picker_.childNodes[s].childNodes[o],s*i+o)},t.FieldColour.prototype.onMouseMove_=function(t){var e=(t=t.target)&&Number(t.getAttribute("data-index"));null!==e&&e!==this.highlightedIndex_&&this.setHighlightedCell_(t,e)},t.FieldColour.prototype.onMouseEnter_=function(){this.picker_.focus({preventScroll:!0})},t.FieldColour.prototype.onMouseLeave_=function(){this.picker_.blur();var e=this.getHighlighted_();e&&t.utils.dom.removeClass(e,"blocklyColourHighlighted")},t.FieldColour.prototype.getHighlighted_=function(){var e=this.columns_||t.FieldColour.COLUMNS,n=this.picker_.childNodes[Math.floor(this.highlightedIndex_/e)];return n?n.childNodes[this.highlightedIndex_%e]:null},t.FieldColour.prototype.setHighlightedCell_=function(e,n){var r=this.getHighlighted_();r&&t.utils.dom.removeClass(r,"blocklyColourHighlighted"),t.utils.dom.addClass(e,"blocklyColourHighlighted"),this.highlightedIndex_=n,t.utils.aria.setState(this.picker_,t.utils.aria.State.ACTIVEDESCENDANT,e.getAttribute("id"))},t.FieldColour.prototype.dropdownCreate_=function(){var e=this.columns_||t.FieldColour.COLUMNS,n=this.colours_||t.FieldColour.COLOURS,r=this.titles_||t.FieldColour.TITLES,i=this.getValue(),o=document.createElement("table");o.className="blocklyColourTable",o.tabIndex=0,o.dir="ltr",t.utils.aria.setRole(o,t.utils.aria.Role.GRID),t.utils.aria.setState(o,t.utils.aria.State.EXPANDED,!0),t.utils.aria.setState(o,t.utils.aria.State.ROWCOUNT,Math.floor(n.length/e)),t.utils.aria.setState(o,t.utils.aria.State.COLCOUNT,e);for(var s,a=0;atr>td {","border: .5px solid #888;","box-sizing: border-box;","cursor: pointer;","display: inline-block;","height: 20px;","padding: 0;","width: 20px;","}",".blocklyColourTable>tr>td.blocklyColourHighlighted {","border-color: #eee;","box-shadow: 2px 2px 7px 2px rgba(0,0,0,.3);","position: relative;","}",".blocklyColourSelected, .blocklyColourSelected:hover {","border-color: #eee !important;","outline: 1px solid #333;","position: relative;","}"]),t.fieldRegistry.register("field_colour",t.FieldColour),t.FieldDropdown=function(e,n,r){"function"!=typeof e&&t.FieldDropdown.validateOptions_(e),this.menuGenerator_=e,this.suffixField=this.prefixField=this.generatedOptions_=null,this.trimOptions_(),this.selectedOption_=this.getOptions(!1)[0],t.FieldDropdown.superClass_.constructor.call(this,this.selectedOption_[1],n,r),this.svgArrow_=this.arrow_=this.imageElement_=this.menu_=this.selectedMenuItem_=null},t.utils.object.inherits(t.FieldDropdown,t.Field),t.FieldDropdown.fromJson=function(e){return new t.FieldDropdown(e.options,void 0,e)},t.FieldDropdown.prototype.fromXml=function(t){this.isOptionListDynamic()&&this.getOptions(!1),this.setValue(t.textContent)},t.FieldDropdown.prototype.SERIALIZABLE=!0,t.FieldDropdown.CHECKMARK_OVERHANG=25,t.FieldDropdown.MAX_MENU_HEIGHT_VH=.45,t.FieldDropdown.IMAGE_Y_OFFSET=5,t.FieldDropdown.IMAGE_Y_PADDING=2*t.FieldDropdown.IMAGE_Y_OFFSET,t.FieldDropdown.ARROW_CHAR=t.utils.userAgent.ANDROID?"▼":"▾",t.FieldDropdown.prototype.CURSOR="default",t.FieldDropdown.prototype.initView=function(){this.shouldAddBorderRect_()?this.createBorderRect_():this.clickTarget_=this.sourceBlock_.getSvgRoot(),this.createTextElement_(),this.imageElement_=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{},this.fieldGroup_),this.getConstants().FIELD_DROPDOWN_SVG_ARROW?this.createSVGArrow_():this.createTextArrow_(),this.borderRect_&&t.utils.dom.addClass(this.borderRect_,"blocklyDropdownRect")},t.FieldDropdown.prototype.shouldAddBorderRect_=function(){return!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW&&!this.sourceBlock_.isShadow()},t.FieldDropdown.prototype.createTextArrow_=function(){this.arrow_=t.utils.dom.createSvgElement(t.utils.Svg.TSPAN,{},this.textElement_),this.arrow_.appendChild(document.createTextNode(this.sourceBlock_.RTL?t.FieldDropdown.ARROW_CHAR+" ":" "+t.FieldDropdown.ARROW_CHAR)),this.sourceBlock_.RTL?this.textElement_.insertBefore(this.arrow_,this.textContent_):this.textElement_.appendChild(this.arrow_)},t.FieldDropdown.prototype.createSVGArrow_=function(){this.svgArrow_=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{height:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px",width:this.getConstants().FIELD_DROPDOWN_SVG_ARROW_SIZE+"px"},this.fieldGroup_),this.svgArrow_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.getConstants().FIELD_DROPDOWN_SVG_ARROW_DATAURI)},t.FieldDropdown.prototype.showEditor_=function(e){if(this.dropdownCreate_(),this.menu_.openingCoords=e&&"number"==typeof e.clientX?new t.utils.Coordinate(e.clientX,e.clientY):null,this.menu_.render(t.DropDownDiv.getContentDiv()),e=this.menu_.getElement(),t.utils.dom.addClass(e,"blocklyDropdownMenu"),this.getConstants().FIELD_DROPDOWN_COLOURED_DIV){e=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().getColour():this.sourceBlock_.getColour();var n=this.sourceBlock_.isShadow()?this.sourceBlock_.getParent().style.colourTertiary:this.sourceBlock_.style.colourTertiary;t.DropDownDiv.setColour(e,n)}t.DropDownDiv.showPositionedByField(this,this.dropdownDispose_.bind(this)),this.menu_.focus(),this.selectedMenuItem_&&this.menu_.setHighlighted(this.selectedMenuItem_),this.applyColour()},t.FieldDropdown.prototype.dropdownCreate_=function(){var e=new t.Menu;e.setRole(t.utils.aria.Role.LISTBOX),this.menu_=e;var n=this.getOptions(!1);this.selectedMenuItem_=null;for(var r=0;re.length)){for(n=[],r=0;r=r||0>=n)throw Error("Height and width values of an image field must be greater than 0.");this.flipRtl_=!1,this.altText_="",t.FieldImage.superClass_.constructor.call(this,e,null,a),a||(this.flipRtl_=!!s,this.altText_=t.utils.replaceMessageReferences(i)||""),this.size_=new t.utils.Size(n,r+t.FieldImage.Y_PADDING),this.imageHeight_=r,this.clickHandler_=null,"function"==typeof o&&(this.clickHandler_=o),this.imageElement_=null},t.utils.object.inherits(t.FieldImage,t.Field),t.FieldImage.prototype.DEFAULT_VALUE="",t.FieldImage.fromJson=function(e){return new t.FieldImage(e.src,e.width,e.height,void 0,void 0,void 0,e)},t.FieldImage.Y_PADDING=1,t.FieldImage.prototype.EDITABLE=!1,t.FieldImage.prototype.isDirty_=!1,t.FieldImage.prototype.configure_=function(e){t.FieldImage.superClass_.configure_.call(this,e),this.flipRtl_=!!e.flipRtl,this.altText_=t.utils.replaceMessageReferences(e.alt)||""},t.FieldImage.prototype.initView=function(){this.imageElement_=t.utils.dom.createSvgElement(t.utils.Svg.IMAGE,{height:this.imageHeight_+"px",width:this.size_.width+"px",alt:this.altText_},this.fieldGroup_),this.imageElement_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",this.value_),this.clickHandler_&&(this.imageElement_.style.cursor="pointer")},t.FieldImage.prototype.updateSize_=function(){},t.FieldImage.prototype.doClassValidation_=function(t){return"string"!=typeof t?null:t},t.FieldImage.prototype.doValueUpdate_=function(e){this.value_=e,this.imageElement_&&this.imageElement_.setAttributeNS(t.utils.dom.XLINK_NS,"xlink:href",String(this.value_))},t.FieldImage.prototype.getFlipRtl=function(){return this.flipRtl_},t.FieldImage.prototype.setAlt=function(t){t!=this.altText_&&(this.altText_=t||"",this.imageElement_&&this.imageElement_.setAttribute("alt",this.altText_))},t.FieldImage.prototype.showEditor_=function(){this.clickHandler_&&this.clickHandler_(this)},t.FieldImage.prototype.setOnClickHandler=function(t){this.clickHandler_=t},t.FieldImage.prototype.getText_=function(){return this.altText_},t.fieldRegistry.register("field_image",t.FieldImage),t.FieldMultilineInput=function(e,n,r){t.FieldMultilineInput.superClass_.constructor.call(this,e,n,r),this.textGroup_=null,this.maxLines_=1/0,this.isOverflowedY_=!1},t.utils.object.inherits(t.FieldMultilineInput,t.FieldTextInput),t.FieldMultilineInput.prototype.configure_=function(e){t.FieldMultilineInput.superClass_.configure_.call(this,e),e.maxLines&&this.setMaxLines(e.maxLines)},t.FieldMultilineInput.fromJson=function(e){var n=t.utils.replaceMessageReferences(e.text);return new t.FieldMultilineInput(n,void 0,e)},t.FieldMultilineInput.prototype.toXml=function(t){return t.textContent=this.getValue().replace(/\n/g," "),t},t.FieldMultilineInput.prototype.fromXml=function(t){this.setValue(t.textContent.replace(/ /g,"\n"))},t.FieldMultilineInput.prototype.initView=function(){this.createBorderRect_(),this.textGroup_=t.utils.dom.createSvgElement(t.utils.Svg.G,{class:"blocklyEditableText"},this.fieldGroup_)},t.FieldMultilineInput.prototype.getDisplayText_=function(){var e=this.getText();if(!e)return t.Field.NBSP;var n=e.split("\n");e="";for(var r=this.isOverflowedY_?this.maxLines_:n.length,i=0;ithis.maxDisplayLength?o=o.substring(0,this.maxDisplayLength-4)+"...":this.isOverflowedY_&&i===r-1&&(o=o.substring(0,o.length-3)+"..."),e+=o=o.replace(/\s/g,t.Field.NBSP),i!==r-1&&(e+="\n")}return this.sourceBlock_.RTL&&(e+="‏"),e},t.FieldMultilineInput.prototype.doValueUpdate_=function(e){t.FieldMultilineInput.superClass_.doValueUpdate_.call(this,e),this.isOverflowedY_=this.value_.split("\n").length>this.maxLines_},t.FieldMultilineInput.prototype.render_=function(){for(var e;e=this.textGroup_.firstChild;)this.textGroup_.removeChild(e);e=this.getDisplayText_().split("\n");for(var n=0,r=0;rn&&(n=o),r+=this.getConstants().FIELD_TEXT_HEIGHT+(0this.maxDisplayLength&&(e[i]=e[i].substring(0,this.maxDisplayLength)),o.textContent=e[i];var u=t.utils.dom.getFastTextWidth(o,s,a,l);u>n&&(n=u)}n+=this.htmlInput_.offsetWidth-this.htmlInput_.clientWidth}this.borderRect_&&(r+=2*this.getConstants().FIELD_BORDER_RECT_Y_PADDING,n+=2*this.getConstants().FIELD_BORDER_RECT_X_PADDING,this.borderRect_.setAttribute("width",n),this.borderRect_.setAttribute("height",r)),this.size_.width=n,this.size_.height=r,this.positionBorderRect_()},t.FieldMultilineInput.prototype.showEditor_=function(e,n){t.FieldMultilineInput.superClass_.showEditor_.call(this,e,n),this.forceRerender()},t.FieldMultilineInput.prototype.widgetCreate_=function(){var e=t.WidgetDiv.DIV,n=this.workspace_.getScale(),r=document.createElement("textarea");r.className="blocklyHtmlInput blocklyHtmlTextAreaInput",r.setAttribute("spellcheck",this.spellcheck_);var i=this.getConstants().FIELD_TEXT_FONTSIZE*n+"pt";e.style.fontSize=i,r.style.fontSize=i,r.style.borderRadius=t.FieldTextInput.BORDERRADIUS*n+"px",i=this.getConstants().FIELD_BORDER_RECT_X_PADDING*n;var o=this.getConstants().FIELD_BORDER_RECT_Y_PADDING*n/2;return r.style.padding=o+"px "+i+"px "+o+"px "+i+"px",i=this.getConstants().FIELD_TEXT_HEIGHT+this.getConstants().FIELD_BORDER_RECT_Y_PADDING,r.style.lineHeight=i*n+"px",e.appendChild(r),r.value=r.defaultValue=this.getEditorText_(this.value_),r.untypedDefaultValue_=this.value_,r.oldValue_=null,t.utils.userAgent.GECKO?setTimeout(this.resizeEditor_.bind(this),0):this.resizeEditor_(),this.bindInputEvents_(r),r},t.FieldMultilineInput.prototype.setMaxLines=function(t){"number"==typeof t&&0this.max_&&t.utils.aria.setState(e,t.utils.aria.State.VALUEMAX,this.max_),e},t.fieldRegistry.register("field_number",t.FieldNumber),t.FieldVariable=function(e,n,r,i,o){this.menuGenerator_=t.FieldVariable.dropdownCreate,this.defaultVariableName="string"==typeof e?e:"",this.size_=new t.utils.Size(0,0),o&&this.configure_(o),n&&this.setValidator(n),o||this.setTypes_(r,i)},t.utils.object.inherits(t.FieldVariable,t.FieldDropdown),t.FieldVariable.fromJson=function(e){var n=t.utils.replaceMessageReferences(e.variable);return new t.FieldVariable(n,void 0,void 0,void 0,e)},t.FieldVariable.prototype.SERIALIZABLE=!0,t.FieldVariable.prototype.configure_=function(e){t.FieldVariable.superClass_.configure_.call(this,e),this.setTypes_(e.variableTypes,e.defaultType)},t.FieldVariable.prototype.initModel=function(){if(!this.variable_){var e=t.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,null,this.defaultVariableName,this.defaultType_);this.doValueUpdate_(e.getId())}},t.FieldVariable.prototype.shouldAddBorderRect_=function(){return t.FieldVariable.superClass_.shouldAddBorderRect_.call(this)&&(!this.getConstants().FIELD_DROPDOWN_NO_BORDER_RECT_SHADOW||"variables_get"!=this.sourceBlock_.type)},t.FieldVariable.prototype.fromXml=function(e){var n=e.getAttribute("id"),r=e.textContent,i=e.getAttribute("variabletype")||e.getAttribute("variableType")||"";if(n=t.Variables.getOrCreateVariablePackage(this.sourceBlock_.workspace,n,r,i),null!=i&&i!==n.type)throw Error("Serialized variable type with id '"+n.getId()+"' had type "+n.type+", and does not match variable field that references it: "+t.Xml.domToText(e)+".");this.setValue(n.getId())},t.FieldVariable.prototype.toXml=function(t){return this.initModel(),t.id=this.variable_.getId(),t.textContent=this.variable_.name,this.variable_.type&&t.setAttribute("variabletype",this.variable_.type),t},t.FieldVariable.prototype.setSourceBlock=function(e){if(e.isShadow())throw Error("Variable fields are not allowed to exist on shadow blocks.");t.FieldVariable.superClass_.setSourceBlock.call(this,e)},t.FieldVariable.prototype.getValue=function(){return this.variable_?this.variable_.getId():null},t.FieldVariable.prototype.getText=function(){return this.variable_?this.variable_.name:""},t.FieldVariable.prototype.getVariable=function(){return this.variable_},t.FieldVariable.prototype.getValidator=function(){return this.variable_?this.validator_:null},t.FieldVariable.prototype.doClassValidation_=function(e){if(null===e)return null;var n=t.Variables.getVariable(this.sourceBlock_.workspace,e);return n?(n=n.type,this.typeIsAllowed_(n)?e:(console.warn("Variable type doesn't match this field! Type was "+n),null)):(console.warn("Variable id doesn't point to a real variable! ID was "+e),null)},t.FieldVariable.prototype.doValueUpdate_=function(e){this.variable_=t.Variables.getVariable(this.sourceBlock_.workspace,e),t.FieldVariable.superClass_.doValueUpdate_.call(this,e)},t.FieldVariable.prototype.typeIsAllowed_=function(t){var e=this.getVariableTypes_();if(!e)return!0;for(var n=0;nrect,",t+" .blocklyEditableText>rect {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","fill-opacity: .6;","stroke: none;","}",t+" .blocklyNonEditableText>text,",t+" .blocklyEditableText>text {","fill: #000;","}",t+" .blocklyFlyoutLabelText {","fill: #000;","}",t+" .blocklyText.blocklyBubbleText {","fill: #000;","}",t+" .blocklyEditableText:not(.editing):hover>rect {","stroke: #fff;","stroke-width: 2;","}",t+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","}",t+" .blocklySelected>.blocklyPath {","stroke: #fc3;","stroke-width: 3px;","}",t+" .blocklyHighlightedConnectionPath {","stroke: #fc3;","}",t+" .blocklyReplaceable .blocklyPath {","fill-opacity: .5;","}",t+" .blocklyReplaceable .blocklyPathLight,",t+" .blocklyReplaceable .blocklyPathDark {","display: none;","}",t+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]},t.blockRendering.Types={NONE:0,FIELD:1,HAT:2,ICON:4,SPACER:8,BETWEEN_ROW_SPACER:16,IN_ROW_SPACER:32,EXTERNAL_VALUE_INPUT:64,INPUT:128,INLINE_INPUT:256,STATEMENT_INPUT:512,CONNECTION:1024,PREVIOUS_CONNECTION:2048,NEXT_CONNECTION:4096,OUTPUT_CONNECTION:8192,CORNER:16384,LEFT_SQUARE_CORNER:32768,LEFT_ROUND_CORNER:65536,RIGHT_SQUARE_CORNER:131072,RIGHT_ROUND_CORNER:262144,JAGGED_EDGE:524288,ROW:1048576,TOP_ROW:2097152,BOTTOM_ROW:4194304,INPUT_ROW:8388608},t.blockRendering.Types.LEFT_CORNER=t.blockRendering.Types.LEFT_SQUARE_CORNER|t.blockRendering.Types.LEFT_ROUND_CORNER,t.blockRendering.Types.RIGHT_CORNER=t.blockRendering.Types.RIGHT_SQUARE_CORNER|t.blockRendering.Types.RIGHT_ROUND_CORNER,t.blockRendering.Types.nextTypeValue_=16777216,t.blockRendering.Types.getType=function(e){return Object.prototype.hasOwnProperty.call(t.blockRendering.Types,e)||(t.blockRendering.Types[e]=t.blockRendering.Types.nextTypeValue_,t.blockRendering.Types.nextTypeValue_<<=1),t.blockRendering.Types[e]},t.blockRendering.Types.isField=function(e){return e.type&t.blockRendering.Types.FIELD},t.blockRendering.Types.isHat=function(e){return e.type&t.blockRendering.Types.HAT},t.blockRendering.Types.isIcon=function(e){return e.type&t.blockRendering.Types.ICON},t.blockRendering.Types.isSpacer=function(e){return e.type&t.blockRendering.Types.SPACER},t.blockRendering.Types.isInRowSpacer=function(e){return e.type&t.blockRendering.Types.IN_ROW_SPACER},t.blockRendering.Types.isInput=function(e){return e.type&t.blockRendering.Types.INPUT},t.blockRendering.Types.isExternalInput=function(e){return e.type&t.blockRendering.Types.EXTERNAL_VALUE_INPUT},t.blockRendering.Types.isInlineInput=function(e){return e.type&t.blockRendering.Types.INLINE_INPUT},t.blockRendering.Types.isStatementInput=function(e){return e.type&t.blockRendering.Types.STATEMENT_INPUT},t.blockRendering.Types.isPreviousConnection=function(e){return e.type&t.blockRendering.Types.PREVIOUS_CONNECTION},t.blockRendering.Types.isNextConnection=function(e){return e.type&t.blockRendering.Types.NEXT_CONNECTION},t.blockRendering.Types.isPreviousOrNextConnection=function(e){return e.type&(t.blockRendering.Types.PREVIOUS_CONNECTION|t.blockRendering.Types.NEXT_CONNECTION)},t.blockRendering.Types.isLeftRoundedCorner=function(e){return e.type&t.blockRendering.Types.LEFT_ROUND_CORNER},t.blockRendering.Types.isRightRoundedCorner=function(e){return e.type&t.blockRendering.Types.RIGHT_ROUND_CORNER},t.blockRendering.Types.isLeftSquareCorner=function(e){return e.type&t.blockRendering.Types.LEFT_SQUARE_CORNER},t.blockRendering.Types.isRightSquareCorner=function(e){return e.type&t.blockRendering.Types.RIGHT_SQUARE_CORNER},t.blockRendering.Types.isCorner=function(e){return e.type&t.blockRendering.Types.CORNER},t.blockRendering.Types.isJaggedEdge=function(e){return e.type&t.blockRendering.Types.JAGGED_EDGE},t.blockRendering.Types.isRow=function(e){return e.type&t.blockRendering.Types.ROW},t.blockRendering.Types.isBetweenRowSpacer=function(e){return e.type&t.blockRendering.Types.BETWEEN_ROW_SPACER},t.blockRendering.Types.isTopRow=function(e){return e.type&t.blockRendering.Types.TOP_ROW},t.blockRendering.Types.isBottomRow=function(e){return e.type&t.blockRendering.Types.BOTTOM_ROW},t.blockRendering.Types.isTopOrBottomRow=function(e){return e.type&(t.blockRendering.Types.TOP_ROW|t.blockRendering.Types.BOTTOM_ROW)},t.blockRendering.Types.isInputRow=function(e){return e.type&t.blockRendering.Types.INPUT_ROW},t.blockRendering.Measurable=function(e){this.height=this.width=0,this.type=t.blockRendering.Types.NONE,this.centerline=this.xPos=0,this.constants_=e,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT},t.blockRendering.Connection=function(e,n){t.blockRendering.Connection.superClass_.constructor.call(this,e),this.connectionModel=n,this.shape=this.constants_.shapeFor(n),this.isDynamicShape=!!this.shape.isDynamic,this.type|=t.blockRendering.Types.CONNECTION},t.utils.object.inherits(t.blockRendering.Connection,t.blockRendering.Measurable),t.blockRendering.OutputConnection=function(e,n){t.blockRendering.OutputConnection.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.OUTPUT_CONNECTION,this.height=this.isDynamicShape?0:this.shape.height,this.startX=this.width=this.isDynamicShape?0:this.shape.width,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX=0},t.utils.object.inherits(t.blockRendering.OutputConnection,t.blockRendering.Connection),t.blockRendering.PreviousConnection=function(e,n){t.blockRendering.PreviousConnection.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.PREVIOUS_CONNECTION,this.height=this.shape.height,this.width=this.shape.width},t.utils.object.inherits(t.blockRendering.PreviousConnection,t.blockRendering.Connection),t.blockRendering.NextConnection=function(e,n){t.blockRendering.NextConnection.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.NEXT_CONNECTION,this.height=this.shape.height,this.width=this.shape.width},t.utils.object.inherits(t.blockRendering.NextConnection,t.blockRendering.Connection),t.blockRendering.InputConnection=function(e,n){t.blockRendering.InputConnection.superClass_.constructor.call(this,e,n.connection),this.type|=t.blockRendering.Types.INPUT,this.input=n,this.align=n.align,(this.connectedBlock=n.connection&&n.connection.targetBlock()?n.connection.targetBlock():null)?(e=this.connectedBlock.getHeightWidth(),this.connectedBlockWidth=e.width,this.connectedBlockHeight=e.height):this.connectedBlockHeight=this.connectedBlockWidth=0,this.connectionOffsetY=this.connectionOffsetX=0},t.utils.object.inherits(t.blockRendering.InputConnection,t.blockRendering.Connection),t.blockRendering.InlineInput=function(e,n){t.blockRendering.InlineInput.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.INLINE_INPUT,this.connectedBlock?(this.width=this.connectedBlockWidth,this.height=this.connectedBlockHeight):(this.height=this.constants_.EMPTY_INLINE_INPUT_HEIGHT,this.width=this.constants_.EMPTY_INLINE_INPUT_PADDING),this.connectionHeight=this.isDynamicShape?this.shape.height(this.height):this.shape.height,this.connectionWidth=this.isDynamicShape?this.shape.width(this.height):this.shape.width,this.connectedBlock||(this.width+=this.connectionWidth*(this.isDynamicShape?2:1)),this.connectionOffsetY=this.isDynamicShape?this.shape.connectionOffsetY(this.connectionHeight):this.constants_.TAB_OFFSET_FROM_TOP,this.connectionOffsetX=this.isDynamicShape?this.shape.connectionOffsetX(this.connectionWidth):0},t.utils.object.inherits(t.blockRendering.InlineInput,t.blockRendering.InputConnection),t.blockRendering.StatementInput=function(e,n){t.blockRendering.StatementInput.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.STATEMENT_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight+this.constants_.STATEMENT_BOTTOM_SPACER:this.constants_.EMPTY_STATEMENT_INPUT_HEIGHT,this.width=this.constants_.STATEMENT_INPUT_NOTCH_OFFSET+this.shape.width},t.utils.object.inherits(t.blockRendering.StatementInput,t.blockRendering.InputConnection),t.blockRendering.ExternalValueInput=function(e,n){t.blockRendering.ExternalValueInput.superClass_.constructor.call(this,e,n),this.type|=t.blockRendering.Types.EXTERNAL_VALUE_INPUT,this.height=this.connectedBlock?this.connectedBlockHeight-this.constants_.TAB_OFFSET_FROM_TOP-this.constants_.MEDIUM_PADDING:this.shape.height,this.width=this.shape.width+this.constants_.EXTERNAL_VALUE_INPUT_PADDING,this.connectionOffsetY=this.constants_.TAB_OFFSET_FROM_TOP,this.connectionHeight=this.shape.height,this.connectionWidth=this.shape.width},t.utils.object.inherits(t.blockRendering.ExternalValueInput,t.blockRendering.InputConnection),t.blockRendering.Icon=function(e,n){t.blockRendering.Icon.superClass_.constructor.call(this,e),this.icon=n,this.isVisible=n.isVisible(),this.type|=t.blockRendering.Types.ICON,e=n.getCorrectedSize(),this.height=e.height,this.width=e.width},t.utils.object.inherits(t.blockRendering.Icon,t.blockRendering.Measurable),t.blockRendering.JaggedEdge=function(e){t.blockRendering.JaggedEdge.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.JAGGED_EDGE,this.height=this.constants_.JAGGED_TEETH.height,this.width=this.constants_.JAGGED_TEETH.width},t.utils.object.inherits(t.blockRendering.JaggedEdge,t.blockRendering.Measurable),t.blockRendering.Field=function(e,n,r){t.blockRendering.Field.superClass_.constructor.call(this,e),this.field=n,this.isEditable=n.EDITABLE,this.flipRtl=n.getFlipRtl(),this.type|=t.blockRendering.Types.FIELD,e=this.field.getSize(),this.height=e.height,this.width=e.width,this.parentInput=r},t.utils.object.inherits(t.blockRendering.Field,t.blockRendering.Measurable),t.blockRendering.Hat=function(e){t.blockRendering.Hat.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.HAT,this.height=this.constants_.START_HAT.height,this.width=this.constants_.START_HAT.width,this.ascenderHeight=this.height},t.utils.object.inherits(t.blockRendering.Hat,t.blockRendering.Measurable),t.blockRendering.SquareCorner=function(e,n){t.blockRendering.SquareCorner.superClass_.constructor.call(this,e),this.type=(n&&"left"!=n?t.blockRendering.Types.RIGHT_SQUARE_CORNER:t.blockRendering.Types.LEFT_SQUARE_CORNER)|t.blockRendering.Types.CORNER,this.width=this.height=this.constants_.NO_PADDING},t.utils.object.inherits(t.blockRendering.SquareCorner,t.blockRendering.Measurable),t.blockRendering.RoundCorner=function(e,n){t.blockRendering.RoundCorner.superClass_.constructor.call(this,e),this.type=(n&&"left"!=n?t.blockRendering.Types.RIGHT_ROUND_CORNER:t.blockRendering.Types.LEFT_ROUND_CORNER)|t.blockRendering.Types.CORNER,this.width=this.constants_.CORNER_RADIUS,this.height=this.constants_.CORNER_RADIUS/2},t.utils.object.inherits(t.blockRendering.RoundCorner,t.blockRendering.Measurable),t.blockRendering.InRowSpacer=function(e,n){t.blockRendering.InRowSpacer.superClass_.constructor.call(this,e),this.type=this.type|t.blockRendering.Types.SPACER|t.blockRendering.Types.IN_ROW_SPACER,this.width=n,this.height=this.constants_.SPACER_DEFAULT_HEIGHT},t.utils.object.inherits(t.blockRendering.InRowSpacer,t.blockRendering.Measurable),t.blockRendering.Row=function(e){this.type=t.blockRendering.Types.ROW,this.elements=[],this.xPos=this.yPos=this.widthWithConnectedBlocks=this.minWidth=this.minHeight=this.width=this.height=0,this.hasJaggedEdge=this.hasDummyInput=this.hasInlineInput=this.hasStatement=this.hasExternalInput=!1,this.constants_=e,this.notchOffset=this.constants_.NOTCH_OFFSET_LEFT,this.align=null},t.blockRendering.Row.prototype.measure=function(){throw Error("Unexpected attempt to measure a base Row.")},t.blockRendering.Row.prototype.getLastInput=function(){for(var e,n=this.elements.length-1;e=this.elements[n];n--)if(t.blockRendering.Types.isInput(e))return e;return null},t.blockRendering.Row.prototype.startsWithElemSpacer=function(){return!0},t.blockRendering.Row.prototype.endsWithElemSpacer=function(){return!0},t.blockRendering.Row.prototype.getFirstSpacer=function(){for(var e,n=0;e=this.elements[n];n++)if(t.blockRendering.Types.isSpacer(e))return e;return null},t.blockRendering.Row.prototype.getLastSpacer=function(){for(var e,n=this.elements.length-1;e=this.elements[n];n--)if(t.blockRendering.Types.isSpacer(e))return e;return null},t.blockRendering.TopRow=function(e){t.blockRendering.TopRow.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.TOP_ROW,this.ascenderHeight=this.capline=0,this.hasPreviousConnection=!1,this.connection=null},t.utils.object.inherits(t.blockRendering.TopRow,t.blockRendering.Row),t.blockRendering.TopRow.prototype.hasLeftSquareCorner=function(t){var e=(t.hat?"cap"===t.hat:this.constants_.ADD_START_HATS)&&!t.outputConnection&&!t.previousConnection,n=t.getPreviousBlock();return!!t.outputConnection||e||!!n&&n.getNextBlock()==t},t.blockRendering.TopRow.prototype.hasRightSquareCorner=function(t){return!0},t.blockRendering.TopRow.prototype.measure=function(){for(var e,n=0,r=0,i=0,o=0;e=this.elements[o];o++)r+=e.width,t.blockRendering.Types.isSpacer(e)||(t.blockRendering.Types.isHat(e)?i=Math.max(i,e.ascenderHeight):n=Math.max(n,e.height));this.width=Math.max(this.minWidth,r),this.height=Math.max(this.minHeight,n)+i,this.capline=this.ascenderHeight=i,this.widthWithConnectedBlocks=this.width},t.blockRendering.TopRow.prototype.startsWithElemSpacer=function(){return!1},t.blockRendering.TopRow.prototype.endsWithElemSpacer=function(){return!1},t.blockRendering.BottomRow=function(e){t.blockRendering.BottomRow.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.BOTTOM_ROW,this.hasNextConnection=!1,this.connection=null,this.baseline=this.descenderHeight=0},t.utils.object.inherits(t.blockRendering.BottomRow,t.blockRendering.Row),t.blockRendering.BottomRow.prototype.hasLeftSquareCorner=function(t){return!!t.outputConnection||!!t.getNextBlock()},t.blockRendering.BottomRow.prototype.hasRightSquareCorner=function(t){return!0},t.blockRendering.BottomRow.prototype.measure=function(){for(var e,n=0,r=0,i=0,o=0;e=this.elements[o];o++)r+=e.width,t.blockRendering.Types.isSpacer(e)||(t.blockRendering.Types.isNextConnection(e)?i=Math.max(i,e.height):n=Math.max(n,e.height));this.width=Math.max(this.minWidth,r),this.height=Math.max(this.minHeight,n)+i,this.descenderHeight=i,this.widthWithConnectedBlocks=this.width},t.blockRendering.BottomRow.prototype.startsWithElemSpacer=function(){return!1},t.blockRendering.BottomRow.prototype.endsWithElemSpacer=function(){return!1},t.blockRendering.SpacerRow=function(e,n,r){t.blockRendering.SpacerRow.superClass_.constructor.call(this,e),this.type=this.type|t.blockRendering.Types.SPACER|t.blockRendering.Types.BETWEEN_ROW_SPACER,this.width=r,this.height=n,this.followsStatement=!1,this.widthWithConnectedBlocks=0,this.elements=[new t.blockRendering.InRowSpacer(this.constants_,r)]},t.utils.object.inherits(t.blockRendering.SpacerRow,t.blockRendering.Row),t.blockRendering.SpacerRow.prototype.measure=function(){},t.blockRendering.InputRow=function(e){t.blockRendering.InputRow.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.INPUT_ROW,this.connectedBlockWidths=0},t.utils.object.inherits(t.blockRendering.InputRow,t.blockRendering.Row),t.blockRendering.InputRow.prototype.measure=function(){this.width=this.minWidth,this.height=this.minHeight;for(var e,n=0,r=0;e=this.elements[r];r++)this.width+=e.width,t.blockRendering.Types.isInput(e)&&(t.blockRendering.Types.isStatementInput(e)?n+=e.connectedBlockWidth:t.blockRendering.Types.isExternalInput(e)&&0!=e.connectedBlockWidth&&(n+=e.connectedBlockWidth-e.connectionWidth)),t.blockRendering.Types.isSpacer(e)||(this.height=Math.max(this.height,e.height));this.connectedBlockWidths=n,this.widthWithConnectedBlocks=this.width+n},t.blockRendering.InputRow.prototype.endsWithElemSpacer=function(){return!this.hasExternalInput&&!this.hasStatement},t.blockRendering.RenderInfo=function(e,n){this.block_=n,this.renderer_=e,this.constants_=this.renderer_.getConstants(),this.outputConnection=n.outputConnection?new t.blockRendering.OutputConnection(this.constants_,n.outputConnection):null,this.isInline=n.getInputsInline()&&!n.isCollapsed(),this.isCollapsed=n.isCollapsed(),this.isInsertionMarker=n.isInsertionMarker(),this.RTL=n.RTL,this.statementEdge=this.width=this.widthWithChildren=this.height=0,this.rows=[],this.inputRows=[],this.hiddenIcons=[],this.topRow=new t.blockRendering.TopRow(this.constants_),this.bottomRow=new t.blockRendering.BottomRow(this.constants_),this.startY=this.startX=0},t.blockRendering.RenderInfo.prototype.getRenderer=function(){return this.renderer_},t.blockRendering.RenderInfo.prototype.measure=function(){this.createRows_(),this.addElemSpacing_(),this.addRowSpacing_(),this.computeBounds_(),this.alignRowElements_(),this.finalize_()},t.blockRendering.RenderInfo.prototype.createRows_=function(){this.populateTopRow_(),this.rows.push(this.topRow);var e=new t.blockRendering.InputRow(this.constants_);this.inputRows.push(e);for(var n,r=this.block_.getIcons(),i=0;n=r[i];i++){var o=new t.blockRendering.Icon(this.constants_,n);this.isCollapsed&&n.collapseHidden?this.hiddenIcons.push(o):e.elements.push(o)}for(n=null,i=0;r=this.block_.inputList[i];i++)if(r.isVisible()){for(this.shouldStartNewRow_(r,n)&&(this.rows.push(e),e=new t.blockRendering.InputRow(this.constants_),this.inputRows.push(e)),n=0;o=r.fieldRow[n];n++)e.elements.push(new t.blockRendering.Field(this.constants_,o,r));this.addInput_(r,e),n=r}this.isCollapsed&&(e.hasJaggedEdge=!0,e.elements.push(new t.blockRendering.JaggedEdge(this.constants_))),(e.elements.length||e.hasDummyInput)&&this.rows.push(e),this.populateBottomRow_(),this.rows.push(this.bottomRow)},t.blockRendering.RenderInfo.prototype.populateTopRow_=function(){var e=!!this.block_.previousConnection,n=(this.block_.hat?"cap"===this.block_.hat:this.constants_.ADD_START_HATS)&&!this.outputConnection&&!e,r=this.topRow.hasLeftSquareCorner(this.block_)?t.blockRendering.SquareCorner:t.blockRendering.RoundCorner;this.topRow.elements.push(new r(this.constants_)),n?(e=new t.blockRendering.Hat(this.constants_),this.topRow.elements.push(e),this.topRow.capline=e.ascenderHeight):e&&(this.topRow.hasPreviousConnection=!0,this.topRow.connection=new t.blockRendering.PreviousConnection(this.constants_,this.block_.previousConnection),this.topRow.elements.push(this.topRow.connection)),this.block_.inputList.length&&this.block_.inputList[0].type==t.inputTypes.STATEMENT&&!this.block_.isCollapsed()?this.topRow.minHeight=this.constants_.TOP_ROW_PRECEDES_STATEMENT_MIN_HEIGHT:this.topRow.minHeight=this.constants_.TOP_ROW_MIN_HEIGHT,r=this.topRow.hasRightSquareCorner(this.block_)?t.blockRendering.SquareCorner:t.blockRendering.RoundCorner,this.topRow.elements.push(new r(this.constants_,"right"))},t.blockRendering.RenderInfo.prototype.populateBottomRow_=function(){this.bottomRow.hasNextConnection=!!this.block_.nextConnection,this.bottomRow.minHeight=this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==t.inputTypes.STATEMENT?this.constants_.BOTTOM_ROW_AFTER_STATEMENT_MIN_HEIGHT:this.constants_.BOTTOM_ROW_MIN_HEIGHT,this.bottomRow.hasLeftSquareCorner(this.block_)?this.bottomRow.elements.push(new t.blockRendering.SquareCorner(this.constants_)):this.bottomRow.elements.push(new t.blockRendering.RoundCorner(this.constants_)),this.bottomRow.hasNextConnection&&(this.bottomRow.connection=new t.blockRendering.NextConnection(this.constants_,this.block_.nextConnection),this.bottomRow.elements.push(this.bottomRow.connection)),this.bottomRow.hasRightSquareCorner(this.block_)?this.bottomRow.elements.push(new t.blockRendering.SquareCorner(this.constants_,"right")):this.bottomRow.elements.push(new t.blockRendering.RoundCorner(this.constants_,"right"))},t.blockRendering.RenderInfo.prototype.addInput_=function(e,n){this.isInline&&e.type==t.inputTypes.VALUE?(n.elements.push(new t.blockRendering.InlineInput(this.constants_,e)),n.hasInlineInput=!0):e.type==t.inputTypes.STATEMENT?(n.elements.push(new t.blockRendering.StatementInput(this.constants_,e)),n.hasStatement=!0):e.type==t.inputTypes.VALUE?(n.elements.push(new t.blockRendering.ExternalValueInput(this.constants_,e)),n.hasExternalInput=!0):e.type==t.inputTypes.DUMMY&&(n.minHeight=Math.max(n.minHeight,e.getSourceBlock()&&e.getSourceBlock().isShadow()?this.constants_.DUMMY_INPUT_SHADOW_MIN_HEIGHT:this.constants_.DUMMY_INPUT_MIN_HEIGHT),n.hasDummyInput=!0),null==n.align&&(n.align=e.align)},t.blockRendering.RenderInfo.prototype.shouldStartNewRow_=function(e,n){return!!n&&(e.type==t.inputTypes.STATEMENT||n.type==t.inputTypes.STATEMENT||(e.type==t.inputTypes.VALUE||e.type==t.inputTypes.DUMMY)&&!this.isInline)},t.blockRendering.RenderInfo.prototype.addElemSpacing_=function(){for(var e,n=0;e=this.rows[n];n++){var r=e.elements;if(e.elements=[],e.startsWithElemSpacer()&&e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,r[0]))),r.length){for(var i=0;ie.height;o&&(n-=i),this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"rowSpacerRect blockRenderDebug",x:r?-(e.xPos+e.width):e.xPos,y:n,width:e.width,height:i,stroke:o?"black":"blue",fill:"blue","fill-opacity":"0.5","stroke-width":"1px"},this.svgRoot_))}},t.blockRendering.Debug.prototype.drawSpacerElem=function(e,n,r){if(t.blockRendering.Debug.config.elemSpacers){n=Math.abs(e.width);var i=0>e.width,o=i?e.xPos-n:e.xPos;r&&(o=-(o+n)),this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"elemSpacerRect blockRenderDebug",x:o,y:e.centerline-e.height/2,width:n,height:e.height,stroke:"pink",fill:i?"black":"pink","fill-opacity":"0.5","stroke-width":"1px"},this.svgRoot_))}},t.blockRendering.Debug.prototype.drawRenderedElem=function(e,n){if(t.blockRendering.Debug.config.elems){var r=e.xPos;n&&(r=-(r+e.width)),n=e.centerline-e.height/2,this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"rowRenderingRect blockRenderDebug",x:r,y:n,width:e.width,height:e.height,stroke:"black",fill:"none","stroke-width":"1px"},this.svgRoot_)),t.blockRendering.Types.isField(e)&&e.field instanceof t.FieldLabel&&this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"rowRenderingRect blockRenderDebug",x:r,y:n+this.constants_.FIELD_TEXT_BASELINE,width:e.width,height:"0.1px",stroke:"red",fill:"none","stroke-width":"0.5px"},this.svgRoot_))}t.blockRendering.Types.isInput(e)&&t.blockRendering.Debug.config.connections&&this.drawConnection(e.connectionModel)},t.blockRendering.Debug.prototype.drawConnection=function(e){if(t.blockRendering.Debug.config.connections){if(e.type==t.connectionTypes.INPUT_VALUE)var n=4,r="magenta",i="none";else e.type==t.connectionTypes.OUTPUT_VALUE?(n=2,i=r="magenta"):e.type==t.connectionTypes.NEXT_STATEMENT?(n=4,r="goldenrod",i="none"):e.type==t.connectionTypes.PREVIOUS_STATEMENT&&(n=2,i=r="goldenrod");this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.CIRCLE,{class:"blockRenderDebug",cx:e.offsetInBlock_.x,cy:e.offsetInBlock_.y,r:n,fill:i,stroke:r},this.svgRoot_))}},t.blockRendering.Debug.prototype.drawRenderedRow=function(e,n,r){t.blockRendering.Debug.config.rows&&(this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"elemRenderingRect blockRenderDebug",x:r?-(e.xPos+e.width):e.xPos,y:e.yPos,width:e.width,height:e.height,stroke:"red",fill:"none","stroke-width":"1px"},this.svgRoot_)),t.blockRendering.Types.isTopOrBottomRow(e)||t.blockRendering.Debug.config.connectedBlockBounds&&this.debugElements_.push(t.utils.dom.createSvgElement(t.utils.Svg.RECT,{class:"connectedBlockWidth blockRenderDebug",x:r?-(e.xPos+e.widthWithConnectedBlocks):e.xPos,y:e.yPos,width:e.widthWithConnectedBlocks,height:e.height,stroke:this.randomColour_,fill:"none","stroke-width":"1px","stroke-dasharray":"3,3"},this.svgRoot_)))},t.blockRendering.Debug.prototype.drawRowWithElements=function(e,n,r){for(var i=0,o=e.elements.length;i.blocklyPathLight,",e+" .blocklyInsertionMarker>.blocklyPathDark {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"])},t.geras.Highlighter=function(t){this.info_=t,this.inlineSteps_=this.steps_="",this.RTL_=this.info_.RTL,t=t.getRenderer(),this.constants_=t.getConstants(),this.highlightConstants_=t.getHighlightConstants(),this.highlightOffset_=this.highlightConstants_.OFFSET,this.outsideCornerPaths_=this.highlightConstants_.OUTSIDE_CORNER,this.insideCornerPaths_=this.highlightConstants_.INSIDE_CORNER,this.puzzleTabPaths_=this.highlightConstants_.PUZZLE_TAB,this.notchPaths_=this.highlightConstants_.NOTCH,this.startPaths_=this.highlightConstants_.START_HAT,this.jaggedTeethPaths_=this.highlightConstants_.JAGGED_TEETH},t.geras.Highlighter.prototype.getPath=function(){return this.steps_+"\n"+this.inlineSteps_},t.geras.Highlighter.prototype.drawTopCorner=function(e){this.steps_+=t.utils.svgPaths.moveBy(e.xPos,this.info_.startY);for(var n,r=0;n=e.elements[r];r++)t.blockRendering.Types.isLeftSquareCorner(n)?this.steps_+=this.highlightConstants_.START_POINT:t.blockRendering.Types.isLeftRoundedCorner(n)?this.steps_+=this.outsideCornerPaths_.topLeft(this.RTL_):t.blockRendering.Types.isPreviousConnection(n)?this.steps_+=this.notchPaths_.pathLeft:t.blockRendering.Types.isHat(n)?this.steps_+=this.startPaths_.path(this.RTL_):t.blockRendering.Types.isSpacer(n)&&0!=n.width&&(this.steps_+=t.utils.svgPaths.lineOnAxis("H",n.xPos+n.width-this.highlightOffset_));this.steps_+=t.utils.svgPaths.lineOnAxis("H",e.xPos+e.width-this.highlightOffset_)},t.geras.Highlighter.prototype.drawJaggedEdge_=function(e){this.info_.RTL&&(this.steps_+=this.jaggedTeethPaths_.pathLeft+t.utils.svgPaths.lineOnAxis("v",e.height-this.jaggedTeethPaths_.height-this.highlightOffset_))},t.geras.Highlighter.prototype.drawValueInput=function(e){var n=e.getLastInput();if(this.RTL_){var r=e.height-n.connectionHeight;this.steps_+=t.utils.svgPaths.moveTo(n.xPos+n.width-this.highlightOffset_,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)+t.utils.svgPaths.lineOnAxis("v",r)}else this.steps_+=t.utils.svgPaths.moveTo(n.xPos+n.width,e.yPos)+this.puzzleTabPaths_.pathDown(this.RTL_)},t.geras.Highlighter.prototype.drawStatementInput=function(e){var n=e.getLastInput();if(this.RTL_){var r=e.height-2*this.insideCornerPaths_.height;this.steps_+=t.utils.svgPaths.moveTo(n.xPos,e.yPos)+this.insideCornerPaths_.pathTop(this.RTL_)+t.utils.svgPaths.lineOnAxis("v",r)+this.insideCornerPaths_.pathBottom(this.RTL_)+t.utils.svgPaths.lineTo(e.width-n.xPos-this.insideCornerPaths_.width,0)}else this.steps_+=t.utils.svgPaths.moveTo(n.xPos,e.yPos+e.height)+this.insideCornerPaths_.pathBottom(this.RTL_)+t.utils.svgPaths.lineTo(e.width-n.xPos-this.insideCornerPaths_.width,0)},t.geras.Highlighter.prototype.drawRightSideRow=function(e){var n=e.xPos+e.width-this.highlightOffset_;e.followsStatement&&(this.steps_+=t.utils.svgPaths.lineOnAxis("H",n)),this.RTL_&&(this.steps_+=t.utils.svgPaths.lineOnAxis("H",n),e.height>this.highlightOffset_&&(this.steps_+=t.utils.svgPaths.lineOnAxis("V",e.yPos+e.height-this.highlightOffset_)))},t.geras.Highlighter.prototype.drawBottomRow=function(e){if(this.RTL_)this.steps_+=t.utils.svgPaths.lineOnAxis("V",e.baseline-this.highlightOffset_);else{var n=this.info_.bottomRow.elements[0];t.blockRendering.Types.isLeftSquareCorner(n)?this.steps_+=t.utils.svgPaths.moveTo(e.xPos+this.highlightOffset_,e.baseline-this.highlightOffset_):t.blockRendering.Types.isLeftRoundedCorner(n)&&(this.steps_+=t.utils.svgPaths.moveTo(e.xPos,e.baseline),this.steps_+=this.outsideCornerPaths_.bottomLeft())}},t.geras.Highlighter.prototype.drawLeft=function(){var e=this.info_.outputConnection;e&&(e=e.connectionOffsetY+e.height,this.RTL_?this.steps_+=t.utils.svgPaths.moveTo(this.info_.startX,e):(this.steps_+=t.utils.svgPaths.moveTo(this.info_.startX+this.highlightOffset_,this.info_.bottomRow.baseline-this.highlightOffset_),this.steps_+=t.utils.svgPaths.lineOnAxis("V",e)),this.steps_+=this.puzzleTabPaths_.pathUp(this.RTL_)),this.RTL_||(e=this.info_.topRow,t.blockRendering.Types.isLeftRoundedCorner(e.elements[0])?this.steps_+=t.utils.svgPaths.lineOnAxis("V",this.outsideCornerPaths_.height):this.steps_+=t.utils.svgPaths.lineOnAxis("V",e.capline+this.highlightOffset_))},t.geras.Highlighter.prototype.drawInlineInput=function(e){var n=this.highlightOffset_,r=e.xPos+e.connectionWidth,i=e.centerline-e.height/2,o=e.width-e.connectionWidth,s=i+n;this.RTL_?(i=e.connectionOffsetY-n,e=e.height-(e.connectionOffsetY+e.connectionHeight)+n,this.inlineSteps_+=t.utils.svgPaths.moveTo(r-n,s)+t.utils.svgPaths.lineOnAxis("v",i)+this.puzzleTabPaths_.pathDown(this.RTL_)+t.utils.svgPaths.lineOnAxis("v",e)+t.utils.svgPaths.lineOnAxis("h",o)):this.inlineSteps_+=t.utils.svgPaths.moveTo(e.xPos+e.width+n,s)+t.utils.svgPaths.lineOnAxis("v",e.height)+t.utils.svgPaths.lineOnAxis("h",-o)+t.utils.svgPaths.moveTo(r,i+e.connectionOffsetY)+this.puzzleTabPaths_.pathDown(this.RTL_)},t.geras.InlineInput=function(e,n){t.geras.InlineInput.superClass_.constructor.call(this,e,n),this.connectedBlock&&(this.width+=this.constants_.DARK_PATH_OFFSET,this.height+=this.constants_.DARK_PATH_OFFSET)},t.utils.object.inherits(t.geras.InlineInput,t.blockRendering.InlineInput),t.geras.StatementInput=function(e,n){t.geras.StatementInput.superClass_.constructor.call(this,e,n),this.connectedBlock&&(this.height+=this.constants_.DARK_PATH_OFFSET)},t.utils.object.inherits(t.geras.StatementInput,t.blockRendering.StatementInput),t.geras.RenderInfo=function(e,n){t.geras.RenderInfo.superClass_.constructor.call(this,e,n)},t.utils.object.inherits(t.geras.RenderInfo,t.blockRendering.RenderInfo),t.geras.RenderInfo.prototype.getRenderer=function(){return this.renderer_},t.geras.RenderInfo.prototype.populateBottomRow_=function(){t.geras.RenderInfo.superClass_.populateBottomRow_.call(this),this.block_.inputList.length&&this.block_.inputList[this.block_.inputList.length-1].type==t.inputTypes.STATEMENT||(this.bottomRow.minHeight=this.constants_.MEDIUM_PADDING-this.constants_.DARK_PATH_OFFSET)},t.geras.RenderInfo.prototype.addInput_=function(e,n){this.isInline&&e.type==t.inputTypes.VALUE?(n.elements.push(new t.geras.InlineInput(this.constants_,e)),n.hasInlineInput=!0):e.type==t.inputTypes.STATEMENT?(n.elements.push(new t.geras.StatementInput(this.constants_,e)),n.hasStatement=!0):e.type==t.inputTypes.VALUE?(n.elements.push(new t.blockRendering.ExternalValueInput(this.constants_,e)),n.hasExternalInput=!0):e.type==t.inputTypes.DUMMY&&(n.minHeight=Math.max(n.minHeight,this.constants_.DUMMY_INPUT_MIN_HEIGHT),n.hasDummyInput=!0),this.isInline||null!=n.align||(n.align=e.align)},t.geras.RenderInfo.prototype.addElemSpacing_=function(){for(var e,n=!1,r=0;e=this.rows[r];r++)e.hasExternalInput&&(n=!0);for(r=0;e=this.rows[r];r++){var i=e.elements;if(e.elements=[],e.startsWithElemSpacer()&&e.elements.push(new t.blockRendering.InRowSpacer(this.constants_,this.getInRowSpacing_(null,i[0]))),i.length){for(var o=0;on?n:o,i=i?-1:1,e=(r?-1:1)*e/2,t.utils.svgPaths.lineTo(-i*o,e)+t.utils.svgPaths.lineTo(i*o,e)}var n=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH;return{type:this.SHAPES.HEXAGONAL,isDynamic:!0,width:function(t){return(t/=2)>n?n:t},height:function(t){return t},connectionOffsetY:function(t){return t/2},connectionOffsetX:function(t){return-t},pathDown:function(t){return e(t,!1,!1)},pathUp:function(t){return e(t,!0,!1)},pathRightDown:function(t){return e(t,!1,!0)},pathRightUp:function(t){return e(t,!1,!0)}}},t.zelos.ConstantProvider.prototype.makeRounded=function(){function e(e,n,i){var o=e>r?e-r:0;return e=(e>r?r:e)/2,t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point((n?-1:1)*e,(n?-1:1)*e))+t.utils.svgPaths.lineOnAxis("v",(i?1:-1)*o)+t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point((n?1:-1)*e,(n?-1:1)*e))}var n=this.MAX_DYNAMIC_CONNECTION_SHAPE_WIDTH,r=2*n;return{type:this.SHAPES.ROUND,isDynamic:!0,width:function(t){return(t/=2)>n?n:t},height:function(t){return t},connectionOffsetY:function(t){return t/2},connectionOffsetX:function(t){return-t},pathDown:function(t){return e(t,!1,!1)},pathUp:function(t){return e(t,!0,!1)},pathRightDown:function(t){return e(t,!1,!0)},pathRightUp:function(t){return e(t,!1,!0)}}},t.zelos.ConstantProvider.prototype.makeSquared=function(){function e(e,r,i){return e-=2*n,t.utils.svgPaths.arc("a","0 0,1",n,t.utils.svgPaths.point((r?-1:1)*n,(r?-1:1)*n))+t.utils.svgPaths.lineOnAxis("v",(i?1:-1)*e)+t.utils.svgPaths.arc("a","0 0,1",n,t.utils.svgPaths.point((r?1:-1)*n,(r?-1:1)*n))}var n=this.CORNER_RADIUS;return{type:this.SHAPES.SQUARE,isDynamic:!0,width:function(t){return n},height:function(t){return t},connectionOffsetY:function(t){return t/2},connectionOffsetX:function(t){return-t},pathDown:function(t){return e(t,!1,!1)},pathUp:function(t){return e(t,!0,!1)},pathRightDown:function(t){return e(t,!1,!0)},pathRightUp:function(t){return e(t,!1,!0)}}},t.zelos.ConstantProvider.prototype.shapeFor=function(e){var n=e.getCheck();switch(!n&&e.targetConnection&&(n=e.targetConnection.getCheck()),e.type){case t.connectionTypes.INPUT_VALUE:case t.connectionTypes.OUTPUT_VALUE:if(null!=(e=e.getSourceBlock().getOutputShape()))switch(e){case this.SHAPES.HEXAGONAL:return this.HEXAGONAL;case this.SHAPES.ROUND:return this.ROUNDED;case this.SHAPES.SQUARE:return this.SQUARED}return n&&-1!=n.indexOf("Boolean")?this.HEXAGONAL:n&&-1!=n.indexOf("Number")?this.ROUNDED:(n&&n.indexOf("String"),this.ROUNDED);case t.connectionTypes.PREVIOUS_STATEMENT:case t.connectionTypes.NEXT_STATEMENT:return this.NOTCH;default:throw Error("Unknown type")}},t.zelos.ConstantProvider.prototype.makeNotch=function(){function e(e){return t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(e*o/2,0),t.utils.svgPaths.point(e*o*3/4,a/2),t.utils.svgPaths.point(e*o,a)])+t.utils.svgPaths.line([t.utils.svgPaths.point(e*o,s)])+t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(e*o/4,a/2),t.utils.svgPaths.point(e*o/2,a),t.utils.svgPaths.point(e*o,a)])+t.utils.svgPaths.lineOnAxis("h",e*i)+t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(e*o/2,0),t.utils.svgPaths.point(e*o*3/4,-a/2),t.utils.svgPaths.point(e*o,-a)])+t.utils.svgPaths.line([t.utils.svgPaths.point(e*o,-s)])+t.utils.svgPaths.curve("c",[t.utils.svgPaths.point(e*o/4,-a/2),t.utils.svgPaths.point(e*o/2,-a),t.utils.svgPaths.point(e*o,-a)])}var n=this.NOTCH_WIDTH,r=this.NOTCH_HEIGHT,i=n/3,o=i/3,s=r/2,a=s/2,l=e(1),u=e(-1);return{type:this.SHAPES.NOTCH,width:n,height:r,pathLeft:l,pathRight:u}},t.zelos.ConstantProvider.prototype.makeInsideCorners=function(){var e=this.CORNER_RADIUS,n=t.utils.svgPaths.arc("a","0 0,0",e,t.utils.svgPaths.point(-e,e)),r=t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point(-e,e));return{width:e,height:e,pathTop:n,pathBottom:t.utils.svgPaths.arc("a","0 0,0",e,t.utils.svgPaths.point(e,e)),rightWidth:e,rightHeight:e,pathTopRight:r,pathBottomRight:t.utils.svgPaths.arc("a","0 0,1",e,t.utils.svgPaths.point(e,e))}},t.zelos.ConstantProvider.prototype.generateSecondaryColour_=function(e){return t.utils.colour.blend("#000",e,.15)||e},t.zelos.ConstantProvider.prototype.generateTertiaryColour_=function(e){return t.utils.colour.blend("#000",e,.25)||e},t.zelos.ConstantProvider.prototype.createDom=function(e,n,r){t.zelos.ConstantProvider.superClass_.createDom.call(this,e,n,r),e=t.utils.dom.createSvgElement(t.utils.Svg.DEFS,{},e),n=t.utils.dom.createSvgElement(t.utils.Svg.FILTER,{id:"blocklySelectedGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),t.utils.dom.createSvgElement(t.utils.Svg.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.SELECTED_GLOW_SIZE},n),r=t.utils.dom.createSvgElement(t.utils.Svg.FECOMPONENTTRANSFER,{result:"outBlur"},n),t.utils.dom.createSvgElement(t.utils.Svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},r),t.utils.dom.createSvgElement(t.utils.Svg.FEFLOOD,{"flood-color":this.SELECTED_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},n),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},n),this.selectedGlowFilterId=n.id,this.selectedGlowFilter_=n,e=t.utils.dom.createSvgElement(t.utils.Svg.FILTER,{id:"blocklyReplacementGlowFilter"+this.randomIdentifier,height:"160%",width:"180%",y:"-30%",x:"-40%"},e),t.utils.dom.createSvgElement(t.utils.Svg.FEGAUSSIANBLUR,{in:"SourceGraphic",stdDeviation:this.REPLACEMENT_GLOW_SIZE},e),n=t.utils.dom.createSvgElement(t.utils.Svg.FECOMPONENTTRANSFER,{result:"outBlur"},e),t.utils.dom.createSvgElement(t.utils.Svg.FEFUNCA,{type:"table",tableValues:"0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1"},n),t.utils.dom.createSvgElement(t.utils.Svg.FEFLOOD,{"flood-color":this.REPLACEMENT_GLOW_COLOUR,"flood-opacity":1,result:"outColor"},e),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"outColor",in2:"outBlur",operator:"in",result:"outGlow"},e),t.utils.dom.createSvgElement(t.utils.Svg.FECOMPOSITE,{in:"SourceGraphic",in2:"outGlow",operator:"over"},e),this.replacementGlowFilterId=e.id,this.replacementGlowFilter_=e},t.zelos.ConstantProvider.prototype.getCSS_=function(t){return[t+" .blocklyText,",t+" .blocklyFlyoutLabelText {","font: "+this.FIELD_TEXT_FONTWEIGHT+" "+this.FIELD_TEXT_FONTSIZE+"pt "+this.FIELD_TEXT_FONTFAMILY+";","}",t+" .blocklyText {","fill: #fff;","}",t+" .blocklyNonEditableText>rect:not(.blocklyDropdownRect),",t+" .blocklyEditableText>rect:not(.blocklyDropdownRect) {","fill: "+this.FIELD_BORDER_RECT_COLOUR+";","}",t+" .blocklyNonEditableText>text,",t+" .blocklyEditableText>text,",t+" .blocklyNonEditableText>g>text,",t+" .blocklyEditableText>g>text {","fill: #575E75;","}",t+" .blocklyFlyoutLabelText {","fill: #575E75;","}",t+" .blocklyText.blocklyBubbleText {","fill: #575E75;","}",t+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>rect,",t+" .blocklyDraggable:not(.blocklyDisabled)"," .blocklyEditableText:not(.editing):hover>.blocklyPath {","stroke: #fff;","stroke-width: 2;","}",t+" .blocklyHtmlInput {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","font-weight: "+this.FIELD_TEXT_FONTWEIGHT+";","color: #575E75;","}",t+" .blocklyDropdownText {","fill: #fff !important;","}",t+".blocklyWidgetDiv .goog-menuitem,",t+".blocklyDropDownDiv .goog-menuitem {","font-family: "+this.FIELD_TEXT_FONTFAMILY+";","}",t+".blocklyDropDownDiv .goog-menuitem-content {","color: #fff;","}",t+" .blocklyHighlightedConnectionPath {","stroke: "+this.SELECTED_GLOW_COLOUR+";","}",t+" .blocklyDisabled > .blocklyOutlinePath {","fill: url(#blocklyDisabledPattern"+this.randomIdentifier+")","}",t+" .blocklyInsertionMarker>.blocklyPath {","fill-opacity: "+this.INSERTION_MARKER_OPACITY+";","stroke: none;","}"]},t.zelos.TopRow=function(e){t.zelos.TopRow.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.zelos.TopRow,t.blockRendering.TopRow),t.zelos.TopRow.prototype.endsWithElemSpacer=function(){return!1},t.zelos.TopRow.prototype.hasLeftSquareCorner=function(t){var e=(t.hat?"cap"===t.hat:this.constants_.ADD_START_HATS)&&!t.outputConnection&&!t.previousConnection;return!!t.outputConnection||e},t.zelos.TopRow.prototype.hasRightSquareCorner=function(t){return!!t.outputConnection&&!t.statementInputCount&&!t.nextConnection},t.zelos.BottomRow=function(e){t.zelos.BottomRow.superClass_.constructor.call(this,e)},t.utils.object.inherits(t.zelos.BottomRow,t.blockRendering.BottomRow),t.zelos.BottomRow.prototype.endsWithElemSpacer=function(){return!1},t.zelos.BottomRow.prototype.hasLeftSquareCorner=function(t){return!!t.outputConnection},t.zelos.BottomRow.prototype.hasRightSquareCorner=function(t){return!!t.outputConnection&&!t.statementInputCount&&!t.nextConnection},t.zelos.RightConnectionShape=function(e){t.zelos.RightConnectionShape.superClass_.constructor.call(this,e),this.type|=t.blockRendering.Types.getType("RIGHT_CONNECTION"),this.width=this.height=0},t.utils.object.inherits(t.zelos.RightConnectionShape,t.blockRendering.Measurable),t.zelos.RenderInfo=function(e,n){t.zelos.RenderInfo.superClass_.constructor.call(this,e,n),this.topRow=new t.zelos.TopRow(this.constants_),this.bottomRow=new t.zelos.BottomRow(this.constants_),this.isInline=!0,this.isMultiRow=!n.getInputsInline()||n.isCollapsed(),this.hasStatementInput=0=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!s.precedesStatement,t.blockRendering.Types.isInputRow(o)&&o.hasStatement)o.measure(),n=o.width-o.getLastInput().width+e;else if(i&&(2==r||s)&&t.blockRendering.Types.isInputRow(o)&&!o.hasStatement){s=o.xPos,i=null;for(var a,l=0;a=o.elements[l];l++)t.blockRendering.Types.isSpacer(a)&&(i=a),!(i&&(t.blockRendering.Types.isField(a)||t.blockRendering.Types.isInput(a))&&sr?r:this.height/2)*(1-Math.sin(Math.acos((r-this.constants_.SMALL_PADDING)/r)));default:return 0}if(t.blockRendering.Types.isInlineInput(e)){var o=e.connectedBlock;return e=o?o.pathObject.outputShapeType:e.shape.type,o&&o.outputConnection&&(o.statementInputCount||o.nextConnection)||r==i.SHAPES.HEXAGONAL&&r!=e?0:n-this.constants_.SHAPE_IN_SHAPE_PADDING[r][e]}return t.blockRendering.Types.isField(e)?r==i.SHAPES.ROUND&&e.field instanceof t.FieldTextInput?n-2.75*i.GRID_UNIT:n-this.constants_.SHAPE_IN_SHAPE_PADDING[r][0]:t.blockRendering.Types.isIcon(e)?this.constants_.SMALL_PADDING:0},t.zelos.RenderInfo.prototype.finalizeVerticalAlignment_=function(){if(!this.outputConnection)for(var e=2;e=this.rows.length-1?!!this.bottomRow.hasNextConnection:!!i.precedesStatement;if(o?this.topRow.hasPreviousConnection:n.followsStatement){var a=3==r.elements.length&&(r.elements[1].field instanceof t.FieldLabel||r.elements[1].field instanceof t.FieldImage);if(!o&&a)n.height-=this.constants_.SMALL_PADDING,i.height-=this.constants_.SMALL_PADDING,r.height-=this.constants_.MEDIUM_PADDING;else if(o||s){if(s){for(o=!1,s=0;a=r.elements[s];s++)if(t.blockRendering.Types.isInlineInput(a)&&a.connectedBlock&&!a.connectedBlock.isShadow()&&40<=a.connectedBlock.getHeightWidth().height){o=!0;break}o&&(n.height-=this.constants_.SMALL_PADDING,i.height-=this.constants_.SMALL_PADDING)}}else n.height+=this.constants_.SMALL_PADDING}}},t.zelos.RenderInfo.prototype.finalize_=function(){this.finalizeOutputConnection_(),this.finalizeHorizontalAlignment_(),this.finalizeVerticalAlignment_(),t.zelos.RenderInfo.superClass_.finalize_.call(this),this.rightSide&&(this.widthWithChildren+=this.rightSide.width)},t.zelos.Drawer=function(e,n){t.zelos.Drawer.superClass_.constructor.call(this,e,n)},t.utils.object.inherits(t.zelos.Drawer,t.blockRendering.Drawer),t.zelos.Drawer.prototype.draw=function(){var e=this.block_.pathObject;e.beginDrawing(),this.hideHiddenIcons_(),this.drawOutline_(),this.drawInternals_(),e.setPath(this.outlinePath_+"\n"+this.inlinePath_),this.info_.RTL&&e.flipRTL(),t.blockRendering.useDebugger&&this.block_.renderingDebugger.drawDebug(this.block_,this.info_),this.recordSizeOnBlock_(),this.info_.outputConnection&&(e.outputShapeType=this.info_.outputConnection.shape.type),e.endDrawing()},t.zelos.Drawer.prototype.drawOutline_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape&&!this.info_.hasStatementInput&&!this.info_.bottomRow.hasNextConnection?(this.drawFlatTop_(),this.drawRightDynamicConnection_(),this.drawFlatBottom_(),this.drawLeftDynamicConnection_()):t.zelos.Drawer.superClass_.drawOutline_.call(this)},t.zelos.Drawer.prototype.drawLeft_=function(){this.info_.outputConnection&&this.info_.outputConnection.isDynamicShape?this.drawLeftDynamicConnection_():t.zelos.Drawer.superClass_.drawLeft_.call(this)},t.zelos.Drawer.prototype.drawRightSideRow_=function(e){if(!(0>=e.height))if(e.precedesStatement||e.followsStatement){var n=this.constants_.INSIDE_CORNERS.rightHeight;n=e.height-(e.precedesStatement?n:0),this.outlinePath_+=(e.followsStatement?this.constants_.INSIDE_CORNERS.pathBottomRight:"")+(0t.name):Object.keys(t);for(let o=0;o{const e=await l.bytes(),n=e.reduce((t,e)=>t+e.length,0)+a*e.length,r=new Uint8Array(n);let i=0;for(let t=0;t{if(e+=t.byteLength,n.push(t.byteLength===t.buffer.byteLength?t:new t.constructor(t)),!(t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array))throw new Error(`Unsupported TypedArray subtype: ${t.constructor.name}`)});const r=new Uint8Array(e);let i=0;return n.forEach(t=>{r.set(new Uint8Array(t.buffer),i),i+=t.byteLength}),r.buffer}(await Promise.all(r)),specs:n}},e.e=function(t,e){const n={};let l,u=0;for(const h of e){const e=h.name,d=h.dtype,p=h.shape,f=Object(o.sizeFromShape)(p);let g;if("quantization"in h){const n=h.quantization;if("uint8"===n.dtype||"uint16"===n.dtype){if(!("min"in n&&"scale"in n))throw new Error(`Weight ${h.name} with quantization ${n.dtype} `+"doesn't have corresponding metadata min and scale.")}else{if("float16"!==n.dtype)throw new Error(`Weight ${h.name} has unknown `+`quantization dtype ${n.dtype}. `+"Supported quantization dtypes are: 'uint8', 'uint16', and 'float16'.");if("float32"!==d)throw new Error(`Weight ${h.name} is quantized with ${n.dtype} `+`which only supports weights of type float32 not ${d}.`)}const r=s.a[n.dtype],i=t.slice(u,u+f*r),o="uint8"===n.dtype?new Uint8Array(i):new Uint16Array(i);if("float32"===d)if("uint8"===n.dtype||"uint16"===n.dtype){g=new Float32Array(o.length);for(let t=0;t{e+=t.byteLength});const n=new Uint8Array(e);let r=0;return t.forEach(t=>{n.set(new Uint8Array(t),r),r+=t.byteLength}),n.buffer},e.c=function(t){t=t.trim();for(;t.endsWith("/");)t=t.slice(0,t.length-1);const e=t.split("/");return e[e.length-1]},e.i=function(t,e){const n={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:e};null!=t.signature&&(n.signature=t.signature);null!=t.userDefinedMetadata&&(n.userDefinedMetadata=t.userDefinedMetadata);null!=t.modelInitializer&&(n.modelInitializer=t.modelInitializer);null!=t.trainingConfig&&(n.trainingConfig=t.trainingConfig);return n},e.g=async function(t,e){const n={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy};null!=t.trainingConfig&&(n.trainingConfig=t.trainingConfig);if(null!=t.weightsManifest){const[r,i]=await e(t.weightsManifest);n.weightSpecs=r,n.weightData=i}null!=t.signature&&(n.signature=t.signature);null!=t.userDefinedMetadata&&(n.userDefinedMetadata=t.userDefinedMetadata);null!=t.modelInitializer&&(n.modelInitializer=t.modelInitializer);return n},e.h=function(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("Expected JSON model topology, received ArrayBuffer.");return{dateSaved:new Date,modelTopologyType:"JSON",modelTopologyBytes:null==t.modelTopology?0:u(JSON.stringify(t.modelTopology)),weightSpecsBytes:null==t.weightSpecs?0:u(JSON.stringify(t.weightSpecs)),weightDataBytes:null==t.weightData?0:t.weightData.byteLength}};var r=n("rQ0i"),i=n("gHp0"),o=n("XFvI"),s=n("T3Fu"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ const a=4;const l=void 0!==t&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function u(e){return l?t.byteLength(e):new Blob([e]).size}function c(){const t=function(){const t=t=>{let e=t<<13,n=0;for(;0==(8388608&e);)n-=8388608,e<<=1;return(e&=-8388609)|(n+=947912704)},e=new Uint32Array(2048);e[0]=0;for(let n=1;n<1024;n++)e[n]=t(n);for(let t=1024;t<2048;t++)e[t]=939524096+(t-1024<<13);return e}(),e=function(){const t=new Uint32Array(64);t[0]=0,t[31]=1199570944,t[32]=2147483648,t[63]=3347054592;for(let e=1;e<31;e++)t[e]=e<<23;for(let e=33;e<63;e++)t[e]=2147483648+(e-32<<23);return t}(),n=function(){const t=new Uint32Array(64);for(let e=0;e<64;e++)t[e]=1024;return t[0]=t[32]=0,t}();return r=>{const i=new ArrayBuffer(4*r.length),o=new Uint32Array(i);for(let i=0;i>10]+(1023&s)]+e[s>>10];o[i]=a}return new Float32Array(i)}}}).call(e,n("EuP9").Buffer)},GHBc:function(t,e,n){"use strict";var r=n("cGG2");t.exports=r.isStandardBrowserEnv()?function(){var t,e=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(t){var r=t;return e&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(e){var n=r.isString(e)?i(e):e;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0}},GegP:function(t,e){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=117)}({0:function(t,e,n){"use strict";function r(t,e,n,r,i,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):i&&(l=a?function(){i.call(this,this.$root.$options.shadowRoot)}:i),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return r})},117:function(t,e,n){"use strict";n.r(e);var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"el-progress",class:["el-progress--"+t.type,t.status?"is-"+t.status:"",{"el-progress--without-text":!t.showText,"el-progress--text-inside":t.textInside}],attrs:{role:"progressbar","aria-valuenow":t.percentage,"aria-valuemin":"0","aria-valuemax":"100"}},["line"===t.type?n("div",{staticClass:"el-progress-bar"},[n("div",{staticClass:"el-progress-bar__outer",style:{height:t.strokeWidth+"px"}},[n("div",{staticClass:"el-progress-bar__inner",style:t.barStyle},[t.showText&&t.textInside?n("div",{staticClass:"el-progress-bar__innerText"},[t._v(t._s(t.content))]):t._e()])])]):n("div",{staticClass:"el-progress-circle",style:{height:t.width+"px",width:t.width+"px"}},[n("svg",{attrs:{viewBox:"0 0 100 100"}},[n("path",{staticClass:"el-progress-circle__track",style:t.trailPathStyle,attrs:{d:t.trackPath,stroke:"#e5e9f2","stroke-width":t.relativeStrokeWidth,fill:"none"}}),n("path",{staticClass:"el-progress-circle__path",style:t.circlePathStyle,attrs:{d:t.trackPath,stroke:t.stroke,fill:"none","stroke-linecap":t.strokeLinecap,"stroke-width":t.percentage?t.relativeStrokeWidth:0}})])]),t.showText&&!t.textInside?n("div",{staticClass:"el-progress__text",style:{fontSize:t.progressTextSize+"px"}},[t.status?n("i",{class:t.iconClass}):[t._v(t._s(t.content))]],2):t._e()])};r._withStripped=!0;var i={name:"ElProgress",props:{type:{type:String,default:"line",validator:function(t){return["line","circle","dashboard"].indexOf(t)>-1}},percentage:{type:Number,default:0,required:!0,validator:function(t){return t>=0&&t<=100}},status:{type:String,validator:function(t){return["success","exception","warning"].indexOf(t)>-1}},strokeWidth:{type:Number,default:6},strokeLinecap:{type:String,default:"round"},textInside:{type:Boolean,default:!1},width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:[String,Array,Function],default:""},format:Function},computed:{barStyle:function(){var t={};return t.width=this.percentage+"%",t.backgroundColor=this.getCurrentColor(this.percentage),t},relativeStrokeWidth:function(){return(this.strokeWidth/this.width*100).toFixed(1)},radius:function(){return"circle"===this.type||"dashboard"===this.type?parseInt(50-parseFloat(this.relativeStrokeWidth)/2,10):0},trackPath:function(){var t=this.radius,e="dashboard"===this.type;return"\n M 50 50\n m 0 "+(e?"":"-")+t+"\n a "+t+" "+t+" 0 1 1 0 "+(e?"-":"")+2*t+"\n a "+t+" "+t+" 0 1 1 0 "+(e?"":"-")+2*t+"\n "},perimeter:function(){return 2*Math.PI*this.radius},rate:function(){return"dashboard"===this.type?.75:1},strokeDashoffset:function(){return-1*this.perimeter*(1-this.rate)/2+"px"},trailPathStyle:function(){return{strokeDasharray:this.perimeter*this.rate+"px, "+this.perimeter+"px",strokeDashoffset:this.strokeDashoffset}},circlePathStyle:function(){return{strokeDasharray:this.perimeter*this.rate*(this.percentage/100)+"px, "+this.perimeter+"px",strokeDashoffset:this.strokeDashoffset,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease"}},stroke:function(){var t=void 0;if(this.color)t=this.getCurrentColor(this.percentage);else switch(this.status){case"success":t="#13ce66";break;case"exception":t="#ff4949";break;case"warning":t="#e6a23c";break;default:t="#20a0ff"}return t},iconClass:function(){return"warning"===this.status?"el-icon-warning":"line"===this.type?"success"===this.status?"el-icon-circle-check":"el-icon-circle-close":"success"===this.status?"el-icon-check":"el-icon-close"},progressTextSize:function(){return"line"===this.type?12+.4*this.strokeWidth:.111111*this.width+2},content:function(){return"function"==typeof this.format?this.format(this.percentage)||"":this.percentage+"%"}},methods:{getCurrentColor:function(t){return"function"==typeof this.color?this.color(t):"string"==typeof this.color?this.color:this.getLevelColor(t)},getLevelColor:function(t){for(var e=this.getColorArray().sort(function(t,e){return t.percentage-e.percentage}),n=0;nt)return e[n].color;return e[e.length-1].color},getColorArray:function(){var t=this.color,e=100/t.length;return t.map(function(t,n){return"string"==typeof t?{color:t,percentage:(n+1)*e}:t})}}},o=n(0),s=Object(o.a)(i,r,[],!1,null,null,null);s.options.__file="packages/progress/src/progress.vue";var a=s.exports;a.install=function(t){t.component(a.name,a)};e.default=a}})},GtxA:function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("35G1");const a=Object(s.a)({reshape_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e){const n={x:Object(o.a)(t,"x","reshape","string_or_numeric")},s={shape:e};return r.a.runKernel(i._63,n,s)}});e.a=a},"H/Ud":function(t,e,n){var r=n("VOQS"),i=n("di0+"),o=n("i+52"),s=n("fzqA"),a=n("9g4f"),l=n("4dK1"),u=n("p//t");u.alea=r,u.xor128=i,u.xorwow=o,u.xorshift7=s,u.xor4096=a,u.tychei=l,t.exports=u},H8dH:function(t,e,n){"use strict";e.__esModule=!0,e.default=function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:300,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!t||!e)throw new Error("instance & callback is required");var i=!1,o=function(){i||(i=!0,e&&e.apply(null,arguments))};r?t.$once("after-leave",o):t.$on("after-leave",o),setTimeout(function(){o()},n+100)}},H9Ud:function(t,e,n){"use strict";var r={};n.d(r,"isTensor",function(){return u}),n.d(r,"isTensor1D",function(){return c}),n.d(r,"isTensor2D",function(){return h}),n.d(r,"isTensor3D",function(){return d}),n.d(r,"isTensor4D",function(){return p}),n.d(r,"isFloat",function(){return f}),n.d(r,"isEven",function(){return g}),n.d(r,"round",function(){return m}),n.d(r,"isDimensions",function(){return v}),n.d(r,"computeReshapedDimensions",function(){return b}),n.d(r,"getCenterPoint",function(){return _}),n.d(r,"range",function(){return y}),n.d(r,"isValidNumber",function(){return T}),n.d(r,"isValidProbablitiy",function(){return E});var i={};n.d(i,"drawContour",function(){return s}),n.d(i,"drawDetections",function(){return lt}),n.d(i,"drawFaceExpressions",function(){return te}),n.d(i,"DrawBoxOptions",function(){return st}),n.d(i,"DrawBox",function(){return at}),n.d(i,"DrawFaceLandmarksOptions",function(){return re}),n.d(i,"DrawFaceLandmarks",function(){return ie}),n.d(i,"drawFaceLandmarks",function(){return oe}),n.d(i,"AnchorPosition",function(){return tt}),n.d(i,"DrawTextFieldOptions",function(){return it}),n.d(i,"DrawTextField",function(){return ot});var o=n("pSAl");function s(t,e,n){if(void 0===n&&(n=!1),t.beginPath(),e.slice(1).forEach(function(n,r){var i=n.x,o=n.y,s=e[r];t.moveTo(s.x,s.y),t.lineTo(i,o)}),n){var r=e[e.length-1],i=e[0];if(!r||!i)return;t.moveTo(r.x,r.y),t.lineTo(i.x,i.y)}t.stroke()}var a=n("TToO"),l=function(){function t(t,e){if(!T(t)||!T(e))throw new Error("Dimensions.constructor - expected width and height to be valid numbers, instead have "+JSON.stringify({width:t,height:e}));this._width=t,this._height=e}return Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),t.prototype.reverse=function(){return new t(1/this.width,1/this.height)},t}();function u(t,e){return t instanceof o.a&&t.shape.length===e}function c(t){return u(t,1)}function h(t){return u(t,2)}function d(t){return u(t,3)}function p(t){return u(t,4)}function f(t){return t%1!=0}function g(t){return t%2==0}function m(t,e){void 0===e&&(e=2);var n=Math.pow(10,e);return Math.floor(t*n)/n}function v(t){return t&&t.width&&t.height}function b(t,e){var n=t.width,r=t.height,i=e/Math.max(r,n);return new l(Math.round(n*i),Math.round(r*i))}function _(t){return t.reduce(function(t,e){return t.add(e)},new x(0,0)).div(new x(t.length,t.length))}function y(t,e,n){return Array(t).fill(0).map(function(t,r){return e+r*n})}function T(t){return!!t&&t!==1/0&&t!==-1/0&&!isNaN(t)||0===t}function E(t){return T(t)&&0<=t&&t<=1}var x=function(){function t(t,e){this._x=t,this._y=e}return Object.defineProperty(t.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),t.prototype.add=function(e){return new t(this.x+e.x,this.y+e.y)},t.prototype.sub=function(e){return new t(this.x-e.x,this.y-e.y)},t.prototype.mul=function(e){return new t(this.x*e.x,this.y*e.y)},t.prototype.div=function(e){return new t(this.x/e.x,this.y/e.y)},t.prototype.abs=function(){return new t(Math.abs(this.x),Math.abs(this.y))},t.prototype.magnitude=function(){return Math.sqrt(Math.pow(this.x,2)+Math.pow(this.y,2))},t.prototype.floor=function(){return new t(Math.floor(this.x),Math.floor(this.y))},t}(),w=function(){function t(e,n){void 0===n&&(n=!0);var r=e||{},i=[r.left,r.top,r.right,r.bottom].every(T),o=[r.x,r.y,r.width,r.height].every(T);if(!o&&!i)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(r));var s=o?[r.x,r.y,r.width,r.height]:[r.left,r.top,r.right-r.left,r.bottom-r.top],a=s[0],l=s[1],u=s[2],c=s[3];t.assertIsValidBox({x:a,y:l,width:u,height:c},"Box.constructor",n),this._x=a,this._y=l,this._width=u,this._height=c}return t.isRect=function(t){return!!t&&[t.x,t.y,t.width,t.height].every(T)},t.assertIsValidBox=function(e,n,r){if(void 0===r&&(r=!1),!t.isRect(e))throw new Error(n+" - invalid box: "+JSON.stringify(e)+", expected object with properties x, y, width, height");if(!r&&(e.width<0||e.height<0))throw new Error(n+" - width ("+e.width+") and height ("+e.height+") must be positive numbers")},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this.x},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this.y},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topLeft",{get:function(){return new x(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topRight",{get:function(){return new x(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomLeft",{get:function(){return new x(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomRight",{get:function(){return new x(this.right,this.bottom)},enumerable:!0,configurable:!0}),t.prototype.round=function(){var e=[this.x,this.y,this.width,this.height].map(function(t){return Math.round(t)});return new t({x:e[0],y:e[1],width:e[2],height:e[3]})},t.prototype.floor=function(){var e=[this.x,this.y,this.width,this.height].map(function(t){return Math.floor(t)});return new t({x:e[0],y:e[1],width:e[2],height:e[3]})},t.prototype.toSquare=function(){var e=this.x,n=this.y,r=this.width,i=this.height,o=Math.abs(r-i);return re&&(i=-l+e+n,l=e),u>t&&(o=-u+t+r,u=t),s<1&&(o=2-s,s=1),a<1&&(o=2-a,a=1),{dy:1,edy:o,dx:1,edx:i,y:a,ey:u,x:s,ex:l,w:n,h:r}},t.prototype.calibrate=function(e){return new t({left:this.left+e.left*this.width,top:this.top+e.top*this.height,right:this.right+e.right*this.width,bottom:this.bottom+e.bottom*this.height}).toSquare().round()},t}(),C=function(t){function e(e,n,r,i,o){return void 0===o&&(o=!1),t.call(this,{left:e,top:n,right:r,bottom:i},o)||this}return Object(a.c)(e,t),e}(w),S=function(){function t(t,e,n,r,i){this._imageDims=new l(i.width,i.height),this._score=t,this._classScore=e,this._className=n,this._box=new w(r).rescale(this._imageDims)}return Object.defineProperty(t.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"className",{get:function(){return this._className},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"box",{get:function(){return this._box},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageDims",{get:function(){return this._imageDims},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageWidth",{get:function(){return this.imageDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageHeight",{get:function(){return this.imageDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relativeBox",{get:function(){return new w(this._box).rescale(this.imageDims.reverse())},enumerable:!0,configurable:!0}),t.prototype.forSize=function(e,n){return new t(this.score,this.classScore,this.className,this.relativeBox,{width:e,height:n})},t}(),k=function(t){function e(e,n,r){return t.call(this,e,e,"",n,r)||this}return Object(a.c)(e,t),e.prototype.forSize=function(n,r){var i=t.prototype.forSize.call(this,n,r);return new e(i.score,i.relativeBox,i.imageDims)},e}(S);function O(t,e,n){void 0===n&&(n=!0);var r=Math.max(0,Math.min(t.right,e.right)-Math.max(t.left,e.left))*Math.max(0,Math.min(t.bottom,e.bottom)-Math.max(t.top,e.top));return n?r/(t.area+e.area-r):r/Math.min(t.area,e.area)}function I(t){var e=t.map(function(t){return t.x}),n=t.map(function(t){return t.y}),r=e.reduce(function(t,e){return e0;)s();return o}function A(t,e){return o.L(function(){var n=e[0],r=e[1],i=e[2],s=o.n(Object(a.e)(t.shape.slice(0,3),[1]),n),l=o.n(Object(a.e)(t.shape.slice(0,3),[1]),r),u=o.n(Object(a.e)(t.shape.slice(0,3),[1]),i),c=o.h([s,l,u],3);return o.F(t,c)})}function N(t,e){return void 0===e&&(e=!1),o.L(function(){var n=t.shape.slice(1),r=n[0],i=n[1];if(r===i)return t;var s=Math.abs(r-i),a=Math.round(s*(e?.5:1)),l=r>i?2:1,u=function(e){var n=t.shape.slice();return n[l]=e,o.n(n,0)},c=u(a),h=s-c.shape[l],d=[e&&h?u(h):null,t,c].filter(function(t){return!!t}).map(function(t){return t.toFloat()});return o.h(d,l)})}function D(t){for(var e=t.slice(),n=e.length-1;n>0;n--){var r=Math.floor(Math.random()*(n+1)),i=e[n];e[n]=e[r],e[r]=i}return e}function M(t){return 1/(1+Math.exp(-t))}function L(t){return Math.log(t/(1-t))}var P=function(t){function e(e,n,r,i,o){return void 0===o&&(o=!1),t.call(this,{x:e,y:n,width:r,height:i},o)||this}return Object(a.c)(e,t),e}(w),F=function(){function t(t,e,n){void 0===n&&(n=new x(0,0));var r=e.width,i=e.height;this._imgDims=new l(r,i),this._shift=n,this._positions=t.map(function(t){return t.mul(new x(r,i)).add(n)})}return Object.defineProperty(t.prototype,"shift",{get:function(){return new x(this._shift.x,this._shift.y)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageWidth",{get:function(){return this._imgDims.width},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"imageHeight",{get:function(){return this._imgDims.height},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relativePositions",{get:function(){var t=this;return this._positions.map(function(e){return e.sub(t._shift).div(new x(t.imageWidth,t.imageHeight))})},enumerable:!0,configurable:!0}),t.prototype.forSize=function(t,e){return new this.constructor(this.relativePositions,{width:t,height:e})},t.prototype.shiftBy=function(t,e){return new this.constructor(this.relativePositions,this._imgDims,new x(t,e))},t.prototype.shiftByPoint=function(t){return this.shiftBy(t.x,t.y)},t.prototype.align=function(t,e){if(void 0===e&&(e={}),t){var n=t instanceof k?t.box.floor():new w(t);return this.shiftBy(n.x,n.y).align(null,e)}var r=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},e),i=r.useDlibAlignment,o=r.minBoxPadding;return i?this.alignDlib():this.alignMinBbox(o)},t.prototype.alignDlib=function(){var t=this.getRefPointsForAlignment(),e=t[0],n=t[1],r=t[2],i=function(t){return r.sub(t).magnitude()},o=(i(e)+i(n))/2,s=Math.floor(o/.45),a=_(t),l=Math.floor(Math.max(0,a.x-.5*s)),u=Math.floor(Math.max(0,a.y-.43*s));return new P(l,u,Math.min(s,this.imageWidth+l),Math.min(s,this.imageHeight+u))},t.prototype.alignMinBbox=function(t){var e=I(this.positions);return e.pad(e.width*t,e.height*t)},t.prototype.getRefPointsForAlignment=function(){throw new Error("getRefPointsForAlignment not implemented by base class")},t}(),B=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.getRefPointsForAlignment=function(){var t=this.positions;return[t[0],t[1],_([t[3],t[4]])]},e}(F),j=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.getJawOutline=function(){return this.positions.slice(0,17)},e.prototype.getLeftEyeBrow=function(){return this.positions.slice(17,22)},e.prototype.getRightEyeBrow=function(){return this.positions.slice(22,27)},e.prototype.getNose=function(){return this.positions.slice(27,36)},e.prototype.getLeftEye=function(){return this.positions.slice(36,42)},e.prototype.getRightEye=function(){return this.positions.slice(42,48)},e.prototype.getMouth=function(){return this.positions.slice(48,68)},e.prototype.getRefPointsForAlignment=function(){return[this.getLeftEye(),this.getRightEye(),this.getMouth()].map(_)},e}(F),$=function(){function t(t,e){this._label=t,this._distance=e}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distance",{get:function(){return this._distance},enumerable:!0,configurable:!0}),t.prototype.toString=function(t){return void 0===t&&(t=!0),this.label+(t?" ("+m(this.distance)+")":"")},t}(),U=function(t){function e(e,n){var r=t.call(this,e)||this;return r._label=n,r}return Object(a.c)(e,t),e.assertIsValidLabeledBox=function(t,e){if(w.assertIsValidBox(t,e),!T(t.label))throw new Error(e+" - expected property label ("+t.label+") to be a number")},Object.defineProperty(e.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),e}(w),V=function(){function t(t,e){if("string"!=typeof t)throw new Error("LabeledFaceDescriptors - constructor expected label to be a string");if(!Array.isArray(e)||e.some(function(t){return!(t instanceof Float32Array)}))throw new Error("LabeledFaceDescriptors - constructor expected descriptors to be an array of Float32Array");this._label=t,this._descriptors=e}return Object.defineProperty(t.prototype,"label",{get:function(){return this._label},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"descriptors",{get:function(){return this._descriptors},enumerable:!0,configurable:!0}),t.prototype.toJSON=function(){return{label:this.label,descriptors:this.descriptors.map(function(t){return Array.from(t)})}},t.fromJSON=function(e){var n=e.descriptors.map(function(t){return new Float32Array(t)});return new t(e.label,n)},t}(),W=function(t){function e(e,n,r,i){var o=t.call(this,e,n)||this;return o._score=r,o._classScore=i,o}return Object(a.c)(e,t),e.assertIsValidPredictedBox=function(t,e){if(U.assertIsValidLabeledBox(t,e),!E(t.score)||!E(t.classScore))throw new Error(e+" - expected properties score ("+t.score+") and ("+t.classScore+") to be a number between [0, 1]")},Object.defineProperty(e.prototype,"score",{get:function(){return this._score},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"classScore",{get:function(){return this._classScore},enumerable:!0,configurable:!0}),e}(U);function H(t){return t.detection instanceof k}function G(t,e){var n={detection:e};return Object.assign({},t,n)}function z(){var t=window.fetch||function(){throw new Error("fetch - missing fetch implementation for browser environment")};return{Canvas:HTMLCanvasElement,CanvasRenderingContext2D:CanvasRenderingContext2D,Image:HTMLImageElement,ImageData:ImageData,Video:HTMLVideoElement,createCanvasElement:function(){return document.createElement("canvas")},createImageElement:function(){return document.createElement("img")},fetch:t,readFile:function(){throw new Error("readFile - filesystem not available for browser environment")}}}var X=n("pcbz"),K=n("dxT3");function Y(){return"object"==typeof window&&"undefined"!=typeof document&&"undefined"!=typeof HTMLImageElement&&"undefined"!=typeof HTMLCanvasElement&&"undefined"!=typeof HTMLVideoElement&&"undefined"!=typeof ImageData&&"undefined"!=typeof CanvasRenderingContext2D}var q,J=n("iMyp");function Z(t){q=t}function Q(){Y()&&Z(z()),Object(J.a)()&&Z(Object(K.a)())}var tt,et={getEnv:function(){if(!q)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return q},setEnv:Z,initialize:Q,createBrowserEnv:z,createFileSystem:X.a,createNodejsEnv:K.a,monkeyPatch:function(t){if(q||Q(),!q)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");var e=t.Canvas,n=void 0===e?q.Canvas:e,r=t.Image,i=void 0===r?q.Image:r;q.Canvas=n,q.Image=i,q.createCanvasElement=t.createCanvasElement||function(){return new n},q.createImageElement=t.createImageElement||function(){return new i},q.ImageData=t.ImageData||q.ImageData,q.Video=t.Video||q.Video,q.fetch=t.fetch||q.fetch,q.readFile=t.readFile||q.readFile},isBrowser:Y,isNodejs:J.a};function nt(t){return et.isNodejs()||"string"!=typeof t?t:document.getElementById(t)}function rt(t){var e=et.getEnv(),n=e.Canvas;if(t instanceof e.CanvasRenderingContext2D)return t;var r=nt(t);if(!(r instanceof n))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");var i=r.getContext("2d");if(!i)throw new Error("resolveContext2d - canvas 2d context is null");return i}Q(),function(t){t.TOP_LEFT="TOP_LEFT",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_LEFT="BOTTOM_LEFT",t.BOTTOM_RIGHT="BOTTOM_RIGHT"}(tt||(tt={}));var it=function(){return function(t){void 0===t&&(t={});var e=t.anchorPosition,n=t.backgroundColor,r=t.fontColor,i=t.fontSize,o=t.fontStyle,s=t.padding;this.anchorPosition=e||tt.TOP_LEFT,this.backgroundColor=n||"rgba(0, 0, 0, 0.5)",this.fontColor=r||"rgba(255, 255, 255, 1)",this.fontSize=i||14,this.fontStyle=o||"Georgia",this.padding=s||4}}(),ot=function(){function t(e,n,r){void 0===r&&(r={}),this.text="string"==typeof e?[e]:e instanceof t?e.text:e,this.anchor=n,this.options=new it(r)}return t.prototype.measureWidth=function(t){var e=this.options.padding;return this.text.map(function(e){return t.measureText(e).width}).reduce(function(t,e){return t=3}function ct(t){return new Promise(function(e,n){if(t instanceof et.getEnv().Canvas||ut(t))return e();function r(t){t.currentTarget&&(t.currentTarget.removeEventListener("load",r),t.currentTarget.removeEventListener("error",i),e(t))}function i(t){t.currentTarget&&(t.currentTarget.removeEventListener("load",r),t.currentTarget.removeEventListener("error",i),n(t))}t.addEventListener("load",r),t.addEventListener("error",i)})}function ht(t){return new Promise(function(e,n){if(!(t instanceof Blob))return n("bufferToImage - expected buf to be of type: Blob");var r=new FileReader;r.onload=function(){if("string"!=typeof r.result)return n("bufferToImage - expected reader.result to be a string, in onload");var t=et.getEnv().createImageElement();t.onload=function(){return e(t)},t.onerror=n,t.src=r.result},r.onerror=n,r.readAsDataURL(t)})}function dt(t){var e=et.getEnv(),n=e.Image,r=e.Video;return t instanceof n?new l(t.naturalWidth,t.naturalHeight):t instanceof r?new l(t.videoWidth,t.videoHeight):new l(t.width,t.height)}function pt(t){var e=t.width,n=t.height,r=(0,et.getEnv().createCanvasElement)();return r.width=e,r.height=n,r}function ft(t,e){var n=et.getEnv().ImageData;if(!(t instanceof n||ut(t)))throw new Error("createCanvasFromMedia - media has not finished loading yet");var r=e||dt(t),i=r.width,o=r.height,s=pt({width:i,height:o});return t instanceof n?rt(s).putImageData(t,0,0):rt(s).drawImage(t,0,0,i,o),s}function gt(t,e){return Object(a.b)(this,void 0,void 0,function(){var n,r,i,s,l,u;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=e||et.getEnv().createCanvasElement(),r=t.shape.slice(p(t)?1:0),i=r[0],s=r[1],l=r[2],u=o.L(function(){return t.as3D(i,s,l).toInt()}),[4,o.f.toPixels(u,n)];case 1:return a.sent(),u.dispose(),[2,n]}})})}function mt(t){var e=et.getEnv(),n=e.Image,r=e.Canvas,i=e.Video;return t instanceof n||t instanceof r||t instanceof i}function vt(t,e,n){void 0===n&&(n=!1);var r=et.getEnv(),i=r.Image,o=r.Canvas;if(!(t instanceof i||t instanceof o))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");var s=dt(t),a=e/Math.max(s.height,s.width),l=a*s.width,u=a*s.height,c=pt({width:e,height:e}),h=t instanceof o?t:ft(t),d=Math.abs(l-u)/2,p=n&&l1||this._treatAsBatchInput},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"batchSize",{get:function(){return this._batchSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputDimensions",{get:function(){return this._inputDimensions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reshapedInputDimensions",{get:function(){var t=this;return y(this.batchSize,0,1).map(function(e,n){return t.getReshapedInputDimensions(n)})},enumerable:!0,configurable:!0}),t.prototype.getInput=function(t){return this.canvases[t]||this.imageTensors[t]},t.prototype.getInputDimensions=function(t){return this._inputDimensions[t]},t.prototype.getInputHeight=function(t){return this._inputDimensions[t][0]},t.prototype.getInputWidth=function(t){return this._inputDimensions[t][1]},t.prototype.getReshapedInputDimensions=function(t){if("number"!=typeof this.inputSize)throw new Error("getReshapedInputDimensions - inputSize not set, toBatchTensor has not been called yet");return b({width:this.getInputWidth(t),height:this.getInputHeight(t)},this.inputSize)},t.prototype.toBatchTensor=function(t,e){var n=this;return void 0===e&&(e=!0),this._inputSize=t,o.L(function(){var r=y(n.batchSize,0,1).map(function(r){var i=n.getInput(r);if(i instanceof o.a){var s=p(i)?i:i.expandDims();return(s=N(s,e)).shape[1]===t&&s.shape[2]===t||(s=o.o.resizeBilinear(s,[t,t])),s.as3D(t,t,3)}if(i instanceof et.getEnv().Canvas)return o.f.fromPixels(vt(i,t,e));throw new Error("toBatchTensor - at batchIdx "+r+", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have "+i)});return o.E(r.map(function(t){return t.toFloat()})).as4D(n.batchSize,t,t,3)})},t}();function _t(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,r;return Object(a.d)(this,function(i){switch(i.label){case 0:if(t instanceof bt)return[2,t];if(!(e=Array.isArray(t)?t:[t]).length)throw new Error("toNetInput - empty array passed as input");return n=function(e){return Array.isArray(t)?" at input index "+e+":":""},(r=e.map(nt)).forEach(function(t,r){if(!mt(t)&&!d(t)&&!p(t)){if("string"==typeof e[r])throw new Error("toNetInput -"+n(r)+" string passed, but could not resolve HTMLElement for element id "+e[r]);throw new Error("toNetInput -"+n(r)+" expected media to be of type HTMLImageElement | HTMLVideoElement | HTMLCanvasElement | tf.Tensor3D, or to be an element id")}if(p(t)){var i=t.shape[0];if(1!==i)throw new Error("toNetInput -"+n(r)+" tf.Tensor4D with batchSize "+i+" passed, but not supported in input array")}}),[4,Promise.all(r.map(function(t){return mt(t)&&ct(t)}))];case 1:return i.sent(),[2,new bt(r,Array.isArray(t))]}})})}function yt(t,e){return Object(a.b)(this,void 0,void 0,function(){var n,r,i,o,s,l;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=et.getEnv().Canvas,r=t,t instanceof n?[3,5]:[4,_t(t)];case 1:if((i=a.sent()).batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");return(o=i.getInput(0))instanceof n?(s=o,[3,4]):[3,2];case 2:return[4,gt(o)];case 3:s=a.sent(),a.label=4;case 4:r=s,a.label=5;case 5:return l=rt(r),[2,e.map(function(t){return t instanceof k?t.forSize(r.width,r.height).box.floor():t}).map(function(t){return t.clipAtImageBorders(r.width,r.height)}).map(function(t){var e=t.x,n=t.y,r=t.width,i=t.height,o=pt({width:r,height:i});return rt(o).putImageData(l.getImageData(e,n,r,i),0,0),o})]}})})}function Tt(t,e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){if(!d(t)&&!p(t))throw new Error("extractFaceTensors - expected image tensor to be 3D or 4D");if(p(t)&&t.shape[0]>1)throw new Error("extractFaceTensors - batchSize > 1 not supported");return[2,o.L(function(){var n=t.shape.slice(p(t)?1:0),r=n[0],i=n[1],s=n[2];return e.map(function(t){return t instanceof k?t.forSize(i,r).box:t}).map(function(t){return t.clipAtImageBorders(i,r)}).map(function(e){var n=e.x,a=e.y,l=e.width,u=e.height;return o.C(t.as3D(r,i,s),[a,n,0],[u,l,s])})})]})})}function Et(t,e){return Object(a.b)(this,void 0,void 0,function(){var n;return Object(a.d)(this,function(r){switch(r.label){case 0:return[4,(0,et.getEnv().fetch)(t,e)];case 1:if(!((n=r.sent()).status<400))throw new Error("failed to fetch: ("+n.status+") "+n.statusText+", from url: "+n.url);return[2,n]}})})}function xt(t){return Object(a.b)(this,void 0,void 0,function(){var e,n;return Object(a.d)(this,function(r){switch(r.label){case 0:return[4,Et(t)];case 1:return[4,(e=r.sent()).blob()];case 2:if(!(n=r.sent()).type.startsWith("image/"))throw new Error("fetchImage - expected blob type to be of type image/*, instead have: "+n.type+", for url: "+e.url);return[2,ht(n)]}})})}function wt(t){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(e){switch(e.label){case 0:return[4,Et(t)];case 1:return[2,e.sent().json()]}})})}function Ct(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=Float32Array.bind,[4,Et(t)];case 1:return[4,n.sent().arrayBuffer()];case 2:return[2,new(e.apply(Float32Array,[void 0,n.sent()]))]}})})}function St(t,e){var n=e+"-weights_manifest.json";if(!t)return{modelBaseUri:"",manifestUri:n};if("/"===t)return{modelBaseUri:"/",manifestUri:"/"+n};var r=t.startsWith("http://")?"http://":t.startsWith("https://")?"https://":"",i=(t=t.replace(r,"")).split("/").filter(function(t){return t}),o=t.endsWith(".json")?i[i.length-1]:n,s=r+(t.endsWith(".json")?i.slice(0,i.length-1):i).join("/");return{modelBaseUri:s=t.startsWith("/")?"/"+s:s,manifestUri:"/"===s?"/"+o:s+"/"+o}}function kt(t,e){return Object(a.b)(this,void 0,void 0,function(){var n,r,i,s;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=St(t,e),r=n.manifestUri,i=n.modelBaseUri,[4,wt(r)];case 1:return s=a.sent(),[2,o.p.loadWeights(s,i)]}})})}function Ot(t,e,n){void 0===n&&(n=!1);var r=n?dt(e):e,i=r.width,o=r.height;return t.width=i,t.height=o,{width:i,height:o}}var It=function(){function t(t){this._name=t,this._params=void 0,this._paramMappings=[]}return Object.defineProperty(t.prototype,"params",{get:function(){return this._params},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paramMappings",{get:function(){return this._paramMappings},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isLoaded",{get:function(){return!!this.params},enumerable:!0,configurable:!0}),t.prototype.getParamFromPath=function(t){var e=this.traversePropertyPath(t);return e.obj[e.objProp]},t.prototype.reassignParamFromPath=function(t,e){var n=this.traversePropertyPath(t),r=n.obj,i=n.objProp;r[i].dispose(),r[i]=e},t.prototype.getParamList=function(){var t=this;return this._paramMappings.map(function(e){var n=e.paramPath;return{path:n,tensor:t.getParamFromPath(n)}})},t.prototype.getTrainableParams=function(){return this.getParamList().filter(function(t){return t.tensor instanceof o.b})},t.prototype.getFrozenParams=function(){return this.getParamList().filter(function(t){return!(t.tensor instanceof o.b)})},t.prototype.variable=function(){var t=this;this.getFrozenParams().forEach(function(e){var n=e.path,r=e.tensor;t.reassignParamFromPath(n,r.variable())})},t.prototype.freeze=function(){var t=this;this.getTrainableParams().forEach(function(e){var n=e.path,r=e.tensor,i=o.G(r.dataSync());r.dispose(),t.reassignParamFromPath(n,i)})},t.prototype.dispose=function(t){void 0===t&&(t=!0),this.getParamList().forEach(function(e){if(t&&e.tensor.isDisposed)throw new Error("param tensor has already been disposed for path "+e.path);e.tensor.dispose()}),this._params=void 0},t.prototype.serializeParams=function(){return new Float32Array(this.getParamList().map(function(t){var e=t.tensor;return Array.from(e.dataSync())}).reduce(function(t,e){return t.concat(e)}))},t.prototype.load=function(t){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(e){switch(e.label){case 0:return t instanceof Float32Array?(this.extractWeights(t),[2]):[4,this.loadFromUri(t)];case 1:return e.sent(),[2]}})})},t.prototype.loadFromUri=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:if(t&&"string"!=typeof t)throw new Error(this._name+".loadFromUri - expected model uri");return[4,kt(t,this.getDefaultModelName())];case 1:return e=n.sent(),this.loadFromWeightMap(e),[2]}})})},t.prototype.loadFromDisk=function(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,r,i,s,l,u,c,h,d;return Object(a.d)(this,function(a){switch(a.label){case 0:if(t&&"string"!=typeof t)throw new Error(this._name+".loadFromDisk - expected model file path");return e=et.getEnv().readFile,n=St(t,this.getDefaultModelName()),r=n.manifestUri,i=n.modelBaseUri,s=function(t){return Promise.all(t.map(function(t){return e(t).then(function(t){return t.buffer})}))},l=o.p.weightsLoaderFactory(s),h=(c=JSON).parse,[4,e(r)];case 1:return u=h.apply(c,[a.sent().toString()]),[4,l(u,i)];case 2:return d=a.sent(),this.loadFromWeightMap(d),[2]}})})},t.prototype.loadFromWeightMap=function(t){var e=this.extractParamsFromWeigthMap(t),n=e.paramMappings,r=e.params;this._paramMappings=n,this._params=r},t.prototype.extractWeights=function(t){var e=this.extractParams(t),n=e.paramMappings,r=e.params;this._paramMappings=n,this._params=r},t.prototype.traversePropertyPath=function(t){if(!this.params)throw new Error("traversePropertyPath - model has no loaded params");var e=t.split("/").reduce(function(e,n){if(!e.nextObj.hasOwnProperty(n))throw new Error("traversePropertyPath - object does not have property "+n+", for path "+t);return{obj:e.nextObj,objProp:n,nextObj:e.nextObj[n]}},{nextObj:this.params}),n=e.obj,r=e.objProp;if(!(n&&r&&n[r]instanceof o.a))throw new Error("traversePropertyPath - parameter is not a tensor, for path "+t);return{obj:n,objProp:r}},t}();function Rt(t,e,n){return o.L(function(){var r=o.z(t,e.depthwise_filter,e.pointwise_filter,n,"same");return r=o.c(r,e.bias)})}function At(t,e,n){return void 0===n&&(n=!1),o.L(function(){var r=o.w(n?o.c(o.i(t,e.conv0.filters,[2,2],"same"),e.conv0.bias):Rt(t,e.conv0,[2,2])),i=Rt(r,e.conv1,[1,1]),s=Rt(o.w(o.c(r,i)),e.conv2,[1,1]);return o.w(o.c(r,o.c(i,s)))})}function Nt(t,e,n,r){return void 0===n&&(n=!1),void 0===r&&(r=!0),o.L(function(){var i=o.w(n?o.c(o.i(t,e.conv0.filters,r?[2,2]:[1,1],"same"),e.conv0.bias):Rt(t,e.conv0,r?[2,2]:[1,1])),s=Rt(i,e.conv1,[1,1]),a=Rt(o.w(o.c(i,s)),e.conv2,[1,1]),l=Rt(o.w(o.c(i,o.c(s,a))),e.conv3,[1,1]);return o.w(o.c(i,o.c(s,o.c(a,l))))})}function Dt(t,e,n,r){return void 0===n&&(n="same"),void 0===r&&(r=!1),o.L(function(){var i=o.c(o.i(t,e.filters,[1,1],n),e.bias);return r?o.w(i):i})}function Mt(t,e){Object.keys(t).forEach(function(n){e.some(function(t){return t.originalPath===n})||t[n].dispose()})}function Lt(t,e){return function(n,r,i,s){var a=o.K(t(n*r*i*i),[i,i,n,r]),l=o.H(t(r));return e.push({paramPath:s+"/filters"},{paramPath:s+"/bias"}),{filters:a,bias:l}}}function Pt(t,e){return function(n,r,i){var s=o.I(t(n*r),[n,r]),a=o.H(t(r));return e.push({paramPath:i+"/weights"},{paramPath:i+"/bias"}),{weights:s,bias:a}}}var Ft=function(){return function(t,e,n){this.depthwise_filter=t,this.pointwise_filter=e,this.bias=n}}();function Bt(t,e){return function(n,r,i){var s=o.K(t(9*n),[3,3,n,1]),a=o.K(t(n*r),[1,1,n,r]),l=o.H(t(r));return e.push({paramPath:i+"/depthwise_filter"},{paramPath:i+"/pointwise_filter"},{paramPath:i+"/bias"}),new Ft(s,a,l)}}function jt(t){return function(e){var n=t(e+"/depthwise_filter",4),r=t(e+"/pointwise_filter",4),i=t(e+"/bias",1);return new Ft(n,r,i)}}function $t(t,e){return function(n,r,i){var o=t[n];if(!u(o,r))throw new Error("expected weightMap["+n+"] to be a Tensor"+r+"D, instead have "+o);return e.push({originalPath:n,paramPath:i||n}),o}}function Ut(t){var e=t;return{extractWeights:function(t){var n=e.slice(0,t);return e=e.slice(t),n},getRemainingWeights:function(){return e}}}function Vt(t,e){var n=Lt(t,e),r=Bt(t,e);function i(t,e,i,o){return void 0===o&&(o=!1),{conv0:o?n(t,e,3,i+"/conv0"):r(t,e,i+"/conv0"),conv1:r(e,e,i+"/conv1"),conv2:r(e,e,i+"/conv2")}}return{extractDenseBlock3Params:i,extractDenseBlock4Params:function(t,e,n,o){void 0===o&&(o=!1);var s=i(t,e,n,o);return{conv0:s.conv0,conv1:s.conv1,conv2:s.conv2,conv3:r(e,e,n+"/conv3")}}}}function Wt(t){return function(e){return{filters:t(e+"/filters",4),bias:t(e+"/bias",1)}}}function Ht(t,e){var n=$t(t,e),r=Wt(n),i=jt(n);return{extractDenseBlock3Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?r(t+"/conv0"):i(t+"/conv0"),conv1:i(t+"/conv1"),conv2:i(t+"/conv2")}},extractDenseBlock4Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?r(t+"/conv0"):i(t+"/conv0"),conv1:i(t+"/conv1"),conv2:i(t+"/conv2"),conv3:i(t+"/conv3")}}}}var Gt=function(t){function e(){return t.call(this,"FaceFeatureExtractor")||this}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("FaceFeatureExtractor - load model before inference");return o.L(function(){var n=Nt(A(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(o.y(255)),e.dense0,!0);return n=Nt(n=Nt(n=Nt(n,e.dense1),e.dense2),e.dense3),n=o.d(n,[7,7],[2,2],"valid")})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,_t(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"face_feature_extractor_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=Ht(t,e).extractDenseBlock4Params,r={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2"),dense3:n("dense3")};return Mt(t,e),{params:r,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=Ut(t),r=n.extractWeights,i=n.getRemainingWeights,o=Vt(r,e).extractDenseBlock4Params,s=o(3,32,"dense0",!0),a=o(32,64,"dense1"),l=o(64,128,"dense2"),u=o(128,256,"dense3");if(0!==i().length)throw new Error("weights remaing after extract: "+i().length);return{paramMappings:e,params:{dense0:s,dense1:a,dense2:l,dense3:u}}}(t)},e}(It);function zt(t,e){return o.L(function(){return o.c(o.q(t,e.weights),e.bias)})}function Xt(t){var e={},n={};return Object.keys(t).forEach(function(r){(r.startsWith("fc")?n:e)[r]=t[r]}),{featureExtractorMap:e,classifierMap:n}}var Kt=function(t){function e(e,n){var r=t.call(this,e)||this;return r._faceFeatureExtractor=n,r}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),e.prototype.runNet=function(t){var e=this,n=this.params;if(!n)throw new Error(this._name+" - load model before inference");return o.L(function(){var r=t instanceof bt?e.faceFeatureExtractor.forwardInput(t):t;return zt(r.as2D(r.shape[0],-1),n.fc)})},e.prototype.dispose=function(e){void 0===e&&(e=!0),this.faceFeatureExtractor.dispose(e),t.prototype.dispose.call(this,e)},e.prototype.loadClassifierParams=function(t){var e=this.extractClassifierParams(t),n=e.params,r=e.paramMappings;this._params=n,this._paramMappings=r},e.prototype.extractClassifierParams=function(t){return function(t,e,n){var r=[],i=Ut(t),o=i.extractWeights,s=i.getRemainingWeights,a=Pt(o,r)(e,n,"fc");if(0!==s().length)throw new Error("weights remaing after extract: "+s().length);return{paramMappings:r,params:{fc:a}}}(t,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},e.prototype.extractParamsFromWeigthMap=function(t){var e=Xt(t),n=e.featureExtractorMap,r=e.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(n),function(t){var e,n=[],r=$t(t,n),i={fc:(e="fc",{weights:r(e+"/weights",2),bias:r(e+"/bias",1)})};return Mt(t,n),{params:i,paramMappings:n}}(r)},e.prototype.extractParams=function(t){var e=this.getClassifierChannelsIn(),n=this.getClassifierChannelsOut(),r=n*e+n,i=t.slice(0,t.length-r),o=t.slice(t.length-r);return this.faceFeatureExtractor.extractWeights(i),this.extractClassifierParams(o)},e}(It),Yt=["neutral","happy","sad","angry","fearful","disgusted","surprised"],qt=function(){function t(t){var e=this;if(7!==t.length)throw new Error("FaceExpressions.constructor - expected probabilities.length to be 7, have: "+t.length);Yt.forEach(function(n,r){e[n]=t[r]})}return t.prototype.asSortedArray=function(){var t=this;return Yt.map(function(e){return{expression:e,probability:t[e]}}).sort(function(t,e){return e.probability-t.probability})},t}(),Jt=function(t){function e(e){return void 0===e&&(e=new Gt),t.call(this,"FaceExpressionNet",e)||this}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this;return o.L(function(){return o.D(e.runNet(t))})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,_t(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.predictExpressions=function(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,r,i,s=this;return Object(a.d)(this,function(l){switch(l.label){case 0:return[4,_t(t)];case 1:return e=l.sent(),[4,this.forwardInput(e)];case 2:return n=l.sent(),[4,Promise.all(o.O(n).map(function(t){return Object(a.b)(s,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,t.data()];case 1:return e=n.sent(),t.dispose(),[2,e]}})})}))];case 3:return r=l.sent(),n.dispose(),i=r.map(function(t){return new qt(t)}),[2,e.isBatchInput?i:i[0]]}})})},e.prototype.getDefaultModelName=function(){return"face_expression_model"},e.prototype.getClassifierChannelsIn=function(){return 256},e.prototype.getClassifierChannelsOut=function(){return 7},e}(Kt);function Zt(t){return t.expressions instanceof qt}function Qt(t,e){var n={expressions:e};return Object.assign({},t,n)}function te(t,e,n,r){void 0===n&&(n=.1),(Array.isArray(e)?e:[e]).forEach(function(e){var i=e instanceof qt?e:Zt(e)?e.expressions:void 0;if(!i)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");var o=i.asSortedArray().filter(function(t){return t.probability>n}),s=H(e)?e.detection.box.bottomLeft:r||new x(0,0);new ot(o.map(function(t){return t.expression+" ("+m(t.probability)+")"}),s).draw(t)})}function ee(t){return H(t)&&t.landmarks instanceof F&&t.unshiftedLandmarks instanceof F&&t.alignedRect instanceof k}function ne(t,e){var n=t.detection.box,r=e.shiftBy(n.x,n.y),i=r.align(),o=t.detection.imageDims,s={landmarks:r,unshiftedLandmarks:e,alignedRect:new k(t.detection.score,i.rescale(o.reverse()),o)};return Object.assign({},t,s)}var re=function(){return function(t){void 0===t&&(t={});var e=t.drawLines,n=void 0===e||e,r=t.drawPoints,i=void 0===r||r,o=t.lineWidth,s=t.lineColor,a=t.pointSize,l=t.pointColor;this.drawLines=n,this.drawPoints=i,this.lineWidth=o||1,this.pointSize=a||2,this.lineColor=s||"rgba(0, 255, 255, 1)",this.pointColor=l||"rgba(255, 0, 255, 1)"}}(),ie=function(){function t(t,e){void 0===e&&(e={}),this.faceLandmarks=t,this.options=new re(e)}return t.prototype.draw=function(t){var e=rt(t),n=this.options,r=n.drawLines,i=n.drawPoints,o=n.lineWidth,a=n.lineColor,l=n.pointSize,u=n.pointColor;if(r&&this.faceLandmarks instanceof j&&(e.strokeStyle=a,e.lineWidth=o,s(e,this.faceLandmarks.getJawOutline()),s(e,this.faceLandmarks.getLeftEyeBrow()),s(e,this.faceLandmarks.getRightEyeBrow()),s(e,this.faceLandmarks.getNose()),s(e,this.faceLandmarks.getLeftEye(),!0),s(e,this.faceLandmarks.getRightEye(),!0),s(e,this.faceLandmarks.getMouth(),!0)),i){e.strokeStyle=u,e.fillStyle=u;this.faceLandmarks.positions.forEach(function(t){e.beginPath(),e.arc(t.x,t.y,l,0,2*Math.PI),e.fill()})}},t}();function oe(t,e){(Array.isArray(e)?e:[e]).forEach(function(e){var n=e instanceof F?e:ee(e)?e.landmarks:void 0;if(!n)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks> or array thereof");new ie(n).draw(t)})}function se(t,e){var n=[],r=Ut(t),i=r.extractWeights,o=r.getRemainingWeights,s=function(t,e){var n=Lt(t,e),r=Bt(t,e);return{extractConvParams:n,extractSeparableConvParams:r,extractReductionBlockParams:function(t,e,i){return{separable_conv0:r(t,e,i+"/separable_conv0"),separable_conv1:r(e,e,i+"/separable_conv1"),expansion_conv:n(t,e,1,i+"/expansion_conv")}},extractMainBlockParams:function(t,e){return{separable_conv0:r(t,t,e+"/separable_conv0"),separable_conv1:r(t,t,e+"/separable_conv1"),separable_conv2:r(t,t,e+"/separable_conv2")}}}}(i,n),a=s.extractConvParams,l=s.extractSeparableConvParams,u=s.extractReductionBlockParams,c=s.extractMainBlockParams,h={conv_in:a(3,32,3,"entry_flow/conv_in"),reduction_block_0:u(32,64,"entry_flow/reduction_block_0"),reduction_block_1:u(64,128,"entry_flow/reduction_block_1")},d={};y(e,0,1).forEach(function(t){d["main_block_"+t]=c(128,"middle_flow/main_block_"+t)});var p={reduction_block:u(128,256,"exit_flow/reduction_block"),separable_conv:l(256,512,"exit_flow/separable_conv")};if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:n,params:{entry_flow:h,middle_flow:d,exit_flow:p}}}function ae(t,e){var n=[],r=function(t,e){var n=$t(t,e),r=Wt(n),i=jt(n);return{extractConvParams:r,extractSeparableConvParams:i,extractReductionBlockParams:function(t){return{separable_conv0:i(t+"/separable_conv0"),separable_conv1:i(t+"/separable_conv1"),expansion_conv:r(t+"/expansion_conv")}},extractMainBlockParams:function(t){return{separable_conv0:i(t+"/separable_conv0"),separable_conv1:i(t+"/separable_conv1"),separable_conv2:i(t+"/separable_conv2")}}}}(t,n),i=r.extractConvParams,o=r.extractSeparableConvParams,s=r.extractReductionBlockParams,a=r.extractMainBlockParams,l={conv_in:i("entry_flow/conv_in"),reduction_block_0:s("entry_flow/reduction_block_0"),reduction_block_1:s("entry_flow/reduction_block_1")},u={};y(e,0,1).forEach(function(t){u["main_block_"+t]=a("middle_flow/main_block_"+t)});var c={reduction_block:s("exit_flow/reduction_block"),separable_conv:o("exit_flow/separable_conv")};return Mt(t,n),{params:{entry_flow:l,middle_flow:u,exit_flow:c},paramMappings:n}}function le(t,e,n){return o.c(o.i(t,e.filters,n,"same"),e.bias)}function ue(t,e,n){void 0===n&&(n=!0);var r=n?o.w(t):t;return r=Rt(r,e.separable_conv0,[1,1]),r=Rt(o.w(r),e.separable_conv1,[1,1]),r=o.s(r,[3,3],[2,2],"same"),r=o.c(r,le(t,e.expansion_conv,[2,2]))}var ce,he=function(t){function e(e){var n=t.call(this,"TinyXception")||this;return n._numMainBlocks=e,n}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this,n=this.params;if(!n)throw new Error("TinyXception - load model before inference");return o.L(function(){var r=A(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(o.y(256)),i=o.w(le(r,n.entry_flow.conv_in,[2,2]));return i=ue(i=ue(i,n.entry_flow.reduction_block_0,!1),n.entry_flow.reduction_block_1),y(e._numMainBlocks,0,1).forEach(function(t){i=function(t,e){var n=Rt(o.w(t),e.separable_conv0,[1,1]);return n=Rt(o.w(n),e.separable_conv1,[1,1]),n=Rt(o.w(n),e.separable_conv2,[1,1]),n=o.c(n,t)}(i,n.middle_flow["main_block_"+t])}),i=ue(i,n.exit_flow.reduction_block),i=o.w(Rt(i,n.exit_flow.separable_conv,[1,1]))})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,_t(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.getDefaultModelName=function(){return"tiny_xception_model"},e.prototype.extractParamsFromWeigthMap=function(t){return ae(t,this._numMainBlocks)},e.prototype.extractParams=function(t){return se(t,this._numMainBlocks)},e}(It);!function(t){t.FEMALE="female",t.MALE="male"}(ce||(ce={}));var de=function(t){function e(e){void 0===e&&(e=new he(2));var n=t.call(this,"AgeGenderNet")||this;return n._faceFeatureExtractor=e,n}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"faceFeatureExtractor",{get:function(){return this._faceFeatureExtractor},enumerable:!0,configurable:!0}),e.prototype.runNet=function(t){var e=this,n=this.params;if(!n)throw new Error(this._name+" - load model before inference");return o.L(function(){var r=t instanceof bt?e.faceFeatureExtractor.forwardInput(t):t,i=o.d(r,[7,7],[2,2],"valid").as2D(r.shape[0],-1);return{age:zt(i,n.fc.age).as1D(),gender:zt(i,n.fc.gender)}})},e.prototype.forwardInput=function(t){var e=this;return o.L(function(){var n=e.runNet(t),r=n.age,i=n.gender;return{age:r,gender:o.D(i)}})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,_t(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.predictAgeAndGender=function(t){return Object(a.b)(this,void 0,void 0,function(){var e,n,r,i,s,l,u=this;return Object(a.d)(this,function(c){switch(c.label){case 0:return[4,_t(t)];case 1:return e=c.sent(),[4,this.forwardInput(e)];case 2:return n=c.sent(),r=o.O(n.age),i=o.O(n.gender),s=r.map(function(t,e){return{ageTensor:t,genderTensor:i[e]}}),[4,Promise.all(s.map(function(t){var e=t.ageTensor,n=t.genderTensor;return Object(a.b)(u,void 0,void 0,function(){var t,r,i,o,s;return Object(a.d)(this,function(a){switch(a.label){case 0:return[4,e.data()];case 1:return t=a.sent()[0],[4,n.data()];case 2:return r=a.sent()[0],o=(i=r>.5)?ce.MALE:ce.FEMALE,s=i?r:1-r,e.dispose(),n.dispose(),[2,{age:t,gender:o,genderProbability:s}]}})})}))];case 3:return l=c.sent(),n.age.dispose(),n.gender.dispose(),[2,e.isBatchInput?l:l[0]]}})})},e.prototype.getDefaultModelName=function(){return"age_gender_model"},e.prototype.dispose=function(e){void 0===e&&(e=!0),this.faceFeatureExtractor.dispose(e),t.prototype.dispose.call(this,e)},e.prototype.loadClassifierParams=function(t){var e=this.extractClassifierParams(t),n=e.params,r=e.paramMappings;this._params=n,this._paramMappings=r},e.prototype.extractClassifierParams=function(t){return function(t){var e=[],n=Ut(t),r=n.extractWeights,i=n.getRemainingWeights,o=Pt(r,e),s=o(512,1,"fc/age"),a=o(512,2,"fc/gender");if(0!==i().length)throw new Error("weights remaing after extract: "+i().length);return{paramMappings:e,params:{fc:{age:s,gender:a}}}}(t)},e.prototype.extractParamsFromWeigthMap=function(t){var e=Xt(t),n=e.featureExtractorMap,r=e.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(n),function(t){var e=[],n=$t(t,e);function r(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}var i={fc:{age:r("fc/age"),gender:r("fc/gender")}};return Mt(t,e),{params:i,paramMappings:e}}(r)},e.prototype.extractParams=function(t){var e=t.slice(0,t.length-1539),n=t.slice(t.length-1539);return this.faceFeatureExtractor.extractWeights(e),this.extractClassifierParams(n)},e}(It),pe=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.postProcess=function(t,e,n){var r=n.map(function(t){var n=t.width,r=t.height,i=e/Math.max(r,n);return{width:n*i,height:r*i}}),i=r.length;return o.L(function(){var n=function(t,e){return o.E([o.n([68],t),o.n([68],e)],1).as2D(1,136).as1D()},s=function(t,e){var n=r[t],i=n.width,o=n.height;return e(i,o)?Math.abs(i-o)/2:0};return t.mul(o.n([i,136],e)).sub(o.E(Array.from(Array(i),function(t,e){return n(function(t){return s(t,function(t,e){return t 0");if("number"!=typeof this._scaleFactor||this._scaleFactor<=0||this._scaleFactor>=1)throw new Error(this._name+" - expected scaleFactor to be a number between 0 and 1");if("number"!=typeof this._maxNumScales||this._maxNumScales<0)throw new Error(this._name+" - expected maxNumScales to be a number > 0");if(!Array.isArray(this._scoreThresholds)||3!==this._scoreThresholds.length||this._scoreThresholds.some(function(t){return"number"!=typeof t}))throw new Error(this._name+" - expected scoreThresholds to be an array of numbers of length 3");if(this._scaleSteps&&(!Array.isArray(this._scaleSteps)||this._scaleSteps.some(function(t){return"number"!=typeof t})))throw new Error(this._name+" - expected scaleSteps to be an array of numbers")}return Object.defineProperty(t.prototype,"minFaceSize",{get:function(){return this._minFaceSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleFactor",{get:function(){return this._scaleFactor},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxNumScales",{get:function(){return this._maxNumScales},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scoreThresholds",{get:function(){return this._scoreThresholds},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleSteps",{get:function(){return this._scaleSteps},enumerable:!0,configurable:!0}),t}();function De(t,e){function n(n,r,i,s,a){var l=o.K(t(n*r*i*i),[i,i,n,r]),u=o.H(t(r));return e.push({paramPath:s+"/filters"},{paramPath:s+"/"+(a?"batch_norm_offset":"bias")}),{filters:l,bias:u}}function r(t,e,r,i){var o=n(t,e,r,i,!0);return{filters:o.filters,batch_norm_offset:o.bias}}function i(n,i,s){return{depthwise_conv:function(n,r){var i=o.K(t(9*n),[3,3,n,1]),s=o.H(t(n)),a=o.H(t(n)),l=o.H(t(n)),u=o.H(t(n));return e.push({paramPath:r+"/filters"},{paramPath:r+"/batch_norm_scale"},{paramPath:r+"/batch_norm_offset"},{paramPath:r+"/batch_norm_mean"},{paramPath:r+"/batch_norm_variance"}),{filters:i,batch_norm_scale:s,batch_norm_offset:a,batch_norm_mean:l,batch_norm_variance:u}}(n,s+"/depthwise_conv"),pointwise_conv:r(n,i,1,s+"/pointwise_conv")}}return{extractMobilenetV1Params:function(){return{conv_0:r(3,32,3,"mobilenetv1/conv_0"),conv_1:i(32,64,"mobilenetv1/conv_1"),conv_2:i(64,128,"mobilenetv1/conv_2"),conv_3:i(128,128,"mobilenetv1/conv_3"),conv_4:i(128,256,"mobilenetv1/conv_4"),conv_5:i(256,256,"mobilenetv1/conv_5"),conv_6:i(256,512,"mobilenetv1/conv_6"),conv_7:i(512,512,"mobilenetv1/conv_7"),conv_8:i(512,512,"mobilenetv1/conv_8"),conv_9:i(512,512,"mobilenetv1/conv_9"),conv_10:i(512,512,"mobilenetv1/conv_10"),conv_11:i(512,512,"mobilenetv1/conv_11"),conv_12:i(512,1024,"mobilenetv1/conv_12"),conv_13:i(1024,1024,"mobilenetv1/conv_13")}},extractPredictionLayerParams:function(){return{conv_0:r(1024,256,1,"prediction_layer/conv_0"),conv_1:r(256,512,3,"prediction_layer/conv_1"),conv_2:r(512,128,1,"prediction_layer/conv_2"),conv_3:r(128,256,3,"prediction_layer/conv_3"),conv_4:r(256,128,1,"prediction_layer/conv_4"),conv_5:r(128,256,3,"prediction_layer/conv_5"),conv_6:r(256,64,1,"prediction_layer/conv_6"),conv_7:r(64,128,3,"prediction_layer/conv_7"),box_predictor_0:{box_encoding_predictor:n(512,12,1,"prediction_layer/box_predictor_0/box_encoding_predictor"),class_predictor:n(512,9,1,"prediction_layer/box_predictor_0/class_predictor")},box_predictor_1:{box_encoding_predictor:n(1024,24,1,"prediction_layer/box_predictor_1/box_encoding_predictor"),class_predictor:n(1024,18,1,"prediction_layer/box_predictor_1/class_predictor")},box_predictor_2:{box_encoding_predictor:n(512,24,1,"prediction_layer/box_predictor_2/box_encoding_predictor"),class_predictor:n(512,18,1,"prediction_layer/box_predictor_2/class_predictor")},box_predictor_3:{box_encoding_predictor:n(256,24,1,"prediction_layer/box_predictor_3/box_encoding_predictor"),class_predictor:n(256,18,1,"prediction_layer/box_predictor_3/class_predictor")},box_predictor_4:{box_encoding_predictor:n(256,24,1,"prediction_layer/box_predictor_4/box_encoding_predictor"),class_predictor:n(256,18,1,"prediction_layer/box_predictor_4/class_predictor")},box_predictor_5:{box_encoding_predictor:n(128,24,1,"prediction_layer/box_predictor_5/box_encoding_predictor"),class_predictor:n(128,18,1,"prediction_layer/box_predictor_5/class_predictor")}}}}}function Me(t){var e=[],n=function(t,e){var n=$t(t,e);function r(t,e,r){return{filters:n(t+"/Conv2d_"+e+"_pointwise/weights",4,r+"/filters"),batch_norm_offset:n(t+"/Conv2d_"+e+"_pointwise/convolution_bn_offset",1,r+"/batch_norm_offset")}}function i(t){var e="mobilenetv1/conv_"+t,i="MobilenetV1/Conv2d_"+t+"_depthwise",o=e+"/depthwise_conv",s=e+"/pointwise_conv";return{depthwise_conv:{filters:n(i+"/depthwise_weights",4,o+"/filters"),batch_norm_scale:n(i+"/BatchNorm/gamma",1,o+"/batch_norm_scale"),batch_norm_offset:n(i+"/BatchNorm/beta",1,o+"/batch_norm_offset"),batch_norm_mean:n(i+"/BatchNorm/moving_mean",1,o+"/batch_norm_mean"),batch_norm_variance:n(i+"/BatchNorm/moving_variance",1,o+"/batch_norm_variance")},pointwise_conv:r("MobilenetV1",t,s)}}function o(t,e){return{filters:n(t+"/weights",4,e+"/filters"),bias:n(t+"/biases",1,e+"/bias")}}function s(t){return{box_encoding_predictor:o("Prediction/BoxPredictor_"+t+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+t+"/box_encoding_predictor"),class_predictor:o("Prediction/BoxPredictor_"+t+"/ClassPredictor","prediction_layer/box_predictor_"+t+"/class_predictor")}}return{extractMobilenetV1Params:function(){return{conv_0:r("MobilenetV1",0,"mobilenetv1/conv_0"),conv_1:i(1),conv_2:i(2),conv_3:i(3),conv_4:i(4),conv_5:i(5),conv_6:i(6),conv_7:i(7),conv_8:i(8),conv_9:i(9),conv_10:i(10),conv_11:i(11),conv_12:i(12),conv_13:i(13)}},extractPredictionLayerParams:function(){return{conv_0:r("Prediction",0,"prediction_layer/conv_0"),conv_1:r("Prediction",1,"prediction_layer/conv_1"),conv_2:r("Prediction",2,"prediction_layer/conv_2"),conv_3:r("Prediction",3,"prediction_layer/conv_3"),conv_4:r("Prediction",4,"prediction_layer/conv_4"),conv_5:r("Prediction",5,"prediction_layer/conv_5"),conv_6:r("Prediction",6,"prediction_layer/conv_6"),conv_7:r("Prediction",7,"prediction_layer/conv_7"),box_predictor_0:s(0),box_predictor_1:s(1),box_predictor_2:s(2),box_predictor_3:s(3),box_predictor_4:s(4),box_predictor_5:s(5)}}}}(t,e),r=n.extractMobilenetV1Params,i=n.extractPredictionLayerParams,o=t["Output/extra_dim"];if(e.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!d(o))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+o);var s={mobilenetv1:r(),prediction_layer:i(),output_layer:{extra_dim:o}};return Mt(t,e),{params:s,paramMappings:e}}function Le(t,e,n){return o.L(function(){var r=o.i(t,e.filters,n,"same");return r=o.c(r,e.batch_norm_offset),o.g(r,0,6)})}var Pe=.0010000000474974513;function Fe(t,e){return o.L(function(){var n=null,r=Le(t,e.conv_0,[2,2]);if([e.conv_1,e.conv_2,e.conv_3,e.conv_4,e.conv_5,e.conv_6,e.conv_7,e.conv_8,e.conv_9,e.conv_10,e.conv_11,e.conv_12,e.conv_13].forEach(function(t,e){var i,s,a,l=e+1,u=function(t){return[2,4,6,12].some(function(e){return e===t})?[2,2]:[1,1]}(l);i=r,s=t.depthwise_conv,a=u,r=Le(r=o.L(function(){var t=o.j(i,s.filters,a,"same");return t=o.e(t,s.batch_norm_mean,s.batch_norm_variance,s.batch_norm_offset,s.batch_norm_scale,Pe),o.g(t,0,6)}),t.pointwise_conv,[1,1]),11===l&&(n=r)}),null===n)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:r,conv11:n}})}function Be(t,e,n){var r=t.arraySync(),i=Math.min(r[e][0],r[e][2]),o=Math.min(r[e][1],r[e][3]),s=Math.max(r[e][0],r[e][2]),a=Math.max(r[e][1],r[e][3]),l=Math.min(r[n][0],r[n][2]),u=Math.min(r[n][1],r[n][3]),c=Math.max(r[n][0],r[n][2]),h=Math.max(r[n][1],r[n][3]),d=(s-i)*(a-o),p=(c-l)*(h-u);if(d<=0||p<=0)return 0;var f=Math.max(i,l),g=Math.max(o,u),m=Math.min(s,c),v=Math.min(a,h),b=Math.max(m-f,0)*Math.max(v-g,0);return b/(d+p-b)}function je(t,e){var n=function(t){var e=o.O(o.N(t,[1,0])),n=[o.F(e[2],e[0]),o.F(e[3],e[1])];return{sizes:n,centers:[o.c(e[0],o.k(n[0],o.y(2))),o.c(e[1],o.k(n[1],o.y(2)))]}}(t),r=n.sizes,i=n.centers,s=o.O(o.N(e,[1,0])),a=o.k(o.t(o.l(o.k(s[2],o.y(5))),r[0]),o.y(2)),l=o.c(o.t(o.k(s[0],o.y(10)),r[0]),i[0]),u=o.k(o.t(o.l(o.k(s[3],o.y(5))),r[1]),o.y(2)),c=o.c(o.t(o.k(s[1],o.y(10)),r[1]),i[1]);return o.N(o.E([o.F(l,a),o.F(c,u),o.c(l,a),o.c(c,u)]),[1,0])}function $e(t,e){return o.L(function(){var n=t.shape[0];return{boxPredictionEncoding:o.x(Dt(t,e.box_encoding_predictor),[n,-1,1,4]),classPrediction:o.x(Dt(t,e.class_predictor),[n,-1,3])}})}var Ue=function(){function t(t){var e=void 0===t?{}:t,n=e.minConfidence,r=e.maxResults;if(this._name="SsdMobilenetv1Options",this._minConfidence=n||.5,this._maxResults=r||100,"number"!=typeof this._minConfidence||this._minConfidence<=0||this._minConfidence>=1)throw new Error(this._name+" - expected minConfidence to be a number between 0 and 1");if("number"!=typeof this._maxResults)throw new Error(this._name+" - expected maxResults to be a number")}return Object.defineProperty(t.prototype,"minConfidence",{get:function(){return this._minConfidence},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"maxResults",{get:function(){return this._maxResults},enumerable:!0,configurable:!0}),t}(),Ve=function(t){function e(){return t.call(this,"SsdMobilenetv1")||this}return Object(a.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("SsdMobilenetv1 - load model before inference");return o.L(function(){var n=t.toBatchTensor(512,!1).toFloat(),r=Fe(o.F(o.t(n,o.y(.007843137718737125)),o.y(1)),e.mobilenetv1),i=function(t,e,n){return o.L(function(){var r=Le(Le(t,n.conv_0,[1,1]),n.conv_1,[2,2]),i=Le(Le(r,n.conv_2,[1,1]),n.conv_3,[2,2]),s=Le(Le(i,n.conv_4,[1,1]),n.conv_5,[2,2]),a=Le(Le(s,n.conv_6,[1,1]),n.conv_7,[2,2]),l=$e(e,n.box_predictor_0),u=$e(t,n.box_predictor_1),c=$e(r,n.box_predictor_2),h=$e(i,n.box_predictor_3),d=$e(s,n.box_predictor_4),p=$e(a,n.box_predictor_5);return{boxPredictions:o.h([l.boxPredictionEncoding,u.boxPredictionEncoding,c.boxPredictionEncoding,h.boxPredictionEncoding,d.boxPredictionEncoding,p.boxPredictionEncoding],1),classPredictions:o.h([l.classPrediction,u.classPrediction,c.classPrediction,h.classPrediction,d.classPrediction,p.classPrediction],1)}})}(r.out,r.conv11,e.prediction_layer);return function(t,e,n){return o.L(function(){var r=t.shape[0],i=je(o.x(o.M(n.extra_dim,[r,1,1]),[-1,4]),o.x(t,[-1,4]));i=o.x(i,[r,i.shape[0]/r,4]);var s=o.A(o.B(e,[0,0,1],[-1,-1,-1])),a=o.B(s,[0,0,0],[-1,-1,1]);return a=o.x(a,[r,a.shape[1]]),{boxes:o.O(i),scores:o.O(a)}})}(i.boxPredictions,i.classPredictions,e.output_layer)})},e.prototype.forward=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=this.forwardInput,[4,_t(t)];case 1:return[2,e.apply(this,[n.sent()])]}})})},e.prototype.locateFaces=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n,r,i,o,s,l,u,c,h,d,p,f,g,m,v,b,_,y,T,E;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=new Ue(e),r=n.maxResults,i=n.minConfidence,[4,_t(t)];case 1:for(o=a.sent(),s=this.forwardInput(o),l=s.boxes,u=s.scores,c=l[0],h=u[0],d=1;di}).sort(function(t,e){return e.score-t.score}).forEach(function(e){if(!(a.length>=s)){for(var n=e.score,o=a.length-1;o>=0;--o){var l=Be(t,e.boxIndex,a[o]);if(0!==l&&(e.score*=l<=r?1:0,e.score<=i))break}n===e.score&&a.push(e.boxIndex)}}),a}(c,p,r,.5,i),v=o.getReshapedInputDimensions(0),b=o.inputSize,_=b/v.width,y=b/v.height,T=c.arraySync(),E=m.map(function(t){var e=[Math.max(0,T[t][0]),Math.min(1,T[t][2])].map(function(t){return t*y}),n=e[0],r=e[1],i=[Math.max(0,T[t][1]),Math.min(1,T[t][3])].map(function(t){return t*_}),s=i[0],a=i[1];return new k(p[t],new P(s,n,a-s,r-n),{height:o.getInputHeight(0),width:o.getInputWidth(0)})}),c.dispose(),h.dispose(),[2,E]}})})},e.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},e.prototype.extractParamsFromWeigthMap=function(t){return Me(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=Ut(t),r=n.extractWeights,i=n.getRemainingWeights,s=De(r,e),a=s.extractMobilenetV1Params,l=s.extractPredictionLayerParams,u=a(),c=l(),h={extra_dim:o.J(r(20472),[1,5118,4])};if(e.push({paramPath:"output_layer/extra_dim"}),0!==i().length)throw new Error("weights remaing after extract: "+i().length);return{params:{mobilenetv1:u,prediction_layer:c,output_layer:h},paramMappings:e}}(t)},e}(It);function We(t){var e=new Ve;return e.extractWeights(t),e}function He(t){return We(t)}var Ge,ze=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e}(Ve),Xe=.4,Ke=[new x(.738768,.874946),new x(2.42204,2.65704),new x(4.30971,7.04493),new x(10.246,4.59428),new x(12.6868,11.8741)],Ye=[new x(1.603231,2.094468),new x(6.041143,7.080126),new x(2.882459,3.518061),new x(4.266906,5.178857),new x(9.041765,10.66308)],qe=[117.001,114.697,97.404],Je=function(t){return"number"==typeof t};function Ze(t){if(!t)throw new Error("invalid config: "+t);if("boolean"!=typeof t.withSeparableConvs)throw new Error("config.withSeparableConvs has to be a boolean, have: "+t.withSeparableConvs);if(!Je(t.iouThreshold)||t.iouThreshold<0||t.iouThreshold>1)throw new Error("config.iouThreshold has to be a number between [0, 1], have: "+t.iouThreshold);if(!Array.isArray(t.classes)||!t.classes.length||!t.classes.every(function(t){return"string"==typeof t}))throw new Error("config.classes has to be an array class names: string[], have: "+JSON.stringify(t.classes));if(!Array.isArray(t.anchors)||!t.anchors.length||!t.anchors.map(function(t){return t||{}}).every(function(t){return Je(t.x)&&Je(t.y)}))throw new Error("config.anchors has to be an array of { x: number, y: number }, have: "+JSON.stringify(t.anchors));if(t.meanRgb&&(!Array.isArray(t.meanRgb)||3!==t.meanRgb.length||!t.meanRgb.every(Je)))throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: "+JSON.stringify(t.meanRgb))}function Qe(t){return o.L(function(){var e=o.t(t,o.y(.10000000149011612));return o.c(o.w(o.F(t,e)),e)})}function tn(t,e){return o.L(function(){var n=o.v(t,[[0,0],[1,1],[1,1],[0,0]]);return n=o.i(n,e.conv.filters,[1,1],"valid"),n=o.F(n,e.bn.sub),n=o.t(n,e.bn.truediv),Qe(n=o.c(n,e.conv.bias))})}function en(t,e){return o.L(function(){var n=o.v(t,[[0,0],[1,1],[1,1],[0,0]]);return n=o.z(n,e.depthwise_filter,e.pointwise_filter,[1,1],"valid"),Qe(n=o.c(n,e.bias))})}function nn(t,e){var n=Lt(t,e);var r=Bt(t,e);return{extractConvParams:n,extractConvWithBatchNormParams:function(r,i,s){return{conv:n(r,i,3,s+"/conv"),bn:function(n,r){var i=o.H(t(n)),s=o.H(t(n));return e.push({paramPath:r+"/sub"},{paramPath:r+"/truediv"}),{sub:i,truediv:s}}(i,s+"/bn")}},extractSeparableConvParams:r}}function rn(t,e){var n=$t(t,e);function r(t){return{filters:n(t+"/filters",4),bias:n(t+"/bias",1)}}return{extractConvParams:r,extractConvWithBatchNormParams:function(t){return{conv:r(t+"/conv"),bn:function(t){return{sub:n(t+"/sub",1),truediv:n(t+"/truediv",1)}}(t+"/bn")}},extractSeparableConvParams:jt(n)}}!function(t){t[t.XS=224]="XS",t[t.SM=320]="SM",t[t.MD=416]="MD",t[t.LG=608]="LG"}(Ge||(Ge={}));var on=function(){function t(t){var e=void 0===t?{}:t,n=e.inputSize,r=e.scoreThreshold;if(this._name="TinyYolov2Options",this._inputSize=n||416,this._scoreThreshold=r||.5,"number"!=typeof this._inputSize||this._inputSize%32!=0)throw new Error(this._name+" - expected inputSize to be a number divisible by 32");if("number"!=typeof this._scoreThreshold||this._scoreThreshold<=0||this._scoreThreshold>=1)throw new Error(this._name+" - expected scoreThreshold to be a number between 0 and 1")}return Object.defineProperty(t.prototype,"inputSize",{get:function(){return this._inputSize},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scoreThreshold",{get:function(){return this._scoreThreshold},enumerable:!0,configurable:!0}),t}(),sn=function(t){function e(e){var n=t.call(this,"TinyYolov2")||this;return Ze(e),n._config=e,n}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"config",{get:function(){return this._config},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"withClassScores",{get:function(){return this.config.withClassScores||this.config.classes.length>1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"boxEncodingSize",{get:function(){return 5+(this.withClassScores?this.config.classes.length:0)},enumerable:!0,configurable:!0}),e.prototype.runTinyYolov2=function(t,e){var n=tn(t,e.conv0);return n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv1),n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv2),n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv3),n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv4),n=tn(n=o.s(n,[2,2],[2,2],"same"),e.conv5),Dt(n=tn(n=tn(n=o.s(n,[2,2],[1,1],"same"),e.conv6),e.conv7),e.conv8,"valid",!1)},e.prototype.runMobilenet=function(t,e){var n=this.config.isFirstLayerConv2d?Qe(Dt(t,e.conv0,"valid",!1)):en(t,e.conv0);return n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv1),n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv2),n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv3),n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv4),n=en(n=o.s(n,[2,2],[2,2],"same"),e.conv5),n=o.s(n,[2,2],[1,1],"same"),n=e.conv6?en(n,e.conv6):n,Dt(n=e.conv7?en(n,e.conv7):n,e.conv8,"valid",!1)},e.prototype.forwardInput=function(t,e){var n=this,r=this.params;if(!r)throw new Error("TinyYolov2 - load model before inference");return o.L(function(){var i=t.toBatchTensor(e,!1).toFloat();return i=(i=n.config.meanRgb?A(i,n.config.meanRgb):i).div(o.y(256)),n.config.withSeparableConvs?n.runMobilenet(i,r):n.runTinyYolov2(i,r)})},e.prototype.forward=function(t,e){return Object(a.b)(this,void 0,void 0,function(){var n;return Object(a.d)(this,function(r){switch(r.label){case 0:return n=this.forwardInput,[4,_t(t)];case 1:return[4,n.apply(this,[r.sent(),e])];case 2:return[2,r.sent()]}})})},e.prototype.detect=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n,r,i,s,l,u,c,h,d,p,f,g,m,v=this;return Object(a.d)(this,function(a){switch(a.label){case 0:return n=new on(e),r=n.inputSize,i=n.scoreThreshold,[4,_t(t)];case 1:return s=a.sent(),[4,this.forwardInput(s,r)];case 2:return l=a.sent(),u=o.L(function(){return o.O(l)[0].expandDims()}),c={width:s.getInputWidth(0),height:s.getInputHeight(0)},[4,this.extractBoxes(u,s.getReshapedInputDimensions(0),i)];case 3:return h=a.sent(),l.dispose(),u.dispose(),d=h.map(function(t){return t.box}),p=h.map(function(t){return t.score}),f=h.map(function(t){return t.classScore}),g=h.map(function(t){return v.config.classes[t.label]}),m=R(d.map(function(t){return t.rescale(r)}),p,this.config.iouThreshold,!0),[2,m.map(function(t){return new S(p[t],f[t],g[t],d[t],c)})]}})})},e.prototype.getDefaultModelName=function(){return""},e.prototype.extractParamsFromWeigthMap=function(t){return function(t,e){var n,r=[],i=rn(t,r),o=i.extractConvParams,s=i.extractConvWithBatchNormParams,a=i.extractSeparableConvParams;if(e.withSeparableConvs){var l=e.filterSizes&&e.filterSizes.length||9;n={conv0:e.isFirstLayerConv2d?o("conv0"):a("conv0"),conv1:a("conv1"),conv2:a("conv2"),conv3:a("conv3"),conv4:a("conv4"),conv5:a("conv5"),conv6:l>7?a("conv6"):void 0,conv7:l>8?a("conv7"):void 0,conv8:o("conv8")}}else n={conv0:s("conv0"),conv1:s("conv1"),conv2:s("conv2"),conv3:s("conv3"),conv4:s("conv4"),conv5:s("conv5"),conv6:s("conv6"),conv7:s("conv7"),conv8:o("conv8")};return Mt(t,r),{params:n,paramMappings:r}}(t,this.config)},e.prototype.extractParams=function(t){var n=this.config.filterSizes||e.DEFAULT_FILTER_SIZES,r=n?n.length:void 0;if(7!==r&&8!==r&&9!==r)throw new Error("TinyYolov2 - expected 7 | 8 | 9 convolutional filters, but found "+r+" filterSizes in config");return function(t,e,n,r){var i,o=Ut(t),s=o.extractWeights,a=o.getRemainingWeights,l=[],u=nn(s,l),c=u.extractConvParams,h=u.extractConvWithBatchNormParams,d=u.extractSeparableConvParams;if(e.withSeparableConvs){var p=r[0],f=r[1],g=r[2],m=r[3],v=r[4],b=r[5],_=r[6],y=r[7],T=r[8];i={conv0:e.isFirstLayerConv2d?c(p,f,3,"conv0"):d(p,f,"conv0"),conv1:d(f,g,"conv1"),conv2:d(g,m,"conv2"),conv3:d(m,v,"conv3"),conv4:d(v,b,"conv4"),conv5:d(b,_,"conv5"),conv6:y?d(_,y,"conv6"):void 0,conv7:T?d(y,T,"conv7"):void 0,conv8:c(T||y||_,5*n,1,"conv8")}}else p=r[0],f=r[1],g=r[2],m=r[3],v=r[4],b=r[5],_=r[6],y=r[7],T=r[8],i={conv0:h(p,f,"conv0"),conv1:h(f,g,"conv1"),conv2:h(g,m,"conv2"),conv3:h(m,v,"conv3"),conv4:h(v,b,"conv4"),conv5:h(b,_,"conv5"),conv6:h(_,y,"conv6"),conv7:h(y,T,"conv7"),conv8:c(T,5*n,1,"conv8")};if(0!==a().length)throw new Error("weights remaing after extract: "+a().length);return{params:i,paramMappings:l}}(t,this.config,this.boxEncodingSize,n)},e.prototype.extractBoxes=function(t,e,n){return Object(a.b)(this,void 0,void 0,function(){var r,i,s,l,u,c,h,d,p,f,g,m,v,b,_,y,T,E,x,w,S,k,O,I,R,A,N,D,L,P=this;return Object(a.d)(this,function(F){switch(F.label){case 0:return r=e.width,i=e.height,s=Math.max(r,i),l=s/r,u=s/i,c=t.shape[1],h=this.config.anchors.length,d=o.L(function(){var e=t.reshape([c,c,h,P.boxEncodingSize]);return[e.slice([0,0,0,0],[c,c,h,4]),e.slice([0,0,0,4],[c,c,h,1]),P.withClassScores?o.D(e.slice([0,0,0,5],[c,c,h,P.config.classes.length]),3):o.y(0)]}),p=d[0],f=d[1],g=d[2],m=[],[4,f.array()];case 1:return v=F.sent(),[4,p.array()];case 2:b=F.sent(),_=0,F.label=3;case 3:if(!(_n?(x=(y+M(b[_][y][T][0]))/c*l,w=(_+M(b[_][y][T][1]))/c*u,S=Math.exp(b[_][y][T][2])*this.config.anchors[T].x/c*l,k=Math.exp(b[_][y][T][3])*this.config.anchors[T].y/c*u,O=x-S/2,I=w-k/2,R={row:_,col:y,anchor:T},this.withClassScores?[4,this.extractPredictedClass(g,R)]:[3,7]):[3,9]):[3,10];case 6:return L=F.sent(),[3,8];case 7:L={classScore:1,label:0},F.label=8;case 8:N=(A=L).classScore,D=A.label,m.push(Object(a.a)({box:new C(O,I,O+S,I+k),score:E,classScore:E*N,label:D},R)),F.label=9;case 9:return T++,[3,5];case 10:return y++,[3,4];case 11:return _++,[3,3];case 12:return p.dispose(),f.dispose(),g.dispose(),[2,m]}})})},e.prototype.extractPredictedClass=function(t,e){return Object(a.b)(this,void 0,void 0,function(){var n,r,i,o;return Object(a.d)(this,function(s){switch(s.label){case 0:return n=e.row,r=e.col,i=e.anchor,[4,t.array()];case 1:return o=s.sent(),[2,Array(this.config.classes.length).fill(0).map(function(t,e){return o[n][r][i][e]}).map(function(t,e){return{classScore:t,label:e}}).reduce(function(t,e){return t.classScore>e.classScore?t:e})]}})})},e.DEFAULT_FILTER_SIZES=[3,16,32,64,128,256,512,1024,1024],e}(It),an=function(t){function e(e){void 0===e&&(e=!0);var n=Object.assign({},{withSeparableConvs:e,iouThreshold:Xe,classes:["face"]},e?{anchors:Ye,meanRgb:qe}:{anchors:Ke,withClassScores:!0});return t.call(this,n)||this}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"withSeparableConvs",{get:function(){return this.config.withSeparableConvs},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),e.prototype.locateFaces=function(t,e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.detect(t,e)];case 1:return[2,n.sent().map(function(t){return new k(t.score,t.relativeBox,{width:t.imageWidth,height:t.imageHeight})})]}})})},e.prototype.getDefaultModelName=function(){return this.withSeparableConvs?"tiny_yolov2_separable_conv_model":"tiny_yolov2_model"},e.prototype.extractParamsFromWeigthMap=function(e){return t.prototype.extractParamsFromWeigthMap.call(this,e)},e}(sn);function ln(t,e){void 0===e&&(e=!0);var n=new an(e);return n.extractWeights(t),n}var un=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._name="TinyFaceDetectorOptions",e}return Object(a.c)(e,t),e}(on),cn=function(){function t(){}return t.prototype.then=function(t){return Object(a.b)(this,void 0,void 0,function(){var e;return Object(a.d)(this,function(n){switch(n.label){case 0:return e=t,[4,this.run()];case 1:return[2,e.apply(void 0,[n.sent()])]}})})},t.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(t){throw new Error("ComposableTask - run is not implemented")})})},t}();function hn(t,e,n,r,i){return void 0===i&&(i=function(t){return t.alignedRect}),Object(a.b)(this,void 0,void 0,function(){var s,l,u,c,h;return Object(a.d)(this,function(a){switch(a.label){case 0:return s=t.map(function(t){return ee(t)?i(t):t.detection}),(u=r)?[3,5]:e instanceof o.a?[4,Tt(e,s)]:[3,2];case 1:return c=a.sent(),[3,4];case 2:return[4,yt(e,s)];case 3:c=a.sent(),a.label=4;case 4:u=c,a.label=5;case 5:return[4,n(l=u)];case 6:return h=a.sent(),l.forEach(function(t){return t instanceof o.a&&t.dispose()}),[2,h]}})})}function dn(t,e,n,r,i){return Object(a.b)(this,void 0,void 0,function(){var o=this;return Object(a.d)(this,function(s){return[2,hn([t],e,function(t){return Object(a.b)(o,void 0,void 0,function(){return Object(a.d)(this,function(e){return[2,n(t[0])]})})},r,i)]})})}var pn=2,fn=12;function gn(t){var e=Ut(t),n=e.extractWeights,r=e.getRemainingWeights,i=[],s=function(t,e){var n=Lt(t,e),r=Pt(t,e);function i(n,r){var i=o.H(t(n));return e.push({paramPath:r}),i}function s(t,e,r){return void 0===r&&(r=!1),{conv1:n(t[0],t[1],3,e+"/conv1"),prelu1_alpha:i(t[1],e+"/prelu1_alpha"),conv2:n(t[1],t[2],3,e+"/conv2"),prelu2_alpha:i(t[2],e+"/prelu2_alpha"),conv3:n(t[2],t[3],r?2:3,e+"/conv3"),prelu3_alpha:i(t[3],e+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=s([3,10,16,32],"pnet"),e=n(32,2,1,"pnet/conv4_1"),r=n(32,4,1,"pnet/conv4_2");return Object(a.a)(Object(a.a)({},t),{conv4_1:e,conv4_2:r})},extractRNetParams:function(){var t=s([3,28,48,64],"rnet",!0),e=r(576,128,"rnet/fc1"),n=i(128,"rnet/prelu4_alpha"),o=r(128,2,"rnet/fc2_1"),l=r(128,4,"rnet/fc2_2");return Object(a.a)(Object(a.a)({},t),{fc1:e,prelu4_alpha:n,fc2_1:o,fc2_2:l})},extractONetParams:function(){var t=s([3,32,64,64],"onet"),e=n(64,128,2,"onet/conv4"),o=i(128,"onet/prelu4_alpha"),l=r(1152,256,"onet/fc1"),u=i(256,"onet/prelu5_alpha"),c=r(256,2,"onet/fc2_1"),h=r(256,4,"onet/fc2_2"),d=r(256,10,"onet/fc2_3");return Object(a.a)(Object(a.a)({},t),{conv4:e,prelu4_alpha:o,fc1:l,prelu5_alpha:u,fc2_1:c,fc2_2:h,fc2_3:d})}}}(n,i),l=s.extractPNetParams,u=s.extractRNetParams,c=s.extractONetParams,h=l(),d=u(),p=c();if(0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{params:{pnet:h,rnet:d,onet:p},paramMappings:i}}function mn(t){var e=[],n=function(t,e){var n=$t(t,e);function r(t){return{filters:n(t+"/weights",4,t+"/filters"),bias:n(t+"/bias",1)}}function i(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}function o(t){return n(t,1)}function s(t){return{conv1:r(t+"/conv1"),prelu1_alpha:o(t+"/prelu1_alpha"),conv2:r(t+"/conv2"),prelu2_alpha:o(t+"/prelu2_alpha"),conv3:r(t+"/conv3"),prelu3_alpha:o(t+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=s("pnet"),e=r("pnet/conv4_1"),n=r("pnet/conv4_2");return Object(a.a)(Object(a.a)({},t),{conv4_1:e,conv4_2:n})},extractRNetParams:function(){var t=s("rnet"),e=i("rnet/fc1"),n=o("rnet/prelu4_alpha"),r=i("rnet/fc2_1"),l=i("rnet/fc2_2");return Object(a.a)(Object(a.a)({},t),{fc1:e,prelu4_alpha:n,fc2_1:r,fc2_2:l})},extractONetParams:function(){var t=s("onet"),e=r("onet/conv4"),n=o("onet/prelu4_alpha"),l=i("onet/fc1"),u=o("onet/prelu5_alpha"),c=i("onet/fc2_1"),h=i("onet/fc2_2"),d=i("onet/fc2_3");return Object(a.a)(Object(a.a)({},t),{conv4:e,prelu4_alpha:n,fc1:l,prelu5_alpha:u,fc2_1:c,fc2_2:h,fc2_3:d})}}}(t,e),r=n.extractPNetParams,i=n.extractRNetParams,o=n.extractONetParams,s=r(),l=i(),u=o();return Mt(t,e),{params:{pnet:s,rnet:l,onet:u},paramMappings:e}}function vn(t,e){var n=e[0],r=e[1];return{height:Math.floor(n*t),width:Math.floor(r*t)}}var bn=function(t){function e(e,n,r,i){return t.call(this,{left:e,top:n,right:r,bottom:i},!0)||this}return Object(a.c)(e,t),e}(w);function _n(t){return o.L(function(){return o.t(o.F(t,o.y(127.5)),o.y(.0078125))})}function yn(t,e){return o.L(function(){return o.c(o.w(t),o.t(e,o.u(o.w(o.u(t)))))})}function Tn(t,e,n){return void 0===n&&(n=!1),o.L(function(){var r=Dt(t,e.conv1,"valid");return r=yn(r,e.prelu1_alpha),r=yn(r=Dt(r=o.s(r,n?[2,2]:[3,3],[2,2],"same"),e.conv2,"valid"),e.prelu2_alpha),r=yn(r=Dt(r=n?r:o.s(r,[3,3],[2,2],"valid"),e.conv3,"valid"),e.prelu3_alpha)})}function En(t,e,n,r,i){i.stage1=[];var s=e.map(function(e){return o.L(function(){var n={scale:e},i=function(t,e){return o.L(function(){var n=vn(e,t.shape.slice(1)),r=n.height,i=n.width,s=_n(o.o.resizeBilinear(t,[r,i]));return o.N(s,[0,2,1,3])})}(t,e),s=Date.now(),a=function(t,e){return o.L(function(){var n=Tn(t,e,!0),r=Dt(n,e.conv4_1,"valid"),i=o.m(o.r(r,3),3);return{prob:o.D(o.F(r,i),3),regions:Dt(n,e.conv4_2,"valid")}})}(i,r),l=a.prob,u=a.regions;return n.pnet=Date.now()-s,{scoresTensor:o.O(o.O(l,3)[1])[0],regionsTensor:o.O(u)[0],scale:e,statsForScale:n}})}).map(function(t){var e=t.scoresTensor,r=t.regionsTensor,o=t.scale,s=t.statsForScale,a=function(t,e,n,r){for(var i=[],o=t.arraySync(),s=0;s=r&&i.push(new x(a,s));return i.map(function(t){var r=new C(Math.round((t.y*pn+1)/n),Math.round((t.x*pn+1)/n),Math.round((t.y*pn+fn)/n),Math.round((t.x*pn+fn)/n)),i=o[t.y][t.x],s=e.arraySync();return{cell:r,score:i,region:new bn(s[t.y][t.x][0],s[t.y][t.x][1],s[t.y][t.x][2],s[t.y][t.x][3])}})}(e,r,o,n);if(e.dispose(),r.dispose(),!a.length)return i.stage1.push(s),[];var l=Date.now(),u=R(a.map(function(t){return t.cell}),a.map(function(t){return t.score}),.5);return s.nms=Date.now()-l,s.numBoxes=u.length,i.stage1.push(s),u.map(function(t){return a[t]})}).reduce(function(t,e){return t.concat(e)},[]),a=[],l=[];if(s.length>0){var u=Date.now(),c=R(s.map(function(t){return t.cell}),s.map(function(t){return t.score}),.7);i.stage1_nms=Date.now()-u,l=c.map(function(t){return s[t].score}),a=c.map(function(t){return s[t]}).map(function(t){var e=t.cell,n=t.region;return new C(e.left+n.left*e.width,e.top+n.top*e.height,e.right+n.right*e.width,e.bottom+n.bottom*e.height).toSquare().round()})}return{boxes:a,scores:l}}function xn(t,e,n){var r=n.width,i=n.height;return Object(a.b)(this,void 0,void 0,function(){var n,s,l,u=this;return Object(a.d)(this,function(c){switch(c.label){case 0:return n=rt(t),[4,Promise.all(e.map(function(e){return Object(a.b)(u,void 0,void 0,function(){var r,i,o,s,l,u,c,h;return Object(a.d)(this,function(a){return r=e.padAtBorders(t.height,t.width),i=r.y,o=r.ey,s=r.x,l=r.ex,u=s-1,c=i-1,h=n.getImageData(u,c,l-u,o-c),[2,et.isNodejs()?ft(h):createImageBitmap(h)]})})}))];case 1:return s=c.sent(),l=[],s.forEach(function(t){var e=rt(pt({width:r,height:i}));e.drawImage(t,0,0,r,i);for(var n=e.getImageData(0,0,r,i).data,o=[],s=0;s1?o.h(u.map(function(t){return t.scores})):u[0].scores,p=(d=Array).from,[4,c.data()];case 2:return h=p.apply(d,[a.sent()]),c.dispose(),f=h.map(function(t,e){return{score:t,idx:e}}).filter(function(t){return t.score>n}).map(function(t){return t.idx}),g=f.map(function(t){return e[t]}),m=f.map(function(t){return h[t]}),v=[],b=[],g.length>0&&(s=Date.now(),_=R(g,m,.7),i.stage2_nms=Date.now()-s,y=_.map(function(t){var e=u[f[t]].regions.arraySync();return new bn(e[0][0],e[0][1],e[0][2],e[0][3])}),b=_.map(function(t){return m[t]}),v=_.map(function(t,e){return g[t].calibrate(y[e])})),u.forEach(function(t){t.regions.dispose(),t.scores.dispose()}),[2,{boxes:v,scores:b}]}})})}function Cn(t,e,n,r,i){return Object(a.b)(this,void 0,void 0,function(){var s,l,u,c,h,d,p,f,g,m,v,b,_,y,T;return Object(a.d)(this,function(a){switch(a.label){case 0:return s=Date.now(),[4,xn(t,e,{width:48,height:48})];case 1:return l=a.sent(),i.stage3_extractImagePatches=Date.now()-s,s=Date.now(),u=l.map(function(t){var e=function(t,e){return o.L(function(){var n=Tn(t,e);n=yn(n=Dt(n=o.s(n,[2,2],[2,2],"same"),e.conv4,"valid"),e.prelu4_alpha);var r=yn(zt(o.x(n,[n.shape[0],e.fc1.weights.shape[0]]),e.fc1),e.prelu5_alpha),i=zt(r,e.fc2_1),s=o.m(o.r(i,1),1),a=o.D(o.F(i,s),1),l=zt(r,e.fc2_2),u=zt(r,e.fc2_3);return{scores:o.O(a,1)[1],regions:l,points:u}})}(t,r);return t.dispose(),e}),i.stage3_onet=Date.now()-s,c=u.length>1?o.h(u.map(function(t){return t.scores})):u[0].scores,p=(d=Array).from,[4,c.data()];case 2:return h=p.apply(d,[a.sent()]),c.dispose(),f=h.map(function(t,e){return{score:t,idx:e}}).filter(function(t){return t.score>n}).map(function(t){return t.idx}),g=f.map(function(t){var e=u[t].regions.arraySync();return new bn(e[0][0],e[0][1],e[0][2],e[0][3])}),m=f.map(function(t,n){return e[t].calibrate(g[n])}),v=f.map(function(t){return h[t]}),b=[],_=[],y=[],m.length>0&&(s=Date.now(),T=R(m,v,.7,!1),i.stage3_nms=Date.now()-s,b=T.map(function(t){return m[t]}),_=T.map(function(t){return v[t]}),y=T.map(function(t,e){return Array(5).fill(0).map(function(n,r){var i=u[t].points.arraySync();return new x(i[0][r]*(b[e].width+1)+b[e].left,i[0][r+5]*(b[e].height+1)+b[e].top)})})),u.forEach(function(t){t.regions.dispose(),t.scores.dispose(),t.points.dispose()}),[2,{boxes:b,scores:_,points:y}]}})})}var Sn=function(t){function e(){return t.call(this,"Mtcnn")||this}return Object(a.c)(e,t),e.prototype.load=function(e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){return console.warn("mtcnn is deprecated and will be removed soon"),[2,t.prototype.load.call(this,e)]})})},e.prototype.loadFromDisk=function(e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){return console.warn("mtcnn is deprecated and will be removed soon"),[2,t.prototype.loadFromDisk.call(this,e)]})})},e.prototype.forwardInput=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n,r,i,s,l,u,c,h,d,p,f,g,m,v,b,_,y,T,E,w,C;return Object(a.d)(this,function(a){switch(a.label){case 0:if(!(n=this.params))throw new Error("Mtcnn - load model before inference");if(!(r=t.canvases[0]))throw new Error("Mtcnn - inputCanvas is not defined, note that passing tensors into Mtcnn.forwardInput is not supported yet.");return i={},s=Date.now(),l=o.L(function(){return t=o.m(o.f.fromPixels(r)).toFloat(),o.L(function(){return o.E(o.O(t,3).reverse(),3)});var t}),u=function(t){return l.dispose(),i.total=Date.now()-s,t},c=l.shape.slice(1),h=c[0],d=c[1],p=new Ne(e),f=p.minFaceSize,g=p.scaleFactor,m=p.maxNumScales,v=p.scoreThresholds,b=p.scaleSteps,_=(b||function(t,e,n){for(var r=n[0],i=n[1],o=fn/t,s=[],a=Math.min(r,i)*o,l=0;a>=12;)s.push(o*Math.pow(e,l)),a*=e,l+=1;return s}(f,g,[h,d])).filter(function(t){var e=vn(t,[h,d]);return Math.min(e.width,e.height)>fn}).slice(0,m),i.scales=_,i.pyramid=_.map(function(t){return vn(t,[h,d])}),y=Date.now(),[4,En(l,_,v[0],n.pnet,i)];case 1:return T=a.sent(),i.total_stage1=Date.now()-y,T.boxes.length?(i.stage2_numInputBoxes=T.boxes.length,y=Date.now(),[4,wn(r,T.boxes,v[1],n.rnet,i)]):[2,u({results:[],stats:i})];case 2:return E=a.sent(),i.total_stage2=Date.now()-y,E.boxes.length?(i.stage3_numInputBoxes=E.boxes.length,y=Date.now(),[4,Cn(r,E.boxes,v[2],n.onet,i)]):[2,u({results:[],stats:i})];case 3:return w=a.sent(),i.total_stage3=Date.now()-y,C=w.boxes.map(function(t,e){return ne(G({},new k(w.scores[e],new P(t.left/d,t.top/h,t.width/d,t.height/h),{height:h,width:d})),new B(w.points[e].map(function(e){return e.sub(new x(t.left,t.top)).div(new x(t.width,t.height))}),{width:t.width,height:t.height}))}),[2,u({results:C,stats:i})]}})})},e.prototype.forward=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n;return Object(a.d)(this,function(r){switch(r.label){case 0:return n=this.forwardInput,[4,_t(t)];case 1:return[4,n.apply(this,[r.sent(),e])];case 2:return[2,r.sent().results]}})})},e.prototype.forwardWithStats=function(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){var n;return Object(a.d)(this,function(r){switch(r.label){case 0:return n=this.forwardInput,[4,_t(t)];case 1:return[2,n.apply(this,[r.sent(),e])]}})})},e.prototype.getDefaultModelName=function(){return"mtcnn_model"},e.prototype.extractParamsFromWeigthMap=function(t){return mn(t)},e.prototype.extractParams=function(t){return gn(t)},e}(It),kn=.4,On=[new x(1.603231,2.094468),new x(6.041143,7.080126),new x(2.882459,3.518061),new x(4.266906,5.178857),new x(9.041765,10.66308)],In=[117.001,114.697,97.404],Rn=function(t){function e(){var e={withSeparableConvs:!0,iouThreshold:kn,classes:["face"],anchors:On,meanRgb:In,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return t.call(this,e)||this}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"anchors",{get:function(){return this.config.anchors},enumerable:!0,configurable:!0}),e.prototype.locateFaces=function(t,e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.detect(t,e)];case 1:return[2,n.sent().map(function(t){return new k(t.score,t.relativeBox,{width:t.imageWidth,height:t.imageHeight})})]}})})},e.prototype.getDefaultModelName=function(){return"tiny_face_detector_model"},e.prototype.extractParamsFromWeigthMap=function(e){return t.prototype.extractParamsFromWeigthMap.call(this,e)},e}(sn),An={ssdMobilenetv1:new Ve,tinyFaceDetector:new Rn,tinyYolov2:new an,mtcnn:new Sn,faceLandmark68Net:new fe,faceLandmark68TinyNet:new me,faceRecognitionNet:new Ce,faceExpressionNet:new Jt,ageGenderNet:new de},Nn=function(t,e){return An.ssdMobilenetv1.locateFaces(t,e)},Dn=function(t,e){return An.tinyFaceDetector.locateFaces(t,e)},Mn=function(t,e){return An.tinyYolov2.locateFaces(t,e)},Ln=function(t,e){return An.mtcnn.forward(t,e)},Pn=function(t){return An.faceLandmark68Net.detectLandmarks(t)},Fn=function(t){return An.faceLandmark68TinyNet.detectLandmarks(t)},Bn=function(t){return An.faceRecognitionNet.computeFaceDescriptor(t)},jn=function(t){return An.faceExpressionNet.predictExpressions(t)},$n=function(t){return An.ageGenderNet.predictAgeAndGender(t)},Un=function(t){return An.ssdMobilenetv1.load(t)},Vn=function(t){return An.tinyFaceDetector.load(t)},Wn=function(t){return An.mtcnn.load(t)},Hn=function(t){return An.tinyYolov2.load(t)},Gn=function(t){return An.faceLandmark68Net.load(t)},zn=function(t){return An.faceLandmark68TinyNet.load(t)},Xn=function(t){return An.faceRecognitionNet.load(t)},Kn=function(t){return An.faceExpressionNet.load(t)},Yn=function(t){return An.ageGenderNet.load(t)},qn=Un,Jn=Nn,Zn=Pn,Qn=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parentTask=e,i.input=n,i.extractedFaces=r,i}return Object(a.c)(e,t),e}(cn),tr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n=this;return Object(a.d)(this,function(r){switch(r.label){case 0:return[4,this.parentTask];case 1:return[4,hn(t=r.sent(),this.input,function(t){return Object(a.b)(n,void 0,void 0,function(){return Object(a.d)(this,function(e){switch(e.label){case 0:return[4,Promise.all(t.map(function(t){return An.faceExpressionNet.predictExpressions(t)}))];case 1:return[2,e.sent()]}})})},this.extractedFaces)];case 2:return e=r.sent(),[2,t.map(function(t,n){return Qt(t,e[n])})]}})})},e.prototype.withAgeAndGender=function(){return new or(this,this.input)},e}(Qn),er=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.parentTask];case 1:return(t=n.sent())?[4,dn(t,this.input,function(t){return An.faceExpressionNet.predictExpressions(t)},this.extractedFaces)]:[2];case 2:return e=n.sent(),[2,Qt(t,e)]}})})},e.prototype.withAgeAndGender=function(){return new sr(this,this.input)},e}(Qn),nr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.withAgeAndGender=function(){return new ar(this,this.input)},e.prototype.withFaceDescriptors=function(){return new cr(this,this.input)},e}(tr),rr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.withAgeAndGender=function(){return new lr(this,this.input)},e.prototype.withFaceDescriptor=function(){return new hr(this,this.input)},e}(er),ir=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parentTask=e,i.input=n,i.extractedFaces=r,i}return Object(a.c)(e,t),e}(cn),or=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n=this;return Object(a.d)(this,function(r){switch(r.label){case 0:return[4,this.parentTask];case 1:return[4,hn(t=r.sent(),this.input,function(t){return Object(a.b)(n,void 0,void 0,function(){return Object(a.d)(this,function(e){switch(e.label){case 0:return[4,Promise.all(t.map(function(t){return An.ageGenderNet.predictAgeAndGender(t)}))];case 1:return[2,e.sent()]}})})},this.extractedFaces)];case 2:return e=r.sent(),[2,t.map(function(t,n){var r=e[n],i=r.age;return Ie(Ae(t,r.gender,r.genderProbability),i)})]}})})},e.prototype.withFaceExpressions=function(){return new tr(this,this.input)},e}(ir),sr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n,r,i;return Object(a.d)(this,function(o){switch(o.label){case 0:return[4,this.parentTask];case 1:return(t=o.sent())?[4,dn(t,this.input,function(t){return An.ageGenderNet.predictAgeAndGender(t)},this.extractedFaces)]:[2];case 2:return e=o.sent(),n=e.age,r=e.gender,i=e.genderProbability,[2,Ie(Ae(t,r,i),n)]}})})},e.prototype.withFaceExpressions=function(){return new er(this,this.input)},e}(ir),ar=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.withFaceExpressions=function(){return new nr(this,this.input)},e.prototype.withFaceDescriptors=function(){return new cr(this,this.input)},e}(or),lr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.withFaceExpressions=function(){return new rr(this,this.input)},e.prototype.withFaceDescriptor=function(){return new hr(this,this.input)},e}(sr),ur=function(t){function e(e,n){var r=t.call(this)||this;return r.parentTask=e,r.input=n,r}return Object(a.c)(e,t),e}(cn),cr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t;return Object(a.d)(this,function(e){switch(e.label){case 0:return[4,this.parentTask];case 1:return[4,hn(t=e.sent(),this.input,function(t){return Promise.all(t.map(function(t){return An.faceRecognitionNet.computeFaceDescriptor(t)}))},null,function(t){return t.landmarks.align(null,{useDlibAlignment:!0})})];case 2:return[2,e.sent().map(function(e,n){return ke(t[n],e)})]}})})},e.prototype.withFaceExpressions=function(){return new nr(this,this.input)},e.prototype.withAgeAndGender=function(){return new ar(this,this.input)},e}(ur),hr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.parentTask];case 1:return(t=n.sent())?[4,dn(t,this.input,function(t){return An.faceRecognitionNet.computeFaceDescriptor(t)},null,function(t){return t.landmarks.align(null,{useDlibAlignment:!0})})]:[2];case 2:return e=n.sent(),[2,ke(t,e)]}})})},e.prototype.withFaceExpressions=function(){return new rr(this,this.input)},e.prototype.withAgeAndGender=function(){return new lr(this,this.input)},e}(ur),dr=function(t){function e(e,n,r){var i=t.call(this)||this;return i.parentTask=e,i.input=n,i.useTinyLandmarkNet=r,i}return Object(a.c)(e,t),Object.defineProperty(e.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?An.faceLandmark68TinyNet:An.faceLandmark68Net},enumerable:!0,configurable:!0}),e}(cn),pr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n,r,i,s=this;return Object(a.d)(this,function(a){switch(a.label){case 0:return[4,this.parentTask];case 1:return t=a.sent(),e=t.map(function(t){return t.detection}),this.input instanceof o.a?[4,Tt(this.input,e)]:[3,3];case 2:return r=a.sent(),[3,5];case 3:return[4,yt(this.input,e)];case 4:r=a.sent(),a.label=5;case 5:return n=r,[4,Promise.all(n.map(function(t){return s.landmarkNet.detectLandmarks(t)}))];case 6:return i=a.sent(),n.forEach(function(t){return t instanceof o.a&&t.dispose()}),[2,t.map(function(t,e){return ne(t,i[e])})]}})})},e.prototype.withFaceExpressions=function(){return new nr(this,this.input)},e.prototype.withAgeAndGender=function(){return new ar(this,this.input)},e.prototype.withFaceDescriptors=function(){return new cr(this,this.input)},e}(dr),fr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n,r,i;return Object(a.d)(this,function(s){switch(s.label){case 0:return[4,this.parentTask];case 1:return(t=s.sent())?(e=t.detection,this.input instanceof o.a?[4,Tt(this.input,[e])]:[3,3]):[2];case 2:return r=s.sent(),[3,5];case 3:return[4,yt(this.input,[e])];case 4:r=s.sent(),s.label=5;case 5:return n=r,[4,this.landmarkNet.detectLandmarks(n[0])];case 6:return i=s.sent(),n.forEach(function(t){return t instanceof o.a&&t.dispose()}),[2,ne(t,i)]}})})},e.prototype.withFaceExpressions=function(){return new rr(this,this.input)},e.prototype.withAgeAndGender=function(){return new lr(this,this.input)},e.prototype.withFaceDescriptor=function(){return new hr(this,this.input)},e}(dr),gr=function(t){function e(e,n){void 0===n&&(n=new Ue);var r=t.call(this)||this;return r.input=e,r.options=n,r}return Object(a.c)(e,t),e}(cn),mr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e,n,r;return Object(a.d)(this,function(i){switch(i.label){case 0:return e=(t=this).input,(n=t.options)instanceof Ne?[4,An.mtcnn.forward(e,n)]:[3,2];case 1:return[2,i.sent().map(function(t){return t.detection})];case 2:if(!(r=n instanceof un?function(t){return An.tinyFaceDetector.locateFaces(t,n)}:n instanceof Ue?function(t){return An.ssdMobilenetv1.locateFaces(t,n)}:n instanceof on?function(t){return An.tinyYolov2.locateFaces(t,n)}:null))throw new Error("detectFaces - expected options to be instance of TinyFaceDetectorOptions | SsdMobilenetv1Options | MtcnnOptions | TinyYolov2Options");return[2,r(e)]}})})},e.prototype.runAndExtendWithFaceDetections=function(){var t=this;return new Promise(function(e){return Object(a.b)(t,void 0,void 0,function(){var t;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.run()];case 1:return t=n.sent(),[2,e(t.map(function(t){return G({},t)}))]}})})})},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new pr(this.runAndExtendWithFaceDetections(),this.input,t)},e.prototype.withFaceExpressions=function(){return new tr(this.runAndExtendWithFaceDetections(),this.input)},e.prototype.withAgeAndGender=function(){return new or(this.runAndExtendWithFaceDetections(),this.input)},e}(gr),vr=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(a.c)(e,t),e.prototype.run=function(){return Object(a.b)(this,void 0,void 0,function(){var t,e;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,new mr(this.input,this.options)];case 1:return t=n.sent(),e=t[0],t.forEach(function(t){t.score>e.score&&(e=t)}),[2,e]}})})},e.prototype.runAndExtendWithFaceDetection=function(){var t=this;return new Promise(function(e){return Object(a.b)(t,void 0,void 0,function(){var t;return Object(a.d)(this,function(n){switch(n.label){case 0:return[4,this.run()];case 1:return t=n.sent(),[2,e(t?G({},t):void 0)]}})})})},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new fr(this.runAndExtendWithFaceDetection(),this.input,t)},e.prototype.withFaceExpressions=function(){return new er(this.runAndExtendWithFaceDetection(),this.input)},e.prototype.withAgeAndGender=function(){return new sr(this.runAndExtendWithFaceDetection(),this.input)},e}(gr);function br(t,e){return void 0===e&&(e=new Ue),new vr(t,e)}function _r(t,e){return void 0===e&&(e=new Ue),new mr(t,e)}function yr(t,e){return Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return console.warn("allFacesSsdMobilenetv1 is deprecated and will be removed soon, use the high level api instead"),[4,_r(t,new Ue(e?{minConfidence:e}:{})).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}function Tr(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return console.warn("allFacesTinyYolov2 is deprecated and will be removed soon, use the high level api instead"),[4,_r(t,new on(e)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}function Er(t,e){return void 0===e&&(e={}),Object(a.b)(this,void 0,void 0,function(){return Object(a.d)(this,function(n){switch(n.label){case 0:return console.warn("allFacesMtcnn is deprecated and will be removed soon, use the high level api instead"),[4,_r(t,new Ne(e)).withFaceLandmarks().withFaceDescriptors()];case 1:return[2,n.sent()]}})})}var xr=yr;function wr(t,e){if(t.length!==e.length)throw new Error("euclideanDistance: arr1.length !== arr2.length");var n=Array.from(t),r=Array.from(e);return Math.sqrt(n.map(function(t,e){return t-r[e]}).reduce(function(t,e){return t+Math.pow(e,2)},0))}var Cr=function(){function t(t,e){void 0===e&&(e=.6),this._distanceThreshold=e;var n=Array.isArray(t)?t:[t];if(!n.length)throw new Error("FaceRecognizer.constructor - expected atleast one input");var r=1,i=function(){return"person "+r++};this._labeledDescriptors=n.map(function(t){if(t instanceof V)return t;if(t instanceof Float32Array)return new V(i(),[t]);if(t.descriptor&&t.descriptor instanceof Float32Array)return new V(i(),[t.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor | Float32Array | Array | Float32Array>")})}return Object.defineProperty(t.prototype,"labeledDescriptors",{get:function(){return this._labeledDescriptors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"distanceThreshold",{get:function(){return this._distanceThreshold},enumerable:!0,configurable:!0}),t.prototype.computeMeanDistance=function(t,e){return e.map(function(e){return wr(e,t)}).reduce(function(t,e){return t+e},0)/(e.length||1)},t.prototype.matchDescriptor=function(t){var e=this;return this.labeledDescriptors.map(function(n){var r=n.descriptors,i=n.label;return new $(i,e.computeMeanDistance(t,r))}).reduce(function(t,e){return t.distance1&&void 0!==arguments[1]?arguments[1]:1,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;l||(l=document.createElement("textarea"),document.body.appendChild(l));var r=function(t){var e=window.getComputedStyle(t),n=e.getPropertyValue("box-sizing"),r=parseFloat(e.getPropertyValue("padding-bottom"))+parseFloat(e.getPropertyValue("padding-top")),i=parseFloat(e.getPropertyValue("border-bottom-width"))+parseFloat(e.getPropertyValue("border-top-width"));return{contextStyle:c.map(function(t){return t+":"+e.getPropertyValue(t)}).join(";"),paddingSize:r,borderSize:i,boxSizing:n}}(t),i=r.paddingSize,o=r.borderSize,s=r.boxSizing,a=r.contextStyle;l.setAttribute("style",a+";"+u),l.value=t.value||t.placeholder||"";var h=l.scrollHeight,d={};"border-box"===s?h+=o:"content-box"===s&&(h-=i),l.value="";var p=l.scrollHeight-i;if(null!==e){var f=p*e;"border-box"===s&&(f=f+i+o),h=Math.max(f,h),d.minHeight=f+"px"}if(null!==n){var g=p*n;"border-box"===s&&(g=g+i+o),h=Math.min(g,h)}return d.height=h+"px",l.parentNode&&l.parentNode.removeChild(l),l=null,d}var d=n(9),p=n.n(d),f=n(21),g={name:"ElInput",componentName:"ElInput",mixins:[o.a,a.a],inheritAttrs:!1,inject:{elForm:{default:""},elFormItem:{default:""}},data:function(){return{textareaCalcStyle:{},hovering:!1,focused:!1,isComposing:!1,passwordVisible:!1}},props:{value:[String,Number],size:String,resize:String,form:String,disabled:Boolean,readonly:Boolean,type:{type:String,default:"text"},autosize:{type:[Boolean,Object],default:!1},autocomplete:{type:String,default:"off"},autoComplete:{type:String,validator:function(t){return!0}},validateEvent:{type:Boolean,default:!0},suffixIcon:String,prefixIcon:String,label:String,clearable:{type:Boolean,default:!1},showPassword:{type:Boolean,default:!1},showWordLimit:{type:Boolean,default:!1},tabindex:String},computed:{_elFormItemSize:function(){return(this.elFormItem||{}).elFormItemSize},validateState:function(){return this.elFormItem?this.elFormItem.validateState:""},needStatusIcon:function(){return!!this.elForm&&this.elForm.statusIcon},validateIcon:function(){return{validating:"el-icon-loading",success:"el-icon-circle-check",error:"el-icon-circle-close"}[this.validateState]},textareaStyle:function(){return p()({},this.textareaCalcStyle,{resize:this.resize})},inputSize:function(){return this.size||this._elFormItemSize||(this.$ELEMENT||{}).size},inputDisabled:function(){return this.disabled||(this.elForm||{}).disabled},nativeInputValue:function(){return null===this.value||void 0===this.value?"":String(this.value)},showClear:function(){return this.clearable&&!this.inputDisabled&&!this.readonly&&this.nativeInputValue&&(this.focused||this.hovering)},showPwdVisible:function(){return this.showPassword&&!this.inputDisabled&&!this.readonly&&(!!this.nativeInputValue||this.focused)},isWordLimitVisible:function(){return this.showWordLimit&&this.$attrs.maxlength&&("text"===this.type||"textarea"===this.type)&&!this.inputDisabled&&!this.readonly&&!this.showPassword},upperLimit:function(){return this.$attrs.maxlength},textLength:function(){return"number"==typeof this.value?String(this.value).length:(this.value||"").length},inputExceed:function(){return this.isWordLimitVisible&&this.textLength>this.upperLimit}},watch:{value:function(t){this.$nextTick(this.resizeTextarea),this.validateEvent&&this.dispatch("ElFormItem","el.form.change",[t])},nativeInputValue:function(){this.setNativeInputValue()},type:function(){var t=this;this.$nextTick(function(){t.setNativeInputValue(),t.resizeTextarea(),t.updateIconOffset()})}},methods:{focus:function(){this.getInput().focus()},blur:function(){this.getInput().blur()},getMigratingConfig:function(){return{props:{icon:"icon is removed, use suffix-icon / prefix-icon instead.","on-icon-click":"on-icon-click is removed."},events:{click:"click is removed."}}},handleBlur:function(t){this.focused=!1,this.$emit("blur",t),this.validateEvent&&this.dispatch("ElFormItem","el.form.blur",[this.value])},select:function(){this.getInput().select()},resizeTextarea:function(){if(!this.$isServer){var t=this.autosize;if("textarea"===this.type)if(t){var e=t.minRows,n=t.maxRows;this.textareaCalcStyle=h(this.$refs.textarea,e,n)}else this.textareaCalcStyle={minHeight:h(this.$refs.textarea).minHeight}}},setNativeInputValue:function(){var t=this.getInput();t&&t.value!==this.nativeInputValue&&(t.value=this.nativeInputValue)},handleFocus:function(t){this.focused=!0,this.$emit("focus",t)},handleCompositionStart:function(){this.isComposing=!0},handleCompositionUpdate:function(t){var e=t.target.value,n=e[e.length-1]||"";this.isComposing=!Object(f.isKorean)(n)},handleCompositionEnd:function(t){this.isComposing&&(this.isComposing=!1,this.handleInput(t))},handleInput:function(t){this.isComposing||t.target.value!==this.nativeInputValue&&(this.$emit("input",t.target.value),this.$nextTick(this.setNativeInputValue))},handleChange:function(t){this.$emit("change",t.target.value)},calcIconOffset:function(t){var e=[].slice.call(this.$el.querySelectorAll(".el-input__"+t)||[]);if(e.length){for(var n=null,r=0;r`Error in ${t}: pad must be an integer when using `+`dimRoundingMode ${n} but got pad ${e}.`);else{if("object"!=typeof e)throw Error(`Error in ${t}: Unknown padding parameter: ${e}`);e.forEach(e=>{e.forEach(e=>{r.assert(r.isInt(e),()=>`Error in ${t}: pad must be an integer when using `+`dimRoundingMode ${n} but got pad ${e}.`)})})}}};var r=n("XFvI");function i(t,e,n,r,i,o,l=!1,h="channelsLast"){let[d,p,f,g]=[-1,-1,-1,-1];if("channelsLast"===h)[d,p,f,g]=t;else{if("channelsFirst"!==h)throw new Error(`Unknown dataFormat ${h}`);[d,g,p,f]=t}const[m,v,,b]=e,[_,y]=a(n),[T,E]=a(r),x=u(m,T),w=u(v,E),{padInfo:C,outHeight:S,outWidth:k}=function(t,e,n,r,i,o,a,l,u){let h,d,p;if("number"==typeof t){const i=0===t?"VALID":"NUMBER";h={top:t,bottom:t,left:t,right:t,type:i};const a=function(t,e,n,r,i){null==r&&(r=s(t,e,n));const o=t[0],a=t[1],l=c((o-e+2*r)/n+1,i),u=c((a-e+2*r)/n+1,i);return[l,u]}([e,n],o,r,t,l);d=a[0],p=a[1]}else if("same"===t){d=Math.ceil(e/r),p=Math.ceil(n/i);const t=Math.max(0,(d-1)*r+o-e),s=Math.max(0,(p-1)*i+a-n),l=Math.floor(t/2),u=t-l,c=Math.floor(s/2),f=s-c;h={top:l,bottom:u,left:c,right:f,type:"SAME"}}else if("valid"===t)h={top:0,bottom:0,left:0,right:0,type:"VALID"},d=Math.ceil((e-o+1)/r),p=Math.ceil((n-a+1)/i);else{if("object"!=typeof t)throw Error(`Unknown padding parameter: ${t}`);{const s="channelsLast"===u?t[1][0]:t[2][0],f="channelsLast"===u?t[1][1]:t[2][1],g="channelsLast"===u?t[2][0]:t[3][0],m="channelsLast"===u?t[2][1]:t[3][1],v=0===s&&0===f&&0===g&&0===m?"VALID":"EXPLICIT";h={top:s,bottom:f,left:g,right:m,type:v},d=c((e-o+s+f)/r+1,l),p=c((n-a+g+m)/i+1,l)}}return{padInfo:h,outHeight:d,outWidth:p}}(i,p,f,_,y,x,w,o,h),O=l?b*g:b;let I;return"channelsFirst"===h?I=[d,O,S,k]:"channelsLast"===h&&(I=[d,S,k,O]),{batchSize:d,dataFormat:h,inHeight:p,inWidth:f,inChannels:g,outHeight:S,outWidth:k,outChannels:O,padInfo:C,strideHeight:_,strideWidth:y,filterHeight:m,filterWidth:v,effectiveFilterHeight:x,effectiveFilterWidth:w,dilationHeight:T,dilationWidth:E,inShape:t,outShape:I,filterShape:e}}function o(t,e,n,r,i,o=!1,a="channelsLast",h){let[d,p,f,g,m]=[-1,-1,-1,-1,-1];if("channelsLast"===a)[d,p,f,g,m]=t;else{if("channelsFirst"!==a)throw new Error(`Unknown dataFormat ${a}`);[d,m,p,f,g]=t}const[v,b,_,,y]=e,[T,E,x]=l(n),[w,C,S]=l(r),k=u(v,w),O=u(b,C),I=u(_,S),{padInfo:R,outDepth:A,outHeight:N,outWidth:D}=function(t,e,n,r,i,o,a,l,u,h,d){let p,f,g,m;if("number"==typeof t){const o=0===t?"VALID":"NUMBER";p={top:t,bottom:t,left:t,right:t,front:t,back:t,type:o};const a=function(t,e,n,r,i,o){null==i&&(i=s(t,e,r));const a=t[0],l=t[1],u=t[2],h=c((a-e+2*i)/r+1,o),d=c((l-e+2*i)/r+1,o),p=c((u-e+2*i)/r+1,o);return[h,d,p,n]}([e,n,r,1],l,1,i,t,d);f=a[0],g=a[1],m=a[2]}else if("same"===t){f=Math.ceil(e/i),g=Math.ceil(n/o),m=Math.ceil(r/a);const t=(f-1)*i+l-e,s=(g-1)*o+u-n,c=(m-1)*a+h-r,d=Math.floor(t/2),v=t-d,b=Math.floor(s/2),_=s-b,y=Math.floor(c/2),T=c-y;p={top:b,bottom:_,left:y,right:T,front:d,back:v,type:"SAME"}}else{if("valid"!==t)throw Error(`Unknown padding parameter: ${t}`);p={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},f=Math.ceil((e-l+1)/i),g=Math.ceil((n-u+1)/o),m=Math.ceil((r-h+1)/a)}return{padInfo:p,outDepth:f,outHeight:g,outWidth:m}}(i,p,f,g,T,E,x,k,O,I,h),M=o?y*m:y;let L;return"channelsFirst"===a?L=[d,M,A,N,D]:"channelsLast"===a&&(L=[d,A,N,D,M]),{batchSize:d,dataFormat:a,inDepth:p,inHeight:f,inWidth:g,inChannels:m,outDepth:A,outHeight:N,outWidth:D,outChannels:M,padInfo:R,strideDepth:T,strideHeight:E,strideWidth:x,filterDepth:v,filterHeight:b,filterWidth:_,effectiveFilterDepth:k,effectiveFilterHeight:O,effectiveFilterWidth:I,dilationDepth:w,dilationHeight:C,dilationWidth:S,inShape:t,outShape:L,filterShape:e}}function s(t,e,n,r=1){const i=u(e,r);return Math.floor((t[0]*(n-1)-n+i)/2)}function a(t){return"number"==typeof t?[t,t,t]:2===t.length?[t[0],t[1],1]:t}function l(t){return"number"==typeof t?[t,t,t]:t}function u(t,e){return e<=1?t:t+(t-1)*(e-1)}function c(t,e){if(!e)return Math.trunc(t);switch(e){case"round":return Math.round(t);case"ceil":return Math.ceil(t);case"floor":return Math.floor(t);default:throw new Error(`Unknown roundingMode ${e}`)}}function h(t){const[e,n,r]=a(t);return 1===e&&1===n&&1===r}function d(t){if("NHWC"===t)return"channelsLast";if("NCHW"===t)return"channelsFirst";throw new Error(`Unknown dataFormat ${t}`)}},HzcN:function(t,e,n){var r=n("uY1a"),i=n("ON3O");t.exports={throttle:r,debounce:i}},IDSB:function(t,e,n){var r,i,o,s;s=function(t){return(t={Msg:{}}).Msg.ADD_COMMENT="添加注释",t.Msg.CANNOT_DELETE_VARIABLE_PROCEDURE="不能删除变量“%1”,因为它是函数“%2”定义的一部分",t.Msg.CHANGE_VALUE_TITLE="更改值:",t.Msg.CLEAN_UP="整理块",t.Msg.COLLAPSED_WARNINGS_WARNING="已收起的信息块内包含警告。",t.Msg.COLLAPSE_ALL="折叠块",t.Msg.COLLAPSE_BLOCK="折叠块",t.Msg.COLOUR_BLEND_COLOUR1="颜色1",t.Msg.COLOUR_BLEND_COLOUR2="颜色2",t.Msg.COLOUR_BLEND_HELPURL="https://meyerweb.com/eric/tools/color-blend/#:::rgbp",t.Msg.COLOUR_BLEND_RATIO="比例",t.Msg.COLOUR_BLEND_TITLE="混合",t.Msg.COLOUR_BLEND_TOOLTIP="把两种颜色以一个给定的比例(0.0-1.0)进行混合。",t.Msg.COLOUR_PICKER_HELPURL="https://zh.wikipedia.org/wiki/颜色",t.Msg.COLOUR_PICKER_TOOLTIP="从调色板中选择一种颜色。",t.Msg.COLOUR_RANDOM_HELPURL="http://randomcolour.com",t.Msg.COLOUR_RANDOM_TITLE="随机颜色",t.Msg.COLOUR_RANDOM_TOOLTIP="随机选择一种颜色。",t.Msg.COLOUR_RGB_BLUE="蓝色",t.Msg.COLOUR_RGB_GREEN="绿色",t.Msg.COLOUR_RGB_HELPURL="https://www.december.com/html/spec/colorpercompact.html",t.Msg.COLOUR_RGB_RED="红色",t.Msg.COLOUR_RGB_TITLE="颜色",t.Msg.COLOUR_RGB_TOOLTIP="通过指定红色、绿色和蓝色的量创建一种颜色。所有的值必须在0和100之间。",t.Msg.CONTROLS_FLOW_STATEMENTS_HELPURL="https://github.com/google/blockly/wiki/Loops#loop-termination-blocks",t.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK="跳出循环",t.Msg.CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE="继续下一轮循环",t.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK="跳出包含它的循环。",t.Msg.CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE="跳过本轮循环的剩余部分,并继进行续下一轮循环。",t.Msg.CONTROLS_FLOW_STATEMENTS_WARNING="警告:这个块只能在循环内使用。",t.Msg.CONTROLS_FOREACH_HELPURL="https://github.com/google/blockly/wiki/Loops#for-each",t.Msg.CONTROLS_FOREACH_TITLE="遍历列表 %2 里的每一项 %1",t.Msg.CONTROLS_FOREACH_TOOLTIP="遍历列表中的每一项,将变量“%1”设为所选项,并执行一些语句。",t.Msg.CONTROLS_FOR_HELPURL="https://github.com/google/blockly/wiki/Loops#count-with",t.Msg.CONTROLS_FOR_TITLE="变量 %1 从 %2 数到 %3 每次增加 %4",t.Msg.CONTROLS_FOR_TOOLTIP="用变量%1记录从开始数值到终止数值之间的数值,数值按指定间隔增加,并执行指定的块。",t.Msg.CONTROLS_IF_ELSEIF_TOOLTIP="在这个if语句块中增加一个条件。",t.Msg.CONTROLS_IF_ELSE_TOOLTIP="在这个if语句块中添加一个最终的,包括所有其余情况的条件。",t.Msg.CONTROLS_IF_HELPURL="https://github.com/google/blockly/wiki/IfElse",t.Msg.CONTROLS_IF_IF_TOOLTIP="增加、删除或重新排列各节来重新配置这个if语句块。",t.Msg.CONTROLS_IF_MSG_ELSE="否则",t.Msg.CONTROLS_IF_MSG_ELSEIF="否则如果",t.Msg.CONTROLS_IF_MSG_IF="如果",t.Msg.CONTROLS_IF_TOOLTIP_1="如果值为真,执行一些语句。",t.Msg.CONTROLS_IF_TOOLTIP_2="如果值为真,则执行第一块语句。否则,则执行第二块语句。",t.Msg.CONTROLS_IF_TOOLTIP_3="如果第一个值为真,则执行第一块的语句。否则,如果第二个值为真,则执行第二块的语句。",t.Msg.CONTROLS_IF_TOOLTIP_4="如果第一个值为真,则执行第一块对语句。否则,如果第二个值为真,则执行语句的第二块。如果没有值为真,则执行最后一块的语句。",t.Msg.CONTROLS_REPEAT_HELPURL="https://zh.wikipedia.org/wiki/For循环",t.Msg.CONTROLS_REPEAT_INPUT_DO="执行",t.Msg.CONTROLS_REPEAT_TITLE="重复 %1 次",t.Msg.CONTROLS_REPEAT_TOOLTIP="多次执行一些语句。",t.Msg.CONTROLS_WHILEUNTIL_HELPURL="https://github.com/google/blockly/wiki/Loops#repeat",t.Msg.CONTROLS_WHILEUNTIL_OPERATOR_UNTIL="重复直到条件满足",t.Msg.CONTROLS_WHILEUNTIL_OPERATOR_WHILE="当条件满足时重复",t.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL="只要值为假,就一直循环执行一些语句。",t.Msg.CONTROLS_WHILEUNTIL_TOOLTIP_WHILE="只要值为真,就一直循环执行一些语句。",t.Msg.DELETE_ALL_BLOCKS="删除所有 %1 个块吗?",t.Msg.DELETE_BLOCK="删除块",t.Msg.DELETE_VARIABLE="删除变量“%1”",t.Msg.DELETE_VARIABLE_CONFIRMATION="要删除对变量“%2”的%1个引用吗?",t.Msg.DELETE_X_BLOCKS="删除 %1 个块",t.Msg.DISABLE_BLOCK="禁用块",t.Msg.DUPLICATE_BLOCK="复制",t.Msg.DUPLICATE_COMMENT="复制注释",t.Msg.ENABLE_BLOCK="启用块",t.Msg.EXPAND_ALL="展开块",t.Msg.EXPAND_BLOCK="展开块",t.Msg.EXTERNAL_INPUTS="外部输入",t.Msg.HELP="帮助",t.Msg.INLINE_INPUTS="单行输入",t.Msg.IOS_CANCEL="取消",t.Msg.IOS_ERROR="错误",t.Msg.IOS_OK="确定",t.Msg.IOS_PROCEDURES_ADD_INPUT="+ 添加输入",t.Msg.IOS_PROCEDURES_ALLOW_STATEMENTS="允许的语句",t.Msg.IOS_PROCEDURES_DUPLICATE_INPUTS_ERROR="这个函数有多个输入。",t.Msg.IOS_PROCEDURES_INPUTS="输入",t.Msg.IOS_VARIABLES_ADD_BUTTON="添加",t.Msg.IOS_VARIABLES_ADD_VARIABLE="+ 添加变量",t.Msg.IOS_VARIABLES_DELETE_BUTTON="删除",t.Msg.IOS_VARIABLES_EMPTY_NAME_ERROR="你不能使用空白的变量名。",t.Msg.IOS_VARIABLES_RENAME_BUTTON="重命名",t.Msg.IOS_VARIABLES_VARIABLE_NAME="变量名",t.Msg.LISTS_CREATE_EMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#create-empty-list",t.Msg.LISTS_CREATE_EMPTY_TITLE="创建空列表",t.Msg.LISTS_CREATE_EMPTY_TOOLTIP="返回一个列表,长度为 0,不包含任何数据记录",t.Msg.LISTS_CREATE_WITH_CONTAINER_TITLE_ADD="列表",t.Msg.LISTS_CREATE_WITH_CONTAINER_TOOLTIP="增加、删除或重新排列各部分以此重新配置这个列表块。",t.Msg.LISTS_CREATE_WITH_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",t.Msg.LISTS_CREATE_WITH_INPUT_WITH="创建列表,内容:",t.Msg.LISTS_CREATE_WITH_ITEM_TOOLTIP="将一个项添加到列表中。",t.Msg.LISTS_CREATE_WITH_TOOLTIP="建立一个具有任意数量项目的列表。",t.Msg.LISTS_GET_INDEX_FIRST="第一项",t.Msg.LISTS_GET_INDEX_FROM_END="倒数第#项",t.Msg.LISTS_GET_INDEX_FROM_START="#",t.Msg.LISTS_GET_INDEX_GET="取得",t.Msg.LISTS_GET_INDEX_GET_REMOVE="取得并移除",t.Msg.LISTS_GET_INDEX_LAST="最后一项",t.Msg.LISTS_GET_INDEX_RANDOM="随机的一项",t.Msg.LISTS_GET_INDEX_REMOVE="移除",t.Msg.LISTS_GET_INDEX_TAIL="-",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FIRST="返回列表中的第一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_FROM="返回在列表中的指定位置的项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_LAST="返回列表中的最后一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_RANDOM="返回列表中的随机一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FIRST="移除并返回列表中的第一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_FROM="移除并返回列表中的指定位置的项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_LAST="移除并返回列表中的最后一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_GET_REMOVE_RANDOM="移除并返回列表中的随机一项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FIRST="移除列表中的第一项",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_FROM="移除在列表中的指定位置的项。",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_LAST="移除列表中的最后一项",t.Msg.LISTS_GET_INDEX_TOOLTIP_REMOVE_RANDOM="删除列表中的随机一项。",t.Msg.LISTS_GET_SUBLIST_END_FROM_END="到倒数第#项",t.Msg.LISTS_GET_SUBLIST_END_FROM_START="到第#项",t.Msg.LISTS_GET_SUBLIST_END_LAST="到最后一项",t.Msg.LISTS_GET_SUBLIST_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-a-sublist",t.Msg.LISTS_GET_SUBLIST_START_FIRST="获取子列表,从第一项",t.Msg.LISTS_GET_SUBLIST_START_FROM_END="获取子列表,从倒数第#项",t.Msg.LISTS_GET_SUBLIST_START_FROM_START="获取子列表,从第#项",t.Msg.LISTS_GET_SUBLIST_TAIL="-",t.Msg.LISTS_GET_SUBLIST_TOOLTIP="复制列表中指定的部分。",t.Msg.LISTS_INDEX_FROM_END_TOOLTIP="%1是最后一项。",t.Msg.LISTS_INDEX_FROM_START_TOOLTIP="%1是第一项。",t.Msg.LISTS_INDEX_OF_FIRST="寻找第一次出现的项",t.Msg.LISTS_INDEX_OF_HELPURL="https://github.com/google/blockly/wiki/Lists#getting-items-from-a-list",t.Msg.LISTS_INDEX_OF_LAST="寻找最后一次出现的项",t.Msg.LISTS_INDEX_OF_TOOLTIP="返回在列表中的第一/最后一个匹配项的索引值。如果找不到项目则返回%1。",t.Msg.LISTS_INLIST="在列表中",t.Msg.LISTS_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Lists#is-empty",t.Msg.LISTS_ISEMPTY_TITLE="%1是空的",t.Msg.LISTS_ISEMPTY_TOOLTIP="如果改列表为空,则返回真。",t.Msg.LISTS_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Lists#length-of",t.Msg.LISTS_LENGTH_TITLE="%1的长度",t.Msg.LISTS_LENGTH_TOOLTIP="返回列表的长度。",t.Msg.LISTS_REPEAT_HELPURL="https://github.com/google/blockly/wiki/Lists#create-list-with",t.Msg.LISTS_REPEAT_TITLE="建立列表使用项 %1 重复 %2 次",t.Msg.LISTS_REPEAT_TOOLTIP="建立包含指定重复次数的值的列表。",t.Msg.LISTS_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Lists#reversing-a-list",t.Msg.LISTS_REVERSE_MESSAGE0="倒转%1",t.Msg.LISTS_REVERSE_TOOLTIP="倒转一个列表,返回副本。",t.Msg.LISTS_SET_INDEX_HELPURL="https://github.com/google/blockly/wiki/Lists#in-list--set",t.Msg.LISTS_SET_INDEX_INPUT_TO="值为",t.Msg.LISTS_SET_INDEX_INSERT="插入在",t.Msg.LISTS_SET_INDEX_SET="设置",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FIRST="在列表的起始处添加该项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_FROM="在列表中指定位置插入项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_LAST="在列表的末尾处添加该项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_INSERT_RANDOM="在列表的随机位置插入该项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FIRST="设置列表中的第一项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_FROM="设置在列表中指定位置的项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_LAST="设置列表中的最后一项。",t.Msg.LISTS_SET_INDEX_TOOLTIP_SET_RANDOM="设置列表中的随机一项。",t.Msg.LISTS_SORT_HELPURL="https://github.com/google/blockly/wiki/Lists#sorting-a-list",t.Msg.LISTS_SORT_ORDER_ASCENDING="升序",t.Msg.LISTS_SORT_ORDER_DESCENDING="降序",t.Msg.LISTS_SORT_TITLE="排序%1 %2 %3",t.Msg.LISTS_SORT_TOOLTIP="排序一个列表,返回副本。",t.Msg.LISTS_SORT_TYPE_IGNORECASE="按字母(忽略大小写)",t.Msg.LISTS_SORT_TYPE_NUMERIC="按数字",t.Msg.LISTS_SORT_TYPE_TEXT="按字母",t.Msg.LISTS_SPLIT_HELPURL="https://github.com/google/blockly/wiki/Lists#splitting-strings-and-joining-lists",t.Msg.LISTS_SPLIT_LIST_FROM_TEXT="从文本制作列表",t.Msg.LISTS_SPLIT_TEXT_FROM_LIST="将列表合并为文本",t.Msg.LISTS_SPLIT_TOOLTIP_JOIN="加入文本列表至一个文本,由分隔符分隔。",t.Msg.LISTS_SPLIT_TOOLTIP_SPLIT="将文本按指定的分隔符拆分为文本组成的列表。",t.Msg.LISTS_SPLIT_WITH_DELIMITER="分隔符:",t.Msg.LOGIC_BOOLEAN_FALSE="假",t.Msg.LOGIC_BOOLEAN_HELPURL="https://github.com/google/blockly/wiki/Logic#values",t.Msg.LOGIC_BOOLEAN_TOOLTIP="返回真或假。",t.Msg.LOGIC_BOOLEAN_TRUE="真",t.Msg.LOGIC_COMPARE_HELPURL="https://zh.wikipedia.org/wiki/不等",t.Msg.LOGIC_COMPARE_TOOLTIP_EQ="如果两个输入结果相等,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_GT="如果第一个输入结果比第二个大,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_GTE="如果第一个输入结果大于或等于第二个输入结果,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_LT="如果第一个输入结果比第二个小,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_LTE="如果第一个输入结果小于或等于第二个输入结果,则返回真。",t.Msg.LOGIC_COMPARE_TOOLTIP_NEQ="如果两个输入结果不相等,则返回真。",t.Msg.LOGIC_NEGATE_HELPURL="https://github.com/google/blockly/wiki/Logic#not",t.Msg.LOGIC_NEGATE_TITLE="%1不成立",t.Msg.LOGIC_NEGATE_TOOLTIP="如果输入结果为假,则返回真;如果输入结果为真,则返回假。",t.Msg.LOGIC_NULL="空",t.Msg.LOGIC_NULL_HELPURL="https://en.wikipedia.org/wiki/Nullable_type",t.Msg.LOGIC_NULL_TOOLTIP="返回空值。",t.Msg.LOGIC_OPERATION_AND="并且",t.Msg.LOGIC_OPERATION_HELPURL="https://github.com/google/blockly/wiki/Logic#logical-operations",t.Msg.LOGIC_OPERATION_OR="或",t.Msg.LOGIC_OPERATION_TOOLTIP_AND="如果两个输入结果都为真,则返回真。",t.Msg.LOGIC_OPERATION_TOOLTIP_OR="如果至少有一个输入结果为真,则返回真。",t.Msg.LOGIC_TERNARY_CONDITION="断言",t.Msg.LOGIC_TERNARY_HELPURL="https://zh.wikipedia.org/wiki/条件运算符",t.Msg.LOGIC_TERNARY_IF_FALSE="如果为假",t.Msg.LOGIC_TERNARY_IF_TRUE="如果为真",t.Msg.LOGIC_TERNARY_TOOLTIP="检查“断言”里的条件语句。如果条件为真,则返回“如果为真”的值,否则,则返回“如果为假”的值。",t.Msg.MATH_ADDITION_SYMBOL="+",t.Msg.MATH_ARITHMETIC_HELPURL="https://zh.wikipedia.org/wiki/算术",t.Msg.MATH_ARITHMETIC_TOOLTIP_ADD="返回两个数值的和。",t.Msg.MATH_ARITHMETIC_TOOLTIP_DIVIDE="返回两个数值的商。",t.Msg.MATH_ARITHMETIC_TOOLTIP_MINUS="返回两个数值的差。",t.Msg.MATH_ARITHMETIC_TOOLTIP_MULTIPLY="返回两个数值的乘积。",t.Msg.MATH_ARITHMETIC_TOOLTIP_POWER="返回以第一个数值为底数,以第二个数值为幂的结果。",t.Msg.MATH_ATAN2_HELPURL="https://zh.wikipedia.org/wiki/反正切2",t.Msg.MATH_ATAN2_TITLE="点(x:%1,y:%2)的方位角",t.Msg.MATH_ATAN2_TOOLTIP="返回点(X,Y)的反正切值,范围为-180到180度。",t.Msg.MATH_CHANGE_HELPURL="https://zh.wikipedia.org/wiki/加法",t.Msg.MATH_CHANGE_TITLE="将 %1 增加 %2",t.Msg.MATH_CHANGE_TOOLTIP="为变量“%1”增加一个数值。",t.Msg.MATH_CONSTANT_HELPURL="https://zh.wikipedia.org/wiki/数学常数",t.Msg.MATH_CONSTANT_TOOLTIP="返回一个常见常量:π (3.141…)、e (2.718…)、φ (1.618…)、根号2 (1.414…)、根号二分之一 (0.707…)或∞ (无穷大)。",t.Msg.MATH_CONSTRAIN_HELPURL="https://en.wikipedia.org/wiki/Clamping_(graphics)",t.Msg.MATH_CONSTRAIN_TITLE="将 %1 限制在 最低 %2 到最高 %3 之间",t.Msg.MATH_CONSTRAIN_TOOLTIP="将一个数值限制在两个指定的数值范围(含边界)之间。",t.Msg.MATH_DIVISION_SYMBOL="÷",t.Msg.MATH_IS_DIVISIBLE_BY="可被整除",t.Msg.MATH_IS_EVEN="是偶数",t.Msg.MATH_IS_NEGATIVE="是负数",t.Msg.MATH_IS_ODD="是奇数",t.Msg.MATH_IS_POSITIVE="是正数",t.Msg.MATH_IS_PRIME="是质数",t.Msg.MATH_IS_TOOLTIP="检查一个数值是否是偶数、奇数、质数、自然数、正数、负数或者是否能被某数整除。返回真或假。",t.Msg.MATH_IS_WHOLE="是整数",t.Msg.MATH_MODULO_HELPURL="https://zh.wikipedia.org/wiki/模除",t.Msg.MATH_MODULO_TITLE="取 %1 ÷ %2 的余数",t.Msg.MATH_MODULO_TOOLTIP="返回这两个数字相除后的余数。",t.Msg.MATH_MULTIPLICATION_SYMBOL="×",t.Msg.MATH_NUMBER_HELPURL="https://zh.wikipedia.org/wiki/数",t.Msg.MATH_NUMBER_TOOLTIP="一个数值。",t.Msg.MATH_ONLIST_HELPURL="",t.Msg.MATH_ONLIST_OPERATOR_AVERAGE="列表平均值",t.Msg.MATH_ONLIST_OPERATOR_MAX="列表最大值",t.Msg.MATH_ONLIST_OPERATOR_MEDIAN="列表中位数",t.Msg.MATH_ONLIST_OPERATOR_MIN="列表最小值",t.Msg.MATH_ONLIST_OPERATOR_MODE="列表中的众数",t.Msg.MATH_ONLIST_OPERATOR_RANDOM="列表中的随机一项",t.Msg.MATH_ONLIST_OPERATOR_STD_DEV="列表的标准差",t.Msg.MATH_ONLIST_OPERATOR_SUM="列表中数值的和",t.Msg.MATH_ONLIST_TOOLTIP_AVERAGE="返回列表中的数值的平均值。",t.Msg.MATH_ONLIST_TOOLTIP_MAX="返回列表中最大值。",t.Msg.MATH_ONLIST_TOOLTIP_MEDIAN="返回列表中数值的中位数。",t.Msg.MATH_ONLIST_TOOLTIP_MIN="返回列表中最小值。",t.Msg.MATH_ONLIST_TOOLTIP_MODE="返回列表中的出现次数最多的项的列表。",t.Msg.MATH_ONLIST_TOOLTIP_RANDOM="从列表中返回一个随机的元素。",t.Msg.MATH_ONLIST_TOOLTIP_STD_DEV="返回列表的标准差。",t.Msg.MATH_ONLIST_TOOLTIP_SUM="返回列表中的所有数值的和。",t.Msg.MATH_POWER_SYMBOL="^",t.Msg.MATH_RANDOM_FLOAT_HELPURL="https://zh.wikipedia.org/wiki/随机数生成器",t.Msg.MATH_RANDOM_FLOAT_TITLE_RANDOM="随机小数",t.Msg.MATH_RANDOM_FLOAT_TOOLTIP="返回一个从0.0(含)到1.0(不含)之间的随机数。",t.Msg.MATH_RANDOM_INT_HELPURL="https://zh.wikipedia.org/wiki/随机数生成器",t.Msg.MATH_RANDOM_INT_TITLE="从 %1 到 %2 范围内的随机整数",t.Msg.MATH_RANDOM_INT_TOOLTIP="返回一个限制在两个指定数值的范围(含边界)之间的随机整数。",t.Msg.MATH_ROUND_HELPURL="https://zh.wikipedia.org/wiki/数值修约",t.Msg.MATH_ROUND_OPERATOR_ROUND="四舍五入",t.Msg.MATH_ROUND_OPERATOR_ROUNDDOWN="向下舍入",t.Msg.MATH_ROUND_OPERATOR_ROUNDUP="向上舍入",t.Msg.MATH_ROUND_TOOLTIP="数字向上或向下舍入。",t.Msg.MATH_SINGLE_HELPURL="https://zh.wikipedia.org/wiki/平方根",t.Msg.MATH_SINGLE_OP_ABSOLUTE="绝对值",t.Msg.MATH_SINGLE_OP_ROOT="平方根",t.Msg.MATH_SINGLE_TOOLTIP_ABS="返回一个数值的绝对值。",t.Msg.MATH_SINGLE_TOOLTIP_EXP="返回一个数值的e次幂。",t.Msg.MATH_SINGLE_TOOLTIP_LN="返回一个数值的自然对数。",t.Msg.MATH_SINGLE_TOOLTIP_LOG10="返回一个数值的以10为底的对数。",t.Msg.MATH_SINGLE_TOOLTIP_NEG="返回一个数值的相反数。",t.Msg.MATH_SINGLE_TOOLTIP_POW10="返回一个数值的10次幂。",t.Msg.MATH_SINGLE_TOOLTIP_ROOT="返回一个数的平方根。",t.Msg.MATH_SUBTRACTION_SYMBOL="-",t.Msg.MATH_TRIG_ACOS="acos",t.Msg.MATH_TRIG_ASIN="asin",t.Msg.MATH_TRIG_ATAN="atan",t.Msg.MATH_TRIG_COS="cos",t.Msg.MATH_TRIG_HELPURL="https://zh.wikipedia.org/wiki/三角函数",t.Msg.MATH_TRIG_SIN="sin",t.Msg.MATH_TRIG_TAN="tan",t.Msg.MATH_TRIG_TOOLTIP_ACOS="返回一个数值的反余弦值。",t.Msg.MATH_TRIG_TOOLTIP_ASIN="返回一个数值的反正弦值。",t.Msg.MATH_TRIG_TOOLTIP_ATAN="返回一个数值的反正切值。",t.Msg.MATH_TRIG_TOOLTIP_COS="返回指定角度的余弦值(非弧度)。",t.Msg.MATH_TRIG_TOOLTIP_SIN="返回指定角度的正弦值(非弧度)。",t.Msg.MATH_TRIG_TOOLTIP_TAN="返回指定角度的正切值(非弧度)。",t.Msg.NEW_COLOUR_VARIABLE="创建颜色变量...",t.Msg.NEW_NUMBER_VARIABLE="创建数字变量...",t.Msg.NEW_STRING_VARIABLE="创建字符串变量...",t.Msg.NEW_VARIABLE="创建变量...",t.Msg.NEW_VARIABLE_TITLE="新变量的名称:",t.Msg.NEW_VARIABLE_TYPE_TITLE="新变量的类型:",t.Msg.ORDINAL_NUMBER_SUFFIX="-",t.Msg.PROCEDURES_ALLOW_STATEMENTS="允许声明",t.Msg.PROCEDURES_BEFORE_PARAMS="与:",t.Msg.PROCEDURES_CALLNORETURN_HELPURL="https://zh.wikipedia.org/wiki/子程序",t.Msg.PROCEDURES_CALLNORETURN_TOOLTIP="运行用户定义的函数“%1”。",t.Msg.PROCEDURES_CALLRETURN_HELPURL="https://zh.wikipedia.org/wiki/子程序",t.Msg.PROCEDURES_CALLRETURN_TOOLTIP="运行用户定义的函数“%1”,并使用它的输出值。",t.Msg.PROCEDURES_CALL_BEFORE_PARAMS="与:",t.Msg.PROCEDURES_CREATE_DO="创建“%1”",t.Msg.PROCEDURES_DEFNORETURN_COMMENT="描述该功能...",t.Msg.PROCEDURES_DEFNORETURN_DO="-",t.Msg.PROCEDURES_DEFNORETURN_HELPURL="https://zh.wikipedia.org/wiki/子程序",t.Msg.PROCEDURES_DEFNORETURN_PROCEDURE="做点什么",t.Msg.PROCEDURES_DEFNORETURN_TITLE="至",t.Msg.PROCEDURES_DEFNORETURN_TOOLTIP="创建一个不带输出值的函数。",t.Msg.PROCEDURES_DEFRETURN_HELPURL="https://zh.wikipedia.org/wiki/子程序",t.Msg.PROCEDURES_DEFRETURN_RETURN="返回",t.Msg.PROCEDURES_DEFRETURN_TOOLTIP="创建一个有输出值的函数。",t.Msg.PROCEDURES_DEF_DUPLICATE_WARNING="警告:此函数具有重复参数。",t.Msg.PROCEDURES_HIGHLIGHT_DEF="突出显示函数定义",t.Msg.PROCEDURES_IFRETURN_HELPURL="http://c2.com/cgi/wiki?GuardClause",t.Msg.PROCEDURES_IFRETURN_TOOLTIP="如果值为真,则返回第二个值。",t.Msg.PROCEDURES_IFRETURN_WARNING="警告:这个块只能在函数内部使用。",t.Msg.PROCEDURES_MUTATORARG_TITLE="输入名称:",t.Msg.PROCEDURES_MUTATORARG_TOOLTIP="添加函数输入。",t.Msg.PROCEDURES_MUTATORCONTAINER_TITLE="输入",t.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP="添加、移除或重新排此函数的输入。",t.Msg.REDO="重做",t.Msg.REMOVE_COMMENT="删除注释",t.Msg.RENAME_VARIABLE="重命名变量...",t.Msg.RENAME_VARIABLE_TITLE="将所有“%1”变量重命名为:",t.Msg.TEXT_APPEND_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",t.Msg.TEXT_APPEND_TITLE="在%1之后加上文本%2",t.Msg.TEXT_APPEND_TOOLTIP="将一些文本追加到变量“%1”里。",t.Msg.TEXT_CHANGECASE_HELPURL="https://github.com/google/blockly/wiki/Text#adjusting-text-case",t.Msg.TEXT_CHANGECASE_OPERATOR_LOWERCASE="转为小写",t.Msg.TEXT_CHANGECASE_OPERATOR_TITLECASE="转为首字母大写",t.Msg.TEXT_CHANGECASE_OPERATOR_UPPERCASE="转为大写",t.Msg.TEXT_CHANGECASE_TOOLTIP="用不同的大小写模式复制并返回这段文字。",t.Msg.TEXT_CHARAT_FIRST="获取第一个字符",t.Msg.TEXT_CHARAT_FROM_END="获取倒数第#个字符",t.Msg.TEXT_CHARAT_FROM_START="获取第#个字符",t.Msg.TEXT_CHARAT_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-text",t.Msg.TEXT_CHARAT_LAST="获取最后一个字符",t.Msg.TEXT_CHARAT_RANDOM="获取随机一个字符",t.Msg.TEXT_CHARAT_TAIL="-",t.Msg.TEXT_CHARAT_TITLE="在文本%1 里 %2",t.Msg.TEXT_CHARAT_TOOLTIP="返回位于指定位置的字符。",t.Msg.TEXT_COUNT_HELPURL="https://github.com/google/blockly/wiki/Text#counting-substrings",t.Msg.TEXT_COUNT_MESSAGE0="计算%1在%2里出现的次数",t.Msg.TEXT_COUNT_TOOLTIP="计算在一段文本中,某个部分文本重复出现了多少次。",t.Msg.TEXT_CREATE_JOIN_ITEM_TOOLTIP="将一个项添加到文本中。",t.Msg.TEXT_CREATE_JOIN_TITLE_JOIN="拼接",t.Msg.TEXT_CREATE_JOIN_TOOLTIP="添加、移除或重新排列各节来重新配置这个文本块。",t.Msg.TEXT_GET_SUBSTRING_END_FROM_END="到倒数第#个字符",t.Msg.TEXT_GET_SUBSTRING_END_FROM_START="到第#个字符",t.Msg.TEXT_GET_SUBSTRING_END_LAST="到最后一个字符",t.Msg.TEXT_GET_SUBSTRING_HELPURL="https://github.com/google/blockly/wiki/Text#extracting-a-region-of-text",t.Msg.TEXT_GET_SUBSTRING_INPUT_IN_TEXT="从文本",t.Msg.TEXT_GET_SUBSTRING_START_FIRST="获取子串,从第一个字符",t.Msg.TEXT_GET_SUBSTRING_START_FROM_END="获取子串,从倒数第#个字符",t.Msg.TEXT_GET_SUBSTRING_START_FROM_START="获取子串,从第#个字符",t.Msg.TEXT_GET_SUBSTRING_TAIL="-",t.Msg.TEXT_GET_SUBSTRING_TOOLTIP="返回文本中指定的一部分。",t.Msg.TEXT_INDEXOF_HELPURL="https://github.com/google/blockly/wiki/Text#finding-text",t.Msg.TEXT_INDEXOF_OPERATOR_FIRST="寻找第一次出现的文本",t.Msg.TEXT_INDEXOF_OPERATOR_LAST="寻找最后一次出现的文本",t.Msg.TEXT_INDEXOF_TITLE="在文本 %1 里 %2 %3",t.Msg.TEXT_INDEXOF_TOOLTIP="返回第一个文本段在第二个文本段中的第一/最后一个匹配项的起始位置。如果未找到,则返回%1。",t.Msg.TEXT_ISEMPTY_HELPURL="https://github.com/google/blockly/wiki/Text#checking-for-empty-text",t.Msg.TEXT_ISEMPTY_TITLE="%1是空的",t.Msg.TEXT_ISEMPTY_TOOLTIP="如果给定的文本为空,则返回真。",t.Msg.TEXT_JOIN_HELPURL="https://github.com/google/blockly/wiki/Text#text-creation",t.Msg.TEXT_JOIN_TITLE_CREATEWITH="创建文本,内容:",t.Msg.TEXT_JOIN_TOOLTIP="通过串起任意数量的项以建立一段文本。",t.Msg.TEXT_LENGTH_HELPURL="https://github.com/google/blockly/wiki/Text#text-modification",t.Msg.TEXT_LENGTH_TITLE="%1的长度",t.Msg.TEXT_LENGTH_TOOLTIP="返回给定文本的字母数(包括空格)。",t.Msg.TEXT_PRINT_HELPURL="https://github.com/google/blockly/wiki/Text#printing-text",t.Msg.TEXT_PRINT_TITLE="输出%1",t.Msg.TEXT_PRINT_TOOLTIP="输出指定的文字、数字或其他值。",t.Msg.TEXT_PROMPT_HELPURL="https://github.com/google/blockly/wiki/Text#getting-input-from-the-user",t.Msg.TEXT_PROMPT_TOOLTIP_NUMBER="要求用户输入数字。",t.Msg.TEXT_PROMPT_TOOLTIP_TEXT="要求用户输入一些文本。",t.Msg.TEXT_PROMPT_TYPE_NUMBER="要求输入数字,并显示提示消息",t.Msg.TEXT_PROMPT_TYPE_TEXT="要求输入文本,并显示提示消息",t.Msg.TEXT_REPLACE_HELPURL="https://github.com/google/blockly/wiki/Text#replacing-substrings",t.Msg.TEXT_REPLACE_MESSAGE0="把%3中的%1替换为%2",t.Msg.TEXT_REPLACE_TOOLTIP="在一段文本中,将出现过的某部分文本都替换掉。",t.Msg.TEXT_REVERSE_HELPURL="https://github.com/google/blockly/wiki/Text#reversing-text",t.Msg.TEXT_REVERSE_MESSAGE0="倒转文本%1",t.Msg.TEXT_REVERSE_TOOLTIP="将文本中各个字符的顺序倒转。",t.Msg.TEXT_TEXT_HELPURL="https://zh.wikipedia.org/wiki/字符串",t.Msg.TEXT_TEXT_TOOLTIP="一个字、词语或一行文本。",t.Msg.TEXT_TRIM_HELPURL="https://github.com/google/blockly/wiki/Text#trimming-removing-spaces",t.Msg.TEXT_TRIM_OPERATOR_BOTH="消除其两侧的空白",t.Msg.TEXT_TRIM_OPERATOR_LEFT="消除其左侧的空白",t.Msg.TEXT_TRIM_OPERATOR_RIGHT="消除其右侧的空白",t.Msg.TEXT_TRIM_TOOLTIP="从某一端或同时从两端删除多余的空白,并返回这段文字的一个副本。",t.Msg.TODAY="今天",t.Msg.UNDO="撤销",t.Msg.UNNAMED_KEY="匿名",t.Msg.VARIABLES_DEFAULT_NAME="项目",t.Msg.VARIABLES_GET_CREATE_SET="创建“设定%1”",t.Msg.VARIABLES_GET_HELPURL="https://github.com/google/blockly/wiki/Variables#get",t.Msg.VARIABLES_GET_TOOLTIP="返回此变量的值。",t.Msg.VARIABLES_SET="赋值 %1 为 %2",t.Msg.VARIABLES_SET_CREATE_GET="创建“获得%1”",t.Msg.VARIABLES_SET_HELPURL="https://github.com/google/blockly/wiki/Variables#set",t.Msg.VARIABLES_SET_TOOLTIP="设置此变量,以使它和输入值相等。",t.Msg.VARIABLE_ALREADY_EXISTS="名字叫“%1”的变量已经存在了。",t.Msg.VARIABLE_ALREADY_EXISTS_FOR_ANOTHER_TYPE="名字叫“%1”的变量已经有了另一个类型:“%2”。",t.Msg.WORKSPACE_ARIA_LABEL="Blockly工作区",t.Msg.WORKSPACE_COMMENT_DEFAULT_TEXT="说点什么...",t.Msg.CONTROLS_FOREACH_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_FOR_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_IF_ELSEIF_TITLE_ELSEIF=t.Msg.CONTROLS_IF_MSG_ELSEIF,t.Msg.CONTROLS_IF_ELSE_TITLE_ELSE=t.Msg.CONTROLS_IF_MSG_ELSE,t.Msg.CONTROLS_IF_IF_TITLE_IF=t.Msg.CONTROLS_IF_MSG_IF,t.Msg.CONTROLS_IF_MSG_THEN=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.CONTROLS_WHILEUNTIL_INPUT_DO=t.Msg.CONTROLS_REPEAT_INPUT_DO,t.Msg.LISTS_CREATE_WITH_ITEM_TITLE=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.LISTS_GET_INDEX_HELPURL=t.Msg.LISTS_INDEX_OF_HELPURL,t.Msg.LISTS_GET_INDEX_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_GET_SUBLIST_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_INDEX_OF_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.LISTS_SET_INDEX_INPUT_IN_LIST=t.Msg.LISTS_INLIST,t.Msg.MATH_CHANGE_TITLE_ITEM=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.PROCEDURES_DEFRETURN_COMMENT=t.Msg.PROCEDURES_DEFNORETURN_COMMENT,t.Msg.PROCEDURES_DEFRETURN_DO=t.Msg.PROCEDURES_DEFNORETURN_DO,t.Msg.PROCEDURES_DEFRETURN_PROCEDURE=t.Msg.PROCEDURES_DEFNORETURN_PROCEDURE,t.Msg.PROCEDURES_DEFRETURN_TITLE=t.Msg.PROCEDURES_DEFNORETURN_TITLE,t.Msg.TEXT_APPEND_VARIABLE=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.TEXT_CREATE_JOIN_ITEM_TITLE_ITEM=t.Msg.VARIABLES_DEFAULT_NAME,t.Msg.MATH_HUE="230",t.Msg.LOOPS_HUE="120",t.Msg.LISTS_HUE="260",t.Msg.LOGIC_HUE="210",t.Msg.VARIABLES_HUE="330",t.Msg.TEXTS_HUE="160",t.Msg.PROCEDURES_HUE="290",t.Msg.COLOUR_HUE="20",t.Msg.VARIABLES_DYNAMIC_HUE="310",t.Msg},i=[n("xnUL")],void 0===(o="function"==typeof(r=s)?r.apply(e,i):r)||(t.exports=o)},ISYW:function(t,e,n){"use strict";e.__esModule=!0;var r,i=n("7+uW"),o=(r=i)&&r.__esModule?r:{default:r},s=n("2kvA");var a=[],l="@@clickoutsideContext",u=void 0,c=0;function h(t,e,n){return function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!(n&&n.context&&r.target&&i.target)||t.contains(r.target)||t.contains(i.target)||t===r.target||n.context.popperElm&&(n.context.popperElm.contains(r.target)||n.context.popperElm.contains(i.target))||(e.expression&&t[l].methodName&&n.context[t[l].methodName]?n.context[t[l].methodName]():t[l].bindingFn&&t[l].bindingFn())}}!o.default.prototype.$isServer&&(0,s.on)(document,"mousedown",function(t){return u=t}),!o.default.prototype.$isServer&&(0,s.on)(document,"mouseup",function(t){a.forEach(function(e){return e[l].documentHandler(t,u)})}),e.default={bind:function(t,e,n){a.push(t);var r=c++;t[l]={id:r,documentHandler:h(t,e,n),methodName:e.expression,bindingFn:e.value}},update:function(t,e,n){t[l].documentHandler=h(t,e,n),t[l].methodName=e.expression,t[l].bindingFn=e.value},unbind:function(t){for(var e=a.length,n=0;nl;)r(a,n=e[l++])&&(~o(u,n)||u.push(n));return u}},JMbB:function(t,e,n){var r,i,o,s;s=function(t){"use strict";return t.JavaScript=new t.Generator("JavaScript"),t.JavaScript.addReservedWords("break,case,catch,class,const,continue,debugger,default,delete,do,else,export,extends,finally,for,function,if,import,in,instanceof,new,return,super,switch,this,throw,try,typeof,var,void,while,with,yield,enum,implements,interface,let,package,private,protected,public,static,await,null,true,false,arguments,"+Object.getOwnPropertyNames(t.utils.global).join(",")),t.JavaScript.ORDER_ATOMIC=0,t.JavaScript.ORDER_NEW=1.1,t.JavaScript.ORDER_MEMBER=1.2,t.JavaScript.ORDER_FUNCTION_CALL=2,t.JavaScript.ORDER_INCREMENT=3,t.JavaScript.ORDER_DECREMENT=3,t.JavaScript.ORDER_BITWISE_NOT=4.1,t.JavaScript.ORDER_UNARY_PLUS=4.2,t.JavaScript.ORDER_UNARY_NEGATION=4.3,t.JavaScript.ORDER_LOGICAL_NOT=4.4,t.JavaScript.ORDER_TYPEOF=4.5,t.JavaScript.ORDER_VOID=4.6,t.JavaScript.ORDER_DELETE=4.7,t.JavaScript.ORDER_AWAIT=4.8,t.JavaScript.ORDER_EXPONENTIATION=5,t.JavaScript.ORDER_MULTIPLICATION=5.1,t.JavaScript.ORDER_DIVISION=5.2,t.JavaScript.ORDER_MODULUS=5.3,t.JavaScript.ORDER_SUBTRACTION=6.1,t.JavaScript.ORDER_ADDITION=6.2,t.JavaScript.ORDER_BITWISE_SHIFT=7,t.JavaScript.ORDER_RELATIONAL=8,t.JavaScript.ORDER_IN=8,t.JavaScript.ORDER_INSTANCEOF=8,t.JavaScript.ORDER_EQUALITY=9,t.JavaScript.ORDER_BITWISE_AND=10,t.JavaScript.ORDER_BITWISE_XOR=11,t.JavaScript.ORDER_BITWISE_OR=12,t.JavaScript.ORDER_LOGICAL_AND=13,t.JavaScript.ORDER_LOGICAL_OR=14,t.JavaScript.ORDER_CONDITIONAL=15,t.JavaScript.ORDER_ASSIGNMENT=16,t.JavaScript.ORDER_YIELD=17,t.JavaScript.ORDER_COMMA=18,t.JavaScript.ORDER_NONE=99,t.JavaScript.ORDER_OVERRIDES=[[t.JavaScript.ORDER_FUNCTION_CALL,t.JavaScript.ORDER_MEMBER],[t.JavaScript.ORDER_FUNCTION_CALL,t.JavaScript.ORDER_FUNCTION_CALL],[t.JavaScript.ORDER_MEMBER,t.JavaScript.ORDER_MEMBER],[t.JavaScript.ORDER_MEMBER,t.JavaScript.ORDER_FUNCTION_CALL],[t.JavaScript.ORDER_LOGICAL_NOT,t.JavaScript.ORDER_LOGICAL_NOT],[t.JavaScript.ORDER_MULTIPLICATION,t.JavaScript.ORDER_MULTIPLICATION],[t.JavaScript.ORDER_ADDITION,t.JavaScript.ORDER_ADDITION],[t.JavaScript.ORDER_LOGICAL_AND,t.JavaScript.ORDER_LOGICAL_AND],[t.JavaScript.ORDER_LOGICAL_OR,t.JavaScript.ORDER_LOGICAL_OR]],t.JavaScript.isInitialized=!1,t.JavaScript.init=function(e){Object.getPrototypeOf(this).init.call(this),this.nameDB_?this.nameDB_.reset():this.nameDB_=new t.Names(this.RESERVED_WORDS_),this.nameDB_.setVariableMap(e.getVariableMap()),this.nameDB_.populateVariables(e),this.nameDB_.populateProcedures(e);for(var n=[],r=t.Variables.allDeveloperVariables(e),i=0;ir?this.valueToCode(e,n,this.ORDER_SUBTRACTION)||s:i?this.valueToCode(e,n,this.ORDER_UNARY_NEGATION)||s:this.valueToCode(e,n,o)||s,t.isNumber(e))e=Number(e)+r,i&&(e=-e);else{if(0r&&(e=e+" - "+-r,a=this.ORDER_SUBTRACTION);i&&(e=r?"-("+e+")":"-"+e,a=this.ORDER_UNARY_NEGATION),a=Math.floor(a),o=Math.floor(o),a&&o>=a&&(e="("+e+")")}return e},t.JavaScript.colour={},t.JavaScript.colour_picker=function(e){return[t.JavaScript.quote_(e.getFieldValue("COLOUR")),t.JavaScript.ORDER_ATOMIC]},t.JavaScript.colour_random=function(e){return[t.JavaScript.provideFunction_("colourRandom",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"() {"," var num = Math.floor(Math.random() * Math.pow(2, 24));"," return '#' + ('00000' + num.toString(16)).substr(-6);","}"])+"()",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.colour_rgb=function(e){var n=t.JavaScript.valueToCode(e,"RED",t.JavaScript.ORDER_NONE)||0,r=t.JavaScript.valueToCode(e,"GREEN",t.JavaScript.ORDER_NONE)||0;return e=t.JavaScript.valueToCode(e,"BLUE",t.JavaScript.ORDER_NONE)||0,[t.JavaScript.provideFunction_("colourRgb",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(r, g, b) {"," r = Math.max(Math.min(Number(r), 100), 0) * 2.55;"," g = Math.max(Math.min(Number(g), 100), 0) * 2.55;"," b = Math.max(Math.min(Number(b), 100), 0) * 2.55;"," r = ('0' + (Math.round(r) || 0).toString(16)).slice(-2);"," g = ('0' + (Math.round(g) || 0).toString(16)).slice(-2);"," b = ('0' + (Math.round(b) || 0).toString(16)).slice(-2);"," return '#' + r + g + b;","}"])+"("+n+", "+r+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.colour_blend=function(e){var n=t.JavaScript.valueToCode(e,"COLOUR1",t.JavaScript.ORDER_NONE)||"'#000000'",r=t.JavaScript.valueToCode(e,"COLOUR2",t.JavaScript.ORDER_NONE)||"'#000000'";return e=t.JavaScript.valueToCode(e,"RATIO",t.JavaScript.ORDER_NONE)||.5,[t.JavaScript.provideFunction_("colourBlend",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(c1, c2, ratio) {"," ratio = Math.max(Math.min(Number(ratio), 1), 0);"," var r1 = parseInt(c1.substring(1, 3), 16);"," var g1 = parseInt(c1.substring(3, 5), 16);"," var b1 = parseInt(c1.substring(5, 7), 16);"," var r2 = parseInt(c2.substring(1, 3), 16);"," var g2 = parseInt(c2.substring(3, 5), 16);"," var b2 = parseInt(c2.substring(5, 7), 16);"," var r = Math.round(r1 * (1 - ratio) + r2 * ratio);"," var g = Math.round(g1 * (1 - ratio) + g2 * ratio);"," var b = Math.round(b1 * (1 - ratio) + b2 * ratio);"," r = ('0' + (r || 0).toString(16)).slice(-2);"," g = ('0' + (g || 0).toString(16)).slice(-2);"," b = ('0' + (b || 0).toString(16)).slice(-2);"," return '#' + r + g + b;","}"])+"("+n+", "+r+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists={},t.JavaScript.lists_create_empty=function(e){return["[]",t.JavaScript.ORDER_ATOMIC]},t.JavaScript.lists_create_with=function(e){for(var n=Array(e.itemCount_),r=0;r b.toString() ? 1 : -1; },",' "IGNORE_CASE": function(a, b) {'," return a.toString().toLowerCase() > b.toString().toLowerCase() ? 1 : -1; },"," };"," var compare = compareFuncs[type];"," return function(a, b) { return compare(a, b) * direction; }","}"])+'("'+e+'", '+r+"))",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists_split=function(e){var n=t.JavaScript.valueToCode(e,"INPUT",t.JavaScript.ORDER_MEMBER),r=t.JavaScript.valueToCode(e,"DELIM",t.JavaScript.ORDER_NONE)||"''";if("SPLIT"==(e=e.getFieldValue("MODE")))n||(n="''"),e="split";else{if("JOIN"!=e)throw Error("Unknown mode: "+e);n||(n="[]"),e="join"}return[n+"."+e+"("+r+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.lists_reverse=function(e){return[(t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_FUNCTION_CALL)||"[]")+".slice().reverse()",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.logic={},t.JavaScript.controls_if=function(e){var n=0,r="";t.JavaScript.STATEMENT_PREFIX&&(r+=t.JavaScript.injectId(t.JavaScript.STATEMENT_PREFIX,e));do{var i=t.JavaScript.valueToCode(e,"IF"+n,t.JavaScript.ORDER_NONE)||"false",o=t.JavaScript.statementToCode(e,"DO"+n);t.JavaScript.STATEMENT_SUFFIX&&(o=t.JavaScript.prefixLines(t.JavaScript.injectId(t.JavaScript.STATEMENT_SUFFIX,e),t.JavaScript.INDENT)+o),r+=(0",GTE:">="}[e.getFieldValue("OP")],r="=="==n||"!="==n?t.JavaScript.ORDER_EQUALITY:t.JavaScript.ORDER_RELATIONAL;return[(t.JavaScript.valueToCode(e,"A",r)||"0")+" "+n+" "+(e=t.JavaScript.valueToCode(e,"B",r)||"0"),r]},t.JavaScript.logic_operation=function(e){var n="AND"==e.getFieldValue("OP")?"&&":"||",r="&&"==n?t.JavaScript.ORDER_LOGICAL_AND:t.JavaScript.ORDER_LOGICAL_OR,i=t.JavaScript.valueToCode(e,"A",r);if(e=t.JavaScript.valueToCode(e,"B",r),i||e){var o="&&"==n?"true":"false";i||(i=o),e||(e=o)}else e=i="false";return[i+" "+n+" "+e,r]},t.JavaScript.logic_negate=function(e){var n=t.JavaScript.ORDER_LOGICAL_NOT;return["!"+(t.JavaScript.valueToCode(e,"BOOL",n)||"true"),n]},t.JavaScript.logic_boolean=function(e){return["TRUE"==e.getFieldValue("BOOL")?"true":"false",t.JavaScript.ORDER_ATOMIC]},t.JavaScript.logic_null=function(e){return["null",t.JavaScript.ORDER_ATOMIC]},t.JavaScript.logic_ternary=function(e){return[(t.JavaScript.valueToCode(e,"IF",t.JavaScript.ORDER_CONDITIONAL)||"false")+" ? "+(t.JavaScript.valueToCode(e,"THEN",t.JavaScript.ORDER_CONDITIONAL)||"null")+" : "+(e=t.JavaScript.valueToCode(e,"ELSE",t.JavaScript.ORDER_CONDITIONAL)||"null"),t.JavaScript.ORDER_CONDITIONAL]},t.JavaScript.loops={},t.JavaScript.controls_repeat_ext=function(e){var n=e.getField("TIMES")?String(Number(e.getFieldValue("TIMES"))):t.JavaScript.valueToCode(e,"TIMES",t.JavaScript.ORDER_ASSIGNMENT)||"0",r=t.JavaScript.statementToCode(e,"DO");r=t.JavaScript.addLoopTrap(r,e),e="";var i=t.JavaScript.nameDB_.getDistinctName("count",t.VARIABLE_CATEGORY_NAME),o=n;return n.match(/^\w+$/)||t.isNumber(n)||(e+="var "+(o=t.JavaScript.nameDB_.getDistinctName("repeat_end",t.VARIABLE_CATEGORY_NAME))+" = "+n+";\n"),e+"for (var "+i+" = 0; "+i+" < "+o+"; "+i+"++) {\n"+r+"}\n"},t.JavaScript.controls_repeat=t.JavaScript.controls_repeat_ext,t.JavaScript.controls_whileUntil=function(e){var n="UNTIL"==e.getFieldValue("MODE"),r=t.JavaScript.valueToCode(e,"BOOL",n?t.JavaScript.ORDER_LOGICAL_NOT:t.JavaScript.ORDER_NONE)||"false",i=t.JavaScript.statementToCode(e,"DO");return i=t.JavaScript.addLoopTrap(i,e),n&&(r="!"+r),"while ("+r+") {\n"+i+"}\n"},t.JavaScript.controls_for=function(e){var n=t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME),r=t.JavaScript.valueToCode(e,"FROM",t.JavaScript.ORDER_ASSIGNMENT)||"0",i=t.JavaScript.valueToCode(e,"TO",t.JavaScript.ORDER_ASSIGNMENT)||"0",o=t.JavaScript.valueToCode(e,"BY",t.JavaScript.ORDER_ASSIGNMENT)||"1",s=t.JavaScript.statementToCode(e,"DO");if(s=t.JavaScript.addLoopTrap(s,e),t.isNumber(r)&&t.isNumber(i)&&t.isNumber(o)){var a=Number(r)<=Number(i);e="for ("+n+" = "+r+"; "+n+(a?" <= ":" >= ")+i+"; "+n,e=(1==(n=Math.abs(Number(o)))?e+(a?"++":"--"):e+(a?" += ":" -= ")+n)+") {\n"+s+"}\n"}else e="",a=r,r.match(/^\w+$/)||t.isNumber(r)||(e+="var "+(a=t.JavaScript.nameDB_.getDistinctName(n+"_start",t.VARIABLE_CATEGORY_NAME))+" = "+r+";\n"),r=i,i.match(/^\w+$/)||t.isNumber(i)||(e+="var "+(r=t.JavaScript.nameDB_.getDistinctName(n+"_end",t.VARIABLE_CATEGORY_NAME))+" = "+i+";\n"),e+="var "+(i=t.JavaScript.nameDB_.getDistinctName(n+"_inc",t.VARIABLE_CATEGORY_NAME))+" = ",e=(e=t.isNumber(o)?e+(Math.abs(o)+";\n"):e+"Math.abs("+o+");\n")+"if ("+a+" > "+r+") {\n"+(t.JavaScript.INDENT+i)+" = -"+i+";\n",e+="}\n",e+="for ("+n+" = "+a+"; "+i+" >= 0 ? "+n+" <= "+r+" : "+n+" >= "+r+"; "+n+" += "+i+") {\n"+s+"}\n";return e},t.JavaScript.controls_forEach=function(e){var n=t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME),r=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_ASSIGNMENT)||"[]",i=t.JavaScript.statementToCode(e,"DO");i=t.JavaScript.addLoopTrap(i,e),e="";var o=r;return r.match(/^\w+$/)||(e+="var "+(o=t.JavaScript.nameDB_.getDistinctName(n+"_list",t.VARIABLE_CATEGORY_NAME))+" = "+r+";\n"),e+"for (var "+(r=t.JavaScript.nameDB_.getDistinctName(n+"_index",t.VARIABLE_CATEGORY_NAME))+" in "+o+") {\n"+(i=t.JavaScript.INDENT+n+" = "+o+"["+r+"];\n"+i)+"}\n"},t.JavaScript.controls_flow_statements=function(e){var n="";if(t.JavaScript.STATEMENT_PREFIX&&(n+=t.JavaScript.injectId(t.JavaScript.STATEMENT_PREFIX,e)),t.JavaScript.STATEMENT_SUFFIX&&(n+=t.JavaScript.injectId(t.JavaScript.STATEMENT_SUFFIX,e)),t.JavaScript.STATEMENT_PREFIX){var r=t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(e);r&&!r.suppressPrefixSuffix&&(n+=t.JavaScript.injectId(t.JavaScript.STATEMENT_PREFIX,r))}switch(e.getFieldValue("FLOW")){case"BREAK":return n+"break;\n";case"CONTINUE":return n+"continue;\n"}throw Error("Unknown flow statement.")},t.JavaScript.math={},t.JavaScript.math_number=function(e){return[e=Number(e.getFieldValue("NUM")),0<=e?t.JavaScript.ORDER_ATOMIC:t.JavaScript.ORDER_UNARY_NEGATION]},t.JavaScript.math_arithmetic=function(e){var n={ADD:[" + ",t.JavaScript.ORDER_ADDITION],MINUS:[" - ",t.JavaScript.ORDER_SUBTRACTION],MULTIPLY:[" * ",t.JavaScript.ORDER_MULTIPLICATION],DIVIDE:[" / ",t.JavaScript.ORDER_DIVISION],POWER:[null,t.JavaScript.ORDER_NONE]}[e.getFieldValue("OP")],r=n[0];n=n[1];var i=t.JavaScript.valueToCode(e,"A",n)||"0";return e=t.JavaScript.valueToCode(e,"B",n)||"0",r?[i+r+e,n]:["Math.pow("+i+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_single=function(e){var n=e.getFieldValue("OP");if("NEG"==n)return"-"==(e=t.JavaScript.valueToCode(e,"NUM",t.JavaScript.ORDER_UNARY_NEGATION)||"0")[0]&&(e=" "+e),["-"+e,t.JavaScript.ORDER_UNARY_NEGATION];switch(e="SIN"==n||"COS"==n||"TAN"==n?t.JavaScript.valueToCode(e,"NUM",t.JavaScript.ORDER_DIVISION)||"0":t.JavaScript.valueToCode(e,"NUM",t.JavaScript.ORDER_NONE)||"0",n){case"ABS":var r="Math.abs("+e+")";break;case"ROOT":r="Math.sqrt("+e+")";break;case"LN":r="Math.log("+e+")";break;case"EXP":r="Math.exp("+e+")";break;case"POW10":r="Math.pow(10,"+e+")";break;case"ROUND":r="Math.round("+e+")";break;case"ROUNDUP":r="Math.ceil("+e+")";break;case"ROUNDDOWN":r="Math.floor("+e+")";break;case"SIN":r="Math.sin("+e+" / 180 * Math.PI)";break;case"COS":r="Math.cos("+e+" / 180 * Math.PI)";break;case"TAN":r="Math.tan("+e+" / 180 * Math.PI)"}if(r)return[r,t.JavaScript.ORDER_FUNCTION_CALL];switch(n){case"LOG10":r="Math.log("+e+") / Math.log(10)";break;case"ASIN":r="Math.asin("+e+") / Math.PI * 180";break;case"ACOS":r="Math.acos("+e+") / Math.PI * 180";break;case"ATAN":r="Math.atan("+e+") / Math.PI * 180";break;default:throw Error("Unknown math operator: "+n)}return[r,t.JavaScript.ORDER_DIVISION]},t.JavaScript.math_constant=function(e){return{PI:["Math.PI",t.JavaScript.ORDER_MEMBER],E:["Math.E",t.JavaScript.ORDER_MEMBER],GOLDEN_RATIO:["(1 + Math.sqrt(5)) / 2",t.JavaScript.ORDER_DIVISION],SQRT2:["Math.SQRT2",t.JavaScript.ORDER_MEMBER],SQRT1_2:["Math.SQRT1_2",t.JavaScript.ORDER_MEMBER],INFINITY:["Infinity",t.JavaScript.ORDER_ATOMIC]}[e.getFieldValue("CONSTANT")]},t.JavaScript.math_number_property=function(e){var n=t.JavaScript.valueToCode(e,"NUMBER_TO_CHECK",t.JavaScript.ORDER_MODULUS)||"0",r=e.getFieldValue("PROPERTY");if("PRIME"==r)return[t.JavaScript.provideFunction_("mathIsPrime",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(n) {"," // https://en.wikipedia.org/wiki/Primality_test#Naive_methods"," if (n == 2 || n == 3) {"," return true;"," }"," // False if n is NaN, negative, is 1, or not whole."," // And false if n is divisible by 2 or 3."," if (isNaN(n) || n <= 1 || n % 1 != 0 || n % 2 == 0 || n % 3 == 0) {"," return false;"," }"," // Check all the numbers of form 6k +/- 1, up to sqrt(n)."," for (var x = 6; x <= Math.sqrt(n) + 1; x += 6) {"," if (n % (x - 1) == 0 || n % (x + 1) == 0) {"," return false;"," }"," }"," return true;","}"])+"("+n+")",t.JavaScript.ORDER_FUNCTION_CALL];switch(r){case"EVEN":var i=n+" % 2 == 0";break;case"ODD":i=n+" % 2 == 1";break;case"WHOLE":i=n+" % 1 == 0";break;case"POSITIVE":i=n+" > 0";break;case"NEGATIVE":i=n+" < 0";break;case"DIVISIBLE_BY":i=n+" % "+(e=t.JavaScript.valueToCode(e,"DIVISOR",t.JavaScript.ORDER_MODULUS)||"0")+" == 0"}return[i,t.JavaScript.ORDER_EQUALITY]},t.JavaScript.math_change=function(e){var n=t.JavaScript.valueToCode(e,"DELTA",t.JavaScript.ORDER_ADDITION)||"0";return(e=t.JavaScript.nameDB_.getName(e.getFieldValue("VAR"),t.VARIABLE_CATEGORY_NAME))+" = (typeof "+e+" == 'number' ? "+e+" : 0) + "+n+";\n"},t.JavaScript.math_round=t.JavaScript.math_single,t.JavaScript.math_trig=t.JavaScript.math_single,t.JavaScript.math_on_list=function(e){var n=e.getFieldValue("OP");switch(n){case"SUM":e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_MEMBER)||"[]",e+=".reduce(function(x, y) {return x + y;})";break;case"MIN":e="Math.min.apply(null, "+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"MAX":e="Math.max.apply(null, "+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"AVERAGE":e=(n=t.JavaScript.provideFunction_("mathMean",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," return myList.reduce(function(x, y) {return x + y;}) / myList.length;","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"MEDIAN":e=(n=t.JavaScript.provideFunction_("mathMedian",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(myList) {"," var localList = myList.filter(function (x) {return typeof x == 'number';});"," if (!localList.length) return null;"," localList.sort(function(a, b) {return b - a;});"," if (localList.length % 2 == 0) {"," return (localList[localList.length / 2 - 1] + localList[localList.length / 2]) / 2;"," } else {"," return localList[(localList.length - 1) / 2];"," }","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"MODE":e=(n=t.JavaScript.provideFunction_("mathModes",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(values) {"," var modes = [];"," var counts = [];"," var maxCount = 0;"," for (var i = 0; i < values.length; i++) {"," var value = values[i];"," var found = false;"," var thisCount;"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][0] === value) {"," thisCount = ++counts[j][1];"," found = true;"," break;"," }"," }"," if (!found) {"," counts.push([value, 1]);"," thisCount = 1;"," }"," maxCount = Math.max(thisCount, maxCount);"," }"," for (var j = 0; j < counts.length; j++) {"," if (counts[j][1] == maxCount) {"," modes.push(counts[j][0]);"," }"," }"," return modes;","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"STD_DEV":e=(n=t.JavaScript.provideFunction_("mathStandardDeviation",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(numbers) {"," var n = numbers.length;"," if (!n) return null;"," var mean = numbers.reduce(function(x, y) {return x + y;}) / n;"," var variance = 0;"," for (var j = 0; j < n; j++) {"," variance += Math.pow(numbers[j] - mean, 2);"," }"," variance = variance / n;"," return Math.sqrt(variance);","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;case"RANDOM":e=(n=t.JavaScript.provideFunction_("mathRandomList",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(list) {"," var x = Math.floor(Math.random() * list.length);"," return list[x];","}"]))+"("+(e=t.JavaScript.valueToCode(e,"LIST",t.JavaScript.ORDER_NONE)||"[]")+")";break;default:throw Error("Unknown operator: "+n)}return[e,t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_modulo=function(e){return[(t.JavaScript.valueToCode(e,"DIVIDEND",t.JavaScript.ORDER_MODULUS)||"0")+" % "+(e=t.JavaScript.valueToCode(e,"DIVISOR",t.JavaScript.ORDER_MODULUS)||"0"),t.JavaScript.ORDER_MODULUS]},t.JavaScript.math_constrain=function(e){return["Math.min(Math.max("+(t.JavaScript.valueToCode(e,"VALUE",t.JavaScript.ORDER_NONE)||"0")+", "+(t.JavaScript.valueToCode(e,"LOW",t.JavaScript.ORDER_NONE)||"0")+"), "+(e=t.JavaScript.valueToCode(e,"HIGH",t.JavaScript.ORDER_NONE)||"Infinity")+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_random_int=function(e){var n=t.JavaScript.valueToCode(e,"FROM",t.JavaScript.ORDER_NONE)||"0";return e=t.JavaScript.valueToCode(e,"TO",t.JavaScript.ORDER_NONE)||"0",[t.JavaScript.provideFunction_("mathRandomInt",["function "+t.JavaScript.FUNCTION_NAME_PLACEHOLDER_+"(a, b) {"," if (a > b) {"," // Swap a and b to ensure a is smaller."," var c = a;"," a = b;"," b = c;"," }"," return Math.floor(Math.random() * (b - a + 1) + a);","}"])+"("+n+", "+e+")",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_random_float=function(e){return["Math.random()",t.JavaScript.ORDER_FUNCTION_CALL]},t.JavaScript.math_atan2=function(e){var n=t.JavaScript.valueToCode(e,"X",t.JavaScript.ORDER_NONE)||"0";return["Math.atan2("+(t.JavaScript.valueToCode(e,"Y",t.JavaScript.ORDER_NONE)||"0")+", "+n+") / Math.PI * 180",t.JavaScript.ORDER_DIVISION]},t.JavaScript.procedures={},t.JavaScript.procedures_defreturn=function(e){var n=t.JavaScript.nameDB_.getName(e.getFieldValue("NAME"),t.PROCEDURE_CATEGORY_NAME),r="";t.JavaScript.STATEMENT_PREFIX&&(r+=t.JavaScript.injectId(t.JavaScript.STATEMENT_PREFIX,e)),t.JavaScript.STATEMENT_SUFFIX&&(r+=t.JavaScript.injectId(t.JavaScript.STATEMENT_SUFFIX,e)),r&&(r=t.JavaScript.prefixLines(r,t.JavaScript.INDENT));var i="";t.JavaScript.INFINITE_LOOP_TRAP&&(i=t.JavaScript.prefixLines(t.JavaScript.injectId(t.JavaScript.INFINITE_LOOP_TRAP,e),t.JavaScript.INDENT));var o=t.JavaScript.statementToCode(e,"STACK"),s=t.JavaScript.valueToCode(e,"RETURN",t.JavaScript.ORDER_NONE)||"",a="";o&&s&&(a=r),s&&(s=t.JavaScript.INDENT+"return "+s+";\n");for(var l=[],u=e.getVars(),c=0;c{const i=e(t,n);null!==i&&r.push(i)}),r}}const m=t=>g.registerSaveRouter(t),v=t=>g.registerLoadRouter(t),b=t=>g.getSaveHandlers(t),_=(t,e)=>g.getLoadHandlers(t,e),y="tensorflowjs",T=1,E="models_store",x="model_info_store";function w(){if(!Object(p.b)().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");const t="undefined"==typeof window?self:window,e=t.indexedDB||t.mozIndexedDB||t.webkitIndexedDB||t.msIndexedDB||t.shimIndexedDB;if(null==e)throw new Error("The current browser does not appear to support IndexedDB.");return e}function C(t){const e=t.result;e.createObjectStore(E,{keyPath:"modelPath"}),e.createObjectStore(x,{keyPath:"modelPath"})}class S{constructor(t){if(this.indexedDB=w(),null==t||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return this.databaseAction(this.modelPath,t)}async load(){return this.databaseAction(this.modelPath)}databaseAction(t,e){return new Promise((t,n)=>{const r=this.indexedDB.open(y,T);r.onupgradeneeded=(()=>C(r)),r.onsuccess=(()=>{const i=r.result;if(null==e){const e=i.transaction(E,"readonly"),r=e.objectStore(E).get(this.modelPath);r.onsuccess=(()=>{if(null==r.result)return i.close(),n(new Error(`Cannot find model with path '${this.modelPath}' `+"in IndexedDB."));t(r.result.modelArtifacts)}),r.onerror=(t=>(i.close(),n(r.error))),e.oncomplete=(()=>i.close())}else{const r=Object(f.h)(e),o=i.transaction(x,"readwrite");let s=o.objectStore(x);const a=s.put({modelPath:this.modelPath,modelArtifactsInfo:r});let l;a.onsuccess=(()=>{const a=(l=i.transaction(E,"readwrite")).objectStore(E).put({modelPath:this.modelPath,modelArtifacts:e,modelArtifactsInfo:r});a.onsuccess=(()=>t({modelArtifactsInfo:r})),a.onerror=(t=>{const e=(s=o.objectStore(x)).delete(this.modelPath);e.onsuccess=(()=>(i.close(),n(a.error))),e.onerror=(t=>(i.close(),n(a.error)))})}),a.onerror=(t=>(i.close(),n(a.error))),o.oncomplete=(()=>{null==l?i.close():l.oncomplete=(()=>i.close())})}}),r.onerror=(t=>n(r.error))})}}S.URL_SCHEME="indexeddb://";const k=t=>Object(p.b)().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(S.URL_SCHEME)?(O=t.slice(S.URL_SCHEME.length),new S(O)):null;var O;g.registerSaveRouter(k),g.registerLoadRouter(k);var I=n("XFvI"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */const R="/",A="tensorflowjs_models",N="info",D="model_topology",M="weight_specs",L="weight_data",P="model_metadata";function F(t){return{info:[A,t,N].join(R),topology:[A,t,D].join(R),weightSpecs:[A,t,M].join(R),weightData:[A,t,L].join(R),modelMetadata:[A,t,P].join(R)}}function B(t){for(const e of Object.values(t))window.localStorage.removeItem(e)}function j(t){const e=t.split(R);if(e.length<3)throw new Error(`Invalid key format: ${t}`);return e.slice(1,e.length-1).join(R)}class ${constructor(t){if(!Object(p.b)().getBool("IS_BROWSER")||"undefined"==typeof window||void 0===window.localStorage)throw new Error("The current environment does not support local storage.");if(this.LS=window.localStorage,null==t||!t)throw new Error("For local storage, modelPath must not be null, undefined or empty.");this.modelPath=t,this.keys=F(this.modelPath)}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");{const e=JSON.stringify(t.modelTopology),n=JSON.stringify(t.weightSpecs),r=Object(f.h)(t);try{this.LS.setItem(this.keys.info,JSON.stringify(r)),this.LS.setItem(this.keys.topology,e),this.LS.setItem(this.keys.weightSpecs,n),this.LS.setItem(this.keys.weightData,Object(f.a)(t.weightData));const i={format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,signature:null!=t.signature?t.signature:void 0,userDefinedMetadata:null!=t.userDefinedMetadata?t.userDefinedMetadata:void 0,modelInitializer:null!=t.modelInitializer?t.modelInitializer:void 0,trainingConfig:null!=t.trainingConfig?t.trainingConfig:void 0};return this.LS.setItem(this.keys.modelMetadata,JSON.stringify(i)),{modelArtifactsInfo:r}}catch(t){throw B(this.keys),new Error(`Failed to save model '${this.modelPath}' to local storage: `+"size quota being exceeded is a possible cause of this failure: "+`modelTopologyBytes=${r.modelTopologyBytes}, `+`weightSpecsBytes=${r.weightSpecsBytes}, `+`weightDataBytes=${r.weightDataBytes}.`)}}}async load(){const t=JSON.parse(this.LS.getItem(this.keys.info));if(null==t)throw new Error(`In local storage, there is no model with name '${this.modelPath}'`);if("JSON"!==t.modelTopologyType)throw new Error("BrowserLocalStorage does not support loading non-JSON model topology yet.");const e={},n=JSON.parse(this.LS.getItem(this.keys.topology));if(null==n)throw new Error(`In local storage, the topology of model '${this.modelPath}' `+"is missing.");e.modelTopology=n;const r=JSON.parse(this.LS.getItem(this.keys.weightSpecs));if(null==r)throw new Error(`In local storage, the weight specs of model '${this.modelPath}' `+"are missing.");e.weightSpecs=r;const i=this.LS.getItem(this.keys.modelMetadata);if(null!=i){const t=JSON.parse(i);e.format=t.format,e.generatedBy=t.generatedBy,e.convertedBy=t.convertedBy,null!=t.signature&&(e.signature=t.signature),null!=t.userDefinedMetadata&&(e.userDefinedMetadata=t.userDefinedMetadata),null!=t.modelInitializer&&(e.modelInitializer=t.modelInitializer),null!=t.trainingConfig&&(e.trainingConfig=t.trainingConfig)}const o=this.LS.getItem(this.keys.weightData);if(null==o)throw new Error("In local storage, the binary weight values of model "+`'${this.modelPath}' are missing.`);return e.weightData=Object(f.b)(o),e}}$.URL_SCHEME="localstorage://";const U=t=>Object(p.b)().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith($.URL_SCHEME)?function(t){return new $(t)}(t.slice($.URL_SCHEME.length)):null;g.registerSaveRouter(U),g.registerLoadRouter(U); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ const V="://";class W{constructor(){this.managers={}}static getInstance(){return null==W.instance&&(W.instance=new W),W.instance}static registerManager(t,e){Object(I.assert)(null!=t,()=>"scheme must not be undefined or null."),t.endsWith(V)&&(t=t.slice(0,t.indexOf(V))),Object(I.assert)(t.length>0,()=>"scheme must not be an empty string.");const n=W.getInstance();Object(I.assert)(null==n.managers[t],()=>`A model store manager is already registered for scheme '${t}'.`),n.managers[t]=e}static getManager(t){const e=this.getInstance().managers[t];if(null==e)throw new Error(`Cannot find model manager for scheme '${t}'`);return e}static getSchemes(){return Object.keys(this.getInstance().managers)}}function H(t){if(-1===t.indexOf(V))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+`${W.getSchemes().join(",")}`);return{scheme:t.split(V)[0],path:t.split(V)[1]}}async function G(t,e,n=!1){Object(I.assert)(t!==e,()=>`Old path and new path are the same: '${t}'`);const r=g.getLoadHandlers(t);Object(I.assert)(r.length>0,()=>`Copying failed because no load handler is found for source URL ${t}.`),Object(I.assert)(r.length<2,()=>`Copying failed because more than one (${r.length}) `+`load handlers for source URL ${t}.`);const i=r[0],o=g.getSaveHandlers(e);Object(I.assert)(o.length>0,()=>"Copying failed because no save handler is found for destination "+`URL ${e}.`),Object(I.assert)(o.length<2,()=>`Copying failed because more than one (${r.length}) `+`save handlers for destination URL ${e}.`);const s=o[0],a=H(t).scheme,l=H(t).path,u=a===H(t).scheme,c=await i.load();n&&u&&await W.getManager(a).removeModel(l);const h=await s.save(c);return n&&!u&&await W.getManager(a).removeModel(l),h.modelArtifactsInfo}async function z(){const t=W.getSchemes(),e={};for(const n of t){const t=await W.getManager(n).listModels();for(const r in t){e[n+V+r]=t[r]}}return e}async function X(t){const e=H(t);return W.getManager(e.scheme).removeModel(e.path)}async function K(t,e){return G(t,e,!1)}async function Y(t,e){return G(t,e,!0)} /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */if(Object(p.b)().get("IS_BROWSER")){Object(p.b)().setPlatform("browser",new class{fetch(t,e){return fetch(t,e)}now(){return performance.now()}encode(t,e){if("utf-8"!==e&&"utf8"!==e)throw new Error(`Browser's encoder only supports utf-8, but got ${e}`);return null==this.textEncoder&&(this.textEncoder=new TextEncoder),this.textEncoder.encode(t)}decode(t,e){return new TextDecoder(e).decode(t)}});try{W.registerManager($.URL_SCHEME,new class{constructor(){Object(I.assert)(Object(p.b)().getBool("IS_BROWSER"),()=>"Current environment is not a web browser"),Object(I.assert)("undefined"==typeof window||void 0!==window.localStorage,()=>"Current browser does not appear to support localStorage"),this.LS=window.localStorage}async listModels(){const t={},e=A+R,n=R+N;for(let r=0;r{const n=this.indexedDB.open(y,T);n.onupgradeneeded=(()=>C(n)),n.onsuccess=(()=>{const r=n.result,i=r.transaction(x,"readonly"),o=i.objectStore(x).getAll();o.onsuccess=(()=>{const e={};for(const t of o.result)e[t.modelPath]=t.modelArtifactsInfo;t(e)}),o.onerror=(t=>(r.close(),e(o.error))),i.oncomplete=(()=>r.close())}),n.onerror=(t=>e(n.error))})}async removeModel(t){var e;return t=(e=t).startsWith(S.URL_SCHEME)?e.slice(S.URL_SCHEME.length):e,new Promise((e,n)=>{const r=this.indexedDB.open(y,T);r.onupgradeneeded=(()=>C(r)),r.onsuccess=(()=>{const i=r.result,o=i.transaction(x,"readwrite"),s=o.objectStore(x),a=s.get(t);let l;a.onsuccess=(()=>{if(null==a.result)return i.close(),n(new Error(`Cannot find model with path '${t}' `+"in IndexedDB."));{const r=s.delete(t),o=()=>{const r=(l=i.transaction(E,"readwrite")).objectStore(E).delete(t);r.onsuccess=(()=>e(a.result.modelArtifactsInfo)),r.onerror=(t=>n(a.error))};r.onsuccess=o,r.onerror=(t=>(o(),i.close(),n(a.error)))}}),a.onerror=(t=>(i.close(),n(a.error))),o.oncomplete=(()=>{null==l?i.close():l.oncomplete=(()=>i.close())})}),r.onerror=(t=>n(r.error))})}})}catch(t){}}n("ficH");var q=n("SnLv"),J=n("MlK1"),Z=n("VdVo"),Q=n("xnen"),tt=n("XPNO"); /** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ Object(d.b)();const et={buffer:q.a,cast:J.a,clone:Z.a,print:Q.a};Object(tt.e)(et); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ const nt="model",rt=".json",it=".weights.bin";function ot(t){return new Promise(t=>setTimeout(t)).then(t)}class st{constructor(t){if(!Object(p.b)().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");t.startsWith(st.URL_SCHEME)&&(t=t.slice(st.URL_SCHEME.length)),null!=t&&0!==t.length||(t=nt),this.modelJsonFileName=t+rt,this.weightDataFileName=t+it}async save(t){if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");const e=window.URL.createObjectURL(new Blob([t.weightData],{type:"application/octet-stream"}));if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");{const n=[{paths:["./"+this.weightDataFileName],weights:t.weightSpecs}],r=Object(f.i)(t,n),i=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:"application/json"})),o=null==this.modelJsonAnchor?document.createElement("a"):this.modelJsonAnchor;if(o.download=this.modelJsonFileName,o.href=i,await ot(()=>o.dispatchEvent(new MouseEvent("click"))),null!=t.weightData){const t=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor;t.download=this.weightDataFileName,t.href=e,await ot(()=>t.dispatchEvent(new MouseEvent("click")))}return{modelArtifactsInfo:Object(f.h)(t)}}}}st.URL_SCHEME="downloads://";class at{constructor(t){if(null==t||t.length<1)throw new Error("When calling browserFiles, at least 1 file is required, "+`but received ${t}`);this.jsonFile=t[0],this.weightsFiles=t.slice(1)}async load(){return new Promise((t,e)=>{const n=new FileReader;n.onload=(n=>{const r=JSON.parse(n.target.result),i=r.modelTopology;if(null==i)return void e(new Error(`modelTopology field is missing from file ${this.jsonFile.name}`));if(null==r.weightsManifest)return void e(new Error(`weightManifest field is missing from file ${this.jsonFile.name}`));if(0===this.weightsFiles.length)return void t({modelTopology:i});const o=Object(f.g)(r,t=>this.loadWeights(t));t(o)}),n.onerror=(t=>e("Failed to read model topology and weights manifest JSON "+`from file '${this.jsonFile.name}'. BrowserFiles supports loading `+"Keras-style tf.Model artifacts only.")),n.readAsText(this.jsonFile)})}loadWeights(t){const e=[],n=[];for(const r of t)e.push(...r.weights),n.push(...r.paths);const r=this.checkManifestAndWeightFiles(t),i=n.map(t=>this.loadWeightsFile(t,r[t]));return Promise.all(i).then(t=>[e,Object(f.d)(t)])}loadWeightsFile(t,e){return new Promise((n,r)=>{const i=new FileReader;i.onload=(t=>{const e=t.target.result;n(e)}),i.onerror=(e=>r(`Failed to weights data from file of path '${t}'.`)),i.readAsArrayBuffer(e)})}checkManifestAndWeightFiles(t){const e=[],n=this.weightsFiles.map(t=>Object(f.c)(t.name)),r={};for(const i of t)i.paths.forEach(t=>{const i=Object(f.c)(t);if(-1!==e.indexOf(i))throw new Error("Duplicate file basename found in weights manifest: "+`'${i}'`);if(e.push(i),-1===n.indexOf(i))throw new Error(`Weight file with basename '${i}' is not provided.`);r[t]=this.weightsFiles[n.indexOf(i)]});if(e.length!==this.weightsFiles.length)throw new Error("Mismatch in the number of files in weights manifest "+`(${e.length}) and the number of weight files provided `+`(${this.weightsFiles.length}).`);return r}}function lt(t){return new at(t)} /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function ut(t,e,n,r){!function(t){Object(I.assert)(null!=t&&Array.isArray(t)&&t.length>0,()=>"promises must be a none empty array")}(t),function(t,e){Object(I.assert)(t>=0&&t<=1,()=>"Progress fraction must be in range [0, 1], but "+`got startFraction ${t}`),Object(I.assert)(e>=0&&e<=1,()=>"Progress fraction must be in range [0, 1], but "+`got endFraction ${e}`),Object(I.assert)(e>=t,()=>"startFraction must be no more than endFraction, but "+`got startFraction ${t} and endFraction `+`${e}`)}(n=null==n?0:n,r=null==r?1:r);let i=0;return Promise.all(t.map(o=>(o.then(o=>{const s=n+ ++i/t.length*(r-n);return e(s),o}),o)))}g.registerSaveRouter(t=>Object(p.b)().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(st.URL_SCHEME)?function(t="model"){return new st(t)}(t.slice(st.URL_SCHEME.length)):null);var ct=n("T3Fu"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */async function ht(t,e){null==e&&(e={});const n=null==e.fetchFunc?Object(p.b)().platform.fetch:e.fetchFunc,r=t.map(t=>n(t,e.requestInit,{isBinary:!0})),i=(null==e.onProgress?await Promise.all(r):await ut(r,e.onProgress,0,.5)).map(t=>t.arrayBuffer());return null==e.onProgress?await Promise.all(i):await ut(i,e.onProgress,.5,1)}async function dt(t,e="",n,r){return pt(t=>ht(t,{requestInit:r}))(t,e,n)}function pt(t){return async(e,n="",r)=>{const i=e.map(()=>!1),o={},s=null!=r?r.map(()=>!1):[],a=[];if(e.forEach((t,e)=>{let n=0;t.weights.forEach(t=>{const l="quantization"in t?t.quantization.dtype:t.dtype,u=ct.a[l]*I.sizeFromShape(t.shape),c=()=>{i[e]=!0,null==o[e]&&(o[e]=[]),o[e].push({manifestEntry:t,groupOffset:n,sizeBytes:u})};null!=r?r.forEach((e,n)=>{e===t.name&&(c(),s[n]=!0)}):c(),a.push(t.name),n+=u})}),!s.every(t=>t)){const t=r.filter((t,e)=>!s[e]);throw new Error("Could not find weights in manifest with names: "+`${t.join(", ")}. \n`+"Manifest JSON has weights with names: "+`${a.join(", ")}.`)}const l=i.reduce((t,e,n)=>(e&&t.push(n),t),[]),u=[];l.forEach(t=>{e[t].paths.forEach(t=>{const e=n+(n.endsWith("/")?"":"/")+t;u.push(e)})});const c=await t(u),h={};let d=0;return l.forEach(t=>{const n=e[t].paths.length;let r=0;for(let t=0;t{const e=i.slice(t.groupOffset,t.groupOffset+t.sizeBytes),n=Object(f.e)(e,[t.manifestEntry]);for(const t in n)h[t]=n[t]}),d+=n}),h}} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */const ft="application/octet-stream",gt="application/json";class mt{constructor(t,e){if(this.DEFAULT_METHOD="POST",null==e&&(e={}),this.weightPathPrefix=e.weightPathPrefix,this.onProgress=e.onProgress,this.weightUrlConverter=e.weightUrlConverter,null!=e.fetchFunc?(Object(I.assert)("function"==typeof e.fetchFunc,()=>"Must pass a function that matches the signature of `fetch` (see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)"),this.fetch=e.fetchFunc):this.fetch=Object(p.b)().platform.fetch,Object(I.assert)(null!=t&&t.length>0,()=>"URL path for http must not be null, undefined or empty."),Array.isArray(t)&&Object(I.assert)(2===t.length,()=>"URL paths for http must have a length of 2, "+`(actual length is ${t.length}).`),this.path=t,null!=e.requestInit&&null!=e.requestInit.body)throw new Error("requestInit is expected to have no pre-existing body, but has one.");this.requestInit=e.requestInit||{}}async save(t){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");const e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit);e.body=new FormData;const n=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],r=Object(f.i)(t,n);e.body.append("model.json",new Blob([JSON.stringify(r)],{type:gt}),"model.json"),null!=t.weightData&&e.body.append("model.weights.bin",new Blob([t.weightData],{type:ft}),"model.weights.bin");const i=await this.fetch(this.path,e);if(i.ok)return{modelArtifactsInfo:Object(f.h)(t),responses:[i]};throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+`${i.status}.`)}async load(){const t=await this.fetch(this.path,this.requestInit);if(!t.ok)throw new Error(`Request to ${this.path} failed with status code `+`${t.status}. Please verify this URL points to `+"the model JSON of the model to load.");let e;try{e=await t.json()}catch(t){let e=`Failed to parse model JSON of response from ${this.path}.`;throw this.path.endsWith(".pb")?e+=" Your path contains a .pb file extension. Support for .pb models have been removed in TensorFlow.js 1.0 in favor of .json models. You can re-convert your Python TensorFlow model using the TensorFlow.js 1.0 conversion scripts or you can convert your.pb models with the 'pb2json'NPM script in the tensorflow/tfjs-converter repository.":e+=" Please make sure the server is serving valid JSON for this request.",new Error(e)}const n=e.modelTopology,r=e.weightsManifest;if(null==n&&null==r)throw new Error(`The JSON from HTTP path ${this.path} contains neither model `+"topology or manifest for weights.");return Object(f.g)(e,t=>this.loadWeights(t))}async loadWeights(t){const e=Array.isArray(this.path)?this.path[1]:this.path,[n,r]=function(t){const e=t.lastIndexOf("/"),n=t.lastIndexOf("?"),r=t.substring(0,e),i=n>e?t.substring(n):"";return[r+"/",i]}(e),i=this.weightPathPrefix||n,o=[];for(const e of t)o.push(...e.weights);const s=[],a=[];for(const e of t)for(const t of e.paths)null!=this.weightUrlConverter?a.push(this.weightUrlConverter(t)):s.push(i+t+r);this.weightUrlConverter&&s.push(...await Promise.all(a));const l=await ht(s,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress});return[o,Object(f.d)(l)]}}function vt(t){return null!=t.match(mt.URL_SCHEME_REGEX)}mt.URL_SCHEME_REGEX=/^https?:\/\//;const bt=(t,e)=>{if("undefined"==typeof fetch&&(null==e||null==e.fetchFunc))return null;{let n=!0;if(n=Array.isArray(t)?t.every(t=>vt(t)):vt(t))return _t(t,e)}return null};function _t(t,e){return new mt(t,e)}function yt(t,e){return _t(t,e)} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */g.registerSaveRouter(bt),g.registerLoadRouter(bt);class Tt{constructor(t){this.modelArtifacts=t}async load(){return this.modelArtifacts}}class Et{constructor(t){this.saveHandler=t}async save(t){return this.saveHandler(t)}}function xt(t,e,n,r){if(1===arguments.length){return null!=t.modelTopology||null!=t.weightSpecs?new Tt(t):(console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Tt({modelTopology:t}))}return console.warn("Please call tf.io.fromMemory() with only one argument. The argument should be of type ModelArtifacts. The multi-argument signature of tf.io.fromMemory() has been deprecated and will be removed in a future release."),new Tt({modelTopology:t,weightSpecs:e,weightData:n,trainingConfig:r})}function wt(t){return new Et(t)} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */var Ct=n("xMQ1"),St=n("4Ute"),kt=n("0FNO"),Ot=n("35G1"),It=n("gkZw");const Rt=Object(Ot.a)({confusionMatrix_: /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e,n){const r=Object(Ct.a)(t,"labels","confusionMatrix"),i=Object(Ct.a)(e,"predictions","confusionMatrix");I.assert(null==n||n>0&&Number.isInteger(n),()=>"If provided, numClasses must be a positive integer, "+`but got ${n}`),I.assert(1===r.rank,()=>`Expected the rank of labels to be 1, but got ${r.rank}`),I.assert(1===i.rank,()=>"Expected the rank of predictions to be 1, "+`but got ${i.rank}`),I.assert(r.shape[0]===i.shape[0],()=>"Mismatch in the number of examples: "+`${r.shape[0]} vs. ${i.shape[0]}. `+"Labels and predictions should have the same number of elements."),I.assert(n>0&&Number.isInteger(n),()=>"numClasses is required to be a positive integer, but got "+`${n}`);const o=Object(kt.a)(Object(J.a)(r,"int32"),n),s=Object(kt.a)(Object(J.a)(i,"int32"),n),a=Object(It.a)(o),l=Object(St.a)(a,s);return Object(J.a)(l,"int32")}}); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */var At=n("bDWH"),Nt=n("l5jf"),Dt=n("aYFL"),Mt=n("ke9e"); /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ let Lt;function Pt(t,e=3){if(e>4)throw new Error("Cannot construct Tensor with more than 4 channels from pixels.");if(null==t)throw new Error("pixels passed to tf.browser.fromPixels() can not be null");let n=!1,r=!1,i=!1,o=!1,s=!1,a=!1;if(t.data instanceof Uint8Array)n=!0;else if("undefined"!=typeof ImageData&&t instanceof ImageData)r=!0;else if("undefined"!=typeof HTMLVideoElement&&t instanceof HTMLVideoElement)i=!0;else if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement)o=!0;else if(null!=t.getContext)s=!0;else{if(!("undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap))throw new Error("pixels passed to tf.browser.fromPixels() must be either an HTMLVideoElement, HTMLImageElement, HTMLCanvasElement, ImageData in browser, or OffscreenCanvas, ImageData in webworker or {data: Uint32Array, width: number, height: number}, "+`but was ${t.constructor.name}`);a=!0}if(i){const e=2;if(i&&t.readyState element.")}if(null!=Object(Dt.b)(Nt._6,d.a.backendName)){const n={pixels:t},r={numChannels:e};return d.a.runKernel(Nt._6,n,r)}const[l,u]=i?[t.videoWidth,t.videoHeight]:[t.width,t.height];let c,h;if(s)c=t.getContext("2d").getImageData(0,0,l,u).data;else if(r||n)c=t.data;else if(o||i||a){if(null==Lt)if("undefined"==typeof document){if("undefined"==typeof OffscreenCanvas||"undefined"==typeof OffscreenCanvasRenderingContext2D)throw new Error("Cannot parse input in current context. Reason: OffscreenCanvas Context2D rendering is not supported.");Lt=new OffscreenCanvas(1,1).getContext("2d")}else Lt=document.createElement("canvas").getContext("2d");Lt.canvas.width=l,Lt.canvas.height=u,Lt.drawImage(t,0,0,l,u),c=Lt.getImageData(0,0,l,u).data}if(4===e)h=new Int32Array(c);else{const t=l*u;h=new Int32Array(t*e);for(let n=0;n4||2===o)throw new Error("toPixels only supports depth of size "+`1, 3 or 4 but got ${o}`);if("float32"!==n.dtype&&"int32"!==n.dtype)throw new Error(`Unsupported type for toPixels: ${n.dtype}.`+" Please use float32 or int32 tensors.");const s=await n.data(),a="float32"===n.dtype?255:1,l=new Uint8ClampedArray(i*r*4);for(let t=0;t1)throw new Error("Tensor values for a float32 Tensor must be in the "+`range [0 - 1] but encountered ${i}.`)}else if("int32"===n.dtype&&(i<0||i>255))throw new Error("Tensor values for a int32 Tensor must be in the "+`range [0 - 255] but encountered ${i}.`);1===o?(e[0]=i*a,e[1]=i*a,e[2]=i*a):e[r]=i*a}const r=4*t;l[r+0]=Math.round(e[0]),l[r+1]=Math.round(e[1]),l[r+2]=Math.round(e[2]),l[r+3]=Math.round(e[3])}if(null!=e){e.width=i,e.height=r;const t=e.getContext("2d"),n=new ImageData(l,i,r);t.putImageData(n,0,0)}return n!==t&&n.dispose(),l}const $t=Object(Ot.a)({fromPixels_:Pt});function Ut(t,e){const n=t.shape.length,r=e.shape.length;if(n<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher,"+` but the rank was ${n}.`);if(r<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher,"+` but the rank was ${r}.`);if("int32"!==e.dtype)throw new Error("tf.gatherND() expects the indices to be int32 type,"+` but the dtype was ${e.dtype}.`);if(e.shape[r-1]>n)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+`${e.shape[r-1]} vs. ${n}`);if(0===Object(I.sizeFromShape)(t.shape))throw new Error("Requested more than 0 entries, but input is empty."+` Input shape: ${t.shape}.`);const i=e.shape,o=i[i.length-1];let s=1;for(let t=0;tt/u),1].slice(0,o);return[l,s,u,c]}var Vt=n("G6fb"); /** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */const Wt=-2,Ht=-1;function Gt(t,e,n){const r=t.shape.length;I.assert(r===e.length,()=>`Error in slice${r}D: Length of begin ${e} must `+`match the rank of the array (${r}).`),I.assert(r===n.length,()=>`Error in slice${r}D: Length of size ${n} must `+`match the rank of the array (${r}).`);for(let i=0;i`Error in slice${r}D: begin[${i}] + size[${i}] `+`(${e[i]+n[i]}) would overflow input.shape[${i}] (${t.shape[i]})`)}function zt(t){const e=[];let n=0;for(;t>0;)1&t&&e.push(n),t/=2,n++;return e}function Xt(t,e,n){const r=[];for(let i=0;i0){const l=e[0],u=n+1;c=Zt(s,l,u,r,t),h=Qt(a,l,u,i,t),d=Kt(o,l,u,t)}else for(let e=0;e-1)o[i]=0;else{const s=Yt(e,n,i);let a=r[s];t&1<-1)o[i]=Number.MAX_SAFE_INTEGER;else{const s=Yt(e,n,i);let a=r[s];t&1<0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);const l=r[i];return s<0&&(s+=l),s=I.clamp(0,s,l-1)}function ne(t,e,n,r,i,o){let s=e[i];const a=n[i]||1;(t&1<0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);const l=r[i];return s<0&&(s+=l),s=a>0?I.clamp(0,s,l):I.clamp(-1,s,l-1)}function re(t,e,n){let r=n.length;for(let t=0;t1){r=t;break}for(let i=r+1;i0||n[i]!==t[i])return!1;return!0}function ie(t,e){let n=t.length>0?t[t.length-1]:1;for(let r=0;r{I.assert(-1!==t,()=>"slice() does not support negative begin indexing.")}),o=(o=null==n?new Array(i).fill(-1):"number"==typeof n?[n,...new Array(i-1).fill(-1)]:n.lengthe>=0?e:(I.assert(-1===e,()=>"Negative size values should be exactly -1 but got "+`${e} for the slice() size at index ${n}.`),t.shape[n]-r[n])),[r,o]}function se(t,e,n,r,i,o,s,a,l){let u;if(null==r?(u=new Array(e.length)).fill(1):u=r,null!=s&&0!=(s&s-1))throw new Error("Multiple ellipses in slice is not allowed.");let c=!1;const h={dims:u.length,numAddAxisAfterEllipsis:0,begin:e.slice(),end:n.slice(),strides:u.slice(),beginMask:i,endMask:o,ellipsisMask:s,newAxisMask:a,shrinkAxisMask:l};for(let t=0;t0?0:-1,d.strides[e]>0?r:r-1];if(n&&d.strides[e]<=0)throw Error("only stride 1 allowed on non-range indexing.");g=g&&1===d.strides[e];const s=!!(d.beginMask&1<=r)throw Error(`slice index ${d.begin[e]} of dimension ${e} out of bounds.`)}else d.begin[e]=ae(d.begin[e],0,d.strides[e],r,i,o),d.end[e]=ae(d.end[e],1,d.strides[e],r,i,o);const t=1===d.strides[e]&&0===d.begin[e]&&d.end[e]===r;p=p&&t,f=f&&(0===e&&1===d.strides[e]||t)}else p=p&&1===d.strides[e]&&s,f=f&&(0===e&&1===d.strides[e]||s);let a,l=!1;if(d.beginValid&&d.endValid?(a=d.end[e]-d.begin[e],l=!0):n?(a=1,l=!0):s&&r>=0&&(a=d.strides[e]<0?-r:r,l=!0),l){let t;t=0===a||a<0!=d.strides[e]<0?0:Math.trunc(a/d.strides[e])+(a%d.strides[e]!=0?1:0),m.push(t)}else m.push(-1)}for(let t=0;t=0?v.push(m[e]):e===Wt&&v.push(1)}return{finalShapeSparse:v.filter((t,e)=>d.finalShapeGatherIndices[e]!==Wt),finalShape:v,isIdentity:p,sliceDim0:f,isSimpleSlice:g,begin:d.begin,end:d.end,strides:d.strides}}function ae(t,e,n,r,i,o){if(i[e])return n>0?o[e]:o[e+1&1];{const e=t<0?r+t:t;return eo[1]?o[1]:e}} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */class le{getClassName(){return this.constructor.className}static fromConfig(t,e){return new t(e)}}class ue{constructor(){this.classNameMap={}}static getMap(){return null==ue.instance&&(ue.instance=new ue),ue.instance}static register(t){ue.getMap().classNameMap[t.className]=[t,t.fromConfig]}}function ce(t){Object(I.assert)(null!=t.className,()=>"Class being registered does not have the static className property defined."),Object(I.assert)("string"==typeof t.className,()=>"className is required to be a string, but got type "+typeof t.className),Object(I.assert)(t.className.length>0,()=>"Class being registered has an empty-string as its className, which is disallowed."),ue.register(t)}var he=n("jb1O"),de=n("ZD6k");var pe=n("V6aD"),fe=n("ODj2"),ge=n("sfDJ"),me=n("dZfa"),ve=n("m3RX"),be=n("UWMC"),_e=n("Cwm/"),ye=n("9Nf/"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class Te extends le{minimize(t,e=!1,n){const{value:r,grads:i}=this.computeGradients(t,n);if(null!=n){const t=n.map(t=>({name:t.name,tensor:i[t.name]}));this.applyGradients(t)}else this.applyGradients(i);return Object(pe.a)(i),e?r:(r.dispose(),null)}get iterations(){return null==this.iterations_&&(this.iterations_=0),this.iterations_}incrementIterations(){this.iterations_=this.iterations+1}computeGradients(t,e){return Object(ye.b)(t,e)}dispose(){null!=this.iterations_&&Object(pe.a)(this.iterations_)}async saveIterations(){return null==this.iterations_&&(this.iterations_=0),{name:"iter",tensor:Object(ve._54)(this.iterations_,"int32")}}async getWeights(){throw new Error("getWeights() is not implemented for this optimizer yet.")}async setWeights(t){throw new Error("setWeights() is not implemented for this optimizer class "+`${this.getClassName()}`)}async extractIterations(t){return this.iterations_=(await t[0].tensor.data())[0],t.slice(1)}}Object.defineProperty(Te,Symbol.hasInstance,{value:t=>null!=t.minimize&&null!=t.computeGradients&&null!=t.applyGradients}); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class Ee extends Te{constructor(t,e,n=null){super(),this.learningRate=t,this.rho=e,this.epsilon=n,this.accumulatedGrads=[],this.accumulatedUpdates=[],null==n&&(this.epsilon=d.a.backend.epsilon())}applyGradients(t){(Array.isArray(t)?t.map(t=>t.name):Object.keys(t)).forEach((e,n)=>{const r=d.a.registeredVariables[e];null==this.accumulatedGrads[n]&&(this.accumulatedGrads[n]={originalName:`${e}/accum_grad`,variable:Object(pe.e)(()=>Object(_e.a)(r).variable(!1))}),null==this.accumulatedUpdates[n]&&(this.accumulatedUpdates[n]={originalName:`${e}/accum_var`,variable:Object(pe.e)(()=>Object(_e.a)(r).variable(!1))});const i=Array.isArray(t)?t[n].tensor:t[e];if(null==i)return;const o=this.accumulatedGrads[n].variable,s=this.accumulatedUpdates[n].variable;Object(pe.e)(()=>{const t=Object(fe.a)(Object(me.a)(o,this.rho),Object(me.a)(Object(be.a)(i),1-this.rho)),e=Object(me.a)(Object(ge.a)(Object(ve._69)(Object(fe.a)(s,this.epsilon)),Object(ve._69)(Object(fe.a)(o,this.epsilon))),i),n=Object(fe.a)(Object(me.a)(s,this.rho),Object(me.a)(Object(be.a)(e),1-this.rho));o.assign(t),s.assign(n);const a=Object(fe.a)(Object(me.a)(e,-this.learningRate),r);r.assign(a)})}),this.incrementIterations()}dispose(){null!=this.accumulatedUpdates&&(Object(pe.a)(this.accumulatedGrads.map(t=>t.variable)),Object(pe.a)(this.accumulatedUpdates.map(t=>t.variable)))}async getWeights(){const t=[...this.accumulatedGrads,...this.accumulatedUpdates];return[await this.saveIterations()].concat(t.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(t){const e=(t=await this.extractIterations(t)).length/2;this.accumulatedGrads=t.slice(0,e).map(t=>({originalName:t.name,variable:t.tensor.variable(!1)})),this.accumulatedUpdates=t.slice(e,2*e).map(t=>({originalName:t.name,variable:t.tensor.variable(!1)}))}getConfig(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}}static fromConfig(t,e){return new t(e.learningRate,e.rho,e.epsilon)}}Ee.className="Adadelta",ce(Ee);var xe=n("Hdl1"),we=n("FUmq"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class Ce extends Te{constructor(t,e=.1){super(),this.learningRate=t,this.initialAccumulatorValue=e,this.accumulatedGrads=[]}applyGradients(t){(Array.isArray(t)?t.map(t=>t.name):Object.keys(t)).forEach((e,n)=>{const r=d.a.registeredVariables[e];if(null==this.accumulatedGrads[n]){const t=!1;this.accumulatedGrads[n]={originalName:`${e}/accumulator`,variable:Object(pe.e)(()=>Object(xe.a)(r.shape,this.initialAccumulatorValue).variable(t))}}const i=Array.isArray(t)?t[n].tensor:t[e];if(null==i)return;const o=this.accumulatedGrads[n].variable;Object(pe.e)(()=>{const t=Object(fe.a)(o,Object(be.a)(i));o.assign(t);const e=Object(fe.a)(Object(me.a)(Object(ge.a)(i,Object(we.a)(Object(fe.a)(t,d.a.backend.epsilon()))),-this.learningRate),r);r.assign(e)})}),this.incrementIterations()}dispose(){null!=this.accumulatedGrads&&Object(pe.a)(this.accumulatedGrads.map(t=>t.variable))}async getWeights(){return[await this.saveIterations()].concat(this.accumulatedGrads.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(t){t=await this.extractIterations(t);this.accumulatedGrads=t.map(t=>({originalName:t.name,variable:t.tensor.variable(!1)}))}getConfig(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}}static fromConfig(t,e){return new t(e.learningRate,e.initialAccumulatorValue)}}Ce.className="Adagrad",ce(Ce);var Se=n("eNzZ"),ke=n("s2iQ"),Oe=n("6kjP"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class Ie extends Te{constructor(t,e,n,r=null){super(),this.learningRate=t,this.beta1=e,this.beta2=n,this.epsilon=r,this.accumulatedFirstMoment=[],this.accumulatedSecondMoment=[],Object(pe.e)(()=>{this.accBeta1=Object(ke.a)(e).variable(),this.accBeta2=Object(ke.a)(n).variable()}),null==r&&(this.epsilon=d.a.backend.epsilon())}applyGradients(t){const e=Array.isArray(t)?t.map(t=>t.name):Object.keys(t);Object(pe.e)(()=>{const n=Object(Oe.a)(1,this.accBeta1),r=Object(Oe.a)(1,this.accBeta2);e.forEach((e,i)=>{const o=d.a.registeredVariables[e];null==this.accumulatedFirstMoment[i]&&(this.accumulatedFirstMoment[i]={originalName:`${e}/m`,variable:Object(pe.e)(()=>Object(_e.a)(o).variable(!1))}),null==this.accumulatedSecondMoment[i]&&(this.accumulatedSecondMoment[i]={originalName:`${e}/v`,variable:Object(pe.e)(()=>Object(_e.a)(o).variable(!1))});const s=Array.isArray(t)?t[i].tensor:t[e];if(null==s)return;const a=this.accumulatedFirstMoment[i].variable,l=this.accumulatedSecondMoment[i].variable,u=Object(fe.a)(Object(me.a)(a,this.beta1),Object(me.a)(s,1-this.beta1)),c=Object(fe.a)(Object(me.a)(l,this.beta2),Object(me.a)(Object(be.a)(s),1-this.beta2)),h=Object(ge.a)(u,n),p=Object(ge.a)(c,r);a.assign(u),l.assign(c);const f=Object(fe.a)(Object(me.a)(Object(ge.a)(h,Object(fe.a)(Object(we.a)(p),this.epsilon)),-this.learningRate),o);o.assign(f)}),this.accBeta1.assign(Object(me.a)(this.accBeta1,this.beta1)),this.accBeta2.assign(Object(me.a)(this.accBeta2,this.beta2))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&Object(pe.a)(this.accumulatedFirstMoment.map(t=>t.variable)),null!=this.accumulatedSecondMoment&&Object(pe.a)(this.accumulatedSecondMoment.map(t=>t.variable))}async getWeights(){const t=[...this.accumulatedFirstMoment,...this.accumulatedSecondMoment];return[await this.saveIterations()].concat(t.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(t){t=await this.extractIterations(t),Object(pe.e)(()=>{this.accBeta1.assign(Object(Se.a)(this.beta1,this.iterations_+1)),this.accBeta2.assign(Object(Se.a)(this.beta2,this.iterations_+1))});const e=t.length/2;this.accumulatedFirstMoment=t.slice(0,e).map(t=>({originalName:t.name,variable:t.tensor.variable(!1)})),this.accumulatedSecondMoment=t.slice(e,2*e).map(t=>({originalName:t.name,variable:t.tensor.variable(!1)}))}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}}static fromConfig(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon)}}Ie.className="Adam",ce(Ie);var Re=n("BVpN"),Ae=n("dHLy"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class Ne extends Te{constructor(t,e,n,r=null,i=0){super(),this.learningRate=t,this.beta1=e,this.beta2=n,this.epsilon=r,this.decay=i,this.accumulatedFirstMoment=[],this.accumulatedWeightedInfNorm=[],Object(pe.e)(()=>{this.iteration=Object(ke.a)(0).variable(),this.accBeta1=Object(ke.a)(e).variable()}),null==r&&(this.epsilon=d.a.backend.epsilon())}applyGradients(t){const e=Array.isArray(t)?t.map(t=>t.name):Object.keys(t);Object(pe.e)(()=>{const n=Object(Oe.a)(1,this.accBeta1),r=Object(ge.a)(-this.learningRate,Object(fe.a)(Object(me.a)(this.iteration,this.decay),1));e.forEach((e,i)=>{const o=d.a.registeredVariables[e];null==this.accumulatedFirstMoment[i]&&(this.accumulatedFirstMoment[i]={originalName:`${e}/m`,variable:Object(_e.a)(o).variable(!1)}),null==this.accumulatedWeightedInfNorm[i]&&(this.accumulatedWeightedInfNorm[i]={originalName:`${e}/v`,variable:Object(_e.a)(o).variable(!1)});const s=Array.isArray(t)?t[i].tensor:t[e];if(null==s)return;const a=this.accumulatedFirstMoment[i].variable,l=this.accumulatedWeightedInfNorm[i].variable,u=Object(fe.a)(Object(me.a)(a,this.beta1),Object(me.a)(s,1-this.beta1)),c=Object(me.a)(l,this.beta2),h=Object(Re.a)(s),p=Object(Ae.a)(c,h);a.assign(u),l.assign(p);const f=Object(fe.a)(Object(me.a)(Object(ge.a)(r,n),Object(ge.a)(u,Object(fe.a)(p,this.epsilon))),o);o.assign(f)}),this.iteration.assign(Object(fe.a)(this.iteration,1)),this.accBeta1.assign(Object(me.a)(this.accBeta1,this.beta1))}),this.incrementIterations()}dispose(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&Object(pe.a)(this.accumulatedFirstMoment.map(t=>t.variable)),null!=this.accumulatedWeightedInfNorm&&Object(pe.a)(this.accumulatedWeightedInfNorm.map(t=>t.variable))}async getWeights(){throw new Error("getWeights() is not implemented for Adamax yet.")}async setWeights(t){throw new Error("setWeights() is not implemented for Adamax yet.")}getConfig(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}}static fromConfig(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon,e.decay)}}Ne.className="Adamax",ce(Ne); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class De extends Te{constructor(t){super(),this.learningRate=t,this.setLearningRate(t)}applyGradients(t){(Array.isArray(t)?t.map(t=>t.name):Object.keys(t)).forEach((e,n)=>{const r=Array.isArray(t)?t[n].tensor:t[e];if(null==r)return;const i=d.a.registeredVariables[e];Object(pe.e)(()=>{const t=Object(fe.a)(Object(me.a)(this.c,r),i);i.assign(t)})}),this.incrementIterations()}setLearningRate(t){this.learningRate=t,null!=this.c&&this.c.dispose(),this.c=Object(pe.c)(Object(ke.a)(-t))}dispose(){this.c.dispose()}async getWeights(){return[await this.saveIterations()]}async setWeights(t){if(0!==(t=await this.extractIterations(t)).length)throw new Error("SGD optimizer does not have settable weights.")}getConfig(){return{learningRate:this.learningRate}}static fromConfig(t,e){return new t(e.learningRate)}}De.className="SGD",ce(De); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class Me extends De{constructor(t,e,n=!1){super(t),this.learningRate=t,this.momentum=e,this.useNesterov=n,this.accumulations=[],this.m=Object(ke.a)(this.momentum)}applyGradients(t){(Array.isArray(t)?t.map(t=>t.name):Object.keys(t)).forEach((e,n)=>{const r=d.a.registeredVariables[e];if(null==this.accumulations[n]){const t=!1;this.accumulations[n]={originalName:`${e}/momentum`,variable:Object(pe.e)(()=>Object(_e.a)(r).variable(t))}}const i=this.accumulations[n].variable,o=Array.isArray(t)?t[n].tensor:t[e];null!=o&&Object(pe.e)(()=>{let t;const e=Object(fe.a)(Object(me.a)(this.m,i),o);t=this.useNesterov?Object(fe.a)(Object(me.a)(this.c,Object(fe.a)(o,Object(me.a)(e,this.m))),r):Object(fe.a)(Object(me.a)(this.c,e),r),i.assign(e),r.assign(t)})}),this.incrementIterations()}dispose(){this.m.dispose(),null!=this.accumulations&&Object(pe.a)(this.accumulations.map(t=>t.variable))}setMomentum(t){this.momentum=t}async getWeights(){return[await this.saveIterations()].concat(this.accumulations.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(t){t=await this.extractIterations(t);this.accumulations=t.map(t=>({originalName:t.name,variable:t.tensor.variable(!1)}))}getConfig(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}}static fromConfig(t,e){return new t(e.learningRate,e.momentum,e.useNesterov)}}Me.className="Momentum",ce(Me); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class Le extends Te{constructor(t,e=.9,n=0,r=null,i=!1){if(super(),this.learningRate=t,this.decay=e,this.momentum=n,this.epsilon=r,this.accumulatedMeanSquares=[],this.accumulatedMoments=[],this.accumulatedMeanGrads=[],this.centered=i,null==r&&(this.epsilon=d.a.backend.epsilon()),null==t)throw new Error("learningRate for RMSPropOptimizer must be defined.")}applyGradients(t){(Array.isArray(t)?t.map(t=>t.name):Object.keys(t)).forEach((e,n)=>{const r=d.a.registeredVariables[e];null==this.accumulatedMeanSquares[n]&&(this.accumulatedMeanSquares[n]={originalName:`${e}/rms`,variable:Object(pe.e)(()=>Object(_e.a)(r).variable(!1))}),null==this.accumulatedMoments[n]&&(this.accumulatedMoments[n]={originalName:`${e}/momentum`,variable:Object(pe.e)(()=>Object(_e.a)(r).variable(!1))}),null==this.accumulatedMeanGrads[n]&&this.centered&&(this.accumulatedMeanGrads[n]={originalName:`${e}/mg`,variable:Object(pe.e)(()=>Object(_e.a)(r).variable(!1))});const i=Array.isArray(t)?t[n].tensor:t[e];if(null==i)return;const o=this.accumulatedMeanSquares[n].variable,s=this.accumulatedMoments[n].variable;Object(pe.e)(()=>{const t=Object(fe.a)(Object(me.a)(o,this.decay),Object(me.a)(Object(be.a)(i),1-this.decay));if(this.centered){const e=this.accumulatedMeanGrads[n].variable,a=Object(fe.a)(Object(me.a)(e,this.decay),Object(me.a)(i,1-this.decay)),l=Object(ge.a)(Object(me.a)(i,this.learningRate),Object(we.a)(Object(Oe.a)(t,Object(fe.a)(Object(be.a)(a),this.epsilon)))),u=Object(fe.a)(Object(me.a)(s,this.momentum),l);o.assign(t),e.assign(a),s.assign(u);const c=Object(Oe.a)(r,u);r.assign(c)}else{const t=Object(fe.a)(Object(me.a)(o,this.decay),Object(me.a)(Object(be.a)(i),1-this.decay)),e=Object(fe.a)(Object(me.a)(s,this.momentum),Object(ge.a)(Object(me.a)(i,this.learningRate),Object(we.a)(Object(fe.a)(t,this.epsilon))));o.assign(t),s.assign(e);const n=Object(Oe.a)(r,e);r.assign(n)}})}),this.incrementIterations()}dispose(){null!=this.accumulatedMeanSquares&&Object(pe.a)(this.accumulatedMeanSquares.map(t=>t.variable)),null!=this.accumulatedMeanGrads&&this.centered&&Object(pe.a)(this.accumulatedMeanGrads.map(t=>t.variable)),null!=this.accumulatedMoments&&Object(pe.a)(this.accumulatedMoments.map(t=>t.variable))}async getWeights(){const t=[...this.accumulatedMeanSquares,...this.accumulatedMoments];return this.centered&&t.push(...this.accumulatedMeanGrads),[await this.saveIterations()].concat(t.map(t=>({name:t.originalName,tensor:t.variable})))}async setWeights(t){t=await this.extractIterations(t);const e=this.centered?t.length/3:t.length/2;this.accumulatedMeanSquares=t.slice(0,e).map(t=>({originalName:t.name,variable:t.tensor.variable(!1)})),this.accumulatedMoments=t.slice(e,2*e).map(t=>({originalName:t.name,variable:t.tensor.variable(!1)})),this.centered&&(this.accumulatedMeanGrads=t.slice(2*e,3*e).map(t=>({originalName:t.name,variable:t.tensor.variable(!1)})))}getConfig(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}}static fromConfig(t,e){return new t(e.learningRate,e.decay,e.momentum,e.epsilon,e.centered)}}Le.className="RMSProp",ce(Le); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class Pe{static sgd(t){return new De(t)}static momentum(t,e,n=!1){return new Me(t,e,n)}static rmsprop(t,e=.9,n=0,r=null,i=!1){return new Le(t,e,n,r,i)}static adam(t=.001,e=.9,n=.999,r=null){return new Ie(t,e,n,r)}static adadelta(t=.001,e=.95,n=null){return new Ee(t,e,n)}static adamax(t=.002,e=.9,n=.999,r=null,i=0){return new Ne(t,e,n,r,i)}static adagrad(t,e=.1){return new Ce(t,e)}}var Fe=n("3goy"),Be=n("HOGz");const je={sgd:Pe.sgd,momentum:Pe.momentum,adadelta:Pe.adadelta,adagrad:Pe.adagrad,rmsprop:Pe.rmsprop,adamax:Pe.adamax,adam:Pe.adam},$e=(()=>"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate?setImmediate:t=>t())(); /** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function Ue(){return new Promise(t=>$e(()=>t()))}var Ve=n("DqkE"); /** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function We(t,e){const n=t[0].length;t.forEach((t,e)=>{I.assert(t.length===n,()=>`Error in concat${n}D: rank of tensors[${e}] must be the same `+`as the rank of the rest (${n})`)}),I.assert(e>=0&&e`Error in concat${n}D: axis must be between 0 and ${n-1}.`);const r=t[0];t.forEach((t,i)=>{for(let o=0;o`Error in concat${n}D: Shape of tensors[${i}] (${t}) `+`does not match the shape of the rest (${r}) `+`along the non-concatenated axis ${i}.`)})}function He(t,e){const n=t[0].slice();for(let r=1;r=2*e+1||r%2==1?i.push(r):n.push(r);r.push(...n),r.push(0),r.push(...i)}return r}function Ze(t,e,n,r=!0){const i=[];r?i.push(t[0]/n):i.push(t[0]*n);for(let n=1;n/g,En=",",xn="...";function wn(t,e){const n=((t=t.replace(/\s/g,"")).length-t.replace(Tn,"").length)/yn.length;if(n<1)throw new Error("Equations without an arrow are not supported.");if(n>1)throw new Error(`Equation must contain exactly one arrow ("${yn}").`);const[r,i]=t.split(yn);Object(_n.b)(-1===r.indexOf(xn),()=>`The ellipsis notation ("${xn}") is not supported yet.`);const o=r.split(En),s=o.length;if(e!==s)throw new Error(`Expected ${s} input tensors, received ${e}`);if(s>2)throw new Error("Support for more than 2 input tensors is not implemented yet.");const a=[];for(let t=0;t-1!==t.indexOf(e)))throw new Error(`Output subscripts contain the label ${e} `+"not present in the input subscripts.");-1===a.indexOf(e)&&a.push(e)}for(let t=0;t-1!==t),expandDims:r}}function Sn(t,e,n){const r=new Array(t);for(let t=0;t`Expected dimension ${r[e[t][n]]} at axis ${n} `+`of input shaped ${JSON.stringify(i)}, `+`but got dimension ${i[n]}`)}}function kn(t,e){const n=t,r=[];let i=0;0===t.length&&n.push(-1),i=t.length+1;for(let t=0;tt===e)}function In(t,e){const n=[];for(let r=0;r"Number of splits must evenly divide the axis."),r=new Array(e).fill(t.shape[n]/e);else{const i=e.reduce((t,e)=>(-1===e&&(t+=1),t),0);Object(I.assert)(i<=1,()=>"There should be only one negative value in split array.");const o=e.indexOf(-1);if(-1!==o){const r=e.reduce((t,e)=>e>0?t+e:t);e[o]=t.shape[n]-r}Object(I.assert)(t.shape[n]===e.reduce((t,e)=>t+e),()=>"The sum of sizes must match the size of the axis dimension."),r=e}return r} /** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function An(t){return`Received SparseTensor with denseShape[0] = 0 but\n indices.shape[0] = ${t}`}function Nn(t,e){return`indices(${t}, 0) is invalid: ${e} < 0`}function Dn(t,e,n){return`indices(${t}, 0) is invalid: ${e} >= ${n}`} /** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function Mn(t,e){return`only one output dimension may be -1, not both ${t} and ${e}`}function Ln(t,e){return`size ${t} must be non-negative, not ${e}`}function Pn(){return"reshape cannot infer the missing input size for an empty tensor unless all specified input sizes are non-zero"}function Fn(t,e){return`Input to reshape is a SparseTensor with ${Object(I.sizeFromShape)(t)}\n dense values, but the requested shape requires a multiple of ${Object(I.sizeFromShape)(e)}. inputShape=${t} outputShape= ${e}`}function Bn(t,e){return`Input to reshape is a tensor with ${Object(I.sizeFromShape)(t)} dense values, but the requested shape has ${Object(I.sizeFromShape)(e)}. inputShape=${t} outputShape=${e}`} /** * @license * Copyright 2021 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function jn(){return"segment ids must be >= 0"}function $n(){return"segment ids are not increasing"}function Un(t,e){return`Segment id ${t} out of range [0, ${e}), possibly because segmentIds input is not sorted.`}function Vn(t,e,n){return`Bad: indices[${t}] == ${e} out of range [0, ${n})`} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function Wn(t,e){let n,r=!1;for(t<=Xe?(n=t,r=!0):n=Object(I.nearestDivisor)(t,Math.floor(Math.sqrt(t)));!r;)n>e||n===t?r=!0:n=Object(I.nearestDivisor)(t,n+1);return n}function Hn(t,e,n){const r=[],i=t.length;for(let o=0;oi))throw new Error(`Expect batchDims in the range of [-${i}, ${i}], but got ${r}`);if(r<0&&(r+=i),r>o)throw new Error(`batchDims (${r}) must be less than rank(x) (\n ${o}).`);if(nObject(I.decodeString)(t))}catch(t){throw new Error(`Failed to decode encoded string bytes into utf-8, error: ${t}`)}}function Xn(t){return t.map(t=>Object(I.encodeString)(t))}var Kn=n("kESI"),Yn=n("7Mdl"),qn=n("cTqU"),Jn=n("ngdQ"); /** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */n.d(e,!1,function(){return Ee}),n.d(e,!1,function(){return Ce}),n.d(e,!1,function(){return Ie}),n.d(e,!1,function(){return Ne}),n.d(e,!1,function(){return Me}),n.d(e,!1,function(){return Te}),n.d(e,!1,function(){return Pe}),n.d(e,!1,function(){return Le}),n.d(e,!1,function(){return De}),n.d(e,"_103",function(){return tt.a}),n.d(e,"_104",function(){return tt.b}),n.d(e,!1,function(){return tt.c}),n.d(e,!1,function(){}),n.d(e,"_145",function(){return Fe.a}),n.d(e,"_151",function(){return Fe.b}),n.d(e,!1,function(){return Be.a}),n.d(e,!1,function(){return ye.a}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ye.b}),n.d(e,!1,function(){return p.a}),n.d(e,"_127",function(){return p.b}),n.d(e,!1,function(){}),n.d(e,!1,function(){return"3.14.0"}),n.d(e,!1,function(){return Ue}),n.d(e,"_117",function(){return o}),n.d(e,"_131",function(){return r}),n.d(e,!1,function(){return i}),n.d(e,!1,function(){return l}),n.d(e,!1,function(){return de}),n.d(e,"_152",function(){return I}),n.d(e,"_115",function(){return c}),n.d(e,"_116",function(){return At}),n.d(e,!1,function(){return he}),n.d(e,"_141",function(){return a}),n.d(e,!1,function(){return s}),n.d(e,!1,function(){return Vt}),n.d(e,"_123",function(){return Kn}),n.d(e,"_133",function(){return h}),n.d(e,"_21",function(){return Jn.b}),n.d(e,"M",function(){return Jn.a}),n.d(e,!1,function(){return ve.a}),n.d(e,!1,function(){return ve.b}),n.d(e,!1,function(){return ve.c}),n.d(e,"_114",function(){return ve.d}),n.d(e,!1,function(){return ve.e}),n.d(e,!1,function(){return ve.f}),n.d(e,!1,function(){return ve.g}),n.d(e,!1,function(){return ve.h}),n.d(e,!1,function(){return ve.i}),n.d(e,!1,function(){return ve.j}),n.d(e,!1,function(){return ve.k}),n.d(e,!1,function(){return ve.l}),n.d(e,!1,function(){return ve.m}),n.d(e,!1,function(){return ve.n}),n.d(e,!1,function(){return ve.o}),n.d(e,!1,function(){return ve.p}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve.r}),n.d(e,!1,function(){return ve.q}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve.s}),n.d(e,!1,function(){return ve.t}),n.d(e,!1,function(){return ve.u}),n.d(e,"_118",function(){return ve.v}),n.d(e,"_119",function(){return ve.w}),n.d(e,!1,function(){return ve.x}),n.d(e,"_120",function(){return ve.y}),n.d(e,"_121",function(){return ve.z}),n.d(e,!1,function(){return ve.A}),n.d(e,"_122",function(){return ve.B}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve.C}),n.d(e,!1,function(){return ve.D}),n.d(e,!1,function(){return ve.E}),n.d(e,!1,function(){return ve.F}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve.G}),n.d(e,!1,function(){return ve.H}),n.d(e,!1,function(){return ve.I}),n.d(e,!1,function(){return ve.J}),n.d(e,!1,function(){return ve.K}),n.d(e,!1,function(){return ve.L}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve.M}),n.d(e,"_125",function(){return ve.N}),n.d(e,!1,function(){return ve.O}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve.P}),n.d(e,!1,function(){return ve.Q}),n.d(e,!1,function(){return ve.R}),n.d(e,!1,function(){return ve.S}),n.d(e,"_128",function(){return ve.T}),n.d(e,"_129",function(){return ve.U}),n.d(e,!1,function(){return ve.V}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve.X}),n.d(e,!1,function(){return ve.Y}),n.d(e,!1,function(){return ve.Z}),n.d(e,!1,function(){return ve._1}),n.d(e,!1,function(){return ve._3}),n.d(e,!1,function(){return ve._4}),n.d(e,!1,function(){return ve._6}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._9}),n.d(e,!1,function(){return ve._10}),n.d(e,!1,function(){return ve._11}),n.d(e,!1,function(){return ve._12}),n.d(e,!1,function(){return ve._13}),n.d(e,!1,function(){return ve._14}),n.d(e,!1,function(){return ve._15}),n.d(e,!1,function(){return ve._16}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._17}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._18}),n.d(e,!1,function(){return ve._19}),n.d(e,!1,function(){return ve._20}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._21}),n.d(e,!1,function(){return ve._22}),n.d(e,!1,function(){return ve._23}),n.d(e,!1,function(){return ve._24}),n.d(e,!1,function(){return ve._25}),n.d(e,!1,function(){return ve._26}),n.d(e,!1,function(){return ve._27}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._28}),n.d(e,!1,function(){return ve._29}),n.d(e,!1,function(){return ve._30}),n.d(e,!1,function(){return ve._31}),n.d(e,!1,function(){}),n.d(e,"_134",function(){return ve._32}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._33}),n.d(e,!1,function(){return ve._34}),n.d(e,!1,function(){return ve._35}),n.d(e,!1,function(){return ve._36}),n.d(e,!1,function(){return ve._37}),n.d(e,!1,function(){return ve._38}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._39}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._40}),n.d(e,!1,function(){return ve._41}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._42}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._43}),n.d(e,!1,function(){return ve._44}),n.d(e,!1,function(){return ve._45}),n.d(e,!1,function(){return ve._46}),n.d(e,!1,function(){return ve._47}),n.d(e,!1,function(){return ve._48}),n.d(e,"_137",function(){return ve._49}),n.d(e,!1,function(){return ve._50}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._52}),n.d(e,!1,function(){return ve._53}),n.d(e,"_138",function(){return ve._54}),n.d(e,!1,function(){return ve._56}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._57}),n.d(e,"_139",function(){return ve._58}),n.d(e,!1,function(){return ve._59}),n.d(e,!1,function(){return ve._60}),n.d(e,!1,function(){return ve._61}),n.d(e,"_140",function(){return ve._62}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._63}),n.d(e,!1,function(){return ve._64}),n.d(e,!1,function(){return ve._65}),n.d(e,!1,function(){return ve.W}),n.d(e,!1,function(){return ve._5}),n.d(e,!1,function(){return ve._8}),n.d(e,!1,function(){return ve._51}),n.d(e,!1,function(){return ve._68}),n.d(e,!1,function(){return ve._69}),n.d(e,!1,function(){return ve._70}),n.d(e,!1,function(){return ve._71}),n.d(e,"_142",function(){return ve._72}),n.d(e,"_143",function(){return ve._73}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._74}),n.d(e,"_144",function(){return ve._76}),n.d(e,!1,function(){return ve._77}),n.d(e,!1,function(){return ve._78}),n.d(e,!1,function(){return ve._79}),n.d(e,"_146",function(){return ve._80}),n.d(e,"_147",function(){return ve._81}),n.d(e,"_148",function(){return ve._82}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._83}),n.d(e,!1,function(){return ve._84}),n.d(e,!1,function(){return ve._86}),n.d(e,!1,function(){return ve._87}),n.d(e,!1,function(){}),n.d(e,"_150",function(){return ve._88}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._89}),n.d(e,!1,function(){return ve._90}),n.d(e,"_153",function(){return ve._91}),n.d(e,!1,function(){return ve._92}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,"_130",function(){return ve._7}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._0}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._66}),n.d(e,!1,function(){return ve._75}),n.d(e,!1,function(){return je}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,"_126",function(){return pe.b}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,"_149",function(){return pe.e}),n.d(e,"_124",function(){return pe.a}),n.d(e,"_132",function(){return pe.c}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,"_135",function(){return pe.d}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return Dt.b}),n.d(e,!1,function(){return Dt.a}),n.d(e,!1,function(){return Dt.c}),n.d(e,"_136",function(){return Dt.d}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,"a",function(){return Nt.a}),n.d(e,"b",function(){return Nt.b}),n.d(e,"c",function(){return Nt.c}),n.d(e,"d",function(){return Nt.d}),n.d(e,"e",function(){return Nt.e}),n.d(e,"f",function(){return Nt.f}),n.d(e,"g",function(){return Nt.g}),n.d(e,"h",function(){return Nt.h}),n.d(e,"i",function(){return Nt.i}),n.d(e,"j",function(){return Nt.j}),n.d(e,"k",function(){return Nt.k}),n.d(e,"l",function(){return Nt.l}),n.d(e,"n",function(){return Nt.n}),n.d(e,"m",function(){return Nt.m}),n.d(e,"o",function(){return Nt.o}),n.d(e,"r",function(){return Nt.r}),n.d(e,"p",function(){return Nt.p}),n.d(e,"q",function(){return Nt.q}),n.d(e,"s",function(){return Nt.s}),n.d(e,"t",function(){return Nt.t}),n.d(e,"u",function(){return Nt.u}),n.d(e,!1,function(){}),n.d(e,"v",function(){return Nt.v}),n.d(e,"w",function(){return Nt.w}),n.d(e,"x",function(){return Nt.x}),n.d(e,"y",function(){return Nt.y}),n.d(e,"z",function(){return Nt.z}),n.d(e,"A",function(){return Nt.A}),n.d(e,"B",function(){return Nt.B}),n.d(e,"C",function(){return Nt.C}),n.d(e,"D",function(){return Nt.D}),n.d(e,"E",function(){return Nt.E}),n.d(e,"F",function(){return Nt.F}),n.d(e,"G",function(){return Nt.G}),n.d(e,"H",function(){return Nt.H}),n.d(e,"I",function(){return Nt.I}),n.d(e,"J",function(){return Nt.J}),n.d(e,"L",function(){return Nt.L}),n.d(e,"K",function(){return Nt.K}),n.d(e,"N",function(){return Nt.M}),n.d(e,"O",function(){return Nt.N}),n.d(e,"P",function(){return Nt.O}),n.d(e,"Q",function(){return Nt.P}),n.d(e,"R",function(){return Nt.Q}),n.d(e,"S",function(){return Nt.R}),n.d(e,"T",function(){return Nt.S}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,"_61",function(){return Nt._59}),n.d(e,"U",function(){return Nt.T}),n.d(e,"V",function(){return Nt.U}),n.d(e,"W",function(){return Nt.V}),n.d(e,"Y",function(){return Nt.X}),n.d(e,"X",function(){return Nt.W}),n.d(e,"Z",function(){return Nt.Y}),n.d(e,"_0",function(){return Nt.Z}),n.d(e,"_1",function(){return Nt._0}),n.d(e,"_2",function(){return Nt._1}),n.d(e,"_3",function(){return Nt._2}),n.d(e,"_4",function(){return Nt._3}),n.d(e,"_5",function(){return Nt._4}),n.d(e,"_6",function(){return Nt._5}),n.d(e,"_8",function(){return Nt._7}),n.d(e,"_12",function(){return Nt._11}),n.d(e,"_11",function(){return Nt._10}),n.d(e,"_13",function(){return Nt._12}),n.d(e,"_14",function(){return Nt._13}),n.d(e,"_16",function(){return Nt._15}),n.d(e,"_15",function(){return Nt._14}),n.d(e,"_17",function(){return Nt._16}),n.d(e,"_18",function(){return Nt._17}),n.d(e,"_19",function(){return Nt._18}),n.d(e,"_20",function(){return Nt._19}),n.d(e,"_24",function(){return Nt._22}),n.d(e,"_25",function(){return Nt._23}),n.d(e,"_26",function(){return Nt._24}),n.d(e,"_27",function(){return Nt._25}),n.d(e,"_28",function(){return Nt._26}),n.d(e,"_29",function(){return Nt._27}),n.d(e,"_30",function(){return Nt._28}),n.d(e,"_31",function(){return Nt._29}),n.d(e,"_32",function(){return Nt._30}),n.d(e,!1,function(){}),n.d(e,"_22",function(){return Nt._20}),n.d(e,"_23",function(){return Nt._21}),n.d(e,"_33",function(){return Nt._31}),n.d(e,"_39",function(){return Nt._37}),n.d(e,"_34",function(){return Nt._32}),n.d(e,"_37",function(){return Nt._35}),n.d(e,"_35",function(){return Nt._33}),n.d(e,"_36",function(){return Nt._34}),n.d(e,"_38",function(){return Nt._36}),n.d(e,"_40",function(){return Nt._38}),n.d(e,"_41",function(){return Nt._39}),n.d(e,"_42",function(){return Nt._40}),n.d(e,"_43",function(){return Nt._41}),n.d(e,"_44",function(){return Nt._42}),n.d(e,"_45",function(){return Nt._43}),n.d(e,"_46",function(){return Nt._44}),n.d(e,"_47",function(){return Nt._45}),n.d(e,"_51",function(){return Nt._49}),n.d(e,"_48",function(){return Nt._46}),n.d(e,"_49",function(){return Nt._47}),n.d(e,"_50",function(){return Nt._48}),n.d(e,"_53",function(){return Nt._51}),n.d(e,"_52",function(){return Nt._50}),n.d(e,"_54",function(){return Nt._52}),n.d(e,"_55",function(){return Nt._53}),n.d(e,!1,function(){}),n.d(e,"_56",function(){return Nt._54}),n.d(e,"_57",function(){return Nt._55}),n.d(e,"_58",function(){return Nt._56}),n.d(e,"_59",function(){return Nt._57}),n.d(e,"_60",function(){return Nt._58}),n.d(e,"_62",function(){return Nt._60}),n.d(e,"_63",function(){return Nt._61}),n.d(e,"_65",function(){return Nt._63}),n.d(e,"_68",function(){return Nt._66}),n.d(e,"_69",function(){return Nt._67}),n.d(e,"_66",function(){return Nt._64}),n.d(e,"_67",function(){return Nt._65}),n.d(e,"_64",function(){return Nt._62}),n.d(e,"_70",function(){return Nt._68}),n.d(e,"_72",function(){return Nt._70}),n.d(e,"_73",function(){return Nt._71}),n.d(e,"_74",function(){return Nt._72}),n.d(e,"_75",function(){return Nt._73}),n.d(e,"_76",function(){return Nt._74}),n.d(e,"_81",function(){return Nt._79}),n.d(e,"_79",function(){return Nt._77}),n.d(e,"_80",function(){return Nt._78}),n.d(e,"_78",function(){return Nt._76}),n.d(e,"_77",function(){return Nt._75}),n.d(e,"_83",function(){return Nt._81}),n.d(e,"_91",function(){return Nt._89}),n.d(e,"_100",function(){return Nt._98}),n.d(e,"_84",function(){return Nt._82}),n.d(e,"_90",function(){return Nt._88}),n.d(e,"_82",function(){return Nt._80}),n.d(e,"_85",function(){return Nt._83}),n.d(e,"_86",function(){return Nt._84}),n.d(e,"_87",function(){return Nt._85}),n.d(e,"_88",function(){return Nt._86}),n.d(e,"_89",function(){return Nt._87}),n.d(e,"_93",function(){return Nt._91}),n.d(e,"_92",function(){return Nt._90}),n.d(e,"_95",function(){return Nt._93}),n.d(e,"_96",function(){return Nt._94}),n.d(e,"_97",function(){return Nt._95}),n.d(e,"_98",function(){return Nt._96}),n.d(e,"_99",function(){return Nt._97}),n.d(e,"_101",function(){return Nt._99}),n.d(e,"_102",function(){return Nt._100}),n.d(e,"_105",function(){return Nt._101}),n.d(e,"_106",function(){return Nt._102}),n.d(e,"_107",function(){return Nt._103}),n.d(e,"_108",function(){return Nt._104}),n.d(e,"_109",function(){return Nt._105}),n.d(e,"_110",function(){return Nt._106}),n.d(e,"_111",function(){return Nt._107}),n.d(e,"_112",function(){return Nt._108}),n.d(e,"_94",function(){return Nt._92}),n.d(e,"_7",function(){return Nt._6}),n.d(e,"_71",function(){return Nt._69}),n.d(e,"_113",function(){return Nt._109}),n.d(e,"_9",function(){return Nt._8}),n.d(e,"_10",function(){return Nt._9}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._85}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){return ve._55}),n.d(e,!1,function(){return ve._67}),n.d(e,!1,function(){return ve._2}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){}),n.d(e,!1,function(){})},JffD:function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("35G1");const a=Object(s.a)({prelu_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e){const n={x:Object(o.a)(t,"x","prelu"),alpha:Object(o.a)(e,"alpha","prelu")};return r.a.runKernel(i._55,n)}});e.a=a},K9mh:function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("jb1O"),s=n("xMQ1"),a=n("35G1");const l=Object(a.a)({floorDiv_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e){let n=Object(s.a)(t,"a","floorDiv"),a=Object(s.a)(e,"b","floorDiv");[n,a]=Object(o.c)(n,a);const l={a:n,b:a};return r.a.runKernel(i._5,l)}});e.a=l},KCLY:function(t,e,n){"use strict";(function(e){var r=n("cGG2"),i=n("5VQ+"),o={"Content-Type":"application/x-www-form-urlencoded"};function s(t,e){!r.isUndefined(t)&&r.isUndefined(t["Content-Type"])&&(t["Content-Type"]=e)}var a,l={adapter:("undefined"!=typeof XMLHttpRequest?a=n("7GwW"):void 0!==e&&"[object process]"===Object.prototype.toString.call(e)&&(a=n("7GwW")),a),transformRequest:[function(t,e){return i(e,"Accept"),i(e,"Content-Type"),r.isFormData(t)||r.isArrayBuffer(t)||r.isBuffer(t)||r.isStream(t)||r.isFile(t)||r.isBlob(t)?t:r.isArrayBufferView(t)?t.buffer:r.isURLSearchParams(t)?(s(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString()):r.isObject(t)?(s(e,"application/json;charset=utf-8"),JSON.stringify(t)):t}],transformResponse:[function(t){if("string"==typeof t)try{t=JSON.parse(t)}catch(t){}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(t){return t>=200&&t<300}};l.headers={common:{Accept:"application/json, text/plain, */*"}},r.forEach(["delete","get","head"],function(t){l.headers[t]={}}),r.forEach(["post","put","patch"],function(t){l.headers[t]=r.merge(o)}),t.exports=l}).call(e,n("W2nU"))},Kh4W:function(t,e,n){e.f=n("dSzd")},Kkag:function(t,e,n){"use strict";var r=n("ngdQ"),i=n("v/P2"),o=n("Nhog"),s=n("l5jf"),a=n("aYFL"),l=n("QSAg"),u=n("XFvI"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class c{constructor(t,e){this.backendTimer=t,this.logger=e,null==e&&(this.logger=new d)}profileKernel(t,e,n){let r;const o=()=>{r=n()};let s;const a=u.now();if(this.backendTimer.timerAvailable())s=this.backendTimer.time(o);else{o();for(const t of r)t.dataSync();s=Promise.resolve({kernelMs:u.now()-a})}if(Object(i.b)().getBool("CHECK_COMPUTATION_FOR_ERRORS"))for(let e=0;e{h(e,n.dtype,t)})}return{kernelName:t,outputs:r,inputs:e,timeMs:s.then(t=>t.kernelMs),extraInfo:s.then(t=>null!=t.getExtraProfileInfo?t.getExtraProfileInfo():"")}}logKernelProfile(t){const{kernelName:e,outputs:n,timeMs:r,inputs:i,extraInfo:o}=t;n.forEach(t=>{Promise.all([t.data(),r,o]).then(n=>{this.logger.logKernelProfile(e,t,n[0],n[1],i,n[2])})})}}function h(t,e,n){if("float32"!==e)return!1;for(let e=0;e0?r:""} `}}console.log(`%c${a}\t%c${s}\t%c${l}D ${h}\t%c${c}\t%c${d}\t%c${o}`,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")}} /** * @license * Copyright 2017 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */var p=n("XPNO"),f=n("jb1O"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function g(t){return null!=t.kernelName}e.b=b;class m{constructor(){this.registeredVariables={},this.nextTapeNodeId=0,this.numBytes=0,this.numTensors=0,this.numStringTensors=0,this.numDataBuffers=0,this.gradientDepth=0,this.kernelDepth=0,this.scopeStack=[],this.numDataMovesStack=[],this.nextScopeId=0,this.tensorInfo=new WeakMap,this.profiling=!1,this.activeProfile={newBytes:0,newTensors:0,peakBytes:0,kernels:[],result:null,get kernelNames(){return Array.from(new Set(this.kernels.map(t=>t.name)))}}}dispose(){for(const t in this.registeredVariables)this.registeredVariables[t].dispose()}}class v{constructor(t){this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new m}async ready(){if(null!=this.pendingBackendInit)return this.pendingBackendInit.then(()=>{});if(null!=this.backendInstance)return;const t=this.getSortedBackends();for(let e=0;e{null!=t.setupFunc&&t.setupFunc(this.backendInstance)})}disposeRegisteredKernels(t){Object(a.c)(t).forEach(e=>{null!=e.disposeFunc&&e.disposeFunc(this.registry[t])})}initializeBackend(t){const e=this.registryFactory[t];if(null==e)throw new Error(`Cannot initialize backend ${t}, no registration found.`);try{const n=e.factory();if(!n||n instanceof r.b||"function"!=typeof n.then)return this.registry[t]=n,{success:!0,asyncInit:!1};{const e=++this.pendingBackendInitId,r=n.then(n=>!(e!(ethis.registryFactory[e].priority-this.registryFactory[t].priority)}initializeBackendsAndReturnBest(){const t=this.getSortedBackends();for(let e=0;ethis.startScope(r),()=>this.endScope(n),()=>((n=e())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n))}scopedRun(t,e,n){t();try{const t=n();return e(),t}catch(t){throw e(),t}}nextTensorId(){return v.nextTensorId++}nextVariableId(){return v.nextVariableId++}clone(t){const e=_.runKernel(s._15,{x:t}),n={x:t};return this.addTapeNode(this.state.activeScope.name,n,[e],t=>({x:()=>{const e={x:t},n={dtype:"float32"};return _.runKernel(s.w,e,n)}}),[],{}),e}runKernel(t,e,n){if(null==this.backendName&&this.backend,!(null!=Object(a.b)(t,this.backendName)))throw new Error(`Kernel '${t}' not registered for backend '${this.backendName}'`);return this.runKernelFunc({kernelName:t,inputs:e,attrs:n})}shouldCheckForMemLeaks(){return this.ENV.getBool("IS_TEST")}checkKernelForMemLeak(t,e,n){const r=this.backend.numDataIds();let i=0;n.forEach(t=>{i+="complex64"===t.dtype?3:1});const o=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],s=r-e-i-o;if(s>0)throw new Error(`Backend '${this.backendName}' has an internal memory leak `+`(${s} data ids) after running '${t}'`)}runKernelFunc(t){let e,n=[];const r=this.isTapeOn(),i=this.state.numBytes,o=this.state.numTensors;let s,l;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0),null==this.backendName&&this.backend;const c=g(t)?t.kernelName:null!=this.state.activeScope?this.state.activeScope.name:"";if(g(t)){const{kernelName:e,inputs:i,attrs:o}=t;null==this.backendName&&this.backend;const c=Object(a.b)(e,this.backendName);u.assert(null!=c,()=>`Cannot find registered kernel '${e}' for backend '${this.backendName}'`),s=(()=>{const t=this.backend.numDataIds();l=c.kernelFunc({inputs:i,attrs:o,backend:this.backend});const s=Array.isArray(l)?l:[l];this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(e,t,s);const a=s.map(t=>{if(null!=t.rank)return t;const{dataId:e,shape:n,dtype:r}=t;return this.makeTensorFromDataId(e,n,r)});if(r){const t=this.getTensorsForGradient(e,i,a);n=this.saveTensorsForBackwardMode(t)}return a})}else{const{forwardFunc:e}=t,i=t=>{r&&(n=t.map(t=>this.keep(this.clone(t))))};s=(()=>{const t=this.backend.numDataIds();l=this.tidy(()=>e(this.backend,i));const n=Array.isArray(l)?l:[l];return this.shouldCheckForMemLeaks()&&this.checkKernelForMemLeak(c,t,n),n})}const{inputs:h,attrs:d}=t,p=g(t)?null:t.backwardsFunc;let f;return this.scopedRun(()=>this.state.kernelDepth++,()=>this.state.kernelDepth--,()=>{this.ENV.getBool("DEBUG")||this.state.profiling?(f=this.profiler.profileKernel(c,h,()=>s()),this.ENV.getBool("DEBUG")&&this.profiler.logKernelProfile(f),e=f.outputs):e=s()}),r&&this.addTapeNode(c,h,e,p,n,d),this.state.profiling&&this.state.activeProfile.kernels.push({name:c,bytesAdded:this.state.numBytes-i,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-o,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(h).map(t=>null!=h[t]?h[t].shape:null),outputShapes:e.map(t=>t.shape),kernelTimeMs:f.timeMs,extraInfo:f.extraInfo}),Array.isArray(l)?e:e[0]}saveTensorsForBackwardMode(t){return t.map(t=>this.keep(this.clone(t)))}getTensorsForGradient(t,e,n){const r=Object(a.a)(t);if(null!=r){const t=r.inputsToSave||[],i=r.outputsToSave||[];let o;r.saveAllInputs?(u.assert(Array.isArray(e),()=>"saveAllInputs is true, expected inputs to be an array."),o=Object.keys(e).map(t=>e[t])):o=t.map(t=>e[t]);const s=n.filter((t,e)=>i[e]);return o.concat(s)}return[]}makeTensor(t,e,n,r){if(null==t)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;let i=t;"string"===n&&u.isString(t[0])&&(i=t.map(t=>u.encodeString(t)));const o=r.write(i,e,n),s=new p.a(e,n,o,this.nextTensorId());if(this.trackTensor(s,r),"string"===n){const t=this.state.tensorInfo.get(o),e=Object(u.bytesFromStringArray)(i);this.state.numBytes+=e-t.bytes,t.bytes=e}return s}makeTensorFromDataId(t,e,n,r){n=n||"float32";const i=new p.a(e,n,t,this.nextTensorId());return this.trackTensor(i,r),i}makeVariable(t,e=!0,n,r){n=n||this.nextVariableId().toString(),null!=r&&r!==t.dtype&&(t=t.cast(r));const i=new p.c(t,e,n,this.nextTensorId());if(null!=this.state.registeredVariables[i.name])throw new Error(`Variable with name ${i.name} was already registered`);return this.state.registeredVariables[i.name]=i,this.incRef(i,this.backend),i}trackTensor(t,e){this.state.numTensors++,"string"===t.dtype&&this.state.numStringTensors++;let n=0;"complex64"!==t.dtype&&"string"!==t.dtype&&(n=t.size*u.bytesPerElement(t.dtype)),this.state.numBytes+=n,this.state.tensorInfo.has(t.dataId)||(this.state.numDataBuffers++,this.state.tensorInfo.set(t.dataId,{backend:e||this.backend,dtype:t.dtype,shape:t.shape,bytes:n})),t instanceof p.c||this.track(t)}incRef(t,e){this.trackTensor(t,e),this.backend.incRef(t.dataId)}removeDataId(t,e){this.state.tensorInfo.has(t)&&this.state.tensorInfo.get(t).backend===e&&(this.state.tensorInfo.delete(t),this.state.numDataBuffers--)}disposeTensor(t){if(!this.state.tensorInfo.has(t.dataId))return;const e=this.state.tensorInfo.get(t.dataId);if(this.state.numTensors--,"string"===t.dtype&&(this.state.numStringTensors--,this.state.numBytes-=e.bytes),"complex64"!==t.dtype&&"string"!==t.dtype){const e=t.size*u.bytesPerElement(t.dtype);this.state.numBytes-=e}e.backend.disposeData(t.dataId)&&this.removeDataId(t.dataId,e.backend)}disposeVariables(){for(const t in this.state.registeredVariables){const e=this.state.registeredVariables[t];this.disposeVariable(e)}}disposeVariable(t){this.disposeTensor(t),null!=this.state.registeredVariables[t.name]&&delete this.state.registeredVariables[t.name]}memory(){const t=this.backend.memory();return t.numTensors=this.state.numTensors,t.numDataBuffers=this.state.numDataBuffers,t.numBytes=this.state.numBytes,this.state.numStringTensors>0&&(t.unreliable=!0,null==t.reasons&&(t.reasons=[]),t.reasons.push("Memory usage by string tensors is approximate (2 bytes per character)")),t}async profile(t){this.state.profiling=!0;const e=this.state.numBytes,n=this.state.numTensors;this.state.activeProfile.kernels=[],this.state.activeProfile.result=await t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max(...this.state.activeProfile.kernels.map(t=>t.totalBytesSnapshot)),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-n;for(const t of this.state.activeProfile.kernels)t.kernelTimeMs=await t.kernelTimeMs,t.extraInfo=await t.extraInfo;return this.state.activeProfile}isTapeOn(){return this.state.gradientDepth>0&&0===this.state.kernelDepth}addTapeNode(t,e,n,r,i,o){const s={id:this.state.nextTapeNodeId++,kernelName:t,inputs:e,outputs:n,saved:i},l=Object(a.a)(t);null!=l&&(r=l.gradFunc),null!=r&&(s.gradient=(t=>(t=t.map((t,e)=>{if(null==t){const t=n[e],r=u.makeZerosTypedArray(t.size,t.dtype);return this.makeTensor(r,t.shape,t.dtype)}return t}),r(t.length>1?t:t[0],i,o)))),this.state.activeTape.push(s)}keep(t){return t.kept=!0,t}startTape(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++}endTape(){this.state.gradientDepth--}startScope(t){const e={track:[],name:"unnamed scope",id:this.state.nextScopeId++};t&&(e.name=t),this.state.scopeStack.push(e),this.state.activeScope=e}endScope(t){const e=Object(f.b)(t),n=new Set(e.map(t=>t.id));for(let t=0;t{t.kept||t.scopeId!==r.id||this.track(t)})}gradients(t,e,n,r=!1){if(u.assert(e.length>0,()=>"gradients() received an empty list of xs."),null!=n&&"float32"!==n.dtype)throw new Error(`dy must have 'float32' dtype, but has '${n.dtype}'`);const i=this.scopedRun(()=>this.startTape(),()=>this.endTape(),()=>this.tidy("forward",t));u.assert(i instanceof p.a,()=>"The result y returned by f() must be a tensor.");const o=function(t,e,n){const r={},i={};for(let t=0;tr[t.id]=!0),a=!0,i[o.id]=!0;break}if(a)break}}const o={};o[n.id]=!0;const s={};for(let e=t.length-1;e>=0;e--){const n=t[e],r=n.inputs;for(let t=0;t0)throw new Error("Cannot compute gradient of y=f(x) with respect to x. Make sure that the f you passed encloses all operations that lead from x to y.");return this.tidy("backward",()=>{const t={};t[i.id]=null==n?function(t){const e=Object(u.makeOnesTypedArray)(Object(u.sizeFromShape)(t),"float32");return _.makeTensor(e,t,"float32")}(i.shape):n,function(t,e,n,r){for(let i=e.length-1;i>=0;i--){const o=e[i],s=[];if(o.outputs.forEach(e=>{const n=t[e.id];null!=n?s.push(n):s.push(null)}),null==o.gradient)throw new Error("Cannot compute gradient: gradient function not found "+`for ${o.kernelName}.`);const a=o.gradient(s);for(const e in o.inputs){if(!(e in a))throw new Error(`Cannot backprop through input ${e}. `+`Available gradients found: ${Object.keys(a)}.`);const i=n(()=>a[e]());if("float32"!==i.dtype)throw new Error(`Error in gradient for op ${o.kernelName}. The gradient of input `+`${e} must have 'float32' dtype, but has '${i.dtype}'`);const s=o.inputs[e];if(!u.arraysEqual(i.shape,s.shape))throw new Error(`Error in gradient for op ${o.kernelName}. The gradient of input `+`'${e}' has shape '${i.shape}', which does not match `+`the shape of the input '${s.shape}'`);if(null==t[s.id])t[s.id]=i;else{const e=t[s.id];t[s.id]=r(e,i),e.dispose()}}}}(t,o,t=>this.tidy(t),y);const r=e.map(e=>t[e.id]);return 0===this.state.gradientDepth&&(this.state.activeTape.forEach(t=>{for(const e of t.saved)e.dispose()}),this.state.activeTape=null),{value:i,grads:r}})}customGrad(t){return u.assert(u.isFunction(t),()=>"The f passed in customGrad(f) must be a function."),(...e)=>{let n;u.assert(e.every(t=>t instanceof p.a),()=>"The args passed in customGrad(f)(x1, x2,...) must all be tensors");const r={};e.forEach((t,e)=>{r[e]=t});return this.runKernelFunc({forwardFunc:(r,i)=>(n=t(...[...e,i]),u.assert(n.value instanceof p.a,()=>"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"),u.assert(u.isFunction(n.gradFunc),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."),n.value),backwardsFunc:(t,r)=>{const i=n.gradFunc(t,r),o=Array.isArray(i)?i:[i];u.assert(o.length===e.length,()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns the same number of tensors as inputs passed to f(...)."),u.assert(o.every(t=>t instanceof p.a),()=>"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors.");const s={};return o.forEach((t,e)=>{s[e]=(()=>t)}),s},inputs:r})}}readSync(t){return this.state.tensorInfo.get(t).backend.readSync(t)}read(t){return this.state.tensorInfo.get(t).backend.read(t)}readToGPU(t,e){return this.state.tensorInfo.get(t).backend.readToGPU(t,e)}async time(t){const e=Object(u.now)(),n=await this.backend.time(t);return n.wallMs=Object(u.now)()-e,n}track(t){return null!=this.state.activeScope&&(t.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(t)),t}get registeredVariables(){return this.state.registeredVariables}reset(){this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new m;for(const t in this.registry)this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null}}function b(){const t=Object(o.b)();if(null==t._tfengine){const e=new i.a(t);t._tfengine=new v(e)}return Object(i.c)(t._tfengine.ENV),Object(p.f)(()=>t._tfengine),t._tfengine}v.nextTensorId=0,v.nextVariableId=0;const _=b();function y(t,e){const n={a:t,b:e};return _.runKernel(s.d,n)}e.a=_},L42u:function(t,e,n){var r,i,o,s=n("+ZMJ"),a=n("knuC"),l=n("RPLV"),u=n("ON07"),c=n("7KvD"),h=c.process,d=c.setImmediate,p=c.clearImmediate,f=c.MessageChannel,g=c.Dispatch,m=0,v={},b=function(){var t=+this;if(v.hasOwnProperty(t)){var e=v[t];delete v[t],e()}},_=function(t){b.call(t.data)};d&&p||(d=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return v[++m]=function(){a("function"==typeof t?t:Function(t),e)},r(m),m},p=function(t){delete v[t]},"process"==n("R9M2")(h)?r=function(t){h.nextTick(s(b,t,1))}:g&&g.now?r=function(t){g.now(s(b,t,1))}:f?(o=(i=new f).port2,i.port1.onmessage=_,r=s(o.postMessage,o,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(r=function(t){c.postMessage(t+"","*")},c.addEventListener("message",_,!1)):r="onreadystatechange"in u("script")?function(t){l.appendChild(u("script")).onreadystatechange=function(){l.removeChild(this),b.call(t)}}:function(t){setTimeout(s(b,t,1),0)}),t.exports={set:d,clear:p}},LGuY:function(t,e){t.exports=function(){throw new Error("define cannot be used indirect")}},LKZe:function(t,e,n){var r=n("NpIQ"),i=n("X8DO"),o=n("TcQ7"),s=n("MmMw"),a=n("D2L2"),l=n("SfB7"),u=Object.getOwnPropertyDescriptor;e.f=n("+E39")?u:function(t,e){if(t=o(t),e=s(e,!0),l)try{return u(t,e)}catch(t){}if(a(t,e))return i(!r.f.call(t,e),t[e])}},M1Ti:function(t,e,n){"use strict";e.a= /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e,n,o){null==o&&(o=Object(i.inferDtype)(t));if("complex64"===o)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!Object(i.isTypedArray)(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t)throw new Error("values passed to tensor(values) must be a number/boolean/string or an array of numbers/booleans/strings, or a TypedArray");if(null!=e){Object(i.assertNonNegativeIntegerDimensions)(e);const t=Object(i.sizeFromShape)(e),r=Object(i.sizeFromShape)(n);Object(i.assert)(t===r,()=>`Based on the provided shape, [${e}], the tensor should have `+`${t} values but has ${r}`);for(let t=0;t"Error creating a new Tensor. Inferred shape "+`(${n}) does not match the provided `+`shape (${e}). `)}}Object(i.isTypedArray)(t)||Array.isArray(t)||(t=[t]);return e=e||n,t="string"!==o?Object(i.toTypedArray)(t,o):Object(i.flatten)(t,[],!0),r.a.makeTensor(t,e,o)};var r=n("Kkag"),i=n("XFvI")},M6a0:function(t,e){},MU5D:function(t,e,n){var r=n("R9M2");t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},Mhyx:function(t,e,n){var r=n("/bQp"),i=n("dSzd")("iterator"),o=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||o[i]===t)}},MlK1:function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("XFvI"),a=n("35G1");const l=Object(a.a)({cast_: /** * @license * Copyright 2020 Google Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e){const n=Object(o.a)(t,"x","cast");if(!s.isValidDtype(e))throw new Error(`Failed to cast to unknown dtype ${e}`);if("string"===e&&"string"!==n.dtype||"string"!==e&&"string"===n.dtype)throw new Error("Only strings can be casted to strings");const a={x:n},l={dtype:e};return r.a.runKernel(i.w,a,l)}});e.a=l},MmMw:function(t,e,n){var r=n("EqjI");t.exports=function(t,e){if(!r(t))return t;var n,i;if(e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;if("function"==typeof(n=t.valueOf)&&!r(i=n.call(t)))return i;if(!e&&"function"==typeof(n=t.toString)&&!r(i=n.call(t)))return i;throw TypeError("Can't convert object to primitive value")}},NMof:function(t,e,n){"use strict";var r,i;"function"==typeof Symbol&&Symbol.iterator;void 0===(i="function"==typeof(r=function(){var t=window,e={placement:"bottom",gpuAcceleration:!0,offset:0,boundariesElement:"viewport",boundariesPadding:5,preventOverflowOrder:["left","right","top","bottom"],flipBehavior:"flip",arrowElement:"[x-arrow]",arrowOffset:0,modifiers:["shift","offset","preventOverflow","keepTogether","arrow","flip","applyStyle"],modifiersIgnored:[],forceAbsolute:!1};function n(t,n,r){this._reference=t.jquery?t[0]:t,this.state={};var i=void 0===n||null===n,o=n&&"[object Object]"===Object.prototype.toString.call(n);return this._popper=i||o?this.parse(o?n:{}):n.jquery?n[0]:n,this._options=Object.assign({},e,r),this._options.modifiers=this._options.modifiers.map(function(t){if(-1===this._options.modifiersIgnored.indexOf(t))return"applyStyle"===t&&this._popper.setAttribute("x-placement",this._options.placement),this.modifiers[t]||t}.bind(this)),this.state.position=this._getPosition(this._popper,this._reference),c(this._popper,{position:this.state.position,top:0}),this.update(),this._setupEventListeners(),this}function r(e){var n=e.style.display,r=e.style.visibility;e.style.display="block",e.style.visibility="hidden";e.offsetWidth;var i=t.getComputedStyle(e),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),s=parseFloat(i.marginLeft)+parseFloat(i.marginRight),a={width:e.offsetWidth+s,height:e.offsetHeight+o};return e.style.display=n,e.style.visibility=r,a}function i(t){var e={left:"right",right:"left",bottom:"top",top:"bottom"};return t.replace(/left|right|bottom|top/g,function(t){return e[t]})}function o(t){var e=Object.assign({},t);return e.right=e.left+e.width,e.bottom=e.top+e.height,e}function s(t,e){var n,r=0;for(n in t){if(t[n]===e)return r;r++}return null}function a(e,n){return t.getComputedStyle(e,null)[n]}function l(e){var n=e.offsetParent;return n!==t.document.body&&n?n:t.document.documentElement}function u(e){var n=e.parentNode;return n?n===t.document?t.document.body.scrollTop||t.document.body.scrollLeft?t.document.body:t.document.documentElement:-1!==["scroll","auto"].indexOf(a(n,"overflow"))||-1!==["scroll","auto"].indexOf(a(n,"overflow-x"))||-1!==["scroll","auto"].indexOf(a(n,"overflow-y"))?n:u(e.parentNode):e}function c(t,e){Object.keys(e).forEach(function(n){var r,i="";-1!==["width","height","top","right","bottom","left"].indexOf(n)&&(""!==(r=e[n])&&!isNaN(parseFloat(r))&&isFinite(r))&&(i="px"),t.style[n]=e[n]+i})}function h(t){var e={width:t.offsetWidth,height:t.offsetHeight,left:t.offsetLeft,top:t.offsetTop};return e.right=e.left+e.width,e.bottom=e.top+e.height,e}function d(t){var e=t.getBoundingClientRect(),n=-1!=navigator.userAgent.indexOf("MSIE")&&"HTML"===t.tagName?-t.scrollTop:e.top;return{left:e.left,top:n,right:e.right,bottom:e.bottom,width:e.right-e.left,height:e.bottom-n}}function p(e){for(var n=["","ms","webkit","moz","o"],r=0;r1&&console.warn("WARNING: the given `parent` query("+e.parent+") matched more than one element, the first one will be used"),0===s.length)throw"ERROR: the given `parent` doesn't exists!";s=s[0]}return s.length>1&&s instanceof Element==!1&&(console.warn("WARNING: you have passed as parent a list of elements, the first one will be used"),s=s[0]),s.appendChild(i),i;function a(t,e){e.forEach(function(e){t.classList.add(e)})}function l(t,e){e.forEach(function(e){t.setAttribute(e.split(":")[0],e.split(":")[1]||"")})}},n.prototype._getPosition=function(e,n){l(n);return this._options.forceAbsolute?"absolute":function e(n){if(n===t.document.body)return!1;if("fixed"===a(n,"position"))return!0;return n.parentNode?e(n.parentNode):n}(n)?"fixed":"absolute"},n.prototype._getOffsets=function(t,e,n){n=n.split("-")[0];var i={};i.position=this.state.position;var o="fixed"===i.position,s=function(t,e,n){var r=d(t),i=d(e);if(n){var o=u(e);i.top+=o.scrollTop,i.bottom+=o.scrollTop,i.left+=o.scrollLeft,i.right+=o.scrollLeft}return{top:r.top-i.top,left:r.left-i.left,bottom:r.top-i.top+r.height,right:r.left-i.left+r.width,width:r.width,height:r.height}}(e,l(t),o),a=r(t);return-1!==["right","left"].indexOf(n)?(i.top=s.top+s.height/2-a.height/2,i.left="left"===n?s.left-a.width:s.right):(i.left=s.left+s.width/2-a.width/2,i.top="top"===n?s.top-a.height:s.bottom),i.width=a.width,i.height=a.height,{popper:i,reference:s}},n.prototype._setupEventListeners=function(){if(this.state.updateBound=this.update.bind(this),t.addEventListener("resize",this.state.updateBound),"window"!==this._options.boundariesElement){var e=u(this._reference);e!==t.document.body&&e!==t.document.documentElement||(e=t),e.addEventListener("scroll",this.state.updateBound),this.state.scrollTarget=e}},n.prototype._removeEventListeners=function(){t.removeEventListener("resize",this.state.updateBound),"window"!==this._options.boundariesElement&&this.state.scrollTarget&&(this.state.scrollTarget.removeEventListener("scroll",this.state.updateBound),this.state.scrollTarget=null),this.state.updateBound=null},n.prototype._getBoundaries=function(e,n,r){var i,o,s={};if("window"===r){var a=t.document.body,c=t.document.documentElement;i=Math.max(a.scrollHeight,a.offsetHeight,c.clientHeight,c.scrollHeight,c.offsetHeight),s={top:0,right:Math.max(a.scrollWidth,a.offsetWidth,c.clientWidth,c.scrollWidth,c.offsetWidth),bottom:i,left:0}}else if("viewport"===r){var d=l(this._popper),p=u(this._popper),f=h(d),g="fixed"===e.offsets.popper.position?0:(o=p)==document.body?Math.max(document.documentElement.scrollTop,document.body.scrollTop):o.scrollTop,m="fixed"===e.offsets.popper.position?0:function(t){return t==document.body?Math.max(document.documentElement.scrollLeft,document.body.scrollLeft):t.scrollLeft}(p);s={top:0-(f.top-g),right:t.document.documentElement.clientWidth-(f.left-m),bottom:t.document.documentElement.clientHeight-(f.top-g),left:0-(f.left-m)}}else s=l(this._popper)===r?{top:0,left:0,right:r.clientWidth,bottom:r.clientHeight}:h(r);return s.left+=n,s.right-=n,s.top=s.top+n,s.bottom=s.bottom-n,s},n.prototype.runModifiers=function(t,e,n){var r=e.slice();return void 0!==n&&(r=this._options.modifiers.slice(0,s(this._options.modifiers,n))),r.forEach(function(e){var n;(n=e)&&"[object Function]"==={}.toString.call(n)&&(t=e.call(this,t))}.bind(this)),t},n.prototype.isModifierRequired=function(t,e){var n=s(this._options.modifiers,t);return!!this._options.modifiers.slice(0,n).filter(function(t){return t===e}).length},n.prototype.modifiers={},n.prototype.modifiers.applyStyle=function(t){var e,n={position:t.offsets.popper.position},r=Math.round(t.offsets.popper.left),i=Math.round(t.offsets.popper.top);return this._options.gpuAcceleration&&(e=p("transform"))?(n[e]="translate3d("+r+"px, "+i+"px, 0)",n.top=0,n.left=0):(n.left=r,n.top=i),Object.assign(n,t.styles),c(this._popper,n),this._popper.setAttribute("x-placement",t.placement),this.isModifierRequired(this.modifiers.applyStyle,this.modifiers.arrow)&&t.offsets.arrow&&c(t.arrowElement,t.offsets.arrow),t},n.prototype.modifiers.shift=function(t){var e=t.placement,n=e.split("-")[0],r=e.split("-")[1];if(r){var i=t.offsets.reference,s=o(t.offsets.popper),a={y:{start:{top:i.top},end:{top:i.top+i.height-s.height}},x:{start:{left:i.left},end:{left:i.left+i.width-s.width}}},l=-1!==["bottom","top"].indexOf(n)?"x":"y";t.offsets.popper=Object.assign(s,a[l][r])}return t},n.prototype.modifiers.preventOverflow=function(t){var e=this._options.preventOverflowOrder,n=o(t.offsets.popper),r={left:function(){var e=n.left;return n.leftt.boundaries.right&&(e=Math.min(n.left,t.boundaries.right-n.width)),{left:e}},top:function(){var e=n.top;return n.topt.boundaries.bottom&&(e=Math.min(n.top,t.boundaries.bottom-n.height)),{top:e}}};return e.forEach(function(e){t.offsets.popper=Object.assign(n,r[e]())}),t},n.prototype.modifiers.keepTogether=function(t){var e=o(t.offsets.popper),n=t.offsets.reference,r=Math.floor;return e.rightr(n.right)&&(t.offsets.popper.left=r(n.right)),e.bottomr(n.bottom)&&(t.offsets.popper.top=r(n.bottom)),t},n.prototype.modifiers.flip=function(t){if(!this.isModifierRequired(this.modifiers.flip,this.modifiers.preventOverflow))return console.warn("WARNING: preventOverflow modifier is required by flip modifier in order to work, be sure to include it before flip!"),t;if(t.flipped&&t.placement===t._originalPlacement)return t;var e=t.placement.split("-")[0],n=i(e),r=t.placement.split("-")[1]||"",s=[];return(s="flip"===this._options.flipBehavior?[e,n]:this._options.flipBehavior).forEach(function(a,l){if(e===a&&s.length!==l+1){e=t.placement.split("-")[0],n=i(e);var u=o(t.offsets.popper),c=-1!==["right","bottom"].indexOf(e);(c&&Math.floor(t.offsets.reference[e])>Math.floor(u[n])||!c&&Math.floor(t.offsets.reference[e])a[p]&&(t.offsets.popper[h]+=l[h]+f-a[p]);var g=l[h]+(n||l[c]/2-f/2)-a[h];return g=Math.max(Math.min(a[c]-f-8,g),8),i[h]=g,i[d]="",t.offsets.arrow=i,t.arrowElement=e,t},Object.assign||Object.defineProperty(Object,"assign",{enumerable:!1,configurable:!0,writable:!0,value:function(t){if(void 0===t||null===t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),n=1;n_;_++)if((m=e?b(s(f=t[_])[0],f[1]):b(t[_]))===u||m===c)return m}else for(g=v.call(t);!(f=g.next()).done;)if((m=i(g,b,f.value,e))===u||m===c)return m}).BREAK=u,e.RETURN=c},NYxO:function(t,e,n){"use strict";(function(t){var n=("undefined"!=typeof window?window:void 0!==t?t:{}).__VUE_DEVTOOLS_GLOBAL_HOOK__;function r(t,e){if(void 0===e&&(e=[]),null===t||"object"!=typeof t)return t;var n,i=(n=function(e){return e.original===t},e.filter(n)[0]);if(i)return i.copy;var o=Array.isArray(t)?[]:{};return e.push({original:t,copy:o}),Object.keys(t).forEach(function(n){o[n]=r(t[n],e)}),o}function i(t,e){Object.keys(t).forEach(function(n){return e(t[n],n)})}function o(t){return null!==t&&"object"==typeof t}var s=function(t,e){this.runtime=e,this._children=Object.create(null),this._rawModule=t;var n=t.state;this.state=("function"==typeof n?n():n)||{}},a={namespaced:{configurable:!0}};a.namespaced.get=function(){return!!this._rawModule.namespaced},s.prototype.addChild=function(t,e){this._children[t]=e},s.prototype.removeChild=function(t){delete this._children[t]},s.prototype.getChild=function(t){return this._children[t]},s.prototype.hasChild=function(t){return t in this._children},s.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)},s.prototype.forEachChild=function(t){i(this._children,t)},s.prototype.forEachGetter=function(t){this._rawModule.getters&&i(this._rawModule.getters,t)},s.prototype.forEachAction=function(t){this._rawModule.actions&&i(this._rawModule.actions,t)},s.prototype.forEachMutation=function(t){this._rawModule.mutations&&i(this._rawModule.mutations,t)},Object.defineProperties(s.prototype,a);var l=function(t){this.register([],t,!1)};l.prototype.get=function(t){return t.reduce(function(t,e){return t.getChild(e)},this.root)},l.prototype.getNamespace=function(t){var e=this.root;return t.reduce(function(t,n){return t+((e=e.getChild(n)).namespaced?n+"/":"")},"")},l.prototype.update=function(t){!function t(e,n,r){0;n.update(r);if(r.modules)for(var i in r.modules){if(!n.getChild(i))return void 0;t(e.concat(i),n.getChild(i),r.modules[i])}}([],this.root,t)},l.prototype.register=function(t,e,n){var r=this;void 0===n&&(n=!0);var o=new s(e,n);0===t.length?this.root=o:this.get(t.slice(0,-1)).addChild(t[t.length-1],o);e.modules&&i(e.modules,function(e,i){r.register(t.concat(i),e,n)})},l.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1],r=e.getChild(n);r&&r.runtime&&e.removeChild(n)},l.prototype.isRegistered=function(t){var e=this.get(t.slice(0,-1)),n=t[t.length-1];return!!e&&e.hasChild(n)};var u;var c=function(t){var e=this;void 0===t&&(t={}),!u&&"undefined"!=typeof window&&window.Vue&&b(window.Vue);var r=t.plugins;void 0===r&&(r=[]);var i=t.strict;void 0===i&&(i=!1),this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new l(t),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._watcherVM=new u,this._makeLocalGettersCache=Object.create(null);var o=this,s=this.dispatch,a=this.commit;this.dispatch=function(t,e){return s.call(o,t,e)},this.commit=function(t,e,n){return a.call(o,t,e,n)},this.strict=i;var c=this._modules.root.state;g(this,c,[],this._modules.root),f(this,c),r.forEach(function(t){return t(e)}),(void 0!==t.devtools?t.devtools:u.config.devtools)&&function(t){n&&(t._devtoolHook=n,n.emit("vuex:init",t),n.on("vuex:travel-to-state",function(e){t.replaceState(e)}),t.subscribe(function(t,e){n.emit("vuex:mutation",t,e)},{prepend:!0}),t.subscribeAction(function(t,e){n.emit("vuex:action",t,e)},{prepend:!0}))}(this)},h={state:{configurable:!0}};function d(t,e,n){return e.indexOf(t)<0&&(n&&n.prepend?e.unshift(t):e.push(t)),function(){var n=e.indexOf(t);n>-1&&e.splice(n,1)}}function p(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var n=t.state;g(t,n,[],t._modules.root,!0),f(t,n,e)}function f(t,e,n){var r=t._vm;t.getters={},t._makeLocalGettersCache=Object.create(null);var o={};i(t._wrappedGetters,function(e,n){o[n]=function(t,e){return function(){return t(e)}}(e,t),Object.defineProperty(t.getters,n,{get:function(){return t._vm[n]},enumerable:!0})});var s=u.config.silent;u.config.silent=!0,t._vm=new u({data:{$$state:e},computed:o}),u.config.silent=s,t.strict&&function(t){t._vm.$watch(function(){return this._data.$$state},function(){0},{deep:!0,sync:!0})}(t),r&&(n&&t._withCommit(function(){r._data.$$state=null}),u.nextTick(function(){return r.$destroy()}))}function g(t,e,n,r,i){var o=!n.length,s=t._modules.getNamespace(n);if(r.namespaced&&(t._modulesNamespaceMap[s],t._modulesNamespaceMap[s]=r),!o&&!i){var a=m(e,n.slice(0,-1)),l=n[n.length-1];t._withCommit(function(){u.set(a,l,r.state)})}var c=r.context=function(t,e,n){var r=""===e,i={dispatch:r?t.dispatch:function(n,r,i){var o=v(n,r,i),s=o.payload,a=o.options,l=o.type;return a&&a.root||(l=e+l),t.dispatch(l,s)},commit:r?t.commit:function(n,r,i){var o=v(n,r,i),s=o.payload,a=o.options,l=o.type;a&&a.root||(l=e+l),t.commit(l,s,a)}};return Object.defineProperties(i,{getters:{get:r?function(){return t.getters}:function(){return function(t,e){if(!t._makeLocalGettersCache[e]){var n={},r=e.length;Object.keys(t.getters).forEach(function(i){if(i.slice(0,r)===e){var o=i.slice(r);Object.defineProperty(n,o,{get:function(){return t.getters[i]},enumerable:!0})}}),t._makeLocalGettersCache[e]=n}return t._makeLocalGettersCache[e]}(t,e)}},state:{get:function(){return m(t.state,n)}}}),i}(t,s,n);r.forEachMutation(function(e,n){!function(t,e,n,r){(t._mutations[e]||(t._mutations[e]=[])).push(function(e){n.call(t,r.state,e)})}(t,s+n,e,c)}),r.forEachAction(function(e,n){var r=e.root?n:s+n,i=e.handler||e;!function(t,e,n,r){(t._actions[e]||(t._actions[e]=[])).push(function(e){var i,o=n.call(t,{dispatch:r.dispatch,commit:r.commit,getters:r.getters,state:r.state,rootGetters:t.getters,rootState:t.state},e);return(i=o)&&"function"==typeof i.then||(o=Promise.resolve(o)),t._devtoolHook?o.catch(function(e){throw t._devtoolHook.emit("vuex:error",e),e}):o})}(t,r,i,c)}),r.forEachGetter(function(e,n){!function(t,e,n,r){if(t._wrappedGetters[e])return void 0;t._wrappedGetters[e]=function(t){return n(r.state,r.getters,t.state,t.getters)}}(t,s+n,e,c)}),r.forEachChild(function(r,o){g(t,e,n.concat(o),r,i)})}function m(t,e){return e.reduce(function(t,e){return t[e]},t)}function v(t,e,n){return o(t)&&t.type&&(n=e,e=t,t=t.type),{type:t,payload:e,options:n}}function b(t){u&&t===u|| /*! * vuex v3.6.2 * (c) 2021 Evan You * @license MIT */ function(t){if(Number(t.version.split(".")[0])>=2)t.mixin({beforeCreate:n});else{var e=t.prototype._init;t.prototype._init=function(t){void 0===t&&(t={}),t.init=t.init?[n].concat(t.init):n,e.call(this,t)}}function n(){var t=this.$options;t.store?this.$store="function"==typeof t.store?t.store():t.store:t.parent&&t.parent.$store&&(this.$store=t.parent.$store)}}(u=t)}h.state.get=function(){return this._vm._data.$$state},h.state.set=function(t){0},c.prototype.commit=function(t,e,n){var r=this,i=v(t,e,n),o=i.type,s=i.payload,a=(i.options,{type:o,payload:s}),l=this._mutations[o];l&&(this._withCommit(function(){l.forEach(function(t){t(s)})}),this._subscribers.slice().forEach(function(t){return t(a,r.state)}))},c.prototype.dispatch=function(t,e){var n=this,r=v(t,e),i=r.type,o=r.payload,s={type:i,payload:o},a=this._actions[i];if(a){try{this._actionSubscribers.slice().filter(function(t){return t.before}).forEach(function(t){return t.before(s,n.state)})}catch(t){0}var l=a.length>1?Promise.all(a.map(function(t){return t(o)})):a[0](o);return new Promise(function(t,e){l.then(function(e){try{n._actionSubscribers.filter(function(t){return t.after}).forEach(function(t){return t.after(s,n.state)})}catch(t){0}t(e)},function(t){try{n._actionSubscribers.filter(function(t){return t.error}).forEach(function(e){return e.error(s,n.state,t)})}catch(t){0}e(t)})})}},c.prototype.subscribe=function(t,e){return d(t,this._subscribers,e)},c.prototype.subscribeAction=function(t,e){return d("function"==typeof t?{before:t}:t,this._actionSubscribers,e)},c.prototype.watch=function(t,e,n){var r=this;return this._watcherVM.$watch(function(){return t(r.state,r.getters)},e,n)},c.prototype.replaceState=function(t){var e=this;this._withCommit(function(){e._vm._data.$$state=t})},c.prototype.registerModule=function(t,e,n){void 0===n&&(n={}),"string"==typeof t&&(t=[t]),this._modules.register(t,e),g(this,this.state,t,this._modules.get(t),n.preserveState),f(this,this.state)},c.prototype.unregisterModule=function(t){var e=this;"string"==typeof t&&(t=[t]),this._modules.unregister(t),this._withCommit(function(){var n=m(e.state,t.slice(0,-1));u.delete(n,t[t.length-1])}),p(this)},c.prototype.hasModule=function(t){return"string"==typeof t&&(t=[t]),this._modules.isRegistered(t)},c.prototype.hotUpdate=function(t){this._modules.update(t),p(this,!0)},c.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(c.prototype,h);var _=w(function(t,e){var n={};return x(e).forEach(function(e){var r=e.key,i=e.val;n[r]=function(){var e=this.$store.state,n=this.$store.getters;if(t){var r=C(this.$store,"mapState",t);if(!r)return;e=r.context.state,n=r.context.getters}return"function"==typeof i?i.call(this,e,n):e[i]},n[r].vuex=!0}),n}),y=w(function(t,e){var n={};return x(e).forEach(function(e){var r=e.key,i=e.val;n[r]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=this.$store.commit;if(t){var o=C(this.$store,"mapMutations",t);if(!o)return;r=o.context.commit}return"function"==typeof i?i.apply(this,[r].concat(e)):r.apply(this.$store,[i].concat(e))}}),n}),T=w(function(t,e){var n={};return x(e).forEach(function(e){var r=e.key,i=e.val;i=t+i,n[r]=function(){if(!t||C(this.$store,"mapGetters",t))return this.$store.getters[i]},n[r].vuex=!0}),n}),E=w(function(t,e){var n={};return x(e).forEach(function(e){var r=e.key,i=e.val;n[r]=function(){for(var e=[],n=arguments.length;n--;)e[n]=arguments[n];var r=this.$store.dispatch;if(t){var o=C(this.$store,"mapActions",t);if(!o)return;r=o.context.dispatch}return"function"==typeof i?i.apply(this,[r].concat(e)):r.apply(this.$store,[i].concat(e))}}),n});function x(t){return function(t){return Array.isArray(t)||o(t)}(t)?Array.isArray(t)?t.map(function(t){return{key:t,val:t}}):Object.keys(t).map(function(e){return{key:e,val:t[e]}}):[]}function w(t){return function(e,n){return"string"!=typeof e?(n=e,e=""):"/"!==e.charAt(e.length-1)&&(e+="/"),t(e,n)}}function C(t,e,n){return t._modulesNamespaceMap[n]}function S(t,e,n){var r=n?t.groupCollapsed:t.group;try{r.call(t,e)}catch(n){t.log(e)}}function k(t){try{t.groupEnd()}catch(e){t.log("—— log end ——")}}function O(){var t=new Date;return" @ "+I(t.getHours(),2)+":"+I(t.getMinutes(),2)+":"+I(t.getSeconds(),2)+"."+I(t.getMilliseconds(),3)}function I(t,e){return n="0",r=e-t.toString().length,new Array(r+1).join(n)+t;var n,r}var R={Store:c,install:b,version:"3.6.2",mapState:_,mapMutations:y,mapGetters:T,mapActions:E,createNamespacedHelpers:function(t){return{mapState:_.bind(null,t),mapGetters:T.bind(null,t),mapMutations:y.bind(null,t),mapActions:E.bind(null,t)}},createLogger:function(t){void 0===t&&(t={});var e=t.collapsed;void 0===e&&(e=!0);var n=t.filter;void 0===n&&(n=function(t,e,n){return!0});var i=t.transformer;void 0===i&&(i=function(t){return t});var o=t.mutationTransformer;void 0===o&&(o=function(t){return t});var s=t.actionFilter;void 0===s&&(s=function(t,e){return!0});var a=t.actionTransformer;void 0===a&&(a=function(t){return t});var l=t.logMutations;void 0===l&&(l=!0);var u=t.logActions;void 0===u&&(u=!0);var c=t.logger;return void 0===c&&(c=console),function(t){var h=r(t.state);void 0!==c&&(l&&t.subscribe(function(t,s){var a=r(s);if(n(t,h,a)){var l=O(),u=o(t),d="mutation "+t.type+l;S(c,d,e),c.log("%c prev state","color: #9E9E9E; font-weight: bold",i(h)),c.log("%c mutation","color: #03A9F4; font-weight: bold",u),c.log("%c next state","color: #4CAF50; font-weight: bold",i(a)),k(c)}h=a}),u&&t.subscribeAction(function(t,n){if(s(t,n)){var r=O(),i=a(t),o="action "+t.type+r;S(c,o,e),c.log("%c action","color: #03A9F4; font-weight: bold",i),k(c)}}))}}};e.a=R}).call(e,n("DuR2"))},Nhog:function(t,e,n){"use strict";(function(t,n){ /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ let r;function i(){if(null==r){let e;if("undefined"!=typeof window)e=window;else if(void 0!==t)e=t;else if(void 0!==n)e=n;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}r=e}return r}e.b=i,e.a=function(t,e){const n=function(){const t=i();null==t._tfGlobals&&(t._tfGlobals=new Map);return t._tfGlobals}();if(n.has(t))return n.get(t);{const r=e();return n.set(t,r),n.get(t)}}}).call(e,n("DuR2"),n("W2nU"))},NpIQ:function(t,e){e.f={}.propertyIsEnumerable},O4g8:function(t,e){t.exports=!0},OAzY:function(t,e,n){"use strict";e.__esModule=!0;var r,i=n("7+uW"),o=(r=i)&&r.__esModule?r:{default:r},s=n("2kvA");var a=!1,l=!1,u=void 0,c=function(){if(!o.default.prototype.$isServer){var t=d.modalDom;return t?a=!0:(a=!1,t=document.createElement("div"),d.modalDom=t,t.addEventListener("touchmove",function(t){t.preventDefault(),t.stopPropagation()}),t.addEventListener("click",function(){d.doOnModalClick&&d.doOnModalClick()})),t}},h={},d={modalFade:!0,getInstance:function(t){return h[t]},register:function(t,e){t&&e&&(h[t]=e)},deregister:function(t){t&&(h[t]=null,delete h[t])},nextZIndex:function(){return d.zIndex++},modalStack:[],doOnModalClick:function(){var t=d.modalStack[d.modalStack.length-1];if(t){var e=d.getInstance(t.id);e&&e.closeOnClickModal&&e.close()}},openModal:function(t,e,n,r,i){if(!o.default.prototype.$isServer&&t&&void 0!==e){this.modalFade=i;for(var l=this.modalStack,u=0,h=l.length;u0){var r=e[e.length-1];if(r.id===t){if(r.modalClass)r.modalClass.trim().split(/\s+/).forEach(function(t){return(0,s.removeClass)(n,t)});e.pop(),e.length>0&&(n.style.zIndex=e[e.length-1].zIndex)}else for(var i=e.length-1;i>=0;i--)if(e[i].id===t){e.splice(i,1);break}}0===e.length&&(this.modalFade&&(0,s.addClass)(n,"v-modal-leave"),setTimeout(function(){0===e.length&&(n.parentNode&&n.parentNode.removeChild(n),n.style.display="none",d.modalDom=void 0),(0,s.removeClass)(n,"v-modal-leave")},200))}};Object.defineProperty(d,"zIndex",{configurable:!0,get:function(){return l||(u=u||(o.default.prototype.$ELEMENT||{}).zIndex||2e3,l=!0),u},set:function(t){u=t}});o.default.prototype.$isServer||window.addEventListener("keydown",function(t){if(27===t.keyCode){var e=function(){if(!o.default.prototype.$isServer&&d.modalStack.length>0){var t=d.modalStack[d.modalStack.length-1];if(!t)return;return d.getInstance(t.id)}}();e&&e.closeOnPressEscape&&(e.handleClose?e.handleClose():e.handleAction?e.handleAction("cancel"):e.close())}}),e.default=d},ODj2:function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("jb1O"),s=n("xMQ1"),a=n("35G1");const l=Object(a.a)({add_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t,e){let n=Object(s.a)(t,"a","add"),a=Object(s.a)(e,"b","add");[n,a]=Object(o.c)(n,a);const l={a:n,b:a};return r.a.runKernel(i.d,l)}});e.a=l},ON07:function(t,e,n){var r=n("EqjI"),i=n("7KvD").document,o=r(i)&&r(i.createElement);t.exports=function(t){return o?i.createElement(t):{}}},ON3O:function(t,e,n){var r=n("uY1a");t.exports=function(t,e,n){return void 0===n?r(t,e,!1):r(t,n,!1!==e)}},OYls:function(t,e,n){n("crlp")("asyncIterator")},"Oi+a":function(t,e,n){"use strict";var r=n("dIwP"),i=n("qRfI");t.exports=function(t,e){return t&&!r(e)?i(t,e):e}},PzxK:function(t,e,n){var r=n("D2L2"),i=n("sB3e"),o=n("ax3d")("IE_PROTO"),s=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=i(t),r(t,o)?t[o]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?s:null}},QRG4:function(t,e,n){var r=n("UuGF"),i=Math.min;t.exports=function(t){return t>0?i(r(t),9007199254740991):0}},QSAg:function(t,e,n){"use strict";e.b= /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(...t){Object(r.b)().getBool("IS_TEST")||Object(r.b)().getBool("PROD")||console.warn(...t)},e.a=function(...t){Object(r.b)().getBool("IS_TEST")||Object(r.b)().getBool("PROD")||console.log(...t)};var r=n("v/P2")},QUGb:function(t,e,n){var r,i,o,s;s=function(t){"use strict";return t.Blocks.colour={},t.Constants={},t.Constants.Colour={},t.Constants.Colour.HUE=20,t.defineBlocksWithJsonArray([{type:"colour_picker",message0:"%1",args0:[{type:"field_colour",name:"COLOUR",colour:"#ff0000"}],output:"Colour",helpUrl:"%{BKY_COLOUR_PICKER_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_PICKER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"colour_random",message0:"%{BKY_COLOUR_RANDOM_TITLE}",output:"Colour",helpUrl:"%{BKY_COLOUR_RANDOM_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RANDOM_TOOLTIP}"},{type:"colour_rgb",message0:"%{BKY_COLOUR_RGB_TITLE} %{BKY_COLOUR_RGB_RED} %1 %{BKY_COLOUR_RGB_GREEN} %2 %{BKY_COLOUR_RGB_BLUE} %3",args0:[{type:"input_value",name:"RED",check:"Number",align:"RIGHT"},{type:"input_value",name:"GREEN",check:"Number",align:"RIGHT"},{type:"input_value",name:"BLUE",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_RGB_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_RGB_TOOLTIP}"},{type:"colour_blend",message0:"%{BKY_COLOUR_BLEND_TITLE} %{BKY_COLOUR_BLEND_COLOUR1} %1 %{BKY_COLOUR_BLEND_COLOUR2} %2 %{BKY_COLOUR_BLEND_RATIO} %3",args0:[{type:"input_value",name:"COLOUR1",check:"Colour",align:"RIGHT"},{type:"input_value",name:"COLOUR2",check:"Colour",align:"RIGHT"},{type:"input_value",name:"RATIO",check:"Number",align:"RIGHT"}],output:"Colour",helpUrl:"%{BKY_COLOUR_BLEND_HELPURL}",style:"colour_blocks",tooltip:"%{BKY_COLOUR_BLEND_TOOLTIP}"}]),t.Constants.Lists={},t.Constants.Lists.HUE=260,t.defineBlocksWithJsonArray([{type:"lists_create_empty",message0:"%{BKY_LISTS_CREATE_EMPTY_TITLE}",output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_CREATE_EMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_CREATE_EMPTY_HELPURL}"},{type:"lists_repeat",message0:"%{BKY_LISTS_REPEAT_TITLE}",args0:[{type:"input_value",name:"ITEM"},{type:"input_value",name:"NUM",check:"Number"}],output:"Array",style:"list_blocks",tooltip:"%{BKY_LISTS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_LISTS_REPEAT_HELPURL}"},{type:"lists_reverse",message0:"%{BKY_LISTS_REVERSE_MESSAGE0}",args0:[{type:"input_value",name:"LIST",check:"Array"}],output:"Array",inputsInline:!0,style:"list_blocks",tooltip:"%{BKY_LISTS_REVERSE_TOOLTIP}",helpUrl:"%{BKY_LISTS_REVERSE_HELPURL}"},{type:"lists_isEmpty",message0:"%{BKY_LISTS_ISEMPTY_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Boolean",style:"list_blocks",tooltip:"%{BKY_LISTS_ISEMPTY_TOOLTIP}",helpUrl:"%{BKY_LISTS_ISEMPTY_HELPURL}"},{type:"lists_length",message0:"%{BKY_LISTS_LENGTH_TITLE}",args0:[{type:"input_value",name:"VALUE",check:["String","Array"]}],output:"Number",style:"list_blocks",tooltip:"%{BKY_LISTS_LENGTH_TOOLTIP}",helpUrl:"%{BKY_LISTS_LENGTH_HELPURL}"}]),t.Blocks.lists_create_with={init:function(){this.setHelpUrl(t.Msg.LISTS_CREATE_WITH_HELPURL),this.setStyle("list_blocks"),this.itemCount_=3,this.updateShape_(),this.setOutput(!0,"Array"),this.setMutator(new t.Mutator(["lists_create_with_item"])),this.setTooltip(t.Msg.LISTS_CREATE_WITH_TOOLTIP)},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("items",this.itemCount_),e},domToMutation:function(t){this.itemCount_=parseInt(t.getAttribute("items"),10),this.updateShape_()},decompose:function(t){var e=t.newBlock("lists_create_with_container");e.initSvg();for(var n=e.getInput("STACK").connection,r=0;r","GT"],["‏≥","GTE"]]},{type:"input_value",name:"B"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_COMPARE_HELPURL}",extensions:["logic_compare","logic_op_tooltip"]},{type:"logic_operation",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Boolean"},{type:"field_dropdown",name:"OP",options:[["%{BKY_LOGIC_OPERATION_AND}","AND"],["%{BKY_LOGIC_OPERATION_OR}","OR"]]},{type:"input_value",name:"B",check:"Boolean"}],inputsInline:!0,output:"Boolean",style:"logic_blocks",helpUrl:"%{BKY_LOGIC_OPERATION_HELPURL}",extensions:["logic_op_tooltip"]},{type:"logic_negate",message0:"%{BKY_LOGIC_NEGATE_TITLE}",args0:[{type:"input_value",name:"BOOL",check:"Boolean"}],output:"Boolean",style:"logic_blocks",tooltip:"%{BKY_LOGIC_NEGATE_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NEGATE_HELPURL}"},{type:"logic_null",message0:"%{BKY_LOGIC_NULL}",output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_NULL_TOOLTIP}",helpUrl:"%{BKY_LOGIC_NULL_HELPURL}"},{type:"logic_ternary",message0:"%{BKY_LOGIC_TERNARY_CONDITION} %1",args0:[{type:"input_value",name:"IF",check:"Boolean"}],message1:"%{BKY_LOGIC_TERNARY_IF_TRUE} %1",args1:[{type:"input_value",name:"THEN"}],message2:"%{BKY_LOGIC_TERNARY_IF_FALSE} %1",args2:[{type:"input_value",name:"ELSE"}],output:null,style:"logic_blocks",tooltip:"%{BKY_LOGIC_TERNARY_TOOLTIP}",helpUrl:"%{BKY_LOGIC_TERNARY_HELPURL}",extensions:["logic_ternary"]}]),t.defineBlocksWithJsonArray([{type:"controls_if_if",message0:"%{BKY_CONTROLS_IF_IF_TITLE_IF}",nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_IF_TOOLTIP}"},{type:"controls_if_elseif",message0:"%{BKY_CONTROLS_IF_ELSEIF_TITLE_ELSEIF}",previousStatement:null,nextStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSEIF_TOOLTIP}"},{type:"controls_if_else",message0:"%{BKY_CONTROLS_IF_ELSE_TITLE_ELSE}",previousStatement:null,enableContextMenu:!1,style:"logic_blocks",tooltip:"%{BKY_CONTROLS_IF_ELSE_TOOLTIP}"}]),t.Constants.Logic.TOOLTIPS_BY_OP={EQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_EQ}",NEQ:"%{BKY_LOGIC_COMPARE_TOOLTIP_NEQ}",LT:"%{BKY_LOGIC_COMPARE_TOOLTIP_LT}",LTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_LTE}",GT:"%{BKY_LOGIC_COMPARE_TOOLTIP_GT}",GTE:"%{BKY_LOGIC_COMPARE_TOOLTIP_GTE}",AND:"%{BKY_LOGIC_OPERATION_TOOLTIP_AND}",OR:"%{BKY_LOGIC_OPERATION_TOOLTIP_OR}"},t.Extensions.register("logic_op_tooltip",t.Extensions.buildTooltipForDropdown("OP",t.Constants.Logic.TOOLTIPS_BY_OP)),t.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN={elseifCount_:0,elseCount_:0,suppressPrefixSuffix:!0,mutationToDom:function(){if(!this.elseifCount_&&!this.elseCount_)return null;var e=t.utils.xml.createElement("mutation");return this.elseifCount_&&e.setAttribute("elseif",this.elseifCount_),this.elseCount_&&e.setAttribute("else",1),e},domToMutation:function(t){this.elseifCount_=parseInt(t.getAttribute("elseif"),10)||0,this.elseCount_=parseInt(t.getAttribute("else"),10)||0,this.rebuildShape_()},decompose:function(t){var e=t.newBlock("controls_if_if");e.initSvg();for(var n=e.nextConnection,r=1;r<=this.elseifCount_;r++){var i=t.newBlock("controls_if_elseif");i.initSvg(),n.connect(i.previousConnection),n=i.nextConnection}return this.elseCount_&&((t=t.newBlock("controls_if_else")).initSvg(),n.connect(t.previousConnection)),e},compose:function(t){t=t.nextConnection.targetBlock(),this.elseCount_=this.elseifCount_=0;for(var e=[null],n=[null],r=null;t&&!t.isInsertionMarker();){switch(t.type){case"controls_if_elseif":this.elseifCount_++,e.push(t.valueConnection_),n.push(t.statementConnection_);break;case"controls_if_else":this.elseCount_++,r=t.statementConnection_;break;default:throw TypeError("Unknown block type: "+t.type)}t=t.nextConnection&&t.nextConnection.targetBlock()}this.updateShape_(),this.reconnectChildBlocks_(e,n,r)},saveConnections:function(t){t=t.nextConnection.targetBlock();for(var e=1;t;){switch(t.type){case"controls_if_elseif":var n=this.getInput("IF"+e),r=this.getInput("DO"+e);t.valueConnection_=n&&n.connection.targetConnection,t.statementConnection_=r&&r.connection.targetConnection,e++;break;case"controls_if_else":r=this.getInput("ELSE"),t.statementConnection_=r&&r.connection.targetConnection;break;default:throw TypeError("Unknown block type: "+t.type)}t=t.nextConnection&&t.nextConnection.targetBlock()}},rebuildShape_:function(){var t=[null],e=[null],n=null;this.getInput("ELSE")&&(n=this.getInput("ELSE").connection.targetConnection);for(var r=1;this.getInput("IF"+r);){var i=this.getInput("IF"+r),o=this.getInput("DO"+r);t.push(i.connection.targetConnection),e.push(o.connection.targetConnection),r++}this.updateShape_(),this.reconnectChildBlocks_(t,e,n)},updateShape_:function(){this.getInput("ELSE")&&this.removeInput("ELSE");for(var e=1;this.getInput("IF"+e);)this.removeInput("IF"+e),this.removeInput("DO"+e),e++;for(e=1;e<=this.elseifCount_;e++)this.appendValueInput("IF"+e).setCheck("Boolean").appendField(t.Msg.CONTROLS_IF_MSG_ELSEIF),this.appendStatementInput("DO"+e).appendField(t.Msg.CONTROLS_IF_MSG_THEN);this.elseCount_&&this.appendStatementInput("ELSE").appendField(t.Msg.CONTROLS_IF_MSG_ELSE)},reconnectChildBlocks_:function(e,n,r){for(var i=1;i<=this.elseifCount_;i++)t.Mutator.reconnect(e[i],this,"IF"+i),t.Mutator.reconnect(n[i],this,"DO"+i);t.Mutator.reconnect(r,this,"ELSE")}},t.Extensions.registerMutator("controls_if_mutator",t.Constants.Logic.CONTROLS_IF_MUTATOR_MIXIN,null,["controls_if_elseif","controls_if_else"]),t.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION=function(){this.setTooltip(function(){return this.elseifCount_||this.elseCount_?!this.elseifCount_&&this.elseCount_?t.Msg.CONTROLS_IF_TOOLTIP_2:this.elseifCount_&&!this.elseCount_?t.Msg.CONTROLS_IF_TOOLTIP_3:this.elseifCount_&&this.elseCount_?t.Msg.CONTROLS_IF_TOOLTIP_4:"":t.Msg.CONTROLS_IF_TOOLTIP_1}.bind(this))},t.Extensions.register("controls_if_tooltip",t.Constants.Logic.CONTROLS_IF_TOOLTIP_EXTENSION),t.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN={onchange:function(e){this.prevBlocks_||(this.prevBlocks_=[null,null]);var n=this.getInputTargetBlock("A"),r=this.getInputTargetBlock("B");n&&r&&!this.workspace.connectionChecker.doTypeChecks(n.outputConnection,r.outputConnection)&&(t.Events.setGroup(e.group),(e=this.prevBlocks_[0])!==n&&(n.unplug(),!e||e.isDisposed()||e.isShadow()||this.getInput("A").connection.connect(e.outputConnection)),(n=this.prevBlocks_[1])!==r&&(r.unplug(),!n||n.isDisposed()||n.isShadow()||this.getInput("B").connection.connect(n.outputConnection)),this.bumpNeighbours(),t.Events.setGroup(!1)),this.prevBlocks_[0]=this.getInputTargetBlock("A"),this.prevBlocks_[1]=this.getInputTargetBlock("B")}},t.Constants.Logic.LOGIC_COMPARE_EXTENSION=function(){this.mixin(t.Constants.Logic.LOGIC_COMPARE_ONCHANGE_MIXIN)},t.Extensions.register("logic_compare",t.Constants.Logic.LOGIC_COMPARE_EXTENSION),t.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN={prevParentConnection_:null,onchange:function(e){var n=this.getInputTargetBlock("THEN"),r=this.getInputTargetBlock("ELSE"),i=this.outputConnection.targetConnection;if((n||r)&&i)for(var o=0;2>o;o++){var s=1==o?n:r;s&&!s.workspace.connectionChecker.doTypeChecks(s.outputConnection,i)&&(t.Events.setGroup(e.group),i===this.prevParentConnection_?(this.unplug(),i.getSourceBlock().bumpNeighbours()):(s.unplug(),s.bumpNeighbours()),t.Events.setGroup(!1))}this.prevParentConnection_=i}},t.Extensions.registerMixin("logic_ternary",t.Constants.Logic.LOGIC_TERNARY_ONCHANGE_MIXIN),t.Blocks.loops={},t.Constants.Loops={},t.Constants.Loops.HUE=120,t.defineBlocksWithJsonArray([{type:"controls_repeat_ext",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"input_value",name:"TIMES",check:"Number"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_repeat",message0:"%{BKY_CONTROLS_REPEAT_TITLE}",args0:[{type:"field_number",name:"TIMES",value:10,min:0,precision:1}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",tooltip:"%{BKY_CONTROLS_REPEAT_TOOLTIP}",helpUrl:"%{BKY_CONTROLS_REPEAT_HELPURL}"},{type:"controls_whileUntil",message0:"%1 %2",args0:[{type:"field_dropdown",name:"MODE",options:[["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_WHILE}","WHILE"],["%{BKY_CONTROLS_WHILEUNTIL_OPERATOR_UNTIL}","UNTIL"]]},{type:"input_value",name:"BOOL",check:"Boolean"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_WHILEUNTIL_HELPURL}",extensions:["controls_whileUntil_tooltip"]},{type:"controls_for",message0:"%{BKY_CONTROLS_FOR_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"FROM",check:"Number",align:"RIGHT"},{type:"input_value",name:"TO",check:"Number",align:"RIGHT"},{type:"input_value",name:"BY",check:"Number",align:"RIGHT"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],inputsInline:!0,previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOR_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_for_tooltip"]},{type:"controls_forEach",message0:"%{BKY_CONTROLS_FOREACH_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:null},{type:"input_value",name:"LIST",check:"Array"}],message1:"%{BKY_CONTROLS_REPEAT_INPUT_DO} %1",args1:[{type:"input_statement",name:"DO"}],previousStatement:null,nextStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FOREACH_HELPURL}",extensions:["contextMenu_newGetVariableBlock","controls_forEach_tooltip"]},{type:"controls_flow_statements",message0:"%1",args0:[{type:"field_dropdown",name:"FLOW",options:[["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_BREAK}","BREAK"],["%{BKY_CONTROLS_FLOW_STATEMENTS_OPERATOR_CONTINUE}","CONTINUE"]]}],previousStatement:null,style:"loop_blocks",helpUrl:"%{BKY_CONTROLS_FLOW_STATEMENTS_HELPURL}",extensions:["controls_flow_tooltip","controls_flow_in_loop_check"]}]),t.Constants.Loops.WHILE_UNTIL_TOOLTIPS={WHILE:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_WHILE}",UNTIL:"%{BKY_CONTROLS_WHILEUNTIL_TOOLTIP_UNTIL}"},t.Extensions.register("controls_whileUntil_tooltip",t.Extensions.buildTooltipForDropdown("MODE",t.Constants.Loops.WHILE_UNTIL_TOOLTIPS)),t.Constants.Loops.BREAK_CONTINUE_TOOLTIPS={BREAK:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_BREAK}",CONTINUE:"%{BKY_CONTROLS_FLOW_STATEMENTS_TOOLTIP_CONTINUE}"},t.Extensions.register("controls_flow_tooltip",t.Extensions.buildTooltipForDropdown("FLOW",t.Constants.Loops.BREAK_CONTINUE_TOOLTIPS)),t.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN={customContextMenu:function(e){if(!this.isInFlyout){var n=this.getField("VAR").getVariable(),r=n.name;if(!this.isCollapsed()&&null!=r){var i={enabled:!0};i.text=t.Msg.VARIABLES_SET_CREATE_GET.replace("%1",r),n=t.Variables.generateVariableFieldDom(n),(r=t.utils.xml.createElement("block")).setAttribute("type","variables_get"),r.appendChild(n),i.callback=t.ContextMenu.callbackFactory(this,r),e.push(i)}}}},t.Extensions.registerMixin("contextMenu_newGetVariableBlock",t.Constants.Loops.CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN),t.Extensions.register("controls_for_tooltip",t.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOR_TOOLTIP}","VAR")),t.Extensions.register("controls_forEach_tooltip",t.Extensions.buildTooltipWithFieldText("%{BKY_CONTROLS_FOREACH_TOOLTIP}","VAR")),t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN={LOOP_TYPES:["controls_repeat","controls_repeat_ext","controls_forEach","controls_for","controls_whileUntil"],suppressPrefixSuffix:!0,getSurroundLoop:function(e){do{if(-1!=t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.LOOP_TYPES.indexOf(e.type))return e;e=e.getSurroundParent()}while(e);return null},onchange:function(e){if(this.workspace.isDragging&&!this.workspace.isDragging()&&e.type==t.Events.BLOCK_MOVE){var n=t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN.getSurroundLoop(this);if(this.setWarningText(n?null:t.Msg.CONTROLS_FLOW_STATEMENTS_WARNING),!this.isInFlyout){var r=t.Events.getGroup();t.Events.setGroup(e.group),this.setEnabled(n),t.Events.setGroup(r)}}}},t.Extensions.registerMixin("controls_flow_in_loop_check",t.Constants.Loops.CONTROL_FLOW_IN_LOOP_CHECK_MIXIN),t.Blocks.math={},t.Constants.Math={},t.Constants.Math.HUE=230,t.defineBlocksWithJsonArray([{type:"math_number",message0:"%1",args0:[{type:"field_number",name:"NUM",value:0}],output:"Number",helpUrl:"%{BKY_MATH_NUMBER_HELPURL}",style:"math_blocks",tooltip:"%{BKY_MATH_NUMBER_TOOLTIP}",extensions:["parent_tooltip_when_inline"]},{type:"math_arithmetic",message0:"%1 %2 %3",args0:[{type:"input_value",name:"A",check:"Number"},{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ADDITION_SYMBOL}","ADD"],["%{BKY_MATH_SUBTRACTION_SYMBOL}","MINUS"],["%{BKY_MATH_MULTIPLICATION_SYMBOL}","MULTIPLY"],["%{BKY_MATH_DIVISION_SYMBOL}","DIVIDE"],["%{BKY_MATH_POWER_SYMBOL}","POWER"]]},{type:"input_value",name:"B",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ARITHMETIC_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_single",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_SINGLE_OP_ROOT}","ROOT"],["%{BKY_MATH_SINGLE_OP_ABSOLUTE}","ABS"],["-","NEG"],["ln","LN"],["log10","LOG10"],["e^","EXP"],["10^","POW10"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_SINGLE_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_trig",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_TRIG_SIN}","SIN"],["%{BKY_MATH_TRIG_COS}","COS"],["%{BKY_MATH_TRIG_TAN}","TAN"],["%{BKY_MATH_TRIG_ASIN}","ASIN"],["%{BKY_MATH_TRIG_ACOS}","ACOS"],["%{BKY_MATH_TRIG_ATAN}","ATAN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_TRIG_HELPURL}",extensions:["math_op_tooltip"]},{type:"math_constant",message0:"%1",args0:[{type:"field_dropdown",name:"CONSTANT",options:[["π","PI"],["e","E"],["φ","GOLDEN_RATIO"],["sqrt(2)","SQRT2"],["sqrt(½)","SQRT1_2"],["∞","INFINITY"]]}],output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTANT_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTANT_HELPURL}"},{type:"math_number_property",message0:"%1 %2",args0:[{type:"input_value",name:"NUMBER_TO_CHECK",check:"Number"},{type:"field_dropdown",name:"PROPERTY",options:[["%{BKY_MATH_IS_EVEN}","EVEN"],["%{BKY_MATH_IS_ODD}","ODD"],["%{BKY_MATH_IS_PRIME}","PRIME"],["%{BKY_MATH_IS_WHOLE}","WHOLE"],["%{BKY_MATH_IS_POSITIVE}","POSITIVE"],["%{BKY_MATH_IS_NEGATIVE}","NEGATIVE"],["%{BKY_MATH_IS_DIVISIBLE_BY}","DIVISIBLE_BY"]]}],inputsInline:!0,output:"Boolean",style:"math_blocks",tooltip:"%{BKY_MATH_IS_TOOLTIP}",mutator:"math_is_divisibleby_mutator"},{type:"math_change",message0:"%{BKY_MATH_CHANGE_TITLE}",args0:[{type:"field_variable",name:"VAR",variable:"%{BKY_MATH_CHANGE_TITLE_ITEM}"},{type:"input_value",name:"DELTA",check:"Number"}],previousStatement:null,nextStatement:null,style:"variable_blocks",helpUrl:"%{BKY_MATH_CHANGE_HELPURL}",extensions:["math_change_tooltip"]},{type:"math_round",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ROUND_OPERATOR_ROUND}","ROUND"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDUP}","ROUNDUP"],["%{BKY_MATH_ROUND_OPERATOR_ROUNDDOWN}","ROUNDDOWN"]]},{type:"input_value",name:"NUM",check:"Number"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ROUND_HELPURL}",tooltip:"%{BKY_MATH_ROUND_TOOLTIP}"},{type:"math_on_list",message0:"%1 %2",args0:[{type:"field_dropdown",name:"OP",options:[["%{BKY_MATH_ONLIST_OPERATOR_SUM}","SUM"],["%{BKY_MATH_ONLIST_OPERATOR_MIN}","MIN"],["%{BKY_MATH_ONLIST_OPERATOR_MAX}","MAX"],["%{BKY_MATH_ONLIST_OPERATOR_AVERAGE}","AVERAGE"],["%{BKY_MATH_ONLIST_OPERATOR_MEDIAN}","MEDIAN"],["%{BKY_MATH_ONLIST_OPERATOR_MODE}","MODE"],["%{BKY_MATH_ONLIST_OPERATOR_STD_DEV}","STD_DEV"],["%{BKY_MATH_ONLIST_OPERATOR_RANDOM}","RANDOM"]]},{type:"input_value",name:"LIST",check:"Array"}],output:"Number",style:"math_blocks",helpUrl:"%{BKY_MATH_ONLIST_HELPURL}",mutator:"math_modes_of_list_mutator",extensions:["math_op_tooltip"]},{type:"math_modulo",message0:"%{BKY_MATH_MODULO_TITLE}",args0:[{type:"input_value",name:"DIVIDEND",check:"Number"},{type:"input_value",name:"DIVISOR",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_MODULO_TOOLTIP}",helpUrl:"%{BKY_MATH_MODULO_HELPURL}"},{type:"math_constrain",message0:"%{BKY_MATH_CONSTRAIN_TITLE}",args0:[{type:"input_value",name:"VALUE",check:"Number"},{type:"input_value",name:"LOW",check:"Number"},{type:"input_value",name:"HIGH",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_CONSTRAIN_TOOLTIP}",helpUrl:"%{BKY_MATH_CONSTRAIN_HELPURL}"},{type:"math_random_int",message0:"%{BKY_MATH_RANDOM_INT_TITLE}",args0:[{type:"input_value",name:"FROM",check:"Number"},{type:"input_value",name:"TO",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_INT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_INT_HELPURL}"},{type:"math_random_float",message0:"%{BKY_MATH_RANDOM_FLOAT_TITLE_RANDOM}",output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_RANDOM_FLOAT_TOOLTIP}",helpUrl:"%{BKY_MATH_RANDOM_FLOAT_HELPURL}"},{type:"math_atan2",message0:"%{BKY_MATH_ATAN2_TITLE}",args0:[{type:"input_value",name:"X",check:"Number"},{type:"input_value",name:"Y",check:"Number"}],inputsInline:!0,output:"Number",style:"math_blocks",tooltip:"%{BKY_MATH_ATAN2_TOOLTIP}",helpUrl:"%{BKY_MATH_ATAN2_HELPURL}"}]),t.Constants.Math.TOOLTIPS_BY_OP={ADD:"%{BKY_MATH_ARITHMETIC_TOOLTIP_ADD}",MINUS:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MINUS}",MULTIPLY:"%{BKY_MATH_ARITHMETIC_TOOLTIP_MULTIPLY}",DIVIDE:"%{BKY_MATH_ARITHMETIC_TOOLTIP_DIVIDE}",POWER:"%{BKY_MATH_ARITHMETIC_TOOLTIP_POWER}",ROOT:"%{BKY_MATH_SINGLE_TOOLTIP_ROOT}",ABS:"%{BKY_MATH_SINGLE_TOOLTIP_ABS}",NEG:"%{BKY_MATH_SINGLE_TOOLTIP_NEG}",LN:"%{BKY_MATH_SINGLE_TOOLTIP_LN}",LOG10:"%{BKY_MATH_SINGLE_TOOLTIP_LOG10}",EXP:"%{BKY_MATH_SINGLE_TOOLTIP_EXP}",POW10:"%{BKY_MATH_SINGLE_TOOLTIP_POW10}",SIN:"%{BKY_MATH_TRIG_TOOLTIP_SIN}",COS:"%{BKY_MATH_TRIG_TOOLTIP_COS}",TAN:"%{BKY_MATH_TRIG_TOOLTIP_TAN}",ASIN:"%{BKY_MATH_TRIG_TOOLTIP_ASIN}",ACOS:"%{BKY_MATH_TRIG_TOOLTIP_ACOS}",ATAN:"%{BKY_MATH_TRIG_TOOLTIP_ATAN}",SUM:"%{BKY_MATH_ONLIST_TOOLTIP_SUM}",MIN:"%{BKY_MATH_ONLIST_TOOLTIP_MIN}",MAX:"%{BKY_MATH_ONLIST_TOOLTIP_MAX}",AVERAGE:"%{BKY_MATH_ONLIST_TOOLTIP_AVERAGE}",MEDIAN:"%{BKY_MATH_ONLIST_TOOLTIP_MEDIAN}",MODE:"%{BKY_MATH_ONLIST_TOOLTIP_MODE}",STD_DEV:"%{BKY_MATH_ONLIST_TOOLTIP_STD_DEV}",RANDOM:"%{BKY_MATH_ONLIST_TOOLTIP_RANDOM}"},t.Extensions.register("math_op_tooltip",t.Extensions.buildTooltipForDropdown("OP",t.Constants.Math.TOOLTIPS_BY_OP)),t.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN={mutationToDom:function(){var e=t.utils.xml.createElement("mutation"),n="DIVISIBLE_BY"==this.getFieldValue("PROPERTY");return e.setAttribute("divisor_input",n),e},domToMutation:function(t){t="true"==t.getAttribute("divisor_input"),this.updateShape_(t)},updateShape_:function(t){var e=this.getInput("DIVISOR");t?e||this.appendValueInput("DIVISOR").setCheck("Number"):e&&this.removeInput("DIVISOR")}},t.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION=function(){this.getField("PROPERTY").setValidator(function(t){t="DIVISIBLE_BY"==t,this.getSourceBlock().updateShape_(t)})},t.Extensions.registerMutator("math_is_divisibleby_mutator",t.Constants.Math.IS_DIVISIBLEBY_MUTATOR_MIXIN,t.Constants.Math.IS_DIVISIBLE_MUTATOR_EXTENSION),t.Extensions.register("math_change_tooltip",t.Extensions.buildTooltipWithFieldText("%{BKY_MATH_CHANGE_TOOLTIP}","VAR")),t.Constants.Math.LIST_MODES_MUTATOR_MIXIN={updateType_:function(t){"MODE"==t?this.outputConnection.setCheck("Array"):this.outputConnection.setCheck("Number")},mutationToDom:function(){var e=t.utils.xml.createElement("mutation");return e.setAttribute("op",this.getFieldValue("OP")),e},domToMutation:function(t){this.updateType_(t.getAttribute("op"))}},t.Constants.Math.LIST_MODES_MUTATOR_EXTENSION=function(){this.getField("OP").setValidator(function(t){this.updateType_(t)}.bind(this))},t.Extensions.registerMutator("math_modes_of_list_mutator",t.Constants.Math.LIST_MODES_MUTATOR_MIXIN,t.Constants.Math.LIST_MODES_MUTATOR_EXTENSION),t.Blocks.procedures={},t.Blocks.procedures_defnoreturn={init:function(){var e=t.Procedures.findLegalName("",this);(e=new t.FieldTextInput(e,t.Procedures.rename)).setSpellcheck(!1),this.appendDummyInput().appendField(t.Msg.PROCEDURES_DEFNORETURN_TITLE).appendField(e,"NAME").appendField("","PARAMS"),this.setMutator(new t.Mutator(["procedures_mutatorarg"])),(this.workspace.options.comments||this.workspace.options.parentWorkspace&&this.workspace.options.parentWorkspace.options.comments)&&t.Msg.PROCEDURES_DEFNORETURN_COMMENT&&this.setCommentText(t.Msg.PROCEDURES_DEFNORETURN_COMMENT),this.setStyle("procedure_blocks"),this.setTooltip(t.Msg.PROCEDURES_DEFNORETURN_TOOLTIP),this.setHelpUrl(t.Msg.PROCEDURES_DEFNORETURN_HELPURL),this.arguments_=[],this.argumentVarModels_=[],this.setStatements_(!0),this.statementConnection_=null},setStatements_:function(e){this.hasStatements_!==e&&(e?(this.appendStatementInput("STACK").appendField(t.Msg.PROCEDURES_DEFNORETURN_DO),this.getInput("RETURN")&&this.moveInputBefore("STACK","RETURN")):this.removeInput("STACK",!0),this.hasStatements_=e)},updateParams_:function(){var e="";this.arguments_.length&&(e=t.Msg.PROCEDURES_BEFORE_PARAMS+" "+this.arguments_.join(", ")),t.Events.disable();try{this.setFieldValue(e,"PARAMS")}finally{t.Events.enable()}},mutationToDom:function(e){var n=t.utils.xml.createElement("mutation");e&&n.setAttribute("name",this.getFieldValue("NAME"));for(var r=0;r=this.select.multipleLimit&&this.select.multipleLimit>0)}},watch:{currentLabel:function(){this.created||this.select.remote||this.dispatch("ElSelect","setSelected")},value:function(t,e){var n=this.select,r=n.remote,i=n.valueKey;if(!this.created&&!r){if(i&&"object"===(void 0===t?"undefined":a(t))&&"object"===(void 0===e?"undefined":a(e))&&t[i]===e[i])return;this.dispatch("ElSelect","setSelected")}}},methods:{isEqual:function(t,e){if(this.isObject){var n=this.select.valueKey;return Object(s.getValueByPath)(t,n)===Object(s.getValueByPath)(e,n)}return t===e},contains:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments[1];if(this.isObject){var n=this.select.valueKey;return t&&t.some(function(t){return Object(s.getValueByPath)(t,n)===Object(s.getValueByPath)(e,n)})}return t&&t.indexOf(e)>-1},handleGroupDisabled:function(t){this.groupDisabled=t},hoverItem:function(){this.disabled||this.groupDisabled||(this.select.hoverIndex=this.select.options.indexOf(this))},selectOptionClick:function(){!0!==this.disabled&&!0!==this.groupDisabled&&this.dispatch("ElSelect","handleOptionClick",[this,!0])},queryChange:function(t){this.visible=new RegExp(Object(s.escapeRegexpString)(t),"i").test(this.currentLabel)||this.created,this.visible||this.select.filteredOptionsCount--}},created:function(){this.select.options.push(this),this.select.cachedOptions.push(this),this.select.optionsCount++,this.select.filteredOptionsCount++,this.$on("queryChange",this.queryChange),this.$on("handleGroupDisabled",this.handleGroupDisabled)},beforeDestroy:function(){var t=this.select,e=t.selected,n=t.multiple?e:[e],r=this.select.cachedOptions.indexOf(this),i=n.indexOf(this);r>-1&&i<0&&this.select.cachedOptions.splice(r,1),this.select.onOptionDestroy(this.select.options.indexOf(this))}},u=n(0),c=Object(u.a)(l,r,[],!1,null,null,null);c.options.__file="packages/select/src/option.vue";e.a=c.exports},4:function(t,e){t.exports=n("fPll")},53:function(t,e,n){"use strict";n.r(e);var r=n(33);r.a.install=function(t){t.component(r.a.name,r.a)},e.default=r.a}})},SW71:function(t,e,n){"use strict";e.a=function(t){return r[t]}; /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ const r={}},SXzR:function(t,e,n){t.exports=function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=73)}({0:function(t,e,n){"use strict";function r(t,e,n,r,i,o,s,a){var l,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),r&&(u.functional=!0),o&&(u._scopeId="data-v-"+o),s?(l=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),i&&i.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=l):i&&(l=a?function(){i.call(this,this.$root.$options.shadowRoot)}:i),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(t,e){return l.call(e),c(t,e)}}else{var h=u.beforeCreate;u.beforeCreate=h?[].concat(h,l):[l]}return{exports:t,options:u}}n.d(e,"a",function(){return r})},2:function(t,e){t.exports=n("2kvA")},3:function(t,e){t.exports=n("ylDJ")},5:function(t,e){t.exports=n("fKx3")},7:function(t,e){t.exports=n("7+uW")},73:function(t,e,n){"use strict";n.r(e);var r=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("span",[n("transition",{attrs:{name:t.transition},on:{"after-enter":t.handleAfterEnter,"after-leave":t.handleAfterLeave}},[n("div",{directives:[{name:"show",rawName:"v-show",value:!t.disabled&&t.showPopper,expression:"!disabled && showPopper"}],ref:"popper",staticClass:"el-popover el-popper",class:[t.popperClass,t.content&&"el-popover--plain"],style:{width:t.width+"px"},attrs:{role:"tooltip",id:t.tooltipId,"aria-hidden":t.disabled||!t.showPopper?"true":"false"}},[t.title?n("div",{staticClass:"el-popover__title",domProps:{textContent:t._s(t.title)}}):t._e(),t._t("default",[t._v(t._s(t.content))])],2)]),n("span",{ref:"wrapper",staticClass:"el-popover__reference-wrapper"},[t._t("reference")],2)],1)};r._withStripped=!0;var i=n(5),o=n.n(i),s=n(2),a=n(3),l={name:"ElPopover",mixins:[o.a],props:{trigger:{type:String,default:"click",validator:function(t){return["click","focus","hover","manual"].indexOf(t)>-1}},openDelay:{type:Number,default:0},closeDelay:{type:Number,default:200},title:String,disabled:Boolean,content:String,reference:{},popperClass:String,width:{},visibleArrow:{default:!0},arrowOffset:{type:Number,default:0},transition:{type:String,default:"fade-in-linear"},tabindex:{type:Number,default:0}},computed:{tooltipId:function(){return"el-popover-"+Object(a.generateId)()}},watch:{showPopper:function(t){this.disabled||(t?this.$emit("show"):this.$emit("hide"))}},mounted:function(){var t=this,e=this.referenceElm=this.reference||this.$refs.reference,n=this.popper||this.$refs.popper;!e&&this.$refs.wrapper.children&&(e=this.referenceElm=this.$refs.wrapper.children[0]),e&&(Object(s.addClass)(e,"el-popover__reference"),e.setAttribute("aria-describedby",this.tooltipId),e.setAttribute("tabindex",this.tabindex),n.setAttribute("tabindex",0),"click"!==this.trigger&&(Object(s.on)(e,"focusin",function(){t.handleFocus();var n=e.__vue__;n&&"function"==typeof n.focus&&n.focus()}),Object(s.on)(n,"focusin",this.handleFocus),Object(s.on)(e,"focusout",this.handleBlur),Object(s.on)(n,"focusout",this.handleBlur)),Object(s.on)(e,"keydown",this.handleKeydown),Object(s.on)(e,"click",this.handleClick)),"click"===this.trigger?(Object(s.on)(e,"click",this.doToggle),Object(s.on)(document,"click",this.handleDocumentClick)):"hover"===this.trigger?(Object(s.on)(e,"mouseenter",this.handleMouseEnter),Object(s.on)(n,"mouseenter",this.handleMouseEnter),Object(s.on)(e,"mouseleave",this.handleMouseLeave),Object(s.on)(n,"mouseleave",this.handleMouseLeave)):"focus"===this.trigger&&(this.tabindex<0&&console.warn("[Element Warn][Popover]a negative taindex means that the element cannot be focused by tab key"),e.querySelector("input, textarea")?(Object(s.on)(e,"focusin",this.doShow),Object(s.on)(e,"focusout",this.doClose)):(Object(s.on)(e,"mousedown",this.doShow),Object(s.on)(e,"mouseup",this.doClose)))},beforeDestroy:function(){this.cleanup()},deactivated:function(){this.cleanup()},methods:{doToggle:function(){this.showPopper=!this.showPopper},doShow:function(){this.showPopper=!0},doClose:function(){this.showPopper=!1},handleFocus:function(){Object(s.addClass)(this.referenceElm,"focusing"),"click"!==this.trigger&&"focus"!==this.trigger||(this.showPopper=!0)},handleClick:function(){Object(s.removeClass)(this.referenceElm,"focusing")},handleBlur:function(){Object(s.removeClass)(this.referenceElm,"focusing"),"click"!==this.trigger&&"focus"!==this.trigger||(this.showPopper=!1)},handleMouseEnter:function(){var t=this;clearTimeout(this._timer),this.openDelay?this._timer=setTimeout(function(){t.showPopper=!0},this.openDelay):this.showPopper=!0},handleKeydown:function(t){27===t.keyCode&&"manual"!==this.trigger&&this.doClose()},handleMouseLeave:function(){var t=this;clearTimeout(this._timer),this.closeDelay?this._timer=setTimeout(function(){t.showPopper=!1},this.closeDelay):this.showPopper=!1},handleDocumentClick:function(t){var e=this.reference||this.$refs.reference,n=this.popper||this.$refs.popper;!e&&this.$refs.wrapper.children&&(e=this.referenceElm=this.$refs.wrapper.children[0]),this.$el&&e&&!this.$el.contains(t.target)&&!e.contains(t.target)&&n&&!n.contains(t.target)&&(this.showPopper=!1)},handleAfterEnter:function(){this.$emit("after-enter")},handleAfterLeave:function(){this.$emit("after-leave"),this.doDestroy()},cleanup:function(){(this.openDelay||this.closeDelay)&&clearTimeout(this._timer)}},destroyed:function(){var t=this.reference;Object(s.off)(t,"click",this.doToggle),Object(s.off)(t,"mouseup",this.doClose),Object(s.off)(t,"mousedown",this.doShow),Object(s.off)(t,"focusin",this.doShow),Object(s.off)(t,"focusout",this.doClose),Object(s.off)(t,"mousedown",this.doShow),Object(s.off)(t,"mouseup",this.doClose),Object(s.off)(t,"mouseleave",this.handleMouseLeave),Object(s.off)(t,"mouseenter",this.handleMouseEnter),Object(s.off)(document,"click",this.handleDocumentClick)}},u=n(0),c=Object(u.a)(l,r,[],!1,null,null,null);c.options.__file="packages/popover/src/main.vue";var h=c.exports,d=function(t,e,n){var r=e.expression?e.value:e.arg,i=n.context.$refs[r];i&&(Array.isArray(i)?i[0].$refs.reference=t:i.$refs.reference=t)},p={bind:function(t,e,n){d(t,e,n)},inserted:function(t,e,n){d(t,e,n)}},f=n(7);n.n(f).a.directive("popover",p),h.install=function(t){t.directive("popover",p),t.component(h.name,h)},h.directive=p;e.default=h}})},SfB7:function(t,e,n){t.exports=!n("+E39")&&!n("S82l")(function(){return 7!=Object.defineProperty(n("ON07")("div"),"a",{get:function(){return 7}}).a})},SldL:function(t,e){!function(e){"use strict";var n,r=Object.prototype,i=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},s=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",l=o.toStringTag||"@@toStringTag",u="object"==typeof t,c=e.regeneratorRuntime;if(c)u&&(t.exports=c);else{(c=e.regeneratorRuntime=u?t.exports:{}).wrap=y;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",g={},m={};m[s]=function(){return this};var v=Object.getPrototypeOf,b=v&&v(v(A([])));b&&b!==r&&i.call(b,s)&&(m=b);var _=w.prototype=E.prototype=Object.create(m);x.prototype=_.constructor=w,w.constructor=x,w[l]=x.displayName="GeneratorFunction",c.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===x||"GeneratorFunction"===(e.displayName||e.name))},c.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l in t||(t[l]="GeneratorFunction")),t.prototype=Object.create(_),t},c.awrap=function(t){return{__await:t}},C(S.prototype),S.prototype[a]=function(){return this},c.AsyncIterator=S,c.async=function(t,e,n,r){var i=new S(y(t,e,n,r));return c.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},C(_),_[l]="Generator",_[s]=function(){return this},_.toString=function(){return"[object Generator]"},c.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},c.values=A,R.prototype={constructor:R,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(I),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,i){return a.type="throw",a.arg=t,e.next=r,i&&(e.method="next",e.arg=n),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var s=this.tryEntries[o],a=s.completion;if("root"===s.tryLoc)return r("end");if(s.tryLoc<=this.prev){var l=i.call(s,"catchLoc"),u=i.call(s,"finallyLoc");if(l&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),I(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;I(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:A(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),g}}}function y(t,e,n,r){var i=e&&e.prototype instanceof E?e:E,o=Object.create(i.prototype),s=new R(r||[]);return o._invoke=function(t,e,n){var r=h;return function(i,o){if(r===p)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw o;return N()}for(n.method=i,n.arg=o;;){var s=n.delegate;if(s){var a=k(s,n);if(a){if(a===g)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var l=T(t,e,n);if("normal"===l.type){if(r=n.done?f:d,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r=f,n.method="throw",n.arg=l.arg)}}}(t,n,s),o}function T(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function E(){}function x(){}function w(){}function C(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function S(t){var e;this._invoke=function(n,r){function o(){return new Promise(function(e,o){!function e(n,r,o,s){var a=T(t[n],t,r);if("throw"!==a.type){var l=a.arg,u=l.value;return u&&"object"==typeof u&&i.call(u,"__await")?Promise.resolve(u.__await).then(function(t){e("next",t,o,s)},function(t){e("throw",t,o,s)}):Promise.resolve(u).then(function(t){l.value=t,o(l)},s)}s(a.arg)}(n,r,e,o)})}return e=e?e.then(o,o):o()}}function k(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,k(t,e),"throw"===e.method))return g;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var i=T(r,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,g):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function I(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function A(t){if(t){var e=t[s];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,o=function e(){for(;++r1?e-1:0),s=1;s0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]!1,t=>{t&&console.warn("Debugging mode is ON. The output of every math call will be downloaded to CPU and checked for NaNs. This significantly impacts performance.")}),i.registerFlag("IS_BROWSER",()=>e.isBrowser()),i.registerFlag("IS_NODE",()=>void 0!==t&&void 0!==t.versions&&void 0!==t.versions.node),i.registerFlag("IS_CHROME",()=>"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)),i.registerFlag("PROD",()=>!1),i.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",()=>i.getBool("DEBUG")),i.registerFlag("DEPRECATION_WARNINGS_ENABLED",()=>!0),i.registerFlag("IS_TEST",()=>!1),i.registerFlag("CHECK_COMPUTATION_FOR_ERRORS",()=>!0),i.registerFlag("WRAP_TO_IMAGEBITMAP",()=>!1)}).call(e,n("W2nU"))},To3L:function(t,e,n){"use strict";var r=n("+E39"),i=n("lktj"),o=n("1kS7"),s=n("NpIQ"),a=n("sB3e"),l=n("MU5D"),u=Object.assign;t.exports=!u||n("S82l")(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=u({},t)[n]||Object.keys(u({},e)).join("")!=r})?function(t,e){for(var n=a(t),u=arguments.length,c=1,h=o.f,d=s.f;u>c;)for(var p,f=l(arguments[c++]),g=h?i(f).concat(h(f)):i(f),m=g.length,v=0;m>v;)p=g[v++],r&&!d.call(f,p)||(n[p]=f[p]);return n}:u},U5ju:function(t,e,n){n("M6a0"),n("zQR9"),n("+tPU"),n("CXw9"),n("EqBC"),n("jKW+"),t.exports=n("FeBl").Promise},UWMC:function(t,e,n){"use strict";var r=n("Kkag"),i=n("xMQ1"),o=n("35G1");const s=Object(o.a)({square_: /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t){const e=Object(i.a)(t,"x","square");return r.a.runKernel("Square",{x:e},{})}});e.a=s},UuGF:function(t,e){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},V3tA:function(t,e,n){n("R4wc"),t.exports=n("FeBl").Object.assign},V6aD:function(t,e,n){"use strict";e.b=function(){return r.a},e.e=function(t,e){return r.a.tidy(t,e)},e.a=function(t){Object(s.b)(t).forEach(t=>t.dispose())},e.c=function(t){return r.a.keep(t)},e.d=function(t,e,n=1){return r.a.registerBackend(t,e,n)};var r=n("Kkag"),i=n("v/P2"),o=n("XPNO"),s=n("jb1O");Object(o.d)(function(t){Object(i.b)().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(t+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")})},VOQS:function(t,e,n){(function(t){var r;!function(t,i,o){function s(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function a(t,e){var n=new function(t){var e,n=this,r=(e=4022871197,function(t){t=t.toString();for(var n=0;n>>0,e=(r*=e)>>>0,e+=4294967296*(r-=e)}return 2.3283064365386963e-10*(e>>>0)});n.next=function(){var t=2091639*n.s0+2.3283064365386963e-10*n.c;return n.s0=n.s1,n.s1=n.s2,n.s2=t-(n.c=0|t)},n.c=1,n.s0=r(" "),n.s1=r(" "),n.s2=r(" "),n.s0-=r(t),n.s0<0&&(n.s0+=1),n.s1-=r(t),n.s1<0&&(n.s1+=1),n.s2-=r(t),n.s2<0&&(n.s2+=1),r=null}(t),r=e&&e.state,i=n.next;return i.int32=function(){return 4294967296*n.next()|0},i.double=function(){return i()+1.1102230246251565e-16*(2097152*i()|0)},i.quick=i,r&&("object"==typeof r&&s(r,n),i.state=function(){return s(n,{})}),i}i&&i.exports?i.exports=a:n("LGuY")&&n("nErl")?void 0===(r=function(){return a}.call(e,n,e,i))||(i.exports=r):this.alea=a}(0,"object"==typeof t&&t,n("LGuY"))}).call(e,n("3IRH")(t))},"VU/8":function(t,e){t.exports=function(t,e,n,r,i,o){var s,a=t=t||{},l=typeof t.default;"object"!==l&&"function"!==l||(s=t,a=t.default);var u,c="function"==typeof a?a.options:a;if(e&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0),n&&(c.functional=!0),i&&(c._scopeId=i),o?(u=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(o)},c._ssrRegister=u):r&&(u=r),u){var h=c.functional,d=h?c.render:c.beforeCreate;h?(c._injectStyles=u,c.render=function(t,e){return u.call(e),d(t,e)}):c.beforeCreate=d?[].concat(d,u):[u]}return{esModule:s,exports:a,options:c}}},VdVo:function(t,e,n){"use strict";var r=n("Kkag"),i=n("l5jf"),o=n("xMQ1"),s=n("35G1");const a=Object(s.a)({clone_: /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function(t){const e={x:Object(o.a)(t,"x","clone","string_or_numeric")};return r.a.runKernel(i._15,e)}});e.a=a},Vi3T:function(t,e,n){"use strict";e.__esModule=!0,e.default={el:{colorpicker:{confirm:"确定",clear:"清空"},datepicker:{now:"此刻",today:"今天",cancel:"取消",clear:"清空",confirm:"确定",selectDate:"选择日期",selectTime:"选择时间",startDate:"开始日期",startTime:"开始时间",endDate:"结束日期",endTime:"结束时间",prevYear:"前一年",nextYear:"后一年",prevMonth:"上个月",nextMonth:"下个月",year:"年",month1:"1 月",month2:"2 月",month3:"3 月",month4:"4 月",month5:"5 月",month6:"6 月",month7:"7 月",month8:"8 月",month9:"9 月",month10:"10 月",month11:"11 月",month12:"12 月",weeks:{sun:"日",mon:"一",tue:"二",wed:"三",thu:"四",fri:"五",sat:"六"},months:{jan:"一月",feb:"二月",mar:"三月",apr:"四月",may:"五月",jun:"六月",jul:"七月",aug:"八月",sep:"九月",oct:"十月",nov:"十一月",dec:"十二月"}},select:{loading:"加载中",noMatch:"无匹配数据",noData:"无数据",placeholder:"请选择"},cascader:{noMatch:"无匹配数据",loading:"加载中",placeholder:"请选择",noData:"暂无数据"},pagination:{goto:"前往",pagesize:"条/页",total:"共 {total} 条",pageClassifier:"页"},messagebox:{title:"提示",confirm:"确定",cancel:"取消",error:"输入的数据不合法!"},upload:{deleteTip:"按 delete 键可删除",delete:"删除",preview:"查看图片",continue:"继续上传"},table:{emptyText:"暂无数据",confirmFilter:"筛选",resetFilter:"重置",clearFilter:"全部",sumText:"合计"},tree:{emptyText:"暂无数据"},transfer:{noMatch:"无匹配数据",noData:"无数据",titles:["列表 1","列表 2"],filterPlaceholder:"请输入搜索内容",noCheckedFormat:"共 {total} 项",hasCheckedFormat:"已选 {checked}/{total} 项"},image:{error:"加载失败"},pageHeader:{title:"返回"},popconfirm:{confirmButtonText:"确定",cancelButtonText:"取消"},empty:{description:"暂无数据"}}}},W2nU:function(t,e){var n,r,i=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(n===setTimeout)return setTimeout(t,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(t){n=o}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var l,u=[],c=!1,h=-1;function d(){c&&l&&(c=!1,l.length?u=l.concat(u):h=-1,u.length&&p())}function p(){if(!c){var t=a(d);c=!0;for(var e=u.length;e;){for(l=u,u=[];++h1)for(var n=1;n=8){const n=c.add(2*e),r=p(t,0).add(c),i=p(t,e-8);return m(g(i,37).mul(n).add(r),g(r,25).add(i).mul(n),n)}if(e>=4){const n=c.add(2*e);return m(f(t,0).shl(3).add(e),f(t,e-4),n)}if(e>0){const n=t[0]+(t[e>>1]<<8),r=e+(t[e-1]<<2);return h(c.mul(n).xor(l.mul(r))).mul(c)}return c}(t,e):function(t,e=t.length){const n=c.add(2*e),r=p(t,0).mul(u),i=p(t,8),o=p(t,e-8).mul(n),s=p(t,e-16).mul(c);return m(g(r.add(i),43).add(g(o,30)).add(s),r.add(g(i.add(c),18)).add(o),n)}(t,e);if(e<=64)return function(t,e=t.length){const n=c.add(2*e),r=p(t,0).mul(c),i=p(t,8),o=p(t,e-8).mul(n),s=p(t,e-16).mul(c),a=g(r.add(i),43).add(g(o,30)).add(s),l=m(a,r.add(g(i.add(c),18)).add(o),n),u=p(t,16).mul(n),h=p(t,24),d=a.add(p(t,e-32)).mul(n),f=l.add(p(t,e-24)).mul(n);return m(g(u.add(h),43).add(g(d,30)).add(f),u.add(g(h.add(r),18)).add(d),n)}(t,e);let r=n,i=n.mul(u).add(113),o=h(i.mul(c).add(113)).mul(c),a=[s.UZERO,s.UZERO],d=[s.UZERO,s.UZERO];r=r.mul(c).add(p(t,0));let b=0;const _=64*(e-1>>6),y=_+(e-1&63)-63;do{r=g(r.add(i).add(a[0]).add(p(t,b+8)),37).mul(u),i=g(i.add(a[1]).add(p(t,b+48)),42).mul(u),r=r.xor(d[1]),i=i.add(a[0]).add(p(t,b+40)),o=g(o.add(d[0]),33).mul(u),a=v(t,b,a[1].mul(u),r.add(d[0])),d=v(t,b+32,o.add(d[1]),i.add(p(t,b+16))),[o,r]=[r,o],b+=64}while(b!==_);const T=u.add(o.and(255).shl(1));return b=y,d[0]=d[0].add(e-1&63),a[0]=a[0].add(d[0]),d[0]=d[0].add(a[0]),r=g(r.add(i).add(a[0]).add(p(t,b+8)),37).mul(T),i=g(i.add(a[1]).add(p(t,b+48)),42).mul(T),r=r.xor(d[1].mul(9)),i=i.add(a[0].mul(9).add(p(t,b+40))),o=g(o.add(d[0]),33).mul(T),a=v(t,b,a[1].mul(T),r.add(d[0])),d=v(t,b+32,o.add(d[1]),i.add(p(t,b+16))),[o,r]=[r,o],m(m(a[0],d[0],T).add(h(i).mul(l)).add(o),m(a[1],d[1],T).add(r),T)}function _(t,e){if("string"===e)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=i.m(t)),Object(r.b)().getBool("DEBUG")&&i.h(t,e),function(t,e){return t instanceof Float32Array&&"float32"===e||t instanceof Int32Array&&"int32"===e||t instanceof Uint8Array&&"bool"===e}(t,e))return t;if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e){const e=new Uint8Array(t.length);for(let n=0;n!1,t=>{t&&console.warn("Keep intermediate tensors is ON. This will print the values of all intermediate tensors during model inference. Not all models support this mode. For details, check e2e/benchmarks/ model_config.js. This significantly impacts performance.")});var o=n("qR1P"),s=n("zp+s"); /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class a{constructor(t,e,n){this.node=t,this.tensorMap=e,this.context=n,this.inputs=[],this.attrs={},this.inputs=t.inputNames.map(t=>this.getInput(t)),null!=t.rawAttrs&&(this.attrs=Object.keys(t.rawAttrs).reduce((t,e)=>(t[e]=this.getAttr(e),t),{}))}getInput(t){return Object(s.e)(t,this.tensorMap,this.context)}getAttr(t,e){const n=this.node.rawAttrs[t];if(null!=n.tensor)return Object(s.e)(t,this.tensorMap,this.context);if(null!=n.i||null!=n.f)return Object(o.f)(this.node.rawAttrs,t,e);if(null!=n.s)return Object(o.i)(this.node.rawAttrs,t,e);if(null!=n.b)return Object(o.c)(this.node.rawAttrs,t,e);if(null!=n.shape)return Object(o.k)(this.node.rawAttrs,t,e);if(null!=n.type)return Object(o.e)(this.node.rawAttrs,t,e);if(null!=n.list){if(null!=n.list.i||null!=n.list.f)return Object(o.g)(this.node.rawAttrs,t,e);if(null!=n.list.s)return Object(o.h)(this.node.rawAttrs,t,e);if(null!=n.list.shape)return Object(o.j)(this.node.rawAttrs,t,e);if(null!=n.list.b)return Object(o.b)(this.node.rawAttrs,t,e);if(null!=n.list.type)return Object(o.d)(this.node.rawAttrs,t,e)}return e}}var l=n("SW71"),u=n("m3RX"); /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ const c=(t,e,n)=>{switch(t.op){case"BiasAdd":case"AddV2":case"Add":return[u.d(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"AddN":return[u.e(Object(s.d)("tensors",t,e,n))];case"FloorMod":case"Mod":return[u._31(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"Mul":return[u._32(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"RealDiv":case"Div":return[u.N(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"DivNoNan":return[u.O(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"FloorDiv":return[u.Z(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"Sub":return[u._76(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"Minimum":return[u._29(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"Maximum":return[u._26(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"Pow":return[u._40(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"SquaredDifference":return[u._71(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}},h=(t,e,n)=>{switch(t.op){case"Abs":case"ComplexAbs":return[u.a(Object(s.d)("x",t,e,n))];case"Acos":return[u.b(Object(s.d)("x",t,e,n))];case"Acosh":return[u.c(Object(s.d)("x",t,e,n))];case"Asin":return[u.j(Object(s.d)("x",t,e,n))];case"Asinh":return[u.k(Object(s.d)("x",t,e,n))];case"Atan":return[u.l(Object(s.d)("x",t,e,n))];case"Atan2":return[u.m(Object(s.d)("x",t,e,n),Object(s.d)("y",t,e,n))];case"Atanh":return[u.n(Object(s.d)("x",t,e,n))];case"Ceil":return[u.x(Object(s.d)("x",t,e,n))];case"Complex":return[u.A(Object(s.d)("real",t,e,n),Object(s.d)("imag",t,e,n))];case"Cos":return[u.G(Object(s.d)("x",t,e,n))];case"Cosh":return[u.H(Object(s.d)("x",t,e,n))];case"Elu":return[u.Q(Object(s.d)("x",t,e,n))];case"Erf":return[u.S(Object(s.d)("x",t,e,n))];case"Exp":return[u.T(Object(s.d)("x",t,e,n))];case"Expm1":return[u.V(Object(s.d)("x",t,e,n))];case"Floor":return[u.Y(Object(s.d)("x",t,e,n))];case"Log":return[u._15(Object(s.d)("x",t,e,n))];case"Log1p":return[u._16(Object(s.d)("x",t,e,n))];case"Imag":return[u._6(Object(s.d)("x",t,e,n))];case"Neg":return[u._34(Object(s.d)("x",t,e,n))];case"Reciprocal":return[u._46(Object(s.d)("x",t,e,n))];case"Real":return[u._45(Object(s.d)("x",t,e,n))];case"Relu":return[u._47(Object(s.d)("x",t,e,n))];case"Round":return[u._52(Object(s.d)("x",t,e,n))];case"Selu":return[u._56(Object(s.d)("x",t,e,n))];case"Sigmoid":return[u._58(Object(s.d)("x",t,e,n))];case"Sin":return[u._60(Object(s.d)("x",t,e,n))];case"Sign":return[u._59(Object(s.d)("x",t,e,n))];case"Sinh":return[u._61(Object(s.d)("x",t,e,n))];case"Softplus":return[u._64(Object(s.d)("x",t,e,n))];case"Sqrt":return[u._69(Object(s.d)("x",t,e,n))];case"Square":return[u._70(Object(s.d)("x",t,e,n))];case"Tanh":return[u._79(Object(s.d)("x",t,e,n))];case"Tan":return[u._78(Object(s.d)("x",t,e,n))];case"ClipByValue":return[u.y(Object(s.d)("x",t,e,n),Object(s.d)("clipValueMin",t,e,n),Object(s.d)("clipValueMax",t,e,n))];case"Relu6":return[u._48(Object(s.d)("x",t,e,n))];case"Rsqrt":return[u._53(Object(s.e)(t.inputNames[0],e,n))];case"Prod":return[u._42(Object(s.d)("x",t,e,n),Object(s.d)("axes",t,e,n))];case"LeakyRelu":return[u._10(Object(s.d)("x",t,e,n),Object(s.d)("alpha",t,e,n))];case"Prelu":return[u._41(Object(s.d)("x",t,e,n),Object(s.d)("alpha",t,e,n))];case"IsNan":return[u._9(Object(s.e)(t.inputNames[0],e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}}; /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function d(t,e,n=""){if("number"!=typeof t&&"number"!=typeof e){i._152.assert(t.length===e.length,()=>n+` Shapes ${t} and ${e} must match`);for(let r=0;rn+` Shapes ${t} and ${e} must match`)}}}function p(t){return"number"!=typeof t&&!t.some(t=>t<0)}function f(t,e,n){let r=g(t,n);const i=!p(r);if(i&&0===e.length)throw new Error("Tried to calculate elements of an empty list"+` with non-fully-defined elementShape: ${r}`);if(i&&e.forEach(t=>{r=g(t.shape,r)}),!p(r))throw new Error(`Non-fully-defined elementShape: ${r}`);return r}function g(t,e){if("number"==typeof t)return e;if("number"==typeof e)return t;if(t.length!==e.length)throw new Error(`Incompatible ranks during merge: ${t} vs. ${e}`);const n=[];for(let r=0;r=0&&o>=0&&i!==o)throw new Error(`Incompatible shape during merge: ${t} vs. ${e}`);n[r]=i>=0?i:o}return n} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class m{constructor(t,e,n,r=-1){this.tensors=t,this.elementShape=e,this.elementDtype=n,null!=t&&t.forEach(t=>{if(n!==t.dtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${t.dtype}`);d(e,t.shape,"TensorList shape mismatch: "),Object(i._132)(t)}),this.idTensor=Object(i._138)(0),this.maxNumElements=r,Object(i._132)(this.idTensor)}get id(){return this.idTensor.id}copy(){return new m([...this.tensors],this.elementShape,this.elementDtype)}clearAndClose(t){this.tensors.forEach(e=>{null!=t&&t.has(e.id)||e.dispose()}),this.tensors.length=0,this.idTensor.dispose()}size(){return this.tensors.length}stack(t,e,n=-1){if(e!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e}, but list elements ${this.elementDtype}`);if(-1!==n&&this.tensors.length!==n)throw new Error(`Operation expected a list with ${n} elements but got a list with ${this.tensors.length} elements.`);d(t,this.elementShape,"TensorList shape mismatch: ");const r=f(this.elementShape,this.tensors,t);return Object(i._149)(()=>{const t=this.tensors.map(t=>Object(i._137)(t,r));return Object(i._143)(t,0)})}popBack(t,e){if(e!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e}, but list elements ${this.elementDtype}`);if(0===this.size())throw new Error("Trying to pop from an empty list.");const n=f(this.elementShape,this.tensors,t),r=this.tensors.pop();return d(r.shape,t,"TensorList shape mismatch: "),Object(i._137)(r,n)}pushBack(t){if(t.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${this.elementDtype}`);if(d(t.shape,this.elementShape,"TensorList shape mismatch: "),this.maxNumElements===this.size())throw new Error("Trying to push element into a full list.");Object(i._132)(t),this.tensors.push(t)}resize(t){if(t<0)throw new Error(`TensorListResize expects size to be non-negative. Got: ${t}`);if(-1!==this.maxNumElements&&t>this.maxNumElements)throw new Error(`TensorListResize input size ${t} is greater maxNumElement ${this.maxNumElements}.`);this.tensors.length=t}getItem(t,e,n){if(n!==this.elementDtype)throw new Error(`Invalid data types; op elements ${n}, but list elements ${this.elementDtype}`);if(t<0||t>this.tensors.length)throw new Error(`Trying to access element ${t} in a list with ${this.tensors.length} elements.`);if(null==this.tensors[t])throw new Error(`element at index ${t} is null.`);d(this.tensors[t].shape,e,"TensorList shape mismatch: ");const r=f(this.elementShape,this.tensors,e);return Object(i._137)(this.tensors[t],r)}setItem(t,e){if(e.dtype!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e.dtype}, but list elements ${this.elementDtype}`);if(t<0||-1!==this.maxNumElements&&t>=this.maxNumElements)throw new Error(`Trying to set element ${t} in a list with max ${this.maxNumElements} elements.`);d(this.elementShape,e.shape,"TensorList shape mismatch: "),Object(i._132)(e),this.tensors[t]=e}gather(t,e,n){if(e!==this.elementDtype)throw new Error(`Invalid data types; op elements ${e}, but list elements ${this.elementDtype}`);d(this.elementShape,n,"TensorList shape mismatch: "),t=t.slice(0,this.size());const r=f(this.elementShape,this.tensors,n);return 0===t.length?Object(i._146)([],[0].concat(r)):Object(i._149)(()=>{const e=t.map(t=>Object(i._137)(this.tensors[t],r));return Object(i._143)(e,0)})}concat(t,e){if(t&&t!==this.elementDtype)throw new Error(`TensorList dtype is ${this.elementDtype} but concat requested dtype ${t}`);d(this.elementShape,e,"TensorList shape mismatch: ");const n=f(this.elementShape,this.tensors,e);return 0===this.size()?Object(i._146)([],[0].concat(n)):Object(i._149)(()=>{const t=this.tensors.map(t=>Object(i._137)(t,n));return Object(i._122)(t,0)})}} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ const v=async(t,e,n)=>{switch(t.op){case"If":case"StatelessIf":{const r=Object(s.d)("thenBranch",t,e,n),i=Object(s.d)("elseBranch",t,e,n),o=Object(s.d)("cond",t,e,n),a=Object(s.d)("args",t,e,n);return(await o.data())[0]?n.functionMap[r].executeFunctionAsync(a,n.tensorArrayMap,n.tensorListMap):n.functionMap[i].executeFunctionAsync(a,n.tensorArrayMap,n.tensorListMap)}case"While":case"StatelessWhile":{const r=Object(s.d)("body",t,e,n),i=Object(s.d)("cond",t,e,n),o=Object(s.d)("args",t,e,n),a=await n.functionMap[i].executeFunctionAsync(o,n.tensorArrayMap,n.tensorListMap),l=o.map(t=>t.id);let u=await a[0].data();a.forEach(t=>{t.kept||-1!==l.indexOf(t.id)||t.dispose()});let c=o;for(;u[0];){const t=c,e=(c=await n.functionMap[r].executeFunctionAsync(c,n.tensorArrayMap,n.tensorListMap)).map(t=>t.id);t.forEach(t=>{t.kept||-1!==l.indexOf(t.id)||-1!==e.indexOf(t.id)||t.dispose()});const o=await n.functionMap[i].executeFunctionAsync(c,n.tensorArrayMap,n.tensorListMap);u=await o[0].data(),o.forEach(t=>{t.kept||-1!==l.indexOf(t.id)||-1!==e.indexOf(t.id)||t.dispose()})}return c}case"LoopCond":{const r=Object(s.d)("pred",t,e,n);return[Object(s.a)(r)]}case"Switch":{const r=Object(s.d)("pred",t,e,n);let i=Object(s.d)("data",t,e,n);return i.kept||(i=Object(s.a)(i)),(await r.data())[0]?[void 0,i]:[i,void 0]}case"Merge":{const r=t.inputNames.find(t=>void 0!==Object(s.e)(t,e,n));if(r){const t=Object(s.e)(r,e,n);return[Object(s.a)(t)]}return}case"Enter":{const r=Object(s.d)("frameName",t,e,n),i=Object(s.d)("tensor",t,e,n);return n.enterFrame(r),[Object(s.a)(i)]}case"Exit":{const r=Object(s.d)("tensor",t,e,n);return n.exitFrame(),[Object(s.a)(r)]}case"NextIteration":{const r=Object(s.d)("tensor",t,e,n);return n.nextIteration(),[Object(s.a)(r)]}case"TensorArrayV3":{const r=Object(s.d)("size",t,e,n),o=Object(s.d)("dtype",t,e,n),a=Object(s.d)("elementShape",t,e,n),l=Object(s.d)("dynamicSize",t,e,n),u=Object(s.d)("clearAfterRead",t,e,n),c=Object(s.d)("identicalElementShapes",t,e,n),h=new class{constructor(t,e,n,r,o,s,a){this.name=t,this.dtype=e,this.maxSize=n,this.elementShape=r,this.identicalElementShapes=o,this.dynamicSize=s,this.clearAfterRead=a,this.tensors=[],this.closed_=!1,this.idTensor=Object(i._138)(0),Object(i._132)(this.idTensor)}get id(){return this.idTensor.id}get closed(){return this.closed_}clearAndClose(t){this.tensors.forEach(e=>{null!=t&&t.has(e.tensor.id)||e.tensor.dispose()}),this.tensors=[],this.closed_=!0,this.idTensor.dispose()}size(){return this.tensors.length}read(t){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(t<0||t>=this.size())throw new Error(`Tried to read from index ${t}, but array size is: ${this.size()}`);const e=this.tensors[t];if(e.cleared)throw new Error(`TensorArray ${this.name}: Could not read index ${t} twice because it was cleared after a previous read `+"(perhaps try setting clear_after_read = false?).");return this.clearAfterRead&&(e.cleared=!0),e.read=!0,e.tensor}readMany(t){return t.map(t=>this.read(t))}write(t,e){if(this.closed_)throw new Error(`TensorArray ${this.name} has already been closed.`);if(t<0||!this.dynamicSize&&t>=this.maxSize)throw new Error(`Tried to write to index ${t}, but array is not resizeable and size is: ${this.maxSize}`);const n=this.tensors[t]||{};if(e.dtype!==this.dtype)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${t},\n because the value dtype is ${e.dtype}, but TensorArray dtype is ${this.dtype}.`);if(0!==this.size()||null!=this.elementShape&&0!==this.elementShape.length||(this.elementShape=e.shape),d(this.elementShape,e.shape,`TensorArray ${this.name}: Could not write to TensorArray index ${t}.`),n.read)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${t}, because it has already been read.`);if(n.written)throw new Error(`TensorArray ${this.name}: Could not write to TensorArray index ${t}, because it has already been written.`);n.tensor=e,Object(i._132)(e),n.written=!0,this.tensors[t]=n}writeMany(t,e){if(t.length!==e.length)throw new Error(`TensorArray ${this.name}: could not write multiple tensors,`+`because the index size: ${t.length} is not the same as tensors size: ${e.length}.`);t.forEach((t,n)=>this.write(t,e[n]))}gather(t,e){if(e&&e!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but gather requested dtype ${e}`);if(t)t=t.slice(0,this.size());else{t=[];for(let e=0;e=this.maxSize)throw new Error(`Max index must be < array size (${n} vs. ${this.maxSize})`);this.writeMany(t,Object(i._150)(e,0))}split(t,e){if(e.dtype!==this.dtype)throw new Error(`TensorArray dtype is ${this.dtype} but tensor has dtype ${e.dtype}`);let n=0;const r=t.map(t=>n+=t);if(n!==e.shape[0])throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${n}, and tensor's shape is: ${e.shape}`);if(!this.dynamicSize&&t.length!==this.maxSize)throw new Error(`TensorArray's size is not equal to the size of lengths (${this.maxSize} vs. ${t.length}), `+"and the TensorArray is not marked as dynamically resizeable");const o=0===n?0:e.size/n,s=[];Object(i._149)(()=>{e=Object(i._137)(e,[1,n,o]);for(let n=0;n=r)throw new Error(`Max index must be < array size (${o} vs. ${r})`);const s=new m([],n,t.dtype,r),a=Object(i._150)(t,0);return e.forEach((t,e)=>{s.setItem(t,a[e])}),s}(Object(s.d)("tensor",t,e,n),r,Object(s.d)("elementShape",t,e,n),Object(s.d)("numElements",t,e,n));return n.addTensorList(o),[o.idTensor]}case"TensorListReserve":case"EmptyTensorList":{const r=Object(s.d)("elementShape",t,e,n),i=Object(s.d)("elementDType",t,e,n);let o;o="TensorListReserve"===t.op?"numElements":"maxNumElements";const a=Object(s.d)(o,t,e,n),l=new m([],r,i,a);return n.addTensorList(l),[l.idTensor]}case"TensorListGather":{const r=Object(s.d)("tensorListId",t,e,n),i=Object(s.d)("indices",t,e,n),o=Object(s.d)("elementShape",t,e,n),a=Object(s.d)("elementDType",t,e,n);return[n.getTensorList(r.id).gather(i,a,o)]}case"TensorListStack":{const r=Object(s.d)("tensorListId",t,e,n),i=Object(s.d)("elementShape",t,e,n),o=Object(s.d)("elementDType",t,e,n),a=Object(s.d)("numElements",t,e,n);return[n.getTensorList(r.id).stack(i,o,a)]}case"TensorListFromTensor":{const r=function(t,e,n){const r=t.dtype;if(t.shape.length<1)throw new Error(`Tensor must be at least a vector, but saw shape: ${t.shape}`);if(t.dtype!==n)throw new Error(`Invalid data types; op elements ${t.dtype}, but list elements ${n}`);d(t.shape.slice(1),e,"TensorList shape mismatch: ");const o=Object(i._150)(t);return new m(o,e,r)}(Object(s.d)("tensor",t,e,n),Object(s.d)("elementShape",t,e,n),Object(s.d)("elementDType",t,e,n));return n.addTensorList(r),[r.idTensor]}case"TensorListConcat":{const r=Object(s.d)("tensorListId",t,e,n),i=n.getTensorList(r.id),o=Object(s.d)("dtype",t,e,n),a=Object(s.d)("elementShape",t,e,n);return[i.concat(o,a)]}case"TensorListPushBack":{const r=Object(s.d)("tensorListId",t,e,n),i=Object(s.d)("tensor",t,e,n),o=n.getTensorList(r.id);return o.pushBack(i),[o.idTensor]}case"TensorListPopBack":{const r=Object(s.d)("tensorListId",t,e,n),i=Object(s.d)("elementShape",t,e,n),o=Object(s.d)("elementDType",t,e,n);return[n.getTensorList(r.id).popBack(i,o)]}case"TensorListSplit":{const r=Object(s.d)("tensor",t,e,n),o=Object(s.d)("elementShape",t,e,n),a=function(t,e,n){let r=0;const o=e.map(t=>r+=t);if(r!==t.shape[0])throw new Error(`Expected sum of lengths to be equal to\n tensor.shape[0], but sum of lengths is\n ${r}, and tensor's shape is: ${t.shape}`);const s=g(t.shape.slice(1),n),a=0===r?0:t.size/r,l=Object(i._149)(()=>{const n=[];t=Object(i._137)(t,[1,r,a]);for(let r=0;r{switch(t.op){case"Conv1D":{const r=Object(s.d)("stride",t,e,n),i=Object(s.d)("pad",t,e,n),o=Object(s.d)("dataFormat",t,e,n).toUpperCase(),a=Object(s.d)("dilation",t,e,n);return[u.C(Object(s.d)("x",t,e,n),Object(s.d)("filter",t,e,n),r,i,o,a)]}case"Conv2D":{const r=Object(s.d)("strides",t,e,n),i=Object(s.c)(t,e,n),o=Object(s.d)("dataFormat",t,e,n).toUpperCase(),a=Object(s.d)("dilations",t,e,n);return[u.D(Object(s.d)("x",t,e,n),Object(s.d)("filter",t,e,n),[r[1],r[2]],i,o,[a[1],a[2]])]}case"_FusedConv2D":{const{stride:r,pad:i,dataFormat:o,dilations:a,biasArg:l,preluArg:c,activationFunc:h,leakyreluAlpha:d}=b(t,e,n);return[u._0.conv2d({x:Object(s.d)("x",t,e,n),filter:Object(s.d)("filter",t,e,n),strides:[r[1],r[2]],pad:i,dataFormat:o,dilations:[a[1],a[2]],bias:l,activation:h,preluActivationWeights:c,leakyreluAlpha:d})]}case"FusedDepthwiseConv2dNative":{const{stride:r,pad:i,dataFormat:o,dilations:a,biasArg:l,preluArg:c,activationFunc:h,leakyreluAlpha:d}=b(t,e,n);return[u._0.depthwiseConv2d({x:Object(s.d)("x",t,e,n),filter:Object(s.d)("filter",t,e,n),strides:[r[1],r[2]],pad:i,dataFormat:o,dilations:[a[1],a[2]],bias:l,activation:h,preluActivationWeights:c,leakyreluAlpha:d})]}case"Conv2DBackpropInput":case"Conv2dTranspose":{const r=Object(s.d)("outputShape",t,e,n),i=Object(s.d)("strides",t,e,n),o=Object(s.c)(t,e,n);return[u.E(Object(s.d)("x",t,e,n),Object(s.d)("filter",t,e,n),r,[i[1],i[2]],o)]}case"DepthwiseConv2dNative":case"DepthwiseConv2d":{const r=Object(s.d)("strides",t,e,n),i=Object(s.c)(t,e,n),o=Object(s.d)("dilations",t,e,n),a=Object(s.d)("dataFormat",t,e,n).toUpperCase();return[u.L(Object(s.d)("input",t,e,n),Object(s.d)("filter",t,e,n),[r[1],r[2]],i,a,[o[1],o[2]])]}case"Conv3D":{const r=Object(s.d)("strides",t,e,n),i=Object(s.d)("pad",t,e,n),o=Object(s.d)("dataFormat",t,e,n).toUpperCase(),a=Object(s.d)("dilations",t,e,n);return[u.F(Object(s.d)("x",t,e,n),Object(s.d)("filter",t,e,n),[r[1],r[2],r[3]],i,o,[a[1],a[2],a[3]])]}case"AvgPool":{const r=Object(s.d)("strides",t,e,n),i=Object(s.d)("pad",t,e,n),o=Object(s.d)("kernelSize",t,e,n);return[u.o(Object(s.d)("x",t,e,n),[o[1],o[2]],[r[1],r[2]],i)]}case"MaxPool":{const r=Object(s.d)("strides",t,e,n),i=Object(s.d)("pad",t,e,n),o=Object(s.d)("kernelSize",t,e,n);return[u._23(Object(s.d)("x",t,e,n),[o[1],o[2]],[r[1],r[2]],i)]}case"MaxPoolWithArgmax":{const r=Object(s.d)("strides",t,e,n),i=Object(s.d)("pad",t,e,n),o=Object(s.d)("kernelSize",t,e,n),a=Object(s.d)("includeBatchInIndex",t,e,n),{result:l,indexes:c}=u._25(Object(s.d)("x",t,e,n),[o[1],o[2]],[r[1],r[2]],i,a);return[l,c]}case"AvgPool3D":{const r=Object(s.d)("strides",t,e,n),i=Object(s.d)("pad",t,e,n),o=Object(s.d)("kernelSize",t,e,n);return[u.p(Object(s.d)("x",t,e,n),[o[1],o[2],o[3]],[r[1],r[2],r[3]],i)]}case"MaxPool3D":{const r=Object(s.d)("strides",t,e,n),i=Object(s.d)("pad",t,e,n),o=Object(s.d)("kernelSize",t,e,n);return[u._24(Object(s.d)("x",t,e,n),[o[1],o[2],o[3]],[r[1],r[2],r[3]],i)]}case"Dilation2D":{const r=Object(s.d)("strides",t,e,n),i=Object(s.d)("pad",t,e,n),o=Object(s.d)("dilations",t,e,n),a=r[1],l=r[2],c=o[1],h=o[2];return[u.M(Object(s.d)("x",t,e,n),Object(s.d)("filter",t,e,n),[a,l],i,[c,h],"NHWC")]}default:throw TypeError(`Node type ${t.op} is not implemented`)}},y=(t,e,n)=>{switch(t.op){case"Fill":{const r=Object(s.d)("shape",t,e,n),i=Object(s.d)("dtype",t,e,n),o=Object(s.d)("value",t,e,n);return[u.X(r,o,i)]}case"LinSpace":{const r=Object(s.d)("start",t,e,n),i=Object(s.d)("stop",t,e,n),o=Object(s.d)("num",t,e,n);return[u._13(r,i,o)]}case"Multinomial":{const r=Object(s.d)("logits",t,e,n),i=Object(s.d)("numSamples",t,e,n),o=Object(s.d)("seed",t,e,n);return[u._33(r,i,o)]}case"OneHot":{const r=Object(s.d)("indices",t,e,n),i=Object(s.d)("depth",t,e,n),o=Object(s.d)("onValue",t,e,n),a=Object(s.d)("offValue",t,e,n);return[u._36(r,i,o,a)]}case"Ones":return[u._37(Object(s.d)("shape",t,e,n),Object(s.d)("dtype",t,e,n))];case"OnesLike":return[u._38(Object(s.d)("x",t,e,n))];case"RandomUniform":return[u._43(Object(s.d)("shape",t,e,n),Object(s.d)("minval",t,e,n),Object(s.d)("maxval",t,e,n),Object(s.d)("dtype",t,e,n))];case"Range":{const r=Object(s.d)("start",t,e,n),i=Object(s.d)("stop",t,e,n),o=Object(s.d)("step",t,e,n);return[u._44(r,i,o,Object(s.d)("dtype",t,e,n))]}case"TruncatedNormal":{const r=Object(s.d)("shape",t,e,n),i=Object(s.d)("mean",t,e,n),o=Object(s.d)("stdDev",t,e,n),a=Object(s.d)("seed",t,e,n);return[u._86(r,i,o,Object(s.d)("dtype",t,e,n),a)]}case"Zeros":return[u._91(Object(s.d)("shape",t,e,n),Object(s.d)("dtype",t,e,n))];case"ZerosLike":return[u._92(Object(s.d)("x",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}}; /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function T(t,e,n){return{boxes:Object(s.d)("boxes",t,e,n),scores:Object(s.d)("scores",t,e,n),maxOutputSize:Object(s.d)("maxOutputSize",t,e,n),iouThreshold:Object(s.d)("iouThreshold",t,e,n),scoreThreshold:Object(s.d)("scoreThreshold",t,e,n),softNmsSigma:Object(s.d)("softNmsSigma",t,e,n)}}const E=async(t,e,n)=>{switch(t.op){case"NonMaxSuppressionV5":{const{boxes:r,scores:i,maxOutputSize:o,iouThreshold:s,scoreThreshold:a,softNmsSigma:l}=T(t,e,n),c=await u._7.nonMaxSuppressionWithScoreAsync(r,i,o,s,a,l);return[c.selectedIndices,c.selectedScores]}case"NonMaxSuppressionV4":{const{boxes:r,scores:i,maxOutputSize:o,iouThreshold:a,scoreThreshold:l}=T(t,e,n),c=Object(s.d)("padToMaxOutputSize",t,e,n),h=await u._7.nonMaxSuppressionPaddedAsync(r,i,o,a,l,c);return[h.selectedIndices,h.validOutputs]}case"NonMaxSuppressionV3":case"NonMaxSuppressionV2":{const{boxes:r,scores:i,maxOutputSize:o,iouThreshold:s,scoreThreshold:a}=T(t,e,n);return[await u._7.nonMaxSuppressionAsync(r,i,o,s,a)]}case"Where":{const r=u.w(Object(s.d)("condition",t,e,n),"bool"),i=[await u._90(r)];return r.dispose(),i}case"ListDiff":return u._57(Object(s.d)("x",t,e,n),Object(s.d)("y",t,e,n));default:throw TypeError(`Node type ${t.op} is not implemented`)}},x=(t,e,n)=>{switch(t.op){case"TopKV2":{const r=Object(s.d)("x",t,e,n),i=Object(s.d)("k",t,e,n),o=Object(s.d)("sorted",t,e,n),a=u._84(r,i,o);return[a.values,a.indices]}case"Unique":{const r=Object(s.d)("x",t,e,n),i=u._87(r);return[i.values,i.indices]}case"UniqueV2":{const r=Object(s.d)("x",t,e,n),i=Object(s.d)("axis",t,e,n),o=u._87(r,i);return[o.values,o.indices]}default:throw TypeError(`Node type ${t.op} is not implemented`)}},w=(t,e,n)=>{switch(t.op){case"Const":return e[t.name];case"PlaceholderWithDefault":const r=Object(s.d)("default",t,e,n);return[Object(s.e)(t.name,e,n)||r];case"Placeholder":return[Object(s.e)(t.name,e,n)];case"Identity":case"StopGradient":case"FakeQuantWithMinMaxVars":{const r=Object(s.d)("x",t,e,n);return[Object(s.a)(r)]}case"IdentityN":return Object(s.d)("x",t,e,n).map(t=>Object(s.a)(t));case"Snapshot":const i=Object(s.d)("x",t,e,n);return[Object(s.a)(i)];case"Shape":return[u._81(Object(s.d)("x",t,e,n).shape,"int32")];case"ShapeN":return Object(s.d)("x",t,e,n).map(t=>u._81(t.shape));case"Size":return[u._54(Object(s.d)("x",t,e,n).size,"int32")];case"Rank":return[u._54(Object(s.d)("x",t,e,n).rank,"int32")];case"NoOp":return[u._54(1)];case"Print":const o=Object(s.d)("x",t,e,n),a=Object(s.d)("data",t,e,n),l=Object(s.d)("message",t,e,n),c=Object(s.d)("summarize",t,e,n);console.warn("The graph has a tf.print() operation,usually used for debugging, which slows down performance."),console.log(l);for(let t=0;t{switch(t.op){case"HashTable":case"HashTableV2":{const o=new /** * @license * Copyright 2020 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ class{constructor(t,e){this.keyDType=t,this.valueDType=e,this.handle=Object(i._138)(0),this.tensorMap=new Map,Object(i._132)(this.handle)}get id(){return this.handle.id}clearAndClose(){this.tensorMap.forEach(t=>t.dispose()),this.tensorMap.clear(),this.handle.dispose()}size(){return this.tensorMap.size}tensorSize(){return u._54(this.size(),"int32")}async import(t,e){this.checkKeyAndValueTensor(t,e);const n=await t.data();return this.tensorMap.forEach(t=>t.dispose()),this.tensorMap.clear(),Object(i._149)(()=>{const t=Object(i._150)(e),r=n.length,o=t.length;i._152.assert(r===o,()=>"The number of elements doesn't match, keys has "+`${r} elements, the values has ${o} `+"elements.");for(let e=0;e{const t=[];for(let r=0;r{switch(t.op){case"ResizeBilinear":{const r=Object(s.d)("images",t,e,n),i=Object(s.d)("size",t,e,n),o=Object(s.d)("alignCorners",t,e,n),a=Object(s.d)("halfPixelCenters",t,e,n);return[u._7.resizeBilinear(r,[i[0],i[1]],o,a)]}case"ResizeNearestNeighbor":{const r=Object(s.d)("images",t,e,n),i=Object(s.d)("size",t,e,n),o=Object(s.d)("alignCorners",t,e,n),a=Object(s.d)("halfPixelCenters",t,e,n);return[u._7.resizeNearestNeighbor(r,[i[0],i[1]],o,a)]}case"CropAndResize":{const r=Object(s.d)("image",t,e,n),i=Object(s.d)("boxes",t,e,n),o=Object(s.d)("boxInd",t,e,n),a=Object(s.d)("cropSize",t,e,n),l=Object(s.d)("method",t,e,n),c=Object(s.d)("extrapolationValue",t,e,n);return[u._7.cropAndResize(r,i,o,a,l,c)]}default:throw TypeError(`Node type ${t.op} is not implemented`)}},k=(t,e,n)=>{switch(t.op){case"Equal":return[u.R(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"NotEqual":return[u._35(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"Greater":return[u._3(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"GreaterEqual":return[u._4(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"Less":return[u._11(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"LessEqual":return[u._12(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"LogicalAnd":return[u._18(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"LogicalNot":return[u._19(Object(s.d)("a",t,e,n))];case"LogicalOr":return[u._20(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];case"Select":case"SelectV2":return[u._89(Object(s.d)("condition",t,e,n),Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}},O=(t,e,n)=>{switch(t.op){case"BatchMatMul":case"BatchMatMulV2":case"MatMul":return[u._21(Object(s.d)("a",t,e,n),Object(s.d)("b",t,e,n),Object(s.d)("transposeA",t,e,n),Object(s.d)("transposeB",t,e,n))];case"Einsum":return[u.P(Object(s.d)("equation",t,e,n),...Object(s.d)("tensors",t,e,n))];case"Transpose":return[u._85(Object(s.d)("x",t,e,n),Object(s.d)("perm",t,e,n))];case"_FusedMatMul":const[r,i]=Object(s.d)("fusedOps",t,e,n),o="biasadd"===r,a="prelu"===i,l=Object(s.d)("numArgs",t,e,n),c=Object(s.d)("leakyreluAlpha",t,e,n);if(o){if(a&&2!==l)throw new Error("Fused MatMul with BiasAdd and Prelu must have two extra arguments: bias and alpha.");if(!a&&1!==l)throw new Error("Fused MatMul with BiasAdd must have one extra argument: bias.")}const[h,d]=Object(s.d)("args",t,e,n);return[u._0.matMul({a:Object(s.d)("a",t,e,n),b:Object(s.d)("b",t,e,n),transposeA:Object(s.d)("transposeA",t,e,n),transposeB:Object(s.d)("transposeB",t,e,n),bias:h,activation:i,preluActivationWeights:d,leakyreluAlpha:c})];default:throw TypeError(`Node type ${t.op} is not implemented`)}},I=(t,e,n)=>{switch(t.op){case"FusedBatchNorm":case"FusedBatchNormV2":case"FusedBatchNormV3":return[u.q(Object(s.d)("x",t,e,n),Object(s.d)("mean",t,e,n),Object(s.d)("variance",t,e,n),Object(s.d)("offset",t,e,n),Object(s.d)("scale",t,e,n),Object(s.d)("epsilon",t,e,n))];case"LRN":return[u._14(Object(s.d)("x",t,e,n),Object(s.d)("radius",t,e,n),Object(s.d)("bias",t,e,n),Object(s.d)("alpha",t,e,n),Object(s.d)("beta",t,e,n))];case"Softmax":return[u._63(Object(s.d)("x",t,e,n))];case"LogSoftmax":return[u._17(Object(s.d)("x",t,e,n))];case"SparseToDense":return[u._67(Object(s.d)("sparseIndices",t,e,n),Object(s.d)("outputShape",t,e,n),Object(s.d)("sparseValues",t,e,n),Object(s.d)("defaultValue",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}},R=(t,e,n)=>{switch(t.op){case"Max":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("keepDims",t,e,n);return[u._22(Object(s.d)("x",t,e,n),r,i)]}case"Mean":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("keepDims",t,e,n);return[u._27(Object(s.d)("x",t,e,n),r,i)]}case"Min":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("keepDims",t,e,n);return[u._28(Object(s.d)("x",t,e,n),r,i)]}case"Sum":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("keepDims",t,e,n);return[u._77(Object(s.d)("x",t,e,n),r,i)]}case"All":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("keepDims",t,e,n);return[u.f(Object(s.d)("x",t,e,n),r,i)]}case"Any":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("keepDims",t,e,n);return[u.g(Object(s.d)("x",t,e,n),r,i)]}case"ArgMax":{const r=Object(s.d)("axis",t,e,n);return[u.h(Object(s.d)("x",t,e,n),r)]}case"ArgMin":{const r=Object(s.d)("axis",t,e,n);return[u.i(Object(s.d)("x",t,e,n),r)]}case"Prod":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("keepDims",t,e,n);return[u._42(Object(s.d)("x",t,e,n),r,i)]}case"Cumsum":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("exclusive",t,e,n),o=Object(s.d)("reverse",t,e,n);return[u.I(Object(s.d)("x",t,e,n),r,i,o)]}case"Bincount":const r=Object(s.d)("x",t,e,n),i=Object(s.d)("weights",t,e,n),o=Object(s.d)("size",t,e,n);return[u.s(r,i,o)];case"DenseBincount":{const r=Object(s.d)("x",t,e,n),i=Object(s.d)("weights",t,e,n),o=Object(s.d)("size",t,e,n),a=Object(s.d)("binaryOutput",t,e,n);return[u.J(r,i,o,a)]}default:throw TypeError(`Node type ${t.op} is not implemented`)}},A=(t,e,n)=>{switch(t.op){case"ConcatV2":case"Concat":{const r=Object(s.d)("n",t,e,n),i=Object(s.d)("axis",t,e,n);let o=Object(s.d)("tensors",t,e,n);return o=o.slice(0,r),[u.B(o,i)]}case"Gather":{const r=Object(s.d)("x",t,e,n),i=Object(s.d)("indices",t,e,n);return[u._1(r,u.w(i,"int32"),0)]}case"GatherV2":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("batchDims",t,e,n),o=Object(s.d)("x",t,e,n),a=Object(s.d)("indices",t,e,n);return[u._1(o,u.w(a,"int32"),r,i)]}case"Reverse":{const r=Object(s.d)("dims",t,e,n),i=[];for(let t=0;t{const r=Object(s.d)("axis",t,e,n),o=Object(s.d)("tensors",t,e,n),a=o[0].shape,l=u._72(o[0]).shape,c=o.map(t=>{const e=i._152.arraysEqual(t.shape,a);if(!e&&!i._152.arraysEqual(u._72(t).shape,l))throw new Error("the input tensors shape does not match");return e?t:u._49(t,a)});return[u._73(c,r)]});case"Unpack":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("tensor",t,e,n);return u._88(i,r)}case"Tile":{const r=Object(s.d)("reps",t,e,n);return[u._83(Object(s.d)("x",t,e,n),r)]}case"Split":case"SplitV":{const r=Object(s.d)("axis",t,e,n),i=Object(s.d)("numOrSizeSplits",t,e,n),o=Object(s.d)("x",t,e,n);return u._68(o,i,r)}case"ScatterNd":{const r=Object(s.d)("indices",t,e,n),i=Object(s.d)("values",t,e,n),o=Object(s.d)("shape",t,e,n);return[u._55(r,i,o)]}case"GatherNd":{const r=Object(s.d)("x",t,e,n),i=Object(s.d)("indices",t,e,n);return[u._2(r,i)]}case"SparseToDense":{const r=Object(s.d)("sparseIndices",t,e,n),i=Object(s.d)("outputShape",t,e,n),o=Object(s.d)("sparseValues",t,e,n),a=Object(s.d)("defaultValue",t,e,n);return[u._67(r,o,i,o.dtype===a.dtype?a:u.w(a,o.dtype))]}default:throw TypeError(`Node type ${t.op} is not implemented`)}},N=(t,e,n)=>{switch(t.op){case"SparseFillEmptyRows":{const{outputIndices:r,outputValues:i,emptyRowIndicator:o,reverseIndexMap:a}=u._66.sparseFillEmptyRows(Object(s.d)("indices",t,e,n),Object(s.d)("values",t,e,n),Object(s.d)("denseShape",t,e,n),Object(s.d)("defaultValue",t,e,n));return[r,i,o,a]}case"SparseReshape":{const{outputIndices:r,outputShape:i}=u._66.sparseReshape(Object(s.d)("inputIndices",t,e,n),Object(s.d)("inputShape",t,e,n),Object(s.d)("newShape",t,e,n));return[r,i]}case"SparseSegmentMean":return[u._66.sparseSegmentMean(Object(s.d)("data",t,e,n),Object(s.d)("indices",t,e,n),Object(s.d)("segmentIds",t,e,n))];case"SparseSegmentSum":return[u._66.sparseSegmentSum(Object(s.d)("data",t,e,n),Object(s.d)("indices",t,e,n),Object(s.d)("segmentIds",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}},D=(t,e,n)=>{switch(t.op){case"FFT":return[u.W(Object(s.d)("x",t,e,n))];case"IFFT":return[u._5(Object(s.d)("x",t,e,n))];case"RFFT":return[u._51(Object(s.d)("x",t,e,n))];case"IRFFT":return[u._8(Object(s.d)("x",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}},M=(t,e,n)=>{switch(t.op){case"StringNGrams":{const{nGrams:r,nGramsSplits:i}=u._75.stringNGrams(Object(s.d)("data",t,e,n),Object(s.d)("dataSplits",t,e,n),Object(s.d)("separator",t,e,n),Object(s.d)("nGramWidths",t,e,n),Object(s.d)("leftPad",t,e,n),Object(s.d)("rightPad",t,e,n),Object(s.d)("padWidth",t,e,n),Object(s.d)("preserveShortSequences",t,e,n));return[r,i]}case"StringSplit":{const{indices:r,values:i,shape:o}=u._75.stringSplit(Object(s.d)("input",t,e,n),Object(s.d)("delimiter",t,e,n),Object(s.d)("skipEmpty",t,e,n));return[r,i,o]}case"StringToHashBucketFast":return[u._75.stringToHashBucketFast(Object(s.d)("input",t,e,n),Object(s.d)("numBuckets",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}},L=(t,e,n)=>{switch(t.op){case"Cast":return[u.w(Object(s.d)("x",t,e,n),Object(s.d)("dtype",t,e,n))];case"ExpandDims":{const r=Object(s.d)("axis",t,e,n);return[u.U(Object(s.d)("x",t,e,n),r)]}case"Squeeze":{const r=Object(s.d)("axis",t,e,n);return[u._72(Object(s.d)("x",t,e,n),r)]}case"Reshape":return[u._49(Object(s.d)("x",t,e,n),Object(s.d)("shape",t,e,n))];case"MirrorPad":return[u._30(Object(s.d)("x",t,e,n),Object(s.d)("padding",t,e,n),Object(s.d)("mode",t,e,n))];case"PadV2":case"Pad":return[u._39(Object(s.d)("x",t,e,n),Object(s.d)("padding",t,e,n),Object(s.d)("constantValue",t,e,n))];case"SpaceToBatchND":{const r=Object(s.d)("blockShape",t,e,n),i=Object(s.d)("paddings",t,e,n);return[u._65(Object(s.d)("x",t,e,n),r,i)]}case"BatchToSpaceND":{const r=Object(s.d)("blockShape",t,e,n),i=Object(s.d)("crops",t,e,n);return[u.r(Object(s.d)("x",t,e,n),r,i)]}case"DepthToSpace":{const r=Object(s.d)("blockSize",t,e,n),i=Object(s.d)("dataFormat",t,e,n).toUpperCase();return[u.K(Object(s.d)("x",t,e,n),r,i)]}case"BroadcastTo":return[u.u(Object(s.d)("x",t,e,n),Object(s.d)("shape",t,e,n))];case"BroadcastArgs":return[u.t(Object(s.d)("s0",t,e,n),Object(s.d)("s1",t,e,n))];default:throw TypeError(`Node type ${t.op} is not implemented`)}}; /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ function P(t,e,n,r){const o=((t,e,n)=>{switch(t.category){case"arithmetic":return i._149(()=>c(t,e,n));case"basic_math":return i._149(()=>h(t,e,n));case"control":return v(t,e,n);case"convolution":return i._149(()=>_(t,e,n));case"creation":return i._149(()=>y(t,e,n));case"dynamic":return E(t,e,n);case"evaluation":return i._149(()=>x(t,e,n));case"image":return i._149(()=>S(t,e,n));case"graph":return i._149(()=>w(t,e,n));case"logical":return i._149(()=>k(t,e,n));case"matrices":return i._149(()=>O(t,e,n));case"normalization":return i._149(()=>I(t,e,n));case"reduction":return i._149(()=>R(t,e,n));case"slice_join":return i._149(()=>A(t,e,n));case"sparse":return i._149(()=>N(t,e,n));case"spectral":return i._149(()=>D(t,e,n));case"string":return i._149(()=>M(t,e,n));case"transformation":return i._149(()=>L(t,e,n));case"hash_table":return C(t,e,n,r);case"custom":const o=Object(l.a)(t.op);if(o&&o.customExecutor)return o.customExecutor(new a(t,e,n));throw TypeError(`Custom op ${t.op} is not registered.`);default:throw TypeError(`Unknown op '${t.op}'. File an issue at `+"https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()")}})(t,e,n);return i._152.isPromise(o)?o.then(t=>[].concat(t)):[].concat(o)}class F{constructor(t={},e={},n={},r={}){this.weightMap=t,this.tensorArrayMap=e,this.tensorListMap=n,this.functionMap=r,this.rootContext={id:0,frameName:"",iterationId:0},this.contexts=[this.rootContext],this.lastId=0,this.generateCurrentContextIds()}newFrame(t,e){return{id:t,frameName:e,iterationId:0}}set currentContext(t){this.contexts!==t&&(this.contexts=t,this.generateCurrentContextIds())}get currentContext(){return this.contexts}get currentContextId(){return this._currentContextIds[0]}get currentContextIds(){return this._currentContextIds}generateCurrentContextIds(){const t=[];for(let e=0;e0===t.id&&0===t.iterationId?"":`${t.frameName}-${t.iterationId}`).join("/"):""}enterFrame(t){this.contexts&&(this.lastId++,this.contexts=this.contexts.slice(),this.contexts.push(this.newFrame(this.lastId,t)),this._currentContextIds.unshift(this.contextIdforContexts(this.contexts)))}exitFrame(){if(!(this.contexts&&this.contexts.length>1))throw new Error("Cannot exit frame, the context is empty");this.contexts=this.contexts.slice(),this.contexts.splice(-1),this.currentContextIds.shift()}nextIteration(){if(!(this.contexts&&this.contexts.length>0))throw new Error("Cannot increase frame iteration, the context is empty");{this.contexts=this.contexts.slice(),this.lastId++;const t=Object.assign({},this.contexts[this.contexts.length-1]);t.iterationId+=1,t.id=this.lastId,this.contexts.splice(-1,1,t),this._currentContextIds.splice(0,1,this.contextIdforContexts(this.contexts))}}getWeight(t){return this.weightMap[t]}addTensorArray(t){this.tensorArrayMap[t.id]=t}getTensorArray(t){return this.tensorArrayMap[t]}addTensorList(t){this.tensorListMap[t.id]=t}getTensorList(t){return this.tensorListMap[t]}dispose(t){for(const e in this.tensorArrayMap)this.tensorArrayMap[e].clearAndClose(t);for(const e in this.tensorListMap)this.tensorListMap[e].clearAndClose(t)}} /** * @license * Copyright 2019 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */function B(t,e,n,r){const i=new Set,o=[];let a=null,l=null;const u=new Set,c=Object.keys(t).map(t=>Object(s.g)(t)[0]);let h=[];null!=r&&(h=r.map(t=>Object(s.g)(t.name)[0]));const d=[...e];for(;d.length>0;){const t=d.pop();(V(t)||(t=t,$.indexOf(t.op)>=0)||W(t))&&null==a&&(l=(a=t).children.map(t=>t.name).filter(t=>i.has(t))),i.add(t.name),null==n[t.name]&&(-1===c.indexOf(t.name)&&-1===h.indexOf(t.name)&&(0!==t.inputs.length?t.inputs.forEach(t=>{u.has(t.name)||(u.add(t.name),d.push(t))}):o.push(t.name)))}var p;return{inputs:t,outputs:e,usedNodes:i,missingInputs:o,dynamicNode:a,syncInputs:l}}const j=["Switch","Merge","Enter","Exit","NextIteration","StatelessIf","StatelessWhile","if","While"],$=["NonMaxSuppressionV2","NonMaxSuppressionV3","NonMaxSuppressionV5","Where"],U=["HashTable","HashTableV2","LookupTableImport","LookupTableImportV2","LookupTableFind","LookupTableFindV2","LookupTableSize","LookupTableSizeV2"];function V(t){return j.indexOf(t.op)>=0}function W(t){return U.indexOf(t.op)>=0} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */class H{constructor(t,e){this.graph=t,this.parent=e,this.compiledMap=new Map,this._weightMap={},this.SEPERATOR=",",this._functions={},this._functionExecutorMap={},this.intermediateTensors={},this.keepTensorForDebug=!1,this._outputs=t.outputs,this._inputs=t.inputs,this._initNodes=t.initNodes,this._signature=t.signature,this._functions=t.functions,null!=t.functions&&Object.keys(t.functions).forEach(e=>{this._functionExecutorMap[e]=new H(t.functions[e],this)})}get weightIds(){return this.parent?this.parent.weightIds:this._weightIds}get functionExecutorMap(){return this.parent?this.parent.functionExecutorMap:this._functionExecutorMap}get weightMap(){return this.parent?this.parent.weightMap:this._weightMap}set weightMap(t){const e=Object.keys(t).map(e=>t[e].map(t=>t.id));this._weightIds=[].concat(...e),this._weightMap=t}set resourceManager(t){this._resourceManager=t}get inputs(){return this._inputs.map(t=>({name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}))}get outputs(){return this._outputs.map(t=>({name:t.name,shape:t.attrParams.shape?t.attrParams.shape.value:void 0,dtype:t.attrParams.dtype?t.attrParams.dtype.value:void 0}))}get inputNodes(){return this._inputs.map(t=>t.signatureKey||t.name)}get outputNodes(){return this._outputs.map(t=>{const e=t.signatureKey||t.name;return t.defaultOutput?`${e}:${t.defaultOutput}`:e})}get functions(){return Object.keys(this._functions).reduce((t,e)=>(t[e]=this._functions[e].signature,t),{})}getCompilationKey(t,e){const n=t.map(t=>t.name).sort(),r=e.map(t=>t.name).sort();return n.join(this.SEPERATOR)+"--"+r.join(this.SEPERATOR)}compile(t,e){const n=B(t,e,this.weightMap,this._initNodes),{missingInputs:r,dynamicNode:i,syncInputs:o}=n;if(null!=i)throw new Error(`This execution contains the node '${i.name}', which has `+`the dynamic op '${i.op}'. Please use `+"model.executeAsync() instead. Alternatively, to avoid the "+`dynamic ops, specify the inputs [${o}]`);if(r.length>0){const n=e.map(t=>t.name),i=Object.keys(t);throw new Error(`Cannot compute the outputs [${n}] from the provided inputs `+`[${i}]. Missing the following inputs: [${r}]`)}return function(t,e,n){const{usedNodes:r,inputs:i}=n,o=[],a=Object.keys(i).map(t=>Object(s.g)(t)[0]).map(e=>t.nodes[e]),l=t.initNodes;a.forEach(t=>{r.has(t.name)&&o.push(t)}),t.weights.forEach(t=>{r.has(t.name)&&o.push(t)}),null!=l&&l.forEach(t=>{r.has(t.name)&&o.push(t)});const u=new Set,c=[];for(;o.length>0;){const t=o.pop();u.add(t.name),e[t.name]||c.push(t),t.children.forEach(t=>{!u.has(t.name)&&r.has(t.name)&&t.inputs.every(t=>u.has(t.name))&&o.push(t)})}return c}(this.graph,this.weightMap,n)}execute(t,e){t=this.mapInputs(t);const n=Object.keys(t).sort();this.checkInputs(t),this.checkInputShapeAndType(t),e=this.mapOutputs(e),this.checkOutputs(e);const r=n.map(t=>this.graph.nodes[Object(s.g)(t)[0]]),o=e.map(t=>Object(s.g)(t)[0]);let a=o.map(t=>this.graph.nodes[t]);this.resetIntermediateTensors(),0===a.length&&(a=this._outputs);const l=this.getCompilationKey(r,a);let u=this.compiledMap.get(l);null==u&&(u=this.compile(t,a),this.compiledMap.set(l,u));const c={},h={};return Object(i._149)(()=>{const n=new F(this.weightMap,c,h,this.functionExecutorMap),r=Object.assign({},this.weightMap);Object.keys(t).forEach(e=>{const[n,i]=Object(s.g)(e),o=[];o[i]=t[e],r[n]=o});const a=this.getFrozenTensorIds(r),l={};for(let t=0;tObject(s.e)(t,r,n))})}getFrozenTensorIds(t){const e=[].concat.apply([],Object.keys(t).map(e=>t[e]).map(t=>t.map(t=>t.id)));return new Set(e)}checkTensorForDisposal(t,e,n,r,i,o,a){"control"!==e.category&&-1===o.indexOf(t)&&(n[t].forEach(t=>{null!=t&&(a[t.id]=(a[t.id]||0)+e.children.length)}),e.inputs.forEach(t=>{if("control"!==t.category){const o=Object(s.f)(t.name,n,r);null!=o&&o.forEach(t=>{if(t&&!t.kept&&!i.has(t.id)){const n=a[t.id];if(1===n){if(this.keepTensorForDebug){const[n,i]=Object(s.b)(e.name,r);this.intermediateTensors[n]?this.intermediateTensors[n][i]=t:(this.intermediateTensors[n]=[],this.intermediateTensors[n][i]=t)}else t.dispose();delete a[t.id]}else null!=n&&a[t.id]--}})}}))}async executeAsync(t,e){return this._executeAsync(t,e)}disposeIntermediateTensors(){this.intermediateTensors&&(Object.keys(this.intermediateTensors).forEach(t=>this.intermediateTensors[t].forEach(t=>t.dispose())),this.disposeTensorsMap())}disposeTensorsMap(){this.tensorsMap&&Object.keys(this.tensorsMap).forEach(t=>{this.tensorsMap[t].forEach(t=>{!t||t.kept||t.isDisposed||this.keepIds.has(t.id)||t.dispose()})})}getIntermediateTensors(){return this.tensorsMap}resetIntermediateTensors(){for(const t in this.intermediateTensors)this.intermediateTensors[t].forEach(t=>t.dispose()),delete this.intermediateTensors[t]}async _executeAsync(t,e,n=!1,r={},o={}){n||(t=this.mapInputs(t),this.checkInputs(t),this.checkInputShapeAndType(t),e=this.mapOutputs(e),this.checkOutputs(e));try{this.keepTensorForDebug=Object(i._127)().getBool("KEEP_INTERMEDIATE_TENSORS")}catch(t){console.warn(t.message)}this.resetIntermediateTensors();const a=new F(this.weightMap,r,o,this.functionExecutorMap);this.tensorsMap=await this.executeWithControlFlow(t,a,e,n);const l=e.map(t=>Object(s.e)(t,this.tensorsMap,a)),u=l.map(t=>t.id),c=Object.keys(t).map(e=>t[e].id);return this.keepIds=new Set([...u,...c,...this.weightIds]),this.keepTensorForDebug||this.disposeTensorsMap(),null==this.parent&&a.dispose(this.keepIds),l}async executeFunctionAsync(t,e,n){const r=t.reduce((t,e,n)=>(t[this.inputs[n].name]=e,t),{});return this._executeAsync(r,this.outputNodes,!0,e,n)}async executeWithControlFlow(t,e,n,r){const i=Object.keys(t),o=i.map(t=>this.graph.nodes[Object(s.g)(t)[0]]),a=n.map(t=>Object(s.g)(t)[0]);let l=a.map(t=>this.graph.nodes[t]);0===l.length&&(l=this._outputs);const{usedNodes:u,missingInputs:c,dynamicNode:h,syncInputs:d}=B(t,l,this.weightMap,this._initNodes),p=[...o,...this.graph.weights,...this._initNodes||[]].map(t=>({node:t,contexts:e.currentContext})),f=Object.assign({},this.weightMap);Object.keys(t).forEach(e=>{const[n,r]=Object(s.g)(e),i=[];i[r]=t[e],f[n]=i});const g={},m=this.getFrozenTensorIds(f),v={};for(;p.length>0;){const t=this.processStack(o,p,e,f,v,m,a,g,u);await Promise.all(t)}null!=h||r||console.warn("This model execution did not contain any nodes with control flow or dynamic output shapes. You can use model.execute() instead.");const b=l.filter(t=>!V(t)&&!Object(s.e)(t.name,f,e)).map(t=>t.name);if(b.length>0){let t="";throw null!=h&&(t="Alternatively, to avoid the dynamic ops, use model.execute() "+`and specify the inputs [${d}]`),new Error(`Cannot compute the outputs [${b}] from the provided `+`inputs [${i}]. Consider providing the following inputs: `+`[${c}]. ${t}`)}return f}processStack(t,e,n,r,o,a,l,u,c){const h=[];for(;e.length>0;){const t=e.pop();n.currentContext=t.contexts;let d="";if("Enter"===t.node.op&&Object(s.d)("isConstant",t.node,r,n)&&([d]=Object(s.b)(t.node.name,n)),null==r[t.node.name]){const p=P(t.node,r,n,this._resourceManager);d||([d]=Object(s.b)(t.node.name,n));const f=n.currentContext;i._152.isPromise(p)?h.push(p.then(i=>(r[d]=i,n.currentContext=f,this.checkTensorForDisposal(d,t.node,r,n,a,l,u),this.processChildNodes(t.node,e,n,r,o,c),i))):(r[d]=p,this.checkTensorForDisposal(d,t.node,r,n,a,l,u),this.processChildNodes(t.node,e,n,r,o,c))}else this.processChildNodes(t.node,e,n,r,o,c)}return h}processChildNodes(t,e,n,r,i,o){t.children.forEach(t=>{const[a]=Object(s.b)(t.name,n);!i[a]&&o.has(t.name)&&("Merge"===t.op?t.inputNames.some(t=>!!Object(s.e)(t,r,n))&&(i[a]=!0,e.push({contexts:n.currentContext,node:t})):t.inputNames.every(t=>!!Object(s.e)(t,r,n))&&(i[a]=!0,e.push({contexts:n.currentContext,node:t})))})}dispose(){Object.keys(this.weightMap).forEach(t=>this.weightMap[t].forEach(t=>t.dispose()))}checkInputShapeAndType(t){Object.keys(t).forEach(e=>{const n=t[e],[r]=Object(s.g)(e),o=this.graph.nodes[r];if(o.attrParams.shape&&o.attrParams.shape.value){const t=o.attrParams.shape.value,e=t.length===n.shape.length&&n.shape.every((e,n)=>-1===t[n]||t[n]===e);i._152.assert(e,()=>`The shape of dict['${o.name}'] provided in `+`model.execute(dict) must be [${t}], but was `+`[${n.shape}]`)}o.attrParams.dtype&&o.attrParams.dtype.value&&i._152.assert(n.dtype===o.attrParams.dtype.value,()=>`The dtype of dict['${o.name}'] provided in `+"model.execute(dict) must be "+`${o.attrParams.dtype.value}, but was ${n.dtype}`)})}mapInputs(t){const e={};for(const n in t)if(null!=this._signature&&null!=this._signature.inputs&&null!=this._signature.inputs[n]){e[this._signature.inputs[n].name]=t[n]}else e[n]=t[n];return e}checkInputs(t){const e=Object.keys(t).filter(t=>{const[e]=Object(s.g)(t);return null==this.graph.nodes[e]});if(e.length>0)throw new Error("The dict provided in model.execute(dict) has "+`keys: [${e}] that are not part of graph`)}mapOutputs(t){return t.map(t=>{if(null!=this._signature&&null!=this._signature.outputs&&null!=this._signature.outputs[t]){return this._signature.outputs[t].name}return t},{})}checkOutputs(t){t.forEach(t=>{const[e]=Object(s.g)(t);if(!this.graph.nodes[e])throw new Error(`The output '${t}' is not found in the graph`)})}}class G{constructor(t={},e={}){this.hashTableNameToHandle=t,this.hashTableMap=e}addHashTable(t,e){this.hashTableNameToHandle[t]=e.handle,this.hashTableMap[e.id]=e}getHashTableHandleByName(t){return this.hashTableNameToHandle[t]}getHashTableById(t){return this.hashTableMap[t]}dispose(){for(const t in this.hashTableMap)this.hashTableMap[t].clearAndClose(),delete this.hashTableMap[t];for(const t in this.hashTableNameToHandle)this.hashTableNameToHandle[t].dispose(),delete this.hashTableNameToHandle[t]}} /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */const z="?tfjs-format=file",X="model.json";class K{constructor(t,e={}){this.modelUrl=t,this.loadOptions=e,this.version="n/a",null==e&&(this.loadOptions={}),this.resourceManager=new G}get modelVersion(){return this.version}get inputNodes(){return this.executor.inputNodes}get outputNodes(){return this.executor.outputNodes}get inputs(){return this.executor.inputs}get outputs(){return this.executor.outputs}get weights(){return this.executor.weightMap}get metadata(){return this.artifacts.userDefinedMetadata}get modelSignature(){return this.signature}findIOHandler(){const t=this.modelUrl;if(null!=t.load)this.handler=t;else if(null!=this.loadOptions.requestInit)this.handler=i._131.browserHTTPRequest(t,this.loadOptions);else{const e=i._131.getLoadHandlers(t,this.loadOptions);if(0===e.length)e.push(i._131.browserHTTPRequest(t,this.loadOptions));else if(e.length>1)throw new Error(`Found more than one (${e.length}) load handlers for `+`URL '${[t]}'`);this.handler=e[0]}}async load(){if(this.findIOHandler(),null==this.handler.load)throw new Error("Cannot proceed with model loading because the IOHandler provided does not have the `load` method implemented.");const t=await this.handler.load();return this.loadSync(t)}loadSync(t){this.artifacts=t;const e=this.artifacts.modelTopology;let n;n=null!=this.artifacts.userDefinedMetadata&&null!=this.artifacts.userDefinedMetadata.signature?this.artifacts.userDefinedMetadata.signature:this.artifacts.signature,this.signature=n,this.version=`${e.versions.producer}.${e.versions.minConsumer}`;const r=i._131.decodeWeights(this.artifacts.weightData,this.artifacts.weightSpecs);if(this.executor=new H(o.a.Instance.transformGraph(e,this.signature)),this.executor.weightMap=this.convertTensorMapToTensorsMap(r),this.executor.resourceManager=this.resourceManager,null!=t.modelInitializer&&null!=t.modelInitializer.node){const e=o.a.Instance.transformGraph(t.modelInitializer);this.initializer=new H(e),this.initializer.weightMap=this.executor.weightMap,this.initializer.resourceManager=this.resourceManager,this.initializer.executeAsync({},[])}return!0}async save(t,e){if("string"==typeof t){const e=i._131.getSaveHandlers(t);if(0===e.length)throw new Error(`Cannot find any save handlers for URL '${t}'`);if(e.length>1)throw new Error(`Found more than one (${e.length}) save handlers for `+`URL '${t}'`);t=e[0]}if(null==t.save)throw new Error("GraphModel.save() cannot proceed because the IOHandler provided does not have the `save` attribute defined.");return t.save(this.artifacts)}predict(t,e){return this.execute(t,this.outputNodes)}normalizeInputs(t){if(!(t instanceof i._103||Array.isArray(t)))return t;if((t=Array.isArray(t)?t:[t]).length!==this.inputNodes.length)throw new Error("Input tensor count mismatch,"+`the graph model has ${this.inputNodes.length} placeholders, `+`while there are ${t.length} input tensors.`);return this.inputNodes.reduce((e,n,r)=>(e[n]=t[r],e),{})}normalizeOutputs(t){return t=t||this.outputNodes,Array.isArray(t)?t:[t]}execute(t,e){t=this.normalizeInputs(t),e=this.normalizeOutputs(e);const n=this.executor.execute(t,e);return n.length>1?n:n[0]}async executeAsync(t,e){t=this.normalizeInputs(t),e=this.normalizeOutputs(e);const n=await this.executor.executeAsync(t,e);return n.length>1?n:n[0]}getIntermediateTensors(){return this.executor.getIntermediateTensors()}disposeIntermediateTensors(){this.executor.disposeIntermediateTensors()}convertTensorMapToTensorsMap(t){return Object.keys(t).reduce((e,n)=>(e[n]=[t[n]],e),{})}dispose(){this.executor.dispose(),this.initializer&&this.initializer.dispose(),this.resourceManager.dispose()}}async function Y(t,e={}){if(null==t)throw new Error("modelUrl in loadGraphModel() cannot be null. Please provide a url or an IOHandler that loads the model");null==e&&(e={}),e.fromTFHub&&null==t.load&&(t.endsWith("/")||(t+="/"),t=`${t}${X}${z}`);const n=new K(t,e);return await n.load(),n} /** @license See the LICENSE file. */ /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */n.d(e,"a",function(){return bt}),n.d(e,"b",function(){return Rt}); /** * @license * Copyright 2022 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ var q=function(){return(q=Object.assign||function(t){for(var e,n=1,r=arguments.length;n0&&i[i.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]l?(o=t.width,s=t.width*a,c=(1-l/a)/2):(o=t.height/a,s=t.height,u=(1-a/l)/2),t.width=o,t.height=s,{top:c,left:u,right:u,bottom:c}}(u,r,o),h=function(t,e,n,r){var i=t.width,o=t.height,s=r?-1:1,a=Math.cos(t.rotation),l=Math.sin(t.rotation),u=t.xCenter,c=t.yCenter,h=1/e,d=1/n,p=new Array(16);return p[0]=i*a*s*h,p[1]=-o*l*h,p[2]=0,p[3]=(-.5*i*a*s+.5*o*l+u)*h,p[4]=i*l*s*d,p[5]=o*a*d,p[6]=0,p[7]=(-.5*o*a-.5*i*l*s+c)*d,p[8]=0,p[9]=0,p[10]=i*h,p[11]=0,p[12]=0,p[13]=0,p[14]=0,p[15]=1,function(t){if(16!==t.length)throw new Error("Array length must be 16 but got "+t.length);return[[t[0],t[1],t[2],t[3]],[t[4],t[5],t[6],t[7]],[t[8],t[9],t[10],t[11]],[t[12],t[13],t[14],t[15]]]}(p)}(u,l.width,l.height,!1);return{imageTensor:Object(i._149)(function(){var e=st(t),n=Object(i._148)(function(t,e,n){return at(n,"inputResolution"),[1/n.width*t[0][0]*e.width,1/n.height*t[0][1]*e.width,t[0][3]*e.width,1/n.width*t[1][0]*e.height,1/n.height*t[1][1]*e.height,t[1][3]*e.height,0,0]}(h,l,r),[1,8]),o="zero"===s?"constant":"nearest",u=i._130.transform(Object(i._129)(Object(i._119)(e,"float32")),n,"bilinear",o,0,[r.height,r.width]);return null!=a?function(t,e){var n=function(t,e,n,r){var i=(r-n)/255;return{scale:i,offset:n-0*i}}(0,0,e[0],e[1]);return Object(i._149)(function(){return Object(i._114)(Object(i._134)(t,n.scale),n.offset)})}(u,a):u}),padding:c,transformationMatrix:h}}function ut(t,e,n,r){return 1===r?.5*(t+e):t+(e-t)*n/(r-1)}function ct(t){return{xCenter:t.xMin+t.width/2,yCenter:t.yMin+t.height/2,width:t.width,height:t.height}}function ht(t){var e=t.relativeKeypoints;if(e.length<=1)throw new Error("2 or more keypoints required to calculate a rect.");var n=Number.MAX_VALUE,r=Number.MAX_VALUE,i=Number.MIN_VALUE,o=Number.MIN_VALUE;return e.forEach(function(t){n=Math.min(n,t.x),i=Math.max(i,t.x),r=Math.min(r,t.y),o=Math.max(o,t.y)}),{xCenter:(n+i)/2,yCenter:(r+o)/2,width:i-n,height:o-r}}function dt(t,e){return t.map(function(t){var n=q(q({},t),{x:t.x*e.width,y:t.y*e.height});return null!=t.z&&(n.z=t.z*e.width),n})}function pt(t,e,n){return J(this,void 0,void 0,function(){var r,o,s,a,l;return Z(this,function(u){switch(u.label){case 0:return r=t[0],o=t[1],s=function(t,e,n){return Object(i._149)(function(){var r,o,s,a;n.reverseOutputOrder?(o=Object(i._142)(Object(i._140)(t,[0,n.boxCoordOffset+0],[-1,1])),r=Object(i._142)(Object(i._140)(t,[0,n.boxCoordOffset+1],[-1,1])),a=Object(i._142)(Object(i._140)(t,[0,n.boxCoordOffset+2],[-1,1])),s=Object(i._142)(Object(i._140)(t,[0,n.boxCoordOffset+3],[-1,1]))):(r=Object(i._142)(Object(i._140)(t,[0,n.boxCoordOffset+0],[-1,1])),o=Object(i._142)(Object(i._140)(t,[0,n.boxCoordOffset+1],[-1,1])),s=Object(i._142)(Object(i._140)(t,[0,n.boxCoordOffset+2],[-1,1])),a=Object(i._142)(Object(i._140)(t,[0,n.boxCoordOffset+3],[-1,1]))),o=Object(i._114)(Object(i._134)(Object(i._125)(o,n.xScale),e.w),e.x),r=Object(i._114)(Object(i._134)(Object(i._125)(r,n.yScale),e.h),e.y),n.applyExponentialOnBoxSize?(s=Object(i._134)(Object(i._128)(Object(i._125)(s,n.hScale)),e.h),a=Object(i._134)(Object(i._128)(Object(i._125)(a,n.wScale)),e.w)):(s=Object(i._134)(Object(i._125)(s,n.hScale),e.h),a=Object(i._134)(Object(i._125)(a,n.wScale),e.h));var l=Object(i._144)(r,Object(i._125)(s,2)),u=Object(i._144)(o,Object(i._125)(a,2)),c=Object(i._114)(r,Object(i._125)(s,2)),h=Object(i._114)(o,Object(i._125)(a,2)),d=Object(i._122)([Object(i._137)(l,[n.numBoxes,1]),Object(i._137)(u,[n.numBoxes,1]),Object(i._137)(c,[n.numBoxes,1]),Object(i._137)(h,[n.numBoxes,1])],1);if(n.numKeypoints)for(var p=0;p0)for((c=l.locationData).relativeKeypoints=[],h=n.numKeypoints*n.numValuesPerKeypoint,d=0;d1&&(h.y=r?e.inputImageHeight-s[u+1]:s[u+1]),o>2&&(h.z=s[u+2]),o>3&&(h.score=gt(e.visibilityActivation,s[u+3])),a.push(h);for(c=0;c0){var c=a===t.strides.length-1?1:ut(t.minScale,t.maxScale,a+1,t.strides.length);s.push(Math.sqrt(l*c)),o.push(t.interpolatedScaleAspectRatio)}}a++}for(var h=0;h0)p=t.featureMapHeight[n],f=t.featureMapWidth[n];else{var g=t.strides[n];p=Math.ceil(t.inputSizeHeight/g),f=Math.ceil(t.inputSizeWidth/g)}for(var m=0;m0?i/o:0}(t,e)<=.5})).push(t)})}),a=x,[4,Promise.all(a.map(function(t){return T.handLandmarks(t,o)}))];case 4:for(c=E.sent(),h=[],this.prevHandRectsFromLandmarks=[],d=0,p=c;d-1}),Object(i._124)([r,o,s]),[2,l]}})})}(u,this.maxHands,.3)];case 2:return c=d.sent(),h=function(t,e){void 0===t&&(t=[]);for(var n=e.left,r=e.top,i=e.left+e.right,o=e.top+e.bottom,s=0;s=.5?"Left":"Right",[4,mt(a,kt)];case 3:return f=_.sent(),[4,mt(c,Ot)];case 4:return g=_.sent(),m=function(t,e){var n=e.left,r=e.top,i=e.left+e.right,o=e.top+e.bottom;return t.map(function(t){return q(q({},t),{x:(t.x-n)/(1-i),y:(t.y-r)/(1-o),z:t.z/(1-i)})})}(f,o),v=function(t,e,n){void 0===n&&(n={ignoreRotation:!1});for(var r=[],i=0,o=m;i-1,r=e.landmarkModelUrl.indexOf("https://tfhub.dev")>-1,[4,Promise.all([Y(e.detectorModelUrl,{fromTFHub:n}),Y(e.landmarkModelUrl,{fromTFHub:r})])];case 1:return i=a.sent(),o=i[0],s=i[1],[2,new It(o,s,e.maxHands)]}})})}(n)];if("mediapipe"===n.runtime)return[2,function(t){return J(this,void 0,void 0,function(){var e,n;return Z(this,function(r){switch(r.label){case 0:return e=function(t){if(null==t)return q({},tt);var e=q({},t);return e.runtime="mediapipe",null==e.maxHands&&(e.maxHands=tt.maxHands),null==e.modelType&&(e.modelType=tt.modelType),e}(t),[4,(n=new et(e)).initialize()];case 1:return r.sent(),[2,n]}})})}(n)];r=n.runtime}throw new Error("Expect modelConfig.runtime to be either 'tfjs' or 'mediapipe', but got "+r);default:throw new Error(t+" is not a supported model name.")}})})}(bt||(bt={})).MediaPipeHands="MediaPipeHands"},XPNO:function(t,e,n){"use strict";var r=n("Nhog"),i=n("XFvI"); /** * @license * Copyright 2018 Google LLC. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================================= */ const o=20,s=3,a=7;function l(t,e,n,r){const a=Object(i.computeStrides)(e),l=function(t,e,n,r){const o=Object(i.sizeFromShape)(e),s=r[r.length-1],a=new Array(s).fill(0),l=e.length,c="complex64"===n?h(t):t;if(l>1)for(let t=0;to){const t=s*d;let n=Array.from(e.slice(0,t)),i=Array.from(e.slice((p-s)*d,p*d));return"complex64"===r&&(n=h(n),i=h(i)),["["+n.map((t,e)=>u(t,a[e],r)).join(", ")+", ..., "+i.map((t,e)=>u(t,a[p-s+e],r)).join(", ")+"]"]}const t="complex64"===r?h(e):Array.from(e);return["["+t.map((t,e)=>u(t,a[e],r)).join(", ")+"]"]}const g=n.slice(1);const m=i.slice(1);const v=i[0]*d;const b=[];if(p>o){for(let n=0;n" "+t).join("\n")),f.join("\n")}function u(t,e,n){let r;return r=Array.isArray(t)?`${parseFloat(t[0].toFixed(a))} + `+`${parseFloat(t[1].toFixed(a))}j`:Object(i.isString)(t)?`'${t}'`:"bool"===n?c(t):parseFloat(t.toFixed(a)).toString(),Object(i.rightPad)(r,e)}function c(t){return 0===t?"false":"true"}function h(t){const e=[];for(let n=0;n`Length of values '${t}' does not match the size `+`inferred by the shape '${this.size}'.`)}if("complex64"===e)throw new Error("complex64 dtype TensorBuffers are not supported. Please create a TensorBuffer for the real and imaginary parts separately and call tf.complex(real, imag).");this.values=n||i.getArrayFromDType(e,this.size),this.strides=Object(i.computeStrides)(t)}set(t,...e){0===e.length&&(e=[0]),i.assert(e.length===this.rank,()=>`The number of provided coordinates (${e.length}) must `+`match the rank (${this.rank})`);const n=this.locToIndex(e);this.values[n]=t}get(...t){0===t.length&&(t=[0]);let e=0;for(const n of t){if(n<0||n>=this.shape[e]){const e=`Requested out of range element at ${t}. `+` Buffer shape=${this.shape}`;throw new Error(e)}e++}let n=t[t.length-1];for(let e=0;ei.decodeString(t))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}}return t}dataToGPU(t){return this.throwIfDisposed(),d().readToGPU(this.dataId,t)}dataSync(){this.throwIfDisposed();const t=d().readSync(this.dataId);if("string"===this.dtype)try{return t.map(t=>i.decodeString(t))}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}return t}async bytes(){this.throwIfDisposed();const t=await d().read(this.dataId);return"string"===this.dtype?t:new Uint8Array(t.buffer)}dispose(){this.isDisposed||(d().disposeTensor(this),this.isDisposedInternal=!0)}get isDisposed(){return this.isDisposedInternal}throwIfDisposed(){if(this.isDisposed)throw new Error("Tensor is disposed.")}print(t=!1){return p.print(this,t)}clone(){return this.throwIfDisposed(),p.clone(this)}toString(t=!1){return l(this.dataSync(),this.shape,this.dtype,t)}cast(t){return this.throwIfDisposed(),p.cast(this,t)}variable(t=!0,e,n){return this.throwIfDisposed(),d().makeVariable(this,t,e,n)}}e.a=g,Object.defineProperty(g,Symbol.hasInstance,{value:t=>!!t&&null!=t.data&&null!=t.dataSync&&null!=t.throwIfDisposed}),Object(r.a)("Tensor",()=>g);class m extends g{constructor(t,e,n,r){super(t.shape,t.dtype,t.dataId,r),this.trainable=e,this.name=n}assign(t){if(t.dtype!==this.dtype)throw new Error(`dtype of the new value (${t.dtype}) and `+`previous value (${this.dtype}) must match`);if(!i.arraysEqual(t.shape,this.shape))throw new Error(`shape of the new value (${t.shape}) and `+`previous value (${this.shape}) must match`);d().disposeTensor(this),this.dataId=t.dataId,d().incRef(this,null)}dispose(){d().disposeVariable(this),this.isDisposedInternal=!0}}e.c=m,Object.defineProperty(m,Symbol.hasInstance,{value:t=>t instanceof g&&null!=t.assign&&t.assign instanceof Function})},Xc4G:function(t,e,n){var r=n("lktj"),i=n("1kS7"),o=n("NpIQ");t.exports=function(t){var e=r(t),n=i.f;if(n)for(var s,a=n(t),l=o.f,u=0;a.length>u;)l.call(t,s=a[u++])&&e.push(s);return e}},Xd32:function(t,e,n){n("+tPU"),n("zQR9"),t.exports=n("5PlU")},XgCd:function(t,e,n){"use strict";var r=String.prototype.replace,i=/%20/g;t.exports={default:"RFC3986",formatters:{RFC1738:function(t){return r.call(t,i,"+")},RFC3986:function(t){return t}},RFC1738:"RFC1738",RFC3986:"RFC3986"}},XmWM:function(t,e,n){"use strict";var r=n("cGG2"),i=n("DQCr"),o=n("fuGk"),s=n("xLtR"),a=n("DUeU");function l(t){this.defaults=t,this.interceptors={request:new o,response:new o}}l.prototype.request=function(t){"string"==typeof t?(t=arguments[1]||{}).url=arguments[0]:t=t||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var e=[s,void 0],n=Promise.resolve(t);for(this.interceptors.request.forEach(function(t){e.unshift(t.fulfilled,t.rejected)}),this.interceptors.response.forEach(function(t){e.push(t.fulfilled,t.rejected)});e.length;)n=n.then(e.shift(),e.shift());return n},l.prototype.getUri=function(t){return t=a(this.defaults,t),i(t.url,t.params,t.paramsSerializer).replace(/^\?/,"")},r.forEach(["delete","get","head","options"],function(t){l.prototype[t]=function(e,n){return this.request(a(n||{},{method:t,url:e,data:(n||{}).data}))}}),r.forEach(["post","put","patch"],function(t){l.prototype[t]=function(e,n,r){return this.request(a(r||{},{method:t,url:e,data:n}))}}),t.exports=l},Xxa5:function(t,e,n){t.exports=n("jyFz")},Y5mS:function(t,e,n){"use strict";var r,i=n("lFkc");i.canUseDOM&&(r=document.implementation&&document.implementation.hasFeature&&!0!==document.implementation.hasFeature("","")) /** * Checks if an event is supported in the current execution environment. * * NOTE: This will not work correctly for non-generic events such as `change`, * `reset`, `load`, `error`, and `select`. * * Borrows from Modernizr. * * @param {string} eventNameSuffix Event name, e.g. "click". * @param {?boolean} capture Check if the capture phase is supported. * @return {boolean} True if the event is supported. * @internal * @license Modernizr 3.0.0pre (Custom Build) | MIT */,t.exports=function(t,e){if(!i.canUseDOM||e&&!("addEventListener"in document))return!1;var n="on"+t,o=n in document;if(!o){var s=document.createElement("div");s.setAttribute(n,"return;"),o="function"==typeof s[n]}return!o&&r&&"wheel"===t&&(o=document.implementation.hasFeature("Events.wheel","3.0")),o}},YAhB:function(t,e,n){"use strict";var r=n("++K3"),i=n("Y5mS"),o=10,s=40,a=800;function l(t){var e=0,n=0,r=0,i=0;return"detail"in t&&(n=t.detail),"wheelDelta"in t&&(n=-t.wheelDelta/120),"wheelDeltaY"in t&&(n=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=n,n=0),r=e*o,i=n*o,"deltaY"in t&&(i=t.deltaY),"deltaX"in t&&(r=t.deltaX),(r||i)&&t.deltaMode&&(1==t.deltaMode?(r*=s,i*=s):(r*=a,i*=a)),r&&!e&&(e=r<1?-1:1),i&&!n&&(n=i<1?-1:1),{spinX:e,spinY:n,pixelX:r,pixelY:i}}l.getEventType=function(){return r.firefox()?"DOMMouseScroll":i("wheel")?"wheel":"mousewheel"},t.exports=l},Ya8g:function(t,e){},Yobk:function(t,e,n){var r=n("77Pl"),i=n("qio6"),o=n("xnc9"),s=n("ax3d")("IE_PROTO"),a=function(){},l=function(){var t,e=n("ON07")("iframe"),r=o.length;for(e.style.display="none",n("RPLV").appendChild(e),e.src="javascript:",(t=e.contentWindow.document).open(),t.write("