@onekeyfe/hd-web-sdk 0.2.1 → 0.2.2-beta-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/iframe.html +1 -1
- package/build/js/iframe.5799fe007c4f1aa371c7.js +3 -0
- package/build/js/iframe.5799fe007c4f1aa371c7.js.map +1 -0
- package/build/onekey-js-sdk.js +83 -5
- package/build/onekey-js-sdk.js.map +1 -1
- package/build/onekey-js-sdk.min.js +1 -1
- package/build/onekey-js-sdk.min.js.map +1 -1
- package/package.json +6 -6
- package/build/js/iframe.b3d08698f1332b9d17e0.js +0 -3
- package/build/js/iframe.b3d08698f1332b9d17e0.js.map +0 -1
- /package/build/js/{iframe.b3d08698f1332b9d17e0.js.LICENSE.txt → iframe.5799fe007c4f1aa371c7.js.LICENSE.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["onekey-js-sdk"]=t():e["onekey-js-sdk"]=t()}(self,(()=>(()=>{var __webpack_modules__={3525:(e,t)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function i(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function n(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function o(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){n(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=void 0,t.number=r,t.bool=i,t.bytes=n,t.hash=s,t.exists=o,t.output=a;const d={number:r,bool:i,bytes:n,hash:s,exists:o,output:a};t.default=d},2686:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLAKE2=t.SIGMA=void 0;const i=r(3525),n=r(64);t.SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class s extends n.Hash{constructor(e,t,r={},s,o,a){if(super(),this.blockLen=e,this.outputLen=t,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,i.default.number(e),i.default.number(t),i.default.number(s),t<0||t>s)throw new Error("Blake2: outputLen bigger than keyLen");if(void 0!==r.key&&(r.key.length<1||r.key.length>s))throw new Error(`Key should be up 1..${s} byte long or undefined`);if(void 0!==r.salt&&r.salt.length!==o)throw new Error(`Salt should be ${o} byte long or undefined`);if(void 0!==r.personalization&&r.personalization.length!==a)throw new Error(`Personalization should be ${a} byte long or undefined`);this.buffer32=(0,n.u32)(this.buffer=new Uint8Array(e))}update(e){i.default.exists(this);const{blockLen:t,buffer:r,buffer32:s}=this,o=(e=(0,n.toBytes)(e)).length;for(let i=0;i<o;){this.pos===t&&(this.compress(s,0,!1),this.pos=0);const n=Math.min(t-this.pos,o-i),a=e.byteOffset+i;if(n!==t||a%4||!(i+n<o))r.set(e.subarray(i,i+n),this.pos),this.pos+=n,this.length+=n,i+=n;else{const r=new Uint32Array(e.buffer,a,Math.floor((o-i)/4));for(let e=0;i+t<o;e+=s.length,i+=t)this.length+=t,this.compress(r,e,!1)}}return this}digestInto(e){i.default.exists(this),i.default.output(e,this);const{pos:t,buffer32:r}=this;this.finished=!0,this.buffer.subarray(t).fill(0),this.compress(r,0,!0);const s=(0,n.u32)(e);this.get().forEach(((e,t)=>s[t]=e))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){const{buffer:t,length:r,finished:i,destroyed:n,outputLen:s,pos:o}=this;return e||(e=new this.constructor({dkLen:s})),e.set(...this.get()),e.length=r,e.finished=i,e.destroyed=n,e.outputLen=s,e.buffer.set(t),e.pos=o,e}}t.BLAKE2=s},9350:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const i=r(3525),n=r(64);class s extends n.Hash{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,n.createView)(this.buffer)}update(e){i.default.exists(this);const{view:t,buffer:r,blockLen:s}=this,o=(e=(0,n.toBytes)(e)).length;for(let i=0;i<o;){const a=Math.min(s-this.pos,o-i);if(a!==s)r.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===s&&(this.process(t,0),this.pos=0);else{const t=(0,n.createView)(e);for(;s<=o-i;i+=s)this.process(t,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){i.default.exists(this),i.default.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:o}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(r,0),a=0);for(let e=a;e<s;e++)t[e]=0;!function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);const n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),d=i?4:0,u=i?0:4;e.setUint32(t+d,o,i),e.setUint32(t+u,a,i)}(r,s-8,BigInt(8*this.length),o),this.process(r,0);const d=(0,n.createView)(e);this.get().forEach(((e,t)=>d.setUint32(4*t,e,o)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}t.SHA2=s},1655:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add=t.toBig=t.split=t.fromBig=void 0;const r=BigInt(2**32-1),i=BigInt(32);function n(e,t=!1){return t?{h:Number(e&r),l:Number(e>>i&r)}:{h:0|Number(e>>i&r),l:0|Number(e&r)}}function s(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:o,l:a}=n(e[s],t);[r[s],i[s]]=[o,a]}return[r,i]}t.fromBig=n,t.split=s;t.toBig=(e,t)=>BigInt(e>>>0)<<i|BigInt(t>>>0);function o(e,t,r,i){const n=(t>>>0)+(i>>>0);return{h:e+r+(n/2**32|0)|0,l:0|n}}t.add=o;const a={fromBig:n,split:s,toBig:t.toBig,shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:o,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,i)=>t+r+i+(e/2**32|0)|0,add4L:(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),add4H:(e,t,r,i,n)=>t+r+i+n+(e/2**32|0)|0,add5H:(e,t,r,i,n,s)=>t+r+i+n+s+(e/2**32|0)|0,add5L:(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0)};t.default=a},9467:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.blake2s=t.compress=t.IV=void 0;const i=r(2686),n=r(1655),s=r(64);function o(e,t,r,i,n){return e=e+t+n|0,r=r+(i=(0,s.rotr)(i^e,16))|0,{a:e,b:t=(0,s.rotr)(t^r,12),c:r,d:i}}function a(e,t,r,i,n){return e=e+t+n|0,r=r+(i=(0,s.rotr)(i^e,8))|0,{a:e,b:t=(0,s.rotr)(t^r,7),c:r,d:i}}function d(e,t,r,i,n,s,d,u,l,c,p,h,f,y,g,m,v,b,_,w){let E=0;for(let T=0;T<i;T++)({a:n,b:l,c:f,d:v}=o(n,l,f,v,r[t+e[E++]])),({a:n,b:l,c:f,d:v}=a(n,l,f,v,r[t+e[E++]])),({a:s,b:c,c:y,d:b}=o(s,c,y,b,r[t+e[E++]])),({a:s,b:c,c:y,d:b}=a(s,c,y,b,r[t+e[E++]])),({a:d,b:p,c:g,d:_}=o(d,p,g,_,r[t+e[E++]])),({a:d,b:p,c:g,d:_}=a(d,p,g,_,r[t+e[E++]])),({a:u,b:h,c:m,d:w}=o(u,h,m,w,r[t+e[E++]])),({a:u,b:h,c:m,d:w}=a(u,h,m,w,r[t+e[E++]])),({a:n,b:c,c:g,d:w}=o(n,c,g,w,r[t+e[E++]])),({a:n,b:c,c:g,d:w}=a(n,c,g,w,r[t+e[E++]])),({a:s,b:p,c:m,d:v}=o(s,p,m,v,r[t+e[E++]])),({a:s,b:p,c:m,d:v}=a(s,p,m,v,r[t+e[E++]])),({a:d,b:h,c:f,d:b}=o(d,h,f,b,r[t+e[E++]])),({a:d,b:h,c:f,d:b}=a(d,h,f,b,r[t+e[E++]])),({a:u,b:l,c:y,d:_}=o(u,l,y,_,r[t+e[E++]])),({a:u,b:l,c:y,d:_}=a(u,l,y,_,r[t+e[E++]]));return{v0:n,v1:s,v2:d,v3:u,v4:l,v5:c,v6:p,v7:h,v8:f,v9:y,v10:g,v11:m,v12:v,v13:b,v14:_,v15:w}}t.IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.compress=d;class u extends i.BLAKE2{constructor(e={}){super(64,void 0===e.dkLen?32:e.dkLen,e,32,8,8),this.v0=0|t.IV[0],this.v1=0|t.IV[1],this.v2=0|t.IV[2],this.v3=0|t.IV[3],this.v4=0|t.IV[4],this.v5=0|t.IV[5],this.v6=0|t.IV[6],this.v7=0|t.IV[7];const r=e.key?e.key.length:0;if(this.v0^=this.outputLen|r<<8|65536|1<<24,e.salt){const t=(0,s.u32)((0,s.toBytes)(e.salt));this.v4^=t[0],this.v5^=t[1]}if(e.personalization){const t=(0,s.u32)((0,s.toBytes)(e.personalization));this.v6^=t[0],this.v7^=t[1]}if(e.key){const t=new Uint8Array(this.blockLen);t.set((0,s.toBytes)(e.key)),this.update(t)}}get(){const{v0:e,v1:t,v2:r,v3:i,v4:n,v5:s,v6:o,v7:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.v0=0|e,this.v1=0|t,this.v2=0|r,this.v3=0|i,this.v4=0|n,this.v5=0|s,this.v6=0|o,this.v7=0|a}compress(e,r,s){const{h:o,l:a}=n.default.fromBig(BigInt(this.length)),{v0:u,v1:l,v2:c,v3:p,v4:h,v5:f,v6:y,v7:g,v8:m,v9:v,v10:b,v11:_,v12:w,v13:E,v14:T,v15:S}=d(i.SIGMA,r,e,10,this.v0,this.v1,this.v2,this.v3,this.v4,this.v5,this.v6,this.v7,t.IV[0],t.IV[1],t.IV[2],t.IV[3],a^t.IV[4],o^t.IV[5],s?~t.IV[6]:t.IV[6],t.IV[7]);this.v0^=u^m,this.v1^=l^v,this.v2^=c^b,this.v3^=p^_,this.v4^=h^w,this.v5^=f^E,this.v6^=y^T,this.v7^=g^S}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0)}}t.blake2s=(0,s.wrapConstructorWithOpts)((e=>new u(e)))},4661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},6053:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const i=r(9350),n=r(64),s=(e,t,r)=>e&t^e&r^t&r,o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),d=new Uint32Array(64);class u extends i.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)d[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=d[e-15],r=d[e-2],i=(0,n.rotr)(t,7)^(0,n.rotr)(t,18)^t>>>3,s=(0,n.rotr)(r,17)^(0,n.rotr)(r,19)^r>>>10;d[e]=s+d[e-7]+i+d[e-16]|0}let{A:r,B:i,C:a,D:u,E:l,F:c,G:p,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,n.rotr)(l,6)^(0,n.rotr)(l,11)^(0,n.rotr)(l,25))+((f=l)&c^~f&p)+o[e]+d[e]|0,y=((0,n.rotr)(r,2)^(0,n.rotr)(r,13)^(0,n.rotr)(r,22))+s(r,i,a)|0;h=p,p=c,c=l,l=u+t|0,u=a,a=i,i=r,r=t+y|0}var f;r=r+this.A|0,i=i+this.B|0,a=a+this.C|0,u=u+this.D|0,l=l+this.E|0,c=c+this.F|0,p=p+this.G|0,h=h+this.H|0,this.set(r,i,a,u,l,c,p,h)}roundClean(){d.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}t.sha256=(0,n.wrapConstructor)((()=>new u))},125:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shake256=t.shake128=t.keccak_512=t.keccak_384=t.keccak_256=t.keccak_224=t.sha3_512=t.sha3_384=t.sha3_256=t.sha3_224=t.Keccak=t.keccakP=void 0;const i=r(3525),n=r(1655),s=r(64),[o,a,d]=[[],[],[]],u=BigInt(0),l=BigInt(1),c=BigInt(2),p=BigInt(7),h=BigInt(256),f=BigInt(113);for(let e=0,t=l,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],o.push(2*(5*i+r)),a.push((e+1)*(e+2)/2%64);let n=u;for(let e=0;e<7;e++)t=(t<<l^(t>>p)*f)%h,t&c&&(n^=l<<(l<<BigInt(e))-l);d.push(n)}const[y,g]=n.default.split(d,!0),m=(e,t,r)=>r>32?n.default.rotlBH(e,t,r):n.default.rotlSH(e,t,r),v=(e,t,r)=>r>32?n.default.rotlBL(e,t,r):n.default.rotlSL(e,t,r);function b(e,t=24){const r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=m(s,o,1)^r[i],d=v(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=d}let t=e[2],n=e[3];for(let r=0;r<24;r++){const i=a[r],s=m(t,n,i),d=v(t,n,i),u=o[r];t=e[u],n=e[u+1],e[u]=s,e[u+1]=d}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=y[i],e[1]^=g[i]}r.fill(0)}t.keccakP=b;class _ extends s.Hash{constructor(e,t,r,n=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,i.default.number(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,s.u32)(this.state)}keccak(){b(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){i.default.exists(this);const{blockLen:t,state:r}=this,n=(e=(0,s.toBytes)(e)).length;for(let i=0;i<n;){const s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,0!=(128&t)&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){i.default.exists(this,!1),i.default.bytes(e),this.finish();const t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return i.default.number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(i.default.output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new _(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}t.Keccak=_;const w=(e,t,r)=>(0,s.wrapConstructor)((()=>new _(t,e,r)));t.sha3_224=w(6,144,28),t.sha3_256=w(6,136,32),t.sha3_384=w(6,104,48),t.sha3_512=w(6,72,64),t.keccak_224=w(1,144,28),t.keccak_256=w(1,136,32),t.keccak_384=w(1,104,48),t.keccak_512=w(1,72,64);const E=(e,t,r)=>(0,s.wrapConstructorWithOpts)(((i={})=>new _(t,e,void 0===i.dkLen?r:i.dkLen,!0)));t.shake128=E(31,168,16),t.shake256=E(31,136,32)},64:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const i=r(4661);t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));t.bytesToHex=function(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=n[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const i=2*r,n=e.slice(i,i+2),s=Number.parseInt(n,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t};function s(e){if("string"!=typeof e)throw new TypeError("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}function o(e){if("string"==typeof e&&(e=s(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}t.nextTick=async()=>{},t.asyncLoop=async function(e,r,i){let n=Date.now();for(let s=0;s<e;s++){i(s);const e=Date.now()-n;e>=0&&e<r||(await(0,t.nextTick)(),n+=e)}},t.utf8ToBytes=s,t.toBytes=o,t.concatBytes=function(...e){if(!e.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return r};t.Hash=class{clone(){return this._cloneInto()}};t.checkOpts=function(e,t){if(void 0!==t&&("object"!=typeof t||(r=t,"[object Object]"!==Object.prototype.toString.call(r)||r.constructor!==Object)))throw new TypeError("Options should be object or undefined");var r;return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(o(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(o(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(i.crypto.web)return i.crypto.web.getRandomValues(new Uint8Array(e));if(i.crypto.node)return new Uint8Array(i.crypto.node.randomBytes(e).buffer);throw new Error("The environment doesn't have randomBytes function")}},7408:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,r)}(e,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,r,i){var n,s,o,u;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=l.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):f(n,n.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function y(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return d(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var d=s[e];if(void 0===d)return!1;if("function"==typeof d)i(d,this,t);else{var u=d.length,l=f(d,u);for(r=0;r<u;++r)i(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,c(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,c(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,s,o;if(a(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},6781:e=>{"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),i=0,n=2,s=!0;for(;n<arguments.length;)r[i++]=arguments[n++];return new Promise((function(n,o){r[i]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];n.apply(null,t)}};try{e.apply(t||null,r)}catch(e){s&&(s=!1,o(e))}}))}},7026:(e,t)=>{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var i=new Array(64),n=new Array(123),s=0;s<64;)n[i[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(e,t,r){for(var n,s=null,o=[],a=0,d=0;t<r;){var u=e[t++];switch(d){case 0:o[a++]=i[u>>2],n=(3&u)<<4,d=1;break;case 1:o[a++]=i[n|u>>4],n=(15&u)<<2,d=2;break;case 2:o[a++]=i[n|u>>6],o[a++]=i[63&u],d=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return d&&(o[a++]=i[n],o[a++]=61,1===d&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";r.decode=function(e,t,r){for(var i,s=r,a=0,d=0;d<e.length;){var u=e.charCodeAt(d++);if(61===u&&a>1)break;if(void 0===(u=n[u]))throw Error(o);switch(a){case 0:i=u,a=1;break;case 1:t[r++]=i<<2|(48&u)>>4,i=u,a=2;break;case 2:t[r++]=(15&i)<<4|(60&u)>>2,i=u,a=3;break;case 3:t[r++]=(3&i)<<6|u,a=0}}if(1===a)throw Error(o);return r-s},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},1706:e=>{"use strict";function t(e,r){"string"==typeof e&&(r=e,e=void 0);var i=[];function n(e){if("string"!=typeof e){var r=s();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var o=Object.keys(e),a=new Array(o.length+1),d=new Array(o.length),u=0;u<o.length;)a[u]=o[u],d[u]=e[o[u++]];return a[u]=r,Function.apply(null,a).apply(null,d)}return Function(r)()}for(var l=new Array(arguments.length-1),c=0;c<l.length;)l[c]=arguments[++c];if(c=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var r=l[c++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),c!==l.length)throw Error("parameter count mismatch");return i.push(e),n}function s(t){return"function "+(t||r||"")+"("+(e&&e.join(",")||"")+"){\n "+i.join("\n ")+"\n}"}return n.toString=s,n}e.exports=t,t.verbose=!1},5570:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],i=0;i<r.length;)r[i].fn===t?r.splice(i,1):++i;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],i=1;i<arguments.length;)r.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,r)}return this}},4641:(e,t,r)=>{"use strict";e.exports=s;var i=r(6781),n=r(6116)("fs");function s(e,t,r){return"function"==typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&n&&n.readFile?n.readFile(e,(function(i,n){return i&&"undefined"!=typeof XMLHttpRequest?s.xhr(e,t,r):i?r(i):r(null,t.binary?n:n.toString("utf8"))})):s.xhr(e,t,r):i(s,this,e,t)}s.xhr=function(e,t,r){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(4===i.readyState){if(0!==i.status&&200!==i.status)return r(Error("status "+i.status));if(t.binary){var e=i.response;if(!e){e=[];for(var n=0;n<i.responseText.length;++n)e.push(255&i.responseText.charCodeAt(n))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,i.responseText)}},t.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",e),i.send()}},5298:e=>{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),i=128===r[3];function n(e,i,n){t[0]=e,i[n]=r[0],i[n+1]=r[1],i[n+2]=r[2],i[n+3]=r[3]}function s(e,i,n){t[0]=e,i[n]=r[3],i[n+1]=r[2],i[n+2]=r[1],i[n+3]=r[0]}function o(e,i){return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],t[0]}function a(e,i){return r[3]=e[i],r[2]=e[i+1],r[1]=e[i+2],r[0]=e[i+3],t[0]}e.writeFloatLE=i?n:s,e.writeFloatBE=i?s:n,e.readFloatLE=i?o:a,e.readFloatBE=i?a:o}():function(){function t(e,t,r,i){var n=t<0?1:0;if(n&&(t=-t),0===t)e(1/t>0?0:2147483648,r,i);else if(isNaN(t))e(2143289344,r,i);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,r,i);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,r,i);else{var s=Math.floor(Math.log(t)/Math.LN2);e((n<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,i)}}function o(e,t,r){var i=e(t,r),n=2*(i>>31)+1,s=i>>>23&255,o=8388607&i;return 255===s?o?NaN:n*(1/0):0===s?1401298464324817e-60*n*o:n*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,i),e.readFloatLE=o.bind(null,n),e.readFloatBE=o.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),i=128===r[7];function n(e,i,n){t[0]=e,i[n]=r[0],i[n+1]=r[1],i[n+2]=r[2],i[n+3]=r[3],i[n+4]=r[4],i[n+5]=r[5],i[n+6]=r[6],i[n+7]=r[7]}function s(e,i,n){t[0]=e,i[n]=r[7],i[n+1]=r[6],i[n+2]=r[5],i[n+3]=r[4],i[n+4]=r[3],i[n+5]=r[2],i[n+6]=r[1],i[n+7]=r[0]}function o(e,i){return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],r[4]=e[i+4],r[5]=e[i+5],r[6]=e[i+6],r[7]=e[i+7],t[0]}function a(e,i){return r[7]=e[i],r[6]=e[i+1],r[5]=e[i+2],r[4]=e[i+3],r[3]=e[i+4],r[2]=e[i+5],r[1]=e[i+6],r[0]=e[i+7],t[0]}e.writeDoubleLE=i?n:s,e.writeDoubleBE=i?s:n,e.readDoubleLE=i?o:a,e.readDoubleBE=i?a:o}():function(){function t(e,t,r,i,n,s){var o=i<0?1:0;if(o&&(i=-i),0===i)e(0,n,s+t),e(1/i>0?0:2147483648,n,s+r);else if(isNaN(i))e(0,n,s+t),e(2146959360,n,s+r);else if(i>17976931348623157e292)e(0,n,s+t),e((o<<31|2146435072)>>>0,n,s+r);else{var a;if(i<22250738585072014e-324)e((a=i/5e-324)>>>0,n,s+t),e((o<<31|a/4294967296)>>>0,n,s+r);else{var d=Math.floor(Math.log(i)/Math.LN2);1024===d&&(d=1023),e(4503599627370496*(a=i*Math.pow(2,-d))>>>0,n,s+t),e((o<<31|d+1023<<20|1048576*a&1048575)>>>0,n,s+r)}}}function o(e,t,r,i,n){var s=e(i,n+t),o=e(i,n+r),a=2*(o>>31)+1,d=o>>>20&2047,u=4294967296*(1048575&o)+s;return 2047===d?u?NaN:a*(1/0):0===d?5e-324*a*u:a*Math.pow(2,d-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,i,4,0),e.readDoubleLE=o.bind(null,n,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function i(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},6116:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},2659:(e,t)=>{"use strict";var r=t,i=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=i(e),n="";r&&(n=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return n+t.join("/")};r.resolve=function(e,t,r){return r||(t=n(t)),i(t)?t:(r||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}},804:e=>{"use strict";e.exports=function(e,t,r){var i=r||8192,n=i>>>1,s=null,o=i;return function(r){if(r<1||r>n)return e(r);o+r>i&&(s=e(i),o=0);var a=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),a}}},7958:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,i=0;i<e.length;++i)(r=e.charCodeAt(i))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(i+1))?(++i,t+=4):t+=3;return t},r.read=function(e,t,r){if(r-t<1)return"";for(var i,n=null,s=[],o=0;t<r;)(i=e[t++])<128?s[o++]=i:i>191&&i<224?s[o++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(i>>10),s[o++]=56320+(1023&i)):s[o++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0);return n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))},r.write=function(e,t,r){for(var i,n,s=r,o=0;o<e.length;++o)(i=e.charCodeAt(o))<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&56320==(64512&(n=e.charCodeAt(o+1)))?(i=65536+((1023&i)<<10)+(1023&n),++o,t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128);return r-s}},9644:(e,t,r)=>{e.exports=r(5644)},353:(e,t,r)=>{"use strict";var i=r(3044),n=r(6955),s=r(2233),o=r(8030),a=r(7948),d=r(1875),u=r(842),l=r(8560),c=r(1218),p=r(8047),h=r(738);e.exports=function(e){return new Promise((function(t,r){var f,y=e.data,g=e.headers,m=e.responseType;function v(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}i.isFormData(y)&&i.isStandardBrowserEnv()&&delete g["Content-Type"];var b=new XMLHttpRequest;if(e.auth){var _=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";g.Authorization="Basic "+btoa(_+":"+w)}var E=a(e.baseURL,e.url);function T(){if(b){var i="getAllResponseHeaders"in b?d(b.getAllResponseHeaders()):null,s={data:m&&"text"!==m&&"json"!==m?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:i,config:e,request:b};n((function(e){t(e),v()}),(function(e){r(e),v()}),s),b=null}}if(b.open(e.method.toUpperCase(),o(E,e.params,e.paramsSerializer),!0),b.timeout=e.timeout,"onloadend"in b?b.onloadend=T:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(T)},b.onabort=function(){b&&(r(new c("Request aborted",c.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new c("Network Error",c.ERR_NETWORK,e,b,b)),b=null},b.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",i=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new c(t,i.clarifyTimeoutError?c.ETIMEDOUT:c.ECONNABORTED,e,b)),b=null},i.isStandardBrowserEnv()){var S=(e.withCredentials||u(E))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;S&&(g[e.xsrfHeaderName]=S)}"setRequestHeader"in b&&i.forEach(g,(function(e,t){void 0===y&&"content-type"===t.toLowerCase()?delete g[t]:b.setRequestHeader(t,e)})),i.isUndefined(e.withCredentials)||(b.withCredentials=!!e.withCredentials),m&&"json"!==m&&(b.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&b.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(f=function(e){b&&(r(!e||e&&e.type?new p:e),b.abort(),b=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f))),y||(y=null);var R=h(E);R&&-1===["http","https","file"].indexOf(R)?r(new c("Unsupported protocol "+R+":",c.ERR_BAD_REQUEST,e)):b.send(y)}))}},5644:(e,t,r)=>{"use strict";var i=r(3044),n=r(3644),s=r(2215),o=r(2937);var a=function e(t){var r=new s(t),a=n(s.prototype.request,r);return i.extend(a,s.prototype,r),i.extend(a,r),a.create=function(r){return e(o(t,r))},a}(r(663));a.Axios=s,a.CanceledError=r(8047),a.CancelToken=r(4089),a.isCancel=r(8041),a.VERSION=r(9241).version,a.toFormData=r(9027),a.AxiosError=r(1218),a.Cancel=a.CanceledError,a.all=function(e){return Promise.all(e)},a.spread=r(783),a.isAxiosError=r(5587),e.exports=a,e.exports.default=a},4089:(e,t,r)=>{"use strict";var i=r(8047);function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,i=r._listeners.length;for(t=0;t<i;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,i=new Promise((function(e){r.subscribe(e),t=e})).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e){r.reason||(r.reason=new i(e),t(r.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},n.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},n.source=function(){var e;return{token:new n((function(t){e=t})),cancel:e}},e.exports=n},8047:(e,t,r)=>{"use strict";var i=r(1218);function n(e){i.call(this,null==e?"canceled":e,i.ERR_CANCELED),this.name="CanceledError"}r(3044).inherits(n,i,{__CANCEL__:!0}),e.exports=n},8041:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},2215:(e,t,r)=>{"use strict";var i=r(3044),n=r(8030),s=r(946),o=r(6895),a=r(2937),d=r(7948),u=r(7525),l=u.validators;function c(e){this.defaults=e,this.interceptors={request:new s,response:new s}}c.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&u.assertOptions(r,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1);var i=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));var s,d=[];if(this.interceptors.response.forEach((function(e){d.push(e.fulfilled,e.rejected)})),!n){var c=[o,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(d),s=Promise.resolve(t);c.length;)s=s.then(c.shift(),c.shift());return s}for(var p=t;i.length;){var h=i.shift(),f=i.shift();try{p=h(p)}catch(e){f(e);break}}try{s=o(p)}catch(e){return Promise.reject(e)}for(;d.length;)s=s.then(d.shift(),d.shift());return s},c.prototype.getUri=function(e){e=a(this.defaults,e);var t=d(e.baseURL,e.url);return n(t,e.params,e.paramsSerializer)},i.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),i.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(a(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}c.prototype[e]=t(),c.prototype[e+"Form"]=t(!0)})),e.exports=c},1218:(e,t,r)=>{"use strict";var i=r(3044);function n(e,t,r,i,n){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}i.inherits(n,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var s=n.prototype,o={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){o[e]={value:e}})),Object.defineProperties(n,o),Object.defineProperty(s,"isAxiosError",{value:!0}),n.from=function(e,t,r,o,a,d){var u=Object.create(s);return i.toFlatObject(e,u,(function(e){return e!==Error.prototype})),n.call(u,e.message,t,r,o,a),u.name=e.name,d&&Object.assign(u,d),u},e.exports=n},946:(e,t,r)=>{"use strict";var i=r(3044);function n(){this.handlers=[]}n.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){i.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},7948:(e,t,r)=>{"use strict";var i=r(9192),n=r(8762);e.exports=function(e,t){return e&&!i(t)?n(e,t):t}},6895:(e,t,r)=>{"use strict";var i=r(3044),n=r(8556),s=r(8041),o=r(663),a=r(8047);function d(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a}e.exports=function(e){return d(e),e.headers=e.headers||{},e.data=n.call(e,e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),i.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return d(e),t.data=n.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(d(e),t&&t.response&&(t.response.data=n.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},2937:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e,t){t=t||{};var r={};function n(e,t){return i.isPlainObject(e)&&i.isPlainObject(t)?i.merge(e,t):i.isPlainObject(t)?i.merge({},t):i.isArray(t)?t.slice():t}function s(r){return i.isUndefined(t[r])?i.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function o(e){if(!i.isUndefined(t[e]))return n(void 0,t[e])}function a(r){return i.isUndefined(t[r])?i.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function d(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:d};return i.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||s,n=t(e);i.isUndefined(n)&&t!==d||(r[e]=n)})),r}},6955:(e,t,r)=>{"use strict";var i=r(1218);e.exports=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new i("Request failed with status code "+r.status,[i.ERR_BAD_REQUEST,i.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}},8556:(e,t,r)=>{"use strict";var i=r(3044),n=r(663);e.exports=function(e,t,r){var s=this||n;return i.forEach(r,(function(r){e=r.call(s,e,t)})),e}},663:(e,t,r)=>{"use strict";var i=r(3044),n=r(8868),s=r(1218),o=r(8560),a=r(9027),d={"Content-Type":"application/x-www-form-urlencoded"};function u(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,c={transitional:o,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(l=r(353)),l),transformRequest:[function(e,t){if(n(t,"Accept"),n(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e))return e;if(i.isArrayBufferView(e))return e.buffer;if(i.isURLSearchParams(e))return u(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var r,s=i.isObject(e),o=t&&t["Content-Type"];if((r=i.isFileList(e))||s&&"multipart/form-data"===o){var d=this.env&&this.env.FormData;return a(r?{"files[]":e}:e,d&&new d)}return s||"application/json"===o?(u(t,"application/json"),function(e,t,r){if(i.isString(e))try{return(t||JSON.parse)(e),i.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,o=!r&&"json"===this.responseType;if(o||n&&i.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw s.from(e,s.ERR_BAD_RESPONSE,this,null,this.response);throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:r(4684)},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),i.forEach(["post","put","patch"],(function(e){c.headers[e]=i.merge(d)})),e.exports=c},8560:e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},9241:e=>{e.exports={version:"0.27.2"}},3644:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];return e.apply(t,r)}}},8030:(e,t,r)=>{"use strict";var i=r(3044);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(i.isURLSearchParams(t))s=t.toString();else{var o=[];i.forEach(t,(function(e,t){null!=e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,(function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),o.push(n(t)+"="+n(e))})))})),s=o.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},8762:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},2233:(e,t,r)=>{"use strict";var i=r(3044);e.exports=i.isStandardBrowserEnv()?{write:function(e,t,r,n,s,o){var a=[];a.push(e+"="+encodeURIComponent(t)),i.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),i.isString(n)&&a.push("path="+n),i.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},9192:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},5587:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e){return i.isObject(e)&&!0===e.isAxiosError}},842:(e,t,r)=>{"use strict";var i=r(3044);e.exports=i.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var i=e;return t&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=i.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},8868:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e,t){i.forEach(e,(function(r,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[i])}))}},4684:e=>{e.exports=null},1875:(e,t,r)=>{"use strict";var i=r(3044),n=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,o={};return e?(i.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=i.trim(e.substr(0,s)).toLowerCase(),r=i.trim(e.substr(s+1)),t){if(o[t]&&n.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([r]):o[t]?o[t]+", "+r:r}})),o):o}},738:e=>{"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},783:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},9027:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e,t){t=t||new FormData;var r=[];function n(e){return null===e?"":i.isDate(e)?e.toISOString():i.isArrayBuffer(e)||i.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}return function e(s,o){if(i.isPlainObject(s)||i.isArray(s)){if(-1!==r.indexOf(s))throw Error("Circular reference detected in "+o);r.push(s),i.forEach(s,(function(r,s){if(!i.isUndefined(r)){var a,d=o?o+"."+s:s;if(r&&!o&&"object"==typeof r)if(i.endsWith(s,"{}"))r=JSON.stringify(r);else if(i.endsWith(s,"[]")&&(a=i.toArray(r)))return void a.forEach((function(e){!i.isUndefined(e)&&t.append(d,n(e))}));e(r,d)}})),r.pop()}else t.append(o,n(s))}(e),t}},7525:(e,t,r)=>{"use strict";var i=r(9241).version,n=r(1218),s={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){s[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var o={};s.transitional=function(e,t,r){function s(e,t){return"[Axios v"+i+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,a){if(!1===e)throw new n(s(i," has been removed"+(t?" in "+t:"")),n.ERR_DEPRECATED);return t&&!o[i]&&(o[i]=!0,console.warn(s(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new n("options must be an object",n.ERR_BAD_OPTION_VALUE);for(var i=Object.keys(e),s=i.length;s-- >0;){var o=i[s],a=t[o];if(a){var d=e[o],u=void 0===d||a(d,o,e);if(!0!==u)throw new n("option "+o+" must be "+u,n.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new n("Unknown option "+o,n.ERR_BAD_OPTION)}},validators:s}},3044:(e,t,r)=>{"use strict";var i,n=r(3644),s=Object.prototype.toString,o=(i=Object.create(null),function(e){var t=s.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return o(t)===e}}function d(e){return Array.isArray(e)}function u(e){return void 0===e}var l=a("ArrayBuffer");function c(e){return null!==e&&"object"==typeof e}function p(e){if("object"!==o(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var h=a("Date"),f=a("File"),y=a("Blob"),g=a("FileList");function m(e){return"[object Function]"===s.call(e)}var v=a("URLSearchParams");function b(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),d(e))for(var r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}var _,w=(_="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return _&&e instanceof _});e.exports={isArray:d,isArrayBuffer:l,isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||s.call(e)===t||m(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&l(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:c,isPlainObject:p,isUndefined:u,isDate:h,isFile:f,isBlob:y,isFunction:m,isStream:function(e){return c(e)&&m(e.pipe)},isURLSearchParams:v,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:b,merge:function e(){var t={};function r(r,i){p(t[i])&&p(r)?t[i]=e(t[i],r):p(r)?t[i]=e({},r):d(r)?t[i]=r.slice():t[i]=r}for(var i=0,n=arguments.length;i<n;i++)b(arguments[i],r);return t},extend:function(e,t,r){return b(t,(function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,i){e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r){var i,n,s,o={};t=t||{};do{for(n=(i=Object.getOwnPropertyNames(e)).length;n-- >0;)o[s=i[n]]||(t[s]=e[s],o[s]=!0);e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var i=e.indexOf(t,r);return-1!==i&&i===r},toArray:function(e){if(!e)return null;var t=e.length;if(u(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:w,isFileList:g}},5890:(e,t,r)=>{"use strict";var i=r(7699),n=r(8402),s=r(9644),o=r(6391),a=r(64),d=r(9467),u=r(6053),l=r(1297),c=r(7495),p=r(125);function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(i),y=h(s),g=h(o),m=h(l);function v(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=b(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){(function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)})(i,n,(t=e[r](t)).done,t.value)}))}}}var w,E={exports:{}},T="object"==typeof Reflect?Reflect:null,S=T&&"function"==typeof T.apply?T.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};w=T&&"function"==typeof T.ownKeys?T.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var R=Number.isNaN||function(e){return e!=e};function O(){O.init.call(this)}E.exports=O,E.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}B(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&B(e,"error",t,r)}(e,n,{once:!0})}))},O.EventEmitter=O,O.prototype._events=void 0,O.prototype._eventsCount=0,O.prototype._maxListeners=void 0;var I=10;function x(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function A(e){return void 0===e._maxListeners?O.defaultMaxListeners:e._maxListeners}function C(e,t,r,i){var n,s,o,a;if(x(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=A(e))>0&&o.length>n&&!o.warned){o.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=o.length,a=d,console&&console.warn&&console.warn(a)}return e}function k(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function M(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=k.bind(i);return n.listener=r,i.wrapFn=n,n}function N(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):D(n,n.length)}function P(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function D(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function B(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(O,"defaultMaxListeners",{enumerable:!0,get:function(){return I},set:function(e){if("number"!=typeof e||e<0||R(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");I=e}}),O.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},O.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||R(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},O.prototype.getMaxListeners=function(){return A(this)},O.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)S(a,this,t);else{var d=a.length,u=D(a,d);for(r=0;r<d;++r)S(u[r],this,t)}return!0},O.prototype.addListener=function(e,t){return C(this,e,t,!1)},O.prototype.on=O.prototype.addListener,O.prototype.prependListener=function(e,t){return C(this,e,t,!0)},O.prototype.once=function(e,t){return x(t),this.on(e,M(this,e,t)),this},O.prototype.prependOnceListener=function(e,t){return x(t),this.prependListener(e,M(this,e,t)),this},O.prototype.removeListener=function(e,t){var r,i,n,s,o;if(x(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},O.prototype.off=O.prototype.removeListener,O.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},O.prototype.listeners=function(e){return N(this,e,!0)},O.prototype.rawListeners=function(e){return N(this,e,!1)},O.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):P.call(e,t)},O.prototype.listenerCount=P,O.prototype.eventNames=function(){return this._eventsCount>0?w(this._events):[]};const L=2147483648,q=e=>(e|L)>>>0,j=e=>(2147483647&e)>>>0,F=n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Not a valid path"),U=n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Path cannot contain negative values"),z=e=>{const t=e.toLowerCase().split("/");if("m"!==t[0])throw F;return t.filter((e=>"m"!==e&&""!==e)).map((e=>{let t=!1;"'"===e.substr(e.length-1)&&(t=!0,e=e.substr(0,e.length-1));let r=parseInt(e);if(Number.isNaN(r))throw F;if(r<0)throw U;return t&&(r=q(r)),r}))},H=e=>{if(!Array.isArray(e)||e.length<1)return"SPENDADDRESS";switch(j(e[0])){case 48:return"SPENDMULTISIG";case 49:return"SPENDP2SHWITNESS";case 84:return"SPENDWITNESS";default:return"SPENDADDRESS"}},$=e=>`m/${e.map((e=>e&L?(2147483647&e)+"'":e)).join("/")}`,G=(e,t=0,r=!1)=>{let i;if(i="string"==typeof e?z(e):Array.isArray(e)?e.map((e=>{const t=parseInt(e);if(Number.isNaN(t))throw F;if(t<0)throw U;return t})):void 0,!i)throw F;if(t>0&&i.length<t)throw F;return r?i.splice(0,3):i},W=e=>{if(!e||"object"!=typeof e||!e.serial_no)return"classic";const t=e.serial_no.slice(0,2);return"mi"===t.toLowerCase()?"mini":"tc"===t.toLowerCase()?"touch":"classic"},V=e=>e?e.startsWith("MI")?"mini":e.startsWith("T")?"touch":"classic":"classic",K=e=>{var t,r;return"classic"===W(e)?null!==(t=e.onekey_serial)&&void 0!==t?t:"":null!==(r=e.serial_no)&&void 0!==r?r:""},Y=e=>{const t=W(e);return"string"==typeof e.label?e.label:`My OneKey ${t.charAt(0).toUpperCase()+t.slice(1)}`},X=e=>e?e.onekey_version?e.onekey_version.split("."):[e.major_version,e.minor_version,e.patch_version]:[0,0,0],Z=e=>e.ble_ver&&f.default.valid(e.ble_ver)?e.ble_ver.split("."):null,J=e=>{if(!e)return{support:!1};if("touch"===W(e))return{support:!1};const t=X(e).join(".");return{support:f.default.gte(t,"2.3.0"),require:"2.3.0"}},Q=(e,t)=>v(void 0,void 0,void 0,(function*(){if(!e)return!1;const{message:r}=yield t.typedCall("GetAddress","Address",{address_n:[q(44),q(1),q(0),0,0],coin_name:"Testnet",script_type:"SPENDADDRESS",show_display:!1});return r.address}));var ee={nested:{AlgorandGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:3}}},AlgorandAddress:{fields:{address:{type:"string",id:1}}},AlgorandSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},AlgorandSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},AptosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},AptosAddress:{fields:{address:{type:"string",id:1}}},AptosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},AptosSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},AptosSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},payload:{rule:"required",type:"AptosMessagePayload",id:2}},nested:{AptosMessagePayload:{fields:{address:{type:"string",id:2},chain_id:{type:"string",id:3},application:{type:"string",id:4},nonce:{rule:"required",type:"string",id:5},message:{rule:"required",type:"string",id:6}}}}},AptosMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:1},address:{rule:"required",type:"string",id:2}}},BinanceGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},BinanceAddress:{fields:{address:{rule:"required",type:"string",id:1}}},BinanceGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},BinancePublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},BinanceSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},msg_count:{type:"uint32",id:2},account_number:{type:"sint64",id:3},chain_id:{type:"string",id:4},memo:{type:"string",id:5},sequence:{type:"sint64",id:6},source:{type:"sint64",id:7}}},BinanceTxRequest:{fields:{}},BinanceTransferMsg:{fields:{inputs:{rule:"repeated",type:"BinanceInputOutput",id:1},outputs:{rule:"repeated",type:"BinanceInputOutput",id:2}},nested:{BinanceInputOutput:{fields:{address:{type:"string",id:1},coins:{rule:"repeated",type:"BinanceCoin",id:2}}},BinanceCoin:{fields:{amount:{type:"sint64",id:1},denom:{type:"string",id:2}}}}},BinanceOrderMsg:{fields:{id:{type:"string",id:1},ordertype:{type:"BinanceOrderType",id:2},price:{type:"sint64",id:3},quantity:{type:"sint64",id:4},sender:{type:"string",id:5},side:{type:"BinanceOrderSide",id:6},symbol:{type:"string",id:7},timeinforce:{type:"BinanceTimeInForce",id:8}},nested:{BinanceOrderType:{values:{OT_UNKNOWN:0,MARKET:1,LIMIT:2,OT_RESERVED:3}},BinanceOrderSide:{values:{SIDE_UNKNOWN:0,BUY:1,SELL:2}},BinanceTimeInForce:{values:{TIF_UNKNOWN:0,GTE:1,TIF_RESERVED:2,IOC:3}}}},BinanceCancelMsg:{fields:{refid:{type:"string",id:1},sender:{type:"string",id:2},symbol:{type:"string",id:3}}},BinanceSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},public_key:{rule:"required",type:"bytes",id:2}}},InputScriptType:{values:{SPENDADDRESS:0,SPENDMULTISIG:1,EXTERNAL:2,SPENDWITNESS:3,SPENDP2SHWITNESS:4,SPENDTAPROOT:5}},OutputScriptType:{values:{PAYTOADDRESS:0,PAYTOSCRIPTHASH:1,PAYTOMULTISIG:2,PAYTOOPRETURN:3,PAYTOWITNESS:4,PAYTOP2SHWITNESS:5,PAYTOTAPROOT:6}},DecredStakingSpendType:{values:{SSGen:0,SSRTX:1}},AmountUnit:{values:{BITCOIN:0,MILLIBITCOIN:1,MICROBITCOIN:2,SATOSHI:3}},MultisigRedeemScriptType:{fields:{pubkeys:{rule:"repeated",type:"HDNodePathType",id:1},signatures:{rule:"repeated",type:"bytes",id:2},m:{rule:"required",type:"uint32",id:3},nodes:{rule:"repeated",type:"HDNodeType",id:4},address_n:{rule:"repeated",type:"uint32",id:5,options:{packed:!1}}},nested:{HDNodePathType:{fields:{node:{rule:"required",type:"HDNodeType",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}}}}}},GetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},ecdsa_curve_name:{type:"string",id:2},show_display:{type:"bool",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}}},PublicKey:{fields:{node:{rule:"required",type:"HDNodeType",id:1},xpub:{rule:"required",type:"string",id:2},root_fingerprint:{type:"uint32",id:3}}},GetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},show_display:{type:"bool",id:3},multisig:{type:"MultisigRedeemScriptType",id:4},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}}},Address:{fields:{address:{rule:"required",type:"string",id:1}}},GetOwnershipId:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},multisig:{type:"MultisigRedeemScriptType",id:3},script_type:{type:"InputScriptType",id:4,options:{default:"SPENDADDRESS"}}}},OwnershipId:{fields:{ownership_id:{rule:"required",type:"bytes",id:1}}},SignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2},coin_name:{type:"string",id:3,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:4,options:{default:"SPENDADDRESS"}},no_script_type:{type:"bool",id:5}}},MessageSignature:{fields:{address:{rule:"required",type:"string",id:1},signature:{rule:"required",type:"bytes",id:2}}},VerifyMessage:{fields:{address:{rule:"required",type:"string",id:1},signature:{rule:"required",type:"bytes",id:2},message:{rule:"required",type:"bytes",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}}}},SignTx:{fields:{outputs_count:{rule:"required",type:"uint32",id:1},inputs_count:{rule:"required",type:"uint32",id:2},coin_name:{type:"string",id:3,options:{default:"Bitcoin"}},version:{type:"uint32",id:4,options:{default:1}},lock_time:{type:"uint32",id:5,options:{default:0}},expiry:{type:"uint32",id:6},overwintered:{type:"bool",id:7,options:{deprecated:!0}},version_group_id:{type:"uint32",id:8},timestamp:{type:"uint32",id:9},branch_id:{type:"uint32",id:10},amount_unit:{type:"AmountUnit",id:11,options:{default:"BITCOIN"}},decred_staking_ticket:{type:"bool",id:12,options:{default:!1}}}},TxRequest:{fields:{request_type:{type:"RequestType",id:1},details:{type:"TxRequestDetailsType",id:2},serialized:{type:"TxRequestSerializedType",id:3}},nested:{RequestType:{values:{TXINPUT:0,TXOUTPUT:1,TXMETA:2,TXFINISHED:3,TXEXTRADATA:4,TXORIGINPUT:5,TXORIGOUTPUT:6}},TxRequestDetailsType:{fields:{request_index:{type:"uint32",id:1},tx_hash:{type:"bytes",id:2},extra_data_len:{type:"uint32",id:3},extra_data_offset:{type:"uint32",id:4}}},TxRequestSerializedType:{fields:{signature_index:{type:"uint32",id:1},signature:{type:"bytes",id:2},serialized_tx:{type:"bytes",id:3}}}}},TxAck:{options:{deprecated:!0},fields:{tx:{type:"TransactionType",id:1}},nested:{TransactionType:{fields:{version:{type:"uint32",id:1},inputs:{rule:"repeated",type:"TxInputType",id:2},bin_outputs:{rule:"repeated",type:"TxOutputBinType",id:3},lock_time:{type:"uint32",id:4},outputs:{rule:"repeated",type:"TxOutputType",id:5},inputs_cnt:{type:"uint32",id:6},outputs_cnt:{type:"uint32",id:7},extra_data:{type:"bytes",id:8},extra_data_len:{type:"uint32",id:9},expiry:{type:"uint32",id:10},overwintered:{type:"bool",id:11,options:{deprecated:!0}},version_group_id:{type:"uint32",id:12},timestamp:{type:"uint32",id:13},branch_id:{type:"uint32",id:14}},nested:{TxInputType:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{type:"bytes",id:4},sequence:{type:"uint32",id:5,options:{default:4294967295}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:7},amount:{type:"uint64",id:8},decred_tree:{type:"uint32",id:9},witness:{type:"bytes",id:13},ownership_proof:{type:"bytes",id:14},commitment_data:{type:"bytes",id:15},orig_hash:{type:"bytes",id:16},orig_index:{type:"uint32",id:17},decred_staking_spend:{type:"DecredStakingSpendType",id:18},script_pubkey:{type:"bytes",id:19}}},TxOutputBinType:{fields:{amount:{rule:"required",type:"uint64",id:1},script_pubkey:{rule:"required",type:"bytes",id:2},decred_script_version:{type:"uint32",id:3}}},TxOutputType:{fields:{address:{type:"string",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:3},script_type:{type:"OutputScriptType",id:4,options:{default:"PAYTOADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:5},op_return_data:{type:"bytes",id:6},orig_hash:{type:"bytes",id:10},orig_index:{type:"uint32",id:11}}}}}}},TxInput:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{type:"bytes",id:4},sequence:{type:"uint32",id:5,options:{default:4294967295}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:7},amount:{rule:"required",type:"uint64",id:8},decred_tree:{type:"uint32",id:9},witness:{type:"bytes",id:13},ownership_proof:{type:"bytes",id:14},commitment_data:{type:"bytes",id:15},orig_hash:{type:"bytes",id:16},orig_index:{type:"uint32",id:17},decred_staking_spend:{type:"DecredStakingSpendType",id:18},script_pubkey:{type:"bytes",id:19}}},TxOutput:{fields:{address:{type:"string",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:3},script_type:{type:"OutputScriptType",id:4,options:{default:"PAYTOADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:5},op_return_data:{type:"bytes",id:6},orig_hash:{type:"bytes",id:10},orig_index:{type:"uint32",id:11}}},PrevTx:{fields:{version:{rule:"required",type:"uint32",id:1},lock_time:{rule:"required",type:"uint32",id:4},inputs_count:{rule:"required",type:"uint32",id:6},outputs_count:{rule:"required",type:"uint32",id:7},extra_data_len:{type:"uint32",id:9,options:{default:0}},expiry:{type:"uint32",id:10},version_group_id:{type:"uint32",id:12},timestamp:{type:"uint32",id:13},branch_id:{type:"uint32",id:14}}},PrevInput:{fields:{prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{rule:"required",type:"bytes",id:4},sequence:{rule:"required",type:"uint32",id:5},decred_tree:{type:"uint32",id:9}}},PrevOutput:{fields:{amount:{rule:"required",type:"uint64",id:1},script_pubkey:{rule:"required",type:"bytes",id:2},decred_script_version:{type:"uint32",id:3}}},TxAckInput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckInputWrapper",id:1}},nested:{TxAckInputWrapper:{fields:{input:{rule:"required",type:"TxInput",id:2}}}}},TxAckOutput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckOutputWrapper",id:1}},nested:{TxAckOutputWrapper:{fields:{output:{rule:"required",type:"TxOutput",id:5}}}}},TxAckPrevMeta:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"PrevTx",id:1}}},TxAckPrevInput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevInputWrapper",id:1}},nested:{TxAckPrevInputWrapper:{fields:{input:{rule:"required",type:"PrevInput",id:2}}}}},TxAckPrevOutput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevOutputWrapper",id:1}},nested:{TxAckPrevOutputWrapper:{fields:{output:{rule:"required",type:"PrevOutput",id:3}}}}},TxAckPrevExtraData:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevExtraDataWrapper",id:1}},nested:{TxAckPrevExtraDataWrapper:{fields:{extra_data_chunk:{rule:"required",type:"bytes",id:8}}}}},GetOwnershipProof:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:3,options:{default:"SPENDWITNESS"}},multisig:{type:"MultisigRedeemScriptType",id:4},user_confirmation:{type:"bool",id:5,options:{default:!1}},ownership_ids:{rule:"repeated",type:"bytes",id:6},commitment_data:{type:"bytes",id:7,options:{default:""}}}},OwnershipProof:{fields:{ownership_proof:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},AuthorizeCoinJoin:{options:{"(unstable)":!0},fields:{coordinator:{rule:"required",type:"string",id:1},max_total_fee:{rule:"required",type:"uint64",id:2},fee_per_anonymity:{type:"uint32",id:3,options:{default:0}},address_n:{rule:"repeated",type:"uint32",id:4,options:{packed:!1}},coin_name:{type:"string",id:5,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},amount_unit:{type:"AmountUnit",id:11,options:{default:"BITCOIN"}}}},GetPublicKeyMultiple:{fields:{addresses:{rule:"repeated",type:"BIP32Address",id:1},ecdsa_curve_name:{type:"string",id:2},show_display:{type:"bool",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}},nested:{BIP32Address:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}}}},PublicKeyMultiple:{fields:{xpubs:{rule:"repeated",type:"string",id:1}}},FirmwareErase:{fields:{length:{type:"uint32",id:1}}},FirmwareRequest:{fields:{offset:{type:"uint32",id:1},length:{type:"uint32",id:2}}},FirmwareUpload:{fields:{payload:{rule:"required",type:"bytes",id:1},hash:{type:"bytes",id:2}}},SelfTest:{fields:{payload:{type:"bytes",id:1}}},FirmwareErase_ex:{fields:{length:{type:"uint32",id:1}}},CardanoDerivationType:{values:{LEDGER:0,ICARUS:1,ICARUS_TREZOR:2}},CardanoAddressType:{values:{BASE:0,BASE_SCRIPT_KEY:1,BASE_KEY_SCRIPT:2,BASE_SCRIPT_SCRIPT:3,POINTER:4,POINTER_SCRIPT:5,ENTERPRISE:6,ENTERPRISE_SCRIPT:7,BYRON:8,REWARD:14,REWARD_SCRIPT:15}},CardanoNativeScriptType:{values:{PUB_KEY:0,ALL:1,ANY:2,N_OF_K:3,INVALID_BEFORE:4,INVALID_HEREAFTER:5}},CardanoNativeScriptHashDisplayFormat:{values:{HIDE:0,BECH32:1,POLICY_ID:2}},CardanoCertificateType:{values:{STAKE_REGISTRATION:0,STAKE_DEREGISTRATION:1,STAKE_DELEGATION:2,STAKE_POOL_REGISTRATION:3}},CardanoPoolRelayType:{values:{SINGLE_HOST_IP:0,SINGLE_HOST_NAME:1,MULTIPLE_HOST_NAME:2}},CardanoTxAuxiliaryDataSupplementType:{values:{NONE:0,CATALYST_REGISTRATION_SIGNATURE:1}},CardanoTxSigningMode:{values:{ORDINARY_TRANSACTION:0,POOL_REGISTRATION_AS_OWNER:1,MULTISIG_TRANSACTION:2}},CardanoTxWitnessType:{values:{BYRON_WITNESS:0,SHELLEY_WITNESS:1}},CardanoBlockchainPointerType:{fields:{block_index:{rule:"required",type:"uint32",id:1},tx_index:{rule:"required",type:"uint32",id:2},certificate_index:{rule:"required",type:"uint32",id:3}}},CardanoNativeScript:{fields:{type:{rule:"required",type:"CardanoNativeScriptType",id:1},scripts:{rule:"repeated",type:"CardanoNativeScript",id:2},key_hash:{type:"bytes",id:3},key_path:{rule:"repeated",type:"uint32",id:4,options:{packed:!1}},required_signatures_count:{type:"uint32",id:5},invalid_before:{type:"uint64",id:6},invalid_hereafter:{type:"uint64",id:7}}},CardanoGetNativeScriptHash:{fields:{script:{rule:"required",type:"CardanoNativeScript",id:1},display_format:{rule:"required",type:"CardanoNativeScriptHashDisplayFormat",id:2},derivation_type:{rule:"required",type:"CardanoDerivationType",id:3}}},CardanoNativeScriptHash:{fields:{script_hash:{rule:"required",type:"bytes",id:1}}},CardanoAddressParametersType:{fields:{address_type:{rule:"required",type:"CardanoAddressType",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},address_n_staking:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},staking_key_hash:{type:"bytes",id:4},certificate_pointer:{type:"CardanoBlockchainPointerType",id:5},script_payment_hash:{type:"bytes",id:6},script_staking_hash:{type:"bytes",id:7}}},CardanoGetAddress:{fields:{show_display:{type:"bool",id:2,options:{default:!1}},protocol_magic:{rule:"required",type:"uint32",id:3},network_id:{rule:"required",type:"uint32",id:4},address_parameters:{rule:"required",type:"CardanoAddressParametersType",id:5},derivation_type:{rule:"required",type:"CardanoDerivationType",id:6}}},CardanoAddress:{fields:{address:{rule:"required",type:"string",id:1}}},CardanoGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},derivation_type:{rule:"required",type:"CardanoDerivationType",id:3}}},CardanoPublicKey:{fields:{xpub:{rule:"required",type:"string",id:1},node:{rule:"required",type:"HDNodeType",id:2}}},CardanoSignTxInit:{fields:{signing_mode:{rule:"required",type:"CardanoTxSigningMode",id:1},protocol_magic:{rule:"required",type:"uint32",id:2},network_id:{rule:"required",type:"uint32",id:3},inputs_count:{rule:"required",type:"uint32",id:4},outputs_count:{rule:"required",type:"uint32",id:5},fee:{rule:"required",type:"uint64",id:6},ttl:{type:"uint64",id:7},certificates_count:{rule:"required",type:"uint32",id:8},withdrawals_count:{rule:"required",type:"uint32",id:9},has_auxiliary_data:{rule:"required",type:"bool",id:10},validity_interval_start:{type:"uint64",id:11},witness_requests_count:{rule:"required",type:"uint32",id:12},minting_asset_groups_count:{rule:"required",type:"uint32",id:13},derivation_type:{rule:"required",type:"CardanoDerivationType",id:14}}},CardanoTxInput:{fields:{prev_hash:{rule:"required",type:"bytes",id:1},prev_index:{rule:"required",type:"uint32",id:2}}},CardanoTxOutput:{fields:{address:{type:"string",id:1},address_parameters:{type:"CardanoAddressParametersType",id:2},amount:{rule:"required",type:"uint64",id:3},asset_groups_count:{rule:"required",type:"uint32",id:4}}},CardanoAssetGroup:{fields:{policy_id:{rule:"required",type:"bytes",id:1},tokens_count:{rule:"required",type:"uint32",id:2}}},CardanoToken:{fields:{asset_name_bytes:{rule:"required",type:"bytes",id:1},amount:{type:"uint64",id:2},mint_amount:{type:"sint64",id:3}}},CardanoPoolOwner:{fields:{staking_key_path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},staking_key_hash:{type:"bytes",id:2}}},CardanoPoolRelayParameters:{fields:{type:{rule:"required",type:"CardanoPoolRelayType",id:1},ipv4_address:{type:"bytes",id:2},ipv6_address:{type:"bytes",id:3},host_name:{type:"string",id:4},port:{type:"uint32",id:5}}},CardanoPoolMetadataType:{fields:{url:{rule:"required",type:"string",id:1},hash:{rule:"required",type:"bytes",id:2}}},CardanoPoolParametersType:{fields:{pool_id:{rule:"required",type:"bytes",id:1},vrf_key_hash:{rule:"required",type:"bytes",id:2},pledge:{rule:"required",type:"uint64",id:3},cost:{rule:"required",type:"uint64",id:4},margin_numerator:{rule:"required",type:"uint64",id:5},margin_denominator:{rule:"required",type:"uint64",id:6},reward_account:{rule:"required",type:"string",id:7},owners:{rule:"repeated",type:"CardanoPoolOwner",id:8,options:{deprecated:!0}},relays:{rule:"repeated",type:"CardanoPoolRelayParameters",id:9,options:{deprecated:!0}},metadata:{type:"CardanoPoolMetadataType",id:10},owners_count:{rule:"required",type:"uint32",id:11},relays_count:{rule:"required",type:"uint32",id:12}}},CardanoTxCertificate:{fields:{type:{rule:"required",type:"CardanoCertificateType",id:1},path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},pool:{type:"bytes",id:3},pool_parameters:{type:"CardanoPoolParametersType",id:4},script_hash:{type:"bytes",id:5}}},CardanoTxWithdrawal:{fields:{path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:2},script_hash:{type:"bytes",id:3}}},CardanoCatalystRegistrationParametersType:{fields:{voting_public_key:{rule:"required",type:"bytes",id:1},staking_path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},reward_address_parameters:{rule:"required",type:"CardanoAddressParametersType",id:3},nonce:{rule:"required",type:"uint64",id:4}}},CardanoTxAuxiliaryData:{fields:{catalyst_registration_parameters:{type:"CardanoCatalystRegistrationParametersType",id:1},hash:{type:"bytes",id:2}}},CardanoTxMint:{fields:{asset_groups_count:{rule:"required",type:"uint32",id:1}}},CardanoTxItemAck:{fields:{}},CardanoTxAuxiliaryDataSupplement:{fields:{type:{rule:"required",type:"CardanoTxAuxiliaryDataSupplementType",id:1},auxiliary_data_hash:{type:"bytes",id:2},catalyst_signature:{type:"bytes",id:3}}},CardanoTxWitnessRequest:{fields:{path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},CardanoTxWitnessResponse:{fields:{type:{rule:"required",type:"CardanoTxWitnessType",id:1},pub_key:{rule:"required",type:"bytes",id:2},signature:{rule:"required",type:"bytes",id:3},chain_code:{type:"bytes",id:4}}},CardanoTxHostAck:{fields:{}},CardanoTxBodyHash:{fields:{tx_hash:{rule:"required",type:"bytes",id:1}}},CardanoSignTxFinished:{fields:{}},CardanoSignTx:{options:{deprecated:!0},fields:{inputs:{rule:"repeated",type:"CardanoTxInputType",id:1},outputs:{rule:"repeated",type:"CardanoTxOutputType",id:2},protocol_magic:{rule:"required",type:"uint32",id:5},fee:{rule:"required",type:"uint64",id:6},ttl:{type:"uint64",id:7},network_id:{rule:"required",type:"uint32",id:8},certificates:{rule:"repeated",type:"CardanoTxCertificateType",id:9},withdrawals:{rule:"repeated",type:"CardanoTxWithdrawalType",id:10},validity_interval_start:{type:"uint64",id:12},auxiliary_data:{type:"CardanoTxAuxiliaryDataType",id:13}},nested:{CardanoTxInputType:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3}}},CardanoTxOutputType:{fields:{address:{type:"string",id:1},amount:{rule:"required",type:"uint64",id:3},address_parameters:{type:"CardanoAddressParametersType",id:4},token_bundle:{rule:"repeated",type:"CardanoAssetGroupType",id:5}}},CardanoAssetGroupType:{fields:{policy_id:{rule:"required",type:"bytes",id:1},tokens:{rule:"repeated",type:"CardanoTokenType",id:2}}},CardanoTokenType:{fields:{asset_name_bytes:{rule:"required",type:"bytes",id:1},amount:{rule:"required",type:"uint64",id:2}}},CardanoPoolOwnerType:{fields:{staking_key_path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},staking_key_hash:{type:"bytes",id:2}}},CardanoPoolRelayParametersType:{fields:{type:{rule:"required",type:"CardanoPoolRelayType",id:1},ipv4_address:{type:"bytes",id:2},ipv6_address:{type:"bytes",id:3},host_name:{type:"string",id:4},port:{type:"uint32",id:5}}},CardanoTxCertificateType:{fields:{type:{rule:"required",type:"CardanoCertificateType",id:1},path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},pool:{type:"bytes",id:3},pool_parameters:{type:"CardanoPoolParametersType",id:4}}},CardanoTxWithdrawalType:{fields:{path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:2}}},CardanoTxAuxiliaryDataType:{fields:{blob:{type:"bytes",id:1},catalyst_registration_parameters:{type:"CardanoCatalystRegistrationParametersType",id:2}}}}},CardanoSignedTxChunk:{options:{deprecated:!0},fields:{signed_tx_chunk:{rule:"required",type:"bytes",id:1}}},CardanoSignedTxChunkAck:{options:{deprecated:!0},fields:{}},CardanoSignedTx:{options:{deprecated:!0},fields:{tx_hash:{rule:"required",type:"bytes",id:1},serialized_tx:{type:"bytes",id:2}}},Success:{fields:{message:{type:"string",id:1,options:{default:""}}}},Failure:{fields:{code:{type:"FailureType",id:1},message:{type:"string",id:2}},nested:{FailureType:{values:{Failure_UnexpectedMessage:1,Failure_ButtonExpected:2,Failure_DataError:3,Failure_ActionCancelled:4,Failure_PinExpected:5,Failure_PinCancelled:6,Failure_PinInvalid:7,Failure_InvalidSignature:8,Failure_ProcessError:9,Failure_NotEnoughFunds:10,Failure_NotInitialized:11,Failure_PinMismatch:12,Failure_WipeCodeMismatch:13,Failure_InvalidSession:14,Failure_FirmwareError:99}}}},ButtonRequest:{fields:{code:{type:"ButtonRequestType",id:1},pages:{type:"uint32",id:2}},nested:{ButtonRequestType:{values:{ButtonRequest_Other:1,ButtonRequest_FeeOverThreshold:2,ButtonRequest_ConfirmOutput:3,ButtonRequest_ResetDevice:4,ButtonRequest_ConfirmWord:5,ButtonRequest_WipeDevice:6,ButtonRequest_ProtectCall:7,ButtonRequest_SignTx:8,ButtonRequest_FirmwareCheck:9,ButtonRequest_Address:10,ButtonRequest_PublicKey:11,ButtonRequest_MnemonicWordCount:12,ButtonRequest_MnemonicInput:13,_Deprecated_ButtonRequest_PassphraseType:14,ButtonRequest_UnknownDerivationPath:15,ButtonRequest_RecoveryHomepage:16,ButtonRequest_Success:17,ButtonRequest_Warning:18,ButtonRequest_PassphraseEntry:19,ButtonRequest_PinEntry:20}}}},ButtonAck:{fields:{}},PinMatrixRequest:{fields:{type:{type:"PinMatrixRequestType",id:1}},nested:{PinMatrixRequestType:{values:{PinMatrixRequestType_Current:1,PinMatrixRequestType_NewFirst:2,PinMatrixRequestType_NewSecond:3,PinMatrixRequestType_WipeCodeFirst:4,PinMatrixRequestType_WipeCodeSecond:5,PinMatrixRequestType_BackupFirst:6,PinMatrixRequestType_BackupSecond:7}}}},PinMatrixAck:{fields:{pin:{rule:"required",type:"string",id:1},new_pin:{type:"string",id:2}}},PassphraseRequest:{fields:{_on_device:{type:"bool",id:1,options:{deprecated:!0}}}},PassphraseAck:{fields:{passphrase:{type:"string",id:1},_state:{type:"bytes",id:2,options:{deprecated:!0}},on_device:{type:"bool",id:3}}},Deprecated_PassphraseStateRequest:{options:{deprecated:!0},fields:{state:{type:"bytes",id:1}}},Deprecated_PassphraseStateAck:{options:{deprecated:!0},fields:{}},HDNodeType:{fields:{depth:{rule:"required",type:"uint32",id:1},fingerprint:{rule:"required",type:"uint32",id:2},child_num:{rule:"required",type:"uint32",id:3},chain_code:{rule:"required",type:"bytes",id:4},private_key:{type:"bytes",id:5},public_key:{rule:"required",type:"bytes",id:6}}},BixinPinInputOnDevice:{fields:{}},ConfluxGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},chain_id:{type:"uint32",id:3}}},ConfluxAddress:{fields:{address:{type:"string",id:1}}},ConfluxSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{type:"bytes",id:2},gas_price:{type:"bytes",id:3},gas_limit:{type:"bytes",id:4},to:{type:"string",id:5},value:{type:"bytes",id:6},epoch_height:{type:"bytes",id:7},storage_limit:{type:"bytes",id:8},data_initial_chunk:{type:"bytes",id:9},data_length:{type:"uint32",id:10},chain_id:{type:"uint32",id:11}}},ConfluxTxRequest:{fields:{data_length:{type:"uint32",id:1},signature_v:{type:"uint32",id:2},signature_r:{type:"bytes",id:3},signature_s:{type:"bytes",id:4}}},ConfluxTxAck:{fields:{data_chunk:{type:"bytes",id:1}}},ConfluxSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{type:"bytes",id:2}}},ConfluxMessageSignature:{fields:{signature:{type:"bytes",id:2},address:{type:"string",id:3}}},ConfluxSignMessageCIP23:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_hash:{type:"bytes",id:2},message_hash:{type:"bytes",id:3}}},CosmosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},hrp:{type:"string",id:2},show_display:{type:"bool",id:3}}},CosmosAddress:{fields:{address:{type:"string",id:1}}},CosmosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},CosmosSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},CipherKeyValue:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},key:{rule:"required",type:"string",id:2},value:{rule:"required",type:"bytes",id:3},encrypt:{type:"bool",id:4},ask_on_encrypt:{type:"bool",id:5},ask_on_decrypt:{type:"bool",id:6},iv:{type:"bytes",id:7}}},CipheredKeyValue:{fields:{value:{rule:"required",type:"bytes",id:1}}},IdentityType:{fields:{proto:{type:"string",id:1},user:{type:"string",id:2},host:{type:"string",id:3},port:{type:"string",id:4},path:{type:"string",id:5},index:{type:"uint32",id:6,options:{default:0}}}},SignIdentity:{fields:{identity:{rule:"required",type:"IdentityType",id:1},challenge_hidden:{type:"bytes",id:2,options:{default:""}},challenge_visual:{type:"string",id:3,options:{default:""}},ecdsa_curve_name:{type:"string",id:4}}},SignedIdentity:{fields:{address:{type:"string",id:1},public_key:{rule:"required",type:"bytes",id:2},signature:{rule:"required",type:"bytes",id:3}}},GetECDHSessionKey:{fields:{identity:{rule:"required",type:"IdentityType",id:1},peer_public_key:{rule:"required",type:"bytes",id:2},ecdsa_curve_name:{type:"string",id:3}}},ECDHSessionKey:{fields:{session_key:{rule:"required",type:"bytes",id:1},public_key:{type:"bytes",id:2}}},CosiCommit:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},data:{type:"bytes",id:2}}},CosiCommitment:{fields:{commitment:{type:"bytes",id:1},pubkey:{type:"bytes",id:2}}},CosiSign:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},data:{type:"bytes",id:2},global_commitment:{type:"bytes",id:3},global_pubkey:{type:"bytes",id:4}}},CosiSignature:{fields:{signature:{rule:"required",type:"bytes",id:1}}},BatchGetPublickeys:{fields:{ecdsa_curve_name:{type:"string",id:1,options:{default:"ed25519"}},paths:{rule:"repeated",type:"Path",id:2}},nested:{Path:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}}}},EcdsaPublicKeys:{fields:{public_keys:{rule:"repeated",type:"bytes",id:1}}},DebugLinkDecision:{fields:{yes_no:{type:"bool",id:1},swipe:{type:"DebugSwipeDirection",id:2},input:{type:"string",id:3},x:{type:"uint32",id:4},y:{type:"uint32",id:5},wait:{type:"bool",id:6},hold_ms:{type:"uint32",id:7}},nested:{DebugSwipeDirection:{values:{UP:0,DOWN:1,LEFT:2,RIGHT:3}}}},DebugLinkLayout:{fields:{lines:{rule:"repeated",type:"string",id:1}}},DebugLinkReseedRandom:{fields:{value:{type:"uint32",id:1}}},DebugLinkRecordScreen:{fields:{target_directory:{type:"string",id:1}}},DebugLinkGetState:{fields:{wait_word_list:{type:"bool",id:1},wait_word_pos:{type:"bool",id:2},wait_layout:{type:"bool",id:3}}},DebugLinkState:{fields:{layout:{type:"bytes",id:1},pin:{type:"string",id:2},matrix:{type:"string",id:3},mnemonic_secret:{type:"bytes",id:4},node:{type:"HDNodeType",id:5},passphrase_protection:{type:"bool",id:6},reset_word:{type:"string",id:7},reset_entropy:{type:"bytes",id:8},recovery_fake_word:{type:"string",id:9},recovery_word_pos:{type:"uint32",id:10},reset_word_pos:{type:"uint32",id:11},mnemonic_type:{type:"BackupType",id:12},layout_lines:{rule:"repeated",type:"string",id:13}}},DebugLinkStop:{fields:{}},DebugLinkLog:{fields:{level:{type:"uint32",id:1},bucket:{type:"string",id:2},text:{type:"string",id:3}}},DebugLinkMemoryRead:{fields:{address:{type:"uint32",id:1},length:{type:"uint32",id:2}}},DebugLinkMemory:{fields:{memory:{type:"bytes",id:1}}},DebugLinkMemoryWrite:{fields:{address:{type:"uint32",id:1},memory:{type:"bytes",id:2},flash:{type:"bool",id:3}}},DebugLinkFlashErase:{fields:{sector:{type:"uint32",id:1}}},DebugLinkEraseSdCard:{fields:{format:{type:"bool",id:1}}},DebugLinkWatchLayout:{fields:{watch:{type:"bool",id:1}}},EosGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},EosPublicKey:{fields:{wif_public_key:{rule:"required",type:"string",id:1},raw_public_key:{rule:"required",type:"bytes",id:2}}},EosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},chain_id:{type:"bytes",id:2},header:{type:"EosTxHeader",id:3},num_actions:{type:"uint32",id:4}},nested:{EosTxHeader:{fields:{expiration:{rule:"required",type:"uint32",id:1},ref_block_num:{rule:"required",type:"uint32",id:2},ref_block_prefix:{rule:"required",type:"uint32",id:3},max_net_usage_words:{rule:"required",type:"uint32",id:4},max_cpu_usage_ms:{rule:"required",type:"uint32",id:5},delay_sec:{rule:"required",type:"uint32",id:6}}}}},EosTxActionRequest:{fields:{data_size:{type:"uint32",id:1}}},EosTxActionAck:{fields:{common:{type:"EosActionCommon",id:1},transfer:{type:"EosActionTransfer",id:2},delegate:{type:"EosActionDelegate",id:3},undelegate:{type:"EosActionUndelegate",id:4},refund:{type:"EosActionRefund",id:5},buy_ram:{type:"EosActionBuyRam",id:6},buy_ram_bytes:{type:"EosActionBuyRamBytes",id:7},sell_ram:{type:"EosActionSellRam",id:8},vote_producer:{type:"EosActionVoteProducer",id:9},update_auth:{type:"EosActionUpdateAuth",id:10},delete_auth:{type:"EosActionDeleteAuth",id:11},link_auth:{type:"EosActionLinkAuth",id:12},unlink_auth:{type:"EosActionUnlinkAuth",id:13},new_account:{type:"EosActionNewAccount",id:14},unknown:{type:"EosActionUnknown",id:15}},nested:{EosAsset:{fields:{amount:{type:"sint64",id:1},symbol:{type:"uint64",id:2}}},EosPermissionLevel:{fields:{actor:{type:"uint64",id:1},permission:{type:"uint64",id:2}}},EosAuthorizationKey:{fields:{type:{rule:"required",type:"uint32",id:1},key:{type:"bytes",id:2},address_n:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},weight:{rule:"required",type:"uint32",id:4}}},EosAuthorizationAccount:{fields:{account:{type:"EosPermissionLevel",id:1},weight:{type:"uint32",id:2}}},EosAuthorizationWait:{fields:{wait_sec:{type:"uint32",id:1},weight:{type:"uint32",id:2}}},EosAuthorization:{fields:{threshold:{type:"uint32",id:1},keys:{rule:"repeated",type:"EosAuthorizationKey",id:2},accounts:{rule:"repeated",type:"EosAuthorizationAccount",id:3},waits:{rule:"repeated",type:"EosAuthorizationWait",id:4}}},EosActionCommon:{fields:{account:{type:"uint64",id:1},name:{type:"uint64",id:2},authorization:{rule:"repeated",type:"EosPermissionLevel",id:3}}},EosActionTransfer:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},quantity:{type:"EosAsset",id:3},memo:{type:"string",id:4}}},EosActionDelegate:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},net_quantity:{type:"EosAsset",id:3},cpu_quantity:{type:"EosAsset",id:4},transfer:{type:"bool",id:5}}},EosActionUndelegate:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},net_quantity:{type:"EosAsset",id:3},cpu_quantity:{type:"EosAsset",id:4}}},EosActionRefund:{fields:{owner:{type:"uint64",id:1}}},EosActionBuyRam:{fields:{payer:{type:"uint64",id:1},receiver:{type:"uint64",id:2},quantity:{type:"EosAsset",id:3}}},EosActionBuyRamBytes:{fields:{payer:{type:"uint64",id:1},receiver:{type:"uint64",id:2},bytes:{type:"uint32",id:3}}},EosActionSellRam:{fields:{account:{type:"uint64",id:1},bytes:{type:"uint64",id:2}}},EosActionVoteProducer:{fields:{voter:{type:"uint64",id:1},proxy:{type:"uint64",id:2},producers:{rule:"repeated",type:"uint64",id:3,options:{packed:!1}}}},EosActionUpdateAuth:{fields:{account:{type:"uint64",id:1},permission:{type:"uint64",id:2},parent:{type:"uint64",id:3},auth:{type:"EosAuthorization",id:4}}},EosActionDeleteAuth:{fields:{account:{type:"uint64",id:1},permission:{type:"uint64",id:2}}},EosActionLinkAuth:{fields:{account:{type:"uint64",id:1},code:{type:"uint64",id:2},type:{type:"uint64",id:3},requirement:{type:"uint64",id:4}}},EosActionUnlinkAuth:{fields:{account:{type:"uint64",id:1},code:{type:"uint64",id:2},type:{type:"uint64",id:3}}},EosActionNewAccount:{fields:{creator:{type:"uint64",id:1},name:{type:"uint64",id:2},owner:{type:"EosAuthorization",id:3},active:{type:"EosAuthorization",id:4}}},EosActionUnknown:{fields:{data_size:{rule:"required",type:"uint32",id:1},data_chunk:{type:"bytes",id:2}}}}},EosSignedTx:{fields:{signature:{rule:"required",type:"string",id:1}}},EthereumSignTypedData:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},primary_type:{rule:"required",type:"string",id:2},metamask_v4_compat:{type:"bool",id:3,options:{default:!0}}}},EthereumTypedDataStructRequest:{fields:{name:{rule:"required",type:"string",id:1}}},EthereumTypedDataStructAck:{fields:{members:{rule:"repeated",type:"EthereumStructMember",id:1}},nested:{EthereumStructMember:{fields:{type:{rule:"required",type:"EthereumFieldType",id:1},name:{rule:"required",type:"string",id:2}}},EthereumFieldType:{fields:{data_type:{rule:"required",type:"EthereumDataType",id:1},size:{type:"uint32",id:2},entry_type:{type:"EthereumFieldType",id:3},struct_name:{type:"string",id:4}}},EthereumDataType:{values:{UINT:1,INT:2,BYTES:3,STRING:4,BOOL:5,ADDRESS:6,ARRAY:7,STRUCT:8}}}},EthereumTypedDataValueRequest:{fields:{member_path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},EthereumTypedDataValueAck:{fields:{value:{rule:"required",type:"bytes",id:1}}},EthereumGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},EthereumPublicKey:{fields:{node:{rule:"required",type:"HDNodeType",id:1},xpub:{rule:"required",type:"string",id:2}}},EthereumGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},EthereumAddress:{fields:{_old_address:{type:"bytes",id:1,options:{deprecated:!0}},address:{type:"string",id:2}}},EthereumSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{type:"bytes",id:2,options:{default:""}},gas_price:{rule:"required",type:"bytes",id:3},gas_limit:{rule:"required",type:"bytes",id:4},to:{type:"string",id:11,options:{default:""}},value:{type:"bytes",id:6,options:{default:""}},data_initial_chunk:{type:"bytes",id:7,options:{default:""}},data_length:{type:"uint32",id:8,options:{default:0}},chain_id:{rule:"required",type:"uint64",id:9},tx_type:{type:"uint32",id:10}}},EthereumSignTxEIP1559:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{rule:"required",type:"bytes",id:2},max_gas_fee:{rule:"required",type:"bytes",id:3},max_priority_fee:{rule:"required",type:"bytes",id:4},gas_limit:{rule:"required",type:"bytes",id:5},to:{type:"string",id:6,options:{default:""}},value:{rule:"required",type:"bytes",id:7},data_initial_chunk:{type:"bytes",id:8,options:{default:""}},data_length:{rule:"required",type:"uint32",id:9},chain_id:{rule:"required",type:"uint64",id:10},access_list:{rule:"repeated",type:"EthereumAccessList",id:11}},nested:{EthereumAccessList:{fields:{address:{rule:"required",type:"string",id:1},storage_keys:{rule:"repeated",type:"bytes",id:2}}}}},EthereumTxRequest:{fields:{data_length:{type:"uint32",id:1},signature_v:{type:"uint32",id:2},signature_r:{type:"bytes",id:3},signature_s:{type:"bytes",id:4}}},EthereumTxAck:{fields:{data_chunk:{rule:"required",type:"bytes",id:1}}},EthereumSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2}}},EthereumMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:2},address:{rule:"required",type:"string",id:3}}},EthereumVerifyMessage:{fields:{signature:{rule:"required",type:"bytes",id:2},message:{rule:"required",type:"bytes",id:3},address:{rule:"required",type:"string",id:4}}},EthereumSignMessageEIP712:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_hash:{type:"bytes",id:2},message_hash:{type:"bytes",id:3}}},EthereumSignTypedHash:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_separator_hash:{rule:"required",type:"bytes",id:2},message_hash:{type:"bytes",id:3}}},EthereumTypedDataSignature:{fields:{signature:{rule:"required",type:"bytes",id:1},address:{rule:"required",type:"string",id:2}}},BackupType:{values:{Bip39:0,Slip39_Basic:1,Slip39_Advanced:2}},SafetyCheckLevel:{values:{Strict:0,PromptAlways:1,PromptTemporarily:2}},Initialize:{fields:{session_id:{type:"bytes",id:1},_skip_passphrase:{type:"bool",id:2,options:{deprecated:!0}},derive_cardano:{type:"bool",id:3}}},GetFeatures:{fields:{}},Features:{fields:{vendor:{type:"string",id:1},major_version:{rule:"required",type:"uint32",id:2},minor_version:{rule:"required",type:"uint32",id:3},patch_version:{rule:"required",type:"uint32",id:4},bootloader_mode:{type:"bool",id:5},device_id:{type:"string",id:6},pin_protection:{type:"bool",id:7},passphrase_protection:{type:"bool",id:8},language:{type:"string",id:9},label:{type:"string",id:10},initialized:{type:"bool",id:12},revision:{type:"bytes",id:13},bootloader_hash:{type:"bytes",id:14},imported:{type:"bool",id:15},unlocked:{type:"bool",id:16},_passphrase_cached:{type:"bool",id:17,options:{deprecated:!0}},firmware_present:{type:"bool",id:18},needs_backup:{type:"bool",id:19},flags:{type:"uint32",id:20},model:{type:"string",id:21},fw_major:{type:"uint32",id:22},fw_minor:{type:"uint32",id:23},fw_patch:{type:"uint32",id:24},fw_vendor:{type:"string",id:25},fw_vendor_keys:{type:"bytes",id:26},unfinished_backup:{type:"bool",id:27},no_backup:{type:"bool",id:28},recovery_mode:{type:"bool",id:29},capabilities:{rule:"repeated",type:"Capability",id:30,options:{packed:!1}},backup_type:{type:"BackupType",id:31},sd_card_present:{type:"bool",id:32},sd_protection:{type:"bool",id:33},wipe_code_protection:{type:"bool",id:34},session_id:{type:"bytes",id:35},passphrase_always_on_device:{type:"bool",id:36},safety_checks:{type:"SafetyCheckLevel",id:37},auto_lock_delay_ms:{type:"uint32",id:38},display_rotation:{type:"uint32",id:39},experimental_features:{type:"bool",id:40},offset:{type:"uint32",id:500},ble_name:{type:"string",id:501},ble_ver:{type:"string",id:502},ble_enable:{type:"bool",id:503},se_enable:{type:"bool",id:504},se_ver:{type:"string",id:506},backup_only:{type:"bool",id:507},onekey_version:{type:"string",id:508},onekey_serial:{type:"string",id:509},bootloader_version:{type:"string",id:510},serial_no:{type:"string",id:511},spi_flash:{type:"string",id:512},initstates:{type:"uint32",id:513},NFT_voucher:{type:"bytes",id:514},cpu_info:{type:"string",id:515},pre_firmware:{type:"string",id:516},coin_switch:{type:"uint32",id:517},build_id:{type:"string",id:518}},nested:{Capability:{options:{"(has_bitcoin_only_values)":!0},values:{Capability_Bitcoin:1,Capability_Bitcoin_like:2,Capability_Binance:3,Capability_Cardano:4,Capability_Crypto:5,Capability_EOS:6,Capability_Ethereum:7,Capability_Lisk:8,Capability_Monero:9,Capability_NEM:10,Capability_Ripple:11,Capability_Stellar:12,Capability_Tezos:13,Capability_U2F:14,Capability_Shamir:15,Capability_ShamirGroups:16,Capability_PassphraseEntry:17}}}},LockDevice:{fields:{}},EndSession:{fields:{}},ApplySettings:{fields:{language:{type:"string",id:1},label:{type:"string",id:2},use_passphrase:{type:"bool",id:3},homescreen:{type:"bytes",id:4},_passphrase_source:{type:"uint32",id:5,options:{deprecated:!0}},auto_lock_delay_ms:{type:"uint32",id:6},display_rotation:{type:"uint32",id:7},passphrase_always_on_device:{type:"bool",id:8},safety_checks:{type:"SafetyCheckLevel",id:9},experimental_features:{type:"bool",id:10},use_ble:{type:"bool",id:100},use_se:{type:"bool",id:101},is_bixinapp:{type:"bool",id:102},fastpay_pin:{type:"bool",id:103},fastpay_confirm:{type:"bool",id:104},fastpay_money_limit:{type:"uint64",id:105},fastpay_times:{type:"uint32",id:106}},nested:{ExportType:{values:{SeedEncExportType_NO:0,SeedEncExportType_YES:1,MnemonicPlainExportType_YES:2}}}},ApplyFlags:{fields:{flags:{rule:"required",type:"uint32",id:1}}},ChangePin:{fields:{remove:{type:"bool",id:1}}},ChangeWipeCode:{fields:{remove:{type:"bool",id:1}}},SdProtect:{fields:{operation:{rule:"required",type:"SdProtectOperationType",id:1}},nested:{SdProtectOperationType:{values:{DISABLE:0,ENABLE:1,REFRESH:2}}}},Ping:{fields:{message:{type:"string",id:1,options:{default:""}},button_protection:{type:"bool",id:2}}},Cancel:{fields:{}},GetEntropy:{fields:{size:{rule:"required",type:"uint32",id:1}}},Entropy:{fields:{entropy:{rule:"required",type:"bytes",id:1}}},WipeDevice:{fields:{}},LoadDevice:{fields:{mnemonics:{rule:"repeated",type:"string",id:1},pin:{type:"string",id:3},passphrase_protection:{type:"bool",id:4},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},skip_checksum:{type:"bool",id:7},u2f_counter:{type:"uint32",id:8},needs_backup:{type:"bool",id:9},no_backup:{type:"bool",id:10}}},ResetDevice:{fields:{display_random:{type:"bool",id:1},strength:{type:"uint32",id:2,options:{default:256}},passphrase_protection:{type:"bool",id:3},pin_protection:{type:"bool",id:4},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},u2f_counter:{type:"uint32",id:7},skip_backup:{type:"bool",id:8},no_backup:{type:"bool",id:9},backup_type:{type:"BackupType",id:10,options:{default:"Bip39"}}}},BackupDevice:{fields:{}},EntropyRequest:{fields:{}},EntropyAck:{fields:{entropy:{rule:"required",type:"bytes",id:1}}},RecoveryDevice:{fields:{word_count:{type:"uint32",id:1},passphrase_protection:{type:"bool",id:2},pin_protection:{type:"bool",id:3},language:{type:"string",id:4},label:{type:"string",id:5},enforce_wordlist:{type:"bool",id:6},type:{type:"RecoveryDeviceType",id:8},u2f_counter:{type:"uint32",id:9},dry_run:{type:"bool",id:10}},nested:{RecoveryDeviceType:{values:{RecoveryDeviceType_ScrambledWords:0,RecoveryDeviceType_Matrix:1}}}},WordRequest:{fields:{type:{rule:"required",type:"WordRequestType",id:1}},nested:{WordRequestType:{values:{WordRequestType_Plain:0,WordRequestType_Matrix9:1,WordRequestType_Matrix6:2}}}},WordAck:{fields:{word:{rule:"required",type:"string",id:1}}},SetU2FCounter:{fields:{u2f_counter:{rule:"required",type:"uint32",id:1}}},GetNextU2FCounter:{fields:{}},NextU2FCounter:{fields:{u2f_counter:{rule:"required",type:"uint32",id:1}}},DoPreauthorized:{fields:{}},PreauthorizedRequest:{fields:{}},CancelAuthorization:{fields:{}},BixinSeedOperate:{fields:{type:{rule:"required",type:"SeedRequestType",id:1},seed_importData:{type:"bytes",id:2}},nested:{SeedRequestType:{values:{SeedRequestType_Gen:0,SeedRequestType_EncExport:1,SeedRequestType_EncImport:2}}}},BixinMessageSE:{fields:{inputmessage:{rule:"required",type:"bytes",id:1}}},BixinOutMessageSE:{fields:{outmessage:{type:"bytes",id:1}}},DeviceBackToBoot:{fields:{}},BixinBackupRequest:{fields:{}},BixinBackupAck:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinRestoreRequest:{fields:{data:{rule:"required",type:"bytes",id:1},language:{type:"string",id:2},label:{type:"string",id:3},passphrase_protection:{type:"bool",id:4}}},BixinRestoreAck:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinVerifyDeviceRequest:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinVerifyDeviceAck:{fields:{cert:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},BixinWhiteListRequest:{fields:{type:{rule:"required",type:"WL_OperationType",id:1},addr_in:{type:"string",id:2}},nested:{WL_OperationType:{values:{WL_OperationType_Add:0,WL_OperationType_Delete:1,WL_OperationType_Inquire:2}}}},BixinWhiteListAck:{fields:{address:{rule:"repeated",type:"string",id:1}}},BixinLoadDevice:{fields:{mnemonics:{rule:"required",type:"string",id:1},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},skip_checksum:{type:"bool",id:7}}},BixinBackupDevice:{fields:{}},BixinBackupDeviceAck:{fields:{mnemonics:{rule:"required",type:"string",id:1}}},DeviceInfoSettings:{fields:{serial_no:{type:"string",id:1},cpu_info:{type:"string",id:2},pre_firmware:{type:"string",id:3}}},GetDeviceInfo:{fields:{}},DeviceInfo:{fields:{serial_no:{type:"string",id:1},spiFlash_info:{type:"string",id:2},SE_info:{type:"string",id:3},NFT_voucher:{type:"bytes",id:4},cpu_info:{type:"string",id:5},pre_firmware:{type:"string",id:6}}},ReadSEPublicKey:{fields:{}},SEPublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},WriteSEPublicCert:{fields:{public_cert:{rule:"required",type:"bytes",id:1}}},ReadSEPublicCert:{fields:{}},SEPublicCert:{fields:{public_cert:{rule:"required",type:"bytes",id:1}}},SpiFlashWrite:{fields:{address:{rule:"required",type:"uint32",id:1},data:{rule:"required",type:"bytes",id:2}}},SpiFlashRead:{fields:{address:{rule:"required",type:"uint32",id:1},len:{rule:"required",type:"uint32",id:2}}},SpiFlashData:{fields:{data:{rule:"required",type:"bytes",id:1}}},SESignMessage:{fields:{message:{rule:"required",type:"bytes",id:1}}},SEMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:1}}},ResourceUpload:{fields:{extension:{rule:"required",type:"string",id:1},data_length:{rule:"required",type:"uint32",id:2},res_type:{rule:"required",type:"ResourceType",id:3},zoom_data_length:{rule:"required",type:"uint32",id:5},nft_meta_data:{type:"bytes",id:4}},nested:{ResourceType:{values:{WallPaper:0,Nft:1}}}},ZoomRequest:{fields:{offset:{type:"uint32",id:1},data_length:{rule:"required",type:"uint32",id:2}}},ResourceRequest:{fields:{offset:{type:"uint32",id:1},data_length:{rule:"required",type:"uint32",id:2}}},ResourceAck:{fields:{data_chunk:{rule:"required",type:"bytes",id:1},hash:{type:"bytes",id:2}}},ResourceUpdate:{fields:{file_name:{rule:"required",type:"string",id:1},data_length:{rule:"required",type:"uint32",id:2},initial_data_chunk:{rule:"required",type:"bytes",id:3},hash:{type:"bytes",id:4}}},NFTWriteInfo:{fields:{index:{rule:"required",type:"uint32",id:1},width:{rule:"required",type:"uint32",id:2},height:{rule:"required",type:"uint32",id:3},name_zh:{type:"string",id:4},name_en:{type:"string",id:5}}},NFTWriteData:{fields:{index:{rule:"required",type:"uint32",id:1},data:{rule:"required",type:"bytes",id:2},offset:{rule:"required",type:"uint32",id:3}}},RebootToBootloader:{fields:{}},MoneroTransactionSourceEntry:{fields:{outputs:{rule:"repeated",type:"MoneroOutputEntry",id:1},real_output:{type:"uint64",id:2},real_out_tx_key:{type:"bytes",id:3},real_out_additional_tx_keys:{rule:"repeated",type:"bytes",id:4},real_output_in_tx_index:{type:"uint64",id:5},amount:{type:"uint64",id:6},rct:{type:"bool",id:7},mask:{type:"bytes",id:8},multisig_kLRki:{type:"MoneroMultisigKLRki",id:9},subaddr_minor:{type:"uint32",id:10}},nested:{MoneroOutputEntry:{fields:{idx:{type:"uint64",id:1},key:{type:"MoneroRctKeyPublic",id:2}},nested:{MoneroRctKeyPublic:{fields:{dest:{type:"bytes",id:1},commitment:{type:"bytes",id:2}}}}},MoneroMultisigKLRki:{fields:{K:{type:"bytes",id:1},L:{type:"bytes",id:2},R:{type:"bytes",id:3},ki:{type:"bytes",id:4}}}}},MoneroTransactionDestinationEntry:{fields:{amount:{type:"uint64",id:1},addr:{type:"MoneroAccountPublicAddress",id:2},is_subaddress:{type:"bool",id:3},original:{type:"bytes",id:4},is_integrated:{type:"bool",id:5}},nested:{MoneroAccountPublicAddress:{fields:{spend_public_key:{type:"bytes",id:1},view_public_key:{type:"bytes",id:2}}}}},MoneroTransactionRsigData:{fields:{rsig_type:{type:"uint32",id:1},offload_type:{type:"uint32",id:2},grouping:{rule:"repeated",type:"uint64",id:3,options:{packed:!1}},mask:{type:"bytes",id:4},rsig:{type:"bytes",id:5},rsig_parts:{rule:"repeated",type:"bytes",id:6},bp_version:{type:"uint32",id:7}}},MoneroGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},network_type:{type:"uint32",id:3},account:{type:"uint32",id:4},minor:{type:"uint32",id:5},payment_id:{type:"bytes",id:6}}},MoneroAddress:{fields:{address:{type:"bytes",id:1}}},MoneroGetWatchKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2}}},MoneroWatchKey:{fields:{watch_key:{type:"bytes",id:1},address:{type:"bytes",id:2}}},MoneroTransactionInitRequest:{fields:{version:{type:"uint32",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},network_type:{type:"uint32",id:3},tsx_data:{type:"MoneroTransactionData",id:4}},nested:{MoneroTransactionData:{fields:{version:{type:"uint32",id:1},payment_id:{type:"bytes",id:2},unlock_time:{type:"uint64",id:3},outputs:{rule:"repeated",type:"MoneroTransactionDestinationEntry",id:4},change_dts:{type:"MoneroTransactionDestinationEntry",id:5},num_inputs:{type:"uint32",id:6},mixin:{type:"uint32",id:7},fee:{type:"uint64",id:8},account:{type:"uint32",id:9},minor_indices:{rule:"repeated",type:"uint32",id:10,options:{packed:!1}},rsig_data:{type:"MoneroTransactionRsigData",id:11},integrated_indices:{rule:"repeated",type:"uint32",id:12,options:{packed:!1}},client_version:{type:"uint32",id:13},hard_fork:{type:"uint32",id:14},monero_version:{type:"bytes",id:15}}}}},MoneroTransactionInitAck:{fields:{hmacs:{rule:"repeated",type:"bytes",id:1},rsig_data:{type:"MoneroTransactionRsigData",id:2}}},MoneroTransactionSetInputRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1}}},MoneroTransactionSetInputAck:{fields:{vini:{type:"bytes",id:1},vini_hmac:{type:"bytes",id:2},pseudo_out:{type:"bytes",id:3},pseudo_out_hmac:{type:"bytes",id:4},pseudo_out_alpha:{type:"bytes",id:5},spend_key:{type:"bytes",id:6}}},MoneroTransactionInputsPermutationRequest:{fields:{perm:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},MoneroTransactionInputsPermutationAck:{fields:{}},MoneroTransactionInputViniRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1},vini:{type:"bytes",id:2},vini_hmac:{type:"bytes",id:3},pseudo_out:{type:"bytes",id:4},pseudo_out_hmac:{type:"bytes",id:5},orig_idx:{type:"uint32",id:6}}},MoneroTransactionInputViniAck:{fields:{}},MoneroTransactionAllInputsSetRequest:{fields:{}},MoneroTransactionAllInputsSetAck:{fields:{rsig_data:{type:"MoneroTransactionRsigData",id:1}}},MoneroTransactionSetOutputRequest:{fields:{dst_entr:{type:"MoneroTransactionDestinationEntry",id:1},dst_entr_hmac:{type:"bytes",id:2},rsig_data:{type:"MoneroTransactionRsigData",id:3},is_offloaded_bp:{type:"bool",id:4}}},MoneroTransactionSetOutputAck:{fields:{tx_out:{type:"bytes",id:1},vouti_hmac:{type:"bytes",id:2},rsig_data:{type:"MoneroTransactionRsigData",id:3},out_pk:{type:"bytes",id:4},ecdh_info:{type:"bytes",id:5}}},MoneroTransactionAllOutSetRequest:{fields:{rsig_data:{type:"MoneroTransactionRsigData",id:1}}},MoneroTransactionAllOutSetAck:{fields:{extra:{type:"bytes",id:1},tx_prefix_hash:{type:"bytes",id:2},rv:{type:"MoneroRingCtSig",id:4},full_message_hash:{type:"bytes",id:5}},nested:{MoneroRingCtSig:{fields:{txn_fee:{type:"uint64",id:1},message:{type:"bytes",id:2},rv_type:{type:"uint32",id:3}}}}},MoneroTransactionSignInputRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1},vini:{type:"bytes",id:2},vini_hmac:{type:"bytes",id:3},pseudo_out:{type:"bytes",id:4},pseudo_out_hmac:{type:"bytes",id:5},pseudo_out_alpha:{type:"bytes",id:6},spend_key:{type:"bytes",id:7},orig_idx:{type:"uint32",id:8}}},MoneroTransactionSignInputAck:{fields:{signature:{type:"bytes",id:1},pseudo_out:{type:"bytes",id:2}}},MoneroTransactionFinalRequest:{fields:{}},MoneroTransactionFinalAck:{fields:{cout_key:{type:"bytes",id:1},salt:{type:"bytes",id:2},rand_mult:{type:"bytes",id:3},tx_enc_keys:{type:"bytes",id:4},opening_key:{type:"bytes",id:5}}},MoneroKeyImageExportInitRequest:{fields:{num:{type:"uint64",id:1},hash:{type:"bytes",id:2},address_n:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},network_type:{type:"uint32",id:4},subs:{rule:"repeated",type:"MoneroSubAddressIndicesList",id:5}},nested:{MoneroSubAddressIndicesList:{fields:{account:{type:"uint32",id:1},minor_indices:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}}}}}},MoneroKeyImageExportInitAck:{fields:{}},MoneroKeyImageSyncStepRequest:{fields:{tdis:{rule:"repeated",type:"MoneroTransferDetails",id:1}},nested:{MoneroTransferDetails:{fields:{out_key:{type:"bytes",id:1},tx_pub_key:{type:"bytes",id:2},additional_tx_pub_keys:{rule:"repeated",type:"bytes",id:3},internal_output_index:{type:"uint64",id:4},sub_addr_major:{type:"uint32",id:5},sub_addr_minor:{type:"uint32",id:6}}}}},MoneroKeyImageSyncStepAck:{fields:{kis:{rule:"repeated",type:"MoneroExportedKeyImage",id:1}},nested:{MoneroExportedKeyImage:{fields:{iv:{type:"bytes",id:1},blob:{type:"bytes",id:3}}}}},MoneroKeyImageSyncFinalRequest:{fields:{}},MoneroKeyImageSyncFinalAck:{fields:{enc_key:{type:"bytes",id:1}}},MoneroGetTxKeyRequest:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2},salt1:{type:"bytes",id:3},salt2:{type:"bytes",id:4},tx_enc_keys:{type:"bytes",id:5},tx_prefix_hash:{type:"bytes",id:6},reason:{type:"uint32",id:7},view_public_key:{type:"bytes",id:8}}},MoneroGetTxKeyAck:{fields:{salt:{type:"bytes",id:1},tx_keys:{type:"bytes",id:2},tx_derivations:{type:"bytes",id:3}}},MoneroLiveRefreshStartRequest:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2}}},MoneroLiveRefreshStartAck:{fields:{}},MoneroLiveRefreshStepRequest:{fields:{out_key:{type:"bytes",id:1},recv_deriv:{type:"bytes",id:2},real_out_idx:{type:"uint64",id:3},sub_addr_major:{type:"uint32",id:4},sub_addr_minor:{type:"uint32",id:5}}},MoneroLiveRefreshStepAck:{fields:{salt:{type:"bytes",id:1},key_image:{type:"bytes",id:2}}},MoneroLiveRefreshFinalRequest:{fields:{}},MoneroLiveRefreshFinalAck:{fields:{}},DebugMoneroDiagRequest:{fields:{ins:{type:"uint64",id:1},p1:{type:"uint64",id:2},p2:{type:"uint64",id:3},pd:{rule:"repeated",type:"uint64",id:4,options:{packed:!1}},data1:{type:"bytes",id:5},data2:{type:"bytes",id:6}}},DebugMoneroDiagAck:{fields:{ins:{type:"uint64",id:1},p1:{type:"uint64",id:2},p2:{type:"uint64",id:3},pd:{rule:"repeated",type:"uint64",id:4,options:{packed:!1}},data1:{type:"bytes",id:5},data2:{type:"bytes",id:6}}},NearGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},NearAddress:{fields:{address:{type:"string",id:1}}},NearSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},NearSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},NEMGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},show_display:{type:"bool",id:3}}},NEMAddress:{fields:{address:{rule:"required",type:"string",id:1}}},NEMSignTx:{fields:{transaction:{type:"NEMTransactionCommon",id:1},multisig:{type:"NEMTransactionCommon",id:2},transfer:{type:"NEMTransfer",id:3},cosigning:{type:"bool",id:4},provision_namespace:{type:"NEMProvisionNamespace",id:5},mosaic_creation:{type:"NEMMosaicCreation",id:6},supply_change:{type:"NEMMosaicSupplyChange",id:7},aggregate_modification:{type:"NEMAggregateModification",id:8},importance_transfer:{type:"NEMImportanceTransfer",id:9}},nested:{NEMTransactionCommon:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},timestamp:{type:"uint32",id:3},fee:{type:"uint64",id:4},deadline:{type:"uint32",id:5},signer:{type:"bytes",id:6}}},NEMTransfer:{fields:{recipient:{type:"string",id:1},amount:{type:"uint64",id:2},payload:{type:"bytes",id:3},public_key:{type:"bytes",id:4},mosaics:{rule:"repeated",type:"NEMMosaic",id:5}},nested:{NEMMosaic:{fields:{namespace:{type:"string",id:1},mosaic:{type:"string",id:2},quantity:{type:"uint64",id:3}}}}},NEMProvisionNamespace:{fields:{namespace:{type:"string",id:1},parent:{type:"string",id:2},sink:{type:"string",id:3},fee:{type:"uint64",id:4}}},NEMMosaicCreation:{fields:{definition:{type:"NEMMosaicDefinition",id:1},sink:{type:"string",id:2},fee:{type:"uint64",id:3}},nested:{NEMMosaicDefinition:{fields:{name:{type:"string",id:1},ticker:{type:"string",id:2},namespace:{type:"string",id:3},mosaic:{type:"string",id:4},divisibility:{type:"uint32",id:5},levy:{type:"NEMMosaicLevy",id:6},fee:{type:"uint64",id:7},levy_address:{type:"string",id:8},levy_namespace:{type:"string",id:9},levy_mosaic:{type:"string",id:10},supply:{type:"uint64",id:11},mutable_supply:{type:"bool",id:12},transferable:{type:"bool",id:13},description:{type:"string",id:14},networks:{rule:"repeated",type:"uint32",id:15,options:{packed:!1}}},nested:{NEMMosaicLevy:{values:{MosaicLevy_Absolute:1,MosaicLevy_Percentile:2}}}}}},NEMMosaicSupplyChange:{fields:{namespace:{type:"string",id:1},mosaic:{type:"string",id:2},type:{type:"NEMSupplyChangeType",id:3},delta:{type:"uint64",id:4}},nested:{NEMSupplyChangeType:{values:{SupplyChange_Increase:1,SupplyChange_Decrease:2}}}},NEMAggregateModification:{fields:{modifications:{rule:"repeated",type:"NEMCosignatoryModification",id:1},relative_change:{type:"sint32",id:2}},nested:{NEMCosignatoryModification:{fields:{type:{type:"NEMModificationType",id:1},public_key:{type:"bytes",id:2}},nested:{NEMModificationType:{values:{CosignatoryModification_Add:1,CosignatoryModification_Delete:2}}}}}},NEMImportanceTransfer:{fields:{mode:{type:"NEMImportanceTransferMode",id:1},public_key:{type:"bytes",id:2}},nested:{NEMImportanceTransferMode:{values:{ImportanceTransfer_Activate:1,ImportanceTransfer_Deactivate:2}}}}}},NEMSignedTx:{fields:{data:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},NEMDecryptMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},public_key:{type:"bytes",id:3},payload:{type:"bytes",id:4}}},NEMDecryptedMessage:{fields:{payload:{rule:"required",type:"bytes",id:1}}},RippleGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},RippleAddress:{fields:{address:{rule:"required",type:"string",id:1}}},RippleSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},fee:{type:"uint64",id:2},flags:{type:"uint32",id:3},sequence:{type:"uint32",id:4},last_ledger_sequence:{type:"uint32",id:5},payment:{type:"RipplePayment",id:6}},nested:{RipplePayment:{fields:{amount:{rule:"required",type:"uint64",id:1},destination:{rule:"required",type:"string",id:2},destination_tag:{type:"uint32",id:3}}}}},RippleSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},serialized_tx:{rule:"required",type:"bytes",id:2}}},SolanaGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},SolanaAddress:{fields:{address:{type:"string",id:1}}},SolanaSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},SolanaSignedTx:{fields:{signature:{type:"bytes",id:1}}},StarcoinGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StarcoinAddress:{fields:{address:{type:"string",id:1}}},StarcoinGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StarcoinPublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},StarcoinSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{type:"bytes",id:2}}},StarcoinSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},StarcoinSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{type:"bytes",id:2}}},StarcoinMessageSignature:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},StarcoinVerifyMessage:{fields:{public_key:{type:"bytes",id:1},signature:{type:"bytes",id:2},message:{type:"bytes",id:3}}},StellarAssetType:{values:{NATIVE:0,ALPHANUM4:1,ALPHANUM12:2}},StellarAsset:{fields:{type:{rule:"required",type:"StellarAssetType",id:1},code:{type:"string",id:2},issuer:{type:"string",id:3}}},StellarGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StellarAddress:{fields:{address:{rule:"required",type:"string",id:1}}},StellarSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},network_passphrase:{rule:"required",type:"string",id:3},source_account:{rule:"required",type:"string",id:4},fee:{rule:"required",type:"uint32",id:5},sequence_number:{rule:"required",type:"uint64",id:6},timebounds_start:{rule:"required",type:"uint32",id:8},timebounds_end:{rule:"required",type:"uint32",id:9},memo_type:{rule:"required",type:"StellarMemoType",id:10},memo_text:{type:"string",id:11},memo_id:{type:"uint64",id:12},memo_hash:{type:"bytes",id:13},num_operations:{rule:"required",type:"uint32",id:14}},nested:{StellarMemoType:{values:{NONE:0,TEXT:1,ID:2,HASH:3,RETURN:4}}}},StellarTxOpRequest:{fields:{}},StellarPaymentOp:{fields:{source_account:{type:"string",id:1},destination_account:{rule:"required",type:"string",id:2},asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4}}},StellarCreateAccountOp:{fields:{source_account:{type:"string",id:1},new_account:{rule:"required",type:"string",id:2},starting_balance:{rule:"required",type:"sint64",id:3}}},StellarPathPaymentStrictReceiveOp:{fields:{source_account:{type:"string",id:1},send_asset:{rule:"required",type:"StellarAsset",id:2},send_max:{rule:"required",type:"sint64",id:3},destination_account:{rule:"required",type:"string",id:4},destination_asset:{rule:"required",type:"StellarAsset",id:5},destination_amount:{rule:"required",type:"sint64",id:6},paths:{rule:"repeated",type:"StellarAsset",id:7}}},StellarPathPaymentStrictSendOp:{fields:{source_account:{type:"string",id:1},send_asset:{rule:"required",type:"StellarAsset",id:2},send_amount:{rule:"required",type:"sint64",id:3},destination_account:{rule:"required",type:"string",id:4},destination_asset:{rule:"required",type:"StellarAsset",id:5},destination_min:{rule:"required",type:"sint64",id:6},paths:{rule:"repeated",type:"StellarAsset",id:7}}},StellarManageSellOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6},offer_id:{rule:"required",type:"uint64",id:7}}},StellarManageBuyOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6},offer_id:{rule:"required",type:"uint64",id:7}}},StellarCreatePassiveSellOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6}}},StellarSetOptionsOp:{fields:{source_account:{type:"string",id:1},inflation_destination_account:{type:"string",id:2},clear_flags:{type:"uint32",id:3},set_flags:{type:"uint32",id:4},master_weight:{type:"uint32",id:5},low_threshold:{type:"uint32",id:6},medium_threshold:{type:"uint32",id:7},high_threshold:{type:"uint32",id:8},home_domain:{type:"string",id:9},signer_type:{type:"StellarSignerType",id:10},signer_key:{type:"bytes",id:11},signer_weight:{type:"uint32",id:12}},nested:{StellarSignerType:{values:{ACCOUNT:0,PRE_AUTH:1,HASH:2}}}},StellarChangeTrustOp:{fields:{source_account:{type:"string",id:1},asset:{rule:"required",type:"StellarAsset",id:2},limit:{rule:"required",type:"uint64",id:3}}},StellarAllowTrustOp:{fields:{source_account:{type:"string",id:1},trusted_account:{rule:"required",type:"string",id:2},asset_type:{rule:"required",type:"StellarAssetType",id:3},asset_code:{type:"string",id:4},is_authorized:{rule:"required",type:"bool",id:5}}},StellarAccountMergeOp:{fields:{source_account:{type:"string",id:1},destination_account:{rule:"required",type:"string",id:2}}},StellarManageDataOp:{fields:{source_account:{type:"string",id:1},key:{rule:"required",type:"string",id:2},value:{type:"bytes",id:3}}},StellarBumpSequenceOp:{fields:{source_account:{type:"string",id:1},bump_to:{rule:"required",type:"uint64",id:2}}},StellarSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},TezosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TezosAddress:{fields:{address:{rule:"required",type:"string",id:1}}},TezosGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TezosPublicKey:{fields:{public_key:{rule:"required",type:"string",id:1}}},TezosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},branch:{rule:"required",type:"bytes",id:2},reveal:{type:"TezosRevealOp",id:3},transaction:{type:"TezosTransactionOp",id:4},origination:{type:"TezosOriginationOp",id:5},delegation:{type:"TezosDelegationOp",id:6},proposal:{type:"TezosProposalOp",id:7},ballot:{type:"TezosBallotOp",id:8}},nested:{TezosContractID:{fields:{tag:{rule:"required",type:"TezosContractType",id:1},hash:{rule:"required",type:"bytes",id:2}},nested:{TezosContractType:{values:{Implicit:0,Originated:1}}}},TezosRevealOp:{fields:{source:{rule:"required",type:"bytes",id:7},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},public_key:{rule:"required",type:"bytes",id:6}}},TezosTransactionOp:{fields:{source:{rule:"required",type:"bytes",id:9},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},amount:{rule:"required",type:"uint64",id:6},destination:{rule:"required",type:"TezosContractID",id:7},parameters:{type:"bytes",id:8},parameters_manager:{type:"TezosParametersManager",id:10}},nested:{TezosParametersManager:{fields:{set_delegate:{type:"bytes",id:1},cancel_delegate:{type:"bool",id:2},transfer:{type:"TezosManagerTransfer",id:3}},nested:{TezosManagerTransfer:{fields:{destination:{type:"TezosContractID",id:1},amount:{type:"uint64",id:2}}}}}}},TezosOriginationOp:{fields:{source:{rule:"required",type:"bytes",id:12},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},manager_pubkey:{type:"bytes",id:6},balance:{rule:"required",type:"uint64",id:7},spendable:{type:"bool",id:8},delegatable:{type:"bool",id:9},delegate:{type:"bytes",id:10},script:{rule:"required",type:"bytes",id:11}}},TezosDelegationOp:{fields:{source:{rule:"required",type:"bytes",id:7},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},delegate:{rule:"required",type:"bytes",id:6}}},TezosProposalOp:{fields:{source:{type:"bytes",id:1},period:{type:"uint64",id:2},proposals:{rule:"repeated",type:"bytes",id:4}}},TezosBallotOp:{fields:{source:{type:"bytes",id:1},period:{type:"uint64",id:2},proposal:{type:"bytes",id:3},ballot:{type:"TezosBallotType",id:4}},nested:{TezosBallotType:{values:{Yay:0,Nay:1,Pass:2}}}}}},TezosSignedTx:{fields:{signature:{rule:"required",type:"string",id:1},sig_op_contents:{rule:"required",type:"bytes",id:2},operation_hash:{rule:"required",type:"string",id:3}}},TronGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TronAddress:{fields:{address:{type:"string",id:1}}},TronSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},ref_block_bytes:{rule:"required",type:"bytes",id:2},ref_block_hash:{rule:"required",type:"bytes",id:3},expiration:{rule:"required",type:"uint64",id:4},data:{type:"string",id:5},contract:{rule:"required",type:"TronContract",id:6},timestamp:{rule:"required",type:"uint64",id:7},fee_limit:{type:"uint64",id:8}},nested:{TronContract:{fields:{transfer_contract:{type:"TronTransferContract",id:2},trigger_smart_contract:{type:"TronTriggerSmartContract",id:31}},nested:{TronTransferContract:{fields:{to_address:{type:"string",id:2},amount:{type:"uint64",id:3}}},TronTriggerSmartContract:{fields:{contract_address:{type:"string",id:2},call_value:{type:"uint64",id:3},data:{type:"bytes",id:4},call_token_value:{type:"uint64",id:5},asset_id:{type:"uint64",id:6}}}}}}},TronSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},serialized_tx:{type:"bytes",id:2}}},TronSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2}}},TronMessageSignature:{fields:{address:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},WebAuthnListResidentCredentials:{fields:{}},WebAuthnAddResidentCredential:{fields:{credential_id:{type:"bytes",id:1}}},WebAuthnRemoveResidentCredential:{fields:{index:{type:"uint32",id:1}}},WebAuthnCredentials:{fields:{credentials:{rule:"repeated",type:"WebAuthnCredential",id:1}},nested:{WebAuthnCredential:{fields:{index:{type:"uint32",id:1},id:{type:"bytes",id:2},rp_id:{type:"string",id:3},rp_name:{type:"string",id:4},user_id:{type:"bytes",id:5},user_name:{type:"string",id:6},user_display_name:{type:"string",id:7},creation_time:{type:"uint32",id:8},hmac_secret:{type:"bool",id:9},use_sign_count:{type:"bool",id:10},algorithm:{type:"sint32",id:11},curve:{type:"sint32",id:12}}}}},wire_in:{type:"bool",id:50002,extend:"google.protobuf.EnumValueOptions"},wire_out:{type:"bool",id:50003,extend:"google.protobuf.EnumValueOptions"},wire_debug_in:{type:"bool",id:50004,extend:"google.protobuf.EnumValueOptions"},wire_debug_out:{type:"bool",id:50005,extend:"google.protobuf.EnumValueOptions"},wire_tiny:{type:"bool",id:50006,extend:"google.protobuf.EnumValueOptions"},wire_bootloader:{type:"bool",id:50007,extend:"google.protobuf.EnumValueOptions"},wire_no_fsm:{type:"bool",id:50008,extend:"google.protobuf.EnumValueOptions"},facotry:{type:"bool",id:50501,extend:"google.protobuf.EnumValueOptions"},bitcoin_only:{type:"bool",id:6e4,extend:"google.protobuf.EnumValueOptions"},has_bitcoin_only_values:{type:"bool",id:51001,extend:"google.protobuf.EnumOptions"},unstable:{type:"bool",id:52001,extend:"google.protobuf.MessageOptions"},wire_type:{type:"uint32",id:52002,extend:"google.protobuf.MessageOptions"},experimental:{type:"bool",id:53001,extend:"google.protobuf.FieldOptions"},include_in_bitcoin_only:{type:"bool",id:6e4,extend:"google.protobuf.FileOptions"},CommandFlags:{values:{Default:0,Factory_Only:1}},MessageType:{options:{"(has_bitcoin_only_values)":!0},values:{MessageType_Initialize:0,MessageType_Ping:1,MessageType_Success:2,MessageType_Failure:3,MessageType_ChangePin:4,MessageType_WipeDevice:5,MessageType_GetEntropy:9,MessageType_Entropy:10,MessageType_LoadDevice:13,MessageType_ResetDevice:14,MessageType_Features:17,MessageType_PinMatrixRequest:18,MessageType_PinMatrixAck:19,MessageType_Cancel:20,MessageType_LockDevice:24,MessageType_ApplySettings:25,MessageType_ButtonRequest:26,MessageType_ButtonAck:27,MessageType_ApplyFlags:28,MessageType_BackupDevice:34,MessageType_EntropyRequest:35,MessageType_EntropyAck:36,MessageType_PassphraseRequest:41,MessageType_PassphraseAck:42,MessageType_RecoveryDevice:45,MessageType_WordRequest:46,MessageType_WordAck:47,MessageType_GetFeatures:55,MessageType_SdProtect:79,MessageType_ChangeWipeCode:82,MessageType_EndSession:83,MessageType_DoPreauthorized:84,MessageType_PreauthorizedRequest:85,MessageType_CancelAuthorization:86,MessageType_RebootToBootloader:87,MessageType_SetU2FCounter:63,MessageType_GetNextU2FCounter:80,MessageType_NextU2FCounter:81,MessageType_Deprecated_PassphraseStateRequest:77,MessageType_Deprecated_PassphraseStateAck:78,MessageType_FirmwareErase:6,MessageType_FirmwareErase_ex:16,MessageType_FirmwareUpload:7,MessageType_FirmwareRequest:8,MessageType_SelfTest:32,MessageType_GetPublicKey:11,MessageType_PublicKey:12,MessageType_SignTx:15,MessageType_TxRequest:21,MessageType_TxAck:22,MessageType_GetAddress:29,MessageType_Address:30,MessageType_SignMessage:38,MessageType_VerifyMessage:39,MessageType_MessageSignature:40,MessageType_GetOwnershipId:43,MessageType_OwnershipId:44,MessageType_GetOwnershipProof:49,MessageType_OwnershipProof:50,MessageType_AuthorizeCoinJoin:51,MessageType_CipherKeyValue:23,MessageType_CipheredKeyValue:48,MessageType_SignIdentity:53,MessageType_SignedIdentity:54,MessageType_GetECDHSessionKey:61,MessageType_ECDHSessionKey:62,MessageType_CosiCommit:71,MessageType_CosiCommitment:72,MessageType_CosiSign:73,MessageType_CosiSignature:74,MessageType_BatchGetPublickeys:10016,MessageType_EcdsaPublicKeys:10017,MessageType_DebugLinkDecision:100,MessageType_DebugLinkGetState:101,MessageType_DebugLinkState:102,MessageType_DebugLinkStop:103,MessageType_DebugLinkLog:104,MessageType_DebugLinkMemoryRead:110,MessageType_DebugLinkMemory:111,MessageType_DebugLinkMemoryWrite:112,MessageType_DebugLinkFlashErase:113,MessageType_DebugLinkLayout:9001,MessageType_DebugLinkReseedRandom:9002,MessageType_DebugLinkRecordScreen:9003,MessageType_DebugLinkEraseSdCard:9005,MessageType_DebugLinkWatchLayout:9006,MessageType_EthereumGetPublicKey:450,MessageType_EthereumPublicKey:451,MessageType_EthereumGetAddress:56,MessageType_EthereumAddress:57,MessageType_EthereumSignTx:58,MessageType_EthereumSignTxEIP1559:452,MessageType_EthereumTxRequest:59,MessageType_EthereumTxAck:60,MessageType_EthereumSignMessage:64,MessageType_EthereumVerifyMessage:65,MessageType_EthereumMessageSignature:66,MessageType_EthereumSignTypedData:464,MessageType_EthereumTypedDataStructRequest:465,MessageType_EthereumTypedDataStructAck:466,MessageType_EthereumTypedDataValueRequest:467,MessageType_EthereumTypedDataValueAck:468,MessageType_EthereumTypedDataSignature:469,MessageType_EthereumSignTypedHash:470,MessageType_NEMGetAddress:67,MessageType_NEMAddress:68,MessageType_NEMSignTx:69,MessageType_NEMSignedTx:70,MessageType_NEMDecryptMessage:75,MessageType_NEMDecryptedMessage:76,MessageType_TezosGetAddress:150,MessageType_TezosAddress:151,MessageType_TezosSignTx:152,MessageType_TezosSignedTx:153,MessageType_TezosGetPublicKey:154,MessageType_TezosPublicKey:155,MessageType_StellarSignTx:202,MessageType_StellarTxOpRequest:203,MessageType_StellarGetAddress:207,MessageType_StellarAddress:208,MessageType_StellarCreateAccountOp:210,MessageType_StellarPaymentOp:211,MessageType_StellarPathPaymentStrictReceiveOp:212,MessageType_StellarManageSellOfferOp:213,MessageType_StellarCreatePassiveSellOfferOp:214,MessageType_StellarSetOptionsOp:215,MessageType_StellarChangeTrustOp:216,MessageType_StellarAllowTrustOp:217,MessageType_StellarAccountMergeOp:218,MessageType_StellarManageDataOp:220,MessageType_StellarBumpSequenceOp:221,MessageType_StellarManageBuyOfferOp:222,MessageType_StellarPathPaymentStrictSendOp:223,MessageType_StellarSignedTx:230,MessageType_CardanoSignTx:303,MessageType_CardanoGetPublicKey:305,MessageType_CardanoPublicKey:306,MessageType_CardanoGetAddress:307,MessageType_CardanoAddress:308,MessageType_CardanoSignedTx:310,MessageType_CardanoSignedTxChunk:311,MessageType_CardanoSignedTxChunkAck:312,MessageType_CardanoTxItemAck:313,MessageType_CardanoTxAuxiliaryDataSupplement:314,MessageType_CardanoTxWitnessRequest:315,MessageType_CardanoTxWitnessResponse:316,MessageType_CardanoTxHostAck:317,MessageType_CardanoTxBodyHash:318,MessageType_CardanoSignTxFinished:319,MessageType_CardanoSignTxInit:320,MessageType_CardanoTxInput:321,MessageType_CardanoTxOutput:322,MessageType_CardanoAssetGroup:323,MessageType_CardanoToken:324,MessageType_CardanoTxCertificate:325,MessageType_CardanoTxWithdrawal:326,MessageType_CardanoTxAuxiliaryData:327,MessageType_CardanoPoolOwner:328,MessageType_CardanoPoolRelayParameters:329,MessageType_CardanoGetNativeScriptHash:330,MessageType_CardanoNativeScriptHash:331,MessageType_CardanoTxMint:332,MessageType_RippleGetAddress:400,MessageType_RippleAddress:401,MessageType_RippleSignTx:402,MessageType_RippleSignedTx:403,MessageType_MoneroTransactionInitRequest:501,MessageType_MoneroTransactionInitAck:502,MessageType_MoneroTransactionSetInputRequest:503,MessageType_MoneroTransactionSetInputAck:504,MessageType_MoneroTransactionInputsPermutationRequest:505,MessageType_MoneroTransactionInputsPermutationAck:506,MessageType_MoneroTransactionInputViniRequest:507,MessageType_MoneroTransactionInputViniAck:508,MessageType_MoneroTransactionAllInputsSetRequest:509,MessageType_MoneroTransactionAllInputsSetAck:510,MessageType_MoneroTransactionSetOutputRequest:511,MessageType_MoneroTransactionSetOutputAck:512,MessageType_MoneroTransactionAllOutSetRequest:513,MessageType_MoneroTransactionAllOutSetAck:514,MessageType_MoneroTransactionSignInputRequest:515,MessageType_MoneroTransactionSignInputAck:516,MessageType_MoneroTransactionFinalRequest:517,MessageType_MoneroTransactionFinalAck:518,MessageType_MoneroKeyImageExportInitRequest:530,MessageType_MoneroKeyImageExportInitAck:531,MessageType_MoneroKeyImageSyncStepRequest:532,MessageType_MoneroKeyImageSyncStepAck:533,MessageType_MoneroKeyImageSyncFinalRequest:534,MessageType_MoneroKeyImageSyncFinalAck:535,MessageType_MoneroGetAddress:540,MessageType_MoneroAddress:541,MessageType_MoneroGetWatchKey:542,MessageType_MoneroWatchKey:543,MessageType_DebugMoneroDiagRequest:546,MessageType_DebugMoneroDiagAck:547,MessageType_MoneroGetTxKeyRequest:550,MessageType_MoneroGetTxKeyAck:551,MessageType_MoneroLiveRefreshStartRequest:552,MessageType_MoneroLiveRefreshStartAck:553,MessageType_MoneroLiveRefreshStepRequest:554,MessageType_MoneroLiveRefreshStepAck:555,MessageType_MoneroLiveRefreshFinalRequest:556,MessageType_MoneroLiveRefreshFinalAck:557,MessageType_EosGetPublicKey:600,MessageType_EosPublicKey:601,MessageType_EosSignTx:602,MessageType_EosTxActionRequest:603,MessageType_EosTxActionAck:604,MessageType_EosSignedTx:605,MessageType_BinanceGetAddress:700,MessageType_BinanceAddress:701,MessageType_BinanceGetPublicKey:702,MessageType_BinancePublicKey:703,MessageType_BinanceSignTx:704,MessageType_BinanceTxRequest:705,MessageType_BinanceTransferMsg:706,MessageType_BinanceOrderMsg:707,MessageType_BinanceCancelMsg:708,MessageType_BinanceSignedTx:709,MessageType_SolanaGetAddress:10100,MessageType_SolanaAddress:10101,MessageType_SolanaSignTx:10102,MessageType_SolanaSignedTx:10103,MessageType_StarcoinGetAddress:10300,MessageType_StarcoinAddress:10301,MessageType_StarcoinGetPublicKey:10302,MessageType_StarcoinPublicKey:10303,MessageType_StarcoinSignTx:10304,MessageType_StarcoinSignedTx:10305,MessageType_StarcoinSignMessage:10306,MessageType_StarcoinMessageSignature:10307,MessageType_StarcoinVerifyMessage:10308,MessageType_AptosGetAddress:10600,MessageType_AptosAddress:10601,MessageType_AptosSignTx:10602,MessageType_AptosSignedTx:10603,MessageType_AptosSignMessage:10604,MessageType_AptosMessageSignature:10605,MessageType_WebAuthnListResidentCredentials:800,MessageType_WebAuthnCredentials:801,MessageType_WebAuthnAddResidentCredential:802,MessageType_WebAuthnRemoveResidentCredential:803,MessageType_BixinSeedOperate:901,MessageType_BixinMessageSE:902,MessageType_BixinOutMessageSE:904,MessageType_BixinBackupRequest:905,MessageType_BixinBackupAck:906,MessageType_BixinRestoreRequest:907,MessageType_BixinRestoreAck:908,MessageType_BixinVerifyDeviceRequest:909,MessageType_BixinVerifyDeviceAck:910,MessageType_BixinWhiteListRequest:911,MessageType_BixinWhiteListAck:912,MessageType_BixinLoadDevice:913,MessageType_BixinBackupDevice:914,MessageType_BixinBackupDeviceAck:915,MessageType_BixinPinInputOnDevice:1e4,MessageType_EthereumSignMessageEIP712:10200,MessageType_GetPublicKeyMultiple:10210,MessageType_PublicKeyMultiple:10211,MessageType_ConfluxGetAddress:10112,MessageType_ConfluxAddress:10113,MessageType_ConfluxSignTx:10114,MessageType_ConfluxTxRequest:10115,MessageType_ConfluxTxAck:10116,MessageType_ConfluxSignMessage:10117,MessageType_ConfluxSignMessageCIP23:10118,MessageType_ConfluxMessageSignature:10119,MessageType_TronGetAddress:10501,MessageType_TronAddress:10502,MessageType_TronSignTx:10503,MessageType_TronSignedTx:10504,MessageType_TronSignMessage:10505,MessageType_TronMessageSignature:10506,MessageType_NearGetAddress:10701,MessageType_NearAddress:10702,MessageType_NearSignTx:10703,MessageType_NearSignedTx:10704,MessageType_CosmosGetAddress:10800,MessageType_CosmosAddress:10801,MessageType_CosmosSignTx:10802,MessageType_CosmosSignedTx:10803,MessageType_AlgorandGetAddress:10900,MessageType_AlgorandAddress:10901,MessageType_AlgorandSignTx:10902,MessageType_AlgorandSignedTx:10903,MessageType_DeviceBackToBoot:903,MessageType_DeviceInfoSettings:10001,MessageType_GetDeviceInfo:10002,MessageType_DeviceInfo:10003,MessageType_ReadSEPublicKey:10004,MessageType_SEPublicKey:10005,MessageType_WriteSEPublicCert:10006,MessageType_ReadSEPublicCert:10007,MessageType_SEPublicCert:10008,MessageType_SpiFlashWrite:10009,MessageType_SpiFlashRead:10010,MessageType_SpiFlashData:10011,MessageType_SESignMessage:10012,MessageType_SEMessageSignature:10013,MessageType_NFTWriteInfo:10014,MessageType_NFTWriteData:10015,MessageType_ResourceUpload:10018,MessageType_ZoomRequest:10019,MessageType_ResourceRequest:10020,MessageType_ResourceAck:10021,MessageType_ResourceUpdate:10022}},google:{nested:{protobuf:{nested:{FileDescriptorSet:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},public_dependency:{rule:"repeated",type:"int32",id:10,options:{packed:!1}},weak_dependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},message_type:{rule:"repeated",type:"DescriptorProto",id:4},enum_type:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},source_code_info:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12}}},DescriptorProto:{fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nested_type:{rule:"repeated",type:"DescriptorProto",id:3},enum_type:{rule:"repeated",type:"EnumDescriptorProto",id:4},extension_range:{rule:"repeated",type:"ExtensionRange",id:5},oneof_decl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reserved_range:{rule:"repeated",type:"ReservedRange",id:9},reserved_name:{rule:"repeated",type:"string",id:10}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},FieldDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},type_name:{type:"string",id:6},extendee:{type:"string",id:2},default_value:{type:"string",id:7},oneof_index:{type:"int32",id:9},json_name:{type:"string",id:10},options:{type:"FieldOptions",id:8}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{fields:{name:{type:"string",id:1},input_type:{type:"string",id:2},output_type:{type:"string",id:3},options:{type:"MethodOptions",id:4},client_streaming:{type:"bool",id:5},server_streaming:{type:"bool",id:6}}},FileOptions:{fields:{java_package:{type:"string",id:1},java_outer_classname:{type:"string",id:8},java_multiple_files:{type:"bool",id:10},java_generate_equals_and_hash:{type:"bool",id:20,options:{deprecated:!0}},java_string_check_utf8:{type:"bool",id:27},optimize_for:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},go_package:{type:"string",id:11},cc_generic_services:{type:"bool",id:16},java_generic_services:{type:"bool",id:17},py_generic_services:{type:"bool",id:18},deprecated:{type:"bool",id:23},cc_enable_arenas:{type:"bool",id:31},objc_class_prefix:{type:"string",id:36},csharp_namespace:{type:"string",id:37},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{message_set_wire_format:{type:"bool",id:1},no_standard_descriptor_accessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},map_entry:{type:"bool",id:7},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8]]},FieldOptions:{fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allow_alias:{type:"bool",id:2},deprecated:{type:"bool",id:3},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},UninterpretedOption:{fields:{name:{rule:"repeated",type:"NamePart",id:2},identifier_value:{type:"string",id:3},positive_int_value:{type:"uint64",id:4},negative_int_value:{type:"int64",id:5},double_value:{type:"double",id:6},string_value:{type:"bytes",id:7},aggregate_value:{type:"string",id:8}},nested:{NamePart:{fields:{name_part:{rule:"required",type:"string",id:1},is_extension:{rule:"required",type:"bool",id:2}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leading_comments:{type:"string",id:3},trailing_comments:{type:"string",id:4},leading_detached_comments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},source_file:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}}}}}}}};const te=(e,t)=>((e,t="text")=>v(void 0,void 0,void 0,(function*(){const r=yield y.default.request({url:e,withCredentials:!1,responseType:"binary"===t?"arraybuffer":"json"});if(200==+r.status)return r.data;throw new Error(`httpRequest error: ${e} ${r.statusText}`)})))(e,t),re=()=>(new Date).getTime(),ie=new RegExp(/^[0-9]{1,3}(\.[0-9]{1,3}){0,2}$/),ne=e=>ie.test(e),se=e=>{if(!Array.isArray(e))return!1;if(0===e.length||e.length>3)return!1;if(0===e[0])return!1;for(let t=0;t<e.length;t++)if("number"!=typeof e[t]||e[t]<0)return!1;return!0},oe=e=>{if(3===e.length)return e;const t=[...e];for(let r=e.length;r<3;r++)t.push(0);return t},ae=e=>ne(e)?e.split(".").map((e=>Number(e))):[0,0,0];function de(e){return"Features"!==e.type||e.message.major_version<1&&(e.message.major_version=1),e}const ue="LOG_EVENT",le={OUTPUT:"log-output"},ce=(e,t)=>({event:ue,type:e,payload:t});let pe;class he{constructor(e,t){this.prefix=e,this.enabled=t,this.messages=[]}addMessage(e,t,...r){this.messages.push({level:e,prefix:t,message:r,timestamp:(new Date).getTime()}),this.messages.length>500&&this.messages.shift()}log(...e){this.addMessage("log",this.prefix,...e),_e(this.prefix,...e),this.enabled&&console.log(this.prefix,...e)}error(...e){this.addMessage("error",this.prefix,...e),_e(this.prefix,...e),this.enabled&&console.error(this.prefix,...e)}warn(...e){this.addMessage("warn",this.prefix,...e),_e(this.prefix,...e),this.enabled&&console.warn(this.prefix,...e)}debug(...e){this.addMessage("debug",this.prefix,...e),_e(this.prefix,...e),this.enabled&&console.log(this.prefix,...e)}}const fe={},ye=(e,t)=>{const r=new he(e,!!t);return fe[e]=r,r},ge=e=>{Object.keys(fe).forEach((t=>{fe[t].enabled=!!e}))},me=()=>{let e=[];return Object.keys(fe).forEach((t=>{e=e.concat(fe[t].messages)})),e.sort(((e,t)=>e.timestamp-t.timestamp)),e},ve=e=>{pe=e},be=()=>{const e=new WeakSet;return(t,r)=>{if("object"==typeof r&&null!==r){if(e.has(r))return;e.add(r)}return r}},_e=(e,...t)=>{null==pe||pe(ce(le.OUTPUT,((...e)=>e.map((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e?e:"object"==typeof e?JSON.stringify(e,be()):e)))(e,...t)))};var we;t.d0=void 0,(we=t.d0||(t.d0={})).Core="Core",we.Transport="Transport",we.Device="Device",we.DeviceCommands="DeviceCommands",we.DeviceConnector="DeviceConnector",we.DeviceList="DeviceList",we.DevicePool="DevicePool",we.HdCommonConnectSdk="@onekey/common-connect-sdk",we.HdBleSdk="@onekey/hd-ble-sdk",we.HdTransportHttp="@onekey/hd-transport-http",we.HdBleTransport="@onekey/hd-ble-transport",we.Connect="@onekey/connect",we.Iframe="IFrame",we.SendMessage="[SendMessage]",we.Method="[Method]";const Ee={[t.d0.Core]:ye(t.d0.Core),[t.d0.Transport]:ye(t.d0.Transport),[t.d0.Device]:ye(t.d0.Device),[t.d0.DeviceCommands]:ye(t.d0.DeviceCommands),[t.d0.DeviceConnector]:ye(t.d0.DeviceConnector),[t.d0.DeviceList]:ye(t.d0.DeviceList),[t.d0.DevicePool]:ye(t.d0.DevicePool),[t.d0.HdBleSdk]:ye(t.d0.HdBleSdk),[t.d0.HdTransportHttp]:ye(t.d0.HdTransportHttp),[t.d0.HdBleTransport]:ye(t.d0.HdBleTransport),[t.d0.Connect]:ye(t.d0.Connect),[t.d0.Iframe]:ye(t.d0.Iframe),[t.d0.SendMessage]:ye(t.d0.SendMessage),[t.d0.Method]:ye(t.d0.Method),[t.d0.HdCommonConnectSdk]:ye(t.d0.Method)},Te=e=>Ee[e],Se=e=>new Promise((t=>{setTimeout(t,e)})),Re=(e,t)=>{const r=e.filter((e=>f.default.gt(e.version.join("."),t)));return 0===r.length?"valid":r.some((e=>e.required))?"required":"outdated"},Oe=(e,t)=>e.filter((e=>f.default.gt(e.version.join("."),t))).map((e=>e.changelog)),Ie=e=>{let t=e[0];return e.forEach((e=>{f.default.gt(e.version.join("."),t.version.join("."))&&(t=e)})),t};var xe;class Ae{static load(e){return v(this,void 0,void 0,(function*(){this.settings=e;try{const{data:e}=yield y.default.get(`https://data.onekey.so/config.json?noCache=${re()}`);this.deviceMap={classic:e.classic,mini:e.mini,touch:e.touch,pro:e.pro},this.assets={bridge:e.bridge}}catch(e){}}))}static getProtobufMessages(){return this.messages.default}static getSettings(e){return this.settings?"string"==typeof e?this.settings[e]:this.settings:null}}xe=Ae,Ae.deviceMap={classic:{firmware:[],ble:[]},mini:{firmware:[],ble:[]},touch:{firmware:[],ble:[]},pro:{firmware:[],ble:[]}},Ae.assets=null,Ae.messages={default:ee},Ae.getFirmwareStatus=e=>{var t,r;const i=W(e),n=X(e);if(!1===e.firmware_present)return"none";if("classic"===i&&e.bootloader_mode)return"unknown";const s=null!==(r=null===(t=xe.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],o=n.join(".");return Re(s,o)},Ae.getSysResourcesLatestRelease=(e,t)=>{var r,i,n;const s=W(e),o=X(e);if("pro"!==s&&"touch"!==s)return;const a=null!==(i=null===(r=xe.deviceMap[s])||void 0===r?void 0:r.firmware)&&void 0!==i?i:[],d=o.join("."),u=a.filter((e=>(t||f.default.gt(e.version.join("."),d))&&!!e.resource));return null===(n=Ie(u))||void 0===n?void 0:n.resource},Ae.getFirmwareChangelog=e=>{var t,r;const i=W(e),n=X(e);if(!1===e.firmware_present||"classic"===i&&e.bootloader_mode)return[];const s=null!==(r=null===(t=xe.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],o=n.join(".");return Oe(s,o)},Ae.getFirmwareLatestRelease=e=>{var t,r;const i=W(e),n=null!==(r=null===(t=xe.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],s=Ie(n);if(!s)return s;if(!s.resource){const t=xe.getSysResourcesLatestRelease(e);return Object.assign(Object.assign({},s),{resource:t})}return s},Ae.getBLEFirmwareStatus=e=>{var t,r;const i=W(e),n=Z(e);if(!n)return"none";const s=null!==(r=null===(t=xe.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[],o=n.join(".");return Re(s,o)},Ae.getBleFirmwareChangelog=e=>{var t,r;const i=W(e),n=Z(e);if(!n)return[];const s=null!==(r=null===(t=xe.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[],o=n.join(".");return Oe(s,o)},Ae.getBleFirmwareLatestRelease=e=>{var t,r;const i=W(e),n=null!==(r=null===(t=xe.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[];return Ie(n)},Ae.getTransportStatus=e=>{var t,r;const i=null===(r=null===(t=xe.assets)||void 0===t?void 0:t.bridge)||void 0===r?void 0:r.version;if(!i)return"valid";return f.default.gte(e,i.join("."))?"valid":"outdated"};const Ce="CORE_EVENT",ke="UI_EVENT",Me={REQUEST_PIN:"ui-request_pin",INVALID_PIN:"ui-invalid_pin",REQUEST_BUTTON:"ui-button",REQUEST_PASSPHRASE:"ui-request_passphrase",REQUEST_PASSPHRASE_ON_DEVICE:"ui-request_passphrase_on_device",CLOSE_UI_WINDOW:"ui-close_window",BLUETOOTH_PERMISSION:"ui-bluetooth_permission",LOCATION_PERMISSION:"ui-location_permission",LOCATION_SERVICE_PERMISSION:"ui-location_service_permission",FIRMWARE_PROGRESS:"ui-firmware-progress",FIRMWARE_TIP:"ui-firmware-tip",NOT_IN_BOOTLOADER:"ui-device_not_in_bootloader_mode"},Ne=(e,t)=>({event:ke,type:e,payload:t}),Pe={INIT:"iframe-init",INIT_BRIDGE:"iframe-init-bridge",CALL:"iframe-call",CANCEL:"iframe-cancel"},De="RESPONSE_EVENT",Be=(e,t,r)=>({event:De,type:De,id:e,success:t,payload:t?r:n.serializeError(r)}),Le={RECEIVE_PIN:"ui-receive_pin",RECEIVE_PASSPHRASE:"ui-receive_passphrase"},qe="DEVICE_EVENT",je={CONNECT:"device-connect",CONNECT_UNACQUIRED:"device-connect_unacquired",DISCONNECT:"device-disconnect",CHANGED:"device-changed",ACQUIRE:"device-acquire",RELEASE:"device-release",ACQUIRED:"device-acquired",RELEASED:"device-released",USED_ELSEWHERE:"device-used_elsewhere",UNREADABLE:"unreadable-device",LOADING:"device-loading",BUTTON:"button",PIN:"pin",PASSPHRASE:"passphrase",PASSPHRASE_ON_DEVICE:"passphrase_on_device",WORD:"word",SUPPORT_FEATURES:"support_features",FEATURES:"features"},Fe=(e,t)=>({event:qe,type:e,payload:t}),Ue="FIRMWARE_EVENT",ze={RELEASE_INFO:"firmware-release-info",BLE_RELEASE_INFO:"ble-firmware-release-info"},He=(e,t)=>({event:Ue,type:e,payload:t}),$e=Te(t.d0.DevicePool);class Ge extends E.exports{static setConnector(e){this.connector=e}static getDevices(e,t,r){var i,n,s,o;return v(this,void 0,void 0,(function*(){$e.debug("get device list: connectId: ",t);const a={},d=[];if(t){const i=this.devicesCache[t];if(i){const n=e.find((e=>e.path===i.originalDescriptor.path));if(n)return $e.debug("find existed Device: ",t),i.updateDescriptor(n,!0),a[t]=i,d.push(i),yield this._checkDevicePool(r),{devices:a,deviceList:d};$e.debug("found device in cache, but path is different: ",t)}}try{for(i=_(e);!(n=yield i.next()).done;){const e=n.value,t=yield this._createDevice(e,r);if(t.features){const r=K(t.features);if(this.devicesCache[r]){this.devicesCache[r].updateDescriptor(e,!0)}this.devicesCache[r]=t,a[r]=t}d.push(t)}}catch(e){s={error:e}}finally{try{n&&!n.done&&(o=i.return)&&(yield o.call(i))}finally{if(s)throw s.error}}return console.log("device poll -> connected: ",this.connectedPool),console.log("device poll -> disconnected: ",this.disconnectPool),yield this._checkDevicePool(r),{devices:a,deviceList:d}}))}static clearDeviceCache(e){$e.debug("clear device pool cache: connectId",e),$e.debug("clear device pool cache: ",this.devicesCache),e&&delete this.devicesCache[e]}static _createDevice(e,t){return v(this,void 0,void 0,(function*(){let r=this.getDeviceByPath(e.path);return r||(r=ct.fromDescriptor(e),r.deviceConnector=this.connector,yield r.connect(),yield r.initialize(t),yield r.release()),r}))}static _checkDevicePool(e){return v(this,void 0,void 0,(function*(){yield this._sendConnectMessage(e),this._sendDisconnectMessage()}))}static _sendConnectMessage(e){return v(this,void 0,void 0,(function*(){for(let t=this.connectedPool.length-1;t>=0;t--){const r=this.connectedPool[t],i=yield this._createDevice(r,e);$e.debug("emit DEVICE.CONNECT: ",i),this.emitter.emit(je.CONNECT,i),this.connectedPool.splice(t,1)}}))}static _sendDisconnectMessage(){for(let e=this.disconnectPool.length-1;e>=0;e--){const t=this.connectedPool[e],r=(null==t?void 0:t.path)?this.getDeviceByPath(t.path):null;r&&this.emitter.emit(je.DISCONNECT,r),this.disconnectPool.splice(e,1)}}static reportDeviceChange(e){const t=((e,t)=>{const r=t.filter((t=>void 0===e.find((e=>e.path===t.path)))),i=e.filter((e=>void 0===t.find((t=>t.path===e.path)))),n=t.filter((t=>{const r=e.find((e=>e.path===t.path));return!!r&&r.session!==t.session})),s=n.filter((e=>"string"==typeof e.session)),o=n.filter((e=>"string"!=typeof e.session)),a=t.filter((t=>{const r=e.find((e=>e.path===t.path));return!!r&&r.debugSession!==t.debugSession})),d=n.filter((e=>"string"==typeof e.debugSession)),u=n.filter((e=>"string"!=typeof e.debugSession));return{connected:r,disconnected:i,changedSessions:n,acquired:s,released:o,changedDebugSessions:a,debugAcquired:d,debugReleased:u,didUpdate:r.length+i.length+n.length+a.length>0,descriptors:t}})(this.current||[],e);this.upcoming=e,this.current=this.upcoming,console.log("device pool -> current: ",this.current),console.log("device pool -> upcomming: ",this.upcoming),console.log("DeviceCache.reportDeviceChange diff: ",t),t.didUpdate&&(t.connected.forEach((e=>{const t=this.getDeviceByPath(e.path);t?($e.debug("emit DEVICE.CONNECT: ",t),this.emitter.emit(je.CONNECT,t)):this._addConnectedDeviceToPool(e)})),t.disconnected.forEach((e=>{this._removeDeviceFromConnectedPool(e.path);const t=this.getDeviceByPath(e.path);t?($e.debug("emit DEVICE.DISCONNECT: ",t),this.emitter.emit(je.DISCONNECT,t)):this._addDisconnectedDeviceToPool(e)})))}static getDeviceByPath(e){return Object.values(this.devicesCache).find((t=>t.originalDescriptor.path===e))}static _addConnectedDeviceToPool(e){const t=this.connectedPool.findIndex((t=>t.path===e.path));t>-1?this.connectedPool.splice(t,1,e):this.connectedPool.push(e)}static _removeDeviceFromConnectedPool(e){const t=this.connectedPool.findIndex((t=>t.path===e));t>-1&&this.connectedPool.splice(t,1)}static _addDisconnectedDeviceToPool(e){const t=this.disconnectPool.findIndex((t=>t.path===e.path));t>-1?this.disconnectPool.splice(t,1,e):this.disconnectPool.push(e)}}Ge.current=null,Ge.upcoming=[],Ge.connectedPool=[],Ge.disconnectPool=[],Ge.devicesCache={},Ge.emitter=new E.exports;const We=Te(t.d0.Transport),Ve=Te(t.d0.HdBleTransport),Ke=Te(t.d0.HdTransportHttp);class Ye{static load(){We.debug("transport manager load"),this.defaultMessages=Ae.getProtobufMessages(),this.currentMessages=this.defaultMessages}static configure(){return v(this,void 0,void 0,(function*(){try{const e=Ae.getSettings("env");We.debug("Initializing transports"),"react-native"===e?this.reactNativeInit?We.debug("React Native Do Not Initializing transports"):(yield this.transport.init(Ve,Ge.emitter),this.reactNativeInit=!0):yield this.transport.init(Ke),We.debug("Configuring transports"),yield this.transport.configure(JSON.stringify(this.defaultMessages)),We.debug("Configuring transports done")}catch(e){if(We.debug("Initializing transports error: ",e),"ECONNABORTED"===e.code)throw n.ERRORS.TypedError(n.HardwareErrorCode.BridgeTimeoutError)}}))}static reconfigure(e){return v(this,void 0,void 0,(function*(){if(Array.isArray(e)&&(e=Ae.getProtobufMessages()),this.currentMessages!==e&&e)try{yield this.transport.configure(JSON.stringify(e)),this.currentMessages=e}catch(e){throw n.ERRORS.TypedError(n.HardwareErrorCode.TransportInvalidProtobuf,`Transport_InvalidProtobuf: ${e.message}`)}}))}static setTransport(e){const t=Ae.getSettings("env");this.transport="react-native"===t?new e({scanTimeout:3e3}):new e,We.debug("set transport: ",this.transport)}static getTransport(){return this.transport}static getDefaultMessages(){return this.defaultMessages}static getCurrentMessages(){return this.currentMessages}}Ye.reactNativeInit=!1;const Xe=Te(t.d0.DeviceCommands);class Ze{constructor(e,t){this.device=e,this.mainId=t,this.transport=Ye.getTransport(),this.disposed=!1}dispose(e){var t,r;return v(this,void 0,void 0,(function*(){this.disposed=!0,e&&this._cancelableRequest&&this._cancelableRequest(),this._cancelableRequest=void 0,yield null===(r=(t=this.transport).cancel)||void 0===r?void 0:r.call(t)}))}call(e,t={}){var r,i;return v(this,void 0,void 0,(function*(){Xe.debug("[DeviceCommands] [call] Sending",e);try{const r=this.transport.call(this.mainId,e,t);this.callPromise=r;const i=yield r;return Xe.debug("[DeviceCommands] [call] Received",i.type),i}catch(e){if(Xe.debug("[DeviceCommands] [call] Received error",e),"device disconnected during action"===(null===(i=null===(r=null==e?void 0:e.response)||void 0===r?void 0:r.data)||void 0===i?void 0:i.error))return{type:"BridgeNetworkError",message:{}};throw e}}))}typedCall(e,t,r){return v(this,void 0,void 0,(function*(){if(this.disposed)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"typedCall: DeviceCommands already disposed");const i=yield this._commonCall(e,r);try{((e,t)=>{if(!(Array.isArray(t)?t:t.split("|")).includes(e.type))throw n.ERRORS.TypedError(n.HardwareErrorCode.ResponseUnexpectTypeError,`assertType: Response of unexpected type: ${e.type}. Should be ${t}`)})(i,t)}catch(e){if(Xe.debug("DeviceCommands typedcall error: ",e),!(e instanceof n.HardwareError))throw e;if(e.errorCode===n.HardwareErrorCode.ResponseUnexpectTypeError&&e.message.indexOf("BridgeNetworkError")>-1)throw n.ERRORS.TypedError(n.HardwareErrorCode.BridgeNetworkError)}return i}))}_commonCall(e,t){return v(this,void 0,void 0,(function*(){const r=yield this.call(e,t);return this._filterCommonTypes(r,e)}))}_filterCommonTypes(e,t){try{"react-native"===Ae.getSettings("env")?Xe.debug("_filterCommonTypes: ",JSON.stringify(e)):Xe.debug("_filterCommonTypes: ",e)}catch(e){}if("Failure"===e.type){const{code:r,message:i}=e.message;let s=null;return"Failure_FirmwareError"!==r||i||(s=n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareError)),"Failure_ActionCancelled"===r&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.ActionCancelled)),"Failure_PinInvalid"===r&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.PinInvalid,i)),"Failure_PinCancelled"===r&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.PinCancelled)),"Failure_DataError"===r&&"Please confirm the BlindSign enabled"===i&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.BlindSignDisabled)),"Failure_UnexpectedMessage"===r&&"PassphraseAck"===t&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.UnexpectPassphrase)),s?Promise.reject(s):Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`${r||"Failure_UnknownCode"},${i||"Failure_UnknownMessage"}`))}if("Features"===e.type)return Promise.resolve(de(e));if("ButtonRequest"===e.type)return"ButtonRequest_PassphraseEntry"===e.message.code?this.device.emit(je.PASSPHRASE_ON_DEVICE,this.device):this.device.emit(je.BUTTON,this.device,e.message),this._commonCall("ButtonAck",{});e.type;const r="webusb"===Ae.getSettings("env");return"PinMatrixRequest"===e.type?r?Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Please unlock your device")):this._promptPin(e.message.type).then((e=>"@@ONEKEY_INPUT_PIN_IN_DEVICE"===e?this._commonCall("BixinPinInputOnDevice"):this._commonCall("PinMatrixAck",{pin:e})),(()=>this._commonCall("Cancel",{}))):"PassphraseRequest"===e.type?this._promptPassphrase().then((e=>{const{passphrase:t,passphraseOnDevice:r}=e;return r?this._commonCall("PassphraseAck",{on_device:!0}):this._commonCall("PassphraseAck",{passphrase:t})})):(e.type,e.type,Promise.resolve(e))}_promptPin(e){return new Promise(((t,r)=>{this.device.listenerCount(je.PIN)>0?(this._cancelableRequest=r,this.device.emit(je.PIN,this.device,e,((e,i)=>{this._cancelableRequest=void 0,e?r(e):t(i)}))):(console.warn("[DeviceCommands] [call] PIN callback not configured, cancelling request"),r(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"_promptPin: PIN callback not configured")))}))}_promptPassphrase(){return new Promise(((e,t)=>{this.device.listenerCount(je.PASSPHRASE)>0?(this._cancelableRequest=t,this.device.emit(je.PASSPHRASE,this.device,((r,i)=>{this._cancelableRequest=void 0,i?t(i):e(r)}))):(Xe.error("[DeviceCommands] [call] Passphrase callback not configured, cancelling request"),t(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"_promptPassphrase: Passphrase callback not configured")))}))}}const Je="ui-device_bootloader_mode",Qe="ui-device_not_in_bootloader_mode",et="ui-device_not_initialized",tt="ui-device_seedless",rt="ui-firmware-tip",it=r(2391),nt=()=>it.version,st=`https://jssdk.onekey.so/${nt()}/`,ot={configSrc:"./data/config.json",version:"",debug:!1,priority:2,trustedHost:!1,connectSrc:st,iframeSrc:`${st}iframe.html`,parentOrigin:"undefined"!=typeof window&&window.location?window.location.origin:"",supportedBrowser:"undefined"==typeof navigator||!/Trident|MSIE|Edge/.test(navigator.userAgent),env:"web",lazyLoad:!1,timestamp:(new Date).getTime()},at=()=>{if("undefined"!=typeof chrome&&chrome.runtime&&void 0!==chrome.runtime.onConnect)return"webextension";if("undefined"!=typeof navigator){if("string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase())return"react-native";if(navigator.userAgent.toLowerCase().indexOf(" electron/")>-1)return"electron"}return"web"},dt=e=>{if("string"==typeof e)return e.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*onekey\.so\//)||e.match(/^https?:\/\/localhost:[58][0-9]{3}\//),e},ut=Te(t.d0.Device),lt={};class ct extends E.exports{constructor(e){super(),this.deviceConnector=null,this.features=void 0,this.featuresNeedsReload=!1,this.externalState=[],this.unavailableCapabilities={},this.instance=0,this.internalState=[],this.needReloadDevice=!1,this.keepSession=!1,this.passphraseState=void 0,this.originalDescriptor=e}static fromDescriptor(e){const t=Object.assign({},e);return new ct(t)}toMessageObject(){if(this.isUnacquired()||!this.features)return null;return{connectId:"react-native"===Ae.getSettings("env")?this.mainId||null:K(this.features),uuid:K(this.features),deviceType:this.features.bootloader_mode?(e=this.features,W(e)):W(this.features),deviceId:this.features.device_id||null,path:this.originalDescriptor.path,name:this.features.ble_name||this.features.label||`OneKey ${W(this.features).toUpperCase()}`,label:Y(this.features),mode:this.getMode(),features:this.features,firmwareVersion:this.getFirmwareVersion(),bleFirmwareVersion:this.getBLEFirmwareVersion(),unavailableCapabilities:this.unavailableCapabilities};var e}connect(){const e=Ae.getSettings("env");return new Promise((t=>v(this,void 0,void 0,(function*(){if("react-native"!==e)if(!this.mainId||!this.isUsedHere()&&this.originalDescriptor)try{yield this.acquire(),t(!0)}catch(e){t(e)}else this.isUsedHere()?t(!0):t(!1);else try{yield this.acquire(),t(!0)}catch(e){t(e)}}))))}acquire(){var e,t,r,i;return v(this,void 0,void 0,(function*(){const n=Ae.getSettings("env"),s="react-native"===n?"id":"session";try{if("react-native"===n){const r=yield null===(e=this.deviceConnector)||void 0===e?void 0:e.acquire(this.originalDescriptor.id);this.mainId=null!==(t=r.uuid)&&void 0!==t?t:"",ut.debug("Expected uuid:",this.mainId)}else this.mainId=yield null===(r=this.deviceConnector)||void 0===r?void 0:r.acquire(this.originalDescriptor.path,this.originalDescriptor.session),ut.debug("Expected session id:",this.mainId);this.updateDescriptor({[s]:this.mainId}),this.commands&&(yield this.commands.dispose(!1)),this.commands=new Ze(this,null!==(i=this.mainId)&&void 0!==i?i:"")}catch(e){if(!this.runPromise)throw e;this.runPromise.reject(e),this.runPromise=null}}))}release(){var e;return v(this,void 0,void 0,(function*(){const t=Ae.getSettings("env");if(this.isUsedHere()&&!this.keepSession&&this.mainId||this.mainId&&"react-native"===t){if(this.commands&&(this.commands.dispose(!1),this.commands.callPromise))try{yield this.commands.callPromise}catch(e){this.commands.callPromise=void 0}try{yield null===(e=this.deviceConnector)||void 0===e?void 0:e.release(this.mainId,!1),this.updateDescriptor({session:null})}catch(e){ut.error("[Device] release error: ",e)}finally{this.needReloadDevice=!0}}}))}getCommands(){return this.commands}generateStateKey(e,t){return t?`${e}@${t}`:e}getInternalState(e){var t,r;ut.debug("getInternalState session param: ",`device_id: ${e}`,`features.device_id: ${null===(t=this.features)||void 0===t?void 0:t.device_id}`,`passphraseState: ${this.passphraseState}`),ut.debug("getInternalState session cache: ",lt);const i=e||(null===(r=this.features)||void 0===r?void 0:r.device_id);if(!i)return;if(!this.passphraseState)return;const n=this.generateStateKey(i,this.passphraseState);return lt[n]}tryFixInternalState(e,t){ut.debug("tryFixInternalState session param: ",`device_id: ${t}`,`passphraseState: ${e}`);const r=`${t}`,i=lt[r];i&&(lt[this.generateStateKey(t,e)]=i,delete lt[r]),ut.debug("tryFixInternalState session cache: ",lt)}setInternalState(e,t){var r,i;if(ut.debug("setInternalState session param: ",`state: ${e}`,`initSession: ${t}`,`device_id: ${null===(r=this.features)||void 0===r?void 0:r.device_id}`,`passphraseState: ${this.passphraseState}`),!this.features)return;if(!this.passphraseState&&!t)return;const n=null===(i=this.features)||void 0===i?void 0:i.device_id;if(!n)return;const s=this.generateStateKey(n,this.passphraseState);e&&(lt[s]=e),ut.debug("setInternalState done session cache: ",lt)}clearInternalState(e){var t;ut.debug("clearInternalState param: ",e);const r=e||(null===(t=this.features)||void 0===t?void 0:t.device_id);if(!r)return;if(delete lt[`${r}`],this.passphraseState){const e=this.generateStateKey(r,this.passphraseState);delete lt[e]}}initialize(e){return v(this,void 0,void 0,(function*(){ut.debug("initialize param:",e),this.passphraseState=null==e?void 0:e.passphraseState,(null==e?void 0:e.initSession)&&this.clearInternalState(null==e?void 0:e.deviceId);const t=this.getInternalState(null==e?void 0:e.deviceId),r={};t&&(r.session_id=t),ut.debug("initialize payload:",r);const{message:i}=yield this.commands.typedCall("Initialize","Features",r);this._updateFeatures(i,null==e?void 0:e.initSession)}))}getFeatures(){return v(this,void 0,void 0,(function*(){const{message:e}=yield this.commands.typedCall("GetFeatures","Features",{});this._updateFeatures(e)}))}_updateFeatures(e,t){this.features&&this.features.session_id&&!e.session_id&&(e.session_id=this.features.session_id),this.features&&this.features.device_id&&e.session_id&&this.setInternalState(e.session_id,t),e.unlocked=e.unlocked||!0,this.features=e,this.featuresNeedsReload=!1,this.emit(je.FEATURES,this,e)}updateDescriptor(e,t=!1){if("react-native"===Ae.getSettings("env"))return;const r=this.originalDescriptor.session,i=e.session;r!==i&&(this.originalDescriptor.session=i),t&&(this.originalDescriptor=e)}updateFromCache(e){this.mainId=e.mainId,this.commands=e.commands,this.updateDescriptor(e.originalDescriptor,!0),e.features&&this._updateFeatures(e.features)}run(e,t){return v(this,void 0,void 0,(function*(){return this.runPromise&&(yield this.interruptionFromOutside(),ut.debug("[Device] run error:","Device is running, but will cancel previous operate")),t=(e=>(e||(e={}),e))(t),this.runPromise=n.createDeferred(this._runInner.bind(this,e,t)),this.runPromise.promise}))}_runInner(e,t){return v(this,void 0,void 0,(function*(){if(!this.isUsedHere()||this.commands.disposed){if("react-native"!==Ae.getSettings("env")){yield this.acquire();try{e&&(yield this.initialize(t))}catch(e){return this.runPromise=null,e instanceof n.HardwareError?Promise.reject(e):Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceInitializeFailed,`Initialize failed: ${e.message}, code: ${e.code}`))}}}if(t.keepSession&&(this.keepSession=!0),e)try{yield e()}catch(e){return this.runPromise&&this.runPromise.reject(e),void(this.runPromise=null)}(!this.keepSession&&"boolean"!=typeof t.keepSession||!1===t.keepSession)&&(this.keepSession=!1,yield this.release(),ut.debug("release device, mainId: ",this.mainId)),this.runPromise&&this.runPromise.resolve(),this.runPromise=null}))}interruptionFromOutside(){return v(this,void 0,void 0,(function*(){this.commands&&(yield this.commands.dispose(!1)),this.runPromise&&this.runPromise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceInterruptedFromOutside))}))}interruptionFromUser(){return v(this,void 0,void 0,(function*(){this.commands&&(yield this.commands.dispose(!0)),this.runPromise&&this.runPromise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceInterruptedFromUser))}))}getMode(){var e,t,r;return(null===(e=this.features)||void 0===e?void 0:e.bootloader_mode)?"bootloader":(null===(t=this.features)||void 0===t?void 0:t.initialized)?(null===(r=this.features)||void 0===r?void 0:r.no_backup)?"seedless":"normal":"initialize"}getFirmwareVersion(){return this.features?X(this.features):null}getBLEFirmwareVersion(){return this.features?Z(this.features):null}isUsed(){return"string"==typeof this.originalDescriptor.session}isUsedHere(){return"react-native"!==Ae.getSettings("env")&&(this.isUsed()&&this.originalDescriptor.session===this.mainId)}isUsedElsewhere(){return this.isUsed()&&!this.isUsedHere()}isBootloader(){return this.features&&!!this.features.bootloader_mode}isInitialized(){return this.features&&!!this.features.initialized}isSeedless(){return this.features&&!!this.features.no_backup}isUnacquired(){return void 0===this.features}hasUnexpectedMode(e,t){if(this.features){if(this.isBootloader()&&!e.includes(Je))return Je;if(!this.isInitialized()&&!e.includes(et))return et;if(this.isSeedless()&&!e.includes(tt))return tt;if(!this.isBootloader()&&t.includes(Je))return Qe}return null}hasUsePassphrase(){var e;const t=("touch"===W(this.features)||"pro"===W(this.features))&&!0===(null===(e=this.features)||void 0===e?void 0:e.unlocked);return this.features&&(!!this.features.passphrase_protection||t)}checkDeviceId(e){return!!this.features&&this.features.device_id===e}checkPassphraseState(){var e;return v(this,void 0,void 0,(function*(){if(!this.features)return!1;const t=!0===(null===(e=this.features)||void 0===e?void 0:e.unlocked),r="touch"===W(this.features)||"pro"===W(this.features),i=yield Q(this.features,this.commands);return r&&t&&(yield this.getFeatures()),this.passphraseState&&this.passphraseState!==i?(this.clearInternalState(),i):void 0}))}}class pt extends E.exports{constructor(){super(...arguments),this.devices={}}getDeviceLists(e,t){var r,i;return v(this,void 0,void 0,(function*(){const n=yield null===(r=this.connector)||void 0===r?void 0:r.enumerate(),s=null!==(i=null==n?void 0:n.descriptors)&&void 0!==i?i:[];this.devices={};const{deviceList:o,devices:a}=yield Ge.getDevices(s,e,t);return this.devices=a,o}))}allDevices(){return Object.keys(this.devices).map((e=>this.devices[e]))}getDevice(e){return this.devices[e]}}const ht=e=>({status:Ae.getFirmwareStatus(e),changelog:Ae.getFirmwareChangelog(e),release:Ae.getFirmwareLatestRelease(e)}),ft=e=>({status:Ae.getBLEFirmwareStatus(e),changelog:Ae.getBleFirmwareChangelog(e),release:Ae.getBleFirmwareLatestRelease(e)}),yt=Te(t.d0.Method);class gt{constructor(e){this.shouldEnsureConnected=!0,this.checkDeviceId=!1,this.useDevicePassphraseState=!0;const{payload:t}=e;this.name=t.method,this.payload=t,this.responseID=e.id||0,this.connectId=t.connectId||"",this.deviceId=t.deviceId||"",this.useDevice=!0,this.allowDeviceMode=[et],this.requireDeviceMode=[]}getVersionRange(){return{}}setDevice(e){this.device=e,this.connectId=e.originalDescriptor.path}checkFirmwareRelease(){if(!this.device||!this.device.features)return;const e=ht(this.device.features);this.postMessage(He(ze.RELEASE_INFO,Object.assign(Object.assign({},e),{features:this.device.features})));const t=ft(this.device.features);this.postMessage(He(ze.BLE_RELEASE_INFO,Object.assign(Object.assign({},t),{features:this.device.features})))}checkDeviceSupportFeature(){if(!this.device||!this.device.features)return;const e=J(this.device.features);this.postMessage(Fe(je.SUPPORT_FEATURES,{inputPinOnSoftware:e,device:this.device.toMessageObject()}))}checkSafetyLevelOnTestNet(){var e,t,r;return v(this,void 0,void 0,(function*(){if("touch"!==W(this.device.features))return;let i=!1;"evmSignTransaction"===this.name&&[3,4,5,42].includes(Number(null===(t=null===(e=this.payload)||void 0===e?void 0:e.transaction)||void 0===t?void 0:t.chainId))&&(i=!0),i&&"Strict"===(null===(r=this.device.features)||void 0===r?void 0:r.safety_checks)&&(yt.debug("will change safety_checks level"),yield this.device.commands.typedCall("ApplySettings","Success",{safety_checks:"PromptTemporarily"}))}))}dispose(){}}const mt=e=>"0x"===e.slice(0,2).toLowerCase(),vt=e=>mt(e)?e.slice(2):e,bt=e=>{for(;/^00/.test(e);)e=e.slice(2);return e},_t=e=>{if("string"==typeof e){let t=vt(e);return t.length%2!=0&&(t=`0${t}`),t}return Array.isArray(e)?e.map(_t):"object"==typeof e?(t=e,r=e=>_t(e),Object.fromEntries(Object.entries(t).map((([e,t])=>[e,r(t,e)])))):e;var t,r},wt=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Et(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=wt[e[r]];return t}function Tt(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const i=2*r,n=e.slice(i,i+2),s=Number.parseInt(n,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t}const St=e=>n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,e),Rt=(e,t)=>{t.forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t.name)&&t.required)throw St(`Missing required parameter: ${t.name}`);const r=e[t.name];if(r&&t.type)switch(t.type){case"array":if(!Array.isArray(r))throw St(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`);if(!t.allowEmpty&&r.length<1)throw St(`Parameter "${t.name}" is empty.`);break;case"bigNumber":if("string"!=typeof r)throw St(`Parameter [${t.name}] is of type invalid and should be [string].`);try{if(new g.default(r).toFixed(0)!==r)throw new Error("")}catch(e){throw St(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`)}break;case"buffer":if(void 0===r||"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r))throw St(`Parameter [${t.name}] is of type invalid and should be [buffer].`);break;case"hexString":if("string"!=typeof r||!((e,t)=>!("string"!=typeof e||!e.match(/^(0x|0X)?[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t))((i=r,mt(i)?i:`0x${i}`)))throw St(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`);break;default:if(typeof r!==t.type)throw St(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`)}var i}))};const Ot=({features:e,updateType:t,version:r})=>v(void 0,void 0,void 0,(function*(){const i=It({features:e,updateType:t});if(!i)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"no firmware found for this device");if(r&&!f.default.eq(i.version.join("."),r.join(".")))throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"firmware version mismatch");const s="ble"===t?i.webUpdate:i.url;let o;try{o=yield te(s,"binary")}catch(e){throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Method_FirmwareUpdate_DownloadFailed")}return Object.assign(Object.assign({},i),{binary:o})})),It=({features:e,updateType:t})=>{var r,i;const n=W(e),{deviceMap:s}=Ae,o=null!==(i=null===(r=null==s?void 0:s[n])||void 0===r?void 0:r[t])&&void 0!==i?i:[];return Ie(o)};Te(t.d0.Device);const xt=e=>{var t;(null===(t=e.features)||void 0===t?void 0:t.firmware_present)&&e.emit(je.BUTTON,e,{code:"ButtonRequest_FirmwareUpdate"})},At=(e,t,r)=>{r(Ne(Me.FIRMWARE_PROGRESS,{device:e.toMessageObject(),progress:t}))},Ct=(e,t,r)=>{r(Ne(Me.FIRMWARE_TIP,{device:e.toMessageObject(),data:{message:t}}))},kt=e=>v(void 0,void 0,void 0,(function*(){"ble"===e&&(yield Se(1e4))})),Mt=(e,t,r,i,{payload:s})=>v(void 0,void 0,void 0,(function*(){var o,a;if(1===(null===(o=i.features)||void 0===o?void 0:o.major_version)){xt(i),Ct(i,"ConfirmOnDevice",r);const n="firmware"===e?"FirmwareErase":"FirmwareErase_ex";yield t(n,"Success",{}),Ct(i,"FirmwareEraseSuccess",r),At(i,0,r);const{message:o}=yield t("FirmwareUpload","Success",{payload:s});return At(i,100,r),yield kt(e),o}if(2===(null===(a=i.features)||void 0===a?void 0:a.major_version)){xt(i),Ct(i,"ConfirmOnDevice",r);const n=s.byteLength;let o=yield t("FirmwareErase",["FirmwareRequest","Success"],{length:n});for(Ct(i,"FirmwareEraseSuccess",r);"Success"!==o.type;){const e=o.message.offset,a=o.message.offset+o.message.length,d=s.slice(e,a);e>0&&At(i,Math.round(e/n*100),r),o=yield t("FirmwareUpload",["FirmwareRequest","Success"],{payload:d})}return At(i,100,r),yield kt(e),o.message}throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"uploadFirmware: unknown major_version")})),Nt=(e,t,r)=>v(void 0,void 0,void 0,(function*(){if("Success"===t.type)return t.message;const{offset:i,data_length:n}=t.message;if(void 0===i)throw new Error("offset is undefined");const s=new Uint8Array(r.slice(i,Math.min(i+n,r.byteLength))),o=d.blake2s(s),a={data_chunk:Et(s),hash:Et(o)},u=yield e("ResourceAck",["ResourceRequest","Success"],Object.assign({},a));return Nt(e,u,r)})),Pt=(e,t,r)=>v(void 0,void 0,void 0,(function*(){const i=new Uint8Array(r.slice(0,Math.min(16384,r.byteLength))),n=d.blake2s(i),s=yield e("ResourceUpdate",["ResourceRequest","Success"],{file_name:t,data_length:r.byteLength,initial_data_chunk:Et(i),hash:Et(n)});return Nt(e,s,r)}));const Dt=Te(t.d0.Method);const Bt=Te(t.d0.Method);var Lt=[{name:"Bitcoin",label:"BTC",slip44:0},{name:"Regtest",label:"REGTEST",slip44:1},{name:"Testnet",label:"TEST",slip44:1},{name:"Actinium",label:"ACM",slip44:228},{name:"Axe",label:"AXE",slip44:4242},{name:"Bcash",label:"BCH",slip44:145},{name:"Bitcore",label:"BTX",slip44:160},{name:"Dash",label:"DASH",slip44:5},{name:"Dash Testnet",label:"tDASH",slip44:1},{name:"Decred",label:"DCR",slip44:42},{name:"Decred Testnet",label:"TDCR",slip44:1},{name:"DigiByte",label:"DGB",slip44:20},{name:"Dogecoin",label:"DOGE",slip44:3},{name:"Feathercoin",label:"FTC",slip44:8},{name:"Firo",label:"FIRO",slip44:136},{name:"Firo Testnet",label:"tFIRO",slip44:1},{name:"Fujicoin",label:"FJC",slip44:75},{name:"GameCredits",label:"GAME",slip44:101},{name:"Komodo",label:"KMD",slip44:141},{name:"Koto",label:"KOTO",slip44:510},{name:"Litecoin",label:"LTC",slip44:2},{name:"Litecoin Testnet",label:"tLTC",slip44:1},{name:"Monacoin",label:"MONA",slip44:22},{name:"MonetaryUnit",label:"MUE",slip44:31},{name:"NIX",label:"NIX",slip44:400},{name:"Namecoin",label:"NMC",slip44:7},{name:"Peercoin",label:"PPC",slip44:6},{name:"Peercoin Testnet",label:"tPPC",slip44:1},{name:"Polis",label:"POLIS",slip44:1997},{name:"Primecoin",label:"XPM",slip44:24},{name:"Ravencoin",label:"RVN",slip44:175},{name:"Ritocoin",label:"RITO",slip44:19169},{name:"Stakenet",label:"XSN",slip44:199},{name:"Syscoin",label:"SYS",slip44:57},{name:"Unobtanium",label:"UNO",slip44:92},{name:"Verge",label:"XVG",slip44:77},{name:"Vertcoin",label:"VTC",slip44:28},{name:"Viacoin",label:"VIA",slip44:14},{name:"ZCore",label:"ZCR",slip44:428},{name:"Zcash",label:"ZEC",slip44:133},{name:"Zcash Testnet",label:"TAZ",slip44:1}];const qt=(e,t)=>{let r;if(t){const e=t.toLowerCase();r=Lt.find((t=>t.name.toLowerCase()===e||t.label.toLowerCase()===e))}else if(e){const t=j(e[1]);r=Lt.find((e=>e.slip44===t))}if(!r)throw t?n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,`Invalid coin name: ${t}`):e?n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,`Invalid path: ${e[0]}`):n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter);return r},jt=(e,t,r)=>{const i=qt(e,t).name;let n=r;void 0===n&&(n=(e=>Array.isArray(e)&&e[0]===q(48))(e));let s=H(e);return"SPENDMULTISIG"!==s||n||(s="SPENDADDRESS"),{coinName:i,scriptType:null!=s?s:"SPENDADDRESS"}};const Ft=e=>{const{tx_hash:t}=e.txRequest.details;return t?(({typedCall:e,txRequest:{request_type:t,details:r},refTxs:i})=>{const{tx_hash:s}=r;if(!s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: unknown details.tx_hash");const o=i[s.toLowerCase()];if(!o)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown tx: ${s}`);if("TXINPUT"===t){if(!o.bin_outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXINPUT: ${s}`);return e("TxAckPrevInput","TxRequest",{tx:{input:o.inputs[r.request_index]}})}if("TXOUTPUT"===t){if(!o.bin_outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXOUTPUT: ${s}`);return e("TxAckPrevOutput","TxRequest",{tx:{output:o.bin_outputs[r.request_index]}})}if("TXORIGINPUT"===t){if(!o.outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXORIGINPUT: ${s}`);return e("TxAckInput","TxRequest",{tx:{input:o.inputs[r.request_index]}})}if("TXORIGOUTPUT"===t){if(!o.outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXORIGOUTPUT: ${s}`);return e("TxAckOutput","TxRequest",{tx:{output:o.outputs[r.request_index]}})}if("TXEXTRADATA"===t){if("number"!=typeof r.extra_data_len)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_len");if("number"!=typeof r.extra_data_offset)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_offset");if("string"!=typeof o.extra_data)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: No extra data for transaction ${o.hash}`);const t=o.extra_data,i=r.extra_data_len,s=r.extra_data_offset;return e("TxAckPrevExtraData","TxRequest",{tx:{extra_data_chunk:t.substring(2*s,2*(s+i))}})}if("TXMETA"===t){const t=o.extra_data;return e("TxAckPrevMeta","TxRequest",{tx:{version:o.version,lock_time:o.lock_time,inputs_count:o.inputs.length,outputs_count:o.outputs?o.outputs.length:o.bin_outputs.length,timestamp:o.timestamp,version_group_id:o.version_group_id,expiry:o.expiry,branch_id:o.branch_id,extra_data_len:t?t.length/2:void 0}})}throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Unknown request type: ${t}`)})(e):(({typedCall:e,txRequest:{request_type:t,details:r},inputs:i,outputs:s})=>{if("TXINPUT"===t)return e("TxAckInput","TxRequest",{tx:{input:i[r.request_index]}});if("TXOUTPUT"===t)return e("TxAckOutput","TxRequest",{tx:{output:s[r.request_index]}});if("TXMETA"===t)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXMETA from signed transaction");if("TXEXTRADATA"===t)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction");throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestSignedTxInfo: Unknown request type: ${t}`)})(e)},Ut=e=>v(void 0,void 0,void 0,(function*(){const{typedCall:t,txRequest:r,refTxs:i,inputs:s,outputs:o,serializedTx:a,signatures:d}=e;if(((e,t,r)=>{if(!r)return;const{signature_index:i,signature:s,serialized_tx:o}=r;if(o&&e.push(o),"number"==typeof i){if(!s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.");t[i]=s}})(a,d,r.serialized),"TXFINISHED"===r.request_type)return Promise.resolve({signatures:d,serializedTx:a.join("")});const{message:u}=yield Ft(e);return Ut({typedCall:t,txRequest:u,refTxs:i,inputs:s,outputs:o,serializedTx:a,signatures:d})}));var zt=(e,t,r,i,n,s)=>v(void 0,void 0,void 0,(function*(){const o={};i.forEach((e=>{o[e.hash.toLowerCase()]=e}));const{message:a}=yield e("SignTx","TxRequest",Object.assign(Object.assign({},n),{inputs_count:t.length,outputs_count:r.length,coin_name:s}));return Ut({typedCall:e,txRequest:a,refTxs:o,inputs:t,outputs:r,serializedTx:[],signatures:[]})}));const Ht=e=>{const{tx_hash:t}=e.txRequest.details;return t?(({txRequest:{request_type:e,details:t},refTxs:r})=>{const{tx_hash:i}=t;if(!i)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: unknown details.tx_hash");const s=r[i.toLowerCase()];if(!s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown tx: ${i}`);if(!s.bin_outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: bin_outputs not set tx: ${i}`);if("TXINPUT"===e)return{inputs:[s.inputs[t.request_index]]};if("TXOUTPUT"===e)return{bin_outputs:[s.bin_outputs[t.request_index]]};if("TXEXTRADATA"===e){if("number"!=typeof t.extra_data_len)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_len");if("number"!=typeof t.extra_data_offset)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_offset");if("string"!=typeof s.extra_data)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: No extra data for transaction ${s.hash}`);const e=s.extra_data,r=t.extra_data_len,i=t.extra_data_offset;return{extra_data:e.substring(2*i,2*(i+r))}}if("TXMETA"===e){const e=s.extra_data,t={version:s.version,lock_time:s.lock_time,inputs_cnt:s.inputs.length,outputs_cnt:s.bin_outputs.length,timestamp:s.timestamp,version_group_id:s.version_group_id,expiry:s.expiry,branch_id:s.branch_id};return"string"==typeof e&&0!==e.length?Object.assign(Object.assign({},t),{extra_data_len:e.length/2}):t}throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Unknown request type: ${e}`)})(e):(({txRequest:{request_type:e,details:t},inputs:r,outputs:i})=>{if("TXINPUT"===e)return{inputs:[r[t.request_index]]};if("TXOUTPUT"===e)return{outputs:[i[t.request_index]]};if("TXMETA"===e)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXMETA from signed transaction");if("TXEXTRADATA"===e)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction");throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestSignedTxInfo: Unknown request type: ${e}`)})(e)},$t=e=>v(void 0,void 0,void 0,(function*(){const{typedCall:t,txRequest:r,refTxs:i,inputs:s,outputs:o,serializedTx:a,signatures:d}=e;if(((e,t,r)=>{if(!r)return;const{signature_index:i,signature:s,serialized_tx:o}=r;if(o&&e.push(o),"number"==typeof i){if(!s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.");t[i]=s}})(a,d,r.serialized),"TXFINISHED"===r.request_type)return Promise.resolve({signatures:d,serializedTx:a.join("")});const u=Ht(e),{message:l}=yield t("TxAck","TxRequest",{tx:u});return $t({typedCall:t,txRequest:l,refTxs:i,inputs:s,outputs:o,serializedTx:a,signatures:d})}));var Gt=(e,t,r,i,n,s)=>v(void 0,void 0,void 0,(function*(){const o={};i.forEach((e=>{o[e.hash.toLowerCase()]=e}));const{message:a}=yield e("SignTx","TxRequest",Object.assign(Object.assign({},n),{inputs_count:t.length,outputs_count:r.length,coin_name:s}));return $t({typedCall:e,txRequest:a,refTxs:o,inputs:t,outputs:r,serializedTx:[],signatures:[]})}));const Wt=(e,t)=>{if(!e)return["",""];return[e.slice(0,t),e.slice(t)]};const Vt=(e,t,r)=>{let i=new g.default(e);if(r&&(i=((e,t)=>{if(t<1||t>32)throw n.ERRORS.TypedError("Runtime","Int byte size must be between 1 and 32 (8 and 256 bits)");const r=new g.default(2).exponentiatedBy(8*t-1).negated(),i=r.negated().minus(1),s=new g.default(e);if(s.isGreaterThan(i)||s.isLessThan(r))throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`Overflow when trying to convert number ${e.toString()} into ${t} bytes`);return s.isPositive()?s:s.minus(r).minus(r)})(i,t)),i.isNegative())throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`Cannot convert negative number to unsigned interger: ${e.toString()}`);const s=i.toString(16),o=2*t;if(s.length>o)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`Overflow when trying to convert number ${e.toString()} into ${t} bytes`);return s.padStart(2*t,"0")},Kt=new RegExp(/^(.*)\[([0-9]*)\]$/),Yt=new RegExp(/^bytes([0-9]*)$/),Xt=new RegExp(/^(u?int)([0-9]*)$/),Zt=e=>{const t=Kt.exec(e);if(null===t)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`typename ${e} could not be parsed as an EIP-712 array`);const[r,i,s]=t;return{entryTypeName:i,arraySize:parseInt(s,10)||null}},Jt=(e,t)=>{if(Yt.test(e)||"address"===e)return _t(t);if("string"===e)return Buffer.from(t,"utf-8").toString("hex");const r=Xt.exec(e);if(r){const[e,i,n]=r,s=Math.ceil(parseInt(n,10)/8);return Vt(t,s,"int"===i)}if("bool"===e)return t?"01":"00";throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`Unsupported data type for direct field encoding: ${e}`)},Qt={string:c.EthereumDataType.STRING,bool:c.EthereumDataType.BOOL,address:c.EthereumDataType.ADDRESS},er=(e,t)=>{const r=Kt.exec(e);if(r){const[e,i,n]=r,s=er(i,t);return{data_type:c.EthereumDataType.ARRAY,size:parseInt(n,10)||void 0,entry_type:s}}const i=Xt.exec(e);if(i){const[e,t,r]=i;return{data_type:"uint"===t?c.EthereumDataType.UINT:c.EthereumDataType.INT,size:Math.floor(parseInt(r,10)/8)}}const s=Yt.exec(e);if(s){const[e,t]=s;return{data_type:c.EthereumDataType.BYTES,size:parseInt(t,10)||void 0}}const o=Qt[e];if(o)return{data_type:o};if(e in t)return{data_type:c.EthereumDataType.STRUCT,size:t[e].length,struct_name:e};throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`No type definition specified: ${e}`)};var tr=Object.freeze({__proto__:null,searchDevices:class extends gt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){var e,t;return v(this,void 0,void 0,(function*(){yield Ye.configure();const r=yield null===(e=this.connector)||void 0===e?void 0:e.enumerate(),i=null!==(t=null==r?void 0:r.descriptors)&&void 0!==t?t:[];if("react-native"===Ae.getSettings("env"))return i.map((e=>{var t;return Object.assign(Object.assign({},e),{connectId:e.id,deviceType:V(null!==(t=e.name)&&void 0!==t?t:"")})}));const{deviceList:n}=yield Ge.getDevices(i);return n.map((e=>e.toMessageObject()))}))}},getFeatures:class extends gt{init(){this.allowDeviceMode=[...this.allowDeviceMode,et,Je],this.useDevicePassphraseState=!1}run(){return Promise.resolve(this.device.features)}},getPassphraseState:class extends gt{init(){this.allowDeviceMode=[...this.allowDeviceMode,et],this.useDevicePassphraseState=!1}run(){var e,t;return v(this,void 0,void 0,(function*(){if(!this.device.features)return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceInitializeFailed));let{features:r}=this.device;const i=!0===(null===(t=null===(e=this.device)||void 0===e?void 0:e.features)||void 0===t?void 0:t.unlocked),s=yield Q(this.device.features,this.device.commands);if(("touch"===W(r)||"pro"===W(r))&&i){const{message:e}=yield this.device.commands.typedCall("GetFeatures","Features",{});r=e}return r&&!0===r.passphrase_protection?(s&&r.device_id&&this.device.tryFixInternalState(s,r.device_id),Promise.resolve(s)):Promise.resolve(void 0)}))}},getLogs:class extends gt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=me();return Promise.resolve(e)}))}},checkFirmwareRelease:class extends gt{init(){this.useDevicePassphraseState=!1}run(){if(this.device.features){const e=ht(this.device.features);return Promise.resolve(e)}return Promise.resolve(null)}},checkBLEFirmwareRelease:class extends gt{init(){this.allowDeviceMode=[...this.allowDeviceMode,Je],this.checkDeviceId=!0,this.useDevicePassphraseState=!1}run(){if(this.device.features){const e=ft(this.device.features);return Promise.resolve(e)}return Promise.resolve(null)}},checkTransportRelease:class extends gt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=Ye.getTransport(),t=yield e.init(),r=Ae.getTransportStatus(t);return Promise.resolve(r)}))}},checkBridgeStatus:class extends gt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{y.default.request({url:"http://localhost:21320",method:"POST",withCredentials:!1,timeout:3e3}).then((()=>e(!0))).catch((r=>{"ECONNABORTED"===r.code?t(n.ERRORS.TypedError(n.HardwareErrorCode.BridgeTimeoutError)):e(!1)}))}))}))}},deviceBackup:class extends gt{init(){this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("BackupDevice","Success");return Promise.resolve(e.message)}))}},deviceChangePin:class extends gt{init(){this.useDevicePassphraseState=!1,Rt(this.payload,[{name:"remove",type:"boolean"}]),this.params={remove:this.payload.remove}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ChangePin","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceFlags:class extends gt{init(){this.useDevicePassphraseState=!1,Rt(this.payload,[{name:"flags",type:"number"}]),this.params={flags:this.payload.flags}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ApplyFlags","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceRebootToBootloader:class extends gt{init(){this.useDevicePassphraseState=!1}getVersionRange(){return{classic:{min:"2.1.11"},mini:{min:"2.1.11"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("RebootToBootloader","Success");return Promise.resolve(e.message)}))}},deviceRecovery:class extends gt{init(){this.useDevicePassphraseState=!1,Rt(this.payload,[{name:"wordCount",type:"number"},{name:"passphraseProtection",type:"boolean"},{name:"pinProtection",type:"boolean"},{name:"language",type:"string"},{name:"label",type:"string"},{name:"enforceWordlist",type:"boolean"},{name:"type",type:"object"},{name:"u2fCounter",type:"number"},{name:"dryRun",type:"boolean"}]),this.params={word_count:this.payload.wordCount,passphrase_protection:this.payload.passphraseProtection,pin_protection:this.payload.pinProtection,language:this.payload.language,label:this.payload.label,enforce_wordlist:this.payload.enforceWordlist,type:this.payload.type,u2f_counter:this.payload.u2fCounter||Math.floor(Date.now()/1e3),dry_run:this.payload.dryRun}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("RecoveryDevice","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceReset:class extends gt{init(){this.useDevicePassphraseState=!1,Rt(this.payload,[{name:"displayRandom",type:"boolean"},{name:"strength",type:"number"},{name:"passphraseProtection",type:"boolean"},{name:"pinProtection",type:"boolean"},{name:"language",type:"string"},{name:"label",type:"string"},{name:"u2fCounter",type:"number"},{name:"skipBackup",type:"boolean"},{name:"noBackup",type:"boolean"},{name:"backupType"}]),this.params={display_random:this.payload.displayRandom,strength:this.payload.strength||256,passphrase_protection:this.payload.passphraseProtection,pin_protection:this.payload.pinProtection,language:this.payload.language,label:this.payload.label,u2f_counter:this.payload.u2fCounter||Math.floor(Date.now()/1e3),skip_backup:this.payload.skipBackup,no_backup:this.payload.noBackup,backup_type:this.payload.backupType}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ResetDevice","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceSettings:class extends gt{init(){this.useDevicePassphraseState=!1,Rt(this.payload,[{name:"language",type:"string"},{name:"label",type:"string"},{name:"usePassphrase",type:"boolean"},{name:"homescreen",type:"string"},{name:"passphraseSource",type:"number"},{name:"autoLockDelayMs",type:"number"},{name:"displayRotation",type:"number"},{name:"passphraseAlwaysOnDevice",type:"boolean"},{name:"safetyChecks",type:"number"},{name:"experimentalFeatures",type:"boolean"}]),this.params={language:this.payload.language,label:this.payload.label,use_passphrase:this.payload.usePassphrase,homescreen:this.payload.homescreen,_passphrase_source:this.payload.passphraseSource,auto_lock_delay_ms:this.payload.autoLockDelayMs,display_rotation:this.payload.displayRotation,passphrase_always_on_device:this.payload.passphraseAlwaysOnDevice,safety_checks:this.payload.safetyChecks,experimental_features:this.payload.experimentalFeatures}}getVersionRange(){return this.payload.usePassphrase?{model_mini:{min:"2.4.0"}}:{}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ApplySettings","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceUpdateReboot:class extends gt{init(){this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("DeviceBackToBoot","Success");return Promise.resolve(e.message)}))}},deviceUploadResource:class extends gt{constructor(){super(...arguments),this.paramsData={data:new Uint8Array,thumbnailData:new Uint8Array},this.processResourceRequest=e=>v(this,void 0,void 0,(function*(){if("Success"===e.type)return e.message;const{offset:t,data_length:r}=e.message,{data:i,thumbnailData:n}=this.paramsData;if(void 0===t)throw new Error("offset is undefined");let s;s="ResourceRequest"===e.type?new Uint8Array(i.slice(t,Math.min(t+r,i.byteLength))):new Uint8Array(n.slice(t,Math.min(t+r,n.byteLength)));const o=d.blake2s(s),u={data_chunk:a.bytesToHex(s),hash:a.bytesToHex(o)},l=yield this.device.commands.typedCall("ResourceAck",["ResourceRequest","ZoomRequest","Success"],u);return this.processResourceRequest(l)}))}getVersionRange(){return{model_touch:{min:"3.2.0"}}}init(){this.useDevicePassphraseState=!1,Rt(this.payload,[{name:"suffix",type:"string",required:!0},{name:"dataHex",type:"string",required:!0},{name:"thumbnailDataHex",type:"string",required:!0},{name:"resType",type:"number",required:!0},{name:"nftMetaData",type:"string"}]);const{suffix:e,dataHex:t,thumbnailDataHex:r,resType:i,nftMetaData:n}=this.payload;this.paramsData={data:Tt(t),thumbnailData:Tt(r)},this.params={extension:e,data_length:this.paramsData.data.byteLength,zoom_data_length:this.paramsData.thumbnailData.byteLength,res_type:i,nft_meta_data:n}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ResourceUpload",["ResourceRequest","ZoomRequest","Success"],this.params);return this.postMessage(Ne(Me.CLOSE_UI_WINDOW)),this.processResourceRequest(e)}))}},deviceSupportFeatures:class extends gt{init(){this.useDevicePassphraseState=!1}run(){if(!this.device.features)return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Device not initialized"));const e=J(this.device.features),t=(e=>{if(!e)return{support:!1};const t=X(e).join("."),r=W(e);return"classic"===r||"mini"===r?{support:!0}:{support:f.default.gte(t,"3.4.0")}})(this.device.features);return Promise.resolve({inputPinOnSoftware:e,modifyHomescreen:t,device:this.device.toMessageObject()})}},deviceVerify:class extends gt{init(){this.useDevicePassphraseState=!1,Rt(this.payload,[{name:"dataHex",type:"hexString"}]),this.params={data:_t(this.payload.dataHex)}}run(){return v(this,void 0,void 0,(function*(){let e;if("classic"===W(this.device.features)){e=(yield this.device.commands.typedCall("BixinVerifyDeviceRequest","BixinVerifyDeviceAck",Object.assign(Object.assign({},this.params),{data:a.bytesToHex(u.sha256(this.params.data))}))).message}else{const t=yield this.device.commands.typedCall("SESignMessage","SEMessageSignature",{message:this.params.data});e={cert:(yield this.device.commands.typedCall("ReadSEPublicCert","SEPublicCert")).message.public_cert,signature:t.message.signature}}return e?Promise.resolve(e):Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Device not support verify"))}))}},deviceWipe:class extends gt{init(){this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("WipeDevice","Success");return Promise.resolve(e.message)}))}},firmwareUpdate:class extends gt{init(){this.allowDeviceMode=[Je,et],this.requireDeviceMode=[Je],this.useDevicePassphraseState=!1;const{payload:e}=this;if(Rt(e,[{name:"version",type:"array"},{name:"binary",type:"buffer"}]),!e.updateType)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"updateType is required");this.params={updateType:e.updateType},"version"in e&&(this.params=Object.assign(Object.assign({},this.params),{version:e.version})),"binary"in e&&(this.params=Object.assign(Object.assign({},this.params),{binary:e.binary}))}run(){var e;return v(this,void 0,void 0,(function*(){const{device:t,params:r}=this;let i;try{if(r.binary)i=this.params.binary;else{if(!t.features)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"no features found for this device");i=(yield Ot({features:t.features,version:r.version,updateType:r.updateType})).binary}}catch(t){throw n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareUpdateDownloadFailed,null!==(e=t.message)&&void 0!==e?e:t)}return Mt(r.updateType,this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,t,{payload:i})}))}},firmwareUpdateV2:class extends gt{constructor(){super(...arguments),this.checkPromise=null,this.postTipMessage=e=>{this.postMessage(Ne(rt,{device:this.device.toMessageObject(),data:{message:e}}))}}init(){this.allowDeviceMode=[Je,et],this.requireDeviceMode=[],this.useDevicePassphraseState=!1;const{payload:e}=this;if(Rt(e,[{name:"version",type:"array"},{name:"binary",type:"buffer"},{name:"forcedUpdateRes",type:"boolean"}]),!e.updateType)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"updateType is required");this.params={updateType:e.updateType,forcedUpdateRes:e.forcedUpdateRes},"version"in e&&(this.params=Object.assign(Object.assign({},this.params),{version:e.version})),"binary"in e&&(this.params=Object.assign(Object.assign({},this.params),{binary:e.binary}))}checkDeviceToBootloader(e){this.checkPromise=n.createDeferred();const t=Ae.getSettings("env"),r=e&&"react-native"===t;Dt.log("FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ",r);const i=setInterval((()=>v(this,void 0,void 0,(function*(){var t,n,s,o,a,d,u;if(r)yield this.device.acquire(),yield this.device.initialize(),(null===(t=this.device.features)||void 0===t?void 0:t.bootloader_mode)&&(clearInterval(i),null===(n=this.checkPromise)||void 0===n||n.resolve(!0));else{const t=yield null===(s=this.device.deviceConnector)||void 0===s?void 0:s.enumerate(),r=null!==(o=null==t?void 0:t.descriptors)&&void 0!==o?o:[],{deviceList:n}=yield Ge.getDevices(r,e);1===n.length&&(null===(d=null===(a=n[0])||void 0===a?void 0:a.features)||void 0===d?void 0:d.bootloader_mode)&&(this.device.updateFromCache(n[0]),this.device.commands.disposed=!1,clearInterval(i),null===(u=this.checkPromise)||void 0===u||u.resolve(!0))}}))),r?3e3:2e3);setTimeout((()=>{this.checkPromise&&(clearInterval(i),this.checkPromise.reject(new Error))}),3e4)}isEnteredManuallyBoot(e){const t=W(e),r="mini"===t,i="firmware"===this.params.updateType&&"classic"===t&&"1.8.3"===e.bootloader_version;return r||i}isSupportResourceUpdate(e,t){if("firmware"!==t)return!1;const r=W(e),i="touch"===r||"pro"===r,n=X(e).join(".");return i&&f.default.gte(n,"3.2.0")}run(){var e,t;return v(this,void 0,void 0,(function*(){const{device:r,params:i}=this,{features:s,commands:o}=r;if(!(null==s?void 0:s.bootloader_mode)&&s){const t=K(s),d=W(s);if(this.isEnteredManuallyBoot(s))return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareUpdateManuallyEnterBoot));if(s&&this.isSupportResourceUpdate(s,i.updateType)){this.postTipMessage("CheckLatestUiResource");const e=Ae.getSysResourcesLatestRelease(s,i.forcedUpdateRes);if(e){this.postTipMessage("DownloadLatestUiResource");const t=yield(a=e,v(void 0,void 0,void 0,(function*(){let e;try{e=yield te(a,"binary")}catch(e){throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Method_FirmwareUpdate_DownloadFailed")}return{binary:e}})));this.postTipMessage("DownloadLatestUiResourceSuccess"),t&&(yield((e,t,r,i)=>v(void 0,void 0,void 0,(function*(){Ct(r,"UpdateSysResource",t);const n=yield m.default.loadAsync(i),s=Object.entries(n.files);let o=0;const a=100/s.length;for(const[i,n]of s){const s=i.split("/").pop();if(!n.dir&&-1===i.indexOf("__MACOSX")&&s){const t=yield n.async("arraybuffer");yield Pt(e,s,t)}o+=a,At(r,Math.floor(o),t)}return At(r,100,t),Ct(r,"UpdateSysResourceSuccess",t),!0})))(this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,r,t.binary))}}try{this.postTipMessage("AutoRebootToBootloader"),yield o.typedCall("DeviceBackToBoot","Success"),this.postTipMessage("GoToBootloaderSuccess"),this.checkDeviceToBootloader(this.payload.connectId),"classic"===d&&Ge.clearDeviceCache(t),delete Ge.devicesCache[""],yield null===(e=this.checkPromise)||void 0===e?void 0:e.promise,this.checkPromise=null,yield Se(1500)}catch(e){return e instanceof n.HardwareError?Promise.reject(e):(console.log("auto go to bootloader mode failed: ",e),Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure)))}}var a;let d;try{if(i.binary)d=this.params.binary;else{if(!r.features)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"no features found for this device");this.postTipMessage("DownloadFirmware");d=(yield Ot({features:r.features,version:i.version,updateType:i.updateType})).binary,this.postTipMessage("DownloadFirmwareSuccess")}}catch(e){throw n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareUpdateDownloadFailed,null!==(t=e.message)&&void 0!==t?t:e)}return yield this.device.acquire(),Mt(i.updateType,this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,r,{payload:d})}))}},requestWebUsbDevice:class extends gt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){var e,t;return v(this,void 0,void 0,(function*(){yield Ye.configure();if("webusb"!==Ae.getSettings("env"))return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Not webusb environment"));try{const r=yield null===(e=this.connector)||void 0===e?void 0:e.enumerate(),i=null!==(t=null==r?void 0:r.descriptors)&&void 0!==t?t:[],{deviceList:s}=yield Ge.getDevices(i);return s.length>0?{device:s[0].toMessageObject()}:yield Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Please select the device to connect"))}catch(e){return Bt.debug(e),Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Please select the device to connect"))}}))}},cipherKeyValue:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{const t=G(e.path);Rt(e,[{name:"path",required:!0},{name:"key",type:"string"},{name:"value",type:"hexString"},{name:"encrypt",type:"boolean"},{name:"askOnEncrypt",type:"boolean"},{name:"askOnDecrypt",type:"boolean"},{name:"iv",type:"hexString"}]),this.params.push({address_n:t,key:e.key,value:_t(e.value),encrypt:e.encrypt,ask_on_encrypt:e.askOnEncrypt,ask_on_decrypt:e.askOnDecrypt,iv:_t(e.iv)})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("CipherKeyValue","CipheredKeyValue",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},btcGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=Object.prototype.hasOwnProperty.call(this.payload,"bundle");const e=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(e,[{name:"bundle",type:"array"}]),this.params=[],e.bundle.forEach((e=>{var t;const r=G(e.path,1);Rt(e,[{name:"path",required:!0},{name:"coin",type:"string"},{name:"showOnOneKey",type:"boolean"},{name:"multisig",type:"object"},{name:"scriptType",type:"string"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t,{multisig:n,coin:s}=e;let{scriptType:o}=e;o||(o=H(r),"SPENDMULTISIG"!==o||n||(o="SPENDADDRESS"));const a=qt(r,s).name;this.params.push({address_n:r,show_display:i,coin_name:a,multisig:n,script_type:o||"SPENDADDRESS"})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("GetAddress","Address",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},btcGetPublicKey:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=Object.prototype.hasOwnProperty.call(this.payload,"bundle");const e=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(e,[{name:"bundle",type:"array"}]),this.params=[],e.bundle.forEach((e=>{var t;const r=G(e.path,1);Rt(e,[{name:"path",required:!0},{name:"coin",type:"string"},{name:"showOnOneKey",type:"boolean"},{name:"scriptType",type:"string"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t,{multisig:n,coin:s}=e;let{scriptType:o}=e;o||(o=H(r),"SPENDMULTISIG"!==o||n||(o="SPENDADDRESS"));const a=qt(r,s).name;this.params.push({address_n:r,show_display:i,coin_name:a,script_type:o||"SPENDADDRESS"})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("GetPublicKey","PublicKey",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},btcSignMessage:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"coin",type:"string"}]);const{path:e,messageHex:t,coin:r}=this.payload,i=G(e),{coinName:n,scriptType:s}=jt(i,r,!1);this.params={address_n:i,message:_t(t),coin_name:n,script_type:s}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("SignMessage","MessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},btcSignTransaction:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"coin",type:"string",required:!0},{name:"inputs",type:"array",required:!0},{name:"outputs",type:"array",required:!0},{name:"refTxs",type:"array",required:!0,allowEmpty:!0},{name:"locktime",type:"number"},{name:"version",type:"number"},{name:"expiry",type:"number"},{name:"overwintered",type:"boolean"},{name:"versionGroupId",type:"number"},{name:"branchId",type:"number"},{name:"timestamp",type:"number"}]),this.payload.refTxs.forEach((e=>{Rt(e,[{name:"hash",type:"hexString",required:!0},{name:"inputs",type:"array",required:!0},{name:"bin_outputs",type:"array",required:!Array.isArray(e.outputs)},{name:"outputs",type:"array"},{name:"version",type:"number",required:!0},{name:"lock_time",type:"number",required:!0},{name:"extra_data",type:"string"},{name:"timestamp",type:"number"},{name:"version_group_id",type:"number"}])})),this.payload.inputs.forEach((e=>{G(e.address_n);const t=(r=e.address_n,Array.isArray(r)&&r[0]===q(49));var r;Rt(e,[{name:"prev_hash",type:"hexString",required:!0},{name:"prev_index",type:"number",required:!0},{name:"script_type",type:"string"},{name:"amount",type:"string",required:t},{name:"sequence",type:"number"},{name:"multisig",type:"object"}])})),this.payload.outputs.forEach((e=>{if(Rt(e,[{name:"address_n",type:"array"},{name:"address",type:"string"},{name:"amount",type:"string"},{name:"op_return_data",type:"string"},{name:"multisig",type:"object"}]),Object.prototype.hasOwnProperty.call(e,"address_n")&&Object.prototype.hasOwnProperty.call(e,"address"))throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Cannot use address and address_n in one output");if(e.address_n){const t=(e=>{if(!Array.isArray(e)||e.length<1)return"PAYTOADDRESS";if(49===e[0])return"PAYTOP2SHWITNESS";switch(j(e[0])){case 48:return"PAYTOMULTISIG";case 49:return"PAYTOP2SHWITNESS";case 84:return"PAYTOWITNESS";default:return"PAYTOADDRESS"}})(e.address_n);if(e.script_type!==t)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,`Output change script_type should be set to ${t}`)}}));const{inputs:e,outputs:t,refTxs:r,account:i,coin:s}=this.payload,o=qt(void 0,s).name;this.params={inputs:e,outputs:t,refTxs:r,addresses:i?i.addresses:void 0,options:{lock_time:this.payload.locktime,timestamp:this.payload.timestamp,version:this.payload.version,expiry:this.payload.expiry,overwintered:this.payload.overwintered,version_group_id:this.payload.versionGroupId,branch_id:this.payload.branchId},coinName:o}}run(){return v(this,void 0,void 0,(function*(){const{device:e,params:t}=this,r=e.unavailableCapabilities.replaceTransaction,{refTxs:i}=t,n=r?Gt:zt;return yield n(e.commands.typedCall.bind(e.commands),t.inputs,t.outputs,i,t.options,t.coinName)}))}},btcVerifyMessage:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"address",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0},{name:"coin",type:"string",required:!0}]);const{coin:e}=this.payload,{address:t,messageHex:r,signature:i}=_t(this.payload),n=qt(void 0,e).name;this.params={address:t,message:r,signature:i,coin_name:n}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("VerifyMessage","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},confluxGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"chainId",type:"number"},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,chain_id:e.chainId,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("ConfluxGetAddress","ConfluxAddress",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},confluxSignMessage:class extends gt{init(){this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=G(e,3);this.params={address_n:r,message:_t(t)}}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ConfluxSignMessage","ConfluxMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},confluxSignMessageCIP23:class extends gt{init(){this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{path:e,domainHash:t,messageHash:r}=this.payload,i=G(e,3);this.params={address_n:i,domain_hash:_t(t),message_hash:_t(r)}}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ConfluxSignMessageCIP23","ConfluxMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},confluxSignTransaction:class extends gt{constructor(){super(...arguments),this.addressN=[],this.processTxRequest=(e,t)=>v(this,void 0,void 0,(function*(){if(!e.data_length){const t=e.signature_v,r=e.signature_r,i=e.signature_s;if(null==t||null==r||null==i)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodError,"sign transaction failed");return Promise.resolve({v:`0x${t.toString(16)}`,r:`0x${r}`,s:`0x${i}`})}const[r,i]=Wt(t,2*e.data_length),s=yield this.device.commands.typedCall("ConfluxTxAck","ConfluxTxRequest",{data_chunk:r});return this.processTxRequest(s.message,i)})),this.evmSignTx=(e,t)=>v(this,void 0,void 0,(function*(){const{to:r,value:i,gasPrice:n,gasLimit:s,nonce:o,data:a,chainId:d,epochHeight:u,storageLimit:l}=t,c=null==a?0:a.length/2,[p,h]=Wt(a,2048);let f={address_n:e,nonce:bt(o),gas_price:bt(n),gas_limit:bt(s),to:r,value:bt(i),epoch_height:bt(u),storage_limit:bt(l),chain_id:d};0!==c&&(f=Object.assign(Object.assign({},f),{data_length:c,data_initial_chunk:p}));const y=yield this.device.commands.typedCall("ConfluxSignTx","ConfluxTxRequest",f);return this.processTxRequest(y.message,h)}))}init(){this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload;this.addressN=G(e,3);const r=t;Rt(r,[{name:"to",type:"hexString",required:!0},{name:"value",type:"hexString",required:!0},{name:"gasLimit",type:"hexString",required:!0},{name:"gasPrice",type:"hexString",required:!0},{name:"nonce",type:"hexString",required:!0},{name:"epochHeight",type:"hexString",required:!0},{name:"storageLimit",type:"hexString",required:!0},{name:"chainId",type:"number",required:!0},{name:"data",type:"hexString"}]),this.formattedTx=_t(r)}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return v(this,void 0,void 0,(function*(){const{addressN:e,formattedTx:t}=this;if(null==t)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"ConfluxSignTransaction: format tx error");const r=yield this.evmSignTx(e,t);return Promise.resolve(r)}))}},evmGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("EthereumGetAddress","EthereumAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},evmGetPublicKey:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("EthereumGetPublicKey","EthereumPublicKey",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},evmSignMessage:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=G(e,3);this.params={address_n:r,message:_t(t)}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumSignMessage","EthereumMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},evmSignMessageEIP712:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{path:e,domainHash:t,messageHash:r}=this.payload,i=G(e,3);this.params={address_n:i,domain_hash:_t(t),message_hash:_t(r)}}getVersionRange(){return{model_mini:{min:"2.1.9"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumSignMessageEIP712","EthereumMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},evmSignTransaction:class extends gt{constructor(){super(...arguments),this.addressN=[],this.isEIP1559=!1,this.processTxRequest=(e,t,r)=>v(this,void 0,void 0,(function*(){if(!e.data_length){let t=e.signature_v;const i=e.signature_r,s=e.signature_s;if(null==t||null==i||null==s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"processTxRequest: Unexpected request");return r&&t<=1&&(t+=2*r+35),Promise.resolve({v:`0x${t.toString(16)}`,r:`0x${i}`,s:`0x${s}`})}const[i,s]=Wt(t,2*e.data_length),o=yield this.device.commands.typedCall("EthereumTxAck","EthereumTxRequest",{data_chunk:i});return this.processTxRequest(o.message,s,r)})),this.evmSignTx=(e,t)=>v(this,void 0,void 0,(function*(){const{to:r,value:i,gasPrice:n,gasLimit:s,nonce:o,data:a,chainId:d,txType:u}=t,l=null==a?0:a.length/2,[c,p]=Wt(a,2048);let h={address_n:e,nonce:bt(o),gas_price:bt(n),gas_limit:bt(s),to:r,value:bt(i),chain_id:d};0!==l&&(h=Object.assign(Object.assign({},h),{data_length:l,data_initial_chunk:c})),null!==u&&(h=Object.assign(Object.assign({},h),{tx_type:u}));const f=yield this.device.commands.typedCall("EthereumSignTx","EthereumTxRequest",h);return this.processTxRequest(f.message,p,d)})),this.evmSignTxEip1559=(e,t)=>v(this,void 0,void 0,(function*(){const{to:r,value:i,gasLimit:n,nonce:s,data:o,chainId:a,maxFeePerGas:d,maxPriorityFeePerGas:u,accessList:l}=t,c=null==o?0:o.length/2,[p,h]=Wt(o,2048),f={address_n:e,nonce:bt(s),max_gas_fee:bt(d),max_priority_fee:bt(u),gas_limit:bt(n),to:r,value:bt(i),data_length:c,data_initial_chunk:p,chain_id:a,access_list:(l||[]).map((e=>({address:e.address,storage_keys:e.storageKeys})))},y=yield this.device.commands.typedCall("EthereumSignTxEIP1559","EthereumTxRequest",f);return this.processTxRequest(y.message,h)}))}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload;this.addressN=G(e,3);const r=t;this.isEIP1559=!!r.maxFeePerGas&&!!r.maxPriorityFeePerGas;const i=[{name:"to",type:"hexString",required:!0},{name:"value",type:"hexString",required:!0},{name:"gasLimit",type:"hexString",required:!0},{name:"nonce",type:"hexString",required:!0},{name:"chainId",type:"number",required:!0},{name:"data",type:"hexString"}];this.isEIP1559?(i.push({name:"maxFeePerGas",type:"hexString",required:!0}),i.push({name:"maxPriorityFeePerGas",type:"hexString",required:!0})):(i.push({name:"gasPrice",type:"hexString",required:!0}),i.push({name:"txType",type:"number"})),Rt(r,i),this.formattedTx=_t(r)}getVersionRange(){return this.isEIP1559?{model_mini:{min:"2.1.11"}}:{model_mini:{min:"1.0.0"}}}run(){return v(this,void 0,void 0,(function*(){const{addressN:e,isEIP1559:t,formattedTx:r}=this,i=yield t?this.evmSignTxEip1559(e,r):this.evmSignTx(e,r);return Promise.resolve(i)}))}},evmSignTypedData:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"metamaskV4Compat",type:"boolean"},{name:"data",type:"object"},{name:"domainHash",type:"hexString"},{name:"messageHash",type:"hexString"}]);const{path:e,data:t,metamaskV4Compat:r,domainHash:i,messageHash:s}=this.payload,o=G(e,3);if(this.params={addressN:o,metamaskV4Compat:r,data:t},i)if(this.params.domainHash=_t(i),s)this.params.messageHash=_t(s);else if(t&&(!t.primaryType||"EIP712Domain"!==t.primaryType))throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"message_hash should only be empty when data.primaryType=EIP712Domain")}signTypedData(){return v(this,void 0,void 0,(function*(){const{commands:e}=this.device,{addressN:t,data:r,metamaskV4Compat:i}=this.params,{types:s,primaryType:o,domain:a,message:d}=r;let u=yield e.typedCall("EthereumSignTypedData",["EthereumTypedDataStructRequest","EthereumTypedDataValueRequest","EthereumTypedDataSignature"],{address_n:t,primary_type:o,metamask_v4_compat:i});for(;"EthereumTypedDataStructRequest"===u.type;){const{name:t}=u.message,r=s[t];if(void 0===r)throw n.ERRORS.TypedError("Runtime",`Type ${t} was not defined in types object`);const i={members:r.map((({name:e,type:t})=>({name:e,type:er(t,s)})))};u=yield e.typedCall("EthereumTypedDataStructAck",["EthereumTypedDataStructRequest","EthereumTypedDataValueRequest","EthereumTypedDataSignature"],i)}for(;"EthereumTypedDataValueRequest"===u.type;){const{member_path:t}=u.message;let r,i;const[l,...c]=t;switch(l){case 0:r=a,i="EIP712Domain";break;case 1:r=d,i=o;break;default:throw n.ERRORS.TypedError("Runtime","Root index can only be 0 or 1")}for(const e of c)if(Array.isArray(r))i=Zt(i).entryTypeName,r=r[e];else if("object"==typeof r&&null!==r){const t=s[i][e];i=t.type,r=r[t.name]}let p;p=Array.isArray(r)?Jt("uint16",r.length):Jt(i,r),u=yield e.typedCall("EthereumTypedDataValueAck",["EthereumTypedDataValueRequest","EthereumTypedDataSignature"],{value:p})}if("EthereumTypedDataSignature"!==u.type)throw n.ERRORS.TypedError("Runtime","Unexpected response type");const{address:l,signature:c}=u.message;return{address:l,signature:c}}))}getVersionRange(){return{model_mini:{min:"2.1.9"}}}supportSignTyped(){const e=W(this.device.features);if("classic"===e||"mini"===e){const e=X(this.device.features).join("."),t="2.2.0";if(f.default.lt(e,t))return!1}return!0}run(){return v(this,void 0,void 0,(function*(){if(!this.device.features)throw n.ERRORS.TypedError("Device_InitializeFailed","Device initialization failed. Please try again.");const{addressN:e}=this.params,t=W(this.device.features);if("classic"===t||"mini"===t){Rt(this.params,[{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{domainHash:t,messageHash:r}=this.params;let i;return i=this.supportSignTyped()?yield this.device.commands.typedCall("EthereumSignTypedHash","EthereumTypedDataSignature",{address_n:e,domain_separator_hash:null!=t?t:"",message_hash:r}):yield this.device.commands.typedCall("EthereumSignMessageEIP712","EthereumMessageSignature",{address_n:e,domain_hash:null!=t?t:"",message_hash:null!=r?r:""}),Promise.resolve(i.message)}return this.signTypedData()}))}},evmVerifyMessage:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"address",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0}]);const{address:e,messageHex:t,signature:r}=_t(this.payload);this.params={address:e,message:t,signature:r}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumVerifyMessage","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},starcoinGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StarcoinGetAddress","StarcoinAddress",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},starcoinGetPublicKey:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StarcoinGetPublicKey","StarcoinPublicKey",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},starcoinSignMessage:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=G(e,3);this.params={address_n:r,message:_t(t)}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinSignMessage","StarcoinMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},starcoinSignTransaction:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:_t(t)}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinSignTx","StarcoinSignedTx",Object.assign({},this.params));return Promise.resolve(e.message)}))}},starcoinVerifyMessage:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"publicKey",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0}]);const{publicKey:e,messageHex:t,signature:r}=_t(this.payload);this.params={public_key:e,message:t,signature:r}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinVerifyMessage","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},nemGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"network",type:"number"},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,network:e.network||104,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("NEMGetAddress","NEMAddress",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},nemSignTransaction:class extends gt{constructor(){super(...arguments),this.NEM_MOSAIC_LEVY_TYPES={1:"MosaicLevy_Absolute",2:"MosaicLevy_Percentile"},this.NEM_SUPPLY_CHANGE_TYPES={1:"SupplyChange_Increase",2:"SupplyChange_Decrease"},this.NEM_AGGREGATE_MODIFICATION_TYPES={1:"CosignatoryModification_Add",2:"CosignatoryModification_Delete"},this.NEM_IMPORTANCE_TRANSFER_MODES={1:"ImportanceTransfer_Activate",2:"ImportanceTransfer_Deactivate"},this.getCommon=(e,t)=>{var r;return{address_n:t,network:e.version>>24&255,timestamp:e.timeStamp,fee:e.fee,deadline:null!==(r=e.deadline)&&void 0!==r?r:0,signer:t?void 0:e.signer}},this.transferMessage=e=>{const t=e.mosaics?e.mosaics.map((e=>({namespace:e.mosaicId.namespaceId,mosaic:e.mosaicId.name,quantity:e.quantity}))):void 0;return{recipient:e.recipient,amount:e.amount,payload:e.message?e.message.payload:void 0,public_key:e.message&&2===e.message.type?e.message.publicKey:void 0,mosaics:t}},this.importanceTransferMessage=e=>({mode:this.NEM_IMPORTANCE_TRANSFER_MODES[e.importanceTransfer.mode],public_key:e.importanceTransfer.publicKey}),this.aggregateModificationMessage=e=>({modifications:e.modifications?e.modifications.map((e=>({type:this.NEM_AGGREGATE_MODIFICATION_TYPES[e.modificationType],public_key:e.cosignatoryAccount}))):void 0,relative_change:e.minCosignatories.relativeChange}),this.provisionNamespaceMessage=e=>{var t,r,i;return{namespace:null!==(t=e.newPart)&&void 0!==t?t:"",parent:e.parent||void 0,sink:null!==(r=e.rentalFeeSink)&&void 0!==r?r:"",fee:null!==(i=e.rentalFee)&&void 0!==i?i:0}},this.mosaicCreationMessage=e=>{var t,r;const{levy:i}=e.mosaicDefinition,n={namespace:e.mosaicDefinition.id.namespaceId,mosaic:e.mosaicDefinition.id.name,levy:i&&i.type?this.NEM_MOSAIC_LEVY_TYPES[i.type]:void 0,fee:i&&i.fee,levy_address:i&&i.recipient,levy_namespace:i&&i.mosaicId&&i.mosaicId.namespaceId,levy_mosaic:i&&i.mosaicId&&i.mosaicId.name,description:e.mosaicDefinition.description},{properties:s}=e.mosaicDefinition;return Array.isArray(s)&&s.forEach((e=>{const{name:t,value:r}=e;switch(t){case"divisibility":n.divisibility=parseInt(r);break;case"initialSupply":n.supply=parseInt(r);break;case"supplyMutable":n.mutable_supply="true"===r;break;case"transferable":n.transferable="true"===r}})),{definition:n,sink:null!==(t=e.creationFeeSink)&&void 0!==t?t:"",fee:null!==(r=e.creationFee)&&void 0!==r?r:0}},this.supplyChangeMessage=e=>{var t;return{namespace:e.mosaicId.namespaceId,mosaic:e.mosaicId.name,type:this.NEM_SUPPLY_CHANGE_TYPES[e.supplyType],delta:null!==(t=e.delta)&&void 0!==t?t:0}},this.parseTx=(e,t)=>{let r=e;const i={transaction:this.getCommon(e,t),transfer:void 0,importance_transfer:void 0,aggregate_modification:void 0,provision_namespace:void 0,mosaic_creation:void 0,supply_change:void 0};switch(258!==e.type&&4100!==e.type&&4098!==e.type||(i.cosigning=258===e.type||4098===e.type,r=e.otherTrans,i.multisig=this.getCommon(r)),r.type){case 257:i.transfer=this.transferMessage(r);break;case 2049:i.importance_transfer=this.importanceTransferMessage(r);break;case 4097:i.aggregate_modification=this.aggregateModificationMessage(r);break;case 8193:i.provision_namespace=this.provisionNamespaceMessage(r);break;case 16385:i.mosaic_creation=this.mosaicCreationMessage(r);break;case 16386:i.supply_change=this.supplyChangeMessage(r);break;default:throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Unknown transaction type")}return i}}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload,r=G(e,3);this.params=this.parseTx(t,r)}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("NEMSignTx","NEMSignedTx",Object.assign({},this.params));return Promise.resolve(e)}))}},solGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("SolanaGetAddress","SolanaAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},solSignTransaction:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{const t=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]),this.params.push({address_n:t,raw_tx:_t(e.rawTx)})}))}getVersionRange(){return{classic:{min:"2.1.9"},mini:{min:"2.1.9"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("SolanaSignTx","SolanaSignedTx",Object.assign({},r)),{signature:n}=i.message;e.push({path:$(r.address_n),signature:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},stellarGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StellarGetAddress","StellarAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},stellarSignTransaction:class extends gt{constructor(){super(...arguments),this.operations=[],this.parseOperation=e=>{switch(e.type){case"createAccount":return Rt(e,[{name:"destination",type:"string",required:!0},{name:"startingBalance",type:"bigNumber",required:!0}]),{type:"StellarCreateAccountOp",source_account:e.source,new_account:e.destination,starting_balance:e.startingBalance};case"payment":return Rt(e,[{name:"destination",type:"string",required:!0},{name:"amount",type:"bigNumber",required:!0},{name:"asset",required:!0}]),{type:"StellarPaymentOp",source_account:e.source,destination_account:e.destination,asset:e.asset,amount:e.amount};case"pathPayment":return Rt(e,[{name:"destAmount",type:"bigNumber",required:!0}]),{type:"StellarPathPaymentOp",source_account:e.source,send_asset:e.sendAsset,send_max:e.sendMax,destination_account:e.destination,destination_asset:e.destAsset,destination_amount:e.destAmount,paths:e.path};case"createPassiveOffer":return Rt(e,[{name:"amount",type:"bigNumber",required:!0}]),{type:"StellarCreatePassiveOfferOp",source_account:e.source,buying_asset:e.buying,selling_asset:e.selling,amount:e.amount,price_n:e.price.n,price_d:e.price.d};case"manageOffer":return Rt(e,[{name:"amount",type:"bigNumber",required:!0}]),{type:"StellarManageOfferOp",source_account:e.source,buying_asset:e.buying,selling_asset:e.selling,amount:e.amount,offer_id:e.offerId,price_n:e.price.n,price_d:e.price.d};case"setOptions":{const t=e.signer?{signer_type:e.signer.type,signer_key:e.signer.key,signer_weight:e.signer.weight}:void 0;return Object.assign({type:"StellarSetOptionsOp",source_account:e.source,clear_flags:e.clearFlags,set_flags:e.setFlags,master_weight:e.masterWeight,low_threshold:e.lowThreshold,medium_threshold:e.medThreshold,high_threshold:e.highThreshold,home_domain:e.homeDomain,inflation_destination_account:e.inflationDest},t)}case"changeTrust":return Rt(e,[{name:"limit",type:"bigNumber"}]),{type:"StellarChangeTrustOp",source_account:e.source,asset:e.line,limit:e.limit};case"allowTrust":return{type:"StellarAllowTrustOp",source_account:e.source,trusted_account:e.trustor,asset_type:e.assetType,asset_code:e.assetCode,is_authorized:e.authorize?1:0};case"accountMerge":return{type:"StellarAccountMergeOp",source_account:e.source,destination_account:e.destination};case"manageData":return{type:"StellarManageDataOp",source_account:e.source,key:e.name,value:e.value};case"bumpSequence":return{type:"StellarBumpSequenceOp",source_account:e.source,bump_to:e.bumpTo};default:return{}}},this.processTxRequest=(e,t)=>v(this,void 0,void 0,(function*(){const r=t+1>=e.length,i=e[t],{type:n}=i,s=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(i,["type"]);if(r){return(yield this.device.commands.typedCall(n,"StellarSignedTx",s)).message}return yield this.device.commands.typedCall(n,"StellarTxOpRequest",s),this.processTxRequest(e,t+1)}))}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"networkPassphrase",type:"string",required:!0},{name:"transaction",type:"object",required:!0}]);const{transaction:e,networkPassphrase:t}=this.payload;if(!e.timebounds)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"timebounds is required");const r=G(this.payload.path,3);this.params={address_n:r,network_passphrase:t,source_account:e.source,fee:e.fee,sequence_number:e.sequence,num_operations:e.operations.length,memo_type:c.StellarMemoType.NONE,timebounds_start:e.timebounds.minTime,timebounds_end:e.timebounds.maxTime},e.memo&&(this.params.memo_type=e.memo.type,this.params.memo_text=e.memo.text,this.params.memo_id=e.memo.id,this.params.memo_hash=e.memo.hash),e.operations.forEach((e=>{const t=this.parseOperation(e);t&&this.operations.push(t)})),console.log("StellarSignTransactionParams",this.params),console.log("StellarSignTransactionOperations",this.operations)}run(){return v(this,void 0,void 0,(function*(){return yield this.device.commands.typedCall("StellarSignTx","StellarTxOpRequest",Object.assign({},this.params)),this.processTxRequest(this.operations,0)}))}},tronGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("TronGetAddress","TronAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},tronSignMessage:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=G(e,3);this.params={address_n:r,message:vt(t)}}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("TronSignMessage","TronMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},tronSignTransaction:class extends gt{parseTx(e,t){const r={address_n:t,data:e.data,timestamp:e.timestamp,fee_limit:e.feeLimit,ref_block_bytes:e.refBlockBytes,ref_block_hash:e.refBlockHash,expiration:e.expiration,contract:{}};return e.contract&&(e.contract.transferContract&&(r.contract={transfer_contract:{to_address:e.contract.transferContract.toAddress,amount:e.contract.transferContract.amount}}),e.contract.triggerSmartContract&&(r.contract={trigger_smart_contract:{contract_address:e.contract.triggerSmartContract.contractAddress,call_value:e.contract.triggerSmartContract.callValue,data:e.contract.triggerSmartContract.data,call_token_value:e.contract.triggerSmartContract.callTokenValue,asset_id:e.contract.triggerSmartContract.assetId}})),r}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload,r=G(e,3);Rt(t,[{name:"refBlockBytes",type:"hexString",required:!0},{name:"refBlockHash",type:"hexString",required:!0},{name:"expiration",type:"number",required:!0},{name:"timestamp",type:"number",required:!0},{name:"contract",type:"object",required:!0}]),this.params=this.parseTx(_t(t),r)}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("TronSignTx","TronSignedTx",Object.assign({},this.params));return Promise.resolve(e.message)}))}},nearGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("NearGetAddress","NearAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},nearSignTransaction:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:_t(t)}}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("NearSignTx","NearSignedTx",Object.assign({},this.params));return Promise.resolve(e.message)}))}},aptosGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}publicKeyToAddress(e){const t=p.sha3_256.create();return t.update(Tt(e)),t.update("\0"),`0x${a.bytesToHex(t.digest())}`}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){var e;return v(this,void 0,void 0,(function*(){if(this.hasBundle&&(e=>{if(!e)return!1;const t=X(e).join("."),r=W(e);return"touch"===r||"pro"===r?f.default.gte(t,"3.1.0"):f.default.gte(t,"2.6.0")})(null===(e=this.device)||void 0===e?void 0:e.features)){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"ed25519"})).message.public_keys.map(((e,t)=>({path:$(this.params[t].address_n),publicKey:e,address:this.publicKeyToAddress(e)})));return Promise.resolve(e)}const t=[];for(let e=0;e<this.params.length;e++){const r=this.params[e],i=yield this.device.commands.typedCall("AptosGetAddress","AptosAddress",Object.assign({},r)),{address:n}=i.message;t.push({path:$(r.address_n),address:null==n?void 0:n.toLowerCase()})}return Promise.resolve(this.hasBundle?t:t[0])}))}},aptosGetPublicKey:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"ed25519"})).message.public_keys.map(((e,t)=>({path:$(this.params[t].address_n),publicKey:e})));return Promise.resolve(this.hasBundle?e:e[0])}))}},aptosSignTransaction:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:_t(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("AptosSignTx","AptosSignedTx",Object.assign({},this.params));return Promise.resolve(e.message)}))}},aptosSignMessage:class extends gt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,et],Rt(this.payload,[{name:"path",required:!0},{name:"payload",type:"object",required:!0}]);const{path:e,payload:t}=this.payload,r=G(e,3);Rt(t,[{name:"address",type:"string"},{name:"chainId",type:"string"},{name:"application",type:"string"},{name:"nonce",type:"string",required:!0},{name:"message",type:"string",required:!0}]),this.params={address_n:r,payload:{address:t.address,chain_id:t.chainId,application:t.application,nonce:t.nonce,message:t.message}}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){let e="APTOS\n";this.params.payload.address&&(e+=`address: ${this.params.payload.address}\n`),this.params.payload.application&&(e+=`application: ${this.params.payload.application}\n`),this.params.payload.chain_id&&(e+=`chainId: ${this.params.payload.chain_id}\n`),e+=`message: ${this.params.payload.message}\n`,e+=`nonce: ${this.params.payload.nonce}`;const t=yield this.device.commands.typedCall("AptosSignMessage","AptosMessageSignature",Object.assign({},this.params)),{address:r,signature:i}=t.message;return Promise.resolve({path:$(this.params.address_n),address:r,signature:i,fullMessage:e})}))}},algoGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("AlgorandGetAddress","AlgorandAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},algoSignTransaction:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],Rt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:_t(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("AlgorandSignTx","AlgorandSignedTx",Object.assign({},this.params)),{signature:t}=e.message;return{path:$(this.params.address_n),signature:t}}))}},cosmosGetAddress:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Rt(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Rt(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("CosmosGetAddress","CosmosAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},cosmosSignTransaction:class extends gt{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],Rt(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:_t(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("CosmosSignTx","CosmosSignedTx",Object.assign({},this.params)),{signature:t}=e.message;return{path:$(this.params.address_n),signature:t}}))}}});const rr=e=>{throw e instanceof n.HardwareError?e:"ERR_NETWORK"===e.code?n.ERRORS.TypedError(n.HardwareErrorCode.BridgeNotInstalled):"ECONNABORTED"===e.code?n.ERRORS.TypedError(n.HardwareErrorCode.BridgeTimeoutError):n.ERRORS.TypedError(e)},ir=Te(t.d0.DeviceConnector);class nr{constructor(){this.listenTimestamp=0,this.current=null,this.upcoming=[],this.listening=!1,Ye.load(),this.transport=Ye.getTransport(),Ge.setConnector(this)}enumerate(){return v(this,void 0,void 0,(function*(){try{const e=yield this.transport.enumerate();return this.upcoming=e,this._reportDevicesChange(),{descriptors:e}}catch(e){rr(e)}}))}listen(){return v(this,void 0,void 0,(function*(){const e=null!==this.current,t=this.current||[];let r;this.listening=!0;try{if(ir.debug("Start listening",t),this.listenTimestamp=(new Date).getTime(),r=e?yield this.transport.listen(t):yield this.transport.enumerate(),!this.listening)return;this.upcoming=r,ir.debug("Listen result",r),this._reportDevicesChange(),this.listening&&this.listen()}catch(e){const t=(new Date).getTime()-this.listenTimestamp;ir.debug("Listen error","timestamp",t,typeof e),t>1100?(yield(i=1e3,n=null,new Promise((e=>{setTimeout(e,i,n)}))),this.listening&&this.listen()):ir.warn("Transport error")}var i,n}))}stop(){this.listening=!1}acquire(e,t){return v(this,void 0,void 0,(function*(){ir.debug("acquire",e,t);const r=Ae.getSettings("env");try{let i;return i="react-native"===r?yield this.transport.acquire({uuid:e}):yield this.transport.acquire({path:e,previous:null!=t?t:null}),i}catch(e){ir.debug("acquire error: ",e.message),rr(e)}}))}release(e,t){return v(this,void 0,void 0,(function*(){try{return yield this.transport.release(e,t)}catch(e){rr(e)}}))}_reportDevicesChange(){Ge.reportDeviceChange(this.upcoming)}}const sr=Te(t.d0.Core),or=e=>({initSession:null==e?void 0:e.payload.initSession,passphraseState:null==e?void 0:e.payload.passphraseState,deviceId:null==e?void 0:e.payload.deviceId});let ar,dr,ur,lr,cr=[];const pr=[],hr=new Map;let fr=1;const yr={};let gr={passphraseState:void 0};const mr=e=>v(void 0,void 0,void 0,(function*(){var t;if(!e.id||!e.payload||e.type!==Pe.CALL)return Promise.reject(n.ERRORS.TypedError("on call: message.id or message.payload is missing"));let r,i;try{r=function(e){const{method:t}=e.payload;if("string"!=typeof t)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Method is not set");const r=tr[t];if(r)return new r(e);throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,`Method ${t} is not set`)}(e),r.connector=ur,r.postMessage=Pr,r.init()}catch(e){return Promise.reject(e)}if(Ge.emitter.on(je.CONNECT,Ir),!r.useDevice)try{const e=yield r.run();return Be(r.responseID,!0,e)}catch(e){return Be(r.responseID,!1,{error:e})}pr.push(r),pr.length>1&&sr.debug("should cancel the previous method execution: ",pr.map((e=>e.name)));const s=gr.passphraseState!==r.payload.passphraseState;let o;gr={passphraseState:r.payload.passphraseState},(s||r.payload.initSession)&&(sr.debug("passphrase state change, clear device cache"),Ge.clearDeviceCache(r.payload.connectId)),yr[fr]&&(yr[fr]=!1),fr+=1;try{o=yield Er(r,fr)}catch(e){return Be(r.responseID,!1,{error:e})}sr.debug("Call API - setDevice: ",o.mainId),null===(t=r.setDevice)||void 0===t||t.call(r,o),o.on(je.PIN,Ar),o.on(je.BUTTON,Cr),o.on(je.PASSPHRASE,Mr),o.on(je.PASSPHRASE_ON_DEVICE,Nr),o.on(je.FEATURES,kr);try{const e=()=>v(void 0,void 0,void 0,(function*(){const e=W(o.features),t=(s=o.features)&&"object"==typeof s?"1"===s.model?"model_mini":"model_touch":"model_mini";var s;const a=r.getVersionRange()[e],d=r.getVersionRange()[t],u=null!=a?a:d;if(u&&o.features){const e=X(o.features).join(".");if(f.default.valid(u.min)&&f.default.lt(e,u.min)){const t=Ae.getFirmwareStatus(o.features);if("none"===t||"valid"===t)throw n.ERRORS.TypedError(n.HardwareErrorCode.NewFirmwareUnRelease);return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodNeedUpgradeFirmware,`Device firmware version is too low, please update to ${u.min}`,{current:e,require:u.min}))}if(u.max&&f.default.valid(u.max)&&f.default.gte(e,u.max))return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodDeprecated,`Device firmware version is too high, this method has been deprecated in ${u.max}`,{current:e,deprecated:u.max}))}const l=o.hasUnexpectedMode(r.allowDeviceMode,r.requireDeviceMode);if(l)return l===Me.NOT_IN_BOOTLOADER?Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceUnexpectedBootloaderMode)):Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceUnexpectedMode,l));if(r.deviceId&&r.checkDeviceId){if(!o.checkDeviceId(r.deviceId))return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceCheckDeviceIdError))}if(r.checkFirmwareRelease(),r.checkDeviceSupportFeature(),dr&&(yield Ye.reconfigure(o.getFirmwareVersion())),Tr(r,o.features),o.hasUsePassphrase()&&r.useDevicePassphraseState){const e=(e=>{if(!e)return{support:!1};const t=W(e);if("touch"===t||"pro"===t)return{support:!0};const r=X(e).join(".");return{support:f.default.gte(r,"2.4.0"),require:"2.4.0"}})(o.features);if(!e.support)return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceNotSupportPassphrase,`Device not support passphrase, please update to ${e.require}`,{require:e.require}));const t=yield o.checkPassphraseState();if(Tr(r,o.features),t)return Ge.clearDeviceCache(r.payload.connectId),Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceCheckPassphraseStateError))}try{yield r.checkSafetyLevelOnTestNet()}catch(e){const t=e instanceof n.HardwareError?e:n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"open safety check failed.");return i=Be(r.responseID,!1,{error:t}),void(null==lr||lr.resolve(i))}try{const e=yield r.run();sr.debug("Call API - Inner Method Run: "),i=Be(r.responseID,!0,e),null==lr||lr.resolve(i)}catch(e){sr.debug("Call API - Inner Method Run Error: ",e),i=Be(r.responseID,!1,{error:e}),null==lr||lr.resolve(i)}}));sr.debug("Call API - Device Run: ",o.mainId);const t=Object.assign({keepSession:r.payload.keepSession},or(r)),s=()=>o.run(e,t);lr=n.createDeferred(s);try{return yield lr.promise}catch(e){return sr.debug("Device Run Error: ",e),Be(r.responseID,!1,{error:e})}}catch(e){i=Be(r.responseID,!1,{error:e}),null==lr||lr.reject(n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodError,e.message)),sr.debug("Call API - Run Error: ",e)}finally{i&&r&&r.dispose();const e=r.responseID?pr.findIndex((e=>e.responseID===r.responseID)):-1;e>-1&&(pr.splice(e,1),sr.debug("Remove the finished method from the queue: ",pr.map((e=>e.name)))),Or(),Sr(),Rr(o)}}));function vr(e){if(!dr)throw n.ERRORS.TypedError(n.HardwareErrorCode.DeviceListNotInitialized);let t;const r=dr.allDevices();if(e.connectId)t=dr.getDevice(e.connectId);else if(1===r.length)[t]=r;else if(r.length>1)throw n.ERRORS.TypedError("firmwareUpdateV2"===e.name?n.HardwareErrorCode.FirmwareUpdateLimitOneDevice:n.HardwareErrorCode.SelectDevice);if(!t)throw n.ERRORS.TypedError(n.HardwareErrorCode.DeviceNotFound);return t.deviceConnector=ur,t}function br(e){if(!e.connectId&&!dr)throw n.ERRORS.TypedError(n.HardwareErrorCode.DeviceListNotInitialized);if(!e.connectId)return vr(e);let t;return hr.has(e.connectId)?t=hr.get(e.connectId):(t=ct.fromDescriptor({id:e.connectId}),hr.set(e.connectId,t)),t.deviceConnector=ur,t}let _r=0;function wr(e,t){return v(this,void 0,void 0,(function*(){try{yield t.acquire(),yield t.initialize(or(e))}catch(r){if(!(r.errorCode===n.HardwareErrorCode.BleTimeoutError&&_r<=5))throw r;_r+=1,sr.debug(`Bletooth connect timeout and will retry, retry count: ${_r}`),yield Se(3e3),yield wr(e,t)}}))}const Er=(e,t)=>v(void 0,void 0,void 0,(function*(){let r=0;const i=e.payload&&e.payload.retryCount||5,s=e.payload&&e.payload.pollIntervalTime||1e3,o=e.payload&&e.payload.timeout||1e4;let a=null;sr.debug(`EnsureConnected function start, MAX_RETRY_COUNT=${i}, POLL_INTERVAL_TIME=${s} `);const d=(i=s)=>v(void 0,void 0,void 0,(function*(){return new Promise(((s,u)=>v(void 0,void 0,void 0,(function*(){if(!yr[t])return sr.debug("EnsureConnected function stop, polling id: ",t),void u(n.ERRORS.TypedError(n.HardwareErrorCode.PollingStop));a&&clearTimeout(a),a=setTimeout((()=>{u(n.ERRORS.TypedError(n.HardwareErrorCode.PollingTimeout))}),o),r+=1,sr.debug("EnsureConnected function try count: ",r," poll interval time: ",i);try{yield function(e){return v(this,void 0,void 0,(function*(){"react-native"===Ae.getSettings("env")&&e.connectId?yield Ye.configure():(dr||(dr=new pt,yield Ye.configure(),dr.connector=ur),yield dr.getDeviceLists(e.connectId,or(e)))}))}(e)}catch(e){if(sr.debug("device list error: ",e),[n.HardwareErrorCode.BridgeNotInstalled,n.HardwareErrorCode.BridgeTimeoutError].includes(e.errorCode))return dr=void 0,void u(e);e.errorCode===n.HardwareErrorCode.TransportNotConfigured&&(yield Ye.configure())}const l=Ae.getSettings("env");let c;try{if(c="react-native"===l?br(e):vr(e),c)return a&&clearTimeout(a),"react-native"===l&&(_r=0,yield wr(e,c)),void s(c)}catch(e){if(sr.debug("device error: ",e),[n.HardwareErrorCode.BlePermissionError,n.HardwareErrorCode.BleLocationError,n.HardwareErrorCode.BleLocationServicesDisabled,n.HardwareErrorCode.BleDeviceNotBonded,n.HardwareErrorCode.BleCharacteristicNotifyError,n.HardwareErrorCode.BleTimeoutError,n.HardwareErrorCode.BleWriteCharacteristicError,n.HardwareErrorCode.BleAlreadyConnected,n.HardwareErrorCode.FirmwareUpdateLimitOneDevice].includes(e.errorCode))return void u(e)}return r>5?(a&&clearTimeout(a),sr.debug("EnsureConnected get to max try count, will return: ",r),void u(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceNotFound))):setTimeout((()=>s(d(1.5*i))),i)}))))}));return yr[t]=!0,d()})),Tr=(e,t)=>{if(e.useDevicePassphraseState){if(!0===(null==t?void 0:t.passphrase_protection)&&!e.payload.passphraseState)throw Ge.clearDeviceCache(e.payload.connectId),n.ERRORS.TypedError(n.HardwareErrorCode.DeviceOpenedPassphrase);if(!1===(null==t?void 0:t.passphrase_protection)&&e.payload.passphraseState)throw Ge.clearDeviceCache(e.payload.connectId),n.ERRORS.TypedError(n.HardwareErrorCode.DeviceNotOpenedPassphrase)}},Sr=()=>{cr=[],sr.debug("Cleanup...")},Rr=e=>{e.removeListener(je.PIN,Ar),e.removeListener(je.BUTTON,Cr),e.removeListener(je.PASSPHRASE,Mr),e.removeListener(je.PASSPHRASE_ON_DEVICE,Nr),e.removeListener(je.FEATURES,kr),Ge.emitter.removeListener(je.CONNECT,Ir)},Or=()=>{Pr(Ne(Me.CLOSE_UI_WINDOW))},Ir=e=>{const t="react-native"===Ae.getSettings("env")?e:e.toMessageObject();Pr(Fe(je.CONNECT,{device:t}))},xr=e=>{const t="react-native"===Ae.getSettings("env")?e:e.toMessageObject();Pr(Fe(je.DISCONNECT,{device:t}))},Ar=(...[e,t,r])=>v(void 0,void 0,void 0,(function*(){sr.debug("onDevicePinHandler");const i=Dr(Le.RECEIVE_PIN,e);Pr(Ne(Me.REQUEST_PIN,{device:e.toMessageObject(),type:t}));const n=yield i.promise;r(null,n.payload)})),Cr=(...[e,t])=>{Pr(Fe(je.BUTTON,Object.assign(Object.assign({},t),{device:e.toMessageObject()}))),"ButtonRequest_PinEntry"===t.code?Pr(Ne(Me.REQUEST_PIN,{device:e.toMessageObject(),type:"ButtonRequest_PinEntry"})):Pr(Ne(Me.REQUEST_BUTTON,{device:e.toMessageObject()}))},kr=(...[e,t])=>{Pr(Fe(je.FEATURES,Object.assign({},t)))},Mr=(...[e,t])=>v(void 0,void 0,void 0,(function*(){sr.debug("onDevicePassphraseHandler");const r=Dr(Le.RECEIVE_PASSPHRASE,e);Pr(Ne(Me.REQUEST_PASSPHRASE,{device:e.toMessageObject(),passphraseState:e.passphraseState}));const i=yield r.promise,{value:n,passphraseOnDevice:s,save:o}=i.payload;t({passphrase:n.normalize("NFKD"),passphraseOnDevice:s,cache:o})})),Nr=(...[e])=>{Pr(Ne(Me.REQUEST_PASSPHRASE_ON_DEVICE,{device:e.toMessageObject(),passphraseState:e.passphraseState}))},Pr=e=>{ar.emit(Ce,e)},Dr=(e,t)=>{const r=n.createDeferred(e,t);return cr.push(r),r};class Br extends E.exports{handleMessage(e){var t,r,i,n;return v(this,void 0,void 0,(function*(){switch(e.type){case Le.RECEIVE_PIN:case Le.RECEIVE_PASSPHRASE:{const t=(o=e.type,cr.find((e=>e.id===o)));t&&(t.resolve(e),s=t,cr=cr.filter((e=>e!==s)));break}case Me.BLUETOOTH_PERMISSION:case Me.LOCATION_PERMISSION:case Me.LOCATION_SERVICE_PERMISSION:Pr(e);break;case Pe.CALL:{const s=yield mr(e),{success:o,payload:a}=s;return o?s:Object.assign(Object.assign({},s),{payload:Object.assign(Object.assign({},a),{connectId:null!==(r=null===(t=e.payload)||void 0===t?void 0:t.connectId)&&void 0!==r?r:"",deviceId:null!==(n=null===(i=e.payload)||void 0===i?void 0:i.deviceId)&&void 0!==n?n:""})})}case Pe.CANCEL:(e=>{const t=Ae.getSettings("env");try{if(e){let r;r="react-native"===t?br({connectId:e}):vr({connectId:e}),null==r||r.interruptionFromUser()}}catch(e){sr.error("Cancel API Error: ",e)}Sr(),Or()})(e.payload.connectId)}var s,o;return Promise.resolve(e)}))}dispose(){}}t.Td=je,t.Fd=qe,t.SI=Ue,t.Bg=Pe,t.og=ue,t.rF=ke,t.xG=e=>{let t={error:e.message,code:e.code};return e instanceof n.HardwareError&&(t={error:e.message,code:e.errorCode}),{success:!1,payload:t}},t.ZP=({init:e,call:t,dispose:r,eventEmitter:i,uiResponse:n,cancel:s})=>(({call:e,cancel:t,dispose:r,eventEmitter:i,init:n,uiResponse:s})=>({on:(e,t)=>{i.on(e,t)},off:(e,t)=>{i.removeListener(e,t)},removeAllListeners:e=>{i.removeAllListeners(e)},init:n,call:e,dispose:r,uiResponse:s,cancel:t,getLogs:()=>e({method:"getLogs"}),searchDevices:()=>e({method:"searchDevices"}),getFeatures:t=>e({connectId:t,method:"getFeatures"}),checkFirmwareRelease:t=>e({connectId:t,method:"checkFirmwareRelease"}),checkBLEFirmwareRelease:t=>e({connectId:t,method:"checkBLEFirmwareRelease"}),checkTransportRelease:()=>e({method:"checkTransportRelease"}),checkBridgeStatus:()=>e({method:"checkBridgeStatus"}),cipherKeyValue:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"cipherKeyValue"})),deviceBackup:t=>e({connectId:t,method:"deviceBackup"}),deviceChangePin:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceChangePin"})),deviceFlags:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceFlags"})),deviceRebootToBootloader:t=>e({connectId:t,method:"deviceRebootToBootloader"}),deviceRecovery:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceRecovery"})),deviceReset:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceReset"})),deviceSettings:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceSettings"})),deviceUpdateReboot:t=>e({connectId:t,method:"deviceUpdateReboot"}),deviceUploadResource:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceUploadResource"})),deviceSupportFeatures:t=>e({connectId:t,method:"deviceSupportFeatures"}),deviceVerify:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceVerify"})),deviceWipe:t=>e({connectId:t,method:"deviceWipe"}),getPassphraseState:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"getPassphraseState"})),evmGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmGetAddress"})),evmGetPublicKey:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmGetPublicKey"})),evmSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmSignMessage"})),evmSignMessageEIP712:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmSignMessageEIP712"})),evmSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmSignTransaction"})),evmSignTypedData:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmSignTypedData"})),evmVerifyMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmVerifyMessage"})),btcGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcGetAddress"})),btcGetPublicKey:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcGetPublicKey"})),btcSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcSignMessage"})),btcSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcSignTransaction"})),btcVerifyMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcVerifyMessage"})),starcoinGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinGetAddress"})),starcoinGetPublicKey:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinGetPublicKey"})),starcoinSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinSignMessage"})),starcoinSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinSignTransaction"})),starcoinVerifyMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinVerifyMessage"})),nemGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"nemGetAddress"})),nemSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"nemSignTransaction"})),solGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"solGetAddress"})),solSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"solSignTransaction"})),stellarGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"stellarGetAddress"})),stellarSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"stellarSignTransaction"})),firmwareUpdate:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"firmwareUpdate"})),firmwareUpdateV2:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"firmwareUpdateV2"})),requestWebUsbDevice:()=>e({method:"requestWebUsbDevice"}),tronGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"tronGetAddress"})),tronSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"tronSignMessage"})),tronSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"tronSignTransaction"})),confluxGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"confluxGetAddress"})),confluxSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"confluxSignMessage"})),confluxSignMessageCIP23:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"confluxSignMessageCIP23"})),confluxSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"confluxSignTransaction"})),nearGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"nearGetAddress"})),nearSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"nearSignTransaction"})),aptosGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"aptosGetAddress"})),aptosGetPublicKey:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"aptosGetPublicKey"})),aptosSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"aptosSignMessage"})),aptosSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"aptosSignTransaction"})),algoGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"algoGetAddress"})),algoSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"algoSignTransaction"})),cosmosGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"cosmosGetAddress"})),cosmosSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"cosmosSignTransaction"}))}))({init:e,call:t,dispose:r,eventEmitter:i,uiResponse:n,cancel:s}),t.yI=ge,t.jl=Te,t._4=(e={})=>{const t=Object.assign({},ot);let i;Object.prototype.hasOwnProperty.call(e,"debug")&&(t.debug=e.debug),e.isFrame&&(t.parentOrigin=e.parentOrigin),"string"==typeof e.connectSrc&&(t.connectSrc=e.connectSrc),"undefined"!=typeof window?i=window.ONEKEY_CONNECT_SRC:void 0!==r.g&&(i=r.g.ONEKEY_CONNECT_SRC),"string"==typeof i&&(t.connectSrc=dt(i),t.debug=!0);const n=t.connectSrc||st;return t.iframeSrc=`${n}iframe.html`,e.transportReconnect&&(t.transportReconnect=e.transportReconnect),e.lazyLoad&&(t.lazyLoad=e.lazyLoad),"string"==typeof e.env?t.env=e.env:t.env=at(),e.timestamp&&(t.timestamp=e.timestamp),t},t.kW=e=>{const{data:t}=e,r={event:t.event,type:t.type,payload:t.payload};return"number"==typeof e.id&&(r.id=e.id),"boolean"==typeof r.success&&(r.success=t.success),r},t.hZ=ve},7495:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(3448),n=r(7808),s=r(9396),o=r(8834);function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=d(i),l=d(n),c=a(s);const p=["bool","string","bytes","int32","int64","uint32","uint64","sint32","sint64","fixed32","fixed64","sfixed32","sfixed64","double","float"],h=e=>p.includes(e),f=(e,t)=>e.optional&&void 0===t?null:"bytes"===e.type?c.default.wrap(t).toString("hex"):e.long?Number.isSafeInteger(t.toNumber())?t.toNumber():t.toString():t;function y(e,t){const r=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(e,[]),i={};return Object.keys(t).forEach((e=>{const n=t[e],s=r[e];if(n.repeated)if(h(n.type))i[e]=s.map((e=>f(n,e)));else if("valuesById"in n.resolvedType)i[e]=s;else{if(!("fields"in n.resolvedType))throw new Error(`case not handled for repeated key: ${e}`);i[e]=s.map((e=>y(e,n.resolvedType.fields)))}else if(h(n.type))i[e]=f(n,s);else if("valuesById"in n.resolvedType)i[e]=n.resolvedType.valuesById[s];else{if(!n.resolvedType.fields)throw new Error(`case not handled: ${e}`);i[e]=y(s,n.resolvedType.fields)}})),i}const g=(e,t)=>{if("bytes"===e)return"string"!=typeof t||t?o.Buffer.from(t,"hex"):t;if("number"==typeof t&&!Number.isSafeInteger(t))throw new RangeError("field value is not within safe integer range");return t};function m(e,t){const r={};return e.fields?(Object.keys(e.fields).forEach((i=>{const n=e.fields[i],s=t[i];if(void 0!==s)if(h(n.type))n.repeated?r[i]=s.map((e=>g(n.type,e))):r[i]=g(n.type,s);else if(n.repeated){const t=e.lookupTypeOrEnum(n.type);r[i]=s.map((e=>m(t,e)))}else if("object"==typeof s&&null!==s){const t=e.lookupType(n.type);r[i]=m(t,s)}else if("number"==typeof s){const t=e.lookupEnum(n.type);r[i]=t.values[s]}else r[i]=s})),r):r}const v=(e,t)=>{const r=m(e,t),i=e.fromObject(r),n=e.encode(i).finish(),s=new c.default(n.byteLength);return s.append(n),s.reset(),s};const b=(e,t)=>{const r=e.lookupType(t);let i=e.lookupEnum("MessageType").values[`MessageType_${t}`];return!i&&r.options&&(i=r.options["(wire_type)"]),{Message:r,messageType:i}},_=e=>{const{typeId:t}=(e=>({typeId:e.readUint16(),length:e.readUint32()}))(e);return{typeId:t,buffer:e}};var w=Object.freeze({__proto__:null,decode:_,decodeChunked:e=>{const t=c.default.wrap(e,void 0,void 0,!0),{sharp1:r,sharp2:i,typeId:n,length:s}=(e=>({sharp1:e.readByte(),sharp2:e.readByte(),typeId:e.readUint16(),length:e.readUint32()}))(t);if(35!==r||35!==i)throw new Error("Didn't receive expected header signature.");return{length:s,typeId:n,restBuffer:t}}});function E(e,t){const{addTrezorHeaders:r,chunked:i,messageType:n}=t,s=(r?8:6)+e.limit,o=new c.default(s);if(r&&(o.writeByte(35),o.writeByte(35)),o.writeUint16(n),o.writeUint32(e.limit),o.append(e.buffer),o.reset(),!1===i)return o;const a=[],d=Math.floor((o.limit-1)/63)+1||1;for(let e=0;e<d;e++){const t=63*e,r=Math.min(63*(e+1),o.limit),i=o.slice(t,r);i.compact(),a.push(i.buffer)}return a}const T=(e,t,r)=>{const{Message:i,messageType:n}=b(e,t);return E(v(i,r),{addTrezorHeaders:!0,chunked:!0,messageType:n})};const S="Wrong result type.";function R(e){if(null==e)return null;if("string"!=typeof e)throw new Error(S);return e}var O,I,x,A,C,k,M,N,P,D,B,L,q,j,F,U,z,H,$,G,W,V,K,Y,X,Z,J,Q,ee,te,re,ie,ne,se,oe,ae,de,ue,le,ce,pe,he=Object.freeze({__proto__:null,info:function(e){if("object"!=typeof e||null==e)throw new Error("Wrong result type.");const{version:t}=e;if("string"!=typeof t)throw new Error(S);return{version:t,configured:!!e.configured}},version:function(e){if("string"!=typeof e)throw new Error(S);return e.trim()},devices:function(e){if("object"!=typeof e)throw new Error(S);if(!(e instanceof Array))throw new Error(S);return e.map((e=>{if("object"!=typeof e||null==e)throw new Error(S);const{path:t}=e;if("string"!=typeof t)throw new Error(S);return{path:t.toString(),session:R(e.session),debugSession:R(e.debugSession),product:e.product,vendor:e.vendor,debug:!!e.debug}}))},acquire:function(e){if("object"!=typeof e||null==e)throw new Error(S);const{session:t}=e;if("string"!=typeof t&&"number"!=typeof t)throw new Error(S);return t.toString()},call:function(e){if("object"!=typeof e||null==e)throw new Error(S);const{type:t}=e;if("string"!=typeof t)throw new Error(S);const{message:r}=e;if("object"!=typeof r||null==r)throw new Error(S);return{type:t,message:r}}});t.BinanceOrderType=void 0,(O=t.BinanceOrderType||(t.BinanceOrderType={}))[O.OT_UNKNOWN=0]="OT_UNKNOWN",O[O.MARKET=1]="MARKET",O[O.LIMIT=2]="LIMIT",O[O.OT_RESERVED=3]="OT_RESERVED",t.BinanceOrderSide=void 0,(I=t.BinanceOrderSide||(t.BinanceOrderSide={}))[I.SIDE_UNKNOWN=0]="SIDE_UNKNOWN",I[I.BUY=1]="BUY",I[I.SELL=2]="SELL",t.BinanceTimeInForce=void 0,(x=t.BinanceTimeInForce||(t.BinanceTimeInForce={}))[x.TIF_UNKNOWN=0]="TIF_UNKNOWN",x[x.GTE=1]="GTE",x[x.TIF_RESERVED=2]="TIF_RESERVED",x[x.IOC=3]="IOC",t.Enum_InputScriptType=void 0,(A=t.Enum_InputScriptType||(t.Enum_InputScriptType={}))[A.SPENDADDRESS=0]="SPENDADDRESS",A[A.SPENDMULTISIG=1]="SPENDMULTISIG",A[A.EXTERNAL=2]="EXTERNAL",A[A.SPENDWITNESS=3]="SPENDWITNESS",A[A.SPENDP2SHWITNESS=4]="SPENDP2SHWITNESS",A[A.SPENDTAPROOT=5]="SPENDTAPROOT",t.Enum_OutputScriptType=void 0,(C=t.Enum_OutputScriptType||(t.Enum_OutputScriptType={}))[C.PAYTOADDRESS=0]="PAYTOADDRESS",C[C.PAYTOSCRIPTHASH=1]="PAYTOSCRIPTHASH",C[C.PAYTOMULTISIG=2]="PAYTOMULTISIG",C[C.PAYTOOPRETURN=3]="PAYTOOPRETURN",C[C.PAYTOWITNESS=4]="PAYTOWITNESS",C[C.PAYTOP2SHWITNESS=5]="PAYTOP2SHWITNESS",C[C.PAYTOTAPROOT=6]="PAYTOTAPROOT",t.DecredStakingSpendType=void 0,(k=t.DecredStakingSpendType||(t.DecredStakingSpendType={}))[k.SSGen=0]="SSGen",k[k.SSRTX=1]="SSRTX",t.AmountUnit=void 0,(M=t.AmountUnit||(t.AmountUnit={}))[M.BITCOIN=0]="BITCOIN",M[M.MILLIBITCOIN=1]="MILLIBITCOIN",M[M.MICROBITCOIN=2]="MICROBITCOIN",M[M.SATOSHI=3]="SATOSHI",t.Enum_RequestType=void 0,(N=t.Enum_RequestType||(t.Enum_RequestType={}))[N.TXINPUT=0]="TXINPUT",N[N.TXOUTPUT=1]="TXOUTPUT",N[N.TXMETA=2]="TXMETA",N[N.TXFINISHED=3]="TXFINISHED",N[N.TXEXTRADATA=4]="TXEXTRADATA",N[N.TXORIGINPUT=5]="TXORIGINPUT",N[N.TXORIGOUTPUT=6]="TXORIGOUTPUT",t.CardanoDerivationType=void 0,(P=t.CardanoDerivationType||(t.CardanoDerivationType={}))[P.LEDGER=0]="LEDGER",P[P.ICARUS=1]="ICARUS",P[P.ICARUS_TREZOR=2]="ICARUS_TREZOR",t.CardanoAddressType=void 0,(D=t.CardanoAddressType||(t.CardanoAddressType={}))[D.BASE=0]="BASE",D[D.BASE_SCRIPT_KEY=1]="BASE_SCRIPT_KEY",D[D.BASE_KEY_SCRIPT=2]="BASE_KEY_SCRIPT",D[D.BASE_SCRIPT_SCRIPT=3]="BASE_SCRIPT_SCRIPT",D[D.POINTER=4]="POINTER",D[D.POINTER_SCRIPT=5]="POINTER_SCRIPT",D[D.ENTERPRISE=6]="ENTERPRISE",D[D.ENTERPRISE_SCRIPT=7]="ENTERPRISE_SCRIPT",D[D.BYRON=8]="BYRON",D[D.REWARD=14]="REWARD",D[D.REWARD_SCRIPT=15]="REWARD_SCRIPT",t.CardanoNativeScriptType=void 0,(B=t.CardanoNativeScriptType||(t.CardanoNativeScriptType={}))[B.PUB_KEY=0]="PUB_KEY",B[B.ALL=1]="ALL",B[B.ANY=2]="ANY",B[B.N_OF_K=3]="N_OF_K",B[B.INVALID_BEFORE=4]="INVALID_BEFORE",B[B.INVALID_HEREAFTER=5]="INVALID_HEREAFTER",t.CardanoNativeScriptHashDisplayFormat=void 0,(L=t.CardanoNativeScriptHashDisplayFormat||(t.CardanoNativeScriptHashDisplayFormat={}))[L.HIDE=0]="HIDE",L[L.BECH32=1]="BECH32",L[L.POLICY_ID=2]="POLICY_ID",t.CardanoCertificateType=void 0,(q=t.CardanoCertificateType||(t.CardanoCertificateType={}))[q.STAKE_REGISTRATION=0]="STAKE_REGISTRATION",q[q.STAKE_DEREGISTRATION=1]="STAKE_DEREGISTRATION",q[q.STAKE_DELEGATION=2]="STAKE_DELEGATION",q[q.STAKE_POOL_REGISTRATION=3]="STAKE_POOL_REGISTRATION",t.CardanoPoolRelayType=void 0,(j=t.CardanoPoolRelayType||(t.CardanoPoolRelayType={}))[j.SINGLE_HOST_IP=0]="SINGLE_HOST_IP",j[j.SINGLE_HOST_NAME=1]="SINGLE_HOST_NAME",j[j.MULTIPLE_HOST_NAME=2]="MULTIPLE_HOST_NAME",t.CardanoTxAuxiliaryDataSupplementType=void 0,(F=t.CardanoTxAuxiliaryDataSupplementType||(t.CardanoTxAuxiliaryDataSupplementType={}))[F.NONE=0]="NONE",F[F.CATALYST_REGISTRATION_SIGNATURE=1]="CATALYST_REGISTRATION_SIGNATURE",t.CardanoTxSigningMode=void 0,(U=t.CardanoTxSigningMode||(t.CardanoTxSigningMode={}))[U.ORDINARY_TRANSACTION=0]="ORDINARY_TRANSACTION",U[U.POOL_REGISTRATION_AS_OWNER=1]="POOL_REGISTRATION_AS_OWNER",U[U.MULTISIG_TRANSACTION=2]="MULTISIG_TRANSACTION",t.CardanoTxWitnessType=void 0,(z=t.CardanoTxWitnessType||(t.CardanoTxWitnessType={}))[z.BYRON_WITNESS=0]="BYRON_WITNESS",z[z.SHELLEY_WITNESS=1]="SHELLEY_WITNESS",t.FailureType=void 0,(H=t.FailureType||(t.FailureType={}))[H.Failure_UnexpectedMessage=1]="Failure_UnexpectedMessage",H[H.Failure_ButtonExpected=2]="Failure_ButtonExpected",H[H.Failure_DataError=3]="Failure_DataError",H[H.Failure_ActionCancelled=4]="Failure_ActionCancelled",H[H.Failure_PinExpected=5]="Failure_PinExpected",H[H.Failure_PinCancelled=6]="Failure_PinCancelled",H[H.Failure_PinInvalid=7]="Failure_PinInvalid",H[H.Failure_InvalidSignature=8]="Failure_InvalidSignature",H[H.Failure_ProcessError=9]="Failure_ProcessError",H[H.Failure_NotEnoughFunds=10]="Failure_NotEnoughFunds",H[H.Failure_NotInitialized=11]="Failure_NotInitialized",H[H.Failure_PinMismatch=12]="Failure_PinMismatch",H[H.Failure_WipeCodeMismatch=13]="Failure_WipeCodeMismatch",H[H.Failure_InvalidSession=14]="Failure_InvalidSession",H[H.Failure_FirmwareError=99]="Failure_FirmwareError",t.Enum_ButtonRequestType=void 0,($=t.Enum_ButtonRequestType||(t.Enum_ButtonRequestType={}))[$.ButtonRequest_Other=1]="ButtonRequest_Other",$[$.ButtonRequest_FeeOverThreshold=2]="ButtonRequest_FeeOverThreshold",$[$.ButtonRequest_ConfirmOutput=3]="ButtonRequest_ConfirmOutput",$[$.ButtonRequest_ResetDevice=4]="ButtonRequest_ResetDevice",$[$.ButtonRequest_ConfirmWord=5]="ButtonRequest_ConfirmWord",$[$.ButtonRequest_WipeDevice=6]="ButtonRequest_WipeDevice",$[$.ButtonRequest_ProtectCall=7]="ButtonRequest_ProtectCall",$[$.ButtonRequest_SignTx=8]="ButtonRequest_SignTx",$[$.ButtonRequest_FirmwareCheck=9]="ButtonRequest_FirmwareCheck",$[$.ButtonRequest_Address=10]="ButtonRequest_Address",$[$.ButtonRequest_PublicKey=11]="ButtonRequest_PublicKey",$[$.ButtonRequest_MnemonicWordCount=12]="ButtonRequest_MnemonicWordCount",$[$.ButtonRequest_MnemonicInput=13]="ButtonRequest_MnemonicInput",$[$._Deprecated_ButtonRequest_PassphraseType=14]="_Deprecated_ButtonRequest_PassphraseType",$[$.ButtonRequest_UnknownDerivationPath=15]="ButtonRequest_UnknownDerivationPath",$[$.ButtonRequest_RecoveryHomepage=16]="ButtonRequest_RecoveryHomepage",$[$.ButtonRequest_Success=17]="ButtonRequest_Success",$[$.ButtonRequest_Warning=18]="ButtonRequest_Warning",$[$.ButtonRequest_PassphraseEntry=19]="ButtonRequest_PassphraseEntry",$[$.ButtonRequest_PinEntry=20]="ButtonRequest_PinEntry",t.Enum_PinMatrixRequestType=void 0,(G=t.Enum_PinMatrixRequestType||(t.Enum_PinMatrixRequestType={}))[G.PinMatrixRequestType_Current=1]="PinMatrixRequestType_Current",G[G.PinMatrixRequestType_NewFirst=2]="PinMatrixRequestType_NewFirst",G[G.PinMatrixRequestType_NewSecond=3]="PinMatrixRequestType_NewSecond",G[G.PinMatrixRequestType_WipeCodeFirst=4]="PinMatrixRequestType_WipeCodeFirst",G[G.PinMatrixRequestType_WipeCodeSecond=5]="PinMatrixRequestType_WipeCodeSecond",G[G.PinMatrixRequestType_BackupFirst=6]="PinMatrixRequestType_BackupFirst",G[G.PinMatrixRequestType_BackupSecond=7]="PinMatrixRequestType_BackupSecond",t.EthereumDataType=void 0,(W=t.EthereumDataType||(t.EthereumDataType={}))[W.UINT=1]="UINT",W[W.INT=2]="INT",W[W.BYTES=3]="BYTES",W[W.STRING=4]="STRING",W[W.BOOL=5]="BOOL",W[W.ADDRESS=6]="ADDRESS",W[W.ARRAY=7]="ARRAY",W[W.STRUCT=8]="STRUCT",t.Enum_BackupType=void 0,(V=t.Enum_BackupType||(t.Enum_BackupType={}))[V.Bip39=0]="Bip39",V[V.Slip39_Basic=1]="Slip39_Basic",V[V.Slip39_Advanced=2]="Slip39_Advanced",t.Enum_SafetyCheckLevel=void 0,(K=t.Enum_SafetyCheckLevel||(t.Enum_SafetyCheckLevel={}))[K.Strict=0]="Strict",K[K.PromptAlways=1]="PromptAlways",K[K.PromptTemporarily=2]="PromptTemporarily",t.Enum_Capability=void 0,(Y=t.Enum_Capability||(t.Enum_Capability={}))[Y.Capability_Bitcoin=1]="Capability_Bitcoin",Y[Y.Capability_Bitcoin_like=2]="Capability_Bitcoin_like",Y[Y.Capability_Binance=3]="Capability_Binance",Y[Y.Capability_Cardano=4]="Capability_Cardano",Y[Y.Capability_Crypto=5]="Capability_Crypto",Y[Y.Capability_EOS=6]="Capability_EOS",Y[Y.Capability_Ethereum=7]="Capability_Ethereum",Y[Y.Capability_Lisk=8]="Capability_Lisk",Y[Y.Capability_Monero=9]="Capability_Monero",Y[Y.Capability_NEM=10]="Capability_NEM",Y[Y.Capability_Ripple=11]="Capability_Ripple",Y[Y.Capability_Stellar=12]="Capability_Stellar",Y[Y.Capability_Tezos=13]="Capability_Tezos",Y[Y.Capability_U2F=14]="Capability_U2F",Y[Y.Capability_Shamir=15]="Capability_Shamir",Y[Y.Capability_ShamirGroups=16]="Capability_ShamirGroups",Y[Y.Capability_PassphraseEntry=17]="Capability_PassphraseEntry",t.ExportType=void 0,(X=t.ExportType||(t.ExportType={}))[X.SeedEncExportType_NO=0]="SeedEncExportType_NO",X[X.SeedEncExportType_YES=1]="SeedEncExportType_YES",X[X.MnemonicPlainExportType_YES=2]="MnemonicPlainExportType_YES",t.SdProtectOperationType=void 0,(Z=t.SdProtectOperationType||(t.SdProtectOperationType={}))[Z.DISABLE=0]="DISABLE",Z[Z.ENABLE=1]="ENABLE",Z[Z.REFRESH=2]="REFRESH",t.RecoveryDeviceType=void 0,(J=t.RecoveryDeviceType||(t.RecoveryDeviceType={}))[J.RecoveryDeviceType_ScrambledWords=0]="RecoveryDeviceType_ScrambledWords",J[J.RecoveryDeviceType_Matrix=1]="RecoveryDeviceType_Matrix",t.Enum_WordRequestType=void 0,(Q=t.Enum_WordRequestType||(t.Enum_WordRequestType={}))[Q.WordRequestType_Plain=0]="WordRequestType_Plain",Q[Q.WordRequestType_Matrix9=1]="WordRequestType_Matrix9",Q[Q.WordRequestType_Matrix6=2]="WordRequestType_Matrix6",t.SeedRequestType=void 0,(ee=t.SeedRequestType||(t.SeedRequestType={}))[ee.SeedRequestType_Gen=0]="SeedRequestType_Gen",ee[ee.SeedRequestType_EncExport=1]="SeedRequestType_EncExport",ee[ee.SeedRequestType_EncImport=2]="SeedRequestType_EncImport",t.WL_OperationType=void 0,(te=t.WL_OperationType||(t.WL_OperationType={}))[te.WL_OperationType_Add=0]="WL_OperationType_Add",te[te.WL_OperationType_Delete=1]="WL_OperationType_Delete",te[te.WL_OperationType_Inquire=2]="WL_OperationType_Inquire",t.ResourceType=void 0,(re=t.ResourceType||(t.ResourceType={}))[re.WallPaper=0]="WallPaper",re[re.Nft=1]="Nft",t.NEMMosaicLevy=void 0,(ie=t.NEMMosaicLevy||(t.NEMMosaicLevy={}))[ie.MosaicLevy_Absolute=1]="MosaicLevy_Absolute",ie[ie.MosaicLevy_Percentile=2]="MosaicLevy_Percentile",t.NEMSupplyChangeType=void 0,(ne=t.NEMSupplyChangeType||(t.NEMSupplyChangeType={}))[ne.SupplyChange_Increase=1]="SupplyChange_Increase",ne[ne.SupplyChange_Decrease=2]="SupplyChange_Decrease",t.NEMModificationType=void 0,(se=t.NEMModificationType||(t.NEMModificationType={}))[se.CosignatoryModification_Add=1]="CosignatoryModification_Add",se[se.CosignatoryModification_Delete=2]="CosignatoryModification_Delete",t.NEMImportanceTransferMode=void 0,(oe=t.NEMImportanceTransferMode||(t.NEMImportanceTransferMode={}))[oe.ImportanceTransfer_Activate=1]="ImportanceTransfer_Activate",oe[oe.ImportanceTransfer_Deactivate=2]="ImportanceTransfer_Deactivate",t.StellarAssetType=void 0,(ae=t.StellarAssetType||(t.StellarAssetType={}))[ae.NATIVE=0]="NATIVE",ae[ae.ALPHANUM4=1]="ALPHANUM4",ae[ae.ALPHANUM12=2]="ALPHANUM12",t.StellarMemoType=void 0,(de=t.StellarMemoType||(t.StellarMemoType={}))[de.NONE=0]="NONE",de[de.TEXT=1]="TEXT",de[de.ID=2]="ID",de[de.HASH=3]="HASH",de[de.RETURN=4]="RETURN",t.StellarSignerType=void 0,(ue=t.StellarSignerType||(t.StellarSignerType={}))[ue.ACCOUNT=0]="ACCOUNT",ue[ue.PRE_AUTH=1]="PRE_AUTH",ue[ue.HASH=2]="HASH",t.TezosContractType=void 0,(le=t.TezosContractType||(t.TezosContractType={}))[le.Implicit=0]="Implicit",le[le.Originated=1]="Originated",t.TezosBallotType=void 0,(ce=t.TezosBallotType||(t.TezosBallotType={}))[ce.Yay=0]="Yay",ce[ce.Nay=1]="Nay",ce[ce.Pass=2]="Pass",t.CommandFlags=void 0,(pe=t.CommandFlags||(t.CommandFlags={}))[pe.Default=0]="Default",pe[pe.Factory_Only=1]="Factory_Only";var fe=Object.freeze({__proto__:null,get BinanceOrderType(){return t.BinanceOrderType},get BinanceOrderSide(){return t.BinanceOrderSide},get BinanceTimeInForce(){return t.BinanceTimeInForce},get Enum_InputScriptType(){return t.Enum_InputScriptType},get Enum_OutputScriptType(){return t.Enum_OutputScriptType},get DecredStakingSpendType(){return t.DecredStakingSpendType},get AmountUnit(){return t.AmountUnit},get Enum_RequestType(){return t.Enum_RequestType},get CardanoDerivationType(){return t.CardanoDerivationType},get CardanoAddressType(){return t.CardanoAddressType},get CardanoNativeScriptType(){return t.CardanoNativeScriptType},get CardanoNativeScriptHashDisplayFormat(){return t.CardanoNativeScriptHashDisplayFormat},get CardanoCertificateType(){return t.CardanoCertificateType},get CardanoPoolRelayType(){return t.CardanoPoolRelayType},get CardanoTxAuxiliaryDataSupplementType(){return t.CardanoTxAuxiliaryDataSupplementType},get CardanoTxSigningMode(){return t.CardanoTxSigningMode},get CardanoTxWitnessType(){return t.CardanoTxWitnessType},get FailureType(){return t.FailureType},get Enum_ButtonRequestType(){return t.Enum_ButtonRequestType},get Enum_PinMatrixRequestType(){return t.Enum_PinMatrixRequestType},get EthereumDataType(){return t.EthereumDataType},get Enum_BackupType(){return t.Enum_BackupType},get Enum_SafetyCheckLevel(){return t.Enum_SafetyCheckLevel},get Enum_Capability(){return t.Enum_Capability},get ExportType(){return t.ExportType},get SdProtectOperationType(){return t.SdProtectOperationType},get RecoveryDeviceType(){return t.RecoveryDeviceType},get Enum_WordRequestType(){return t.Enum_WordRequestType},get SeedRequestType(){return t.SeedRequestType},get WL_OperationType(){return t.WL_OperationType},get ResourceType(){return t.ResourceType},get NEMMosaicLevy(){return t.NEMMosaicLevy},get NEMSupplyChangeType(){return t.NEMSupplyChangeType},get NEMModificationType(){return t.NEMModificationType},get NEMImportanceTransferMode(){return t.NEMImportanceTransferMode},get StellarAssetType(){return t.StellarAssetType},get StellarMemoType(){return t.StellarMemoType},get StellarSignerType(){return t.StellarSignerType},get TezosContractType(){return t.TezosContractType},get TezosBallotType(){return t.TezosBallotType},get CommandFlags(){return t.CommandFlags}});u.util.Long=l,u.configure();var ye={check:he,buildOne:function(e,t,r){const{Message:i,messageType:n}=b(e,t);return E(v(i,r),{addTrezorHeaders:!1,chunked:!1,messageType:n})},buildBuffers:(e,t,r)=>{const i=T(e,t,r),n=[];for(const e of i){const t=new c.default(64);t.writeByte(63),t.append(e),t.reset(),n.push(t)}return n},buildEncodeBuffers:T,receiveOne:function(e,t){const r=c.default.wrap(t,"hex"),{typeId:i,buffer:n}=_(r),{Message:s,messageName:o}=((e,t)=>{const r=e.lookupEnum("MessageType").valuesById[t].replace("MessageType_","");return{Message:e.lookupType(r),messageName:r}})(e,i),a=((e,t)=>{const r=t.toBuffer(),i=new Uint8Array(r),n=e.decode(i);return y(n,n.$type.fields)})(s,n);return{message:a,type:o}},parseConfigure:function(e){return"string"==typeof e?u.Root.fromJSON(JSON.parse(e)):u.Root.fromJSON(e)},decodeProtocol:w};t.BUFFER_SIZE=63,t.COMMON_HEADER_SIZE=6,t.HEADER_SIZE=8,t.MESSAGE_HEADER_BYTE=35,t.MESSAGE_TOP_CHAR=63,t.Messages=fe,t.default=ye},8402:(e,t)=>{"use strict";function r(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))}Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{constructor(e){var t;super(),this.errorCode=n.UnknownError,this.message="",this.params={};const r=s;if(this.message=r[n.UnknownError],"string"==typeof e)this.errorCode=n.UnknownError,this.message=e;else{const n=null!==(t=e.message||r[e.errorCode])&&void 0!==t?t:"";n&&(this.message=(o=e,"string"!=typeof(i=n)?i:i.replace(/\{([^}]+)\}/g,((e,t)=>o[t]||"?")))),this.params=e.params,this.errorCode=e.errorCode}var i,o;this.name="HardwareError"}}const n={UnknownError:0,DeviceFwException:101,DeviceUnexpectedMode:102,DeviceListNotInitialized:103,SelectDevice:104,DeviceNotFound:105,DeviceInitializeFailed:106,DeviceInterruptedFromOutside:107,DeviceUnexpectedBootloaderMode:108,DeviceInterruptedFromUser:109,DeviceCheckDeviceIdError:110,DeviceNotSupportPassphrase:111,DeviceCheckPassphraseStateError:112,DeviceNotOpenedPassphrase:113,DeviceOpenedPassphrase:114,NotInitialized:200,IFrameNotInitialized:300,IFrameAleradyInitialized:301,IFrameLoadFail:302,IframeTimeout:303,IframeBlocked:304,CallMethodError:400,CallMethodNotResponse:404,CallMethodInvalidParameter:405,FirmwareUpdateDownloadFailed:406,CallMethodNeedUpgradeFirmware:407,CallMethodDeprecated:408,FirmwareUpdateLimitOneDevice:409,FirmwareUpdateManuallyEnterBoot:410,FirmwareUpdateAutoEnterBootFailure:411,NewFirmwareUnRelease:412,NetworkError:500,TransportNotConfigured:600,TransportCallInProgress:601,TransportNotFound:602,TransportInvalidProtobuf:603,BleScanError:700,BlePermissionError:701,BleLocationError:702,BleRequiredUUID:703,BleConnectedError:704,BleDeviceNotBonded:705,BleServiceNotFound:706,BleCharacteristicNotFound:707,BleMonitorError:708,BleCharacteristicNotifyError:709,BleWriteCharacteristicError:710,BleAlreadyConnected:711,BleLocationServicesDisabled:712,BleTimeoutError:713,RuntimeError:800,PinInvalid:801,PinCancelled:802,ActionCancelled:803,FirmwareError:804,ResponseUnexpectTypeError:805,BridgeNetworkError:806,BridgeTimeoutError:807,BridgeNotInstalled:808,PollingTimeout:809,PollingStop:810,BlindSignDisabled:811,UnexpectPassphrase:812},s={[n.UnknownError]:"Unknown error occurred. Check message property.",[n.DeviceFwException]:"Firmware version mismatch",[n.DeviceUnexpectedMode]:"Device unexpected mode",[n.DeviceListNotInitialized]:"Device list is not initialized",[n.SelectDevice]:"Please select the connected device",[n.DeviceNotFound]:"Device not found",[n.DeviceInitializeFailed]:"Device initialization failed",[n.DeviceInterruptedFromOutside]:"Device interrupted",[n.DeviceInterruptedFromUser]:"Device interrupted",[n.DeviceUnexpectedBootloaderMode]:"Device should be in bootloader mode",[n.DeviceCheckDeviceIdError]:"Device Id in the features is not same.",[n.DeviceNotSupportPassphrase]:"Device not support passphrase",[n.DeviceCheckPassphraseStateError]:"Device passphrase state error",[n.DeviceNotOpenedPassphrase]:"Device not opened passphrase",[n.DeviceOpenedPassphrase]:"Device opened passphrase",[n.NotInitialized]:"Not initialized",[n.IFrameNotInitialized]:"IFrame not initialized",[n.IFrameAleradyInitialized]:"IFrame alerady initialized",[n.IFrameLoadFail]:"IFrame load fail",[n.IframeTimeout]:"init iframe time out",[n.IframeBlocked]:"IFrame blocked",[n.CallMethodError]:"Runtime errors during method execution",[n.CallMethodNotResponse]:"Method does not responding",[n.CallMethodInvalidParameter]:"Call method invalid parameter",[n.FirmwareUpdateDownloadFailed]:"Firmware update download failed",[n.CallMethodNeedUpgradeFirmware]:"Call method need upgrade firmware",[n.CallMethodDeprecated]:"Call method is deprecated",[n.FirmwareUpdateLimitOneDevice]:"Only one device can be connected during firmware upgrade",[n.FirmwareUpdateManuallyEnterBoot]:"You need to manually enter boot",[n.FirmwareUpdateAutoEnterBootFailure]:"Description Failed to automatically enter boot",[n.NewFirmwareUnRelease]:"new firmware has not been released yet",[n.NetworkError]:"Network request error",[n.TransportNotConfigured]:"Transport not configured",[n.TransportCallInProgress]:"Transport call in progress",[n.TransportNotFound]:"Transport not found",[n.TransportInvalidProtobuf]:"Transport invalid protobuf",[n.BleScanError]:"BLE scan error",[n.BlePermissionError]:"Bluetooth required to be turned on",[n.BleLocationError]:"Location permissions for the application are not available",[n.BleRequiredUUID]:"uuid is required",[n.BleConnectedError]:"connected error is always runtime error",[n.BleDeviceNotBonded]:"device is not bonded",[n.BleServiceNotFound]:"BLEServiceNotFound: service not found",[n.BleCharacteristicNotFound]:"BLEServiceNotFound: service not found",[n.BleMonitorError]:"Monitor Error: characteristic not found",[n.BleCharacteristicNotifyError]:"Characteristic Notify Error",[n.BleWriteCharacteristicError]:"Write Characteristic Error",[n.BleAlreadyConnected]:"Already connected to device",[n.BleLocationServicesDisabled]:"Location Services disabled",[n.BleTimeoutError]:"The connection has timed out unexpectedly.",[n.RuntimeError]:"Runtime error",[n.PinInvalid]:"Pin invalid",[n.PinCancelled]:"Pin cancelled",[n.ActionCancelled]:"Action cancelled by user",[n.FirmwareError]:"Firmware installation failed",[n.ResponseUnexpectTypeError]:"Response type is not expected",[n.BridgeNetworkError]:"Bridge network error",[n.BridgeTimeoutError]:"Bridge network timeout",[n.BridgeNotInstalled]:"Bridge not installed",[n.PollingTimeout]:"Polling timeout",[n.PollingStop]:"Polling stop",[n.BlindSignDisabled]:"Please confirm the BlindSign enabled",[n.UnexpectPassphrase]:"Unexpect passphrase"},o=(e,t,r)=>new i("string"==typeof e?e:{errorCode:e,message:null!=t?t:"",params:r}),a=e=>e&&e.error instanceof i?{error:e.error.message,code:e.error.errorCode,params:e.error.params}:e&&e.error instanceof Error?{error:e.error.message,code:e.error.code}:e,d=e=>{for(const t of Object.values(n))if(s[t]===e)return o(t);return new i(e)};var u=Object.freeze({__proto__:null,HardwareError:i,HardwareErrorCode:n,HardwareErrorCodeMessage:s,TypedError:o,serializeError:a,CreateErrorByMessage:d});t.CreateErrorByMessage=d,t.ERRORS=u,t.HardwareError=i,t.HardwareErrorCode=n,t.HardwareErrorCodeMessage=s,t.TypedError=o,t.createDeferred=function(e,t){let i,n=e=>{},s=e=>{};const o=new Promise(((t,o)=>r(this,void 0,void 0,(function*(){if(n=t,s=o,"function"==typeof e)try{yield e()}catch(e){o(e)}"string"==typeof e&&(i=e)}))));return{id:i,data:t,resolve:n,reject:s,promise:o}},t.serializeError=a},5766:(e,t)=>{"use strict";t.byteLength=function(e){var t=d(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,s=d(e),o=s[0],a=s[1],u=new n(function(e,t,r){return 3*(t+r)/4-r}(0,o,a)),l=0,c=a>0?o-4:o;for(r=0;r<c;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s=[],o=16383,a=0,d=i-n;a<d;a+=o)s.push(u(e,a,a+o>d?d:a+o));1===n?(t=e[i-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[i-2]<<8)+e[i-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return s.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)r[o]=s[o],i[s.charCodeAt(o)]=o;function d(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,i){for(var n,s,o=[],a=t;a<i;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[(s=n)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},6391:function(e,t,r){var i;!function(n){"use strict";var s,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,d=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",c=1e14,p=14,h=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,i=1,n=e.length,s=e[0]+"";i<n;){for(t=e[i++]+"",r=p-t.length;r--;t="0"+t);s+=t}for(n=s.length;48===s.charCodeAt(--n););return s.slice(0,n+1||1)}function b(e,t){var r,i,n=e.c,s=t.c,o=e.s,a=t.s,d=e.e,u=t.e;if(!o||!a)return null;if(r=n&&!n[0],i=s&&!s[0],r||i)return r?i?0:-a:o;if(o!=a)return o;if(r=o<0,i=d==u,!n||!s)return i?0:!n^r?1:-1;if(!i)return d>u^r?1:-1;for(a=(d=n.length)<(u=s.length)?d:u,o=0;o<a;o++)if(n[o]!=s[o])return n[o]>s[o]^r?1:-1;return d==u?0:d>u^r?1:-1}function _(e,t,r,i){if(e<t||e>r||e!==d(e))throw Error(u+(i||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return m(e.e/p)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function T(e,t,r){var i,n;if(t<0){for(n=r+".";++t;n+=r);e=n+e}else if(++t>(i=e.length)){for(n=r,t-=i;--t;n+=r);e+=n}else t<i&&(e=e.slice(0,t)+"."+e.slice(t));return e}s=function e(t){var r,i,n,s,S,R,O,I,x,A,C=$.prototype={constructor:$,toString:null,valueOf:null},k=new $(1),M=20,N=4,P=-7,D=21,B=-1e7,L=1e7,q=!1,j=1,F=0,U={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function $(e,t){var r,s,a,u,c,f,y,g,m=this;if(!(m instanceof $))return new $(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>L?m.c=m.e=null:e.e<B?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((f="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,c=e;c>=10;c/=10,u++);return void(u>L?m.c=m.e=null:(m.e=u,m.c=[e]))}g=String(e)}else{if(!o.test(g=String(e)))return n(m,g,f);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(u<0&&(u=c),u+=+g.slice(c+1),g=g.substring(0,c)):u<0&&(u=g.length)}else{if(_(t,2,z.length,"Base"),10==t&&H)return K(m=new $(e),M+m.e+1,N);if(g=String(e),f="number"==typeof e){if(0*e!=0)return n(m,g,f,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,$.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=z.slice(0,t),u=c=0,y=g.length;c<y;c++)if(r.indexOf(s=g.charAt(c))<0){if("."==s){if(c>u){u=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,u=0;continue}return n(m,String(e),f,t)}f=!1,(u=(g=i(g,t,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(c=0;48===g.charCodeAt(c);c++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(c,++y)){if(y-=c,f&&$.DEBUG&&y>15&&(e>h||e!==d(e)))throw Error(l+m.s*e);if((u=u-c-1)>L)m.c=m.e=null;else if(u<B)m.c=[m.e=0];else{if(m.e=u,m.c=[],c=(u+1)%p,u<0&&(c+=p),c<y){for(c&&m.c.push(+g.slice(0,c)),y-=p;c<y;)m.c.push(+g.slice(c,c+=p));c=p-(g=g.slice(c)).length}else c-=y;for(;c--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function G(e,t,r,i){var n,s,o,a,d;if(null==r?r=N:_(r,0,8),!e.c)return e.toString();if(n=e.c[0],o=e.e,null==t)d=v(e.c),d=1==i||2==i&&(o<=P||o>=D)?E(d,o):T(d,o,"0");else if(s=(e=K(new $(e),t,r)).e,a=(d=v(e.c)).length,1==i||2==i&&(t<=s||s<=P)){for(;a<t;d+="0",a++);d=E(d,s)}else if(t-=o,d=T(d,s,"0"),s+1>a){if(--t>0)for(d+=".";t--;d+="0");}else if((t+=s-a)>0)for(s+1==a&&(d+=".");t--;d+="0");return e.s<0&&n?"-"+d:d}function W(e,t){for(var r,i=1,n=new $(e[0]);i<e.length;i++){if(!(r=new $(e[i])).s){n=r;break}t.call(n,r)&&(n=r)}return n}function V(e,t,r){for(var i=1,n=t.length;!t[--n];t.pop());for(n=t[0];n>=10;n/=10,i++);return(r=i+r*p-1)>L?e.c=e.e=null:r<B?e.c=[e.e=0]:(e.e=r,e.c=t),e}function K(e,t,r,i){var n,s,o,u,l,h,y,g=e.c,m=f;if(g){e:{for(n=1,u=g[0];u>=10;u/=10,n++);if((s=t-n)<0)s+=p,o=t,y=(l=g[h=0])/m[n-o-1]%10|0;else if((h=a((s+1)/p))>=g.length){if(!i)break e;for(;g.length<=h;g.push(0));l=y=0,n=1,o=(s%=p)-p+1}else{for(l=u=g[h],n=1;u>=10;u/=10,n++);y=(o=(s%=p)-p+n)<0?0:l/m[n-o-1]%10|0}if(i=i||t<0||null!=g[h+1]||(o<0?l:l%m[n-o-1]),i=r<4?(y||i)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||i||6==r&&(s>0?o>0?l/m[n-o]:0:g[h-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,i?(t-=e.e+1,g[0]=m[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==s?(g.length=h,u=1,h--):(g.length=h+1,u=m[p-s],g[h]=o>0?d(l/m[n-o]%m[o])*u:0),i)for(;;){if(0==h){for(s=1,o=g[0];o>=10;o/=10,s++);for(o=g[0]+=u,u=1;o>=10;o/=10,u++);s!=u&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[h]+=u,g[h]!=c)break;g[h--]=0,u=1}for(s=g.length;0===g[--s];g.pop());}e.e>L?e.c=e.e=null:e.e<B&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=v(e.c),t=r<=P||r>=D?E(t,r):T(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(_(r=e[t],0,g,t),M=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(_(r=e[t],0,8,t),N=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(_(r[0],-g,0,t),_(r[1],0,g,t),P=r[0],D=r[1]):(_(r,-g,g,t),P=-(D=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)_(r[0],-g,-1,t),_(r[1],1,g,t),B=r[0],L=r[1];else{if(_(r,-g,g,t),!r)throw Error(u+t+" cannot be zero: "+r);B=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw q=!r,Error(u+"crypto unavailable");q=r}else q=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(_(r=e[t],0,9,t),j=r),e.hasOwnProperty(t="POW_PRECISION")&&(_(r=e[t],0,g,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);U=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);H="0123456789"==r.slice(0,10),z=r}}return{DECIMAL_PLACES:M,ROUNDING_MODE:N,EXPONENTIAL_AT:[P,D],RANGE:[B,L],CRYPTO:q,MODULO_MODE:j,POW_PRECISION:F,FORMAT:U,ALPHABET:z}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,i=e.c,n=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(i)){if((1===s||-1===s)&&n>=-g&&n<=g&&n===d(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break e}if((t=(n+1)%p)<1&&(t+=p),String(i[0]).length==t){for(t=0;t<i.length;t++)if((r=i[t])<0||r>=c||r!==d(r))break e;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(u+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return W(arguments,C.lt)},$.minimum=$.min=function(){return W(arguments,C.gt)},$.random=(s=9007199254740992,S=Math.random()*s&2097151?function(){return d(Math.random()*s)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,i,n,s,o=0,l=[],c=new $(k);if(null==e?e=M:_(e,0,g),n=a(e/p),q)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(n*=2));o<n;)(s=131072*t[o]+(t[o+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[o]=r[0],t[o+1]=r[1]):(l.push(s%1e14),o+=2);o=n/2}else{if(!crypto.randomBytes)throw q=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(n*=7);o<n;)(s=281474976710656*(31&t[o])+1099511627776*t[o+1]+4294967296*t[o+2]+16777216*t[o+3]+(t[o+4]<<16)+(t[o+5]<<8)+t[o+6])>=9e15?crypto.randomBytes(7).copy(t,o):(l.push(s%1e14),o+=7);o=n/7}if(!q)for(;o<n;)(s=S())<9e15&&(l[o++]=s%1e14);for(n=l[--o],e%=p,n&&e&&(s=f[p-e],l[o]=d(n/s)*s);0===l[o];l.pop(),o--);if(o<0)l=[i=0];else{for(i=-1;0===l[0];l.splice(0,1),i-=p);for(o=1,s=l[0];s>=10;s/=10,o++);o<p&&(i-=p-o)}return c.e=i,c.c=l,c}),$.sum=function(){for(var e=1,t=arguments,r=new $(t[0]);e<t.length;)r=r.plus(t[e++]);return r},i=function(){var e="0123456789";function t(e,t,r,i){for(var n,s,o=[0],a=0,d=e.length;a<d;){for(s=o.length;s--;o[s]*=t);for(o[0]+=i.indexOf(e.charAt(a++)),n=0;n<o.length;n++)o[n]>r-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}return function(i,n,s,o,a){var d,u,l,c,p,h,f,y,g=i.indexOf("."),m=M,b=N;for(g>=0&&(c=F,F=0,i=i.replace(".",""),h=(y=new $(n)).pow(i.length-g),F=c,y.c=t(T(v(h.c),h.e,"0"),10,s,e),y.e=y.c.length),l=c=(f=t(i,n,s,a?(d=z,e):(d=e,z))).length;0==f[--c];f.pop());if(!f[0])return d.charAt(0);if(g<0?--l:(h.c=f,h.e=l,h.s=o,f=(h=r(h,y,m,b,s)).c,p=h.r,l=h.e),g=f[u=l+m+1],c=s/2,p=p||u<0||null!=f[u+1],p=b<4?(null!=g||p)&&(0==b||b==(h.s<0?3:2)):g>c||g==c&&(4==b||p||6==b&&1&f[u-1]||b==(h.s<0?8:7)),u<1||!f[0])i=p?T(d.charAt(1),-m,d.charAt(0)):d.charAt(0);else{if(f.length=u,p)for(--s;++f[--u]>s;)f[u]=0,u||(++l,f=[1].concat(f));for(c=f.length;!f[--c];);for(g=0,i="";g<=c;i+=d.charAt(f[g++]));i=T(i,l,d.charAt(0))}return i}}(),r=function(){function e(e,t,r){var i,n,s,o,a=0,d=e.length,u=t%y,l=t/y|0;for(e=e.slice();d--;)a=((n=u*(s=e[d]%y)+(i=l*s+(o=e[d]/y|0)*u)%y*y+a)/r|0)+(i/y|0)+l*o,e[d]=n%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;n<r;n++)if(e[n]!=t[n]){s=e[n]>t[n]?1:-1;break}return s}function r(e,t,r,i){for(var n=0;r--;)e[r]-=n,n=e[r]<t[r]?1:0,e[r]=n*i+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,n,s,o,a){var u,l,h,f,y,g,v,b,_,w,E,T,S,R,O,I,x,A=i.s==n.s?1:-1,C=i.c,k=n.c;if(!(C&&C[0]&&k&&k[0]))return new $(i.s&&n.s&&(C?!k||C[0]!=k[0]:k)?C&&0==C[0]||!k?0*A:A/0:NaN);for(_=(b=new $(A)).c=[],A=s+(l=i.e-n.e)+1,a||(a=c,l=m(i.e/p)-m(n.e/p),A=A/p|0),h=0;k[h]==(C[h]||0);h++);if(k[h]>(C[h]||0)&&l--,A<0)_.push(1),f=!0;else{for(R=C.length,I=k.length,h=0,A+=2,(y=d(a/(k[0]+1)))>1&&(k=e(k,y,a),C=e(C,y,a),I=k.length,R=C.length),S=I,E=(w=C.slice(0,I)).length;E<I;w[E++]=0);x=k.slice(),x=[0].concat(x),O=k[0],k[1]>=a/2&&O++;do{if(y=0,(u=t(k,w,I,E))<0){if(T=w[0],I!=E&&(T=T*a+(w[1]||0)),(y=d(T/O))>1)for(y>=a&&(y=a-1),v=(g=e(k,y,a)).length,E=w.length;1==t(g,w,v,E);)y--,r(g,I<v?x:k,v,a),v=g.length,u=1;else 0==y&&(u=y=1),v=(g=k.slice()).length;if(v<E&&(g=[0].concat(g)),r(w,g,E,a),E=w.length,-1==u)for(;t(k,w,I,E)<1;)y++,r(w,I<E?x:k,E,a),E=w.length}else 0===u&&(y++,w=[0]);_[h++]=y,w[0]?w[E++]=C[S]||0:(w=[C[S]],E=1)}while((S++<R||null!=w[0])&&A--);f=null!=w[0],_[0]||_.splice(0,1)}if(a==c){for(h=1,A=_[0];A>=10;A/=10,h++);K(b,s+(b.e=h+l*p-1)+1,o,f)}else b.e=l,b.r=+f;return b}}(),R=/^(-?)0([xbo])(?=\w[\w.]*$)/i,O=/^([^.]+)\.$/,I=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,A=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,i){var n,s=r?t:t.replace(A,"");if(x.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(R,(function(e,t,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?e:t})),i&&(n=i,s=s.replace(O,"$1").replace(I,"0.$1")),t!=s))return new $(s,n);if($.DEBUG)throw Error(u+"Not a"+(i?" base "+i:"")+" number: "+t);e.s=null}e.c=e.e=null},C.absoluteValue=C.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},C.comparedTo=function(e,t){return b(this,new $(e,t))},C.decimalPlaces=C.dp=function(e,t){var r,i,n,s=this;if(null!=e)return _(e,0,g),null==t?t=N:_(t,0,8),K(new $(s),e+s.e+1,t);if(!(r=s.c))return null;if(i=((n=r.length-1)-m(this.e/p))*p,n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},C.dividedBy=C.div=function(e,t){return r(this,new $(e,t),M,N)},C.dividedToIntegerBy=C.idiv=function(e,t){return r(this,new $(e,t),0,1)},C.exponentiatedBy=C.pow=function(e,t){var r,i,n,s,o,l,c,h,f=this;if((e=new $(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new $(t)),o=e.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Y(f),o?2-w(e):+Y(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(i=!l&&f.isInteger()&&t.isInteger())&&(f=f.mod(t))}else{if(e.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||o&&f.c[1]>=24e7:f.c[0]<8e13||o&&f.c[0]<=9999975e7)))return s=f.s<0&&w(e)?-0:0,f.e>-1&&(s=1/s),new $(l?1/s:s);F&&(s=a(F/p+2))}for(o?(r=new $(.5),l&&(e.s=1),c=w(e)):c=(n=Math.abs(+Y(e)))%2,h=new $(k);;){if(c){if(!(h=h.times(f)).c)break;s?h.c.length>s&&(h.c.length=s):i&&(h=h.mod(t))}if(n){if(0===(n=d(n/2)))break;c=n%2}else if(K(e=e.times(r),e.e+1,1),e.e>14)c=w(e);else{if(0===(n=+Y(e)))break;c=n%2}f=f.times(f),s?f.c&&f.c.length>s&&(f.c.length=s):i&&(f=f.mod(t))}return i?h:(l&&(h=k.div(h)),t?h.mod(t):s?K(h,F,N,undefined):h)},C.integerValue=function(e){var t=new $(this);return null==e?e=N:_(e,0,8),K(t,t.e+1,e)},C.isEqualTo=C.eq=function(e,t){return 0===b(this,new $(e,t))},C.isFinite=function(){return!!this.c},C.isGreaterThan=C.gt=function(e,t){return b(this,new $(e,t))>0},C.isGreaterThanOrEqualTo=C.gte=function(e,t){return 1===(t=b(this,new $(e,t)))||0===t},C.isInteger=function(){return!!this.c&&m(this.e/p)>this.c.length-2},C.isLessThan=C.lt=function(e,t){return b(this,new $(e,t))<0},C.isLessThanOrEqualTo=C.lte=function(e,t){return-1===(t=b(this,new $(e,t)))||0===t},C.isNaN=function(){return!this.s},C.isNegative=function(){return this.s<0},C.isPositive=function(){return this.s>0},C.isZero=function(){return!!this.c&&0==this.c[0]},C.minus=function(e,t){var r,i,n,s,o=this,a=o.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,o.plus(e);var d=o.e/p,u=e.e/p,l=o.c,h=e.c;if(!d||!u){if(!l||!h)return l?(e.s=-t,e):new $(h?o:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new $(l[0]?o:3==N?-0:0)}if(d=m(d),u=m(u),l=l.slice(),a=d-u){for((s=a<0)?(a=-a,n=l):(u=d,n=h),n.reverse(),t=a;t--;n.push(0));n.reverse()}else for(i=(s=(a=l.length)<(t=h.length))?a:t,a=t=0;t<i;t++)if(l[t]!=h[t]){s=l[t]<h[t];break}if(s&&(n=l,l=h,h=n,e.s=-e.s),(t=(i=h.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=c-1;i>a;){if(l[--i]<h[i]){for(r=i;r&&!l[--r];l[r]=t);--l[r],l[i]+=c}l[i]-=h[i]}for(;0==l[0];l.splice(0,1),--u);return l[0]?V(e,l,u):(e.s=3==N?-1:1,e.c=[e.e=0],e)},C.modulo=C.mod=function(e,t){var i,n,s=this;return e=new $(e,t),!s.c||!e.s||e.c&&!e.c[0]?new $(NaN):!e.c||s.c&&!s.c[0]?new $(s):(9==j?(n=e.s,e.s=1,i=r(s,e,0,3),e.s=n,i.s*=n):i=r(s,e,0,j),(e=s.minus(i.times(e))).c[0]||1!=j||(e.s=s.s),e)},C.multipliedBy=C.times=function(e,t){var r,i,n,s,o,a,d,u,l,h,f,g,v,b,_,w=this,E=w.c,T=(e=new $(e,t)).c;if(!(E&&T&&E[0]&&T[0]))return!w.s||!e.s||E&&!E[0]&&!T||T&&!T[0]&&!E?e.c=e.e=e.s=null:(e.s*=w.s,E&&T?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=m(w.e/p)+m(e.e/p),e.s*=w.s,(d=E.length)<(h=T.length)&&(v=E,E=T,T=v,n=d,d=h,h=n),n=d+h,v=[];n--;v.push(0));for(b=c,_=y,n=h;--n>=0;){for(r=0,f=T[n]%_,g=T[n]/_|0,s=n+(o=d);s>n;)r=((u=f*(u=E[--o]%_)+(a=g*u+(l=E[o]/_|0)*f)%_*_+v[s]+r)/b|0)+(a/_|0)+g*l,v[s--]=u%b;v[s]=r}return r?++i:v.splice(0,1),V(e,v,i)},C.negated=function(){var e=new $(this);return e.s=-e.s||null,e},C.plus=function(e,t){var r,i=this,n=i.s;if(t=(e=new $(e,t)).s,!n||!t)return new $(NaN);if(n!=t)return e.s=-t,i.minus(e);var s=i.e/p,o=e.e/p,a=i.c,d=e.c;if(!s||!o){if(!a||!d)return new $(n/0);if(!a[0]||!d[0])return d[0]?e:new $(a[0]?i:0*n)}if(s=m(s),o=m(o),a=a.slice(),n=s-o){for(n>0?(o=s,r=d):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(t=d.length)<0&&(r=d,d=a,a=r,t=n),n=0;t;)n=(a[--t]=a[t]+d[t]+n)/c|0,a[t]=c===a[t]?0:a[t]%c;return n&&(a=[n].concat(a),++o),V(e,a,o)},C.precision=C.sd=function(e,t){var r,i,n,s=this;if(null!=e&&e!==!!e)return _(e,1,g),null==t?t=N:_(t,0,8),K(new $(s),e,t);if(!(r=s.c))return null;if(i=(n=r.length-1)*p+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return e&&s.e+1>i&&(i=s.e+1),i},C.shiftedBy=function(e){return _(e,-9007199254740991,h),this.times("1e"+e)},C.squareRoot=C.sqrt=function(){var e,t,i,n,s,o=this,a=o.c,d=o.s,u=o.e,l=M+4,c=new $("0.5");if(1!==d||!a||!a[0])return new $(!d||d<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(d=Math.sqrt(+Y(o)))||d==1/0?(((t=v(a)).length+u)%2==0&&(t+="0"),d=Math.sqrt(+t),u=m((u+1)/2)-(u<0||u%2),i=new $(t=d==1/0?"5e"+u:(t=d.toExponential()).slice(0,t.indexOf("e")+1)+u)):i=new $(d+""),i.c[0])for((d=(u=i.e)+l)<3&&(d=0);;)if(s=i,i=c.times(s.plus(r(o,s,l,1))),v(s.c).slice(0,d)===(t=v(i.c)).slice(0,d)){if(i.e<u&&--d,"9999"!=(t=t.slice(d-3,d+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(K(i,i.e+M+2,1),e=!i.times(i).eq(o));break}if(!n&&(K(s,s.e+M+2,0),s.times(s).eq(o))){i=s;break}l+=4,d+=4,n=1}return K(i,i.e+M+1,N,e)},C.toExponential=function(e,t){return null!=e&&(_(e,0,g),e++),G(this,e,t,1)},C.toFixed=function(e,t){return null!=e&&(_(e,0,g),e=e+this.e+1),G(this,e,t)},C.toFormat=function(e,t,r){var i,n=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=U;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(i=n.toFixed(e,t),n.c){var s,o=i.split("."),a=+r.groupSize,d=+r.secondaryGroupSize,l=r.groupSeparator||"",c=o[0],p=o[1],h=n.s<0,f=h?c.slice(1):c,y=f.length;if(d&&(s=a,a=d,d=s,y-=s),a>0&&y>0){for(s=y%a||a,c=f.substr(0,s);s<y;s+=a)c+=l+f.substr(s,a);d>0&&(c+=l+f.slice(s)),h&&(c="-"+c)}i=p?c+(r.decimalSeparator||"")+((d=+r.fractionGroupSize)?p.replace(new RegExp("\\d{"+d+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):p):c}return(r.prefix||"")+i+(r.suffix||"")},C.toFraction=function(e){var t,i,n,s,o,a,d,l,c,h,y,g,m=this,b=m.c;if(null!=e&&(!(d=new $(e)).isInteger()&&(d.c||1!==d.s)||d.lt(k)))throw Error(u+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+Y(d));if(!b)return new $(m);for(t=new $(k),c=i=new $(k),n=l=new $(k),g=v(b),o=t.e=g.length-m.e-1,t.c[0]=f[(a=o%p)<0?p+a:a],e=!e||d.comparedTo(t)>0?o>0?t:c:d,a=L,L=1/0,d=new $(g),l.c[0]=0;h=r(d,t,0,1),1!=(s=i.plus(h.times(n))).comparedTo(e);)i=n,n=s,c=l.plus(h.times(s=c)),l=s,t=d.minus(h.times(s=t)),d=s;return s=r(e.minus(i),n,0,1),l=l.plus(s.times(c)),i=i.plus(s.times(n)),l.s=c.s=m.s,y=r(c,n,o*=2,N).minus(m).abs().comparedTo(r(l,i,o,N).minus(m).abs())<1?[c,n]:[l,i],L=a,y},C.toNumber=function(){return+Y(this)},C.toPrecision=function(e,t){return null!=e&&_(e,1,g),G(this,e,t,2)},C.toString=function(e){var t,r=this,n=r.s,s=r.e;return null===s?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=s<=P||s>=D?E(v(r.c),s):T(v(r.c),s,"0"):10===e&&H?t=T(v((r=K(new $(r),M+s+1,N)).c),r.e,"0"):(_(e,2,z.length,"Base"),t=i(T(v(r.c),s,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},C.valueOf=C.toJSON=function(){return Y(this)},C._isBigNumber=!0,null!=t&&$.set(t),$}(),s.default=s.BigNumber=s,void 0===(i=function(){return s}.call(t,r,t,e))||(e.exports=i)}()},8834:(e,t,r)=>{"use strict";const i=r(5766),n=r(2333),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=function(e){+e!=e&&(e=0);return d.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!d.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let i=a(r);const n=i.write(e,t);n!==r&&(i=i.slice(0,n));return i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return d.from(i,t,r);const n=function(e){if(d.isBuffer(e)){const t=0|f(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||X(e.length)?a(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return d.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),a(e<0?0:0|f(e))}function p(e){const t=e.length<0?0:0|f(e.length),r=a(t);for(let i=0;i<t;i+=1)r[i]=255&e[i];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(i,d.prototype),i}function f(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function y(e,t){if(d.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(n)return i?-1:W(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function v(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=d.from(t,i)),d.isBuffer(t))return 0===t.length?-1:b(e,t,r,i,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,i,n){let s,o=1,a=e.length,d=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,d/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){let i=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===d)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(r+d>a&&(r=a-d),s=r;s>=0;s--){let r=!0;for(let i=0;i<d;i++)if(u(e,s+i)!==u(t,i)){r=!1;break}if(r)return s}return-1}function _(e,t,r,i){r=Number(r)||0;const n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(t.substr(2*o,2),16);if(X(i))return o;e[r+o]=i}return o}function w(e,t,r,i){return K(W(t,e.length-r),e,r,i)}function E(e,t,r,i){return K(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function T(e,t,r,i){return K(V(t),e,r,i)}function S(e,t,r,i){return K(function(e,t){let r,i,n;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function R(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);const i=[];let n=t;for(;n<r;){const t=e[n];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(n+o<=r){let r,i,a,d;switch(o){case 1:t<128&&(s=t);break;case 2:r=e[n+1],128==(192&r)&&(d=(31&t)<<6|63&r,d>127&&(s=d));break;case 3:r=e[n+1],i=e[n+2],128==(192&r)&&128==(192&i)&&(d=(15&t)<<12|(63&r)<<6|63&i,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:r=e[n+1],i=e[n+2],a=e[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(d=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&a,d>65535&&d<1114112&&(s=d))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=I));return r}(i)}t.kMaxLength=o,d.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),d.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}}),d.poolSize=8192,d.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array),d.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},d.allocUnsafe=function(e){return c(e)},d.allocUnsafeSlow=function(e){return c(e)},d.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==d.prototype},d.compare=function(e,t){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,s=Math.min(r,i);n<s;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},d.isEncoding=function(e){switch(String(e).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}},d.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return d.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const i=d.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))n+t.length>i.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(i,n)):Uint8Array.prototype.set.call(i,t,n);else{if(!d.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,n)}n+=t.length}return i},d.byteLength=y,d.prototype._isBuffer=!0,d.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},d.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},d.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},d.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):g.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===d.compare(this,e)},d.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(d.prototype[s]=d.prototype.inspect),d.prototype.compare=function(e,t,r,i,n){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0);const a=Math.min(s,o),u=this.slice(i,n),l=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==l[e]){s=u[e],o=l[e];break}return s<o?-1:o<s?1:0},d.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},d.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},d.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},d.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function x(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function A(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function C(e,t,r){const i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=t;i<r;++i)n+=Z[e[i]];return n}function k(e,t,r){const i=e.slice(t,r);let n="";for(let e=0;e<i.length-1;e+=2)n+=String.fromCharCode(i[e]+256*i[e+1]);return n}function M(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,i,n,s){if(!d.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function P(e,t,r,i,n){z(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function D(e,t,r,i,n){z(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function B(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,s){return t=+t,r>>>=0,s||B(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function q(e,t,r,i,s){return t=+t,r>>>=0,s||B(e,0,r,8),n.write(e,t,r,i,52,8),r+8}d.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,d.prototype),i},d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let i=this[e],n=1,s=0;for(;++s<t&&(n*=256);)i+=this[e+s]*n;return i},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let i=this[e+--t],n=1;for(;t>0&&(n*=256);)i+=this[e+--t]*n;return i},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(i)+(BigInt(n)<<BigInt(32))})),d.prototype.readBigUInt64BE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)})),d.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let i=this[e],n=1,s=0;for(;++s<t&&(n*=256);)i+=this[e+s]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},d.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let i=t,n=1,s=this[e+--i];for(;i>0&&(n*=256);)s+=this[e+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*t)),s},d.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),d.prototype.readBigInt64BE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!1,52,8)},d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t>>>=0,r>>>=0,!i){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=1,s=0;for(this[t]=255&e;++s<r&&(n*=256);)this[t+s]=e/n&255;return t+r},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,r,i){if(e=+e,t>>>=0,r>>>=0,!i){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=r-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+r},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeBigUInt64LE=J((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),d.prototype.writeBigUInt64BE=J((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),d.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}let n=0,s=1,o=0;for(this[t]=255&e;++n<r&&(s*=256);)e<0&&0===o&&0!==this[t+n-1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+r},d.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[t+n]=255&e;--n>=0&&(s*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+r},d.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},d.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeBigInt64LE=J((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),d.prototype.writeBigInt64BE=J((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),d.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},d.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},d.prototype.writeDoubleLE=function(e,t,r){return q(this,e,t,!0,r)},d.prototype.writeDoubleBE=function(e,t,r){return q(this,e,t,!1,r)},d.prototype.copy=function(e,t,r,i){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);const n=i-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),t),n},d.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!d.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const s=d.isBuffer(e)?e:d.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=s[n%o]}return this};const j={};function F(e,t,r){j[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function U(e){let t="",r=e.length;const i="-"===e[0]?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function z(e,t,r,i,n,s){if(e>r||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new j.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||$(t,e.length-(r+1))}(i,n,s)}function H(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){if(Math.floor(e)!==e)throw H(e,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=U(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=U(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function W(e,t){let r;t=t||1/0;const i=e.length;let n=null;const s=[];for(let o=0;o<i;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t}();function J(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},9396:function(e,t,r){var i,n,s;n=[r(6874)],i=function(e){"use strict";var t=function(e,r,n){if(void 0===e&&(e=t.DEFAULT_CAPACITY),void 0===r&&(r=t.DEFAULT_ENDIAN),void 0===n&&(n=t.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");r=!!r,n=!!n}this.buffer=0===e?i:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=r,this.noAssert=n};t.VERSION="5.0.1",t.LITTLE_ENDIAN=!0,t.BIG_ENDIAN=!1,t.DEFAULT_CAPACITY=16,t.DEFAULT_ENDIAN=t.BIG_ENDIAN,t.DEFAULT_NOASSERT=!1,t.Long=e||null;var r=t.prototype;r.__isByteBuffer__,Object.defineProperty(r,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var i=new ArrayBuffer(0),n=String.fromCharCode;function s(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function o(){var e=[],t=[];return function(){if(0===arguments.length)return t.join("")+n.apply(String,e);e.length+arguments.length>1024&&(t.push(n.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function a(e,t,r,i,n){var s,o,a=8*n-i-1,d=(1<<a)-1,u=d>>1,l=-7,c=r?n-1:0,p=r?-1:1,h=e[t+c];for(c+=p,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+c],c+=p,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+c],c+=p,l-=8);if(0===s)s=1-u;else{if(s===d)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=u}return(h?-1:1)*o*Math.pow(2,s-i)}function d(e,t,r,i,n,s){var o,a,d,u=8*s-n-1,l=(1<<u)-1,c=l>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,f=i?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-o))<1&&(o--,d*=2),(t+=o+c>=1?p/d:p*Math.pow(2,1-c))*d>=2&&(o++,d/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(t*d-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[r+h]=255&a,h+=f,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[r+h]=255&o,h+=f,o/=256,u-=8);e[r+h-f]|=128*y}t.accessor=function(){return Uint8Array},t.allocate=function(e,r,i){return new t(e,r,i)},t.concat=function(e,r,i,n){"boolean"!=typeof r&&"string"==typeof r||(n=i,i=r,r=void 0);for(var s,o=0,a=0,d=e.length;a<d;++a)t.isByteBuffer(e[a])||(e[a]=t.wrap(e[a],r)),(s=e[a].limit-e[a].offset)>0&&(o+=s);if(0===o)return new t(0,i,n);var u,l=new t(o,i,n);for(a=0;a<d;)(s=(u=e[a++]).limit-u.offset)<=0||(l.view.set(u.view.subarray(u.offset,u.limit),l.offset),l.offset+=s);return l.limit=l.offset,l.offset=0,l},t.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},t.type=function(){return ArrayBuffer},t.wrap=function(e,i,n,s){if("string"!=typeof i&&(s=n,n=i,i=void 0),"string"==typeof e)switch(void 0===i&&(i="utf8"),i){case"base64":return t.fromBase64(e,n);case"hex":return t.fromHex(e,n);case"binary":return t.fromBinary(e,n);case"utf8":return t.fromUTF8(e,n);case"debug":return t.fromDebug(e,n);default:throw Error("Unsupported encoding: "+i)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");var o;if(t.isByteBuffer(e))return(o=r.clone.call(e)).markedOffset=-1,o;if(e instanceof Uint8Array)o=new t(0,n,s),e.length>0&&(o.buffer=e.buffer,o.offset=e.byteOffset,o.limit=e.byteOffset+e.byteLength,o.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)o=new t(0,n,s),e.byteLength>0&&(o.buffer=e,o.offset=0,o.limit=e.byteLength,o.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");(o=new t(e.length,n,s)).limit=e.length;for(var a=0;a<e.length;++a)o.view[a]=e[a]}return o},r.writeBitSet=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var i,n=t,s=e.length,o=s>>3,a=0;for(t+=this.writeVarint32(s,t);o--;)i=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(i,t++);if(a<s){var d=0;for(i=0;a<s;)i|=(1&!!e[a++])<<d++;this.writeByte(i,t++)}return r?(this.offset=t,this):t-n},r.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var r,i=this.readVarint32(e),n=i.value,s=n>>3,o=0,a=[];for(e+=i.length;s--;)r=this.readByte(e++),a[o++]=!!(1&r),a[o++]=!!(2&r),a[o++]=!!(4&r),a[o++]=!!(8&r),a[o++]=!!(16&r),a[o++]=!!(32&r),a[o++]=!!(64&r),a[o++]=!!(128&r);if(o<n){var d=0;for(r=this.readByte(e++);o<n;)a[o++]=!!(r>>d++&1)}return t&&(this.offset=e),a},r.readBytes=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}var i=this.slice(t,t+e);return r&&(this.offset+=e),i},r.writeBytes=r.append,r.writeInt8=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},r.writeByte=r.writeInt8,r.readInt8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r=this.view[e];return 128==(128&r)&&(r=-(255-r+1)),t&&(this.offset+=1),r},r.readByte=r.readInt8,r.writeUint8=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},r.writeUInt8=r.writeUint8,r.readUint8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r=this.view[e];return t&&(this.offset+=1),r},r.readUInt8=r.readUint8,r.writeInt16=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},r.writeShort=r.writeInt16,r.readInt16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e],r|=this.view[e+1]<<8):(r=this.view[e]<<8,r|=this.view[e+1]),32768==(32768&r)&&(r=-(65535-r+1)),t&&(this.offset+=2),r},r.readShort=r.readInt16,r.writeUint16=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},r.writeUInt16=r.writeUint16,r.readUint16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e],r|=this.view[e+1]<<8):(r=this.view[e]<<8,r|=this.view[e+1]),t&&(this.offset+=2),r},r.readUInt16=r.readUint16,r.writeInt32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),r&&(this.offset+=4),this},r.writeInt=r.writeInt32,r.readInt32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=this.view[e]<<24>>>0),r|=0,t&&(this.offset+=4),r},r.readInt=r.readInt32,r.writeUint32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),r&&(this.offset+=4),this},r.writeUInt32=r.writeUint32,r.readUint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=this.view[e]<<24>>>0),t&&(this.offset+=4),r},r.readUInt32=r.readUint32,e&&(r.writeInt64=function(t,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),r+=8;var n=this.buffer.byteLength;r>n&&this.resize((n*=2)>r?n:r),r-=8;var s=t.low,o=t.high;return this.littleEndian?(this.view[r+3]=s>>>24&255,this.view[r+2]=s>>>16&255,this.view[r+1]=s>>>8&255,this.view[r]=255&s,r+=4,this.view[r+3]=o>>>24&255,this.view[r+2]=o>>>16&255,this.view[r+1]=o>>>8&255,this.view[r]=255&o):(this.view[r]=o>>>24&255,this.view[r+1]=o>>>16&255,this.view[r+2]=o>>>8&255,this.view[r+3]=255&o,r+=4,this.view[r]=s>>>24&255,this.view[r+1]=s>>>16&255,this.view[r+2]=s>>>8&255,this.view[r+3]=255&s),i&&(this.offset+=8),this},r.writeLong=r.writeInt64,r.readInt64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var i=0,n=0;this.littleEndian?(i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0);var s=new e(i,n,!1);return r&&(this.offset+=8),s},r.readLong=r.readInt64,r.writeUint64=function(t,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),r+=8;var n=this.buffer.byteLength;r>n&&this.resize((n*=2)>r?n:r),r-=8;var s=t.low,o=t.high;return this.littleEndian?(this.view[r+3]=s>>>24&255,this.view[r+2]=s>>>16&255,this.view[r+1]=s>>>8&255,this.view[r]=255&s,r+=4,this.view[r+3]=o>>>24&255,this.view[r+2]=o>>>16&255,this.view[r+1]=o>>>8&255,this.view[r]=255&o):(this.view[r]=o>>>24&255,this.view[r+1]=o>>>16&255,this.view[r+2]=o>>>8&255,this.view[r+3]=255&o,r+=4,this.view[r]=s>>>24&255,this.view[r+1]=s>>>16&255,this.view[r+2]=s>>>8&255,this.view[r+3]=255&s),i&&(this.offset+=8),this},r.writeUInt64=r.writeUint64,r.readUint64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var i=0,n=0;this.littleEndian?(i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0);var s=new e(i,n,!0);return r&&(this.offset+=8),s},r.readUInt64=r.readUint64),r.writeFloat32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,d(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},r.writeFloat=r.writeFloat32,r.readFloat32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=a(this.view,e,this.littleEndian,23,4);return t&&(this.offset+=4),r},r.readFloat=r.readFloat32,r.writeFloat64=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=8,d(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},r.writeDouble=r.writeFloat64,r.readFloat64=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var r=a(this.view,e,this.littleEndian,52,8);return t&&(this.offset+=8),r},r.readDouble=r.readFloat64,t.MAX_VARINT32_BYTES=5,t.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},t.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},t.zigZagDecode32=function(e){return e>>>1^-(1&e)|0},r.writeVarint32=function(e,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n,s=t.calculateVarint32(e);r+=s;var o=this.buffer.byteLength;for(r>o&&this.resize((o*=2)>r?o:r),r-=s,e>>>=0;e>=128;)n=127&e|128,this.view[r++]=n,e>>>=7;return this.view[r++]=e,i?(this.offset=r,this):s},r.writeVarint32ZigZag=function(e,r){return this.writeVarint32(t.zigZagEncode32(e),r)},r.readVarint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=0,n=0;do{if(!this.noAssert&&e>this.limit){var s=Error("Truncated");throw s.truncated=!0,s}r=this.view[e++],i<5&&(n|=(127&r)<<7*i),++i}while(0!=(128&r));return n|=0,t?(this.offset=e,n):{value:n,length:i}},r.readVarint32ZigZag=function(e){var r=this.readVarint32(e);return"object"==typeof r?r.value=t.zigZagDecode32(r.value):r=t.zigZagDecode32(r),r},e&&(t.MAX_VARINT64_BYTES=10,t.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var r=t.toInt()>>>0,i=t.shiftRightUnsigned(28).toInt()>>>0,n=t.shiftRightUnsigned(56).toInt()>>>0;return 0==n?0==i?r<16384?r<128?1:2:r<1<<21?3:4:i<16384?i<128?5:6:i<1<<21?7:8:n<128?9:10},t.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},t.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},r.writeVarint64=function(r,i){var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"==typeof r)r=e.fromNumber(r);else if("string"==typeof r)r=e.fromString(r);else if(!(r&&r instanceof e))throw TypeError("Illegal value: "+r+" (not an integer or Long)");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}"number"==typeof r?r=e.fromNumber(r,!1):"string"==typeof r?r=e.fromString(r,!1):!1!==r.unsigned&&(r=r.toSigned());var s=t.calculateVarint64(r),o=r.toInt()>>>0,a=r.shiftRightUnsigned(28).toInt()>>>0,d=r.shiftRightUnsigned(56).toInt()>>>0;i+=s;var u=this.buffer.byteLength;switch(i>u&&this.resize((u*=2)>i?u:i),i-=s,s){case 10:this.view[i+9]=d>>>7&1;case 9:this.view[i+8]=9!==s?128|d:127&d;case 8:this.view[i+7]=8!==s?a>>>21|128:a>>>21&127;case 7:this.view[i+6]=7!==s?a>>>14|128:a>>>14&127;case 6:this.view[i+5]=6!==s?a>>>7|128:a>>>7&127;case 5:this.view[i+4]=5!==s?128|a:127&a;case 4:this.view[i+3]=4!==s?o>>>21|128:o>>>21&127;case 3:this.view[i+2]=3!==s?o>>>14|128:o>>>14&127;case 2:this.view[i+1]=2!==s?o>>>7|128:o>>>7&127;case 1:this.view[i]=1!==s?128|o:127&o}return n?(this.offset+=s,this):s},r.writeVarint64ZigZag=function(e,r){return this.writeVarint64(t.zigZagEncode64(e),r)},r.readVarint64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var i=t,n=0,s=0,o=0,a=0;if(n=127&(a=this.view[t++]),128&a&&(n|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(s=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(o=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(o|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");var d=e.fromBits(n|s<<28,s>>>4|o<<24,!1);return r?(this.offset=t,d):{value:d,length:t-i}},r.readVarint64ZigZag=function(r){var i=this.readVarint64(r);return i&&i.value instanceof e?i.value=t.zigZagDecode64(i.value):i=t.zigZagDecode64(i),i}),r.writeCString=function(e,t){var r=void 0===t;r&&(t=this.offset);var i,n=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;i<n;++i)if(0===e.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}n=l.calculateUTF16asUTF8(s(e))[1],t+=n+1;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=n+1,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),this.view[t++]=0,r?(this.offset=t,this):n},r.readCString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=e,n=-1;return l.decodeUTF8toUTF16(function(){if(0===n)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(n=this.view[e++])?null:n}.bind(this),r=o(),!0),t?(this.offset=e,r()):{string:r(),length:e-i}},r.writeIString=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var i,n=t;i=l.calculateUTF16asUTF8(s(e),this.noAssert)[1],t+=4+i;var o=this.buffer.byteLength;if(t>o&&this.resize((o*=2)>t?o:t),t-=4+i,this.littleEndian?(this.view[t+3]=i>>>24&255,this.view[t+2]=i>>>16&255,this.view[t+1]=i>>>8&255,this.view[t]=255&i):(this.view[t]=i>>>24&255,this.view[t+1]=i>>>16&255,this.view[t+2]=i>>>8&255,this.view[t+3]=255&i),t+=4,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),t!==n+4+i)throw RangeError("Illegal range: Truncated data, "+t+" == "+(t+4+i));return r?(this.offset=t,this):t-n},r.readIString=function(e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=e,n=this.readUint32(e),s=this.readUTF8String(n,t.METRICS_BYTES,e+=4);return e+=s.length,r?(this.offset=e,s.string):{string:s.string,length:e-i}},t.METRICS_CHARS="c",t.METRICS_BYTES="b",r.writeUTF8String=function(e,t){var r,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var n=t;r=l.calculateUTF16asUTF8(s(e))[1],t+=r;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=r,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),i?(this.offset=t,this):t-n},r.writeString=r.writeUTF8String,t.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(s(e))[0]},t.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(s(e))[1]},t.calculateString=t.calculateUTF8Bytes,r.readUTF8String=function(e,r,i){"number"==typeof r&&(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),void 0===r&&(r=t.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}var s,a=0,d=i;if(r===t.METRICS_CHARS){if(s=o(),l.decodeUTF8(function(){return a<e&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++a,l.UTF8toUTF16(e,s)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return n?(this.offset=i,s()):{string:s(),length:i-d}}if(r===t.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}var u=i+e;if(l.decodeUTF8toUTF16(function(){return i<u?this.view[i++]:null}.bind(this),s=o(),this.noAssert),i!==u)throw RangeError("Illegal range: Truncated data, "+i+" == "+u);return n?(this.offset=i,s()):{string:s(),length:i-d}}throw TypeError("Unsupported metrics: "+r)},r.readString=r.readUTF8String,r.writeVString=function(e,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n,o,a=r;n=l.calculateUTF16asUTF8(s(e),this.noAssert)[1],o=t.calculateVarint32(n),r+=o+n;var d=this.buffer.byteLength;if(r>d&&this.resize((d*=2)>r?d:r),r-=o+n,r+=this.writeVarint32(n,r),l.encodeUTF16toUTF8(s(e),function(e){this.view[r++]=e}.bind(this)),r!==a+n+o)throw RangeError("Illegal range: Truncated data, "+r+" == "+(r+n+o));return i?(this.offset=r,this):r-a},r.readVString=function(e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i=e,n=this.readVarint32(e),s=this.readUTF8String(n.value,t.METRICS_BYTES,e+=n.length);return e+=s.length,r?(this.offset=e,s.string):{string:s.string,length:e-i}},r.append=function(e,r,i){"number"!=typeof r&&"string"==typeof r||(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,r));var s=e.limit-e.offset;if(s<=0)return this;i+=s;var o=this.buffer.byteLength;return i>o&&this.resize((o*=2)>i?o:i),i-=s,this.view.set(e.view.subarray(e.offset,e.limit),i),e.offset+=s,n&&(this.offset+=s),this},r.appendTo=function(e,t){return e.append(this,t),this},r.assert=function(e){return this.noAssert=!e,this},r.capacity=function(){return this.buffer.byteLength},r.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},r.clone=function(e){var r=new t(0,this.littleEndian,this.noAssert);return e?(r.buffer=new ArrayBuffer(this.buffer.byteLength),r.view=new Uint8Array(r.buffer)):(r.buffer=this.buffer,r.view=this.view),r.offset=this.offset,r.markedOffset=this.markedOffset,r.limit=this.limit,r},r.compact=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var r=t-e;if(0===r)return this.buffer=i,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var n=new ArrayBuffer(r),s=new Uint8Array(n);return s.set(this.view.subarray(e,t)),this.buffer=n,this.view=s,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=r,this},r.copy=function(e,r){if(void 0===e&&(e=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal end: Not an integer");if(r>>>=0,e<0||e>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+r+" <= "+this.buffer.byteLength)}if(e===r)return new t(0,this.littleEndian,this.noAssert);var i=r-e,n=new t(i,this.littleEndian,this.noAssert);return n.offset=0,n.limit=i,n.markedOffset>=0&&(n.markedOffset-=e),this.copyTo(n,0,e,r),n},r.copyTo=function(e,r,i,n){var s,o;if(!this.noAssert&&!t.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(r=(o=void 0===r)?e.offset:0|r,i=(s=void 0===i)?this.offset:0|i,n=void 0===n?this.limit:0|n,r<0||r>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+r+" <= "+e.buffer.byteLength);if(i<0||n>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+i+" <= "+this.buffer.byteLength);var a=n-i;return 0===a?e:(e.ensureCapacity(r+a),e.view.set(this.view.subarray(i,n),r),s&&(this.offset+=a),o&&(e.offset+=a),this)},r.ensureCapacity=function(e){var t=this.buffer.byteLength;return t<e?this.resize((t*=2)>e?t:e):this},r.fill=function(e,t,r){var i=void 0===t;if(i&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal end: Not an integer");if(r>>>=0,t<0||t>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+r+" <= "+this.buffer.byteLength)}if(t>=r)return this;for(;t<r;)this.view[t++]=e;return i&&(this.offset=t),this},r.flip=function(){return this.limit=this.offset,this.offset=0,this},r.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},r.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},r.LE=function(e){return this.littleEndian=void 0===e||!!e,this},r.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},r.prepend=function(e,r,i){"number"!=typeof r&&"string"==typeof r||(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,r));var s=e.limit-e.offset;if(s<=0)return this;var o=s-i;if(o>0){var a=new ArrayBuffer(this.buffer.byteLength+o),d=new Uint8Array(a);d.set(this.view.subarray(i,this.buffer.byteLength),s),this.buffer=a,this.view=d,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,i+=o}else new Uint8Array(this.buffer);return this.view.set(e.view.subarray(e.offset,e.limit),i-s),e.offset=e.limit,n&&(this.offset-=s),this},r.prependTo=function(e,t){return e.prepend(this,t),this},r.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},r.remaining=function(){return this.limit-this.offset},r.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},r.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength<e){var t=new ArrayBuffer(e),r=new Uint8Array(t);r.set(this.view),this.buffer=t,this.view=r}return this},r.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},r.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},r.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r=this.clone();return r.offset=e,r.limit=t,r},r.toBuffer=function(e){var t=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,t<0||t>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+r+" <= "+this.buffer.byteLength)}if(!e&&0===t&&r===this.buffer.byteLength)return this.buffer;if(t===r)return i;var n=new ArrayBuffer(r-t);return new Uint8Array(n).set(new Uint8Array(this.buffer).subarray(t,r),0),n},r.toArrayBuffer=r.toBuffer,r.toString=function(e,t,r){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(r=t=e="utf8"),e){case"utf8":return this.toUTF8(t,r);case"base64":return this.toBase64(t,r);case"hex":return this.toHex(t,r);case"binary":return this.toBinary(t,r);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var u=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],r=[],i=0,n=t.length;i<n;++i)r[t[i]]=i;return e.encode=function(e,r){for(var i,n;null!==(i=e());)r(t[i>>2&63]),n=(3&i)<<4,null!==(i=e())?(r(t[63&((n|=i>>4&15)|i>>4&15)]),n=(15&i)<<2,null!==(i=e())?(r(t[63&(n|i>>6&3)]),r(t[63&i])):(r(t[63&n]),r(61))):(r(t[63&n]),r(61),r(61))},e.decode=function(e,t){var i,n,s;function o(e){throw Error("Illegal character code: "+e)}for(;null!==(i=e());)if(void 0===(n=r[i])&&o(i),null!==(i=e())&&(void 0===(s=r[i])&&o(i),t(n<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(n=r[i])){if(61===i)break;o(i)}if(t((15&s)<<4>>>0|(60&n)>>2),null!==(i=e())){if(void 0===(s=r[i])){if(61===i)break;o(i)}t((3&n)<<6>>>0|s)}}},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)},e}();r.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return e<t?this.view[e++]:null}.bind(this),r=o()),r()},t.fromBase64=function(e,r){if("string"!=typeof e)throw TypeError("str");var i=new t(e.length/4*3,r),n=0;return u.decode(s(e),(function(e){i.view[n++]=e})),i.limit=n,i},t.btoa=function(e){return t.fromBinary(e).toBase64()},t.atob=function(e){return t.fromBase64(e).toBinary()},r.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var r=[],i=[];e<t;)r.push(this.view[e++]),r.length>=1024&&(i.push(String.fromCharCode.apply(String,r)),r=[]);return i.join("")+String.fromCharCode.apply(String,r)},t.fromBinary=function(e,r){if("string"!=typeof e)throw TypeError("str");for(var i,n=0,s=e.length,o=new t(s,r);n<s;){if((i=e.charCodeAt(n))>255)throw RangeError("illegal char code: "+i);o.view[n++]=i}return o.limit=s,o},r.toDebug=function(e){for(var t,r=-1,i=this.buffer.byteLength,n="",s="",o="";r<i;){if(-1!==r&&(n+=(t=this.view[r])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(s+=t>32&&t<127?String.fromCharCode(t):".")),++r,e&&r>0&&r%16==0&&r!==i){for(;n.length<51;)n+=" ";o+=n+s+"\n",n=s=""}r===this.offset&&r===this.limit?n+=r===this.markedOffset?"!":"|":r===this.offset?n+=r===this.markedOffset?"[":"<":r===this.limit?n+=r===this.markedOffset?"]":">":n+=r===this.markedOffset?"'":e||0!==r&&r!==i?" ":""}if(e&&" "!==n){for(;n.length<51;)n+=" ";o+=n+s+"\n"}return e?o:n},t.fromDebug=function(e,r,i){for(var n,s,o=e.length,a=new t((o+1)/3|0,r,i),d=0,u=0,l=!1,c=!1,p=!1,h=!1,f=!1;d<o;){switch(n=e.charAt(d++)){case"!":if(!i){if(c||p||h){f=!0;break}c=p=h=!0}a.offset=a.markedOffset=a.limit=u,l=!1;break;case"|":if(!i){if(c||h){f=!0;break}c=h=!0}a.offset=a.limit=u,l=!1;break;case"[":if(!i){if(c||p){f=!0;break}c=p=!0}a.offset=a.markedOffset=u,l=!1;break;case"<":if(!i){if(c){f=!0;break}c=!0}a.offset=u,l=!1;break;case"]":if(!i){if(h||p){f=!0;break}h=p=!0}a.limit=a.markedOffset=u,l=!1;break;case">":if(!i){if(h){f=!0;break}h=!0}a.limit=u,l=!1;break;case"'":if(!i){if(p){f=!0;break}p=!0}a.markedOffset=u,l=!1;break;case" ":l=!1;break;default:if(!i&&l){f=!0;break}if(s=parseInt(n+e.charAt(d++),16),!i&&(isNaN(s)||s<0||s>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[u++]=s,l=!0}if(f)throw TypeError("Illegal str: Invalid symbol at "+d)}if(!i){if(!c||!h)throw TypeError("Illegal str: Missing offset or limit");if(u<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+o)}return a},r.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var r,i=new Array(t-e);e<t;)(r=this.view[e++])<16?i.push("0",r.toString(16)):i.push(r.toString(16));return i.join("")},t.fromHex=function(e,r,i){if(!i){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var n,s=e.length,o=new t(s/2|0,r),a=0,d=0;a<s;a+=2){if(n=parseInt(e.substring(a,a+2),16),!i&&(!isFinite(n)||n<0||n>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[d++]=n}return o.limit=d,o};var l=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var r=null;for("number"==typeof e&&(r=e,e=function(){return null});null!==r||null!==(r=e());)r<128?t(127&r):r<2048?(t(r>>6&31|192),t(63&r|128)):r<65536?(t(r>>12&15|224),t(r>>6&63|128),t(63&r|128)):(t(r>>18&7|240),t(r>>12&63|128),t(r>>6&63|128),t(63&r|128)),r=null},decodeUTF8:function(e,t){for(var r,i,n,s,o=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(r=e());)if(0==(128&r))t(r);else if(192==(224&r))null===(i=e())&&o([r,i]),t((31&r)<<6|63&i);else if(224==(240&r))(null===(i=e())||null===(n=e()))&&o([r,i,n]),t((15&r)<<12|(63&i)<<6|63&n);else{if(240!=(248&r))throw RangeError("Illegal starting byte: "+r);(null===(i=e())||null===(n=e())||null===(s=e()))&&o([r,i,n,s]),t((7&r)<<18|(63&i)<<12|(63&n)<<6|63&s)}},UTF16toUTF8:function(e,t){for(var r,i=null;null!==(r=null!==i?i:e());)r>=55296&&r<=57343&&null!==(i=e())&&i>=56320&&i<=57343?(t(1024*(r-55296)+i-56320+65536),i=null):t(r);null!==i&&t(i)},UTF8toUTF16:function(e,t){var r=null;for("number"==typeof e&&(r=e,e=function(){return null});null!==r||null!==(r=e());)r<=65535?t(r):(t(55296+((r-=65536)>>10)),t(r%1024+56320)),r=null},encodeUTF16toUTF8:function(t,r){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,r)}))},decodeUTF8toUTF16:function(t,r){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,r)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,r=0;null!==(t=e());)r+=t<128?1:t<2048?2:t<65536?3:4;return r},calculateUTF16asUTF8:function(t){var r=0,i=0;return e.UTF16toUTF8(t,(function(e){++r,i+=e<128?1:e<2048?2:e<65536?3:4})),[r,i]}};return e}();return r.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{l.decodeUTF8toUTF16(function(){return e<t?this.view[e++]:null}.bind(this),r=o())}catch(r){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},t.fromUTF8=function(e,r,i){if(!i&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var n=new t(l.calculateUTF16asUTF8(s(e),!0)[1],r,i),o=0;return l.encodeUTF16toUTF8(s(e),(function(e){n.view[o++]=e})),n.limit=o,n},t},void 0===(s="function"==typeof i?i.apply(t,n):i)||(e.exports=s)},6874:function(e,t){var r,i,n;i=[],void 0===(n="function"==typeof(r=function(){"use strict";function e(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function t(e){return!0===(e&&e.__isLong__)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var r={},i={};function n(e,t){var n,s,a;return t?(a=0<=(e>>>=0)&&e<256)&&(s=i[e])?s:(n=o(e,(0|e)<0?-1:0,!0),a&&(i[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(s=r[e])?s:(n=o(e,e<0?-1:0,!1),a&&(r[e]=n),n)}function s(e,t){if(isNaN(e)||!isFinite(e))return t?g:y;if(t){if(e<0)return g;if(e>=p)return w}else{if(e<=-h)return E;if(e+1>=h)return _}return e<0?s(-e,t).neg():o(e%c|0,e/c|0,t)}function o(t,r,i){return new e(t,r,i)}e.fromInt=n,e.fromNumber=s,e.fromBits=o;var a=Math.pow;function d(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return y;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return d(e.substring(1),t,r).neg();for(var n=s(a(r,8)),o=y,u=0;u<e.length;u+=8){var l=Math.min(8,e.length-u),c=parseInt(e.substring(u,u+l),r);if(l<8){var p=s(a(r,l));o=o.mul(p).add(s(c))}else o=(o=o.mul(n)).add(s(c))}return o.unsigned=t,o}function u(t){return t instanceof e?t:"number"==typeof t?s(t):"string"==typeof t?d(t):o(t.low,t.high,t.unsigned)}e.fromString=d,e.fromValue=u;var l=65536,c=l*l,p=c*c,h=p/2,f=n(1<<24),y=n(0);e.ZERO=y;var g=n(0,!0);e.UZERO=g;var m=n(1);e.ONE=m;var v=n(1,!0);e.UONE=v;var b=n(-1);e.NEG_ONE=b;var _=o(-1,2147483647,!1);e.MAX_VALUE=_;var w=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=w;var E=o(0,-2147483648,!1);e.MIN_VALUE=E;var T=e.prototype;return T.toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*c+(this.low>>>0):this.high*c+(this.low>>>0)},T.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(E)){var t=s(e),r=this.div(t),i=r.mul(t).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=s(a(e,6),this.unsigned),o=this,d="";;){var u=o.div(n),l=(o.sub(u.mul(n)).toInt()>>>0).toString(e);if((o=u).isZero())return l+d;for(;l.length<6;)l="0"+l;d=""+l+d}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){if(this.isNegative())return this.eq(E)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},T.isZero=function(){return 0===this.high&&0===this.low},T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.equals=function(e){return t(e)||(e=u(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.compare=function(e){if(t(e)||(e=u(e)),this.eq(e))return 0;var r=this.isNegative(),i=e.isNegative();return r&&!i?-1:!r&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(m)},T.neg=T.negate,T.add=function(e){t(e)||(e=u(e));var r=this.high>>>16,i=65535&this.high,n=this.low>>>16,s=65535&this.low,a=e.high>>>16,d=65535&e.high,l=e.low>>>16,c=0,p=0,h=0,f=0;return h+=(f+=s+(65535&e.low))>>>16,p+=(h+=n+l)>>>16,c+=(p+=i+d)>>>16,c+=r+a,o((h&=65535)<<16|(f&=65535),(c&=65535)<<16|(p&=65535),this.unsigned)},T.subtract=function(e){return t(e)||(e=u(e)),this.add(e.neg())},T.sub=T.subtract,T.multiply=function(e){if(this.isZero())return y;if(t(e)||(e=u(e)),e.isZero())return y;if(this.eq(E))return e.isOdd()?E:y;if(e.eq(E))return this.isOdd()?E:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(f)&&e.lt(f))return s(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,n=this.low>>>16,a=65535&this.low,d=e.high>>>16,l=65535&e.high,c=e.low>>>16,p=65535&e.low,h=0,g=0,m=0,v=0;return m+=(v+=a*p)>>>16,g+=(m+=n*p)>>>16,m&=65535,g+=(m+=a*c)>>>16,h+=(g+=i*p)>>>16,g&=65535,h+=(g+=n*c)>>>16,g&=65535,h+=(g+=a*l)>>>16,h+=r*p+i*c+n*l+a*d,o((m&=65535)<<16|(v&=65535),(h&=65535)<<16|(g&=65535),this.unsigned)},T.mul=T.multiply,T.divide=function(e){if(t(e)||(e=u(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:y;var r,i,n;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return v;n=g}else{if(this.eq(E))return e.eq(m)||e.eq(b)?E:e.eq(E)?m:(r=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?m:b:(i=this.sub(e.mul(r)),n=r.add(i.div(e)));if(e.eq(E))return this.unsigned?g:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=y}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),d=o<=48?1:a(2,o-48),l=s(r),c=l.mul(e);c.isNegative()||c.gt(i);)c=(l=s(r-=d,this.unsigned)).mul(e);l.isZero()&&(l=m),n=n.add(l),i=i.sub(c)}return n},T.div=T.divide,T.modulo=function(e){return t(e)||(e=u(e)),this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.not=function(){return o(~this.low,~this.high,this.unsigned)},T.and=function(e){return t(e)||(e=u(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return t(e)||(e=u(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return t(e)||(e=u(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},T.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):o(0,this.low<<e-32,this.unsigned)},T.shl=T.shiftLeft,T.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):o(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},T.shr=T.shiftRight,T.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0==(e&=63))return this;var r=this.high;return e<32?o(this.low>>>e|r<<32-e,r>>>e,this.unsigned):o(32===e?r:r>>>e-32,0,this.unsigned)},T.shru=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},T.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})?r.apply(t,i):r)||(e.exports=n)},2699:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,r)}(e,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,r,i){var n,s,o,u;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=l.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):f(n,n.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function y(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return d(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var d=s[e];if(void 0===d)return!1;if("function"==typeof d)i(d,this,t);else{var u=d.length,l=f(d,u);for(r=0;r<u;++r)i(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,c(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,c(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,s,o;if(a(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},6920:e=>{e.exports=o,o.default=o,o.stable=l,o.stableStringify=l;var t="[...]",r="[Circular]",i=[],n=[];function s(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function o(e,t,r,o){var a;void 0===o&&(o=s()),d(e,"",0,[],void 0,0,o);try{a=0===n.length?JSON.stringify(e,t,r):JSON.stringify(e,p(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var u=i.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return a}function a(e,t,r,s){var o=Object.getOwnPropertyDescriptor(s,r);void 0!==o.get?o.configurable?(Object.defineProperty(s,r,{value:e}),i.push([s,r,t,o])):n.push([t,r,e]):(s[r]=e,i.push([s,r,t]))}function d(e,i,n,s,o,u,l){var c;if(u+=1,"object"==typeof e&&null!==e){for(c=0;c<s.length;c++)if(s[c]===e)return void a(r,e,i,o);if(void 0!==l.depthLimit&&u>l.depthLimit)return void a(t,e,i,o);if(void 0!==l.edgesLimit&&n+1>l.edgesLimit)return void a(t,e,i,o);if(s.push(e),Array.isArray(e))for(c=0;c<e.length;c++)d(e[c],c,c,s,e,u,l);else{var p=Object.keys(e);for(c=0;c<p.length;c++){var h=p[c];d(e[h],h,c,s,e,u,l)}}s.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function l(e,t,r,o){void 0===o&&(o=s());var a,d=c(e,"",0,[],void 0,0,o)||e;try{a=0===n.length?JSON.stringify(d,t,r):JSON.stringify(d,p(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var u=i.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return a}function c(e,n,s,o,d,l,p){var h;if(l+=1,"object"==typeof e&&null!==e){for(h=0;h<o.length;h++)if(o[h]===e)return void a(r,e,n,d);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==p.depthLimit&&l>p.depthLimit)return void a(t,e,n,d);if(void 0!==p.edgesLimit&&s+1>p.edgesLimit)return void a(t,e,n,d);if(o.push(e),Array.isArray(e))for(h=0;h<e.length;h++)c(e[h],h,h,o,e,l,p);else{var f={},y=Object.keys(e).sort(u);for(h=0;h<y.length;h++){var g=y[h];c(e[g],g,h,o,e,l,p),f[g]=e[g]}if(void 0===d)return f;i.push([d,n,e]),d[n]=f}o.pop()}}function p(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var i=0;i<n.length;i++){var s=n[i];if(s[1]===t&&s[0]===r){r=s[2],n.splice(i,1);break}}return e.call(this,t,r)}}},2333:(e,t)=>{t.read=function(e,t,r,i,n){var s,o,a=8*n-i-1,d=(1<<a)-1,u=d>>1,l=-7,c=r?n-1:0,p=r?-1:1,h=e[t+c];for(c+=p,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+c],c+=p,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+c],c+=p,l-=8);if(0===s)s=1-u;else{if(s===d)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=u}return(h?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var o,a,d,u=8*s-n-1,l=(1<<u)-1,c=l>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,f=i?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-o))<1&&(o--,d*=2),(t+=o+c>=1?p/d:p*Math.pow(2,1-c))*d>=2&&(o++,d/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(t*d-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[r+h]=255&a,h+=f,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[r+h]=255&o,h+=f,o/=256,u-=8);e[r+h-f]|=128*y}},1297:(e,t,r)=>{e.exports=function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){if(s)return s(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return n(t[o][1][e]||e)}),u,u.exports,e,t,r,i)}return r[o].exports}for(var s=void 0,o=0;o<i.length;o++)n(i[o]);return n}({1:[function(e,t,r){"use strict";var i=e("./utils"),n=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,n,o,a,d,u,l=[],c=0,p=e.length,h=p,f="string"!==i.getTypeOf(e);c<e.length;)h=p-c,n=f?(t=e[c++],r=c<p?e[c++]:0,c<p?e[c++]:0):(t=e.charCodeAt(c++),r=c<p?e.charCodeAt(c++):0,c<p?e.charCodeAt(c++):0),o=t>>2,a=(3&t)<<4|r>>4,d=1<h?(15&r)<<2|n>>6:64,u=2<h?63&n:64,l.push(s.charAt(o)+s.charAt(a)+s.charAt(d)+s.charAt(u));return l.join("")},r.decode=function(e){var t,r,i,o,a,d,u=0,l=0,c="data:";if(e.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");var p,h=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&h--,e.charAt(e.length-2)===s.charAt(64)&&h--,h%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=n.uint8array?new Uint8Array(0|h):new Array(0|h);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,r=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,i=(3&a)<<6|(d=s.indexOf(e.charAt(u++))),p[l++]=t,64!==a&&(p[l++]=r),64!==d&&(p[l++]=i);return p}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var i=e("./external"),n=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,r,i,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var i=e("./utils"),n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,r,i){var s=n,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,r,i){var s=n,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var i=null;i="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=i?"uint8array":"array";function d(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(d,o),d.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},d.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(e){return new d("Deflate",e)},r.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function i(e,t){var r,i="";for(r=0;r<t;r++)i+=String.fromCharCode(255&e),e>>>=8;return i}function n(e,t,r,n,o,l){var c,p,h=e.file,f=e.compression,y=l!==a.utf8encode,g=s.transformTo("string",l(h.name)),m=s.transformTo("string",a.utf8encode(h.name)),v=h.comment,b=s.transformTo("string",l(v)),_=s.transformTo("string",a.utf8encode(v)),w=m.length!==h.name.length,E=_.length!==v.length,T="",S="",R="",O=h.dir,I=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var A=0;t&&(A|=8),y||!w&&!E||(A|=2048);var C=0,k=0;O&&(C|=16),"UNIX"===o?(k=798,C|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,O)):(k=20,C|=function(e){return 63&(e||0)}(h.dosPermissions)),c=I.getUTCHours(),c<<=6,c|=I.getUTCMinutes(),c<<=5,c|=I.getUTCSeconds()/2,p=I.getUTCFullYear()-1980,p<<=4,p|=I.getUTCMonth()+1,p<<=5,p|=I.getUTCDate(),w&&(S=i(1,1)+i(d(g),4)+m,T+="up"+i(S.length,2)+S),E&&(R=i(1,1)+i(d(b),4)+_,T+="uc"+i(R.length,2)+R);var M="";return M+="\n\0",M+=i(A,2),M+=f.magic,M+=i(c,2),M+=i(p,2),M+=i(x.crc32,4),M+=i(x.compressedSize,4),M+=i(x.uncompressedSize,4),M+=i(g.length,2),M+=i(T.length,2),{fileRecord:u.LOCAL_FILE_HEADER+M+g+T,dirRecord:u.CENTRAL_FILE_HEADER+i(k,2)+M+i(b.length,2)+"\0\0\0\0"+i(C,4)+i(n,4)+g+T+b}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),d=e("../crc32"),u=e("../signature");function l(e,t,r,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(l,o),l.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-i-1))/r:100}}))},l.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+i(e.crc32,4)+i(e.compressedSize,4)+i(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,n=function(e,t,r,n,o){var a=s.transformTo("string",o(n));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(e,2)+i(e,2)+i(t,4)+i(r,4)+i(a.length,2)+a}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},l.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},l.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},l.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},l.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=l},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var i=e("../compressions"),n=e("./ZipFileWorker");r.generateWorker=function(e,t,r){var s=new n(t.streamFiles,r,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,r){o++;var n=function(e,t){var r=e||t,n=i[r];if(!n)throw new Error(r+" is not a valid compression method !");return n}(r.options.compression,t.compression),a=r.options.compressionOptions||t.compressionOptions||{},d=r.dir,u=r.date;r._compressWorker(n,a).withStreamInfo("file",{name:e,dir:d,date:u,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(s)})),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new i;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(i.prototype=e("./object")).loadAsync=e("./load"),i.support=e("./support"),i.defaults=e("./defaults"),i.version="3.10.1",i.loadAsync=function(e,t){return(new i).loadAsync(e,t)},i.external=e("./external"),t.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var i=e("./utils"),n=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),d=e("./nodejsUtils");function u(e){return new n.Promise((function(t,r){var i=e.decompressed.getContentWorker().pipe(new a);i.on("error",(function(e){r(e)})).on("end",(function(){i.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var r=this;return t=i.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),d.isNode&&d.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var r=new o(t);return r.load(e),r})).then((function(e){var r=[n.Promise.resolve(e)],i=e.files;if(t.checkCRC32)for(var s=0;s<i.length;s++)r.push(u(i[s]));return n.Promise.all(r)})).then((function(e){for(var n=e.shift(),s=n.files,o=0;o<s.length;o++){var a=s[o],d=a.fileNameStr,u=i.resolve(a.fileNameStr);r.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(r.file(u).unsafeOriginalName=d)}return n.zipComment.length&&(r.comment=n.zipComment),r}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../stream/GenericWorker");function s(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}i.inherits(s,n),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},s.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var i=e("readable-stream").Readable;function n(e,t,r){i.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),r&&r(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){"use strict";t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,r){"use strict";function i(e,t,r){var i,n=s.getTypeOf(t),a=s.extend(r||{},d);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=y(e)),a.createFolders&&(i=f(e))&&g.call(this,i,!0);var c="string"===n&&!1===a.binary&&!1===a.base64;r&&void 0!==r.binary||(a.binary=!c),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var m=null;m=t instanceof u||t instanceof o?t:p.isNode&&p.isStream(t)?new h(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var v=new l(e,m,a);this.files[e]=v}var n=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),d=e("./defaults"),u=e("./compressedObject"),l=e("./zipObject"),c=e("./generate"),p=e("./nodejsUtils"),h=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},y=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:d.createFolders,e=y(e),this.files[e]||i.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function m(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,i;for(t in this.files)i=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,i)},filter:function(e){var t=[];return this.forEach((function(r,i){e(r,i)&&t.push(i)})),t},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,i.call(this,e,t,r),this;if(m(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(m(e))return this.filter((function(t,r){return r.dir&&e.test(t)}));var t=this.root+e,r=g.call(this,t),i=this.clone();return i.root=r.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter((function(t,r){return r.name.slice(0,e.length)===e})),i=0;i<r.length;i++)delete this.files[r[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");s.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var i=r.comment||this.comment||"";t=c.generateWorker(this,r,i)}catch(e){(t=new o("error")).error(e)}return new a(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var i=e("./DataReader");function n(e){i.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&i===s[2]&&n===s[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var i=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,r){"use strict";var i=e("./Uint8ArrayReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var i=e("./DataReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var i=e("./ArrayReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),d=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new d(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var i=e("./GenericWorker"),n=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var i=e("./GenericWorker"),n=e("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,n),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}i.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=i},{}],29:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),d=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function l(e,t){return new d.Promise((function(r,n){var s=[],a=e._internalType,d=e._outputType,u=e._mimeType;e.on("data",(function(e,r){s.push(e),t&&t(r)})).on("error",(function(e){s=[],n(e)})).on("end",(function(){try{var e=function(e,t,r){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),r);case"base64":return o.encode(t);default:return i.transformTo(e,t)}}(d,function(e,t){var r,i=0,n=null,s=0;for(r=0;r<t.length;r++)s+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(s),r=0;r<t.length;r++)n.set(t[r],i),i+=t[r].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);r(e)}catch(e){n(e)}s=[]})).resume()}))}function c(e,t,r){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=r,i.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return l(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,(function(e){t.call(r,e.data,e.meta)})):this._worker.on(e,(function(){i.delay(t,arguments,r)})),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer="undefined"!=typeof Buffer,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var i=new ArrayBuffer(0);try{r.blob=0===new Blob([i],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(i),r.blob=0===n.getBlob("application/zip").size}catch(e){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(e){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var i=e("./utils"),n=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),d=0;d<256;d++)a[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function l(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,r.utf8encode=function(e){return n.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,r,i,s,o,a=e.length,d=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),d+=r<128?1:r<2048?2:r<65536?3:4;for(t=n.uint8array?new Uint8Array(d):new Array(d),s=o=0;o<d;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t}(e)},r.utf8decode=function(e){return n.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,s,o=e.length,d=new Array(2*o);for(t=r=0;t<o;)if((n=e[t++])<128)d[r++]=n;else if(4<(s=a[n]))d[r++]=65533,t+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&t<o;)n=n<<6|63&e[t++],s--;1<s?d[r++]=65533:n<65536?d[r++]=n:(n-=65536,d[r++]=55296|n>>10&1023,d[r++]=56320|1023&n)}return d.length!==r&&(d.subarray?d=d.subarray(0,r):d.length=r),i.applyFromCharCode(d)}(e=i.transformTo(n.uint8array?"uint8array":"array",e))},i.inherits(u,o),u.prototype.processChunk=function(e){var t=i.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+a[e[r]]>t?r:t}(t),d=t;o!==t.length&&(n.uint8array?(d=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(d=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:r.utf8decode(d),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,i.inherits(l,o),l.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var i=e("./support"),n=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function d(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),r.newBlob=function(e,t){r.checkSupport("blob");try{return new Blob([e],{type:t})}catch(r){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,r){var i=[],n=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);for(;n<s;)"array"===t||"nodebuffer"===t?i.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+r,s)))):i.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+r,s)))),n+=r;return i.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function l(e){var t=65536,i=r.getTypeOf(e),n=!0;if("uint8array"===i?n=u.applyCanBeUsed.uint8array:"nodebuffer"===i&&(n=u.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return u.stringifyByChunk(e,i,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function c(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}r.applyFromCharCode=l;var p={};p.string={string:a,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return p.string.uint8array(e).buffer},uint8array:function(e){return d(e,new Uint8Array(e.length))},nodebuffer:function(e){return d(e,s.allocBuffer(e.length))}},p.array={string:l,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},p.arraybuffer={string:function(e){return l(new Uint8Array(e))},array:function(e){return c(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},p.uint8array={string:l,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},p.nodebuffer={string:l,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return p.nodebuffer.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:a},r.transformTo=function(e,t){if(t=t||"",!e)return t;r.checkSupport(e);var i=r.getTypeOf(t);return p[i][e](t)},r.resolve=function(e){for(var t=e.split("/"),r=[],i=0;i<t.length;i++){var n=t[i];"."===n||""===n&&0!==i&&i!==t.length-1||(".."===n?r.pop():r.push(n))}return r.join("/")},r.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":i.nodebuffer&&s.isBuffer(e)?"nodebuffer":i.uint8array&&e instanceof Uint8Array?"uint8array":i.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(e){var t,r,i="";for(r=0;r<(e||"").length;r++)i+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return i},r.delay=function(e,t,r){setImmediate((function(){e.apply(r||null,t||[])}))},r.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r},r.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},r.prepareContent=function(e,t,s,a,u){return o.Promise.resolve(t).then((function(e){return i.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,r){var i=new FileReader;i.onload=function(e){t(e.target.result)},i.onerror=function(e){r(e.target.error)},i.readAsArrayBuffer(e)})):e})).then((function(t){var l=r.getTypeOf(t);return l?("arraybuffer"===l?t=r.transformTo("uint8array",t):"string"===l&&(u?t=n.decode(t):s&&!0!==a&&(t=function(e){return d(e,i.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){"use strict";var i=e("./reader/readerFor"),n=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function d(e){this.files=[],this.loadOptions=e}d.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4)===t;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",r=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,i=this.zip64EndOfCentralSize-44;0<i;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var i=t-r;if(0<i)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(e){this.reader=i(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){"use strict";var i=e("./reader/readerFor"),n=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),d=e("./compressions"),u=e("./support");function l(e,t){this.options=e,this.loadOptions=t}l.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in d)if(Object.prototype.hasOwnProperty.call(d,t)&&d[t].magic===e)return d[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,i,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),r=e.readInt(2),i=e.readData(r),this.extraFields[t]={id:t,length:r,value:i};e.setIndex(n)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var s=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){"use strict";function i(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var n=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),d=e("./stream/GenericWorker");i.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var i="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!i&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&i&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new d("error")).error(e)}return new n(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof d?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<u.length;c++)i.prototype[u[c]]=l;t.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){"use strict";var r,i,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var s=0,o=new n(l),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),r=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var d=new e.MessageChannel;d.port1.onmessage=l,r=function(){d.port2.postMessage(0)}}var u=[];function l(){var e,t;i=!0;for(var r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}i=!1}t.exports=function(e){1!==u.push(e)||i||r()}}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,r){"use strict";var i=e("immediate");function n(){}var s={},o=["REJECTED"],a=["FULFILLED"],d=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,e!==n&&h(this,e)}function l(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function c(e,t,r){i((function(){var i;try{i=t(r)}catch(i){return s.reject(e,i)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function p(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function i(t){r||(r=!0,s.reject(e,t))}function n(t){r||(r=!0,s.resolve(e,t))}var o=f((function(){t(n,i)}));"error"===o.status&&i(o.value)}function f(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(r){return t.resolve(e()).then((function(){return r}))}),(function(r){return t.resolve(e()).then((function(){throw r}))}))},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(n);return this.state!==d?c(r,this.state===a?e:t,this.outcome):this.queue.push(new l(r,e,t)),r},l.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){c(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){s.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){c(this.promise,this.onRejected,e)},s.resolve=function(e,t){var r=f(p,t);if("error"===r.status)return s.reject(e,r.value);var i=r.value;if(i)h(e,i);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,i=e.queue.length;++r<i;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(n),e)},u.reject=function(e){var t=new this(n);return s.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var o=new Array(r),a=0,d=-1,u=new this(n);++d<r;)l(e[d],d);return u;function l(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==r||i||(i=!0,s.resolve(u,o))}),(function(e){i||(i=!0,s.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var o,a=-1,d=new this(n);++a<r;)o=e[a],t.resolve(o).then((function(e){i||(i=!0,s.resolve(d,e))}),(function(e){i||(i=!0,s.reject(d,e))}));return d}},{immediate:36}],38:[function(e,t,r){"use strict";var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){"use strict";var i=e("./zlib/deflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),d=Object.prototype.toString,u=0,l=-1,c=0,p=8;function h(e){if(!(this instanceof h))return new h(e);this.options=n.assign({level:l,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:c,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==u)throw new Error(o[r]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var f;if(f="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===d.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=i.deflateSetDictionary(this.strm,f))!==u)throw new Error(o[r]);this._dict_set=!0}}function f(e,t){var r=new h(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}h.prototype.push=function(e,t){var r,o,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===d.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(l),a.next_out=0,a.avail_out=l),1!==(r=i.deflate(a,o))&&r!==u)return this.onEnd(r),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==r);return 4===o?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===u):2!==o||(this.onEnd(u),!(a.avail_out=0))},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===u&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=h,r.deflate=f,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,f(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){"use strict";var i=e("./zlib/inflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),d=e("./zlib/zstream"),u=e("./zlib/gzheader"),l=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,t.windowBits);if(r!==o.Z_OK)throw new Error(a[r]);this.header=new u,i.inflateGetHeader(this.strm,this.header)}function p(e,t){var r=new c(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}c.prototype.push=function(e,t){var r,a,d,u,c,p,h=this.strm,f=this.options.chunkSize,y=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?h.input=s.binstring2buf(e):"[object ArrayBuffer]"===l.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new n.Buf8(f),h.next_out=0,h.avail_out=f),(r=i.inflate(h,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&y&&(p="string"==typeof y?s.string2buf(y):"[object ArrayBuffer]"===l.call(y)?new Uint8Array(y):y,r=i.inflateSetDictionary(this.strm,p)),r===o.Z_BUF_ERROR&&!0===g&&(r=o.Z_OK,g=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),!(this.ended=!0);h.next_out&&(0!==h.avail_out&&r!==o.Z_STREAM_END&&(0!==h.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(d=s.utf8border(h.output,h.next_out),u=h.next_out-d,c=s.buf2string(h.output,d),h.next_out=u,h.avail_out=f-u,u&&n.arraySet(h.output,h.output,d,u,0),this.onData(c)):this.onData(n.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(g=!0)}while((0<h.avail_in||0===h.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(h.avail_out=0))},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=c,r.inflate=p,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,p(e,t)},r.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){var t,r,i,n,s,o;for(t=i=0,r=e.length;t<r;t++)i+=e[t].length;for(o=new Uint8Array(i),t=n=0,r=e.length;t<r;t++)s=e[t],o.set(s,n),n+=s.length;return o}},s={arraySet:function(e,t,r,i,n){for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(i)},{}],42:[function(e,t,r){"use strict";var i=e("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function d(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var r="",o=0;o<t;o++)r+=String.fromCharCode(e[o]);return r}o[254]=o[254]=1,r.string2buf=function(e){var t,r,n,s,o,a=e.length,d=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),d+=r<128?1:r<2048?2:r<65536?3:4;for(t=new i.Buf8(d),s=o=0;o<d;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t},r.buf2binstring=function(e){return d(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,i,n,s,a=t||e.length,u=new Array(2*a);for(r=i=0;r<a;)if((n=e[r++])<128)u[i++]=n;else if(4<(s=o[n]))u[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&r<a;)n=n<<6|63&e[r++],s--;1<s?u[i++]=65533:n<65536?u[i++]=n:(n-=65536,u[i++]=55296|n>>10&1023,u[i++]=56320|1023&n)}return d(u,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,i){for(var n=65535&e|0,s=e>>>16&65535|0,o=0;0!==r;){for(r-=o=2e3<r?2e3:r;s=s+(n=n+t[i++]|0)|0,--o;);n%=65521,s%=65521}return n|s<<16|0}},{}],44:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){"use strict";var i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var s=i,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){"use strict";var i,n=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),d=e("./messages"),u=0,l=4,c=0,p=-2,h=-1,f=4,y=2,g=8,m=9,v=286,b=30,_=19,w=2*v+1,E=15,T=3,S=258,R=S+T+1,O=42,I=113,x=1,A=2,C=3,k=4;function M(e,t){return e.msg=d[t],t}function N(e){return(e<<1)-(4<e?9:0)}function P(e){for(var t=e.length;0<=--t;)e[t]=0}function D(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function B(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,D(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function q(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function j(e,t){var r,i,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,d=e.strstart>e.w_size-R?e.strstart-(e.w_size-R):0,u=e.window,l=e.w_mask,c=e.prev,p=e.strstart+S,h=u[s+o-1],f=u[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+o]===f&&u[r+o-1]===h&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<p);if(i=S-(p-s),s=p-S,o<i){if(e.match_start=t,a<=(o=i))break;h=u[s+o-1],f=u[s+o]}}}while((t=c[t&l])>d&&0!=--n);return o<=e.lookahead?o:e.lookahead}function F(e){var t,r,i,s,d,u,l,c,p,h,f=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-R)){for(n.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=r=e.hash_size;i=e.head[--t],e.head[t]=f<=i?i-f:0,--r;);for(t=r=f;i=e.prev[--t],e.prev[t]=f<=i?i-f:0,--r;);s+=f}if(0===e.strm.avail_in)break;if(u=e.strm,l=e.window,c=e.strstart+e.lookahead,h=void 0,(p=s)<(h=u.avail_in)&&(h=p),r=0===h?0:(u.avail_in-=h,n.arraySet(l,u.input,u.next_in,h,c),1===u.state.wrap?u.adler=o(u.adler,l,h,c):2===u.state.wrap&&(u.adler=a(u.adler,l,h,c)),u.next_in+=h,u.total_in+=h,h),e.lookahead+=r,e.lookahead+e.insert>=T)for(d=e.strstart-e.insert,e.ins_h=e.window[d],e.ins_h=(e.ins_h<<e.hash_shift^e.window[d+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[d+T-1])&e.hash_mask,e.prev[d&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=d,d++,e.insert--,!(e.lookahead+e.insert<T)););}while(e.lookahead<R&&0!==e.strm.avail_in)}function U(e,t){for(var r,i;;){if(e.lookahead<R){if(F(e),e.lookahead<R&&t===u)return x;if(0===e.lookahead)break}if(r=0,e.lookahead>=T&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+T-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-R&&(e.match_length=j(e,r)),e.match_length>=T)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-T),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=T){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+T-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(B(e,!1),0===e.strm.avail_out))return x}return e.insert=e.strstart<T-1?e.strstart:T-1,t===l?(B(e,!0),0===e.strm.avail_out?C:k):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?x:A}function z(e,t){for(var r,i,n;;){if(e.lookahead<R){if(F(e),e.lookahead<R&&t===u)return x;if(0===e.lookahead)break}if(r=0,e.lookahead>=T&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+T-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=T-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-R&&(e.match_length=j(e,r),e.match_length<=5&&(1===e.strategy||e.match_length===T&&4096<e.strstart-e.match_start)&&(e.match_length=T-1)),e.prev_length>=T&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-T,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-T),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+T-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=T-1,e.strstart++,i&&(B(e,!1),0===e.strm.avail_out))return x}else if(e.match_available){if((i=s._tr_tally(e,0,e.window[e.strstart-1]))&&B(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return x}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<T-1?e.strstart:T-1,t===l?(B(e,!0),0===e.strm.avail_out?C:k):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?x:A}function H(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}function $(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(2*w),this.dyn_dtree=new n.Buf16(2*(2*b+1)),this.bl_tree=new n.Buf16(2*(2*_+1)),P(this.dyn_ltree),P(this.dyn_dtree),P(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(E+1),this.heap=new n.Buf16(2*v+1),P(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*v+1),P(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=y,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?O:I,e.adler=2===t.wrap?0:1,t.last_flush=u,s._tr_init(t),c):M(e,p)}function W(e){var t=G(e);return t===c&&function(e){e.window_size=2*e.w_size,P(e.head),e.max_lazy_match=i[e.level].max_lazy,e.good_match=i[e.level].good_length,e.nice_match=i[e.level].nice_length,e.max_chain_length=i[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=T-1,e.match_available=0,e.ins_h=0}(e.state),t}function V(e,t,r,i,s,o){if(!e)return p;var a=1;if(t===h&&(t=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),s<1||m<s||r!==g||i<8||15<i||t<0||9<t||o<0||f<o)return M(e,p);8===i&&(i=9);var d=new $;return(e.state=d).strm=e,d.wrap=a,d.gzhead=null,d.w_bits=i,d.w_size=1<<d.w_bits,d.w_mask=d.w_size-1,d.hash_bits=s+7,d.hash_size=1<<d.hash_bits,d.hash_mask=d.hash_size-1,d.hash_shift=~~((d.hash_bits+T-1)/T),d.window=new n.Buf8(2*d.w_size),d.head=new n.Buf16(d.hash_size),d.prev=new n.Buf16(d.w_size),d.lit_bufsize=1<<s+6,d.pending_buf_size=4*d.lit_bufsize,d.pending_buf=new n.Buf8(d.pending_buf_size),d.d_buf=1*d.lit_bufsize,d.l_buf=3*d.lit_bufsize,d.level=t,d.strategy=o,d.method=r,W(e)}i=[new H(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(F(e),0===e.lookahead&&t===u)return x;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,B(e,!1),0===e.strm.avail_out))return x;if(e.strstart-e.block_start>=e.w_size-R&&(B(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?C:k):(e.strstart>e.block_start&&(B(e,!1),e.strm.avail_out),x)})),new H(4,4,8,4,U),new H(4,5,16,8,U),new H(4,6,32,32,U),new H(4,4,16,16,z),new H(8,16,32,32,z),new H(8,16,128,128,z),new H(8,32,128,256,z),new H(32,128,258,1024,z),new H(32,258,258,4096,z)],r.deflateInit=function(e,t){return V(e,t,g,15,8,0)},r.deflateInit2=V,r.deflateReset=W,r.deflateResetKeep=G,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?p:(e.state.gzhead=t,c):p},r.deflate=function(e,t){var r,n,o,d;if(!e||!e.state||5<t||t<0)return e?M(e,p):p;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==l)return M(e,0===e.avail_out?-5:p);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===O)if(2===n.wrap)e.adler=0,L(n,31),L(n,139),L(n,8),n.gzhead?(L(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),L(n,255&n.gzhead.time),L(n,n.gzhead.time>>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=I);else{var h=g+(n.w_bits-8<<4)<<8;h|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(h|=32),h+=31-h%31,n.status=I,q(n,h),0!==n.strstart&&(q(n,e.adler>>>16),q(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),D(e),o=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),D(e),o=n.pending,n.pending===n.pending_buf_size)){d=1;break}d=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,L(n,d)}while(0!==d);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===d&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),D(e),o=n.pending,n.pending===n.pending_buf_size)){d=1;break}d=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,L(n,d)}while(0!==d);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===d&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&D(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=I)):n.status=I),0!==n.pending){if(D(e),0===e.avail_out)return n.last_flush=-1,c}else if(0===e.avail_in&&N(t)<=N(r)&&t!==l)return M(e,-5);if(666===n.status&&0!==e.avail_in)return M(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var f=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(F(e),0===e.lookahead)){if(t===u)return x;break}if(e.match_length=0,r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(B(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?C:k):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?x:A}(n,t):3===n.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=S){if(F(e),e.lookahead<=S&&t===u)return x;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=T&&0<e.strstart&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+S;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=S-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=T?(r=s._tr_tally(e,1,e.match_length-T),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(B(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?C:k):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?x:A}(n,t):i[n.level].func(n,t);if(f!==C&&f!==k||(n.status=666),f===x||f===C)return 0===e.avail_out&&(n.last_flush=-1),c;if(f===A&&(1===t?s._tr_align(n):5!==t&&(s._tr_stored_block(n,0,0,!1),3===t&&(P(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),D(e),0===e.avail_out))return n.last_flush=-1,c}return t!==l?c:n.wrap<=0?1:(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(q(n,e.adler>>>16),q(n,65535&e.adler)),D(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?c:1)},r.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==O&&69!==t&&73!==t&&91!==t&&103!==t&&t!==I&&666!==t?M(e,p):(e.state=null,t===I?M(e,-3):c):p},r.deflateSetDictionary=function(e,t){var r,i,s,a,d,u,l,h,f=t.length;if(!e||!e.state)return p;if(2===(a=(r=e.state).wrap)||1===a&&r.status!==O||r.lookahead)return p;for(1===a&&(e.adler=o(e.adler,t,f,0)),r.wrap=0,f>=r.w_size&&(0===a&&(P(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new n.Buf8(r.w_size),n.arraySet(h,t,f-r.w_size,r.w_size,0),t=h,f=r.w_size),d=e.avail_in,u=e.next_in,l=e.input,e.avail_in=f,e.next_in=0,e.input=t,F(r);r.lookahead>=T;){for(i=r.strstart,s=r.lookahead-(T-1);r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+T-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,--s;);r.strstart=i,r.lookahead=T-1,F(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=T-1,r.match_available=0,e.next_in=u,e.input=l,e.avail_in=d,r.wrap=a,c},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n,s,o,a,d,u,l,c,p,h,f,y,g,m,v,b,_,w,E,T,S,R,O;r=e.state,i=e.next_in,R=e.input,n=i+(e.avail_in-5),s=e.next_out,O=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),d=r.dmax,u=r.wsize,l=r.whave,c=r.wnext,p=r.window,h=r.hold,f=r.bits,y=r.lencode,g=r.distcode,m=(1<<r.lenbits)-1,v=(1<<r.distbits)-1;e:do{f<15&&(h+=R[i++]<<f,f+=8,h+=R[i++]<<f,f+=8),b=y[h&m];t:for(;;){if(h>>>=_=b>>>24,f-=_,0==(_=b>>>16&255))O[s++]=65535&b;else{if(!(16&_)){if(0==(64&_)){b=y[(65535&b)+(h&(1<<_)-1)];continue t}if(32&_){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}w=65535&b,(_&=15)&&(f<_&&(h+=R[i++]<<f,f+=8),w+=h&(1<<_)-1,h>>>=_,f-=_),f<15&&(h+=R[i++]<<f,f+=8,h+=R[i++]<<f,f+=8),b=g[h&v];r:for(;;){if(h>>>=_=b>>>24,f-=_,!(16&(_=b>>>16&255))){if(0==(64&_)){b=g[(65535&b)+(h&(1<<_)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&b,f<(_&=15)&&(h+=R[i++]<<f,(f+=8)<_&&(h+=R[i++]<<f,f+=8)),d<(E+=h&(1<<_)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(h>>>=_,f-=_,(_=s-o)<E){if(l<(_=E-_)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=p,(T=0)===c){if(T+=u-_,_<w){for(w-=_;O[s++]=p[T++],--_;);T=s-E,S=O}}else if(c<_){if(T+=u+c-_,(_-=c)<w){for(w-=_;O[s++]=p[T++],--_;);if(T=0,c<w){for(w-=_=c;O[s++]=p[T++],--_;);T=s-E,S=O}}}else if(T+=c-_,_<w){for(w-=_;O[s++]=p[T++],--_;);T=s-E,S=O}for(;2<w;)O[s++]=S[T++],O[s++]=S[T++],O[s++]=S[T++],w-=3;w&&(O[s++]=S[T++],1<w&&(O[s++]=S[T++]))}else{for(T=s-E;O[s++]=O[T++],O[s++]=O[T++],O[s++]=O[T++],2<(w-=3););w&&(O[s++]=O[T++],1<w&&(O[s++]=O[T++]))}break}}break}}while(i<n&&s<a);i-=w=f>>3,h&=(1<<(f-=w<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=s<a?a-s+257:257-(s-a),r.hold=h,r.bits=f}},{}],49:[function(e,t,r){"use strict";var i=e("../utils/common"),n=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),d=1,u=2,l=0,c=-2,p=1,h=852,f=592;function y(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function m(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=p,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(h),t.distcode=t.distdyn=new i.Buf32(f),t.sane=1,t.back=-1,l):c}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,m(e)):c}function b(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?c:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,v(e))):c}function _(e,t){var r,i;return e?(i=new g,(e.state=i).window=null,(r=b(e,t))!==l&&(e.state=null),r):c}var w,E,T=!0;function S(e){if(T){var t;for(w=new i.Buf32(512),E=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(d,e.lens,0,288,w,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(u,e.lens,0,32,E,0,e.work,{bits:5}),T=!1}e.lencode=w,e.lenbits=9,e.distcode=E,e.distbits=5}function R(e,t,r,n){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new i.Buf8(o.wsize)),n>=o.wsize?(i.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(s=o.wsize-o.wnext)&&(s=n),i.arraySet(o.window,t,r-n,s,o.wnext),(n-=s)?(i.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}r.inflateReset=v,r.inflateReset2=b,r.inflateResetKeep=m,r.inflateInit=function(e){return _(e,15)},r.inflateInit2=_,r.inflate=function(e,t){var r,h,f,g,m,v,b,_,w,E,T,O,I,x,A,C,k,M,N,P,D,B,L,q,j=0,F=new i.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return c;12===(r=e.state).mode&&(r.mode=13),m=e.next_out,f=e.output,b=e.avail_out,g=e.next_in,h=e.input,v=e.avail_in,_=r.hold,w=r.bits,E=v,T=b,B=l;e:for(;;)switch(r.mode){case p:if(0===r.wrap){r.mode=13;break}for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(2&r.wrap&&35615===_){F[r.check=0]=255&_,F[1]=_>>>8&255,r.check=s(r.check,F,2,0),w=_=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&_)<<8)+(_>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&_)){e.msg="unknown compression method",r.mode=30;break}if(w-=4,D=8+(15&(_>>>=4)),0===r.wbits)r.wbits=D;else if(D>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<D,e.adler=r.check=1,r.mode=512&_?10:12,w=_=0;break;case 2:for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(r.flags=_,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=_>>8&1),512&r.flags&&(F[0]=255&_,F[1]=_>>>8&255,r.check=s(r.check,F,2,0)),w=_=0,r.mode=3;case 3:for(;w<32;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.head&&(r.head.time=_),512&r.flags&&(F[0]=255&_,F[1]=_>>>8&255,F[2]=_>>>16&255,F[3]=_>>>24&255,r.check=s(r.check,F,4,0)),w=_=0,r.mode=4;case 4:for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.head&&(r.head.xflags=255&_,r.head.os=_>>8),512&r.flags&&(F[0]=255&_,F[1]=_>>>8&255,r.check=s(r.check,F,2,0)),w=_=0,r.mode=5;case 5:if(1024&r.flags){for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.length=_,r.head&&(r.head.extra_len=_),512&r.flags&&(F[0]=255&_,F[1]=_>>>8&255,r.check=s(r.check,F,2,0)),w=_=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(v<(O=r.length)&&(O=v),O&&(r.head&&(D=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,h,g,O,D)),512&r.flags&&(r.check=s(r.check,h,O,g)),v-=O,g+=O,r.length-=O),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===v)break e;for(O=0;D=h[g+O++],r.head&&D&&r.length<65536&&(r.head.name+=String.fromCharCode(D)),D&&O<v;);if(512&r.flags&&(r.check=s(r.check,h,O,g)),v-=O,g+=O,D)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===v)break e;for(O=0;D=h[g+O++],r.head&&D&&r.length<65536&&(r.head.comment+=String.fromCharCode(D)),D&&O<v;);if(512&r.flags&&(r.check=s(r.check,h,O,g)),v-=O,g+=O,D)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(_!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}w=_=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;w<32;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}e.adler=r.check=y(_),w=_=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=m,e.avail_out=b,e.next_in=g,e.avail_in=v,r.hold=_,r.bits=w,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){_>>>=7&w,w-=7&w,r.mode=27;break}for(;w<3;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}switch(r.last=1&_,w-=1,3&(_>>>=1)){case 0:r.mode=14;break;case 1:if(S(r),r.mode=20,6!==t)break;_>>>=2,w-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}_>>>=2,w-=2;break;case 14:for(_>>>=7&w,w-=7&w;w<32;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if((65535&_)!=(_>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&_,w=_=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(O=r.length){if(v<O&&(O=v),b<O&&(O=b),0===O)break e;i.arraySet(f,h,g,O,m),v-=O,g+=O,b-=O,m+=O,r.length-=O;break}r.mode=12;break;case 17:for(;w<14;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(r.nlen=257+(31&_),_>>>=5,w-=5,r.ndist=1+(31&_),_>>>=5,w-=5,r.ncode=4+(15&_),_>>>=4,w-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;w<3;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.lens[U[r.have++]]=7&_,_>>>=3,w-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,L={bits:r.lenbits},B=a(0,r.lens,0,19,r.lencode,0,r.work,L),r.lenbits=L.bits,B){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;C=(j=r.lencode[_&(1<<r.lenbits)-1])>>>16&255,k=65535&j,!((A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(k<16)_>>>=A,w-=A,r.lens[r.have++]=k;else{if(16===k){for(q=A+2;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(_>>>=A,w-=A,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}D=r.lens[r.have-1],O=3+(3&_),_>>>=2,w-=2}else if(17===k){for(q=A+3;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}w-=A,D=0,O=3+(7&(_>>>=A)),_>>>=3,w-=3}else{for(q=A+7;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}w-=A,D=0,O=11+(127&(_>>>=A)),_>>>=7,w-=7}if(r.have+O>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;O--;)r.lens[r.have++]=D}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,L={bits:r.lenbits},B=a(d,r.lens,0,r.nlen,r.lencode,0,r.work,L),r.lenbits=L.bits,B){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,L={bits:r.distbits},B=a(u,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,L),r.distbits=L.bits,B){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=v&&258<=b){e.next_out=m,e.avail_out=b,e.next_in=g,e.avail_in=v,r.hold=_,r.bits=w,o(e,T),m=e.next_out,f=e.output,b=e.avail_out,g=e.next_in,h=e.input,v=e.avail_in,_=r.hold,w=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;C=(j=r.lencode[_&(1<<r.lenbits)-1])>>>16&255,k=65535&j,!((A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(C&&0==(240&C)){for(M=A,N=C,P=k;C=(j=r.lencode[P+((_&(1<<M+N)-1)>>M)])>>>16&255,k=65535&j,!(M+(A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}_>>>=M,w-=M,r.back+=M}if(_>>>=A,w-=A,r.back+=A,r.length=k,0===C){r.mode=26;break}if(32&C){r.back=-1,r.mode=12;break}if(64&C){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&C,r.mode=22;case 22:if(r.extra){for(q=r.extra;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.length+=_&(1<<r.extra)-1,_>>>=r.extra,w-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;C=(j=r.distcode[_&(1<<r.distbits)-1])>>>16&255,k=65535&j,!((A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(0==(240&C)){for(M=A,N=C,P=k;C=(j=r.distcode[P+((_&(1<<M+N)-1)>>M)])>>>16&255,k=65535&j,!(M+(A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}_>>>=M,w-=M,r.back+=M}if(_>>>=A,w-=A,r.back+=A,64&C){e.msg="invalid distance code",r.mode=30;break}r.offset=k,r.extra=15&C,r.mode=24;case 24:if(r.extra){for(q=r.extra;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.offset+=_&(1<<r.extra)-1,_>>>=r.extra,w-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===b)break e;if(O=T-b,r.offset>O){if((O=r.offset-O)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}I=O>r.wnext?(O-=r.wnext,r.wsize-O):r.wnext-O,O>r.length&&(O=r.length),x=r.window}else x=f,I=m-r.offset,O=r.length;for(b<O&&(O=b),b-=O,r.length-=O;f[m++]=x[I++],--O;);0===r.length&&(r.mode=21);break;case 26:if(0===b)break e;f[m++]=r.length,b--,r.mode=21;break;case 27:if(r.wrap){for(;w<32;){if(0===v)break e;v--,_|=h[g++]<<w,w+=8}if(T-=b,e.total_out+=T,r.total+=T,T&&(e.adler=r.check=r.flags?s(r.check,f,T,m-T):n(r.check,f,T,m-T)),T=b,(r.flags?_:y(_))!==r.check){e.msg="incorrect data check",r.mode=30;break}w=_=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;w<32;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(_!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}w=_=0}r.mode=29;case 29:B=1;break e;case 30:B=-3;break e;case 31:return-4;default:return c}return e.next_out=m,e.avail_out=b,e.next_in=g,e.avail_in=v,r.hold=_,r.bits=w,(r.wsize||T!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&R(e,e.output,e.next_out,T-e.avail_out)?(r.mode=31,-4):(E-=e.avail_in,T-=e.avail_out,e.total_in+=E,e.total_out+=T,r.total+=T,r.wrap&&T&&(e.adler=r.check=r.flags?s(r.check,f,T,e.next_out-T):n(r.check,f,T,e.next_out-T)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==E&&0===T||4===t)&&B===l&&(B=-5),B)},r.inflateEnd=function(e){if(!e||!e.state)return c;var t=e.state;return t.window&&(t.window=null),e.state=null,l},r.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?c:((r.head=t).done=!1,l):c},r.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?c:11===r.mode&&n(1,t,i,0)!==r.check?-3:R(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,l):c},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){"use strict";var i=e("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,d,u,l,c,p){var h,f,y,g,m,v,b,_,w,E=p.bits,T=0,S=0,R=0,O=0,I=0,x=0,A=0,C=0,k=0,M=0,N=null,P=0,D=new i.Buf16(16),B=new i.Buf16(16),L=null,q=0;for(T=0;T<=15;T++)D[T]=0;for(S=0;S<d;S++)D[t[r+S]]++;for(I=E,O=15;1<=O&&0===D[O];O--);if(O<I&&(I=O),0===O)return u[l++]=20971520,u[l++]=20971520,p.bits=1,0;for(R=1;R<O&&0===D[R];R++);for(I<R&&(I=R),T=C=1;T<=15;T++)if(C<<=1,(C-=D[T])<0)return-1;if(0<C&&(0===e||1!==O))return-1;for(B[1]=0,T=1;T<15;T++)B[T+1]=B[T]+D[T];for(S=0;S<d;S++)0!==t[r+S]&&(c[B[t[r+S]]++]=S);if(v=0===e?(N=L=c,19):1===e?(N=n,P-=257,L=s,q-=257,256):(N=o,L=a,-1),T=R,m=l,A=S=M=0,y=-1,g=(k=1<<(x=I))-1,1===e&&852<k||2===e&&592<k)return 1;for(;;){for(b=T-A,w=c[S]<v?(_=0,c[S]):c[S]>v?(_=L[q+c[S]],N[P+c[S]]):(_=96,0),h=1<<T-A,R=f=1<<x;u[m+(M>>A)+(f-=h)]=b<<24|_<<16|w|0,0!==f;);for(h=1<<T-1;M&h;)h>>=1;if(0!==h?(M&=h-1,M+=h):M=0,S++,0==--D[T]){if(T===O)break;T=t[r+c[S]]}if(I<T&&(M&g)!==y){for(0===A&&(A=I),m+=R,C=1<<(x=T-A);x+A<O&&!((C-=D[x+A])<=0);)x++,C<<=1;if(k+=1<<x,1===e&&852<k||2===e&&592<k)return 1;u[y=M&g]=I<<24|x<<16|m-l|0}}return 0!==M&&(u[m+M]=T-A<<24|64<<16|0),p.bits=I,0}},{"../utils/common":41}],51:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){"use strict";var i=e("../utils/common"),n=0,s=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0}var a=0,d=29,u=256,l=u+1+d,c=30,p=19,h=2*l+1,f=15,y=16,g=7,m=256,v=16,b=17,_=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],R=new Array(2*(l+2));o(R);var O=new Array(2*c);o(O);var I=new Array(512);o(I);var x=new Array(256);o(x);var A=new Array(d);o(A);var C,k,M,N=new Array(c);function P(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function D(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function B(e){return e<256?I[e]:I[256+(e>>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function q(e,t,r){e.bi_valid>y-r?(e.bi_buf|=t<<e.bi_valid&65535,L(e,e.bi_buf),e.bi_buf=t>>y-e.bi_valid,e.bi_valid+=r-y):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function j(e,t,r){q(e,r[2*t],r[2*t+1])}function F(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function U(e,t,r){var i,n,s=new Array(f+1),o=0;for(i=1;i<=f;i++)s[i]=o=o+r[i-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=F(s[a]++,a))}}function z(e){var t;for(t=0;t<l;t++)e.dyn_ltree[2*t]=0;for(t=0;t<c;t++)e.dyn_dtree[2*t]=0;for(t=0;t<p;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*m]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function H(e){8<e.bi_valid?L(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function $(e,t,r,i){var n=2*t,s=2*r;return e[n]<e[s]||e[n]===e[s]&&i[t]<=i[r]}function G(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&$(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!$(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function W(e,t,r){var i,n,s,o,a=0;if(0!==e.last_lit)for(;i=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],n=e.pending_buf[e.l_buf+a],a++,0===i?j(e,n,t):(j(e,(s=x[n])+u+1,t),0!==(o=w[s])&&q(e,n-=A[s],o),j(e,s=B(--i),r),0!==(o=E[s])&&q(e,i-=N[s],o)),a<e.last_lit;);j(e,m,t)}function V(e,t){var r,i,n,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,d=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=h,r=0;r<d;r++)0!==s[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=u,r=e.heap_len>>1;1<=r;r--)G(e,s,r);for(n=d;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,s[2*n]=s[2*r]+s[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,s[2*r+1]=s[2*i+1]=n,e.heap[1]=n++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,s,o,a,d=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,c=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,y=t.stat_desc.extra_base,g=t.stat_desc.max_length,m=0;for(s=0;s<=f;s++)e.bl_count[s]=0;for(d[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<h;r++)g<(s=d[2*d[2*(i=e.heap[r])+1]+1]+1)&&(s=g,m++),d[2*i+1]=s,u<i||(e.bl_count[s]++,o=0,y<=i&&(o=p[i-y]),a=d[2*i],e.opt_len+=a*(s+o),c&&(e.static_len+=a*(l[2*i+1]+o)));if(0!==m){do{for(s=g-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[g]--,m-=2}while(0<m);for(s=g;0!==s;s--)for(i=e.bl_count[s];0!==i;)u<(n=e.heap[--r])||(d[2*n+1]!==s&&(e.opt_len+=(s-d[2*n+1])*d[2*n],d[2*n+1]=s),i--)}}(e,t),U(s,u,e.bl_count)}function K(e,t,r){var i,n,s=-1,o=t[1],a=0,d=7,u=4;for(0===o&&(d=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=t[2*(i+1)+1],++a<d&&n===o||(a<u?e.bl_tree[2*n]+=a:0!==n?(n!==s&&e.bl_tree[2*n]++,e.bl_tree[2*v]++):a<=10?e.bl_tree[2*b]++:e.bl_tree[2*_]++,s=n,u=(a=0)===o?(d=138,3):n===o?(d=6,3):(d=7,4))}function Y(e,t,r){var i,n,s=-1,o=t[1],a=0,d=7,u=4;for(0===o&&(d=138,u=3),i=0;i<=r;i++)if(n=o,o=t[2*(i+1)+1],!(++a<d&&n===o)){if(a<u)for(;j(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==s&&(j(e,n,e.bl_tree),a--),j(e,v,e.bl_tree),q(e,a-3,2)):a<=10?(j(e,b,e.bl_tree),q(e,a-3,3)):(j(e,_,e.bl_tree),q(e,a-11,7));s=n,u=(a=0)===o?(d=138,3):n===o?(d=6,3):(d=7,4)}}o(N);var X=!1;function Z(e,t,r,n){q(e,(a<<1)+(n?1:0),3),function(e,t,r,n){H(e),n&&(L(e,r),L(e,~r)),i.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}r._tr_init=function(e){X||(function(){var e,t,r,i,n,s=new Array(f+1);for(i=r=0;i<d-1;i++)for(A[i]=r,e=0;e<1<<w[i];e++)x[r++]=i;for(x[r-1]=i,i=n=0;i<16;i++)for(N[i]=n,e=0;e<1<<E[i];e++)I[n++]=i;for(n>>=7;i<c;i++)for(N[i]=n<<7,e=0;e<1<<E[i]-7;e++)I[256+n++]=i;for(t=0;t<=f;t++)s[t]=0;for(e=0;e<=143;)R[2*e+1]=8,e++,s[8]++;for(;e<=255;)R[2*e+1]=9,e++,s[9]++;for(;e<=279;)R[2*e+1]=7,e++,s[7]++;for(;e<=287;)R[2*e+1]=8,e++,s[8]++;for(U(R,l+1,s),e=0;e<c;e++)O[2*e+1]=5,O[2*e]=F(e,5);C=new P(R,w,u+1,l,f),k=new P(O,E,0,c,f),M=new P(new Array(0),T,0,p,g)}(),X=!0),e.l_desc=new D(e.dyn_ltree,C),e.d_desc=new D(e.dyn_dtree,k),e.bl_desc=new D(e.bl_tree,M),e.bi_buf=0,e.bi_valid=0,z(e)},r._tr_stored_block=Z,r._tr_flush_block=function(e,t,r,i){var o,a,d=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t<u;t++)if(0!==e.dyn_ltree[2*t])return s;return n}(e)),V(e,e.l_desc),V(e,e.d_desc),d=function(e){var t;for(K(e,e.dyn_ltree,e.l_desc.max_code),K(e,e.dyn_dtree,e.d_desc.max_code),V(e,e.bl_desc),t=p-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=r+5,r+4<=o&&-1!==t?Z(e,t,r,i):4===e.strategy||a===o?(q(e,2+(i?1:0),3),W(e,R,O)):(q(e,4+(i?1:0),3),function(e,t,r,i){var n;for(q(e,t-257,5),q(e,r-1,5),q(e,i-4,4),n=0;n<i;n++)q(e,e.bl_tree[2*S[n]+1],3);Y(e,e.dyn_ltree,t-1),Y(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,d+1),W(e,e.dyn_ltree,e.dyn_dtree)),z(e),i&&H(e)},r._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(x[r]+u+1)]++,e.dyn_dtree[2*B(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){q(e,2,3),j(e,m,R),function(e){16===e.bi_valid?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var r,i,n,s,o=1,a={},d=!1,u=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,r="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){p(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?(s="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(s+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){p(e.data)},function(e){n.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(i=u.documentElement,function(e){var t=u.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(p,0,e)},l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];var n={callback:e,args:t};return a[o]=n,r(o),o++},l.clearImmediate=c}function c(e){delete a[e]}function p(e){if(d)setTimeout(p,0,e);else{var r=a[e];if(r){d=!0;try{!function(e){var r=e.callback,i=e.args;switch(i.length){case 0:r();break;case 1:r(i[0]);break;case 2:r(i[0],i[1]);break;case 3:r(i[0],i[1],i[2]);break;default:r.apply(t,i)}}(r)}finally{c(e),d=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&p(+t.data.slice(s.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)},857:(e,t,r)=>{var i=r(7772).Symbol;e.exports=i},3366:(e,t,r)=>{var i=r(857),n=r(2107),s=r(7157),o=i?i.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?n(e):s(e)}},1242:(e,t,r)=>{var i="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=i},7353:(e,t,r)=>{var i=r(241)(Object.getPrototypeOf,Object);e.exports=i},2107:(e,t,r)=>{var i=r(857),n=Object.prototype,s=n.hasOwnProperty,o=n.toString,a=i?i.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),r=e[a];try{e[a]=void 0;var i=!0}catch(e){}var n=o.call(e);return i&&(t?e[a]=r:delete e[a]),n}},7157:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},241:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},7772:(e,t,r)=>{var i=r(1242),n="object"==typeof self&&self&&self.Object===Object&&self,s=i||n||Function("return this")();e.exports=s},6152:e=>{var t=Array.isArray;e.exports=t},1049:(e,t,r)=>{var i=r(3366),n=r(9259);e.exports=function(e){if(!n(e))return!1;var t=i(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},9259:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},5125:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},7030:(e,t,r)=>{var i=r(3366),n=r(7353),s=r(5125),o=Function.prototype,a=Object.prototype,d=o.toString,u=a.hasOwnProperty,l=d.call(Object);e.exports=function(e){if(!s(e)||"[object Object]"!=i(e))return!1;var t=n(e);if(null===t)return!0;var r=u.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&d.call(r)==l}},5505:(e,t,r)=>{var i=r(3366),n=r(6152),s=r(5125);e.exports=function(e){return"string"==typeof e||!n(e)&&s(e)&&"[object String]"==i(e)}},7808:e=>{e.exports=r;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=i;var n={},s={};function o(e,t){var r,i,o;return t?(o=0<=(e>>>=0)&&e<256)&&(i=s[e])?i:(r=d(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=n[e])?i:(r=d(e,e<0?-1:0,!1),o&&(n[e]=r),r)}function a(e,t){if(isNaN(e))return t?m:g;if(t){if(e<0)return m;if(e>=h)return E}else{if(e<=-f)return T;if(e+1>=f)return w}return e<0?a(-e,t).neg():d(e%p|0,e/p|0,t)}function d(e,t,i){return new r(e,t,i)}r.fromInt=o,r.fromNumber=a,r.fromBits=d;var u=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return l(e.substring(1),t,r).neg();for(var n=a(u(r,8)),s=g,o=0;o<e.length;o+=8){var d=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+d),r);if(d<8){var p=a(u(r,d));s=s.mul(p).add(a(c))}else s=(s=s.mul(n)).add(a(c))}return s.unsigned=t,s}function c(e,t){return"number"==typeof e?a(e,t):"string"==typeof e?l(e,t):d(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}r.fromString=l,r.fromValue=c;var p=4294967296,h=p*p,f=h/2,y=o(1<<24),g=o(0);r.ZERO=g;var m=o(0,!0);r.UZERO=m;var v=o(1);r.ONE=v;var b=o(1,!0);r.UONE=b;var _=o(-1);r.NEG_ONE=_;var w=d(-1,2147483647,!1);r.MAX_VALUE=w;var E=d(-1,-1,!0);r.MAX_UNSIGNED_VALUE=E;var T=d(0,-2147483648,!1);r.MIN_VALUE=T;var S=r.prototype;S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},S.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(T)){var t=a(e),r=this.div(t),i=r.mul(t).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=a(u(e,6),this.unsigned),s=this,o="";;){var d=s.div(n),l=(s.sub(d.mul(n)).toInt()>>>0).toString(e);if((s=d).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},S.isZero=function(){return 0===this.high&&0===this.low},S.eqz=S.isZero,S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return 1==(1&this.low)},S.isEven=function(){return 0==(1&this.low)},S.equals=function(e){return i(e)||(e=c(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.ne=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.le=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.ge=S.greaterThanOrEqual,S.compare=function(e){if(i(e)||(e=c(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(v)},S.neg=S.negate,S.add=function(e){i(e)||(e=c(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,u=e.low>>>16,l=0,p=0,h=0,f=0;return h+=(f+=s+(65535&e.low))>>>16,p+=(h+=n+u)>>>16,l+=(p+=r+a)>>>16,l+=t+o,d((h&=65535)<<16|(f&=65535),(l&=65535)<<16|(p&=65535),this.unsigned)},S.subtract=function(e){return i(e)||(e=c(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){if(this.isZero())return g;if(i(e)||(e=c(e)),t)return d(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(T))return e.isOdd()?T:g;if(e.eq(T))return this.isOdd()?T:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(y)&&e.lt(y))return a(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,n=65535&this.high,s=this.low>>>16,o=65535&this.low,u=e.high>>>16,l=65535&e.high,p=e.low>>>16,h=65535&e.low,f=0,m=0,v=0,b=0;return v+=(b+=o*h)>>>16,m+=(v+=s*h)>>>16,v&=65535,m+=(v+=o*p)>>>16,f+=(m+=n*h)>>>16,m&=65535,f+=(m+=s*p)>>>16,m&=65535,f+=(m+=o*l)>>>16,f+=r*h+n*p+s*l+o*u,d((v&=65535)<<16|(b&=65535),(f&=65535)<<16|(m&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(e){if(i(e)||(e=c(e)),e.isZero())throw Error("division by zero");var r,n,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?d((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return b;s=m}else{if(this.eq(T))return e.eq(v)||e.eq(_)?T:e.eq(T)?v:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:_:(n=this.sub(e.mul(r)),s=r.add(n.div(e)));if(e.eq(T))return this.unsigned?m:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=g}for(n=this;n.gte(e);){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),l=o<=48?1:u(2,o-48),p=a(r),h=p.mul(e);h.isNegative()||h.gt(n);)h=(p=a(r-=l,this.unsigned)).mul(e);p.isZero()&&(p=v),s=s.add(p),n=n.sub(h)}return s},S.div=S.divide,S.modulo=function(e){return i(e)||(e=c(e)),t?d((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.rem=S.modulo,S.not=function(){return d(~this.low,~this.high,this.unsigned)},S.and=function(e){return i(e)||(e=c(e)),d(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return i(e)||(e=c(e)),d(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return i(e)||(e=c(e)),d(this.low^e.low,this.high^e.high,this.unsigned)},S.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?d(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):d(0,this.low<<e-32,this.unsigned)},S.shl=S.shiftLeft,S.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?d(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):d(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?d(this.low>>>e|t<<32-e,t>>>e,this.unsigned):d(32===e?t:t>>>e-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?d(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:d(this.low,this.high,!0)},S.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},S.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},S.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,i){return i?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},7105:(e,t,r)=>{"use strict";const i=r(8006),n=Symbol("max"),s=Symbol("length"),o=Symbol("lengthCalculator"),a=Symbol("allowStale"),d=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),c=Symbol("lruList"),p=Symbol("cache"),h=Symbol("updateAgeOnGet"),f=()=>1;const y=(e,t,r)=>{const i=e[p].get(t);if(i){const t=i.value;if(g(e,t)){if(v(e,i),!e[a])return}else r&&(e[h]&&(i.value.now=Date.now()),e[c].unshiftNode(i));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[d])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[d]&&r>e[d]},m=e=>{if(e[s]>e[n])for(let t=e[c].tail;e[s]>e[n]&&null!==t;){const r=t.prev;v(e,t),t=r}},v=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[s]-=r.length,e[p].delete(r.key),e[c].removeNode(t)}};class b{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const _=(e,t,r,i)=>{let n=r.value;g(e,n)&&(v(e,r),e[a]||(n=void 0)),n&&t.call(i,n.value,n.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[n]=e.max||1/0;const t=e.length||f;if(this[o]="function"!=typeof t?f:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[d]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[h]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[n]=e||1/0,m(this)}get max(){return this[n]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[d]=e,m(this)}get maxAge(){return this[d]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[o]&&(this[o]=e,this[s]=0,this[c].forEach((e=>{e.length=this[o](e.value,e.key),this[s]+=e.length}))),m(this)}get lengthCalculator(){return this[o]}get length(){return this[s]}get itemCount(){return this[c].length}rforEach(e,t){t=t||this;for(let r=this[c].tail;null!==r;){const i=r.prev;_(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[c].head;null!==r;){const i=r.next;_(this,e,r,t),r=i}}keys(){return this[c].toArray().map((e=>e.key))}values(){return this[c].toArray().map((e=>e.value))}reset(){this[u]&&this[c]&&this[c].length&&this[c].forEach((e=>this[u](e.key,e.value))),this[p]=new Map,this[c]=new i,this[s]=0}dump(){return this[c].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[c]}set(e,t,r){if((r=r||this[d])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const i=r?Date.now():0,a=this[o](t,e);if(this[p].has(e)){if(a>this[n])return v(this,this[p].get(e)),!1;const o=this[p].get(e).value;return this[u]&&(this[l]||this[u](e,o.value)),o.now=i,o.maxAge=r,o.value=t,this[s]+=a-o.length,o.length=a,this.get(e),m(this),!0}const h=new b(e,t,a,i,r);return h.length>this[n]?(this[u]&&this[u](e,t),!1):(this[s]+=h.length,this[c].unshift(h),this[p].set(e,this[c].head),m(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!g(this,t)}get(e){return y(this,e,!0)}peek(e){return y(this,e,!1)}pop(){const e=this[c].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const i=e[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const e=n-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[p].forEach(((e,t)=>y(this,t,!1)))}}},1378:e=>{var t=1e3,r=60*t,i=60*r,n=24*i,s=7*n,o=365.25*n;function a(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,d){d=d||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var d=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return d*o;case"weeks":case"week":case"w":return d*s;case"days":case"day":case"d":return d*n;case"hours":case"hour":case"hrs":case"hr":case"h":return d*i;case"minutes":case"minute":case"mins":case"min":case"m":return d*r;case"seconds":case"second":case"secs":case"sec":case"s":return d*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}(e);if("number"===u&&isFinite(e))return d.long?function(e){var s=Math.abs(e);if(s>=n)return a(e,s,n,"day");if(s>=i)return a(e,s,i,"hour");if(s>=r)return a(e,s,r,"minute");if(s>=t)return a(e,s,t,"second");return e+" ms"}(e):function(e){var s=Math.abs(e);if(s>=n)return Math.round(e/n)+"d";if(s>=i)return Math.round(e/i)+"h";if(s>=r)return Math.round(e/r)+"m";if(s>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},3448:(e,t,r)=>{"use strict";e.exports=r(9188)},3746:(e,t,r)=>{"use strict";var i=t,n=r(6901),s=r(8066);function o(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(d%s){",i);for(var s=t.resolvedType.values,o=Object.keys(s),a=0;a<o.length;++a)t.repeated&&s[o[a]]===t.typeDefault&&e("default:"),e("case%j:",o[a])("case %i:",s[o[a]])("m%s=%j",i,s[o[a]])("break");e("}")}else e('if(typeof d%s!=="object")',i)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",i,r,i);else{var d=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",i,i);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",i,i);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",i,i);break;case"uint64":d=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",i,i,d)('else if(typeof d%s==="string")',i)("m%s=parseInt(d%s,10)",i,i)('else if(typeof d%s==="number")',i)("m%s=d%s",i,i)('else if(typeof d%s==="object")',i)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",i,i,i,d?"true":"");break;case"bytes":e('if(typeof d%s==="string")',i)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",i,i,i)("else if(d%s.length)",i)("m%s=d%s",i,i);break;case"string":e("m%s=String(d%s)",i,i);break;case"bool":e("m%s=Boolean(d%s)",i,i)}}return e}function a(e,t,r,i){if(t.resolvedType)t.resolvedType instanceof n?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",i,r,i,i):e("d%s=types[%i].toObject(m%s,o)",i,r,i);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",i,i,i,i);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',i)("d%s=o.longs===String?String(m%s):m%s",i,i,i)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",i,i,i,i,s?"true":"",i);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",i,i,i,i,i);break;default:e("d%s=m%s",i,i)}}return e}i.fromObject=function(e){var t=e.fieldsArray,r=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var i=0;i<t.length;++i){var a=t[i].resolve(),d=s.safeProp(a.name);a.map?(r("if(d%s){",d)('if(typeof d%s!=="object")',d)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",d)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",d),o(r,a,i,d+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",d)("if(!Array.isArray(d%s))",d)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",d)("for(var i=0;i<d%s.length;++i){",d),o(r,a,i,d+"[i]")("}")("}")):(a.resolvedType instanceof n||r("if(d%s!=null){",d),o(r,a,i,d),a.resolvedType instanceof n||r("}"))}return r("return m")},i.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var r=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),i=[],o=[],d=[],u=0;u<t.length;++u)t[u].partOf||(t[u].resolve().repeated?i:t[u].map?o:d).push(t[u]);if(i.length){for(r("if(o.arrays||o.defaults){"),u=0;u<i.length;++u)r("d%s=[]",s.safeProp(i[u].name));r("}")}if(o.length){for(r("if(o.objects||o.defaults){"),u=0;u<o.length;++u)r("d%s={}",s.safeProp(o[u].name));r("}")}if(d.length){for(r("if(o.defaults){"),u=0;u<d.length;++u){var l=d[u],c=s.safeProp(l.name);if(l.resolvedType instanceof n)r("d%s=o.enums===String?%j:%j",c,l.resolvedType.valuesById[l.typeDefault],l.typeDefault);else if(l.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",l.typeDefault.low,l.typeDefault.high,l.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",c)("}else")("d%s=o.longs===String?%j:%i",c,l.typeDefault.toString(),l.typeDefault.toNumber());else if(l.bytes){var p="["+Array.prototype.slice.call(l.typeDefault).join(",")+"]";r("if(o.bytes===String)d%s=%j",c,String.fromCharCode.apply(String,l.typeDefault))("else{")("d%s=%s",c,p)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",c,c)("}")}else r("d%s=%j",c,l.typeDefault)}r("}")}var h=!1;for(u=0;u<t.length;++u){l=t[u];var f=e._fieldsArray.indexOf(l);c=s.safeProp(l.name);l.map?(h||(h=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",c,c)("d%s={}",c)("for(var j=0;j<ks2.length;++j){"),a(r,l,f,c+"[ks2[j]]")("}")):l.repeated?(r("if(m%s&&m%s.length){",c,c)("d%s=[]",c)("for(var j=0;j<m%s.length;++j){",c),a(r,l,f,c+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",c,l.name),a(r,l,f,c),l.partOf&&r("if(o.oneofs)")("d%s=%j",s.safeProp(l.partOf.name),l.name)),r("}")}return r("return d")}},9847:(e,t,r)=>{"use strict";e.exports=function(e){var t=s.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var a=e._fieldsArray[r].resolve(),d=a.resolvedType instanceof i?"int32":a.type,u="m"+s.safeProp(a.name);t("case %i:",a.id),a.map?(t("if(%s===util.emptyObject)",u)("%s={}",u)("var c2 = r.uint32()+r.pos"),void 0!==n.defaults[a.keyType]?t("k=%j",n.defaults[a.keyType]):t("k=null"),void 0!==n.defaults[d]?t("value=%j",n.defaults[d]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===n.basic[d]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",d),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==n.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',u):t("%s[k]=value",u)):a.repeated?(t("if(!(%s&&%s.length))",u,u)("%s=[]",u),void 0!==n.packed[d]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",u,d)("}else"),void 0===n.basic[d]?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",u,r):t("%s.push(r.%s())",u,d)):void 0===n.basic[d]?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",u,r):t("%s=r.%s()",u,d),t("break")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var l=e._fieldsArray[r];l.required&&t("if(!m.hasOwnProperty(%j))",l.name)("throw util.ProtocolError(%j,{instance:m})",o(l))}return t("return m")};var i=r(6901),n=r(3970),s=r(8066);function o(e){return"missing required '"+e.name+"'"}},5191:(e,t,r)=>{"use strict";e.exports=function(e){for(var t,r=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),d=0;d<a.length;++d){var u=a[d].resolve(),l=e._fieldsArray.indexOf(u),c=u.resolvedType instanceof i?"int32":u.type,p=n.basic[c];t="m"+s.safeProp(u.name),u.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,u.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(u.id<<3|2)>>>0,8|n.mapKey[u.keyType],u.keyType),void 0===p?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",l,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|p,c,t),r("}")("}")):u.repeated?(r("if(%s!=null&&%s.length){",t,t),u.packed&&void 0!==n.packed[c]?r("w.uint32(%i).fork()",(u.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",c,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===p?o(r,u,l,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(u.id<<3|p)>>>0,c,t)),r("}")):(u.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,u.name),void 0===p?o(r,u,l,t):r("w.uint32(%i).%s(%s)",(u.id<<3|p)>>>0,c,t))}return r("return w")};var i=r(6901),n=r(3970),s=r(8066);function o(e,t,r,i){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,i,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,i,(t.id<<3|2)>>>0)}},6901:(e,t,r)=>{"use strict";e.exports=o;var i=r(7641);((o.prototype=Object.create(i.prototype)).constructor=o).className="Enum";var n=r(9788),s=r(8066);function o(e,t,r,n,s){if(i.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=s||{},this.reserved=void 0,t)for(var o=Object.keys(t),a=0;a<o.length;++a)"number"==typeof t[o[a]]&&(this.valuesById[this.values[o[a]]=t[o[a]]]=o[a])}o.fromJSON=function(e,t){var r=new o(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,r){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},o.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)}},797:(e,t,r)=>{"use strict";e.exports=u;var i=r(7641);((u.prototype=Object.create(i.prototype)).constructor=u).className="Field";var n,s=r(6901),o=r(3970),a=r(8066),d=/^required|optional|repeated$/;function u(e,t,r,n,s,u,l){if(a.isObject(n)?(l=s,u=n,n=s=void 0):a.isObject(s)&&(l=u,u=s,s=void 0),i.call(this,e,u),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==n&&!d.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===n&&(n="optional"),this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=l}u.fromJSON=function(e,t){return new u(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(u.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),u.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),i.prototype.setOption.call(this,e,t,r)},u.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},u.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof n?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof n&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this)},u.d=function(e,t,r,i){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(n,s){a.decorateType(n.constructor).add(new u(s,e,t,r,{default:i}))}},u._configure=function(e){n=e}},9188:(e,t,r)=>{"use strict";var i=e.exports=r(536);i.build="light",i.load=function(e,t,r){return"function"==typeof t?(r=t,t=new i.Root):t||(t=new i.Root),t.load(e,r)},i.loadSync=function(e,t){return t||(t=new i.Root),t.loadSync(e)},i.encoder=r(5191),i.decoder=r(9847),i.verifier=r(2332),i.converter=r(3746),i.ReflectionObject=r(7641),i.Namespace=r(9788),i.Root=r(742),i.Enum=r(6901),i.Type=r(3138),i.Field=r(797),i.OneOf=r(6898),i.MapField=r(1981),i.Service=r(9355),i.Method=r(8820),i.Message=r(3611),i.wrappers=r(6423),i.types=r(3970),i.util=r(8066),i.ReflectionObject._configure(i.Root),i.Namespace._configure(i.Type,i.Service,i.Enum),i.Root._configure(i.Type),i.Field._configure(i.Type)},536:(e,t,r)=>{"use strict";var i=t;function n(){i.util._configure(),i.Writer._configure(i.BufferWriter),i.Reader._configure(i.BufferReader)}i.build="minimal",i.Writer=r(123),i.BufferWriter=r(6673),i.Reader=r(9799),i.BufferReader=r(7038),i.util=r(4165),i.rpc=r(4963),i.roots=r(9009),i.configure=n,n()},1981:(e,t,r)=>{"use strict";e.exports=o;var i=r(797);((o.prototype=Object.create(i.prototype)).constructor=o).className="MapField";var n=r(3970),s=r(8066);function o(e,t,r,n,o,a){if(i.call(this,e,t,n,void 0,void 0,o,a),!s.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===n.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},o.d=function(e,t,r){return"function"==typeof r?r=s.decorateType(r).name:r&&"object"==typeof r&&(r=s.decorateEnum(r).name),function(i,n){s.decorateType(i.constructor).add(new o(n,e,t,r))}}},3611:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}n.create=function(e){return this.$type.create(e)},n.encode=function(e,t){return this.$type.encode(e,t)},n.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},n.decode=function(e){return this.$type.decode(e)},n.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},n.verify=function(e){return this.$type.verify(e)},n.fromObject=function(e){return this.$type.fromObject(e)},n.toObject=function(e,t){return this.$type.toObject(e,t)},n.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},8820:(e,t,r)=>{"use strict";e.exports=s;var i=r(7641);((s.prototype=Object.create(i.prototype)).constructor=s).className="Method";var n=r(8066);function s(e,t,r,s,o,a,d,u,l){if(n.isObject(o)?(d=o,o=a=void 0):n.isObject(a)&&(d=a,a=void 0),void 0!==t&&!n.isString(t))throw TypeError("type must be a string");if(!n.isString(r))throw TypeError("requestType must be a string");if(!n.isString(s))throw TypeError("responseType must be a string");i.call(this,e,d),this.type=t||"rpc",this.requestType=r,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=u,this.parsedOptions=l}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return n.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},9788:(e,t,r)=>{"use strict";e.exports=c;var i=r(7641);((c.prototype=Object.create(i.prototype)).constructor=c).className="Namespace";var n,s,o,a=r(797),d=r(6898),u=r(8066);function l(e,t){if(e&&e.length){for(var r={},i=0;i<e.length;++i)r[e[i].name]=e[i].toJSON(t);return r}}function c(e,t){i.call(this,e,t),this.nested=void 0,this._nestedArray=null}function p(e){return e._nestedArray=null,e}c.fromJSON=function(e,t){return new c(e,t.options).addJSON(t.nested)},c.arrayToJSON=l,c.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},c.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=u.toArray(this.nested))}}),c.prototype.toJSON=function(e){return u.toObject(["options",this.options,"nested",l(this.nestedArray,e)])},c.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),i=0;i<r.length;++i)t=e[r[i]],this.add((void 0!==t.fields?n.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:c.fromJSON)(r[i],t));return this},c.prototype.get=function(e){return this.nested&&this.nested[e]||null},c.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},c.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof n||e instanceof o||e instanceof s||e instanceof c||e instanceof d))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof c&&e instanceof c)||t instanceof n||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,i=0;i<r.length;++i)e.add(r[i]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),p(this)},c.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),p(this)},c.prototype.define=function(e,t){if(u.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var i=e.shift();if(r.nested&&r.nested[i]){if(!((r=r.nested[i])instanceof c))throw Error("path conflicts with non-namespace objects")}else r.add(r=new c(i))}return t&&r.addJSON(t),r},c.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof c?e[t++].resolveAll():e[t++].resolve();return this.resolve()},c.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),u.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var i=this.get(e[0]);if(i){if(1===e.length){if(!t||t.indexOf(i.constructor)>-1)return i}else if(i instanceof c&&(i=i.lookup(e.slice(1),t,!0)))return i}else for(var n=0;n<this.nestedArray.length;++n)if(this._nestedArray[n]instanceof c&&(i=this._nestedArray[n].lookup(e,t,!0)))return i;return null===this.parent||r?null:this.parent.lookup(e,t)},c.prototype.lookupType=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such type: "+e);return t},c.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},c.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[n,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},c.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},c._configure=function(e,t,r){n=e,s=t,o=r}},7641:(e,t,r)=>{"use strict";e.exports=s,s.className="ReflectionObject";var i,n=r(8066);function s(e,t){if(!n.isString(e))throw TypeError("name must be a string");if(t&&!n.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(s.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),s.prototype.toJSON=function(){throw Error()},s.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof i&&t._handleAdd(this)},s.prototype.onRemove=function(e){var t=e.root;t instanceof i&&t._handleRemove(this),this.parent=null,this.resolved=!1},s.prototype.resolve=function(){return this.resolved||this.root instanceof i&&(this.resolved=!0),this},s.prototype.getOption=function(e){if(this.options)return this.options[e]},s.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},s.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var i=this.parsedOptions;if(r){var s=i.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(s){var o=s[e];n.setProperty(o,r,t)}else(s={})[e]=n.setProperty({},r,t),i.push(s)}else{var a={};a[e]=t,i.push(a)}return this},s.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)this.setOption(r[i],e[r[i]],t);return this},s.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},s._configure=function(e){i=e}},6898:(e,t,r)=>{"use strict";e.exports=o;var i=r(7641);((o.prototype=Object.create(i.prototype)).constructor=o).className="OneOf";var n=r(797),s=r(8066);function o(e,t,r,n){if(Array.isArray(t)||(r=t,t=void 0),i.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){i.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}a(this)},o.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);i.prototype.onRemove.call(this,e)},o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){s.decorateType(t.constructor).add(new o(r,e)),Object.defineProperty(t,r,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},9799:(e,t,r)=>{"use strict";e.exports=d;var i,n=r(4165),s=n.LongBits,o=n.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function d(e){this.buf=e,this.pos=0,this.len=e.length}var u,l="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new d(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new d(e);throw Error("illegal buffer")},c=function(){return n.Buffer?function(e){return(d.create=function(e){return n.Buffer.isBuffer(e)?new i(e):l(e)})(e)}:l};function p(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new s(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}d.create=c(),d.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,d.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),d.prototype.int32=function(){return 0|this.uint32()},d.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},d.prototype.bool=function(){return 0!==this.uint32()},d.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return h(this.buf,this.pos+=4)},d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|h(this.buf,this.pos+=4)},d.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},d.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},d.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},d.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},d.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},d.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},d._configure=function(e){i=e,d.create=c(),i._configure();var t=n.Long?"toLong":"toNumber";n.merge(d.prototype,{int64:function(){return p.call(this)[t](!1)},uint64:function(){return p.call(this)[t](!0)},sint64:function(){return p.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},7038:(e,t,r)=>{"use strict";e.exports=s;var i=r(9799);(s.prototype=Object.create(i.prototype)).constructor=s;var n=r(4165);function s(e){i.call(this,e)}s._configure=function(){n.Buffer&&(s.prototype._slice=n.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},742:(e,t,r)=>{"use strict";e.exports=c;var i=r(9788);((c.prototype=Object.create(i.prototype)).constructor=c).className="Root";var n,s,o,a=r(797),d=r(6901),u=r(6898),l=r(8066);function c(e){i.call(this,"",e),this.deferred=[],this.files=[]}function p(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=l.path.resolve,c.prototype.fetch=l.fetch,c.prototype.load=function e(t,r,i){"function"==typeof r&&(i=r,r=void 0);var n=this;if(!i)return l.asPromise(e,n,t,r);var a=i===p;function d(e,t){if(i){var r=i;if(i=null,a)throw e;r(e,t)}}function u(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in o)return r}return null}function c(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){s.filename=e;var i,o=s(t,n,r),c=0;if(o.imports)for(;c<o.imports.length;++c)(i=u(o.imports[c])||n.resolvePath(e,o.imports[c]))&&h(i);if(o.weakImports)for(c=0;c<o.weakImports.length;++c)(i=u(o.weakImports[c])||n.resolvePath(e,o.weakImports[c]))&&h(i,!0)}else n.setOptions(t.options).addJSON(t.nested)}catch(e){d(e)}a||f||d(null,n)}function h(e,t){if(!(n.files.indexOf(e)>-1))if(n.files.push(e),e in o)a?c(e,o[e]):(++f,setTimeout((function(){--f,c(e,o[e])})));else if(a){var r;try{r=l.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||d(e))}c(e,r)}else++f,n.fetch(e,(function(r,s){--f,i&&(r?t?f||d(null,n):d(r):c(e,s))}))}var f=0;l.isString(t)&&(t=[t]);for(var y,g=0;g<t.length;++g)(y=n.resolvePath("",t[g]))&&h(y);if(a)return n;f||d(null,n)},c.prototype.loadSync=function(e,t){if(!l.isNode)throw Error("not supported");return this.load(e,t,p)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return i.prototype.resolveAll.call(this)};var h=/^[A-Z]/;function f(e,t){var r=t.parent.lookup(t.extend);if(r){var i=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return i.declaringField=t,t.extensionField=i,r.add(i),!0}return!1}c.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||f(0,e)||this.deferred.push(e);else if(e instanceof d)h.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof u)){if(e instanceof n)for(var t=0;t<this.deferred.length;)f(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);h.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof d)h.test(e.name)&&delete e.parent[e.name];else if(e instanceof i){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);h.test(e.name)&&delete e.parent[e.name]}},c._configure=function(e,t,r){n=e,s=t,o=r}},9009:e=>{"use strict";e.exports={}},4963:(e,t,r)=>{"use strict";t.Service=r(9548)},9548:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(n.prototype=Object.create(i.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,r,n,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return i.asPromise(e,a,t,r,n,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof n))try{r=n[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){o(e)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9355:(e,t,r)=>{"use strict";e.exports=a;var i=r(9788);((a.prototype=Object.create(i.prototype)).constructor=a).className="Service";var n=r(8820),s=r(8066),o=r(4963);function a(e,t){i.call(this,e,t),this.methods={},this._methodsArray=null}function d(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var i=Object.keys(t.methods),s=0;s<i.length;++s)r.add(n.fromJSON(i[s],t.methods[i[s]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=i.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return s.toObject(["options",t&&t.options||void 0,"methods",i.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||i.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return i.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof n?(this.methods[e.name]=e,e.parent=this,d(this)):i.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof n){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,d(this)}return i.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var i,n=new o.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var d=s.lcFirst((i=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");n[d]=s.codegen(["r","c"],s.isReserved(d)?d+"_":d)("return this.rpcCall(m,q,s,r,c)")({m:i,q:i.resolvedRequestType.ctor,s:i.resolvedResponseType.ctor})}return n}},3138:(e,t,r)=>{"use strict";e.exports=v;var i=r(9788);((v.prototype=Object.create(i.prototype)).constructor=v).className="Type";var n=r(6901),s=r(6898),o=r(797),a=r(1981),d=r(9355),u=r(3611),l=r(9799),c=r(123),p=r(8066),h=r(5191),f=r(9847),y=r(2332),g=r(3746),m=r(6423);function v(e,t){i.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],i=r.id;if(this._fieldsById[i])throw Error("duplicate id "+i+" in "+this);this._fieldsById[i]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=p.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=p.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof u||((e.prototype=new u).constructor=e,p.merge(e.prototype,t)),e.$type=e.prototype.$type=this,p.merge(e,u,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var i={};for(r=0;r<this.oneofsArray.length;++r)i[this._oneofsArray[r].resolve().name]={get:p.oneOfGetter(this._oneofsArray[r].oneof),set:p.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,i)}}}),v.generateConstructor=function(e){for(var t,r=p.codegen(["p"],e.name),i=0;i<e.fieldsArray.length;++i)(t=e._fieldsArray[i]).map?r("this%s={}",p.safeProp(t.name)):t.repeated&&r("this%s=[]",p.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(e,t){var r=new v(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var u=Object.keys(t.fields),l=0;l<u.length;++l)r.add((void 0!==t.fields[u[l]].keyType?a.fromJSON:o.fromJSON)(u[l],t.fields[u[l]]));if(t.oneofs)for(u=Object.keys(t.oneofs),l=0;l<u.length;++l)r.add(s.fromJSON(u[l],t.oneofs[u[l]]));if(t.nested)for(u=Object.keys(t.nested),l=0;l<u.length;++l){var c=t.nested[u[l]];r.add((void 0!==c.id?o.fromJSON:void 0!==c.fields?v.fromJSON:void 0!==c.values?n.fromJSON:void 0!==c.methods?d.fromJSON:i.fromJSON)(u[l],c))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},v.prototype.toJSON=function(e){var t=i.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return p.toObject(["options",t&&t.options||void 0,"oneofs",i.arrayToJSON(this.oneofsArray,e),"fields",i.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return i.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):i.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return i.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=h(this)({Writer:c,types:t,util:p}),this.decode=f(this)({Reader:l,types:t,util:p}),this.verify=y(this)({types:t,util:p}),this.fromObject=g.fromObject(this)({types:t,util:p}),this.toObject=g.toObject(this)({types:t,util:p});var i=m[e];if(i){var n=Object.create(this);n.fromObject=this.fromObject,this.fromObject=i.fromObject.bind(n),n.toObject=this.toObject,this.toObject=i.toObject.bind(n)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof l||(e=l.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){p.decorateType(t,e)}}},3970:(e,t,r)=>{"use strict";var i=t,n=r(8066),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,i={};for(t|=0;r<e.length;)i[s[r+t]]=e[r++];return i}i.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",n.emptyArray,null]),i.long=o([0,0,0,1,1],7),i.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},8066:(e,t,r)=>{"use strict";var i,n,s=e.exports=r(4165),o=r(9009);s.codegen=r(1706),s.fetch=r(4641),s.path=r(2659),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),i=0;i<t.length;)r[i]=e[t[i++]];return r}return[]},s.toObject=function(e){for(var t={},r=0;r<e.length;){var i=e[r++],n=e[r++];void 0!==n&&(t[i]=n)}return t};var a=/\\/g,d=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(d,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var u=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(u,(function(e,t){return t.toUpperCase()}))},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;i||(i=r(3138));var n=new i(t||e.name);return s.decorateRoot.add(n),n.ctor=e,Object.defineProperty(e,"$type",{value:n,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:n,enumerable:!1}),n};var l=0;s.decorateEnum=function(e){if(e.$type)return e.$type;n||(n=r(6901));var t=new n("Enum"+l++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,r){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,i){var n=r.shift();if("__proto__"===n)return t;if(r.length>0)t[n]=e(t[n]||{},r,i);else{var s=t[n];s&&(i=[].concat(s).concat(i)),t[n]=i}return t}(e,t=t.split("."),r)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(742)))}})},1697:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=n.zero=new n(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(i.isString(e)){if(!i.Long)return n.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):s},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;n.fromHash=function(e){return e===o?s:new n((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},4165:function(e,t,r){"use strict";var i=t;function n(e,t,r){for(var i=Object.keys(t),n=0;n<i.length;++n)void 0!==e[i[n]]&&r||(e[i[n]]=t[i[n]]);return e}function s(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&n(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}i.asPromise=r(6781),i.base64=r(7026),i.EventEmitter=r(5570),i.float=r(5298),i.inquire=r(6116),i.utf8=r(7958),i.pool=r(804),i.LongBits=r(1697),i.isNode=Boolean(void 0!==r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),i.global=i.isNode&&r.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},i.isString=function(e){return"string"==typeof e||e instanceof String},i.isObject=function(e){return e&&"object"==typeof e},i.isset=i.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},i.Buffer=function(){try{var e=i.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(e){return"number"==typeof e?i.Buffer?i._Buffer_allocUnsafe(e):new i.Array(e):i.Buffer?i._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(e){return e?i.LongBits.from(e).toHash():i.LongBits.zeroHash},i.longFromHash=function(e,t){var r=i.LongBits.fromHash(e);return i.Long?i.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},i.merge=n,i.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},i.newError=s,i.ProtocolError=s("ProtocolError"),i.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},i.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var e=i.Buffer;e?(i._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},i._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):i._Buffer_from=i._Buffer_allocUnsafe=null}},2332:(e,t,r)=>{"use strict";e.exports=function(e){var t=n.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,i={};r.length&&t("var p={}");for(var d=0;d<e.fieldsArray.length;++d){var u=e._fieldsArray[d].resolve(),l="m"+n.safeProp(u.name);if(u.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",l,u.name),u.map)t("if(!util.isObject(%s))",l)("return%j",s(u,"object"))("var k=Object.keys(%s)",l)("for(var i=0;i<k.length;++i){"),a(t,u,"k[i]"),o(t,u,d,l+"[k[i]]")("}");else if(u.repeated)t("if(!Array.isArray(%s))",l)("return%j",s(u,"array"))("for(var i=0;i<%s.length;++i){",l),o(t,u,d,l+"[i]")("}");else{if(u.partOf){var c=n.safeProp(u.partOf.name);1===i[u.partOf.name]&&t("if(p%s===1)",c)("return%j",u.partOf.name+": multiple values"),i[u.partOf.name]=1,t("p%s=1",c)}o(t,u,d,l)}u.optional&&t("}")}return t("return null")};var i=r(6901),n=r(8066);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(%s){",n)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,n)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",n)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',n)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',n)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",n)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",s(t,"buffer"))}return e}function a(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",s(t,"boolean key"))}return e}},6423:(e,t,r)=>{"use strict";var i=t,n=r(3611);i[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var i="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return-1===i.indexOf("/")&&(i="/"+i),this.create({type_url:i,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",i="";if(t&&t.json&&e.type_url&&e.value){i=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(i);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof n){var o=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),i=r+("."===e.$type.fullName[0]?e.$type.fullName.substr(1):e.$type.fullName),o["@type"]=i,o}return this.toObject(e,t)}}},123:(e,t,r)=>{"use strict";e.exports=c;var i,n=r(4165),s=n.LongBits,o=n.base64,a=n.utf8;function d(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function u(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new d(u,0,0),this.tail=this.head,this.states=null}var p=function(){return n.Buffer?function(){return(c.create=function(){return new i})()}:function(){return new c}};function h(e,t,r){t[r]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}c.create=p(),c.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(c.alloc=n.pool(c.alloc,n.Array.prototype.subarray)),c.prototype._push=function(e,t,r){return this.tail=this.tail.next=new d(e,t,r),this.len+=t,this},f.prototype=Object.create(d.prototype),f.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(y,10,s.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=s.from(e);return this._push(y,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(y,t.length(),t)},c.prototype.bool=function(e){return this._push(h,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=s.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var m=n.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var i=0;i<e.length;++i)t[r+i]=e[i]};c.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(h,1,0);if(n.isString(e)){var r=c.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},c.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(h,1,0)},c.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new d(u,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new d(u,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},c._configure=function(e){i=e,c.create=p(),i._configure()}},6673:(e,t,r)=>{"use strict";e.exports=s;var i=r(123);(s.prototype=Object.create(i.prototype)).constructor=s;var n=r(4165);function s(){i.call(this)}function o(e,t,r){e.length<40?n.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=n._Buffer_allocUnsafe,s.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&"set"===n.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var i=0;i<e.length;)t[r++]=e[i++]}},s.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=n.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},7847:(e,t,r)=>{const i=Symbol("SemVer ANY");class n{static get ANY(){return i}constructor(e,t){if(t=s(t),e instanceof n){if(e.loose===!!t.loose)return e;e=e.value}u("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===i?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const t=this.options.loose?o[a.COMPARATORLOOSE]:o[a.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new l(r[2],this.options.loose):this.semver=i}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===i||e===i)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return d(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new c(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new c(this.value,t).test(e.semver);const r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),s=this.semver.version===e.semver.version,o=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=d(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),u=d(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||i||s&&o||a||u}}e.exports=n;const s=r(1388),{re:o,t:a}=r(4808),d=r(8117),u=r(952),l=r(2435),c=r(6843)},6843:(e,t,r)=>{class i{constructor(e,t){if(t=s(t),e instanceof i)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new i(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!f(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&y(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const t=`parseRange:${Object.keys(this.options).join(",")}:${e}`,r=n.get(t);if(r)return r;const i=this.options.loose,s=i?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];e=e.replace(s,I(this.options.includePrerelease)),a("hyphen replace",e),e=e.replace(u[l.COMPARATORTRIM],c),a("comparator trim",e);let d=(e=(e=(e=e.replace(u[l.TILDETRIM],p)).replace(u[l.CARETTRIM],h)).split(/\s+/).join(" ")).split(" ").map((e=>m(e,this.options))).join(" ").split(/\s+/).map((e=>O(e,this.options)));i&&(d=d.filter((e=>(a("loose invalid filter",e,this.options),!!e.match(u[l.COMPARATORLOOSE]))))),a("range list",d);const y=new Map,g=d.map((e=>new o(e,this.options)));for(const e of g){if(f(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const v=[...y.values()];return n.set(t,v),v}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Range is required");return this.set.some((r=>g(r,t)&&e.set.some((e=>g(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new d(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(x(this.set[t],e,this.options))return!0;return!1}}e.exports=i;const n=new(r(7105))({max:1e3}),s=r(1388),o=r(7847),a=r(952),d=r(2435),{re:u,t:l,comparatorTrimReplace:c,tildeTrimReplace:p,caretTrimReplace:h}=r(4808),f=e=>"<0.0.0-0"===e.value,y=e=>""===e.value,g=(e,t)=>{let r=!0;const i=e.slice();let n=i.pop();for(;r&&i.length;)r=i.every((e=>n.intersects(e,t))),n=i.pop();return r},m=(e,t)=>(a("comp",e,t),e=w(e,t),a("caret",e),e=b(e,t),a("tildes",e),e=T(e,t),a("xrange",e),e=R(e,t),a("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>_(e,t))).join(" "),_=(e,t)=>{const r=t.loose?u[l.TILDELOOSE]:u[l.TILDE];return e.replace(r,((t,r,i,n,s)=>{let o;return a("tilde",e,t,r,i,n,s),v(r)?o="":v(i)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:v(n)?o=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:s?(a("replaceTilde pr",s),o=`>=${r}.${i}.${n}-${s} <${r}.${+i+1}.0-0`):o=`>=${r}.${i}.${n} <${r}.${+i+1}.0-0`,a("tilde return",o),o}))},w=(e,t)=>e.trim().split(/\s+/).map((e=>E(e,t))).join(" "),E=(e,t)=>{a("caret",e,t);const r=t.loose?u[l.CARETLOOSE]:u[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,((t,r,n,s,o)=>{let d;return a("caret",e,t,r,n,s,o),v(r)?d="":v(n)?d=`>=${r}.0.0${i} <${+r+1}.0.0-0`:v(s)?d="0"===r?`>=${r}.${n}.0${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${i} <${+r+1}.0.0-0`:o?(a("replaceCaret pr",o),d="0"===r?"0"===n?`>=${r}.${n}.${s}-${o} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}-${o} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s}-${o} <${+r+1}.0.0-0`):(a("no pr"),d="0"===r?"0"===n?`>=${r}.${n}.${s}${i} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s} <${+r+1}.0.0-0`),a("caret return",d),d}))},T=(e,t)=>(a("replaceXRanges",e,t),e.split(/\s+/).map((e=>S(e,t))).join(" ")),S=(e,t)=>{e=e.trim();const r=t.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return e.replace(r,((r,i,n,s,o,d)=>{a("xRange",e,r,i,n,s,o,d);const u=v(n),l=u||v(s),c=l||v(o),p=c;return"="===i&&p&&(i=""),d=t.includePrerelease?"-0":"",u?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&p?(l&&(s=0),o=0,">"===i?(i=">=",l?(n=+n+1,s=0,o=0):(s=+s+1,o=0)):"<="===i&&(i="<",l?n=+n+1:s=+s+1),"<"===i&&(d="-0"),r=`${i+n}.${s}.${o}${d}`):l?r=`>=${n}.0.0${d} <${+n+1}.0.0-0`:c&&(r=`>=${n}.${s}.0${d} <${n}.${+s+1}.0-0`),a("xRange return",r),r}))},R=(e,t)=>(a("replaceStars",e,t),e.trim().replace(u[l.STAR],"")),O=(e,t)=>(a("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),I=e=>(t,r,i,n,s,o,a,d,u,l,c,p,h)=>`${r=v(i)?"":v(n)?`>=${i}.0.0${e?"-0":""}`:v(s)?`>=${i}.${n}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${d=v(u)?"":v(l)?`<${+u+1}.0.0-0`:v(c)?`<${u}.${+l+1}.0-0`:p?`<=${u}.${l}.${c}-${p}`:e?`<${u}.${l}.${+c+1}-0`:`<=${d}`}`.trim(),x=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(a(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){const i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}},2435:(e,t,r)=>{const i=r(952),{MAX_LENGTH:n,MAX_SAFE_INTEGER:s}=r(5558),{re:o,t:a}=r(4808),d=r(1388),{compareIdentifiers:u}=r(4935);class l{constructor(e,t){if(t=d(t),e instanceof l){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>n)throw new TypeError(`version is longer than ${n} characters`);i("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[a.LOOSE]:o[a.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<s)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(i("SemVer.compare",this.version,this.options,e),!(e instanceof l)){if("string"==typeof e&&e===this.version)return 0;e=new l(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof l||(e=new l(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof l||(e=new l(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],n=e.prerelease[t];if(i("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return u(r,n)}while(++t)}compareBuild(e){e instanceof l||(e=new l(e,this.options));let t=0;do{const r=this.build[t],n=e.build[t];if(i("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return u(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}e.exports=l},6694:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},8117:(e,t,r)=>{const i=r(3276),n=r(7893),s=r(6379),o=r(8463),a=r(1897),d=r(506);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return i(e,r,u);case"!=":return n(e,r,u);case">":return s(e,r,u);case">=":return o(e,r,u);case"<":return a(e,r,u);case"<=":return d(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},8686:(e,t,r)=>{const i=r(2435),n=r(9943),{re:s,t:o}=r(4808);e.exports=(e,t)=>{if(e instanceof i)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=s[o.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),s[o.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;s[o.COERCERTL].lastIndex=-1}else r=e.match(s[o.COERCE]);return null===r?null:n(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)}},5914:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r)=>{const n=new i(e,r),s=new i(t,r);return n.compare(s)||n.compareBuild(s)}},5404:(e,t,r)=>{const i=r(2271);e.exports=(e,t)=>i(e,t,!0)},2271:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r)=>new i(e,r).compare(new i(t,r))},6007:(e,t,r)=>{const i=r(9943),n=r(3276);e.exports=(e,t)=>{if(n(e,t))return null;{const r=i(e),n=i(t),s=r.prerelease.length||n.prerelease.length,o=s?"pre":"",a=s?"prerelease":"";for(const e in r)if(("major"===e||"minor"===e||"patch"===e)&&r[e]!==n[e])return o+e;return a}}},3276:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>0===i(e,t,r)},6379:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)>0},8463:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)>=0},6360:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r,n)=>{"string"==typeof r&&(n=r,r=void 0);try{return new i(e instanceof i?e.version:e,r).inc(t,n).version}catch(e){return null}}},1897:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)<0},506:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)<=0},4551:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).major},469:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).minor},7893:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>0!==i(e,t,r)},9943:(e,t,r)=>{const{MAX_LENGTH:i}=r(5558),{re:n,t:s}=r(4808),o=r(2435),a=r(1388);e.exports=(e,t)=>{if(t=a(t),e instanceof o)return e;if("string"!=typeof e)return null;if(e.length>i)return null;if(!(t.loose?n[s.LOOSE]:n[s.FULL]).test(e))return null;try{return new o(e,t)}catch(e){return null}}},4250:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).patch},8204:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e,t);return r&&r.prerelease.length?r.prerelease:null}},733:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(t,e,r)},2961:(e,t,r)=>{const i=r(5914);e.exports=(e,t)=>e.sort(((e,r)=>i(r,e,t)))},9844:(e,t,r)=>{const i=r(6843);e.exports=(e,t,r)=>{try{t=new i(t,r)}catch(e){return!1}return t.test(e)}},1116:(e,t,r)=>{const i=r(5914);e.exports=(e,t)=>e.sort(((e,r)=>i(e,r,t)))},7230:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e,t);return r?r.version:null}},7699:(e,t,r)=>{const i=r(4808);e.exports={re:i.re,src:i.src,tokens:i.t,SEMVER_SPEC_VERSION:r(5558).SEMVER_SPEC_VERSION,SemVer:r(2435),compareIdentifiers:r(4935).compareIdentifiers,rcompareIdentifiers:r(4935).rcompareIdentifiers,parse:r(9943),valid:r(7230),clean:r(6694),inc:r(6360),diff:r(6007),major:r(4551),minor:r(469),patch:r(4250),prerelease:r(8204),compare:r(2271),rcompare:r(733),compareLoose:r(5404),compareBuild:r(5914),sort:r(1116),rsort:r(2961),gt:r(6379),lt:r(1897),eq:r(3276),neq:r(7893),gte:r(8463),lte:r(506),cmp:r(8117),coerce:r(8686),Comparator:r(7847),Range:r(6843),satisfies:r(9844),toComparators:r(8865),maxSatisfying:r(3727),minSatisfying:r(4338),minVersion:r(1542),validRange:r(6240),outside:r(9106),gtr:r(995),ltr:r(7805),intersects:r(2013),simplifyRange:r(1338),subset:r(3122)}},5558:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:t,MAX_SAFE_COMPONENT_LENGTH:16}},952:e=>{const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},4935:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const i=t.test(e),n=t.test(r);return i&&n&&(e=+e,r=+r),e===r?0:i&&!n?-1:n&&!i?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},1388:e=>{const t=["includePrerelease","loose","rtl"];e.exports=e=>e?"object"!=typeof e?{loose:!0}:t.filter((t=>e[t])).reduce(((e,t)=>(e[t]=!0,e)),{}):{}},4808:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:i}=r(5558),n=r(952),s=(t=e.exports={}).re=[],o=t.src=[],a=t.t={};let d=0;const u=(e,t,r)=>{const i=d++;n(e,i,t),a[e]=i,o[i]=t,s[i]=new RegExp(t,r?"g":void 0)};u("NUMERICIDENTIFIER","0|[1-9]\\d*"),u("NUMERICIDENTIFIERLOOSE","[0-9]+"),u("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),u("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),u("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),u("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),u("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),u("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),u("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),u("BUILDIDENTIFIER","[0-9A-Za-z-]+"),u("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),u("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),u("FULL",`^${o[a.FULLPLAIN]}$`),u("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),u("LOOSE",`^${o[a.LOOSEPLAIN]}$`),u("GTLT","((?:<|>)?=?)"),u("XRANGEIDENTIFIERLOOSE",`${o[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),u("XRANGEIDENTIFIER",`${o[a.NUMERICIDENTIFIER]}|x|X|\\*`),u("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),u("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),u("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),u("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),u("COERCE",`(^|[^\\d])(\\d{1,${i}})(?:\\.(\\d{1,${i}}))?(?:\\.(\\d{1,${i}}))?(?:$|[^\\d])`),u("COERCERTL",o[a.COERCE],!0),u("LONETILDE","(?:~>?)"),u("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",u("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),u("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),u("LONECARET","(?:\\^)"),u("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",u("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),u("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),u("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),u("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),u("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",u("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),u("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),u("STAR","(<|>)?=?\\s*\\*"),u("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),u("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},995:(e,t,r)=>{const i=r(9106);e.exports=(e,t,r)=>i(e,t,">",r)},2013:(e,t,r)=>{const i=r(6843);e.exports=(e,t,r)=>(e=new i(e,r),t=new i(t,r),e.intersects(t))},7805:(e,t,r)=>{const i=r(9106);e.exports=(e,t,r)=>i(e,t,"<",r)},3727:(e,t,r)=>{const i=r(2435),n=r(6843);e.exports=(e,t,r)=>{let s=null,o=null,a=null;try{a=new n(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(s&&-1!==o.compare(e)||(s=e,o=new i(s,r)))})),s}},4338:(e,t,r)=>{const i=r(2435),n=r(6843);e.exports=(e,t,r)=>{let s=null,o=null,a=null;try{a=new n(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(s&&1!==o.compare(e)||(s=e,o=new i(s,r)))})),s}},1542:(e,t,r)=>{const i=r(2435),n=r(6843),s=r(6379);e.exports=(e,t)=>{e=new n(e,t);let r=new i("0.0.0");if(e.test(r))return r;if(r=new i("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const n=e.set[t];let o=null;n.forEach((e=>{const t=new i(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":o&&!s(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||r&&!s(r,o)||(r=o)}return r&&e.test(r)?r:null}},9106:(e,t,r)=>{const i=r(2435),n=r(7847),{ANY:s}=n,o=r(6843),a=r(9844),d=r(6379),u=r(1897),l=r(506),c=r(8463);e.exports=(e,t,r,p)=>{let h,f,y,g,m;switch(e=new i(e,p),t=new o(t,p),r){case">":h=d,f=l,y=u,g=">",m=">=";break;case"<":h=u,f=c,y=d,g="<",m="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,p))return!1;for(let r=0;r<t.set.length;++r){const i=t.set[r];let o=null,a=null;if(i.forEach((e=>{e.semver===s&&(e=new n(">=0.0.0")),o=o||e,a=a||e,h(e.semver,o.semver,p)?o=e:y(e.semver,a.semver,p)&&(a=e)})),o.operator===g||o.operator===m)return!1;if((!a.operator||a.operator===g)&&f(e,a.semver))return!1;if(a.operator===m&&y(e,a.semver))return!1}return!0}},1338:(e,t,r)=>{const i=r(9844),n=r(2271);e.exports=(e,t,r)=>{const s=[];let o=null,a=null;const d=e.sort(((e,t)=>n(e,t,r)));for(const e of d){i(e,t,r)?(a=e,o||(o=e)):(a&&s.push([o,a]),a=null,o=null)}o&&s.push([o,null]);const u=[];for(const[e,t]of s)e===t?u.push(e):t||e!==d[0]?t?e===d[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const l=u.join(" || "),c="string"==typeof t.raw?t.raw:String(t);return l.length<c.length?l:t}},3122:(e,t,r)=>{const i=r(6843),n=r(7847),{ANY:s}=n,o=r(9844),a=r(2271),d=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===s){if(1===t.length&&t[0].semver===s)return!0;e=r.includePrerelease?[new n(">=0.0.0-0")]:[new n(">=0.0.0")]}if(1===t.length&&t[0].semver===s){if(r.includePrerelease)return!0;t=[new n(">=0.0.0")]}const i=new Set;let d,c,p,h,f,y,g;for(const t of e)">"===t.operator||">="===t.operator?d=u(d,t,r):"<"===t.operator||"<="===t.operator?c=l(c,t,r):i.add(t.semver);if(i.size>1)return null;if(d&&c){if(p=a(d.semver,c.semver,r),p>0)return null;if(0===p&&(">="!==d.operator||"<="!==c.operator))return null}for(const e of i){if(d&&!o(e,String(d),r))return null;if(c&&!o(e,String(c),r))return null;for(const i of t)if(!o(e,String(i),r))return!1;return!0}let m=!(!c||r.includePrerelease||!c.semver.prerelease.length)&&c.semver,v=!(!d||r.includePrerelease||!d.semver.prerelease.length)&&d.semver;m&&1===m.prerelease.length&&"<"===c.operator&&0===m.prerelease[0]&&(m=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,y=y||"<"===e.operator||"<="===e.operator,d)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),">"===e.operator||">="===e.operator){if(h=u(d,e,r),h===e&&h!==d)return!1}else if(">="===d.operator&&!o(d.semver,String(e),r))return!1;if(c)if(m&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===m.major&&e.semver.minor===m.minor&&e.semver.patch===m.patch&&(m=!1),"<"===e.operator||"<="===e.operator){if(f=l(c,e,r),f===e&&f!==c)return!1}else if("<="===c.operator&&!o(c.semver,String(e),r))return!1;if(!e.operator&&(c||d)&&0!==p)return!1}return!(d&&y&&!c&&0!==p)&&(!(c&&g&&!d&&0!==p)&&(!v&&!m))},u=(e,t,r)=>{if(!e)return t;const i=a(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},l=(e,t,r)=>{if(!e)return t;const i=a(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new i(e,r),t=new i(t,r);let n=!1;e:for(const i of e.set){for(const e of t.set){const t=d(i,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0}},8865:(e,t,r)=>{const i=r(6843);e.exports=(e,t)=>new i(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},6240:(e,t,r)=>{const i=r(6843);e.exports=(e,t)=>{try{return new i(e,t).range||"*"}catch(e){return null}}},8268:e=>{"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},8006:(e,t,r)=>{"use strict";function i(e){var t=this;if(t instanceof i||(t=new i),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);return t}function n(e,t,r){var i=t===e.head?new a(r,null,t,e):new a(r,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function s(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function o(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,r,i){if(!(this instanceof a))return new a(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=i,i.Node=a,i.create=i,i.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},i.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},i.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},i.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},i.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},i.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},i.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},i.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;null!==r;i++)e.call(t,r.value,i,this),r=r.next},i.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;null!==r;i--)e.call(t,r.value,i,this),r=r.prev},i.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},i.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},i.prototype.map=function(e,t){t=t||this;for(var r=new i,n=this.head;null!==n;)r.push(e.call(t,n.value,this)),n=n.next;return r},i.prototype.mapReverse=function(e,t){t=t||this;for(var r=new i,n=this.tail;null!==n;)r.push(e.call(t,n.value,this)),n=n.prev;return r},i.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=e(r,i.value,n),i=i.next;return r},i.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=e(r,i.value,n),i=i.prev;return r},i.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},i.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},i.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new i;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=0,s=this.head;null!==s&&n<e;n++)s=s.next;for(;null!==s&&n<t;n++,s=s.next)r.push(s.value);return r},i.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new i;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=this.length,s=this.tail;null!==s&&n>t;n--)s=s.prev;for(;null!==s&&n>e;n--,s=s.prev)r.push(s.value);return r},i.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,s=this.head;null!==s&&i<e;i++)s=s.next;var o=[];for(i=0;s&&i<t;i++)o.push(s.value),s=this.removeNode(s);null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(i=0;i<r.length;i++)s=n(this,s,r[i]);return o},i.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};try{r(8268)(i)}catch(e){}},2391:e=>{"use strict";e.exports=JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.1","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.1","@onekeyfe/hd-transport":"^0.2.1","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.d(__webpack_exports__,{default:()=>fe});var e=__webpack_require__(2699),t=__webpack_require__.n(e),r=__webpack_require__(5890),i=__webpack_require__(8402);let n,s,o=(0,i.createDeferred)(),a=0;const d=async e=>{o=(0,i.createDeferred)();const t=document.getElementById("onekey-connect");t?n=t:(n=document.createElement("iframe"),n.frameBorder="0",n.width="0px",n.height="0px",n.style.position="absolute",n.style.display="none",n.style.border="0px",n.style.width="0px",n.style.height="0px",n.id="onekey-connect","webusb"===e.env&&(n.allow="usb"));const r=`version=${e.version}`,d=`${e.iframeSrc}?${r}`;n.setAttribute("src",d),s=(e=>{if("string"!=typeof e)return"unknown";if(0===e.indexOf("file://"))return"file://";const t=e.match(/^.+\:\/\/[^\/]+/);return Array.isArray(t)&&t.length>0?t[0]:"unknown"})(n.src),a=window.setTimeout((()=>{o.reject(i.ERRORS.TypedError(i.HardwareErrorCode.IframeTimeout))}),1e4);const u=()=>{var t;n?(null===(t=n.contentWindow)||void 0===t||t.postMessage({type:"iframe-init",payload:{settings:{...e}}},s),n.onload=null):o.reject(i.ERRORS.TypedError(i.HardwareErrorCode.IframeBlocked))};n.attachEvent?n.attachEvent("onload",u):n.onload=u,document.body&&document.body.appendChild(n);try{await o.promise}catch(e){throw n&&(n.parentNode&&n.parentNode.removeChild(n),n=null),e}finally{window.clearTimeout(a),a=0}},u={iframeName:"onekey-iframe",hostName:"onekey-host",channel:"onekey-js-sdk",scope:"$hardware_sdk"};var l=__webpack_require__(7408);function c(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class p extends l{emit(e,...t){return super.emit(e,...t)}addListener(e,t){return super.addListener(e,t),this}on(e,t){return super.on(e,t),this}once(e,t){return super.once(e,t),this}removeListener(e,t){return super.removeListener(e,t),this}off(e,t){return super.off(e,t),this}removeAllListeners(e){return super.removeAllListeners(e),this}setMaxListeners(e){return super.setMaxListeners(e),this}getMaxListeners(){return super.getMaxListeners()}listeners(e){return super.listeners(e)}rawListeners(e){return super.rawListeners(e)}listenerCount(e){return super.listenerCount(e)}prependListener(e,t){return super.prependListener(e,t),this}prependOnceListener(e,t){return super.prependOnceListener(e,t),this}eventNames(){return super.eventNames()}}class h extends p{emit(e,...t){let r="error"===e;const i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const n=i[e];if(void 0===n)return!1;if("function"==typeof n)c(n,this,t);else{const e=n.length,r=function(e){const t=e.length,r=new Array(t);for(let i=0;i<t;i+=1)r[i]=e[i];return r}(n);for(let i=0;i<e;i+=1)c(r[i],this,t)}return!0}}var f=__webpack_require__(7030),y=__webpack_require__(5505),g=__webpack_require__(1378),m=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const v=function(e){return m(this,void 0,void 0,(function*(){function t(e){let i,n,s,o=null;function a(...e){if(!a.enabled)return;const r=a,n=Number(new Date),s=n-(i||n);r.diff=s,r.prev=i,r.curr=n,i=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((i,n)=>{if("%%"===i)return"%";o++;const s=t.formatters[n];if("function"==typeof s){const t=e[o];i=s.call(r,t),e.splice(o,1),o--}return i})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==t.namespaces&&(n=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const i=t(this.namespace+(void 0===r?":":r)+e);return i.log=this.log,i}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>`-${e}`))].join(",");return t.enable(""),e},t.enable=function(e){return m(this,void 0,void 0,(function*(){let r;yield t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),n=i.length;for(r=0;r<n;r++)i[r]&&("-"===(e=i[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp(`^${e.substr(1)}$`)):t.names.push(new RegExp(`^${e}$`)))}))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,i;for(r=0,i=t.skips.length;r<i;r++)if(t.skips[r].test(e))return!1;for(r=0,i=t.names.length;r<i;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=g,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={j(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: ${e.message}`}}},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]};const n=yield t.load();return yield t.enable(n),t}))},b="$$ONEKEY_DEBUG_LOGGER";var _=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const w=b,E={};E.formatArgs=function(e){if(e[0]=`${(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")}+${E.humanize(this.diff)}`,!this.useColors)return;const t=`color: ${this.color}`;e.splice(1,0,t,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r+=1,"%c"===e&&(i=r))})),e.splice(i,0,t)},E.save=function(e){return _(this,void 0,void 0,(function*(){try{e?yield E.storage.setItem(w,e):yield E.storage.removeItem(w)}catch(e){console.error("debug logger storage error",e)}}))},E.load=function(){return _(this,void 0,void 0,(function*(){let e;try{e=yield E.storage.getItem(w)}catch(e){console.error("debug logger storage error",e)}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}))},E.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},E.storage=function(){try{return"undefined"!=typeof global&&global.$$onekeyAppStorage?global.$$onekeyAppStorage:"undefined"!=typeof window&&window.localStorage?window.localStorage:(console.warn("debugLogger init warning, neither `global.$$onekeyAppStorage` nor `window.localStorage` found."),{getItem(){return _(this,void 0,void 0,(function*(){return""}))},setItem(){return _(this,void 0,void 0,(function*(){}))},removeItem(){return _(this,void 0,void 0,(function*(){}))}})}catch(e){console.error("debug logger storage error",e)}}(),E.humanize=g,E.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),E.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],E.log=(...e)=>{console.debug?console.debug(...e):console.log&&console.log(...e)};const T=E;var S=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const R=function(){return S(this,void 0,void 0,(function*(){return v(T)}))};function O(...e){"undefined"!=typeof localStorage&&localStorage.getItem(b)&&console.error(...e)}const I={_isFakeLogger:!0,log:(...e)=>{},warn:(...e)=>{},error:(...e)=>{},debug:(...e)=>{},info:(...e)=>{},trace:(...e)=>{}};var x;!function(e){e.jsBridge="jsBridge",e.providerBase="providerBase",e.extInjected="extInjected",e.extContentScripts="extContentScripts",e.webview="webview",e.desktopInjected="desktopInjected",e.ethereum="ethereum"}(x||(x={}));class A extends h{constructor(){super(),this.jsBridge=(...e)=>null,this.providerBase=(...e)=>null,this.extInjected=(...e)=>null,this.extContentScripts=(...e)=>null,this.webview=(...e)=>null,this.desktopInjected=(...e)=>null,this.ethereum=(...e)=>null,this._debug={enable(e){}},this._externalLogger=I,this._createExternalLog=e=>(...t)=>{var r,i;return this.once("debugReady",(()=>{var r;null===(r=this[e])||void 0===r||r.call(this,...t)})),null===(i=null===(r=this._externalLogger)||void 0===r?void 0:r.log)||void 0===i?void 0:i.call(r,`${e} >>> `,...t)},this.initExternalLogInstances()}initExternalLogInstances(){Object.keys(x).forEach((e=>{this[e]=this._createExternalLog(e)}))}isDebugReady(){return this._debug&&"function"==typeof this._debug}_attachExternalLogger(e){e&&(this._externalLogger=e)}_createDebugInstance(e){}}new A;const C=new class extends A{constructor(){super(),this._debugInstanceCreatedMap={},R().then((e=>{this._debug=e,this.initDebugInstances(),this.emit("debugReady")}))}initDebugInstances(){this.isDebugReady()&&Object.keys(x).forEach((e=>{this[e]=this._debug(e)}))}_createDebugInstance(e){if(!this._debugInstanceCreatedMap[e]&&(this._debugInstanceCreatedMap[e]=!0,e&&this._debug&&"function"==typeof this._debug)){const t=this._debug(e),r=this[e];this[e]=(...e)=>{t(...e),r&&"function"==typeof r&&r(...e)}}}};var k,M;!function(e){e.RESPONSE="RESPONSE",e.REQUEST="REQUEST"}(k||(k={})),function(e){e.ethereum="ethereum",e.conflux="conflux",e.solana="solana",e.starcoin="starcoin",e.sollet="sollet",e.near="near",e.$private="$private",e.$hardware_sdk="$hardware_sdk"}(M||(M={}));var N=__webpack_require__(6920);class P extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return N(this.serialize(),B,2)}}class D extends P{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function B(e,t){if("[Circular]"!==t)return t}const L={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},q={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,requestTimeout:4500},j={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Web3 provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4500:{standard:"",message:"The request by this Web3 provider is timeout."}},F=L.internal;U(F);function U(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){const t=e.toString();if(H(j,t))return j[t].message;if(z(e))return"Unspecified server error."}return t}function z(e){return e>=-32099&&e<=-32e3}function H(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const $={userRejectedRequest:e=>G(q.userRejectedRequest,e),unauthorized:e=>G(q.unauthorized,e),unsupportedMethod:e=>G(q.unsupportedMethod,e),disconnected:e=>G(q.disconnected,e),chainDisconnected:e=>G(q.chainDisconnected,e),requestTimeout:e=>G(q.requestTimeout,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Web3 Provider custom errors must provide single object argument.");const{code:t,message:r,data:i}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new D(t,r,i)}};function G(e,t){const[r,i]=W(t);return new D(e,r||U(e),i)}function W(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}const V="0.0.17";var K=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const Y="undefined"!=typeof window?window:global,X="message",Z="error";class J extends h{constructor(e={}){var t,r;super(),this._requestPayloadCache={},this.isExtUi=!1,this.isInjected=!1,this.sendAsString=!0,this.globalOnMessageEnabled=!0,this.providersHub={},this.globalOnMessage=e=>K(this,void 0,void 0,(function*(){try{if(this.config.receiveHandler&&this.globalOnMessageEnabled){const t=yield this.config.receiveHandler(e,this);e.id&&this.response({id:e.id,scope:e.scope,remoteId:e.remoteId,data:t})}}catch(t){e.id&&e.type===k.REQUEST&&this.responseError({id:e.id,scope:e.scope,remoteId:e.remoteId,error:t}),this.emit(Z,t)}})),this.version=V,this.remoteInfo={origin:"",remoteId:""},this.callbacksExpireTimeout=6e5,this.debugLogger=C,this.callbacks=[],this.callbackId=1,this.config=e,this.callbacksExpireTimeout=null!==(t=e.timeout)&&void 0!==t?t:this.callbacksExpireTimeout,this.debugLogger=e.debugLogger||C,this.sendAsString=null!==(r=e.sendAsString)&&void 0!==r?r:this.sendAsString,this.config.receiveHandler&&this.on(X,this.globalOnMessage),this.on(Z,(e=>{var t;O("JsBridge ERROR: ",e,{code:null===(t=e)||void 0===t?void 0:t.code})})),this.rejectExpiredCallbacks()}attachProviderInstance(e){var t;const r=e.providerName;r&&(this.providersHub[r]=null!==(t=this.providersHub[r])&&void 0!==t?t:[],this.providersHub[r].push(e))}createCallbackId(){return this.callbackId+=1,this.callbackId}createPayload(e,{resolve:t,reject:r}){const{id:i,type:n}=e;if(t&&r&&i&&n===k.REQUEST){if(this.callbacks[i])throw new Error(`JsBridge ERROR: callback exists, id=${i}`);this.callbacks[i]={id:i,resolve:t,reject:r,created:Date.now()}}if(e.error){const t=e.error;e.error=function(e){return{name:e.name,message:e.message,stack:e.stack,code:e.code,data:e.data,key:e.key,info:e.info,className:e.className}}(t)}return null==e||delete e.resolve,null==e||delete e.reject,e}send({type:e,data:t,error:r,id:i,remoteId:n,sync:s=!1,scope:o}){const a=(a,d)=>{var u,l,c;let p=i;s||e!==k.REQUEST||(p=this.createCallbackId());try{const i=this.createPayload({id:p,data:t,error:r,type:e,origin:(null===(u=null==Y?void 0:Y.location)||void 0===u?void 0:u.origin)||"",remoteId:n,scope:o},{resolve:a,reject:d});let s=i;this.sendAsString&&(s=JSON.stringify(i)),(null===(l=this.debugLogger.jsBridge)||void 0===l?void 0:l.enabled)&&i&&i.id&&i.type===k.REQUEST&&(this._requestPayloadCache[i.id]=i,i.id%100==0&&(this._requestPayloadCache={})),this.debugLogger.jsBridge("send",i,"\r\n ------\x3e ",i.data,"\r\n ------\x3e ",null===(c=i.data)||void 0===c?void 0:c.result),this.sendPayload(s)}catch(e){p?this.rejectCallback(p,e):this.emit(Z,e)}};if(!s)return new Promise(a);a()}rejectCallback(e,t){this.processCallback({method:"reject",id:e,error:t})}resolveCallback(e,t){this.processCallback({method:"resolve",id:e,data:t})}processCallback({method:e,id:t,data:r,error:i}){const n=this.callbacks[t];n&&("reject"===e&&(n.reject&&n.reject(i),this.emit(Z,i)),"resolve"===e&&n.resolve&&n.resolve(r),this.clearCallbackCache(t))}rejectExpiredCallbacks(){if(!this.callbacksExpireTimeout)return;const e=Date.now();for(const t in this.callbacks){const r=this.callbacks[t];if(r&&r.created&&e-r.created>this.callbacksExpireTimeout){const e=$.requestTimeout();this.rejectCallback(t,e)}}setTimeout((()=>{this.rejectExpiredCallbacks()}),this.callbacksExpireTimeout)}clearCallbackCache(e){delete this.callbacks[e]}receive(e="",t){var r,i,n,s,o;let a={data:null};if(f(e)&&(a=e),y(e))try{a=JSON.parse(e)}catch(p){throw this.emit(Z,p),new Error("JsBridge ERROR: JSON.parse payloadReceived failed")}if(a.origin=null==t?void 0:t.origin,a.internal=Boolean(null==t?void 0:t.internal),(null==t?void 0:t.internal)&&this.isExtUi&&function(e){const t=e;return Boolean(t.name)&&["onekey-provider-eth","onekey-provider-cfx","publicConfig"].includes(t.name)}(a))return;if(!a.origin&&!this.isInjected)throw O(null===(r=null==this?void 0:this.constructor)||void 0===r?void 0:r.name,"[payload.origin] is missing.",this),new Error("JsBridge ERROR: receive message [payload.origin] is required.");if(!a.internal&&!a.scope)throw new Error("JsBridge ERROR: receive message [payload.scope] is required for non-internal method call.");const d=null!==(n=this._requestPayloadCache[null!==(i=null==a?void 0:a.id)&&void 0!==i?i:""])&&void 0!==n?n:null;this.debugLogger.jsBridge("receive",a,{sender:t},"\r\n -----\x3e ",null!==(o=null===(s=a.data)||void 0===s?void 0:s.result)&&void 0!==o?o:a.data,"\r\n <----- ",null==d?void 0:d.data);const{type:u,id:l,data:c,error:p,origin:h,remoteId:g}=a;if(this.remoteInfo={origin:h,remoteId:g},u===k.RESPONSE){if(null==l)throw new Error("JsBridge ERROR: parameter [id] is required in JsBridge.receive() when REQUEST type message");if(this.callbacks[l])try{p?this.rejectCallback(l,p):this.resolveCallback(l,c)}catch(e){this.emit(Z,e)}}else{if(u!==k.REQUEST)throw new Error(`JsBridge ERROR: payload type not support yet (type=${u||"undefined"})`);{const e=Object.assign(Object.assign({},a),{created:Date.now()});this.emit(X,e)}}}requestSync({data:e,scope:t,remoteId:r}){this.send({id:void 0,type:k.REQUEST,scope:t,data:e,remoteId:r,sync:!0})}request(e){const{data:t,remoteId:r,scope:i}=e;return void 0===t&&console.warn("JsBridge ERROR: data required. Call like `bridge.request({ data: {...} });`"),this.send({type:k.REQUEST,data:t,remoteId:r,sync:!1,scope:i})}response({id:e,data:t,remoteId:r,scope:i}){this.send({type:k.RESPONSE,data:t,id:e,remoteId:r,scope:i,sync:!0})}responseError({id:e,error:t,scope:r,remoteId:i}){this.send({type:k.RESPONSE,error:t,id:e,remoteId:i,scope:r,sync:!0})}}__webpack_require__(1049);let Q=!1;class ee extends J{constructor(e){var t;super(e),this.sendAsString=!1,this.isInjected=!0,this.bridgeConfig=e,this.targetOrigin=null!==(t=e.targetOrigin)&&void 0!==t?t:window.location.origin,function(e={}){Q||(Q=!0,window.addEventListener("message",(t=>{var r,i,n;const s=t.data,o=null===(r=e.bridge)||void 0===r?void 0:r.bridgeConfig;if(o&&s.channel===o.channel&&s.frameName===o.remoteFrameName){const t=s.payload,r=null!==(i=e.bridge)&&void 0!==i?i:null===(n=null===window||void 0===window?void 0:window.$onekey)||void 0===n?void 0:n.jsBridge;r&&r.receive(t)}}),!1))}({debugLogger:this.debugLogger,bridge:this,origin:this.targetOrigin})}sendPayload(e){const t={channel:this.bridgeConfig.channel,frameName:this.bridgeConfig.selfFrameName,payload:e,direction:""};this.bridgeConfig.remoteFrame.postMessage(t,this.targetOrigin)}}let te,re;const ie=(0,r.jl)(r.d0.SendMessage),ne=()=>{Q=!1},se=async(e,t=!0)=>{const r=t?re:te;try{"LOG_EVENT"!==e.event&&ie.debug("request: ",e);const t=await(null==r?void 0:r.request({scope:u.scope,data:{...e}}));return"LOG_EVENT"!==e.event&&ie.debug("response: ",t),t}catch(e){throw ie.error(e),i.ERRORS.CreateErrorByMessage(e.message)}},oe=new(t()),ae=(0,r.jl)(r.d0.Connect);let de=(0,r._4)();const ue=async e=>{switch(e.event){case r.rF:if(e.type===r.Bg.INIT_BRIDGE)return o.resolve(),Promise.resolve({success:!0,payload:"JSBridge Handshake Success"});oe.emit(e.event,e),oe.emit(e.type,e.payload);break;case r.og:case r.SI:oe.emit(e.event,e);break;case r.Fd:[r.Td.CONNECT,r.Td.DISCONNECT,r.Td.FEATURES,r.Td.SUPPORT_FEATURES].includes(e.type)&&oe.emit(e.type,e.payload);break;default:ae.log("No need to be captured message",e.event)}},le=()=>{oe.removeAllListeners(),(()=>{if(n&&n.parentNode)try{n.parentNode.removeChild(n)}catch(e){}n=null,a=0})(),de=(0,r._4)(),window.removeEventListener("message",pe)};let ce=null;const pe=e=>{var t,i,o;e.origin===s&&(re&&ce===(null===(t=n)||void 0===t?void 0:t.contentWindow)||(ne(),(e=>{const t=new ee(e);e.isHost?re=t:te=t})({isHost:!0,remoteFrame:null===(i=n)||void 0===i?void 0:i.contentWindow,remoteFrameName:u.iframeName,selfFrameName:u.hostName,channel:u.channel,targetOrigin:s,receiveHandler:async e=>{const t=(0,r.kW)(e);"LOG_EVENT"!==t.event&&ae.debug("Host Bridge Receive message: ",t);const i=await ue(t);return"LOG_EVENT"!==t.event&&ae.debug("Host Bridge response: ",i),i}}),ce=null===(o=n)||void 0===o?void 0:o.contentWindow))},he=async e=>{if(n)throw i.ERRORS.TypedError(i.HardwareErrorCode.IFrameAleradyInitialized);de=(0,r._4)({...de,...e}),(0,r.yI)(!!e.debug),(0,r.hZ)(ue),ae.debug("init"),window.addEventListener("message",pe),window.addEventListener("unload",le);try{return await d({...de,version:"0.2.1"}),!0}catch(e){return console.log("init error: ",e),!1}},fe=(0,r.ZP)({eventEmitter:oe,init:he,call:async e=>{if(ae.debug("call : ",e),!n&&!a){de=(0,r._4)(de),ae.debug("Try to recreate iframe if it's initialize failed: ",de);try{if(!await he(de))return ae.debug("Recreate iframe failed"),(0,r.xG)(i.ERRORS.TypedError(i.HardwareErrorCode.IFrameLoadFail));ae.debug("Recreate iframe success")}catch(e){return ae.debug("Recreate iframe failed: ",e),(0,r.xG)(e)}}if(a)return(0,r.xG)(i.ERRORS.TypedError(i.HardwareErrorCode.IFrameLoadFail));try{const t=await se({event:r.Bg.CALL,type:r.Bg.CALL,payload:e});return t||(0,r.xG)(i.ERRORS.TypedError(i.HardwareErrorCode.CallMethodNotResponse))}catch(e){ae.error("__call error: ",e);let t=e;return t instanceof i.HardwareError||(t=i.ERRORS.CreateErrorByMessage(e.message)),(0,r.xG)(t)}},cancel:e=>{se({event:r.Bg.CANCEL,type:r.Bg.CANCEL,payload:{connectId:e}})},dispose:le,uiResponse:e=>{if(!n)throw i.ERRORS.TypedError(i.HardwareErrorCode.IFrameNotInitialized);const{type:t,payload:s}=e;se({event:r.rF,type:t,payload:s})}})})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["onekey-js-sdk"]=t():e["onekey-js-sdk"]=t()}(self,(()=>(()=>{var __webpack_modules__={3525:(e,t)=>{"use strict";function r(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function i(e){if("boolean"!=typeof e)throw new Error(`Expected boolean, not ${e}`)}function n(e,...t){if(!(e instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new TypeError(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function s(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");r(e.outputLen),r(e.blockLen)}function o(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function a(e,t){n(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}Object.defineProperty(t,"__esModule",{value:!0}),t.output=t.exists=t.hash=t.bytes=t.bool=t.number=void 0,t.number=r,t.bool=i,t.bytes=n,t.hash=s,t.exists=o,t.output=a;const d={number:r,bool:i,bytes:n,hash:s,exists:o,output:a};t.default=d},2686:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BLAKE2=t.SIGMA=void 0;const i=r(3525),n=r(64);t.SIGMA=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3]);class s extends n.Hash{constructor(e,t,r={},s,o,a){if(super(),this.blockLen=e,this.outputLen=t,this.length=0,this.pos=0,this.finished=!1,this.destroyed=!1,i.default.number(e),i.default.number(t),i.default.number(s),t<0||t>s)throw new Error("Blake2: outputLen bigger than keyLen");if(void 0!==r.key&&(r.key.length<1||r.key.length>s))throw new Error(`Key should be up 1..${s} byte long or undefined`);if(void 0!==r.salt&&r.salt.length!==o)throw new Error(`Salt should be ${o} byte long or undefined`);if(void 0!==r.personalization&&r.personalization.length!==a)throw new Error(`Personalization should be ${a} byte long or undefined`);this.buffer32=(0,n.u32)(this.buffer=new Uint8Array(e))}update(e){i.default.exists(this);const{blockLen:t,buffer:r,buffer32:s}=this,o=(e=(0,n.toBytes)(e)).length;for(let i=0;i<o;){this.pos===t&&(this.compress(s,0,!1),this.pos=0);const n=Math.min(t-this.pos,o-i),a=e.byteOffset+i;if(n!==t||a%4||!(i+n<o))r.set(e.subarray(i,i+n),this.pos),this.pos+=n,this.length+=n,i+=n;else{const r=new Uint32Array(e.buffer,a,Math.floor((o-i)/4));for(let e=0;i+t<o;e+=s.length,i+=t)this.length+=t,this.compress(r,e,!1)}}return this}digestInto(e){i.default.exists(this),i.default.output(e,this);const{pos:t,buffer32:r}=this;this.finished=!0,this.buffer.subarray(t).fill(0),this.compress(r,0,!0);const s=(0,n.u32)(e);this.get().forEach(((e,t)=>s[t]=e))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){const{buffer:t,length:r,finished:i,destroyed:n,outputLen:s,pos:o}=this;return e||(e=new this.constructor({dkLen:s})),e.set(...this.get()),e.length=r,e.finished=i,e.destroyed=n,e.outputLen=s,e.buffer.set(t),e.pos=o,e}}t.BLAKE2=s},9350:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SHA2=void 0;const i=r(3525),n=r(64);class s extends n.Hash{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,n.createView)(this.buffer)}update(e){i.default.exists(this);const{view:t,buffer:r,blockLen:s}=this,o=(e=(0,n.toBytes)(e)).length;for(let i=0;i<o;){const a=Math.min(s-this.pos,o-i);if(a!==s)r.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===s&&(this.process(t,0),this.pos=0);else{const t=(0,n.createView)(e);for(;s<=o-i;i+=s)this.process(t,i)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){i.default.exists(this),i.default.output(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:s,isLE:o}=this;let{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(r,0),a=0);for(let e=a;e<s;e++)t[e]=0;!function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);const n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),d=i?4:0,u=i?0:4;e.setUint32(t+d,o,i),e.setUint32(t+u,a,i)}(r,s-8,BigInt(8*this.length),o),this.process(r,0);const d=(0,n.createView)(e);this.get().forEach(((e,t)=>d.setUint32(4*t,e,o)))}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}t.SHA2=s},1655:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.add=t.toBig=t.split=t.fromBig=void 0;const r=BigInt(2**32-1),i=BigInt(32);function n(e,t=!1){return t?{h:Number(e&r),l:Number(e>>i&r)}:{h:0|Number(e>>i&r),l:0|Number(e&r)}}function s(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:o,l:a}=n(e[s],t);[r[s],i[s]]=[o,a]}return[r,i]}t.fromBig=n,t.split=s;t.toBig=(e,t)=>BigInt(e>>>0)<<i|BigInt(t>>>0);function o(e,t,r,i){const n=(t>>>0)+(i>>>0);return{h:e+r+(n/2**32|0)|0,l:0|n}}t.add=o;const a={fromBig:n,split:s,toBig:t.toBig,shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:(e,t,r)=>e<<r|t>>>32-r,rotlSL:(e,t,r)=>t<<r|e>>>32-r,rotlBH:(e,t,r)=>t<<r-32|e>>>64-r,rotlBL:(e,t,r)=>e<<r-32|t>>>64-r,add:o,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,i)=>t+r+i+(e/2**32|0)|0,add4L:(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),add4H:(e,t,r,i,n)=>t+r+i+n+(e/2**32|0)|0,add5H:(e,t,r,i,n,s)=>t+r+i+n+s+(e/2**32|0)|0,add5L:(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0)};t.default=a},9467:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.blake2s=t.compress=t.IV=void 0;const i=r(2686),n=r(1655),s=r(64);function o(e,t,r,i,n){return e=e+t+n|0,r=r+(i=(0,s.rotr)(i^e,16))|0,{a:e,b:t=(0,s.rotr)(t^r,12),c:r,d:i}}function a(e,t,r,i,n){return e=e+t+n|0,r=r+(i=(0,s.rotr)(i^e,8))|0,{a:e,b:t=(0,s.rotr)(t^r,7),c:r,d:i}}function d(e,t,r,i,n,s,d,u,l,c,p,h,f,y,g,m,v,b,_,w){let E=0;for(let T=0;T<i;T++)({a:n,b:l,c:f,d:v}=o(n,l,f,v,r[t+e[E++]])),({a:n,b:l,c:f,d:v}=a(n,l,f,v,r[t+e[E++]])),({a:s,b:c,c:y,d:b}=o(s,c,y,b,r[t+e[E++]])),({a:s,b:c,c:y,d:b}=a(s,c,y,b,r[t+e[E++]])),({a:d,b:p,c:g,d:_}=o(d,p,g,_,r[t+e[E++]])),({a:d,b:p,c:g,d:_}=a(d,p,g,_,r[t+e[E++]])),({a:u,b:h,c:m,d:w}=o(u,h,m,w,r[t+e[E++]])),({a:u,b:h,c:m,d:w}=a(u,h,m,w,r[t+e[E++]])),({a:n,b:c,c:g,d:w}=o(n,c,g,w,r[t+e[E++]])),({a:n,b:c,c:g,d:w}=a(n,c,g,w,r[t+e[E++]])),({a:s,b:p,c:m,d:v}=o(s,p,m,v,r[t+e[E++]])),({a:s,b:p,c:m,d:v}=a(s,p,m,v,r[t+e[E++]])),({a:d,b:h,c:f,d:b}=o(d,h,f,b,r[t+e[E++]])),({a:d,b:h,c:f,d:b}=a(d,h,f,b,r[t+e[E++]])),({a:u,b:l,c:y,d:_}=o(u,l,y,_,r[t+e[E++]])),({a:u,b:l,c:y,d:_}=a(u,l,y,_,r[t+e[E++]]));return{v0:n,v1:s,v2:d,v3:u,v4:l,v5:c,v6:p,v7:h,v8:f,v9:y,v10:g,v11:m,v12:v,v13:b,v14:_,v15:w}}t.IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.compress=d;class u extends i.BLAKE2{constructor(e={}){super(64,void 0===e.dkLen?32:e.dkLen,e,32,8,8),this.v0=0|t.IV[0],this.v1=0|t.IV[1],this.v2=0|t.IV[2],this.v3=0|t.IV[3],this.v4=0|t.IV[4],this.v5=0|t.IV[5],this.v6=0|t.IV[6],this.v7=0|t.IV[7];const r=e.key?e.key.length:0;if(this.v0^=this.outputLen|r<<8|65536|1<<24,e.salt){const t=(0,s.u32)((0,s.toBytes)(e.salt));this.v4^=t[0],this.v5^=t[1]}if(e.personalization){const t=(0,s.u32)((0,s.toBytes)(e.personalization));this.v6^=t[0],this.v7^=t[1]}if(e.key){const t=new Uint8Array(this.blockLen);t.set((0,s.toBytes)(e.key)),this.update(t)}}get(){const{v0:e,v1:t,v2:r,v3:i,v4:n,v5:s,v6:o,v7:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.v0=0|e,this.v1=0|t,this.v2=0|r,this.v3=0|i,this.v4=0|n,this.v5=0|s,this.v6=0|o,this.v7=0|a}compress(e,r,s){const{h:o,l:a}=n.default.fromBig(BigInt(this.length)),{v0:u,v1:l,v2:c,v3:p,v4:h,v5:f,v6:y,v7:g,v8:m,v9:v,v10:b,v11:_,v12:w,v13:E,v14:T,v15:S}=d(i.SIGMA,r,e,10,this.v0,this.v1,this.v2,this.v3,this.v4,this.v5,this.v6,this.v7,t.IV[0],t.IV[1],t.IV[2],t.IV[3],a^t.IV[4],o^t.IV[5],s?~t.IV[6]:t.IV[6],t.IV[7]);this.v0^=u^m,this.v1^=l^v,this.v2^=c^b,this.v3^=p^_,this.v4^=h^w,this.v5^=f^E,this.v6^=y^T,this.v7^=g^S}destroy(){this.destroyed=!0,this.buffer32.fill(0),this.set(0,0,0,0,0,0,0,0)}}t.blake2s=(0,s.wrapConstructorWithOpts)((e=>new u(e)))},4661:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=void 0,t.crypto={node:void 0,web:"object"==typeof self&&"crypto"in self?self.crypto:void 0}},6053:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sha256=void 0;const i=r(9350),n=r(64),s=(e,t,r)=>e&t^e&r^t&r,o=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),a=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),d=new Uint32Array(64);class u extends i.SHA2{constructor(){super(64,32,8,!1),this.A=0|a[0],this.B=0|a[1],this.C=0|a[2],this.D=0|a[3],this.E=0|a[4],this.F=0|a[5],this.G=0|a[6],this.H=0|a[7]}get(){const{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)d[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=d[e-15],r=d[e-2],i=(0,n.rotr)(t,7)^(0,n.rotr)(t,18)^t>>>3,s=(0,n.rotr)(r,17)^(0,n.rotr)(r,19)^r>>>10;d[e]=s+d[e-7]+i+d[e-16]|0}let{A:r,B:i,C:a,D:u,E:l,F:c,G:p,H:h}=this;for(let e=0;e<64;e++){const t=h+((0,n.rotr)(l,6)^(0,n.rotr)(l,11)^(0,n.rotr)(l,25))+((f=l)&c^~f&p)+o[e]+d[e]|0,y=((0,n.rotr)(r,2)^(0,n.rotr)(r,13)^(0,n.rotr)(r,22))+s(r,i,a)|0;h=p,p=c,c=l,l=u+t|0,u=a,a=i,i=r,r=t+y|0}var f;r=r+this.A|0,i=i+this.B|0,a=a+this.C|0,u=u+this.D|0,l=l+this.E|0,c=c+this.F|0,p=p+this.G|0,h=h+this.H|0,this.set(r,i,a,u,l,c,p,h)}roundClean(){d.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}t.sha256=(0,n.wrapConstructor)((()=>new u))},125:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.shake256=t.shake128=t.keccak_512=t.keccak_384=t.keccak_256=t.keccak_224=t.sha3_512=t.sha3_384=t.sha3_256=t.sha3_224=t.Keccak=t.keccakP=void 0;const i=r(3525),n=r(1655),s=r(64),[o,a,d]=[[],[],[]],u=BigInt(0),l=BigInt(1),c=BigInt(2),p=BigInt(7),h=BigInt(256),f=BigInt(113);for(let e=0,t=l,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],o.push(2*(5*i+r)),a.push((e+1)*(e+2)/2%64);let n=u;for(let e=0;e<7;e++)t=(t<<l^(t>>p)*f)%h,t&c&&(n^=l<<(l<<BigInt(e))-l);d.push(n)}const[y,g]=n.default.split(d,!0),m=(e,t,r)=>r>32?n.default.rotlBH(e,t,r):n.default.rotlSH(e,t,r),v=(e,t,r)=>r>32?n.default.rotlBL(e,t,r):n.default.rotlSL(e,t,r);function b(e,t=24){const r=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=m(s,o,1)^r[i],d=v(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=d}let t=e[2],n=e[3];for(let r=0;r<24;r++){const i=a[r],s=m(t,n,i),d=v(t,n,i),u=o[r];t=e[u],n=e[u+1],e[u]=s,e[u+1]=d}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=y[i],e[1]^=g[i]}r.fill(0)}t.keccakP=b;class _ extends s.Hash{constructor(e,t,r,n=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,i.default.number(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,s.u32)(this.state)}keccak(){b(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){i.default.exists(this);const{blockLen:t,state:r}=this,n=(e=(0,s.toBytes)(e)).length;for(let i=0;i<n;){const s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,0!=(128&t)&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){i.default.exists(this,!1),i.default.bytes(e),this.finish();const t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return i.default.number(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(i.default.output(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new _(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}t.Keccak=_;const w=(e,t,r)=>(0,s.wrapConstructor)((()=>new _(t,e,r)));t.sha3_224=w(6,144,28),t.sha3_256=w(6,136,32),t.sha3_384=w(6,104,48),t.sha3_512=w(6,72,64),t.keccak_224=w(1,144,28),t.keccak_256=w(1,136,32),t.keccak_384=w(1,104,48),t.keccak_512=w(1,72,64);const E=(e,t,r)=>(0,s.wrapConstructorWithOpts)(((i={})=>new _(t,e,void 0===i.dkLen?r:i.dkLen,!0)));t.shake128=E(31,168,16),t.shake256=E(31,136,32)},64:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytes=t.wrapConstructorWithOpts=t.wrapConstructor=t.checkOpts=t.Hash=t.concatBytes=t.toBytes=t.utf8ToBytes=t.asyncLoop=t.nextTick=t.hexToBytes=t.bytesToHex=t.isLE=t.rotr=t.createView=t.u32=t.u8=void 0;const i=r(4661);t.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);t.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));t.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.rotr=(e,t)=>e<<32-t|e>>>t,t.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!t.isLE)throw new Error("Non little-endian hardware is not supported");const n=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));t.bytesToHex=function(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=n[e[r]];return t},t.hexToBytes=function(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const i=2*r,n=e.slice(i,i+2),s=Number.parseInt(n,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t};function s(e){if("string"!=typeof e)throw new TypeError("utf8ToBytes expected string, got "+typeof e);return(new TextEncoder).encode(e)}function o(e){if("string"==typeof e&&(e=s(e)),!(e instanceof Uint8Array))throw new TypeError(`Expected input type is Uint8Array (got ${typeof e})`);return e}t.nextTick=async()=>{},t.asyncLoop=async function(e,r,i){let n=Date.now();for(let s=0;s<e;s++){i(s);const e=Date.now()-n;e>=0&&e<r||(await(0,t.nextTick)(),n+=e)}},t.utf8ToBytes=s,t.toBytes=o,t.concatBytes=function(...e){if(!e.every((e=>e instanceof Uint8Array)))throw new Error("Uint8Array list expected");if(1===e.length)return e[0];const t=e.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){const n=e[t];r.set(n,i),i+=n.length}return r};t.Hash=class{clone(){return this._cloneInto()}};t.checkOpts=function(e,t){if(void 0!==t&&("object"!=typeof t||(r=t,"[object Object]"!==Object.prototype.toString.call(r)||r.constructor!==Object)))throw new TypeError("Options should be object or undefined");var r;return Object.assign(e,t)},t.wrapConstructor=function(e){const t=t=>e().update(o(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},t.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(o(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},t.randomBytes=function(e=32){if(i.crypto.web)return i.crypto.web.getRandomValues(new Uint8Array(e));if(i.crypto.node)return new Uint8Array(i.crypto.node.randomBytes(e).buffer);throw new Error("The environment doesn't have randomBytes function")}},7408:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,r)}(e,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,r,i){var n,s,o,u;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=l.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):f(n,n.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function y(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return d(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var d=s[e];if(void 0===d)return!1;if("function"==typeof d)i(d,this,t);else{var u=d.length,l=f(d,u);for(r=0;r<u;++r)i(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,c(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,c(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,s,o;if(a(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},6781:e=>{"use strict";e.exports=function(e,t){var r=new Array(arguments.length-1),i=0,n=2,s=!0;for(;n<arguments.length;)r[i++]=arguments[n++];return new Promise((function(n,o){r[i]=function(e){if(s)if(s=!1,e)o(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];n.apply(null,t)}};try{e.apply(t||null,r)}catch(e){s&&(s=!1,o(e))}}))}},7026:(e,t)=>{"use strict";var r=t;r.length=function(e){var t=e.length;if(!t)return 0;for(var r=0;--t%4>1&&"="===e.charAt(t);)++r;return Math.ceil(3*e.length)/4-r};for(var i=new Array(64),n=new Array(123),s=0;s<64;)n[i[s]=s<26?s+65:s<52?s+71:s<62?s-4:s-59|43]=s++;r.encode=function(e,t,r){for(var n,s=null,o=[],a=0,d=0;t<r;){var u=e[t++];switch(d){case 0:o[a++]=i[u>>2],n=(3&u)<<4,d=1;break;case 1:o[a++]=i[n|u>>4],n=(15&u)<<2,d=2;break;case 2:o[a++]=i[n|u>>6],o[a++]=i[63&u],d=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return d&&(o[a++]=i[n],o[a++]=61,1===d&&(o[a++]=61)),s?(a&&s.push(String.fromCharCode.apply(String,o.slice(0,a))),s.join("")):String.fromCharCode.apply(String,o.slice(0,a))};var o="invalid encoding";r.decode=function(e,t,r){for(var i,s=r,a=0,d=0;d<e.length;){var u=e.charCodeAt(d++);if(61===u&&a>1)break;if(void 0===(u=n[u]))throw Error(o);switch(a){case 0:i=u,a=1;break;case 1:t[r++]=i<<2|(48&u)>>4,i=u,a=2;break;case 2:t[r++]=(15&i)<<4|(60&u)>>2,i=u,a=3;break;case 3:t[r++]=(3&i)<<6|u,a=0}}if(1===a)throw Error(o);return r-s},r.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)}},1706:e=>{"use strict";function t(e,r){"string"==typeof e&&(r=e,e=void 0);var i=[];function n(e){if("string"!=typeof e){var r=s();if(t.verbose&&console.log("codegen: "+r),r="return "+r,e){for(var o=Object.keys(e),a=new Array(o.length+1),d=new Array(o.length),u=0;u<o.length;)a[u]=o[u],d[u]=e[o[u++]];return a[u]=r,Function.apply(null,a).apply(null,d)}return Function(r)()}for(var l=new Array(arguments.length-1),c=0;c<l.length;)l[c]=arguments[++c];if(c=0,e=e.replace(/%([%dfijs])/g,(function(e,t){var r=l[c++];switch(t){case"d":case"f":return String(Number(r));case"i":return String(Math.floor(r));case"j":return JSON.stringify(r);case"s":return String(r)}return"%"})),c!==l.length)throw Error("parameter count mismatch");return i.push(e),n}function s(t){return"function "+(t||r||"")+"("+(e&&e.join(",")||"")+"){\n "+i.join("\n ")+"\n}"}return n.toString=s,n}e.exports=t,t.verbose=!1},5570:e=>{"use strict";function t(){this._listeners={}}e.exports=t,t.prototype.on=function(e,t,r){return(this._listeners[e]||(this._listeners[e]=[])).push({fn:t,ctx:r||this}),this},t.prototype.off=function(e,t){if(void 0===e)this._listeners={};else if(void 0===t)this._listeners[e]=[];else for(var r=this._listeners[e],i=0;i<r.length;)r[i].fn===t?r.splice(i,1):++i;return this},t.prototype.emit=function(e){var t=this._listeners[e];if(t){for(var r=[],i=1;i<arguments.length;)r.push(arguments[i++]);for(i=0;i<t.length;)t[i].fn.apply(t[i++].ctx,r)}return this}},4641:(e,t,r)=>{"use strict";e.exports=s;var i=r(6781),n=r(6116)("fs");function s(e,t,r){return"function"==typeof t?(r=t,t={}):t||(t={}),r?!t.xhr&&n&&n.readFile?n.readFile(e,(function(i,n){return i&&"undefined"!=typeof XMLHttpRequest?s.xhr(e,t,r):i?r(i):r(null,t.binary?n:n.toString("utf8"))})):s.xhr(e,t,r):i(s,this,e,t)}s.xhr=function(e,t,r){var i=new XMLHttpRequest;i.onreadystatechange=function(){if(4===i.readyState){if(0!==i.status&&200!==i.status)return r(Error("status "+i.status));if(t.binary){var e=i.response;if(!e){e=[];for(var n=0;n<i.responseText.length;++n)e.push(255&i.responseText.charCodeAt(n))}return r(null,"undefined"!=typeof Uint8Array?new Uint8Array(e):e)}return r(null,i.responseText)}},t.binary&&("overrideMimeType"in i&&i.overrideMimeType("text/plain; charset=x-user-defined"),i.responseType="arraybuffer"),i.open("GET",e),i.send()}},5298:e=>{"use strict";function t(e){return"undefined"!=typeof Float32Array?function(){var t=new Float32Array([-0]),r=new Uint8Array(t.buffer),i=128===r[3];function n(e,i,n){t[0]=e,i[n]=r[0],i[n+1]=r[1],i[n+2]=r[2],i[n+3]=r[3]}function s(e,i,n){t[0]=e,i[n]=r[3],i[n+1]=r[2],i[n+2]=r[1],i[n+3]=r[0]}function o(e,i){return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],t[0]}function a(e,i){return r[3]=e[i],r[2]=e[i+1],r[1]=e[i+2],r[0]=e[i+3],t[0]}e.writeFloatLE=i?n:s,e.writeFloatBE=i?s:n,e.readFloatLE=i?o:a,e.readFloatBE=i?a:o}():function(){function t(e,t,r,i){var n=t<0?1:0;if(n&&(t=-t),0===t)e(1/t>0?0:2147483648,r,i);else if(isNaN(t))e(2143289344,r,i);else if(t>34028234663852886e22)e((n<<31|2139095040)>>>0,r,i);else if(t<11754943508222875e-54)e((n<<31|Math.round(t/1401298464324817e-60))>>>0,r,i);else{var s=Math.floor(Math.log(t)/Math.LN2);e((n<<31|s+127<<23|8388607&Math.round(t*Math.pow(2,-s)*8388608))>>>0,r,i)}}function o(e,t,r){var i=e(t,r),n=2*(i>>31)+1,s=i>>>23&255,o=8388607&i;return 255===s?o?NaN:n*(1/0):0===s?1401298464324817e-60*n*o:n*Math.pow(2,s-150)*(o+8388608)}e.writeFloatLE=t.bind(null,r),e.writeFloatBE=t.bind(null,i),e.readFloatLE=o.bind(null,n),e.readFloatBE=o.bind(null,s)}(),"undefined"!=typeof Float64Array?function(){var t=new Float64Array([-0]),r=new Uint8Array(t.buffer),i=128===r[7];function n(e,i,n){t[0]=e,i[n]=r[0],i[n+1]=r[1],i[n+2]=r[2],i[n+3]=r[3],i[n+4]=r[4],i[n+5]=r[5],i[n+6]=r[6],i[n+7]=r[7]}function s(e,i,n){t[0]=e,i[n]=r[7],i[n+1]=r[6],i[n+2]=r[5],i[n+3]=r[4],i[n+4]=r[3],i[n+5]=r[2],i[n+6]=r[1],i[n+7]=r[0]}function o(e,i){return r[0]=e[i],r[1]=e[i+1],r[2]=e[i+2],r[3]=e[i+3],r[4]=e[i+4],r[5]=e[i+5],r[6]=e[i+6],r[7]=e[i+7],t[0]}function a(e,i){return r[7]=e[i],r[6]=e[i+1],r[5]=e[i+2],r[4]=e[i+3],r[3]=e[i+4],r[2]=e[i+5],r[1]=e[i+6],r[0]=e[i+7],t[0]}e.writeDoubleLE=i?n:s,e.writeDoubleBE=i?s:n,e.readDoubleLE=i?o:a,e.readDoubleBE=i?a:o}():function(){function t(e,t,r,i,n,s){var o=i<0?1:0;if(o&&(i=-i),0===i)e(0,n,s+t),e(1/i>0?0:2147483648,n,s+r);else if(isNaN(i))e(0,n,s+t),e(2146959360,n,s+r);else if(i>17976931348623157e292)e(0,n,s+t),e((o<<31|2146435072)>>>0,n,s+r);else{var a;if(i<22250738585072014e-324)e((a=i/5e-324)>>>0,n,s+t),e((o<<31|a/4294967296)>>>0,n,s+r);else{var d=Math.floor(Math.log(i)/Math.LN2);1024===d&&(d=1023),e(4503599627370496*(a=i*Math.pow(2,-d))>>>0,n,s+t),e((o<<31|d+1023<<20|1048576*a&1048575)>>>0,n,s+r)}}}function o(e,t,r,i,n){var s=e(i,n+t),o=e(i,n+r),a=2*(o>>31)+1,d=o>>>20&2047,u=4294967296*(1048575&o)+s;return 2047===d?u?NaN:a*(1/0):0===d?5e-324*a*u:a*Math.pow(2,d-1075)*(u+4503599627370496)}e.writeDoubleLE=t.bind(null,r,0,4),e.writeDoubleBE=t.bind(null,i,4,0),e.readDoubleLE=o.bind(null,n,0,4),e.readDoubleBE=o.bind(null,s,4,0)}(),e}function r(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}function i(e,t,r){t[r]=e>>>24,t[r+1]=e>>>16&255,t[r+2]=e>>>8&255,t[r+3]=255&e}function n(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function s(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}e.exports=t(t)},6116:module=>{"use strict";function inquire(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(e){}return null}module.exports=inquire},2659:(e,t)=>{"use strict";var r=t,i=r.isAbsolute=function(e){return/^(?:\/|\w+:)/.test(e)},n=r.normalize=function(e){var t=(e=e.replace(/\\/g,"/").replace(/\/{2,}/g,"/")).split("/"),r=i(e),n="";r&&(n=t.shift()+"/");for(var s=0;s<t.length;)".."===t[s]?s>0&&".."!==t[s-1]?t.splice(--s,2):r?t.splice(s,1):++s:"."===t[s]?t.splice(s,1):++s;return n+t.join("/")};r.resolve=function(e,t,r){return r||(t=n(t)),i(t)?t:(r||(e=n(e)),(e=e.replace(/(?:\/|^)[^/]+$/,"")).length?n(e+"/"+t):t)}},804:e=>{"use strict";e.exports=function(e,t,r){var i=r||8192,n=i>>>1,s=null,o=i;return function(r){if(r<1||r>n)return e(r);o+r>i&&(s=e(i),o=0);var a=t.call(s,o,o+=r);return 7&o&&(o=1+(7|o)),a}}},7958:(e,t)=>{"use strict";var r=t;r.length=function(e){for(var t=0,r=0,i=0;i<e.length;++i)(r=e.charCodeAt(i))<128?t+=1:r<2048?t+=2:55296==(64512&r)&&56320==(64512&e.charCodeAt(i+1))?(++i,t+=4):t+=3;return t},r.read=function(e,t,r){if(r-t<1)return"";for(var i,n=null,s=[],o=0;t<r;)(i=e[t++])<128?s[o++]=i:i>191&&i<224?s[o++]=(31&i)<<6|63&e[t++]:i>239&&i<365?(i=((7&i)<<18|(63&e[t++])<<12|(63&e[t++])<<6|63&e[t++])-65536,s[o++]=55296+(i>>10),s[o++]=56320+(1023&i)):s[o++]=(15&i)<<12|(63&e[t++])<<6|63&e[t++],o>8191&&((n||(n=[])).push(String.fromCharCode.apply(String,s)),o=0);return n?(o&&n.push(String.fromCharCode.apply(String,s.slice(0,o))),n.join("")):String.fromCharCode.apply(String,s.slice(0,o))},r.write=function(e,t,r){for(var i,n,s=r,o=0;o<e.length;++o)(i=e.charCodeAt(o))<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):55296==(64512&i)&&56320==(64512&(n=e.charCodeAt(o+1)))?(i=65536+((1023&i)<<10)+(1023&n),++o,t[r++]=i>>18|240,t[r++]=i>>12&63|128,t[r++]=i>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128);return r-s}},9644:(e,t,r)=>{e.exports=r(5644)},353:(e,t,r)=>{"use strict";var i=r(3044),n=r(6955),s=r(2233),o=r(8030),a=r(7948),d=r(1875),u=r(842),l=r(8560),c=r(1218),p=r(8047),h=r(738);e.exports=function(e){return new Promise((function(t,r){var f,y=e.data,g=e.headers,m=e.responseType;function v(){e.cancelToken&&e.cancelToken.unsubscribe(f),e.signal&&e.signal.removeEventListener("abort",f)}i.isFormData(y)&&i.isStandardBrowserEnv()&&delete g["Content-Type"];var b=new XMLHttpRequest;if(e.auth){var _=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";g.Authorization="Basic "+btoa(_+":"+w)}var E=a(e.baseURL,e.url);function T(){if(b){var i="getAllResponseHeaders"in b?d(b.getAllResponseHeaders()):null,s={data:m&&"text"!==m&&"json"!==m?b.response:b.responseText,status:b.status,statusText:b.statusText,headers:i,config:e,request:b};n((function(e){t(e),v()}),(function(e){r(e),v()}),s),b=null}}if(b.open(e.method.toUpperCase(),o(E,e.params,e.paramsSerializer),!0),b.timeout=e.timeout,"onloadend"in b?b.onloadend=T:b.onreadystatechange=function(){b&&4===b.readyState&&(0!==b.status||b.responseURL&&0===b.responseURL.indexOf("file:"))&&setTimeout(T)},b.onabort=function(){b&&(r(new c("Request aborted",c.ECONNABORTED,e,b)),b=null)},b.onerror=function(){r(new c("Network Error",c.ERR_NETWORK,e,b,b)),b=null},b.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",i=e.transitional||l;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new c(t,i.clarifyTimeoutError?c.ETIMEDOUT:c.ECONNABORTED,e,b)),b=null},i.isStandardBrowserEnv()){var S=(e.withCredentials||u(E))&&e.xsrfCookieName?s.read(e.xsrfCookieName):void 0;S&&(g[e.xsrfHeaderName]=S)}"setRequestHeader"in b&&i.forEach(g,(function(e,t){void 0===y&&"content-type"===t.toLowerCase()?delete g[t]:b.setRequestHeader(t,e)})),i.isUndefined(e.withCredentials)||(b.withCredentials=!!e.withCredentials),m&&"json"!==m&&(b.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&b.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&b.upload&&b.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(f=function(e){b&&(r(!e||e&&e.type?new p:e),b.abort(),b=null)},e.cancelToken&&e.cancelToken.subscribe(f),e.signal&&(e.signal.aborted?f():e.signal.addEventListener("abort",f))),y||(y=null);var R=h(E);R&&-1===["http","https","file"].indexOf(R)?r(new c("Unsupported protocol "+R+":",c.ERR_BAD_REQUEST,e)):b.send(y)}))}},5644:(e,t,r)=>{"use strict";var i=r(3044),n=r(3644),s=r(2215),o=r(2937);var a=function e(t){var r=new s(t),a=n(s.prototype.request,r);return i.extend(a,s.prototype,r),i.extend(a,r),a.create=function(r){return e(o(t,r))},a}(r(663));a.Axios=s,a.CanceledError=r(8047),a.CancelToken=r(4089),a.isCancel=r(8041),a.VERSION=r(9241).version,a.toFormData=r(9027),a.AxiosError=r(1218),a.Cancel=a.CanceledError,a.all=function(e){return Promise.all(e)},a.spread=r(783),a.isAxiosError=r(5587),e.exports=a,e.exports.default=a},4089:(e,t,r)=>{"use strict";var i=r(8047);function n(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;this.promise.then((function(e){if(r._listeners){var t,i=r._listeners.length;for(t=0;t<i;t++)r._listeners[t](e);r._listeners=null}})),this.promise.then=function(e){var t,i=new Promise((function(e){r.subscribe(e),t=e})).then(e);return i.cancel=function(){r.unsubscribe(t)},i},e((function(e){r.reason||(r.reason=new i(e),t(r.reason))}))}n.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},n.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},n.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},n.source=function(){var e;return{token:new n((function(t){e=t})),cancel:e}},e.exports=n},8047:(e,t,r)=>{"use strict";var i=r(1218);function n(e){i.call(this,null==e?"canceled":e,i.ERR_CANCELED),this.name="CanceledError"}r(3044).inherits(n,i,{__CANCEL__:!0}),e.exports=n},8041:e=>{"use strict";e.exports=function(e){return!(!e||!e.__CANCEL__)}},2215:(e,t,r)=>{"use strict";var i=r(3044),n=r(8030),s=r(946),o=r(6895),a=r(2937),d=r(7948),u=r(7525),l=u.validators;function c(e){this.defaults=e,this.interceptors={request:new s,response:new s}}c.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=a(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&u.assertOptions(r,{silentJSONParsing:l.transitional(l.boolean),forcedJSONParsing:l.transitional(l.boolean),clarifyTimeoutError:l.transitional(l.boolean)},!1);var i=[],n=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(n=n&&e.synchronous,i.unshift(e.fulfilled,e.rejected))}));var s,d=[];if(this.interceptors.response.forEach((function(e){d.push(e.fulfilled,e.rejected)})),!n){var c=[o,void 0];for(Array.prototype.unshift.apply(c,i),c=c.concat(d),s=Promise.resolve(t);c.length;)s=s.then(c.shift(),c.shift());return s}for(var p=t;i.length;){var h=i.shift(),f=i.shift();try{p=h(p)}catch(e){f(e);break}}try{s=o(p)}catch(e){return Promise.reject(e)}for(;d.length;)s=s.then(d.shift(),d.shift());return s},c.prototype.getUri=function(e){e=a(this.defaults,e);var t=d(e.baseURL,e.url);return n(t,e.params,e.paramsSerializer)},i.forEach(["delete","get","head","options"],(function(e){c.prototype[e]=function(t,r){return this.request(a(r||{},{method:e,url:t,data:(r||{}).data}))}})),i.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(a(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}c.prototype[e]=t(),c.prototype[e+"Form"]=t(!0)})),e.exports=c},1218:(e,t,r)=>{"use strict";var i=r(3044);function n(e,t,r,i,n){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),i&&(this.request=i),n&&(this.response=n)}i.inherits(n,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var s=n.prototype,o={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){o[e]={value:e}})),Object.defineProperties(n,o),Object.defineProperty(s,"isAxiosError",{value:!0}),n.from=function(e,t,r,o,a,d){var u=Object.create(s);return i.toFlatObject(e,u,(function(e){return e!==Error.prototype})),n.call(u,e.message,t,r,o,a),u.name=e.name,d&&Object.assign(u,d),u},e.exports=n},946:(e,t,r)=>{"use strict";var i=r(3044);function n(){this.handlers=[]}n.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},n.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},n.prototype.forEach=function(e){i.forEach(this.handlers,(function(t){null!==t&&e(t)}))},e.exports=n},7948:(e,t,r)=>{"use strict";var i=r(9192),n=r(8762);e.exports=function(e,t){return e&&!i(t)?n(e,t):t}},6895:(e,t,r)=>{"use strict";var i=r(3044),n=r(8556),s=r(8041),o=r(663),a=r(8047);function d(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new a}e.exports=function(e){return d(e),e.headers=e.headers||{},e.data=n.call(e,e.data,e.headers,e.transformRequest),e.headers=i.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),i.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||o.adapter)(e).then((function(t){return d(e),t.data=n.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return s(t)||(d(e),t&&t.response&&(t.response.data=n.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))}},2937:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e,t){t=t||{};var r={};function n(e,t){return i.isPlainObject(e)&&i.isPlainObject(t)?i.merge(e,t):i.isPlainObject(t)?i.merge({},t):i.isArray(t)?t.slice():t}function s(r){return i.isUndefined(t[r])?i.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function o(e){if(!i.isUndefined(t[e]))return n(void 0,t[e])}function a(r){return i.isUndefined(t[r])?i.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function d(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var u={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:d};return i.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=u[e]||s,n=t(e);i.isUndefined(n)&&t!==d||(r[e]=n)})),r}},6955:(e,t,r)=>{"use strict";var i=r(1218);e.exports=function(e,t,r){var n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new i("Request failed with status code "+r.status,[i.ERR_BAD_REQUEST,i.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}},8556:(e,t,r)=>{"use strict";var i=r(3044),n=r(663);e.exports=function(e,t,r){var s=this||n;return i.forEach(r,(function(r){e=r.call(s,e,t)})),e}},663:(e,t,r)=>{"use strict";var i=r(3044),n=r(8868),s=r(1218),o=r(8560),a=r(9027),d={"Content-Type":"application/x-www-form-urlencoded"};function u(e,t){!i.isUndefined(e)&&i.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var l,c={transitional:o,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(l=r(353)),l),transformRequest:[function(e,t){if(n(t,"Accept"),n(t,"Content-Type"),i.isFormData(e)||i.isArrayBuffer(e)||i.isBuffer(e)||i.isStream(e)||i.isFile(e)||i.isBlob(e))return e;if(i.isArrayBufferView(e))return e.buffer;if(i.isURLSearchParams(e))return u(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var r,s=i.isObject(e),o=t&&t["Content-Type"];if((r=i.isFileList(e))||s&&"multipart/form-data"===o){var d=this.env&&this.env.FormData;return a(r?{"files[]":e}:e,d&&new d)}return s||"application/json"===o?(u(t,"application/json"),function(e,t,r){if(i.isString(e))try{return(t||JSON.parse)(e),i.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||c.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,o=!r&&"json"===this.responseType;if(o||n&&i.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw s.from(e,s.ERR_BAD_RESPONSE,this,null,this.response);throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:r(4684)},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};i.forEach(["delete","get","head"],(function(e){c.headers[e]={}})),i.forEach(["post","put","patch"],(function(e){c.headers[e]=i.merge(d)})),e.exports=c},8560:e=>{"use strict";e.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}},9241:e=>{e.exports={version:"0.27.2"}},3644:e=>{"use strict";e.exports=function(e,t){return function(){for(var r=new Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];return e.apply(t,r)}}},8030:(e,t,r)=>{"use strict";var i=r(3044);function n(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}e.exports=function(e,t,r){if(!t)return e;var s;if(r)s=r(t);else if(i.isURLSearchParams(t))s=t.toString();else{var o=[];i.forEach(t,(function(e,t){null!=e&&(i.isArray(e)?t+="[]":e=[e],i.forEach(e,(function(e){i.isDate(e)?e=e.toISOString():i.isObject(e)&&(e=JSON.stringify(e)),o.push(n(t)+"="+n(e))})))})),s=o.join("&")}if(s){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}},8762:e=>{"use strict";e.exports=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}},2233:(e,t,r)=>{"use strict";var i=r(3044);e.exports=i.isStandardBrowserEnv()?{write:function(e,t,r,n,s,o){var a=[];a.push(e+"="+encodeURIComponent(t)),i.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),i.isString(n)&&a.push("path="+n),i.isString(s)&&a.push("domain="+s),!0===o&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},9192:e=>{"use strict";e.exports=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}},5587:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e){return i.isObject(e)&&!0===e.isAxiosError}},842:(e,t,r)=>{"use strict";var i=r(3044);e.exports=i.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var i=e;return t&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=i.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0}},8868:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e,t){i.forEach(e,(function(r,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[i])}))}},4684:e=>{e.exports=null},1875:(e,t,r)=>{"use strict";var i=r(3044),n=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];e.exports=function(e){var t,r,s,o={};return e?(i.forEach(e.split("\n"),(function(e){if(s=e.indexOf(":"),t=i.trim(e.substr(0,s)).toLowerCase(),r=i.trim(e.substr(s+1)),t){if(o[t]&&n.indexOf(t)>=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([r]):o[t]?o[t]+", "+r:r}})),o):o}},738:e=>{"use strict";e.exports=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}},783:e=>{"use strict";e.exports=function(e){return function(t){return e.apply(null,t)}}},9027:(e,t,r)=>{"use strict";var i=r(3044);e.exports=function(e,t){t=t||new FormData;var r=[];function n(e){return null===e?"":i.isDate(e)?e.toISOString():i.isArrayBuffer(e)||i.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}return function e(s,o){if(i.isPlainObject(s)||i.isArray(s)){if(-1!==r.indexOf(s))throw Error("Circular reference detected in "+o);r.push(s),i.forEach(s,(function(r,s){if(!i.isUndefined(r)){var a,d=o?o+"."+s:s;if(r&&!o&&"object"==typeof r)if(i.endsWith(s,"{}"))r=JSON.stringify(r);else if(i.endsWith(s,"[]")&&(a=i.toArray(r)))return void a.forEach((function(e){!i.isUndefined(e)&&t.append(d,n(e))}));e(r,d)}})),r.pop()}else t.append(o,n(s))}(e),t}},7525:(e,t,r)=>{"use strict";var i=r(9241).version,n=r(1218),s={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){s[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var o={};s.transitional=function(e,t,r){function s(e,t){return"[Axios v"+i+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,a){if(!1===e)throw new n(s(i," has been removed"+(t?" in "+t:"")),n.ERR_DEPRECATED);return t&&!o[i]&&(o[i]=!0,console.warn(s(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,a)}},e.exports={assertOptions:function(e,t,r){if("object"!=typeof e)throw new n("options must be an object",n.ERR_BAD_OPTION_VALUE);for(var i=Object.keys(e),s=i.length;s-- >0;){var o=i[s],a=t[o];if(a){var d=e[o],u=void 0===d||a(d,o,e);if(!0!==u)throw new n("option "+o+" must be "+u,n.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new n("Unknown option "+o,n.ERR_BAD_OPTION)}},validators:s}},3044:(e,t,r)=>{"use strict";var i,n=r(3644),s=Object.prototype.toString,o=(i=Object.create(null),function(e){var t=s.call(e);return i[t]||(i[t]=t.slice(8,-1).toLowerCase())});function a(e){return e=e.toLowerCase(),function(t){return o(t)===e}}function d(e){return Array.isArray(e)}function u(e){return void 0===e}var l=a("ArrayBuffer");function c(e){return null!==e&&"object"==typeof e}function p(e){if("object"!==o(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var h=a("Date"),f=a("File"),y=a("Blob"),g=a("FileList");function m(e){return"[object Function]"===s.call(e)}var v=a("URLSearchParams");function b(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),d(e))for(var r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}var _,w=(_="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return _&&e instanceof _});e.exports={isArray:d,isArrayBuffer:l,isBuffer:function(e){return null!==e&&!u(e)&&null!==e.constructor&&!u(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||s.call(e)===t||m(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&l(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:c,isPlainObject:p,isUndefined:u,isDate:h,isFile:f,isBlob:y,isFunction:m,isStream:function(e){return c(e)&&m(e.pipe)},isURLSearchParams:v,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:b,merge:function e(){var t={};function r(r,i){p(t[i])&&p(r)?t[i]=e(t[i],r):p(r)?t[i]=e({},r):d(r)?t[i]=r.slice():t[i]=r}for(var i=0,n=arguments.length;i<n;i++)b(arguments[i],r);return t},extend:function(e,t,r){return b(t,(function(t,i){e[i]=r&&"function"==typeof t?n(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,i){e.prototype=Object.create(t.prototype,i),e.prototype.constructor=e,r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r){var i,n,s,o={};t=t||{};do{for(n=(i=Object.getOwnPropertyNames(e)).length;n-- >0;)o[s=i[n]]||(t[s]=e[s],o[s]=!0);e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:o,kindOfTest:a,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var i=e.indexOf(t,r);return-1!==i&&i===r},toArray:function(e){if(!e)return null;var t=e.length;if(u(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:w,isFileList:g}},5890:(e,t,r)=>{"use strict";var i=r(7699),n=r(8402),s=r(9644),o=r(6391),a=r(64),d=r(9467),u=r(6053),l=r(1297),c=r(7495),p=r(125);function h(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=h(i),y=h(s),g=h(o),m=h(l);function v(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=b(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){(function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)})(i,n,(t=e[r](t)).done,t.value)}))}}}var w,E={exports:{}},T="object"==typeof Reflect?Reflect:null,S=T&&"function"==typeof T.apply?T.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};w=T&&"function"==typeof T.ownKeys?T.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var R=Number.isNaN||function(e){return e!=e};function O(){O.init.call(this)}E.exports=O,E.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}B(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&B(e,"error",t,r)}(e,n,{once:!0})}))},O.EventEmitter=O,O.prototype._events=void 0,O.prototype._eventsCount=0,O.prototype._maxListeners=void 0;var I=10;function x(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function A(e){return void 0===e._maxListeners?O.defaultMaxListeners:e._maxListeners}function C(e,t,r,i){var n,s,o,a;if(x(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=A(e))>0&&o.length>n&&!o.warned){o.warned=!0;var d=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");d.name="MaxListenersExceededWarning",d.emitter=e,d.type=t,d.count=o.length,a=d,console&&console.warn&&console.warn(a)}return e}function k(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function M(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=k.bind(i);return n.listener=r,i.wrapFn=n,n}function N(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):D(n,n.length)}function P(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function D(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function B(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(O,"defaultMaxListeners",{enumerable:!0,get:function(){return I},set:function(e){if("number"!=typeof e||e<0||R(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");I=e}}),O.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},O.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||R(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},O.prototype.getMaxListeners=function(){return A(this)},O.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,n=this._events;if(void 0!==n)i=i&&void 0===n.error;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=n[e];if(void 0===a)return!1;if("function"==typeof a)S(a,this,t);else{var d=a.length,u=D(a,d);for(r=0;r<d;++r)S(u[r],this,t)}return!0},O.prototype.addListener=function(e,t){return C(this,e,t,!1)},O.prototype.on=O.prototype.addListener,O.prototype.prependListener=function(e,t){return C(this,e,t,!0)},O.prototype.once=function(e,t){return x(t),this.on(e,M(this,e,t)),this},O.prototype.prependOnceListener=function(e,t){return x(t),this.prependListener(e,M(this,e,t)),this},O.prototype.removeListener=function(e,t){var r,i,n,s,o;if(x(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},O.prototype.off=O.prototype.removeListener,O.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},O.prototype.listeners=function(e){return N(this,e,!0)},O.prototype.rawListeners=function(e){return N(this,e,!1)},O.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):P.call(e,t)},O.prototype.listenerCount=P,O.prototype.eventNames=function(){return this._eventsCount>0?w(this._events):[]};const L=2147483648,q=e=>(e|L)>>>0,j=e=>(2147483647&e)>>>0,F=n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Not a valid path"),U=n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Path cannot contain negative values"),z=e=>{const t=e.toLowerCase().split("/");if("m"!==t[0])throw F;return t.filter((e=>"m"!==e&&""!==e)).map((e=>{let t=!1;"'"===e.substr(e.length-1)&&(t=!0,e=e.substr(0,e.length-1));let r=parseInt(e);if(Number.isNaN(r))throw F;if(r<0)throw U;return t&&(r=q(r)),r}))},H=e=>{if(!Array.isArray(e)||e.length<1)return"SPENDADDRESS";switch(j(e[0])){case 48:return"SPENDMULTISIG";case 49:return"SPENDP2SHWITNESS";case 84:return"SPENDWITNESS";default:return"SPENDADDRESS"}},$=e=>`m/${e.map((e=>e&L?(2147483647&e)+"'":e)).join("/")}`,G=(e,t=0,r=!1)=>{let i;if(i="string"==typeof e?z(e):Array.isArray(e)?e.map((e=>{const t=parseInt(e);if(Number.isNaN(t))throw F;if(t<0)throw U;return t})):void 0,!i)throw F;if(t>0&&i.length<t)throw F;return r?i.splice(0,3):i},W=e=>e&&"object"==typeof e&&e.model?"1"===e.model?"model_mini":"model_touch":"model_mini",V=e=>{if(!e||"object"!=typeof e||!e.serial_no)return"classic";const t=e.serial_no.slice(0,2);return"mi"===t.toLowerCase()?"mini":"tc"===t.toLowerCase()?"touch":"classic"},K=e=>e?e.startsWith("MI")?"mini":e.startsWith("T")?"touch":"classic":"classic",Y=e=>{var t,r;return"classic"===V(e)?null!==(t=e.onekey_serial)&&void 0!==t?t:"":null!==(r=e.serial_no)&&void 0!==r?r:""},X=e=>{const t=V(e);return"string"==typeof e.label?e.label:`My OneKey ${t.charAt(0).toUpperCase()+t.slice(1)}`},Z=e=>e?e.onekey_version?e.onekey_version.split("."):[e.major_version,e.minor_version,e.patch_version]:[0,0,0],J=e=>e.ble_ver&&f.default.valid(e.ble_ver)?e.ble_ver.split("."):null,Q=e=>{if(!e)return{support:!1};if("touch"===V(e))return{support:!1};const t=Z(e).join(".");return{support:f.default.gte(t,"2.3.0"),require:"2.3.0"}},ee=(e,t)=>v(void 0,void 0,void 0,(function*(){if(!e)return!1;const{message:r}=yield t.typedCall("GetAddress","Address",{address_n:[q(44),q(1),q(0),0,0],coin_name:"Testnet",script_type:"SPENDADDRESS",show_display:!1});return r.address}));var te={nested:{AlgorandGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:3}}},AlgorandAddress:{fields:{address:{type:"string",id:1}}},AlgorandSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},AlgorandSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},AptosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},AptosAddress:{fields:{address:{type:"string",id:1}}},AptosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},AptosSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},AptosSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},payload:{rule:"required",type:"AptosMessagePayload",id:2}},nested:{AptosMessagePayload:{fields:{address:{type:"string",id:2},chain_id:{type:"string",id:3},application:{type:"string",id:4},nonce:{rule:"required",type:"string",id:5},message:{rule:"required",type:"string",id:6}}}}},AptosMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:1},address:{rule:"required",type:"string",id:2}}},BinanceGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},BinanceAddress:{fields:{address:{rule:"required",type:"string",id:1}}},BinanceGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},BinancePublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},BinanceSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},msg_count:{type:"uint32",id:2},account_number:{type:"sint64",id:3},chain_id:{type:"string",id:4},memo:{type:"string",id:5},sequence:{type:"sint64",id:6},source:{type:"sint64",id:7}}},BinanceTxRequest:{fields:{}},BinanceTransferMsg:{fields:{inputs:{rule:"repeated",type:"BinanceInputOutput",id:1},outputs:{rule:"repeated",type:"BinanceInputOutput",id:2}},nested:{BinanceInputOutput:{fields:{address:{type:"string",id:1},coins:{rule:"repeated",type:"BinanceCoin",id:2}}},BinanceCoin:{fields:{amount:{type:"sint64",id:1},denom:{type:"string",id:2}}}}},BinanceOrderMsg:{fields:{id:{type:"string",id:1},ordertype:{type:"BinanceOrderType",id:2},price:{type:"sint64",id:3},quantity:{type:"sint64",id:4},sender:{type:"string",id:5},side:{type:"BinanceOrderSide",id:6},symbol:{type:"string",id:7},timeinforce:{type:"BinanceTimeInForce",id:8}},nested:{BinanceOrderType:{values:{OT_UNKNOWN:0,MARKET:1,LIMIT:2,OT_RESERVED:3}},BinanceOrderSide:{values:{SIDE_UNKNOWN:0,BUY:1,SELL:2}},BinanceTimeInForce:{values:{TIF_UNKNOWN:0,GTE:1,TIF_RESERVED:2,IOC:3}}}},BinanceCancelMsg:{fields:{refid:{type:"string",id:1},sender:{type:"string",id:2},symbol:{type:"string",id:3}}},BinanceSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},public_key:{rule:"required",type:"bytes",id:2}}},InputScriptType:{values:{SPENDADDRESS:0,SPENDMULTISIG:1,EXTERNAL:2,SPENDWITNESS:3,SPENDP2SHWITNESS:4,SPENDTAPROOT:5}},OutputScriptType:{values:{PAYTOADDRESS:0,PAYTOSCRIPTHASH:1,PAYTOMULTISIG:2,PAYTOOPRETURN:3,PAYTOWITNESS:4,PAYTOP2SHWITNESS:5,PAYTOTAPROOT:6}},DecredStakingSpendType:{values:{SSGen:0,SSRTX:1}},AmountUnit:{values:{BITCOIN:0,MILLIBITCOIN:1,MICROBITCOIN:2,SATOSHI:3}},MultisigRedeemScriptType:{fields:{pubkeys:{rule:"repeated",type:"HDNodePathType",id:1},signatures:{rule:"repeated",type:"bytes",id:2},m:{rule:"required",type:"uint32",id:3},nodes:{rule:"repeated",type:"HDNodeType",id:4},address_n:{rule:"repeated",type:"uint32",id:5,options:{packed:!1}}},nested:{HDNodePathType:{fields:{node:{rule:"required",type:"HDNodeType",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}}}}}},GetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},ecdsa_curve_name:{type:"string",id:2},show_display:{type:"bool",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}}},PublicKey:{fields:{node:{rule:"required",type:"HDNodeType",id:1},xpub:{rule:"required",type:"string",id:2},root_fingerprint:{type:"uint32",id:3}}},GetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},show_display:{type:"bool",id:3},multisig:{type:"MultisigRedeemScriptType",id:4},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}}},Address:{fields:{address:{rule:"required",type:"string",id:1}}},GetOwnershipId:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},multisig:{type:"MultisigRedeemScriptType",id:3},script_type:{type:"InputScriptType",id:4,options:{default:"SPENDADDRESS"}}}},OwnershipId:{fields:{ownership_id:{rule:"required",type:"bytes",id:1}}},SignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2},coin_name:{type:"string",id:3,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:4,options:{default:"SPENDADDRESS"}},no_script_type:{type:"bool",id:5}}},MessageSignature:{fields:{address:{rule:"required",type:"string",id:1},signature:{rule:"required",type:"bytes",id:2}}},VerifyMessage:{fields:{address:{rule:"required",type:"string",id:1},signature:{rule:"required",type:"bytes",id:2},message:{rule:"required",type:"bytes",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}}}},SignTx:{fields:{outputs_count:{rule:"required",type:"uint32",id:1},inputs_count:{rule:"required",type:"uint32",id:2},coin_name:{type:"string",id:3,options:{default:"Bitcoin"}},version:{type:"uint32",id:4,options:{default:1}},lock_time:{type:"uint32",id:5,options:{default:0}},expiry:{type:"uint32",id:6},overwintered:{type:"bool",id:7,options:{deprecated:!0}},version_group_id:{type:"uint32",id:8},timestamp:{type:"uint32",id:9},branch_id:{type:"uint32",id:10},amount_unit:{type:"AmountUnit",id:11,options:{default:"BITCOIN"}},decred_staking_ticket:{type:"bool",id:12,options:{default:!1}}}},TxRequest:{fields:{request_type:{type:"RequestType",id:1},details:{type:"TxRequestDetailsType",id:2},serialized:{type:"TxRequestSerializedType",id:3}},nested:{RequestType:{values:{TXINPUT:0,TXOUTPUT:1,TXMETA:2,TXFINISHED:3,TXEXTRADATA:4,TXORIGINPUT:5,TXORIGOUTPUT:6}},TxRequestDetailsType:{fields:{request_index:{type:"uint32",id:1},tx_hash:{type:"bytes",id:2},extra_data_len:{type:"uint32",id:3},extra_data_offset:{type:"uint32",id:4}}},TxRequestSerializedType:{fields:{signature_index:{type:"uint32",id:1},signature:{type:"bytes",id:2},serialized_tx:{type:"bytes",id:3}}}}},TxAck:{options:{deprecated:!0},fields:{tx:{type:"TransactionType",id:1}},nested:{TransactionType:{fields:{version:{type:"uint32",id:1},inputs:{rule:"repeated",type:"TxInputType",id:2},bin_outputs:{rule:"repeated",type:"TxOutputBinType",id:3},lock_time:{type:"uint32",id:4},outputs:{rule:"repeated",type:"TxOutputType",id:5},inputs_cnt:{type:"uint32",id:6},outputs_cnt:{type:"uint32",id:7},extra_data:{type:"bytes",id:8},extra_data_len:{type:"uint32",id:9},expiry:{type:"uint32",id:10},overwintered:{type:"bool",id:11,options:{deprecated:!0}},version_group_id:{type:"uint32",id:12},timestamp:{type:"uint32",id:13},branch_id:{type:"uint32",id:14}},nested:{TxInputType:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{type:"bytes",id:4},sequence:{type:"uint32",id:5,options:{default:4294967295}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:7},amount:{type:"uint64",id:8},decred_tree:{type:"uint32",id:9},witness:{type:"bytes",id:13},ownership_proof:{type:"bytes",id:14},commitment_data:{type:"bytes",id:15},orig_hash:{type:"bytes",id:16},orig_index:{type:"uint32",id:17},decred_staking_spend:{type:"DecredStakingSpendType",id:18},script_pubkey:{type:"bytes",id:19}}},TxOutputBinType:{fields:{amount:{rule:"required",type:"uint64",id:1},script_pubkey:{rule:"required",type:"bytes",id:2},decred_script_version:{type:"uint32",id:3}}},TxOutputType:{fields:{address:{type:"string",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:3},script_type:{type:"OutputScriptType",id:4,options:{default:"PAYTOADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:5},op_return_data:{type:"bytes",id:6},orig_hash:{type:"bytes",id:10},orig_index:{type:"uint32",id:11}}}}}}},TxInput:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{type:"bytes",id:4},sequence:{type:"uint32",id:5,options:{default:4294967295}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:7},amount:{rule:"required",type:"uint64",id:8},decred_tree:{type:"uint32",id:9},witness:{type:"bytes",id:13},ownership_proof:{type:"bytes",id:14},commitment_data:{type:"bytes",id:15},orig_hash:{type:"bytes",id:16},orig_index:{type:"uint32",id:17},decred_staking_spend:{type:"DecredStakingSpendType",id:18},script_pubkey:{type:"bytes",id:19}}},TxOutput:{fields:{address:{type:"string",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:3},script_type:{type:"OutputScriptType",id:4,options:{default:"PAYTOADDRESS"}},multisig:{type:"MultisigRedeemScriptType",id:5},op_return_data:{type:"bytes",id:6},orig_hash:{type:"bytes",id:10},orig_index:{type:"uint32",id:11}}},PrevTx:{fields:{version:{rule:"required",type:"uint32",id:1},lock_time:{rule:"required",type:"uint32",id:4},inputs_count:{rule:"required",type:"uint32",id:6},outputs_count:{rule:"required",type:"uint32",id:7},extra_data_len:{type:"uint32",id:9,options:{default:0}},expiry:{type:"uint32",id:10},version_group_id:{type:"uint32",id:12},timestamp:{type:"uint32",id:13},branch_id:{type:"uint32",id:14}}},PrevInput:{fields:{prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3},script_sig:{rule:"required",type:"bytes",id:4},sequence:{rule:"required",type:"uint32",id:5},decred_tree:{type:"uint32",id:9}}},PrevOutput:{fields:{amount:{rule:"required",type:"uint64",id:1},script_pubkey:{rule:"required",type:"bytes",id:2},decred_script_version:{type:"uint32",id:3}}},TxAckInput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckInputWrapper",id:1}},nested:{TxAckInputWrapper:{fields:{input:{rule:"required",type:"TxInput",id:2}}}}},TxAckOutput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckOutputWrapper",id:1}},nested:{TxAckOutputWrapper:{fields:{output:{rule:"required",type:"TxOutput",id:5}}}}},TxAckPrevMeta:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"PrevTx",id:1}}},TxAckPrevInput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevInputWrapper",id:1}},nested:{TxAckPrevInputWrapper:{fields:{input:{rule:"required",type:"PrevInput",id:2}}}}},TxAckPrevOutput:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevOutputWrapper",id:1}},nested:{TxAckPrevOutputWrapper:{fields:{output:{rule:"required",type:"PrevOutput",id:3}}}}},TxAckPrevExtraData:{options:{"(wire_type)":22},fields:{tx:{rule:"required",type:"TxAckPrevExtraDataWrapper",id:1}},nested:{TxAckPrevExtraDataWrapper:{fields:{extra_data_chunk:{rule:"required",type:"bytes",id:8}}}}},GetOwnershipProof:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},coin_name:{type:"string",id:2,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:3,options:{default:"SPENDWITNESS"}},multisig:{type:"MultisigRedeemScriptType",id:4},user_confirmation:{type:"bool",id:5,options:{default:!1}},ownership_ids:{rule:"repeated",type:"bytes",id:6},commitment_data:{type:"bytes",id:7,options:{default:""}}}},OwnershipProof:{fields:{ownership_proof:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},AuthorizeCoinJoin:{options:{"(unstable)":!0},fields:{coordinator:{rule:"required",type:"string",id:1},max_total_fee:{rule:"required",type:"uint64",id:2},fee_per_anonymity:{type:"uint32",id:3,options:{default:0}},address_n:{rule:"repeated",type:"uint32",id:4,options:{packed:!1}},coin_name:{type:"string",id:5,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:6,options:{default:"SPENDADDRESS"}},amount_unit:{type:"AmountUnit",id:11,options:{default:"BITCOIN"}}}},GetPublicKeyMultiple:{fields:{addresses:{rule:"repeated",type:"BIP32Address",id:1},ecdsa_curve_name:{type:"string",id:2},show_display:{type:"bool",id:3},coin_name:{type:"string",id:4,options:{default:"Bitcoin"}},script_type:{type:"InputScriptType",id:5,options:{default:"SPENDADDRESS"}},ignore_xpub_magic:{type:"bool",id:6}},nested:{BIP32Address:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}}}},PublicKeyMultiple:{fields:{xpubs:{rule:"repeated",type:"string",id:1}}},FirmwareErase:{fields:{length:{type:"uint32",id:1}}},FirmwareRequest:{fields:{offset:{type:"uint32",id:1},length:{type:"uint32",id:2}}},FirmwareUpload:{fields:{payload:{rule:"required",type:"bytes",id:1},hash:{type:"bytes",id:2}}},SelfTest:{fields:{payload:{type:"bytes",id:1}}},FirmwareErase_ex:{fields:{length:{type:"uint32",id:1}}},CardanoDerivationType:{values:{LEDGER:0,ICARUS:1,ICARUS_TREZOR:2}},CardanoAddressType:{values:{BASE:0,BASE_SCRIPT_KEY:1,BASE_KEY_SCRIPT:2,BASE_SCRIPT_SCRIPT:3,POINTER:4,POINTER_SCRIPT:5,ENTERPRISE:6,ENTERPRISE_SCRIPT:7,BYRON:8,REWARD:14,REWARD_SCRIPT:15}},CardanoNativeScriptType:{values:{PUB_KEY:0,ALL:1,ANY:2,N_OF_K:3,INVALID_BEFORE:4,INVALID_HEREAFTER:5}},CardanoNativeScriptHashDisplayFormat:{values:{HIDE:0,BECH32:1,POLICY_ID:2}},CardanoCertificateType:{values:{STAKE_REGISTRATION:0,STAKE_DEREGISTRATION:1,STAKE_DELEGATION:2,STAKE_POOL_REGISTRATION:3}},CardanoPoolRelayType:{values:{SINGLE_HOST_IP:0,SINGLE_HOST_NAME:1,MULTIPLE_HOST_NAME:2}},CardanoTxAuxiliaryDataSupplementType:{values:{NONE:0,CATALYST_REGISTRATION_SIGNATURE:1}},CardanoTxSigningMode:{values:{ORDINARY_TRANSACTION:0,POOL_REGISTRATION_AS_OWNER:1,MULTISIG_TRANSACTION:2}},CardanoTxWitnessType:{values:{BYRON_WITNESS:0,SHELLEY_WITNESS:1}},CardanoBlockchainPointerType:{fields:{block_index:{rule:"required",type:"uint32",id:1},tx_index:{rule:"required",type:"uint32",id:2},certificate_index:{rule:"required",type:"uint32",id:3}}},CardanoNativeScript:{fields:{type:{rule:"required",type:"CardanoNativeScriptType",id:1},scripts:{rule:"repeated",type:"CardanoNativeScript",id:2},key_hash:{type:"bytes",id:3},key_path:{rule:"repeated",type:"uint32",id:4,options:{packed:!1}},required_signatures_count:{type:"uint32",id:5},invalid_before:{type:"uint64",id:6},invalid_hereafter:{type:"uint64",id:7}}},CardanoGetNativeScriptHash:{fields:{script:{rule:"required",type:"CardanoNativeScript",id:1},display_format:{rule:"required",type:"CardanoNativeScriptHashDisplayFormat",id:2},derivation_type:{rule:"required",type:"CardanoDerivationType",id:3}}},CardanoNativeScriptHash:{fields:{script_hash:{rule:"required",type:"bytes",id:1}}},CardanoAddressParametersType:{fields:{address_type:{rule:"required",type:"CardanoAddressType",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},address_n_staking:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},staking_key_hash:{type:"bytes",id:4},certificate_pointer:{type:"CardanoBlockchainPointerType",id:5},script_payment_hash:{type:"bytes",id:6},script_staking_hash:{type:"bytes",id:7}}},CardanoGetAddress:{fields:{show_display:{type:"bool",id:2,options:{default:!1}},protocol_magic:{rule:"required",type:"uint32",id:3},network_id:{rule:"required",type:"uint32",id:4},address_parameters:{rule:"required",type:"CardanoAddressParametersType",id:5},derivation_type:{rule:"required",type:"CardanoDerivationType",id:6}}},CardanoAddress:{fields:{address:{rule:"required",type:"string",id:1}}},CardanoGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},derivation_type:{rule:"required",type:"CardanoDerivationType",id:3}}},CardanoPublicKey:{fields:{xpub:{rule:"required",type:"string",id:1},node:{rule:"required",type:"HDNodeType",id:2}}},CardanoSignTxInit:{fields:{signing_mode:{rule:"required",type:"CardanoTxSigningMode",id:1},protocol_magic:{rule:"required",type:"uint32",id:2},network_id:{rule:"required",type:"uint32",id:3},inputs_count:{rule:"required",type:"uint32",id:4},outputs_count:{rule:"required",type:"uint32",id:5},fee:{rule:"required",type:"uint64",id:6},ttl:{type:"uint64",id:7},certificates_count:{rule:"required",type:"uint32",id:8},withdrawals_count:{rule:"required",type:"uint32",id:9},has_auxiliary_data:{rule:"required",type:"bool",id:10},validity_interval_start:{type:"uint64",id:11},witness_requests_count:{rule:"required",type:"uint32",id:12},minting_asset_groups_count:{rule:"required",type:"uint32",id:13},derivation_type:{rule:"required",type:"CardanoDerivationType",id:14}}},CardanoTxInput:{fields:{prev_hash:{rule:"required",type:"bytes",id:1},prev_index:{rule:"required",type:"uint32",id:2}}},CardanoTxOutput:{fields:{address:{type:"string",id:1},address_parameters:{type:"CardanoAddressParametersType",id:2},amount:{rule:"required",type:"uint64",id:3},asset_groups_count:{rule:"required",type:"uint32",id:4}}},CardanoAssetGroup:{fields:{policy_id:{rule:"required",type:"bytes",id:1},tokens_count:{rule:"required",type:"uint32",id:2}}},CardanoToken:{fields:{asset_name_bytes:{rule:"required",type:"bytes",id:1},amount:{type:"uint64",id:2},mint_amount:{type:"sint64",id:3}}},CardanoPoolOwner:{fields:{staking_key_path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},staking_key_hash:{type:"bytes",id:2}}},CardanoPoolRelayParameters:{fields:{type:{rule:"required",type:"CardanoPoolRelayType",id:1},ipv4_address:{type:"bytes",id:2},ipv6_address:{type:"bytes",id:3},host_name:{type:"string",id:4},port:{type:"uint32",id:5}}},CardanoPoolMetadataType:{fields:{url:{rule:"required",type:"string",id:1},hash:{rule:"required",type:"bytes",id:2}}},CardanoPoolParametersType:{fields:{pool_id:{rule:"required",type:"bytes",id:1},vrf_key_hash:{rule:"required",type:"bytes",id:2},pledge:{rule:"required",type:"uint64",id:3},cost:{rule:"required",type:"uint64",id:4},margin_numerator:{rule:"required",type:"uint64",id:5},margin_denominator:{rule:"required",type:"uint64",id:6},reward_account:{rule:"required",type:"string",id:7},owners:{rule:"repeated",type:"CardanoPoolOwner",id:8,options:{deprecated:!0}},relays:{rule:"repeated",type:"CardanoPoolRelayParameters",id:9,options:{deprecated:!0}},metadata:{type:"CardanoPoolMetadataType",id:10},owners_count:{rule:"required",type:"uint32",id:11},relays_count:{rule:"required",type:"uint32",id:12}}},CardanoTxCertificate:{fields:{type:{rule:"required",type:"CardanoCertificateType",id:1},path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},pool:{type:"bytes",id:3},pool_parameters:{type:"CardanoPoolParametersType",id:4},script_hash:{type:"bytes",id:5}}},CardanoTxWithdrawal:{fields:{path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:2},script_hash:{type:"bytes",id:3}}},CardanoCatalystRegistrationParametersType:{fields:{voting_public_key:{rule:"required",type:"bytes",id:1},staking_path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},reward_address_parameters:{rule:"required",type:"CardanoAddressParametersType",id:3},nonce:{rule:"required",type:"uint64",id:4}}},CardanoTxAuxiliaryData:{fields:{catalyst_registration_parameters:{type:"CardanoCatalystRegistrationParametersType",id:1},hash:{type:"bytes",id:2}}},CardanoTxMint:{fields:{asset_groups_count:{rule:"required",type:"uint32",id:1}}},CardanoTxItemAck:{fields:{}},CardanoTxAuxiliaryDataSupplement:{fields:{type:{rule:"required",type:"CardanoTxAuxiliaryDataSupplementType",id:1},auxiliary_data_hash:{type:"bytes",id:2},catalyst_signature:{type:"bytes",id:3}}},CardanoTxWitnessRequest:{fields:{path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},CardanoTxWitnessResponse:{fields:{type:{rule:"required",type:"CardanoTxWitnessType",id:1},pub_key:{rule:"required",type:"bytes",id:2},signature:{rule:"required",type:"bytes",id:3},chain_code:{type:"bytes",id:4}}},CardanoTxHostAck:{fields:{}},CardanoTxBodyHash:{fields:{tx_hash:{rule:"required",type:"bytes",id:1}}},CardanoSignTxFinished:{fields:{}},CardanoSignTx:{options:{deprecated:!0},fields:{inputs:{rule:"repeated",type:"CardanoTxInputType",id:1},outputs:{rule:"repeated",type:"CardanoTxOutputType",id:2},protocol_magic:{rule:"required",type:"uint32",id:5},fee:{rule:"required",type:"uint64",id:6},ttl:{type:"uint64",id:7},network_id:{rule:"required",type:"uint32",id:8},certificates:{rule:"repeated",type:"CardanoTxCertificateType",id:9},withdrawals:{rule:"repeated",type:"CardanoTxWithdrawalType",id:10},validity_interval_start:{type:"uint64",id:12},auxiliary_data:{type:"CardanoTxAuxiliaryDataType",id:13}},nested:{CardanoTxInputType:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},prev_hash:{rule:"required",type:"bytes",id:2},prev_index:{rule:"required",type:"uint32",id:3}}},CardanoTxOutputType:{fields:{address:{type:"string",id:1},amount:{rule:"required",type:"uint64",id:3},address_parameters:{type:"CardanoAddressParametersType",id:4},token_bundle:{rule:"repeated",type:"CardanoAssetGroupType",id:5}}},CardanoAssetGroupType:{fields:{policy_id:{rule:"required",type:"bytes",id:1},tokens:{rule:"repeated",type:"CardanoTokenType",id:2}}},CardanoTokenType:{fields:{asset_name_bytes:{rule:"required",type:"bytes",id:1},amount:{rule:"required",type:"uint64",id:2}}},CardanoPoolOwnerType:{fields:{staking_key_path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},staking_key_hash:{type:"bytes",id:2}}},CardanoPoolRelayParametersType:{fields:{type:{rule:"required",type:"CardanoPoolRelayType",id:1},ipv4_address:{type:"bytes",id:2},ipv6_address:{type:"bytes",id:3},host_name:{type:"string",id:4},port:{type:"uint32",id:5}}},CardanoTxCertificateType:{fields:{type:{rule:"required",type:"CardanoCertificateType",id:1},path:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},pool:{type:"bytes",id:3},pool_parameters:{type:"CardanoPoolParametersType",id:4}}},CardanoTxWithdrawalType:{fields:{path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},amount:{rule:"required",type:"uint64",id:2}}},CardanoTxAuxiliaryDataType:{fields:{blob:{type:"bytes",id:1},catalyst_registration_parameters:{type:"CardanoCatalystRegistrationParametersType",id:2}}}}},CardanoSignedTxChunk:{options:{deprecated:!0},fields:{signed_tx_chunk:{rule:"required",type:"bytes",id:1}}},CardanoSignedTxChunkAck:{options:{deprecated:!0},fields:{}},CardanoSignedTx:{options:{deprecated:!0},fields:{tx_hash:{rule:"required",type:"bytes",id:1},serialized_tx:{type:"bytes",id:2}}},Success:{fields:{message:{type:"string",id:1,options:{default:""}}}},Failure:{fields:{code:{type:"FailureType",id:1},message:{type:"string",id:2}},nested:{FailureType:{values:{Failure_UnexpectedMessage:1,Failure_ButtonExpected:2,Failure_DataError:3,Failure_ActionCancelled:4,Failure_PinExpected:5,Failure_PinCancelled:6,Failure_PinInvalid:7,Failure_InvalidSignature:8,Failure_ProcessError:9,Failure_NotEnoughFunds:10,Failure_NotInitialized:11,Failure_PinMismatch:12,Failure_WipeCodeMismatch:13,Failure_InvalidSession:14,Failure_FirmwareError:99}}}},ButtonRequest:{fields:{code:{type:"ButtonRequestType",id:1},pages:{type:"uint32",id:2}},nested:{ButtonRequestType:{values:{ButtonRequest_Other:1,ButtonRequest_FeeOverThreshold:2,ButtonRequest_ConfirmOutput:3,ButtonRequest_ResetDevice:4,ButtonRequest_ConfirmWord:5,ButtonRequest_WipeDevice:6,ButtonRequest_ProtectCall:7,ButtonRequest_SignTx:8,ButtonRequest_FirmwareCheck:9,ButtonRequest_Address:10,ButtonRequest_PublicKey:11,ButtonRequest_MnemonicWordCount:12,ButtonRequest_MnemonicInput:13,_Deprecated_ButtonRequest_PassphraseType:14,ButtonRequest_UnknownDerivationPath:15,ButtonRequest_RecoveryHomepage:16,ButtonRequest_Success:17,ButtonRequest_Warning:18,ButtonRequest_PassphraseEntry:19,ButtonRequest_PinEntry:20}}}},ButtonAck:{fields:{}},PinMatrixRequest:{fields:{type:{type:"PinMatrixRequestType",id:1}},nested:{PinMatrixRequestType:{values:{PinMatrixRequestType_Current:1,PinMatrixRequestType_NewFirst:2,PinMatrixRequestType_NewSecond:3,PinMatrixRequestType_WipeCodeFirst:4,PinMatrixRequestType_WipeCodeSecond:5,PinMatrixRequestType_BackupFirst:6,PinMatrixRequestType_BackupSecond:7}}}},PinMatrixAck:{fields:{pin:{rule:"required",type:"string",id:1},new_pin:{type:"string",id:2}}},PassphraseRequest:{fields:{_on_device:{type:"bool",id:1,options:{deprecated:!0}}}},PassphraseAck:{fields:{passphrase:{type:"string",id:1},_state:{type:"bytes",id:2,options:{deprecated:!0}},on_device:{type:"bool",id:3}}},Deprecated_PassphraseStateRequest:{options:{deprecated:!0},fields:{state:{type:"bytes",id:1}}},Deprecated_PassphraseStateAck:{options:{deprecated:!0},fields:{}},HDNodeType:{fields:{depth:{rule:"required",type:"uint32",id:1},fingerprint:{rule:"required",type:"uint32",id:2},child_num:{rule:"required",type:"uint32",id:3},chain_code:{rule:"required",type:"bytes",id:4},private_key:{type:"bytes",id:5},public_key:{rule:"required",type:"bytes",id:6}}},BixinPinInputOnDevice:{fields:{}},ConfluxGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},chain_id:{type:"uint32",id:3}}},ConfluxAddress:{fields:{address:{type:"string",id:1}}},ConfluxSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{type:"bytes",id:2},gas_price:{type:"bytes",id:3},gas_limit:{type:"bytes",id:4},to:{type:"string",id:5},value:{type:"bytes",id:6},epoch_height:{type:"bytes",id:7},storage_limit:{type:"bytes",id:8},data_initial_chunk:{type:"bytes",id:9},data_length:{type:"uint32",id:10},chain_id:{type:"uint32",id:11}}},ConfluxTxRequest:{fields:{data_length:{type:"uint32",id:1},signature_v:{type:"uint32",id:2},signature_r:{type:"bytes",id:3},signature_s:{type:"bytes",id:4}}},ConfluxTxAck:{fields:{data_chunk:{type:"bytes",id:1}}},ConfluxSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{type:"bytes",id:2}}},ConfluxMessageSignature:{fields:{signature:{type:"bytes",id:2},address:{type:"string",id:3}}},ConfluxSignMessageCIP23:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_hash:{type:"bytes",id:2},message_hash:{type:"bytes",id:3}}},CosmosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},hrp:{type:"string",id:2},show_display:{type:"bool",id:3}}},CosmosAddress:{fields:{address:{type:"string",id:1}}},CosmosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},CosmosSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},CipherKeyValue:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},key:{rule:"required",type:"string",id:2},value:{rule:"required",type:"bytes",id:3},encrypt:{type:"bool",id:4},ask_on_encrypt:{type:"bool",id:5},ask_on_decrypt:{type:"bool",id:6},iv:{type:"bytes",id:7}}},CipheredKeyValue:{fields:{value:{rule:"required",type:"bytes",id:1}}},IdentityType:{fields:{proto:{type:"string",id:1},user:{type:"string",id:2},host:{type:"string",id:3},port:{type:"string",id:4},path:{type:"string",id:5},index:{type:"uint32",id:6,options:{default:0}}}},SignIdentity:{fields:{identity:{rule:"required",type:"IdentityType",id:1},challenge_hidden:{type:"bytes",id:2,options:{default:""}},challenge_visual:{type:"string",id:3,options:{default:""}},ecdsa_curve_name:{type:"string",id:4}}},SignedIdentity:{fields:{address:{type:"string",id:1},public_key:{rule:"required",type:"bytes",id:2},signature:{rule:"required",type:"bytes",id:3}}},GetECDHSessionKey:{fields:{identity:{rule:"required",type:"IdentityType",id:1},peer_public_key:{rule:"required",type:"bytes",id:2},ecdsa_curve_name:{type:"string",id:3}}},ECDHSessionKey:{fields:{session_key:{rule:"required",type:"bytes",id:1},public_key:{type:"bytes",id:2}}},CosiCommit:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},data:{type:"bytes",id:2}}},CosiCommitment:{fields:{commitment:{type:"bytes",id:1},pubkey:{type:"bytes",id:2}}},CosiSign:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},data:{type:"bytes",id:2},global_commitment:{type:"bytes",id:3},global_pubkey:{type:"bytes",id:4}}},CosiSignature:{fields:{signature:{rule:"required",type:"bytes",id:1}}},BatchGetPublickeys:{fields:{ecdsa_curve_name:{type:"string",id:1,options:{default:"ed25519"}},paths:{rule:"repeated",type:"Path",id:2}},nested:{Path:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}}}},EcdsaPublicKeys:{fields:{public_keys:{rule:"repeated",type:"bytes",id:1}}},DebugLinkDecision:{fields:{yes_no:{type:"bool",id:1},swipe:{type:"DebugSwipeDirection",id:2},input:{type:"string",id:3},x:{type:"uint32",id:4},y:{type:"uint32",id:5},wait:{type:"bool",id:6},hold_ms:{type:"uint32",id:7}},nested:{DebugSwipeDirection:{values:{UP:0,DOWN:1,LEFT:2,RIGHT:3}}}},DebugLinkLayout:{fields:{lines:{rule:"repeated",type:"string",id:1}}},DebugLinkReseedRandom:{fields:{value:{type:"uint32",id:1}}},DebugLinkRecordScreen:{fields:{target_directory:{type:"string",id:1}}},DebugLinkGetState:{fields:{wait_word_list:{type:"bool",id:1},wait_word_pos:{type:"bool",id:2},wait_layout:{type:"bool",id:3}}},DebugLinkState:{fields:{layout:{type:"bytes",id:1},pin:{type:"string",id:2},matrix:{type:"string",id:3},mnemonic_secret:{type:"bytes",id:4},node:{type:"HDNodeType",id:5},passphrase_protection:{type:"bool",id:6},reset_word:{type:"string",id:7},reset_entropy:{type:"bytes",id:8},recovery_fake_word:{type:"string",id:9},recovery_word_pos:{type:"uint32",id:10},reset_word_pos:{type:"uint32",id:11},mnemonic_type:{type:"BackupType",id:12},layout_lines:{rule:"repeated",type:"string",id:13}}},DebugLinkStop:{fields:{}},DebugLinkLog:{fields:{level:{type:"uint32",id:1},bucket:{type:"string",id:2},text:{type:"string",id:3}}},DebugLinkMemoryRead:{fields:{address:{type:"uint32",id:1},length:{type:"uint32",id:2}}},DebugLinkMemory:{fields:{memory:{type:"bytes",id:1}}},DebugLinkMemoryWrite:{fields:{address:{type:"uint32",id:1},memory:{type:"bytes",id:2},flash:{type:"bool",id:3}}},DebugLinkFlashErase:{fields:{sector:{type:"uint32",id:1}}},DebugLinkEraseSdCard:{fields:{format:{type:"bool",id:1}}},DebugLinkWatchLayout:{fields:{watch:{type:"bool",id:1}}},EosGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},EosPublicKey:{fields:{wif_public_key:{rule:"required",type:"string",id:1},raw_public_key:{rule:"required",type:"bytes",id:2}}},EosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},chain_id:{type:"bytes",id:2},header:{type:"EosTxHeader",id:3},num_actions:{type:"uint32",id:4}},nested:{EosTxHeader:{fields:{expiration:{rule:"required",type:"uint32",id:1},ref_block_num:{rule:"required",type:"uint32",id:2},ref_block_prefix:{rule:"required",type:"uint32",id:3},max_net_usage_words:{rule:"required",type:"uint32",id:4},max_cpu_usage_ms:{rule:"required",type:"uint32",id:5},delay_sec:{rule:"required",type:"uint32",id:6}}}}},EosTxActionRequest:{fields:{data_size:{type:"uint32",id:1}}},EosTxActionAck:{fields:{common:{type:"EosActionCommon",id:1},transfer:{type:"EosActionTransfer",id:2},delegate:{type:"EosActionDelegate",id:3},undelegate:{type:"EosActionUndelegate",id:4},refund:{type:"EosActionRefund",id:5},buy_ram:{type:"EosActionBuyRam",id:6},buy_ram_bytes:{type:"EosActionBuyRamBytes",id:7},sell_ram:{type:"EosActionSellRam",id:8},vote_producer:{type:"EosActionVoteProducer",id:9},update_auth:{type:"EosActionUpdateAuth",id:10},delete_auth:{type:"EosActionDeleteAuth",id:11},link_auth:{type:"EosActionLinkAuth",id:12},unlink_auth:{type:"EosActionUnlinkAuth",id:13},new_account:{type:"EosActionNewAccount",id:14},unknown:{type:"EosActionUnknown",id:15}},nested:{EosAsset:{fields:{amount:{type:"sint64",id:1},symbol:{type:"uint64",id:2}}},EosPermissionLevel:{fields:{actor:{type:"uint64",id:1},permission:{type:"uint64",id:2}}},EosAuthorizationKey:{fields:{type:{rule:"required",type:"uint32",id:1},key:{type:"bytes",id:2},address_n:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},weight:{rule:"required",type:"uint32",id:4}}},EosAuthorizationAccount:{fields:{account:{type:"EosPermissionLevel",id:1},weight:{type:"uint32",id:2}}},EosAuthorizationWait:{fields:{wait_sec:{type:"uint32",id:1},weight:{type:"uint32",id:2}}},EosAuthorization:{fields:{threshold:{type:"uint32",id:1},keys:{rule:"repeated",type:"EosAuthorizationKey",id:2},accounts:{rule:"repeated",type:"EosAuthorizationAccount",id:3},waits:{rule:"repeated",type:"EosAuthorizationWait",id:4}}},EosActionCommon:{fields:{account:{type:"uint64",id:1},name:{type:"uint64",id:2},authorization:{rule:"repeated",type:"EosPermissionLevel",id:3}}},EosActionTransfer:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},quantity:{type:"EosAsset",id:3},memo:{type:"string",id:4}}},EosActionDelegate:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},net_quantity:{type:"EosAsset",id:3},cpu_quantity:{type:"EosAsset",id:4},transfer:{type:"bool",id:5}}},EosActionUndelegate:{fields:{sender:{type:"uint64",id:1},receiver:{type:"uint64",id:2},net_quantity:{type:"EosAsset",id:3},cpu_quantity:{type:"EosAsset",id:4}}},EosActionRefund:{fields:{owner:{type:"uint64",id:1}}},EosActionBuyRam:{fields:{payer:{type:"uint64",id:1},receiver:{type:"uint64",id:2},quantity:{type:"EosAsset",id:3}}},EosActionBuyRamBytes:{fields:{payer:{type:"uint64",id:1},receiver:{type:"uint64",id:2},bytes:{type:"uint32",id:3}}},EosActionSellRam:{fields:{account:{type:"uint64",id:1},bytes:{type:"uint64",id:2}}},EosActionVoteProducer:{fields:{voter:{type:"uint64",id:1},proxy:{type:"uint64",id:2},producers:{rule:"repeated",type:"uint64",id:3,options:{packed:!1}}}},EosActionUpdateAuth:{fields:{account:{type:"uint64",id:1},permission:{type:"uint64",id:2},parent:{type:"uint64",id:3},auth:{type:"EosAuthorization",id:4}}},EosActionDeleteAuth:{fields:{account:{type:"uint64",id:1},permission:{type:"uint64",id:2}}},EosActionLinkAuth:{fields:{account:{type:"uint64",id:1},code:{type:"uint64",id:2},type:{type:"uint64",id:3},requirement:{type:"uint64",id:4}}},EosActionUnlinkAuth:{fields:{account:{type:"uint64",id:1},code:{type:"uint64",id:2},type:{type:"uint64",id:3}}},EosActionNewAccount:{fields:{creator:{type:"uint64",id:1},name:{type:"uint64",id:2},owner:{type:"EosAuthorization",id:3},active:{type:"EosAuthorization",id:4}}},EosActionUnknown:{fields:{data_size:{rule:"required",type:"uint32",id:1},data_chunk:{type:"bytes",id:2}}}}},EosSignedTx:{fields:{signature:{rule:"required",type:"string",id:1}}},EthereumSignTypedData:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},primary_type:{rule:"required",type:"string",id:2},metamask_v4_compat:{type:"bool",id:3,options:{default:!0}}}},EthereumTypedDataStructRequest:{fields:{name:{rule:"required",type:"string",id:1}}},EthereumTypedDataStructAck:{fields:{members:{rule:"repeated",type:"EthereumStructMember",id:1}},nested:{EthereumStructMember:{fields:{type:{rule:"required",type:"EthereumFieldType",id:1},name:{rule:"required",type:"string",id:2}}},EthereumFieldType:{fields:{data_type:{rule:"required",type:"EthereumDataType",id:1},size:{type:"uint32",id:2},entry_type:{type:"EthereumFieldType",id:3},struct_name:{type:"string",id:4}}},EthereumDataType:{values:{UINT:1,INT:2,BYTES:3,STRING:4,BOOL:5,ADDRESS:6,ARRAY:7,STRUCT:8}}}},EthereumTypedDataValueRequest:{fields:{member_path:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},EthereumTypedDataValueAck:{fields:{value:{rule:"required",type:"bytes",id:1}}},EthereumGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},EthereumPublicKey:{fields:{node:{rule:"required",type:"HDNodeType",id:1},xpub:{rule:"required",type:"string",id:2}}},EthereumGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},EthereumAddress:{fields:{_old_address:{type:"bytes",id:1,options:{deprecated:!0}},address:{type:"string",id:2}}},EthereumSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{type:"bytes",id:2,options:{default:""}},gas_price:{rule:"required",type:"bytes",id:3},gas_limit:{rule:"required",type:"bytes",id:4},to:{type:"string",id:11,options:{default:""}},value:{type:"bytes",id:6,options:{default:""}},data_initial_chunk:{type:"bytes",id:7,options:{default:""}},data_length:{type:"uint32",id:8,options:{default:0}},chain_id:{rule:"required",type:"uint64",id:9},tx_type:{type:"uint32",id:10}}},EthereumSignTxEIP1559:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},nonce:{rule:"required",type:"bytes",id:2},max_gas_fee:{rule:"required",type:"bytes",id:3},max_priority_fee:{rule:"required",type:"bytes",id:4},gas_limit:{rule:"required",type:"bytes",id:5},to:{type:"string",id:6,options:{default:""}},value:{rule:"required",type:"bytes",id:7},data_initial_chunk:{type:"bytes",id:8,options:{default:""}},data_length:{rule:"required",type:"uint32",id:9},chain_id:{rule:"required",type:"uint64",id:10},access_list:{rule:"repeated",type:"EthereumAccessList",id:11}},nested:{EthereumAccessList:{fields:{address:{rule:"required",type:"string",id:1},storage_keys:{rule:"repeated",type:"bytes",id:2}}}}},EthereumTxRequest:{fields:{data_length:{type:"uint32",id:1},signature_v:{type:"uint32",id:2},signature_r:{type:"bytes",id:3},signature_s:{type:"bytes",id:4}}},EthereumTxAck:{fields:{data_chunk:{rule:"required",type:"bytes",id:1}}},EthereumSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2}}},EthereumMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:2},address:{rule:"required",type:"string",id:3}}},EthereumVerifyMessage:{fields:{signature:{rule:"required",type:"bytes",id:2},message:{rule:"required",type:"bytes",id:3},address:{rule:"required",type:"string",id:4}}},EthereumSignMessageEIP712:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_hash:{type:"bytes",id:2},message_hash:{type:"bytes",id:3}}},EthereumSignTypedHash:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},domain_separator_hash:{rule:"required",type:"bytes",id:2},message_hash:{type:"bytes",id:3}}},EthereumTypedDataSignature:{fields:{signature:{rule:"required",type:"bytes",id:1},address:{rule:"required",type:"string",id:2}}},BackupType:{values:{Bip39:0,Slip39_Basic:1,Slip39_Advanced:2}},SafetyCheckLevel:{values:{Strict:0,PromptAlways:1,PromptTemporarily:2}},Initialize:{fields:{session_id:{type:"bytes",id:1},_skip_passphrase:{type:"bool",id:2,options:{deprecated:!0}},derive_cardano:{type:"bool",id:3}}},GetFeatures:{fields:{}},Features:{fields:{vendor:{type:"string",id:1},major_version:{rule:"required",type:"uint32",id:2},minor_version:{rule:"required",type:"uint32",id:3},patch_version:{rule:"required",type:"uint32",id:4},bootloader_mode:{type:"bool",id:5},device_id:{type:"string",id:6},pin_protection:{type:"bool",id:7},passphrase_protection:{type:"bool",id:8},language:{type:"string",id:9},label:{type:"string",id:10},initialized:{type:"bool",id:12},revision:{type:"bytes",id:13},bootloader_hash:{type:"bytes",id:14},imported:{type:"bool",id:15},unlocked:{type:"bool",id:16},_passphrase_cached:{type:"bool",id:17,options:{deprecated:!0}},firmware_present:{type:"bool",id:18},needs_backup:{type:"bool",id:19},flags:{type:"uint32",id:20},model:{type:"string",id:21},fw_major:{type:"uint32",id:22},fw_minor:{type:"uint32",id:23},fw_patch:{type:"uint32",id:24},fw_vendor:{type:"string",id:25},fw_vendor_keys:{type:"bytes",id:26},unfinished_backup:{type:"bool",id:27},no_backup:{type:"bool",id:28},recovery_mode:{type:"bool",id:29},capabilities:{rule:"repeated",type:"Capability",id:30,options:{packed:!1}},backup_type:{type:"BackupType",id:31},sd_card_present:{type:"bool",id:32},sd_protection:{type:"bool",id:33},wipe_code_protection:{type:"bool",id:34},session_id:{type:"bytes",id:35},passphrase_always_on_device:{type:"bool",id:36},safety_checks:{type:"SafetyCheckLevel",id:37},auto_lock_delay_ms:{type:"uint32",id:38},display_rotation:{type:"uint32",id:39},experimental_features:{type:"bool",id:40},offset:{type:"uint32",id:500},ble_name:{type:"string",id:501},ble_ver:{type:"string",id:502},ble_enable:{type:"bool",id:503},se_enable:{type:"bool",id:504},se_ver:{type:"string",id:506},backup_only:{type:"bool",id:507},onekey_version:{type:"string",id:508},onekey_serial:{type:"string",id:509},bootloader_version:{type:"string",id:510},serial_no:{type:"string",id:511},spi_flash:{type:"string",id:512},initstates:{type:"uint32",id:513},NFT_voucher:{type:"bytes",id:514},cpu_info:{type:"string",id:515},pre_firmware:{type:"string",id:516},coin_switch:{type:"uint32",id:517},build_id:{type:"string",id:518}},nested:{Capability:{options:{"(has_bitcoin_only_values)":!0},values:{Capability_Bitcoin:1,Capability_Bitcoin_like:2,Capability_Binance:3,Capability_Cardano:4,Capability_Crypto:5,Capability_EOS:6,Capability_Ethereum:7,Capability_Lisk:8,Capability_Monero:9,Capability_NEM:10,Capability_Ripple:11,Capability_Stellar:12,Capability_Tezos:13,Capability_U2F:14,Capability_Shamir:15,Capability_ShamirGroups:16,Capability_PassphraseEntry:17}}}},LockDevice:{fields:{}},EndSession:{fields:{}},ApplySettings:{fields:{language:{type:"string",id:1},label:{type:"string",id:2},use_passphrase:{type:"bool",id:3},homescreen:{type:"bytes",id:4},_passphrase_source:{type:"uint32",id:5,options:{deprecated:!0}},auto_lock_delay_ms:{type:"uint32",id:6},display_rotation:{type:"uint32",id:7},passphrase_always_on_device:{type:"bool",id:8},safety_checks:{type:"SafetyCheckLevel",id:9},experimental_features:{type:"bool",id:10},use_ble:{type:"bool",id:100},use_se:{type:"bool",id:101},is_bixinapp:{type:"bool",id:102},fastpay_pin:{type:"bool",id:103},fastpay_confirm:{type:"bool",id:104},fastpay_money_limit:{type:"uint64",id:105},fastpay_times:{type:"uint32",id:106}},nested:{ExportType:{values:{SeedEncExportType_NO:0,SeedEncExportType_YES:1,MnemonicPlainExportType_YES:2}}}},ApplyFlags:{fields:{flags:{rule:"required",type:"uint32",id:1}}},ChangePin:{fields:{remove:{type:"bool",id:1}}},ChangeWipeCode:{fields:{remove:{type:"bool",id:1}}},SdProtect:{fields:{operation:{rule:"required",type:"SdProtectOperationType",id:1}},nested:{SdProtectOperationType:{values:{DISABLE:0,ENABLE:1,REFRESH:2}}}},Ping:{fields:{message:{type:"string",id:1,options:{default:""}},button_protection:{type:"bool",id:2}}},Cancel:{fields:{}},GetEntropy:{fields:{size:{rule:"required",type:"uint32",id:1}}},Entropy:{fields:{entropy:{rule:"required",type:"bytes",id:1}}},WipeDevice:{fields:{}},LoadDevice:{fields:{mnemonics:{rule:"repeated",type:"string",id:1},pin:{type:"string",id:3},passphrase_protection:{type:"bool",id:4},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},skip_checksum:{type:"bool",id:7},u2f_counter:{type:"uint32",id:8},needs_backup:{type:"bool",id:9},no_backup:{type:"bool",id:10}}},ResetDevice:{fields:{display_random:{type:"bool",id:1},strength:{type:"uint32",id:2,options:{default:256}},passphrase_protection:{type:"bool",id:3},pin_protection:{type:"bool",id:4},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},u2f_counter:{type:"uint32",id:7},skip_backup:{type:"bool",id:8},no_backup:{type:"bool",id:9},backup_type:{type:"BackupType",id:10,options:{default:"Bip39"}}}},BackupDevice:{fields:{}},EntropyRequest:{fields:{}},EntropyAck:{fields:{entropy:{rule:"required",type:"bytes",id:1}}},RecoveryDevice:{fields:{word_count:{type:"uint32",id:1},passphrase_protection:{type:"bool",id:2},pin_protection:{type:"bool",id:3},language:{type:"string",id:4},label:{type:"string",id:5},enforce_wordlist:{type:"bool",id:6},type:{type:"RecoveryDeviceType",id:8},u2f_counter:{type:"uint32",id:9},dry_run:{type:"bool",id:10}},nested:{RecoveryDeviceType:{values:{RecoveryDeviceType_ScrambledWords:0,RecoveryDeviceType_Matrix:1}}}},WordRequest:{fields:{type:{rule:"required",type:"WordRequestType",id:1}},nested:{WordRequestType:{values:{WordRequestType_Plain:0,WordRequestType_Matrix9:1,WordRequestType_Matrix6:2}}}},WordAck:{fields:{word:{rule:"required",type:"string",id:1}}},SetU2FCounter:{fields:{u2f_counter:{rule:"required",type:"uint32",id:1}}},GetNextU2FCounter:{fields:{}},NextU2FCounter:{fields:{u2f_counter:{rule:"required",type:"uint32",id:1}}},DoPreauthorized:{fields:{}},PreauthorizedRequest:{fields:{}},CancelAuthorization:{fields:{}},BixinSeedOperate:{fields:{type:{rule:"required",type:"SeedRequestType",id:1},seed_importData:{type:"bytes",id:2}},nested:{SeedRequestType:{values:{SeedRequestType_Gen:0,SeedRequestType_EncExport:1,SeedRequestType_EncImport:2}}}},BixinMessageSE:{fields:{inputmessage:{rule:"required",type:"bytes",id:1}}},BixinOutMessageSE:{fields:{outmessage:{type:"bytes",id:1}}},DeviceBackToBoot:{fields:{}},BixinBackupRequest:{fields:{}},BixinBackupAck:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinRestoreRequest:{fields:{data:{rule:"required",type:"bytes",id:1},language:{type:"string",id:2},label:{type:"string",id:3},passphrase_protection:{type:"bool",id:4}}},BixinRestoreAck:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinVerifyDeviceRequest:{fields:{data:{rule:"required",type:"bytes",id:1}}},BixinVerifyDeviceAck:{fields:{cert:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},BixinWhiteListRequest:{fields:{type:{rule:"required",type:"WL_OperationType",id:1},addr_in:{type:"string",id:2}},nested:{WL_OperationType:{values:{WL_OperationType_Add:0,WL_OperationType_Delete:1,WL_OperationType_Inquire:2}}}},BixinWhiteListAck:{fields:{address:{rule:"repeated",type:"string",id:1}}},BixinLoadDevice:{fields:{mnemonics:{rule:"required",type:"string",id:1},language:{type:"string",id:5,options:{default:"en-US"}},label:{type:"string",id:6},skip_checksum:{type:"bool",id:7}}},BixinBackupDevice:{fields:{}},BixinBackupDeviceAck:{fields:{mnemonics:{rule:"required",type:"string",id:1}}},DeviceInfoSettings:{fields:{serial_no:{type:"string",id:1},cpu_info:{type:"string",id:2},pre_firmware:{type:"string",id:3}}},GetDeviceInfo:{fields:{}},DeviceInfo:{fields:{serial_no:{type:"string",id:1},spiFlash_info:{type:"string",id:2},SE_info:{type:"string",id:3},NFT_voucher:{type:"bytes",id:4},cpu_info:{type:"string",id:5},pre_firmware:{type:"string",id:6}}},ReadSEPublicKey:{fields:{}},SEPublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},WriteSEPublicCert:{fields:{public_cert:{rule:"required",type:"bytes",id:1}}},ReadSEPublicCert:{fields:{}},SEPublicCert:{fields:{public_cert:{rule:"required",type:"bytes",id:1}}},SpiFlashWrite:{fields:{address:{rule:"required",type:"uint32",id:1},data:{rule:"required",type:"bytes",id:2}}},SpiFlashRead:{fields:{address:{rule:"required",type:"uint32",id:1},len:{rule:"required",type:"uint32",id:2}}},SpiFlashData:{fields:{data:{rule:"required",type:"bytes",id:1}}},SESignMessage:{fields:{message:{rule:"required",type:"bytes",id:1}}},SEMessageSignature:{fields:{signature:{rule:"required",type:"bytes",id:1}}},ResourceUpload:{fields:{extension:{rule:"required",type:"string",id:1},data_length:{rule:"required",type:"uint32",id:2},res_type:{rule:"required",type:"ResourceType",id:3},zoom_data_length:{rule:"required",type:"uint32",id:5},nft_meta_data:{type:"bytes",id:4}},nested:{ResourceType:{values:{WallPaper:0,Nft:1}}}},ZoomRequest:{fields:{offset:{type:"uint32",id:1},data_length:{rule:"required",type:"uint32",id:2}}},ResourceRequest:{fields:{offset:{type:"uint32",id:1},data_length:{rule:"required",type:"uint32",id:2}}},ResourceAck:{fields:{data_chunk:{rule:"required",type:"bytes",id:1},hash:{type:"bytes",id:2}}},ResourceUpdate:{fields:{file_name:{rule:"required",type:"string",id:1},data_length:{rule:"required",type:"uint32",id:2},initial_data_chunk:{rule:"required",type:"bytes",id:3},hash:{type:"bytes",id:4}}},NFTWriteInfo:{fields:{index:{rule:"required",type:"uint32",id:1},width:{rule:"required",type:"uint32",id:2},height:{rule:"required",type:"uint32",id:3},name_zh:{type:"string",id:4},name_en:{type:"string",id:5}}},NFTWriteData:{fields:{index:{rule:"required",type:"uint32",id:1},data:{rule:"required",type:"bytes",id:2},offset:{rule:"required",type:"uint32",id:3}}},RebootToBootloader:{fields:{}},MoneroTransactionSourceEntry:{fields:{outputs:{rule:"repeated",type:"MoneroOutputEntry",id:1},real_output:{type:"uint64",id:2},real_out_tx_key:{type:"bytes",id:3},real_out_additional_tx_keys:{rule:"repeated",type:"bytes",id:4},real_output_in_tx_index:{type:"uint64",id:5},amount:{type:"uint64",id:6},rct:{type:"bool",id:7},mask:{type:"bytes",id:8},multisig_kLRki:{type:"MoneroMultisigKLRki",id:9},subaddr_minor:{type:"uint32",id:10}},nested:{MoneroOutputEntry:{fields:{idx:{type:"uint64",id:1},key:{type:"MoneroRctKeyPublic",id:2}},nested:{MoneroRctKeyPublic:{fields:{dest:{type:"bytes",id:1},commitment:{type:"bytes",id:2}}}}},MoneroMultisigKLRki:{fields:{K:{type:"bytes",id:1},L:{type:"bytes",id:2},R:{type:"bytes",id:3},ki:{type:"bytes",id:4}}}}},MoneroTransactionDestinationEntry:{fields:{amount:{type:"uint64",id:1},addr:{type:"MoneroAccountPublicAddress",id:2},is_subaddress:{type:"bool",id:3},original:{type:"bytes",id:4},is_integrated:{type:"bool",id:5}},nested:{MoneroAccountPublicAddress:{fields:{spend_public_key:{type:"bytes",id:1},view_public_key:{type:"bytes",id:2}}}}},MoneroTransactionRsigData:{fields:{rsig_type:{type:"uint32",id:1},offload_type:{type:"uint32",id:2},grouping:{rule:"repeated",type:"uint64",id:3,options:{packed:!1}},mask:{type:"bytes",id:4},rsig:{type:"bytes",id:5},rsig_parts:{rule:"repeated",type:"bytes",id:6},bp_version:{type:"uint32",id:7}}},MoneroGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2},network_type:{type:"uint32",id:3},account:{type:"uint32",id:4},minor:{type:"uint32",id:5},payment_id:{type:"bytes",id:6}}},MoneroAddress:{fields:{address:{type:"bytes",id:1}}},MoneroGetWatchKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2}}},MoneroWatchKey:{fields:{watch_key:{type:"bytes",id:1},address:{type:"bytes",id:2}}},MoneroTransactionInitRequest:{fields:{version:{type:"uint32",id:1},address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},network_type:{type:"uint32",id:3},tsx_data:{type:"MoneroTransactionData",id:4}},nested:{MoneroTransactionData:{fields:{version:{type:"uint32",id:1},payment_id:{type:"bytes",id:2},unlock_time:{type:"uint64",id:3},outputs:{rule:"repeated",type:"MoneroTransactionDestinationEntry",id:4},change_dts:{type:"MoneroTransactionDestinationEntry",id:5},num_inputs:{type:"uint32",id:6},mixin:{type:"uint32",id:7},fee:{type:"uint64",id:8},account:{type:"uint32",id:9},minor_indices:{rule:"repeated",type:"uint32",id:10,options:{packed:!1}},rsig_data:{type:"MoneroTransactionRsigData",id:11},integrated_indices:{rule:"repeated",type:"uint32",id:12,options:{packed:!1}},client_version:{type:"uint32",id:13},hard_fork:{type:"uint32",id:14},monero_version:{type:"bytes",id:15}}}}},MoneroTransactionInitAck:{fields:{hmacs:{rule:"repeated",type:"bytes",id:1},rsig_data:{type:"MoneroTransactionRsigData",id:2}}},MoneroTransactionSetInputRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1}}},MoneroTransactionSetInputAck:{fields:{vini:{type:"bytes",id:1},vini_hmac:{type:"bytes",id:2},pseudo_out:{type:"bytes",id:3},pseudo_out_hmac:{type:"bytes",id:4},pseudo_out_alpha:{type:"bytes",id:5},spend_key:{type:"bytes",id:6}}},MoneroTransactionInputsPermutationRequest:{fields:{perm:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}}}},MoneroTransactionInputsPermutationAck:{fields:{}},MoneroTransactionInputViniRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1},vini:{type:"bytes",id:2},vini_hmac:{type:"bytes",id:3},pseudo_out:{type:"bytes",id:4},pseudo_out_hmac:{type:"bytes",id:5},orig_idx:{type:"uint32",id:6}}},MoneroTransactionInputViniAck:{fields:{}},MoneroTransactionAllInputsSetRequest:{fields:{}},MoneroTransactionAllInputsSetAck:{fields:{rsig_data:{type:"MoneroTransactionRsigData",id:1}}},MoneroTransactionSetOutputRequest:{fields:{dst_entr:{type:"MoneroTransactionDestinationEntry",id:1},dst_entr_hmac:{type:"bytes",id:2},rsig_data:{type:"MoneroTransactionRsigData",id:3},is_offloaded_bp:{type:"bool",id:4}}},MoneroTransactionSetOutputAck:{fields:{tx_out:{type:"bytes",id:1},vouti_hmac:{type:"bytes",id:2},rsig_data:{type:"MoneroTransactionRsigData",id:3},out_pk:{type:"bytes",id:4},ecdh_info:{type:"bytes",id:5}}},MoneroTransactionAllOutSetRequest:{fields:{rsig_data:{type:"MoneroTransactionRsigData",id:1}}},MoneroTransactionAllOutSetAck:{fields:{extra:{type:"bytes",id:1},tx_prefix_hash:{type:"bytes",id:2},rv:{type:"MoneroRingCtSig",id:4},full_message_hash:{type:"bytes",id:5}},nested:{MoneroRingCtSig:{fields:{txn_fee:{type:"uint64",id:1},message:{type:"bytes",id:2},rv_type:{type:"uint32",id:3}}}}},MoneroTransactionSignInputRequest:{fields:{src_entr:{type:"MoneroTransactionSourceEntry",id:1},vini:{type:"bytes",id:2},vini_hmac:{type:"bytes",id:3},pseudo_out:{type:"bytes",id:4},pseudo_out_hmac:{type:"bytes",id:5},pseudo_out_alpha:{type:"bytes",id:6},spend_key:{type:"bytes",id:7},orig_idx:{type:"uint32",id:8}}},MoneroTransactionSignInputAck:{fields:{signature:{type:"bytes",id:1},pseudo_out:{type:"bytes",id:2}}},MoneroTransactionFinalRequest:{fields:{}},MoneroTransactionFinalAck:{fields:{cout_key:{type:"bytes",id:1},salt:{type:"bytes",id:2},rand_mult:{type:"bytes",id:3},tx_enc_keys:{type:"bytes",id:4},opening_key:{type:"bytes",id:5}}},MoneroKeyImageExportInitRequest:{fields:{num:{type:"uint64",id:1},hash:{type:"bytes",id:2},address_n:{rule:"repeated",type:"uint32",id:3,options:{packed:!1}},network_type:{type:"uint32",id:4},subs:{rule:"repeated",type:"MoneroSubAddressIndicesList",id:5}},nested:{MoneroSubAddressIndicesList:{fields:{account:{type:"uint32",id:1},minor_indices:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}}}}}},MoneroKeyImageExportInitAck:{fields:{}},MoneroKeyImageSyncStepRequest:{fields:{tdis:{rule:"repeated",type:"MoneroTransferDetails",id:1}},nested:{MoneroTransferDetails:{fields:{out_key:{type:"bytes",id:1},tx_pub_key:{type:"bytes",id:2},additional_tx_pub_keys:{rule:"repeated",type:"bytes",id:3},internal_output_index:{type:"uint64",id:4},sub_addr_major:{type:"uint32",id:5},sub_addr_minor:{type:"uint32",id:6}}}}},MoneroKeyImageSyncStepAck:{fields:{kis:{rule:"repeated",type:"MoneroExportedKeyImage",id:1}},nested:{MoneroExportedKeyImage:{fields:{iv:{type:"bytes",id:1},blob:{type:"bytes",id:3}}}}},MoneroKeyImageSyncFinalRequest:{fields:{}},MoneroKeyImageSyncFinalAck:{fields:{enc_key:{type:"bytes",id:1}}},MoneroGetTxKeyRequest:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2},salt1:{type:"bytes",id:3},salt2:{type:"bytes",id:4},tx_enc_keys:{type:"bytes",id:5},tx_prefix_hash:{type:"bytes",id:6},reason:{type:"uint32",id:7},view_public_key:{type:"bytes",id:8}}},MoneroGetTxKeyAck:{fields:{salt:{type:"bytes",id:1},tx_keys:{type:"bytes",id:2},tx_derivations:{type:"bytes",id:3}}},MoneroLiveRefreshStartRequest:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network_type:{type:"uint32",id:2}}},MoneroLiveRefreshStartAck:{fields:{}},MoneroLiveRefreshStepRequest:{fields:{out_key:{type:"bytes",id:1},recv_deriv:{type:"bytes",id:2},real_out_idx:{type:"uint64",id:3},sub_addr_major:{type:"uint32",id:4},sub_addr_minor:{type:"uint32",id:5}}},MoneroLiveRefreshStepAck:{fields:{salt:{type:"bytes",id:1},key_image:{type:"bytes",id:2}}},MoneroLiveRefreshFinalRequest:{fields:{}},MoneroLiveRefreshFinalAck:{fields:{}},DebugMoneroDiagRequest:{fields:{ins:{type:"uint64",id:1},p1:{type:"uint64",id:2},p2:{type:"uint64",id:3},pd:{rule:"repeated",type:"uint64",id:4,options:{packed:!1}},data1:{type:"bytes",id:5},data2:{type:"bytes",id:6}}},DebugMoneroDiagAck:{fields:{ins:{type:"uint64",id:1},p1:{type:"uint64",id:2},p2:{type:"uint64",id:3},pd:{rule:"repeated",type:"uint64",id:4,options:{packed:!1}},data1:{type:"bytes",id:5},data2:{type:"bytes",id:6}}},NearGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},NearAddress:{fields:{address:{type:"string",id:1}}},NearSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},NearSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1}}},NEMGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},show_display:{type:"bool",id:3}}},NEMAddress:{fields:{address:{rule:"required",type:"string",id:1}}},NEMSignTx:{fields:{transaction:{type:"NEMTransactionCommon",id:1},multisig:{type:"NEMTransactionCommon",id:2},transfer:{type:"NEMTransfer",id:3},cosigning:{type:"bool",id:4},provision_namespace:{type:"NEMProvisionNamespace",id:5},mosaic_creation:{type:"NEMMosaicCreation",id:6},supply_change:{type:"NEMMosaicSupplyChange",id:7},aggregate_modification:{type:"NEMAggregateModification",id:8},importance_transfer:{type:"NEMImportanceTransfer",id:9}},nested:{NEMTransactionCommon:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},timestamp:{type:"uint32",id:3},fee:{type:"uint64",id:4},deadline:{type:"uint32",id:5},signer:{type:"bytes",id:6}}},NEMTransfer:{fields:{recipient:{type:"string",id:1},amount:{type:"uint64",id:2},payload:{type:"bytes",id:3},public_key:{type:"bytes",id:4},mosaics:{rule:"repeated",type:"NEMMosaic",id:5}},nested:{NEMMosaic:{fields:{namespace:{type:"string",id:1},mosaic:{type:"string",id:2},quantity:{type:"uint64",id:3}}}}},NEMProvisionNamespace:{fields:{namespace:{type:"string",id:1},parent:{type:"string",id:2},sink:{type:"string",id:3},fee:{type:"uint64",id:4}}},NEMMosaicCreation:{fields:{definition:{type:"NEMMosaicDefinition",id:1},sink:{type:"string",id:2},fee:{type:"uint64",id:3}},nested:{NEMMosaicDefinition:{fields:{name:{type:"string",id:1},ticker:{type:"string",id:2},namespace:{type:"string",id:3},mosaic:{type:"string",id:4},divisibility:{type:"uint32",id:5},levy:{type:"NEMMosaicLevy",id:6},fee:{type:"uint64",id:7},levy_address:{type:"string",id:8},levy_namespace:{type:"string",id:9},levy_mosaic:{type:"string",id:10},supply:{type:"uint64",id:11},mutable_supply:{type:"bool",id:12},transferable:{type:"bool",id:13},description:{type:"string",id:14},networks:{rule:"repeated",type:"uint32",id:15,options:{packed:!1}}},nested:{NEMMosaicLevy:{values:{MosaicLevy_Absolute:1,MosaicLevy_Percentile:2}}}}}},NEMMosaicSupplyChange:{fields:{namespace:{type:"string",id:1},mosaic:{type:"string",id:2},type:{type:"NEMSupplyChangeType",id:3},delta:{type:"uint64",id:4}},nested:{NEMSupplyChangeType:{values:{SupplyChange_Increase:1,SupplyChange_Decrease:2}}}},NEMAggregateModification:{fields:{modifications:{rule:"repeated",type:"NEMCosignatoryModification",id:1},relative_change:{type:"sint32",id:2}},nested:{NEMCosignatoryModification:{fields:{type:{type:"NEMModificationType",id:1},public_key:{type:"bytes",id:2}},nested:{NEMModificationType:{values:{CosignatoryModification_Add:1,CosignatoryModification_Delete:2}}}}}},NEMImportanceTransfer:{fields:{mode:{type:"NEMImportanceTransferMode",id:1},public_key:{type:"bytes",id:2}},nested:{NEMImportanceTransferMode:{values:{ImportanceTransfer_Activate:1,ImportanceTransfer_Deactivate:2}}}}}},NEMSignedTx:{fields:{data:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},NEMDecryptMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},network:{type:"uint32",id:2},public_key:{type:"bytes",id:3},payload:{type:"bytes",id:4}}},NEMDecryptedMessage:{fields:{payload:{rule:"required",type:"bytes",id:1}}},RippleGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},RippleAddress:{fields:{address:{rule:"required",type:"string",id:1}}},RippleSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},fee:{type:"uint64",id:2},flags:{type:"uint32",id:3},sequence:{type:"uint32",id:4},last_ledger_sequence:{type:"uint32",id:5},payment:{type:"RipplePayment",id:6}},nested:{RipplePayment:{fields:{amount:{rule:"required",type:"uint64",id:1},destination:{rule:"required",type:"string",id:2},destination_tag:{type:"uint32",id:3}}}}},RippleSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},serialized_tx:{rule:"required",type:"bytes",id:2}}},SolanaGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},SolanaAddress:{fields:{address:{type:"string",id:1}}},SolanaSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{rule:"required",type:"bytes",id:2}}},SolanaSignedTx:{fields:{signature:{type:"bytes",id:1}}},StarcoinGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StarcoinAddress:{fields:{address:{type:"string",id:1}}},StarcoinGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StarcoinPublicKey:{fields:{public_key:{rule:"required",type:"bytes",id:1}}},StarcoinSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},raw_tx:{type:"bytes",id:2}}},StarcoinSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},StarcoinSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{type:"bytes",id:2}}},StarcoinMessageSignature:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},StarcoinVerifyMessage:{fields:{public_key:{type:"bytes",id:1},signature:{type:"bytes",id:2},message:{type:"bytes",id:3}}},StellarAssetType:{values:{NATIVE:0,ALPHANUM4:1,ALPHANUM12:2}},StellarAsset:{fields:{type:{rule:"required",type:"StellarAssetType",id:1},code:{type:"string",id:2},issuer:{type:"string",id:3}}},StellarGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},StellarAddress:{fields:{address:{rule:"required",type:"string",id:1}}},StellarSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:2,options:{packed:!1}},network_passphrase:{rule:"required",type:"string",id:3},source_account:{rule:"required",type:"string",id:4},fee:{rule:"required",type:"uint32",id:5},sequence_number:{rule:"required",type:"uint64",id:6},timebounds_start:{rule:"required",type:"uint32",id:8},timebounds_end:{rule:"required",type:"uint32",id:9},memo_type:{rule:"required",type:"StellarMemoType",id:10},memo_text:{type:"string",id:11},memo_id:{type:"uint64",id:12},memo_hash:{type:"bytes",id:13},num_operations:{rule:"required",type:"uint32",id:14}},nested:{StellarMemoType:{values:{NONE:0,TEXT:1,ID:2,HASH:3,RETURN:4}}}},StellarTxOpRequest:{fields:{}},StellarPaymentOp:{fields:{source_account:{type:"string",id:1},destination_account:{rule:"required",type:"string",id:2},asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4}}},StellarCreateAccountOp:{fields:{source_account:{type:"string",id:1},new_account:{rule:"required",type:"string",id:2},starting_balance:{rule:"required",type:"sint64",id:3}}},StellarPathPaymentStrictReceiveOp:{fields:{source_account:{type:"string",id:1},send_asset:{rule:"required",type:"StellarAsset",id:2},send_max:{rule:"required",type:"sint64",id:3},destination_account:{rule:"required",type:"string",id:4},destination_asset:{rule:"required",type:"StellarAsset",id:5},destination_amount:{rule:"required",type:"sint64",id:6},paths:{rule:"repeated",type:"StellarAsset",id:7}}},StellarPathPaymentStrictSendOp:{fields:{source_account:{type:"string",id:1},send_asset:{rule:"required",type:"StellarAsset",id:2},send_amount:{rule:"required",type:"sint64",id:3},destination_account:{rule:"required",type:"string",id:4},destination_asset:{rule:"required",type:"StellarAsset",id:5},destination_min:{rule:"required",type:"sint64",id:6},paths:{rule:"repeated",type:"StellarAsset",id:7}}},StellarManageSellOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6},offer_id:{rule:"required",type:"uint64",id:7}}},StellarManageBuyOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6},offer_id:{rule:"required",type:"uint64",id:7}}},StellarCreatePassiveSellOfferOp:{fields:{source_account:{type:"string",id:1},selling_asset:{rule:"required",type:"StellarAsset",id:2},buying_asset:{rule:"required",type:"StellarAsset",id:3},amount:{rule:"required",type:"sint64",id:4},price_n:{rule:"required",type:"uint32",id:5},price_d:{rule:"required",type:"uint32",id:6}}},StellarSetOptionsOp:{fields:{source_account:{type:"string",id:1},inflation_destination_account:{type:"string",id:2},clear_flags:{type:"uint32",id:3},set_flags:{type:"uint32",id:4},master_weight:{type:"uint32",id:5},low_threshold:{type:"uint32",id:6},medium_threshold:{type:"uint32",id:7},high_threshold:{type:"uint32",id:8},home_domain:{type:"string",id:9},signer_type:{type:"StellarSignerType",id:10},signer_key:{type:"bytes",id:11},signer_weight:{type:"uint32",id:12}},nested:{StellarSignerType:{values:{ACCOUNT:0,PRE_AUTH:1,HASH:2}}}},StellarChangeTrustOp:{fields:{source_account:{type:"string",id:1},asset:{rule:"required",type:"StellarAsset",id:2},limit:{rule:"required",type:"uint64",id:3}}},StellarAllowTrustOp:{fields:{source_account:{type:"string",id:1},trusted_account:{rule:"required",type:"string",id:2},asset_type:{rule:"required",type:"StellarAssetType",id:3},asset_code:{type:"string",id:4},is_authorized:{rule:"required",type:"bool",id:5}}},StellarAccountMergeOp:{fields:{source_account:{type:"string",id:1},destination_account:{rule:"required",type:"string",id:2}}},StellarManageDataOp:{fields:{source_account:{type:"string",id:1},key:{rule:"required",type:"string",id:2},value:{type:"bytes",id:3}}},StellarBumpSequenceOp:{fields:{source_account:{type:"string",id:1},bump_to:{rule:"required",type:"uint64",id:2}}},StellarSignedTx:{fields:{public_key:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},TezosGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TezosAddress:{fields:{address:{rule:"required",type:"string",id:1}}},TezosGetPublicKey:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TezosPublicKey:{fields:{public_key:{rule:"required",type:"string",id:1}}},TezosSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},branch:{rule:"required",type:"bytes",id:2},reveal:{type:"TezosRevealOp",id:3},transaction:{type:"TezosTransactionOp",id:4},origination:{type:"TezosOriginationOp",id:5},delegation:{type:"TezosDelegationOp",id:6},proposal:{type:"TezosProposalOp",id:7},ballot:{type:"TezosBallotOp",id:8}},nested:{TezosContractID:{fields:{tag:{rule:"required",type:"TezosContractType",id:1},hash:{rule:"required",type:"bytes",id:2}},nested:{TezosContractType:{values:{Implicit:0,Originated:1}}}},TezosRevealOp:{fields:{source:{rule:"required",type:"bytes",id:7},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},public_key:{rule:"required",type:"bytes",id:6}}},TezosTransactionOp:{fields:{source:{rule:"required",type:"bytes",id:9},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},amount:{rule:"required",type:"uint64",id:6},destination:{rule:"required",type:"TezosContractID",id:7},parameters:{type:"bytes",id:8},parameters_manager:{type:"TezosParametersManager",id:10}},nested:{TezosParametersManager:{fields:{set_delegate:{type:"bytes",id:1},cancel_delegate:{type:"bool",id:2},transfer:{type:"TezosManagerTransfer",id:3}},nested:{TezosManagerTransfer:{fields:{destination:{type:"TezosContractID",id:1},amount:{type:"uint64",id:2}}}}}}},TezosOriginationOp:{fields:{source:{rule:"required",type:"bytes",id:12},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},manager_pubkey:{type:"bytes",id:6},balance:{rule:"required",type:"uint64",id:7},spendable:{type:"bool",id:8},delegatable:{type:"bool",id:9},delegate:{type:"bytes",id:10},script:{rule:"required",type:"bytes",id:11}}},TezosDelegationOp:{fields:{source:{rule:"required",type:"bytes",id:7},fee:{rule:"required",type:"uint64",id:2},counter:{rule:"required",type:"uint64",id:3},gas_limit:{rule:"required",type:"uint64",id:4},storage_limit:{rule:"required",type:"uint64",id:5},delegate:{rule:"required",type:"bytes",id:6}}},TezosProposalOp:{fields:{source:{type:"bytes",id:1},period:{type:"uint64",id:2},proposals:{rule:"repeated",type:"bytes",id:4}}},TezosBallotOp:{fields:{source:{type:"bytes",id:1},period:{type:"uint64",id:2},proposal:{type:"bytes",id:3},ballot:{type:"TezosBallotType",id:4}},nested:{TezosBallotType:{values:{Yay:0,Nay:1,Pass:2}}}}}},TezosSignedTx:{fields:{signature:{rule:"required",type:"string",id:1},sig_op_contents:{rule:"required",type:"bytes",id:2},operation_hash:{rule:"required",type:"string",id:3}}},TronGetAddress:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},show_display:{type:"bool",id:2}}},TronAddress:{fields:{address:{type:"string",id:1}}},TronSignTx:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},ref_block_bytes:{rule:"required",type:"bytes",id:2},ref_block_hash:{rule:"required",type:"bytes",id:3},expiration:{rule:"required",type:"uint64",id:4},data:{type:"string",id:5},contract:{rule:"required",type:"TronContract",id:6},timestamp:{rule:"required",type:"uint64",id:7},fee_limit:{type:"uint64",id:8}},nested:{TronContract:{fields:{transfer_contract:{type:"TronTransferContract",id:2},trigger_smart_contract:{type:"TronTriggerSmartContract",id:31}},nested:{TronTransferContract:{fields:{to_address:{type:"string",id:2},amount:{type:"uint64",id:3}}},TronTriggerSmartContract:{fields:{contract_address:{type:"string",id:2},call_value:{type:"uint64",id:3},data:{type:"bytes",id:4},call_token_value:{type:"uint64",id:5},asset_id:{type:"uint64",id:6}}}}}}},TronSignedTx:{fields:{signature:{rule:"required",type:"bytes",id:1},serialized_tx:{type:"bytes",id:2}}},TronSignMessage:{fields:{address_n:{rule:"repeated",type:"uint32",id:1,options:{packed:!1}},message:{rule:"required",type:"bytes",id:2}}},TronMessageSignature:{fields:{address:{rule:"required",type:"bytes",id:1},signature:{rule:"required",type:"bytes",id:2}}},WebAuthnListResidentCredentials:{fields:{}},WebAuthnAddResidentCredential:{fields:{credential_id:{type:"bytes",id:1}}},WebAuthnRemoveResidentCredential:{fields:{index:{type:"uint32",id:1}}},WebAuthnCredentials:{fields:{credentials:{rule:"repeated",type:"WebAuthnCredential",id:1}},nested:{WebAuthnCredential:{fields:{index:{type:"uint32",id:1},id:{type:"bytes",id:2},rp_id:{type:"string",id:3},rp_name:{type:"string",id:4},user_id:{type:"bytes",id:5},user_name:{type:"string",id:6},user_display_name:{type:"string",id:7},creation_time:{type:"uint32",id:8},hmac_secret:{type:"bool",id:9},use_sign_count:{type:"bool",id:10},algorithm:{type:"sint32",id:11},curve:{type:"sint32",id:12}}}}},wire_in:{type:"bool",id:50002,extend:"google.protobuf.EnumValueOptions"},wire_out:{type:"bool",id:50003,extend:"google.protobuf.EnumValueOptions"},wire_debug_in:{type:"bool",id:50004,extend:"google.protobuf.EnumValueOptions"},wire_debug_out:{type:"bool",id:50005,extend:"google.protobuf.EnumValueOptions"},wire_tiny:{type:"bool",id:50006,extend:"google.protobuf.EnumValueOptions"},wire_bootloader:{type:"bool",id:50007,extend:"google.protobuf.EnumValueOptions"},wire_no_fsm:{type:"bool",id:50008,extend:"google.protobuf.EnumValueOptions"},facotry:{type:"bool",id:50501,extend:"google.protobuf.EnumValueOptions"},bitcoin_only:{type:"bool",id:6e4,extend:"google.protobuf.EnumValueOptions"},has_bitcoin_only_values:{type:"bool",id:51001,extend:"google.protobuf.EnumOptions"},unstable:{type:"bool",id:52001,extend:"google.protobuf.MessageOptions"},wire_type:{type:"uint32",id:52002,extend:"google.protobuf.MessageOptions"},experimental:{type:"bool",id:53001,extend:"google.protobuf.FieldOptions"},include_in_bitcoin_only:{type:"bool",id:6e4,extend:"google.protobuf.FileOptions"},CommandFlags:{values:{Default:0,Factory_Only:1}},MessageType:{options:{"(has_bitcoin_only_values)":!0},values:{MessageType_Initialize:0,MessageType_Ping:1,MessageType_Success:2,MessageType_Failure:3,MessageType_ChangePin:4,MessageType_WipeDevice:5,MessageType_GetEntropy:9,MessageType_Entropy:10,MessageType_LoadDevice:13,MessageType_ResetDevice:14,MessageType_Features:17,MessageType_PinMatrixRequest:18,MessageType_PinMatrixAck:19,MessageType_Cancel:20,MessageType_LockDevice:24,MessageType_ApplySettings:25,MessageType_ButtonRequest:26,MessageType_ButtonAck:27,MessageType_ApplyFlags:28,MessageType_BackupDevice:34,MessageType_EntropyRequest:35,MessageType_EntropyAck:36,MessageType_PassphraseRequest:41,MessageType_PassphraseAck:42,MessageType_RecoveryDevice:45,MessageType_WordRequest:46,MessageType_WordAck:47,MessageType_GetFeatures:55,MessageType_SdProtect:79,MessageType_ChangeWipeCode:82,MessageType_EndSession:83,MessageType_DoPreauthorized:84,MessageType_PreauthorizedRequest:85,MessageType_CancelAuthorization:86,MessageType_RebootToBootloader:87,MessageType_SetU2FCounter:63,MessageType_GetNextU2FCounter:80,MessageType_NextU2FCounter:81,MessageType_Deprecated_PassphraseStateRequest:77,MessageType_Deprecated_PassphraseStateAck:78,MessageType_FirmwareErase:6,MessageType_FirmwareErase_ex:16,MessageType_FirmwareUpload:7,MessageType_FirmwareRequest:8,MessageType_SelfTest:32,MessageType_GetPublicKey:11,MessageType_PublicKey:12,MessageType_SignTx:15,MessageType_TxRequest:21,MessageType_TxAck:22,MessageType_GetAddress:29,MessageType_Address:30,MessageType_SignMessage:38,MessageType_VerifyMessage:39,MessageType_MessageSignature:40,MessageType_GetOwnershipId:43,MessageType_OwnershipId:44,MessageType_GetOwnershipProof:49,MessageType_OwnershipProof:50,MessageType_AuthorizeCoinJoin:51,MessageType_CipherKeyValue:23,MessageType_CipheredKeyValue:48,MessageType_SignIdentity:53,MessageType_SignedIdentity:54,MessageType_GetECDHSessionKey:61,MessageType_ECDHSessionKey:62,MessageType_CosiCommit:71,MessageType_CosiCommitment:72,MessageType_CosiSign:73,MessageType_CosiSignature:74,MessageType_BatchGetPublickeys:10016,MessageType_EcdsaPublicKeys:10017,MessageType_DebugLinkDecision:100,MessageType_DebugLinkGetState:101,MessageType_DebugLinkState:102,MessageType_DebugLinkStop:103,MessageType_DebugLinkLog:104,MessageType_DebugLinkMemoryRead:110,MessageType_DebugLinkMemory:111,MessageType_DebugLinkMemoryWrite:112,MessageType_DebugLinkFlashErase:113,MessageType_DebugLinkLayout:9001,MessageType_DebugLinkReseedRandom:9002,MessageType_DebugLinkRecordScreen:9003,MessageType_DebugLinkEraseSdCard:9005,MessageType_DebugLinkWatchLayout:9006,MessageType_EthereumGetPublicKey:450,MessageType_EthereumPublicKey:451,MessageType_EthereumGetAddress:56,MessageType_EthereumAddress:57,MessageType_EthereumSignTx:58,MessageType_EthereumSignTxEIP1559:452,MessageType_EthereumTxRequest:59,MessageType_EthereumTxAck:60,MessageType_EthereumSignMessage:64,MessageType_EthereumVerifyMessage:65,MessageType_EthereumMessageSignature:66,MessageType_EthereumSignTypedData:464,MessageType_EthereumTypedDataStructRequest:465,MessageType_EthereumTypedDataStructAck:466,MessageType_EthereumTypedDataValueRequest:467,MessageType_EthereumTypedDataValueAck:468,MessageType_EthereumTypedDataSignature:469,MessageType_EthereumSignTypedHash:470,MessageType_NEMGetAddress:67,MessageType_NEMAddress:68,MessageType_NEMSignTx:69,MessageType_NEMSignedTx:70,MessageType_NEMDecryptMessage:75,MessageType_NEMDecryptedMessage:76,MessageType_TezosGetAddress:150,MessageType_TezosAddress:151,MessageType_TezosSignTx:152,MessageType_TezosSignedTx:153,MessageType_TezosGetPublicKey:154,MessageType_TezosPublicKey:155,MessageType_StellarSignTx:202,MessageType_StellarTxOpRequest:203,MessageType_StellarGetAddress:207,MessageType_StellarAddress:208,MessageType_StellarCreateAccountOp:210,MessageType_StellarPaymentOp:211,MessageType_StellarPathPaymentStrictReceiveOp:212,MessageType_StellarManageSellOfferOp:213,MessageType_StellarCreatePassiveSellOfferOp:214,MessageType_StellarSetOptionsOp:215,MessageType_StellarChangeTrustOp:216,MessageType_StellarAllowTrustOp:217,MessageType_StellarAccountMergeOp:218,MessageType_StellarManageDataOp:220,MessageType_StellarBumpSequenceOp:221,MessageType_StellarManageBuyOfferOp:222,MessageType_StellarPathPaymentStrictSendOp:223,MessageType_StellarSignedTx:230,MessageType_CardanoSignTx:303,MessageType_CardanoGetPublicKey:305,MessageType_CardanoPublicKey:306,MessageType_CardanoGetAddress:307,MessageType_CardanoAddress:308,MessageType_CardanoSignedTx:310,MessageType_CardanoSignedTxChunk:311,MessageType_CardanoSignedTxChunkAck:312,MessageType_CardanoTxItemAck:313,MessageType_CardanoTxAuxiliaryDataSupplement:314,MessageType_CardanoTxWitnessRequest:315,MessageType_CardanoTxWitnessResponse:316,MessageType_CardanoTxHostAck:317,MessageType_CardanoTxBodyHash:318,MessageType_CardanoSignTxFinished:319,MessageType_CardanoSignTxInit:320,MessageType_CardanoTxInput:321,MessageType_CardanoTxOutput:322,MessageType_CardanoAssetGroup:323,MessageType_CardanoToken:324,MessageType_CardanoTxCertificate:325,MessageType_CardanoTxWithdrawal:326,MessageType_CardanoTxAuxiliaryData:327,MessageType_CardanoPoolOwner:328,MessageType_CardanoPoolRelayParameters:329,MessageType_CardanoGetNativeScriptHash:330,MessageType_CardanoNativeScriptHash:331,MessageType_CardanoTxMint:332,MessageType_RippleGetAddress:400,MessageType_RippleAddress:401,MessageType_RippleSignTx:402,MessageType_RippleSignedTx:403,MessageType_MoneroTransactionInitRequest:501,MessageType_MoneroTransactionInitAck:502,MessageType_MoneroTransactionSetInputRequest:503,MessageType_MoneroTransactionSetInputAck:504,MessageType_MoneroTransactionInputsPermutationRequest:505,MessageType_MoneroTransactionInputsPermutationAck:506,MessageType_MoneroTransactionInputViniRequest:507,MessageType_MoneroTransactionInputViniAck:508,MessageType_MoneroTransactionAllInputsSetRequest:509,MessageType_MoneroTransactionAllInputsSetAck:510,MessageType_MoneroTransactionSetOutputRequest:511,MessageType_MoneroTransactionSetOutputAck:512,MessageType_MoneroTransactionAllOutSetRequest:513,MessageType_MoneroTransactionAllOutSetAck:514,MessageType_MoneroTransactionSignInputRequest:515,MessageType_MoneroTransactionSignInputAck:516,MessageType_MoneroTransactionFinalRequest:517,MessageType_MoneroTransactionFinalAck:518,MessageType_MoneroKeyImageExportInitRequest:530,MessageType_MoneroKeyImageExportInitAck:531,MessageType_MoneroKeyImageSyncStepRequest:532,MessageType_MoneroKeyImageSyncStepAck:533,MessageType_MoneroKeyImageSyncFinalRequest:534,MessageType_MoneroKeyImageSyncFinalAck:535,MessageType_MoneroGetAddress:540,MessageType_MoneroAddress:541,MessageType_MoneroGetWatchKey:542,MessageType_MoneroWatchKey:543,MessageType_DebugMoneroDiagRequest:546,MessageType_DebugMoneroDiagAck:547,MessageType_MoneroGetTxKeyRequest:550,MessageType_MoneroGetTxKeyAck:551,MessageType_MoneroLiveRefreshStartRequest:552,MessageType_MoneroLiveRefreshStartAck:553,MessageType_MoneroLiveRefreshStepRequest:554,MessageType_MoneroLiveRefreshStepAck:555,MessageType_MoneroLiveRefreshFinalRequest:556,MessageType_MoneroLiveRefreshFinalAck:557,MessageType_EosGetPublicKey:600,MessageType_EosPublicKey:601,MessageType_EosSignTx:602,MessageType_EosTxActionRequest:603,MessageType_EosTxActionAck:604,MessageType_EosSignedTx:605,MessageType_BinanceGetAddress:700,MessageType_BinanceAddress:701,MessageType_BinanceGetPublicKey:702,MessageType_BinancePublicKey:703,MessageType_BinanceSignTx:704,MessageType_BinanceTxRequest:705,MessageType_BinanceTransferMsg:706,MessageType_BinanceOrderMsg:707,MessageType_BinanceCancelMsg:708,MessageType_BinanceSignedTx:709,MessageType_SolanaGetAddress:10100,MessageType_SolanaAddress:10101,MessageType_SolanaSignTx:10102,MessageType_SolanaSignedTx:10103,MessageType_StarcoinGetAddress:10300,MessageType_StarcoinAddress:10301,MessageType_StarcoinGetPublicKey:10302,MessageType_StarcoinPublicKey:10303,MessageType_StarcoinSignTx:10304,MessageType_StarcoinSignedTx:10305,MessageType_StarcoinSignMessage:10306,MessageType_StarcoinMessageSignature:10307,MessageType_StarcoinVerifyMessage:10308,MessageType_AptosGetAddress:10600,MessageType_AptosAddress:10601,MessageType_AptosSignTx:10602,MessageType_AptosSignedTx:10603,MessageType_AptosSignMessage:10604,MessageType_AptosMessageSignature:10605,MessageType_WebAuthnListResidentCredentials:800,MessageType_WebAuthnCredentials:801,MessageType_WebAuthnAddResidentCredential:802,MessageType_WebAuthnRemoveResidentCredential:803,MessageType_BixinSeedOperate:901,MessageType_BixinMessageSE:902,MessageType_BixinOutMessageSE:904,MessageType_BixinBackupRequest:905,MessageType_BixinBackupAck:906,MessageType_BixinRestoreRequest:907,MessageType_BixinRestoreAck:908,MessageType_BixinVerifyDeviceRequest:909,MessageType_BixinVerifyDeviceAck:910,MessageType_BixinWhiteListRequest:911,MessageType_BixinWhiteListAck:912,MessageType_BixinLoadDevice:913,MessageType_BixinBackupDevice:914,MessageType_BixinBackupDeviceAck:915,MessageType_BixinPinInputOnDevice:1e4,MessageType_EthereumSignMessageEIP712:10200,MessageType_GetPublicKeyMultiple:10210,MessageType_PublicKeyMultiple:10211,MessageType_ConfluxGetAddress:10112,MessageType_ConfluxAddress:10113,MessageType_ConfluxSignTx:10114,MessageType_ConfluxTxRequest:10115,MessageType_ConfluxTxAck:10116,MessageType_ConfluxSignMessage:10117,MessageType_ConfluxSignMessageCIP23:10118,MessageType_ConfluxMessageSignature:10119,MessageType_TronGetAddress:10501,MessageType_TronAddress:10502,MessageType_TronSignTx:10503,MessageType_TronSignedTx:10504,MessageType_TronSignMessage:10505,MessageType_TronMessageSignature:10506,MessageType_NearGetAddress:10701,MessageType_NearAddress:10702,MessageType_NearSignTx:10703,MessageType_NearSignedTx:10704,MessageType_CosmosGetAddress:10800,MessageType_CosmosAddress:10801,MessageType_CosmosSignTx:10802,MessageType_CosmosSignedTx:10803,MessageType_AlgorandGetAddress:10900,MessageType_AlgorandAddress:10901,MessageType_AlgorandSignTx:10902,MessageType_AlgorandSignedTx:10903,MessageType_DeviceBackToBoot:903,MessageType_DeviceInfoSettings:10001,MessageType_GetDeviceInfo:10002,MessageType_DeviceInfo:10003,MessageType_ReadSEPublicKey:10004,MessageType_SEPublicKey:10005,MessageType_WriteSEPublicCert:10006,MessageType_ReadSEPublicCert:10007,MessageType_SEPublicCert:10008,MessageType_SpiFlashWrite:10009,MessageType_SpiFlashRead:10010,MessageType_SpiFlashData:10011,MessageType_SESignMessage:10012,MessageType_SEMessageSignature:10013,MessageType_NFTWriteInfo:10014,MessageType_NFTWriteData:10015,MessageType_ResourceUpload:10018,MessageType_ZoomRequest:10019,MessageType_ResourceRequest:10020,MessageType_ResourceAck:10021,MessageType_ResourceUpdate:10022}},google:{nested:{protobuf:{nested:{FileDescriptorSet:{fields:{file:{rule:"repeated",type:"FileDescriptorProto",id:1}}},FileDescriptorProto:{fields:{name:{type:"string",id:1},package:{type:"string",id:2},dependency:{rule:"repeated",type:"string",id:3},public_dependency:{rule:"repeated",type:"int32",id:10,options:{packed:!1}},weak_dependency:{rule:"repeated",type:"int32",id:11,options:{packed:!1}},message_type:{rule:"repeated",type:"DescriptorProto",id:4},enum_type:{rule:"repeated",type:"EnumDescriptorProto",id:5},service:{rule:"repeated",type:"ServiceDescriptorProto",id:6},extension:{rule:"repeated",type:"FieldDescriptorProto",id:7},options:{type:"FileOptions",id:8},source_code_info:{type:"SourceCodeInfo",id:9},syntax:{type:"string",id:12}}},DescriptorProto:{fields:{name:{type:"string",id:1},field:{rule:"repeated",type:"FieldDescriptorProto",id:2},extension:{rule:"repeated",type:"FieldDescriptorProto",id:6},nested_type:{rule:"repeated",type:"DescriptorProto",id:3},enum_type:{rule:"repeated",type:"EnumDescriptorProto",id:4},extension_range:{rule:"repeated",type:"ExtensionRange",id:5},oneof_decl:{rule:"repeated",type:"OneofDescriptorProto",id:8},options:{type:"MessageOptions",id:7},reserved_range:{rule:"repeated",type:"ReservedRange",id:9},reserved_name:{rule:"repeated",type:"string",id:10}},nested:{ExtensionRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}},ReservedRange:{fields:{start:{type:"int32",id:1},end:{type:"int32",id:2}}}}},FieldDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:3},label:{type:"Label",id:4},type:{type:"Type",id:5},type_name:{type:"string",id:6},extendee:{type:"string",id:2},default_value:{type:"string",id:7},oneof_index:{type:"int32",id:9},json_name:{type:"string",id:10},options:{type:"FieldOptions",id:8}},nested:{Type:{values:{TYPE_DOUBLE:1,TYPE_FLOAT:2,TYPE_INT64:3,TYPE_UINT64:4,TYPE_INT32:5,TYPE_FIXED64:6,TYPE_FIXED32:7,TYPE_BOOL:8,TYPE_STRING:9,TYPE_GROUP:10,TYPE_MESSAGE:11,TYPE_BYTES:12,TYPE_UINT32:13,TYPE_ENUM:14,TYPE_SFIXED32:15,TYPE_SFIXED64:16,TYPE_SINT32:17,TYPE_SINT64:18}},Label:{values:{LABEL_OPTIONAL:1,LABEL_REQUIRED:2,LABEL_REPEATED:3}}}},OneofDescriptorProto:{fields:{name:{type:"string",id:1},options:{type:"OneofOptions",id:2}}},EnumDescriptorProto:{fields:{name:{type:"string",id:1},value:{rule:"repeated",type:"EnumValueDescriptorProto",id:2},options:{type:"EnumOptions",id:3}}},EnumValueDescriptorProto:{fields:{name:{type:"string",id:1},number:{type:"int32",id:2},options:{type:"EnumValueOptions",id:3}}},ServiceDescriptorProto:{fields:{name:{type:"string",id:1},method:{rule:"repeated",type:"MethodDescriptorProto",id:2},options:{type:"ServiceOptions",id:3}}},MethodDescriptorProto:{fields:{name:{type:"string",id:1},input_type:{type:"string",id:2},output_type:{type:"string",id:3},options:{type:"MethodOptions",id:4},client_streaming:{type:"bool",id:5},server_streaming:{type:"bool",id:6}}},FileOptions:{fields:{java_package:{type:"string",id:1},java_outer_classname:{type:"string",id:8},java_multiple_files:{type:"bool",id:10},java_generate_equals_and_hash:{type:"bool",id:20,options:{deprecated:!0}},java_string_check_utf8:{type:"bool",id:27},optimize_for:{type:"OptimizeMode",id:9,options:{default:"SPEED"}},go_package:{type:"string",id:11},cc_generic_services:{type:"bool",id:16},java_generic_services:{type:"bool",id:17},py_generic_services:{type:"bool",id:18},deprecated:{type:"bool",id:23},cc_enable_arenas:{type:"bool",id:31},objc_class_prefix:{type:"string",id:36},csharp_namespace:{type:"string",id:37},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[38,38]],nested:{OptimizeMode:{values:{SPEED:1,CODE_SIZE:2,LITE_RUNTIME:3}}}},MessageOptions:{fields:{message_set_wire_format:{type:"bool",id:1},no_standard_descriptor_accessor:{type:"bool",id:2},deprecated:{type:"bool",id:3},map_entry:{type:"bool",id:7},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[8,8]]},FieldOptions:{fields:{ctype:{type:"CType",id:1,options:{default:"STRING"}},packed:{type:"bool",id:2},jstype:{type:"JSType",id:6,options:{default:"JS_NORMAL"}},lazy:{type:"bool",id:5},deprecated:{type:"bool",id:3},weak:{type:"bool",id:10},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]],reserved:[[4,4]],nested:{CType:{values:{STRING:0,CORD:1,STRING_PIECE:2}},JSType:{values:{JS_NORMAL:0,JS_STRING:1,JS_NUMBER:2}}}},OneofOptions:{fields:{uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumOptions:{fields:{allow_alias:{type:"bool",id:2},deprecated:{type:"bool",id:3},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},EnumValueOptions:{fields:{deprecated:{type:"bool",id:1},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},ServiceOptions:{fields:{deprecated:{type:"bool",id:33},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},MethodOptions:{fields:{deprecated:{type:"bool",id:33},uninterpreted_option:{rule:"repeated",type:"UninterpretedOption",id:999}},extensions:[[1e3,536870911]]},UninterpretedOption:{fields:{name:{rule:"repeated",type:"NamePart",id:2},identifier_value:{type:"string",id:3},positive_int_value:{type:"uint64",id:4},negative_int_value:{type:"int64",id:5},double_value:{type:"double",id:6},string_value:{type:"bytes",id:7},aggregate_value:{type:"string",id:8}},nested:{NamePart:{fields:{name_part:{rule:"required",type:"string",id:1},is_extension:{rule:"required",type:"bool",id:2}}}}},SourceCodeInfo:{fields:{location:{rule:"repeated",type:"Location",id:1}},nested:{Location:{fields:{path:{rule:"repeated",type:"int32",id:1},span:{rule:"repeated",type:"int32",id:2},leading_comments:{type:"string",id:3},trailing_comments:{type:"string",id:4},leading_detached_comments:{rule:"repeated",type:"string",id:6}}}}},GeneratedCodeInfo:{fields:{annotation:{rule:"repeated",type:"Annotation",id:1}},nested:{Annotation:{fields:{path:{rule:"repeated",type:"int32",id:1},source_file:{type:"string",id:2},begin:{type:"int32",id:3},end:{type:"int32",id:4}}}}}}}}}}};const re=(e,t)=>((e,t="text")=>v(void 0,void 0,void 0,(function*(){const r=yield y.default.request({url:e,withCredentials:!1,responseType:"binary"===t?"arraybuffer":"json"});if(200==+r.status)return r.data;throw new Error(`httpRequest error: ${e} ${r.statusText}`)})))(e,t),ie=()=>(new Date).getTime(),ne=new RegExp(/^[0-9]{1,3}(\.[0-9]{1,3}){0,2}$/),se=e=>ne.test(e),oe=e=>{if(!Array.isArray(e))return!1;if(0===e.length||e.length>3)return!1;if(0===e[0])return!1;for(let t=0;t<e.length;t++)if("number"!=typeof e[t]||e[t]<0)return!1;return!0},ae=e=>{if(3===e.length)return e;const t=[...e];for(let r=e.length;r<3;r++)t.push(0);return t},de=e=>se(e)?e.split(".").map((e=>Number(e))):[0,0,0];function ue(e){return"Features"!==e.type||e.message.major_version<1&&(e.message.major_version=1),e}const le="LOG_EVENT",ce={OUTPUT:"log-output"},pe=(e,t)=>({event:le,type:e,payload:t});let he;class fe{constructor(e,t){this.prefix=e,this.enabled=t,this.messages=[]}addMessage(e,t,...r){this.messages.push({level:e,prefix:t,message:r,timestamp:(new Date).getTime()}),this.messages.length>500&&this.messages.shift()}log(...e){this.addMessage("log",this.prefix,...e),we(this.prefix,...e),this.enabled&&console.log(this.prefix,...e)}error(...e){this.addMessage("error",this.prefix,...e),we(this.prefix,...e),this.enabled&&console.error(this.prefix,...e)}warn(...e){this.addMessage("warn",this.prefix,...e),we(this.prefix,...e),this.enabled&&console.warn(this.prefix,...e)}debug(...e){this.addMessage("debug",this.prefix,...e),we(this.prefix,...e),this.enabled&&console.log(this.prefix,...e)}}const ye={},ge=(e,t)=>{const r=new fe(e,!!t);return ye[e]=r,r},me=e=>{Object.keys(ye).forEach((t=>{ye[t].enabled=!!e}))},ve=()=>{let e=[];return Object.keys(ye).forEach((t=>{e=e.concat(ye[t].messages)})),e.sort(((e,t)=>e.timestamp-t.timestamp)),e},be=e=>{he=e},_e=()=>{const e=new WeakSet;return(t,r)=>{if("object"==typeof r&&null!==r){if(e.has(r))return;e.add(r)}return r}},we=(e,...t)=>{null==he||he(pe(ce.OUTPUT,((...e)=>e.map((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e?e:"object"==typeof e?JSON.stringify(e,_e()):e)))(e,...t)))};var Ee;t.d0=void 0,(Ee=t.d0||(t.d0={})).Core="Core",Ee.Transport="Transport",Ee.Device="Device",Ee.DeviceCommands="DeviceCommands",Ee.DeviceConnector="DeviceConnector",Ee.DeviceList="DeviceList",Ee.DevicePool="DevicePool",Ee.HdCommonConnectSdk="@onekey/common-connect-sdk",Ee.HdBleSdk="@onekey/hd-ble-sdk",Ee.HdTransportHttp="@onekey/hd-transport-http",Ee.HdBleTransport="@onekey/hd-ble-transport",Ee.Connect="@onekey/connect",Ee.Iframe="IFrame",Ee.SendMessage="[SendMessage]",Ee.Method="[Method]";const Te={[t.d0.Core]:ge(t.d0.Core),[t.d0.Transport]:ge(t.d0.Transport),[t.d0.Device]:ge(t.d0.Device),[t.d0.DeviceCommands]:ge(t.d0.DeviceCommands),[t.d0.DeviceConnector]:ge(t.d0.DeviceConnector),[t.d0.DeviceList]:ge(t.d0.DeviceList),[t.d0.DevicePool]:ge(t.d0.DevicePool),[t.d0.HdBleSdk]:ge(t.d0.HdBleSdk),[t.d0.HdTransportHttp]:ge(t.d0.HdTransportHttp),[t.d0.HdBleTransport]:ge(t.d0.HdBleTransport),[t.d0.Connect]:ge(t.d0.Connect),[t.d0.Iframe]:ge(t.d0.Iframe),[t.d0.SendMessage]:ge(t.d0.SendMessage),[t.d0.Method]:ge(t.d0.Method),[t.d0.HdCommonConnectSdk]:ge(t.d0.Method)},Se=e=>Te[e],Re=e=>new Promise((t=>{setTimeout(t,e)})),Oe=(e,t)=>{const r=e.filter((e=>f.default.gt(e.version.join("."),t)));return 0===r.length?"valid":r.some((e=>e.required))?"required":"outdated"},Ie=(e,t)=>e.filter((e=>f.default.gt(e.version.join("."),t))).map((e=>e.changelog)),xe=e=>{let t=e[0];return e.forEach((e=>{f.default.gt(e.version.join("."),t.version.join("."))&&(t=e)})),t};var Ae;class Ce{static load(e){return v(this,void 0,void 0,(function*(){this.settings=e;try{const{data:e}=yield y.default.get(`https://data.onekey.so/config.json?noCache=${ie()}`);this.deviceMap={classic:e.classic,mini:e.mini,touch:e.touch,pro:e.pro},this.assets={bridge:e.bridge}}catch(e){}}))}static getProtobufMessages(){return this.messages.default}static getSettings(e){return this.settings?"string"==typeof e?this.settings[e]:this.settings:null}}Ae=Ce,Ce.deviceMap={classic:{firmware:[],ble:[]},mini:{firmware:[],ble:[]},touch:{firmware:[],ble:[]},pro:{firmware:[],ble:[]}},Ce.assets=null,Ce.messages={default:te},Ce.getFirmwareStatus=e=>{var t,r;const i=V(e),n=Z(e);if(!1===e.firmware_present)return"none";if("classic"===i&&e.bootloader_mode)return"unknown";const s=null!==(r=null===(t=Ae.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],o=n.join(".");return Oe(s,o)},Ce.getSysResourcesLatestRelease=(e,t)=>{var r,i,n;const s=V(e),o=Z(e);if("pro"!==s&&"touch"!==s)return;const a=null!==(i=null===(r=Ae.deviceMap[s])||void 0===r?void 0:r.firmware)&&void 0!==i?i:[],d=o.join("."),u=a.filter((e=>(t||f.default.gt(e.version.join("."),d))&&!!e.resource));return null===(n=xe(u))||void 0===n?void 0:n.resource},Ce.getSysFullResource=e=>{var t,r,i;const n=V(e);if("pro"!==n&&"touch"!==n)return;const s=(null!==(r=null===(t=Ae.deviceMap[n])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[]).filter((e=>!!e.fullResource));return null===(i=xe(s))||void 0===i?void 0:i.fullResource},Ce.getFirmwareChangelog=e=>{var t,r;const i=V(e),n=Z(e);if(!1===e.firmware_present||"classic"===i&&e.bootloader_mode)return[];const s=null!==(r=null===(t=Ae.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],o=n.join(".");return Ie(s,o)},Ce.getFirmwareLatestRelease=e=>{var t,r;const i=V(e),n=null!==(r=null===(t=Ae.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],s=xe(n);if(!s)return s;if(!s.resource){const t=Ae.getSysResourcesLatestRelease(e);return Object.assign(Object.assign({},s),{resource:t})}return s},Ce.getBLEFirmwareStatus=e=>{var t,r;const i=V(e),n=J(e);if(!n)return"none";const s=null!==(r=null===(t=Ae.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[],o=n.join(".");return Oe(s,o)},Ce.getBleFirmwareChangelog=e=>{var t,r;const i=V(e),n=J(e);if(!n)return[];const s=null!==(r=null===(t=Ae.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[],o=n.join(".");return Ie(s,o)},Ce.getBleFirmwareLatestRelease=e=>{var t,r;const i=V(e),n=null!==(r=null===(t=Ae.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[];return xe(n)},Ce.getTransportStatus=e=>{var t,r;const i=null===(r=null===(t=Ae.assets)||void 0===t?void 0:t.bridge)||void 0===r?void 0:r.version;if(!i)return"valid";return f.default.gte(e,i.join("."))?"valid":"outdated"};const ke="CORE_EVENT",Me="UI_EVENT",Ne={REQUEST_PIN:"ui-request_pin",INVALID_PIN:"ui-invalid_pin",REQUEST_BUTTON:"ui-button",REQUEST_PASSPHRASE:"ui-request_passphrase",REQUEST_PASSPHRASE_ON_DEVICE:"ui-request_passphrase_on_device",CLOSE_UI_WINDOW:"ui-close_window",BLUETOOTH_PERMISSION:"ui-bluetooth_permission",LOCATION_PERMISSION:"ui-location_permission",LOCATION_SERVICE_PERMISSION:"ui-location_service_permission",FIRMWARE_PROGRESS:"ui-firmware-progress",FIRMWARE_TIP:"ui-firmware-tip",NOT_IN_BOOTLOADER:"ui-device_not_in_bootloader_mode"},Pe=(e,t)=>({event:Me,type:e,payload:t}),De={INIT:"iframe-init",INIT_BRIDGE:"iframe-init-bridge",CALL:"iframe-call",CANCEL:"iframe-cancel"},Be="RESPONSE_EVENT",Le=(e,t,r)=>({event:Be,type:Be,id:e,success:t,payload:t?r:n.serializeError(r)}),qe={RECEIVE_PIN:"ui-receive_pin",RECEIVE_PASSPHRASE:"ui-receive_passphrase"},je="DEVICE_EVENT",Fe={CONNECT:"device-connect",CONNECT_UNACQUIRED:"device-connect_unacquired",DISCONNECT:"device-disconnect",CHANGED:"device-changed",ACQUIRE:"device-acquire",RELEASE:"device-release",ACQUIRED:"device-acquired",RELEASED:"device-released",USED_ELSEWHERE:"device-used_elsewhere",UNREADABLE:"unreadable-device",LOADING:"device-loading",BUTTON:"button",PIN:"pin",PASSPHRASE:"passphrase",PASSPHRASE_ON_DEVICE:"passphrase_on_device",WORD:"word",SUPPORT_FEATURES:"support_features",FEATURES:"features"},Ue=(e,t)=>({event:je,type:e,payload:t}),ze="FIRMWARE_EVENT",He={RELEASE_INFO:"firmware-release-info",BLE_RELEASE_INFO:"ble-firmware-release-info"},$e=(e,t)=>({event:ze,type:e,payload:t}),Ge=Se(t.d0.DevicePool);class We extends E.exports{static setConnector(e){this.connector=e}static getDevices(e,t,r){var i,n,s,o;return v(this,void 0,void 0,(function*(){Ge.debug("get device list: connectId: ",t);const a={},d=[];if(t){const i=this.devicesCache[t];if(i){const n=e.find((e=>e.path===i.originalDescriptor.path));if(n)return Ge.debug("find existed Device: ",t),i.updateDescriptor(n,!0),a[t]=i,d.push(i),yield this._checkDevicePool(r),{devices:a,deviceList:d};Ge.debug("found device in cache, but path is different: ",t)}}try{for(i=_(e);!(n=yield i.next()).done;){const e=n.value,t=yield this._createDevice(e,r);if(t.features){const r=Y(t.features);if(this.devicesCache[r]){this.devicesCache[r].updateDescriptor(e,!0)}this.devicesCache[r]=t,a[r]=t}d.push(t)}}catch(e){s={error:e}}finally{try{n&&!n.done&&(o=i.return)&&(yield o.call(i))}finally{if(s)throw s.error}}return console.log("device poll -> connected: ",this.connectedPool),console.log("device poll -> disconnected: ",this.disconnectPool),yield this._checkDevicePool(r),{devices:a,deviceList:d}}))}static clearDeviceCache(e){Ge.debug("clear device pool cache: connectId",e),Ge.debug("clear device pool cache: ",this.devicesCache),e&&delete this.devicesCache[e]}static _createDevice(e,t){return v(this,void 0,void 0,(function*(){let r=this.getDeviceByPath(e.path);return r||(r=pt.fromDescriptor(e),r.deviceConnector=this.connector,yield r.connect(),yield r.initialize(t),yield r.release()),r}))}static _checkDevicePool(e){return v(this,void 0,void 0,(function*(){yield this._sendConnectMessage(e),this._sendDisconnectMessage()}))}static _sendConnectMessage(e){return v(this,void 0,void 0,(function*(){for(let t=this.connectedPool.length-1;t>=0;t--){const r=this.connectedPool[t],i=yield this._createDevice(r,e);Ge.debug("emit DEVICE.CONNECT: ",i),this.emitter.emit(Fe.CONNECT,i),this.connectedPool.splice(t,1)}}))}static _sendDisconnectMessage(){for(let e=this.disconnectPool.length-1;e>=0;e--){const t=this.connectedPool[e],r=(null==t?void 0:t.path)?this.getDeviceByPath(t.path):null;r&&this.emitter.emit(Fe.DISCONNECT,r),this.disconnectPool.splice(e,1)}}static reportDeviceChange(e){const t=((e,t)=>{const r=t.filter((t=>void 0===e.find((e=>e.path===t.path)))),i=e.filter((e=>void 0===t.find((t=>t.path===e.path)))),n=t.filter((t=>{const r=e.find((e=>e.path===t.path));return!!r&&r.session!==t.session})),s=n.filter((e=>"string"==typeof e.session)),o=n.filter((e=>"string"!=typeof e.session)),a=t.filter((t=>{const r=e.find((e=>e.path===t.path));return!!r&&r.debugSession!==t.debugSession})),d=n.filter((e=>"string"==typeof e.debugSession)),u=n.filter((e=>"string"!=typeof e.debugSession));return{connected:r,disconnected:i,changedSessions:n,acquired:s,released:o,changedDebugSessions:a,debugAcquired:d,debugReleased:u,didUpdate:r.length+i.length+n.length+a.length>0,descriptors:t}})(this.current||[],e);this.upcoming=e,this.current=this.upcoming,console.log("device pool -> current: ",this.current),console.log("device pool -> upcomming: ",this.upcoming),console.log("DeviceCache.reportDeviceChange diff: ",t),t.didUpdate&&(t.connected.forEach((e=>{const t=this.getDeviceByPath(e.path);t?(Ge.debug("emit DEVICE.CONNECT: ",t),this.emitter.emit(Fe.CONNECT,t)):this._addConnectedDeviceToPool(e)})),t.disconnected.forEach((e=>{this._removeDeviceFromConnectedPool(e.path);const t=this.getDeviceByPath(e.path);t?(Ge.debug("emit DEVICE.DISCONNECT: ",t),this.emitter.emit(Fe.DISCONNECT,t)):this._addDisconnectedDeviceToPool(e)})))}static getDeviceByPath(e){return Object.values(this.devicesCache).find((t=>t.originalDescriptor.path===e))}static _addConnectedDeviceToPool(e){const t=this.connectedPool.findIndex((t=>t.path===e.path));t>-1?this.connectedPool.splice(t,1,e):this.connectedPool.push(e)}static _removeDeviceFromConnectedPool(e){const t=this.connectedPool.findIndex((t=>t.path===e));t>-1&&this.connectedPool.splice(t,1)}static _addDisconnectedDeviceToPool(e){const t=this.disconnectPool.findIndex((t=>t.path===e.path));t>-1?this.disconnectPool.splice(t,1,e):this.disconnectPool.push(e)}}We.current=null,We.upcoming=[],We.connectedPool=[],We.disconnectPool=[],We.devicesCache={},We.emitter=new E.exports;const Ve=Se(t.d0.Transport),Ke=Se(t.d0.HdBleTransport),Ye=Se(t.d0.HdTransportHttp);class Xe{static load(){Ve.debug("transport manager load"),this.defaultMessages=Ce.getProtobufMessages(),this.currentMessages=this.defaultMessages}static configure(){return v(this,void 0,void 0,(function*(){try{const e=Ce.getSettings("env");Ve.debug("Initializing transports"),"react-native"===e?this.reactNativeInit?Ve.debug("React Native Do Not Initializing transports"):(yield this.transport.init(Ke,We.emitter),this.reactNativeInit=!0):yield this.transport.init(Ye),Ve.debug("Configuring transports"),yield this.transport.configure(JSON.stringify(this.defaultMessages)),Ve.debug("Configuring transports done")}catch(e){if(Ve.debug("Initializing transports error: ",e),"ECONNABORTED"===e.code)throw n.ERRORS.TypedError(n.HardwareErrorCode.BridgeTimeoutError)}}))}static reconfigure(e){return v(this,void 0,void 0,(function*(){if(Array.isArray(e)&&(e=Ce.getProtobufMessages()),this.currentMessages!==e&&e)try{yield this.transport.configure(JSON.stringify(e)),this.currentMessages=e}catch(e){throw n.ERRORS.TypedError(n.HardwareErrorCode.TransportInvalidProtobuf,`Transport_InvalidProtobuf: ${e.message}`)}}))}static setTransport(e){const t=Ce.getSettings("env");this.transport="react-native"===t?new e({scanTimeout:3e3}):new e,Ve.debug("set transport: ",this.transport)}static getTransport(){return this.transport}static getDefaultMessages(){return this.defaultMessages}static getCurrentMessages(){return this.currentMessages}}Xe.reactNativeInit=!1;const Ze=Se(t.d0.DeviceCommands);class Je{constructor(e,t){this.device=e,this.mainId=t,this.transport=Xe.getTransport(),this.disposed=!1}dispose(e){var t,r;return v(this,void 0,void 0,(function*(){this.disposed=!0,e&&this._cancelableRequest&&this._cancelableRequest(),this._cancelableRequest=void 0,yield null===(r=(t=this.transport).cancel)||void 0===r?void 0:r.call(t)}))}call(e,t={}){var r,i;return v(this,void 0,void 0,(function*(){Ze.debug("[DeviceCommands] [call] Sending",e);try{const r=this.transport.call(this.mainId,e,t);this.callPromise=r;const i=yield r;return Ze.debug("[DeviceCommands] [call] Received",i.type),i}catch(e){if(Ze.debug("[DeviceCommands] [call] Received error",e),"device disconnected during action"===(null===(i=null===(r=null==e?void 0:e.response)||void 0===r?void 0:r.data)||void 0===i?void 0:i.error))return{type:"BridgeNetworkError",message:{}};throw e}}))}typedCall(e,t,r){return v(this,void 0,void 0,(function*(){if(this.disposed)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"typedCall: DeviceCommands already disposed");const i=yield this._commonCall(e,r);try{((e,t)=>{if(!(Array.isArray(t)?t:t.split("|")).includes(e.type))throw n.ERRORS.TypedError(n.HardwareErrorCode.ResponseUnexpectTypeError,`assertType: Response of unexpected type: ${e.type}. Should be ${t}`)})(i,t)}catch(e){if(Ze.debug("DeviceCommands typedcall error: ",e),!(e instanceof n.HardwareError))throw e;if(e.errorCode===n.HardwareErrorCode.ResponseUnexpectTypeError&&e.message.indexOf("BridgeNetworkError")>-1)throw n.ERRORS.TypedError(n.HardwareErrorCode.BridgeNetworkError)}return i}))}_commonCall(e,t){return v(this,void 0,void 0,(function*(){const r=yield this.call(e,t);return this._filterCommonTypes(r,e)}))}_filterCommonTypes(e,t){try{"react-native"===Ce.getSettings("env")?Ze.debug("_filterCommonTypes: ",JSON.stringify(e)):Ze.debug("_filterCommonTypes: ",e)}catch(e){}if("Failure"===e.type){const{code:r,message:i}=e.message;let s=null;return"Failure_FirmwareError"!==r||i||(s=n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareError)),"Failure_ActionCancelled"===r&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.ActionCancelled)),"Failure_PinInvalid"===r&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.PinInvalid,i)),"Failure_PinCancelled"===r&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.PinCancelled)),"Failure_DataError"===r&&"Please confirm the BlindSign enabled"===i&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.BlindSignDisabled)),"Failure_UnexpectedMessage"===r&&"PassphraseAck"===t&&(s=n.ERRORS.TypedError(n.HardwareErrorCode.UnexpectPassphrase)),s?Promise.reject(s):Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`${r||"Failure_UnknownCode"},${i||"Failure_UnknownMessage"}`))}if("Features"===e.type)return Promise.resolve(ue(e));if("ButtonRequest"===e.type)return"ButtonRequest_PassphraseEntry"===e.message.code?this.device.emit(Fe.PASSPHRASE_ON_DEVICE,this.device):this.device.emit(Fe.BUTTON,this.device,e.message),this._commonCall("ButtonAck",{});e.type;const r="webusb"===Ce.getSettings("env");return"PinMatrixRequest"===e.type?r?Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Please unlock your device")):this._promptPin(e.message.type).then((e=>"@@ONEKEY_INPUT_PIN_IN_DEVICE"===e?this._commonCall("BixinPinInputOnDevice"):this._commonCall("PinMatrixAck",{pin:e})),(()=>this._commonCall("Cancel",{}))):"PassphraseRequest"===e.type?this._promptPassphrase().then((e=>{const{passphrase:t,passphraseOnDevice:r}=e;return r?this._commonCall("PassphraseAck",{on_device:!0}):this._commonCall("PassphraseAck",{passphrase:t})})):(e.type,e.type,Promise.resolve(e))}_promptPin(e){return new Promise(((t,r)=>{this.device.listenerCount(Fe.PIN)>0?(this._cancelableRequest=r,this.device.emit(Fe.PIN,this.device,e,((e,i)=>{this._cancelableRequest=void 0,e?r(e):t(i)}))):(console.warn("[DeviceCommands] [call] PIN callback not configured, cancelling request"),r(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"_promptPin: PIN callback not configured")))}))}_promptPassphrase(){return new Promise(((e,t)=>{this.device.listenerCount(Fe.PASSPHRASE)>0?(this._cancelableRequest=t,this.device.emit(Fe.PASSPHRASE,this.device,((r,i)=>{this._cancelableRequest=void 0,i?t(i):e(r)}))):(Ze.error("[DeviceCommands] [call] Passphrase callback not configured, cancelling request"),t(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"_promptPassphrase: Passphrase callback not configured")))}))}}const Qe="ui-device_bootloader_mode",et="ui-device_not_in_bootloader_mode",tt="ui-device_not_initialized",rt="ui-device_seedless",it="ui-firmware-tip",nt=r(2391),st=()=>nt.version,ot=`https://jssdk.onekey.so/${st()}/`,at={configSrc:"./data/config.json",version:"",debug:!1,priority:2,trustedHost:!1,connectSrc:ot,iframeSrc:`${ot}iframe.html`,parentOrigin:"undefined"!=typeof window&&window.location?window.location.origin:"",supportedBrowser:"undefined"==typeof navigator||!/Trident|MSIE|Edge/.test(navigator.userAgent),env:"web",lazyLoad:!1,timestamp:(new Date).getTime()},dt=()=>{if("undefined"!=typeof chrome&&chrome.runtime&&void 0!==chrome.runtime.onConnect)return"webextension";if("undefined"!=typeof navigator){if("string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase())return"react-native";if(navigator.userAgent.toLowerCase().indexOf(" electron/")>-1)return"electron"}return"web"},ut=e=>{if("string"==typeof e)return e.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*onekey\.so\//)||e.match(/^https?:\/\/localhost:[58][0-9]{3}\//),e},lt=Se(t.d0.Device),ct={};class pt extends E.exports{constructor(e){super(),this.deviceConnector=null,this.features=void 0,this.featuresNeedsReload=!1,this.externalState=[],this.unavailableCapabilities={},this.instance=0,this.internalState=[],this.needReloadDevice=!1,this.keepSession=!1,this.passphraseState=void 0,this.originalDescriptor=e}static fromDescriptor(e){const t=Object.assign({},e);return new pt(t)}toMessageObject(){if(this.isUnacquired()||!this.features)return null;return{connectId:"react-native"===Ce.getSettings("env")?this.mainId||null:Y(this.features),uuid:Y(this.features),deviceType:this.features.bootloader_mode?(e=this.features,V(e)):V(this.features),deviceId:this.features.device_id||null,path:this.originalDescriptor.path,name:this.features.ble_name||this.features.label||`OneKey ${V(this.features).toUpperCase()}`,label:X(this.features),mode:this.getMode(),features:this.features,firmwareVersion:this.getFirmwareVersion(),bleFirmwareVersion:this.getBLEFirmwareVersion(),unavailableCapabilities:this.unavailableCapabilities};var e}connect(){const e=Ce.getSettings("env");return new Promise((t=>v(this,void 0,void 0,(function*(){if("react-native"!==e)if(!this.mainId||!this.isUsedHere()&&this.originalDescriptor)try{yield this.acquire(),t(!0)}catch(e){t(e)}else this.isUsedHere()?t(!0):t(!1);else try{yield this.acquire(),t(!0)}catch(e){t(e)}}))))}acquire(){var e,t,r,i;return v(this,void 0,void 0,(function*(){const n=Ce.getSettings("env"),s="react-native"===n?"id":"session";try{if("react-native"===n){const r=yield null===(e=this.deviceConnector)||void 0===e?void 0:e.acquire(this.originalDescriptor.id);this.mainId=null!==(t=r.uuid)&&void 0!==t?t:"",lt.debug("Expected uuid:",this.mainId)}else this.mainId=yield null===(r=this.deviceConnector)||void 0===r?void 0:r.acquire(this.originalDescriptor.path,this.originalDescriptor.session),lt.debug("Expected session id:",this.mainId);this.updateDescriptor({[s]:this.mainId}),this.commands&&(yield this.commands.dispose(!1)),this.commands=new Je(this,null!==(i=this.mainId)&&void 0!==i?i:"")}catch(e){if(!this.runPromise)throw e;this.runPromise.reject(e),this.runPromise=null}}))}release(){var e;return v(this,void 0,void 0,(function*(){const t=Ce.getSettings("env");if(this.isUsedHere()&&!this.keepSession&&this.mainId||this.mainId&&"react-native"===t){if(this.commands&&(this.commands.dispose(!1),this.commands.callPromise))try{yield this.commands.callPromise}catch(e){this.commands.callPromise=void 0}try{yield null===(e=this.deviceConnector)||void 0===e?void 0:e.release(this.mainId,!1),this.updateDescriptor({session:null})}catch(e){lt.error("[Device] release error: ",e)}finally{this.needReloadDevice=!0}}}))}getCommands(){return this.commands}generateStateKey(e,t){return t?`${e}@${t}`:e}getInternalState(e){var t,r;lt.debug("getInternalState session param: ",`device_id: ${e}`,`features.device_id: ${null===(t=this.features)||void 0===t?void 0:t.device_id}`,`passphraseState: ${this.passphraseState}`),lt.debug("getInternalState session cache: ",ct);const i=e||(null===(r=this.features)||void 0===r?void 0:r.device_id);if(!i)return;if(!this.passphraseState)return;const n=this.generateStateKey(i,this.passphraseState);return ct[n]}tryFixInternalState(e,t){lt.debug("tryFixInternalState session param: ",`device_id: ${t}`,`passphraseState: ${e}`);const r=`${t}`,i=ct[r];i&&(ct[this.generateStateKey(t,e)]=i,delete ct[r]),lt.debug("tryFixInternalState session cache: ",ct)}setInternalState(e,t){var r,i;if(lt.debug("setInternalState session param: ",`state: ${e}`,`initSession: ${t}`,`device_id: ${null===(r=this.features)||void 0===r?void 0:r.device_id}`,`passphraseState: ${this.passphraseState}`),!this.features)return;if(!this.passphraseState&&!t)return;const n=null===(i=this.features)||void 0===i?void 0:i.device_id;if(!n)return;const s=this.generateStateKey(n,this.passphraseState);e&&(ct[s]=e),lt.debug("setInternalState done session cache: ",ct)}clearInternalState(e){var t;lt.debug("clearInternalState param: ",e);const r=e||(null===(t=this.features)||void 0===t?void 0:t.device_id);if(!r)return;if(delete ct[`${r}`],this.passphraseState){const e=this.generateStateKey(r,this.passphraseState);delete ct[e]}}initialize(e){return v(this,void 0,void 0,(function*(){lt.debug("initialize param:",e),this.passphraseState=null==e?void 0:e.passphraseState,(null==e?void 0:e.initSession)&&this.clearInternalState(null==e?void 0:e.deviceId);const t=this.getInternalState(null==e?void 0:e.deviceId),r={};t&&(r.session_id=t),lt.debug("initialize payload:",r);const{message:i}=yield this.commands.typedCall("Initialize","Features",r);this._updateFeatures(i,null==e?void 0:e.initSession)}))}getFeatures(){return v(this,void 0,void 0,(function*(){const{message:e}=yield this.commands.typedCall("GetFeatures","Features",{});this._updateFeatures(e)}))}_updateFeatures(e,t){this.features&&this.features.session_id&&!e.session_id&&(e.session_id=this.features.session_id),this.features&&this.features.device_id&&e.session_id&&this.setInternalState(e.session_id,t),e.unlocked=e.unlocked||!0,this.features=e,this.featuresNeedsReload=!1,this.emit(Fe.FEATURES,this,e)}updateDescriptor(e,t=!1){if("react-native"===Ce.getSettings("env"))return;const r=this.originalDescriptor.session,i=e.session;r!==i&&(this.originalDescriptor.session=i),t&&(this.originalDescriptor=e)}updateFromCache(e){this.mainId=e.mainId,this.commands=e.commands,this.updateDescriptor(e.originalDescriptor,!0),e.features&&this._updateFeatures(e.features)}run(e,t){return v(this,void 0,void 0,(function*(){return this.runPromise&&(yield this.interruptionFromOutside(),lt.debug("[Device] run error:","Device is running, but will cancel previous operate")),t=(e=>(e||(e={}),e))(t),this.runPromise=n.createDeferred(this._runInner.bind(this,e,t)),this.runPromise.promise}))}_runInner(e,t){return v(this,void 0,void 0,(function*(){if(!this.isUsedHere()||this.commands.disposed){if("react-native"!==Ce.getSettings("env")){yield this.acquire();try{e&&(yield this.initialize(t))}catch(e){return this.runPromise=null,e instanceof n.HardwareError?Promise.reject(e):Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceInitializeFailed,`Initialize failed: ${e.message}, code: ${e.code}`))}}}if(t.keepSession&&(this.keepSession=!0),e)try{yield e()}catch(e){return this.runPromise&&this.runPromise.reject(e),void(this.runPromise=null)}(!this.keepSession&&"boolean"!=typeof t.keepSession||!1===t.keepSession)&&(this.keepSession=!1,yield this.release(),lt.debug("release device, mainId: ",this.mainId)),this.runPromise&&this.runPromise.resolve(),this.runPromise=null}))}interruptionFromOutside(){return v(this,void 0,void 0,(function*(){this.commands&&(yield this.commands.dispose(!1)),this.runPromise&&this.runPromise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceInterruptedFromOutside))}))}interruptionFromUser(){return v(this,void 0,void 0,(function*(){this.commands&&(yield this.commands.dispose(!0)),this.runPromise&&this.runPromise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceInterruptedFromUser))}))}getMode(){var e,t,r;return(null===(e=this.features)||void 0===e?void 0:e.bootloader_mode)?"bootloader":(null===(t=this.features)||void 0===t?void 0:t.initialized)?(null===(r=this.features)||void 0===r?void 0:r.no_backup)?"seedless":"normal":"initialize"}getFirmwareVersion(){return this.features?Z(this.features):null}getBLEFirmwareVersion(){return this.features?J(this.features):null}isUsed(){return"string"==typeof this.originalDescriptor.session}isUsedHere(){return"react-native"!==Ce.getSettings("env")&&(this.isUsed()&&this.originalDescriptor.session===this.mainId)}isUsedElsewhere(){return this.isUsed()&&!this.isUsedHere()}isBootloader(){return this.features&&!!this.features.bootloader_mode}isInitialized(){return this.features&&!!this.features.initialized}isSeedless(){return this.features&&!!this.features.no_backup}isUnacquired(){return void 0===this.features}hasUnexpectedMode(e,t){if(this.features){if(this.isBootloader()&&!e.includes(Qe))return Qe;if(!this.isInitialized()&&!e.includes(tt))return tt;if(this.isSeedless()&&!e.includes(rt))return rt;if(!this.isBootloader()&&t.includes(Qe))return et}return null}hasUsePassphrase(){var e;const t=("touch"===V(this.features)||"pro"===V(this.features))&&!0===(null===(e=this.features)||void 0===e?void 0:e.unlocked);return this.features&&(!!this.features.passphrase_protection||t)}checkDeviceId(e){return!!this.features&&this.features.device_id===e}checkPassphraseState(){var e;return v(this,void 0,void 0,(function*(){if(!this.features)return!1;const t=!0===(null===(e=this.features)||void 0===e?void 0:e.unlocked),r="touch"===V(this.features)||"pro"===V(this.features),i=yield ee(this.features,this.commands);return r&&t&&(yield this.getFeatures()),this.passphraseState&&this.passphraseState!==i?(this.clearInternalState(),i):void 0}))}}class ht extends E.exports{constructor(){super(...arguments),this.devices={}}getDeviceLists(e,t){var r,i;return v(this,void 0,void 0,(function*(){const n=yield null===(r=this.connector)||void 0===r?void 0:r.enumerate(),s=null!==(i=null==n?void 0:n.descriptors)&&void 0!==i?i:[];this.devices={};const{deviceList:o,devices:a}=yield We.getDevices(s,e,t);return this.devices=a,o}))}allDevices(){return Object.keys(this.devices).map((e=>this.devices[e]))}getDevice(e){return this.devices[e]}}const ft=e=>({status:Ce.getFirmwareStatus(e),changelog:Ce.getFirmwareChangelog(e),release:Ce.getFirmwareLatestRelease(e)}),yt=e=>({status:Ce.getBLEFirmwareStatus(e),changelog:Ce.getBleFirmwareChangelog(e),release:Ce.getBleFirmwareLatestRelease(e)}),gt=Se(t.d0.Method);class mt{constructor(e){this.shouldEnsureConnected=!0,this.checkDeviceId=!1,this.useDevicePassphraseState=!0;const{payload:t}=e;this.name=t.method,this.payload=t,this.responseID=e.id||0,this.connectId=t.connectId||"",this.deviceId=t.deviceId||"",this.useDevice=!0,this.allowDeviceMode=[tt],this.requireDeviceMode=[]}getVersionRange(){return{}}setDevice(e){this.device=e,this.connectId=e.originalDescriptor.path}checkFirmwareRelease(){if(!this.device||!this.device.features)return;const e=ft(this.device.features);this.postMessage($e(He.RELEASE_INFO,Object.assign(Object.assign({},e),{features:this.device.features})));const t=yt(this.device.features);this.postMessage($e(He.BLE_RELEASE_INFO,Object.assign(Object.assign({},t),{features:this.device.features})))}checkDeviceSupportFeature(){if(!this.device||!this.device.features)return;const e=Q(this.device.features);this.postMessage(Ue(Fe.SUPPORT_FEATURES,{inputPinOnSoftware:e,device:this.device.toMessageObject()}))}checkSafetyLevelOnTestNet(){var e,t,r;return v(this,void 0,void 0,(function*(){if("touch"!==V(this.device.features))return;let i=!1;"evmSignTransaction"===this.name&&[3,4,5,42].includes(Number(null===(t=null===(e=this.payload)||void 0===e?void 0:e.transaction)||void 0===t?void 0:t.chainId))&&(i=!0),i&&"Strict"===(null===(r=this.device.features)||void 0===r?void 0:r.safety_checks)&&(gt.debug("will change safety_checks level"),yield this.device.commands.typedCall("ApplySettings","Success",{safety_checks:"PromptTemporarily"}))}))}dispose(){}}const vt=e=>"0x"===e.slice(0,2).toLowerCase(),bt=e=>vt(e)?e.slice(2):e,_t=e=>{for(;/^00/.test(e);)e=e.slice(2);return e},wt=e=>{if("string"==typeof e){let t=bt(e);return t.length%2!=0&&(t=`0${t}`),t}return Array.isArray(e)?e.map(wt):"object"==typeof e?(t=e,r=e=>wt(e),Object.fromEntries(Object.entries(t).map((([e,t])=>[e,r(t,e)])))):e;var t,r},Et=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function Tt(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=Et[e[r]];return t}function St(e){if("string"!=typeof e)throw new TypeError("hexToBytes: expected string, got "+typeof e);if(e.length%2)throw new Error("hexToBytes: received invalid unpadded hex");const t=new Uint8Array(e.length/2);for(let r=0;r<t.length;r++){const i=2*r,n=e.slice(i,i+2),s=Number.parseInt(n,16);if(Number.isNaN(s)||s<0)throw new Error("Invalid byte sequence");t[r]=s}return t}const Rt=e=>n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,e),Ot=(e,t)=>{t.forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t.name)&&t.required)throw Rt(`Missing required parameter: ${t.name}`);const r=e[t.name];if(r&&t.type)switch(t.type){case"array":if(!Array.isArray(r))throw Rt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`);if(!t.allowEmpty&&r.length<1)throw Rt(`Parameter "${t.name}" is empty.`);break;case"bigNumber":if("string"!=typeof r)throw Rt(`Parameter [${t.name}] is of type invalid and should be [string].`);try{if(new g.default(r).toFixed(0)!==r)throw new Error("")}catch(e){throw Rt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`)}break;case"buffer":if(void 0===r||"function"==typeof r.constructor.isBuffer&&r.constructor.isBuffer(r))throw Rt(`Parameter [${t.name}] is of type invalid and should be [buffer].`);break;case"hexString":if("string"!=typeof r||!((e,t)=>!("string"!=typeof e||!e.match(/^(0x|0X)?[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t))((i=r,vt(i)?i:`0x${i}`)))throw Rt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`);break;default:if(typeof r!==t.type)throw Rt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`)}var i}))};const It=({features:e,updateType:t,version:r})=>v(void 0,void 0,void 0,(function*(){const i=At({features:e,updateType:t});if(!i)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"no firmware found for this device");if(r&&!f.default.eq(i.version.join("."),r.join(".")))throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"firmware version mismatch");const s="ble"===t?i.webUpdate:i.url;let o;try{o=yield re(s,"binary")}catch(e){throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Method_FirmwareUpdate_DownloadFailed")}return Object.assign(Object.assign({},i),{binary:o})})),xt=e=>v(void 0,void 0,void 0,(function*(){let t;try{t=yield re(e,"binary")}catch(e){throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Method_FirmwareUpdate_DownloadFailed")}return{binary:t}})),At=({features:e,updateType:t})=>{var r,i;const n=V(e),{deviceMap:s}=Ce,o=null!==(i=null===(r=null==s?void 0:s[n])||void 0===r?void 0:r[t])&&void 0!==i?i:[];return xe(o)};Se(t.d0.Device);const Ct=e=>{var t;(null===(t=e.features)||void 0===t?void 0:t.firmware_present)&&e.emit(Fe.BUTTON,e,{code:"ButtonRequest_FirmwareUpdate"})},kt=(e,t,r)=>{r(Pe(Ne.FIRMWARE_PROGRESS,{device:e.toMessageObject(),progress:t}))},Mt=(e,t,r)=>{r(Pe(Ne.FIRMWARE_TIP,{device:e.toMessageObject(),data:{message:t}}))},Nt=e=>v(void 0,void 0,void 0,(function*(){"ble"===e&&(yield Re(1e4))})),Pt=(e,t,r,i,{payload:s})=>v(void 0,void 0,void 0,(function*(){const o=W(i.features);if("model_mini"===o){Ct(i),Mt(i,"ConfirmOnDevice",r);const n="firmware"===e?"FirmwareErase":"FirmwareErase_ex";yield t(n,"Success",{}),Mt(i,"FirmwareEraseSuccess",r),kt(i,0,r);const{message:o}=yield t("FirmwareUpload","Success",{payload:s});return kt(i,100,r),yield Nt(e),o}if("model_touch"===o){Ct(i),Mt(i,"ConfirmOnDevice",r);const n=s.byteLength;let o=yield t("FirmwareErase",["FirmwareRequest","Success"],{length:n});for(Mt(i,"FirmwareEraseSuccess",r);"Success"!==o.type;){const e=o.message.offset,a=o.message.offset+o.message.length,d=s.slice(e,a);e>0&&kt(i,Math.round(e/n*100),r),o=yield t("FirmwareUpload",["FirmwareRequest","Success"],{payload:d})}return kt(i,100,r),yield Nt(e),o.message}throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"uploadFirmware: unknown major_version")})),Dt=(e,t,r)=>v(void 0,void 0,void 0,(function*(){if("Success"===t.type)return t.message;const{offset:i,data_length:n}=t.message;if(void 0===i)throw new Error("offset is undefined");const s=new Uint8Array(r.slice(i,Math.min(i+n,r.byteLength))),o=d.blake2s(s),a={data_chunk:Tt(s),hash:Tt(o)},u=yield e("ResourceAck",["ResourceRequest","Success"],Object.assign({},a));return Dt(e,u,r)})),Bt=(e,t,r)=>v(void 0,void 0,void 0,(function*(){const i=new Uint8Array(r.slice(0,Math.min(16384,r.byteLength))),n=d.blake2s(i),s=yield e("ResourceUpdate",["ResourceRequest","Success"],{file_name:t,data_length:r.byteLength,initial_data_chunk:Tt(i),hash:Tt(n)});return Dt(e,s,r)})),Lt=(e,t,r,i)=>v(void 0,void 0,void 0,(function*(){Mt(r,"UpdateSysResource",t);const n=yield m.default.loadAsync(i),s=Object.entries(n.files);let o=0;const a=100/s.length;for(const[i,n]of s){const s=i.split("/").pop();if(!n.dir&&-1===i.indexOf("__MACOSX")&&s){const t=yield n.async("arraybuffer");yield Bt(e,s,t)}o+=a,kt(r,Math.floor(o),t)}return kt(r,100,t),Mt(r,"UpdateSysResourceSuccess",t),!0}));const qt=Se(t.d0.Method);const jt=Se(t.d0.Method);var Ft=[{name:"Bitcoin",label:"BTC",slip44:0},{name:"Regtest",label:"REGTEST",slip44:1},{name:"Testnet",label:"TEST",slip44:1},{name:"Actinium",label:"ACM",slip44:228},{name:"Axe",label:"AXE",slip44:4242},{name:"Bcash",label:"BCH",slip44:145},{name:"Bitcore",label:"BTX",slip44:160},{name:"Dash",label:"DASH",slip44:5},{name:"Dash Testnet",label:"tDASH",slip44:1},{name:"Decred",label:"DCR",slip44:42},{name:"Decred Testnet",label:"TDCR",slip44:1},{name:"DigiByte",label:"DGB",slip44:20},{name:"Dogecoin",label:"DOGE",slip44:3},{name:"Feathercoin",label:"FTC",slip44:8},{name:"Firo",label:"FIRO",slip44:136},{name:"Firo Testnet",label:"tFIRO",slip44:1},{name:"Fujicoin",label:"FJC",slip44:75},{name:"GameCredits",label:"GAME",slip44:101},{name:"Komodo",label:"KMD",slip44:141},{name:"Koto",label:"KOTO",slip44:510},{name:"Litecoin",label:"LTC",slip44:2},{name:"Litecoin Testnet",label:"tLTC",slip44:1},{name:"Monacoin",label:"MONA",slip44:22},{name:"MonetaryUnit",label:"MUE",slip44:31},{name:"NIX",label:"NIX",slip44:400},{name:"Namecoin",label:"NMC",slip44:7},{name:"Peercoin",label:"PPC",slip44:6},{name:"Peercoin Testnet",label:"tPPC",slip44:1},{name:"Polis",label:"POLIS",slip44:1997},{name:"Primecoin",label:"XPM",slip44:24},{name:"Ravencoin",label:"RVN",slip44:175},{name:"Ritocoin",label:"RITO",slip44:19169},{name:"Stakenet",label:"XSN",slip44:199},{name:"Syscoin",label:"SYS",slip44:57},{name:"Unobtanium",label:"UNO",slip44:92},{name:"Verge",label:"XVG",slip44:77},{name:"Vertcoin",label:"VTC",slip44:28},{name:"Viacoin",label:"VIA",slip44:14},{name:"ZCore",label:"ZCR",slip44:428},{name:"Zcash",label:"ZEC",slip44:133},{name:"Zcash Testnet",label:"TAZ",slip44:1}];const Ut=(e,t)=>{let r;if(t){const e=t.toLowerCase();r=Ft.find((t=>t.name.toLowerCase()===e||t.label.toLowerCase()===e))}else if(e){const t=j(e[1]);r=Ft.find((e=>e.slip44===t))}if(!r)throw t?n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,`Invalid coin name: ${t}`):e?n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,`Invalid path: ${e[0]}`):n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter);return r},zt=(e,t,r)=>{const i=Ut(e,t).name;let n=r;void 0===n&&(n=(e=>Array.isArray(e)&&e[0]===q(48))(e));let s=H(e);return"SPENDMULTISIG"!==s||n||(s="SPENDADDRESS"),{coinName:i,scriptType:null!=s?s:"SPENDADDRESS"}};const Ht=e=>{const{tx_hash:t}=e.txRequest.details;return t?(({typedCall:e,txRequest:{request_type:t,details:r},refTxs:i})=>{const{tx_hash:s}=r;if(!s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: unknown details.tx_hash");const o=i[s.toLowerCase()];if(!o)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown tx: ${s}`);if("TXINPUT"===t){if(!o.bin_outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXINPUT: ${s}`);return e("TxAckPrevInput","TxRequest",{tx:{input:o.inputs[r.request_index]}})}if("TXOUTPUT"===t){if(!o.bin_outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXOUTPUT: ${s}`);return e("TxAckPrevOutput","TxRequest",{tx:{output:o.bin_outputs[r.request_index]}})}if("TXORIGINPUT"===t){if(!o.outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXORIGINPUT: ${s}`);return e("TxAckInput","TxRequest",{tx:{input:o.inputs[r.request_index]}})}if("TXORIGOUTPUT"===t){if(!o.outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXORIGOUTPUT: ${s}`);return e("TxAckOutput","TxRequest",{tx:{output:o.outputs[r.request_index]}})}if("TXEXTRADATA"===t){if("number"!=typeof r.extra_data_len)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_len");if("number"!=typeof r.extra_data_offset)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_offset");if("string"!=typeof o.extra_data)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: No extra data for transaction ${o.hash}`);const t=o.extra_data,i=r.extra_data_len,s=r.extra_data_offset;return e("TxAckPrevExtraData","TxRequest",{tx:{extra_data_chunk:t.substring(2*s,2*(s+i))}})}if("TXMETA"===t){const t=o.extra_data;return e("TxAckPrevMeta","TxRequest",{tx:{version:o.version,lock_time:o.lock_time,inputs_count:o.inputs.length,outputs_count:o.outputs?o.outputs.length:o.bin_outputs.length,timestamp:o.timestamp,version_group_id:o.version_group_id,expiry:o.expiry,branch_id:o.branch_id,extra_data_len:t?t.length/2:void 0}})}throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Unknown request type: ${t}`)})(e):(({typedCall:e,txRequest:{request_type:t,details:r},inputs:i,outputs:s})=>{if("TXINPUT"===t)return e("TxAckInput","TxRequest",{tx:{input:i[r.request_index]}});if("TXOUTPUT"===t)return e("TxAckOutput","TxRequest",{tx:{output:s[r.request_index]}});if("TXMETA"===t)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXMETA from signed transaction");if("TXEXTRADATA"===t)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction");throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestSignedTxInfo: Unknown request type: ${t}`)})(e)},$t=e=>v(void 0,void 0,void 0,(function*(){const{typedCall:t,txRequest:r,refTxs:i,inputs:s,outputs:o,serializedTx:a,signatures:d}=e;if(((e,t,r)=>{if(!r)return;const{signature_index:i,signature:s,serialized_tx:o}=r;if(o&&e.push(o),"number"==typeof i){if(!s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.");t[i]=s}})(a,d,r.serialized),"TXFINISHED"===r.request_type)return Promise.resolve({signatures:d,serializedTx:a.join("")});const{message:u}=yield Ht(e);return $t({typedCall:t,txRequest:u,refTxs:i,inputs:s,outputs:o,serializedTx:a,signatures:d})}));var Gt=(e,t,r,i,n,s)=>v(void 0,void 0,void 0,(function*(){const o={};i.forEach((e=>{o[e.hash.toLowerCase()]=e}));const{message:a}=yield e("SignTx","TxRequest",Object.assign(Object.assign({},n),{inputs_count:t.length,outputs_count:r.length,coin_name:s}));return $t({typedCall:e,txRequest:a,refTxs:o,inputs:t,outputs:r,serializedTx:[],signatures:[]})}));const Wt=e=>{const{tx_hash:t}=e.txRequest.details;return t?(({txRequest:{request_type:e,details:t},refTxs:r})=>{const{tx_hash:i}=t;if(!i)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: unknown details.tx_hash");const s=r[i.toLowerCase()];if(!s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown tx: ${i}`);if(!s.bin_outputs)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: bin_outputs not set tx: ${i}`);if("TXINPUT"===e)return{inputs:[s.inputs[t.request_index]]};if("TXOUTPUT"===e)return{bin_outputs:[s.bin_outputs[t.request_index]]};if("TXEXTRADATA"===e){if("number"!=typeof t.extra_data_len)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_len");if("number"!=typeof t.extra_data_offset)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_offset");if("string"!=typeof s.extra_data)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: No extra data for transaction ${s.hash}`);const e=s.extra_data,r=t.extra_data_len,i=t.extra_data_offset;return{extra_data:e.substring(2*i,2*(i+r))}}if("TXMETA"===e){const e=s.extra_data,t={version:s.version,lock_time:s.lock_time,inputs_cnt:s.inputs.length,outputs_cnt:s.bin_outputs.length,timestamp:s.timestamp,version_group_id:s.version_group_id,expiry:s.expiry,branch_id:s.branch_id};return"string"==typeof e&&0!==e.length?Object.assign(Object.assign({},t),{extra_data_len:e.length/2}):t}throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Unknown request type: ${e}`)})(e):(({txRequest:{request_type:e,details:t},inputs:r,outputs:i})=>{if("TXINPUT"===e)return{inputs:[r[t.request_index]]};if("TXOUTPUT"===e)return{outputs:[i[t.request_index]]};if("TXMETA"===e)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXMETA from signed transaction");if("TXEXTRADATA"===e)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction");throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`requestSignedTxInfo: Unknown request type: ${e}`)})(e)},Vt=e=>v(void 0,void 0,void 0,(function*(){const{typedCall:t,txRequest:r,refTxs:i,inputs:s,outputs:o,serializedTx:a,signatures:d}=e;if(((e,t,r)=>{if(!r)return;const{signature_index:i,signature:s,serialized_tx:o}=r;if(o&&e.push(o),"number"==typeof i){if(!s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.");t[i]=s}})(a,d,r.serialized),"TXFINISHED"===r.request_type)return Promise.resolve({signatures:d,serializedTx:a.join("")});const u=Wt(e),{message:l}=yield t("TxAck","TxRequest",{tx:u});return Vt({typedCall:t,txRequest:l,refTxs:i,inputs:s,outputs:o,serializedTx:a,signatures:d})}));var Kt=(e,t,r,i,n,s)=>v(void 0,void 0,void 0,(function*(){const o={};i.forEach((e=>{o[e.hash.toLowerCase()]=e}));const{message:a}=yield e("SignTx","TxRequest",Object.assign(Object.assign({},n),{inputs_count:t.length,outputs_count:r.length,coin_name:s}));return Vt({typedCall:e,txRequest:a,refTxs:o,inputs:t,outputs:r,serializedTx:[],signatures:[]})}));const Yt=(e,t)=>{if(!e)return["",""];return[e.slice(0,t),e.slice(t)]};const Xt=(e,t,r)=>{let i=new g.default(e);if(r&&(i=((e,t)=>{if(t<1||t>32)throw n.ERRORS.TypedError("Runtime","Int byte size must be between 1 and 32 (8 and 256 bits)");const r=new g.default(2).exponentiatedBy(8*t-1).negated(),i=r.negated().minus(1),s=new g.default(e);if(s.isGreaterThan(i)||s.isLessThan(r))throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`Overflow when trying to convert number ${e.toString()} into ${t} bytes`);return s.isPositive()?s:s.minus(r).minus(r)})(i,t)),i.isNegative())throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`Cannot convert negative number to unsigned interger: ${e.toString()}`);const s=i.toString(16),o=2*t;if(s.length>o)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`Overflow when trying to convert number ${e.toString()} into ${t} bytes`);return s.padStart(2*t,"0")},Zt=new RegExp(/^(.*)\[([0-9]*)\]$/),Jt=new RegExp(/^bytes([0-9]*)$/),Qt=new RegExp(/^(u?int)([0-9]*)$/),er=e=>{const t=Zt.exec(e);if(null===t)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`typename ${e} could not be parsed as an EIP-712 array`);const[r,i,s]=t;return{entryTypeName:i,arraySize:parseInt(s,10)||null}},tr=(e,t)=>{if(Jt.test(e)||"address"===e)return wt(t);if("string"===e)return Buffer.from(t,"utf-8").toString("hex");const r=Qt.exec(e);if(r){const[e,i,n]=r,s=Math.ceil(parseInt(n,10)/8);return Xt(t,s,"int"===i)}if("bool"===e)return t?"01":"00";throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`Unsupported data type for direct field encoding: ${e}`)},rr={string:c.EthereumDataType.STRING,bool:c.EthereumDataType.BOOL,address:c.EthereumDataType.ADDRESS},ir=(e,t)=>{const r=Zt.exec(e);if(r){const[e,i,n]=r,s=ir(i,t);return{data_type:c.EthereumDataType.ARRAY,size:parseInt(n,10)||void 0,entry_type:s}}const i=Qt.exec(e);if(i){const[e,t,r]=i;return{data_type:"uint"===t?c.EthereumDataType.UINT:c.EthereumDataType.INT,size:Math.floor(parseInt(r,10)/8)}}const s=Jt.exec(e);if(s){const[e,t]=s;return{data_type:c.EthereumDataType.BYTES,size:parseInt(t,10)||void 0}}const o=rr[e];if(o)return{data_type:o};if(e in t)return{data_type:c.EthereumDataType.STRUCT,size:t[e].length,struct_name:e};throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,`No type definition specified: ${e}`)};var nr=Object.freeze({__proto__:null,searchDevices:class extends mt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){var e,t;return v(this,void 0,void 0,(function*(){yield Xe.configure();const r=yield null===(e=this.connector)||void 0===e?void 0:e.enumerate(),i=null!==(t=null==r?void 0:r.descriptors)&&void 0!==t?t:[];if("react-native"===Ce.getSettings("env"))return i.map((e=>{var t;return Object.assign(Object.assign({},e),{connectId:e.id,deviceType:K(null!==(t=e.name)&&void 0!==t?t:"")})}));const{deviceList:n}=yield We.getDevices(i);return n.map((e=>e.toMessageObject()))}))}},getFeatures:class extends mt{init(){this.allowDeviceMode=[...this.allowDeviceMode,tt,Qe],this.useDevicePassphraseState=!1}run(){return Promise.resolve(this.device.features)}},getPassphraseState:class extends mt{init(){this.allowDeviceMode=[...this.allowDeviceMode,tt],this.useDevicePassphraseState=!1}run(){var e,t;return v(this,void 0,void 0,(function*(){if(!this.device.features)return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceInitializeFailed));let{features:r}=this.device;const i=!0===(null===(t=null===(e=this.device)||void 0===e?void 0:e.features)||void 0===t?void 0:t.unlocked),s=yield ee(this.device.features,this.device.commands);if(("touch"===V(r)||"pro"===V(r))&&i){const{message:e}=yield this.device.commands.typedCall("GetFeatures","Features",{});r=e}return r&&!0===r.passphrase_protection?(s&&r.device_id&&this.device.tryFixInternalState(s,r.device_id),Promise.resolve(s)):Promise.resolve(void 0)}))}},getLogs:class extends mt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=ve();return Promise.resolve(e)}))}},checkFirmwareRelease:class extends mt{init(){this.useDevicePassphraseState=!1}run(){if(this.device.features){const e=ft(this.device.features);return Promise.resolve(e)}return Promise.resolve(null)}},checkBLEFirmwareRelease:class extends mt{init(){this.allowDeviceMode=[...this.allowDeviceMode,Qe],this.checkDeviceId=!0,this.useDevicePassphraseState=!1}run(){if(this.device.features){const e=yt(this.device.features);return Promise.resolve(e)}return Promise.resolve(null)}},checkTransportRelease:class extends mt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=Xe.getTransport(),t=yield e.init(),r=Ce.getTransportStatus(t);return Promise.resolve(r)}))}},checkBridgeStatus:class extends mt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){return new Promise(((e,t)=>{y.default.request({url:"http://localhost:21320",method:"POST",withCredentials:!1,timeout:3e3}).then((()=>e(!0))).catch((r=>{"ECONNABORTED"===r.code?t(n.ERRORS.TypedError(n.HardwareErrorCode.BridgeTimeoutError)):e(!1)}))}))}))}},deviceBackup:class extends mt{init(){this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("BackupDevice","Success");return Promise.resolve(e.message)}))}},deviceChangePin:class extends mt{init(){this.useDevicePassphraseState=!1,Ot(this.payload,[{name:"remove",type:"boolean"}]),this.params={remove:this.payload.remove}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ChangePin","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceFlags:class extends mt{init(){this.useDevicePassphraseState=!1,Ot(this.payload,[{name:"flags",type:"number"}]),this.params={flags:this.payload.flags}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ApplyFlags","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceRebootToBootloader:class extends mt{init(){this.useDevicePassphraseState=!1}getVersionRange(){return{classic:{min:"2.1.11"},mini:{min:"2.1.11"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("RebootToBootloader","Success");return Promise.resolve(e.message)}))}},deviceRecovery:class extends mt{init(){this.useDevicePassphraseState=!1,Ot(this.payload,[{name:"wordCount",type:"number"},{name:"passphraseProtection",type:"boolean"},{name:"pinProtection",type:"boolean"},{name:"language",type:"string"},{name:"label",type:"string"},{name:"enforceWordlist",type:"boolean"},{name:"type",type:"object"},{name:"u2fCounter",type:"number"},{name:"dryRun",type:"boolean"}]),this.params={word_count:this.payload.wordCount,passphrase_protection:this.payload.passphraseProtection,pin_protection:this.payload.pinProtection,language:this.payload.language,label:this.payload.label,enforce_wordlist:this.payload.enforceWordlist,type:this.payload.type,u2f_counter:this.payload.u2fCounter||Math.floor(Date.now()/1e3),dry_run:this.payload.dryRun}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("RecoveryDevice","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceReset:class extends mt{init(){this.useDevicePassphraseState=!1,Ot(this.payload,[{name:"displayRandom",type:"boolean"},{name:"strength",type:"number"},{name:"passphraseProtection",type:"boolean"},{name:"pinProtection",type:"boolean"},{name:"language",type:"string"},{name:"label",type:"string"},{name:"u2fCounter",type:"number"},{name:"skipBackup",type:"boolean"},{name:"noBackup",type:"boolean"},{name:"backupType"}]),this.params={display_random:this.payload.displayRandom,strength:this.payload.strength||256,passphrase_protection:this.payload.passphraseProtection,pin_protection:this.payload.pinProtection,language:this.payload.language,label:this.payload.label,u2f_counter:this.payload.u2fCounter||Math.floor(Date.now()/1e3),skip_backup:this.payload.skipBackup,no_backup:this.payload.noBackup,backup_type:this.payload.backupType}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ResetDevice","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceSettings:class extends mt{init(){this.useDevicePassphraseState=!1,Ot(this.payload,[{name:"language",type:"string"},{name:"label",type:"string"},{name:"usePassphrase",type:"boolean"},{name:"homescreen",type:"string"},{name:"passphraseSource",type:"number"},{name:"autoLockDelayMs",type:"number"},{name:"displayRotation",type:"number"},{name:"passphraseAlwaysOnDevice",type:"boolean"},{name:"safetyChecks",type:"number"},{name:"experimentalFeatures",type:"boolean"}]),this.params={language:this.payload.language,label:this.payload.label,use_passphrase:this.payload.usePassphrase,homescreen:this.payload.homescreen,_passphrase_source:this.payload.passphraseSource,auto_lock_delay_ms:this.payload.autoLockDelayMs,display_rotation:this.payload.displayRotation,passphrase_always_on_device:this.payload.passphraseAlwaysOnDevice,safety_checks:this.payload.safetyChecks,experimental_features:this.payload.experimentalFeatures}}getVersionRange(){return this.payload.usePassphrase?{model_mini:{min:"2.4.0"}}:{}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ApplySettings","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},deviceUpdateReboot:class extends mt{init(){this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("DeviceBackToBoot","Success");return Promise.resolve(e.message)}))}},deviceUploadResource:class extends mt{constructor(){super(...arguments),this.paramsData={data:new Uint8Array,thumbnailData:new Uint8Array},this.processResourceRequest=e=>v(this,void 0,void 0,(function*(){if("Success"===e.type)return e.message;const{offset:t,data_length:r}=e.message,{data:i,thumbnailData:n}=this.paramsData;if(void 0===t)throw new Error("offset is undefined");let s;s="ResourceRequest"===e.type?new Uint8Array(i.slice(t,Math.min(t+r,i.byteLength))):new Uint8Array(n.slice(t,Math.min(t+r,n.byteLength)));const o=d.blake2s(s),u={data_chunk:a.bytesToHex(s),hash:a.bytesToHex(o)},l=yield this.device.commands.typedCall("ResourceAck",["ResourceRequest","ZoomRequest","Success"],u);return this.processResourceRequest(l)}))}getVersionRange(){return{model_touch:{min:"3.2.0"}}}init(){this.useDevicePassphraseState=!1,Ot(this.payload,[{name:"suffix",type:"string",required:!0},{name:"dataHex",type:"string",required:!0},{name:"thumbnailDataHex",type:"string",required:!0},{name:"resType",type:"number",required:!0},{name:"nftMetaData",type:"string"}]);const{suffix:e,dataHex:t,thumbnailDataHex:r,resType:i,nftMetaData:n}=this.payload;this.paramsData={data:St(t),thumbnailData:St(r)},this.params={extension:e,data_length:this.paramsData.data.byteLength,zoom_data_length:this.paramsData.thumbnailData.byteLength,res_type:i,nft_meta_data:n}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ResourceUpload",["ResourceRequest","ZoomRequest","Success"],this.params);return this.postMessage(Pe(Ne.CLOSE_UI_WINDOW)),this.processResourceRequest(e)}))}},deviceSupportFeatures:class extends mt{init(){this.useDevicePassphraseState=!1}run(){if(!this.device.features)return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Device not initialized"));const e=Q(this.device.features),t=(e=>{if(!e)return{support:!1};const t=Z(e).join("."),r=V(e);return"classic"===r||"mini"===r?{support:!0}:{support:f.default.gte(t,"3.4.0")}})(this.device.features);return Promise.resolve({inputPinOnSoftware:e,modifyHomescreen:t,device:this.device.toMessageObject()})}},deviceVerify:class extends mt{init(){this.useDevicePassphraseState=!1,Ot(this.payload,[{name:"dataHex",type:"hexString"}]),this.params={data:wt(this.payload.dataHex)}}run(){return v(this,void 0,void 0,(function*(){let e;if("classic"===V(this.device.features)){e=(yield this.device.commands.typedCall("BixinVerifyDeviceRequest","BixinVerifyDeviceAck",Object.assign(Object.assign({},this.params),{data:a.bytesToHex(u.sha256(this.params.data))}))).message}else{const t=yield this.device.commands.typedCall("SESignMessage","SEMessageSignature",{message:this.params.data});e={cert:(yield this.device.commands.typedCall("ReadSEPublicCert","SEPublicCert")).message.public_cert,signature:t.message.signature}}return e?Promise.resolve(e):Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Device not support verify"))}))}},deviceWipe:class extends mt{init(){this.useDevicePassphraseState=!1}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("WipeDevice","Success");return Promise.resolve(e.message)}))}},deviceFullyUploadResource:class extends mt{constructor(){super(...arguments),this.checkPromise=null,this.postTipMessage=e=>{this.postMessage(Pe(it,{device:this.device.toMessageObject(),data:{message:e}}))}}init(){this.allowDeviceMode=[Qe,tt],this.requireDeviceMode=[],this.useDevicePassphraseState=!1}isSupportResourceUpdate(e,t){if("firmware"!==t)return!1;const r=V(e),i="touch"===r||"pro"===r,n=Z(e).join(".");return i&&f.default.gte(n,"3.4.0")}run(){return v(this,void 0,void 0,(function*(){const{device:e}=this,{features:t}=e;if(!(null==t?void 0:t.bootloader_mode)&&t&&t){this.postTipMessage("CheckLatestUiResource");const r=Ce.getSysFullResource(t);if(r){this.postTipMessage("DownloadLatestUiResource");const t=yield xt(r);this.postTipMessage("DownloadLatestUiResourceSuccess"),t&&(yield Lt(this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,e,t.binary))}}}))}},firmwareUpdate:class extends mt{init(){this.allowDeviceMode=[Qe,tt],this.requireDeviceMode=[Qe],this.useDevicePassphraseState=!1;const{payload:e}=this;if(Ot(e,[{name:"version",type:"array"},{name:"binary",type:"buffer"}]),!e.updateType)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"updateType is required");this.params={updateType:e.updateType},"version"in e&&(this.params=Object.assign(Object.assign({},this.params),{version:e.version})),"binary"in e&&(this.params=Object.assign(Object.assign({},this.params),{binary:e.binary}))}run(){var e;return v(this,void 0,void 0,(function*(){const{device:t,params:r}=this;let i;try{if(r.binary)i=this.params.binary;else{if(!t.features)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"no features found for this device");i=(yield It({features:t.features,version:r.version,updateType:r.updateType})).binary}}catch(t){throw n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareUpdateDownloadFailed,null!==(e=t.message)&&void 0!==e?e:t)}return Pt(r.updateType,this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,t,{payload:i})}))}},firmwareUpdateV2:class extends mt{constructor(){super(...arguments),this.checkPromise=null,this.postTipMessage=e=>{this.postMessage(Pe(it,{device:this.device.toMessageObject(),data:{message:e}}))}}init(){this.allowDeviceMode=[Qe,tt],this.requireDeviceMode=[],this.useDevicePassphraseState=!1;const{payload:e}=this;if(Ot(e,[{name:"version",type:"array"},{name:"binary",type:"buffer"},{name:"forcedUpdateRes",type:"boolean"}]),!e.updateType)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"updateType is required");this.params={updateType:e.updateType,forcedUpdateRes:e.forcedUpdateRes},"version"in e&&(this.params=Object.assign(Object.assign({},this.params),{version:e.version})),"binary"in e&&(this.params=Object.assign(Object.assign({},this.params),{binary:e.binary}))}checkDeviceToBootloader(e){this.checkPromise=n.createDeferred();const t=Ce.getSettings("env"),r=e&&"react-native"===t;qt.log("FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ",r);const i=setInterval((()=>v(this,void 0,void 0,(function*(){var t,n,s,o,a,d,u;if(r)yield this.device.acquire(),yield this.device.initialize(),(null===(t=this.device.features)||void 0===t?void 0:t.bootloader_mode)&&(clearInterval(i),null===(n=this.checkPromise)||void 0===n||n.resolve(!0));else{const t=yield null===(s=this.device.deviceConnector)||void 0===s?void 0:s.enumerate(),r=null!==(o=null==t?void 0:t.descriptors)&&void 0!==o?o:[],{deviceList:n}=yield We.getDevices(r,e);1===n.length&&(null===(d=null===(a=n[0])||void 0===a?void 0:a.features)||void 0===d?void 0:d.bootloader_mode)&&(this.device.updateFromCache(n[0]),this.device.commands.disposed=!1,clearInterval(i),null===(u=this.checkPromise)||void 0===u||u.resolve(!0))}}))),r?3e3:2e3);setTimeout((()=>{this.checkPromise&&(clearInterval(i),this.checkPromise.reject(new Error))}),3e4)}isEnteredManuallyBoot(e){const t=V(e),r="mini"===t,i="firmware"===this.params.updateType&&"classic"===t&&"1.8.3"===e.bootloader_version;return r||i}isSupportResourceUpdate(e,t){if("firmware"!==t)return!1;const r=V(e),i="touch"===r||"pro"===r,n=Z(e).join(".");return i&&f.default.gte(n,"3.2.0")}run(){var e,t;return v(this,void 0,void 0,(function*(){const{device:r,params:i}=this,{features:s,commands:o}=r;if(!(null==s?void 0:s.bootloader_mode)&&s){const t=Y(s),a=V(s);if(this.isEnteredManuallyBoot(s))return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareUpdateManuallyEnterBoot));if(s&&this.isSupportResourceUpdate(s,i.updateType)){this.postTipMessage("CheckLatestUiResource");const e=Ce.getSysResourcesLatestRelease(s,i.forcedUpdateRes);if(e){this.postTipMessage("DownloadLatestUiResource");const t=yield xt(e);this.postTipMessage("DownloadLatestUiResourceSuccess"),t&&(yield Lt(this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,r,t.binary))}}try{this.postTipMessage("AutoRebootToBootloader"),yield o.typedCall("DeviceBackToBoot","Success"),this.postTipMessage("GoToBootloaderSuccess"),this.checkDeviceToBootloader(this.payload.connectId),"classic"===a&&We.clearDeviceCache(t),delete We.devicesCache[""],yield null===(e=this.checkPromise)||void 0===e?void 0:e.promise,this.checkPromise=null,yield Re(1500)}catch(e){return e instanceof n.HardwareError?Promise.reject(e):(console.log("auto go to bootloader mode failed: ",e),Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure)))}}let a;try{if(i.binary)a=this.params.binary;else{if(!r.features)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"no features found for this device");this.postTipMessage("DownloadFirmware");a=(yield It({features:r.features,version:i.version,updateType:i.updateType})).binary,this.postTipMessage("DownloadFirmwareSuccess")}}catch(e){throw n.ERRORS.TypedError(n.HardwareErrorCode.FirmwareUpdateDownloadFailed,null!==(t=e.message)&&void 0!==t?t:e)}return yield this.device.acquire(),Pt(i.updateType,this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,r,{payload:a})}))}},requestWebUsbDevice:class extends mt{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){var e,t;return v(this,void 0,void 0,(function*(){yield Xe.configure();if("webusb"!==Ce.getSettings("env"))return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Not webusb environment"));try{const r=yield null===(e=this.connector)||void 0===e?void 0:e.enumerate(),i=null!==(t=null==r?void 0:r.descriptors)&&void 0!==t?t:[],{deviceList:s}=yield We.getDevices(i);return s.length>0?{device:s[0].toMessageObject()}:yield Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Please select the device to connect"))}catch(e){return jt.debug(e),Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"Please select the device to connect"))}}))}},cipherKeyValue:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{const t=G(e.path);Ot(e,[{name:"path",required:!0},{name:"key",type:"string"},{name:"value",type:"hexString"},{name:"encrypt",type:"boolean"},{name:"askOnEncrypt",type:"boolean"},{name:"askOnDecrypt",type:"boolean"},{name:"iv",type:"hexString"}]),this.params.push({address_n:t,key:e.key,value:wt(e.value),encrypt:e.encrypt,ask_on_encrypt:e.askOnEncrypt,ask_on_decrypt:e.askOnDecrypt,iv:wt(e.iv)})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("CipherKeyValue","CipheredKeyValue",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},btcGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=Object.prototype.hasOwnProperty.call(this.payload,"bundle");const e=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(e,[{name:"bundle",type:"array"}]),this.params=[],e.bundle.forEach((e=>{var t;const r=G(e.path,1);Ot(e,[{name:"path",required:!0},{name:"coin",type:"string"},{name:"showOnOneKey",type:"boolean"},{name:"multisig",type:"object"},{name:"scriptType",type:"string"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t,{multisig:n,coin:s}=e;let{scriptType:o}=e;o||(o=H(r),"SPENDMULTISIG"!==o||n||(o="SPENDADDRESS"));const a=Ut(r,s).name;this.params.push({address_n:r,show_display:i,coin_name:a,multisig:n,script_type:o||"SPENDADDRESS"})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("GetAddress","Address",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},btcGetPublicKey:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=Object.prototype.hasOwnProperty.call(this.payload,"bundle");const e=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(e,[{name:"bundle",type:"array"}]),this.params=[],e.bundle.forEach((e=>{var t;const r=G(e.path,1);Ot(e,[{name:"path",required:!0},{name:"coin",type:"string"},{name:"showOnOneKey",type:"boolean"},{name:"scriptType",type:"string"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t,{multisig:n,coin:s}=e;let{scriptType:o}=e;o||(o=H(r),"SPENDMULTISIG"!==o||n||(o="SPENDADDRESS"));const a=Ut(r,s).name;this.params.push({address_n:r,show_display:i,coin_name:a,script_type:o||"SPENDADDRESS"})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("GetPublicKey","PublicKey",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},btcSignMessage:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"coin",type:"string"}]);const{path:e,messageHex:t,coin:r}=this.payload,i=G(e),{coinName:n,scriptType:s}=zt(i,r,!1);this.params={address_n:i,message:wt(t),coin_name:n,script_type:s}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("SignMessage","MessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},btcSignTransaction:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"coin",type:"string",required:!0},{name:"inputs",type:"array",required:!0},{name:"outputs",type:"array",required:!0},{name:"refTxs",type:"array",required:!0,allowEmpty:!0},{name:"locktime",type:"number"},{name:"version",type:"number"},{name:"expiry",type:"number"},{name:"overwintered",type:"boolean"},{name:"versionGroupId",type:"number"},{name:"branchId",type:"number"},{name:"timestamp",type:"number"}]),this.payload.refTxs.forEach((e=>{Ot(e,[{name:"hash",type:"hexString",required:!0},{name:"inputs",type:"array",required:!0},{name:"bin_outputs",type:"array",required:!Array.isArray(e.outputs)},{name:"outputs",type:"array"},{name:"version",type:"number",required:!0},{name:"lock_time",type:"number",required:!0},{name:"extra_data",type:"string"},{name:"timestamp",type:"number"},{name:"version_group_id",type:"number"}])})),this.payload.inputs.forEach((e=>{G(e.address_n);const t=(r=e.address_n,Array.isArray(r)&&r[0]===q(49));var r;Ot(e,[{name:"prev_hash",type:"hexString",required:!0},{name:"prev_index",type:"number",required:!0},{name:"script_type",type:"string"},{name:"amount",type:"string",required:t},{name:"sequence",type:"number"},{name:"multisig",type:"object"}])})),this.payload.outputs.forEach((e=>{if(Ot(e,[{name:"address_n",type:"array"},{name:"address",type:"string"},{name:"amount",type:"string"},{name:"op_return_data",type:"string"},{name:"multisig",type:"object"}]),Object.prototype.hasOwnProperty.call(e,"address_n")&&Object.prototype.hasOwnProperty.call(e,"address"))throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Cannot use address and address_n in one output");if(e.address_n){const t=(e=>{if(!Array.isArray(e)||e.length<1)return"PAYTOADDRESS";if(49===e[0])return"PAYTOP2SHWITNESS";switch(j(e[0])){case 48:return"PAYTOMULTISIG";case 49:return"PAYTOP2SHWITNESS";case 84:return"PAYTOWITNESS";default:return"PAYTOADDRESS"}})(e.address_n);if(e.script_type!==t)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,`Output change script_type should be set to ${t}`)}}));const{inputs:e,outputs:t,refTxs:r,account:i,coin:s}=this.payload,o=Ut(void 0,s).name;this.params={inputs:e,outputs:t,refTxs:r,addresses:i?i.addresses:void 0,options:{lock_time:this.payload.locktime,timestamp:this.payload.timestamp,version:this.payload.version,expiry:this.payload.expiry,overwintered:this.payload.overwintered,version_group_id:this.payload.versionGroupId,branch_id:this.payload.branchId},coinName:o}}run(){return v(this,void 0,void 0,(function*(){const{device:e,params:t}=this,r=e.unavailableCapabilities.replaceTransaction,{refTxs:i}=t,n=r?Kt:Gt;return yield n(e.commands.typedCall.bind(e.commands),t.inputs,t.outputs,i,t.options,t.coinName)}))}},btcVerifyMessage:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"address",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0},{name:"coin",type:"string",required:!0}]);const{coin:e}=this.payload,{address:t,messageHex:r,signature:i}=wt(this.payload),n=Ut(void 0,e).name;this.params={address:t,message:r,signature:i,coin_name:n}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("VerifyMessage","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},confluxGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"chainId",type:"number"},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,chain_id:e.chainId,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("ConfluxGetAddress","ConfluxAddress",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},confluxSignMessage:class extends mt{init(){this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=G(e,3);this.params={address_n:r,message:wt(t)}}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ConfluxSignMessage","ConfluxMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},confluxSignMessageCIP23:class extends mt{init(){this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{path:e,domainHash:t,messageHash:r}=this.payload,i=G(e,3);this.params={address_n:i,domain_hash:wt(t),message_hash:wt(r)}}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ConfluxSignMessageCIP23","ConfluxMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},confluxSignTransaction:class extends mt{constructor(){super(...arguments),this.addressN=[],this.processTxRequest=(e,t)=>v(this,void 0,void 0,(function*(){if(!e.data_length){const t=e.signature_v,r=e.signature_r,i=e.signature_s;if(null==t||null==r||null==i)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodError,"sign transaction failed");return Promise.resolve({v:`0x${t.toString(16)}`,r:`0x${r}`,s:`0x${i}`})}const[r,i]=Yt(t,2*e.data_length),s=yield this.device.commands.typedCall("ConfluxTxAck","ConfluxTxRequest",{data_chunk:r});return this.processTxRequest(s.message,i)})),this.evmSignTx=(e,t)=>v(this,void 0,void 0,(function*(){const{to:r,value:i,gasPrice:n,gasLimit:s,nonce:o,data:a,chainId:d,epochHeight:u,storageLimit:l}=t,c=null==a?0:a.length/2,[p,h]=Yt(a,2048);let f={address_n:e,nonce:_t(o),gas_price:_t(n),gas_limit:_t(s),to:r,value:_t(i),epoch_height:_t(u),storage_limit:_t(l),chain_id:d};0!==c&&(f=Object.assign(Object.assign({},f),{data_length:c,data_initial_chunk:p}));const y=yield this.device.commands.typedCall("ConfluxSignTx","ConfluxTxRequest",f);return this.processTxRequest(y.message,h)}))}init(){this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload;this.addressN=G(e,3);const r=t;Ot(r,[{name:"to",type:"hexString",required:!0},{name:"value",type:"hexString",required:!0},{name:"gasLimit",type:"hexString",required:!0},{name:"gasPrice",type:"hexString",required:!0},{name:"nonce",type:"hexString",required:!0},{name:"epochHeight",type:"hexString",required:!0},{name:"storageLimit",type:"hexString",required:!0},{name:"chainId",type:"number",required:!0},{name:"data",type:"hexString"}]),this.formattedTx=wt(r)}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return v(this,void 0,void 0,(function*(){const{addressN:e,formattedTx:t}=this;if(null==t)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"ConfluxSignTransaction: format tx error");const r=yield this.evmSignTx(e,t);return Promise.resolve(r)}))}},evmGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("EthereumGetAddress","EthereumAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},evmGetPublicKey:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("EthereumGetPublicKey","EthereumPublicKey",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},evmSignMessage:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=G(e,3);this.params={address_n:r,message:wt(t)}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumSignMessage","EthereumMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},evmSignMessageEIP712:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{path:e,domainHash:t,messageHash:r}=this.payload,i=G(e,3);this.params={address_n:i,domain_hash:wt(t),message_hash:wt(r)}}getVersionRange(){return{model_mini:{min:"2.1.9"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumSignMessageEIP712","EthereumMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},evmSignTransaction:class extends mt{constructor(){super(...arguments),this.addressN=[],this.isEIP1559=!1,this.processTxRequest=(e,t,r)=>v(this,void 0,void 0,(function*(){if(!e.data_length){let t=e.signature_v;const i=e.signature_r,s=e.signature_s;if(null==t||null==i||null==s)throw n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"processTxRequest: Unexpected request");return r&&t<=1&&(t+=2*r+35),Promise.resolve({v:`0x${t.toString(16)}`,r:`0x${i}`,s:`0x${s}`})}const[i,s]=Yt(t,2*e.data_length),o=yield this.device.commands.typedCall("EthereumTxAck","EthereumTxRequest",{data_chunk:i});return this.processTxRequest(o.message,s,r)})),this.evmSignTx=(e,t)=>v(this,void 0,void 0,(function*(){const{to:r,value:i,gasPrice:n,gasLimit:s,nonce:o,data:a,chainId:d,txType:u}=t,l=null==a?0:a.length/2,[c,p]=Yt(a,2048);let h={address_n:e,nonce:_t(o),gas_price:_t(n),gas_limit:_t(s),to:r,value:_t(i),chain_id:d};0!==l&&(h=Object.assign(Object.assign({},h),{data_length:l,data_initial_chunk:c})),null!==u&&(h=Object.assign(Object.assign({},h),{tx_type:u}));const f=yield this.device.commands.typedCall("EthereumSignTx","EthereumTxRequest",h);return this.processTxRequest(f.message,p,d)})),this.evmSignTxEip1559=(e,t)=>v(this,void 0,void 0,(function*(){const{to:r,value:i,gasLimit:n,nonce:s,data:o,chainId:a,maxFeePerGas:d,maxPriorityFeePerGas:u,accessList:l}=t,c=null==o?0:o.length/2,[p,h]=Yt(o,2048),f={address_n:e,nonce:_t(s),max_gas_fee:_t(d),max_priority_fee:_t(u),gas_limit:_t(n),to:r,value:_t(i),data_length:c,data_initial_chunk:p,chain_id:a,access_list:(l||[]).map((e=>({address:e.address,storage_keys:e.storageKeys})))},y=yield this.device.commands.typedCall("EthereumSignTxEIP1559","EthereumTxRequest",f);return this.processTxRequest(y.message,h)}))}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload;this.addressN=G(e,3);const r=t;this.isEIP1559=!!r.maxFeePerGas&&!!r.maxPriorityFeePerGas;const i=[{name:"to",type:"hexString",required:!0},{name:"value",type:"hexString",required:!0},{name:"gasLimit",type:"hexString",required:!0},{name:"nonce",type:"hexString",required:!0},{name:"chainId",type:"number",required:!0},{name:"data",type:"hexString"}];this.isEIP1559?(i.push({name:"maxFeePerGas",type:"hexString",required:!0}),i.push({name:"maxPriorityFeePerGas",type:"hexString",required:!0})):(i.push({name:"gasPrice",type:"hexString",required:!0}),i.push({name:"txType",type:"number"})),Ot(r,i),this.formattedTx=wt(r)}getVersionRange(){return this.isEIP1559?{model_mini:{min:"2.1.11"}}:{model_mini:{min:"1.0.0"}}}run(){return v(this,void 0,void 0,(function*(){const{addressN:e,isEIP1559:t,formattedTx:r}=this,i=yield t?this.evmSignTxEip1559(e,r):this.evmSignTx(e,r);return Promise.resolve(i)}))}},evmSignTypedData:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"metamaskV4Compat",type:"boolean"},{name:"data",type:"object"},{name:"domainHash",type:"hexString"},{name:"messageHash",type:"hexString"}]);const{path:e,data:t,metamaskV4Compat:r,domainHash:i,messageHash:s}=this.payload,o=G(e,3);if(this.params={addressN:o,metamaskV4Compat:r,data:t},i)if(this.params.domainHash=wt(i),s)this.params.messageHash=wt(s);else if(t&&(!t.primaryType||"EIP712Domain"!==t.primaryType))throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"message_hash should only be empty when data.primaryType=EIP712Domain")}signTypedData(){return v(this,void 0,void 0,(function*(){const{commands:e}=this.device,{addressN:t,data:r,metamaskV4Compat:i}=this.params,{types:s,primaryType:o,domain:a,message:d}=r;let u=yield e.typedCall("EthereumSignTypedData",["EthereumTypedDataStructRequest","EthereumTypedDataValueRequest","EthereumTypedDataSignature"],{address_n:t,primary_type:o,metamask_v4_compat:i});for(;"EthereumTypedDataStructRequest"===u.type;){const{name:t}=u.message,r=s[t];if(void 0===r)throw n.ERRORS.TypedError("Runtime",`Type ${t} was not defined in types object`);const i={members:r.map((({name:e,type:t})=>({name:e,type:ir(t,s)})))};u=yield e.typedCall("EthereumTypedDataStructAck",["EthereumTypedDataStructRequest","EthereumTypedDataValueRequest","EthereumTypedDataSignature"],i)}for(;"EthereumTypedDataValueRequest"===u.type;){const{member_path:t}=u.message;let r,i;const[l,...c]=t;switch(l){case 0:r=a,i="EIP712Domain";break;case 1:r=d,i=o;break;default:throw n.ERRORS.TypedError("Runtime","Root index can only be 0 or 1")}for(const e of c)if(Array.isArray(r))i=er(i).entryTypeName,r=r[e];else if("object"==typeof r&&null!==r){const t=s[i][e];i=t.type,r=r[t.name]}let p;p=Array.isArray(r)?tr("uint16",r.length):tr(i,r),u=yield e.typedCall("EthereumTypedDataValueAck",["EthereumTypedDataValueRequest","EthereumTypedDataSignature"],{value:p})}if("EthereumTypedDataSignature"!==u.type)throw n.ERRORS.TypedError("Runtime","Unexpected response type");const{address:l,signature:c}=u.message;return{address:l,signature:c}}))}getVersionRange(){return{model_mini:{min:"2.1.9"}}}supportSignTyped(){const e=V(this.device.features);if("classic"===e||"mini"===e){const e=Z(this.device.features).join("."),t="2.2.0";if(f.default.lt(e,t))return!1}return!0}run(){return v(this,void 0,void 0,(function*(){if(!this.device.features)throw n.ERRORS.TypedError("Device_InitializeFailed","Device initialization failed. Please try again.");const{addressN:e}=this.params,t=V(this.device.features);if("classic"===t||"mini"===t){Ot(this.params,[{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{domainHash:t,messageHash:r}=this.params;let i;return i=this.supportSignTyped()?yield this.device.commands.typedCall("EthereumSignTypedHash","EthereumTypedDataSignature",{address_n:e,domain_separator_hash:null!=t?t:"",message_hash:r}):yield this.device.commands.typedCall("EthereumSignMessageEIP712","EthereumMessageSignature",{address_n:e,domain_hash:null!=t?t:"",message_hash:null!=r?r:""}),Promise.resolve(i.message)}return this.signTypedData()}))}},evmVerifyMessage:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"address",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0}]);const{address:e,messageHex:t,signature:r}=wt(this.payload);this.params={address:e,message:t,signature:r}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumVerifyMessage","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},starcoinGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StarcoinGetAddress","StarcoinAddress",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},starcoinGetPublicKey:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StarcoinGetPublicKey","StarcoinPublicKey",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},starcoinSignMessage:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=G(e,3);this.params={address_n:r,message:wt(t)}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinSignMessage","StarcoinMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},starcoinSignTransaction:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:wt(t)}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinSignTx","StarcoinSignedTx",Object.assign({},this.params));return Promise.resolve(e.message)}))}},starcoinVerifyMessage:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"publicKey",type:"string",required:!0},{name:"messageHex",type:"hexString",required:!0},{name:"signature",type:"hexString",required:!0}]);const{publicKey:e,messageHex:t,signature:r}=wt(this.payload);this.params={public_key:e,message:t,signature:r}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinVerifyMessage","Success",Object.assign({},this.params));return Promise.resolve(e.message)}))}},nemGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"network",type:"number"},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,network:e.network||104,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("NEMGetAddress","NEMAddress",Object.assign({},r));e.push(Object.assign({path:$(r.address_n)},i.message))}return Promise.resolve(this.hasBundle?e:e[0])}))}},nemSignTransaction:class extends mt{constructor(){super(...arguments),this.NEM_MOSAIC_LEVY_TYPES={1:"MosaicLevy_Absolute",2:"MosaicLevy_Percentile"},this.NEM_SUPPLY_CHANGE_TYPES={1:"SupplyChange_Increase",2:"SupplyChange_Decrease"},this.NEM_AGGREGATE_MODIFICATION_TYPES={1:"CosignatoryModification_Add",2:"CosignatoryModification_Delete"},this.NEM_IMPORTANCE_TRANSFER_MODES={1:"ImportanceTransfer_Activate",2:"ImportanceTransfer_Deactivate"},this.getCommon=(e,t)=>{var r;return{address_n:t,network:e.version>>24&255,timestamp:e.timeStamp,fee:e.fee,deadline:null!==(r=e.deadline)&&void 0!==r?r:0,signer:t?void 0:e.signer}},this.transferMessage=e=>{const t=e.mosaics?e.mosaics.map((e=>({namespace:e.mosaicId.namespaceId,mosaic:e.mosaicId.name,quantity:e.quantity}))):void 0;return{recipient:e.recipient,amount:e.amount,payload:e.message?e.message.payload:void 0,public_key:e.message&&2===e.message.type?e.message.publicKey:void 0,mosaics:t}},this.importanceTransferMessage=e=>({mode:this.NEM_IMPORTANCE_TRANSFER_MODES[e.importanceTransfer.mode],public_key:e.importanceTransfer.publicKey}),this.aggregateModificationMessage=e=>({modifications:e.modifications?e.modifications.map((e=>({type:this.NEM_AGGREGATE_MODIFICATION_TYPES[e.modificationType],public_key:e.cosignatoryAccount}))):void 0,relative_change:e.minCosignatories.relativeChange}),this.provisionNamespaceMessage=e=>{var t,r,i;return{namespace:null!==(t=e.newPart)&&void 0!==t?t:"",parent:e.parent||void 0,sink:null!==(r=e.rentalFeeSink)&&void 0!==r?r:"",fee:null!==(i=e.rentalFee)&&void 0!==i?i:0}},this.mosaicCreationMessage=e=>{var t,r;const{levy:i}=e.mosaicDefinition,n={namespace:e.mosaicDefinition.id.namespaceId,mosaic:e.mosaicDefinition.id.name,levy:i&&i.type?this.NEM_MOSAIC_LEVY_TYPES[i.type]:void 0,fee:i&&i.fee,levy_address:i&&i.recipient,levy_namespace:i&&i.mosaicId&&i.mosaicId.namespaceId,levy_mosaic:i&&i.mosaicId&&i.mosaicId.name,description:e.mosaicDefinition.description},{properties:s}=e.mosaicDefinition;return Array.isArray(s)&&s.forEach((e=>{const{name:t,value:r}=e;switch(t){case"divisibility":n.divisibility=parseInt(r);break;case"initialSupply":n.supply=parseInt(r);break;case"supplyMutable":n.mutable_supply="true"===r;break;case"transferable":n.transferable="true"===r}})),{definition:n,sink:null!==(t=e.creationFeeSink)&&void 0!==t?t:"",fee:null!==(r=e.creationFee)&&void 0!==r?r:0}},this.supplyChangeMessage=e=>{var t;return{namespace:e.mosaicId.namespaceId,mosaic:e.mosaicId.name,type:this.NEM_SUPPLY_CHANGE_TYPES[e.supplyType],delta:null!==(t=e.delta)&&void 0!==t?t:0}},this.parseTx=(e,t)=>{let r=e;const i={transaction:this.getCommon(e,t),transfer:void 0,importance_transfer:void 0,aggregate_modification:void 0,provision_namespace:void 0,mosaic_creation:void 0,supply_change:void 0};switch(258!==e.type&&4100!==e.type&&4098!==e.type||(i.cosigning=258===e.type||4098===e.type,r=e.otherTrans,i.multisig=this.getCommon(r)),r.type){case 257:i.transfer=this.transferMessage(r);break;case 2049:i.importance_transfer=this.importanceTransferMessage(r);break;case 4097:i.aggregate_modification=this.aggregateModificationMessage(r);break;case 8193:i.provision_namespace=this.provisionNamespaceMessage(r);break;case 16385:i.mosaic_creation=this.mosaicCreationMessage(r);break;case 16386:i.supply_change=this.supplyChangeMessage(r);break;default:throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Unknown transaction type")}return i}}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload,r=G(e,3);this.params=this.parseTx(t,r)}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("NEMSignTx","NEMSignedTx",Object.assign({},this.params));return Promise.resolve(e)}))}},solGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("SolanaGetAddress","SolanaAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},solSignTransaction:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{const t=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]),this.params.push({address_n:t,raw_tx:wt(e.rawTx)})}))}getVersionRange(){return{classic:{min:"2.1.9"},mini:{min:"2.1.9"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("SolanaSignTx","SolanaSignedTx",Object.assign({},r)),{signature:n}=i.message;e.push({path:$(r.address_n),signature:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},stellarGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("StellarGetAddress","StellarAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},stellarSignTransaction:class extends mt{constructor(){super(...arguments),this.operations=[],this.parseOperation=e=>{switch(e.type){case"createAccount":return Ot(e,[{name:"destination",type:"string",required:!0},{name:"startingBalance",type:"bigNumber",required:!0}]),{type:"StellarCreateAccountOp",source_account:e.source,new_account:e.destination,starting_balance:e.startingBalance};case"payment":return Ot(e,[{name:"destination",type:"string",required:!0},{name:"amount",type:"bigNumber",required:!0},{name:"asset",required:!0}]),{type:"StellarPaymentOp",source_account:e.source,destination_account:e.destination,asset:e.asset,amount:e.amount};case"pathPayment":return Ot(e,[{name:"destAmount",type:"bigNumber",required:!0}]),{type:"StellarPathPaymentOp",source_account:e.source,send_asset:e.sendAsset,send_max:e.sendMax,destination_account:e.destination,destination_asset:e.destAsset,destination_amount:e.destAmount,paths:e.path};case"createPassiveOffer":return Ot(e,[{name:"amount",type:"bigNumber",required:!0}]),{type:"StellarCreatePassiveOfferOp",source_account:e.source,buying_asset:e.buying,selling_asset:e.selling,amount:e.amount,price_n:e.price.n,price_d:e.price.d};case"manageOffer":return Ot(e,[{name:"amount",type:"bigNumber",required:!0}]),{type:"StellarManageOfferOp",source_account:e.source,buying_asset:e.buying,selling_asset:e.selling,amount:e.amount,offer_id:e.offerId,price_n:e.price.n,price_d:e.price.d};case"setOptions":{const t=e.signer?{signer_type:e.signer.type,signer_key:e.signer.key,signer_weight:e.signer.weight}:void 0;return Object.assign({type:"StellarSetOptionsOp",source_account:e.source,clear_flags:e.clearFlags,set_flags:e.setFlags,master_weight:e.masterWeight,low_threshold:e.lowThreshold,medium_threshold:e.medThreshold,high_threshold:e.highThreshold,home_domain:e.homeDomain,inflation_destination_account:e.inflationDest},t)}case"changeTrust":return Ot(e,[{name:"limit",type:"bigNumber"}]),{type:"StellarChangeTrustOp",source_account:e.source,asset:e.line,limit:e.limit};case"allowTrust":return{type:"StellarAllowTrustOp",source_account:e.source,trusted_account:e.trustor,asset_type:e.assetType,asset_code:e.assetCode,is_authorized:e.authorize?1:0};case"accountMerge":return{type:"StellarAccountMergeOp",source_account:e.source,destination_account:e.destination};case"manageData":return{type:"StellarManageDataOp",source_account:e.source,key:e.name,value:e.value};case"bumpSequence":return{type:"StellarBumpSequenceOp",source_account:e.source,bump_to:e.bumpTo};default:return{}}},this.processTxRequest=(e,t)=>v(this,void 0,void 0,(function*(){const r=t+1>=e.length,i=e[t],{type:n}=i,s=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(i,["type"]);if(r){return(yield this.device.commands.typedCall(n,"StellarSignedTx",s)).message}return yield this.device.commands.typedCall(n,"StellarTxOpRequest",s),this.processTxRequest(e,t+1)}))}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"networkPassphrase",type:"string",required:!0},{name:"transaction",type:"object",required:!0}]);const{transaction:e,networkPassphrase:t}=this.payload;if(!e.timebounds)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"timebounds is required");const r=G(this.payload.path,3);this.params={address_n:r,network_passphrase:t,source_account:e.source,fee:e.fee,sequence_number:e.sequence,num_operations:e.operations.length,memo_type:c.StellarMemoType.NONE,timebounds_start:e.timebounds.minTime,timebounds_end:e.timebounds.maxTime},e.memo&&(this.params.memo_type=e.memo.type,this.params.memo_text=e.memo.text,this.params.memo_id=e.memo.id,this.params.memo_hash=e.memo.hash),e.operations.forEach((e=>{const t=this.parseOperation(e);t&&this.operations.push(t)})),console.log("StellarSignTransactionParams",this.params),console.log("StellarSignTransactionOperations",this.operations)}run(){return v(this,void 0,void 0,(function*(){return yield this.device.commands.typedCall("StellarSignTx","StellarTxOpRequest",Object.assign({},this.params)),this.processTxRequest(this.operations,0)}))}},tronGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("TronGetAddress","TronAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},tronSignMessage:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"messageHex",type:"hexString",required:!0}]);const{path:e,messageHex:t}=this.payload,r=G(e,3);this.params={address_n:r,message:bt(t)}}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("TronSignMessage","TronMessageSignature",Object.assign({},this.params));return Promise.resolve(e.message)}))}},tronSignTransaction:class extends mt{parseTx(e,t){const r={address_n:t,data:e.data,timestamp:e.timestamp,fee_limit:e.feeLimit,ref_block_bytes:e.refBlockBytes,ref_block_hash:e.refBlockHash,expiration:e.expiration,contract:{}};return e.contract&&(e.contract.transferContract&&(r.contract={transfer_contract:{to_address:e.contract.transferContract.toAddress,amount:e.contract.transferContract.amount}}),e.contract.triggerSmartContract&&(r.contract={trigger_smart_contract:{contract_address:e.contract.triggerSmartContract.contractAddress,call_value:e.contract.triggerSmartContract.callValue,data:e.contract.triggerSmartContract.data,call_token_value:e.contract.triggerSmartContract.callTokenValue,asset_id:e.contract.triggerSmartContract.assetId}})),r}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload,r=G(e,3);Ot(t,[{name:"refBlockBytes",type:"hexString",required:!0},{name:"refBlockHash",type:"hexString",required:!0},{name:"expiration",type:"number",required:!0},{name:"timestamp",type:"number",required:!0},{name:"contract",type:"object",required:!0}]),this.params=this.parseTx(wt(t),r)}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("TronSignTx","TronSignedTx",Object.assign({},this.params));return Promise.resolve(e.message)}))}},nearGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("NearGetAddress","NearAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},nearSignTransaction:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:wt(t)}}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("NearSignTx","NearSignedTx",Object.assign({},this.params));return Promise.resolve(e.message)}))}},aptosGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}publicKeyToAddress(e){const t=p.sha3_256.create();return t.update(St(e)),t.update("\0"),`0x${a.bytesToHex(t.digest())}`}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){var e;return v(this,void 0,void 0,(function*(){if(this.hasBundle&&(e=>{if(!e)return!1;const t=Z(e).join("."),r=V(e);return"touch"===r||"pro"===r?f.default.gte(t,"3.1.0"):f.default.gte(t,"2.6.0")})(null===(e=this.device)||void 0===e?void 0:e.features)){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"ed25519"})).message.public_keys.map(((e,t)=>({path:$(this.params[t].address_n),publicKey:e,address:this.publicKeyToAddress(e)})));return Promise.resolve(e)}const t=[];for(let e=0;e<this.params.length;e++){const r=this.params[e],i=yield this.device.commands.typedCall("AptosGetAddress","AptosAddress",Object.assign({},r)),{address:n}=i.message;t.push({path:$(r.address_n),address:null==n?void 0:n.toLowerCase()})}return Promise.resolve(this.hasBundle?t:t[0])}))}},aptosGetPublicKey:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=(yield this.device.commands.typedCall("BatchGetPublickeys","EcdsaPublicKeys",{paths:this.params,ecdsa_curve_name:"ed25519"})).message.public_keys.map(((e,t)=>({path:$(this.params[t].address_n),publicKey:e})));return Promise.resolve(this.hasBundle?e:e[0])}))}},aptosSignTransaction:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:wt(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("AptosSignTx","AptosSignedTx",Object.assign({},this.params));return Promise.resolve(e.message)}))}},aptosSignMessage:class extends mt{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Ot(this.payload,[{name:"path",required:!0},{name:"payload",type:"object",required:!0}]);const{path:e,payload:t}=this.payload,r=G(e,3);Ot(t,[{name:"address",type:"string"},{name:"chainId",type:"string"},{name:"application",type:"string"},{name:"nonce",type:"string",required:!0},{name:"message",type:"string",required:!0}]),this.params={address_n:r,payload:{address:t.address,chain_id:t.chainId,application:t.application,nonce:t.nonce,message:t.message}}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){let e="APTOS\n";this.params.payload.address&&(e+=`address: ${this.params.payload.address}\n`),this.params.payload.application&&(e+=`application: ${this.params.payload.application}\n`),this.params.payload.chain_id&&(e+=`chainId: ${this.params.payload.chain_id}\n`),e+=`message: ${this.params.payload.message}\n`,e+=`nonce: ${this.params.payload.nonce}`;const t=yield this.device.commands.typedCall("AptosSignMessage","AptosMessageSignature",Object.assign({},this.params)),{address:r,signature:i}=t.message;return Promise.resolve({path:$(this.params.address_n),address:r,signature:i,fullMessage:e})}))}},algoGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("AlgorandGetAddress","AlgorandAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},algoSignTransaction:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],Ot(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:wt(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("AlgorandSignTx","AlgorandSignedTx",Object.assign({},this.params)),{signature:t}=e.message;return{path:$(this.params.address_n),signature:t}}))}},cosmosGetAddress:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){var e;this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],this.hasBundle=!!(null===(e=this.payload)||void 0===e?void 0:e.bundle);const t=this.hasBundle?this.payload:{bundle:[this.payload]};Ot(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Ot(e,[{name:"path",required:!0},{name:"showOnOneKey",type:"boolean"}]);const i=null===(t=e.showOnOneKey)||void 0===t||t;this.params.push({address_n:r,show_display:i})}))}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=[];for(let t=0;t<this.params.length;t++){const r=this.params[t],i=yield this.device.commands.typedCall("CosmosGetAddress","CosmosAddress",Object.assign({},r)),{address:n}=i.message;e.push({path:$(r.address_n),address:n})}return Promise.resolve(this.hasBundle?e:e[0])}))}},cosmosSignTransaction:class extends mt{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],Ot(this.payload,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]);const{path:e,rawTx:t}=this.payload,r=G(e,3);this.params={address_n:r,raw_tx:wt(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return v(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("CosmosSignTx","CosmosSignedTx",Object.assign({},this.params)),{signature:t}=e.message;return{path:$(this.params.address_n),signature:t}}))}}});const sr=e=>{throw e instanceof n.HardwareError?e:"ERR_NETWORK"===e.code?n.ERRORS.TypedError(n.HardwareErrorCode.BridgeNotInstalled):"ECONNABORTED"===e.code?n.ERRORS.TypedError(n.HardwareErrorCode.BridgeTimeoutError):n.ERRORS.TypedError(e)},or=Se(t.d0.DeviceConnector);class ar{constructor(){this.listenTimestamp=0,this.current=null,this.upcoming=[],this.listening=!1,Xe.load(),this.transport=Xe.getTransport(),We.setConnector(this)}enumerate(){return v(this,void 0,void 0,(function*(){try{const e=yield this.transport.enumerate();return this.upcoming=e,this._reportDevicesChange(),{descriptors:e}}catch(e){sr(e)}}))}listen(){return v(this,void 0,void 0,(function*(){const e=null!==this.current,t=this.current||[];let r;this.listening=!0;try{if(or.debug("Start listening",t),this.listenTimestamp=(new Date).getTime(),r=e?yield this.transport.listen(t):yield this.transport.enumerate(),!this.listening)return;this.upcoming=r,or.debug("Listen result",r),this._reportDevicesChange(),this.listening&&this.listen()}catch(e){const t=(new Date).getTime()-this.listenTimestamp;or.debug("Listen error","timestamp",t,typeof e),t>1100?(yield(i=1e3,n=null,new Promise((e=>{setTimeout(e,i,n)}))),this.listening&&this.listen()):or.warn("Transport error")}var i,n}))}stop(){this.listening=!1}acquire(e,t){return v(this,void 0,void 0,(function*(){or.debug("acquire",e,t);const r=Ce.getSettings("env");try{let i;return i="react-native"===r?yield this.transport.acquire({uuid:e}):yield this.transport.acquire({path:e,previous:null!=t?t:null}),i}catch(e){or.debug("acquire error: ",e.message),sr(e)}}))}release(e,t){return v(this,void 0,void 0,(function*(){try{return yield this.transport.release(e,t)}catch(e){sr(e)}}))}_reportDevicesChange(){We.reportDeviceChange(this.upcoming)}}const dr=Se(t.d0.Core),ur=e=>({initSession:null==e?void 0:e.payload.initSession,passphraseState:null==e?void 0:e.payload.passphraseState,deviceId:null==e?void 0:e.payload.deviceId});let lr,cr,pr,hr,fr=[];const yr=[],gr=new Map;let mr=1;const vr={};let br={passphraseState:void 0};const _r=e=>v(void 0,void 0,void 0,(function*(){var t;if(!e.id||!e.payload||e.type!==De.CALL)return Promise.reject(n.ERRORS.TypedError("on call: message.id or message.payload is missing"));let r,i;try{r=function(e){const{method:t}=e.payload;if("string"!=typeof t)throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,"Method is not set");const r=nr[t];if(r)return new r(e);throw n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodInvalidParameter,`Method ${t} is not set`)}(e),r.connector=pr,r.postMessage=Lr,r.init()}catch(e){return Promise.reject(e)}if(We.emitter.on(Fe.CONNECT,Cr),!r.useDevice)try{const e=yield r.run();return Le(r.responseID,!0,e)}catch(e){return Le(r.responseID,!1,{error:e})}yr.push(r),yr.length>1&&dr.debug("should cancel the previous method execution: ",yr.map((e=>e.name)));const s=br.passphraseState!==r.payload.passphraseState;let o;br={passphraseState:r.payload.passphraseState},(s||r.payload.initSession)&&(dr.debug("passphrase state change, clear device cache"),We.clearDeviceCache(r.payload.connectId)),vr[mr]&&(vr[mr]=!1),mr+=1;try{o=yield Rr(r,mr)}catch(e){return Le(r.responseID,!1,{error:e})}dr.debug("Call API - setDevice: ",o.mainId),null===(t=r.setDevice)||void 0===t||t.call(r,o),o.on(Fe.PIN,Mr),o.on(Fe.BUTTON,Nr),o.on(Fe.PASSPHRASE,Dr),o.on(Fe.PASSPHRASE_ON_DEVICE,Br),o.on(Fe.FEATURES,Pr);try{const e=()=>v(void 0,void 0,void 0,(function*(){const e=V(o.features),t=W(o.features),s=r.getVersionRange()[e],a=r.getVersionRange()[t],d=null!=s?s:a;if(d&&o.features){const e=Z(o.features).join(".");if(f.default.valid(d.min)&&f.default.lt(e,d.min)){const t=Ce.getFirmwareStatus(o.features);if("none"===t||"valid"===t)throw n.ERRORS.TypedError(n.HardwareErrorCode.NewFirmwareUnRelease);return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodNeedUpgradeFirmware,`Device firmware version is too low, please update to ${d.min}`,{current:e,require:d.min}))}if(d.max&&f.default.valid(d.max)&&f.default.gte(e,d.max))return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodDeprecated,`Device firmware version is too high, this method has been deprecated in ${d.max}`,{current:e,deprecated:d.max}))}const u=o.hasUnexpectedMode(r.allowDeviceMode,r.requireDeviceMode);if(u)return u===Ne.NOT_IN_BOOTLOADER?Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceUnexpectedBootloaderMode)):Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceUnexpectedMode,u));if(r.deviceId&&r.checkDeviceId){if(!o.checkDeviceId(r.deviceId))return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceCheckDeviceIdError))}if(r.checkFirmwareRelease(),r.checkDeviceSupportFeature(),cr&&(yield Xe.reconfigure(o.getFirmwareVersion())),Or(r,o.features),o.hasUsePassphrase()&&r.useDevicePassphraseState){const e=(e=>{if(!e)return{support:!1};const t=V(e);if("touch"===t||"pro"===t)return{support:!0};const r=Z(e).join(".");return{support:f.default.gte(r,"2.4.0"),require:"2.4.0"}})(o.features);if(!e.support)return Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceNotSupportPassphrase,`Device not support passphrase, please update to ${e.require}`,{require:e.require}));const t=yield o.checkPassphraseState();if(Or(r,o.features),t)return We.clearDeviceCache(r.payload.connectId),Promise.reject(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceCheckPassphraseStateError))}try{yield r.checkSafetyLevelOnTestNet()}catch(e){const t=e instanceof n.HardwareError?e:n.ERRORS.TypedError(n.HardwareErrorCode.RuntimeError,"open safety check failed.");return i=Le(r.responseID,!1,{error:t}),void(null==hr||hr.resolve(i))}try{const e=yield r.run();dr.debug("Call API - Inner Method Run: "),i=Le(r.responseID,!0,e),null==hr||hr.resolve(i)}catch(e){dr.debug("Call API - Inner Method Run Error: ",e),i=Le(r.responseID,!1,{error:e}),null==hr||hr.resolve(i)}}));dr.debug("Call API - Device Run: ",o.mainId);const t=Object.assign({keepSession:r.payload.keepSession},ur(r)),s=()=>o.run(e,t);hr=n.createDeferred(s);try{return yield hr.promise}catch(e){return dr.debug("Device Run Error: ",e),Le(r.responseID,!1,{error:e})}}catch(e){i=Le(r.responseID,!1,{error:e}),null==hr||hr.reject(n.ERRORS.TypedError(n.HardwareErrorCode.CallMethodError,e.message)),dr.debug("Call API - Run Error: ",e)}finally{i&&r&&r.dispose();const e=r.responseID?yr.findIndex((e=>e.responseID===r.responseID)):-1;e>-1&&(yr.splice(e,1),dr.debug("Remove the finished method from the queue: ",yr.map((e=>e.name)))),Ar(),Ir(),xr(o)}}));function wr(e){if(!cr)throw n.ERRORS.TypedError(n.HardwareErrorCode.DeviceListNotInitialized);let t;const r=cr.allDevices();if(e.connectId)t=cr.getDevice(e.connectId);else if(1===r.length)[t]=r;else if(r.length>1)throw n.ERRORS.TypedError("firmwareUpdateV2"===e.name?n.HardwareErrorCode.FirmwareUpdateLimitOneDevice:n.HardwareErrorCode.SelectDevice);if(!t)throw n.ERRORS.TypedError(n.HardwareErrorCode.DeviceNotFound);return t.deviceConnector=pr,t}function Er(e){if(!e.connectId&&!cr)throw n.ERRORS.TypedError(n.HardwareErrorCode.DeviceListNotInitialized);if(!e.connectId)return wr(e);let t;return gr.has(e.connectId)?t=gr.get(e.connectId):(t=pt.fromDescriptor({id:e.connectId}),gr.set(e.connectId,t)),t.deviceConnector=pr,t}let Tr=0;function Sr(e,t){return v(this,void 0,void 0,(function*(){try{yield t.acquire(),yield t.initialize(ur(e))}catch(r){if(!(r.errorCode===n.HardwareErrorCode.BleTimeoutError&&Tr<=5))throw r;Tr+=1,dr.debug(`Bletooth connect timeout and will retry, retry count: ${Tr}`),yield Re(3e3),yield Sr(e,t)}}))}const Rr=(e,t)=>v(void 0,void 0,void 0,(function*(){let r=0;const i=e.payload&&e.payload.retryCount||5,s=e.payload&&e.payload.pollIntervalTime||1e3,o=e.payload&&e.payload.timeout||1e4;let a=null;dr.debug(`EnsureConnected function start, MAX_RETRY_COUNT=${i}, POLL_INTERVAL_TIME=${s} `);const d=(i=s)=>v(void 0,void 0,void 0,(function*(){return new Promise(((s,u)=>v(void 0,void 0,void 0,(function*(){if(!vr[t])return dr.debug("EnsureConnected function stop, polling id: ",t),void u(n.ERRORS.TypedError(n.HardwareErrorCode.PollingStop));a&&clearTimeout(a),a=setTimeout((()=>{u(n.ERRORS.TypedError(n.HardwareErrorCode.PollingTimeout))}),o),r+=1,dr.debug("EnsureConnected function try count: ",r," poll interval time: ",i);try{yield function(e){return v(this,void 0,void 0,(function*(){"react-native"===Ce.getSettings("env")&&e.connectId?yield Xe.configure():(cr||(cr=new ht,yield Xe.configure(),cr.connector=pr),yield cr.getDeviceLists(e.connectId,ur(e)))}))}(e)}catch(e){if(dr.debug("device list error: ",e),[n.HardwareErrorCode.BridgeNotInstalled,n.HardwareErrorCode.BridgeTimeoutError].includes(e.errorCode))return cr=void 0,void u(e);e.errorCode===n.HardwareErrorCode.TransportNotConfigured&&(yield Xe.configure())}const l=Ce.getSettings("env");let c;try{if(c="react-native"===l?Er(e):wr(e),c)return a&&clearTimeout(a),"react-native"===l&&(Tr=0,yield Sr(e,c)),void s(c)}catch(e){if(dr.debug("device error: ",e),[n.HardwareErrorCode.BlePermissionError,n.HardwareErrorCode.BleLocationError,n.HardwareErrorCode.BleLocationServicesDisabled,n.HardwareErrorCode.BleDeviceNotBonded,n.HardwareErrorCode.BleCharacteristicNotifyError,n.HardwareErrorCode.BleTimeoutError,n.HardwareErrorCode.BleWriteCharacteristicError,n.HardwareErrorCode.BleAlreadyConnected,n.HardwareErrorCode.FirmwareUpdateLimitOneDevice].includes(e.errorCode))return void u(e)}return r>5?(a&&clearTimeout(a),dr.debug("EnsureConnected get to max try count, will return: ",r),void u(n.ERRORS.TypedError(n.HardwareErrorCode.DeviceNotFound))):setTimeout((()=>s(d(1.5*i))),i)}))))}));return vr[t]=!0,d()})),Or=(e,t)=>{if(e.useDevicePassphraseState){if(!0===(null==t?void 0:t.passphrase_protection)&&!e.payload.passphraseState)throw We.clearDeviceCache(e.payload.connectId),n.ERRORS.TypedError(n.HardwareErrorCode.DeviceOpenedPassphrase);if(!1===(null==t?void 0:t.passphrase_protection)&&e.payload.passphraseState)throw We.clearDeviceCache(e.payload.connectId),n.ERRORS.TypedError(n.HardwareErrorCode.DeviceNotOpenedPassphrase)}},Ir=()=>{fr=[],dr.debug("Cleanup...")},xr=e=>{e.removeListener(Fe.PIN,Mr),e.removeListener(Fe.BUTTON,Nr),e.removeListener(Fe.PASSPHRASE,Dr),e.removeListener(Fe.PASSPHRASE_ON_DEVICE,Br),e.removeListener(Fe.FEATURES,Pr),We.emitter.removeListener(Fe.CONNECT,Cr)},Ar=()=>{Lr(Pe(Ne.CLOSE_UI_WINDOW))},Cr=e=>{const t="react-native"===Ce.getSettings("env")?e:e.toMessageObject();Lr(Ue(Fe.CONNECT,{device:t}))},kr=e=>{const t="react-native"===Ce.getSettings("env")?e:e.toMessageObject();Lr(Ue(Fe.DISCONNECT,{device:t}))},Mr=(...[e,t,r])=>v(void 0,void 0,void 0,(function*(){dr.debug("onDevicePinHandler");const i=qr(qe.RECEIVE_PIN,e);Lr(Pe(Ne.REQUEST_PIN,{device:e.toMessageObject(),type:t}));const n=yield i.promise;r(null,n.payload)})),Nr=(...[e,t])=>{Lr(Ue(Fe.BUTTON,Object.assign(Object.assign({},t),{device:e.toMessageObject()}))),"ButtonRequest_PinEntry"===t.code?Lr(Pe(Ne.REQUEST_PIN,{device:e.toMessageObject(),type:"ButtonRequest_PinEntry"})):Lr(Pe(Ne.REQUEST_BUTTON,{device:e.toMessageObject()}))},Pr=(...[e,t])=>{Lr(Ue(Fe.FEATURES,Object.assign({},t)))},Dr=(...[e,t])=>v(void 0,void 0,void 0,(function*(){dr.debug("onDevicePassphraseHandler");const r=qr(qe.RECEIVE_PASSPHRASE,e);Lr(Pe(Ne.REQUEST_PASSPHRASE,{device:e.toMessageObject(),passphraseState:e.passphraseState}));const i=yield r.promise,{value:n,passphraseOnDevice:s,save:o}=i.payload;t({passphrase:n.normalize("NFKD"),passphraseOnDevice:s,cache:o})})),Br=(...[e])=>{Lr(Pe(Ne.REQUEST_PASSPHRASE_ON_DEVICE,{device:e.toMessageObject(),passphraseState:e.passphraseState}))},Lr=e=>{lr.emit(ke,e)},qr=(e,t)=>{const r=n.createDeferred(e,t);return fr.push(r),r};class jr extends E.exports{handleMessage(e){var t,r,i,n;return v(this,void 0,void 0,(function*(){switch(e.type){case qe.RECEIVE_PIN:case qe.RECEIVE_PASSPHRASE:{const t=(o=e.type,fr.find((e=>e.id===o)));t&&(t.resolve(e),s=t,fr=fr.filter((e=>e!==s)));break}case Ne.BLUETOOTH_PERMISSION:case Ne.LOCATION_PERMISSION:case Ne.LOCATION_SERVICE_PERMISSION:Lr(e);break;case De.CALL:{const s=yield _r(e),{success:o,payload:a}=s;return o?s:Object.assign(Object.assign({},s),{payload:Object.assign(Object.assign({},a),{connectId:null!==(r=null===(t=e.payload)||void 0===t?void 0:t.connectId)&&void 0!==r?r:"",deviceId:null!==(n=null===(i=e.payload)||void 0===i?void 0:i.deviceId)&&void 0!==n?n:""})})}case De.CANCEL:(e=>{const t=Ce.getSettings("env");try{if(e){let r;r="react-native"===t?Er({connectId:e}):wr({connectId:e}),null==r||r.interruptionFromUser()}}catch(e){dr.error("Cancel API Error: ",e)}Ir(),Ar()})(e.payload.connectId)}var s,o;return Promise.resolve(e)}))}dispose(){}}t.Td=Fe,t.Fd=je,t.SI=ze,t.Bg=De,t.og=le,t.rF=Me,t.xG=e=>{let t={error:e.message,code:e.code};return e instanceof n.HardwareError&&(t={error:e.message,code:e.errorCode}),{success:!1,payload:t}},t.ZP=({init:e,call:t,dispose:r,eventEmitter:i,uiResponse:n,cancel:s})=>(({call:e,cancel:t,dispose:r,eventEmitter:i,init:n,uiResponse:s})=>({on:(e,t)=>{i.on(e,t)},off:(e,t)=>{i.removeListener(e,t)},removeAllListeners:e=>{i.removeAllListeners(e)},init:n,call:e,dispose:r,uiResponse:s,cancel:t,getLogs:()=>e({method:"getLogs"}),searchDevices:()=>e({method:"searchDevices"}),getFeatures:t=>e({connectId:t,method:"getFeatures"}),checkFirmwareRelease:t=>e({connectId:t,method:"checkFirmwareRelease"}),checkBLEFirmwareRelease:t=>e({connectId:t,method:"checkBLEFirmwareRelease"}),checkTransportRelease:()=>e({method:"checkTransportRelease"}),checkBridgeStatus:()=>e({method:"checkBridgeStatus"}),cipherKeyValue:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"cipherKeyValue"})),deviceBackup:t=>e({connectId:t,method:"deviceBackup"}),deviceChangePin:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceChangePin"})),deviceFlags:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceFlags"})),deviceRebootToBootloader:t=>e({connectId:t,method:"deviceRebootToBootloader"}),deviceRecovery:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceRecovery"})),deviceReset:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceReset"})),deviceSettings:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceSettings"})),deviceUpdateReboot:t=>e({connectId:t,method:"deviceUpdateReboot"}),deviceUploadResource:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceUploadResource"})),deviceSupportFeatures:t=>e({connectId:t,method:"deviceSupportFeatures"}),deviceVerify:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"deviceVerify"})),deviceWipe:t=>e({connectId:t,method:"deviceWipe"}),deviceFullyUploadResource:t=>e({connectId:t,method:"deviceFullyUploadResource"}),getPassphraseState:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"getPassphraseState"})),evmGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmGetAddress"})),evmGetPublicKey:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmGetPublicKey"})),evmSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmSignMessage"})),evmSignMessageEIP712:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmSignMessageEIP712"})),evmSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmSignTransaction"})),evmSignTypedData:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmSignTypedData"})),evmVerifyMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"evmVerifyMessage"})),btcGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcGetAddress"})),btcGetPublicKey:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcGetPublicKey"})),btcSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcSignMessage"})),btcSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcSignTransaction"})),btcVerifyMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"btcVerifyMessage"})),starcoinGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinGetAddress"})),starcoinGetPublicKey:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinGetPublicKey"})),starcoinSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinSignMessage"})),starcoinSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinSignTransaction"})),starcoinVerifyMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"starcoinVerifyMessage"})),nemGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"nemGetAddress"})),nemSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"nemSignTransaction"})),solGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"solGetAddress"})),solSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"solSignTransaction"})),stellarGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"stellarGetAddress"})),stellarSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"stellarSignTransaction"})),firmwareUpdate:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"firmwareUpdate"})),firmwareUpdateV2:(t,r)=>e(Object.assign(Object.assign({},r),{connectId:t,method:"firmwareUpdateV2"})),requestWebUsbDevice:()=>e({method:"requestWebUsbDevice"}),tronGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"tronGetAddress"})),tronSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"tronSignMessage"})),tronSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"tronSignTransaction"})),confluxGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"confluxGetAddress"})),confluxSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"confluxSignMessage"})),confluxSignMessageCIP23:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"confluxSignMessageCIP23"})),confluxSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"confluxSignTransaction"})),nearGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"nearGetAddress"})),nearSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"nearSignTransaction"})),aptosGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"aptosGetAddress"})),aptosGetPublicKey:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"aptosGetPublicKey"})),aptosSignMessage:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"aptosSignMessage"})),aptosSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"aptosSignTransaction"})),algoGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"algoGetAddress"})),algoSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"algoSignTransaction"})),cosmosGetAddress:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"cosmosGetAddress"})),cosmosSignTransaction:(t,r,i)=>e(Object.assign(Object.assign({},i),{connectId:t,deviceId:r,method:"cosmosSignTransaction"}))}))({init:e,call:t,dispose:r,eventEmitter:i,uiResponse:n,cancel:s}),t.yI=me,t.jl=Se,t._4=(e={})=>{const t=Object.assign({},at);let i;Object.prototype.hasOwnProperty.call(e,"debug")&&(t.debug=e.debug),e.isFrame&&(t.parentOrigin=e.parentOrigin),"string"==typeof e.connectSrc&&(t.connectSrc=e.connectSrc),"undefined"!=typeof window?i=window.ONEKEY_CONNECT_SRC:void 0!==r.g&&(i=r.g.ONEKEY_CONNECT_SRC),"string"==typeof i&&(t.connectSrc=ut(i),t.debug=!0);const n=t.connectSrc||ot;return t.iframeSrc=`${n}iframe.html`,e.transportReconnect&&(t.transportReconnect=e.transportReconnect),e.lazyLoad&&(t.lazyLoad=e.lazyLoad),"string"==typeof e.env?t.env=e.env:t.env=dt(),e.timestamp&&(t.timestamp=e.timestamp),t},t.kW=e=>{const{data:t}=e,r={event:t.event,type:t.type,payload:t.payload};return"number"==typeof e.id&&(r.id=e.id),"boolean"==typeof r.success&&(r.success=t.success),r},t.hZ=be},7495:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var i=r(3448),n=r(7808),s=r(9396),o=r(8834);function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function d(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var u=d(i),l=d(n),c=a(s);const p=["bool","string","bytes","int32","int64","uint32","uint64","sint32","sint64","fixed32","fixed64","sfixed32","sfixed64","double","float"],h=e=>p.includes(e),f=(e,t)=>e.optional&&void 0===t?null:"bytes"===e.type?c.default.wrap(t).toString("hex"):e.long?Number.isSafeInteger(t.toNumber())?t.toNumber():t.toString():t;function y(e,t){const r=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(e,[]),i={};return Object.keys(t).forEach((e=>{const n=t[e],s=r[e];if(n.repeated)if(h(n.type))i[e]=s.map((e=>f(n,e)));else if("valuesById"in n.resolvedType)i[e]=s;else{if(!("fields"in n.resolvedType))throw new Error(`case not handled for repeated key: ${e}`);i[e]=s.map((e=>y(e,n.resolvedType.fields)))}else if(h(n.type))i[e]=f(n,s);else if("valuesById"in n.resolvedType)i[e]=n.resolvedType.valuesById[s];else{if(!n.resolvedType.fields)throw new Error(`case not handled: ${e}`);i[e]=y(s,n.resolvedType.fields)}})),i}const g=(e,t)=>{if("bytes"===e)return"string"!=typeof t||t?o.Buffer.from(t,"hex"):t;if("number"==typeof t&&!Number.isSafeInteger(t))throw new RangeError("field value is not within safe integer range");return t};function m(e,t){const r={};return e.fields?(Object.keys(e.fields).forEach((i=>{const n=e.fields[i],s=t[i];if(void 0!==s)if(h(n.type))n.repeated?r[i]=s.map((e=>g(n.type,e))):r[i]=g(n.type,s);else if(n.repeated){const t=e.lookupTypeOrEnum(n.type);r[i]=s.map((e=>m(t,e)))}else if("object"==typeof s&&null!==s){const t=e.lookupType(n.type);r[i]=m(t,s)}else if("number"==typeof s){const t=e.lookupEnum(n.type);r[i]=t.values[s]}else r[i]=s})),r):r}const v=(e,t)=>{const r=m(e,t),i=e.fromObject(r),n=e.encode(i).finish(),s=new c.default(n.byteLength);return s.append(n),s.reset(),s};const b=(e,t)=>{const r=e.lookupType(t);let i=e.lookupEnum("MessageType").values[`MessageType_${t}`];return!i&&r.options&&(i=r.options["(wire_type)"]),{Message:r,messageType:i}},_=e=>{const{typeId:t}=(e=>({typeId:e.readUint16(),length:e.readUint32()}))(e);return{typeId:t,buffer:e}};var w=Object.freeze({__proto__:null,decode:_,decodeChunked:e=>{const t=c.default.wrap(e,void 0,void 0,!0),{sharp1:r,sharp2:i,typeId:n,length:s}=(e=>({sharp1:e.readByte(),sharp2:e.readByte(),typeId:e.readUint16(),length:e.readUint32()}))(t);if(35!==r||35!==i)throw new Error("Didn't receive expected header signature.");return{length:s,typeId:n,restBuffer:t}}});function E(e,t){const{addTrezorHeaders:r,chunked:i,messageType:n}=t,s=(r?8:6)+e.limit,o=new c.default(s);if(r&&(o.writeByte(35),o.writeByte(35)),o.writeUint16(n),o.writeUint32(e.limit),o.append(e.buffer),o.reset(),!1===i)return o;const a=[],d=Math.floor((o.limit-1)/63)+1||1;for(let e=0;e<d;e++){const t=63*e,r=Math.min(63*(e+1),o.limit),i=o.slice(t,r);i.compact(),a.push(i.buffer)}return a}const T=(e,t,r)=>{const{Message:i,messageType:n}=b(e,t);return E(v(i,r),{addTrezorHeaders:!0,chunked:!0,messageType:n})};const S="Wrong result type.";function R(e){if(null==e)return null;if("string"!=typeof e)throw new Error(S);return e}var O,I,x,A,C,k,M,N,P,D,B,L,q,j,F,U,z,H,$,G,W,V,K,Y,X,Z,J,Q,ee,te,re,ie,ne,se,oe,ae,de,ue,le,ce,pe,he=Object.freeze({__proto__:null,info:function(e){if("object"!=typeof e||null==e)throw new Error("Wrong result type.");const{version:t}=e;if("string"!=typeof t)throw new Error(S);return{version:t,configured:!!e.configured}},version:function(e){if("string"!=typeof e)throw new Error(S);return e.trim()},devices:function(e){if("object"!=typeof e)throw new Error(S);if(!(e instanceof Array))throw new Error(S);return e.map((e=>{if("object"!=typeof e||null==e)throw new Error(S);const{path:t}=e;if("string"!=typeof t)throw new Error(S);return{path:t.toString(),session:R(e.session),debugSession:R(e.debugSession),product:e.product,vendor:e.vendor,debug:!!e.debug}}))},acquire:function(e){if("object"!=typeof e||null==e)throw new Error(S);const{session:t}=e;if("string"!=typeof t&&"number"!=typeof t)throw new Error(S);return t.toString()},call:function(e){if("object"!=typeof e||null==e)throw new Error(S);const{type:t}=e;if("string"!=typeof t)throw new Error(S);const{message:r}=e;if("object"!=typeof r||null==r)throw new Error(S);return{type:t,message:r}}});t.BinanceOrderType=void 0,(O=t.BinanceOrderType||(t.BinanceOrderType={}))[O.OT_UNKNOWN=0]="OT_UNKNOWN",O[O.MARKET=1]="MARKET",O[O.LIMIT=2]="LIMIT",O[O.OT_RESERVED=3]="OT_RESERVED",t.BinanceOrderSide=void 0,(I=t.BinanceOrderSide||(t.BinanceOrderSide={}))[I.SIDE_UNKNOWN=0]="SIDE_UNKNOWN",I[I.BUY=1]="BUY",I[I.SELL=2]="SELL",t.BinanceTimeInForce=void 0,(x=t.BinanceTimeInForce||(t.BinanceTimeInForce={}))[x.TIF_UNKNOWN=0]="TIF_UNKNOWN",x[x.GTE=1]="GTE",x[x.TIF_RESERVED=2]="TIF_RESERVED",x[x.IOC=3]="IOC",t.Enum_InputScriptType=void 0,(A=t.Enum_InputScriptType||(t.Enum_InputScriptType={}))[A.SPENDADDRESS=0]="SPENDADDRESS",A[A.SPENDMULTISIG=1]="SPENDMULTISIG",A[A.EXTERNAL=2]="EXTERNAL",A[A.SPENDWITNESS=3]="SPENDWITNESS",A[A.SPENDP2SHWITNESS=4]="SPENDP2SHWITNESS",A[A.SPENDTAPROOT=5]="SPENDTAPROOT",t.Enum_OutputScriptType=void 0,(C=t.Enum_OutputScriptType||(t.Enum_OutputScriptType={}))[C.PAYTOADDRESS=0]="PAYTOADDRESS",C[C.PAYTOSCRIPTHASH=1]="PAYTOSCRIPTHASH",C[C.PAYTOMULTISIG=2]="PAYTOMULTISIG",C[C.PAYTOOPRETURN=3]="PAYTOOPRETURN",C[C.PAYTOWITNESS=4]="PAYTOWITNESS",C[C.PAYTOP2SHWITNESS=5]="PAYTOP2SHWITNESS",C[C.PAYTOTAPROOT=6]="PAYTOTAPROOT",t.DecredStakingSpendType=void 0,(k=t.DecredStakingSpendType||(t.DecredStakingSpendType={}))[k.SSGen=0]="SSGen",k[k.SSRTX=1]="SSRTX",t.AmountUnit=void 0,(M=t.AmountUnit||(t.AmountUnit={}))[M.BITCOIN=0]="BITCOIN",M[M.MILLIBITCOIN=1]="MILLIBITCOIN",M[M.MICROBITCOIN=2]="MICROBITCOIN",M[M.SATOSHI=3]="SATOSHI",t.Enum_RequestType=void 0,(N=t.Enum_RequestType||(t.Enum_RequestType={}))[N.TXINPUT=0]="TXINPUT",N[N.TXOUTPUT=1]="TXOUTPUT",N[N.TXMETA=2]="TXMETA",N[N.TXFINISHED=3]="TXFINISHED",N[N.TXEXTRADATA=4]="TXEXTRADATA",N[N.TXORIGINPUT=5]="TXORIGINPUT",N[N.TXORIGOUTPUT=6]="TXORIGOUTPUT",t.CardanoDerivationType=void 0,(P=t.CardanoDerivationType||(t.CardanoDerivationType={}))[P.LEDGER=0]="LEDGER",P[P.ICARUS=1]="ICARUS",P[P.ICARUS_TREZOR=2]="ICARUS_TREZOR",t.CardanoAddressType=void 0,(D=t.CardanoAddressType||(t.CardanoAddressType={}))[D.BASE=0]="BASE",D[D.BASE_SCRIPT_KEY=1]="BASE_SCRIPT_KEY",D[D.BASE_KEY_SCRIPT=2]="BASE_KEY_SCRIPT",D[D.BASE_SCRIPT_SCRIPT=3]="BASE_SCRIPT_SCRIPT",D[D.POINTER=4]="POINTER",D[D.POINTER_SCRIPT=5]="POINTER_SCRIPT",D[D.ENTERPRISE=6]="ENTERPRISE",D[D.ENTERPRISE_SCRIPT=7]="ENTERPRISE_SCRIPT",D[D.BYRON=8]="BYRON",D[D.REWARD=14]="REWARD",D[D.REWARD_SCRIPT=15]="REWARD_SCRIPT",t.CardanoNativeScriptType=void 0,(B=t.CardanoNativeScriptType||(t.CardanoNativeScriptType={}))[B.PUB_KEY=0]="PUB_KEY",B[B.ALL=1]="ALL",B[B.ANY=2]="ANY",B[B.N_OF_K=3]="N_OF_K",B[B.INVALID_BEFORE=4]="INVALID_BEFORE",B[B.INVALID_HEREAFTER=5]="INVALID_HEREAFTER",t.CardanoNativeScriptHashDisplayFormat=void 0,(L=t.CardanoNativeScriptHashDisplayFormat||(t.CardanoNativeScriptHashDisplayFormat={}))[L.HIDE=0]="HIDE",L[L.BECH32=1]="BECH32",L[L.POLICY_ID=2]="POLICY_ID",t.CardanoCertificateType=void 0,(q=t.CardanoCertificateType||(t.CardanoCertificateType={}))[q.STAKE_REGISTRATION=0]="STAKE_REGISTRATION",q[q.STAKE_DEREGISTRATION=1]="STAKE_DEREGISTRATION",q[q.STAKE_DELEGATION=2]="STAKE_DELEGATION",q[q.STAKE_POOL_REGISTRATION=3]="STAKE_POOL_REGISTRATION",t.CardanoPoolRelayType=void 0,(j=t.CardanoPoolRelayType||(t.CardanoPoolRelayType={}))[j.SINGLE_HOST_IP=0]="SINGLE_HOST_IP",j[j.SINGLE_HOST_NAME=1]="SINGLE_HOST_NAME",j[j.MULTIPLE_HOST_NAME=2]="MULTIPLE_HOST_NAME",t.CardanoTxAuxiliaryDataSupplementType=void 0,(F=t.CardanoTxAuxiliaryDataSupplementType||(t.CardanoTxAuxiliaryDataSupplementType={}))[F.NONE=0]="NONE",F[F.CATALYST_REGISTRATION_SIGNATURE=1]="CATALYST_REGISTRATION_SIGNATURE",t.CardanoTxSigningMode=void 0,(U=t.CardanoTxSigningMode||(t.CardanoTxSigningMode={}))[U.ORDINARY_TRANSACTION=0]="ORDINARY_TRANSACTION",U[U.POOL_REGISTRATION_AS_OWNER=1]="POOL_REGISTRATION_AS_OWNER",U[U.MULTISIG_TRANSACTION=2]="MULTISIG_TRANSACTION",t.CardanoTxWitnessType=void 0,(z=t.CardanoTxWitnessType||(t.CardanoTxWitnessType={}))[z.BYRON_WITNESS=0]="BYRON_WITNESS",z[z.SHELLEY_WITNESS=1]="SHELLEY_WITNESS",t.FailureType=void 0,(H=t.FailureType||(t.FailureType={}))[H.Failure_UnexpectedMessage=1]="Failure_UnexpectedMessage",H[H.Failure_ButtonExpected=2]="Failure_ButtonExpected",H[H.Failure_DataError=3]="Failure_DataError",H[H.Failure_ActionCancelled=4]="Failure_ActionCancelled",H[H.Failure_PinExpected=5]="Failure_PinExpected",H[H.Failure_PinCancelled=6]="Failure_PinCancelled",H[H.Failure_PinInvalid=7]="Failure_PinInvalid",H[H.Failure_InvalidSignature=8]="Failure_InvalidSignature",H[H.Failure_ProcessError=9]="Failure_ProcessError",H[H.Failure_NotEnoughFunds=10]="Failure_NotEnoughFunds",H[H.Failure_NotInitialized=11]="Failure_NotInitialized",H[H.Failure_PinMismatch=12]="Failure_PinMismatch",H[H.Failure_WipeCodeMismatch=13]="Failure_WipeCodeMismatch",H[H.Failure_InvalidSession=14]="Failure_InvalidSession",H[H.Failure_FirmwareError=99]="Failure_FirmwareError",t.Enum_ButtonRequestType=void 0,($=t.Enum_ButtonRequestType||(t.Enum_ButtonRequestType={}))[$.ButtonRequest_Other=1]="ButtonRequest_Other",$[$.ButtonRequest_FeeOverThreshold=2]="ButtonRequest_FeeOverThreshold",$[$.ButtonRequest_ConfirmOutput=3]="ButtonRequest_ConfirmOutput",$[$.ButtonRequest_ResetDevice=4]="ButtonRequest_ResetDevice",$[$.ButtonRequest_ConfirmWord=5]="ButtonRequest_ConfirmWord",$[$.ButtonRequest_WipeDevice=6]="ButtonRequest_WipeDevice",$[$.ButtonRequest_ProtectCall=7]="ButtonRequest_ProtectCall",$[$.ButtonRequest_SignTx=8]="ButtonRequest_SignTx",$[$.ButtonRequest_FirmwareCheck=9]="ButtonRequest_FirmwareCheck",$[$.ButtonRequest_Address=10]="ButtonRequest_Address",$[$.ButtonRequest_PublicKey=11]="ButtonRequest_PublicKey",$[$.ButtonRequest_MnemonicWordCount=12]="ButtonRequest_MnemonicWordCount",$[$.ButtonRequest_MnemonicInput=13]="ButtonRequest_MnemonicInput",$[$._Deprecated_ButtonRequest_PassphraseType=14]="_Deprecated_ButtonRequest_PassphraseType",$[$.ButtonRequest_UnknownDerivationPath=15]="ButtonRequest_UnknownDerivationPath",$[$.ButtonRequest_RecoveryHomepage=16]="ButtonRequest_RecoveryHomepage",$[$.ButtonRequest_Success=17]="ButtonRequest_Success",$[$.ButtonRequest_Warning=18]="ButtonRequest_Warning",$[$.ButtonRequest_PassphraseEntry=19]="ButtonRequest_PassphraseEntry",$[$.ButtonRequest_PinEntry=20]="ButtonRequest_PinEntry",t.Enum_PinMatrixRequestType=void 0,(G=t.Enum_PinMatrixRequestType||(t.Enum_PinMatrixRequestType={}))[G.PinMatrixRequestType_Current=1]="PinMatrixRequestType_Current",G[G.PinMatrixRequestType_NewFirst=2]="PinMatrixRequestType_NewFirst",G[G.PinMatrixRequestType_NewSecond=3]="PinMatrixRequestType_NewSecond",G[G.PinMatrixRequestType_WipeCodeFirst=4]="PinMatrixRequestType_WipeCodeFirst",G[G.PinMatrixRequestType_WipeCodeSecond=5]="PinMatrixRequestType_WipeCodeSecond",G[G.PinMatrixRequestType_BackupFirst=6]="PinMatrixRequestType_BackupFirst",G[G.PinMatrixRequestType_BackupSecond=7]="PinMatrixRequestType_BackupSecond",t.EthereumDataType=void 0,(W=t.EthereumDataType||(t.EthereumDataType={}))[W.UINT=1]="UINT",W[W.INT=2]="INT",W[W.BYTES=3]="BYTES",W[W.STRING=4]="STRING",W[W.BOOL=5]="BOOL",W[W.ADDRESS=6]="ADDRESS",W[W.ARRAY=7]="ARRAY",W[W.STRUCT=8]="STRUCT",t.Enum_BackupType=void 0,(V=t.Enum_BackupType||(t.Enum_BackupType={}))[V.Bip39=0]="Bip39",V[V.Slip39_Basic=1]="Slip39_Basic",V[V.Slip39_Advanced=2]="Slip39_Advanced",t.Enum_SafetyCheckLevel=void 0,(K=t.Enum_SafetyCheckLevel||(t.Enum_SafetyCheckLevel={}))[K.Strict=0]="Strict",K[K.PromptAlways=1]="PromptAlways",K[K.PromptTemporarily=2]="PromptTemporarily",t.Enum_Capability=void 0,(Y=t.Enum_Capability||(t.Enum_Capability={}))[Y.Capability_Bitcoin=1]="Capability_Bitcoin",Y[Y.Capability_Bitcoin_like=2]="Capability_Bitcoin_like",Y[Y.Capability_Binance=3]="Capability_Binance",Y[Y.Capability_Cardano=4]="Capability_Cardano",Y[Y.Capability_Crypto=5]="Capability_Crypto",Y[Y.Capability_EOS=6]="Capability_EOS",Y[Y.Capability_Ethereum=7]="Capability_Ethereum",Y[Y.Capability_Lisk=8]="Capability_Lisk",Y[Y.Capability_Monero=9]="Capability_Monero",Y[Y.Capability_NEM=10]="Capability_NEM",Y[Y.Capability_Ripple=11]="Capability_Ripple",Y[Y.Capability_Stellar=12]="Capability_Stellar",Y[Y.Capability_Tezos=13]="Capability_Tezos",Y[Y.Capability_U2F=14]="Capability_U2F",Y[Y.Capability_Shamir=15]="Capability_Shamir",Y[Y.Capability_ShamirGroups=16]="Capability_ShamirGroups",Y[Y.Capability_PassphraseEntry=17]="Capability_PassphraseEntry",t.ExportType=void 0,(X=t.ExportType||(t.ExportType={}))[X.SeedEncExportType_NO=0]="SeedEncExportType_NO",X[X.SeedEncExportType_YES=1]="SeedEncExportType_YES",X[X.MnemonicPlainExportType_YES=2]="MnemonicPlainExportType_YES",t.SdProtectOperationType=void 0,(Z=t.SdProtectOperationType||(t.SdProtectOperationType={}))[Z.DISABLE=0]="DISABLE",Z[Z.ENABLE=1]="ENABLE",Z[Z.REFRESH=2]="REFRESH",t.RecoveryDeviceType=void 0,(J=t.RecoveryDeviceType||(t.RecoveryDeviceType={}))[J.RecoveryDeviceType_ScrambledWords=0]="RecoveryDeviceType_ScrambledWords",J[J.RecoveryDeviceType_Matrix=1]="RecoveryDeviceType_Matrix",t.Enum_WordRequestType=void 0,(Q=t.Enum_WordRequestType||(t.Enum_WordRequestType={}))[Q.WordRequestType_Plain=0]="WordRequestType_Plain",Q[Q.WordRequestType_Matrix9=1]="WordRequestType_Matrix9",Q[Q.WordRequestType_Matrix6=2]="WordRequestType_Matrix6",t.SeedRequestType=void 0,(ee=t.SeedRequestType||(t.SeedRequestType={}))[ee.SeedRequestType_Gen=0]="SeedRequestType_Gen",ee[ee.SeedRequestType_EncExport=1]="SeedRequestType_EncExport",ee[ee.SeedRequestType_EncImport=2]="SeedRequestType_EncImport",t.WL_OperationType=void 0,(te=t.WL_OperationType||(t.WL_OperationType={}))[te.WL_OperationType_Add=0]="WL_OperationType_Add",te[te.WL_OperationType_Delete=1]="WL_OperationType_Delete",te[te.WL_OperationType_Inquire=2]="WL_OperationType_Inquire",t.ResourceType=void 0,(re=t.ResourceType||(t.ResourceType={}))[re.WallPaper=0]="WallPaper",re[re.Nft=1]="Nft",t.NEMMosaicLevy=void 0,(ie=t.NEMMosaicLevy||(t.NEMMosaicLevy={}))[ie.MosaicLevy_Absolute=1]="MosaicLevy_Absolute",ie[ie.MosaicLevy_Percentile=2]="MosaicLevy_Percentile",t.NEMSupplyChangeType=void 0,(ne=t.NEMSupplyChangeType||(t.NEMSupplyChangeType={}))[ne.SupplyChange_Increase=1]="SupplyChange_Increase",ne[ne.SupplyChange_Decrease=2]="SupplyChange_Decrease",t.NEMModificationType=void 0,(se=t.NEMModificationType||(t.NEMModificationType={}))[se.CosignatoryModification_Add=1]="CosignatoryModification_Add",se[se.CosignatoryModification_Delete=2]="CosignatoryModification_Delete",t.NEMImportanceTransferMode=void 0,(oe=t.NEMImportanceTransferMode||(t.NEMImportanceTransferMode={}))[oe.ImportanceTransfer_Activate=1]="ImportanceTransfer_Activate",oe[oe.ImportanceTransfer_Deactivate=2]="ImportanceTransfer_Deactivate",t.StellarAssetType=void 0,(ae=t.StellarAssetType||(t.StellarAssetType={}))[ae.NATIVE=0]="NATIVE",ae[ae.ALPHANUM4=1]="ALPHANUM4",ae[ae.ALPHANUM12=2]="ALPHANUM12",t.StellarMemoType=void 0,(de=t.StellarMemoType||(t.StellarMemoType={}))[de.NONE=0]="NONE",de[de.TEXT=1]="TEXT",de[de.ID=2]="ID",de[de.HASH=3]="HASH",de[de.RETURN=4]="RETURN",t.StellarSignerType=void 0,(ue=t.StellarSignerType||(t.StellarSignerType={}))[ue.ACCOUNT=0]="ACCOUNT",ue[ue.PRE_AUTH=1]="PRE_AUTH",ue[ue.HASH=2]="HASH",t.TezosContractType=void 0,(le=t.TezosContractType||(t.TezosContractType={}))[le.Implicit=0]="Implicit",le[le.Originated=1]="Originated",t.TezosBallotType=void 0,(ce=t.TezosBallotType||(t.TezosBallotType={}))[ce.Yay=0]="Yay",ce[ce.Nay=1]="Nay",ce[ce.Pass=2]="Pass",t.CommandFlags=void 0,(pe=t.CommandFlags||(t.CommandFlags={}))[pe.Default=0]="Default",pe[pe.Factory_Only=1]="Factory_Only";var fe=Object.freeze({__proto__:null,get BinanceOrderType(){return t.BinanceOrderType},get BinanceOrderSide(){return t.BinanceOrderSide},get BinanceTimeInForce(){return t.BinanceTimeInForce},get Enum_InputScriptType(){return t.Enum_InputScriptType},get Enum_OutputScriptType(){return t.Enum_OutputScriptType},get DecredStakingSpendType(){return t.DecredStakingSpendType},get AmountUnit(){return t.AmountUnit},get Enum_RequestType(){return t.Enum_RequestType},get CardanoDerivationType(){return t.CardanoDerivationType},get CardanoAddressType(){return t.CardanoAddressType},get CardanoNativeScriptType(){return t.CardanoNativeScriptType},get CardanoNativeScriptHashDisplayFormat(){return t.CardanoNativeScriptHashDisplayFormat},get CardanoCertificateType(){return t.CardanoCertificateType},get CardanoPoolRelayType(){return t.CardanoPoolRelayType},get CardanoTxAuxiliaryDataSupplementType(){return t.CardanoTxAuxiliaryDataSupplementType},get CardanoTxSigningMode(){return t.CardanoTxSigningMode},get CardanoTxWitnessType(){return t.CardanoTxWitnessType},get FailureType(){return t.FailureType},get Enum_ButtonRequestType(){return t.Enum_ButtonRequestType},get Enum_PinMatrixRequestType(){return t.Enum_PinMatrixRequestType},get EthereumDataType(){return t.EthereumDataType},get Enum_BackupType(){return t.Enum_BackupType},get Enum_SafetyCheckLevel(){return t.Enum_SafetyCheckLevel},get Enum_Capability(){return t.Enum_Capability},get ExportType(){return t.ExportType},get SdProtectOperationType(){return t.SdProtectOperationType},get RecoveryDeviceType(){return t.RecoveryDeviceType},get Enum_WordRequestType(){return t.Enum_WordRequestType},get SeedRequestType(){return t.SeedRequestType},get WL_OperationType(){return t.WL_OperationType},get ResourceType(){return t.ResourceType},get NEMMosaicLevy(){return t.NEMMosaicLevy},get NEMSupplyChangeType(){return t.NEMSupplyChangeType},get NEMModificationType(){return t.NEMModificationType},get NEMImportanceTransferMode(){return t.NEMImportanceTransferMode},get StellarAssetType(){return t.StellarAssetType},get StellarMemoType(){return t.StellarMemoType},get StellarSignerType(){return t.StellarSignerType},get TezosContractType(){return t.TezosContractType},get TezosBallotType(){return t.TezosBallotType},get CommandFlags(){return t.CommandFlags}});u.util.Long=l,u.configure();var ye={check:he,buildOne:function(e,t,r){const{Message:i,messageType:n}=b(e,t);return E(v(i,r),{addTrezorHeaders:!1,chunked:!1,messageType:n})},buildBuffers:(e,t,r)=>{const i=T(e,t,r),n=[];for(const e of i){const t=new c.default(64);t.writeByte(63),t.append(e),t.reset(),n.push(t)}return n},buildEncodeBuffers:T,receiveOne:function(e,t){const r=c.default.wrap(t,"hex"),{typeId:i,buffer:n}=_(r),{Message:s,messageName:o}=((e,t)=>{const r=e.lookupEnum("MessageType").valuesById[t].replace("MessageType_","");return{Message:e.lookupType(r),messageName:r}})(e,i),a=((e,t)=>{const r=t.toBuffer(),i=new Uint8Array(r),n=e.decode(i);return y(n,n.$type.fields)})(s,n);return{message:a,type:o}},parseConfigure:function(e){return"string"==typeof e?u.Root.fromJSON(JSON.parse(e)):u.Root.fromJSON(e)},decodeProtocol:w};t.BUFFER_SIZE=63,t.COMMON_HEADER_SIZE=6,t.HEADER_SIZE=8,t.MESSAGE_HEADER_BYTE=35,t.MESSAGE_TOP_CHAR=63,t.Messages=fe,t.default=ye},8402:(e,t)=>{"use strict";function r(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))}Object.defineProperty(t,"__esModule",{value:!0});class i extends Error{constructor(e){var t;super(),this.errorCode=n.UnknownError,this.message="",this.params={};const r=s;if(this.message=r[n.UnknownError],"string"==typeof e)this.errorCode=n.UnknownError,this.message=e;else{const n=null!==(t=e.message||r[e.errorCode])&&void 0!==t?t:"";n&&(this.message=(o=e,"string"!=typeof(i=n)?i:i.replace(/\{([^}]+)\}/g,((e,t)=>o[t]||"?")))),this.params=e.params,this.errorCode=e.errorCode}var i,o;this.name="HardwareError"}}const n={UnknownError:0,DeviceFwException:101,DeviceUnexpectedMode:102,DeviceListNotInitialized:103,SelectDevice:104,DeviceNotFound:105,DeviceInitializeFailed:106,DeviceInterruptedFromOutside:107,DeviceUnexpectedBootloaderMode:108,DeviceInterruptedFromUser:109,DeviceCheckDeviceIdError:110,DeviceNotSupportPassphrase:111,DeviceCheckPassphraseStateError:112,DeviceNotOpenedPassphrase:113,DeviceOpenedPassphrase:114,NotInitialized:200,IFrameNotInitialized:300,IFrameAleradyInitialized:301,IFrameLoadFail:302,IframeTimeout:303,IframeBlocked:304,CallMethodError:400,CallMethodNotResponse:404,CallMethodInvalidParameter:405,FirmwareUpdateDownloadFailed:406,CallMethodNeedUpgradeFirmware:407,CallMethodDeprecated:408,FirmwareUpdateLimitOneDevice:409,FirmwareUpdateManuallyEnterBoot:410,FirmwareUpdateAutoEnterBootFailure:411,NewFirmwareUnRelease:412,NetworkError:500,TransportNotConfigured:600,TransportCallInProgress:601,TransportNotFound:602,TransportInvalidProtobuf:603,BleScanError:700,BlePermissionError:701,BleLocationError:702,BleRequiredUUID:703,BleConnectedError:704,BleDeviceNotBonded:705,BleServiceNotFound:706,BleCharacteristicNotFound:707,BleMonitorError:708,BleCharacteristicNotifyError:709,BleWriteCharacteristicError:710,BleAlreadyConnected:711,BleLocationServicesDisabled:712,BleTimeoutError:713,RuntimeError:800,PinInvalid:801,PinCancelled:802,ActionCancelled:803,FirmwareError:804,ResponseUnexpectTypeError:805,BridgeNetworkError:806,BridgeTimeoutError:807,BridgeNotInstalled:808,PollingTimeout:809,PollingStop:810,BlindSignDisabled:811,UnexpectPassphrase:812},s={[n.UnknownError]:"Unknown error occurred. Check message property.",[n.DeviceFwException]:"Firmware version mismatch",[n.DeviceUnexpectedMode]:"Device unexpected mode",[n.DeviceListNotInitialized]:"Device list is not initialized",[n.SelectDevice]:"Please select the connected device",[n.DeviceNotFound]:"Device not found",[n.DeviceInitializeFailed]:"Device initialization failed",[n.DeviceInterruptedFromOutside]:"Device interrupted",[n.DeviceInterruptedFromUser]:"Device interrupted",[n.DeviceUnexpectedBootloaderMode]:"Device should be in bootloader mode",[n.DeviceCheckDeviceIdError]:"Device Id in the features is not same.",[n.DeviceNotSupportPassphrase]:"Device not support passphrase",[n.DeviceCheckPassphraseStateError]:"Device passphrase state error",[n.DeviceNotOpenedPassphrase]:"Device not opened passphrase",[n.DeviceOpenedPassphrase]:"Device opened passphrase",[n.NotInitialized]:"Not initialized",[n.IFrameNotInitialized]:"IFrame not initialized",[n.IFrameAleradyInitialized]:"IFrame alerady initialized",[n.IFrameLoadFail]:"IFrame load fail",[n.IframeTimeout]:"init iframe time out",[n.IframeBlocked]:"IFrame blocked",[n.CallMethodError]:"Runtime errors during method execution",[n.CallMethodNotResponse]:"Method does not responding",[n.CallMethodInvalidParameter]:"Call method invalid parameter",[n.FirmwareUpdateDownloadFailed]:"Firmware update download failed",[n.CallMethodNeedUpgradeFirmware]:"Call method need upgrade firmware",[n.CallMethodDeprecated]:"Call method is deprecated",[n.FirmwareUpdateLimitOneDevice]:"Only one device can be connected during firmware upgrade",[n.FirmwareUpdateManuallyEnterBoot]:"You need to manually enter boot",[n.FirmwareUpdateAutoEnterBootFailure]:"Description Failed to automatically enter boot",[n.NewFirmwareUnRelease]:"new firmware has not been released yet",[n.NetworkError]:"Network request error",[n.TransportNotConfigured]:"Transport not configured",[n.TransportCallInProgress]:"Transport call in progress",[n.TransportNotFound]:"Transport not found",[n.TransportInvalidProtobuf]:"Transport invalid protobuf",[n.BleScanError]:"BLE scan error",[n.BlePermissionError]:"Bluetooth required to be turned on",[n.BleLocationError]:"Location permissions for the application are not available",[n.BleRequiredUUID]:"uuid is required",[n.BleConnectedError]:"connected error is always runtime error",[n.BleDeviceNotBonded]:"device is not bonded",[n.BleServiceNotFound]:"BLEServiceNotFound: service not found",[n.BleCharacteristicNotFound]:"BLEServiceNotFound: service not found",[n.BleMonitorError]:"Monitor Error: characteristic not found",[n.BleCharacteristicNotifyError]:"Characteristic Notify Error",[n.BleWriteCharacteristicError]:"Write Characteristic Error",[n.BleAlreadyConnected]:"Already connected to device",[n.BleLocationServicesDisabled]:"Location Services disabled",[n.BleTimeoutError]:"The connection has timed out unexpectedly.",[n.RuntimeError]:"Runtime error",[n.PinInvalid]:"Pin invalid",[n.PinCancelled]:"Pin cancelled",[n.ActionCancelled]:"Action cancelled by user",[n.FirmwareError]:"Firmware installation failed",[n.ResponseUnexpectTypeError]:"Response type is not expected",[n.BridgeNetworkError]:"Bridge network error",[n.BridgeTimeoutError]:"Bridge network timeout",[n.BridgeNotInstalled]:"Bridge not installed",[n.PollingTimeout]:"Polling timeout",[n.PollingStop]:"Polling stop",[n.BlindSignDisabled]:"Please confirm the BlindSign enabled",[n.UnexpectPassphrase]:"Unexpect passphrase"},o=(e,t,r)=>new i("string"==typeof e?e:{errorCode:e,message:null!=t?t:"",params:r}),a=e=>e&&e.error instanceof i?{error:e.error.message,code:e.error.errorCode,params:e.error.params}:e&&e.error instanceof Error?{error:e.error.message,code:e.error.code}:e,d=e=>{for(const t of Object.values(n))if(s[t]===e)return o(t);return new i(e)};var u=Object.freeze({__proto__:null,HardwareError:i,HardwareErrorCode:n,HardwareErrorCodeMessage:s,TypedError:o,serializeError:a,CreateErrorByMessage:d});t.CreateErrorByMessage=d,t.ERRORS=u,t.HardwareError=i,t.HardwareErrorCode=n,t.HardwareErrorCodeMessage=s,t.TypedError=o,t.createDeferred=function(e,t){let i,n=e=>{},s=e=>{};const o=new Promise(((t,o)=>r(this,void 0,void 0,(function*(){if(n=t,s=o,"function"==typeof e)try{yield e()}catch(e){o(e)}"string"==typeof e&&(i=e)}))));return{id:i,data:t,resolve:n,reject:s,promise:o}},t.serializeError=a},5766:(e,t)=>{"use strict";t.byteLength=function(e){var t=d(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,s=d(e),o=s[0],a=s[1],u=new n(function(e,t,r){return 3*(t+r)/4-r}(0,o,a)),l=0,c=a>0?o-4:o;for(r=0;r<c;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],u[l++]=t>>16&255,u[l++]=t>>8&255,u[l++]=255&t;2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,u[l++]=255&t);1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,u[l++]=t>>8&255,u[l++]=255&t);return u},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s=[],o=16383,a=0,d=i-n;a<d;a+=o)s.push(u(e,a,a+o>d?d:a+o));1===n?(t=e[i-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===n&&(t=(e[i-2]<<8)+e[i-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return s.join("")};for(var r=[],i=[],n="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)r[o]=s[o],i[s.charCodeAt(o)]=o;function d(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function u(e,t,i){for(var n,s,o=[],a=t;a<i;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[(s=n)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},6391:function(e,t,r){var i;!function(n){"use strict";var s,o=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,a=Math.ceil,d=Math.floor,u="[BigNumber Error] ",l=u+"Number primitive has more than 15 significant digits: ",c=1e14,p=14,h=9007199254740991,f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],y=1e7,g=1e9;function m(e){var t=0|e;return e>0||e===t?t:t-1}function v(e){for(var t,r,i=1,n=e.length,s=e[0]+"";i<n;){for(t=e[i++]+"",r=p-t.length;r--;t="0"+t);s+=t}for(n=s.length;48===s.charCodeAt(--n););return s.slice(0,n+1||1)}function b(e,t){var r,i,n=e.c,s=t.c,o=e.s,a=t.s,d=e.e,u=t.e;if(!o||!a)return null;if(r=n&&!n[0],i=s&&!s[0],r||i)return r?i?0:-a:o;if(o!=a)return o;if(r=o<0,i=d==u,!n||!s)return i?0:!n^r?1:-1;if(!i)return d>u^r?1:-1;for(a=(d=n.length)<(u=s.length)?d:u,o=0;o<a;o++)if(n[o]!=s[o])return n[o]>s[o]^r?1:-1;return d==u?0:d>u^r?1:-1}function _(e,t,r,i){if(e<t||e>r||e!==d(e))throw Error(u+(i||"Argument")+("number"==typeof e?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function w(e){var t=e.c.length-1;return m(e.e/p)==t&&e.c[t]%2!=0}function E(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function T(e,t,r){var i,n;if(t<0){for(n=r+".";++t;n+=r);e=n+e}else if(++t>(i=e.length)){for(n=r,t-=i;--t;n+=r);e+=n}else t<i&&(e=e.slice(0,t)+"."+e.slice(t));return e}s=function e(t){var r,i,n,s,S,R,O,I,x,A,C=$.prototype={constructor:$,toString:null,valueOf:null},k=new $(1),M=20,N=4,P=-7,D=21,B=-1e7,L=1e7,q=!1,j=1,F=0,U={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function $(e,t){var r,s,a,u,c,f,y,g,m=this;if(!(m instanceof $))return new $(e,t);if(null==t){if(e&&!0===e._isBigNumber)return m.s=e.s,void(!e.c||e.e>L?m.c=m.e=null:e.e<B?m.c=[m.e=0]:(m.e=e.e,m.c=e.c.slice()));if((f="number"==typeof e)&&0*e==0){if(m.s=1/e<0?(e=-e,-1):1,e===~~e){for(u=0,c=e;c>=10;c/=10,u++);return void(u>L?m.c=m.e=null:(m.e=u,m.c=[e]))}g=String(e)}else{if(!o.test(g=String(e)))return n(m,g,f);m.s=45==g.charCodeAt(0)?(g=g.slice(1),-1):1}(u=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(u<0&&(u=c),u+=+g.slice(c+1),g=g.substring(0,c)):u<0&&(u=g.length)}else{if(_(t,2,z.length,"Base"),10==t&&H)return K(m=new $(e),M+m.e+1,N);if(g=String(e),f="number"==typeof e){if(0*e!=0)return n(m,g,f,t);if(m.s=1/e<0?(g=g.slice(1),-1):1,$.DEBUG&&g.replace(/^0\.0*|\./,"").length>15)throw Error(l+e)}else m.s=45===g.charCodeAt(0)?(g=g.slice(1),-1):1;for(r=z.slice(0,t),u=c=0,y=g.length;c<y;c++)if(r.indexOf(s=g.charAt(c))<0){if("."==s){if(c>u){u=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,u=0;continue}return n(m,String(e),f,t)}f=!1,(u=(g=i(g,t,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):u=g.length}for(c=0;48===g.charCodeAt(c);c++);for(y=g.length;48===g.charCodeAt(--y););if(g=g.slice(c,++y)){if(y-=c,f&&$.DEBUG&&y>15&&(e>h||e!==d(e)))throw Error(l+m.s*e);if((u=u-c-1)>L)m.c=m.e=null;else if(u<B)m.c=[m.e=0];else{if(m.e=u,m.c=[],c=(u+1)%p,u<0&&(c+=p),c<y){for(c&&m.c.push(+g.slice(0,c)),y-=p;c<y;)m.c.push(+g.slice(c,c+=p));c=p-(g=g.slice(c)).length}else c-=y;for(;c--;g+="0");m.c.push(+g)}}else m.c=[m.e=0]}function G(e,t,r,i){var n,s,o,a,d;if(null==r?r=N:_(r,0,8),!e.c)return e.toString();if(n=e.c[0],o=e.e,null==t)d=v(e.c),d=1==i||2==i&&(o<=P||o>=D)?E(d,o):T(d,o,"0");else if(s=(e=K(new $(e),t,r)).e,a=(d=v(e.c)).length,1==i||2==i&&(t<=s||s<=P)){for(;a<t;d+="0",a++);d=E(d,s)}else if(t-=o,d=T(d,s,"0"),s+1>a){if(--t>0)for(d+=".";t--;d+="0");}else if((t+=s-a)>0)for(s+1==a&&(d+=".");t--;d+="0");return e.s<0&&n?"-"+d:d}function W(e,t){for(var r,i=1,n=new $(e[0]);i<e.length;i++){if(!(r=new $(e[i])).s){n=r;break}t.call(n,r)&&(n=r)}return n}function V(e,t,r){for(var i=1,n=t.length;!t[--n];t.pop());for(n=t[0];n>=10;n/=10,i++);return(r=i+r*p-1)>L?e.c=e.e=null:r<B?e.c=[e.e=0]:(e.e=r,e.c=t),e}function K(e,t,r,i){var n,s,o,u,l,h,y,g=e.c,m=f;if(g){e:{for(n=1,u=g[0];u>=10;u/=10,n++);if((s=t-n)<0)s+=p,o=t,y=(l=g[h=0])/m[n-o-1]%10|0;else if((h=a((s+1)/p))>=g.length){if(!i)break e;for(;g.length<=h;g.push(0));l=y=0,n=1,o=(s%=p)-p+1}else{for(l=u=g[h],n=1;u>=10;u/=10,n++);y=(o=(s%=p)-p+n)<0?0:l/m[n-o-1]%10|0}if(i=i||t<0||null!=g[h+1]||(o<0?l:l%m[n-o-1]),i=r<4?(y||i)&&(0==r||r==(e.s<0?3:2)):y>5||5==y&&(4==r||i||6==r&&(s>0?o>0?l/m[n-o]:0:g[h-1])%10&1||r==(e.s<0?8:7)),t<1||!g[0])return g.length=0,i?(t-=e.e+1,g[0]=m[(p-t%p)%p],e.e=-t||0):g[0]=e.e=0,e;if(0==s?(g.length=h,u=1,h--):(g.length=h+1,u=m[p-s],g[h]=o>0?d(l/m[n-o]%m[o])*u:0),i)for(;;){if(0==h){for(s=1,o=g[0];o>=10;o/=10,s++);for(o=g[0]+=u,u=1;o>=10;o/=10,u++);s!=u&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[h]+=u,g[h]!=c)break;g[h--]=0,u=1}for(s=g.length;0===g[--s];g.pop());}e.e>L?e.c=e.e=null:e.e<B&&(e.c=[e.e=0])}return e}function Y(e){var t,r=e.e;return null===r?e.toString():(t=v(e.c),t=r<=P||r>=D?E(t,r):T(t,r,"0"),e.s<0?"-"+t:t)}return $.clone=e,$.ROUND_UP=0,$.ROUND_DOWN=1,$.ROUND_CEIL=2,$.ROUND_FLOOR=3,$.ROUND_HALF_UP=4,$.ROUND_HALF_DOWN=5,$.ROUND_HALF_EVEN=6,$.ROUND_HALF_CEIL=7,$.ROUND_HALF_FLOOR=8,$.EUCLID=9,$.config=$.set=function(e){var t,r;if(null!=e){if("object"!=typeof e)throw Error(u+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(_(r=e[t],0,g,t),M=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(_(r=e[t],0,8,t),N=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(_(r[0],-g,0,t),_(r[1],0,g,t),P=r[0],D=r[1]):(_(r,-g,g,t),P=-(D=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)_(r[0],-g,-1,t),_(r[1],1,g,t),B=r[0],L=r[1];else{if(_(r,-g,g,t),!r)throw Error(u+t+" cannot be zero: "+r);B=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(u+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw q=!r,Error(u+"crypto unavailable");q=r}else q=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(_(r=e[t],0,9,t),j=r),e.hasOwnProperty(t="POW_PRECISION")&&(_(r=e[t],0,g,t),F=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(u+t+" not an object: "+r);U=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(u+t+" invalid: "+r);H="0123456789"==r.slice(0,10),z=r}}return{DECIMAL_PLACES:M,ROUNDING_MODE:N,EXPONENTIAL_AT:[P,D],RANGE:[B,L],CRYPTO:q,MODULO_MODE:j,POW_PRECISION:F,FORMAT:U,ALPHABET:z}},$.isBigNumber=function(e){if(!e||!0!==e._isBigNumber)return!1;if(!$.DEBUG)return!0;var t,r,i=e.c,n=e.e,s=e.s;e:if("[object Array]"=={}.toString.call(i)){if((1===s||-1===s)&&n>=-g&&n<=g&&n===d(n)){if(0===i[0]){if(0===n&&1===i.length)return!0;break e}if((t=(n+1)%p)<1&&(t+=p),String(i[0]).length==t){for(t=0;t<i.length;t++)if((r=i[t])<0||r>=c||r!==d(r))break e;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(u+"Invalid BigNumber: "+e)},$.maximum=$.max=function(){return W(arguments,C.lt)},$.minimum=$.min=function(){return W(arguments,C.gt)},$.random=(s=9007199254740992,S=Math.random()*s&2097151?function(){return d(Math.random()*s)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(e){var t,r,i,n,s,o=0,l=[],c=new $(k);if(null==e?e=M:_(e,0,g),n=a(e/p),q)if(crypto.getRandomValues){for(t=crypto.getRandomValues(new Uint32Array(n*=2));o<n;)(s=131072*t[o]+(t[o+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),t[o]=r[0],t[o+1]=r[1]):(l.push(s%1e14),o+=2);o=n/2}else{if(!crypto.randomBytes)throw q=!1,Error(u+"crypto unavailable");for(t=crypto.randomBytes(n*=7);o<n;)(s=281474976710656*(31&t[o])+1099511627776*t[o+1]+4294967296*t[o+2]+16777216*t[o+3]+(t[o+4]<<16)+(t[o+5]<<8)+t[o+6])>=9e15?crypto.randomBytes(7).copy(t,o):(l.push(s%1e14),o+=7);o=n/7}if(!q)for(;o<n;)(s=S())<9e15&&(l[o++]=s%1e14);for(n=l[--o],e%=p,n&&e&&(s=f[p-e],l[o]=d(n/s)*s);0===l[o];l.pop(),o--);if(o<0)l=[i=0];else{for(i=-1;0===l[0];l.splice(0,1),i-=p);for(o=1,s=l[0];s>=10;s/=10,o++);o<p&&(i-=p-o)}return c.e=i,c.c=l,c}),$.sum=function(){for(var e=1,t=arguments,r=new $(t[0]);e<t.length;)r=r.plus(t[e++]);return r},i=function(){var e="0123456789";function t(e,t,r,i){for(var n,s,o=[0],a=0,d=e.length;a<d;){for(s=o.length;s--;o[s]*=t);for(o[0]+=i.indexOf(e.charAt(a++)),n=0;n<o.length;n++)o[n]>r-1&&(null==o[n+1]&&(o[n+1]=0),o[n+1]+=o[n]/r|0,o[n]%=r)}return o.reverse()}return function(i,n,s,o,a){var d,u,l,c,p,h,f,y,g=i.indexOf("."),m=M,b=N;for(g>=0&&(c=F,F=0,i=i.replace(".",""),h=(y=new $(n)).pow(i.length-g),F=c,y.c=t(T(v(h.c),h.e,"0"),10,s,e),y.e=y.c.length),l=c=(f=t(i,n,s,a?(d=z,e):(d=e,z))).length;0==f[--c];f.pop());if(!f[0])return d.charAt(0);if(g<0?--l:(h.c=f,h.e=l,h.s=o,f=(h=r(h,y,m,b,s)).c,p=h.r,l=h.e),g=f[u=l+m+1],c=s/2,p=p||u<0||null!=f[u+1],p=b<4?(null!=g||p)&&(0==b||b==(h.s<0?3:2)):g>c||g==c&&(4==b||p||6==b&&1&f[u-1]||b==(h.s<0?8:7)),u<1||!f[0])i=p?T(d.charAt(1),-m,d.charAt(0)):d.charAt(0);else{if(f.length=u,p)for(--s;++f[--u]>s;)f[u]=0,u||(++l,f=[1].concat(f));for(c=f.length;!f[--c];);for(g=0,i="";g<=c;i+=d.charAt(f[g++]));i=T(i,l,d.charAt(0))}return i}}(),r=function(){function e(e,t,r){var i,n,s,o,a=0,d=e.length,u=t%y,l=t/y|0;for(e=e.slice();d--;)a=((n=u*(s=e[d]%y)+(i=l*s+(o=e[d]/y|0)*u)%y*y+a)/r|0)+(i/y|0)+l*o,e[d]=n%r;return a&&(e=[a].concat(e)),e}function t(e,t,r,i){var n,s;if(r!=i)s=r>i?1:-1;else for(n=s=0;n<r;n++)if(e[n]!=t[n]){s=e[n]>t[n]?1:-1;break}return s}function r(e,t,r,i){for(var n=0;r--;)e[r]-=n,n=e[r]<t[r]?1:0,e[r]=n*i+e[r]-t[r];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(i,n,s,o,a){var u,l,h,f,y,g,v,b,_,w,E,T,S,R,O,I,x,A=i.s==n.s?1:-1,C=i.c,k=n.c;if(!(C&&C[0]&&k&&k[0]))return new $(i.s&&n.s&&(C?!k||C[0]!=k[0]:k)?C&&0==C[0]||!k?0*A:A/0:NaN);for(_=(b=new $(A)).c=[],A=s+(l=i.e-n.e)+1,a||(a=c,l=m(i.e/p)-m(n.e/p),A=A/p|0),h=0;k[h]==(C[h]||0);h++);if(k[h]>(C[h]||0)&&l--,A<0)_.push(1),f=!0;else{for(R=C.length,I=k.length,h=0,A+=2,(y=d(a/(k[0]+1)))>1&&(k=e(k,y,a),C=e(C,y,a),I=k.length,R=C.length),S=I,E=(w=C.slice(0,I)).length;E<I;w[E++]=0);x=k.slice(),x=[0].concat(x),O=k[0],k[1]>=a/2&&O++;do{if(y=0,(u=t(k,w,I,E))<0){if(T=w[0],I!=E&&(T=T*a+(w[1]||0)),(y=d(T/O))>1)for(y>=a&&(y=a-1),v=(g=e(k,y,a)).length,E=w.length;1==t(g,w,v,E);)y--,r(g,I<v?x:k,v,a),v=g.length,u=1;else 0==y&&(u=y=1),v=(g=k.slice()).length;if(v<E&&(g=[0].concat(g)),r(w,g,E,a),E=w.length,-1==u)for(;t(k,w,I,E)<1;)y++,r(w,I<E?x:k,E,a),E=w.length}else 0===u&&(y++,w=[0]);_[h++]=y,w[0]?w[E++]=C[S]||0:(w=[C[S]],E=1)}while((S++<R||null!=w[0])&&A--);f=null!=w[0],_[0]||_.splice(0,1)}if(a==c){for(h=1,A=_[0];A>=10;A/=10,h++);K(b,s+(b.e=h+l*p-1)+1,o,f)}else b.e=l,b.r=+f;return b}}(),R=/^(-?)0([xbo])(?=\w[\w.]*$)/i,O=/^([^.]+)\.$/,I=/^\.([^.]+)$/,x=/^-?(Infinity|NaN)$/,A=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,i){var n,s=r?t:t.replace(A,"");if(x.test(s))e.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(R,(function(e,t,r){return n="x"==(r=r.toLowerCase())?16:"b"==r?2:8,i&&i!=n?e:t})),i&&(n=i,s=s.replace(O,"$1").replace(I,"0.$1")),t!=s))return new $(s,n);if($.DEBUG)throw Error(u+"Not a"+(i?" base "+i:"")+" number: "+t);e.s=null}e.c=e.e=null},C.absoluteValue=C.abs=function(){var e=new $(this);return e.s<0&&(e.s=1),e},C.comparedTo=function(e,t){return b(this,new $(e,t))},C.decimalPlaces=C.dp=function(e,t){var r,i,n,s=this;if(null!=e)return _(e,0,g),null==t?t=N:_(t,0,8),K(new $(s),e+s.e+1,t);if(!(r=s.c))return null;if(i=((n=r.length-1)-m(this.e/p))*p,n=r[n])for(;n%10==0;n/=10,i--);return i<0&&(i=0),i},C.dividedBy=C.div=function(e,t){return r(this,new $(e,t),M,N)},C.dividedToIntegerBy=C.idiv=function(e,t){return r(this,new $(e,t),0,1)},C.exponentiatedBy=C.pow=function(e,t){var r,i,n,s,o,l,c,h,f=this;if((e=new $(e)).c&&!e.isInteger())throw Error(u+"Exponent not an integer: "+Y(e));if(null!=t&&(t=new $(t)),o=e.e>14,!f.c||!f.c[0]||1==f.c[0]&&!f.e&&1==f.c.length||!e.c||!e.c[0])return h=new $(Math.pow(+Y(f),o?2-w(e):+Y(e))),t?h.mod(t):h;if(l=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new $(NaN);(i=!l&&f.isInteger()&&t.isInteger())&&(f=f.mod(t))}else{if(e.e>9&&(f.e>0||f.e<-1||(0==f.e?f.c[0]>1||o&&f.c[1]>=24e7:f.c[0]<8e13||o&&f.c[0]<=9999975e7)))return s=f.s<0&&w(e)?-0:0,f.e>-1&&(s=1/s),new $(l?1/s:s);F&&(s=a(F/p+2))}for(o?(r=new $(.5),l&&(e.s=1),c=w(e)):c=(n=Math.abs(+Y(e)))%2,h=new $(k);;){if(c){if(!(h=h.times(f)).c)break;s?h.c.length>s&&(h.c.length=s):i&&(h=h.mod(t))}if(n){if(0===(n=d(n/2)))break;c=n%2}else if(K(e=e.times(r),e.e+1,1),e.e>14)c=w(e);else{if(0===(n=+Y(e)))break;c=n%2}f=f.times(f),s?f.c&&f.c.length>s&&(f.c.length=s):i&&(f=f.mod(t))}return i?h:(l&&(h=k.div(h)),t?h.mod(t):s?K(h,F,N,undefined):h)},C.integerValue=function(e){var t=new $(this);return null==e?e=N:_(e,0,8),K(t,t.e+1,e)},C.isEqualTo=C.eq=function(e,t){return 0===b(this,new $(e,t))},C.isFinite=function(){return!!this.c},C.isGreaterThan=C.gt=function(e,t){return b(this,new $(e,t))>0},C.isGreaterThanOrEqualTo=C.gte=function(e,t){return 1===(t=b(this,new $(e,t)))||0===t},C.isInteger=function(){return!!this.c&&m(this.e/p)>this.c.length-2},C.isLessThan=C.lt=function(e,t){return b(this,new $(e,t))<0},C.isLessThanOrEqualTo=C.lte=function(e,t){return-1===(t=b(this,new $(e,t)))||0===t},C.isNaN=function(){return!this.s},C.isNegative=function(){return this.s<0},C.isPositive=function(){return this.s>0},C.isZero=function(){return!!this.c&&0==this.c[0]},C.minus=function(e,t){var r,i,n,s,o=this,a=o.s;if(t=(e=new $(e,t)).s,!a||!t)return new $(NaN);if(a!=t)return e.s=-t,o.plus(e);var d=o.e/p,u=e.e/p,l=o.c,h=e.c;if(!d||!u){if(!l||!h)return l?(e.s=-t,e):new $(h?o:NaN);if(!l[0]||!h[0])return h[0]?(e.s=-t,e):new $(l[0]?o:3==N?-0:0)}if(d=m(d),u=m(u),l=l.slice(),a=d-u){for((s=a<0)?(a=-a,n=l):(u=d,n=h),n.reverse(),t=a;t--;n.push(0));n.reverse()}else for(i=(s=(a=l.length)<(t=h.length))?a:t,a=t=0;t<i;t++)if(l[t]!=h[t]){s=l[t]<h[t];break}if(s&&(n=l,l=h,h=n,e.s=-e.s),(t=(i=h.length)-(r=l.length))>0)for(;t--;l[r++]=0);for(t=c-1;i>a;){if(l[--i]<h[i]){for(r=i;r&&!l[--r];l[r]=t);--l[r],l[i]+=c}l[i]-=h[i]}for(;0==l[0];l.splice(0,1),--u);return l[0]?V(e,l,u):(e.s=3==N?-1:1,e.c=[e.e=0],e)},C.modulo=C.mod=function(e,t){var i,n,s=this;return e=new $(e,t),!s.c||!e.s||e.c&&!e.c[0]?new $(NaN):!e.c||s.c&&!s.c[0]?new $(s):(9==j?(n=e.s,e.s=1,i=r(s,e,0,3),e.s=n,i.s*=n):i=r(s,e,0,j),(e=s.minus(i.times(e))).c[0]||1!=j||(e.s=s.s),e)},C.multipliedBy=C.times=function(e,t){var r,i,n,s,o,a,d,u,l,h,f,g,v,b,_,w=this,E=w.c,T=(e=new $(e,t)).c;if(!(E&&T&&E[0]&&T[0]))return!w.s||!e.s||E&&!E[0]&&!T||T&&!T[0]&&!E?e.c=e.e=e.s=null:(e.s*=w.s,E&&T?(e.c=[0],e.e=0):e.c=e.e=null),e;for(i=m(w.e/p)+m(e.e/p),e.s*=w.s,(d=E.length)<(h=T.length)&&(v=E,E=T,T=v,n=d,d=h,h=n),n=d+h,v=[];n--;v.push(0));for(b=c,_=y,n=h;--n>=0;){for(r=0,f=T[n]%_,g=T[n]/_|0,s=n+(o=d);s>n;)r=((u=f*(u=E[--o]%_)+(a=g*u+(l=E[o]/_|0)*f)%_*_+v[s]+r)/b|0)+(a/_|0)+g*l,v[s--]=u%b;v[s]=r}return r?++i:v.splice(0,1),V(e,v,i)},C.negated=function(){var e=new $(this);return e.s=-e.s||null,e},C.plus=function(e,t){var r,i=this,n=i.s;if(t=(e=new $(e,t)).s,!n||!t)return new $(NaN);if(n!=t)return e.s=-t,i.minus(e);var s=i.e/p,o=e.e/p,a=i.c,d=e.c;if(!s||!o){if(!a||!d)return new $(n/0);if(!a[0]||!d[0])return d[0]?e:new $(a[0]?i:0*n)}if(s=m(s),o=m(o),a=a.slice(),n=s-o){for(n>0?(o=s,r=d):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(t=d.length)<0&&(r=d,d=a,a=r,t=n),n=0;t;)n=(a[--t]=a[t]+d[t]+n)/c|0,a[t]=c===a[t]?0:a[t]%c;return n&&(a=[n].concat(a),++o),V(e,a,o)},C.precision=C.sd=function(e,t){var r,i,n,s=this;if(null!=e&&e!==!!e)return _(e,1,g),null==t?t=N:_(t,0,8),K(new $(s),e,t);if(!(r=s.c))return null;if(i=(n=r.length-1)*p+1,n=r[n]){for(;n%10==0;n/=10,i--);for(n=r[0];n>=10;n/=10,i++);}return e&&s.e+1>i&&(i=s.e+1),i},C.shiftedBy=function(e){return _(e,-9007199254740991,h),this.times("1e"+e)},C.squareRoot=C.sqrt=function(){var e,t,i,n,s,o=this,a=o.c,d=o.s,u=o.e,l=M+4,c=new $("0.5");if(1!==d||!a||!a[0])return new $(!d||d<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(d=Math.sqrt(+Y(o)))||d==1/0?(((t=v(a)).length+u)%2==0&&(t+="0"),d=Math.sqrt(+t),u=m((u+1)/2)-(u<0||u%2),i=new $(t=d==1/0?"5e"+u:(t=d.toExponential()).slice(0,t.indexOf("e")+1)+u)):i=new $(d+""),i.c[0])for((d=(u=i.e)+l)<3&&(d=0);;)if(s=i,i=c.times(s.plus(r(o,s,l,1))),v(s.c).slice(0,d)===(t=v(i.c)).slice(0,d)){if(i.e<u&&--d,"9999"!=(t=t.slice(d-3,d+1))&&(n||"4999"!=t)){+t&&(+t.slice(1)||"5"!=t.charAt(0))||(K(i,i.e+M+2,1),e=!i.times(i).eq(o));break}if(!n&&(K(s,s.e+M+2,0),s.times(s).eq(o))){i=s;break}l+=4,d+=4,n=1}return K(i,i.e+M+1,N,e)},C.toExponential=function(e,t){return null!=e&&(_(e,0,g),e++),G(this,e,t,1)},C.toFixed=function(e,t){return null!=e&&(_(e,0,g),e=e+this.e+1),G(this,e,t)},C.toFormat=function(e,t,r){var i,n=this;if(null==r)null!=e&&t&&"object"==typeof t?(r=t,t=null):e&&"object"==typeof e?(r=e,e=t=null):r=U;else if("object"!=typeof r)throw Error(u+"Argument not an object: "+r);if(i=n.toFixed(e,t),n.c){var s,o=i.split("."),a=+r.groupSize,d=+r.secondaryGroupSize,l=r.groupSeparator||"",c=o[0],p=o[1],h=n.s<0,f=h?c.slice(1):c,y=f.length;if(d&&(s=a,a=d,d=s,y-=s),a>0&&y>0){for(s=y%a||a,c=f.substr(0,s);s<y;s+=a)c+=l+f.substr(s,a);d>0&&(c+=l+f.slice(s)),h&&(c="-"+c)}i=p?c+(r.decimalSeparator||"")+((d=+r.fractionGroupSize)?p.replace(new RegExp("\\d{"+d+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):p):c}return(r.prefix||"")+i+(r.suffix||"")},C.toFraction=function(e){var t,i,n,s,o,a,d,l,c,h,y,g,m=this,b=m.c;if(null!=e&&(!(d=new $(e)).isInteger()&&(d.c||1!==d.s)||d.lt(k)))throw Error(u+"Argument "+(d.isInteger()?"out of range: ":"not an integer: ")+Y(d));if(!b)return new $(m);for(t=new $(k),c=i=new $(k),n=l=new $(k),g=v(b),o=t.e=g.length-m.e-1,t.c[0]=f[(a=o%p)<0?p+a:a],e=!e||d.comparedTo(t)>0?o>0?t:c:d,a=L,L=1/0,d=new $(g),l.c[0]=0;h=r(d,t,0,1),1!=(s=i.plus(h.times(n))).comparedTo(e);)i=n,n=s,c=l.plus(h.times(s=c)),l=s,t=d.minus(h.times(s=t)),d=s;return s=r(e.minus(i),n,0,1),l=l.plus(s.times(c)),i=i.plus(s.times(n)),l.s=c.s=m.s,y=r(c,n,o*=2,N).minus(m).abs().comparedTo(r(l,i,o,N).minus(m).abs())<1?[c,n]:[l,i],L=a,y},C.toNumber=function(){return+Y(this)},C.toPrecision=function(e,t){return null!=e&&_(e,1,g),G(this,e,t,2)},C.toString=function(e){var t,r=this,n=r.s,s=r.e;return null===s?n?(t="Infinity",n<0&&(t="-"+t)):t="NaN":(null==e?t=s<=P||s>=D?E(v(r.c),s):T(v(r.c),s,"0"):10===e&&H?t=T(v((r=K(new $(r),M+s+1,N)).c),r.e,"0"):(_(e,2,z.length,"Base"),t=i(T(v(r.c),s,"0"),10,e,n,!0)),n<0&&r.c[0]&&(t="-"+t)),t},C.valueOf=C.toJSON=function(){return Y(this)},C._isBigNumber=!0,null!=t&&$.set(t),$}(),s.default=s.BigNumber=s,void 0===(i=function(){return s}.call(t,r,t,e))||(e.exports=i)}()},8834:(e,t,r)=>{"use strict";const i=r(5766),n=r(2333),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=d,t.SlowBuffer=function(e){+e!=e&&(e=0);return d.alloc(+e)},t.INSPECT_MAX_BYTES=50;const o=2147483647;function a(e){if(e>o)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,d.prototype),t}function d(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return u(e,t,r)}function u(e,t,r){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!d.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let i=a(r);const n=i.write(e,t);n!==r&&(i=i.slice(0,n));return i}(e,t);if(ArrayBuffer.isView(e))return function(e){if(Y(e,Uint8Array)){const t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(Y(e,ArrayBuffer)||e&&Y(e.buffer,ArrayBuffer))return h(e,t,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(e,SharedArrayBuffer)||e&&Y(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const i=e.valueOf&&e.valueOf();if(null!=i&&i!==e)return d.from(i,t,r);const n=function(e){if(d.isBuffer(e)){const t=0|f(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||X(e.length)?a(0):p(e);if("Buffer"===e.type&&Array.isArray(e.data))return p(e.data)}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return d.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return l(e),a(e<0?0:0|f(e))}function p(e){const t=e.length<0?0:0|f(e.length),r=a(t);for(let i=0;i<t;i+=1)r[i]=255&e[i];return r}function h(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let i;return i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(i,d.prototype),i}function f(e){if(e>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return 0|e}function y(e,t){if(d.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||Y(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return W(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return V(e).length;default:if(n)return i?-1:W(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return C(this,t,r);case"utf8":case"utf-8":return O(this,t,r);case"ascii":return x(this,t,r);case"latin1":case"binary":return A(this,t,r);case"base64":return R(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,r);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function m(e,t,r){const i=e[t];e[t]=e[r],e[r]=i}function v(e,t,r,i,n){if(0===e.length)return-1;if("string"==typeof r?(i=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),X(r=+r)&&(r=n?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(n)return-1;r=e.length-1}else if(r<0){if(!n)return-1;r=0}if("string"==typeof t&&(t=d.from(t,i)),d.isBuffer(t))return 0===t.length?-1:b(e,t,r,i,n);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?n?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):b(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function b(e,t,r,i,n){let s,o=1,a=e.length,d=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return-1;o=2,a/=2,d/=2,r/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){let i=-1;for(s=r;s<a;s++)if(u(e,s)===u(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===d)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(r+d>a&&(r=a-d),s=r;s>=0;s--){let r=!0;for(let i=0;i<d;i++)if(u(e,s+i)!==u(t,i)){r=!1;break}if(r)return s}return-1}function _(e,t,r,i){r=Number(r)||0;const n=e.length-r;i?(i=Number(i))>n&&(i=n):i=n;const s=t.length;let o;for(i>s/2&&(i=s/2),o=0;o<i;++o){const i=parseInt(t.substr(2*o,2),16);if(X(i))return o;e[r+o]=i}return o}function w(e,t,r,i){return K(W(t,e.length-r),e,r,i)}function E(e,t,r,i){return K(function(e){const t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,i)}function T(e,t,r,i){return K(V(t),e,r,i)}function S(e,t,r,i){return K(function(e,t){let r,i,n;const s=[];for(let o=0;o<e.length&&!((t-=2)<0);++o)r=e.charCodeAt(o),i=r>>8,n=r%256,s.push(n),s.push(i);return s}(t,e.length-r),e,r,i)}function R(e,t,r){return 0===t&&r===e.length?i.fromByteArray(e):i.fromByteArray(e.slice(t,r))}function O(e,t,r){r=Math.min(e.length,r);const i=[];let n=t;for(;n<r;){const t=e[n];let s=null,o=t>239?4:t>223?3:t>191?2:1;if(n+o<=r){let r,i,a,d;switch(o){case 1:t<128&&(s=t);break;case 2:r=e[n+1],128==(192&r)&&(d=(31&t)<<6|63&r,d>127&&(s=d));break;case 3:r=e[n+1],i=e[n+2],128==(192&r)&&128==(192&i)&&(d=(15&t)<<12|(63&r)<<6|63&i,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:r=e[n+1],i=e[n+2],a=e[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(d=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&a,d>65535&&d<1114112&&(s=d))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,i.push(s>>>10&1023|55296),s=56320|1023&s),i.push(s),n+=o}return function(e){const t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=I));return r}(i)}t.kMaxLength=o,d.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),d.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}}),d.poolSize=8192,d.from=function(e,t,r){return u(e,t,r)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array),d.alloc=function(e,t,r){return function(e,t,r){return l(e),e<=0?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)}(e,t,r)},d.allocUnsafe=function(e){return c(e)},d.allocUnsafeSlow=function(e){return c(e)},d.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==d.prototype},d.compare=function(e,t){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=d.from(t,t.offset,t.byteLength)),!d.isBuffer(e)||!d.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let n=0,s=Math.min(r,i);n<s;++n)if(e[n]!==t[n]){r=e[n],i=t[n];break}return r<i?-1:i<r?1:0},d.isEncoding=function(e){switch(String(e).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}},d.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return d.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const i=d.allocUnsafe(t);let n=0;for(r=0;r<e.length;++r){let t=e[r];if(Y(t,Uint8Array))n+t.length>i.length?(d.isBuffer(t)||(t=d.from(t)),t.copy(i,n)):Uint8Array.prototype.set.call(i,t,n);else{if(!d.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,n)}n+=t.length}return i},d.byteLength=y,d.prototype._isBuffer=!0,d.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)m(this,t,t+1);return this},d.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)m(this,t,t+3),m(this,t+1,t+2);return this},d.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)m(this,t,t+7),m(this,t+1,t+6),m(this,t+2,t+5),m(this,t+3,t+4);return this},d.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?O(this,0,e):g.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===d.compare(this,e)},d.prototype.inspect=function(){let e="";const r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(d.prototype[s]=d.prototype.inspect),d.prototype.compare=function(e,t,r,i,n){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===n&&(n=this.length),t<0||r>e.length||i<0||n>this.length)throw new RangeError("out of range index");if(i>=n&&t>=r)return 0;if(i>=n)return-1;if(t>=r)return 1;if(this===e)return 0;let s=(n>>>=0)-(i>>>=0),o=(r>>>=0)-(t>>>=0);const a=Math.min(s,o),u=this.slice(i,n),l=e.slice(t,r);for(let e=0;e<a;++e)if(u[e]!==l[e]){s=u[e],o=l[e];break}return s<o?-1:o<s?1:0},d.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},d.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},d.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},d.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0)}const n=this.length-t;if((void 0===r||r>n)&&(r=n),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return _(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":case"latin1":case"binary":return E(this,e,t,r);case"base64":return T(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}},d.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function x(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(127&e[n]);return i}function A(e,t,r){let i="";r=Math.min(e.length,r);for(let n=t;n<r;++n)i+=String.fromCharCode(e[n]);return i}function C(e,t,r){const i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);let n="";for(let i=t;i<r;++i)n+=Z[e[i]];return n}function k(e,t,r){const i=e.slice(t,r);let n="";for(let e=0;e<i.length-1;e+=2)n+=String.fromCharCode(i[e]+256*i[e+1]);return n}function M(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,i,n,s){if(!d.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<s)throw new RangeError('"value" argument is out of bounds');if(r+i>e.length)throw new RangeError("Index out of range")}function P(e,t,r,i,n){z(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function D(e,t,r,i,n){z(t,i,n,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function B(e,t,r,i,n,s){if(r+i>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function L(e,t,r,i,s){return t=+t,r>>>=0,s||B(e,0,r,4),n.write(e,t,r,i,23,4),r+4}function q(e,t,r,i,s){return t=+t,r>>>=0,s||B(e,0,r,8),n.write(e,t,r,i,52,8),r+8}d.prototype.slice=function(e,t){const r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);const i=this.subarray(e,t);return Object.setPrototypeOf(i,d.prototype),i},d.prototype.readUintLE=d.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let i=this[e],n=1,s=0;for(;++s<t&&(n*=256);)i+=this[e+s]*n;return i},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let i=this[e+--t],n=1;for(;t>0&&(n*=256);)i+=this[e+--t]*n;return i},d.prototype.readUint8=d.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const i=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,n=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(i)+(BigInt(n)<<BigInt(32))})),d.prototype.readBigUInt64BE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const i=t*2**24+65536*this[++e]+256*this[++e]+this[++e],n=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(i)<<BigInt(32))+BigInt(n)})),d.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let i=this[e],n=1,s=0;for(;++s<t&&(n*=256);)i+=this[e+s]*n;return n*=128,i>=n&&(i-=Math.pow(2,8*t)),i},d.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||M(e,t,this.length);let i=t,n=1,s=this[e+--i];for(;i>0&&(n*=256);)s+=this[e+--i]*n;return n*=128,s>=n&&(s-=Math.pow(2,8*t)),s},d.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},d.prototype.readInt16LE=function(e,t){e>>>=0,t||M(e,2,this.length);const r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt16BE=function(e,t){e>>>=0,t||M(e,2,this.length);const r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},d.prototype.readInt32LE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,t){return e>>>=0,t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const i=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),d.prototype.readBigInt64BE=J((function(e){H(e>>>=0,"offset");const t=this[e],r=this[e+7];void 0!==t&&void 0!==r||$(e,this.length-8);const i=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),d.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!1,52,8)},d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t>>>=0,r>>>=0,!i){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=1,s=0;for(this[t]=255&e;++s<r&&(n*=256);)this[t+s]=e/n&255;return t+r},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,t,r,i){if(e=+e,t>>>=0,r>>>=0,!i){N(this,e,t,r,Math.pow(2,8*r)-1,0)}let n=r-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+r},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,255,0),this[t]=255&e,t+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeBigUInt64LE=J((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),d.prototype.writeBigUInt64BE=J((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),d.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}let n=0,s=1,o=0;for(this[t]=255&e;++n<r&&(s*=256);)e<0&&0===o&&0!==this[t+n-1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+r},d.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);N(this,e,t,r,i-1,-i)}let n=r-1,s=1,o=0;for(this[t+n]=255&e;--n>=0&&(s*=256);)e<0&&0===o&&0!==this[t+n+1]&&(o=1),this[t+n]=(e/s>>0)-o&255;return t+r},d.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},d.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},d.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},d.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},d.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},d.prototype.writeBigInt64LE=J((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),d.prototype.writeBigInt64BE=J((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),d.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},d.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},d.prototype.writeDoubleLE=function(e,t,r){return q(this,e,t,!0,r)},d.prototype.writeDoubleBE=function(e,t,r){return q(this,e,t,!1,r)},d.prototype.copy=function(e,t,r,i){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);const n=i-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),t),n},d.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!d.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(1===e.length){const t=e.charCodeAt(0);("utf8"===i&&t<128||"latin1"===i)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let n;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(n=t;n<r;++n)this[n]=e;else{const s=d.isBuffer(e)?e:d.from(e,i),o=s.length;if(0===o)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(n=0;n<r-t;++n)this[n+t]=s[n%o]}return this};const j={};function F(e,t,r){j[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function U(e){let t="",r=e.length;const i="-"===e[0]?1:0;for(;r>=i+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function z(e,t,r,i,n,s){if(e>r||e<t){const i="bigint"==typeof t?"n":"";let n;throw n=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${8*(s+1)}${i}`:`>= -(2${i} ** ${8*(s+1)-1}${i}) and < 2 ** ${8*(s+1)-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new j.ERR_OUT_OF_RANGE("value",n,e)}!function(e,t,r){H(t,"offset"),void 0!==e[t]&&void 0!==e[t+r]||$(t,e.length-(r+1))}(i,n,s)}function H(e,t){if("number"!=typeof e)throw new j.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){if(Math.floor(e)!==e)throw H(e,r),new j.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new j.ERR_BUFFER_OUT_OF_BOUNDS;throw new j.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}F("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),F("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),F("ERR_OUT_OF_RANGE",(function(e,t,r){let i=`The value of "${e}" is out of range.`,n=r;return Number.isInteger(r)&&Math.abs(r)>2**32?n=U(String(r)):"bigint"==typeof r&&(n=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(n=U(n)),n+="n"),i+=` It must be ${t}. Received ${n}`,i}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function W(e,t){let r;t=t||1/0;const i=e.length;let n=null;const s=[];for(let o=0;o<i;++o){if(r=e.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===i){(t-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),n=r;continue}r=65536+(n-55296<<10|r-56320)}else n&&(t-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function V(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,r,i){let n;for(n=0;n<i&&!(n+r>=t.length||n>=e.length);++n)t[n+r]=e[n];return n}function Y(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function X(e){return e!=e}const Z=function(){const e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){const i=16*r;for(let n=0;n<16;++n)t[i+n]=e[r]+e[n]}return t}();function J(e){return"undefined"==typeof BigInt?Q:e}function Q(){throw new Error("BigInt not supported")}},9396:function(e,t,r){var i,n,s;n=[r(6874)],i=function(e){"use strict";var t=function(e,r,n){if(void 0===e&&(e=t.DEFAULT_CAPACITY),void 0===r&&(r=t.DEFAULT_ENDIAN),void 0===n&&(n=t.DEFAULT_NOASSERT),!n){if((e|=0)<0)throw RangeError("Illegal capacity");r=!!r,n=!!n}this.buffer=0===e?i:new ArrayBuffer(e),this.view=0===e?null:new Uint8Array(this.buffer),this.offset=0,this.markedOffset=-1,this.limit=e,this.littleEndian=r,this.noAssert=n};t.VERSION="5.0.1",t.LITTLE_ENDIAN=!0,t.BIG_ENDIAN=!1,t.DEFAULT_CAPACITY=16,t.DEFAULT_ENDIAN=t.BIG_ENDIAN,t.DEFAULT_NOASSERT=!1,t.Long=e||null;var r=t.prototype;r.__isByteBuffer__,Object.defineProperty(r,"__isByteBuffer__",{value:!0,enumerable:!1,configurable:!1});var i=new ArrayBuffer(0),n=String.fromCharCode;function s(e){var t=0;return function(){return t<e.length?e.charCodeAt(t++):null}}function o(){var e=[],t=[];return function(){if(0===arguments.length)return t.join("")+n.apply(String,e);e.length+arguments.length>1024&&(t.push(n.apply(String,e)),e.length=0),Array.prototype.push.apply(e,arguments)}}function a(e,t,r,i,n){var s,o,a=8*n-i-1,d=(1<<a)-1,u=d>>1,l=-7,c=r?n-1:0,p=r?-1:1,h=e[t+c];for(c+=p,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+c],c+=p,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+c],c+=p,l-=8);if(0===s)s=1-u;else{if(s===d)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=u}return(h?-1:1)*o*Math.pow(2,s-i)}function d(e,t,r,i,n,s){var o,a,d,u=8*s-n-1,l=(1<<u)-1,c=l>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,f=i?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-o))<1&&(o--,d*=2),(t+=o+c>=1?p/d:p*Math.pow(2,1-c))*d>=2&&(o++,d/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(t*d-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[r+h]=255&a,h+=f,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[r+h]=255&o,h+=f,o/=256,u-=8);e[r+h-f]|=128*y}t.accessor=function(){return Uint8Array},t.allocate=function(e,r,i){return new t(e,r,i)},t.concat=function(e,r,i,n){"boolean"!=typeof r&&"string"==typeof r||(n=i,i=r,r=void 0);for(var s,o=0,a=0,d=e.length;a<d;++a)t.isByteBuffer(e[a])||(e[a]=t.wrap(e[a],r)),(s=e[a].limit-e[a].offset)>0&&(o+=s);if(0===o)return new t(0,i,n);var u,l=new t(o,i,n);for(a=0;a<d;)(s=(u=e[a++]).limit-u.offset)<=0||(l.view.set(u.view.subarray(u.offset,u.limit),l.offset),l.offset+=s);return l.limit=l.offset,l.offset=0,l},t.isByteBuffer=function(e){return!0===(e&&e.__isByteBuffer__)},t.type=function(){return ArrayBuffer},t.wrap=function(e,i,n,s){if("string"!=typeof i&&(s=n,n=i,i=void 0),"string"==typeof e)switch(void 0===i&&(i="utf8"),i){case"base64":return t.fromBase64(e,n);case"hex":return t.fromHex(e,n);case"binary":return t.fromBinary(e,n);case"utf8":return t.fromUTF8(e,n);case"debug":return t.fromDebug(e,n);default:throw Error("Unsupported encoding: "+i)}if(null===e||"object"!=typeof e)throw TypeError("Illegal buffer");var o;if(t.isByteBuffer(e))return(o=r.clone.call(e)).markedOffset=-1,o;if(e instanceof Uint8Array)o=new t(0,n,s),e.length>0&&(o.buffer=e.buffer,o.offset=e.byteOffset,o.limit=e.byteOffset+e.byteLength,o.view=new Uint8Array(e.buffer));else if(e instanceof ArrayBuffer)o=new t(0,n,s),e.byteLength>0&&(o.buffer=e,o.offset=0,o.limit=e.byteLength,o.view=e.byteLength>0?new Uint8Array(e):null);else{if("[object Array]"!==Object.prototype.toString.call(e))throw TypeError("Illegal buffer");(o=new t(e.length,n,s)).limit=e.length;for(var a=0;a<e.length;++a)o.view[a]=e[a]}return o},r.writeBitSet=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if(!(e instanceof Array))throw TypeError("Illegal BitSet: Not an array");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var i,n=t,s=e.length,o=s>>3,a=0;for(t+=this.writeVarint32(s,t);o--;)i=1&!!e[a++]|(1&!!e[a++])<<1|(1&!!e[a++])<<2|(1&!!e[a++])<<3|(1&!!e[a++])<<4|(1&!!e[a++])<<5|(1&!!e[a++])<<6|(1&!!e[a++])<<7,this.writeByte(i,t++);if(a<s){var d=0;for(i=0;a<s;)i|=(1&!!e[a++])<<d++;this.writeByte(i,t++)}return r?(this.offset=t,this):t-n},r.readBitSet=function(e){var t=void 0===e;t&&(e=this.offset);var r,i=this.readVarint32(e),n=i.value,s=n>>3,o=0,a=[];for(e+=i.length;s--;)r=this.readByte(e++),a[o++]=!!(1&r),a[o++]=!!(2&r),a[o++]=!!(4&r),a[o++]=!!(8&r),a[o++]=!!(16&r),a[o++]=!!(32&r),a[o++]=!!(64&r),a[o++]=!!(128&r);if(o<n){var d=0;for(r=this.readByte(e++);o<n;)a[o++]=!!(r>>d++&1)}return t&&(this.offset=e),a},r.readBytes=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+"+e+") <= "+this.buffer.byteLength)}var i=this.slice(t,t+e);return r&&(this.offset+=e),i},r.writeBytes=r.append,r.writeInt8=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},r.writeByte=r.writeInt8,r.readInt8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r=this.view[e];return 128==(128&r)&&(r=-(255-r+1)),t&&(this.offset+=1),r},r.readByte=r.readInt8,r.writeUint8=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=1;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=1,this.view[t]=e,r&&(this.offset+=1),this},r.writeUInt8=r.writeUint8,r.readUint8=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r=this.view[e];return t&&(this.offset+=1),r},r.readUInt8=r.readUint8,r.writeInt16=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},r.writeShort=r.writeInt16,r.readInt16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e],r|=this.view[e+1]<<8):(r=this.view[e]<<8,r|=this.view[e+1]),32768==(32768&r)&&(r=-(65535-r+1)),t&&(this.offset+=2),r},r.readShort=r.readInt16,r.writeUint16=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=2;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=2,this.littleEndian?(this.view[t+1]=(65280&e)>>>8,this.view[t]=255&e):(this.view[t]=(65280&e)>>>8,this.view[t+1]=255&e),r&&(this.offset+=2),this},r.writeUInt16=r.writeUint16,r.readUint16=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+2>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+2) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e],r|=this.view[e+1]<<8):(r=this.view[e]<<8,r|=this.view[e+1]),t&&(this.offset+=2),r},r.readUInt16=r.readUint16,r.writeInt32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),r&&(this.offset+=4),this},r.writeInt=r.writeInt32,r.readInt32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=this.view[e]<<24>>>0),r|=0,t&&(this.offset+=4),r},r.readInt=r.readInt32,r.writeUint32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,this.littleEndian?(this.view[t+3]=e>>>24&255,this.view[t+2]=e>>>16&255,this.view[t+1]=e>>>8&255,this.view[t]=255&e):(this.view[t]=e>>>24&255,this.view[t+1]=e>>>16&255,this.view[t+2]=e>>>8&255,this.view[t+3]=255&e),r&&(this.offset+=4),this},r.writeUInt32=r.writeUint32,r.readUint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=0;return this.littleEndian?(r=this.view[e+2]<<16,r|=this.view[e+1]<<8,r|=this.view[e],r+=this.view[e+3]<<24>>>0):(r=this.view[e+1]<<16,r|=this.view[e+2]<<8,r|=this.view[e+3],r+=this.view[e]<<24>>>0),t&&(this.offset+=4),r},r.readUInt32=r.readUint32,e&&(r.writeInt64=function(t,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),r+=8;var n=this.buffer.byteLength;r>n&&this.resize((n*=2)>r?n:r),r-=8;var s=t.low,o=t.high;return this.littleEndian?(this.view[r+3]=s>>>24&255,this.view[r+2]=s>>>16&255,this.view[r+1]=s>>>8&255,this.view[r]=255&s,r+=4,this.view[r+3]=o>>>24&255,this.view[r+2]=o>>>16&255,this.view[r+1]=o>>>8&255,this.view[r]=255&o):(this.view[r]=o>>>24&255,this.view[r+1]=o>>>16&255,this.view[r+2]=o>>>8&255,this.view[r+3]=255&o,r+=4,this.view[r]=s>>>24&255,this.view[r+1]=s>>>16&255,this.view[r+2]=s>>>8&255,this.view[r+3]=255&s),i&&(this.offset+=8),this},r.writeLong=r.writeInt64,r.readInt64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var i=0,n=0;this.littleEndian?(i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0);var s=new e(i,n,!1);return r&&(this.offset+=8),s},r.readLong=r.readInt64,r.writeUint64=function(t,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"==typeof t)t=e.fromNumber(t);else if("string"==typeof t)t=e.fromString(t);else if(!(t&&t instanceof e))throw TypeError("Illegal value: "+t+" (not an integer or Long)");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t)),r+=8;var n=this.buffer.byteLength;r>n&&this.resize((n*=2)>r?n:r),r-=8;var s=t.low,o=t.high;return this.littleEndian?(this.view[r+3]=s>>>24&255,this.view[r+2]=s>>>16&255,this.view[r+1]=s>>>8&255,this.view[r]=255&s,r+=4,this.view[r+3]=o>>>24&255,this.view[r+2]=o>>>16&255,this.view[r+1]=o>>>8&255,this.view[r]=255&o):(this.view[r]=o>>>24&255,this.view[r+1]=o>>>16&255,this.view[r+2]=o>>>8&255,this.view[r+3]=255&o,r+=4,this.view[r]=s>>>24&255,this.view[r+1]=s>>>16&255,this.view[r+2]=s>>>8&255,this.view[r+3]=255&s),i&&(this.offset+=8),this},r.writeUInt64=r.writeUint64,r.readUint64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+8) <= "+this.buffer.byteLength)}var i=0,n=0;this.littleEndian?(i=this.view[t+2]<<16,i|=this.view[t+1]<<8,i|=this.view[t],i+=this.view[t+3]<<24>>>0,t+=4,n=this.view[t+2]<<16,n|=this.view[t+1]<<8,n|=this.view[t],n+=this.view[t+3]<<24>>>0):(n=this.view[t+1]<<16,n|=this.view[t+2]<<8,n|=this.view[t+3],n+=this.view[t]<<24>>>0,t+=4,i=this.view[t+1]<<16,i|=this.view[t+2]<<8,i|=this.view[t+3],i+=this.view[t]<<24>>>0);var s=new e(i,n,!0);return r&&(this.offset+=8),s},r.readUInt64=r.readUint64),r.writeFloat32=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=4;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=4,d(this.view,e,t,this.littleEndian,23,4),r&&(this.offset+=4),this},r.writeFloat=r.writeFloat32,r.readFloat32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var r=a(this.view,e,this.littleEndian,23,4);return t&&(this.offset+=4),r},r.readFloat=r.readFloat32,r.writeFloat64=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof e)throw TypeError("Illegal value: "+e+" (not a number)");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}t+=8;var i=this.buffer.byteLength;return t>i&&this.resize((i*=2)>t?i:t),t-=8,d(this.view,e,t,this.littleEndian,52,8),r&&(this.offset+=8),this},r.writeDouble=r.writeFloat64,r.readFloat64=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+8>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+8) <= "+this.buffer.byteLength)}var r=a(this.view,e,this.littleEndian,52,8);return t&&(this.offset+=8),r},r.readDouble=r.readFloat64,t.MAX_VARINT32_BYTES=5,t.calculateVarint32=function(e){return(e>>>=0)<128?1:e<16384?2:e<1<<21?3:e<1<<28?4:5},t.zigZagEncode32=function(e){return((e|=0)<<1^e>>31)>>>0},t.zigZagDecode32=function(e){return e>>>1^-(1&e)|0},r.writeVarint32=function(e,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n,s=t.calculateVarint32(e);r+=s;var o=this.buffer.byteLength;for(r>o&&this.resize((o*=2)>r?o:r),r-=s,e>>>=0;e>=128;)n=127&e|128,this.view[r++]=n,e>>>=7;return this.view[r++]=e,i?(this.offset=r,this):s},r.writeVarint32ZigZag=function(e,r){return this.writeVarint32(t.zigZagEncode32(e),r)},r.readVarint32=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=0,n=0;do{if(!this.noAssert&&e>this.limit){var s=Error("Truncated");throw s.truncated=!0,s}r=this.view[e++],i<5&&(n|=(127&r)<<7*i),++i}while(0!=(128&r));return n|=0,t?(this.offset=e,n):{value:n,length:i}},r.readVarint32ZigZag=function(e){var r=this.readVarint32(e);return"object"==typeof r?r.value=t.zigZagDecode32(r.value):r=t.zigZagDecode32(r),r},e&&(t.MAX_VARINT64_BYTES=10,t.calculateVarint64=function(t){"number"==typeof t?t=e.fromNumber(t):"string"==typeof t&&(t=e.fromString(t));var r=t.toInt()>>>0,i=t.shiftRightUnsigned(28).toInt()>>>0,n=t.shiftRightUnsigned(56).toInt()>>>0;return 0==n?0==i?r<16384?r<128?1:2:r<1<<21?3:4:i<16384?i<128?5:6:i<1<<21?7:8:n<128?9:10},t.zigZagEncode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftLeft(1).xor(t.shiftRight(63)).toUnsigned()},t.zigZagDecode64=function(t){return"number"==typeof t?t=e.fromNumber(t,!1):"string"==typeof t?t=e.fromString(t,!1):!1!==t.unsigned&&(t=t.toSigned()),t.shiftRightUnsigned(1).xor(t.and(e.ONE).toSigned().negate()).toSigned()},r.writeVarint64=function(r,i){var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"==typeof r)r=e.fromNumber(r);else if("string"==typeof r)r=e.fromString(r);else if(!(r&&r instanceof e))throw TypeError("Illegal value: "+r+" (not an integer or Long)");if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}"number"==typeof r?r=e.fromNumber(r,!1):"string"==typeof r?r=e.fromString(r,!1):!1!==r.unsigned&&(r=r.toSigned());var s=t.calculateVarint64(r),o=r.toInt()>>>0,a=r.shiftRightUnsigned(28).toInt()>>>0,d=r.shiftRightUnsigned(56).toInt()>>>0;i+=s;var u=this.buffer.byteLength;switch(i>u&&this.resize((u*=2)>i?u:i),i-=s,s){case 10:this.view[i+9]=d>>>7&1;case 9:this.view[i+8]=9!==s?128|d:127&d;case 8:this.view[i+7]=8!==s?a>>>21|128:a>>>21&127;case 7:this.view[i+6]=7!==s?a>>>14|128:a>>>14&127;case 6:this.view[i+5]=6!==s?a>>>7|128:a>>>7&127;case 5:this.view[i+4]=5!==s?128|a:127&a;case 4:this.view[i+3]=4!==s?o>>>21|128:o>>>21&127;case 3:this.view[i+2]=3!==s?o>>>14|128:o>>>14&127;case 2:this.view[i+1]=2!==s?o>>>7|128:o>>>7&127;case 1:this.view[i]=1!==s?128|o:127&o}return n?(this.offset+=s,this):s},r.writeVarint64ZigZag=function(e,r){return this.writeVarint64(t.zigZagEncode64(e),r)},r.readVarint64=function(t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+1) <= "+this.buffer.byteLength)}var i=t,n=0,s=0,o=0,a=0;if(n=127&(a=this.view[t++]),128&a&&(n|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(n|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(s=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<7,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<14,(128&a||this.noAssert&&void 0===a)&&(s|=(127&(a=this.view[t++]))<<21,(128&a||this.noAssert&&void 0===a)&&(o=127&(a=this.view[t++]),(128&a||this.noAssert&&void 0===a)&&(o|=(127&(a=this.view[t++]))<<7,128&a||this.noAssert&&void 0===a))))))))))throw Error("Buffer overrun");var d=e.fromBits(n|s<<28,s>>>4|o<<24,!1);return r?(this.offset=t,d):{value:d,length:t-i}},r.readVarint64ZigZag=function(r){var i=this.readVarint64(r);return i&&i.value instanceof e?i.value=t.zigZagDecode64(i.value):i=t.zigZagDecode64(i),i}),r.writeCString=function(e,t){var r=void 0===t;r&&(t=this.offset);var i,n=e.length;if(!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");for(i=0;i<n;++i)if(0===e.charCodeAt(i))throw RangeError("Illegal str: Contains NULL-characters");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}n=l.calculateUTF16asUTF8(s(e))[1],t+=n+1;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=n+1,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),this.view[t++]=0,r?(this.offset=t,this):n},r.readCString=function(e){var t=void 0===e;if(t&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var r,i=e,n=-1;return l.decodeUTF8toUTF16(function(){if(0===n)return null;if(e>=this.limit)throw RangeError("Illegal range: Truncated data, "+e+" < "+this.limit);return 0===(n=this.view[e++])?null:n}.bind(this),r=o(),!0),t?(this.offset=e,r()):{string:r(),length:e-i}},r.writeIString=function(e,t){var r=void 0===t;if(r&&(t=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var i,n=t;i=l.calculateUTF16asUTF8(s(e),this.noAssert)[1],t+=4+i;var o=this.buffer.byteLength;if(t>o&&this.resize((o*=2)>t?o:t),t-=4+i,this.littleEndian?(this.view[t+3]=i>>>24&255,this.view[t+2]=i>>>16&255,this.view[t+1]=i>>>8&255,this.view[t]=255&i):(this.view[t]=i>>>24&255,this.view[t+1]=i>>>16&255,this.view[t+2]=i>>>8&255,this.view[t+3]=255&i),t+=4,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),t!==n+4+i)throw RangeError("Illegal range: Truncated data, "+t+" == "+(t+4+i));return r?(this.offset=t,this):t-n},r.readIString=function(e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+4>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+4) <= "+this.buffer.byteLength)}var i=e,n=this.readUint32(e),s=this.readUTF8String(n,t.METRICS_BYTES,e+=4);return e+=s.length,r?(this.offset=e,s.string):{string:s.string,length:e-i}},t.METRICS_CHARS="c",t.METRICS_BYTES="b",r.writeUTF8String=function(e,t){var r,i=void 0===t;if(i&&(t=this.offset),!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: "+t+" (not an integer)");if((t>>>=0)<0||t+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+t+" (+0) <= "+this.buffer.byteLength)}var n=t;r=l.calculateUTF16asUTF8(s(e))[1],t+=r;var o=this.buffer.byteLength;return t>o&&this.resize((o*=2)>t?o:t),t-=r,l.encodeUTF16toUTF8(s(e),function(e){this.view[t++]=e}.bind(this)),i?(this.offset=t,this):t-n},r.writeString=r.writeUTF8String,t.calculateUTF8Chars=function(e){return l.calculateUTF16asUTF8(s(e))[0]},t.calculateUTF8Bytes=function(e){return l.calculateUTF16asUTF8(s(e))[1]},t.calculateString=t.calculateUTF8Bytes,r.readUTF8String=function(e,r,i){"number"==typeof r&&(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),void 0===r&&(r=t.METRICS_CHARS),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");if(e|=0,"number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}var s,a=0,d=i;if(r===t.METRICS_CHARS){if(s=o(),l.decodeUTF8(function(){return a<e&&i<this.limit?this.view[i++]:null}.bind(this),(function(e){++a,l.UTF8toUTF16(e,s)})),a!==e)throw RangeError("Illegal range: Truncated data, "+a+" == "+e);return n?(this.offset=i,s()):{string:s(),length:i-d}}if(r===t.METRICS_BYTES){if(!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+e>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+"+e+") <= "+this.buffer.byteLength)}var u=i+e;if(l.decodeUTF8toUTF16(function(){return i<u?this.view[i++]:null}.bind(this),s=o(),this.noAssert),i!==u)throw RangeError("Illegal range: Truncated data, "+i+" == "+u);return n?(this.offset=i,s()):{string:s(),length:i-d}}throw TypeError("Unsupported metrics: "+r)},r.readString=r.readUTF8String,r.writeVString=function(e,r){var i=void 0===r;if(i&&(r=this.offset),!this.noAssert){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if("number"!=typeof r||r%1!=0)throw TypeError("Illegal offset: "+r+" (not an integer)");if((r>>>=0)<0||r+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+r+" (+0) <= "+this.buffer.byteLength)}var n,o,a=r;n=l.calculateUTF16asUTF8(s(e),this.noAssert)[1],o=t.calculateVarint32(n),r+=o+n;var d=this.buffer.byteLength;if(r>d&&this.resize((d*=2)>r?d:r),r-=o+n,r+=this.writeVarint32(n,r),l.encodeUTF16toUTF8(s(e),function(e){this.view[r++]=e}.bind(this)),r!==a+n+o)throw RangeError("Illegal range: Truncated data, "+r+" == "+(r+n+o));return i?(this.offset=r,this):r-a},r.readVString=function(e){var r=void 0===e;if(r&&(e=this.offset),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+1>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+1) <= "+this.buffer.byteLength)}var i=e,n=this.readVarint32(e),s=this.readUTF8String(n.value,t.METRICS_BYTES,e+=n.length);return e+=s.length,r?(this.offset=e,s.string):{string:s.string,length:e-i}},r.append=function(e,r,i){"number"!=typeof r&&"string"==typeof r||(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,r));var s=e.limit-e.offset;if(s<=0)return this;i+=s;var o=this.buffer.byteLength;return i>o&&this.resize((o*=2)>i?o:i),i-=s,this.view.set(e.view.subarray(e.offset,e.limit),i),e.offset+=s,n&&(this.offset+=s),this},r.appendTo=function(e,t){return e.append(this,t),this},r.assert=function(e){return this.noAssert=!e,this},r.capacity=function(){return this.buffer.byteLength},r.clear=function(){return this.offset=0,this.limit=this.buffer.byteLength,this.markedOffset=-1,this},r.clone=function(e){var r=new t(0,this.littleEndian,this.noAssert);return e?(r.buffer=new ArrayBuffer(this.buffer.byteLength),r.view=new Uint8Array(r.buffer)):(r.buffer=this.buffer,r.view=this.view),r.offset=this.offset,r.markedOffset=this.markedOffset,r.limit=this.limit,r},r.compact=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}if(0===e&&t===this.buffer.byteLength)return this;var r=t-e;if(0===r)return this.buffer=i,this.view=null,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=0,this;var n=new ArrayBuffer(r),s=new Uint8Array(n);return s.set(this.view.subarray(e,t)),this.buffer=n,this.view=s,this.markedOffset>=0&&(this.markedOffset-=e),this.offset=0,this.limit=r,this},r.copy=function(e,r){if(void 0===e&&(e=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal end: Not an integer");if(r>>>=0,e<0||e>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+r+" <= "+this.buffer.byteLength)}if(e===r)return new t(0,this.littleEndian,this.noAssert);var i=r-e,n=new t(i,this.littleEndian,this.noAssert);return n.offset=0,n.limit=i,n.markedOffset>=0&&(n.markedOffset-=e),this.copyTo(n,0,e,r),n},r.copyTo=function(e,r,i,n){var s,o;if(!this.noAssert&&!t.isByteBuffer(e))throw TypeError("Illegal target: Not a ByteBuffer");if(r=(o=void 0===r)?e.offset:0|r,i=(s=void 0===i)?this.offset:0|i,n=void 0===n?this.limit:0|n,r<0||r>e.buffer.byteLength)throw RangeError("Illegal target range: 0 <= "+r+" <= "+e.buffer.byteLength);if(i<0||n>this.buffer.byteLength)throw RangeError("Illegal source range: 0 <= "+i+" <= "+this.buffer.byteLength);var a=n-i;return 0===a?e:(e.ensureCapacity(r+a),e.view.set(this.view.subarray(i,n),r),s&&(this.offset+=a),o&&(e.offset+=a),this)},r.ensureCapacity=function(e){var t=this.buffer.byteLength;return t<e?this.resize((t*=2)>e?t:e):this},r.fill=function(e,t,r){var i=void 0===t;if(i&&(t=this.offset),"string"==typeof e&&e.length>0&&(e=e.charCodeAt(0)),void 0===t&&(t=this.offset),void 0===r&&(r=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal value: "+e+" (not an integer)");if(e|=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal begin: Not an integer");if(t>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal end: Not an integer");if(r>>>=0,t<0||t>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+r+" <= "+this.buffer.byteLength)}if(t>=r)return this;for(;t<r;)this.view[t++]=e;return i&&(this.offset=t),this},r.flip=function(){return this.limit=this.offset,this.offset=0,this},r.mark=function(e){if(e=void 0===e?this.offset:e,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal offset: "+e+" (not an integer)");if((e>>>=0)<0||e+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+e+" (+0) <= "+this.buffer.byteLength)}return this.markedOffset=e,this},r.order=function(e){if(!this.noAssert&&"boolean"!=typeof e)throw TypeError("Illegal littleEndian: Not a boolean");return this.littleEndian=!!e,this},r.LE=function(e){return this.littleEndian=void 0===e||!!e,this},r.BE=function(e){return this.littleEndian=void 0!==e&&!e,this},r.prepend=function(e,r,i){"number"!=typeof r&&"string"==typeof r||(i=r,r=void 0);var n=void 0===i;if(n&&(i=this.offset),!this.noAssert){if("number"!=typeof i||i%1!=0)throw TypeError("Illegal offset: "+i+" (not an integer)");if((i>>>=0)<0||i+0>this.buffer.byteLength)throw RangeError("Illegal offset: 0 <= "+i+" (+0) <= "+this.buffer.byteLength)}e instanceof t||(e=t.wrap(e,r));var s=e.limit-e.offset;if(s<=0)return this;var o=s-i;if(o>0){var a=new ArrayBuffer(this.buffer.byteLength+o),d=new Uint8Array(a);d.set(this.view.subarray(i,this.buffer.byteLength),s),this.buffer=a,this.view=d,this.offset+=o,this.markedOffset>=0&&(this.markedOffset+=o),this.limit+=o,i+=o}else new Uint8Array(this.buffer);return this.view.set(e.view.subarray(e.offset,e.limit),i-s),e.offset=e.limit,n&&(this.offset-=s),this},r.prependTo=function(e,t){return e.prepend(this,t),this},r.printDebug=function(e){"function"!=typeof e&&(e=console.log.bind(console)),e(this.toString()+"\n-------------------------------------------------------------------\n"+this.toDebug(!0))},r.remaining=function(){return this.limit-this.offset},r.reset=function(){return this.markedOffset>=0?(this.offset=this.markedOffset,this.markedOffset=-1):this.offset=0,this},r.resize=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal capacity: "+e+" (not an integer)");if((e|=0)<0)throw RangeError("Illegal capacity: 0 <= "+e)}if(this.buffer.byteLength<e){var t=new ArrayBuffer(e),r=new Uint8Array(t);r.set(this.view),this.buffer=t,this.view=r}return this},r.reverse=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}return e===t||Array.prototype.reverse.call(this.view.subarray(e,t)),this},r.skip=function(e){if(!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal length: "+e+" (not an integer)");e|=0}var t=this.offset+e;if(!this.noAssert&&(t<0||t>this.buffer.byteLength))throw RangeError("Illegal length: 0 <= "+this.offset+" + "+e+" <= "+this.buffer.byteLength);return this.offset=t,this},r.slice=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r=this.clone();return r.offset=e,r.limit=t,r},r.toBuffer=function(e){var t=this.offset,r=this.limit;if(!this.noAssert){if("number"!=typeof t||t%1!=0)throw TypeError("Illegal offset: Not an integer");if(t>>>=0,"number"!=typeof r||r%1!=0)throw TypeError("Illegal limit: Not an integer");if(r>>>=0,t<0||t>r||r>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+t+" <= "+r+" <= "+this.buffer.byteLength)}if(!e&&0===t&&r===this.buffer.byteLength)return this.buffer;if(t===r)return i;var n=new ArrayBuffer(r-t);return new Uint8Array(n).set(new Uint8Array(this.buffer).subarray(t,r),0),n},r.toArrayBuffer=r.toBuffer,r.toString=function(e,t,r){if(void 0===e)return"ByteBufferAB(offset="+this.offset+",markedOffset="+this.markedOffset+",limit="+this.limit+",capacity="+this.capacity()+")";switch("number"==typeof e&&(r=t=e="utf8"),e){case"utf8":return this.toUTF8(t,r);case"base64":return this.toBase64(t,r);case"hex":return this.toHex(t,r);case"binary":return this.toBinary(t,r);case"debug":return this.toDebug();case"columns":return this.toColumns();default:throw Error("Unsupported encoding: "+e)}};var u=function(){for(var e={},t=[65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,48,49,50,51,52,53,54,55,56,57,43,47],r=[],i=0,n=t.length;i<n;++i)r[t[i]]=i;return e.encode=function(e,r){for(var i,n;null!==(i=e());)r(t[i>>2&63]),n=(3&i)<<4,null!==(i=e())?(r(t[63&((n|=i>>4&15)|i>>4&15)]),n=(15&i)<<2,null!==(i=e())?(r(t[63&(n|i>>6&3)]),r(t[63&i])):(r(t[63&n]),r(61))):(r(t[63&n]),r(61),r(61))},e.decode=function(e,t){var i,n,s;function o(e){throw Error("Illegal character code: "+e)}for(;null!==(i=e());)if(void 0===(n=r[i])&&o(i),null!==(i=e())&&(void 0===(s=r[i])&&o(i),t(n<<2>>>0|(48&s)>>4),null!==(i=e()))){if(void 0===(n=r[i])){if(61===i)break;o(i)}if(t((15&s)<<4>>>0|(60&n)>>2),null!==(i=e())){if(void 0===(s=r[i])){if(61===i)break;o(i)}t((3&n)<<6>>>0|s)}}},e.test=function(e){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(e)},e}();r.toBase64=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity||e>t)throw RangeError("begin, end");var r;return u.encode(function(){return e<t?this.view[e++]:null}.bind(this),r=o()),r()},t.fromBase64=function(e,r){if("string"!=typeof e)throw TypeError("str");var i=new t(e.length/4*3,r),n=0;return u.decode(s(e),(function(e){i.view[n++]=e})),i.limit=n,i},t.btoa=function(e){return t.fromBinary(e).toBase64()},t.atob=function(e){return t.fromBase64(e).toBinary()},r.toBinary=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),t|=0,(e|=0)<0||t>this.capacity()||e>t)throw RangeError("begin, end");if(e===t)return"";for(var r=[],i=[];e<t;)r.push(this.view[e++]),r.length>=1024&&(i.push(String.fromCharCode.apply(String,r)),r=[]);return i.join("")+String.fromCharCode.apply(String,r)},t.fromBinary=function(e,r){if("string"!=typeof e)throw TypeError("str");for(var i,n=0,s=e.length,o=new t(s,r);n<s;){if((i=e.charCodeAt(n))>255)throw RangeError("illegal char code: "+i);o.view[n++]=i}return o.limit=s,o},r.toDebug=function(e){for(var t,r=-1,i=this.buffer.byteLength,n="",s="",o="";r<i;){if(-1!==r&&(n+=(t=this.view[r])<16?"0"+t.toString(16).toUpperCase():t.toString(16).toUpperCase(),e&&(s+=t>32&&t<127?String.fromCharCode(t):".")),++r,e&&r>0&&r%16==0&&r!==i){for(;n.length<51;)n+=" ";o+=n+s+"\n",n=s=""}r===this.offset&&r===this.limit?n+=r===this.markedOffset?"!":"|":r===this.offset?n+=r===this.markedOffset?"[":"<":r===this.limit?n+=r===this.markedOffset?"]":">":n+=r===this.markedOffset?"'":e||0!==r&&r!==i?" ":""}if(e&&" "!==n){for(;n.length<51;)n+=" ";o+=n+s+"\n"}return e?o:n},t.fromDebug=function(e,r,i){for(var n,s,o=e.length,a=new t((o+1)/3|0,r,i),d=0,u=0,l=!1,c=!1,p=!1,h=!1,f=!1;d<o;){switch(n=e.charAt(d++)){case"!":if(!i){if(c||p||h){f=!0;break}c=p=h=!0}a.offset=a.markedOffset=a.limit=u,l=!1;break;case"|":if(!i){if(c||h){f=!0;break}c=h=!0}a.offset=a.limit=u,l=!1;break;case"[":if(!i){if(c||p){f=!0;break}c=p=!0}a.offset=a.markedOffset=u,l=!1;break;case"<":if(!i){if(c){f=!0;break}c=!0}a.offset=u,l=!1;break;case"]":if(!i){if(h||p){f=!0;break}h=p=!0}a.limit=a.markedOffset=u,l=!1;break;case">":if(!i){if(h){f=!0;break}h=!0}a.limit=u,l=!1;break;case"'":if(!i){if(p){f=!0;break}p=!0}a.markedOffset=u,l=!1;break;case" ":l=!1;break;default:if(!i&&l){f=!0;break}if(s=parseInt(n+e.charAt(d++),16),!i&&(isNaN(s)||s<0||s>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[u++]=s,l=!0}if(f)throw TypeError("Illegal str: Invalid symbol at "+d)}if(!i){if(!c||!h)throw TypeError("Illegal str: Missing offset or limit");if(u<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+u+" < "+o)}return a},r.toHex=function(e,t){if(e=void 0===e?this.offset:e,t=void 0===t?this.limit:t,!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}for(var r,i=new Array(t-e);e<t;)(r=this.view[e++])<16?i.push("0",r.toString(16)):i.push(r.toString(16));return i.join("")},t.fromHex=function(e,r,i){if(!i){if("string"!=typeof e)throw TypeError("Illegal str: Not a string");if(e.length%2!=0)throw TypeError("Illegal str: Length not a multiple of 2")}for(var n,s=e.length,o=new t(s/2|0,r),a=0,d=0;a<s;a+=2){if(n=parseInt(e.substring(a,a+2),16),!i&&(!isFinite(n)||n<0||n>255))throw TypeError("Illegal str: Contains non-hex characters");o.view[d++]=n}return o.limit=d,o};var l=function(){var e={MAX_CODEPOINT:1114111,encodeUTF8:function(e,t){var r=null;for("number"==typeof e&&(r=e,e=function(){return null});null!==r||null!==(r=e());)r<128?t(127&r):r<2048?(t(r>>6&31|192),t(63&r|128)):r<65536?(t(r>>12&15|224),t(r>>6&63|128),t(63&r|128)):(t(r>>18&7|240),t(r>>12&63|128),t(r>>6&63|128),t(63&r|128)),r=null},decodeUTF8:function(e,t){for(var r,i,n,s,o=function(e){e=e.slice(0,e.indexOf(null));var t=Error(e.toString());throw t.name="TruncatedError",t.bytes=e,t};null!==(r=e());)if(0==(128&r))t(r);else if(192==(224&r))null===(i=e())&&o([r,i]),t((31&r)<<6|63&i);else if(224==(240&r))(null===(i=e())||null===(n=e()))&&o([r,i,n]),t((15&r)<<12|(63&i)<<6|63&n);else{if(240!=(248&r))throw RangeError("Illegal starting byte: "+r);(null===(i=e())||null===(n=e())||null===(s=e()))&&o([r,i,n,s]),t((7&r)<<18|(63&i)<<12|(63&n)<<6|63&s)}},UTF16toUTF8:function(e,t){for(var r,i=null;null!==(r=null!==i?i:e());)r>=55296&&r<=57343&&null!==(i=e())&&i>=56320&&i<=57343?(t(1024*(r-55296)+i-56320+65536),i=null):t(r);null!==i&&t(i)},UTF8toUTF16:function(e,t){var r=null;for("number"==typeof e&&(r=e,e=function(){return null});null!==r||null!==(r=e());)r<=65535?t(r):(t(55296+((r-=65536)>>10)),t(r%1024+56320)),r=null},encodeUTF16toUTF8:function(t,r){e.UTF16toUTF8(t,(function(t){e.encodeUTF8(t,r)}))},decodeUTF8toUTF16:function(t,r){e.decodeUTF8(t,(function(t){e.UTF8toUTF16(t,r)}))},calculateCodePoint:function(e){return e<128?1:e<2048?2:e<65536?3:4},calculateUTF8:function(e){for(var t,r=0;null!==(t=e());)r+=t<128?1:t<2048?2:t<65536?3:4;return r},calculateUTF16asUTF8:function(t){var r=0,i=0;return e.UTF16toUTF8(t,(function(e){++r,i+=e<128?1:e<2048?2:e<65536?3:4})),[r,i]}};return e}();return r.toUTF8=function(e,t){if(void 0===e&&(e=this.offset),void 0===t&&(t=this.limit),!this.noAssert){if("number"!=typeof e||e%1!=0)throw TypeError("Illegal begin: Not an integer");if(e>>>=0,"number"!=typeof t||t%1!=0)throw TypeError("Illegal end: Not an integer");if(t>>>=0,e<0||e>t||t>this.buffer.byteLength)throw RangeError("Illegal range: 0 <= "+e+" <= "+t+" <= "+this.buffer.byteLength)}var r;try{l.decodeUTF8toUTF16(function(){return e<t?this.view[e++]:null}.bind(this),r=o())}catch(r){if(e!==t)throw RangeError("Illegal range: Truncated data, "+e+" != "+t)}return r()},t.fromUTF8=function(e,r,i){if(!i&&"string"!=typeof e)throw TypeError("Illegal str: Not a string");var n=new t(l.calculateUTF16asUTF8(s(e),!0)[1],r,i),o=0;return l.encodeUTF16toUTF8(s(e),(function(e){n.view[o++]=e})),n.limit=o,n},t},void 0===(s="function"==typeof i?i.apply(t,n):i)||(e.exports=s)},6874:function(e,t){var r,i,n;i=[],void 0===(n="function"==typeof(r=function(){"use strict";function e(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function t(e){return!0===(e&&e.__isLong__)}e.prototype.__isLong__,Object.defineProperty(e.prototype,"__isLong__",{value:!0,enumerable:!1,configurable:!1}),e.isLong=t;var r={},i={};function n(e,t){var n,s,a;return t?(a=0<=(e>>>=0)&&e<256)&&(s=i[e])?s:(n=o(e,(0|e)<0?-1:0,!0),a&&(i[e]=n),n):(a=-128<=(e|=0)&&e<128)&&(s=r[e])?s:(n=o(e,e<0?-1:0,!1),a&&(r[e]=n),n)}function s(e,t){if(isNaN(e)||!isFinite(e))return t?g:y;if(t){if(e<0)return g;if(e>=p)return w}else{if(e<=-h)return E;if(e+1>=h)return _}return e<0?s(-e,t).neg():o(e%c|0,e/c|0,t)}function o(t,r,i){return new e(t,r,i)}e.fromInt=n,e.fromNumber=s,e.fromBits=o;var a=Math.pow;function d(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return y;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return d(e.substring(1),t,r).neg();for(var n=s(a(r,8)),o=y,u=0;u<e.length;u+=8){var l=Math.min(8,e.length-u),c=parseInt(e.substring(u,u+l),r);if(l<8){var p=s(a(r,l));o=o.mul(p).add(s(c))}else o=(o=o.mul(n)).add(s(c))}return o.unsigned=t,o}function u(t){return t instanceof e?t:"number"==typeof t?s(t):"string"==typeof t?d(t):o(t.low,t.high,t.unsigned)}e.fromString=d,e.fromValue=u;var l=65536,c=l*l,p=c*c,h=p/2,f=n(1<<24),y=n(0);e.ZERO=y;var g=n(0,!0);e.UZERO=g;var m=n(1);e.ONE=m;var v=n(1,!0);e.UONE=v;var b=n(-1);e.NEG_ONE=b;var _=o(-1,2147483647,!1);e.MAX_VALUE=_;var w=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=w;var E=o(0,-2147483648,!1);e.MIN_VALUE=E;var T=e.prototype;return T.toInt=function(){return this.unsigned?this.low>>>0:this.low},T.toNumber=function(){return this.unsigned?(this.high>>>0)*c+(this.low>>>0):this.high*c+(this.low>>>0)},T.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(E)){var t=s(e),r=this.div(t),i=r.mul(t).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=s(a(e,6),this.unsigned),o=this,d="";;){var u=o.div(n),l=(o.sub(u.mul(n)).toInt()>>>0).toString(e);if((o=u).isZero())return l+d;for(;l.length<6;)l="0"+l;d=""+l+d}},T.getHighBits=function(){return this.high},T.getHighBitsUnsigned=function(){return this.high>>>0},T.getLowBits=function(){return this.low},T.getLowBitsUnsigned=function(){return this.low>>>0},T.getNumBitsAbs=function(){if(this.isNegative())return this.eq(E)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},T.isZero=function(){return 0===this.high&&0===this.low},T.isNegative=function(){return!this.unsigned&&this.high<0},T.isPositive=function(){return this.unsigned||this.high>=0},T.isOdd=function(){return 1==(1&this.low)},T.isEven=function(){return 0==(1&this.low)},T.equals=function(e){return t(e)||(e=u(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},T.eq=T.equals,T.notEquals=function(e){return!this.eq(e)},T.neq=T.notEquals,T.lessThan=function(e){return this.comp(e)<0},T.lt=T.lessThan,T.lessThanOrEqual=function(e){return this.comp(e)<=0},T.lte=T.lessThanOrEqual,T.greaterThan=function(e){return this.comp(e)>0},T.gt=T.greaterThan,T.greaterThanOrEqual=function(e){return this.comp(e)>=0},T.gte=T.greaterThanOrEqual,T.compare=function(e){if(t(e)||(e=u(e)),this.eq(e))return 0;var r=this.isNegative(),i=e.isNegative();return r&&!i?-1:!r&&i?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},T.comp=T.compare,T.negate=function(){return!this.unsigned&&this.eq(E)?E:this.not().add(m)},T.neg=T.negate,T.add=function(e){t(e)||(e=u(e));var r=this.high>>>16,i=65535&this.high,n=this.low>>>16,s=65535&this.low,a=e.high>>>16,d=65535&e.high,l=e.low>>>16,c=0,p=0,h=0,f=0;return h+=(f+=s+(65535&e.low))>>>16,p+=(h+=n+l)>>>16,c+=(p+=i+d)>>>16,c+=r+a,o((h&=65535)<<16|(f&=65535),(c&=65535)<<16|(p&=65535),this.unsigned)},T.subtract=function(e){return t(e)||(e=u(e)),this.add(e.neg())},T.sub=T.subtract,T.multiply=function(e){if(this.isZero())return y;if(t(e)||(e=u(e)),e.isZero())return y;if(this.eq(E))return e.isOdd()?E:y;if(e.eq(E))return this.isOdd()?E:y;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(f)&&e.lt(f))return s(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,i=65535&this.high,n=this.low>>>16,a=65535&this.low,d=e.high>>>16,l=65535&e.high,c=e.low>>>16,p=65535&e.low,h=0,g=0,m=0,v=0;return m+=(v+=a*p)>>>16,g+=(m+=n*p)>>>16,m&=65535,g+=(m+=a*c)>>>16,h+=(g+=i*p)>>>16,g&=65535,h+=(g+=n*c)>>>16,g&=65535,h+=(g+=a*l)>>>16,h+=r*p+i*c+n*l+a*d,o((m&=65535)<<16|(v&=65535),(h&=65535)<<16|(g&=65535),this.unsigned)},T.mul=T.multiply,T.divide=function(e){if(t(e)||(e=u(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?g:y;var r,i,n;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return g;if(e.gt(this.shru(1)))return v;n=g}else{if(this.eq(E))return e.eq(m)||e.eq(b)?E:e.eq(E)?m:(r=this.shr(1).div(e).shl(1)).eq(y)?e.isNegative()?m:b:(i=this.sub(e.mul(r)),n=r.add(i.div(e)));if(e.eq(E))return this.unsigned?g:y;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();n=y}for(i=this;i.gte(e);){r=Math.max(1,Math.floor(i.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),d=o<=48?1:a(2,o-48),l=s(r),c=l.mul(e);c.isNegative()||c.gt(i);)c=(l=s(r-=d,this.unsigned)).mul(e);l.isZero()&&(l=m),n=n.add(l),i=i.sub(c)}return n},T.div=T.divide,T.modulo=function(e){return t(e)||(e=u(e)),this.sub(this.div(e).mul(e))},T.mod=T.modulo,T.not=function(){return o(~this.low,~this.high,this.unsigned)},T.and=function(e){return t(e)||(e=u(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},T.or=function(e){return t(e)||(e=u(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},T.xor=function(e){return t(e)||(e=u(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},T.shiftLeft=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):o(0,this.low<<e-32,this.unsigned)},T.shl=T.shiftLeft,T.shiftRight=function(e){return t(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?o(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):o(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},T.shr=T.shiftRight,T.shiftRightUnsigned=function(e){if(t(e)&&(e=e.toInt()),0==(e&=63))return this;var r=this.high;return e<32?o(this.low>>>e|r<<32-e,r>>>e,this.unsigned):o(32===e?r:r>>>e-32,0,this.unsigned)},T.shru=T.shiftRightUnsigned,T.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},T.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},T.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},T.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24&255,255&e,e>>>8&255,e>>>16&255,e>>>24&255]},T.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t]},e})?r.apply(t,i):r)||(e.exports=n)},2699:e=>{"use strict";var t,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var n=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(r,i){function n(r){e.removeListener(t,s),i(r)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",n),r([].slice.call(arguments))}y(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&y(e,"error",t,r)}(e,n,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function u(e,t,r,i){var n,s,o,u;if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=d(e))>0&&o.length>n&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,u=l,console&&console.warn&&console.warn(u)}return e}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function c(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=l.bind(i);return n.listener=r,i.wrapFn=n,n}function p(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=new Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):f(n,n.length)}function h(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function f(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function y(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function n(s){i.once&&e.removeEventListener(t,n),r(s)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o},set:function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||n(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return d(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var d=s[e];if(void 0===d)return!1;if("function"==typeof d)i(d,this,t);else{var u=d.length,l=f(d,u);for(r=0;r<u;++r)i(l[r],this,t)}return!0},s.prototype.addListener=function(e,t){return u(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return u(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,c(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,c(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,s,o;if(a(t),void 0===(i=this._events))return this;if(void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0===arguments.length){var n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},6920:e=>{e.exports=o,o.default=o,o.stable=l,o.stableStringify=l;var t="[...]",r="[Circular]",i=[],n=[];function s(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function o(e,t,r,o){var a;void 0===o&&(o=s()),d(e,"",0,[],void 0,0,o);try{a=0===n.length?JSON.stringify(e,t,r):JSON.stringify(e,p(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var u=i.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return a}function a(e,t,r,s){var o=Object.getOwnPropertyDescriptor(s,r);void 0!==o.get?o.configurable?(Object.defineProperty(s,r,{value:e}),i.push([s,r,t,o])):n.push([t,r,e]):(s[r]=e,i.push([s,r,t]))}function d(e,i,n,s,o,u,l){var c;if(u+=1,"object"==typeof e&&null!==e){for(c=0;c<s.length;c++)if(s[c]===e)return void a(r,e,i,o);if(void 0!==l.depthLimit&&u>l.depthLimit)return void a(t,e,i,o);if(void 0!==l.edgesLimit&&n+1>l.edgesLimit)return void a(t,e,i,o);if(s.push(e),Array.isArray(e))for(c=0;c<e.length;c++)d(e[c],c,c,s,e,u,l);else{var p=Object.keys(e);for(c=0;c<p.length;c++){var h=p[c];d(e[h],h,c,s,e,u,l)}}s.pop()}}function u(e,t){return e<t?-1:e>t?1:0}function l(e,t,r,o){void 0===o&&(o=s());var a,d=c(e,"",0,[],void 0,0,o)||e;try{a=0===n.length?JSON.stringify(d,t,r):JSON.stringify(d,p(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var u=i.pop();4===u.length?Object.defineProperty(u[0],u[1],u[3]):u[0][u[1]]=u[2]}}return a}function c(e,n,s,o,d,l,p){var h;if(l+=1,"object"==typeof e&&null!==e){for(h=0;h<o.length;h++)if(o[h]===e)return void a(r,e,n,d);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==p.depthLimit&&l>p.depthLimit)return void a(t,e,n,d);if(void 0!==p.edgesLimit&&s+1>p.edgesLimit)return void a(t,e,n,d);if(o.push(e),Array.isArray(e))for(h=0;h<e.length;h++)c(e[h],h,h,o,e,l,p);else{var f={},y=Object.keys(e).sort(u);for(h=0;h<y.length;h++){var g=y[h];c(e[g],g,h,o,e,l,p),f[g]=e[g]}if(void 0===d)return f;i.push([d,n,e]),d[n]=f}o.pop()}}function p(e){return e=void 0!==e?e:function(e,t){return t},function(t,r){if(n.length>0)for(var i=0;i<n.length;i++){var s=n[i];if(s[1]===t&&s[0]===r){r=s[2],n.splice(i,1);break}}return e.call(this,t,r)}}},2333:(e,t)=>{t.read=function(e,t,r,i,n){var s,o,a=8*n-i-1,d=(1<<a)-1,u=d>>1,l=-7,c=r?n-1:0,p=r?-1:1,h=e[t+c];for(c+=p,s=h&(1<<-l)-1,h>>=-l,l+=a;l>0;s=256*s+e[t+c],c+=p,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=i;l>0;o=256*o+e[t+c],c+=p,l-=8);if(0===s)s=1-u;else{if(s===d)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=u}return(h?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var o,a,d,u=8*s-n-1,l=(1<<u)-1,c=l>>1,p=23===n?Math.pow(2,-24)-Math.pow(2,-77):0,h=i?0:s-1,f=i?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-o))<1&&(o--,d*=2),(t+=o+c>=1?p/d:p*Math.pow(2,1-c))*d>=2&&(o++,d/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(t*d-1)*Math.pow(2,n),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,n),o=0));n>=8;e[r+h]=255&a,h+=f,a/=256,n-=8);for(o=o<<n|a,u+=n;u>0;e[r+h]=255&o,h+=f,o/=256,u-=8);e[r+h-f]|=128*y}},1297:(e,t,r)=>{e.exports=function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){if(s)return s(o,!0);var d=new Error("Cannot find module '"+o+"'");throw d.code="MODULE_NOT_FOUND",d}var u=r[o]={exports:{}};t[o][0].call(u.exports,(function(e){return n(t[o][1][e]||e)}),u,u.exports,e,t,r,i)}return r[o].exports}for(var s=void 0,o=0;o<i.length;o++)n(i[o]);return n}({1:[function(e,t,r){"use strict";var i=e("./utils"),n=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";r.encode=function(e){for(var t,r,n,o,a,d,u,l=[],c=0,p=e.length,h=p,f="string"!==i.getTypeOf(e);c<e.length;)h=p-c,n=f?(t=e[c++],r=c<p?e[c++]:0,c<p?e[c++]:0):(t=e.charCodeAt(c++),r=c<p?e.charCodeAt(c++):0,c<p?e.charCodeAt(c++):0),o=t>>2,a=(3&t)<<4|r>>4,d=1<h?(15&r)<<2|n>>6:64,u=2<h?63&n:64,l.push(s.charAt(o)+s.charAt(a)+s.charAt(d)+s.charAt(u));return l.join("")},r.decode=function(e){var t,r,i,o,a,d,u=0,l=0,c="data:";if(e.substr(0,c.length)===c)throw new Error("Invalid base64 input, it looks like a data url.");var p,h=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&h--,e.charAt(e.length-2)===s.charAt(64)&&h--,h%1!=0)throw new Error("Invalid base64 input, bad content length.");for(p=n.uint8array?new Uint8Array(0|h):new Array(0|h);u<e.length;)t=s.indexOf(e.charAt(u++))<<2|(o=s.indexOf(e.charAt(u++)))>>4,r=(15&o)<<4|(a=s.indexOf(e.charAt(u++)))>>2,i=(3&a)<<6|(d=s.indexOf(e.charAt(u++))),p[l++]=t,64!==a&&(p[l++]=r),64!==d&&(p[l++]=i);return p}},{"./support":30,"./utils":32}],2:[function(e,t,r){"use strict";var i=e("./external"),n=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,r,i,n){this.compressedSize=e,this.uncompressedSize=t,this.crc32=r,this.compression=i,this.compressedContent=n}a.prototype={getContentWorker:function(){var e=new n(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new n(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,r){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(r)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,r){"use strict";var i=e("./stream/GenericWorker");r.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},r.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,r){"use strict";var i=e("./utils"),n=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,r,i){var s=n,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,r,i){var s=n,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,r){"use strict";r.base64=!1,r.binary=!1,r.dir=!1,r.createFolders=!0,r.date=null,r.compression=null,r.compressionOptions=null,r.comment=null,r.unixPermissions=null,r.dosPermissions=null},{}],6:[function(e,t,r){"use strict";var i=null;i="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,n=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=i?"uint8array":"array";function d(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(d,o),d.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},d.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},d.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},d.prototype._createPako=function(){this._pako=new n[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},r.compressWorker=function(e){return new d("Deflate",e)},r.uncompressWorker=function(){return new d("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,r){"use strict";function i(e,t){var r,i="";for(r=0;r<t;r++)i+=String.fromCharCode(255&e),e>>>=8;return i}function n(e,t,r,n,o,l){var c,p,h=e.file,f=e.compression,y=l!==a.utf8encode,g=s.transformTo("string",l(h.name)),m=s.transformTo("string",a.utf8encode(h.name)),v=h.comment,b=s.transformTo("string",l(v)),_=s.transformTo("string",a.utf8encode(v)),w=m.length!==h.name.length,E=_.length!==v.length,T="",S="",R="",O=h.dir,I=h.date,x={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(x.crc32=e.crc32,x.compressedSize=e.compressedSize,x.uncompressedSize=e.uncompressedSize);var A=0;t&&(A|=8),y||!w&&!E||(A|=2048);var C=0,k=0;O&&(C|=16),"UNIX"===o?(k=798,C|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,O)):(k=20,C|=function(e){return 63&(e||0)}(h.dosPermissions)),c=I.getUTCHours(),c<<=6,c|=I.getUTCMinutes(),c<<=5,c|=I.getUTCSeconds()/2,p=I.getUTCFullYear()-1980,p<<=4,p|=I.getUTCMonth()+1,p<<=5,p|=I.getUTCDate(),w&&(S=i(1,1)+i(d(g),4)+m,T+="up"+i(S.length,2)+S),E&&(R=i(1,1)+i(d(b),4)+_,T+="uc"+i(R.length,2)+R);var M="";return M+="\n\0",M+=i(A,2),M+=f.magic,M+=i(c,2),M+=i(p,2),M+=i(x.crc32,4),M+=i(x.compressedSize,4),M+=i(x.uncompressedSize,4),M+=i(g.length,2),M+=i(T.length,2),{fileRecord:u.LOCAL_FILE_HEADER+M+g+T,dirRecord:u.CENTRAL_FILE_HEADER+i(k,2)+M+i(b.length,2)+"\0\0\0\0"+i(C,4)+i(n,4)+g+T+b}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),d=e("../crc32"),u=e("../signature");function l(e,t,r,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=r,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(l,o),l.prototype.push=function(e){var t=e.meta.percent||0,r=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:r?(t+100*(r-i-1))/r:100}}))},l.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var r=n(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:r.fileRecord,meta:{percent:0}})}else this.accumulate=!0},l.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,r=n(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(r.dirRecord),t)this.push({data:function(e){return u.DATA_DESCRIPTOR+i(e.crc32,4)+i(e.compressedSize,4)+i(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:r.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},l.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var r=this.bytesWritten-e,n=function(e,t,r,n,o){var a=s.transformTo("string",o(n));return u.CENTRAL_DIRECTORY_END+"\0\0\0\0"+i(e,2)+i(e,2)+i(t,4)+i(r,4)+i(a.length,2)+a}(this.dirRecords.length,r,e,this.zipComment,this.encodeFileName);this.push({data:n,meta:{percent:100}})},l.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},l.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},l.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},l.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var r=0;r<t.length;r++)try{t[r].error(e)}catch(e){}return!0},l.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=l},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,r){"use strict";var i=e("../compressions"),n=e("./ZipFileWorker");r.generateWorker=function(e,t,r){var s=new n(t.streamFiles,r,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,r){o++;var n=function(e,t){var r=e||t,n=i[r];if(!n)throw new Error(r+" is not a valid compression method !");return n}(r.options.compression,t.compression),a=r.options.compressionOptions||t.compressionOptions||{},d=r.dir,u=r.date;r._compressWorker(n,a).withStreamInfo("file",{name:e,dir:d,date:u,comment:r.comment||"",unixPermissions:r.unixPermissions,dosPermissions:r.dosPermissions}).pipe(s)})),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,r){"use strict";function i(){if(!(this instanceof i))return new i;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new i;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(i.prototype=e("./object")).loadAsync=e("./load"),i.support=e("./support"),i.defaults=e("./defaults"),i.version="3.10.1",i.loadAsync=function(e,t){return(new i).loadAsync(e,t)},i.external=e("./external"),t.exports=i},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,r){"use strict";var i=e("./utils"),n=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),d=e("./nodejsUtils");function u(e){return new n.Promise((function(t,r){var i=e.decompressed.getContentWorker().pipe(new a);i.on("error",(function(e){r(e)})).on("end",(function(){i.streamInfo.crc32!==e.decompressed.crc32?r(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var r=this;return t=i.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),d.isNode&&d.isStream(e)?n.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):i.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var r=new o(t);return r.load(e),r})).then((function(e){var r=[n.Promise.resolve(e)],i=e.files;if(t.checkCRC32)for(var s=0;s<i.length;s++)r.push(u(i[s]));return n.Promise.all(r)})).then((function(e){for(var n=e.shift(),s=n.files,o=0;o<s.length;o++){var a=s[o],d=a.fileNameStr,u=i.resolve(a.fileNameStr);r.file(u,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(r.file(u).unsafeOriginalName=d)}return n.zipComment.length&&(r.comment=n.zipComment),r}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../stream/GenericWorker");function s(e,t){n.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}i.inherits(s,n),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},s.prototype.pause=function(){return!!n.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,r){"use strict";var i=e("readable-stream").Readable;function n(e,t,r){i.call(this,t),this._helper=e;var n=this;e.on("data",(function(e,t){n.push(e)||n._helper.pause(),r&&r(t)})).on("error",(function(e){n.emit("error",e)})).on("end",(function(){n.push(null)}))}e("../utils").inherits(n,i),n.prototype._read=function(){this._helper.resume()},t.exports=n},{"../utils":32,"readable-stream":16}],14:[function(e,t,r){"use strict";t.exports={isNode:"undefined"!=typeof Buffer,newBufferFrom:function(e,t){if(Buffer.from&&Buffer.from!==Uint8Array.from)return Buffer.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new Buffer(e,t)},allocBuffer:function(e){if(Buffer.alloc)return Buffer.alloc(e);var t=new Buffer(e);return t.fill(0),t},isBuffer:function(e){return Buffer.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,r){"use strict";function i(e,t,r){var i,n=s.getTypeOf(t),a=s.extend(r||{},d);a.date=a.date||new Date,null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=y(e)),a.createFolders&&(i=f(e))&&g.call(this,i,!0);var c="string"===n&&!1===a.binary&&!1===a.base64;r&&void 0!==r.binary||(a.binary=!c),(t instanceof u&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var m=null;m=t instanceof u||t instanceof o?t:p.isNode&&p.isStream(t)?new h(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var v=new l(e,m,a);this.files[e]=v}var n=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),d=e("./defaults"),u=e("./compressedObject"),l=e("./zipObject"),c=e("./generate"),p=e("./nodejsUtils"),h=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},y=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:d.createFolders,e=y(e),this.files[e]||i.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function m(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var v={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,r,i;for(t in this.files)i=this.files[t],(r=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(r,i)},filter:function(e){var t=[];return this.forEach((function(r,i){e(r,i)&&t.push(i)})),t},file:function(e,t,r){if(1!==arguments.length)return e=this.root+e,i.call(this,e,t,r),this;if(m(e)){var n=e;return this.filter((function(e,t){return!t.dir&&n.test(e)}))}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(m(e))return this.filter((function(t,r){return r.dir&&e.test(t)}));var t=this.root+e,r=g.call(this,t),i=this.clone();return i.root=r.name,i},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var r=this.filter((function(t,r){return r.name.slice(0,e.length)===e})),i=0;i<r.length;i++)delete this.files[r[i].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,r={};try{if((r=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:n.utf8encode})).type=r.type.toLowerCase(),r.compression=r.compression.toUpperCase(),"binarystring"===r.type&&(r.type="string"),!r.type)throw new Error("No output type specified.");s.checkSupport(r.type),"darwin"!==r.platform&&"freebsd"!==r.platform&&"linux"!==r.platform&&"sunos"!==r.platform||(r.platform="UNIX"),"win32"===r.platform&&(r.platform="DOS");var i=r.comment||this.comment||"";t=c.generateWorker(this,r,i)}catch(e){(t=new o("error")).error(e)}return new a(t,r.type||"string",r.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=v},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,r){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,r){"use strict";var i=e("./DataReader");function n(e){i.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data[this.zero+e]},n.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===r&&this.data[s+2]===i&&this.data[s+3]===n)return s-this.zero;return-1},n.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),r=e.charCodeAt(1),i=e.charCodeAt(2),n=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&r===s[1]&&i===s[2]&&n===s[3]},n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],18:[function(e,t,r){"use strict";var i=e("../utils");function n(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}n.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,r=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)r=(r<<8)+this.byteAt(t);return this.index+=e,r},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=n},{"../utils":32}],19:[function(e,t,r){"use strict";var i=e("./Uint8ArrayReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,r){"use strict";var i=e("./DataReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},n.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},n.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},n.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./DataReader":18}],21:[function(e,t,r){"use strict";var i=e("./ArrayReader");function n(e){i.call(this,e)}e("../utils").inherits(n,i),n.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=n},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,r){"use strict";var i=e("../utils"),n=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),d=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||n.uint8array?"nodebuffer"===t?new a(e):n.uint8array?new d(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,r){"use strict";r.LOCAL_FILE_HEADER="PK",r.CENTRAL_FILE_HEADER="PK",r.CENTRAL_DIRECTORY_END="PK",r.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",r.ZIP64_CENTRAL_DIRECTORY_END="PK",r.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,r){"use strict";var i=e("./GenericWorker"),n=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}n.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:n.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,r){"use strict";var i=e("./GenericWorker"),n=e("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=n(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,n),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}n.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./GenericWorker");function s(e){n.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}i.inherits(s,n),s.prototype.cleanUp=function(){n.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!n.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,r){"use strict";function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var r=0;r<this._listeners[e].length;r++)this._listeners[e][r].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=i},{}],29:[function(e,t,r){"use strict";var i=e("../utils"),n=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),d=e("../external"),u=null;if(a.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function l(e,t){return new d.Promise((function(r,n){var s=[],a=e._internalType,d=e._outputType,u=e._mimeType;e.on("data",(function(e,r){s.push(e),t&&t(r)})).on("error",(function(e){s=[],n(e)})).on("end",(function(){try{var e=function(e,t,r){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),r);case"base64":return o.encode(t);default:return i.transformTo(e,t)}}(d,function(e,t){var r,i=0,n=null,s=0;for(r=0;r<t.length;r++)s+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(n=new Uint8Array(s),r=0;r<t.length;r++)n.set(t[r],i),i+=t[r].length;return n;case"nodebuffer":return Buffer.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(a,s),u);r(e)}catch(e){n(e)}s=[]})).resume()}))}function c(e,t,r){var o=t;switch(t){case"blob":case"arraybuffer":o="uint8array";break;case"base64":o="string"}try{this._internalType=o,this._outputType=t,this._mimeType=r,i.checkSupport(o),this._worker=e.pipe(new n(o)),e.lock()}catch(e){this._worker=new s("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return l(this,e)},on:function(e,t){var r=this;return"data"===e?this._worker.on(e,(function(e){t.call(r,e.data,e.meta)})):this._worker.on(e,(function(){i.delay(t,arguments,r)})),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},t.exports=c},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,t,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer="undefined"!=typeof Buffer,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var i=new ArrayBuffer(0);try{r.blob=0===new Blob([i],{type:"application/zip"}).size}catch(e){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);n.append(i),r.blob=0===n.getBlob("application/zip").size}catch(e){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(e){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,r){"use strict";for(var i=e("./utils"),n=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),d=0;d<256;d++)a[d]=252<=d?6:248<=d?5:240<=d?4:224<=d?3:192<=d?2:1;function u(){o.call(this,"utf-8 decode"),this.leftOver=null}function l(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,r.utf8encode=function(e){return n.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,r,i,s,o,a=e.length,d=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),d+=r<128?1:r<2048?2:r<65536?3:4;for(t=n.uint8array?new Uint8Array(d):new Array(d),s=o=0;o<d;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(i-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t}(e)},r.utf8decode=function(e){return n.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,r,n,s,o=e.length,d=new Array(2*o);for(t=r=0;t<o;)if((n=e[t++])<128)d[r++]=n;else if(4<(s=a[n]))d[r++]=65533,t+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&t<o;)n=n<<6|63&e[t++],s--;1<s?d[r++]=65533:n<65536?d[r++]=n:(n-=65536,d[r++]=55296|n>>10&1023,d[r++]=56320|1023&n)}return d.length!==r&&(d.subarray?d=d.subarray(0,r):d.length=r),i.applyFromCharCode(d)}(e=i.transformTo(n.uint8array?"uint8array":"array",e))},i.inherits(u,o),u.prototype.processChunk=function(e){var t=i.transformTo(n.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(n.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+a[e[r]]>t?r:t}(t),d=t;o!==t.length&&(n.uint8array?(d=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(d=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:r.utf8decode(d),meta:e.meta})},u.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=u,i.inherits(l,o),l.prototype.processChunk=function(e){this.push({data:r.utf8encode(e.data),meta:e.meta})},r.Utf8EncodeWorker=l},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var i=e("./support"),n=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function d(e,t){for(var r=0;r<e.length;++r)t[r]=255&e.charCodeAt(r);return t}e("setimmediate"),r.newBlob=function(e,t){r.checkSupport("blob");try{return new Blob([e],{type:t})}catch(r){try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return i.append(e),i.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,r){var i=[],n=0,s=e.length;if(s<=r)return String.fromCharCode.apply(null,e);for(;n<s;)"array"===t||"nodebuffer"===t?i.push(String.fromCharCode.apply(null,e.slice(n,Math.min(n+r,s)))):i.push(String.fromCharCode.apply(null,e.subarray(n,Math.min(n+r,s)))),n+=r;return i.join("")},stringifyByChar:function(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,s.allocBuffer(1)).length}catch(e){return!1}}()}};function l(e){var t=65536,i=r.getTypeOf(e),n=!0;if("uint8array"===i?n=u.applyCanBeUsed.uint8array:"nodebuffer"===i&&(n=u.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return u.stringifyByChunk(e,i,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function c(e,t){for(var r=0;r<e.length;r++)t[r]=e[r];return t}r.applyFromCharCode=l;var p={};p.string={string:a,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return p.string.uint8array(e).buffer},uint8array:function(e){return d(e,new Uint8Array(e.length))},nodebuffer:function(e){return d(e,s.allocBuffer(e.length))}},p.array={string:l,array:a,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(e)}},p.arraybuffer={string:function(e){return l(new Uint8Array(e))},array:function(e){return c(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:a,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return s.newBufferFrom(new Uint8Array(e))}},p.uint8array={string:l,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:a,nodebuffer:function(e){return s.newBufferFrom(e)}},p.nodebuffer={string:l,array:function(e){return c(e,new Array(e.length))},arraybuffer:function(e){return p.nodebuffer.uint8array(e).buffer},uint8array:function(e){return c(e,new Uint8Array(e.length))},nodebuffer:a},r.transformTo=function(e,t){if(t=t||"",!e)return t;r.checkSupport(e);var i=r.getTypeOf(t);return p[i][e](t)},r.resolve=function(e){for(var t=e.split("/"),r=[],i=0;i<t.length;i++){var n=t[i];"."===n||""===n&&0!==i&&i!==t.length-1||(".."===n?r.pop():r.push(n))}return r.join("/")},r.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":i.nodebuffer&&s.isBuffer(e)?"nodebuffer":i.uint8array&&e instanceof Uint8Array?"uint8array":i.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(e){var t,r,i="";for(r=0;r<(e||"").length;r++)i+="\\x"+((t=e.charCodeAt(r))<16?"0":"")+t.toString(16).toUpperCase();return i},r.delay=function(e,t,r){setImmediate((function(){e.apply(r||null,t||[])}))},r.inherits=function(e,t){function r(){}r.prototype=t.prototype,e.prototype=new r},r.extend=function(){var e,t,r={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===r[t]&&(r[t]=arguments[e][t]);return r},r.prepareContent=function(e,t,s,a,u){return o.Promise.resolve(t).then((function(e){return i.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)))&&"undefined"!=typeof FileReader?new o.Promise((function(t,r){var i=new FileReader;i.onload=function(e){t(e.target.result)},i.onerror=function(e){r(e.target.error)},i.readAsArrayBuffer(e)})):e})).then((function(t){var l=r.getTypeOf(t);return l?("arraybuffer"===l?t=r.transformTo("uint8array",t):"string"===l&&(u?t=n.decode(t):s&&!0!==a&&(t=function(e){return d(e,i.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):o.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,r){"use strict";var i=e("./reader/readerFor"),n=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function d(e){this.files=[],this.loadOptions=e}d.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+n.pretty(t)+", expected "+n.pretty(e)+")")}},isSignature:function(e,t){var r=this.reader.index;this.reader.setIndex(e);var i=this.reader.readString(4)===t;return this.reader.setIndex(r),i},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",r=n.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(r)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,r,i=this.zip64EndOfCentralSize-44;0<i;)e=this.reader.readInt(2),t=this.reader.readInt(4),r=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:r}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Can't find end of central directory : is this a zip file ? If it is, see https://stuk.github.io/jszip/documentation/howto/read_zip.html");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===n.MAX_VALUE_16BITS||this.diskWithCentralDirStart===n.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===n.MAX_VALUE_16BITS||this.centralDirRecords===n.MAX_VALUE_16BITS||this.centralDirSize===n.MAX_VALUE_32BITS||this.centralDirOffset===n.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var r=this.centralDirOffset+this.centralDirSize;this.zip64&&(r+=20,r+=12+this.zip64EndOfCentralSize);var i=t-r;if(0<i)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=i);else if(i<0)throw new Error("Corrupted zip: missing "+Math.abs(i)+" bytes.")},prepareReader:function(e){this.reader=i(e)},load:function(e){this.prepareReader(e),this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}},t.exports=d},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,r){"use strict";var i=e("./reader/readerFor"),n=e("./utils"),s=e("./compressedObject"),o=e("./crc32"),a=e("./utf8"),d=e("./compressions"),u=e("./support");function l(e,t){this.options=e,this.loadOptions=t}l.prototype={isEncrypted:function(){return 1==(1&this.bitFlag)},useUTF8:function(){return 2048==(2048&this.bitFlag)},readLocalPart:function(e){var t,r;if(e.skip(22),this.fileNameLength=e.readInt(2),r=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(r),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=function(e){for(var t in d)if(Object.prototype.hasOwnProperty.call(d,t)&&d[t].magic===e)return d[t];return null}(this.compressionMethod)))throw new Error("Corrupted zip : compression "+n.pretty(this.compressionMethod)+" unknown (inner file : "+n.transformTo("string",this.fileName)+")");this.decompressed=new s(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===n.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===n.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===n.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===n.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,r,i,n=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<n;)t=e.readInt(2),r=e.readInt(2),i=e.readData(r),this.extraFields[t]={id:t,length:r,value:i};e.setIndex(n)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=a.utf8decode(this.fileName),this.fileCommentStr=a.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var r=n.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(r)}var i=this.findExtraFieldUnicodeComment();if(null!==i)this.fileCommentStr=i;else{var s=n.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(s)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileName)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=i(e.value);return 1!==t.readInt(1)||o(this.fileComment)!==t.readInt(4)?null:a.utf8decode(t.readData(e.length-5))}return null}},t.exports=l},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,r){"use strict";function i(e,t,r){this.name=e,this.dir=r.dir,this.date=r.date,this.comment=r.comment,this.unixPermissions=r.unixPermissions,this.dosPermissions=r.dosPermissions,this._data=t,this._dataBinary=r.binary,this.options={compression:r.compression,compressionOptions:r.compressionOptions}}var n=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),d=e("./stream/GenericWorker");i.prototype={internalStream:function(e){var t=null,r="string";try{if(!e)throw new Error("No output type specified.");var i="string"===(r=e.toLowerCase())||"text"===r;"binarystring"!==r&&"text"!==r||(r="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!i&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&i&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new d("error")).error(e)}return new n(t,r,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var r=this._decompressWorker();return this._dataBinary||(r=r.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(r,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof d?this._data:new s(this._data)}};for(var u=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],l=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},c=0;c<u.length;c++)i.prototype[u[c]]=l;t.exports=i},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,i){(function(e){"use strict";var r,i,n=e.MutationObserver||e.WebKitMutationObserver;if(n){var s=0,o=new n(l),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),r=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)r="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){l(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(l,0)};else{var d=new e.MessageChannel;d.port1.onmessage=l,r=function(){d.port2.postMessage(0)}}var u=[];function l(){var e,t;i=!0;for(var r=u.length;r;){for(t=u,u=[],e=-1;++e<r;)t[e]();r=u.length}i=!1}t.exports=function(e){1!==u.push(e)||i||r()}}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,r){"use strict";var i=e("immediate");function n(){}var s={},o=["REJECTED"],a=["FULFILLED"],d=["PENDING"];function u(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=d,this.queue=[],this.outcome=void 0,e!==n&&h(this,e)}function l(e,t,r){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof r&&(this.onRejected=r,this.callRejected=this.otherCallRejected)}function c(e,t,r){i((function(){var i;try{i=t(r)}catch(i){return s.reject(e,i)}i===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,i)}))}function p(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function h(e,t){var r=!1;function i(t){r||(r=!0,s.reject(e,t))}function n(t){r||(r=!0,s.resolve(e,t))}var o=f((function(){t(n,i)}));"error"===o.status&&i(o.value)}function f(e,t){var r={};try{r.value=e(t),r.status="success"}catch(e){r.status="error",r.value=e}return r}(t.exports=u).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(r){return t.resolve(e()).then((function(){return r}))}),(function(r){return t.resolve(e()).then((function(){throw r}))}))},u.prototype.catch=function(e){return this.then(null,e)},u.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var r=new this.constructor(n);return this.state!==d?c(r,this.state===a?e:t,this.outcome):this.queue.push(new l(r,e,t)),r},l.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},l.prototype.otherCallFulfilled=function(e){c(this.promise,this.onFulfilled,e)},l.prototype.callRejected=function(e){s.reject(this.promise,e)},l.prototype.otherCallRejected=function(e){c(this.promise,this.onRejected,e)},s.resolve=function(e,t){var r=f(p,t);if("error"===r.status)return s.reject(e,r.value);var i=r.value;if(i)h(e,i);else{e.state=a,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var r=-1,i=e.queue.length;++r<i;)e.queue[r].callRejected(t);return e},u.resolve=function(e){return e instanceof this?e:s.resolve(new this(n),e)},u.reject=function(e){var t=new this(n);return s.reject(t,e)},u.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var o=new Array(r),a=0,d=-1,u=new this(n);++d<r;)l(e[d],d);return u;function l(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==r||i||(i=!0,s.resolve(u,o))}),(function(e){i||(i=!0,s.reject(u,e))}))}},u.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var r=e.length,i=!1;if(!r)return this.resolve([]);for(var o,a=-1,d=new this(n);++a<r;)o=e[a],t.resolve(o).then((function(e){i||(i=!0,s.resolve(d,e))}),(function(e){i||(i=!0,s.reject(d,e))}));return d}},{immediate:36}],38:[function(e,t,r){"use strict";var i={};(0,e("./lib/utils/common").assign)(i,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=i},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,r){"use strict";var i=e("./zlib/deflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),d=Object.prototype.toString,u=0,l=-1,c=0,p=8;function h(e){if(!(this instanceof h))return new h(e);this.options=n.assign({level:l,method:p,chunkSize:16384,windowBits:15,memLevel:8,strategy:c,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var r=i.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==u)throw new Error(o[r]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var f;if(f="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===d.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(r=i.deflateSetDictionary(this.strm,f))!==u)throw new Error(o[r]);this._dict_set=!0}}function f(e,t){var r=new h(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}h.prototype.push=function(e,t){var r,o,a=this.strm,l=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===d.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new n.Buf8(l),a.next_out=0,a.avail_out=l),1!==(r=i.deflate(a,o))&&r!==u)return this.onEnd(r),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==r);return 4===o?(r=i.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===u):2!==o||(this.onEnd(u),!(a.avail_out=0))},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===u&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Deflate=h,r.deflate=f,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,f(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,r){"use strict";var i=e("./zlib/inflate"),n=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),d=e("./zlib/zstream"),u=e("./zlib/gzheader"),l=Object.prototype.toString;function c(e){if(!(this instanceof c))return new c(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new d,this.strm.avail_out=0;var r=i.inflateInit2(this.strm,t.windowBits);if(r!==o.Z_OK)throw new Error(a[r]);this.header=new u,i.inflateGetHeader(this.strm,this.header)}function p(e,t){var r=new c(t);if(r.push(e,!0),r.err)throw r.msg||a[r.err];return r.result}c.prototype.push=function(e,t){var r,a,d,u,c,p,h=this.strm,f=this.options.chunkSize,y=this.options.dictionary,g=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?h.input=s.binstring2buf(e):"[object ArrayBuffer]"===l.call(e)?h.input=new Uint8Array(e):h.input=e,h.next_in=0,h.avail_in=h.input.length;do{if(0===h.avail_out&&(h.output=new n.Buf8(f),h.next_out=0,h.avail_out=f),(r=i.inflate(h,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&y&&(p="string"==typeof y?s.string2buf(y):"[object ArrayBuffer]"===l.call(y)?new Uint8Array(y):y,r=i.inflateSetDictionary(this.strm,p)),r===o.Z_BUF_ERROR&&!0===g&&(r=o.Z_OK,g=!1),r!==o.Z_STREAM_END&&r!==o.Z_OK)return this.onEnd(r),!(this.ended=!0);h.next_out&&(0!==h.avail_out&&r!==o.Z_STREAM_END&&(0!==h.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(d=s.utf8border(h.output,h.next_out),u=h.next_out-d,c=s.buf2string(h.output,d),h.next_out=u,h.avail_out=f-u,u&&n.arraySet(h.output,h.output,d,u,0),this.onData(c)):this.onData(n.shrinkBuf(h.output,h.next_out)))),0===h.avail_in&&0===h.avail_out&&(g=!0)}while((0<h.avail_in||0===h.avail_out)&&r!==o.Z_STREAM_END);return r===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(r=i.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(h.avail_out=0))},c.prototype.onData=function(e){this.chunks.push(e)},c.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},r.Inflate=c,r.inflate=p,r.inflateRaw=function(e,t){return(t=t||{}).raw=!0,p(e,t)},r.ungzip=p},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,r){"use strict";var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;r.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(var i in r)r.hasOwnProperty(i)&&(e[i]=r[i])}}return e},r.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){var t,r,i,n,s,o;for(t=i=0,r=e.length;t<r;t++)i+=e[t].length;for(o=new Uint8Array(i),t=n=0,r=e.length;t<r;t++)s=e[t],o.set(s,n),n+=s.length;return o}},s={arraySet:function(e,t,r,i,n){for(var s=0;s<i;s++)e[n+s]=t[r+s]},flattenChunks:function(e){return[].concat.apply([],e)}};r.setTyped=function(e){e?(r.Buf8=Uint8Array,r.Buf16=Uint16Array,r.Buf32=Int32Array,r.assign(r,n)):(r.Buf8=Array,r.Buf16=Array,r.Buf32=Array,r.assign(r,s))},r.setTyped(i)},{}],42:[function(e,t,r){"use strict";var i=e("./common"),n=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new i.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function d(e,t){if(t<65537&&(e.subarray&&s||!e.subarray&&n))return String.fromCharCode.apply(null,i.shrinkBuf(e,t));for(var r="",o=0;o<t;o++)r+=String.fromCharCode(e[o]);return r}o[254]=o[254]=1,r.string2buf=function(e){var t,r,n,s,o,a=e.length,d=0;for(s=0;s<a;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),d+=r<128?1:r<2048?2:r<65536?3:4;for(t=new i.Buf8(d),s=o=0;o<d;s++)55296==(64512&(r=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(n=e.charCodeAt(s+1)))&&(r=65536+(r-55296<<10)+(n-56320),s++),r<128?t[o++]=r:(r<2048?t[o++]=192|r>>>6:(r<65536?t[o++]=224|r>>>12:(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63),t[o++]=128|r>>>6&63),t[o++]=128|63&r);return t},r.buf2binstring=function(e){return d(e,e.length)},r.binstring2buf=function(e){for(var t=new i.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},r.buf2string=function(e,t){var r,i,n,s,a=t||e.length,u=new Array(2*a);for(r=i=0;r<a;)if((n=e[r++])<128)u[i++]=n;else if(4<(s=o[n]))u[i++]=65533,r+=s-1;else{for(n&=2===s?31:3===s?15:7;1<s&&r<a;)n=n<<6|63&e[r++],s--;1<s?u[i++]=65533:n<65536?u[i++]=n:(n-=65536,u[i++]=55296|n>>10&1023,u[i++]=56320|1023&n)}return d(u,i)},r.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;0<=r&&128==(192&e[r]);)r--;return r<0||0===r?t:r+o[e[r]]>t?r:t}},{"./common":41}],43:[function(e,t,r){"use strict";t.exports=function(e,t,r,i){for(var n=65535&e|0,s=e>>>16&65535|0,o=0;0!==r;){for(r-=o=2e3<r?2e3:r;s=s+(n=n+t[i++]|0)|0,--o;);n%=65521,s%=65521}return n|s<<16|0}},{}],44:[function(e,t,r){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,r){"use strict";var i=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();t.exports=function(e,t,r,n){var s=i,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,r){"use strict";var i,n=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),d=e("./messages"),u=0,l=4,c=0,p=-2,h=-1,f=4,y=2,g=8,m=9,v=286,b=30,_=19,w=2*v+1,E=15,T=3,S=258,R=S+T+1,O=42,I=113,x=1,A=2,C=3,k=4;function M(e,t){return e.msg=d[t],t}function N(e){return(e<<1)-(4<e?9:0)}function P(e){for(var t=e.length;0<=--t;)e[t]=0}function D(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(n.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function B(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,D(e.strm)}function L(e,t){e.pending_buf[e.pending++]=t}function q(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function j(e,t){var r,i,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,d=e.strstart>e.w_size-R?e.strstart-(e.w_size-R):0,u=e.window,l=e.w_mask,c=e.prev,p=e.strstart+S,h=u[s+o-1],f=u[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(u[(r=t)+o]===f&&u[r+o-1]===h&&u[r]===u[s]&&u[++r]===u[s+1]){s+=2,r++;do{}while(u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&u[++s]===u[++r]&&s<p);if(i=S-(p-s),s=p-S,o<i){if(e.match_start=t,a<=(o=i))break;h=u[s+o-1],f=u[s+o]}}}while((t=c[t&l])>d&&0!=--n);return o<=e.lookahead?o:e.lookahead}function F(e){var t,r,i,s,d,u,l,c,p,h,f=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-R)){for(n.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=r=e.hash_size;i=e.head[--t],e.head[t]=f<=i?i-f:0,--r;);for(t=r=f;i=e.prev[--t],e.prev[t]=f<=i?i-f:0,--r;);s+=f}if(0===e.strm.avail_in)break;if(u=e.strm,l=e.window,c=e.strstart+e.lookahead,h=void 0,(p=s)<(h=u.avail_in)&&(h=p),r=0===h?0:(u.avail_in-=h,n.arraySet(l,u.input,u.next_in,h,c),1===u.state.wrap?u.adler=o(u.adler,l,h,c):2===u.state.wrap&&(u.adler=a(u.adler,l,h,c)),u.next_in+=h,u.total_in+=h,h),e.lookahead+=r,e.lookahead+e.insert>=T)for(d=e.strstart-e.insert,e.ins_h=e.window[d],e.ins_h=(e.ins_h<<e.hash_shift^e.window[d+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[d+T-1])&e.hash_mask,e.prev[d&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=d,d++,e.insert--,!(e.lookahead+e.insert<T)););}while(e.lookahead<R&&0!==e.strm.avail_in)}function U(e,t){for(var r,i;;){if(e.lookahead<R){if(F(e),e.lookahead<R&&t===u)return x;if(0===e.lookahead)break}if(r=0,e.lookahead>=T&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+T-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-R&&(e.match_length=j(e,r)),e.match_length>=T)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-T),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=T){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+T-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else i=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(B(e,!1),0===e.strm.avail_out))return x}return e.insert=e.strstart<T-1?e.strstart:T-1,t===l?(B(e,!0),0===e.strm.avail_out?C:k):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?x:A}function z(e,t){for(var r,i,n;;){if(e.lookahead<R){if(F(e),e.lookahead<R&&t===u)return x;if(0===e.lookahead)break}if(r=0,e.lookahead>=T&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+T-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=T-1,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-R&&(e.match_length=j(e,r),e.match_length<=5&&(1===e.strategy||e.match_length===T&&4096<e.strstart-e.match_start)&&(e.match_length=T-1)),e.prev_length>=T&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-T,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-T),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+T-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=T-1,e.strstart++,i&&(B(e,!1),0===e.strm.avail_out))return x}else if(e.match_available){if((i=s._tr_tally(e,0,e.window[e.strstart-1]))&&B(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return x}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<T-1?e.strstart:T-1,t===l?(B(e,!0),0===e.strm.avail_out?C:k):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?x:A}function H(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}function $(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new n.Buf16(2*w),this.dyn_dtree=new n.Buf16(2*(2*b+1)),this.bl_tree=new n.Buf16(2*(2*_+1)),P(this.dyn_ltree),P(this.dyn_dtree),P(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(E+1),this.heap=new n.Buf16(2*v+1),P(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(2*v+1),P(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function G(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=y,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?O:I,e.adler=2===t.wrap?0:1,t.last_flush=u,s._tr_init(t),c):M(e,p)}function W(e){var t=G(e);return t===c&&function(e){e.window_size=2*e.w_size,P(e.head),e.max_lazy_match=i[e.level].max_lazy,e.good_match=i[e.level].good_length,e.nice_match=i[e.level].nice_length,e.max_chain_length=i[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=T-1,e.match_available=0,e.ins_h=0}(e.state),t}function V(e,t,r,i,s,o){if(!e)return p;var a=1;if(t===h&&(t=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),s<1||m<s||r!==g||i<8||15<i||t<0||9<t||o<0||f<o)return M(e,p);8===i&&(i=9);var d=new $;return(e.state=d).strm=e,d.wrap=a,d.gzhead=null,d.w_bits=i,d.w_size=1<<d.w_bits,d.w_mask=d.w_size-1,d.hash_bits=s+7,d.hash_size=1<<d.hash_bits,d.hash_mask=d.hash_size-1,d.hash_shift=~~((d.hash_bits+T-1)/T),d.window=new n.Buf8(2*d.w_size),d.head=new n.Buf16(d.hash_size),d.prev=new n.Buf16(d.w_size),d.lit_bufsize=1<<s+6,d.pending_buf_size=4*d.lit_bufsize,d.pending_buf=new n.Buf8(d.pending_buf_size),d.d_buf=1*d.lit_bufsize,d.l_buf=3*d.lit_bufsize,d.level=t,d.strategy=o,d.method=r,W(e)}i=[new H(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(F(e),0===e.lookahead&&t===u)return x;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,B(e,!1),0===e.strm.avail_out))return x;if(e.strstart-e.block_start>=e.w_size-R&&(B(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?C:k):(e.strstart>e.block_start&&(B(e,!1),e.strm.avail_out),x)})),new H(4,4,8,4,U),new H(4,5,16,8,U),new H(4,6,32,32,U),new H(4,4,16,16,z),new H(8,16,32,32,z),new H(8,16,128,128,z),new H(8,32,128,256,z),new H(32,128,258,1024,z),new H(32,258,258,4096,z)],r.deflateInit=function(e,t){return V(e,t,g,15,8,0)},r.deflateInit2=V,r.deflateReset=W,r.deflateResetKeep=G,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?p:(e.state.gzhead=t,c):p},r.deflate=function(e,t){var r,n,o,d;if(!e||!e.state||5<t||t<0)return e?M(e,p):p;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&t!==l)return M(e,0===e.avail_out?-5:p);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===O)if(2===n.wrap)e.adler=0,L(n,31),L(n,139),L(n,8),n.gzhead?(L(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),L(n,255&n.gzhead.time),L(n,n.gzhead.time>>8&255),L(n,n.gzhead.time>>16&255),L(n,n.gzhead.time>>24&255),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(L(n,255&n.gzhead.extra.length),L(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=a(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(L(n,0),L(n,0),L(n,0),L(n,0),L(n,0),L(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),L(n,3),n.status=I);else{var h=g+(n.w_bits-8<<4)<<8;h|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(h|=32),h+=31-h%31,n.status=I,q(n,h),0!==n.strstart&&(q(n,e.adler>>>16),q(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(o=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),D(e),o=n.pending,n.pending!==n.pending_buf_size));)L(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),D(e),o=n.pending,n.pending===n.pending_buf_size)){d=1;break}d=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,L(n,d)}while(0!==d);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===d&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){o=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),D(e),o=n.pending,n.pending===n.pending_buf_size)){d=1;break}d=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,L(n,d)}while(0!==d);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===d&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&D(e),n.pending+2<=n.pending_buf_size&&(L(n,255&e.adler),L(n,e.adler>>8&255),e.adler=0,n.status=I)):n.status=I),0!==n.pending){if(D(e),0===e.avail_out)return n.last_flush=-1,c}else if(0===e.avail_in&&N(t)<=N(r)&&t!==l)return M(e,-5);if(666===n.status&&0!==e.avail_in)return M(e,-5);if(0!==e.avail_in||0!==n.lookahead||t!==u&&666!==n.status){var f=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(F(e),0===e.lookahead)){if(t===u)return x;break}if(e.match_length=0,r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(B(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?C:k):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?x:A}(n,t):3===n.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=S){if(F(e),e.lookahead<=S&&t===u)return x;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=T&&0<e.strstart&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+S;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=S-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=T?(r=s._tr_tally(e,1,e.match_length-T),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(B(e,!1),0===e.strm.avail_out))return x}return e.insert=0,t===l?(B(e,!0),0===e.strm.avail_out?C:k):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?x:A}(n,t):i[n.level].func(n,t);if(f!==C&&f!==k||(n.status=666),f===x||f===C)return 0===e.avail_out&&(n.last_flush=-1),c;if(f===A&&(1===t?s._tr_align(n):5!==t&&(s._tr_stored_block(n,0,0,!1),3===t&&(P(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),D(e),0===e.avail_out))return n.last_flush=-1,c}return t!==l?c:n.wrap<=0?1:(2===n.wrap?(L(n,255&e.adler),L(n,e.adler>>8&255),L(n,e.adler>>16&255),L(n,e.adler>>24&255),L(n,255&e.total_in),L(n,e.total_in>>8&255),L(n,e.total_in>>16&255),L(n,e.total_in>>24&255)):(q(n,e.adler>>>16),q(n,65535&e.adler)),D(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?c:1)},r.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==O&&69!==t&&73!==t&&91!==t&&103!==t&&t!==I&&666!==t?M(e,p):(e.state=null,t===I?M(e,-3):c):p},r.deflateSetDictionary=function(e,t){var r,i,s,a,d,u,l,h,f=t.length;if(!e||!e.state)return p;if(2===(a=(r=e.state).wrap)||1===a&&r.status!==O||r.lookahead)return p;for(1===a&&(e.adler=o(e.adler,t,f,0)),r.wrap=0,f>=r.w_size&&(0===a&&(P(r.head),r.strstart=0,r.block_start=0,r.insert=0),h=new n.Buf8(r.w_size),n.arraySet(h,t,f-r.w_size,r.w_size,0),t=h,f=r.w_size),d=e.avail_in,u=e.next_in,l=e.input,e.avail_in=f,e.next_in=0,e.input=t,F(r);r.lookahead>=T;){for(i=r.strstart,s=r.lookahead-(T-1);r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+T-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,--s;);r.strstart=i,r.lookahead=T-1,F(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=T-1,r.match_available=0,e.next_in=u,e.input=l,e.avail_in=d,r.wrap=a,c},r.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,r){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,r){"use strict";t.exports=function(e,t){var r,i,n,s,o,a,d,u,l,c,p,h,f,y,g,m,v,b,_,w,E,T,S,R,O;r=e.state,i=e.next_in,R=e.input,n=i+(e.avail_in-5),s=e.next_out,O=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),d=r.dmax,u=r.wsize,l=r.whave,c=r.wnext,p=r.window,h=r.hold,f=r.bits,y=r.lencode,g=r.distcode,m=(1<<r.lenbits)-1,v=(1<<r.distbits)-1;e:do{f<15&&(h+=R[i++]<<f,f+=8,h+=R[i++]<<f,f+=8),b=y[h&m];t:for(;;){if(h>>>=_=b>>>24,f-=_,0==(_=b>>>16&255))O[s++]=65535&b;else{if(!(16&_)){if(0==(64&_)){b=y[(65535&b)+(h&(1<<_)-1)];continue t}if(32&_){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}w=65535&b,(_&=15)&&(f<_&&(h+=R[i++]<<f,f+=8),w+=h&(1<<_)-1,h>>>=_,f-=_),f<15&&(h+=R[i++]<<f,f+=8,h+=R[i++]<<f,f+=8),b=g[h&v];r:for(;;){if(h>>>=_=b>>>24,f-=_,!(16&(_=b>>>16&255))){if(0==(64&_)){b=g[(65535&b)+(h&(1<<_)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&b,f<(_&=15)&&(h+=R[i++]<<f,(f+=8)<_&&(h+=R[i++]<<f,f+=8)),d<(E+=h&(1<<_)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(h>>>=_,f-=_,(_=s-o)<E){if(l<(_=E-_)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=p,(T=0)===c){if(T+=u-_,_<w){for(w-=_;O[s++]=p[T++],--_;);T=s-E,S=O}}else if(c<_){if(T+=u+c-_,(_-=c)<w){for(w-=_;O[s++]=p[T++],--_;);if(T=0,c<w){for(w-=_=c;O[s++]=p[T++],--_;);T=s-E,S=O}}}else if(T+=c-_,_<w){for(w-=_;O[s++]=p[T++],--_;);T=s-E,S=O}for(;2<w;)O[s++]=S[T++],O[s++]=S[T++],O[s++]=S[T++],w-=3;w&&(O[s++]=S[T++],1<w&&(O[s++]=S[T++]))}else{for(T=s-E;O[s++]=O[T++],O[s++]=O[T++],O[s++]=O[T++],2<(w-=3););w&&(O[s++]=O[T++],1<w&&(O[s++]=O[T++]))}break}}break}}while(i<n&&s<a);i-=w=f>>3,h&=(1<<(f-=w<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=s<a?a-s+257:257-(s-a),r.hold=h,r.bits=f}},{}],49:[function(e,t,r){"use strict";var i=e("../utils/common"),n=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),d=1,u=2,l=0,c=-2,p=1,h=852,f=592;function y(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function m(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=p,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(h),t.distcode=t.distdyn=new i.Buf32(f),t.sane=1,t.back=-1,l):c}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,m(e)):c}function b(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?c:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,v(e))):c}function _(e,t){var r,i;return e?(i=new g,(e.state=i).window=null,(r=b(e,t))!==l&&(e.state=null),r):c}var w,E,T=!0;function S(e){if(T){var t;for(w=new i.Buf32(512),E=new i.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(d,e.lens,0,288,w,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(u,e.lens,0,32,E,0,e.work,{bits:5}),T=!1}e.lencode=w,e.lenbits=9,e.distcode=E,e.distbits=5}function R(e,t,r,n){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new i.Buf8(o.wsize)),n>=o.wsize?(i.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(n<(s=o.wsize-o.wnext)&&(s=n),i.arraySet(o.window,t,r-n,s,o.wnext),(n-=s)?(i.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}r.inflateReset=v,r.inflateReset2=b,r.inflateResetKeep=m,r.inflateInit=function(e){return _(e,15)},r.inflateInit2=_,r.inflate=function(e,t){var r,h,f,g,m,v,b,_,w,E,T,O,I,x,A,C,k,M,N,P,D,B,L,q,j=0,F=new i.Buf8(4),U=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return c;12===(r=e.state).mode&&(r.mode=13),m=e.next_out,f=e.output,b=e.avail_out,g=e.next_in,h=e.input,v=e.avail_in,_=r.hold,w=r.bits,E=v,T=b,B=l;e:for(;;)switch(r.mode){case p:if(0===r.wrap){r.mode=13;break}for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(2&r.wrap&&35615===_){F[r.check=0]=255&_,F[1]=_>>>8&255,r.check=s(r.check,F,2,0),w=_=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&_)<<8)+(_>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&_)){e.msg="unknown compression method",r.mode=30;break}if(w-=4,D=8+(15&(_>>>=4)),0===r.wbits)r.wbits=D;else if(D>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<D,e.adler=r.check=1,r.mode=512&_?10:12,w=_=0;break;case 2:for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(r.flags=_,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=_>>8&1),512&r.flags&&(F[0]=255&_,F[1]=_>>>8&255,r.check=s(r.check,F,2,0)),w=_=0,r.mode=3;case 3:for(;w<32;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.head&&(r.head.time=_),512&r.flags&&(F[0]=255&_,F[1]=_>>>8&255,F[2]=_>>>16&255,F[3]=_>>>24&255,r.check=s(r.check,F,4,0)),w=_=0,r.mode=4;case 4:for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.head&&(r.head.xflags=255&_,r.head.os=_>>8),512&r.flags&&(F[0]=255&_,F[1]=_>>>8&255,r.check=s(r.check,F,2,0)),w=_=0,r.mode=5;case 5:if(1024&r.flags){for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.length=_,r.head&&(r.head.extra_len=_),512&r.flags&&(F[0]=255&_,F[1]=_>>>8&255,r.check=s(r.check,F,2,0)),w=_=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(v<(O=r.length)&&(O=v),O&&(r.head&&(D=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,h,g,O,D)),512&r.flags&&(r.check=s(r.check,h,O,g)),v-=O,g+=O,r.length-=O),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===v)break e;for(O=0;D=h[g+O++],r.head&&D&&r.length<65536&&(r.head.name+=String.fromCharCode(D)),D&&O<v;);if(512&r.flags&&(r.check=s(r.check,h,O,g)),v-=O,g+=O,D)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===v)break e;for(O=0;D=h[g+O++],r.head&&D&&r.length<65536&&(r.head.comment+=String.fromCharCode(D)),D&&O<v;);if(512&r.flags&&(r.check=s(r.check,h,O,g)),v-=O,g+=O,D)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;w<16;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(_!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}w=_=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;w<32;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}e.adler=r.check=y(_),w=_=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=m,e.avail_out=b,e.next_in=g,e.avail_in=v,r.hold=_,r.bits=w,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){_>>>=7&w,w-=7&w,r.mode=27;break}for(;w<3;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}switch(r.last=1&_,w-=1,3&(_>>>=1)){case 0:r.mode=14;break;case 1:if(S(r),r.mode=20,6!==t)break;_>>>=2,w-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}_>>>=2,w-=2;break;case 14:for(_>>>=7&w,w-=7&w;w<32;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if((65535&_)!=(_>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&_,w=_=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(O=r.length){if(v<O&&(O=v),b<O&&(O=b),0===O)break e;i.arraySet(f,h,g,O,m),v-=O,g+=O,b-=O,m+=O,r.length-=O;break}r.mode=12;break;case 17:for(;w<14;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(r.nlen=257+(31&_),_>>>=5,w-=5,r.ndist=1+(31&_),_>>>=5,w-=5,r.ncode=4+(15&_),_>>>=4,w-=4,286<r.nlen||30<r.ndist){e.msg="too many length or distance symbols",r.mode=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;w<3;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.lens[U[r.have++]]=7&_,_>>>=3,w-=3}for(;r.have<19;)r.lens[U[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,L={bits:r.lenbits},B=a(0,r.lens,0,19,r.lencode,0,r.work,L),r.lenbits=L.bits,B){e.msg="invalid code lengths set",r.mode=30;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;C=(j=r.lencode[_&(1<<r.lenbits)-1])>>>16&255,k=65535&j,!((A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(k<16)_>>>=A,w-=A,r.lens[r.have++]=k;else{if(16===k){for(q=A+2;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(_>>>=A,w-=A,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}D=r.lens[r.have-1],O=3+(3&_),_>>>=2,w-=2}else if(17===k){for(q=A+3;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}w-=A,D=0,O=3+(7&(_>>>=A)),_>>>=3,w-=3}else{for(q=A+7;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}w-=A,D=0,O=11+(127&(_>>>=A)),_>>>=7,w-=7}if(r.have+O>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;O--;)r.lens[r.have++]=D}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,L={bits:r.lenbits},B=a(d,r.lens,0,r.nlen,r.lencode,0,r.work,L),r.lenbits=L.bits,B){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,L={bits:r.distbits},B=a(u,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,L),r.distbits=L.bits,B){e.msg="invalid distances set",r.mode=30;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(6<=v&&258<=b){e.next_out=m,e.avail_out=b,e.next_in=g,e.avail_in=v,r.hold=_,r.bits=w,o(e,T),m=e.next_out,f=e.output,b=e.avail_out,g=e.next_in,h=e.input,v=e.avail_in,_=r.hold,w=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;C=(j=r.lencode[_&(1<<r.lenbits)-1])>>>16&255,k=65535&j,!((A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(C&&0==(240&C)){for(M=A,N=C,P=k;C=(j=r.lencode[P+((_&(1<<M+N)-1)>>M)])>>>16&255,k=65535&j,!(M+(A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}_>>>=M,w-=M,r.back+=M}if(_>>>=A,w-=A,r.back+=A,r.length=k,0===C){r.mode=26;break}if(32&C){r.back=-1,r.mode=12;break}if(64&C){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&C,r.mode=22;case 22:if(r.extra){for(q=r.extra;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.length+=_&(1<<r.extra)-1,_>>>=r.extra,w-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;C=(j=r.distcode[_&(1<<r.distbits)-1])>>>16&255,k=65535&j,!((A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(0==(240&C)){for(M=A,N=C,P=k;C=(j=r.distcode[P+((_&(1<<M+N)-1)>>M)])>>>16&255,k=65535&j,!(M+(A=j>>>24)<=w);){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}_>>>=M,w-=M,r.back+=M}if(_>>>=A,w-=A,r.back+=A,64&C){e.msg="invalid distance code",r.mode=30;break}r.offset=k,r.extra=15&C,r.mode=24;case 24:if(r.extra){for(q=r.extra;w<q;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}r.offset+=_&(1<<r.extra)-1,_>>>=r.extra,w-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=30;break}r.mode=25;case 25:if(0===b)break e;if(O=T-b,r.offset>O){if((O=r.offset-O)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}I=O>r.wnext?(O-=r.wnext,r.wsize-O):r.wnext-O,O>r.length&&(O=r.length),x=r.window}else x=f,I=m-r.offset,O=r.length;for(b<O&&(O=b),b-=O,r.length-=O;f[m++]=x[I++],--O;);0===r.length&&(r.mode=21);break;case 26:if(0===b)break e;f[m++]=r.length,b--,r.mode=21;break;case 27:if(r.wrap){for(;w<32;){if(0===v)break e;v--,_|=h[g++]<<w,w+=8}if(T-=b,e.total_out+=T,r.total+=T,T&&(e.adler=r.check=r.flags?s(r.check,f,T,m-T):n(r.check,f,T,m-T)),T=b,(r.flags?_:y(_))!==r.check){e.msg="incorrect data check",r.mode=30;break}w=_=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;w<32;){if(0===v)break e;v--,_+=h[g++]<<w,w+=8}if(_!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}w=_=0}r.mode=29;case 29:B=1;break e;case 30:B=-3;break e;case 31:return-4;default:return c}return e.next_out=m,e.avail_out=b,e.next_in=g,e.avail_in=v,r.hold=_,r.bits=w,(r.wsize||T!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&R(e,e.output,e.next_out,T-e.avail_out)?(r.mode=31,-4):(E-=e.avail_in,T-=e.avail_out,e.total_in+=E,e.total_out+=T,r.total+=T,r.wrap&&T&&(e.adler=r.check=r.flags?s(r.check,f,T,e.next_out-T):n(r.check,f,T,e.next_out-T)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==E&&0===T||4===t)&&B===l&&(B=-5),B)},r.inflateEnd=function(e){if(!e||!e.state)return c;var t=e.state;return t.window&&(t.window=null),e.state=null,l},r.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?c:((r.head=t).done=!1,l):c},r.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?c:11===r.mode&&n(1,t,i,0)!==r.check?-3:R(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,l):c},r.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,r){"use strict";var i=e("../utils/common"),n=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,r,d,u,l,c,p){var h,f,y,g,m,v,b,_,w,E=p.bits,T=0,S=0,R=0,O=0,I=0,x=0,A=0,C=0,k=0,M=0,N=null,P=0,D=new i.Buf16(16),B=new i.Buf16(16),L=null,q=0;for(T=0;T<=15;T++)D[T]=0;for(S=0;S<d;S++)D[t[r+S]]++;for(I=E,O=15;1<=O&&0===D[O];O--);if(O<I&&(I=O),0===O)return u[l++]=20971520,u[l++]=20971520,p.bits=1,0;for(R=1;R<O&&0===D[R];R++);for(I<R&&(I=R),T=C=1;T<=15;T++)if(C<<=1,(C-=D[T])<0)return-1;if(0<C&&(0===e||1!==O))return-1;for(B[1]=0,T=1;T<15;T++)B[T+1]=B[T]+D[T];for(S=0;S<d;S++)0!==t[r+S]&&(c[B[t[r+S]]++]=S);if(v=0===e?(N=L=c,19):1===e?(N=n,P-=257,L=s,q-=257,256):(N=o,L=a,-1),T=R,m=l,A=S=M=0,y=-1,g=(k=1<<(x=I))-1,1===e&&852<k||2===e&&592<k)return 1;for(;;){for(b=T-A,w=c[S]<v?(_=0,c[S]):c[S]>v?(_=L[q+c[S]],N[P+c[S]]):(_=96,0),h=1<<T-A,R=f=1<<x;u[m+(M>>A)+(f-=h)]=b<<24|_<<16|w|0,0!==f;);for(h=1<<T-1;M&h;)h>>=1;if(0!==h?(M&=h-1,M+=h):M=0,S++,0==--D[T]){if(T===O)break;T=t[r+c[S]]}if(I<T&&(M&g)!==y){for(0===A&&(A=I),m+=R,C=1<<(x=T-A);x+A<O&&!((C-=D[x+A])<=0);)x++,C<<=1;if(k+=1<<x,1===e&&852<k||2===e&&592<k)return 1;u[y=M&g]=I<<24|x<<16|m-l|0}}return 0!==M&&(u[m+M]=T-A<<24|64<<16|0),p.bits=I,0}},{"../utils/common":41}],51:[function(e,t,r){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,r){"use strict";var i=e("../utils/common"),n=0,s=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0}var a=0,d=29,u=256,l=u+1+d,c=30,p=19,h=2*l+1,f=15,y=16,g=7,m=256,v=16,b=17,_=18,w=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],T=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],R=new Array(2*(l+2));o(R);var O=new Array(2*c);o(O);var I=new Array(512);o(I);var x=new Array(256);o(x);var A=new Array(d);o(A);var C,k,M,N=new Array(c);function P(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function D(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function B(e){return e<256?I[e]:I[256+(e>>>7)]}function L(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function q(e,t,r){e.bi_valid>y-r?(e.bi_buf|=t<<e.bi_valid&65535,L(e,e.bi_buf),e.bi_buf=t>>y-e.bi_valid,e.bi_valid+=r-y):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function j(e,t,r){q(e,r[2*t],r[2*t+1])}function F(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function U(e,t,r){var i,n,s=new Array(f+1),o=0;for(i=1;i<=f;i++)s[i]=o=o+r[i-1]<<1;for(n=0;n<=t;n++){var a=e[2*n+1];0!==a&&(e[2*n]=F(s[a]++,a))}}function z(e){var t;for(t=0;t<l;t++)e.dyn_ltree[2*t]=0;for(t=0;t<c;t++)e.dyn_dtree[2*t]=0;for(t=0;t<p;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*m]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function H(e){8<e.bi_valid?L(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function $(e,t,r,i){var n=2*t,s=2*r;return e[n]<e[s]||e[n]===e[s]&&i[t]<=i[r]}function G(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&$(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!$(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function W(e,t,r){var i,n,s,o,a=0;if(0!==e.last_lit)for(;i=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],n=e.pending_buf[e.l_buf+a],a++,0===i?j(e,n,t):(j(e,(s=x[n])+u+1,t),0!==(o=w[s])&&q(e,n-=A[s],o),j(e,s=B(--i),r),0!==(o=E[s])&&q(e,i-=N[s],o)),a<e.last_lit;);j(e,m,t)}function V(e,t){var r,i,n,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,d=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=h,r=0;r<d;r++)0!==s[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=u,r=e.heap_len>>1;1<=r;r--)G(e,s,r);for(n=d;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],G(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,s[2*n]=s[2*r]+s[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,s[2*r+1]=s[2*i+1]=n,e.heap[1]=n++,G(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,s,o,a,d=t.dyn_tree,u=t.max_code,l=t.stat_desc.static_tree,c=t.stat_desc.has_stree,p=t.stat_desc.extra_bits,y=t.stat_desc.extra_base,g=t.stat_desc.max_length,m=0;for(s=0;s<=f;s++)e.bl_count[s]=0;for(d[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<h;r++)g<(s=d[2*d[2*(i=e.heap[r])+1]+1]+1)&&(s=g,m++),d[2*i+1]=s,u<i||(e.bl_count[s]++,o=0,y<=i&&(o=p[i-y]),a=d[2*i],e.opt_len+=a*(s+o),c&&(e.static_len+=a*(l[2*i+1]+o)));if(0!==m){do{for(s=g-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[g]--,m-=2}while(0<m);for(s=g;0!==s;s--)for(i=e.bl_count[s];0!==i;)u<(n=e.heap[--r])||(d[2*n+1]!==s&&(e.opt_len+=(s-d[2*n+1])*d[2*n],d[2*n+1]=s),i--)}}(e,t),U(s,u,e.bl_count)}function K(e,t,r){var i,n,s=-1,o=t[1],a=0,d=7,u=4;for(0===o&&(d=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=t[2*(i+1)+1],++a<d&&n===o||(a<u?e.bl_tree[2*n]+=a:0!==n?(n!==s&&e.bl_tree[2*n]++,e.bl_tree[2*v]++):a<=10?e.bl_tree[2*b]++:e.bl_tree[2*_]++,s=n,u=(a=0)===o?(d=138,3):n===o?(d=6,3):(d=7,4))}function Y(e,t,r){var i,n,s=-1,o=t[1],a=0,d=7,u=4;for(0===o&&(d=138,u=3),i=0;i<=r;i++)if(n=o,o=t[2*(i+1)+1],!(++a<d&&n===o)){if(a<u)for(;j(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==s&&(j(e,n,e.bl_tree),a--),j(e,v,e.bl_tree),q(e,a-3,2)):a<=10?(j(e,b,e.bl_tree),q(e,a-3,3)):(j(e,_,e.bl_tree),q(e,a-11,7));s=n,u=(a=0)===o?(d=138,3):n===o?(d=6,3):(d=7,4)}}o(N);var X=!1;function Z(e,t,r,n){q(e,(a<<1)+(n?1:0),3),function(e,t,r,n){H(e),n&&(L(e,r),L(e,~r)),i.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}r._tr_init=function(e){X||(function(){var e,t,r,i,n,s=new Array(f+1);for(i=r=0;i<d-1;i++)for(A[i]=r,e=0;e<1<<w[i];e++)x[r++]=i;for(x[r-1]=i,i=n=0;i<16;i++)for(N[i]=n,e=0;e<1<<E[i];e++)I[n++]=i;for(n>>=7;i<c;i++)for(N[i]=n<<7,e=0;e<1<<E[i]-7;e++)I[256+n++]=i;for(t=0;t<=f;t++)s[t]=0;for(e=0;e<=143;)R[2*e+1]=8,e++,s[8]++;for(;e<=255;)R[2*e+1]=9,e++,s[9]++;for(;e<=279;)R[2*e+1]=7,e++,s[7]++;for(;e<=287;)R[2*e+1]=8,e++,s[8]++;for(U(R,l+1,s),e=0;e<c;e++)O[2*e+1]=5,O[2*e]=F(e,5);C=new P(R,w,u+1,l,f),k=new P(O,E,0,c,f),M=new P(new Array(0),T,0,p,g)}(),X=!0),e.l_desc=new D(e.dyn_ltree,C),e.d_desc=new D(e.dyn_dtree,k),e.bl_desc=new D(e.bl_tree,M),e.bi_buf=0,e.bi_valid=0,z(e)},r._tr_stored_block=Z,r._tr_flush_block=function(e,t,r,i){var o,a,d=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return n;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t<u;t++)if(0!==e.dyn_ltree[2*t])return s;return n}(e)),V(e,e.l_desc),V(e,e.d_desc),d=function(e){var t;for(K(e,e.dyn_ltree,e.l_desc.max_code),K(e,e.dyn_dtree,e.d_desc.max_code),V(e,e.bl_desc),t=p-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=r+5,r+4<=o&&-1!==t?Z(e,t,r,i):4===e.strategy||a===o?(q(e,2+(i?1:0),3),W(e,R,O)):(q(e,4+(i?1:0),3),function(e,t,r,i){var n;for(q(e,t-257,5),q(e,r-1,5),q(e,i-4,4),n=0;n<i;n++)q(e,e.bl_tree[2*S[n]+1],3);Y(e,e.dyn_ltree,t-1),Y(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,d+1),W(e,e.dyn_ltree,e.dyn_dtree)),z(e),i&&H(e)},r._tr_tally=function(e,t,r){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(x[r]+u+1)]++,e.dyn_dtree[2*B(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){q(e,2,3),j(e,m,R),function(e){16===e.bi_valid?(L(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,r){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,i){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var r,i,n,s,o=1,a={},d=!1,u=e.document,l=Object.getPrototypeOf&&Object.getPrototypeOf(e);l=l&&l.setTimeout?l:e,r="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){p(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,r=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=r,t}}()?(s="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",h,!1):e.attachEvent("onmessage",h),function(t){e.postMessage(s+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){p(e.data)},function(e){n.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(i=u.documentElement,function(e){var t=u.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(p,0,e)},l.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i<t.length;i++)t[i]=arguments[i+1];var n={callback:e,args:t};return a[o]=n,r(o),o++},l.clearImmediate=c}function c(e){delete a[e]}function p(e){if(d)setTimeout(p,0,e);else{var r=a[e];if(r){d=!0;try{!function(e){var r=e.callback,i=e.args;switch(i.length){case 0:r();break;case 1:r(i[0]);break;case 2:r(i[0],i[1]);break;case 3:r(i[0],i[1],i[2]);break;default:r.apply(t,i)}}(r)}finally{c(e),d=!1}}}}function h(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&p(+t.data.slice(s.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==r.g?r.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)},857:(e,t,r)=>{var i=r(7772).Symbol;e.exports=i},3366:(e,t,r)=>{var i=r(857),n=r(2107),s=r(7157),o=i?i.toStringTag:void 0;e.exports=function(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":o&&o in Object(e)?n(e):s(e)}},1242:(e,t,r)=>{var i="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g;e.exports=i},7353:(e,t,r)=>{var i=r(241)(Object.getPrototypeOf,Object);e.exports=i},2107:(e,t,r)=>{var i=r(857),n=Object.prototype,s=n.hasOwnProperty,o=n.toString,a=i?i.toStringTag:void 0;e.exports=function(e){var t=s.call(e,a),r=e[a];try{e[a]=void 0;var i=!0}catch(e){}var n=o.call(e);return i&&(t?e[a]=r:delete e[a]),n}},7157:e=>{var t=Object.prototype.toString;e.exports=function(e){return t.call(e)}},241:e=>{e.exports=function(e,t){return function(r){return e(t(r))}}},7772:(e,t,r)=>{var i=r(1242),n="object"==typeof self&&self&&self.Object===Object&&self,s=i||n||Function("return this")();e.exports=s},6152:e=>{var t=Array.isArray;e.exports=t},1049:(e,t,r)=>{var i=r(3366),n=r(9259);e.exports=function(e){if(!n(e))return!1;var t=i(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}},9259:e=>{e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},5125:e=>{e.exports=function(e){return null!=e&&"object"==typeof e}},7030:(e,t,r)=>{var i=r(3366),n=r(7353),s=r(5125),o=Function.prototype,a=Object.prototype,d=o.toString,u=a.hasOwnProperty,l=d.call(Object);e.exports=function(e){if(!s(e)||"[object Object]"!=i(e))return!1;var t=n(e);if(null===t)return!0;var r=u.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&d.call(r)==l}},5505:(e,t,r)=>{var i=r(3366),n=r(6152),s=r(5125);e.exports=function(e){return"string"==typeof e||!n(e)&&s(e)&&"[object String]"==i(e)}},7808:e=>{e.exports=r;var t=null;try{t=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function r(e,t,r){this.low=0|e,this.high=0|t,this.unsigned=!!r}function i(e){return!0===(e&&e.__isLong__)}r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0}),r.isLong=i;var n={},s={};function o(e,t){var r,i,o;return t?(o=0<=(e>>>=0)&&e<256)&&(i=s[e])?i:(r=d(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=n[e])?i:(r=d(e,e<0?-1:0,!1),o&&(n[e]=r),r)}function a(e,t){if(isNaN(e))return t?m:g;if(t){if(e<0)return m;if(e>=h)return E}else{if(e<=-f)return T;if(e+1>=f)return w}return e<0?a(-e,t).neg():d(e%p|0,e/p|0,t)}function d(e,t,i){return new r(e,t,i)}r.fromInt=o,r.fromNumber=a,r.fromBits=d;var u=Math.pow;function l(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return g;if("number"==typeof t?(r=t,t=!1):t=!!t,(r=r||10)<2||36<r)throw RangeError("radix");var i;if((i=e.indexOf("-"))>0)throw Error("interior hyphen");if(0===i)return l(e.substring(1),t,r).neg();for(var n=a(u(r,8)),s=g,o=0;o<e.length;o+=8){var d=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+d),r);if(d<8){var p=a(u(r,d));s=s.mul(p).add(a(c))}else s=(s=s.mul(n)).add(a(c))}return s.unsigned=t,s}function c(e,t){return"number"==typeof e?a(e,t):"string"==typeof e?l(e,t):d(e.low,e.high,"boolean"==typeof t?t:e.unsigned)}r.fromString=l,r.fromValue=c;var p=4294967296,h=p*p,f=h/2,y=o(1<<24),g=o(0);r.ZERO=g;var m=o(0,!0);r.UZERO=m;var v=o(1);r.ONE=v;var b=o(1,!0);r.UONE=b;var _=o(-1);r.NEG_ONE=_;var w=d(-1,2147483647,!1);r.MAX_VALUE=w;var E=d(-1,-1,!0);r.MAX_UNSIGNED_VALUE=E;var T=d(0,-2147483648,!1);r.MIN_VALUE=T;var S=r.prototype;S.toInt=function(){return this.unsigned?this.low>>>0:this.low},S.toNumber=function(){return this.unsigned?(this.high>>>0)*p+(this.low>>>0):this.high*p+(this.low>>>0)},S.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(T)){var t=a(e),r=this.div(t),i=r.mul(t).sub(this);return r.toString(e)+i.toInt().toString(e)}return"-"+this.neg().toString(e)}for(var n=a(u(e,6),this.unsigned),s=this,o="";;){var d=s.div(n),l=(s.sub(d.mul(n)).toInt()>>>0).toString(e);if((s=d).isZero())return l+o;for(;l.length<6;)l="0"+l;o=""+l+o}},S.getHighBits=function(){return this.high},S.getHighBitsUnsigned=function(){return this.high>>>0},S.getLowBits=function(){return this.low},S.getLowBitsUnsigned=function(){return this.low>>>0},S.getNumBitsAbs=function(){if(this.isNegative())return this.eq(T)?64:this.neg().getNumBitsAbs();for(var e=0!=this.high?this.high:this.low,t=31;t>0&&0==(e&1<<t);t--);return 0!=this.high?t+33:t+1},S.isZero=function(){return 0===this.high&&0===this.low},S.eqz=S.isZero,S.isNegative=function(){return!this.unsigned&&this.high<0},S.isPositive=function(){return this.unsigned||this.high>=0},S.isOdd=function(){return 1==(1&this.low)},S.isEven=function(){return 0==(1&this.low)},S.equals=function(e){return i(e)||(e=c(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&(this.high===e.high&&this.low===e.low)},S.eq=S.equals,S.notEquals=function(e){return!this.eq(e)},S.neq=S.notEquals,S.ne=S.notEquals,S.lessThan=function(e){return this.comp(e)<0},S.lt=S.lessThan,S.lessThanOrEqual=function(e){return this.comp(e)<=0},S.lte=S.lessThanOrEqual,S.le=S.lessThanOrEqual,S.greaterThan=function(e){return this.comp(e)>0},S.gt=S.greaterThan,S.greaterThanOrEqual=function(e){return this.comp(e)>=0},S.gte=S.greaterThanOrEqual,S.ge=S.greaterThanOrEqual,S.compare=function(e){if(i(e)||(e=c(e)),this.eq(e))return 0;var t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this.unsigned?e.high>>>0>this.high>>>0||e.high===this.high&&e.low>>>0>this.low>>>0?-1:1:this.sub(e).isNegative()?-1:1},S.comp=S.compare,S.negate=function(){return!this.unsigned&&this.eq(T)?T:this.not().add(v)},S.neg=S.negate,S.add=function(e){i(e)||(e=c(e));var t=this.high>>>16,r=65535&this.high,n=this.low>>>16,s=65535&this.low,o=e.high>>>16,a=65535&e.high,u=e.low>>>16,l=0,p=0,h=0,f=0;return h+=(f+=s+(65535&e.low))>>>16,p+=(h+=n+u)>>>16,l+=(p+=r+a)>>>16,l+=t+o,d((h&=65535)<<16|(f&=65535),(l&=65535)<<16|(p&=65535),this.unsigned)},S.subtract=function(e){return i(e)||(e=c(e)),this.add(e.neg())},S.sub=S.subtract,S.multiply=function(e){if(this.isZero())return g;if(i(e)||(e=c(e)),t)return d(t.mul(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned);if(e.isZero())return g;if(this.eq(T))return e.isOdd()?T:g;if(e.eq(T))return this.isOdd()?T:g;if(this.isNegative())return e.isNegative()?this.neg().mul(e.neg()):this.neg().mul(e).neg();if(e.isNegative())return this.mul(e.neg()).neg();if(this.lt(y)&&e.lt(y))return a(this.toNumber()*e.toNumber(),this.unsigned);var r=this.high>>>16,n=65535&this.high,s=this.low>>>16,o=65535&this.low,u=e.high>>>16,l=65535&e.high,p=e.low>>>16,h=65535&e.low,f=0,m=0,v=0,b=0;return v+=(b+=o*h)>>>16,m+=(v+=s*h)>>>16,v&=65535,m+=(v+=o*p)>>>16,f+=(m+=n*h)>>>16,m&=65535,f+=(m+=s*p)>>>16,m&=65535,f+=(m+=o*l)>>>16,f+=r*h+n*p+s*l+o*u,d((v&=65535)<<16|(b&=65535),(f&=65535)<<16|(m&=65535),this.unsigned)},S.mul=S.multiply,S.divide=function(e){if(i(e)||(e=c(e)),e.isZero())throw Error("division by zero");var r,n,s;if(t)return this.unsigned||-2147483648!==this.high||-1!==e.low||-1!==e.high?d((this.unsigned?t.div_u:t.div_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this;if(this.isZero())return this.unsigned?m:g;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return m;if(e.gt(this.shru(1)))return b;s=m}else{if(this.eq(T))return e.eq(v)||e.eq(_)?T:e.eq(T)?v:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:_:(n=this.sub(e.mul(r)),s=r.add(n.div(e)));if(e.eq(T))return this.unsigned?m:g;if(this.isNegative())return e.isNegative()?this.neg().div(e.neg()):this.neg().div(e).neg();if(e.isNegative())return this.div(e.neg()).neg();s=g}for(n=this;n.gte(e);){r=Math.max(1,Math.floor(n.toNumber()/e.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),l=o<=48?1:u(2,o-48),p=a(r),h=p.mul(e);h.isNegative()||h.gt(n);)h=(p=a(r-=l,this.unsigned)).mul(e);p.isZero()&&(p=v),s=s.add(p),n=n.sub(h)}return s},S.div=S.divide,S.modulo=function(e){return i(e)||(e=c(e)),t?d((this.unsigned?t.rem_u:t.rem_s)(this.low,this.high,e.low,e.high),t.get_high(),this.unsigned):this.sub(this.div(e).mul(e))},S.mod=S.modulo,S.rem=S.modulo,S.not=function(){return d(~this.low,~this.high,this.unsigned)},S.and=function(e){return i(e)||(e=c(e)),d(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return i(e)||(e=c(e)),d(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return i(e)||(e=c(e)),d(this.low^e.low,this.high^e.high,this.unsigned)},S.shiftLeft=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?d(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):d(0,this.low<<e-32,this.unsigned)},S.shl=S.shiftLeft,S.shiftRight=function(e){return i(e)&&(e=e.toInt()),0==(e&=63)?this:e<32?d(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):d(this.high>>e-32,this.high>=0?0:-1,this.unsigned)},S.shr=S.shiftRight,S.shiftRightUnsigned=function(e){if(i(e)&&(e=e.toInt()),0===(e&=63))return this;var t=this.high;return e<32?d(this.low>>>e|t<<32-e,t>>>e,this.unsigned):d(32===e?t:t>>>e-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?d(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:d(this.low,this.high,!0)},S.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},S.toBytesLE=function(){var e=this.high,t=this.low;return[255&t,t>>>8&255,t>>>16&255,t>>>24,255&e,e>>>8&255,e>>>16&255,e>>>24]},S.toBytesBE=function(){var e=this.high,t=this.low;return[e>>>24,e>>>16&255,e>>>8&255,255&e,t>>>24,t>>>16&255,t>>>8&255,255&t]},r.fromBytes=function(e,t,i){return i?r.fromBytesLE(e,t):r.fromBytesBE(e,t)},r.fromBytesLE=function(e,t){return new r(e[0]|e[1]<<8|e[2]<<16|e[3]<<24,e[4]|e[5]<<8|e[6]<<16|e[7]<<24,t)},r.fromBytesBE=function(e,t){return new r(e[4]<<24|e[5]<<16|e[6]<<8|e[7],e[0]<<24|e[1]<<16|e[2]<<8|e[3],t)}},7105:(e,t,r)=>{"use strict";const i=r(8006),n=Symbol("max"),s=Symbol("length"),o=Symbol("lengthCalculator"),a=Symbol("allowStale"),d=Symbol("maxAge"),u=Symbol("dispose"),l=Symbol("noDisposeOnSet"),c=Symbol("lruList"),p=Symbol("cache"),h=Symbol("updateAgeOnGet"),f=()=>1;const y=(e,t,r)=>{const i=e[p].get(t);if(i){const t=i.value;if(g(e,t)){if(v(e,i),!e[a])return}else r&&(e[h]&&(i.value.now=Date.now()),e[c].unshiftNode(i));return t.value}},g=(e,t)=>{if(!t||!t.maxAge&&!e[d])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[d]&&r>e[d]},m=e=>{if(e[s]>e[n])for(let t=e[c].tail;e[s]>e[n]&&null!==t;){const r=t.prev;v(e,t),t=r}},v=(e,t)=>{if(t){const r=t.value;e[u]&&e[u](r.key,r.value),e[s]-=r.length,e[p].delete(r.key),e[c].removeNode(t)}};class b{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const _=(e,t,r,i)=>{let n=r.value;g(e,n)&&(v(e,r),e[a]||(n=void 0)),n&&t.call(i,n.value,n.key,e)};e.exports=class{constructor(e){if("number"==typeof e&&(e={max:e}),e||(e={}),e.max&&("number"!=typeof e.max||e.max<0))throw new TypeError("max must be a non-negative number");this[n]=e.max||1/0;const t=e.length||f;if(this[o]="function"!=typeof t?f:t,this[a]=e.stale||!1,e.maxAge&&"number"!=typeof e.maxAge)throw new TypeError("maxAge must be a number");this[d]=e.maxAge||0,this[u]=e.dispose,this[l]=e.noDisposeOnSet||!1,this[h]=e.updateAgeOnGet||!1,this.reset()}set max(e){if("number"!=typeof e||e<0)throw new TypeError("max must be a non-negative number");this[n]=e||1/0,m(this)}get max(){return this[n]}set allowStale(e){this[a]=!!e}get allowStale(){return this[a]}set maxAge(e){if("number"!=typeof e)throw new TypeError("maxAge must be a non-negative number");this[d]=e,m(this)}get maxAge(){return this[d]}set lengthCalculator(e){"function"!=typeof e&&(e=f),e!==this[o]&&(this[o]=e,this[s]=0,this[c].forEach((e=>{e.length=this[o](e.value,e.key),this[s]+=e.length}))),m(this)}get lengthCalculator(){return this[o]}get length(){return this[s]}get itemCount(){return this[c].length}rforEach(e,t){t=t||this;for(let r=this[c].tail;null!==r;){const i=r.prev;_(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[c].head;null!==r;){const i=r.next;_(this,e,r,t),r=i}}keys(){return this[c].toArray().map((e=>e.key))}values(){return this[c].toArray().map((e=>e.value))}reset(){this[u]&&this[c]&&this[c].length&&this[c].forEach((e=>this[u](e.key,e.value))),this[p]=new Map,this[c]=new i,this[s]=0}dump(){return this[c].map((e=>!g(this,e)&&{k:e.key,v:e.value,e:e.now+(e.maxAge||0)})).toArray().filter((e=>e))}dumpLru(){return this[c]}set(e,t,r){if((r=r||this[d])&&"number"!=typeof r)throw new TypeError("maxAge must be a number");const i=r?Date.now():0,a=this[o](t,e);if(this[p].has(e)){if(a>this[n])return v(this,this[p].get(e)),!1;const o=this[p].get(e).value;return this[u]&&(this[l]||this[u](e,o.value)),o.now=i,o.maxAge=r,o.value=t,this[s]+=a-o.length,o.length=a,this.get(e),m(this),!0}const h=new b(e,t,a,i,r);return h.length>this[n]?(this[u]&&this[u](e,t),!1):(this[s]+=h.length,this[c].unshift(h),this[p].set(e,this[c].head),m(this),!0)}has(e){if(!this[p].has(e))return!1;const t=this[p].get(e).value;return!g(this,t)}get(e){return y(this,e,!0)}peek(e){return y(this,e,!1)}pop(){const e=this[c].tail;return e?(v(this,e),e.value):null}del(e){v(this,this[p].get(e))}load(e){this.reset();const t=Date.now();for(let r=e.length-1;r>=0;r--){const i=e[r],n=i.e||0;if(0===n)this.set(i.k,i.v);else{const e=n-t;e>0&&this.set(i.k,i.v,e)}}}prune(){this[p].forEach(((e,t)=>y(this,t,!1)))}}},1378:e=>{var t=1e3,r=60*t,i=60*r,n=24*i,s=7*n,o=365.25*n;function a(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,d){d=d||{};var u=typeof e;if("string"===u&&e.length>0)return function(e){if((e=String(e)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!a)return;var d=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return d*o;case"weeks":case"week":case"w":return d*s;case"days":case"day":case"d":return d*n;case"hours":case"hour":case"hrs":case"hr":case"h":return d*i;case"minutes":case"minute":case"mins":case"min":case"m":return d*r;case"seconds":case"second":case"secs":case"sec":case"s":return d*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return d;default:return}}(e);if("number"===u&&isFinite(e))return d.long?function(e){var s=Math.abs(e);if(s>=n)return a(e,s,n,"day");if(s>=i)return a(e,s,i,"hour");if(s>=r)return a(e,s,r,"minute");if(s>=t)return a(e,s,t,"second");return e+" ms"}(e):function(e){var s=Math.abs(e);if(s>=n)return Math.round(e/n)+"d";if(s>=i)return Math.round(e/i)+"h";if(s>=r)return Math.round(e/r)+"m";if(s>=t)return Math.round(e/t)+"s";return e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},3448:(e,t,r)=>{"use strict";e.exports=r(9188)},3746:(e,t,r)=>{"use strict";var i=t,n=r(6901),s=r(8066);function o(e,t,r,i){if(t.resolvedType)if(t.resolvedType instanceof n){e("switch(d%s){",i);for(var s=t.resolvedType.values,o=Object.keys(s),a=0;a<o.length;++a)t.repeated&&s[o[a]]===t.typeDefault&&e("default:"),e("case%j:",o[a])("case %i:",s[o[a]])("m%s=%j",i,s[o[a]])("break");e("}")}else e('if(typeof d%s!=="object")',i)("throw TypeError(%j)",t.fullName+": object expected")("m%s=types[%i].fromObject(d%s)",i,r,i);else{var d=!1;switch(t.type){case"double":case"float":e("m%s=Number(d%s)",i,i);break;case"uint32":case"fixed32":e("m%s=d%s>>>0",i,i);break;case"int32":case"sint32":case"sfixed32":e("m%s=d%s|0",i,i);break;case"uint64":d=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",i,i,d)('else if(typeof d%s==="string")',i)("m%s=parseInt(d%s,10)",i,i)('else if(typeof d%s==="number")',i)("m%s=d%s",i,i)('else if(typeof d%s==="object")',i)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",i,i,i,d?"true":"");break;case"bytes":e('if(typeof d%s==="string")',i)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",i,i,i)("else if(d%s.length)",i)("m%s=d%s",i,i);break;case"string":e("m%s=String(d%s)",i,i);break;case"bool":e("m%s=Boolean(d%s)",i,i)}}return e}function a(e,t,r,i){if(t.resolvedType)t.resolvedType instanceof n?e("d%s=o.enums===String?types[%i].values[m%s]:m%s",i,r,i,i):e("d%s=types[%i].toObject(m%s,o)",i,r,i);else{var s=!1;switch(t.type){case"double":case"float":e("d%s=o.json&&!isFinite(m%s)?String(m%s):m%s",i,i,i,i);break;case"uint64":s=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e('if(typeof m%s==="number")',i)("d%s=o.longs===String?String(m%s):m%s",i,i,i)("else")("d%s=o.longs===String?util.Long.prototype.toString.call(m%s):o.longs===Number?new util.LongBits(m%s.low>>>0,m%s.high>>>0).toNumber(%s):m%s",i,i,i,i,s?"true":"",i);break;case"bytes":e("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",i,i,i,i,i);break;default:e("d%s=m%s",i,i)}}return e}i.fromObject=function(e){var t=e.fieldsArray,r=s.codegen(["d"],e.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!t.length)return r("return new this.ctor");r("var m=new this.ctor");for(var i=0;i<t.length;++i){var a=t[i].resolve(),d=s.safeProp(a.name);a.map?(r("if(d%s){",d)('if(typeof d%s!=="object")',d)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",d)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",d),o(r,a,i,d+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",d)("if(!Array.isArray(d%s))",d)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",d)("for(var i=0;i<d%s.length;++i){",d),o(r,a,i,d+"[i]")("}")("}")):(a.resolvedType instanceof n||r("if(d%s!=null){",d),o(r,a,i,d),a.resolvedType instanceof n||r("}"))}return r("return m")},i.toObject=function(e){var t=e.fieldsArray.slice().sort(s.compareFieldsById);if(!t.length)return s.codegen()("return {}");for(var r=s.codegen(["m","o"],e.name+"$toObject")("if(!o)")("o={}")("var d={}"),i=[],o=[],d=[],u=0;u<t.length;++u)t[u].partOf||(t[u].resolve().repeated?i:t[u].map?o:d).push(t[u]);if(i.length){for(r("if(o.arrays||o.defaults){"),u=0;u<i.length;++u)r("d%s=[]",s.safeProp(i[u].name));r("}")}if(o.length){for(r("if(o.objects||o.defaults){"),u=0;u<o.length;++u)r("d%s={}",s.safeProp(o[u].name));r("}")}if(d.length){for(r("if(o.defaults){"),u=0;u<d.length;++u){var l=d[u],c=s.safeProp(l.name);if(l.resolvedType instanceof n)r("d%s=o.enums===String?%j:%j",c,l.resolvedType.valuesById[l.typeDefault],l.typeDefault);else if(l.long)r("if(util.Long){")("var n=new util.Long(%i,%i,%j)",l.typeDefault.low,l.typeDefault.high,l.typeDefault.unsigned)("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n",c)("}else")("d%s=o.longs===String?%j:%i",c,l.typeDefault.toString(),l.typeDefault.toNumber());else if(l.bytes){var p="["+Array.prototype.slice.call(l.typeDefault).join(",")+"]";r("if(o.bytes===String)d%s=%j",c,String.fromCharCode.apply(String,l.typeDefault))("else{")("d%s=%s",c,p)("if(o.bytes!==Array)d%s=util.newBuffer(d%s)",c,c)("}")}else r("d%s=%j",c,l.typeDefault)}r("}")}var h=!1;for(u=0;u<t.length;++u){l=t[u];var f=e._fieldsArray.indexOf(l);c=s.safeProp(l.name);l.map?(h||(h=!0,r("var ks2")),r("if(m%s&&(ks2=Object.keys(m%s)).length){",c,c)("d%s={}",c)("for(var j=0;j<ks2.length;++j){"),a(r,l,f,c+"[ks2[j]]")("}")):l.repeated?(r("if(m%s&&m%s.length){",c,c)("d%s=[]",c)("for(var j=0;j<m%s.length;++j){",c),a(r,l,f,c+"[j]")("}")):(r("if(m%s!=null&&m.hasOwnProperty(%j)){",c,l.name),a(r,l,f,c),l.partOf&&r("if(o.oneofs)")("d%s=%j",s.safeProp(l.partOf.name),l.name)),r("}")}return r("return d")}},9847:(e,t,r)=>{"use strict";e.exports=function(e){var t=s.codegen(["r","l"],e.name+"$decode")("if(!(r instanceof Reader))")("r=Reader.create(r)")("var c=l===undefined?r.len:r.pos+l,m=new this.ctor"+(e.fieldsArray.filter((function(e){return e.map})).length?",k,value":""))("while(r.pos<c){")("var t=r.uint32()");e.group&&t("if((t&7)===4)")("break");t("switch(t>>>3){");for(var r=0;r<e.fieldsArray.length;++r){var a=e._fieldsArray[r].resolve(),d=a.resolvedType instanceof i?"int32":a.type,u="m"+s.safeProp(a.name);t("case %i:",a.id),a.map?(t("if(%s===util.emptyObject)",u)("%s={}",u)("var c2 = r.uint32()+r.pos"),void 0!==n.defaults[a.keyType]?t("k=%j",n.defaults[a.keyType]):t("k=null"),void 0!==n.defaults[d]?t("value=%j",n.defaults[d]):t("value=null"),t("while(r.pos<c2){")("var tag2=r.uint32()")("switch(tag2>>>3){")("case 1: k=r.%s(); break",a.keyType)("case 2:"),void 0===n.basic[d]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",d),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==n.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',u):t("%s[k]=value",u)):a.repeated?(t("if(!(%s&&%s.length))",u,u)("%s=[]",u),void 0!==n.packed[d]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",u,d)("}else"),void 0===n.basic[d]?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",u,r):t("%s.push(r.%s())",u,d)):void 0===n.basic[d]?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",u,r):t("%s=r.%s()",u,d),t("break")}for(t("default:")("r.skipType(t&7)")("break")("}")("}"),r=0;r<e._fieldsArray.length;++r){var l=e._fieldsArray[r];l.required&&t("if(!m.hasOwnProperty(%j))",l.name)("throw util.ProtocolError(%j,{instance:m})",o(l))}return t("return m")};var i=r(6901),n=r(3970),s=r(8066);function o(e){return"missing required '"+e.name+"'"}},5191:(e,t,r)=>{"use strict";e.exports=function(e){for(var t,r=s.codegen(["m","w"],e.name+"$encode")("if(!w)")("w=Writer.create()"),a=e.fieldsArray.slice().sort(s.compareFieldsById),d=0;d<a.length;++d){var u=a[d].resolve(),l=e._fieldsArray.indexOf(u),c=u.resolvedType instanceof i?"int32":u.type,p=n.basic[c];t="m"+s.safeProp(u.name),u.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,u.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(u.id<<3|2)>>>0,8|n.mapKey[u.keyType],u.keyType),void 0===p?r("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",l,t):r(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|p,c,t),r("}")("}")):u.repeated?(r("if(%s!=null&&%s.length){",t,t),u.packed&&void 0!==n.packed[c]?r("w.uint32(%i).fork()",(u.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",t)("w.%s(%s[i])",c,t)("w.ldelim()"):(r("for(var i=0;i<%s.length;++i)",t),void 0===p?o(r,u,l,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(u.id<<3|p)>>>0,c,t)),r("}")):(u.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,u.name),void 0===p?o(r,u,l,t):r("w.uint32(%i).%s(%s)",(u.id<<3|p)>>>0,c,t))}return r("return w")};var i=r(6901),n=r(3970),s=r(8066);function o(e,t,r,i){return t.resolvedType.group?e("types[%i].encode(%s,w.uint32(%i)).uint32(%i)",r,i,(t.id<<3|3)>>>0,(t.id<<3|4)>>>0):e("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",r,i,(t.id<<3|2)>>>0)}},6901:(e,t,r)=>{"use strict";e.exports=o;var i=r(7641);((o.prototype=Object.create(i.prototype)).constructor=o).className="Enum";var n=r(9788),s=r(8066);function o(e,t,r,n,s){if(i.call(this,e,r),t&&"object"!=typeof t)throw TypeError("values must be an object");if(this.valuesById={},this.values=Object.create(this.valuesById),this.comment=n,this.comments=s||{},this.reserved=void 0,t)for(var o=Object.keys(t),a=0;a<o.length;++a)"number"==typeof t[o[a]]&&(this.valuesById[this.values[o[a]]=t[o[a]]]=o[a])}o.fromJSON=function(e,t){var r=new o(e,t.values,t.options,t.comment,t.comments);return r.reserved=t.reserved,r},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"values",this.values,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"comment",t?this.comment:void 0,"comments",t?this.comments:void 0])},o.prototype.add=function(e,t,r){if(!s.isString(e))throw TypeError("name must be a string");if(!s.isInteger(t))throw TypeError("id must be an integer");if(void 0!==this.values[e])throw Error("duplicate name '"+e+"' in "+this);if(this.isReservedId(t))throw Error("id "+t+" is reserved in "+this);if(this.isReservedName(e))throw Error("name '"+e+"' is reserved in "+this);if(void 0!==this.valuesById[t]){if(!this.options||!this.options.allow_alias)throw Error("duplicate id "+t+" in "+this);this.values[e]=t}else this.valuesById[this.values[e]=t]=e;return this.comments[e]=r||null,this},o.prototype.remove=function(e){if(!s.isString(e))throw TypeError("name must be a string");var t=this.values[e];if(null==t)throw Error("name '"+e+"' does not exist in "+this);return delete this.valuesById[t],delete this.values[e],delete this.comments[e],this},o.prototype.isReservedId=function(e){return n.isReservedId(this.reserved,e)},o.prototype.isReservedName=function(e){return n.isReservedName(this.reserved,e)}},797:(e,t,r)=>{"use strict";e.exports=u;var i=r(7641);((u.prototype=Object.create(i.prototype)).constructor=u).className="Field";var n,s=r(6901),o=r(3970),a=r(8066),d=/^required|optional|repeated$/;function u(e,t,r,n,s,u,l){if(a.isObject(n)?(l=s,u=n,n=s=void 0):a.isObject(s)&&(l=u,u=s,s=void 0),i.call(this,e,u),!a.isInteger(t)||t<0)throw TypeError("id must be a non-negative integer");if(!a.isString(r))throw TypeError("type must be a string");if(void 0!==n&&!d.test(n=n.toString().toLowerCase()))throw TypeError("rule must be a string rule");if(void 0!==s&&!a.isString(s))throw TypeError("extend must be a string");"proto3_optional"===n&&(n="optional"),this.rule=n&&"optional"!==n?n:void 0,this.type=r,this.id=t,this.extend=s||void 0,this.required="required"===n,this.optional=!this.required,this.repeated="repeated"===n,this.map=!1,this.message=null,this.partOf=null,this.typeDefault=null,this.defaultValue=null,this.long=!!a.Long&&void 0!==o.long[r],this.bytes="bytes"===r,this.resolvedType=null,this.extensionField=null,this.declaringField=null,this._packed=null,this.comment=l}u.fromJSON=function(e,t){return new u(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(u.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),u.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),i.prototype.setOption.call(this,e,t,r)},u.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return a.toObject(["rule","optional"!==this.rule&&this.rule||void 0,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},u.prototype.resolve=function(){if(this.resolved)return this;if(void 0===(this.typeDefault=o.defaults[this.type])&&(this.resolvedType=(this.declaringField?this.declaringField.parent:this.parent).lookupTypeOrEnum(this.type),this.resolvedType instanceof n?this.typeDefault=null:this.typeDefault=this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]),this.options&&null!=this.options.default&&(this.typeDefault=this.options.default,this.resolvedType instanceof s&&"string"==typeof this.typeDefault&&(this.typeDefault=this.resolvedType.values[this.typeDefault])),this.options&&(!0!==this.options.packed&&(void 0===this.options.packed||!this.resolvedType||this.resolvedType instanceof s)||delete this.options.packed,Object.keys(this.options).length||(this.options=void 0)),this.long)this.typeDefault=a.Long.fromNumber(this.typeDefault,"u"===this.type.charAt(0)),Object.freeze&&Object.freeze(this.typeDefault);else if(this.bytes&&"string"==typeof this.typeDefault){var e;a.base64.test(this.typeDefault)?a.base64.decode(this.typeDefault,e=a.newBuffer(a.base64.length(this.typeDefault)),0):a.utf8.write(this.typeDefault,e=a.newBuffer(a.utf8.length(this.typeDefault)),0),this.typeDefault=e}return this.map?this.defaultValue=a.emptyObject:this.repeated?this.defaultValue=a.emptyArray:this.defaultValue=this.typeDefault,this.parent instanceof n&&(this.parent.ctor.prototype[this.name]=this.defaultValue),i.prototype.resolve.call(this)},u.d=function(e,t,r,i){return"function"==typeof t?t=a.decorateType(t).name:t&&"object"==typeof t&&(t=a.decorateEnum(t).name),function(n,s){a.decorateType(n.constructor).add(new u(s,e,t,r,{default:i}))}},u._configure=function(e){n=e}},9188:(e,t,r)=>{"use strict";var i=e.exports=r(536);i.build="light",i.load=function(e,t,r){return"function"==typeof t?(r=t,t=new i.Root):t||(t=new i.Root),t.load(e,r)},i.loadSync=function(e,t){return t||(t=new i.Root),t.loadSync(e)},i.encoder=r(5191),i.decoder=r(9847),i.verifier=r(2332),i.converter=r(3746),i.ReflectionObject=r(7641),i.Namespace=r(9788),i.Root=r(742),i.Enum=r(6901),i.Type=r(3138),i.Field=r(797),i.OneOf=r(6898),i.MapField=r(1981),i.Service=r(9355),i.Method=r(8820),i.Message=r(3611),i.wrappers=r(6423),i.types=r(3970),i.util=r(8066),i.ReflectionObject._configure(i.Root),i.Namespace._configure(i.Type,i.Service,i.Enum),i.Root._configure(i.Type),i.Field._configure(i.Type)},536:(e,t,r)=>{"use strict";var i=t;function n(){i.util._configure(),i.Writer._configure(i.BufferWriter),i.Reader._configure(i.BufferReader)}i.build="minimal",i.Writer=r(123),i.BufferWriter=r(6673),i.Reader=r(9799),i.BufferReader=r(7038),i.util=r(4165),i.rpc=r(4963),i.roots=r(9009),i.configure=n,n()},1981:(e,t,r)=>{"use strict";e.exports=o;var i=r(797);((o.prototype=Object.create(i.prototype)).constructor=o).className="MapField";var n=r(3970),s=r(8066);function o(e,t,r,n,o,a){if(i.call(this,e,t,n,void 0,void 0,o,a),!s.isString(r))throw TypeError("keyType must be a string");this.keyType=r,this.resolvedKeyType=null,this.map=!0}o.fromJSON=function(e,t){return new o(e,t.id,t.keyType,t.type,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["keyType",this.keyType,"type",this.type,"id",this.id,"extend",this.extend,"options",this.options,"comment",t?this.comment:void 0])},o.prototype.resolve=function(){if(this.resolved)return this;if(void 0===n.mapKey[this.keyType])throw Error("invalid key type: "+this.keyType);return i.prototype.resolve.call(this)},o.d=function(e,t,r){return"function"==typeof r?r=s.decorateType(r).name:r&&"object"==typeof r&&(r=s.decorateEnum(r).name),function(i,n){s.decorateType(i.constructor).add(new o(n,e,t,r))}}},3611:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e){if(e)for(var t=Object.keys(e),r=0;r<t.length;++r)this[t[r]]=e[t[r]]}n.create=function(e){return this.$type.create(e)},n.encode=function(e,t){return this.$type.encode(e,t)},n.encodeDelimited=function(e,t){return this.$type.encodeDelimited(e,t)},n.decode=function(e){return this.$type.decode(e)},n.decodeDelimited=function(e){return this.$type.decodeDelimited(e)},n.verify=function(e){return this.$type.verify(e)},n.fromObject=function(e){return this.$type.fromObject(e)},n.toObject=function(e,t){return this.$type.toObject(e,t)},n.prototype.toJSON=function(){return this.$type.toObject(this,i.toJSONOptions)}},8820:(e,t,r)=>{"use strict";e.exports=s;var i=r(7641);((s.prototype=Object.create(i.prototype)).constructor=s).className="Method";var n=r(8066);function s(e,t,r,s,o,a,d,u,l){if(n.isObject(o)?(d=o,o=a=void 0):n.isObject(a)&&(d=a,a=void 0),void 0!==t&&!n.isString(t))throw TypeError("type must be a string");if(!n.isString(r))throw TypeError("requestType must be a string");if(!n.isString(s))throw TypeError("responseType must be a string");i.call(this,e,d),this.type=t||"rpc",this.requestType=r,this.requestStream=!!o||void 0,this.responseType=s,this.responseStream=!!a||void 0,this.resolvedRequestType=null,this.resolvedResponseType=null,this.comment=u,this.parsedOptions=l}s.fromJSON=function(e,t){return new s(e,t.type,t.requestType,t.responseType,t.requestStream,t.responseStream,t.options,t.comment,t.parsedOptions)},s.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return n.toObject(["type","rpc"!==this.type&&this.type||void 0,"requestType",this.requestType,"requestStream",this.requestStream,"responseType",this.responseType,"responseStream",this.responseStream,"options",this.options,"comment",t?this.comment:void 0,"parsedOptions",this.parsedOptions])},s.prototype.resolve=function(){return this.resolved?this:(this.resolvedRequestType=this.parent.lookupType(this.requestType),this.resolvedResponseType=this.parent.lookupType(this.responseType),i.prototype.resolve.call(this))}},9788:(e,t,r)=>{"use strict";e.exports=c;var i=r(7641);((c.prototype=Object.create(i.prototype)).constructor=c).className="Namespace";var n,s,o,a=r(797),d=r(6898),u=r(8066);function l(e,t){if(e&&e.length){for(var r={},i=0;i<e.length;++i)r[e[i].name]=e[i].toJSON(t);return r}}function c(e,t){i.call(this,e,t),this.nested=void 0,this._nestedArray=null}function p(e){return e._nestedArray=null,e}c.fromJSON=function(e,t){return new c(e,t.options).addJSON(t.nested)},c.arrayToJSON=l,c.isReservedId=function(e,t){if(e)for(var r=0;r<e.length;++r)if("string"!=typeof e[r]&&e[r][0]<=t&&e[r][1]>t)return!0;return!1},c.isReservedName=function(e,t){if(e)for(var r=0;r<e.length;++r)if(e[r]===t)return!0;return!1},Object.defineProperty(c.prototype,"nestedArray",{get:function(){return this._nestedArray||(this._nestedArray=u.toArray(this.nested))}}),c.prototype.toJSON=function(e){return u.toObject(["options",this.options,"nested",l(this.nestedArray,e)])},c.prototype.addJSON=function(e){if(e)for(var t,r=Object.keys(e),i=0;i<r.length;++i)t=e[r[i]],this.add((void 0!==t.fields?n.fromJSON:void 0!==t.values?o.fromJSON:void 0!==t.methods?s.fromJSON:void 0!==t.id?a.fromJSON:c.fromJSON)(r[i],t));return this},c.prototype.get=function(e){return this.nested&&this.nested[e]||null},c.prototype.getEnum=function(e){if(this.nested&&this.nested[e]instanceof o)return this.nested[e].values;throw Error("no such enum: "+e)},c.prototype.add=function(e){if(!(e instanceof a&&void 0!==e.extend||e instanceof n||e instanceof o||e instanceof s||e instanceof c||e instanceof d))throw TypeError("object must be a valid nested object");if(this.nested){var t=this.get(e.name);if(t){if(!(t instanceof c&&e instanceof c)||t instanceof n||t instanceof s)throw Error("duplicate name '"+e.name+"' in "+this);for(var r=t.nestedArray,i=0;i<r.length;++i)e.add(r[i]);this.remove(t),this.nested||(this.nested={}),e.setOptions(t.options,!0)}}else this.nested={};return this.nested[e.name]=e,e.onAdd(this),p(this)},c.prototype.remove=function(e){if(!(e instanceof i))throw TypeError("object must be a ReflectionObject");if(e.parent!==this)throw Error(e+" is not a member of "+this);return delete this.nested[e.name],Object.keys(this.nested).length||(this.nested=void 0),e.onRemove(this),p(this)},c.prototype.define=function(e,t){if(u.isString(e))e=e.split(".");else if(!Array.isArray(e))throw TypeError("illegal path");if(e&&e.length&&""===e[0])throw Error("path must be relative");for(var r=this;e.length>0;){var i=e.shift();if(r.nested&&r.nested[i]){if(!((r=r.nested[i])instanceof c))throw Error("path conflicts with non-namespace objects")}else r.add(r=new c(i))}return t&&r.addJSON(t),r},c.prototype.resolveAll=function(){for(var e=this.nestedArray,t=0;t<e.length;)e[t]instanceof c?e[t++].resolveAll():e[t++].resolve();return this.resolve()},c.prototype.lookup=function(e,t,r){if("boolean"==typeof t?(r=t,t=void 0):t&&!Array.isArray(t)&&(t=[t]),u.isString(e)&&e.length){if("."===e)return this.root;e=e.split(".")}else if(!e.length)return this;if(""===e[0])return this.root.lookup(e.slice(1),t);var i=this.get(e[0]);if(i){if(1===e.length){if(!t||t.indexOf(i.constructor)>-1)return i}else if(i instanceof c&&(i=i.lookup(e.slice(1),t,!0)))return i}else for(var n=0;n<this.nestedArray.length;++n)if(this._nestedArray[n]instanceof c&&(i=this._nestedArray[n].lookup(e,t,!0)))return i;return null===this.parent||r?null:this.parent.lookup(e,t)},c.prototype.lookupType=function(e){var t=this.lookup(e,[n]);if(!t)throw Error("no such type: "+e);return t},c.prototype.lookupEnum=function(e){var t=this.lookup(e,[o]);if(!t)throw Error("no such Enum '"+e+"' in "+this);return t},c.prototype.lookupTypeOrEnum=function(e){var t=this.lookup(e,[n,o]);if(!t)throw Error("no such Type or Enum '"+e+"' in "+this);return t},c.prototype.lookupService=function(e){var t=this.lookup(e,[s]);if(!t)throw Error("no such Service '"+e+"' in "+this);return t},c._configure=function(e,t,r){n=e,s=t,o=r}},7641:(e,t,r)=>{"use strict";e.exports=s,s.className="ReflectionObject";var i,n=r(8066);function s(e,t){if(!n.isString(e))throw TypeError("name must be a string");if(t&&!n.isObject(t))throw TypeError("options must be an object");this.options=t,this.parsedOptions=null,this.name=e,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}Object.defineProperties(s.prototype,{root:{get:function(){for(var e=this;null!==e.parent;)e=e.parent;return e}},fullName:{get:function(){for(var e=[this.name],t=this.parent;t;)e.unshift(t.name),t=t.parent;return e.join(".")}}}),s.prototype.toJSON=function(){throw Error()},s.prototype.onAdd=function(e){this.parent&&this.parent!==e&&this.parent.remove(this),this.parent=e,this.resolved=!1;var t=e.root;t instanceof i&&t._handleAdd(this)},s.prototype.onRemove=function(e){var t=e.root;t instanceof i&&t._handleRemove(this),this.parent=null,this.resolved=!1},s.prototype.resolve=function(){return this.resolved||this.root instanceof i&&(this.resolved=!0),this},s.prototype.getOption=function(e){if(this.options)return this.options[e]},s.prototype.setOption=function(e,t,r){return r&&this.options&&void 0!==this.options[e]||((this.options||(this.options={}))[e]=t),this},s.prototype.setParsedOption=function(e,t,r){this.parsedOptions||(this.parsedOptions=[]);var i=this.parsedOptions;if(r){var s=i.find((function(t){return Object.prototype.hasOwnProperty.call(t,e)}));if(s){var o=s[e];n.setProperty(o,r,t)}else(s={})[e]=n.setProperty({},r,t),i.push(s)}else{var a={};a[e]=t,i.push(a)}return this},s.prototype.setOptions=function(e,t){if(e)for(var r=Object.keys(e),i=0;i<r.length;++i)this.setOption(r[i],e[r[i]],t);return this},s.prototype.toString=function(){var e=this.constructor.className,t=this.fullName;return t.length?e+" "+t:e},s._configure=function(e){i=e}},6898:(e,t,r)=>{"use strict";e.exports=o;var i=r(7641);((o.prototype=Object.create(i.prototype)).constructor=o).className="OneOf";var n=r(797),s=r(8066);function o(e,t,r,n){if(Array.isArray(t)||(r=t,t=void 0),i.call(this,e,r),void 0!==t&&!Array.isArray(t))throw TypeError("fieldNames must be an Array");this.oneof=t||[],this.fieldsArray=[],this.comment=n}function a(e){if(e.parent)for(var t=0;t<e.fieldsArray.length;++t)e.fieldsArray[t].parent||e.parent.add(e.fieldsArray[t])}o.fromJSON=function(e,t){return new o(e,t.oneof,t.options,t.comment)},o.prototype.toJSON=function(e){var t=!!e&&Boolean(e.keepComments);return s.toObject(["options",this.options,"oneof",this.oneof,"comment",t?this.comment:void 0])},o.prototype.add=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");return e.parent&&e.parent!==this.parent&&e.parent.remove(e),this.oneof.push(e.name),this.fieldsArray.push(e),e.partOf=this,a(this),this},o.prototype.remove=function(e){if(!(e instanceof n))throw TypeError("field must be a Field");var t=this.fieldsArray.indexOf(e);if(t<0)throw Error(e+" is not a member of "+this);return this.fieldsArray.splice(t,1),(t=this.oneof.indexOf(e.name))>-1&&this.oneof.splice(t,1),e.partOf=null,this},o.prototype.onAdd=function(e){i.prototype.onAdd.call(this,e);for(var t=0;t<this.oneof.length;++t){var r=e.get(this.oneof[t]);r&&!r.partOf&&(r.partOf=this,this.fieldsArray.push(r))}a(this)},o.prototype.onRemove=function(e){for(var t,r=0;r<this.fieldsArray.length;++r)(t=this.fieldsArray[r]).parent&&t.parent.remove(t);i.prototype.onRemove.call(this,e)},o.d=function(){for(var e=new Array(arguments.length),t=0;t<arguments.length;)e[t]=arguments[t++];return function(t,r){s.decorateType(t.constructor).add(new o(r,e)),Object.defineProperty(t,r,{get:s.oneOfGetter(e),set:s.oneOfSetter(e)})}}},9799:(e,t,r)=>{"use strict";e.exports=d;var i,n=r(4165),s=n.LongBits,o=n.utf8;function a(e,t){return RangeError("index out of range: "+e.pos+" + "+(t||1)+" > "+e.len)}function d(e){this.buf=e,this.pos=0,this.len=e.length}var u,l="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new d(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new d(e);throw Error("illegal buffer")},c=function(){return n.Buffer?function(e){return(d.create=function(e){return n.Buffer.isBuffer(e)?new i(e):l(e)})(e)}:l};function p(){var e=new s(0,0),t=0;if(!(this.len-this.pos>4)){for(;t<3;++t){if(this.pos>=this.len)throw a(this);if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(127&this.buf[this.pos++])<<7*t)>>>0,e}for(;t<4;++t)if(e.lo=(e.lo|(127&this.buf[this.pos])<<7*t)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(127&this.buf[this.pos])<<28)>>>0,e.hi=(e.hi|(127&this.buf[this.pos])>>4)>>>0,this.buf[this.pos++]<128)return e;if(t=0,this.len-this.pos>4){for(;t<5;++t)if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}else for(;t<5;++t){if(this.pos>=this.len)throw a(this);if(e.hi=(e.hi|(127&this.buf[this.pos])<<7*t+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}function h(e,t){return(e[t-4]|e[t-3]<<8|e[t-2]<<16|e[t-1]<<24)>>>0}function f(){if(this.pos+8>this.len)throw a(this,8);return new s(h(this.buf,this.pos+=4),h(this.buf,this.pos+=4))}d.create=c(),d.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,d.prototype.uint32=(u=4294967295,function(){if(u=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return u;if(u=(u|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return u;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return u}),d.prototype.int32=function(){return 0|this.uint32()},d.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},d.prototype.bool=function(){return 0!==this.uint32()},d.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return h(this.buf,this.pos+=4)},d.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|h(this.buf,this.pos+=4)},d.prototype.float=function(){if(this.pos+4>this.len)throw a(this,4);var e=n.float.readFloatLE(this.buf,this.pos);return this.pos+=4,e},d.prototype.double=function(){if(this.pos+8>this.len)throw a(this,4);var e=n.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,e},d.prototype.bytes=function(){var e=this.uint32(),t=this.pos,r=this.pos+e;if(r>this.len)throw a(this,e);return this.pos+=e,Array.isArray(this.buf)?this.buf.slice(t,r):t===r?new this.buf.constructor(0):this._slice.call(this.buf,t,r)},d.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},d.prototype.skip=function(e){if("number"==typeof e){if(this.pos+e>this.len)throw a(this,e);this.pos+=e}else do{if(this.pos>=this.len)throw a(this)}while(128&this.buf[this.pos++]);return this},d.prototype.skipType=function(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;4!=(e=7&this.uint32());)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+e+" at offset "+this.pos)}return this},d._configure=function(e){i=e,d.create=c(),i._configure();var t=n.Long?"toLong":"toNumber";n.merge(d.prototype,{int64:function(){return p.call(this)[t](!1)},uint64:function(){return p.call(this)[t](!0)},sint64:function(){return p.call(this).zzDecode()[t](!1)},fixed64:function(){return f.call(this)[t](!0)},sfixed64:function(){return f.call(this)[t](!1)}})}},7038:(e,t,r)=>{"use strict";e.exports=s;var i=r(9799);(s.prototype=Object.create(i.prototype)).constructor=s;var n=r(4165);function s(e){i.call(this,e)}s._configure=function(){n.Buffer&&(s.prototype._slice=n.Buffer.prototype.slice)},s.prototype.string=function(){var e=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+e,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+e,this.len))},s._configure()},742:(e,t,r)=>{"use strict";e.exports=c;var i=r(9788);((c.prototype=Object.create(i.prototype)).constructor=c).className="Root";var n,s,o,a=r(797),d=r(6901),u=r(6898),l=r(8066);function c(e){i.call(this,"",e),this.deferred=[],this.files=[]}function p(){}c.fromJSON=function(e,t){return t||(t=new c),e.options&&t.setOptions(e.options),t.addJSON(e.nested)},c.prototype.resolvePath=l.path.resolve,c.prototype.fetch=l.fetch,c.prototype.load=function e(t,r,i){"function"==typeof r&&(i=r,r=void 0);var n=this;if(!i)return l.asPromise(e,n,t,r);var a=i===p;function d(e,t){if(i){var r=i;if(i=null,a)throw e;r(e,t)}}function u(e){var t=e.lastIndexOf("google/protobuf/");if(t>-1){var r=e.substring(t);if(r in o)return r}return null}function c(e,t){try{if(l.isString(t)&&"{"===t.charAt(0)&&(t=JSON.parse(t)),l.isString(t)){s.filename=e;var i,o=s(t,n,r),c=0;if(o.imports)for(;c<o.imports.length;++c)(i=u(o.imports[c])||n.resolvePath(e,o.imports[c]))&&h(i);if(o.weakImports)for(c=0;c<o.weakImports.length;++c)(i=u(o.weakImports[c])||n.resolvePath(e,o.weakImports[c]))&&h(i,!0)}else n.setOptions(t.options).addJSON(t.nested)}catch(e){d(e)}a||f||d(null,n)}function h(e,t){if(!(n.files.indexOf(e)>-1))if(n.files.push(e),e in o)a?c(e,o[e]):(++f,setTimeout((function(){--f,c(e,o[e])})));else if(a){var r;try{r=l.fs.readFileSync(e).toString("utf8")}catch(e){return void(t||d(e))}c(e,r)}else++f,n.fetch(e,(function(r,s){--f,i&&(r?t?f||d(null,n):d(r):c(e,s))}))}var f=0;l.isString(t)&&(t=[t]);for(var y,g=0;g<t.length;++g)(y=n.resolvePath("",t[g]))&&h(y);if(a)return n;f||d(null,n)},c.prototype.loadSync=function(e,t){if(!l.isNode)throw Error("not supported");return this.load(e,t,p)},c.prototype.resolveAll=function(){if(this.deferred.length)throw Error("unresolvable extensions: "+this.deferred.map((function(e){return"'extend "+e.extend+"' in "+e.parent.fullName})).join(", "));return i.prototype.resolveAll.call(this)};var h=/^[A-Z]/;function f(e,t){var r=t.parent.lookup(t.extend);if(r){var i=new a(t.fullName,t.id,t.type,t.rule,void 0,t.options);return i.declaringField=t,t.extensionField=i,r.add(i),!0}return!1}c.prototype._handleAdd=function(e){if(e instanceof a)void 0===e.extend||e.extensionField||f(0,e)||this.deferred.push(e);else if(e instanceof d)h.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof u)){if(e instanceof n)for(var t=0;t<this.deferred.length;)f(0,this.deferred[t])?this.deferred.splice(t,1):++t;for(var r=0;r<e.nestedArray.length;++r)this._handleAdd(e._nestedArray[r]);h.test(e.name)&&(e.parent[e.name]=e)}},c.prototype._handleRemove=function(e){if(e instanceof a){if(void 0!==e.extend)if(e.extensionField)e.extensionField.parent.remove(e.extensionField),e.extensionField=null;else{var t=this.deferred.indexOf(e);t>-1&&this.deferred.splice(t,1)}}else if(e instanceof d)h.test(e.name)&&delete e.parent[e.name];else if(e instanceof i){for(var r=0;r<e.nestedArray.length;++r)this._handleRemove(e._nestedArray[r]);h.test(e.name)&&delete e.parent[e.name]}},c._configure=function(e,t,r){n=e,s=t,o=r}},9009:e=>{"use strict";e.exports={}},4963:(e,t,r)=>{"use strict";t.Service=r(9548)},9548:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e,t,r){if("function"!=typeof e)throw TypeError("rpcImpl must be a function");i.EventEmitter.call(this),this.rpcImpl=e,this.requestDelimited=Boolean(t),this.responseDelimited=Boolean(r)}(n.prototype=Object.create(i.EventEmitter.prototype)).constructor=n,n.prototype.rpcCall=function e(t,r,n,s,o){if(!s)throw TypeError("request must be specified");var a=this;if(!o)return i.asPromise(e,a,t,r,n,s);if(a.rpcImpl)try{return a.rpcImpl(t,r[a.requestDelimited?"encodeDelimited":"encode"](s).finish(),(function(e,r){if(e)return a.emit("error",e,t),o(e);if(null!==r){if(!(r instanceof n))try{r=n[a.responseDelimited?"decodeDelimited":"decode"](r)}catch(e){return a.emit("error",e,t),o(e)}return a.emit("data",r,t),o(null,r)}a.end(!0)}))}catch(e){return a.emit("error",e,t),void setTimeout((function(){o(e)}),0)}else setTimeout((function(){o(Error("already ended"))}),0)},n.prototype.end=function(e){return this.rpcImpl&&(e||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this}},9355:(e,t,r)=>{"use strict";e.exports=a;var i=r(9788);((a.prototype=Object.create(i.prototype)).constructor=a).className="Service";var n=r(8820),s=r(8066),o=r(4963);function a(e,t){i.call(this,e,t),this.methods={},this._methodsArray=null}function d(e){return e._methodsArray=null,e}a.fromJSON=function(e,t){var r=new a(e,t.options);if(t.methods)for(var i=Object.keys(t.methods),s=0;s<i.length;++s)r.add(n.fromJSON(i[s],t.methods[i[s]]));return t.nested&&r.addJSON(t.nested),r.comment=t.comment,r},a.prototype.toJSON=function(e){var t=i.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return s.toObject(["options",t&&t.options||void 0,"methods",i.arrayToJSON(this.methodsArray,e)||{},"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},Object.defineProperty(a.prototype,"methodsArray",{get:function(){return this._methodsArray||(this._methodsArray=s.toArray(this.methods))}}),a.prototype.get=function(e){return this.methods[e]||i.prototype.get.call(this,e)},a.prototype.resolveAll=function(){for(var e=this.methodsArray,t=0;t<e.length;++t)e[t].resolve();return i.prototype.resolve.call(this)},a.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);return e instanceof n?(this.methods[e.name]=e,e.parent=this,d(this)):i.prototype.add.call(this,e)},a.prototype.remove=function(e){if(e instanceof n){if(this.methods[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.methods[e.name],e.parent=null,d(this)}return i.prototype.remove.call(this,e)},a.prototype.create=function(e,t,r){for(var i,n=new o.Service(e,t,r),a=0;a<this.methodsArray.length;++a){var d=s.lcFirst((i=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");n[d]=s.codegen(["r","c"],s.isReserved(d)?d+"_":d)("return this.rpcCall(m,q,s,r,c)")({m:i,q:i.resolvedRequestType.ctor,s:i.resolvedResponseType.ctor})}return n}},3138:(e,t,r)=>{"use strict";e.exports=v;var i=r(9788);((v.prototype=Object.create(i.prototype)).constructor=v).className="Type";var n=r(6901),s=r(6898),o=r(797),a=r(1981),d=r(9355),u=r(3611),l=r(9799),c=r(123),p=r(8066),h=r(5191),f=r(9847),y=r(2332),g=r(3746),m=r(6423);function v(e,t){i.call(this,e,t),this.fields={},this.oneofs=void 0,this.extensions=void 0,this.reserved=void 0,this.group=void 0,this._fieldsById=null,this._fieldsArray=null,this._oneofsArray=null,this._ctor=null}function b(e){return e._fieldsById=e._fieldsArray=e._oneofsArray=null,delete e.encode,delete e.decode,delete e.verify,e}Object.defineProperties(v.prototype,{fieldsById:{get:function(){if(this._fieldsById)return this._fieldsById;this._fieldsById={};for(var e=Object.keys(this.fields),t=0;t<e.length;++t){var r=this.fields[e[t]],i=r.id;if(this._fieldsById[i])throw Error("duplicate id "+i+" in "+this);this._fieldsById[i]=r}return this._fieldsById}},fieldsArray:{get:function(){return this._fieldsArray||(this._fieldsArray=p.toArray(this.fields))}},oneofsArray:{get:function(){return this._oneofsArray||(this._oneofsArray=p.toArray(this.oneofs))}},ctor:{get:function(){return this._ctor||(this.ctor=v.generateConstructor(this)())},set:function(e){var t=e.prototype;t instanceof u||((e.prototype=new u).constructor=e,p.merge(e.prototype,t)),e.$type=e.prototype.$type=this,p.merge(e,u,!0),this._ctor=e;for(var r=0;r<this.fieldsArray.length;++r)this._fieldsArray[r].resolve();var i={};for(r=0;r<this.oneofsArray.length;++r)i[this._oneofsArray[r].resolve().name]={get:p.oneOfGetter(this._oneofsArray[r].oneof),set:p.oneOfSetter(this._oneofsArray[r].oneof)};r&&Object.defineProperties(e.prototype,i)}}}),v.generateConstructor=function(e){for(var t,r=p.codegen(["p"],e.name),i=0;i<e.fieldsArray.length;++i)(t=e._fieldsArray[i]).map?r("this%s={}",p.safeProp(t.name)):t.repeated&&r("this%s=[]",p.safeProp(t.name));return r("if(p)for(var ks=Object.keys(p),i=0;i<ks.length;++i)if(p[ks[i]]!=null)")("this[ks[i]]=p[ks[i]]")},v.fromJSON=function(e,t){var r=new v(e,t.options);r.extensions=t.extensions,r.reserved=t.reserved;for(var u=Object.keys(t.fields),l=0;l<u.length;++l)r.add((void 0!==t.fields[u[l]].keyType?a.fromJSON:o.fromJSON)(u[l],t.fields[u[l]]));if(t.oneofs)for(u=Object.keys(t.oneofs),l=0;l<u.length;++l)r.add(s.fromJSON(u[l],t.oneofs[u[l]]));if(t.nested)for(u=Object.keys(t.nested),l=0;l<u.length;++l){var c=t.nested[u[l]];r.add((void 0!==c.id?o.fromJSON:void 0!==c.fields?v.fromJSON:void 0!==c.values?n.fromJSON:void 0!==c.methods?d.fromJSON:i.fromJSON)(u[l],c))}return t.extensions&&t.extensions.length&&(r.extensions=t.extensions),t.reserved&&t.reserved.length&&(r.reserved=t.reserved),t.group&&(r.group=!0),t.comment&&(r.comment=t.comment),r},v.prototype.toJSON=function(e){var t=i.prototype.toJSON.call(this,e),r=!!e&&Boolean(e.keepComments);return p.toObject(["options",t&&t.options||void 0,"oneofs",i.arrayToJSON(this.oneofsArray,e),"fields",i.arrayToJSON(this.fieldsArray.filter((function(e){return!e.declaringField})),e)||{},"extensions",this.extensions&&this.extensions.length?this.extensions:void 0,"reserved",this.reserved&&this.reserved.length?this.reserved:void 0,"group",this.group||void 0,"nested",t&&t.nested||void 0,"comment",r?this.comment:void 0])},v.prototype.resolveAll=function(){for(var e=this.fieldsArray,t=0;t<e.length;)e[t++].resolve();var r=this.oneofsArray;for(t=0;t<r.length;)r[t++].resolve();return i.prototype.resolveAll.call(this)},v.prototype.get=function(e){return this.fields[e]||this.oneofs&&this.oneofs[e]||this.nested&&this.nested[e]||null},v.prototype.add=function(e){if(this.get(e.name))throw Error("duplicate name '"+e.name+"' in "+this);if(e instanceof o&&void 0===e.extend){if(this._fieldsById?this._fieldsById[e.id]:this.fieldsById[e.id])throw Error("duplicate id "+e.id+" in "+this);if(this.isReservedId(e.id))throw Error("id "+e.id+" is reserved in "+this);if(this.isReservedName(e.name))throw Error("name '"+e.name+"' is reserved in "+this);return e.parent&&e.parent.remove(e),this.fields[e.name]=e,e.message=this,e.onAdd(this),b(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),b(this)):i.prototype.add.call(this,e)},v.prototype.remove=function(e){if(e instanceof o&&void 0===e.extend){if(!this.fields||this.fields[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.fields[e.name],e.parent=null,e.onRemove(this),b(this)}if(e instanceof s){if(!this.oneofs||this.oneofs[e.name]!==e)throw Error(e+" is not a member of "+this);return delete this.oneofs[e.name],e.parent=null,e.onRemove(this),b(this)}return i.prototype.remove.call(this,e)},v.prototype.isReservedId=function(e){return i.isReservedId(this.reserved,e)},v.prototype.isReservedName=function(e){return i.isReservedName(this.reserved,e)},v.prototype.create=function(e){return new this.ctor(e)},v.prototype.setup=function(){for(var e=this.fullName,t=[],r=0;r<this.fieldsArray.length;++r)t.push(this._fieldsArray[r].resolve().resolvedType);this.encode=h(this)({Writer:c,types:t,util:p}),this.decode=f(this)({Reader:l,types:t,util:p}),this.verify=y(this)({types:t,util:p}),this.fromObject=g.fromObject(this)({types:t,util:p}),this.toObject=g.toObject(this)({types:t,util:p});var i=m[e];if(i){var n=Object.create(this);n.fromObject=this.fromObject,this.fromObject=i.fromObject.bind(n),n.toObject=this.toObject,this.toObject=i.toObject.bind(n)}return this},v.prototype.encode=function(e,t){return this.setup().encode(e,t)},v.prototype.encodeDelimited=function(e,t){return this.encode(e,t&&t.len?t.fork():t).ldelim()},v.prototype.decode=function(e,t){return this.setup().decode(e,t)},v.prototype.decodeDelimited=function(e){return e instanceof l||(e=l.create(e)),this.decode(e,e.uint32())},v.prototype.verify=function(e){return this.setup().verify(e)},v.prototype.fromObject=function(e){return this.setup().fromObject(e)},v.prototype.toObject=function(e,t){return this.setup().toObject(e,t)},v.d=function(e){return function(t){p.decorateType(t,e)}}},3970:(e,t,r)=>{"use strict";var i=t,n=r(8066),s=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function o(e,t){var r=0,i={};for(t|=0;r<e.length;)i[s[r+t]]=e[r++];return i}i.basic=o([1,5,0,0,0,5,5,0,0,0,1,1,0,2,2]),i.defaults=o([0,0,0,0,0,0,0,0,0,0,0,0,!1,"",n.emptyArray,null]),i.long=o([0,0,0,1,1],7),i.mapKey=o([0,0,0,5,5,0,0,0,1,1,0,2],2),i.packed=o([1,5,0,0,0,5,5,0,0,0,1,1,0])},8066:(e,t,r)=>{"use strict";var i,n,s=e.exports=r(4165),o=r(9009);s.codegen=r(1706),s.fetch=r(4641),s.path=r(2659),s.fs=s.inquire("fs"),s.toArray=function(e){if(e){for(var t=Object.keys(e),r=new Array(t.length),i=0;i<t.length;)r[i]=e[t[i++]];return r}return[]},s.toObject=function(e){for(var t={},r=0;r<e.length;){var i=e[r++],n=e[r++];void 0!==n&&(t[i]=n)}return t};var a=/\\/g,d=/"/g;s.isReserved=function(e){return/^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(e)},s.safeProp=function(e){return!/^[$\w_]+$/.test(e)||s.isReserved(e)?'["'+e.replace(a,"\\\\").replace(d,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var u=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(u,(function(e,t){return t.toUpperCase()}))},s.compareFieldsById=function(e,t){return e.id-t.id},s.decorateType=function(e,t){if(e.$type)return t&&e.$type.name!==t&&(s.decorateRoot.remove(e.$type),e.$type.name=t,s.decorateRoot.add(e.$type)),e.$type;i||(i=r(3138));var n=new i(t||e.name);return s.decorateRoot.add(n),n.ctor=e,Object.defineProperty(e,"$type",{value:n,enumerable:!1}),Object.defineProperty(e.prototype,"$type",{value:n,enumerable:!1}),n};var l=0;s.decorateEnum=function(e){if(e.$type)return e.$type;n||(n=r(6901));var t=new n("Enum"+l++,e);return s.decorateRoot.add(t),Object.defineProperty(e,"$type",{value:t,enumerable:!1}),t},s.setProperty=function(e,t,r){if("object"!=typeof e)throw TypeError("dst must be an object");if(!t)throw TypeError("path must be specified");return function e(t,r,i){var n=r.shift();if("__proto__"===n)return t;if(r.length>0)t[n]=e(t[n]||{},r,i);else{var s=t[n];s&&(i=[].concat(s).concat(i)),t[n]=i}return t}(e,t=t.split("."),r)},Object.defineProperty(s,"decorateRoot",{get:function(){return o.decorated||(o.decorated=new(r(742)))}})},1697:(e,t,r)=>{"use strict";e.exports=n;var i=r(4165);function n(e,t){this.lo=e>>>0,this.hi=t>>>0}var s=n.zero=new n(0,0);s.toNumber=function(){return 0},s.zzEncode=s.zzDecode=function(){return this},s.length=function(){return 1};var o=n.zeroHash="\0\0\0\0\0\0\0\0";n.fromNumber=function(e){if(0===e)return s;var t=e<0;t&&(e=-e);var r=e>>>0,i=(e-r)/4294967296>>>0;return t&&(i=~i>>>0,r=~r>>>0,++r>4294967295&&(r=0,++i>4294967295&&(i=0))),new n(r,i)},n.from=function(e){if("number"==typeof e)return n.fromNumber(e);if(i.isString(e)){if(!i.Long)return n.fromNumber(parseInt(e,10));e=i.Long.fromString(e)}return e.low||e.high?new n(e.low>>>0,e.high>>>0):s},n.prototype.toNumber=function(e){if(!e&&this.hi>>>31){var t=1+~this.lo>>>0,r=~this.hi>>>0;return t||(r=r+1>>>0),-(t+4294967296*r)}return this.lo+4294967296*this.hi},n.prototype.toLong=function(e){return i.Long?new i.Long(0|this.lo,0|this.hi,Boolean(e)):{low:0|this.lo,high:0|this.hi,unsigned:Boolean(e)}};var a=String.prototype.charCodeAt;n.fromHash=function(e){return e===o?s:new n((a.call(e,0)|a.call(e,1)<<8|a.call(e,2)<<16|a.call(e,3)<<24)>>>0,(a.call(e,4)|a.call(e,5)<<8|a.call(e,6)<<16|a.call(e,7)<<24)>>>0)},n.prototype.toHash=function(){return String.fromCharCode(255&this.lo,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,255&this.hi,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},n.prototype.zzEncode=function(){var e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this},n.prototype.zzDecode=function(){var e=-(1&this.lo);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this},n.prototype.length=function(){var e=this.lo,t=(this.lo>>>28|this.hi<<4)>>>0,r=this.hi>>>24;return 0===r?0===t?e<16384?e<128?1:2:e<2097152?3:4:t<16384?t<128?5:6:t<2097152?7:8:r<128?9:10}},4165:function(e,t,r){"use strict";var i=t;function n(e,t,r){for(var i=Object.keys(t),n=0;n<i.length;++n)void 0!==e[i[n]]&&r||(e[i[n]]=t[i[n]]);return e}function s(e){function t(e,r){if(!(this instanceof t))return new t(e,r);Object.defineProperty(this,"message",{get:function(){return e}}),Error.captureStackTrace?Error.captureStackTrace(this,t):Object.defineProperty(this,"stack",{value:(new Error).stack||""}),r&&n(this,r)}return(t.prototype=Object.create(Error.prototype)).constructor=t,Object.defineProperty(t.prototype,"name",{get:function(){return e}}),t.prototype.toString=function(){return this.name+": "+this.message},t}i.asPromise=r(6781),i.base64=r(7026),i.EventEmitter=r(5570),i.float=r(5298),i.inquire=r(6116),i.utf8=r(7958),i.pool=r(804),i.LongBits=r(1697),i.isNode=Boolean(void 0!==r.g&&r.g&&r.g.process&&r.g.process.versions&&r.g.process.versions.node),i.global=i.isNode&&r.g||"undefined"!=typeof window&&window||"undefined"!=typeof self&&self||this,i.emptyArray=Object.freeze?Object.freeze([]):[],i.emptyObject=Object.freeze?Object.freeze({}):{},i.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},i.isString=function(e){return"string"==typeof e||e instanceof String},i.isObject=function(e){return e&&"object"==typeof e},i.isset=i.isSet=function(e,t){var r=e[t];return!(null==r||!e.hasOwnProperty(t))&&("object"!=typeof r||(Array.isArray(r)?r.length:Object.keys(r).length)>0)},i.Buffer=function(){try{var e=i.inquire("buffer").Buffer;return e.prototype.utf8Write?e:null}catch(e){return null}}(),i._Buffer_from=null,i._Buffer_allocUnsafe=null,i.newBuffer=function(e){return"number"==typeof e?i.Buffer?i._Buffer_allocUnsafe(e):new i.Array(e):i.Buffer?i._Buffer_from(e):"undefined"==typeof Uint8Array?e:new Uint8Array(e)},i.Array="undefined"!=typeof Uint8Array?Uint8Array:Array,i.Long=i.global.dcodeIO&&i.global.dcodeIO.Long||i.global.Long||i.inquire("long"),i.key2Re=/^true|false|0|1$/,i.key32Re=/^-?(?:0|[1-9][0-9]*)$/,i.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,i.longToHash=function(e){return e?i.LongBits.from(e).toHash():i.LongBits.zeroHash},i.longFromHash=function(e,t){var r=i.LongBits.fromHash(e);return i.Long?i.Long.fromBits(r.lo,r.hi,t):r.toNumber(Boolean(t))},i.merge=n,i.lcFirst=function(e){return e.charAt(0).toLowerCase()+e.substring(1)},i.newError=s,i.ProtocolError=s("ProtocolError"),i.oneOfGetter=function(e){for(var t={},r=0;r<e.length;++r)t[e[r]]=1;return function(){for(var e=Object.keys(this),r=e.length-1;r>-1;--r)if(1===t[e[r]]&&void 0!==this[e[r]]&&null!==this[e[r]])return e[r]}},i.oneOfSetter=function(e){return function(t){for(var r=0;r<e.length;++r)e[r]!==t&&delete this[e[r]]}},i.toJSONOptions={longs:String,enums:String,bytes:String,json:!0},i._configure=function(){var e=i.Buffer;e?(i._Buffer_from=e.from!==Uint8Array.from&&e.from||function(t,r){return new e(t,r)},i._Buffer_allocUnsafe=e.allocUnsafe||function(t){return new e(t)}):i._Buffer_from=i._Buffer_allocUnsafe=null}},2332:(e,t,r)=>{"use strict";e.exports=function(e){var t=n.codegen(["m"],e.name+"$verify")('if(typeof m!=="object"||m===null)')("return%j","object expected"),r=e.oneofsArray,i={};r.length&&t("var p={}");for(var d=0;d<e.fieldsArray.length;++d){var u=e._fieldsArray[d].resolve(),l="m"+n.safeProp(u.name);if(u.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",l,u.name),u.map)t("if(!util.isObject(%s))",l)("return%j",s(u,"object"))("var k=Object.keys(%s)",l)("for(var i=0;i<k.length;++i){"),a(t,u,"k[i]"),o(t,u,d,l+"[k[i]]")("}");else if(u.repeated)t("if(!Array.isArray(%s))",l)("return%j",s(u,"array"))("for(var i=0;i<%s.length;++i){",l),o(t,u,d,l+"[i]")("}");else{if(u.partOf){var c=n.safeProp(u.partOf.name);1===i[u.partOf.name]&&t("if(p%s===1)",c)("return%j",u.partOf.name+": multiple values"),i[u.partOf.name]=1,t("p%s=1",c)}o(t,u,d,l)}u.optional&&t("}")}return t("return null")};var i=r(6901),n=r(8066);function s(e,t){return e.name+": "+t+(e.repeated&&"array"!==t?"[]":e.map&&"object"!==t?"{k:"+e.keyType+"}":"")+" expected"}function o(e,t,r,n){if(t.resolvedType)if(t.resolvedType instanceof i){e("switch(%s){",n)("default:")("return%j",s(t,"enum value"));for(var o=Object.keys(t.resolvedType.values),a=0;a<o.length;++a)e("case %i:",t.resolvedType.values[o[a]]);e("break")("}")}else e("{")("var e=types[%i].verify(%s);",r,n)("if(e)")("return%j+e",t.name+".")("}");else switch(t.type){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.isInteger(%s))",n)("return%j",s(t,"integer"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))",n,n,n,n)("return%j",s(t,"integer|Long"));break;case"float":case"double":e('if(typeof %s!=="number")',n)("return%j",s(t,"number"));break;case"bool":e('if(typeof %s!=="boolean")',n)("return%j",s(t,"boolean"));break;case"string":e("if(!util.isString(%s))",n)("return%j",s(t,"string"));break;case"bytes":e('if(!(%s&&typeof %s.length==="number"||util.isString(%s)))',n,n,n)("return%j",s(t,"buffer"))}return e}function a(e,t,r){switch(t.keyType){case"int32":case"uint32":case"sint32":case"fixed32":case"sfixed32":e("if(!util.key32Re.test(%s))",r)("return%j",s(t,"integer key"));break;case"int64":case"uint64":case"sint64":case"fixed64":case"sfixed64":e("if(!util.key64Re.test(%s))",r)("return%j",s(t,"integer|Long key"));break;case"bool":e("if(!util.key2Re.test(%s))",r)("return%j",s(t,"boolean key"))}return e}},6423:(e,t,r)=>{"use strict";var i=t,n=r(3611);i[".google.protobuf.Any"]={fromObject:function(e){if(e&&e["@type"]){var t=e["@type"].substring(e["@type"].lastIndexOf("/")+1),r=this.lookup(t);if(r){var i="."===e["@type"].charAt(0)?e["@type"].substr(1):e["@type"];return-1===i.indexOf("/")&&(i="/"+i),this.create({type_url:i,value:r.encode(r.fromObject(e)).finish()})}}return this.fromObject(e)},toObject:function(e,t){var r="",i="";if(t&&t.json&&e.type_url&&e.value){i=e.type_url.substring(e.type_url.lastIndexOf("/")+1),r=e.type_url.substring(0,e.type_url.lastIndexOf("/")+1);var s=this.lookup(i);s&&(e=s.decode(e.value))}if(!(e instanceof this.ctor)&&e instanceof n){var o=e.$type.toObject(e,t);return""===r&&(r="type.googleapis.com/"),i=r+("."===e.$type.fullName[0]?e.$type.fullName.substr(1):e.$type.fullName),o["@type"]=i,o}return this.toObject(e,t)}}},123:(e,t,r)=>{"use strict";e.exports=c;var i,n=r(4165),s=n.LongBits,o=n.base64,a=n.utf8;function d(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function u(){}function l(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}function c(){this.len=0,this.head=new d(u,0,0),this.tail=this.head,this.states=null}var p=function(){return n.Buffer?function(){return(c.create=function(){return new i})()}:function(){return new c}};function h(e,t,r){t[r]=255&e}function f(e,t){this.len=e,this.next=void 0,this.val=t}function y(e,t,r){for(;e.hi;)t[r++]=127&e.lo|128,e.lo=(e.lo>>>7|e.hi<<25)>>>0,e.hi>>>=7;for(;e.lo>127;)t[r++]=127&e.lo|128,e.lo=e.lo>>>7;t[r++]=e.lo}function g(e,t,r){t[r]=255&e,t[r+1]=e>>>8&255,t[r+2]=e>>>16&255,t[r+3]=e>>>24}c.create=p(),c.alloc=function(e){return new n.Array(e)},n.Array!==Array&&(c.alloc=n.pool(c.alloc,n.Array.prototype.subarray)),c.prototype._push=function(e,t,r){return this.tail=this.tail.next=new d(e,t,r),this.len+=t,this},f.prototype=Object.create(d.prototype),f.prototype.fn=function(e,t,r){for(;e>127;)t[r++]=127&e|128,e>>>=7;t[r]=e},c.prototype.uint32=function(e){return this.len+=(this.tail=this.tail.next=new f((e>>>=0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this},c.prototype.int32=function(e){return e<0?this._push(y,10,s.fromNumber(e)):this.uint32(e)},c.prototype.sint32=function(e){return this.uint32((e<<1^e>>31)>>>0)},c.prototype.uint64=function(e){var t=s.from(e);return this._push(y,t.length(),t)},c.prototype.int64=c.prototype.uint64,c.prototype.sint64=function(e){var t=s.from(e).zzEncode();return this._push(y,t.length(),t)},c.prototype.bool=function(e){return this._push(h,1,e?1:0)},c.prototype.fixed32=function(e){return this._push(g,4,e>>>0)},c.prototype.sfixed32=c.prototype.fixed32,c.prototype.fixed64=function(e){var t=s.from(e);return this._push(g,4,t.lo)._push(g,4,t.hi)},c.prototype.sfixed64=c.prototype.fixed64,c.prototype.float=function(e){return this._push(n.float.writeFloatLE,4,e)},c.prototype.double=function(e){return this._push(n.float.writeDoubleLE,8,e)};var m=n.Array.prototype.set?function(e,t,r){t.set(e,r)}:function(e,t,r){for(var i=0;i<e.length;++i)t[r+i]=e[i]};c.prototype.bytes=function(e){var t=e.length>>>0;if(!t)return this._push(h,1,0);if(n.isString(e)){var r=c.alloc(t=o.length(e));o.decode(e,r,0),e=r}return this.uint32(t)._push(m,t,e)},c.prototype.string=function(e){var t=a.length(e);return t?this.uint32(t)._push(a.write,t,e):this._push(h,1,0)},c.prototype.fork=function(){return this.states=new l(this),this.head=this.tail=new d(u,0,0),this.len=0,this},c.prototype.reset=function(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new d(u,0,0),this.len=0),this},c.prototype.ldelim=function(){var e=this.head,t=this.tail,r=this.len;return this.reset().uint32(r),r&&(this.tail.next=e.next,this.tail=t,this.len+=r),this},c.prototype.finish=function(){for(var e=this.head.next,t=this.constructor.alloc(this.len),r=0;e;)e.fn(e.val,t,r),r+=e.len,e=e.next;return t},c._configure=function(e){i=e,c.create=p(),i._configure()}},6673:(e,t,r)=>{"use strict";e.exports=s;var i=r(123);(s.prototype=Object.create(i.prototype)).constructor=s;var n=r(4165);function s(){i.call(this)}function o(e,t,r){e.length<40?n.utf8.write(e,t,r):t.utf8Write?t.utf8Write(e,r):t.write(e,r)}s._configure=function(){s.alloc=n._Buffer_allocUnsafe,s.writeBytesBuffer=n.Buffer&&n.Buffer.prototype instanceof Uint8Array&&"set"===n.Buffer.prototype.set.name?function(e,t,r){t.set(e,r)}:function(e,t,r){if(e.copy)e.copy(t,r,0,e.length);else for(var i=0;i<e.length;)t[r++]=e[i++]}},s.prototype.bytes=function(e){n.isString(e)&&(e=n._Buffer_from(e,"base64"));var t=e.length>>>0;return this.uint32(t),t&&this._push(s.writeBytesBuffer,t,e),this},s.prototype.string=function(e){var t=n.Buffer.byteLength(e);return this.uint32(t),t&&this._push(o,t,e),this},s._configure()},7847:(e,t,r)=>{const i=Symbol("SemVer ANY");class n{static get ANY(){return i}constructor(e,t){if(t=s(t),e instanceof n){if(e.loose===!!t.loose)return e;e=e.value}u("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===i?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){const t=this.options.loose?o[a.COMPARATORLOOSE]:o[a.COMPARATOR],r=e.match(t);if(!r)throw new TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new l(r[2],this.options.loose):this.semver=i}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===i||e===i)return!0;if("string"==typeof e)try{e=new l(e,this.options)}catch(e){return!1}return d(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof n))throw new TypeError("a Comparator is required");if(t&&"object"==typeof t||(t={loose:!!t,includePrerelease:!1}),""===this.operator)return""===this.value||new c(e.value,t).test(this.value);if(""===e.operator)return""===e.value||new c(this.value,t).test(e.semver);const r=!(">="!==this.operator&&">"!==this.operator||">="!==e.operator&&">"!==e.operator),i=!("<="!==this.operator&&"<"!==this.operator||"<="!==e.operator&&"<"!==e.operator),s=this.semver.version===e.semver.version,o=!(">="!==this.operator&&"<="!==this.operator||">="!==e.operator&&"<="!==e.operator),a=d(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),u=d(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||i||s&&o||a||u}}e.exports=n;const s=r(1388),{re:o,t:a}=r(4808),d=r(8117),u=r(952),l=r(2435),c=r(6843)},6843:(e,t,r)=>{class i{constructor(e,t){if(t=s(t),e instanceof i)return e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease?e:new i(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.format(),this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e,this.set=e.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${e}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!f(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&y(e[0])){this.set=[e];break}}this.format()}format(){return this.range=this.set.map((e=>e.join(" ").trim())).join("||").trim(),this.range}toString(){return this.range}parseRange(e){e=e.trim();const t=`parseRange:${Object.keys(this.options).join(",")}:${e}`,r=n.get(t);if(r)return r;const i=this.options.loose,s=i?u[l.HYPHENRANGELOOSE]:u[l.HYPHENRANGE];e=e.replace(s,I(this.options.includePrerelease)),a("hyphen replace",e),e=e.replace(u[l.COMPARATORTRIM],c),a("comparator trim",e);let d=(e=(e=(e=e.replace(u[l.TILDETRIM],p)).replace(u[l.CARETTRIM],h)).split(/\s+/).join(" ")).split(" ").map((e=>m(e,this.options))).join(" ").split(/\s+/).map((e=>O(e,this.options)));i&&(d=d.filter((e=>(a("loose invalid filter",e,this.options),!!e.match(u[l.COMPARATORLOOSE]))))),a("range list",d);const y=new Map,g=d.map((e=>new o(e,this.options)));for(const e of g){if(f(e))return[e];y.set(e.value,e)}y.size>1&&y.has("")&&y.delete("");const v=[...y.values()];return n.set(t,v),v}intersects(e,t){if(!(e instanceof i))throw new TypeError("a Range is required");return this.set.some((r=>g(r,t)&&e.set.some((e=>g(e,t)&&r.every((r=>e.every((e=>r.intersects(e,t)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new d(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(x(this.set[t],e,this.options))return!0;return!1}}e.exports=i;const n=new(r(7105))({max:1e3}),s=r(1388),o=r(7847),a=r(952),d=r(2435),{re:u,t:l,comparatorTrimReplace:c,tildeTrimReplace:p,caretTrimReplace:h}=r(4808),f=e=>"<0.0.0-0"===e.value,y=e=>""===e.value,g=(e,t)=>{let r=!0;const i=e.slice();let n=i.pop();for(;r&&i.length;)r=i.every((e=>n.intersects(e,t))),n=i.pop();return r},m=(e,t)=>(a("comp",e,t),e=w(e,t),a("caret",e),e=b(e,t),a("tildes",e),e=T(e,t),a("xrange",e),e=R(e,t),a("stars",e),e),v=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>_(e,t))).join(" "),_=(e,t)=>{const r=t.loose?u[l.TILDELOOSE]:u[l.TILDE];return e.replace(r,((t,r,i,n,s)=>{let o;return a("tilde",e,t,r,i,n,s),v(r)?o="":v(i)?o=`>=${r}.0.0 <${+r+1}.0.0-0`:v(n)?o=`>=${r}.${i}.0 <${r}.${+i+1}.0-0`:s?(a("replaceTilde pr",s),o=`>=${r}.${i}.${n}-${s} <${r}.${+i+1}.0-0`):o=`>=${r}.${i}.${n} <${r}.${+i+1}.0-0`,a("tilde return",o),o}))},w=(e,t)=>e.trim().split(/\s+/).map((e=>E(e,t))).join(" "),E=(e,t)=>{a("caret",e,t);const r=t.loose?u[l.CARETLOOSE]:u[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,((t,r,n,s,o)=>{let d;return a("caret",e,t,r,n,s,o),v(r)?d="":v(n)?d=`>=${r}.0.0${i} <${+r+1}.0.0-0`:v(s)?d="0"===r?`>=${r}.${n}.0${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${i} <${+r+1}.0.0-0`:o?(a("replaceCaret pr",o),d="0"===r?"0"===n?`>=${r}.${n}.${s}-${o} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}-${o} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s}-${o} <${+r+1}.0.0-0`):(a("no pr"),d="0"===r?"0"===n?`>=${r}.${n}.${s}${i} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s} <${+r+1}.0.0-0`),a("caret return",d),d}))},T=(e,t)=>(a("replaceXRanges",e,t),e.split(/\s+/).map((e=>S(e,t))).join(" ")),S=(e,t)=>{e=e.trim();const r=t.loose?u[l.XRANGELOOSE]:u[l.XRANGE];return e.replace(r,((r,i,n,s,o,d)=>{a("xRange",e,r,i,n,s,o,d);const u=v(n),l=u||v(s),c=l||v(o),p=c;return"="===i&&p&&(i=""),d=t.includePrerelease?"-0":"",u?r=">"===i||"<"===i?"<0.0.0-0":"*":i&&p?(l&&(s=0),o=0,">"===i?(i=">=",l?(n=+n+1,s=0,o=0):(s=+s+1,o=0)):"<="===i&&(i="<",l?n=+n+1:s=+s+1),"<"===i&&(d="-0"),r=`${i+n}.${s}.${o}${d}`):l?r=`>=${n}.0.0${d} <${+n+1}.0.0-0`:c&&(r=`>=${n}.${s}.0${d} <${n}.${+s+1}.0-0`),a("xRange return",r),r}))},R=(e,t)=>(a("replaceStars",e,t),e.trim().replace(u[l.STAR],"")),O=(e,t)=>(a("replaceGTE0",e,t),e.trim().replace(u[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),I=e=>(t,r,i,n,s,o,a,d,u,l,c,p,h)=>`${r=v(i)?"":v(n)?`>=${i}.0.0${e?"-0":""}`:v(s)?`>=${i}.${n}.0${e?"-0":""}`:o?`>=${r}`:`>=${r}${e?"-0":""}`} ${d=v(u)?"":v(l)?`<${+u+1}.0.0-0`:v(c)?`<${u}.${+l+1}.0-0`:p?`<=${u}.${l}.${c}-${p}`:e?`<${u}.${l}.${+c+1}-0`:`<=${d}`}`.trim(),x=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(a(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){const i=e[r].semver;if(i.major===t.major&&i.minor===t.minor&&i.patch===t.patch)return!0}return!1}return!0}},2435:(e,t,r)=>{const i=r(952),{MAX_LENGTH:n,MAX_SAFE_INTEGER:s}=r(5558),{re:o,t:a}=r(4808),d=r(1388),{compareIdentifiers:u}=r(4935);class l{constructor(e,t){if(t=d(t),e instanceof l){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid Version: ${e}`);if(e.length>n)throw new TypeError(`version is longer than ${n} characters`);i("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?o[a.LOOSE]:o[a.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>s||this.major<0)throw new TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<s)return t}return e})):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(i("SemVer.compare",this.version,this.options,e),!(e instanceof l)){if("string"==typeof e&&e===this.version)return 0;e=new l(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof l||(e=new l(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof l||(e=new l(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{const r=this.prerelease[t],n=e.prerelease[t];if(i("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return u(r,n)}while(++t)}compareBuild(e){e instanceof l||(e=new l(e,this.options));let t=0;do{const r=this.build[t],n=e.build[t];if(i("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return-1;if(r!==n)return u(r,n)}while(++t)}inc(e,t){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t),this.inc("pre",t);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t),this.inc("pre",t);break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":if(0===this.prerelease.length)this.prerelease=[0];else{let e=this.prerelease.length;for(;--e>=0;)"number"==typeof this.prerelease[e]&&(this.prerelease[e]++,e=-2);-1===e&&this.prerelease.push(0)}t&&(0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=[t,0]):this.prerelease=[t,0]);break;default:throw new Error(`invalid increment argument: ${e}`)}return this.format(),this.raw=this.version,this}}e.exports=l},6694:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},8117:(e,t,r)=>{const i=r(3276),n=r(7893),s=r(6379),o=r(8463),a=r(1897),d=r(506);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return i(e,r,u);case"!=":return n(e,r,u);case">":return s(e,r,u);case">=":return o(e,r,u);case"<":return a(e,r,u);case"<=":return d(e,r,u);default:throw new TypeError(`Invalid operator: ${t}`)}}},8686:(e,t,r)=>{const i=r(2435),n=r(9943),{re:s,t:o}=r(4808);e.exports=(e,t)=>{if(e instanceof i)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let t;for(;(t=s[o.COERCERTL].exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&t.index+t[0].length===r.index+r[0].length||(r=t),s[o.COERCERTL].lastIndex=t.index+t[1].length+t[2].length;s[o.COERCERTL].lastIndex=-1}else r=e.match(s[o.COERCE]);return null===r?null:n(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,t)}},5914:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r)=>{const n=new i(e,r),s=new i(t,r);return n.compare(s)||n.compareBuild(s)}},5404:(e,t,r)=>{const i=r(2271);e.exports=(e,t)=>i(e,t,!0)},2271:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r)=>new i(e,r).compare(new i(t,r))},6007:(e,t,r)=>{const i=r(9943),n=r(3276);e.exports=(e,t)=>{if(n(e,t))return null;{const r=i(e),n=i(t),s=r.prerelease.length||n.prerelease.length,o=s?"pre":"",a=s?"prerelease":"";for(const e in r)if(("major"===e||"minor"===e||"patch"===e)&&r[e]!==n[e])return o+e;return a}}},3276:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>0===i(e,t,r)},6379:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)>0},8463:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)>=0},6360:(e,t,r)=>{const i=r(2435);e.exports=(e,t,r,n)=>{"string"==typeof r&&(n=r,r=void 0);try{return new i(e instanceof i?e.version:e,r).inc(t,n).version}catch(e){return null}}},1897:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)<0},506:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(e,t,r)<=0},4551:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).major},469:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).minor},7893:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>0!==i(e,t,r)},9943:(e,t,r)=>{const{MAX_LENGTH:i}=r(5558),{re:n,t:s}=r(4808),o=r(2435),a=r(1388);e.exports=(e,t)=>{if(t=a(t),e instanceof o)return e;if("string"!=typeof e)return null;if(e.length>i)return null;if(!(t.loose?n[s.LOOSE]:n[s.FULL]).test(e))return null;try{return new o(e,t)}catch(e){return null}}},4250:(e,t,r)=>{const i=r(2435);e.exports=(e,t)=>new i(e,t).patch},8204:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e,t);return r&&r.prerelease.length?r.prerelease:null}},733:(e,t,r)=>{const i=r(2271);e.exports=(e,t,r)=>i(t,e,r)},2961:(e,t,r)=>{const i=r(5914);e.exports=(e,t)=>e.sort(((e,r)=>i(r,e,t)))},9844:(e,t,r)=>{const i=r(6843);e.exports=(e,t,r)=>{try{t=new i(t,r)}catch(e){return!1}return t.test(e)}},1116:(e,t,r)=>{const i=r(5914);e.exports=(e,t)=>e.sort(((e,r)=>i(e,r,t)))},7230:(e,t,r)=>{const i=r(9943);e.exports=(e,t)=>{const r=i(e,t);return r?r.version:null}},7699:(e,t,r)=>{const i=r(4808);e.exports={re:i.re,src:i.src,tokens:i.t,SEMVER_SPEC_VERSION:r(5558).SEMVER_SPEC_VERSION,SemVer:r(2435),compareIdentifiers:r(4935).compareIdentifiers,rcompareIdentifiers:r(4935).rcompareIdentifiers,parse:r(9943),valid:r(7230),clean:r(6694),inc:r(6360),diff:r(6007),major:r(4551),minor:r(469),patch:r(4250),prerelease:r(8204),compare:r(2271),rcompare:r(733),compareLoose:r(5404),compareBuild:r(5914),sort:r(1116),rsort:r(2961),gt:r(6379),lt:r(1897),eq:r(3276),neq:r(7893),gte:r(8463),lte:r(506),cmp:r(8117),coerce:r(8686),Comparator:r(7847),Range:r(6843),satisfies:r(9844),toComparators:r(8865),maxSatisfying:r(3727),minSatisfying:r(4338),minVersion:r(1542),validRange:r(6240),outside:r(9106),gtr:r(995),ltr:r(7805),intersects:r(2013),simplifyRange:r(1338),subset:r(3122)}},5558:e=>{const t=Number.MAX_SAFE_INTEGER||9007199254740991;e.exports={SEMVER_SPEC_VERSION:"2.0.0",MAX_LENGTH:256,MAX_SAFE_INTEGER:t,MAX_SAFE_COMPONENT_LENGTH:16}},952:e=>{const t="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=t},4935:e=>{const t=/^[0-9]+$/,r=(e,r)=>{const i=t.test(e),n=t.test(r);return i&&n&&(e=+e,r=+r),e===r?0:i&&!n?-1:n&&!i?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},1388:e=>{const t=["includePrerelease","loose","rtl"];e.exports=e=>e?"object"!=typeof e?{loose:!0}:t.filter((t=>e[t])).reduce(((e,t)=>(e[t]=!0,e)),{}):{}},4808:(e,t,r)=>{const{MAX_SAFE_COMPONENT_LENGTH:i}=r(5558),n=r(952),s=(t=e.exports={}).re=[],o=t.src=[],a=t.t={};let d=0;const u=(e,t,r)=>{const i=d++;n(e,i,t),a[e]=i,o[i]=t,s[i]=new RegExp(t,r?"g":void 0)};u("NUMERICIDENTIFIER","0|[1-9]\\d*"),u("NUMERICIDENTIFIERLOOSE","[0-9]+"),u("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),u("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),u("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),u("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),u("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),u("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),u("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),u("BUILDIDENTIFIER","[0-9A-Za-z-]+"),u("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),u("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),u("FULL",`^${o[a.FULLPLAIN]}$`),u("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),u("LOOSE",`^${o[a.LOOSEPLAIN]}$`),u("GTLT","((?:<|>)?=?)"),u("XRANGEIDENTIFIERLOOSE",`${o[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),u("XRANGEIDENTIFIER",`${o[a.NUMERICIDENTIFIER]}|x|X|\\*`),u("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),u("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),u("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),u("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),u("COERCE",`(^|[^\\d])(\\d{1,${i}})(?:\\.(\\d{1,${i}}))?(?:\\.(\\d{1,${i}}))?(?:$|[^\\d])`),u("COERCERTL",o[a.COERCE],!0),u("LONETILDE","(?:~>?)"),u("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",u("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),u("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),u("LONECARET","(?:\\^)"),u("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",u("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),u("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),u("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),u("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),u("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",u("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),u("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),u("STAR","(<|>)?=?\\s*\\*"),u("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),u("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},995:(e,t,r)=>{const i=r(9106);e.exports=(e,t,r)=>i(e,t,">",r)},2013:(e,t,r)=>{const i=r(6843);e.exports=(e,t,r)=>(e=new i(e,r),t=new i(t,r),e.intersects(t))},7805:(e,t,r)=>{const i=r(9106);e.exports=(e,t,r)=>i(e,t,"<",r)},3727:(e,t,r)=>{const i=r(2435),n=r(6843);e.exports=(e,t,r)=>{let s=null,o=null,a=null;try{a=new n(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(s&&-1!==o.compare(e)||(s=e,o=new i(s,r)))})),s}},4338:(e,t,r)=>{const i=r(2435),n=r(6843);e.exports=(e,t,r)=>{let s=null,o=null,a=null;try{a=new n(t,r)}catch(e){return null}return e.forEach((e=>{a.test(e)&&(s&&1!==o.compare(e)||(s=e,o=new i(s,r)))})),s}},1542:(e,t,r)=>{const i=r(2435),n=r(6843),s=r(6379);e.exports=(e,t)=>{e=new n(e,t);let r=new i("0.0.0");if(e.test(r))return r;if(r=new i("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t<e.set.length;++t){const n=e.set[t];let o=null;n.forEach((e=>{const t=new i(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":o&&!s(t,o)||(o=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!o||r&&!s(r,o)||(r=o)}return r&&e.test(r)?r:null}},9106:(e,t,r)=>{const i=r(2435),n=r(7847),{ANY:s}=n,o=r(6843),a=r(9844),d=r(6379),u=r(1897),l=r(506),c=r(8463);e.exports=(e,t,r,p)=>{let h,f,y,g,m;switch(e=new i(e,p),t=new o(t,p),r){case">":h=d,f=l,y=u,g=">",m=">=";break;case"<":h=u,f=c,y=d,g="<",m="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(a(e,t,p))return!1;for(let r=0;r<t.set.length;++r){const i=t.set[r];let o=null,a=null;if(i.forEach((e=>{e.semver===s&&(e=new n(">=0.0.0")),o=o||e,a=a||e,h(e.semver,o.semver,p)?o=e:y(e.semver,a.semver,p)&&(a=e)})),o.operator===g||o.operator===m)return!1;if((!a.operator||a.operator===g)&&f(e,a.semver))return!1;if(a.operator===m&&y(e,a.semver))return!1}return!0}},1338:(e,t,r)=>{const i=r(9844),n=r(2271);e.exports=(e,t,r)=>{const s=[];let o=null,a=null;const d=e.sort(((e,t)=>n(e,t,r)));for(const e of d){i(e,t,r)?(a=e,o||(o=e)):(a&&s.push([o,a]),a=null,o=null)}o&&s.push([o,null]);const u=[];for(const[e,t]of s)e===t?u.push(e):t||e!==d[0]?t?e===d[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");const l=u.join(" || "),c="string"==typeof t.raw?t.raw:String(t);return l.length<c.length?l:t}},3122:(e,t,r)=>{const i=r(6843),n=r(7847),{ANY:s}=n,o=r(9844),a=r(2271),d=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===s){if(1===t.length&&t[0].semver===s)return!0;e=r.includePrerelease?[new n(">=0.0.0-0")]:[new n(">=0.0.0")]}if(1===t.length&&t[0].semver===s){if(r.includePrerelease)return!0;t=[new n(">=0.0.0")]}const i=new Set;let d,c,p,h,f,y,g;for(const t of e)">"===t.operator||">="===t.operator?d=u(d,t,r):"<"===t.operator||"<="===t.operator?c=l(c,t,r):i.add(t.semver);if(i.size>1)return null;if(d&&c){if(p=a(d.semver,c.semver,r),p>0)return null;if(0===p&&(">="!==d.operator||"<="!==c.operator))return null}for(const e of i){if(d&&!o(e,String(d),r))return null;if(c&&!o(e,String(c),r))return null;for(const i of t)if(!o(e,String(i),r))return!1;return!0}let m=!(!c||r.includePrerelease||!c.semver.prerelease.length)&&c.semver,v=!(!d||r.includePrerelease||!d.semver.prerelease.length)&&d.semver;m&&1===m.prerelease.length&&"<"===c.operator&&0===m.prerelease[0]&&(m=!1);for(const e of t){if(g=g||">"===e.operator||">="===e.operator,y=y||"<"===e.operator||"<="===e.operator,d)if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),">"===e.operator||">="===e.operator){if(h=u(d,e,r),h===e&&h!==d)return!1}else if(">="===d.operator&&!o(d.semver,String(e),r))return!1;if(c)if(m&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===m.major&&e.semver.minor===m.minor&&e.semver.patch===m.patch&&(m=!1),"<"===e.operator||"<="===e.operator){if(f=l(c,e,r),f===e&&f!==c)return!1}else if("<="===c.operator&&!o(c.semver,String(e),r))return!1;if(!e.operator&&(c||d)&&0!==p)return!1}return!(d&&y&&!c&&0!==p)&&(!(c&&g&&!d&&0!==p)&&(!v&&!m))},u=(e,t,r)=>{if(!e)return t;const i=a(e.semver,t.semver,r);return i>0?e:i<0||">"===t.operator&&">="===e.operator?t:e},l=(e,t,r)=>{if(!e)return t;const i=a(e.semver,t.semver,r);return i<0?e:i>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new i(e,r),t=new i(t,r);let n=!1;e:for(const i of e.set){for(const e of t.set){const t=d(i,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0}},8865:(e,t,r)=>{const i=r(6843);e.exports=(e,t)=>new i(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")))},6240:(e,t,r)=>{const i=r(6843);e.exports=(e,t)=>{try{return new i(e,t).range||"*"}catch(e){return null}}},8268:e=>{"use strict";e.exports=function(e){e.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}},8006:(e,t,r)=>{"use strict";function i(e){var t=this;if(t instanceof i||(t=new i),t.tail=null,t.head=null,t.length=0,e&&"function"==typeof e.forEach)e.forEach((function(e){t.push(e)}));else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);return t}function n(e,t,r){var i=t===e.head?new a(r,null,t,e):new a(r,t,t.next,e);return null===i.next&&(e.tail=i),null===i.prev&&(e.head=i),e.length++,i}function s(e,t){e.tail=new a(t,e.tail,null,e),e.head||(e.head=e.tail),e.length++}function o(e,t){e.head=new a(t,null,e.head,e),e.tail||(e.tail=e.head),e.length++}function a(e,t,r,i){if(!(this instanceof a))return new a(e,t,r,i);this.list=i,this.value=e,t?(t.next=this,this.prev=t):this.prev=null,r?(r.prev=this,this.next=r):this.next=null}e.exports=i,i.Node=a,i.create=i,i.prototype.removeNode=function(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");var t=e.next,r=e.prev;return t&&(t.prev=r),r&&(r.next=t),e===this.head&&(this.head=t),e===this.tail&&(this.tail=r),e.list.length--,e.next=null,e.prev=null,e.list=null,t},i.prototype.unshiftNode=function(e){if(e!==this.head){e.list&&e.list.removeNode(e);var t=this.head;e.list=this,e.next=t,t&&(t.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}},i.prototype.pushNode=function(e){if(e!==this.tail){e.list&&e.list.removeNode(e);var t=this.tail;e.list=this,e.prev=t,t&&(t.next=e),this.tail=e,this.head||(this.head=e),this.length++}},i.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)s(this,arguments[e]);return this.length},i.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)o(this,arguments[e]);return this.length},i.prototype.pop=function(){if(this.tail){var e=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,e}},i.prototype.shift=function(){if(this.head){var e=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,e}},i.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,i=0;null!==r;i++)e.call(t,r.value,i,this),r=r.next},i.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,i=this.length-1;null!==r;i--)e.call(t,r.value,i,this),r=r.prev},i.prototype.get=function(e){for(var t=0,r=this.head;null!==r&&t<e;t++)r=r.next;if(t===e&&null!==r)return r.value},i.prototype.getReverse=function(e){for(var t=0,r=this.tail;null!==r&&t<e;t++)r=r.prev;if(t===e&&null!==r)return r.value},i.prototype.map=function(e,t){t=t||this;for(var r=new i,n=this.head;null!==n;)r.push(e.call(t,n.value,this)),n=n.next;return r},i.prototype.mapReverse=function(e,t){t=t||this;for(var r=new i,n=this.tail;null!==n;)r.push(e.call(t,n.value,this)),n=n.prev;return r},i.prototype.reduce=function(e,t){var r,i=this.head;if(arguments.length>1)r=t;else{if(!this.head)throw new TypeError("Reduce of empty list with no initial value");i=this.head.next,r=this.head.value}for(var n=0;null!==i;n++)r=e(r,i.value,n),i=i.next;return r},i.prototype.reduceReverse=function(e,t){var r,i=this.tail;if(arguments.length>1)r=t;else{if(!this.tail)throw new TypeError("Reduce of empty list with no initial value");i=this.tail.prev,r=this.tail.value}for(var n=this.length-1;null!==i;n--)r=e(r,i.value,n),i=i.prev;return r},i.prototype.toArray=function(){for(var e=new Array(this.length),t=0,r=this.head;null!==r;t++)e[t]=r.value,r=r.next;return e},i.prototype.toArrayReverse=function(){for(var e=new Array(this.length),t=0,r=this.tail;null!==r;t++)e[t]=r.value,r=r.prev;return e},i.prototype.slice=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new i;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=0,s=this.head;null!==s&&n<e;n++)s=s.next;for(;null!==s&&n<t;n++,s=s.next)r.push(s.value);return r},i.prototype.sliceReverse=function(e,t){(t=t||this.length)<0&&(t+=this.length),(e=e||0)<0&&(e+=this.length);var r=new i;if(t<e||t<0)return r;e<0&&(e=0),t>this.length&&(t=this.length);for(var n=this.length,s=this.tail;null!==s&&n>t;n--)s=s.prev;for(;null!==s&&n>e;n--,s=s.prev)r.push(s.value);return r},i.prototype.splice=function(e,t,...r){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);for(var i=0,s=this.head;null!==s&&i<e;i++)s=s.next;var o=[];for(i=0;s&&i<t;i++)o.push(s.value),s=this.removeNode(s);null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev);for(i=0;i<r.length;i++)s=n(this,s,r[i]);return o},i.prototype.reverse=function(){for(var e=this.head,t=this.tail,r=e;null!==r;r=r.prev){var i=r.prev;r.prev=r.next,r.next=i}return this.head=t,this.tail=e,this};try{r(8268)(i)}catch(e){}},2391:e=>{"use strict";e.exports=JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.2-beta-2","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.2-beta-2","@onekeyfe/hd-transport":"^0.2.2-beta-2","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9"}}')}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={};return(()=>{"use strict";__webpack_require__.d(__webpack_exports__,{default:()=>fe});var e=__webpack_require__(2699),t=__webpack_require__.n(e),r=__webpack_require__(5890),i=__webpack_require__(8402);let n,s,o=(0,i.createDeferred)(),a=0;const d=async e=>{o=(0,i.createDeferred)();const t=document.getElementById("onekey-connect");t?n=t:(n=document.createElement("iframe"),n.frameBorder="0",n.width="0px",n.height="0px",n.style.position="absolute",n.style.display="none",n.style.border="0px",n.style.width="0px",n.style.height="0px",n.id="onekey-connect","webusb"===e.env&&(n.allow="usb"));const r=`version=${e.version}`,d=`${e.iframeSrc}?${r}`;n.setAttribute("src",d),s=(e=>{if("string"!=typeof e)return"unknown";if(0===e.indexOf("file://"))return"file://";const t=e.match(/^.+\:\/\/[^\/]+/);return Array.isArray(t)&&t.length>0?t[0]:"unknown"})(n.src),a=window.setTimeout((()=>{o.reject(i.ERRORS.TypedError(i.HardwareErrorCode.IframeTimeout))}),1e4);const u=()=>{var t;n?(null===(t=n.contentWindow)||void 0===t||t.postMessage({type:"iframe-init",payload:{settings:{...e}}},s),n.onload=null):o.reject(i.ERRORS.TypedError(i.HardwareErrorCode.IframeBlocked))};n.attachEvent?n.attachEvent("onload",u):n.onload=u,document.body&&document.body.appendChild(n);try{await o.promise}catch(e){throw n&&(n.parentNode&&n.parentNode.removeChild(n),n=null),e}finally{window.clearTimeout(a),a=0}},u={iframeName:"onekey-iframe",hostName:"onekey-host",channel:"onekey-js-sdk",scope:"$hardware_sdk"};var l=__webpack_require__(7408);function c(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class p extends l{emit(e,...t){return super.emit(e,...t)}addListener(e,t){return super.addListener(e,t),this}on(e,t){return super.on(e,t),this}once(e,t){return super.once(e,t),this}removeListener(e,t){return super.removeListener(e,t),this}off(e,t){return super.off(e,t),this}removeAllListeners(e){return super.removeAllListeners(e),this}setMaxListeners(e){return super.setMaxListeners(e),this}getMaxListeners(){return super.getMaxListeners()}listeners(e){return super.listeners(e)}rawListeners(e){return super.rawListeners(e)}listenerCount(e){return super.listenerCount(e)}prependListener(e,t){return super.prependListener(e,t),this}prependOnceListener(e,t){return super.prependOnceListener(e,t),this}eventNames(){return super.eventNames()}}class h extends p{emit(e,...t){let r="error"===e;const i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){let e;if(t.length>0&&([e]=t),e instanceof Error)throw e;const r=new Error("Unhandled error."+(e?` (${e.message})`:""));throw r.context=e,r}const n=i[e];if(void 0===n)return!1;if("function"==typeof n)c(n,this,t);else{const e=n.length,r=function(e){const t=e.length,r=new Array(t);for(let i=0;i<t;i+=1)r[i]=e[i];return r}(n);for(let i=0;i<e;i+=1)c(r[i],this,t)}return!0}}var f=__webpack_require__(7030),y=__webpack_require__(5505),g=__webpack_require__(1378),m=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const v=function(e){return m(this,void 0,void 0,(function*(){function t(e){let i,n,s,o=null;function a(...e){if(!a.enabled)return;const r=a,n=Number(new Date),s=n-(i||n);r.diff=s,r.prev=i,r.curr=n,i=n,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let o=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((i,n)=>{if("%%"===i)return"%";o++;const s=t.formatters[n];if("function"==typeof s){const t=e[o];i=s.call(r,t),e.splice(o,1),o--}return i})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==o?o:(n!==t.namespaces&&(n=t.namespaces,s=t.enabled(e)),s),set:e=>{o=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const i=t(this.namespace+(void 0===r?":":r)+e);return i.log=this.log,i}function i(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(i),...t.skips.map(i).map((e=>`-${e}`))].join(",");return t.enable(""),e},t.enable=function(e){return m(this,void 0,void 0,(function*(){let r;yield t.save(e),t.namespaces=e,t.names=[],t.skips=[];const i=("string"==typeof e?e:"").split(/[\s,]+/),n=i.length;for(r=0;r<n;r++)i[r]&&("-"===(e=i[r].replace(/\*/g,".*?"))[0]?t.skips.push(new RegExp(`^${e.substr(1)}$`)):t.names.push(new RegExp(`^${e}$`)))}))},t.enabled=function(e){if("*"===e[e.length-1])return!0;let r,i;for(r=0,i=t.skips.length;r<i;r++)if(t.skips[r].test(e))return!1;for(r=0,i=t.names.length;r<i;r++)if(t.names[r].test(e))return!0;return!1},t.humanize=g,t.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")},Object.keys(e).forEach((r=>{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={j(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: ${e.message}`}}},t.selectColor=function(e){let r=0;for(let t=0;t<e.length;t++)r=(r<<5)-r+e.charCodeAt(t),r|=0;return t.colors[Math.abs(r)%t.colors.length]};const n=yield t.load();return yield t.enable(n),t}))},b="$$ONEKEY_DEBUG_LOGGER";var _=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const w=b,E={};E.formatArgs=function(e){if(e[0]=`${(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")}+${E.humanize(this.diff)}`,!this.useColors)return;const t=`color: ${this.color}`;e.splice(1,0,t,"color: inherit");let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,(e=>{"%%"!==e&&(r+=1,"%c"===e&&(i=r))})),e.splice(i,0,t)},E.save=function(e){return _(this,void 0,void 0,(function*(){try{e?yield E.storage.setItem(w,e):yield E.storage.removeItem(w)}catch(e){console.error("debug logger storage error",e)}}))},E.load=function(){return _(this,void 0,void 0,(function*(){let e;try{e=yield E.storage.getItem(w)}catch(e){console.error("debug logger storage error",e)}return!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG),e}))},E.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},E.storage=function(){try{return"undefined"!=typeof global&&global.$$onekeyAppStorage?global.$$onekeyAppStorage:"undefined"!=typeof window&&window.localStorage?window.localStorage:(console.warn("debugLogger init warning, neither `global.$$onekeyAppStorage` nor `window.localStorage` found."),{getItem(){return _(this,void 0,void 0,(function*(){return""}))},setItem(){return _(this,void 0,void 0,(function*(){}))},removeItem(){return _(this,void 0,void 0,(function*(){}))}})}catch(e){console.error("debug logger storage error",e)}}(),E.humanize=g,E.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),E.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],E.log=(...e)=>{console.debug?console.debug(...e):console.log&&console.log(...e)};const T=E;var S=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const R=function(){return S(this,void 0,void 0,(function*(){return v(T)}))};function O(...e){"undefined"!=typeof localStorage&&localStorage.getItem(b)&&console.error(...e)}const I={_isFakeLogger:!0,log:(...e)=>{},warn:(...e)=>{},error:(...e)=>{},debug:(...e)=>{},info:(...e)=>{},trace:(...e)=>{}};var x;!function(e){e.jsBridge="jsBridge",e.providerBase="providerBase",e.extInjected="extInjected",e.extContentScripts="extContentScripts",e.webview="webview",e.desktopInjected="desktopInjected",e.ethereum="ethereum"}(x||(x={}));class A extends h{constructor(){super(),this.jsBridge=(...e)=>null,this.providerBase=(...e)=>null,this.extInjected=(...e)=>null,this.extContentScripts=(...e)=>null,this.webview=(...e)=>null,this.desktopInjected=(...e)=>null,this.ethereum=(...e)=>null,this._debug={enable(e){}},this._externalLogger=I,this._createExternalLog=e=>(...t)=>{var r,i;return this.once("debugReady",(()=>{var r;null===(r=this[e])||void 0===r||r.call(this,...t)})),null===(i=null===(r=this._externalLogger)||void 0===r?void 0:r.log)||void 0===i?void 0:i.call(r,`${e} >>> `,...t)},this.initExternalLogInstances()}initExternalLogInstances(){Object.keys(x).forEach((e=>{this[e]=this._createExternalLog(e)}))}isDebugReady(){return this._debug&&"function"==typeof this._debug}_attachExternalLogger(e){e&&(this._externalLogger=e)}_createDebugInstance(e){}}new A;const C=new class extends A{constructor(){super(),this._debugInstanceCreatedMap={},R().then((e=>{this._debug=e,this.initDebugInstances(),this.emit("debugReady")}))}initDebugInstances(){this.isDebugReady()&&Object.keys(x).forEach((e=>{this[e]=this._debug(e)}))}_createDebugInstance(e){if(!this._debugInstanceCreatedMap[e]&&(this._debugInstanceCreatedMap[e]=!0,e&&this._debug&&"function"==typeof this._debug)){const t=this._debug(e),r=this[e];this[e]=(...e)=>{t(...e),r&&"function"==typeof r&&r(...e)}}}};var k,M;!function(e){e.RESPONSE="RESPONSE",e.REQUEST="REQUEST"}(k||(k={})),function(e){e.ethereum="ethereum",e.conflux="conflux",e.solana="solana",e.starcoin="starcoin",e.sollet="sollet",e.near="near",e.$private="$private",e.$hardware_sdk="$hardware_sdk"}(M||(M={}));var N=__webpack_require__(6920);class P extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||"string"!=typeof t)throw new Error('"message" must be a nonempty string.');super(t),this.code=e,void 0!==r&&(this.data=r)}serialize(){const e={code:this.code,message:this.message};return void 0!==this.data&&(e.data=this.data),this.stack&&(e.stack=this.stack),e}toString(){return N(this.serialize(),B,2)}}class D extends P{constructor(e,t,r){if(!function(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function B(e,t){if("[Circular]"!==t)return t}const L={invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},q={userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,requestTimeout:4500},j={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Web3 provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4500:{standard:"",message:"The request by this Web3 provider is timeout."}},F=L.internal;U(F);function U(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){const t=e.toString();if(H(j,t))return j[t].message;if(z(e))return"Unspecified server error."}return t}function z(e){return e>=-32099&&e<=-32e3}function H(e,t){return Object.prototype.hasOwnProperty.call(e,t)}const $={userRejectedRequest:e=>G(q.userRejectedRequest,e),unauthorized:e=>G(q.unauthorized,e),unsupportedMethod:e=>G(q.unsupportedMethod,e),disconnected:e=>G(q.disconnected,e),chainDisconnected:e=>G(q.chainDisconnected,e),requestTimeout:e=>G(q.requestTimeout,e),custom:e=>{if(!e||"object"!=typeof e||Array.isArray(e))throw new Error("Web3 Provider custom errors must provide single object argument.");const{code:t,message:r,data:i}=e;if(!r||"string"!=typeof r)throw new Error('"message" must be a nonempty string');return new D(t,r,i)}};function G(e,t){const[r,i]=W(t);return new D(e,r||U(e),i)}function W(e){if(e){if("string"==typeof e)return[e];if("object"==typeof e&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&"string"!=typeof t)throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}const V="0.0.17";var K=function(e,t,r,i){return new(r||(r=Promise))((function(n,s){function o(e){try{d(i.next(e))}catch(e){s(e)}}function a(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}d((i=i.apply(e,t||[])).next())}))};const Y="undefined"!=typeof window?window:global,X="message",Z="error";class J extends h{constructor(e={}){var t,r;super(),this._requestPayloadCache={},this.isExtUi=!1,this.isInjected=!1,this.sendAsString=!0,this.globalOnMessageEnabled=!0,this.providersHub={},this.globalOnMessage=e=>K(this,void 0,void 0,(function*(){try{if(this.config.receiveHandler&&this.globalOnMessageEnabled){const t=yield this.config.receiveHandler(e,this);e.id&&this.response({id:e.id,scope:e.scope,remoteId:e.remoteId,data:t})}}catch(t){e.id&&e.type===k.REQUEST&&this.responseError({id:e.id,scope:e.scope,remoteId:e.remoteId,error:t}),this.emit(Z,t)}})),this.version=V,this.remoteInfo={origin:"",remoteId:""},this.callbacksExpireTimeout=6e5,this.debugLogger=C,this.callbacks=[],this.callbackId=1,this.config=e,this.callbacksExpireTimeout=null!==(t=e.timeout)&&void 0!==t?t:this.callbacksExpireTimeout,this.debugLogger=e.debugLogger||C,this.sendAsString=null!==(r=e.sendAsString)&&void 0!==r?r:this.sendAsString,this.config.receiveHandler&&this.on(X,this.globalOnMessage),this.on(Z,(e=>{var t;O("JsBridge ERROR: ",e,{code:null===(t=e)||void 0===t?void 0:t.code})})),this.rejectExpiredCallbacks()}attachProviderInstance(e){var t;const r=e.providerName;r&&(this.providersHub[r]=null!==(t=this.providersHub[r])&&void 0!==t?t:[],this.providersHub[r].push(e))}createCallbackId(){return this.callbackId+=1,this.callbackId}createPayload(e,{resolve:t,reject:r}){const{id:i,type:n}=e;if(t&&r&&i&&n===k.REQUEST){if(this.callbacks[i])throw new Error(`JsBridge ERROR: callback exists, id=${i}`);this.callbacks[i]={id:i,resolve:t,reject:r,created:Date.now()}}if(e.error){const t=e.error;e.error=function(e){return{name:e.name,message:e.message,stack:e.stack,code:e.code,data:e.data,key:e.key,info:e.info,className:e.className}}(t)}return null==e||delete e.resolve,null==e||delete e.reject,e}send({type:e,data:t,error:r,id:i,remoteId:n,sync:s=!1,scope:o}){const a=(a,d)=>{var u,l,c;let p=i;s||e!==k.REQUEST||(p=this.createCallbackId());try{const i=this.createPayload({id:p,data:t,error:r,type:e,origin:(null===(u=null==Y?void 0:Y.location)||void 0===u?void 0:u.origin)||"",remoteId:n,scope:o},{resolve:a,reject:d});let s=i;this.sendAsString&&(s=JSON.stringify(i)),(null===(l=this.debugLogger.jsBridge)||void 0===l?void 0:l.enabled)&&i&&i.id&&i.type===k.REQUEST&&(this._requestPayloadCache[i.id]=i,i.id%100==0&&(this._requestPayloadCache={})),this.debugLogger.jsBridge("send",i,"\r\n ------\x3e ",i.data,"\r\n ------\x3e ",null===(c=i.data)||void 0===c?void 0:c.result),this.sendPayload(s)}catch(e){p?this.rejectCallback(p,e):this.emit(Z,e)}};if(!s)return new Promise(a);a()}rejectCallback(e,t){this.processCallback({method:"reject",id:e,error:t})}resolveCallback(e,t){this.processCallback({method:"resolve",id:e,data:t})}processCallback({method:e,id:t,data:r,error:i}){const n=this.callbacks[t];n&&("reject"===e&&(n.reject&&n.reject(i),this.emit(Z,i)),"resolve"===e&&n.resolve&&n.resolve(r),this.clearCallbackCache(t))}rejectExpiredCallbacks(){if(!this.callbacksExpireTimeout)return;const e=Date.now();for(const t in this.callbacks){const r=this.callbacks[t];if(r&&r.created&&e-r.created>this.callbacksExpireTimeout){const e=$.requestTimeout();this.rejectCallback(t,e)}}setTimeout((()=>{this.rejectExpiredCallbacks()}),this.callbacksExpireTimeout)}clearCallbackCache(e){delete this.callbacks[e]}receive(e="",t){var r,i,n,s,o;let a={data:null};if(f(e)&&(a=e),y(e))try{a=JSON.parse(e)}catch(p){throw this.emit(Z,p),new Error("JsBridge ERROR: JSON.parse payloadReceived failed")}if(a.origin=null==t?void 0:t.origin,a.internal=Boolean(null==t?void 0:t.internal),(null==t?void 0:t.internal)&&this.isExtUi&&function(e){const t=e;return Boolean(t.name)&&["onekey-provider-eth","onekey-provider-cfx","publicConfig"].includes(t.name)}(a))return;if(!a.origin&&!this.isInjected)throw O(null===(r=null==this?void 0:this.constructor)||void 0===r?void 0:r.name,"[payload.origin] is missing.",this),new Error("JsBridge ERROR: receive message [payload.origin] is required.");if(!a.internal&&!a.scope)throw new Error("JsBridge ERROR: receive message [payload.scope] is required for non-internal method call.");const d=null!==(n=this._requestPayloadCache[null!==(i=null==a?void 0:a.id)&&void 0!==i?i:""])&&void 0!==n?n:null;this.debugLogger.jsBridge("receive",a,{sender:t},"\r\n -----\x3e ",null!==(o=null===(s=a.data)||void 0===s?void 0:s.result)&&void 0!==o?o:a.data,"\r\n <----- ",null==d?void 0:d.data);const{type:u,id:l,data:c,error:p,origin:h,remoteId:g}=a;if(this.remoteInfo={origin:h,remoteId:g},u===k.RESPONSE){if(null==l)throw new Error("JsBridge ERROR: parameter [id] is required in JsBridge.receive() when REQUEST type message");if(this.callbacks[l])try{p?this.rejectCallback(l,p):this.resolveCallback(l,c)}catch(e){this.emit(Z,e)}}else{if(u!==k.REQUEST)throw new Error(`JsBridge ERROR: payload type not support yet (type=${u||"undefined"})`);{const e=Object.assign(Object.assign({},a),{created:Date.now()});this.emit(X,e)}}}requestSync({data:e,scope:t,remoteId:r}){this.send({id:void 0,type:k.REQUEST,scope:t,data:e,remoteId:r,sync:!0})}request(e){const{data:t,remoteId:r,scope:i}=e;return void 0===t&&console.warn("JsBridge ERROR: data required. Call like `bridge.request({ data: {...} });`"),this.send({type:k.REQUEST,data:t,remoteId:r,sync:!1,scope:i})}response({id:e,data:t,remoteId:r,scope:i}){this.send({type:k.RESPONSE,data:t,id:e,remoteId:r,scope:i,sync:!0})}responseError({id:e,error:t,scope:r,remoteId:i}){this.send({type:k.RESPONSE,error:t,id:e,remoteId:i,scope:r,sync:!0})}}__webpack_require__(1049);let Q=!1;class ee extends J{constructor(e){var t;super(e),this.sendAsString=!1,this.isInjected=!0,this.bridgeConfig=e,this.targetOrigin=null!==(t=e.targetOrigin)&&void 0!==t?t:window.location.origin,function(e={}){Q||(Q=!0,window.addEventListener("message",(t=>{var r,i,n;const s=t.data,o=null===(r=e.bridge)||void 0===r?void 0:r.bridgeConfig;if(o&&s.channel===o.channel&&s.frameName===o.remoteFrameName){const t=s.payload,r=null!==(i=e.bridge)&&void 0!==i?i:null===(n=null===window||void 0===window?void 0:window.$onekey)||void 0===n?void 0:n.jsBridge;r&&r.receive(t)}}),!1))}({debugLogger:this.debugLogger,bridge:this,origin:this.targetOrigin})}sendPayload(e){const t={channel:this.bridgeConfig.channel,frameName:this.bridgeConfig.selfFrameName,payload:e,direction:""};this.bridgeConfig.remoteFrame.postMessage(t,this.targetOrigin)}}let te,re;const ie=(0,r.jl)(r.d0.SendMessage),ne=()=>{Q=!1},se=async(e,t=!0)=>{const r=t?re:te;try{"LOG_EVENT"!==e.event&&ie.debug("request: ",e);const t=await(null==r?void 0:r.request({scope:u.scope,data:{...e}}));return"LOG_EVENT"!==e.event&&ie.debug("response: ",t),t}catch(e){throw ie.error(e),i.ERRORS.CreateErrorByMessage(e.message)}},oe=new(t()),ae=(0,r.jl)(r.d0.Connect);let de=(0,r._4)();const ue=async e=>{switch(e.event){case r.rF:if(e.type===r.Bg.INIT_BRIDGE)return o.resolve(),Promise.resolve({success:!0,payload:"JSBridge Handshake Success"});oe.emit(e.event,e),oe.emit(e.type,e.payload);break;case r.og:case r.SI:oe.emit(e.event,e);break;case r.Fd:[r.Td.CONNECT,r.Td.DISCONNECT,r.Td.FEATURES,r.Td.SUPPORT_FEATURES].includes(e.type)&&oe.emit(e.type,e.payload);break;default:ae.log("No need to be captured message",e.event)}},le=()=>{oe.removeAllListeners(),(()=>{if(n&&n.parentNode)try{n.parentNode.removeChild(n)}catch(e){}n=null,a=0})(),de=(0,r._4)(),window.removeEventListener("message",pe)};let ce=null;const pe=e=>{var t,i,o;e.origin===s&&(re&&ce===(null===(t=n)||void 0===t?void 0:t.contentWindow)||(ne(),(e=>{const t=new ee(e);e.isHost?re=t:te=t})({isHost:!0,remoteFrame:null===(i=n)||void 0===i?void 0:i.contentWindow,remoteFrameName:u.iframeName,selfFrameName:u.hostName,channel:u.channel,targetOrigin:s,receiveHandler:async e=>{const t=(0,r.kW)(e);"LOG_EVENT"!==t.event&&ae.debug("Host Bridge Receive message: ",t);const i=await ue(t);return"LOG_EVENT"!==t.event&&ae.debug("Host Bridge response: ",i),i}}),ce=null===(o=n)||void 0===o?void 0:o.contentWindow))},he=async e=>{if(n)throw i.ERRORS.TypedError(i.HardwareErrorCode.IFrameAleradyInitialized);de=(0,r._4)({...de,...e}),(0,r.yI)(!!e.debug),(0,r.hZ)(ue),ae.debug("init"),window.addEventListener("message",pe),window.addEventListener("unload",le);try{return await d({...de,version:"0.2.2-beta-2"}),!0}catch(e){return console.log("init error: ",e),!1}},fe=(0,r.ZP)({eventEmitter:oe,init:he,call:async e=>{if(ae.debug("call : ",e),!n&&!a){de=(0,r._4)(de),ae.debug("Try to recreate iframe if it's initialize failed: ",de);try{if(!await he(de))return ae.debug("Recreate iframe failed"),(0,r.xG)(i.ERRORS.TypedError(i.HardwareErrorCode.IFrameLoadFail));ae.debug("Recreate iframe success")}catch(e){return ae.debug("Recreate iframe failed: ",e),(0,r.xG)(e)}}if(a)return(0,r.xG)(i.ERRORS.TypedError(i.HardwareErrorCode.IFrameLoadFail));try{const t=await se({event:r.Bg.CALL,type:r.Bg.CALL,payload:e});return t||(0,r.xG)(i.ERRORS.TypedError(i.HardwareErrorCode.CallMethodNotResponse))}catch(e){ae.error("__call error: ",e);let t=e;return t instanceof i.HardwareError||(t=i.ERRORS.CreateErrorByMessage(e.message)),(0,r.xG)(t)}},cancel:e=>{se({event:r.Bg.CANCEL,type:r.Bg.CANCEL,payload:{connectId:e}})},dispose:le,uiResponse:e=>{if(!n)throw i.ERRORS.TypedError(i.HardwareErrorCode.IFrameNotInitialized);const{type:t,payload:s}=e;se({event:r.rF,type:t,payload:s})}})})(),__webpack_exports__=__webpack_exports__.default,__webpack_exports__})()));
|