@onekeyfe/hd-web-sdk 0.2.2 → 0.2.4
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.75db335c57cdc1bb866f.js +3 -0
- package/build/js/{iframe.51c8ede48aec304fdfba.js.LICENSE.txt → iframe.75db335c57cdc1bb866f.js.LICENSE.txt} +9 -0
- package/build/js/iframe.75db335c57cdc1bb866f.js.map +1 -0
- package/build/onekey-js-sdk.js +46006 -22070
- 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.51c8ede48aec304fdfba.js +0 -3
- package/build/js/iframe.51c8ede48aec304fdfba.js.map +0 -1
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/*! For license information please see iframe.51c8ede48aec304fdfba.js.LICENSE.txt */
|
|
2
|
-
(()=>{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 u={number:r,bool:i,bytes:n,hash:s,exists:o,output:a};t.default=u},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),u=i?4:0,d=i?0:4;e.setUint32(t+u,o,i),e.setUint32(t+d,a,i)}(r,s-8,BigInt(8*this.length),o),this.process(r,0);const u=(0,n.createView)(e);this.get().forEach(((e,t)=>u.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]}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.fromBig=n,t.split=s,t.toBig=(e,t)=>BigInt(e>>>0)<<i|BigInt(t>>>0),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 u(e,t,r,i,n,s,u,d,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:_}=o(s,c,y,_,r[t+e[E++]])),({a:s,b:c,c:y,d:_}=a(s,c,y,_,r[t+e[E++]])),({a:u,b:p,c:g,d:b}=o(u,p,g,b,r[t+e[E++]])),({a:u,b:p,c:g,d:b}=a(u,p,g,b,r[t+e[E++]])),({a:d,b:h,c:m,d:w}=o(d,h,m,w,r[t+e[E++]])),({a:d,b:h,c:m,d:w}=a(d,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:u,b:h,c:f,d:_}=o(u,h,f,_,r[t+e[E++]])),({a:u,b:h,c:f,d:_}=a(u,h,f,_,r[t+e[E++]])),({a:d,b:l,c:y,d:b}=o(d,l,y,b,r[t+e[E++]])),({a:d,b:l,c:y,d:b}=a(d,l,y,b,r[t+e[E++]]));return{v0:n,v1:s,v2:u,v3:d,v4:l,v5:c,v6:p,v7:h,v8:f,v9:y,v10:g,v11:m,v12:v,v13:_,v14:b,v15:w}}t.IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),t.compress=u;class d 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:d,v1:l,v2:c,v3:p,v4:h,v5:f,v6:y,v7:g,v8:m,v9:v,v10:_,v11:b,v12:w,v13:E,v14:T,v15:S}=u(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^=d^m,this.v1^=l^v,this.v2^=c^_,this.v3^=p^b,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 d(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]),u=new Uint32Array(64);class d 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)u[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=u[e-15],r=u[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;u[e]=s+u[e-7]+i+u[e-16]|0}let{A:r,B:i,C:a,D:d,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]+u[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=d+t|0,d=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,d=d+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,d,l,c,p,h)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}t.sha256=(0,n.wrapConstructor)((()=>new d))},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,u]=[[],[],[]],d=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=d;for(let e=0;e<7;e++)t=(t<<l^(t>>p)*f)%h,t&c&&(n^=l<<(l<<BigInt(e))-l);u.push(n)}const[y,g]=n.default.split(u,!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 _(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],u=v(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=u}let t=e[2],n=e[3];for(let r=0;r<24;r++){const i=a[r],s=m(t,n,i),u=v(t,n,i),d=o[r];t=e[d],n=e[d+1],e[d]=s,e[d+1]=u}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=_;class b 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(){_(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 b(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=b;const w=(e,t,r)=>(0,s.wrapConstructor)((()=>new b(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 b(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);if(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),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")));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.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},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,t,r)=>{"use strict";var i,n=r(6139).Promise,s="object"==typeof Reflect?Reflect:null,o=s&&"function"==typeof s.apply?s.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};i=s&&"function"==typeof s.ownKeys?s.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function u(){u.init.call(this)}e.exports=u,e.exports.once=function(e,t){return new n((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))}v(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&v(e,"error",t,{once:!0})}(e,n)}))},u.EventEmitter=u,u.prototype._events=void 0,u.prototype._eventsCount=0,u.prototype._maxListeners=void 0;var d=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?u.defaultMaxListeners:e._maxListeners}function p(e,t,r,i){var n,s,o,a;if(l(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=c(e))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function h(){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 f(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=h.bind(i);return n.listener=r,i.wrapFn=n,n}function y(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):m(n,n.length)}function g(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 m(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function v(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(u,"defaultMaxListeners",{enumerable:!0,get:function(){return d},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");d=e}}),u.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},u.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(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},u.prototype.getMaxListeners=function(){return c(this)},u.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 a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var u=n[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var d=u.length,l=m(u,d);for(r=0;r<d;++r)o(l[r],this,t)}return!0},u.prototype.addListener=function(e,t){return p(this,e,t,!1)},u.prototype.on=u.prototype.addListener,u.prototype.prependListener=function(e,t){return p(this,e,t,!0)},u.prototype.once=function(e,t){return l(t),this.on(e,f(this,e,t)),this},u.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,f(this,e,t)),this},u.prototype.removeListener=function(e,t){var r,i,n,s,o;if(l(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},u.prototype.off=u.prototype.removeListener,u.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},u.prototype.listeners=function(e){return y(this,e,!0)},u.prototype.rawListeners=function(e){return y(this,e,!1)},u.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):g.call(e,t)},u.prototype.listenerCount=g,u.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]}},6781:(e,t,r)=>{"use strict";var i=r(6139).Promise;e.exports=function(e,t){for(var r=new Array(arguments.length-1),n=0,s=2,o=!0;s<arguments.length;)r[n++]=arguments[s++];return new i((function(i,s){r[n]=function(e){if(o)if(o=!1,e)s(e);else{for(var t=new Array(arguments.length-1),r=0;r<t.length;)t[r++]=arguments[r];i.apply(null,t)}};try{e.apply(t||null,r)}catch(e){o&&(o=!1,s(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,u=0;t<r;){var d=e[t++];switch(u){case 0:o[a++]=i[d>>2],n=(3&d)<<4,u=1;break;case 1:o[a++]=i[n|d>>4],n=(15&d)<<2,u=2;break;case 2:o[a++]=i[n|d>>6],o[a++]=i[63&d],u=0}a>8191&&((s||(s=[])).push(String.fromCharCode.apply(String,o)),a=0)}return u&&(o[a++]=i[n],o[a++]=61,1===u&&(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,u=0;u<e.length;){var d=e.charCodeAt(u++);if(61===d&&a>1)break;if(void 0===(d=n[d]))throw Error(o);switch(a){case 0:i=d,a=1;break;case 1:t[r++]=i<<2|(48&d)>>4,i=d,a=2;break;case 2:t[r++]=(15&i)<<4|(60&d)>>2,i=d,a=3;break;case 3:t[r++]=(3&i)<<6|d,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),u=new Array(o.length),d=0;d<o.length;)a[d]=o[d],u[d]=e[o[d++]];return a[d]=r,Function.apply(null,a).apply(null,u)}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 u=Math.floor(Math.log(i)/Math.LN2);1024===u&&(u=1023),e(4503599627370496*(a=i*Math.pow(2,-u))>>>0,n,s+t),e((o<<31|u+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,u=o>>>20&2047,d=4294967296*(1048575&o)+s;return 2047===u?d?NaN:a*(1/0):0===u?5e-324*a*d:a*Math.pow(2,u-1075)*(d+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(6139).Promise,n=r(3044),s=r(6955),o=r(2233),a=r(8030),u=r(7948),d=r(1875),l=r(842),c=r(8560),p=r(1218),h=r(8047),f=r(738);e.exports=function(e){return new i((function(t,r){var i,y=e.data,g=e.headers,m=e.responseType;function v(){e.cancelToken&&e.cancelToken.unsubscribe(i),e.signal&&e.signal.removeEventListener("abort",i)}n.isFormData(y)&&n.isStandardBrowserEnv()&&delete g["Content-Type"];var _=new XMLHttpRequest;if(e.auth){var b=e.auth.username||"",w=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";g.Authorization="Basic "+btoa(b+":"+w)}var E=u(e.baseURL,e.url);function T(){if(_){var i="getAllResponseHeaders"in _?d(_.getAllResponseHeaders()):null,n={data:m&&"text"!==m&&"json"!==m?_.response:_.responseText,status:_.status,statusText:_.statusText,headers:i,config:e,request:_};s((function(e){t(e),v()}),(function(e){r(e),v()}),n),_=null}}if(_.open(e.method.toUpperCase(),a(E,e.params,e.paramsSerializer),!0),_.timeout=e.timeout,"onloadend"in _?_.onloadend=T:_.onreadystatechange=function(){_&&4===_.readyState&&(0!==_.status||_.responseURL&&0===_.responseURL.indexOf("file:"))&&setTimeout(T)},_.onabort=function(){_&&(r(new p("Request aborted",p.ECONNABORTED,e,_)),_=null)},_.onerror=function(){r(new p("Network Error",p.ERR_NETWORK,e,_,_)),_=null},_.ontimeout=function(){var t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded",i=e.transitional||c;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new p(t,i.clarifyTimeoutError?p.ETIMEDOUT:p.ECONNABORTED,e,_)),_=null},n.isStandardBrowserEnv()){var S=(e.withCredentials||l(E))&&e.xsrfCookieName?o.read(e.xsrfCookieName):void 0;S&&(g[e.xsrfHeaderName]=S)}"setRequestHeader"in _&&n.forEach(g,(function(e,t){void 0===y&&"content-type"===t.toLowerCase()?delete g[t]:_.setRequestHeader(t,e)})),n.isUndefined(e.withCredentials)||(_.withCredentials=!!e.withCredentials),m&&"json"!==m&&(_.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&_.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&_.upload&&_.upload.addEventListener("progress",e.onUploadProgress),(e.cancelToken||e.signal)&&(i=function(e){_&&(r(!e||e&&e.type?new h:e),_.abort(),_=null)},e.cancelToken&&e.cancelToken.subscribe(i),e.signal&&(e.signal.aborted?i():e.signal.addEventListener("abort",i))),y||(y=null);var R=f(E);R&&-1===["http","https","file"].indexOf(R)?r(new p("Unsupported protocol "+R+":",p.ERR_BAD_REQUEST,e)):_.send(y)}))}},5644:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(3044),s=r(3644),o=r(2215),a=r(2937),u=function e(t){var r=new o(t),i=s(o.prototype.request,r);return n.extend(i,o.prototype,r),n.extend(i,r),i.create=function(r){return e(a(t,r))},i}(r(663));u.Axios=o,u.CanceledError=r(8047),u.CancelToken=r(4089),u.isCancel=r(8041),u.VERSION=r(9241).version,u.toFormData=r(9027),u.AxiosError=r(1218),u.Cancel=u.CanceledError,u.all=function(e){return i.all(e)},u.spread=r(783),u.isAxiosError=r(5587),e.exports=u,e.exports.default=u},4089:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(8047);function s(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new i((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,n=new i((function(e){r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e){r.reason||(r.reason=new n(e),t(r.reason))}))}s.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},s.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},s.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},s.source=function(){var e;return{token:new s((function(t){e=t})),cancel:e}},e.exports=s},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(6139).Promise,n=r(3044),s=r(8030),o=r(946),a=r(6895),u=r(2937),d=r(7948),l=r(7525),c=l.validators;function p(e){this.defaults=e,this.interceptors={request:new o,response:new o}}p.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=u(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&&l.assertOptions(r,{silentJSONParsing:c.transitional(c.boolean),forcedJSONParsing:c.transitional(c.boolean),clarifyTimeoutError:c.transitional(c.boolean)},!1);var n=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,d=[];if(this.interceptors.response.forEach((function(e){d.push(e.fulfilled,e.rejected)})),!s){var p=[a,void 0];for(Array.prototype.unshift.apply(p,n),p=p.concat(d),o=i.resolve(t);p.length;)o=o.then(p.shift(),p.shift());return o}for(var h=t;n.length;){var f=n.shift(),y=n.shift();try{h=f(h)}catch(e){y(e);break}}try{o=a(h)}catch(e){return i.reject(e)}for(;d.length;)o=o.then(d.shift(),d.shift());return o},p.prototype.getUri=function(e){e=u(this.defaults,e);var t=d(e.baseURL,e.url);return s(t,e.params,e.paramsSerializer)},n.forEach(["delete","get","head","options"],(function(e){p.prototype[e]=function(t,r){return this.request(u(r||{},{method:e,url:t,data:(r||{}).data}))}})),n.forEach(["post","put","patch"],(function(e){function t(t){return function(r,i,n){return this.request(u(n||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:i}))}}p.prototype[e]=t(),p.prototype[e+"Form"]=t(!0)})),e.exports=p},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,u){var d=Object.create(s);return i.toFlatObject(e,d,(function(e){return e!==Error.prototype})),n.call(d,e.message,t,r,o,a),d.name=e.name,u&&Object.assign(d,u),d},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(6139).Promise,n=r(3044),s=r(8556),o=r(8041),a=r(663),u=r(8047);function d(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new u}e.exports=function(e){return d(e),e.headers=e.headers||{},e.data=s.call(e,e.data,e.headers,e.transformRequest),e.headers=n.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),n.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||a.adapter)(e).then((function(t){return d(e),t.data=s.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return o(t)||(d(e),t&&t.response&&(t.response.data=s.call(e,t.response.data,t.response.headers,e.transformResponse))),i.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 u(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var d={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:u};return i.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=d[e]||s,n=t(e);i.isUndefined(n)&&t!==u||(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(4406),n=r(3044),s=r(8868),o=r(1218),a=r(8560),u=r(9027),d={"Content-Type":"application/x-www-form-urlencoded"};function l(e,t){!n.isUndefined(e)&&n.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var c,p={transitional:a,adapter:(("undefined"!=typeof XMLHttpRequest||void 0!==i&&"[object process]"===Object.prototype.toString.call(i))&&(c=r(353)),c),transformRequest:[function(e,t){if(s(t,"Accept"),s(t,"Content-Type"),n.isFormData(e)||n.isArrayBuffer(e)||n.isBuffer(e)||n.isStream(e)||n.isFile(e)||n.isBlob(e))return e;if(n.isArrayBufferView(e))return e.buffer;if(n.isURLSearchParams(e))return l(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var r,i=n.isObject(e),o=t&&t["Content-Type"];if((r=n.isFileList(e))||i&&"multipart/form-data"===o){var a=this.env&&this.env.FormData;return u(r?{"files[]":e}:e,a&&new a)}return i||"application/json"===o?(l(t,"application/json"),function(e,t,r){if(n.isString(e))try{return(0,JSON.parse)(e),n.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(0,JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||p.transitional,r=t&&t.silentJSONParsing,i=t&&t.forcedJSONParsing,s=!r&&"json"===this.responseType;if(s||i&&n.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(s){if("SyntaxError"===e.name)throw o.from(e,o.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, */*"}}};n.forEach(["delete","get","head"],(function(e){p.headers[e]={}})),n.forEach(["post","put","patch"],(function(e){p.headers[e]=n.merge(d)})),e.exports=p},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(8834).Buffer,n=r(3044);e.exports=function(e,t){t=t||new FormData;var r=[];function s(e){return null===e?"":n.isDate(e)?e.toISOString():n.isArrayBuffer(e)||n.isTypedArray(e)?"function"==typeof Blob?new Blob([e]):i.from(e):e}return function e(i,o){if(n.isPlainObject(i)||n.isArray(i)){if(-1!==r.indexOf(i))throw Error("Circular reference detected in "+o);r.push(i),n.forEach(i,(function(r,i){if(!n.isUndefined(r)){var a,u=o?o+"."+i:i;if(r&&!o&&"object"==typeof r)if(n.endsWith(i,"{}"))r=JSON.stringify(r);else if(n.endsWith(i,"[]")&&(a=n.toArray(r)))return void a.forEach((function(e){!n.isUndefined(e)&&t.append(u,s(e))}));e(r,u)}})),r.pop()}else t.append(o,s(i))}(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 u=e[o],d=void 0===u||a(u,o,e);if(!0!==d)throw new n("option "+o+" must be "+d,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 u(e){return Array.isArray(e)}function d(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 _(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),u(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 b,w=(b="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return b&&e instanceof b});e.exports={isArray:u,isArrayBuffer:l,isBuffer:function(e){return null!==e&&!d(e)&&null!==e.constructor&&!d(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:d,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:_,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):u(r)?t[i]=r.slice():t[i]=r}for(var i=0,n=arguments.length;i<n;i++)_(arguments[i],r);return t},extend:function(e,t,r){return _(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(d(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:w,isFileList:g}},5514:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(8834).Buffer,s=r(7699),o=r(1464),a=r(9644),u=r(6391),d=r(64),l=r(9467),c=r(6053),p=r(1297),h=r(1780),f=r(125);function y(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var g=y(s),m=y(a),v=y(u),_=y(p);function b(e,t,r,n){return new(r||(r=i))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}function w(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=function(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.")}(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new i((function(n,s){!function(e,t,r,n){i.resolve(n).then((function(t){e({value:t,done:r})}),t)}(n,s,(t=e[r](t)).done,t.value)}))}}}var E,T={exports:{}},S="object"==typeof Reflect?Reflect:null,R=S&&"function"==typeof S.apply?S.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};E=S&&"function"==typeof S.ownKeys?S.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var x=Number.isNaN||function(e){return e!=e};function O(){O.init.call(this)}T.exports=O,T.exports.once=function(e,t){return new i((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))}L(e,t,s,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&L(e,"error",t,{once:!0})}(e,n)}))},O.EventEmitter=O,O.prototype._events=void 0,O.prototype._eventsCount=0,O.prototype._maxListeners=void 0;var A=10;function I(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function C(e){return void 0===e._maxListeners?O.defaultMaxListeners:e._maxListeners}function k(e,t,r,i){var n,s,o,a;if(I(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=C(e))>0&&o.length>n&&!o.warned){o.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=o.length,a=u,console&&console.warn&&console.warn(a)}return e}function M(){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 D(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=M.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):B(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 B(e,t){for(var r=new Array(t),i=0;i<t;++i)r[i]=e[i];return r}function L(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 A},set:function(e){if("number"!=typeof e||e<0||x(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");A=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||x(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 C(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)R(a,this,t);else{var u=a.length,d=B(a,u);for(r=0;r<u;++r)R(d[r],this,t)}return!0},O.prototype.addListener=function(e,t){return k(this,e,t,!1)},O.prototype.on=O.prototype.addListener,O.prototype.prependListener=function(e,t){return k(this,e,t,!0)},O.prototype.once=function(e,t){return I(t),this.on(e,D(this,e,t)),this},O.prototype.prependOnceListener=function(e,t){return I(t),this.prependListener(e,D(this,e,t)),this},O.prototype.removeListener=function(e,t){var r,i,n,s,o;if(I(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?E(this._events):[]};const q=2147483648,F=e=>(e|q)>>>0,j=e=>(2147483647&e)>>>0,U=o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Not a valid path"),z=o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Path cannot contain negative values"),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&q?(2147483647&e)+"'":e)).join("/")}`,G=(e,t=0,r=!1)=>{let i;if(i="string"==typeof e?(e=>{const t=e.toLowerCase().split("/");if("m"!==t[0])throw U;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 U;if(r<0)throw z;return t&&(r=F(r)),r}))})(e):Array.isArray(e)?e.map((e=>{const t=parseInt(e);if(Number.isNaN(t))throw U;if(t<0)throw z;return t})):void 0,!i)throw U;if(t>0&&i.length<t)throw U;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=>{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:""},K=e=>{const t=W(e);return"string"==typeof e.label?e.label:`My OneKey ${t.charAt(0).toUpperCase()+t.slice(1)}`},Y=e=>e?e.onekey_version?e.onekey_version.split("."):[e.major_version,e.minor_version,e.patch_version]:[0,0,0],X=e=>e.ble_ver&&g.default.valid(e.ble_ver)?e.ble_ver.split("."):null,Z=e=>{if(!e)return{support:!1};if("touch"===W(e))return{support:!1};const t=Y(e).join(".");return{support:g.default.gte(t,"2.3.0"),require:"2.3.0"}},J=(e,t)=>b(void 0,void 0,void 0,(function*(){if(!e)return!1;const{message:r}=yield t.typedCall("GetAddress","Address",{address_n:[F(44),F(1),F(0),0,0],coin_name:"Testnet",script_type:"SPENDADDRESS",show_display:!1});return r.address}));const Q=(e,t)=>((e,t="text")=>b(void 0,void 0,void 0,(function*(){const r=yield m.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);new RegExp(/^[0-9]{1,3}(\.[0-9]{1,3}){0,2}$/);const ee="log-output";let te;class re{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),se(this.prefix,...e),this.enabled&&console.log(this.prefix,...e)}error(...e){this.addMessage("error",this.prefix,...e),se(this.prefix,...e),this.enabled&&console.error(this.prefix,...e)}warn(...e){this.addMessage("warn",this.prefix,...e),se(this.prefix,...e),this.enabled&&console.warn(this.prefix,...e)}debug(...e){this.addMessage("debug",this.prefix,...e),se(this.prefix,...e),this.enabled&&console.log(this.prefix,...e)}}const ie={},ne=(e,t)=>{const r=new re(e,!!t);return ie[e]=r,r},se=(e,...t)=>{var r,i;null==te||te((r=ee,i=((...e)=>e.map((e=>"string"==typeof e||"number"==typeof e||"boolean"==typeof e||void 0===e?e:"object"==typeof e?JSON.stringify(e,(()=>{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),{event:"LOG_EVENT",type:r,payload:i}))};var oe;t.d0=void 0,(oe=t.d0||(t.d0={})).Core="Core",oe.Transport="Transport",oe.Device="Device",oe.DeviceCommands="DeviceCommands",oe.DeviceConnector="DeviceConnector",oe.DeviceList="DeviceList",oe.DevicePool="DevicePool",oe.HdCommonConnectSdk="@onekey/common-connect-sdk",oe.HdBleSdk="@onekey/hd-ble-sdk",oe.HdTransportHttp="@onekey/hd-transport-http",oe.HdBleTransport="@onekey/hd-ble-transport",oe.Connect="@onekey/connect",oe.Iframe="IFrame",oe.SendMessage="[SendMessage]",oe.Method="[Method]";const ae={[t.d0.Core]:ne(t.d0.Core),[t.d0.Transport]:ne(t.d0.Transport),[t.d0.Device]:ne(t.d0.Device),[t.d0.DeviceCommands]:ne(t.d0.DeviceCommands),[t.d0.DeviceConnector]:ne(t.d0.DeviceConnector),[t.d0.DeviceList]:ne(t.d0.DeviceList),[t.d0.DevicePool]:ne(t.d0.DevicePool),[t.d0.HdBleSdk]:ne(t.d0.HdBleSdk),[t.d0.HdTransportHttp]:ne(t.d0.HdTransportHttp),[t.d0.HdBleTransport]:ne(t.d0.HdBleTransport),[t.d0.Connect]:ne(t.d0.Connect),[t.d0.Iframe]:ne(t.d0.Iframe),[t.d0.SendMessage]:ne(t.d0.SendMessage),[t.d0.Method]:ne(t.d0.Method),[t.d0.HdCommonConnectSdk]:ne(t.d0.Method)},ue=e=>ae[e],de=e=>new i((t=>{setTimeout(t,e)})),le=(e,t)=>{const r=e.filter((e=>g.default.gt(e.version.join("."),t)));return 0===r.length?"valid":r.some((e=>e.required))?"required":"outdated"},ce=(e,t)=>e.filter((e=>g.default.gt(e.version.join("."),t))).map((e=>e.changelog)),pe=e=>{let t=e[0];return e.forEach((e=>{g.default.gt(e.version.join("."),t.version.join("."))&&(t=e)})),t};var he;class fe{static load(e){return b(this,void 0,void 0,(function*(){this.settings=e;try{const{data:e}=yield m.default.get(`https://data.onekey.so/config.json?noCache=${(new Date).getTime()}`);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}}he=fe,fe.deviceMap={classic:{firmware:[],ble:[]},mini:{firmware:[],ble:[]},touch:{firmware:[],ble:[]},pro:{firmware:[],ble:[]}},fe.assets=null,fe.messages={default:{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}}}}}}}}}}}},fe.getFirmwareStatus=e=>{var t,r;const i=W(e),n=Y(e);if(!1===e.firmware_present)return"none";if("classic"===i&&e.bootloader_mode)return"unknown";const s=null!==(r=null===(t=he.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],o=n.join(".");return le(s,o)},fe.getSysResourcesLatestRelease=(e,t)=>{var r,i,n;const s=W(e),o=Y(e);if("pro"!==s&&"touch"!==s)return;const a=null!==(i=null===(r=he.deviceMap[s])||void 0===r?void 0:r.firmware)&&void 0!==i?i:[],u=o.join("."),d=a.filter((e=>(t||g.default.gt(e.version.join("."),u))&&!!e.resource));return null===(n=pe(d))||void 0===n?void 0:n.resource},fe.getSysFullResource=e=>{var t,r,i;const n=W(e);if("pro"!==n&&"touch"!==n)return;const s=(null!==(r=null===(t=he.deviceMap[n])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[]).filter((e=>!!e.fullResource));return null===(i=pe(s))||void 0===i?void 0:i.fullResource},fe.getFirmwareChangelog=e=>{var t,r;const i=W(e),n=Y(e);if(!1===e.firmware_present||"classic"===i&&e.bootloader_mode)return[];const s=null!==(r=null===(t=he.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],o=n.join(".");return ce(s,o)},fe.getFirmwareLatestRelease=e=>{var t,r;const i=W(e),n=null!==(r=null===(t=he.deviceMap[i])||void 0===t?void 0:t.firmware)&&void 0!==r?r:[],s=pe(n);if(!s)return s;if(!s.resource){const t=he.getSysResourcesLatestRelease(e);return Object.assign(Object.assign({},s),{resource:t})}return s},fe.getBLEFirmwareStatus=e=>{var t,r;const i=W(e),n=X(e);if(!n)return"none";const s=null!==(r=null===(t=he.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[],o=n.join(".");return le(s,o)},fe.getBleFirmwareChangelog=e=>{var t,r;const i=W(e),n=X(e);if(!n)return[];const s=null!==(r=null===(t=he.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[],o=n.join(".");return ce(s,o)},fe.getBleFirmwareLatestRelease=e=>{var t,r;const i=W(e),n=null!==(r=null===(t=he.deviceMap[i])||void 0===t?void 0:t.ble)&&void 0!==r?r:[];return pe(n)},fe.getTransportStatus=e=>{var t,r;const i=null===(r=null===(t=he.assets)||void 0===t?void 0:t.bridge)||void 0===r?void 0:r.version;return i?g.default.gte(e,i.join("."))?"valid":"outdated":"valid"};const ye="CORE_EVENT",ge="UI_EVENT",me="ui-request_pin",ve="ui-button",_e="ui-request_passphrase",be="ui-request_passphrase_on_device",we="ui-close_window",Ee="ui-bluetooth_permission",Te="ui-location_permission",Se="ui-location_service_permission",Re="ui-firmware-progress",xe="ui-firmware-tip",Oe="ui-device_not_in_bootloader_mode",Ae=(e,t)=>({event:ge,type:e,payload:t}),Ie={INIT:"iframe-init",INIT_BRIDGE:"iframe-init-bridge",CALL:"iframe-call",CANCEL:"iframe-cancel"},Ce="RESPONSE_EVENT",ke=(e,t,r)=>({event:Ce,type:Ce,id:e,success:t,payload:t?r:o.serializeError(r)}),Me="ui-receive_pin",De="ui-receive_passphrase",Ne="device-connect",Pe="device-disconnect",Be="button",Le="pin",qe="passphrase",Fe="passphrase_on_device",je="support_features",Ue="features",ze=(e,t)=>({event:"DEVICE_EVENT",type:e,payload:t}),He="firmware-release-info",$e="ble-firmware-release-info",Ge=(e,t)=>({event:"FIRMWARE_EVENT",type:e,payload:t}),We=ue(t.d0.DevicePool);class Ve extends T.exports{static setConnector(e){this.connector=e}static getDevices(e,t,r){var i,n,s,o;return b(this,void 0,void 0,(function*(){We.debug("get device list: connectId: ",t);const a={},u=[];if(t){const i=this.devicesCache[t];if(i){const n=e.find((e=>e.path===i.originalDescriptor.path));if(n)return We.debug("find existed Device: ",t),i.updateDescriptor(n,!0),a[t]=i,u.push(i),yield this._checkDevicePool(r),{devices:a,deviceList:u};We.debug("found device in cache, but path is different: ",t)}}try{for(i=w(e);!(n=yield i.next()).done;){const e=n.value,t=yield this._createDevice(e,r);if(t.features){const r=V(t.features);this.devicesCache[r]&&this.devicesCache[r].updateDescriptor(e,!0),this.devicesCache[r]=t,a[r]=t}u.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:u}}))}static clearDeviceCache(e){We.debug("clear device pool cache: connectId",e),We.debug("clear device pool cache: ",this.devicesCache),e&&delete this.devicesCache[e]}static _createDevice(e,t){return b(this,void 0,void 0,(function*(){let r=this.getDeviceByPath(e.path);return r||(r=ut.fromDescriptor(e),r.deviceConnector=this.connector,yield r.connect(),yield r.initialize(t),yield r.release()),r}))}static _checkDevicePool(e){return b(this,void 0,void 0,(function*(){yield this._sendConnectMessage(e),this._sendDisconnectMessage()}))}static _sendConnectMessage(e){return b(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);We.debug("emit DEVICE.CONNECT: ",i),this.emitter.emit(Ne,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(Pe,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})),u=n.filter((e=>"string"==typeof e.debugSession)),d=n.filter((e=>"string"!=typeof e.debugSession));return{connected:r,disconnected:i,changedSessions:n,acquired:s,released:o,changedDebugSessions:a,debugAcquired:u,debugReleased:d,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?(We.debug("emit DEVICE.CONNECT: ",t),this.emitter.emit(Ne,t)):this._addConnectedDeviceToPool(e)})),t.disconnected.forEach((e=>{this._removeDeviceFromConnectedPool(e.path);const t=this.getDeviceByPath(e.path);t?(We.debug("emit DEVICE.DISCONNECT: ",t),this.emitter.emit(Pe,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)}}Ve.current=null,Ve.upcoming=[],Ve.connectedPool=[],Ve.disconnectPool=[],Ve.devicesCache={},Ve.emitter=new T.exports;const Ke=ue(t.d0.Transport),Ye=ue(t.d0.HdBleTransport),Xe=ue(t.d0.HdTransportHttp);class Ze{static load(){Ke.debug("transport manager load"),this.defaultMessages=fe.getProtobufMessages(),this.currentMessages=this.defaultMessages}static configure(){return b(this,void 0,void 0,(function*(){try{const e=fe.getSettings("env");Ke.debug("Initializing transports"),"react-native"===e?this.reactNativeInit?Ke.debug("React Native Do Not Initializing transports"):(yield this.transport.init(Ye,Ve.emitter),this.reactNativeInit=!0):yield this.transport.init(Xe),Ke.debug("Configuring transports"),yield this.transport.configure(JSON.stringify(this.defaultMessages)),Ke.debug("Configuring transports done")}catch(e){if(Ke.debug("Initializing transports error: ",e),"ECONNABORTED"===e.code)throw o.ERRORS.TypedError(o.HardwareErrorCode.BridgeTimeoutError)}}))}static reconfigure(e){return b(this,void 0,void 0,(function*(){if(Array.isArray(e)&&(e=fe.getProtobufMessages()),this.currentMessages!==e&&e)try{yield this.transport.configure(JSON.stringify(e)),this.currentMessages=e}catch(e){throw o.ERRORS.TypedError(o.HardwareErrorCode.TransportInvalidProtobuf,`Transport_InvalidProtobuf: ${e.message}`)}}))}static setTransport(e){const t=fe.getSettings("env");this.transport="react-native"===t?new e({scanTimeout:3e3}):new e,Ke.debug("set transport: ",this.transport)}static getTransport(){return this.transport}static getDefaultMessages(){return this.defaultMessages}static getCurrentMessages(){return this.currentMessages}}Ze.reactNativeInit=!1;const Je=ue(t.d0.DeviceCommands);class Qe{constructor(e,t){this.device=e,this.mainId=t,this.transport=Ze.getTransport(),this.disposed=!1}dispose(e){var t,r;return b(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 b(this,void 0,void 0,(function*(){Je.debug("[DeviceCommands] [call] Sending",e);try{const r=this.transport.call(this.mainId,e,t);this.callPromise=r;const i=yield r;return Je.debug("[DeviceCommands] [call] Received",i.type),i}catch(e){if(Je.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 b(this,void 0,void 0,(function*(){if(this.disposed)throw o.ERRORS.TypedError(o.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 o.ERRORS.TypedError(o.HardwareErrorCode.ResponseUnexpectTypeError,`assertType: Response of unexpected type: ${e.type}. Should be ${t}`)})(i,t)}catch(e){if(Je.debug("DeviceCommands typedcall error: ",e),!(e instanceof o.HardwareError))throw e;if(e.errorCode===o.HardwareErrorCode.ResponseUnexpectTypeError&&e.message.indexOf("BridgeNetworkError")>-1)throw o.ERRORS.TypedError(o.HardwareErrorCode.BridgeNetworkError)}return i}))}_commonCall(e,t){return b(this,void 0,void 0,(function*(){const r=yield this.call(e,t);return this._filterCommonTypes(r,e)}))}_filterCommonTypes(e,t){try{"react-native"===fe.getSettings("env")?Je.debug("_filterCommonTypes: ",JSON.stringify(e)):Je.debug("_filterCommonTypes: ",e)}catch(e){}if("Failure"===e.type){const{code:r,message:n}=e.message;let s=null;return"Failure_FirmwareError"!==r||n||(s=o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareError)),"Failure_ActionCancelled"===r&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.ActionCancelled)),"Failure_PinInvalid"===r&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.PinInvalid,n)),"Failure_PinCancelled"===r&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.PinCancelled)),"Failure_DataError"===r&&"Please confirm the BlindSign enabled"===n&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.BlindSignDisabled)),"Failure_UnexpectedMessage"===r&&"PassphraseAck"===t&&(s=o.ERRORS.TypedError(o.HardwareErrorCode.UnexpectPassphrase)),s?i.reject(s):i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`${r||"Failure_UnknownCode"},${n||"Failure_UnknownMessage"}`))}if("Features"===e.type)return i.resolve(("Features"!==(r=e).type||r.message.major_version<1&&(r.message.major_version=1),r));var r;if("ButtonRequest"===e.type)return"ButtonRequest_PassphraseEntry"===e.message.code?this.device.emit(Fe,this.device):this.device.emit(Be,this.device,e.message),this._commonCall("ButtonAck",{});e.type;const n="webusb"===fe.getSettings("env");return"PinMatrixRequest"===e.type?n?i.reject(o.ERRORS.TypedError(o.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,i.resolve(e))}_promptPin(e){return new i(((t,r)=>{this.device.listenerCount(Le)>0?(this._cancelableRequest=r,this.device.emit(Le,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(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"_promptPin: PIN callback not configured")))}))}_promptPassphrase(){return new i(((e,t)=>{this.device.listenerCount(qe)>0?(this._cancelableRequest=t,this.device.emit(qe,this.device,((r,i)=>{this._cancelableRequest=void 0,i?t(i):e(r)}))):(Je.error("[DeviceCommands] [call] Passphrase callback not configured, cancelling request"),t(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"_promptPassphrase: Passphrase callback not configured")))}))}}const et="ui-device_bootloader_mode",tt="ui-device_not_initialized",rt="ui-device_seedless",it="ui-firmware-tip",nt=`https://jssdk.onekey.so/${r(2391).version}/`,st={configSrc:"./data/config.json",version:"",debug:!1,priority:2,trustedHost:!1,connectSrc:nt,iframeSrc:`${nt}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()},ot=ue(t.d0.Device),at={};class ut extends T.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 ut(t)}toMessageObject(){return this.isUnacquired()||!this.features?null:{connectId:"react-native"===fe.getSettings("env")?this.mainId||null:V(this.features),uuid:V(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:K(this.features),mode:this.getMode(),features:this.features,firmwareVersion:this.getFirmwareVersion(),bleFirmwareVersion:this.getBLEFirmwareVersion(),unavailableCapabilities:this.unavailableCapabilities};var e}connect(){const e=fe.getSettings("env");return new i((t=>b(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 b(this,void 0,void 0,(function*(){const n=fe.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:"",ot.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),ot.debug("Expected session id:",this.mainId);this.updateDescriptor({[s]:this.mainId}),this.commands&&(yield this.commands.dispose(!1)),this.commands=new Qe(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 b(this,void 0,void 0,(function*(){const t=fe.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){ot.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;ot.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}`),ot.debug("getInternalState session cache: ",at);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 at[n]}tryFixInternalState(e,t){ot.debug("tryFixInternalState session param: ",`device_id: ${t}`,`passphraseState: ${e}`);const r=`${t}`,i=at[r];i&&(at[this.generateStateKey(t,e)]=i,delete at[r]),ot.debug("tryFixInternalState session cache: ",at)}setInternalState(e,t){var r,i;if(ot.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&&(at[s]=e),ot.debug("setInternalState done session cache: ",at)}clearInternalState(e){var t;ot.debug("clearInternalState param: ",e);const r=e||(null===(t=this.features)||void 0===t?void 0:t.device_id);if(r&&(delete at[`${r}`],this.passphraseState)){const e=this.generateStateKey(r,this.passphraseState);delete at[e]}}initialize(e){return b(this,void 0,void 0,(function*(){ot.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),ot.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 b(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(Ue,this,e)}updateDescriptor(e,t=!1){if("react-native"===fe.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 b(this,void 0,void 0,(function*(){return this.runPromise&&(yield this.interruptionFromOutside(),ot.debug("[Device] run error:","Device is running, but will cancel previous operate")),t=(e=>(e||(e={}),e))(t),this.runPromise=o.createDeferred(this._runInner.bind(this,e,t)),this.runPromise.promise}))}_runInner(e,t){return b(this,void 0,void 0,(function*(){if((!this.isUsedHere()||this.commands.disposed)&&"react-native"!==fe.getSettings("env")){yield this.acquire();try{e&&(yield this.initialize(t))}catch(e){return this.runPromise=null,e instanceof o.HardwareError?i.reject(e):i.reject(o.ERRORS.TypedError(o.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(),ot.debug("release device, mainId: ",this.mainId)),this.runPromise&&this.runPromise.resolve(),this.runPromise=null}))}interruptionFromOutside(){return b(this,void 0,void 0,(function*(){this.commands&&(yield this.commands.dispose(!1)),this.runPromise&&this.runPromise.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceInterruptedFromOutside))}))}interruptionFromUser(){return b(this,void 0,void 0,(function*(){this.commands&&(yield this.commands.dispose(!0)),this.runPromise&&this.runPromise.reject(o.ERRORS.TypedError(o.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?Y(this.features):null}getBLEFirmwareVersion(){return this.features?X(this.features):null}isUsed(){return"string"==typeof this.originalDescriptor.session}isUsedHere(){return"react-native"!==fe.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(et))return et;if(!this.isInitialized()&&!e.includes(tt))return tt;if(this.isSeedless()&&!e.includes(rt))return rt;if(!this.isBootloader()&&t.includes(et))return"ui-device_not_in_bootloader_mode"}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 b(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 J(this.features,this.commands);return r&&t&&(yield this.getFeatures()),this.passphraseState&&this.passphraseState!==i?(this.clearInternalState(),i):void 0}))}}class dt extends T.exports{constructor(){super(...arguments),this.devices={}}getDeviceLists(e,t){var r,i;return b(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 Ve.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 lt=e=>({status:fe.getFirmwareStatus(e),changelog:fe.getFirmwareChangelog(e),release:fe.getFirmwareLatestRelease(e)}),ct=e=>({status:fe.getBLEFirmwareStatus(e),changelog:fe.getBleFirmwareChangelog(e),release:fe.getBleFirmwareLatestRelease(e)}),pt=ue(t.d0.Method);class ht{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=lt(this.device.features);this.postMessage(Ge(He,Object.assign(Object.assign({},e),{features:this.device.features})));const t=ct(this.device.features);this.postMessage(Ge($e,Object.assign(Object.assign({},t),{features:this.device.features})))}checkDeviceSupportFeature(){if(!this.device||!this.device.features)return;const e=Z(this.device.features);this.postMessage(ze(je,{inputPinOnSoftware:e,device:this.device.toMessageObject()}))}checkSafetyLevelOnTestNet(){var e,t,r;return b(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)&&(pt.debug("will change safety_checks level"),yield this.device.commands.typedCall("ApplySettings","Success",{safety_checks:"PromptTemporarily"}))}))}dispose(){}}const ft=e=>"0x"===e.slice(0,2).toLowerCase(),yt=e=>ft(e)?e.slice(2):e,gt=e=>{for(;/^00/.test(e);)e=e.slice(2);return e},mt=e=>{if("string"==typeof e){let t=yt(e);return t.length%2!=0&&(t=`0${t}`),t}return Array.isArray(e)?e.map(mt):"object"==typeof e?(t=e,r=e=>mt(e),Object.fromEntries(Object.entries(t).map((([e,t])=>[e,r(t)])))):e;var t,r},vt=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function _t(e){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=vt[e[r]];return t}function bt(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 wt=e=>o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,e),Et=(e,t)=>{t.forEach((t=>{if(!Object.prototype.hasOwnProperty.call(e,t.name)&&t.required)throw wt(`Missing required parameter: ${t.name}`);const r=e[t.name];if(r&&t.type)switch(t.type){case"array":if(!Array.isArray(r))throw wt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`);if(!t.allowEmpty&&r.length<1)throw wt(`Parameter "${t.name}" is empty.`);break;case"bigNumber":if("string"!=typeof r)throw wt(`Parameter [${t.name}] is of type invalid and should be [string].`);try{if(new v.default(r).toFixed(0)!==r)throw new Error("")}catch(e){throw wt(`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 wt(`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]*$/)))((i=r,ft(i)?i:`0x${i}`)))throw wt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`);break;default:if(typeof r!==t.type)throw wt(`Parameter [${t.name}] is of type invalid and should be [${t.type}].`)}var i}))},Tt=({features:e,updateType:t,version:r})=>b(void 0,void 0,void 0,(function*(){const i=Rt({features:e,updateType:t});if(!i)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"no firmware found for this device");if(r&&!g.default.eq(i.version.join("."),r.join(".")))throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"firmware version mismatch");const n="ble"===t?i.webUpdate:i.url;let s;try{s=yield Q(n,"binary")}catch(e){throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Method_FirmwareUpdate_DownloadFailed")}return Object.assign(Object.assign({},i),{binary:s})})),St=e=>b(void 0,void 0,void 0,(function*(){let t;try{t=yield Q(e,"binary")}catch(e){throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Method_FirmwareUpdate_DownloadFailed")}return{binary:t}})),Rt=({features:e,updateType:t})=>{var r,i;const n=W(e),{deviceMap:s}=fe,o=null!==(i=null===(r=null==s?void 0:s[n])||void 0===r?void 0:r[t])&&void 0!==i?i:[];return pe(o)};ue(t.d0.Device);const xt=e=>{var t;(null===(t=e.features)||void 0===t?void 0:t.firmware_present)&&e.emit(Be,e,{code:"ButtonRequest_FirmwareUpdate"})},Ot=(e,t,r)=>{r(Ae(Re,{device:e.toMessageObject(),progress:t}))},At=(e,t,r)=>{r(Ae(xe,{device:e.toMessageObject(),data:{message:t}}))},It=e=>b(void 0,void 0,void 0,(function*(){"ble"===e&&(yield de(1e4))})),Ct=(e,t,r,i,{payload:n})=>b(void 0,void 0,void 0,(function*(){var s,a;if(1===(null===(s=i.features)||void 0===s?void 0:s.major_version)){xt(i),At(i,"ConfirmOnDevice",r);const s="firmware"===e?"FirmwareErase":"FirmwareErase_ex";yield t(s,"Success",{}),At(i,"FirmwareEraseSuccess",r),Ot(i,0,r);const{message:o}=yield t("FirmwareUpload","Success",{payload:n});return Ot(i,100,r),yield It(e),o}if(2===(null===(a=i.features)||void 0===a?void 0:a.major_version)){xt(i),At(i,"ConfirmOnDevice",r);const s=n.byteLength;let o=yield t("FirmwareErase",["FirmwareRequest","Success"],{length:s});for(At(i,"FirmwareEraseSuccess",r);"Success"!==o.type;){const e=o.message.offset,a=o.message.offset+o.message.length,u=n.slice(e,a);e>0&&Ot(i,Math.round(e/s*100),r),o=yield t("FirmwareUpload",["FirmwareRequest","Success"],{payload:u})}return Ot(i,100,r),yield It(e),o.message}throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"uploadFirmware: unknown major_version")})),kt=(e,t,r)=>b(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=l.blake2s(s),a={data_chunk:_t(s),hash:_t(o)},u=yield e("ResourceAck",["ResourceRequest","Success"],Object.assign({},a));return kt(e,u,r)})),Mt=(e,t,r)=>b(void 0,void 0,void 0,(function*(){const i=new Uint8Array(r.slice(0,Math.min(16384,r.byteLength))),n=l.blake2s(i),s=yield e("ResourceUpdate",["ResourceRequest","Success"],{file_name:t,data_length:r.byteLength,initial_data_chunk:_t(i),hash:_t(n)});return kt(e,s,r)})),Dt=(e,t,r,i)=>b(void 0,void 0,void 0,(function*(){At(r,"UpdateSysResource",t);const n=yield _.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 Mt(e,s,t)}o+=a,Ot(r,Math.floor(o),t)}return Ot(r,100,t),At(r,"UpdateSysResourceSuccess",t),!0})),Nt=ue(t.d0.Method),Pt=ue(t.d0.Method);var Bt=[{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 Lt=(e,t)=>{let r;if(t){const e=t.toLowerCase();r=Bt.find((t=>t.name.toLowerCase()===e||t.label.toLowerCase()===e))}else if(e){const t=j(e[1]);r=Bt.find((e=>e.slip44===t))}if(!r)throw t?o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,`Invalid coin name: ${t}`):e?o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,`Invalid path: ${e[0]}`):o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter);return r},qt=e=>b(void 0,void 0,void 0,(function*(){const{typedCall:t,txRequest:r,refTxs:n,inputs:s,outputs:a,serializedTx:u,signatures:d}=e;if(((e,t,r)=>{if(!r)return;const{signature_index:i,signature:n,serialized_tx:s}=r;if(s&&e.push(s),"number"==typeof i){if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.");t[i]=n}})(u,d,r.serialized),"TXFINISHED"===r.request_type)return i.resolve({signatures:d,serializedTx:u.join("")});const{message:l}=yield(e=>{const{tx_hash:t}=e.txRequest.details;return t?(({typedCall:e,txRequest:{request_type:t,details:r},refTxs:i})=>{const{tx_hash:n}=r;if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: unknown details.tx_hash");const s=i[n.toLowerCase()];if(!s)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown tx: ${n}`);if("TXINPUT"===t){if(!s.bin_outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXINPUT: ${n}`);return e("TxAckPrevInput","TxRequest",{tx:{input:s.inputs[r.request_index]}})}if("TXOUTPUT"===t){if(!s.bin_outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXOUTPUT: ${n}`);return e("TxAckPrevOutput","TxRequest",{tx:{output:s.bin_outputs[r.request_index]}})}if("TXORIGINPUT"===t){if(!s.outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXORIGINPUT: ${n}`);return e("TxAckInput","TxRequest",{tx:{input:s.inputs[r.request_index]}})}if("TXORIGOUTPUT"===t){if(!s.outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown TXORIGOUTPUT: ${n}`);return e("TxAckOutput","TxRequest",{tx:{output:s.outputs[r.request_index]}})}if("TXEXTRADATA"===t){if("number"!=typeof r.extra_data_len)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_len");if("number"!=typeof r.extra_data_offset)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_offset");if("string"!=typeof s.extra_data)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: No extra data for transaction ${s.hash}`);const t=s.extra_data,i=r.extra_data_len,n=r.extra_data_offset;return e("TxAckPrevExtraData","TxRequest",{tx:{extra_data_chunk:t.substring(2*n,2*(n+i))}})}if("TXMETA"===t){const t=s.extra_data;return e("TxAckPrevMeta","TxRequest",{tx:{version:s.version,lock_time:s.lock_time,inputs_count:s.inputs.length,outputs_count:s.outputs?s.outputs.length:s.bin_outputs.length,timestamp:s.timestamp,version_group_id:s.version_group_id,expiry:s.expiry,branch_id:s.branch_id,extra_data_len:t?t.length/2:void 0}})}throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Unknown request type: ${t}`)})(e):(({typedCall:e,txRequest:{request_type:t,details:r},inputs:i,outputs:n})=>{if("TXINPUT"===t)return e("TxAckInput","TxRequest",{tx:{input:i[r.request_index]}});if("TXOUTPUT"===t)return e("TxAckOutput","TxRequest",{tx:{output:n[r.request_index]}});if("TXMETA"===t)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXMETA from signed transaction");if("TXEXTRADATA"===t)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction");throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestSignedTxInfo: Unknown request type: ${t}`)})(e)})(e);return qt({typedCall:t,txRequest:l,refTxs:n,inputs:s,outputs:a,serializedTx:u,signatures:d})}));var Ft=(e,t,r,i,n,s)=>b(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 qt({typedCall:e,txRequest:a,refTxs:o,inputs:t,outputs:r,serializedTx:[],signatures:[]})}));const jt=e=>b(void 0,void 0,void 0,(function*(){const{typedCall:t,txRequest:r,refTxs:n,inputs:s,outputs:a,serializedTx:u,signatures:d}=e;if(((e,t,r)=>{if(!r)return;const{signature_index:i,signature:n,serialized_tx:s}=r;if(s&&e.push(s),"number"==typeof i){if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"saveTxSignatures: Unexpected null in trezor:TxRequestSerialized signature.");t[i]=n}})(u,d,r.serialized),"TXFINISHED"===r.request_type)return i.resolve({signatures:d,serializedTx:u.join("")});const l=(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 o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: unknown details.tx_hash");const n=r[i.toLowerCase()];if(!n)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: Requested unknown tx: ${i}`);if(!n.bin_outputs)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: bin_outputs not set tx: ${i}`);if("TXINPUT"===e)return{inputs:[n.inputs[t.request_index]]};if("TXOUTPUT"===e)return{bin_outputs:[n.bin_outputs[t.request_index]]};if("TXEXTRADATA"===e){if("number"!=typeof t.extra_data_len)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_len");if("number"!=typeof t.extra_data_offset)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestPrevTxInfo: Missing extra_data_offset");if("string"!=typeof n.extra_data)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestPrevTxInfo: No extra data for transaction ${n.hash}`);const e=n.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=n.extra_data,t={version:n.version,lock_time:n.lock_time,inputs_cnt:n.inputs.length,outputs_cnt:n.bin_outputs.length,timestamp:n.timestamp,version_group_id:n.version_group_id,expiry:n.expiry,branch_id:n.branch_id};return"string"==typeof e&&0!==e.length?Object.assign(Object.assign({},t),{extra_data_len:e.length/2}):t}throw o.ERRORS.TypedError(o.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 o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXMETA from signed transaction");if("TXEXTRADATA"===e)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"requestSignedTxInfo: Cannot read TXEXTRADATA from signed transaction");throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`requestSignedTxInfo: Unknown request type: ${e}`)})(e)})(e),{message:c}=yield t("TxAck","TxRequest",{tx:l});return jt({typedCall:t,txRequest:c,refTxs:n,inputs:s,outputs:a,serializedTx:u,signatures:d})}));var Ut=(e,t,r,i,n,s)=>b(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 jt({typedCall:e,txRequest:a,refTxs:o,inputs:t,outputs:r,serializedTx:[],signatures:[]})}));const zt=(e,t)=>e?[e.slice(0,t),e.slice(t)]:["",""],Ht=new RegExp(/^(.*)\[([0-9]*)\]$/),$t=new RegExp(/^bytes([0-9]*)$/),Gt=new RegExp(/^(u?int)([0-9]*)$/),Wt=e=>{const t=Ht.exec(e);if(null===t)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`typename ${e} could not be parsed as an EIP-712 array`);const[r,i,n]=t;return{entryTypeName:i,arraySize:parseInt(n,10)||null}},Vt=(e,t)=>{if($t.test(e)||"address"===e)return mt(t);if("string"===e)return n.from(t,"utf-8").toString("hex");const r=Gt.exec(e);if(r){const[e,i,n]=r;return((e,t,r)=>{let i=new v.default(e);if(r&&(i=((e,t)=>{if(t<1||t>32)throw o.ERRORS.TypedError("Runtime","Int byte size must be between 1 and 32 (8 and 256 bits)");const r=new v.default(2).exponentiatedBy(8*t-1).negated(),i=r.negated().minus(1),n=new v.default(e);if(n.isGreaterThan(i)||n.isLessThan(r))throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`Overflow when trying to convert number ${e.toString()} into ${t} bytes`);return n.isPositive()?n:n.minus(r).minus(r)})(i,t)),i.isNegative())throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`Cannot convert negative number to unsigned interger: ${e.toString()}`);const n=i.toString(16),s=2*t;if(n.length>s)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`Overflow when trying to convert number ${e.toString()} into ${t} bytes`);return n.padStart(2*t,"0")})(t,Math.ceil(parseInt(n,10)/8),"int"===i)}if("bool"===e)return t?"01":"00";throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`Unsupported data type for direct field encoding: ${e}`)},Kt={string:h.EthereumDataType.STRING,bool:h.EthereumDataType.BOOL,address:h.EthereumDataType.ADDRESS},Yt=(e,t)=>{const r=Ht.exec(e);if(r){const[e,i,n]=r,s=Yt(i,t);return{data_type:h.EthereumDataType.ARRAY,size:parseInt(n,10)||void 0,entry_type:s}}const i=Gt.exec(e);if(i){const[e,t,r]=i;return{data_type:"uint"===t?h.EthereumDataType.UINT:h.EthereumDataType.INT,size:Math.floor(parseInt(r,10)/8)}}const n=$t.exec(e);if(n){const[e,t]=n;return{data_type:h.EthereumDataType.BYTES,size:parseInt(t,10)||void 0}}const s=Kt[e];if(s)return{data_type:s};if(e in t)return{data_type:h.EthereumDataType.STRUCT,size:t[e].length,struct_name:e};throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,`No type definition specified: ${e}`)};var Xt=Object.freeze({__proto__:null,searchDevices:class extends ht{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){var e,t;return b(this,void 0,void 0,(function*(){yield Ze.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"===fe.getSettings("env"))return i.map((e=>{var t,r;return Object.assign(Object.assign({},e),{connectId:e.id,deviceType:(r=null!==(t=e.name)&&void 0!==t?t:"",r?r.startsWith("MI")?"mini":r.startsWith("T")?"touch":"classic":"classic")})}));const{deviceList:n}=yield Ve.getDevices(i);return n.map((e=>e.toMessageObject()))}))}},getFeatures:class extends ht{init(){this.allowDeviceMode=[...this.allowDeviceMode,tt,et],this.useDevicePassphraseState=!1}run(){return i.resolve(this.device.features)}},getPassphraseState:class extends ht{init(){this.allowDeviceMode=[...this.allowDeviceMode,tt],this.useDevicePassphraseState=!1}run(){var e,t;return b(this,void 0,void 0,(function*(){if(!this.device.features)return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceInitializeFailed));let{features:r}=this.device;const n=!0===(null===(t=null===(e=this.device)||void 0===e?void 0:e.features)||void 0===t?void 0:t.unlocked),s=yield J(this.device.features,this.device.commands);if(("touch"===W(r)||"pro"===W(r))&&n){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),i.resolve(s)):i.resolve(void 0)}))}},getLogs:class extends ht{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return b(this,void 0,void 0,(function*(){const e=(()=>{let e=[];return Object.keys(ie).forEach((t=>{e=e.concat(ie[t].messages)})),e.sort(((e,t)=>e.timestamp-t.timestamp)),e})();return i.resolve(e)}))}},checkFirmwareRelease:class extends ht{init(){this.useDevicePassphraseState=!1}run(){if(this.device.features){const e=lt(this.device.features);return i.resolve(e)}return i.resolve(null)}},checkBLEFirmwareRelease:class extends ht{init(){this.allowDeviceMode=[...this.allowDeviceMode,et],this.checkDeviceId=!0,this.useDevicePassphraseState=!1}run(){if(this.device.features){const e=ct(this.device.features);return i.resolve(e)}return i.resolve(null)}},checkTransportRelease:class extends ht{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return b(this,void 0,void 0,(function*(){const e=Ze.getTransport(),t=yield e.init(),r=fe.getTransportStatus(t);return i.resolve(r)}))}},checkBridgeStatus:class extends ht{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){return b(this,void 0,void 0,(function*(){return new i(((e,t)=>{m.default.request({url:"http://localhost:21320",method:"POST",withCredentials:!1,timeout:3e3}).then((()=>e(!0))).catch((r=>{"ECONNABORTED"===r.code?t(o.ERRORS.TypedError(o.HardwareErrorCode.BridgeTimeoutError)):e(!1)}))}))}))}},deviceBackup:class extends ht{init(){this.useDevicePassphraseState=!1}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("BackupDevice","Success");return i.resolve(e.message)}))}},deviceChangePin:class extends ht{init(){this.useDevicePassphraseState=!1,Et(this.payload,[{name:"remove",type:"boolean"}]),this.params={remove:this.payload.remove}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ChangePin","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceFlags:class extends ht{init(){this.useDevicePassphraseState=!1,Et(this.payload,[{name:"flags",type:"number"}]),this.params={flags:this.payload.flags}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ApplyFlags","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceRebootToBootloader:class extends ht{init(){this.useDevicePassphraseState=!1}getVersionRange(){return{classic:{min:"2.1.11"},mini:{min:"2.1.11"}}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("RebootToBootloader","Success");return i.resolve(e.message)}))}},deviceRecovery:class extends ht{init(){this.useDevicePassphraseState=!1,Et(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 b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("RecoveryDevice","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceReset:class extends ht{init(){this.useDevicePassphraseState=!1,Et(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 b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ResetDevice","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceSettings:class extends ht{init(){this.useDevicePassphraseState=!1,Et(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 b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ApplySettings","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},deviceUpdateReboot:class extends ht{init(){this.useDevicePassphraseState=!1}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("DeviceBackToBoot","Success");return i.resolve(e.message)}))}},deviceUploadResource:class extends ht{constructor(){super(...arguments),this.paramsData={data:new Uint8Array,thumbnailData:new Uint8Array},this.processResourceRequest=e=>b(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=l.blake2s(s),a={data_chunk:d.bytesToHex(s),hash:d.bytesToHex(o)},u=yield this.device.commands.typedCall("ResourceAck",["ResourceRequest","ZoomRequest","Success"],a);return this.processResourceRequest(u)}))}getVersionRange(){return{model_touch:{min:"3.2.0"}}}init(){this.useDevicePassphraseState=!1,Et(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:bt(t),thumbnailData:bt(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 b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ResourceUpload",["ResourceRequest","ZoomRequest","Success"],this.params);return this.postMessage(Ae(we)),this.processResourceRequest(e)}))}},deviceSupportFeatures:class extends ht{init(){this.useDevicePassphraseState=!1}run(){if(!this.device.features)return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Device not initialized"));const e=Z(this.device.features),t=(e=>{if(!e)return{support:!1};const t=Y(e).join("."),r=W(e);return"classic"===r||"mini"===r?{support:!0}:{support:g.default.gte(t,"3.4.0")}})(this.device.features);return i.resolve({inputPinOnSoftware:e,modifyHomescreen:t,device:this.device.toMessageObject()})}},deviceVerify:class extends ht{init(){this.useDevicePassphraseState=!1,Et(this.payload,[{name:"dataHex",type:"hexString"}]),this.params={data:mt(this.payload.dataHex)}}run(){return b(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:d.bytesToHex(c.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?i.resolve(e):i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Device not support verify"))}))}},deviceWipe:class extends ht{init(){this.useDevicePassphraseState=!1}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("WipeDevice","Success");return i.resolve(e.message)}))}},deviceFullyUploadResource:class extends ht{constructor(){super(...arguments),this.checkPromise=null,this.postTipMessage=e=>{this.postMessage(Ae(it,{device:this.device.toMessageObject(),data:{message:e}}))}}init(){this.allowDeviceMode=[et,tt],this.requireDeviceMode=[],this.useDevicePassphraseState=!1}isSupportResourceUpdate(e,t){if("firmware"!==t)return!1;const r=W(e),i="touch"===r||"pro"===r,n=Y(e).join(".");return i&&g.default.gte(n,"3.4.0")}run(){return b(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=fe.getSysFullResource(t);if(r){this.postTipMessage("DownloadLatestUiResource");const t=yield St(r);this.postTipMessage("DownloadLatestUiResourceSuccess"),t&&(yield Dt(this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,e,t.binary))}}}))}},firmwareUpdate:class extends ht{init(){this.allowDeviceMode=[et,tt],this.requireDeviceMode=[et],this.useDevicePassphraseState=!1;const{payload:e}=this;if(Et(e,[{name:"version",type:"array"},{name:"binary",type:"buffer"}]),!e.updateType)throw o.ERRORS.TypedError(o.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 b(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 o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"no features found for this device");i=(yield Tt({features:t.features,version:r.version,updateType:r.updateType})).binary}}catch(t){throw o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateDownloadFailed,null!==(e=t.message)&&void 0!==e?e:t)}return Ct(r.updateType,this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,t,{payload:i})}))}},firmwareUpdateV2:class extends ht{constructor(){super(...arguments),this.checkPromise=null,this.postTipMessage=e=>{this.postMessage(Ae(it,{device:this.device.toMessageObject(),data:{message:e}}))}}init(){this.allowDeviceMode=[et,tt],this.requireDeviceMode=[],this.useDevicePassphraseState=!1;const{payload:e}=this;if(Et(e,[{name:"version",type:"array"},{name:"binary",type:"buffer"},{name:"forcedUpdateRes",type:"boolean"}]),!e.updateType)throw o.ERRORS.TypedError(o.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=o.createDeferred();const t=fe.getSettings("env"),r=e&&"react-native"===t;Nt.log("FirmwareUpdateV2 [checkDeviceToBootloader] isBleReconnect: ",r);const i=setInterval((()=>b(this,void 0,void 0,(function*(){var t,n,s,o,a,u,d;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 Ve.getDevices(r,e);1===n.length&&(null===(u=null===(a=n[0])||void 0===a?void 0:a.features)||void 0===u?void 0:u.bootloader_mode)&&(this.device.updateFromCache(n[0]),this.device.commands.disposed=!1,clearInterval(i),null===(d=this.checkPromise)||void 0===d||d.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=Y(e).join(".");return i&&g.default.gte(n,"3.2.0")}run(){var e,t;return b(this,void 0,void 0,(function*(){const{device:r,params:n}=this,{features:s,commands:a}=r;if(!(null==s?void 0:s.bootloader_mode)&&s){const t=V(s),u=W(s);if(this.isEnteredManuallyBoot(s))return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateManuallyEnterBoot));if(s&&this.isSupportResourceUpdate(s,n.updateType)){this.postTipMessage("CheckLatestUiResource");const e=fe.getSysResourcesLatestRelease(s,n.forcedUpdateRes);if(e){this.postTipMessage("DownloadLatestUiResource");const t=yield St(e);this.postTipMessage("DownloadLatestUiResourceSuccess"),t&&(yield Dt(this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,r,t.binary))}}try{this.postTipMessage("AutoRebootToBootloader"),yield a.typedCall("DeviceBackToBoot","Success"),this.postTipMessage("GoToBootloaderSuccess"),this.checkDeviceToBootloader(this.payload.connectId),"classic"===u&&Ve.clearDeviceCache(t),delete Ve.devicesCache[""],yield null===(e=this.checkPromise)||void 0===e?void 0:e.promise,this.checkPromise=null,yield de(1500)}catch(e){return e instanceof o.HardwareError?i.reject(e):(console.log("auto go to bootloader mode failed: ",e),i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure)))}}let u;try{if(n.binary)u=this.params.binary;else{if(!r.features)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"no features found for this device");this.postTipMessage("DownloadFirmware"),u=(yield Tt({features:r.features,version:n.version,updateType:n.updateType})).binary,this.postTipMessage("DownloadFirmwareSuccess")}}catch(e){throw o.ERRORS.TypedError(o.HardwareErrorCode.FirmwareUpdateDownloadFailed,null!==(t=e.message)&&void 0!==t?t:e)}return yield this.device.acquire(),Ct(n.updateType,this.device.getCommands().typedCall.bind(this.device.getCommands()),this.postMessage,r,{payload:u})}))}},requestWebUsbDevice:class extends ht{init(){this.useDevice=!1,this.useDevicePassphraseState=!1}run(){var e,t;return b(this,void 0,void 0,(function*(){if(yield Ze.configure(),"webusb"!==fe.getSettings("env"))return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Not webusb environment"));try{const r=yield null===(e=this.connector)||void 0===e?void 0:e.enumerate(),n=null!==(t=null==r?void 0:r.descriptors)&&void 0!==t?t:[],{deviceList:s}=yield Ve.getDevices(n);return s.length>0?{device:s[0].toMessageObject()}:yield i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Please select the device to connect"))}catch(e){return Pt.debug(e),i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"Please select the device to connect"))}}))}},cipherKeyValue:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{const t=G(e.path);Et(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:mt(e.value),encrypt:e.encrypt,ask_on_encrypt:e.askOnEncrypt,ask_on_decrypt:e.askOnDecrypt,iv:mt(e.iv)})}))}run(){return b(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 i.resolve(this.hasBundle?e:e[0])}))}},btcGetAddress:class extends ht{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]};Et(e,[{name:"bundle",type:"array"}]),this.params=[],e.bundle.forEach((e=>{var t;const r=G(e.path,1);Et(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=Lt(r,s).name;this.params.push({address_n:r,show_display:i,coin_name:a,multisig:n,script_type:o||"SPENDADDRESS"})}))}run(){return b(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 i.resolve(this.hasBundle?e:e[0])}))}},btcGetPublicKey:class extends ht{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]};Et(e,[{name:"bundle",type:"array"}]),this.params=[],e.bundle.forEach((e=>{var t;const r=G(e.path,1);Et(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=Lt(r,s).name;this.params.push({address_n:r,show_display:i,coin_name:a,script_type:o||"SPENDADDRESS"})}))}run(){return b(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 i.resolve(this.hasBundle?e:e[0])}))}},btcSignMessage:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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}=((e,t,r)=>{const i=Lt(e,t).name;let n=r;void 0===n&&(n=(e=>Array.isArray(e)&&e[0]===F(48))(e));let s=H(e);return"SPENDMULTISIG"!==s||n||(s="SPENDADDRESS"),{coinName:i,scriptType:null!=s?s:"SPENDADDRESS"}})(i,r,!1);this.params={address_n:i,message:mt(t),coin_name:n,script_type:s}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("SignMessage","MessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},btcSignTransaction:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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=>{Et(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]===F(49));var r;Et(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(Et(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 o.ERRORS.TypedError(o.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 o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,`Output change script_type should be set to ${t}`)}}));const{inputs:e,outputs:t,refTxs:r,account:i,coin:n}=this.payload,s=Lt(void 0,n).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:s}}run(){return b(this,void 0,void 0,(function*(){const{device:e,params:t}=this,r=e.unavailableCapabilities.replaceTransaction,{refTxs:i}=t,n=r?Ut:Ft;return yield n(e.commands.typedCall.bind(e.commands),t.inputs,t.outputs,i,t.options,t.coinName)}))}},btcVerifyMessage:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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}=mt(this.payload),n=Lt(void 0,e).name;this.params={address:t,message:r,signature:i,coin_name:n}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("VerifyMessage","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},confluxGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},confluxSignMessage:class extends ht{init(){this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:mt(t)}}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ConfluxSignMessage","ConfluxMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},confluxSignMessageCIP23:class extends ht{init(){this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:mt(t),message_hash:mt(r)}}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("ConfluxSignMessageCIP23","ConfluxMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},confluxSignTransaction:class extends ht{constructor(){super(...arguments),this.addressN=[],this.processTxRequest=(e,t)=>b(this,void 0,void 0,(function*(){if(!e.data_length){const t=e.signature_v,r=e.signature_r,n=e.signature_s;if(null==t||null==r||null==n)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodError,"sign transaction failed");return i.resolve({v:`0x${t.toString(16)}`,r:`0x${r}`,s:`0x${n}`})}const[r,n]=zt(t,2*e.data_length),s=yield this.device.commands.typedCall("ConfluxTxAck","ConfluxTxRequest",{data_chunk:r});return this.processTxRequest(s.message,n)})),this.evmSignTx=(e,t)=>b(this,void 0,void 0,(function*(){const{to:r,value:i,gasPrice:n,gasLimit:s,nonce:o,data:a,chainId:u,epochHeight:d,storageLimit:l}=t,c=null==a?0:a.length/2,[p,h]=zt(a,2048);let f={address_n:e,nonce:gt(o),gas_price:gt(n),gas_limit:gt(s),to:r,value:gt(i),epoch_height:gt(d),storage_limit:gt(l),chain_id:u};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],Et(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;Et(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=mt(r)}getVersionRange(){return{model_mini:{min:"2.4.0"}}}run(){return b(this,void 0,void 0,(function*(){const{addressN:e,formattedTx:t}=this;if(null==t)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"ConfluxSignTransaction: format tx error");const r=yield this.evmSignTx(e,t);return i.resolve(r)}))}},evmGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},evmGetPublicKey:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},evmSignMessage:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:mt(t)}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumSignMessage","EthereumMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},evmSignMessageEIP712:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:mt(t),message_hash:mt(r)}}getVersionRange(){return{model_mini:{min:"2.1.9"}}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumSignMessageEIP712","EthereumMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},evmSignTransaction:class extends ht{constructor(){super(...arguments),this.addressN=[],this.isEIP1559=!1,this.processTxRequest=(e,t,r)=>b(this,void 0,void 0,(function*(){if(!e.data_length){let t=e.signature_v;const n=e.signature_r,s=e.signature_s;if(null==t||null==n||null==s)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"processTxRequest: Unexpected request");return r&&t<=1&&(t+=2*r+35),i.resolve({v:`0x${t.toString(16)}`,r:`0x${n}`,s:`0x${s}`})}const[n,s]=zt(t,2*e.data_length),a=yield this.device.commands.typedCall("EthereumTxAck","EthereumTxRequest",{data_chunk:n});return this.processTxRequest(a.message,s,r)})),this.evmSignTx=(e,t)=>b(this,void 0,void 0,(function*(){const{to:r,value:i,gasPrice:n,gasLimit:s,nonce:o,data:a,chainId:u,txType:d}=t,l=null==a?0:a.length/2,[c,p]=zt(a,2048);let h={address_n:e,nonce:gt(o),gas_price:gt(n),gas_limit:gt(s),to:r,value:gt(i),chain_id:u};0!==l&&(h=Object.assign(Object.assign({},h),{data_length:l,data_initial_chunk:c})),null!==d&&(h=Object.assign(Object.assign({},h),{tx_type:d}));const f=yield this.device.commands.typedCall("EthereumSignTx","EthereumTxRequest",h);return this.processTxRequest(f.message,p,u)})),this.evmSignTxEip1559=(e,t)=>b(this,void 0,void 0,(function*(){const{to:r,value:i,gasLimit:n,nonce:s,data:o,chainId:a,maxFeePerGas:u,maxPriorityFeePerGas:d,accessList:l}=t,c=null==o?0:o.length/2,[p,h]=zt(o,2048),f={address_n:e,nonce:gt(s),max_gas_fee:gt(u),max_priority_fee:gt(d),gas_limit:gt(n),to:r,value:gt(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],Et(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"})),Et(r,i),this.formattedTx=mt(r)}getVersionRange(){return this.isEIP1559?{model_mini:{min:"2.1.11"}}:{model_mini:{min:"1.0.0"}}}run(){return b(this,void 0,void 0,(function*(){const{addressN:e,isEIP1559:t,formattedTx:r}=this,n=yield t?this.evmSignTxEip1559(e,r):this.evmSignTx(e,r);return i.resolve(n)}))}},evmSignTypedData:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:n}=this.payload,s=G(e,3);if(this.params={addressN:s,metamaskV4Compat:r,data:t},i)if(this.params.domainHash=mt(i),n)this.params.messageHash=mt(n);else if(t&&(!t.primaryType||"EIP712Domain"!==t.primaryType))throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"message_hash should only be empty when data.primaryType=EIP712Domain")}signTypedData(){return b(this,void 0,void 0,(function*(){const{commands:e}=this.device,{addressN:t,data:r,metamaskV4Compat:i}=this.params,{types:n,primaryType:s,domain:a,message:u}=r;let d=yield e.typedCall("EthereumSignTypedData",["EthereumTypedDataStructRequest","EthereumTypedDataValueRequest","EthereumTypedDataSignature"],{address_n:t,primary_type:s,metamask_v4_compat:i});for(;"EthereumTypedDataStructRequest"===d.type;){const{name:t}=d.message,r=n[t];if(void 0===r)throw o.ERRORS.TypedError("Runtime",`Type ${t} was not defined in types object`);const i={members:r.map((({name:e,type:t})=>({name:e,type:Yt(t,n)})))};d=yield e.typedCall("EthereumTypedDataStructAck",["EthereumTypedDataStructRequest","EthereumTypedDataValueRequest","EthereumTypedDataSignature"],i)}for(;"EthereumTypedDataValueRequest"===d.type;){const{member_path:t}=d.message;let r,i;const[l,...c]=t;switch(l){case 0:r=a,i="EIP712Domain";break;case 1:r=u,i=s;break;default:throw o.ERRORS.TypedError("Runtime","Root index can only be 0 or 1")}for(const e of c)if(Array.isArray(r))i=Wt(i).entryTypeName,r=r[e];else if("object"==typeof r&&null!==r){const t=n[i][e];i=t.type,r=r[t.name]}let p;p=Array.isArray(r)?Vt("uint16",r.length):Vt(i,r),d=yield e.typedCall("EthereumTypedDataValueAck",["EthereumTypedDataValueRequest","EthereumTypedDataSignature"],{value:p})}if("EthereumTypedDataSignature"!==d.type)throw o.ERRORS.TypedError("Runtime","Unexpected response type");const{address:l,signature:c}=d.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=Y(this.device.features).join("."),t="2.2.0";if(g.default.lt(e,t))return!1}return!0}run(){return b(this,void 0,void 0,(function*(){if(!this.device.features)throw o.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){Et(this.params,[{name:"domainHash",type:"hexString",required:!0},{name:"messageHash",type:"hexString",required:!0}]);const{domainHash:t,messageHash:r}=this.params;let n;return n=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:""}),i.resolve(n.message)}return this.signTypedData()}))}},evmVerifyMessage:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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}=mt(this.payload);this.params={address:e,message:t,signature:r}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("EthereumVerifyMessage","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},starcoinGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},starcoinGetPublicKey:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},starcoinSignMessage:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:mt(t)}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinSignMessage","StarcoinMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},starcoinSignTransaction:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:mt(t)}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinSignTx","StarcoinSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},starcoinVerifyMessage:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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}=mt(this.payload);this.params={public_key:e,message:t,signature:r}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("StarcoinVerifyMessage","Success",Object.assign({},this.params));return i.resolve(e.message)}))}},nemGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},nemSignTransaction:class extends ht{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 o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Unknown transaction type")}return i}}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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 b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("NEMSignTx","NEMSignedTx",Object.assign({},this.params));return i.resolve(e)}))}},solGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},solSignTransaction:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{const t=G(e.path,3);Et(e,[{name:"path",required:!0},{name:"rawTx",type:"hexString",required:!0}]),this.params.push({address_n:t,raw_tx:mt(e.rawTx)})}))}getVersionRange(){return{classic:{min:"2.1.9"},mini:{min:"2.1.9"}}}run(){return b(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 i.resolve(this.hasBundle?e:e[0])}))}},stellarGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},stellarSignTransaction:class extends ht{constructor(){super(...arguments),this.operations=[],this.parseOperation=e=>{switch(e.type){case"createAccount":return Et(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 Et(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 Et(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 Et(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 Et(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 Et(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)=>b(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"]);return r?(yield this.device.commands.typedCall(n,"StellarSignedTx",s)).message:(yield this.device.commands.typedCall(n,"StellarTxOpRequest",s),this.processTxRequest(e,t+1))}))}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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 o.ERRORS.TypedError(o.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:h.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 b(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 ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},tronSignMessage:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:yt(t)}}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("TronSignMessage","TronMessageSignature",Object.assign({},this.params));return i.resolve(e.message)}))}},tronSignTransaction:class extends ht{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],Et(this.payload,[{name:"path",required:!0},{name:"transaction",type:"object",required:!0}]);const{path:e,transaction:t}=this.payload,r=G(e,3);Et(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(mt(t),r)}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("TronSignTx","TronSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},nearGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},nearSignTransaction:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:mt(t)}}getVersionRange(){return{model_mini:{min:"2.5.0"}}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("NearSignTx","NearSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},aptosGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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=f.sha3_256.create();return t.update(bt(e)),t.update("\0"),`0x${d.bytesToHex(t.digest())}`}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){var e;return b(this,void 0,void 0,(function*(){if(this.hasBundle&&(e=>{if(!e)return!1;const t=Y(e).join("."),r=W(e);return"touch"===r||"pro"===r?g.default.gte(t,"3.1.0"):g.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 i.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 i.resolve(this.hasBundle?t:t[0])}))}},aptosGetPublicKey:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},aptosSignTransaction:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(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:mt(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return b(this,void 0,void 0,(function*(){const e=yield this.device.commands.typedCall("AptosSignTx","AptosSignedTx",Object.assign({},this.params));return i.resolve(e.message)}))}},aptosSignMessage:class extends ht{init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode,tt],Et(this.payload,[{name:"path",required:!0},{name:"payload",type:"object",required:!0}]);const{path:e,payload:t}=this.payload,r=G(e,3);Et(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 b(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:n}=t.message;return i.resolve({path:$(this.params.address_n),address:r,signature:n,fullMessage:e})}))}},algoGetAddress:class extends ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},algoSignTransaction:class extends ht{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],Et(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:mt(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return b(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 ht{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]};Et(t,[{name:"bundle",type:"array"}]),this.params=[],t.bundle.forEach((e=>{var t;const r=G(e.path,3);Et(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 b(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 i.resolve(this.hasBundle?e:e[0])}))}},cosmosSignTransaction:class extends ht{constructor(){super(...arguments),this.hasBundle=!1}init(){this.checkDeviceId=!0,this.allowDeviceMode=[...this.allowDeviceMode],Et(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:mt(t)}}getVersionRange(){return{model_mini:{min:"2.6.0"}}}run(){return b(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 Zt=e=>{throw e instanceof o.HardwareError?e:"ERR_NETWORK"===e.code?o.ERRORS.TypedError(o.HardwareErrorCode.BridgeNotInstalled):"ECONNABORTED"===e.code?o.ERRORS.TypedError(o.HardwareErrorCode.BridgeTimeoutError):o.ERRORS.TypedError(e)},Jt=ue(t.d0.DeviceConnector);class Qt{constructor(){this.listenTimestamp=0,this.current=null,this.upcoming=[],this.listening=!1,Ze.load(),this.transport=Ze.getTransport(),Ve.setConnector(this)}enumerate(){return b(this,void 0,void 0,(function*(){try{const e=yield this.transport.enumerate();return this.upcoming=e,this._reportDevicesChange(),{descriptors:e}}catch(e){Zt(e)}}))}listen(){return b(this,void 0,void 0,(function*(){const e=null!==this.current,t=this.current||[];let r;this.listening=!0;try{if(Jt.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,Jt.debug("Listen result",r),this._reportDevicesChange(),this.listening&&this.listen()}catch(e){const t=(new Date).getTime()-this.listenTimestamp;Jt.debug("Listen error","timestamp",t,typeof e),t>1100?(yield(1e3,null,new i((e=>{setTimeout(e,1e3,null)}))),this.listening&&this.listen()):Jt.warn("Transport error")}}))}stop(){this.listening=!1}acquire(e,t){return b(this,void 0,void 0,(function*(){Jt.debug("acquire",e,t);const r=fe.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){Jt.debug("acquire error: ",e.message),Zt(e)}}))}release(e,t){return b(this,void 0,void 0,(function*(){try{return yield this.transport.release(e,t)}catch(e){Zt(e)}}))}_reportDevicesChange(){Ve.reportDeviceChange(this.upcoming)}}const er=ue(t.d0.Core),tr=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 rr,ir,nr,sr,or=[];const ar=[],ur=new Map;let dr=1;const lr={};let cr={passphraseState:void 0};function pr(e){if(!ir)throw o.ERRORS.TypedError(o.HardwareErrorCode.DeviceListNotInitialized);let t;const r=ir.allDevices();if(e.connectId)t=ir.getDevice(e.connectId);else if(1===r.length)[t]=r;else if(r.length>1)throw o.ERRORS.TypedError("firmwareUpdateV2"===e.name?o.HardwareErrorCode.FirmwareUpdateLimitOneDevice:o.HardwareErrorCode.SelectDevice);if(!t)throw o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotFound);return t.deviceConnector=nr,t}function hr(e){if(!e.connectId&&!ir)throw o.ERRORS.TypedError(o.HardwareErrorCode.DeviceListNotInitialized);if(!e.connectId)return pr(e);let t;return ur.has(e.connectId)?t=ur.get(e.connectId):(t=ut.fromDescriptor({id:e.connectId}),ur.set(e.connectId,t)),t.deviceConnector=nr,t}let fr=0;function yr(e,t){return b(this,void 0,void 0,(function*(){try{yield t.acquire(),yield t.initialize(tr(e))}catch(r){if(!(r.errorCode===o.HardwareErrorCode.BleTimeoutError&&fr<=5))throw r;fr+=1,er.debug(`Bletooth connect timeout and will retry, retry count: ${fr}`),yield de(3e3),yield yr(e,t)}}))}const gr=(e,t)=>b(void 0,void 0,void 0,(function*(){let r=0;const n=e.payload&&e.payload.retryCount||5,s=e.payload&&e.payload.pollIntervalTime||1e3,a=e.payload&&e.payload.timeout||1e4;let u=null;er.debug(`EnsureConnected function start, MAX_RETRY_COUNT=${n}, POLL_INTERVAL_TIME=${s} `);const d=(n=s)=>b(void 0,void 0,void 0,(function*(){return new i(((i,s)=>b(void 0,void 0,void 0,(function*(){if(!lr[t])return er.debug("EnsureConnected function stop, polling id: ",t),void s(o.ERRORS.TypedError(o.HardwareErrorCode.PollingStop));u&&clearTimeout(u),u=setTimeout((()=>{s(o.ERRORS.TypedError(o.HardwareErrorCode.PollingTimeout))}),a),r+=1,er.debug("EnsureConnected function try count: ",r," poll interval time: ",n);try{yield function(e){return b(this,void 0,void 0,(function*(){"react-native"===fe.getSettings("env")&&e.connectId?yield Ze.configure():(ir||(ir=new dt,yield Ze.configure(),ir.connector=nr),yield ir.getDeviceLists(e.connectId,tr(e)))}))}(e)}catch(e){if(er.debug("device list error: ",e),[o.HardwareErrorCode.BridgeNotInstalled,o.HardwareErrorCode.BridgeTimeoutError].includes(e.errorCode))return ir=void 0,void s(e);e.errorCode===o.HardwareErrorCode.TransportNotConfigured&&(yield Ze.configure())}const l=fe.getSettings("env");let c;try{if(c="react-native"===l?hr(e):pr(e),c)return u&&clearTimeout(u),"react-native"===l&&(fr=0,yield yr(e,c)),void i(c)}catch(e){if(er.debug("device error: ",e),[o.HardwareErrorCode.BlePermissionError,o.HardwareErrorCode.BleLocationError,o.HardwareErrorCode.BleLocationServicesDisabled,o.HardwareErrorCode.BleDeviceNotBonded,o.HardwareErrorCode.BleCharacteristicNotifyError,o.HardwareErrorCode.BleTimeoutError,o.HardwareErrorCode.BleWriteCharacteristicError,o.HardwareErrorCode.BleAlreadyConnected,o.HardwareErrorCode.FirmwareUpdateLimitOneDevice].includes(e.errorCode))return void s(e)}return r>5?(u&&clearTimeout(u),er.debug("EnsureConnected get to max try count, will return: ",r),void s(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotFound))):setTimeout((()=>i(d(1.5*n))),n)}))))}));return lr[t]=!0,d()})),mr=(e,t)=>{if(e.useDevicePassphraseState){if(!0===(null==t?void 0:t.passphrase_protection)&&!e.payload.passphraseState)throw Ve.clearDeviceCache(e.payload.connectId),o.ERRORS.TypedError(o.HardwareErrorCode.DeviceOpenedPassphrase);if(!1===(null==t?void 0:t.passphrase_protection)&&e.payload.passphraseState)throw Ve.clearDeviceCache(e.payload.connectId),o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotOpenedPassphrase)}},vr=()=>{or=[],er.debug("Cleanup...")},_r=e=>{e.removeListener(Le,Tr),e.removeListener(Be,Sr),e.removeListener(qe,xr),e.removeListener(Fe,Or),e.removeListener(Ue,Rr),Ve.emitter.removeListener(Ne,wr)},br=()=>{Ar(Ae(we))},wr=e=>{const t="react-native"===fe.getSettings("env")?e:e.toMessageObject();Ar(ze(Ne,{device:t}))},Er=e=>{const t="react-native"===fe.getSettings("env")?e:e.toMessageObject();Ar(ze(Pe,{device:t}))},Tr=(...[e,t,r])=>b(void 0,void 0,void 0,(function*(){er.debug("onDevicePinHandler");const i=Ir(Me,e);Ar(Ae(me,{device:e.toMessageObject(),type:t}));const n=yield i.promise;r(null,n.payload)})),Sr=(...[e,t])=>{Ar(ze(Be,Object.assign(Object.assign({},t),{device:e.toMessageObject()}))),"ButtonRequest_PinEntry"===t.code?Ar(Ae(me,{device:e.toMessageObject(),type:"ButtonRequest_PinEntry"})):Ar(Ae(ve,{device:e.toMessageObject()}))},Rr=(...[e,t])=>{Ar(ze(Ue,Object.assign({},t)))},xr=(...[e,t])=>b(void 0,void 0,void 0,(function*(){er.debug("onDevicePassphraseHandler");const r=Ir(De,e);Ar(Ae(_e,{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})})),Or=(...[e])=>{Ar(Ae(be,{device:e.toMessageObject(),passphraseState:e.passphraseState}))},Ar=e=>{rr.emit(ye,e)},Ir=(e,t)=>{const r=o.createDeferred(e,t);return or.push(r),r};class Cr extends T.exports{handleMessage(e){var t,r,n,s;return b(this,void 0,void 0,(function*(){switch(e.type){case Me:case De:{const t=(u=e.type,or.find((e=>e.id===u)));t&&(t.resolve(e),a=t,or=or.filter((e=>e!==a)));break}case Ee:case Te:case Se:Ar(e);break;case Ie.CALL:{const a=yield(e=>b(void 0,void 0,void 0,(function*(){var t;if(!e.id||!e.payload||e.type!==Ie.CALL)return i.reject(o.ERRORS.TypedError("on call: message.id or message.payload is missing"));let r,n;try{r=function(e){const{method:t}=e.payload;if("string"!=typeof t)throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,"Method is not set");const r=Xt[t];if(r)return new r(e);throw o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodInvalidParameter,`Method ${t} is not set`)}(e),r.connector=nr,r.postMessage=Ar,r.init()}catch(e){return i.reject(e)}if(Ve.emitter.on(Ne,wr),!r.useDevice)try{const e=yield r.run();return ke(r.responseID,!0,e)}catch(e){return ke(r.responseID,!1,{error:e})}ar.push(r),ar.length>1&&er.debug("should cancel the previous method execution: ",ar.map((e=>e.name)));const s=cr.passphraseState!==r.payload.passphraseState;let a;cr={passphraseState:r.payload.passphraseState},(s||r.payload.initSession)&&(er.debug("passphrase state change, clear device cache"),Ve.clearDeviceCache(r.payload.connectId)),lr[dr]&&(lr[dr]=!1),dr+=1;try{a=yield gr(r,dr)}catch(e){return ke(r.responseID,!1,{error:e})}er.debug("Call API - setDevice: ",a.mainId),null===(t=r.setDevice)||void 0===t||t.call(r,a),a.on(Le,Tr),a.on(Be,Sr),a.on(qe,xr),a.on(Fe,Or),a.on(Ue,Rr);try{const e=()=>b(void 0,void 0,void 0,(function*(){const e=W(a.features),t=(s=a.features)&&"object"==typeof s?"1"===s.model?"model_mini":"model_touch":"model_mini";var s;const u=r.getVersionRange()[e],d=r.getVersionRange()[t],l=null!=u?u:d;if(l&&a.features){const e=Y(a.features).join(".");if(g.default.valid(l.min)&&g.default.lt(e,l.min)){const t=fe.getFirmwareStatus(a.features);if("none"===t||"valid"===t)throw o.ERRORS.TypedError(o.HardwareErrorCode.NewFirmwareUnRelease);return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodNeedUpgradeFirmware,`Device firmware version is too low, please update to ${l.min}`,{current:e,require:l.min}))}if(l.max&&g.default.valid(l.max)&&g.default.gte(e,l.max))return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodDeprecated,`Device firmware version is too high, this method has been deprecated in ${l.max}`,{current:e,deprecated:l.max}))}const c=a.hasUnexpectedMode(r.allowDeviceMode,r.requireDeviceMode);if(c)return c===Oe?i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceUnexpectedBootloaderMode)):i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceUnexpectedMode,c));if(r.deviceId&&r.checkDeviceId&&!a.checkDeviceId(r.deviceId))return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceCheckDeviceIdError));if(r.checkFirmwareRelease(),r.checkDeviceSupportFeature(),ir&&(yield Ze.reconfigure(a.getFirmwareVersion())),mr(r,a.features),a.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=Y(e).join(".");return{support:g.default.gte(r,"2.4.0"),require:"2.4.0"}})(a.features);if(!e.support)return i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotSupportPassphrase,`Device not support passphrase, please update to ${e.require}`,{require:e.require}));const t=yield a.checkPassphraseState();if(mr(r,a.features),t)return Ve.clearDeviceCache(r.payload.connectId),i.reject(o.ERRORS.TypedError(o.HardwareErrorCode.DeviceCheckPassphraseStateError))}try{yield r.checkSafetyLevelOnTestNet()}catch(e){const t=e instanceof o.HardwareError?e:o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"open safety check failed.");return n=ke(r.responseID,!1,{error:t}),void(null==sr||sr.resolve(n))}try{const e=yield r.run();er.debug("Call API - Inner Method Run: "),n=ke(r.responseID,!0,e),null==sr||sr.resolve(n)}catch(e){er.debug("Call API - Inner Method Run Error: ",e),n=ke(r.responseID,!1,{error:e}),null==sr||sr.resolve(n)}}));er.debug("Call API - Device Run: ",a.mainId);const t=Object.assign({keepSession:r.payload.keepSession},tr(r)),s=()=>a.run(e,t);sr=o.createDeferred(s);try{return yield sr.promise}catch(e){return er.debug("Device Run Error: ",e),ke(r.responseID,!1,{error:e})}}catch(e){n=ke(r.responseID,!1,{error:e}),null==sr||sr.reject(o.ERRORS.TypedError(o.HardwareErrorCode.CallMethodError,e.message)),er.debug("Call API - Run Error: ",e)}finally{n&&r&&r.dispose();const e=r.responseID?ar.findIndex((e=>e.responseID===r.responseID)):-1;e>-1&&(ar.splice(e,1),er.debug("Remove the finished method from the queue: ",ar.map((e=>e.name)))),br(),vr(),_r(a)}})))(e),{success:u,payload:d}=a;return u?a:Object.assign(Object.assign({},a),{payload:Object.assign(Object.assign({},d),{connectId:null!==(r=null===(t=e.payload)||void 0===t?void 0:t.connectId)&&void 0!==r?r:"",deviceId:null!==(s=null===(n=e.payload)||void 0===n?void 0:n.deviceId)&&void 0!==s?s:""})})}case Ie.CANCEL:(e=>{const t=fe.getSettings("env");try{if(e){let r;r="react-native"===t?hr({connectId:e}):pr({connectId:e}),null==r||r.interruptionFromUser()}}catch(e){er.error("Cancel API Error: ",e)}vr(),br()})(e.payload.connectId)}var a,u;return i.resolve(e)}))}dispose(){}}t.WE=ye,t.hm=fe,t.Bg=Ie,t.xG=e=>{let t={error:e.message,code:e.code};return e instanceof o.HardwareError&&(t={error:e.message,code:e.errorCode}),{success:!1,payload:t}},t.Tl=(e,t)=>({event:ge,type:e,payload:t}),t.jl=ue,t.S0=(e,t)=>b(void 0,void 0,void 0,(function*(){try{try{yield fe.load(e),(e=>{Ze.setTransport(e)})(t)}catch(e){er.error("DataManager.load error")}return r=fe.getSettings("debug"),Object.keys(ie).forEach((e=>{ie[e].enabled=!!r})),"react-native"!==fe.getSettings("env")&&(te=Ar),rr=new Cr,nr=new Qt,Ve.emitter.on(Pe,Er),rr}catch(e){er.error("core init",e)}var r})),t._4=(e={})=>{const t=Object.assign({},st);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=(e=>{if("string"==typeof e)return e.match(/^https:\/\/([A-Za-z0-9\-_]+\.)*onekey\.so\//)||e.match(/^https?:\/\/localhost:[58][0-9]{3}\//),e})(i),t.debug=!0);const n=t.connectSrc||nt;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=(()=>{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"})(),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}},426:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(1780),s=r(1464),o=r(9644);function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=a(n),d=a(o);function l(e,t,r,n){return new(r||(r=i))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}function c(e){return"string"==typeof e?"text/plain":"application/json"}function p(e){try{const t=JSON.parse(e);if("object"!=typeof t)throw new Error("Invalid response");return t}catch(t){return e}}function h(e){var t;return l(this,void 0,void 0,(function*(){const r={url:e.url,method:e.method,data:(i=e.body,"string"==typeof i?i:JSON.stringify(i)),withCredentials:!1,headers:{"Content-Type":c(null==e.body?"":e.body)},timeout:null!==(t=e.timeout)&&void 0!==t?t:void 0,transformResponse:e=>e};var i;const n=yield d.default.request(r);if(200==+n.status)return p(n.data);const o=p(n.data);throw"object"==typeof o&&null!=o&&null!=o.error?new s.HardwareError({errorCode:s.HardwareErrorCode.NetworkError,message:o.error}):new s.HardwareError({errorCode:s.HardwareErrorCode.NetworkError,message:n.data})}))}d.default.interceptors.request.use((e=>{var t,r;return"undefined"!=typeof window||(null===(t=e.url)||void 0===t?void 0:t.startsWith("http://localhost:21320"))&&((null===(r=null==e?void 0:e.headers)||void 0===r?void 0:r.Origin)||(console.log("set node request origin"),e.headers=Object.assign(Object.assign({},e.headers),{Origin:"https://jssdk.onekey.so"}))),e}));const{check:f,buildOne:y,receiveOne:g,parseConfigure:m}=u.default;e.exports=class{constructor(e){this.configured=!1,this.stopped=!1,this.url=null==e?"http://localhost:21320":e}_post(e){return this.stopped?i.reject(s.ERRORS.TypedError("Transport stopped.")):h(Object.assign(Object.assign({},e),{method:"POST",url:this.url+e.url}))}init(e){return l(this,void 0,void 0,(function*(){return this.Log=e,yield this._silentInit()}))}_silentInit(){return l(this,void 0,void 0,(function*(){const e=yield h({url:this.url,method:"POST",timeout:3e3});return f.info(e).version}))}configure(e){const t=m(e);this.configured=!0,this._messages=t}listen(e){return l(this,void 0,void 0,(function*(){if(null===e)throw s.ERRORS.TypedError("Http-Transport does not support listen without previous.");const t=yield this._post({url:"/listen",body:e});return f.devices(t)}))}enumerate(){return l(this,void 0,void 0,(function*(){const e=yield this._post({url:"/enumerate"});return f.devices(e)}))}_acquireMixed(e){const t=null==e.previous?"null":e.previous,r=`/acquire/${e.path}/${t}`;return this._post({url:r})}acquire(e){return l(this,void 0,void 0,(function*(){const t=yield this._acquireMixed(e);return f.acquire(t)}))}release(e,t){return l(this,void 0,void 0,(function*(){const r=this._post({url:`/release/${e}`});t||(yield r)}))}call(e,t,r){return l(this,void 0,void 0,(function*(){if(null==this._messages)throw s.ERRORS.TypedError(s.HardwareErrorCode.TransportNotConfigured);const i=this._messages;this.Log.debug("call-"," name: ",t," data: ",r);const n=y(i,t,r).toString("hex"),o=yield this._post({url:`/call/${e}`,body:n,timeout:"Initialize"===t?1e4:void 0});if("string"!=typeof o)throw s.ERRORS.TypedError(s.HardwareErrorCode.NetworkError,"Returning data is not string.");const a=g(i,o);return f.call(a)}))}post(e,t,r){return l(this,void 0,void 0,(function*(){if(null==this._messages)throw s.ERRORS.TypedError(s.HardwareErrorCode.TransportNotConfigured);const i=this._messages,n=y(i,t,r).toString("hex");yield this._post({url:`/post/${e}`,body:n})}))}read(e){return l(this,void 0,void 0,(function*(){if(null==this._messages)throw s.ERRORS.TypedError(s.HardwareErrorCode.TransportNotConfigured);const t=this._messages,r=yield this._post({url:`/read/${e}`});if("string"!=typeof r)throw s.ERRORS.TypedError(s.HardwareErrorCode.NetworkError,"Returning data is not string.");const i=g(t,r);return f.call(i)}))}requestDevice(){return i.reject()}stop(){this.stopped=!0}cancel(){this.Log.debug("canceled")}}},5016:(e,t,r)=>{"use strict";var i=r(6139).Promise,n=r(8834).Buffer,s=r(1780),o=r(1464),a=r(9396);function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(s),l=u(a);function c(e,t,r,n){return new(r||(r=i))((function(i,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((n=n.apply(e,t||[])).next())}))}const{parseConfigure:p,buildEncodeBuffers:h,decodeProtocol:f,receiveOne:y,check:g}=d.default,m=[{vendorId:4617,productId:21440},{vendorId:4617,productId:21441}];e.exports=class{constructor(){this.stopped=!1,this.configured=!1,this._lastDevices=[],this.configurationId=1,this.endpointId=1,this.interfaceId=0}init(e){this.Log=e;const{usb:t}=navigator;if(!t)throw o.ERRORS.TypedError(o.HardwareErrorCode.RuntimeError,"WebUSB is not supported by current browsers");this.usb=t}configure(e){const t=p(e);this.configured=!0,this._messages=t}enumerate(){return c(this,void 0,void 0,(function*(){return yield this._getDeviceList()}))}_getDeviceList(){return c(this,void 0,void 0,(function*(){if(!this.usb)return[];const e=(yield this.usb.getDevices()).filter((e=>{const t=m.some((t=>e.vendorId===t.vendorId&&e.productId===t.productId)),r="string"==typeof e.serialNumber&&e.serialNumber.length>0;return t&&r}));return this._lastDevices=e.map((e=>({path:e.serialNumber,device:e}))),this._lastDevices}))}acquire(e){var t;return c(this,void 0,void 0,(function*(){if(e.path)try{return yield this.connect(null!==(t=e.path)&&void 0!==t?t:"",!0),yield i.resolve(e.path)}catch(e){throw this.Log.debug("acquire error: ",e),e}}))}_findDevice(e){const t=this._lastDevices.find((t=>t.path===e));if(null==t)throw new Error("Action was interrupted.");return t.device}connect(e,t){return c(this,void 0,void 0,(function*(){for(let r=0;r<5;r++){r>0&&(yield new i((e=>setTimeout((()=>e(void 0)),200*r))));try{return yield this._connectIn(e,t)}catch(e){if(4===r)throw e}}}))}_connectIn(e,t){return c(this,void 0,void 0,(function*(){const r=yield this._findDevice(e);if(yield r.open(),t){yield r.selectConfiguration(this.configurationId);try{yield r.reset()}catch(e){}}yield r.claimInterface(this.interfaceId)}))}call(e,t,r){return c(this,void 0,void 0,(function*(){if(null==this._messages)throw o.ERRORS.TypedError(o.HardwareErrorCode.TransportNotConfigured);const i=yield this._findDevice(e);if(!i)throw o.ERRORS.TypedError(o.HardwareErrorCode.DeviceNotFound);const n=this._messages;this.Log.debug("call-"," name: ",t," data: ",r);const s=h(n,t,r);for(const t of s){const r=new Uint8Array(64);r[0]=63,r.set(new Uint8Array(t),1),i.opened||(yield this.connect(e,!1)),yield i.transferOut(this.endpointId,r)}const a=yield this._receive(e);if("string"!=typeof a)throw o.ERRORS.TypedError(o.HardwareErrorCode.NetworkError,"Returning data is not string.");const u=y(n,a);return g.call(u)}))}_receive(e){var t;return c(this,void 0,void 0,(function*(){const r=yield this._findDevice(e);r.opened||(yield this.connect(e,!1));const i=yield r.transferIn(this.endpointId,64),s=null===(t=i.data)||void 0===t?void 0:t.buffer.slice(1),{length:o,typeId:a,restBuffer:u}=f.decodeChunked(s),d=Number(o+6),c=new l.default(d);for(c.writeUint16(a),c.writeUint32(o),o&&c.append(u);c.offset<d;){const e=yield r.transferIn(this.endpointId,64);if(!e.data)throw new Error("no data");0===e.data.byteLength&&console.warn("empty data");const t=e.data.buffer.slice(1);d-c.offset>=64?c.append(t):c.append(t.slice(0,d-c.offset))}c.reset();const p=c.toBuffer();return n.from(p).toString("hex")}))}release(e){return c(this,void 0,void 0,(function*(){const t=yield this._findDevice(e);yield t.releaseInterface(this.interfaceId),yield t.close()}))}requestDevice(){return c(this,void 0,void 0,(function*(){if(this.usb)try{return yield this.usb.requestDevice({filters:m})}catch(e){this.Log.debug("requestDevice error: ",e)}}))}}},1780:(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 u(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 d=u(i),l=u(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},_=(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}},b=e=>{const{typeId:t}=(e=>({typeId:e.readUint16(),length:e.readUint32()}))(e);return{typeId:t,buffer:e}};var w=Object.freeze({__proto__:null,decode:b,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=[],u=Math.floor((o.limit-1)/63)+1||1;for(let e=0;e<u;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}=_(e,t);return E(v(i,r),{addTrezorHeaders:!0,chunked:!0,messageType:n})},S="Wrong result type.";function R(e){if(null==e)return null;if("string"!=typeof e)throw new Error(S);return e}var x,O,A,I,C,k,M,D,N,P,B,L,q,F,j,U,z,H,$,G,W,V,K,Y,X,Z,J,Q,ee,te,re,ie,ne,se,oe,ae,ue,de,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,(x=t.BinanceOrderType||(t.BinanceOrderType={}))[x.OT_UNKNOWN=0]="OT_UNKNOWN",x[x.MARKET=1]="MARKET",x[x.LIMIT=2]="LIMIT",x[x.OT_RESERVED=3]="OT_RESERVED",t.BinanceOrderSide=void 0,(O=t.BinanceOrderSide||(t.BinanceOrderSide={}))[O.SIDE_UNKNOWN=0]="SIDE_UNKNOWN",O[O.BUY=1]="BUY",O[O.SELL=2]="SELL",t.BinanceTimeInForce=void 0,(A=t.BinanceTimeInForce||(t.BinanceTimeInForce={}))[A.TIF_UNKNOWN=0]="TIF_UNKNOWN",A[A.GTE=1]="GTE",A[A.TIF_RESERVED=2]="TIF_RESERVED",A[A.IOC=3]="IOC",t.Enum_InputScriptType=void 0,(I=t.Enum_InputScriptType||(t.Enum_InputScriptType={}))[I.SPENDADDRESS=0]="SPENDADDRESS",I[I.SPENDMULTISIG=1]="SPENDMULTISIG",I[I.EXTERNAL=2]="EXTERNAL",I[I.SPENDWITNESS=3]="SPENDWITNESS",I[I.SPENDP2SHWITNESS=4]="SPENDP2SHWITNESS",I[I.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,(D=t.Enum_RequestType||(t.Enum_RequestType={}))[D.TXINPUT=0]="TXINPUT",D[D.TXOUTPUT=1]="TXOUTPUT",D[D.TXMETA=2]="TXMETA",D[D.TXFINISHED=3]="TXFINISHED",D[D.TXEXTRADATA=4]="TXEXTRADATA",D[D.TXORIGINPUT=5]="TXORIGINPUT",D[D.TXORIGOUTPUT=6]="TXORIGOUTPUT",t.CardanoDerivationType=void 0,(N=t.CardanoDerivationType||(t.CardanoDerivationType={}))[N.LEDGER=0]="LEDGER",N[N.ICARUS=1]="ICARUS",N[N.ICARUS_TREZOR=2]="ICARUS_TREZOR",t.CardanoAddressType=void 0,(P=t.CardanoAddressType||(t.CardanoAddressType={}))[P.BASE=0]="BASE",P[P.BASE_SCRIPT_KEY=1]="BASE_SCRIPT_KEY",P[P.BASE_KEY_SCRIPT=2]="BASE_KEY_SCRIPT",P[P.BASE_SCRIPT_SCRIPT=3]="BASE_SCRIPT_SCRIPT",P[P.POINTER=4]="POINTER",P[P.POINTER_SCRIPT=5]="POINTER_SCRIPT",P[P.ENTERPRISE=6]="ENTERPRISE",P[P.ENTERPRISE_SCRIPT=7]="ENTERPRISE_SCRIPT",P[P.BYRON=8]="BYRON",P[P.REWARD=14]="REWARD",P[P.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,(F=t.CardanoPoolRelayType||(t.CardanoPoolRelayType={}))[F.SINGLE_HOST_IP=0]="SINGLE_HOST_IP",F[F.SINGLE_HOST_NAME=1]="SINGLE_HOST_NAME",F[F.MULTIPLE_HOST_NAME=2]="MULTIPLE_HOST_NAME",t.CardanoTxAuxiliaryDataSupplementType=void 0,(j=t.CardanoTxAuxiliaryDataSupplementType||(t.CardanoTxAuxiliaryDataSupplementType={}))[j.NONE=0]="NONE",j[j.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,(ue=t.StellarMemoType||(t.StellarMemoType={}))[ue.NONE=0]="NONE",ue[ue.TEXT=1]="TEXT",ue[ue.ID=2]="ID",ue[ue.HASH=3]="HASH",ue[ue.RETURN=4]="RETURN",t.StellarSignerType=void 0,(de=t.StellarSignerType||(t.StellarSignerType={}))[de.ACCOUNT=0]="ACCOUNT",de[de.PRE_AUTH=1]="PRE_AUTH",de[de.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}});d.util.Long=l,d.configure();var ye={check:he,buildOne:function(e,t,r){const{Message:i,messageType:n}=_(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}=b(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?d.Root.fromJSON(JSON.parse(e)):d.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},1464:(e,t,r)=>{"use strict";var i=r(6139).Promise;Object.defineProperty(t,"__esModule",{value:!0});class n extends Error{constructor(e){var t;super(),this.errorCode=s.UnknownError,this.message="",this.params={};const r=o;if(this.message=r[s.UnknownError],"string"==typeof e)this.errorCode=s.UnknownError,this.message=e;else{const s=null!==(t=e.message||r[e.errorCode])&&void 0!==t?t:"";s&&(this.message=(n=e,"string"!=typeof(i=s)?i:i.replace(/\{([^}]+)\}/g,((e,t)=>n[t]||"?")))),this.params=e.params,this.errorCode=e.errorCode}var i,n;this.name="HardwareError"}}const s={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},o={[s.UnknownError]:"Unknown error occurred. Check message property.",[s.DeviceFwException]:"Firmware version mismatch",[s.DeviceUnexpectedMode]:"Device unexpected mode",[s.DeviceListNotInitialized]:"Device list is not initialized",[s.SelectDevice]:"Please select the connected device",[s.DeviceNotFound]:"Device not found",[s.DeviceInitializeFailed]:"Device initialization failed",[s.DeviceInterruptedFromOutside]:"Device interrupted",[s.DeviceInterruptedFromUser]:"Device interrupted",[s.DeviceUnexpectedBootloaderMode]:"Device should be in bootloader mode",[s.DeviceCheckDeviceIdError]:"Device Id in the features is not same.",[s.DeviceNotSupportPassphrase]:"Device not support passphrase",[s.DeviceCheckPassphraseStateError]:"Device passphrase state error",[s.DeviceNotOpenedPassphrase]:"Device not opened passphrase",[s.DeviceOpenedPassphrase]:"Device opened passphrase",[s.NotInitialized]:"Not initialized",[s.IFrameNotInitialized]:"IFrame not initialized",[s.IFrameAleradyInitialized]:"IFrame alerady initialized",[s.IFrameLoadFail]:"IFrame load fail",[s.IframeTimeout]:"init iframe time out",[s.IframeBlocked]:"IFrame blocked",[s.CallMethodError]:"Runtime errors during method execution",[s.CallMethodNotResponse]:"Method does not responding",[s.CallMethodInvalidParameter]:"Call method invalid parameter",[s.FirmwareUpdateDownloadFailed]:"Firmware update download failed",[s.CallMethodNeedUpgradeFirmware]:"Call method need upgrade firmware",[s.CallMethodDeprecated]:"Call method is deprecated",[s.FirmwareUpdateLimitOneDevice]:"Only one device can be connected during firmware upgrade",[s.FirmwareUpdateManuallyEnterBoot]:"You need to manually enter boot",[s.FirmwareUpdateAutoEnterBootFailure]:"Description Failed to automatically enter boot",[s.NewFirmwareUnRelease]:"new firmware has not been released yet",[s.NetworkError]:"Network request error",[s.TransportNotConfigured]:"Transport not configured",[s.TransportCallInProgress]:"Transport call in progress",[s.TransportNotFound]:"Transport not found",[s.TransportInvalidProtobuf]:"Transport invalid protobuf",[s.BleScanError]:"BLE scan error",[s.BlePermissionError]:"Bluetooth required to be turned on",[s.BleLocationError]:"Location permissions for the application are not available",[s.BleRequiredUUID]:"uuid is required",[s.BleConnectedError]:"connected error is always runtime error",[s.BleDeviceNotBonded]:"device is not bonded",[s.BleServiceNotFound]:"BLEServiceNotFound: service not found",[s.BleCharacteristicNotFound]:"BLEServiceNotFound: service not found",[s.BleMonitorError]:"Monitor Error: characteristic not found",[s.BleCharacteristicNotifyError]:"Characteristic Notify Error",[s.BleWriteCharacteristicError]:"Write Characteristic Error",[s.BleAlreadyConnected]:"Already connected to device",[s.BleLocationServicesDisabled]:"Location Services disabled",[s.BleTimeoutError]:"The connection has timed out unexpectedly.",[s.RuntimeError]:"Runtime error",[s.PinInvalid]:"Pin invalid",[s.PinCancelled]:"Pin cancelled",[s.ActionCancelled]:"Action cancelled by user",[s.FirmwareError]:"Firmware installation failed",[s.ResponseUnexpectTypeError]:"Response type is not expected",[s.BridgeNetworkError]:"Bridge network error",[s.BridgeTimeoutError]:"Bridge network timeout",[s.BridgeNotInstalled]:"Bridge not installed",[s.PollingTimeout]:"Polling timeout",[s.PollingStop]:"Polling stop",[s.BlindSignDisabled]:"Please confirm the BlindSign enabled",[s.UnexpectPassphrase]:"Unexpect passphrase"},a=(e,t,r)=>new n("string"==typeof e?e:{errorCode:e,message:null!=t?t:"",params:r}),u=e=>e&&e.error instanceof n?{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(s))if(o[t]===e)return a(t);return new n(e)};var l=Object.freeze({__proto__:null,HardwareError:n,HardwareErrorCode:s,HardwareErrorCodeMessage:o,TypedError:a,serializeError:u,CreateErrorByMessage:d});t.CreateErrorByMessage=d,t.ERRORS=l,t.HardwareError=n,t.HardwareErrorCode=s,t.HardwareErrorCodeMessage=o,t.TypedError=a,t.createDeferred=function(e,t){let r,n=e=>{},s=e=>{};const o=new i(((t,o)=>{return a=this,u=void 0,l=function*(){if(n=t,s=o,"function"==typeof e)try{yield e()}catch(e){o(e)}"string"==typeof e&&(r=e)},new((d=void 0)||(d=i))((function(e,t){function r(e){try{n(l.next(e))}catch(e){t(e)}}function i(e){try{n(l.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):(n=t.value,n instanceof d?n:new d((function(e){e(n)}))).then(r,i)}n((l=l.apply(a,u||[])).next())}));var a,u,d,l}));return{id:r,data:t,resolve:n,reject:s,promise:o}},t.serializeError=u},5766:(e,t)=>{"use strict";t.byteLength=function(e){var t=u(e),r=t[0],i=t[1];return 3*(r+i)/4-i},t.toByteArray=function(e){var t,r,s=u(e),o=s[0],a=s[1],d=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)],d[l++]=t>>16&255,d[l++]=t>>8&255,d[l++]=255&t;return 2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,d[l++]=255&t),1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,d[l++]=t>>8&255,d[l++]=255&t),d},t.fromByteArray=function(e){for(var t,i=e.length,n=i%3,s=[],o=16383,a=0,u=i-n;a<u;a+=o)s.push(d(e,a,a+o>u?u:a+o));return 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]+"=")),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 u(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 d(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,u=Math.floor,d="[BigNumber Error] ",l=d+"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 _(e,t){var r,i,n=e.c,s=t.c,o=e.s,a=t.s,u=e.e,d=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=u==d,!n||!s)return i?0:!n^r?1:-1;if(!i)return u>d^r?1:-1;for(a=(u=n.length)<(d=s.length)?u:d,o=0;o<a;o++)if(n[o]!=s[o])return n[o]>s[o]^r?1:-1;return u==d?0:u>d^r?1:-1}function b(e,t,r,i){if(e<t||e>r||e!==u(e))throw Error(d+(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,x,O,A,I,C=$.prototype={constructor:$,toString:null,valueOf:null},k=new $(1),M=20,D=4,N=-7,P=21,B=-1e7,L=1e7,q=!1,F=1,j=0,U={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},z="0123456789abcdefghijklmnopqrstuvwxyz",H=!0;function $(e,t){var r,s,a,d,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(d=0,c=e;c>=10;c/=10,d++);return void(d>L?m.c=m.e=null:(m.e=d,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}(d=g.indexOf("."))>-1&&(g=g.replace(".","")),(c=g.search(/e/i))>0?(d<0&&(d=c),d+=+g.slice(c+1),g=g.substring(0,c)):d<0&&(d=g.length)}else{if(b(t,2,z.length,"Base"),10==t&&H)return K(m=new $(e),M+m.e+1,D);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),d=c=0,y=g.length;c<y;c++)if(r.indexOf(s=g.charAt(c))<0){if("."==s){if(c>d){d=y;continue}}else if(!a&&(g==g.toUpperCase()&&(g=g.toLowerCase())||g==g.toLowerCase()&&(g=g.toUpperCase()))){a=!0,c=-1,d=0;continue}return n(m,String(e),f,t)}f=!1,(d=(g=i(g,t,10,m.s)).indexOf("."))>-1?g=g.replace(".",""):d=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!==u(e)))throw Error(l+m.s*e);if((d=d-c-1)>L)m.c=m.e=null;else if(d<B)m.c=[m.e=0];else{if(m.e=d,m.c=[],c=(d+1)%p,d<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,u;if(null==r?r=D:b(r,0,8),!e.c)return e.toString();if(n=e.c[0],o=e.e,null==t)u=v(e.c),u=1==i||2==i&&(o<=N||o>=P)?E(u,o):T(u,o,"0");else if(s=(e=K(new $(e),t,r)).e,a=(u=v(e.c)).length,1==i||2==i&&(t<=s||s<=N)){for(;a<t;u+="0",a++);u=E(u,s)}else if(t-=o,u=T(u,s,"0"),s+1>a){if(--t>0)for(u+=".";t--;u+="0");}else if((t+=s-a)>0)for(s+1==a&&(u+=".");t--;u+="0");return e.s<0&&n?"-"+u:u}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,d,l,h,y,g=e.c,m=f;if(g){e:{for(n=1,d=g[0];d>=10;d/=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=d=g[h],n=1;d>=10;d/=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,d=1,h--):(g.length=h+1,d=m[p-s],g[h]=o>0?u(l/m[n-o]%m[o])*d:0),i)for(;;){if(0==h){for(s=1,o=g[0];o>=10;o/=10,s++);for(o=g[0]+=d,d=1;o>=10;o/=10,d++);s!=d&&(e.e++,g[0]==c&&(g[0]=1));break}if(g[h]+=d,g[h]!=c)break;g[h--]=0,d=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<=N||r>=P?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(d+"Object expected: "+e);if(e.hasOwnProperty(t="DECIMAL_PLACES")&&(b(r=e[t],0,g,t),M=r),e.hasOwnProperty(t="ROUNDING_MODE")&&(b(r=e[t],0,8,t),D=r),e.hasOwnProperty(t="EXPONENTIAL_AT")&&((r=e[t])&&r.pop?(b(r[0],-g,0,t),b(r[1],0,g,t),N=r[0],P=r[1]):(b(r,-g,g,t),N=-(P=r<0?-r:r))),e.hasOwnProperty(t="RANGE"))if((r=e[t])&&r.pop)b(r[0],-g,-1,t),b(r[1],1,g,t),B=r[0],L=r[1];else{if(b(r,-g,g,t),!r)throw Error(d+t+" cannot be zero: "+r);B=-(L=r<0?-r:r)}if(e.hasOwnProperty(t="CRYPTO")){if((r=e[t])!==!!r)throw Error(d+t+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw q=!r,Error(d+"crypto unavailable");q=r}else q=r}if(e.hasOwnProperty(t="MODULO_MODE")&&(b(r=e[t],0,9,t),F=r),e.hasOwnProperty(t="POW_PRECISION")&&(b(r=e[t],0,g,t),j=r),e.hasOwnProperty(t="FORMAT")){if("object"!=typeof(r=e[t]))throw Error(d+t+" not an object: "+r);U=r}if(e.hasOwnProperty(t="ALPHABET")){if("string"!=typeof(r=e[t])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(d+t+" invalid: "+r);H="0123456789"==r.slice(0,10),z=r}}return{DECIMAL_PLACES:M,ROUNDING_MODE:D,EXPONENTIAL_AT:[N,P],RANGE:[B,L],CRYPTO:q,MODULO_MODE:F,POW_PRECISION:j,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===u(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!==u(r))break e;if(0!==r)return!0}}}else if(null===i&&null===n&&(null===s||1===s||-1===s))return!0;throw Error(d+"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 u(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:b(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(d+"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]=u(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,u=e.length;a<u;){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 u,d,l,c,p,h,f,y,g=i.indexOf("."),m=M,_=D;for(g>=0&&(c=j,j=0,i=i.replace(".",""),h=(y=new $(n)).pow(i.length-g),j=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?(u=z,e):(u=e,z))).length;0==f[--c];f.pop());if(!f[0])return u.charAt(0);if(g<0?--l:(h.c=f,h.e=l,h.s=o,f=(h=r(h,y,m,_,s)).c,p=h.r,l=h.e),g=f[d=l+m+1],c=s/2,p=p||d<0||null!=f[d+1],p=_<4?(null!=g||p)&&(0==_||_==(h.s<0?3:2)):g>c||g==c&&(4==_||p||6==_&&1&f[d-1]||_==(h.s<0?8:7)),d<1||!f[0])i=p?T(u.charAt(1),-m,u.charAt(0)):u.charAt(0);else{if(f.length=d,p)for(--s;++f[--d]>s;)f[d]=0,d||(++l,f=[1].concat(f));for(c=f.length;!f[--c];);for(g=0,i="";g<=c;i+=u.charAt(f[g++]));i=T(i,l,u.charAt(0))}return i}}(),r=function(){function e(e,t,r){var i,n,s,o,a=0,u=e.length,d=t%y,l=t/y|0;for(e=e.slice();u--;)a=((n=d*(s=e[u]%y)+(i=l*s+(o=e[u]/y|0)*d)%y*y+a)/r|0)+(i/y|0)+l*o,e[u]=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 d,l,h,f,y,g,v,_,b,w,E,T,S,R,x,O,A,I=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*I:I/0:NaN);for(b=(_=new $(I)).c=[],I=s+(l=i.e-n.e)+1,a||(a=c,l=m(i.e/p)-m(n.e/p),I=I/p|0),h=0;k[h]==(C[h]||0);h++);if(k[h]>(C[h]||0)&&l--,I<0)b.push(1),f=!0;else{for(R=C.length,O=k.length,h=0,I+=2,(y=u(a/(k[0]+1)))>1&&(k=e(k,y,a),C=e(C,y,a),O=k.length,R=C.length),S=O,E=(w=C.slice(0,O)).length;E<O;w[E++]=0);A=k.slice(),A=[0].concat(A),x=k[0],k[1]>=a/2&&x++;do{if(y=0,(d=t(k,w,O,E))<0){if(T=w[0],O!=E&&(T=T*a+(w[1]||0)),(y=u(T/x))>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,O<v?A:k,v,a),v=g.length,d=1;else 0==y&&(d=y=1),v=(g=k.slice()).length;if(v<E&&(g=[0].concat(g)),r(w,g,E,a),E=w.length,-1==d)for(;t(k,w,O,E)<1;)y++,r(w,O<E?A:k,E,a),E=w.length}else 0===d&&(y++,w=[0]);b[h++]=y,w[0]?w[E++]=C[S]||0:(w=[C[S]],E=1)}while((S++<R||null!=w[0])&&I--);f=null!=w[0],b[0]||b.splice(0,1)}if(a==c){for(h=1,I=b[0];I>=10;I/=10,h++);K(_,s+(_.e=h+l*p-1)+1,o,f)}else _.e=l,_.r=+f;return _}}(),R=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,O=/^\.([^.]+)$/,A=/^-?(Infinity|NaN)$/,I=/^\s*\+(?=[\w.])|^\s+|\s+$/g,n=function(e,t,r,i){var n,s=r?t:t.replace(I,"");if(A.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(x,"$1").replace(O,"0.$1")),t!=s))return new $(s,n);if($.DEBUG)throw Error(d+"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 _(this,new $(e,t))},C.decimalPlaces=C.dp=function(e,t){var r,i,n,s=this;if(null!=e)return b(e,0,g),null==t?t=D:b(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,D)},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(d+"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);j&&(s=a(j/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=u(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,j,D,void 0):h)},C.integerValue=function(e){var t=new $(this);return null==e?e=D:b(e,0,8),K(t,t.e+1,e)},C.isEqualTo=C.eq=function(e,t){return 0===_(this,new $(e,t))},C.isFinite=function(){return!!this.c},C.isGreaterThan=C.gt=function(e,t){return _(this,new $(e,t))>0},C.isGreaterThanOrEqualTo=C.gte=function(e,t){return 1===(t=_(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 _(this,new $(e,t))<0},C.isLessThanOrEqualTo=C.lte=function(e,t){return-1===(t=_(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 u=o.e/p,d=e.e/p,l=o.c,h=e.c;if(!u||!d){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==D?-0:0)}if(u=m(u),d=m(d),l=l.slice(),a=u-d){for((s=a<0)?(a=-a,n=l):(d=u,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),--d);return l[0]?V(e,l,d):(e.s=3==D?-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==F?(n=e.s,e.s=1,i=r(s,e,0,3),e.s=n,i.s*=n):i=r(s,e,0,F),(e=s.minus(i.times(e))).c[0]||1!=F||(e.s=s.s),e)},C.multipliedBy=C.times=function(e,t){var r,i,n,s,o,a,u,d,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,(u=E.length)<(h=T.length)&&(v=E,E=T,T=v,n=u,u=h,h=n),n=u+h,v=[];n--;v.push(0));for(_=c,b=y,n=h;--n>=0;){for(r=0,f=T[n]%b,g=T[n]/b|0,s=n+(o=u);s>n;)r=((d=f*(d=E[--o]%b)+(a=g*d+(l=E[o]/b|0)*f)%b*b+v[s]+r)/_|0)+(a/b|0)+g*l,v[s--]=d%_;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,u=e.c;if(!s||!o){if(!a||!u)return new $(n/0);if(!a[0]||!u[0])return u[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=u):(n=-n,r=a),r.reverse();n--;r.push(0));r.reverse()}for((n=a.length)-(t=u.length)<0&&(r=u,u=a,a=r,t=n),n=0;t;)n=(a[--t]=a[t]+u[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 b(e,1,g),null==t?t=D:b(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 b(e,-9007199254740991,h),this.times("1e"+e)},C.squareRoot=C.sqrt=function(){var e,t,i,n,s,o=this,a=o.c,u=o.s,d=o.e,l=M+4,c=new $("0.5");if(1!==u||!a||!a[0])return new $(!u||u<0&&(!a||a[0])?NaN:a?o:1/0);if(0==(u=Math.sqrt(+Y(o)))||u==1/0?(((t=v(a)).length+d)%2==0&&(t+="0"),u=Math.sqrt(+t),d=m((d+1)/2)-(d<0||d%2),i=new $(t=u==1/0?"5e"+d:(t=u.toExponential()).slice(0,t.indexOf("e")+1)+d)):i=new $(u+""),i.c[0])for((u=(d=i.e)+l)<3&&(u=0);;)if(s=i,i=c.times(s.plus(r(o,s,l,1))),v(s.c).slice(0,u)===(t=v(i.c)).slice(0,u)){if(i.e<d&&--u,"9999"!=(t=t.slice(u-3,u+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,u+=4,n=1}return K(i,i.e+M+1,D,e)},C.toExponential=function(e,t){return null!=e&&(b(e,0,g),e++),G(this,e,t,1)},C.toFixed=function(e,t){return null!=e&&(b(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(d+"Argument not an object: "+r);if(i=n.toFixed(e,t),n.c){var s,o=i.split("."),a=+r.groupSize,u=+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(u&&(s=a,a=u,u=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);u>0&&(c+=l+f.slice(s)),h&&(c="-"+c)}i=p?c+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?p.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):p):c}return(r.prefix||"")+i+(r.suffix||"")},C.toFraction=function(e){var t,i,n,s,o,a,u,l,c,h,y,g,m=this,_=m.c;if(null!=e&&(!(u=new $(e)).isInteger()&&(u.c||1!==u.s)||u.lt(k)))throw Error(d+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+Y(u));if(!_)return new $(m);for(t=new $(k),c=i=new $(k),n=l=new $(k),g=v(_),o=t.e=g.length-m.e-1,t.c[0]=f[(a=o%p)<0?p+a:a],e=!e||u.comparedTo(t)>0?o>0?t:c:u,a=L,L=1/0,u=new $(g),l.c[0]=0;h=r(u,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=u.minus(h.times(s=t)),u=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,D).minus(m).abs().comparedTo(r(l,i,o,D).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&&b(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<=N||s>=P?E(v(r.c),s):T(v(r.c),s,"0"):10===e&&H?t=T(v((r=K(new $(r),M+s+1,D)).c),r.e,"0"):(b(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=u,t.SlowBuffer=function(e){return+e!=e&&(e=0),u.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,u.prototype),t}function u(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 d(e,t,r)}function d(e,t,r){if("string"==typeof e)return function(e,t){if("string"==typeof t&&""!==t||(t="utf8"),!u.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const r=0|y(e,t);let i=a(r);const n=i.write(e,t);return n!==r&&(i=i.slice(0,n)),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 u.from(i,t,r);const n=function(e){if(u.isBuffer(e)){const t=0|f(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||X(e.length)?a(0):p(e):"Buffer"===e.type&&Array.isArray(e.data)?p(e.data):void 0}(e);if(n)return n;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return u.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,u.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(u.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 x(this,t,r);case"ascii":return A(this,t,r);case"latin1":case"binary":return I(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=u.from(t,i)),u.isBuffer(t))return 0===t.length?-1:_(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):_(e,[t],r,i,n);throw new TypeError("val must be string, number or Buffer")}function _(e,t,r,i,n){let s,o=1,a=e.length,u=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,u/=2,r/=2}function d(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(n){let i=-1;for(s=r;s<a;s++)if(d(e,s)===d(t,-1===i?0:s-i)){if(-1===i&&(i=s),s-i+1===u)return i*o}else-1!==i&&(s-=s-i),i=-1}else for(r+u>a&&(r=a-u),s=r;s>=0;s--){let r=!0;for(let i=0;i<u;i++)if(d(e,s+i)!==d(t,i)){r=!1;break}if(r)return s}return-1}function b(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 x(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,u;switch(o){case 1:t<128&&(s=t);break;case 2:r=e[n+1],128==(192&r)&&(u=(31&t)<<6|63&r,u>127&&(s=u));break;case 3:r=e[n+1],i=e[n+2],128==(192&r)&&128==(192&i)&&(u=(15&t)<<12|(63&r)<<6|63&i,u>2047&&(u<55296||u>57343)&&(s=u));break;case 4:r=e[n+1],i=e[n+2],a=e[n+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&(u=(15&t)<<18|(63&r)<<12|(63&i)<<6|63&a,u>65535&&u<1114112&&(s=u))}}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<=O)return String.fromCharCode.apply(String,e);let r="",i=0;for(;i<t;)r+=String.fromCharCode.apply(String,e.slice(i,i+=O));return r}(i)}t.kMaxLength=o,u.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}}(),u.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(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(e,t,r){return d(e,t,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.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)},u.allocUnsafe=function(e){return c(e)},u.allocUnsafeSlow=function(e){return c(e)},u.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==u.prototype},u.compare=function(e,t){if(Y(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(e)||!u.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},u.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}},u.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return u.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;const i=u.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?(u.isBuffer(t)||(t=u.from(t)),t.copy(i,n)):Uint8Array.prototype.set.call(i,t,n);else{if(!u.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(i,n)}n+=t.length}return i},u.byteLength=y,u.prototype._isBuffer=!0,u.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},u.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},u.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},u.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?x(this,0,e):g.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===u.compare(this,e)},u.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&&(u.prototype[s]=u.prototype.inspect),u.prototype.compare=function(e,t,r,i,n){if(Y(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.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),d=this.slice(i,n),l=e.slice(t,r);for(let e=0;e<a;++e)if(d[e]!==l[e]){s=d[e],o=l[e];break}return s<o?-1:o<s?1:0},u.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},u.prototype.indexOf=function(e,t,r){return v(this,e,t,r,!0)},u.prototype.lastIndexOf=function(e,t,r){return v(this,e,t,r,!1)},u.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 b(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}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const O=4096;function A(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 I(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 D(e,t,r,i,n,s){if(!u.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 N(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 P(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}u.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,u.prototype),i},u.prototype.readUintLE=u.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},u.prototype.readUintBE=u.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},u.prototype.readUint8=u.prototype.readUInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),this[e]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]|this[e+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(e,t){return e>>>=0,t||M(e,2,this.length),this[e]<<8|this[e+1]},u.prototype.readUint32LE=u.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]},u.prototype.readUint32BE=u.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])},u.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))})),u.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)})),u.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},u.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},u.prototype.readInt8=function(e,t){return e>>>=0,t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},u.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},u.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},u.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},u.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]},u.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)})),u.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)})),u.prototype.readFloatLE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!0,23,4)},u.prototype.readFloatBE=function(e,t){return e>>>=0,t||M(e,4,this.length),n.read(this,e,!1,23,4)},u.prototype.readDoubleLE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!0,52,8)},u.prototype.readDoubleBE=function(e,t){return e>>>=0,t||M(e,8,this.length),n.read(this,e,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||D(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},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(e,t,r,i){e=+e,t>>>=0,r>>>=0,i||D(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},u.prototype.writeUint8=u.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,255,0),this[t]=255&e,t+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(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},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(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},u.prototype.writeBigUInt64LE=J((function(e,t=0){return N(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);D(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},u.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t>>>=0,!i){const i=Math.pow(2,8*r-1);D(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},u.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},u.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},u.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||D(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},u.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||D(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},u.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||D(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},u.prototype.writeBigInt64LE=J((function(e,t=0){return N(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(e,t,r){return L(this,e,t,!0,r)},u.prototype.writeFloatBE=function(e,t,r){return L(this,e,t,!1,r)},u.prototype.writeDoubleLE=function(e,t,r){return q(this,e,t,!0,r)},u.prototype.writeDoubleBE=function(e,t,r){return q(this,e,t,!1,r)},u.prototype.copy=function(e,t,r,i){if(!u.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},u.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&&!u.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=u.isBuffer(e)?e:u.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 F={};function j(e,t,r){F[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 F.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 F.ERR_INVALID_ARG_TYPE(t,"number",e)}function $(e,t,r){if(Math.floor(e)!==e)throw H(e,r),new F.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new F.ERR_BUFFER_OUT_OF_BOUNDS;throw new F.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}j("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),j("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),j("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,u=(1<<a)-1,d=u>>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-d;else{if(s===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=d}return(h?-1:1)*o*Math.pow(2,s-i)}function u(e,t,r,i,n,s){var o,a,u,d=8*s-n-1,l=(1<<d)-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*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(t*u-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,d+=n;d>0;e[r+h]=255&o,h+=f,o/=256,d-=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,u=e.length;a<u;++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 d,l=new t(o,i,n);for(a=0;a<u;)(s=(d=e[a++]).limit-d.offset)<=0||(l.view.set(d.view.subarray(d.offset,d.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 u=0;for(i=0;a<s;)i|=(1&!!e[a++])<<u++;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 u=0;for(r=this.readByte(e++);o<n;)a[o++]=!!(r>>u++&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,u(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,u(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,u=r.shiftRightUnsigned(56).toInt()>>>0;i+=s;var d=this.buffer.byteLength;switch(i>d&&this.resize((d*=2)>i?d:i),i-=s,s){case 10:this.view[i+9]=u>>>7&1;case 9:this.view[i+8]=9!==s?128|u:127&u;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 u=e.fromBits(n|s<<28,s>>>4|o<<24,!1);return r?(this.offset=t,u):{value:u,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,u=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-u}}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 d=i+e;if(l.decodeUTF8toUTF16(function(){return i<d?this.view[i++]:null}.bind(this),s=o(),this.noAssert),i!==d)throw RangeError("Illegal range: Truncated data, "+i+" == "+d);return n?(this.offset=i,s()):{string:s(),length:i-u}}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 u=this.buffer.byteLength;if(r>u&&this.resize((u*=2)>r?u: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),u=new Uint8Array(a);u.set(this.view.subarray(i,this.buffer.byteLength),s),this.buffer=a,this.view=u,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 d=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 d.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 d.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),u=0,d=0,l=!1,c=!1,p=!1,h=!1,f=!1;u<o;){switch(n=e.charAt(u++)){case"!":if(!i){if(c||p||h){f=!0;break}c=p=h=!0}a.offset=a.markedOffset=a.limit=d,l=!1;break;case"|":if(!i){if(c||h){f=!0;break}c=h=!0}a.offset=a.limit=d,l=!1;break;case"[":if(!i){if(c||p){f=!0;break}c=p=!0}a.offset=a.markedOffset=d,l=!1;break;case"<":if(!i){if(c){f=!0;break}c=!0}a.offset=d,l=!1;break;case"]":if(!i){if(h||p){f=!0;break}h=p=!0}a.limit=a.markedOffset=d,l=!1;break;case">":if(!i){if(h){f=!0;break}h=!0}a.limit=d,l=!1;break;case"'":if(!i){if(p){f=!0;break}p=!0}a.markedOffset=d,l=!1;break;case" ":l=!1;break;default:if(!i&&l){f=!0;break}if(s=parseInt(n+e.charAt(u++),16),!i&&(isNaN(s)||s<0||s>255))throw TypeError("Illegal str: Not a debug encoded string");a.view[d++]=s,l=!0}if(f)throw TypeError("Illegal str: Invalid symbol at "+u)}if(!i){if(!c||!h)throw TypeError("Illegal str: Missing offset or limit");if(d<a.buffer.byteLength)throw TypeError("Illegal str: Not a debug encoded string (is it hex?) "+d+" < "+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,u=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[u++]=n}return o.limit=u,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=i.apply(t,n))||(e.exports=s)},6874:function(e,t){var r,i;void 0===(i="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?y:f;if(t){if(e<0)return y;if(e>=c)return b}else{if(e<=-p)return w;if(e+1>=p)return _}return e<0?s(-e,t).neg():o(e%l|0,e/l|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 u(e,t,r){if(0===e.length)throw Error("empty string");if("NaN"===e||"Infinity"===e||"+Infinity"===e||"-Infinity"===e)return f;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 u(e.substring(1),t,r).neg();for(var n=s(a(r,8)),o=f,d=0;d<e.length;d+=8){var l=Math.min(8,e.length-d),c=parseInt(e.substring(d,d+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 d(t){return t instanceof e?t:"number"==typeof t?s(t):"string"==typeof t?u(t):o(t.low,t.high,t.unsigned)}e.fromString=u,e.fromValue=d;var l=4294967296,c=l*l,p=c/2,h=n(1<<24),f=n(0);e.ZERO=f;var y=n(0,!0);e.UZERO=y;var g=n(1);e.ONE=g;var m=n(1,!0);e.UONE=m;var v=n(-1);e.NEG_ONE=v;var _=o(-1,2147483647,!1);e.MAX_VALUE=_;var b=o(-1,-1,!0);e.MAX_UNSIGNED_VALUE=b;var w=o(0,-2147483648,!1);e.MIN_VALUE=w;var E=e.prototype;return E.toInt=function(){return this.unsigned?this.low>>>0:this.low},E.toNumber=function(){return this.unsigned?(this.high>>>0)*l+(this.low>>>0):this.high*l+(this.low>>>0)},E.toString=function(e){if((e=e||10)<2||36<e)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative()){if(this.eq(w)){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,u="";;){var d=o.div(n),l=(o.sub(d.mul(n)).toInt()>>>0).toString(e);if((o=d).isZero())return l+u;for(;l.length<6;)l="0"+l;u=""+l+u}},E.getHighBits=function(){return this.high},E.getHighBitsUnsigned=function(){return this.high>>>0},E.getLowBits=function(){return this.low},E.getLowBitsUnsigned=function(){return this.low>>>0},E.getNumBitsAbs=function(){if(this.isNegative())return this.eq(w)?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},E.isZero=function(){return 0===this.high&&0===this.low},E.isNegative=function(){return!this.unsigned&&this.high<0},E.isPositive=function(){return this.unsigned||this.high>=0},E.isOdd=function(){return 1==(1&this.low)},E.isEven=function(){return 0==(1&this.low)},E.equals=function(e){return t(e)||(e=d(e)),(this.unsigned===e.unsigned||this.high>>>31!=1||e.high>>>31!=1)&&this.high===e.high&&this.low===e.low},E.eq=E.equals,E.notEquals=function(e){return!this.eq(e)},E.neq=E.notEquals,E.lessThan=function(e){return this.comp(e)<0},E.lt=E.lessThan,E.lessThanOrEqual=function(e){return this.comp(e)<=0},E.lte=E.lessThanOrEqual,E.greaterThan=function(e){return this.comp(e)>0},E.gt=E.greaterThan,E.greaterThanOrEqual=function(e){return this.comp(e)>=0},E.gte=E.greaterThanOrEqual,E.compare=function(e){if(t(e)||(e=d(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},E.comp=E.compare,E.negate=function(){return!this.unsigned&&this.eq(w)?w:this.not().add(g)},E.neg=E.negate,E.add=function(e){t(e)||(e=d(e));var r=this.high>>>16,i=65535&this.high,n=this.low>>>16,s=65535&this.low,a=e.high>>>16,u=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+u)>>>16,c+=r+a,o((h&=65535)<<16|(f&=65535),(c&=65535)<<16|(p&=65535),this.unsigned)},E.subtract=function(e){return t(e)||(e=d(e)),this.add(e.neg())},E.sub=E.subtract,E.multiply=function(e){if(this.isZero())return f;if(t(e)||(e=d(e)),e.isZero())return f;if(this.eq(w))return e.isOdd()?w:f;if(e.eq(w))return this.isOdd()?w:f;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(h)&&e.lt(h))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,u=e.high>>>16,l=65535&e.high,c=e.low>>>16,p=65535&e.low,y=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,y+=(g+=i*p)>>>16,g&=65535,y+=(g+=n*c)>>>16,g&=65535,y+=(g+=a*l)>>>16,y+=r*p+i*c+n*l+a*u,o((m&=65535)<<16|(v&=65535),(y&=65535)<<16|(g&=65535),this.unsigned)},E.mul=E.multiply,E.divide=function(e){if(t(e)||(e=d(e)),e.isZero())throw Error("division by zero");if(this.isZero())return this.unsigned?y:f;var r,i,n;if(this.unsigned){if(e.unsigned||(e=e.toUnsigned()),e.gt(this))return y;if(e.gt(this.shru(1)))return m;n=y}else{if(this.eq(w))return e.eq(g)||e.eq(v)?w:e.eq(w)?g:(r=this.shr(1).div(e).shl(1)).eq(f)?e.isNegative()?g:v:(i=this.sub(e.mul(r)),n=r.add(i.div(e)));if(e.eq(w))return this.unsigned?y:f;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=f}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),u=o<=48?1:a(2,o-48),l=s(r),c=l.mul(e);c.isNegative()||c.gt(i);)c=(l=s(r-=u,this.unsigned)).mul(e);l.isZero()&&(l=g),n=n.add(l),i=i.sub(c)}return n},E.div=E.divide,E.modulo=function(e){return t(e)||(e=d(e)),this.sub(this.div(e).mul(e))},E.mod=E.modulo,E.not=function(){return o(~this.low,~this.high,this.unsigned)},E.and=function(e){return t(e)||(e=d(e)),o(this.low&e.low,this.high&e.high,this.unsigned)},E.or=function(e){return t(e)||(e=d(e)),o(this.low|e.low,this.high|e.high,this.unsigned)},E.xor=function(e){return t(e)||(e=d(e)),o(this.low^e.low,this.high^e.high,this.unsigned)},E.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)},E.shl=E.shiftLeft,E.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)},E.shr=E.shiftRight,E.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)},E.shru=E.shiftRightUnsigned,E.toSigned=function(){return this.unsigned?o(this.low,this.high,!1):this},E.toUnsigned=function(){return this.unsigned?this:o(this.low,this.high,!0)},E.toBytes=function(e){return e?this.toBytesLE():this.toBytesBE()},E.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]},E.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,[]):r)||(e.exports=i)},6139:function(e,t,r){var i=r(4406);e.exports=function(){"use strict";function e(e){return"function"==typeof e}var t=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},n=0,s=void 0,o=void 0,a=function(e,t){f[n]=e,f[n+1]=t,2===(n+=2)&&(o?o(y):b())};var u="undefined"!=typeof window?window:void 0,d=u||{},l=d.MutationObserver||d.WebKitMutationObserver,c="undefined"==typeof self&&void 0!==i&&"[object process]"==={}.toString.call(i),p="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(y,1)}}var f=new Array(1e3);function y(){for(var e=0;e<n;e+=2)(0,f[e])(f[e+1]),f[e]=void 0,f[e+1]=void 0;n=0}var g,m,v,_,b=void 0;function w(e,t){var r=this,i=new this.constructor(S);void 0===i[T]&&P(i);var n=r._state;if(n){var s=arguments[n-1];a((function(){return D(n,i,s,r._result)}))}else k(r,i,e,t);return i}function E(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(S);return O(t,e),t}b=c?function(){return i.nextTick(y)}:l?(m=0,v=new l(y),_=document.createTextNode(""),v.observe(_,{characterData:!0}),function(){_.data=m=++m%2}):p?((g=new MessageChannel).port1.onmessage=y,function(){return g.port2.postMessage(0)}):void 0===u?function(){try{var e=Function("return this")().require("vertx");return void 0!==(s=e.runOnLoop||e.runOnContext)?function(){s(y)}:h()}catch(e){return h()}}():h();var T=Math.random().toString(36).substring(2);function S(){}var R=void 0;function x(t,r,i){r.constructor===t.constructor&&i===w&&r.constructor.resolve===E?function(e,t){1===t._state?I(e,t._result):2===t._state?C(e,t._result):k(t,void 0,(function(t){return O(e,t)}),(function(t){return C(e,t)}))}(t,r):void 0===i?I(t,r):e(i)?function(e,t,r){a((function(e){var i=!1,n=function(e,t,r,i){try{e.call(t,r,i)}catch(e){return e}}(r,t,(function(r){i||(i=!0,t!==r?O(e,r):I(e,r))}),(function(t){i||(i=!0,C(e,t))}),e._label);!i&&n&&(i=!0,C(e,n))}),e)}(t,r,i):I(t,r)}function O(e,t){if(e===t)C(e,new TypeError("You cannot resolve a promise with itself"));else if(n=typeof(i=t),null===i||"object"!==n&&"function"!==n)I(e,t);else{var r=void 0;try{r=t.then}catch(t){return void C(e,t)}x(e,t,r)}var i,n}function A(e){e._onerror&&e._onerror(e._result),M(e)}function I(e,t){e._state===R&&(e._result=t,e._state=1,0!==e._subscribers.length&&a(M,e))}function C(e,t){e._state===R&&(e._state=2,e._result=t,a(A,e))}function k(e,t,r,i){var n=e._subscribers,s=n.length;e._onerror=null,n[s]=t,n[s+1]=r,n[s+2]=i,0===s&&e._state&&a(M,e)}function M(e){var t=e._subscribers,r=e._state;if(0!==t.length){for(var i=void 0,n=void 0,s=e._result,o=0;o<t.length;o+=3)i=t[o],n=t[o+r],i?D(r,i,n,s):n(s);e._subscribers.length=0}}function D(t,r,i,n){var s=e(i),o=void 0,a=void 0,u=!0;if(s){try{o=i(n)}catch(e){u=!1,a=e}if(r===o)return void C(r,new TypeError("A promises callback cannot return that same promise."))}else o=n;r._state!==R||(s&&u?O(r,o):!1===u?C(r,a):1===t?I(r,o):2===t&&C(r,o))}var N=0;function P(e){e[T]=N++,e._state=void 0,e._result=void 0,e._subscribers=[]}var B=function(){function e(e,r){this._instanceConstructor=e,this.promise=new e(S),this.promise[T]||P(this.promise),t(r)?(this.length=r.length,this._remaining=r.length,this._result=new Array(this.length),0===this.length?I(this.promise,this._result):(this.length=this.length||0,this._enumerate(r),0===this._remaining&&I(this.promise,this._result))):C(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===R&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var r=this._instanceConstructor,i=r.resolve;if(i===E){var n=void 0,s=void 0,o=!1;try{n=e.then}catch(e){o=!0,s=e}if(n===w&&e._state!==R)this._settledAt(e._state,t,e._result);else if("function"!=typeof n)this._remaining--,this._result[t]=e;else if(r===L){var a=new r(S);o?C(a,s):x(a,e,n),this._willSettleAt(a,t)}else this._willSettleAt(new r((function(t){return t(e)})),t)}else this._willSettleAt(i(e),t)},e.prototype._settledAt=function(e,t,r){var i=this.promise;i._state===R&&(this._remaining--,2===e?C(i,r):this._result[t]=r),0===this._remaining&&I(i,this._result)},e.prototype._willSettleAt=function(e,t){var r=this;k(e,void 0,(function(e){return r._settledAt(1,t,e)}),(function(e){return r._settledAt(2,t,e)}))},e}();var L=function(){function t(e){this[T]=N++,this._result=this._state=void 0,this._subscribers=[],S!==e&&("function"!=typeof e&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof t?function(e,t){try{t((function(t){O(e,t)}),(function(t){C(e,t)}))}catch(t){C(e,t)}}(this,e):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return t.prototype.catch=function(e){return this.then(null,e)},t.prototype.finally=function(t){var r=this,i=r.constructor;return e(t)?r.then((function(e){return i.resolve(t()).then((function(){return e}))}),(function(e){return i.resolve(t()).then((function(){throw e}))})):r.then(t,t)},t}();return L.prototype.then=w,L.all=function(e){return new B(this,e).promise},L.race=function(e){var r=this;return t(e)?new r((function(t,i){for(var n=e.length,s=0;s<n;s++)r.resolve(e[s]).then(t,i)})):new r((function(e,t){return t(new TypeError("You must pass an array to race."))}))},L.resolve=E,L.reject=function(e){var t=new this(S);return C(t,e),t},L._setScheduler=function(e){o=e},L._setAsap=function(e){a=e},L._asap=a,L.polyfill=function(){var e=void 0;if(void 0!==r.g)e=r.g;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var i=null;try{i=Object.prototype.toString.call(t.resolve())}catch(e){}if("[object Promise]"===i&&!t.cast)return}e.Promise=L},L.Promise=L,L}()},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()),u(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 d=i.pop();4===d.length?Object.defineProperty(d[0],d[1],d[3]):d[0][d[1]]=d[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 u(e,i,n,s,o,d,l){var c;if(d+=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&&d>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++)u(e[c],c,c,s,e,d,l);else{var p=Object.keys(e);for(c=0;c<p.length;c++){var h=p[c];u(e[h],h,c,s,e,d,l)}}s.pop()}}function d(e,t){return e<t?-1:e>t?1:0}function l(e,t,r,o){void 0===o&&(o=s());var a,u=c(e,"",0,[],void 0,0,o)||e;try{a=0===n.length?JSON.stringify(u,t,r):JSON.stringify(u,p(t),r)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==i.length;){var d=i.pop();4===d.length?Object.defineProperty(d[0],d[1],d[3]):d[0][d[1]]=d[2]}}return a}function c(e,n,s,o,u,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,u);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==p.depthLimit&&l>p.depthLimit)return void a(t,e,n,u);if(void 0!==p.edgesLimit&&s+1>p.edgesLimit)return void a(t,e,n,u);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(d);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===u)return f;i.push([u,n,e]),u[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,u=(1<<a)-1,d=u>>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-d;else{if(s===u)return o?NaN:1/0*(h?-1:1);o+=Math.pow(2,i),s-=d}return(h?-1:1)*o*Math.pow(2,s-i)},t.write=function(e,t,r,i,n,s){var o,a,u,d=8*s-n-1,l=(1<<d)-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*(u=Math.pow(2,-o))<1&&(o--,u*=2),(t+=o+c>=1?p/u:p*Math.pow(2,1-c))*u>=2&&(o++,u/=2),o+c>=l?(a=0,o=l):o+c>=1?(a=(t*u-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,d+=n;d>0;e[r+h]=255&o,h+=f,o/=256,d-=8);e[r+h-f]|=128*y}},1297:(e,t,r)=>{var i=r(6139).Promise,n=r(8834).Buffer,s=r(4406);e.exports=function e(t,r,i){function n(o,a){if(!r[o]){if(!t[o]){if(s)return s(o,!0);var u=new Error("Cannot find module '"+o+"'");throw u.code="MODULE_NOT_FOUND",u}var d=r[o]={exports:{}};t[o][0].call(d.exports,(function(e){return n(t[o][1][e]||e)}),d,d.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,u,d,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,u=1<h?(15&r)<<2|n>>6:64,d=2<h?63&n:64,l.push(s.charAt(o)+s.charAt(a)+s.charAt(u)+s.charAt(d));return l.join("")},r.decode=function(e){var t,r,i,o,a,u,d=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);d<e.length;)t=s.indexOf(e.charAt(d++))<<2|(o=s.indexOf(e.charAt(d++)))>>4,r=(15&o)<<4|(a=s.indexOf(e.charAt(d++)))>>2,i=(3&a)<<6|(u=s.indexOf(e.charAt(d++))),p[l++]=t,64!==a&&(p[l++]=r),64!==u&&(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=0+r;e^=-1;for(var a=0;a<o;a++)e=e>>>8^s[255&(e^t[a])];return-1^e}(0|t,e,e.length):function(e,t,r,i){var s=n,o=0+r;e^=-1;for(var a=0;a<o;a++)e=e>>>8^s[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length):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 n;n=void 0!==i?i:e("lie"),t.exports={Promise:n}},{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 u(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}r.magic="\b\0",s.inherits(u,o),u.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},u.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},u.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},u.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 u("Deflate",e)},r.uncompressWorker=function(){return new u("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,_=s.transformTo("string",l(v)),b=s.transformTo("string",a.utf8encode(v)),w=m.length!==h.name.length,E=b.length!==v.length,T="",S="",R="",x=h.dir,O=h.date,A={crc32:0,compressedSize:0,uncompressedSize:0};t&&!r||(A.crc32=e.crc32,A.compressedSize=e.compressedSize,A.uncompressedSize=e.uncompressedSize);var I=0;t&&(I|=8),y||!w&&!E||(I|=2048);var C=0,k=0;x&&(C|=16),"UNIX"===o?(k=798,C|=function(e,t){var r=e;return e||(r=t?16893:33204),(65535&r)<<16}(h.unixPermissions,x)):(k=20,C|=function(e){return 63&(e||0)}(h.dosPermissions)),c=O.getUTCHours(),c<<=6,c|=O.getUTCMinutes(),c<<=5,c|=O.getUTCSeconds()/2,p=O.getUTCFullYear()-1980,p<<=4,p|=O.getUTCMonth()+1,p<<=5,p|=O.getUTCDate(),w&&(S=i(1,1)+i(u(g),4)+m,T+="up"+i(S.length,2)+S),E&&(R=i(1,1)+i(u(_),4)+b,T+="uc"+i(R.length,2)+R);var M="";return M+="\n\0",M+=i(I,2),M+=f.magic,M+=i(c,2),M+=i(p,2),M+=i(A.crc32,4),M+=i(A.compressedSize,4),M+=i(A.uncompressedSize,4),M+=i(g.length,2),M+=i(T.length,2),{fileRecord:d.LOCAL_FILE_HEADER+M+g+T,dirRecord:d.CENTRAL_FILE_HEADER+i(k,2)+M+i(_.length,2)+"\0\0\0\0"+i(C,4)+i(n,4)+g+T+_}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),u=e("../crc32"),d=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 d.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 d.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||{},u=r.dir,d=r.date;r._compressWorker(n,a).withStreamInfo("file",{name:e,dir:u,date:d,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"),u=e("./nodejsUtils");function d(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}),u.isNode&&u.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(d(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],u=a.fileNameStr,d=i.resolve(a.fileNameStr);r.file(d,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(d).unsafeOriginalName=u)}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:void 0!==n,newBufferFrom:function(e,t){if(n.from&&n.from!==Uint8Array.from)return n.from(e,t);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new n(e,t)},allocBuffer:function(e){if(n.alloc)return n.alloc(e);var t=new n(e);return t.fill(0),t},isBuffer:function(e){return n.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||{},u);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 d&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",n="string");var m;m=t instanceof d||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"),u=e("./defaults"),d=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:u.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"),u=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 u(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"),s=e("./ConvertWorker"),o=e("./GenericWorker"),a=e("../base64"),u=e("../support"),d=e("../external"),l=null;if(u.nodestream)try{l=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function c(e,t,r){var n=t;switch(t){case"blob":case"arraybuffer":n="uint8array";break;case"base64":n="string"}try{this._internalType=n,this._outputType=t,this._mimeType=r,i.checkSupport(n),this._worker=e.pipe(new s(n)),e.lock()}catch(e){this._worker=new o("error"),this._worker.error(e)}}c.prototype={accumulate:function(e){return function(e,t){return new d.Promise((function(r,s){var o=[],u=e._internalType,d=e._outputType,l=e._mimeType;e.on("data",(function(e,r){o.push(e),t&&t(r)})).on("error",(function(e){o=[],s(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 a.encode(t);default:return i.transformTo(e,t)}}(d,function(e,t){var r,i=0,s=null,o=0;for(r=0;r<t.length;r++)o+=t[r].length;switch(e){case"string":return t.join("");case"array":return Array.prototype.concat.apply([],t);case"uint8array":for(s=new Uint8Array(o),r=0;r<t.length;r++)s.set(t[r],i),i+=t[r].length;return s;case"nodebuffer":return n.concat(t);default:throw new Error("concat : unsupported type '"+e+"'")}}(u,o),l);r(e)}catch(e){s(e)}o=[]})).resume()}))}(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 l(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=void 0!==n,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 s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),r.blob=0===s.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),u=0;u<256;u++)a[u]=252<=u?6:248<=u?5:240<=u?4:224<=u?3:192<=u?2:1;function d(){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,u=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++),u+=r<128?1:r<2048?2:r<65536?3:4;for(t=n.uint8array?new Uint8Array(u):new Array(u),s=o=0;o<u;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,u=new Array(2*o);for(t=r=0;t<o;)if((n=e[t++])<128)u[r++]=n;else if(4<(s=a[n]))u[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?u[r++]=65533:n<65536?u[r++]=n:(n-=65536,u[r++]=55296|n>>10&1023,u[r++]=56320|1023&n)}return u.length!==r&&(u.subarray?u=u.subarray(0,r):u.length=r),i.applyFromCharCode(u)}(e=i.transformTo(n.uint8array?"uint8array":"array",e))},i.inherits(d,o),d.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),u=t;o!==t.length&&(n.uint8array?(u=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(u=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:r.utf8decode(u),meta:e.meta})},d.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:r.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},r.Utf8DecodeWorker=d,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 u(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 d={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=d.applyCanBeUsed.uint8array:"nodebuffer"===i&&(n=d.applyCanBeUsed.nodebuffer),n)for(;1<t;)try{return d.stringifyByChunk(e,i,t)}catch(e){t=Math.floor(t/2)}return d.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 u(e,new Array(e.length))},arraybuffer:function(e){return p.string.uint8array(e).buffer},uint8array:function(e){return u(e,new Uint8Array(e.length))},nodebuffer:function(e){return u(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,d){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&&(d?t=n.decode(t):s&&!0!==a&&(t=function(e){return u(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 u(e){this.files=[],this.loadOptions=e}u.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=u},{"./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"),u=e("./compressions"),d=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 u)if(Object.prototype.hasOwnProperty.call(u,t)&&u[t].magic===e)return u[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=d.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"),u=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 u("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 u?this._data:new s(this._data)}};for(var d=["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<d.length;c++)i.prototype[d[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 u=new e.MessageChannel;u.port1.onmessage=l,r=function(){u.port2.postMessage(0)}}var d=[];function l(){var e,t;i=!0;for(var r=d.length;r;){for(t=d,d=[],e=-1;++e<r;)t[e]();r=d.length}i=!1}t.exports=function(e){1!==d.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"],u=["PENDING"];function d(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=u,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=d).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}))}))},d.prototype.catch=function(e){return this.then(null,e)},d.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!==u?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},d.resolve=function(e){return e instanceof this?e:s.resolve(new this(n),e)},d.reject=function(e){var t=new this(n);return s.reject(t,e)},d.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,u=-1,d=new this(n);++u<r;)l(e[u],u);return d;function l(e,n){t.resolve(e).then((function(e){o[n]=e,++a!==r||i||(i=!0,s.resolve(d,o))}),(function(e){i||(i=!0,s.reject(d,e))}))}},d.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var t=e.length,r=!1;if(!t)return this.resolve([]);for(var i,o=-1,a=new this(n);++o<t;)i=e[o],this.resolve(i).then((function(e){r||(r=!0,s.resolve(a,e))}),(function(e){r||(r=!0,s.reject(a,e))}));return a}},{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"),u=Object.prototype.toString;function d(e){if(!(this instanceof d))return new d(e);this.options=n.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,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(0!==r)throw new Error(o[r]);if(t.header&&i.deflateSetHeader(this.strm,t.header),t.dictionary){var l;if(l="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=i.deflateSetDictionary(this.strm,l)))throw new Error(o[r]);this._dict_set=!0}}function l(e,t){var r=new d(t);if(r.push(e,!0),r.err)throw r.msg||o[r.err];return r.result}d.prototype.push=function(e,t){var r,o,a=this.strm,d=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]"===u.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(d),a.next_out=0,a.avail_out=d),1!==(r=i.deflate(a,o))&&0!==r)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,0===r):2!==o||(this.onEnd(0),!(a.avail_out=0))},d.prototype.onData=function(e){this.chunks.push(e)},d.prototype.onEnd=function(e){0===e&&("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=d,r.deflate=l,r.deflateRaw=function(e,t){return(t=t||{}).raw=!0,l(e,t)},r.gzip=function(e,t){return(t=t||{}).gzip=!0,l(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"),u=e("./zlib/zstream"),d=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 u,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 d,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,u,d,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?(u=s.utf8border(h.output,h.next_out),d=h.next_out-u,c=s.buf2string(h.output,u),h.next_out=d,h.avail_out=f-d,d&&n.arraySet(h.output,h.output,u,d,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 u(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,u=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++),u+=r<128?1:r<2048?2:r<65536?3:4;for(t=new i.Buf8(u),s=o=0;o<u;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 u(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,d=new Array(2*a);for(r=i=0;r<a;)if((n=e[r++])<128)d[i++]=n;else if(4<(s=o[n]))d[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?d[i++]=65533:n<65536?d[i++]=n:(n-=65536,d[i++]=55296|n>>10&1023,d[i++]=56320|1023&n)}return u(d,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"),u=e("./messages"),d=-2,l=258,c=262,p=113;function h(e,t){return e.msg=u[t],t}function f(e){return(e<<1)-(4<e?9:0)}function y(e){for(var t=e.length;0<=--t;)e[t]=0}function g(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 m(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,g(e.strm)}function v(e,t){e.pending_buf[e.pending++]=t}function _(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function b(e,t){var r,i,n=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,u=e.strstart>e.w_size-c?e.strstart-(e.w_size-c):0,d=e.window,p=e.w_mask,h=e.prev,f=e.strstart+l,y=d[s+o-1],g=d[s+o];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(d[(r=t)+o]===g&&d[r+o-1]===y&&d[r]===d[s]&&d[++r]===d[s+1]){s+=2,r++;do{}while(d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&d[++s]===d[++r]&&s<f);if(i=l-(f-s),s=f-l,o<i){if(e.match_start=t,a<=(o=i))break;y=d[s+o-1],g=d[s+o]}}}while((t=h[t&p])>u&&0!=--n);return o<=e.lookahead?o:e.lookahead}function w(e){var t,r,i,s,u,d,l,p,h,f,y=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=y+(y-c)){for(n.arraySet(e.window,e.window,y,y,0),e.match_start-=y,e.strstart-=y,e.block_start-=y,t=r=e.hash_size;i=e.head[--t],e.head[t]=y<=i?i-y:0,--r;);for(t=r=y;i=e.prev[--t],e.prev[t]=y<=i?i-y:0,--r;);s+=y}if(0===e.strm.avail_in)break;if(d=e.strm,l=e.window,p=e.strstart+e.lookahead,f=void 0,(h=s)<(f=d.avail_in)&&(f=h),r=0===f?0:(d.avail_in-=f,n.arraySet(l,d.input,d.next_in,f,p),1===d.state.wrap?d.adler=o(d.adler,l,f,p):2===d.state.wrap&&(d.adler=a(d.adler,l,f,p)),d.next_in+=f,d.total_in+=f,f),e.lookahead+=r,e.lookahead+e.insert>=3)for(u=e.strstart-e.insert,e.ins_h=e.window[u],e.ins_h=(e.ins_h<<e.hash_shift^e.window[u+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[u+3-1])&e.hash_mask,e.prev[u&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=u,u++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<c&&0!==e.strm.avail_in)}function E(e,t){for(var r,i;;){if(e.lookahead<c){if(w(e),e.lookahead<c&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-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-c&&(e.match_length=b(e,r)),e.match_length>=3)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-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&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}function T(e,t){for(var r,i,n;;){if(e.lookahead<c){if(w(e),e.lookahead<c&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-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=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-c&&(e.match_length=b(e,r),e.match_length<=5&&(1===e.strategy||3===e.match_length&&4096<e.strstart-e.match_start)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){for(n=e.strstart+e.lookahead-3,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),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+3-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=2,e.strstart++,i&&(m(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=s._tr_tally(e,0,e.window[e.strstart-1]))&&m(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}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<2?e.strstart:2,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}function S(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 R(){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=8,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(1146),this.dyn_dtree=new n.Buf16(122),this.bl_tree=new n.Buf16(78),y(this.dyn_ltree),y(this.dyn_dtree),y(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new n.Buf16(16),this.heap=new n.Buf16(573),y(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new n.Buf16(573),y(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 x(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:p,e.adler=2===t.wrap?0:1,t.last_flush=0,s._tr_init(t),0):h(e,d)}function O(e){var t=x(e);return 0===t&&function(e){e.window_size=2*e.w_size,y(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=2,e.match_available=0,e.ins_h=0}(e.state),t}function A(e,t,r,i,s,o){if(!e)return d;var a=1;if(-1===t&&(t=6),i<0?(a=0,i=-i):15<i&&(a=2,i-=16),s<1||9<s||8!==r||i<8||15<i||t<0||9<t||o<0||4<o)return h(e,d);8===i&&(i=9);var u=new R;return(e.state=u).strm=e,u.wrap=a,u.gzhead=null,u.w_bits=i,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=s+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+3-1)/3),u.window=new n.Buf8(2*u.w_size),u.head=new n.Buf16(u.hash_size),u.prev=new n.Buf16(u.w_size),u.lit_bufsize=1<<s+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new n.Buf8(u.pending_buf_size),u.d_buf=1*u.lit_bufsize,u.l_buf=3*u.lit_bufsize,u.level=t,u.strategy=o,u.method=r,O(e)}i=[new S(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(w(e),0===e.lookahead&&0===t)return 1;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,m(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-c&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(m(e,!1),e.strm.avail_out),1)})),new S(4,4,8,4,E),new S(4,5,16,8,E),new S(4,6,32,32,E),new S(4,4,16,16,T),new S(8,16,32,32,T),new S(8,16,128,128,T),new S(8,32,128,256,T),new S(32,128,258,1024,T),new S(32,258,258,4096,T)],r.deflateInit=function(e,t){return A(e,t,8,15,8,0)},r.deflateInit2=A,r.deflateReset=O,r.deflateResetKeep=x,r.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?d:(e.state.gzhead=t,0):d},r.deflate=function(e,t){var r,n,o,u;if(!e||!e.state||5<t||t<0)return e?h(e,d):d;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return h(e,0===e.avail_out?-5:d);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,v(n,31),v(n,139),v(n,8),n.gzhead?(v(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)),v(n,255&n.gzhead.time),v(n,n.gzhead.time>>8&255),v(n,n.gzhead.time>>16&255),v(n,n.gzhead.time>>24&255),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(v(n,255&n.gzhead.extra.length),v(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):(v(n,0),v(n,0),v(n,0),v(n,0),v(n,0),v(n,9===n.level?2:2<=n.strategy||n.level<2?4:0),v(n,3),n.status=p);else{var c=8+(n.w_bits-8<<4)<<8;c|=(2<=n.strategy||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(c|=32),c+=31-c%31,n.status=p,_(n,c),0!==n.strstart&&(_(n,e.adler>>>16),_(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)),g(e),o=n.pending,n.pending!==n.pending_buf_size));)v(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)),g(e),o=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,v(n,u)}while(0!==u);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===u&&(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)),g(e),o=n.pending,n.pending===n.pending_buf_size)){u=1;break}u=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,v(n,u)}while(0!==u);n.gzhead.hcrc&&n.pending>o&&(e.adler=a(e.adler,n.pending_buf,n.pending-o,o)),0===u&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&g(e),n.pending+2<=n.pending_buf_size&&(v(n,255&e.adler),v(n,e.adler>>8&255),e.adler=0,n.status=p)):n.status=p),0!==n.pending){if(g(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&f(t)<=f(r)&&4!==t)return h(e,-5);if(666===n.status&&0!==e.avail_in)return h(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var b=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(w(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=l){if(w(e),e.lookahead<=l&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&0<e.strstart&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+l;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=l-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=s._tr_tally(e,1,e.match_length-3),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&&(m(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(m(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(m(e,!1),0===e.strm.avail_out)?1:2}(n,t):i[n.level].func(n,t);if(3!==b&&4!==b||(n.status=666),1===b||3===b)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===b&&(1===t?s._tr_align(n):5!==t&&(s._tr_stored_block(n,0,0,!1),3===t&&(y(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),g(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(v(n,255&e.adler),v(n,e.adler>>8&255),v(n,e.adler>>16&255),v(n,e.adler>>24&255),v(n,255&e.total_in),v(n,e.total_in>>8&255),v(n,e.total_in>>16&255),v(n,e.total_in>>24&255)):(_(n,e.adler>>>16),_(n,65535&e.adler)),g(e),0<n.wrap&&(n.wrap=-n.wrap),0!==n.pending?0:1)},r.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&t!==p&&666!==t?h(e,d):(e.state=null,t===p?h(e,-3):0):d},r.deflateSetDictionary=function(e,t){var r,i,s,a,u,l,c,p,h=t.length;if(!e||!e.state)return d;if(2===(a=(r=e.state).wrap)||1===a&&42!==r.status||r.lookahead)return d;for(1===a&&(e.adler=o(e.adler,t,h,0)),r.wrap=0,h>=r.w_size&&(0===a&&(y(r.head),r.strstart=0,r.block_start=0,r.insert=0),p=new n.Buf8(r.w_size),n.arraySet(p,t,h-r.w_size,r.w_size,0),t=p,h=r.w_size),u=e.avail_in,l=e.next_in,c=e.input,e.avail_in=h,e.next_in=0,e.input=t,w(r);r.lookahead>=3;){for(i=r.strstart,s=r.lookahead-2;r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+3-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=2,w(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=l,e.input=c,e.avail_in=u,r.wrap=a,0},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,u,d,l,c,p,h,f,y,g,m,v,_,b,w,E,T,S,R,x;r=e.state,i=e.next_in,R=e.input,n=i+(e.avail_in-5),s=e.next_out,x=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),u=r.dmax,d=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),_=y[h&m];t:for(;;){if(h>>>=b=_>>>24,f-=b,0==(b=_>>>16&255))x[s++]=65535&_;else{if(!(16&b)){if(0==(64&b)){_=y[(65535&_)+(h&(1<<b)-1)];continue t}if(32&b){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}w=65535&_,(b&=15)&&(f<b&&(h+=R[i++]<<f,f+=8),w+=h&(1<<b)-1,h>>>=b,f-=b),f<15&&(h+=R[i++]<<f,f+=8,h+=R[i++]<<f,f+=8),_=g[h&v];r:for(;;){if(h>>>=b=_>>>24,f-=b,!(16&(b=_>>>16&255))){if(0==(64&b)){_=g[(65535&_)+(h&(1<<b)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(E=65535&_,f<(b&=15)&&(h+=R[i++]<<f,(f+=8)<b&&(h+=R[i++]<<f,f+=8)),u<(E+=h&(1<<b)-1)){e.msg="invalid distance too far back",r.mode=30;break e}if(h>>>=b,f-=b,(b=s-o)<E){if(l<(b=E-b)&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(S=p,(T=0)===c){if(T+=d-b,b<w){for(w-=b;x[s++]=p[T++],--b;);T=s-E,S=x}}else if(c<b){if(T+=d+c-b,(b-=c)<w){for(w-=b;x[s++]=p[T++],--b;);if(T=0,c<w){for(w-=b=c;x[s++]=p[T++],--b;);T=s-E,S=x}}}else if(T+=c-b,b<w){for(w-=b;x[s++]=p[T++],--b;);T=s-E,S=x}for(;2<w;)x[s++]=S[T++],x[s++]=S[T++],x[s++]=S[T++],w-=3;w&&(x[s++]=S[T++],1<w&&(x[s++]=S[T++]))}else{for(T=s-E;x[s++]=x[T++],x[s++]=x[T++],x[s++]=x[T++],2<(w-=3););w&&(x[s++]=x[T++],1<w&&(x[s++]=x[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"),u=-2;function d(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function l(){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 c(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=1,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(852),t.distcode=t.distdyn=new i.Buf32(592),t.sane=1,t.back=-1,0):u}function p(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,c(e)):u}function h(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)?u:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,p(e))):u}function f(e,t){var r,i;return e?(i=new l,(e.state=i).window=null,0!==(r=h(e,t))&&(e.state=null),r):u}var y,g,m=!0;function v(e){if(m){var t;for(y=new i.Buf32(512),g=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(1,e.lens,0,288,y,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(2,e.lens,0,32,g,0,e.work,{bits:5}),m=!1}e.lencode=y,e.lenbits=9,e.distcode=g,e.distbits=5}function _(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=p,r.inflateReset2=h,r.inflateResetKeep=c,r.inflateInit=function(e){return f(e,15)},r.inflateInit2=f,r.inflate=function(e,t){var r,l,c,p,h,f,y,g,m,b,w,E,T,S,R,x,O,A,I,C,k,M,D,N,P=0,B=new i.Buf8(4),L=[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 u;12===(r=e.state).mode&&(r.mode=13),h=e.next_out,c=e.output,y=e.avail_out,p=e.next_in,l=e.input,f=e.avail_in,g=r.hold,m=r.bits,b=f,w=y,M=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;m<16;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(2&r.wrap&&35615===g){B[r.check=0]=255&g,B[1]=g>>>8&255,r.check=s(r.check,B,2,0),m=g=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&g)<<8)+(g>>8))%31){e.msg="incorrect header check",r.mode=30;break}if(8!=(15&g)){e.msg="unknown compression method",r.mode=30;break}if(m-=4,k=8+(15&(g>>>=4)),0===r.wbits)r.wbits=k;else if(k>r.wbits){e.msg="invalid window size",r.mode=30;break}r.dmax=1<<k,e.adler=r.check=1,r.mode=512&g?10:12,m=g=0;break;case 2:for(;m<16;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(r.flags=g,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=g>>8&1),512&r.flags&&(B[0]=255&g,B[1]=g>>>8&255,r.check=s(r.check,B,2,0)),m=g=0,r.mode=3;case 3:for(;m<32;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}r.head&&(r.head.time=g),512&r.flags&&(B[0]=255&g,B[1]=g>>>8&255,B[2]=g>>>16&255,B[3]=g>>>24&255,r.check=s(r.check,B,4,0)),m=g=0,r.mode=4;case 4:for(;m<16;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}r.head&&(r.head.xflags=255&g,r.head.os=g>>8),512&r.flags&&(B[0]=255&g,B[1]=g>>>8&255,r.check=s(r.check,B,2,0)),m=g=0,r.mode=5;case 5:if(1024&r.flags){for(;m<16;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}r.length=g,r.head&&(r.head.extra_len=g),512&r.flags&&(B[0]=255&g,B[1]=g>>>8&255,r.check=s(r.check,B,2,0)),m=g=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&(f<(E=r.length)&&(E=f),E&&(r.head&&(k=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),i.arraySet(r.head.extra,l,p,E,k)),512&r.flags&&(r.check=s(r.check,l,E,p)),f-=E,p+=E,r.length-=E),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===f)break e;for(E=0;k=l[p+E++],r.head&&k&&r.length<65536&&(r.head.name+=String.fromCharCode(k)),k&&E<f;);if(512&r.flags&&(r.check=s(r.check,l,E,p)),f-=E,p+=E,k)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&r.flags){if(0===f)break e;for(E=0;k=l[p+E++],r.head&&k&&r.length<65536&&(r.head.comment+=String.fromCharCode(k)),k&&E<f;);if(512&r.flags&&(r.check=s(r.check,l,E,p)),f-=E,p+=E,k)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;m<16;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(g!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}m=g=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(;m<32;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}e.adler=r.check=d(g),m=g=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=h,e.avail_out=y,e.next_in=p,e.avail_in=f,r.hold=g,r.bits=m,2;e.adler=r.check=1,r.mode=12;case 12:if(5===t||6===t)break e;case 13:if(r.last){g>>>=7&m,m-=7&m,r.mode=27;break}for(;m<3;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}switch(r.last=1&g,m-=1,3&(g>>>=1)){case 0:r.mode=14;break;case 1:if(v(r),r.mode=20,6!==t)break;g>>>=2,m-=2;break e;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=30}g>>>=2,m-=2;break;case 14:for(g>>>=7&m,m-=7&m;m<32;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if((65535&g)!=(g>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;break}if(r.length=65535&g,m=g=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(E=r.length){if(f<E&&(E=f),y<E&&(E=y),0===E)break e;i.arraySet(c,l,p,E,h),f-=E,p+=E,y-=E,h+=E,r.length-=E;break}r.mode=12;break;case 17:for(;m<14;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(r.nlen=257+(31&g),g>>>=5,m-=5,r.ndist=1+(31&g),g>>>=5,m-=5,r.ncode=4+(15&g),g>>>=4,m-=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(;m<3;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}r.lens[L[r.have++]]=7&g,g>>>=3,m-=3}for(;r.have<19;)r.lens[L[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,D={bits:r.lenbits},M=a(0,r.lens,0,19,r.lencode,0,r.work,D),r.lenbits=D.bits,M){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(;x=(P=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,O=65535&P,!((R=P>>>24)<=m);){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(O<16)g>>>=R,m-=R,r.lens[r.have++]=O;else{if(16===O){for(N=R+2;m<N;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(g>>>=R,m-=R,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}k=r.lens[r.have-1],E=3+(3&g),g>>>=2,m-=2}else if(17===O){for(N=R+3;m<N;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}m-=R,k=0,E=3+(7&(g>>>=R)),g>>>=3,m-=3}else{for(N=R+7;m<N;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}m-=R,k=0,E=11+(127&(g>>>=R)),g>>>=7,m-=7}if(r.have+E>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;E--;)r.lens[r.have++]=k}}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,D={bits:r.lenbits},M=a(1,r.lens,0,r.nlen,r.lencode,0,r.work,D),r.lenbits=D.bits,M){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,D={bits:r.distbits},M=a(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,D),r.distbits=D.bits,M){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<=f&&258<=y){e.next_out=h,e.avail_out=y,e.next_in=p,e.avail_in=f,r.hold=g,r.bits=m,o(e,w),h=e.next_out,c=e.output,y=e.avail_out,p=e.next_in,l=e.input,f=e.avail_in,g=r.hold,m=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;x=(P=r.lencode[g&(1<<r.lenbits)-1])>>>16&255,O=65535&P,!((R=P>>>24)<=m);){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(x&&0==(240&x)){for(A=R,I=x,C=O;x=(P=r.lencode[C+((g&(1<<A+I)-1)>>A)])>>>16&255,O=65535&P,!(A+(R=P>>>24)<=m);){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}g>>>=A,m-=A,r.back+=A}if(g>>>=R,m-=R,r.back+=R,r.length=O,0===x){r.mode=26;break}if(32&x){r.back=-1,r.mode=12;break}if(64&x){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&x,r.mode=22;case 22:if(r.extra){for(N=r.extra;m<N;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}r.length+=g&(1<<r.extra)-1,g>>>=r.extra,m-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;x=(P=r.distcode[g&(1<<r.distbits)-1])>>>16&255,O=65535&P,!((R=P>>>24)<=m);){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(0==(240&x)){for(A=R,I=x,C=O;x=(P=r.distcode[C+((g&(1<<A+I)-1)>>A)])>>>16&255,O=65535&P,!(A+(R=P>>>24)<=m);){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}g>>>=A,m-=A,r.back+=A}if(g>>>=R,m-=R,r.back+=R,64&x){e.msg="invalid distance code",r.mode=30;break}r.offset=O,r.extra=15&x,r.mode=24;case 24:if(r.extra){for(N=r.extra;m<N;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}r.offset+=g&(1<<r.extra)-1,g>>>=r.extra,m-=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===y)break e;if(E=w-y,r.offset>E){if((E=r.offset-E)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=30;break}T=E>r.wnext?(E-=r.wnext,r.wsize-E):r.wnext-E,E>r.length&&(E=r.length),S=r.window}else S=c,T=h-r.offset,E=r.length;for(y<E&&(E=y),y-=E,r.length-=E;c[h++]=S[T++],--E;);0===r.length&&(r.mode=21);break;case 26:if(0===y)break e;c[h++]=r.length,y--,r.mode=21;break;case 27:if(r.wrap){for(;m<32;){if(0===f)break e;f--,g|=l[p++]<<m,m+=8}if(w-=y,e.total_out+=w,r.total+=w,w&&(e.adler=r.check=r.flags?s(r.check,c,w,h-w):n(r.check,c,w,h-w)),w=y,(r.flags?g:d(g))!==r.check){e.msg="incorrect data check",r.mode=30;break}m=g=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;m<32;){if(0===f)break e;f--,g+=l[p++]<<m,m+=8}if(g!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}m=g=0}r.mode=29;case 29:M=1;break e;case 30:M=-3;break e;case 31:return-4;default:return u}return e.next_out=h,e.avail_out=y,e.next_in=p,e.avail_in=f,r.hold=g,r.bits=m,(r.wsize||w!==e.avail_out&&r.mode<30&&(r.mode<27||4!==t))&&_(e,e.output,e.next_out,w-e.avail_out)?(r.mode=31,-4):(b-=e.avail_in,w-=e.avail_out,e.total_in+=b,e.total_out+=w,r.total+=w,r.wrap&&w&&(e.adler=r.check=r.flags?s(r.check,c,w,e.next_out-w):n(r.check,c,w,e.next_out-w)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0==b&&0===w||4===t)&&0===M&&(M=-5),M)},r.inflateEnd=function(e){if(!e||!e.state)return u;var t=e.state;return t.window&&(t.window=null),e.state=null,0},r.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?u:((r.head=t).done=!1,0):u},r.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?u:11===r.mode&&n(1,t,i,0)!==r.check?-3:_(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,0):u},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,u,d,l,c,p){var h,f,y,g,m,v,_,b,w,E=p.bits,T=0,S=0,R=0,x=0,O=0,A=0,I=0,C=0,k=0,M=0,D=null,N=0,P=new i.Buf16(16),B=new i.Buf16(16),L=null,q=0;for(T=0;T<=15;T++)P[T]=0;for(S=0;S<u;S++)P[t[r+S]]++;for(O=E,x=15;1<=x&&0===P[x];x--);if(x<O&&(O=x),0===x)return d[l++]=20971520,d[l++]=20971520,p.bits=1,0;for(R=1;R<x&&0===P[R];R++);for(O<R&&(O=R),T=C=1;T<=15;T++)if(C<<=1,(C-=P[T])<0)return-1;if(0<C&&(0===e||1!==x))return-1;for(B[1]=0,T=1;T<15;T++)B[T+1]=B[T]+P[T];for(S=0;S<u;S++)0!==t[r+S]&&(c[B[t[r+S]]++]=S);if(v=0===e?(D=L=c,19):1===e?(D=n,N-=257,L=s,q-=257,256):(D=o,L=a,-1),T=R,m=l,I=S=M=0,y=-1,g=(k=1<<(A=O))-1,1===e&&852<k||2===e&&592<k)return 1;for(;;){for(_=T-I,w=c[S]<v?(b=0,c[S]):c[S]>v?(b=L[q+c[S]],D[N+c[S]]):(b=96,0),h=1<<T-I,R=f=1<<A;d[m+(M>>I)+(f-=h)]=_<<24|b<<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==--P[T]){if(T===x)break;T=t[r+c[S]]}if(O<T&&(M&g)!==y){for(0===I&&(I=O),m+=R,C=1<<(A=T-I);A+I<x&&!((C-=P[A+I])<=0);)A++,C<<=1;if(k+=1<<A,1===e&&852<k||2===e&&592<k)return 1;d[y=M&g]=O<<24|A<<16|m-l|0}}return 0!==M&&(d[m+M]=T-I<<24|64<<16|0),p.bits=O,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");function n(e){for(var t=e.length;0<=--t;)e[t]=0}var s=256,o=286,a=30,u=15,d=[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],l=[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],c=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],p=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],h=new Array(576);n(h);var f=new Array(60);n(f);var y=new Array(512);n(y);var g=new Array(256);n(g);var m=new Array(29);n(m);var v,_,b,w=new Array(a);function E(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 T(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function S(e){return e<256?y[e]:y[256+(e>>>7)]}function R(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function x(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,R(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function O(e,t,r){x(e,r[2*t],r[2*t+1])}function A(e,t){for(var r=0;r|=1&e,e>>>=1,r<<=1,0<--t;);return r>>>1}function I(e,t,r){var i,n,s=new Array(16),o=0;for(i=1;i<=u;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]=A(s[a]++,a))}}function C(e){var t;for(t=0;t<o;t++)e.dyn_ltree[2*t]=0;for(t=0;t<a;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function k(e){8<e.bi_valid?R(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 M(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 D(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&M(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!M(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function N(e,t,r){var i,n,o,a,u=0;if(0!==e.last_lit)for(;i=e.pending_buf[e.d_buf+2*u]<<8|e.pending_buf[e.d_buf+2*u+1],n=e.pending_buf[e.l_buf+u],u++,0===i?O(e,n,t):(O(e,(o=g[n])+s+1,t),0!==(a=d[o])&&x(e,n-=m[o],a),O(e,o=S(--i),r),0!==(a=l[o])&&x(e,i-=w[o],a)),u<e.last_lit;);O(e,256,t)}function P(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,l=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<d;r++)0!==s[2*r]?(e.heap[++e.heap_len]=l=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)s[2*(n=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[n]=0,e.opt_len--,a&&(e.static_len-=o[2*n+1]);for(t.max_code=l,r=e.heap_len>>1;1<=r;r--)D(e,s,r);for(n=d;r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],D(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++,D(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,l=t.max_code,c=t.stat_desc.static_tree,p=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,f=t.stat_desc.extra_base,y=t.stat_desc.max_length,g=0;for(s=0;s<=u;s++)e.bl_count[s]=0;for(d[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)y<(s=d[2*d[2*(i=e.heap[r])+1]+1]+1)&&(s=y,g++),d[2*i+1]=s,l<i||(e.bl_count[s]++,o=0,f<=i&&(o=h[i-f]),a=d[2*i],e.opt_len+=a*(s+o),p&&(e.static_len+=a*(c[2*i+1]+o)));if(0!==g){do{for(s=y-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[y]--,g-=2}while(0<g);for(s=y;0!==s;s--)for(i=e.bl_count[s];0!==i;)l<(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),I(s,l,e.bl_count)}function B(e,t,r){var i,n,s=-1,o=t[1],a=0,u=7,d=4;for(0===o&&(u=138,d=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=o,o=t[2*(i+1)+1],++a<u&&n===o||(a<d?e.bl_tree[2*n]+=a:0!==n?(n!==s&&e.bl_tree[2*n]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=n,d=(a=0)===o?(u=138,3):n===o?(u=6,3):(u=7,4))}function L(e,t,r){var i,n,s=-1,o=t[1],a=0,u=7,d=4;for(0===o&&(u=138,d=3),i=0;i<=r;i++)if(n=o,o=t[2*(i+1)+1],!(++a<u&&n===o)){if(a<d)for(;O(e,n,e.bl_tree),0!=--a;);else 0!==n?(n!==s&&(O(e,n,e.bl_tree),a--),O(e,16,e.bl_tree),x(e,a-3,2)):a<=10?(O(e,17,e.bl_tree),x(e,a-3,3)):(O(e,18,e.bl_tree),x(e,a-11,7));s=n,d=(a=0)===o?(u=138,3):n===o?(u=6,3):(u=7,4)}}n(w);var q=!1;function F(e,t,r,n){x(e,0+(n?1:0),3),function(e,t,r,n){k(e),R(e,r),R(e,~r),i.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r)}r._tr_init=function(e){q||(function(){var e,t,r,i,n,s=new Array(16);for(i=r=0;i<28;i++)for(m[i]=r,e=0;e<1<<d[i];e++)g[r++]=i;for(g[r-1]=i,i=n=0;i<16;i++)for(w[i]=n,e=0;e<1<<l[i];e++)y[n++]=i;for(n>>=7;i<a;i++)for(w[i]=n<<7,e=0;e<1<<l[i]-7;e++)y[256+n++]=i;for(t=0;t<=u;t++)s[t]=0;for(e=0;e<=143;)h[2*e+1]=8,e++,s[8]++;for(;e<=255;)h[2*e+1]=9,e++,s[9]++;for(;e<=279;)h[2*e+1]=7,e++,s[7]++;for(;e<=287;)h[2*e+1]=8,e++,s[8]++;for(I(h,287,s),e=0;e<a;e++)f[2*e+1]=5,f[2*e]=A(e,5);v=new E(h,d,257,o,u),_=new E(f,l,0,a,u),b=new E(new Array(0),c,0,19,7)}(),q=!0),e.l_desc=new T(e.dyn_ltree,v),e.d_desc=new T(e.dyn_dtree,_),e.bl_desc=new T(e.bl_tree,b),e.bi_buf=0,e.bi_valid=0,C(e)},r._tr_stored_block=F,r._tr_flush_block=function(e,t,r,i){var n,o,a=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 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<s;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),P(e,e.l_desc),P(e,e.d_desc),a=function(e){var t;for(B(e,e.dyn_ltree,e.l_desc.max_code),B(e,e.dyn_dtree,e.d_desc.max_code),P(e,e.bl_desc),t=18;3<=t&&0===e.bl_tree[2*p[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==t?F(e,t,r,i):4===e.strategy||o===n?(x(e,2+(i?1:0),3),N(e,h,f)):(x(e,4+(i?1:0),3),function(e,t,r,i){var n;for(x(e,t-257,5),x(e,r-1,5),x(e,i-4,4),n=0;n<i;n++)x(e,e.bl_tree[2*p[n]+1],3);L(e,e.dyn_ltree,t-1),L(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),N(e,e.dyn_ltree,e.dyn_dtree)),C(e),i&&k(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*(g[r]+s+1)]++,e.dyn_dtree[2*S(t)]++),e.last_lit===e.lit_bufsize-1},r._tr_align=function(e){x(e,2,3),O(e,256,h),function(e){16===e.bi_valid?(R(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,o,a=1,u={},d=!1,l=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,r="[object process]"==={}.toString.call(e.process)?function(e){s.nextTick((function(){h(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}}()?(o="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",f,!1):e.attachEvent("onmessage",f),function(t){e.postMessage(o+t,"*")}):e.MessageChannel?((n=new MessageChannel).port1.onmessage=function(e){h(e.data)},function(e){n.port2.postMessage(e)}):l&&"onreadystatechange"in l.createElement("script")?(i=l.documentElement,function(e){var t=l.createElement("script");t.onreadystatechange=function(){h(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(h,0,e)},c.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 u[a]=n,r(a),a++},c.clearImmediate=p}function p(e){delete u[e]}function h(e){if(d)setTimeout(h,0,e);else{var t=u[e];if(t){d=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(undefined,r)}}(t)}finally{p(e),d=!1}}}}function f(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&h(+t.data.slice(o.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,u=o.toString,d=a.hasOwnProperty,l=u.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=d.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&u.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=u(e,(0|e)<0?-1:0,!0),o&&(s[e]=r),r):(o=-128<=(e|=0)&&e<128)&&(i=n[e])?i:(r=u(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():u(e%p|0,e/p|0,t)}function u(e,t,i){return new r(e,t,i)}r.fromInt=o,r.fromNumber=a,r.fromBits=u;var d=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(d(r,8)),s=g,o=0;o<e.length;o+=8){var u=Math.min(8,e.length-o),c=parseInt(e.substring(o,o+u),r);if(u<8){var p=a(d(r,u));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):u(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 _=o(1,!0);r.UONE=_;var b=o(-1);r.NEG_ONE=b;var w=u(-1,2147483647,!1);r.MAX_VALUE=w;var E=u(-1,-1,!0);r.MAX_UNSIGNED_VALUE=E;var T=u(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(d(e,6),this.unsigned),s=this,o="";;){var u=s.div(n),l=(s.sub(u.mul(n)).toInt()>>>0).toString(e);if((s=u).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,d=e.low>>>16,l=0,p=0,h=0,f=0;return h+=(f+=s+(65535&e.low))>>>16,p+=(h+=n+d)>>>16,l+=(p+=r+a)>>>16,l+=t+o,u((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 u(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,d=e.high>>>16,l=65535&e.high,p=e.low>>>16,h=65535&e.low,f=0,m=0,v=0,_=0;return v+=(_+=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*d,u((v&=65535)<<16|(_&=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?u((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 _;s=m}else{if(this.eq(T))return e.eq(v)||e.eq(b)?T:e.eq(T)?v:(r=this.shr(1).div(e).shl(1)).eq(g)?e.isNegative()?v:b:(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:d(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?u((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 u(~this.low,~this.high,this.unsigned)},S.and=function(e){return i(e)||(e=c(e)),u(this.low&e.low,this.high&e.high,this.unsigned)},S.or=function(e){return i(e)||(e=c(e)),u(this.low|e.low,this.high|e.high,this.unsigned)},S.xor=function(e){return i(e)||(e=c(e)),u(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?u(this.low<<e,this.high<<e|this.low>>>32-e,this.unsigned):u(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?u(this.low>>>e|this.high<<32-e,this.high>>e,this.unsigned):u(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?u(this.low>>>e|t<<32-e,t>>>e,this.unsigned):u(32===e?t:t>>>e-32,0,this.unsigned)},S.shru=S.shiftRightUnsigned,S.shr_u=S.shiftRightUnsigned,S.toSigned=function(){return this.unsigned?u(this.low,this.high,!1):this},S.toUnsigned=function(){return this.unsigned?this:u(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"),u=Symbol("maxAge"),d=Symbol("dispose"),l=Symbol("noDisposeOnSet"),c=Symbol("lruList"),p=Symbol("cache"),h=Symbol("updateAgeOnGet"),f=()=>1,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[u])return!1;const r=Date.now()-t.now;return t.maxAge?r>t.maxAge:e[u]&&r>e[u]},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[d]&&e[d](r.key,r.value),e[s]-=r.length,e[p].delete(r.key),e[c].removeNode(t)}};class _{constructor(e,t,r,i,n){this.key=e,this.value=t,this.length=r,this.now=i,this.maxAge=n||0}}const b=(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[u]=e.maxAge||0,this[d]=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[u]=e,m(this)}get maxAge(){return this[u]}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;b(this,e,r,t),r=i}}forEach(e,t){t=t||this;for(let r=this[c].head;null!==r;){const i=r.next;b(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[d]&&this[c]&&this[c].length&&this[c].forEach((e=>this[d](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[u])&&"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[d]&&(this[l]||this[d](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 _(e,t,a,i,r);return h.length>this[n]?(this[d]&&this[d](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;function s(e,t,r,i){var n=t>=1.5*r;return Math.round(e/r)+" "+i+(n?"s":"")}e.exports=function(e,o){o=o||{};var a,u,d=typeof e;if("string"===d&&e.length>0)return function(e){if(!((e=String(e)).length>100)){var s=/^(-?(?:\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(s){var o=parseFloat(s[1]);switch((s[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*o;case"weeks":case"week":case"w":return 6048e5*o;case"days":case"day":case"d":return o*n;case"hours":case"hour":case"hrs":case"hr":case"h":return o*i;case"minutes":case"minute":case"mins":case"min":case"m":return o*r;case"seconds":case"second":case"secs":case"sec":case"s":return o*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return o;default:return}}}}(e);if("number"===d&&isFinite(e))return o.long?(a=e,(u=Math.abs(a))>=n?s(a,u,n,"day"):u>=i?s(a,u,i,"hour"):u>=r?s(a,u,r,"minute"):u>=t?s(a,u,t,"second"):a+" ms"):function(e){var s=Math.abs(e);return s>=n?Math.round(e/n)+"d":s>=i?Math.round(e/i)+"h":s>=r?Math.round(e/r)+"m":s>=t?Math.round(e/t)+"s":e+"ms"}(e);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))}},4406:e=>{var t,r,i=e.exports={};function n(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function o(e){if(t===setTimeout)return setTimeout(e,0);if((t===n||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:n}catch(e){t=n}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(e){r=s}}();var a,u=[],d=!1,l=-1;function c(){d&&a&&(d=!1,a.length?u=a.concat(u):l=-1,u.length&&p())}function p(){if(!d){var e=o(c);d=!0;for(var t=u.length;t;){for(a=u,u=[];++l<t;)a&&a[l].run();l=-1,t=u.length}a=null,d=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function h(e,t){this.fun=e,this.array=t}function f(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];u.push(new h(e,t)),1!==u.length||d||o(p)},h.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=f,i.addListener=f,i.once=f,i.off=f,i.removeListener=f,i.removeAllListeners=f,i.emit=f,i.prependListener=f,i.prependOnceListener=f,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},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 u=!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":u=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":e("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",i,i,u)('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,u?"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(),u=s.safeProp(a.name);a.map?(r("if(d%s){",u)('if(typeof d%s!=="object")',u)("throw TypeError(%j)",a.fullName+": object expected")("m%s={}",u)("for(var ks=Object.keys(d%s),i=0;i<ks.length;++i){",u),o(r,a,i,u+"[ks[i]]")("}")("}")):a.repeated?(r("if(d%s){",u)("if(!Array.isArray(d%s))",u)("throw TypeError(%j)",a.fullName+": array expected")("m%s=[]",u)("for(var i=0;i<d%s.length;++i){",u),o(r,a,i,u+"[i]")("}")("}")):(a.resolvedType instanceof n||r("if(d%s!=null){",u),o(r,a,i,u),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=[],u=[],d=0;d<t.length;++d)t[d].partOf||(t[d].resolve().repeated?i:t[d].map?o:u).push(t[d]);if(i.length){for(r("if(o.arrays||o.defaults){"),d=0;d<i.length;++d)r("d%s=[]",s.safeProp(i[d].name));r("}")}if(o.length){for(r("if(o.objects||o.defaults){"),d=0;d<o.length;++d)r("d%s={}",s.safeProp(o[d].name));r("}")}if(u.length){for(r("if(o.defaults){"),d=0;d<u.length;++d){var l=u[d],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(d=0;d<t.length;++d){l=t[d];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(),u=a.resolvedType instanceof i?"int32":a.type,d="m"+s.safeProp(a.name);t("case %i:",a.id),a.map?(t("if(%s===util.emptyObject)",d)("%s={}",d)("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[u]?t("value=%j",n.defaults[u]):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[u]?t("value=types[%i].decode(r,r.uint32())",r):t("value=r.%s()",u),t("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),void 0!==n.long[a.keyType]?t('%s[typeof k==="object"?util.longToHash(k):k]=value',d):t("%s[k]=value",d)):a.repeated?(t("if(!(%s&&%s.length))",d,d)("%s=[]",d),void 0!==n.packed[u]&&t("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos<c2)")("%s.push(r.%s())",d,u)("}else"),void 0===n.basic[u]?t(a.resolvedType.group?"%s.push(types[%i].decode(r))":"%s.push(types[%i].decode(r,r.uint32()))",d,r):t("%s.push(r.%s())",d,u)):void 0===n.basic[u]?t(a.resolvedType.group?"%s=types[%i].decode(r)":"%s=types[%i].decode(r,r.uint32())",d,r):t("%s=r.%s()",d,u),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),u=0;u<a.length;++u){var d=a[u].resolve(),l=e._fieldsArray.indexOf(d),c=d.resolvedType instanceof i?"int32":d.type,p=n.basic[c];t="m"+s.safeProp(d.name),d.map?(r("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){",t,d.name)("for(var ks=Object.keys(%s),i=0;i<ks.length;++i){",t)("w.uint32(%i).fork().uint32(%i).%s(ks[i])",(d.id<<3|2)>>>0,8|n.mapKey[d.keyType],d.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("}")("}")):d.repeated?(r("if(%s!=null&&%s.length){",t,t),d.packed&&void 0!==n.packed[c]?r("w.uint32(%i).fork()",(d.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,d,l,t+"[i]"):r("w.uint32(%i).%s(%s[i])",(d.id<<3|p)>>>0,c,t)),r("}")):(d.optional&&r("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",t,d.name),void 0===p?o(r,d,l,t):r("w.uint32(%i).%s(%s)",(d.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=d;var i=r(7641);((d.prototype=Object.create(i.prototype)).constructor=d).className="Field";var n,s=r(6901),o=r(3970),a=r(8066),u=/^required|optional|repeated$/;function d(e,t,r,n,s,d,l){if(a.isObject(n)?(l=s,d=n,n=s=void 0):a.isObject(s)&&(l=d,d=s,s=void 0),i.call(this,e,d),!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&&!u.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}d.fromJSON=function(e,t){return new d(e,t.id,t.type,t.rule,t.extend,t.options,t.comment)},Object.defineProperty(d.prototype,"packed",{get:function(){return null===this._packed&&(this._packed=!1!==this.getOption("packed")),this._packed}}),d.prototype.setOption=function(e,t,r){return"packed"===e&&(this._packed=null),i.prototype.setOption.call(this,e,t,r)},d.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])},d.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)},d.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 d(s,e,t,r,{default:i}))}},d._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,u,d,l){if(n.isObject(o)?(u=o,o=a=void 0):n.isObject(a)&&(u=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,u),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=d,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),u=r(6898),d=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=d.toArray(this.nested))}}),c.prototype.toJSON=function(e){return d.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 u))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(d.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]),d.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=u;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 u(e){this.buf=e,this.pos=0,this.len=e.length}var d,l="undefined"!=typeof Uint8Array?function(e){if(e instanceof Uint8Array||Array.isArray(e))return new u(e);throw Error("illegal buffer")}:function(e){if(Array.isArray(e))return new u(e);throw Error("illegal buffer")},c=function(){return n.Buffer?function(e){return(u.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))}u.create=c(),u.prototype._slice=n.Array.prototype.subarray||n.Array.prototype.slice,u.prototype.uint32=(d=4294967295,function(){if(d=(127&this.buf[this.pos])>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<7)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<14)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(127&this.buf[this.pos])<<21)>>>0,this.buf[this.pos++]<128)return d;if(d=(d|(15&this.buf[this.pos])<<28)>>>0,this.buf[this.pos++]<128)return d;if((this.pos+=5)>this.len)throw this.pos=this.len,a(this,10);return d}),u.prototype.int32=function(){return 0|this.uint32()},u.prototype.sint32=function(){var e=this.uint32();return e>>>1^-(1&e)|0},u.prototype.bool=function(){return 0!==this.uint32()},u.prototype.fixed32=function(){if(this.pos+4>this.len)throw a(this,4);return h(this.buf,this.pos+=4)},u.prototype.sfixed32=function(){if(this.pos+4>this.len)throw a(this,4);return 0|h(this.buf,this.pos+=4)},u.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},u.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},u.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)},u.prototype.string=function(){var e=this.bytes();return o.read(e,0,e.length)},u.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},u.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},u._configure=function(e){i=e,u.create=c(),i._configure();var t=n.Long?"toLong":"toNumber";n.merge(u.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),u=r(6901),d=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 u(e,t){if(i){var r=i;if(i=null,a)throw e;r(e,t)}}function d(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=d(o.imports[c])||n.resolvePath(e,o.imports[c]))&&h(i);if(o.weakImports)for(c=0;c<o.weakImports.length;++c)(i=d(o.weakImports[c])||n.resolvePath(e,o.weakImports[c]))&&h(i,!0)}else n.setOptions(t.options).addJSON(t.nested)}catch(e){u(e)}a||f||u(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||u(e))}c(e,r)}else++f,n.fetch(e,(function(r,s){--f,i&&(r?t?f||u(null,n):u(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||u(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 u)h.test(e.name)&&(e.parent[e.name]=e.values);else if(!(e instanceof d)){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 u)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 u(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,u(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,u(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 u=s.lcFirst((i=this._methodsArray[a]).resolve().name).replace(/[^$\w_]/g,"");n[u]=s.codegen(["r","c"],s.isReserved(u)?u+"_":u)("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),u=r(9355),d=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 _(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 d||((e.prototype=new d).constructor=e,p.merge(e.prototype,t)),e.$type=e.prototype.$type=this,p.merge(e,d,!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 d=Object.keys(t.fields),l=0;l<d.length;++l)r.add((void 0!==t.fields[d[l]].keyType?a.fromJSON:o.fromJSON)(d[l],t.fields[d[l]]));if(t.oneofs)for(d=Object.keys(t.oneofs),l=0;l<d.length;++l)r.add(s.fromJSON(d[l],t.oneofs[d[l]]));if(t.nested)for(d=Object.keys(t.nested),l=0;l<d.length;++l){var c=t.nested[d[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?u.fromJSON:i.fromJSON)(d[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),_(this)}return e instanceof s?(this.oneofs||(this.oneofs={}),this.oneofs[e.name]=e,e.onAdd(this),_(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),_(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),_(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,u=/"/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(u,'\\"')+'"]':"."+e},s.ucFirst=function(e){return e.charAt(0).toUpperCase()+e.substring(1)};var d=/_([a-z])/g;s.camelCase=function(e){return e.substring(0,1)+e.substring(1).replace(d,(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.length&&t("var p={}");for(var i=0;i<e.fieldsArray.length;++i){var u=e._fieldsArray[i].resolve(),d="m"+n.safeProp(u.name);if(u.optional&&t("if(%s!=null&&m.hasOwnProperty(%j)){",d,u.name),u.map)t("if(!util.isObject(%s))",d)("return%j",s(u,"object"))("var k=Object.keys(%s)",d)("for(var i=0;i<k.length;++i){"),a(t,u,"k[i]"),o(t,u,i,d+"[k[i]]")("}");else if(u.repeated)t("if(!Array.isArray(%s))",d)("return%j",s(u,"array"))("for(var i=0;i<%s.length;++i){",d),o(t,u,i,d+"[i]")("}");else{if(u.partOf){var l=n.safeProp(u.partOf.name);1===r[u.partOf.name]&&t("if(p%s===1)",l)("return%j",u.partOf.name+": multiple values"),r[u.partOf.name]=1,t("p%s=1",l)}o(t,u,i,d)}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 u(e,t,r){this.fn=e,this.len=t,this.next=void 0,this.val=r}function d(){}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 u(d,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 u(e,t,r),this.len+=t,this},f.prototype=Object.create(u.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 u(d,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 u(d,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}d("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,d("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(d("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 u(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=u(this.semver,"<",e.semver,t)&&(">="===this.operator||">"===this.operator)&&("<="===e.operator||"<"===e.operator),d=u(this.semver,">",e.semver,t)&&("<="===this.operator||"<"===this.operator)&&(">="===e.operator||">"===e.operator);return r||i||s&&o||a||d}}e.exports=n;const s=r(1388),{re:o,t:a}=r(4808),u=r(8117),d=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?d[l.HYPHENRANGELOOSE]:d[l.HYPHENRANGE];e=e.replace(s,O(this.options.includePrerelease)),a("hyphen replace",e),e=e.replace(d[l.COMPARATORTRIM],c),a("comparator trim",e);let u=(e=(e=(e=e.replace(d[l.TILDETRIM],p)).replace(d[l.CARETTRIM],h)).split(/\s+/).join(" ")).split(" ").map((e=>m(e,this.options))).join(" ").split(/\s+/).map((e=>x(e,this.options)));i&&(u=u.filter((e=>(a("loose invalid filter",e,this.options),!!e.match(d[l.COMPARATORLOOSE]))))),a("range list",u);const y=new Map,g=u.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 u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(A(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),u=r(2435),{re:d,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=_(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,_=(e,t)=>e.trim().split(/\s+/).map((e=>b(e,t))).join(" "),b=(e,t)=>{const r=t.loose?d[l.TILDELOOSE]:d[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?d[l.CARETLOOSE]:d[l.CARET],i=t.includePrerelease?"-0":"";return e.replace(r,((t,r,n,s,o)=>{let u;return a("caret",e,t,r,n,s,o),v(r)?u="":v(n)?u=`>=${r}.0.0${i} <${+r+1}.0.0-0`:v(s)?u="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),u="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"),u="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",u),u}))},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?d[l.XRANGELOOSE]:d[l.XRANGE];return e.replace(r,((r,i,n,s,o,u)=>{a("xRange",e,r,i,n,s,o,u);const d=v(n),l=d||v(s),c=l||v(o),p=c;return"="===i&&p&&(i=""),u=t.includePrerelease?"-0":"",d?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&&(u="-0"),r=`${i+n}.${s}.${o}${u}`):l?r=`>=${n}.0.0${u} <${+n+1}.0.0-0`:c&&(r=`>=${n}.${s}.0${u} <${n}.${+s+1}.0-0`),a("xRange return",r),r}))},R=(e,t)=>(a("replaceStars",e,t),e.trim().replace(d[l.STAR],"")),x=(e,t)=>(a("replaceGTE0",e,t),e.trim().replace(d[t.includePrerelease?l.GTE0PRE:l.GTE0],"")),O=e=>(t,r,i,n,s,o,a,u,d,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":""}`} ${u=v(d)?"":v(l)?`<${+d+1}.0.0-0`:v(c)?`<${d}.${+l+1}.0-0`:p?`<=${d}.${l}.${c}-${p}`:e?`<${d}.${l}.${+c+1}-0`:`<=${u}`}`.trim(),A=(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),u=r(1388),{compareIdentifiers:d}=r(4935);class l{constructor(e,t){if(t=u(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)),d(this.major,e.major)||d(this.minor,e.minor)||d(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 d(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 d(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===d(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),u=r(506);e.exports=(e,t,r,d)=>{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,d);case"!=":return n(e,r,d);case">":return s(e,r,d);case">=":return o(e,r,d);case"<":return a(e,r,d);case"<=":return u(e,r,d);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,t,r)=>{var i=r(4406);const n="object"==typeof i&&i.env&&i.env.NODE_DEBUG&&/\bsemver\b/i.test(i.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};e.exports=n},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 u=0;const d=(e,t,r)=>{const i=u++;n(e,i,t),a[e]=i,o[i]=t,s[i]=new RegExp(t,r?"g":void 0)};d("NUMERICIDENTIFIER","0|[1-9]\\d*"),d("NUMERICIDENTIFIERLOOSE","[0-9]+"),d("NONNUMERICIDENTIFIER","\\d*[a-zA-Z-][a-zA-Z0-9-]*"),d("MAINVERSION",`(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})\\.(${o[a.NUMERICIDENTIFIER]})`),d("MAINVERSIONLOOSE",`(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})\\.(${o[a.NUMERICIDENTIFIERLOOSE]})`),d("PRERELEASEIDENTIFIER",`(?:${o[a.NUMERICIDENTIFIER]}|${o[a.NONNUMERICIDENTIFIER]})`),d("PRERELEASEIDENTIFIERLOOSE",`(?:${o[a.NUMERICIDENTIFIERLOOSE]}|${o[a.NONNUMERICIDENTIFIER]})`),d("PRERELEASE",`(?:-(${o[a.PRERELEASEIDENTIFIER]}(?:\\.${o[a.PRERELEASEIDENTIFIER]})*))`),d("PRERELEASELOOSE",`(?:-?(${o[a.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${o[a.PRERELEASEIDENTIFIERLOOSE]})*))`),d("BUILDIDENTIFIER","[0-9A-Za-z-]+"),d("BUILD",`(?:\\+(${o[a.BUILDIDENTIFIER]}(?:\\.${o[a.BUILDIDENTIFIER]})*))`),d("FULLPLAIN",`v?${o[a.MAINVERSION]}${o[a.PRERELEASE]}?${o[a.BUILD]}?`),d("FULL",`^${o[a.FULLPLAIN]}$`),d("LOOSEPLAIN",`[v=\\s]*${o[a.MAINVERSIONLOOSE]}${o[a.PRERELEASELOOSE]}?${o[a.BUILD]}?`),d("LOOSE",`^${o[a.LOOSEPLAIN]}$`),d("GTLT","((?:<|>)?=?)"),d("XRANGEIDENTIFIERLOOSE",`${o[a.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),d("XRANGEIDENTIFIER",`${o[a.NUMERICIDENTIFIER]}|x|X|\\*`),d("XRANGEPLAIN",`[v=\\s]*(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:\\.(${o[a.XRANGEIDENTIFIER]})(?:${o[a.PRERELEASE]})?${o[a.BUILD]}?)?)?`),d("XRANGEPLAINLOOSE",`[v=\\s]*(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:\\.(${o[a.XRANGEIDENTIFIERLOOSE]})(?:${o[a.PRERELEASELOOSE]})?${o[a.BUILD]}?)?)?`),d("XRANGE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAIN]}$`),d("XRANGELOOSE",`^${o[a.GTLT]}\\s*${o[a.XRANGEPLAINLOOSE]}$`),d("COERCE",`(^|[^\\d])(\\d{1,${i}})(?:\\.(\\d{1,${i}}))?(?:\\.(\\d{1,${i}}))?(?:$|[^\\d])`),d("COERCERTL",o[a.COERCE],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM",`(\\s*)${o[a.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",d("TILDE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAIN]}$`),d("TILDELOOSE",`^${o[a.LONETILDE]}${o[a.XRANGEPLAINLOOSE]}$`),d("LONECARET","(?:\\^)"),d("CARETTRIM",`(\\s*)${o[a.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",d("CARET",`^${o[a.LONECARET]}${o[a.XRANGEPLAIN]}$`),d("CARETLOOSE",`^${o[a.LONECARET]}${o[a.XRANGEPLAINLOOSE]}$`),d("COMPARATORLOOSE",`^${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]})$|^$`),d("COMPARATOR",`^${o[a.GTLT]}\\s*(${o[a.FULLPLAIN]})$|^$`),d("COMPARATORTRIM",`(\\s*)${o[a.GTLT]}\\s*(${o[a.LOOSEPLAIN]}|${o[a.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE",`^\\s*(${o[a.XRANGEPLAIN]})\\s+-\\s+(${o[a.XRANGEPLAIN]})\\s*$`),d("HYPHENRANGELOOSE",`^\\s*(${o[a.XRANGEPLAINLOOSE]})\\s+-\\s+(${o[a.XRANGEPLAINLOOSE]})\\s*$`),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("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),u=r(6379),d=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=u,f=l,y=d,g=">",m=">=";break;case"<":h=d,f=c,y=u,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 u=e.sort(((e,t)=>n(e,t,r)));for(const e of u)i(e,t,r)?(a=e,o||(o=e)):(a&&s.push([o,a]),a=null,o=null);o&&s.push([o,null]);const d=[];for(const[e,t]of s)e===t?d.push(e):t||e!==u[0]?t?e===u[0]?d.push(`<=${t}`):d.push(`${e} - ${t}`):d.push(`>=${e}`):d.push("*");const l=d.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),u=(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 u,c,p,h,f,y,g;for(const t of e)">"===t.operator||">="===t.operator?u=d(u,t,r):"<"===t.operator||"<="===t.operator?c=l(c,t,r):i.add(t.semver);if(i.size>1)return null;if(u&&c){if(p=a(u.semver,c.semver,r),p>0)return null;if(0===p&&(">="!==u.operator||"<="!==c.operator))return null}for(const e of i){if(u&&!o(e,String(u),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=!(!u||r.includePrerelease||!u.semver.prerelease.length)&&u.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,u)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=d(u,e,r),h===e&&h!==u)return!1}else if(">="===u.operator&&!o(u.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||u)&&0!==p)return!1}return!(u&&y&&!c&&0!==p||c&&g&&!u&&0!==p||v||m)},d=(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=u(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);for(null===s&&(s=this.tail),s!==this.head&&s!==this.tail&&(s=s.prev),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","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","@onekeyfe/hd-transport":"^0.2.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__={};(()=>{"use strict";var e=__webpack_require__(426),t=__webpack_require__.n(e),r=__webpack_require__(5016),i=__webpack_require__.n(r),n=__webpack_require__(5514);const 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"};var o=__webpack_require__(7408);function a(e,t,r){try{Reflect.apply(e,t,r)}catch(e){setTimeout((()=>{throw e}))}}class u extends o{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 d extends u{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)a(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)a(r[i],this,t)}return!0}}var l=__webpack_require__(7030),c=__webpack_require__(5505),p=__webpack_require__(1378),h=__webpack_require__(6139).Promise,f=function(e,t,r,i){return new(r||(r=h))((function(n,s){function o(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((i=i.apply(e,t||[])).next())}))};const y="$$ONEKEY_DEBUG_LOGGER";var g=__webpack_require__(6139).Promise,m=__webpack_require__(4406),v=function(e,t,r,i){return new(r||(r=g))((function(n,s){function o(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((i=i.apply(e,t||[])).next())}))};const _=y,b={formatArgs:function(e){if(e[0]=`${(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+e[0]+(this.useColors?"%c ":" ")}+${b.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)},save:function(e){return v(this,void 0,void 0,(function*(){try{e?yield b.storage.setItem(_,e):yield b.storage.removeItem(_)}catch(e){console.error("debug logger storage error",e)}}))},load:function(){return v(this,void 0,void 0,(function*(){let e;try{e=yield b.storage.getItem(_)}catch(e){console.error("debug logger storage error",e)}return!e&&void 0!==m&&"env"in m&&(e=m.env.DEBUG),e}))},useColors:function(){return!("undefined"==typeof window||!window.process||"renderer"!==window.process.type&&!window.process.__nwjs)||("undefined"==typeof navigator||!navigator.userAgent||!navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))&&("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+)/))}};b.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 v(this,void 0,void 0,(function*(){return""}))},setItem(){return v(this,void 0,void 0,(function*(){}))},removeItem(){return v(this,void 0,void 0,(function*(){}))}})}catch(e){console.error("debug logger storage error",e)}}(),b.humanize=p,b.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`."))}})(),b.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"],b.log=(...e)=>{console.debug?console.debug(...e):console.log&&console.log(...e)};const w=b;var E=__webpack_require__(6139).Promise;const T=function(){return e=this,t=void 0,i=function*(){return function(e){return f(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){return e instanceof Error?e.stack||e.message: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 f(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=p,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}))}(w)},new((r=void 0)||(r=E))((function(n,s){function o(e){try{u(i.next(e))}catch(e){s(e)}}function a(e){try{u(i.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(o,a)}u((i=i.apply(e,t||[])).next())}));var e,t,r,i};function S(...e){"undefined"!=typeof localStorage&&localStorage.getItem(y)&&console.error(...e)}const R={_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 O extends d{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=R,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 O;const A=new class extends O{constructor(){super(),this._debugInstanceCreatedMap={},T().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 I,C;!function(e){e.RESPONSE="RESPONSE",e.REQUEST="REQUEST"}(I||(I={})),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"}(C||(C={}));var k=__webpack_require__(6920);class M 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 k(this.serialize(),N,2)}}class D extends M{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 N(e,t){if("[Circular]"!==t)return t}const P=4500,B={"-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."}};function L(e,t="Unspecified error message. This is a bug, please report it."){if(Number.isInteger(e)){const t=e.toString();if(r=B,i=t,Object.prototype.hasOwnProperty.call(r,i))return B[t].message;if(function(e){return e>=-32099&&e<=-32e3}(e))return"Unspecified server error."}var r,i;return t}L(-32603);const q=e=>F(P,e);function F(e,t){const[r,i]=function(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[]}(t);return new D(e,r||L(e),i)}var j=__webpack_require__(6139).Promise;const U="undefined"!=typeof window?window:global,z="message",H="error";class $ extends d{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=>{return t=this,r=void 0,n=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===I.REQUEST&&this.responseError({id:e.id,scope:e.scope,remoteId:e.remoteId,error:t}),this.emit(H,t)}},new((i=void 0)||(i=j))((function(e,s){function o(e){try{u(n.next(e))}catch(e){s(e)}}function a(e){try{u(n.throw(e))}catch(e){s(e)}}function u(t){var r;t.done?e(t.value):(r=t.value,r instanceof i?r:new i((function(e){e(r)}))).then(o,a)}u((n=n.apply(t,r||[])).next())}));var t,r,i,n},this.version="0.0.17",this.remoteInfo={origin:"",remoteId:""},this.callbacksExpireTimeout=6e5,this.debugLogger=A,this.callbacks=[],this.callbackId=1,this.config=e,this.callbacksExpireTimeout=null!==(t=e.timeout)&&void 0!==t?t:this.callbacksExpireTimeout,this.debugLogger=e.debugLogger||A,this.sendAsString=null!==(r=e.sendAsString)&&void 0!==r?r:this.sendAsString,this.config.receiveHandler&&this.on(z,this.globalOnMessage),this.on(H,(e=>{var t;S("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===I.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,u)=>{var d,l,c;let p=i;s||e!==I.REQUEST||(p=this.createCallbackId());try{const i=this.createPayload({id:p,data:t,error:r,type:e,origin:(null===(d=null==U?void 0:U.location)||void 0===d?void 0:d.origin)||"",remoteId:n,scope:o},{resolve:a,reject:u});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===I.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(H,e)}};if(!s)return new j(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(H,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=q();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(l(e)&&(a=e),c(e))try{a=JSON.parse(e)}catch(f){throw this.emit(H,f),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 S(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 u=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==u?void 0:u.data);const{type:d,id:p,data:h,error:f,origin:y,remoteId:g}=a;if(this.remoteInfo={origin:y,remoteId:g},d===I.RESPONSE){if(null==p)throw new Error("JsBridge ERROR: parameter [id] is required in JsBridge.receive() when REQUEST type message");if(this.callbacks[p])try{f?this.rejectCallback(p,f):this.resolveCallback(p,h)}catch(e){this.emit(H,e)}}else{if(d!==I.REQUEST)throw new Error(`JsBridge ERROR: payload type not support yet (type=${d||"undefined"})`);{const e=Object.assign(Object.assign({},a),{created:Date.now()});this.emit(z,e)}}}requestSync({data:e,scope:t,remoteId:r}){this.send({id:void 0,type:I.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:I.REQUEST,data:t,remoteId:r,sync:!1,scope:i})}response({id:e,data:t,remoteId:r,scope:i}){this.send({type:I.RESPONSE,data:t,id:e,remoteId:r,scope:i,sync:!0})}responseError({id:e,error:t,scope:r,remoteId:i}){this.send({type:I.RESPONSE,error:t,id:e,remoteId:i,scope:r,sync:!0})}}__webpack_require__(1049),__webpack_require__(6139).Promise,__webpack_require__(6139).Promise;let G=!1;class W extends ${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={}){G||(G=!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)}}var V=__webpack_require__(1464);const K="onekey-iframe",Y="onekey-host",X="onekey-js-sdk",Z="$hardware_sdk";let J,Q;const ee=(0,n.jl)(n.d0.SendMessage),te=async(e,t=!0)=>{const r=t?Q:J;try{"LOG_EVENT"!==e.event&&ee.debug("request: ",e);const t=await(r?.request({scope:Z,data:{...e}}));return"LOG_EVENT"!==e.event&&ee.debug("response: ",t),t}catch(e){throw ee.error(e),V.ERRORS.CreateErrorByMessage(e.message)}};let re;const ie=(0,n.jl)(n.d0.Iframe);window.addEventListener("message",(e=>{if(e.source===window||!e.data)return;const r=(0,n.kW)(e);r.type===n.Bg.INIT&&async function(e){if(n.hm.getSettings("origin"))return;const r=(0,n._4)({...e.settings??{},isFrame:!0});r.origin=origin&&"null"!==origin?origin:e.settings.origin,ie.enabled=!!r.debug;try{const e="webusb"===r.env?i():t();re=await(0,n.S0)(r,e),re?.on(n.WE,(e=>te(e,!1)))}catch(e){return(0,n.xG)(e)}(e=>{const t=new W(e);e.isHost?Q=t:J=t})({isHost:!1,remoteFrame:window.parent,remoteFrameName:Y,selfFrameName:K,channel:X,targetOrigin:s(r.parentOrigin),receiveHandler:async e=>{const t=(0,n.kW)(e);ie.debug("Frame Bridge Receive message: ",t);const r=await(re?.handleMessage(t));return ie.debug("Frame Bridge response data: ",r),r}}),await te((0,n.Tl)(n.Bg.INIT_BRIDGE,{}),!1)}(r.payload??{})}),!1)})()})();
|
|
3
|
-
//# sourceMappingURL=iframe.51c8ede48aec304fdfba.js.map
|