You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
NewEduCoderBuild/p__Classrooms__Lists__Exerc...

510 lines
1.1 MiB

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

(window.webpackJsonp=window.webpackJsonp||[]).push([[58],{"1uat":
/*!******************************************!*\
!*** ./node_modules/crypto-js/sha512.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./x64-core */"MlIO"),function(){var t=r,e=t.lib.Hasher,n=t.x64,o=n.Word,i=n.WordArray,a=t.algo;function s(){return o.create.apply(o,arguments)}var u=[s(1116352408,3609767458),s(1899447441,602891725),s(3049323471,3964484399),s(3921009573,2173295548),s(961987163,4081628472),s(1508970993,3053834265),s(2453635748,2937671579),s(2870763221,3664609560),s(3624381080,2734883394),s(310598401,1164996542),s(607225278,1323610764),s(1426881987,3590304994),s(1925078388,4068182383),s(2162078206,991336113),s(2614888103,633803317),s(3248222580,3479774868),s(3835390401,2666613458),s(4022224774,944711139),s(264347078,2341262773),s(604807628,2007800933),s(770255983,1495990901),s(1249150122,1856431235),s(1555081692,3175218132),s(1996064986,2198950837),s(2554220882,3999719339),s(2821834349,766784016),s(2952996808,2566594879),s(3210313671,3203337956),s(3336571891,1034457026),s(3584528711,2466948901),s(113926993,3758326383),s(338241895,168717936),s(666307205,1188179964),s(773529912,1546045734),s(1294757372,1522805485),s(1396182291,2643833823),s(1695183700,2343527390),s(1986661051,1014477480),s(2177026350,1206759142),s(2456956037,344077627),s(2730485921,1290863460),s(2820302411,3158454273),s(3259730800,3505952657),s(3345764771,106217008),s(3516065817,3606008344),s(3600352804,1432725776),s(4094571909,1467031594),s(275423344,851169720),s(430227734,3100823752),s(506948616,1363258195),s(659060556,3750685593),s(883997877,3785050280),s(958139571,3318307427),s(1322822218,3812723403),s(1537002063,2003034995),s(1747873779,3602036899),s(1955562222,1575990012),s(2024104815,1125592928),s(2227730452,2716904306),s(2361852424,442776044),s(2428436474,593698344),s(2756734187,3733110249),s(3204031479,2999351573),s(3329325298,3815920427),s(3391569614,3928383900),s(3515267271,566280711),s(3940187606,3454069534),s(4118630271,4000239992),s(116418474,1914138554),s(174292421,2731055270),s(289380356,3203993006),s(460393269,320620315),s(685471733,587496836),s(852142971,1086792851),s(1017036298,365543100),s(1126000580,2618297676),s(1288033470,3409855158),s(1501505948,4234509866),s(1607167915,987167468),s(1816402316,1246189591)],c=[];!function(){for(var t=0;t<80;t++)c[t]=s()}();var l=a.SHA512=e.extend({_doReset:function(){this._hash=new i.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],f=n[6],h=n[7],p=r.high,d=r.low,m=o.high,v=o.low,g=i.high,y=i.low,b=a.high,w=a.low,x=s.high,_=s.low,E=l.high,C=l.low,S=f.high,k=f.low,T=h.high,I=h.low,O=p,R=d,A=m,D=v,N=g,P=y,M=b,j=w,F=x,B=_,L=E,U=C,W=S,z=k,V=T,q=I,G=0;G<80;G++){var H,X,K=c[G];if(G<16)X=K.high=0|t[e+2*G],H=K.low=0|t[e+2*G+1];else{var Y=c[G-15],$=Y.high,J=Y.low,Q=($>>>1|J<<31)^($>>>8|J<<24)^$>>>7,Z=(J>>>1|$<<31)^(J>>>8|$<<24)^(J>>>7|$<<25),tt=c[G-2],et=tt.high,nt=tt.low,rt=(et>>>19|nt<<13)^(et<<3|nt>>>29)^et>>>6,ot=(nt>>>19|et<<13)^(nt<<3|et>>>29)^(nt>>>6|et<<26),it=c[G-7],at=it.high,st=it.low,ut=c[G-16],ct=ut.high,lt=ut.low;X=(X=(X=Q+at+((H=Z+st)>>>0<Z>>>0?1:0))+rt+((H+=ot)>>>0<ot>>>0?1:0))+ct+((H+=lt)>>>0<lt>>>0?1:0),K.high=X,K.low=H}var ft,ht=F&L^~F&W,pt=B&U^~B&z,dt=O&A^O&N^A&N,mt=R&D^R&P^D&P,vt=(O>>>28|R<<4)^(O<<30|R>>>2)^(O<<25|R>>>7),gt=(R>>>28|O<<4)^(R<<30|O>>>2)^(R<<25|O>>>7),yt=(F>>>14|B<<18)^(F>>>18|B<<14)^(F<<23|B>>>9),bt=(B>>>14|F<<18)^(B>>>18|F<<14)^(B<<23|F>>>9),wt=u[G],xt=wt.high,_t=wt.low,Et=V+yt+((ft=q+bt)>>>0<q>>>0?1:0),Ct=gt+mt;V=W,q=z,W=L,z=U,L=F,U=B,F=M+(Et=(Et=(Et=Et+ht+((ft+=pt)>>>0<pt>>>0?1:0))+xt+((ft+=_t)>>>0<_t>>>0?1:0))+X+((ft+=H)>>>0<H>>>0?1:0))+((B=j+ft|0)>>>0<j>>>0?1:0)|0,M=N,j=P,N=A,P=D,A=O,D=R,O=Et+(vt+dt+(Ct>>>0<gt>>>0?1:0))+((R=ft+Ct|0)>>>0<ft>>>0?1:0)|0}d=r.low=d+R,r.high=p+O+(d>>>0<R>>>0?1:0),v=o.low=v+D,o.high=m+A+(v>>>0<D>>>0?1:0),y=i.low=y+P,i.high=g+N+(y>>>0<P>>>0?1:0),w=a.low=w+j,a.high=b+M+(w>>>0<j>>>0?1:0),_=s.low=_+B,s.high=x+F+(_>>>0<B>>>0?1:0),C=l.low=C+U,l.high=E+L+(C>>>0<U>>>0?1:0),k=f.low=k+z,f.high=S+W+(k>>>0<z>>>0?1:0),I=h.low=I+q,h.high=T+V+(I>>>0<q>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(r+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=e.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});t.SHA512=e._createHelper(l),t.HmacSHA512=e._createHmacHelper(l)}(),r.SHA512)},"2LEM":
/*!*******************************************!*\
!*** ./src/assets/images/checkPeople.jpg ***!
\*******************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports=n.p+"static/checkPeople.d3191bb4.jpg"},"2U/9":
/*!*******************************************************!*\
!*** ./node_modules/rc-steps/es/index.js + 2 modules ***!
\*******************************************************/
/*! exports provided: Step, default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/classCallCheck.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createClass.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/createSuper.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/defineProperty.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/inherits.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-util/es/Children/toArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";var r=n("VTBJ"),o=n("rePB"),i=n("Ff2n"),a=n("1OyB"),s=n("vuIU"),u=n("Ji7U"),c=n("LK+K"),l=n("q1tI"),f=n.n(l),h=n("Zm9Q"),p=n("TSYQ"),d=n.n(p),m=["className","prefixCls","style","active","status","iconPrefix","icon","wrapperStyle","stepNumber","disabled","description","title","subTitle","progressDot","stepIcon","tailContent","icons","stepIndex","onStepClick","onClick"];function v(t){return"string"==typeof t}var g=function(t){Object(u.a)(n,t);var e=Object(c.a)(n);function n(){var t;return Object(a.a)(this,n),(t=e.apply(this,arguments)).onClick=function(){var e=t.props,n=e.onClick,r=e.onStepClick,o=e.stepIndex;n&&n.apply(void 0,arguments),r(o)},t}return Object(s.a)(n,[{key:"renderIconNode",value:function(){var t,e,n=this.props,r=n.prefixCls,i=n.progressDot,a=n.stepIcon,s=n.stepNumber,u=n.status,c=n.title,f=n.description,h=n.icon,p=n.iconPrefix,m=n.icons,g=d()("".concat(r,"-icon"),"".concat(p,"icon"),(t={},Object(o.a)(t,"".concat(p,"icon-").concat(h),h&&v(h)),Object(o.a)(t,"".concat(p,"icon-check"),!h&&"finish"===u&&(m&&!m.finish||!m)),Object(o.a)(t,"".concat(p,"icon-cross"),!h&&"error"===u&&(m&&!m.error||!m)),t)),y=l.createElement("span",{className:"".concat(r,"-icon-dot")});return e=i?"function"==typeof i?l.createElement("span",{className:"".concat(r,"-icon")},i(y,{index:s-1,status:u,title:c,description:f})):l.createElement("span",{className:"".concat(r,"-icon")},y):h&&!v(h)?l.createElement("span",{className:"".concat(r,"-icon")},h):m&&m.finish&&"finish"===u?l.createElement("span",{className:"".concat(r,"-icon")},m.finish):m&&m.error&&"error"===u?l.createElement("span",{className:"".concat(r,"-icon")},m.error):h||"finish"===u||"error"===u?l.createElement("span",{className:g}):l.createElement("span",{className:"".concat(r,"-icon")},s),a&&(e=a({index:s-1,status:u,title:c,description:f,node:e})),e}},{key:"render",value:function(){var t,e=this.props,n=e.className,a=e.prefixCls,s=e.style,u=e.active,c=e.status,f=void 0===c?"wait":c,h=(e.iconPrefix,e.icon),p=(e.wrapperStyle,e.stepNumber,e.disabled),v=e.description,g=e.title,y=e.subTitle,b=(e.progressDot,e.stepIcon,e.tailContent),w=(e.icons,e.stepIndex,e.onStepClick),x=e.onClick,_=Object(i.a)(e,m),E=d()("".concat(a,"-item"),"".concat(a,"-item-").concat(f),n,(t={},Object(o.a)(t,"".concat(a,"-item-custom"),h),Object(o.a)(t,"".concat(a,"-item-active"),u),Object(o.a)(t,"".concat(a,"-item-disabled"),!0===p),t)),C=Object(r.a)({},s),S={};return w&&!p&&(S.role="button",S.tabIndex=0,S.onClick=this.onClick),l.createElement("div",Object.assign({},_,{className:E,style:C}),l.createElement("div",Object.assign({onClick:x},S,{className:"".concat(a,"-item-container")}),l.createElement("div",{className:"".concat(a,"-item-tail")},b),l.createElement("div",{className:"".concat(a,"-item-icon")},this.renderIconNode()),l.createElement("div",{className:"".concat(a,"-item-content")},l.createElement("div",{className:"".concat(a,"-item-title")},g,y&&l.createElement("div",{title:"string"==typeof y?y:void 0,className:"".concat(a,"-item-subtitle")},y)),v&&l.createElement("div",{className:"".concat(a,"-item-description")},v))))}}]),n}(l.Component),y=["prefixCls","style","className","children","direction","type","labelPlacement","iconPrefix","status","size","current","progressDot","stepIcon","initial","icons","onChange"],b=function(t){Object(u.a)(n,t);var e=Object(c.a)(n);function n(){var t;return Object(a.a)(this,n),(t=e.apply(this,arguments)).onStepClick=function(e){var n=t.props,r=n.onChange,o=n.current;r&&o!==e&&r(e)},t}return Object(s.a)(n,[{key:"render",value:function(){var t,e=this,n=this.props,a=n.prefixCls,s=n.style,u=void 0===s?{}:s,c=n.className,p=n.children,m=n.direction,v=n.type,g=n.labelPlacement,b=n.iconPrefix,w=n.status,x=n.size,_=n.current,E=n.progressDot,C=n.stepIcon,S=n.initial,k=n.icons,T=n.onChange,I=Object(i.a)(n,y),O="navigation"===v,R=E?"vertical":g,A=d()(a,"".concat(a,"-").concat(m),c,(t={},Object(o.a)(t,"".concat(a,"-").concat(x),x),Object(o.a)(t,"".concat(a,"-label-").concat(R),"horizontal"===m),Object(o.a)(t,"".concat(a,"-dot"),!!E),Object(o.a)(t,"".concat(a,"-navigation"),O),t));return f.a.createElement("div",Object.assign({className:A,style:u},I),Object(h.a)(p).map((function(t,n){var o=S+n,i=Object(r.a)({stepNumber:"".concat(o+1),stepIndex:o,key:o,prefixCls:a,iconPrefix:b,wrapperStyle:u,progressDot:E,stepIcon:C,icons:k,onStepClick:T&&e.onStepClick},t.props);return"error"===w&&n===_-1&&(i.className="".concat(a,"-next-error")),t.props.status||(i.status=o===_?w:o<_?"finish":"wait"),i.active=o===_,Object(l.cloneElement)(t,i)})))}}]),n}(f.a.Component);b.Step=g,b.defaultProps={type:"default",prefixCls:"rc-steps",iconPrefix:"rc",direction:"horizontal",labelPlacement:"horizontal",initial:0,current:0,status:"process",size:"",progressDot:!1};e.a=b},"3y9D":
/*!****************************************!*\
!*** ./node_modules/crypto-js/sha1.js ***!
\****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i,a,s,u,c,l;t.exports=(l=n(/*! ./core */"Ib8C"),o=(r=l).lib,i=o.WordArray,a=o.Hasher,s=r.algo,u=[],c=s.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],c=0;c<80;c++){if(c<16)u[c]=0|t[e+c];else{var l=u[c-3]^u[c-8]^u[c-14]^u[c-16];u[c]=l<<1|l>>>31}var f=(r<<5|r>>>27)+s+u[c];f+=c<20?1518500249+(o&i|~o&a):c<40?1859775393+(o^i^a):c<60?(o&i|o&a|i&a)-1894007588:(o^i^a)-899497514,s=a,a=i,i=o<<30|o>>>2,o=r,r=f}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=a.clone.call(this);return t._hash=this._hash.clone(),t}}),r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c),l.SHA1)},4:
/*!************************!*\
!*** crypto (ignored) ***!
\************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){},"49sm":
/*!***************************************!*\
!*** ./node_modules/isarray/index.js ***!
\***************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},5:
/*!************************!*\
!*** crypto (ignored) ***!
\************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){},"5hvy":
/*!****************************************!*\
!*** ./node_modules/crypto-js/sha3.js ***!
\****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./x64-core */"MlIO"),function(t){var e=r,n=e.lib,o=n.WordArray,i=n.Hasher,a=e.x64.Word,s=e.algo,u=[],c=[],l=[];!function(){for(var t=1,e=0,n=0;n<24;n++){u[t+5*e]=(n+1)*(n+2)/2%64;var r=(2*t+3*e)%5;t=e%5,e=r}for(t=0;t<5;t++)for(e=0;e<5;e++)c[t+5*e]=e+(2*t+3*e)%5*5;for(var o=1,i=0;i<24;i++){for(var s=0,f=0,h=0;h<7;h++){if(1&o){var p=(1<<h)-1;p<32?f^=1<<p:s^=1<<p-32}128&o?o=o<<1^113:o<<=1}l[i]=a.create(s,f)}}();var f=[];!function(){for(var t=0;t<25;t++)f[t]=a.create()}();var h=s.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new a.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;o<r;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),(I=n[o]).high^=a,I.low^=i}for(var s=0;s<24;s++){for(var h=0;h<5;h++){for(var p=0,d=0,m=0;m<5;m++)p^=(I=n[h+5*m]).high,d^=I.low;var v=f[h];v.high=p,v.low=d}for(h=0;h<5;h++){var g=f[(h+4)%5],y=f[(h+1)%5],b=y.high,w=y.low;for(p=g.high^(b<<1|w>>>31),d=g.low^(w<<1|b>>>31),m=0;m<5;m++)(I=n[h+5*m]).high^=p,I.low^=d}for(var x=1;x<25;x++){var _=(I=n[x]).high,E=I.low,C=u[x];C<32?(p=_<<C|E>>>32-C,d=E<<C|_>>>32-C):(p=E<<C-32|_>>>64-C,d=_<<C-32|E>>>64-C);var S=f[c[x]];S.high=p,S.low=d}var k=f[0],T=n[0];for(k.high=T.high,k.low=T.low,h=0;h<5;h++)for(m=0;m<5;m++){var I=n[x=h+5*m],O=f[x],R=f[(h+1)%5+5*m],A=f[(h+2)%5+5*m];I.high=O.high^~R.high&A.high,I.low=O.low^~R.low&A.low}I=n[0];var D=l[s];I.high^=D.high,I.low^=D.low}},_doFinalize:function(){var e=this._data,n=e.words,r=(this._nDataBytes,8*e.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(t.ceil((r+1)/i)*i>>>5)-1]|=128,e.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;l<u;l++){var f=a[l],h=f.high,p=f.low;h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),c.push(p),c.push(h)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;n<25;n++)e[n]=e[n].clone();return t}});e.SHA3=i._createHelper(h),e.HmacSHA3=i._createHmacHelper(h)}(Math),r.SHA3)},6:
/*!****************************!*\
!*** node-fetch (ignored) ***!
\****************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){},7:
/*!**********************!*\
!*** util (ignored) ***!
\**********************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){},"7Cbv":
/*!**************************************************************!*\
!*** ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules ***!
\**************************************************************/
/*! exports provided: default */
/*! exports used: default */function(t,e,n){"use strict";var r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),o=new Uint8Array(16);function i(){if(!r)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(o)}var a=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var s=function(t){return"string"==typeof t&&a.test(t)},u=[],c=0;c<256;++c)u.push((c+256).toString(16).substr(1));var l=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(u[t[e+0]]+u[t[e+1]]+u[t[e+2]]+u[t[e+3]]+"-"+u[t[e+4]]+u[t[e+5]]+"-"+u[t[e+6]]+u[t[e+7]]+"-"+u[t[e+8]]+u[t[e+9]]+"-"+u[t[e+10]]+u[t[e+11]]+u[t[e+12]]+u[t[e+13]]+u[t[e+14]]+u[t[e+15]]).toLowerCase();if(!s(n))throw TypeError("Stringified UUID is invalid");return n};e.a=function(t,e,n){var r=(t=t||{}).random||(t.rng||i)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,e){n=n||0;for(var o=0;o<16;++o)e[n+o]=r[o];return e}return l(r)}},"7ixt":
/*!**************************************************!*\
!*** ./node_modules/rc-tooltip/es/placements.js ***!
\**************************************************/
/*! exports provided: placements, default */
/*! exports used: placements */function(t,e,n){"use strict";n.d(e,"a",(function(){return i}));var r={adjustX:1,adjustY:1},o=[0,0],i={left:{points:["cr","cl"],overflow:r,offset:[-4,0],targetOffset:o},right:{points:["cl","cr"],overflow:r,offset:[4,0],targetOffset:o},top:{points:["bc","tc"],overflow:r,offset:[0,-4],targetOffset:o},bottom:{points:["tc","bc"],overflow:r,offset:[0,4],targetOffset:o},topLeft:{points:["bl","tl"],overflow:r,offset:[0,-4],targetOffset:o},leftTop:{points:["tr","tl"],overflow:r,offset:[-4,0],targetOffset:o},topRight:{points:["br","tr"],overflow:r,offset:[0,-4],targetOffset:o},rightTop:{points:["tl","tr"],overflow:r,offset:[4,0],targetOffset:o},bottomRight:{points:["tr","br"],overflow:r,offset:[0,4],targetOffset:o},rightBottom:{points:["bl","br"],overflow:r,offset:[4,0],targetOffset:o},bottomLeft:{points:["tl","bl"],overflow:r,offset:[0,4],targetOffset:o},leftBottom:{points:["br","bl"],overflow:r,offset:[-4,0],targetOffset:o}}},"8KZw":
/*!************************************************************!*\
!*** ./node_modules/checkapi.js/build/es6/env/isNodejs.js ***!
\************************************************************/
/*! exports provided: isNodejs */
/*! exports used: isNodejs */
/*! ModuleConcatenation bailout: Module uses injected variables (global, process) */function(t,e,n){"use strict";(function(r,o){function i(){return"object"==typeof r&&void 0!==t&&void 0!==o&&!!o.version}n.d(e,"a",(function(){return i}))}).call(this,n(/*! ./../../../../@umijs/deps/compiled/webpack/4/global.js */"IyRk"),n(/*! ./../../../../node-libs-browser/mock/process.js */"Q2Ig"))},"9OqN":
/*!********************************************!*\
!*** ./node_modules/crypto-js/mode-ctr.js ***!
\********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i;t.exports=(i=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),i.mode.CTR=(r=i.lib.BlockCipherMode.extend(),o=r.Encryptor=r.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._counter;o&&(i=this._counter=o.slice(0),this._iv=void 0);var a=i.slice(0);n.encryptBlock(a,0),i[r-1]=i[r-1]+1|0;for(var s=0;s<r;s++)t[e+s]^=a[s]}}),r.Decryptor=o,r),i.mode.CTR)},ALsQ:
/*!********************************************!*\
!*** ./node_modules/crypto-js/mode-cfb.js ***!
\********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),r.mode.CFB=function(){var t=r.lib.BlockCipherMode.extend();function e(t,e,n,r){var o,i=this._iv;i?(o=i.slice(0),this._iv=void 0):o=this._prevBlock,r.encryptBlock(o,0);for(var a=0;a<n;a++)t[e+a]^=o[a]}return t.Encryptor=t.extend({processBlock:function(t,n){var r=this._cipher,o=r.blockSize;e.call(this,t,n,o,r),this._prevBlock=t.slice(n,n+o)}}),t.Decryptor=t.extend({processBlock:function(t,n){var r=this._cipher,o=r.blockSize,i=t.slice(n,n+o);e.call(this,t,n,o,r),this._prevBlock=i}}),t}(),r.mode.CFB)},E4JC:
/*!******************************************!*\
!*** ./node_modules/crypto-js/rabbit.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./enc-base64 */"ETIr"),n(/*! ./md5 */"cv67"),n(/*! ./evpkdf */"K3mO"),n(/*! ./cipher-core */"OLod"),function(){var t=r,e=t.lib.StreamCipher,n=t.algo,o=[],i=[],a=[],s=n.Rabbit=e.extend({_doReset:function(){for(var t=this._key.words,e=this.cfg.iv,n=0;n<4;n++)t[n]=16711935&(t[n]<<8|t[n]>>>24)|4278255360&(t[n]<<24|t[n]>>>8);var r=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],o=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];for(this._b=0,n=0;n<4;n++)u.call(this);for(n=0;n<8;n++)o[n]^=r[n+4&7];if(e){var i=e.words,a=i[0],s=i[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(o[0]^=c,o[1]^=f,o[2]^=l,o[3]^=h,o[4]^=c,o[5]^=f,o[6]^=l,o[7]^=h,n=0;n<4;n++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),t[e+r]^=o[r]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)i[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=t[n]+e[n],o=65535&r,s=r>>>16,u=((o*o>>>17)+o*s>>>15)+s*s,c=((4294901760&r)*r|0)+((65535&r)*r|0);a[n]=u^c}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.Rabbit=e._createHelper(s)}(),r.Rabbit)},ELcG:
/*!*********************************************!*\
!*** ./node_modules/crypto-js/ripemd160.js ***!
\*********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),
/** @preserve
(c) 2012 by Cédric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function(t){var e=r,n=e.lib,o=n.WordArray,i=n.Hasher,a=e.algo,s=o.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=o.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=o.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),l=o.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),f=o.create([0,1518500249,1859775393,2400959708,2840853838]),h=o.create([1352829926,1548603684,1836072691,2053994217,0]),p=a.RIPEMD160=i.extend({_doReset:function(){this._hash=o.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var r=e+n,o=t[r];t[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i,a,p,w,x,_,E,C,S,k,T,I=this._hash.words,O=f.words,R=h.words,A=s.words,D=u.words,N=c.words,P=l.words;for(_=i=I[0],E=a=I[1],C=p=I[2],S=w=I[3],k=x=I[4],n=0;n<80;n+=1)T=i+t[e+A[n]]|0,T+=n<16?d(a,p,w)+O[0]:n<32?m(a,p,w)+O[1]:n<48?v(a,p,w)+O[2]:n<64?g(a,p,w)+O[3]:y(a,p,w)+O[4],T=(T=b(T|=0,N[n]))+x|0,i=x,x=w,w=b(p,10),p=a,a=T,T=_+t[e+D[n]]|0,T+=n<16?y(E,C,S)+R[0]:n<32?g(E,C,S)+R[1]:n<48?v(E,C,S)+R[2]:n<64?m(E,C,S)+R[3]:d(E,C,S)+R[4],T=(T=b(T|=0,P[n]))+k|0,_=k,k=S,S=b(C,10),C=E,E=T;T=I[1]+p+S|0,I[1]=I[2]+w+k|0,I[2]=I[3]+x+_|0,I[3]=I[4]+i+E|0,I[4]=I[0]+a+C|0,I[0]=T},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process();for(var o=this._hash,i=o.words,a=0;a<5;a++){var s=i[a];i[a]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8)}return o},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function d(t,e,n){return t^e^n}function m(t,e,n){return t&e|~t&n}function v(t,e,n){return(t|~e)^n}function g(t,e,n){return t&n|e&~n}function y(t,e,n){return t^(e|~n)}function b(t,e){return t<<e|t>>>32-e}e.RIPEMD160=i._createHelper(p),e.HmacRIPEMD160=i._createHmacHelper(p)}(Math),r.RIPEMD160)},ETIr:
/*!**********************************************!*\
!*** ./node_modules/crypto-js/enc-base64.js ***!
\**********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i;t.exports=(i=n(/*! ./core */"Ib8C"),o=(r=i).lib.WordArray,r.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp();for(var o=[],i=0;i<n;i+=3)for(var a=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s<n;s++)o.push(r.charAt(a>>>6*(3-s)&63));var u=r.charAt(64);if(u)for(;o.length%4;)o.push(u);return o.join("")},parse:function(t){var e=t.length,n=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var i=0;i<n.length;i++)r[n.charCodeAt(i)]=i}var a=n.charAt(64);if(a){var s=t.indexOf(a);-1!==s&&(e=s)}return function(t,e,n){for(var r=[],i=0,a=0;a<e;a++)if(a%4){var s=n[t.charCodeAt(a-1)]<<a%4*2,u=n[t.charCodeAt(a)]>>>6-a%4*2,c=s|u;r[i>>>2]|=c<<24-i%4*8,i++}return o.create(r,i)}(t,e,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},i.enc.Base64)},"F+F2":
/*!***************************************************!*\
!*** ./node_modules/crypto-js/lib-typedarrays.js ***!
\***************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),function(){if("function"==typeof ArrayBuffer){var t=r.lib.WordArray,e=t.init;(t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var n=t.byteLength,r=[],o=0;o<n;o++)r[o>>>2]|=t[o]<<24-o%4*8;e.call(this,r,n)}else e.apply(this,arguments)}).prototype=t}}(),r.lib.WordArray)},GRuw:
/*!******************************************!*\
!*** ./node_modules/crypto-js/sha224.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i,a,s,u;t.exports=(u=n(/*! ./core */"Ib8C"),n(/*! ./sha256 */"lPiR"),o=(r=u).lib.WordArray,i=r.algo,a=i.SHA256,s=i.SHA224=a.extend({_doReset:function(){this._hash=new o.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=a._doFinalize.call(this);return t.sigBytes-=4,t}}),r.SHA224=a._createHelper(s),r.HmacSHA224=a._createHmacHelper(s),u.SHA224)},GfqC:
/*!********************************************************!*\
!*** ./node_modules/rc-upload/es/index.js + 6 modules ***!
\********************************************************/
/*! exports provided: default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/classnames/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";var r=n("q1tI"),o=n.n(r),i=n("TSYQ"),a=n.n(i);function s(t){var e=t.responseText||t.response;if(!e)return e;try{return JSON.parse(e)}catch(t){return e}}function u(t){var e=new XMLHttpRequest;t.onProgress&&e.upload&&(e.upload.onprogress=function(e){e.total>0&&(e.percent=e.loaded/e.total*100),t.onProgress(e)});var n=new FormData;t.data&&Object.keys(t.data).forEach((function(e){var r=t.data[e];Array.isArray(r)?r.forEach((function(t){n.append(e+"[]",t)})):n.append(e,t.data[e])})),t.file instanceof Blob?n.append(t.filename,t.file,t.file.name):n.append(t.filename,t.file),e.onerror=function(e){t.onError(e)},e.onload=function(){return e.status<200||e.status>=300?t.onError(function(t,e){var n="cannot "+t.method+" "+t.action+" "+e.status+"'",r=new Error(n);return r.status=e.status,r.method=t.method,r.url=t.action,r}(t,e),s(e)):t.onSuccess(s(e),e)},e.open(t.method,t.action,!0),t.withCredentials&&"withCredentials"in e&&(e.withCredentials=!0);var r=t.headers||{};return null!==r["X-Requested-With"]&&e.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(r).forEach((function(t){null!==r[t]&&e.setRequestHeader(t,r[t])})),e.send(n),{abort:function(){e.abort()}}}var c=+new Date,l=0;function f(){return"rc-upload-"+c+"-"+ ++l}var h=function(t,e){if(t&&e){var n=Array.isArray(e)?e:e.split(","),r=t.name||"",o=t.type||"",i=o.replace(/\/.*$/,"");return n.some((function(t){var e,n,a=t.trim();return"."===a.charAt(0)?(e=r.toLowerCase(),n=a.toLowerCase(),-1!==e.indexOf(n,e.length-n.length)):/\/\*$/.test(a)?i===a.replace(/\/.*$/,""):o===a}))}return!0};var p=function(t,e,n){var r=function t(r,o){o=o||"",r.isFile?r.file((function(t){n(t)&&(r.fullPath&&!t.webkitRelativePath&&(Object.defineProperties(t,{webkitRelativePath:{writable:!0}}),t.webkitRelativePath=r.fullPath.replace(/^\//,""),Object.defineProperties(t,{webkitRelativePath:{writable:!1}})),e([t]))})):r.isDirectory&&function(t,e){var n=t.createReader(),r=[];!function t(){n.readEntries((function(n){var o=Array.prototype.slice.apply(n);r=r.concat(o),!o.length?e(r):t()}))}()}(r,(function(e){e.forEach((function(e){t(e,""+o+r.name+"/")}))}))};t.forEach((function(t){r(t.webkitGetAsEntry())}))},d=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},m=function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var n=[],r=!0,o=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){o=!0,i=t}finally{try{!r&&s.return&&s.return()}finally{if(o)throw i}}return n}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")},v=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function g(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function b(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}var w=function(t){function e(){var t,n,r;y(this,e);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=b(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(i))),r.state={uid:f()},r.reqs={},r.onChange=function(t){var e=t.target.files;r.uploadFiles(e),r.reset()},r.onClick=function(t){var e=r.fileInput;if(e){var n=r.props,o=n.children,i=n.onClick;o&&"button"===o.type&&(e.parentNode.focus(),e.parentNode.querySelector("button").blur()),e.click(),i&&i(t)}},r.onKeyDown=function(t){"Enter"===t.key&&r.onClick()},r.onFileDrop=function(t){var e=r.props.multiple;if(t.preventDefault(),"dragover"!==t.type)if(r.props.directory)p(Array.prototype.slice.call(t.dataTransfer.items),r.uploadFiles,(function(t){return h(t,r.props.accept)}));else{var n=Array.prototype.slice.call(t.dataTransfer.files).filter((function(t){return h(t,r.props.accept)}));!1===e&&(n=n.slice(0,1)),r.uploadFiles(n)}},r.uploadFiles=function(t){var e=Array.prototype.slice.call(t);e.map((function(t){return t.uid=f(),t})).forEach((function(t){r.upload(t,e)}))},r.saveFileInput=function(t){r.fileInput=t},b(r,n)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),v(e,[{key:"componentDidMount",value:function(){this._isMounted=!0}},{key:"componentWillUnmount",value:function(){this._isMounted=!1,this.abort()}},{key:"upload",value:function(t,e){var n=this,r=this.props;if(!r.beforeUpload)return setTimeout((function(){return n.post(t)}),0);var o=r.beforeUpload(t,e);o&&o.then?o.then((function(e){var r=Object.prototype.toString.call(e);return"[object File]"===r||"[object Blob]"===r?n.post(e):n.post(t)})).catch((function(t){console.log(t)})):!1!==o&&setTimeout((function(){return n.post(t)}),0)}},{key:"post",value:function(t){var e=this;if(this._isMounted){var n=this.props,r=n.onStart,o=n.onProgress,i=n.transformFile,a=void 0===i?function(t){return t}:i;new Promise((function(e){var r=n.action;return"function"==typeof r&&(r=r(t)),e(r)})).then((function(i){var s=t.uid,c=n.customRequest||u;Promise.resolve(a(t)).then((function(t){var e=n.data;return"function"==typeof e&&(e=e(t)),Promise.all([t,e])})).catch((function(t){console.error(t)})).then((function(a){var u=m(a,2),l=u[0],f=u[1],h={action:i,filename:n.name,data:f,file:l,headers:n.headers,withCredentials:n.withCredentials,method:n.method||"post",onProgress:o?function(e){o(e,t)}:null,onSuccess:function(r,o){delete e.reqs[s],n.onSuccess(r,t,o)},onError:function(r,o){delete e.reqs[s],n.onError(r,o,t)}};r(t),e.reqs[s]=c(h)}))}))}}},{key:"reset",value:function(){this.setState({uid:f()})}},{key:"abort",value:function(t){var e=this.reqs;if(t){var n=t;t&&t.uid&&(n=t.uid),e[n]&&e[n].abort&&e[n].abort(),delete e[n]}else Object.keys(e).forEach((function(t){e[t]&&e[t].abort&&e[t].abort(),delete e[t]}))}},{key:"render",value:function(){var t,e,n=this.props,r=n.component,i=n.prefixCls,s=n.className,u=n.disabled,c=n.id,l=n.style,f=n.multiple,h=n.accept,p=n.children,m=n.directory,v=n.openFileDialogOnClick,y=n.onMouseEnter,b=n.onMouseLeave,w=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n}(n,["component","prefixCls","className","disabled","id","style","multiple","accept","children","directory","openFileDialogOnClick","onMouseEnter","onMouseLeave"]),x=a()((g(t={},i,!0),g(t,i+"-disabled",u),g(t,s,s),t)),_=u?{}:{onClick:v?this.onClick:function(){},onKeyDown:v?this.onKeyDown:function(){},onMouseEnter:y,onMouseLeave:b,onDrop:this.onFileDrop,onDragOver:this.onFileDrop,tabIndex:"0"};return o.a.createElement(r,d({},_,{className:x,role:"button",style:l}),o.a.createElement("input",d({},(e=w,Object.keys(e).reduce((function(t,n){return"data-"!==n.substr(0,5)&&"aria-"!==n.substr(0,5)&&"role"!==n||(t[n]=e[n]),t}),{})),{id:c,type:"file",ref:this.saveFileInput,onClick:function(t){return t.stopPropagation()},key:this.state.uid,style:{display:"none"},accept:h,directory:m?"directory":null,webkitdirectory:m?"webkitdirectory":null,multiple:f,onChange:this.onChange})),p)}}]),e}(r.Component),x=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();function E(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function C(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function S(){}var k=function(t){function e(){var t,n,r;E(this,e);for(var o=arguments.length,i=Array(o),a=0;a<o;a++)i[a]=arguments[a];return n=r=C(this,(t=e.__proto__||Object.getPrototypeOf(e)).call.apply(t,[this].concat(i))),r.saveUploader=function(t){r.uploader=t},C(r,n)}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}(e,t),_(e,[{key:"abort",value:function(t){this.uploader.abort(t)}},{key:"render",value:function(){return o.a.createElement(w,x({},this.props,{ref:this.saveUploader}))}}]),e}(r.Component);k.defaultProps={component:"span",prefixCls:"rc-upload",data:{},headers:{},name:"file",multipart:!1,onStart:S,onError:S,onSuccess:S,multiple:!1,beforeUpload:null,customRequest:null,withCredentials:!1,openFileDialogOnClick:!0};var T=k;e.a=T},H7XF:
/*!*****************************************!*\
!*** ./node_modules/base64-js/index.js ***!
\*****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){"use strict";e.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){var e,n,r=c(t),a=r[0],s=r[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,s)),l=0,f=s>0?a-4:a;for(n=0;n<f;n+=4)e=o[t.charCodeAt(n)]<<18|o[t.charCodeAt(n+1)]<<12|o[t.charCodeAt(n+2)]<<6|o[t.charCodeAt(n+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;2===s&&(e=o[t.charCodeAt(n)]<<2|o[t.charCodeAt(n+1)]>>4,u[l++]=255&e);1===s&&(e=o[t.charCodeAt(n)]<<10|o[t.charCodeAt(n+1)]<<4|o[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e);return u},e.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],a=0,s=n-o;a<s;a+=16383)i.push(l(t,a,a+16383>s?s:a+16383));1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)r[s]=a[s],o[a.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)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 l(t,e,n){for(var o,i,a=[],s=e;s<n;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},HDXh:
/*!*********************************************************************!*\
!*** ./node_modules/node-libs-browser/node_modules/buffer/index.js ***!
\*********************************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
var r=n(/*! base64-js */"H7XF"),o=n(/*! ieee754 */"kVK+"),i=n(/*! isarray */"49sm");function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return c(this,t,e,n)}function c(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=h(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|d(e,n),o=(t=s(t,r)).write(e,n);o!==r&&(t=t.slice(0,o));return t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|p(e.length);return 0===(t=s(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?s(t,0):h(t,e);if("Buffer"===e.type&&i(e.data))return h(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(l(e),t=s(t,e<0?0:0|p(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function h(t,e){var n=e.length<0?0:0|p(e.length);t=s(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function p(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function d(t,e){if(u.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 U(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return W(t).length;default:if(r)return U(t).length;e=(""+e).toLowerCase(),r=!0}}function m(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.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 O(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return I(this,e,n);case"base64":return S(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}}function v(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,r,o){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=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:y(t,e,n,r,o);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,r,o);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,o){var i,a=1,s=t.length,u=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;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var l=-1;for(i=n;i<s;i++)if(c(t,i)===c(e,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*a}else-1!==l&&(i-=i-l),l=-1}else for(n+u>s&&(n=s-u),i=n;i>=0;i--){for(var f=!0,h=0;h<u;h++)if(c(t,i+h)!==c(e,h)){f=!1;break}if(f)return i}return-1}function b(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function w(t,e,n,r){return z(U(e,t.length-n),t,n,r)}function x(t,e,n,r){return z(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function _(t,e,n,r){return x(t,e,n,r)}function E(t,e,n,r){return z(W(e),t,n,r)}function C(t,e,n,r){return z(function(t,e){for(var n,r,o,i=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i,a,s,u,c=t[o],l=null,f=c>239?4:c>223?3:c>191?2:1;if(o+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,n){return c(null,t,e,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,n){return function(t,e,n,r){return l(e),e<=0?s(t,e):void 0!==n?"string"==typeof r?s(t,e).fill(n,r):s(t,e).fill(n):s(t,e)}(null,t,e,n)},u.allocUnsafe=function(t){return f(null,t)},u.allocUnsafeSlow=function(t){return f(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,o=0,i=Math.min(n,r);o<i;++o)if(t[o]!==e[o]){n=t[o],r=e[o];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!i(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=u.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var a=t[n];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,o),o+=a.length}return r},u.byteLength=d,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?k(this,0,t):m.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.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+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,n,r,o){if(!u.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===o&&(o=this.length),e<0||n>t.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&e>=n)return 0;if(r>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var i=(o>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),s=Math.min(i,a),c=this.slice(r,o),l=t.slice(e,n),f=0;f<s;++f)if(c[f]!==l[f]){i=c[f],a=l[f];break}return i<a?-1:a<i?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":return x(this,t,e,n);case"latin1":case"binary":return _(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function T(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function I(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function O(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var o="",i=e;i<n;++i)o+=L(t[i]);return o}function R(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function A(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,r,o,i){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<i)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function N(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);o<i;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function P(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);o<i;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function M(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,i){return i||M(t,0,n,4),o.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,i){return i||M(t,0,n,8),o.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=u.prototype;else{var o=e-t;n=new u(o,void 0);for(var i=0;i<o;++i)n[i]=this[i+t]}return n},u.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},u.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},u.prototype.readUInt8=function(t,e){return e||A(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||A(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||A(t,2,this.length),this[t]<<8|this[t+1]},u.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]},u.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])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},u.prototype.readInt8=function(t,e){return e||A(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.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},u.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},u.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},u.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]},u.prototype.readFloatLE=function(t,e){return e||A(t,4,this.length),o.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||A(t,4,this.length),o.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||A(t,8,this.length),o.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||A(t,8,this.length),o.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||D(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},u.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||D(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):P(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);D(this,t,e,n,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i<n&&(a*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);D(this,t,e,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):P(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},u.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<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=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<r-n&&(r=t.length-e+n);var o,i=r-n;if(this===t&&n<e&&e<r)for(o=i-1;o>=0;--o)t[o+e]=this[o+n];else if(i<1e3||!u.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+i),e);return i},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var i;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(i=e;i<n;++i)this[i]=t;else{var a=u.isBuffer(t)?t:U(new u(t,r).toString()),s=a.length;for(i=0;i<n-e;++i)this[i+e]=a[i%s]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function L(t){return t<16?"0"+t.toString(16):t.toString(16)}function U(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.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;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function W(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 z(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}}).call(this,n(/*! ./../../../@umijs/deps/compiled/webpack/4/global.js */"IyRk"))},IO3U:
/*!*******************************************************!*\
!*** ./src/components/CheckPeople/index.less?modules ***!
\*******************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports={wrp:"wrp___1U2de"}},Ib8C:
/*!****************************************!*\
!*** ./node_modules/crypto-js/core.js ***!
\****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){(function(e){var r;t.exports=(r=r||function(t,r){var o;if("undefined"!=typeof window&&window.crypto&&(o=window.crypto),"undefined"!=typeof self&&self.crypto&&(o=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(o=globalThis.crypto),!o&&"undefined"!=typeof window&&window.msCrypto&&(o=window.msCrypto),!o&&void 0!==e&&e.crypto&&(o=e.crypto),!o)try{o=n(/*! crypto */4)}catch(t){}var i=function(){if(o){if("function"==typeof o.getRandomValues)try{return o.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof o.randomBytes)try{return o.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),s={},u=s.lib={},c=u.Base={extend:function(t){var e=a(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},l=u.WordArray=c.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||h).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;i<o;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var s=0;s<o;s+=4)e[r+s>>>2]=n[s>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=c.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(i());return new l.init(e,t)}}),f=s.enc={},h=f.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new l.init(n,e/2)}},p=f.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new l.init(n,e)}},d=f.Utf8={stringify:function(t){try{return decodeURIComponent(escape(p.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return p.parse(unescape(encodeURIComponent(t)))}},m=u.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n,r=this._data,o=r.words,i=r.sigBytes,a=this.blockSize,s=i/(4*a),u=(s=e?t.ceil(s):t.max((0|s)-this._minBufferSize,0))*a,c=t.min(4*u,i);if(u){for(var f=0;f<u;f+=a)this._doProcessBlock(o,f);n=o.splice(0,u),r.sigBytes-=c}return new l.init(n,c)},clone:function(){var t=c.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),v=(u.Hasher=m.extend({cfg:c.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){m.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new v.HMAC.init(t,n).finalize(e)}}}),s.algo={});return s}(Math),r)}).call(this,n(/*! ./../@umijs/deps/compiled/webpack/4/global.js */"IyRk"))},K3mO:
/*!******************************************!*\
!*** ./node_modules/crypto-js/evpkdf.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i,a,s,u,c,l;t.exports=(l=n(/*! ./core */"Ib8C"),n(/*! ./sha1 */"3y9D"),n(/*! ./hmac */"WYAk"),o=(r=l).lib,i=o.Base,a=o.WordArray,s=r.algo,u=s.MD5,c=s.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:u,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n,r=this.cfg,o=r.hasher.create(),i=a.create(),s=i.words,u=r.keySize,c=r.iterations;s.length<u;){n&&o.update(n),n=o.update(t).finalize(e),o.reset();for(var l=1;l<c;l++)n=o.finalize(n),o.reset();i.concat(n)}return i.sigBytes=4*u,i}}),r.EvpKDF=function(t,e,n){return c.create(n).compute(t,e)},l.EvpKDF)},KhGG:
/*!*********************************************!*\
!*** ./src/components/UploadFile/index.tsx ***!
\*********************************************/
/*! exports provided: decrypt, uploadFile, UploadFile, default */
/*! exports used: decrypt, default, uploadFile */function(t,e,n){"use strict";n.d(e,"a",(function(){return E})),n.d(e,"c",(function(){return C}));var r=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/extends */"0Owb"),o=(n(/*! antd/es/message/style */"miYZ"),n(/*! antd/es/message */"tsqr")),i=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/toConsumableArray */"oBTY"),a=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray */"tJVT"),s=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties */"PpiC"),u=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2 */"k1fw"),c=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator */"9og8"),l=(n(/*! antd/es/upload/style */"DZo9"),n(/*! antd/es/upload */"8z0m")),f=n(/*! ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator */"WmNS"),h=n.n(f),p=n(/*! react */"q1tI"),d=n.n(p),m=n(/*! @/utils/fetch */"ErOA"),v=n(/*! crypto-js */"NFKh"),g=n.n(v),y=n(/*! uuid */"7Cbv"),b=n(/*! umi */"9kvl"),w=n(/*! ali-oss */"mxV5"),x=n.n(w),_=l.a.Dragger,E=function(t){var e=g.a.enc.Utf8.parse("bf3c199c2470cb477d907b1e0917c17b"),n=g.a.enc.Utf8.parse("5183666c72eec9e4"),r=g.a.AES.decrypt(t,e,{iv:n,mode:g.a.mode.CBC});return r.toString(g.a.enc.Utf8)},C=function(){var t=Object(c.a)(h.a.mark((function t(e,n,r){var o,i,a,s,c,l,f,p,d;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.file_name=e.name,t.next=3,Object(m.a)("/api/buckets/get_upload_token.json",{method:"get"});case 3:return f=t.sent,console.log("decrypt(res.data):",E(f.data)),f.data=JSON.parse(E(f.data)),p=Object(y.a)(),d=new x.a({endpoint:null==f||null===(o=f.data)||void 0===o?void 0:o.end_point,region:null==f||null===(i=f.data)||void 0===i?void 0:i.region,accessKeyId:null==f||null===(a=f.data)||void 0===a?void 0:a.access_key_id,accessKeySecret:null==f||null===(s=f.data)||void 0===s?void 0:s.access_key_secret,bucket:null==f||null===(c=f.data)||void 0===c?void 0:c.bucket,stsToken:null==f||null===(l=f.data)||void 0===l?void 0:l.security_token}),t.abrupt("return",new Promise((function(t,o){var i;d.multipartUpload("".concat(p),new Blob([e],{type:e.type}),Object(u.a)(Object(u.a)({timeout:2e5,partSize:102400},r),{},{callback:{url:null==f||null===(i=f.data)||void 0===i?void 0:i.callback_url,host:null==f?void 0:f.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&"+Object(m.e)(n)}})).then((function(n){var r;e.response=null===(r=n.data)||void 0===r?void 0:r.data,t(null==n?void 0:n.data)})).catch((function(t){o(t),console.log("err:",t)}))})));case 9:case"end":return t.stop()}}),t)})));return function(e,n,r){return t.apply(this,arguments)}}();e.b=Object(b.a)((function(t){var e=t.loading,n=t.globalSetting,r=t.user;return{globalSetting:n,loading:e.models.competitions,user:r}}))((function(t){var e,n=t.user,u=t.cancelUpload,l=Object(s.a)(t,["user","cancelUpload"]),f=Object(p.useState)([]),v=Object(a.a)(f,2),g=v[0],b=v[1],w=Object(p.useState)(),C=Object(a.a)(w,2),S=C[0],k=C[1],T={onRemove:function(t){b(Object(i.a)(g.filter((function(e){return e.name!==t.name})))),l.onChange(g.filter((function(e){return e.name!==t.name})))},disabled:l.disabled,multiple:!0,fileList:null==g?void 0:g.map((function(t){return t.file})),customRequest:function(){},beforeUpload:(e=Object(c.a)(h.a.mark((function t(e){var n;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=l.maxSize||1073741824,!g.filter((function(t){return t.name===e.name})).length){t.next=4;break}return o.b.info("".concat(e.name,"已存在,请重新选择")),t.abrupt("return");case 4:if(!((null==e?void 0:e.size)>n)){t.next=7;break}return o.b.info("文件超过".concat(n/1024/1024/1024,"GB不符合上传要求")),t.abrupt("return",!1);case 7:return g.push({name:e.name,file:e}),b(Object(i.a)(g)),l.onChange(g),t.abrupt("return",!1);case 11:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)})},I=function(){var t=Object(c.a)(h.a.mark((function t(e,n){var r,a,s,u,c,f,p,d,v;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n.file_name=e.name,p=e.name,t.next=4,Object(m.a)("/api/buckets/get_upload_token_for_big_files.json",{method:"get"});case 4:if((d=t.sent).data=JSON.parse(E(d.data)),0===(null==d?void 0:d.status)){t.next=12;break}return g[g.findIndex((function(t){return t.name===p}))].status="error",g[g.findIndex((function(t){return t.name===p}))].file.status="error",l.onChange(g),o.b.warn("上传失败,请重新尝试"),t.abrupt("return");case 12:return S=new x.a({endpoint:null==d||null===(r=d.data)||void 0===r?void 0:r.end_point,region:null==d||null===(a=d.data)||void 0===a?void 0:a.region,accessKeyId:null==d||null===(s=d.data)||void 0===s?void 0:s.access_key_id,accessKeySecret:null==d||null===(u=d.data)||void 0===u?void 0:u.access_key_secret,bucket:null==d||null===(c=d.data)||void 0===c?void 0:c.bucket,stsToken:null==d||null===(f=d.data)||void 0===f?void 0:f.security_token}),console.log(e,"file"),k(S),v=Object(y.a)(),t.abrupt("return",new Promise((function(t,r){try{var a;S.multipartUpload("".concat(l.identifier,"/").concat(v).concat(p.indexOf(".")>-1?"."+p.split(".").pop():""),new Blob([e.file],{type:e.file.type}),{timeout:36e5,partSize:1002400,progress:function(t,e,n){try{console.log("进度",t,e,n);var r=g.findIndex((function(t){return t.name===p}));g[r].file.percent=100*t,g[r].tempCheckpoint=e,b(Object(i.a)(g))}catch(t){}},checkpoint:g[g.findIndex((function(t){return t.name===p}))].tempCheckpoint,callback:{customValue:{id:p+""},url:null==d||null===(a=d.data)||void 0===a?void 0:a.callback_url,host:null==d?void 0:d.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&"+Object(m.e)(n)}}).then((function(n){var r,i=g.findIndex((function(t){return t.name===p})),a="done";if(0===(null===(r=n.data)||void 0===r?void 0:r.status)){var s;e.response=null===(s=n.data)||void 0===s?void 0:s.data;var u=g.findIndex((function(t){return t.name===p}));g[u].status="done",g[u].file.status="done"}else{var c;o.b.warn(null===(c=n.data)||void 0===c?void 0:c.message),a="error"}g[i].status=a,g[i].file.status=a,l.onChange(g),t(null==n?void 0:n.data)})).catch((function(t){g[g.findIndex((function(t){return t.name===p}))].status="error",g[g.findIndex((function(t){return t.name===p}))].file.status="error",o.b.warn("上传失败,请重新尝试"),b(Object(i.a)(g)),l.onChange(g),r(t),console.log("err:",t)}))}catch(t){}})));case 17:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}();return Object(p.useEffect)((function(){g.every((function(t){return"done"===t||"error"===t}))&&l.onComplete(g)}),[g]),Object(p.useEffect)((function(){var t;u&&(null===(t=S)||void 0===t||t.cancel())}),[u]),Object(p.useEffect)((function(){l.uploading&&g.map(function(){var t=Object(c.a)(h.a.mark((function t(e){var r;return h.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.status&&"error"!==e.status||u){t.next=6;break}return e.status="uploading",e.file.status="uploading",t.next=5,I(e,{login:null==n||null===(r=n.userInfo)||void 0===r?void 0:r.login,container_type:l.container_type,container_id:l.container_id,description:l.description});case 5:t.sent;case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}())}),[l.uploading]),d.a.createElement(_,Object(r.a)({},T,{height:l.height,className:l.className}),d.a.createElement("p",{className:"ant-upload-hint"},l.text||"拖拽文件或者点击上传"))}))},KmYQ:
/*!***************************************************!*\
!*** ./node_modules/crypto-js/pad-zeropadding.js ***!
\***************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),r.pad.ZeroPadding={pad:function(t,e){var n=4*e;t.clamp(),t.sigBytes+=n-(t.sigBytes%n||n)},unpad:function(t){var e=t.words,n=t.sigBytes-1;for(n=t.sigBytes-1;n>=0;n--)if(e[n>>>2]>>>24-n%4*8&255){t.sigBytes=n+1;break}}},r.pad.ZeroPadding)},MlIO:
/*!********************************************!*\
!*** ./node_modules/crypto-js/x64-core.js ***!
\********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i,a,s,u;t.exports=(u=n(/*! ./core */"Ib8C"),o=(r=u).lib,i=o.Base,a=o.WordArray,(s=r.x64={}).Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),s.WordArray=i.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;r<e;r++){var o=t[r];n.push(o.high),n.push(o.low)}return a.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;r<n;r++)e[r]=e[r].clone();return t}}),u)},NFKh:
/*!*****************************************!*\
!*** ./node_modules/crypto-js/index.js ***!
\*****************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./x64-core */"MlIO"),n(/*! ./lib-typedarrays */"F+F2"),n(/*! ./enc-utf16 */"qM6L"),n(/*! ./enc-base64 */"ETIr"),n(/*! ./enc-base64url */"wbyO"),n(/*! ./md5 */"cv67"),n(/*! ./sha1 */"3y9D"),n(/*! ./sha256 */"lPiR"),n(/*! ./sha224 */"GRuw"),n(/*! ./sha512 */"1uat"),n(/*! ./sha384 */"uGsb"),n(/*! ./sha3 */"5hvy"),n(/*! ./ripemd160 */"ELcG"),n(/*! ./hmac */"WYAk"),n(/*! ./pbkdf2 */"e7zE"),n(/*! ./evpkdf */"K3mO"),n(/*! ./cipher-core */"OLod"),n(/*! ./mode-cfb */"ALsQ"),n(/*! ./mode-ctr */"9OqN"),n(/*! ./mode-ctr-gladman */"qu8F"),n(/*! ./mode-ofb */"S6kV"),n(/*! ./mode-ecb */"gb/T"),n(/*! ./pad-ansix923 */"qBft"),n(/*! ./pad-iso10126 */"oRuE"),n(/*! ./pad-iso97971 */"jO9C"),n(/*! ./pad-zeropadding */"KmYQ"),n(/*! ./pad-nopadding */"uGxW"),n(/*! ./format-hex */"bQjk"),n(/*! ./aes */"wZgz"),n(/*! ./tripledes */"pA7S"),n(/*! ./rc4 */"w7YG"),n(/*! ./rabbit */"E4JC"),n(/*! ./rabbit-legacy */"PVpz"),r)},OLES:
/*!*********************************************************!*\
!*** ./node_modules/rc-tooltip/es/index.js + 2 modules ***!
\*********************************************************/
/*! exports provided: default */
/*! exports used: default */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@babel/runtime/helpers/esm/typeof.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-tooltip/es/placements.js because of ./node_modules/antd/es/tooltip/placements.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/rc-trigger/es/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */function(t,e,n){"use strict";var r=n("U8pU"),o=n("VTBJ"),i=n("Ff2n"),a=n("q1tI"),s=n("uciX"),u=n("7ixt"),c=function(t){var e=t.overlay,n=t.prefixCls,r=t.id,o=t.overlayInnerStyle;return a.createElement("div",{className:"".concat(n,"-inner"),id:r,role:"tooltip",style:o},"function"==typeof e?e():e)},l=Object(a.forwardRef)((function(t,e){var n=t.overlayClassName,l=t.trigger,f=void 0===l?["hover"]:l,h=t.mouseEnterDelay,p=void 0===h?0:h,d=t.mouseLeaveDelay,m=void 0===d?.1:d,v=t.overlayStyle,g=t.prefixCls,y=void 0===g?"rc-tooltip":g,b=t.children,w=t.onVisibleChange,x=t.afterVisibleChange,_=t.transitionName,E=t.animation,C=t.placement,S=void 0===C?"right":C,k=t.align,T=void 0===k?{}:k,I=t.destroyTooltipOnHide,O=void 0!==I&&I,R=t.defaultVisible,A=t.getTooltipContainer,D=t.overlayInnerStyle,N=Object(i.a)(t,["overlayClassName","trigger","mouseEnterDelay","mouseLeaveDelay","overlayStyle","prefixCls","children","onVisibleChange","afterVisibleChange","transitionName","animation","placement","align","destroyTooltipOnHide","defaultVisible","getTooltipContainer","overlayInnerStyle"]),P=Object(a.useRef)(null);Object(a.useImperativeHandle)(e,(function(){return P.current}));var M=Object(o.a)({},N);"visible"in t&&(M.popupVisible=t.visible);var j=!1,F=!1;if("boolean"==typeof O)j=O;else if(O&&"object"===Object(r.a)(O)){var B=O.keepParent;j=!0===B,F=!1===B}return a.createElement(s.a,Object.assign({popupClassName:n,prefixCls:y,popup:function(){var e=t.arrowContent,n=void 0===e?null:e,r=t.overlay,o=t.id;return[a.createElement("div",{className:"".concat(y,"-arrow"),key:"arrow"},n),a.createElement(c,{key:"content",prefixCls:y,id:o,overlay:r,overlayInnerStyle:D})]},action:f,builtinPlacements:u.a,popupPlacement:S,ref:P,popupAlign:T,getPopupContainer:A,onPopupVisibleChange:w,afterPopupVisibleChange:x,popupTransitionName:_,popupAnimation:E,defaultPopupVisible:R,destroyPopupOnHide:j,autoDestroy:F,mouseLeaveDelay:m,popupStyle:v,mouseEnterDelay:p},M),b)}));e.a=l},OLod:
/*!***********************************************!*\
!*** ./node_modules/crypto-js/cipher-core.js ***!
\***********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./evpkdf */"K3mO"),void(r.lib.Cipher||function(t){var e=r,n=e.lib,o=n.Base,i=n.WordArray,a=n.BufferedBlockAlgorithm,s=e.enc,u=(s.Utf8,s.Base64),c=e.algo.EvpKDF,l=n.Cipher=a.extend({cfg:o.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?b:g}return function(e){return{encrypt:function(n,r,o){return t(r).encrypt(e,n,r,o)},decrypt:function(n,r,o){return t(r).decrypt(e,n,r,o)}}}}()}),f=(n.StreamCipher=l.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),e.mode={}),h=n.BlockCipherMode=o.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),p=f.CBC=function(){var t=h.extend();function e(t,e,n){var r,o=this._iv;o?(r=o,this._iv=void 0):r=this._prevBlock;for(var i=0;i<n;i++)t[e+i]^=r[i]}return t.Encryptor=t.extend({processBlock:function(t,n){var r=this._cipher,o=r.blockSize;e.call(this,t,n,o),r.encryptBlock(t,n),this._prevBlock=t.slice(n,n+o)}}),t.Decryptor=t.extend({processBlock:function(t,n){var r=this._cipher,o=r.blockSize,i=t.slice(n,n+o);r.decryptBlock(t,n),e.call(this,t,n,o),this._prevBlock=i}}),t}(),d=(e.pad={}).Pkcs7={pad:function(t,e){for(var n=4*e,r=n-t.sigBytes%n,o=r<<24|r<<16|r<<8|r,a=[],s=0;s<r;s+=4)a.push(o);var u=i.create(a,r);t.concat(u)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},m=(n.BlockCipher=l.extend({cfg:l.cfg.extend({mode:p,padding:d}),reset:function(){var t;l.reset.call(this);var e=this.cfg,n=e.iv,r=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=r.createEncryptor:(t=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,n&&n.words):(this._mode=t.call(r,this,n&&n.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),n.CipherParams=o.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),v=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,n=t.salt;return(n?i.create([1398893684,1701076831]).concat(n).concat(e):e).toString(u)},parse:function(t){var e,n=u.parse(t),r=n.words;return 1398893684==r[0]&&1701076831==r[1]&&(e=i.create(r.slice(2,4)),r.splice(0,4),n.sigBytes-=16),m.create({ciphertext:n,salt:e})}},g=n.SerializableCipher=o.extend({cfg:o.extend({format:v}),encrypt:function(t,e,n,r){r=this.cfg.extend(r);var o=t.createEncryptor(n,r),i=o.finalize(e),a=o.cfg;return m.create({ciphertext:i,key:n,iv:a.iv,algorithm:t,mode:a.mode,padding:a.padding,blockSize:t.blockSize,formatter:r.format})},decrypt:function(t,e,n,r){return r=this.cfg.extend(r),e=this._parse(e,r.format),t.createDecryptor(n,r).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),y=(e.kdf={}).OpenSSL={execute:function(t,e,n,r){r||(r=i.random(8));var o=c.create({keySize:e+n}).compute(t,r),a=i.create(o.words.slice(e),4*n);return o.sigBytes=4*e,m.create({key:o,iv:a,salt:r})}},b=n.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:y}),encrypt:function(t,e,n,r){var o=(r=this.cfg.extend(r)).kdf.execute(n,t.keySize,t.ivSize);r.iv=o.iv;var i=g.encrypt.call(this,t,e,o.key,r);return i.mixIn(o),i},decrypt:function(t,e,n,r){r=this.cfg.extend(r),e=this._parse(e,r.format);var o=r.kdf.execute(n,t.keySize,t.ivSize,e.salt);return r.iv=o.iv,g.decrypt.call(this,t,e,o.key,r)}})}()))},Og1z:
/*!****************************!*\
!*** (webpack)/4/empty.js ***!
\****************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){(function(e){t.exports=function(){var t={887:function(){}},n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={exports:{}},i=!0;try{t[e](o,o.exports,r),i=!1}finally{i&&delete n[e]}return o.exports}return r.ab=e+"/",r(887)}()}).call(this,"/")},PVpz:
/*!*************************************************!*\
!*** ./node_modules/crypto-js/rabbit-legacy.js ***!
\*************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./enc-base64 */"ETIr"),n(/*! ./md5 */"cv67"),n(/*! ./evpkdf */"K3mO"),n(/*! ./cipher-core */"OLod"),function(){var t=r,e=t.lib.StreamCipher,n=t.algo,o=[],i=[],a=[],s=n.RabbitLegacy=e.extend({_doReset:function(){var t=this._key.words,e=this.cfg.iv,n=this._X=[t[0],t[3]<<16|t[2]>>>16,t[1],t[0]<<16|t[3]>>>16,t[2],t[1]<<16|t[0]>>>16,t[3],t[2]<<16|t[1]>>>16],r=this._C=[t[2]<<16|t[2]>>>16,4294901760&t[0]|65535&t[1],t[3]<<16|t[3]>>>16,4294901760&t[1]|65535&t[2],t[0]<<16|t[0]>>>16,4294901760&t[2]|65535&t[3],t[1]<<16|t[1]>>>16,4294901760&t[3]|65535&t[0]];this._b=0;for(var o=0;o<4;o++)u.call(this);for(o=0;o<8;o++)r[o]^=n[o+4&7];if(e){var i=e.words,a=i[0],s=i[1],c=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),l=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),f=c>>>16|4294901760&l,h=l<<16|65535&c;for(r[0]^=c,r[1]^=f,r[2]^=l,r[3]^=h,r[4]^=c,r[5]^=f,r[6]^=l,r[7]^=h,o=0;o<4;o++)u.call(this)}},_doProcessBlock:function(t,e){var n=this._X;u.call(this),o[0]=n[0]^n[5]>>>16^n[3]<<16,o[1]=n[2]^n[7]>>>16^n[5]<<16,o[2]=n[4]^n[1]>>>16^n[7]<<16,o[3]=n[6]^n[3]>>>16^n[1]<<16;for(var r=0;r<4;r++)o[r]=16711935&(o[r]<<8|o[r]>>>24)|4278255360&(o[r]<<24|o[r]>>>8),t[e+r]^=o[r]},blockSize:4,ivSize:2});function u(){for(var t=this._X,e=this._C,n=0;n<8;n++)i[n]=e[n];for(e[0]=e[0]+1295307597+this._b|0,e[1]=e[1]+3545052371+(e[0]>>>0<i[0]>>>0?1:0)|0,e[2]=e[2]+886263092+(e[1]>>>0<i[1]>>>0?1:0)|0,e[3]=e[3]+1295307597+(e[2]>>>0<i[2]>>>0?1:0)|0,e[4]=e[4]+3545052371+(e[3]>>>0<i[3]>>>0?1:0)|0,e[5]=e[5]+886263092+(e[4]>>>0<i[4]>>>0?1:0)|0,e[6]=e[6]+1295307597+(e[5]>>>0<i[5]>>>0?1:0)|0,e[7]=e[7]+3545052371+(e[6]>>>0<i[6]>>>0?1:0)|0,this._b=e[7]>>>0<i[7]>>>0?1:0,n=0;n<8;n++){var r=t[n]+e[n],o=65535&r,s=r>>>16,u=((o*o>>>17)+o*s>>>15)+s*s,c=((4294901760&r)*r|0)+((65535&r)*r|0);a[n]=u^c}t[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,t[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,t[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,t[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,t[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,t[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,t[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,t[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}t.RabbitLegacy=e._createHelper(s)}(),r.RabbitLegacy)},"Re/O":
/*!****************************************************************!*\
!*** ./node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js ***!
\****************************************************************/
/*! exports provided: AdadeltaOptimizer, AdagradOptimizer, AdamOptimizer, AdamaxOptimizer, DataStorage, ENV, Environment, KernelBackend, MomentumOptimizer, Optimizer, RMSPropOptimizer, Rank, Reduction, SGDOptimizer, Tensor, TensorBuffer, Variable, abs, acos, acosh, add, addN, addStrict, all, any, argMax, argMin, asin, asinh, atan, atan2, atanh, avgPool, avgPool3d, backend, backend_util, basicLSTMCell, batchNorm, batchNorm2d, batchNorm3d, batchNorm4d, batchNormalization, batchNormalization2d, batchNormalization3d, batchNormalization4d, batchToSpaceND, booleanMaskAsync, broadcastTo, browser, buffer, cast, ceil, clipByValue, clone, complex, concat, concat1d, concat2d, concat3d, concat4d, conv1d, conv2d, conv2dTranspose, conv3d, conv3dTranspose, cos, cosh, cumsum, customGrad, deprecationWarn, depthToSpace, depthwiseConv2d, diag, disableDeprecationWarnings, dispose, disposeVariables, div, divNoNan, divStrict, dot, dropout, elu, enableDebugMode, enableProdMode, engine, env, equal, equalStrict, erf, exp, expandDims, expm1, eye, fft, fill, findBackend, findBackendFactory, floor, floorDiv, frame, fused, gather, gatherND, gather_util, getBackend, getGradient, getKernel, getKernelsForBackend, grad, grads, greater, greaterEqual, greaterEqualStrict, greaterStrict, hammingWindow, hannWindow, ifft, imag, image, inTopKAsync, io, irfft, isFinite, isInf, isNaN, keep, leakyRelu, less, lessEqual, lessEqualStrict, lessStrict, linalg, linspace, localResponseNormalization, log, log1p, logSigmoid, logSoftmax, logSumExp, logicalAnd, logicalNot, logicalOr, logicalXor, losses, matMul, math, max, maxPool, maxPool3d, maximum, maximumStrict, mean, memory, min, minimum, minimumStrict, mod, modStrict, moments, movingAverage, mul, mulStrict, multiRNNCell, multinomial, neg, nextFrame, norm, notEqual, notEqualStrict, oneHot, ones, onesLike, op, outerProduct, pad, pad1d, pad2d, pad3d, pad4d, pool, pow, powStrict, prelu, print, prod, profile, rand, randomGamma, randomNormal, randomUniform, range, ready, real, reciprocal, registerBackend, registerGradient, registerKernel, relu, relu6, removeBackend, reshape, reverse, reverse1d, reverse2d, reverse3d, reverse4d, rfft, round, rsqrt, scalar, scatterND, scatter_util, selu, separableConv2d, serialization, setBackend, setPlatform, setdiff1dAsync, sigmoid, sign, signal, sin, sinh, slice, slice1d, slice2d, slice3d, slice4d, slice_util, softmax, softplus, spaceToBatchND, sparseToDense, spectral, split, sqrt, square, squaredDifference, squaredDifferenceStrict, squeeze, stack, step, stft, stridedSlice, sub, subStrict, sum, sumOutType, tan, tanh, tensor, tensor1d, tensor2d, tensor3d, tensor4d, tensor5d, tensor6d, tensor_util, test_util, tidy, tile, time, topk, train, transpose, truncatedNormal, unregisterGradient, unregisterKernel, unsortedSegmentSum, unstack, util, valueAndGrad, valueAndGrads, variable, variableGrads, version_core, webgl, where, whereAsync, zeros, zerosLike */
/*! exports used: Tensor, Variable, add, avgPool, batchNorm, browser, clipByValue, concat, conv2d, depthwiseConv2d, div, exp, expandDims, fill, image, io, matMul, max, maxPool, mul, neg, pad, relu, reshape, scalar, separableConv2d, sigmoid, slice, slice3d, softmax, stack, sub, tensor, tensor1d, tensor2d, tensor3d, tensor4d, tidy, tile, transpose, unstack, zeros */
/*! ModuleConcatenation bailout: Module uses injected variables (global, process, Buffer) */function(t,e,n){"use strict";(function(t,r,o){n.d(e,"a",(function(){return yt})),n.d(e,"b",(function(){return Ct})),n.d(e,"c",(function(){return Qs})),n.d(e,"d",(function(){return ac})),n.d(e,"e",(function(){return zs})),n.d(e,"f",(function(){return Gf})),n.d(e,"g",(function(){return as})),n.d(e,"h",(function(){return xn})),n.d(e,"i",(function(){return Lu})),n.d(e,"j",(function(){return Vu})),n.d(e,"k",(function(){return nu})),n.d(e,"l",(function(){return ls})),n.d(e,"m",(function(){return Hn})),n.d(e,"n",(function(){return gn})),n.d(e,"o",(function(){return Sl})),n.d(e,"p",(function(){return zf})),n.d(e,"q",(function(){return Yu})),n.d(e,"r",(function(){return xc})),n.d(e,"s",(function(){return ic})),n.d(e,"t",(function(){return hu})),n.d(e,"u",(function(){return vs})),n.d(e,"v",(function(){return $n})),n.d(e,"w",(function(){return Rc})),n.d(e,"x",(function(){return ir})),n.d(e,"y",(function(){return ln})),n.d(e,"z",(function(){return Hu})),n.d(e,"A",(function(){return ws})),n.d(e,"B",(function(){return lc})),n.d(e,"C",(function(){return pc})),n.d(e,"D",(function(){return Rr})),n.d(e,"E",(function(){return ur})),n.d(e,"F",(function(){return gu})),n.d(e,"G",(function(){return un})),n.d(e,"H",(function(){return fn})),n.d(e,"I",(function(){return hn})),n.d(e,"J",(function(){return pn})),n.d(e,"K",(function(){return dn})),n.d(e,"L",(function(){return Ue})),n.d(e,"M",(function(){return cr})),n.d(e,"N",(function(){return Nc})),n.d(e,"O",(function(){return fr})),n.d(e,"P",(function(){return vn}));
/**
* @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.
* =============================================================================
*/
var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function a(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function s(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){t.done?o(t.value):new n((function(e){e(t.value)})).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function u(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}var c=function(){function t(t){this.global=t,this.flags={},this.flagRegistry={},this.urlFlags={},this.populateURLFlags()}return t.prototype.setPlatform=function(t,e){null!=this.platform&&console.warn("Platform "+this.platformName+" has already been set. Overwriting the platform with "+e+"."),this.platformName=t,this.platform=e},t.prototype.registerFlag=function(t,e,n){if(this.flagRegistry[t]={evaluationFn:e,setHook:n},null!=this.urlFlags[t]){var r=this.urlFlags[t];console.warn("Setting feature override from URL "+t+": "+r+"."),this.set(t,r)}},t.prototype.get=function(t){return t in this.flags||(this.flags[t]=this.evaluateFlag(t)),this.flags[t]},t.prototype.getNumber=function(t){return this.get(t)},t.prototype.getBool=function(t){return this.get(t)},t.prototype.getFlags=function(){return this.flags},Object.defineProperty(t.prototype,"features",{get:function(){return this.flags},enumerable:!0,configurable:!0}),t.prototype.set=function(t,e){if(null==this.flagRegistry[t])throw new Error("Cannot set flag "+t+" as it has not been registered.");this.flags[t]=e,null!=this.flagRegistry[t].setHook&&this.flagRegistry[t].setHook(e)},t.prototype.evaluateFlag=function(t){if(null==this.flagRegistry[t])throw new Error("Cannot evaluate flag '"+t+"': no evaluation function found.");return this.flagRegistry[t].evaluationFn()},t.prototype.setFlags=function(t){this.flags=Object.assign({},t)},t.prototype.reset=function(){this.flags={},this.urlFlags={},this.populateURLFlags()},t.prototype.populateURLFlags=function(){var t=this;if(void 0!==this.global&&void 0!==this.global.location&&void 0!==this.global.location.search){var e,n,r=(e=this.global.location.search,n={},e.replace(/[?&]([^=?&]+)(?:=([^&]*))?/g,(function(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];return l(n,e[0],e[1]),e.join("=")})),n);"tfjsflags"in r&&r.tfjsflags.split(",").forEach((function(e){var n=e.split(":"),r=n[0],o=n[1];t.urlFlags[r]=function(t,e){if("true"===(e=e.toLowerCase())||"false"===e)return"true"===e;if(""+ +e===e)return+e;throw new Error("Could not parse value flag value "+e+" for flag "+t+".")}(r,o)}))}},t}();function l(t,e,n){t[decodeURIComponent(e)]=decodeURIComponent(n||"")}function f(){return h}var h=null,p=new Map,d=new Map;function m(t,e){var n=b(t,e);return p.get(n)}function v(t){for(var e=p.entries(),n=[];;){var r=e.next(),o=r.done,i=r.value;if(o)break;var a=i[0],s=i[1];a.split("_")[0]===t&&n.push(s)}return n}function g(t){var e=t.kernelName,n=t.backendName,r=b(e,n);if(p.has(r))throw new Error("The kernel '"+e+"' for backend '"+n+"' is already registered");p.set(r,t)}function y(t){var e=t.kernelName;d.has(e)&&console.warn("Overriding the gradient for '"+e+"'"),d.set(e,t)}function b(t,e){return e+"_"+t}function w(t){for(var e=t.length,n=0,r=0;e>0;)r=Math.random()*e|0,n=t[--e],t[e]=t[r],t[r]=n}function x(t,e,n){return Math.max(t,Math.min(e,n))}function _(t){return t%2==0?t:t+1}function E(t){for(var e=0,n=0;n<t.length;n++)e+=t[n];return e}function C(t,e){if(!t)throw new Error("string"==typeof e?e:e())}function S(t,e,n){void 0===n&&(n=""),C(O(t,e),(function(){return n+" Shapes "+t+" and "+e+" must match"}))}function k(t){C(null!=t,(function(){return"The input to the tensor constructor must be a non-null value."}))}function T(t,e,n){if(void 0===e&&(e=[]),void 0===n&&(n=!1),null==e&&(e=[]),Array.isArray(t)||V(t)&&!n)for(var r=0;r<t.length;++r)T(t[r],e,n);else e.push(t);return e}function I(t){if(0===t.length)return 1;for(var e=t[0],n=1;n<t.length;n++)e*=t[n];return e}function O(t,e){if(t===e)return!0;if(null==t||null==e)return!1;if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!==e[n])return!1;return!0}function R(t){return t%1==0}function A(t){if(null!=Math.tanh)return Math.tanh(t);if(t===1/0)return 1;if(t===-1/0)return-1;var e=Math.exp(2*t);return(e-1)/(e+1)}function D(t){var e=Math.ceil(Math.sqrt(t));return[e,Math.ceil(t/e)]}function N(t,e){return e<=t.length?t:t+" ".repeat(e-t.length)}function P(t,e,n){return void 0===e&&(e=function(t){return 0}),new Promise((function(r,o){var i=0,a=function(){if(t())r();else{i++;var s=e(i);null!=n&&i>=n?o():setTimeout(a,s)}};a()}))}function M(t,e){for(var n=1,r=-1,o=0;o<t.length;++o)if(t[o]>=0)n*=t[o];else if(-1===t[o]){if(-1!==r)throw Error("Shapes can only have 1 implicit size. Found -1 at dim "+r+" and dim "+o);r=o}else if(t[o]<0)throw Error("Shapes can not be < 0. Found "+t[o]+" at dim "+o);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);var i=t.slice();return i[r]=e/n,i}function j(t,e){var n=e.length;return C((t=null==t?e.map((function(t,e){return e})):[].concat(t)).every((function(t){return t>=-n&&t<n})),(function(){return"All values in axis param must be in range [-"+n+", "+n+") but got axis "+t})),C(t.every((function(t){return R(t)})),(function(){return"All values in axis param must be integers but got axis "+t})),t.map((function(t){return t<0?n+t:t}))}function F(t,e){for(var n=[],r=[],o=null!=e&&Array.isArray(e)&&0===e.length,i=null==e||o?null:j(e,t).sort(),a=0,s=0;s<t.length;++s){if(null!=i){if(i[a]===s&&1!==t[s])throw new Error("Can't squeeze axis "+s+" since its dim '"+t[s]+"' is not 1");(null==i[a]||i[a]>s)&&1===t[s]&&(n.push(t[s]),r.push(s)),i[a]<=s&&a++}1!==t[s]&&(n.push(t[s]),r.push(s))}return{newShape:n,keptDims:r}}function B(t,e){var 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}function L(t,e){var 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}function U(t,e){for(var n=0;n<t.length;n++){var r=t[n];if(isNaN(r)||!isFinite(r))throw Error("A tensor of type "+e+" being uploaded contains "+r+".")}}function W(t){return"bool"===t||"complex64"===t||"float32"===t||"int32"===t||"string"===t}function z(t,e){return!("complex64"===e||"float32"===e&&"complex64"!==t||"int32"===e&&"float32"!==t&&"complex64"!==t||"bool"===e&&"bool"===t)}function V(t){return t instanceof Float32Array||t instanceof Int32Array||t instanceof Uint8Array}function q(t){if("float32"===t||"int32"===t)return 4;if("complex64"===t)return 8;if("bool"===t)return 1;throw new Error("Unknown dtype "+t)}function G(t){if(null==t)return 0;var e=0;return t.forEach((function(t){return e+=t.length})),e}function H(t){return"string"==typeof t||t instanceof String}function X(t){return"boolean"==typeof t}function K(t){return"number"==typeof t}function Y(t){return Array.isArray(t)?Y(t[0]):t instanceof Float32Array?"float32":t instanceof Int32Array||t instanceof Uint8Array?"int32":K(t)?"float32":H(t)?"string":X(t)?"bool":"float32"}function $(t){return!!(t&&t.constructor&&t.call&&t.apply)}function J(t,e){for(var n=e;n<t;++n)if(t%n==0)return n;return t}function Q(t){var e=t.length;if(e<2)return[];var n=new Array(e-1);n[e-2]=t[e-1];for(var r=e-3;r>=0;--r)n[r]=n[r+1]*t[r+1];return n}function Z(t,e,n){if("string"===e)throw new Error("Cannot convert a string[] to a TypedArray");if(Array.isArray(t)&&(t=T(t)),n&&U(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){for(var r=new Uint8Array(t.length),o=0;o<r.length;++o)0!==Math.round(t[o])&&(r[o]=1);return r}throw new Error("Unknown data type "+e)}function tt(t,e){if(0===t.length)return e[0];var n=t.reduce((function(t,e){return t*e}));if(0===n)return[];if(n!==e.length)throw new Error("["+t+"] does not match the input size.");return function t(e,n,r){var o=new Array;if(1===n.length)for(var i=n[0],a=0;a<i;a++)o[a]=r[e+a];else{i=n[0];var s=n.slice(1),u=s.reduce((function(t,e){return t*e}));for(a=0;a<i;a++)o[a]=t(e+a*u,s,r)}return o}(0,t,e)}function et(t,e){for(var n=nt(t,e),r=0;r<n.length;r++)n[r]=1;return n}function nt(t,e){if(null==e||"float32"===e||"complex64"===e)return new Float32Array(t);if("int32"===e)return new Int32Array(t);if("bool"===e)return new Uint8Array(t);throw new Error("Unknown data type "+e)}function rt(){return f().platform.now()}function ot(t){t.forEach((function(e){C(Number.isInteger(e)&&e>=0,(function(){return"Tensor must have a shape comprised of positive integers but got shape ["+t+"]."}))}))}function it(t,e){return void 0===e&&(e="utf-8"),e=e||"utf-8",f().platform.encode(t,e)}function at(t,e){return void 0===e&&(e="utf-8"),e=e||"utf-8",f().platform.decode(t,e)}function st(t,e,n){if(0===e)return 0;if(1===e)return t[0];for(var r=t[t.length-1],o=0;o<t.length-1;++o)r+=n[o]*t[o];return r}function ut(t,e,n){if(0===e)return[];if(1===e)return[t];for(var r=new Array(e),o=0;o<r.length-1;++o)r[o]=Math.floor(t/n[o]),t-=r[o]*n[o];return r[r.length-1]=t,r}Object.freeze({shuffle:w,clamp:x,nearestLargerEven:_,sum:E,randUniform:function(t,e){var n=Math.random();return e*n+(1-n)*t},distSquared:function(t,e){for(var n=0,r=0;r<t.length;r++){var o=Number(t[r])-Number(e[r]);n+=o*o}return n},assert:C,assertShapesMatch:S,assertNonNull:k,flatten:T,sizeFromShape:I,isScalarShape:function(t){return 0===t.length},arraysEqual:O,isInt:R,tanh:A,sizeToSquarishShape:D,createShuffledIndices:function(t){for(var e=new Uint32Array(t),n=0;n<t;++n)e[n]=n;return w(e),e},rightPad:N,repeatedTry:P,inferFromImplicitShape:M,parseAxisParam:j,squeezeShape:F,getTypedArrayFromDType:B,getArrayFromDType:L,checkConversionForErrors:U,isValidDtype:W,hasEncodingLoss:z,isTypedArray:V,bytesPerElement:q,bytesFromStringArray:G,isString:H,isBoolean:X,isNumber:K,inferDtype:Y,isFunction:$,nearestDivisor:J,computeStrides:Q,toTypedArray:Z,toNestedArray:tt,makeOnesTypedArray:et,makeZerosTypedArray:nt,now:rt,assertNonNegativeIntegerDimensions:ot,fetch:function(t,e){return f().platform.fetch(t,e)},encodeString:it,decodeString:at,locToIndex:st,indexToLoc:ut});var ct=function(){function t(t,e){this.backendTimer=t,this.logger=e,null==e&&(this.logger=new lt)}return t.prototype.profileKernel=function(t,e,n){var r,o=this,i=this.backendTimer.time((function(){r=n()}));return r.forEach((function(n){n.data().then((function(r){!function(t,e,n){if("float32"!==e)return!1;for(var r=0;r<t.length;r++){var o=t[r];if(isNaN(o)||!isFinite(o))return console.warn("Found "+o+" in the result of '"+n+"'"),!0}}(r,n.dtype,t),i.then((function(i){var a="";null!=i.getExtraProfileInfo&&(a=i.getExtraProfileInfo()),o.logger.logKernelProfile(t,n,r,i.kernelMs,e,a)}))}))})),r},t}(),lt=function(){function t(){}return t.prototype.logKernelProfile=function(t,e,n,r,o,i){var a="number"==typeof r?N(r+"ms",9):r.error,s=N(t,25),u=e.rank,c=e.size,l=N(e.shape.toString(),14),f="";for(var h in o){var p=o[h].shape||e.shape,d=p.length;f+=h+": "+d+"D "+(d>0?p:"")+" "}console.log("%c"+s+"\t%c"+a+"\t%c"+u+"D "+l+"\t%c"+c+"\t%c"+f+"\t%c"+i,"font-weight:bold","color:red","color:blue","color: orange","color: green","color: steelblue")},t}();function ft(t,e,n){return N(Array.isArray(t)?parseFloat(t[0].toFixed(7))+" + "+parseFloat(t[1].toFixed(7))+"j":H(t)?"'"+t+"'":"bool"===n?ht(t):parseFloat(t.toFixed(7)).toString(),e)}function ht(t){return 0===t?"false":"true"}function pt(t){for(var e=[],n=0;n<t.length;n+=2)e.push([t[n],t[n+1]]);return e}var dt=function(){function t(t,e,n){var r=this;if(this.dtype=e,this.shape=t.slice(),this.size=I(t),null!=n){var o=n.length;C(o===this.size,(function(){return"Length of values '"+o+"' does not match the size inferred by the shape '"+r.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||L(e,this.size),this.strides=Q(t)}return t.prototype.set=function(t){for(var e=this,n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];0===n.length&&(n=[0]),C(n.length===this.rank,(function(){return"The number of provided coordinates ("+n.length+") must match the rank ("+e.rank+")"}));var o=this.locToIndex(n);this.values[o]=t},t.prototype.get=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];0===t.length&&(t=[0]);for(var n=0,r=0,o=t;r<o.length;r++){var i=o[r];if(i<0||i>=this.shape[n]){var a="Requested out of range element at "+t+". Buffer shape="+this.shape;throw new Error(a)}n++}for(var s=t[t.length-1],u=0;u<t.length-1;++u)s+=this.strides[u]*t[u];return this.values[s]},t.prototype.locToIndex=function(t){if(0===this.rank)return 0;if(1===this.rank)return t[0];for(var e=t[t.length-1],n=0;n<t.length-1;++n)e+=this.strides[n]*t[n];return e},t.prototype.indexToLoc=function(t){if(0===this.rank)return[];if(1===this.rank)return[t];for(var e=new Array(this.shape.length),n=0;n<e.length-1;++n)e[n]=Math.floor(t/this.strides[n]),t-=e[n]*this.strides[n];return e[e.length-1]=t,e},Object.defineProperty(t.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.toTensor=function(){return mt().makeTensor(this.values,this.shape,this.dtype)},t}(),mt=null,vt=null,gt=null,yt=function(){function t(t,e,n,r){this.kept=!1,this.isDisposedInternal=!1,this.shape=t.slice(),this.dtype=e||"float32",this.size=I(t),this.strides=Q(t),this.dataId=n,this.id=r,this.rankType=this.rank<5?this.rank.toString():"higher"}return t.prototype.flatten=function(){return this.throwIfDisposed(),this.as1D()},t.prototype.asScalar=function(){return this.throwIfDisposed(),C(1===this.size,(function(){return"The array must have only 1 element."})),this.reshape([])},t.prototype.as1D=function(){return this.throwIfDisposed(),this.reshape([this.size])},t.prototype.as2D=function(t,e){return this.throwIfDisposed(),this.reshape([t,e])},t.prototype.as3D=function(t,e,n){return this.throwIfDisposed(),this.reshape([t,e,n])},t.prototype.as4D=function(t,e,n,r){return this.throwIfDisposed(),this.reshape([t,e,n,r])},t.prototype.as5D=function(t,e,n,r,o){return this.throwIfDisposed(),this.reshape([t,e,n,r,o])},t.prototype.asType=function(t){return this.throwIfDisposed(),vt.cast(this,t)},Object.defineProperty(t.prototype,"rank",{get:function(){return this.shape.length},enumerable:!0,configurable:!0}),t.prototype.buffer=function(){return s(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,vt.buffer(this.shape,this.dtype,t)]}}))}))},t.prototype.bufferSync=function(){return vt.buffer(this.shape,this.dtype,this.dataSync())},t.prototype.array=function(){return s(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return[4,this.data()];case 1:return t=e.sent(),[2,tt(this.shape,t)]}}))}))},t.prototype.arraySync=function(){return tt(this.shape,this.dataSync())},t.prototype.data=function(){return s(this,void 0,void 0,(function(){var t,e;return u(this,(function(n){switch(n.label){case 0:return this.throwIfDisposed(),t=mt().read(this.dataId),"string"!==this.dtype?[3,2]:[4,t];case 1:e=n.sent();try{return[2,e.map((function(t){return at(t)}))]}catch(t){throw new Error("Failed to decode the string bytes into utf-8. To get the original bytes, call tensor.bytes().")}n.label=2;case 2:return[2,t]}}))}))},t.prototype.dataSync=function(){this.throwIfDisposed();var t=mt().readSync(this.dataId);if("string"===this.dtype)try{return t.map((function(t){return at(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},t.prototype.bytes=function(){return s(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return this.throwIfDisposed(),[4,mt().read(this.dataId)];case 1:return t=e.sent(),"string"===this.dtype?[2,t]:[2,new Uint8Array(t.buffer)]}}))}))},t.prototype.dispose=function(){this.isDisposed||(mt().disposeTensor(this),this.isDisposedInternal=!0)},Object.defineProperty(t.prototype,"isDisposed",{get:function(){return this.isDisposedInternal},enumerable:!0,configurable:!0}),t.prototype.throwIfDisposed=function(){if(this.isDisposed)throw new Error("Tensor is disposed.")},t.prototype.toFloat=function(){return this.asType("float32")},t.prototype.toInt=function(){return this.asType("int32")},t.prototype.toBool=function(){return this.asType("bool")},t.prototype.print=function(t){return void 0===t&&(t=!1),vt.print(this,t)},t.prototype.reshape=function(t){return this.throwIfDisposed(),vt.reshape(this,t)},t.prototype.reshapeAs=function(t){return this.throwIfDisposed(),this.reshape(t.shape)},t.prototype.expandDims=function(t){return void 0===t&&(t=0),vt.expandDims(this,t)},t.prototype.cumsum=function(t,e,n){return void 0===t&&(t=0),void 0===e&&(e=!1),void 0===n&&(n=!1),vt.cumsum(this,t,e,n)},t.prototype.squeeze=function(t){return this.throwIfDisposed(),vt.squeeze(this,t)},t.prototype.clone=function(){return this.throwIfDisposed(),vt.clone(this)},t.prototype.oneHot=function(t,e,n){return this.throwIfDisposed(),vt.oneHot(this,t,e,n)},t.prototype.toString=function(t){return void 0===t&&(t=!1),function(t,e,n,r){var o=Q(e),i=function(t,e,n,r){var o=I(e),i=r[r.length-1],a=new Array(i).fill(0),s=e.length,u="complex64"===n?pt(t):t;if(s>1)for(var c=0;c<o/i;c++)for(var l=c*i,f=0;f<i;f++)a[f]=Math.max(a[f],ft(u[l+f],0,n).length);return a}(t,e,n,o),a=e.length,s=function t(e,n,r,o,i,a){void 0===a&&(a=!0);var s="complex64"===r?2:1,u=n[0],c=n.length;if(0===c)return"complex64"===r?[ft(pt(e)[0],0,r)]:"bool"===r?[ht(e[0])]:[e[0].toString()];if(1===c){if(u>20){var l=3*s,f=Array.from(e.slice(0,l)),h=Array.from(e.slice((u-3)*s,u*s));return"complex64"===r&&(f=pt(f),h=pt(h)),["["+f.map((function(t,e){return ft(t,i[e],r)})).join(", ")+", ..., "+h.map((function(t,e){return ft(t,i[u-3+e],r)})).join(", ")+"]"]}return["["+("complex64"===r?pt(e):Array.from(e)).map((function(t,e){return ft(t,i[e],r)})).join(", ")+"]"]}var p=n.slice(1),d=o.slice(1),m=o[0]*s,v=[];if(u>20){for(var g=0;g<3;g++){var y=(b=g*m)+m;v.push.apply(v,t(e.slice(b,y),p,r,d,i,!1))}for(v.push("..."),g=u-3;g<u;g++)y=(b=g*m)+m,v.push.apply(v,t(e.slice(b,y),p,r,d,i,g===u-1))}else for(g=0;g<u;g++){var b;y=(b=g*m)+m,v.push.apply(v,t(e.slice(b,y),p,r,d,i,g===u-1))}var w=2===c?",":"";for(v[0]="["+v[0]+w,g=1;g<v.length-1;g++)v[g]=" "+v[g]+w;var x=",\n";for(g=2;g<c;g++)x+="\n";return v[v.length-1]=" "+v[v.length-1]+"]"+(a?"":x),v}(t,e,n,o,i),u=["Tensor"];return r&&(u.push(" dtype: "+n),u.push(" rank: "+a),u.push(" shape: ["+e+"]"),u.push(" values:")),u.push(s.map((function(t){return" "+t})).join("\n")),u.join("\n")}(this.dataSync(),this.shape,this.dtype,t)},t.prototype.tile=function(t){return this.throwIfDisposed(),vt.tile(this,t)},t.prototype.gather=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),vt.gather(this,t,e)},t.prototype.matMul=function(t,e,n){return void 0===e&&(e=!1),void 0===n&&(n=!1),this.throwIfDisposed(),vt.matMul(this,t,e,n)},t.prototype.dot=function(t){return this.throwIfDisposed(),vt.dot(this,t)},t.prototype.norm=function(t,e,n){return void 0===t&&(t="euclidean"),void 0===e&&(e=null),void 0===n&&(n=!1),this.throwIfDisposed(),vt.norm(this,t,e,n)},t.prototype.slice=function(t,e){return this.throwIfDisposed(),vt.slice(this,t,e)},t.prototype.reverse=function(t){return this.throwIfDisposed(),vt.reverse(this,t)},t.prototype.concat=function(e,n){return void 0===n&&(n=0),this.throwIfDisposed(),e instanceof t&&(e=[e]),vt.concat([this].concat(e),n)},t.prototype.split=function(t,e){return void 0===e&&(e=0),this.throwIfDisposed(),vt.split(this,t,e)},t.prototype.stack=function(t,e){return void 0===e&&(e=0),vt.stack([this,t],e)},t.prototype.unstack=function(t){return void 0===t&&(t=0),vt.unstack(this,t)},t.prototype.pad=function(t,e){return void 0===e&&(e=0),vt.pad(this,t,e)},t.prototype.batchNormalization=function(t,e,n,r,o){return void 0===n&&(n=.001),gt("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon"),this.batchNorm(t,e,o,r,n)},t.prototype.batchNorm=function(t,e,n,r,o){return void 0===o&&(o=.001),this.throwIfDisposed(),vt.batchNorm(this,t,e,n,r,o)},t.prototype.all=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),vt.all(this,t,e)},t.prototype.any=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),vt.any(this,t,e)},t.prototype.logSumExp=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),vt.logSumExp(this,t,e)},t.prototype.sum=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),vt.sum(this,t,e)},t.prototype.prod=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),vt.prod(this,t,e)},t.prototype.mean=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),vt.mean(this,t,e)},t.prototype.min=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),vt.min(this,t,e)},t.prototype.max=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=!1),this.throwIfDisposed(),vt.max(this,t,e)},t.prototype.argMin=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),vt.argMin(this,t)},t.prototype.argMax=function(t){return void 0===t&&(t=null),this.throwIfDisposed(),vt.argMax(this,t)},t.prototype.cast=function(t){return this.throwIfDisposed(),vt.cast(this,t)},t.prototype.add=function(t){return this.throwIfDisposed(),vt.add(this,t)},t.prototype.addStrict=function(t){return this.throwIfDisposed(),vt.addStrict(this,t)},t.prototype.atan2=function(t){return this.throwIfDisposed(),vt.atan2(this,t)},t.prototype.sub=function(t){return this.throwIfDisposed(),vt.sub(this,t)},t.prototype.subStrict=function(t){return this.throwIfDisposed(),vt.subStrict(this,t)},t.prototype.pow=function(t){return this.throwIfDisposed(),vt.pow(this,t)},t.prototype.powStrict=function(t){return this.throwIfDisposed(),vt.powStrict(this,t)},t.prototype.mul=function(t){return this.throwIfDisposed(),vt.mul(this,t)},t.prototype.mulStrict=function(t){return this.throwIfDisposed(),vt.mulStrict(this,t)},t.prototype.div=function(t){return this.throwIfDisposed(),vt.div(this,t)},t.prototype.divNoNan=function(t){return this.throwIfDisposed(),vt.divNoNan(this,t)},t.prototype.floorDiv=function(t){return this.throwIfDisposed(),vt.floorDiv(this,t)},t.prototype.divStrict=function(t){return this.throwIfDisposed(),vt.divStrict(this,t)},t.prototype.minimum=function(t){return this.throwIfDisposed(),vt.minimum(this,t)},t.prototype.minimumStrict=function(t){return this.throwIfDisposed(),vt.minimumStrict(this,t)},t.prototype.maximum=function(t){return this.throwIfDisposed(),vt.maximum(this,t)},t.prototype.maximumStrict=function(t){return this.throwIfDisposed(),vt.maximumStrict(this,t)},t.prototype.mod=function(t){return this.throwIfDisposed(),vt.mod(this,t)},t.prototype.modStrict=function(t){return this.throwIfDisposed(),vt.modStrict(this,t)},t.prototype.squaredDifferenceStrict=function(t){return this.throwIfDisposed(),vt.squaredDifferenceStrict(this,t)},t.prototype.transpose=function(t){return this.throwIfDisposed(),vt.transpose(this,t)},t.prototype.notEqual=function(t){return this.throwIfDisposed(),vt.notEqual(this,t)},t.prototype.notEqualStrict=function(t){return this.throwIfDisposed(),vt.notEqualStrict(this,t)},t.prototype.less=function(t){return this.throwIfDisposed(),vt.less(this,t)},t.prototype.lessStrict=function(t){return this.throwIfDisposed(),vt.lessStrict(this,t)},t.prototype.equal=function(t){return this.throwIfDisposed(),vt.equal(this,t)},t.prototype.equalStrict=function(t){return this.throwIfDisposed(),vt.equalStrict(this,t)},t.prototype.lessEqual=function(t){return this.throwIfDisposed(),vt.lessEqual(this,t)},t.prototype.lessEqualStrict=function(t){return this.throwIfDisposed(),vt.lessEqualStrict(this,t)},t.prototype.greater=function(t){return this.throwIfDisposed(),vt.greater(this,t)},t.prototype.greaterStrict=function(t){return this.throwIfDisposed(),vt.greaterStrict(this,t)},t.prototype.greaterEqual=function(t){return this.throwIfDisposed(),vt.greaterEqual(this,t)},t.prototype.greaterEqualStrict=function(t){return this.throwIfDisposed(),vt.greaterEqualStrict(this,t)},t.prototype.logicalAnd=function(t){return this.throwIfDisposed(),vt.logicalAnd(this,t)},t.prototype.logicalOr=function(t){return this.throwIfDisposed(),vt.logicalOr(this,t)},t.prototype.logicalNot=function(){return this.throwIfDisposed(),vt.logicalNot(this)},t.prototype.logicalXor=function(t){return this.throwIfDisposed(),vt.logicalXor(this,t)},t.prototype.where=function(t,e){return this.throwIfDisposed(),vt.where(t,this,e)},t.prototype.neg=function(){return this.throwIfDisposed(),vt.neg(this)},t.prototype.ceil=function(){return this.throwIfDisposed(),vt.ceil(this)},t.prototype.floor=function(){return this.throwIfDisposed(),vt.floor(this)},t.prototype.sign=function(){return this.throwIfDisposed(),vt.sign(this)},t.prototype.isNaN=function(){return this.throwIfDisposed(),vt.isNaN(this)},t.prototype.isInf=function(){return this.throwIfDisposed(),vt.isInf(this)},t.prototype.isFinite=function(){return this.throwIfDisposed(),vt.isFinite(this)},t.prototype.exp=function(){return this.throwIfDisposed(),vt.exp(this)},t.prototype.expm1=function(){return this.throwIfDisposed(),vt.expm1(this)},t.prototype.log=function(){return this.throwIfDisposed(),vt.log(this)},t.prototype.log1p=function(){return this.throwIfDisposed(),vt.log1p(this)},t.prototype.sqrt=function(){return this.throwIfDisposed(),vt.sqrt(this)},t.prototype.rsqrt=function(){return this.throwIfDisposed(),vt.rsqrt(this)},t.prototype.square=function(){return this.throwIfDisposed(),vt.square(this)},t.prototype.reciprocal=function(){return this.throwIfDisposed(),vt.reciprocal(this)},t.prototype.abs=function(){return this.throwIfDisposed(),vt.abs(this)},t.prototype.clipByValue=function(t,e){return this.throwIfDisposed(),vt.clipByValue(this,t,e)},t.prototype.relu=function(){return this.throwIfDisposed(),vt.relu(this)},t.prototype.relu6=function(){return this.throwIfDisposed(),vt.relu6(this)},t.prototype.elu=function(){return this.throwIfDisposed(),vt.elu(this)},t.prototype.selu=function(){return this.throwIfDisposed(),vt.selu(this)},t.prototype.leakyRelu=function(t){return void 0===t&&(t=.2),this.throwIfDisposed(),vt.leakyRelu(this,t)},t.prototype.prelu=function(t){return this.throwIfDisposed(),vt.prelu(this,t)},t.prototype.sigmoid=function(){return this.throwIfDisposed(),vt.sigmoid(this)},t.prototype.logSigmoid=function(){return this.throwIfDisposed(),vt.logSigmoid(this)},t.prototype.softplus=function(){return this.throwIfDisposed(),vt.softplus(this)},t.prototype.zerosLike=function(){return this.throwIfDisposed(),vt.zerosLike(this)},t.prototype.onesLike=function(){return this.throwIfDisposed(),vt.onesLike(this)},t.prototype.sin=function(){return this.throwIfDisposed(),vt.sin(this)},t.prototype.cos=function(){return this.throwIfDisposed(),vt.cos(this)},t.prototype.tan=function(){return this.throwIfDisposed(),vt.tan(this)},t.prototype.asin=function(){return this.throwIfDisposed(),vt.asin(this)},t.prototype.acos=function(){return this.throwIfDisposed(),vt.acos(this)},t.prototype.atan=function(){return this.throwIfDisposed(),vt.atan(this)},t.prototype.sinh=function(){return this.throwIfDisposed(),vt.sinh(this)},t.prototype.cosh=function(){return this.throwIfDisposed(),vt.cosh(this)},t.prototype.tanh=function(){return this.throwIfDisposed(),vt.tanh(this)},t.prototype.asinh=function(){return this.throwIfDisposed(),vt.asinh(this)},t.prototype.acosh=function(){return this.throwIfDisposed(),vt.acosh(this)},t.prototype.atanh=function(){return this.throwIfDisposed(),vt.atanh(this)},t.prototype.erf=function(){return this.throwIfDisposed(),vt.erf(this)},t.prototype.round=function(){return this.throwIfDisposed(),vt.round(this)},t.prototype.step=function(t){return void 0===t&&(t=0),this.throwIfDisposed(),vt.step(this,t)},t.prototype.softmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),vt.softmax(this,t)},t.prototype.logSoftmax=function(t){return void 0===t&&(t=-1),this.throwIfDisposed(),vt.logSoftmax(this,t)},t.prototype.resizeBilinear=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),vt.image.resizeBilinear(this,t,e)},t.prototype.resizeNearestNeighbor=function(t,e){return void 0===e&&(e=!1),this.throwIfDisposed(),vt.image.resizeNearestNeighbor(this,t,e)},t.prototype.conv1d=function(t,e,n,r,o,i){return void 0===r&&(r="NWC"),void 0===o&&(o=1),this.throwIfDisposed(),vt.conv1d(this,t,e,n,r,o,i)},t.prototype.conv2d=function(t,e,n,r,o,i){return void 0===r&&(r="NHWC"),void 0===o&&(o=[1,1]),this.throwIfDisposed(),vt.conv2d(this,t,e,n,r,o,i)},t.prototype.conv2dTranspose=function(t,e,n,r,o){return this.throwIfDisposed(),vt.conv2dTranspose(this,t,e,n,r,o)},t.prototype.depthwiseConv2D=function(t,e,n,r,o,i){return void 0===r&&(r="NHWC"),void 0===o&&(o=[1,1]),this.throwIfDisposed(),vt.depthwiseConv2d(this,t,e,n,r,o,i)},t.prototype.separableConv2d=function(t,e,n,r,o,i){return void 0===o&&(o=[1,1]),void 0===i&&(i="NHWC"),this.throwIfDisposed(),vt.separableConv2d(this,t,e,n,r,o,i)},t.prototype.avgPool=function(t,e,n,r){return this.throwIfDisposed(),vt.avgPool(this,t,e,n,r)},t.prototype.maxPool=function(t,e,n,r){return this.throwIfDisposed(),vt.maxPool(this,t,e,n,r)},t.prototype.localResponseNormalization=function(t,e,n,r){return void 0===t&&(t=5),void 0===e&&(e=1),void 0===n&&(n=1),void 0===r&&(r=.5),vt.localResponseNormalization(this,t,e,n,r)},t.prototype.pool=function(t,e,n,r,o){return this.throwIfDisposed(),vt.pool(this,t,e,n,r,o)},t.prototype.variable=function(t,e,n){return void 0===t&&(t=!0),this.throwIfDisposed(),mt().makeVariable(this,t,e,n)},t.prototype.unsortedSegmentSum=function(t,e){return this.throwIfDisposed(),vt.unsortedSegmentSum(this,t,e)},t.prototype.batchToSpaceND=function(t,e){return this.throwIfDisposed(),vt.batchToSpaceND(this,t,e)},t.prototype.spaceToBatchND=function(t,e){return this.throwIfDisposed(),vt.spaceToBatchND(this,t,e)},t.prototype.topk=function(t,e){return void 0===t&&(t=1),void 0===e&&(e=!0),this.throwIfDisposed(),vt.topk(this,t,e)},t.prototype.stridedSlice=function(t,e,n,r,o,i,a,s){return void 0===r&&(r=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===a&&(a=0),void 0===s&&(s=0),this.throwIfDisposed(),vt.stridedSlice(this,t,e,n,r,o,i,a,s)},t.prototype.depthToSpace=function(t,e){return this.throwIfDisposed(),vt.depthToSpace(this,t,e)},t.prototype.fft=function(){return this.throwIfDisposed(),vt.spectral.fft(this)},t.prototype.ifft=function(){return this.throwIfDisposed(),vt.spectral.ifft(this)},t.prototype.rfft=function(){return this.throwIfDisposed(),vt.spectral.rfft(this)},t.prototype.irfft=function(){return this.throwIfDisposed(),vt.spectral.irfft(this)},t}();Object.defineProperty(yt,Symbol.hasInstance,{value:function(t){return!!t&&null!=t.dataId&&null!=t.shape&&null!=t.dtype}});var bt,wt,xt,_t,Et,Ct=function(t){function e(e,n,r,o){var i=t.call(this,e.shape,e.dtype,e.dataId,o)||this;return i.trainable=n,i.name=r,i}return a(e,t),e.prototype.assign=function(t){if(t.dtype!==this.dtype)throw new Error("dtype of the new value ("+t.dtype+") and previous value ("+this.dtype+") must match");if(!O(t.shape,this.shape))throw new Error("shape of the new value ("+t.shape+") and previous value ("+this.shape+") must match");mt().disposeTensor(this),this.dataId=t.dataId,mt().incRef(this,null)},e.prototype.dispose=function(){mt().disposeVariable(this),this.isDisposedInternal=!0},e}(yt);Object.defineProperty(Ct,Symbol.hasInstance,{value:function(t){return t instanceof yt&&null!=t.assign&&t.assign instanceof Function}}),function(t){t.R0="R0",t.R1="R1",t.R2="R2",t.R3="R3",t.R4="R4",t.R5="R5",t.R6="R6"}(bt||(bt={})),function(t){t.float32="float32",t.int32="int32",t.bool="int32",t.complex64="complex64"}(wt||(wt={})),function(t){t.float32="float32",t.int32="int32",t.bool="bool",t.complex64="complex64"}(xt||(xt={})),function(t){t.float32="float32",t.int32="float32",t.bool="float32",t.complex64="complex64"}(_t||(_t={})),function(t){t.float32="complex64",t.int32="complex64",t.bool="complex64",t.complex64="complex64"}(Et||(Et={}));var St={float32:_t,int32:wt,bool:xt,complex64:Et};function kt(t,e){if("string"===t||"string"===e){if("string"===t&&"string"===e)return"string";throw new Error("Can not upcast "+t+" with "+e)}return St[t][e]}function Tt(t){return kt(t,"int32")}function It(t,e){if(t.dtype===e.dtype)return[t,e];var n=kt(t.dtype,e.dtype);return[t.cast(n),e.cast(n)]}function Ot(t,e){C(t.dtype===e.dtype,(function(){return"The dtypes of the first("+t.dtype+") and second("+e.dtype+") input must match"}))}function Rt(t){var e=[];return function t(e,n,r){if(null!=e)if(e instanceof yt)n.push(e);else if(o=e,Array.isArray(o)||"object"==typeof o){var o,i=e;for(var a in i){var s=i[a];r.has(s)||(r.add(s),t(s,n,r))}}}(t,e,new Set),e}Object.freeze({makeTypesMatch:It,assertTypesMatch:Ot,isTensorInList:function(t,e){return e.some((function(e){return e.id===t.id}))},getTensorsInContainer:Rt});var At,Dt=function(){function t(){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}}return t.prototype.dispose=function(){for(var t in this.registeredVariables)this.registeredVariables[t].dispose()},t}(),Nt=function(){function t(t){this.ENV=t,this.registry={},this.registryFactory={},this.pendingBackendInitId=0,this.state=new Dt}return t.prototype.ready=function(){return s(this,void 0,void 0,(function(){var t,e,n;return u(this,(function(r){switch(r.label){case 0:if(null!=this.pendingBackendInit)return[2,this.pendingBackendInit.then((function(){}))];if(null!=this.backendInstance)return[2];t=this.getSortedBackends(),e=0,r.label=1;case 1:return e<t.length?(n=t[e],[4,this.initializeBackend(n).success]):[3,5];case 2:return r.sent()?[4,this.setBackend(n)]:[3,4];case 3:return r.sent(),[2];case 4:return e++,[3,1];case 5:throw new Error("Could not initialize any backends, all backend initializations failed.")}}))}))},Object.defineProperty(t.prototype,"backend",{get:function(){if(null!=this.pendingBackendInit)throw new Error("Backend '"+this.backendName+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");if(null==this.backendInstance){var t=this.initializeBackendsAndReturnBest(),e=t.name;if(t.asyncInit)throw new Error("The highest priority backend '"+e+"' has not yet been initialized. Make sure to await tf.ready() or await tf.setBackend() before calling other methods");this.setBackend(e)}return this.backendInstance},enumerable:!0,configurable:!0}),t.prototype.backendNames=function(){return Object.keys(this.registryFactory)},t.prototype.findBackend=function(t){if(!(t in this.registry)){if(!(t in this.registryFactory))return null;if(this.initializeBackend(t).asyncInit)return null}return this.registry[t]},t.prototype.findBackendFactory=function(t){return t in this.registryFactory?this.registryFactory[t].factory:null},t.prototype.registerBackend=function(t,e,n){return void 0===n&&(n=1),t in this.registryFactory?(console.warn(t+" backend was already registered. Reusing existing backend factory."),!1):(this.registryFactory[t]={factory:e,priority:n},!0)},t.prototype.setBackend=function(t){return s(this,void 0,void 0,(function(){var e,n,r;return u(this,(function(o){switch(o.label){case 0:if(null==this.registryFactory[t])throw new Error("Backend name '"+t+"' not found in registry");return this.backendName=t,null!=this.registry[t]?[3,4]:(this.backendInstance=null,e=this.initializeBackend(t),n=e.success,e.asyncInit?[4,n]:[3,2]);case 1:return r=o.sent(),[3,3];case 2:r=n,o.label=3;case 3:if(!r)return[2,!1];o.label=4;case 4:return this.backendInstance=this.registry[t],this.setupRegisteredKernels(),this.profiler=new ct(this.backendInstance),[2,!0]}}))}))},t.prototype.setupRegisteredKernels=function(){var t=this;v(this.backendName).forEach((function(e){null!=e.setupFunc&&e.setupFunc(t.backendInstance)}))},t.prototype.disposeRegisteredKernels=function(t){var e=this;v(t).forEach((function(n){null!=n.disposeFunc&&n.disposeFunc(e.registry[t])}))},t.prototype.initializeBackend=function(t){var e=this,n=this.registryFactory[t];if(null==n)throw new Error("Cannot initialize backend "+t+", no registration found.");try{var r=n.factory();if(Promise.resolve(r)===r){var o=++this.pendingBackendInitId,i=r.then((function(n){return!(o<e.pendingBackendInitId||(e.registry[t]=n,e.pendingBackendInit=null,0))})).catch((function(n){return!(o<e.pendingBackendInitId||(e.pendingBackendInit=null,console.warn("Initialization of backend "+t+" failed"),console.warn(n.stack||n.message),1))}));return this.pendingBackendInit=i,{success:i,asyncInit:!0}}return this.registry[t]=r,{success:!0,asyncInit:!1}}catch(e){return console.warn("Initialization of backend "+t+" failed"),console.warn(e.stack||e.message),{success:!1,asyncInit:!1}}},t.prototype.removeBackend=function(t){if(!(t in this.registryFactory))throw new Error(t+" backend not found in registry");this.backendName===t&&null!=this.pendingBackendInit&&this.pendingBackendInitId++,t in this.registry&&(this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t]),delete this.registryFactory[t],this.backendName===t&&(this.pendingBackendInit=null,this.backendName=null,this.backendInstance=null)},t.prototype.getSortedBackends=function(){var t=this;if(0===Object.keys(this.registryFactory).length)throw new Error("No backend found in registry.");return Object.keys(this.registryFactory).sort((function(e,n){return t.registryFactory[n].priority-t.registryFactory[e].priority}))},t.prototype.initializeBackendsAndReturnBest=function(){for(var t=this.getSortedBackends(),e=0;e<t.length;e++){var n=t[e],r=this.initializeBackend(n),o=r.success,i=r.asyncInit;if(i||o)return{name:n,asyncInit:i}}throw new Error("Could not initialize any backends, all backend initializations failed.")},t.prototype.moveData=function(t,e){var n=this.state.tensorInfo.get(e),r=n.backend,o=this.readSync(e);r.disposeData(e),n.backend=t,t.move(e,o,n.shape,n.dtype),this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack[this.state.numDataMovesStack.length-1]++},t.prototype.tidy=function(t,e){var n,r=this,o=null;if(null==e){if("function"!=typeof t)throw new Error("Please provide a function to tidy()");e=t}else{if("string"!=typeof t&&!(t instanceof String))throw new Error("When calling with two arguments, the first argument to tidy() must be a string");if("function"!=typeof e)throw new Error("When calling with two arguments, the 2nd argument to tidy() must be a function");o=t}return this.scopedRun((function(){return r.startScope(o)}),(function(){return r.endScope(n)}),(function(){return(n=e())instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),n}))},t.prototype.scopedRun=function(t,e,n){t();try{var r=n();return e(),r}catch(t){throw e(),t}},t.prototype.nextTensorId=function(){return t.nextTensorId++},t.prototype.nextVariableId=function(){return t.nextVariableId++},t.prototype.clone=function(t){var e=this.makeTensorFromDataId(t.dataId,t.shape,t.dtype),n={x:t};return this.addTapeNode(this.state.activeScope.name,n,[e],(function(t){return{x:function(){return t.toFloat()}}}),[]),e},t.prototype.runKernel=function(t,e,n,r,o){return this.runKernelFunc(null,e,null,t,n,r,o)},t.prototype.shouldCheckForMemLeaks=function(){return this.ENV.getBool("IS_TEST")},t.prototype.checkKernelForMemLeak=function(t,e,n){var r=this.backend.numDataIds(),o=0;n.forEach((function(t){o+="complex64"===t.dtype?3:1}));var i=this.state.numDataMovesStack[this.state.numDataMovesStack.length-1],a=r-e-o-i;if(a>0)throw new Error("Backend '"+this.backendName+"' has an internal memory leak ("+a+" data ids) after running '"+t+"'")},t.prototype.runKernelFunc=function(t,e,n,r,o,i,a){var s,u=this;void 0===i&&(i=[]),void 0===a&&(a=[]);var c=[],l=this.isTapeOn();null==r&&(r=null!=this.state.activeScope?this.state.activeScope.name:"");var f,h=function(t){l&&(c=t.map((function(t){return u.keep(u.clone(t))})))},p=this.state.numBytes,d=this.state.numTensors;this.shouldCheckForMemLeaks()&&this.state.numDataMovesStack.push(0);var v,g=m(r,this.backendName);return f=null!=g?function(){var t=u.backend.numDataIds();v=g.kernelFunc({inputs:e,attrs:o,backend:u.backend});var n=Array.isArray(v)?v:[v];u.shouldCheckForMemLeaks()&&u.checkKernelForMemLeak(r,t,n);var s=n.map((function(t){var e=t.dataId,n=t.shape,r=t.dtype;return u.makeTensorFromDataId(e,n,r)})),c=s.filter((function(t,e){return a[e]}));return h((i||[]).slice().concat(c)),s}:function(){var e=u.backend.numDataIds();v=u.tidy((function(){return t(u.backend,h)}));var n=Array.isArray(v)?v:[v];return u.shouldCheckForMemLeaks()&&u.checkKernelForMemLeak(r,e,n),n},this.scopedRun((function(){return u.state.kernelDepth++}),(function(){return u.state.kernelDepth--}),(function(){s=u.ENV.getBool("DEBUG")?u.profiler.profileKernel(r,e,(function(){return f()})):f()})),l&&this.addTapeNode(r,e,s,n,c),this.state.profiling&&this.state.activeProfile.kernels.push({name:r,bytesAdded:this.state.numBytes-p,totalBytesSnapshot:this.state.numBytes,tensorsAdded:this.state.numTensors-d,totalTensorsSnapshot:this.state.numTensors,inputShapes:Object.keys(e).map((function(t){return e[t].shape})),outputShapes:s.map((function(t){return t.shape}))}),Array.isArray(v)?s:s[0]},t.prototype.makeTensor=function(t,e,n,r){if(null==t)throw new Error("Values passed to engine.makeTensor() are null");n=n||"float32",r=r||this.backend;var o=t;"string"===n&&H(t[0])&&(o=t.map((function(t){return it(t)})));var i=r.write(o,e,n),a=new yt(e,n,i,this.nextTensorId());if(this.incRef(a,r),"string"===n){var s=this.state.tensorInfo.get(i),u=G(o);this.state.numBytes+=u-s.bytes,s.bytes=u}return a},t.prototype.makeTensorFromDataId=function(t,e,n,r){var o=new yt(e,n=n||"float32",t,this.nextTensorId());return this.incRef(o,r),o},t.prototype.makeVariable=function(t,e,n,r){void 0===e&&(e=!0),n=n||this.nextVariableId().toString(),null!=r&&r!==t.dtype&&(t=t.asType(r));var o=new Ct(t,e,n,this.nextTensorId());if(null!=this.state.registeredVariables[o.name])throw new Error("Variable with name "+o.name+" was already registered");return this.state.registeredVariables[o.name]=o,this.incRef(o,this.backend),o},t.prototype.incRef=function(t,e){var n=this.state.tensorInfo.has(t.dataId)?this.state.tensorInfo.get(t.dataId).refCount:0;if(this.state.numTensors++,"string"===t.dtype&&this.state.numStringTensors++,0===n){this.state.numDataBuffers++;var r=0;"complex64"!==t.dtype&&"string"!==t.dtype&&(r=t.size*q(t.dtype)),this.state.tensorInfo.set(t.dataId,{backend:e||this.backend,dtype:t.dtype,shape:t.shape,bytes:r,refCount:0}),this.state.numBytes+=r}this.state.tensorInfo.get(t.dataId).refCount++,t instanceof Ct||this.track(t)},t.prototype.disposeTensor=function(t){if(this.state.tensorInfo.has(t.dataId)){this.state.numTensors--,"string"===t.dtype&&this.state.numStringTensors--;var e=this.state.tensorInfo.get(t.dataId);e.refCount<=1?("complex64"!==t.dtype&&(this.state.numBytes-=e.bytes),this.state.numDataBuffers--,e.backend.disposeData(t.dataId),this.state.tensorInfo.delete(t.dataId)):this.state.tensorInfo.get(t.dataId).refCount--}},t.prototype.disposeVariables=function(){for(var t in this.state.registeredVariables){var e=this.state.registeredVariables[t];this.disposeVariable(e)}},t.prototype.disposeVariable=function(t){this.disposeTensor(t),null!=this.state.registeredVariables[t.name]&&delete this.state.registeredVariables[t.name]},t.prototype.memory=function(){var 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},t.prototype.profile=function(t){return s(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){return this.state.profiling=!0,e=this.state.numBytes,n=this.state.numTensors,this.state.activeProfile.kernels=[],this.state.activeProfile.result=t(),this.state.profiling=!1,this.state.activeProfile.peakBytes=Math.max.apply(Math,this.state.activeProfile.kernels.map((function(t){return t.totalBytesSnapshot}))),this.state.activeProfile.newBytes=this.state.numBytes-e,this.state.activeProfile.newTensors=this.state.numTensors-n,[2,this.state.activeProfile]}))}))},t.prototype.isTapeOn=function(){return this.state.gradientDepth>0&&0===this.state.kernelDepth},t.prototype.addTapeNode=function(t,e,n,r,o){var i=this,a={id:this.state.nextTapeNodeId++,kernelName:t,inputs:e,outputs:n,saved:o},s=function(t){return d.get(t)}(t);null!=s&&(r=s.gradFunc),null!=r&&(a.gradient=function(t){return t=t.map((function(t,e){if(null==t){var r=n[e],o=nt(r.size,r.dtype);return i.makeTensor(o,r.shape,r.dtype)}return t})),r(t.length>1?t:t[0],o)}),this.state.activeTape.push(a)},t.prototype.keep=function(t){return t.kept=!0,t},t.prototype.startTape=function(){0===this.state.gradientDepth&&(this.state.activeTape=[]),this.state.gradientDepth++},t.prototype.endTape=function(){this.state.gradientDepth--},t.prototype.startScope=function(t){var e={track:[],name:"unnamed scope",id:this.state.nextScopeId++};t&&(e.name=t),this.state.scopeStack.push(e),this.state.activeScope=e},t.prototype.endScope=function(t){for(var e=this,n=Rt(t),r=new Set(n.map((function(t){return t.id}))),o=0;o<this.state.activeScope.track.length;o++){var i=this.state.activeScope.track[o];i.kept||r.has(i.id)||i.dispose()}var a=this.state.scopeStack.pop();this.state.activeScope=0===this.state.scopeStack.length?null:this.state.scopeStack[this.state.scopeStack.length-1],n.forEach((function(t){t.kept||t.scopeId!==a.id||e.track(t)}))},t.prototype.gradients=function(t,e,n,r){var o=this;if(void 0===r&&(r=!1),C(e.length>0,(function(){return"gradients() received an empty list of xs."})),null!=n&&"float32"!==n.dtype)throw new Error("dy must have 'float32' dtype, but has '"+n.dtype+"'");var i=this.scopedRun((function(){return o.startTape()}),(function(){return o.endTape()}),(function(){return o.tidy("forward",t)}));C(i instanceof yt,(function(){return"The result y returned by f() must be a tensor."}));var a=function(t,e,n){for(var r={},o={},i=0;i<e.length;i++)r[e[i].id]=!0;for(i=0;i<t.length;i++){var a=(d=t[i]).inputs;for(var s in a){for(var u=a[s],c=!1,l=0;l<e.length;l++)if(r[u.id]){d.outputs.forEach((function(t){return r[t.id]=!0})),c=!0,o[d.id]=!0;break}if(c)break}}var f={};f[n.id]=!0;var h={};for(i=t.length-1;i>=0;i--)for(a=(d=t[i]).inputs,l=0;l<d.outputs.length;l++)if(f[d.outputs[l].id]){for(var s in a)f[a[s].id]=!0,h[d.id]=!0;break}var p=[];for(i=0;i<t.length;i++){var d;if(o[(d=t[i]).id]&&h[d.id]){var m={};for(var s in d.inputs){var v=d.inputs[s];r[v.id]&&(m[s]=v)}var g=Object.assign({},d);g.inputs=m,g.outputs=d.outputs,p.push(g)}}return p}(this.state.activeTape,e,i);if(!r&&0===a.length&&e.length>0)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",(function(){var t,r,s={};s[i.id]=null==n?(r=et(I(t=i.shape),"float32"),Pt.makeTensor(r,t,"float32")):n,function(t,e,n){for(var r=function(r){var o=e[r],i=[];if(o.outputs.forEach((function(e){var n=t[e.id];null!=n?i.push(n):i.push(null)})),null==o.gradient)throw new Error("Cannot compute gradient: gradient function not found for "+o.kernelName+".");var a=o.gradient(i),s=function(e){if(!(e in a))throw new Error("Cannot backprop through input "+e+". Available gradients found: "+Object.keys(a)+".");var r=n((function(){return a[e]()}));if("float32"!==r.dtype)throw new Error("Error in gradient for op "+o.kernelName+". The gradient of input "+e+" must have 'float32' dtype, but has '"+r.dtype+"'");var i=o.inputs[e];if(!O(r.shape,i.shape))throw new Error("Error in gradient for op "+o.kernelName+". The gradient of input '"+e+"' has shape '"+r.shape+"', which does not match the shape of the input '"+i.shape+"'");if(null==t[i.id])t[i.id]=r;else{var s=t[i.id];t[i.id]=s.add(r),s.dispose()}};for(var u in o.inputs)s(u)},o=e.length-1;o>=0;o--)r(o)}(s,a,(function(t){return o.tidy(t)}));var u=e.map((function(t){return s[t.id]}));return 0===o.state.gradientDepth&&(o.state.activeTape.forEach((function(t){for(var e=0,n=t.saved;e<n.length;e++)n[e].dispose()})),o.state.activeTape=null),{value:i,grads:u}}))},t.prototype.customGrad=function(t){var e=this;return C($(t),(function(){return"The f passed in customGrad(f) must be a function."})),function(){for(var n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];C(r.every((function(t){return t instanceof yt})),(function(){return"The args passed in customGrad(f)(x1, x2,...) must all be tensors"}));var i={};return r.forEach((function(t,e){i[e]=t})),e.runKernelFunc((function(e,o){return C((n=t.apply(void 0,r.concat([o]))).value instanceof yt,(function(){return"The function f passed in customGrad(f) must return an object where `obj.value` is a tensor"})),C($(n.gradFunc),(function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function."})),n.value}),i,(function(t,e){var o=n.gradFunc(t,e),i=Array.isArray(o)?o:[o];C(i.length===r.length,(function(){return"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(...)."})),C(i.every((function(t){return t instanceof yt})),(function(){return"The function f passed in customGrad(f) must return an object where `obj.gradFunc` is a function that returns a list of only tensors."}));var a={};return i.forEach((function(t,e){a[e]=function(){return t}})),a}))}},t.prototype.readSync=function(t){return this.state.tensorInfo.get(t).backend.readSync(t)},t.prototype.read=function(t){return this.state.tensorInfo.get(t).backend.read(t)},t.prototype.time=function(t){return s(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){switch(r.label){case 0:return e=rt(),[4,this.backend.time(t)];case 1:return(n=r.sent()).wallMs=rt()-e,[2,n]}}))}))},t.prototype.track=function(t){return null!=this.state.activeScope&&(t.scopeId=this.state.activeScope.id,this.state.activeScope.track.push(t)),t},Object.defineProperty(t.prototype,"registeredVariables",{get:function(){return this.state.registeredVariables},enumerable:!0,configurable:!0}),t.prototype.reset=function(){for(var t in this.pendingBackendInitId++,this.state.dispose(),this.ENV.reset(),this.state=new Dt,this.registry)this.disposeRegisteredKernels(t),this.registry[t].dispose(),delete this.registry[t];this.backendName=null,this.backendInstance=null,this.pendingBackendInit=null},t.nextTensorId=0,t.nextVariableId=0,t}(),Pt=function(){var e=function(){if(null==At){var e=void 0;if("undefined"!=typeof window)e=window;else if(void 0!==t)e=t;else if(void 0!==r)e=r;else{if("undefined"==typeof self)throw new Error("Could not find a global object");e=self}At=e}return At}();if(null==e._tfengine){var n=new c(e);e._tfengine=new Nt(n)}return function(t){h=t}(e._tfengine.ENV),mt=function(){return e._tfengine},e._tfengine}();function Mt(){return"undefined"!=typeof window&&null!=window.document||"undefined"!=typeof WorkerGlobalScope}var jt=f();jt.registerFlag("DEBUG",(function(){return!1}),(function(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.")})),jt.registerFlag("IS_BROWSER",(function(){return Mt()})),jt.registerFlag("IS_NODE",(function(){return void 0!==r&&void 0!==r.versions&&void 0!==r.versions.node})),jt.registerFlag("IS_CHROME",(function(){return"undefined"!=typeof navigator&&null!=navigator&&null!=navigator.userAgent&&/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)})),jt.registerFlag("PROD",(function(){return!1})),jt.registerFlag("TENSORLIKE_CHECK_SHAPE_CONSISTENCY",(function(){return jt.getBool("DEBUG")})),jt.registerFlag("DEPRECATION_WARNINGS_ENABLED",(function(){return!0})),jt.registerFlag("IS_TEST",(function(){return!1}));var Ft,Bt,Lt,Ut={},Wt={alpha:!1,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!1,depth:!1,stencil:!1,failIfMajorPerformanceCaveat:!0};function zt(t,e){Ut[t]=e}function Vt(t){t in Ut||(Ut[t]=function(t){if(1!==t&&2!==t)throw new Error("Cannot get WebGL rendering context, WebGL is disabled.");var e=function(t){if("undefined"!=typeof OffscreenCanvas&&2===t)return new OffscreenCanvas(300,150);if("undefined"!=typeof document)return document.createElement("canvas");throw new Error("Cannot create a canvas in this context")}(t);return e.addEventListener("webglcontextlost",(function(e){e.preventDefault(),delete Ut[t]}),!1),1===t?e.getContext("webgl",Wt)||e.getContext("experimental-webgl",Wt):e.getContext("webgl2",Wt)}(t));var e=Ut[t];return e.isContextLost()?(delete Ut[t],Vt(t)):(e.disable(e.DEPTH_TEST),e.disable(e.STENCIL_TEST),e.disable(e.BLEND),e.disable(e.DITHER),e.disable(e.POLYGON_OFFSET_FILL),e.disable(e.SAMPLE_COVERAGE),e.enable(e.SCISSOR_TEST),e.enable(e.CULL_FACE),e.cullFace(e.BACK),Ut[t])}function qt(t,e){return[e,t]}function Gt(t){var e=I(t);return D(Math.ceil(e/4))}function Ht(t,e){return[Math.max(1,Math.ceil(e/2)),Math.max(1,Math.ceil(t/2))]}function Xt(t,e){var n,r,o,i,a,s,u,c,l,h=t;return 2===f().getNumber("WEBGL_VERSION")?(n=h.R32F,r=h.R16F,o=h.RGBA16F,i=h.RGBA32F,a=h.RED,s=4,u=1,c=h.HALF_FLOAT,l=h.FLOAT):(n=t.RGBA,r=t.RGBA,o=t.RGBA,i=h.RGBA,a=t.RGBA,s=4,u=4,c=null!=e?e.HALF_FLOAT_OES:null,l=t.FLOAT),{internalFormatFloat:n,internalFormatHalfFloat:r,internalFormatPackedHalfFloat:o,internalFormatPackedFloat:i,textureFormatFloat:a,downloadTextureFormat:t.RGBA,downloadUnpackNumChannels:s,defaultNumChannels:u,textureTypeHalfFloat:c,textureTypeFloat:l}}function Kt(t,e,n){var r=n();return e&&function(t){var e=t.getError();if(e!==t.NO_ERROR)throw new Error("WebGL Error: "+$t(t,e))}(t),r}!function(t){t[t.DENSE=0]="DENSE",t[t.SHARED_BATCH=1]="SHARED_BATCH"}(Ft||(Ft={})),function(t){t[t.RENDER=0]="RENDER",t[t.UPLOAD=1]="UPLOAD",t[t.PIXELS=2]="PIXELS",t[t.DOWNLOAD=3]="DOWNLOAD"}(Bt||(Bt={})),function(t){t[t.UNPACKED_FLOAT16=0]="UNPACKED_FLOAT16",t[t.UNPACKED_FLOAT32=1]="UNPACKED_FLOAT32",t[t.PACKED_4X1_UNSIGNED_BYTE=2]="PACKED_4X1_UNSIGNED_BYTE",t[t.PACKED_2X2_FLOAT32=3]="PACKED_2X2_FLOAT32",t[t.PACKED_2X2_FLOAT16=4]="PACKED_2X2_FLOAT16"}(Lt||(Lt={}));function Yt(t){return!!(f().getBool("WEBGL_RENDER_FLOAT32_ENABLED")||0===t||5.96e-8<Math.abs(t)&&Math.abs(t)<65504)}function $t(t,e){switch(e){case t.NO_ERROR:return"NO_ERROR";case t.INVALID_ENUM:return"INVALID_ENUM";case t.INVALID_VALUE:return"INVALID_VALUE";case t.INVALID_OPERATION:return"INVALID_OPERATION";case t.INVALID_FRAMEBUFFER_OPERATION:return"INVALID_FRAMEBUFFER_OPERATION";case t.OUT_OF_MEMORY:return"OUT_OF_MEMORY";case t.CONTEXT_LOST_WEBGL:return"CONTEXT_LOST_WEBGL";default:return"Unknown error code "+e}}function Jt(t,e,n){return we(t,e,(function(){return t.getExtension(n)}),'Extension "'+n+'" not supported on this browser.')}function Qt(t,e,n){var r=we(t,e,(function(){return t.createShader(t.VERTEX_SHADER)}),"Unable to create vertex WebGLShader.");if(Kt(t,e,(function(){return t.shaderSource(r,n)})),Kt(t,e,(function(){return t.compileShader(r)})),!1===t.getShaderParameter(r,t.COMPILE_STATUS))throw console.log(t.getShaderInfoLog(r)),new Error("Failed to compile vertex shader.");return r}function Zt(t,e,n){var r=we(t,e,(function(){return t.createShader(t.FRAGMENT_SHADER)}),"Unable to create fragment WebGLShader.");if(Kt(t,e,(function(){return t.shaderSource(r,n)})),Kt(t,e,(function(){return t.compileShader(r)})),!1===t.getShaderParameter(r,t.COMPILE_STATUS))throw function(t,e){var n=ne.exec(e);if(null==n)return console.log("Couldn't parse line number in error: "+e),void console.log(t);for(var r=+n[1],o=t.split("\n"),i=o.length.toString().length+2,a=o.map((function(t,e){return N((e+1).toString(),i)+t})),s=0,u=0;u<a.length;u++)s=Math.max(a[u].length,s);var c=a.slice(0,r-1),l=a.slice(r-1,r),f=a.slice(r);console.log(c.join("\n")),console.log(e.split("\n")[0]),console.log("%c "+N(l[0],s),"border:1px solid red; background-color:#e3d2d2; color:#a61717"),console.log(f.join("\n"))}(n,t.getShaderInfoLog(r)),new Error("Failed to compile fragment shader.");return r}var te,ee,ne=/ERROR: [0-9]+:([0-9]+):/g;function re(t,e){return we(t,e,(function(){return t.createProgram()}),"Unable to create WebGLProgram.")}function oe(t,e,n){if(Kt(t,e,(function(){return t.linkProgram(n)})),!1===t.getProgramParameter(n,t.LINK_STATUS))throw console.log(t.getProgramInfoLog(n)),new Error("Failed to link vertex and fragment shaders.")}function ie(t,e,n){if(Kt(t,e,(function(){return t.validateProgram(n)})),!1===t.getProgramParameter(n,t.VALIDATE_STATUS))throw console.log(t.getProgramInfoLog(n)),new Error("Shader program validation failed.")}function ae(t,e,n){var r=we(t,e,(function(){return t.createBuffer()}),"Unable to create WebGLBuffer");return Kt(t,e,(function(){return t.bindBuffer(t.ARRAY_BUFFER,r)})),Kt(t,e,(function(){return t.bufferData(t.ARRAY_BUFFER,n,t.STATIC_DRAW)})),r}function se(t,e,n){var r=we(t,e,(function(){return t.createBuffer()}),"Unable to create WebGLBuffer");return Kt(t,e,(function(){return t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,r)})),Kt(t,e,(function(){return t.bufferData(t.ELEMENT_ARRAY_BUFFER,n,t.STATIC_DRAW)})),r}function ue(t,e){return we(t,e,(function(){return t.createTexture()}),"Unable to create WebGLTexture.")}function ce(t,e){var n=f().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(t<=0||e<=0){var r="["+t+"x"+e+"]";throw new Error("Requested texture size "+r+" is invalid.")}if(t>n||e>n)throw r="["+t+"x"+e+"]",new Error("Requested texture size "+r+" greater than WebGL maximum on this browser / GPU ["+n+"x"+n+"].")}function le(t,e){return we(t,e,(function(){return t.createFramebuffer()}),"Unable to create WebGLFramebuffer.")}function fe(t,e,n,r,o,i,a,s){var u=t.getAttribLocation(n,r);return-1!==u&&(Kt(t,e,(function(){return t.bindBuffer(t.ARRAY_BUFFER,o)})),Kt(t,e,(function(){return t.vertexAttribPointer(u,i,t.FLOAT,!1,a,s)})),Kt(t,e,(function(){return t.enableVertexAttribArray(u)})),!0)}function he(t,e,n,r){xe(t,r),Kt(t,e,(function(){return t.activeTexture(t.TEXTURE0+r)})),Kt(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,n)}))}function pe(t,e,n,r){return we(t,e,(function(){return t.getUniformLocation(n,r)}),'uniform "'+r+'" not present in program.')}function de(t,e,n){return t.getUniformLocation(e,n)}function me(t,e,n,r,o,i){Kt(t,e,(function(){return he(t,e,r,i)})),Kt(t,e,(function(){return t.uniform1i(o,i)}))}function ve(t,e,n,r){Kt(t,e,(function(){return t.bindFramebuffer(t.FRAMEBUFFER,r)})),Kt(t,e,(function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0)}))}function ge(t,e,n){Kt(t,e,(function(){return t.bindFramebuffer(t.FRAMEBUFFER,n)})),Kt(t,e,(function(){return t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,null,0)}))}function ye(t){var e=t.checkFramebufferStatus(t.FRAMEBUFFER);if(e!==t.FRAMEBUFFER_COMPLETE)throw new Error("Error binding framebuffer: "+be(t,e))}function be(t,e){switch(e){case t.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:return"FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT";case t.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:return"FRAMEBUFFER_INCOMPLETE_DIMENSIONS";case t.FRAMEBUFFER_UNSUPPORTED:return"FRAMEBUFFER_UNSUPPORTED";default:return"unknown error "+e}}function we(t,e,n,r){var o=Kt(t,e,(function(){return n()}));if(null==o)throw new Error(r);return o}function xe(t,e){var n=t.MAX_COMBINED_TEXTURE_IMAGE_UNITS-1,r=e+t.TEXTURE0;if(r<t.TEXTURE0||r>n)throw new Error("textureUnit must be in [gl.TEXTURE0, gl.TEXTURE"+n+"].")}function _e(t,e){return void 0===e&&(e=2),I(t.slice(0,t.length-e))}function Ee(t){if(0===t.length)throw Error("Cannot get rows and columns of an empty shape array.");return[t.length>1?t[t.length-2]:1,t[t.length-1]]}function Ce(t){var e=[1,1,1];return 0===t.length||1===t.length&&1===t[0]||(e=[_e(t)].concat(Ee(t))),e}function Se(t,e){var n;void 0===e&&(e=!1);var r=f().getNumber("WEBGL_MAX_TEXTURE_SIZE");if(e&&(r*=2,1===(t=t.map((function(e,n){return n>=t.length-2?_(t[n]):t[n]}))).length&&(t=[2,t[0]])),2!==t.length){var o=F(t);t=o.newShape}var i=I(t);if(t.length<=1&&i<=r)return[1,i];if(2===t.length&&t[0]<=r&&t[1]<=r)return t;if(3===t.length&&t[0]*t[1]<=r&&t[2]<=r)return[t[0]*t[1],t[2]];if(3===t.length&&t[0]<=r&&t[1]*t[2]<=r)return[t[0],t[1]*t[2]];if(4===t.length&&t[0]*t[1]*t[2]<=r&&t[3]<=r)return[t[0]*t[1]*t[2],t[3]];if(4===t.length&&t[0]<=r&&t[1]*t[2]*t[3]<=r)return[t[0],t[1]*t[2]*t[3]];if(e){var a=_e(t),s=2,u=2;return t.length&&(s=(n=Ee(t))[0],u=n[1]),D(i=a*(s/2)*(u/2)).map((function(t){return 2*t}))}return D(i)}function ke(t){return t%2==0}function Te(t,e){if(O(t=t.slice(-2),e=e.slice(-2)))return!0;if(!t.length||!e.length)return!0;if(0===t[0]||0===t[1]||0===e[0]||0===e[1])return!0;if(t.length!==e.length){var n=t.slice(-1)[0],r=e.slice(-1)[0];if(n===r)return!0;if(ke(n)&&ke(r)&&(1===t[0]||1===e[0]))return!0}return t[1]===e[1]&&ke(t[0])&&ke(e[0])}function Ie(t){if(null==te){var e=Vt(t);te=e.getParameter(e.MAX_TEXTURE_SIZE)}return te}function Oe(t){if(null==ee){var e=Vt(t);ee=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)}return Math.min(16,ee)}function Re(t){if(0===t)return 0;var e=Vt(t);return Ae(e,"EXT_disjoint_timer_query_webgl2")&&2===t?2:Ae(e,"EXT_disjoint_timer_query")?1:0}function Ae(t,e){return null!=t.getExtension(e)}function De(t){try{if(null!=Vt(t))return!0}catch(t){return!1}return!1}function Ne(t){if(0===t)return!1;var e=Vt(t);if(1===t){if(!Ae(e,"OES_texture_float"))return!1}else if(!Ae(e,"EXT_color_buffer_float"))return!1;return Me(e)}function Pe(t){if(0===t)return!1;var e=Vt(t);if(1!==t){if(Ae(e,"EXT_color_buffer_float"))return Me(e);if(Ae(e,"EXT_color_buffer_half_float")){var n=e.getExtension("EXT_color_buffer_half_float");return function(t,e){var n=Xt(t,e),r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,n.internalFormatHalfFloat,1,1,0,n.textureFormatFloat,n.textureTypeHalfFloat,null);var o=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,o),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);var i=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(r),t.deleteFramebuffer(o),i}(e,n)}return!1}return!!Ae(e,"OES_texture_float")&&!!Ae(e,"WEBGL_color_buffer_float")&&Me(e)}function Me(t){var e=Xt(t),n=t.createTexture();t.bindTexture(t.TEXTURE_2D,n),t.texImage2D(t.TEXTURE_2D,0,e.internalFormatFloat,1,1,0,e.textureFormatFloat,e.textureTypeFloat,null);var r=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,r),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,n,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER)===t.FRAMEBUFFER_COMPLETE;return t.bindTexture(t.TEXTURE_2D,null),t.bindFramebuffer(t.FRAMEBUFFER,null),t.deleteTexture(n),t.deleteFramebuffer(r),o}function je(t){return 2===t&&null!=Vt(t).fenceSync}var Fe=Object.freeze({callAndCheck:Kt,canBeRepresented:Yt,getWebGLErrorMessage:$t,getExtensionOrThrow:Jt,createVertexShader:Qt,createFragmentShader:Zt,createProgram:re,linkProgram:oe,validateProgram:ie,createStaticVertexBuffer:ae,createStaticIndexBuffer:se,getNumChannels:function(){return 2===f().getNumber("WEBGL_VERSION")?1:4},createTexture:ue,validateTextureSize:ce,createFramebuffer:le,bindVertexBufferToProgramAttribute:fe,bindTextureUnit:he,unbindTextureUnit:function(t,e,n){xe(t,n),Kt(t,e,(function(){return t.activeTexture(t.TEXTURE0+n)})),Kt(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,null)}))},getProgramUniformLocationOrThrow:pe,getProgramUniformLocation:de,bindTextureToProgramUniformSampler:me,bindCanvasToFramebuffer:function(t,e){Kt(t,e,(function(){return t.bindFramebuffer(t.FRAMEBUFFER,null)})),Kt(t,e,(function(){return t.viewport(0,0,t.canvas.width,t.canvas.height)})),Kt(t,e,(function(){return t.scissor(0,0,t.canvas.width,t.canvas.height)}))},bindColorTextureToFramebuffer:ve,unbindColorTextureFromFramebuffer:ge,validateFramebuffer:ye,getFramebufferErrorMessage:be,getBatchDim:_e,getRowsCols:Ee,getShapeAs3D:Ce,getTextureShapeFromLogicalShape:Se,isReshapeFree:Te,getWebGLMaxTextureSize:Ie,resetMaxTextureSize:function(){te=null},resetMaxTexturesInShader:function(){ee=null},getMaxTexturesInShader:Oe,getWebGLDisjointQueryTimerVersion:Re,hasExtension:Ae,isWebGLVersionEnabled:De,isCapableOfRenderingToFloatTexture:Ne,isDownloadFloatTextureEnabled:Pe,isWebGLFenceEnabled:je}),Be=f();function Le(t){f().getBool("DEPRECATION_WARNINGS_ENABLED")&&console.warn(t+" You can disable deprecation warnings with tf.disableDeprecationWarnings().")}function Ue(t,e){return Pt.tidy(t,e)}function We(t){Rt(t).forEach((function(t){return t.dispose()}))}function ze(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];f().getBool("IS_TEST")||console.warn.apply(console,t)}function Ve(t,e){var n=t;if(V(t))return"string"===e?[]:[t.length];if(!Array.isArray(t))return[];for(var r=[];Array.isArray(n)||V(n)&&"string"!==e;)r.push(n.length),n=n[0];return Array.isArray(t)&&f().getBool("TENSORLIKE_CHECK_SHAPE_CONSISTENCY")&&function t(e,n,r){if(r=r||[],Array.isArray(e)||V(e)){C(n.length>0,(function(){return"Element arr["+r.join("][")+"] should be a primitive, but is an array of "+e.length+" elements"})),C(e.length===n[0],(function(){return"Element arr["+r.join("][")+"] should have "+n[0]+" elements, but has "+e.length+" elements"}));for(var o=n.slice(1),i=0;i<e.length;++i)t(e[i],o,r.concat(i))}else C(0===n.length,(function(){return"Element arr["+r.join("][")+"] is a primitive, but should be an array/TypedArray of "+n[0]+" elements"}))}(t,r,[]),r}function qe(t,e,n,r){if(null!=t&&("numeric"!==t&&t!==e||"numeric"===t&&"string"===e))throw new Error("Argument '"+n+"' passed to '"+r+"' must be "+t+" tensor, but got "+e+" tensor")}function Ge(t,e,n,r){if(void 0===r&&(r="numeric"),t instanceof yt)return qe(r,t.dtype,e,n),t;var o=Y(t);if("string"!==o&&["bool","int32","float32"].indexOf(r)>=0&&(o=r),qe(r,o,e,n),null==t||!V(t)&&!Array.isArray(t)&&"number"!=typeof t&&"boolean"!=typeof t&&"string"!=typeof t){var i=null==t?"null":t.constructor.name;throw new Error("Argument '"+e+"' passed to '"+n+"' must be a Tensor or TensorLike, but got '"+i+"'")}var a=Ve(t,o);V(t)||Array.isArray(t)||(t=[t]);var s="string"!==o?Z(t,o,f().getBool("DEBUG")):T(t,[],!0);return Pt.makeTensor(s,a,o)}function He(t,e,n,r){if(void 0===r&&(r="numeric"),!Array.isArray(t))throw new Error("Argument "+e+" passed to "+n+" must be a `Tensor[]` or `TensorLike[]`");return t.map((function(t,r){return Ge(t,e+"["+r+"]",n)}),r)}function Xe(t,e){for(var n=0;n<t.length;++n)if(t[t.length-n-1]!==e-1-n)return!1;return!0}function Ke(t,e,n){for(var r=t.length+e.length,o=[],i=0,a=0,s=0;s<r;s++)-1===n.indexOf(s)?o.push(t[i++]):o.push(e[a++]);return o}function Ye(t,e){for(var n=[],r=t.length,o=0;o<r;o++)-1===e.indexOf(o)&&n.push(t[o]);return[n,e.map((function(e){return t[e]}))]}function $e(t,e){return Ke(t,e.map((function(t){return 1})),e)}function Je(t,e,n){C(Xe(e,n),(function(){return t+" supports only inner-most axes for now. Got axes "+e+" and rank-"+n+" input."}))}function Qe(t,e){if(Xe(t,e))return null;for(var n=[],r=0;r<e;++r)-1===t.indexOf(r)&&n.push(r);return t.forEach((function(t){return n.push(t)})),n}function Ze(t){return t.map((function(t,e){return[e,t]})).sort((function(t,e){return t[1]-e[1]})).map((function(t){return t[0]}))}function tn(t,e){for(var n=[],r=e-t;r<e;++r)n.push(r);return n}function en(t,e){var n=t[0].length;t.forEach((function(t,e){C(t.length===n,(function(){return"Error in concat"+n+"D: rank of tensors["+e+"] must be the same as the rank of the rest ("+n+")"}))})),C(e>=0&&e<n,(function(){return"Error in concat"+n+"D: axis must be between 0 and "+(n-1)+"."}));var r=t[0];t.forEach((function(t,o){for(var i=0;i<n;i++)C(i===e||t[i]===r[i],(function(){return"Error in concat"+n+"D: Shape of tensors["+o+"] ("+t+") does not match the shape of the rest ("+r+") along the non-concatenated axis "+o+"."}))}))}function nn(t,e){for(var n=t[0].slice(),r=1;r<t.length;r++)n[e]+=t[r][e];return n}function rn(t){var e=Object.keys(t);if(1!==e.length)throw new Error("Please provide an object with a single key (operation name) mapping to a function. Got an object with "+e.length+" keys.");var n=e[0],r=t[n];n.endsWith("_")&&(n=n.substring(0,n.length-1));var o=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];Pt.startScope(n);try{var o=r.apply(void 0,t);return o instanceof Promise&&console.error("Cannot return a Promise inside of tidy."),Pt.endScope(o),o}catch(t){throw Pt.endScope(null),t}};return Object.defineProperty(o,"name",{value:n,configurable:!0}),o}Be.registerFlag("HAS_WEBGL",(function(){return Be.getNumber("WEBGL_VERSION")>0})),Be.registerFlag("WEBGL_VERSION",(function(){return De(2)?2:De(1)?1:0})),Be.registerFlag("WEBGL_BUFFER_SUPPORTED",(function(){return 2===Be.get("WEBGL_VERSION")})),Be.registerFlag("WEBGL_CPU_FORWARD",(function(){return!0})),Be.registerFlag("WEBGL_FORCE_F16_TEXTURES",(function(){return!1})),Be.registerFlag("WEBGL_PACK",(function(){return Be.getBool("HAS_WEBGL")})),Be.registerFlag("WEBGL_PACK_NORMALIZATION",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_PACK_CLIP",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_PACK_DEPTHWISECONV",(function(){return!1})),Be.registerFlag("WEBGL_PACK_BINARY_OPERATIONS",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_PACK_UNARY_OPERATIONS",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_PACK_ARRAY_OPERATIONS",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_PACK_IMAGE_OPERATIONS",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_PACK_REDUCE",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_LAZILY_UNPACK",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_CONV_IM2COL",(function(){return Be.getBool("WEBGL_PACK")})),Be.registerFlag("WEBGL_MAX_TEXTURE_SIZE",(function(){return Ie(Be.getNumber("WEBGL_VERSION"))})),Be.registerFlag("WEBGL_MAX_TEXTURES_IN_SHADER",(function(){return Oe(Be.getNumber("WEBGL_VERSION"))})),Be.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION",(function(){var t=Be.getNumber("WEBGL_VERSION");return 0===t?0:Re(t)})),Be.registerFlag("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE",(function(){return Be.getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0&&(t=navigator.userAgent||navigator.vendor||window.opera,!(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4))));var t})),Be.registerFlag("WEBGL_RENDER_FLOAT32_CAPABLE",(function(){return Ne(Be.getNumber("WEBGL_VERSION"))})),Be.registerFlag("WEBGL_RENDER_FLOAT32_ENABLED",(function(){return!Be.getBool("WEBGL_FORCE_F16_TEXTURES")&&Be.getBool("WEBGL_RENDER_FLOAT32_CAPABLE")})),Be.registerFlag("WEBGL_DOWNLOAD_FLOAT_ENABLED",(function(){return Pe(Be.getNumber("WEBGL_VERSION"))})),Be.registerFlag("WEBGL_FENCE_API_ENABLED",(function(){return je(Be.getNumber("WEBGL_VERSION"))})),Be.registerFlag("WEBGL_SIZE_UPLOAD_UNIFORM",(function(){return Be.getBool("WEBGL_RENDER_FLOAT32_ENABLED")?4:0})),gt=Le;var on=rn({complex_:function(t,e){var n=Ge(t,"real","complex"),r=Ge(e,"imag","complex");return S(n.shape,r.shape,"real and imag shapes, "+n.shape+" and "+r.shape+", must match in call to tf.complex()."),Pt.runKernelFunc((function(t){return t.complex(n,r)}),{$real:n,$imag:r})}}),an=rn({real_:function(t){var e=Ge(t,"input","real");return Pt.runKernelFunc((function(t){return t.real(e)}),{$input:e})}}),sn=rn({imag_:function(t){var e=Ge(t,"input","imag");return Pt.runKernelFunc((function(t){return t.imag(e)}),{$input:e})}});function un(t,e,n){return cn(t,e,Ve(t,n),n)}function cn(t,e,n,r){if(null==r&&(r=Y(t)),"complex64"===r)throw new Error("Cannot construct a complex64 tensor directly. Please use tf.complex(real, imag).");if(!V(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){ot(e);var o=I(e),i=I(n);C(o===i,(function(){return"Based on the provided shape, ["+e+"], the tensor should have "+o+" values but has "+i}));for(var a=0;a<n.length;++a){var s=n[a],u=a!==n.length-1||s!==I(e.slice(a));C(n[a]===e[a]||!u,(function(){return"Error creating a new Tensor. Inferred shape ("+n+") does not match the provided shape ("+e+"). "}))}}return V(t)||Array.isArray(t)||(t=[t]),e=e||n,t="string"!==r?Z(t,r,f().getBool("DEBUG")):T(t,[],!0),Pt.makeTensor(t,e,r)}function ln(t,e){if((V(t)&&"string"!==e||Array.isArray(t))&&"complex64"!==e)throw new Error("Error creating a new Scalar: value must be a primitive (number|boolean|string)");if("string"===e&&V(t)&&!(t instanceof Uint8Array))throw new Error("When making a scalar from encoded string, the value must be `Uint8Array`.");return cn(t,[],[],e)}function fn(t,e){k(t);var n=Ve(t,e);if(1!==n.length)throw new Error("tensor1d() requires values to be a flat/TypedArray");return cn(t,null,n,e)}function hn(t,e,n){if(k(t),null!=e&&2!==e.length)throw new Error("tensor2d() requires shape to have two numbers");var r=Ve(t,n);if(2!==r.length&&1!==r.length)throw new Error("tensor2d() requires values to be number[][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor2d() requires shape to be provided when `values` are a flat/TypedArray");return cn(t,e,r,n)}function pn(t,e,n){if(k(t),null!=e&&3!==e.length)throw new Error("tensor3d() requires shape to have three numbers");var r=Ve(t,n);if(3!==r.length&&1!==r.length)throw new Error("tensor3d() requires values to be number[][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor3d() requires shape to be provided when `values` are a flat array");return cn(t,e,r,n)}function dn(t,e,n){if(k(t),null!=e&&4!==e.length)throw new Error("tensor4d() requires shape to have four numbers");var r=Ve(t,n);if(4!==r.length&&1!==r.length)throw new Error("tensor4d() requires values to be number[][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor4d() requires shape to be provided when `values` are a flat array");return cn(t,e,r,n)}function mn(t,e){if(void 0===e&&(e="float32"),"complex64"===e){var n=mn(t,"float32"),r=vn(t,"float32");return on(n,r)}var o=et(I(t),e);return Pt.makeTensor(o,t,e)}function vn(t,e){if(void 0===e&&(e="float32"),"complex64"===e){var n=vn(t,"float32"),r=vn(t,"float32");return on(n,r)}var o=nt(I(t),e);return Pt.makeTensor(o,t,e)}function gn(t,e,n){return Pt.runKernelFunc((function(r){return r.fill(t,e,n)}),{})}function yn(t,e,n,r){if(void 0===n&&(n=1),void 0===r&&(r="float32"),0===n)throw new Error("Cannot have a step of zero");if(t===e||t<e&&n<0||e<t&&n>1)return vn([0],r);var o=nt(Math.abs(Math.ceil((e-t)/n)),r);e<t&&1===n&&(n=-1),o[0]=t;for(var i=1;i<o.length;i++)o[i]=o[i-1]+n;return fn(o,r)}var bn=rn({onesLike_:function(t){var e=Ge(t,"x","onesLike");if("complex64"===e.dtype){var n=bn(an(e)),r=wn(sn(e));return on(n,r)}return Pt.runKernelFunc((function(t){return t.onesLike(e)}),{$x:e},(function(t,e){return{$x:function(){return wn(t)}}}))}}),wn=rn({zerosLike_:function(t){var e=Ge(t,"x","zerosLike");return Pt.runKernelFunc((function(t){return t.zerosLike(e)}),{$x:e},(function(t,e){return{$x:function(){return wn(t)}}}))}}),xn=rn({concat_:function(t,e){void 0===e&&(e=0),C(t.length>=1,(function(){return"Pass at least one tensor to concat"}));var n=He(t,"tensors","concat");"complex64"===n[0].dtype&&n.forEach((function(t){if("complex64"!==t.dtype)throw new Error("Cannot concatenate complex64 tensors with a tensor\n with dtype "+t.dtype+". ")})),e=j(e,n[0].shape)[0];var r=nn(n.map((function(t){return t.shape})),e);if(0===I(r))return un([],r);if(1===(n=n.filter((function(t){return t.size>0}))).length)return n[0];var o=n.map((function(t){return t.shape}));en(o,e);var i=n,a={axis:e};return Pt.runKernelFunc((function(t){return t.concat(n,e)}),i,(function(t){var n=o.map((function(t){return t[e]}));return kn(t,n,e).map((function(t){return function(){return t}}))}),"Concat",a)}}),_n=rn({concat1d_:function(t){return xn(t,0)}}),En=rn({concat2d_:function(t,e){return xn(t,e)}}),Cn=rn({concat3d_:function(t,e){return xn(t,e)}}),Sn=rn({concat4d_:function(t,e){return xn(t,e)}}),kn=rn({split_:function(t,e,n){void 0===n&&(n=0);var r,o=Ge(t,"x","split");return n=j(n,o.shape)[0],"number"==typeof e?(C(o.shape[n]%e==0,(function(){return"Number of splits must evenly divide the axis."})),r=new Array(e).fill(o.shape[n]/e)):(C(o.shape[n]===e.reduce((function(t,e){return t+e})),(function(){return"The sum of sizes must match the size of the axis dimension."})),r=e),Pt.runKernelFunc((function(t){return t.split(o,r,n)}),{$x:o},(function(t){return{$x:function(){return xn(t,n)}}}))}});function Tn(t,e){return t(e={exports:{}},e.exports),e.exports}"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==t||"undefined"!=typeof self&&self;var In=Tn((function(t){!function(t,e,n){function r(t){var e,n=this,r=(e=4022871197,function(t){t=t.toString();for(var n=0;n<t.length;n++){var r=.02519603282416938*(e+=t.charCodeAt(n));r-=e=r>>>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}function o(t,e){return e.c=t.c,e.s0=t.s0,e.s1=t.s1,e.s2=t.s2,e}function i(t,e){var n=new r(t),i=e&&e.state,a=n.next;return a.int32=function(){return 4294967296*n.next()|0},a.double=function(){return a()+11102230246251565e-32*(2097152*a()|0)},a.quick=a,i&&("object"==typeof i&&o(i,n),a.state=function(){return o(n,{})}),a}e&&e.exports?e.exports=i:this.alea=i}(0,t)})),On=Tn((function(t){!function(t,e,n){function r(t){var e=this,n="";e.x=0,e.y=0,e.z=0,e.w=0,e.next=function(){var t=e.x^e.x<<11;return e.x=e.y,e.y=e.z,e.z=e.w,e.w^=e.w>>>19^t^t>>>8},t===(0|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),e.next()}function o(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e}function i(t,e){var n=new r(t),i=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,i&&("object"==typeof i&&o(i,n),a.state=function(){return o(n,{})}),a}e&&e.exports?e.exports=i:this.xor128=i}(0,t)})),Rn=Tn((function(t){!function(t,e,n){function r(t){var e=this,n="";e.next=function(){var t=e.x^e.x>>>2;return e.x=e.y,e.y=e.z,e.z=e.w,e.w=e.v,(e.d=e.d+362437|0)+(e.v=e.v^e.v<<4^t^t<<1)|0},e.x=0,e.y=0,e.z=0,e.w=0,e.v=0,t===(0|t)?e.x=t:n+=t;for(var r=0;r<n.length+64;r++)e.x^=0|n.charCodeAt(r),r==n.length&&(e.d=e.x<<10^e.x>>>4),e.next()}function o(t,e){return e.x=t.x,e.y=t.y,e.z=t.z,e.w=t.w,e.v=t.v,e.d=t.d,e}function i(t,e){var n=new r(t),i=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,i&&("object"==typeof i&&o(i,n),a.state=function(){return o(n,{})}),a}e&&e.exports?e.exports=i:this.xorwow=i}(0,t)})),An=Tn((function(t){!function(t,e,n){function r(t){var e=this;e.next=function(){var t,n,r=e.x,o=e.i;return t=r[o],n=(t^=t>>>7)^t<<24,n^=(t=r[o+1&7])^t>>>10,n^=(t=r[o+3&7])^t>>>3,n^=(t=r[o+4&7])^t<<7,t=r[o+7&7],n^=(t^=t<<13)^t<<9,r[o]=n,e.i=o+1&7,n},function(t,e){var n,r=[];if(e===(0|e))r[0]=e;else for(e=""+e,n=0;n<e.length;++n)r[7&n]=r[7&n]<<15^e.charCodeAt(n)+r[n+1&7]<<13;for(;r.length<8;)r.push(0);for(n=0;n<8&&0===r[n];++n);for(8==n?r[7]=-1:r[n],t.x=r,t.i=0,n=256;n>0;--n)t.next()}(e,t)}function o(t,e){return e.x=t.x.slice(),e.i=t.i,e}function i(t,e){null==t&&(t=+new Date);var n=new r(t),i=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,i&&(i.x&&o(i,n),a.state=function(){return o(n,{})}),a}e&&e.exports?e.exports=i:this.xorshift7=i}(0,t)})),Dn=Tn((function(t){!function(t,e,n){function r(t){var e=this;e.next=function(){var t,n,r=e.w,o=e.X,i=e.i;return e.w=r=r+1640531527|0,n=o[i+34&127],t=o[i=i+1&127],n^=n<<13,t^=t<<17,n^=n>>>15,t^=t>>>12,n=o[i]=n^t,e.i=i,n+(r^r>>>16)|0},function(t,e){var n,r,o,i,a,s=[],u=128;for(e===(0|e)?(r=e,e=null):(e+="\0",r=0,u=Math.max(u,e.length)),o=0,i=-32;i<u;++i)e&&(r^=e.charCodeAt((i+32)%e.length)),0===i&&(a=r),r^=r<<10,r^=r>>>15,r^=r<<4,r^=r>>>13,i>=0&&(a=a+1640531527|0,o=0==(n=s[127&i]^=r+a)?o+1:0);for(o>=128&&(s[127&(e&&e.length||0)]=-1),o=127,i=512;i>0;--i)r=s[o+34&127],n=s[o=o+1&127],r^=r<<13,n^=n<<17,r^=r>>>15,n^=n>>>12,s[o]=r^n;t.w=a,t.X=s,t.i=o}(e,t)}function o(t,e){return e.i=t.i,e.w=t.w,e.X=t.X.slice(),e}function i(t,e){null==t&&(t=+new Date);var n=new r(t),i=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,i&&(i.X&&o(i,n),a.state=function(){return o(n,{})}),a}e&&e.exports?e.exports=i:this.xor4096=i}(0,t)})),Nn=Tn((function(t){!function(t,e,n){function r(t){var e=this,n="";e.next=function(){var t=e.b,n=e.c,r=e.d,o=e.a;return t=t<<25^t>>>7^n,n=n-r|0,r=r<<24^r>>>8^o,o=o-t|0,e.b=t=t<<20^t>>>12^n,e.c=n=n-r|0,e.d=r<<16^n>>>16^o,e.a=o-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<n.length+20;r++)e.b^=0|n.charCodeAt(r),e.next()}function o(t,e){return e.a=t.a,e.b=t.b,e.c=t.c,e.d=t.d,e}function i(t,e){var n=new r(t),i=e&&e.state,a=function(){return(n.next()>>>0)/4294967296};return a.double=function(){do{var t=((n.next()>>>11)+(n.next()>>>0)/4294967296)/(1<<21)}while(0===t);return t},a.int32=n.next,a.quick=a,i&&("object"==typeof i&&o(i,n),a.state=function(){return o(n,{})}),a}e&&e.exports?e.exports=i:this.tychei=i}(0,t)})),Pn=Tn((function(t){!function(e,r){var o,i=this,a=256,s="random",u=r.pow(a,6),c=r.pow(2,52),l=2*c,f=255;function h(t,n,f){var h=[],g=m(function t(e,n){var r,o=[],i=typeof e;if(n&&"object"==i)for(r in e)try{o.push(t(e[r],n-1))}catch(t){}return o.length?o:"string"==i?e:e+"\0"}((n=1==n?{entropy:!0}:n||{}).entropy?[t,v(e)]:null==t?function(){try{var t;return o&&(t=o.randomBytes)?t=t(a):(t=new Uint8Array(a),(i.crypto||i.msCrypto).getRandomValues(t)),v(t)}catch(t){var n=i.navigator,r=n&&n.plugins;return[+new Date,i,r,i.screen,v(e)]}}():t,3),h),y=new p(h),b=function(){for(var t=y.g(6),e=u,n=0;t<c;)t=(t+n)*a,e*=a,n=y.g(1);for(;t>=l;)t/=2,e/=2,n>>>=1;return(t+n)/e};return b.int32=function(){return 0|y.g(4)},b.quick=function(){return y.g(4)/4294967296},b.double=b,m(v(y.S),e),(n.pass||f||function(t,e,n,o){return o&&(o.S&&d(o,y),t.state=function(){return d(y,{})}),n?(r[s]=t,e):t})(b,g,"global"in n?n.global:this==r,n.state)}function p(t){var e,n=t.length,r=this,o=0,i=r.i=r.j=0,s=r.S=[];for(n||(t=[n++]);o<a;)s[o]=o++;for(o=0;o<a;o++)s[o]=s[i=f&i+t[o%n]+(e=s[o])],s[i]=e;(r.g=function(t){for(var e,n=0,o=r.i,i=r.j,s=r.S;t--;)e=s[o=f&o+1],n=n*a+s[f&(s[o]=s[i=f&i+e])+(s[i]=e)];return r.i=o,r.j=i,n})(a)}function d(t,e){return e.i=t.i,e.j=t.j,e.S=t.S.slice(),e}function m(t,e){for(var n,r=t+"",o=0;o<r.length;)e[f&o]=f&(n^=19*e[f&o])+r.charCodeAt(o++);return v(e)}function v(t){return String.fromCharCode.apply(0,t)}if(r.seedrandom=h,m(r.random(),e),t.exports){t.exports=h;try{o=n(/*! crypto */5)}catch(t){}}}([],Math)}));Pn.alea=In,Pn.xor128=On,Pn.xorwow=Rn,Pn.xorshift7=An,Pn.xor4096=Dn,Pn.tychei=Nn;var Mn=Pn.alea,jn=function(){function t(t,e,n,r,o){this.mean=t,this.stdDev=e,this.dtype=n,this.nextVal=NaN,this.truncated=r,this.truncated&&(this.upper=this.mean+2*this.stdDev,this.lower=this.mean-2*this.stdDev);var i=o||Math.random();this.random=Mn(i.toString())}return t.prototype.nextValue=function(){if(!isNaN(this.nextVal)){var t=this.nextVal;return this.nextVal=NaN,t}for(var e,n,r=!1;!r;){var o=void 0,i=void 0,a=void 0;do{a=(o=2*this.random()-1)*o+(i=2*this.random()-1)*i}while(a>=1||0===a);var s=Math.sqrt(-2*Math.log(a)/a);e=this.mean+this.stdDev*o*s,n=this.mean+this.stdDev*i*s,this.truncated&&!this.isValidTruncated(e)||(r=!0)}return this.truncated&&!this.isValidTruncated(n)||(this.nextVal=this.convertValue(n)),this.convertValue(e)},t.prototype.convertValue=function(t){return null==this.dtype||"float32"===this.dtype?t:Math.round(t)},t.prototype.isValidTruncated=function(t){return t<=this.upper&&t>=this.lower},t}(),Fn=function(){function t(t,e,n,r){this.alpha=t,this.beta=1/e,this.dtype=n;var o=r||Math.random();this.randu=Mn(o.toString()),this.randn=new jn(0,1,n,!1,this.randu()),this.d=t<1?t+2/3:t-1/3,this.c=1/Math.sqrt(9*this.d)}return t.prototype.nextValue=function(){for(var t,e,n,r,o,i;;){do{r=this.randn.nextValue(),i=1+this.c*r}while(i<=0);if(i*=i*i,e=1-.331*(t=r*r)*t,n=.5*t+this.d*(1-i+Math.log(i)),(o=this.randu())<e||Math.log(o)<n)break}return i=1/this.beta*this.d*i,this.alpha<1&&(i*=Math.pow(this.randu(),1/this.alpha)),this.convertValue(i)},t.prototype.convertValue=function(t){return"float32"===this.dtype?t:Math.round(t)},t}(),Bn=function(){function t(t,e,n,r){var o=this;if(void 0===t&&(t=0),void 0===e&&(e=1),this.canReturnFloat=function(){return null==o.dtype||"float32"===o.dtype},this.min=t,this.range=e-t,this.dtype=n,null==r&&(r=Math.random()),"number"==typeof r&&(r=r.toString()),!this.canReturnFloat()&&this.range<=1)throw new Error("The difference between "+t+" - "+e+" <= 1 and dtype is not float");this.random=Mn(r)}return t.prototype.convertValue=function(t){return this.canReturnFloat()?t:Math.round(t)},t.prototype.nextValue=function(){return this.convertValue(this.min+this.range*this.random())},t}();function Ln(t,e,n){return void 0===e&&(e="float32"),e=e||"float32",ot(t),new dt(t,e,n)}var Un=rn({batchToSpaceND_:function(t,e,n){var r=Ge(t,"x","batchToSpaceND"),o=e.reduce((function(t,e){return t*e}));return C(r.rank>=1+e.length,(function(){return"input rank is "+r.rank+" but should be > than blockShape.length "+e.length})),C(n.length===e.length,(function(){return"crops.length is "+n.length+" but should be equal to blockShape.length "+e.length})),C(r.shape[0]%o==0,(function(){return"input tensor batch is "+r.shape[0]+" but is not divisible by the product of the elements of blockShape "+e.join(" * ")+" === "+o})),Pt.runKernelFunc((function(t){return t.batchToSpaceND(r,e,n)}),{$x:r},(function(t){return{$x:function(){return t.spaceToBatchND(e,n)}}}))}}),Wn=rn({broadcastTo_:function(t,e){var n=Ge(t,"broadcastTo","x"),r=n.shape;if(e.some((function(t){return!(t>0)||t%1!=0})))throw new Error("broadcastTo(): Invalid broadcast shape ["+e+"].");if(e.length<n.rank)throw new Error("broadcastTo(): shape.length="+e.length+" < input.rank="+n.rank+".");if(e.length>n.rank){for(var o=n.shape.slice();o.length<e.length;)o.unshift(1);n=n.reshape(o)}for(var i=Array.from(e),a=e.length-1;a>=0;a--)if(n.shape[a]===e[a])i[a]=1;else if(1!==n.shape[a])throw new Error("broadcastTo(): ["+r+"] cannot be broadcast to ["+e+"].");var s=i.map((function(t,e){return t>1?e:-1})).filter((function(t){return t>=0}));return 0===s.length?n.clone():Pt.runKernelFunc((function(t){return t.tile(n,i)}),{input:n},(function(t){return{input:function(){return t.sum(s,!0)}}}))}}),zn=rn({cast_:function(t,e){var n=Ge(t,"x","cast");if(!W(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");var r={dtype:e};return Pt.runKernelFunc((function(t){return t.cast(n,e)}),{x:n},(function(t){return{x:function(){return t.clone()}}}),"Cast",r)}}),Vn=rn({clone_:function(t){var e=Ge(t,"x","clone",null);return Pt.runKernelFunc((function(){return Pt.makeTensorFromDataId(e.dataId,e.shape,e.dtype)}),{$x:e},(function(t){return{$x:function(){return t.toFloat()}}}))}}),qn=rn({cumsum_:function(t,e,n,r){void 0===e&&(e=0),void 0===n&&(n=!1),void 0===r&&(r=!1);var o=Ge(t,"x","cumsum"),i=Qe([e|=0],o.rank),a=o;null!=i&&(a=o.transpose(i));var s=tn(1,o.rank)[0],u=Pt.runKernelFunc((function(t){return t.cumsum(a,s,n,r)}),{permutedX:a},(function(t){return{permutedX:function(){return t.cumsum(e,n,!r)}}}));return null!=i&&(u=u.transpose(i)),u}}),Gn=rn({depthToSpace_:function(t,e,n){void 0===n&&(n="NHWC");var r=Ge(t,"x","depthToSpace"),o="NHWC"===n?r.shape[1]:r.shape[2],i="NHWC"===n?r.shape[2]:r.shape[3],a="NHWC"===n?r.shape[3]:r.shape[1];return C(o*e>=0,(function(){return"Negative dimension size caused by overflow when multiplying\n "+o+" and "+e+" for depthToSpace with input shape\n "+r.shape})),C(i*e>=0,(function(){return"Negative dimension size caused by overflow when multiplying\n "+i+" and "+e+" for depthToSpace with input shape\n "+r.shape})),C(a%(e*e)==0,(function(){return"Dimension size must be evenly divisible by "+e*e+" but is "+a+" for depthToSpace with input shape "+r.shape})),Pt.runKernelFunc((function(t){return t.depthToSpace(r,e,n)}),{$x:r})}}),Hn=rn({expandDims_:function(t,e){void 0===e&&(e=0);var n=Ge(t,"x","expandDims",null);C(e<=n.rank,(function(){return"Axis must be <= rank of the tensor"}));var r=n.shape.slice();return e<0&&(C(-(n.rank+1)<=e,(function(){return"Axis must be in the interval ["+-(n.rank+1)+", "+n.rank+"]"})),e=n.rank+e+1),r.splice(e,0,1),ir(n,r)}}),Xn=rn({eye_:function(t,e,n,r){void 0===r&&(r="float32"),null==e&&(e=t);for(var o=Ln([t,e],r),i=t<=e?t:e,a=0;a<i;++a)o.set(1,a,a);var s=o.toTensor().as2D(t,e);if(null==n)return s;if(1===n.length)return cr(Hn(s,0),[n[0],1,1]);if(2===n.length)return cr(Hn(Hn(s,0),0),[n[0],n[1],1,1]);if(3===n.length)return cr(Hn(Hn(Hn(s,0),0),0),[n[0],n[1],n[2],1,1]);throw new Error("eye() currently supports only 1D and 2D batchShapes, but received "+n.length+"D.")}}),Kn=rn({multinomial_:function(t,e,n,r){void 0===r&&(r=!1);var o=Ge(t,"logits","multinomial"),i=o.size,a=o.rank;if(i<2)throw new Error("Error in multinomial: you need at least 2 outcomes, but got "+i+".");if(a>2)throw new Error("Rank of probabilities must be 1 or 2, but is "+a);n=n||Math.random();var s=1===a?o.as2D(1,-1):o,u=Pt.runKernelFunc((function(t){return t.multinomial(s,r,e,n)}),{logits2D:s});return 1===a?u.as1D():u}}),Yn=rn({oneHot_:function(t,e,n,r){if(void 0===n&&(n=1),void 0===r&&(r=0),e<2)throw new Error("Error in oneHot: depth must be >=2, but it is "+e);var o=Ge(t,"indices","oneHot","int32"),i=o.shape.concat([e]);return o=o.flatten(),Pt.runKernelFunc((function(t){return t.oneHot(o,e,n,r)}),{$indices:o},(function(t){return{$indices:function(){return vn(o.shape,"float32")}}})).reshape(i)}}),$n=rn({pad_:function(t,e,n){void 0===n&&(n=0);var r=Ge(t,"x","pad");if(0===r.rank)throw new Error("pad(scalar) is not defined. Pass non-scalar to pad");var o={paddings:e,constantValue:n};return Pt.runKernelFunc((function(t){return t.pad(r,e,n)}),{x:r},(function(t){var n=e.map((function(t){return t[0]}));return{x:function(){return t.slice(n,r.shape)}}}),"PadV2",o)}}),Jn=rn({pad1d_:function(t,e,n){return void 0===n&&(n=0),C(2===e.length,(function(){return"Invalid number of paddings. Must be length of 2."})),$n(t,[e],n)}}),Qn=rn({pad2d_:function(t,e,n){return void 0===n&&(n=0),C(2===e.length&&2===e[0].length&&2===e[1].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),$n(t,e,n)}}),Zn=rn({pad3d_:function(t,e,n){return void 0===n&&(n=0),C(3===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),$n(t,e,n)}}),tr=rn({pad4d_:function(t,e,n){return void 0===n&&(n=0),C(4===e.length&&2===e[0].length&&2===e[1].length&&2===e[2].length&&2===e[3].length,(function(){return"Invalid number of paddings. Must be length of 2 each."})),$n(t,e,n)}}),er=rn({rand_:function(t,e,n){var r=I(t),o=null;if(null==n||"float32"===n)o=new Float32Array(r);else if("int32"===n)o=new Int32Array(r);else{if("bool"!==n)throw new Error("Unknown data type "+n);o=new Uint8Array(r)}for(var i=0;i<r;i++)o[i]=e();return Pt.makeTensor(o,t,n)}}),nr=rn({randomNormal_:function(t,e,n,r,o){if(void 0===e&&(e=0),void 0===n&&(n=1),null!=r&&"bool"===r)throw new Error("Unsupported data type "+r);for(var i=new jn(e,n,r,!1,o),a=Ln(t,r),s=0;s<a.values.length;s++)a.values[s]=i.nextValue();return a.toTensor()}}),rr=rn({randomGamma_:function(t,e,n,r,o){if(void 0===n&&(n=1),void 0===r&&(r="float32"),null==n&&(n=1),null==r&&(r="float32"),"float32"!==r&&"int32"!==r)throw new Error("Unsupported data type "+r);for(var i=new Fn(e,n,r,o),a=Ln(t,r),s=0;s<a.values.length;s++)a.values[s]=i.nextValue();return a.toTensor()}}),or=rn({randomUniform_:function(t,e,n,r,o){void 0===e&&(e=0),void 0===n&&(n=1),void 0===r&&(r="float32");for(var i=Ln(t,r),a=new Bn(e,n,null,o),s=0;s<i.values.length;s++)i.values[s]=a.nextValue();return i.toTensor()}}),ir=rn({reshape_:function(t,e){var n=Ge(t,"x","reshape",null);e=M(e,n.size),C(n.size===I(e),(function(){return"new shape and old shape must have the same number of elements."}));var r={shape:e};return Pt.runKernelFunc((function(t){return t.reshape(n,e)}),{x:n},(function(t){return{x:function(){return t.reshape(n.shape)}}}),"Reshape",r)}}),ar=rn({spaceToBatchND_:function(t,e,n){var r=Ge(t,"x","spaceToBatchND");return C(r.rank>=1+e.length,(function(){return"input rank "+r.rank+" should be > than [blockShape] "+e.length})),C(n.length===e.length,(function(){return"paddings.shape[0] "+n.length+" must be equal to [blockShape] "+e.length})),C(r.shape.reduce((function(t,r,o){return o>0&&o<=e.length?t&&(r+n[o-1][0]+n[o-1][1])%e[o-1]==0:t}),!0),(function(){return"input spatial dimensions "+r.shape.slice(1)+" with paddings "+n.toString()+" must be divisible by blockShapes "+e.toString()})),Pt.runKernelFunc((function(t){return t.spaceToBatchND(r,e,n)}),{$x:r},(function(t){return{$x:function(){return t.batchToSpaceND(e,n)}}}))}}),sr=rn({squeeze_:function(t,e){var n=Ge(t,"x","squeeze");return ir(n,F(n.shape,e).newShape)}}),ur=rn({stack_:function(t,e){void 0===e&&(e=0);var n=He(t,"tensors","stack");if(C(n.length>=1,(function(){return"Pass at least one tensor to tf.stack"})),1===n.length)return n[0].expandDims(e);var r=n[0].rank,o=n[0].shape,i=n[0].dtype;C(e<=r,(function(){return"Axis must be <= rank of the tensor"})),n.forEach((function(t){S(o,t.shape,"All tensors passed to stack must have matching shapes")})),n.forEach((function(t){C(i===t.dtype,(function(){return"All tensors passed to stack must have matching dtypes"}))}));var a=n.map((function(t){return t.expandDims(e)}));return xn(a,e)}}),cr=rn({tile_:function(t,e){var n=Ge(t,"x","tile",null);C(n.rank===e.length,(function(){return"Error in transpose: rank of input "+n.rank+" must match length of reps "+e+"."}));var r=[n],o={reps:e};return Pt.runKernelFunc((function(t,r){var o=t.tile(n,e);return r([n]),o}),{x:n},(function(t,n){var r=n[0];return{x:function(){var n=wn(r);if(1===r.rank)for(var o=0;o<e[0];++o)n=n.add(t.slice([o*r.shape[0]],[r.shape[0]]));else if(2===r.rank)for(o=0;o<e[0];++o)for(var i=0;i<e[1];++i)n=n.add(t.slice([o*r.shape[0],i*r.shape[1]],[r.shape[0],r.shape[1]]));else if(3===r.rank)for(o=0;o<e[0];++o)for(i=0;i<e[1];++i)for(var a=0;a<e[2];++a)n=n.add(t.slice([o*r.shape[0],i*r.shape[1],a*r.shape[2]],[r.shape[0],r.shape[1],r.shape[2]]));else{if(4!==r.rank)throw new Error("Gradient for tile operation is not implemented for rank-"+r.rank+" tensors yet.");for(o=0;o<e[0];++o)for(i=0;i<e[1];++i)for(a=0;a<e[2];++a)for(var s=0;s<e[3];++s)n=n.add(t.slice([o*r.shape[0],i*r.shape[1],a*r.shape[2],s*r.shape[3]],[r.shape[0],r.shape[1],r.shape[2],r.shape[3]]))}return n}}}),"Tile",o,r)}}),lr=rn({truncatedNormal_:function(t,e,n,r,o){if(void 0===e&&(e=0),void 0===n&&(n=1),null!=r&&"bool"===r)throw new Error("Unsupported data type "+r);for(var i=new jn(e,n,r,!0,o),a=Ln(t,r),s=0;s<a.values.length;s++)a.values[s]=i.nextValue();return a.toTensor()}}),fr=rn({unstack_:function(t,e){void 0===e&&(e=0),e=e||0;var n=Ge(t,"x","unstack");C(e>=-n.shape.length&&e<n.shape.length,(function(){return"Axis = "+e+" is not in [-"+n.shape.length+", "+n.shape.length+")"})),e<0&&(e+=n.shape.length);var r={axis:e};return Pt.runKernelFunc((function(t){return t.unstack(n,e)}),{x:n},(function(t){return{x:function(){return ur(t,e)}}}),"Unpack",r)}});function hr(t,e,n,r){void 0===r&&(r=!0);var o=[];if(r)(o=o.concat(e.slice(0))).push(t[0]/n),o=o.concat(t.slice(1));else{o=o.concat(t[0]);for(var i=e.length,a=0;a<i;++a)o=o.concat([t[a+1]/e[a],e[a]]);o=o.concat(t.slice(i+1))}return o}function pr(t,e,n){void 0===n&&(n=!0);var r=[];if(n){r.push(e);for(var o=e+1;o<t;++o)o<=2*e?(r.push(o),r.push(o-(e+1))):r.push(o)}else{var i=[],a=[];for(o=1;o<t;++o)o>=2*e+1||o%2==1?a.push(o):i.push(o);r.push.apply(r,i),r.push(0),r.push.apply(r,a)}return r}function dr(t,e,n,r){void 0===r&&(r=!0);var o=[];r?o.push(t[0]/n):o.push(t[0]*n);for(var i=1;i<t.length;++i)i<=e.length?r?o.push(e[i-1]*t[i]):o.push(t[i]/e[i-1]):o.push(t[i]);return o}function mr(t,e){for(var n=[0],r=0;r<e;++r)n.push(t[r][0]);return n}function vr(t,e,n){for(var r=t.slice(0,1),o=0;o<n;++o)r.push(t[o+1]-e[o][0]-e[o][1]);return r}function gr(t,e){if(t.rank<1)throw new Error("tf.gatherND() expects the input to be rank 1 or higher, but the rank was "+t.rank+".");if(e.rank<1)throw new Error("tf.gatherND() expects the indices to be rank 1 or higher, but the rank was "+e.rank+".");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[e.rank-1]>t.rank)throw new Error("index innermost dimension length must be <= tensor rank; saw: "+e.shape[e.rank-1]+" vs. "+t.rank);if(0===t.size)throw new Error("Requested more than 0 entries, but input is empty. Input shape: "+t.shape+".");for(var n=e.shape,r=n[n.length-1],o=1,i=0;i<n.length-1;++i)o*=n[i];var a=t.shape,s=n.slice();s.pop();var u=1;for(i=r;i<t.rank;++i)u*=a[i],s.push(a[i]);var c=Q(t.shape).map((function(t){return t/u})).concat([1]).slice(0,r);return[s,o,u,c]}Object.freeze({prepareAndValidate:gr});function yr(t){return t<=30?t:J(t,Math.floor(Math.sqrt(t)))}function br(t,e,n){var r=e.rank>1?e.shape[e.rank-1]:1,o=e.rank>1?e.rank-1:1,i="Must have updates.shape = indices.shape[:batchDim] + shape[sliceDim:], got updates.shape: "+n.shape+", indices.shape: "+e.shape+", shape: "+t+", sliceDim: "+r+", and batchDim: "+o+".";if(n.rank<o)throw new Error(i+" update.rank < "+o+". ");if(t.length<r+(n.rank-o))throw new Error(i+" Output shape length < "+(r+(n.rank-o)));if(n.rank!==o+t.length-r)throw new Error(i+" update.rank != "+(o+t.length-r));for(var a=0;a<o;++a)if(n.shape[a]!==e.shape[a])throw new Error(i+" updates.shape["+a+"] ("+n.shape[a]+") != indices.shape["+a+"] ("+e.shape[a]+").");for(a=0;a<n.rank-o;++a)if(n.shape[a+o]!==t[a+r])throw new Error(i+" updates.shape["+(a+o)+"] ("+n.shape[a+o]+") != shape["+(a+o)+"] ("+t[a+o]+")")}function wr(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)}br(n,e,t)}function xr(t,e,n){for(var r=e.shape.length,o=r>1?e.shape[r-1]:1,i=n.length,a=1,s=o;s<i;++s)a*=n[s];var u=o<1?1:o;return{sliceRank:o,numUpdates:I(e.shape)/u,sliceSize:a,strides:Q(n.slice(0,o)).concat([1]),outputSize:I(n)}}Object.freeze({validateUpdateShape:br,validateInput:wr,calculateShapes:xr});function _r(t,e,n){C(t.rank===e.length,(function(){return"Error in slice"+t.rank+"D: Length of begin "+e+" must match the rank of the array ("+t.rank+")."})),C(t.rank===n.length,(function(){return"Error in slice"+t.rank+"D: Length of size "+n+" must match the rank of the array ("+t.rank+")."}));for(var r=function(r){C(e[r]+n[r]<=t.shape[r],(function(){return"Error in slice"+t.rank+"D: begin["+r+"] + size["+r+"] ("+(e[r]+n[r])+") would overflow input.shape["+r+"] ("+t.shape[r]+")"}))},o=0;o<t.rank;++o)r(o)}function Er(t){for(var e=[],n=0;t>0;)1&t&&e.push(n),t/=2,n++;return e}function Cr(t,e,n){for(var r=[],o=0;o<t.length;o++)r[o]=Math.ceil((e[o]-t[o])/n[o]);return r}function Sr(t,e,n,r,o){var i=e[o],a=n[o]||1;(t&1<<o||null==i)&&(i=a>0?Number.MIN_SAFE_INTEGER:Number.MAX_SAFE_INTEGER);var s=r[o];return i<0&&(i+=s),x(0,i,s-1)}function kr(t,e,n,r,o){var i=e[o],a=n[o]||1;(t&1<<o||null==i)&&(i=a>0?Number.MAX_SAFE_INTEGER:Number.MIN_SAFE_INTEGER);var s=r[o];return i<0&&(i+=s),a>0?x(0,i,s):x(-1,i,s-1)}function Tr(t,e,n){for(var r=n.length,o=0;o<n.length;o++)if(n[o]>1){r=o;break}for(o=r+1;o<n.length;o++)if(e[o]>0||n[o]!==t[o])return!1;return!0}function Ir(t,e){for(var n=t.length>0?t[t.length-1]:1,r=0;r<t.length-1;r++)n+=t[r]*e[r];return n}Object.freeze({assertParamsValid:_r,maskToAxes:Er,computeOutShape:Cr,startForAxis:Sr,stopForAxis:kr,isSliceContinous:Tr,computeFlatOffset:Ir});function Or(t){return Pt.customGrad(t)}var Rr=rn({softmax_:function(t,e){void 0===e&&(e=-1);var n=Ge(t,"logits","softmax","float32");if(-1===e&&(e=n.rank-1),e!==n.rank-1)throw Error("Softmax along a non-last dimension is not yet supported. Logits was rank "+n.rank+" and dim was "+e);return Pt.runKernelFunc((function(t,r){var o=t.softmax(n,e);return r([o]),o}),{logits:n},(function(t,n){var r=n[0],o=t.mul(r);return{logits:function(){return o.sub(o.sum([e],!0).mul(r))}}}),"Softmax",{dim:e},[],[!0])}}),Ar=rn({logSoftmax_:function(t,e){void 0===e&&(e=-1);var n=Ge(t,"logits","logSoftmax");if(-1===e&&(e=n.rank-1),e!==n.rank-1)throw Error("Log Softmax along a non-last dimension is not yet supported. Logits was rank "+n.rank+" and axis was "+e);return Or((function(t,n){var r=t.max(e,!0),o=t.sub(r),i=o.toFloat().sub(o.exp().sum(e,!0).log());return n([i]),{value:i,gradFunc:function(t,n){var r=n[0].exp();return t.sub(t.sum(e,!0).mul(r))}}}))(n)}}),Dr=function(){function t(t,e){this.backend=t,this.dataMover=e,this.data=new WeakMap,this.dataIdsCount=0}return t.prototype.get=function(t){return this.data.has(t)||this.dataMover.moveData(this.backend,t),this.data.get(t)},t.prototype.set=function(t,e){this.dataIdsCount++,this.data.set(t,e)},t.prototype.has=function(t){return this.data.has(t)},t.prototype.delete=function(t){return this.dataIdsCount--,this.data.delete(t)},t.prototype.numDataIds=function(){return this.dataIdsCount},t}(),Nr=function(){function t(){}return t.prototype.time=function(t){return Pr("time")},t.prototype.read=function(t){return Pr("read")},t.prototype.readSync=function(t){return Pr("readSync")},t.prototype.numDataIds=function(){return Pr("numDataIds")},t.prototype.disposeData=function(t){return Pr("disposeData")},t.prototype.write=function(t,e,n){return Pr("write")},t.prototype.move=function(t,e,n,r){return Pr("move")},t.prototype.memory=function(){return Pr("memory")},t.prototype.floatPrecision=function(){return Pr("floatPrecision")},t.prototype.epsilon=function(){return 32===this.floatPrecision()?1e-7:1e-4},t.prototype.batchMatMul=function(t,e,n,r){return Pr("batchMatMul")},t.prototype.fusedBatchMatMul=function(t){return t.a,t.b,t.transposeA,t.transposeB,t.bias,t.activation,t.preluActivationWeights,Pr("fusedBatchMatMul")},t.prototype.slice=function(t,e,n){return Pr("slice")},t.prototype.stridedSlice=function(t,e,n,r){return Pr("stridedSlice")},t.prototype.unstack=function(t,e){return Pr("unstack")},t.prototype.reverse=function(t,e){return Pr("reverse")},t.prototype.concat=function(t,e){return Pr("concat")},t.prototype.neg=function(t){return Pr("neg")},t.prototype.add=function(t,e){return Pr("add")},t.prototype.addN=function(t){return Pr("addN")},t.prototype.subtract=function(t,e){return Pr("subtract")},t.prototype.multiply=function(t,e){return Pr("multiply")},t.prototype.realDivide=function(t,e){return Pr("realDivide")},t.prototype.floorDiv=function(t,e){return Pr("floorDiv")},t.prototype.sum=function(t,e){return Pr("sum")},t.prototype.prod=function(t,e){return Pr("prod")},t.prototype.unsortedSegmentSum=function(t,e,n){return Pr("unsortedSegmentSum")},t.prototype.argMin=function(t,e){return Pr("argMin")},t.prototype.argMax=function(t,e){return Pr("argMax")},t.prototype.equal=function(t,e){return Pr("equal")},t.prototype.notEqual=function(t,e){return Pr("notEqual")},t.prototype.less=function(t,e){return Pr("less")},t.prototype.lessEqual=function(t,e){return Pr("lessEqual")},t.prototype.greater=function(t,e){return Pr("greater")},t.prototype.greaterEqual=function(t,e){return Pr("greaterEqual")},t.prototype.logicalNot=function(t){return Pr("logicalNot")},t.prototype.logicalAnd=function(t,e){return Pr("logicalAnd")},t.prototype.logicalOr=function(t,e){return Pr("logicalOr")},t.prototype.where=function(t){return Pr("where")},t.prototype.select=function(t,e,n){return Pr("select")},t.prototype.topk=function(t,e,n){return Pr("topk")},t.prototype.min=function(t,e){return Pr("min")},t.prototype.minimum=function(t,e){return Pr("minimum")},t.prototype.mod=function(t,e){return Pr("mod")},t.prototype.max=function(t,e){return Pr("max")},t.prototype.maximum=function(t,e){return Pr("maximum")},t.prototype.all=function(t,e){return Pr("all")},t.prototype.any=function(t,e){return Pr("any")},t.prototype.squaredDifference=function(t,e){return Pr("squaredDifference")},t.prototype.ceil=function(t){return Pr("ceil")},t.prototype.floor=function(t){return Pr("floor")},t.prototype.round=function(t){return Pr("round")},t.prototype.sign=function(t){return Pr("sign")},t.prototype.isNaN=function(t){return Pr("isNaN")},t.prototype.isInf=function(t){return Pr("isInf")},t.prototype.isFinite=function(t){return Pr("isFinite")},t.prototype.pow=function(t,e){return Pr("pow")},t.prototype.exp=function(t){return Pr("exp")},t.prototype.expm1=function(t){return Pr("expm1")},t.prototype.softmax=function(t,e){return Pr("softmax")},t.prototype.log=function(t){return Pr("log")},t.prototype.log1p=function(t){return Pr("log1p")},t.prototype.sqrt=function(t){return Pr("sqrt")},t.prototype.rsqrt=function(t){return Pr("rsqrt")},t.prototype.square=function(t){return Pr("square")},t.prototype.reciprocal=function(t){return Pr("reciprocal")},t.prototype.relu=function(t){return Pr("relu")},t.prototype.relu6=function(t){return Pr("relu6")},t.prototype.prelu=function(t,e){return Pr("prelu")},t.prototype.elu=function(t){return Pr("elu")},t.prototype.eluDer=function(t,e){return Pr("eluDer")},t.prototype.selu=function(t){return Pr("selu")},t.prototype.int=function(t){return Pr("int")},t.prototype.clip=function(t,e,n){return Pr("clip")},t.prototype.abs=function(t){return Pr("abs")},t.prototype.complexAbs=function(t){return Pr("complexAbs")},t.prototype.sigmoid=function(t){return Pr("sigmoid")},t.prototype.softplus=function(t){return Pr("softplus")},t.prototype.sin=function(t){return Pr("sin")},t.prototype.cos=function(t){return Pr("cos")},t.prototype.tan=function(t){return Pr("tan")},t.prototype.asin=function(t){return Pr("asin")},t.prototype.acos=function(t){return Pr("acos")},t.prototype.atan=function(t){return Pr("atan")},t.prototype.atan2=function(t,e){return Pr("atan2")},t.prototype.sinh=function(t){return Pr("sinh")},t.prototype.cosh=function(t){return Pr("cosh")},t.prototype.tanh=function(t){return Pr("tanh")},t.prototype.asinh=function(t){return Pr("asinh")},t.prototype.acosh=function(t){return Pr("acosh")},t.prototype.atanh=function(t){return Pr("atanh")},t.prototype.erf=function(t){return Pr("erf")},t.prototype.step=function(t,e){return Pr("step")},t.prototype.fusedConv2d=function(t){return t.input,t.filter,t.convInfo,t.bias,t.activation,t.preluActivationWeights,Pr("fusedConv2d")},t.prototype.conv2d=function(t,e,n){return Pr("conv2d")},t.prototype.conv2dDerInput=function(t,e,n){return Pr("conv2dDerInput")},t.prototype.conv2dDerFilter=function(t,e,n){return Pr("conv2dDerFilter")},t.prototype.fusedDepthwiseConv2D=function(t){return t.input,t.filter,t.convInfo,t.bias,t.activation,t.preluActivationWeights,Pr("fusedDepthwiseConv2D")},t.prototype.depthwiseConv2D=function(t,e,n){return Pr("depthwiseConv2D")},t.prototype.depthwiseConv2DDerInput=function(t,e,n){return Pr("depthwiseConv2DDerInput")},t.prototype.depthwiseConv2DDerFilter=function(t,e,n){return Pr("depthwiseConv2DDerFilter")},t.prototype.conv3d=function(t,e,n){return Pr("conv3d")},t.prototype.conv3dDerInput=function(t,e,n){return Pr("conv3dDerInput")},t.prototype.conv3dDerFilter=function(t,e,n){return Pr("conv3dDerFilter")},t.prototype.maxPool=function(t,e){return Pr("maxPool")},t.prototype.maxPoolBackprop=function(t,e,n,r){return Pr("maxPoolBackprop")},t.prototype.avgPool=function(t,e){return Pr("avgPool")},t.prototype.avgPoolBackprop=function(t,e,n){return Pr("avgPoolBackprop")},t.prototype.avgPool3d=function(t,e){return Pr("avgPool3d")},t.prototype.avgPool3dBackprop=function(t,e,n){return Pr("avgPool3dBackprop")},t.prototype.maxPool3d=function(t,e){return Pr("maxPool3d")},t.prototype.maxPool3dBackprop=function(t,e,n,r){return Pr("maxPool3dBackprop")},t.prototype.reshape=function(t,e){return Pr("reshape")},t.prototype.cast=function(t,e){return Pr("cast")},t.prototype.tile=function(t,e){return Pr("tile")},t.prototype.pad=function(t,e,n){return Pr("pad")},t.prototype.transpose=function(t,e){return Pr("transpose")},t.prototype.gather=function(t,e,n){return Pr("gather")},t.prototype.gatherND=function(t,e){return Pr("gatherND")},t.prototype.scatterND=function(t,e,n){return Pr("scatterND")},t.prototype.batchToSpaceND=function(t,e,n){return Pr("batchToSpaceND")},t.prototype.spaceToBatchND=function(t,e,n){return Pr("spaceToBatchND")},t.prototype.resizeBilinear=function(t,e,n,r){return Pr("resizeBilinear")},t.prototype.resizeBilinearBackprop=function(t,e,n){return Pr("resizeBilinearBackprop")},t.prototype.resizeNearestNeighbor=function(t,e,n,r){return Pr("resizeNearestNeighbor")},t.prototype.resizeNearestNeighborBackprop=function(t,e,n){return Pr("resizeNearestNeighborBackprop")},t.prototype.batchNormalization=function(t,e,n,r,o,i){return Pr("batchNormalization")},t.prototype.localResponseNormalization4D=function(t,e,n,r,o){return Pr("localResponseNormalization4D")},t.prototype.LRNGrad=function(t,e,n,r,o,i,a){return Pr("LRNGrad")},t.prototype.multinomial=function(t,e,n,r){return Pr("multinomial")},t.prototype.oneHot=function(t,e,n,r){return Pr("oneHot")},t.prototype.cumsum=function(t,e,n,r){return Pr("cumsum")},t.prototype.nonMaxSuppression=function(t,e,n,r,o){return Pr("nonMaxSuppression")},t.prototype.fft=function(t){return Pr("fft")},t.prototype.ifft=function(t){return Pr("ifft")},t.prototype.complex=function(t,e){return Pr("complex")},t.prototype.real=function(t){return Pr("real")},t.prototype.imag=function(t){return Pr("imag")},t.prototype.cropAndResize=function(t,e,n,r,o,i){return Pr("cropAndResize")},t.prototype.depthToSpace=function(t,e,n){return Pr("depthToSpace")},t.prototype.split=function(t,e,n){return Pr("split")},t.prototype.sparseToDense=function(t,e,n,r){return Pr("sparseToDense")},t.prototype.diag=function(t){return Pr("diag")},t.prototype.fill=function(t,e,n){return Pr("fill")},t.prototype.onesLike=function(t){return Pr("onesLike")},t.prototype.zerosLike=function(t){return Pr("zerosLike")},t.prototype.linspace=function(t,e,n){return Pr("linspace")},t.prototype.dispose=function(){return Pr("dispose")},t}();function Pr(t){throw new Error("'"+t+"' not yet implemented or not found in the registry. Did you forget to import the kernel?")}function Mr(t,e){for(var n=t.length,r=[],o=0;o<n;o++){var i=n-1-o,a=t[i]||1;(e[e.length-1-o]||1)>1&&1===a&&r.unshift(i)}return r}function jr(t,e){for(var n=[],r=0;r<e.length;r++){var o=t[t.length-r-1],i=e.length-r-1,a=e[i];(null==o||1===o&&a>1)&&n.unshift(i)}return n}function Fr(t,e){for(var n=[],r=Math.max(t.length,e.length),o=0;o<r;o++){var i=t[t.length-o-1];null==i&&(i=1);var a=e[e.length-o-1];if(null==a&&(a=1),1===i)n.unshift(a);else if(1===a)n.unshift(i);else{if(i!==a)throw Error("Operands could not be broadcast together with shapes "+t+" and "+e+".");n.unshift(i)}}return n}function Br(t,e,n,r,o,i,a){void 0===a&&(a="channelsLast");var s,u=Vr(e),c=u[0],l=u[1];if("channelsLast"===a)s=[c,l,t[3],t[3]];else{if("channelsFirst"!==a)throw new Error("Unknown dataFormat "+a);s=[c,l,t[1],t[1]]}return Ur(t,s,n,r,o,i,!1,a)}function Lr(t,e,n,r,o,i,a){void 0===a&&(a="NDHWC");var s,u,c=qr(e),l=c[0],f=c[1],h=c[2];if("NDHWC"===a)u="channelsLast",s=[l,f,h,t[4],t[4]];else{if("NCDHW"!==a)throw new Error("Unknown dataFormat "+a);u="channelsFirst",s=[l,f,h,t[1],t[1]]}return Wr(t,s,n,r,o,!1,u,i)}function Ur(t,e,n,r,o,i,a,s){void 0===a&&(a=!1),void 0===s&&(s="channelsLast");var u=[-1,-1,-1,-1],c=u[0],l=u[1],f=u[2],h=u[3];if("channelsLast"===s)c=t[0],l=t[1],f=t[2],h=t[3];else{if("channelsFirst"!==s)throw new Error("Unknown dataFormat "+s);c=t[0],h=t[1],l=t[2],f=t[3]}var p,d=e[0],m=e[1],v=e[3],g=Vr(n),y=g[0],b=g[1],w=Vr(r),x=w[0],_=w[1],E=Gr(d,x),S=Gr(m,_),k=function(t,e,n,r,o,i,a,s){var u,c,l;if("number"==typeof t){u={top:t,bottom:t,left:t,right:t,type:0===t?"VALID":"NUMBER"};var f=function(t,e,n,r,o){null==r&&(r=zr(t,e,n));var i=t[1],a=Hr((t[0]-e+2*r)/n+1,o);C(R(a),(function(){return"The output # of rows ("+a+") must be an integer. Change the stride and/or zero pad parameters"}));var s=Hr((i-e+2*r)/n+1,o);return C(R(s),(function(){return"The output # of columns ("+s+") must be an integer. Change the stride and/or zero pad parameters"})),[a,s]}([e,n],i,r,t,s);c=f[0],l=f[1]}else if("same"===t){c=Math.ceil(e/r),l=Math.ceil(n/o);var h=Math.max(0,(c-1)*r+i-e),p=Math.max(0,(l-1)*o+a-n),d=Math.floor(h/2),m=h-d,v=Math.floor(p/2);u={top:d,bottom:m,left:v,right:p-v,type:"SAME"}}else{if("valid"!==t)throw Error("Unknown padding parameter: "+t);u={top:0,bottom:0,left:0,right:0,type:"VALID"},c=Math.ceil((e-i+1)/r),l=Math.ceil((n-a+1)/o)}return{padInfo:u,outHeight:c,outWidth:l}}(o,l,f,y,b,E,S,i),T=k.padInfo,I=k.outHeight,O=k.outWidth,A=a?v*h:v;return"channelsFirst"===s?p=[c,A,I,O]:"channelsLast"===s&&(p=[c,I,O,A]),{batchSize:c,dataFormat:s,inHeight:l,inWidth:f,inChannels:h,outHeight:I,outWidth:O,outChannels:A,padInfo:T,strideHeight:y,strideWidth:b,filterHeight:d,filterWidth:m,effectiveFilterHeight:E,effectiveFilterWidth:S,dilationHeight:x,dilationWidth:_,inShape:t,outShape:p,filterShape:e}}function Wr(t,e,n,r,o,i,a,s){void 0===i&&(i=!1),void 0===a&&(a="channelsLast");var u=[-1,-1,-1,-1,-1],c=u[0],l=u[1],f=u[2],h=u[3],p=u[4];if("channelsLast"===a)c=t[0],l=t[1],f=t[2],h=t[3],p=t[4];else{if("channelsFirst"!==a)throw new Error("Unknown dataFormat "+a);c=t[0],p=t[1],l=t[2],f=t[3],h=t[4]}var d,m=e[0],v=e[1],g=e[2],y=e[4],b=qr(n),w=b[0],x=b[1],_=b[2],E=qr(r),S=E[0],k=E[1],T=E[2],I=Gr(m,S),O=Gr(v,k),A=Gr(g,T),D=function(t,e,n,r,o,i,a,s,u,c,l){var f,h,p,d;if("number"==typeof t){f={top:t,bottom:t,left:t,right:t,front:t,back:t,type:0===t?"VALID":"NUMBER"};var m=function(t,e,n,r,o,i){null==o&&(o=zr(t,e,r));var a=t[1],s=t[2],u=Hr((t[0]-e+2*o)/r+1,i);C(R(u),(function(){return"The output # of depths ("+u+") must be an integer. Change the stride and/or zero pad parameters"}));var c=Hr((a-e+2*o)/r+1,i);C(R(c),(function(){return"The output # of rows ("+c+") must be an integer. Change the stride and/or zero pad parameters"}));var l=Hr((s-e+2*o)/r+1,i);return C(R(l),(function(){return"The output # of columns ("+l+") must be an integer. Change the stride and/or zero pad parameters"})),[u,c,l,1]}([e,n,r,1],s,0,o,t,l);h=m[0],p=m[1],d=m[2]}else if("same"===t){var v=((h=Math.ceil(e/o))-1)*o+s-e,g=((p=Math.ceil(n/i))-1)*i+u-n,y=((d=Math.ceil(r/a))-1)*a+c-r,b=Math.floor(v/2),w=v-b,x=Math.floor(g/2),_=g-x,E=Math.floor(y/2);f={top:x,bottom:_,left:E,right:y-E,front:b,back:w,type:"SAME"}}else{if("valid"!==t)throw Error("Unknown padding parameter: "+t);f={top:0,bottom:0,left:0,right:0,front:0,back:0,type:"VALID"},h=Math.ceil((e-s+1)/o),p=Math.ceil((n-u+1)/i),d=Math.ceil((r-c+1)/a)}return{padInfo:f,outDepth:h,outHeight:p,outWidth:d}}(o,l,f,h,w,x,_,I,O,A,s),N=D.padInfo,P=D.outDepth,M=D.outHeight,j=D.outWidth,F=i?y*p:y;return"channelsFirst"===a?d=[c,F,P,M,j]:"channelsLast"===a&&(d=[c,P,M,j,F]),{batchSize:c,dataFormat:a,inDepth:l,inHeight:f,inWidth:h,inChannels:p,outDepth:P,outHeight:M,outWidth:j,outChannels:F,padInfo:N,strideDepth:w,strideHeight:x,strideWidth:_,filterDepth:m,filterHeight:v,filterWidth:g,effectiveFilterDepth:I,effectiveFilterHeight:O,effectiveFilterWidth:A,dilationDepth:S,dilationHeight:k,dilationWidth:T,inShape:t,outShape:d,filterShape:e}}function zr(t,e,n,r){void 0===r&&(r=1);var o=Gr(e,r);return Math.floor((t[0]*(n-1)-n+o)/2)}function Vr(t){return"number"==typeof t?[t,t,t]:2===t.length?[t[0],t[1],1]:t}function qr(t){return"number"==typeof t?[t,t,t]:t}function Gr(t,e){return e<=1?t:t+(t-1)*(e-1)}function Hr(t,e){if(!e)return 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 Xr(t){var e=Vr(t),n=e[0],r=e[1],o=e[2];return 1===n&&1===r&&1===o}function Kr(t,e){return Xr(t)||Xr(e)}function Yr(t){if("NHWC"===t)return"channelsLast";if("NCHW"===t)return"channelsFirst";throw new Error("Unknown dataFormat "+t)}function $r(t,e,n){if("complex64"===e){if("complex64"===t.dtype)return t.clone();var r=vn(t.shape),o=t.toFloat(),i=n.complex(o,r);return r.dispose(),o.dispose(),i}if(!z(t.dtype,e))return Pt.makeTensorFromDataId(t.dataId,t.shape,e);if("complex64"===t.dtype){var a=n.real(t);return i=a.cast(e),a.dispose(),i}if("int32"===e)return n.int(t);if("bool"===e){var s=ln(0,t.dtype);return i=n.notEqual(t,s),s.dispose(),i}throw new Error("Error in Cast: failed to cast "+t.dtype+" to "+e)}function Jr(t,e){return Pt.makeTensorFromDataId(t.dataId,e,t.dtype)}function Qr(t,e,n){var r=(e-t)/(n-1),o=nt(n,"float32");o[0]=t;for(var i=1;i<o.length;i++)o[i]=o[i-1]+r;return fn(o,"float32")}Object.freeze({castTensor:$r,reshapeTensor:Jr,linspaceImpl:Qr,upcastType:kt,axesAreInnerMostDims:Xe,combineLocations:Ke,computeOutAndReduceShapes:Ye,expandShapeToKeepDim:$e,assertAxesAreInnerMostDims:Je,getAxesPermutation:Qe,getUndoAxesPermutation:Ze,getInnerMostAxes:tn,getBroadcastDims:Mr,getReductionAxes:jr,assertAndGetBroadcastShape:Fr,assertParamsConsistent:en,computeOutShape:nn,computePool2DInfo:Br,computePool3DInfo:Lr,computeConv2DInfo:Ur,computeConv3DInfo:Wr,computeDefaultPad:zr,tupleValuesAreOne:Xr,eitherStridesOrDilationsAreOne:Kr,convertConv2DDataFormat:Yr,PARALLELIZE_THRESHOLD:30,computeOptimalWindowSize:yr});function Zr(t,e){if(t.length!==e.length)throw new Error("Cannot merge real and imag arrays of different lengths. real:"+t.length+", imag: "+e.length+".");for(var n=new Float32Array(2*t.length),r=0;r<n.length;r+=2)n[r]=t[r/2],n[r+1]=e[r/2];return n}function to(t,e){return{real:t[2*e],imag:t[2*e+1]}}function eo(t,e,n,r){t[2*r]=e,t[2*r+1]=n}function no(t,e,n){var r=(n?2:-2)*Math.PI*(t/e);return{real:Math.cos(r),imag:Math.sin(r)}}function ro(t,e,n){var r=function(t,e,n){return function(t,e,n){for(var r=0,o=t.length,i=0,a=!1;r<o;){var s=n(e,t[i=r+(o-r>>>1)]);s>0?r=i+1:(o=i,a=!s)}return a?r:-r-1}(t,e,n||oo)}(t,e,n),o=r<0?-(r+1):r;t.splice(o,0,e)}function oo(t,e){return t>e?1:t<e?-1:0}function io(t,e,n,r,o){return so(t,e,n,r,o,0).selectedIndices}function ao(t,e,n,r,o,i){var a=so(t,e,n,r,o,i,!0);return a.numValidOutputs.dispose(),{selectedIndices:a.selectedIndices,selectedScores:a.selectedScores}}function so(t,e,n,r,o,i,a,s){void 0===a&&(a=!1),void 0===s&&(s=!1);for(var u=Array.from(e).map((function(t,e){return{score:t,boxIndex:e,suppressBeginIndex:0}})).filter((function(t){return t.score>o})).sort(lo),c=i>0?-.5/i:0,l=[],f=[];l.length<n&&u.length>0;){var h=u.pop(),p=h.score,d=h.boxIndex,m=h.suppressBeginIndex;if(p<o)break;for(var v=!1,g=l.length-1;g>=m;--g){var y=uo(t,d,l[g]);if(y>=r){v=!0;break}if(h.score=h.score*co(r,c,y),h.score<=o)break}h.suppressBeginIndex=l.length,v||(h.score===p?(l.push(d),f.push(h.score)):h.score>o&&ro(u,h,lo))}var b=l.length;return s&&(l.fill(0,b),f.fill(0,b)),{selectedIndices:fn(l,"int32"),selectedScores:fn(f,"float32"),numValidOutputs:ln(b,"int32")}}function uo(t,e,n){var r=t.subarray(4*e,4*e+4),o=t.subarray(4*n,4*n+4),i=Math.min(r[0],r[2]),a=Math.min(r[1],r[3]),s=Math.max(r[0],r[2]),u=Math.max(r[1],r[3]),c=Math.min(o[0],o[2]),l=Math.min(o[1],o[3]),f=Math.max(o[0],o[2]),h=Math.max(o[1],o[3]),p=(s-i)*(u-a),d=(f-c)*(h-l);if(p<=0||d<=0)return 0;var m=Math.max(i,c),v=Math.max(a,l),g=Math.min(s,f),y=Math.min(u,h),b=Math.max(g-m,0)*Math.max(y-v,0);return b/(p+d-b)}function co(t,e,n){var r=Math.exp(e*n*n);return n<=t?r:0}function lo(t,e){return t.score-e.score||t.score===e.score&&e.boxIndex-t.boxIndex}function fo(t,e,n){var r=new Array(t.rank).fill(0),o=t.shape.slice();return e.map((function(e){o[n]=e;var i=t.slice(r,o);return r[n]+=e,i}))}function ho(t,e){for(var n=new Array(t.rank),r=0;r<n.length;r++)n[r]=t.shape[r]*e[r];var o=Ln(n,t.dtype);for(r=0;r<o.values.length;++r){for(var i=o.indexToLoc(r),a=new Array(t.rank),s=0;s<a.length;s++)a[s]=i[s]%t.shape[s];var u=t.locToIndex(a);o.values[r]=t.values[u]}return o.toTensor()}function po(t,e,n,r,o){for(var i=e[e.length-1],a=[t.length/i,i],s=a[0],u=a[1],c=B(n,s*r),l=B("int32",s*r),f=0;f<s;f++){for(var h=f*u,p=t.subarray(h,h+u),d=[],m=0;m<p.length;m++)d.push({value:p[m],index:m});d.sort((function(t,e){return e.value-t.value}));var v=f*r,g=c.subarray(v,v+r),y=l.subarray(v,v+r);for(m=0;m<r;m++)g[m]=d[m].value,y[m]=d[m].index}var b=e.slice();return b[b.length-1]=r,[un(c,b,n),un(l,b,"int32")]}function mo(t,e){for(var n=[],r=0;r<e.length;r++)e[r]&&n.push(r);var o=Ln(t,"int32"),i=Ln([n.length,t.length],"int32");for(r=0;r<n.length;r++){var a=o.indexToLoc(n[r]),s=r*t.length;i.values.set(a,s)}return i.toTensor()}var vo=function(t,e){this.outputShape=[],this.outputShape=t,this.variableNames=e.map((function(t,e){return"T"+e}));var n=[];this.variableNames.forEach((function(t){n.push("float v"+t+" = get"+t+"AtOutCoords();")}));var r=this.variableNames.map((function(t){return"v"+t})).join(" + ");this.userCode="\n void main() {\n "+n.join("\n ")+"\n\n float result = "+r+";\n setOutput(result);\n }\n "},go=function(t,e){this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.variableNames=e.map((function(t,e){return"T"+e}));var n=[];this.variableNames.forEach((function(t){n.push("vec4 v"+t+" = get"+t+"AtOutCoords();")}));var r=this.variableNames.map((function(t){return"v"+t})).join(" + ");this.userCode="\n void main() {\n "+n.join("\n ")+"\n\n vec4 result = "+r+";\n setOutput(result);\n }\n "},yo=function(t,e,n){this.variableNames=["A"];var r=t.windowSize,o=t.batchSize,i=t.inSize,a=Math.ceil(i/r);n||this.variableNames.push("bestIndicesA"),this.outputShape=[o,a];var s="max"===e?">":"<",u=n?"inOffset + i;":"round(getBestIndicesA(batch, inOffset + i));";this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+r+";\n\n int bestIndex = inOffset;\n float bestValue = getA(batch, bestIndex);\n\n for (int i = 0; i < "+r+"; i++) {\n int inIdx = "+u+";\n float candidate = getA(batch, inIdx);\n if (candidate "+s+" bestValue) {\n bestValue = candidate;\n bestIndex = inIdx;\n }\n }\n setOutput(float(bestIndex));\n }\n "};function bo(t,e){return["x","y","z","w","u","v"].slice(0,e).map((function(e){return t+"."+e}))}function wo(t,e){return 1===e?[t]:bo(t,e)}function xo(){var t,e,n,r,o,i,a,s,u,c;return 2===f().getNumber("WEBGL_VERSION")?(t="#version 300 es",e="in",n="out",r="in",o="texture",i="outputColor",a="out vec4 outputColor;",s="\n bool isnan_custom(float val) {\n return (val > 0.0 || val < 0.0) ? false : val != 0.0;\n }\n\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan_custom(val.x),\n isnan_custom(val.y), isnan_custom(val.z), isnan_custom(val.w));\n }\n\n #define isnan(value) isnan_custom(value)\n ",u="",c="\n #define round(value) newRound(value)\n int newRound(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 newRound(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "):(t="",e="attribute",n="varying",r="varying",o="texture2D",i="gl_FragColor",a="",s="\n #define isnan(value) isnan_custom(value)\n bool isnan_custom(float val) {\n return (val > 0. || val < 1. || val == 0.) ? false : true;\n }\n bvec4 isnan_custom(vec4 val) {\n return bvec4(isnan(val.x), isnan(val.y), isnan(val.z), isnan(val.w));\n }\n ",u="\n uniform float INFINITY;\n\n bool isinf(float val) {\n return abs(val) == INFINITY;\n }\n bvec4 isinf(vec4 val) {\n return equal(abs(val), vec4(INFINITY));\n }\n ",c="\n int round(float value) {\n return int(floor(value + 0.5));\n }\n\n ivec4 round(vec4 value) {\n return ivec4(floor(value + vec4(0.5)));\n }\n "),{version:t,attribute:e,varyingVs:n,varyingFs:r,texture2D:o,output:i,defineOutput:a,defineSpecialNaN:s,defineSpecialInf:u,defineRound:c}}function _o(t,e,n){void 0===n&&(n="index");var r=Q(e);return r.map((function(e,o){return"int "+t[o]+" = "+n+" / "+e+"; "+(o===r.length-1?"int "+t[o+1]+" = "+n+" - "+t[o]+" * "+e:"index -= "+t[o]+" * "+e)+";"})).join("")}function Eo(t){var e=Q(t).map((function(t){return t.toString()}));return"\n int getFlatIndex(ivec3 coords) {\n return coords.x * "+e[0]+" + coords.y * "+e[1]+" + coords.z;\n }\n"}var Co="\n const float FLOAT_MAX = 1.70141184e38;\n const float FLOAT_MIN = 1.17549435e-38;\n\n lowp vec4 encode_float(highp float v) {\n if (isnan(v)) {\n return vec4(255, 255, 255, 255);\n }\n\n highp float av = abs(v);\n\n if(av < FLOAT_MIN) {\n return vec4(0.0, 0.0, 0.0, 0.0);\n } else if(v > FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 127.0) / 255.0;\n } else if(v < -FLOAT_MAX) {\n return vec4(0.0, 0.0, 128.0, 255.0) / 255.0;\n }\n\n highp vec4 c = vec4(0,0,0,0);\n\n highp float e = floor(log2(av));\n highp float m = exp2(fract(log2(av))) - 1.0;\n\n c[2] = floor(128.0 * m);\n m -= c[2] / 128.0;\n c[1] = floor(32768.0 * m);\n m -= c[1] / 32768.0;\n c[0] = floor(8388608.0 * m);\n\n highp float ebias = e + 127.0;\n c[3] = floor(ebias / 2.0);\n ebias -= c[3] * 2.0;\n c[2] += floor(ebias) * 128.0;\n\n c[3] += 128.0 * step(0.0, -v);\n\n return c / 255.0;\n }\n";function So(t,e,n,r){var o=[];t.forEach((function(t){var e=I(t.shapeInfo.logicalShape);t.shapeInfo.isUniform?o.push("uniform float "+t.name+(e>1?"["+e+"]":"")+";"):(o.push("uniform sampler2D "+t.name+";"),o.push("uniform int offset"+t.name+";"))}));var i,a,s=o.join("\n"),u=t.map((function(t){return function(t,e,n){void 0===n&&(n=!1);var r="";r+=n?function t(e){var n,r,o;switch(e.shapeInfo.logicalShape.length){case 0:return n=e.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),o=xo(),"\n vec4 "+r+"() {\n return "+o.texture2D+"("+n+", halfCR);\n }\n ";case 1:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1),r=t.shapeInfo.texShape,o=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],i=xo();return"\n vec4 "+n+"(int index) {\n vec2 uv = packedUVfrom1D(\n "+o[0]+", "+o[1]+", index);\n return "+i.texture2D+"("+e+", uv);\n }\n "}(e);case 2:return function(t){var e=t.shapeInfo.logicalShape,n=t.name,r="get"+n.charAt(0).toUpperCase()+n.slice(1),o=t.shapeInfo.texShape,i=o[0],a=o[1],s=xo();if(null!=o&&O(e,o))return"\n vec4 "+r+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+a+".0, "+i+".0);\n\n return "+s.texture2D+"("+n+", uv);\n }\n ";var u=[Math.ceil(o[0]/2),Math.ceil(o[1]/2)];return"\n vec4 "+r+"(int row, int col) {\n vec2 uv = packedUVfrom2D("+Math.ceil(e[1]/2)+", "+u[0]+", "+u[1]+", row, col);\n return "+s.texture2D+"("+n+", uv);\n }\n "}(e);case 3:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,o="get"+r.charAt(0).toUpperCase()+r.slice(1),i=e.shapeInfo.texShape,a=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)];if(1===n[0]){var s=No(e,n.slice(1));return"\n "+t(s)+"\n vec4 "+o+"(int b, int row, int col) {\n return "+o+"("+Po(["b","row","col"],[1,2])+");\n }\n "}var u=a[0],c=a[1],l=Math.ceil(n[2]/2);return"\n vec4 "+o+"(int b, int row, int col) {\n vec2 uv = packedUVfrom3D(\n "+u+", "+c+", "+l*Math.ceil(n[1]/2)+", "+l+", b, row, col);\n return "+xo().texture2D+"("+r+", uv);\n }\n "}(e);default:return function(t){for(var e=t.shapeInfo.logicalShape,n=e.length,r=t.name,o="get"+r.charAt(0).toUpperCase()+r.slice(1),i=t.shapeInfo.texShape,a=[Math.ceil(i[0]/2),Math.ceil(i[1]/2)],s=a[0],u=a[1],c=Math.ceil(e[n-1]/2),l=c*Math.ceil(e[n-2]/2),f="int b, int row, int col",h="b * "+l+" + (row / 2) * "+c+" + (col / 2)",p=2;p<n-1;p++)f="int b"+p+", "+f,h="b"+p+" * "+(l*=e[n-p-1])+" + "+h;return"\n vec4 "+o+"("+f+") {\n int index = "+h+";\n int texR = index / "+u+";\n int texC = index - texR * "+u+";\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+u+", "+s+");\n return "+xo().texture2D+"("+r+", uv);\n }\n "}(e)}}(t):function t(e){var n=e.shapeInfo.logicalShape;switch(n.length){case 0:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return"float "+n+"() {return "+e+";}";var r=t.shapeInfo.texShape,o=r[0],i=r[1];if(1===o&&1===i)return"\n float "+n+"() {\n return sampleTexture("+e+", halfCR);\n }\n ";var a=t.shapeInfo.texShape;return"\n float "+n+"() {\n vec2 uv = uvFromFlat("+a[0]+", "+a[1]+", "+Ro(e)+");\n return sampleTexture("+e+", uv);\n }\n "}(e);case 1:return function(t){var e=t.name,n="get"+e.charAt(0).toUpperCase()+e.slice(1);if(t.shapeInfo.isUniform)return"\n float "+n+"(int index) {\n "+Ao(t)+"\n }\n ";var r=t.shapeInfo.texShape,o=r[0],i=r[1];if(1===i&&1===o)return"\n float "+n+"(int index) {\n return sampleTexture("+e+", halfCR);\n }\n ";var a=Ro(e);return 1===i?"\n float "+n+"(int index) {\n vec2 uv = vec2(0.5, (float(index + "+a+") + 0.5) / "+o+".0);\n return sampleTexture("+e+", uv);\n }\n ":1===o?"\n float "+n+"(int index) {\n vec2 uv = vec2((float(index + "+a+") + 0.5) / "+i+".0, 0.5);\n return sampleTexture("+e+", uv);\n }\n ":"\n float "+n+"(int index) {\n vec2 uv = uvFromFlat("+o+", "+i+", index + "+a+");\n return sampleTexture("+e+", uv);\n }\n "}(e);case 2:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,o="get"+r.charAt(0).toUpperCase()+r.slice(1),i=e.shapeInfo.texShape;if(null!=i&&O(n,i)){var a=i[0];return"\n float "+o+"(int row, int col) {\n vec2 uv = (vec2(col, row) + halfCR) / vec2("+i[1]+".0, "+a+".0);\n return sampleTexture("+r+", uv);\n }\n "}var s=F(n),u=s.newShape,c=s.keptDims,l=u;if(l.length<n.length){var f=No(e,l);return"\n "+t(f)+"\n float "+o+"(int row, int col) {\n return "+o+"("+Po(["row","col"],c)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+o+"(int row, int col) {\n int index = round(dot(vec2(row, col), vec2("+n[1]+", 1)));\n "+Ao(e)+"\n }\n ";var h=i[0],p=i[1],d=Ro(r);return 1===p?"\n float "+o+"(int row, int col) {\n float index = dot(vec3(row, col, "+d+"), vec3("+n[1]+", 1, 1));\n vec2 uv = vec2(0.5, (index + 0.5) / "+h+".0);\n return sampleTexture("+r+", uv);\n }\n ":1===h?"\n float "+o+"(int row, int col) {\n float index = dot(vec3(row, col, "+d+"), vec3("+n[1]+", 1, 1));\n vec2 uv = vec2((index + 0.5) / "+p+".0, 0.5);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+o+"(int row, int col) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+n[1]+" + col + "+d+";\n vec2 uv = uvFromFlat("+h+", "+p+", index);\n return sampleTexture("+r+", uv);\n }\n"}(e);case 3:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,o="get"+r.charAt(0).toUpperCase()+r.slice(1),i=n[1]*n[2],a=n[2],s=F(n),u=s.newShape,c=s.keptDims,l=u;if(l.length<n.length){var f=No(e,l);return"\n "+t(f)+"\n float "+o+"(int row, int col, int depth) {\n return "+o+"("+Po(["row","col","depth"],c)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+o+"(int row, int col, int depth) {\n int index = round(dot(vec3(row, col, depth),\n vec3("+i+", "+a+", 1)));\n "+Ao(e)+"\n }\n ";var h=e.shapeInfo.texShape,p=h[0],d=h[1],m=e.shapeInfo.flatOffset;return d===i&&null==m?"\n float "+o+"(int row, int col, int depth) {\n float texR = float(row);\n float texC = dot(vec2(col, depth), vec2("+a+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+d+".0, "+p+".0);\n return sampleTexture("+r+", uv);\n }\n ":d===a&&null==m?"\n float "+o+"(int row, int col, int depth) {\n float texR = dot(vec2(row, col), vec2("+n[1]+", 1));\n float texC = float(depth);\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+d+".0, "+p+".0);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+o+"(int row, int col, int depth) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+i+" + col * "+a+" + depth + "+Ro(r)+";\n vec2 uv = uvFromFlat("+p+", "+d+", index);\n return sampleTexture("+r+", uv);\n }\n "}(e);case 4:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,o="get"+r.charAt(0).toUpperCase()+r.slice(1),i=n[3],a=n[2]*i,s=n[1]*a,u=F(n),c=u.newShape,l=u.keptDims;if(c.length<n.length){var f=No(e,c);return"\n "+t(f)+"\n float "+o+"(int row, int col, int depth, int depth2) {\n return "+o+"("+Po(["row","col","depth","depth2"],l)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+o+"(int row, int col, int depth, int depth2) {\n int index = round(dot(vec4(row, col, depth, depth2),\n vec4("+s+", "+a+", "+i+", 1)));\n "+Ao(e)+"\n }\n ";var h=e.shapeInfo.flatOffset,p=e.shapeInfo.texShape,d=p[0],m=p[1];return m===s&&null==h?"\n float "+o+"(int row, int col, int depth, int depth2) {\n float texR = float(row);\n float texC =\n dot(vec3(col, depth, depth2),\n vec3("+a+", "+i+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+m+".0, "+d+".0);\n return sampleTexture("+r+", uv);\n }\n ":m===i&&null==h?"\n float "+o+"(int row, int col, int depth, int depth2) {\n float texR = dot(vec3(row, col, depth),\n vec3("+n[1]*n[2]+", "+n[2]+", 1));\n float texC = float(depth2);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+m+".0, "+d+".0);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+o+"(int row, int col, int depth, int depth2) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+s+" + col * "+a+" +\n depth * "+i+" + depth2;\n vec2 uv = uvFromFlat("+d+", "+m+", index + "+Ro(r)+");\n return sampleTexture("+r+", uv);\n }\n "}(e);case 5:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,o="get"+r.charAt(0).toUpperCase()+r.slice(1),i=n[4],a=n[3]*i,s=n[2]*a,u=n[1]*s,c=F(n),l=c.newShape,f=c.keptDims;if(l.length<n.length){var h=No(e,l);return"\n "+t(h)+"\n float "+o+"(int row, int col, int depth, int depth2, int depth3) {\n return "+o+"("+Po(["row","col","depth","depth2","depth3"],f)+");\n }\n "}if(e.shapeInfo.isUniform)return"\n float "+o+"(int row, int col, int depth, int depth2, int depth3) {\n float index = dot(\n vec4(row, col, depth, depth2),\n vec4("+u+", "+s+", "+a+", "+i+")) +\n depth3;\n "+Ao(e)+"\n }\n ";var p=e.shapeInfo.flatOffset,d=e.shapeInfo.texShape,m=d[0],v=d[1];return v===u&&null==p?"\n float "+o+"(int row, int col, int depth, int depth2, int depth3) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4("+s+", "+a+", "+i+", 1));\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+v+".0, "+m+".0);\n return sampleTexture("+r+", uv);\n }\n ":v===i&&null==p?"\n float "+o+"(int row, int col, int depth, int depth2, int depth3) {\n float texR = dot(\n vec4(row, col, depth, depth2),\n vec4("+n[1]*n[2]*n[3]+",\n "+n[2]*n[3]+", "+n[3]+", 1));\n int texC = depth3;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+v+".0, "+m+".0);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+o+"(int row, int col, int depth, int depth2, int depth3) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+u+" + col * "+s+" + depth * "+a+" +\n depth2 * "+i+" + depth3 + "+Ro(r)+";\n vec2 uv = uvFromFlat("+m+", "+v+", index);\n return sampleTexture("+r+", uv);\n }\n "}(e);case 6:return function(e){var n=e.shapeInfo.logicalShape,r=e.name,o="get"+r.charAt(0).toUpperCase()+r.slice(1),i=F(n),a=i.newShape,s=i.keptDims;if(a.length<n.length){var u=No(e,a);return"\n "+t(u)+"\n float "+o+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n return "+o+"("+Po(["row","col","depth","depth2","depth3","depth4"],s)+");\n }\n "}var c=n[5],l=n[4]*c,f=n[3]*l,h=n[2]*f,p=n[1]*h;if(e.shapeInfo.isUniform)return"\n float "+o+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int index = round(dot(\n vec4(row, col, depth, depth2),\n vec4("+p+", "+h+", "+f+", "+l+")) +\n dot(\n vec2(depth3, depth4),\n vec2("+c+", 1)));\n "+Ao(e)+"\n }\n ";var d=e.shapeInfo.flatOffset,m=e.shapeInfo.texShape,v=m[0],g=m[1];return g===p&&null==d?"\n float "+o+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n int texR = row;\n float texC = dot(vec4(col, depth, depth2, depth3),\n vec4("+h+", "+f+", "+l+", "+c+")) +\n float(depth4);\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+g+".0, "+v+".0);\n return sampleTexture("+r+", uv);\n }\n ":g===c&&null==d?"\n float "+o+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n float texR = dot(vec4(row, col, depth, depth2),\n vec4("+n[1]*n[2]*n[3]*n[4]+",\n "+n[2]*n[3]*n[4]+",\n "+n[3]*n[4]+",\n "+n[4]+")) + float(depth3);\n int texC = depth4;\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+g+".0, "+v+".0);\n return sampleTexture("+r+", uv);\n }\n ":"\n float "+o+"(int row, int col, int depth,\n int depth2, int depth3, int depth4) {\n // Explicitly use integer operations as dot() only works on floats.\n int index = row * "+p+" + col * "+h+" + depth * "+f+" +\n depth2 * "+l+" + depth3 * "+c+" + depth4 + "+Ro(r)+";\n vec2 uv = uvFromFlat("+v+", "+g+", index);\n return sampleTexture("+r+", uv);\n }\n "}(e);default:throw new Error(n.length+"-D input sampling is not yet supported")}}(t);var o=t.shapeInfo.logicalShape,i=e.logicalShape;return o.length<=i.length&&(r+=n?function(t,e){var n,r=t.name,o=r.charAt(0).toUpperCase()+r.slice(1),i="get"+o+"AtOutCoords",a=t.shapeInfo.logicalShape.length,s=e.logicalShape.length,u=Mr(t.shapeInfo.logicalShape,e.logicalShape),c=Do(s),l=s-a,f=["x","y","z","w","u","v"];n=0===a?"":s<2&&u.length>=1?"coords = 0;":u.map((function(t){return"coords."+f[t+l]+" = 0;"})).join("\n");var h;h=s<2&&a>0?"coords":t.shapeInfo.logicalShape.map((function(t,e){return"coords."+f[e+l]})).join(", ");var p="return outputValue;",d=1===I(t.shapeInfo.logicalShape),m=1===I(e.logicalShape);if(1!==a||d||m){if(d&&!m)p=1===s?"\n return vec4(outputValue.x, outputValue.x, 0., 0.);\n ":"\n return vec4(outputValue.x);\n ";else if(u.length){var v=a-2,g=a-1;u.indexOf(v)>-1&&u.indexOf(g)>-1?p="return vec4(outputValue.x);":u.indexOf(v)>-1?p="return vec4(outputValue.x, outputValue.y, outputValue.x, outputValue.y);":u.indexOf(g)>-1&&(p="return vec4(outputValue.xx, outputValue.zz);")}}else p="\n return vec4(outputValue.xy, outputValue.xy);\n ";return"\n vec4 "+i+"() {\n "+c+" coords = getOutputCoords();\n "+n+"\n vec4 outputValue = get"+o+"("+h+");\n "+p+"\n }\n "}(t,e):function(t,e){var n=t.name,r=n.charAt(0).toUpperCase()+n.slice(1),o="get"+r+"AtOutCoords",i=e.texShape,a=t.shapeInfo.texShape,s=t.shapeInfo.logicalShape.length,u=e.logicalShape.length;if(!t.shapeInfo.isUniform&&s===u&&null==t.shapeInfo.flatOffset&&O(a,i))return"\n float "+o+"() {\n return sampleTexture("+n+", resultUV);\n }\n ";var c=Do(u),l=Mr(t.shapeInfo.logicalShape,e.logicalShape),f=u-s,h=["x","y","z","w","u","v"];return"\n float "+o+"() {\n "+c+" coords = getOutputCoords();\n "+(0===s?"":u<2&&l.length>=1?"coords = 0;":l.map((function(t){return"coords."+h[t+f]+" = 0;"})).join("\n"))+"\n return get"+r+"("+(u<2&&s>0?"coords":t.shapeInfo.logicalShape.map((function(t,e){return"coords."+h[e+f]})).join(", "))+");\n }\n "}(t,e)),r}(t,e,r)})).join("\n"),c=e.texShape,l=xo(),f=function(t){return"\n float sampleTexture(sampler2D textureSampler, vec2 uv) {\n return "+t.texture2D+"(textureSampler, uv).r;\n }\n "}(l),h=function(t){return t.version+"\n precision highp float;\n precision highp int;\n precision highp sampler2D;\n "+t.varyingFs+" vec2 resultUV;\n "+t.defineOutput+"\n const vec2 halfCR = vec2(0.5, 0.5);\n\n struct ivec5\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n };\n\n struct ivec6\n {\n int x;\n int y;\n int z;\n int w;\n int u;\n int v;\n };\n\n uniform float NAN;\n "+t.defineSpecialNaN+"\n "+t.defineSpecialInf+"\n "+t.defineRound+"\n\n int imod(int x, int y) {\n return x - y * (x / y);\n }\n\n int idiv(int a, int b, float sign) {\n int res = a / b;\n int mod = imod(a, b);\n if (sign < 0. && mod != 0) {\n res -= 1;\n }\n return res;\n }\n\n //Based on the work of Dave Hoskins\n //https://www.shadertoy.com/view/4djSRW\n #define HASHSCALE1 443.8975\n float random(float seed){\n vec2 p = resultUV * seed;\n vec3 p3 = fract(vec3(p.xyx) * HASHSCALE1);\n p3 += dot(p3, p3.yzx + 19.19);\n return fract((p3.x + p3.y) * p3.z);\n }\n\n "+ko+"\n "+To+"\n "+Io+"\n "}(l);return e.isPacked?(i=function(t,e){switch(t.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];return 1===n[0]?"\n int getOutputCoords() {\n return 2 * int(resultUV.x * "+n[1]+".0);\n }\n ":1===n[1]?"\n int getOutputCoords() {\n return 2 * int(resultUV.y * "+n[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n return 2 * (resTexRC.x * "+n[1]+" + resTexRC.y);\n }\n "}(0,e);case 2:return function(t,e){var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)];if(O(t,e))return"\n ivec2 getOutputCoords() {\n return 2 * ivec2(resultUV.yx * vec2("+n[0]+", "+n[1]+"));\n }\n ";var r=Math.ceil(t[1]/2);return"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n int r = 2 * (index / "+r+");\n int c = imod(index, "+r+") * 2;\n\n return ivec2(r, c);\n }\n "}(t,e);case 3:return n=t,r=e,o=[Math.ceil(r[0]/2),Math.ceil(r[1]/2)],a=(i=Math.ceil(n[2]/2))*Math.ceil(n[1]/2),"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+o[0]+", "+o[1]+"));\n int index = resTexRC.x * "+o[1]+" + resTexRC.y;\n\n int b = index / "+a+";\n index -= b * "+a+";\n\n int r = 2 * (index / "+i+");\n int c = imod(index, "+i+") * 2;\n\n return ivec3(b, r, c);\n }\n ";default:return function(t,e){for(var n=[Math.ceil(e[0]/2),Math.ceil(e[1]/2)],r=Math.ceil(t[t.length-1]/2),o=r*Math.ceil(t[t.length-2]/2),i=o,a="",s="b, r, c",u=2;u<t.length-1;u++)a="\n int b"+u+" = index / "+(i*=t[t.length-u-1])+";\n index -= b"+u+" * "+i+";\n "+a,s="b"+u+", "+s;return"\n ivec"+t.length+" getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n\n "+a+"\n\n int b = index / "+o+";\n index -= b * "+o+";\n\n int r = 2 * (index / "+r+");\n int c = imod(index, "+r+") * 2;\n\n return ivec"+t.length+"("+s+");\n }\n "}(t,e)}var n,r,o,i,a}(e.logicalShape,c),a=function(t){return"\n void setOutput(vec4 val) {\n "+t.output+" = val;\n }\n "}(l)):(i=function(t,e){switch(t.length){case 0:return"\n int getOutputCoords() {\n return 0;\n }\n ";case 1:return function(t,e){return 1===e[0]?"\n int getOutputCoords() {\n return int(resultUV.x * "+e[1]+".0);\n }\n ":1===e[1]?"\n int getOutputCoords() {\n return int(resultUV.y * "+e[0]+".0);\n }\n ":"\n int getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n return resTexRC.x * "+e[1]+" + resTexRC.y;\n }\n "}(0,e);case 2:return function(t,e){return O(t,e)?"\n ivec2 getOutputCoords() {\n return ivec2(resultUV.yx * vec2("+e[0]+", "+e[1]+"));\n }\n ":1===t[1]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n return ivec2(index, 0);\n }\n ":1===t[0]?"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n return ivec2(0, index);\n }\n ":"\n ivec2 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n int r = index / "+t[1]+";\n int c = index - r * "+t[1]+";\n return ivec2(r, c);\n }\n "}(t,e);case 3:return n=e,r=_o(["r","c","d"],t),"\n ivec3 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+n[0]+", "+n[1]+"));\n int index = resTexRC.x * "+n[1]+" + resTexRC.y;\n "+r+"\n return ivec3(r, c, d);\n }\n ";case 4:return function(t,e){var n=_o(["r","c","d","d2"],t);return"\n ivec4 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n "+n+"\n return ivec4(r, c, d, d2);\n }\n "}(t,e);case 5:return function(t,e){var n=_o(["r","c","d","d2","d3"],t);return"\n ivec5 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx * vec2("+e[0]+",\n "+e[1]+"));\n\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n\n "+n+"\n\n ivec5 outShape = ivec5(r, c, d, d2, d3);\n return outShape;\n }\n "}(t,e);case 6:return function(t,e){var n=_o(["r","c","d","d2","d3","d4"],t);return"\n ivec6 getOutputCoords() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = resTexRC.x * "+e[1]+" + resTexRC.y;\n\n "+n+"\n\n ivec6 result = ivec6(r, c, d, d2, d3, d4);\n return result;\n }\n "}(t,e);default:throw new Error(t.length+"-D output sampling is not yet supported")}var n,r}(e.logicalShape,c),a=function(t){return"\n void setOutput(float val) {\n "+t.output+" = vec4(val, 0, 0, 0);\n }\n "}(l)),r&&(h+=Oo),[h,f,a,s,i,u,n].join("\n")}var ko="\nvec2 uvFromFlat(int texNumR, int texNumC, int index) {\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\nvec2 packedUVfrom1D(int texNumR, int texNumC, int index) {\n int texelIndex = index / 2;\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",To="\nvec2 packedUVfrom2D(int texelsInLogicalRow, int texNumR,\n int texNumC, int row, int col) {\n int texelIndex = (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = texelIndex / texNumC;\n int texC = texelIndex - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",Io="\nvec2 packedUVfrom3D(int texNumR, int texNumC,\n int texelsInBatch, int texelsInLogicalRow, int b,\n int row, int col) {\n int index = b * texelsInBatch + (row / 2) * texelsInLogicalRow + (col / 2);\n int texR = index / texNumC;\n int texC = index - texR * texNumC;\n return (vec2(texC, texR) + halfCR) / vec2(texNumC, texNumR);\n}\n",Oo="\n float getChannel(vec4 frag, vec2 innerDims) {\n vec2 modCoord = mod(innerDims, 2.);\n return modCoord.x == 0. ?\n (modCoord.y == 0. ? frag.r : frag.g) :\n (modCoord.y == 0. ? frag.b : frag.a);\n }\n float getChannel(vec4 frag, int dim) {\n float modCoord = mod(float(dim), 2.);\n return modCoord == 0. ? frag.r : frag.g;\n }\n";function Ro(t){return"offset"+t}function Ao(t){var e=t.name,n=I(t.shapeInfo.logicalShape);return n<2?"return "+e+";":"\n for (int i = 0; i < "+n+"; i++) {\n if (i == index) {\n return "+e+"[i];\n }\n }\n "}function Do(t){if(t<=1)return"int";if(2===t)return"ivec2";if(3===t)return"ivec3";if(4===t)return"ivec4";if(5===t)return"ivec5";if(6===t)return"ivec6";throw Error("GPU for rank "+t+" is not yet supported")}function No(t,e){var n=JSON.parse(JSON.stringify(t));return n.shapeInfo.logicalShape=e,n}function Po(t,e){return e.map((function(e){return t[e]})).join(", ")}var Mo=function(t,e,n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,C(t.length>2,(function(){return"Packed arg"+(n.charAt(0).toUpperCase()+n.slice(1))+" supports only inputs with rank above 2."}));var o=t[t.length-1],i=Math.ceil(o/e);this.outputShape=t.slice(0,-1),i>1&&this.outputShape.push(i),r||this.variableNames.push("bestIndicesA");var a,s,u=this.outputShape,c=u.length,l=Do(c),f=wo("coords",c);if(1===i){var h=Do(s=c+1);a="\n "+h+" sourceLocR = "+h+"("+f.join()+", 0);\n ++"+f[c-1]+";\n "+h+" sourceLocG = "+h+"("+f.join()+", 0);\n ++"+f[c-2]+";\n "+h+" sourceLocA = "+h+"("+f.join()+", 0);\n --"+f[c-1]+";\n "+h+" sourceLocB = "+h+"("+f.join()+", 0);\n --"+f[c-2]+";"}else s=c,a="\n "+l+" sourceLocR = coords;\n ++"+f[c-1]+";\n "+l+" sourceLocG = coords;\n ++"+f[c-2]+";\n "+l+" sourceLocA = coords;\n --"+f[c-1]+";\n "+l+" sourceLocB = coords;\n --"+f[c-2]+";";var p=["x","y","z","w","u","v"].slice(0,s),d="."+p[s-1],m=p.map((function(t){return"int "+t})),v=wo("sourceLocR",s-1).concat("inIdx.r"),g=wo("sourceLocG",s-1).concat("inIdx.g"),y=wo("sourceLocB",s-1).concat("inIdx.b"),b=wo("sourceLocA",s-1).concat("inIdx.a"),w="max"===n?"greaterThan":"lessThan",x=r?"":"\n inIdx = round(vec4(getBestIndicesAChannel("+v.join()+"),\n getBestIndicesAChannel("+g.join()+"),\n getBestIndicesAChannel("+y.join()+"),\n getBestIndicesAChannel("+b.join()+")));",_="vec4(\n getAChannel("+v.join()+"),\n hasNextCol ? getAChannel("+g.join()+") : 0.,\n hasNextRow ? getAChannel("+y.join()+") : 0.,\n hasNextRow && hasNextCol ? getAChannel("+b.join()+") : 0.)",E=r?"":"\n float getBestIndicesAChannel("+m.join()+") {\n return getChannel(getBestIndicesA("+p.join()+"),\n vec2("+p.slice(-2).join()+"));\n }";this.userCode="\n float getAChannel("+m.join()+") {\n return getChannel(getA("+p.join()+"),\n vec2("+p.slice(-2).join()+"));\n }\n "+E+"\n void main() {\n "+l+" coords = getOutputCoords();\n bool hasNextCol = "+f[c-1]+" < "+(u[c-1]-1)+";\n bool hasNextRow = "+f[c-2]+" < "+(u[c-2]-1)+";\n "+a+"\n ivec4 srcIdx = ivec4(sourceLocR"+d+", sourceLocG"+d+",\n sourceLocB"+d+", sourceLocA"+d+") * "+e+";\n ivec4 inIdx = srcIdx;\n vec4 bestIndex = vec4(inIdx);\n vec4 bestValue = "+_+";\n\n for (int i = 0; i < "+e+"; i++) {\n inIdx = srcIdx;\n "+x+"\n vec4 candidate = "+_+";\n bvec4 nan = isnan(candidate);\n bvec4 replace = bvec4(\n vec4("+w+"(candidate, bestValue)) * (vec4(1.0) - vec4(nan)));\n\n bestValue = vec4(replace.x ? candidate.x : bestValue.x,\n replace.y ? candidate.y : bestValue.y,\n replace.z ? candidate.z : bestValue.z,\n replace.w ? candidate.w : bestValue.w);\n bestIndex = mix(bestIndex, vec4(inIdx), vec4(replace));\n srcIdx++;\n }\n setOutput(bestIndex);\n }\n "},jo=function(t){this.variableNames=["dy"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,o=t.strideWidth,i=t.dilationHeight,a=t.dilationWidth,s=t.effectiveFilterHeight,u=t.effectiveFilterWidth,c=s-1-t.padInfo.top,l=u-1-t.padInfo.left,f=1/(e*n);this.userCode="\n const ivec2 pads = ivec2("+c+", "+l+");\n const float avgMultiplier = float("+f+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+s+";\n wR += "+i+") {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+u+";\n wC+= "+a+") {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n setOutput(dotProd);\n }\n "},Fo=function(t){this.variableNames=["dy"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,r=t.filterWidth,o=t.strideDepth,i=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,c=t.dilationWidth,l=t.effectiveFilterDepth,f=t.effectiveFilterHeight,h=t.effectiveFilterWidth,p=l-1-t.padInfo.front,d=f-1-t.padInfo.top,m=h-1-t.padInfo.left,v=1/(e*n*r);this.userCode="\n const ivec3 pads = ivec3("+p+", "+d+", "+m+");\n const float avgMultiplier = float("+v+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, d) with pos mask(:, :, :, ch) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < "+l+";\n wD += "+s+") {\n float dyD = float(dyDCorner + wD) / "+o+".0;\n\n if (dyD < 0.0 || dyD >= "+t.outDepth+".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < "+f+";\n wR += "+u+") {\n float dyR = float(dyRCorner + wR) / "+i+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+h+";\n wC += "+c+") {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n\n dotProd += dyValue * avgMultiplier;\n }\n }\n }\n setOutput(dotProd);\n }\n "},Bo=function(t,e,n,r,o,i){this.outputShape=[],this.variableNames=["x","mean","variance"],Fr(t,e),Fr(t,n);var a="0.0";null!=r&&(Fr(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="1.0";null!=o&&(Fr(t,o),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n float x = getXAtOutCoords();\n float mean = getMeanAtOutCoords();\n float variance = getVarianceAtOutCoords();\n float offset = "+a+";\n float scale = "+s+";\n float inv = scale * inversesqrt(variance + float("+i+"));\n setOutput(dot(vec3(x, -mean, offset), vec3(inv, inv, 1)));\n }\n "},Lo=function(t,e,n,r,o,i){this.packedInputs=!0,this.packedOutput=!0,this.variableNames=["x","mean","variance"],Fr(t,e),Fr(t,n);var a="vec4(0.0)";null!=r&&(Fr(t,r),this.variableNames.push("offset"),a="getOffsetAtOutCoords()");var s="vec4(1.0)";null!=o&&(Fr(t,o),this.variableNames.push("scale"),s="getScaleAtOutCoords()"),this.outputShape=t,this.userCode="\n void main() {\n vec4 offset = "+a+";\n vec4 scale = "+s+";\n\n vec4 x = getXAtOutCoords();\n vec4 mean = getMeanAtOutCoords();\n vec4 variance = getVarianceAtOutCoords();\n\n vec4 inv = scale * inversesqrt(variance + vec4("+i+"));\n\n setOutput((x - mean) * inv + offset);\n }\n "},Uo=function(t,e,n){this.variableNames=["AReal","AImag","BReal","BImag"],this.outputShape=Fr(e,n),this.userCode="\n float binaryOpComplex(\n float areal, float aimag, float breal, float bimag) {\n "+t+"\n }\n\n void main() {\n float areal = getARealAtOutCoords();\n float aimag = getAImagAtOutCoords();\n float breal = getBRealAtOutCoords();\n float bimag = getBImagAtOutCoords();\n setOutput(binaryOpComplex(areal, aimag, breal, bimag));\n }\n "},Wo="return a + b;",zo="return a - b;",Vo="return a * b;",qo="return (a < 0.) ? b * a : a;",Go=function(t,e,n){this.variableNames=["A","B"],this.outputShape=Fr(e,n),this.userCode="\n float binaryOperation(float a, float b) {\n "+t+"\n }\n\n void main() {\n float a = getAAtOutCoords();\n float b = getBAtOutCoords();\n setOutput(binaryOperation(a, b));\n }\n "},Ho="\n vec4 aLessThanZero = vec4(lessThan(a, vec4(0.)));\n return (aLessThanZero * (b * a)) + ((vec4(1.0) - aLessThanZero) * a);\n",Xo=function(t,e,n,r){void 0===r&&(r=!1),this.variableNames=["A","B"],this.supportsBroadcasting=!0,this.packedInputs=!0,this.packedOutput=!0,this.outputShape=Fr(e,n);var o=this.outputShape.length,i="";if(r)if(0===o||1===I(this.outputShape))i="\n result.y = 0.;\n result.z = 0.;\n result.w = 0.;\n ";else if(i="\n "+Do(o)+" coords = getOutputCoords();\n ",1===o)i+="\n result.y = (coords + 1) >= "+this.outputShape[0]+" ? 0. : result.y;\n result.z = 0.;\n result.w = 0.;\n ";else{var a=wo("coords",o);i+="\n bool nextRowOutOfBounds =\n ("+a[o-2]+" + 1) >= "+this.outputShape[o-2]+";\n bool nextColOutOfBounds =\n ("+a[o-1]+" + 1) >= "+this.outputShape[o-1]+";\n result.y = nextColOutOfBounds ? 0. : result.y;\n result.z = nextRowOutOfBounds ? 0. : result.z;\n result.w = nextColOutOfBounds || nextRowOutOfBounds ? 0. : result.w;\n "}this.userCode="\n vec4 binaryOperation(vec4 a, vec4 b) {\n "+t+"\n }\n\n void main() {\n vec4 a = getAAtOutCoords();\n vec4 b = getBAtOutCoords();\n\n vec4 result = binaryOperation(a, b);\n "+i+"\n\n setOutput(result);\n }\n "},Ko=function(){function t(t){this.variableNames=["A"],this.outputShape=t,this.userCode="\n uniform float minVal;\n uniform float maxVal;\n\n void main() {\n float value = getAAtOutCoords();\n if (isnan(value)) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, minVal, maxVal));\n }\n "}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(r,o){null==n.minLoc&&(n.minLoc=r.getUniformLocationNoThrow(o,"minVal"),n.maxLoc=r.getUniformLocationNoThrow(o,"maxVal")),r.gl.uniform1f(n.minLoc,t),r.gl.uniform1f(n.maxLoc,e)}},t}(),Yo=function(){function t(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.userCode="\n uniform float minVal;\n uniform float maxVal;\n\n void main() {\n vec4 value = getAAtOutCoords();\n\n if (any(isnan(value))) {\n setOutput(value);\n return;\n }\n\n setOutput(clamp(value, vec4(minVal), vec4(maxVal)));\n }\n "}return t.prototype.getCustomSetupFunc=function(t,e){var n=this;return function(r,o){null==n.minLoc&&(n.minLoc=r.getUniformLocationNoThrow(o,"minVal"),n.maxLoc=r.getUniformLocationNoThrow(o,"maxVal")),r.gl.uniform1f(n.minLoc,t),r.gl.uniform1f(n.maxLoc,e)}},t}(),$o=function(t){this.variableNames=["real","imag"],this.outputShape=t,this.userCode="\n void main() {\n float re = abs(getRealAtOutCoords());\n float im = abs(getImagAtOutCoords());\n float mx = max(re, im);\n\n // sadly the length function in glsl is not underflow-safe\n // (at least not on Intel GPUs). So the safe solution is\n // to ensure underflow-safety in all cases.\n setOutput(\n mx == 0.0 ? 0.0 : mx * length(vec2(1, min(re, im)/mx))\n );\n }\n "},Jo=function(t){this.outputShape=[],this.outputShape=nn(t,1),this.variableNames=t.map((function(t,e){return"T"+e}));var e=new Array(t.length-1);e[0]=t[0][1];for(var n=1;n<e.length;n++)e[n]=e[n-1]+t[n][1];var r=["if (yC < "+e[0]+") setOutput(getT0(yR, yC));"];for(n=1;n<e.length;n++){var o=e[n-1];r.push("else if (yC < "+e[n]+") setOutput(getT"+n+"(yR, yC-"+o+"));")}var i=e.length,a=e[e.length-1];r.push("else setOutput(getT"+i+"(yR, yC-"+a+"));"),this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int yR = coords.x;\n int yC = coords.y;\n\n "+r.join("\n ")+"\n }\n "},Qo=function(t,e){this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[],this.outputShape=nn(t,e);var n=this.outputShape,r=n.length,o=Do(r),i=wo("coords",r),a=["x","y","z","w","u","v"].slice(0,r);this.variableNames=t.map((function(t,e){return"T"+e}));var s=new Array(t.length-1);s[0]=t[0][e];for(var u=1;u<s.length;u++)s[u]=s[u-1]+t[u][e];var c=a[e],l=a.slice(-2),f=a.join(),h="if ("+c+" < "+s[0]+") {\n return getChannel(\n getT0("+f+"), vec2("+l.join()+"));\n }";for(u=1;u<s.length;u++){var p=s[u-1];h+="\n if ("+c+" < "+s[u]+" && "+c+" >= "+s[u-1]+") {\n return getChannel(\n getT"+u+"("+Zo(a,c,p)+"),\n vec2("+Zo(l,c,p)+"));\n }"}var d=s.length,m=s[s.length-1];h+="\n return getChannel(\n getT"+d+"("+Zo(a,c,m)+"),\n vec2("+Zo(l,c,m)+"));",this.userCode="\n float getValue("+a.map((function(t){return"int "+t}))+") {\n "+h+"\n }\n\n void main() {\n "+o+" coords = getOutputCoords();\n vec4 result = vec4(getValue("+i+"), 0., 0., 0.);\n\n "+i[r-1]+" = "+i[r-1]+" + 1;\n if ("+i[r-1]+" < "+n[r-1]+") {\n result.g = getValue("+i+");\n }\n\n "+i[r-2]+" = "+i[r-2]+" + 1;\n if ("+i[r-2]+" < "+n[r-2]+") {\n result.a = getValue("+i+");\n }\n\n "+i[r-1]+" = "+i[r-1]+" - 1;\n if ("+i[r-2]+" < "+n[r-2]+" &&\n "+i[r-1]+" < "+n[r-1]+") {\n result.b = getValue("+i+");\n }\n setOutput(result);\n }\n "};function Zo(t,e,n){var r=t.indexOf(e);return t.map((function(t,e){return e===r?t+" - "+n:t})).join()}var ti=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,o=t.padInfo.left,i="channelsLast"===t.dataFormat;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int d2 = coords.w;\n\n // Convolve x(?, ?, d1) with dy(:, :, d2) to get dw(wR, wC, d1, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+r+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+o+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n if ("+i+") {\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n } else {\n float dyValue = getDy(b, d2, yR, yC);\n float xValue = getX(b, d1, xR, xC);\n dotProd += (xValue * dyValue);\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n "},ei=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,o=t.strideWidth,i="channelsLast"===t.dataFormat,a=e-1-t.padInfo.top,s=n-1-t.padInfo.left,u=i?1:2,c=i?2:3,l=i?3:1;this.userCode="\n const ivec2 pads = ivec2("+a+", "+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords["+l+"];\n\n ivec2 dyCorner = ivec2(coords["+u+"], coords["+c+"]) - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n // Convolve dy(?, ?, d2) with w(:, :, d1, d2) to compute dx(xR, xC, d1).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n\n if ("+i+") {\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n } else {\n float xValue = getDy(batch, d2, idyR, idyC);\n float wValue = getW(wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n\n }\n }\n }\n setOutput(dotProd);\n }\n "},ni=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideDepth,n=t.strideHeight,r=t.strideWidth,o=t.padInfo.front,i=t.padInfo.top,a=t.padInfo.left;this.userCode="\n void main() {\n ivec5 coords = getOutputCoords();\n int wF = coords.x;\n int wR = coords.y;\n int wC = coords.z;\n int d1 = coords.w;\n int d2 = coords.u;\n\n float dotProd = 0.0;\n\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yF = 0; yF < "+t.outDepth+"; yF++) {\n int xF = wF + yF * "+e+" - "+o+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+n+" - "+i+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+r+" - "+a+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yF, yR, yC, d2);\n float xValue = getX(b, xF, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},ri=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterDepth,n=t.filterHeight,r=t.filterWidth,o=t.strideDepth,i=t.strideHeight,a=t.strideWidth,s=e-1-t.padInfo.front,u=n-1-t.padInfo.top,c=r-1-t.padInfo.left;this.userCode="\n const ivec3 pads = ivec3("+s+", "+u+", "+c+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d1 = coords.u;\n\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyFCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n float dotProd = 0.0;\n for (int wF = 0; wF < "+e+"; wF++) {\n float dyF = float(dyFCorner + wF) / "+o+".0;\n\n if (dyF < 0.0 || dyF >= "+t.outDepth+".0 || fract(dyF) > 0.0) {\n continue;\n }\n int idyF = int(dyF);\n\n int wFPerm = "+e+" - 1 - wF;\n\n for (int wR = 0; wR < "+n+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+i+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+n+" - 1 - wR;\n\n for (int wC = 0; wC < "+r+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+a+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+r+" - 1 - wC;\n\n for (int d2 = 0; d2 < "+t.outChannels+"; d2++) {\n float xValue = getDy(batch, idyF, idyR, idyC, d2);\n float wValue = getW(wFPerm, wRPerm, wCPerm, d1, d2);\n dotProd += xValue * wValue;\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},oi=function(t){this.variableNames=["x","dy"],this.outputShape=t.filterShape;var e=t.strideHeight,n=t.strideWidth,r=t.padInfo.top,o=t.padInfo.left,i=t.outChannels/t.inChannels;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int wR = coords.x;\n int wC = coords.y;\n int d1 = coords.z;\n int dm = coords.w;\n int d2 = d1 * "+i+" + dm;\n\n float dotProd = 0.0;\n\n // TO DO: Vec4 over the batch size\n for (int b = 0; b < "+t.batchSize+"; b++) {\n for (int yR = 0; yR < "+t.outHeight+"; yR++) {\n int xR = wR + yR * "+e+" - "+r+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int yC = 0; yC < "+t.outWidth+"; yC++) {\n int xC = wC + yC * "+n+" - "+o+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float dyValue = getDy(b, yR, yC, d2);\n float xValue = getX(b, xR, xC, d1);\n dotProd += (xValue * dyValue);\n }\n }\n }\n setOutput(dotProd);\n }\n "},ii=function(t){this.variableNames=["dy","W"],this.outputShape=t.inShape;var e=t.filterHeight,n=t.filterWidth,r=t.strideHeight,o=t.strideWidth,i=e-1-t.padInfo.top,a=n-1-t.padInfo.left,s=t.outChannels/t.inChannels;this.userCode="\n const ivec2 pads = ivec2("+i+", "+a+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d1 = coords[3];\n ivec2 dyCorner = coords.yz - pads;\n int dyRCorner = dyCorner.x;\n int dyCCorner = dyCorner.y;\n\n float dotProd = 0.0;\n\n for (int wR = 0; wR < "+e+"; wR++) {\n float dyR = float(dyRCorner + wR) / "+r+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n int wRPerm = "+e+" - 1 - wR;\n\n for (int wC = 0; wC < "+n+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+o+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n int wCPerm = "+n+" - 1 - wC;\n\n // TO DO: Vec4 over the channelMul\n for (int dm = 0; dm < "+s+"; dm++) {\n int d2 = d1 * "+s+" + dm;\n float xValue = getDy(batch, idyR, idyC, d2);\n float wValue = getW(wRPerm, wCPerm, d1, dm);\n dotProd += xValue * wValue;\n }\n }\n }\n setOutput(dotProd);\n }\n "},ai=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===r&&(r=!1),this.variableNames=["x","W"],this.outputShape=t.outShape;var o=t.padInfo.top,i=t.padInfo.left,a=t.strideHeight,s=t.strideWidth,u=t.dilationHeight,c=t.dilationWidth,l=t.filterHeight,f=t.filterWidth,h=4*Math.floor(t.inChannels/4),p=t.inChannels%4,d="channelsLast"===t.dataFormat,m=d?1:2,v=d?2:3,g=d?3:1,y="",b="";n&&(y=r?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n "+n+"\n }":"\n float activation(float x) {\n "+n+"\n }\n ",b="result = activation(result);");var w=e?"result += getBiasAtOutCoords();":"";e&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+y+"\n\n const ivec2 strides = ivec2("+a+", "+s+");\n const ivec2 pads = ivec2("+o+", "+i+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d2 = coords["+g+"];\n\n ivec2 xRCCorner =\n ivec2(coords["+m+"], coords["+v+"]) * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, d2) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+l+"; wR++) {\n int xR = xRCorner + wR * "+u+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+f+"; wC++) {\n int xC = xCCorner + wC * "+c+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+h+"; d1 += 4) {\n vec4 wValues = vec4(\n getW(wR, wC, d1, d2),\n getW(wR, wC, d1 + 1, d2),\n getW(wR, wC, d1 + 2, d2),\n getW(wR, wC, d1 + 3, d2)\n );\n\n if ("+d+") {\n vec4 xValues = vec4(\n getX(batch, xR, xC, d1),\n getX(batch, xR, xC, d1 + 1),\n getX(batch, xR, xC, d1 + 2),\n getX(batch, xR, xC, d1 + 3)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec4 xValues = vec4(\n getX(batch, d1, xR, xC),\n getX(batch, d1 + 1, xR, xC),\n getX(batch, d1 + 2, xR, xC),\n getX(batch, d1 + 3, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n\n if ("+(1===p)+") {\n\n if ("+d+") {\n dotProd +=\n getX(batch, xR, xC, "+h+") *\n getW(wR, wC, "+h+", d2);\n } else {\n dotProd +=\n getX(batch, "+h+", xR, xC) *\n getW(wR, wC, "+h+", d2);\n }\n\n } else if ("+(2===p)+") {\n vec2 wValues = vec2(\n getW(wR, wC, "+h+", d2),\n getW(wR, wC, "+h+" + 1, d2)\n );\n\n if ("+d+") {\n vec2 xValues = vec2(\n getX(batch, xR, xC, "+h+"),\n getX(batch, xR, xC, "+h+" + 1)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec2 xValues = vec2(\n getX(batch, "+h+", xR, xC),\n getX(batch, "+h+" + 1, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n } else if ("+(3===p)+") {\n vec3 wValues = vec3(\n getW(wR, wC, "+h+", d2),\n getW(wR, wC, "+h+" + 1, d2),\n getW(wR, wC, "+h+" + 2, d2)\n );\n\n if ("+d+") {\n vec3 xValues = vec3(\n getX(batch, xR, xC, "+h+"),\n getX(batch, xR, xC, "+h+" + 1),\n getX(batch, xR, xC, "+h+" + 2)\n );\n dotProd += dot(xValues, wValues);\n } else {\n vec3 xValues = vec3(\n getX(batch, "+h+", xR, xC),\n getX(batch, "+h+" + 1, xR, xC),\n getX(batch, "+h+" + 2, xR, xC)\n );\n dotProd += dot(xValues, wValues);\n }\n\n }\n }\n }\n\n float result = dotProd;\n "+w+"\n "+b+"\n setOutput(result);\n }\n "},si=function(t){this.variableNames=["x","W"],this.outputShape=t.outShape;var e=t.padInfo.front,n=t.padInfo.top,r=t.padInfo.left,o=t.strideDepth,i=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,c=t.dilationWidth,l=t.filterDepth,f=t.filterHeight,h=t.filterWidth,p=4*Math.floor(t.inChannels/4),d=t.inChannels%4;this.userCode="\n const ivec3 strides = ivec3("+o+", "+i+", "+a+");\n const ivec3 pads = ivec3("+e+", "+n+", "+r+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int d2 = coords.u;\n\n ivec3 xFRCCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xFCorner = xFRCCorner.x;\n int xRCorner = xFRCCorner.y;\n int xCCorner = xFRCCorner.z;\n\n // Convolve x(?, ?, ?, d1) with w(:, :, :, d1, d2) to get\n // y(yF, yR, yC, d2). ? = to be determined. : = across all\n // values in that axis.\n float dotProd = 0.0;\n for (int wF = 0; wF < "+l+"; wF++) {\n int xF = xFCorner + wF * "+s+";\n\n if (xF < 0 || xF >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+f+"; wR++) {\n int xR = xRCorner + wR * "+u+";\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+h+"; wC++) {\n int xC = xCCorner + wC * "+c+";\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n for (int d1 = 0; d1 < "+p+"; d1 += 4) {\n vec4 xValues = vec4(\n getX(batch, xF, xR, xC, d1),\n getX(batch, xF, xR, xC, d1 + 1),\n getX(batch, xF, xR, xC, d1 + 2),\n getX(batch, xF, xR, xC, d1 + 3)\n );\n vec4 wValues = vec4(\n getW(wF, wR, wC, d1, d2),\n getW(wF, wR, wC, d1 + 1, d2),\n getW(wF, wR, wC, d1 + 2, d2),\n getW(wF, wR, wC, d1 + 3, d2)\n );\n\n dotProd += dot(xValues, wValues);\n }\n\n if ("+(1===d)+") {\n dotProd +=\n getX(batch, xF, xR, xC, "+p+") *\n getW(wF, wR, wC, "+p+", d2);\n } else if ("+(2===d)+") {\n vec2 xValues = vec2(\n getX(batch, xF, xR, xC, "+p+"),\n getX(batch, xF, xR, xC, "+p+" + 1)\n );\n vec2 wValues = vec2(\n getW(wF, wR, wC, "+p+", d2),\n getW(wF, wR, wC, "+p+" + 1, d2)\n );\n dotProd += dot(xValues, wValues);\n } else if ("+(3===d)+") {\n vec3 xValues = vec3(\n getX(batch, xF, xR, xC, "+p+"),\n getX(batch, xF, xR, xC, "+p+" + 1),\n getX(batch, xF, xR, xC, "+p+" + 2)\n );\n vec3 wValues = vec3(\n getW(wF, wR, wC, "+p+", d2),\n getW(wF, wR, wC, "+p+" + 1, d2),\n getW(wF, wR, wC, "+p+" + 2, d2)\n );\n dotProd += dot(xValues, wValues);\n }\n }\n }\n }\n setOutput(dotProd);\n }\n "},ui=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===r&&(r=!1),this.variableNames=["x","W"],this.outputShape=t.outShape;var o=t.inHeight,i=t.inWidth,a=t.padInfo.top,s=t.padInfo.left,u=t.strideHeight,c=t.strideWidth,l=t.dilationHeight,f=t.dilationWidth,h=t.filterHeight,p=t.filterWidth,d=t.outChannels/t.inChannels,m="",v="";n&&(m=r?"float activation(float a) {\n float b = getPreluActivationWeightsAtOutCoords();\n "+n+"\n }":"\n float activation(float x) {\n "+n+"\n }\n ",v="result = activation(result);");var g=e?"result += getBiasAtOutCoords();":"";e&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+m+"\n\n const ivec2 strides = ivec2("+u+", "+c+");\n const ivec2 pads = ivec2("+a+", "+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2 / "+d+";\n int q = d2 - d1 * "+d+";\n\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // Convolve x(?, ?, d1) with w(:, :, d1, q) to get y(yR, yC, d2).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n // TO DO(dsmilkov): Flatten the two for loops and vec4 the operations.\n for (int wR = 0; wR < "+h+"; wR++) {\n int xR = xRCorner + wR * "+l+";\n\n if (xR < 0 || xR >= "+o+") {\n continue;\n }\n\n for (int wC = 0; wC < "+p+"; wC++) {\n int xC = xCCorner + wC * "+f+";\n\n if (xC < 0 || xC >= "+i+") {\n continue;\n }\n\n float xVal = getX(batch, xR, xC, d1);\n float wVal = getW(wR, wC, d1, q);\n dotProd += xVal * wVal;\n }\n }\n\n float result = dotProd;\n "+g+"\n "+v+"\n setOutput(result);\n }\n "},ci=function(t,e,n,r){void 0===e&&(e=!1),void 0===n&&(n=null),void 0===r&&(r=!1),this.variableNames=["x","W"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t.outShape;for(var o=t.inHeight,i=t.inWidth,a=t.padInfo.top,s=t.padInfo.left,u=t.strideHeight,c=t.strideWidth,l=t.dilationHeight,f=t.dilationWidth,h=t.filterHeight,p=t.filterWidth,d=p,m="int xR; int xC; int xCOffset;",v=0;v<h;v++)for(var g=0;g<p;g++)m+="\n vec4 xTexelR"+v+"C"+2*g+" = vec4(0.);\n vec4 wR"+v+"C"+g+" = vec4(0.);\n vec4 xR"+v+"C"+g+" = vec4(0.);";for(v=0;v<h;v++)for(var y=0;y<d;y++){if(m+="\n xR = xRCorner + "+v*l+";\n xC = xCCorner + "+(g=2*y)*f+";\n ",1===c){if(g<p&&(m+=s%2==1?"\n xCOffset = xC + 1;\n if(xR >= 0 && xR < "+o+" && xCOffset >= 0 && xCOffset < "+i+") {\n xTexelR"+v+"C"+g+" = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if(xCOffset + 1 >= "+i+") {\n xTexelR"+v+"C"+g+".zw = vec2(0.);\n }\n } else {\n xTexelR"+v+"C"+g+" = vec4(0.);\n }\n\n xCOffset = xC + 1 - 2;\n if(xR >= 0 && xR < "+o+" && xCOffset >= 0 && xCOffset < "+i+") {\n vec4 previous = getX(batch, xR, xCOffset, d1);\n\n // Need to manually clear unused channels in case\n // we're reading from recycled texture.\n if(xCOffset + 1 >= "+i+") {\n previous.zw = vec2(0.);\n }\n\n xR"+v+"C"+g+" = vec4(previous.zw, xTexelR"+v+"C"+g+".xy);\n } else {\n xR"+v+"C"+g+" = vec4(0, 0, xTexelR"+v+"C"+g+".xy);\n }\n ":"\n if(xR >= 0 && xR < "+o+" && xC >= 0 && xC < "+i+") {\n xTexelR"+v+"C"+g+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+v+"C"+g+" = vec4(0.);\n }\n\n xR"+v+"C"+g+" = xTexelR"+v+"C"+g+";\n ",g+1<p)){var b=s%2==0?_(f):f;f%2==0&&s%2==1||f%2!=0&&s%2!=1?(m+="\n xCOffset = xC + "+s%2+" + "+b+";\n\n if(xR >= 0 && xR < "+o+" &&\n xCOffset >= 0 && xCOffset < "+i+") {\n xTexelR"+v+"C"+(g+2)+" = getX(batch, xR, xCOffset, d1);\n }\n ",f>1&&(m+="\n xCOffset -= 2;\n if(xR >= 0 && xR < "+o+" &&\n xCOffset >= 0 && xCOffset < "+i+") {\n xTexelR"+v+"C"+g+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+v+"C"+g+" = vec4(0.);\n }\n "),m+="\n xR"+v+"C"+(g+1)+" = vec4(\n xTexelR"+v+"C"+g+".zw, xTexelR"+v+"C"+(g+2)+".xy);\n "):m+="\n xCOffset = xC + "+b+";\n\n if(xR >= 0 && xR < "+o+" &&\n xCOffset >= 0 && xCOffset < "+i+") {\n xTexelR"+v+"C"+(g+2)+" = getX(batch, xR, xCOffset, d1);\n }\n\n xR"+v+"C"+(g+1)+" = xTexelR"+v+"C"+(g+2)+";\n "}}else g<p&&(m+="\n if(xR >= 0 && xR < "+o+") {\n ",s%2==1?(m+="\n xCOffset = xC + 1 - "+c+";\n if(xCOffset >= 0 && xCOffset < "+i+") {\n xTexelR"+v+"C"+g+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+v+"C"+g+" = vec4(0.);\n }\n\n if(xC + 1 >= 0 && xC + 1 < "+i+") {\n xTexelR"+v+"C"+(g+2)+" = getX(batch, xR, xC + 1, d1);\n } else {\n xTexelR"+v+"C"+(g+2)+" = vec4(0.);\n }\n\n xR"+v+"C"+g+" = vec4(\n xTexelR"+v+"C"+g+".zw, xTexelR"+v+"C"+(g+2)+".zw);\n ",g+1<p&&(m+="\n vec4 final = vec4(0.);\n xCOffset = xC + 1 + "+c+";\n if(xCOffset >= 0 && xCOffset < "+i+") {\n final = getX(batch, xR, xCOffset, d1);\n }\n xR"+v+"C"+(g+1)+" = vec4(xTexelR"+v+"C"+(g+2)+".xy, final.xy);\n ")):(m+="\n if(xC >= 0 && xC < "+i+") {\n xTexelR"+v+"C"+g+" = getX(batch, xR, xC, d1);\n } else {\n xTexelR"+v+"C"+g+" = vec4(0.);\n }\n\n xCOffset = xC + "+c+";\n if(xCOffset >= 0 && xCOffset < "+i+") {\n xTexelR"+v+"C"+(g+2)+" = getX(batch, xR, xCOffset, d1);\n } else {\n xTexelR"+v+"C"+(g+2)+" = vec4(0.);\n }\n\n xR"+v+"C"+g+" = vec4(\n xTexelR"+v+"C"+g+".xy, xTexelR"+v+"C"+(g+2)+".xy);\n ",g+1<p&&(m+="\n xR"+v+"C"+(g+1)+" = vec4(\n xTexelR"+v+"C"+g+".zw, xTexelR"+v+"C"+(g+2)+".zw);\n ")),m+="}");g<p&&(m+="\n vec4 wTexelR"+v+"C"+g+" = getW("+v+", "+g+", d1, q);\n wR"+v+"C"+g+" = vec4(wTexelR"+v+"C"+g+".xz, wTexelR"+v+"C"+g+".xz);\n ",g+1<p&&(m+="\n vec4 wTexelR"+v+"C"+(g+1)+" = getW("+v+", "+(g+1)+", d1, q);\n wR"+v+"C"+(g+1)+" =\n vec4(wTexelR"+v+"C"+(g+1)+".xz, wTexelR"+v+"C"+(g+1)+".xz);"))}for(v=0;v<h;v++)for(g=0;g<p;g++)m+="dotProd += xR"+v+"C"+g+" * wR"+v+"C"+g+";";var w="",x="";n&&(w=r?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n "+n+"\n }":"vec4 activation(vec4 x) {\n "+n+"\n }",x="result = activation(result);");var E=e?"result += getBiasAtOutCoords();":"";e&&this.variableNames.push("bias"),r&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+w+"\n\n const ivec2 strides = ivec2("+u+", "+c+");\n const ivec2 pads = ivec2("+a+", "+s+");\n\n void main() {\n\n ivec4 coords = getOutputCoords();\n int batch = coords.x;\n ivec2 xRCCorner = coords.yz * strides - pads;\n int d2 = coords.w;\n int d1 = d2;\n int q = 0;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n vec4 dotProd = vec4(0.);\n\n "+m+"\n\n vec4 result = dotProd;\n "+E+"\n "+x+"\n setOutput(result);\n }\n "},li=function(t,e,n,r,o){this.variableNames=["Image","Boxes","BoxInd"],this.outputShape=[];var i=t[0],a=t[1],s=t[2],u=t[3],c=e[0],l=n[0],f=n[1];this.outputShape=[c,l,f,u];var h="bilinear"===r?1:0,p=[a-1+".0",s-1+".0"],d=p[0],m=p[1],v=l>1?[""+(a-1)/(l-1),"(y2-y1) * height_ratio","y1*"+d+" + float(y)*(height_scale)"]:["0.0","0.0","0.5 * (y1+y2) * "+d],g=v[0],y=v[1],b=v[2],w=f>1?[""+(s-1)/(f-1),"(x2-x1) * width_ratio","x1*"+m+" + float(x)*(width_scale)"]:["0.0","0.0","0.5 * (x1+x2) * "+m],x=w[0],_=w[1],E=w[2];this.userCode="\n const float height_ratio = float("+g+");\n const float width_ratio = float("+x+");\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int y = coords[1];\n int x = coords[2];\n int d = coords[3];\n\n // get box vals\n float y1 = getBoxes(b,0);\n float x1 = getBoxes(b,1);\n float y2 = getBoxes(b,2);\n float x2 = getBoxes(b,3);\n\n // get image in batch index\n int bInd = round(getBoxInd(b));\n if(bInd < 0 || bInd >= "+i+") {\n return;\n }\n\n float height_scale = "+y+";\n float width_scale = "+_+";\n\n float in_y = "+b+";\n if( in_y < 0.0 || in_y > "+d+" ) {\n setOutput(float("+o+"));\n return;\n }\n float in_x = "+E+";\n if( in_x < 0.0 || in_x > "+m+" ) {\n setOutput(float("+o+"));\n return;\n }\n\n vec2 sourceFracIndexCR = vec2(in_x,in_y);\n if("+h+" == 1) {\n // Compute the four integer indices.\n ivec2 sourceFloorCR = ivec2(sourceFracIndexCR);\n ivec2 sourceCeilCR = ivec2(ceil(sourceFracIndexCR));\n\n float topLeft = getImage(b, sourceFloorCR.y, sourceFloorCR.x, d);\n float bottomLeft = getImage(b, sourceCeilCR.y, sourceFloorCR.x, d);\n float topRight = getImage(b, sourceFloorCR.y, sourceCeilCR.x, d);\n float bottomRight = getImage(b, sourceCeilCR.y, sourceCeilCR.x, d);\n\n vec2 fracCR = sourceFracIndexCR - vec2(sourceFloorCR);\n\n float top = topLeft + (topRight - topLeft) * fracCR.x;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracCR.x;\n float newValue = top + (bottom - top) * fracCR.y;\n setOutput(newValue);\n } else {\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestCR = ivec2(floor(\n sourceFracIndexCR + vec2(0.5,0.5)));\n float newValue = getImage(b, sourceNearestCR.y, sourceNearestCR.x, d);\n setOutput(newValue);\n }\n }\n "},fi=function(t,e,n){this.variableNames=["x"],this.outputShape=t;var r=t.length,o=t[t.length-1],i=n?"<":">";this.userCode="\n int getIndex(int i) {\n "+(n?"return "+o+" -i - 1;":"return i;")+"\n }\n\n void main() {\n "+Do(r)+" coords = getOutputCoords();\n int end = "+hi(r,"coords")+";\n float val = 0.0;\n for (int i = "+o+" - 1; i >= 0; i -= 1) {\n int idx = getIndex(i);\n if (idx "+i+" end) {\n continue;\n }\n if (idx == end && "+e+") {\n continue;\n }\n "+hi(r,"coords")+" = idx;\n val += getX("+function(t,e){if(1===t)return""+e;if(2===t)return e+".x, "+e+".y";if(3===t)return e+".x, "+e+".y, "+e+".z";if(4===t)return e+".x, "+e+".y, "+e+".z, "+e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}(r,"coords")+");\n }\n setOutput(val);\n }\n "};function hi(t,e){if(1===t)return""+e;if(2===t)return e+".y";if(3===t)return e+".z";if(4===t)return e+".w";throw Error("Cumulative sum for rank "+t+" is not yet supported")}var pi=function(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outPackingScheme=Ft.DENSE;var e=Gt(t),n=xo();this.outputShape=t,this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n "+_o(["r","c","d"],t)+"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = 4 * (resTexRC.x * "+e[1]+" + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getA(rc.x, rc.y, rc.z);\n }\n\n "+n.output+" = result;\n }\n "},di=function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outPackingScheme=Ft.DENSE;var e=Gt(t),n=xo();this.outputShape=t,this.userCode="\n ivec3 outCoordsFromFlatIndex(int index) {\n "+_o(["r","c","d"],t)+"\n return ivec3(r, c, d);\n }\n\n void main() {\n ivec2 resTexRC = ivec2(resultUV.yx *\n vec2("+e[0]+", "+e[1]+"));\n int index = 4 * (resTexRC.x * "+e[1]+" + resTexRC.y);\n\n vec4 result = vec4(0.);\n\n for (int i=0; i<4; i++) {\n int flatIndex = index + i;\n ivec3 rc = outCoordsFromFlatIndex(flatIndex);\n result[i] = getChannel(getA(rc.x, rc.y, rc.z), vec2(rc.y, rc.z));\n }\n\n "+n.output+" = result;\n }\n "},mi=function(){function t(t,e,n){this.variableNames=["x"],this.outputShape=[],this.outputShape=t,this.blockSize=e,this.dataFormat=n,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int h = "+this.getHeightCoordString()+";\n int w = "+this.getWidthCoordString()+";\n int d = "+this.getDepthCoordString()+";\n\n int in_h = h / "+e+";\n int offset_h = imod(h, "+e+");\n int in_w = w / "+e+";\n int offset_w = imod(w, "+e+");\n int offset_d = (offset_h * "+e+" + offset_w) *\n "+this.getOutputDepthSize()+";\n int in_d = d + offset_d;\n\n float result = "+this.getInputSamplingString()+";\n setOutput(result);\n }\n "}return t.prototype.getHeightCoordString=function(){return"NHWC"===this.dataFormat?"coords[1]":"coords[2]"},t.prototype.getWidthCoordString=function(){return"NHWC"===this.dataFormat?"coords[2]":"coords[3]"},t.prototype.getDepthCoordString=function(){return"NHWC"===this.dataFormat?"coords[3]":"coords[1]"},t.prototype.getOutputDepthSize=function(){return"NHWC"===this.dataFormat?this.outputShape[3]:this.outputShape[1]},t.prototype.getInputSamplingString=function(){return"NHWC"===this.dataFormat?"getX(b, in_h, in_w, in_d)":"getX(b, in_d, in_h, in_w)"},t}(),vi=function(t){this.variableNames=["X"],this.outputShape=[t,t],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n float val = coords[0] == coords[1] ? getX(coords[0]) : 0.0;\n setOutput(val);\n }\n "},gi=function(t){this.variableNames=["A"],this.outTexUsage=Bt.DOWNLOAD;var e=xo();this.outputShape=t,this.userCode="\n "+Co+"\n\n void main() {\n float x = getAAtOutCoords();\n "+e.output+" = encode_float(x);\n }\n "},yi=function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outTexUsage=Bt.DOWNLOAD;var e=xo();this.outputShape=t,this.userCode="\n "+Co+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n float x = getChannel(getAAtOutCoords(), vec2(coords.y, coords.z));\n "+e.output+" = encode_float(x);\n }\n "},bi=function(t,e,n){void 0===n&&(n=!1),this.variableNames=["A"];var r=xo(),o=e[0],i=e[1];this.outputShape=t;var a="result";n&&(a="floor(result * 255. + 0.5)"),this.userCode="\n "+Eo(t)+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n int flatIndex = getFlatIndex(coords);\n int offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n \n int r = flatIndex / "+i+";\n int c = imod(flatIndex, "+i+");\n vec2 uv = (vec2(c, r) + halfCR) / vec2("+i+".0, "+o+".0);\n vec4 values = "+r.texture2D+"(A, uv);\n\n float result;\n\n if(offset == 0) {\n result = values[0];\n } else if(offset == 1) {\n result = values[1];\n } else if(offset == 2) {\n result = values[2];\n } else {\n result = values[3];\n }\n\n "+r.output+" = vec4("+a+", 0., 0., 0.);\n }\n "},wi=function(t,e,n){void 0===n&&(n=!1),this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var r=xo(),o=e[0],i=e[1];this.outputShape=t;var a="",s="result";n&&(s="floor(result * 255. + 0.5)");for(var u=0;u<=1;u++)for(var c=0;c<=1;c++){var l=2*u+c;a+="\n localCoords = coords;\n if(localCoords[2] + "+c+" < "+t[2]+") {\n localCoords[2] += "+c+";\n if(localCoords[1] + "+u+" < "+t[1]+") {\n localCoords[1] += "+u+";\n\n flatIndex = getFlatIndex(localCoords);\n offset = imod(flatIndex, 4);\n\n flatIndex = idiv(flatIndex, 4, 1.);\n\n r = flatIndex / "+i+";\n c = imod(flatIndex, "+i+");\n uv = (vec2(c, r) + halfCR) / vec2("+i+".0, "+o+".0);\n values = "+r.texture2D+"(A, uv);\n\n if(offset == 0) {\n result["+l+"] = values[0];\n } else if(offset == 1) {\n result["+l+"] = values[1];\n } else if(offset == 2) {\n result["+l+"] = values[2];\n } else {\n result["+l+"] = values[3];\n }\n }\n }\n "}this.userCode="\n "+Eo(t)+"\n\n void main() {\n ivec3 coords = getOutputCoords();\n\n vec4 result = vec4(0.);\n int flatIndex, r, c, offset;\n ivec3 localCoords;\n vec2 uv;\n vec4 values;\n\n "+a+"\n\n "+r.output+" = "+s+";\n }\n "},xi=function(t,e,n){this.variableNames=["real","imag"];var r=e[1];this.outputShape=e;var o=n?"2.0 * "+Math.PI:"-2.0 * "+Math.PI,i=n?r+".0":"1.0";this.userCode="\n const float exponentMultiplier = "+o+";\n\n float unaryOpComplex(float real, float expR, float imag, float expI) {\n "+t+"\n }\n\n float mulMatDFT(int batch, int index) {\n float indexRatio = float(index) / float("+r+");\n float exponentMultiplierTimesIndexRatio =\n exponentMultiplier * indexRatio;\n\n float result = 0.0;\n\n for (int i = 0; i < "+r+"; i++) {\n // x = (-2|2 * PI / N) * index * i;\n float x = exponentMultiplierTimesIndexRatio * float(i);\n float expR = cos(x);\n float expI = sin(x);\n float real = getReal(batch, i);\n float imag = getImag(batch, i);\n\n result +=\n unaryOpComplex(real, expR, imag, expI) / "+i+";\n }\n\n return result;\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n setOutput(mulMatDFT(coords[0], coords[1]));\n }\n "},_i=function(){function t(t,e){this.outputShape=[],this.variableNames=["x"],this.outputShape=t,this.userCode="\n uniform float value;\n void main() {\n // Input can be obtained from uniform value.\n setOutput(value);\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,r){null==e.valueLoc&&(e.valueLoc=n.getUniformLocationNoThrow(r,"value")),n.gl.uniform1f(e.valueLoc,t)}},t}(),Ei=function(t,e,n){this.variableNames=["A","indices"];var r=t.slice();r[n]=e,this.outputShape=r,this.rank=r.length;var o=Do(this.rank),i=function(t,e){var n=t.length;if(n>4)throw Error("Gather for rank "+n+" is not yet supported");if(1===n)return"int(getIndices(resRC))";for(var r=["resRC.x","resRC.y","resRC.z","resRC.w"],o=[],i=0;i<t.length;i++)i===e?o.push("int(getIndices("+r[i]+"))"):o.push(""+r[i]);return o.join()}(t,n);this.userCode="\n void main() {\n "+o+" resRC = getOutputCoords();\n setOutput(getA("+i+"));\n }\n "},Ci=function(t,e,n){this.sliceDim=t,this.strides=e,this.variableNames=["x","indices"],this.outputShape=n;var r=Do(e.length),o=Do(n.length),i=this.sliceDim>1?"strides[j]":"strides";this.userCode="\n "+r+" strides = "+r+"("+this.strides+");\n void main() {\n "+o+" coords = getOutputCoords();\n int flattenIndex = 0;\n for (int j = 0; j < "+this.sliceDim+"; j++) {\n int index = round(getIndices(coords[0], j));\n flattenIndex += index * "+i+";\n }\n setOutput(getX(flattenIndex, coords[1]));\n }\n "};function Si(t,e){var n=xo();return Qt(t,e,n.version+"\n precision highp float;\n "+n.attribute+" vec3 clipSpacePos;\n "+n.attribute+" vec2 uv;\n "+n.varyingVs+" vec2 resultUV;\n\n void main() {\n gl_Position = vec4(clipSpacePos, 1);\n resultUV = uv;\n }")}function ki(t,e){return ae(t,e,new Float32Array([-1,1,0,0,1,-1,-1,0,0,0,1,1,0,1,1,1,-1,0,1,0]))}function Ti(t,e){return se(t,e,new Uint16Array([0,1,2,2,1,3]))}function Ii(t,e,n,r,o,i,a){ce(n,r);var s=ue(t,e),u=t.TEXTURE_2D;return Kt(t,e,(function(){return t.bindTexture(u,s)})),Kt(t,e,(function(){return t.texParameteri(u,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE)})),Kt(t,e,(function(){return t.texParameteri(u,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE)})),Kt(t,e,(function(){return t.texParameteri(u,t.TEXTURE_MIN_FILTER,t.NEAREST)})),Kt(t,e,(function(){return t.texParameteri(u,t.TEXTURE_MAG_FILTER,t.NEAREST)})),Kt(t,e,(function(){return t.texImage2D(u,0,o,n,r,0,i,a,null)})),Kt(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,null)})),s}function Oi(t,e,n,r,o){var i=qt(n,r);return Ii(t,e,i[0],i[1],o.internalFormatFloat,o.textureFormatFloat,t.FLOAT)}function Ri(t,e,n,r,o){var i=qt(n,r);return Ii(t,e,i[0],i[1],o.internalFormatHalfFloat,o.textureFormatFloat,o.textureTypeHalfFloat)}function Ai(t,e,n,r,o){var i=qt(n,r);return Ii(t,e,i[0],i[1],t.RGBA,t.RGBA,t.UNSIGNED_BYTE)}function Di(t,e,n,r,o){var i=Ht(n,r);return Ii(t,e,i[0],i[1],o.internalFormatPackedFloat,t.RGBA,t.FLOAT)}function Ni(t,e,n,r,o){var i=Ht(n,r);return Ii(t,e,i[0],i[1],o.internalFormatPackedHalfFloat,t.RGBA,o.textureTypeHalfFloat)}function Pi(t,e,n,r){return Kt(t,e,(function(){return t.bindBuffer(t.ARRAY_BUFFER,r)})),fe(t,e,n,"clipSpacePos",r,3,20,0)&&fe(t,e,n,"uv",r,2,20,12)}function Mi(t,e,n,r,o,i,a){var s,u,c;Kt(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,n)})),i instanceof Uint8Array?(s=new Uint8Array(r*o*4),u=t.UNSIGNED_BYTE,c=t.RGBA):(s=new Float32Array(r*o*4),u=t.FLOAT,c=a.internalFormatPackedFloat),s.set(i),Kt(t,e,(function(){return t.texImage2D(t.TEXTURE_2D,0,c,r,o,0,t.RGBA,u,s)})),Kt(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,null)}))}function ji(t,e,n,r){Kt(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,n)})),r.data instanceof Uint8Array?Kt(t,e,(function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,r.width,r.height,0,t.RGBA,t.UNSIGNED_BYTE,r.data)})):Kt(t,e,(function(){return t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,r)})),Kt(t,e,(function(){return t.bindTexture(t.TEXTURE_2D,null)}))}function Fi(t,e,n,r,o){var i=t.createBuffer();Kt(t,e,(function(){return t.bindBuffer(t.PIXEL_PACK_BUFFER,i)}));var a=16*n*r;return Kt(t,e,(function(){return t.bufferData(t.PIXEL_PACK_BUFFER,a,t.STREAM_READ)})),Kt(t,e,(function(){return t.readPixels(0,0,r,n,t.RGBA,t.FLOAT,0)})),Kt(t,e,(function(){return t.bindBuffer(t.PIXEL_PACK_BUFFER,null)})),i}function Bi(t,e,n){var r=t,o=new Float32Array(n);return r.bindBuffer(r.PIXEL_PACK_BUFFER,e),r.getBufferSubData(r.PIXEL_PACK_BUFFER,0,o),r.bindBuffer(r.PIXEL_PACK_BUFFER,null),o}function Li(t,e,n,r,o){var i=qt(n,r),a=i[0],s=i[1],u=new Uint8Array(n*r*4);return Kt(t,e,(function(){return t.readPixels(0,0,a,s,o.downloadTextureFormat,t.UNSIGNED_BYTE,u)})),new Float32Array(u.buffer)}function Ui(t,e,n,r,o,i,a,s){var u=t,c=new Float32Array(function(t,e){var n=Ht(t,e);return n[0]*n[1]*4}(i,a));return u.bindBuffer(u.PIXEL_PACK_BUFFER,e),u.getBufferSubData(u.PIXEL_PACK_BUFFER,0,c),u.bindBuffer(u.PIXEL_PACK_BUFFER,null),c}function Wi(t,e,n,r){var o=new Float32Array(n*r*4);return Kt(t,e,(function(){return t.readPixels(0,0,r,n,t.RGBA,t.FLOAT,o)})),o}var zi=Object.freeze({createVertexShader:Si,createVertexBuffer:ki,createIndexBuffer:Ti,createFloat32MatrixTexture:Oi,createFloat16MatrixTexture:Ri,createUnsignedBytesMatrixTexture:Ai,createPackedMatrixTexture:Di,createFloat16PackedMatrixTexture:Ni,bindVertexProgramAttributeStreams:Pi,uploadDenseMatrixToTexture:Mi,uploadPixelDataToTexture:ji,createBufferFromOutputTexture:Fi,downloadFloat32MatrixFromBuffer:Bi,downloadByteEncodedFloatMatrixFromOutputTexture:Li,downloadPackedMatrixFromBuffer:Ui,downloadMatrixFromPackedOutputTexture:Wi}),Vi=function(){function t(t){this.outputTexture=null,this.program=null,this.disposed=!1,this.vertexAttrsAreBound=!1,this.itemsToPoll=[];var e=f().getNumber("WEBGL_VERSION");null!=t?(this.gl=t,zt(e,t)):this.gl=Vt(e);var n="WEBGL_color_buffer_float";if(1===f().getNumber("WEBGL_VERSION")){if(this.textureFloatExtension=Jt(this.gl,this.debug,"OES_texture_float"),Ae(this.gl,"OES_texture_half_float"))this.textureHalfFloatExtension=Jt(this.gl,this.debug,"OES_texture_half_float");else if(f().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support half float textures, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.");if(this.colorBufferFloatExtension=this.gl.getExtension(n),Ae(this.gl,"EXT_color_buffer_half_float"))this.colorBufferHalfFloatExtension=Jt(this.gl,this.debug,"EXT_color_buffer_half_float");else if(f().get("WEBGL_FORCE_F16_TEXTURES"))throw new Error("GL context does not support color renderable half floats, yet the environment flag WEBGL_FORCE_F16_TEXTURES is set to true.")}else if(n="EXT_color_buffer_float",Ae(this.gl,n))this.colorBufferFloatExtension=this.gl.getExtension(n);else{if(!Ae(this.gl,"EXT_color_buffer_half_float"))throw new Error("GL context does not support color renderable floats");this.colorBufferHalfFloatExtension=this.gl.getExtension("EXT_color_buffer_half_float")}this.vertexBuffer=ki(this.gl,this.debug),this.indexBuffer=Ti(this.gl,this.debug),this.framebuffer=le(this.gl,this.debug),this.textureConfig=Xt(this.gl,this.textureHalfFloatExtension)}return Object.defineProperty(t.prototype,"debug",{get:function(){return f().getBool("DEBUG")},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){var t=this;if(!this.disposed){null!=this.program&&console.warn("Disposing a GPGPUContext that still has a bound WebGLProgram. This is probably a resource leak, delete the program with GPGPUContext.deleteProgram before disposing."),null!=this.outputTexture&&console.warn("Disposing a GPGPUContext that still has a bound output matrix texture. This is probably a resource leak, delete the output matrix texture with GPGPUContext.deleteMatrixTexture before disposing.");var e=this.gl;Kt(e,this.debug,(function(){return e.finish()})),Kt(e,this.debug,(function(){return e.bindFramebuffer(e.FRAMEBUFFER,null)})),Kt(e,this.debug,(function(){return e.deleteFramebuffer(t.framebuffer)})),Kt(e,this.debug,(function(){return e.bindBuffer(e.ARRAY_BUFFER,null)})),Kt(e,this.debug,(function(){return e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,null)})),Kt(e,this.debug,(function(){return e.deleteBuffer(t.indexBuffer)})),this.disposed=!0}},t.prototype.createFloat32MatrixTexture=function(t,e){return this.throwIfDisposed(),Oi(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createFloat16MatrixTexture=function(t,e){return this.throwIfDisposed(),Ri(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createUnsignedBytesMatrixTexture=function(t,e){return this.throwIfDisposed(),Ai(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.uploadPixelDataToTexture=function(t,e){this.throwIfDisposed(),ji(this.gl,this.debug,t,e)},t.prototype.uploadDenseMatrixToTexture=function(t,e,n,r){this.throwIfDisposed(),Mi(this.gl,this.debug,t,e,n,r,this.textureConfig)},t.prototype.createFloat16PackedMatrixTexture=function(t,e){return this.throwIfDisposed(),Ni(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.createPackedMatrixTexture=function(t,e){return this.throwIfDisposed(),Di(this.gl,this.debug,t,e,this.textureConfig)},t.prototype.deleteMatrixTexture=function(t){var e=this;this.throwIfDisposed(),this.outputTexture===t&&(ge(this.gl,this.debug,this.framebuffer),this.outputTexture=null),Kt(this.gl,this.debug,(function(){return e.gl.deleteTexture(t)}))},t.prototype.downloadByteEncodedFloatMatrixFromOutputTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,(function(){return Li(r.gl,r.debug,e,n,r.textureConfig)}))},t.prototype.downloadPackedMatrixFromBuffer=function(t,e,n,r,o,i){return Ui(this.gl,t,0,0,0,o,i,this.textureConfig)},t.prototype.downloadFloat32MatrixFromBuffer=function(t,e){return Bi(this.gl,t,e)},t.prototype.createBufferFromTexture=function(t,e,n){this.bindTextureToFrameBuffer(t);var r=Fi(this.gl,this.debug,e,n,this.textureConfig);return this.unbindTextureToFrameBuffer(),r},t.prototype.createAndWaitForFence=function(){var t=this.createFence(this.gl);return this.pollFence(t)},t.prototype.createFence=function(t){var e,n,r=this;if(f().getBool("WEBGL_FENCE_API_ENABLED")){var o=t,i=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);t.flush(),n=function(){var t=o.clientWaitSync(i,0,0);return t===o.ALREADY_SIGNALED||t===o.CONDITION_SATISFIED},e=i}else f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")>0?(e=this.beginQuery(),this.endQuery(),n=function(){return r.isQueryAvailable(e,f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}):n=function(){return!0};return{query:e,isFencePassed:n}},t.prototype.downloadMatrixFromPackedTexture=function(t,e,n){var r=this;return this.downloadMatrixDriver(t,(function(){return Wi(r.gl,r.debug,e,n)}))},t.prototype.createProgram=function(t){this.throwIfDisposed();var e=this.gl,n=Zt(e,this.debug,t),r=Si(e,this.debug),o=re(e,this.debug);return Kt(e,this.debug,(function(){return e.attachShader(o,r)})),Kt(e,this.debug,(function(){return e.attachShader(o,n)})),oe(e,this.debug,o),this.debug&&ie(e,this.debug,o),this.vertexAttrsAreBound||(this.setProgram(o),this.vertexAttrsAreBound=Pi(e,this.debug,this.program,this.vertexBuffer)),o},t.prototype.deleteProgram=function(t){var e=this;this.throwIfDisposed(),t===this.program&&(this.program=null),null!=t&&Kt(this.gl,this.debug,(function(){return e.gl.deleteProgram(t)}))},t.prototype.setProgram=function(t){var e=this;this.throwIfDisposed(),this.program=t,null!=this.program&&this.debug&&ie(this.gl,this.debug,this.program),Kt(this.gl,this.debug,(function(){return e.gl.useProgram(t)}))},t.prototype.getUniformLocation=function(t,e,n){return void 0===n&&(n=!0),this.throwIfDisposed(),n?pe(this.gl,this.debug,t,e):de(this.gl,t,e)},t.prototype.getAttributeLocation=function(t,e){var n=this;return this.throwIfDisposed(),Kt(this.gl,this.debug,(function(){return n.gl.getAttribLocation(t,e)}))},t.prototype.getUniformLocationNoThrow=function(t,e){return this.throwIfDisposed(),this.gl.getUniformLocation(t,e)},t.prototype.setInputMatrixTexture=function(t,e,n){this.throwIfDisposed(),this.throwIfNoProgram(),me(this.gl,this.debug,this.program,t,e,n)},t.prototype.setOutputMatrixTexture=function(t,e,n){this.setOutputMatrixTextureDriver(t,n,e)},t.prototype.setOutputPackedMatrixTexture=function(t,e,n){this.throwIfDisposed();var r=Ht(e,n),o=r[0],i=r[1];this.setOutputMatrixTextureDriver(t,o,i)},t.prototype.setOutputMatrixWriteRegion=function(t,e,n,r){this.setOutputMatrixWriteRegionDriver(n,t,r,e)},t.prototype.setOutputPackedMatrixWriteRegion=function(t,e,n,r){throw new Error("setOutputPackedMatrixWriteRegion not implemented.")},t.prototype.debugValidate=function(){null!=this.program&&ie(this.gl,this.debug,this.program),ye(this.gl)},t.prototype.executeProgram=function(){this.throwIfDisposed(),this.throwIfNoProgram();var t=this.gl;this.debug&&this.debugValidate(),Kt(t,this.debug,(function(){return t.drawElements(t.TRIANGLES,6,t.UNSIGNED_SHORT,0)}))},t.prototype.blockUntilAllProgramsCompleted=function(){var t=this;this.throwIfDisposed(),Kt(this.gl,this.debug,(function(){return t.gl.finish()}))},t.prototype.getQueryTimerExtension=function(){return null==this.disjointQueryTimerExtension&&(this.disjointQueryTimerExtension=Jt(this.gl,this.debug,2===f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")?"EXT_disjoint_timer_query_webgl2":"EXT_disjoint_timer_query")),this.disjointQueryTimerExtension},t.prototype.getQueryTimerExtensionWebGL2=function(){return this.getQueryTimerExtension()},t.prototype.getQueryTimerExtensionWebGL1=function(){return this.getQueryTimerExtension()},t.prototype.beginQuery=function(){if(2===f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.gl,e=this.getQueryTimerExtensionWebGL2(),n=t.createQuery();return t.beginQuery(e.TIME_ELAPSED_EXT,n),n}var r=this.getQueryTimerExtensionWebGL1(),o=r.createQueryEXT();return r.beginQueryEXT(r.TIME_ELAPSED_EXT,o),o},t.prototype.endQuery=function(){if(2!==f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION")){var t=this.getQueryTimerExtensionWebGL1();t.endQueryEXT(t.TIME_ELAPSED_EXT)}else{var e=this.gl,n=this.getQueryTimerExtensionWebGL2();e.endQuery(n.TIME_ELAPSED_EXT)}},t.prototype.waitForQueryAndGetTime=function(t){return s(this,void 0,void 0,(function(){var e=this;return u(this,(function(n){switch(n.label){case 0:return[4,P((function(){return e.disposed||e.isQueryAvailable(t,f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))}))];case 1:return n.sent(),[2,this.getQueryTime(t,f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_VERSION"))]}}))}))},t.prototype.getQueryTime=function(t,e){if(0===e)return null;if(2===e){var n=this.gl;return n.getQueryParameter(t,n.QUERY_RESULT)/1e6}var r=this.getQueryTimerExtensionWebGL1();return r.getQueryObjectEXT(t,r.QUERY_RESULT_EXT)/1e6},t.prototype.isQueryAvailable=function(t,e){if(0===e)return!0;if(2===e){var n=this.gl,r=this.getQueryTimerExtensionWebGL2(),o=n.getQueryParameter(t,n.QUERY_RESULT_AVAILABLE);return null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),o&&!this.disjoint}return o=(r=this.getQueryTimerExtensionWebGL1()).getQueryObjectEXT(t,r.QUERY_RESULT_AVAILABLE_EXT),null==this.disjoint&&(this.disjoint=this.gl.getParameter(r.GPU_DISJOINT_EXT)),o&&!this.disjoint},t.prototype.pollFence=function(t){var e=this;return new Promise((function(n){e.addItemToPoll((function(){return t.isFencePassed()}),(function(){return n()}))}))},t.prototype.pollItems=function(){for(var t=function(t){for(var e=0;e<t.length&&t[e]();++e);return e-1}(this.itemsToPoll.map((function(t){return t.isDoneFn}))),e=0;e<=t;++e)(0,this.itemsToPoll[e].resolveFn)();this.itemsToPoll=this.itemsToPoll.slice(t+1)},t.prototype.addItemToPoll=function(t,e){var n=this;this.itemsToPoll.push({isDoneFn:t,resolveFn:e}),this.itemsToPoll.length>1||P((function(){return n.pollItems(),0===n.itemsToPoll.length}))},t.prototype.bindTextureToFrameBuffer=function(t){this.throwIfDisposed(),ve(this.gl,this.debug,t,this.framebuffer),this.debug&&ye(this.gl)},t.prototype.unbindTextureToFrameBuffer=function(){null!=this.outputTexture?(ve(this.gl,this.debug,this.outputTexture,this.framebuffer),this.debug&&ye(this.gl)):ge(this.gl,this.debug,this.framebuffer)},t.prototype.downloadMatrixDriver=function(t,e){this.bindTextureToFrameBuffer(t);var n=e();return this.unbindTextureToFrameBuffer(),n},t.prototype.setOutputMatrixTextureDriver=function(t,e,n){this.throwIfDisposed();var r=this.gl;ve(r,this.debug,t,this.framebuffer),this.debug&&ye(r),this.outputTexture=t,Kt(r,this.debug,(function(){return r.viewport(0,0,e,n)})),Kt(r,this.debug,(function(){return r.scissor(0,0,e,n)}))},t.prototype.setOutputMatrixWriteRegionDriver=function(t,e,n,r){var o=this;this.throwIfDisposed(),Kt(this.gl,this.debug,(function(){return o.gl.scissor(t,e,n,r)}))},t.prototype.throwIfDisposed=function(){if(this.disposed)throw new Error("Attempted to use disposed GPGPUContext.")},t.prototype.throwIfNoProgram=function(){if(null==this.program)throw new Error("No GPU program is currently set.")},t}();function qi(t,e){if(t.length!==e.length)throw Error("Binary was compiled with "+t.length+" inputs, but was executed with "+e.length+" inputs");t.forEach((function(t,n){var r=t.logicalShape,o=e[n],i=o.shape;if(!O(r,i))throw Error("Binary was compiled with different shapes than the current args. Shapes "+r+" and "+i+" must match");if(!t.isUniform||!o.isUniform){var a=t.texShape,s=o.isUniform?null:o.texData.texShape;if(!O(a,s))throw Error("Binary was compiled with different texture shapes than the current args. Shape "+a+" and "+s+" must match")}}))}var Gi=function(t,e,n){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t;for(var r=n.filterWidth,o=n.inChannels,i=n.strideWidth,a=n.strideHeight,s=n.padInfo,u=n.outWidth,c=n.dilationWidth,l=n.dilationHeight,f=n.dataFormat,h=s.left,p=s.top,d=o*r,m=xo(),v="channelsLast"===f,g=v?0:1,y=v?1:2,b="",w=0;w<=1;w++)for(var x=0;x<=1;x++)b+="\n blockIndex = rc.y + "+x+";\n pos = rc.x + "+w+";\n\n if(blockIndex < "+t[1]+" && pos < "+t[0]+") {\n offsetY = int(blockIndex / ("+u+")) * "+a+" - "+p+";\n d0 = offsetY + "+l+" * (pos / "+d+");\n\n if(d0 < "+e[g]+" && d0 >= 0) {\n\n offsetX = int(mod(float(blockIndex), "+u+".) * "+i+". - "+h+".);\n d1 = offsetX + "+c+" * (int(mod(float(pos), "+d+".) / "+o+".));\n\n if(d1 < "+e[y]+" && d1 >= 0) {\n\n ch = int(mod(float(pos), "+o+".));\n\n if ("+v+") {\n innerDims = vec2(d1, ch);\n result["+(2*w+x)+"] = getChannel(\n getA(d0, int(innerDims.x),\n int(innerDims.y)), innerDims);\n } else {\n innerDims = vec2(d0, d1);\n result["+(2*w+x)+"] = getChannel(\n getA(ch, int(innerDims.x),\n int(innerDims.y)), innerDims);\n }\n }\n }\n }\n ";this.userCode="\n void main() {\n ivec2 rc = getOutputCoords();\n\n vec4 result = vec4(0);\n\n int blockIndex, pos, offsetY, d0, offsetX, d1, ch;\n vec2 innerDims;\n\n "+b+"\n\n "+m.output+" = result;\n }\n "},Hi=function(t,e,n,r,o){this.variableNames=["x"],this.outputShape=[];var i,a=e,s=t[3]-1;this.outputShape=t;var u="float("+n+") + float("+r+") * sum";i=.5===o?"inversesqrt("+u+")":1===o?"1.0/("+u+")":"exp(log("+u+") * float(-"+o+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n int d = coords[3];\n float x = getX(b, r, c, d);\n float sum = 0.0;\n for (int j = -"+a+"; j <= "+a+"; j++) {\n int idx = d + j;\n if (idx >= 0 && idx <= "+s+") {\n float z = getX(b, r, c, idx);\n sum += z * z;\n }\n }\n float val = x * "+i+";\n setOutput(val);\n }\n "},Xi=function(t,e,n,r,o){this.variableNames=["inputImage","outputImage","dy"],this.outputShape=[],this.outputShape=t,this.depth=t[3],this.depthRadius=e,this.bias=n,this.alpha=r,this.beta=o,this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int r = coords[1];\n int c = coords[2];\n\n float result = 0.0;\n for (int d = 0; d < "+this.depth+"; ++d) {\n int depthBegin = int(max(0.0, float(d - "+e+")));\n int depthEnd = int(min(float("+this.depth+"),\n float(d + "+e+" + 1)));\n\n const int MIN_DEPTH_BEGIN = 0;\n const int MAX_DEPTH_END = "+this.depth+";\n\n float norm = 0.0;\n for (int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k) {\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd) {\n norm += getInputImage(b, r, c, k) * getInputImage(b, r, c, k);\n }\n else {\n break;\n }\n }\n\n norm = float("+r+") * norm + float("+n+");\n\n for(int k = MIN_DEPTH_BEGIN; k < MAX_DEPTH_END; ++k){\n if (k < depthBegin){\n continue;\n }\n else if (k >= depthBegin && k < depthEnd){\n float dyi = -2.0 * float("+r+")\n * float("+o+")\n * getInputImage(b ,r ,c, k) * getOutputImage(b, r, c, d)\n / norm;\n if (k == d) {\n dyi += pow(norm, -1.0 * "+o+");\n }\n if (k == coords[3]) {\n dyi *= getDy(b, r, c, d);\n result += dyi;\n }\n }\n else {\n break;\n }\n }\n }\n setOutput(result);\n }\n "},Ki=function(t,e,n,r,o){this.variableNames=["x"],this.outputShape=[],this.packedInputs=!0,this.packedOutput=!0;var i,a=e,s=t[3]-1;this.outputShape=t;var u="float("+n+") + float("+r+") * sum";i=.5===o?"inversesqrt("+u+")":1===o?"1.0/("+u+")":"exp(log("+u+") * float(-"+o+"));",this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords.x;\n int r = coords.y;\n int c = coords.z;\n int d = coords.w;\n\n bool hasNextCol = d < "+this.outputShape[3]+";\n bool hasNextRow = c < "+this.outputShape[2]+";\n\n vec4 sum = vec4(0.);\n vec4 xFragAtOutputCoords = getX(b, r, c, d);\n\n vec4 xAtOutputCoords = vec4(\n getChannel(xFragAtOutputCoords, vec2(c, d)),\n hasNextCol ?\n getChannel(xFragAtOutputCoords, vec2(c, d + 1)) : 0.0,\n hasNextRow ?\n getChannel(xFragAtOutputCoords , vec2(c + 1, d)) : 0.0,\n (hasNextRow && hasNextCol) ?\n getChannel(xFragAtOutputCoords, vec2(c + 1, d + 1)) : 0.0\n );\n\n int firstChannel = d - "+a+";\n vec2 cache = vec2(0.);\n if(firstChannel >= 0){\n vec4 firstChannelFrag = getX(b, r, c, firstChannel);\n cache.x = getChannel(firstChannelFrag, vec2(c, firstChannel));\n if(hasNextRow){\n cache.y = getChannel(firstChannelFrag, vec2(c + 1, firstChannel));\n }\n }\n\n ivec2 depth = ivec2(d, d + 1);\n for (int j = - "+a+"; j <= "+a+"; j++) {\n ivec2 idx = depth + j;\n bvec2 aboveLowerBound = greaterThanEqual(idx, ivec2(0));\n bvec2 belowUpperBound = lessThanEqual(idx, ivec2("+s+"));\n\n bool depthInRange = aboveLowerBound.x && belowUpperBound.x;\n bool depthPlusOneInRange = aboveLowerBound.y && belowUpperBound.y;\n\n if(depthInRange || depthPlusOneInRange){\n vec4 z = vec4(0.);\n vec4 xFragAtCurrentDepth;\n z.xz = cache.xy;\n if(depthPlusOneInRange && hasNextCol){\n xFragAtCurrentDepth = idx.y != d ?\n getX(b, r, c, idx.y) : xFragAtOutputCoords;\n z.y = getChannel(xFragAtCurrentDepth, vec2(c, idx.y));\n if(hasNextRow){\n z.w = getChannel(xFragAtCurrentDepth, vec2(c + 1, idx.y));\n }\n }\n cache.xy = z.yw;\n sum += z * z;\n }\n }\n vec4 result = xAtOutputCoords * "+i+";\n setOutput(result);\n }\n "},Yi=function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideHeight,n=t.strideWidth,r=t.dilationHeight,o=t.effectiveFilterHeight,i=t.effectiveFilterWidth,a=o-1-t.padInfo.top,s=i-1-t.padInfo.left,u=o*i-1;this.userCode="\n const ivec2 pads = ivec2("+a+", "+s+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n\n ivec2 dyRCCorner = coords.yz - pads;\n int dyRCorner = dyRCCorner.x;\n int dyCCorner = dyRCCorner.y;\n\n // Convolve dy(?, ?, d) with pos mask(:, :, d) to get dx(xR, xC, d).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n for (int wR = 0; wR < "+o+";\n wR += "+r+") {\n float dyR = float(dyRCorner + wR) / "+e+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 || fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+i+"; wC++) {\n float dyC = float(dyCCorner + wC) / "+n+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(b, idyR, idyC, d);\n int maxPosValue = "+u+" - int(getMaxPos(b, idyR, idyC, d));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue = wR * "+i+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n setOutput(dotProd);\n }\n "},$i=function(t){this.variableNames=["dy","maxPos"],this.outputShape=t.inShape;var e=t.strideDepth,n=t.strideHeight,r=t.strideWidth,o=t.dilationDepth,i=t.dilationHeight,a=t.dilationWidth,s=t.effectiveFilterDepth,u=t.effectiveFilterHeight,c=t.effectiveFilterWidth,l=s-1-t.padInfo.front,f=u-1-t.padInfo.top,h=c-1-t.padInfo.left,p=s*u*c-1;this.userCode="\n const ivec3 pads = ivec3("+l+", "+f+", "+h+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 dyCorner = ivec3(coords.y, coords.z, coords.w) - pads;\n int dyDCorner = dyCorner.x;\n int dyRCorner = dyCorner.y;\n int dyCCorner = dyCorner.z;\n\n // Convolve dy(?, ?, ?, ch) with pos mask(:, :, :, d) to get\n // dx(xD, xR, xC, ch).\n // ? = to be determined. : = across all values in that axis.\n float dotProd = 0.0;\n\n for (int wD = 0; wD < "+s+";\n wD += "+o+") {\n float dyD = float(dyDCorner + wD) / "+e+".0;\n\n if (dyD < 0.0 || dyD >= "+t.outDepth+".0 || fract(dyD) > 0.0) {\n continue;\n }\n int idyD = int(dyD);\n\n for (int wR = 0; wR < "+u+";\n wR += "+i+") {\n float dyR = float(dyRCorner + wR) / "+n+".0;\n\n if (dyR < 0.0 || dyR >= "+t.outHeight+".0 ||\n fract(dyR) > 0.0) {\n continue;\n }\n int idyR = int(dyR);\n\n for (int wC = 0; wC < "+c+";\n wC += "+a+") {\n float dyC = float(dyCCorner + wC) / "+r+".0;\n\n if (dyC < 0.0 || dyC >= "+t.outWidth+".0 ||\n fract(dyC) > 0.0) {\n continue;\n }\n int idyC = int(dyC);\n\n float dyValue = getDy(batch, idyD, idyR, idyC, ch);\n int maxPosValue = "+p+" -\n int(getMaxPos(batch, idyD, idyR, idyC, ch));\n\n // Get the current value, check it against the value from the\n // position matrix.\n int curPosValue =\n wD * "+u+" * "+c+" +\n wR * "+c+" + wC;\n float mask = float(maxPosValue == curPosValue ? 1.0 : 0.0);\n\n dotProd += dyValue * mask;\n }\n }\n }\n setOutput(dotProd);\n }\n "},Ji=function(t,e,n,r,o,i,a){void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===i&&(i=null),void 0===a&&(a=!1),this.variableNames=["matrixA","matrixB"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e;var s=n?t[1]:t[2],u=Math.ceil(s/2),c=n?"i * 2, rc.y":"rc.y, i * 2",l=r?"rc.z, i * 2":"i * 2, rc.z",f=n?["a.xxyy","a.zzww"]:["a.xxzz","a.yyww"],h=r?["b.xzxz","b.ywyw"]:["b.xyxy","b.zwzw"],p="",d="";i&&(p=a?"vec4 activation(vec4 a) {\n vec4 b = getPreluActivationWeightsAtOutCoords();\n "+i+"\n }":"vec4 activation(vec4 x) {\n "+i+"\n }",d="result = activation(result);");var m=o?"result += getBiasAtOutCoords();":"";o&&this.variableNames.push("bias"),a&&this.variableNames.push("preluActivationWeights"),this.userCode="\n "+p+"\n\n const float sharedDimension = "+u+".0;\n\n vec4 dot2x2ARowBCol(ivec3 rc) {\n vec4 result = vec4(0);\n for (int i = 0; i < "+u+"; i++) {\n vec4 a = getMatrixA(rc.x, "+c+");\n vec4 b = getMatrixB(rc.x, "+l+");\n\n // These swizzled products need to be separately added.\n // See: https://github.com/tensorflow/tfjs/issues/1735\n result += ("+f[0]+" * "+h[0]+");\n result += ("+f[1]+" * "+h[1]+");\n }\n return result;\n }\n\n void main() {\n ivec3 rc = getOutputCoords();\n vec4 result = dot2x2ARowBCol(rc);\n\n "+m+"\n\n "+d+"\n\n setOutput(result);\n }\n "},Qi=function(){function t(t,e,n){this.variableNames=["probs"],this.outputShape=[t,n],this.userCode="\n uniform float seed;\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n\n float r = random(seed);\n float cdf = 0.0;\n\n for (int i = 0; i < "+(e-1)+"; i++) {\n cdf += getProbs(batch, i);\n\n if (r < cdf) {\n setOutput(float(i));\n return;\n }\n }\n\n // If no other event happened, last event happened.\n setOutput(float("+(e-1)+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;return function(n,r){null==e.seedLoc&&(e.seedLoc=n.getUniformLocation(r,"seed")),n.gl.uniform1f(e.seedLoc,t)}},t}(),Zi=function(t,e,n,r){this.variableNames=["indices"],this.outputShape=[t,e],this.userCode="\n void main() {\n ivec2 coords = getOutputCoords();\n int index = round(getIndices(coords.x));\n setOutput(mix(float("+r+"), float("+n+"),\n float(index == coords.y)));\n }\n "},ta=function(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0,this.outputShape=t;var e=t.length;if(0===e)this.userCode="\n void main() {\n setOutput(vec4(getA(), 0., 0., 0.));\n }\n ";else{var n=wo("rc",e),r=Do(e),o=function(t,e,n){if(1===t)return"rc > "+e[0];for(var r="",o=t-2;o<t;o++)r+=n[o]+" >= "+e[o],o<t-1&&(r+="||");return r}(e,t,n),i=function(t,e,n,r){if(1===t)return"";var o=r.slice(-2);return"\n int r = "+o[0]+";\n int c = "+o[1]+";\n int rp1 = r + 1;\n int cp1 = c + 1;\n\n bool cEdge = cp1 >= "+e+";\n bool rEdge = rp1 >= "+n+";\n "}(e,t[t.length-1],t[t.length-2],n),a=function(t,e){var n=t.length,r=function(t,e){for(var n=[],r=0;r<=1;r++)for(var o=0;o<=1;o++){for(var i=(0===r?"r":"rp1")+", "+(0===o?"c":"cp1"),a=2;a<t;a++)i=e[e.length-1-a]+","+i;n.push(i)}return n}(n,e);return 1===n?"getA(rc),\n rc + 1 >= "+t[0]+" ? 0. : getA(rc + 1),\n 0, 0":"getA("+r[0]+"),\n cEdge ? 0. : getA("+r[1]+"),\n rEdge ? 0. : getA("+r[2]+"),\n rEdge || cEdge ? 0. : getA("+r[3]+")"}(t,n);this.userCode="\n void main() {\n "+r+" rc = getOutputCoords();\n\n if("+o+") {\n setOutput(vec4(0));\n } else {\n "+i+"\n\n setOutput(vec4("+a+"));\n }\n }\n "}},ea=function(t,e,n){this.variableNames=["x"],this.outputShape=e.map((function(e,n){return e[0]+t[n]+e[1]}));var r=t.length,o=Do(r),i=e.map((function(t){return t[0]})).join(","),a=e.map((function(e,n){return e[0]+t[n]})).join(","),s=["coords[0]","coords[1]","coords[2]","coords[3]"].slice(0,r);this.userCode=1!==r?"\n "+o+" start = "+o+"("+i+");\n "+o+" end = "+o+"("+a+");\n\n void main() {\n "+o+" outC = getOutputCoords();\n if (any(lessThan(outC, start)) || any(greaterThanEqual(outC, end))) {\n setOutput(float("+n+"));\n } else {\n "+o+" coords = outC - start;\n setOutput(getX("+s+"));\n }\n }\n ":"\n int start = "+i+";\n int end = "+a+";\n\n void main() {\n int outC = getOutputCoords();\n if (outC < start || outC >= end) {\n setOutput(float("+n+"));\n } else {\n setOutput(getX(outC - start));\n }\n }\n "},na=function(t,e,n){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=e.map((function(e,n){return e[0]+t[n]+e[1]}));for(var r=t.length,o=Do(r),i=e.map((function(t){return t[0]})).join(","),a=e.map((function(e,n){return e[0]+t[n]})).join(","),s=wo("rc",r),u=wo("source",r),c=s[r-1]+" < "+this.outputShape[r-1],l=1===r?"source":"vec2("+u.slice(-2).join()+")",f=[o+" rc = outputLoc;",s[r-1]+" += 1;\n if("+c+") {\n ",1===r?"":"}\n rc = outputLoc;\n "+s[r-2]+" += 1;\n if("+s[r-2]+" < "+this.outputShape[r-2]+") {",1===r?"":" "+s[r-1]+" += 1;\n if("+c+") {"],h=1===r?"rc < start || rc >= end":"any(lessThan(rc, start)) || any(greaterThanEqual(rc, end))",p="",d=0,m=1===r?2:4;d<m;d++)p+="\n "+f[d]+"\n if ("+h+") {\n result["+d+"] = float("+n+");\n } else {\n "+o+" source = rc - start;\n result["+d+"] = getChannel(getX("+u.join()+"), "+l+");\n }\n ";p+=1===r?"} ":"}}",this.userCode="\n const "+o+" start = "+o+"("+i+");\n const "+o+" end = "+o+"("+a+");\n\n void main() {\n "+o+" outputLoc = getOutputCoords();\n vec4 result = vec4(0.);\n "+p+"\n setOutput(result);\n }\n "},ra=function(t,e,n){if(this.variableNames=["x"],"avg"===e&&n)throw new Error("Cannot compute positions for average pool.");var r=t.filterWidth,o=t.strideHeight,i=t.strideWidth,a=t.dilationHeight,s=t.dilationWidth,u=t.effectiveFilterHeight,c=t.effectiveFilterWidth,l=t.padInfo.top,f=t.padInfo.left;this.outputShape=t.outShape;var h="avg"===e,p="0.0";if(h||(p="-1.0 / 1e-20"),n)this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+l+", "+f+");\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n float avgValue = 0.0;\n\n for (int wR = 0; wR < "+u+";\n wR += "+a+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+c+";\n wC += "+s+") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xR, xC, d);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition = wR * "+c+" + wC;\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var d=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(d="avgValue / count");var m=4*Math.floor(r/4),v=r%4,g="\n if ("+h+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec2 strides = ivec2("+o+", "+i+");\n const ivec2 pads = ivec2("+l+", "+f+");\n const float initializationValue = "+p+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xR, int xC, int d) {\n if (xC < 0 || xC >= "+t.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xR, xC, d);\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int batch = coords[0];\n int d = coords[3];\n\n ivec2 xRCCorner = coords.yz * strides - pads;\n int xRCorner = xRCCorner.x;\n int xCCorner = xRCCorner.y;\n\n // max/min x(?, ?, d) to get y(yR, yC, d).\n // ? = to be determined\n vec4 minMaxValue = vec4("+p+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wR = 0; wR < "+u+";\n wR += "+a+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+m+"; wC += 4) {\n int xC = xCCorner + wC * "+s+";\n\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n getValue(batch, xR, xC + 2 * "+s+", d),\n getValue(batch, xR, xC + 3 * "+s+", d)\n );\n\n "+g+"\n }\n\n int xC = xCCorner + "+m+";\n if ("+(1===v)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+g+"\n } else if ("+(2===v)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n initializationValue,\n initializationValue\n );\n\n "+g+"\n } else if ("+(3===v)+") {\n vec4 values = vec4(\n getValue(batch, xR, xC, d),\n getValue(batch, xR, xC + "+s+", d),\n getValue(batch, xR, xC + 2 * "+s+", d),\n initializationValue\n );\n\n "+g+"\n }\n }\n setOutput("+d+");\n }\n "}},oa=function(t,e,n){if(this.variableNames=["x"],"avg"===e&&n)throw new Error("Cannot compute positions for average pool.");var r=t.filterWidth,o=t.strideDepth,i=t.strideHeight,a=t.strideWidth,s=t.dilationDepth,u=t.dilationHeight,c=t.dilationWidth,l=t.effectiveFilterDepth,f=t.effectiveFilterHeight,h=t.effectiveFilterWidth,p=t.padInfo.front,d=t.padInfo.top,m=t.padInfo.left;this.outputShape=t.outShape;var v="avg"===e,g="0.0";if(v||(g="-1.0 / 1e-20"),n)this.userCode="\n const ivec3 strides =\n ivec3("+o+", "+i+", "+a+");\n const ivec3 pads = ivec3("+p+", "+d+", "+m+");\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, ch) to get y(yD, yR, yC, ch).\n // ? = to be determined\n float minMaxValue = 0.0;\n float minMaxValueFound = 0.0;\n int minMaxPosition = 0;\n\n for (int wD = 0; wD < "+l+";\n wD += "+s+") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+f+";\n wR += "+u+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+h+";\n wC += "+c+") {\n int xC = xCCorner + wC;\n\n if (xC < 0 || xC >= "+t.inWidth+") {\n continue;\n }\n\n float value = getX(batch, xD, xR, xC, ch);\n\n // If a min / max value has already been found, use it. If not,\n // use the current value.\n float currMinMaxValue = mix(\n value, minMaxValue, minMaxValueFound);\n if (value >= currMinMaxValue) {\n minMaxValue = value;\n minMaxValueFound = 1.0;\n minMaxPosition =\n wD * "+f+" * "+h+" +\n wR * "+h+" + wC;;\n }\n }\n }\n }\n setOutput(float(minMaxPosition));\n }\n ";else{var y=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"avg"===e&&(y="avgValue / count");var b=4*Math.floor(r/4),w=r%4,x="\n if ("+v+") {\n avgValue += dot(values, ones);\n } else {\n minMaxValue = max(values, minMaxValue);\n }\n ";this.userCode="\n const ivec3 strides =\n ivec3("+o+", "+i+", "+a+");\n const ivec3 pads = ivec3("+p+", "+d+", "+m+");\n const float initializationValue = "+g+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float count = 0.0;\n\n float getValue(int batch, int xD, int xR, int xC, int ch) {\n if (xC < 0 || xC >= "+t.inWidth+") {\n return initializationValue;\n }\n count += 1.0;\n return getX(batch, xD, xR, xC, ch);\n }\n\n void main() {\n ivec5 coords = getOutputCoords();\n int batch = coords.x;\n int ch = coords.u;\n\n ivec3 xCorner = ivec3(coords.y, coords.z, coords.w) * strides - pads;\n int xDCorner = xCorner.x;\n int xRCorner = xCorner.y;\n int xCCorner = xCorner.z;\n\n // max/min x(?, ?, ?, d) to get y(yD, yR, yC, ch).\n // ? = to be determined\n vec4 minMaxValue = vec4("+g+");\n float avgValue = 0.0;\n count = 0.0;\n\n for (int wD = 0; wD < "+l+";\n wD += "+s+") {\n int xD = xDCorner + wD;\n\n if (xD < 0 || xD >= "+t.inDepth+") {\n continue;\n }\n\n for (int wR = 0; wR < "+f+";\n wR += "+u+") {\n int xR = xRCorner + wR;\n\n if (xR < 0 || xR >= "+t.inHeight+") {\n continue;\n }\n\n for (int wC = 0; wC < "+b+"; wC += 4) {\n int xC = xCCorner + wC * "+c+";\n\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+c+", ch),\n getValue(batch, xD, xR, xC + 2 * "+c+", ch),\n getValue(batch, xD, xR, xC + 3 * "+c+", ch)\n );\n\n "+x+"\n }\n\n int xC = xCCorner + "+b+";\n if ("+(1===w)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+x+"\n } else if ("+(2===w)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+c+", ch),\n initializationValue,\n initializationValue\n );\n\n "+x+"\n } else if ("+(3===w)+") {\n vec4 values = vec4(\n getValue(batch, xD, xR, xC, ch),\n getValue(batch, xD, xR, xC + "+c+", ch),\n getValue(batch, xD, xR, xC + 2 * "+c+", ch),\n initializationValue\n );\n\n "+x+"\n }\n }\n setOutput("+y+");\n }\n }\n "}},ia=function(t,e){this.variableNames=["x"];var n=t.windowSize,r=t.batchSize,o=t.inSize,i=Math.ceil(o/n);this.outputShape=[r,i];var a="0.0",s="";"prod"===e?a="1.0":"min"===e?(a="1.0 / 1e-20",s="min"):"max"===e&&(a="-1.0 / 1e-20",s="max");var u=e+"("+e+"("+e+"(minMaxValue[0], minMaxValue[1]), minMaxValue[2]), minMaxValue[3])";"sum"===e?u="sumValue":"prod"===e?u="prodValue":"all"===e?u="allValue":"any"===e&&(u="anyValue");var c=4*Math.floor(n/4),l=n%4,f="\n if ("+("sum"===e)+") {\n sumValue += dot(values, ones);\n } else if ("+("prod"===e)+") {\n vec2 tmp = vec2(values[0], values[1]) * vec2(values[2], values[3]);\n prodValue *= tmp[0] * tmp[1];\n } else {\n minMaxValue = "+s+"(values, minMaxValue);\n }\n ",h="vec4";"all"===e?(a="1.0",f="\n bool reducedAllValue = all(values);\n float floatedReducedAllValue = float(reducedAllValue);\n allValue = float(allValue >= 1.0 && floatedReducedAllValue >= 1.0);\n ",h="bvec4"):"any"===e&&(a="0.0",f="\n bool reducedAnyValue = any(values);\n float floatedReducedAnyValue = float(reducedAnyValue);\n anyValue = float(anyValue >= 1.0 || floatedReducedAnyValue >= 1.0);\n ",h="bvec4");var p="";o%n>0&&(p="\n if (inIdx < 0 || inIdx >= "+o+") {\n return initializationValue;\n }\n "),this.userCode="\n const float initializationValue = "+a+";\n const vec4 ones = vec4(1.0, 1.0, 1.0, 1.0);\n\n float getValue(int batch, int inIdx) {\n "+p+"\n return getX(batch, inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = outIdx * "+n+";\n\n vec4 minMaxValue = vec4("+a+");\n float prodValue = 1.0;\n float sumValue = 0.0;\n float allValue = 1.0;\n float anyValue = 0.0;\n\n for (int i = 0; i < "+c+"; i += 4) {\n int inIdx = inOffset + i;\n "+h+" values = "+h+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n "+f+"\n }\n\n int inIdx = inOffset + "+c+";\n if ("+(1===l)+") {\n "+h+" values = "+h+"(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(2===l)+") {\n "+h+" values = "+h+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n "+f+"\n } else if ("+(3===l)+") {\n "+h+" values = "+h+"(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n "+f+"\n }\n setOutput("+u+");\n }\n "},aa=function(t,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t;for(var n="",r=0;r<4;r++){var o="thisRC = rc;";r%2==1&&(o+="thisRC.z += 1;"),r>1&&(o+="thisRC.y += 1;"),n+="\n "+o+"\n "+(r>0?"if(thisRC.y < rows && thisRC.z < cols){":"")+"\n int flatIndex = getFlatIndex(thisRC);\n\n ivec3 inputRC = inputCoordsFromReshapedOutCoords(flatIndex);\n vec2 inputRCInnerDims = vec2(float(inputRC.y),float(inputRC.z));\n\n result["+r+"] =\n getChannel(getA(inputRC.x, inputRC.y, inputRC.z), inputRCInnerDims);\n "+(r>0?"}":"")+"\n "}this.userCode="\n \n ivec3 inputCoordsFromReshapedOutCoords(int index) {\n "+_o(["r","c","d"],e)+"\n return ivec3(r, c, d);\n }\n \n "+Eo(t)+"\n\n void main() {\n ivec3 rc = getOutputCoords();\n\n vec4 result = vec4(0.);\n\n ivec3 thisRC;\n int rows = "+t[1]+";\n int cols = "+t[2]+";\n\n "+n+"\n\n setOutput(result);\n }\n "},sa=function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,o=r[1],i=r[2],a=t.shape,s=a[1],u=a[2],c=[n&&s>1?o-1:o,n&&u>1?i-1:i],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],f=c[0]/l[0],h=c[1]/l[1],p=1/f,d=1/h,m=2*Math.ceil(p)+2,v=2*Math.ceil(d)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+f+");\n const float widthScale = float("+h+");\n\n const float invHeightScale = float("+p+");\n const float invWidthScale = float("+d+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+v+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(startRLerp - float(winHeight / 2));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(startCLerp - float(winWidth / 2));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float dxR = float(dyR) * heightScale;\n int topDxRIndex = int(floor(dxR));\n int bottomDxRIndex = int(min(ceil(dxR), "+(o-1)+".0));\n float dxRLerp = dxR - float(topDxRIndex);\n float inverseDxRLerp = 1.0 - dxRLerp;\n\n float dxC = float(dyC) * widthScale;\n int leftDxCIndex = int(floor(dxC));\n int rightDxCIndex = int(min(ceil(dxC), "+(i-1)+".0));\n float dxCLerp = dxC - float(leftDxCIndex);\n float inverseDxCLerp = 1.0 - dxCLerp;\n\n if (r == topDxRIndex && c == leftDxCIndex) {\n // topLeft\n accumulator +=\n getDy(b, dyR, dyC, d) * inverseDxRLerp * inverseDxCLerp;\n }\n\n if (r == topDxRIndex && c == rightDxCIndex) {\n // topRight\n accumulator += getDy(b, dyR, dyC, d) * inverseDxRLerp * dxCLerp;\n }\n\n if (r == bottomDxRIndex && c == leftDxCIndex) {\n // bottomLeft\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * inverseDxCLerp;\n }\n\n if (r == bottomDxRIndex && c == rightDxCIndex) {\n // bottomRight\n accumulator += getDy(b, dyR, dyC, d) * dxRLerp * dxCLerp;\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "},ua=function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var o=t[0],i=t[1],a=t[2],s=t[3];this.outputShape=[o,e,n,s];var u=[r&&e>1?i-1:i,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n];this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+");\n const vec2 inputShapeRC = vec2("+i+".0, "+a+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec2 sourceFloorRC = ivec2(sourceFracIndexRC);\n ivec2 sourceCeilRC = ivec2(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n float topLeft = getA(b, sourceFloorRC.x, sourceFloorRC.y, d);\n float bottomLeft = getA(b, sourceCeilRC.x, sourceFloorRC.y, d);\n float topRight = getA(b, sourceFloorRC.x, sourceCeilRC.y, d);\n float bottomRight = getA(b, sourceCeilRC.x, sourceCeilRC.y, d);\n\n vec2 fracRC = sourceFracIndexRC - vec2(sourceFloorRC);\n\n float top = topLeft + (topRight - topLeft) * fracRC.y;\n float bottom = bottomLeft + (bottomRight - bottomLeft) * fracRC.y;\n float newValue = top + (bottom - top) * fracRC.x;\n\n setOutput(newValue);\n }\n "},ca=function(t,e,n,r){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=[];var o=t[0],i=t[1],a=t[2],s=t[3];this.outputShape=[o,e,n,s];var u=[r&&e>1?i-1:i,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n];this.userCode="\n const vec3 effectiveInputOverOutputRatioRC = vec3(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+",\n "+u[1]/c[1]+");\n const vec3 inputShapeRC = vec3("+i+".0, "+a+".0,\n "+a+".0);\n\n float getAValue(int b, int r, int c, int d) {\n return getChannel(getA(b, r, c, d), vec2(c, d));\n }\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n // Calculate values for next column in yRC.z.\n ivec3 yRC = coords.yzz + ivec3(0, 0, 1);\n\n // Fractional source index.\n vec3 sourceFracIndexRC = vec3(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the four integer indices.\n ivec3 sourceFloorRC = ivec3(sourceFracIndexRC);\n ivec3 sourceCeilRC = ivec3(\n min(inputShapeRC - 1.0, ceil(sourceFracIndexRC)));\n\n // Should we calculate next column and row elements in 2x2 packed cell.\n bool hasNextCol = d < "+(s-1)+";\n bool hasNextRow = coords.z < "+(n-1)+";\n\n // In parallel, construct four corners for all four components in\n // packed 2x2 cell.\n vec4 topLeft = vec4(\n getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 bottomLeft = vec4(\n getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceFloorRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceFloorRC.z, d + 1) : 0.0);\n\n vec4 topRight = vec4(\n getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceFloorRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceFloorRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec4 bottomRight = vec4(\n getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d),\n hasNextCol ? getAValue(b, sourceCeilRC.x, sourceCeilRC.y, d + 1)\n : 0.0,\n hasNextRow ? getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d)\n : 0.0,\n (hasNextRow && hasNextCol) ?\n getAValue(b, sourceCeilRC.x, sourceCeilRC.z, d + 1) : 0.0);\n\n vec3 fracRC = sourceFracIndexRC - vec3(sourceFloorRC);\n\n vec4 top = mix(topLeft, topRight, fracRC.yyzz);\n vec4 bottom = mix(bottomLeft, bottomRight, fracRC.yyzz);\n vec4 newValue = mix(top, bottom, fracRC.x);\n\n setOutput(newValue);\n }\n "},la=function(t,e,n){this.variableNames=["dy"],this.outputShape=[],this.outputShape=e.shape;var r=e.shape,o=r[1],i=r[2],a=t.shape,s=a[1],u=a[2],c=[n&&s>1?o-1:o,n&&u>1?i-1:i],l=[n&&s>1?s-1:s,n&&u>1?u-1:u],f=c[0]/l[0],h=c[1]/l[1],p=1/f,d=1/h,m=2*Math.ceil(p)+2,v=2*Math.ceil(d)+2;this.userCode="\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n int r = coords[1];\n int c = coords[2];\n\n float accumulator = 0.0;\n\n const float heightScale = float("+f+");\n const float widthScale = float("+h+");\n\n const float invHeightScale = float("+p+");\n const float invWidthScale = float("+d+");\n\n const int winHeight = int("+m+");\n const int winWidth = int("+v+");\n\n // Compute bounds for where in dy we will look\n float startRLerp = floor(float(r) * invHeightScale);\n int startDyR = int(floor(startRLerp - float(winHeight / 2)));\n\n float startCLerp = floor(float(c) * invWidthScale);\n int startDyC = int(floor(startCLerp - float(winWidth / 2)));\n\n // Loop over dy\n for (int dyROffset = 0; dyROffset < winHeight; dyROffset++) {\n int dyR = dyROffset + startDyR;\n\n // Guard against the window exceeding the bounds of dy\n if (dyR < 0 || dyR >= "+s+") {\n continue;\n }\n\n for (int dyCOffset = 0; dyCOffset < winWidth; dyCOffset++) {\n int dyC = dyCOffset + startDyC;\n\n // Guard against the window exceeding the bounds of dy\n if (dyC < 0 || dyC >= "+u+") {\n continue;\n }\n\n float sourceFracRow =\n float("+c[0]+") *\n (float(dyR) / float("+l[0]+"));\n\n float sourceFracCol =\n float("+c[1]+") *\n (float(dyC) / float("+l[1]+"));\n\n int sourceNearestRow = int(min(\n float(int("+o+") - 1),\n "+n+" ? float(round(sourceFracRow)) :\n float(floor(sourceFracRow))));\n\n int sourceNearestCol = int(min(\n float(int("+i+") - 1),\n "+n+" ? float(round(sourceFracCol)) :\n float(floor(sourceFracCol))));\n\n if (r == sourceNearestRow && c == sourceNearestCol) {\n accumulator += getDy(b, dyR, dyC, d);\n }\n }\n }\n // End loop over dy\n\n setOutput(accumulator);\n }\n "},fa=function(t,e,n,r){this.variableNames=["A"],this.outputShape=[];var o=t[0],i=t[1],a=t[2],s=t[3];this.outputShape=[o,e,n,s];var u=[r&&e>1?i-1:i,r&&n>1?a-1:a],c=[r&&e>1?e-1:e,r&&n>1?n-1:n],l=r?"0.5":"0.0";this.userCode="\n const vec2 effectiveInputOverOutputRatioRC = vec2(\n "+u[0]/c[0]+",\n "+u[1]/c[1]+");\n const vec2 inputShapeRC = vec2("+i+".0, "+a+".0);\n\n void main() {\n ivec4 coords = getOutputCoords();\n int b = coords[0];\n int d = coords[3];\n ivec2 yRC = coords.yz;\n\n // Fractional source index.\n vec2 sourceFracIndexRC = vec2(yRC) * effectiveInputOverOutputRatioRC;\n\n // Compute the coordinators of nearest neighbor point.\n ivec2 sourceNearestRC = ivec2(\n min(inputShapeRC - 1.0, floor(sourceFracIndexRC + "+l+")));\n\n float newValue = getA(b, sourceNearestRC.x, sourceNearestRC.y, d);\n\n setOutput(newValue);\n }\n "},ha=function(t,e){this.variableNames=["x"];var n=t.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");if(this.outputShape=t,1!==n){var r=t.map((function(n,r){return function(n){return-1!==e.indexOf(n)&&1!==t[n]?t[n]+" - coords["+n+"] - 1":"coords["+n+"]"}(r)})).join(","),o=Do(n);this.userCode="\n void main() {\n "+o+" coords = getOutputCoords();\n setOutput(getX("+r+"));\n }\n "}else this.userCode="\n void main() {\n int coord = getOutputCoords();\n setOutput(getX("+t[0]+" - coord - 1));\n }\n "},pa=function(t,e){this.variableNames=["x"],this.packedInputs=!0,this.packedOutput=!0;var n=t.length;if(n>4)throw new Error("WebGL backend: Reverse of rank-"+n+" tensor is not yet supported");this.outputShape=t;var r=wo("rc",n),o=r[n-1]+" + 1 < "+this.outputShape[n-1],i=r[n-2]+" + 1 < "+this.outputShape[n-2],a=Do(n);function s(n){var r=t.map((function(r,o){return function(n,r){return-1!==e.indexOf(n)&&1!==t[n]?t[n]+" - "+r[n]+" - 1":""+r[n]}(o,n)}));return"getChannel(getX("+r.join(",")+"), vec2("+r.slice(-2).join(",")+"))"}this.userCode=1===n?"\n void main(){\n int rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = getChannel(getX("+t[0]+" - rc - 1),\n "+t[0]+" - rc - 1);\n if("+o+"){\n result.g = getChannel(getX("+t[0]+" - (rc + 1) - 1),\n "+t[0]+" - (rc + 1) - 1);\n }\n setOutput(result);\n }\n ":"\n void main() {\n "+a+" rc = getOutputCoords();\n vec4 result = vec4(0.);\n result.r = "+function(t){return s(t)}(r.slice())+";\n if("+o+"){\n result.g = "+function(t){return t[n-1]="("+t[n-1]+" + 1)",s(t)}(r.slice())+";\n }\n if("+i+") {\n result.b = "+function(t){return t[n-2]="("+t[n-2]+" + 1)",s(t)}(r.slice())+";\n if("+o+") {\n result.a = "+function(t){return t[n-1]="("+t[n-1]+" + 1)",t[n-2]="("+t[n-2]+" + 1)",s(t)}(r.slice())+";\n }\n }\n setOutput(result);\n }\n "},da=function(t,e,n,r,o,i,a){void 0===a&&(a=!0),this.variableNames=["updates","indices","defaultValue"],this.outputShape=i;var s=Do(o.length),u=Do(i.length),c="";1===n?c="i":2===n&&(c="i, j");var l="getIndices("+c+")",f="";1===r?f="i":2===r&&(f="i, coords[1]");var h="getUpdates("+f+")",p=e>1?"strides[j]":"strides";this.userCode="\n "+s+" strides = "+s+"("+o+");\n\n void main() {\n "+u+" coords = getOutputCoords();\n float sum = 0.0;\n bool found = false;\n for (int i = 0; i < "+t+"; i++) {\n int flattenedIndex = 0;\n for (int j = 0; j < "+e+"; j++) {\n int index = round("+l+");\n flattenedIndex += index * "+p+";\n }\n if (flattenedIndex == coords[0]) {\n sum += "+h+";\n found = true;\n }\n }\n setOutput(mix(getDefaultValue(), sum, float(found)));\n }\n "},ma=function(t,e){this.variableNames=["x","segmentIds"];var n=t.windowSize,r=t.batchSize,o=t.inSize,i=t.numSegments,a=i*Math.ceil(o/n);this.outputShape=[r,a];var s=4*Math.floor(n/4),u=n%4,c="\n sumValue += dot(values, segFilter);\n ",l="";o%n>0&&(l="\n if (inIdx < 0 || inIdx >= "+o+") {\n return initializationValue;\n }\n ");var f="";o%n>0&&(f="\n if (inIdx < 0 || inIdx >= "+o+") {\n return -1.0;\n }\n "),this.userCode="\n const float initializationValue = 0.0;\n\n float getValue(int batch, int inIdx) {\n "+l+"\n return getX(batch, inIdx);\n }\n\n float getSegmentIdAtIndex(int inIdx) {\n "+f+"\n return getSegmentIds(inIdx);\n }\n\n void main() {\n ivec2 coords = getOutputCoords();\n int batch = coords[0];\n int outIdx = coords[1];\n int inOffset = int(floor(float(outIdx) / float(\n "+i+")) * float("+n+"));\n int currentSeg = int(mod(float(outIdx), float("+i+")));\n\n float sumValue = 0.0;\n\n for (int i = 0; i < "+s+"; i += 4) {\n int inIdx = inOffset + i;\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n getValue(batch, inIdx + 3)\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 3)) == currentSeg ? 1 : 0\n );\n\n "+c+"\n }\n\n int inIdx = inOffset + "+s+";\n if ("+(1===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n initializationValue,\n initializationValue,\n initializationValue\n );\n\n int inIdxSeg = int(getSegmentIdAtIndex(inIdx));\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n 0,\n 0,\n 0\n );\n\n "+c+"\n } else if ("+(2===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n initializationValue,\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n 0,\n 0\n );\n\n "+c+"\n } else if ("+(3===u)+") {\n vec4 values = vec4(\n getValue(batch, inIdx),\n getValue(batch, inIdx + 1),\n getValue(batch, inIdx + 2),\n initializationValue\n );\n\n vec4 segFilter = vec4(\n int(getSegmentIdAtIndex(inIdx)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 1)) == currentSeg ? 1 : 0,\n int(getSegmentIdAtIndex(inIdx + 2)) == currentSeg ? 1 : 0,\n 0\n );\n\n "+c+"\n }\n setOutput(sumValue);\n }\n "},va=function(t,e,n){var r,o;if(this.variableNames=["c","a","b"],this.outputShape=e,n>4)throw Error("Where for rank "+n+" is not yet supported");if(1===n)o="resRC",r="resRC";else{for(var i=["resRC.x","resRC.y","resRC.z","resRC.w"],a=[],s=[],u=0;u<e.length;u++)s.push(""+i[u]),u<t&&a.push(""+i[u]);r=a.join(),o=s.join()}var c=Do(n);this.userCode="\n void main() {\n "+c+" resRC = getOutputCoords();\n float cVal = getC("+r+");\n if (cVal >= 1.0) {\n setOutput(getA("+o+"));\n } else {\n setOutput(getB("+o+"));\n }\n }\n "},ga=function(){function t(t){this.variableNames=["source"],this.outputShape=t,this.rank=t.length;var e,n=Do(this.rank),r="uniform int start["+this.rank+"];",o=function(t){if(1===t)return"sourceLoc";if(t<=6)return ya.slice(0,t).map((function(t){return"sourceLoc."+t})).join(",");throw Error("Slicing for rank "+t+" is not yet supported")}(this.rank);e="\n "+n+" sourceLoc;\n "+n+" coords = getOutputCoords();\n "+t.map((function(t,e){return"sourceLoc."+ya[e]+" = start["+e+"] + coords."+ya[e]+";"})).join("\n")+"\n ",this.userCode="\n "+r+"\n void main() {\n "+e+"\n setOutput(getSource("+o+"));\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+t.length+")");return function(n,r){null==e.startLoc&&(e.startLoc=n.getUniformLocationNoThrow(r,"start"),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}(),ya=["x","y","z","w","u","v"],ba=function(){function t(t){this.variableNames=["source"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.rank=t.length;var e=Do(this.rank),n=wo("coords",this.rank),r=wo("sourceLoc",this.rank),o=1===this.rank?"sourceLoc":"vec2("+r.slice(-2).join()+")",i="getChannel(getSource("+r.join()+"), "+o+")",a="\n result.x = "+i+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+r[this.rank-1]+";\n result.y = "+i+";\n --"+r[this.rank-1]+";\n }\n ",s=1===this.rank?"":"\n --"+n[this.rank-1]+";\n if (++"+n[this.rank-2]+" < "+t[this.rank-2]+") {\n ++"+r[this.rank-2]+";\n result.z = "+i+";\n if (++"+n[this.rank-1]+" < "+t[this.rank-1]+") {\n ++"+r[this.rank-1]+";\n result.w = "+i+";\n }\n }\n ",u=this.rank<=4?"sourceLoc = coords +\n "+e+"("+t.map((function(t,e){return"start["+e+"]"})).join()+");":t.map((function(t,e){return r[e]+" = "+n[e]+" + start["+e+"];"})).join("\n");this.userCode="\n uniform int start["+this.rank+"];\n void main() {\n "+e+" coords = getOutputCoords();\n "+e+" sourceLoc;\n "+u+"\n vec4 result = vec4(0.);\n "+a+"\n "+s+"\n setOutput(result);\n }\n "}return t.prototype.getCustomSetupFunc=function(t){var e=this;if(t.length!==this.rank)throw Error("The rank ("+this.rank+") of the program must match the length of start ("+t.length+")");return function(n,r){null==e.startLoc&&(e.startLoc=n.getUniformLocationNoThrow(r,"start"),null==e.startLoc)||n.gl.uniform1iv(e.startLoc,t)}},t}(),wa=function(t,e,n){this.variableNames=["x"],this.outputShape=n;var r=n.length,o=Do(n.length),i=Do(n.length),a="";if(1===r)a="coords * strides + begin";else{var s=0;a=n.map((function(t,e){return s++,1===n.length?"coords * strides["+e+"] + begin["+e+"]":"coords["+(s-1)+"] * strides["+e+"] + begin["+e+"]"})).join(",")}this.userCode="\n "+o+" begin = "+o+"("+t+");\n "+o+" strides = "+o+"("+e+");\n\n void main() {\n "+i+" coords = getOutputCoords();\n setOutput(getX("+a+"));\n }\n "},xa=function(){function t(t){this.gpgpu=t,this.numUsedTextures=0,this.numFreeTextures=0,this.freeTextures={},this.logEnabled=!1,this.usedTextures={}}return t.prototype.acquireTexture=function(t,e,n){var r,o=_a(e,n),i=Ea(t,o,n);if(i in this.freeTextures||(this.freeTextures[i]=[]),i in this.usedTextures||(this.usedTextures[i]=[]),this.freeTextures[i].length>0){this.numFreeTextures--,this.numUsedTextures++,this.log();var a=this.freeTextures[i].shift();return this.usedTextures[i].push(a),a}return this.numUsedTextures++,this.log(),o===Lt.PACKED_2X2_FLOAT32?r=this.gpgpu.createPackedMatrixTexture(t[0],t[1]):o===Lt.PACKED_2X2_FLOAT16?r=this.gpgpu.createFloat16PackedMatrixTexture(t[0],t[1]):o===Lt.UNPACKED_FLOAT32?r=this.gpgpu.createFloat32MatrixTexture(t[0],t[1]):o===Lt.UNPACKED_FLOAT16?r=this.gpgpu.createFloat16MatrixTexture(t[0],t[1]):o===Lt.PACKED_4X1_UNSIGNED_BYTE&&(r=this.gpgpu.createUnsignedBytesMatrixTexture(t[0],t[1])),this.usedTextures[i].push(r),r},t.prototype.releaseTexture=function(t,e,n,r){if(null!=this.freeTextures){var o=Ea(e,_a(n,r),r);o in this.freeTextures||(this.freeTextures[o]=[]),this.freeTextures[o].push(t),this.numFreeTextures++,this.numUsedTextures--;var i=this.usedTextures[o],a=i.indexOf(t);if(a<0)throw new Error("Cannot release a texture that was never provided by this texture manager");i.splice(a,1),this.log()}},t.prototype.log=function(){if(this.logEnabled){var t=this.numFreeTextures+this.numUsedTextures;console.log("Free/Used",this.numFreeTextures+" / "+this.numUsedTextures,"("+t+")")}},t.prototype.getNumUsedTextures=function(){return this.numUsedTextures},t.prototype.getNumFreeTextures=function(){return this.numFreeTextures},t.prototype.dispose=function(){var t=this;if(null!=this.freeTextures){for(var e in this.freeTextures)this.freeTextures[e].forEach((function(e){t.gpgpu.deleteMatrixTexture(e)}));for(var e in this.usedTextures)this.usedTextures[e].forEach((function(e){t.gpgpu.deleteMatrixTexture(e)}));this.freeTextures=null,this.usedTextures=null,this.numUsedTextures=0,this.numFreeTextures=0}},t}();function _a(t,e){if(t===Bt.UPLOAD)return Lt.PACKED_2X2_FLOAT32;if(t===Bt.RENDER||null==t)return function(t){return f().getBool("WEBGL_RENDER_FLOAT32_ENABLED")?t?Lt.PACKED_2X2_FLOAT32:Lt.UNPACKED_FLOAT32:t?Lt.PACKED_2X2_FLOAT16:Lt.UNPACKED_FLOAT16}(e);if(t===Bt.DOWNLOAD||t===Bt.PIXELS)return Lt.PACKED_4X1_UNSIGNED_BYTE;throw new Error("Unknown logical texture type "+t)}function Ea(t,e,n){return t[0]+"_"+t[1]+"_"+e+"_"+n}var Ca=function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t[r]*e[r];this.outputShape=n,this.rank=n.length;var o=Do(this.rank),i=function(t){var e=t.length;if(e>5)throw Error("Tile for rank "+e+" is not yet supported");if(1===e)return"imod(resRC, "+t[0]+")";for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u"],r=[],o=0;o<t.length;o++)r.push("imod("+n[o]+", "+t[o]+")");return r.join()}(t);this.userCode="\n void main() {\n "+o+" resRC = getOutputCoords();\n setOutput(getA("+i+"));\n }\n "},Sa=function(t,e){this.variableNames=["A"];for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t[e[r]];this.outputShape=n,this.rank=n.length;var o=Do(this.rank),i=function(t){var e=t.length;if(e>6)throw Error("Transpose for rank "+e+" is not yet supported");for(var n=["resRC.x","resRC.y","resRC.z","resRC.w","resRC.u","resRC.v"],r=new Array(e),o=0;o<t.length;o++)r[t[o]]=n[o];return r.join()}(e);this.userCode="\n void main() {\n "+o+" resRC = getOutputCoords();\n setOutput(getA("+i+"));\n }\n "},ka=function(t,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0;for(var n=new Array(t.length),r=0;r<n.length;r++)n[r]=t[e[r]];if(this.outputShape=n,this.rank=n.length,this.rank>6)throw Error("Packed transpose for rank "+this.rank+" is not yet supported.");var o=Do(this.rank),i=bo("rc",this.rank),a=new Array(this.rank);for(r=0;r<e.length;r++)a[e[r]]=i[r];var s="vec2("+a.slice(-2).join()+")",u="++"+i[this.rank-1]+" < "+n[this.rank-1],c="getChannel(getA("+a.join()+"), "+s+")";this.userCode="\n void main() {\n "+o+" rc = getOutputCoords();\n vec4 result = vec4(0.);\n result[0] = "+c+";\n if("+u+") {\n result[1] = "+c+";\n }\n --"+i[this.rank-1]+";\n if(++"+i[this.rank-2]+" < "+n[this.rank-2]+") {\n result[2] = "+c+";\n if("+u+") {\n result[3] = "+c+";\n }\n }\n setOutput(result);\n }\n "},Ta=1.7580993408473768,Ia=1.0507009873554805,Oa=function(t,e){this.variableNames=["A"],this.outputShape=t,this.userCode="\n float unaryOperation(float x) {\n "+e+"\n }\n\n void main() {\n float x = getAAtOutCoords();\n float y = unaryOperation(x);\n\n setOutput(y);\n }\n "},Ra="if (isnan(x)) return x;",Aa="return abs(x);",Da=Ra+"\n return (x < 0.0) ? 0.0 : x;\n",Na=Ra+"\n return (x < 0.0) ? 0.0 : min(6.0, x);\n",Pa="return (x >= 0.0) ? x : (exp(x) - 1.0);",Ma="return -x;",ja="return ceil(x);",Fa="return floor(x);",Ba="return exp(x);",La="return exp(x) - 1.0;",Ua="return x;",Wa="\n vec4 result = x * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",za="\n vec4 result = min(x, vec4(6.)) * vec4(greaterThanEqual(x, vec4(0.0)));\n bvec4 isNaN = isnan(x);\n\n result.r = isNaN.r ? x.r : result.r;\n result.g = isNaN.g ? x.g : result.g;\n result.b = isNaN.b ? x.b : result.b;\n result.a = isNaN.a ? x.a : result.a;\n\n return result;\n",Va="\n vec4 result;\n\n result.r = (x.r >= 0.0) ? x.r : (exp(x.r) - 1.0);\n result.g = (x.g >= 0.0) ? x.g : (exp(x.g) - 1.0);\n result.b = (x.b >= 0.0) ? x.b : (exp(x.b) - 1.0);\n result.a = (x.a >= 0.0) ? x.a : (exp(x.a) - 1.0);\n\n return result;\n",qa=function(t,e){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!0,this.outputShape=t,this.userCode="\n vec4 unaryOperation(vec4 x) {\n "+e+"\n }\n\n void main() {\n vec4 x = getAAtOutCoords();\n vec4 y = unaryOperation(x);\n\n setOutput(y);\n }\n "},Ga=function(t){this.variableNames=["A"],this.packedInputs=!0,this.packedOutput=!1,this.outputShape=t;var e=t.length,n=wo("rc",e),r=Do(e),o=function(t,e){if(1===t)return"rc";for(var n="",r=0;r<t;r++)n+=e[r],r<t-1&&(n+=",");return n}(e,n),i=n.slice(-2),a=e<=1?"rc":"vec2("+i.join(",")+")";this.userCode="\n void main() {\n "+r+" rc = getOutputCoords();\n vec4 packedInput = getA("+o+");\n\n setOutput(getChannel(packedInput, "+a+"));\n }\n "},Ha={};function Xa(t,e){if(void 0===e&&(e=!1),"linear"===t)return"return x;";if("relu"===t)return e?Wa:Da;if("elu"===t)return e?Va:Pa;if("relu6"===t)return e?za:Na;if("prelu"===t)return e?Ho:qo;throw new Error("Activation "+t+" has not been implemented for the WebGL backend.")}var Ka=function(t){function e(e){var n,r=t.call(this)||this;if(r.pendingRead=new WeakMap,r.pendingDisposal=new WeakSet,r.dataRefCount=new WeakMap,r.numBytesInGPU=0,r.uploadWaitMs=0,r.downloadWaitMs=0,r.warnedAboutMemory=!1,r.pendingDeletes=0,r.disposed=!1,!f().getBool("HAS_WEBGL"))throw new Error("WebGL is not supported on this device");if(null==e){var o=Vt(f().getNumber("WEBGL_VERSION"));r.binaryCache=((n=f().getNumber("WEBGL_VERSION"))in Ha||(Ha[n]={}),Ha[n]),r.gpgpu=new Vi(o),r.canvas=o.canvas,r.gpgpuCreatedLocally=!0}else r.gpgpu=e,r.binaryCache={},r.gpgpuCreatedLocally=!1,r.canvas=e.gl.canvas;return r.textureManager=new xa(r.gpgpu),r.numMBBeforeWarning=null==f().global.screen?1024:f().global.screen.height*f().global.screen.width*window.devicePixelRatio*600/1024/1024,r.texData=new Dr(r,Pt),r}return a(e,t),e.prototype.numDataIds=function(){return this.texData.numDataIds()+(this.cpuBackend?this.cpuBackend.numDataIds():0)-this.pendingDeletes},e.prototype.write=function(t,e,n){if(f().getBool("DEBUG")&&this.checkNumericalProblems(t),"complex64"===n&&null!=t)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");var r={};return this.texData.set(r,{shape:e,dtype:n,values:t,usage:Bt.UPLOAD}),r},e.prototype.move=function(t,e,n,r){if(f().getBool("DEBUG")&&this.checkNumericalProblems(e),"complex64"===r)throw new Error("Cannot write to a complex64 dtype. Please use tf.complex(real, imag).");this.texData.set(t,{shape:n,dtype:r,values:e,usage:Bt.UPLOAD})},e.prototype.readSync=function(t){var e=this.texData.get(t),n=e.values,r=e.dtype,o=e.complexTensors,i=e.slice,a=e.shape,s=e.isPacked;if(null!=i){var u;u=s?new qa(a,Ua):new Oa(a,Ua);var c=this.runWebGLProgram(u,[{dataId:t,shape:a,dtype:r}],r),l=this.readSync(c.dataId);return this.disposeData(c.dataId),l}if(null!=n)return this.convertAndCacheOnCPU(t);if("string"===r)return n;var f,h,p=null!=this.activeTimers;return p&&(f=rt()),h="complex64"===r?Zr(o.real.dataSync(),o.imag.dataSync()):this.getValuesFromTexture(t),p&&(this.downloadWaitMs+=rt()-f),this.convertAndCacheOnCPU(t,h)},e.prototype.read=function(t){return s(this,void 0,void 0,(function(){var e,n,r,o,i,a,s,c,l,h,p,d,m,v,g,y,b,w,x,_,E,C;return u(this,(function(u){switch(u.label){case 0:if(this.pendingRead.has(t))return e=this.pendingRead.get(t),[2,new Promise((function(t){return e.push(t)}))];if(n=this.texData.get(t),r=n.values,o=n.shape,i=n.slice,a=n.dtype,s=n.complexTensors,c=n.isPacked,null!=i)return void 0,l=c?new qa(o,Ua):new Oa(o,Ua),h=this.runWebGLProgram(l,[{dataId:t,shape:o,dtype:a}],a),p=this.read(h.dataId),this.disposeData(h.dataId),[2,p];if(null!=r)return[2,this.convertAndCacheOnCPU(t)];if(!f().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")&&2===f().getNumber("WEBGL_VERSION"))throw new Error("tensor.data() with WEBGL_DOWNLOAD_FLOAT_ENABLED=false and WEBGL_VERSION=2 not yet supported.");return d=null,"complex64"!==a&&f().get("WEBGL_BUFFER_SUPPORTED")&&(m=this.decode(t),v=this.texData.get(m.dataId),d=(C=this.gpgpu).createBufferFromTexture.apply(C,[v.texture].concat(Gt(o)))),this.pendingRead.set(t,[]),"complex64"===a?[3,2]:[4,this.gpgpu.createAndWaitForFence()];case 1:u.sent(),u.label=2;case 2:return"complex64"!==a?[3,4]:[4,Promise.all([s.real.data(),s.imag.data()])];case 3:return y=u.sent(),b=y[0],w=y[1],g=Zr(b,w),[3,5];case 4:null==d?g=this.getValuesFromTexture(t):(x=I(o),g=this.gpgpu.downloadFloat32MatrixFromBuffer(d,x)),u.label=5;case 5:return null!=m&&this.disposeData(m.dataId),_=this.convertAndCacheOnCPU(t,g),E=this.pendingRead.get(t),this.pendingRead.delete(t),E.forEach((function(t){return t(_)})),this.pendingDisposal.has(t)&&(this.pendingDisposal.delete(t),this.disposeData(t),this.pendingDeletes--),[2,_]}}))}))},e.prototype.checkNumericalProblems=function(t){if(null!=t)for(var e=0;e<t.length;e++){var n=t[e];if(!Yt(n)){if(f().getBool("WEBGL_RENDER_FLOAT32_CAPABLE"))throw Error("The value "+n+" cannot be represented with your current settings. Consider enabling float32 rendering: 'tf.env().set('WEBGL_RENDER_FLOAT32_ENABLED', true);'");throw Error("The value "+n+" cannot be represented on this device.")}}},e.prototype.getValuesFromTexture=function(t){var e,n=this.texData.get(t),r=n.shape,o=n.dtype,i=n.isPacked,a=I(r);if(f().getBool("WEBGL_DOWNLOAD_FLOAT_ENABLED")){var s=this.decode(t),u=this.texData.get(s.dataId),c=(e=this.gpgpu).downloadMatrixFromPackedTexture.apply(e,[u.texture].concat(Gt(r))).subarray(0,a);return this.disposeData(s.dataId),c}var l=f().getBool("WEBGL_PACK")&&!0===i,h=l?Ce(r):r,p=l?new yi(h):new gi(h),d=this.runWebGLProgram(p,[{shape:h,dtype:o,dataId:t}],"float32"),m=this.texData.get(d.dataId),v=this.gpgpu.downloadByteEncodedFloatMatrixFromOutputTexture(m.texture,m.texShape[0],m.texShape[1]).subarray(0,a);return this.disposeData(d.dataId),v},e.prototype.time=function(t){return s(this,void 0,void 0,(function(){var e,n,r,o,i,a,s;return u(this,(function(u){switch(u.label){case 0:return e=this.activeTimers,n=[],r=!1,null==this.programTimersStack?(this.programTimersStack=n,r=!0):this.activeTimers.push(n),this.activeTimers=n,t(),o=T(this.activeTimers.map((function(t){return t.query}))).filter((function(t){return null!=t})),i=T(this.activeTimers.map((function(t){return t.name}))).filter((function(t){return null!=t})),this.activeTimers=e,r&&(this.programTimersStack=null),a={uploadWaitMs:this.uploadWaitMs,downloadWaitMs:this.downloadWaitMs,kernelMs:null,wallMs:null},f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[4,Promise.all(o)]:[3,2];case 1:return s=u.sent(),a.kernelMs=E(s),a.getExtraProfileInfo=function(){return s.map((function(t,e){return{name:i[e],ms:t}})).map((function(t){return t.name+": "+t.ms})).join(", ")},[3,3];case 2:a.kernelMs={error:"WebGL query timers are not supported in this environment."},u.label=3;case 3:return this.uploadWaitMs=0,this.downloadWaitMs=0,[2,a]}}))}))},e.prototype.memory=function(){return{unreliable:!1,numBytesInGPU:this.numBytesInGPU}},e.prototype.startTimer=function(){return f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?this.gpgpu.beginQuery():{startMs:rt(),endMs:null}},e.prototype.endTimer=function(t){return f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?(this.gpgpu.endQuery(),t):(t.endMs=rt(),t)},e.prototype.getQueryTime=function(t){return s(this,void 0,void 0,(function(){var e;return u(this,(function(n){return f().getNumber("WEBGL_DISJOINT_QUERY_TIMER_EXTENSION_RELIABLE")>0?[2,this.gpgpu.waitForQueryAndGetTime(t)]:[2,(e=t).endMs-e.startMs]}))}))},e.prototype.disposeData=function(t){if(!this.pendingDisposal.has(t)){if(this.pendingRead.has(t))return this.pendingDisposal.add(t),void this.pendingDeletes++;if(this.texData.has(t)){this.releaseGPUData(t);var e=this.texData.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.texData.delete(t)}}},e.prototype.releaseGPUData=function(t){var e=this.texData.get(t),n=e.texture,r=e.dtype,o=e.texShape,i=e.usage,a=e.isPacked,s=e.slice,u=s&&s.origDataId||t,c=this.dataRefCount.get(u);c>1?this.dataRefCount.set(u,c-1):(this.dataRefCount.delete(u),null!=n&&(this.numBytesInGPU-=this.computeBytes(o,r),this.textureManager.releaseTexture(n,o,i,a)));var l=this.texData.get(t);l.texture=null,l.texShape=null,l.isPacked=!1,l.slice=null},e.prototype.getTexture=function(t){return this.uploadToGPU(t),this.texData.get(t).texture},e.prototype.getDataInfo=function(t){return this.texData.get(t)},e.prototype.getCPUBackend=function(){return f().getBool("WEBGL_CPU_FORWARD")?(null==this.cpuBackend&&(this.cpuBackend=Pt.findBackend("cpu")),this.cpuBackend):null},e.prototype.shouldExecuteOnCPU=function(t,e){var n=this;return void 0===e&&(e=128),null!=this.getCPUBackend()&&t.every((function(t){return null==n.texData.get(t.dataId).texture&&t.size<e}))},e.prototype.getGPGPUContext=function(){return this.gpgpu},e.prototype.complex=function(t,e){var n=this.makeOutput(t.shape,"complex64");return this.texData.get(n.dataId).complexTensors={real:Pt.keep(t.clone()),imag:Pt.keep(e.clone())},n},e.prototype.real=function(t){return this.texData.get(t.dataId).complexTensors.real.clone()},e.prototype.imag=function(t){return this.texData.get(t.dataId).complexTensors.imag.clone()},e.prototype.slice=function(t,e,n){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.slice(t,e,n);if(0===I(n))return un([],n,t.dtype);var r=this.texData.get(t.dataId).isPacked,o=Tr(t.shape,e,n);if(r||!o){var i=f().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new ba(n):new ga(n),a=i.getCustomSetupFunc(e);return this.compileAndRun(i,[t],null,a)}return this.uploadToGPU(t.dataId),this.shallowSlice(t,e,n)},e.prototype.shallowSlice=function(t,e,n){var r=this.texData.get(t.dataId),o=this.makeOutput(n,t.dtype),i=this.texData.get(o.dataId);Object.assign(i,r),i.shape=n,i.dtype=t.dtype;var a=Ir(e,t.strides);r.slice&&(a+=r.slice.flatOffset),i.slice={flatOffset:a,origDataId:r.slice&&r.slice.origDataId||t.dataId};var s=this.dataRefCount.get(i.slice.origDataId)||1;return this.dataRefCount.set(i.slice.origDataId,s+1),o},e.prototype.stridedSlice=function(t,e,n,r){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.stridedSlice(t,e,n,r);var o=Cr(e,n,r);if(o.some((function(t){return 0===t})))return un([],o);var i=new wa(e,r,o);return this.compileAndRun(i,[t])},e.prototype.reverse=function(t,e){var n=f().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new pa(t.shape,e):new ha(t.shape,e);return this.compileAndRun(n,[t])},e.prototype.concat=function(t,e){if("complex64"===t[0].dtype){var n=t.map((function(t){return an(t)})),r=t.map((function(t){return sn(t)}));return on(this.concat(n,e),this.concat(r,e))}if(this.shouldExecuteOnCPU(t))return this.cpuBackend.concat(t,e);if(1===t.length)return t[0];if(t.length>f().getNumber("WEBGL_MAX_TEXTURES_IN_SHADER")){var o=Math.floor(t.length/2),i=this.concat(t.slice(0,o),e),a=this.concat(t.slice(o),e);return this.concat([i,a],e)}if(f().getBool("WEBGL_PACK_ARRAY_OPERATIONS")&&t[0].rank>1){var s=new Qo(t.map((function(t){return t.shape})),e);return this.compileAndRun(s,t)}var u=nn(t.map((function(t){return t.shape})),e),c=t.map((function(t){return t.as2D(-1,I(t.shape.slice(e)))})),l=new Jo(c.map((function(t){return t.shape})));return this.compileAndRun(l,c).reshape(u)},e.prototype.neg=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.neg(t);if(f().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Ma,t.dtype);var e=new Oa(t.shape,Ma);return this.compileAndRun(e,[t])},e.prototype.batchMatMul=function(t,e,n,r){var o=n?t.shape[2]:t.shape[1],i=r?e.shape[1]:e.shape[2],a=n?t.shape[1]:t.shape[2],s=t.shape[0];if((1===o||1===i)&&a>1e3){n&&(t=t.transpose([0,2,1])),r&&(e=e.transpose([0,2,1]));var u=1===i?t:t.as3D(s,a,1),c=1===i?2:1,l=1===i?e.as3D(s,1,a):e;return this.multiply(u,l).sum(c,!0)}var f=kt(t.dtype,e.dtype),h=new Ji(t.shape,[s,o,i],n,r);return this.compileAndRun(h,[t,e],f)},e.prototype.fusedBatchMatMul=function(t){var e=t.a,n=t.b,r=t.transposeA,o=t.transposeB,i=t.bias,a=t.activation,s=t.preluActivationWeights,u=r?e.shape[2]:e.shape[1],c=o?n.shape[1]:n.shape[2],l=e.shape[0],f=kt(e.dtype,n.dtype),h=null!=i,p=null!=s,d=a?Xa(a,!0):null,m=new Ji(e.shape,[l,u,c],r,o,h,d,p),v=[e,n];return i&&v.push(i),s&&v.push(s),this.compileAndRun(m,v,f)},e.prototype.multiply=function(t,e){if("complex64"===t.dtype){var n=this.texData.get(t.dataId),r=this.texData.get(e.dataId),o=new Uo("return areal * breal - aimag * bimag;",t.shape,e.shape),i=new Uo("return areal * bimag + aimag * breal;",t.shape,e.shape),a=[this.makeComplexComponentTensorInfo(t,n.complexTensors.real),this.makeComplexComponentTensorInfo(t,n.complexTensors.imag),this.makeComplexComponentTensorInfo(e,r.complexTensors.real),this.makeComplexComponentTensorInfo(e,r.complexTensors.imag)],s=this.compileAndRun(o,a),u=this.compileAndRun(i,a),c=this.complex(s,u);return s.dispose(),u.dispose(),c}if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.multiply(t,e);if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Vo,t.dtype);var l=new Go(Vo,t.shape,e.shape);return this.compileAndRun(l,[t,e],t.dtype)},e.prototype.batchNormalization=function(t,e,n,r,o,i){var a=[t,e,n],s=null;null!=i&&(s=i.shape,a.push(i));var u=null;if(null!=o&&(u=o.shape,a.push(o)),f().getBool("WEBGL_PACK_NORMALIZATION")){var c=new Lo(t.shape,e.shape,n.shape,s,u,r);return this.compileAndRun(c,a)}var l=new Bo(t.shape,e.shape,n.shape,s,u,r);return this.compileAndRun(l,a)},e.prototype.localResponseNormalization4D=function(t,e,n,r,o){var i=f().getBool("WEBGL_PACK_NORMALIZATION")?new Ki(t.shape,e,n,r,o):new Hi(t.shape,e,n,r,o);return this.compileAndRun(i,[t])},e.prototype.LRNGrad=function(t,e,n,r,o,i,a){var s=new Xi(e.shape,r,o,i,a);return this.compileAndRun(s,[e,n,t])},e.prototype.tile=function(t,e){if("string"===t.dtype){var n=this.readSync(t.dataId).map((function(t){return at(t)}));return ho(Ln(t.shape,t.dtype,n),e)}var r=new Ca(t.shape,e);return this.compileAndRun(r,[t])},e.prototype.pad=function(t,e,n){var r=f().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new na(t.shape,e,n):new ea(t.shape,e,n);return this.compileAndRun(r,[t])},e.prototype.transpose=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.transpose(t,e);var n=f().getBool("WEBGL_PACK_ARRAY_OPERATIONS")?new ka(t.shape,e):new Sa(t.shape,e);return this.compileAndRun(n,[t])},e.prototype.gather=function(t,e,n){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.gather(t,e,n);var r=new Ei(t.shape,e.size,n);return this.compileAndRun(r,[t,e])},e.prototype.batchToSpaceND=function(t,e,n){C(t.rank<=4,(function(){return"batchToSpaceND for rank > 4 with a WebGL backend not implemented yet"}));var r=e.reduce((function(t,e){return t*e})),o=hr(t.shape,e,r),i=pr(o.length,e.length),a=dr(t.shape,e,r),s=mr(n,e.length),u=vr(a,n,e.length);return t.reshape(o).transpose(i).reshape(a).slice(s,u)},e.prototype.spaceToBatchND=function(t,e,n){C(t.rank<=4,(function(){return"spaceToBatchND for rank > 4 with a WebGL backend not implemented yet"}));var r=e.reduce((function(t,e){return t*e})),o=[[0,0]];o.push.apply(o,n);for(var i=1+e.length;i<t.shape.length;++i)o.push([0,0]);var a=t.pad(o),s=hr(a.shape,e,r,!1),u=pr(s.length,e.length,!1),c=dr(a.shape,e,r,!1);return a.reshape(s).transpose(u).reshape(c)},e.prototype.reduce=function(t,e,n){var r=t.shape[0],o=t.shape[1],i=yr(o),a=new ia({windowSize:i,inSize:o,batchSize:r},e),s=this.compileAndRun(a,[t],n);return 1===s.shape[1]?s:this.reduce(s,e,n)},e.prototype.argReduce=function(t,e,n){void 0===n&&(n=null);var r=t.shape[0],o=t.shape[1];null!=n&&(r=n.shape[0],o=n.shape[1]);var i=yr(o),a=new yo({windowSize:i,inSize:o,batchSize:r},e,null==n),s=[t];null!=n&&s.push(n);var u=this.compileAndRun(a,s,"int32");return 1===u.shape[1]?u:this.argReduce(t,e,u)},e.prototype.argReducePacked=function(t,e,n){void 0===n&&(n=null);var r=null!=n?n.shape:t.shape,o=yr(r[r.length-1]),i=new Mo(r,o,e,null==n),a=null==n?[t]:[t,n],s=this.compileAndRun(i,a,"int32");return s.rank===t.rank?this.argReducePacked(t,e,s):s},e.prototype.sum=function(t,e){Je("sum",e,t.rank);var n=Ye(t.shape,e),r=n[0],o=I(n[1]),i=t.as2D(-1,o),a=Tt(t.dtype);return this.reduce(i,"sum",a).reshape(r)},e.prototype.prod=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.prod(t,e);var n=Ye(t.shape,e),r=n[0],o=I(n[1]),i=t.as2D(-1,o),a=Tt(t.dtype);return this.reduce(i,"prod",a).reshape(r)},e.prototype.unsortedSegmentSum=function(t,e,n){var r=0,o=Qe([r],t.rank),i=t;null!=o&&(i=t.transpose(o),r=tn(1,t.rank)[0]);var a=function(t,e,n){for(var r=[],o=t.length,i=0;i<o;i++)i!==e?r.push(t[i]):r.push(n);return r}(i.shape,r,n),s=I([i.shape[r]]),u=i.as2D(-1,s),c=Tt(t.dtype),l=this.segOpCompute(u,"unsortedSegmentSum",e,c,n).reshape(a);return null!=o&&(l=l.transpose(Ze(o))),l},e.prototype.segOpCompute=function(t,e,n,r,o){var i=t.shape[0],a=t.shape[1],s=function(t,e){var n,r=!1;for(t<=30?(n=t,r=!0):n=J(t,Math.floor(Math.sqrt(t)));!r;)n>e||n===t?r=!0:n=J(t,n+1);return n}(a,o),u=new ma({windowSize:s,inSize:a,batchSize:i,numSegments:o},e),c=this.compileAndRun(u,[t,n],r);return c.shape[1]===o?c:(n=yn(0,o).tile([a/s]),this.segOpCompute(c,e,n,r,o))},e.prototype.argMinMaxReduce=function(t,e,n){var r=[e];if(Je("arg"+n.charAt(0).toUpperCase()+n.slice(1),r,t.rank),!f().getBool("WEBGL_PACK_REDUCE")||t.rank<=2){var o=Ye(t.shape,r),i=o[0],a=I(o[1]),s=t.as2D(-1,a);return this.argReduce(s,n).reshape(i)}return this.argReducePacked(t,n)},e.prototype.argMin=function(t,e){return this.argMinMaxReduce(t,e,"min")},e.prototype.argMax=function(t,e){return this.argMinMaxReduce(t,e,"max")},e.prototype.cumsum=function(t,e,n,r){if(e!==t.rank-1)throw new Error("WebGL cumsum shader expects an inner-most axis="+(t.rank-1)+" but got axis="+e);var o=new fi(t.shape,n,r);return this.compileAndRun(o,[t])},e.prototype.equal=function(t,e){if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(equal(a, b));\n","bool");var n=new Go("return float(a == b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.notEqual=function(t,e){if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(notEqual(a, b));\n","bool");var n=new Go("return float(a != b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.less=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.less(t,e);if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(lessThan(a, b));\n","bool");var n=new Go("return float(a < b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.lessEqual=function(t,e){if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(lessThanEqual(a, b));\n","bool");var n=new Go("return float(a <= b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.greater=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.greater(t,e);if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThan(a, b));\n","bool");var n=new Go("return float(a > b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.greaterEqual=function(t,e){if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(greaterThanEqual(a, b));\n","bool");var n=new Go("return float(a >= b);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.logicalNot=function(t){var e=new Oa(t.shape,"return float(!(x >= 1.0));");return this.compileAndRun(e,[t])},e.prototype.logicalAnd=function(t,e){if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return vec4(\n vec4(greaterThanEqual(a, vec4(1.0))) *\n vec4(greaterThanEqual(b, vec4(1.0))));\n","bool");var n=new Go("return float(a >= 1.0 && b >= 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.logicalOr=function(t,e){if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n return min(\n vec4(greaterThanEqual(a, vec4(1.0))) +\n vec4(greaterThanEqual(b, vec4(1.0))),\n vec4(1.0));\n","bool");var n=new Go("return float(a >= 1.0 || b >= 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e],"bool")},e.prototype.select=function(t,e,n){var r=new va(t.rank,e.shape,e.rank);return this.compileAndRun(r,[t,e,n],kt(e.dtype,n.dtype))},e.prototype.where=function(t){ze("tf.where() in webgl locks the UI thread. Call tf.whereAsync() instead");var e=t.dataSync();return mo(t.shape,e)},e.prototype.topk=function(t,e,n){return po(t.dataSync(),t.shape,t.dtype,e)},e.prototype.min=function(t,e){Je("min",e,t.rank);var n=Ye(t.shape,e),r=n[0],o=I(n[1]),i=t.as2D(-1,o);return this.reduce(i,"min",i.dtype).reshape(r)},e.prototype.minimum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.minimum(t,e);var n=f().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Xo("\n vec4 result = vec4(min(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Go("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return min(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.mod=function(t,e){var n=f().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Xo("\n vec4 result = mod(a, b);\n vec4 isNaN = vec4(equal(b, vec4(0.0)));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Go("if (b == 0.0) return NAN;\n return mod(a, b);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.max=function(t,e){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.max(t,e);Je("max",e,t.rank);var n=Ye(t.shape,e),r=n[0],o=I(n[1]),i=t.as2D(-1,o);return this.reduce(i,"max",i.dtype).reshape(r)},e.prototype.maximum=function(t,e){if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.maximum(t,e);var n=f().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Xo("\n vec4 result = vec4(max(a, b));\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Go("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return max(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.all=function(t,e){Je("all",e,t.rank);var n=Ye(t.shape,e),r=n[0],o=I(n[1]),i=t.as2D(-1,o);return this.reduce(i,"all",i.dtype).reshape(r)},e.prototype.any=function(t,e){Je("any",e,t.rank);var n=Ye(t.shape,e),r=n[0],o=I(n[1]),i=t.as2D(-1,o);return this.reduce(i,"any",i.dtype).reshape(r)},e.prototype.realDivide=function(t,e){if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n // vec4 one = vec4(equal(a, b));\n // return one + (vec4(1.0) - one) * a / b;\n vec4 result = a / b;\n if(a.x == b.x) {\n result.x = 1.;\n }\n if(a.y == b.y) {\n result.y = 1.;\n }\n if(a.z == b.z) {\n result.z = 1.;\n }\n if(a.w == b.w) {\n result.w = 1.;\n }\n\n return result;\n","float32",!0);var n=new Go("\nif (a == b) {\n return 1.0;\n};\nreturn a / b;",t.shape,e.shape);return this.compileAndRun(n,[t,e],"float32")},e.prototype.floorDiv=function(t,e){if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,"\n ivec4 ia = round(a);\n ivec4 ib = round(b);\n bvec4 cond = notEqual(ib, ivec4(0));\n ivec4 result = ivec4(0);\n vec4 s = sign(a) * sign(b);\n\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n if (cond[0]) {\n result[0] = idiv(ia[0], ib[0], s[0]);\n }\n if (cond[1]) {\n result[1] = idiv(ia[1], ib[1], s[1]);\n }\n if (cond[2]) {\n result[2] = idiv(ia[2], ib[2], s[2]);\n }\n if (cond[3]) {\n result[3] = idiv(ia[3], ib[3], s[3]);\n }\n return vec4(result);\n","int32");var n=new Go("\n float s = sign(a) * sign(b);\n int ia = round(a);\n int ib = round(b);\n if (ib != 0) {\n // Windows (D3D) wants guaranteed non-zero int division at compile-time.\n return float(idiv(ia, ib, s));\n } else {\n return NAN;\n }\n",t.shape,e.shape);return this.compileAndRun(n,[t,e],"int32")},e.prototype.add=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,Wo);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.add(t,e);var n=kt(t.dtype,e.dtype);if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,Wo,n);var r=new Go(Wo,t.shape,e.shape);return this.compileAndRun(r,[t,e],n)},e.prototype.packedUnaryOp=function(t,e,n){var r=new qa(t.shape,e);return this.compileAndRun(r,[t],n)},e.prototype.packedBinaryOp=function(t,e,n,r,o){void 0===o&&(o=!1);var i=new Xo(n,t.shape,e.shape,o);return this.compileAndRun(i,[t,e],r)},e.prototype.complexSeparableBinaryOp=function(t,e,n){var r=this,o=this.texData.get(t.dataId),i=this.texData.get(e.dataId),a=[[o.complexTensors.real,i.complexTensors.real],[o.complexTensors.imag,i.complexTensors.imag]].map((function(o){var i=o[0],a=o[1],s=r.makeComplexComponentTensorInfo(t,i),u=r.makeComplexComponentTensorInfo(e,a),c=new Go(n,t.shape,e.shape);return r.compileAndRun(c,[s,u],kt(i.dtype,a.dtype))})),s=a[0],u=a[1],c=this.complex(s,u);return s.dispose(),u.dispose(),c},e.prototype.makeComplexComponentTensorInfo=function(t,e){return{dataId:e.dataId,dtype:e.dtype,shape:t.shape}},e.prototype.addN=function(t){if(1===t.length)return t[0];if(t.length>f().get("WEBGL_MAX_TEXTURES_IN_SHADER")){var e=Math.floor(t.length/2),n=this.addN(t.slice(0,e)),r=this.addN(t.slice(e));return this.addN([n,r])}var o=t.map((function(t){return t.dtype})).reduce((function(t,e){return kt(t,e)})),i=t.map((function(t){return t.shape})),a=f().getBool("WEBGL_PACK")?new go(t[0].shape,i):new vo(t[0].shape,i);return this.compileAndRun(a,t,o)},e.prototype.subtract=function(t,e){if("complex64"===t.dtype&&"complex64"===e.dtype)return this.complexSeparableBinaryOp(t,e,zo);if(this.shouldExecuteOnCPU([t,e]))return this.cpuBackend.subtract(t,e);var n=kt(t.dtype,e.dtype);if(f().getBool("WEBGL_PACK_BINARY_OPERATIONS"))return this.packedBinaryOp(t,e,zo,t.dtype);var r=new Go(zo,t.shape,e.shape);return this.compileAndRun(r,[t,e],n)},e.prototype.pow=function(t,e){var n=f().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Xo("\n // isModRound1 has 1 for components with round(mod(b, 2.0)) == 1, 0 otherwise.\n vec4 isModRound1 = vec4(equal(round(mod(b, 2.0)), ivec4(1)));\n vec4 multiplier = sign(a) * isModRound1 + (vec4(1.0) - isModRound1);\n vec4 result = multiplier * pow(abs(a), b);\n\n // Ensure that a^0 = 1, including 0^0 = 1 as this correspond to TF and JS\n bvec4 isExpZero = equal(b, vec4(0.0));\n result.r = isExpZero.r ? 1.0 : result.r;\n result.g = isExpZero.g ? 1.0 : result.g;\n result.b = isExpZero.b ? 1.0 : result.b;\n result.a = isExpZero.a ? 1.0 : result.a;\n\n vec4 isNaN = vec4(lessThan(a, vec4(0.0))) * vec4(lessThan(floor(b), b));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Go("\nif(a < 0.0 && floor(b) < b){\n return NAN;\n}\nif (b == 0.0) {\n return 1.0;\n}\nreturn (round(mod(b, 2.0)) != 1) ?\n pow(abs(a), b) : sign(a) * pow(abs(a), b);\n",t.shape,e.shape),r=kt(t.dtype,e.dtype);return this.compileAndRun(n,[t,e],r)},e.prototype.ceil=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.ceil(t);if(f().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,ja,t.dtype);var e=new Oa(t.shape,ja);return this.compileAndRun(e,[t])},e.prototype.floor=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.floor(t);if(f().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Fa,t.dtype);var e=new Oa(t.shape,Fa);return this.compileAndRun(e,[t])},e.prototype.sign=function(t){var e=new Oa(t.shape,"\n if (isnan(x)) { return 0.0; }\n return sign(x);\n");return this.compileAndRun(e,[t])},e.prototype.isNaN=function(t){var e=new Oa(t.shape,"return float(isnan(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.isInf=function(t){var e=new Oa(t.shape,"return float(isinf(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.isFinite=function(t){var e=new Oa(t.shape,"return float(!isnan(x) && !isinf(x));");return this.compileAndRun(e,[t],"bool")},e.prototype.round=function(t){var e=new Oa(t.shape,"\n // OpenGL ES does not support round function.\n // The algorithm is based on banker's rounding.\n float base = floor(x);\n if ((x - base) < 0.5) {\n return floor(x);\n } else if ((x - base) > 0.5) {\n return ceil(x);\n } else {\n if (mod(base, 2.0) == 0.0) {\n return base;\n } else {\n return base + 1.0;\n }\n }\n");return this.compileAndRun(e,[t])},e.prototype.exp=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.exp(t);if(f().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Ba,t.dtype);var e=new Oa(t.shape,Ba);return this.compileAndRun(e,[t])},e.prototype.expm1=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.expm1(t);if(f().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,La,t.dtype);var e=new Oa(t.shape,La);return this.compileAndRun(e,[t])},e.prototype.softmax=function(t,e){var n=j([e],t.shape),r=this.max(t,n),o=$e(r.shape,n),i=this.subtract(t,r.reshape(o)),a=this.exp(i),s=this.sum(a,n).reshape(o);return this.realDivide(a,s)},e.prototype.log=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.log(t);if(f().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,"\n vec4 result = log(x);\n vec4 isNaN = vec4(lessThan(x, vec4(0.0)));\n result.r = isNaN.r == 1.0 ? NAN : result.r;\n result.g = isNaN.g == 1.0 ? NAN : result.g;\n result.b = isNaN.b == 1.0 ? NAN : result.b;\n result.a = isNaN.a == 1.0 ? NAN : result.a;\n\n return result;\n",t.dtype);var e=new Oa(t.shape,"if (x < 0.0) return NAN;\n return log(x);");return this.compileAndRun(e,[t])},e.prototype.log1p=function(t){var e=new Oa(t.shape,"return log(1.0 + x);");return this.compileAndRun(e,[t])},e.prototype.sqrt=function(t){var e=new Oa(t.shape,"return sqrt(x);");return this.compileAndRun(e,[t])},e.prototype.rsqrt=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.rsqrt(t);var e=new Oa(t.shape,"return inversesqrt(x);");return this.compileAndRun(e,[t])},e.prototype.reciprocal=function(t){var e=new Oa(t.shape,"return 1.0 / x;");return this.compileAndRun(e,[t])},e.prototype.relu=function(t){var e;return e=f().getBool("WEBGL_PACK")?new qa(t.shape,Wa):new Oa(t.shape,Da),this.compileAndRun(e,[t])},e.prototype.relu6=function(t){var e;return e=f().getBool("WEBGL_PACK")?new qa(t.shape,za):new Oa(t.shape,Na),this.compileAndRun(e,[t])},e.prototype.prelu=function(t,e){var n=f().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Xo(Ho,t.shape,e.shape):new Go(qo,t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.elu=function(t){if(f().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Va,t.dtype);var e=new Oa(t.shape,Pa);return this.compileAndRun(e,[t])},e.prototype.eluDer=function(t,e){var n=f().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Xo("\n vec4 bGTEZero = vec4(greaterThanEqual(b, vec4(0.)));\n return (bGTEZero * a) + ((vec4(1.0) - bGTEZero) * (a * (b + vec4(1.0))));\n",t.shape,e.shape):new Go("return (b >= 1.0) ? a : a * (b + 1.0);",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.selu=function(t){var e=new Oa(t.shape,"\n // Stable and Attracting Fixed Point (0, 1) for Normalized Weights.\n // see: https://arxiv.org/abs/1706.02515\n float scaleAlpha = 1.7580993408473768;\n float scale = 1.0507009873554805;\n return (x >= 0.0) ? scale * x : scaleAlpha * (exp(x) - 1.0);\n");return this.compileAndRun(e,[t])},e.prototype.int=function(t){var e=new Oa(t.shape,"return float(int(x));");return this.compileAndRun(e,[t],"int32")},e.prototype.clip=function(t,e,n){var r,o=(r=f().getBool("WEBGL_PACK_CLIP")?new Yo(t.shape):new Ko(t.shape)).getCustomSetupFunc(e,n);return this.compileAndRun(r,[t],null,o)},e.prototype.abs=function(t){if(this.shouldExecuteOnCPU([t]))return this.cpuBackend.abs(t);if(f().getBool("WEBGL_PACK_UNARY_OPERATIONS"))return this.packedUnaryOp(t,Aa,t.dtype);var e=new Oa(t.shape,Aa);return this.compileAndRun(e,[t])},e.prototype.complexAbs=function(t){var e=this.texData.get(t.dataId),n=new $o(t.shape),r=[this.makeComplexComponentTensorInfo(t,e.complexTensors.real),this.makeComplexComponentTensorInfo(t,e.complexTensors.imag)];return this.compileAndRun(n,r)},e.prototype.sigmoid=function(t){var e=new Oa(t.shape,"return 1.0 / (1.0 + exp(-1.0 * x));");return this.compileAndRun(e,[t])},e.prototype.softplus=function(t){var e=new Oa(t.shape,"\n float epsilon = 1.1920928955078125e-7;\n float threshold = log(epsilon) + 2.0;\n\n bool too_large = x > -threshold;\n bool too_small = x < threshold;\n\n float result;\n float exp_x = exp(x);\n\n if (too_large){\n result = x;\n }\n else if (too_small){\n result = exp_x;\n }\n else{\n result = log(exp_x + 1.0);\n }\n return result;\n");return this.compileAndRun(e,[t])},e.prototype.sin=function(t){var e=new Oa(t.shape,"if (isnan(x)) return x;\n return sin(x);\n");return this.compileAndRun(e,[t])},e.prototype.cos=function(t){var e=new Oa(t.shape,"if (isnan(x)) return x;\n return cos(x);\n");return this.compileAndRun(e,[t])},e.prototype.tan=function(t){var e=new Oa(t.shape,"return tan(x);");return this.compileAndRun(e,[t])},e.prototype.asin=function(t){var e=new Oa(t.shape,"if (isnan(x)) return x;\n if (abs(x) > 1.) {\n return NAN;\n }\n return asin(x);\n");return this.compileAndRun(e,[t])},e.prototype.acos=function(t){var e=new Oa(t.shape,"if (isnan(x)) return x;\n if (abs(x) > 1.) {\n return NAN;\n }\n return acos(x);\n");return this.compileAndRun(e,[t])},e.prototype.atan=function(t){var e=new Oa(t.shape,"if (isnan(x)) return x;\n return atan(x);\n");return this.compileAndRun(e,[t])},e.prototype.atan2=function(t,e){var n=f().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Xo("\n vec4 result = atan(a, b);\n vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0));\n \n result.r = isNaN.r > 0. ? NAN : result.r;\n result.g = isNaN.g > 0. ? NAN : result.g;\n result.b = isNaN.b > 0. ? NAN : result.b;\n result.a = isNaN.a > 0. ? NAN : result.a;\n\n return result;\n",t.shape,e.shape):new Go("\n if (isnan(a)) return a;\n if (isnan(b)) return b;\n\n return atan(a, b);\n",t.shape,e.shape);return this.compileAndRun(n,[t,e])},e.prototype.sinh=function(t){var e=new Oa(t.shape,"\n float e2x = exp(x);\n return (e2x - 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},e.prototype.cosh=function(t){var e=new Oa(t.shape,"\n float e2x = exp(-x);\n return (e2x + 1.0 / e2x) / 2.0;\n");return this.compileAndRun(e,[t])},e.prototype.tanh=function(t){var e=new Oa(t.shape,"\n float e2x = exp(-2.0 * abs(x));\n return sign(x) * (1.0 - e2x) / (1.0 + e2x);\n");return this.compileAndRun(e,[t])},e.prototype.asinh=function(t){var e=new Oa(t.shape,"if (isnan(x)) return x;return log(x + sqrt(x * x + 1.0));");return this.compileAndRun(e,[t])},e.prototype.acosh=function(t){var e=new Oa(t.shape,"if (isnan(x)) return x;\n if (x < 1.0) return NAN;\n return log(x + sqrt(x * x - 1.0));");return this.compileAndRun(e,[t])},e.prototype.atanh=function(t){var e=new Oa(t.shape,"if (isnan(x)) return x;\n if ((x < -1.0) || (x > 1.0)) return NAN;\n return (log(1.0 + x) - log(1.0 - x)) / 2.0;");return this.compileAndRun(e,[t])},e.prototype.erf=function(t){var e=new Oa(t.shape,'\n // Error function is calculated approximately with elementary function.\n // See "Handbook of Mathematical Functions with Formulas,\n // Graphs, and Mathematical Tables", Abramowitz and Stegun.\n float p = 0.3275911;\n float a1 = 0.254829592;\n float a2 = -0.284496736;\n float a3 = 1.421413741;\n float a4 = -1.453152027;\n float a5 = 1.061405429;\n\n float sign = sign(x);\n x = abs(x);\n float t = 1.0 / (1.0 + p * x);\n return sign * (1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x));\n');return this.compileAndRun(e,[t])},e.prototype.step=function(t,e){var n=new Oa(t.shape,function(t){return void 0===t&&(t=0),Ra+"\n return x > 0.0 ? 1.0 : float("+t+");\n "}(e));return this.compileAndRun(n,[t])},e.prototype.conv2dByMatMul=function(t,e,n,r,o,i){var a=t.shape,s=this.texData.get(t.dataId),u=n.inChannels,c=a[0]*a[1]*a[2],l=n.outChannels,h="channelsLast"===n.dataFormat,p=(1===c||1===l)&&u>1e3,d=a[2]%2!=0&&!!s.isPacked;if(p||!f().getBool("WEBGL_LAZILY_UNPACK")||!f().getBool("WEBGL_PACK_BINARY_OPERATIONS")||!d){var m=h?a[0]*a[1]*a[2]:a[0]*a[2]*a[3],v=this.reshape(t,[1,m,n.inChannels]),g=this.reshape(e,[1,n.inChannels,n.outChannels]);return this.reshape(this.fusedBatchMatMul({a:v,b:g,transposeA:!1,transposeB:!1,bias:r,activation:o,preluActivationWeights:i}),n.outShape)}var y=h?a[0]*a[1]*(a[2]+1):a[0]*a[2]*(a[3]+1),b={dataId:t.dataId,shape:[1,y,n.inChannels],dtype:t.dtype},w=s.shape;s.shape=s.shape.slice(),s.shape[s.shape.length-2]++,C(Te(s.shape,b.shape),(function(){return"packed reshape "+s.shape+" to "+b.shape+" isn't free"}));var x=this.reshape(e,[1,n.inChannels,n.outChannels]),_=this.fusedBatchMatMul({a:b,b:x,transposeA:!1,transposeB:!1,bias:r,activation:o,preluActivationWeights:i}),E=this.texData.get(_.dataId);return C(E.isPacked,(function(){return"batchMatMul result is expected to be packed"})),s.shape=w,E.shape=n.outShape,Pt.makeTensorFromDataId(_.dataId,n.outShape,_.dtype)},e.prototype.conv2dWithIm2Row=function(t,e,n,r,o,i){var a=n.filterWidth,s=n.filterHeight,u=n.inChannels,c=n.outWidth,l=n.outHeight,f="channelsLast"===n.dataFormat,h=a*s*u,p=l*c,d=[h,p],m=t.squeeze([0]),v=e.reshape([1,h,-1]),g=new Gi(d,m.shape,n),y=this.compileAndRun(g,[m]).reshape([1,d[0],d[1]]),b=null!=r,w=null!=i,x=o?Xa(o,!0):null,_=new Ji(y.shape,[1,p,n.outChannels],!0,!1,b,x,w),E=[y,v];r&&E.push(r),w&&E.push(i);var C=this.compileAndRun(_,E);return f?C.reshape([1,l,c,n.outChannels]):C.reshape([1,n.outChannels,l,c])},e.prototype.fusedConv2d=function(t){var e=t.input,n=t.filter,r=t.convInfo,o=t.bias,i=t.activation,a=t.preluActivationWeights;if(1===r.filterHeight&&1===r.filterWidth&&1===r.dilationHeight&&1===r.dilationWidth&&1===r.strideHeight&&1===r.strideWidth&&("SAME"===r.padInfo.type||"VALID"===r.padInfo.type))return this.conv2dByMatMul(e,n,r,o,i,a);if(f().getBool("WEBGL_CONV_IM2COL")&&1===e.shape[0])return this.conv2dWithIm2Row(e,n,r,o,i,a);var s=null!=o,u=null!=a,c=i?Xa(i,!1):null,l=new ai(r,s,c,u),h=[e,n];return o&&h.push(o),a&&h.push(a),this.compileAndRun(l,h)},e.prototype.conv2d=function(t,e,n){if(1===n.filterHeight&&1===n.filterWidth&&1===n.dilationHeight&&1===n.dilationWidth&&1===n.strideHeight&&1===n.strideWidth&&("SAME"===n.padInfo.type||"VALID"===n.padInfo.type))return this.conv2dByMatMul(t,e,n);if(f().getBool("WEBGL_CONV_IM2COL")&&1===t.shape[0])return this.conv2dWithIm2Row(t,e,n);var r=new ai(n);return this.compileAndRun(r,[t,e])},e.prototype.conv2dDerInput=function(t,e,n){var r=new ei(n);return this.compileAndRun(r,[t,e])},e.prototype.conv2dDerFilter=function(t,e,n){var r=new ti(n);return this.compileAndRun(r,[t,e])},e.prototype.fusedDepthwiseConv2D=function(t){var e,n=t.input,r=t.filter,o=t.convInfo,i=t.bias,a=t.activation,s=t.preluActivationWeights,u=f().getBool("WEBGL_PACK_DEPTHWISECONV")&&o.strideWidth<=2&&o.outChannels/o.inChannels==1,c=a?Xa(a,u):null,l=[n,r],h=null!=i,p=null!=s;return h&&l.push(i),p&&l.push(s),u?(e=new ci(o,h,c,p),this.compileAndRun(e,l)):(e=new ui(o,h,c,p),this.compileAndRun(e,l))},e.prototype.depthwiseConv2D=function(t,e,n){var r;return f().getBool("WEBGL_PACK_DEPTHWISECONV")&&n.strideWidth<=2&&n.outChannels/n.inChannels==1?(r=new ci(n),this.compileAndRun(r,[t,e])):(r=new ui(n),this.compileAndRun(r,[t,e]))},e.prototype.depthwiseConv2DDerInput=function(t,e,n){var r=new ii(n);return this.compileAndRun(r,[t,e])},e.prototype.depthwiseConv2DDerFilter=function(t,e,n){var r=new oi(n);return this.compileAndRun(r,[t,e])},e.prototype.conv3d=function(t,e,n){var r=new si(n);return this.compileAndRun(r,[t,e])},e.prototype.conv3dDerInput=function(t,e,n){var r=new ri(n);return this.compileAndRun(r,[t,e])},e.prototype.conv3dDerFilter=function(t,e,n){var r=new ni(n);return this.compileAndRun(r,[t,e])},e.prototype.maxPool=function(t,e){var n=new ra(e,"max",!1);return this.compileAndRun(n,[t])},e.prototype.avgPool=function(t,e){var n=new ra(e,"avg",!1);return this.compileAndRun(n,[t],"float32")},e.prototype.maxPoolBackprop=function(t,e,n,r){var o=new ra(r,"max",!0),i=this.compileAndRun(o,[e]),a=new Yi(r),s=this.compileAndRun(a,[t,i],e.dtype);return i.dispose(),s},e.prototype.avgPoolBackprop=function(t,e,n){var r=new jo(n);return this.compileAndRun(r,[t],e.dtype)},e.prototype.cast=function(t,e){return $r(t,e,this)},e.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),o=0,i=0;i<t.rank;i++)i!==e&&(r[o++]=t.shape[i]);var a=new Array(t.rank).fill(0),s=t.shape.slice();s[e]=1;var u=new Array(n);for(i=0;i<u.length;i++)a[e]=i,u[i]=this.slice(t,a,s).reshape(r);return u},e.prototype.avgPool3d=function(t,e){var n=new oa(e,"avg",!1);return this.compileAndRun(n,[t],"float32")},e.prototype.avgPool3dBackprop=function(t,e,n){var r=new Fo(n);return this.compileAndRun(r,[t],e.dtype)},e.prototype.maxPool3d=function(t,e){var n=new oa(e,"max",!1);return this.compileAndRun(n,[t],"float32")},e.prototype.maxPool3dBackprop=function(t,e,n,r){var o=new oa(r,"max",!0),i=this.compileAndRun(o,[e]),a=new $i(r),s=this.compileAndRun(a,[t,i],e.dtype);return i.dispose(),s},e.prototype.reshape=function(t,e){var n=this.texData.get(t.dataId);if(n.isPacked&&!Te(t.shape,e)&&(null===n.texture||!Te(n.shape,e))){var r=this.packedReshape(t,e);return Pt.makeTensorFromDataId(r.dataId,r.shape,r.dtype)}return Jr(t,e)},e.prototype.resizeBilinear=function(t,e,n,r){var o=f().getBool("WEBGL_PACK_IMAGE_OPERATIONS")?new ca(t.shape,e,n,r):new ua(t.shape,e,n,r);return this.compileAndRun(o,[t],"float32")},e.prototype.resizeBilinearBackprop=function(t,e,n){var r=new sa(t,e,n);return this.compileAndRun(r,[t])},e.prototype.resizeNearestNeighbor=function(t,e,n,r){var o=new fa(t.shape,e,n,r);return this.compileAndRun(o,[t])},e.prototype.resizeNearestNeighborBackprop=function(t,e,n){var r=new la(t,e,n);return this.compileAndRun(r,[t])},e.prototype.multinomial=function(t,e,n,r){var o=e?t:Rr(t),i=o.shape[0],a=o.shape[1],s=new Qi(i,a,n),u=s.getCustomSetupFunc(r);return this.compileAndRun(s,[o],"int32",u)},e.prototype.oneHot=function(t,e,n,r){var o=new Zi(t.size,e,n,r);return this.compileAndRun(o,[t])},e.prototype.diag=function(t){var e=new vi(t.size);return this.compileAndRun(e,[t])},e.prototype.nonMaxSuppression=function(t,e,n,r,o){return ze("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead"),io(t.dataSync(),e.dataSync(),n,r,o)},e.prototype.cropAndResize=function(t,e,n,r,o,i){var a=new li(t.shape,e.shape,r,o,i);return this.compileAndRun(a,[t,e,n],"float32")},e.prototype.depthToSpace=function(t,e,n){C(e>1,(function(){return"blockSize should be > 1 for depthToSpace, but was: "+e}));var r=t.shape[0],o="NHWC"===n?t.shape[1]:t.shape[2],i="NHWC"===n?t.shape[2]:t.shape[3],a="NHWC"===n?t.shape[3]:t.shape[1],s=o*e,u=i*e,c=a/(e*e),l=new mi("NHWC"===n?[r,s,u,c]:[r,c,s,u],e,n);return this.compileAndRun(l,[t])},e.prototype.split=function(t,e,n){return fo(t,e,n)},e.prototype.scatterND=function(t,e,n){var r=xr(0,t,n),o=r.sliceRank,i=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,c=[u/a,a],l=t.reshape([i,o]),f=e.reshape([i,a]);if(0===u)return Jr(un([]),n);var h=ln(0),p=new da(i,o,l.rank,f.rank,s,c);return this.compileAndRun(p,[f,l,h]).reshape(n)},e.prototype.sparseToDense=function(t,e,n,r){var o=xr(0,t,n),i=o.sliceRank,a=o.numUpdates,s=o.strides,u=o.outputSize,c=new da(a,i,t.rank,e.rank,s,[u,1],!1);return this.compileAndRun(c,[e,t,r]).reshape(n)},e.prototype.fft=function(t){return this.fftImpl(t,!1)},e.prototype.ifft=function(t){return this.fftImpl(t,!0)},e.prototype.fftImpl=function(t,e){var n=this.texData.get(t.dataId),r=new xi("return real * expR - imag * expI;",t.shape,e),o=new xi("return real * expI + imag * expR;",t.shape,e),i=[this.makeComplexComponentTensorInfo(t,n.complexTensors.real),this.makeComplexComponentTensorInfo(t,n.complexTensors.imag)],a=this.compileAndRun(r,i),s=this.compileAndRun(o,i),u=this.complex(a,s).as2D(t.shape[0],t.shape[1]);return a.dispose(),s.dispose(),u},e.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],o=gr(t,e),i=o[0],a=o[1],s=o[2],u=o[3],c=e.reshape([a,r]),l=t.reshape([t.size/s,s]),f=new Ci(r,u,[a,s]);return this.compileAndRun(f,[l,c]).reshape(i)},e.prototype.fill=function(t,e,n){if("string"===(n=n||Y(e))){var r=L(n,I(t));return r.fill(e),Pt.makeTensor(r,t,n,this)}var o=new _i(t,e),i=o.getCustomSetupFunc(e);return this.compileAndRun(o,[],n,i)},e.prototype.onesLike=function(t){if("string"===t.dtype)throw new Error("onesLike is not supported under string dtype");return this.fill(t.shape,1,t.dtype)},e.prototype.zerosLike=function(t){return this.fill(t.shape,"string"===t.dtype?"":0,t.dtype)},e.prototype.linspace=function(t,e,n){return Qr(t,e,n)},e.prototype.makeTensorInfo=function(t,e){var n=this.write(null,t,e);return this.texData.get(n).usage=null,{dataId:n,shape:t,dtype:e}},e.prototype.makeOutput=function(t,e){var n=this.makeTensorInfo(t,e).dataId;return Pt.makeTensorFromDataId(n,t,e,this)},e.prototype.unpackTensor=function(t){var e=new Ga(t.shape);return this.runWebGLProgram(e,[t],t.dtype)},e.prototype.packTensor=function(t){var e=new ta(t.shape);return this.runWebGLProgram(e,[t],t.dtype,null,!0)},e.prototype.packedReshape=function(t,e){var n=[_e(t.shape)].concat(Ee(t.shape)),r={dtype:t.dtype,shape:n,dataId:t.dataId},o=[_e(e)].concat(Ee(e)),i=new aa(o,n),a=this.runWebGLProgram(i,[r],t.dtype,null,!0);return{dataId:a.dataId,shape:e,dtype:a.dtype}},e.prototype.decode=function(t){var e,n=this.texData.get(t),r=n.isPacked,o=n.shape,i=n.dtype,a=Ce(o);return e=r?new di(a):new pi(a),{dtype:i,shape:o,dataId:this.runWebGLProgram(e,[{shape:a,dtype:i,dataId:t}],i,null,!0).dataId}},e.prototype.runWebGLProgram=function(t,e,n,r,o){var i=this;void 0===o&&(o=!1);var a=this.makeTensorInfo(t.outputShape,n),s=this.texData.get(a.dataId);if(t.packedOutput&&(s.isPacked=!0),t.outPackingScheme===Ft.DENSE){var u=Gt(t.outputShape);s.texShape=u.map((function(t){return 2*t}))}if(null!=t.outTexUsage&&(s.usage=t.outTexUsage),0===I(a.shape))return s.values=B(a.dtype,0),a;var c=[],l=e.map((function(e){if("complex64"===e.dtype)throw new Error("GPGPUProgram does not support complex64 input. For complex64 dtypes, please separate the program into real and imaginary parts.");var n=i.texData.get(e.dataId);if(null==n.texture){if(!t.packedInputs&&I(e.shape)<=f().getNumber("WEBGL_SIZE_UPLOAD_UNIFORM"))return{shape:e.shape,texData:null,isUniform:!0,uniformValues:n.values};t.packedInputs&&(n.isPacked=!0,n.shape=e.shape)}else if(!!n.isPacked!=!!t.packedInputs)e=n.isPacked?i.unpackTensor(e):i.packTensor(e),c.push(e),n=i.texData.get(e.dataId);else if(n.isPacked&&!Te(n.shape,e.shape)){var r=e,o=e.shape;e.shape=n.shape,e=i.packedReshape(e,o),c.push(e),n=i.texData.get(e.dataId),r.shape=o}return i.uploadToGPU(e.dataId),{shape:e.shape,texData:n,isUniform:!1}}));this.uploadToGPU(a.dataId);var h,p={shape:a.shape,texData:s,isUniform:!1},d=function(t,e,n){var r="";e.concat(n).forEach((function(t){var e=null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0,n=t.isUniform?"uniform":t.texData.texShape;r+=t.shape+"_"+n+"_"+e}));var o=t.userCode;return t.constructor.name+"_"+r+"_"+o}(t,l,p),m=this.getAndSaveBinary(d,(function(){return function(t,e,n,r){var o=e.userCode,i=n.map((function(t,n){var r={logicalShape:t.shape,texShape:t.isUniform?null:t.texData.texShape,isUniform:t.isUniform,isPacked:!t.isUniform&&t.texData.isPacked,flatOffset:null};return null!=t.texData&&null!=t.texData.slice&&t.texData.slice.flatOffset>0&&(r.flatOffset=t.texData.slice.flatOffset),{name:e.variableNames[n],shapeInfo:r}})),a=i.map((function(t){return t.shapeInfo})),s={logicalShape:r.shape,texShape:r.texData.texShape,isUniform:!1,isPacked:r.texData.isPacked,flatOffset:null},u=So(i,s,o,e.packedInputs),c=t.createProgram(u),l=null,h=t.getUniformLocation(c,"NAN",!1);1===f().getNumber("WEBGL_VERSION")&&(l=t.getUniformLocation(c,"INFINITY",!1));for(var p={},d=0;d<e.variableNames.length;d++){var m=e.variableNames[d];p[m]=t.getUniformLocation(c,m,!1),p["offset"+m]=t.getUniformLocation(c,"offset"+m,!1)}return{program:e,source:u,webGLProgram:c,uniformLocations:p,inShapeInfos:a,outShapeInfo:s,infLoc:l,nanLoc:h}}(i.gpgpu,t,l,p)})),v=null!=this.activeTimers;if(v&&(h=this.startTimer()),function(t,e,n,r,o){qi(e.inShapeInfos,n),qi([e.outShapeInfo],[r]);var i=r.texData.texture,a=r.texData.texShape;r.texData.isPacked?t.setOutputPackedMatrixTexture(i,a[0],a[1]):t.setOutputMatrixTexture(i,a[0],a[1]),t.setProgram(e.webGLProgram),1===f().getNumber("WEBGL_VERSION")&&null!==e.infLoc&&t.gl.uniform1f(e.infLoc,1/0),null!==e.nanLoc&&t.gl.uniform1f(e.nanLoc,NaN),n.forEach((function(n,r){var o=e.program.variableNames[r],i=e.uniformLocations[o],a=e.uniformLocations["offset"+o];if(null!=i)if(n.isUniform)if(I(n.shape)<2)t.gl.uniform1f(i,n.uniformValues[0]);else{var s=n.uniformValues;s instanceof Float32Array||(s=new Float32Array(s)),t.gl.uniform1fv(i,s)}else null!=n.texData.slice&&null!=a&&t.gl.uniform1i(a,n.texData.slice.flatOffset),t.setInputMatrixTexture(n.texData.texture,i,r)})),null!=o&&o(t,e.webGLProgram),t.executeProgram()}(this.gpgpu,m,l,p,r),c.forEach((function(t){return i.disposeData(t.dataId)})),v&&(h=this.endTimer(h),this.activeTimers.push({name:t.constructor.name,query:this.getQueryTime(h)})),!f().getBool("WEBGL_LAZILY_UNPACK")&&s.isPacked&&!1===o){var g=this.unpackTensor(a);return this.disposeData(a.dataId),g}return a},e.prototype.compileAndRun=function(t,e,n,r,o){void 0===o&&(o=!1),n=n||e[0].dtype;var i=this.runWebGLProgram(t,e,n,r,o);return Pt.makeTensorFromDataId(i.dataId,i.shape,i.dtype)},e.prototype.getAndSaveBinary=function(t,e){return t in this.binaryCache||(this.binaryCache[t]=e()),this.binaryCache[t]},e.prototype.getTextureManager=function(){return this.textureManager},e.prototype.dispose=function(){var t=this;this.disposed||(f().getBool("IS_TEST")||Object.keys(this.binaryCache).forEach((function(e){t.gpgpu.deleteProgram(t.binaryCache[e].webGLProgram),delete t.binaryCache[e]})),this.textureManager.dispose(),null!=this.canvas&&"undefined"!=typeof HTMLCanvasElement&&this.canvas instanceof HTMLCanvasElement?this.canvas.remove():this.canvas=null,this.gpgpuCreatedLocally&&(this.gpgpu.program=null,this.gpgpu.dispose()),this.disposed=!0)},e.prototype.floatPrecision=function(){var t=this;return null==this.floatPrecisionValue&&(this.floatPrecisionValue=Ue((function(){if(!f().get("WEBGL_RENDER_FLOAT32_ENABLED")){var e=f().getBool("DEBUG");f().set("DEBUG",!1);var n=t.abs(ln(1e-8)).dataSync()[0];if(f().set("DEBUG",e),n>0)return 32}return 16}))),this.floatPrecisionValue},e.prototype.epsilon=function(){return 32===this.floatPrecision()?1e-7:1e-4},e.prototype.uploadToGPU=function(t){var e,n=this.texData.get(t),r=n.shape,o=n.dtype,i=n.values,a=n.texture,s=n.usage,u=n.isPacked;if(null==a){var c,l=null!=this.activeTimers;l&&(c=rt());var f=n.texShape;if(null==f&&(f=Se(r,u),n.texShape=f),null!=i){var h=Ce(r),p=void 0,d=f[1],m=f[0],v=i instanceof Uint8Array;u?(d=(e=Ht(f[0],f[1]))[0],m=e[1],p=new wi(h,[m,d],v)):p=new bi(h,[m,d],v);var g=this.makeTensorInfo([m,d],o);this.texData.get(g.dataId).usage=v?Bt.PIXELS:Bt.UPLOAD,this.gpgpu.uploadDenseMatrixToTexture(this.getTexture(g.dataId),d,m,i);var y=this.runWebGLProgram(p,[g],o,null,!0),b=this.texData.get(y.dataId);n.texture=b.texture,n.texShape=b.texShape,n.isPacked=b.isPacked,n.usage=b.usage,this.disposeData(g.dataId),this.texData.delete(y.dataId),n.values=null,l&&(this.uploadWaitMs+=rt()-c)}else{var w=this.acquireTexture(f,s,o,u);n.texture=w}}},e.prototype.convertAndCacheOnCPU=function(t,e){var n=this.texData.get(t),r=n.dtype;return this.releaseGPUData(t),null!=e&&(n.values=function(t,e){if("float32"===e||"complex64"===e)return t;if("int32"===e||"bool"===e){for(var n="int32"===e?new Int32Array(t.length):new Uint8Array(t.length),r=0;r<n.length;++r)n[r]=Math.round(t[r]);return n}throw new Error("Unknown dtype "+e)}(e,r)),n.values},e.prototype.acquireTexture=function(t,e,n,r){if(this.numBytesInGPU+=this.computeBytes(t,n),!this.warnedAboutMemory&&this.numBytesInGPU>1024*this.numMBBeforeWarning*1024){var o=(this.numBytesInGPU/1024/1024).toFixed(2);this.warnedAboutMemory=!0,console.warn("High memory usage in GPU: "+o+" MB, most likely due to a memory leak")}return this.textureManager.acquireTexture(t,e,r)},e.prototype.computeBytes=function(t,e){return t[0]*t[1]*q(e)},e}(Nr);Mt()&&Pt.registerBackend("webgl",(function(){return new Ka}),2);var Ya=rn({square_:function(t){var e=Ge(t,"x","square"),n=[e];return Pt.runKernelFunc((function(t,n){return n([e]),t.square(e)}),{x:e},null,"Square",{},n,[])}}),$a="SquaredDifference",Ja=rn({squaredDifference_:function(t,e){var n,r=Ge(t,"a","squaredDifference"),o=Ge(e,"b","squaredDifference");n=It(r,o),r=n[0],o=n[1],Fr(r.shape,o.shape);var i={a:r,b:o},a=[r,o];return Pt.runKernelFunc((function(t,e){var n=t.squaredDifference(r,o);return e([r,o]),n}),i,(function(t,e){var n=e[0],r=e[1],o=ln(2);return{a:function(){return t.mul(n.sub(r).mul(o))},b:function(){return t.mul(r.sub(n).mul(o))}}}),$a,{},a,[])}}),Qa=rn({abs_:function(t){var e=Ge(t,"x","abs");return"complex64"===e.dtype?Pt.runKernelFunc((function(t){return t.complexAbs(e)}),{$x:e}):Pt.runKernelFunc((function(t,n){var r=t.abs(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return t.mul(n.toFloat().step(-1))}}}),"Abs")}}),Za=rn({acos_:function(t){var e=Ge(t,"x","acos");return Pt.runKernelFunc((function(t,n){var r=t.acos(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.divStrict(ln(1).sub(n.toFloat().square()).sqrt()).neg()}}}))}}),ts=rn({acosh_:function(t){var e=Ge(t,"x","acosh");return Pt.runKernelFunc((function(t,n){var r=t.acosh(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.divStrict(n.toFloat().square().sub(1).sqrt())}}}))}}),es=rn({asin_:function(t){var e=Ge(t,"x","asin");return Pt.runKernelFunc((function(t,n){var r=t.asin(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.divStrict(ln(1).sub(n.toFloat().square()).sqrt())}}}))}}),ns=rn({asinh_:function(t){var e=Ge(t,"x","asinh");return Pt.runKernelFunc((function(t,n){var r=t.asinh(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.divStrict(ln(1).add(n.toFloat().square()).sqrt())}}}))}}),rs=rn({atan_:function(t){var e=Ge(t,"x","atan");return Pt.runKernelFunc((function(t,n){var r=t.atan(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat().square().add(1))}}}))}}),os=rn({atanh_:function(t){var e=Ge(t,"x","atanh");return Pt.runKernelFunc((function(t,n){var r=t.atanh(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.div(ln(1).sub(n.toFloat().square()))}}}))}}),is=rn({ceil_:function(t){var e=Ge(t,"x","ceil");return Pt.runKernelFunc((function(t){return t.ceil(e)}),{$x:e},(function(t){return{$x:function(){return wn(t)}}}))}}),as=rn({clipByValue_:function(t,e,n){var r=Ge(t,"x","clipByValue");C(e<=n,(function(){return"Error in clip: min ("+e+") must be less than or equal to max ("+n+")."}));var o=[r],i={min:e,max:n};return Pt.runKernelFunc((function(t,o){var i=t.clip(r,e,n);return o([r]),i}),{x:r},(function(t,r){var o=r[0];return{x:function(){return t.where(o.greaterEqual(e).logicalAnd(o.lessEqual(n)),wn(t))}}}),"ClipByValue",i,o)}}),ss=rn({cos_:function(t){var e=Ge(t,"x","cos"),n=[e];return Pt.runKernelFunc((function(t,n){var r=t.cos(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return n.toFloat().sin().neg().mul(t)}}}),"Cos",{},n)}}),us=rn({cosh_:function(t){var e=Ge(t,"x","cosh");return Pt.runKernelFunc((function(t,n){var r=t.cosh(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return n.toFloat().sinh().mulStrict(t)}}}))}}),cs=rn({erf_:function(t){var e=Ge(t,"x","erf");return C("int32"===e.dtype||"float32"===e.dtype,(function(){return"Input dtype must be `int32` or `float32`."})),"int32"===e.dtype&&(e=e.toFloat()),Pt.runKernelFunc((function(t,n){var r=t.erf(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.mul(n.square().neg().exp().mul(2/Math.sqrt(Math.PI)))}}}))}}),ls=rn({exp_:function(t){var e=Ge(t,"x","exp");return Pt.runKernelFunc((function(t,n){var r=t.exp(e);return n([r]),r}),{x:e},(function(t,e){return{x:function(){return t.mulStrict(e[0])}}}),"Exp",{},[],[!0])}}),fs=rn({expm1_:function(t){var e=Ge(t,"x","expm1");return Pt.runKernelFunc((function(t,n){var r=t.expm1(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.mul(n.exp())}}}))}}),hs=rn({floor_:function(t){var e=Ge(t,"x","floor");return Pt.runKernelFunc((function(t){return t.floor(e)}),{$x:e},(function(t){return{$x:function(){return wn(t)}}}))}}),ps=rn({log_:function(t){var e=Ge(t,"x","log"),n=[e];return Pt.runKernelFunc((function(t,n){var r=t.log(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return t.div(n.toFloat())}}}),"Log",{},n)}}),ds=rn({log1p_:function(t){var e=Ge(t,"x","log1p");return Pt.runKernelFunc((function(t,n){var r=t.log1p(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.div(n.add(1))}}}))}}),ms=rn({logSigmoid_:function(t){var e=Ge(t,"x","logSigmoid");return Pt.runKernelFunc((function(t,n){var r=t.softplus(e.neg()).neg();return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.mul(n.neg().sigmoid())}}}))}}),vs=rn({neg_:function(t){var e=Ge(t,"x","neg"),n=[e];return Pt.runKernelFunc((function(t){return t.neg(e)}),{x:e},(function(t){return{x:function(){return t.neg()}}}),"Neg",{},n)}}),gs=rn({reciprocal_:function(t){var e=Ge(t,"x","reciprocal");return Pt.runKernelFunc((function(t,n){var r=t.reciprocal(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.div(n.square().neg())}}}))}}),ys=rn({round_:function(t){var e=Ge(t,"x","round");return Pt.runKernelFunc((function(t){return t.round(e)}),{$x:e},(function(t){return{$x:function(){return wn(t)}}}))}}),bs=rn({rsqrt_:function(t){var e=Ge(t,"x","rsqrt"),n=[e];return Pt.runKernelFunc((function(t,n){var r=t.rsqrt(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return t.div(n.pow(1.5).mul(2)).neg()}}}),"Rsqrt",{},n)}}),ws=rn({sigmoid_:function(t){var e=Ge(t,"x","sigmoid");return Pt.runKernelFunc((function(t,n){var r=t.sigmoid(e);return n([r]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return t.mul(n.mul(ln(1).sub(n)))}}}),"Sigmoid")}}),xs=rn({sign_:function(t){var e=Ge(t,"x","sign");return Pt.runKernelFunc((function(t){return t.sign(e)}),{$x:e},(function(t){return{$x:function(){return wn(t)}}}))}}),_s=rn({isNaN_:function(t){var e=Ge(t,"x","isNaN");return Pt.runKernelFunc((function(t){return t.isNaN(e)}),{$x:e},(function(t){return{$x:function(){return wn(t)}}}))}}),Es=rn({isInf_:function(t){var e=Ge(t,"x","isInf");return Pt.runKernelFunc((function(t){return t.isInf(e)}),{$x:e},(function(t){return{$x:function(){return wn(t)}}}))}}),Cs=rn({isFinite_:function(t){var e=Ge(t,"x","isFinite");return Pt.runKernelFunc((function(t){return t.isFinite(e)}),{$x:e},(function(t){return{$x:function(){return wn(t)}}}))}}),Ss=rn({sin_:function(t){var e=Ge(t,"x","sin"),n=[e];return Pt.runKernelFunc((function(t,n){var r=t.sin(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return n.toFloat().cos().mul(t)}}}),"Sin",{},n)}}),ks=rn({sinh_:function(t){var e=Ge(t,"x","sinh");return Pt.runKernelFunc((function(t,n){var r=t.sinh(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return n.toFloat().cosh().mulStrict(t)}}}))}}),Ts=rn({softplus_:function(t){var e=Ge(t,"x","softplus");return Pt.runKernelFunc((function(t,n){var r=t.softplus(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.mul(n.sigmoid())}}}))}}),Is=rn({sqrt_:function(t){var e=Ge(t,"x","sqrt");return Pt.runKernelFunc((function(t,n){var r=t.sqrt(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.div(n.toFloat().sqrt().mul(2))}}}))}}),Os=rn({step_:function(t,e){void 0===e&&(e=0);var n=Ge(t,"x","step");return Pt.runKernelFunc((function(t){return t.step(n,e)}),{$x:n},(function(t){return{$x:function(){return wn(t)}}}))}}),Rs=rn({tan_:function(t){var e=Ge(t,"x","tan");return Pt.runKernelFunc((function(t,n){var r=t.tan(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return t.div(n.cos().square())}}}))}}),As=rn({tanh_:function(t){var e=Ge(t,"x","tanh");return Pt.runKernelFunc((function(t,n){var r=t.tanh(e);return n([r]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return ln(1).sub(n.square()).mulStrict(t)}}}),"Tanh",{},null,[!0])}});function Ds(t,e,n,r,o,i){var a,s,u=Ge(t,"x","batchNorm"),c=Ge(e,"mean","batchNorm"),l=Ge(n,"variance","batchNorm");return null!=o&&(a=Ge(o,"scale","batchNorm")),null!=r&&(s=Ge(r,"offset","batchNorm")),C(2===u.rank,(function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."})),C(2===c.rank||1===c.rank,(function(){return"Error in batchNorm2D: mean must be rank 2 or rank 1 but got rank "+c.rank+"."})),C(2===l.rank||1===l.rank,(function(){return"Error in batchNorm2D: variance must be rank 2 or rank 1 but got rank "+l.rank+"."})),null!=a&&C(2===a.rank||1===a.rank,(function(){return"Error in batchNorm2D: scale must be rank 2 or rank 1 but got rank "+a.rank+"."})),null!=s&&C(2===s.rank||1===s.rank,(function(){return"Error in batchNorm2D: offset must be rank 2 or rank 1 but got rank "+s.rank+"."})),Ms(u,c,l,s,a,i)}function Ns(t,e,n,r,o,i){var a,s,u=Ge(t,"x","batchNorm"),c=Ge(e,"mean","batchNorm"),l=Ge(n,"variance","batchNorm");return null!=o&&(a=Ge(o,"scale","batchNorm")),null!=r&&(s=Ge(r,"offset","batchNorm")),C(3===u.rank,(function(){return"Error in batchNorm3D: x must be rank 3 but got rank "+u.rank+"."})),C(3===c.rank||1===c.rank,(function(){return"Error in batchNorm3D: mean must be rank 3 or rank 1 but got rank "+c.rank+"."})),C(3===l.rank||1===l.rank,(function(){return"Error in batchNorm3D: variance must be rank 3 or rank 1 but got rank "+l.rank+"."})),null!=a&&C(3===a.rank||1===a.rank,(function(){return"Error in batchNorm3D: scale must be rank 3 or rank 1 but got rank "+a.rank+"."})),null!=s&&C(3===s.rank||1===s.rank,(function(){return"Error in batchNorm3D: offset must be rank 3 or rank 1 but got rank "+s.rank+"."})),Ms(u,c,l,s,a,i)}function Ps(t,e,n,r,o,i){var a,s,u=Ge(t,"x","batchNorm"),c=Ge(e,"mean","batchNorm"),l=Ge(n,"variance","batchNorm");return null!=o&&(a=Ge(o,"scale","batchNorm")),null!=r&&(s=Ge(r,"offset","batchNorm")),C(4===u.rank,(function(){return"Error in batchNorm4D: x must be rank 4 but got rank "+u.rank+"."})),C(4===c.rank||1===c.rank,(function(){return"Error in batchNorm4D: mean must be rank 4 or rank 1 but got rank "+c.rank+"."})),C(4===l.rank||1===l.rank,(function(){return"Error in batchNorm4D: variance must be rank 4 or rank 1 but got rank "+l.rank+"."})),null!=a&&C(4===a.rank||1===a.rank,(function(){return"Error in batchNorm4D: scale must be rank 4 or rank 1 but got rank "+a.rank+"."})),null!=s&&C(4===s.rank||1===s.rank,(function(){return"Error in batchNorm4D: offset must be rank 4 or rank 1 but got rank "+s.rank+"."})),Ms(u,c,l,s,a,i)}function Ms(t,e,n,r,o,i){null==i&&(i=.001);var a,s,u,c=Ge(t,"x","batchNorm"),l=Ge(e,"mean","batchNorm"),f=Ge(n,"variance","batchNorm");null!=o&&(a=Ge(o,"scale","batchNorm")),null!=r&&(s=Ge(r,"offset","batchNorm")),C(l.rank===f.rank,(function(){return"Batch normalization gradient requires mean and variance to have equal ranks."})),C(null==s||l.rank===s.rank,(function(){return"Batch normalization gradient requires mean and offset to have equal ranks."})),C(null==a||l.rank===a.rank,(function(){return"Batch normalization gradient requires mean and scale to have equal ranks."})),u=0===c.rank||1===c.rank?c.as4D(1,1,1,c.size):2===c.rank?c.as4D(1,1,c.shape[0],c.shape[1]):3===c.rank?c.as4D(1,c.shape[0],c.shape[1],c.shape[2]):c;var h=[c,l,f,a];return Pt.runKernelFunc((function(t,e){var n=t.batchNormalization(u,js(l),js(f),i,js(a),js(s));return e([c,l,f,a]),n}),{x:c,mean:l,variance:f,scale:a,offset:s},(function(t,e){var n=e,r=n[0],o=n[1],a=n[2],s=n[3],c=null==s?ln(1):s,l=jr(o.shape,u.shape),f=[];if(1===o.rank){for(var h=0;h<u.shape.length-1;++h)f.push(u.shape[h]);f.push(1)}var p=r.sub(o),d=t.mul(c),m=bs(a.add(ln(i))),v=m.mul(m).mul(m).mul(ln(-.5));return{x:function(){return 1===o.rank?t.mul(cr(m.as4D(1,1,1,o.shape[0]),f)).mul(c).reshape(r.shape):t.mul(m).mul(c).reshape(r.shape)},mean:function(){var t=m.mul(ln(-1)).mul(d);return 1===o.rank&&(t=t.sum(l)),t.reshape(o.shape)},variance:function(){var t=v.mul(p).mul(d);return 1===o.rank&&(t=t.sum(l)),t.reshape(o.shape)},scale:function(){var e=p.mul(m),n=t.mul(e);return 1===o.rank&&(n=n.sum(l)),n.reshape(o.shape)},offset:function(){var e=t;return 1===o.rank&&(e=e.sum(l)),e.reshape(o.shape)}}}),"BatchNormalization",{varianceEpsilon:i},h).reshape(c.shape)}function js(t){return null==t?null:0===t.rank?t.as1D():1===t.rank?t:2===t.rank?t.as4D(1,1,t.shape[0],t.shape[1]):3===t.rank?t.as4D(1,t.shape[0],t.shape[1],t.shape[2]):t}function Fs(){Le("tf.batchNormalization() is going away. Use tf.batchNorm() instead, and note the positional argument change of scale, offset, and varianceEpsilon")}var Bs=rn({batchNormalization2d_:function(t,e,n,r,o,i){return void 0===r&&(r=.001),Fs(),Ds(t,e,n,i,o,r)}}),Ls=rn({batchNormalization3d_:function(t,e,n,r,o,i){return void 0===r&&(r=.001),Fs(),Ns(t,e,n,i,o,r)}}),Us=rn({batchNormalization4d_:function(t,e,n,r,o,i){return void 0===r&&(r=.001),Fs(),Ps(t,e,n,i,o,r)}}),Ws=rn({batchNormalization_:function(t,e,n,r,o,i){return void 0===r&&(r=.001),Fs(),Ms(t,e,n,i,o,r)}}),zs=rn({batchNorm_:Ms}),Vs=rn({batchNorm2d_:Ds}),qs=rn({batchNorm3d_:Ns}),Gs=rn({batchNorm4d_:Ps}),Hs=rn({logicalAnd_:function(t,e){var n=Ge(t,"a","logicalAnd","bool"),r=Ge(e,"b","logicalAnd","bool");return Fr(n.shape,r.shape),Pt.runKernelFunc((function(t){return t.logicalAnd(n,r)}),{a:n,b:r},null,"LogicalAnd")}}),Xs=rn({logicalNot_:function(t){var e=Ge(t,"x","logicalNot","bool");return Pt.runKernelFunc((function(t){return t.logicalNot(e)}),{$x:e})}}),Ks=rn({logicalOr_:function(t,e){var n=Ge(t,"a","logicalOr","bool"),r=Ge(e,"b","logicalOr","bool");return Fr(n.shape,r.shape),Pt.runKernelFunc((function(t){return t.logicalOr(n,r)}),{$a:n,$b:r})}}),Ys=rn({logicalXor_:function(t,e){var n=Ge(t,"a","logicalXor","bool"),r=Ge(e,"b","logicalXor","bool");return Fr(n.shape,r.shape),Ks(t,e).logicalAnd(Hs(t,e).logicalNot())}}),$s=rn({where_:function(t,e,n){var r=Ge(e,"a","where"),o=Ge(n,"b","where"),i=Ge(t,"condition","where","bool");return S(r.shape,o.shape,"Error in where: "),1===i.rank?C(i.shape[0]===r.shape[0],(function(){return"The first dimension of `a` must match the size of `condition`."})):S(i.shape,o.shape,"Error in where: "),Pt.runKernelFunc((function(t,e){var n=t.select(i,r,o);return e([i]),n}),{$condition:i,$a:r,$b:o},(function(t,e){var n=e[0];return{$condition:function(){return wn(n).toFloat()},$a:function(){return t.mul(n.cast(t.dtype))},$b:function(){return t.mul(n.logicalNot().cast(t.dtype))}}}))}}),Js=function(t){return s(this,void 0,void 0,(function(){var e,n,r;return u(this,(function(o){switch(o.label){case 0:return[4,(e=Ge(t,"condition","whereAsync","bool")).data()];case 1:return n=o.sent(),r=mo(e.shape,n),t!==e&&e.dispose(),[2,r]}}))}))},Qs=rn({add_:function(t,e){var n,r=Ge(t,"a","add"),o=Ge(e,"b","add");n=It(r,o),r=n[0],o=n[1];var i=Fr(r.shape,o.shape);return Pt.runKernelFunc((function(t){return t.add(r,o)}),{a:r,b:o},(function(t){return{a:function(){var e=t,n=jr(r.shape,i);return n.length>0&&(e=e.sum(n)),e.reshape(r.shape)},b:function(){var e=t,n=jr(o.shape,i);return n.length>0&&(e=e.sum(n)),e.reshape(o.shape)}}}),"Add")}}),Zs=rn({addN_:function(t){C(Array.isArray(t),(function(){return"The argument passed to tf.addN() must be a list of tensors"})),C(t.length>=1,(function(){return"Must pass at least one tensor to tf.addN(), but got "+t.length}));var e=t.map((function(t,e){return Ge(t,"tensors"+e,"addN")})),n=e[0];e.forEach((function(t){if(t.dtype!==n.dtype)throw new Error("All tensors passed to tf.addN() must have the same dtype")})),e.forEach((function(t){if(!O(t.shape,n.shape))throw new Error("All tensors passed to tf.addN() must have the same shape")}));var r=e;return Pt.runKernelFunc((function(t){return t.addN(e)}),r,(function(t){var n={};return e.forEach((function(e,r){n[r]=function(){return t.clone()}})),n}),"AddN")}}),tu=rn({addStrict_:function(t,e){var n=Ge(t,"a","addStrict"),r=Ge(e,"b","addStrict");return S(n.shape,r.shape,"Error in addStrict: "),n.add(r)}}),eu=rn({atan2_:function(t,e){var n,r=Ge(t,"a","atan2"),o=Ge(e,"b","atan2");n=It(r,o),r=n[0],o=n[1];var i=Fr(r.shape,o.shape);return Pt.runKernelFunc((function(t,e){var n=t.atan2(r,o);return e([r,o]),n}),{$a:r,$b:o},(function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=Qs(n.square(),r.square()),o=t.mul(r.div(e)),a=jr(n.shape,i);return a.length>0&&(o=o.sum(a)),o.reshape(n.shape)},$b:function(){var e=Qs(n.square(),r.square()),o=vs(t.mul(n.div(e))),a=jr(r.shape,i);return a.length>0&&(o=o.sum(a)),o.reshape(r.shape)}}}))}}),nu=rn({div_:function(t,e){var n,r=Ge(t,"a","div"),o=Ge(e,"b","div");if(n=It(r,o),r=n[0],o=n[1],"int32"===r.dtype&&"int32"===o.dtype)return iu(r,o);var i=Fr(r.shape,o.shape);return Pt.runKernelFunc((function(t,e){var n=t.realDivide(r,o);return e([r,o]),n}),{a:r,b:o},(function(t,e){var n=e[0],r=e[1];return{a:function(){var e=t.div(r.toFloat()),o=jr(n.shape,i);return o.length>0?e.sum(o).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),o=jr(r.shape,i);o.length>0&&(e=e.sum(o).reshape(r.shape));var a=r.square();return e.div(a.toFloat()).neg()}}}),"Div")}}),ru=rn({divNoNan_:function(t,e){var n,r=Ge(t,"a","div"),o=Ge(e,"b","div");r=(n=It(r,o))[0],o=n[1];var i=nu(r,o),a=wn(i),s=o.equal(a);return $s(s,a,i)}}),ou=rn({divStrict_:function(t,e){var n=Ge(t,"a","div"),r=Ge(e,"b","div");return S(n.shape,r.shape,"Error in divideStrict: "),n.div(r)}}),iu=rn({floorDiv_:function(t,e){var n,r=Ge(t,"a","floorDiv"),o=Ge(e,"b","floorDiv");n=It(r,o),r=n[0],o=n[1];var i=Fr(r.shape,o.shape);return Pt.runKernelFunc((function(t,e){var n=t.floorDiv(r,o);return e([r,o]),n}),{a:r,b:o},(function(t,e){var n=e[0],r=e[1];return{a:function(){var e=t.div(r.toFloat()),o=jr(n.shape,i);return o.length>0?e.sum(o).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),o=jr(r.shape,i);o.length>0&&(e=e.sum(o).reshape(r.shape));var a=r.square();return e.div(a.toFloat()).neg()}}}),"FloorDiv")}}),au=rn({maximum_:function(t,e){var n,r=Ge(t,"a","maximum"),o=Ge(e,"b","maximum");return n=It(r,o),r=n[0],o=n[1],"bool"===r.dtype&&(r=r.toInt(),o=o.toInt()),Fr(r.shape,o.shape),Pt.runKernelFunc((function(t,e){var n=t.maximum(r,o);return e([r,o]),n}),{a:r,b:o},(function(t,e){var n=e[0],r=e[1];return{a:function(){return t.mul(n.greaterEqual(r).toFloat())},b:function(){return t.mul(n.less(r).toFloat())}}}),"Maximum")}}),su=rn({maximumStrict_:function(t,e){var n=Ge(t,"a","maximumStrict"),r=Ge(e,"b","maximumStrict");return S(n.shape,r.shape,"Error in maximumStrict: "),n.maximum(r)}}),uu=rn({minimum_:function(t,e){var n,r=Ge(t,"a","minimum"),o=Ge(e,"b","minimum");return n=It(r,o),r=n[0],o=n[1],"bool"===r.dtype&&(r=r.toInt(),o=o.toInt()),Fr(r.shape,o.shape),Pt.runKernelFunc((function(t,e){var n=t.minimum(r,o);return e([r,o]),n}),{a:r,b:o},(function(t,e){var n=e[0],r=e[1];return{a:function(){return t.mul(n.lessEqual(r).toFloat())},b:function(){return t.mul(n.greater(r).toFloat())}}}),"Minimum")}}),cu=rn({minimumStrict_:function(t,e){var n=Ge(t,"a","minimumStrict"),r=Ge(e,"b","minimumStrict");return S(n.shape,r.shape,"Error in minimumStrict: "),n.minimum(r)}}),lu=rn({mod_:function(t,e){var n,r=Ge(t,"a","mod"),o=Ge(e,"b","mod");n=It(r,o),r=n[0],o=n[1];var i=Fr(r.shape,o.shape);return Pt.runKernelFunc((function(t,e){var n=t.mod(r,o);return e([r,o]),n}),{$a:r,$b:o},(function(t,e){var n=e[0],r=e[1];return{$a:function(){var e=jr(n.shape,i);return e.length>0?t.sum(e).reshape(n.shape):t},$b:function(){var e=t.mul(n.div(r).floor().neg()),o=jr(r.shape,i);return o.length>0?e.sum(o).reshape(r.shape):e}}}))}}),fu=rn({modStrict_:function(t,e){var n=Ge(t,"a","modStrict"),r=Ge(e,"b","modStrict");return S(n.shape,r.shape,"Error in modStrict: "),n.mod(r)}}),hu=rn({mul_:function(t,e){var n,r=Ge(t,"a","mul"),o=Ge(e,"b","mul");n=It(r,o),r=n[0],o=n[1];var i=Fr(r.shape,o.shape);return Pt.runKernelFunc((function(t,e){var n=t.multiply(r,o);return e([r,o]),n}),{a:r,b:o},(function(t,e){var n=e[0],r=e[1];return{a:function(){var e=t.mul(r.toFloat()),o=jr(n.shape,i);return o.length>0?e.sum(o).reshape(n.shape):e},b:function(){var e=t.mul(n.toFloat()),o=jr(r.shape,i);return o.length>0?e.sum(o).reshape(r.shape):e}}}),"Mul")}}),pu=rn({mulStrict_:function(t,e){var n=Ge(t,"a","mul"),r=Ge(e,"b","mul");return S(n.shape,r.shape,"Error in multiplyStrict: "),n.mul(r)}}),du=rn({pow_:function(t,e){var n,r=Ge(t,"base","pow"),o=Ge(e,"exp","pow");n=It(r,o),r=n[0],o=n[1];var i=Fr(r.shape,o.shape),a=[r,o];return Pt.runKernelFunc((function(t,e){var n=t.pow(r,o);return e([r,o,n]),n}),{a:r,b:o},(function(t,e){var n=e[0],r=e[1],o=e[2];return{a:function(){var e=r.toFloat(),o=t.mul(e.mul(n.pow(e.sub(ln(1))))),a=jr(n.shape,i);return a.length>0&&(o=o.sum(a)),o.reshape(n.shape)},b:function(){var e=n.greater(0),a=n.log().where(e,wn(n)),s=t.mul(o.mul(a)),u=jr(r.shape,i);return u.length>0&&(s=s.sum(u)),s.reshape(r.shape)}}}),"Pow",{},a,[!0])}}),mu=rn({powStrict_:function(t,e){return S(t.shape,e.shape,"Error in powStrict: "),t.pow(e)}}),vu=rn({squaredDifferenceStrict_:function(t,e){var n=Ge(t,"a","squaredDifferenceStrict"),r=Ge(e,"b","squaredDifferenceStrict");return S(n.shape,r.shape,"Error in squaredDifferenceStrict: "),n.squaredDifference(r)}}),gu=rn({sub_:function(t,e){var n,r=Ge(t,"a","sub"),o=Ge(e,"b","sub");n=It(r,o),r=n[0],o=n[1];var i=Fr(r.shape,o.shape);return Pt.runKernelFunc((function(t){return t.subtract(r,o)}),{a:r,b:o},(function(t){return{a:function(){var e=t,n=jr(r.shape,i);return n.length>0&&(e=e.sum(n)),e.reshape(r.shape)},b:function(){var e=t,n=jr(o.shape,i);return n.length>0&&(e=e.sum(n)),e.neg().reshape(o.shape)}}}),"Sub")}}),yu=rn({subStrict_:function(t,e){var n=Ge(t,"a","subStrict"),r=Ge(e,"b","subStrict");return S(n.shape,r.shape,"Error in subStrict: "),n.sub(r)}}),bu=rn({equal_:function(t,e){var n,r=Ge(t,"a","equal"),o=Ge(e,"b","equal");return n=It(r,o),r=n[0],o=n[1],Fr(r.shape,o.shape),Pt.runKernelFunc((function(t){return t.equal(r,o)}),{$a:r,$b:o})}}),wu=rn({equalStrict_:function(t,e){var n=Ge(t,"a","equalStrict"),r=Ge(e,"b","equalStrict");return S(n.shape,r.shape,"Error in equalStrict: "),n.equal(r)}}),xu=rn({greater_:function(t,e){var n,r=Ge(t,"a","greater"),o=Ge(e,"b","greater");return n=It(r,o),r=n[0],o=n[1],Fr(r.shape,o.shape),Pt.runKernelFunc((function(t){return t.greater(r,o)}),{a:r,b:o},null,"Greater")}}),_u=rn({greaterEqual_:function(t,e){var n,r=Ge(t,"a","greaterEqual"),o=Ge(e,"b","greaterEqual");return n=It(r,o),r=n[0],o=n[1],Fr(r.shape,o.shape),Pt.runKernelFunc((function(t,e){var n=t.greaterEqual(r,o);return e([r,o]),n}),{a:r,b:o},(function(t,e){var n=e[0],r=e[1];return{a:function(){return wn(n)},b:function(){return wn(r)}}}),"GreaterEqual")}}),Eu=rn({greaterEqualStrict_:function(t,e){var n=Ge(t,"a","greaterEqualStrict"),r=Ge(e,"b","greaterEqualStrict");return S(n.shape,r.shape,"Error in greaterEqualStrict: "),n.greaterEqual(r)}}),Cu=rn({greaterStrict_:function(t,e){var n=Ge(t,"a","greaterStrict"),r=Ge(e,"b","greaterStrict");return S(n.shape,r.shape,"Error in greaterStrict: "),n.greater(r)}}),Su=rn({less_:function(t,e){var n,r=Ge(t,"a","less"),o=Ge(e,"b","less");return n=It(r,o),r=n[0],o=n[1],Fr(r.shape,o.shape),Pt.runKernelFunc((function(t){return t.less(r,o)}),{a:r,b:o},null,"Less")}}),ku=rn({lessEqual_:function(t,e){var n,r=Ge(t,"a","lessEqual"),o=Ge(e,"b","lessEqual");return n=It(r,o),r=n[0],o=n[1],Fr(r.shape,o.shape),Pt.runKernelFunc((function(t,e){var n=t.lessEqual(r,o);return e([r,o]),n}),{a:r,b:o},null,"LessEqual")}}),Tu=rn({lessEqualStrict_:function(t,e){var n=Ge(t,"a","lessEqualStrict"),r=Ge(e,"b","lessEqualStrict");return S(n.shape,r.shape,"Error in lessEqualStrict: "),n.lessEqual(r)}}),Iu=rn({lessStrict_:function(t,e){var n=Ge(t,"a","lessStrict"),r=Ge(e,"b","lessStrict");return S(n.shape,r.shape,"Error in lessStrict: "),n.less(r)}}),Ou=rn({notEqual_:function(t,e){var n,r=Ge(t,"a","notEqual"),o=Ge(e,"b","notEqual");return n=It(r,o),r=n[0],o=n[1],Fr(r.shape,o.shape),Pt.runKernelFunc((function(t){return t.notEqual(r,o)}),{a:r,b:o},null,"NotEqual")}}),Ru=rn({notEqualStrict_:function(t,e){var n=Ge(t,"a","notEqualStrict"),r=Ge(e,"b","notEqualStrict");return S(n.shape,r.shape,"Error in notEqualStrict: "),n.notEqual(r)}});function Au(t,e){for(var n=[],r=t;r<e;++r)n.push(r);return n}function Du(t){for(var e=[],n=0;n<t.length;++n)for(var r=0;r<t[n].length;++r)e.push(t[n][r]);return e}var Nu=rn({gather_:function(t,e,n){void 0===n&&(n=0);var r=Ge(t,"x","gather"),o=Ge(e,"indices","gather","int32");n=j(n,r.shape)[0];var i=function(t,e,n){for(var r=t.shape[n],o=[],i=1,a=1,s=0;s<n;s++)o.push(t.shape[s]),i*=t.shape[s];for(s=0;s<e.rank;s++)o.push(e.shape[s]);for(s=n+1;s<t.rank;s++)o.push(t.shape[s]),a*=t.shape[s];return{batchSize:i,sliceSize:a,dimSize:r,outputShape:o}}(r,o,n);return Pt.runKernelFunc((function(t,e){var i=t.gather(r,o.flatten(),n);return e([o]),i}),{x:r,indices:o},(function(t,e){var o=e[0];return{x:function(){var e=r.shape,i=o.size,a=e.slice(0,n),s=a.length,u=e.slice(n,e.length).slice(1),c=u.length,l=Au(0,s),f=Au(s+1,s+1+c),h=Du([a,[i],u]),p=t.reshape(h),d=o.reshape([i]),m=Du([[s],l,f]),v=p.transpose(m),g=Pu(v,d,r.shape[n]),y=Ze(m);return g.transpose(y)},indices:function(){return o}}}),"Gather",{axis:n}).reshape(i.outputShape)}}),Pu=rn({unsortedSegmentSum_:function(t,e,n){var r=Ge(t,"x","unsortedSegmentSum"),o=Ge(e,"segmentIds","unsortedSegmentSum","int32");return C(R(n),(function(){return"numSegments must be of dtype int"})),Pt.runKernelFunc((function(t,e){var i=t.unsortedSegmentSum(r,o,n);return e([o]),i}),{$x:r},(function(t,e){var n=e[0];return{$x:function(){return function(t,e){for(var n=au(e,wn(e)),r=Nu(t,n),o=_u(e,ln(0,"int32")),i=r.rank-o.rank,a=0;a<i;++a)o=Hn(o,a+1);o=Hs(o,mn(r.shape,"bool"));var s=wn(r);return $s(o,r,s)}(t,n)}}}))}});function Mu(t,e,n,r,o,i,a){void 0===i&&(i="NHWC"),C(t.length===e.rank,(function(){return"Length of inShape ("+t.length+") and rank of dy ("+e.rank+") must match"}));var s=t,u=e,c=!1;3===e.rank&&(c=!0,u=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]),s=[1,t[0],t[1],t[2]]),C(4===s.length,(function(){return"Error in conv2dDerInput: inShape must be length 4, but got length "+s.length+"."})),C(4===u.rank,(function(){return"Error in conv2dDerInput: dy must be rank 4, but got rank "+u.rank})),C(4===n.rank,(function(){return"Error in conv2dDerInput: filter must be rank 4, but got rank "+n.rank}));var l="NHWC"===i?s[3]:s[1],f="NHWC"===i?u.shape[3]:u.shape[1];C(l===n.shape[2],(function(){return"Error in conv2dDerInput: depth of input ("+l+") must match input depth for filter "+n.shape[2]+"."})),C(f===n.shape[3],(function(){return"Error in conv2dDerInput: depth of output ("+f+") must match output depth for filter "+n.shape[3]+"."})),null!=a&&C(R(o),(function(){return"Error in conv2dDerInput: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+"."}));var h=Yr(i),p=Ur(s,n.shape,r,1,o,a,!1,h),d=Pt.runKernelFunc((function(t,e){var r=t.conv2dDerInput(u,n,p);return e([n,u]),r}),{dy4D:u,filter:n},(function(t,e){var n=e[0],s=e[1];return{dy4D:function(){return Lu(t,n,r,o,i,1,a)},filter:function(){return Wu(t,s,n.shape,r,o,i,a)}}}));return c?d.as3D(d.shape[1],d.shape[2],d.shape[3]):d}function ju(t){var e=function(t){return"number"==typeof t?[t,t,t]:2===t.length?[t[0],t[1],1]:t}(t),n=e[0],r=e[1],o=e[2];return 1===n&&1===r&&1===o}function Fu(t,e,n,r,o){C(t.length===e.rank,(function(){return"Length of inShape ("+t.length+") and rank of dy ("+e.rank+") must match"}));var i=t,a=e,s=!1;4===e.rank&&(s=!0,a=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3]),i=[1,t[0],t[1],t[2],t[3]]);var u=i[4],c=a.shape[4];C(5===i.length,(function(){return"Error in conv3dDerInput: inShape must be length 5, but got length "+i.length+"."})),C(5===a.rank,(function(){return"Error in conv3dDerInput: dy must be rank 5, but got rank "+a.rank})),C(5===n.rank,(function(){return"Error in conv3dDerInput: filter must be rank 5, but got rank "+n.rank})),C(u===n.shape[3],(function(){return"Error in conv3dDerInput: depth of input ("+u+") must match input depth for filter "+n.shape[3]+"."})),C(c===n.shape[4],(function(){return"Error in conv3dDerInput: depth of output ("+c+") must match output depth for filter "+n.shape[4]+"."}));var l=Wr(i,n.shape,r,1,o),f=Pt.runKernelFunc((function(t){return t.conv3dDerInput(a,n,l)}),{dy5D:a});return s?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}var Bu=rn({conv1d_:function(t,e,n,r,o,i,a){void 0===o&&(o="NWC"),void 0===i&&(i=1);var s=Ge(t,"x","conv1d"),u=Ge(e,"filter","conv1d"),c=s,l=!1;2===s.rank&&(l=!0,c=s.as3D(1,s.shape[0],s.shape[1])),C(3===c.rank,(function(){return"Error in conv1d: input must be rank 3, but got rank "+c.rank+"."})),C(3===u.rank,(function(){return"Error in conv1d: filter must be rank 3, but got rank "+u.rank+"."})),null!=a&&C(R(r),(function(){return"Error in conv1d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."})),C(c.shape[2]===u.shape[1],(function(){return"Error in conv1d: depth of input ("+c.shape[2]+") must match input depth for filter "+u.shape[1]+"."})),C(Kr(n,i),(function(){return"Error in conv1D: Either stride or dilation must be 1. Got stride "+n+" and dilation '"+i+"'"})),C("NWC"===o,(function(){return"Error in conv1d: got dataFormat of "+o+" but only NWC is currently supported."}));var f=u.as4D(1,u.shape[0],u.shape[1],u.shape[2]),h=c.as4D(c.shape[0],1,c.shape[1],c.shape[2]),p=Lu(h,f,[1,n],r,"NHWC",[1,i],a);return l?p.as2D(p.shape[2],p.shape[3]):p.as3D(p.shape[0],p.shape[2],p.shape[3])}}),Lu=rn({conv2d_:function(t,e,n,r,o,i,a){void 0===o&&(o="NHWC"),void 0===i&&(i=[1,1]);var s=Ge(t,"x","conv2d"),u=Ge(e,"filter","conv2d"),c=s,l=!1;3===s.rank&&(l=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),C(4===c.rank,(function(){return"Error in conv2d: input must be rank 4, but got rank "+c.rank+"."})),C(4===u.rank,(function(){return"Error in conv2d: filter must be rank 4, but got rank "+u.rank+"."})),null!=a&&C(R(r),(function(){return"Error in conv2d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."}));var f="NHWC"===o?c.shape[3]:c.shape[1];C(f===u.shape[2],(function(){return"Error in conv2d: depth of input ("+f+") must match input depth for filter "+u.shape[2]+"."})),C(Kr(n,i),(function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+i+"'"}));var h=Yr(o),p=Ur(c.shape,u.shape,n,i,r,a,!1,h),d=[u,c],m=Pt.runKernelFunc((function(t,e){var n=t.conv2d(c,u,p);return e([u,c]),n}),{x:c,filter:u},(function(t,e){var a=e,s=a[0],u=a[1];return C(Xr(i),(function(){return"Error in gradient of conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+i+"'"})),{x:function(){return zu(u.shape,t,s,n,r,o)},filter:function(){return Wu(u,t,s.shape,n,r,o)}}}),"Conv2D",p,d);return l?m.as3D(m.shape[1],m.shape[2],m.shape[3]):m}}),Uu=rn({conv3d_:function(t,e,n,r,o,i){void 0===o&&(o="NDHWC"),void 0===i&&(i=[1,1,1]);var a=Ge(t,"x","conv3d"),s=Ge(e,"filter","conv3d"),u=a,c=!1;4===a.rank&&(c=!0,u=a.as5D(1,a.shape[0],a.shape[1],a.shape[2],a.shape[3])),C(5===u.rank,(function(){return"Error in conv3d: input must be rank 5, but got rank "+u.rank+"."})),C(5===s.rank,(function(){return"Error in conv3d: filter must be rank 5, but got rank "+s.rank+"."})),C(u.shape[4]===s.shape[3],(function(){return"Error in conv3d: depth of input ("+u.shape[4]+") must match input depth for filter "+s.shape[3]+"."})),C(function(t,e){return ju(t)||ju(e)}(n,i),(function(){return"Error in conv3D: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+i+"'"})),C("NDHWC"===o,(function(){return"Error in conv3d: got dataFormat of "+o+" but only NDHWC is currently supported."}));var l=Wr(u.shape,s.shape,n,i,r),f=Pt.runKernelFunc((function(t,e){var n=t.conv3d(u,s,l);return e([u,s]),n}),{x:u,$filter:s},(function(t,e){C(ju(i),(function(){return"Error in gradient of conv3D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+i+"'"}));var o=e[0],a=e[1];return{x:function(){return Fu(o.shape,t,a,n,r)},$filter:function(){return function(t,e,n,r,o){var i=t;4===t.rank&&(i=t.as5D(1,t.shape[0],t.shape[1],t.shape[2],t.shape[3]));var a=e;4===a.rank&&(a=e.as5D(1,e.shape[0],e.shape[1],e.shape[2],e.shape[3])),C(5===i.rank,(function(){return"Error in conv3dDerFilter: input must be rank 5, but got shape "+i.shape+"."})),C(5===a.rank,(function(){return"Error in conv3dDerFilter: dy must be rank 5, but got shape "+a.shape+"."})),C(5===n.length,(function(){return"Error in conv3dDerFilter: filterShape must be length 5, but got "+n+"."})),C(i.shape[4]===n[3],(function(){return"Error in conv3dDerFilter: depth of input "+i.shape[4]+") must match input depth in filter ("+n[3]+"."})),C(a.shape[4]===n[4],(function(){return"Error in conv3dDerFilter: depth of dy ("+a.shape[4]+") must match output depth for filter ("+n[4]+")."}));var s=Wr(i.shape,n,r,1,o);return Pt.runKernelFunc((function(t){return t.conv3dDerFilter(i,a,s)}),{x5D:i,dy5D:a})}(o,t,a.shape,n,r)}}}));return c?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}}),Wu=rn({conv2dDerFilter_:function(t,e,n,r,o,i,a){void 0===i&&(i="NHWC");var s=t;3===t.rank&&(s=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var u=e;3===u.rank&&(u=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),C(4===s.rank,(function(){return"Error in conv2dDerFilter: input must be rank 4, but got shape "+s.shape+"."})),C(4===u.rank,(function(){return"Error in conv2dDerFilter: dy must be rank 4, but got shape "+u.shape+"."})),C(4===n.length,(function(){return"Error in conv2dDerFilter: filterShape must be length 4, but got "+n+"."}));var c="NHWC"===i?s.shape[3]:s.shape[1],l="NHWC"===i?u.shape[3]:u.shape[1];C(c===n[2],(function(){return"Error in conv2dDerFilter: depth of input "+c+") must match input depth in filter ("+n[2]+"."})),C(l===n[3],(function(){return"Error in conv2dDerFilter: depth of dy ("+l+") must match output depth for filter ("+n[3]+")."})),null!=a&&C(R(o),(function(){return"Error in conv2dDerFilter: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+o+"."}));var f=Yr(i),h=Ur(s.shape,n,r,1,o,a,!1,f);return Pt.runKernelFunc((function(t){return t.conv2dDerFilter(s,u,h)}),{x4D:s,dy4D:u})}}),zu=rn({conv2dDerInput_:Mu}),Vu=rn({depthwiseConv2d_:function(t,e,n,r,o,i,a){void 0===o&&(o="NHWC"),void 0===i&&(i=[1,1]);var s=Ge(t,"x","depthwiseConv2d"),u=Ge(e,"filter","depthwiseConv2d"),c=s,l=!1;3===s.rank&&(l=!0,c=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),C(4===c.rank,(function(){return"Error in depthwiseConv2d: input must be rank 4, but got rank "+c.rank+"."})),C(4===u.rank,(function(){return"Error in depthwiseConv2d: filter must be rank 4, but got rank "+u.rank+"."})),C(c.shape[3]===u.shape[2],(function(){return"Error in depthwiseConv2d: number of input channels ("+c.shape[3]+") must match the inChannels dimension in filter "+u.shape[2]+"."})),null==i&&(i=[1,1]),C(Kr(n,i),(function(){return"Error in depthwiseConv2d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+i+"'"})),null!=a&&C(R(r),(function(){return"Error in depthwiseConv2d: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+r+"."}));var f=Ur(c.shape,u.shape,n,i,r,a,!0),h=[c,u],p=Pt.runKernelFunc((function(t,e){var n=t.depthwiseConv2D(c,u,f);return e([c,u]),n}),{x:c,filter:u},(function(t,e){C(Xr(i),(function(){return"Error in gradient of depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+i+"'"}));var n=e[0],r=e[1];return{x:function(){return qu(n.shape,t,r,f)},filter:function(){return Gu(n,t,r.shape,f)}}}),"DepthwiseConv2dNative",f,h);return l?p.as3D(p.shape[1],p.shape[2],p.shape[3]):p}}),qu=rn({depthwiseConv2dDerInput_:function(t,e,n,r){var o=e,i=!1;3===e.rank&&(i=!0,o=e.as4D(1,e.shape[0],e.shape[1],e.shape[2]));var a=Pt.runKernelFunc((function(t){return t.depthwiseConv2DDerInput(o,n,r)}),{dy4D:o});return i?a.as3D(a.shape[1],a.shape[2],a.shape[3]):a}}),Gu=rn({depthwiseConv2dDerFilter_:function(t,e,n,r){var o=t;3===t.rank&&(o=t.as4D(1,t.shape[0],t.shape[1],t.shape[2]));var i=e;return 3===i.rank&&(i=e.as4D(1,e.shape[0],e.shape[1],e.shape[2])),Pt.runKernelFunc((function(t){return t.depthwiseConv2DDerFilter(o,i,r)}),{x4D:o,dy4D:i})}}),Hu=rn({separableConv2d_:function(t,e,n,r,o,i,a){void 0===i&&(i=[1,1]),void 0===a&&(a="NHWC");var s=Ge(t,"x","separableConv2d"),u=Ge(e,"depthwiseFilter","separableConv2d"),c=Ge(n,"pointwiseFilter","separableConv2d"),l=s,f=!1;if(3===s.rank&&(f=!0,l=s.as4D(1,s.shape[0],s.shape[1],s.shape[2])),"NCHW"===a)throw new Error("separableConv2d currently does not support dataFormat NCHW; only NHWC is supported");C(4===l.rank,(function(){return"Error in separableConv2d: input must be rank 4, but got rank "+l.rank+"."})),C(4===u.rank,(function(){return"Error in separableConv2d: depthwise filter must be rank 4, but got rank "+u.rank+"."})),C(4===c.rank,(function(){return"Error in separableConv2d: pointwise filter must be rank 4, but got rank "+u.rank+"."})),C(1===c.shape[0],(function(){return"Error in separableConv2d: the first dimension of pointwise filter must be 1, but got "+c.shape[0]+"."})),C(1===c.shape[1],(function(){return"Error in separableConv2d: the second dimension of pointwise filter must be 1, but got "+c.shape[1]+"."}));var h=u.shape[2],p=u.shape[3];C(c.shape[2]===h*p,(function(){return"Error in separableConv2d: the third dimension of pointwise filter must be "+h*p+", but got "+c.shape[2]+"."}));var d=Vu(l,u,r,o,a,i),m=Lu(d,c,1,"valid",a);return f?m.as3D(m.shape[1],m.shape[2],m.shape[3]):m}}),Xu=rn({conv2dTranspose_:function(t,e,n,r,o,i){return Mu(n,Ge(t,"x","conv2dTranspose"),Ge(e,"filter","conv2dTranspose"),r,o,"NHWC",i)}}),Ku=rn({conv3dTranspose_:function(t,e,n,r,o){return Fu(n,Ge(t,"x","conv3dTranspose"),Ge(e,"filter","conv3dTranspose"),r,o)}}),Yu=rn({matMul_:function(t,e,n,r){var o;void 0===n&&(n=!1),void 0===r&&(r=!1);var i=Ge(t,"a","matMul"),a=Ge(e,"b","matMul");o=It(i,a),i=o[0],a=o[1];var s=n?i.shape[i.rank-2]:i.shape[i.rank-1],u=r?a.shape[a.rank-1]:a.shape[a.rank-2],c=n?i.shape[i.rank-1]:i.shape[i.rank-2],l=r?a.shape[a.rank-2]:a.shape[a.rank-1],f=i.shape.slice(0,-2),h=a.shape.slice(0,-2),p=I(f),d=I(h);C(i.rank>=2&&a.rank>=2&&i.rank===a.rank,(function(){return"Error in matMul: inputs must have the same rank of at least 2, got ranks "+i.rank+" and "+a.rank+"."})),C(O(f,h),(function(){return"Error in matMul: outer dimensions ("+f+") and ("+h+") of Tensors with shapes "+i.shape+" and "+a.shape+" must match."})),C(s===u,(function(){return"Error in matMul: inner shapes ("+s+") and ("+u+") of Tensors with shapes "+i.shape+" and "+a.shape+" and transposeA="+n+" and transposeB="+r+" must match."}));var m=i.shape.slice(0,-2).concat([c,l]),v=n?i.as3D(p,s,c):i.as3D(p,c,s),g=r?a.as3D(d,l,u):a.as3D(d,u,l),y={transposeA:n,transposeB:r};return Pt.runKernelFunc((function(t,e){var o=t.batchMatMul(v,g,n,r);return e([v,g]),o}),{a:v,b:g},(function(t,e){var o=e,i=o[0],a=o[1];return n||r?!n&&r?{a:function(){return t.matMul(a,!1,!1)},b:function(){return t.matMul(i,!0,!1)}}:n&&!r?{a:function(){return a.matMul(t,!1,!0)},b:function(){return i.matMul(t,!1,!1)}}:{a:function(){return a.matMul(t,!0,!0)},b:function(){return t.matMul(i,!0,!0)}}:{a:function(){return t.matMul(a,!1,!0)},b:function(){return i.matMul(t,!0,!1)}}}),"BatchMatMul",y).reshape(m)}}),$u=rn({dot_:function(t,e){var n=Ge(t,"t1","dot"),r=Ge(e,"t2","dot");C(!(1!==n.rank&&2!==n.rank||1!==r.rank&&2!==r.rank),(function(){return"Error in dot: inputs must all be rank 1 or 2, but got ranks "+n.rank+" and "+r.rank+"."}));var o=1===n.rank?n.size:n.shape[1],i=1===r.rank?r.size:r.shape[0];return C(o===i,(function(){return"Error in dot: inner dimensions of inputs must match, but got "+o+" and "+i+"."})),1===n.rank&&1===r.rank?n.as2D(1,-1).matMul(r.as2D(-1,1)).asScalar():1===n.rank&&2===r.rank?n.as2D(1,-1).matMul(r.as2D(r.shape[0],r.shape[1])).as1D():2===n.rank&&1===r.rank?n.matMul(r.as2D(-1,1)).as1D():n.matMul(r.as2D(r.shape[0],r.shape[1]))}}),Ju=rn({outerProduct_:function(t,e){var n=Ge(t,"v1","outerProduct"),r=Ge(e,"v2","outerProduct");return C(1===n.rank&&1===r.rank,(function(){return"Error in outerProduct: inputs must be rank 1, but got ranks "+n.rank+" and "+r.rank+"."})),n.as2D(-1,1).matMul(r.as2D(1,-1))}}),Qu=rn({reverse_:function(t,e){var n=Ge(t,"x","reverse");if(0===n.rank)return n.clone();var r=j(e,n.shape);return Pt.runKernelFunc((function(t){return t.reverse(n,r)}),{$x:n},(function(t){return{$x:function(){return t.reverse(r)}}})).reshapeAs(n)}}),Zu=rn({reverse1d_:function(t){var e=Ge(t,"x","reverse");return C(1===e.rank,(function(){return"Error in reverse1D: x must be rank 1 but got rank "+e.rank+"."})),Qu(e,0)}}),tc=rn({reverse2d_:function(t,e){var n=Ge(t,"x","reverse");return C(2===n.rank,(function(){return"Error in reverse2D: x must be rank 2 but got rank "+n.rank+"."})),Qu(n,e)}}),ec=rn({reverse3d_:function(t,e){var n=Ge(t,"x","reverse");return C(3===n.rank,(function(){return"Error in reverse3D: x must be rank 3 but got rank "+n.rank+"."})),Qu(n,e)}}),nc=rn({reverse4d_:function(t,e){var n=Ge(t,"x","reverse");return C(4===n.rank,(function(){return"Error in reverse4D: x must be rank 4 but got rank "+n.rank+"."})),Qu(n,e)}});function rc(t,e,n,r,o,i){var a=Ge(t,"x","maxPool"),s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),null==r&&(r=[1,1]),C(4===s.rank,(function(){return"Error in maxPool: input must be rank 4 but got rank "+s.rank+"."})),C(Kr(n,r),(function(){return"Error in maxPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+r+"'"})),null!=i&&C(R(o),(function(){return"Error in maxPool: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+o+"."}));var c=Br(s.shape,e,n,r,o,i);if(1===c.filterWidth&&1===c.filterHeight&&O(c.inShape,c.outShape))return a.clone();var l=[s],f=Pt.runKernelFunc((function(t,e){var n=t.maxPool(s,c);return e([s,n]),n}),{x:s},(function(t,i){var a=i[0],s=i[1];return{x:function(){return function(t,e,n,r,o,i,a,s){var u=Ge(t,"dy","maxPoolBackprop"),c=Ge(e,"input","maxPoolBackprop"),l=Ge(n,"output","maxPoolBackprop");C(c.rank===u.rank,(function(){return"Rank of input ("+c.rank+") does not match rank of dy ("+u.rank+")"})),null==i&&(i=[1,1]),C(Kr(o,i),(function(){return"Error in maxPoolBackProp: Either strides or dilations must be 1. Got strides "+o+" and dilations '"+i+"'"})),C(4===u.rank,(function(){return"Error in maxPoolBackprop: dy must be rank 4 but got rank "+u.rank+"."})),C(4===c.rank,(function(){return"Error in maxPoolBackprop: input must be rank 4 but got rank "+c.rank+"."}));var f=Br(c.shape,r,o,i,a,s);return Pt.runKernelFunc((function(t){return t.maxPoolBackprop(u,c,l,f)}),{$dy:u,$input:c})}(t,a,s,e,n,r,o)}}}),"MaxPool",c,l);return u?f.as3D(f.shape[1],f.shape[2],f.shape[3]):f}function oc(t,e,n,r,o,i){var a=Ge(t,"x","avgPool","float32");null==r&&(r=[1,1]),C(Kr(n,r),(function(){return"Error in avgPool: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+r+"'"}));var s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),C(4===s.rank,(function(){return"Error in avgPool: x must be rank 4 but got rank "+s.rank+"."})),null!=i&&C(R(o),(function(){return"Error in avgPool: pad must be an integer when using, dimRoundingMode "+i+" but got pad "+o+"."}));var c=Br(s.shape,e,n,r,o,i);if(1===c.filterWidth&&1===c.filterHeight&&O(c.inShape,c.outShape))return a.clone();var l=Pt.runKernelFunc((function(t){return t.avgPool(s,c)}),{x:s},(function(t){return{x:function(){return function(t,e,n,r,o,i){var a=Ge(t,"dy","avgPoolBackprop"),s=Ge(e,"input","avgPoolBackprop");C(s.rank===a.rank,(function(){return"Rank of input ("+s.rank+") does not match rank of dy ("+a.rank+")"})),null==o&&(o=[1,1]),C(Kr(r,o),(function(){return"Error in avgPoolBackprop: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+o+"'"}));var u=s,c=a,l=!1;3===s.rank&&(l=!0,u=s.as4D(1,s.shape[0],s.shape[1],s.shape[2]),c=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),C(4===c.rank,(function(){return"Error in avgPoolBackprop: dy must be rank 4 but got rank "+c.rank+"."})),C(4===u.rank,(function(){return"Error in avgPoolBackprop: input must be rank 4 but got rank "+u.rank+"."}));var f=Br(u.shape,n,r,o,i),h=Pt.runKernelFunc((function(t){return t.avgPoolBackprop(c,u,f)}),{dy4D:c,input4D:u});return l?h.as3D(h.shape[1],h.shape[2],h.shape[3]):h}(t,s,e,n,r,o)}}}),"AvgPool",c);return l=l.cast(a.dtype),u?l.as3D(l.shape[1],l.shape[2],l.shape[3]):l}var ic=rn({maxPool_:function(t,e,n,r,o){return rc(t,e,n,1,r,o)}}),ac=rn({avgPool_:function(t,e,n,r,o){return oc(t,e,n,1,r,o)}}),sc=rn({pool_:function(t,e,n,r,o,i){null==o&&(o=[1,1]),null==i&&(i=1),0===r&&(r="valid");var a=Ge(t,"x","maxPool"),s=a,u=!1;3===a.rank&&(u=!0,s=a.as4D(1,a.shape[0],a.shape[1],a.shape[2])),C(Kr(i,o),(function(){return"Error in pool: Either strides or dilations must be 1. Got strides "+i+" and dilations '"+o+"'"}));var c,l=Br(s.shape,e,i,o,r),f=[l.dilationHeight,l.dilationWidth];c="same"===r?function(t,e){var n=t.map((function(t,n){return t+(t-1)*(e[n]-1)})).map((function(t){return t-1})),r=n.map((function(t){return Math.floor(t/2)})),o=n.map((function(t,e){return t-r[e]}));return n.map((function(t,e){return[r[e],o[e]]}))}([l.filterHeight,l.filterWidth],f):[[0,0],[0,0]];var h=1===f[0]&&1===f[1],p=function(t,e,n){var r=n.map((function(t){return t[0]})),o=n.map((function(t){return t[1]})),i=t.concat(r,o),a=e.map((function(t,e){return(t-i[e]%t)%t})),s=o.map((function(t,e){return t+a[e]}));return[e.map((function(t,e){return[r[e],s[e]]})),e.map((function(t,e){return[0,a[e]]}))]}([l.inHeight,l.inWidth],f,c),d=p[0],m=p[1],v=h?r:"valid",g=h?s:ar(s,f,d),y=("avg"===n?function(){return oc(g,e,i,1,v)}:function(){return rc(g,e,i,1,v)})(),b=h?y:Un(y,f,m);return u?b.as3D(b.shape[1],b.shape[2],b.shape[3]):b}}),uc=rn({maxPool3d_:function(t,e,n,r,o,i,a){void 0===i&&(i="NDHWC");var s=Ge(t,"x","maxPool3d"),u=s,c=!1;4===s.rank&&(c=!0,u=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),null==a&&(a=[1,1,1]),C(5===u.rank,(function(){return"Error in maxPool3d: x must be rank 5 but got rank "+u.rank+"."})),C("NDHWC"===i,(function(){return"Error in maxPool3d: Only NDHWC is currently supported, but got dataFormat of "+i})),C(Kr(n,a),(function(){return"Error in maxPool3d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+a+"'"})),null!=o&&C(R(r),(function(){return"Error in maxPool3d: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+r+"."}));var l=Lr(u.shape,e,n,a,r,o,i),f=Pt.runKernelFunc((function(t,e){var n=t.maxPool3d(u,l);return e([u,n]),n}),{x:u},(function(t,i){var s=i[0],u=i[1];return{x:function(){return function(t,e,n,r,o,i,a,s){var u=Ge(t,"dy","maxPool3dBackprop"),c=Ge(e,"input","maxPool3dBackprop"),l=Ge(n,"output","maxPool3dBackprop"),f=u,h=c,p=l,d=!1;4===c.rank&&(d=!0,f=u.as5D(1,u.shape[0],u.shape[1],u.shape[2],u.shape[3]),h=c.as5D(1,c.shape[0],c.shape[1],c.shape[2],c.shape[3]),p=l.as5D(1,l.shape[0],l.shape[1],l.shape[2],l.shape[3])),C(5===f.rank,(function(){return"Error in maxPool3dBackprop: dy must be rank 5 but got rank "+f.rank+"."})),C(5===h.rank,(function(){return"Error in maxPool3dBackprop: input must be rank 5 but got rank "+h.rank+"."})),C(5===p.rank,(function(){return"Error in maxPool3dBackprop: output must be rank 5 but got rank "+p.rank+"."})),null==i&&(i=[1,1,1]),C(Kr(o,i),(function(){return"Error in maxPool3dBackprop: Either strides or dilations must be 1. Got strides "+o+" and dilations '"+i+"'"})),null!=s&&C(R(a),(function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+s+" but got pad "+a+"."}));var m=Lr(h.shape,r,o,i,a,s),v=Pt.runKernelFunc((function(t){return t.maxPool3dBackprop(f,h,p,m)}),{dy5D:f,input5D:h});return d?v.as4D(v.shape[1],v.shape[2],v.shape[3],v.shape[4]):v}(t,s,u,e,n,a,r,o)}}}));return c?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}}),cc=rn({avgPool3d_:function(t,e,n,r,o,i,a){void 0===i&&(i="NDHWC");var s=Ge(t,"x","avgPool3d","float32"),u=s,c=!1;4===s.rank&&(c=!0,u=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3])),null==a&&(a=[1,1,1]),C(5===u.rank,(function(){return"Error in avgPool3d: x must be rank 5 but got rank "+u.rank+"."})),C("NDHWC"===i,(function(){return"Error in avgPool3d: Only NDHWC is currently supported, but got dataFormat of "+i})),C(Kr(n,a),(function(){return"Error in avgPool3d: Either strides or dilations must be 1. Got strides "+n+" and dilations '"+a+"'"})),null!=o&&C(R(r),(function(){return"Error in avgPool3d: pad must be an integer when using, dimRoundingMode "+o+" but got pad "+r+"."}));var l=Lr(u.shape,e,n,a,r,o,i),f=Pt.runKernelFunc((function(t){return t.avgPool3d(u,l)}),{x:u},(function(t){return{x:function(){return function(t,e,n,r,o,i,a){var s=Ge(t,"dy","avgPool3dBackprop"),u=Ge(e,"input","avgPool3dBackprop"),c=s,l=u,f=!1;4===u.rank&&(f=!0,c=s.as5D(1,s.shape[0],s.shape[1],s.shape[2],s.shape[3]),l=u.as5D(1,u.shape[0],u.shape[1],u.shape[2],u.shape[3])),C(5===c.rank,(function(){return"Error in avgPool3dBackprop: dy must be rank 5 but got rank "+c.rank+"."})),C(5===l.rank,(function(){return"Error in avgPool3dBackprop: input must be rank 5 but got rank "+l.rank+"."})),null==o&&(o=[1,1,1]),C(Kr(r,o),(function(){return"Error in avgPool3dBackprop: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+o+"'"})),null!=a&&C(R(i),(function(){return"Error in maxPool3dBackprop: pad must be an integer when using, dimRoundingMode "+a+" but got pad "+i+"."}));var h=Lr(l.shape,n,r,o,i,a),p=Pt.runKernelFunc((function(t){return t.avgPool3dBackprop(c,l,h)}),{dy5D:c,input5D:l});return f?p.as4D(p.shape[1],p.shape[2],p.shape[3],p.shape[4]):p}(t,u,e,n,a,r,o)}}}));return f=f.cast(u.dtype),c?f.as4D(f.shape[1],f.shape[2],f.shape[3],f.shape[4]):f}}),lc=rn({slice_:function(t,e,n){var r,o,i=Ge(t,"x","slice");if(0===i.rank)throw new Error("Slicing scalar is not possible");(r="number"==typeof e?[e].concat(new Array(i.rank-1).fill(0)):e.length<i.rank?e.concat(new Array(i.rank-e.length).fill(0)):e.slice()).forEach((function(t){C(-1!==t,(function(){return"slice() does not support negative begin indexing."}))})),o=(o=null==n?new Array(i.rank).fill(-1):"number"==typeof n?[n].concat(new Array(i.rank-1).fill(-1)):n.length<i.rank?n.concat(new Array(i.rank-n.length).fill(-1)):n).map((function(t,e){return t>=0?t:(C(-1===t,(function(){return"Negative size values should be exactly -1 but got "+t+" for the slice() size at index "+e+"."})),i.shape[e]-r[e])})),_r(i,r,o);var a=i.shape,s={begin:r,size:o};return Pt.runKernelFunc((function(t){return t.slice(i,r,o)}),{x:i},(function(t){for(var e=[],n=0;n<t.rank;n++)e.push([r[n],a[n]-r[n]-o[n]]);return{x:function(){return t.pad(e)}}}),"Slice",s)}}),fc=rn({slice1d_:function(t,e,n){var r=Ge(t,"x","slice1d");return C(1===r.rank,(function(){return"slice1d expects a rank-1 tensor, but got a rank-"+r.rank+" tensor"})),lc(r,[e],[n])}}),hc=rn({slice2d_:function(t,e,n){var r=Ge(t,"x","slice2d");return C(2===r.rank,(function(){return"slice2d expects a rank-2 tensor, but got a rank-"+r.rank+" tensor"})),lc(r,e,n)}}),pc=rn({slice3d_:function(t,e,n){var r=Ge(t,"x","slice3d");return C(3===r.rank,(function(){return"slice3d expects a rank-3 tensor, but got a rank-"+r.rank+" tensor"})),lc(r,e,n)}}),dc=rn({slice4d_:function(t,e,n){var r=Ge(t,"x","slice4d");return C(4===r.rank,(function(){return"slice4d expects a rank-4 tensor, but got a rank-"+r.rank+" tensor"})),lc(r,e,n)}});function mc(t,e,n,r,o){return e.rank<n.rank&&(e=e.reshape($e(e.shape,r))),t.rank<n.rank&&(t=t.reshape($e(t.shape,r))),{x:function(){var r=t.mul(n.equal(e).cast(t.dtype));return null==o?r:r.transpose(o)}}}var vc=rn({all_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Ge(t,"x","all","bool"),o=j(e,r.shape),i=o,a=Qe(i,r.rank);null!=a&&(r=r.transpose(a),i=tn(i.length,r.rank));var s=Pt.runKernelFunc((function(t){return t.all(r,i)}),{$x:r});if(n){var u=$e(s.shape,o);return s.reshape(u)}return s}}),gc=rn({any_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Ge(t,"x","any","bool"),o=j(e,r.shape),i=o,a=Qe(i,r.rank);null!=a&&(r=r.transpose(a),i=tn(i.length,r.rank));var s=Pt.runKernelFunc((function(t){return t.any(r,i)}),{$x:r});if(n){var u=$e(s.shape,o);return s.reshape(u)}return s}}),yc=rn({argMax_:function(t,e){void 0===e&&(e=0);var n=Ge(t,"x","argMax");null==e&&(e=0);var r=j(e,n.shape),o=Qe(r,n.rank);null!=o&&(n=n.transpose(o),r=tn(r.length,n.rank));var i={axis:r[0]},a=[n];return Pt.runKernelFunc((function(t,e){var o=t.argMax(n,r[0]);return e([n]),o}),{x:n},(function(t,e){var n=e[0];return{x:function(){return wn(n)}}}),"ArgMax",i,a)}}),bc=rn({argMin_:function(t,e){void 0===e&&(e=0);var n=Ge(t,"x","argMin");null==e&&(e=0);var r=j(e,n.shape),o=Qe(r,n.rank);return null!=o&&(n=n.transpose(o),r=tn(r.length,n.rank)),Pt.runKernelFunc((function(t,e){var o=t.argMin(n,r[0]);return e([n]),o}),{$x:n},(function(t,e){var n=e[0];return{$x:function(){return wn(n)}}}))}}),wc=rn({logSumExp_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Ge(t,"x","logSumExp"),o=j(e,r.shape),i=r.max(o,!0),a=r.sub(i).exp().sum(o).log(),s=i.reshape(a.shape).add(a);if(n){var u=$e(s.shape,o);return s.reshape(u)}return s}}),xc=rn({max_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Ge(t,"x","max"),o=r,i=j(e,r.shape),a=i,s=Qe(a,r.rank);null!=s&&(r=r.transpose(s),a=tn(a.length,r.rank));var u=[r],c=Pt.runKernelFunc((function(t,e){var n=t.max(r,a);return e([o,n]),n}),{x:r},(function(t,e){return mc(t,e[1],e[0],i,s)}),"Max",{axes:a},u,[!0]);if(n){var l=$e(c.shape,i);c=c.reshape(l)}return c}}),_c=rn({mean_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Ge(t,"x","mean"),o=j(e,r.shape),i=I(Ye(r.shape,o)[1]);return Or((function(t){var r=ln(i);return{value:(r.dtype===t.dtype?t:t.cast(r.dtype)).div(r).sum(e,n),gradFunc:function(e){var n=t.shape.slice();return o.forEach((function(t){n[t]=1})),e.reshape(n).mul(mn(t.shape,"float32")).div(i)}}}))(r)}}),Ec=rn({min_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Ge(t,"x","min"),o=r,i=j(e,r.shape),a=i,s=Qe(a,r.rank);null!=s&&(r=r.transpose(s),a=tn(a.length,r.rank));var u=[r],c=Pt.runKernelFunc((function(t,e){var n=t.min(r,a);return e([o,n]),n}),{x:r},(function(t,e){return mc(t,e[1],e[0],i,s)}),"Min",{axes:a},u,[!0]);if(n){var l=$e(c.shape,i);c=c.reshape(l)}return c}}),Cc=rn({moments_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=j(e,(t=Ge(t,"x","moments")).shape),o=t.mean(r,n),i=o.shape;n||(i=$e(o.shape,r));var a=t.toFloat().sub(o.reshape(i)).square();return{mean:o,variance:a.mean(r,n)}}}),Sc=rn({sum_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Ge(t,"x","sum");"bool"===r.dtype&&(r=r.toInt());var o=j(e,r.shape);return Or((function(t){var e=Qe(o,t.rank),r=o,i=t;null!=e&&(i=t.transpose(e),r=tn(r.length,t.rank));var a=function(e){var n=t.shape.slice();return o.forEach((function(t){n[t]=1})),e.reshape(n).mul(mn(t.shape,"float32"))},s={axes:r},u=Pt.runKernelFunc((function(t){return t.sum(i,r)}),{x:i},(function(t){return{x:function(){return a(t)}}}),"Sum",s);if(n){var c=$e(u.shape,o);u=u.reshape(c)}return{value:u,gradFunc:a}}))(r)}}),kc=rn({prod_:function(t,e,n){void 0===e&&(e=null),void 0===n&&(n=!1);var r=Ge(t,"x","prod");"bool"===r.dtype&&(r=r.toInt());var o=j(e,r.shape),i=Qe(o,r.rank),a=o,s=r;null!=i&&(s=r.transpose(i),a=tn(a.length,r.rank));var u=Pt.runKernelFunc((function(t){return t.prod(s,a)}),{permutedX:s});if(n){var c=$e(u.shape,o);u=u.reshape(c)}return u}}),Tc=rn({elu_:function(t){var e=Ge(t,"x","elu");return Pt.runKernelFunc((function(t,n){var r=t.elu(e);return n([r]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){return Pt.runKernelFunc((function(e){return e.eluDer(t,n)}),{dy:t,y:n})}}}))}}),Ic=rn({leakyRelu_:function(t,e){void 0===e&&(e=.2);var n=Ge(t,"x","leakyRelu");return au(ln(e).mul(n),n)}}),Oc=rn({prelu_:function(t,e){var n=Ge(t,"x","prelu"),r=Ge(e,"alpha","prelu");return Pt.runKernelFunc((function(t,e){var o=t.prelu(n,r);return e([n,r]),o}),{x:n,alpha:r},(function(t,e){var n=e[0],r=e[1],o=n.greater(0);return{x:function(){return $s(o,t,t.mul(r))},alpha:function(){var e=$s(o,wn(t),t.mul(n)),i=jr(r.shape,t.shape);return i.length>0&&(e=e.sum(i)),e.reshape(r.shape)}}}),"Prelu")}}),Rc=rn({relu_:function(t){var e=Ge(t,"x","relu");return"bool"===e.dtype?e.toInt():Pt.runKernelFunc((function(t,n){var r=t.relu(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0];return{x:function(){return t.mulStrict(n.step().toFloat())}}}),"Relu")}}),Ac=rn({relu6_:function(t){var e=Ge(t,"x","relu6");return"bool"===e.dtype?e.toInt():Pt.runKernelFunc((function(t,n){var r=t.relu6(e);return n([e]),r}),{x:e},(function(t,e){var n=e[0],r=n.lessEqual(6).mul(n.step());return{x:function(){return t.mulStrict(r.toFloat())}}}),"Relu6")}}),Dc=rn({selu_:function(t){var e=Ge(t,"x","selu");return Pt.runKernelFunc((function(t,n){var r=t.selu(e);return n([e]),r}),{$x:e},(function(t,e){var n=e[0];return{$x:function(){var e=n.greater(ln(0)),r=ln(Ta),o=ln(Ia),i=t.mul(o),a=t.mul(r).mul(n.toFloat().exp());return $s(e,i,a)}}}))}}),Nc=rn({transpose_:function(t,e){var n=Ge(t,"x","transpose");if(null==e&&(e=n.shape.map((function(t,e){return e})).reverse()),C(n.rank===e.length,(function(){return"Error in transpose: rank of input "+n.rank+" must match length of perm "+e+"."})),e.forEach((function(t){C(t>=0&&t<n.rank,(function(){return"All entries in 'perm' must be between 0 and "+(n.rank-1)+" but got "+e}))})),n.rank<=1)return n.clone();var r={perm:e};return Pt.runKernelFunc((function(t){return t.transpose(n,e)}),{x:n},(function(t){var n=Ze(e);return{x:function(){return t.transpose(n)}}}),"Transpose",r)}}),Pc=rn({localResponseNormalization_:function(t,e,n,r,o){void 0===e&&(e=5),void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=.5);var i=Ge(t,"x","localResponseNormalization");C(4===i.rank||3===i.rank,(function(){return"Error in localResponseNormalization: x must be rank 3 or 4 but got\n rank "+i.rank+"."})),C(R(e),(function(){return"Error in localResponseNormalization: depthRadius must be an integer but got depthRadius "+e+"."}));var a=i,s=!1;3===i.rank&&(s=!0,a=i.as4D(1,i.shape[0],i.shape[1],i.shape[2]));var u=Pt.runKernelFunc((function(t,i){var s=t.localResponseNormalization4D(a,e,n,r,o);return i([a,s]),s}),{x4D:a},(function(t,i){var a=i[0],s=i[1];return{x4D:function(){return Pt.runKernelFunc((function(i){return i.LRNGrad(t,a,s,e,n,r,o)}),{})}}}));return s?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),Mc=rn({norm_:function(t,e,n,r){void 0===e&&(e="euclidean"),void 0===n&&(n=null),void 0===r&&(r=!1);var o=function t(e,n,r){if(void 0===r&&(r=null),0===e.rank)return e.abs();if(1!==e.rank&&null===r)return t(e.reshape([-1]),n,r);if(1===e.rank||"number"==typeof r||Array.isArray(r)&&1===r.length){if(1===n)return e.abs().sum(r);if(n===1/0)return e.abs().max(r);if(n===-1/0)return e.abs().min(r);if("euclidean"===n||2===n)return e.abs().pow(ln(2,"int32")).sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}if(Array.isArray(r)&&2===r.length){if(1===n)return e.abs().sum(r[0]).max(r[1]-1);if(n===1/0)return e.abs().sum(r[1]).max(r[0]);if(n===-1/0)return e.abs().sum(r[1]).min(r[0]);if("fro"===n||"euclidean"===n)return e.square().sum(r).sqrt();throw new Error("Error in norm: invalid ord value: "+n)}throw new Error("Error in norm: invalid axis: "+r)}(t=Ge(t,"x","norm"),e,n),i=o.shape;if(r){var a=j(n,t.shape);i=$e(o.shape,a)}return o.reshape(i)}}),jc=rn({basicLSTMCell_:function(t,e,n,r,o,i){var a=Ge(t,"forgetBias","basicLSTMCell"),s=Ge(e,"lstmKernel","basicLSTMCell"),u=Ge(n,"lstmBias","basicLSTMCell"),c=Ge(r,"data","basicLSTMCell"),l=Ge(o,"c","basicLSTMCell"),f=Ge(i,"h","basicLSTMCell"),h=c.concat(f,1).matMul(s).add(u),p=h.shape[0],d=h.shape[1]/4,m=[p,d],v=h.slice([0,0],m),g=h.slice([0,d],m),y=h.slice([0,2*d],m),b=h.slice([0,3*d],m),w=v.sigmoid().mulStrict(g.tanh()).addStrict(l.mulStrict(a.add(y).sigmoid())),x=w.tanh().mulStrict(b.sigmoid());return[w,x]}}),Fc=rn({multiRNNCell_:function(t,e,n,r){for(var o=Ge(e,"data","multiRNNCell"),i=He(n,"c","multiRNNCell"),a=He(r,"h","multiRNNCell"),s=o,u=[],c=0;c<t.length;c++){var l=t[c](s,i[c],a[c]);u.push(l[0]),u.push(l[1]),s=l[1]}var f=[],h=[];for(c=0;c<u.length;c+=2)f.push(u[c]),h.push(u[c+1]);return[f,h]}}),Bc=rn({movingAverage_:function(t,e,n,r,o){void 0===o&&(o=!0);var i=Ge(t,"v","movingAverage"),a=Ge(e,"x","movingAverage"),s=Ge(n,"decay","movingAverage");Ot(i,a),C(O(i.shape,a.shape),(function(){return"Shape mismatch in v and x"}));var u=ln(1),c=u.sub(s),l=a.sub(i).mul(c);if(o){C(null!=r,(function(){return"When using zeroDebias: true, step is required."}));var f=Ge(r,"step","movingAverage");l=l.div(u.sub(du(s,f)))}return i.add(l)}}),Lc=rn({stridedSlice_:function(t,e,n,r,o,i,a,s,u){if(void 0===o&&(o=0),void 0===i&&(i=0),void 0===a&&(a=0),void 0===s&&(s=0),void 0===u&&(u=0),null==r&&(r=new Array(e.length)),0!==a)throw new Error("ellipsis mask is not yet supported");var c=Ge(t,"x","stridedSlice"),l=Er(s),f=c.shape.slice();l.forEach((function(t){e[t]=0,n[t]=1,f.splice(t,0,1)})),c=c.reshape(f);for(var h=0;h<c.rank;h++)e[h]=Sr(o,e,r,c.shape,h),n[h]=kr(i,n,r,c.shape,h),r[h]=r[h]||1;var p=Er(u);p.forEach((function(t){n[t]=e[t]+1,r[t]=1}));var d=Cr(e,n,r),m=d.filter((function(t,e){return-1===p.indexOf(e)}));return r.every((function(t){return 1===t}))?lc(c,e,d).reshape(m):Pt.runKernelFunc((function(t){return t.stridedSlice(c,e,n,r)}),{$x:c}).reshape(m)}}),Uc=rn({topk_:function(t,e,n){void 0===e&&(e=1),void 0===n&&(n=!0);var r=Ge(t,"x","topk");if(0===r.rank)throw new Error("topk() expects the input to be of rank 1 or higher");var o=r.shape[r.shape.length-1];if(e>o)throw new Error("'k' passed to topk() must be <= the last dimension ("+o+") but got "+e);var i=Pt.runKernelFunc((function(t){return t.topk(r,e,n)}),{$x:r});return{values:i[0],indices:i[1]}}}),Wc=rn({scatterND_:function(t,e,n){var r=Ge(t,"indices","scatterND","int32"),o=Ge(e,"updates","scatterND");return wr(o,r,n),Pt.runKernelFunc((function(t){return t.scatterND(r,o,n)}),{indices:r,updates:o},null,"ScatterNd",{shape:n})}}),zc=rn({fft_:function(t){C("complex64"===t.dtype,(function(){return"The dtype for tf.spectral.fft() must be complex64 but got "+t.dtype+"."}));var e=t.shape[t.shape.length-1],n=t.size/e,r=t.as2D(n,e);return Pt.runKernelFunc((function(t){return t.fft(r)}),{input:t}).reshape(t.shape)}}),Vc=rn({ifft_:function(t){C("complex64"===t.dtype,(function(){return"The dtype for tf.spectral.ifft() must be complex64 but got "+t.dtype+"."}));var e=t.shape[t.shape.length-1],n=t.size/e,r=t.as2D(n,e);return Pt.runKernelFunc((function(t){return t.ifft(r)}),{input:t}).reshape(t.shape)}}),qc=rn({rfft_:function(t,e){C("float32"===t.dtype,(function(){return"The dtype for rfft() must be real value but got "+t.dtype}));var n,r=t.shape[t.shape.length-1],o=t.size/r;if(null!=e&&e<r){var i=t.shape.map((function(t){return 0})),a=t.shape.map((function(t){return t}));a[t.shape.length-1]=e,n=t.slice(i,a),r=e}else if(null!=e&&e>r){var s=t.shape.map((function(t){return t}));s[t.shape.length-1]=e-r,n=t.concat(vn(s),t.shape.length-1),r=e}else n=t;var u=n.zerosLike(),c=on(n,u).as2D(o,r),l=zc(c),f=Math.floor(r/2)+1,h=an(l),p=sn(l),d=h.split([f,r-f],h.shape.length-1),m=p.split([f,r-f],p.shape.length-1),v=n.shape.slice();return v[n.shape.length-1]=f,on(d[0],m[0]).reshape(v)}}),Gc=rn({irfft_:function(t){var e=t.shape[t.shape.length-1],n=t.size/e;if(e<=2){var r=t.as2D(n,e),o=Vc(r);return an(o)}var i=[n,2*(e-1)],a=an(t).as2D(n,e),s=sn(t).as2D(n,e),u=a.slice([0,1],[n,e-2]).reverse(1),c=s.slice([0,1],[n,e-2]).reverse(1).mul(ln(-1)),l=a.concat(u,1),f=s.concat(c,1);return r=on(l,f).as2D(i[0],i[1]),o=Vc(r),an(o)}}),Hc=Object.freeze({fft:zc,ifft:Vc,rfft:qc,irfft:Gc}),Xc=rn({sparseToDense_:function(t,e,n,r){void 0===r&&(r=0);var o=Ge(t,"sparseIndices","sparseToDense","int32"),i=Ge(e,"sparseValues","sparseToDense"),a=Ge(r,"defaultValue","sparseToDense",i.dtype);return function(t,e,n,r){if("int32"!==t.dtype)throw new Error("tf.sparseToDense() expects the indices to be int32 type, but the dtype was "+t.dtype+".");if(t.rank>2)throw new Error("sparseIndices should be a scalar, vector, or matrix, but got shape "+t.shape+".");var o=t.rank>0?t.shape[0]:1,i=t.rank>1?t.shape[1]:1;if(n.length!==i)throw new Error("outputShape has incorrect number of elements:, "+n.length+", should be: "+i+".");var a=e.size;if(0!==e.rank&&(1!==e.rank||a!==o))throw new Error("sparseValues has incorrect shape "+e.shape+", should be [] or ["+o+"]");if(e.dtype!==r.dtype)throw new Error("sparseValues.dtype must match defaultValues.dtype")}(o,i,n,a),Pt.runKernelFunc((function(t){return t.sparseToDense(o,i,n,a)}),{$sparseIndices:o,$sparseValues:i,$defaultValue:a})}}),Kc=rn({gatherND_:function(t,e){var n=Ge(e,"indices","gatherND","int32"),r=Ge(t,"x","gatherND");return Pt.runKernelFunc((function(t){return t.gatherND(r,n)}),{x:r,indices:n},null,"GatherNd")}}),Yc=rn({diag_:function(t){var e=Ge(t,"x","diag").flatten(),n=t.shape.concat(t.shape);return Pt.runKernelFunc((function(t){return t.diag(e)}),{$x:e}).reshape(n)}}),$c=rn({dropout_:function(t,e,n,r){var o=Ge(t,"x","dropout");if(C("float32"===o.dtype,(function(){return"x has to be a floating point tensor since it's going to be scaled, but got a "+o.dtype+" tensor instead."})),C(e>=0&&e<1,(function(){return"rate must be a float in the range [0, 1), but got "+e+"."})),0===e)return t instanceof yt?o.clone():o;var i=function(t,e){if(null==e)return t.shape.slice();if(O(t.shape,e))return e;if(t.shape.length===e.length){for(var n=[],r=0;r<t.shape.length;r++)null==e[r]&&null!=t.shape[r]?n.push(t.shape[r]):n.push(e[r]);return n}return e}(o,n),a=1-e,s=or(i,0,1,"float32",r).add(a).floor().div(a);return o.mul(s)}});function Jc(t,e,n){for(var r=1-t%2,o=new Float32Array(t),i=0;i<t;++i){var a=2*Math.PI*i/(t+r-1);o[i]=e-n*Math.cos(a)}return fn(o,"float32")}var Qc,Zc=rn({hannWindow_:function(t){return Jc(t,.5,.5)}}),tl=rn({hammingWindow_:function(t){return Jc(t,.54,.46)}}),el=rn({frame_:function(t,e,n,r,o){void 0===r&&(r=!1),void 0===o&&(o=0);for(var i=0,a=[];i+e<=t.size;)a.push(lc(t,i,e)),i+=n;if(r)for(;i<t.size;){var s=i+e-t.size,u=xn([lc(t,i,e-s),gn([s],o)]);a.push(u),i+=n}return 0===a.length?hn([],[0,e]):xn(a).as2D(a.length,e)}}),nl=rn({stft_:function(t,e,n,r,o){var i;void 0===o&&(o=Zc),null==r&&(i=e,r=Math.floor(Math.pow(2,Math.ceil(Math.log(i)/Math.log(2)))));for(var a=el(t,e,n),s=hu(a,o(e)),u=[],c=0;c<a.shape[0];c++)u.push(qc(s.slice([c,0],[1,e]),r));return xn(u)}}),rl=Object.freeze({hannWindow:Zc,hammingWindow:tl,frame:el,stft:nl});!function(t){t[t.NONE=0]="NONE",t[t.MEAN=1]="MEAN",t[t.SUM=2]="SUM",t[t.SUM_BY_NONZERO_WEIGHTS=3]="SUM_BY_NONZERO_WEIGHTS"}(Qc||(Qc={}));var ol=rn({absoluteDifference_:function(t,e,n,r){void 0===r&&(r=Qc.SUM_BY_NONZERO_WEIGHTS);var o=Ge(t,"labels","absoluteDifference"),i=Ge(e,"predictions","absoluteDifference"),a=null;null!=n&&(a=Ge(n,"weights","absoluteDifference")),S(o.shape,i.shape,"Error in absoluteDifference: ");var s=o.sub(i).abs();return il(s,a,r)}}),il=rn({computeWeightedLoss_:function(t,e,n){void 0===n&&(n=Qc.SUM_BY_NONZERO_WEIGHTS);var r=Ge(t,"losses","computeWeightedLoss"),o=null;null!=e&&(o=Ge(e,"weights","computeWeightedLoss"));var i=null==o?r:r.mul(o);if(n===Qc.NONE)return i;if(n===Qc.SUM)return i.sum();if(n===Qc.MEAN){if(null==o)return i.mean();var a=r.size/o.size,s=i.sum().div(o.sum());return a>1?s.div(ln(a)):s}if(n===Qc.SUM_BY_NONZERO_WEIGHTS){if(null==o)return i.sum().div(ln(r.size));var u=o.mul(mn(r.shape)).notEqual(ln(0)).sum().toFloat();return i.sum().div(u)}throw Error("Unknown reduction: "+n)}}),al=rn({cosineDistance_:function(t,e,n,r,o){void 0===o&&(o=Qc.SUM_BY_NONZERO_WEIGHTS);var i=Ge(t,"labels","cosineDistance"),a=Ge(e,"predictions","cosineDistance"),s=null;null!=r&&(s=Ge(r,"weights","cosineDistance")),S(i.shape,a.shape,"Error in cosineDistance: ");var u=ln(1).sub(i.mul(a).sum(n,!0));return il(u,s,o)}}),sl=rn({hingeLoss_:function(t,e,n,r){void 0===r&&(r=Qc.SUM_BY_NONZERO_WEIGHTS);var o=Ge(t,"labels","hingeLoss"),i=Ge(e,"predictions","hingeLoss"),a=null;null!=n&&(a=Ge(n,"weights","hingeLoss")),S(o.shape,i.shape,"Error in hingeLoss: ");var s=ln(1);o=ln(2).mul(o).sub(s);var u=s.sub(o.mul(i)).relu();return il(u,a,r)}}),ul=rn({huberLoss_:function(t,e,n,r,o){void 0===r&&(r=1),void 0===o&&(o=Qc.SUM_BY_NONZERO_WEIGHTS);var i=Ge(t,"labels","huberLoss"),a=Ge(e,"predictions","huberLoss"),s=null;null!=n&&(s=Ge(n,"weights","huberLoss")),S(i.shape,a.shape,"Error in huberLoss: ");var u=ln(r),c=a.sub(i).abs(),l=uu(c,u),f=c.sub(l),h=ln(.5).mul(l.square()).add(u.mul(f));return il(h,s,o)}}),cl=rn({logLoss_:function(t,e,n,r,o){void 0===r&&(r=1e-7),void 0===o&&(o=Qc.SUM_BY_NONZERO_WEIGHTS);var i=Ge(t,"labels","logLoss"),a=Ge(e,"predictions","logLoss"),s=null;null!=n&&(s=Ge(n,"weights","logLoss")),S(i.shape,a.shape,"Error in logLoss: ");var u=ln(1),c=ln(r),l=i.mul(a.add(c).log()).neg().sub(u.sub(i).mul(u.sub(a).add(c).log()));return il(l,s,o)}}),ll=rn({meanSquaredError_:function(t,e,n,r){void 0===r&&(r=Qc.SUM_BY_NONZERO_WEIGHTS);var o=Ge(t,"labels","meanSquaredError"),i=Ge(e,"predictions","meanSquaredError"),a=null;null!=n&&(a=Ge(n,"weights","meanSquaredError")),S(o.shape,i.shape,"Error in meanSquaredError: ");var s=o.squaredDifference(i);return il(s,a,r)}}),fl=rn({sigmoidCrossEntropy_:function(t,e,n,r,o){void 0===r&&(r=0),void 0===o&&(o=Qc.SUM_BY_NONZERO_WEIGHTS);var i=Ge(t,"multiClassLabels","sigmoidCrossEntropy"),a=Ge(e,"logits","sigmoidCrossEntropy"),s=null;if(null!=n&&(s=Ge(n,"weights","sigmoidCrossEntropy")),S(i.shape,a.shape,"Error in sigmoidCrossEntropy: "),r>0){var u=ln(r),c=ln(1),l=ln(.5);i=i.mul(c.sub(u)).add(l.mul(u))}var f=function(t,e){var n=Ge(t,"labels","sigmoidCrossEntropyWithLogits"),r=Ge(e,"logits","sigmoidCrossEntropyWithLogits");S(n.shape,r.shape,"Error in sigmoidCrossEntropyWithLogits: ");var o=r.relu(),i=r.mul(n),a=r.abs().neg().exp().log1p();return o.sub(i).add(a)}(i,a);return il(f,s,o)}}),hl=rn({softmaxCrossEntropy_:function(t,e,n,r,o){void 0===r&&(r=0),void 0===o&&(o=Qc.SUM_BY_NONZERO_WEIGHTS);var i=Ge(t,"onehotLabels","softmaxCrossEntropy"),a=Ge(e,"logits","softmaxCrossEntropy"),s=null;if(null!=n&&(s=Ge(n,"weights","softmaxCrossEntropy")),S(i.shape,a.shape,"Error in softmaxCrossEntropy: "),r>0){var u=ln(r),c=ln(1),l=ln(i.shape[1]);i=i.mul(c.sub(u)).add(u.div(l))}var f=function(t,e,n){if(void 0===n&&(n=-1),-1===n&&(n=e.rank-1),n!==e.rank-1)throw Error("Softmax cross entropy along a non-last dimension is not yet supported. Labels / logits was rank "+e.rank+" and dim was "+n);return Or((function(t,e,r){var o=e.logSumExp([n],!0),i=e.toFloat().sub(o);return r([t,i]),{value:i.mul(t).neg().sum([n]),gradFunc:function(t,e){var r=e[0],o=e[1],i=$e(t.shape,[n]);return[t.reshape(i).mul(r.toFloat().sub(o.exp())),t.reshape(i).mul(o.exp().sub(r.toFloat()))]}}}))(t,e)}(i,a);return il(f,s,o)}}),pl=Object.freeze({get Reduction(){return Qc},absoluteDifference:ol,computeWeightedLoss:il,cosineDistance:al,hingeLoss:sl,huberLoss:ul,logLoss:cl,meanSquaredError:ll,sigmoidCrossEntropy:fl,softmaxCrossEntropy:hl});function dl(t,e){return void 0===e&&(e=!1),Pt.tidy((function(){if(2!==t.shape.length)throw new Error("qr2d() requires a 2D Tensor, but got a "+t.shape.length+"D Tensor.");for(var n=t.shape[0],r=t.shape[1],o=Xn(n),i=t.clone(),a=hn([[1]],[1,1]),s=a.clone(),u=n>=r?r:n,c=function(t){var e,u=i,c=s,l=o;e=Pt.tidy((function(){var e=i.slice([t,t],[n-t,1]),u=e.norm(),c=i.slice([t,t],[1,1]),l=hn([[-1]]).where(c.greater(0),hn([[1]])),f=c.sub(l.mul(u)),h=e.div(f);s=1===h.shape[0]?a.clone():a.concat(h.slice([1,0],[h.shape[0]-1,h.shape[1]]),0);var p=l.matMul(f).div(u).neg(),d=i.slice([t,0],[n-t,r]),m=p.mul(s);if(0===t)i=d.sub(m.matMul(s.transpose().matMul(d)));else{var v=d.sub(m.matMul(s.transpose().matMul(d)));i=i.slice([0,0],[t,r]).concat(v,0)}var g=o.slice([0,t],[n,o.shape[1]-t]);if(0===t)o=g.sub(g.matMul(s).matMul(m.transpose()));else{var y=g.sub(g.matMul(s).matMul(m.transpose()));o=o.slice([0,0],[n,t]).concat(y,1)}return[s,i,o]})),s=e[0],i=e[1],o=e[2],We([u,c,l])},l=0;l<u;++l)c(l);return!e&&n>r&&(o=o.slice([0,0],[n,r]),i=i.slice([0,0],[r,r])),[o,i]}))}var ml=rn({bandPart_:function(t,e,n){if(e%1!=0)throw new Error("bandPart(): numLower must be an integer, got "+e+".");if(n%1!=0)throw new Error("bandPart(): numUpper must be an integer, got "+n+".");var r=Ge(t,"a","bandPart");if(r.rank<2)throw new Error("bandPart(): Rank must be at least 2, got "+r.rank+".");var o=r.shape,i=r.shape.slice(-2),a=i[0],s=i[1];if(!(e<=a))throw new Error("bandPart(): numLower ("+e+") must not be greater than the number of rows ("+a+").");if(!(n<=s))throw new Error("bandPart(): numUpper ("+n+") must not be greater than the number of columns ("+s+").");e<0&&(e=a),n<0&&(n=s);var u=yn(0,a,1,"int32").reshape([-1,1]),c=yn(0,s,1,"int32"),l=gu(u,c),f=Hs(l.lessEqual(ln(+e,"int32")),l.greaterEqual(ln(-n,"int32"))),h=vn([a,s],r.dtype);return ur(fr(r.reshape([-1,a,s])).map((function(t){return $s(f,t,h)}))).reshape(o)}}),vl=rn({gramSchmidt_:function(t){var e;if(Array.isArray(t)){e=!1,C(null!=t&&t.length>0,(function(){return"Gram-Schmidt process: input must not be null, undefined, or empty"}));for(var n=t[0].shape[0],r=function(e){C(t[e].shape[0]===n,(function(){return"Gram-Schmidt: Non-unique lengths found in the input vectors: ("+t[e].shape[0]+" vs. "+n+")"}))},o=1;o<t.length;++o)r(o)}else e=!0,t=kn(t,t.shape[0],0).map((function(t){return sr(t,[0])}));C(t.length<=t[0].shape[0],(function(){return"Gram-Schmidt: Number of vectors ("+t.length+") exceeds number of dimensions ("+t[0].shape[0]+")."}));var i=[],a=t,s=function(t){i.push(Pt.tidy((function(){var e=a[t];if(t>0)for(var n=0;n<t;++n){var r=Sc(i[n].mulStrict(e)).mul(i[n]);e=e.sub(r)}return e.div(Mc(e,"euclidean"))})))};for(o=0;o<t.length;++o)s(o);return e?ur(i,0):i}}),gl=rn({qr_:function(t,e){if(void 0===e&&(e=!1),t.rank<2)throw new Error("qr() requires input tensor to have a rank >= 2, but got rank "+t.rank);if(2===t.rank)return dl(t,e);var n=t.shape.slice(0,t.shape.length-2).reduce((function(t,e){return t*e})),r=fr(t.reshape([n,t.shape[t.shape.length-2],t.shape[t.shape.length-1]]),0),o=[],i=[];return r.forEach((function(t){var n=dl(t,e),r=n[0],a=n[1];o.push(r),i.push(a)})),[ur(o,0).reshape(t.shape),ur(i,0).reshape(t.shape)]}}),yl=Object.freeze({bandPart:ml,gramSchmidt:vl,qr:gl});function bl(t,e,n,r,o,i){null==r&&(r=.5),null==o&&(o=Number.NEGATIVE_INFINITY),null==i&&(i=0);var a=t.shape[0];return n=Math.min(n,a),C(0<=r&&r<=1,(function(){return"iouThreshold must be in [0, 1], but was '"+r+"'"})),C(2===t.rank,(function(){return"boxes must be a 2D tensor, but was of rank '"+t.rank+"'"})),C(4===t.shape[1],(function(){return"boxes must have 4 columns, but 2nd dimension was "+t.shape[1]})),C(1===e.rank,(function(){return"scores must be a 1D tensor"})),C(e.shape[0]===a,(function(){return"scores has incompatible shape with boxes. Expected "+a+", but was "+e.shape[0]})),C(0<=i&&i<=1,(function(){return"softNmsSigma must be in [0, 1], but was '"+i+"'"})),{maxOutputSize:n,iouThreshold:r,scoreThreshold:o,softNmsSigma:i}}var wl=rn({resizeBilinear_:function(t,e,n){void 0===n&&(n=!1);var r=Ge(t,"images","resizeBilinear");C(3===r.rank||4===r.rank,(function(){return"Error in resizeBilinear: x must be rank 3 or 4, but got rank "+r.rank+"."})),C(2===e.length,(function(){return"Error in resizeBilinear: new shape must 2D, but got shape "+e+"."}));var o=r,i=!1;3===r.rank&&(i=!0,o=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var a=e[0],s=e[1],u=Pt.runKernelFunc((function(t,e){return e([o]),t.resizeBilinear(o,a,s,n)}),{x:o},(function(t,e){return{x:function(){return Pt.runKernelFunc((function(r){return r.resizeBilinearBackprop(t,e[0],n)}),{})}}}),"ResizeBilinear",{alignCorners:n,newHeight:a,newWidth:s});return i?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),xl=rn({resizeNearestNeighbor_:function(t,e,n){void 0===n&&(n=!1);var r=Ge(t,"images","resizeNearestNeighbor");C(3===r.rank||4===r.rank,(function(){return"Error in resizeNearestNeighbor: x must be rank 3 or 4, but got rank "+r.rank+"."})),C(2===e.length,(function(){return"Error in resizeNearestNeighbor: new shape must 2D, but got shape "+e+"."})),C("float32"===r.dtype||"int32"===r.dtype,(function(){return"`images` must have `int32` or `float32` as dtype"}));var o=r,i=!1;3===r.rank&&(i=!0,o=r.as4D(1,r.shape[0],r.shape[1],r.shape[2]));var a=e[0],s=e[1],u=Pt.runKernelFunc((function(t,e){return e([o]),t.resizeNearestNeighbor(o,a,s,n)}),{batchImages:o},(function(t,e){return{batchImages:function(){return Pt.runKernelFunc((function(r){return r.resizeNearestNeighborBackprop(t,e[0],n)}),{})}}}));return i?u.as3D(u.shape[1],u.shape[2],u.shape[3]):u}}),_l=rn({nonMaxSuppression_:function(t,e,n,r,o){void 0===r&&(r=.5),void 0===o&&(o=Number.NEGATIVE_INFINITY);var i=Ge(t,"boxes","nonMaxSuppression"),a=Ge(e,"scores","nonMaxSuppression"),s=bl(i,a,n,r,o);n=s.maxOutputSize,r=s.iouThreshold,o=s.scoreThreshold;var u={maxOutputSize:n,iouThreshold:r,scoreThreshold:o};return Pt.runKernelFunc((function(t){return t.nonMaxSuppression(i,a,n,r,o)}),{boxes:i,scores:a},null,"NonMaxSuppressionV3",u)}}),El=rn({nonMaxSuppressionWithScore_:function(t,e,n,r,o,i){void 0===r&&(r=.5),void 0===o&&(o=Number.NEGATIVE_INFINITY),void 0===i&&(i=0);var a=Ge(t,"boxes","nonMaxSuppression"),s=Ge(e,"scores","nonMaxSuppression"),u=bl(a,s,n,r,o,i),c={maxOutputSize:n=u.maxOutputSize,iouThreshold:r=u.iouThreshold,scoreThreshold:o=u.scoreThreshold,softNmsSigma:i=u.softNmsSigma},l=Pt.runKernel("NonMaxSuppressionV5",{boxes:a,scores:s},c);return{selectedIndices:l[0],selectedScores:l[1]}}}),Cl=rn({cropAndResize_:function(t,e,n,r,o,i){var a=Ge(t,"image","cropAndResize"),s=Ge(e,"boxes","cropAndResize","float32"),u=Ge(n,"boxInd","cropAndResize","int32");o=o||"bilinear",i=i||0;var c=s.shape[0];return C(4===a.rank,(function(){return"Error in cropAndResize: image must be rank 4,but got rank "+a.rank+"."})),C(2===s.rank&&4===s.shape[1],(function(){return"Error in cropAndResize: boxes must be have size ["+c+",4] but had shape "+s.shape+"."})),C(1===u.rank&&u.shape[0]===c,(function(){return"Error in cropAndResize: boxInd must be have size ["+c+"] but had shape "+s.shape+"."})),C(2===r.length,(function(){return"Error in cropAndResize: cropSize must be of length 2, but got length "+r.length+"."})),C(r[0]>=1&&r[1]>=1,(function(){return"cropSize must be atleast [1,1], but was "+r})),C("bilinear"===o||"nearest"===o,(function(){return"method must be bilinear or nearest, but was "+o})),Pt.runKernelFunc((function(t,e){return t.cropAndResize(a,s,u,r,o,i)}),{images:a,boxes:s,boxInd:u},null,"CropAndResize",{method:o,extrapolationValue:i,cropSize:r})}}),Sl=Object.freeze({resizeBilinear:wl,resizeNearestNeighbor:xl,nonMaxSuppression:_l,nonMaxSuppressionAsync:function(t,e,n,r,o){return void 0===r&&(r=.5),void 0===o&&(o=Number.NEGATIVE_INFINITY),s(this,void 0,void 0,(function(){var i,a,s,c,l,f,h;return u(this,(function(u){switch(u.label){case 0:return i=Ge(t,"boxes","nonMaxSuppressionAsync"),a=Ge(e,"scores","nonMaxSuppressionAsync"),s=bl(i,a,n,r,o),n=s.maxOutputSize,r=s.iouThreshold,o=s.scoreThreshold,[4,Promise.all([i.data(),a.data()])];case 1:return c=u.sent(),l=c[0],f=c[1],h=io(l,f,n,r,o),i!==t&&i.dispose(),a!==e&&a.dispose(),[2,h]}}))}))},nonMaxSuppressionWithScore:El,nonMaxSuppressionWithScoreAsync:function(t,e,n,r,o,i){return void 0===r&&(r=.5),void 0===o&&(o=Number.NEGATIVE_INFINITY),void 0===i&&(i=0),s(this,void 0,void 0,(function(){var a,s,c,l,f,h,p;return u(this,(function(u){switch(u.label){case 0:return a=Ge(t,"boxes","nonMaxSuppressionAsync"),s=Ge(e,"scores","nonMaxSuppressionAsync"),c=bl(a,s,n,r,o,i),n=c.maxOutputSize,r=c.iouThreshold,o=c.scoreThreshold,i=c.softNmsSigma,[4,Promise.all([a.data(),s.data()])];case 1:return l=u.sent(),f=l[0],h=l[1],p=ao(f,h,n,r,o,i),a!==t&&a.dispose(),s!==e&&s.dispose(),[2,p]}}))}))},cropAndResize:Cl}),kl=function(t,e){return!(t>0)||"linear"===e},Tl=function(t,e,n){if(null==n||"linear"===n)return t;if("relu"===n)return t.mul(e.step());throw new Error("Gradient for activation "+n+" has not been implemented yet.")},Il=function(t,e){var n=e,r=jr(t.shape,e.shape);return r.length>0&&(n=n.sum(r)),n.reshape(t.shape)},Ol=function(t,e,n){if("linear"===e)return t;if("relu"===e)return Rc(t);if("elu"===e)return Tc(t);if("relu6"===e)return Ac(t);if("prelu"===e)return Oc(t,n);throw new Error("Unknown fused activation "+e+".")},Rl=rn({fusedMatMul_:function(t){var e,n=t.a,r=t.b,o=t.transposeA,i=void 0!==o&&o,a=t.transposeB,s=void 0!==a&&a,u=t.bias,c=t.activation,l=void 0===c?"linear":c,f=t.preluActivationWeights;if(!1===kl(Pt.state.gradientDepth,l)){var h=Yu(n,r,i,s);return null!=u&&(h=Qs(h,u)),Ol(h,l,f)}var p=Ge(n,"a","fused matMul"),d=Ge(r,"b","fused matMul");e=It(p,d),p=e[0],d=e[1];var m=i?p.shape[p.rank-2]:p.shape[p.rank-1],v=s?d.shape[d.rank-1]:d.shape[d.rank-2],g=i?p.shape[p.rank-1]:p.shape[p.rank-2],y=s?d.shape[d.rank-2]:d.shape[d.rank-1],b=p.shape.slice(0,-2),w=d.shape.slice(0,-2),x=I(b),_=I(w);C(p.rank>=2&&d.rank>=2&&p.rank===d.rank,(function(){return"Error in fused matMul: inputs must have the same rank of at least 2, got ranks "+p.rank+" and "+d.rank+"."})),C(O(b,w),(function(){return"Error in fused matMul: outer dimensions ("+b+") and ("+w+") of Tensors with shapes "+p.shape+" and "+d.shape+" must match."})),C(m===v,(function(){return"Error in fused matMul: inner shapes ("+m+") and ("+v+") of Tensors with shapes "+p.shape+" and "+d.shape+" and transposeA="+i+" and transposeB="+s+" must match."}));var E,S,k=p.shape.slice(0,-2).concat([g,y]),T=i?p.as3D(x,m,g):p.as3D(x,g,m),R=s?d.as3D(_,y,v):d.as3D(_,v,y);null!=u&&Fr(k,(E=It(E=Ge(u,"bias","fused matMul"),p)[0]).shape),null!=f&&(S=Ge(f,"prelu weights","fused matMul"));var A={a:T,b:R};null!=u&&(A.bias=E),null!=f&&(A.preluActivationWeights=S);var D=[T,R];return Pt.runKernelFunc((function(t,e){var n=t.fusedBatchMatMul({a:T,b:R,transposeA:i,transposeB:s,bias:E,activation:l,preluActivationWeights:S});return e([T,R,n]),n}),A,(function(t,e){var n=e[0],r=e[1],o=e[2],a=Tl(t,o,l),c={};return null!=u&&(c={bias:function(){return Il(E,a)}}),i||s?!i&&s?Object.assign({a:function(){return a.matMul(r,!1,!1)},b:function(){return a.matMul(n,!0,!1)}},c):i&&!s?Object.assign({a:function(){return r.matMul(a,!1,!0)},b:function(){return n.matMul(a,!1,!1)}},c):Object.assign({a:function(){return r.matMul(a,!0,!0)},b:function(){return a.matMul(n,!0,!0)}},c):Object.assign({a:function(){return a.matMul(r,!1,!0)},b:function(){return n.matMul(a,!0,!1)}},c)}),"_FusedMatMul",{transposeA:i,transposeB:s,activation:l},D,[!0]).reshape(k)}}),Al=rn({fusedConv2d_:function(t){var e=t.x,n=t.filter,r=t.strides,o=t.pad,i=t.dataFormat,a=void 0===i?"NHWC":i,s=t.dilations,u=void 0===s?[1,1]:s,c=t.dimRoundingMode,l=t.bias,f=t.activation,h=void 0===f?"linear":f,p=t.preluActivationWeights;if(h=h||"linear",!1===kl(Pt.state.gradientDepth,h)){var d=Lu(e,n,r,o,a,u,c);return null!=l&&(d=Qs(d,l)),Ol(d,h,p)}var m=Ge(e,"x","conv2d"),v=Ge(n,"filter","conv2d"),g=m,y=!1;3===m.rank&&(y=!0,g=m.as4D(1,m.shape[0],m.shape[1],m.shape[2])),C(4===g.rank,(function(){return"Error in fused conv2d: input must be rank 4, but got rank "+g.rank+"."})),C(4===v.rank,(function(){return"Error in fused conv2d: filter must be rank 4, but got rank "+v.rank+"."})),null!=c&&C(R(o),(function(){return"Error in fused conv2d: pad must be an integer when using, dimRoundingMode "+c+" but got pad "+o+"."})),C(g.shape[3]===v.shape[2],(function(){return"Error in conv2d: depth of input ("+g.shape[3]+") must match input depth for filter "+v.shape[2]+"."})),C(Kr(r,u),(function(){return"Error in conv2D: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+u+"'"})),C("NHWC"===a,(function(){return"Error in conv2d: got dataFormat of "+a+" but only NHWC is currently supported."}));var b,w,x=Ur(g.shape,v.shape,r,u,o,c);null!=l&&(b=It(b=Ge(l,"bias","fused conv2d"),m)[0],Fr(x.outShape,b.shape)),null!=p&&(w=Ge(p,"prelu weights","fused conv2d"));var _={x:g,filter:v};null!=l&&(_.bias=b),null!=p&&(_.preluActivationWeights=w);var E=[v,g],S=Pt.runKernelFunc((function(t,e){var n=t.fusedConv2d({input:g,filter:v,convInfo:x,bias:b,activation:h,preluActivationWeights:w});return e([v,g,n]),n}),_,(function(t,e){var n=e,i=n[0],a=n[1],s=n[2],c=Tl(t,s,h);C(Xr(u),(function(){return"Error in gradient of fused conv2D: dilation rates greater than 1 are not yet supported in gradients. Got dilations '"+u+"'"}));var f={};return null!=l&&(f={bias:function(){return Il(b,c)}}),Object.assign({x:function(){return zu(a.shape,c,i,r,o)},filter:function(){return Wu(a,c,i.shape,r,o)}},f)}),"FusedConv2D",{convInfo:x,activation:h},E,[!0]);return y?S.as3D(S.shape[1],S.shape[2],S.shape[3]):S}}),Dl=rn({fusedDepthwiseConv2d_:function(t){var e=t.x,n=t.filter,r=t.strides,o=t.pad,i=t.dataFormat,a=void 0===i?"NHWC":i,s=t.dilations,u=void 0===s?[1,1]:s,c=t.dimRoundingMode,l=t.bias,f=t.activation,h=void 0===f?"linear":f,p=t.preluActivationWeights;if(!1===kl(Pt.state.gradientDepth,h)){var d=Vu(e,n,r,o,a,u,c);return null!=l&&(d=Qs(d,l)),Ol(d,h,p)}var m=Ge(e,"x","depthwiseConv2d"),v=Ge(n,"filter","depthwiseConv2d"),g=m,y=!1;3===m.rank&&(y=!0,g=m.as4D(1,m.shape[0],m.shape[1],m.shape[2])),C(4===g.rank,(function(){return"Error in fused depthwiseConv2d: input must be rank 4, but got rank "+g.rank+"."})),C(4===v.rank,(function(){return"Error in fused depthwiseConv2d: filter must be rank 4, but got rank "+v.rank+"."})),C(g.shape[3]===v.shape[2],(function(){return"Error in fused depthwiseConv2d: number of input channels ("+g.shape[3]+") must match the inChannels dimension in filter "+v.shape[2]+"."})),null==u&&(u=[1,1]),C(Kr(r,u),(function(){return"Error in fused depthwiseConv2d: Either strides or dilations must be 1. Got strides "+r+" and dilations '"+u+"'"})),null!=c&&C(R(o),(function(){return"Error in fused depthwiseConv2d: pad must be an integer when using dimRoundingMode "+c+" but got pad "+o+"."}));var b,w,x=Ur(g.shape,v.shape,r,u,o,c,!0);null!=l&&(b=It(b=Ge(l,"bias","fused conv2d"),m)[0],Fr(x.outShape,b.shape)),null!=p&&(w=Ge(p,"prelu weights","fused depthwiseConv2d"));var _={x:g,filter:v};null!=l&&(_.bias=b),null!=p&&(_.preluActivationWeights=w);var E=[v,g],S=Pt.runKernelFunc((function(t,e){var n=t.fusedDepthwiseConv2D({input:g,filter:v,convInfo:x,bias:b,activation:h,preluActivationWeights:w});return e([v,g,n]),n}),_,(function(t,e){C(Xr(u),(function(){return"Error in gradient of fused depthwiseConv2d: dilation rates greater than 1 are not yet supported. Got dilations '"+u+"'"}));var n=e[0],r=e[1],o=e[2],i=Tl(t,o,h),a={};return null!=l&&(a={bias:function(){return Il(b,i)}}),Object.assign({x:function(){return qu(r.shape,i,n,x)},filter:function(){return Gu(r,i,n.shape,x)}},a)}),"FusedDepthwiseConv2D",{convInfo:x,activation:h},E,[!0]);return y?S.as3D(S.shape[1],S.shape[2],S.shape[3]):S}}),Nl=Object.freeze({matMul:Rl,conv2d:Al,depthwiseConv2d:Dl}),Pl=Object.freeze({image:Sl,linalg:yl,losses:pl,spectral:Hc,fused:Nl,signal:rl,square:Ya,squaredDifference:Ja,conv1d:Bu,conv2d:Lu,conv3d:Uu,depthwiseConv2d:Vu,separableConv2d:Hu,conv2dTranspose:Xu,conv3dTranspose:Ku,op:rn,batchNormalization2d:Bs,batchNormalization3d:Ls,batchNormalization4d:Us,batchNormalization:Ws,batchNorm:zs,batchNorm2d:Vs,batchNorm3d:qs,batchNorm4d:Gs,booleanMaskAsync:function(t,e,n){return s(this,void 0,void 0,(function(){var r,o,i,a,s,c,l,f,h,p,d,m,v;return u(this,(function(u){switch(u.label){case 0:for(r=Ge(t,"tensor","boolMask"),o=Ge(e,"mask","boolMask","bool"),i=null==n?0:n,a=o.rank,s=r.shape,C(a>0,(function(){return"mask cannot be scalar"})),S(s.slice(i,i+a),o.shape,"mask's shape must match the first K dimensions of tensor's shape,"),c=1,l=i;l<i+a;l++)c*=s[l];return f=s.slice(0,i).concat([c],s.slice(i+a)),h=r.reshape(f),p=o.reshape([-1]),[4,Js(p)];case 1:return d=u.sent(),m=d.squeeze([1]),v=Nu(h,m,i),t!==r&&r.dispose(),e!==o&&o.dispose(),m.dispose(),h.dispose(),p.dispose(),d.dispose(),[2,v]}}))}))},complex:on,real:an,imag:sn,concat:xn,concat1d:_n,concat2d:En,concat3d:Cn,concat4d:Sn,split:kn,matMul:Yu,dot:$u,outerProduct:Ju,reverse:Qu,reverse1d:Zu,reverse2d:tc,reverse3d:ec,reverse4d:nc,maxPool:ic,avgPool:ac,pool:sc,maxPool3d:uc,avgPool3d:cc,slice:lc,slice1d:fc,slice2d:hc,slice3d:pc,slice4d:dc,abs:Qa,acos:Za,acosh:ts,asin:es,asinh:ns,atan:rs,atanh:os,ceil:is,clipByValue:as,cos:ss,cosh:us,erf:cs,exp:ls,expm1:fs,floor:hs,log:ps,log1p:ds,logSigmoid:ms,neg:vs,reciprocal:gs,round:ys,rsqrt:bs,sigmoid:ws,sign:xs,isNaN:_s,isInf:Es,isFinite:Cs,sin:Ss,sinh:ks,softplus:Ts,sqrt:Is,step:Os,tan:Rs,tanh:As,all:vc,any:gc,argMax:yc,argMin:bc,logSumExp:wc,max:xc,mean:_c,min:Ec,moments:Cc,sum:Sc,prod:kc,equal:bu,equalStrict:wu,greater:xu,greaterEqual:_u,greaterEqualStrict:Eu,greaterStrict:Cu,less:Su,lessEqual:ku,lessEqualStrict:Tu,lessStrict:Iu,notEqual:Ou,notEqualStrict:Ru,add:Qs,addN:Zs,addStrict:tu,atan2:eu,div:nu,divNoNan:ru,divStrict:ou,floorDiv:iu,maximum:au,maximumStrict:su,minimum:uu,minimumStrict:cu,mod:lu,modStrict:fu,mul:hu,mulStrict:pu,pow:du,powStrict:mu,squaredDifferenceStrict:vu,sub:gu,subStrict:yu,elu:Tc,leakyRelu:Ic,prelu:Oc,relu:Rc,relu6:Ac,selu:Dc,logicalAnd:Hs,logicalNot:Xs,logicalOr:Ks,logicalXor:Ys,where:$s,whereAsync:Js,buffer:Ln,print:function(t,e){void 0===e&&(e=!1),console.log(t.toString(e))},batchToSpaceND:Un,broadcastTo:Wn,cast:zn,clone:Vn,cumsum:qn,depthToSpace:Gn,expandDims:Hn,eye:Xn,multinomial:Kn,oneHot:Yn,pad:$n,pad1d:Jn,pad2d:Qn,pad3d:Zn,pad4d:tr,rand:er,randomNormal:nr,randomGamma:rr,randomUniform:or,reshape:ir,spaceToBatchND:ar,squeeze:sr,stack:ur,tile:cr,truncatedNormal:lr,unstack:fr,setdiff1dAsync:function(t,e){return s(this,void 0,void 0,(function(){var n,r,o,i,a,s,c,l,f,h;return u(this,(function(u){switch(u.label){case 0:return n=Ge(t,"x","setdiff1d"),r=Ge(e,"y","setdiff1d"),C(n.dtype===r.dtype,(function(){return"x and y should have the same dtype, but got x ("+n.dtype+") and y ("+r.dtype+")."})),C(1===n.rank,(function(){return"x should be 1D tensor, but got x ("+n.shape+")."})),C(1===r.rank,(function(){return"y should be 1D tensor, but got y ("+r.shape+")."})),[4,n.data()];case 1:return o=u.sent(),[4,r.data()];case 2:for(i=u.sent(),a=new Set(i),s=0,f=0;f<o.length;f++)a.has(o[f])||s++;for(c=new dt([s],n.dtype),l=new dt([s],"int32"),f=0,h=0;f<o.length;f++)a.has(o[f])||(c.values[h]=o[f],l.values[h]=f,h++);return[2,[c.toTensor(),l.toTensor()]]}}))}))},fill:gn,linspace:function(t,e,n){if(n<=0)throw new Error("The number of values should be positive.");return Pt.runKernelFunc((function(r){return r.linspace(t,e,n)}),{})},ones:mn,range:yn,scalar:ln,tensor:un,tensor1d:fn,tensor2d:hn,tensor3d:pn,tensor4d:dn,tensor5d:function(t,e,n){if(k(t),null!=e&&5!==e.length)throw new Error("tensor5d() requires shape to have five numbers");var r=Ve(t,n);if(5!==r.length&&1!==r.length)throw new Error("tensor5d() requires values to be number[][][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor5d() requires shape to be provided when `values` are a flat array");return cn(t,e,r,n)},tensor6d:function(t,e,n){if(k(t),null!=e&&6!==e.length)throw new Error("tensor6d() requires shape to have six numbers");var r=Ve(t,n);if(6!==r.length&&1!==r.length)throw new Error("tensor6d() requires values to be number[][][][][][] or flat/TypedArray");if(1===r.length&&null==e)throw new Error("tensor6d() requires shape to be provided when `values` are a flat array");return cn(t,e=e||r,r,n)},variable:function(t,e,n,r){return void 0===e&&(e=!0),Pt.makeVariable(t,e,n,r)},zeros:vn,onesLike:bn,zerosLike:wn,transpose:Nc,softmax:Rr,logSoftmax:Ar,localResponseNormalization:Pc,norm:Mc,gather:Nu,unsortedSegmentSum:Pu,basicLSTMCell:jc,multiRNNCell:Fc,movingAverage:Bc,stridedSlice:Lc,topk:Uc,scatterND:Wc,fft:zc,ifft:Vc,rfft:qc,irfft:Gc,sparseToDense:Xc,gatherND:Kc,diag:Yc,dropout:$c,hannWindow:Zc,hammingWindow:tl,frame:el,stft:nl,inTopKAsync:function(t,e,n){return void 0===n&&(n=1),s(this,void 0,void 0,(function(){var r,o,i,a,s,c,l,f,h,p,d,m,v,g;return u(this,(function(u){switch(u.label){case 0:return r=Ge(t,"predictions","inTopK"),o=Ge(e,"targets","inTopK"),C(r.rank>1,(function(){return"inTopK() expects the predictions to be of rank 2 or higher, but got "+r.rank})),C(r.rank-1===o.rank,(function(){return"predictions rank should be 1 larger than targets rank, but got predictions rank "+r.rank+" and targets rank "+o.rank})),S(r.shape.slice(0,r.shape.length-1),o.shape,"predictions's shape should be align with the targets' shape, except the last dimension."),i=r.shape[r.shape.length-1],C(n>0&&n<=i,(function(){return"'k' passed to inTopK() must be > 0 && <= the predictions last dimension ("+i+"), but got "+n})),[4,r.data()];case 1:return a=u.sent(),[4,o.data()];case 2:for(s=u.sent(),c=[a.length/i,i],f=c[1],h=B("bool",l=c[0]),p=0;p<l;p++){for(d=p*f,m=a.subarray(d,d+f),v=[],g=0;g<m.length;g++)v.push({value:m[g],index:g});for(v.sort((function(t,e){return e.value-t.value})),h[p]=0,g=0;g<n;g++)if(v[g].index===s[p]){h[p]=1;break}}return t!==r&&r.dispose(),e!==o&&o.dispose(),[2,un(h,o.shape,"bool")]}}))}))}});function Ml(t,e){Array.isArray(t)||(t=[t]),t.forEach((function(t){null!=t&&C("complex64"!==t.dtype,(function(){return e+" does not support complex64 tensors."}))}))}function jl(t,e,n,r){if("linear"===n)return t.linear(e);if("relu"===n)return t.relu(e);if("elu"===n)return t.elu(e);if("relu6"===n)return t.relu6(e);if("prelu"===n)return t.prelu(e,r);throw new Error("Activation "+n+" has not been implemented for the CPU backend.")}var Fl=function(t){function e(){var e=t.call(this)||this;return e.blockSize=48,e.firstUse=!0,e.data=new Dr(e,Pt),e}return a(e,t),e.prototype.write=function(t,e,n){this.firstUse&&(this.firstUse=!1,f().get("IS_NODE")&&ze("\n============================\nHi there 👋. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require('@tensorflow/tfjs-node'); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.\n============================"));var r={};return this.data.set(r,{values:t,dtype:n}),r},e.prototype.move=function(t,e,n,r){this.data.set(t,{values:e,dtype:r})},e.prototype.numDataIds=function(){return this.data.numDataIds()},e.prototype.read=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,this.readSync(t)]}))}))},e.prototype.readSync=function(t){var e=this.data.get(t),n=e.dtype,r=e.complexTensors;return"complex64"===n?Zr(this.readSync(r.real.dataId),this.readSync(r.imag.dataId)):this.data.get(t).values},e.prototype.bufferSync=function(t){var e=this.readSync(t.dataId),n=e;if("string"===t.dtype)try{n=e.map((function(t){return at(t)}))}catch(t){throw new Error("Failed to decode encoded string bytes into utf-8")}return Ln(t.shape,t.dtype,n)},e.prototype.makeOutput=function(t,e,n){var r=this.write(t,e,n);return Pt.makeTensorFromDataId(r,e,n,this)},e.prototype.disposeData=function(t){if(this.data.has(t)){var e=this.data.get(t).complexTensors;null!=e&&(e.real.dispose(),e.imag.dispose()),this.data.delete(t)}},e.prototype.time=function(t){return s(this,void 0,void 0,(function(){var e;return u(this,(function(n){return e=rt(),t(),[2,{kernelMs:rt()-e}]}))}))},e.prototype.memory=function(){return{unreliable:!0,reasons:["The reported memory is an upper bound. Due to automatic garbage collection, the true allocated memory may be less."]}},e.prototype.complex=function(t,e){var n=this.makeOutput(null,t.shape,"complex64");return this.data.get(n.dataId).complexTensors={real:Pt.keep(t.clone()),imag:Pt.keep(e.clone())},n},e.prototype.real=function(t){return this.data.get(t.dataId).complexTensors.real.clone()},e.prototype.imag=function(t){return this.data.get(t.dataId).complexTensors.imag.clone()},e.prototype.slice=function(t,e,n){if(Ml(t,"slice"),Tr(t.shape,e,n)){var r=Ir(e,t.strides),o=I(n);return un(this.readSync(t.dataId).subarray(r,r+o),n,t.dtype)}for(var i=Ln(n,t.dtype),a=this.bufferSync(t),s=0;s<i.size;++s){var u=i.indexToLoc(s).map((function(t,n){return t+e[n]}));i.values[s]=a.get.apply(a,u)}return i.toTensor()},e.prototype.stridedSlice=function(t,e,n,r){Ml(t,"stridedSlice");var o=Cr(e,n,r);if(o.some((function(t){return 0===t})))return un([],o);for(var i=Ln(o,t.dtype),a=this.bufferSync(t),s=0;s<i.size;s++){for(var u=i.indexToLoc(s),c=new Array(u.length),l=0;l<c.length;l++)c[l]=u[l]*r[l]+e[l];i.set.apply(i,[a.get.apply(a,c)].concat(u))}return i.toTensor()},e.prototype.diag=function(t){for(var e=this.readSync(t.dataId),n=Ln([t.size,t.size],t.dtype),r=n.values,o=0;o<e.length;o++)r[o*t.size+o]=e[o];return n.toTensor()},e.prototype.unstack=function(t,e){for(var n=t.shape[e],r=new Array(t.rank-1),o=0,i=0;i<t.rank;i++)i!==e&&(r[o++]=t.shape[i]);var a=new Array(t.rank).fill(0),s=t.shape.slice();s[e]=1;var u=new Array(n);for(i=0;i<u.length;i++)a[e]=i,u[i]=this.slice(t,a,s).reshape(r);return u},e.prototype.reverse=function(t,e){Ml(t,"reverse");for(var n=Ln(t.shape,t.dtype),r=this.bufferSync(t),o=function(o){var i=n.indexToLoc(o),a=i.slice();e.forEach((function(e){return a[e]=t.shape[e]-1-a[e]})),n.set.apply(n,[r.get.apply(r,a)].concat(i))},i=0;i<n.size;i++)o(i);return n.toTensor()},e.prototype.concat=function(t,e){var n=this;if("complex64"===t[0].dtype){var r=t.map((function(t){return an(t)})),o=t.map((function(t){return sn(t)}));return on(this.concat(r,e),this.concat(o,e))}var i=t.map((function(t){var n=I(t.shape.slice(e));return t.as2D(-1,n)})),a=nn(i.map((function(t){return t.shape})),1),s=Ln(a,t[0].dtype).values;if(1===i[0].shape[0]){var u=0;i.forEach((function(t){s.set(n.readSync(t.dataId),u),u+=t.size}))}else{var c=0;i.forEach((function(t){for(var e=n.readSync(t.dataId),r=0,o=0;o<t.shape[0];++o)for(var i=o*a[1]+c,u=0;u<t.shape[1];++u)s[i+u]=e[r++];c+=t.shape[1]}))}var l=nn(t.map((function(t){return t.shape})),e);return un(s,l,t[0].dtype)},e.prototype.neg=function(t){return Ml(t,"neg"),this.multiply(ln(-1),t)},e.prototype.add=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),(function(t,e,n,r){return{real:t+n,imag:e+r}})):this.broadcastedBinaryOp(t,e,kt(t.dtype,e.dtype),(function(t,e){return t+e}))},e.prototype.addN=function(t){var e=this;Ml(t,"addN");for(var n=t.map((function(t){return e.readSync(t.dataId)})),r=Ln(t[0].shape,t[0].dtype),o=r.values,i=0;i<t.length;i++)for(var a=n[i],s=0;s<o.length;s++)o[s]+=a[s];return r.toTensor()},e.prototype.softmax=function(t,e){var n=j([e],t.shape),r=this.max(t,n),o=$e(r.shape,n),i=this.subtract(t,r.reshape(o)),a=this.exp(i),s=this.sum(a,n).reshape(o);return this.realDivide(a,s)},e.prototype.subtract=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),(function(t,e,n,r){return{real:t-n,imag:e-r}})):this.broadcastedBinaryOp(t,e,kt(t.dtype,e.dtype),(function(t,e){return t-e}))},e.prototype.pow=function(t,e){return Ml([t,e],"pow"),this.broadcastedBinaryOp(t,e,t.dtype,(function(t,e){return Math.pow(t,e)}))},e.prototype.batchMatMul=function(t,e,n,r){Ml([t,e],"matMul");for(var o=n?t.shape[1]:t.shape[2],i=n?t.shape[2]:t.shape[1],a=r?e.shape[1]:e.shape[2],s=t.shape[0],u=this.readSync(t.dataId),c=this.readSync(e.dataId),l=n?[t.strides[0],1,t.strides[1]]:[t.strides[0],t.strides[1],1],f=l[0],h=l[1],p=l[2],d=r?[1,e.strides[1],e.strides[0]]:[e.strides[1],1,e.strides[0]],m=d[0],v=d[1],g=d[2],y=i*a,b=Ln([s,i,a],t.dtype),w=b.values,x=this.blockSize,_=0;_<s;_++)for(var E=0;E<i;E+=x)for(var C=0;C<a;C+=x)for(var S=0;S<o;S+=x)for(var k=Math.min(E+x,i),T=Math.min(C+x,a),I=Math.min(S+x,o),O=E;O<k;O++)for(var R=C;R<T;R++){for(var A=0,D=S;D<I;D++)A+=u[_*f+O*h+D*p]*c[D*m+R*v+_*g];w[_*y+(O*a+R)]+=A}return b.toTensor()},e.prototype.fusedBatchMatMul=function(t){var e=t.a,n=t.b,r=t.transposeA,o=t.transposeB,i=t.bias,a=t.activation,s=t.preluActivationWeights,u=this.batchMatMul(e,n,r,o);return i&&(u=this.add(u,i)),a&&(u=jl(this,u,a,s)),u},e.prototype.multiply=function(t,e){return"complex64"===t.dtype||"complex64"===e.dtype?this.broadcastedBinaryComplexOp(t.cast("complex64"),e.cast("complex64"),(function(t,e,n,r){return{real:t*n-e*r,imag:t*r+e*n}})):this.broadcastedBinaryOp(t,e,kt(t.dtype,e.dtype),(function(t,e){return t*e}))},e.prototype.realDivide=function(t,e){return Ml([t,e],"realDivide"),this.broadcastedBinaryOp(t,e,"float32",(function(t,e){return t/e}))},e.prototype.floorDiv=function(t,e){return Ml([t,e],"floorDiv"),this.broadcastedBinaryOp(t,e,"int32",(function(t,e){return Math.floor(t/e)}))},e.prototype.sum=function(t,e){Ml(t,"sum"),Je("sum",e,t.rank);for(var n=Ye(t.shape,e),r=n[0],o=n[1],i=vn(r,kt(t.dtype,"int32")),a=I(o),s=this.readSync(i.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=0,h=0;h<a;++h)f+=u[l+h];s[c]=f}return i},e.prototype.prod=function(t,e){Ml(t,"sum");for(var n=Ye(t.shape,e),r=n[0],o=n[1],i=vn(r,kt(t.dtype,"int32")),a=I(o),s=this.readSync(i.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=1,h=0;h<a;++h)f*=u[l+h];s[c]=f}return i},e.prototype.unsortedSegmentSum=function(t,e,n){Ml(t,"unsortedSegmentSum");for(var r=[],o=t.rank-e.rank,i=0;i<o;++i)e=e.expandDims(i+1);for(i=0;i<n;++i){var a=ln(i,"int32"),s=bu(a,e).asType("float32").mul(t).sum(0);r.push(s)}return ur(r)},e.prototype.argMin=function(t,e){Ml(t,"argMin");var n=[e];Je("argMin",n,t.rank);for(var r=Ye(t.shape,n),o=r[0],i=r[1],a=vn(o,"int32"),s=I(i),u=this.readSync(a.dataId),c=this.readSync(t.dataId),l=0;l<u.length;++l){for(var f=l*s,h=c[f],p=0,d=0;d<s;++d){var m=c[f+d];m<h&&(h=m,p=d)}u[l]=p}return a},e.prototype.argMax=function(t,e){Ml(t,"argMax");var n=[e];Je("argMax",n,t.rank);for(var r=Ye(t.shape,n),o=r[0],i=r[1],a=vn(o,"int32"),s=I(i),u=this.readSync(a.dataId),c=this.readSync(t.dataId),l=0;l<u.length;++l){for(var f=l*s,h=c[f],p=0,d=0;d<s;++d){var m=c[f+d];m>h&&(h=m,p=d)}u[l]=p}return a},e.prototype.cumsum=function(t,e,n,r){if(Ml(t,"cumsum"),e!==t.rank-1)throw new Error("backend.cumsum in CPU expects an inner-most axis="+(t.rank-1)+" but got axis="+e);for(var o=kt(t.dtype,"int32"),i=vn(t.shape,o),a=this.readSync(i.dataId),s=this.readSync(t.dataId),u=t.shape[t.rank-1],c=r?function(t,e){return t+u-e-1}:function(t,e){return t+e},l=0;l<s.length;l+=u)for(var f=0;f<u;f++){var h=c(l,f);if(0===f)a[h]=n?0:s[h];else{var p=c(l,f-1);a[h]=n?s[p]+a[p]:s[h]+a[p]}}return i},e.prototype.equal=function(t,e){return Ml([t,e],"equal"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t===e?1:0}))},e.prototype.notEqual=function(t,e){return Ml([t,e],"notEqual"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t!==e?1:0}))},e.prototype.less=function(t,e){return Ml([t,e],"less"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t<e?1:0}))},e.prototype.lessEqual=function(t,e){return Ml([t,e],"lessEqual"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t<=e?1:0}))},e.prototype.greater=function(t,e){return Ml([t,e],"greater"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t>e?1:0}))},e.prototype.greaterEqual=function(t,e){return Ml([t,e],"greaterEqual"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t>=e?1:0}))},e.prototype.logicalNot=function(t){Ml(t,"logicalNot");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r<e.length;++r)n[r]=e[r]?0:1;return this.makeOutput(n,t.shape,"bool")},e.prototype.logicalAnd=function(t,e){return Ml([t,e],"logicalAnd"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t&&e}))},e.prototype.logicalOr=function(t,e){return Ml([t,e],"logicalOr"),this.broadcastedBinaryOp(t,e,"bool",(function(t,e){return t||e}))},e.prototype.select=function(t,e,n){Ml([t,e,n],"select");for(var r=this.readSync(t.dataId),o=this.readSync(e.dataId),i=this.readSync(n.dataId),a=vn(e.shape,kt(e.dtype,n.dtype)),s=this.readSync(a.dataId),u=0,c=0===t.rank||t.rank>1||1===e.rank?1:I(e.shape.slice(1)),l=0;l<r.length;l++)for(var f=0;f<c;f++)1===r[l]?s[u++]=o[l]:s[u++]=i[l];return a},e.prototype.where=function(t){Ml([t],"where");var e=this.readSync(t.dataId);return mo(t.shape,e)},e.prototype.topk=function(t,e,n){return Ml(t,"topk"),po(this.readSync(t.dataId),t.shape,t.dtype,e)},e.prototype.min=function(t,e){Ml(t,"min"),Je("min",e,t.rank);for(var n=Ye(t.shape,e),r=n[0],o=n[1],i=vn(r,t.dtype),a=I(o),s=this.readSync(i.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=u[l],h=0;h<a;++h){var p=u[l+h];p<f&&(f=p)}s[c]=f}return i},e.prototype.minimum=function(t,e){return Ml([t,e],"minimum"),this.broadcastedBinaryOp(t,e,t.dtype,(function(t,e){return Math.min(t,e)}))},e.prototype.mod=function(t,e){return Ml([t,e],"mod"),this.broadcastedBinaryOp(t,e,t.dtype,(function(t,e){var n=t%e;return t<0&&e<0||t>=0&&e>=0?n:(n+e)%e}))},e.prototype.max=function(t,e){Ml(t,"max"),Je("max",e,t.rank);for(var n=Ye(t.shape,e),r=n[0],o=n[1],i=vn(r,t.dtype),a=I(o),s=this.readSync(i.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=u[l],h=0;h<a;++h){var p=u[l+h];p>f&&(f=p)}s[c]=f}return i},e.prototype.maximum=function(t,e){return Ml([t,e],"maximum"),this.broadcastedBinaryOp(t,e,t.dtype,(function(t,e){return Math.max(t,e)}))},e.prototype.all=function(t,e){Ml(t,"all"),Je("all",e,t.rank);for(var n=Ye(t.shape,e),r=n[0],o=n[1],i=vn(r,t.dtype),a=I(o),s=this.readSync(i.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=u[l],h=0;h<a;++h){var p=u[l+h];f=f&&p}s[c]=f}return i},e.prototype.any=function(t,e){Ml(t,"any"),Je("any",e,t.rank);for(var n=Ye(t.shape,e),r=n[0],o=n[1],i=vn(r,t.dtype),a=I(o),s=this.readSync(i.dataId),u=this.readSync(t.dataId),c=0;c<s.length;++c){for(var l=c*a,f=u[l],h=0;h<a;++h){var p=u[l+h];f=f||p}s[c]=f}return i},e.prototype.squaredDifference=function(t,e){return Ml([t,e],"squaredDifference"),this.broadcastedBinaryOp(t,e,t.dtype,(function(t,e){var n=t-e;return n*n}))},e.prototype.ceil=function(t){Ml(t,"ceil");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.ceil(e[r]);return this.makeOutput(n,t.shape,"float32")},e.prototype.floor=function(t){Ml(t,"floor");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.floor(e[r]);return this.makeOutput(n,t.shape,"float32")},e.prototype.sign=function(t){Ml(t,"x");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)e[r]<0?n[r]=-1:e[r]>0?n[r]=1:n[r]=0;return this.makeOutput(n,t.shape,"float32")},e.prototype.isNaN=function(t){Ml(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r<e.length;++r)Number.isNaN(e[r])&&(n[r]=1);return this.makeOutput(n,t.shape,"bool")},e.prototype.isInf=function(t){Ml(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r<e.length;++r)Math.abs(e[r])===1/0&&(n[r]=1);return this.makeOutput(n,t.shape,"bool")},e.prototype.isFinite=function(t){Ml(t,"x");for(var e=this.readSync(t.dataId),n=new Uint8Array(e.length),r=0;r<e.length;++r)Number.isFinite(e[r])&&(n[r]=1);return this.makeOutput(n,t.shape,"bool")},e.prototype.round=function(t){Ml(t,"round");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var o=Math.floor(e[r]);e[r]-o<.5?n[r]=Math.floor(e[r]):e[r]-o>.5?n[r]=Math.ceil(e[r]):n[r]=o%2==0?o:o+1}return this.makeOutput(n,t.shape,"float32")},e.prototype.exp=function(t){Ml(t,"exp");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.exp(e[r]);return this.makeOutput(n,t.shape,"float32")},e.prototype.expm1=function(t){Ml(t,"expm1");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=Math.expm1(e[r]);return this.makeOutput(n,t.shape,"float32")},e.prototype.log=function(t){Ml(t,"log");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var o=e[r];n[r]=Math.log(o)}return this.makeOutput(n,t.shape,"float32")},e.prototype.log1p=function(t){Ml(t,"log1p");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var o=e[r];n[r]=Math.log1p(o)}return this.makeOutput(n,t.shape,"float32")},e.prototype.sqrt=function(t){Ml(t,"sqrt");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var o=e[r];n[r]=Math.sqrt(o)}return this.makeOutput(n,t.shape,"float32")},e.prototype.rsqrt=function(t){Ml(t,"rsqrt");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r){var o=e[r];n[r]=1/Math.sqrt(o)}return this.makeOutput(n,t.shape,"float32")},e.prototype.reciprocal=function(t){Ml(t,"reciprocal");for(var e=this.readSync(t.dataId),n=new Float32Array(e.length),r=0;r<e.length;++r)n[r]=1/e[r];return this.makeOutput(n,t.shape,"float32")},e.prototype.linear=function(t){return t},e.prototype.relu=function(t){Ml(t,"relu");for(var e=vn(t.shape,t.dtype),n=this.readSync(e.dataId),r=this.readSync(t.dataId),o=0;o<r.length;++o)n[o]=Math.max(0,r[o]);return e},e.prototype.relu6=function(t){Ml(t,"relu");for(var e=vn(t.shape,t.dtype),n=this.readSync(e.dataId),r=this.readSync(t.dataId),o=0;o<r.length;++o)n[o]=Math.min(Math.max(0,r[o]),6);return e},e.prototype.prelu=function(t,e){return Ml([t,e],"prelu"),this.broadcastedBinaryOp(t,e,t.dtype,(function(t,e){return t<0?e*t:t}))},e.prototype.elu=function(t){Ml(t,"elu");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r){var o=n[r];e[r]=o>=0?o:Math.exp(o)-1}return this.makeOutput(e,t.shape,"float32")},e.prototype.eluDer=function(t,e){Ml([t,e],"eluDer");for(var n=new Float32Array(e.size),r=this.readSync(e.dataId),o=this.readSync(t.dataId),i=0;i<r.length;++i){var a=r[i];n[i]=a>=1?o[i]:o[i]*(a+1)}return this.makeOutput(n,e.shape,"float32")},e.prototype.selu=function(t){Ml(t,"selu");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r){var o=n[r];e[r]=o>=0?1.0507009873554805*o:1.7580993408473768*(Math.exp(o)-1)}return this.makeOutput(e,t.shape,"float32")},e.prototype.clip=function(t,e,n){Ml(t,"clip");for(var r=new Float32Array(t.size),o=this.readSync(t.dataId),i=0;i<o.length;++i){var a=o[i];r[i]=a>n?n:a<e?e:a}return this.makeOutput(r,t.shape,"float32")},e.prototype.abs=function(t){for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.abs(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.complexAbs=function(t){for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<t.size;++r){var o=n[2*r],i=n[2*r+1];e[r]=Math.hypot(o,i)}return this.makeOutput(e,t.shape,"float32")},e.prototype.int=function(t){Ml(t,"int");for(var e=new Int32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=n[r];return this.makeOutput(e,t.shape,"int32")},e.prototype.sigmoid=function(t){Ml(t,"sigmoid");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=1/(1+Math.exp(-n[r]));return this.makeOutput(e,t.shape,"float32")},e.prototype.softplus=function(t){Ml(t,"softplus");for(var e=Math.log(1.1920928955078125e-7)+2,n=new Float32Array(t.size),r=this.readSync(t.dataId),o=0;o<r.length;++o){var i,a=r[o]>-e,s=r[o]<e,u=Math.exp(r[o]);i=s?u:a?r[o]:Math.log(1+u),n[o]=i}return this.makeOutput(n,t.shape,"float32")},e.prototype.sin=function(t){Ml(t,"sin");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.sin(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.cos=function(t){Ml(t,"cos");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.cos(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.tan=function(t){Ml(t,"tan");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.tan(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.asin=function(t){Ml(t,"asin");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.asin(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.acos=function(t){Ml(t,"acos");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.acos(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.atan=function(t){Ml(t,"atan");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.atan(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.atan2=function(t,e){return Ml([t,e],"atan2"),this.broadcastedBinaryOp(t,e,t.dtype,(function(t,e){return Math.atan2(t,e)}))},e.prototype.sinh=function(t){Ml(t,"sinh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.sinh(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.cosh=function(t){Ml(t,"cosh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.cosh(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.tanh=function(t){Ml(t,"tanh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=A(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.asinh=function(t){Ml(t,"asinh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.asinh(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.acosh=function(t){Ml(t,"acosh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.acosh(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.atanh=function(t){Ml(t,"atanh");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r)e[r]=Math.atanh(n[r]);return this.makeOutput(e,t.shape,"float32")},e.prototype.erf=function(t){Ml(t,"erf");for(var e=new Float32Array(t.size),n=this.readSync(t.dataId),r=0;r<n.length;++r){var o=Math.sign(n[r]),i=Math.abs(n[r]),a=1/(1+.3275911*i);e[r]=o*(1-((((1.061405429*a-1.453152027)*a+1.421413741)*a-.284496736)*a+.254829592)*a*Math.exp(-i*i))}return this.makeOutput(e,t.shape,"float32")},e.prototype.step=function(t,e){void 0===e&&(e=0),Ml(t,"step");for(var n=new Float32Array(t.size),r=this.readSync(t.dataId),o=0;o<r.length;++o){var i=r[o];isNaN(i)?n[o]=NaN:n[o]=i>0?1:e}return this.makeOutput(n,t.shape,"float32")},e.prototype.fusedConv2d=function(t){var e=t.input,n=t.filter,r=t.convInfo,o=t.bias,i=t.activation,a=t.preluActivationWeights,s=this.conv2d(e,n,r);return o&&(s=this.add(s,o)),i&&(s=jl(this,s,i,a)),s},e.prototype.conv2d=function(t,e,n){Ml([t,e],"conv2d");for(var r=n.filterHeight,o=n.filterWidth,i=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c="channelsLast"===n.dataFormat,l=Ln(n.outShape,t.dtype),f=t.strides[0],h=c?t.strides[1]:t.strides[2],p=c?t.strides[2]:1,d=c?1:t.strides[1],m=l.strides[0],v=c?l.strides[1]:l.strides[2],g=c?l.strides[2]:1,y=c?1:l.strides[1],b=this.readSync(t.dataId),w=this.readSync(e.dataId),x=l.values,_=0;_<n.batchSize;++_)for(var E=_*f,C=_*m,S=0;S<n.outHeight;++S)for(var k=C+S*v,T=S*n.strideHeight-u,I=0;I<r;I++){var O=T+I*i;if(!(O<0||O>=n.inHeight))for(var R=I*e.strides[0],A=E+O*h,D=0;D<n.outWidth;++D)for(var N=k+D*g,P=D*n.strideWidth-s,M=0;M<o;M++){var j=P+M*a;if(!(j<0||j>=n.inWidth))for(var F=A+j*p,B=R+M*e.strides[1],L=0;L<n.inChannels;++L){for(var U=b[F+L*d],W=0;W<n.outChannels;++W)x[N+W*y]+=U*w[B+W];B+=n.outChannels}}}return l.toTensor()},e.prototype.conv3d=function(t,e,n){for(var r=n.filterDepth,o=n.filterHeight,i=n.filterWidth,a=n.dilationDepth,s=n.dilationHeight,u=n.dilationWidth,c=n.padInfo.front,l=n.padInfo.left,f=n.padInfo.top,h=Ln(n.outShape,t.dtype),p=this.readSync(t.dataId),d=this.readSync(e.dataId),m=h.values,v=0;v<n.batchSize;++v)for(var g=v*t.strides[0],y=v*h.strides[0],b=0;b<n.outDepth;++b)for(var w=y+b*h.strides[1],x=b*n.strideDepth-c,_=0;_<r;_++){var E=x+_*a;if(!(E<0||E>=n.inDepth))for(var C=_*e.strides[0],S=g+E*t.strides[1],k=0;k<n.outHeight;++k)for(var T=w+k*h.strides[2],I=k*n.strideHeight-f,O=0;O<o;O++){var R=I+O*s;if(!(R<0||R>=n.inHeight))for(var A=C+O*e.strides[1],D=S+R*t.strides[2],N=0;N<n.outWidth;++N)for(var P=T+N*n.outChannels,M=N*n.strideWidth-l,j=0;j<i;j++){var F=M+j*u;if(!(F<0||F>=n.inWidth))for(var B=A+j*e.strides[2],L=D+F*n.inChannels,U=B,W=0;W<n.inChannels;++W){for(var z=p[L+W],V=0;V<n.outChannels;++V)m[P+V]+=z*d[U+V];U+=n.outChannels}}}}return h.toTensor()},e.prototype.conv2dDerInput=function(t,e,n){Ml([t,e],"conv2dDerInput");for(var r=Ln(n.inShape,"float32"),o=r.values,i=this.readSync(t.dataId),a=this.readSync(e.dataId),s=e.strides,u=s[0],c=s[1],l=s[2],f=n.batchSize,h=n.filterHeight,p=n.filterWidth,d=n.inChannels,m=n.inHeight,v=n.inWidth,g=n.outChannels,y=n.outHeight,b=n.outWidth,w=n.strideHeight,x=n.strideWidth,_=n.dataFormat,E=h-1-n.padInfo.top,C=p-1-n.padInfo.left,S="channelsLast"===_,k=r.strides[0],T=S?r.strides[1]:r.strides[2],I=S?r.strides[2]:1,O=S?1:r.strides[1],R=t.strides[0],A=S?t.strides[1]:t.strides[2],D=S?t.strides[2]:1,N=S?1:t.strides[1],P=0;P<f;++P)for(var M=0;M<d;++M)for(var j=0;j<m;++j)for(var F=j-E,B=Math.max(0,Math.ceil(F/w)),L=Math.min(y,(h+F)/w),U=0;U<v;++U){for(var W=U-C,z=Math.max(0,Math.ceil(W/x)),V=Math.min(b,(p+W)/x),q=0,G=B;G<L;++G)for(var H=G*w-F,X=z;X<V;++X)for(var K=R*P+A*G+D*X,Y=u*(h-1-H)+c*(p-1-(X*x-W))+l*M,$=0;$<g;++$)q+=i[K+N*$]*a[Y+$];o[k*P+T*j+I*U+O*M]=q}return r.toTensor()},e.prototype.conv3dDerInput=function(t,e,n){for(var r=Ln(n.inShape,"float32"),o=r.values,i=r.strides,a=i[0],s=i[1],u=i[2],c=i[3],l=this.readSync(t.dataId),f=t.strides,h=f[0],p=f[1],d=f[2],m=f[3],v=this.readSync(e.dataId),g=e.strides,y=g[0],b=g[1],w=g[2],x=g[3],_=n.batchSize,E=n.filterDepth,C=n.filterHeight,S=n.filterWidth,k=n.inChannels,T=n.inDepth,I=n.inHeight,O=n.inWidth,R=n.outChannels,A=n.outDepth,D=n.outHeight,N=n.outWidth,P=n.strideDepth,M=n.strideHeight,j=n.strideWidth,F=E-1-n.padInfo.front,B=C-1-n.padInfo.top,L=S-1-n.padInfo.left,U=0;U<_;++U)for(var W=0;W<k;++W)for(var z=0;z<T;++z)for(var V=z-F,q=Math.max(0,Math.ceil(V/P)),G=Math.min(A,(E+V)/P),H=0;H<I;++H)for(var X=H-B,K=Math.max(0,Math.ceil(X/M)),Y=Math.min(D,(C+X)/M),$=0;$<O;++$){for(var J=$-L,Q=Math.max(0,Math.ceil(J/j)),Z=Math.min(N,(S+J)/j),tt=0,et=q;et<G;++et)for(var nt=et*P-V,rt=K;rt<Y;++rt)for(var ot=rt*M-X,it=Q;it<Z;++it)for(var at=h*U+p*et+d*rt+m*it,st=y*(E-1-nt)+b*(C-1-ot)+w*(S-1-(it*j-J))+x*W,ut=0;ut<R;++ut)tt+=l[at+ut]*v[st+ut];o[a*U+s*z+u*H+c*$+W]=tt}return r.toTensor()},e.prototype.conv2dDerFilter=function(t,e,n){Ml([t,e],"conv2dDerFilter");for(var r=n.strideHeight,o=n.strideWidth,i=n.filterHeight,a=n.filterWidth,s="channelsLast"===n.dataFormat,u=Ln(n.filterShape,"float32"),c=n.padInfo.left,l=n.padInfo.top,f=this.bufferSync(t),h=this.bufferSync(e),p=0;p<i;++p)for(var d=Math.max(0,Math.ceil((l-p)/r)),m=Math.min(n.outHeight,(n.inHeight+l-p)/r),v=0;v<a;++v)for(var g=Math.max(0,Math.ceil((c-v)/o)),y=Math.min(n.outWidth,(n.inWidth+c-v)/o),b=0;b<n.inChannels;++b)for(var w=0;w<n.outChannels;++w){for(var x=0,_=0;_<n.batchSize;++_)for(var E=d;E<m;++E)for(var C=p+E*r-l,S=g;S<y;++S){var k=v+S*o-c;x+=s?f.get(_,C,k,b)*h.get(_,E,S,w):f.get(_,b,C,k)*h.get(_,w,E,S)}u.set(x,p,v,b,w)}return u.toTensor()},e.prototype.conv3dDerFilter=function(t,e,n){for(var r=n.strideDepth,o=n.strideHeight,i=n.strideWidth,a=n.filterDepth,s=n.filterHeight,u=n.filterWidth,c=Ln(n.filterShape,"float32"),l=c.values,f=c.strides,h=f[0],p=f[1],d=f[2],m=f[3],v=this.readSync(e.dataId),g=e.strides,y=g[0],b=g[1],w=g[2],x=g[3],_=this.readSync(t.dataId),E=t.strides,C=E[0],S=E[1],k=E[2],T=E[3],I=n.padInfo.front,O=n.padInfo.left,R=n.padInfo.top,A=0;A<a;++A)for(var D=Math.max(0,Math.ceil((I-A)/r)),N=Math.min(n.outDepth,(n.inDepth+I-A)/r),P=A*h,M=0;M<s;++M)for(var j=Math.max(0,Math.ceil((R-M)/o)),F=Math.min(n.outHeight,(n.inHeight+R-M)/o),B=M*p+P,L=0;L<u;++L)for(var U=Math.max(0,Math.ceil((O-L)/i)),W=Math.min(n.outWidth,(n.inWidth+O-L)/i),z=L*d+B,V=0;V<n.inChannels;++V)for(var q=V*m+z,G=0;G<n.outChannels;++G){for(var H=0,X=0;X<n.batchSize;++X)for(var K=X*C,Y=X*y,$=D;$<N;++$)for(var J=(A+$*r-I)*S+K,Q=$*b+Y,Z=j;Z<F;++Z)for(var tt=(M+Z*o-R)*k+J,et=Z*w+Q,nt=U;nt<W;++nt){var rt=nt*x+et;H+=_[(L+nt*i-O)*T+tt+V]*v[rt+G]}l[q+G]=H}return c.toTensor()},e.prototype.fusedDepthwiseConv2D=function(t){var e=t.input,n=t.filter,r=t.convInfo,o=t.bias,i=t.activation,a=t.preluActivationWeights,s=this.depthwiseConv2D(e,n,r);return o&&(s=this.add(s,o)),i&&(s=jl(this,s,i,a)),s},e.prototype.depthwiseConv2D=function(t,e,n){Ml([t,e],"depthwiseConv2D");for(var r=n.filterHeight,o=n.filterWidth,i=n.dilationHeight,a=n.dilationWidth,s=n.padInfo.left,u=n.padInfo.top,c=n.outChannels/n.inChannels,l=Ln(n.outShape,t.dtype),f=this.readSync(t.dataId),h=this.readSync(e.dataId),p=l.values,d=0;d<n.batchSize;++d)for(var m=d*t.strides[0],v=d*l.strides[0],g=0;g<n.outHeight;++g)for(var y=v+g*l.strides[1],b=g*n.strideHeight-s,w=0;w<r;++w){var x=b+w*i;if(!(x<0||x>=n.inHeight))for(var _=w*e.strides[0],E=m+x*t.strides[1],C=0;C<n.outWidth;++C)for(var S=y+C*l.strides[2],k=C*n.strideWidth-u,T=0;T<o;++T){var I=k+T*a;if(!(I<0||I>=n.inWidth))for(var O=_+T*e.strides[1],R=E+I*n.inChannels,A=S,D=O,N=0;N<n.inChannels;++N){for(var P=f[R+N],M=0;M<c;++M)p[A+M]+=P*h[D+M];A+=c,D+=c}}}return l.toTensor()},e.prototype.depthwiseConv2DDerInput=function(t,e,n){Ml([t,e],"depthwiseConv2DDerInput");for(var r=Ln(n.inShape,"float32"),o=r.values,i=r.strides,a=i[0],s=i[1],u=i[2],c=this.readSync(t.dataId),l=t.strides,f=l[0],h=l[1],p=l[2],d=this.readSync(e.dataId),m=e.strides,v=m[0],g=m[1],y=m[2],b=n.batchSize,w=n.filterHeight,x=n.filterWidth,_=n.inChannels,E=n.inHeight,C=n.inWidth,S=n.outChannels,k=n.outHeight,T=n.outWidth,I=n.strideHeight,O=n.strideWidth,R=w-1-n.padInfo.top,A=x-1-n.padInfo.left,D=S/_,N=0;N<b;++N)for(var P=0;P<_;++P)for(var M=0;M<E;++M)for(var j=M-R,F=Math.max(0,Math.ceil(j/I)),B=Math.min(k,(w+j)/I),L=0;L<C;++L){for(var U=L-A,W=Math.max(0,Math.ceil(U/O)),z=Math.min(T,(x+U)/O),V=0,q=F;q<B;++q)for(var G=q*I-j,H=W;H<z;++H)for(var X=f*N+h*q+p*H,K=v*(w-1-G)+g*(x-1-(H*O-U))+y*P,Y=0;Y<D;++Y)V+=c[X+(P*D+Y)]*d[K+Y];o[a*N+s*M+u*L+P]=V}return r.toTensor()},e.prototype.depthwiseConv2DDerFilter=function(t,e,n){Ml([t,e],"depthwiseConv2DDerFilter");for(var r=n.strideHeight,o=n.strideWidth,i=n.filterHeight,a=n.filterWidth,s=Ln(n.filterShape,"float32"),u=n.padInfo.left,c=n.padInfo.top,l=n.outChannels/n.inChannels,f=this.bufferSync(t),h=this.bufferSync(e),p=0;p<i;++p)for(var d=Math.max(0,Math.ceil((c-p)/r)),m=Math.min(n.outHeight,(n.inHeight+c-p)/r),v=0;v<a;++v)for(var g=Math.max(0,Math.ceil((u-v)/o)),y=Math.min(n.outWidth,(n.inWidth+u-v)/o),b=0;b<n.outChannels;++b){for(var w=Math.trunc(b/l),x=b%l,_=0,E=0;E<n.batchSize;++E)for(var C=d;C<m;++C)for(var S=p+C*r-c,k=g;k<y;++k){var T=v+k*o-u;_+=f.get(E,S,T,w)*h.get(E,C,k,b)}s.set(_,p,v,w,x)}return s.toTensor()},e.prototype.tile=function(t,e){return Ml(t,"tile"),ho(this.bufferSync(t),e)},e.prototype.pad=function(t,e,n){Ml(t,"pad");var r=e.map((function(e,n){return e[0]+t.shape[n]+e[1]})),o=e.map((function(t){return t[0]})),i=this.bufferSync(t),a=Ln(r,t.dtype);0!==n&&a.values.fill(n);for(var s=0;s<t.size;s++){var u=i.indexToLoc(s),c=u.map((function(t,e){return t+o[e]}));a.set.apply(a,[i.get.apply(i,u)].concat(c))}return a.toTensor()},e.prototype.transpose=function(t,e){Ml(t,"transpose");for(var n=new Array(t.rank),r=0;r<n.length;r++)n[r]=t.shape[e[r]];var o=this.readSync(t.dataId),i=Ln(n,t.dtype),a=this.bufferSync(t);for(r=0;r<t.size;++r){for(var s=a.indexToLoc(r),u=new Array(s.length),c=0;c<u.length;c++)u[c]=s[e[c]];var l=i.locToIndex(u);i.values[l]=o[r]}return i.toTensor()},e.prototype.gather=function(t,e,n){Ml([t,e],"gather");var r=t.shape.slice(),o=this.readSync(e.dataId);r[n]=o.length;for(var i=Ln(r,t.dtype),a=this.bufferSync(t),s=0;s<i.size;++s){var u=i.indexToLoc(s),c=u.slice();c[n]=o[u[n]];var l=a.locToIndex(c);i.values[s]=a.values[l]}return i.toTensor()},e.prototype.batchToSpaceND=function(t,e,n){Ml([t],"batchToSpaceND");var r=e.reduce((function(t,e){return t*e})),o=hr(t.shape,e,r),i=pr(o.length,e.length),a=dr(t.shape,e,r),s=mr(n,e.length),u=vr(a,n,e.length);return t.reshape(o).transpose(i).reshape(a).slice(s,u)},e.prototype.spaceToBatchND=function(t,e,n){Ml([t],"spaceToBatchND");var r=e.reduce((function(t,e){return t*e})),o=[[0,0]];o.push.apply(o,n);for(var i=1+e.length;i<t.shape.length;++i)o.push([0,0]);var a=t.pad(o),s=hr(a.shape,e,r,!1),u=pr(s.length,e.length,!1),c=dr(a.shape,e,r,!1);return a.reshape(s).transpose(u).reshape(c)},e.prototype.pool=function(t,e,n){Ml(t,"pool");for(var r=e.strideHeight,o=e.strideWidth,i=e.dilationHeight,a=e.dilationWidth,s=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=e.padInfo.top,l=e.padInfo.left,f="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,h=this.readSync(t.dataId),p=Ln(e.outShape,t.dtype),d=p.values,m=e.outShape[1]*e.outShape[2]*e.outShape[3],v=e.outShape[2]*e.outShape[3],g=e.outShape[3],y=0;y<e.batchSize;++y)for(var b=y*m,w=y*t.strides[0],x=0;x<e.inChannels;++x)for(var _=0;_<e.outHeight;++_)for(var E=_*r-c,C=Math.max(0,E),S=Math.min(e.inHeight,s+E),k=b+_*v,T=0;T<e.outWidth;++T){for(var I=T*o-l,O=Math.max(0,I),R=Math.min(e.inWidth,u+I),A=f,D=0,N=0,P=C;P<S;P+=i){for(var M=w+P*t.strides[1],j=O;j<R;j+=a){var F=h[M+j*t.strides[2]+x];"max"===n&&F>A?A=F:"avg"===n&&(D+=F,N++)}if(isNaN(A))break}d[k+T*g+x]="avg"===n?D/N:A}return p.toTensor()},e.prototype.maxPool=function(t,e){return this.pool(t,e,"max")},e.prototype.maxPoolPositions=function(t,e){for(var n=Ln(e.outShape,"int32"),r=e.strideHeight,o=e.strideWidth,i=e.dilationHeight,a=e.dilationWidth,s=e.effectiveFilterHeight,u=e.effectiveFilterWidth,c=e.padInfo.top,l=e.padInfo.left,f=this.bufferSync(t),h=0;h<e.batchSize;++h)for(var p=0;p<e.inChannels;++p)for(var d=0;d<e.outHeight;++d){for(var m=d*r-c,v=m;v<0;)v+=i;for(var g=Math.min(e.inHeight,s+m),y=0;y<e.outWidth;++y){for(var b=y*o-l,w=b;w<0;)w+=a;for(var x=Math.min(e.inWidth,u+b),_=Number.NEGATIVE_INFINITY,E=-1,C=v;C<g;C+=i)for(var S=C-m,k=w;k<x;k+=a){var T=k-b,I=f.get(h,C,k,p);I>_&&(_=I,E=S*u+T)}n.set(E,h,d,y,p)}}return n.toTensor()},e.prototype.maxPoolBackprop=function(t,e,n,r){Ml([e,n],"maxPoolBackprop");for(var o=this.maxPoolPositions(e,r),i=r.strideHeight,a=r.strideWidth,s=r.dilationHeight,u=r.dilationWidth,c=r.effectiveFilterHeight,l=r.effectiveFilterWidth,f=l-1-r.padInfo.left,h=c-1-r.padInfo.top,p=Ln(e.shape,"float32"),d=this.bufferSync(o),m=this.bufferSync(t),v=0;v<r.batchSize;++v)for(var g=0;g<r.inChannels;++g)for(var y=0;y<r.inHeight;++y)for(var b=0;b<r.inWidth;++b){for(var w=y-h,x=b-f,_=0,E=0;E<c;E+=s){var C=(w+E)/i;if(!(C<0||C>=r.outHeight||Math.floor(C)!==C))for(var S=0;S<l;S+=u){var k=(x+S)/a;if(!(k<0||k>=r.outWidth||Math.floor(k)!==k)){var T=c*l-1-d.get(v,C,k,g)===E*l+S?1:0;0!==T&&(_+=m.get(v,C,k,g)*T)}}}p.set(_,v,y,b,g)}return p.toTensor()},e.prototype.avgPoolBackprop=function(t,e,n){Ml([t,e],"avgPoolBackprop");for(var r=n.strideHeight,o=n.strideWidth,i=n.filterHeight,a=n.filterWidth,s=n.dilationHeight,u=n.dilationWidth,c=n.effectiveFilterHeight,l=n.effectiveFilterWidth,f=l-1-n.padInfo.left,h=c-1-n.padInfo.top,p=Ln(e.shape,"float32"),d=1/(i*a),m=this.bufferSync(t),v=0;v<n.batchSize;++v)for(var g=0;g<n.inChannels;++g)for(var y=0;y<n.inHeight;++y)for(var b=0;b<n.inWidth;++b){for(var w=y-h,x=b-f,_=0,E=0;E<c;E+=s){var C=(w+E)/r;if(!(C<0||C>=n.outHeight||Math.floor(C)!==C))for(var S=0;S<l;S+=u){var k=(x+S)/o;k<0||k>=n.outWidth||Math.floor(k)!==k||(_+=m.get(v,C,k,g))}}p.set(_*d,v,y,b,g)}return p.toTensor()},e.prototype.pool3d=function(t,e,n){Ml(t,"pool3d");for(var r=e.strideDepth,o=e.strideHeight,i=e.strideWidth,a=e.dilationDepth,s=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterDepth,l=e.effectiveFilterHeight,f=e.effectiveFilterWidth,h=e.padInfo.front,p=e.padInfo.top,d=e.padInfo.left,m="max"===n?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,v=this.readSync(t.dataId),g=Ln(e.outShape,t.dtype),y=g.values,b=e.outShape[1]*e.outShape[2]*e.outShape[3]*e.outShape[4],w=e.outShape[2]*e.outShape[3]*e.outShape[4],x=e.outShape[3]*e.outShape[4],_=e.outShape[4],E=0;E<e.batchSize;++E)for(var C=E*b,S=E*t.strides[0],k=0;k<e.inChannels;++k)for(var T=0;T<e.outDepth;++T){for(var I=T*r-h,O=I;O<0;)O+=a;for(var R=Math.min(e.inDepth,c+I),A=C+T*w,D=0;D<e.outHeight;++D){for(var N=D*o-p,P=N;P<0;)P+=s;for(var M=Math.min(e.inHeight,l+N),j=A+D*x,F=0;F<e.outWidth;++F){for(var B=F*i-d,L=B;L<0;)L+=u;for(var U=Math.min(e.inWidth,f+B),W=j+F*_,z=m,V=0,q=0,G=O;G<R;G+=a){for(var H=S+G*t.strides[1],X=P;X<M;X+=s){for(var K=H+X*t.strides[2],Y=L;Y<U;Y+=u){var $=v[K+Y*t.strides[3]+k];if("max"===n&&$>z?z=$:"avg"===n&&(V+=$,q++),isNaN(z))break}if(isNaN(z))break}if(isNaN(z))break}y[W+k]="avg"===n?V/q:z}}}return g.toTensor()},e.prototype.avgPool3d=function(t,e){return Ml(t,"avgPool3d"),this.pool3d(t,e,"avg").toFloat()},e.prototype.avgPool3dBackprop=function(t,e,n){Ml([t,e],"avgPool3dBackprop");for(var r=n.strideDepth,o=n.strideHeight,i=n.strideWidth,a=n.filterDepth,s=n.filterHeight,u=n.filterWidth,c=n.dilationDepth,l=n.dilationHeight,f=n.dilationWidth,h=n.effectiveFilterDepth,p=n.effectiveFilterHeight,d=n.effectiveFilterWidth,m=h-1-n.padInfo.front,v=d-1-n.padInfo.left,g=p-1-n.padInfo.top,y=Ln(e.shape,"float32"),b=1/(a*s*u),w=this.bufferSync(t),x=0;x<n.batchSize;++x)for(var _=0;_<n.inChannels;++_)for(var E=0;E<n.inDepth;++E)for(var C=0;C<n.inHeight;++C)for(var S=0;S<n.inWidth;++S){for(var k=E-m,T=C-g,I=S-v,O=0,R=0;R<h;R+=c){var A=(k+R)/r;if(!(A<0||A>=n.outDepth||Math.floor(A)!==A))for(var D=0;D<p;D+=l){var N=(T+D)/o;if(!(N<0||N>=n.outHeight||Math.floor(N)!==N))for(var P=0;P<d;P+=f){var M=(I+P)/i;M<0||M>=n.outWidth||Math.floor(M)!==M||(O+=w.get(x,A,N,M,_))}}}y.set(O*b,x,E,C,S,_)}return y.toTensor()},e.prototype.maxPool3d=function(t,e){return Ml(t,"maxPool3d"),this.pool3d(t,e,"max").toFloat()},e.prototype.maxPool3dPositions=function(t,e){for(var n=Ln(e.outShape,"int32"),r=e.strideDepth,o=e.strideHeight,i=e.strideWidth,a=e.dilationDepth,s=e.dilationHeight,u=e.dilationWidth,c=e.effectiveFilterDepth,l=e.effectiveFilterHeight,f=e.effectiveFilterWidth,h=e.padInfo.front,p=e.padInfo.top,d=e.padInfo.left,m=this.bufferSync(t),v=0;v<e.batchSize;++v)for(var g=0;g<e.inChannels;++g)for(var y=0;y<e.outDepth;++y){for(var b=y*r-h,w=b;w<0;)w+=a;for(var x=Math.min(e.inDepth,c+b),_=0;_<e.outHeight;++_){for(var E=_*o-p,C=E;C<0;)C+=s;for(var S=Math.min(e.inHeight,l+E),k=0;k<e.outWidth;++k){for(var T=k*i-d,I=T;I<0;)I+=u;for(var O=Math.min(e.inWidth,f+T),R=Number.NEGATIVE_INFINITY,A=-1,D=w;D<x;D+=a)for(var N=D-b,P=C;P<S;P+=s)for(var M=P-E,j=I;j<O;j+=u){var F=j-T,B=m.get(v,D,P,j,g);B>=R&&(R=B,A=N*l*f+M*l+F)}n.set(A,v,y,_,k,g)}}}return n.toTensor()},e.prototype.maxPool3dBackprop=function(t,e,n,r){Ml([e,n],"maxPool3dBackprop");for(var o=this.maxPool3dPositions(e,r),i=r.strideDepth,a=r.strideHeight,s=r.strideWidth,u=r.dilationDepth,c=r.dilationHeight,l=r.dilationWidth,f=r.effectiveFilterDepth,h=r.effectiveFilterHeight,p=r.effectiveFilterWidth,d=f-1-r.padInfo.front,m=p-1-r.padInfo.left,v=h-1-r.padInfo.top,g=Ln(e.shape,"float32"),y=this.bufferSync(o),b=this.bufferSync(t),w=0;w<r.batchSize;++w)for(var x=0;x<r.inChannels;++x)for(var _=0;_<r.inDepth;++_)for(var E=0;E<r.inHeight;++E)for(var C=0;C<r.inWidth;++C){for(var S=_-d,k=E-v,T=C-m,I=0,O=0;O<f;O+=u){var R=(S+O)/i;if(!(R<0||R>=r.outDepth||Math.floor(R)!==R))for(var A=0;A<h;A+=c){var D=(k+A)/a;if(!(D<0||D>=r.outHeight||Math.floor(D)!==D))for(var N=0;N<p;N+=l){var P=(T+N)/s;if(!(P<0||P>=r.outWidth||Math.floor(P)!==P)){var M=f*h*p-1-y.get(w,R,D,P,x)===O*h*p+A*p+N?1:0;0!==M&&(I+=b.get(w,R,D,P,x)*M)}}}}g.set(I,w,_,E,C,x)}return g.toTensor()},e.prototype.cast=function(t,e){return $r(t,e,this)},e.prototype.reshape=function(t,e){return Jr(t,e)},e.prototype.avgPool=function(t,e){return Ml(t,"avgPool"),this.pool(t,e,"avg").toFloat()},e.prototype.resizeBilinear=function(t,e,n,r){Ml(t,"resizeBilinear");for(var o=t.shape,i=o[0],a=o[1],s=o[2],u=o[3],c=this.readSync(t.dataId),l=new Float32Array(I([i,e,n,u])),f=[r&&e>1?a-1:a,r&&n>1?s-1:s],h=[r&&e>1?e-1:e,r&&n>1?n-1:n],p=0,d=f[0]/h[0],m=f[1]/h[1],v=0;v<i;v++)for(var g=0;g<e;g++)for(var y=d*g,b=Math.floor(y),w=y-b,x=Math.min(a-1,Math.ceil(y)),_=v*t.strides[0]+b*t.strides[1],E=v*t.strides[0]+x*t.strides[1],C=0;C<n;C++)for(var S=m*C,k=Math.floor(S),T=S-k,O=Math.min(s-1,Math.ceil(S)),R=_+k*t.strides[2],A=E+k*t.strides[2],D=_+O*t.strides[2],N=E+O*t.strides[2],P=0;P<u;P++){var M=c[R+P],j=c[A+P],F=M+(c[D+P]-M)*T,B=F+(j+(c[N+P]-j)*T-F)*w;l[p++]=B}return un(l,[i,e,n,u])},e.prototype.resizeBilinearBackprop=function(t,e,n){Ml([t,e],"resizeBilinearBackprop");for(var r=e.shape,o=r[0],i=r[1],a=r[2],s=r[3],u=t.shape,c=u[1],l=u[2],f=new Float32Array(o*i*a*s),h=[n&&c>1?i-1:i,n&&l>1?a-1:a],p=[n&&c>1?c-1:c,n&&l>1?l-1:l],d=h[0]/p[0],m=h[1]/p[1],v=this.readSync(t.dataId),g=0,y=0;y<o;y++)for(var b=y*e.strides[0],w=0;w<c;w++)for(var x=w*d,_=Math.floor(x),E=Math.min(Math.ceil(x),i-1),C=b+_*e.strides[1],S=b+E*e.strides[1],k=x-_,T=1-k,I=0;I<l;I++)for(var O=I*m,R=Math.floor(O),A=Math.min(Math.ceil(O),a-1),D=O-R,N=1-D,P=C+R*e.strides[2],M=C+A*e.strides[2],j=S+R*e.strides[2],F=S+A*e.strides[2],B=T*N,L=T*D,U=k*N,W=k*D,z=0;z<s;z++){var V=v[g++];f[P+z]+=V*B,f[M+z]+=V*L,f[j+z]+=V*U,f[F+z]+=V*W}return dn(f,[o,a,i,s],e.dtype)},e.prototype.resizeNearestNeighbor=function(t,e,n,r){Ml(t,"resizeNearestNeighbor");for(var o=t.shape,i=o[0],a=o[1],s=o[2],u=o[3],c=this.readSync(t.dataId),l=new Float32Array(i*e*n*u),f=[r&&e>1?a-1:a,r&&n>1?s-1:s],h=[r&&e>1?e-1:e,r&&n>1?n-1:n],p=f[0]/h[0],d=f[1]/h[1],m=0,v=0;v<i;v++)for(var g=v*t.strides[0],y=0;y<e;y++)for(var b=p*y,w=g+Math.min(a-1,r?Math.round(b):Math.floor(b))*t.strides[1],x=0;x<n;x++)for(var _=d*x,E=w+Math.min(s-1,r?Math.round(_):Math.floor(_))*t.strides[2],C=0;C<u;C++){var S=c[E+C];l[m++]=S}return un(l,[i,e,n,u],t.dtype)},e.prototype.resizeNearestNeighborBackprop=function(t,e,n){Ml([t,e],"resizeNearestNeighborBackprop");for(var r=e.shape,o=r[0],i=r[1],a=r[2],s=r[3],u=t.shape,c=u[1],l=u[2],f=new Float32Array(o*i*a*s),h=this.readSync(t.dataId),p=[n&&c>1?i-1:i,n&&l>1?a-1:a],d=[n&&c>1?c-1:c,n&&l>1?l-1:l],m=p[0]/d[0],v=p[1]/d[1],g=1/m,y=1/v,b=2*Math.ceil(g)+2,w=2*Math.ceil(y)+2,x=0;x<o;x++)for(var _=x*e.strides[0],E=0;E<i;E++)for(var C=_+E*e.strides[1],S=Math.floor(E*g),k=Math.floor(S-b/2),T=0;T<a;T++)for(var I=C+T*e.strides[2],O=Math.floor(T*y),R=Math.floor(O-w/2),A=0;A<s;A++){for(var D=0,N=0;N<b;N++){var P=N+k;if(!(P<0||P>=c)){var M=_+P*t.strides[1],j=P*m;if(E===Math.min(i-1,n?Math.round(j):Math.floor(j)))for(var F=0;F<w;F++){var B=F+R;if(!(B<0||B>=l)){var L=M+B*t.strides[2],U=B*v;T===Math.min(a-1,n?Math.round(U):Math.floor(U))&&(D+=h[L+A])}}}}f[I+A]=D}return dn(f,e.shape,e.dtype)},e.prototype.batchNormalization=function(t,e,n,r,o,i){Ml([t,e,n,o,i],"batchNorm");for(var a=this.readSync(t.dataId),s=this.readSync(e.dataId),u=this.readSync(n.dataId),c=o?this.readSync(o.dataId):new Float32Array([1]),l=i?this.readSync(i.dataId):new Float32Array([0]),f=new Float32Array(a.length),h=l.length,p=c.length,d=u.length,m=s.length,v=0,g=0,y=0,b=0,w=0;w<a.length;++w)f[w]=l[v++]+(a[w]-s[g++])*c[y++]/Math.sqrt(u[b++]+r),v>=h&&(v=0),g>=m&&(g=0),y>=p&&(y=0),b>=d&&(b=0);return dn(f,t.shape)},e.prototype.localResponseNormalization4D=function(t,e,n,r,o){Ml(t,"localResponseNormalization4D");var i=t.shape[3],a=i-1,s=this.readSync(t.dataId),u=t.size,c=new Float32Array(u);function l(t){for(var n=t%i,r=t-n+Math.max(0,n-e),o=t-n+Math.min(n+e,a),u=0;r<=o;r++){var c=s[r];u+=c*c}return u}for(var f=0;f<u;f++){var h=l(f),p=s[f]*Math.pow(n+r*h,-o);c[f]=p}return dn(c,t.shape)},e.prototype.LRNGrad=function(t,e,n,r,o,i,a){Ml(t,"LRNGrad");for(var s=t.shape[3],u=this.readSync(t.dataId),c=this.readSync(e.dataId),l=this.readSync(n.dataId),f=new Float32Array(t.size),h=t.size,p=0;p<h;p++){for(var d=p%s,m=p-d+Math.max(0,d-r),v=p-d+Math.min(s,d+r+1),g=0,y=m;y<v;y++)g+=Math.pow(c[y],2);for(g=i*g+o,y=m;y<v;y++){var b=-2*i*a*c[y]*l[p]/g;p===y&&(b+=Math.pow(g,-a)),b*=u[p],f[y]+=b}}return dn(f,t.shape)},e.prototype.multinomial=function(t,e,n,r){Ml(t,"multinomial");for(var o=e?t:Rr(t),i=o.shape[0],a=o.shape[1],s=vn([i,n],"int32"),u=this.readSync(s.dataId),c=this.readSync(o.dataId),l=0;l<i;++l){var f=l*a,h=new Float32Array(a-1);h[0]=c[f];for(var p=1;p<h.length;++p)h[p]=h[p-1]+c[f+p];for(var d=Mn(r.toString()),m=l*n,v=0;v<n;++v){var g=d();u[m+v]=h.length;for(var y=0;y<h.length;y++)if(g<h[y]){u[m+v]=y;break}}}return s},e.prototype.oneHot=function(t,e,n,r){Ml(t,"oneHot");var o=new Float32Array(t.size*e);o.fill(r);for(var i=this.readSync(t.dataId),a=0;a<t.size;++a)i[a]>=0&&i[a]<e&&(o[a*e+i[a]]=n);return hn(o,[t.size,e],"int32")},e.prototype.nonMaxSuppression=function(t,e,n,r,o){return Ml(t,"nonMaxSuppression"),io(this.readSync(t.dataId),this.readSync(e.dataId),n,r,o)},e.prototype.fft=function(t){return this.fftBatch(t,!1)},e.prototype.ifft=function(t){return this.fftBatch(t,!0)},e.prototype.fftBatch=function(t,e){for(var n=t.shape[0],r=t.shape[1],o=Ln(t.shape,"float32"),i=Ln(t.shape,"float32"),a=an(t).as2D(n,r),s=sn(t).as2D(n,r),u=0;u<n;u++)for(var c=a.slice([u,0],[1,r]),l=s.slice([u,0],[1,r]),f=on(c,l),h=this.readSync(this.fftImpl(f,e).dataId),p=0;p<r;p++){var d=to(h,p);o.values[u*r+p]=d.real,i.values[u*r+p]=d.imag}return on(o.toTensor(),i.toTensor()).as2D(n,r)},e.prototype.fftImpl=function(t,e){var n=t.as1D(),r=n.size;if(this.isExponentOf2(r)){var o=this.fftRadix2(n,r,e).as2D(t.shape[0],t.shape[1]);return e&&(o=on(an(o).div(ln(r)),sn(o).div(ln(r)))),o}var i=this.readSync(t.dataId),a=function(t){for(var e=new Float32Array(t.length/2),n=new Float32Array(t.length/2),r=0;r<t.length;r+=2)e[r/2]=t[r],n[r/2]=t[r+1];return{real:e,imag:n}}(this.fourierTransformByMatmul(i,r,e));return on(a.real,a.imag).as2D(t.shape[0],t.shape[1])},e.prototype.isExponentOf2=function(t){return 0==(t&t-1)},e.prototype.fftRadix2=function(t,e,n){if(1===e)return t;var r=this.readSync(t.dataId),o=e/2,i=function(t){for(var e=Math.ceil(t.length/4),n=new Float32Array(e),r=new Float32Array(e),o=0;o<t.length;o+=4)n[Math.floor(o/4)]=t[o],r[Math.floor(o/4)]=t[o+1];return{real:n,imag:r}}(r),a=on(i.real,i.imag).as1D(),s=function(t){for(var e=Math.floor(t.length/4),n=new Float32Array(e),r=new Float32Array(e),o=2;o<t.length;o+=4)n[Math.floor(o/4)]=t[o],r[Math.floor(o/4)]=t[o+1];return{real:n,imag:r}}(r),u=on(s.real,s.imag).as1D();a=this.fftRadix2(a,o,n),u=this.fftRadix2(u,o,n);var c=function(t,e){for(var n=new Float32Array(t/2),r=new Float32Array(t/2),o=0;o<Math.ceil(t/2);o++){var i=(e?2:-2)*Math.PI*(o/t);n[o]=Math.cos(i),r[o]=Math.sin(i)}return{real:n,imag:r}}(e,n),l=on(c.real,c.imag).mul(u),f=a.add(l),h=a.sub(l),p=an(f).concat(an(h)),d=sn(f).concat(sn(h));return on(p,d).as1D()},e.prototype.fourierTransformByMatmul=function(t,e,n){for(var r=new Float32Array(2*e),o=0;o<e;o++){for(var i=0,a=0,s=0;s<e;s++){var u=no(o*s,e,n),c=to(t,s);i+=c.real*u.real-c.imag*u.imag,a+=c.real*u.imag+c.imag*u.real}n&&(i/=e,a/=e),eo(r,i,a,o)}return r},e.prototype.depthToSpace=function(t,e,n){C("NHWC"===n,(function(){return"Only NHWC dataFormat supported on CPU for depthToSpace. Got "+n})),C(e>1,(function(){return"blockSize should be > 1 for depthToSpace, but was: "+e}));for(var r=t.shape[0],o=t.shape[1],i=t.shape[2],a=t.shape[3],s=o*e,u=i*e,c=a/(e*e),l=this.readSync(t.dataId),f=new Float32Array(r*s*u*c),h=0,p=0;p<r;++p)for(var d=0;d<s;++d)for(var m=Math.floor(d/e),v=d%e,g=0;g<u;++g)for(var y=Math.floor(g/e),b=(v*e+g%e)*c,w=0;w<c;++w){var x=w+b+a*(y+i*(m+o*p));f[h++]=l[x]}return dn(f,[r,s,u,c])},e.prototype.broadcastedBinaryOp=function(t,e,n,r){var o=Fr(t.shape,e.shape),i=Ln(o,n),a=this.readSync(t.dataId),s=this.readSync(e.dataId),u=Mr(t.shape,o),c=Mr(e.shape,o),l=i.values;if(u.length+c.length===0)for(var f=0;f<l.length;++f)l[f]=r(a[f%a.length],s[f%s.length]);else{var h=this.bufferSync(t),p=this.bufferSync(e),d=function(n){var o=i.indexToLoc(n),f=o.slice(-t.rank);u.forEach((function(t){return f[t]=0}));var d=h.locToIndex(f),m=o.slice(-e.rank);c.forEach((function(t){return m[t]=0}));var v=p.locToIndex(m);l[n]=r(a[d],s[v])};for(f=0;f<l.length;++f)d(f)}return i.toTensor()},e.prototype.broadcastedBinaryComplexOp=function(t,e,n){var r=Fr(t.shape,e.shape),o=Ln(r,"float32"),i=Ln(r,"float32"),a=this.readSync(t.dataId),s=this.readSync(e.dataId),u=Mr(t.shape,r),c=Mr(e.shape,r),l=o.values,f=i.values;if(u.length+c.length===0)for(var h=0;h<l.length;h++){var p=h%a.length,d=h%s.length,m=n(a[2*p],a[2*p+1],s[2*d],s[2*d+1]);l[h]=m.real,f[h]=m.imag}else{var v=this.bufferSync(this.data.get(t.dataId).complexTensors.real),g=this.bufferSync(this.data.get(e.dataId).complexTensors.real),y=function(r){var i=o.indexToLoc(r),h=i.slice(-t.rank);u.forEach((function(t){return h[t]=0}));var p=v.locToIndex(h),d=i.slice(-e.rank);c.forEach((function(t){return d[t]=0}));var m=g.locToIndex(d),y=n(a[2*p],a[2*p+1],s[2*m],s[2*m+1]);l[r]=y.real,f[r]=y.imag};for(h=0;h<l.length;h++)y(h)}return this.complex(o.toTensor(),i.toTensor())},e.prototype.split=function(t,e,n){return fo(t,e,n)},e.prototype.dispose=function(){},e.prototype.floatPrecision=function(){return 32},e.prototype.epsilon=function(){return 1e-7},e.prototype.cropAndResize=function(t,e,n,r,o,i){for(var a=t.shape,s=a[0],u=a[1],c=a[2],l=a[3],f=e.shape[0],h=r[0],p=r[1],d=Ln([f,h,p,l],"float32"),m=this.readSync(e.dataId),v=this.readSync(n.dataId),g=this.readSync(t.dataId),y=t.strides,b=d.strides,w=0;w<f;w++){var x=4*w,_=m[x],E=m[x+1],C=m[x+2],S=m[x+3],k=v[w];if(!(k>=s))for(var T=h>1?(C-_)*(u-1)/(h-1):0,I=p>1?(S-E)*(c-1)/(p-1):0,O=0;O<h;O++){var R=h>1?_*(u-1)+O*T:.5*(_+C)*(u-1);if(R<0||R>u-1)for(var A=0;A<p;A++)for(var D=0;D<l;D++){var N=D+A*b[2]+O*b[1]+w*b[0];d.values[N]=i}else if("bilinear"===o){var P=Math.floor(R),M=Math.ceil(R),j=R-P;for(A=0;A<p;A++)if((G=p>1?E*(c-1)+A*I:.5*(E+S)*(c-1))<0||G>c-1)for(D=0;D<l;D++)N=D+A*b[2]+O*b[1]+w*b[0],d.values[N]=i;else{var F=Math.floor(G),B=Math.ceil(G),L=G-F;for(D=0;D<l;D++){var U=g[N=D+F*y[2]+P*y[1]+k*y[0]],W=g[N=D+B*y[2]+P*y[1]+k*y[0]],z=g[N=D+F*y[2]+M*y[1]+k*y[0]],V=U+(W-U)*L,q=z+(g[N=D+B*y[2]+M*y[1]+k*y[0]]-z)*L;N=D+A*b[2]+O*b[1]+w*b[0],d.values[N]=V+(q-V)*j}}}else for(A=0;A<p;++A){var G;if((G=p>1?E*(c-1)+A*I:.5*(E+S)*(c-1))<0||G>c-1)for(D=0;D<l;D++)N=D+A*b[2]+O*b[1]+w*b[0],d.values[N]=i;else{var H=Math.round(G),X=Math.round(R);for(D=0;D<l;D++){var K=D+H*y[2]+X*y[1]+k*y[0],Y=D+A*b[2]+O*b[1]+w*b[0];d.values[Y]=g[K]}}}}}return d.toTensor()},e.prototype.sparseToDense=function(t,e,n,r){var o=xr(0,t,n),i=o.sliceRank,a=o.numUpdates,s=o.sliceSize,u=o.strides,c=o.outputSize;return this.scatter(t,e,n,c,s,a,i,u,r,!1)},e.prototype.gatherND=function(t,e){var n=e.shape,r=n[n.length-1],o=gr(t,e),i=o[0],a=o[1],s=o[2],u=o[3];if(0===a)return un([],i,t.dtype);for(var c=new dt([a,s],t.dtype),l=this.readSync(e.dataId),f=this.readSync(t.dataId),h=0;h<a;h++){for(var p=[],d=0,m=0;m<r;m++){var v=l[h*r+m];d+=v*u[m],p.push(v)}if(d<0||d>=t.size/s)throw new Error("Invalid indices: "+p+" does not index into "+t.shape);for(var g=0;g<s;g++)c.values[h*s+g]=f[d*s+g]}return c.toTensor().reshape(i)},e.prototype.scatterND=function(t,e,n){var r=xr(0,t,n),o=r.sliceRank,i=r.numUpdates,a=r.sliceSize,s=r.strides,u=r.outputSize,c=ln(0);return this.scatter(t,e,n,u,a,i,o,s,c,!0)},e.prototype.fill=function(t,e,n){var r=L(n=n||Y(e),I(t));return r.fill(e),Pt.makeTensor(r,t,n,this)},e.prototype.onesLike=function(t){if("string"===t.dtype)throw new Error("onesLike is not supported for string tensors");return this.fill(t.shape,1,t.dtype)},e.prototype.zerosLike=function(t){var e=L(t.dtype,I(t.shape));return this.makeOutput(e,t.shape,t.dtype)},e.prototype.linspace=function(t,e,n){return Qr(t,e,n)},e.prototype.scatter=function(t,e,n,r,o,i,a,s,u,c){var l=[r/o,o],f=this.readSync(t.dataId),h=this.readSync(e.dataId);if(0===r)return un([],n,e.dtype);var p=new dt(l,e.dtype);p.values.fill(this.readSync(u.dataId)[0]);for(var d=0;d<i;d++){for(var m=[],v=0,g=0;g<a;g++){var y=f[d*a+g];m.push(y),v+=y*s[g]}if(v<0||v>=r/o)throw new Error("Invalid indices: "+m+" does not index into "+n);for(var b=0;b<o;b++)c?p.values[v*o+b]+=h[d*o+b]:p.values[v*o+b]=0===e.rank?h[0]:h[d*o+b]}return p.toTensor().reshape(n)},e}(Nr);Pt.registerBackend("cpu",(function(){return new Fl}),1);for(var Bl=0,Ll=[{kernelName:"NonMaxSuppressionV5",backendName:"cpu",kernelFunc:function(t){var e=t.inputs,n=t.backend,r=t.attrs,o=e,i=o.boxes,a=o.scores,s=r,u=s.maxOutputSize,c=s.iouThreshold,l=s.scoreThreshold,f=s.softNmsSigma,h=n;Ml(i,"NonMaxSuppressionWithScore");var p=ao(h.data.get(i.dataId).values,h.data.get(a.dataId).values,u,c,l,f);return[p.selectedIndices,p.selectedScores]}},{kernelName:"Square",backendName:"cpu",kernelFunc:function(t){var e=t.inputs,n=t.backend,r=e.x,o=n;Ml(r,"square");for(var i=o.data.get(r.dataId).values,a=new Float32Array(i.length),s=0;s<i.length;++s){var u=i[s];a[s]=u*u}return{dataId:o.write(a,r.shape,r.dtype),shape:r.shape,dtype:r.dtype}}},{kernelName:$a,backendName:"cpu",kernelFunc:function(t){var e=t.inputs,n=t.backend,r=e,o=r.a,i=r.b,a=n;Ml([o,i],$a);var s=a.data.get(o.dataId).values,u=a.data.get(i.dataId).values,c=function(t,e,n,r,o,i){var a=Fr(t,e),s=a.length,u=Q(a),c=B(o,I(a)),l=t.length,f=e.length,h=Q(t),p=Q(e),d=Mr(t,a),m=Mr(e,a);if(d.length+m.length===0)for(var v=0;v<c.length;++v)c[v]=i(n[v%n.length],r[v%r.length]);else{var g=function(t){var e=ut(t,s,u),o=e.slice(-l);d.forEach((function(t){return o[t]=0}));var a=st(o,l,h),v=e.slice(-f);m.forEach((function(t){return v[t]=0}));var g=st(v,f,p);c[t]=i(n[a],r[g])};for(v=0;v<c.length;++v)g(v)}return[c,a]}(o.shape,i.shape,s,u,o.dtype,(function(t,e){var n=t-e;return n*n})),l=c[0],f=c[1];return{dataId:a.write(l,f,o.dtype),shape:f,dtype:o.dtype}}}];Bl<Ll.length;Bl++)g(Ll[Bl]);for(var Ul,Wl=function(t){this.variableNames=["A"];var e=xo(),n=t[0],r=t[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n vec2 uv = (vec2(texC, texR) + halfCR) / vec2("+r+".0, "+n+".0);\n\n vec4 values = "+e.texture2D+"(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n setOutput(floor(value * 255.0 + 0.5));\n }\n "},zl=function(t){this.variableNames=["A"],this.packedInputs=!1,this.packedOutput=!0;var e=xo(),n=t[0],r=t[1];this.outputShape=t,this.userCode="\n void main() {\n ivec3 coords = getOutputCoords();\n int texR = coords[0];\n int texC = coords[1];\n int depth = coords[2];\n\n vec4 result = vec4(0.);\n\n for(int row=0; row<=1; row++) {\n for(int col=0; col<=1; col++) {\n texC = coords[1] + row;\n depth = coords[2] + col;\n\n vec2 uv = (vec2(texC, texR) + halfCR) /\n vec2("+r+".0, "+n+".0);\n vec4 values = "+e.texture2D+"(A, uv);\n float value;\n if (depth == 0) {\n value = values.r;\n } else if (depth == 1) {\n value = values.g;\n } else if (depth == 2) {\n value = values.b;\n } else if (depth == 3) {\n value = values.a;\n }\n\n result[row * 2 + col] = floor(value * 255.0 + 0.5);\n }\n }\n\n "+e.output+" = result;\n }\n "},Vl=0,ql=[{kernelName:"FromPixels",backendName:"webgl",kernelFunc:function(t){var e=t.inputs,n=t.backend,r=t.attrs,o=e.pixels,i=r.numChannels,a="undefined"!=typeof HTMLVideoElement&&o instanceof HTMLVideoElement,s="undefined"!=typeof HTMLImageElement&&o instanceof HTMLImageElement,u=a?[o.videoWidth,o.videoHeight]:[o.width,o.height],c=u[0],l=u[1],h=[l,c],p=[l,c,i];(s||a)&&(null==Ul&&(Ul=document.createElement("canvas").getContext("2d")),Ul.canvas.width=c,Ul.canvas.height=l,Ul.drawImage(o,0,0,c,l),o=Ul.canvas);var d=n.makeTensorInfo(h,"int32");n.texData.get(d.dataId).usage=Bt.PIXELS,n.gpgpu.uploadPixelDataToTexture(n.getTexture(d.dataId),o);var m=f().getBool("WEBGL_PACK")?new zl(p):new Wl(p),v=n.runWebGLProgram(m,[d],"int32");return n.disposeData(d.dataId),v}},{kernelName:"NonMaxSuppressionV5",backendName:"webgl",kernelFunc:function(t){var e=t.inputs,n=t.backend,r=t.attrs;ze("tf.nonMaxSuppression() in webgl locks the UI thread. Call tf.nonMaxSuppressionAsync() instead");var o=e,i=o.boxes,a=o.scores,s=r,u=s.maxOutputSize,c=s.iouThreshold,l=s.scoreThreshold,f=s.softNmsSigma,h=n,p=ao(h.readSync(i.dataId),h.readSync(a.dataId),u,c,l,f);return[p.selectedIndices,p.selectedScores]}},{kernelName:"Square",backendName:"webgl",kernelFunc:function(t){var e=t.inputs,n=t.backend,r=e.x,o=n,i=new Oa(r.shape,"return x * x;");return o.runWebGLProgram(i,[r],r.dtype)}},{kernelName:$a,backendName:"webgl",kernelFunc:function(t){var e=t.inputs,n=t.backend,r=e,o=r.a,i=r.b,a=n,s=f().getBool("WEBGL_PACK_BINARY_OPERATIONS")?new Xo("return (a - b) * (a - b);",o.shape,i.shape):new Go("return (a - b) * (a - b);",o.shape,i.shape);return a.compileAndRun(s,[o,i])}}];Vl<ql.length;Vl++)g(ql[Vl]);for(var Gl=0,Hl=[{kernelName:"Square",gradFunc:function(t,e){var n=e[0];return{x:function(){return t.mul(n.toFloat().mul(2))}}}},{kernelName:$a,gradFunc:function(t,e){var n=e[0],r=e[1],o=ln(2);return{a:function(){return hu(t,hu(o,gu(n,r)))},b:function(){return hu(t,hu(o,gu(r,n)))}}}}];Gl<Hl.length;Gl++)y(Hl[Gl]);var Xl=function(){function t(){}return t.prototype.fetch=function(t,e){return fetch(t,e)},t.prototype.now=function(){return performance.now()},t.prototype.encode=function(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)},t.prototype.decode=function(t,e){return new TextDecoder(e).decode(t)},t}();f().get("IS_BROWSER")&&f().setPlatform("browser",new Xl);var Kl,Yl=function(){function t(){this.util=n(/*! util */7),this.textEncoder=new this.util.TextEncoder}return t.prototype.fetch=function(t,e){return null!=f().global.fetch?f().global.fetch(t,e):(null==Kl&&(Kl=n(/*! node-fetch */6)),Kl(t,e))},t.prototype.now=function(){var t=r.hrtime();return 1e3*t[0]+t[1]/1e6},t.prototype.encode=function(t,e){if("utf-8"!==e&&"utf8"!==e)throw new Error("Node built-in encoder only supports utf-8, but got "+e);return this.textEncoder.encode(t)},t.prototype.decode=function(t,e){return 0===t.length?"":new this.util.TextDecoder(e).decode(t)},t}();f().get("IS_NODE")&&f().setPlatform("node",new Yl);var $l={float32:4,int32:4,uint16:2,uint8:1,bool:1};function Jl(t,e){for(var n={},r=0,o=function(e){var o=e.name,i=e.dtype,a=e.shape,s=I(a),u=void 0;if("quantization"in e){var c=e.quantization;if("uint8"!==c.dtype&&"uint16"!==c.dtype)throw new Error("Weight "+e.name+" has unknown quantization dtype "+c.dtype+". Supported quantization dtypes are: 'uint8' and 'uint16'.");var l=$l[c.dtype],f=t.slice(r,r+s*l),h="uint8"===c.dtype?new Uint8Array(f):new Uint16Array(f);if("float32"===i)u=Float32Array.from(h,(function(t){return t*c.scale+c.min}));else{if("int32"!==i)throw new Error("Unsupported dtype in weight '"+o+"': "+i);u=Int32Array.from(h,(function(t){return Math.round(t*c.scale+c.min)}))}r+=s*l}else if("string"===i){var p=I(e.shape);u=[];for(var d=0;d<p;d++){var m=new Uint32Array(t.slice(r,r+4))[0];r+=4;var v=new Uint8Array(t.slice(r,r+m));u.push(v),r+=m}}else{var g=$l[i];if(f=t.slice(r,r+s*g),"float32"===i)u=new Float32Array(f);else if("int32"===i)u=new Int32Array(f);else{if("bool"!==i)throw new Error("Unsupported dtype in weight '"+o+"': "+i);u=new Uint8Array(f)}r+=s*g}n[o]=un(u,a,i)},i=0,a=e;i<a.length;i++)o(a[i]);return n}function Ql(t){if(null===t)throw new Error("Invalid input value: "+JSON.stringify(t));var e=0,n=[];t.forEach((function(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)}));var r=new Uint8Array(e),o=0;return n.forEach((function(t){r.set(new Uint8Array(t.buffer),o),o+=t.byteLength})),r.buffer}var Zl=void 0!==o&&("undefined"==typeof Blob||"undefined"==typeof atob||"undefined"==typeof btoa);function tf(t){return Zl?o.byteLength(t):new Blob([t]).size}function ef(t){var e=0;t.forEach((function(t){e+=t.byteLength}));var n=new Uint8Array(e),r=0;return t.forEach((function(t){n.set(new Uint8Array(t),r),r+=t.byteLength})),n.buffer}function nf(t){for(t=t.trim();t.endsWith("/");)t=t.slice(0,t.length-1);var e=t.split("/");return e[e.length-1]}function rf(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:tf(JSON.stringify(t.modelTopology)),weightSpecsBytes:null==t.weightSpecs?0:tf(JSON.stringify(t.weightSpecs)),weightDataBytes:null==t.weightData?0:t.weightData.byteLength}}var of=function(){function t(){this.saveRouters=[],this.loadRouters=[]}return t.getInstance=function(){return null==t.instance&&(t.instance=new t),t.instance},t.registerSaveRouter=function(e){t.getInstance().saveRouters.push(e)},t.registerLoadRouter=function(e){t.getInstance().loadRouters.push(e)},t.getSaveHandlers=function(e){return t.getHandlers(e,"save")},t.getLoadHandlers=function(e,n){return t.getHandlers(e,"load",n)},t.getHandlers=function(e,n,r){var o=[];return("load"===n?t.getInstance().loadRouters:t.getInstance().saveRouters).forEach((function(t){var n=t(e,r);null!==n&&o.push(n)})),o},t}(),af="://",sf=function(){function t(){this.managers={}}return t.getInstance=function(){return null==t.instance&&(t.instance=new t),t.instance},t.registerManager=function(e,n){C(null!=e,(function(){return"scheme must not be undefined or null."})),e.endsWith(af)&&(e=e.slice(0,e.indexOf(af))),C(e.length>0,(function(){return"scheme must not be an empty string."}));var r=t.getInstance();C(null==r.managers[e],(function(){return"A model store manager is already registered for scheme '"+e+"'."})),r.managers[e]=n},t.getManager=function(t){var e=this.getInstance().managers[t];if(null==e)throw new Error("Cannot find model manager for scheme '"+t+"'");return e},t.getSchemes=function(){return Object.keys(this.getInstance().managers)},t}();function uf(t){if(-1===t.indexOf(af))throw new Error("The url string provided does not contain a scheme. Supported schemes are: "+sf.getSchemes().join(","));return{scheme:t.split(af)[0],path:t.split(af)[1]}}function cf(t,e,n){return void 0===n&&(n=!1),s(this,void 0,void 0,(function(){var r,o,i,a,s,c,l,f,h;return u(this,(function(u){switch(u.label){case 0:return C(t!==e,(function(){return"Old path and new path are the same: '"+t+"'"})),C((r=of.getLoadHandlers(t)).length>0,(function(){return"Copying failed because no load handler is found for source URL "+t+"."})),C(r.length<2,(function(){return"Copying failed because more than one ("+r.length+") load handlers for source URL "+t+"."})),o=r[0],C((i=of.getSaveHandlers(e)).length>0,(function(){return"Copying failed because no save handler is found for destination URL "+e+"."})),C(i.length<2,(function(){return"Copying failed because more than one ("+r.length+") save handlers for destination URL "+e+"."})),a=i[0],s=uf(t).scheme,c=uf(t).path,l=s===uf(t).scheme,[4,o.load()];case 1:return f=u.sent(),n&&l?[4,sf.getManager(s).removeModel(c)]:[3,3];case 2:u.sent(),u.label=3;case 3:return[4,a.save(f)];case 4:return h=u.sent(),!n||l?[3,6]:[4,sf.getManager(s).removeModel(c)];case 5:u.sent(),u.label=6;case 6:return[2,h.modelArtifactsInfo]}}))}))}var lf="models_store",ff="model_info_store";function hf(){if(!f().getBool("IS_BROWSER"))throw new Error("Failed to obtain IndexedDB factory because the current environmentis not a web browser.");var t=window||self,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 pf(t){var e=t.result;e.createObjectStore(lf,{keyPath:"modelPath"}),e.createObjectStore(ff,{keyPath:"modelPath"})}var df=function(){function t(t){if(this.indexedDB=hf(),null==t||!t)throw new Error("For IndexedDB, modelPath must not be null, undefined or empty.");this.modelPath=t}return t.prototype.save=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");return[2,this.databaseAction(this.modelPath,t)]}))}))},t.prototype.load=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){return[2,this.databaseAction(this.modelPath)]}))}))},t.prototype.databaseAction=function(t,e){var n=this;return new Promise((function(t,r){var o=n.indexedDB.open("tensorflowjs",1);o.onupgradeneeded=function(){return pf(o)},o.onsuccess=function(){var i=o.result;if(null==e){var a=i.transaction(lf,"readonly"),s=a.objectStore(lf).get(n.modelPath);s.onsuccess=function(){if(null==s.result)return i.close(),r(new Error("Cannot find model with path '"+n.modelPath+"' in IndexedDB."));t(s.result.modelArtifacts)},s.onerror=function(t){return i.close(),r(s.error)},a.oncomplete=function(){return i.close()}}else{var u,c=rf(e),l=i.transaction(ff,"readwrite"),f=l.objectStore(ff),h=f.put({modelPath:n.modelPath,modelArtifactsInfo:c});h.onsuccess=function(){var o=(u=i.transaction(lf,"readwrite")).objectStore(lf).put({modelPath:n.modelPath,modelArtifacts:e,modelArtifactsInfo:c});o.onsuccess=function(){return t({modelArtifactsInfo:c})},o.onerror=function(t){var e=(f=l.objectStore(ff)).delete(n.modelPath);e.onsuccess=function(){return i.close(),r(o.error)},e.onerror=function(t){return i.close(),r(o.error)}}},h.onerror=function(t){return i.close(),r(h.error)},l.oncomplete=function(){null==u?i.close():u.oncomplete=function(){return i.close()}}}},o.onerror=function(t){return r(o.error)}}))},t.URL_SCHEME="indexeddb://",t}(),mf=function(t){return f().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(df.URL_SCHEME)?(e=t.slice(df.URL_SCHEME.length),new df(e)):null;var e};of.registerSaveRouter(mf),of.registerLoadRouter(mf);var vf=function(){function t(){this.indexedDB=hf()}return t.prototype.listModels=function(){return s(this,void 0,void 0,(function(){var t=this;return u(this,(function(e){return[2,new Promise((function(e,n){var r=t.indexedDB.open("tensorflowjs",1);r.onupgradeneeded=function(){return pf(r)},r.onsuccess=function(){var t=r.result,o=t.transaction(ff,"readonly"),i=o.objectStore(ff).getAll();i.onsuccess=function(){for(var t={},n=0,r=i.result;n<r.length;n++){var o=r[n];t[o.modelPath]=o.modelArtifactsInfo}e(t)},i.onerror=function(e){return t.close(),n(i.error)},o.oncomplete=function(){return t.close()}},r.onerror=function(t){return n(r.error)}}))]}))}))},t.prototype.removeModel=function(t){return s(this,void 0,void 0,(function(){var e=this;return u(this,(function(n){var r;return t=(r=t).startsWith(df.URL_SCHEME)?r.slice(df.URL_SCHEME.length):r,[2,new Promise((function(n,r){var o=e.indexedDB.open("tensorflowjs",1);o.onupgradeneeded=function(){return pf(o)},o.onsuccess=function(){var e,i=o.result,a=i.transaction(ff,"readwrite"),s=a.objectStore(ff),u=s.get(t);u.onsuccess=function(){if(null==u.result)return i.close(),r(new Error("Cannot find model with path '"+t+"' in IndexedDB."));var o=s.delete(t),a=function(){var o=(e=i.transaction(lf,"readwrite")).objectStore(lf).delete(t);o.onsuccess=function(){return n(u.result.modelArtifactsInfo)},o.onerror=function(t){return r(u.error)}};o.onsuccess=a,o.onerror=function(t){return a(),i.close(),r(u.error)}},u.onerror=function(t){return i.close(),r(u.error)},a.oncomplete=function(){null==e?i.close():e.oncomplete=function(){return i.close()}}},o.onerror=function(t){return r(o.error)}}))]}))}))},t}();if(f().getBool("IS_BROWSER"))try{sf.registerManager(df.URL_SCHEME,new vf)}catch(i){}var gf="/",yf="tensorflowjs_models",bf="info",wf="model_topology",xf="weight_specs",_f="weight_data",Ef="model_metadata";function Cf(t){return{info:[yf,t,bf].join(gf),topology:[yf,t,wf].join(gf),weightSpecs:[yf,t,xf].join(gf),weightData:[yf,t,_f].join(gf),modelMetadata:[yf,t,Ef].join(gf)}}function Sf(t){var e=t.split(gf);if(e.length<3)throw new Error("Invalid key format: "+t);return e.slice(1,e.length-1).join(gf)}var kf=function(){function t(t){if(!f().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=Cf(this.modelPath)}return t.prototype.save=function(t){return s(this,void 0,void 0,(function(){var e,n,r;return u(this,(function(i){if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserLocalStorage.save() does not support saving model topology in binary formats yet.");e=JSON.stringify(t.modelTopology),n=JSON.stringify(t.weightSpecs),r=rf(t);try{return 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,function(t){if(Zl)return o.from(t).toString("base64");for(var e=new Uint8Array(t),n="",r=0,i=e.length;r<i;r++)n+=String.fromCharCode(e[r]);return btoa(n)}(t.weightData)),this.LS.setItem(this.keys.modelMetadata,JSON.stringify({format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,userDefinedMetadata:t.userDefinedMetadata})),[2,{modelArtifactsInfo:r}]}catch(t){throw this.LS.removeItem(this.keys.info),this.LS.removeItem(this.keys.topology),this.LS.removeItem(this.keys.weightSpecs),this.LS.removeItem(this.keys.weightData),this.LS.removeItem(this.keys.modelMetadata),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+".")}return[2]}))}))},t.prototype.load=function(){return s(this,void 0,void 0,(function(){var t,e,n,r,i,a,s;return u(this,(function(u){if(null==(t=JSON.parse(this.LS.getItem(this.keys.info))))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.");if(e={},null==(n=JSON.parse(this.LS.getItem(this.keys.topology))))throw new Error("In local storage, the topology of model '"+this.modelPath+"' is missing.");if(e.modelTopology=n,null==(r=JSON.parse(this.LS.getItem(this.keys.weightSpecs))))throw new Error("In local storage, the weight specs of model '"+this.modelPath+"' are missing.");if(e.weightSpecs=r,null!=(i=this.LS.getItem(this.keys.modelMetadata))&&(a=JSON.parse(i),e.format=a.format,e.generatedBy=a.generatedBy,e.convertedBy=a.convertedBy,e.userDefinedMetadata=a.userDefinedMetadata),null==(s=this.LS.getItem(this.keys.weightData)))throw new Error("In local storage, the binary weight values of model '"+this.modelPath+"' are missing.");return e.weightData=function(t){if(Zl){var e=o.from(t,"base64");return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}for(var n=atob(t),r=new Uint8Array(n.length),i=0;i<n.length;++i)r.set([n.charCodeAt(i)],i);return r.buffer}(s),[2,e]}))}))},t.URL_SCHEME="localstorage://",t}(),Tf=function(t){return f().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(kf.URL_SCHEME)?(e=t.slice(kf.URL_SCHEME.length),new kf(e)):null;var e};of.registerSaveRouter(Tf),of.registerLoadRouter(Tf);var If=function(){function t(){C(f().getBool("IS_BROWSER"),(function(){return"Current environment is not a web browser"})),C("undefined"==typeof window||void 0!==window.localStorage,(function(){return"Current browser does not appear to support localStorage"})),this.LS=window.localStorage}return t.prototype.listModels=function(){return s(this,void 0,void 0,(function(){var t,e,n,r,o,i;return u(this,(function(a){for(t={},e=yf+gf,n=gf+bf,r=0;r<this.LS.length;++r)(o=this.LS.key(r)).startsWith(e)&&o.endsWith(n)&&(i=Sf(o),t[i]=JSON.parse(this.LS.getItem(o)));return[2,t]}))}))},t.prototype.removeModel=function(t){return s(this,void 0,void 0,(function(){var e,n;return u(this,(function(r){var o;if(t=(o=t).startsWith(kf.URL_SCHEME)?o.slice(kf.URL_SCHEME.length):o,e=Cf(t),null==this.LS.getItem(e.info))throw new Error("Cannot find model at path '"+t+"'");return n=JSON.parse(this.LS.getItem(e.info)),this.LS.removeItem(e.info),this.LS.removeItem(e.topology),this.LS.removeItem(e.weightSpecs),this.LS.removeItem(e.weightData),[2,n]}))}))},t}();if(f().getBool("IS_BROWSER"))try{sf.registerManager(kf.URL_SCHEME,new If)}catch(i){}function Of(t){return new Promise((function(t){return setTimeout(t)})).then(t)}var Rf=function(){function t(e){if(!f().getBool("IS_BROWSER"))throw new Error("browserDownloads() cannot proceed because the current environment is not a browser.");e.startsWith(t.URL_SCHEME)&&(e=e.slice(t.URL_SCHEME.length)),null!=e&&0!==e.length||(e="model"),this.modelTopologyFileName=e+".json",this.weightDataFileName=e+".weights.bin"}return t.prototype.save=function(t){return s(this,void 0,void 0,(function(){var e,n,r,o,i,a;return u(this,(function(s){switch(s.label){case 0:if("undefined"==typeof document)throw new Error("Browser downloads are not supported in this environment since `document` is not present");if(e=window.URL.createObjectURL(new Blob([t.weightData],{type:"application/octet-stream"})),!(t.modelTopology instanceof ArrayBuffer))return[3,1];throw new Error("BrowserDownloads.save() does not support saving model topology in binary formats yet.");case 1:return n=[{paths:["./"+this.weightDataFileName],weights:t.weightSpecs}],r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,weightsManifest:n},o=window.URL.createObjectURL(new Blob([JSON.stringify(r)],{type:"application/json"})),(i=null==this.jsonAnchor?document.createElement("a"):this.jsonAnchor).download=this.modelTopologyFileName,i.href=o,[4,Of((function(){return i.dispatchEvent(new MouseEvent("click"))}))];case 2:return s.sent(),null==t.weightData?[3,4]:((a=null==this.weightDataAnchor?document.createElement("a"):this.weightDataAnchor).download=this.weightDataFileName,a.href=e,[4,Of((function(){return a.dispatchEvent(new MouseEvent("click"))}))]);case 3:s.sent(),s.label=4;case 4:return[2,{modelArtifactsInfo:rf(t)}]}}))}))},t.URL_SCHEME="downloads://",t}(),Af=function(){function t(t){if(null==t||t.length<1)throw new Error("When calling browserFiles, at least 1 file is required, but received "+t);this.files=t}return t.prototype.load=function(){return s(this,void 0,void 0,(function(){var t,e,n=this;return u(this,(function(r){return t=this.files[0],e=this.files.slice(1),[2,new Promise((function(r,o){var i=new FileReader;i.onload=function(i){var a=JSON.parse(i.target.result),s=a.modelTopology;if(null!=s){0===e.length&&r({modelTopology:s});var u=a.weightsManifest;if(null!=u){var c;try{c=n.checkManifestAndWeightFiles(u,e)}catch(t){return void o(t)}var l=[],f=[],h=[];u.forEach((function(t){t.paths.forEach((function(t){f.push(t),h.push(null)})),l.push.apply(l,t.weights)})),u.forEach((function(t){t.paths.forEach((function(t){var e=new FileReader;e.onload=function(e){var n=e.target.result,o=f.indexOf(t);h[o]=n,-1===h.indexOf(null)&&r({modelTopology:s,weightSpecs:l,weightData:ef(h),format:a.format,generatedBy:a.generatedBy,convertedBy:a.convertedBy,userDefinedMetadata:a.userDefinedMetadata})},e.onerror=function(e){return o("Failed to weights data from file of path '"+t+"'.")},e.readAsArrayBuffer(c[t])}))}))}else o(new Error("weightManifest field is missing from file "+t.name))}else o(new Error("modelTopology field is missing from file "+t.name))},i.onerror=function(e){return o("Failed to read model topology and weights manifest JSON from file '"+t.name+"'. BrowserFiles supports loading Keras-style tf.Model artifacts only.")},i.readAsText(t)}))]}))}))},t.prototype.checkManifestAndWeightFiles=function(t,e){for(var n=[],r=e.map((function(t){return nf(t.name)})),o={},i=0,a=t;i<a.length;i++)a[i].paths.forEach((function(t){var i=nf(t);if(-1!==n.indexOf(i))throw new Error("Duplicate file basename found in weights manifest: '"+i+"'");if(n.push(i),-1===r.indexOf(i))throw new Error("Weight file with basename '"+i+"' is not provided.");o[t]=e[r.indexOf(i)]}));if(n.length!==e.length)throw new Error("Mismatch in the number of files in weights manifest ("+n.length+") and the number of weight files provided ("+e.length+").");return o},t}();function Df(t,e,n,r){!function(t){C(null!=t&&Array.isArray(t)&&t.length>0,(function(){return"promises must be a none empty array"}))}(t),function(t,e){C(t>=0&&t<=1,(function(){return"Progress fraction must be in range [0, 1], but got startFraction "+t})),C(e>=0&&e<=1,(function(){return"Progress fraction must be in range [0, 1], but got endFraction "+e})),C(e>=t,(function(){return"startFraction must be no more than endFraction, but got startFraction "+t+" and endFraction "+e}))}(n=null==n?0:n,r=null==r?1:r);var o=0;return Promise.all(t.map((function(i){return i.then((function(i){var a=n+ ++o/t.length*(r-n);return e(a),i})),i})))}function Nf(t,e){return s(this,void 0,void 0,(function(){var n,r,o,i,a,s,c,l,h;return u(this,(function(u){switch(u.label){case 0:return null==e&&(e={}),n=null==e.fetchFunc?f().platform.fetch:e.fetchFunc,r=t.map((function(t){return n(t,e.requestInit,{isBinary:!0})})),o=0,i=.5,null!=e.onProgress?[3,2]:[4,Promise.all(r)];case 1:return a=u.sent(),[3,4];case 2:return[4,Df(r,e.onProgress,o,i)];case 3:a=u.sent(),u.label=4;case 4:return s=a.map((function(t){return t.arrayBuffer()})),c=.5,l=1,null!=e.onProgress?[3,6]:[4,Promise.all(s)];case 5:return h=u.sent(),[3,8];case 6:return[4,Df(s,e.onProgress,c,l)];case 7:h=u.sent(),u.label=8;case 8:return[2,h]}}))}))}function Pf(t){var e=this;return function(n,r,o){return void 0===r&&(r=""),s(e,void 0,void 0,(function(){var e,i,a,s,c,l,f,h,p,d;return u(this,(function(u){switch(u.label){case 0:if(e=n.map((function(){return!1})),i={},a=null!=o?o.map((function(){return!1})):[],s=[],n.forEach((function(t,n){var r=0;t.weights.forEach((function(t){var u="quantization"in t?t.quantization.dtype:t.dtype,c=$l[u]*I(t.shape),l=function(){e[n]=!0,null==i[n]&&(i[n]=[]),i[n].push({manifestEntry:t,groupOffset:r,sizeBytes:c})};null!=o?o.forEach((function(e,n){e===t.name&&(l(),a[n]=!0)})):l(),s.push(t.name),r+=c}))})),!a.every((function(t){return t})))throw c=o.filter((function(t,e){return!a[e]})),new Error("Could not find weights in manifest with names: "+c.join(", ")+". \nManifest JSON has weights with names: "+s.join(", ")+".");return l=e.reduce((function(t,e,n){return e&&t.push(n),t}),[]),f=[],l.forEach((function(t){n[t].paths.forEach((function(t){var e=r+(r.endsWith("/")?"":"/")+t;f.push(e)}))})),[4,t(f)];case 1:return h=u.sent(),p={},d=0,l.forEach((function(t){for(var e=n[t].paths.length,r=0,o=0;o<e;o++)r+=h[d+o].byteLength;for(var a=new ArrayBuffer(r),s=new Uint8Array(a),u=0,c=0;c<e;c++){var l=new Uint8Array(h[d+c]);s.set(l,u),u+=l.byteLength}i[t].forEach((function(t){var e=Jl(a.slice(t.groupOffset,t.groupOffset+t.sizeBytes),[t.manifestEntry]);for(var n in e)p[n]=e[n]})),d+=e})),[2,p]}}))}))}}of.registerSaveRouter((function(t){return f().getBool("IS_BROWSER")&&!Array.isArray(t)&&t.startsWith(Rf.URL_SCHEME)?function(t){return void 0===t&&(t="model"),new Rf(t)}(t.slice(Rf.URL_SCHEME.length)):null}));var Mf=function(){function t(t,e){if(this.DEFAULT_METHOD="POST",null==e&&(e={}),this.weightPathPrefix=e.weightPathPrefix,this.onProgress=e.onProgress,null!=e.fetchFunc?(C("function"==typeof e.fetchFunc,(function(){return"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=f().platform.fetch,C(null!=t&&t.length>0,(function(){return"URL path for http must not be null, undefined or empty."})),Array.isArray(t)&&C(2===t.length,(function(){return"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||{}}return t.prototype.save=function(t){return s(this,void 0,void 0,(function(){var e,n,r,o;return u(this,(function(i){switch(i.label){case 0:if(t.modelTopology instanceof ArrayBuffer)throw new Error("BrowserHTTPRequest.save() does not support saving model topology in binary formats yet.");return(e=Object.assign({method:this.DEFAULT_METHOD},this.requestInit)).body=new FormData,n=[{paths:["./model.weights.bin"],weights:t.weightSpecs}],r={modelTopology:t.modelTopology,format:t.format,generatedBy:t.generatedBy,convertedBy:t.convertedBy,userDefinedMetadata:t.userDefinedMetadata,weightsManifest:n},e.body.append("model.json",new Blob([JSON.stringify(r)],{type:"application/json"}),"model.json"),null!=t.weightData&&e.body.append("model.weights.bin",new Blob([t.weightData],{type:"application/octet-stream"}),"model.weights.bin"),[4,this.fetch(this.path,e)];case 1:if((o=i.sent()).ok)return[2,{modelArtifactsInfo:rf(t),responses:[o]}];throw new Error("BrowserHTTPRequest.save() failed due to HTTP response status "+o.status+".")}}))}))},t.prototype.load=function(){return s(this,void 0,void 0,(function(){var t,e,n,r,o,i,a,s,c,l,f,h;return u(this,(function(u){switch(u.label){case 0:return[4,this.fetch(this.path,this.requestInit)];case 1:if(!(t=u.sent()).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.");u.label=2;case 2:return u.trys.push([2,4,,5]),[4,t.json()];case 3:return e=u.sent(),[3,5];case 4:throw u.sent(),n="Failed to parse model JSON of response from "+this.path+".",this.path.endsWith(".pb")?n+=" 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.":n+=" Please make sure the server is serving valid JSON for this request.",new Error(n);case 5:if(r=e.modelTopology,o=e.weightsManifest,i=e.generatedBy,a=e.convertedBy,s=e.format,c=e.userDefinedMetadata,null==r&&null==o)throw new Error("The JSON from HTTP path "+this.path+" contains neither model topology or manifest for weights.");return null==o?[3,7]:[4,this.loadWeights(o)];case 6:h=u.sent(),l=h[0],f=h[1],u.label=7;case 7:return[2,{modelTopology:r,weightSpecs:l,weightData:f,userDefinedMetadata:c,generatedBy:i,convertedBy:a,format:s}]}}))}))},t.prototype.loadWeights=function(t){return s(this,void 0,void 0,(function(){var e,n,r,o,i,a,s,c,l,f,h;return u(this,(function(u){switch(u.label){case 0:for(e=Array.isArray(this.path)?this.path[1]:this.path,n=function(t){var e=t.lastIndexOf("/"),n=t.lastIndexOf("?");return[t.substring(0,e)+"/",n>e?t.substring(n):""]}(e),r=n[0],o=n[1],i=this.weightPathPrefix||r,a=[],s=0,c=t;s<c.length;s++)l=c[s],a.push.apply(a,l.weights);return f=[],t.forEach((function(t){t.paths.forEach((function(t){f.push(i+t+o)}))})),[4,Nf(f,{requestInit:this.requestInit,fetchFunc:this.fetch,onProgress:this.onProgress})];case 1:return h=u.sent(),[2,[a,ef(h)]]}}))}))},t.URL_SCHEME_REGEX=/^https?:\/\//,t}();function jf(t){return null!=t.match(Mf.URL_SCHEME_REGEX)}var Ff=function(t,e){return"undefined"==typeof fetch?null:(Array.isArray(t)?t.every((function(t){return jf(t)})):jf(t))?Bf(t,{onProgress:e}):null};function Bf(t,e){return new Mf(t,e)}of.registerSaveRouter(Ff),of.registerLoadRouter(Ff);var Lf,Uf=function(){function t(t){this.modelArtifacts=t}return t.prototype.load=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){return[2,this.modelArtifacts]}))}))},t}(),Wf=function(){function t(t){this.saveHandler=t}return t.prototype.save=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,this.saveHandler(t)]}))}))},t}(),zf=Object.freeze({browserFiles:function(t){return new Af(t)},browserHTTPRequest:function(t,e){return Bf(t,e)},concatenateArrayBuffers:ef,decodeWeights:Jl,encodeWeights:function(t,e){return s(this,void 0,void 0,(function(){var n,r,o,i,a,c=this;return u(this,(function(l){switch(l.label){case 0:for(n=[],r=[],o=Array.isArray(t)?t.map((function(t){return t.name})):Object.keys(t),i=function(i){var a=o[i],l=Array.isArray(t)?t[i].tensor:t[a];if("float32"!==l.dtype&&"int32"!==l.dtype&&"bool"!==l.dtype&&"string"!==l.dtype)throw new Error("Unsupported dtype in weight '"+a+"': "+l.dtype);var f={name:a,shape:l.shape,dtype:l.dtype};if("string"===l.dtype){var h=new Promise((function(t){return s(c,void 0,void 0,(function(){var e,n,r,o,i,a,s;return u(this,(function(u){switch(u.label){case 0:return[4,l.bytes()];case 1:for(e=u.sent(),n=e.reduce((function(t,e){return t+e.length}),0)+4*e.length,r=new Uint8Array(n),o=0,i=0;i<e.length;i++)a=e[i],s=new Uint8Array(new Uint32Array([a.length]).buffer),r.set(s,o),o+=4,r.set(a,o),o+=a.length;return t(r),[2]}}))}))}));r.push(h)}else r.push(l.data());null!=e&&(f.group=e),n.push(f)},a=0;a<o.length;++a)i(a);return[4,Promise.all(r)];case 1:return[2,{data:Ql(l.sent()),specs:n}]}}))}))},fromMemory:function(t,e,n,r){return 1===arguments.length?null!=t.modelTopology||null!=t.weightSpecs?new Uf(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 Uf({modelTopology: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 Uf({modelTopology:t,weightSpecs:e,weightData:n,trainingConfig:r}))},getLoadHandlers:function(t,e){return of.getLoadHandlers(t,e)},getModelArtifactsInfoForJSON:rf,getSaveHandlers:function(t){return of.getSaveHandlers(t)},http:Bf,isHTTPScheme:jf,loadWeights:function(t,e,n,r){return void 0===e&&(e=""),s(this,void 0,void 0,(function(){return u(this,(function(o){return[2,Pf((function(t){return Nf(t,{requestInit:r})}))(t,e,n)]}))}))},registerLoadRouter:function(t){return of.registerLoadRouter(t)},registerSaveRouter:function(t){return of.registerSaveRouter(t)},weightsLoaderFactory:Pf,withSaveHandler:function(t){return new Wf(t)},copyModel:function(t,e){return s(this,void 0,void 0,(function(){return u(this,(function(n){return[2,cf(t,e,!1)]}))}))},listModels:function(){return s(this,void 0,void 0,(function(){var t,e,n,r,o,i,a;return u(this,(function(s){switch(s.label){case 0:t=sf.getSchemes(),e={},n=0,r=t,s.label=1;case 1:return n<r.length?(o=r[n],[4,sf.getManager(o).listModels()]):[3,4];case 2:for(a in i=s.sent())e[o+af+a]=i[a];s.label=3;case 3:return n++,[3,1];case 4:return[2,e]}}))}))},moveModel:function(t,e){return s(this,void 0,void 0,(function(){return u(this,(function(n){return[2,cf(t,e,!0)]}))}))},removeModel:function(t){return s(this,void 0,void 0,(function(){var e;return u(this,(function(n){return e=uf(t),[2,sf.getManager(e.scheme).removeModel(e.path)]}))}))}}),Vf=rn({confusionMatrix_:function(t,e,n){var r=Ge(t,"labels","confusionMatrix"),o=Ge(e,"predictions","confusionMatrix");C(null==n||n>0&&Number.isInteger(n),(function(){return"If provided, numClasses must be a positive integer, but got "+n})),C(1===r.rank,(function(){return"Expected the rank of labels to be 1, but got "+r.rank})),C(1===o.rank,(function(){return"Expected the rank of predictions to be 1, but got "+o.rank})),C(r.shape[0]===o.shape[0],(function(){return"Mismatch in the number of examples: "+r.shape[0]+" vs. "+o.shape[0]+". Labels and predictions should have the same number of elements."})),C(n>0&&Number.isInteger(n),(function(){return"numClasses is required to be a positive integer, but got "+n}));var i=Yn(r.asType("int32"),n),a=Yn(o.asType("int32"),n);return i.transpose().matMul(a).asType("int32")}}),qf=(Object.freeze({confusionMatrix:Vf}),rn({fromPixels_:function(t,e){if(void 0===e&&(e=3),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");var n=!1,r=!1,o=!1,i=!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)o=!0;else if("undefined"!=typeof HTMLImageElement&&t instanceof HTMLImageElement)i=!0;else{if(null==t.getContext)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(o&&o&&t.readyState<2)throw new Error("The video element has not loaded data yet. Please wait for `loadeddata` event on the <video> element.");if(null!=m("FromPixels",Pt.backendName))return Pt.runKernel("FromPixels",{pixels:t},{numChannels:e});var s,u,c=o?[t.videoWidth,t.videoHeight]:[t.width,t.height],l=c[0],f=c[1];if(a?s=t.getContext("2d").getImageData(0,0,l,f).data:r||n?s=t.data:(i||o)&&(null==Lf&&(Lf=document.createElement("canvas").getContext("2d")),Lf.canvas.width=l,Lf.canvas.height=f,Lf.drawImage(t,0,0,l,f),s=Lf.getImageData(0,0,l,f).data),4===e)u=new Int32Array(s);else{var h=l*f;u=new Int32Array(h*e);for(var p=0;p<h;p++)for(var d=0;d<e;++d)u[p*e+d]=s[4*p+d]}return pn(u,[f,l,e],"int32")}})),Gf=Object.freeze({toPixels:function(t,e){return s(this,void 0,void 0,(function(){var n,r,o,i,a,s,c,l,f,h,p,d,m,v,g,y,b,w,x,_,E,C,S;return u(this,(function(u){switch(u.label){case 0:if(n=Ge(t,"img","toPixels"),t instanceof yt||(n=n.toInt()),2!==n.rank&&3!==n.rank)throw new Error("toPixels only supports rank 2 or 3 tensors, got rank "+n.rank+".");if(r=n.shape.slice(0,2),o=r[0],i=r[1],(a=2===n.rank?1:n.shape[2])>4||2===a)throw new Error("toPixels only supports depth of size 1, 3 or 4 but got "+a);return[4,n.data()];case 1:return s=u.sent(),c=n.min(),l=n.max(),[4,Promise.all([c.data(),l.data()])];case 2:if(f=u.sent(),h=f[0],p=f[1],d=h[0],m=p[0],c.dispose(),l.dispose(),"float32"===n.dtype){if(d<0||m>1)throw new Error("Tensor values for a float32 Tensor must be in the range [0 - 1] but got range ["+d+" - "+m+"].")}else{if("int32"!==n.dtype)throw new Error("Unsupported type for toPixels: "+n.dtype+". Please use float32 or int32 tensors.");if(d<0||m>255)throw new Error("Tensor values for a int32 Tensor must be in the range [0 - 255] but got range ["+d+" - "+m+"].")}for(v="float32"===n.dtype?255:1,g=new Uint8ClampedArray(i*o*4),y=0;y<o*i;++y)b=void 0,w=void 0,x=void 0,_=void 0,1===a?(b=s[y]*v,w=s[y]*v,x=s[y]*v,_=255):3===a?(b=s[3*y]*v,w=s[3*y+1]*v,x=s[3*y+2]*v,_=255):4===a&&(b=s[4*y]*v,w=s[4*y+1]*v,x=s[4*y+2]*v,_=s[4*y+3]*v),g[0+(E=4*y)]=Math.round(b),g[E+1]=Math.round(w),g[E+2]=Math.round(x),g[E+3]=Math.round(_);return null!=e&&(e.width=i,e.height=o,C=e.getContext("2d"),S=new ImageData(g,i,o),C.putImageData(S,0,0)),n!==t&&n.dispose(),[2,g]}}))}))},fromPixels:qf}),Hf=function(){function t(){}return t.prototype.getClassName=function(){return this.constructor.className},t.fromConfig=function(t,e){return new t(e)},t}(),Xf=function(){function t(){this.classNameMap={}}return t.getMap=function(){return null==t.instance&&(t.instance=new t),t.instance},t.register=function(e){t.getMap().classNameMap[e.className]=[e,e.fromConfig]},t}();function Kf(t){C(null!=t.className,(function(){return"Class being registered does not have the static className property defined."})),C("string"==typeof t.className,(function(){return"className is required to be a string, but got type "+typeof t.className})),C(t.className.length>0,(function(){return"Class being registered has an empty-string as its className, which is disallowed."})),Xf.register(t)}Object.freeze({Serializable:Hf,SerializationMap:Xf,registerClass:Kf});function Yf(){return 32===Pt.backend.floatPrecision()?.001:.1}function $f(t,e,n){var r=!0;if((V(t)||V(e))&&(r=!1),V(t)&&V(e)&&(r=!0),r){var o=t.constructor.name,i=e.constructor.name;if(o!==i)throw new Error("Arrays are of different type. Actual: "+o+". Expected: "+i)}if(Array.isArray(t)&&Array.isArray(e)){var a=Ve(t),s=Ve(e);if(!O(a,s))throw new Error("Arrays have different shapes. Actual: ["+a+"]. Expected: ["+s+"]")}var u=V(t)?t:T(t),c=V(e)?e:T(e);if(u.length!==c.length)throw new Error("Arrays have different lengths actual: "+u.length+" vs expected: "+c.length+".\nActual: "+u+".\nExpected: "+c+".");for(var l=0;l<c.length;++l){var f=u[l],h=c[l];if(!n(f,h))throw new Error("Arrays differ: actual["+l+"] = "+f+", expected["+l+"] = "+h+".\nActual: "+u+".\nExpected: "+c+".")}}function Jf(t,e,n){return!isFinite(t)&&!isFinite(e)||!(isNaN(t)||isNaN(e)||Math.abs(t-e)>n)}Object.freeze({TEST_EPSILON_FLOAT16:.1,expectArraysClose:function(t,e,n){return null==n&&(n=Yf()),$f(t,e,(function(t,e){return Jf(t,e,n)}))},testEpsilon:Yf,expectPromiseToFail:function(t,e){t().then((function(){return e.fail()}),(function(){return e()}))},expectArraysEqual:function(t,e){var n="string"==typeof e||"number"==typeof e||"boolean"==typeof e?[e]:e;return H(t)||H(t[0])||H(e)||H(e[0])?$f(t,n,(function(t,e){return t==e})):$f(t,e,(function(t,e){return Jf(t,e,0)}))},expectNumbersClose:function(t,e,n){if(null==n&&(n=Yf()),!Jf(t,e,n))throw new Error("Numbers differ: actual === "+t+", expected === "+e)},expectValuesInRange:function(t,e,n){for(var r=0;r<t.length;r++)if(t[r]<e||t[r]>n)throw new Error("Value out of range:"+t[r]+" low: "+e+", high: "+n)},expectArrayBuffersEqual:function(t,e){expect(new Float32Array(t)).toEqual(new Float32Array(e))}}),Object.freeze({gpgpu_util:zi,webgl_util:Fe,forceHalfFloat:function(){f().set("WEBGL_FORCE_F16_TEXTURES",!0)},MathBackendWebGL:Ka,setWebGLContext:zt,GPGPUContext:Vi});var Qf=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return a(e,t),e.prototype.minimize=function(t,e,n){void 0===e&&(e=!1);var r=this.computeGradients(t,n),o=r.value,i=r.grads;if(null!=n){var a=n.map((function(t){return{name:t.name,tensor:i[t.name]}}));this.applyGradients(a)}else this.applyGradients(i);return We(i),e?o:(o.dispose(),null)},Object.defineProperty(e.prototype,"iterations",{get:function(){return null==this.iterations_&&(this.iterations_=0),this.iterations_},enumerable:!0,configurable:!0}),e.prototype.incrementIterations=function(){this.iterations_=this.iterations+1},e.prototype.computeGradients=function(t,e){return function(t,e){C($(t),(function(){return"The f passed in variableGrads(f) must be a function"})),C(null==e||Array.isArray(e)&&e.every((function(t){return t instanceof Ct})),(function(){return"The varList passed in variableGrads(f, varList) must be an array of variables"}));var n=null!=e;if(!n)for(var r in e=[],Pt.registeredVariables)e.push(Pt.registeredVariables[r]);var o=n?e.filter((function(t){return!t.trainable})):null,i=e.length;C((e=e.filter((function(t){return t.trainable}))).length>0,(function(){return"variableGrads() expects at least one of the input variables to be trainable, but none of the "+i+" variables is trainable."}));var a=Pt.gradients(t,e,null,!0),s=a.value,u=a.grads;C(u.some((function(t){return null!=t})),(function(){return"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()."})),C(0===s.rank,(function(){return"The f passed in variableGrads(f) must return a scalar, but it returned a rank-"+s.rank+" tensor"}));var c={};return e.forEach((function(t,e){null!=u[e]&&(c[t.name]=u[e])})),null!=o&&o.forEach((function(t){return c[t.name]=null})),{value:s,grads:c}}(t,e)},e.prototype.dispose=function(){null!=this.iterations_&&We(this.iterations_)},e.prototype.saveIterations=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){return null==this.iterations_&&(this.iterations_=0),[2,{name:"iter",tensor:ln(this.iterations_,"int32")}]}))}))},e.prototype.getWeights=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){throw new Error("getWeights() is not implemented for this optimizer yet.")}))}))},e.prototype.setWeights=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(t){throw new Error("setWeights() is not implemented for this optimizer class "+this.getClassName())}))}))},e.prototype.extractIterations=function(t){return s(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return e=this,[4,t[0].tensor.data()];case 1:return e.iterations_=n.sent()[0],[2,t.slice(1)]}}))}))},e}(Hf);Object.defineProperty(Qf,Symbol.hasInstance,{value:function(t){return null!=t.minimize&&null!=t.computeGradients&&null!=t.applyGradients}});var Zf=function(t){function e(e,n,r){void 0===r&&(r=null);var o=t.call(this)||this;return o.learningRate=e,o.rho=n,o.epsilon=r,o.accumulatedGrads=[],o.accumulatedUpdates=[],null==r&&(o.epsilon=Pt.backend.epsilon()),o}return a(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map((function(t){return t.name})):Object.keys(t)).forEach((function(n,r){var o=Pt.registeredVariables[n];null==e.accumulatedGrads[r]&&(e.accumulatedGrads[r]={originalName:n+"/accum_grad",variable:Ue((function(){return wn(o).variable(!1)}))}),null==e.accumulatedUpdates[r]&&(e.accumulatedUpdates[r]={originalName:n+"/accum_var",variable:Ue((function(){return wn(o).variable(!1)}))});var i=Array.isArray(t)?t[r].tensor:t[n];if(null!=i){var a=e.accumulatedGrads[r].variable,s=e.accumulatedUpdates[r].variable;Ue((function(){var t=a.mul(e.rho).add(i.square().mul(1-e.rho)),n=s.add(e.epsilon).sqrt().div(a.add(e.epsilon).sqrt()).mul(i),r=s.mul(e.rho).add(n.square().mul(1-e.rho));a.assign(t),s.assign(r);var u=n.mul(-e.learningRate).add(o);o.assign(u)}))}})),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedUpdates&&(We(this.accumulatedGrads.map((function(t){return t.variable}))),We(this.accumulatedUpdates.map((function(t){return t.variable}))))},e.prototype.getWeights=function(){return s(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t=this.accumulatedGrads.concat(this.accumulatedUpdates),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map((function(t){return{name:t.originalName,tensor:t.variable}})))]}}))}))},e.prototype.setWeights=function(t){return s(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return[4,this.extractIterations(t)];case 1:return t=n.sent(),e=t.length/2,this.accumulatedGrads=t.slice(0,e).map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),this.accumulatedUpdates=t.slice(e,2*e).map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),[2]}}))}))},e.prototype.getConfig=function(){return{learningRate:this.learningRate,rho:this.rho,epsilon:this.epsilon}},e.fromConfig=function(t,e){return new t(e.learningRate,e.rho,e.epsilon)},e.className="Adadelta",e}(Qf);Kf(Zf);var th=function(t){function e(e,n){void 0===n&&(n=.1);var r=t.call(this)||this;return r.learningRate=e,r.initialAccumulatorValue=n,r.accumulatedGrads=[],r}return a(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map((function(t){return t.name})):Object.keys(t)).forEach((function(n,r){var o=Pt.registeredVariables[n];null==e.accumulatedGrads[r]&&(e.accumulatedGrads[r]={originalName:n+"/accumulator",variable:Ue((function(){return gn(o.shape,e.initialAccumulatorValue).variable(!1)}))});var i=Array.isArray(t)?t[r].tensor:t[n];if(null!=i){var a=e.accumulatedGrads[r].variable;Ue((function(){var t=a.add(i.square());a.assign(t);var n=i.div(t.add(Pt.backend.epsilon()).sqrt()).mul(-e.learningRate).add(o);o.assign(n)}))}})),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedGrads&&We(this.accumulatedGrads.map((function(t){return t.variable})))},e.prototype.getWeights=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(this.accumulatedGrads.map((function(t){return{name:t.originalName,tensor:t.variable}})))]}}))}))},e.prototype.setWeights=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:return t=e.sent(),this.accumulatedGrads=t.map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),[2]}}))}))},e.prototype.getConfig=function(){return{learningRate:this.learningRate,initialAccumulatorValue:this.initialAccumulatorValue}},e.fromConfig=function(t,e){return new t(e.learningRate,e.initialAccumulatorValue)},e.className="Adagrad",e}(Qf);Kf(th);var eh=function(t){function e(e,n,r,o){void 0===o&&(o=null);var i=t.call(this)||this;return i.learningRate=e,i.beta1=n,i.beta2=r,i.epsilon=o,i.accumulatedFirstMoment=[],i.accumulatedSecondMoment=[],Ue((function(){i.accBeta1=ln(n).variable(),i.accBeta2=ln(r).variable()})),null==o&&(i.epsilon=Pt.backend.epsilon()),i}return a(e,t),e.prototype.applyGradients=function(t){var e=this,n=Array.isArray(t)?t.map((function(t){return t.name})):Object.keys(t);Ue((function(){var r=gu(1,e.accBeta1),o=gu(1,e.accBeta2);n.forEach((function(n,i){var a=Pt.registeredVariables[n];null==e.accumulatedFirstMoment[i]&&(e.accumulatedFirstMoment[i]={originalName:n+"/m",variable:Ue((function(){return wn(a).variable(!1)}))}),null==e.accumulatedSecondMoment[i]&&(e.accumulatedSecondMoment[i]={originalName:n+"/v",variable:Ue((function(){return wn(a).variable(!1)}))});var s=Array.isArray(t)?t[i].tensor:t[n];if(null!=s){var u=e.accumulatedFirstMoment[i].variable,c=e.accumulatedSecondMoment[i].variable,l=u.mul(e.beta1).add(s.mul(1-e.beta1)),f=c.mul(e.beta2).add(s.square().mul(1-e.beta2)),h=l.div(r),p=f.div(o);u.assign(l),c.assign(f);var d=h.div(p.sqrt().add(e.epsilon)).mul(-e.learningRate).add(a);a.assign(d)}})),e.accBeta1.assign(e.accBeta1.mul(e.beta1)),e.accBeta2.assign(e.accBeta2.mul(e.beta2))})),this.incrementIterations()},e.prototype.dispose=function(){this.accBeta1.dispose(),this.accBeta2.dispose(),null!=this.accumulatedFirstMoment&&We(this.accumulatedFirstMoment.map((function(t){return t.variable}))),null!=this.accumulatedSecondMoment&&We(this.accumulatedSecondMoment.map((function(t){return t.variable})))},e.prototype.getWeights=function(){return s(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t=this.accumulatedFirstMoment.concat(this.accumulatedSecondMoment),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map((function(t){return{name:t.originalName,tensor:t.variable}})))]}}))}))},e.prototype.setWeights=function(t){return s(this,void 0,void 0,(function(){var e,n=this;return u(this,(function(r){switch(r.label){case 0:return[4,this.extractIterations(t)];case 1:return t=r.sent(),Ue((function(){n.accBeta1.assign(du(n.beta1,n.iterations_+1)),n.accBeta2.assign(du(n.beta2,n.iterations_+1))})),e=t.length/2,this.accumulatedFirstMoment=t.slice(0,e).map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),this.accumulatedSecondMoment=t.slice(e,2*e).map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),[2]}}))}))},e.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon}},e.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon)},e.className="Adam",e}(Qf);Kf(eh);var nh=function(t){function e(e,n,r,o,i){void 0===o&&(o=null),void 0===i&&(i=0);var a=t.call(this)||this;return a.learningRate=e,a.beta1=n,a.beta2=r,a.epsilon=o,a.decay=i,a.accumulatedFirstMoment=[],a.accumulatedWeightedInfNorm=[],Ue((function(){a.iteration=ln(0).variable(),a.accBeta1=ln(n).variable()})),null==o&&(a.epsilon=Pt.backend.epsilon()),a}return a(e,t),e.prototype.applyGradients=function(t){var e=this,n=Array.isArray(t)?t.map((function(t){return t.name})):Object.keys(t);Ue((function(){var r=gu(1,e.accBeta1),o=nu(-e.learningRate,e.iteration.mul(e.decay).add(1));n.forEach((function(n,i){var a=Pt.registeredVariables[n];null==e.accumulatedFirstMoment[i]&&(e.accumulatedFirstMoment[i]={originalName:n+"/m",variable:wn(a).variable(!1)}),null==e.accumulatedWeightedInfNorm[i]&&(e.accumulatedWeightedInfNorm[i]={originalName:n+"/v",variable:wn(a).variable(!1)});var s=Array.isArray(t)?t[i].tensor:t[n];if(null!=s){var u=e.accumulatedFirstMoment[i].variable,c=e.accumulatedWeightedInfNorm[i].variable,l=u.mul(e.beta1).add(s.mul(1-e.beta1)),f=c.mul(e.beta2),h=s.abs(),p=f.maximum(h);u.assign(l),c.assign(p);var d=o.div(r).mul(l.div(p.add(e.epsilon))).add(a);a.assign(d)}})),e.iteration.assign(e.iteration.add(1)),e.accBeta1.assign(e.accBeta1.mul(e.beta1))})),this.incrementIterations()},e.prototype.dispose=function(){this.accBeta1.dispose(),this.iteration.dispose(),null!=this.accumulatedFirstMoment&&We(this.accumulatedFirstMoment.map((function(t){return t.variable}))),null!=this.accumulatedWeightedInfNorm&&We(this.accumulatedWeightedInfNorm.map((function(t){return t.variable})))},e.prototype.getWeights=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){throw new Error("getWeights() is not implemented for Adamax yet.")}))}))},e.prototype.setWeights=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(t){throw new Error("setWeights() is not implemented for Adamax yet.")}))}))},e.prototype.getConfig=function(){return{learningRate:this.learningRate,beta1:this.beta1,beta2:this.beta2,epsilon:this.epsilon,decay:this.decay}},e.fromConfig=function(t,e){return new t(e.learningRate,e.beta1,e.beta2,e.epsilon,e.decay)},e.className="Adamax",e}(Qf);Kf(nh);var rh=function(t){function e(e){var n=t.call(this)||this;return n.learningRate=e,n.setLearningRate(e),n}return a(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map((function(t){return t.name})):Object.keys(t)).forEach((function(n,r){var o=Array.isArray(t)?t[r].tensor:t[n];if(null!=o){var i=Pt.registeredVariables[n];Ue((function(){var t=e.c.mul(o).add(i);i.assign(t)}))}})),this.incrementIterations()},e.prototype.setLearningRate=function(t){this.learningRate=t,null!=this.c&&this.c.dispose(),this.c=function(t){return Pt.keep(t)}(ln(-t))},e.prototype.dispose=function(){this.c.dispose()},e.prototype.getWeights=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()]]}}))}))},e.prototype.setWeights=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:if(0!==(t=e.sent()).length)throw new Error("SGD optimizer does not have settable weights.");return[2]}}))}))},e.prototype.getConfig=function(){return{learningRate:this.learningRate}},e.fromConfig=function(t,e){return new t(e.learningRate)},e.className="SGD",e}(Qf);Kf(rh);var oh=function(t){function e(e,n,r){void 0===r&&(r=!1);var o=t.call(this,e)||this;return o.learningRate=e,o.momentum=n,o.useNesterov=r,o.accumulations=[],o.m=ln(o.momentum),o}return a(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map((function(t){return t.name})):Object.keys(t)).forEach((function(n,r){var o=Pt.registeredVariables[n];null==e.accumulations[r]&&(e.accumulations[r]={originalName:n+"/momentum",variable:Ue((function(){return wn(o).variable(!1)}))});var i=e.accumulations[r].variable,a=Array.isArray(t)?t[r].tensor:t[n];null!=a&&Ue((function(){var t,n=e.m.mul(i).add(a);t=e.useNesterov?e.c.mul(a.add(n.mul(e.m))).add(o):e.c.mul(n).add(o),i.assign(n),o.assign(t)}))})),this.incrementIterations()},e.prototype.dispose=function(){this.m.dispose(),null!=this.accumulations&&We(this.accumulations.map((function(t){return t.variable})))},e.prototype.setMomentum=function(t){this.momentum=t},e.prototype.getWeights=function(){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.saveIterations()];case 1:return[2,[t.sent()].concat(this.accumulations.map((function(t){return{name:t.originalName,tensor:t.variable}})))]}}))}))},e.prototype.setWeights=function(t){return s(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,this.extractIterations(t)];case 1:return t=e.sent(),this.accumulations=t.map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),[2]}}))}))},e.prototype.getConfig=function(){return{learningRate:this.learningRate,momentum:this.momentum,useNesterov:this.useNesterov}},e.fromConfig=function(t,e){return new t(e.learningRate,e.momentum,e.useNesterov)},e.className="Momentum",e}(rh);Kf(oh);var ih=function(t){function e(e,n,r,o,i){void 0===n&&(n=.9),void 0===r&&(r=0),void 0===o&&(o=null),void 0===i&&(i=!1);var a=t.call(this)||this;if(a.learningRate=e,a.decay=n,a.momentum=r,a.epsilon=o,a.accumulatedMeanSquares=[],a.accumulatedMoments=[],a.accumulatedMeanGrads=[],a.centered=i,null==o&&(a.epsilon=Pt.backend.epsilon()),null==e)throw new Error("learningRate for RMSPropOptimizer must be defined.");return a}return a(e,t),e.prototype.applyGradients=function(t){var e=this;(Array.isArray(t)?t.map((function(t){return t.name})):Object.keys(t)).forEach((function(n,r){var o=Pt.registeredVariables[n];null==e.accumulatedMeanSquares[r]&&(e.accumulatedMeanSquares[r]={originalName:n+"/rms",variable:Ue((function(){return wn(o).variable(!1)}))}),null==e.accumulatedMoments[r]&&(e.accumulatedMoments[r]={originalName:n+"/momentum",variable:Ue((function(){return wn(o).variable(!1)}))}),null==e.accumulatedMeanGrads[r]&&e.centered&&(e.accumulatedMeanGrads[r]={originalName:n+"/mg",variable:Ue((function(){return wn(o).variable(!1)}))});var i=Array.isArray(t)?t[r].tensor:t[n];if(null!=i){var a=e.accumulatedMeanSquares[r].variable,s=e.accumulatedMoments[r].variable;Ue((function(){var t=a.mul(e.decay).add(i.square().mul(1-e.decay));if(e.centered){var n=e.accumulatedMeanGrads[r].variable,u=n.mul(e.decay).add(i.mul(1-e.decay)),c=s.mul(e.momentum).add(i.mul(e.learningRate).div(t.sub(u.square().add(e.epsilon)).sqrt()));a.assign(t),n.assign(u),s.assign(c);var l=o.sub(c);o.assign(l)}else{var f=a.mul(e.decay).add(i.square().mul(1-e.decay));c=s.mul(e.momentum).add(i.mul(e.learningRate).div(f.add(e.epsilon).sqrt())),a.assign(f),s.assign(c),l=o.sub(c),o.assign(l)}}))}})),this.incrementIterations()},e.prototype.dispose=function(){null!=this.accumulatedMeanSquares&&We(this.accumulatedMeanSquares.map((function(t){return t.variable}))),null!=this.accumulatedMeanGrads&&this.centered&&We(this.accumulatedMeanGrads.map((function(t){return t.variable}))),null!=this.accumulatedMoments&&We(this.accumulatedMoments.map((function(t){return t.variable})))},e.prototype.getWeights=function(){return s(this,void 0,void 0,(function(){var t;return u(this,(function(e){switch(e.label){case 0:return t=this.accumulatedMeanSquares.concat(this.accumulatedMoments),this.centered&&t.push.apply(t,this.accumulatedMeanGrads),[4,this.saveIterations()];case 1:return[2,[e.sent()].concat(t.map((function(t){return{name:t.originalName,tensor:t.variable}})))]}}))}))},e.prototype.setWeights=function(t){return s(this,void 0,void 0,(function(){var e;return u(this,(function(n){switch(n.label){case 0:return[4,this.extractIterations(t)];case 1:return t=n.sent(),e=this.centered?t.length/3:t.length/2,this.accumulatedMeanSquares=t.slice(0,e).map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),this.accumulatedMoments=t.slice(e,2*e).map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}})),this.centered&&(this.accumulatedMeanGrads=t.slice(2*e,3*e).map((function(t){return{originalName:t.name,variable:t.tensor.variable(!1)}}))),[2]}}))}))},e.prototype.getConfig=function(){return{learningRate:this.learningRate,decay:this.decay,momentum:this.momentum,epsilon:this.epsilon,centered:this.centered}},e.fromConfig=function(t,e){return new t(e.learningRate,e.decay,e.momentum,e.epsilon,e.centered)},e.className="RMSProp",e}(Qf);Kf(ih);var ah=function(){function t(){}return t.sgd=function(t){return new rh(t)},t.momentum=function(t,e,n){return void 0===n&&(n=!1),new oh(t,e,n)},t.rmsprop=function(t,e,n,r,o){return void 0===e&&(e=.9),void 0===n&&(n=0),void 0===r&&(r=null),void 0===o&&(o=!1),new ih(t,e,n,r,o)},t.adam=function(t,e,n,r){return void 0===t&&(t=.001),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===r&&(r=null),new eh(t,e,n,r)},t.adadelta=function(t,e,n){return void 0===t&&(t=.001),void 0===e&&(e=.95),void 0===n&&(n=null),new Zf(t,e,n)},t.adamax=function(t,e,n,r,o){return void 0===t&&(t=.002),void 0===e&&(e=.9),void 0===n&&(n=.999),void 0===r&&(r=null),void 0===o&&(o=0),new nh(t,e,n,r,o)},t.adagrad=function(t,e){return void 0===e&&(e=.1),new th(t,e)},t}();ah.sgd,ah.momentum,ah.adadelta,ah.adagrad,ah.rmsprop,ah.adamax,ah.adam,"undefined"!=typeof requestAnimationFrame?requestAnimationFrame:"undefined"!=typeof setImmediate&&setImmediate;yt.prototype.squaredDifference=function(t){return Ja(this,t)},vt=Pl}).call(this,n(/*! ./../../../@umijs/deps/compiled/webpack/4/global.js */"IyRk"),n(/*! ./../../../node-libs-browser/mock/process.js */"Q2Ig"),n(/*! ./../../../node-libs-browser/node_modules/buffer/index.js */"HDXh").Buffer)},S6kV:
/*!********************************************!*\
!*** ./node_modules/crypto-js/mode-ofb.js ***!
\********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i;t.exports=(i=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),i.mode.OFB=(r=i.lib.BlockCipherMode.extend(),o=r.Encryptor=r.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize,o=this._iv,i=this._keystream;o&&(i=this._keystream=o.slice(0),this._iv=void 0),n.encryptBlock(i,0);for(var a=0;a<r;a++)t[e+a]^=i[a]}}),r.Decryptor=o,r),i.mode.OFB)},WYAk:
/*!****************************************!*\
!*** ./node_modules/crypto-js/hmac.js ***!
\****************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i,a;t.exports=(r=n(/*! ./core */"Ib8C"),i=(o=r).lib.Base,a=o.enc.Utf8,void(o.algo.HMAC=i.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=a.parse(e));var n=t.blockSize,r=4*n;e.sigBytes>r&&(e=t.finalize(e)),e.clamp();for(var o=this._oKey=e.clone(),i=this._iKey=e.clone(),s=o.words,u=i.words,c=0;c<n;c++)s[c]^=1549556828,u[c]^=909522486;o.sigBytes=i.sigBytes=r,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,n=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(n))}})))},bQjk:
/*!**********************************************!*\
!*** ./node_modules/crypto-js/format-hex.js ***!
\**********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i,a;t.exports=(a=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),o=(r=a).lib.CipherParams,i=r.enc.Hex,r.format.Hex={stringify:function(t){return t.ciphertext.toString(i)},parse:function(t){var e=i.parse(t);return o.create({ciphertext:e})}},a.format.Hex)},cv67:
/*!***************************************!*\
!*** ./node_modules/crypto-js/md5.js ***!
\***************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),function(t){var e=r,n=e.lib,o=n.WordArray,i=n.Hasher,a=e.algo,s=[];!function(){for(var e=0;e<64;e++)s[e]=4294967296*t.abs(t.sin(e+1))|0}();var u=a.MD5=i.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var n=0;n<16;n++){var r=e+n,o=t[r];t[r]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}var i=this._hash.words,a=t[e+0],u=t[e+1],p=t[e+2],d=t[e+3],m=t[e+4],v=t[e+5],g=t[e+6],y=t[e+7],b=t[e+8],w=t[e+9],x=t[e+10],_=t[e+11],E=t[e+12],C=t[e+13],S=t[e+14],k=t[e+15],T=i[0],I=i[1],O=i[2],R=i[3];T=c(T,I,O,R,a,7,s[0]),R=c(R,T,I,O,u,12,s[1]),O=c(O,R,T,I,p,17,s[2]),I=c(I,O,R,T,d,22,s[3]),T=c(T,I,O,R,m,7,s[4]),R=c(R,T,I,O,v,12,s[5]),O=c(O,R,T,I,g,17,s[6]),I=c(I,O,R,T,y,22,s[7]),T=c(T,I,O,R,b,7,s[8]),R=c(R,T,I,O,w,12,s[9]),O=c(O,R,T,I,x,17,s[10]),I=c(I,O,R,T,_,22,s[11]),T=c(T,I,O,R,E,7,s[12]),R=c(R,T,I,O,C,12,s[13]),O=c(O,R,T,I,S,17,s[14]),T=l(T,I=c(I,O,R,T,k,22,s[15]),O,R,u,5,s[16]),R=l(R,T,I,O,g,9,s[17]),O=l(O,R,T,I,_,14,s[18]),I=l(I,O,R,T,a,20,s[19]),T=l(T,I,O,R,v,5,s[20]),R=l(R,T,I,O,x,9,s[21]),O=l(O,R,T,I,k,14,s[22]),I=l(I,O,R,T,m,20,s[23]),T=l(T,I,O,R,w,5,s[24]),R=l(R,T,I,O,S,9,s[25]),O=l(O,R,T,I,d,14,s[26]),I=l(I,O,R,T,b,20,s[27]),T=l(T,I,O,R,C,5,s[28]),R=l(R,T,I,O,p,9,s[29]),O=l(O,R,T,I,y,14,s[30]),T=f(T,I=l(I,O,R,T,E,20,s[31]),O,R,v,4,s[32]),R=f(R,T,I,O,b,11,s[33]),O=f(O,R,T,I,_,16,s[34]),I=f(I,O,R,T,S,23,s[35]),T=f(T,I,O,R,u,4,s[36]),R=f(R,T,I,O,m,11,s[37]),O=f(O,R,T,I,y,16,s[38]),I=f(I,O,R,T,x,23,s[39]),T=f(T,I,O,R,C,4,s[40]),R=f(R,T,I,O,a,11,s[41]),O=f(O,R,T,I,d,16,s[42]),I=f(I,O,R,T,g,23,s[43]),T=f(T,I,O,R,w,4,s[44]),R=f(R,T,I,O,E,11,s[45]),O=f(O,R,T,I,k,16,s[46]),T=h(T,I=f(I,O,R,T,p,23,s[47]),O,R,a,6,s[48]),R=h(R,T,I,O,y,10,s[49]),O=h(O,R,T,I,S,15,s[50]),I=h(I,O,R,T,v,21,s[51]),T=h(T,I,O,R,E,6,s[52]),R=h(R,T,I,O,d,10,s[53]),O=h(O,R,T,I,x,15,s[54]),I=h(I,O,R,T,u,21,s[55]),T=h(T,I,O,R,b,6,s[56]),R=h(R,T,I,O,k,10,s[57]),O=h(O,R,T,I,g,15,s[58]),I=h(I,O,R,T,C,21,s[59]),T=h(T,I,O,R,m,6,s[60]),R=h(R,T,I,O,_,10,s[61]),O=h(O,R,T,I,p,15,s[62]),I=h(I,O,R,T,w,21,s[63]),i[0]=i[0]+T|0,i[1]=i[1]+I|0,i[2]=i[2]+O|0,i[3]=i[3]+R|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;n[o>>>5]|=128<<24-o%32;var i=t.floor(r/4294967296),a=r;n[15+(o+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),n[14+(o+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),e.sigBytes=4*(n.length+1),this._process();for(var s=this._hash,u=s.words,c=0;c<4;c++){var l=u[c];u[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,n,r,o,i,a){var s=t+(e&n|~e&r)+o+a;return(s<<i|s>>>32-i)+e}function l(t,e,n,r,o,i,a){var s=t+(e&r|n&~r)+o+a;return(s<<i|s>>>32-i)+e}function f(t,e,n,r,o,i,a){var s=t+(e^n^r)+o+a;return(s<<i|s>>>32-i)+e}function h(t,e,n,r,o,i,a){var s=t+(n^(e|~r))+o+a;return(s<<i|s>>>32-i)+e}e.MD5=i._createHelper(u),e.HmacMD5=i._createHmacHelper(u)}(Math),r.MD5)},e7zE:
/*!******************************************!*\
!*** ./node_modules/crypto-js/pbkdf2.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i,a,s,u,c,l,f;t.exports=(f=n(/*! ./core */"Ib8C"),n(/*! ./sha1 */"3y9D"),n(/*! ./hmac */"WYAk"),o=(r=f).lib,i=o.Base,a=o.WordArray,s=r.algo,u=s.SHA1,c=s.HMAC,l=s.PBKDF2=i.extend({cfg:i.extend({keySize:4,hasher:u,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var n=this.cfg,r=c.create(n.hasher,t),o=a.create(),i=a.create([1]),s=o.words,u=i.words,l=n.keySize,f=n.iterations;s.length<l;){var h=r.update(e).finalize(i);r.reset();for(var p=h.words,d=p.length,m=h,v=1;v<f;v++){m=r.finalize(m),r.reset();for(var g=m.words,y=0;y<d;y++)p[y]^=g[y]}o.concat(h),u[0]++}return o.sigBytes=4*l,o}}),r.PBKDF2=function(t,e,n){return l.create(n).compute(t,e)},f.PBKDF2)},"gb/T":
/*!********************************************!*\
!*** ./node_modules/crypto-js/mode-ecb.js ***!
\********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o;t.exports=(o=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),o.mode.ECB=((r=o.lib.BlockCipherMode.extend()).Encryptor=r.extend({processBlock:function(t,e){this._cipher.encryptBlock(t,e)}}),r.Decryptor=r.extend({processBlock:function(t,e){this._cipher.decryptBlock(t,e)}}),r),o.mode.ECB)},gctT:
/*!*********************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Exercise/AnswerCheck/index.tsx + 172 modules ***!
\*********************************************************************************/
/*! exports provided: default */
/*! all exports used */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@tensorflow/tfjs-core/dist/tf-core.esm.js (<- Module uses injected variables (global, process, Buffer)) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectSpread2.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/helpers/esm/slicedToArray.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/@umijs/babel-preset-umi/node_modules/@babel/runtime/regenerator/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/CheckPeople/index.less?modules (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/pages/Classrooms/Lists/Exercise/AnswerCheck/index.less?modules (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./src/.umi-production/core/umiExports.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/components/UploadFile/index.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./src/service/exercise.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/fetch.ts */
/*! ModuleConcatenation bailout: Cannot concat with ./src/utils/util.tsx */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/tslib/tslib.es6.js because of ./node_modules/checkapi.js/build/es6/env/createNodejsEnv.js */
/*! ModuleConcatenation bailout: Cannot concat with ./src/assets/images/checkPeople.jpg (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/ali-oss/dist/aliyun-oss-sdk.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/button/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/col/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/message/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/modal/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/row/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/spin/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/spin/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/statistic/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/statistic/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/steps/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/antd/es/steps/style/index.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/checkapi.js/build/es6/env/createFileSystem.js because of ./node_modules/checkapi.js/build/es6/env/createNodejsEnv.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/checkapi.js/build/es6/env/createNodejsEnv.js (<- Module uses injected variables (global)) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/checkapi.js/build/es6/env/isNodejs.js (<- Module uses injected variables (global, process)) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/lodash/lodash.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/qrcode.react/lib/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react-router/esm/react-router.js */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/react/index.js (<- Module is not an ECMAScript module) */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/uuid/dist/esm-browser/v4.js */function(t,e,n){"use strict";n.r(e);var r={};n.r(r),n.d(r,"drawContour",(function(){return O})),n.d(r,"drawDetections",(function(){return _t})),n.d(r,"drawFaceExpressions",(function(){return se})),n.d(r,"DrawBoxOptions",(function(){return wt})),n.d(r,"DrawBox",(function(){return xt})),n.d(r,"DrawFaceLandmarksOptions",(function(){return le})),n.d(r,"DrawFaceLandmarks",(function(){return fe})),n.d(r,"drawFaceLandmarks",(function(){return he})),n.d(r,"AnchorPosition",(function(){return dt})),n.d(r,"DrawTextFieldOptions",(function(){return yt})),n.d(r,"DrawTextField",(function(){return bt}));n("2qtc");var o=n("kLXV"),i=(n("14J3"),n("BMrR")),a=(n("jCWc"),n("kPKH")),s=(n("+L6B"),n("2/Rp")),u=(n("miYZ"),n("tsqr")),c=n("k1fw"),l=n("9og8"),f=n("tJVT"),h=n("PpiC"),p=(n("FJo9"),n("L41K")),d=(n("aHsQ"),n("sGsY")),m=n("WmNS"),v=n.n(m),g=n("q1tI"),y=n.n(g),b=n("Ty5D"),w=n("9kvl"),x=n("yPBj"),_=n.n(x),E=n("1vsH"),C=n("V0Rq"),S=n("D1Df"),k=n.n(S),T=(n("T2oS"),n("W9HT")),I=n("Re/O");function O(t,e,n){if(void 0===n&&(n=!1),t.beginPath(),e.slice(1).forEach((function(n,r){var o=n.x,i=n.y,a=e[r];t.moveTo(a.x,a.y),t.lineTo(o,i)})),n){var r=e[e.length-1],o=e[0];if(!r||!o)return;t.moveTo(r.x,r.y),t.lineTo(o.x,o.y)}t.stroke()}var R=n("mrSG"),A=function(){function t(t,e){if(!U(t)||!U(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 D(t,e){return t instanceof I.a&&t.shape.length===e}function N(t){return D(t,3)}function P(t){return D(t,4)}function M(t){return t%2==0}function j(t,e){void 0===e&&(e=2);var n=Math.pow(10,e);return Math.floor(t*n)/n}function F(t){return t&&t.width&&t.height}function B(t){return t.reduce((function(t,e){return t.add(e)}),new z(0,0)).div(new z(t.length,t.length))}function L(t,e,n){return Array(t).fill(0).map((function(t,r){return e+r*n}))}function U(t){return!!t&&t!==1/0&&t!==-1/0&&!isNaN(t)||0===t}function W(t){return U(t)&&0<=t&&t<=1}var z=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}(),V=function(){function t(e,n){void 0===n&&(n=!0);var r=e||{},o=[r.left,r.top,r.right,r.bottom].every(U),i=[r.x,r.y,r.width,r.height].every(U);if(!i&&!o)throw new Error("Box.constructor - expected box to be IBoundingBox | IRect, instead have "+JSON.stringify(r));var a=i?[r.x,r.y,r.width,r.height]:[r.left,r.top,r.right-r.left,r.bottom-r.top],s=a[0],u=a[1],c=a[2],l=a[3];t.assertIsValidBox({x:s,y:u,width:c,height:l},"Box.constructor",n),this._x=s,this._y=u,this._width=c,this._height=l}return t.isRect=function(t){return!!t&&[t.x,t.y,t.width,t.height].every(U)},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 z(this.left,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topRight",{get:function(){return new z(this.right,this.top)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomLeft",{get:function(){return new z(this.left,this.bottom)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bottomRight",{get:function(){return new z(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,o=this.height,i=Math.abs(r-o);return r<o&&(e-=i/2,r+=i),o<r&&(n-=i/2,o+=i),new t({x:e,y:n,width:r,height:o})},t.prototype.rescale=function(e){var n=F(e)?e.width:e,r=F(e)?e.height:e;return new t({x:this.x*n,y:this.y*r,width:this.width*n,height:this.height*r})},t.prototype.pad=function(e,n){var r=[this.x-e/2,this.y-n/2,this.width+e,this.height+n];return new t({x:r[0],y:r[1],width:r[2],height:r[3]})},t.prototype.clipAtImageBorders=function(e,n){var r=this.x,o=this.y,i=this.right,a=this.bottom,s=Math.max(r,0),u=Math.max(o,0),c=i-s,l=a-u;return new t({x:s,y:u,width:Math.min(c,e-s),height:Math.min(l,n-u)}).floor()},t.prototype.shift=function(e,n){var r=this.width,o=this.height;return new t({x:this.x+e,y:this.y+n,width:r,height:o})},t.prototype.padAtBorders=function(t,e){var n=this.width+1,r=this.height+1,o=n,i=r,a=this.left,s=this.top,u=this.right,c=this.bottom;return u>e&&(o=-u+e+n,u=e),c>t&&(i=-c+t+r,c=t),a<1&&(i=2-a,a=1),s<1&&(i=2-s,s=1),{dy:1,edy:i,dx:1,edx:o,y:s,ey:c,x:a,ex:u,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}(),q=function(t){function e(e,n,r,o,i){return void 0===i&&(i=!1),t.call(this,{left:e,top:n,right:r,bottom:o},i)||this}return Object(R.c)(e,t),e}(V),G=function(){function t(t,e,n,r,o){this._imageDims=new A(o.width,o.height),this._score=t,this._classScore=e,this._className=n,this._box=new V(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 V(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}(),H=function(t){function e(e,n,r){return t.call(this,e,e,"",n,r)||this}return Object(R.c)(e,t),e.prototype.forSize=function(n,r){var o=t.prototype.forSize.call(this,n,r);return new e(o.score,o.relativeBox,o.imageDims)},e}(G);function X(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 K(t,e,n,r){void 0===r&&(r=!0);for(var o=e.map((function(t,e){return{score:t,boxIndex:e}})).sort((function(t,e){return t.score-e.score})).map((function(t){return t.boxIndex})),i=[],a=function(){var e=o.pop();i.push(e);for(var a=o,s=[],u=0;u<a.length;u++){var c=a[u],l=t[e],f=t[c];s.push(X(l,f,r))}o=o.filter((function(t,e){return s[e]<=n}))};o.length>0;)a();return i}function Y(t,e){return I.L((function(){var n=e[0],r=e[1],o=e[2],i=I.n(Object(R.e)(t.shape.slice(0,3),[1]),n),a=I.n(Object(R.e)(t.shape.slice(0,3),[1]),r),s=I.n(Object(R.e)(t.shape.slice(0,3),[1]),o),u=I.h([i,a,s],3);return I.F(t,u)}))}function $(t){return 1/(1+Math.exp(-t))}var J=function(t){function e(e,n,r,o,i){return void 0===i&&(i=!1),t.call(this,{x:e,y:n,width:r,height:o},i)||this}return Object(R.c)(e,t),e}(V),Q=function(){function t(t,e,n){void 0===n&&(n=new z(0,0));var r=e.width,o=e.height;this._imgDims=new A(r,o),this._shift=n,this._positions=t.map((function(t){return t.mul(new z(r,o)).add(n)}))}return Object.defineProperty(t.prototype,"shift",{get:function(){return new z(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 z(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 z(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 H?t.box.floor():new V(t);return this.shiftBy(n.x,n.y).align(null,e)}var r=Object.assign({},{useDlibAlignment:!1,minBoxPadding:.2},e),o=r.useDlibAlignment,i=r.minBoxPadding;return o?this.alignDlib():this.alignMinBbox(i)},t.prototype.alignDlib=function(){var t=this.getRefPointsForAlignment(),e=t[0],n=t[1],r=t[2],o=function(t){return r.sub(t).magnitude()},i=(o(e)+o(n))/2,a=Math.floor(i/.45),s=B(t),u=Math.floor(Math.max(0,s.x-.5*a)),c=Math.floor(Math.max(0,s.y-.43*a));return new J(u,c,Math.min(a,this.imageWidth+u),Math.min(a,this.imageHeight+c))},t.prototype.alignMinBbox=function(t){var e,n,r,o,i,a,s,u=(e=this.positions,n=e.map((function(t){return t.x})),r=e.map((function(t){return t.y})),o=n.reduce((function(t,e){return e<t?e:t}),1/0),i=r.reduce((function(t,e){return e<t?e:t}),1/0),a=n.reduce((function(t,e){return t<e?e:t}),0),s=r.reduce((function(t,e){return t<e?e:t}),0),new q(o,i,a,s));return u.pad(u.width*t,u.height*t)},t.prototype.getRefPointsForAlignment=function(){throw new Error("getRefPointsForAlignment not implemented by base class")},t}(),Z=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.getRefPointsForAlignment=function(){var t=this.positions;return[t[0],t[1],B([t[3],t[4]])]},e}(Q),tt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.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(B)},e}(Q),et=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?" ("+j(this.distance)+")":"")},t}(),nt=function(t){function e(e,n){var r=t.call(this,e)||this;return r._label=n,r}return Object(R.c)(e,t),e.assertIsValidLabeledBox=function(t,e){if(V.assertIsValidBox(t,e),!U(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}(V),rt=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}();!function(t){function e(e,n,r,o){var i=t.call(this,e,n)||this;return i._score=r,i._classScore=o,i}Object(R.c)(e,t),e.assertIsValidPredictedBox=function(t,e){if(nt.assertIsValidLabeledBox(t,e),!W(t.score)||!W(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})}(nt);function ot(t){return t.detection instanceof H}function it(t,e){var n={detection:e};return Object.assign({},t,n)}function at(){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 st=n("rOjP"),ut=n("oX8U");function ct(){return"object"==typeof window&&"undefined"!=typeof document&&"undefined"!=typeof HTMLImageElement&&"undefined"!=typeof HTMLCanvasElement&&"undefined"!=typeof HTMLVideoElement&&"undefined"!=typeof ImageData&&"undefined"!=typeof CanvasRenderingContext2D}var lt,ft=n("8KZw");function ht(t){lt=t}function pt(){ct()&&ht(at()),Object(ft.a)()&&ht(Object(ut.a)())}var dt,mt={getEnv:function(){if(!lt)throw new Error("getEnv - environment is not defined, check isNodejs() and isBrowser()");return lt},setEnv:ht,initialize:pt,createBrowserEnv:at,createFileSystem:st.a,createNodejsEnv:ut.a,monkeyPatch:function(t){if(lt||pt(),!lt)throw new Error("monkeyPatch - environment is not defined, check isNodejs() and isBrowser()");var e=t.Canvas,n=void 0===e?lt.Canvas:e,r=t.Image,o=void 0===r?lt.Image:r;lt.Canvas=n,lt.Image=o,lt.createCanvasElement=t.createCanvasElement||function(){return new n},lt.createImageElement=t.createImageElement||function(){return new o},lt.ImageData=t.ImageData||lt.ImageData,lt.Video=t.Video||lt.Video,lt.fetch=t.fetch||lt.fetch,lt.readFile=t.readFile||lt.readFile},isBrowser:ct,isNodejs:ft.a};function vt(t){return mt.isNodejs()||"string"!=typeof t?t:document.getElementById(t)}function gt(t){var e=mt.getEnv(),n=e.Canvas;if(t instanceof e.CanvasRenderingContext2D)return t;var r=vt(t);if(!(r instanceof n))throw new Error("resolveContext2d - expected canvas to be of instance of Canvas");var o=r.getContext("2d");if(!o)throw new Error("resolveContext2d - canvas 2d context is null");return o}pt(),function(t){t.TOP_LEFT="TOP_LEFT",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_LEFT="BOTTOM_LEFT",t.BOTTOM_RIGHT="BOTTOM_RIGHT"}(dt||(dt={}));var yt=function(t){void 0===t&&(t={});var e=t.anchorPosition,n=t.backgroundColor,r=t.fontColor,o=t.fontSize,i=t.fontStyle,a=t.padding;this.anchorPosition=e||dt.TOP_LEFT,this.backgroundColor=n||"rgba(0, 0, 0, 0.5)",this.fontColor=r||"rgba(255, 255, 255, 1)",this.fontSize=o||14,this.fontStyle=i||"Georgia",this.padding=a||4},bt=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 yt(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<e?e:t}),0)+2*e},t.prototype.measureHeight=function(){var t=this.options,e=t.fontSize,n=t.padding;return this.text.length*e+2*n},t.prototype.getUpperLeft=function(t,e){var n=this.options.anchorPosition,r=n===dt.BOTTOM_RIGHT||n===dt.TOP_RIGHT,o=n===dt.BOTTOM_LEFT||n===dt.BOTTOM_RIGHT,i=this.measureWidth(t),a=this.measureHeight(),s=r?this.anchor.x-i:this.anchor.x,u=o?this.anchor.y-a:this.anchor.y;if(e){var c=e.width,l=e.height;return{x:Math.max(Math.min(s,c-i),0),y:Math.max(Math.min(u,l-a),0)}}return{x:s,y:u}},t.prototype.draw=function(t){var e=vt(t),n=gt(e),r=this.options,o=r.backgroundColor,i=r.fontColor,a=r.fontSize,s=r.fontStyle,u=r.padding;n.font=a+"px "+s;var c=this.measureWidth(n),l=this.measureHeight();n.fillStyle=o;var f=this.getUpperLeft(n,e);n.fillRect(f.x,f.y,c,l),n.fillStyle=i,this.text.forEach((function(t,e){var r=u+f.x,o=u+f.y+(e+1)*a;n.fillText(t,r,o)}))},t}(),wt=function(t){void 0===t&&(t={});var e=t.boxColor,n=t.lineWidth,r=t.label,o=t.drawLabelOptions;this.boxColor=e||"rgba(0, 0, 255, 1)",this.lineWidth=n||2,this.label=r;var i={anchorPosition:dt.BOTTOM_LEFT,backgroundColor:this.boxColor};this.drawLabelOptions=new yt(Object.assign({},i,o))},xt=function(){function t(t,e){void 0===e&&(e={}),this.box=new V(t),this.options=new wt(e)}return t.prototype.draw=function(t){var e=gt(t),n=this.options,r=n.boxColor,o=n.lineWidth,i=this.box,a=i.x,s=i.y,u=i.width,c=i.height;e.strokeStyle=r,e.lineWidth=o,e.strokeRect(a,s,u,c);var l=this.options.label;l&&new bt([l],{x:a-o/2,y:s},this.options.drawLabelOptions).draw(t)},t}();function _t(t,e){(Array.isArray(e)?e:[e]).forEach((function(e){var n=e instanceof H?e.score:ot(e)?e.detection.score:void 0,r=e instanceof H?e.box:ot(e)?e.detection.box:new V(e),o=n?""+j(n):void 0;new xt(r,{label:o}).draw(t)}))}function Et(t){var e=mt.getEnv(),n=e.Image,r=e.Video;return t instanceof n&&t.complete||t instanceof r&&t.readyState>=3}function Ct(t){var e=mt.getEnv(),n=e.Image,r=e.Video;return t instanceof n?new A(t.naturalWidth,t.naturalHeight):t instanceof r?new A(t.videoWidth,t.videoHeight):new A(t.width,t.height)}function St(t){var e=t.width,n=t.height,r=(0,mt.getEnv().createCanvasElement)();return r.width=e,r.height=n,r}function kt(t,e){var n=mt.getEnv().ImageData;if(!(t instanceof n||Et(t)))throw new Error("createCanvasFromMedia - media has not finished loading yet");var r=e||Ct(t),o=r.width,i=r.height,a=St({width:o,height:i});return t instanceof n?gt(a).putImageData(t,0,0):gt(a).drawImage(t,0,0,o,i),a}function Tt(t,e){return Object(R.b)(this,void 0,void 0,(function(){var n,r,o,i,a,s;return Object(R.d)(this,(function(u){switch(u.label){case 0:return n=e||mt.getEnv().createCanvasElement(),r=t.shape.slice(P(t)?1:0),o=r[0],i=r[1],a=r[2],s=I.L((function(){return t.as3D(o,i,a).toInt()})),[4,I.f.toPixels(s,n)];case 1:return u.sent(),s.dispose(),[2,n]}}))}))}function It(t){var e=mt.getEnv(),n=e.Image,r=e.Canvas,o=e.Video;return t instanceof n||t instanceof r||t instanceof o}var Ot=function(){function t(t,e){var n=this;if(void 0===e&&(e=!1),this._imageTensors=[],this._canvases=[],this._treatAsBatchInput=!1,this._inputDimensions=[],!Array.isArray(t))throw new Error("NetInput.constructor - expected inputs to be an Array of TResolvedNetInput or to be instanceof tf.Tensor4D, instead have "+t);this._treatAsBatchInput=e,this._batchSize=t.length,t.forEach((function(t,e){if(N(t))return n._imageTensors[e]=t,void(n._inputDimensions[e]=t.shape);if(P(t)){var r=t.shape[0];if(1!==r)throw new Error("NetInput - tf.Tensor4D with batchSize "+r+" passed, but not supported in input array");return n._imageTensors[e]=t,void(n._inputDimensions[e]=t.shape.slice(1))}var o=t instanceof mt.getEnv().Canvas?t:kt(t);n._canvases[e]=o,n._inputDimensions[e]=[o.height,o.width,3]}))}return Object.defineProperty(t.prototype,"imageTensors",{get:function(){return this._imageTensors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"canvases",{get:function(){return this._canvases},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBatchInput",{get:function(){return this.batchSize>1||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 L(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 function(t,e){var n=t.width,r=t.height,o=e/Math.max(r,n);return new A(Math.round(n*o),Math.round(r*o))}({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,I.L((function(){var r=L(n.batchSize,0,1).map((function(r){var o=n.getInput(r);if(o instanceof I.a){var i=P(o)?o:o.expandDims();return(i=function(t,e){return void 0===e&&(e=!1),I.L((function(){var n=t.shape.slice(1),r=n[0],o=n[1];if(r===o)return t;var i=Math.abs(r-o),a=Math.round(i*(e?.5:1)),s=r>o?2:1,u=function(e){var n=t.shape.slice();return n[s]=e,I.n(n,0)},c=u(a),l=i-c.shape[s],f=[e&&l?u(l):null,t,c].filter((function(t){return!!t})).map((function(t){return t.toFloat()}));return I.h(f,s)}))}(i,e)).shape[1]===t&&i.shape[2]===t||(i=I.o.resizeBilinear(i,[t,t])),i.as3D(t,t,3)}if(o instanceof mt.getEnv().Canvas)return I.f.fromPixels(function(t,e,n){void 0===n&&(n=!1);var r=mt.getEnv(),o=r.Image,i=r.Canvas;if(!(t instanceof o||t instanceof i))throw new Error("imageToSquare - expected arg0 to be HTMLImageElement | HTMLCanvasElement");var a=Ct(t),s=e/Math.max(a.height,a.width),u=s*a.width,c=s*a.height,l=St({width:e,height:e}),f=t instanceof i?t:kt(t),h=Math.abs(u-c)/2,p=n&&u<c?h:0,d=n&&c<u?h:0;return gt(l).drawImage(f,p,d,u,c),l}(o,t,e));throw new Error("toBatchTensor - at batchIdx "+r+", expected input to be instanceof tf.Tensor or instanceof HTMLCanvasElement, instead have "+o)}));return I.E(r.map((function(t){return t.toFloat()}))).as4D(n.batchSize,t,t,3)}))},t}();function Rt(t){return Object(R.b)(this,void 0,void 0,(function(){var e,n,r;return Object(R.d)(this,(function(o){switch(o.label){case 0:if(t instanceof Ot)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(vt)).forEach((function(t,r){if(!It(t)&&!N(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 o=t.shape[0];if(1!==o)throw new Error("toNetInput -"+n(r)+" tf.Tensor4D with batchSize "+o+" passed, but not supported in input array")}})),[4,Promise.all(r.map((function(t){return It(t)&&(e=t,new Promise((function(t,n){if(e instanceof mt.getEnv().Canvas||Et(e))return t();function r(e){e.currentTarget&&(e.currentTarget.removeEventListener("load",r),e.currentTarget.removeEventListener("error",o),t(e))}function o(t){t.currentTarget&&(t.currentTarget.removeEventListener("load",r),t.currentTarget.removeEventListener("error",o),n(t))}e.addEventListener("load",r),e.addEventListener("error",o)})));var e})))];case 1:return o.sent(),[2,new Ot(r,Array.isArray(t))]}}))}))}function At(t,e){return Object(R.b)(this,void 0,void 0,(function(){var n,r,o,i,a,s;return Object(R.d)(this,(function(u){switch(u.label){case 0:return n=mt.getEnv().Canvas,r=t,t instanceof n?[3,5]:[4,Rt(t)];case 1:if((o=u.sent()).batchSize>1)throw new Error("extractFaces - batchSize > 1 not supported");return(i=o.getInput(0))instanceof n?(a=i,[3,4]):[3,2];case 2:return[4,Tt(i)];case 3:a=u.sent(),u.label=4;case 4:r=a,u.label=5;case 5:return s=gt(r),[2,e.map((function(t){return t instanceof H?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,o=t.height,i=St({width:r,height:o});return gt(i).putImageData(s.getImageData(e,n,r,o),0,0),i}))]}}))}))}function Dt(t,e){return Object(R.b)(this,void 0,void 0,(function(){return Object(R.d)(this,(function(n){if(!N(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,I.L((function(){var n=t.shape.slice(P(t)?1:0),r=n[0],o=n[1],i=n[2];return e.map((function(t){return t instanceof H?t.forSize(o,r).box:t})).map((function(t){return t.clipAtImageBorders(o,r)})).map((function(e){var n=e.x,a=e.y,s=e.width,u=e.height;return I.C(t.as3D(r,o,i),[a,n,0],[u,s,i])}))}))]}))}))}function Nt(t,e){return Object(R.b)(this,void 0,void 0,(function(){var n;return Object(R.d)(this,(function(r){switch(r.label){case 0:return[4,(0,mt.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 Pt(t){return Object(R.b)(this,void 0,void 0,(function(){return Object(R.d)(this,(function(e){switch(e.label){case 0:return[4,Nt(t)];case 1:return[2,e.sent().json()]}}))}))}function Mt(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://":"",o=(t=t.replace(r,"")).split("/").filter((function(t){return t})),i=t.endsWith(".json")?o[o.length-1]:n,a=r+(t.endsWith(".json")?o.slice(0,o.length-1):o).join("/");return{modelBaseUri:a=t.startsWith("/")?"/"+a:a,manifestUri:"/"===a?"/"+i:a+"/"+i}}function jt(t,e){return Object(R.b)(this,void 0,void 0,(function(){var n,r,o,i;return Object(R.d)(this,(function(a){switch(a.label){case 0:return n=Mt(t,e),r=n.manifestUri,o=n.modelBaseUri,[4,Pt(r)];case 1:return i=a.sent(),[2,I.p.loadWeights(i,o)]}}))}))}var Ft=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,o=n.objProp;r[o].dispose(),r[o]=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 I.b}))},t.prototype.getFrozenParams=function(){return this.getParamList().filter((function(t){return!(t.tensor instanceof I.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,o=I.G(r.dataSync());r.dispose(),t.reassignParamFromPath(n,o)}))},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(R.b)(this,void 0,void 0,(function(){return Object(R.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(R.b)(this,void 0,void 0,(function(){var e;return Object(R.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,jt(t,this.getDefaultModelName())];case 1:return e=n.sent(),this.loadFromWeightMap(e),[2]}}))}))},t.prototype.loadFromDisk=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e,n,r,o,i,a,s,u,c,l;return Object(R.d)(this,(function(f){switch(f.label){case 0:if(t&&"string"!=typeof t)throw new Error(this._name+".loadFromDisk - expected model file path");return e=mt.getEnv().readFile,n=Mt(t,this.getDefaultModelName()),r=n.manifestUri,o=n.modelBaseUri,i=function(t){return Promise.all(t.map((function(t){return e(t).then((function(t){return t.buffer}))})))},a=I.p.weightsLoaderFactory(i),c=(u=JSON).parse,[4,e(r)];case 1:return s=c.apply(u,[f.sent().toString()]),[4,a(s,o)];case 2:return l=f.sent(),this.loadFromWeightMap(l),[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 I.a))throw new Error("traversePropertyPath - parameter is not a tensor, for path "+t);return{obj:n,objProp:r}},t}();function Bt(t,e,n){return I.L((function(){var r=I.z(t,e.depthwise_filter,e.pointwise_filter,n,"same");return r=I.c(r,e.bias)}))}function Lt(t,e,n){return void 0===n&&(n=!1),I.L((function(){var r=I.w(n?I.c(I.i(t,e.conv0.filters,[2,2],"same"),e.conv0.bias):Bt(t,e.conv0,[2,2])),o=Bt(r,e.conv1,[1,1]),i=Bt(I.w(I.c(r,o)),e.conv2,[1,1]);return I.w(I.c(r,I.c(o,i)))}))}function Ut(t,e,n,r){return void 0===n&&(n=!1),void 0===r&&(r=!0),I.L((function(){var o=I.w(n?I.c(I.i(t,e.conv0.filters,r?[2,2]:[1,1],"same"),e.conv0.bias):Bt(t,e.conv0,r?[2,2]:[1,1])),i=Bt(o,e.conv1,[1,1]),a=Bt(I.w(I.c(o,i)),e.conv2,[1,1]),s=Bt(I.w(I.c(o,I.c(i,a))),e.conv3,[1,1]);return I.w(I.c(o,I.c(i,I.c(a,s))))}))}function Wt(t,e,n,r){return void 0===n&&(n="same"),void 0===r&&(r=!1),I.L((function(){var o=I.c(I.i(t,e.filters,[1,1],n),e.bias);return r?I.w(o):o}))}function zt(t,e){Object.keys(t).forEach((function(n){e.some((function(t){return t.originalPath===n}))||t[n].dispose()}))}function Vt(t,e){return function(n,r,o,i){var a=I.K(t(n*r*o*o),[o,o,n,r]),s=I.H(t(r));return e.push({paramPath:i+"/filters"},{paramPath:i+"/bias"}),{filters:a,bias:s}}}function qt(t,e){return function(n,r,o){var i=I.I(t(n*r),[n,r]),a=I.H(t(r));return e.push({paramPath:o+"/weights"},{paramPath:o+"/bias"}),{weights:i,bias:a}}}var Gt=function(t,e,n){this.depthwise_filter=t,this.pointwise_filter=e,this.bias=n};function Ht(t,e){return function(n,r,o){var i=I.K(t(9*n),[3,3,n,1]),a=I.K(t(n*r),[1,1,n,r]),s=I.H(t(r));return e.push({paramPath:o+"/depthwise_filter"},{paramPath:o+"/pointwise_filter"},{paramPath:o+"/bias"}),new Gt(i,a,s)}}function Xt(t){return function(e){var n=t(e+"/depthwise_filter",4),r=t(e+"/pointwise_filter",4),o=t(e+"/bias",1);return new Gt(n,r,o)}}function Kt(t,e){return function(n,r,o){var i=t[n];if(!D(i,r))throw new Error("expected weightMap["+n+"] to be a Tensor"+r+"D, instead have "+i);return e.push({originalPath:n,paramPath:o||n}),i}}function Yt(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 $t(t,e){var n=Vt(t,e),r=Ht(t,e);function o(t,e,o,i){return void 0===i&&(i=!1),{conv0:i?n(t,e,3,o+"/conv0"):r(t,e,o+"/conv0"),conv1:r(e,e,o+"/conv1"),conv2:r(e,e,o+"/conv2")}}return{extractDenseBlock3Params:o,extractDenseBlock4Params:function(t,e,n,i){void 0===i&&(i=!1);var a=o(t,e,n,i);return{conv0:a.conv0,conv1:a.conv1,conv2:a.conv2,conv3:r(e,e,n+"/conv3")}}}}function Jt(t){return function(e){return{filters:t(e+"/filters",4),bias:t(e+"/bias",1)}}}function Qt(t,e){var n=Kt(t,e),r=Jt(n),o=Xt(n);return{extractDenseBlock3Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?r(t+"/conv0"):o(t+"/conv0"),conv1:o(t+"/conv1"),conv2:o(t+"/conv2")}},extractDenseBlock4Params:function(t,e){return void 0===e&&(e=!1),{conv0:e?r(t+"/conv0"):o(t+"/conv0"),conv1:o(t+"/conv1"),conv2:o(t+"/conv2"),conv3:o(t+"/conv3")}}}}var Zt=function(t){function e(){return t.call(this,"FaceFeatureExtractor")||this}return Object(R.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("FaceFeatureExtractor - load model before inference");return I.L((function(){var n=Ut(Y(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(I.y(255)),e.dense0,!0);return n=Ut(n,e.dense1),n=Ut(n,e.dense2),n=Ut(n,e.dense3),n=I.d(n,[7,7],[2,2],"valid")}))},e.prototype.forward=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return e=this.forwardInput,[4,Rt(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=Qt(t,e).extractDenseBlock4Params,r={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2"),dense3:n("dense3")};return zt(t,e),{params:r,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=Yt(t),r=n.extractWeights,o=n.getRemainingWeights,i=$t(r,e).extractDenseBlock4Params,a=i(3,32,"dense0",!0),s=i(32,64,"dense1"),u=i(64,128,"dense2"),c=i(128,256,"dense3");if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:e,params:{dense0:a,dense1:s,dense2:u,dense3:c}}}(t)},e}(Ft);function te(t,e){return I.L((function(){return I.c(I.q(t,e.weights),e.bias)}))}function ee(t){var e={},n={};return Object.keys(t).forEach((function(r){(r.startsWith("fc")?n:e)[r]=t[r]})),{featureExtractorMap:e,classifierMap:n}}var ne=function(t){function e(e,n){var r=t.call(this,e)||this;return r._faceFeatureExtractor=n,r}return Object(R.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 I.L((function(){var r=t instanceof Ot?e.faceFeatureExtractor.forwardInput(t):t;return te(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=[],o=Yt(t),i=o.extractWeights,a=o.getRemainingWeights,s=qt(i,r)(e,n,"fc");if(0!==a().length)throw new Error("weights remaing after extract: "+a().length);return{paramMappings:r,params:{fc:s}}}(t,this.getClassifierChannelsIn(),this.getClassifierChannelsOut())},e.prototype.extractParamsFromWeigthMap=function(t){var e=ee(t),n=e.featureExtractorMap,r=e.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(n),function(t){var e,n=[],r=Kt(t,n),o={fc:(e="fc",{weights:r(e+"/weights",2),bias:r(e+"/bias",1)})};return zt(t,n),{params:o,paramMappings:n}}(r)},e.prototype.extractParams=function(t){var e=this.getClassifierChannelsIn(),n=this.getClassifierChannelsOut(),r=n*e+n,o=t.slice(0,t.length-r),i=t.slice(t.length-r);return this.faceFeatureExtractor.extractWeights(o),this.extractClassifierParams(i)},e}(Ft),re=["neutral","happy","sad","angry","fearful","disgusted","surprised"],oe=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);re.forEach((function(n,r){e[n]=t[r]}))}return t.prototype.asSortedArray=function(){var t=this;return re.map((function(e){return{expression:e,probability:t[e]}})).sort((function(t,e){return e.probability-t.probability}))},t}(),ie=function(t){function e(e){return void 0===e&&(e=new Zt),t.call(this,"FaceExpressionNet",e)||this}return Object(R.c)(e,t),e.prototype.forwardInput=function(t){var e=this;return I.L((function(){return I.D(e.runNet(t))}))},e.prototype.forward=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return e=this.forwardInput,[4,Rt(t)];case 1:return[2,e.apply(this,[n.sent()])]}}))}))},e.prototype.predictExpressions=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e,n,r,o,i=this;return Object(R.d)(this,(function(a){switch(a.label){case 0:return[4,Rt(t)];case 1:return e=a.sent(),[4,this.forwardInput(e)];case 2:return n=a.sent(),[4,Promise.all(I.O(n).map((function(t){return Object(R.b)(i,void 0,void 0,(function(){var e;return Object(R.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=a.sent(),n.dispose(),o=r.map((function(t){return new oe(t)})),[2,e.isBatchInput?o:o[0]]}}))}))},e.prototype.getDefaultModelName=function(){return"face_expression_model"},e.prototype.getClassifierChannelsIn=function(){return 256},e.prototype.getClassifierChannelsOut=function(){return 7},e}(ne);function ae(t,e){var n={expressions:e};return Object.assign({},t,n)}function se(t,e,n,r){void 0===n&&(n=.1),(Array.isArray(e)?e:[e]).forEach((function(e){var o=e instanceof oe?e:e.expressions instanceof oe?e.expressions:void 0;if(!o)throw new Error("drawFaceExpressions - expected faceExpressions to be FaceExpressions | WithFaceExpressions<{}> or array thereof");var i=o.asSortedArray().filter((function(t){return t.probability>n})),a=ot(e)?e.detection.box.bottomLeft:r||new z(0,0);new bt(i.map((function(t){return t.expression+" ("+j(t.probability)+")"})),a).draw(t)}))}function ue(t){return ot(t)&&t.landmarks instanceof Q&&t.unshiftedLandmarks instanceof Q&&t.alignedRect instanceof H}function ce(t,e){var n=t.detection.box,r=e.shiftBy(n.x,n.y),o=r.align(),i=t.detection.imageDims,a={landmarks:r,unshiftedLandmarks:e,alignedRect:new H(t.detection.score,o.rescale(i.reverse()),i)};return Object.assign({},t,a)}var le=function(t){void 0===t&&(t={});var e=t.drawLines,n=void 0===e||e,r=t.drawPoints,o=void 0===r||r,i=t.lineWidth,a=t.lineColor,s=t.pointSize,u=t.pointColor;this.drawLines=n,this.drawPoints=o,this.lineWidth=i||1,this.pointSize=s||2,this.lineColor=a||"rgba(0, 255, 255, 1)",this.pointColor=u||"rgba(255, 0, 255, 1)"},fe=function(){function t(t,e){void 0===e&&(e={}),this.faceLandmarks=t,this.options=new le(e)}return t.prototype.draw=function(t){var e=gt(t),n=this.options,r=n.drawLines,o=n.drawPoints,i=n.lineWidth,a=n.lineColor,s=n.pointSize,u=n.pointColor;if(r&&this.faceLandmarks instanceof tt&&(e.strokeStyle=a,e.lineWidth=i,O(e,this.faceLandmarks.getJawOutline()),O(e,this.faceLandmarks.getLeftEyeBrow()),O(e,this.faceLandmarks.getRightEyeBrow()),O(e,this.faceLandmarks.getNose()),O(e,this.faceLandmarks.getLeftEye(),!0),O(e,this.faceLandmarks.getRightEye(),!0),O(e,this.faceLandmarks.getMouth(),!0)),o){e.strokeStyle=u,e.fillStyle=u;this.faceLandmarks.positions.forEach((function(t){e.beginPath(),e.arc(t.x,t.y,s,0,2*Math.PI),e.fill()}))}},t}();function he(t,e){(Array.isArray(e)?e:[e]).forEach((function(e){var n=e instanceof Q?e:ue(e)?e.landmarks:void 0;if(!n)throw new Error("drawFaceLandmarks - expected faceExpressions to be FaceLandmarks | WithFaceLandmarks<WithFaceDetection<{}>> or array thereof");new fe(n).draw(t)}))}function pe(t,e){var n=[],r=Yt(t),o=r.extractWeights,i=r.getRemainingWeights,a=function(t,e){var n=Vt(t,e),r=Ht(t,e);return{extractConvParams:n,extractSeparableConvParams:r,extractReductionBlockParams:function(t,e,o){return{separable_conv0:r(t,e,o+"/separable_conv0"),separable_conv1:r(e,e,o+"/separable_conv1"),expansion_conv:n(t,e,1,o+"/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")}}}}(o,n),s=a.extractConvParams,u=a.extractSeparableConvParams,c=a.extractReductionBlockParams,l=a.extractMainBlockParams,f={conv_in:s(3,32,3,"entry_flow/conv_in"),reduction_block_0:c(32,64,"entry_flow/reduction_block_0"),reduction_block_1:c(64,128,"entry_flow/reduction_block_1")},h={};L(e,0,1).forEach((function(t){h["main_block_"+t]=l(128,"middle_flow/main_block_"+t)}));var p={reduction_block:c(128,256,"exit_flow/reduction_block"),separable_conv:u(256,512,"exit_flow/separable_conv")};if(0!==i().length)throw new Error("weights remaing after extract: "+i().length);return{paramMappings:n,params:{entry_flow:f,middle_flow:h,exit_flow:p}}}function de(t,e){var n=[],r=function(t,e){var n=Kt(t,e),r=Jt(n),o=Xt(n);return{extractConvParams:r,extractSeparableConvParams:o,extractReductionBlockParams:function(t){return{separable_conv0:o(t+"/separable_conv0"),separable_conv1:o(t+"/separable_conv1"),expansion_conv:r(t+"/expansion_conv")}},extractMainBlockParams:function(t){return{separable_conv0:o(t+"/separable_conv0"),separable_conv1:o(t+"/separable_conv1"),separable_conv2:o(t+"/separable_conv2")}}}}(t,n),o=r.extractConvParams,i=r.extractSeparableConvParams,a=r.extractReductionBlockParams,s=r.extractMainBlockParams,u={conv_in:o("entry_flow/conv_in"),reduction_block_0:a("entry_flow/reduction_block_0"),reduction_block_1:a("entry_flow/reduction_block_1")},c={};L(e,0,1).forEach((function(t){c["main_block_"+t]=s("middle_flow/main_block_"+t)}));var l={reduction_block:a("exit_flow/reduction_block"),separable_conv:i("exit_flow/separable_conv")};return zt(t,n),{params:{entry_flow:u,middle_flow:c,exit_flow:l},paramMappings:n}}function me(t,e,n){return I.c(I.i(t,e.filters,n,"same"),e.bias)}function ve(t,e,n){void 0===n&&(n=!0);var r=n?I.w(t):t;return r=Bt(r,e.separable_conv0,[1,1]),r=Bt(I.w(r),e.separable_conv1,[1,1]),r=I.s(r,[3,3],[2,2],"same"),r=I.c(r,me(t,e.expansion_conv,[2,2]))}var ge,ye=function(t){function e(e){var n=t.call(this,"TinyXception")||this;return n._numMainBlocks=e,n}return Object(R.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 I.L((function(){var r=Y(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(I.y(256)),o=I.w(me(r,n.entry_flow.conv_in,[2,2]));return o=ve(o,n.entry_flow.reduction_block_0,!1),o=ve(o,n.entry_flow.reduction_block_1),L(e._numMainBlocks,0,1).forEach((function(t){o=function(t,e){var n=Bt(I.w(t),e.separable_conv0,[1,1]);return n=Bt(I.w(n),e.separable_conv1,[1,1]),n=Bt(I.w(n),e.separable_conv2,[1,1]),n=I.c(n,t)}(o,n.middle_flow["main_block_"+t])})),o=ve(o,n.exit_flow.reduction_block),o=I.w(Bt(o,n.exit_flow.separable_conv,[1,1]))}))},e.prototype.forward=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return e=this.forwardInput,[4,Rt(t)];case 1:return[2,e.apply(this,[n.sent()])]}}))}))},e.prototype.getDefaultModelName=function(){return"tiny_xception_model"},e.prototype.extractParamsFromWeigthMap=function(t){return de(t,this._numMainBlocks)},e.prototype.extractParams=function(t){return pe(t,this._numMainBlocks)},e}(Ft);!function(t){t.FEMALE="female",t.MALE="male"}(ge||(ge={}));var be=function(t){function e(e){void 0===e&&(e=new ye(2));var n=t.call(this,"AgeGenderNet")||this;return n._faceFeatureExtractor=e,n}return Object(R.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 I.L((function(){var r=t instanceof Ot?e.faceFeatureExtractor.forwardInput(t):t,o=I.d(r,[7,7],[2,2],"valid").as2D(r.shape[0],-1);return{age:te(o,n.fc.age).as1D(),gender:te(o,n.fc.gender)}}))},e.prototype.forwardInput=function(t){var e=this;return I.L((function(){var n=e.runNet(t),r=n.age,o=n.gender;return{age:r,gender:I.D(o)}}))},e.prototype.forward=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return e=this.forwardInput,[4,Rt(t)];case 1:return[2,e.apply(this,[n.sent()])]}}))}))},e.prototype.predictAgeAndGender=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e,n,r,o,i,a,s=this;return Object(R.d)(this,(function(u){switch(u.label){case 0:return[4,Rt(t)];case 1:return e=u.sent(),[4,this.forwardInput(e)];case 2:return n=u.sent(),r=I.O(n.age),o=I.O(n.gender),i=r.map((function(t,e){return{ageTensor:t,genderTensor:o[e]}})),[4,Promise.all(i.map((function(t){var e=t.ageTensor,n=t.genderTensor;return Object(R.b)(s,void 0,void 0,(function(){var t,r,o,i,a;return Object(R.d)(this,(function(s){switch(s.label){case 0:return[4,e.data()];case 1:return t=s.sent()[0],[4,n.data()];case 2:return r=s.sent()[0],i=(o=r>.5)?ge.MALE:ge.FEMALE,a=o?r:1-r,e.dispose(),n.dispose(),[2,{age:t,gender:i,genderProbability:a}]}}))}))})))];case 3:return a=u.sent(),n.age.dispose(),n.gender.dispose(),[2,e.isBatchInput?a:a[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=Yt(t),r=n.extractWeights,o=n.getRemainingWeights,i=qt(r,e),a=i(512,1,"fc/age"),s=i(512,2,"fc/gender");if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:e,params:{fc:{age:a,gender:s}}}}(t)},e.prototype.extractParamsFromWeigthMap=function(t){var e=ee(t),n=e.featureExtractorMap,r=e.classifierMap;return this.faceFeatureExtractor.loadFromWeightMap(n),function(t){var e=[],n=Kt(t,e);function r(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}var o={fc:{age:r("fc/age"),gender:r("fc/gender")}};return zt(t,e),{params:o,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}(Ft),we=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.postProcess=function(t,e,n){var r=n.map((function(t){var n=t.width,r=t.height,o=e/Math.max(r,n);return{width:n*o,height:r*o}})),o=r.length;return I.L((function(){var n=function(t,e){return I.E([I.n([68],t),I.n([68],e)],1).as2D(1,136).as1D()},i=function(t,e){var n=r[t],o=n.width,i=n.height;return e(o,i)?Math.abs(o-i)/2:0};return t.mul(I.n([o,136],e)).sub(I.E(Array.from(Array(o),(function(t,e){return n(function(t){return i(t,(function(t,e){return t<e}))}(e),function(t){return i(t,(function(t,e){return e<t}))}(e))})))).div(I.E(Array.from(Array(o),(function(t,e){return n(r[e].width,r[e].height)}))))}))},e.prototype.forwardInput=function(t){var e=this;return I.L((function(){var n=e.runNet(t);return e.postProcess(n,t.inputSize,t.inputDimensions.map((function(t){return{height:t[0],width:t[1]}})))}))},e.prototype.forward=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return e=this.forwardInput,[4,Rt(t)];case 1:return[2,e.apply(this,[n.sent()])]}}))}))},e.prototype.detectLandmarks=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e,n,r,o=this;return Object(R.d)(this,(function(i){switch(i.label){case 0:return[4,Rt(t)];case 1:return e=i.sent(),n=I.L((function(){return I.O(o.forwardInput(e))})),[4,Promise.all(n.map((function(t,n){return Object(R.b)(o,void 0,void 0,(function(){var r,o,i,a,s;return Object(R.d)(this,(function(u){switch(u.label){case 0:return i=(o=Array).from,[4,t.data()];case 1:return r=i.apply(o,[u.sent()]),a=r.filter((function(t,e){return M(e)})),s=r.filter((function(t,e){return!M(e)})),[2,new tt(Array(68).fill(0).map((function(t,e){return new z(a[e],s[e])})),{height:e.getInputHeight(n),width:e.getInputWidth(n)})]}}))}))})))];case 2:return r=i.sent(),n.forEach((function(t){return t.dispose()})),[2,e.isBatchInput?r:r[0]]}}))}))},e.prototype.getClassifierChannelsOut=function(){return 136},e}(ne),xe=function(t){function e(e){return void 0===e&&(e=new Zt),t.call(this,"FaceLandmark68Net",e)||this}return Object(R.c)(e,t),e.prototype.getDefaultModelName=function(){return"face_landmark_68_model"},e.prototype.getClassifierChannelsIn=function(){return 256},e}(we);var _e=function(t){function e(){return t.call(this,"TinyFaceFeatureExtractor")||this}return Object(R.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("TinyFaceFeatureExtractor - load model before inference");return I.L((function(){var n=Lt(Y(t.toBatchTensor(112,!0),[122.782,117.001,104.298]).div(I.y(255)),e.dense0,!0);return n=Lt(n,e.dense1),n=Lt(n,e.dense2),n=I.d(n,[14,14],[2,2],"valid")}))},e.prototype.forward=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return e=this.forwardInput,[4,Rt(t)];case 1:return[2,e.apply(this,[n.sent()])]}}))}))},e.prototype.getDefaultModelName=function(){return"face_feature_extractor_tiny_model"},e.prototype.extractParamsFromWeigthMap=function(t){return function(t){var e=[],n=Qt(t,e).extractDenseBlock3Params,r={dense0:n("dense0",!0),dense1:n("dense1"),dense2:n("dense2")};return zt(t,e),{params:r,paramMappings:e}}(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=Yt(t),r=n.extractWeights,o=n.getRemainingWeights,i=$t(r,e).extractDenseBlock3Params,a=i(3,32,"dense0",!0),s=i(32,64,"dense1"),u=i(64,128,"dense2");if(0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{paramMappings:e,params:{dense0:a,dense1:s,dense2:u}}}(t)},e}(Ft),Ee=function(t){function e(e){return void 0===e&&(e=new _e),t.call(this,"FaceLandmark68TinyNet",e)||this}return Object(R.c)(e,t),e.prototype.getDefaultModelName=function(){return"face_landmark_68_tiny_model"},e.prototype.getClassifierChannelsIn=function(){return 128},e}(we);!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}Object(R.c)(e,t)}(xe);function Ce(t,e,n,r,o){void 0===o&&(o="same");var i=e.conv,a=i.filters,s=i.bias,u=I.i(t,a,n,o);return u=function(t,e){return I.c(I.t(t,e.weights),e.biases)}(u=I.c(u,s),e.scale),r?I.w(u):u}function Se(t,e){return Ce(t,e,[1,1],!1)}function ke(t,e){return Ce(t,e,[2,2],!0,"valid")}function Te(t,e){function n(n,r,o,i){var a=function(e,n,r){var o=t(e),i=o.length/(n*r*r);if(i%1!=0)throw new Error("depth has to be an integer: "+i+", weights.length: "+o.length+", numFilters: "+n+", filterSize: "+r);return I.L((function(){return I.N(I.K(o,[n,i,r,r]),[2,3,1,0])}))}(n,r,o),s=I.H(t(r));return e.push({paramPath:i+"/filters"},{paramPath:i+"/bias"}),{filters:a,bias:s}}function r(r,o,i,a){return{conv:n(r,o,i,a+"/conv"),scale:function(n,r){var o=I.H(t(n)),i=I.H(t(n));return e.push({paramPath:r+"/weights"},{paramPath:r+"/biases"}),{weights:o,biases:i}}(o,a+"/scale")}}return{extractConvLayerParams:r,extractResidualLayerParams:function(t,e,n,o,i){return void 0===i&&(i=!1),{conv1:r((i?.5:1)*t,e,n,o+"/conv1"),conv2:r(t,e,n,o+"/conv2")}}}}function Ie(t,e){var n=Kt(t,e);function r(t){return{conv:{filters:n(t+"/conv/filters",4),bias:n(t+"/conv/bias",1)},scale:function(t){return{weights:n(t+"/scale/weights",1),biases:n(t+"/scale/biases",1)}}(t)}}return{extractConvLayerParams:r,extractResidualLayerParams:function(t){return{conv1:r(t+"/conv1"),conv2:r(t+"/conv2")}}}}function Oe(t){var e=[],n=Ie(t,e),r=n.extractConvLayerParams,o=n.extractResidualLayerParams,i=r("conv32_down"),a=o("conv32_1"),s=o("conv32_2"),u=o("conv32_3"),c=o("conv64_down"),l=o("conv64_1"),f=o("conv64_2"),h=o("conv64_3"),p=o("conv128_down"),d=o("conv128_1"),m=o("conv128_2"),v=o("conv256_down"),g=o("conv256_1"),y=o("conv256_2"),b=o("conv256_down_out"),w=t.fc;if(e.push({originalPath:"fc",paramPath:"fc"}),!D(w,2))throw new Error("expected weightMap[fc] to be a Tensor2D, instead have "+w);var x={conv32_down:i,conv32_1:a,conv32_2:s,conv32_3:u,conv64_down:c,conv64_1:l,conv64_2:f,conv64_3:h,conv128_down:p,conv128_1:d,conv128_2:m,conv256_down:v,conv256_1:g,conv256_2:y,conv256_down_out:b,fc:w};return zt(t,e),{params:x,paramMappings:e}}function Re(t,e){var n=function(t,e){return Ce(t,e,[1,1],!0)}(t,e.conv1);return n=Se(n,e.conv2),n=I.c(n,t),n=I.w(n)}function Ae(t,e){var n=ke(t,e.conv1);n=Se(n,e.conv2);var r=I.d(t,2,2,"valid"),o=I.P(r.shape),i=r.shape[3]!==n.shape[3];if(r.shape[1]!==n.shape[1]||r.shape[2]!==n.shape[2]){var a=Object(R.e)(n.shape);a[1]=1;var s=I.P(a);n=I.h([n,s],1);var u=Object(R.e)(n.shape);u[2]=1;var c=I.P(u);n=I.h([n,c],2)}return r=i?I.h([r,o],3):r,n=I.c(r,n),n=I.w(n)}var De=function(t){function e(){return t.call(this,"FaceRecognitionNet")||this}return Object(R.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("FaceRecognitionNet - load model before inference");return I.L((function(){var n=ke(Y(t.toBatchTensor(150,!0).toFloat(),[122.782,117.001,104.298]).div(I.y(256)),e.conv32_down);n=Re(n=I.s(n,3,2,"valid"),e.conv32_1),n=Re(n,e.conv32_2),n=Re(n,e.conv32_3),n=Re(n=Ae(n,e.conv64_down),e.conv64_1),n=Re(n,e.conv64_2),n=Re(n,e.conv64_3),n=Re(n=Ae(n,e.conv128_down),e.conv128_1),n=Re(n,e.conv128_2),n=Re(n=Ae(n,e.conv256_down),e.conv256_1);var r=(n=Ae(n=Re(n,e.conv256_2),e.conv256_down_out)).mean([1,2]);return I.q(r,e.fc)}))},e.prototype.forward=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return e=this.forwardInput,[4,Rt(t)];case 1:return[2,e.apply(this,[n.sent()])]}}))}))},e.prototype.computeFaceDescriptor=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e,n,r,o=this;return Object(R.d)(this,(function(i){switch(i.label){case 0:return[4,Rt(t)];case 1:return e=i.sent(),n=I.L((function(){return I.O(o.forwardInput(e))})),[4,Promise.all(n.map((function(t){return t.data()})))];case 2:return r=i.sent(),n.forEach((function(t){return t.dispose()})),[2,e.isBatchInput?r:r[0]]}}))}))},e.prototype.getDefaultModelName=function(){return"face_recognition_model"},e.prototype.extractParamsFromWeigthMap=function(t){return Oe(t)},e.prototype.extractParams=function(t){return function(t){var e=Yt(t),n=e.extractWeights,r=e.getRemainingWeights,o=[],i=Te(n,o),a=i.extractConvLayerParams,s=i.extractResidualLayerParams,u=a(4704,32,7,"conv32_down"),c=s(9216,32,3,"conv32_1"),l=s(9216,32,3,"conv32_2"),f=s(9216,32,3,"conv32_3"),h=s(36864,64,3,"conv64_down",!0),p=s(36864,64,3,"conv64_1"),d=s(36864,64,3,"conv64_2"),m=s(36864,64,3,"conv64_3"),v=s(147456,128,3,"conv128_down",!0),g=s(147456,128,3,"conv128_1"),y=s(147456,128,3,"conv128_2"),b=s(589824,256,3,"conv256_down",!0),w=s(589824,256,3,"conv256_1"),x=s(589824,256,3,"conv256_2"),_=s(589824,256,3,"conv256_down_out"),E=I.L((function(){return I.N(I.I(n(32768),[128,256]),[1,0])}));if(o.push({paramPath:"fc"}),0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{params:{conv32_down:u,conv32_1:c,conv32_2:l,conv32_3:f,conv64_down:h,conv64_1:p,conv64_2:d,conv64_3:m,conv128_down:v,conv128_1:g,conv128_2:y,conv256_down:b,conv256_1:w,conv256_2:x,conv256_down_out:_,fc:E},paramMappings:o}}(t)},e}(Ft);function Ne(t,e){var n={descriptor:e};return Object.assign({},t,n)}function Pe(t,e){var n={age:e};return Object.assign({},t,n)}function Me(t,e,n){var r={gender:e,genderProbability:n};return Object.assign({},t,r)}var je=function(){function t(t){var e=void 0===t?{}:t,n=e.minFaceSize,r=e.scaleFactor,o=e.maxNumScales,i=e.scoreThresholds,a=e.scaleSteps;if(this._name="MtcnnOptions",this._minFaceSize=n||20,this._scaleFactor=r||.709,this._maxNumScales=o||10,this._scoreThresholds=i||[.6,.7,.7],this._scaleSteps=a,"number"!=typeof this._minFaceSize||this._minFaceSize<0)throw new Error(this._name+" - expected minFaceSize to be a number > 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 Fe(t,e){function n(n,r,o,i,a){var s=I.K(t(n*r*o*o),[o,o,n,r]),u=I.H(t(r));return e.push({paramPath:i+"/filters"},{paramPath:i+"/"+(a?"batch_norm_offset":"bias")}),{filters:s,bias:u}}function r(t,e,r,o){var i=n(t,e,r,o,!0);return{filters:i.filters,batch_norm_offset:i.bias}}function o(n,o,i){return{depthwise_conv:function(n,r){var o=I.K(t(9*n),[3,3,n,1]),i=I.H(t(n)),a=I.H(t(n)),s=I.H(t(n)),u=I.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:o,batch_norm_scale:i,batch_norm_offset:a,batch_norm_mean:s,batch_norm_variance:u}}(n,i+"/depthwise_conv"),pointwise_conv:r(n,o,1,i+"/pointwise_conv")}}return{extractMobilenetV1Params:function(){return{conv_0:r(3,32,3,"mobilenetv1/conv_0"),conv_1:o(32,64,"mobilenetv1/conv_1"),conv_2:o(64,128,"mobilenetv1/conv_2"),conv_3:o(128,128,"mobilenetv1/conv_3"),conv_4:o(128,256,"mobilenetv1/conv_4"),conv_5:o(256,256,"mobilenetv1/conv_5"),conv_6:o(256,512,"mobilenetv1/conv_6"),conv_7:o(512,512,"mobilenetv1/conv_7"),conv_8:o(512,512,"mobilenetv1/conv_8"),conv_9:o(512,512,"mobilenetv1/conv_9"),conv_10:o(512,512,"mobilenetv1/conv_10"),conv_11:o(512,512,"mobilenetv1/conv_11"),conv_12:o(512,1024,"mobilenetv1/conv_12"),conv_13:o(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 Be(t){var e=[],n=function(t,e){var n=Kt(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 o(t){var e="mobilenetv1/conv_"+t,o="MobilenetV1/Conv2d_"+t+"_depthwise",i=e+"/depthwise_conv",a=e+"/pointwise_conv";return{depthwise_conv:{filters:n(o+"/depthwise_weights",4,i+"/filters"),batch_norm_scale:n(o+"/BatchNorm/gamma",1,i+"/batch_norm_scale"),batch_norm_offset:n(o+"/BatchNorm/beta",1,i+"/batch_norm_offset"),batch_norm_mean:n(o+"/BatchNorm/moving_mean",1,i+"/batch_norm_mean"),batch_norm_variance:n(o+"/BatchNorm/moving_variance",1,i+"/batch_norm_variance")},pointwise_conv:r("MobilenetV1",t,a)}}function i(t,e){return{filters:n(t+"/weights",4,e+"/filters"),bias:n(t+"/biases",1,e+"/bias")}}function a(t){return{box_encoding_predictor:i("Prediction/BoxPredictor_"+t+"/BoxEncodingPredictor","prediction_layer/box_predictor_"+t+"/box_encoding_predictor"),class_predictor:i("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:o(1),conv_2:o(2),conv_3:o(3),conv_4:o(4),conv_5:o(5),conv_6:o(6),conv_7:o(7),conv_8:o(8),conv_9:o(9),conv_10:o(10),conv_11:o(11),conv_12:o(12),conv_13:o(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:a(0),box_predictor_1:a(1),box_predictor_2:a(2),box_predictor_3:a(3),box_predictor_4:a(4),box_predictor_5:a(5)}}}}(t,e),r=n.extractMobilenetV1Params,o=n.extractPredictionLayerParams,i=t["Output/extra_dim"];if(e.push({originalPath:"Output/extra_dim",paramPath:"output_layer/extra_dim"}),!N(i))throw new Error("expected weightMap['Output/extra_dim'] to be a Tensor3D, instead have "+i);var a={mobilenetv1:r(),prediction_layer:o(),output_layer:{extra_dim:i}};return zt(t,e),{params:a,paramMappings:e}}function Le(t,e,n){return I.L((function(){var r=I.i(t,e.filters,n,"same");return r=I.c(r,e.batch_norm_offset),I.g(r,0,6)}))}function Ue(t,e){return I.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 o=e+1,i=function(t){return[2,4,6,12].some((function(e){return e===t}))?[2,2]:[1,1]}(o);r=Le(r=function(t,e,n){return I.L((function(){var r=I.j(t,e.filters,n,"same");return r=I.e(r,e.batch_norm_mean,e.batch_norm_variance,e.batch_norm_offset,e.batch_norm_scale,.0010000000474974513),I.g(r,0,6)}))}(r,t.depthwise_conv,i),t.pointwise_conv,[1,1]),11===o&&(n=r)})),null===n)throw new Error("mobileNetV1 - output of conv layer 11 is null");return{out:r,conv11:n}}))}function We(t,e,n){var r=t.arraySync(),o=Math.min(r[e][0],r[e][2]),i=Math.min(r[e][1],r[e][3]),a=Math.max(r[e][0],r[e][2]),s=Math.max(r[e][1],r[e][3]),u=Math.min(r[n][0],r[n][2]),c=Math.min(r[n][1],r[n][3]),l=Math.max(r[n][0],r[n][2]),f=Math.max(r[n][1],r[n][3]),h=(a-o)*(s-i),p=(l-u)*(f-c);if(h<=0||p<=0)return 0;var d=Math.max(o,u),m=Math.max(i,c),v=Math.min(a,l),g=Math.min(s,f),y=Math.max(v-d,0)*Math.max(g-m,0);return y/(h+p-y)}function ze(t,e){var n=function(t){var e=I.O(I.N(t,[1,0])),n=[I.F(e[2],e[0]),I.F(e[3],e[1])];return{sizes:n,centers:[I.c(e[0],I.k(n[0],I.y(2))),I.c(e[1],I.k(n[1],I.y(2)))]}}(t),r=n.sizes,o=n.centers,i=I.O(I.N(e,[1,0])),a=I.k(I.t(I.l(I.k(i[2],I.y(5))),r[0]),I.y(2)),s=I.c(I.t(I.k(i[0],I.y(10)),r[0]),o[0]),u=I.k(I.t(I.l(I.k(i[3],I.y(5))),r[1]),I.y(2)),c=I.c(I.t(I.k(i[1],I.y(10)),r[1]),o[1]);return I.N(I.E([I.F(s,a),I.F(c,u),I.c(s,a),I.c(c,u)]),[1,0])}function Ve(t,e){return I.L((function(){var n=t.shape[0];return{boxPredictionEncoding:I.x(Wt(t,e.box_encoding_predictor),[n,-1,1,4]),classPrediction:I.x(Wt(t,e.class_predictor),[n,-1,3])}}))}var qe=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}(),Ge=function(t){function e(){return t.call(this,"SsdMobilenetv1")||this}return Object(R.c)(e,t),e.prototype.forwardInput=function(t){var e=this.params;if(!e)throw new Error("SsdMobilenetv1 - load model before inference");return I.L((function(){var n=t.toBatchTensor(512,!1).toFloat(),r=Ue(I.F(I.t(n,I.y(.007843137718737125)),I.y(1)),e.mobilenetv1),o=function(t,e,n){return I.L((function(){var r=Le(t,n.conv_0,[1,1]),o=Le(r,n.conv_1,[2,2]),i=Le(o,n.conv_2,[1,1]),a=Le(i,n.conv_3,[2,2]),s=Le(a,n.conv_4,[1,1]),u=Le(s,n.conv_5,[2,2]),c=Le(u,n.conv_6,[1,1]),l=Le(c,n.conv_7,[2,2]),f=Ve(e,n.box_predictor_0),h=Ve(t,n.box_predictor_1),p=Ve(o,n.box_predictor_2),d=Ve(a,n.box_predictor_3),m=Ve(u,n.box_predictor_4),v=Ve(l,n.box_predictor_5);return{boxPredictions:I.h([f.boxPredictionEncoding,h.boxPredictionEncoding,p.boxPredictionEncoding,d.boxPredictionEncoding,m.boxPredictionEncoding,v.boxPredictionEncoding],1),classPredictions:I.h([f.classPrediction,h.classPrediction,p.classPrediction,d.classPrediction,m.classPrediction,v.classPrediction],1)}}))}(r.out,r.conv11,e.prediction_layer);return function(t,e,n){return I.L((function(){var r=t.shape[0],o=ze(I.x(I.M(n.extra_dim,[r,1,1]),[-1,4]),I.x(t,[-1,4]));o=I.x(o,[r,o.shape[0]/r,4]);var i=I.A(I.B(e,[0,0,1],[-1,-1,-1])),a=I.B(i,[0,0,0],[-1,-1,1]);return a=I.x(a,[r,a.shape[1]]),{boxes:I.O(o),scores:I.O(a)}}))}(o.boxPredictions,o.classPredictions,e.output_layer)}))},e.prototype.forward=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return e=this.forwardInput,[4,Rt(t)];case 1:return[2,e.apply(this,[n.sent()])]}}))}))},e.prototype.locateFaces=function(t,e){return void 0===e&&(e={}),Object(R.b)(this,void 0,void 0,(function(){var n,r,o,i,a,s,u,c,l,f,h,p,d,m,v,g,y,b,w,x;return Object(R.d)(this,(function(_){switch(_.label){case 0:return n=new qe(e),r=n.maxResults,o=n.minConfidence,[4,Rt(t)];case 1:for(i=_.sent(),a=this.forwardInput(i),s=a.boxes,u=a.scores,c=s[0],l=u[0],f=1;f<s.length;f++)s[f].dispose(),u[f].dispose();return d=(p=Array).from,[4,l.data()];case 2:return h=d.apply(p,[_.sent()]),.5,m=function(t,e,n,r,o){var i=t.shape[0],a=Math.min(n,i),s=e.map((function(t,e){return{score:t,boxIndex:e}})).filter((function(t){return t.score>o})).sort((function(t,e){return e.score-t.score})),u=[];return s.forEach((function(e){if(!(u.length>=a)){for(var n=e.score,i=u.length-1;i>=0;--i){var s=We(t,e.boxIndex,u[i]);if(0!==s&&(e.score*=s<=r?1:0,e.score<=o))break}n===e.score&&u.push(e.boxIndex)}})),u}(c,h,r,.5,o),v=i.getReshapedInputDimensions(0),g=i.inputSize,y=g/v.width,b=g/v.height,w=c.arraySync(),x=m.map((function(t){var e=[Math.max(0,w[t][0]),Math.min(1,w[t][2])].map((function(t){return t*b})),n=e[0],r=e[1],o=[Math.max(0,w[t][1]),Math.min(1,w[t][3])].map((function(t){return t*y})),a=o[0],s=o[1];return new H(h[t],new J(a,n,s-a,r-n),{height:i.getInputHeight(0),width:i.getInputWidth(0)})})),c.dispose(),l.dispose(),[2,x]}}))}))},e.prototype.getDefaultModelName=function(){return"ssd_mobilenetv1_model"},e.prototype.extractParamsFromWeigthMap=function(t){return Be(t)},e.prototype.extractParams=function(t){return function(t){var e=[],n=Yt(t),r=n.extractWeights,o=n.getRemainingWeights,i=Fe(r,e),a=i.extractMobilenetV1Params,s=i.extractPredictionLayerParams,u=a(),c=s(),l={extra_dim:I.J(r(20472),[1,5118,4])};if(e.push({paramPath:"output_layer/extra_dim"}),0!==o().length)throw new Error("weights remaing after extract: "+o().length);return{params:{mobilenetv1:u,prediction_layer:c,output_layer:l},paramMappings:e}}(t)},e}(Ft);!function(t){function e(){return null!==t&&t.apply(this,arguments)||this}Object(R.c)(e,t)}(Ge);var He,Xe=[new z(.738768,.874946),new z(2.42204,2.65704),new z(4.30971,7.04493),new z(10.246,4.59428),new z(12.6868,11.8741)],Ke=[new z(1.603231,2.094468),new z(6.041143,7.080126),new z(2.882459,3.518061),new z(4.266906,5.178857),new z(9.041765,10.66308)],Ye=[117.001,114.697,97.404],$e=function(t){return"number"==typeof t};function Je(t){return I.L((function(){var e=I.t(t,I.y(.10000000149011612));return I.c(I.w(I.F(t,e)),e)}))}function Qe(t,e){return I.L((function(){var n=I.v(t,[[0,0],[1,1],[1,1],[0,0]]);return n=I.i(n,e.conv.filters,[1,1],"valid"),n=I.F(n,e.bn.sub),n=I.t(n,e.bn.truediv),Je(n=I.c(n,e.conv.bias))}))}function Ze(t,e){return I.L((function(){var n=I.v(t,[[0,0],[1,1],[1,1],[0,0]]);return n=I.z(n,e.depthwise_filter,e.pointwise_filter,[1,1],"valid"),Je(n=I.c(n,e.bias))}))}function tn(t,e){var n=Vt(t,e);var r=Ht(t,e);return{extractConvParams:n,extractConvWithBatchNormParams:function(r,o,i){return{conv:n(r,o,3,i+"/conv"),bn:function(n,r){var o=I.H(t(n)),i=I.H(t(n));return e.push({paramPath:r+"/sub"},{paramPath:r+"/truediv"}),{sub:o,truediv:i}}(o,i+"/bn")}},extractSeparableConvParams:r}}function en(t,e){var n=Kt(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:Xt(n)}}!function(t){t[t.XS=224]="XS",t[t.SM=320]="SM",t[t.MD=416]="MD",t[t.LG=608]="LG"}(He||(He={}));var nn=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}(),rn=function(t){function e(e){var n=t.call(this,"TinyYolov2")||this;return function(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(!$e(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 $e(t.x)&&$e(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($e)))throw new Error("config.meanRgb has to be an array of shape [number, number, number], have: "+JSON.stringify(t.meanRgb))}(e),n._config=e,n}return Object(R.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=Qe(t,e.conv0);return n=Qe(n=I.s(n,[2,2],[2,2],"same"),e.conv1),n=Qe(n=I.s(n,[2,2],[2,2],"same"),e.conv2),n=Qe(n=I.s(n,[2,2],[2,2],"same"),e.conv3),n=Qe(n=I.s(n,[2,2],[2,2],"same"),e.conv4),n=Qe(n=I.s(n,[2,2],[2,2],"same"),e.conv5),n=Qe(n=I.s(n,[2,2],[1,1],"same"),e.conv6),Wt(n=Qe(n,e.conv7),e.conv8,"valid",!1)},e.prototype.runMobilenet=function(t,e){var n=this.config.isFirstLayerConv2d?Je(Wt(t,e.conv0,"valid",!1)):Ze(t,e.conv0);return n=Ze(n=I.s(n,[2,2],[2,2],"same"),e.conv1),n=Ze(n=I.s(n,[2,2],[2,2],"same"),e.conv2),n=Ze(n=I.s(n,[2,2],[2,2],"same"),e.conv3),n=Ze(n=I.s(n,[2,2],[2,2],"same"),e.conv4),n=Ze(n=I.s(n,[2,2],[2,2],"same"),e.conv5),n=I.s(n,[2,2],[1,1],"same"),n=e.conv6?Ze(n,e.conv6):n,Wt(n=e.conv7?Ze(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 I.L((function(){var o=t.toBatchTensor(e,!1).toFloat();return o=(o=n.config.meanRgb?Y(o,n.config.meanRgb):o).div(I.y(256)),n.config.withSeparableConvs?n.runMobilenet(o,r):n.runTinyYolov2(o,r)}))},e.prototype.forward=function(t,e){return Object(R.b)(this,void 0,void 0,(function(){var n;return Object(R.d)(this,(function(r){switch(r.label){case 0:return n=this.forwardInput,[4,Rt(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(R.b)(this,void 0,void 0,(function(){var n,r,o,i,a,s,u,c,l,f,h,p,d,m=this;return Object(R.d)(this,(function(v){switch(v.label){case 0:return n=new nn(e),r=n.inputSize,o=n.scoreThreshold,[4,Rt(t)];case 1:return i=v.sent(),[4,this.forwardInput(i,r)];case 2:return a=v.sent(),s=I.L((function(){return I.O(a)[0].expandDims()})),u={width:i.getInputWidth(0),height:i.getInputHeight(0)},[4,this.extractBoxes(s,i.getReshapedInputDimensions(0),o)];case 3:return c=v.sent(),a.dispose(),s.dispose(),l=c.map((function(t){return t.box})),f=c.map((function(t){return t.score})),h=c.map((function(t){return t.classScore})),p=c.map((function(t){return m.config.classes[t.label]})),d=K(l.map((function(t){return t.rescale(r)})),f,this.config.iouThreshold,!0),[2,d.map((function(t){return new G(f[t],h[t],p[t],l[t],u)}))]}}))}))},e.prototype.getDefaultModelName=function(){return""},e.prototype.extractParamsFromWeigthMap=function(t){return function(t,e){var n,r=[],o=en(t,r),i=o.extractConvParams,a=o.extractConvWithBatchNormParams,s=o.extractSeparableConvParams;if(e.withSeparableConvs){var u=e.filterSizes&&e.filterSizes.length||9;n={conv0:e.isFirstLayerConv2d?i("conv0"):s("conv0"),conv1:s("conv1"),conv2:s("conv2"),conv3:s("conv3"),conv4:s("conv4"),conv5:s("conv5"),conv6:u>7?s("conv6"):void 0,conv7:u>8?s("conv7"):void 0,conv8:i("conv8")}}else n={conv0:a("conv0"),conv1:a("conv1"),conv2:a("conv2"),conv3:a("conv3"),conv4:a("conv4"),conv5:a("conv5"),conv6:a("conv6"),conv7:a("conv7"),conv8:i("conv8")};return zt(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 o,i=Yt(t),a=i.extractWeights,s=i.getRemainingWeights,u=[],c=tn(a,u),l=c.extractConvParams,f=c.extractConvWithBatchNormParams,h=c.extractSeparableConvParams;if(e.withSeparableConvs){var p=r[0],d=r[1],m=r[2],v=r[3],g=r[4],y=r[5],b=r[6],w=r[7],x=r[8];o={conv0:e.isFirstLayerConv2d?l(p,d,3,"conv0"):h(p,d,"conv0"),conv1:h(d,m,"conv1"),conv2:h(m,v,"conv2"),conv3:h(v,g,"conv3"),conv4:h(g,y,"conv4"),conv5:h(y,b,"conv5"),conv6:w?h(b,w,"conv6"):void 0,conv7:x?h(w,x,"conv7"):void 0,conv8:l(x||w||b,5*n,1,"conv8")}}else{p=r[0],d=r[1],m=r[2],v=r[3],g=r[4],y=r[5],b=r[6],w=r[7],x=r[8];o={conv0:f(p,d,"conv0"),conv1:f(d,m,"conv1"),conv2:f(m,v,"conv2"),conv3:f(v,g,"conv3"),conv4:f(g,y,"conv4"),conv5:f(y,b,"conv5"),conv6:f(b,w,"conv6"),conv7:f(w,x,"conv7"),conv8:l(x,5*n,1,"conv8")}}if(0!==s().length)throw new Error("weights remaing after extract: "+s().length);return{params:o,paramMappings:u}}(t,this.config,this.boxEncodingSize,n)},e.prototype.extractBoxes=function(t,e,n){return Object(R.b)(this,void 0,void 0,(function(){var r,o,i,a,s,u,c,l,f,h,p,d,m,v,g,y,b,w,x,_,E,C,S,k,T,O,A,D,N,P=this;return Object(R.d)(this,(function(M){switch(M.label){case 0:return r=e.width,o=e.height,i=Math.max(r,o),a=i/r,s=i/o,u=t.shape[1],c=this.config.anchors.length,l=I.L((function(){var e=t.reshape([u,u,c,P.boxEncodingSize]);return[e.slice([0,0,0,0],[u,u,c,4]),e.slice([0,0,0,4],[u,u,c,1]),P.withClassScores?I.D(e.slice([0,0,0,5],[u,u,c,P.config.classes.length]),3):I.y(0)]})),f=l[0],h=l[1],p=l[2],d=[],[4,h.array()];case 1:return m=M.sent(),[4,f.array()];case 2:v=M.sent(),g=0,M.label=3;case 3:if(!(g<u))return[3,12];y=0,M.label=4;case 4:if(!(y<u))return[3,11];b=0,M.label=5;case 5:return b<c?(w=$(m[g][y][b][0]),!n||w>n?(x=(y+$(v[g][y][b][0]))/u*a,_=(g+$(v[g][y][b][1]))/u*s,E=Math.exp(v[g][y][b][2])*this.config.anchors[b].x/u*a,C=Math.exp(v[g][y][b][3])*this.config.anchors[b].y/u*s,S=x-E/2,k=_-C/2,T={row:g,col:y,anchor:b},this.withClassScores?[4,this.extractPredictedClass(p,T)]:[3,7]):[3,9]):[3,10];case 6:return N=M.sent(),[3,8];case 7:N={classScore:1,label:0},M.label=8;case 8:A=(O=N).classScore,D=O.label,d.push(Object(R.a)({box:new q(S,k,S+E,k+C),score:w,classScore:w*A,label:D},T)),M.label=9;case 9:return b++,[3,5];case 10:return y++,[3,4];case 11:return g++,[3,3];case 12:return f.dispose(),h.dispose(),p.dispose(),[2,d]}}))}))},e.prototype.extractPredictedClass=function(t,e){return Object(R.b)(this,void 0,void 0,(function(){var n,r,o,i;return Object(R.d)(this,(function(a){switch(a.label){case 0:return n=e.row,r=e.col,o=e.anchor,[4,t.array()];case 1:return i=a.sent(),[2,Array(this.config.classes.length).fill(0).map((function(t,e){return i[n][r][o][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}(Ft),on=function(t){function e(e){void 0===e&&(e=!0);var n=Object.assign({},{withSeparableConvs:e,iouThreshold:.4,classes:["face"]},e?{anchors:Ke,meanRgb:Ye}:{anchors:Xe,withClassScores:!0});return t.call(this,n)||this}return Object(R.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(R.b)(this,void 0,void 0,(function(){return Object(R.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 H(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}(rn);var an=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._name="TinyFaceDetectorOptions",e}return Object(R.c)(e,t),e}(nn),sn=function(){function t(){}return t.prototype.then=function(t){return Object(R.b)(this,void 0,void 0,(function(){var e;return Object(R.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(R.b)(this,void 0,void 0,(function(){return Object(R.d)(this,(function(t){throw new Error("ComposableTask - run is not implemented")}))}))},t}();function un(t,e,n,r,o){return void 0===o&&(o=function(t){return t.alignedRect}),Object(R.b)(this,void 0,void 0,(function(){var i,a,s,u,c;return Object(R.d)(this,(function(l){switch(l.label){case 0:return i=t.map((function(t){return ue(t)?o(t):t.detection})),(s=r)?[3,5]:e instanceof I.a?[4,Dt(e,i)]:[3,2];case 1:return u=l.sent(),[3,4];case 2:return[4,At(e,i)];case 3:u=l.sent(),l.label=4;case 4:s=u,l.label=5;case 5:return[4,n(a=s)];case 6:return c=l.sent(),a.forEach((function(t){return t instanceof I.a&&t.dispose()})),[2,c]}}))}))}function cn(t,e,n,r,o){return Object(R.b)(this,void 0,void 0,(function(){var i=this;return Object(R.d)(this,(function(a){return[2,un([t],e,(function(t){return Object(R.b)(i,void 0,void 0,(function(){return Object(R.d)(this,(function(e){return[2,n(t[0])]}))}))}),r,o)]}))}))}function ln(t){var e=Yt(t),n=e.extractWeights,r=e.getRemainingWeights,o=[],i=function(t,e){var n=Vt(t,e),r=qt(t,e);function o(n,r){var o=I.H(t(n));return e.push({paramPath:r}),o}function i(t,e,r){return void 0===r&&(r=!1),{conv1:n(t[0],t[1],3,e+"/conv1"),prelu1_alpha:o(t[1],e+"/prelu1_alpha"),conv2:n(t[1],t[2],3,e+"/conv2"),prelu2_alpha:o(t[2],e+"/prelu2_alpha"),conv3:n(t[2],t[3],r?2:3,e+"/conv3"),prelu3_alpha:o(t[3],e+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=i([3,10,16,32],"pnet"),e=n(32,2,1,"pnet/conv4_1"),r=n(32,4,1,"pnet/conv4_2");return Object(R.a)(Object(R.a)({},t),{conv4_1:e,conv4_2:r})},extractRNetParams:function(){var t=i([3,28,48,64],"rnet",!0),e=r(576,128,"rnet/fc1"),n=o(128,"rnet/prelu4_alpha"),a=r(128,2,"rnet/fc2_1"),s=r(128,4,"rnet/fc2_2");return Object(R.a)(Object(R.a)({},t),{fc1:e,prelu4_alpha:n,fc2_1:a,fc2_2:s})},extractONetParams:function(){var t=i([3,32,64,64],"onet"),e=n(64,128,2,"onet/conv4"),a=o(128,"onet/prelu4_alpha"),s=r(1152,256,"onet/fc1"),u=o(256,"onet/prelu5_alpha"),c=r(256,2,"onet/fc2_1"),l=r(256,4,"onet/fc2_2"),f=r(256,10,"onet/fc2_3");return Object(R.a)(Object(R.a)({},t),{conv4:e,prelu4_alpha:a,fc1:s,prelu5_alpha:u,fc2_1:c,fc2_2:l,fc2_3:f})}}}(n,o),a=i.extractPNetParams,s=i.extractRNetParams,u=i.extractONetParams,c=a(),l=s(),f=u();if(0!==r().length)throw new Error("weights remaing after extract: "+r().length);return{params:{pnet:c,rnet:l,onet:f},paramMappings:o}}function fn(t){var e=[],n=function(t,e){var n=Kt(t,e);function r(t){return{filters:n(t+"/weights",4,t+"/filters"),bias:n(t+"/bias",1)}}function o(t){return{weights:n(t+"/weights",2),bias:n(t+"/bias",1)}}function i(t){return n(t,1)}function a(t){return{conv1:r(t+"/conv1"),prelu1_alpha:i(t+"/prelu1_alpha"),conv2:r(t+"/conv2"),prelu2_alpha:i(t+"/prelu2_alpha"),conv3:r(t+"/conv3"),prelu3_alpha:i(t+"/prelu3_alpha")}}return{extractPNetParams:function(){var t=a("pnet"),e=r("pnet/conv4_1"),n=r("pnet/conv4_2");return Object(R.a)(Object(R.a)({},t),{conv4_1:e,conv4_2:n})},extractRNetParams:function(){var t=a("rnet"),e=o("rnet/fc1"),n=i("rnet/prelu4_alpha"),r=o("rnet/fc2_1"),s=o("rnet/fc2_2");return Object(R.a)(Object(R.a)({},t),{fc1:e,prelu4_alpha:n,fc2_1:r,fc2_2:s})},extractONetParams:function(){var t=a("onet"),e=r("onet/conv4"),n=i("onet/prelu4_alpha"),s=o("onet/fc1"),u=i("onet/prelu5_alpha"),c=o("onet/fc2_1"),l=o("onet/fc2_2"),f=o("onet/fc2_3");return Object(R.a)(Object(R.a)({},t),{conv4:e,prelu4_alpha:n,fc1:s,prelu5_alpha:u,fc2_1:c,fc2_2:l,fc2_3:f})}}}(t,e),r=n.extractPNetParams,o=n.extractRNetParams,i=n.extractONetParams,a=r(),s=o(),u=i();return zt(t,e),{params:{pnet:a,rnet:s,onet:u},paramMappings:e}}function hn(t,e){var n=e[0],r=e[1];return{height:Math.floor(n*t),width:Math.floor(r*t)}}var pn=function(t){function e(e,n,r,o){return t.call(this,{left:e,top:n,right:r,bottom:o},!0)||this}return Object(R.c)(e,t),e}(V);function dn(t){return I.L((function(){return I.t(I.F(t,I.y(127.5)),I.y(.0078125))}))}function mn(t,e){return I.L((function(){return I.c(I.w(t),I.t(e,I.u(I.w(I.u(t)))))}))}function vn(t,e,n){return void 0===n&&(n=!1),I.L((function(){var r=Wt(t,e.conv1,"valid");return r=mn(r,e.prelu1_alpha),r=mn(r=Wt(r=I.s(r,n?[2,2]:[3,3],[2,2],"same"),e.conv2,"valid"),e.prelu2_alpha),r=mn(r=Wt(r=n?r:I.s(r,[3,3],[2,2],"valid"),e.conv3,"valid"),e.prelu3_alpha)}))}function gn(t,e,n,r,o){o.stage1=[];var i=e.map((function(e){return I.L((function(){var n={scale:e},o=function(t,e){return I.L((function(){var n=hn(e,t.shape.slice(1)),r=n.height,o=n.width,i=dn(I.o.resizeBilinear(t,[r,o]));return I.N(i,[0,2,1,3])}))}(t,e),i=Date.now(),a=function(t,e){return I.L((function(){var n=vn(t,e,!0),r=Wt(n,e.conv4_1,"valid"),o=I.m(I.r(r,3),3);return{prob:I.D(I.F(r,o),3),regions:Wt(n,e.conv4_2,"valid")}}))}(o,r),s=a.prob,u=a.regions;return n.pnet=Date.now()-i,{scoresTensor:I.O(I.O(s,3)[1])[0],regionsTensor:I.O(u)[0],scale:e,statsForScale:n}}))})).map((function(t){var e=t.scoresTensor,r=t.regionsTensor,i=t.scale,a=t.statsForScale,s=function(t,e,n,r){for(var o=[],i=t.arraySync(),a=0;a<t.shape[0];a++)for(var s=0;s<t.shape[1];s++)i[a][s]>=r&&o.push(new z(s,a));return o.map((function(t){var r=new q(Math.round((2*t.y+1)/n),Math.round((2*t.x+1)/n),Math.round((2*t.y+12)/n),Math.round((2*t.x+12)/n)),o=i[t.y][t.x],a=e.arraySync();return{cell:r,score:o,region:new pn(a[t.y][t.x][0],a[t.y][t.x][1],a[t.y][t.x][2],a[t.y][t.x][3])}}))}(e,r,i,n);if(e.dispose(),r.dispose(),!s.length)return o.stage1.push(a),[];var u=Date.now(),c=K(s.map((function(t){return t.cell})),s.map((function(t){return t.score})),.5);return a.nms=Date.now()-u,a.numBoxes=c.length,o.stage1.push(a),c.map((function(t){return s[t]}))})).reduce((function(t,e){return t.concat(e)}),[]),a=[],s=[];if(i.length>0){var u=Date.now(),c=K(i.map((function(t){return t.cell})),i.map((function(t){return t.score})),.7);o.stage1_nms=Date.now()-u,s=c.map((function(t){return i[t].score})),a=c.map((function(t){return i[t]})).map((function(t){var e=t.cell,n=t.region;return new q(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:s}}function yn(t,e,n){var r=n.width,o=n.height;return Object(R.b)(this,void 0,void 0,(function(){var n,i,a,s=this;return Object(R.d)(this,(function(u){switch(u.label){case 0:return n=gt(t),[4,Promise.all(e.map((function(e){return Object(R.b)(s,void 0,void 0,(function(){var r,o,i,a,s,u,c,l;return Object(R.d)(this,(function(f){return r=e.padAtBorders(t.height,t.width),o=r.y,i=r.ey,a=r.x,s=r.ex,u=a-1,c=o-1,l=n.getImageData(u,c,s-u,i-c),[2,mt.isNodejs()?kt(l):createImageBitmap(l)]}))}))})))];case 1:return i=u.sent(),a=[],i.forEach((function(t){var e=gt(St({width:r,height:o}));e.drawImage(t,0,0,r,o);for(var n=e.getImageData(0,0,r,o).data,i=[],s=0;s<n.length;s+=4)i.push(n[s+2]),i.push(n[s+1]),i.push(n[s]);a.push(i)})),[2,a.map((function(t){return I.L((function(){return dn(I.N(I.K(t,[1,r,o,3]),[0,2,1,3]).toFloat())}))}))]}}))}))}function bn(t,e,n,r,o){return Object(R.b)(this,void 0,void 0,(function(){var i,a,s,u,c,l,f,h,p,d,m,v,g,y;return Object(R.d)(this,(function(b){switch(b.label){case 0:return i=Date.now(),[4,yn(t,e,{width:24,height:24})];case 1:return a=b.sent(),o.stage2_extractImagePatches=Date.now()-i,i=Date.now(),s=a.map((function(t){var e=function(t,e){return I.L((function(){var n=vn(t,e),r=mn(te(I.x(n,[n.shape[0],e.fc1.weights.shape[0]]),e.fc1),e.prelu4_alpha),o=te(r,e.fc2_1),i=I.m(I.r(o,1),1),a=I.D(I.F(o,i),1),s=te(r,e.fc2_2);return{scores:I.O(a,1)[1],regions:s}}))}(t,r);return t.dispose(),e})),o.stage2_rnet=Date.now()-i,u=s.length>1?I.h(s.map((function(t){return t.scores}))):s[0].scores,f=(l=Array).from,[4,u.data()];case 2:return c=f.apply(l,[b.sent()]),u.dispose(),h=c.map((function(t,e){return{score:t,idx:e}})).filter((function(t){return t.score>n})).map((function(t){return t.idx})),p=h.map((function(t){return e[t]})),d=h.map((function(t){return c[t]})),m=[],v=[],p.length>0&&(i=Date.now(),g=K(p,d,.7),o.stage2_nms=Date.now()-i,y=g.map((function(t){var e=s[h[t]].regions.arraySync();return new pn(e[0][0],e[0][1],e[0][2],e[0][3])})),v=g.map((function(t){return d[t]})),m=g.map((function(t,e){return p[t].calibrate(y[e])}))),s.forEach((function(t){t.regions.dispose(),t.scores.dispose()})),[2,{boxes:m,scores:v}]}}))}))}function wn(t,e,n,r,o){return Object(R.b)(this,void 0,void 0,(function(){var i,a,s,u,c,l,f,h,p,d,m,v,g,y,b;return Object(R.d)(this,(function(w){switch(w.label){case 0:return i=Date.now(),[4,yn(t,e,{width:48,height:48})];case 1:return a=w.sent(),o.stage3_extractImagePatches=Date.now()-i,i=Date.now(),s=a.map((function(t){var e=function(t,e){return I.L((function(){var n=vn(t,e);n=mn(n=Wt(n=I.s(n,[2,2],[2,2],"same"),e.conv4,"valid"),e.prelu4_alpha);var r=mn(te(I.x(n,[n.shape[0],e.fc1.weights.shape[0]]),e.fc1),e.prelu5_alpha),o=te(r,e.fc2_1),i=I.m(I.r(o,1),1),a=I.D(I.F(o,i),1),s=te(r,e.fc2_2),u=te(r,e.fc2_3);return{scores:I.O(a,1)[1],regions:s,points:u}}))}(t,r);return t.dispose(),e})),o.stage3_onet=Date.now()-i,u=s.length>1?I.h(s.map((function(t){return t.scores}))):s[0].scores,f=(l=Array).from,[4,u.data()];case 2:return c=f.apply(l,[w.sent()]),u.dispose(),h=c.map((function(t,e){return{score:t,idx:e}})).filter((function(t){return t.score>n})).map((function(t){return t.idx})),p=h.map((function(t){var e=s[t].regions.arraySync();return new pn(e[0][0],e[0][1],e[0][2],e[0][3])})),d=h.map((function(t,n){return e[t].calibrate(p[n])})),m=h.map((function(t){return c[t]})),v=[],g=[],y=[],d.length>0&&(i=Date.now(),b=K(d,m,.7,!1),o.stage3_nms=Date.now()-i,v=b.map((function(t){return d[t]})),g=b.map((function(t){return m[t]})),y=b.map((function(t,e){return Array(5).fill(0).map((function(n,r){var o=s[t].points.arraySync();return new z(o[0][r]*(v[e].width+1)+v[e].left,o[0][r+5]*(v[e].height+1)+v[e].top)}))}))),s.forEach((function(t){t.regions.dispose(),t.scores.dispose(),t.points.dispose()})),[2,{boxes:v,scores:g,points:y}]}}))}))}var xn=function(t){function e(){return t.call(this,"Mtcnn")||this}return Object(R.c)(e,t),e.prototype.load=function(e){return Object(R.b)(this,void 0,void 0,(function(){return Object(R.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(R.b)(this,void 0,void 0,(function(){return Object(R.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(R.b)(this,void 0,void 0,(function(){var n,r,o,i,a,s,u,c,l,f,h,p,d,m,v,g,y,b,w,x,_;return Object(R.d)(this,(function(E){switch(E.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 o={},i=Date.now(),a=I.L((function(){return t=I.m(I.f.fromPixels(r)).toFloat(),I.L((function(){return I.E(I.O(t,3).reverse(),3)}));var t})),s=function(t){return a.dispose(),o.total=Date.now()-i,t},u=a.shape.slice(1),c=u[0],l=u[1],f=new je(e),h=f.minFaceSize,p=f.scaleFactor,d=f.maxNumScales,m=f.scoreThresholds,v=f.scaleSteps,g=(v||function(t,e,n){for(var r=n[0],o=n[1],i=12/t,a=[],s=Math.min(r,o)*i,u=0;s>=12;)a.push(i*Math.pow(e,u)),s*=e,u+=1;return a}(h,p,[c,l])).filter((function(t){var e=hn(t,[c,l]);return Math.min(e.width,e.height)>12})).slice(0,d),o.scales=g,o.pyramid=g.map((function(t){return hn(t,[c,l])})),y=Date.now(),[4,gn(a,g,m[0],n.pnet,o)];case 1:return b=E.sent(),o.total_stage1=Date.now()-y,b.boxes.length?(o.stage2_numInputBoxes=b.boxes.length,y=Date.now(),[4,bn(r,b.boxes,m[1],n.rnet,o)]):[2,s({results:[],stats:o})];case 2:return w=E.sent(),o.total_stage2=Date.now()-y,w.boxes.length?(o.stage3_numInputBoxes=w.boxes.length,y=Date.now(),[4,wn(r,w.boxes,m[2],n.onet,o)]):[2,s({results:[],stats:o})];case 3:return x=E.sent(),o.total_stage3=Date.now()-y,_=x.boxes.map((function(t,e){return ce(it({},new H(x.scores[e],new J(t.left/l,t.top/c,t.width/l,t.height/c),{height:c,width:l})),new Z(x.points[e].map((function(e){return e.sub(new z(t.left,t.top)).div(new z(t.width,t.height))})),{width:t.width,height:t.height}))})),[2,s({results:_,stats:o})]}}))}))},e.prototype.forward=function(t,e){return void 0===e&&(e={}),Object(R.b)(this,void 0,void 0,(function(){var n;return Object(R.d)(this,(function(r){switch(r.label){case 0:return n=this.forwardInput,[4,Rt(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(R.b)(this,void 0,void 0,(function(){var n;return Object(R.d)(this,(function(r){switch(r.label){case 0:return n=this.forwardInput,[4,Rt(t)];case 1:return[2,n.apply(this,[r.sent(),e])]}}))}))},e.prototype.getDefaultModelName=function(){return"mtcnn_model"},e.prototype.extractParamsFromWeigthMap=function(t){return fn(t)},e.prototype.extractParams=function(t){return ln(t)},e}(Ft),_n=[new z(1.603231,2.094468),new z(6.041143,7.080126),new z(2.882459,3.518061),new z(4.266906,5.178857),new z(9.041765,10.66308)],En=[117.001,114.697,97.404],Cn=function(t){function e(){var e={withSeparableConvs:!0,iouThreshold:.4,classes:["face"],anchors:_n,meanRgb:En,isFirstLayerConv2d:!0,filterSizes:[3,16,32,64,128,256,512]};return t.call(this,e)||this}return Object(R.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(R.b)(this,void 0,void 0,(function(){return Object(R.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 H(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}(rn),Sn={ssdMobilenetv1:new Ge,tinyFaceDetector:new Cn,tinyYolov2:new on,mtcnn:new xn,faceLandmark68Net:new xe,faceLandmark68TinyNet:new Ee,faceRecognitionNet:new De,faceExpressionNet:new ie,ageGenderNet:new be},kn=function(t){return Sn.faceLandmark68Net.load(t)},Tn=function(t){return Sn.faceRecognitionNet.load(t)},In=function(t){function e(e,n,r){var o=t.call(this)||this;return o.parentTask=e,o.input=n,o.extractedFaces=r,o}return Object(R.c)(e,t),e}(sn),On=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e,n=this;return Object(R.d)(this,(function(r){switch(r.label){case 0:return[4,this.parentTask];case 1:return[4,un(t=r.sent(),this.input,(function(t){return Object(R.b)(n,void 0,void 0,(function(){return Object(R.d)(this,(function(e){switch(e.label){case 0:return[4,Promise.all(t.map((function(t){return Sn.faceExpressionNet.predictExpressions(t)})))];case 1:return[2,e.sent()]}}))}))}),this.extractedFaces)];case 2:return e=r.sent(),[2,t.map((function(t,n){return ae(t,e[n])}))]}}))}))},e.prototype.withAgeAndGender=function(){return new Pn(this,this.input)},e}(In),Rn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return[4,this.parentTask];case 1:return(t=n.sent())?[4,cn(t,this.input,(function(t){return Sn.faceExpressionNet.predictExpressions(t)}),this.extractedFaces)]:[2];case 2:return e=n.sent(),[2,ae(t,e)]}}))}))},e.prototype.withAgeAndGender=function(){return new Mn(this,this.input)},e}(In),An=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.withAgeAndGender=function(){return new jn(this,this.input)},e.prototype.withFaceDescriptors=function(){return new Ln(this,this.input)},e}(On),Dn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.withAgeAndGender=function(){return new Fn(this,this.input)},e.prototype.withFaceDescriptor=function(){return new Un(this,this.input)},e}(Rn),Nn=function(t){function e(e,n,r){var o=t.call(this)||this;return o.parentTask=e,o.input=n,o.extractedFaces=r,o}return Object(R.c)(e,t),e}(sn),Pn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e,n=this;return Object(R.d)(this,(function(r){switch(r.label){case 0:return[4,this.parentTask];case 1:return[4,un(t=r.sent(),this.input,(function(t){return Object(R.b)(n,void 0,void 0,(function(){return Object(R.d)(this,(function(e){switch(e.label){case 0:return[4,Promise.all(t.map((function(t){return Sn.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],o=r.age;return Pe(Me(t,r.gender,r.genderProbability),o)}))]}}))}))},e.prototype.withFaceExpressions=function(){return new On(this,this.input)},e}(Nn),Mn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e,n,r,o;return Object(R.d)(this,(function(i){switch(i.label){case 0:return[4,this.parentTask];case 1:return(t=i.sent())?[4,cn(t,this.input,(function(t){return Sn.ageGenderNet.predictAgeAndGender(t)}),this.extractedFaces)]:[2];case 2:return e=i.sent(),n=e.age,r=e.gender,o=e.genderProbability,[2,Pe(Me(t,r,o),n)]}}))}))},e.prototype.withFaceExpressions=function(){return new Rn(this,this.input)},e}(Nn),jn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.withFaceExpressions=function(){return new An(this,this.input)},e.prototype.withFaceDescriptors=function(){return new Ln(this,this.input)},e}(Pn),Fn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.withFaceExpressions=function(){return new Dn(this,this.input)},e.prototype.withFaceDescriptor=function(){return new Un(this,this.input)},e}(Mn),Bn=function(t){function e(e,n){var r=t.call(this)||this;return r.parentTask=e,r.input=n,r}return Object(R.c)(e,t),e}(sn),Ln=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t;return Object(R.d)(this,(function(e){switch(e.label){case 0:return[4,this.parentTask];case 1:return[4,un(t=e.sent(),this.input,(function(t){return Promise.all(t.map((function(t){return Sn.faceRecognitionNet.computeFaceDescriptor(t)})))}),null,(function(t){return t.landmarks.align(null,{useDlibAlignment:!0})}))];case 2:return[2,e.sent().map((function(e,n){return Ne(t[n],e)}))]}}))}))},e.prototype.withFaceExpressions=function(){return new An(this,this.input)},e.prototype.withAgeAndGender=function(){return new jn(this,this.input)},e}(Bn),Un=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return[4,this.parentTask];case 1:return(t=n.sent())?[4,cn(t,this.input,(function(t){return Sn.faceRecognitionNet.computeFaceDescriptor(t)}),null,(function(t){return t.landmarks.align(null,{useDlibAlignment:!0})}))]:[2];case 2:return e=n.sent(),[2,Ne(t,e)]}}))}))},e.prototype.withFaceExpressions=function(){return new Dn(this,this.input)},e.prototype.withAgeAndGender=function(){return new Fn(this,this.input)},e}(Bn),Wn=function(t){function e(e,n,r){var o=t.call(this)||this;return o.parentTask=e,o.input=n,o.useTinyLandmarkNet=r,o}return Object(R.c)(e,t),Object.defineProperty(e.prototype,"landmarkNet",{get:function(){return this.useTinyLandmarkNet?Sn.faceLandmark68TinyNet:Sn.faceLandmark68Net},enumerable:!0,configurable:!0}),e}(sn),zn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e,n,r,o,i=this;return Object(R.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 I.a?[4,Dt(this.input,e)]:[3,3];case 2:return r=a.sent(),[3,5];case 3:return[4,At(this.input,e)];case 4:r=a.sent(),a.label=5;case 5:return n=r,[4,Promise.all(n.map((function(t){return i.landmarkNet.detectLandmarks(t)})))];case 6:return o=a.sent(),n.forEach((function(t){return t instanceof I.a&&t.dispose()})),[2,t.map((function(t,e){return ce(t,o[e])}))]}}))}))},e.prototype.withFaceExpressions=function(){return new An(this,this.input)},e.prototype.withAgeAndGender=function(){return new jn(this,this.input)},e.prototype.withFaceDescriptors=function(){return new Ln(this,this.input)},e}(Wn),Vn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e,n,r,o;return Object(R.d)(this,(function(i){switch(i.label){case 0:return[4,this.parentTask];case 1:return(t=i.sent())?(e=t.detection,this.input instanceof I.a?[4,Dt(this.input,[e])]:[3,3]):[2];case 2:return r=i.sent(),[3,5];case 3:return[4,At(this.input,[e])];case 4:r=i.sent(),i.label=5;case 5:return n=r,[4,this.landmarkNet.detectLandmarks(n[0])];case 6:return o=i.sent(),n.forEach((function(t){return t instanceof I.a&&t.dispose()})),[2,ce(t,o)]}}))}))},e.prototype.withFaceExpressions=function(){return new Dn(this,this.input)},e.prototype.withAgeAndGender=function(){return new Fn(this,this.input)},e.prototype.withFaceDescriptor=function(){return new Un(this,this.input)},e}(Wn),qn=function(t){function e(e,n){void 0===n&&(n=new qe);var r=t.call(this)||this;return r.input=e,r.options=n,r}return Object(R.c)(e,t),e}(sn),Gn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e,n,r;return Object(R.d)(this,(function(o){switch(o.label){case 0:return e=(t=this).input,(n=t.options)instanceof je?[4,Sn.mtcnn.forward(e,n)]:[3,2];case 1:return[2,o.sent().map((function(t){return t.detection}))];case 2:if(!(r=n instanceof an?function(t){return Sn.tinyFaceDetector.locateFaces(t,n)}:n instanceof qe?function(t){return Sn.ssdMobilenetv1.locateFaces(t,n)}:n instanceof nn?function(t){return Sn.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(R.b)(t,void 0,void 0,(function(){var t;return Object(R.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 it({},t)})))]}}))}))}))},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new zn(this.runAndExtendWithFaceDetections(),this.input,t)},e.prototype.withFaceExpressions=function(){return new On(this.runAndExtendWithFaceDetections(),this.input)},e.prototype.withAgeAndGender=function(){return new Pn(this.runAndExtendWithFaceDetections(),this.input)},e}(qn),Hn=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return Object(R.c)(e,t),e.prototype.run=function(){return Object(R.b)(this,void 0,void 0,(function(){var t,e;return Object(R.d)(this,(function(n){switch(n.label){case 0:return[4,new Gn(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(R.b)(t,void 0,void 0,(function(){var t;return Object(R.d)(this,(function(n){switch(n.label){case 0:return[4,this.run()];case 1:return t=n.sent(),[2,e(t?it({},t):void 0)]}}))}))}))},e.prototype.withFaceLandmarks=function(t){return void 0===t&&(t=!1),new Vn(this.runAndExtendWithFaceDetection(),this.input,t)},e.prototype.withFaceExpressions=function(){return new Rn(this.runAndExtendWithFaceDetection(),this.input)},e.prototype.withAgeAndGender=function(){return new Mn(this.runAndExtendWithFaceDetection(),this.input)},e}(qn);function Xn(t,e){return void 0===e&&(e=new qe),new Hn(t,e)}var Kn=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,o=function(){return"person "+r++};this._labeledDescriptors=n.map((function(t){if(t instanceof rt)return t;if(t instanceof Float32Array)return new rt(o(),[t]);if(t.descriptor&&t.descriptor instanceof Float32Array)return new rt(o(),[t.descriptor]);throw new Error("FaceRecognizer.constructor - expected inputs to be of type LabeledFaceDescriptors | WithFaceDescriptor<any> | Float32Array | Array<LabeledFaceDescriptors | WithFaceDescriptor<any> | 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 function(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))}(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,o=n.label;return new et(o,e.computeMeanDistance(t,r))})).reduce((function(t,e){return t.distance<e.distance?t:e}))},t.prototype.findBestMatch=function(t){var e=this.matchDescriptor(t);return e.distance<this.distanceThreshold?e:new et("unknown",e.distance)},t.prototype.toJSON=function(){return{distanceThreshold:this.distanceThreshold,labeledDescriptors:this.labeledDescriptors.map((function(t){return t.toJSON()}))}},t.fromJSON=function(e){return new t(e.labeledDescriptors.map((function(t){return rt.fromJSON(t)})),e.distanceThreshold)},t}();var Yn=n("mxV5"),$n=n.n(Yn),Jn=n("7Cbv"),Qn=n("KhGG"),Zn=n("ErOA"),tr=n("IO3U"),er=n.n(tr),nr=function(t,e){for(var n=t.split(","),r=n[0].match(/:(.*?);/)[1],o=atob(n[1]),i=o.length,a=new Uint8Array(i);i--;)a[i]=o.charCodeAt(i);return new Blob([a],{type:r})},rr=function(){var t=Object(l.a)(v.a.mark((function t(e){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,n){var r=new Image;(null==e?void 0:e.indexOf("educoder.net"))>-1?r.setAttribute("crossOrigin","educoder.net"):r.setAttribute("crossOrigin","aliyuncs.com"),r.onload=function(){var e=document.createElement("canvas");e.width=this.naturalWidth,e.height=this.naturalHeight,e.getContext("2d").drawImage(r,0,0);var n=e.toDataURL("image/png");t(n)},r.src=e,r.onerror=function(){n(new Error("图片流异常")),u.b.error("您的身份照片异常,请拍照后提交至人工审核")}})));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),or=Object(g.forwardRef)((function(t,e){var n=t.outputResult,o=t.identity_url,i=t.onCameraReady,a=t.defaultOpen,s=Object(b.i)(),c=Object(g.useRef)(),h=Object(g.useRef)(),p=Object(g.useRef)(),d=Object(g.useRef)(!1),m=Object(g.useRef)(),w=Object(g.useState)(!0),x=Object(f.a)(w,2),_=x[0],E=x[1],C=Object(g.useState)(""),S=Object(f.a)(C,2),k=S[0],I=S[1],O=Object(g.useState)(""),R=Object(f.a)(O,2),D=R[0],N=R[1],P=Object(g.useRef)(!1),M=Object(g.useRef)(""),j=Object(g.useState)(!0),F=Object(f.a)(j,1)[0],B=Object(g.useMemo)((function(){return new an({inputSize:224,scoreThreshold:.5})}),[]),L=function(){var t=Object(l.a)(v.a.mark((function t(){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Sn.ssdMobilenetv1.loadFromUri("/weights/");case 2:return t.next=4,e="/weights/",Sn.tinyFaceDetector.load(e);case 4:return t.next=6,kn("/weights/");case 6:return t.next=8,Tn("/weights/");case 8:case"end":return t.stop()}var e}),t)})));return function(){return t.apply(this,arguments)}}();Object(g.useEffect)((function(){a&&Y(!0)}),[a]),Object(g.useImperativeHandle)(e,(function(){return{handleStop:K,handleRemove:X,handlePlay:Y,startDiscern:q,handleUploadImage:V}}));var U=function(){var t=Object(l.a)(v.a.mark((function t(e){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(c.current){t.next=3;break}return setTimeout((function(){return U(e)})),t.abrupt("return");case 3:navigator.mediaDevices.getUserMedia({video:{width:640,height:360}}).then(function(){var t=Object(l.a)(v.a.mark((function t(n){var r;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("srcObject"in c.current?c.current.srcObject=n:c.current.src=window.URL.createObjectURL(n),c.current.onloadedmetadata=function(t){E(!1),c.current.play()},!e){t.next=10;break}return r=document.createElement("img"),t.next=6,rr(o+"?t="+(new Date).getTime());case 6:return r.src=t.sent,t.next=9,Xn(r,B).withFaceLandmarks().withFaceDescriptor();case 9:m.current=t.sent;case 10:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()).catch((function(t){console.log("err:",t,t.message),"Permission denied"===t.message||"NotAllowedError"===t.name?u.b.error("您已拒绝了获取摄像头"):"图片流异常"!=t.message&&u.b.error("摄像头获取失败,或您已拒绝了获取摄像头")}));case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),W=function(){var t=Object(l.a)(v.a.mark((function t(e,n){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=Object(l.a)(v.a.mark((function t(r){var o,i,a,u,c,l,f,h,p,d,m;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(Zn.a)("/api/buckets/get_upload_token.json",{method:"get"});case 2:(h=t.sent).data=JSON.parse(Object(Qn.a)(h.data)),p=Object(Jn.a)(),d=new $n.a({endpoint:null==h||null===(o=h.data)||void 0===o?void 0:o.end_point,region:null==h||null===(i=h.data)||void 0===i?void 0:i.region,accessKeyId:null==h||null===(a=h.data)||void 0===a?void 0:a.access_key_id,accessKeySecret:null==h||null===(u=h.data)||void 0===u?void 0:u.access_key_secret,bucket:null==h||null===(c=h.data)||void 0===c?void 0:c.bucket,stsToken:null==h||null===(l=h.data)||void 0===l?void 0:l.security_token}),m=nr(e),d.multipartUpload("".concat(p,".png"),m,{timeout:1e4,partSize:10485760,callback:{url:null==h||null===(f=h.data)||void 0===f?void 0:f.callback_url,host:null==h?void 0:h.data.bucket_host,body:"bucket=${bucket}&object=${object}&etag=${etag}&size=${size}&mimeType=${mimeType}&my_var=${x:my_var}&login="+s.login+"&container_id="+s.categoryId+"&container_type=ExerciseIdentity&p="+n}}).then((function(t){r(t),console.log("result:",t)})).catch((function(t){console.log("err:",t)}));case 8:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),z=function(){var t=Object(l.a)(v.a.mark((function t(e){var n;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,h.current.width=c.current.videoWidth,h.current.height=360,n=h.current.getContext("2d"),t.next=6,n.drawImage(c.current,0,0,h.current.width,h.current.height);case 6:M.current=h.current.toDataURL("image/png"),1===e&&W(M.current,e),t.next=12;break;case 10:t.prev=10,t.t0=t.catch(0);case 12:case"end":return t.stop()}}),t,null,[[0,10]])})));return function(e){return t.apply(this,arguments)}}(),V=function(){var t=Object(l.a)(v.a.mark((function t(e){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=Object(l.a)(v.a.mark((function t(n){var r;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=h.current.getContext("2d"),t.next=3,r.drawImage(c.current,0,0,h.current.width,h.current.height);case 3:return t.next=5,W(M.current,e);case 5:n();case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),q=function(){var t=Object(l.a)(v.a.mark((function t(){var e,r,o;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d.current=!0,t.next=3,Xn(c.current,B).withFaceLandmarks().withFaceDescriptor();case 3:(e=t.sent)&&m.current?(r=new Kn(e),o=r.findBestMatch(m.current.descriptor),I(o._distance<.4?"识别成功":"审核失败"),z(o._distance<.4?1:0),setTimeout((function(){null==n||n({content:o._distance<.4?"识别成功":"审核失败",success:o._distance<.4})}),1e3),P.current=!0):(z(0),I("审核失败"),setTimeout((function(){null==n||n({content:"审核失败",success:!1})}),1e3)),setTimeout((function(){c.current.pause()}),600);case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),G=function(){var t=Object(l.a)(v.a.mark((function t(){var e,n,r;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(null!==(e=c.current)&&void 0!==e&&e.paused||null!==(n=c.current)&&void 0!==n&&n.ended)){t.next=2;break}return t.abrupt("return",setTimeout((function(){return G()})));case 2:return t.next=4,Xn(c.current,B).withFaceLandmarks().withFaceDescriptor();case 4:r=t.sent,d.current||(d.current=!0,i(!0)),r&&c.current?(N(""),$(c.current,p.current,[r],F)):N("请将脸部移动至取景框内"),P.current||setTimeout((function(){return G()}));case 8:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),X=function(){try{c.current.srcObject.getTracks().forEach((function(t){t.stop()})),d.current=!1}catch(t){}},K=function(){E(!1);try{d.current=!1}catch(t){}},Y=function(t){d.current=!1,P.current=!1,h.current.getContext("2d").clearRect(0,0,640,480),I(""),E(!0);try{U(t||!1)}catch(t){}},$=function(t,e,n){var o=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=J(t,e,n);o&&r.drawDetections(e,i.map((function(t){return t.detection})))},J=function(t,e,n){var r=t instanceof HTMLVideoElement?Ct(t):t,o=r.width,i=r.height;return e.width=o,e.height=i,function t(e,n){var r=new A(n.width,n.height),o=r.width,i=r.height;if(o<=0||i<=0)throw new Error("resizeResults - invalid dimensions: "+JSON.stringify({width:o,height:i}));if(Array.isArray(e))return e.map((function(e){return t(e,{width:o,height:i})}));if(ue(e)){var a=e.detection.forSize(o,i),s=e.unshiftedLandmarks.forSize(a.box.width,a.box.height);return ce(it(e,a),s)}return ot(e)?it(e,e.detection.forSize(o,i)):e instanceof Q||e instanceof H?e.forSize(o,i):e}(n,{width:o,height:i})};return Object(g.useEffect)((function(){L()}),[]),y.a.createElement("div",{className:er.a.wrp},y.a.createElement(T.a,{spinning:_,tip:"正在启动摄像头,请稍后..."},y.a.createElement("video",{onPlay:G,ref:c,id:"inputVideo",autoPlay:!0,muted:!0}),y.a.createElement("canvas",{style:{zIndex:2},ref:p}),y.a.createElement("canvas",{ref:h}),y.a.createElement("div",{className:"c-red mt5 tc",style:{height:22}},k," ",D)))})),ir=n("2LEM"),ar=n.n(ir),sr=n("LvDl"),ur=d.a.Countdown,cr=p.a.Step;e.default=Object(w.a)((function(t){var e=t.loading,n=t.user,r=t.exercise;return{globalSetting:t.globalSetting,user:n,exercise:r,loading:e.effects}}))((function(t){t.globalSetting,t.loading;var e,n=t.user,r=(t.exercise,t.dispatch,Object(h.a)(t,["globalSetting","loading","user","exercise","dispatch"]),Object(b.i)()),d=Object(g.useState)(0),m=Object(f.a)(d,2),w=m[0],x=m[1],S=Object(g.useState)(!1),T=Object(f.a)(S,2),I=T[0],O=T[1],R=Object(g.useState)(!1),A=Object(f.a)(R,2),D=A[0],N=A[1],P=Object(g.useState)(!1),M=Object(f.a)(P,2),j=M[0],F=M[1],B=Object(g.useState)(0),L=Object(f.a)(B,2),U=L[0],W=L[1],z=Object(g.useState)({}),V=Object(f.a)(z,2),q=V[0],G=V[1],H=Object(g.useRef)(),X=Object(g.useRef)(!0),K=[{title:"采集照片",content:"First-content"},{title:"审核结果",content:"Second-content"},{title:"开启手机录制",content:"Last-content"}].filter((function(t){return!(null==q||!q.open_phone_video_recording)||"Last-content"!==t.content})),Y=function(){var t=Object(l.a)(v.a.mark((function t(){return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise(function(){var t=Object(l.a)(v.a.mark((function t(e){var n;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Object(C.P)(Object(c.a)({},r));case 2:n=t.sent,G(Object(c.a)({},n)),e(n);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()));case 1:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),$=function(){var t=Object(l.a)(v.a.mark((function t(){var e,n;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y();case 2:null!=(e=t.sent)&&e.identity_verify||x(2),null!=e&&e.can_start&&0===e.countdown_time?x(2):"rejected"===(null==e?void 0:e.identity_photo_state)?(X.current=!1,W(1)):"passed"===(null==e?void 0:e.identity_photo_state)&&(X.current=!1,null==H||null===(n=H.current)||void 0===n||n.handleStop(),null!=q&&q.open_phone_video_recording||x(2));case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),J=function(){var t=Object(l.a)(v.a.mark((function t(){var e,n;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y();case 2:"submitted"===(null==(e=t.sent)?void 0:e.identity_photo_state)||("rejected"===(null==e?void 0:e.identity_photo_state)?(X.current=!1,W(2)):"passed"===(null==e?void 0:e.identity_photo_state)&&(X.current=!1,null==H||null===(n=H.current)||void 0===n||n.handleStop(),W(1),null!=q&&q.open_phone_video_recording||x(2))),"passed"!==(null==e?void 0:e.identity_photo_state)&&X.current&&setTimeout((function(){J()}),3e4);case 5:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return Object(g.useEffect)((function(){return $(),console.log("captureRef:",H),function(){W(0),F(!1),N(!1),x(0)}}),[]),y.a.createElement("div",{className:"p30 bg-white minHb100 edu-container mt20"},(null==q?void 0:q.identity_verify)&&y.a.createElement(y.a.Fragment,null,y.a.createElement("div",{className:"tc font16 blod"},"身份验证"),y.a.createElement("div",{className:_.a.steps},y.a.createElement(p.a,{current:w},K.map((function(t){return y.a.createElement(cr,{key:t.title,title:t.title})}))))),y.a.createElement("div",{className:0===w?"":"hide"},y.a.createElement("div",{className:"tc mt50"},"请保证周围光线充足,五官清晰可见!"),!D&&y.a.createElement("div",{className:"tc"},y.a.createElement("img",{width:536,src:ar.a,className:"mt30"})),y.a.createElement("div",{className:D?"":"hide"},y.a.createElement(or,{ref:H,onCameraReady:function(t){O(t)},defaultOpen:null==q?void 0:q.identity_verify,identity_url:Object(E.g)(null==n||null===(e=n.userInfo)||void 0===e?void 0:e.identity_url),outputResult:function(t){t.success?(u.b.success({content:"人脸识别成功",key:"checkapi"}),x(2)):F(!0),O(!1)}})),D&&y.a.createElement(y.a.Fragment,null,j?y.a.createElement("div",{className:"tc mb30 mt15"},y.a.createElement(s.a,{type:"primary",onClick:function(){var t;null==H||null===(t=H.current)||void 0===t||t.handlePlay(),G(Object(c.a)({},{})),F(!1)}},"重新识别"),y.a.createElement(s.a,{type:"primary",className:"ml90",onClick:Object(l.a)(v.a.mark((function t(){var e;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,null==H||null===(e=H.current)||void 0===e?void 0:e.handleUploadImage(0);case 2:X.current=!0,x(1),W(0),F(!1),J();case 7:case"end":return t.stop()}}),t)})))},"人工审核")):I&&y.a.createElement("div",{className:"tc mb30 mt15"},y.a.createElement(s.a,{type:"primary",onClick:Object(sr.throttle)((function(){var t;O(!1),null==H||null===(t=H.current)||void 0===t||t.startDiscern()}),2e3)},"开始识别"))),!D&&y.a.createElement("div",{className:"tc mb30 mt15"},y.a.createElement(s.a,{type:"primary",onClick:function(){N(!0)}},"开始采集"))),1===w&&y.a.createElement("div",{className:"tc"},0===U&&y.a.createElement(y.a.Fragment,null,y.a.createElement("div",{className:"tc mt50"},y.a.createElement("span",{className:"c-blue font50 iconfont icon-dengdaishenhe"}),y.a.createElement("br",null),"人工审核中...",y.a.createElement("br",null),"申请已提交,监控老师审核中,请耐心等待!"),y.a.createElement(s.a,{type:"primary",className:"mt50",onClick:Object(l.a)(v.a.mark((function t(){var e;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y();case 2:"submitted"===(null==(e=t.sent)?void 0:e.identity_photo_state)?u.b.warn({content:"正在等待老师审核中,请稍后...",key:"sh1"}):"rejected"===(null==e?void 0:e.identity_photo_state)?(W(2),X.current=!1):"passed"===(null==e?void 0:e.identity_photo_state)&&(X.current=!1,W(1),null!=q&&q.open_phone_video_recording||x(2));case 4:case"end":return t.stop()}}),t)})))},"查看审核结果")),1===U&&y.a.createElement(y.a.Fragment,null,y.a.createElement("div",{className:"tc mt50"},y.a.createElement("span",{className:"c-green font50 iconfont icon-tongguo"}),y.a.createElement("br",null),"身份验证审核通过。"),(null==q?void 0:q.open_phone_video_recording)&&y.a.createElement(s.a,{type:"primary",className:"mt50",onClick:function(){return x(2)}},"下一步")),2===U&&y.a.createElement(y.a.Fragment,null,y.a.createElement("div",{className:"tc mt50"},y.a.createElement("span",{className:"c-red font50 iconfont icon-hongsejingshi"}),y.a.createElement("br",null),"身份验证审核不通过。请重新拍照验证。"),y.a.createElement("div",{className:"mt20"},y.a.createElement(i.a,null,y.a.createElement(a.a,{className:"tr",flex:"430px"},"失败原因:"),y.a.createElement(a.a,null,null==q?void 0:q.identity_photo_comment)),y.a.createElement(i.a,{className:"mt30"},y.a.createElement(a.a,{className:"tr",flex:"430px"},"采集照片:"),y.a.createElement(a.a,null,y.a.createElement("img",{src:Object(E.g)(null==q?void 0:q.identity_photo_url),width:200}))),y.a.createElement(i.a,null,y.a.createElement(a.a,{className:"tr",flex:"430px"}),y.a.createElement(a.a,null,y.a.createElement(s.a,{type:"primary",className:"mt50",onClick:function(){var t;x(0),O(!1),F(!1),N(!1),null==H||null===(t=H.current)||void 0===t||t.handlePlay()}},"重新认证")))))),2===w&&y.a.createElement(y.a.Fragment,null,y.a.createElement("div",{className:"tc mt50"},!(null!=q&&q.open_phone_video_recording)&&y.a.createElement(y.a.Fragment,null,(null==q?void 0:q.countdown_time)<=0?y.a.createElement(y.a.Fragment,null,y.a.createElement("div",{className:"tc mt50"},y.a.createElement("span",{className:"c-green font50 iconfont icon-tongguo"}),y.a.createElement("br",null),"身份验证审核通过。")):"考试即将开始,请耐心等待..."),(null==q?void 0:q.open_phone_video_recording)&&y.a.createElement(y.a.Fragment,null,(null==q?void 0:q.countdown_time)<=0?y.a.createElement("div",{className:"tc"},"根据考试规定,请打开微信扫一扫,扫码下面的二维码开启手机录制视频",y.a.createElement("br",null),y.a.createElement("span",{className:"c-blue",style:{cursor:"default"},onClick:function(){o.a.info({icon:null,title:"查看操作指引",className:"custom-modal-divider",width:540,content:y.a.createElement(i.a,null,y.a.createElement(a.a,{flex:"178px"},y.a.createElement("img",{width:148,src:"/images/operation_guidance.png"})),y.a.createElement(a.a,{flex:"1"},"请点击右上角“…”,选择",y.a.createElement("span",{className:"c-orange"},"Safari中打开"),"或者",y.a.createElement("span",{className:"c-orange"},"“在默认浏览器中打开”"),"后,浏览器打开后请点击开始录制按钮,可以开启手机录制视频。"))})}},"如苹果手机微信扫描二维码后,出现点击开始录制无响应,请查看操作指引。")):"考试即将开始,请耐心等待...")),(null==q?void 0:q.open_phone_video_recording)&&y.a.createElement("div",{className:_.a.qrcode},y.a.createElement(k.a,{value:"https://".concat(document.domain,"/live-push.html?id=").concat(r.categoryId,"&login=").concat(r.login,"&cookie=").concat(Object(E.E)("_educoder_session"))})),(null==q?void 0:q.countdown_time)>0&&y.a.createElement("div",{className:"tc mt20"},y.a.createElement(ur,{value:Date.now()+1e3*(null==q?void 0:q.countdown_time),valueStyle:{color:"#cf1322",fontSize:40},onFinish:function(){Y()}})),y.a.createElement("div",{className:"tc mb30 mt50"},y.a.createElement(s.a,{type:"primary",onClick:Object(l.a)(v.a.mark((function t(){var e,n;return v.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y();case 2:null!=(e=t.sent)&&e.can_start&&(null==e?void 0:e.countdown_time)<=0?(null==H||null===(n=H.current)||void 0===n||n.handleRemove(),null!=q&&q.open_phone_video_recording?null!=e&&e.video_url&&setTimeout((function(){location.href="/classrooms/".concat(r.coursesId,"/exercise/").concat(r.categoryId,"/users/").concat(r.login)}),300):setTimeout((function(){location.href="/classrooms/".concat(r.coursesId,"/exercise/").concat(r.categoryId,"/users/").concat(r.login)}),300)):(null==e?void 0:e.countdown_time)>0?u.b.warn({content:"考试暂未开始,请稍后..."}):u.b.warn({content:"请打开微信扫一扫,开启手机视频录制"});case 4:case"end":return t.stop()}}),t)})))},"开始考试"))))}))},jO9C:
/*!************************************************!*\
!*** ./node_modules/crypto-js/pad-iso97971.js ***!
\************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),r.pad.Iso97971={pad:function(t,e){t.concat(r.lib.WordArray.create([2147483648],1)),r.pad.ZeroPadding.pad(t,e)},unpad:function(t){r.pad.ZeroPadding.unpad(t),t.sigBytes--}},r.pad.Iso97971)},"kVK+":
/*!***************************************!*\
!*** ./node_modules/ieee754/index.js ***!
\***************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e){
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
e.read=function(t,e,n,r,o){var i,a,s=8*o-r-1,u=(1<<s)-1,c=u>>1,l=-7,f=n?o-1:0,h=n?-1:1,p=t[e+f];for(f+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+t[e+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+t[e+f],f+=h,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=c}return(p?-1:1)*a*Math.pow(2,i-r)},e.write=function(t,e,n,r,o,i){var a,s,u,c=8*i-o-1,l=(1<<c)-1,f=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,o),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;t[n+p]=255&s,p+=d,s/=256,o-=8);for(a=a<<o|s,c+=o;c>0;t[n+p]=255&a,p+=d,a/=256,c-=8);t[n+p-d]|=128*m}},lPiR:
/*!******************************************!*\
!*** ./node_modules/crypto-js/sha256.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),function(t){var e=r,n=e.lib,o=n.WordArray,i=n.Hasher,a=e.algo,s=[],u=[];!function(){function e(e){for(var n=t.sqrt(e),r=2;r<=n;r++)if(!(e%r))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var r=2,o=0;o<64;)e(r)&&(o<8&&(s[o]=n(t.pow(r,.5))),u[o]=n(t.pow(r,1/3)),o++),r++}();var c=[],l=a.SHA256=i.extend({_doReset:function(){this._hash=new o.init(s.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],o=n[1],i=n[2],a=n[3],s=n[4],l=n[5],f=n[6],h=n[7],p=0;p<64;p++){if(p<16)c[p]=0|t[e+p];else{var d=c[p-15],m=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,v=c[p-2],g=(v<<15|v>>>17)^(v<<13|v>>>19)^v>>>10;c[p]=m+c[p-7]+g+c[p-16]}var y=r&o^r&i^o&i,b=(r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22),w=h+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&l^~s&f)+u[p]+c[p];h=f,f=l,l=s,s=a+w|0,a=i,i=o,o=r,r=w+(b+y)|0}n[0]=n[0]+r|0,n[1]=n[1]+o|0,n[2]=n[2]+i|0,n[3]=n[3]+a|0,n[4]=n[4]+s|0,n[5]=n[5]+l|0,n[6]=n[6]+f|0,n[7]=n[7]+h|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,o=8*e.sigBytes;return n[o>>>5]|=128<<24-o%32,n[14+(o+64>>>9<<4)]=t.floor(r/4294967296),n[15+(o+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=i._createHelper(l),e.HmacSHA256=i._createHmacHelper(l)}(Math),r.SHA256)},mrSG:
/*!*****************************************!*\
!*** ./node_modules/tslib/tslib.es6.js ***!
\*****************************************/
/*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __createBinding, __exportStar, __values, __read, __spread, __spreadArrays, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault, __classPrivateFieldGet, __classPrivateFieldSet */
/*! exports used: __assign, __awaiter, __extends, __generator, __spreadArrays */function(t,e,n){"use strict";n.d(e,"c",(function(){return o})),n.d(e,"a",(function(){return i})),n.d(e,"b",(function(){return a})),n.d(e,"d",(function(){return s})),n.d(e,"e",(function(){return u}));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function o(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var i=function(){return(i=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++)for(var o in e=arguments[n])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)};function a(t,e,n,r){return new(n||(n=Promise))((function(o,i){function a(t){try{u(r.next(t))}catch(t){i(t)}}function s(t){try{u(r.throw(t))}catch(t){i(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(a,s)}u((r=r.apply(t,e||[])).next())}))}function s(t,e){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=a.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=e.call(t,a)}catch(t){i=[6,t],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}function u(){for(var t=0,e=0,n=arguments.length;e<n;e++)t+=arguments[e].length;var r=Array(t),o=0;for(e=0;e<n;e++)for(var i=arguments[e],a=0,s=i.length;a<s;a++,o++)r[o]=i[a];return r}},mxV5:
/*!*****************************************************!*\
!*** ./node_modules/ali-oss/dist/aliyun-oss-sdk.js ***!
\*****************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(module,exports,__webpack_require__){(function(global){var require,require,f;f=function(){var define,module,exports;return function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){if(!s&&"function"==typeof require&&require)return require(a,!0);if(i)return i(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};e[a][0].call(c.exports,(function(t){return o(e[a][1][t]||t)}),c,c.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a<r.length;a++)o(r[a]);return o}({1:[function(t,e,n){"use strict";var r=t("./browser/client");r.Buffer=t("buffer").Buffer,r.urllib=t("../shims/xhr"),r.version=t("./browser/version").version,e.exports=r},{"../shims/xhr":291,"./browser/client":2,"./browser/version":5,buffer:73}],2:[function(t,e,n){(function(n,r){"use strict";var o=s(t("babel-runtime/core-js/promise")),i=s(t("babel-runtime/regenerator")),a=s(t("babel-runtime/core-js/object/assign"));function s(t){return t&&t.__esModule?t:{default:t}}var u=t("debug")("ali-oss"),c=t("copy-to"),l=t("xml2js"),f=t("agentkeepalive"),h=t("merge-descriptors"),p=t("url"),d=t("is-type-of"),m=t("platform"),v=t("utility"),g=t("urllib"),y=t("./version"),b=t("bowser"),w=t("../common/signUtils"),x=t("../common/utils/isIP").isIP,_=t("../common/client/initOptions"),E=t("../common/utils/createRequest").createRequest,C=new f;function S(t,e){var n,r;if(n=m.name,r=m.version,n&&n.toLowerCase&&"ie"===n.toLowerCase()&&r.split(".")[0]<10&&console.warn("ali-oss does not support the current browser"),!(this instanceof S))return new S(t,e);t&&t.inited?this.options=t:this.options=S.initOptions(t),this.options.cancelFlag=!1,this.options.urllib?this.urllib=this.options.urllib:(this.urllib=g,this.agent=this.options.agent||C),this.ctx=e,this.userAgent=this._getUserAgent(),this.options.amendTimeSkewed=0}e.exports=S,S.initOptions=function(t){t.stsToken||console.warn("Please use STS Token for safety, see more details at https://help.aliyun.com/document_detail/32077.html");var e=(0,a.default)({secure:location&&"https:"===location.protocol,useFetch:!1},t);return _(e)};var k=S.prototype;k.debug=u,h(k,t("./object")),h(k,t("../common/bucket/getBucketWebsite")),h(k,t("../common/bucket/putBucketWebsite")),h(k,t("../common/bucket/deleteBucketWebsite")),h(k,t("../common/bucket/getBucketLifecycle")),h(k,t("../common/bucket/putBucketLifecycle")),h(k,t("../common/bucket/deleteBucketLifecycle")),h(k,t("../common/bucket/putBucketVersioning")),h(k,t("../common/bucket/getBucketVersioning")),h(k,t("./managed-upload")),h(k,t("../common/multipart")),h(k,t("../common/parallel")),k.signature=function(t){return this.debug("authorization stringToSign: %s",t,"info"),w.computeSignature(this.options.accessKeySecret,t)},k.authorization=function(t,e,n,r){var o=w.buildCanonicalString(t.toUpperCase(),e,{headers:r,parameters:n});return w.authorization(this.options.accessKeyId,this.options.accessKeySecret,o)},k.request=function(t){var e,n,r,o,a,s;return i.default.async((function(u){for(;;)switch(u.prev=u.next){case 0:return e=E.call(this,t),this.options.useFetch||(e.params.mode="disable-fetch"),n=void 0,r=void 0,o=!!t.stream,u.prev=5,u.next=8,i.default.awrap(this.urllib.request(e.url,e.params));case 8:n=u.sent,this.debug("response %s %s, got %s, headers: %j",t.method,e.url,n.status,n.headers,"info"),u.next=15;break;case 12:u.prev=12,u.t0=u.catch(5),r=u.t0;case 15:if(a=void 0,!n||!t.successStatuses||-1!==t.successStatuses.indexOf(n.status)){u.next=28;break}return u.next=19,i.default.awrap(this.requestError(n));case 19:if("RequestTimeTooSkewed"!==(a=u.sent).code||o){u.next=25;break}return this.options.amendTimeSkewed=+new Date(a.serverTime)-new Date,u.next=24,i.default.awrap(this.request(t));case 24:return u.abrupt("return",u.sent);case 25:a.params=t,u.next=32;break;case 28:if(!r){u.next=32;break}return u.next=31,i.default.awrap(this.requestError(r));case 31:a=u.sent;case 32:if(!a){u.next=34;break}throw a;case 34:if(!t.xmlResponse){u.next=39;break}return u.next=37,i.default.awrap(this.parseXML(n.data));case 37:s=u.sent,n.data=s;case 39:return u.abrupt("return",n);case 40:case"end":return u.stop()}}),null,this,[[5,12]])},k._getResource=function(t){var e="/";return t.bucket&&(e+=t.bucket+"/"),t.object&&(e+=t.object),e},k._isIP=x,k._escape=function(t){return v.encodeURIComponent(t).replace(/%2F/g,"/")},k._getReqUrl=function(t){var e={};c(this.options.endpoint).to(e);var n=this._isIP(e.hostname),r=this.options.cname;!t.bucket||r||n||(e.host=t.bucket+"."+e.host);var o="/";t.bucket&&n&&(o+=t.bucket+"/"),t.object&&(o+=this._escape(t.object).replace(/\+/g,"%2B")),e.pathname=o;var i={};if(t.query&&h(i,t.query),t.subres){var a={};d.string(t.subres)?a[t.subres]="":d.array(t.subres)?t.subres.forEach((function(t){a[t]=""})):a=t.subres,h(i,a)}return e.query=i,p.format(e)},k._getUserAgent=function(){var t="aliyun-sdk-"+(r&&r.browser?"js":"nodejs")+"/"+y.version,e=m.description;return!e&&r&&(e="Node.js "+r.version.slice(1)+" on "+r.platform+" "+r.arch),this._checkUserAgent(t+" "+e)},k._checkUserAgent=function(t){return t.replace(/\u03b1/,"alpha").replace(/\u03b2/,"beta")},k.checkBrowserAndVersion=function(t,e){return b.name===t&&b.version.split(".")[0]===e},k.parseXML=function(t){return new o.default((function(e,r){n.isBuffer(t)&&(t=t.toString()),l.parseString(t,{explicitRoot:!1,explicitArray:!1},(function(t,n){t?r(t):e(n)}))}))},k.requestError=function(t){var e,n,r,o;return i.default.async((function(a){for(;;)switch(a.prev=a.next){case 0:if(e=null,t.data&&t.data.length){a.next=5;break}-1===t.status||-2===t.status?((e=new Error(t.message)).name=t.name,e.status=t.status,e.code=t.name):(404===t.status?((e=new Error("Object not exists")).name="NoSuchKeyError",e.status=404,e.code="NoSuchKey"):412===t.status?((e=new Error("Pre condition failed")).name="PreconditionFailedError",e.status=412,e.code="PreconditionFailed"):((e=new Error("Unknow error, status: "+t.status)).name="UnknowError",e.status=t.status),e.requestId=t.headers["x-oss-request-id"],e.host=""),a.next=33;break;case 5:return n=String(t.data),this.debug("request response error data: %s",n,"error"),r=void 0,a.prev=8,a.next=11,i.default.awrap(this.parseXML(n));case 11:if(a.t0=a.sent,a.t0){a.next=14;break}a.t0={};case 14:r=a.t0,a.next=24;break;case 17:return a.prev=17,a.t1=a.catch(8),this.debug(n,"error"),a.t1.message+="\nraw xml: "+n,a.t1.status=t.status,a.t1.requestId=t.headers["x-oss-request-id"],a.abrupt("return",a.t1);case 24:o=r.Message||"unknow request error, status: "+t.status,r.Condition&&(o+=" (condition: "+r.Condition+")"),(e=new Error(o)).name=r.Code?r.Code+"Error":"UnknowError",e.status=t.status,e.code=r.Code,e.requestId=r.RequestId,e.hostId=r.HostId,e.serverTime=r.ServerTime;case 33:return this.debug("generate error %j",e,"error"),a.abrupt("return",e);case 35:case"end":return a.stop()}}),null,this,[[8,17]])}}).call(this,{isBuffer:t("../../node_modules/is-buffer/index.js")},t("_process"))},{"../../node_modules/is-buffer/index.js":197,"../common/bucket/deleteBucketLifecycle":6,"../common/bucket/deleteBucketWebsite":7,"../common/bucket/getBucketLifecycle":8,"../common/bucket/getBucketVersioning":9,"../common/bucket/getBucketWebsite":10,"../common/bucket/putBucketLifecycle":11,"../common/bucket/putBucketVersioning":12,"../common/bucket/putBucketWebsite":13,"../common/client/initOptions":15,"../common/multipart":18,"../common/parallel":33,"../common/signUtils":34,"../common/utils/createRequest":38,"../common/utils/isIP":45,"./managed-upload":3,"./object":4,"./version":5,_process:208,agentkeepalive:48,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,bowser:70,"copy-to":76,debug:288,"is-type-of":289,"merge-descriptors":200,platform:206,url:238,urllib:291,utility:290,xml2js:249}],3:[function(t,e,n){(function(e){"use strict";var r=a(t("babel-runtime/core-js/array/from")),o=a(t("babel-runtime/core-js/promise")),i=a(t("babel-runtime/regenerator"));function a(t){return t&&t.__esModule?t:{default:t}}var s=t("is-type-of"),u=t("util"),c=t("path"),l=t("mime"),f=t("copy-to"),h=t("../common/utils/isBlob").isBlob,p=t("../common/utils/isFile").isFile,d=n;d.multipartUpload=function(t,e,n){var r,o,a,s,u,f,d,m,v;return i.default.async((function(g){for(;;)switch(g.prev=g.next){case 0:if(this.resetCancelFlag(),!(n=n||{}).checkpoint||!n.checkpoint.uploadId){g.next=6;break}return g.next=5,i.default.awrap(this._resumeMultipart(n.checkpoint,n));case 5:return g.abrupt("return",g.sent);case 6:return r=102400,n.mime||(p(e)?n.mime=l.getType(c.extname(e.name)):h(e)?n.mime=e.type:n.mime=l.getType(c.extname(e))),n.headers=n.headers||{},this._convertMetaToHeaders(n.meta,n.headers),g.next=12,i.default.awrap(this._getFileSize(e));case 12:if(!((o=g.sent)<r)){g.next=25;break}return a=this._createStream(e,0,o),n.contentLength=o,g.next=18,i.default.awrap(this.putStream(t,a,n));case 18:if(s=g.sent,!n||!n.progress){g.next=22;break}return g.next=22,i.default.awrap(n.progress(1));case 22:return u={res:s.res,bucket:this.options.bucket,name:t,etag:s.res.headers.etag},(n.headers&&n.headers["x-oss-callback"]||n.callback)&&(u.data=s.data),g.abrupt("return",u);case 25:if(!n.partSize||parseInt(n.partSize,10)===n.partSize){g.next=27;break}throw new Error("partSize must be int number");case 27:if(!(n.partSize&&n.partSize<r)){g.next=29;break}throw new Error("partSize must not be smaller than "+r);case 29:return g.next=31,i.default.awrap(this.initMultipartUpload(t,n));case 31:if(f=g.sent,d=f.uploadId,m=this._getPartSize(o,n.partSize),v={file:e,name:t,fileSize:o,partSize:m,uploadId:d,doneParts:[]},!n||!n.progress){g.next=38;break}return g.next=38,i.default.awrap(n.progress(0,v,f.res));case 38:return g.next=40,i.default.awrap(this._resumeMultipart(v,n));case 40:return g.abrupt("return",g.sent);case 41:case"end":return g.stop()}}),null,this)},d._resumeMultipart=function(t,e){var n,a,s,u,c,l,h,p,d,m,v,g,y,b,w,x,_;return i.default.async((function(E){for(;;)switch(E.prev=E.next){case 0:if(n=this,!this.isCancel()){E.next=3;break}throw this._makeCancelEvent();case 3:return a=t.file,s=t.fileSize,u=t.partSize,c=t.uploadId,l=t.doneParts,h=t.name,p=[],l.length>0&&f(l).to(p),d=this._divideParts(s,u),m=d.length,v=!1,g=function(n,r){var s=this;return new o.default((function(o,u){var p,g,y,b;return i.default.async((function(s){for(;;)switch(s.prev=s.next){case 0:if(s.prev=0,n.isCancel()){s.next=18;break}return p=d[r-1],g={stream:n._createStream(a,p.start,p.end),size:p.end-p.start},s.next=6,i.default.awrap(n._uploadPart(h,c,r,g));case 6:if(y=s.sent,n.isCancel()||v){s.next=15;break}if(t.doneParts.push({number:r,etag:y.res.headers.etag}),!e.progress){s.next=12;break}return s.next=12,i.default.awrap(e.progress(l.length/m,t,y.res));case 12:o({number:r,etag:y.res.headers.etag}),s.next=16;break;case 15:o();case 16:s.next=19;break;case 18:o();case 19:s.next=30;break;case 21:s.prev=21,s.t0=s.catch(0),(b=new Error).name=s.t0.name,b.message=s.t0.message,b.stack=s.t0.stack,b.partNum=r,f(s.t0).to(b),u(b);case 30:case"end":return s.stop()}}),null,s,[[0,21]])}))},y=(0,r.default)(new Array(m),(function(t,e){return e+1})),b=p.map((function(t){return t.number})),w=y.filter((function(t){return b.indexOf(t)<0})),x=e.parallel||5,E.next=17,i.default.awrap(this._parallel(w,x,(function(t){return new o.default((function(e,r){g(n,t).then((function(t){t&&p.push(t),e()})).catch((function(t){r(t)}))}))})));case 17:if(_=E.sent,v=!0,!this.isCancel()){E.next=22;break}throw g=null,this._makeCancelEvent();case 22:if(!(_&&_.length>0)){E.next=25;break}throw _[0].message="Failed to upload some parts with error: "+_[0].toString()+" part_num: "+_[0].partNum,_[0];case 25:return E.next=27,i.default.awrap(this.completeMultipartUpload(h,c,p,e));case 27:return E.abrupt("return",E.sent);case 28:case"end":return E.stop()}}),null,this)},d._getFileSize=function(t){return i.default.async((function(e){for(;;)switch(e.prev=e.next){case 0:if(!s.buffer(t)){e.next=4;break}return e.abrupt("return",t.length);case 4:if(!h(t)&&!p(t)){e.next=6;break}return e.abrupt("return",t.size);case 6:throw new Error("_getFileSize requires Buffer/File/Blob.");case 7:case"end":return e.stop()}}),null,this)};var m=t("stream").Readable;function v(t,e){if(!(this instanceof v))return new v(t,e);m.call(this,e),this.file=t,this.reader=new FileReader,this.start=0,this.finish=!1,this.fileBuffer=null}u.inherits(v,m),v.prototype.readFileAndPush=function(t){if(this.fileBuffer)for(var e=!0;e&&this.fileBuffer&&this.start<this.fileBuffer.length;){var n=this.start,r=n+t;r=r>this.fileBuffer.length?this.fileBuffer.length:r,this.start=r,e=this.push(this.fileBuffer.slice(n,r))}},v.prototype._read=function(t){if(this.file&&this.start>=this.file.size||this.fileBuffer&&this.start>=this.fileBuffer.length||this.finish||0===this.start&&!this.file)return this.finish||(this.fileBuffer=null,this.finish=!0),void this.push(null);t=t||16384;var n=this;this.reader.onload=function(r){n.fileBuffer=e.from(new Uint8Array(r.target.result)),n.file=null,n.readFileAndPush(t)},0===this.start?this.reader.readAsArrayBuffer(this.file):this.readFileAndPush(t)},d._createStream=function(t,e,n){if(h(t)||p(t))return new v(t.slice(e,n));throw new Error("_createStream requires File/Blob.")},d._getPartSize=function(t,e){return e?Math.max(Math.ceil(t/1e4),e):1048576},d._divideParts=function(t,e){for(var n=Math.ceil(t/e),r=[],o=0;o<n;o++){var i=e*o,a=Math.min(i+e,t);r.push({start:i,end:a})}return r}}).call(this,t("buffer").Buffer)},{"../common/utils/isBlob":43,"../common/utils/isFile":44,"babel-runtime/core-js/array/from":52,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,buffer:73,"copy-to":76,"is-type-of":289,mime:202,path:205,stream:230,util:243}],4:[function(t,e,n){"use strict";var r=s(t("babel-runtime/core-js/promise")),o=s(t("babel-runtime/core-js/object/keys")),i=s(t("babel-runtime/core-js/object/assign")),a=s(t("babel-runtime/regenerator"));function s(t){return t&&t.__esModule?t:{default:t}}var u=t("utility"),c=t("fs"),l=t("is-type-of"),f=t("url"),h=t("copy-to"),p=t("path"),d=t("mime"),m=t("../common/callback"),v=t("../common/signUtils"),g=t("merge-descriptors"),y=t("../common/utils/isBlob").isBlob,b=t("../common/utils/isFile").isFile,w=n;w.append=function(t,e,n){var r;return a.default.async((function(o){for(;;)switch(o.prev=o.next){case 0:return void 0===(n=n||{}).position&&(n.position="0"),n.subres={append:"",position:n.position},n.method="POST",o.next=6,a.default.awrap(this.put(t,e,n));case 6:return(r=o.sent).nextAppendPosition=r.res.headers["x-oss-next-append-position"],o.abrupt("return",r);case 9:case"end":return o.stop()}}),null,this)},w.put=function(t,e,n){var r,o,i,s,u,c,f;return a.default.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(r=void 0,n=n||{},t=this._objectName(t),!l.buffer(e)){h.next=7;break}r=e,h.next=33;break;case 7:if(!y(e)&&!b(e)){h.next=32;break}return n.mime||(b(e)?n.mime=d.getType(p.extname(e.name)):n.mime=e.type),o=this._createStream(e,0,e.size),h.next=12,a.default.awrap(this._getFileSize(e));case 12:return n.contentLength=h.sent,h.prev=13,h.next=16,a.default.awrap(this.putStream(t,o,n));case 16:return i=h.sent,h.abrupt("return",i);case 20:if(h.prev=20,h.t0=h.catch(13),"RequestTimeTooSkewed"!==h.t0.code){h.next=29;break}return this.options.amendTimeSkewed=+new Date(h.t0.serverTime)-new Date,h.next=26,a.default.awrap(this.put(t,e,n));case 26:return h.abrupt("return",h.sent);case 29:throw h.t0;case 30:h.next=33;break;case 32:throw new TypeError("Must provide Buffer/Blob/File for put.");case 33:return n.headers=n.headers||{},this._convertMetaToHeaders(n.meta,n.headers),s=n.method||"PUT",u=this._objectRequestParams(s,t,n),m.encodeCallback(u,n),u.mime=n.mime,u.content=r,u.successStatuses=[200],h.next=43,a.default.awrap(this.request(u));case 43:return c=h.sent,f={name:t,url:this._objectUrl(t),res:c.res},u.headers&&u.headers["x-oss-callback"]&&(f.data=JSON.parse(c.data.toString())),h.abrupt("return",f);case 47:case"end":return h.stop()}}),null,this,[[13,20]])},w.putStream=function(t,e,n){var r,o,i,s;return a.default.async((function(u){for(;;)switch(u.prev=u.next){case 0:return(n=n||{}).headers=n.headers||{},t=this._objectName(t),n.contentLength?n.headers["Content-Length"]=n.contentLength:n.headers["Transfer-Encoding"]="chunked",this._convertMetaToHeaders(n.meta,n.headers),r=n.method||"PUT",o=this._objectRequestParams(r,t,n),m.encodeCallback(o,n),o.mime=n.mime,o.stream=e,o.successStatuses=[200],u.next=13,a.default.awrap(this.request(o));case 13:return i=u.sent,s={name:t,url:this._objectUrl(t),res:i.res},o.headers&&o.headers["x-oss-callback"]&&(s.data=JSON.parse(i.data.toString())),u.abrupt("return",s);case 17:case"end":return u.stop()}}),null,this)},g(w,t("../common/object/copyObject")),g(w,t("../common/object/getObjectTagging")),g(w,t("../common/object/putObjectTagging")),g(w,t("../common/object/deleteObjectTagging")),g(w,t("../common/image")),g(w,t("../common/object/getBucketVersions")),g(w,t("../common/object/getACL")),g(w,t("../common/object/putACL")),g(w,t("../common/object/head")),g(w,t("../common/object/delete")),g(w,t("../common/object/get")),g(w,t("../common/object/putSymlink")),g(w,t("../common/object/getSymlink")),g(w,t("../common/object/deleteMulti")),g(w,t("../common/object/getObjectMeta")),w.putMeta=function(t,e,n){var r;return a.default.async((function(o){for(;;)switch(o.prev=o.next){case 0:return o.next=2,a.default.awrap(this.copy(t,t,{meta:e||{},timeout:n&&n.timeout,ctx:n&&n.ctx}));case 2:return r=o.sent,o.abrupt("return",r);case 4:case"end":return o.stop()}}),null,this)},w.list=function(t,e){var n,r,o,i,s;return a.default.async((function(u){for(;;)switch(u.prev=u.next){case 0:return(n=this._objectRequestParams("GET","",e)).query=t,n.xmlResponse=!0,n.successStatuses=[200],u.next=6,a.default.awrap(this.request(n));case 6:return r=u.sent,o=r.data.Contents,i=this,o&&(Array.isArray(o)||(o=[o]),o=o.map((function(t){return{name:t.Key,url:i._objectUrl(t.Key),lastModified:t.LastModified,etag:t.ETag,type:t.Type,size:Number(t.Size),storageClass:t.StorageClass,owner:{id:t.Owner.ID,displayName:t.Owner.DisplayName}}}))),(s=r.data.CommonPrefixes||null)&&(Array.isArray(s)||(s=[s]),s=s.map((function(t){return t.Prefix}))),u.abrupt("return",{res:r.res,objects:o,prefixes:s,nextMarker:r.data.NextMarker||null,isTruncated:"true"===r.data.IsTruncated});case 13:case"end":return u.stop()}}),null,this)},w.restore=function(t,e){var n,r;return a.default.async((function(o){for(;;)switch(o.prev=o.next){case 0:return(e=e||{}).subres=(0,i.default)({restore:""},e.subres),e.versionId&&(e.subres.versionId=e.versionId),(n=this._objectRequestParams("POST",t,e)).successStatuses=[202],o.next=7,a.default.awrap(this.request(n));case 7:return r=o.sent,o.abrupt("return",{res:r.res});case 9:case"end":return o.stop()}}),null,this)},w.signatureUrl=function(t,e){e=e||{},t=this._objectName(t),e.method=e.method||"GET";var n=u.timestamp()+(e.expires||1800),r={bucket:this.options.bucket,object:t},o=this._getResource(r);this.options.stsToken&&(e["security-token"]=this.options.stsToken);var i=v._signatureForURL(this.options.accessKeySecret,e,o,n),a=f.parse(this._getReqUrl(r));return a.query={OSSAccessKeyId:this.options.accessKeyId,Expires:n,Signature:i.Signature},h(i.subResource).to(a.query),a.format()},w.getObjectUrl=function(t,e){return e?"/"!==e[e.length-1]&&(e+="/"):e=this.options.endpoint.format(),e+this._escape(this._objectName(t))},w._objectUrl=function(t){return this._getReqUrl({bucket:this.options.bucket,object:t})},w.generateObjectUrl=function(t,e){if(e)"/"!==e[e.length-1]&&(e+="/");else{e=this.options.endpoint.format();var n=f.parse(e),r=this.options.bucket;n.hostname=r+"."+n.hostname,n.host=r+"."+n.host,e=n.format()}return e+this._escape(this._objectName(t))},w._objectRequestParams=function(t,e,n){if(!this.options.bucket)throw new Error("Please create a bucket first");n=n||{};var r={object:e=this._objectName(e),bucket:this.options.bucket,method:t,subres:n&&n.subres,timeout:n&&n.timeout,ctx:n&&n.ctx};return n.headers&&(r.headers={},h(n.headers).to(r.headers)),r},w._objectName=function(t){return t.replace(/^\/+/,"")},w._convertMetaToHeaders=function(t,e){t&&(0,o.default)(t).forEach((function(n){e["x-oss-meta-"+n]=t[n]}))},w._deleteFileSafe=function(t){var e=this;return new r.default((function(n){c.exists(t,(function(r){r?c.unlink(t,(function(r){r&&e.debug("unlink %j error: %s",t,r,"error"),n()})):n()}))}))}},{"../common/callback":14,"../common/image":16,"../common/object/copyObject":19,"../common/object/delete":20,"../common/object/deleteMulti":21,"../common/object/deleteObjectTagging":22,"../common/object/get":23,"../common/object/getACL":24,"../common/object/getBucketVersions":25,"../common/object/getObjectMeta":26,"../common/object/getObjectTagging":27,"../common/object/getSymlink":28,"../common/object/head":29,"../common/object/putACL":30,"../common/object/putObjectTagging":31,"../common/object/putSymlink":32,"../common/signUtils":34,"../common/utils/isBlob":43,"../common/utils/isFile":44,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68,"copy-to":76,fs:71,"is-type-of":289,"merge-descriptors":200,mime:202,path:205,url:238,utility:290}],5:[function(t,e,n){"use strict";n.version="6.10.0"},{}],6:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName;n.deleteBucketLifecycle=function(t,e){var n,r;return i.default.async((function(o){for(;;)switch(o.prev=o.next){case 0:return a(t),(n=this._bucketRequestParams("DELETE",t,"lifecycle",e)).successStatuses=[204],o.next=5,i.default.awrap(this.request(n));case 5:return r=o.sent,o.abrupt("return",{res:r.res});case 7:case"end":return o.stop()}}),null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],7:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName;n.deleteBucketWebsite=function(t,e){var n,r;return i.default.async((function(o){for(;;)switch(o.prev=o.next){case 0:return a(t),(n=this._bucketRequestParams("DELETE",t,"website",e)).successStatuses=[204],o.next=5,i.default.awrap(this.request(n));case 5:return r=o.sent,o.abrupt("return",{res:r.res});case 7:case"end":return o.stop()}}),null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],8:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName,s=t("../utils/isArray").isArray,u=t("../utils/formatObjKey").formatObjKey;n.getBucketLifecycle=function(t,e){var n,r,o;return i.default.async((function(c){for(;;)switch(c.prev=c.next){case 0:return a(t),(n=this._bucketRequestParams("GET",t,"lifecycle",e)).successStatuses=[200],n.xmlResponse=!0,c.next=6,i.default.awrap(this.request(n));case 6:return r=c.sent,(o=r.data.Rule||null)&&(s(o)||(o=[o]),o=o.map((function(t){return t.ID&&(t.id=t.ID,delete t.ID),t.Tag&&!s(t.Tag)&&(t.Tag=[t.Tag]),u(t,"firstLowerCase")}))),c.abrupt("return",{rules:o,res:r.res});case 10:case"end":return c.stop()}}),null,this)}},{"../utils/checkBucketName":35,"../utils/formatObjKey":40,"../utils/isArray":42,"babel-runtime/regenerator":68}],9:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName;n.getBucketVersioning=function(t,e){var n,r,o;return i.default.async((function(s){for(;;)switch(s.prev=s.next){case 0:return a(t),(n=this._bucketRequestParams("GET",t,"versioning",e)).xmlResponse=!0,n.successStatuses=[200],s.next=6,i.default.awrap(this.request(n));case 6:return r=s.sent,o=r.data.Status,s.abrupt("return",{status:r.status,versionStatus:o,res:r.res});case 9:case"end":return s.stop()}}),null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68}],10:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName,s=t("../utils/isObject").isObject;n.getBucketWebsite=function(t,e){var n,r,o;return i.default.async((function(u){for(;;)switch(u.prev=u.next){case 0:return a(t),(n=this._bucketRequestParams("GET",t,"website",e)).successStatuses=[200],n.xmlResponse=!0,u.next=6,i.default.awrap(this.request(n));case 6:return r=u.sent,o=[],r.data.RoutingRules&&r.data.RoutingRules.RoutingRule&&(o=s(r.data.RoutingRules.RoutingRule)?[r.data.RoutingRules.RoutingRule]:r.data.RoutingRules.RoutingRule),u.abrupt("return",{index:r.data.IndexDocument&&r.data.IndexDocument.Suffix||"",supportSubDir:r.data.IndexDocument&&r.data.IndexDocument.SupportSubDir||"false",type:r.data.IndexDocument&&r.data.IndexDocument.Type,routingRules:o,error:r.data.ErrorDocument&&r.data.ErrorDocument.Key||null,res:r.res});case 10:case"end":return u.stop()}}),null,this)}},{"../utils/checkBucketName":35,"../utils/isObject":46,"babel-runtime/regenerator":68}],11:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName,s=t("../utils/isArray").isArray,u=t("../utils/deepCopy").deepCopy,c=t("../utils/isObject").isObject,l=t("../utils/obj2xml").obj2xml,f=t("../utils/checkObjectTag").checkObjectTag,h=t("../utils/getStrBytesCount").getStrBytesCount;function p(t){t.days&&(t.expiration={days:t.days}),t.date&&(t.expiration={createdBeforeDate:t.date})}function d(t,e){var n=t.days,r=t.createdBeforeDate;if(!n&&!r)throw new Error(e+" must includes days or createdBeforeDate");if(n&&!/^[1-9][0-9]*$/.test(n))throw new Error("days must be a positive integer");if(r&&!/\d{4}-\d{2}-\d{2}T00:00:00.000Z/.test(r))throw new Error("createdBeforeDate must be date and conform to iso8601 format")}function m(t){if(t.id&&h(t.id)>255)throw new Error("ID is composed of 255 bytes at most");if(""===t.prefix||void 0===t.prefix)throw new Error("Rule must includes prefix");if(!["Enabled","Disabled"].includes(t.status))throw new Error("Status must be Enabled or Disabled");if(t.transition){if(!["IA","Archive"].includes(t.transition.storageClass))throw new Error("StorageClass must be IA or Archive");d(t.transition,"Transition")}if(t.expiration)if(t.expiration.expiredObjectDeleteMarker){if(t.expiration.days||t.expiration.createdBeforeDate)throw new Error("expiredObjectDeleteMarker cannot be used with days or createdBeforeDate")}else d(t.expiration,"Expiration");if(t.abortMultipartUpload&&d(t.abortMultipartUpload,"AbortMultipartUpload"),!(t.expiration||t.abortMultipartUpload||t.transition||t.noncurrentVersionTransition))throw new Error("Rule must includes expiration or abortMultipartUpload or transition or noncurrentVersionTransition");if(t.tag){if(t.abortMultipartUpload)throw new Error("Tag cannot be used with abortMultipartUpload");!function(t){if(!s(t)&&!c(t))throw new Error("tag must be Object or Array");t=c(t)?[t]:t;var e={};u(t).forEach((function(t){e[t.key]=t.value})),f(e)}(t.tag)}}n.putBucketLifecycle=function(t,e,n){var r,o,u,c,f;return i.default.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(a(t),s(e)){h.next=3;break}throw new Error("rules must be Array");case 3:return r=this._bucketRequestParams("PUT",t,"lifecycle",n),u={LifecycleConfiguration:{Rule:o=[]}},e.forEach((function(t){p(t),m(t),t.id&&(t.ID=t.id,delete t.id),o.push(t)})),c=l(u,{headers:!0,firstUpperCase:!0}),r.content=c,r.mime="xml",r.successStatuses=[200],h.next=13,i.default.awrap(this.request(r));case 13:return f=h.sent,h.abrupt("return",{res:f.res});case 15:case"end":return h.stop()}}),null,this)}},{"../utils/checkBucketName":35,"../utils/checkObjectTag":36,"../utils/deepCopy":39,"../utils/getStrBytesCount":41,"../utils/isArray":42,"../utils/isObject":46,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],12:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName,s=t("../utils/obj2xml").obj2xml;n.putBucketVersioning=function(t,e){var n,r,o,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return i.default.async((function(c){for(;;)switch(c.prev=c.next){case 0:if(a(t),["Enabled","Suspended"].includes(e)){c.next=3;break}throw new Error("status must be Enabled or Suspended");case 3:return n=this._bucketRequestParams("PUT",t,"versioning",u),r={VersioningConfiguration:{Status:e}},n.mime="xml",n.content=s(r,{headers:!0}),c.next=9,i.default.awrap(this.request(n));case 9:return o=c.sent,c.abrupt("return",{res:o.res,status:o.status});case 11:case"end":return c.stop()}}),null,this)}},{"../utils/checkBucketName":35,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],13:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName,s=t("../utils/obj2xml").obj2xml,u=t("../utils/isArray").isArray;n.putBucketWebsite=function(t){var e,n,r,o,c,l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f=arguments[2];return i.default.async((function(h){for(;;)switch(h.prev=h.next){case 0:if(a(t),e=this._bucketRequestParams("PUT",t,"website",f),n={Suffix:l.index||"index.html"},o={WebsiteConfiguration:r={IndexDocument:n}},l.supportSubDir&&(n.SupportSubDir=l.supportSubDir),l.type&&(n.Type=l.type),l.error&&(r.ErrorDocument={Key:l.error}),void 0===l.routingRules){h.next=12;break}if(u(l.routingRules)){h.next=11;break}throw new Error("RoutingRules must be Array");case 11:r.RoutingRules={RoutingRule:l.routingRules};case 12:return o=s(o),e.content=o,e.mime="xml",e.successStatuses=[200],h.next=18,i.default.awrap(this.request(e));case 18:return c=h.sent,h.abrupt("return",{res:c.res});case 20:case"end":return h.stop()}}),null,this)}},{"../utils/checkBucketName":35,"../utils/isArray":42,"../utils/obj2xml":47,"babel-runtime/regenerator":68}],14:[function(t,e,n){(function(e){"use strict";var r=i(t("babel-runtime/core-js/object/keys")),o=i(t("babel-runtime/core-js/json/stringify"));function i(t){return t&&t.__esModule?t:{default:t}}n.encodeCallback=function(t,n){if(t.headers=t.headers||{},!Object.prototype.hasOwnProperty.call(t.headers,"x-oss-callback")&&n.callback){var i={callbackUrl:encodeURI(n.callback.url),callbackBody:n.callback.body};n.callback.host&&(i.callbackHost=n.callback.host),n.callback.contentType&&(i.callbackBodyType=n.callback.contentType);var a=e.from((0,o.default)(i)).toString("base64");if(t.headers["x-oss-callback"]=a,n.callback.customValue){var s={};(0,r.default)(n.callback.customValue).forEach((function(t){s["x:"+t]=n.callback.customValue[t]})),t.headers["x-oss-callback-var"]=e.from((0,o.default)(s)).toString("base64")}}}}).call(this,t("buffer").Buffer)},{"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/keys":60,buffer:73}],15:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/assign"),i=(r=o)&&r.__esModule?r:{default:r},a=t("humanize-ms"),s=t("url"),u=t("../utils/checkBucketName").checkBucketName;e.exports=function(t){if(!t||!t.accessKeyId||!t.accessKeySecret)throw new Error("require accessKeyId, accessKeySecret");t.bucket&&u(t.bucket);var e,n,r,o,c,l=(0,i.default)({region:"oss-cn-hangzhou",internal:!1,secure:!1,timeout:6e4,bucket:null,endpoint:null,cname:!1,isRequestPay:!1,sldEnable:!1},t);if(l.accessKeyId=l.accessKeyId.trim(),l.accessKeySecret=l.accessKeySecret.trim(),l.timeout&&(l.timeout=a(l.timeout)),l.endpoint)l.endpoint=function(t,e){var n=s.parse(t);if(n.protocol||(n=s.parse("http"+(e?"s":"")+"://"+t)),"http:"!==n.protocol&&"https:"!==n.protocol)throw new Error("Endpoint protocol must be http or https.");return n}(l.endpoint,l.secure);else{if(!l.region)throw new Error("require options.endpoint or options.region");l.endpoint=(e=l.region,n=l.internal,r=l.secure,o=r?"https://":"http://",c=n?"-internal.aliyuncs.com":".aliyuncs.com","vpc100-oss-cn-"===e.substr(0,"vpc100-oss-cn-".length)&&(c=".aliyuncs.com"),s.parse(o+e+c))}return l.inited=!0,l}},{"../utils/checkBucketName":35,"babel-runtime/core-js/object/assign":54,"humanize-ms":194,url:238}],16:[function(t,e,n){"use strict";t("merge-descriptors")(n,t("./processObjectSave"))},{"./processObjectSave":17,"merge-descriptors":200}],17:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("../utils/checkBucketName").checkBucketName,s=t("querystring"),u=t("js-base64").Base64.encode;function c(t,e){if(!t)throw new Error(e+" is required");if("string"!=typeof t)throw new Error(e+" must be String")}n.processObjectSave=function(t,e,n,r){var o,l,f,h;return i.default.async((function(p){for(;;)switch(p.prev=p.next){case 0:return c(t,"sourceObject"),c(e,"targetObject"),c(n,"process"),e=this._objectName(e),r&&a(r),o=this._objectRequestParams("POST",t,{subres:"x-oss-process"}),l=r?",b_"+u(r):"",e=u(e),f={"x-oss-process":n+"|sys/saveas,o_"+e+l},o.content=s.stringify(f),p.next=12,i.default.awrap(this.request(o));case 12:return h=p.sent,p.abrupt("return",{res:h.res,status:h.res.status});case 14:case"end":return p.stop()}}),null,this)}},{"../utils/checkBucketName":35,"babel-runtime/regenerator":68,"js-base64":199,querystring:212}],18:[function(t,e,n){"use strict";var r,o=t("babel-runtime/regenerator"),i=(r=o)&&r.__esModule?r:{default:r},a=t("copy-to"),s=t("./callback"),u=t("./utils/deepCopy").deepCopy,c=n;c.listUploads=function(t,e){var n,r,o,s;return i.default.async((function(u){for(;;)switch(u.prev=u.next){case 0:return n={},a(e=e||{}).to(n),n.subres="uploads",(r=this._objectRequestParams("GET","",n)).query=t,r.xmlResponse=!0,r.successStatuses=[200],u.next=10,i.default.awrap(this.request(r));case 10:return o=u.sent,s=o.data.Upload||[],Array.isArray(s)||(s=[s]),s=s.map((function(t){return{name:t.Key,uploadId:t.UploadId,initiated:t.Initiated}})),u.abrupt("return",{res:o.res,uploads:s,bucket:o.data.Bucket,nextKeyMarker:o.data.NextKeyMarker,nextUploadIdMarker:o.data.NextUploadIdMarker,isTruncated:"true"===o.data.IsTruncated});case 15:case"end":return u.stop()}}),null,this)},c.listParts=function(t,e,n,r){var o,s,u;return i.default.async((function(c){for(;;)switch(c.prev=c.next){case 0:return o={},a(r=r||{}).to(o),o.subres={uploadId:e},(s=this._objectRequestParams("GET",t,o)).query=n,s.xmlResponse=!0,s.successStatuses=[200],c.next=10,i.default.awrap(this.request(s));case 10:return u=c.sent,c.abrupt("return",{res:u.res,uploadId:u.data.UploadId,bucket:u.data.Bucket,name:u.data.Key,partNumberMarker:u.data.PartNumberMarker,nextPartNumberMarker:u.data.NextPartNumberMarker,maxParts:u.data.MaxParts,isTruncated:u.data.IsTruncated,parts:u.data.Part||[]});case 12:case"end":return c.stop()}}),null,this)},c.abortMultipartUpload=function(t,e,n){var r,o,s;return i.default.async((function(u){for(;;)switch(u.prev=u.next){case 0:return this._stop(),r={},a(n=n||{}).to(r),r.subres={uploadId:e},(o=this._objectRequestParams("DELETE",t,r)).successStatuses=[204],u.next=9,i.default.awrap(this.request(o));case 9:return s=u.sent,u.abrupt("return",{res:s.res});case 11:case"end":return u.stop()}}),null,this)},c.initMultipartUpload=function(t,e){var n,r,o;return i.default.async((function(s){for(;;)switch(s.prev=s.next){case 0:return n={},a(e=e||{}).to(n),n.headers=n.headers||{},this._convertMetaToHeaders(e.meta,n.headers),n.subres="uploads",(r=this._objectRequestParams("POST",t,n)).mime=e.mime,r.xmlResponse=!0,r.successStatuses=[200],s.next=12,i.default.awrap(this.request(r));case 12:return o=s.sent,s.abrupt("return",{res:o.res,bucket:o.data.Bucket,name:o.data.Key,uploadId:o.data.UploadId});case 14:case"end":return s.stop()}}),null,this)},c.uploadPart=function(t,e,n,r,o,a,s){var u;return i.default.async((function(c){for(;;)switch(c.prev=c.next){case 0:return u={stream:this._createStream(r,o,a),size:a-o},c.next=3,i.default.awrap(this._uploadPart(t,e,n,u,s));case 3:return c.abrupt("return",c.sent);case 4:case"end":return c.stop()}}),null,this)},c.completeMultipartUpload=function(t,e,n,r){var o,a,c,l,f,h,p,d;return i.default.async((function(m){for(;;)switch(m.prev=m.next){case 0:for(o=n.concat().sort((function(t,e){return t.number-e.number})).filter((function(t,e,n){return!e||t.number!==n[e-1].number})),a='<?xml version="1.0" encoding="UTF-8"?>\n<CompleteMultipartUpload>\n',c=0;c<o.length;c++)l=o[c],a+="<Part>\n",a+="<PartNumber>"+l.number+"</PartNumber>\n",a+="<ETag>"+l.etag+"</ETag>\n",a+="</Part>\n";return a+="</CompleteMultipartUpload>",f={},(f=u(r=r||{})).headers&&delete f.headers["x-oss-server-side-encryption"],f.subres={uploadId:e},h=this._objectRequestParams("POST",t,f),s.encodeCallback(h,f),h.mime="xml",h.content=a,h.headers&&h.headers["x-oss-callback"]||(h.xmlResponse=!0),h.successStatuses=[200],m.next=17,i.default.awrap(this.request(h));case 17:return p=m.sent,d={res:p.res,bucket:h.bucket,name:t,etag:p.res.headers.etag},h.headers&&h.headers["x-oss-callback"]&&(d.data=JSON.parse(p.data.toString())),m.abrupt("return",d);case 21:case"end":return m.stop()}}),null,this)},c._uploadPart=function(t,e,n,r,o){var s,u,c;return i.default.async((function(l){for(;;)switch(l.prev=l.next){case 0:return s={},a(o=o||{}).to(s),s.headers={"Content-Length":r.size},s.subres={partNumber:n,uploadId:e},(u=this._objectRequestParams("PUT",t,s)).mime=s.mime,u.stream=r.stream,u.successStatuses=[200],l.next=11,i.default.awrap(this.request(u));case 11:if((c=l.sent).res.headers.etag){l.next=14;break}throw new Error("Please set the etag of expose-headers in OSS \n https://help.aliyun.com/document_detail/32069.html");case 14:return r.stream=null,u.stream=null,l.abrupt("return",{name:t,etag:c.res.headers.etag,res:c.res});case 17:case"end":return l.stop()}}),null,this)}},{"./callback":14,"./utils/deepCopy":39,"babel-runtime/regenerator":68,"copy-to":76}],19:[function(t,e,n){"use strict";var r=a(t("babel-runtime/regenerator")),o=a(t("babel-runtime/core-js/object/keys")),i=a(t("babel-runtime/helpers/typeof"));function a(t){return t&&t.__esModule?t:{default:t}}var s=t("../utils/checkBucketName").checkBucketName,u=n;u.copy=function(t,e,n,a){var s,u,c;return r.default.async((function(l){for(;;)switch(l.prev=l.next){case 0:return"object"===(void 0===n?"undefined":(0,i.default)(n))&&(a=n),(a=a||{}).headers=a.headers||{},(0,o.default)(a.headers).forEach((function(t){a.headers["x-oss-copy-source-"+t.toLowerCase()]=a.headers[t]})),a.meta&&(a.headers["x-oss-metadata-directive"]="REPLACE"),this._convertMetaToHeaders(a.meta,a.headers),e=this._getSourceName(e,n),a.versionId&&(e=e+"?versionId="+a.versionId),a.headers["x-oss-copy-source"]=e,(s=this._objectRequestParams("PUT",t,a)).xmlResponse=!0,s.successStatuses=[200,304],l.next=14,r.default.awrap(this.request(s));case 14:return u=l.sent,(c=u.data)&&(c={etag:c.ETag,lastModified:c.LastModified}),l.abrupt("return",{data:c,res:u.res});case 18:case"end":return l.stop()}}),null,this)},u._getSourceName=function(t,e){return"string"==typeof e?t=this._objectName(t):"/"!==t[0]?e=this.options.bucket:(e=t.replace(/\/(.+?)(\/.*)/,"$1"),t=t.replace(/(\/.+?\/)(.*)/,"$2")),s(e),t="/"+e+"/"+(t=encodeURI(t))}},{"../utils/checkBucketName":35,"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67,"babel-runtime/regenerator":68}],20:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}n.delete=function(t){var e,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.default.async((function(a){for(;;)switch(a.prev=a.next){case 0:return i.subres=(0,o.default)({},i.subres),i.versionId&&(i.subres.versionId=i.versionId),(e=this._objectRequestParams("DELETE",t,i)).successStatuses=[204],a.next=6,r.default.awrap(this.request(e));case 6:return n=a.sent,a.abrupt("return",{res:n.res});case 8:case"end":return a.stop()}}),null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],21:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}var a=t("utility"),s=t("../utils/obj2xml").obj2xml;n.deleteMulti=function(t){var e,n,i,u,c,l,f,h,p,d,m,v,g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.default.async((function(y){for(;;)switch(y.prev=y.next){case 0:if(e=[],t&&t.length){y.next=3;break}throw new Error("names is required");case 3:for(n=0;n<t.length;n++)i={},"string"==typeof t[n]?i.Key=a.escape(this._objectName(t[n])):(u=t[n],c=u.key,l=u.versionId,i.Key=a.escape(this._objectName(c)),i.VersionId=l),e.push(i);return f={Delete:{Quiet:!!g.quiet,Object:e}},h=s(f,{headers:!0}),g.subres=(0,o.default)({delete:""},g.subres),g.versionId&&(g.subres.versionId=g.versionId),(p=this._objectRequestParams("POST","",g)).mime="xml",p.content=h,p.xmlResponse=!0,p.successStatuses=[200],y.next=15,r.default.awrap(this.request(p));case 15:return d=y.sent,m=d.data,(v=m&&m.Deleted||null)&&(Array.isArray(v)||(v=[v])),y.abrupt("return",{res:d.res,deleted:v||[]});case 20:case"end":return y.stop()}}),null,this)}},{"../utils/obj2xml":47,"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68,utility:290}],22:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}n.deleteObjectTagging=function(t){var e,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.default.async((function(a){for(;;)switch(a.prev=a.next){case 0:return i.subres=(0,o.default)({tagging:""},i.subres),i.versionId&&(i.subres.versionId=i.versionId),t=this._objectName(t),(e=this._objectRequestParams("DELETE",t,i)).successStatuses=[204],a.next=7,r.default.awrap(this.request(e));case 7:return n=a.sent,a.abrupt("return",{status:n.status,res:n.res});case 9:case"end":return a.stop()}}),null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],23:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}var a=t("fs"),s=t("is-type-of");n.get=function(t,e){var n,i,u,c,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.default.async((function(f){for(;;)switch(f.prev=f.next){case 0:return n=null,i=!1,s.writableStream(e)?n=e:s.string(e)?(n=a.createWriteStream(e),i=!0):l=e,(l=l||{}).subres=(0,o.default)({},l.subres),l.versionId&&(l.subres.versionId=l.versionId),l.process&&(l.subres["x-oss-process"]=l.process),u=void 0,f.prev=8,(c=this._objectRequestParams("GET",t,l)).writeStream=n,c.successStatuses=[200,206,304],f.next=14,r.default.awrap(this.request(c));case 14:u=f.sent,i&&n.destroy(),f.next=25;break;case 18:if(f.prev=18,f.t0=f.catch(8),!i){f.next=24;break}return n.destroy(),f.next=24,r.default.awrap(this._deleteFileSafe(e));case 24:throw f.t0;case 25:return f.abrupt("return",{res:u.res,content:u.data});case 26:case"end":return f.stop()}}),null,this,[[8,18]])}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68,fs:71,"is-type-of":289}],24:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}n.getACL=function(t){var e,n,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.default.async((function(a){for(;;)switch(a.prev=a.next){case 0:return i.subres=(0,o.default)({acl:""},i.subres),i.versionId&&(i.subres.versionId=i.versionId),t=this._objectName(t),(e=this._objectRequestParams("GET",t,i)).successStatuses=[200],e.xmlResponse=!0,a.next=8,r.default.awrap(this.request(e));case 8:return n=a.sent,a.abrupt("return",{acl:n.data.AccessControlList.Grant,owner:{id:n.data.Owner.ID,displayName:n.data.Owner.DisplayName},res:n.res});case 10:case"end":return a.stop()}}),null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],25:[function(t,e,n){"use strict";var r=a(t("babel-runtime/core-js/object/keys")),o=a(t("babel-runtime/regenerator")),i=a(t("babel-runtime/core-js/object/assign"));function a(t){return t&&t.__esModule?t:{default:t}}var s=n,u=t("../utils/isObject").isObject,c=t("../utils/isArray").isArray;function l(){var t,e,n,r,a,s,u=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return o.default.async((function(f){for(;;)switch(f.prev=f.next){case 0:if(!u.versionIdMarker||void 0!==u.keyMarker){f.next=2;break}throw new Error("A version-id marker cannot be specified without a key marker");case 2:return l.subres=(0,i.default)({versions:""},l.subres),l.versionId&&(l.subres.versionId=l.versionId),(t=this._objectRequestParams("GET","",l)).xmlResponse=!0,t.successStatuses=[200],t.query=h(u),f.next=10,o.default.awrap(this.request(t));case 10:return e=f.sent,n=e.data.Version||[],r=e.data.DeleteMarker||[],a=this,n&&(Array.isArray(n)||(n=[n]),n=n.map((function(t){return{name:t.Key,url:a._objectUrl(t.Key),lastModified:t.LastModified,isLatest:"true"===t.IsLatest,versionId:t.VersionId,etag:t.ETag,type:t.Type,size:Number(t.Size),storageClass:t.StorageClass,owner:{id:t.Owner.ID,displayName:t.Owner.DisplayName}}}))),r&&(c(r)||(r=[r]),r=r.map((function(t){return{name:t.Key,lastModified:t.LastModified,versionId:t.VersionId,owner:{id:t.Owner.ID,displayName:t.Owner.DisplayName}}}))),(s=e.data.CommonPrefixes||null)&&(c(s)||(s=[s]),s=s.map((function(t){return t.Prefix}))),f.abrupt("return",{res:e.res,objects:n,deleteMarker:r,prefixes:s,nextMarker:e.data.NextMarker||null,NextVersionIdMarker:e.data.NextVersionIdMarker||null,isTruncated:"true"===e.data.IsTruncated});case 19:case"end":return f.stop()}}),null,this)}function f(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function h(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e={};return u(t)&&(0,r.default)(t).forEach((function(n){e[f(n)]=t[n]})),e}s.getBucketVersions=l,s.listObjectVersions=l},{"../utils/isArray":42,"../utils/isObject":46,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],26:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}n.getObjectMeta=function(t,e){var n,i;return r.default.async((function(a){for(;;)switch(a.prev=a.next){case 0:return e=e||{},t=this._objectName(t),e.subres=(0,o.default)({objectMeta:""},e.subres),e.versionId&&(e.subres.versionId=e.versionId),(n=this._objectRequestParams("HEAD",t,e)).successStatuses=[200],a.next=8,r.default.awrap(this.request(n));case 8:return i=a.sent,a.abrupt("return",{status:i.status,res:i.res});case 10:case"end":return a.stop()}}),null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],27:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}var a=n,s=t("../utils/isObject").isObject;a.getObjectTagging=function(t){var e,n,i,a,u,c=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.default.async((function(l){for(;;)switch(l.prev=l.next){case 0:return c.subres=(0,o.default)({tagging:""},c.subres),c.versionId&&(c.subres.versionId=c.versionId),t=this._objectName(t),(e=this._objectRequestParams("GET",t,c)).successStatuses=[200],l.next=7,r.default.awrap(this.request(e));case 7:return n=l.sent,l.next=10,r.default.awrap(this.parseXML(n.data));case 10:return i=l.sent,a=(a=i.TagSet.Tag)&&s(a)?[a]:a||[],u={},a.forEach((function(t){u[t.Key]=t.Value})),l.abrupt("return",{status:n.status,res:n.res,tag:u});case 16:case"end":return l.stop()}}),null,this)}},{"../utils/isObject":46,"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],28:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}n.getSymlink=function(t){var e,n,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.default.async((function(s){for(;;)switch(s.prev=s.next){case 0:return a.subres=(0,o.default)({symlink:""},a.subres),a.versionId&&(a.subres.versionId=a.versionId),t=this._objectName(t),(e=this._objectRequestParams("GET",t,a)).successStatuses=[200],s.next=7,r.default.awrap(this.request(e));case 7:return n=s.sent,i=n.res.headers["x-oss-symlink-target"],s.abrupt("return",{targetName:decodeURIComponent(i),res:n.res});case 10:case"end":return s.stop()}}),null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],29:[function(t,e,n){"use strict";var r=a(t("babel-runtime/regenerator")),o=a(t("babel-runtime/core-js/object/keys")),i=a(t("babel-runtime/core-js/object/assign"));function a(t){return t&&t.__esModule?t:{default:t}}n.head=function(t){var e,n,a,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.default.async((function(u){for(;;)switch(u.prev=u.next){case 0:return s.subres=(0,i.default)({},s.subres),s.versionId&&(s.subres.versionId=s.versionId),(e=this._objectRequestParams("HEAD",t,s)).successStatuses=[200,304],u.next=6,r.default.awrap(this.request(e));case 6:return n=u.sent,a={meta:null,res:n.res,status:n.status},200===n.status&&(0,o.default)(n.headers).forEach((function(t){0===t.indexOf("x-oss-meta-")&&(a.meta||(a.meta={}),a.meta[t.substring(11)]=n.headers[t])})),u.abrupt("return",a);case 10:case"end":return u.stop()}}),null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],30:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}n.putACL=function(t,e,n){var i,a;return r.default.async((function(s){for(;;)switch(s.prev=s.next){case 0:return(n=n||{}).subres=(0,o.default)({acl:""},n.subres),n.versionId&&(n.subres.versionId=n.versionId),n.headers=n.headers||{},n.headers["x-oss-object-acl"]=e,t=this._objectName(t),(i=this._objectRequestParams("PUT",t,n)).successStatuses=[200],s.next=10,r.default.awrap(this.request(i));case 10:return a=s.sent,s.abrupt("return",{res:a.res});case 12:case"end":return s.stop()}}),null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],31:[function(t,e,n){"use strict";var r=a(t("babel-runtime/regenerator")),o=a(t("babel-runtime/core-js/object/keys")),i=a(t("babel-runtime/core-js/object/assign"));function a(t){return t&&t.__esModule?t:{default:t}}var s=t("../utils/obj2xml").obj2xml,u=t("../utils/checkObjectTag").checkObjectTag;n.putObjectTagging=function(t,e){var n,a,c,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return r.default.async((function(f){for(;;)switch(f.prev=f.next){case 0:return u(e),l.subres=(0,i.default)({tagging:""},l.subres),l.versionId&&(l.subres.versionId=l.versionId),t=this._objectName(t),(n=this._objectRequestParams("PUT",t,l)).successStatuses=[200],e=(0,o.default)(e).map((function(t){return{Key:t,Value:e[t]}})),a={Tagging:{TagSet:{Tag:e}}},n.mime="xml",n.content=s(a),f.next=12,r.default.awrap(this.request(n));case 12:return c=f.sent,f.abrupt("return",{res:c.res,status:c.status});case 14:case"end":return f.stop()}}),null,this)}},{"../utils/checkObjectTag":36,"../utils/obj2xml":47,"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/keys":60,"babel-runtime/regenerator":68}],32:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/object/assign"));function i(t){return t&&t.__esModule?t:{default:t}}n.putSymlink=function(t,e,n){var i,a;return r.default.async((function(s){for(;;)switch(s.prev=s.next){case 0:return(n=n||{}).headers=n.headers||{},e=this._escape(this._objectName(e)),this._convertMetaToHeaders(n.meta,n.headers),n.headers["x-oss-symlink-target"]=e,n.subres=(0,o.default)({symlink:""},n.subres),n.versionId&&(n.subres.versionId=n.versionId),n.storageClass&&(n.headers["x-oss-storage-class"]=n.storageClass),t=this._objectName(t),(i=this._objectRequestParams("PUT",t,n)).successStatuses=[200],s.next=13,r.default.awrap(this.request(i));case 13:return a=s.sent,s.abrupt("return",{res:a.res});case 15:case"end":return s.stop()}}),null,this)}},{"babel-runtime/core-js/object/assign":54,"babel-runtime/regenerator":68}],33:[function(t,e,n){"use strict";var r=i(t("babel-runtime/regenerator")),o=i(t("babel-runtime/core-js/promise"));function i(t){return t&&t.__esModule?t:{default:t}}var a=n;a._parallelNode=function(t,e,n,i){var a,s,u,c,l,f,h,p;return r.default.async((function(d){for(;;)switch(d.prev=d.next){case 0:a=this,s=[],u=[],c=t.length/e,l=t.length%e,f=0===l?c:(t.length-l)/e+1,h=1,p=0;case 8:if(!(p<t.length)){d.next=26;break}if(!a.isCancel()){d.next=11;break}return d.abrupt("break",26);case 11:if(i?u.push(n(a,t[p],i)):u.push(n(a,t[p])),u.length!==e&&(h!==f||p!==t.length-1)){d.next=23;break}return d.prev=13,h+=1,d.next=17,r.default.awrap(o.default.all(u));case 17:d.next=22;break;case 19:d.prev=19,d.t0=d.catch(13),s.push(d.t0);case 22:u=[];case 23:p++,d.next=8;break;case 26:return d.abrupt("return",s);case 27:case"end":return d.stop()}}),null,this,[[13,19]])},a._parallel=function(t,e,n){var r=this;return new o.default((function(o){var i=[];if(e<=0||!t)o(i);else{var a,s,u,c=(s=-1,u=(a=t).length,function(){return++s<u&&!r.isCancel()?{value:a[s],key:s}:null}),l=!1,f=0,h=!1;v()}function p(t){return function(){if(null===t)throw new Error("Callback was already called.");var e=t;t=null;for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];e.apply(this,r)}}function d(t,e){f-=1,t?(l=!0,i.push(t),o(i)):e==={}||l&&f<=0?(l=!0,o(i)):h||(r.isCancel()?o(i):v())}function m(t,e){n(t).then((function(t){e(null,t)})).catch((function(t){e(t)}))}function v(){for(h=!0;f<e&&!l&&!r.isCancel();){var t=c();if(null===t||i.length>0)return l=!0,void(f<=0&&o(i));f+=1,m(t.value,p(d))}h=!1}}))},a.cancel=function(t){this.options.cancelFlag=!0,t&&this.abortMultipartUpload(t.name,t.uploadId,t.options)},a.isCancel=function(){return this.options.cancelFlag},a.resetCancelFlag=function(){this.options.cancelFlag=!1},a._stop=function(){this.options.cancelFlag=!0},a._makeCancelEvent=function(){return{status:0,name:"cancel"}}},{"babel-runtime/core-js/promise":61,"babel-runtime/regenerator":68}],34:[function(t,e,n){(function(e){"use strict";var r=i(t("babel-runtime/core-js/json/stringify")),o=i(t("babel-runtime/core-js/object/keys"));function i(t){return t&&t.__esModule?t:{default:t}}var a=t("./../../shims/crypto/crypto.js"),s=t("is-type-of");n.buildCanonicalizedResource=function(t,e){var n=""+t,r="?";return s.string(e)&&""!==e.trim()?n+=r+e:s.array(e)?(e.sort(),n+=r+e.join("&")):e&&(0,o.default)(e).sort((function(t,e){return t[0]>e[0]?1:t[0]<e[0]?-1:0})).forEach((function(t){n+=r+t,e[t]&&(n+="="+e[t]),r="&"})),n},n.buildCanonicalString=function(t,e,n,r){var i=(n=n||{}).headers||{},a=[],s={},u=[t.toUpperCase(),i["Content-Md5"]||"",i["Content-Type"]||i["Content-Type".toLowerCase()],r||i["x-oss-date"]];return(0,o.default)(i).forEach((function(t){var e=t.toLowerCase();0===e.indexOf("x-oss-")&&(s[e]=String(i[t]).trim())})),(0,o.default)(s).sort().forEach((function(t){a.push(t+":"+s[t])})),(u=u.concat(a)).push(this.buildCanonicalizedResource(e,n.parameters)),u.join("\n")},n.computeSignature=function(t,n){return a.createHmac("sha1",t).update(e.from(n,"utf8")).digest("base64")},n.authorization=function(t,e,n){return"OSS "+t+":"+this.computeSignature(e,n)},n._signatureForURL=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments[2],a=arguments[3],s={},u=n.subResource,c=void 0===u?{}:u;if(n.process){var l="x-oss-process";c[l]=n.process}if(n.trafficLimit){var f="x-oss-traffic-limit";c[f]=n.trafficLimit}if(n.response&&(0,o.default)(n.response).forEach((function(t){var e="response-"+t.toLowerCase();c[e]=n.response[t]})),(0,o.default)(n).forEach((function(t){var e=t.toLowerCase(),r=n[t];0===e.indexOf("x-oss-")?s[e]=r:(0===e.indexOf("content-md5")||0===e.indexOf("content-type"))&&(s[t]=r)})),Object.prototype.hasOwnProperty.call(n,"security-token")&&(c["security-token"]=n["security-token"]),Object.prototype.hasOwnProperty.call(n,"callback")){var h={callbackUrl:encodeURI(n.callback.url),callbackBody:n.callback.body};if(n.callback.host&&(h.callbackHost=n.callback.host),n.callback.contentType&&(h.callbackBodyType=n.callback.contentType),c.callback=e.from((0,r.default)(h)).toString("base64"),n.callback.customValue){var p={};(0,o.default)(n.callback.customValue).forEach((function(t){p["x:"+t]=n.callback.customValue[t]})),c["callback-var"]=e.from((0,r.default)(p)).toString("base64")}}var d=this.buildCanonicalString(n.method,i,{headers:s,parameters:c},a.toString());return{Signature:this.computeSignature(t,d),subResource:c}}}).call(this,t("buffer").Buffer)},{"./../../shims/crypto/crypto.js":284,"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/keys":60,buffer:73,"is-type-of":289}],35:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.checkBucketName=void 0,n.checkBucketName=function(t,e){if(!(e?/^[a-z0-9][a-z0-9-]{1,61}[a-z0-9]$/:/^[a-z0-9_][a-z0-9-_]{1,61}[a-z0-9_]$/).test(t))throw new Error("The bucket must be conform to the specifications")}},{}],36:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/entries"),i=(r=o)&&r.__esModule?r:{default:r};Object.defineProperty(n,"__esModule",{value:!0}),n.checkObjectTag=void 0;var a=t("./checkValid").checkValid,s=t("./isObject").isObject,u=[{validator:function(t){if("string"!=typeof t)throw new Error("the key and value of the tag must be String")}},{pattern:/^[a-zA-Z0-9 +-=._:/]+$/,msg:"tag can contain letters, numbers, spaces, and the following symbols: plus sign (+), hyphen (-), equal sign (=), period (.), underscore (_), colon (:), and forward slash (/)"}],c={key:[].concat(u,[{pattern:/^.{1,128}$/,msg:"tag key can be a maximum of 128 bytes in length"}]),value:[].concat(u,[{pattern:/^.{0,256}$/,msg:"tag value can be a maximum of 256 bytes in length"}])};n.checkObjectTag=function(t){if(!s(t))throw new Error("tag must be Object");var e=(0,i.default)(t);if(e.length>10)throw new Error("maximum of 10 tags for a object");var n=["key","value"];e.forEach((function(t){t.forEach((function(t,e){a(t,c[n[e]])}))}))}},{"./checkValid":37,"./isObject":46,"babel-runtime/core-js/object/entries":57}],37:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.checkValid=void 0,n.checkValid=function(t,e){e.forEach((function(e){if(e.validator)e.validator(t);else if(e.pattern&&!e.pattern.test(t))throw new Error(e.msg)}))}},{}],38:[function(t,e,n){(function(e){"use strict";var r,o=t("babel-runtime/core-js/object/assign"),i=(r=o)&&r.__esModule?r:{default:r};Object.defineProperty(n,"__esModule",{value:!0}),n.createRequest=void 0;var a=t("./../../../shims/crypto/crypto.js"),s=t("debug")("ali-oss"),u=t("mime"),c=t("dateformat"),l=t("copy-to"),f=t("path");function h(t,e){return t[e]||t[e.toLowerCase()]}n.createRequest=function(t){var n=new Date;this.options.amendTimeSkewed&&(n=+new Date+this.options.amendTimeSkewed);var r={"x-oss-date":c(n,"UTC:ddd, dd mmm yyyy HH:MM:ss 'GMT'"),"x-oss-user-agent":this.userAgent};this.userAgent.includes("nodejs")&&(r["User-Agent"]=this.userAgent),this.options.isRequestPay&&(0,i.default)(r,{"x-oss-request-payer":"requester"}),this.options.stsToken&&(r["x-oss-security-token"]=this.options.stsToken),l(t.headers).to(r),h(r,"Content-Type")||(t.mime&&t.mime.indexOf("/")>0?r["Content-Type"]=t.mime:r["Content-Type"]=u.getType(t.mime||f.extname(t.object||""))),h(r,"Content-Type")||function(t,e){delete t[e],delete t[e.toLowerCase()]}(r,"Content-Type"),t.content&&(r["Content-Md5"]=a.createHash("md5").update(e.from(t.content,"utf8")).digest("base64"),r["Content-Length"]||(r["Content-Length"]=t.content.length));var o=this._getResource(t);r.authorization=this.authorization(t.method,o,t.subres,r);var p=this._getReqUrl(t);s("request %s %s, with headers %j, !!stream: %s",t.method,p,r,!!t.stream);var d=t.timeout||this.options.timeout,m={method:t.method,content:t.content,stream:t.stream,headers:r,timeout:d,writeStream:t.writeStream,customResponse:t.customResponse,ctx:t.ctx||this.ctx};return this.agent&&(m.agent=this.agent),this.httpsAgent&&(m.httpsAgent=this.httpsAgent),{url:p,params:m}}}).call(this,t("buffer").Buffer)},{"./../../../shims/crypto/crypto.js":284,"babel-runtime/core-js/object/assign":54,buffer:73,"copy-to":76,dateformat:190,debug:288,mime:202,path:205}],39:[function(t,e,n){"use strict";var r=i(t("babel-runtime/core-js/object/keys")),o=i(t("babel-runtime/helpers/typeof"));function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(n,"__esModule",{value:!0}),n.deepCopy=void 0,n.deepCopy=function(t){if(null===t||"object"!==(void 0===t?"undefined":(0,o.default)(t)))return t;var e=Array.isArray(t)?[]:{};return(0,r.default)(t).forEach((function(r){e[r]=n.deepCopy(t[r])})),e}},{"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67}],40:[function(t,e,n){"use strict";var r=i(t("babel-runtime/core-js/object/keys")),o=i(t("babel-runtime/helpers/typeof"));function i(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(n,"__esModule",{value:!0}),n.formatObjKey=void 0,n.formatObjKey=function t(e,n){if(null===e||"object"!==(void 0===e?"undefined":(0,o.default)(e)))return e;var i=void 0;if(Array.isArray(e)){i=[];for(var a=0;a<e.length;a++)i.push(t(e[a],n))}else i={},(0,r.default)(e).forEach((function(r){i[function(t,e){return"firstUpperCase"===e?t=t.replace(/^./,(function(t){return t.toUpperCase()})):"firstLowerCase"===e&&(t=t.replace(/^./,(function(t){return t.toLowerCase()}))),t}(r,n)]=t(e[r],n)}));return i}},{"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67}],41:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.getStrBytesCount=void 0,n.getStrBytesCount=function(t){for(var e=0,n=0;n<t.length;n++){var r=t.charAt(n);/^[\u00-\uff]$/.test(r)?e+=1:e+=2}return e}},{}],42:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isArray=void 0,n.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],43:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isBlob=void 0,n.isBlob=function(t){return"undefined"!=typeof Blob&&t instanceof Blob}},{}],44:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isFile=void 0,n.isFile=function(t){return"undefined"!=typeof File&&t instanceof File}},{}],45:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isIP=void 0,n.isIP=function(t){return/^(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}$/.test(t)||/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/.test(t)}},{}],46:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.isObject=void 0,n.isObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)}},{}],47:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/keys"),i=(r=o)&&r.__esModule?r:{default:r};Object.defineProperty(n,"__esModule",{value:!0}),n.obj2xml=void 0;var a=t("./formatObjKey");function s(t){return Object.prototype.toString.call(t).replace(/(.*? |])/g,"").toLowerCase()}n.obj2xml=function t(e,n){var r="";return n&&n.headers&&(r='<?xml version="1.0" encoding="UTF-8"?>\n'),n&&n.firstUpperCase&&(e=a.formatObjKey(e,"firstUpperCase")),"object"===s(e)?(0,i.default)(e).forEach((function(n){"string"===s(e[n])||"number"===s(e[n])?r+="<"+n+">"+e[n]+"</"+n+">":"object"===s(e[n])?r+="<"+n+">"+t(e[n])+"</"+n+">":"array"===s(e[n])?r+=e[n].map((function(e){return"<"+n+">"+t(e)+"</"+n+">"})).join(""):r+="<"+n+">"+e[n].toString()+"</"+n+">"})):r+=e.toString(),r}},{"./formatObjKey":40,"babel-runtime/core-js/object/keys":60}],48:[function(t,e,n){function r(){}e.exports=r,e.exports.HttpsAgent=r},{}],49:[function(t,e,n){e.exports=t("./register")().Promise},{"./register":51}],50:[function(t,e,n){"use strict";var r=null;e.exports=function(t,e){return function(n,o){n=n||null;var i=!1!==(o=o||{}).global;if(null===r&&i&&(r=t["@@any-promise/REGISTRATION"]||null),null!==r&&null!==n&&r.implementation!==n)throw new Error('any-promise already defined as "'+r.implementation+'". You can only register an implementation before the first call to require("any-promise") and an implementation cannot be changed');return null===r&&(r=null!==n&&void 0!==o.Promise?{Promise:o.Promise,implementation:n}:e(n),i&&(t["@@any-promise/REGISTRATION"]=r)),r}}},{}],51:[function(t,e,n){"use strict";e.exports=t("./loader")(window,(function(){if(void 0===window.Promise)throw new Error("any-promise browser requires a polyfill or explicit registration e.g: require('any-promise/register/bluebird')");return{Promise:window.Promise,implementation:"window.Promise"}}))},{"./loader":50}],52:[function(t,e,n){e.exports={default:t("core-js/library/fn/array/from"),__esModule:!0}},{"core-js/library/fn/array/from":77}],53:[function(t,e,n){e.exports={default:t("core-js/library/fn/json/stringify"),__esModule:!0}},{"core-js/library/fn/json/stringify":78}],54:[function(t,e,n){e.exports={default:t("core-js/library/fn/object/assign"),__esModule:!0}},{"core-js/library/fn/object/assign":79}],55:[function(t,e,n){e.exports={default:t("core-js/library/fn/object/create"),__esModule:!0}},{"core-js/library/fn/object/create":80}],56:[function(t,e,n){e.exports={default:t("core-js/library/fn/object/define-property"),__esModule:!0}},{"core-js/library/fn/object/define-property":81}],57:[function(t,e,n){e.exports={default:t("core-js/library/fn/object/entries"),__esModule:!0}},{"core-js/library/fn/object/entries":82}],58:[function(t,e,n){e.exports={default:t("core-js/library/fn/object/get-own-property-names"),__esModule:!0}},{"core-js/library/fn/object/get-own-property-names":83}],59:[function(t,e,n){e.exports={default:t("core-js/library/fn/object/get-prototype-of"),__esModule:!0}},{"core-js/library/fn/object/get-prototype-of":84}],60:[function(t,e,n){e.exports={default:t("core-js/library/fn/object/keys"),__esModule:!0}},{"core-js/library/fn/object/keys":85}],61:[function(t,e,n){e.exports={default:t("core-js/library/fn/promise"),__esModule:!0}},{"core-js/library/fn/promise":86}],62:[function(t,e,n){e.exports={default:t("core-js/library/fn/set-immediate"),__esModule:!0}},{"core-js/library/fn/set-immediate":87}],63:[function(t,e,n){e.exports={default:t("core-js/library/fn/string/from-code-point"),__esModule:!0}},{"core-js/library/fn/string/from-code-point":88}],64:[function(t,e,n){e.exports={default:t("core-js/library/fn/symbol"),__esModule:!0}},{"core-js/library/fn/symbol":90}],65:[function(t,e,n){e.exports={default:t("core-js/library/fn/symbol/has-instance"),__esModule:!0}},{"core-js/library/fn/symbol/has-instance":89}],66:[function(t,e,n){e.exports={default:t("core-js/library/fn/symbol/iterator"),__esModule:!0}},{"core-js/library/fn/symbol/iterator":91}],67:[function(t,e,n){"use strict";n.__esModule=!0;var r=a(t("../core-js/symbol/iterator")),o=a(t("../core-js/symbol")),i="function"==typeof o.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":typeof t};function a(t){return t&&t.__esModule?t:{default:t}}n.default="function"==typeof o.default&&"symbol"===i(r.default)?function(t){return void 0===t?"undefined":i(t)}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":void 0===t?"undefined":i(t)}},{"../core-js/symbol":64,"../core-js/symbol/iterator":66}],68:[function(t,e,n){e.exports=t("regenerator-runtime")},{"regenerator-runtime":226}],69:[function(t,e,n){"use strict";n.byteLength=function(t){var e=c(t),n=e[0],r=e[1];return 3*(n+r)/4-r},n.toByteArray=function(t){var e,n,r=c(t),a=r[0],s=r[1],u=new i(function(t,e,n){return 3*(e+n)/4-n}(0,a,s)),l=0,f=s>0?a-4:a;for(n=0;n<f;n+=4)e=o[t.charCodeAt(n)]<<18|o[t.charCodeAt(n+1)]<<12|o[t.charCodeAt(n+2)]<<6|o[t.charCodeAt(n+3)],u[l++]=e>>16&255,u[l++]=e>>8&255,u[l++]=255&e;return 2===s&&(e=o[t.charCodeAt(n)]<<2|o[t.charCodeAt(n+1)]>>4,u[l++]=255&e),1===s&&(e=o[t.charCodeAt(n)]<<10|o[t.charCodeAt(n+1)]<<4|o[t.charCodeAt(n+2)]>>2,u[l++]=e>>8&255,u[l++]=255&e),u},n.fromByteArray=function(t){for(var e,n=t.length,o=n%3,i=[],a=0,s=n-o;a<s;a+=16383)i.push(l(t,a,a+16383>s?s:a+16383));return 1===o?(e=t[n-1],i.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],i.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),i.join("")};for(var r=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,u=a.length;s<u;++s)r[s]=a[s],o[a.charCodeAt(s)]=s;function c(t){var e=t.length;if(e%4>0)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 l(t,e,n){for(var o,i,a=[],s=e;s<n;s+=3)o=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),a.push(r[(i=o)>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],70:[function(t,e,n){var r,o;r=this,o=function(){var t=!0;function e(e){function n(t){var n=e.match(t);return n&&n.length>1&&n[1]||""}function r(t){var n=e.match(t);return n&&n.length>1&&n[2]||""}var o,a=n(/(ipod|iphone|ipad)/i).toLowerCase(),s=!/like android/i.test(e)&&/android/i.test(e),u=/nexus\s*[0-6]\s*/i.test(e),c=!u&&/nexus\s*[0-9]+/i.test(e),l=/CrOS/.test(e),f=/silk/i.test(e),h=/sailfish/i.test(e),p=/tizen/i.test(e),d=/(web|hpw)(o|0)s/i.test(e),m=/windows phone/i.test(e),v=(/SamsungBrowser/i.test(e),!m&&/windows/i.test(e)),g=!a&&!f&&/macintosh/i.test(e),y=!s&&!h&&!p&&!d&&/linux/i.test(e),b=r(/edg([ea]|ios)\/(\d+(\.\d+)?)/i),w=n(/version\/(\d+(\.\d+)?)/i),x=/tablet/i.test(e)&&!/tablet pc/i.test(e),_=!x&&/[^-]mobi/i.test(e),E=/xbox/i.test(e);/opera/i.test(e)?o={name:"Opera",opera:t,version:w||n(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(e)?o={name:"Opera",opera:t,version:n(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||w}:/SamsungBrowser/i.test(e)?o={name:"Samsung Internet for Android",samsungBrowser:t,version:w||n(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/Whale/i.test(e)?o={name:"NAVER Whale browser",whale:t,version:n(/(?:whale)[\s\/](\d+(?:\.\d+)+)/i)}:/MZBrowser/i.test(e)?o={name:"MZ Browser",mzbrowser:t,version:n(/(?:MZBrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/coast/i.test(e)?o={name:"Opera Coast",coast:t,version:w||n(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/focus/i.test(e)?o={name:"Focus",focus:t,version:n(/(?:focus)[\s\/](\d+(?:\.\d+)+)/i)}:/yabrowser/i.test(e)?o={name:"Yandex Browser",yandexbrowser:t,version:w||n(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(e)?o={name:"UC Browser",ucbrowser:t,version:n(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(e)?o={name:"Maxthon",maxthon:t,version:n(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(e)?o={name:"Epiphany",epiphany:t,version:n(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(e)?o={name:"Puffin",puffin:t,version:n(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(e)?o={name:"Sleipnir",sleipnir:t,version:n(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(e)?o={name:"K-Meleon",kMeleon:t,version:n(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:m?(o={name:"Windows Phone",osname:"Windows Phone",windowsphone:t},b?(o.msedge=t,o.version=b):(o.msie=t,o.version=n(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(e)?o={name:"Internet Explorer",msie:t,version:n(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:l?o={name:"Chrome",osname:"Chrome OS",chromeos:t,chromeBook:t,chrome:t,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/edg([ea]|ios)/i.test(e)?o={name:"Microsoft Edge",msedge:t,version:b}:/vivaldi/i.test(e)?o={name:"Vivaldi",vivaldi:t,version:n(/vivaldi\/(\d+(\.\d+)?)/i)||w}:h?o={name:"Sailfish",osname:"Sailfish OS",sailfish:t,version:n(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(e)?o={name:"SeaMonkey",seamonkey:t,version:n(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(e)?(o={name:"Firefox",firefox:t,version:n(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(e)&&(o.firefoxos=t,o.osname="Firefox OS")):f?o={name:"Amazon Silk",silk:t,version:n(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(e)?o={name:"PhantomJS",phantom:t,version:n(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(e)?o={name:"SlimerJS",slimer:t,version:n(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(e)||/rim\stablet/i.test(e)?o={name:"BlackBerry",osname:"BlackBerry OS",blackberry:t,version:w||n(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:d?(o={name:"WebOS",osname:"WebOS",webos:t,version:w||n(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(e)&&(o.touchpad=t)):/bada/i.test(e)?o={name:"Bada",osname:"Bada",bada:t,version:n(/dolfin\/(\d+(\.\d+)?)/i)}:p?o={name:"Tizen",osname:"Tizen",tizen:t,version:n(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||w}:/qupzilla/i.test(e)?o={name:"QupZilla",qupzilla:t,version:n(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||w}:/chromium/i.test(e)?o={name:"Chromium",chromium:t,version:n(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||w}:/chrome|crios|crmo/i.test(e)?o={name:"Chrome",chrome:t,version:n(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:s?o={name:"Android",version:w}:/safari|applewebkit/i.test(e)?(o={name:"Safari",safari:t},w&&(o.version=w)):a?(o={name:"iphone"==a?"iPhone":"ipad"==a?"iPad":"iPod"},w&&(o.version=w)):o=/googlebot/i.test(e)?{name:"Googlebot",googlebot:t,version:n(/googlebot\/(\d+(\.\d+))/i)||w}:{name:n(/^(.*)\/(.*) /),version:r(/^(.*)\/(.*) /)},!o.msedge&&/(apple)?webkit/i.test(e)?(/(apple)?webkit\/537\.36/i.test(e)?(o.name=o.name||"Blink",o.blink=t):(o.name=o.name||"Webkit",o.webkit=t),!o.version&&w&&(o.version=w)):!o.opera&&/gecko\//i.test(e)&&(o.name=o.name||"Gecko",o.gecko=t,o.version=o.version||n(/gecko\/(\d+(\.\d+)?)/i)),o.windowsphone||!s&&!o.silk?!o.windowsphone&&a?(o[a]=t,o.ios=t,o.osname="iOS"):g?(o.mac=t,o.osname="macOS"):E?(o.xbox=t,o.osname="Xbox"):v?(o.windows=t,o.osname="Windows"):y&&(o.linux=t,o.osname="Linux"):(o.android=t,o.osname="Android");var C="";o.windows?C=function(t){switch(t){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}(n(/Windows ((NT|XP)( \d\d?.\d)?)/i)):o.windowsphone?C=n(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):o.mac?C=(C=n(/Mac OS X (\d+([_\.\s]\d+)*)/i)).replace(/[_\s]/g,"."):a?C=(C=n(/os (\d+([_\s]\d+)*) like mac os x/i)).replace(/[_\s]/g,"."):s?C=n(/android[ \/-](\d+(\.\d+)*)/i):o.webos?C=n(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):o.blackberry?C=n(/rim\stablet\sos\s(\d+(\.\d+)*)/i):o.bada?C=n(/bada\/(\d+(\.\d+)*)/i):o.tizen&&(C=n(/tizen[\/\s](\d+(\.\d+)*)/i)),C&&(o.osversion=C);var S=!o.windows&&C.split(".")[0];return x||c||"ipad"==a||s&&(3==S||S>=4&&!_)||o.silk?o.tablet=t:(_||"iphone"==a||"ipod"==a||s||u||o.blackberry||o.webos||o.bada)&&(o.mobile=t),o.msedge||o.msie&&o.version>=10||o.yandexbrowser&&o.version>=15||o.vivaldi&&o.version>=1||o.chrome&&o.version>=20||o.samsungBrowser&&o.version>=4||o.whale&&1===i([o.version,"1.0"])||o.mzbrowser&&1===i([o.version,"6.0"])||o.focus&&1===i([o.version,"1.0"])||o.firefox&&o.version>=20||o.safari&&o.version>=6||o.opera&&o.version>=10||o.ios&&o.osversion&&o.osversion.split(".")[0]>=6||o.blackberry&&o.version>=10.1||o.chromium&&o.version>=20?o.a=t:o.msie&&o.version<10||o.chrome&&o.version<20||o.firefox&&o.version<20||o.safari&&o.version<6||o.opera&&o.version<10||o.ios&&o.osversion&&o.osversion.split(".")[0]<6||o.chromium&&o.version<20?o.c=t:o.x=t,o}var n=e("undefined"!=typeof navigator&&navigator.userAgent||"");function r(t){return t.split(".").length}function o(t,e){var n,r=[];if(Array.prototype.map)return Array.prototype.map.call(t,e);for(n=0;n<t.length;n++)r.push(e(t[n]));return r}function i(t){for(var e=Math.max(r(t[0]),r(t[1])),n=o(t,(function(t){var n=e-r(t);return o((t+=new Array(n+1).join(".0")).split("."),(function(t){return new Array(20-t.length).join("0")+t})).reverse()}));--e>=0;){if(n[0][e]>n[1][e])return 1;if(n[0][e]!==n[1][e])return-1;if(0===e)return 0}}function a(t,r,o){var a=n;"string"==typeof r&&(o=r,r=void 0),void 0===r&&(r=!1),o&&(a=e(o));var s=""+a.version;for(var u in t)if(t.hasOwnProperty(u)&&a[u]){if("string"!=typeof t[u])throw new Error("Browser version in the minVersion map should be a string: "+u+": "+String(t));return i([s,t[u]])<0}return r}return n.test=function(t){for(var e=0;e<t.length;++e){var r=t[e];if("string"==typeof r&&r in n)return!0}return!1},n.isUnsupportedBrowser=a,n.compareVersions=i,n.check=function(t,e,n){return!a(t,e,n)},n._detect=e,n.detect=e,n},void 0!==e&&e.exports?e.exports=o():"function"==typeof define&&define.amd?define("bowser",o):r.bowser=o()},{}],71:[function(t,e,n){},{}],72:[function(t,e,n){var r=t("buffer").Buffer,o=r.isEncoding||function(t){switch(t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}},i=n.StringDecoder=function(t){switch(this.encoding=(t||"utf8").toLowerCase().replace(/[-_]/,""),function(t){if(t&&!o(t))throw new Error("Unknown encoding: "+t)}(t),this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2,this.detectIncompleteChar=s;break;case"base64":this.surrogateSize=3,this.detectIncompleteChar=u;break;default:return void(this.write=a)}this.charBuffer=new r(6),this.charReceived=0,this.charLength=0};function a(t){return t.toString(this.encoding)}function s(t){this.charReceived=t.length%2,this.charLength=this.charReceived?2:0}function u(t){this.charReceived=t.length%3,this.charLength=this.charReceived?3:0}i.prototype.write=function(t){for(var e="";this.charLength;){var n=t.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:t.length;if(t.copy(this.charBuffer,this.charReceived,0,n),this.charReceived+=n,this.charReceived<this.charLength)return"";if(t=t.slice(n,t.length),!((r=(e=this.charBuffer.slice(0,this.charLength).toString(this.encoding)).charCodeAt(e.length-1))>=55296&&r<=56319)){if(this.charReceived=this.charLength=0,0===t.length)return e;break}this.charLength+=this.surrogateSize,e=""}this.detectIncompleteChar(t);var r,o=t.length;if(this.charLength&&(t.copy(this.charBuffer,0,t.length-this.charReceived,o),o-=this.charReceived),o=(e+=t.toString(this.encoding,0,o)).length-1,(r=e.charCodeAt(o))>=55296&&r<=56319){var i=this.surrogateSize;return this.charLength+=i,this.charReceived+=i,this.charBuffer.copy(this.charBuffer,i,0,i),t.copy(this.charBuffer,0,0,i),e.substring(0,o)}return e},i.prototype.detectIncompleteChar=function(t){for(var e=t.length>=3?3:t.length;e>0;e--){var n=t[t.length-e];if(1==e&&n>>5==6){this.charLength=2;break}if(e<=2&&n>>4==14){this.charLength=3;break}if(e<=3&&n>>3==30){this.charLength=4;break}}this.charReceived=e},i.prototype.end=function(t){var e="";if(t&&t.length&&(e=this.write(t)),this.charReceived){var n=this.charReceived,r=this.charBuffer,o=this.encoding;e+=r.slice(0,n).toString(o)}return e}},{buffer:73}],73:[function(t,e,n){(function(e,r){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <http://feross.org>
* @license MIT
*/
"use strict";var o=t("base64-js"),i=t("ieee754"),a=t("isarray");function s(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,e){if(s()<e)throw new RangeError("Invalid typed array length");return r.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=r.prototype:(null===t&&(t=new r(e)),t.length=e),t}function r(t,e,n){if(!(r.TYPED_ARRAY_SUPPORT||this instanceof r))return new r(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return f(this,t)}return c(this,t,e,n)}function c(t,e,n,o){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,o){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(o||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===o?new Uint8Array(e):void 0===o?new Uint8Array(e,n):new Uint8Array(e,n,o),r.TYPED_ARRAY_SUPPORT?(t=e).__proto__=r.prototype:t=h(t,e),t}(t,e,n,o):"string"==typeof e?function(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!r.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var o=0|d(e,n),i=(t=u(t,o)).write(e,n);return i!==o&&(t=t.slice(0,i)),t}(t,e,n):function(t,e){if(r.isBuffer(e)){var n=0|p(e.length);return 0===(t=u(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(o=e.length)!=o?u(t,0):h(t,e);if("Buffer"===e.type&&a(e.data))return h(t,e.data)}var o;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function f(t,e){if(l(e),t=u(t,e<0?0:0|p(e)),!r.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function h(t,e){var n=e.length<0?0:0|p(e.length);t=u(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function p(t){if(t>=s())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s().toString(16)+" bytes");return 0|t}function d(t,e){if(r.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 o=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return L(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(o)return L(t).length;e=(""+e).toLowerCase(),o=!0}}function m(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.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 O(this,e,n);case"utf8":case"utf-8":return k(this,e,n);case"ascii":return T(this,e,n);case"latin1":case"binary":return I(this,e,n);case"base64":return S(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}}function v(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function g(t,e,n,o,i){if(0===t.length)return-1;if("string"==typeof n?(o=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=r.from(e,o)),r.isBuffer(e))return 0===e.length?-1:y(t,e,n,o,i);if("number"==typeof e)return e&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):y(t,[e],n,o,i);throw new TypeError("val must be string, number or Buffer")}function y(t,e,n,r,o){var i,a=1,s=t.length,u=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;a=2,s/=2,u/=2,n/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(o){var l=-1;for(i=n;i<s;i++)if(c(t,i)===c(e,-1===l?0:i-l)){if(-1===l&&(l=i),i-l+1===u)return l*a}else-1!==l&&(i-=i-l),l=-1}else for(n+u>s&&(n=s-u),i=n;i>=0;i--){for(var f=!0,h=0;h<u;h++)if(c(t,i+h)!==c(e,h)){f=!1;break}if(f)return i}return-1}function b(t,e,n,r){n=Number(n)||0;var o=t.length-n;r?(r=Number(r))>o&&(r=o):r=o;var i=e.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a<r;++a){var s=parseInt(e.substr(2*a,2),16);if(isNaN(s))return a;t[n+a]=s}return a}function w(t,e,n,r){return W(L(e,t.length-n),t,n,r)}function x(t,e,n,r){return W(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function _(t,e,n,r){return x(t,e,n,r)}function E(t,e,n,r){return W(U(e),t,n,r)}function C(t,e,n,r){return W(function(t,e){for(var n,r,o,i=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,o=n%256,i.push(o),i.push(r);return i}(e,t.length-n),t,n,r)}function S(t,e,n){return 0===e&&n===t.length?o.fromByteArray(t):o.fromByteArray(t.slice(e,n))}function k(t,e,n){n=Math.min(t.length,n);for(var r=[],o=e;o<n;){var i,a,s,u,c=t[o],l=null,f=c>239?4:c>223?3:c>191?2:1;if(o+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(i=t[o+1]))&&(u=(31&c)<<6|63&i)>127&&(l=u);break;case 3:i=t[o+1],a=t[o+2],128==(192&i)&&128==(192&a)&&(u=(15&c)<<12|(63&i)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:i=t[o+1],a=t[o+2],s=t[o+3],128==(192&i)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),o+=f}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var n="",r=0;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=4096));return n}(r)}function T(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(127&t[o]);return r}function I(t,e,n){var r="";n=Math.min(t.length,n);for(var o=e;o<n;++o)r+=String.fromCharCode(t[o]);return r}function O(t,e,n){var r,o=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>o)&&(n=o);for(var i="",a=e;a<n;++a)i+=(r=t[a])<16?"0"+r.toString(16):r.toString(16);return i}function R(t,e,n){for(var r=t.slice(e,n),o="",i=0;i<r.length;i+=2)o+=String.fromCharCode(r[i]+256*r[i+1]);return o}function A(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function D(t,e,n,o,i,a){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<a)throw new RangeError('"value" argument is out of bounds');if(n+o>t.length)throw new RangeError("Index out of range")}function N(t,e,n,r){e<0&&(e=65535+e+1);for(var o=0,i=Math.min(t.length-n,2);o<i;++o)t[n+o]=(e&255<<8*(r?o:1-o))>>>8*(r?o:1-o)}function P(t,e,n,r){e<0&&(e=4294967295+e+1);for(var o=0,i=Math.min(t.length-n,4);o<i;++o)t[n+o]=e>>>8*(r?o:3-o)&255}function M(t,e,n,r,o,i){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,o){return o||M(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function F(t,e,n,r,o){return o||M(t,0,n,8),i.write(t,e,n,r,52,8),n+8}n.Buffer=r,n.SlowBuffer=function(t){return+t!=t&&(t=0),r.alloc(+t)},n.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),n.kMaxLength=s(),r.poolSize=8192,r._augment=function(t){return t.__proto__=r.prototype,t},r.from=function(t,e,n){return c(null,t,e,n)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(t,e,n){return function(t,e,n,r){return l(e),e<=0?u(t,e):void 0!==n?"string"==typeof r?u(t,e).fill(n,r):u(t,e).fill(n):u(t,e)}(null,t,e,n)},r.allocUnsafe=function(t){return f(null,t)},r.allocUnsafeSlow=function(t){return f(null,t)},r.isBuffer=function(t){return!(null==t||!t._isBuffer)},r.compare=function(t,e){if(!r.isBuffer(t)||!r.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,o=e.length,i=0,a=Math.min(n,o);i<a;++i)if(t[i]!==e[i]){n=t[i],o=e[i];break}return n<o?-1:o<n?1:0},r.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.concat=function(t,e){if(!a(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return r.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var o=r.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var s=t[n];if(!r.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(o,i),i+=s.length}return o},r.byteLength=d,r.prototype._isBuffer=!0,r.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)v(this,e,e+1);return this},r.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},r.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},r.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?k(this,0,t):m.apply(this,arguments)},r.prototype.equals=function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===r.compare(this,t)},r.prototype.inspect=function(){var t="",e=n.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,e).match(/.{2}/g).join(" "),this.length>e&&(t+=" ... ")),"<Buffer "+t+">"},r.prototype.compare=function(t,e,n,o,i){if(!r.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===o&&(o=0),void 0===i&&(i=this.length),e<0||n>t.length||o<0||i>this.length)throw new RangeError("out of range index");if(o>=i&&e>=n)return 0;if(o>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var a=(i>>>=0)-(o>>>=0),s=(n>>>=0)-(e>>>=0),u=Math.min(a,s),c=this.slice(o,i),l=t.slice(e,n),f=0;f<u;++f)if(c[f]!==l[f]){a=c[f],s=l[f];break}return a<s?-1:s<a?1:0},r.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},r.prototype.indexOf=function(t,e,n){return g(this,t,e,n,!0)},r.prototype.lastIndexOf=function(t,e,n){return g(this,t,e,n,!1)},r.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var o=this.length-e;if((void 0===n||n>o)&&(n=o),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return b(this,t,e,n);case"utf8":case"utf-8":return w(this,t,e,n);case"ascii":return x(this,t,e,n);case"latin1":case"binary":return _(this,t,e,n);case"base64":return E(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,e,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.slice=function(t,e){var n,o=this.length;if((t=~~t)<0?(t+=o)<0&&(t=0):t>o&&(t=o),(e=void 0===e?o:~~e)<0?(e+=o)<0&&(e=0):e>o&&(e=o),e<t&&(e=t),r.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=r.prototype;else{var i=e-t;n=new r(i,void 0);for(var a=0;a<i;++a)n[a]=this[a+t]}return n},r.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r},r.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=this[t+--e],o=1;e>0&&(o*=256);)r+=this[t+--e]*o;return r},r.prototype.readUInt8=function(t,e){return e||A(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return e||A(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return e||A(t,2,this.length),this[t]<<8|this[t+1]},r.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]},r.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])},r.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=this[t],o=1,i=0;++i<e&&(o*=256);)r+=this[t+i]*o;return r>=(o*=128)&&(r-=Math.pow(2,8*e)),r},r.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||A(t,e,this.length);for(var r=e,o=1,i=this[t+--r];r>0&&(o*=256);)i+=this[t+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*e)),i},r.prototype.readInt8=function(t,e){return e||A(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.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},r.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},r.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},r.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]},r.prototype.readFloatLE=function(t,e){return e||A(t,4,this.length),i.read(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return e||A(t,4,this.length),i.read(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return e||A(t,8,this.length),i.read(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return e||A(t,8,this.length),i.read(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,n,r){t=+t,e|=0,n|=0,r||D(this,t,e,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[e]=255&t;++i<n&&(o*=256);)this[e+i]=t/o&255;return e+n},r.prototype.writeUIntBE=function(t,e,n,r){t=+t,e|=0,n|=0,r||D(this,t,e,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[e+o]=255&t;--o>=0&&(i*=256);)this[e+o]=t/i&255;return e+n},r.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,255,0),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},r.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},r.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):P(this,t,e,!0),e+4},r.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},r.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);D(this,t,e,n,o-1,-o)}var i=0,a=1,s=0;for(this[e]=255&t;++i<n&&(a*=256);)t<0&&0===s&&0!==this[e+i-1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+n},r.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var o=Math.pow(2,8*n-1);D(this,t,e,n,o-1,-o)}var i=n-1,a=1,s=0;for(this[e+i]=255&t;--i>=0&&(a*=256);)t<0&&0===s&&0!==this[e+i+1]&&(s=1),this[e+i]=(t/a>>0)-s&255;return e+n},r.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,1,127,-128),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):N(this,t,e,!0),e+2},r.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):N(this,t,e,!1),e+2},r.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):P(this,t,e,!0),e+4},r.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||D(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):P(this,t,e,!1),e+4},r.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},r.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},r.prototype.writeDoubleLE=function(t,e,n){return F(this,t,e,!0,n)},r.prototype.writeDoubleBE=function(t,e,n){return F(this,t,e,!1,n)},r.prototype.copy=function(t,e,n,o){if(n||(n=0),o||0===o||(o=this.length),e>=t.length&&(e=t.length),e||(e=0),o>0&&o<n&&(o=n),o===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),t.length-e<o-n&&(o=t.length-e+n);var i,a=o-n;if(this===t&&n<e&&e<o)for(i=a-1;i>=0;--i)t[i+e]=this[i+n];else if(a<1e3||!r.TYPED_ARRAY_SUPPORT)for(i=0;i<a;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+a),e);return a},r.prototype.fill=function(t,e,n,o){if("string"==typeof t){if("string"==typeof e?(o=e,e=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!r.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var a;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(a=e;a<n;++a)this[a]=t;else{var s=r.isBuffer(t)?t:L(new r(t,o).toString()),u=s.length;for(a=0;a<n-e;++a)this[a+e]=s[a%u]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function L(t,e){var n;e=e||1/0;for(var r=t.length,o=null,i=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!o){if(n>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(e-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((e-=1)<0)break;i.push(n)}else if(n<2048){if((e-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;i.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;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function U(t){return o.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 W(t,e,n,r){for(var o=0;o<r&&!(o+n>=e.length||o>=t.length);++o)e[o+n]=t[o];return o}}).call(this,void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"base64-js":69,buffer:73,ieee754:195,isarray:198}],74:[function(t,e,n){e.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],75:[function(t,e,n){e.exports={O_RDONLY:0,O_WRONLY:1,O_RDWR:2,S_IFMT:61440,S_IFREG:32768,S_IFDIR:16384,S_IFCHR:8192,S_IFBLK:24576,S_IFIFO:4096,S_IFLNK:40960,S_IFSOCK:49152,O_CREAT:512,O_EXCL:2048,O_NOCTTY:131072,O_TRUNC:1024,O_APPEND:8,O_DIRECTORY:1048576,O_NOFOLLOW:256,O_SYNC:128,O_SYMLINK:2097152,O_NONBLOCK:4,S_IRWXU:448,S_IRUSR:256,S_IWUSR:128,S_IXUSR:64,S_IRWXG:56,S_IRGRP:32,S_IWGRP:16,S_IXGRP:8,S_IRWXO:7,S_IROTH:4,S_IWOTH:2,S_IXOTH:1,E2BIG:7,EACCES:13,EADDRINUSE:48,EADDRNOTAVAIL:49,EAFNOSUPPORT:47,EAGAIN:35,EALREADY:37,EBADF:9,EBADMSG:94,EBUSY:16,ECANCELED:89,ECHILD:10,ECONNABORTED:53,ECONNREFUSED:61,ECONNRESET:54,EDEADLK:11,EDESTADDRREQ:39,EDOM:33,EDQUOT:69,EEXIST:17,EFAULT:14,EFBIG:27,EHOSTUNREACH:65,EIDRM:90,EILSEQ:92,EINPROGRESS:36,EINTR:4,EINVAL:22,EIO:5,EISCONN:56,EISDIR:21,ELOOP:62,EMFILE:24,EMLINK:31,EMSGSIZE:40,EMULTIHOP:95,ENAMETOOLONG:63,ENETDOWN:50,ENETRESET:52,ENETUNREACH:51,ENFILE:23,ENOBUFS:55,ENODATA:96,ENODEV:19,ENOENT:2,ENOEXEC:8,ENOLCK:77,ENOLINK:97,ENOMEM:12,ENOMSG:91,ENOPROTOOPT:42,ENOSPC:28,ENOSR:98,ENOSTR:99,ENOSYS:78,ENOTCONN:57,ENOTDIR:20,ENOTEMPTY:66,ENOTSOCK:38,ENOTSUP:45,ENOTTY:25,ENXIO:6,EOPNOTSUPP:102,EOVERFLOW:84,EPERM:1,EPIPE:32,EPROTO:100,EPROTONOSUPPORT:43,EPROTOTYPE:41,ERANGE:34,EROFS:30,ESPIPE:29,ESRCH:3,ESTALE:70,ETIME:101,ETIMEDOUT:60,ETXTBSY:26,EWOULDBLOCK:35,EXDEV:18,SIGHUP:1,SIGINT:2,SIGQUIT:3,SIGILL:4,SIGTRAP:5,SIGABRT:6,SIGIOT:6,SIGBUS:10,SIGFPE:8,SIGKILL:9,SIGUSR1:30,SIGSEGV:11,SIGUSR2:31,SIGPIPE:13,SIGALRM:14,SIGTERM:15,SIGCHLD:20,SIGCONT:19,SIGSTOP:17,SIGTSTP:18,SIGTTIN:21,SIGTTOU:22,SIGURG:16,SIGXCPU:24,SIGXFSZ:25,SIGVTALRM:26,SIGPROF:27,SIGWINCH:28,SIGIO:23,SIGSYS:12,SSL_OP_ALL:2147486719,SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION:262144,SSL_OP_CIPHER_SERVER_PREFERENCE:4194304,SSL_OP_CISCO_ANYCONNECT:32768,SSL_OP_COOKIE_EXCHANGE:8192,SSL_OP_CRYPTOPRO_TLSEXT_BUG:2147483648,SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS:2048,SSL_OP_EPHEMERAL_RSA:0,SSL_OP_LEGACY_SERVER_CONNECT:4,SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER:32,SSL_OP_MICROSOFT_SESS_ID_BUG:1,SSL_OP_MSIE_SSLV2_RSA_PADDING:0,SSL_OP_NETSCAPE_CA_DN_BUG:536870912,SSL_OP_NETSCAPE_CHALLENGE_BUG:2,SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG:1073741824,SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG:8,SSL_OP_NO_COMPRESSION:131072,SSL_OP_NO_QUERY_MTU:4096,SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION:65536,SSL_OP_NO_SSLv2:16777216,SSL_OP_NO_SSLv3:33554432,SSL_OP_NO_TICKET:16384,SSL_OP_NO_TLSv1:67108864,SSL_OP_NO_TLSv1_1:268435456,SSL_OP_NO_TLSv1_2:134217728,SSL_OP_PKCS1_CHECK_1:0,SSL_OP_PKCS1_CHECK_2:0,SSL_OP_SINGLE_DH_USE:1048576,SSL_OP_SINGLE_ECDH_USE:524288,SSL_OP_SSLEAY_080_CLIENT_DH_BUG:128,SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG:0,SSL_OP_TLS_BLOCK_PADDING_BUG:512,SSL_OP_TLS_D5_BUG:256,SSL_OP_TLS_ROLLBACK_BUG:8388608,ENGINE_METHOD_DSA:2,ENGINE_METHOD_DH:4,ENGINE_METHOD_RAND:8,ENGINE_METHOD_ECDH:16,ENGINE_METHOD_ECDSA:32,ENGINE_METHOD_CIPHERS:64,ENGINE_METHOD_DIGESTS:128,ENGINE_METHOD_STORE:256,ENGINE_METHOD_PKEY_METHS:512,ENGINE_METHOD_PKEY_ASN1_METHS:1024,ENGINE_METHOD_ALL:65535,ENGINE_METHOD_NONE:0,DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6,F_OK:0,R_OK:4,W_OK:2,X_OK:1,UV_UDP_REUSEADDR:4}},{}],76:[function(t,e,n){
/*!
* copy-to - index.js
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
* MIT Licensed
*/
"use strict";var r=Array.prototype.slice;function o(t,e){if(!(this instanceof o))return new o(t,e);this.src=t,this._withAccess=e}function i(t,e){return void 0===t[e]&&void 0===t.__lookupGetter__(e)&&void 0===t.__lookupSetter__(e)}e.exports=o,o.prototype.withAccess=function(t){return this._withAccess=!1!==t,this},o.prototype.pick=function(t){return Array.isArray(t)||(t=r.call(arguments)),t.length&&(this.keys=t),this},o.prototype.to=function(t){if(t=t||{},!this.src)return t;var e=this.keys||Object.keys(this.src);if(!this._withAccess){for(var n=0;n<e.length;n++)void 0===t[r=e[n]]&&(t[r]=this.src[r]);return t}for(n=0;n<e.length;n++){var r=e[n];if(i(t,r)){var o=this.src.__lookupGetter__(r),a=this.src.__lookupSetter__(r);o&&t.__defineGetter__(r,o),a&&t.__defineSetter__(r,a),o||a||(t[r]=this.src[r])}}return t},o.prototype.toCover=function(t){for(var e=this.keys||Object.keys(this.src),n=0;n<e.length;n++){var r=e[n];delete t[r];var o=this.src.__lookupGetter__(r),i=this.src.__lookupSetter__(r);o&&t.__defineGetter__(r,o),i&&t.__defineSetter__(r,i),o||i||(t[r]=this.src[r])}},o.prototype.override=o.prototype.toCover,o.prototype.and=function(t){var e={};return this.to(e),this.src=t,this.to(e),this.src=e,this}},{}],77:[function(t,e,n){t("../../modules/es6.string.iterator"),t("../../modules/es6.array.from"),e.exports=t("../../modules/_core").Array.from},{"../../modules/_core":99,"../../modules/es6.array.from":168,"../../modules/es6.string.iterator":180}],78:[function(t,e,n){var r=t("../../modules/_core"),o=r.JSON||(r.JSON={stringify:JSON.stringify});e.exports=function(t){return o.stringify.apply(o,arguments)}},{"../../modules/_core":99}],79:[function(t,e,n){t("../../modules/es6.object.assign"),e.exports=t("../../modules/_core").Object.assign},{"../../modules/_core":99,"../../modules/es6.object.assign":171}],80:[function(t,e,n){t("../../modules/es6.object.create");var r=t("../../modules/_core").Object;e.exports=function(t,e){return r.create(t,e)}},{"../../modules/_core":99,"../../modules/es6.object.create":172}],81:[function(t,e,n){t("../../modules/es6.object.define-property");var r=t("../../modules/_core").Object;e.exports=function(t,e,n){return r.defineProperty(t,e,n)}},{"../../modules/_core":99,"../../modules/es6.object.define-property":173}],82:[function(t,e,n){t("../../modules/es7.object.entries"),e.exports=t("../../modules/_core").Object.entries},{"../../modules/_core":99,"../../modules/es7.object.entries":182}],83:[function(t,e,n){t("../../modules/es6.object.get-own-property-names");var r=t("../../modules/_core").Object;e.exports=function(t){return r.getOwnPropertyNames(t)}},{"../../modules/_core":99,"../../modules/es6.object.get-own-property-names":174}],84:[function(t,e,n){t("../../modules/es6.object.get-prototype-of"),e.exports=t("../../modules/_core").Object.getPrototypeOf},{"../../modules/_core":99,"../../modules/es6.object.get-prototype-of":175}],85:[function(t,e,n){t("../../modules/es6.object.keys"),e.exports=t("../../modules/_core").Object.keys},{"../../modules/_core":99,"../../modules/es6.object.keys":176}],86:[function(t,e,n){t("../modules/es6.object.to-string"),t("../modules/es6.string.iterator"),t("../modules/web.dom.iterable"),t("../modules/es6.promise"),t("../modules/es7.promise.finally"),t("../modules/es7.promise.try"),e.exports=t("../modules/_core").Promise},{"../modules/_core":99,"../modules/es6.object.to-string":177,"../modules/es6.promise":178,"../modules/es6.string.iterator":180,"../modules/es7.promise.finally":183,"../modules/es7.promise.try":184,"../modules/web.dom.iterable":187}],87:[function(t,e,n){t("../modules/web.immediate"),e.exports=t("../modules/_core").setImmediate},{"../modules/_core":99,"../modules/web.immediate":188}],88:[function(t,e,n){t("../../modules/es6.string.from-code-point"),e.exports=t("../../modules/_core").String.fromCodePoint},{"../../modules/_core":99,"../../modules/es6.string.from-code-point":179}],89:[function(t,e,n){t("../../modules/es6.function.has-instance"),e.exports=t("../../modules/_wks-ext").f("hasInstance")},{"../../modules/_wks-ext":165,"../../modules/es6.function.has-instance":170}],90:[function(t,e,n){t("../../modules/es6.symbol"),t("../../modules/es6.object.to-string"),t("../../modules/es7.symbol.async-iterator"),t("../../modules/es7.symbol.observable"),e.exports=t("../../modules/_core").Symbol},{"../../modules/_core":99,"../../modules/es6.object.to-string":177,"../../modules/es6.symbol":181,"../../modules/es7.symbol.async-iterator":185,"../../modules/es7.symbol.observable":186}],91:[function(t,e,n){t("../../modules/es6.string.iterator"),t("../../modules/web.dom.iterable"),e.exports=t("../../modules/_wks-ext").f("iterator")},{"../../modules/_wks-ext":165,"../../modules/es6.string.iterator":180,"../../modules/web.dom.iterable":187}],92:[function(t,e,n){e.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},{}],93:[function(t,e,n){e.exports=function(){}},{}],94:[function(t,e,n){e.exports=function(t,e,n,r){if(!(t instanceof e)||void 0!==r&&r in t)throw TypeError(n+": incorrect invocation!");return t}},{}],95:[function(t,e,n){var r=t("./_is-object");e.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},{"./_is-object":119}],96:[function(t,e,n){var r=t("./_to-iobject"),o=t("./_to-length"),i=t("./_to-absolute-index");e.exports=function(t){return function(e,n,a){var s,u=r(e),c=o(u.length),l=i(a,c);if(t&&n!=n){for(;c>l;)if((s=u[l++])!=s)return!0}else for(;c>l;l++)if((t||l in u)&&u[l]===n)return t||l||0;return!t&&-1}}},{"./_to-absolute-index":156,"./_to-iobject":158,"./_to-length":159}],97:[function(t,e,n){var r=t("./_cof"),o=t("./_wks")("toStringTag"),i="Arguments"==r(function(){return arguments}());e.exports=function(t){var e,n,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=function(t,e){try{return t[e]}catch(t){}}(e=Object(t),o))?n:i?r(e):"Object"==(a=r(e))&&"function"==typeof e.callee?"Arguments":a}},{"./_cof":98,"./_wks":166}],98:[function(t,e,n){var r={}.toString;e.exports=function(t){return r.call(t).slice(8,-1)}},{}],99:[function(t,e,n){var r=e.exports={version:"2.6.11"};"number"==typeof __e&&(__e=r)},{}],100:[function(t,e,n){"use strict";var r=t("./_object-dp"),o=t("./_property-desc");e.exports=function(t,e,n){e in t?r.f(t,e,o(0,n)):t[e]=n}},{"./_object-dp":132,"./_property-desc":146}],101:[function(t,e,n){var r=t("./_a-function");e.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,o){return t.call(e,n,r,o)}}return function(){return t.apply(e,arguments)}}},{"./_a-function":92}],102:[function(t,e,n){e.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},{}],103:[function(t,e,n){e.exports=!t("./_fails")((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},{"./_fails":108}],104:[function(t,e,n){var r=t("./_is-object"),o=t("./_global").document,i=r(o)&&r(o.createElement);e.exports=function(t){return i?o.createElement(t):{}}},{"./_global":110,"./_is-object":119}],105:[function(t,e,n){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},{}],106:[function(t,e,n){var r=t("./_object-keys"),o=t("./_object-gops"),i=t("./_object-pie");e.exports=function(t){var e=r(t),n=o.f;if(n)for(var a,s=n(t),u=i.f,c=0;s.length>c;)u.call(t,a=s[c++])&&e.push(a);return e}},{"./_object-gops":137,"./_object-keys":140,"./_object-pie":141}],107:[function(t,e,n){var r=t("./_global"),o=t("./_core"),i=t("./_ctx"),a=t("./_hide"),s=t("./_has"),u=function(t,e,n){var c,l,f,h=t&u.F,p=t&u.G,d=t&u.S,m=t&u.P,v=t&u.B,g=t&u.W,y=p?o:o[e]||(o[e]={}),b=y.prototype,w=p?r:d?r[e]:(r[e]||{}).prototype;for(c in p&&(n=e),n)(l=!h&&w&&void 0!==w[c])&&s(y,c)||(f=l?w[c]:n[c],y[c]=p&&"function"!=typeof w[c]?n[c]:v&&l?i(f,r):g&&w[c]==f?function(t){var e=function(e,n,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(e);case 2:return new t(e,n)}return new t(e,n,r)}return t.apply(this,arguments)};return e.prototype=t.prototype,e}(f):m&&"function"==typeof f?i(Function.call,f):f,m&&((y.virtual||(y.virtual={}))[c]=f,t&u.R&&b&&!b[c]&&a(b,c,f)))};u.F=1,u.G=2,u.S=4,u.P=8,u.B=16,u.W=32,u.U=64,u.R=128,e.exports=u},{"./_core":99,"./_ctx":101,"./_global":110,"./_has":111,"./_hide":112}],108:[function(t,e,n){e.exports=function(t){try{return!!t()}catch(t){return!0}}},{}],109:[function(t,e,n){var r=t("./_ctx"),o=t("./_iter-call"),i=t("./_is-array-iter"),a=t("./_an-object"),s=t("./_to-length"),u=t("./core.get-iterator-method"),c={},l={};(n=e.exports=function(t,e,n,f,h){var p,d,m,v,g=h?function(){return t}:u(t),y=r(n,f,e?2:1),b=0;if("function"!=typeof g)throw TypeError(t+" is not iterable!");if(i(g)){for(p=s(t.length);p>b;b++)if((v=e?y(a(d=t[b])[0],d[1]):y(t[b]))===c||v===l)return v}else for(m=g.call(t);!(d=m.next()).done;)if((v=o(m,y,d.value,e))===c||v===l)return v}).BREAK=c,n.RETURN=l},{"./_an-object":95,"./_ctx":101,"./_is-array-iter":117,"./_iter-call":120,"./_to-length":159,"./core.get-iterator-method":167}],110:[function(t,e,n){var r=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=r)},{}],111:[function(t,e,n){var r={}.hasOwnProperty;e.exports=function(t,e){return r.call(t,e)}},{}],112:[function(t,e,n){var r=t("./_object-dp"),o=t("./_property-desc");e.exports=t("./_descriptors")?function(t,e,n){return r.f(t,e,o(1,n))}:function(t,e,n){return t[e]=n,t}},{"./_descriptors":103,"./_object-dp":132,"./_property-desc":146}],113:[function(t,e,n){var r=t("./_global").document;e.exports=r&&r.documentElement},{"./_global":110}],114:[function(t,e,n){e.exports=!t("./_descriptors")&&!t("./_fails")((function(){return 7!=Object.defineProperty(t("./_dom-create")("div"),"a",{get:function(){return 7}}).a}))},{"./_descriptors":103,"./_dom-create":104,"./_fails":108}],115:[function(t,e,n){e.exports=function(t,e,n){var r=void 0===n;switch(e.length){case 0:return r?t():t.call(n);case 1:return r?t(e[0]):t.call(n,e[0]);case 2:return r?t(e[0],e[1]):t.call(n,e[0],e[1]);case 3:return r?t(e[0],e[1],e[2]):t.call(n,e[0],e[1],e[2]);case 4:return r?t(e[0],e[1],e[2],e[3]):t.call(n,e[0],e[1],e[2],e[3])}return t.apply(n,e)}},{}],116:[function(t,e,n){var r=t("./_cof");e.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},{"./_cof":98}],117:[function(t,e,n){var r=t("./_iterators"),o=t("./_wks")("iterator"),i=Array.prototype;e.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},{"./_iterators":125,"./_wks":166}],118:[function(t,e,n){var r=t("./_cof");e.exports=Array.isArray||function(t){return"Array"==r(t)}},{"./_cof":98}],119:[function(t,e,n){e.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},{}],120:[function(t,e,n){var r=t("./_an-object");e.exports=function(t,e,n,o){try{return o?e(r(n)[0],n[1]):e(n)}catch(e){var i=t.return;throw void 0!==i&&r(i.call(t)),e}}},{"./_an-object":95}],121:[function(t,e,n){"use strict";var r=t("./_object-create"),o=t("./_property-desc"),i=t("./_set-to-string-tag"),a={};t("./_hide")(a,t("./_wks")("iterator"),(function(){return this})),e.exports=function(t,e,n){t.prototype=r(a,{next:o(1,n)}),i(t,e+" Iterator")}},{"./_hide":112,"./_object-create":131,"./_property-desc":146,"./_set-to-string-tag":150,"./_wks":166}],122:[function(t,e,n){"use strict";var r=t("./_library"),o=t("./_export"),i=t("./_redefine"),a=t("./_hide"),s=t("./_iterators"),u=t("./_iter-create"),c=t("./_set-to-string-tag"),l=t("./_object-gpo"),f=t("./_wks")("iterator"),h=!([].keys&&"next"in[].keys()),p=function(){return this};e.exports=function(t,e,n,d,m,v,g){u(n,e,d);var y,b,w,x=function(t){if(!h&&t in S)return S[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},_=e+" Iterator",E="values"==m,C=!1,S=t.prototype,k=S[f]||S["@@iterator"]||m&&S[m],T=k||x(m),I=m?E?x("entries"):T:void 0,O="Array"==e&&S.entries||k;if(O&&(w=l(O.call(new t)))!==Object.prototype&&w.next&&(c(w,_,!0),r||"function"==typeof w[f]||a(w,f,p)),E&&k&&"values"!==k.name&&(C=!0,T=function(){return k.call(this)}),r&&!g||!h&&!C&&S[f]||a(S,f,T),s[e]=T,s[_]=p,m)if(y={values:E?T:x("values"),keys:v?T:x("keys"),entries:I},g)for(b in y)b in S||i(S,b,y[b]);else o(o.P+o.F*(h||C),e,y);return y}},{"./_export":107,"./_hide":112,"./_iter-create":121,"./_iterators":125,"./_library":126,"./_object-gpo":138,"./_redefine":148,"./_set-to-string-tag":150,"./_wks":166}],123:[function(t,e,n){var r=t("./_wks")("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,(function(){throw 2}))}catch(t){}e.exports=function(t,e){if(!e&&!o)return!1;var n=!1;try{var i=[7],a=i[r]();a.next=function(){return{done:n=!0}},i[r]=function(){return a},t(i)}catch(t){}return n}},{"./_wks":166}],124:[function(t,e,n){e.exports=function(t,e){return{value:e,done:!!t}}},{}],125:[function(t,e,n){e.exports={}},{}],126:[function(t,e,n){e.exports=!0},{}],127:[function(t,e,n){var r=t("./_uid")("meta"),o=t("./_is-object"),i=t("./_has"),a=t("./_object-dp").f,s=0,u=Object.isExtensible||function(){return!0},c=!t("./_fails")((function(){return u(Object.preventExtensions({}))})),l=function(t){a(t,r,{value:{i:"O"+ ++s,w:{}}})},f=e.exports={KEY:r,NEED:!1,fastKey:function(t,e){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!u(t))return"F";if(!e)return"E";l(t)}return t[r].i},getWeak:function(t,e){if(!i(t,r)){if(!u(t))return!0;if(!e)return!1;l(t)}return t[r].w},onFreeze:function(t){return c&&f.NEED&&u(t)&&!i(t,r)&&l(t),t}}},{"./_fails":108,"./_has":111,"./_is-object":119,"./_object-dp":132,"./_uid":162}],128:[function(t,e,n){var r=t("./_global"),o=t("./_task").set,i=r.MutationObserver||r.WebKitMutationObserver,a=r.process,s=r.Promise,u="process"==t("./_cof")(a);e.exports=function(){var t,e,n,c=function(){var r,o;for(u&&(r=a.domain)&&r.exit();t;){o=t.fn,t=t.next;try{o()}catch(r){throw t?n():e=void 0,r}}e=void 0,r&&r.enter()};if(u)n=function(){a.nextTick(c)};else if(!i||r.navigator&&r.navigator.standalone)if(s&&s.resolve){var l=s.resolve(void 0);n=function(){l.then(c)}}else n=function(){o.call(r,c)};else{var f=!0,h=document.createTextNode("");new i(c).observe(h,{characterData:!0}),n=function(){h.data=f=!f}}return function(r){var o={fn:r,next:void 0};e&&(e.next=o),t||(t=o,n()),e=o}}},{"./_cof":98,"./_global":110,"./_task":155}],129:[function(t,e,n){"use strict";var r=t("./_a-function");function o(t){var e,n;this.promise=new t((function(t,r){if(void 0!==e||void 0!==n)throw TypeError("Bad Promise constructor");e=t,n=r})),this.resolve=r(e),this.reject=r(n)}e.exports.f=function(t){return new o(t)}},{"./_a-function":92}],130:[function(t,e,n){"use strict";var r=t("./_descriptors"),o=t("./_object-keys"),i=t("./_object-gops"),a=t("./_object-pie"),s=t("./_to-object"),u=t("./_iobject"),c=Object.assign;e.exports=!c||t("./_fails")((function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach((function(t){e[t]=t})),7!=c({},t)[n]||Object.keys(c({},e)).join("")!=r}))?function(t,e){for(var n=s(t),c=arguments.length,l=1,f=i.f,h=a.f;c>l;)for(var p,d=u(arguments[l++]),m=f?o(d).concat(f(d)):o(d),v=m.length,g=0;v>g;)p=m[g++],r&&!h.call(d,p)||(n[p]=d[p]);return n}:c},{"./_descriptors":103,"./_fails":108,"./_iobject":116,"./_object-gops":137,"./_object-keys":140,"./_object-pie":141,"./_to-object":160}],131:[function(t,e,n){var r=t("./_an-object"),o=t("./_object-dps"),i=t("./_enum-bug-keys"),a=t("./_shared-key")("IE_PROTO"),s=function(){},u=function(){var e,n=t("./_dom-create")("iframe"),r=i.length;for(n.style.display="none",t("./_html").appendChild(n),n.src="javascript:",(e=n.contentWindow.document).open(),e.write("<script>document.F=Object<\/script>"),e.close(),u=e.F;r--;)delete u.prototype[i[r]];return u()};e.exports=Object.create||function(t,e){var n;return null!==t?(s.prototype=r(t),n=new s,s.prototype=null,n[a]=t):n=u(),void 0===e?n:o(n,e)}},{"./_an-object":95,"./_dom-create":104,"./_enum-bug-keys":105,"./_html":113,"./_object-dps":133,"./_shared-key":151}],132:[function(t,e,n){var r=t("./_an-object"),o=t("./_ie8-dom-define"),i=t("./_to-primitive"),a=Object.defineProperty;n.f=t("./_descriptors")?Object.defineProperty:function(t,e,n){if(r(t),e=i(e,!0),r(n),o)try{return a(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},{"./_an-object":95,"./_descriptors":103,"./_ie8-dom-define":114,"./_to-primitive":161}],133:[function(t,e,n){var r=t("./_object-dp"),o=t("./_an-object"),i=t("./_object-keys");e.exports=t("./_descriptors")?Object.defineProperties:function(t,e){o(t);for(var n,a=i(e),s=a.length,u=0;s>u;)r.f(t,n=a[u++],e[n]);return t}},{"./_an-object":95,"./_descriptors":103,"./_object-dp":132,"./_object-keys":140}],134:[function(t,e,n){var r=t("./_object-pie"),o=t("./_property-desc"),i=t("./_to-iobject"),a=t("./_to-primitive"),s=t("./_has"),u=t("./_ie8-dom-define"),c=Object.getOwnPropertyDescriptor;n.f=t("./_descriptors")?c:function(t,e){if(t=i(t),e=a(e,!0),u)try{return c(t,e)}catch(t){}if(s(t,e))return o(!r.f.call(t,e),t[e])}},{"./_descriptors":103,"./_has":111,"./_ie8-dom-define":114,"./_object-pie":141,"./_property-desc":146,"./_to-iobject":158,"./_to-primitive":161}],135:[function(t,e,n){var r=t("./_to-iobject"),o=t("./_object-gopn").f,i={}.toString,a="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];e.exports.f=function(t){return a&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return a.slice()}}(t):o(r(t))}},{"./_object-gopn":136,"./_to-iobject":158}],136:[function(t,e,n){var r=t("./_object-keys-internal"),o=t("./_enum-bug-keys").concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},{"./_enum-bug-keys":105,"./_object-keys-internal":139}],137:[function(t,e,n){n.f=Object.getOwnPropertySymbols},{}],138:[function(t,e,n){var r=t("./_has"),o=t("./_to-object"),i=t("./_shared-key")("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?a:null}},{"./_has":111,"./_shared-key":151,"./_to-object":160}],139:[function(t,e,n){var r=t("./_has"),o=t("./_to-iobject"),i=t("./_array-includes")(!1),a=t("./_shared-key")("IE_PROTO");e.exports=function(t,e){var n,s=o(t),u=0,c=[];for(n in s)n!=a&&r(s,n)&&c.push(n);for(;e.length>u;)r(s,n=e[u++])&&(~i(c,n)||c.push(n));return c}},{"./_array-includes":96,"./_has":111,"./_shared-key":151,"./_to-iobject":158}],140:[function(t,e,n){var r=t("./_object-keys-internal"),o=t("./_enum-bug-keys");e.exports=Object.keys||function(t){return r(t,o)}},{"./_enum-bug-keys":105,"./_object-keys-internal":139}],141:[function(t,e,n){n.f={}.propertyIsEnumerable},{}],142:[function(t,e,n){var r=t("./_export"),o=t("./_core"),i=t("./_fails");e.exports=function(t,e){var n=(o.Object||{})[t]||Object[t],a={};a[t]=e(n),r(r.S+r.F*i((function(){n(1)})),"Object",a)}},{"./_core":99,"./_export":107,"./_fails":108}],143:[function(t,e,n){var r=t("./_descriptors"),o=t("./_object-keys"),i=t("./_to-iobject"),a=t("./_object-pie").f;e.exports=function(t){return function(e){for(var n,s=i(e),u=o(s),c=u.length,l=0,f=[];c>l;)n=u[l++],r&&!a.call(s,n)||f.push(t?[n,s[n]]:s[n]);return f}}},{"./_descriptors":103,"./_object-keys":140,"./_object-pie":141,"./_to-iobject":158}],144:[function(t,e,n){e.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},{}],145:[function(t,e,n){var r=t("./_an-object"),o=t("./_is-object"),i=t("./_new-promise-capability");e.exports=function(t,e){if(r(t),o(e)&&e.constructor===t)return e;var n=i.f(t);return(0,n.resolve)(e),n.promise}},{"./_an-object":95,"./_is-object":119,"./_new-promise-capability":129}],146:[function(t,e,n){e.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},{}],147:[function(t,e,n){var r=t("./_hide");e.exports=function(t,e,n){for(var o in e)n&&t[o]?t[o]=e[o]:r(t,o,e[o]);return t}},{"./_hide":112}],148:[function(t,e,n){e.exports=t("./_hide")},{"./_hide":112}],149:[function(t,e,n){"use strict";var r=t("./_global"),o=t("./_core"),i=t("./_object-dp"),a=t("./_descriptors"),s=t("./_wks")("species");e.exports=function(t){var e="function"==typeof o[t]?o[t]:r[t];a&&e&&!e[s]&&i.f(e,s,{configurable:!0,get:function(){return this}})}},{"./_core":99,"./_descriptors":103,"./_global":110,"./_object-dp":132,"./_wks":166}],150:[function(t,e,n){var r=t("./_object-dp").f,o=t("./_has"),i=t("./_wks")("toStringTag");e.exports=function(t,e,n){t&&!o(t=n?t:t.prototype,i)&&r(t,i,{configurable:!0,value:e})}},{"./_has":111,"./_object-dp":132,"./_wks":166}],151:[function(t,e,n){var r=t("./_shared")("keys"),o=t("./_uid");e.exports=function(t){return r[t]||(r[t]=o(t))}},{"./_shared":152,"./_uid":162}],152:[function(t,e,n){var r=t("./_core"),o=t("./_global"),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(e.exports=function(t,e){return i[t]||(i[t]=void 0!==e?e:{})})("versions",[]).push({version:r.version,mode:t("./_library")?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},{"./_core":99,"./_global":110,"./_library":126}],153:[function(t,e,n){var r=t("./_an-object"),o=t("./_a-function"),i=t("./_wks")("species");e.exports=function(t,e){var n,a=r(t).constructor;return void 0===a||null==(n=r(a)[i])?e:o(n)}},{"./_a-function":92,"./_an-object":95,"./_wks":166}],154:[function(t,e,n){var r=t("./_to-integer"),o=t("./_defined");e.exports=function(t){return function(e,n){var i,a,s=String(o(e)),u=r(n),c=s.length;return u<0||u>=c?t?"":void 0:(i=s.charCodeAt(u))<55296||i>56319||u+1===c||(a=s.charCodeAt(u+1))<56320||a>57343?t?s.charAt(u):i:t?s.slice(u,u+2):a-56320+(i-55296<<10)+65536}}},{"./_defined":102,"./_to-integer":157}],155:[function(t,e,n){var r,o,i,a=t("./_ctx"),s=t("./_invoke"),u=t("./_html"),c=t("./_dom-create"),l=t("./_global"),f=l.process,h=l.setImmediate,p=l.clearImmediate,d=l.MessageChannel,m=l.Dispatch,v=0,g={},y=function(){var t=+this;if(g.hasOwnProperty(t)){var e=g[t];delete g[t],e()}},b=function(t){y.call(t.data)};h&&p||(h=function(t){for(var e=[],n=1;arguments.length>n;)e.push(arguments[n++]);return g[++v]=function(){s("function"==typeof t?t:Function(t),e)},r(v),v},p=function(t){delete g[t]},"process"==t("./_cof")(f)?r=function(t){f.nextTick(a(y,t,1))}:m&&m.now?r=function(t){m.now(a(y,t,1))}:d?(i=(o=new d).port2,o.port1.onmessage=b,r=a(i.postMessage,i,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScripts?(r=function(t){l.postMessage(t+"","*")},l.addEventListener("message",b,!1)):r="onreadystatechange"in c("script")?function(t){u.appendChild(c("script")).onreadystatechange=function(){u.removeChild(this),y.call(t)}}:function(t){setTimeout(a(y,t,1),0)}),e.exports={set:h,clear:p}},{"./_cof":98,"./_ctx":101,"./_dom-create":104,"./_global":110,"./_html":113,"./_invoke":115}],156:[function(t,e,n){var r=t("./_to-integer"),o=Math.max,i=Math.min;e.exports=function(t,e){return(t=r(t))<0?o(t+e,0):i(t,e)}},{"./_to-integer":157}],157:[function(t,e,n){var r=Math.ceil,o=Math.floor;e.exports=function(t){return isNaN(t=+t)?0:(t>0?o:r)(t)}},{}],158:[function(t,e,n){var r=t("./_iobject"),o=t("./_defined");e.exports=function(t){return r(o(t))}},{"./_defined":102,"./_iobject":116}],159:[function(t,e,n){var r=t("./_to-integer"),o=Math.min;e.exports=function(t){return t>0?o(r(t),9007199254740991):0}},{"./_to-integer":157}],160:[function(t,e,n){var r=t("./_defined");e.exports=function(t){return Object(r(t))}},{"./_defined":102}],161:[function(t,e,n){var r=t("./_is-object");e.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},{"./_is-object":119}],162:[function(t,e,n){var r=0,o=Math.random();e.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++r+o).toString(36))}},{}],163:[function(t,e,n){var r=t("./_global").navigator;e.exports=r&&r.userAgent||""},{"./_global":110}],164:[function(t,e,n){var r=t("./_global"),o=t("./_core"),i=t("./_library"),a=t("./_wks-ext"),s=t("./_object-dp").f;e.exports=function(t){var e=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in e||s(e,t,{value:a.f(t)})}},{"./_core":99,"./_global":110,"./_library":126,"./_object-dp":132,"./_wks-ext":165}],165:[function(t,e,n){n.f=t("./_wks")},{"./_wks":166}],166:[function(t,e,n){var r=t("./_shared")("wks"),o=t("./_uid"),i=t("./_global").Symbol,a="function"==typeof i;(e.exports=function(t){return r[t]||(r[t]=a&&i[t]||(a?i:o)("Symbol."+t))}).store=r},{"./_global":110,"./_shared":152,"./_uid":162}],167:[function(t,e,n){var r=t("./_classof"),o=t("./_wks")("iterator"),i=t("./_iterators");e.exports=t("./_core").getIteratorMethod=function(t){if(null!=t)return t[o]||t["@@iterator"]||i[r(t)]}},{"./_classof":97,"./_core":99,"./_iterators":125,"./_wks":166}],168:[function(t,e,n){"use strict";var r=t("./_ctx"),o=t("./_export"),i=t("./_to-object"),a=t("./_iter-call"),s=t("./_is-array-iter"),u=t("./_to-length"),c=t("./_create-property"),l=t("./core.get-iterator-method");o(o.S+o.F*!t("./_iter-detect")((function(t){Array.from(t)})),"Array",{from:function(t){var e,n,o,f,h=i(t),p="function"==typeof this?this:Array,d=arguments.length,m=d>1?arguments[1]:void 0,v=void 0!==m,g=0,y=l(h);if(v&&(m=r(m,d>2?arguments[2]:void 0,2)),null==y||p==Array&&s(y))for(n=new p(e=u(h.length));e>g;g++)c(n,g,v?m(h[g],g):h[g]);else for(f=y.call(h),n=new p;!(o=f.next()).done;g++)c(n,g,v?a(f,m,[o.value,g],!0):o.value);return n.length=g,n}})},{"./_create-property":100,"./_ctx":101,"./_export":107,"./_is-array-iter":117,"./_iter-call":120,"./_iter-detect":123,"./_to-length":159,"./_to-object":160,"./core.get-iterator-method":167}],169:[function(t,e,n){"use strict";var r=t("./_add-to-unscopables"),o=t("./_iter-step"),i=t("./_iterators"),a=t("./_to-iobject");e.exports=t("./_iter-define")(Array,"Array",(function(t,e){this._t=a(t),this._i=0,this._k=e}),(function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,o(1)):o(0,"keys"==e?n:"values"==e?t[n]:[n,t[n]])}),"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},{"./_add-to-unscopables":93,"./_iter-define":122,"./_iter-step":124,"./_iterators":125,"./_to-iobject":158}],170:[function(t,e,n){"use strict";var r=t("./_is-object"),o=t("./_object-gpo"),i=t("./_wks")("hasInstance"),a=Function.prototype;i in a||t("./_object-dp").f(a,i,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=o(t);)if(this.prototype===t)return!0;return!1}})},{"./_is-object":119,"./_object-dp":132,"./_object-gpo":138,"./_wks":166}],171:[function(t,e,n){var r=t("./_export");r(r.S+r.F,"Object",{assign:t("./_object-assign")})},{"./_export":107,"./_object-assign":130}],172:[function(t,e,n){var r=t("./_export");r(r.S,"Object",{create:t("./_object-create")})},{"./_export":107,"./_object-create":131}],173:[function(t,e,n){var r=t("./_export");r(r.S+r.F*!t("./_descriptors"),"Object",{defineProperty:t("./_object-dp").f})},{"./_descriptors":103,"./_export":107,"./_object-dp":132}],174:[function(t,e,n){t("./_object-sap")("getOwnPropertyNames",(function(){return t("./_object-gopn-ext").f}))},{"./_object-gopn-ext":135,"./_object-sap":142}],175:[function(t,e,n){var r=t("./_to-object"),o=t("./_object-gpo");t("./_object-sap")("getPrototypeOf",(function(){return function(t){return o(r(t))}}))},{"./_object-gpo":138,"./_object-sap":142,"./_to-object":160}],176:[function(t,e,n){var r=t("./_to-object"),o=t("./_object-keys");t("./_object-sap")("keys",(function(){return function(t){return o(r(t))}}))},{"./_object-keys":140,"./_object-sap":142,"./_to-object":160}],177:[function(t,e,n){arguments[4][71][0].apply(n,arguments)},{dup:71}],178:[function(t,e,n){"use strict";var r,o,i,a,s=t("./_library"),u=t("./_global"),c=t("./_ctx"),l=t("./_classof"),f=t("./_export"),h=t("./_is-object"),p=t("./_a-function"),d=t("./_an-instance"),m=t("./_for-of"),v=t("./_species-constructor"),g=t("./_task").set,y=t("./_microtask")(),b=t("./_new-promise-capability"),w=t("./_perform"),x=t("./_user-agent"),_=t("./_promise-resolve"),E=u.TypeError,C=u.process,S=C&&C.versions,k=S&&S.v8||"",T=u.Promise,I="process"==l(C),O=function(){},R=o=b.f,A=!!function(){try{var e=T.resolve(1),n=(e.constructor={})[t("./_wks")("species")]=function(t){t(O,O)};return(I||"function"==typeof PromiseRejectionEvent)&&e.then(O)instanceof n&&0!==k.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(t){}}(),D=function(t){var e;return!(!h(t)||"function"!=typeof(e=t.then))&&e},N=function(t,e){if(!t._n){t._n=!0;var n=t._c;y((function(){for(var r=t._v,o=1==t._s,i=0,a=function(e){var n,i,a,s=o?e.ok:e.fail,u=e.resolve,c=e.reject,l=e.domain;try{s?(o||(2==t._h&&j(t),t._h=1),!0===s?n=r:(l&&l.enter(),n=s(r),l&&(l.exit(),a=!0)),n===e.promise?c(E("Promise-chain cycle")):(i=D(n))?i.call(n,u,c):u(n)):c(r)}catch(t){l&&!a&&l.exit(),c(t)}};n.length>i;)a(n[i++]);t._c=[],t._n=!1,e&&!t._h&&P(t)}))}},P=function(t){g.call(u,(function(){var e,n,r,o=t._v,i=M(t);if(i&&(e=w((function(){I?C.emit("unhandledRejection",o,t):(n=u.onunhandledrejection)?n({promise:t,reason:o}):(r=u.console)&&r.error&&r.error("Unhandled promise rejection",o)})),t._h=I||M(t)?2:1),t._a=void 0,i&&e.e)throw e.v}))},M=function(t){return 1!==t._h&&0===(t._a||t._c).length},j=function(t){g.call(u,(function(){var e;I?C.emit("rejectionHandled",t):(e=u.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()),N(e,!0))},B=function(t){var e,n=this;if(!n._d){n._d=!0,n=n._w||n;try{if(n===t)throw E("Promise can't be resolved itself");(e=D(t))?y((function(){var r={_w:n,_d:!1};try{e.call(t,c(B,r,1),c(F,r,1))}catch(t){F.call(r,t)}})):(n._v=t,n._s=1,N(n,!1))}catch(t){F.call({_w:n,_d:!1},t)}}};A||(T=function(t){d(this,T,"Promise","_h"),p(t),r.call(this);try{t(c(B,this,1),c(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=t("./_redefine-all")(T.prototype,{then:function(t,e){var n=R(v(this,T));return n.ok="function"!=typeof t||t,n.fail="function"==typeof e&&e,n.domain=I?C.domain:void 0,this._c.push(n),this._a&&this._a.push(n),this._s&&N(this,!1),n.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new r;this.promise=t,this.resolve=c(B,t,1),this.reject=c(F,t,1)},b.f=R=function(t){return t===T||t===a?new i(t):o(t)}),f(f.G+f.W+f.F*!A,{Promise:T}),t("./_set-to-string-tag")(T,"Promise"),t("./_set-species")("Promise"),a=t("./_core").Promise,f(f.S+f.F*!A,"Promise",{reject:function(t){var e=R(this);return(0,e.reject)(t),e.promise}}),f(f.S+f.F*(s||!A),"Promise",{resolve:function(t){return _(s&&this===a?T:this,t)}}),f(f.S+f.F*!(A&&t("./_iter-detect")((function(t){T.all(t).catch(O)}))),"Promise",{all:function(t){var e=this,n=R(e),r=n.resolve,o=n.reject,i=w((function(){var n=[],i=0,a=1;m(t,!1,(function(t){var s=i++,u=!1;n.push(void 0),a++,e.resolve(t).then((function(t){u||(u=!0,n[s]=t,--a||r(n))}),o)})),--a||r(n)}));return i.e&&o(i.v),n.promise},race:function(t){var e=this,n=R(e),r=n.reject,o=w((function(){m(t,!1,(function(t){e.resolve(t).then(n.resolve,r)}))}));return o.e&&r(o.v),n.promise}})},{"./_a-function":92,"./_an-instance":94,"./_classof":97,"./_core":99,"./_ctx":101,"./_export":107,"./_for-of":109,"./_global":110,"./_is-object":119,"./_iter-detect":123,"./_library":126,"./_microtask":128,"./_new-promise-capability":129,"./_perform":144,"./_promise-resolve":145,"./_redefine-all":147,"./_set-species":149,"./_set-to-string-tag":150,"./_species-constructor":153,"./_task":155,"./_user-agent":163,"./_wks":166}],179:[function(t,e,n){var r=t("./_export"),o=t("./_to-absolute-index"),i=String.fromCharCode,a=String.fromCodePoint;r(r.S+r.F*(!!a&&1!=a.length),"String",{fromCodePoint:function(t){for(var e,n=[],r=arguments.length,a=0;r>a;){if(e=+arguments[a++],o(e,1114111)!==e)throw RangeError(e+" is not a valid code point");n.push(e<65536?i(e):i(55296+((e-=65536)>>10),e%1024+56320))}return n.join("")}})},{"./_export":107,"./_to-absolute-index":156}],180:[function(t,e,n){"use strict";var r=t("./_string-at")(!0);t("./_iter-define")(String,"String",(function(t){this._t=String(t),this._i=0}),(function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=r(e,n),this._i+=t.length,{value:t,done:!1})}))},{"./_iter-define":122,"./_string-at":154}],181:[function(t,e,n){"use strict";var r=t("./_global"),o=t("./_has"),i=t("./_descriptors"),a=t("./_export"),s=t("./_redefine"),u=t("./_meta").KEY,c=t("./_fails"),l=t("./_shared"),f=t("./_set-to-string-tag"),h=t("./_uid"),p=t("./_wks"),d=t("./_wks-ext"),m=t("./_wks-define"),v=t("./_enum-keys"),g=t("./_is-array"),y=t("./_an-object"),b=t("./_is-object"),w=t("./_to-object"),x=t("./_to-iobject"),_=t("./_to-primitive"),E=t("./_property-desc"),C=t("./_object-create"),S=t("./_object-gopn-ext"),k=t("./_object-gopd"),T=t("./_object-gops"),I=t("./_object-dp"),O=t("./_object-keys"),R=k.f,A=I.f,D=S.f,N=r.Symbol,P=r.JSON,M=P&&P.stringify,j=p("_hidden"),F=p("toPrimitive"),B={}.propertyIsEnumerable,L=l("symbol-registry"),U=l("symbols"),W=l("op-symbols"),z=Object.prototype,V="function"==typeof N&&!!T.f,q=r.QObject,G=!q||!q.prototype||!q.prototype.findChild,H=i&&c((function(){return 7!=C(A({},"a",{get:function(){return A(this,"a",{value:7}).a}})).a}))?function(t,e,n){var r=R(z,e);r&&delete z[e],A(t,e,n),r&&t!==z&&A(z,e,r)}:A,X=function(t){var e=U[t]=C(N.prototype);return e._k=t,e},K=V&&"symbol"==typeof N.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof N},Y=function(t,e,n){return t===z&&Y(W,e,n),y(t),e=_(e,!0),y(n),o(U,e)?(n.enumerable?(o(t,j)&&t[j][e]&&(t[j][e]=!1),n=C(n,{enumerable:E(0,!1)})):(o(t,j)||A(t,j,E(1,{})),t[j][e]=!0),H(t,e,n)):A(t,e,n)},$=function(t,e){y(t);for(var n,r=v(e=x(e)),o=0,i=r.length;i>o;)Y(t,n=r[o++],e[n]);return t},J=function(t){var e=B.call(this,t=_(t,!0));return!(this===z&&o(U,t)&&!o(W,t))&&(!(e||!o(this,t)||!o(U,t)||o(this,j)&&this[j][t])||e)},Q=function(t,e){if(t=x(t),e=_(e,!0),t!==z||!o(U,e)||o(W,e)){var n=R(t,e);return!n||!o(U,e)||o(t,j)&&t[j][e]||(n.enumerable=!0),n}},Z=function(t){for(var e,n=D(x(t)),r=[],i=0;n.length>i;)o(U,e=n[i++])||e==j||e==u||r.push(e);return r},tt=function(t){for(var e,n=t===z,r=D(n?W:x(t)),i=[],a=0;r.length>a;)!o(U,e=r[a++])||n&&!o(z,e)||i.push(U[e]);return i};V||(s((N=function(){if(this instanceof N)throw TypeError("Symbol is not a constructor!");var t=h(arguments.length>0?arguments[0]:void 0),e=function(n){this===z&&e.call(W,n),o(this,j)&&o(this[j],t)&&(this[j][t]=!1),H(this,t,E(1,n))};return i&&G&&H(z,t,{configurable:!0,set:e}),X(t)}).prototype,"toString",(function(){return this._k})),k.f=Q,I.f=Y,t("./_object-gopn").f=S.f=Z,t("./_object-pie").f=J,T.f=tt,i&&!t("./_library")&&s(z,"propertyIsEnumerable",J,!0),d.f=function(t){return X(p(t))}),a(a.G+a.W+a.F*!V,{Symbol:N});for(var et="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),nt=0;et.length>nt;)p(et[nt++]);for(var rt=O(p.store),ot=0;rt.length>ot;)m(rt[ot++]);a(a.S+a.F*!V,"Symbol",{for:function(t){return o(L,t+="")?L[t]:L[t]=N(t)},keyFor:function(t){if(!K(t))throw TypeError(t+" is not a symbol!");for(var e in L)if(L[e]===t)return e},useSetter:function(){G=!0},useSimple:function(){G=!1}}),a(a.S+a.F*!V,"Object",{create:function(t,e){return void 0===e?C(t):$(C(t),e)},defineProperty:Y,defineProperties:$,getOwnPropertyDescriptor:Q,getOwnPropertyNames:Z,getOwnPropertySymbols:tt});var it=c((function(){T.f(1)}));a(a.S+a.F*it,"Object",{getOwnPropertySymbols:function(t){return T.f(w(t))}}),P&&a(a.S+a.F*(!V||c((function(){var t=N();return"[null]"!=M([t])||"{}"!=M({a:t})||"{}"!=M(Object(t))}))),"JSON",{stringify:function(t){for(var e,n,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(n=e=r[1],(b(e)||void 0!==t)&&!K(t))return g(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!K(e))return e}),r[1]=e,M.apply(P,r)}}),N.prototype[F]||t("./_hide")(N.prototype,F,N.prototype.valueOf),f(N,"Symbol"),f(Math,"Math",!0),f(r.JSON,"JSON",!0)},{"./_an-object":95,"./_descriptors":103,"./_enum-keys":106,"./_export":107,"./_fails":108,"./_global":110,"./_has":111,"./_hide":112,"./_is-array":118,"./_is-object":119,"./_library":126,"./_meta":127,"./_object-create":131,"./_object-dp":132,"./_object-gopd":134,"./_object-gopn":136,"./_object-gopn-ext":135,"./_object-gops":137,"./_object-keys":140,"./_object-pie":141,"./_property-desc":146,"./_redefine":148,"./_set-to-string-tag":150,"./_shared":152,"./_to-iobject":158,"./_to-object":160,"./_to-primitive":161,"./_uid":162,"./_wks":166,"./_wks-define":164,"./_wks-ext":165}],182:[function(t,e,n){var r=t("./_export"),o=t("./_object-to-array")(!0);r(r.S,"Object",{entries:function(t){return o(t)}})},{"./_export":107,"./_object-to-array":143}],183:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_core"),i=t("./_global"),a=t("./_species-constructor"),s=t("./_promise-resolve");r(r.P+r.R,"Promise",{finally:function(t){var e=a(this,o.Promise||i.Promise),n="function"==typeof t;return this.then(n?function(n){return s(e,t()).then((function(){return n}))}:t,n?function(n){return s(e,t()).then((function(){throw n}))}:t)}})},{"./_core":99,"./_export":107,"./_global":110,"./_promise-resolve":145,"./_species-constructor":153}],184:[function(t,e,n){"use strict";var r=t("./_export"),o=t("./_new-promise-capability"),i=t("./_perform");r(r.S,"Promise",{try:function(t){var e=o.f(this),n=i(t);return(n.e?e.reject:e.resolve)(n.v),e.promise}})},{"./_export":107,"./_new-promise-capability":129,"./_perform":144}],185:[function(t,e,n){t("./_wks-define")("asyncIterator")},{"./_wks-define":164}],186:[function(t,e,n){t("./_wks-define")("observable")},{"./_wks-define":164}],187:[function(t,e,n){t("./es6.array.iterator");for(var r=t("./_global"),o=t("./_hide"),i=t("./_iterators"),a=t("./_wks")("toStringTag"),s="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(","),u=0;u<s.length;u++){var c=s[u],l=r[c],f=l&&l.prototype;f&&!f[a]&&o(f,a,c),i[c]=i.Array}},{"./_global":110,"./_hide":112,"./_iterators":125,"./_wks":166,"./es6.array.iterator":169}],188:[function(t,e,n){var r=t("./_export"),o=t("./_task");r(r.G+r.B,{setImmediate:o.set,clearImmediate:o.clear})},{"./_export":107,"./_task":155}],189:[function(t,e,n){(function(e){"use strict";var r,o=t("babel-runtime/helpers/typeof"),i=(r=o)&&r.__esModule?r:{default:r};function a(t){return Object.prototype.toString.call(t)}n.isArray=function(t){return Array.isArray?Array.isArray(t):"[object Array]"===a(t)},n.isBoolean=function(t){return"boolean"==typeof t},n.isNull=function(t){return null===t},n.isNullOrUndefined=function(t){return null==t},n.isNumber=function(t){return"number"==typeof t},n.isString=function(t){return"string"==typeof t},n.isSymbol=function(t){return"symbol"===(void 0===t?"undefined":(0,i.default)(t))},n.isUndefined=function(t){return void 0===t},n.isRegExp=function(t){return"[object RegExp]"===a(t)},n.isObject=function(t){return"object"===(void 0===t?"undefined":(0,i.default)(t))&&null!==t},n.isDate=function(t){return"[object Date]"===a(t)},n.isError=function(t){return"[object Error]"===a(t)||t instanceof Error},n.isFunction=function(t){return"function"==typeof t},n.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"===(void 0===t?"undefined":(0,i.default)(t))||void 0===t},n.isBuffer=e.isBuffer}).call(this,{isBuffer:t("../../is-buffer/index.js")})},{"../../is-buffer/index.js":197,"babel-runtime/helpers/typeof":67}],190:[function(t,e,n){"use strict";var r,o=t("babel-runtime/helpers/typeof"),i=(r=o)&&r.__esModule?r:{default:r};!function(t){var r,o,a,s=(r=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZWN]|'[^']*'|'[^']*'/g,o=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,a=/[^-+\dA-Z]/g,function(t,e,n,i){if(1!==arguments.length||"string"!==f(t)||/\d/.test(t)||(e=t,t=void 0),(t=t||new Date)instanceof Date||(t=new Date(t)),isNaN(t))throw TypeError("Invalid date");var h=(e=String(s.masks[e]||e||s.masks.default)).slice(0,4);"UTC:"!==h&&"GMT:"!==h||(e=e.slice(4),n=!0,"GMT:"===h&&(i=!0));var p=n?"getUTC":"get",d=t[p+"Date"](),m=t[p+"Day"](),v=t[p+"Month"](),g=t[p+"FullYear"](),y=t[p+"Hours"](),b=t[p+"Minutes"](),w=t[p+"Seconds"](),x=t[p+"Milliseconds"](),_=n?0:t.getTimezoneOffset(),E=c(t),C=l(t),S={d:d,dd:u(d),ddd:s.i18n.dayNames[m],dddd:s.i18n.dayNames[m+7],m:v+1,mm:u(v+1),mmm:s.i18n.monthNames[v],mmmm:s.i18n.monthNames[v+12],yy:String(g).slice(2),yyyy:g,h:y%12||12,hh:u(y%12||12),H:y,HH:u(y),M:b,MM:u(b),s:w,ss:u(w),l:u(x,3),L:u(Math.round(x/10)),t:y<12?"a":"p",tt:y<12?"am":"pm",T:y<12?"A":"P",TT:y<12?"AM":"PM",Z:i?"GMT":n?"UTC":(String(t).match(o)||[""]).pop().replace(a,""),o:(_>0?"-":"+")+u(100*Math.floor(Math.abs(_)/60)+Math.abs(_)%60,4),S:["th","st","nd","rd"][d%10>3?0:(d%100-d%10!=10)*d%10],W:E,N:C};return e.replace(r,(function(t){return t in S?S[t]:t.slice(1,t.length-1)}))});function u(t,e){for(t=String(t),e=e||2;t.length<e;)t="0"+t;return t}function c(t){var e=new Date(t.getFullYear(),t.getMonth(),t.getDate());e.setDate(e.getDate()-(e.getDay()+6)%7+3);var n=new Date(e.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=e.getTimezoneOffset()-n.getTimezoneOffset();e.setHours(e.getHours()-r);var o=(e-n)/6048e5;return 1+Math.floor(o)}function l(t){var e=t.getDay();return 0===e&&(e=7),e}function f(t){return null===t?"null":void 0===t?"undefined":"object"!==(void 0===t?"undefined":(0,i.default)(t))?void 0===t?"undefined":(0,i.default)(t):Array.isArray(t)?"array":{}.toString.call(t).slice(8,-1).toLowerCase()}s.masks={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},s.i18n={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"]},"function"==typeof define&&define.amd?define((function(){return s})):"object"===(void 0===n?"undefined":(0,i.default)(n))?e.exports=s:t.dateFormat=s}(void 0)},{"babel-runtime/helpers/typeof":67}],191:[function(t,e,n){
/*!
* escape-html
* Copyright(c) 2012-2013 TJ Holowaychuk
* Copyright(c) 2015 Andreas Lubbe
* Copyright(c) 2015 Tiancheng "Timothy" Gu
* MIT Licensed
*/
"use strict";var r=/["'&<>]/;e.exports=function(t){var e,n=""+t,o=r.exec(n);if(!o)return n;var i="",a=0,s=0;for(a=o.index;a<n.length;a++){switch(n.charCodeAt(a)){case 34:e="&quot;";break;case 38:e="&amp;";break;case 39:e="&#39;";break;case 60:e="&lt;";break;case 62:e="&gt;";break;default:continue}s!==a&&(i+=n.substring(s,a)),s=a+1,i+=e}return s!==a?i+n.substring(s,a):i}},{}],192:[function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function o(t){return"function"==typeof t}function i(t){return"object"==typeof t&&null!==t}function a(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,s,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((e=arguments[1])instanceof Error)throw e;var l=new Error('Uncaught, unspecified "error" event. ('+e+")");throw l.context=e,l}if(a(n=this._events[t]))return!1;if(o(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),r=(c=n.slice()).length,u=0;u<r;u++)c[u].apply(this,s);return!0},r.prototype.addListener=function(t,e){var n;if(!o(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,o(e.listener)?e.listener:e),this._events[t]?i(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,i(this._events[t])&&!this._events[t].warned&&(n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace()),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){if(!o(e))throw TypeError("listener must be a function");var n=!1;function r(){this.removeListener(t,r),n||(n=!0,e.apply(this,arguments))}return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var n,r,a,s;if(!o(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(a=(n=this._events[t]).length,r=-1,n===e||o(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(i(n)){for(s=a;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(o(n=this._events[t]))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){return this._events&&this._events[t]?o(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(o(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],193:[function(t,e,n){var r=t("http"),o=e.exports;for(var i in r)r.hasOwnProperty(i)&&(o[i]=r[i]);o.request=function(t,e){return t||(t={}),t.scheme="https",t.protocol="https:",r.request.call(this,t,e)}},{http:231}],194:[function(t,e,n){
/*!
* humanize-ms - index.js
* Copyright(c) 2014 dead_horse <dead_horse@qq.com>
* MIT Licensed
*/
"use strict";var r=t("util"),o=t("ms");e.exports=function(t){if("number"==typeof t)return t;var e=o(t);if(void 0===e){var n=new Error(r.format("humanize-ms(%j) result undefined",t));console.warn(n.stack)}return e}},{ms:204,util:243}],195:[function(t,e,n){n.read=function(t,e,n,r,o){var i,a,s=8*o-r-1,u=(1<<s)-1,c=u>>1,l=-7,f=n?o-1:0,h=n?-1:1,p=t[e+f];for(f+=h,i=p&(1<<-l)-1,p>>=-l,l+=s;l>0;i=256*i+t[e+f],f+=h,l-=8);for(a=i&(1<<-l)-1,i>>=-l,l+=r;l>0;a=256*a+t[e+f],f+=h,l-=8);if(0===i)i=1-c;else{if(i===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),i-=c}return(p?-1:1)*a*Math.pow(2,i-r)},n.write=function(t,e,n,r,o,i){var a,s,u,c=8*i-o-1,l=(1<<c)-1,f=l>>1,h=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:i-1,d=r?1:-1,m=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(s=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+f>=1?h/u:h*Math.pow(2,1-f))*u>=2&&(a++,u/=2),a+f>=l?(s=0,a=l):a+f>=1?(s=(e*u-1)*Math.pow(2,o),a+=f):(s=e*Math.pow(2,f-1)*Math.pow(2,o),a=0));o>=8;t[n+p]=255&s,p+=d,s/=256,o-=8);for(a=a<<o|s,c+=o;c>0;t[n+p]=255&a,p+=d,a/=256,c-=8);t[n+p-d]|=128*m}},{}],196:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}},{}],197:[function(t,e,n){function r(t){return!!t.constructor&&"function"==typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}
/*!
* Determine if an object is a Buffer
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
e.exports=function(t){return null!=t&&(r(t)||function(t){return"function"==typeof t.readFloatLE&&"function"==typeof t.slice&&r(t.slice(0,0))}(t)||!!t._isBuffer)}},{}],198:[function(t,e,n){var r={}.toString;e.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)}},{}],199:[function(require,module,exports){(function(global){!function(t,e){"object"==typeof exports&&void 0!==module?module.exports=e(t):"function"==typeof define&&define.amd?define(e):e(t)}("undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==global?global:this,(function(global){"use strict";global=global||{};var _Base64=global.Base64,version="2.5.2",buffer;if(void 0!==module&&module.exports)try{buffer=eval("require('buffer').Buffer")}catch(t){buffer=void 0}var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b64tab=function(t){for(var e={},n=0,r=t.length;n<r;n++)e[t.charAt(n)]=n;return e}(b64chars),fromCharCode=String.fromCharCode,cb_utob=function(t){if(t.length<2)return(e=t.charCodeAt(0))<128?t:e<2048?fromCharCode(192|e>>>6)+fromCharCode(128|63&e):fromCharCode(224|e>>>12&15)+fromCharCode(128|e>>>6&63)+fromCharCode(128|63&e);var e=65536+1024*(t.charCodeAt(0)-55296)+(t.charCodeAt(1)-56320);return fromCharCode(240|e>>>18&7)+fromCharCode(128|e>>>12&63)+fromCharCode(128|e>>>6&63)+fromCharCode(128|63&e)},re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,utob=function(t){return t.replace(re_utob,cb_utob)},cb_encode=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[b64chars.charAt(n>>>18),b64chars.charAt(n>>>12&63),e>=2?"=":b64chars.charAt(n>>>6&63),e>=1?"=":b64chars.charAt(63&n)].join("")},btoa=global.btoa?function(t){return global.btoa(t)}:function(t){return t.replace(/[\s\S]{1,3}/g,cb_encode)},_encode=function(t){return"[object Uint8Array]"===Object.prototype.toString.call(t)?t.toString("base64"):btoa(utob(String(t)))},encode=function(t,e){return e?_encode(String(t)).replace(/[+\/]/g,(function(t){return"+"==t?"-":"_"})).replace(/=/g,""):_encode(t)},encodeURI=function(t){return encode(t,!0)},re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,cb_btou=function(t){switch(t.length){case 4:var e=((7&t.charCodeAt(0))<<18|(63&t.charCodeAt(1))<<12|(63&t.charCodeAt(2))<<6|63&t.charCodeAt(3))-65536;return fromCharCode(55296+(e>>>10))+fromCharCode(56320+(1023&e));case 3:return fromCharCode((15&t.charCodeAt(0))<<12|(63&t.charCodeAt(1))<<6|63&t.charCodeAt(2));default:return fromCharCode((31&t.charCodeAt(0))<<6|63&t.charCodeAt(1))}},btou=function(t){return t.replace(re_btou,cb_btou)},cb_decode=function(t){var e=t.length,n=e%4,r=(e>0?b64tab[t.charAt(0)]<<18:0)|(e>1?b64tab[t.charAt(1)]<<12:0)|(e>2?b64tab[t.charAt(2)]<<6:0)|(e>3?b64tab[t.charAt(3)]:0),o=[fromCharCode(r>>>16),fromCharCode(r>>>8&255),fromCharCode(255&r)];return o.length-=[0,0,2,1][n],o.join("")},_atob=global.atob?function(t){return global.atob(t)}:function(t){return t.replace(/\S{1,4}/g,cb_decode)},atob=function(t){return _atob(String(t).replace(/[^A-Za-z0-9\+\/]/g,""))},_decode=buffer?buffer.from&&Uint8Array&&buffer.from!==Uint8Array.from?function(t){return(t.constructor===buffer.constructor?t:buffer.from(t,"base64")).toString()}:function(t){return(t.constructor===buffer.constructor?t:new buffer(t,"base64")).toString()}:function(t){return btou(_atob(t))},decode=function(t){return _decode(String(t).replace(/[-_]/g,(function(t){return"-"==t?"+":"/"})).replace(/[^A-Za-z0-9\+\/]/g,""))},noConflict=function(){var t=global.Base64;return global.Base64=_Base64,t};if(global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,__buffer__:buffer},"function"==typeof Object.defineProperty){var noEnum=function(t){return{value:t,enumerable:!1,writable:!0,configurable:!0}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum((function(){return decode(this)}))),Object.defineProperty(String.prototype,"toBase64",noEnum((function(t){return encode(this,t)}))),Object.defineProperty(String.prototype,"toBase64URI",noEnum((function(){return encode(this,!0)})))}}return global.Meteor&&(Base64=global.Base64),void 0!==module&&module.exports?module.exports.Base64=global.Base64:"function"==typeof define&&define.amd&&define([],(function(){return global.Base64})),{Base64:global.Base64}}))}).call(this,void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],200:[function(t,e,n){
/*!
* merge-descriptors
* Copyright(c) 2014 Jonathan Ong
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/
"use strict";e.exports=function(t,e,n){if(!t)throw new TypeError("argument dest is required");if(!e)throw new TypeError("argument src is required");return void 0===n&&(n=!0),Object.getOwnPropertyNames(e).forEach((function(o){if(n||!r.call(t,o)){var i=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,i)}})),t};var r=Object.prototype.hasOwnProperty},{}],201:[function(t,e,n){"use strict";function r(){this._types=Object.create(null),this._extensions=Object.create(null);for(var t=0;t<arguments.length;t++)this.define(arguments[t]);this.define=this.define.bind(this),this.getType=this.getType.bind(this),this.getExtension=this.getExtension.bind(this)}r.prototype.define=function(t,e){for(var n in t){var r=t[n].map((function(t){return t.toLowerCase()}));n=n.toLowerCase();for(var o=0;o<r.length;o++)if("*"!=(i=r[o])[0]){if(!e&&i in this._types)throw new Error('Attempt to change mapping for "'+i+'" extension from "'+this._types[i]+'" to "'+n+'". Pass `force=true` to allow this, otherwise remove "'+i+'" from the list of extensions for "'+n+'".');this._types[i]=n}if(e||!this._extensions[n]){var i=r[0];this._extensions[n]="*"!=i[0]?i:i.substr(1)}}},r.prototype.getType=function(t){var e=(t=String(t)).replace(/^.*[/\\]/,"").toLowerCase(),n=e.replace(/^.*\./,"").toLowerCase(),r=e.length<t.length;return(n.length<e.length-1||!r)&&this._types[n]||null},r.prototype.getExtension=function(t){return(t=/^\s*([^;\s]*)/.test(t)&&RegExp.$1)&&this._extensions[t.toLowerCase()]||null},e.exports=r},{}],202:[function(t,e,n){"use strict";var r=t("./Mime");e.exports=new r(t("./types/standard"))},{"./Mime":201,"./types/standard":203}],203:[function(t,e,n){e.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma","es"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/mrb-consumer+xml":["*xdf"],"application/mrb-publish+xml":["*xdf"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["*xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/ttml+xml":["ttml"],"application/urc-ressheet+xml":["rsheet"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-error+xml":["xer"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}},{}],204:[function(t,e,n){var r=1e3,o=6e4,i=60*o,a=24*i;function s(t,e,n,r){var o=e>=1.5*n;return Math.round(t/n)+" "+r+(o?"s":"")}e.exports=function(t,e){e=e||{};var n,u,c=typeof t;if("string"===c&&t.length>0)return function(t){if(!((t=String(t)).length>100)){var e=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]);switch((e[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*n;case"weeks":case"week":case"w":return 6048e5*n;case"days":case"day":case"d":return n*a;case"hours":case"hour":case"hrs":case"hr":case"h":return n*i;case"minutes":case"minute":case"mins":case"min":case"m":return n*o;case"seconds":case"second":case"secs":case"sec":case"s":return n*r;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}(t);if("number"===c&&isFinite(t))return e.long?(n=t,(u=Math.abs(n))>=a?s(n,u,a,"day"):u>=i?s(n,u,i,"hour"):u>=o?s(n,u,o,"minute"):u>=r?s(n,u,r,"second"):n+" ms"):function(t){var e=Math.abs(t);return e>=a?Math.round(t/a)+"d":e>=i?Math.round(t/i)+"h":e>=o?Math.round(t/o)+"m":e>=r?Math.round(t/r)+"s":t+"ms"}(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},{}],205:[function(t,e,n){(function(t){function e(t,e){for(var n=0,r=t.length-1;r>=0;r--){var o=t[r];"."===o?t.splice(r,1):".."===o?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function r(t,e){if(t.filter)return t.filter(e);for(var n=[],r=0;r<t.length;r++)e(t[r],r,t)&&n.push(t[r]);return n}n.resolve=function(){for(var n="",o=!1,i=arguments.length-1;i>=-1&&!o;i--){var a=i>=0?arguments[i]:t.cwd();if("string"!=typeof a)throw new TypeError("Arguments to path.resolve must be strings");a&&(n=a+"/"+n,o="/"===a.charAt(0))}return(o?"/":"")+(n=e(r(n.split("/"),(function(t){return!!t})),!o).join("/"))||"."},n.normalize=function(t){var i=n.isAbsolute(t),a="/"===o(t,-1);return(t=e(r(t.split("/"),(function(t){return!!t})),!i).join("/"))||i||(t="."),t&&a&&(t+="/"),(i?"/":"")+t},n.isAbsolute=function(t){return"/"===t.charAt(0)},n.join=function(){var t=Array.prototype.slice.call(arguments,0);return n.normalize(r(t,(function(t,e){if("string"!=typeof t)throw new TypeError("Arguments to path.join must be strings");return t})).join("/"))},n.relative=function(t,e){function r(t){for(var e=0;e<t.length&&""===t[e];e++);for(var n=t.length-1;n>=0&&""===t[n];n--);return e>n?[]:t.slice(e,n-e+1)}t=n.resolve(t).substr(1),e=n.resolve(e).substr(1);for(var o=r(t.split("/")),i=r(e.split("/")),a=Math.min(o.length,i.length),s=a,u=0;u<a;u++)if(o[u]!==i[u]){s=u;break}var c=[];for(u=s;u<o.length;u++)c.push("..");return(c=c.concat(i.slice(s))).join("/")},n.sep="/",n.delimiter=":",n.dirname=function(t){if("string"!=typeof t&&(t+=""),0===t.length)return".";for(var e=t.charCodeAt(0),n=47===e,r=-1,o=!0,i=t.length-1;i>=1;--i)if(47===(e=t.charCodeAt(i))){if(!o){r=i;break}}else o=!1;return-1===r?n?"/":".":n&&1===r?"/":t.slice(0,r)},n.basename=function(t,e){var n=function(t){"string"!=typeof t&&(t+="");var e,n=0,r=-1,o=!0;for(e=t.length-1;e>=0;--e)if(47===t.charCodeAt(e)){if(!o){n=e+1;break}}else-1===r&&(o=!1,r=e+1);return-1===r?"":t.slice(n,r)}(t);return e&&n.substr(-1*e.length)===e&&(n=n.substr(0,n.length-e.length)),n},n.extname=function(t){"string"!=typeof t&&(t+="");for(var e=-1,n=0,r=-1,o=!0,i=0,a=t.length-1;a>=0;--a){var s=t.charCodeAt(a);if(47!==s)-1===r&&(o=!1,r=a+1),46===s?-1===e?e=a:1!==i&&(i=1):-1!==e&&(i=-1);else if(!o){n=a+1;break}}return-1===e||-1===r||0===i||1===i&&e===r-1&&e===n+1?"":t.slice(e,r)};var o="b"==="ab".substr(-1)?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}}).call(this,t("_process"))},{_process:208}],206:[function(t,e,n){(function(t){(function(){"use strict";var r={function:!0,object:!0},o=r[typeof window]&&window||this,i=r[typeof n]&&n,a=r[typeof e]&&e&&!e.nodeType&&e,s=i&&a&&"object"==typeof t&&t;!s||s.global!==s&&s.window!==s&&s.self!==s||(o=s);var u=Math.pow(2,53)-1,c=/\bOpera/,l=Object.prototype,f=l.hasOwnProperty,h=l.toString;function p(t){return(t=String(t)).charAt(0).toUpperCase()+t.slice(1)}function d(t){return t=b(t),/^(?:webOS|i(?:OS|P))/.test(t)?t:p(t)}function m(t,e){for(var n in t)f.call(t,n)&&e(t[n],n,t)}function v(t){return null==t?p(t):h.call(t).slice(8,-1)}function g(t){return String(t).replace(/([ -])(?!$)/g,"$1?")}function y(t,e){var n=null;return function(t,e){var n=-1,r=t?t.length:0;if("number"==typeof r&&r>-1&&r<=u)for(;++n<r;)e(t[n],n,t);else m(t,e)}(t,(function(r,o){n=e(n,r,o,t)})),n}function b(t){return String(t).replace(/^ +| +$/g,"")}var w=function t(e){var n=o,r=e&&"object"==typeof e&&"String"!=v(e);r&&(n=e,e=null);var i=n.navigator||{},a=i.userAgent||"";e||(e=a);var s,u,l,f,p,w=r?!!i.likeChrome:/\bChrome\b/.test(e)&&!/internal|\n/i.test(h.toString()),x=r?"Object":"ScriptBridgingProxyObject",_=r?"Object":"Environment",E=r&&n.java?"JavaPackage":v(n.java),C=r?"Object":"RuntimeObject",S=/\bJava/.test(E)&&n.java,k=S&&v(n.environment)==_,T=S?"a":"α",I=S?"b":"β",O=n.document||{},R=n.operamini||n.opera,A=c.test(A=r&&R?R["[[Class]]"]:v(R))?A:R=null,D=e,N=[],P=null,M=e==a,j=M&&R&&"function"==typeof R.version&&R.version(),F=y([{label:"EdgeHTML",pattern:"Edge"},"Trident",{label:"WebKit",pattern:"AppleWebKit"},"iCab","Presto","NetFront","Tasman","KHTML","Gecko"],(function(t,n){return t||RegExp("\\b"+(n.pattern||g(n))+"\\b","i").exec(e)&&(n.label||n)})),B=function(t){return y(t,(function(t,n){return t||RegExp("\\b"+(n.pattern||g(n))+"\\b","i").exec(e)&&(n.label||n)}))}(["Adobe AIR","Arora","Avant Browser","Breach","Camino","Electron","Epiphany","Fennec","Flock","Galeon","GreenBrowser","iCab","Iceweasel","K-Meleon","Konqueror","Lunascape","Maxthon",{label:"Microsoft Edge",pattern:"Edge"},"Midori","Nook Browser","PaleMoon","PhantomJS","Raven","Rekonq","RockMelt",{label:"Samsung Internet",pattern:"SamsungBrowser"},"SeaMonkey",{label:"Silk",pattern:"(?:Cloud9|Silk-Accelerated)"},"Sleipnir","SlimBrowser",{label:"SRWare Iron",pattern:"Iron"},"Sunrise","Swiftfox","Waterfox","WebPositive","Opera Mini",{label:"Opera Mini",pattern:"OPiOS"},"Opera",{label:"Opera",pattern:"OPR"},"Chrome",{label:"Chrome Mobile",pattern:"(?:CriOS|CrMo)"},{label:"Firefox",pattern:"(?:Firefox|Minefield)"},{label:"Firefox for iOS",pattern:"FxiOS"},{label:"IE",pattern:"IEMobile"},{label:"IE",pattern:"MSIE"},"Safari"]),L=z([{label:"BlackBerry",pattern:"BB10"},"BlackBerry",{label:"Galaxy S",pattern:"GT-I9000"},{label:"Galaxy S2",pattern:"GT-I9100"},{label:"Galaxy S3",pattern:"GT-I9300"},{label:"Galaxy S4",pattern:"GT-I9500"},{label:"Galaxy S5",pattern:"SM-G900"},{label:"Galaxy S6",pattern:"SM-G920"},{label:"Galaxy S6 Edge",pattern:"SM-G925"},{label:"Galaxy S7",pattern:"SM-G930"},{label:"Galaxy S7 Edge",pattern:"SM-G935"},"Google TV","Lumia","iPad","iPod","iPhone","Kindle",{label:"Kindle Fire",pattern:"(?:Cloud9|Silk-Accelerated)"},"Nexus","Nook","PlayBook","PlayStation Vita","PlayStation","TouchPad","Transformer",{label:"Wii U",pattern:"WiiU"},"Wii","Xbox One",{label:"Xbox 360",pattern:"Xbox"},"Xoom"]),U=function(t){return y(t,(function(t,n,r){return t||(n[L]||n[/^[a-z]+(?: +[a-z]+\b)*/i.exec(L)]||RegExp("\\b"+g(r)+"(?:\\b|\\w*\\d)","i").exec(e))&&r}))}({Apple:{iPad:1,iPhone:1,iPod:1},Archos:{},Amazon:{Kindle:1,"Kindle Fire":1},Asus:{Transformer:1},"Barnes & Noble":{Nook:1},BlackBerry:{PlayBook:1},Google:{"Google TV":1,Nexus:1},HP:{TouchPad:1},HTC:{},LG:{},Microsoft:{Xbox:1,"Xbox One":1},Motorola:{Xoom:1},Nintendo:{"Wii U":1,Wii:1},Nokia:{Lumia:1},Samsung:{"Galaxy S":1,"Galaxy S2":1,"Galaxy S3":1,"Galaxy S4":1},Sony:{PlayStation:1,"PlayStation Vita":1}}),W=function(t){return y(t,(function(t,n){var r=n.pattern||g(n);return!t&&(t=RegExp("\\b"+r+"(?:/[\\d.]+|[ \\w.]*)","i").exec(e))&&(t=function(t,e,n){var r={"10.0":"10",6.4:"10 Technical Preview",6.3:"8.1",6.2:"8",6.1:"Server 2008 R2 / 7","6.0":"Server 2008 / Vista",5.2:"Server 2003 / XP 64-bit",5.1:"XP",5.01:"2000 SP1","5.0":"2000","4.0":"NT","4.90":"ME"};return e&&n&&/^Win/i.test(t)&&!/^Windows Phone /i.test(t)&&(r=r[/[\d.]+$/.exec(t)])&&(t="Windows "+r),t=String(t),e&&n&&(t=t.replace(RegExp(e,"i"),n)),t=d(t.replace(/ ce$/i," CE").replace(/\bhpw/i,"web").replace(/\bMacintosh\b/,"Mac OS").replace(/_PowerPC\b/i," OS").replace(/\b(OS X) [^ \d]+/i,"$1").replace(/\bMac (OS X)\b/,"$1").replace(/\/(\d)/," $1").replace(/_/g,".").replace(/(?: BePC|[ .]*fc[ \d.]+)$/i,"").replace(/\bx86\.64\b/gi,"x86_64").replace(/\b(Windows Phone) OS\b/,"$1").replace(/\b(Chrome OS \w+) [\d.]+\b/,"$1").split(" on ")[0])}(t,r,n.label||n)),t}))}(["Windows Phone","Android","CentOS",{label:"Chrome OS",pattern:"CrOS"},"Debian","Fedora","FreeBSD","Gentoo","Haiku","Kubuntu","Linux Mint","OpenBSD","Red Hat","SuSE","Ubuntu","Xubuntu","Cygwin","Symbian OS","hpwOS","webOS ","webOS","Tablet OS","Tizen","Linux","Mac OS X","Macintosh","Mac","Windows 98;","Windows "]);function z(t){return y(t,(function(t,n){var r=n.pattern||g(n);return!t&&(t=RegExp("\\b"+r+" *\\d+[.\\w_]*","i").exec(e)||RegExp("\\b"+r+" *\\w+-[\\w]*","i").exec(e)||RegExp("\\b"+r+"(?:; *(?:[a-z]+[_-])?[a-z]+\\d+|[^ ();-]*)","i").exec(e))&&((t=String(n.label&&!RegExp(r,"i").test(n.label)?n.label:t).split("/"))[1]&&!/[\d.]+/.test(t[0])&&(t[0]+=" "+t[1]),n=n.label||n,t=d(t[0].replace(RegExp(r,"i"),n).replace(RegExp("; *(?:"+n+"[_-])?","i")," ").replace(RegExp("("+n+")[-_.]?(\\w)","i"),"$1 $2"))),t}))}if(F&&(F=[F]),U&&!L&&(L=z([U])),(s=/\bGoogle TV\b/.exec(L))&&(L=s[0]),/\bSimulator\b/i.test(e)&&(L=(L?L+" ":"")+"Simulator"),"Opera Mini"==B&&/\bOPiOS\b/.test(e)&&N.push("running in Turbo/Uncompressed mode"),"IE"==B&&/\blike iPhone OS\b/.test(e)?(U=(s=t(e.replace(/like iPhone OS/,""))).manufacturer,L=s.product):/^iP/.test(L)?(B||(B="Safari"),W="iOS"+((s=/ OS ([\d_]+)/i.exec(e))?" "+s[1].replace(/_/g,"."):"")):"Konqueror"!=B||/buntu/i.test(W)?U&&"Google"!=U&&(/Chrome/.test(B)&&!/\bMobile Safari\b/i.test(e)||/\bVita\b/.test(L))||/\bAndroid\b/.test(W)&&/^Chrome/.test(B)&&/\bVersion\//i.test(e)?(B="Android Browser",W=/\bAndroid\b/.test(W)?W:"Android"):"Silk"==B?(/\bMobi/i.test(e)||(W="Android",N.unshift("desktop mode")),/Accelerated *= *true/i.test(e)&&N.unshift("accelerated")):"PaleMoon"==B&&(s=/\bFirefox\/([\d.]+)\b/.exec(e))?N.push("identifying as Firefox "+s[1]):"Firefox"==B&&(s=/\b(Mobile|Tablet|TV)\b/i.exec(e))?(W||(W="Firefox OS"),L||(L=s[1])):!B||(s=!/\bMinefield\b/i.test(e)&&/\b(?:Firefox|Safari)\b/.exec(B))?(B&&!L&&/[\/,]|^[^(]+?\)/.test(e.slice(e.indexOf(s+"/")+8))&&(B=null),(s=L||U||W)&&(L||U||/\b(?:Android|Symbian OS|Tablet OS|webOS)\b/.test(W))&&(B=/[a-z]+(?: Hat)?/i.exec(/\bAndroid\b/.test(W)?W:s)+" Browser")):"Electron"==B&&(s=(/\bChrome\/([\d.]+)\b/.exec(e)||0)[1])&&N.push("Chromium "+s):W="Kubuntu",j||(j=y(["(?:Cloud9|CriOS|CrMo|Edge|FxiOS|IEMobile|Iron|Opera ?Mini|OPiOS|OPR|Raven|SamsungBrowser|Silk(?!/[\\d.]+$))","Version",g(B),"(?:Firefox|Minefield|NetFront)"],(function(t,n){return t||(RegExp(n+"(?:-[\\d.]+/|(?: for [\\w-]+)?[ /-])([\\d.]+[^ ();/_-]*)","i").exec(e)||0)[1]||null}))),(s=("iCab"==F&&parseFloat(j)>3?"WebKit":/\bOpera\b/.test(B)&&(/\bOPR\b/.test(e)?"Blink":"Presto"))||/\b(?:Midori|Nook|Safari)\b/i.test(e)&&!/^(?:Trident|EdgeHTML)$/.test(F)&&"WebKit"||!F&&/\bMSIE\b/i.test(e)&&("Mac OS"==W?"Tasman":"Trident")||"WebKit"==F&&/\bPlayStation\b(?! Vita\b)/i.test(B)&&"NetFront")&&(F=[s]),"IE"==B&&(s=(/; *(?:XBLWP|ZuneWP)(\d+)/i.exec(e)||0)[1])?(B+=" Mobile",W="Windows Phone "+(/\+$/.test(s)?s:s+".x"),N.unshift("desktop mode")):/\bWPDesktop\b/i.test(e)?(B="IE Mobile",W="Windows Phone 8.x",N.unshift("desktop mode"),j||(j=(/\brv:([\d.]+)/.exec(e)||0)[1])):"IE"!=B&&"Trident"==F&&(s=/\brv:([\d.]+)/.exec(e))&&(B&&N.push("identifying as "+B+(j?" "+j:"")),B="IE",j=s[1]),M){if(f="global",p=null!=(l=n)?typeof l[f]:"number",/^(?:boolean|number|string|undefined)$/.test(p)||"object"==p&&!l[f])v(s=n.runtime)==x?(B="Adobe AIR",W=s.flash.system.Capabilities.os):v(s=n.phantom)==C?(B="PhantomJS",j=(s=s.version||null)&&s.major+"."+s.minor+"."+s.patch):"number"==typeof O.documentMode&&(s=/\bTrident\/(\d+)/i.exec(e))?(j=[j,O.documentMode],(s=+s[1]+4)!=j[1]&&(N.push("IE "+j[1]+" mode"),F&&(F[1]=""),j[1]=s),j="IE"==B?String(j[1].toFixed(1)):j[0]):"number"==typeof O.documentMode&&/^(?:Chrome|Firefox)\b/.test(B)&&(N.push("masking as "+B+" "+j),B="IE",j="11.0",F=["Trident"],W="Windows");else if(S&&(D=(s=S.lang.System).getProperty("os.arch"),W=W||s.getProperty("os.name")+" "+s.getProperty("os.version")),k){try{j=n.require("ringo/engine").version.join("."),B="RingoJS"}catch(t){(s=n.system)&&s.global.system==n.system&&(B="Narwhal",W||(W=s[0].os||null))}B||(B="Rhino")}else"object"==typeof n.process&&!n.process.browser&&(s=n.process)&&("object"==typeof s.versions&&("string"==typeof s.versions.electron?(N.push("Node "+s.versions.node),B="Electron",j=s.versions.electron):"string"==typeof s.versions.nw&&(N.push("Chromium "+j,"Node "+s.versions.node),B="NW.js",j=s.versions.nw)),B||(B="Node.js",D=s.arch,W=s.platform,j=(j=/[\d.]+/.exec(s.version))?j[0]:null));W=W&&d(W)}if(j&&(s=/(?:[ab]|dp|pre|[ab]\d+pre)(?:\d+\+?)?$/i.exec(j)||/(?:alpha|beta)(?: ?\d)?/i.exec(e+";"+(M&&i.appMinorVersion))||/\bMinefield\b/i.test(e)&&"a")&&(P=/b/i.test(s)?"beta":"alpha",j=j.replace(RegExp(s+"\\+?$"),"")+("beta"==P?I:T)+(/\d+\+?/.exec(s)||"")),"Fennec"==B||"Firefox"==B&&/\b(?:Android|Firefox OS)\b/.test(W))B="Firefox Mobile";else if("Maxthon"==B&&j)j=j.replace(/\.[\d.]+/,".x");else if(/\bXbox\b/i.test(L))"Xbox 360"==L&&(W=null),"Xbox 360"==L&&/\bIEMobile\b/.test(e)&&N.unshift("mobile mode");else if(!/^(?:Chrome|IE|Opera)$/.test(B)&&(!B||L||/Browser|Mobi/.test(B))||"Windows CE"!=W&&!/Mobi/i.test(e))if("IE"==B&&M)try{null===n.external&&N.unshift("platform preview")}catch(t){N.unshift("embedded")}else(/\bBlackBerry\b/.test(L)||/\bBB10\b/.test(e))&&(s=(RegExp(L.replace(/ +/g," *")+"/([.\\d]+)","i").exec(e)||0)[1]||j)?(W=((s=[s,/BB10/.test(e)])[1]?(L=null,U="BlackBerry"):"Device Software")+" "+s[0],j=null):this!=m&&"Wii"!=L&&(M&&R||/Opera/.test(B)&&/\b(?:MSIE|Firefox)\b/i.test(e)||"Firefox"==B&&/\bOS X (?:\d+\.){2,}/.test(W)||"IE"==B&&(W&&!/^Win/.test(W)&&j>5.5||/\bWindows XP\b/.test(W)&&j>8||8==j&&!/\bTrident\b/.test(e)))&&!c.test(s=t.call(m,e.replace(c,"")+";"))&&s.name&&(s="ing as "+s.name+((s=s.version)?" "+s:""),c.test(B)?(/\bIE\b/.test(s)&&"Mac OS"==W&&(W=null),s="identify"+s):(s="mask"+s,B=A?d(A.replace(/([a-z])([A-Z])/g,"$1 $2")):"Opera",/\bIE\b/.test(s)&&(W=null),M||(j=null)),F=["Presto"],N.push(s));else B+=" Mobile";(s=(/\bAppleWebKit\/([\d.]+\+?)/i.exec(e)||0)[1])&&(s=[parseFloat(s.replace(/\.(\d)$/,".0$1")),s],"Safari"==B&&"+"==s[1].slice(-1)?(B="WebKit Nightly",P="alpha",j=s[1].slice(0,-1)):j!=s[1]&&j!=(s[2]=(/\bSafari\/([\d.]+\+?)/i.exec(e)||0)[1])||(j=null),s[1]=(/\bChrome\/([\d.]+)/i.exec(e)||0)[1],537.36==s[0]&&537.36==s[2]&&parseFloat(s[1])>=28&&"WebKit"==F&&(F=["Blink"]),M&&(w||s[1])?(F&&(F[1]="like Chrome"),s=s[1]||((s=s[0])<530?1:s<532?2:s<532.05?3:s<533?4:s<534.03?5:s<534.07?6:s<534.1?7:s<534.13?8:s<534.16?9:s<534.24?10:s<534.3?11:s<535.01?12:s<535.02?"13+":s<535.07?15:s<535.11?16:s<535.19?17:s<536.05?18:s<536.1?19:s<537.01?20:s<537.11?"21+":s<537.13?23:s<537.18?24:s<537.24?25:s<537.36?26:"Blink"!=F?"27":"28")):(F&&(F[1]="like Safari"),s=(s=s[0])<400?1:s<500?2:s<526?3:s<533?4:s<534?"4+":s<535?5:s<537?6:s<538?7:s<601?8:"8"),F&&(F[1]+=" "+(s+="number"==typeof s?".x":/[.+]/.test(s)?"":"+")),"Safari"==B&&(!j||parseInt(j)>45)&&(j=s)),"Opera"==B&&(s=/\bzbov|zvav$/.exec(W))?(B+=" ",N.unshift("desktop mode"),"zvav"==s?(B+="Mini",j=null):B+="Mobile",W=W.replace(RegExp(" *"+s+"$"),"")):"Safari"==B&&/\bChrome\b/.exec(F&&F[1])&&(N.unshift("desktop mode"),B="Chrome Mobile",j=null,/\bOS X\b/.test(W)?(U="Apple",W="iOS 4.3+"):W=null),j&&0==j.indexOf(s=/[\d.]+$/.exec(W))&&e.indexOf("/"+s+"-")>-1&&(W=b(W.replace(s,""))),F&&!/\b(?:Avant|Nook)\b/.test(B)&&(/Browser|Lunascape|Maxthon/.test(B)||"Safari"!=B&&/^iOS/.test(W)&&/\bSafari\b/.test(F[1])||/^(?:Adobe|Arora|Breach|Midori|Opera|Phantom|Rekonq|Rock|Samsung Internet|Sleipnir|Web)/.test(B)&&F[1])&&(s=F[F.length-1])&&N.push(s),N.length&&(N=["("+N.join("; ")+")"]),U&&L&&L.indexOf(U)<0&&N.push("on "+U),L&&N.push((/^on /.test(N[N.length-1])?"":"on ")+L),W&&(s=/ ([\d.+]+)$/.exec(W),u=s&&"/"==W.charAt(W.length-s[0].length-1),W={architecture:32,family:s&&!u?W.replace(s[0],""):W,version:s?s[1]:null,toString:function(){var t=this.version;return this.family+(t&&!u?" "+t:"")+(64==this.architecture?" 64-bit":"")}}),(s=/\b(?:AMD|IA|Win|WOW|x86_|x)64\b/i.exec(D))&&!/\bi686\b/i.test(D)?(W&&(W.architecture=64,W.family=W.family.replace(RegExp(" *"+s),"")),B&&(/\bWOW64\b/i.test(e)||M&&/\w(?:86|32)$/.test(i.cpuClass||i.platform)&&!/\bWin64; x64\b/i.test(e))&&N.unshift("32-bit")):W&&/^OS X/.test(W.family)&&"Chrome"==B&&parseFloat(j)>=39&&(W.architecture=64),e||(e=null);var V={};return V.description=e,V.layout=F&&F[0],V.manufacturer=U,V.name=B,V.prerelease=P,V.product=L,V.ua=e,V.version=B&&j,V.os=W||{architecture:null,family:null,version:null,toString:function(){return"null"}},V.parse=t,V.toString=function(){return this.description||""},V.version&&N.unshift(j),V.name&&N.unshift(B),W&&B&&(W!=String(W).split(" ")[0]||W!=B.split(" ")[0]&&!L)&&N.push(L?"("+W+")":"on "+W),N.length&&(V.description=N.join(" ")),V}();"function"==typeof define&&"object"==typeof define.amd&&define.amd?(o.platform=w,define((function(){return w}))):i&&a?m(w,(function(t,e){i[e]=t})):o.platform=w}).call(this)}).call(this,void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],207:[function(t,e,n){(function(t){"use strict";void 0===t||!t.version||0===t.version.indexOf("v0.")||0===t.version.indexOf("v1.")&&0!==t.version.indexOf("v1.8.")?e.exports={nextTick:function(e,n,r,o){if("function"!=typeof e)throw new TypeError('"callback" argument must be a function');var i,a,s=arguments.length;switch(s){case 0:case 1:return t.nextTick(e);case 2:return t.nextTick((function(){e.call(null,n)}));case 3:return t.nextTick((function(){e.call(null,n,r)}));case 4:return t.nextTick((function(){e.call(null,n,r,o)}));default:for(i=new Array(s-1),a=0;a<i.length;)i[a++]=arguments[a];return t.nextTick((function(){e.apply(null,i)}))}}}:e.exports=t}).call(this,t("_process"))},{_process:208}],208:[function(t,e,n){var r,o,i=e.exports={};function a(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function u(t){if(r===setTimeout)return setTimeout(t,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(t){r=a}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(t){o=s}}();var c,l=[],f=!1,h=-1;function p(){f&&c&&(f=!1,c.length?l=c.concat(l):h=-1,l.length&&d())}function d(){if(!f){var t=u(p);f=!0;for(var e=l.length;e;){for(c=l,l=[];++h<e;)c&&c[h].run();h=-1,e=l.length}c=null,f=!1,function(t){if(o===clearTimeout)return clearTimeout(t);if((o===s||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(t);try{o(t)}catch(e){try{return o.call(null,t)}catch(e){return o.call(this,t)}}}(t)}}function m(t,e){this.fun=t,this.array=e}function v(){}i.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];l.push(new m(t,e)),1!==l.length||f||u(d)},m.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(t){return[]},i.binding=function(t){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(t){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],209:[function(t,e,n){(function(t){!function(r){var o="object"==typeof n&&n&&!n.nodeType&&n,i="object"==typeof e&&e&&!e.nodeType&&e,a="object"==typeof t&&t;a.global!==a&&a.window!==a&&a.self!==a||(r=a);var s,u,c=2147483647,l=/^xn--/,f=/[^\x20-\x7E]/,h=/[\x2E\u3002\uFF0E\uFF61]/g,p={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},d=Math.floor,m=String.fromCharCode;function v(t){throw new RangeError(p[t])}function g(t,e){for(var n=t.length,r=[];n--;)r[n]=e(t[n]);return r}function y(t,e){var n=t.split("@"),r="";return n.length>1&&(r=n[0]+"@",t=n[1]),r+g((t=t.replace(h,".")).split("."),e).join(".")}function b(t){for(var e,n,r=[],o=0,i=t.length;o<i;)(e=t.charCodeAt(o++))>=55296&&e<=56319&&o<i?56320==(64512&(n=t.charCodeAt(o++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),o--):r.push(e);return r}function w(t){return g(t,(function(t){var e="";return t>65535&&(e+=m((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=m(t)})).join("")}function x(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function _(t,e,n){var r=0;for(t=n?d(t/700):t>>1,t+=d(t/e);t>455;r+=36)t=d(t/35);return d(r+36*t/(t+38))}function E(t){var e,n,r,o,i,a,s,u,l,f,h,p=[],m=t.length,g=0,y=128,b=72;for((n=t.lastIndexOf("-"))<0&&(n=0),r=0;r<n;++r)t.charCodeAt(r)>=128&&v("not-basic"),p.push(t.charCodeAt(r));for(o=n>0?n+1:0;o<m;){for(i=g,a=1,s=36;o>=m&&v("invalid-input"),((u=(h=t.charCodeAt(o++))-48<10?h-22:h-65<26?h-65:h-97<26?h-97:36)>=36||u>d((c-g)/a))&&v("overflow"),g+=u*a,!(u<(l=s<=b?1:s>=b+26?26:s-b));s+=36)a>d(c/(f=36-l))&&v("overflow"),a*=f;b=_(g-i,e=p.length+1,0==i),d(g/e)>c-y&&v("overflow"),y+=d(g/e),g%=e,p.splice(g++,0,y)}return w(p)}function C(t){var e,n,r,o,i,a,s,u,l,f,h,p,g,y,w,E=[];for(p=(t=b(t)).length,e=128,n=0,i=72,a=0;a<p;++a)(h=t[a])<128&&E.push(m(h));for(r=o=E.length,o&&E.push("-");r<p;){for(s=c,a=0;a<p;++a)(h=t[a])>=e&&h<s&&(s=h);for(s-e>d((c-n)/(g=r+1))&&v("overflow"),n+=(s-e)*g,e=s,a=0;a<p;++a)if((h=t[a])<e&&++n>c&&v("overflow"),h==e){for(u=n,l=36;!(u<(f=l<=i?1:l>=i+26?26:l-i));l+=36)w=u-f,y=36-f,E.push(m(x(f+w%y,0))),u=d(w/y);E.push(m(x(u,0))),i=_(n,g,r==o),n=0,++r}++n,++e}return E.join("")}if(s={version:"1.4.1",ucs2:{decode:b,encode:w},decode:E,encode:C,toASCII:function(t){return y(t,(function(t){return f.test(t)?"xn--"+C(t):t}))},toUnicode:function(t){return y(t,(function(t){return l.test(t)?E(t.slice(4).toLowerCase()):t}))}},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",(function(){return s}));else if(o&&i)if(e.exports==o)i.exports=s;else for(u in s)s.hasOwnProperty(u)&&(o[u]=s[u]);else r.punycode=s}(this)}).call(this,void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],210:[function(t,e,n){"use strict";function r(t,e){return Object.prototype.hasOwnProperty.call(t,e)}e.exports=function(t,e,n,i){e=e||"&",n=n||"=";var a={};if("string"!=typeof t||0===t.length)return a;var s=/\+/g;t=t.split(e);var u=1e3;i&&"number"==typeof i.maxKeys&&(u=i.maxKeys);var c=t.length;u>0&&c>u&&(c=u);for(var l=0;l<c;++l){var f,h,p,d,m=t[l].replace(s,"%20"),v=m.indexOf(n);v>=0?(f=m.substr(0,v),h=m.substr(v+1)):(f=m,h=""),p=decodeURIComponent(f),d=decodeURIComponent(h),r(a,p)?o(a[p])?a[p].push(d):a[p]=[a[p],d]:a[p]=d}return a};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},{}],211:[function(t,e,n){"use strict";var r=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};e.exports=function(t,e,n,s){return e=e||"&",n=n||"=",null===t&&(t=void 0),"object"==typeof t?i(a(t),(function(a){var s=encodeURIComponent(r(a))+n;return o(t[a])?i(t[a],(function(t){return s+encodeURIComponent(r(t))})).join(e):s+encodeURIComponent(r(t[a]))})).join(e):s?encodeURIComponent(r(s))+n+encodeURIComponent(r(t)):""};var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(t,e){if(t.map)return t.map(e);for(var n=[],r=0;r<t.length;r++)n.push(e(t[r],r));return n}var a=Object.keys||function(t){var e=[];for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.push(n);return e}},{}],212:[function(t,e,n){"use strict";n.decode=n.parse=t("./decode"),n.encode=n.stringify=t("./encode")},{"./decode":210,"./encode":211}],213:[function(t,e,n){e.exports=t("./lib/_stream_duplex.js")},{"./lib/_stream_duplex.js":214}],214:[function(t,e,n){"use strict";var r=i(t("babel-runtime/core-js/object/create")),o=i(t("babel-runtime/core-js/object/keys"));function i(t){return t&&t.__esModule?t:{default:t}}var a=t("process-nextick-args"),s=o.default||function(t){var e=[];for(var n in t)e.push(n);return e};e.exports=d;var u=(0,r.default)(t("core-util-is"));u.inherits=t("inherits");var c=t("./_stream_readable"),l=t("./_stream_writable");u.inherits(d,c);for(var f=s(l.prototype),h=0;h<f.length;h++){var p=f[h];d.prototype[p]||(d.prototype[p]=l.prototype[p])}function d(t){if(!(this instanceof d))return new d(t);c.call(this,t),l.call(this,t),t&&!1===t.readable&&(this.readable=!1),t&&!1===t.writable&&(this.writable=!1),this.allowHalfOpen=!0,t&&!1===t.allowHalfOpen&&(this.allowHalfOpen=!1),this.once("end",m)}function m(){this.allowHalfOpen||this._writableState.ended||a.nextTick(v,this)}function v(t){t.end()}Object.defineProperty(d.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),Object.defineProperty(d.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&void 0!==this._writableState&&this._readableState.destroyed&&this._writableState.destroyed},set:function(t){void 0!==this._readableState&&void 0!==this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}),d.prototype._destroy=function(t,e){this.push(null),this.end(),a.nextTick(e,t)}},{"./_stream_readable":216,"./_stream_writable":218,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/keys":60,"core-util-is":189,inherits:196,"process-nextick-args":207}],215:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};e.exports=u;var a=t("./_stream_transform"),s=(0,i.default)(t("core-util-is"));function u(t){if(!(this instanceof u))return new u(t);a.call(this,t)}s.inherits=t("inherits"),s.inherits(u,a),u.prototype._transform=function(t,e,n){n(null,t)}},{"./_stream_transform":217,"babel-runtime/core-js/object/create":55,"core-util-is":189,inherits:196}],216:[function(t,e,n){(function(n,r){"use strict";var o=a(t("babel-runtime/core-js/object/get-prototype-of")),i=a(t("babel-runtime/core-js/object/create"));function a(t){return t&&t.__esModule?t:{default:t}}var s=t("process-nextick-args");e.exports=_;var u,c=t("isarray");_.ReadableState=x,t("events").EventEmitter;var l=function(t,e){return t.listeners(e).length},f=t("./internal/streams/stream"),h=t("safe-buffer").Buffer,p=r.Uint8Array||function(){},d=(0,i.default)(t("core-util-is"));d.inherits=t("inherits");var m=t("util"),v=void 0;v=m&&m.debuglog?m.debuglog("stream"):function(){};var g,y=t("./internal/streams/BufferList"),b=t("./internal/streams/destroy");d.inherits(_,f);var w=["error","close","destroy","pause","resume"];function x(e,n){e=e||{};var r=n instanceof(u=u||t("./_stream_duplex"));this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var o=e.highWaterMark,i=e.readableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(i||0===i)?i:a,this.highWaterMark=Math.floor(this.highWaterMark),this.buffer=new y,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.destroyed=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(g||(g=t("string_decoder/").StringDecoder),this.decoder=new g(e.encoding),this.encoding=e.encoding)}function _(e){if(u=u||t("./_stream_duplex"),!(this instanceof _))return new _(e);this._readableState=new x(e,this),this.readable=!0,e&&("function"==typeof e.read&&(this._read=e.read),"function"==typeof e.destroy&&(this._destroy=e.destroy)),f.call(this)}function E(t,e,n,r,i){var a,s=t._readableState;return null===e?(s.reading=!1,function(t,e){if(!e.ended){if(e.decoder){var n=e.decoder.end();n&&n.length&&(e.buffer.push(n),e.length+=e.objectMode?1:n.length)}e.ended=!0,k(t)}}(t,s)):(i||(a=function(t,e){var n,r;return r=e,h.isBuffer(r)||r instanceof p||"string"==typeof e||void 0===e||t.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}(s,e)),a?t.emit("error",a):s.objectMode||e&&e.length>0?("string"==typeof e||s.objectMode||(0,o.default)(e)===h.prototype||(e=function(t){return h.from(t)}(e)),r?s.endEmitted?t.emit("error",new Error("stream.unshift() after end event")):C(t,s,e,!0):s.ended?t.emit("error",new Error("stream.push() after EOF")):(s.reading=!1,s.decoder&&!n?(e=s.decoder.write(e),s.objectMode||0!==e.length?C(t,s,e,!1):I(t,s)):C(t,s,e,!1))):r||(s.reading=!1)),function(t){return!t.ended&&(t.needReadable||t.length<t.highWaterMark||0===t.length)}(s)}function C(t,e,n,r){e.flowing&&0===e.length&&!e.sync?(t.emit("data",n),t.read(0)):(e.length+=e.objectMode?1:n.length,r?e.buffer.unshift(n):e.buffer.push(n),e.needReadable&&k(t)),I(t,e)}function S(t,e){return t<=0||0===e.length&&e.ended?0:e.objectMode?1:t!=t?e.flowing&&e.length?e.buffer.head.data.length:e.length:(t>e.highWaterMark&&(e.highWaterMark=function(t){return t>=8388608?t=8388608:(t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++),t}(t)),t<=e.length?t:e.ended?e.length:(e.needReadable=!0,0))}function k(t){var e=t._readableState;e.needReadable=!1,e.emittedReadable||(v("emitReadable",e.flowing),e.emittedReadable=!0,e.sync?s.nextTick(T,t):T(t))}function T(t){v("emit readable"),t.emit("readable"),D(t)}function I(t,e){e.readingMore||(e.readingMore=!0,s.nextTick(O,t,e))}function O(t,e){for(var n=e.length;!e.reading&&!e.flowing&&!e.ended&&e.length<e.highWaterMark&&(v("maybeReadMore read 0"),t.read(0),n!==e.length);)n=e.length;e.readingMore=!1}function R(t){v("readable nexttick read 0"),t.read(0)}function A(t,e){e.reading||(v("resume read 0"),t.read(0)),e.resumeScheduled=!1,e.awaitDrain=0,t.emit("resume"),D(t),e.flowing&&!e.reading&&t.read(0)}function D(t){var e=t._readableState;for(v("flow",e.flowing);e.flowing&&null!==t.read(););}function N(t,e){return 0===e.length?null:(e.objectMode?n=e.buffer.shift():!t||t>=e.length?(n=e.decoder?e.buffer.join(""):1===e.buffer.length?e.buffer.head.data:e.buffer.concat(e.length),e.buffer.clear()):n=function(t,e,n){var r;return t<e.head.data.length?(r=e.head.data.slice(0,t),e.head.data=e.head.data.slice(t)):r=t===e.head.data.length?e.shift():n?function(t,e){var n=e.head,r=1,o=n.data;for(t-=o.length;n=n.next;){var i=n.data,a=t>i.length?i.length:t;if(a===i.length?o+=i:o+=i.slice(0,t),0==(t-=a)){a===i.length?(++r,n.next?e.head=n.next:e.head=e.tail=null):(e.head=n,n.data=i.slice(a));break}++r}return e.length-=r,o}(t,e):function(t,e){var n=h.allocUnsafe(t),r=e.head,o=1;for(r.data.copy(n),t-=r.data.length;r=r.next;){var i=r.data,a=t>i.length?i.length:t;if(i.copy(n,n.length-t,0,a),0==(t-=a)){a===i.length?(++o,r.next?e.head=r.next:e.head=e.tail=null):(e.head=r,r.data=i.slice(a));break}++o}return e.length-=o,n}(t,e),r}(t,e.buffer,e.decoder),n);var n}function P(t){var e=t._readableState;if(e.length>0)throw new Error('"endReadable()" called on non-empty stream');e.endEmitted||(e.ended=!0,s.nextTick(M,e,t))}function M(t,e){t.endEmitted||0!==t.length||(t.endEmitted=!0,e.readable=!1,e.emit("end"))}function j(t,e){for(var n=0,r=t.length;n<r;n++)if(t[n]===e)return n;return-1}Object.defineProperty(_.prototype,"destroyed",{get:function(){return void 0!==this._readableState&&this._readableState.destroyed},set:function(t){this._readableState&&(this._readableState.destroyed=t)}}),_.prototype.destroy=b.destroy,_.prototype._undestroy=b.undestroy,_.prototype._destroy=function(t,e){this.push(null),e(t)},_.prototype.push=function(t,e){var n,r=this._readableState;return r.objectMode?n=!0:"string"==typeof t&&((e=e||r.defaultEncoding)!==r.encoding&&(t=h.from(t,e),e=""),n=!0),E(this,t,e,!1,n)},_.prototype.unshift=function(t){return E(this,t,null,!0,!1)},_.prototype.isPaused=function(){return!1===this._readableState.flowing},_.prototype.setEncoding=function(e){return g||(g=t("string_decoder/").StringDecoder),this._readableState.decoder=new g(e),this._readableState.encoding=e,this},_.prototype.read=function(t){v("read",t),t=parseInt(t,10);var e=this._readableState,n=t;if(0!==t&&(e.emittedReadable=!1),0===t&&e.needReadable&&(e.length>=e.highWaterMark||e.ended))return v("read: emitReadable",e.length,e.ended),0===e.length&&e.ended?P(this):k(this),null;if(0===(t=S(t,e))&&e.ended)return 0===e.length&&P(this),null;var r,o=e.needReadable;return v("need readable",o),(0===e.length||e.length-t<e.highWaterMark)&&v("length less than watermark",o=!0),e.ended||e.reading?v("reading or ended",o=!1):o&&(v("do read"),e.reading=!0,e.sync=!0,0===e.length&&(e.needReadable=!0),this._read(e.highWaterMark),e.sync=!1,e.reading||(t=S(n,e))),null===(r=t>0?N(t,e):null)?(e.needReadable=!0,t=0):e.length-=t,0===e.length&&(e.ended||(e.needReadable=!0),n!==t&&e.ended&&P(this)),null!==r&&this.emit("data",r),r},_.prototype._read=function(t){this.emit("error",new Error("_read() is not implemented"))},_.prototype.pipe=function(t,e){var r=this,o=this._readableState;switch(o.pipesCount){case 0:o.pipes=t;break;case 1:o.pipes=[o.pipes,t];break;default:o.pipes.push(t)}o.pipesCount+=1,v("pipe count=%d opts=%j",o.pipesCount,e);var i=e&&!1===e.end||t===n.stdout||t===n.stderr?b:u;function a(e,n){v("onunpipe"),e===r&&n&&!1===n.hasUnpiped&&(n.hasUnpiped=!0,v("cleanup"),t.removeListener("close",g),t.removeListener("finish",y),t.removeListener("drain",f),t.removeListener("error",m),t.removeListener("unpipe",a),r.removeListener("end",u),r.removeListener("end",b),r.removeListener("data",d),h=!0,!o.awaitDrain||t._writableState&&!t._writableState.needDrain||f())}function u(){v("onend"),t.end()}o.endEmitted?s.nextTick(i):r.once("end",i),t.on("unpipe",a);var f=function(t){return function(){var e=t._readableState;v("pipeOnDrain",e.awaitDrain),e.awaitDrain&&e.awaitDrain--,0===e.awaitDrain&&l(t,"data")&&(e.flowing=!0,D(t))}}(r);t.on("drain",f);var h=!1,p=!1;function d(e){v("ondata"),p=!1,!1!==t.write(e)||p||((1===o.pipesCount&&o.pipes===t||o.pipesCount>1&&-1!==j(o.pipes,t))&&!h&&(v("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,p=!0),r.pause())}function m(e){v("onerror",e),b(),t.removeListener("error",m),0===l(t,"error")&&t.emit("error",e)}function g(){t.removeListener("finish",y),b()}function y(){v("onfinish"),t.removeListener("close",g),b()}function b(){v("unpipe"),r.unpipe(t)}return r.on("data",d),function(t,e,n){if("function"==typeof t.prependListener)return t.prependListener(e,n);t._events&&t._events[e]?c(t._events[e])?t._events[e].unshift(n):t._events[e]=[n,t._events[e]]:t.on(e,n)}(t,"error",m),t.once("close",g),t.once("finish",y),t.emit("pipe",r),o.flowing||(v("pipe resume"),r.resume()),t},_.prototype.unpipe=function(t){var e=this._readableState,n={hasUnpiped:!1};if(0===e.pipesCount)return this;if(1===e.pipesCount)return t&&t!==e.pipes||(t||(t=e.pipes),e.pipes=null,e.pipesCount=0,e.flowing=!1,t&&t.emit("unpipe",this,n)),this;if(!t){var r=e.pipes,o=e.pipesCount;e.pipes=null,e.pipesCount=0,e.flowing=!1;for(var i=0;i<o;i++)r[i].emit("unpipe",this,n);return this}var a=j(e.pipes,t);return-1===a||(e.pipes.splice(a,1),e.pipesCount-=1,1===e.pipesCount&&(e.pipes=e.pipes[0]),t.emit("unpipe",this,n)),this},_.prototype.on=function(t,e){var n=f.prototype.on.call(this,t,e);if("data"===t)!1!==this._readableState.flowing&&this.resume();else if("readable"===t){var r=this._readableState;r.endEmitted||r.readableListening||(r.readableListening=r.needReadable=!0,r.emittedReadable=!1,r.reading?r.length&&k(this):s.nextTick(R,this))}return n},_.prototype.addListener=_.prototype.on,_.prototype.resume=function(){var t=this._readableState;return t.flowing||(v("resume"),t.flowing=!0,function(t,e){e.resumeScheduled||(e.resumeScheduled=!0,s.nextTick(A,t,e))}(this,t)),this},_.prototype.pause=function(){return v("call pause flowing=%j",this._readableState.flowing),!1!==this._readableState.flowing&&(v("pause"),this._readableState.flowing=!1,this.emit("pause")),this},_.prototype.wrap=function(t){var e=this,n=this._readableState,r=!1;for(var o in t.on("end",(function(){if(v("wrapped end"),n.decoder&&!n.ended){var t=n.decoder.end();t&&t.length&&e.push(t)}e.push(null)})),t.on("data",(function(o){v("wrapped data"),n.decoder&&(o=n.decoder.write(o)),n.objectMode&&null==o||(n.objectMode||o&&o.length)&&(e.push(o)||(r=!0,t.pause()))})),t)void 0===this[o]&&"function"==typeof t[o]&&(this[o]=function(e){return function(){return t[e].apply(t,arguments)}}(o));for(var i=0;i<w.length;i++)t.on(w[i],this.emit.bind(this,w[i]));return this._read=function(e){v("wrapped _read",e),r&&(r=!1,t.resume())},this},Object.defineProperty(_.prototype,"readableHighWaterMark",{enumerable:!1,get:function(){return this._readableState.highWaterMark}}),_._fromList=N}).call(this,t("_process"),void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":214,"./internal/streams/BufferList":219,"./internal/streams/destroy":220,"./internal/streams/stream":221,_process:208,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/get-prototype-of":59,"core-util-is":189,events:192,inherits:196,isarray:198,"process-nextick-args":207,"safe-buffer":228,"string_decoder/":235,util:71}],217:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};e.exports=c;var a=t("./_stream_duplex"),s=(0,i.default)(t("core-util-is"));function u(t,e){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=e&&this.push(e),r(t);var o=this._readableState;o.reading=!1,(o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}function c(t){if(!(this instanceof c))return new c(t);a.call(this,t),this._transformState={afterTransform:u.bind(this),needTransform:!1,transforming:!1,writecb:null,writechunk:null,writeencoding:null},this._readableState.needReadable=!0,this._readableState.sync=!1,t&&("function"==typeof t.transform&&(this._transform=t.transform),"function"==typeof t.flush&&(this._flush=t.flush)),this.on("prefinish",l)}function l(){var t=this;"function"==typeof this._flush?this._flush((function(e,n){f(t,e,n)})):f(this,null,null)}function f(t,e,n){if(e)return t.emit("error",e);if(null!=n&&t.push(n),t._writableState.length)throw new Error("Calling transform done when ws.length != 0");if(t._transformState.transforming)throw new Error("Calling transform done when still transforming");return t.push(null)}s.inherits=t("inherits"),s.inherits(c,a),c.prototype.push=function(t,e){return this._transformState.needTransform=!1,a.prototype.push.call(this,t,e)},c.prototype._transform=function(t,e,n){throw new Error("_transform() is not implemented")},c.prototype._write=function(t,e,n){var r=this._transformState;if(r.writecb=n,r.writechunk=t,r.writeencoding=e,!r.transforming){var o=this._readableState;(r.needTransform||o.needReadable||o.length<o.highWaterMark)&&this._read(o.highWaterMark)}},c.prototype._read=function(t){var e=this._transformState;null!==e.writechunk&&e.writecb&&!e.transforming?(e.transforming=!0,this._transform(e.writechunk,e.writeencoding,e.afterTransform)):e.needTransform=!0},c.prototype._destroy=function(t,e){var n=this;a.prototype._destroy.call(this,t,(function(t){e(t),n.emit("close")}))}},{"./_stream_duplex":214,"babel-runtime/core-js/object/create":55,"core-util-is":189,inherits:196}],218:[function(t,e,n){(function(n,r){"use strict";var o=c(t("babel-runtime/core-js/object/define-property")),i=c(t("babel-runtime/core-js/symbol/has-instance")),a=c(t("babel-runtime/core-js/symbol")),s=c(t("babel-runtime/core-js/object/create")),u=c(t("babel-runtime/core-js/set-immediate"));function c(t){return t&&t.__esModule?t:{default:t}}var l=t("process-nextick-args");function f(t){var e=this;this.next=null,this.entry=null,this.finish=function(){!function(t,e,n){var r=t.entry;for(t.entry=null;r;){var o=r.callback;e.pendingcb--,o(n),r=r.next}e.corkedRequestsFree?e.corkedRequestsFree.next=t:e.corkedRequestsFree=t}(e,t)}}e.exports=E;var h,p=!n.browser&&["v0.10","v0.9."].indexOf(n.version.slice(0,5))>-1?u.default:l.nextTick;E.WritableState=_;var d=(0,s.default)(t("core-util-is"));d.inherits=t("inherits");var m,v={deprecate:t("util-deprecate")},g=t("./internal/streams/stream"),y=t("safe-buffer").Buffer,b=r.Uint8Array||function(){},w=t("./internal/streams/destroy");function x(){}function _(e,n){h=h||t("./_stream_duplex"),e=e||{};var r=n instanceof h;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,i=e.writableHighWaterMark,a=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(i||0===i)?i:a,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var s=!1===e.decodeStrings;this.decodeStrings=!s,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(t){!function(t,e){var n=t._writableState,r=n.sync,o=n.writecb;if(function(t){t.writing=!1,t.writecb=null,t.length-=t.writelen,t.writelen=0}(n),e)!function(t,e,n,r,o){--e.pendingcb,n?(l.nextTick(o,r),l.nextTick(O,t,e),t._writableState.errorEmitted=!0,t.emit("error",r)):(o(r),t._writableState.errorEmitted=!0,t.emit("error",r),O(t,e))}(t,n,r,e,o);else{var i=T(n);i||n.corked||n.bufferProcessing||!n.bufferedRequest||k(t,n),r?p(S,t,n,i,o):S(t,n,i,o)}}(n,t)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new f(this)}function E(e){if(h=h||t("./_stream_duplex"),!(m.call(E,this)||this instanceof h))return new E(e);this._writableState=new _(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),g.call(this)}function C(t,e,n,r,o,i,a){e.writelen=r,e.writecb=a,e.writing=!0,e.sync=!0,n?t._writev(o,e.onwrite):t._write(o,i,e.onwrite),e.sync=!1}function S(t,e,n,r){n||function(t,e){0===e.length&&e.needDrain&&(e.needDrain=!1,t.emit("drain"))}(t,e),e.pendingcb--,r(),O(t,e)}function k(t,e){e.bufferProcessing=!0;var n=e.bufferedRequest;if(t._writev&&n&&n.next){var r=e.bufferedRequestCount,o=new Array(r),i=e.corkedRequestsFree;i.entry=n;for(var a=0,s=!0;n;)o[a]=n,n.isBuf||(s=!1),n=n.next,a+=1;o.allBuffers=s,C(t,e,!0,e.length,o,"",i.finish),e.pendingcb++,e.lastBufferedRequest=null,i.next?(e.corkedRequestsFree=i.next,i.next=null):e.corkedRequestsFree=new f(e),e.bufferedRequestCount=0}else{for(;n;){var u=n.chunk,c=n.encoding,l=n.callback;if(C(t,e,!1,e.objectMode?1:u.length,u,c,l),n=n.next,e.bufferedRequestCount--,e.writing)break}null===n&&(e.lastBufferedRequest=null)}e.bufferedRequest=n,e.bufferProcessing=!1}function T(t){return t.ending&&0===t.length&&null===t.bufferedRequest&&!t.finished&&!t.writing}function I(t,e){t._final((function(n){e.pendingcb--,n&&t.emit("error",n),e.prefinished=!0,t.emit("prefinish"),O(t,e)}))}function O(t,e){var n=T(e);return n&&(function(t,e){e.prefinished||e.finalCalled||("function"==typeof t._final?(e.pendingcb++,e.finalCalled=!0,l.nextTick(I,t,e)):(e.prefinished=!0,t.emit("prefinish")))}(t,e),0===e.pendingcb&&(e.finished=!0,t.emit("finish"))),n}d.inherits(E,g),_.prototype.getBuffer=function(){for(var t=this.bufferedRequest,e=[];t;)e.push(t),t=t.next;return e},function(){try{Object.defineProperty(_.prototype,"buffer",{get:v.deprecate((function(){return this.getBuffer()}),"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(t){}}(),"function"==typeof a.default&&i.default&&"function"==typeof Function.prototype[i.default]?(m=Function.prototype[i.default],(0,o.default)(E,i.default,{value:function(t){return!!m.call(this,t)||this===E&&t&&t._writableState instanceof _}})):m=function(t){return t instanceof this},E.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},E.prototype.write=function(t,e,n){var r,o=this._writableState,i=!1,a=!o.objectMode&&(r=t,y.isBuffer(r)||r instanceof b);return a&&!y.isBuffer(t)&&(t=function(t){return y.from(t)}(t)),"function"==typeof e&&(n=e,e=null),a?e="buffer":e||(e=o.defaultEncoding),"function"!=typeof n&&(n=x),o.ended?function(t,e){var n=new Error("write after end");t.emit("error",n),l.nextTick(e,n)}(this,n):(a||function(t,e,n,r){var o=!0,i=!1;return null===n?i=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||e.objectMode||(i=new TypeError("Invalid non-string/buffer chunk")),i&&(t.emit("error",i),l.nextTick(r,i),o=!1),o}(this,o,t,n))&&(o.pendingcb++,i=function(t,e,n,r,o,i){if(!n){var a=function(t,e,n){return t.objectMode||!1===t.decodeStrings||"string"!=typeof e||(e=y.from(e,n)),e}(e,r,o);r!==a&&(n=!0,o="buffer",r=a)}var s=e.objectMode?1:r.length;e.length+=s;var u=e.length<e.highWaterMark;if(u||(e.needDrain=!0),e.writing||e.corked){var c=e.lastBufferedRequest;e.lastBufferedRequest={chunk:r,encoding:o,isBuf:n,callback:i,next:null},c?c.next=e.lastBufferedRequest:e.bufferedRequest=e.lastBufferedRequest,e.bufferedRequestCount+=1}else C(t,e,!1,s,r,o,i);return u}(this,o,a,t,e,n)),i},E.prototype.cork=function(){this._writableState.corked++},E.prototype.uncork=function(){var t=this._writableState;t.corked&&(t.corked--,t.writing||t.corked||t.finished||t.bufferProcessing||!t.bufferedRequest||k(this,t))},E.prototype.setDefaultEncoding=function(t){if("string"==typeof t&&(t=t.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((t+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this},Object.defineProperty(E.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),E.prototype._write=function(t,e,n){n(new Error("_write() is not implemented"))},E.prototype._writev=null,E.prototype.end=function(t,e,n){var r=this._writableState;"function"==typeof t?(n=t,t=null,e=null):"function"==typeof e&&(n=e,e=null),null!=t&&this.write(t,e),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(t,e,n){e.ending=!0,O(t,e),n&&(e.finished?l.nextTick(n):t.once("finish",n)),e.ended=!0,t.writable=!1}(this,r,n)},Object.defineProperty(E.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(t){this._writableState&&(this._writableState.destroyed=t)}}),E.prototype.destroy=w.destroy,E.prototype._undestroy=w.undestroy,E.prototype._destroy=function(t,e){this.end(),e(t)}}).call(this,t("_process"),void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./_stream_duplex":214,"./internal/streams/destroy":220,"./internal/streams/stream":221,_process:208,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/define-property":56,"babel-runtime/core-js/set-immediate":62,"babel-runtime/core-js/symbol":64,"babel-runtime/core-js/symbol/has-instance":65,"core-util-is":189,inherits:196,"process-nextick-args":207,"safe-buffer":228,"util-deprecate":240}],219:[function(t,e,n){"use strict";var r=t("safe-buffer").Buffer,o=t("util");e.exports=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.head=null,this.tail=null,this.length=0}return t.prototype.push=function(t){var e={data:t,next:null};this.length>0?this.tail.next=e:this.head=e,this.tail=e,++this.length},t.prototype.unshift=function(t){var e={data:t,next:this.head};0===this.length&&(this.tail=e),this.head=e,++this.length},t.prototype.shift=function(){if(0!==this.length){var t=this.head.data;return 1===this.length?this.head=this.tail=null:this.head=this.head.next,--this.length,t}},t.prototype.clear=function(){this.head=this.tail=null,this.length=0},t.prototype.join=function(t){if(0===this.length)return"";for(var e=this.head,n=""+e.data;e=e.next;)n+=t+e.data;return n},t.prototype.concat=function(t){if(0===this.length)return r.alloc(0);if(1===this.length)return this.head.data;for(var e,n,o,i=r.allocUnsafe(t>>>0),a=this.head,s=0;a;)e=a.data,n=i,o=s,e.copy(n,o),s+=a.data.length,a=a.next;return i},t}(),o&&o.inspect&&o.inspect.custom&&(e.exports.prototype[o.inspect.custom]=function(){var t=o.inspect({length:this.length});return this.constructor.name+" "+t})},{"safe-buffer":228,util:71}],220:[function(t,e,n){"use strict";var r=t("process-nextick-args");function o(t,e){t.emit("error",e)}e.exports={destroy:function(t,e){var n=this,i=this._readableState&&this._readableState.destroyed,a=this._writableState&&this._writableState.destroyed;return i||a?(e?e(t):!t||this._writableState&&this._writableState.errorEmitted||r.nextTick(o,this,t),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(t||null,(function(t){!e&&t?(r.nextTick(o,n,t),n._writableState&&(n._writableState.errorEmitted=!0)):e&&e(t)})),this)},undestroy:function(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}}},{"process-nextick-args":207}],221:[function(t,e,n){"use strict";e.exports=t("events").EventEmitter},{events:192}],222:[function(t,e,n){e.exports=t("./readable").PassThrough},{"./readable":223}],223:[function(t,e,n){(n=e.exports=t("./lib/_stream_readable.js")).Stream=n,n.Readable=n,n.Writable=t("./lib/_stream_writable.js"),n.Duplex=t("./lib/_stream_duplex.js"),n.Transform=t("./lib/_stream_transform.js"),n.PassThrough=t("./lib/_stream_passthrough.js")},{"./lib/_stream_duplex.js":214,"./lib/_stream_passthrough.js":215,"./lib/_stream_readable.js":216,"./lib/_stream_transform.js":217,"./lib/_stream_writable.js":218}],224:[function(t,e,n){e.exports=t("./readable").Transform},{"./readable":223}],225:[function(t,e,n){e.exports=t("./lib/_stream_writable.js")},{"./lib/_stream_writable.js":218}],226:[function(t,e,n){var r=function(){return this}()||Function("return this")(),o=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,i=o&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=t("./runtime"),o)r.regeneratorRuntime=i;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},{"./runtime":227}],227:[function(t,e,n){!function(t){"use strict";var n=Object.prototype,r=n.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag",u="object"==typeof e,c=t.regeneratorRuntime;if(c)u&&(e.exports=c);else{(c=t.regeneratorRuntime=u?e.exports:{}).wrap=m;var l={},f={};f[i]=function(){return this};var h=Object.getPrototypeOf,p=h&&h(h(k([])));p&&p!==n&&r.call(p,i)&&(f=p);var d=b.prototype=g.prototype=Object.create(f);y.prototype=d.constructor=b,b.constructor=y,b[s]=y.displayName="GeneratorFunction",c.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===y||"GeneratorFunction"===(e.displayName||e.name))},c.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,s in t||(t[s]="GeneratorFunction")),t.prototype=Object.create(d),t},c.awrap=function(t){return{__await:t}},w(x.prototype),x.prototype[a]=function(){return this},c.AsyncIterator=x,c.async=function(t,e,n,r){var o=new x(m(t,e,n,r));return c.isGeneratorFunction(e)?o:o.next().then((function(t){return t.done?t.value:o.next()}))},w(d),d[s]="Generator",d[i]=function(){return this},d.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=k,S.prototype={constructor:S,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(C),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},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 n(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),l},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),l}},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 o=r.arg;C(n)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:k(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}}}function m(t,e,n,r){var o=e&&e.prototype instanceof g?e:g,i=Object.create(o.prototype),a=new S(r||[]);return i._invoke=function(t,e,n){var r="suspendedStart";return function(o,i){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===o)throw i;return{value:void 0,done:!0}}for(n.method=o,n.arg=i;;){var a=n.delegate;if(a){var s=_(a,n);if(s){if(s===l)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=v(t,e,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===l)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(t,n,a),i}function v(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function g(){}function y(){}function b(){}function w(t){["next","throw","return"].forEach((function(e){t[e]=function(t){return this._invoke(e,t)}}))}function x(t){var e;this._invoke=function(n,o){function i(){return new Promise((function(e,i){!function e(n,o,i,a){var s=v(t[n],t,o);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"==typeof c&&r.call(c,"__await")?Promise.resolve(c.__await).then((function(t){e("next",t,i,a)}),(function(t){e("throw",t,i,a)})):Promise.resolve(c).then((function(t){u.value=t,i(u)}),a)}a(s.arg)}(n,o,e,i)}))}return e=e?e.then(i,i):i()}}function _(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,_(t,e),"throw"===e.method))return l;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=v(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,l;var o=r.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,l):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,l)}function E(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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function S(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function k(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:T}}function T(){return{value:void 0,done:!0}}}(function(){return this}()||Function("return this")())},{}],228:[function(t,e,n){var r=t("buffer"),o=r.Buffer;function i(t,e){for(var n in t)e[n]=t[n]}function a(t,e,n){return o(t,e,n)}o.from&&o.alloc&&o.allocUnsafe&&o.allocUnsafeSlow?e.exports=r:(i(r,n),n.Buffer=a),i(o,a),a.from=function(t,e,n){if("number"==typeof t)throw new TypeError("Argument must not be a number");return o(t,e,n)},a.alloc=function(t,e,n){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=o(t);return void 0!==e?"string"==typeof n?r.fill(e,n):r.fill(e):r.fill(0),r},a.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return o(t)},a.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return r.SlowBuffer(t)}},{buffer:73}],229:[function(t,e,n){(function(e){"use strict";var r=c(t("babel-runtime/core-js/string/from-code-point")),o=c(t("babel-runtime/core-js/json/stringify")),i=c(t("babel-runtime/helpers/typeof")),a=c(t("babel-runtime/core-js/object/define-property")),s=c(t("babel-runtime/core-js/object/keys")),u=c(t("babel-runtime/core-js/object/create"));function c(t){return t&&t.__esModule?t:{default:t}}!function(n){n.parser=function(t,e){return new f(t,e)},n.SAXParser=f,n.SAXStream=p,n.createStream=function(t,e){return new p(t,e)},n.MAX_BUFFER_LENGTH=65536;var c,l=["comment","sgmlDecl","textNode","tagName","doctype","procInstName","procInstBody","entity","attribName","attribValue","cdata","script"];function f(t,e){if(!(this instanceof f))return new f(t,e);!function(t){for(var e=0,n=l.length;e<n;e++)t[l[e]]=""}(this),this.q=this.c="",this.bufferCheckPosition=n.MAX_BUFFER_LENGTH,this.opt=e||{},this.opt.lowercase=this.opt.lowercase||this.opt.lowercasetags,this.looseCase=this.opt.lowercase?"toLowerCase":"toUpperCase",this.tags=[],this.closed=this.closedRoot=this.sawRoot=!1,this.tag=this.error=null,this.strict=!!t,this.noscript=!(!t&&!this.opt.noscript),this.state=I.BEGIN,this.strictEntities=this.opt.strictEntities,this.ENTITIES=this.strictEntities?(0,u.default)(n.XML_ENTITIES):(0,u.default)(n.ENTITIES),this.attribList=[],this.opt.xmlns&&(this.ns=(0,u.default)(m)),this.trackPosition=!1!==this.opt.position,this.trackPosition&&(this.position=this.line=this.column=0),R(this,"onready")}n.EVENTS=["text","processinginstruction","sgmldeclaration","doctype","comment","opentagstart","attribute","opentag","closetag","opencdata","cdata","closecdata","error","end","ready","script","opennamespace","closenamespace"],u.default||(Object.create=function(t){function e(){}return e.prototype=t,new e}),s.default||(Object.keys=function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e}),f.prototype={end:function(){M(this)},write:function(t){if(this.error)throw this.error;if(this.closed)return P(this,"Cannot write after close. Assign an onready handler.");if(null===t)return M(this);"object"===(void 0===t?"undefined":(0,i.default)(t))&&(t=t.toString());for(var e=0,r="";r=q(t,e++),this.c=r,r;)switch(this.trackPosition&&(this.position++,"\n"===r?(this.line++,this.column=0):this.column++),this.state){case I.BEGIN:if(this.state=I.BEGIN_WHITESPACE,"\ufeff"===r)continue;V(this,r);continue;case I.BEGIN_WHITESPACE:V(this,r);continue;case I.TEXT:if(this.sawRoot&&!this.closedRoot){for(var o=e-1;r&&"<"!==r&&"&"!==r;)(r=q(t,e++))&&this.trackPosition&&(this.position++,"\n"===r?(this.line++,this.column=0):this.column++);this.textNode+=t.substring(o,e-1)}"<"!==r||this.sawRoot&&this.closedRoot&&!this.strict?(w(r)||this.sawRoot&&!this.closedRoot||j(this,"Text data outside of root node."),"&"===r?this.state=I.TEXT_ENTITY:this.textNode+=r):(this.state=I.OPEN_WAKA,this.startTagPosition=this.position);continue;case I.SCRIPT:"<"===r?this.state=I.SCRIPT_ENDING:this.script+=r;continue;case I.SCRIPT_ENDING:"/"===r?this.state=I.CLOSE_TAG:(this.script+="<"+r,this.state=I.SCRIPT);continue;case I.OPEN_WAKA:if("!"===r)this.state=I.SGML_DECL,this.sgmlDecl="";else if(w(r));else if(E(v,r))this.state=I.OPEN_TAG,this.tagName=r;else if("/"===r)this.state=I.CLOSE_TAG,this.tagName="";else if("?"===r)this.state=I.PROC_INST,this.procInstName=this.procInstBody="";else{if(j(this,"Unencoded <"),this.startTagPosition+1<this.position){var a=this.position-this.startTagPosition;r=new Array(a).join(" ")+r}this.textNode+="<"+r,this.state=I.TEXT}continue;case I.SGML_DECL:"[CDATA["===(this.sgmlDecl+r).toUpperCase()?(A(this,"onopencdata"),this.state=I.CDATA,this.sgmlDecl="",this.cdata=""):this.sgmlDecl+r==="--"?(this.state=I.COMMENT,this.comment="",this.sgmlDecl=""):"DOCTYPE"===(this.sgmlDecl+r).toUpperCase()?(this.state=I.DOCTYPE,(this.doctype||this.sawRoot)&&j(this,"Inappropriately located doctype declaration"),this.doctype="",this.sgmlDecl=""):">"===r?(A(this,"onsgmldeclaration",this.sgmlDecl),this.sgmlDecl="",this.state=I.TEXT):x(r)?(this.state=I.SGML_DECL_QUOTED,this.sgmlDecl+=r):this.sgmlDecl+=r;continue;case I.SGML_DECL_QUOTED:r===this.q&&(this.state=I.SGML_DECL,this.q=""),this.sgmlDecl+=r;continue;case I.DOCTYPE:">"===r?(this.state=I.TEXT,A(this,"ondoctype",this.doctype),this.doctype=!0):(this.doctype+=r,"["===r?this.state=I.DOCTYPE_DTD:x(r)&&(this.state=I.DOCTYPE_QUOTED,this.q=r));continue;case I.DOCTYPE_QUOTED:this.doctype+=r,r===this.q&&(this.q="",this.state=I.DOCTYPE);continue;case I.DOCTYPE_DTD:this.doctype+=r,"]"===r?this.state=I.DOCTYPE:x(r)&&(this.state=I.DOCTYPE_DTD_QUOTED,this.q=r);continue;case I.DOCTYPE_DTD_QUOTED:this.doctype+=r,r===this.q&&(this.state=I.DOCTYPE_DTD,this.q="");continue;case I.COMMENT:"-"===r?this.state=I.COMMENT_ENDING:this.comment+=r;continue;case I.COMMENT_ENDING:"-"===r?(this.state=I.COMMENT_ENDED,this.comment=N(this.opt,this.comment),this.comment&&A(this,"oncomment",this.comment),this.comment=""):(this.comment+="-"+r,this.state=I.COMMENT);continue;case I.COMMENT_ENDED:">"!==r?(j(this,"Malformed comment"),this.comment+="--"+r,this.state=I.COMMENT):this.state=I.TEXT;continue;case I.CDATA:"]"===r?this.state=I.CDATA_ENDING:this.cdata+=r;continue;case I.CDATA_ENDING:"]"===r?this.state=I.CDATA_ENDING_2:(this.cdata+="]"+r,this.state=I.CDATA);continue;case I.CDATA_ENDING_2:">"===r?(this.cdata&&A(this,"oncdata",this.cdata),A(this,"onclosecdata"),this.cdata="",this.state=I.TEXT):"]"===r?this.cdata+="]":(this.cdata+="]]"+r,this.state=I.CDATA);continue;case I.PROC_INST:"?"===r?this.state=I.PROC_INST_ENDING:w(r)?this.state=I.PROC_INST_BODY:this.procInstName+=r;continue;case I.PROC_INST_BODY:if(!this.procInstBody&&w(r))continue;"?"===r?this.state=I.PROC_INST_ENDING:this.procInstBody+=r;continue;case I.PROC_INST_ENDING:">"===r?(A(this,"onprocessinginstruction",{name:this.procInstName,body:this.procInstBody}),this.procInstName=this.procInstBody="",this.state=I.TEXT):(this.procInstBody+="?"+r,this.state=I.PROC_INST_BODY);continue;case I.OPEN_TAG:E(g,r)?this.tagName+=r:(F(this),">"===r?U(this):"/"===r?this.state=I.OPEN_TAG_SLASH:(w(r)||j(this,"Invalid character in tag name"),this.state=I.ATTRIB));continue;case I.OPEN_TAG_SLASH:">"===r?(U(this,!0),W(this)):(j(this,"Forward-slash in opening tag not followed by >"),this.state=I.ATTRIB);continue;case I.ATTRIB:if(w(r))continue;">"===r?U(this):"/"===r?this.state=I.OPEN_TAG_SLASH:E(v,r)?(this.attribName=r,this.attribValue="",this.state=I.ATTRIB_NAME):j(this,"Invalid attribute name");continue;case I.ATTRIB_NAME:"="===r?this.state=I.ATTRIB_VALUE:">"===r?(j(this,"Attribute without value"),this.attribValue=this.attribName,L(this),U(this)):w(r)?this.state=I.ATTRIB_NAME_SAW_WHITE:E(g,r)?this.attribName+=r:j(this,"Invalid attribute name");continue;case I.ATTRIB_NAME_SAW_WHITE:if("="===r)this.state=I.ATTRIB_VALUE;else{if(w(r))continue;j(this,"Attribute without value"),this.tag.attributes[this.attribName]="",this.attribValue="",A(this,"onattribute",{name:this.attribName,value:""}),this.attribName="",">"===r?U(this):E(v,r)?(this.attribName=r,this.state=I.ATTRIB_NAME):(j(this,"Invalid attribute name"),this.state=I.ATTRIB)}continue;case I.ATTRIB_VALUE:if(w(r))continue;x(r)?(this.q=r,this.state=I.ATTRIB_VALUE_QUOTED):(j(this,"Unquoted attribute value"),this.state=I.ATTRIB_VALUE_UNQUOTED,this.attribValue=r);continue;case I.ATTRIB_VALUE_QUOTED:if(r!==this.q){"&"===r?this.state=I.ATTRIB_VALUE_ENTITY_Q:this.attribValue+=r;continue}L(this),this.q="",this.state=I.ATTRIB_VALUE_CLOSED;continue;case I.ATTRIB_VALUE_CLOSED:w(r)?this.state=I.ATTRIB:">"===r?U(this):"/"===r?this.state=I.OPEN_TAG_SLASH:E(v,r)?(j(this,"No whitespace between attributes"),this.attribName=r,this.attribValue="",this.state=I.ATTRIB_NAME):j(this,"Invalid attribute name");continue;case I.ATTRIB_VALUE_UNQUOTED:if(!_(r)){"&"===r?this.state=I.ATTRIB_VALUE_ENTITY_U:this.attribValue+=r;continue}L(this),">"===r?U(this):this.state=I.ATTRIB;continue;case I.CLOSE_TAG:if(this.tagName)">"===r?W(this):E(g,r)?this.tagName+=r:this.script?(this.script+="</"+this.tagName,this.tagName="",this.state=I.SCRIPT):(w(r)||j(this,"Invalid tagname in closing tag"),this.state=I.CLOSE_TAG_SAW_WHITE);else{if(w(r))continue;C(v,r)?this.script?(this.script+="</"+r,this.state=I.SCRIPT):j(this,"Invalid tagname in closing tag."):this.tagName=r}continue;case I.CLOSE_TAG_SAW_WHITE:if(w(r))continue;">"===r?W(this):j(this,"Invalid characters in closing tag");continue;case I.TEXT_ENTITY:case I.ATTRIB_VALUE_ENTITY_Q:case I.ATTRIB_VALUE_ENTITY_U:var s,u;switch(this.state){case I.TEXT_ENTITY:s=I.TEXT,u="textNode";break;case I.ATTRIB_VALUE_ENTITY_Q:s=I.ATTRIB_VALUE_QUOTED,u="attribValue";break;case I.ATTRIB_VALUE_ENTITY_U:s=I.ATTRIB_VALUE_UNQUOTED,u="attribValue"}";"===r?(this[u]+=z(this),this.entity="",this.state=s):E(this.entity.length?b:y,r)?this.entity+=r:(j(this,"Invalid character in entity name"),this[u]+="&"+this.entity+r,this.entity="",this.state=s);continue;default:throw new Error(this,"Unknown state: "+this.state)}return this.position>=this.bufferCheckPosition&&function(t){for(var e=Math.max(n.MAX_BUFFER_LENGTH,10),r=0,o=0,i=l.length;o<i;o++){var a=t[l[o]].length;if(a>e)switch(l[o]){case"textNode":D(t);break;case"cdata":A(t,"oncdata",t.cdata),t.cdata="";break;case"script":A(t,"onscript",t.script),t.script="";break;default:P(t,"Max buffer length exceeded: "+l[o])}r=Math.max(r,a)}var s=n.MAX_BUFFER_LENGTH-r;t.bufferCheckPosition=s+t.position}(this),this}
/*! http://mths.be/fromcodepoint v0.1.0 by @mathias */,resume:function(){return this.error=null,this},close:function(){return this.write(null)},flush:function(){var t;D(t=this),""!==t.cdata&&(A(t,"oncdata",t.cdata),t.cdata=""),""!==t.script&&(A(t,"onscript",t.script),t.script="")}};try{c=t("stream").Stream}catch(t){c=function(){}}var h=n.EVENTS.filter((function(t){return"error"!==t&&"end"!==t}));function p(t,e){if(!(this instanceof p))return new p(t,e);c.apply(this),this._parser=new f(t,e),this.writable=!0,this.readable=!0;var n=this;this._parser.onend=function(){n.emit("end")},this._parser.onerror=function(t){n.emit("error",t),n._parser.error=null},this._decoder=null,h.forEach((function(t){(0,a.default)(n,"on"+t,{get:function(){return n._parser["on"+t]},set:function(e){if(!e)return n.removeAllListeners(t),n._parser["on"+t]=e,e;n.on(t,e)},enumerable:!0,configurable:!1})}))}p.prototype=(0,u.default)(c.prototype,{constructor:{value:p}}),p.prototype.write=function(n){if("function"==typeof e&&"function"==typeof e.isBuffer&&e.isBuffer(n)){if(!this._decoder){var r=t("string_decoder").StringDecoder;this._decoder=new r("utf8")}n=this._decoder.write(n)}return this._parser.write(n.toString()),this.emit("data",n),!0},p.prototype.end=function(t){return t&&t.length&&this.write(t),this._parser.end(),!0},p.prototype.on=function(t,e){var n=this;return n._parser["on"+t]||-1===h.indexOf(t)||(n._parser["on"+t]=function(){var e=1===arguments.length?[arguments[0]]:Array.apply(null,arguments);e.splice(0,0,t),n.emit.apply(n,e)}),c.prototype.on.call(n,t,e)};var d="http://www.w3.org/XML/1998/namespace",m={xml:d,xmlns:"http://www.w3.org/2000/xmlns/"},v=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,g=/[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/,y=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,b=/[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;function w(t){return" "===t||"\n"===t||"\r"===t||"\t"===t}function x(t){return'"'===t||"'"===t}function _(t){return">"===t||w(t)}function E(t,e){return t.test(e)}function C(t,e){return!E(t,e)}var S,k,T,I=0;for(var O in n.STATE={BEGIN:I++,BEGIN_WHITESPACE:I++,TEXT:I++,TEXT_ENTITY:I++,OPEN_WAKA:I++,SGML_DECL:I++,SGML_DECL_QUOTED:I++,DOCTYPE:I++,DOCTYPE_QUOTED:I++,DOCTYPE_DTD:I++,DOCTYPE_DTD_QUOTED:I++,COMMENT_STARTING:I++,COMMENT:I++,COMMENT_ENDING:I++,COMMENT_ENDED:I++,CDATA:I++,CDATA_ENDING:I++,CDATA_ENDING_2:I++,PROC_INST:I++,PROC_INST_BODY:I++,PROC_INST_ENDING:I++,OPEN_TAG:I++,OPEN_TAG_SLASH:I++,ATTRIB:I++,ATTRIB_NAME:I++,ATTRIB_NAME_SAW_WHITE:I++,ATTRIB_VALUE:I++,ATTRIB_VALUE_QUOTED:I++,ATTRIB_VALUE_CLOSED:I++,ATTRIB_VALUE_UNQUOTED:I++,ATTRIB_VALUE_ENTITY_Q:I++,ATTRIB_VALUE_ENTITY_U:I++,CLOSE_TAG:I++,CLOSE_TAG_SAW_WHITE:I++,SCRIPT:I++,SCRIPT_ENDING:I++},n.XML_ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},n.ENTITIES={amp:"&",gt:">",lt:"<",quot:'"',apos:"'",AElig:198,Aacute:193,Acirc:194,Agrave:192,Aring:197,Atilde:195,Auml:196,Ccedil:199,ETH:208,Eacute:201,Ecirc:202,Egrave:200,Euml:203,Iacute:205,Icirc:206,Igrave:204,Iuml:207,Ntilde:209,Oacute:211,Ocirc:212,Ograve:210,Oslash:216,Otilde:213,Ouml:214,THORN:222,Uacute:218,Ucirc:219,Ugrave:217,Uuml:220,Yacute:221,aacute:225,acirc:226,aelig:230,agrave:224,aring:229,atilde:227,auml:228,ccedil:231,eacute:233,ecirc:234,egrave:232,eth:240,euml:235,iacute:237,icirc:238,igrave:236,iuml:239,ntilde:241,oacute:243,ocirc:244,ograve:242,oslash:248,otilde:245,ouml:246,szlig:223,thorn:254,uacute:250,ucirc:251,ugrave:249,uuml:252,yacute:253,yuml:255,copy:169,reg:174,nbsp:160,iexcl:161,cent:162,pound:163,curren:164,yen:165,brvbar:166,sect:167,uml:168,ordf:170,laquo:171,not:172,shy:173,macr:175,deg:176,plusmn:177,sup1:185,sup2:178,sup3:179,acute:180,micro:181,para:182,middot:183,cedil:184,ordm:186,raquo:187,frac14:188,frac12:189,frac34:190,iquest:191,times:215,divide:247,OElig:338,oelig:339,Scaron:352,scaron:353,Yuml:376,fnof:402,circ:710,tilde:732,Alpha:913,Beta:914,Gamma:915,Delta:916,Epsilon:917,Zeta:918,Eta:919,Theta:920,Iota:921,Kappa:922,Lambda:923,Mu:924,Nu:925,Xi:926,Omicron:927,Pi:928,Rho:929,Sigma:931,Tau:932,Upsilon:933,Phi:934,Chi:935,Psi:936,Omega:937,alpha:945,beta:946,gamma:947,delta:948,epsilon:949,zeta:950,eta:951,theta:952,iota:953,kappa:954,lambda:955,mu:956,nu:957,xi:958,omicron:959,pi:960,rho:961,sigmaf:962,sigma:963,tau:964,upsilon:965,phi:966,chi:967,psi:968,omega:969,thetasym:977,upsih:978,piv:982,ensp:8194,emsp:8195,thinsp:8201,zwnj:8204,zwj:8205,lrm:8206,rlm:8207,ndash:8211,mdash:8212,lsquo:8216,rsquo:8217,sbquo:8218,ldquo:8220,rdquo:8221,bdquo:8222,dagger:8224,Dagger:8225,bull:8226,hellip:8230,permil:8240,prime:8242,Prime:8243,lsaquo:8249,rsaquo:8250,oline:8254,frasl:8260,euro:8364,image:8465,weierp:8472,real:8476,trade:8482,alefsym:8501,larr:8592,uarr:8593,rarr:8594,darr:8595,harr:8596,crarr:8629,lArr:8656,uArr:8657,rArr:8658,dArr:8659,hArr:8660,forall:8704,part:8706,exist:8707,empty:8709,nabla:8711,isin:8712,notin:8713,ni:8715,prod:8719,sum:8721,minus:8722,lowast:8727,radic:8730,prop:8733,infin:8734,ang:8736,and:8743,or:8744,cap:8745,cup:8746,int:8747,there4:8756,sim:8764,cong:8773,asymp:8776,ne:8800,equiv:8801,le:8804,ge:8805,sub:8834,sup:8835,nsub:8836,sube:8838,supe:8839,oplus:8853,otimes:8855,perp:8869,sdot:8901,lceil:8968,rceil:8969,lfloor:8970,rfloor:8971,lang:9001,rang:9002,loz:9674,spades:9824,clubs:9827,hearts:9829,diams:9830},(0,s.default)(n.ENTITIES).forEach((function(t){var e=n.ENTITIES[t],r="number"==typeof e?String.fromCharCode(e):e;n.ENTITIES[t]=r})),n.STATE)n.STATE[n.STATE[O]]=O;function R(t,e,n){t[e]&&t[e](n)}function A(t,e,n){t.textNode&&D(t),R(t,e,n)}function D(t){t.textNode=N(t.opt,t.textNode),t.textNode&&R(t,"ontext",t.textNode),t.textNode=""}function N(t,e){return t.trim&&(e=e.trim()),t.normalize&&(e=e.replace(/\s+/g," ")),e}function P(t,e){return D(t),t.trackPosition&&(e+="\nLine: "+t.line+"\nColumn: "+t.column+"\nChar: "+t.c),e=new Error(e),t.error=e,R(t,"onerror",e),t}function M(t){return t.sawRoot&&!t.closedRoot&&j(t,"Unclosed root tag"),t.state!==I.BEGIN&&t.state!==I.BEGIN_WHITESPACE&&t.state!==I.TEXT&&P(t,"Unexpected end"),D(t),t.c="",t.closed=!0,R(t,"onend"),f.call(t,t.strict,t.opt),t}function j(t,e){if("object"!==(void 0===t?"undefined":(0,i.default)(t))||!(t instanceof f))throw new Error("bad call to strictFail");t.strict&&P(t,e)}function F(t){t.strict||(t.tagName=t.tagName[t.looseCase]());var e=t.tags[t.tags.length-1]||t,n=t.tag={name:t.tagName,attributes:{}};t.opt.xmlns&&(n.ns=e.ns),t.attribList.length=0,A(t,"onopentagstart",n)}function B(t,e){var n=t.indexOf(":")<0?["",t]:t.split(":"),r=n[0],o=n[1];return e&&"xmlns"===t&&(r="xmlns",o=""),{prefix:r,local:o}}function L(t){if(t.strict||(t.attribName=t.attribName[t.looseCase]()),-1!==t.attribList.indexOf(t.attribName)||t.tag.attributes.hasOwnProperty(t.attribName))t.attribName=t.attribValue="";else{if(t.opt.xmlns){var e=B(t.attribName,!0),n=e.prefix,r=e.local;if("xmlns"===n)if("xml"===r&&t.attribValue!==d)j(t,"xml: prefix must be bound to "+d+"\nActual: "+t.attribValue);else if("xmlns"===r&&"http://www.w3.org/2000/xmlns/"!==t.attribValue)j(t,"xmlns: prefix must be bound to http://www.w3.org/2000/xmlns/\nActual: "+t.attribValue);else{var o=t.tag,i=t.tags[t.tags.length-1]||t;o.ns===i.ns&&(o.ns=(0,u.default)(i.ns)),o.ns[r]=t.attribValue}t.attribList.push([t.attribName,t.attribValue])}else t.tag.attributes[t.attribName]=t.attribValue,A(t,"onattribute",{name:t.attribName,value:t.attribValue});t.attribName=t.attribValue=""}}function U(t,e){if(t.opt.xmlns){var n=t.tag,r=B(t.tagName);n.prefix=r.prefix,n.local=r.local,n.uri=n.ns[r.prefix]||"",n.prefix&&!n.uri&&(j(t,"Unbound namespace prefix: "+(0,o.default)(t.tagName)),n.uri=r.prefix);var i=t.tags[t.tags.length-1]||t;n.ns&&i.ns!==n.ns&&(0,s.default)(n.ns).forEach((function(e){A(t,"onopennamespace",{prefix:e,uri:n.ns[e]})}));for(var a=0,u=t.attribList.length;a<u;a++){var c=t.attribList[a],l=c[0],f=c[1],h=B(l,!0),p=h.prefix,d=h.local,m=""===p?"":n.ns[p]||"",v={name:l,value:f,prefix:p,local:d,uri:m};p&&"xmlns"!==p&&!m&&(j(t,"Unbound namespace prefix: "+(0,o.default)(p)),v.uri=p),t.tag.attributes[l]=v,A(t,"onattribute",v)}t.attribList.length=0}t.tag.isSelfClosing=!!e,t.sawRoot=!0,t.tags.push(t.tag),A(t,"onopentag",t.tag),e||(t.noscript||"script"!==t.tagName.toLowerCase()?t.state=I.TEXT:t.state=I.SCRIPT,t.tag=null,t.tagName=""),t.attribName=t.attribValue="",t.attribList.length=0}function W(t){if(!t.tagName)return j(t,"Weird empty close tag."),t.textNode+="</>",void(t.state=I.TEXT);if(t.script){if("script"!==t.tagName)return t.script+="</"+t.tagName+">",t.tagName="",void(t.state=I.SCRIPT);A(t,"onscript",t.script),t.script=""}var e=t.tags.length,n=t.tagName;t.strict||(n=n[t.looseCase]());for(var r=n;e--&&t.tags[e].name!==r;)j(t,"Unexpected close tag");if(e<0)return j(t,"Unmatched closing tag: "+t.tagName),t.textNode+="</"+t.tagName+">",void(t.state=I.TEXT);t.tagName=n;for(var o=t.tags.length;o-- >e;){var i=t.tag=t.tags.pop();t.tagName=t.tag.name,A(t,"onclosetag",t.tagName);var a={};for(var u in i.ns)a[u]=i.ns[u];var c=t.tags[t.tags.length-1]||t;t.opt.xmlns&&i.ns!==c.ns&&(0,s.default)(i.ns).forEach((function(e){var n=i.ns[e];A(t,"onclosenamespace",{prefix:e,uri:n})}))}0===e&&(t.closedRoot=!0),t.tagName=t.attribValue=t.attribName="",t.attribList.length=0,t.state=I.TEXT}function z(t){var e,n=t.entity,o=n.toLowerCase(),i="";return t.ENTITIES[n]?t.ENTITIES[n]:t.ENTITIES[o]?t.ENTITIES[o]:("#"===(n=o).charAt(0)&&("x"===n.charAt(1)?(n=n.slice(2),i=(e=parseInt(n,16)).toString(16)):(n=n.slice(1),i=(e=parseInt(n,10)).toString(10))),n=n.replace(/^0+/,""),isNaN(e)||i.toLowerCase()!==n?(j(t,"Invalid character entity"),"&"+t.entity+";"):(0,r.default)(e))}function V(t,e){"<"===e?(t.state=I.OPEN_WAKA,t.startTagPosition=t.position):w(e)||(j(t,"Non-whitespace before first tag."),t.textNode=e,t.state=I.TEXT)}function q(t,e){var n="";return e<t.length&&(n=t.charAt(e)),n}I=n.STATE,r.default||(S=String.fromCharCode,k=Math.floor,T=function(){var t,e,n=16384,r=[],o=-1,i=arguments.length;if(!i)return"";for(var a="";++o<i;){var s=Number(arguments[o]);if(!isFinite(s)||s<0||s>1114111||k(s)!==s)throw RangeError("Invalid code point: "+s);s<=65535?r.push(s):(t=55296+((s-=65536)>>10),e=s%1024+56320,r.push(t,e)),(o+1===i||r.length>n)&&(a+=S.apply(null,r),r.length=0)}return a},a.default?Object.defineProperty(String,"fromCodePoint",{value:T,configurable:!0,writable:!0}):String.fromCodePoint=T)}(void 0===n?(void 0).sax={}:n)}).call(this,t("buffer").Buffer)},{"babel-runtime/core-js/json/stringify":53,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/define-property":56,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/string/from-code-point":63,"babel-runtime/helpers/typeof":67,buffer:73,stream:230,string_decoder:72}],230:[function(t,e,n){e.exports=o;var r=t("events").EventEmitter;function o(){r.call(this)}t("inherits")(o,r),o.Readable=t("readable-stream/readable.js"),o.Writable=t("readable-stream/writable.js"),o.Duplex=t("readable-stream/duplex.js"),o.Transform=t("readable-stream/transform.js"),o.PassThrough=t("readable-stream/passthrough.js"),o.Stream=o,o.prototype.pipe=function(t,e){var n=this;function o(e){t.writable&&!1===t.write(e)&&n.pause&&n.pause()}function i(){n.readable&&n.resume&&n.resume()}n.on("data",o),t.on("drain",i),t._isStdio||e&&!1===e.end||(n.on("end",s),n.on("close",u));var a=!1;function s(){a||(a=!0,t.end())}function u(){a||(a=!0,"function"==typeof t.destroy&&t.destroy())}function c(t){if(l(),0===r.listenerCount(this,"error"))throw t}function l(){n.removeListener("data",o),t.removeListener("drain",i),n.removeListener("end",s),n.removeListener("close",u),n.removeListener("error",c),t.removeListener("error",c),n.removeListener("end",l),n.removeListener("close",l),t.removeListener("close",l)}return n.on("error",c),t.on("error",c),n.on("end",l),n.on("close",l),t.on("close",l),t.emit("pipe",n),t}},{events:192,inherits:196,"readable-stream/duplex.js":213,"readable-stream/passthrough.js":222,"readable-stream/readable.js":223,"readable-stream/transform.js":224,"readable-stream/writable.js":225}],231:[function(t,e,n){(function(e){var r=t("./lib/request"),o=t("./lib/response"),i=t("xtend"),a=t("builtin-status-codes"),s=t("url"),u=n;u.request=function(t,n){t="string"==typeof t?s.parse(t):i(t);var o=-1===e.location.protocol.search(/^https?:$/)?"http:":"",a=t.protocol||o,u=t.hostname||t.host,c=t.port,l=t.path||"/";u&&-1!==u.indexOf(":")&&(u="["+u+"]"),t.url=(u?a+"//"+u:"")+(c?":"+c:"")+l,t.method=(t.method||"GET").toUpperCase(),t.headers=t.headers||{};var f=new r(t);return n&&f.on("response",n),f},u.get=function(t,e){var n=u.request(t,e);return n.end(),n},u.ClientRequest=r,u.IncomingMessage=o.IncomingMessage,u.Agent=function(){},u.Agent.defaultMaxSockets=4,u.globalAgent=new u.Agent,u.STATUS_CODES=a,u.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]}).call(this,void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./lib/request":233,"./lib/response":234,"builtin-status-codes":74,url:238,xtend:283}],232:[function(t,e,n){(function(t){"use strict";n.fetch=s(t.fetch)&&s(t.ReadableStream),n.writableStream=s(t.WritableStream),n.abortController=s(t.AbortController),n.blobConstructor=!1;try{new Blob([new ArrayBuffer(1)]),n.blobConstructor=!0}catch(t){}var e;function r(){if(void 0!==e)return e;if(t.XMLHttpRequest){e=new t.XMLHttpRequest;try{e.open("GET",t.XDomainRequest?"/":"https://example.com")}catch(t){e=null}}else e=null;return e}function o(t){var e=r();if(!e)return!1;try{return e.responseType=t,e.responseType===t}catch(t){}return!1}var i=void 0!==t.ArrayBuffer,a=i&&s(t.ArrayBuffer.prototype.slice);function s(t){return"function"==typeof t}n.arraybuffer=n.fetch||i&&o("arraybuffer"),n.msstream=!n.fetch&&a&&o("ms-stream"),n.mozchunkedarraybuffer=!n.fetch&&i&&o("moz-chunked-arraybuffer"),n.overrideMimeType=n.fetch||!!r()&&s(r().overrideMimeType),n.vbArray=s(t.VBArray),e=null}).call(this,void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],233:[function(t,e,n){(function(n,r,o){"use strict";var i,a=t("babel-runtime/core-js/object/keys"),s=(i=a)&&i.__esModule?i:{default:i},u=t("./capability"),c=t("inherits"),l=t("./response"),f=t("readable-stream"),h=t("to-arraybuffer"),p=l.IncomingMessage,d=l.readyStates,m=e.exports=function(t){var e,n=this;f.Writable.call(n),n._opts=t,n._body=[],n._headers={},t.auth&&n.setHeader("Authorization","Basic "+new o(t.auth).toString("base64")),(0,s.default)(t.headers).forEach((function(e){n.setHeader(e,t.headers[e])}));var r=!0;if("disable-fetch"===t.mode||"requestTimeout"in t&&!u.abortController)r=!1,e=!0;else if("prefer-streaming"===t.mode)e=!1;else if("allow-wrong-content-type"===t.mode)e=!u.overrideMimeType;else{if(t.mode&&"default"!==t.mode&&"prefer-fast"!==t.mode)throw new Error("Invalid value for opts.mode");e=!0}n._mode=function(t,e){return u.fetch&&e?"fetch":u.mozchunkedarraybuffer?"moz-chunked-arraybuffer":u.msstream?"ms-stream":u.arraybuffer&&t?"arraybuffer":u.vbArray&&t?"text:vbarray":"text"}(e,r),n._fetchTimer=null,n.on("finish",(function(){n._onFinish()}))};c(m,f.Writable),m.prototype.setHeader=function(t,e){var n=t.toLowerCase();-1===v.indexOf(n)&&(this._headers[n]={name:t,value:e})},m.prototype.getHeader=function(t){var e=this._headers[t.toLowerCase()];return e?e.value:null},m.prototype.removeHeader=function(t){delete this._headers[t.toLowerCase()]},m.prototype._onFinish=function(){var t=this;if(!t._destroyed){var e=t._opts,i=t._headers,a=null;"GET"!==e.method&&"HEAD"!==e.method&&(a=u.arraybuffer?h(o.concat(t._body)):u.blobConstructor?new r.Blob(t._body.map((function(t){return h(t)})),{type:(i["content-type"]||{}).value||""}):o.concat(t._body).toString());var c=[];if((0,s.default)(i).forEach((function(t){var e=i[t].name,n=i[t].value;Array.isArray(n)?n.forEach((function(t){c.push([e,t])})):c.push([e,n])})),"fetch"===t._mode){var l=null;if(u.abortController){var f=new AbortController;l=f.signal,t._fetchAbortController=f,"requestTimeout"in e&&0!==e.requestTimeout&&(t._fetchTimer=r.setTimeout((function(){t.emit("requestTimeout"),t._fetchAbortController&&t._fetchAbortController.abort()}),e.requestTimeout))}r.fetch(t._opts.url,{method:t._opts.method,headers:c,body:a||void 0,mode:"cors",credentials:e.withCredentials?"include":"same-origin",signal:l}).then((function(e){t._fetchResponse=e,t._connect()}),(function(e){r.clearTimeout(t._fetchTimer),t._destroyed||t.emit("error",e)}))}else{var p=t._xhr=new r.XMLHttpRequest;try{p.open(t._opts.method,t._opts.url,!0)}catch(e){return void n.nextTick((function(){t.emit("error",e)}))}"responseType"in p&&(p.responseType=t._mode.split(":")[0]),"withCredentials"in p&&(p.withCredentials=!!e.withCredentials),"text"===t._mode&&"overrideMimeType"in p&&p.overrideMimeType("text/plain; charset=x-user-defined"),"requestTimeout"in e&&(p.timeout=e.requestTimeout,p.ontimeout=function(){t.emit("requestTimeout")}),c.forEach((function(t){p.setRequestHeader(t[0],t[1])})),t._response=null,p.onreadystatechange=function(){switch(p.readyState){case d.LOADING:case d.DONE:t._onXHRProgress()}},"moz-chunked-arraybuffer"===t._mode&&(p.onprogress=function(){t._onXHRProgress()}),p.onerror=function(){t._destroyed||t.emit("error",new Error("XHR error"))};try{p.send(a)}catch(e){return void n.nextTick((function(){t.emit("error",e)}))}}}},m.prototype._onXHRProgress=function(){(function(t){try{var e=t.status;return null!==e&&0!==e}catch(t){return!1}})(this._xhr)&&!this._destroyed&&(this._response||this._connect(),this._response._onXHRProgress())},m.prototype._connect=function(){var t=this;t._destroyed||(t._response=new p(t._xhr,t._fetchResponse,t._mode,t._fetchTimer),t._response.on("error",(function(e){t.emit("error",e)})),t.emit("response",t._response))},m.prototype._write=function(t,e,n){this._body.push(t),n()},m.prototype.abort=m.prototype.destroy=function(){this._destroyed=!0,r.clearTimeout(this._fetchTimer),this._response&&(this._response._destroyed=!0),this._xhr?this._xhr.abort():this._fetchAbortController&&this._fetchAbortController.abort()},m.prototype.end=function(t,e,n){"function"==typeof t&&(n=t,t=void 0),f.Writable.prototype.end.call(this,t,e,n)},m.prototype.flushHeaders=function(){},m.prototype.setTimeout=function(){},m.prototype.setNoDelay=function(){},m.prototype.setSocketKeepAlive=function(){};var v=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","date","dnt","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"]}).call(this,t("_process"),void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"./capability":232,"./response":234,_process:208,"babel-runtime/core-js/object/keys":60,buffer:73,inherits:196,"readable-stream":223,"to-arraybuffer":237}],234:[function(t,e,n){(function(e,r,o){"use strict";var i,a=t("babel-runtime/core-js/promise"),s=(i=a)&&i.__esModule?i:{default:i},u=t("./capability"),c=t("inherits"),l=t("readable-stream"),f=n.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},h=n.IncomingMessage=function(t,n,i,a){var c=this;if(l.Readable.call(c),c._mode=i,c.headers={},c.rawHeaders=[],c.trailers={},c.rawTrailers=[],c.on("end",(function(){e.nextTick((function(){c.emit("close")}))})),"fetch"===i){if(c._fetchResponse=n,c.url=n.url,c.statusCode=n.status,c.statusMessage=n.statusText,n.headers.forEach((function(t,e){c.headers[e.toLowerCase()]=t,c.rawHeaders.push(e,t)})),u.writableStream){var f=new WritableStream({write:function(t){return new s.default((function(e,n){c._destroyed?n():c.push(new o(t))?e():c._resumeFetch=e}))},close:function(){r.clearTimeout(a),c._destroyed||c.push(null)},abort:function(t){c._destroyed||c.emit("error",t)}});try{return void n.body.pipeTo(f).catch((function(t){r.clearTimeout(a),c._destroyed||c.emit("error",t)}))}catch(t){}}var h=n.body.getReader();!function t(){h.read().then((function(e){if(!c._destroyed){if(e.done)return r.clearTimeout(a),void c.push(null);c.push(new o(e.value)),t()}})).catch((function(t){r.clearTimeout(a),c._destroyed||c.emit("error",t)}))}()}else if(c._xhr=t,c._pos=0,c.url=t.responseURL,c.statusCode=t.status,c.statusMessage=t.statusText,t.getAllResponseHeaders().split(/\r?\n/).forEach((function(t){var e=t.match(/^([^:]+):\s*(.*)/);if(e){var n=e[1].toLowerCase();"set-cookie"===n?(void 0===c.headers[n]&&(c.headers[n]=[]),c.headers[n].push(e[2])):void 0!==c.headers[n]?c.headers[n]+=", "+e[2]:c.headers[n]=e[2],c.rawHeaders.push(e[1],e[2])}})),c._charset="x-user-defined",!u.overrideMimeType){var p=c.rawHeaders["mime-type"];if(p){var d=p.match(/;\s*charset=([^;])(;|$)/);d&&(c._charset=d[1].toLowerCase())}c._charset||(c._charset="utf-8")}};c(h,l.Readable),h.prototype._read=function(){var t=this._resumeFetch;t&&(this._resumeFetch=null,t())},h.prototype._onXHRProgress=function(){var t=this,e=t._xhr,n=null;switch(t._mode){case"text:vbarray":if(e.readyState!==f.DONE)break;try{n=new r.VBArray(e.responseBody).toArray()}catch(t){}if(null!==n){t.push(new o(n));break}case"text":try{n=e.responseText}catch(e){t._mode="text:vbarray";break}if(n.length>t._pos){var i=n.substr(t._pos);if("x-user-defined"===t._charset){for(var a=new o(i.length),s=0;s<i.length;s++)a[s]=255&i.charCodeAt(s);t.push(a)}else t.push(i,t._charset);t._pos=n.length}break;case"arraybuffer":if(e.readyState!==f.DONE||!e.response)break;n=e.response,t.push(new o(new Uint8Array(n)));break;case"moz-chunked-arraybuffer":if(n=e.response,e.readyState!==f.LOADING||!n)break;t.push(new o(new Uint8Array(n)));break;case"ms-stream":if(n=e.response,e.readyState!==f.LOADING)break;var u=new r.MSStreamReader;u.onprogress=function(){u.result.byteLength>t._pos&&(t.push(new o(new Uint8Array(u.result.slice(t._pos)))),t._pos=u.result.byteLength)},u.onload=function(){t.push(null)},u.readAsArrayBuffer(n)}t._xhr.readyState===f.DONE&&"ms-stream"!==t._mode&&t.push(null)}}).call(this,t("_process"),void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},t("buffer").Buffer)},{"./capability":232,_process:208,"babel-runtime/core-js/promise":61,buffer:73,inherits:196,"readable-stream":223}],235:[function(t,e,n){"use strict";var r=t("safe-buffer").Buffer,o=r.isEncoding||function(t){switch((t=""+t)&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(t){var e;switch(this.encoding=function(t){var e=function(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}(t);if("string"!=typeof e&&(r.isEncoding===o||!o(t)))throw new Error("Unknown encoding: "+t);return e||t}(t),this.encoding){case"utf16le":this.text=u,this.end=c,e=4;break;case"utf8":this.fillLast=s,e=4;break;case"base64":this.text=l,this.end=f,e=3;break;default:return this.write=h,void(this.end=p)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(e)}function a(t){return t<=127?0:t>>5==6?2:t>>4==14?3:t>>3==30?4:t>>6==2?-1:-2}function s(t){var e=this.lastTotal-this.lastNeed,n=function(t,e,n){if(128!=(192&e[0]))return t.lastNeed=0,"<22>";if(t.lastNeed>1&&e.length>1){if(128!=(192&e[1]))return t.lastNeed=1,"<22>";if(t.lastNeed>2&&e.length>2&&128!=(192&e[2]))return t.lastNeed=2,"<22>"}}(this,t);return void 0!==n?n:this.lastNeed<=t.length?(t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(t.copy(this.lastChar,e,0,t.length),void(this.lastNeed-=t.length))}function u(t,e){if((t.length-e)%2==0){var n=t.toString("utf16le",e);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function c(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,n)}return e}function l(t,e){var n=(t.length-e)%3;return 0===n?t.toString("base64",e):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-n))}function f(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function h(t){return t.toString(this.encoding)}function p(t){return t&&t.length?this.write(t):""}n.StringDecoder=i,i.prototype.write=function(t){if(0===t.length)return"";var e,n;if(this.lastNeed){if(void 0===(e=this.fillLast(t)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n<t.length?e?e+this.text(t,n):this.text(t,n):e||""},i.prototype.end=function(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"<22>":e},i.prototype.text=function(t,e){var n=function(t,e,n){var r=e.length-1;if(r<n)return 0;var o=a(e[r]);return o>=0?(o>0&&(t.lastNeed=o-1),o):--r<n||-2===o?0:(o=a(e[r]))>=0?(o>0&&(t.lastNeed=o-2),o):--r<n||-2===o?0:(o=a(e[r]))>=0?(o>0&&(2===o?o=0:t.lastNeed=o-3),o):0}(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=n;var r=t.length-(n-this.lastNeed);return t.copy(this.lastChar,0,r),t.toString("utf8",e,r)},i.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length}},{"safe-buffer":228}],236:[function(t,e,n){(function(e,r){var o=t("process/browser.js").nextTick,i=Function.prototype.apply,a=Array.prototype.slice,s={},u=0;function c(t,e){this._id=t,this._clearFn=e}n.setTimeout=function(){return new c(i.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new c(i.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(t){t.close()},c.prototype.unref=c.prototype.ref=function(){},c.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},n.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},n._unrefActive=n.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n.setImmediate="function"==typeof e?e:function(t){var e=u++,r=!(arguments.length<2)&&a.call(arguments,1);return s[e]=!0,o((function(){s[e]&&(r?t.apply(null,r):t.call(null),n.clearImmediate(e))})),e},n.clearImmediate="function"==typeof r?r:function(t){delete s[t]}}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":208,timers:236}],237:[function(t,e,n){var r=t("buffer").Buffer;e.exports=function(t){if(t instanceof Uint8Array){if(0===t.byteOffset&&t.byteLength===t.buffer.byteLength)return t.buffer;if("function"==typeof t.buffer.slice)return t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}if(r.isBuffer(t)){for(var e=new Uint8Array(t.length),n=t.length,o=0;o<n;o++)e[o]=t[o];return e.buffer}throw new Error("Argument must be a Buffer")}},{buffer:73}],238:[function(t,e,n){"use strict";var r=t("punycode"),o=t("./util");function i(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}n.parse=b,n.resolve=function(t,e){return b(t,!1,!0).resolve(e)},n.resolveObject=function(t,e){return t?b(t,!1,!0).resolveObject(e):e},n.format=function(t){return o.isString(t)&&(t=b(t)),t instanceof i?t.format():i.prototype.format.call(t)},n.Url=i;var a=/^([a-z0-9.+-]+:)/i,s=/:[0-9]*$/,u=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,c=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),l=["'"].concat(c),f=["%","/","?",";","#"].concat(l),h=["/","?","#"],p=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,m={javascript:!0,"javascript:":!0},v={javascript:!0,"javascript:":!0},g={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=t("querystring");function b(t,e,n){if(t&&o.isObject(t)&&t instanceof i)return t;var r=new i;return r.parse(t,e,n),r}i.prototype.parse=function(t,e,n){if(!o.isString(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),s=-1!==i&&i<t.indexOf("#")?"?":"#",c=t.split(s);c[0]=c[0].replace(/\\/g,"/");var b=t=c.join(s);if(b=b.trim(),!n&&1===t.split("#").length){var w=u.exec(b);if(w)return this.path=b,this.href=b,this.pathname=w[1],w[2]?(this.search=w[2],this.query=e?y.parse(this.search.substr(1)):this.search.substr(1)):e&&(this.search="",this.query={}),this}var x=a.exec(b);if(x){var _=(x=x[0]).toLowerCase();this.protocol=_,b=b.substr(x.length)}if(n||x||b.match(/^\/\/[^@\/]+@[^@\/]+/)){var E="//"===b.substr(0,2);!E||x&&v[x]||(b=b.substr(2),this.slashes=!0)}if(!v[x]&&(E||x&&!g[x])){for(var C,S,k=-1,T=0;T<h.length;T++)-1!==(I=b.indexOf(h[T]))&&(-1===k||I<k)&&(k=I);for(-1!==(S=-1===k?b.lastIndexOf("@"):b.lastIndexOf("@",k))&&(C=b.slice(0,S),b=b.slice(S+1),this.auth=decodeURIComponent(C)),k=-1,T=0;T<f.length;T++){var I;-1!==(I=b.indexOf(f[T]))&&(-1===k||I<k)&&(k=I)}-1===k&&(k=b.length),this.host=b.slice(0,k),b=b.slice(k),this.parseHost(),this.hostname=this.hostname||"";var O="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!O)for(var R=this.hostname.split(/\./),A=(T=0,R.length);T<A;T++){var D=R[T];if(D&&!D.match(p)){for(var N="",P=0,M=D.length;P<M;P++)D.charCodeAt(P)>127?N+="x":N+=D[P];if(!N.match(p)){var j=R.slice(0,T),F=R.slice(T+1),B=D.match(d);B&&(j.push(B[1]),F.unshift(B[2])),F.length&&(b="/"+F.join(".")+b),this.hostname=j.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),O||(this.hostname=r.toASCII(this.hostname));var L=this.port?":"+this.port:"",U=this.hostname||"";this.host=U+L,this.href+=this.host,O&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==b[0]&&(b="/"+b))}if(!m[_])for(T=0,A=l.length;T<A;T++){var W=l[T];if(-1!==b.indexOf(W)){var z=encodeURIComponent(W);z===W&&(z=escape(W)),b=b.split(W).join(z)}}var V=b.indexOf("#");-1!==V&&(this.hash=b.substr(V),b=b.slice(0,V));var q=b.indexOf("?");if(-1!==q?(this.search=b.substr(q),this.query=b.substr(q+1),e&&(this.query=y.parse(this.query)),b=b.slice(0,q)):e&&(this.search="",this.query={}),b&&(this.pathname=b),g[_]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){L=this.pathname||"";var G=this.search||"";this.path=L+G}return this.href=this.format(),this},i.prototype.format=function(){var t=this.auth||"";t&&(t=(t=encodeURIComponent(t)).replace(/%3A/i,":"),t+="@");var e=this.protocol||"",n=this.pathname||"",r=this.hash||"",i=!1,a="";this.host?i=t+this.host:this.hostname&&(i=t+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(i+=":"+this.port)),this.query&&o.isObject(this.query)&&Object.keys(this.query).length&&(a=y.stringify(this.query));var s=this.search||a&&"?"+a||"";return e&&":"!==e.substr(-1)&&(e+=":"),this.slashes||(!e||g[e])&&!1!==i?(i="//"+(i||""),n&&"/"!==n.charAt(0)&&(n="/"+n)):i||(i=""),r&&"#"!==r.charAt(0)&&(r="#"+r),s&&"?"!==s.charAt(0)&&(s="?"+s),e+i+(n=n.replace(/[?#]/g,(function(t){return encodeURIComponent(t)})))+(s=s.replace("#","%23"))+r},i.prototype.resolve=function(t){return this.resolveObject(b(t,!1,!0)).format()},i.prototype.resolveObject=function(t){if(o.isString(t)){var e=new i;e.parse(t,!1,!0),t=e}for(var n=new i,r=Object.keys(this),a=0;a<r.length;a++){var s=r[a];n[s]=this[s]}if(n.hash=t.hash,""===t.href)return n.href=n.format(),n;if(t.slashes&&!t.protocol){for(var u=Object.keys(t),c=0;c<u.length;c++){var l=u[c];"protocol"!==l&&(n[l]=t[l])}return g[n.protocol]&&n.hostname&&!n.pathname&&(n.path=n.pathname="/"),n.href=n.format(),n}if(t.protocol&&t.protocol!==n.protocol){if(!g[t.protocol]){for(var f=Object.keys(t),h=0;h<f.length;h++){var p=f[h];n[p]=t[p]}return n.href=n.format(),n}if(n.protocol=t.protocol,t.host||v[t.protocol])n.pathname=t.pathname;else{for(var d=(t.pathname||"").split("/");d.length&&!(t.host=d.shift()););t.host||(t.host=""),t.hostname||(t.hostname=""),""!==d[0]&&d.unshift(""),d.length<2&&d.unshift(""),n.pathname=d.join("/")}if(n.search=t.search,n.query=t.query,n.host=t.host||"",n.auth=t.auth,n.hostname=t.hostname||t.host,n.port=t.port,n.pathname||n.search){var m=n.pathname||"",y=n.search||"";n.path=m+y}return n.slashes=n.slashes||t.slashes,n.href=n.format(),n}var b=n.pathname&&"/"===n.pathname.charAt(0),w=t.host||t.pathname&&"/"===t.pathname.charAt(0),x=w||b||n.host&&t.pathname,_=x,E=n.pathname&&n.pathname.split("/")||[],C=(d=t.pathname&&t.pathname.split("/")||[],n.protocol&&!g[n.protocol]);if(C&&(n.hostname="",n.port=null,n.host&&(""===E[0]?E[0]=n.host:E.unshift(n.host)),n.host="",t.protocol&&(t.hostname=null,t.port=null,t.host&&(""===d[0]?d[0]=t.host:d.unshift(t.host)),t.host=null),x=x&&(""===d[0]||""===E[0])),w)n.host=t.host||""===t.host?t.host:n.host,n.hostname=t.hostname||""===t.hostname?t.hostname:n.hostname,n.search=t.search,n.query=t.query,E=d;else if(d.length)E||(E=[]),E.pop(),E=E.concat(d),n.search=t.search,n.query=t.query;else if(!o.isNullOrUndefined(t.search))return C&&(n.hostname=n.host=E.shift(),(O=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=O.shift(),n.host=n.hostname=O.shift())),n.search=t.search,n.query=t.query,o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.href=n.format(),n;if(!E.length)return n.pathname=null,n.search?n.path="/"+n.search:n.path=null,n.href=n.format(),n;for(var S=E.slice(-1)[0],k=(n.host||t.host||E.length>1)&&("."===S||".."===S)||""===S,T=0,I=E.length;I>=0;I--)"."===(S=E[I])?E.splice(I,1):".."===S?(E.splice(I,1),T++):T&&(E.splice(I,1),T--);if(!x&&!_)for(;T--;T)E.unshift("..");!x||""===E[0]||E[0]&&"/"===E[0].charAt(0)||E.unshift(""),k&&"/"!==E.join("/").substr(-1)&&E.push("");var O,R=""===E[0]||E[0]&&"/"===E[0].charAt(0);return C&&(n.hostname=n.host=R?"":E.length?E.shift():"",(O=!!(n.host&&n.host.indexOf("@")>0)&&n.host.split("@"))&&(n.auth=O.shift(),n.host=n.hostname=O.shift())),(x=x||n.host&&E.length)&&!R&&E.unshift(""),E.length?n.pathname=E.join("/"):(n.pathname=null,n.path=null),o.isNull(n.pathname)&&o.isNull(n.search)||(n.path=(n.pathname?n.pathname:"")+(n.search?n.search:"")),n.auth=t.auth||n.auth,n.slashes=n.slashes||t.slashes,n.href=n.format(),n},i.prototype.parseHost=function(){var t=this.host,e=s.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)}},{"./util":239,punycode:209,querystring:212}],239:[function(t,e,n){"use strict";e.exports={isString:function(t){return"string"==typeof t},isObject:function(t){return"object"==typeof t&&null!==t},isNull:function(t){return null===t},isNullOrUndefined:function(t){return null==t}}},{}],240:[function(t,e,n){(function(t){function n(e){try{if(!t.localStorage)return!1}catch(t){return!1}var n=t.localStorage[e];return null!=n&&"true"===String(n).toLowerCase()}e.exports=function(t,e){if(n("noDeprecation"))return t;var r=!1;return function(){if(!r){if(n("throwDeprecation"))throw new Error(e);n("traceDeprecation")?console.trace(e):console.warn(e),r=!0}return t.apply(this,arguments)}}}).call(this,void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],241:[function(t,e,n){"function"==typeof Object.create?e.exports=function(t,e){t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(t,e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}},{}],242:[function(t,e,n){e.exports=function(t){return t&&"object"==typeof t&&"function"==typeof t.copy&&"function"==typeof t.fill&&"function"==typeof t.readUInt8}},{}],243:[function(t,e,n){(function(e,r){var o=/%[sdj%]/g;n.format=function(t){if(!g(t)){for(var e=[],n=0;n<arguments.length;n++)e.push(s(arguments[n]));return e.join(" ")}n=1;for(var r=arguments,i=r.length,a=String(t).replace(o,(function(t){if("%%"===t)return"%";if(n>=i)return t;switch(t){case"%s":return String(r[n++]);case"%d":return Number(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch(t){return"[Circular]"}default:return t}})),u=r[n];n<i;u=r[++n])m(u)||!w(u)?a+=" "+u:a+=" "+s(u);return a},n.deprecate=function(t,o){if(y(r.process))return function(){return n.deprecate(t,o).apply(this,arguments)};if(!0===e.noDeprecation)return t;var i=!1;return function(){if(!i){if(e.throwDeprecation)throw new Error(o);e.traceDeprecation?console.trace(o):console.error(o),i=!0}return t.apply(this,arguments)}};var i,a={};function s(t,e){var r={seen:[],stylize:c};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(e)?r.showHidden=e:e&&n._extend(r,e),y(r.showHidden)&&(r.showHidden=!1),y(r.depth)&&(r.depth=2),y(r.colors)&&(r.colors=!1),y(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=u),l(r,t,r.depth)}function u(t,e){var n=s.styles[e];return n?"["+s.colors[n][0]+"m"+t+"["+s.colors[n][1]+"m":t}function c(t,e){return t}function l(t,e,r){if(t.customInspect&&e&&E(e.inspect)&&e.inspect!==n.inspect&&(!e.constructor||e.constructor.prototype!==e)){var o=e.inspect(r,t);return g(o)||(o=l(t,o,r)),o}var i=function(t,e){if(y(e))return t.stylize("undefined","undefined");if(g(e)){var n="'"+JSON.stringify(e).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return t.stylize(n,"string")}return v(e)?t.stylize(""+e,"number"):d(e)?t.stylize(""+e,"boolean"):m(e)?t.stylize("null","null"):void 0}(t,e);if(i)return i;var a=Object.keys(e),s=function(t){var e={};return t.forEach((function(t,n){e[t]=!0})),e}(a);if(t.showHidden&&(a=Object.getOwnPropertyNames(e)),_(e)&&(a.indexOf("message")>=0||a.indexOf("description")>=0))return f(e);if(0===a.length){if(E(e)){var u=e.name?": "+e.name:"";return t.stylize("[Function"+u+"]","special")}if(b(e))return t.stylize(RegExp.prototype.toString.call(e),"regexp");if(x(e))return t.stylize(Date.prototype.toString.call(e),"date");if(_(e))return f(e)}var c,w="",C=!1,S=["{","}"];return p(e)&&(C=!0,S=["[","]"]),E(e)&&(w=" [Function"+(e.name?": "+e.name:"")+"]"),b(e)&&(w=" "+RegExp.prototype.toString.call(e)),x(e)&&(w=" "+Date.prototype.toUTCString.call(e)),_(e)&&(w=" "+f(e)),0!==a.length||C&&0!=e.length?r<0?b(e)?t.stylize(RegExp.prototype.toString.call(e),"regexp"):t.stylize("[Object]","special"):(t.seen.push(e),c=C?function(t,e,n,r,o){for(var i=[],a=0,s=e.length;a<s;++a)I(e,String(a))?i.push(h(t,e,n,r,String(a),!0)):i.push("");return o.forEach((function(o){o.match(/^\d+$/)||i.push(h(t,e,n,r,o,!0))})),i}(t,e,r,s,a):a.map((function(n){return h(t,e,r,s,n,C)})),t.seen.pop(),function(t,e,n){return t.reduce((function(t,e){return e.indexOf("\n"),t+e.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60?n[0]+(""===e?"":e+"\n ")+" "+t.join(",\n ")+" "+n[1]:n[0]+e+" "+t.join(", ")+" "+n[1]}(c,w,S)):S[0]+w+S[1]}function f(t){return"["+Error.prototype.toString.call(t)+"]"}function h(t,e,n,r,o,i){var a,s,u;if((u=Object.getOwnPropertyDescriptor(e,o)||{value:e[o]}).get?s=u.set?t.stylize("[Getter/Setter]","special"):t.stylize("[Getter]","special"):u.set&&(s=t.stylize("[Setter]","special")),I(r,o)||(a="["+o+"]"),s||(t.seen.indexOf(u.value)<0?(s=m(n)?l(t,u.value,null):l(t,u.value,n-1)).indexOf("\n")>-1&&(s=i?s.split("\n").map((function(t){return" "+t})).join("\n").substr(2):"\n"+s.split("\n").map((function(t){return" "+t})).join("\n")):s=t.stylize("[Circular]","special")),y(a)){if(i&&o.match(/^\d+$/))return s;(a=JSON.stringify(""+o)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=t.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=t.stylize(a,"string"))}return a+": "+s}function p(t){return Array.isArray(t)}function d(t){return"boolean"==typeof t}function m(t){return null===t}function v(t){return"number"==typeof t}function g(t){return"string"==typeof t}function y(t){return void 0===t}function b(t){return w(t)&&"[object RegExp]"===C(t)}function w(t){return"object"==typeof t&&null!==t}function x(t){return w(t)&&"[object Date]"===C(t)}function _(t){return w(t)&&("[object Error]"===C(t)||t instanceof Error)}function E(t){return"function"==typeof t}function C(t){return Object.prototype.toString.call(t)}function S(t){return t<10?"0"+t.toString(10):t.toString(10)}n.debuglog=function(t){if(y(i)&&(i=e.env.NODE_DEBUG||""),t=t.toUpperCase(),!a[t])if(new RegExp("\\b"+t+"\\b","i").test(i)){var r=e.pid;a[t]=function(){var e=n.format.apply(n,arguments);console.error("%s %d: %s",t,r,e)}}else a[t]=function(){};return a[t]},n.inspect=s,s.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},s.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},n.isArray=p,n.isBoolean=d,n.isNull=m,n.isNullOrUndefined=function(t){return null==t},n.isNumber=v,n.isString=g,n.isSymbol=function(t){return"symbol"==typeof t},n.isUndefined=y,n.isRegExp=b,n.isObject=w,n.isDate=x,n.isError=_,n.isFunction=E,n.isPrimitive=function(t){return null===t||"boolean"==typeof t||"number"==typeof t||"string"==typeof t||"symbol"==typeof t||void 0===t},n.isBuffer=t("./support/isBuffer");var k=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var t=new Date,e=[S(t.getHours()),S(t.getMinutes()),S(t.getSeconds())].join(":");return[t.getDate(),k[t.getMonth()],e].join(" ")}function I(t,e){return Object.prototype.hasOwnProperty.call(t,e)}n.log=function(){console.log("%s - %s",T(),n.format.apply(n,arguments))},n.inherits=t("inherits"),n._extend=function(t,e){if(!e||!w(e))return t;for(var n=Object.keys(e),r=n.length;r--;)t[n[r]]=e[n[r]];return t}}).call(this,t("_process"),void 0!==global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":242,_process:208,inherits:241}],244:[function(t,e,n){"use strict";(function(){n.stripBOM=function(t){return"\ufeff"===t[0]?t.substring(1):t}}).call(void 0)},{}],245:[function(t,e,n){"use strict";var r=i(t("babel-runtime/helpers/typeof")),o=i(t("babel-runtime/core-js/object/keys"));function i(t){return t&&t.__esModule?t:{default:t}}(function(){var e,i,a,s,u,c={}.hasOwnProperty;e=t("xmlbuilder"),i=t("./defaults").defaults,s=function(t){return"string"==typeof t&&(t.indexOf("&")>=0||t.indexOf(">")>=0||t.indexOf("<")>=0)},u=function(t){return"<![CDATA["+a(t)+"]]>"},a=function(t){return t.replace("]]>","]]]]><![CDATA[>")},n.Builder=function(){function t(t){var e,n,r;for(e in this.options={},n=i[.2])c.call(n,e)&&(r=n[e],this.options[e]=r);for(e in t)c.call(t,e)&&(r=t[e],this.options[e]=r)}return t.prototype.buildObject=function(t){var n,a,l,f,h,p;return n=this.options.attrkey,a=this.options.charkey,1===(0,o.default)(t).length&&this.options.rootName===i[.2].rootName?t=t[h=(0,o.default)(t)[0]]:h=this.options.rootName,p=this,l=function(t,e){var o,i,f,h,d,m;if("object"!==(void 0===e?"undefined":(0,r.default)(e)))p.options.cdata&&s(e)?t.raw(u(e)):t.txt(e);else if(Array.isArray(e)){for(h in e)if(c.call(e,h))for(d in i=e[h])f=i[d],t=l(t.ele(d),f).up()}else for(d in e)if(c.call(e,d))if(i=e[d],d===n){if("object"===(void 0===i?"undefined":(0,r.default)(i)))for(o in i)m=i[o],t=t.att(o,m)}else if(d===a)t=p.options.cdata&&s(i)?t.raw(u(i)):t.txt(i);else if(Array.isArray(i))for(h in i)c.call(i,h)&&(t="string"==typeof(f=i[h])?p.options.cdata&&s(f)?t.ele(d).raw(u(f)).up():t.ele(d,f).up():l(t.ele(d),f).up());else"object"===(void 0===i?"undefined":(0,r.default)(i))?t=l(t.ele(d),i).up():"string"==typeof i&&p.options.cdata&&s(i)?t=t.ele(d).raw(u(i)).up():(null==i&&(i=""),t=t.ele(d,i.toString()).up());return t},f=e.create(h,this.options.xmldec,this.options.doctype,{headless:this.options.headless,allowSurrogateChars:this.options.allowSurrogateChars}),l(f,t).end(this.options.renderOpts)},t}()}).call(void 0)},{"./defaults":246,"babel-runtime/core-js/object/keys":60,"babel-runtime/helpers/typeof":67,xmlbuilder:282}],246:[function(t,e,n){"use strict";(function(){n.defaults={.1:{explicitCharkey:!1,trim:!0,normalize:!0,normalizeTags:!1,attrkey:"@",charkey:"#",explicitArray:!1,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!1,validator:null,xmlns:!1,explicitChildren:!1,childkey:"@@",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,emptyTag:""},.2:{explicitCharkey:!1,trim:!1,normalize:!1,normalizeTags:!1,attrkey:"$",charkey:"_",explicitArray:!0,ignoreAttrs:!1,mergeAttrs:!1,explicitRoot:!0,validator:null,xmlns:!1,explicitChildren:!1,preserveChildrenOrder:!1,childkey:"$$",charsAsChildren:!1,includeWhiteChars:!1,async:!1,strict:!0,attrNameProcessors:null,attrValueProcessors:null,tagNameProcessors:null,valueProcessors:null,rootName:"root",xmldec:{version:"1.0",encoding:"UTF-8",standalone:!0},doctype:null,renderOpts:{pretty:!0,indent:" ",newline:"\n"},headless:!1,chunkSize:1e4,emptyTag:"",cdata:!1}}}).call(void 0)},{}],247:[function(t,e,n){"use strict";var r=s(t("babel-runtime/core-js/promise")),o=s(t("babel-runtime/core-js/object/get-own-property-names")),i=s(t("babel-runtime/core-js/object/keys")),a=s(t("babel-runtime/helpers/typeof"));function s(t){return t&&t.__esModule?t:{default:t}}(function(){var e,s,u,c,l,f,h,p,d=function(t,e){return function(){return t.apply(e,arguments)}},m={}.hasOwnProperty;h=t("sax"),u=t("events"),e=t("./bom"),f=t("./processors"),p=t("timers").setImmediate,s=t("./defaults").defaults,c=function(t){return"object"===(void 0===t?"undefined":(0,a.default)(t))&&null!=t&&0===(0,i.default)(t).length},l=function(t,e,n){var r,o;for(r=0,o=t.length;r<o;r++)e=(0,t[r])(e,n);return e},n.Parser=function(t){function u(t){var e,r,o;if(this.parseStringPromise=d(this.parseStringPromise,this),this.parseString=d(this.parseString,this),this.reset=d(this.reset,this),this.assignOrPush=d(this.assignOrPush,this),this.processAsync=d(this.processAsync,this),!(this instanceof n.Parser))return new n.Parser(t);for(e in this.options={},r=s[.2])m.call(r,e)&&(o=r[e],this.options[e]=o);for(e in t)m.call(t,e)&&(o=t[e],this.options[e]=o);this.options.xmlns&&(this.options.xmlnskey=this.options.attrkey+"ns"),this.options.normalizeTags&&(this.options.tagNameProcessors||(this.options.tagNameProcessors=[]),this.options.tagNameProcessors.unshift(f.normalize)),this.reset()}return function(t,e){for(var n in e)m.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(u,t),u.prototype.processAsync=function(){var t,e;try{return this.remaining.length<=this.options.chunkSize?(t=this.remaining,this.remaining="",this.saxParser=this.saxParser.write(t),this.saxParser.close()):(t=this.remaining.substr(0,this.options.chunkSize),this.remaining=this.remaining.substr(this.options.chunkSize,this.remaining.length),this.saxParser=this.saxParser.write(t),p(this.processAsync))}catch(t){if(e=t,!this.saxParser.errThrown)return this.saxParser.errThrown=!0,this.emit(e)}},u.prototype.assignOrPush=function(t,e,n){return e in t?(t[e]instanceof Array||(t[e]=[t[e]]),t[e].push(n)):this.options.explicitArray?t[e]=[n]:t[e]=n},u.prototype.reset=function(){var t,e,n,r,s;return this.removeAllListeners(),this.saxParser=h.parser(this.options.strict,{trim:!1,normalize:!1,xmlns:this.options.xmlns}),this.saxParser.errThrown=!1,this.saxParser.onerror=(s=this,function(t){if(s.saxParser.resume(),!s.saxParser.errThrown)return s.saxParser.errThrown=!0,s.emit("error",t)}),this.saxParser.onend=function(t){return function(){if(!t.saxParser.ended)return t.saxParser.ended=!0,t.emit("end",t.resultObject)}}(this),this.saxParser.ended=!1,this.EXPLICIT_CHARKEY=this.options.explicitCharkey,this.resultObject=null,r=[],t=this.options.attrkey,e=this.options.charkey,this.saxParser.onopentag=function(n){return function(o){var i,a,s,u,c;if((s={})[e]="",!n.options.ignoreAttrs)for(i in c=o.attributes)m.call(c,i)&&(t in s||n.options.mergeAttrs||(s[t]={}),a=n.options.attrValueProcessors?l(n.options.attrValueProcessors,o.attributes[i],i):o.attributes[i],u=n.options.attrNameProcessors?l(n.options.attrNameProcessors,i):i,n.options.mergeAttrs?n.assignOrPush(s,u,a):s[t][u]=a);return s["#name"]=n.options.tagNameProcessors?l(n.options.tagNameProcessors,o.name):o.name,n.options.xmlns&&(s[n.options.xmlnskey]={uri:o.uri,local:o.local}),r.push(s)}}(this),this.saxParser.onclosetag=function(t){return function(){var n,s,u,f,h,p,d,v,g,y;if(p=r.pop(),h=p["#name"],t.options.explicitChildren&&t.options.preserveChildrenOrder||delete p["#name"],!0===p.cdata&&(n=p.cdata,delete p.cdata),g=r[r.length-1],p[e].match(/^\s*$/)&&!n?(s=p[e],delete p[e]):(t.options.trim&&(p[e]=p[e].trim()),t.options.normalize&&(p[e]=p[e].replace(/\s{2,}/g," ").trim()),p[e]=t.options.valueProcessors?l(t.options.valueProcessors,p[e],h):p[e],1===(0,i.default)(p).length&&e in p&&!t.EXPLICIT_CHARKEY&&(p=p[e])),c(p)&&(p=""!==t.options.emptyTag?t.options.emptyTag:s),null!=t.options.validator&&(y="/"+function(){var t,e,n;for(n=[],t=0,e=r.length;t<e;t++)f=r[t],n.push(f["#name"]);return n}().concat(h).join("/"),function(){var e;try{p=t.options.validator(y,g&&g[h],p)}catch(n){return e=n,t.emit("error",e)}}()),t.options.explicitChildren&&!t.options.mergeAttrs&&"object"===(void 0===p?"undefined":(0,a.default)(p)))if(t.options.preserveChildrenOrder){if(g){for(u in g[t.options.childkey]=g[t.options.childkey]||[],d={},p)m.call(p,u)&&(d[u]=p[u]);g[t.options.childkey].push(d),delete p["#name"],1===(0,i.default)(p).length&&e in p&&!t.EXPLICIT_CHARKEY&&(p=p[e])}}else f={},t.options.attrkey in p&&(f[t.options.attrkey]=p[t.options.attrkey],delete p[t.options.attrkey]),!t.options.charsAsChildren&&t.options.charkey in p&&(f[t.options.charkey]=p[t.options.charkey],delete p[t.options.charkey]),(0,o.default)(p).length>0&&(f[t.options.childkey]=p),p=f;return r.length>0?t.assignOrPush(g,h,p):(t.options.explicitRoot&&(v=p,(p={})[h]=v),t.resultObject=p,t.saxParser.ended=!0,t.emit("end",t.resultObject))}}(this),n=function(t){return function(n){var o,i;if(i=r[r.length-1])return i[e]+=n,t.options.explicitChildren&&t.options.preserveChildrenOrder&&t.options.charsAsChildren&&(t.options.includeWhiteChars||""!==n.replace(/\\n/g,"").trim())&&(i[t.options.childkey]=i[t.options.childkey]||[],(o={"#name":"__text__"})[e]=n,t.options.normalize&&(o[e]=o[e].replace(/\s{2,}/g," ").trim()),i[t.options.childkey].push(o)),i}}(this),this.saxParser.ontext=n,this.saxParser.oncdata=function(t){var e;if(e=n(t))return e.cdata=!0}},u.prototype.parseString=function(t,n){var r;null!=n&&"function"==typeof n&&(this.on("end",(function(t){return this.reset(),n(null,t)})),this.on("error",(function(t){return this.reset(),n(t)})));try{return""===(t=t.toString()).trim()?(this.emit("end",null),!0):(t=e.stripBOM(t),this.options.async?(this.remaining=t,p(this.processAsync),this.saxParser):this.saxParser.write(t).close())}catch(t){if(r=t,!this.saxParser.errThrown&&!this.saxParser.ended)return this.emit("error",r),this.saxParser.errThrown=!0;if(this.saxParser.ended)throw r}},u.prototype.parseStringPromise=function(t){return new r.default((e=this,function(n,r){return e.parseString(t,(function(t,e){return t?r(t):n(e)}))}));var e},u}(u),n.parseString=function(t,e,r){var o,i;return null!=r?("function"==typeof r&&(o=r),"object"===(void 0===e?"undefined":(0,a.default)(e))&&(i=e)):("function"==typeof e&&(o=e),i={}),new n.Parser(i).parseString(t,o)},n.parseStringPromise=function(t,e){var r;return"object"===(void 0===e?"undefined":(0,a.default)(e))&&(r=e),new n.Parser(r).parseStringPromise(t)}}).call(void 0)},{"./bom":244,"./defaults":246,"./processors":248,"babel-runtime/core-js/object/get-own-property-names":58,"babel-runtime/core-js/object/keys":60,"babel-runtime/core-js/promise":61,"babel-runtime/helpers/typeof":67,events:192,sax:229,timers:236}],248:[function(t,e,n){"use strict";(function(){var t;t=new RegExp(/(?!xmlns)^.*:/),n.normalize=function(t){return t.toLowerCase()},n.firstCharLowerCase=function(t){return t.charAt(0).toLowerCase()+t.slice(1)},n.stripPrefix=function(e){return e.replace(t,"")},n.parseNumbers=function(t){return isNaN(t)||(t=t%1==0?parseInt(t,10):parseFloat(t)),t},n.parseBooleans=function(t){return/^(?:true|false)$/i.test(t)&&(t="true"===t.toLowerCase()),t}}).call(void 0)},{}],249:[function(t,e,n){"use strict";(function(){var e,r,o,i,a={}.hasOwnProperty;r=t("./defaults"),e=t("./builder"),o=t("./parser"),i=t("./processors"),n.defaults=r.defaults,n.processors=i,n.ValidationError=function(t){function e(t){this.message=t}return function(t,e){for(var n in e)a.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,Error),e}(),n.Builder=e.Builder,n.Parser=o.Parser,n.parseString=o.parseString,n.parseStringPromise=o.parseStringPromise}).call(void 0)},{"./builder":245,"./defaults":246,"./parser":247,"./processors":248}],250:[function(t,e,n){"use strict";(function(){e.exports={Disconnected:1,Preceding:2,Following:4,Contains:8,ContainedBy:16,ImplementationSpecific:32}}).call(void 0)},{}],251:[function(t,e,n){"use strict";(function(){e.exports={Element:1,Attribute:2,Text:3,CData:4,EntityReference:5,EntityDeclaration:6,ProcessingInstruction:7,Comment:8,Document:9,DocType:10,DocumentFragment:11,NotationDeclaration:12,Declaration:201,Raw:202,AttributeDeclaration:203,ElementDeclaration:204,Dummy:205}}).call(void 0)},{}],252:[function(t,e,n){"use strict";var r=a(t("babel-runtime/core-js/object/get-prototype-of")),o=a(t("babel-runtime/helpers/typeof")),i=a(t("babel-runtime/core-js/object/assign"));function a(t){return t&&t.__esModule?t:{default:t}}(function(){var t,n,a,s,u,c,l,f=[].slice,h={}.hasOwnProperty;t=function(){var t,e,n,r,o,a;if(a=arguments[0],o=2<=arguments.length?f.call(arguments,1):[],u(i.default))i.default.apply(null,arguments);else for(t=0,n=o.length;t<n;t++)if(null!=(r=o[t]))for(e in r)h.call(r,e)&&(a[e]=r[e]);return a},u=function(t){return!!t&&"[object Function]"===Object.prototype.toString.call(t)},c=function(t){var e;return!!t&&("function"===(e=void 0===t?"undefined":(0,o.default)(t))||"object"===e)},a=function(t){return u(Array.isArray)?Array.isArray(t):"[object Array]"===Object.prototype.toString.call(t)},s=function(t){var e;if(a(t))return!t.length;for(e in t)if(h.call(t,e))return!1;return!0},l=function(t){var e,n;return c(t)&&(n=(0,r.default)(t))&&(e=n.constructor)&&"function"==typeof e&&e instanceof e&&Function.prototype.toString.call(e)===Function.prototype.toString.call(Object)},n=function(t){return u(t.valueOf)?t.valueOf():t},e.exports.assign=t,e.exports.isFunction=u,e.exports.isObject=c,e.exports.isArray=a,e.exports.isEmpty=s,e.exports.isPlainObject=l,e.exports.getValue=n}).call(void 0)},{"babel-runtime/core-js/object/assign":54,"babel-runtime/core-js/object/get-prototype-of":59,"babel-runtime/helpers/typeof":67}],253:[function(t,e,n){"use strict";(function(){e.exports={None:0,OpenTag:1,InsideTag:2,CloseTag:3}}).call(void 0)},{}],254:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n;n=t("./NodeType"),t("./XMLNode"),e.exports=function(){function t(t,e,r){if(this.parent=t,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),null==e)throw new Error("Missing attribute name. "+this.debugInfo(e));this.name=this.stringify.name(e),this.value=this.stringify.attValue(r),this.type=n.Attribute,this.isId=!1,this.schemaTypeInfo=null}return Object.defineProperty(t.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(t.prototype,"ownerElement",{get:function(){return this.parent}}),Object.defineProperty(t.prototype,"textContent",{get:function(){return this.value},set:function(t){return this.value=t||""}}),Object.defineProperty(t.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(t.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(t.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(t.prototype,"specified",{get:function(){return!0}}),t.prototype.clone=function(){return(0,i.default)(this)},t.prototype.toString=function(t){return this.options.writer.attribute(this,this.options.writer.filterOptions(t))},t.prototype.debugInfo=function(t){return null==(t=t||this.name)?"parent: <"+this.parent.name+">":"attribute: {"+t+"}, parent: <"+this.parent.name+">"},t.prototype.isEqualNode=function(t){return t.namespaceURI===this.namespaceURI&&t.prefix===this.prefix&&t.localName===this.localName&&t.value===this.value},t}()}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],255:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n,r,o={}.hasOwnProperty;n=t("./NodeType"),r=t("./XMLCharacterData"),e.exports=function(t){function e(t,r){if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing CDATA text. "+this.debugInfo());this.name="#cdata-section",this.type=n.CData,this.value=this.stringify.cdata(r)}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.clone=function(){return(0,i.default)(this)},e.prototype.toString=function(t){return this.options.writer.cdata(this,this.options.writer.filterOptions(t))},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],256:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n,r={}.hasOwnProperty;n=t("./XMLNode"),e.exports=function(t){function e(t){e.__super__.constructor.call(this,t),this.value=""}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function o(){this.constructor=t}o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"data",{get:function(){return this.value},set:function(t){return this.value=t||""}}),Object.defineProperty(e.prototype,"length",{get:function(){return this.value.length}}),Object.defineProperty(e.prototype,"textContent",{get:function(){return this.value},set:function(t){return this.value=t||""}}),e.prototype.clone=function(){return(0,i.default)(this)},e.prototype.substringData=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.appendData=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.insertData=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.deleteData=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.replaceData=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isEqualNode=function(t){return!!e.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.data===this.data},e}(n)}).call(void 0)},{"./XMLNode":273,"babel-runtime/core-js/object/create":55}],257:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n,r,o={}.hasOwnProperty;n=t("./NodeType"),r=t("./XMLCharacterData"),e.exports=function(t){function e(t,r){if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing comment text. "+this.debugInfo());this.name="#comment",this.type=n.Comment,this.value=this.stringify.comment(r)}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.clone=function(){return(0,i.default)(this)},e.prototype.toString=function(t){return this.options.writer.comment(this,this.options.writer.filterOptions(t))},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],258:[function(t,e,n){"use strict";var r=i(t("babel-runtime/core-js/object/keys")),o=i(t("babel-runtime/core-js/object/create"));function i(t){return t&&t.__esModule?t:{default:t}}(function(){var n,i;n=t("./XMLDOMErrorHandler"),i=t("./XMLDOMStringList"),e.exports=function(){function t(){this.defaultParams={"canonical-form":!1,"cdata-sections":!1,comments:!1,"datatype-normalization":!1,"element-content-whitespace":!0,entities:!0,"error-handler":new n,infoset:!0,"validate-if-schema":!1,namespaces:!0,"namespace-declarations":!0,"normalize-characters":!1,"schema-location":"","schema-type":"","split-cdata-sections":!0,validate:!1,"well-formed":!0},this.params=(0,o.default)(this.defaultParams)}return Object.defineProperty(t.prototype,"parameterNames",{get:function(){return new i((0,r.default)(this.defaultParams))}}),t.prototype.getParameter=function(t){return this.params.hasOwnProperty(t)?this.params[t]:null},t.prototype.canSetParameter=function(t,e){return!0},t.prototype.setParameter=function(t,e){return null!=e?this.params[t]=e:delete this.params[t]},t}()}).call(void 0)},{"./XMLDOMErrorHandler":259,"./XMLDOMStringList":261,"babel-runtime/core-js/object/create":55,"babel-runtime/core-js/object/keys":60}],259:[function(t,e,n){"use strict";(function(){e.exports=function(){function t(){}return t.prototype.handleError=function(t){throw new Error(t)},t}()}).call(void 0)},{}],260:[function(t,e,n){"use strict";(function(){e.exports=function(){function t(){}return t.prototype.hasFeature=function(t,e){return!0},t.prototype.createDocumentType=function(t,e,n){throw new Error("This DOM method is not implemented.")},t.prototype.createDocument=function(t,e,n){throw new Error("This DOM method is not implemented.")},t.prototype.createHTMLDocument=function(t){throw new Error("This DOM method is not implemented.")},t.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented.")},t}()}).call(void 0)},{}],261:[function(t,e,n){"use strict";(function(){e.exports=function(){function t(t){this.arr=t||[]}return Object.defineProperty(t.prototype,"length",{get:function(){return this.arr.length}}),t.prototype.item=function(t){return this.arr[t]||null},t.prototype.contains=function(t){return-1!==this.arr.indexOf(t)},t}()}).call(void 0)},{}],262:[function(t,e,n){"use strict";(function(){var n,r,o={}.hasOwnProperty;r=t("./XMLNode"),n=t("./NodeType"),e.exports=function(t){function e(t,r,o,i,a,s){if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing DTD element name. "+this.debugInfo());if(null==o)throw new Error("Missing DTD attribute name. "+this.debugInfo(r));if(!i)throw new Error("Missing DTD attribute type. "+this.debugInfo(r));if(!a)throw new Error("Missing DTD attribute default. "+this.debugInfo(r));if(0!==a.indexOf("#")&&(a="#"+a),!a.match(/^(#REQUIRED|#IMPLIED|#FIXED|#DEFAULT)$/))throw new Error("Invalid default value type; expected: #REQUIRED, #IMPLIED, #FIXED or #DEFAULT. "+this.debugInfo(r));if(s&&!a.match(/^(#FIXED|#DEFAULT)$/))throw new Error("Default value only applies to #FIXED or #DEFAULT. "+this.debugInfo(r));this.elementName=this.stringify.name(r),this.type=n.AttributeDeclaration,this.attributeName=this.stringify.name(o),this.attributeType=this.stringify.dtdAttType(i),s&&(this.defaultValue=this.stringify.dtdAttDefault(s)),this.defaultValueType=a}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.toString=function(t){return this.options.writer.dtdAttList(this,this.options.writer.filterOptions(t))},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],263:[function(t,e,n){"use strict";(function(){var n,r,o={}.hasOwnProperty;r=t("./XMLNode"),n=t("./NodeType"),e.exports=function(t){function e(t,r,o){if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing DTD element name. "+this.debugInfo());o||(o="(#PCDATA)"),Array.isArray(o)&&(o="("+o.join(",")+")"),this.name=this.stringify.name(r),this.type=n.ElementDeclaration,this.value=this.stringify.dtdElementValue(o)}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.toString=function(t){return this.options.writer.dtdElement(this,this.options.writer.filterOptions(t))},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],264:[function(t,e,n){"use strict";(function(){var n,r,o,i={}.hasOwnProperty;o=t("./Utility").isObject,r=t("./XMLNode"),n=t("./NodeType"),e.exports=function(t){function e(t,r,i,a){if(e.__super__.constructor.call(this,t),null==i)throw new Error("Missing DTD entity name. "+this.debugInfo(i));if(null==a)throw new Error("Missing DTD entity value. "+this.debugInfo(i));if(this.pe=!!r,this.name=this.stringify.name(i),this.type=n.EntityDeclaration,o(a)){if(!a.pubID&&!a.sysID)throw new Error("Public and/or system identifiers are required for an external entity. "+this.debugInfo(i));if(a.pubID&&!a.sysID)throw new Error("System identifier is required for a public external entity. "+this.debugInfo(i));if(this.internal=!1,null!=a.pubID&&(this.pubID=this.stringify.dtdPubID(a.pubID)),null!=a.sysID&&(this.sysID=this.stringify.dtdSysID(a.sysID)),null!=a.nData&&(this.nData=this.stringify.dtdNData(a.nData)),this.pe&&this.nData)throw new Error("Notation declaration is not allowed in a parameter entity. "+this.debugInfo(i))}else this.value=this.stringify.dtdEntityValue(a),this.internal=!0}return function(t,e){for(var n in e)i.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(e.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(e.prototype,"notationName",{get:function(){return this.nData||null}}),Object.defineProperty(e.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(e.prototype,"xmlEncoding",{get:function(){return null}}),Object.defineProperty(e.prototype,"xmlVersion",{get:function(){return null}}),e.prototype.toString=function(t){return this.options.writer.dtdEntity(this,this.options.writer.filterOptions(t))},e}(r)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLNode":273}],265:[function(t,e,n){"use strict";(function(){var n,r,o={}.hasOwnProperty;r=t("./XMLNode"),n=t("./NodeType"),e.exports=function(t){function e(t,r,o){if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing DTD notation name. "+this.debugInfo(r));if(!o.pubID&&!o.sysID)throw new Error("Public or system identifiers are required for an external entity. "+this.debugInfo(r));this.name=this.stringify.name(r),this.type=n.NotationDeclaration,null!=o.pubID&&(this.pubID=this.stringify.dtdPubID(o.pubID)),null!=o.sysID&&(this.sysID=this.stringify.dtdSysID(o.sysID))}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(e.prototype,"systemId",{get:function(){return this.sysID}}),e.prototype.toString=function(t){return this.options.writer.dtdNotation(this,this.options.writer.filterOptions(t))},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLNode":273}],266:[function(t,e,n){"use strict";(function(){var n,r,o,i={}.hasOwnProperty;o=t("./Utility").isObject,r=t("./XMLNode"),n=t("./NodeType"),e.exports=function(t){function e(t,r,i,a){var s;e.__super__.constructor.call(this,t),o(r)&&(r=(s=r).version,i=s.encoding,a=s.standalone),r||(r="1.0"),this.type=n.Declaration,this.version=this.stringify.xmlVersion(r),null!=i&&(this.encoding=this.stringify.xmlEncoding(i)),null!=a&&(this.standalone=this.stringify.xmlStandalone(a))}return function(t,e){for(var n in e)i.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.toString=function(t){return this.options.writer.declaration(this,this.options.writer.filterOptions(t))},e}(r)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLNode":273}],267:[function(t,e,n){"use strict";(function(){var n,r,o,i,a,s,u,c,l={}.hasOwnProperty;c=t("./Utility").isObject,u=t("./XMLNode"),n=t("./NodeType"),r=t("./XMLDTDAttList"),i=t("./XMLDTDEntity"),o=t("./XMLDTDElement"),a=t("./XMLDTDNotation"),s=t("./XMLNamedNodeMap"),e.exports=function(t){function e(t,r,o){var i,a,s,u,l,f;if(e.__super__.constructor.call(this,t),this.type=n.DocType,t.children)for(a=0,s=(u=t.children).length;a<s;a++)if((i=u[a]).type===n.Element){this.name=i.name;break}this.documentObject=t,c(r)&&(r=(l=r).pubID,o=l.sysID),null==o&&(o=(f=[r,o])[0],r=f[1]),null!=r&&(this.pubID=this.stringify.dtdPubID(r)),null!=o&&(this.sysID=this.stringify.dtdSysID(o))}return function(t,e){for(var n in e)l.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"entities",{get:function(){var t,e,r,o,i;for(o={},e=0,r=(i=this.children).length;e<r;e++)(t=i[e]).type!==n.EntityDeclaration||t.pe||(o[t.name]=t);return new s(o)}}),Object.defineProperty(e.prototype,"notations",{get:function(){var t,e,r,o,i;for(o={},e=0,r=(i=this.children).length;e<r;e++)(t=i[e]).type===n.NotationDeclaration&&(o[t.name]=t);return new s(o)}}),Object.defineProperty(e.prototype,"publicId",{get:function(){return this.pubID}}),Object.defineProperty(e.prototype,"systemId",{get:function(){return this.sysID}}),Object.defineProperty(e.prototype,"internalSubset",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),e.prototype.element=function(t,e){var n;return n=new o(this,t,e),this.children.push(n),this},e.prototype.attList=function(t,e,n,o,i){var a;return a=new r(this,t,e,n,o,i),this.children.push(a),this},e.prototype.entity=function(t,e){var n;return n=new i(this,!1,t,e),this.children.push(n),this},e.prototype.pEntity=function(t,e){var n;return n=new i(this,!0,t,e),this.children.push(n),this},e.prototype.notation=function(t,e){var n;return n=new a(this,t,e),this.children.push(n),this},e.prototype.toString=function(t){return this.options.writer.docType(this,this.options.writer.filterOptions(t))},e.prototype.ele=function(t,e){return this.element(t,e)},e.prototype.att=function(t,e,n,r,o){return this.attList(t,e,n,r,o)},e.prototype.ent=function(t,e){return this.entity(t,e)},e.prototype.pent=function(t,e){return this.pEntity(t,e)},e.prototype.not=function(t,e){return this.notation(t,e)},e.prototype.up=function(){return this.root()||this.documentObject},e.prototype.isEqualNode=function(t){return!!e.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.name===this.name&&t.publicId===this.publicId&&t.systemId===this.systemId},e}(u)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLNamedNodeMap":272,"./XMLNode":273}],268:[function(t,e,n){"use strict";(function(){var n,r,o,i,a,s,u,c={}.hasOwnProperty;u=t("./Utility").isPlainObject,o=t("./XMLDOMImplementation"),r=t("./XMLDOMConfiguration"),i=t("./XMLNode"),n=t("./NodeType"),s=t("./XMLStringifier"),a=t("./XMLStringWriter"),e.exports=function(t){function e(t){e.__super__.constructor.call(this,null),this.name="#document",this.type=n.Document,this.documentURI=null,this.domConfig=new r,t||(t={}),t.writer||(t.writer=new a),this.options=t,this.stringify=new s(t)}return function(t,e){for(var n in e)c.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"implementation",{value:new o}),Object.defineProperty(e.prototype,"doctype",{get:function(){var t,e,r,o;for(e=0,r=(o=this.children).length;e<r;e++)if((t=o[e]).type===n.DocType)return t;return null}}),Object.defineProperty(e.prototype,"documentElement",{get:function(){return this.rootObject||null}}),Object.defineProperty(e.prototype,"inputEncoding",{get:function(){return null}}),Object.defineProperty(e.prototype,"strictErrorChecking",{get:function(){return!1}}),Object.defineProperty(e.prototype,"xmlEncoding",{get:function(){return 0!==this.children.length&&this.children[0].type===n.Declaration?this.children[0].encoding:null}}),Object.defineProperty(e.prototype,"xmlStandalone",{get:function(){return 0!==this.children.length&&this.children[0].type===n.Declaration&&"yes"===this.children[0].standalone}}),Object.defineProperty(e.prototype,"xmlVersion",{get:function(){return 0!==this.children.length&&this.children[0].type===n.Declaration?this.children[0].version:"1.0"}}),Object.defineProperty(e.prototype,"URL",{get:function(){return this.documentURI}}),Object.defineProperty(e.prototype,"origin",{get:function(){return null}}),Object.defineProperty(e.prototype,"compatMode",{get:function(){return null}}),Object.defineProperty(e.prototype,"characterSet",{get:function(){return null}}),Object.defineProperty(e.prototype,"contentType",{get:function(){return null}}),e.prototype.end=function(t){var e;return e={},t?u(t)&&(e=t,t=this.options.writer):t=this.options.writer,t.document(this,t.filterOptions(e))},e.prototype.toString=function(t){return this.options.writer.document(this,this.options.writer.filterOptions(t))},e.prototype.createElement=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createDocumentFragment=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createTextNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createComment=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createCDATASection=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createProcessingInstruction=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createAttribute=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createEntityReference=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementsByTagName=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.importNode=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createElementNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createAttributeNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementsByTagNameNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementById=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.adoptNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.normalizeDocument=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.renameNode=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementsByClassName=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createEvent=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createRange=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createNodeIterator=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.createTreeWalker=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},e}(i)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLDOMConfiguration":258,"./XMLDOMImplementation":260,"./XMLNode":273,"./XMLStringWriter":278,"./XMLStringifier":279}],269:[function(t,e,n){"use strict";(function(){var n,r,o,i,a,s,u,c,l,f,h,p,d,m,v,g,y,b,w,x,_,E,C,S={}.hasOwnProperty;C=t("./Utility"),_=C.isObject,x=C.isFunction,E=C.isPlainObject,w=C.getValue,n=t("./NodeType"),p=t("./XMLDocument"),d=t("./XMLElement"),i=t("./XMLCData"),a=t("./XMLComment"),v=t("./XMLRaw"),b=t("./XMLText"),m=t("./XMLProcessingInstruction"),f=t("./XMLDeclaration"),h=t("./XMLDocType"),s=t("./XMLDTDAttList"),c=t("./XMLDTDEntity"),u=t("./XMLDTDElement"),l=t("./XMLDTDNotation"),o=t("./XMLAttribute"),y=t("./XMLStringifier"),g=t("./XMLStringWriter"),r=t("./WriterState"),e.exports=function(){function t(t,e,r){var o;this.name="?xml",this.type=n.Document,t||(t={}),o={},t.writer?E(t.writer)&&(o=t.writer,t.writer=new g):t.writer=new g,this.options=t,this.writer=t.writer,this.writerOptions=this.writer.filterOptions(o),this.stringify=new y(t),this.onDataCallback=e||function(){},this.onEndCallback=r||function(){},this.currentNode=null,this.currentLevel=-1,this.openTags={},this.documentStarted=!1,this.documentCompleted=!1,this.root=null}return t.prototype.createChildNode=function(t){var e,r,o,i,a,s,u,c;switch(t.type){case n.CData:this.cdata(t.value);break;case n.Comment:this.comment(t.value);break;case n.Element:for(r in o={},u=t.attribs)S.call(u,r)&&(e=u[r],o[r]=e.value);this.node(t.name,o);break;case n.Dummy:this.dummy();break;case n.Raw:this.raw(t.value);break;case n.Text:this.text(t.value);break;case n.ProcessingInstruction:this.instruction(t.target,t.value);break;default:throw new Error("This XML node type is not supported in a JS object: "+t.constructor.name)}for(a=0,s=(c=t.children).length;a<s;a++)i=c[a],this.createChildNode(i),i.type===n.Element&&this.up();return this},t.prototype.dummy=function(){return this},t.prototype.node=function(t,e,n){var r;if(null==t)throw new Error("Missing node name.");if(this.root&&-1===this.currentLevel)throw new Error("Document can only have one root node. "+this.debugInfo(t));return this.openCurrent(),t=w(t),null==e&&(e={}),e=w(e),_(e)||(n=(r=[e,n])[0],e=r[1]),this.currentNode=new d(this,t,e),this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,null!=n&&this.text(n),this},t.prototype.element=function(t,e,r){var o,i,a,s,u,c;if(this.currentNode&&this.currentNode.type===n.DocType)this.dtdElement.apply(this,arguments);else if(Array.isArray(t)||_(t)||x(t))for(s=this.options.noValidation,this.options.noValidation=!0,(c=new p(this.options).element("TEMP_ROOT")).element(t),this.options.noValidation=s,i=0,a=(u=c.children).length;i<a;i++)o=u[i],this.createChildNode(o),o.type===n.Element&&this.up();else this.node(t,e,r);return this},t.prototype.attribute=function(t,e){var n,r;if(!this.currentNode||this.currentNode.children)throw new Error("att() can only be used immediately after an ele() call in callback mode. "+this.debugInfo(t));if(null!=t&&(t=w(t)),_(t))for(n in t)S.call(t,n)&&(r=t[n],this.attribute(n,r));else x(e)&&(e=e.apply()),this.options.keepNullAttributes&&null==e?this.currentNode.attribs[t]=new o(this,t,""):null!=e&&(this.currentNode.attribs[t]=new o(this,t,e));return this},t.prototype.text=function(t){var e;return this.openCurrent(),e=new b(this,t),this.onData(this.writer.text(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.cdata=function(t){var e;return this.openCurrent(),e=new i(this,t),this.onData(this.writer.cdata(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.comment=function(t){var e;return this.openCurrent(),e=new a(this,t),this.onData(this.writer.comment(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.raw=function(t){var e;return this.openCurrent(),e=new v(this,t),this.onData(this.writer.raw(e,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.instruction=function(t,e){var n,r,o,i,a;if(this.openCurrent(),null!=t&&(t=w(t)),null!=e&&(e=w(e)),Array.isArray(t))for(n=0,i=t.length;n<i;n++)r=t[n],this.instruction(r);else if(_(t))for(r in t)S.call(t,r)&&(o=t[r],this.instruction(r,o));else x(e)&&(e=e.apply()),a=new m(this,t,e),this.onData(this.writer.processingInstruction(a,this.writerOptions,this.currentLevel+1),this.currentLevel+1);return this},t.prototype.declaration=function(t,e,n){var r;if(this.openCurrent(),this.documentStarted)throw new Error("declaration() must be the first node.");return r=new f(this,t,e,n),this.onData(this.writer.declaration(r,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.doctype=function(t,e,n){if(this.openCurrent(),null==t)throw new Error("Missing root node name.");if(this.root)throw new Error("dtd() must come before the root node.");return this.currentNode=new h(this,e,n),this.currentNode.rootNodeName=t,this.currentNode.children=!1,this.currentLevel++,this.openTags[this.currentLevel]=this.currentNode,this},t.prototype.dtdElement=function(t,e){var n;return this.openCurrent(),n=new u(this,t,e),this.onData(this.writer.dtdElement(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.attList=function(t,e,n,r,o){var i;return this.openCurrent(),i=new s(this,t,e,n,r,o),this.onData(this.writer.dtdAttList(i,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.entity=function(t,e){var n;return this.openCurrent(),n=new c(this,!1,t,e),this.onData(this.writer.dtdEntity(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.pEntity=function(t,e){var n;return this.openCurrent(),n=new c(this,!0,t,e),this.onData(this.writer.dtdEntity(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.notation=function(t,e){var n;return this.openCurrent(),n=new l(this,t,e),this.onData(this.writer.dtdNotation(n,this.writerOptions,this.currentLevel+1),this.currentLevel+1),this},t.prototype.up=function(){if(this.currentLevel<0)throw new Error("The document node has no parent.");return this.currentNode?(this.currentNode.children?this.closeNode(this.currentNode):this.openNode(this.currentNode),this.currentNode=null):this.closeNode(this.openTags[this.currentLevel]),delete this.openTags[this.currentLevel],this.currentLevel--,this},t.prototype.end=function(){for(;this.currentLevel>=0;)this.up();return this.onEnd()},t.prototype.openCurrent=function(){if(this.currentNode)return this.currentNode.children=!0,this.openNode(this.currentNode)},t.prototype.openNode=function(t){var e,o,i,a;if(!t.isOpen){if(this.root||0!==this.currentLevel||t.type!==n.Element||(this.root=t),o="",t.type===n.Element){for(i in this.writerOptions.state=r.OpenTag,o=this.writer.indent(t,this.writerOptions,this.currentLevel)+"<"+t.name,a=t.attribs)S.call(a,i)&&(e=a[i],o+=this.writer.attribute(e,this.writerOptions,this.currentLevel));o+=(t.children?">":"/>")+this.writer.endline(t,this.writerOptions,this.currentLevel),this.writerOptions.state=r.InsideTag}else this.writerOptions.state=r.OpenTag,o=this.writer.indent(t,this.writerOptions,this.currentLevel)+"<!DOCTYPE "+t.rootNodeName,t.pubID&&t.sysID?o+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.sysID&&(o+=' SYSTEM "'+t.sysID+'"'),t.children?(o+=" [",this.writerOptions.state=r.InsideTag):(this.writerOptions.state=r.CloseTag,o+=">"),o+=this.writer.endline(t,this.writerOptions,this.currentLevel);return this.onData(o,this.currentLevel),t.isOpen=!0}},t.prototype.closeNode=function(t){var e;if(!t.isClosed)return e="",this.writerOptions.state=r.CloseTag,e=t.type===n.Element?this.writer.indent(t,this.writerOptions,this.currentLevel)+"</"+t.name+">"+this.writer.endline(t,this.writerOptions,this.currentLevel):this.writer.indent(t,this.writerOptions,this.currentLevel)+"]>"+this.writer.endline(t,this.writerOptions,this.currentLevel),this.writerOptions.state=r.None,this.onData(e,this.currentLevel),t.isClosed=!0},t.prototype.onData=function(t,e){return this.documentStarted=!0,this.onDataCallback(t,e+1)},t.prototype.onEnd=function(){return this.documentCompleted=!0,this.onEndCallback()},t.prototype.debugInfo=function(t){return null==t?"":"node: <"+t+">"},t.prototype.ele=function(){return this.element.apply(this,arguments)},t.prototype.nod=function(t,e,n){return this.node(t,e,n)},t.prototype.txt=function(t){return this.text(t)},t.prototype.dat=function(t){return this.cdata(t)},t.prototype.com=function(t){return this.comment(t)},t.prototype.ins=function(t,e){return this.instruction(t,e)},t.prototype.dec=function(t,e,n){return this.declaration(t,e,n)},t.prototype.dtd=function(t,e,n){return this.doctype(t,e,n)},t.prototype.e=function(t,e,n){return this.element(t,e,n)},t.prototype.n=function(t,e,n){return this.node(t,e,n)},t.prototype.t=function(t){return this.text(t)},t.prototype.d=function(t){return this.cdata(t)},t.prototype.c=function(t){return this.comment(t)},t.prototype.r=function(t){return this.raw(t)},t.prototype.i=function(t,e){return this.instruction(t,e)},t.prototype.att=function(){return this.currentNode&&this.currentNode.type===n.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},t.prototype.a=function(){return this.currentNode&&this.currentNode.type===n.DocType?this.attList.apply(this,arguments):this.attribute.apply(this,arguments)},t.prototype.ent=function(t,e){return this.entity(t,e)},t.prototype.pent=function(t,e){return this.pEntity(t,e)},t.prototype.not=function(t,e){return this.notation(t,e)},t}()}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLAttribute":254,"./XMLCData":255,"./XMLComment":257,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDocument":268,"./XMLElement":271,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLStringWriter":278,"./XMLStringifier":279,"./XMLText":280}],270:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n,r,o={}.hasOwnProperty;r=t("./XMLNode"),n=t("./NodeType"),e.exports=function(t){function e(t){e.__super__.constructor.call(this,t),this.type=n.Dummy}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.clone=function(){return(0,i.default)(this)},e.prototype.toString=function(t){return""},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],271:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n,r,o,a,s,u,c,l,f={}.hasOwnProperty;l=t("./Utility"),c=l.isObject,u=l.isFunction,s=l.getValue,a=t("./XMLNode"),n=t("./NodeType"),r=t("./XMLAttribute"),o=t("./XMLNamedNodeMap"),e.exports=function(t){function e(t,r,o){var i,a,s,u;if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing element name. "+this.debugInfo());if(this.name=this.stringify.name(r),this.type=n.Element,this.attribs={},this.schemaTypeInfo=null,null!=o&&this.attribute(o),t.type===n.Document&&(this.isRoot=!0,this.documentObject=t,t.rootObject=this,t.children))for(a=0,s=(u=t.children).length;a<s;a++)if((i=u[a]).type===n.DocType){i.name=this.name;break}}return function(t,e){for(var n in e)f.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"tagName",{get:function(){return this.name}}),Object.defineProperty(e.prototype,"namespaceURI",{get:function(){return""}}),Object.defineProperty(e.prototype,"prefix",{get:function(){return""}}),Object.defineProperty(e.prototype,"localName",{get:function(){return this.name}}),Object.defineProperty(e.prototype,"id",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(e.prototype,"className",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(e.prototype,"classList",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(e.prototype,"attributes",{get:function(){return this.attributeMap&&this.attributeMap.nodes||(this.attributeMap=new o(this.attribs)),this.attributeMap}}),e.prototype.clone=function(){var t,e,n,r;for(e in(n=(0,i.default)(this)).isRoot&&(n.documentObject=null),n.attribs={},r=this.attribs)f.call(r,e)&&(t=r[e],n.attribs[e]=t.clone());return n.children=[],this.children.forEach((function(t){var e;return(e=t.clone()).parent=n,n.children.push(e)})),n},e.prototype.attribute=function(t,e){var n,o;if(null!=t&&(t=s(t)),c(t))for(n in t)f.call(t,n)&&(o=t[n],this.attribute(n,o));else u(e)&&(e=e.apply()),this.options.keepNullAttributes&&null==e?this.attribs[t]=new r(this,t,""):null!=e&&(this.attribs[t]=new r(this,t,e));return this},e.prototype.removeAttribute=function(t){var e,n,r;if(null==t)throw new Error("Missing attribute name. "+this.debugInfo());if(t=s(t),Array.isArray(t))for(n=0,r=t.length;n<r;n++)e=t[n],delete this.attribs[e];else delete this.attribs[t];return this},e.prototype.toString=function(t){return this.options.writer.element(this,this.options.writer.filterOptions(t))},e.prototype.att=function(t,e){return this.attribute(t,e)},e.prototype.a=function(t,e){return this.attribute(t,e)},e.prototype.getAttribute=function(t){return this.attribs.hasOwnProperty(t)?this.attribs[t].value:null},e.prototype.setAttribute=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getAttributeNode=function(t){return this.attribs.hasOwnProperty(t)?this.attribs[t]:null},e.prototype.setAttributeNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.removeAttributeNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementsByTagName=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getAttributeNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.setAttributeNS=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.removeAttributeNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getAttributeNodeNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.setAttributeNodeNS=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementsByTagNameNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.hasAttribute=function(t){return this.attribs.hasOwnProperty(t)},e.prototype.hasAttributeNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.setIdAttribute=function(t,e){return this.attribs.hasOwnProperty(t)?this.attribs[t].isId:e},e.prototype.setIdAttributeNS=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.setIdAttributeNode=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementsByTagName=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementsByTagNameNS=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getElementsByClassName=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isEqualNode=function(t){var n,r,o;if(!e.__super__.isEqualNode.apply(this,arguments).isEqualNode(t))return!1;if(t.namespaceURI!==this.namespaceURI)return!1;if(t.prefix!==this.prefix)return!1;if(t.localName!==this.localName)return!1;if(t.attribs.length!==this.attribs.length)return!1;for(n=r=0,o=this.attribs.length-1;0<=o?r<=o:r>=o;n=0<=o?++r:--r)if(!this.attribs[n].isEqualNode(t.attribs[n]))return!1;return!0},e}(a)}).call(void 0)},{"./NodeType":251,"./Utility":252,"./XMLAttribute":254,"./XMLNamedNodeMap":272,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],272:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/keys"),i=(r=o)&&r.__esModule?r:{default:r};(function(){e.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return(0,i.default)(this.nodes).length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.getNamedItem=function(t){return this.nodes[t]},t.prototype.setNamedItem=function(t){var e;return e=this.nodes[t.nodeName],this.nodes[t.nodeName]=t,e||null},t.prototype.removeNamedItem=function(t){var e;return e=this.nodes[t],delete this.nodes[t],e||null},t.prototype.item=function(t){return this.nodes[(0,i.default)(this.nodes)[t]]||null},t.prototype.getNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},t.prototype.setNamedItemNS=function(t){throw new Error("This DOM method is not implemented.")},t.prototype.removeNamedItemNS=function(t,e){throw new Error("This DOM method is not implemented.")},t}()}).call(void 0)},{"babel-runtime/core-js/object/keys":60}],273:[function(t,e,n){"use strict";(function(){var n,r,o,i,a,s,u,c,l,f,h,p,d,m,v,g,y,b={}.hasOwnProperty;y=t("./Utility"),g=y.isObject,v=y.isFunction,m=y.isEmpty,d=y.getValue,c=null,o=null,i=null,a=null,s=null,h=null,p=null,f=null,u=null,r=null,l=null,n=null,e.exports=function(){function e(e){this.parent=e,this.parent&&(this.options=this.parent.options,this.stringify=this.parent.stringify),this.value=null,this.children=[],this.baseURI=null,c||(c=t("./XMLElement"),o=t("./XMLCData"),i=t("./XMLComment"),a=t("./XMLDeclaration"),s=t("./XMLDocType"),h=t("./XMLRaw"),p=t("./XMLText"),f=t("./XMLProcessingInstruction"),u=t("./XMLDummy"),r=t("./NodeType"),l=t("./XMLNodeList"),t("./XMLNamedNodeMap"),n=t("./DocumentPosition"))}return Object.defineProperty(e.prototype,"nodeName",{get:function(){return this.name}}),Object.defineProperty(e.prototype,"nodeType",{get:function(){return this.type}}),Object.defineProperty(e.prototype,"nodeValue",{get:function(){return this.value}}),Object.defineProperty(e.prototype,"parentNode",{get:function(){return this.parent}}),Object.defineProperty(e.prototype,"childNodes",{get:function(){return this.childNodeList&&this.childNodeList.nodes||(this.childNodeList=new l(this.children)),this.childNodeList}}),Object.defineProperty(e.prototype,"firstChild",{get:function(){return this.children[0]||null}}),Object.defineProperty(e.prototype,"lastChild",{get:function(){return this.children[this.children.length-1]||null}}),Object.defineProperty(e.prototype,"previousSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t-1]||null}}),Object.defineProperty(e.prototype,"nextSibling",{get:function(){var t;return t=this.parent.children.indexOf(this),this.parent.children[t+1]||null}}),Object.defineProperty(e.prototype,"ownerDocument",{get:function(){return this.document()||null}}),Object.defineProperty(e.prototype,"textContent",{get:function(){var t,e,n,o,i;if(this.nodeType===r.Element||this.nodeType===r.DocumentFragment){for(i="",e=0,n=(o=this.children).length;e<n;e++)(t=o[e]).textContent&&(i+=t.textContent);return i}return null},set:function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),e.prototype.setParent=function(t){var e,n,r,o,i;for(this.parent=t,t&&(this.options=t.options,this.stringify=t.stringify),i=[],n=0,r=(o=this.children).length;n<r;n++)e=o[n],i.push(e.setParent(this));return i},e.prototype.element=function(t,e,n){var r,o,i,a,s,u,c,l,f,h,p;if(u=null,null===e&&null==n&&(e=(f=[{},null])[0],n=f[1]),null==e&&(e={}),e=d(e),g(e)||(n=(h=[e,n])[0],e=h[1]),null!=t&&(t=d(t)),Array.isArray(t))for(i=0,c=t.length;i<c;i++)o=t[i],u=this.element(o);else if(v(t))u=this.element(t.apply());else if(g(t)){for(s in t)if(b.call(t,s))if(p=t[s],v(p)&&(p=p.apply()),!this.options.ignoreDecorators&&this.stringify.convertAttKey&&0===s.indexOf(this.stringify.convertAttKey))u=this.attribute(s.substr(this.stringify.convertAttKey.length),p);else if(!this.options.separateArrayItems&&Array.isArray(p)&&m(p))u=this.dummy();else if(g(p)&&m(p))u=this.element(s);else if(this.options.keepNullNodes||null!=p)if(!this.options.separateArrayItems&&Array.isArray(p))for(a=0,l=p.length;a<l;a++)o=p[a],(r={})[s]=o,u=this.element(r);else g(p)?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===s.indexOf(this.stringify.convertTextKey)?u=this.element(p):(u=this.element(s)).element(p):u=this.element(s,p);else u=this.dummy()}else u=this.options.keepNullNodes||null!==n?!this.options.ignoreDecorators&&this.stringify.convertTextKey&&0===t.indexOf(this.stringify.convertTextKey)?this.text(n):!this.options.ignoreDecorators&&this.stringify.convertCDataKey&&0===t.indexOf(this.stringify.convertCDataKey)?this.cdata(n):!this.options.ignoreDecorators&&this.stringify.convertCommentKey&&0===t.indexOf(this.stringify.convertCommentKey)?this.comment(n):!this.options.ignoreDecorators&&this.stringify.convertRawKey&&0===t.indexOf(this.stringify.convertRawKey)?this.raw(n):!this.options.ignoreDecorators&&this.stringify.convertPIKey&&0===t.indexOf(this.stringify.convertPIKey)?this.instruction(t.substr(this.stringify.convertPIKey.length),n):this.node(t,e,n):this.dummy();if(null==u)throw new Error("Could not create any elements with: "+t+". "+this.debugInfo());return u},e.prototype.insertBefore=function(t,e,n){var r,o,i,a,s;if(null!=t?t.type:void 0)return a=e,(i=t).setParent(this),a?(o=children.indexOf(a),s=children.splice(o),children.push(i),Array.prototype.push.apply(children,s)):children.push(i),i;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(t));return o=this.parent.children.indexOf(this),s=this.parent.children.splice(o),r=this.parent.element(t,e,n),Array.prototype.push.apply(this.parent.children,s),r},e.prototype.insertAfter=function(t,e,n){var r,o,i;if(this.isRoot)throw new Error("Cannot insert elements at root level. "+this.debugInfo(t));return o=this.parent.children.indexOf(this),i=this.parent.children.splice(o+1),r=this.parent.element(t,e,n),Array.prototype.push.apply(this.parent.children,i),r},e.prototype.remove=function(){var t;if(this.isRoot)throw new Error("Cannot remove the root element. "+this.debugInfo());return t=this.parent.children.indexOf(this),[].splice.apply(this.parent.children,[t,t-t+1].concat([])),this.parent},e.prototype.node=function(t,e,n){var r,o;return null!=t&&(t=d(t)),e||(e={}),e=d(e),g(e)||(n=(o=[e,n])[0],e=o[1]),r=new c(this,t,e),null!=n&&r.text(n),this.children.push(r),r},e.prototype.text=function(t){var e;return g(t)&&this.element(t),e=new p(this,t),this.children.push(e),this},e.prototype.cdata=function(t){var e;return e=new o(this,t),this.children.push(e),this},e.prototype.comment=function(t){var e;return e=new i(this,t),this.children.push(e),this},e.prototype.commentBefore=function(t){var e,n;return e=this.parent.children.indexOf(this),n=this.parent.children.splice(e),this.parent.comment(t),Array.prototype.push.apply(this.parent.children,n),this},e.prototype.commentAfter=function(t){var e,n;return e=this.parent.children.indexOf(this),n=this.parent.children.splice(e+1),this.parent.comment(t),Array.prototype.push.apply(this.parent.children,n),this},e.prototype.raw=function(t){var e;return e=new h(this,t),this.children.push(e),this},e.prototype.dummy=function(){return new u(this)},e.prototype.instruction=function(t,e){var n,r,o,i,a;if(null!=t&&(t=d(t)),null!=e&&(e=d(e)),Array.isArray(t))for(i=0,a=t.length;i<a;i++)n=t[i],this.instruction(n);else if(g(t))for(n in t)b.call(t,n)&&(r=t[n],this.instruction(n,r));else v(e)&&(e=e.apply()),o=new f(this,t,e),this.children.push(o);return this},e.prototype.instructionBefore=function(t,e){var n,r;return n=this.parent.children.indexOf(this),r=this.parent.children.splice(n),this.parent.instruction(t,e),Array.prototype.push.apply(this.parent.children,r),this},e.prototype.instructionAfter=function(t,e){var n,r;return n=this.parent.children.indexOf(this),r=this.parent.children.splice(n+1),this.parent.instruction(t,e),Array.prototype.push.apply(this.parent.children,r),this},e.prototype.declaration=function(t,e,n){var o,i;return o=this.document(),i=new a(o,t,e,n),0===o.children.length?o.children.unshift(i):o.children[0].type===r.Declaration?o.children[0]=i:o.children.unshift(i),o.root()||o},e.prototype.dtd=function(t,e){var n,o,i,a,u,c,l,f,h;for(n=this.document(),o=new s(n,t,e),i=a=0,c=(f=n.children).length;a<c;i=++a)if(f[i].type===r.DocType)return n.children[i]=o,o;for(i=u=0,l=(h=n.children).length;u<l;i=++u)if(h[i].isRoot)return n.children.splice(i,0,o),o;return n.children.push(o),o},e.prototype.up=function(){if(this.isRoot)throw new Error("The root node has no parent. Use doc() if you need to get the document object.");return this.parent},e.prototype.root=function(){var t;for(t=this;t;){if(t.type===r.Document)return t.rootObject;if(t.isRoot)return t;t=t.parent}},e.prototype.document=function(){var t;for(t=this;t;){if(t.type===r.Document)return t;t=t.parent}},e.prototype.end=function(t){return this.document().end(t)},e.prototype.prev=function(){var t;if((t=this.parent.children.indexOf(this))<1)throw new Error("Already at the first node. "+this.debugInfo());return this.parent.children[t-1]},e.prototype.next=function(){var t;if(-1===(t=this.parent.children.indexOf(this))||t===this.parent.children.length-1)throw new Error("Already at the last node. "+this.debugInfo());return this.parent.children[t+1]},e.prototype.importDocument=function(t){var e;return(e=t.root().clone()).parent=this,e.isRoot=!1,this.children.push(e),this},e.prototype.debugInfo=function(t){var e,n;return null!=(t=t||this.name)||(null!=(e=this.parent)?e.name:void 0)?null==t?"parent: <"+this.parent.name+">":(null!=(n=this.parent)?n.name:void 0)?"node: <"+t+">, parent: <"+this.parent.name+">":"node: <"+t+">":""},e.prototype.ele=function(t,e,n){return this.element(t,e,n)},e.prototype.nod=function(t,e,n){return this.node(t,e,n)},e.prototype.txt=function(t){return this.text(t)},e.prototype.dat=function(t){return this.cdata(t)},e.prototype.com=function(t){return this.comment(t)},e.prototype.ins=function(t,e){return this.instruction(t,e)},e.prototype.doc=function(){return this.document()},e.prototype.dec=function(t,e,n){return this.declaration(t,e,n)},e.prototype.e=function(t,e,n){return this.element(t,e,n)},e.prototype.n=function(t,e,n){return this.node(t,e,n)},e.prototype.t=function(t){return this.text(t)},e.prototype.d=function(t){return this.cdata(t)},e.prototype.c=function(t){return this.comment(t)},e.prototype.r=function(t){return this.raw(t)},e.prototype.i=function(t,e){return this.instruction(t,e)},e.prototype.u=function(){return this.up()},e.prototype.importXMLBuilder=function(t){return this.importDocument(t)},e.prototype.replaceChild=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.removeChild=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.appendChild=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.hasChildNodes=function(){return 0!==this.children.length},e.prototype.cloneNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.normalize=function(){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isSupported=function(t,e){return!0},e.prototype.hasAttributes=function(){return 0!==this.attribs.length},e.prototype.compareDocumentPosition=function(t){var e;return this===t?0:this.document()!==t.document()?(e=n.Disconnected|n.ImplementationSpecific,Math.random()<.5?e|=n.Preceding:e|=n.Following,e):this.isAncestor(t)?n.Contains|n.Preceding:this.isDescendant(t)?n.Contains|n.Following:this.isPreceding(t)?n.Preceding:n.Following},e.prototype.isSameNode=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.lookupPrefix=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isDefaultNamespace=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.lookupNamespaceURI=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.isEqualNode=function(t){var e,n,r;if(t.nodeType!==this.nodeType)return!1;if(t.children.length!==this.children.length)return!1;for(e=n=0,r=this.children.length-1;0<=r?n<=r:n>=r;e=0<=r?++n:--n)if(!this.children[e].isEqualNode(t.children[e]))return!1;return!0},e.prototype.getFeature=function(t,e){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.setUserData=function(t,e,n){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.getUserData=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.contains=function(t){return!!t&&(t===this||this.isDescendant(t))},e.prototype.isDescendant=function(t){var e,n,r,o;for(n=0,r=(o=this.children).length;n<r;n++){if(t===(e=o[n]))return!0;if(e.isDescendant(t))return!0}return!1},e.prototype.isAncestor=function(t){return t.isDescendant(this)},e.prototype.isPreceding=function(t){var e,n;return e=this.treePosition(t),n=this.treePosition(this),-1!==e&&-1!==n&&e<n},e.prototype.isFollowing=function(t){var e,n;return e=this.treePosition(t),n=this.treePosition(this),-1!==e&&-1!==n&&e>n},e.prototype.treePosition=function(t){var e,n;return n=0,e=!1,this.foreachTreeNode(this.document(),(function(r){if(n++,!e&&r===t)return e=!0})),e?n:-1},e.prototype.foreachTreeNode=function(t,e){var n,r,o,i,a;for(t||(t=this.document()),r=0,o=(i=t.children).length;r<o;r++){if(a=e(n=i[r]))return a;if(a=this.foreachTreeNode(n,e))return a}},e}()}).call(void 0)},{"./DocumentPosition":250,"./NodeType":251,"./Utility":252,"./XMLCData":255,"./XMLComment":257,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDummy":270,"./XMLElement":271,"./XMLNamedNodeMap":272,"./XMLNodeList":274,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLText":280}],274:[function(t,e,n){"use strict";(function(){e.exports=function(){function t(t){this.nodes=t}return Object.defineProperty(t.prototype,"length",{get:function(){return this.nodes.length||0}}),t.prototype.clone=function(){return this.nodes=null},t.prototype.item=function(t){return this.nodes[t]||null},t}()}).call(void 0)},{}],275:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n,r,o={}.hasOwnProperty;n=t("./NodeType"),r=t("./XMLCharacterData"),e.exports=function(t){function e(t,r,o){if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing instruction target. "+this.debugInfo());this.type=n.ProcessingInstruction,this.target=this.stringify.insTarget(r),this.name=this.target,o&&(this.value=this.stringify.insValue(o))}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.clone=function(){return(0,i.default)(this)},e.prototype.toString=function(t){return this.options.writer.processingInstruction(this,this.options.writer.filterOptions(t))},e.prototype.isEqualNode=function(t){return!!e.__super__.isEqualNode.apply(this,arguments).isEqualNode(t)&&t.target===this.target},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],276:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n,r,o={}.hasOwnProperty;n=t("./NodeType"),r=t("./XMLNode"),e.exports=function(t){function e(t,r){if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing raw text. "+this.debugInfo());this.type=n.Raw,this.value=this.stringify.raw(r)}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.clone=function(){return(0,i.default)(this)},e.prototype.toString=function(t){return this.options.writer.raw(this,this.options.writer.filterOptions(t))},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLNode":273,"babel-runtime/core-js/object/create":55}],277:[function(t,e,n){"use strict";(function(){var n,r,o,i={}.hasOwnProperty;n=t("./NodeType"),o=t("./XMLWriterBase"),r=t("./WriterState"),e.exports=function(t){function e(t,n){this.stream=t,e.__super__.constructor.call(this,n)}return function(t,e){for(var n in e)i.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),e.prototype.endline=function(t,n,o){return t.isLastRootNode&&n.state===r.CloseTag?"":e.__super__.endline.call(this,t,n,o)},e.prototype.document=function(t,e){var n,r,o,i,a,s,u,c,l;for(r=o=0,a=(u=t.children).length;o<a;r=++o)(n=u[r]).isLastRootNode=r===t.children.length-1;for(e=this.filterOptions(e),l=[],i=0,s=(c=t.children).length;i<s;i++)n=c[i],l.push(this.writeChildNode(n,e,0));return l},e.prototype.attribute=function(t,n,r){return this.stream.write(e.__super__.attribute.call(this,t,n,r))},e.prototype.cdata=function(t,n,r){return this.stream.write(e.__super__.cdata.call(this,t,n,r))},e.prototype.comment=function(t,n,r){return this.stream.write(e.__super__.comment.call(this,t,n,r))},e.prototype.declaration=function(t,n,r){return this.stream.write(e.__super__.declaration.call(this,t,n,r))},e.prototype.docType=function(t,e,n){var o,i,a,s;if(n||(n=0),this.openNode(t,e,n),e.state=r.OpenTag,this.stream.write(this.indent(t,e,n)),this.stream.write("<!DOCTYPE "+t.root().name),t.pubID&&t.sysID?this.stream.write(' PUBLIC "'+t.pubID+'" "'+t.sysID+'"'):t.sysID&&this.stream.write(' SYSTEM "'+t.sysID+'"'),t.children.length>0){for(this.stream.write(" ["),this.stream.write(this.endline(t,e,n)),e.state=r.InsideTag,i=0,a=(s=t.children).length;i<a;i++)o=s[i],this.writeChildNode(o,e,n+1);e.state=r.CloseTag,this.stream.write("]")}return e.state=r.CloseTag,this.stream.write(e.spaceBeforeSlash+">"),this.stream.write(this.endline(t,e,n)),e.state=r.None,this.closeNode(t,e,n)},e.prototype.element=function(t,e,o){var a,s,u,c,l,f,h,p,d;for(h in o||(o=0),this.openNode(t,e,o),e.state=r.OpenTag,this.stream.write(this.indent(t,e,o)+"<"+t.name),p=t.attribs)i.call(p,h)&&(a=p[h],this.attribute(a,e,o));if(c=0===(u=t.children.length)?null:t.children[0],0===u||t.children.every((function(t){return(t.type===n.Text||t.type===n.Raw)&&""===t.value})))e.allowEmpty?(this.stream.write(">"),e.state=r.CloseTag,this.stream.write("</"+t.name+">")):(e.state=r.CloseTag,this.stream.write(e.spaceBeforeSlash+"/>"));else if(!e.pretty||1!==u||c.type!==n.Text&&c.type!==n.Raw||null==c.value){for(this.stream.write(">"+this.endline(t,e,o)),e.state=r.InsideTag,l=0,f=(d=t.children).length;l<f;l++)s=d[l],this.writeChildNode(s,e,o+1);e.state=r.CloseTag,this.stream.write(this.indent(t,e,o)+"</"+t.name+">")}else this.stream.write(">"),e.state=r.InsideTag,e.suppressPrettyCount++,this.writeChildNode(c,e,o+1),e.suppressPrettyCount--,e.state=r.CloseTag,this.stream.write("</"+t.name+">");return this.stream.write(this.endline(t,e,o)),e.state=r.None,this.closeNode(t,e,o)},e.prototype.processingInstruction=function(t,n,r){return this.stream.write(e.__super__.processingInstruction.call(this,t,n,r))},e.prototype.raw=function(t,n,r){return this.stream.write(e.__super__.raw.call(this,t,n,r))},e.prototype.text=function(t,n,r){return this.stream.write(e.__super__.text.call(this,t,n,r))},e.prototype.dtdAttList=function(t,n,r){return this.stream.write(e.__super__.dtdAttList.call(this,t,n,r))},e.prototype.dtdElement=function(t,n,r){return this.stream.write(e.__super__.dtdElement.call(this,t,n,r))},e.prototype.dtdEntity=function(t,n,r){return this.stream.write(e.__super__.dtdEntity.call(this,t,n,r))},e.prototype.dtdNotation=function(t,n,r){return this.stream.write(e.__super__.dtdNotation.call(this,t,n,r))},e}(o)}).call(void 0)},{"./NodeType":251,"./WriterState":253,"./XMLWriterBase":281}],278:[function(t,e,n){"use strict";(function(){var n,r={}.hasOwnProperty;n=t("./XMLWriterBase"),e.exports=function(t){function e(t){e.__super__.constructor.call(this,t)}return function(t,e){for(var n in e)r.call(e,n)&&(t[n]=e[n]);function o(){this.constructor=t}o.prototype=e.prototype,t.prototype=new o,t.__super__=e.prototype}(e,t),e.prototype.document=function(t,e){var n,r,o,i,a;for(e=this.filterOptions(e),i="",r=0,o=(a=t.children).length;r<o;r++)n=a[r],i+=this.writeChildNode(n,e,0);return e.pretty&&i.slice(-e.newline.length)===e.newline&&(i=i.slice(0,-e.newline.length)),i},e}(n)}).call(void 0)},{"./XMLWriterBase":281}],279:[function(t,e,n){"use strict";(function(){var t=function(t,e){return function(){return t.apply(e,arguments)}},n={}.hasOwnProperty;e.exports=function(){function e(e){var r,o,i;for(r in this.assertLegalName=t(this.assertLegalName,this),this.assertLegalChar=t(this.assertLegalChar,this),e||(e={}),this.options=e,this.options.version||(this.options.version="1.0"),o=e.stringify||{})n.call(o,r)&&(i=o[r],this[r]=i)}return e.prototype.name=function(t){return this.options.noValidation?t:this.assertLegalName(""+t||"")},e.prototype.text=function(t){return this.options.noValidation?t:this.assertLegalChar(this.textEscape(""+t||""))},e.prototype.cdata=function(t){return this.options.noValidation?t:(t=(t=""+t||"").replace("]]>","]]]]><![CDATA[>"),this.assertLegalChar(t))},e.prototype.comment=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/--/))throw new Error("Comment text cannot contain double-hypen: "+t);return this.assertLegalChar(t)},e.prototype.raw=function(t){return this.options.noValidation?t:""+t||""},e.prototype.attValue=function(t){return this.options.noValidation?t:this.assertLegalChar(this.attEscape(t=""+t||""))},e.prototype.insTarget=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.insValue=function(t){if(this.options.noValidation)return t;if((t=""+t||"").match(/\?>/))throw new Error("Invalid processing instruction value: "+t);return this.assertLegalChar(t)},e.prototype.xmlVersion=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/1\.[0-9]+/))throw new Error("Invalid version number: "+t);return t},e.prototype.xmlEncoding=function(t){if(this.options.noValidation)return t;if(!(t=""+t||"").match(/^[A-Za-z](?:[A-Za-z0-9._-])*$/))throw new Error("Invalid encoding: "+t);return this.assertLegalChar(t)},e.prototype.xmlStandalone=function(t){return this.options.noValidation?t:t?"yes":"no"},e.prototype.dtdPubID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdSysID=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdElementValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdAttType=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdAttDefault=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdEntityValue=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.dtdNData=function(t){return this.options.noValidation?t:this.assertLegalChar(""+t||"")},e.prototype.convertAttKey="@",e.prototype.convertPIKey="?",e.prototype.convertTextKey="#text",e.prototype.convertCDataKey="#cdata",e.prototype.convertCommentKey="#comment",e.prototype.convertRawKey="#raw",e.prototype.assertLegalChar=function(t){var e,n;if(this.options.noValidation)return t;if(e="","1.0"===this.options.version){if(e=/[\0-\x08\x0B\f\x0E-\x1F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,n=t.match(e))throw new Error("Invalid character in string: "+t+" at index "+n.index)}else if("1.1"===this.options.version&&(e=/[\0\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,n=t.match(e)))throw new Error("Invalid character in string: "+t+" at index "+n.index);return t},e.prototype.assertLegalName=function(t){var e;if(this.options.noValidation)return t;if(this.assertLegalChar(t),e=/^([:A-Z_a-z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])([\x2D\.0-:A-Z_a-z\xB7\xC0-\xD6\xD8-\xF6\xF8-\u037D\u037F-\u1FFF\u200C\u200D\u203F\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]|[\uD800-\uDB7F][\uDC00-\uDFFF])*$/,!t.match(e))throw new Error("Invalid character in name");return t},e.prototype.textEscape=function(t){var e;return this.options.noValidation?t:(e=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,t.replace(e,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\r/g,"&#xD;"))},e.prototype.attEscape=function(t){var e;return this.options.noValidation?t:(e=this.options.noDoubleEncoding?/(?!&\S+;)&/g:/&/g,t.replace(e,"&amp;").replace(/</g,"&lt;").replace(/"/g,"&quot;").replace(/\t/g,"&#x9;").replace(/\n/g,"&#xA;").replace(/\r/g,"&#xD;"))},e}()}).call(void 0)},{}],280:[function(t,e,n){"use strict";var r,o=t("babel-runtime/core-js/object/create"),i=(r=o)&&r.__esModule?r:{default:r};(function(){var n,r,o={}.hasOwnProperty;n=t("./NodeType"),r=t("./XMLCharacterData"),e.exports=function(t){function e(t,r){if(e.__super__.constructor.call(this,t),null==r)throw new Error("Missing element text. "+this.debugInfo());this.name="#text",this.type=n.Text,this.value=this.stringify.text(r)}return function(t,e){for(var n in e)o.call(e,n)&&(t[n]=e[n]);function r(){this.constructor=t}r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype}(e,t),Object.defineProperty(e.prototype,"isElementContentWhitespace",{get:function(){throw new Error("This DOM method is not implemented."+this.debugInfo())}}),Object.defineProperty(e.prototype,"wholeText",{get:function(){var t,e,n;for(n="",e=this.previousSibling;e;)n=e.data+n,e=e.previousSibling;for(n+=this.data,t=this.nextSibling;t;)n+=t.data,t=t.nextSibling;return n}}),e.prototype.clone=function(){return(0,i.default)(this)},e.prototype.toString=function(t){return this.options.writer.text(this,this.options.writer.filterOptions(t))},e.prototype.splitText=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e.prototype.replaceWholeText=function(t){throw new Error("This DOM method is not implemented."+this.debugInfo())},e}(r)}).call(void 0)},{"./NodeType":251,"./XMLCharacterData":256,"babel-runtime/core-js/object/create":55}],281:[function(t,e,n){"use strict";(function(){var n,r,o,i={}.hasOwnProperty;o=t("./Utility").assign,n=t("./NodeType"),t("./XMLDeclaration"),t("./XMLDocType"),t("./XMLCData"),t("./XMLComment"),t("./XMLElement"),t("./XMLRaw"),t("./XMLText"),t("./XMLProcessingInstruction"),t("./XMLDummy"),t("./XMLDTDAttList"),t("./XMLDTDElement"),t("./XMLDTDEntity"),t("./XMLDTDNotation"),r=t("./WriterState"),e.exports=function(){function t(t){var e,n,r;for(e in t||(t={}),this.options=t,n=t.writer||{})i.call(n,e)&&(r=n[e],this["_"+e]=this[e],this[e]=r)}return t.prototype.filterOptions=function(t){var e,n,i,a,s,u,c,l;return t||(t={}),t=o({},this.options,t),(e={writer:this}).pretty=t.pretty||!1,e.allowEmpty=t.allowEmpty||!1,e.indent=null!=(n=t.indent)?n:" ",e.newline=null!=(i=t.newline)?i:"\n",e.offset=null!=(a=t.offset)?a:0,e.dontPrettyTextNodes=null!=(s=null!=(u=t.dontPrettyTextNodes)?u:t.dontprettytextnodes)?s:0,e.spaceBeforeSlash=null!=(c=null!=(l=t.spaceBeforeSlash)?l:t.spacebeforeslash)?c:"",!0===e.spaceBeforeSlash&&(e.spaceBeforeSlash=" "),e.suppressPrettyCount=0,e.user={},e.state=r.None,e},t.prototype.indent=function(t,e,n){var r;return!e.pretty||e.suppressPrettyCount?"":e.pretty&&(r=(n||0)+e.offset+1)>0?new Array(r).join(e.indent):""},t.prototype.endline=function(t,e,n){return!e.pretty||e.suppressPrettyCount?"":e.newline},t.prototype.attribute=function(t,e,n){var r;return this.openAttribute(t,e,n),r=" "+t.name+'="'+t.value+'"',this.closeAttribute(t,e,n),r},t.prototype.cdata=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n)+"<![CDATA[",e.state=r.InsideTag,o+=t.value,e.state=r.CloseTag,o+="]]>"+this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.comment=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n)+"\x3c!-- ",e.state=r.InsideTag,o+=t.value,e.state=r.CloseTag,o+=" --\x3e"+this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.declaration=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n)+"<?xml",e.state=r.InsideTag,o+=' version="'+t.version+'"',null!=t.encoding&&(o+=' encoding="'+t.encoding+'"'),null!=t.standalone&&(o+=' standalone="'+t.standalone+'"'),e.state=r.CloseTag,o+=e.spaceBeforeSlash+"?>",o+=this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.docType=function(t,e,n){var o,i,a,s,u;if(n||(n=0),this.openNode(t,e,n),e.state=r.OpenTag,s=this.indent(t,e,n),s+="<!DOCTYPE "+t.root().name,t.pubID&&t.sysID?s+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.sysID&&(s+=' SYSTEM "'+t.sysID+'"'),t.children.length>0){for(s+=" [",s+=this.endline(t,e,n),e.state=r.InsideTag,i=0,a=(u=t.children).length;i<a;i++)o=u[i],s+=this.writeChildNode(o,e,n+1);e.state=r.CloseTag,s+="]"}return e.state=r.CloseTag,s+=e.spaceBeforeSlash+">",s+=this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),s},t.prototype.element=function(t,e,o){var a,s,u,c,l,f,h,p,d,m,v,g,y,b;for(d in o||(o=0),m=!1,v="",this.openNode(t,e,o),e.state=r.OpenTag,v+=this.indent(t,e,o)+"<"+t.name,g=t.attribs)i.call(g,d)&&(a=g[d],v+=this.attribute(a,e,o));if(c=0===(u=t.children.length)?null:t.children[0],0===u||t.children.every((function(t){return(t.type===n.Text||t.type===n.Raw)&&""===t.value})))e.allowEmpty?(v+=">",e.state=r.CloseTag,v+="</"+t.name+">"+this.endline(t,e,o)):(e.state=r.CloseTag,v+=e.spaceBeforeSlash+"/>"+this.endline(t,e,o));else if(!e.pretty||1!==u||c.type!==n.Text&&c.type!==n.Raw||null==c.value){if(e.dontPrettyTextNodes)for(l=0,h=(y=t.children).length;l<h;l++)if(((s=y[l]).type===n.Text||s.type===n.Raw)&&null!=s.value){e.suppressPrettyCount++,m=!0;break}for(v+=">"+this.endline(t,e,o),e.state=r.InsideTag,f=0,p=(b=t.children).length;f<p;f++)s=b[f],v+=this.writeChildNode(s,e,o+1);e.state=r.CloseTag,v+=this.indent(t,e,o)+"</"+t.name+">",m&&e.suppressPrettyCount--,v+=this.endline(t,e,o),e.state=r.None}else v+=">",e.state=r.InsideTag,e.suppressPrettyCount++,m=!0,v+=this.writeChildNode(c,e,o+1),e.suppressPrettyCount--,m=!1,e.state=r.CloseTag,v+="</"+t.name+">"+this.endline(t,e,o);return this.closeNode(t,e,o),v},t.prototype.writeChildNode=function(t,e,r){switch(t.type){case n.CData:return this.cdata(t,e,r);case n.Comment:return this.comment(t,e,r);case n.Element:return this.element(t,e,r);case n.Raw:return this.raw(t,e,r);case n.Text:return this.text(t,e,r);case n.ProcessingInstruction:return this.processingInstruction(t,e,r);case n.Dummy:return"";case n.Declaration:return this.declaration(t,e,r);case n.DocType:return this.docType(t,e,r);case n.AttributeDeclaration:return this.dtdAttList(t,e,r);case n.ElementDeclaration:return this.dtdElement(t,e,r);case n.EntityDeclaration:return this.dtdEntity(t,e,r);case n.NotationDeclaration:return this.dtdNotation(t,e,r);default:throw new Error("Unknown XML node type: "+t.constructor.name)}},t.prototype.processingInstruction=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n)+"<?",e.state=r.InsideTag,o+=t.target,t.value&&(o+=" "+t.value),e.state=r.CloseTag,o+=e.spaceBeforeSlash+"?>",o+=this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.raw=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n),e.state=r.InsideTag,o+=t.value,e.state=r.CloseTag,o+=this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.text=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n),e.state=r.InsideTag,o+=t.value,e.state=r.CloseTag,o+=this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.dtdAttList=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n)+"<!ATTLIST",e.state=r.InsideTag,o+=" "+t.elementName+" "+t.attributeName+" "+t.attributeType,"#DEFAULT"!==t.defaultValueType&&(o+=" "+t.defaultValueType),t.defaultValue&&(o+=' "'+t.defaultValue+'"'),e.state=r.CloseTag,o+=e.spaceBeforeSlash+">"+this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.dtdElement=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n)+"<!ELEMENT",e.state=r.InsideTag,o+=" "+t.name+" "+t.value,e.state=r.CloseTag,o+=e.spaceBeforeSlash+">"+this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.dtdEntity=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n)+"<!ENTITY",e.state=r.InsideTag,t.pe&&(o+=" %"),o+=" "+t.name,t.value?o+=' "'+t.value+'"':(t.pubID&&t.sysID?o+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.sysID&&(o+=' SYSTEM "'+t.sysID+'"'),t.nData&&(o+=" NDATA "+t.nData)),e.state=r.CloseTag,o+=e.spaceBeforeSlash+">"+this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.dtdNotation=function(t,e,n){var o;return this.openNode(t,e,n),e.state=r.OpenTag,o=this.indent(t,e,n)+"<!NOTATION",e.state=r.InsideTag,o+=" "+t.name,t.pubID&&t.sysID?o+=' PUBLIC "'+t.pubID+'" "'+t.sysID+'"':t.pubID?o+=' PUBLIC "'+t.pubID+'"':t.sysID&&(o+=' SYSTEM "'+t.sysID+'"'),e.state=r.CloseTag,o+=e.spaceBeforeSlash+">"+this.endline(t,e,n),e.state=r.None,this.closeNode(t,e,n),o},t.prototype.openNode=function(t,e,n){},t.prototype.closeNode=function(t,e,n){},t.prototype.openAttribute=function(t,e,n){},t.prototype.closeAttribute=function(t,e,n){},t}()}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLCData":255,"./XMLComment":257,"./XMLDTDAttList":262,"./XMLDTDElement":263,"./XMLDTDEntity":264,"./XMLDTDNotation":265,"./XMLDeclaration":266,"./XMLDocType":267,"./XMLDummy":270,"./XMLElement":271,"./XMLProcessingInstruction":275,"./XMLRaw":276,"./XMLText":280}],282:[function(t,e,n){"use strict";(function(){var n,r,o,i,a,s,u,c,l,f;f=t("./Utility"),c=f.assign,l=f.isFunction,o=t("./XMLDOMImplementation"),i=t("./XMLDocument"),a=t("./XMLDocumentCB"),u=t("./XMLStringWriter"),s=t("./XMLStreamWriter"),n=t("./NodeType"),r=t("./WriterState"),e.exports.create=function(t,e,n,r){var o,a;if(null==t)throw new Error("Root element needs a name.");return r=c({},e,n,r),a=(o=new i(r)).element(t),r.headless||(o.declaration(r),null==r.pubID&&null==r.sysID||o.dtd(r)),a},e.exports.begin=function(t,e,n){var r;return l(t)&&(e=(r=[t,e])[0],n=r[1],t={}),e?new a(t,e,n):new i(t)},e.exports.stringWriter=function(t){return new u(t)},e.exports.streamWriter=function(t,e){return new s(t,e)},e.exports.implementation=new o,e.exports.nodeType=n,e.exports.writerState=r}).call(void 0)},{"./NodeType":251,"./Utility":252,"./WriterState":253,"./XMLDOMImplementation":260,"./XMLDocument":268,"./XMLDocumentCB":269,"./XMLStreamWriter":277,"./XMLStringWriter":278}],283:[function(t,e,n){e.exports=function(){for(var t={},e=0;e<arguments.length;e++){var n=arguments[e];for(var o in n)r.call(n,o)&&(t[o]=n[o])}return t};var r=Object.prototype.hasOwnProperty},{}],284:[function(t,e,n){"use strict";var r=t("buffer").Buffer,o={sha1:t("./sha"),md5:t("./md5")},i=r.alloc(64);function a(t,e){var n=o[t=t||"sha1"],a=[];return n||s("algorithm:",t,"is not yet supported"),{update:function(t){return r.isBuffer(t)||(t=r.from(t)),a.push(t),t.length,this},digest:function(t){var o=r.concat(a),s=e?function(t,e,n){r.isBuffer(e)||(e=r.from(e)),r.isBuffer(n)||(n=r.from(n)),e.length>64?e=t(e):e.length<64&&(e=r.concat([e,i],64));for(var o=r.alloc(64),a=r.alloc(64),s=0;s<64;s++)o[s]=54^e[s],a[s]=92^e[s];var u=t(r.concat([o,n]));return t(r.concat([a,u]))}(n,e,o):n(o);return a=null,t?s.toString(t):s}}}function s(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join("\n"))}i.fill(0),n.createHash=function(t){return a(t)},n.createHmac=function(t,e){return a(t,e)},n.createCredentials=function(){s("sorry,createCredentials is not implemented yet")},n.createCipher=function(){s("sorry,createCipher is not implemented yet")},n.createCipheriv=function(){s("sorry,createCipheriv is not implemented yet")},n.createDecipher=function(){s("sorry,createDecipher is not implemented yet")},n.createDecipheriv=function(){s("sorry,createDecipheriv is not implemented yet")},n.createSign=function(){s("sorry,createSign is not implemented yet")},n.createVerify=function(){s("sorry,createVerify is not implemented yet")},n.createDiffieHellman=function(){s("sorry,createDiffieHellman is not implemented yet")},n.pbkdf2=function(){s("sorry,pbkdf2 is not implemented yet")}},{"./md5":286,"./sha":287,buffer:73}],285:[function(t,e,n){"use strict";var r=t("buffer").Buffer,o=r.alloc(4);o.fill(0),e.exports={hash:function(t,e,n,i){return r.isBuffer(t)||(t=r.from(t)),function(t,e,n){for(var o=r.alloc(e),i=n?o.writeInt32BE:o.writeInt32LE,a=0;a<t.length;a++)i.call(o,t[a],4*a,!0);return o}(e(function(t,e){if(t.length%4!=0){var n=t.length+(4-t.length%4);t=r.concat([t,o],n)}for(var i=[],a=e?t.readInt32BE:t.readInt32LE,s=0;s<t.length;s+=4)i.push(a.call(t,s));return i}(t,i),8*t.length),n,i)}}},{buffer:73}],286:[function(t,e,n){"use strict";var r=t("./helpers");function o(t,e){t[e>>5]|=128<<e%32,t[14+(e+64>>>9<<4)]=e;for(var n=1732584193,r=-271733879,o=-1732584194,i=271733878,f=0;f<t.length;f+=16){var h=n,p=r,d=o,m=i;n=a(n,r,o,i,t[f+0],7,-680876936),i=a(i,n,r,o,t[f+1],12,-389564586),o=a(o,i,n,r,t[f+2],17,606105819),r=a(r,o,i,n,t[f+3],22,-1044525330),n=a(n,r,o,i,t[f+4],7,-176418897),i=a(i,n,r,o,t[f+5],12,1200080426),o=a(o,i,n,r,t[f+6],17,-1473231341),r=a(r,o,i,n,t[f+7],22,-45705983),n=a(n,r,o,i,t[f+8],7,1770035416),i=a(i,n,r,o,t[f+9],12,-1958414417),o=a(o,i,n,r,t[f+10],17,-42063),r=a(r,o,i,n,t[f+11],22,-1990404162),n=a(n,r,o,i,t[f+12],7,1804603682),i=a(i,n,r,o,t[f+13],12,-40341101),o=a(o,i,n,r,t[f+14],17,-1502002290),n=s(n,r=a(r,o,i,n,t[f+15],22,1236535329),o,i,t[f+1],5,-165796510),i=s(i,n,r,o,t[f+6],9,-1069501632),o=s(o,i,n,r,t[f+11],14,643717713),r=s(r,o,i,n,t[f+0],20,-373897302),n=s(n,r,o,i,t[f+5],5,-701558691),i=s(i,n,r,o,t[f+10],9,38016083),o=s(o,i,n,r,t[f+15],14,-660478335),r=s(r,o,i,n,t[f+4],20,-405537848),n=s(n,r,o,i,t[f+9],5,568446438),i=s(i,n,r,o,t[f+14],9,-1019803690),o=s(o,i,n,r,t[f+3],14,-187363961),r=s(r,o,i,n,t[f+8],20,1163531501),n=s(n,r,o,i,t[f+13],5,-1444681467),i=s(i,n,r,o,t[f+2],9,-51403784),o=s(o,i,n,r,t[f+7],14,1735328473),n=u(n,r=s(r,o,i,n,t[f+12],20,-1926607734),o,i,t[f+5],4,-378558),i=u(i,n,r,o,t[f+8],11,-2022574463),o=u(o,i,n,r,t[f+11],16,1839030562),r=u(r,o,i,n,t[f+14],23,-35309556),n=u(n,r,o,i,t[f+1],4,-1530992060),i=u(i,n,r,o,t[f+4],11,1272893353),o=u(o,i,n,r,t[f+7],16,-155497632),r=u(r,o,i,n,t[f+10],23,-1094730640),n=u(n,r,o,i,t[f+13],4,681279174),i=u(i,n,r,o,t[f+0],11,-358537222),o=u(o,i,n,r,t[f+3],16,-722521979),r=u(r,o,i,n,t[f+6],23,76029189),n=u(n,r,o,i,t[f+9],4,-640364487),i=u(i,n,r,o,t[f+12],11,-421815835),o=u(o,i,n,r,t[f+15],16,530742520),n=c(n,r=u(r,o,i,n,t[f+2],23,-995338651),o,i,t[f+0],6,-198630844),i=c(i,n,r,o,t[f+7],10,1126891415),o=c(o,i,n,r,t[f+14],15,-1416354905),r=c(r,o,i,n,t[f+5],21,-57434055),n=c(n,r,o,i,t[f+12],6,1700485571),i=c(i,n,r,o,t[f+3],10,-1894986606),o=c(o,i,n,r,t[f+10],15,-1051523),r=c(r,o,i,n,t[f+1],21,-2054922799),n=c(n,r,o,i,t[f+8],6,1873313359),i=c(i,n,r,o,t[f+15],10,-30611744),o=c(o,i,n,r,t[f+6],15,-1560198380),r=c(r,o,i,n,t[f+13],21,1309151649),n=c(n,r,o,i,t[f+4],6,-145523070),i=c(i,n,r,o,t[f+11],10,-1120210379),o=c(o,i,n,r,t[f+2],15,718787259),r=c(r,o,i,n,t[f+9],21,-343485551),n=l(n,h),r=l(r,p),o=l(o,d),i=l(i,m)}return Array(n,r,o,i)}function i(t,e,n,r,o,i){return l((a=l(l(e,t),l(r,i)))<<(s=o)|a>>>32-s,n);var a,s}function a(t,e,n,r,o,a,s){return i(e&n|~e&r,t,e,o,a,s)}function s(t,e,n,r,o,a,s){return i(e&r|n&~r,t,e,o,a,s)}function u(t,e,n,r,o,a,s){return i(e^n^r,t,e,o,a,s)}function c(t,e,n,r,o,a,s){return i(n^(e|~r),t,e,o,a,s)}function l(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}e.exports=function(t){return r.hash(t,o,16)}},{"./helpers":285}],287:[function(t,e,n){"use strict";var r=t("./helpers");function o(t,e){t[e>>5]|=128<<24-e%32,t[15+(e+64>>9<<4)]=e;for(var n=Array(80),r=1732584193,o=-271733879,c=-1732584194,l=271733878,f=-1009589776,h=0;h<t.length;h+=16){for(var p=r,d=o,m=c,v=l,g=f,y=0;y<80;y++){n[y]=y<16?t[h+y]:u(n[y-3]^n[y-8]^n[y-14]^n[y-16],1);var b=s(s(u(r,5),i(y,o,c,l)),s(s(f,n[y]),a(y)));f=l,l=c,c=u(o,30),o=r,r=b}r=s(r,p),o=s(o,d),c=s(c,m),l=s(l,v),f=s(f,g)}return Array(r,o,c,l,f)}function i(t,e,n,r){return t<20?e&n|~e&r:t<40?e^n^r:t<60?e&n|e&r|n&r:e^n^r}function a(t){return t<20?1518500249:t<40?1859775393:t<60?-1894007588:-899497514}function s(t,e){var n=(65535&t)+(65535&e);return(t>>16)+(e>>16)+(n>>16)<<16|65535&n}function u(t,e){return t<<e|t>>>32-e}e.exports=function(t){return r.hash(t,o,20,!0)}},{"./helpers":285}],288:[function(t,e,n){"use strict";e.exports=function(){return function(){}}},{}],289:[function(t,e,n){(function(n){"use strict";var r,o=t("babel-runtime/helpers/typeof"),i=(r=o)&&r.__esModule?r:{default:r},a=t("stream").Stream,s=t("../lib/common/utils/isArray").isArray;e.exports.string=function(t){return"string"==typeof t},e.exports.array=s,e.exports.buffer=n.isBuffer,e.exports.writableStream=function(t){return function(t){return t instanceof a}(t)&&"function"==typeof t._write&&"object"===(0,i.default)(t._writableState)}}).call(this,{isBuffer:t("../node_modules/is-buffer/index.js")})},{"../lib/common/utils/isArray":42,"../node_modules/is-buffer/index.js":197,"babel-runtime/helpers/typeof":67,stream:230}],290:[function(t,e,n){"use strict";n.encodeURIComponent=function(t){try{return encodeURIComponent(t)}catch(e){return t}},n.escape=t("escape-html"),n.timestamp=function(t){if(t){var e=t;return"string"==typeof e&&(e=Number(e)),10===String(t).length&&(e*=1e3),new Date(e)}return Math.round(Date.now()/1e3)}},{"escape-html":191}],291:[function(t,e,n){(function(e,r){"use strict";var o=a(t("babel-runtime/core-js/json/stringify")),i=a(t("babel-runtime/helpers/typeof"));function a(t){return t&&t.__esModule?t:{default:t}}var s,u=t("util"),c=t("url"),l=t("http"),f=t("https"),h=t("debug")("urllib"),p=t("humanize-ms"),d=0,m=Math.pow(2,31)-10,v=/^https?:\/\//i;function g(t,e){return void 0===t?e:t}function y(t,e){return function(n,r,o){if(n)return e(n);t({data:r,status:o.statusCode,headers:o.headers,res:o})}}n.TIMEOUTS=[p("300s"),p("300s")];var b=["json","text"];n.request=function(e,r,o){return 2===arguments.length&&"function"==typeof r&&(o=r,r=null),"function"==typeof o?n.requestWithCallback(e,r,o):(s||(s=t("any-promise")),new s((function(t,o){n.requestWithCallback(e,r,y(t,o))})))},n.requestWithCallback=function(a,s,y){if(!a||"string"!=typeof a&&"object"!==(void 0===a?"undefined":(0,i.default)(a))){var w=u.format("expect request url to be a string or a http request options, but got %j",a);throw new Error(w)}2===arguments.length&&"function"==typeof s&&(y=s,s=null),d>=m&&(d=0);var x=++d;(s=s||{}).requestUrls=s.requestUrls||[];var _={requestId:x,url:a,args:s,ctx:s.ctx};s.emitter&&s.emitter.emit("request",_),s.timeout=s.timeout||n.TIMEOUTS,s.maxRedirects=s.maxRedirects||10,s.streaming=s.streaming||s.customResponse;var E,C=Date.now();"string"==typeof a?(v.test(a)||(a="http://"+a),E=c.parse(a)):E=a;var S=(s.type||s.method||E.method||"GET").toUpperCase(),k=E.port||80,T=l,I=g(s.agent,n.agent),O=s.fixJSONCtlChars;"https:"===E.protocol&&(T=f,I=g(s.httpsAgent,n.httpsAgent),E.port||(k=443));var R={host:E.hostname||E.host||"localhost",path:E.path||"/",method:S,port:k,agent:I,headers:s.headers||{},lookup:s.lookup};Array.isArray(s.timeout)?R.requestTimeout=s.timeout[s.timeout.length-1]:void 0!==s.timeout&&(R.requestTimeout=s.timeout);for(var A=["pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","secureProtocol","secureOptions"],D=0;D<A.length;D++){var N=A[D];s.hasOwnProperty(N)&&(R[N]=s[N])}!1!==R.rejectUnauthorized||R.hasOwnProperty("secureOptions")||(R.secureOptions=t("constants").SSL_OP_NO_TLSv1_2);var P=s.auth||E.auth;P&&(R.auth=P);var M=s.content||s.data,j="GET"===S||"HEAD"===S||s.dataAsQueryString;if(!s.content&&M&&"string"!=typeof M&&!r.isBuffer(M))if(j)M=s.nestedQuerystring?qs.stringify(M):querystring.stringify(M);else{var F=R.headers["Content-Type"]||R.headers["content-type"];F||(F="json"===s.contentType?"application/json":"application/x-www-form-urlencoded",R.headers["Content-Type"]=F),M="application/json"===parseContentType(F).type?(0,o.default)(M):s.nestedQuerystring?qs.stringify(M):querystring.stringify(M)}j&&M&&(R.path+=(E.query?"&":"?")+M,M=null);var B=0;if(M){var L=M.length;r.isBuffer(M)||(L=r.byteLength(M)),B=R.headers["Content-Length"]=L}"json"===s.dataType&&(R.headers.Accept="application/json"),"function"==typeof s.beforeRequest&&s.beforeRequest(R);var U=null,W=null,z=null,V=!1,q=!1,G=0,H=-1,X=!1,K="",Y="",$=null;function J(){U&&(clearTimeout(U),U=null)}function Q(){W&&(clearTimeout(W),W=null)}function Z(t,r,i){if(Q(),!y)return console.warn("[urllib:warn] [%s] [%s] [worker:%s] %s %s callback twice!!!",Date(),x,e.pid,R.method,a),void(t&&console.warn("[urllib:warn] [%s] [%s] [worker:%s] %s: %s\nstack: %s",Date(),x,e.pid,t.name,t.message,t.stack));var u=y;y=null;var c={};if(i&&(H=i.statusCode,c=i.headers),401===H&&c["www-authenticate"]&&(!s.headers||!s.headers.Authorization)&&s.digestAuth){var l=c["www-authenticate"];if(l.indexOf("Digest ")>=0)return h("Request#%d %s: got digest auth header WWW-Authenticate: %s",x,a,l),s.headers=s.headers||{},s.headers.Authorization=digestAuthHeader(R.method,R.path,l,s.digestAuth),h("Request#%d %s: auth with digest header: %s",x,a,s.headers.Authorization),i.headers["set-cookie"]&&(s.headers.Cookie=i.headers["set-cookie"].join(";")),n.requestWithCallback(a,s,u)}var f=Date.now()-C;$&&($.contentDownload=f),h("[%sms] done, %s bytes HTTP %s %s %s %s, keepAliveSocket: %s, timing: %j",f,G,H,R.method,R.host,R.path,q,$);var p={status:H,statusCode:H,headers:c,size:G,aborted:X,rt:f,keepAliveSocket:q,data:r,requestUrls:s.requestUrls,timing:$,remoteAddress:K,remotePort:Y};if(t){var d="";I&&"function"==typeof I.getCurrentStatus&&(d=", agent status: "+(0,o.default)(I.getCurrentStatus())),t.message+=", "+R.method+" "+a+" "+H+" (connected: "+V+", keepalive socket: "+q+d+")\nheaders: "+(0,o.default)(c),t.data=r,t.path=R.path,t.status=H,t.headers=c,t.res=p}u(t,r,s.streaming?i:p),s.emitter&&(_.url=a,_.socket=ot&&ot.connection,_.options=R,_.size=B,s.emitter.emit("response",{requestId:x,error:t,ctx:s.ctx,req:_,res:p}))}function tt(t){var e=null;if(s.followRedirect&&statuses.redirect[t.statusCode]){s._followRedirectCount=(s._followRedirectCount||0)+1;var r=t.headers.location;if(r){if(!(s._followRedirectCount>s.maxRedirects)){var o=s.formatRedirectUrl?s.formatRedirectUrl(a,r):c.resolve(a,r);h("Request#%d %s: `redirected` from %s to %s",x,R.path,a,o),Q(),s.headers&&s.headers.Host&&v.test(r)&&(s.headers.Host=null);var i=y;return y=null,n.requestWithCallback(o,s,i),{redirect:!0,error:null}}(e=new Error("Exceeded maxRedirects. Probably stuck in a redirect loop "+a)).name="MaxRedirectError"}else(e=new Error("Got statusCode "+t.statusCode+" but cannot resolve next location from headers")).name="FollowRedirectError"}return{redirect:!1,error:e}}function et(t,e,n){return n(null,e,t.headers["content-encoding"])}s.timing&&($={queuing:0,dnslookup:0,connected:0,requestSent:0,waiting:0,contentDownload:0}),R.headers["User-Agent"]||R.headers["user-agent"]||(R.headers["User-Agent"]=navigator.userAgent),s.gzip&&(R.headers["Accept-Encoding"]||R.headers["accept-encoding"]||(R.headers["Accept-Encoding"]="gzip"));var nt,rt,ot,it=s.writeStream;function at(t){var e;if($&&($.waiting=Date.now()-C),h("Request#%d %s `req response` event emit: status %d, headers: %j",x,a,t.statusCode,t.headers),s.streaming)return(e=tt(t)).redirect?void t.resume():e.error?(t.resume(),Z(e.error,null,t)):Z(null,null,t);if(t.on("close",(function(){h("Request#%d %s: `res close` event emit, total size %d",x,a,G)})),t.on("error",(function(){h("Request#%d %s: `res error` event emit, total size %d",x,a,G)})),t.on("aborted",(function(){X=!0,h("Request#%d %s: `res aborted` event emit, total size %d",x,a,G)})),it)return(e=tt(t)).redirect?void t.resume():e.error?(t.resume(),it.end(),Z(e.error,null,t)):(!1===s.consumeWriteStream?t.on("end",Z.bind(null,null,null,t)):isNode010||isNode012?first([[it,"close"],[t,"aborted"]],(function(e,n,r){h("Request#%d %s: writeStream or res %s event emitted",x,a,r),Z(z||null,null,t)})):it.on("close",(function(){h("Request#%d %s: writeStream close event emitted",x,a),Z(z||null,null,t)})),t.pipe(it));var n=[];t.on("data",(function(t){h("Request#%d %s: `res data` event emit, size %d",x,a,t.length),G+=t.length,n.push(t)})),t.on("end",(function(){var e=r.concat(n,G);if(h("Request#%d %s: `res end` event emit, total size %d, _dumped: %s",x,a,G,t._dumped),z)return Z(z,e,t);var o=tt(t);if(o.error)return Z(o.error,e,t);o.redirect||et(t,e,(function(n,r,o){if(n)return Z(n,e,t);if(!o&&b.indexOf(s.dataType)>=0){try{r=decodeBodyByCharset(r,t)}catch(e){return h("decodeBodyByCharset error: %s",e),Z(null,r,t)}if("json"===s.dataType)if(0===G)r=null;else{var i=parseJSON(r,O);i.error?n=i.error:r=i.data}}X&&h("Request#%d %s: Remote socket was terminated before `response.end()` was called",x,a),Z(n,r,t)}))}))}function st(){h("Connect timer ticking, timeout: %d",nt),U=setTimeout((function(){U=null,-1===H&&(H=-2);var t="Connect timeout for "+nt+"ms",e="ConnectionTimeoutError";ot.socket||(e="SocketAssignTimeoutError",t+=", working sockets is full"),(z=new Error(t)).name=e,z.requestId=x,h("ConnectTimeout: Request#%d %s %s: %s, connected: %s",x,a,z.name,t,V),ct()}),nt)}function ut(){h("Response timer ticking, timeout: %d",rt),W=setTimeout((function(){W=null;var t="Response timeout for "+rt+"ms";(z=new Error(t)).name="ResponseTimeoutError",z.requestId=x,h("ResponseTimeout: Request#%d %s %s: %s, connected: %s",x,a,z.name,t,V),ct()}),rt)}h("Request#%d %s %s with headers %j, options.path: %s",x,S,a,R.headers,R.path),s.requestUrls.push(a),Array.isArray(s.timeout)?(nt=p(s.timeout[0]),rt=p(s.timeout[1])):nt=rt=p(s.timeout),h("ConnectTimeout: %d, ResponseTimeout: %d",nt,rt),R.mode=s.mode?s.mode:"";try{ot=T.request(R,at)}catch(t){return Z(t)}function ct(){h("Request#%d %s abort, connected: %s",x,a,V),ot.socket||(z.noSocket=!0,Z(z)),ot.abort()}return"undefined"==typeof window?st():ot.on("requestTimeout",(function(){-1===H&&(H=-2),(z=new Error("Connect timeout for "+nt+"ms")).name="ConnectionTimeoutError",z.requestId=x,ct()})),$&&ot.on("finish",(function(){$.requestSent=Date.now()-C})),ot.once("socket",(function(t){$&&($.queuing=Date.now()-C),isNode010&&t.socket&&(t=t.socket);var e=t.readyState;if("opening"===e)return t.once("lookup",(function(t,e,n){h("Request#%d %s lookup: %s, %s, %s",x,a,t,e,n),$&&($.dnslookup=Date.now()-C),e&&(K=e)})),void t.once("connect",(function(){$&&($.connected=Date.now()-C),J(),ut(),h("Request#%d %s new socket connected",x,a),V=!0,K||(K=t.remoteAddress),Y=t.remotePort}));h("Request#%d %s reuse socket connected, readyState: %s",x,a,e),V=!0,q=!0,K||(K=t.remoteAddress),Y=t.remotePort,J(),ut()})),ot.on("error",(function(t){"Error"!==t.name&&"TypeError"!==t.name||(t.name=V?"ResponseError":"RequestError"),t.message+=' (req "error")',h("Request#%d %s `req error` event emit, %s: %s",x,a,t.name,t.message),Z(z||t)})),it&&it.once("error",(function(t){t.message+=' (writeStream "error")',z=t,h("Request#%d %s `writeStream error` event emit, %s: %s",x,a,t.name,t.message),ct()})),s.stream?(s.stream.pipe(ot),s.stream.once("error",(function(t){t.message+=' (stream "error")',z=t,h("Request#%d %s `readStream error` event emit, %s: %s",x,a,t.name,t.message),ct()}))):ot.end(M),ot.requestId=x,ot}}).call(this,t("_process"),t("buffer").Buffer)},{_process:208,"any-promise":49,"babel-runtime/core-js/json/stringify":53,"babel-runtime/helpers/typeof":67,buffer:73,constants:75,debug:288,http:231,https:193,"humanize-ms":194,url:238,util:243}]},{},[1])(1)},module.exports=f()}).call(this,__webpack_require__(/*! ./../../@umijs/deps/compiled/webpack/4/global.js */"IyRk"))},oRuE:
/*!************************************************!*\
!*** ./node_modules/crypto-js/pad-iso10126.js ***!
\************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),r.pad.Iso10126={pad:function(t,e){var n=4*e,o=n-t.sigBytes%n;t.concat(r.lib.WordArray.random(o-1)).concat(r.lib.WordArray.create([o<<24],1))},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},r.pad.Iso10126)},oX8U:
/*!*******************************************************************!*\
!*** ./node_modules/checkapi.js/build/es6/env/createNodejsEnv.js ***!
\*******************************************************************/
/*! exports provided: createNodejsEnv */
/*! exports used: createNodejsEnv */
/*! ModuleConcatenation bailout: Module uses injected variables (global) */function(t,e,n){"use strict";(function(t){n.d(e,"a",(function(){return i}));var r=n(/*! tslib */"mrSG"),o=n(/*! ./createFileSystem */"rOjP");function i(){var e=t.Canvas||t.HTMLCanvasElement,n=t.Image||t.HTMLImageElement,i=t.fetch||function(){throw new Error("fetch - missing fetch implementation for nodejs environment")},a=Object(o.a)();return Object(r.a)({Canvas:e||function(){},CanvasRenderingContext2D:t.CanvasRenderingContext2D||function(){},Image:n||function(){},ImageData:t.ImageData||function(){},Video:t.HTMLVideoElement||function(){},createCanvasElement:function(){if(e)return new e;throw new Error("createCanvasElement - missing Canvas implementation for nodejs environment")},createImageElement:function(){if(n)return new n;throw new Error("createImageElement - missing Image implementation for nodejs environment")},fetch:i},a)}}).call(this,n(/*! ./../../../../@umijs/deps/compiled/webpack/4/global.js */"IyRk"))},pA7S:
/*!*********************************************!*\
!*** ./node_modules/crypto-js/tripledes.js ***!
\*********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./enc-base64 */"ETIr"),n(/*! ./md5 */"cv67"),n(/*! ./evpkdf */"K3mO"),n(/*! ./cipher-core */"OLod"),function(){var t=r,e=t.lib,n=e.WordArray,o=e.BlockCipher,i=t.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],s=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],f=i.DES=o.extend({_doReset:function(){for(var t=this._key.words,e=[],n=0;n<56;n++){var r=a[n]-1;e[n]=t[r>>>5]>>>31-r%32&1}for(var o=this._subKeys=[],i=0;i<16;i++){var c=o[i]=[],l=u[i];for(n=0;n<24;n++)c[n/6|0]|=e[(s[n]-1+l)%28]<<31-n%6,c[4+(n/6|0)]|=e[28+(s[n+24]-1+l)%28]<<31-n%6;for(c[0]=c[0]<<1|c[0]>>>31,n=1;n<7;n++)c[n]=c[n]>>>4*(n-1)+3;c[7]=c[7]<<5|c[7]>>>27}var f=this._invSubKeys=[];for(n=0;n<16;n++)f[n]=o[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,n){this._lBlock=t[e],this._rBlock=t[e+1],h.call(this,4,252645135),h.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),h.call(this,1,1431655765);for(var r=0;r<16;r++){for(var o=n[r],i=this._lBlock,a=this._rBlock,s=0,u=0;u<8;u++)s|=c[u][((a^o[u])&l[u])>>>0];this._lBlock=a,this._rBlock=i^s}var f=this._lBlock;this._lBlock=this._rBlock,this._rBlock=f,h.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),h.call(this,16,65535),h.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function h(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<<t}function p(t,e){var n=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<<t}t.DES=o._createHelper(f);var d=i.TripleDES=o.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),r=t.length<4?t.slice(0,2):t.slice(2,4),o=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=f.createEncryptor(n.create(e)),this._des2=f.createEncryptor(n.create(r)),this._des3=f.createEncryptor(n.create(o))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=o._createHelper(d)}(),r.TripleDES)},qBft:
/*!************************************************!*\
!*** ./node_modules/crypto-js/pad-ansix923.js ***!
\************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),r.pad.AnsiX923={pad:function(t,e){var n=t.sigBytes,r=4*e,o=r-n%r,i=n+o-1;t.clamp(),t.words[i>>>2]|=o<<24-i%4*8,t.sigBytes+=o},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},r.pad.Ansix923)},qM6L:
/*!*********************************************!*\
!*** ./node_modules/crypto-js/enc-utf16.js ***!
\*********************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),function(){var t=r,e=t.lib.WordArray,n=t.enc;function o(t){return t<<8&4278255360|t>>>8&16711935}n.Utf16=n.Utf16BE={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;o<n;o+=2){var i=e[o>>>2]>>>16-o%4*8&65535;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var n=t.length,r=[],o=0;o<n;o++)r[o>>>1]|=t.charCodeAt(o)<<16-o%2*16;return e.create(r,2*n)}},n.Utf16LE={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i+=2){var a=o(e[i>>>2]>>>16-i%4*8&65535);r.push(String.fromCharCode(a))}return r.join("")},parse:function(t){for(var n=t.length,r=[],i=0;i<n;i++)r[i>>>1]|=o(t.charCodeAt(i)<<16-i%2*16);return e.create(r,2*n)}}}(),r.enc.Utf16)},qu8F:
/*!****************************************************!*\
!*** ./node_modules/crypto-js/mode-ctr-gladman.js ***!
\****************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),
/** @preserve
* Counter block mode compatible with Dr Brian Gladman fileenc.c
* derived from CryptoJS.mode.CTR
* Jan Hruby jhruby.web@gmail.com
*/
r.mode.CTRGladman=function(){var t=r.lib.BlockCipherMode.extend();function e(t){if(255==(t>>24&255)){var e=t>>16&255,n=t>>8&255,r=255&t;255===e?(e=0,255===n?(n=0,255===r?r=0:++r):++n):++e,t=0,t+=e<<16,t+=n<<8,t+=r}else t+=1<<24;return t}var n=t.Encryptor=t.extend({processBlock:function(t,n){var r=this._cipher,o=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=i.slice(0),this._iv=void 0),function(t){0===(t[0]=e(t[0]))&&(t[1]=e(t[1]))}(a);var s=a.slice(0);r.encryptBlock(s,0);for(var u=0;u<o;u++)t[n+u]^=s[u]}});return t.Decryptor=n,t}(),r.mode.CTRGladman)},rOjP:
/*!********************************************************************!*\
!*** ./node_modules/checkapi.js/build/es6/env/createFileSystem.js ***!
\********************************************************************/
/*! exports provided: createFileSystem */
/*! exports used: createFileSystem */function(t,e,n){"use strict";function r(t){var e="";if(!t)try{t=n(/*! fs */"Og1z")}catch(t){e=t.toString()}return{readFile:t?function(e){return new Promise((function(n,r){t.readFile(e,(function(t,e){return t?r(t):n(e)}))}))}:function(){throw new Error("readFile - failed to require fs in nodejs environment with error: "+e)}}}n.d(e,"a",(function(){return r}))},uGsb:
/*!******************************************!*\
!*** ./node_modules/crypto-js/sha384.js ***!
\******************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i,a,s,u,c,l;t.exports=(l=n(/*! ./core */"Ib8C"),n(/*! ./x64-core */"MlIO"),n(/*! ./sha512 */"1uat"),o=(r=l).x64,i=o.Word,a=o.WordArray,s=r.algo,u=s.SHA512,c=s.SHA384=u.extend({_doReset:function(){this._hash=new a.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var t=u._doFinalize.call(this);return t.sigBytes-=16,t}}),r.SHA384=u._createHelper(c),r.HmacSHA384=u._createHmacHelper(c),l.SHA384)},uGxW:
/*!*************************************************!*\
!*** ./node_modules/crypto-js/pad-nopadding.js ***!
\*************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./cipher-core */"OLod"),r.pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)},w7YG:
/*!***************************************!*\
!*** ./node_modules/crypto-js/rc4.js ***!
\***************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./enc-base64 */"ETIr"),n(/*! ./md5 */"cv67"),n(/*! ./evpkdf */"K3mO"),n(/*! ./cipher-core */"OLod"),function(){var t=r,e=t.lib.StreamCipher,n=t.algo,o=n.RC4=e.extend({_doReset:function(){for(var t=this._key,e=t.words,n=t.sigBytes,r=this._S=[],o=0;o<256;o++)r[o]=o;o=0;for(var i=0;o<256;o++){var a=o%n,s=e[a>>>2]>>>24-a%4*8&255;i=(i+r[o]+s)%256;var u=r[o];r[o]=r[i],r[i]=u}this._i=this._j=0},_doProcessBlock:function(t,e){t[e]^=i.call(this)},keySize:8,ivSize:0});function i(){for(var t=this._S,e=this._i,n=this._j,r=0,o=0;o<4;o++){n=(n+t[e=(e+1)%256])%256;var i=t[e];t[e]=t[n],t[n]=i,r|=t[(t[e]+t[n])%256]<<24-8*o}return this._i=e,this._j=n,r}t.RC4=e._createHelper(o);var a=n.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var t=this.cfg.drop;t>0;t--)i.call(this)}});t.RC4Drop=e._createHelper(a)}(),r.RC4)},wZgz:
/*!***************************************!*\
!*** ./node_modules/crypto-js/aes.js ***!
\***************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r;t.exports=(r=n(/*! ./core */"Ib8C"),n(/*! ./enc-base64 */"ETIr"),n(/*! ./md5 */"cv67"),n(/*! ./evpkdf */"K3mO"),n(/*! ./cipher-core */"OLod"),function(){var t=r,e=t.lib.BlockCipher,n=t.algo,o=[],i=[],a=[],s=[],u=[],c=[],l=[],f=[],h=[],p=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var n=0,r=0;for(e=0;e<256;e++){var d=r^r<<1^r<<2^r<<3^r<<4;d=d>>>8^255&d^99,o[n]=d,i[d]=n;var m=t[n],v=t[m],g=t[v],y=257*t[d]^16843008*d;a[n]=y<<24|y>>>8,s[n]=y<<16|y>>>16,u[n]=y<<8|y>>>24,c[n]=y,y=16843009*g^65537*v^257*m^16843008*n,l[d]=y<<24|y>>>8,f[d]=y<<16|y>>>16,h[d]=y<<8|y>>>24,p[d]=y,n?(n=m^t[t[t[g^m]]],r^=t[t[r]]):n=r=1}}();var d=[0,1,2,4,8,16,32,64,128,27,54],m=n.AES=e.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,n=t.sigBytes/4,r=4*((this._nRounds=n+6)+1),i=this._keySchedule=[],a=0;a<r;a++)a<n?i[a]=e[a]:(c=i[a-1],a%n?n>6&&a%n==4&&(c=o[c>>>24]<<24|o[c>>>16&255]<<16|o[c>>>8&255]<<8|o[255&c]):(c=o[(c=c<<8|c>>>24)>>>24]<<24|o[c>>>16&255]<<16|o[c>>>8&255]<<8|o[255&c],c^=d[a/n|0]<<24),i[a]=i[a-n]^c);for(var s=this._invKeySchedule=[],u=0;u<r;u++){if(a=r-u,u%4)var c=i[a];else c=i[a-4];s[u]=u<4||a<=4?c:l[o[c>>>24]]^f[o[c>>>16&255]]^h[o[c>>>8&255]]^p[o[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,a,s,u,c,o)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,l,f,h,p,i),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,r,o,i,a,s){for(var u=this._nRounds,c=t[e]^n[0],l=t[e+1]^n[1],f=t[e+2]^n[2],h=t[e+3]^n[3],p=4,d=1;d<u;d++){var m=r[c>>>24]^o[l>>>16&255]^i[f>>>8&255]^a[255&h]^n[p++],v=r[l>>>24]^o[f>>>16&255]^i[h>>>8&255]^a[255&c]^n[p++],g=r[f>>>24]^o[h>>>16&255]^i[c>>>8&255]^a[255&l]^n[p++],y=r[h>>>24]^o[c>>>16&255]^i[l>>>8&255]^a[255&f]^n[p++];c=m,l=v,f=g,h=y}m=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[f>>>8&255]<<8|s[255&h])^n[p++],v=(s[l>>>24]<<24|s[f>>>16&255]<<16|s[h>>>8&255]<<8|s[255&c])^n[p++],g=(s[f>>>24]<<24|s[h>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^n[p++],y=(s[h>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&f])^n[p++],t[e]=m,t[e+1]=v,t[e+2]=g,t[e+3]=y},keySize:8});t.AES=e._createHelper(m)}(),r.AES)},wbyO:
/*!*************************************************!*\
!*** ./node_modules/crypto-js/enc-base64url.js ***!
\*************************************************/
/*! no static exports found */
/*! all exports used */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){var r,o,i;t.exports=(i=n(/*! ./core */"Ib8C"),o=(r=i).lib.WordArray,r.enc.Base64url={stringify:function(t,e=!0){var n=t.words,r=t.sigBytes,o=e?this._safe_map:this._map;t.clamp();for(var i=[],a=0;a<r;a+=3)for(var s=(n[a>>>2]>>>24-a%4*8&255)<<16|(n[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|n[a+2>>>2]>>>24-(a+2)%4*8&255,u=0;u<4&&a+.75*u<r;u++)i.push(o.charAt(s>>>6*(3-u)&63));var c=o.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(t,e=!0){var n=t.length,r=e?this._safe_map:this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var s=r.charAt(64);if(s){var u=t.indexOf(s);-1!==u&&(n=u)}return function(t,e,n){for(var r=[],i=0,a=0;a<e;a++)if(a%4){var s=n[t.charCodeAt(a-1)]<<a%4*2,u=n[t.charCodeAt(a)]>>>6-a%4*2,c=s|u;r[i>>>2]|=c<<24-i%4*8,i++}return o.create(r,i)}(t,n,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"},i.enc.Base64url)},yPBj:
/*!****************************************************************************!*\
!*** ./src/pages/Classrooms/Lists/Exercise/AnswerCheck/index.less?modules ***!
\****************************************************************************/
/*! no static exports found */
/*! exports used: default */
/*! ModuleConcatenation bailout: Module is not an ECMAScript module */function(t,e,n){t.exports={flex_box_center:"flex_box_center___3-ehW",flex_space_between:"flex_space_between___1gePc",flex_box_vertical_center:"flex_box_vertical_center___2IxJA",flex_box_center_end:"flex_box_center_end___2Bh1H",flex_box_column:"flex_box_column___35awp",bg:"bg___CQ173",steps:"steps___upu0k",qrcode:"qrcode___25DP3"}}}]);