@ledgerhq/device-management-kit-devtools-rozenite 0.0.0-develop-20260401001841 → 0.0.0-develop-20260403001844
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/dist/index.js +2 -2
- package/dist/rozenite.json +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -510,7 +510,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
510
510
|
|
|
511
511
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
512
512
|
and limitations under the License.
|
|
513
|
-
***************************************************************************** */var qC;(function(e){(function(t){var r=typeof globalThis=="object"?globalThis:typeof self=="object"||typeof self=="object"?self:typeof this=="object"?this:u(),n=i(e);typeof r.Reflect<"u"&&(n=i(r.Reflect,n)),t(n,r),typeof r.Reflect>"u"&&(r.Reflect=e);function i(c,f){return function(d,g){Object.defineProperty(c,d,{configurable:!0,writable:!0,value:g}),f&&f(d,g)}}function o(){try{return Function("return this;")()}catch{}}function s(){try{return(0,eval)("(function() { return this; })()")}catch{}}function u(){return o()||s()}})(function(t,r){var n=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",o=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",s=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",u=typeof Object.create=="function",c={__proto__:[]}instanceof Array,f=!u&&!c,d={create:u?function(){return It(Object.create(null))}:c?function(){return It({__proto__:null})}:function(){return It({})},has:f?function(ne,se){return n.call(ne,se)}:function(ne,se){return se in ne},get:f?function(ne,se){return n.call(ne,se)?ne[se]:void 0}:function(ne,se){return ne[se]}},g=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Pt(),b=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:ht(),v=typeof WeakMap=="function"?WeakMap:Ft(),S=i?Symbol.for("@reflect-metadata:registry"):void 0,y=Ue(),E=Re(y);function x(ne,se,pe,Y){if(P(pe)){if(!Ee(ne))throw new TypeError;if(!Te(se))throw new TypeError;return z(ne,se)}else{if(!Ee(ne))throw new TypeError;if(!te(se))throw new TypeError;if(!te(Y)&&!P(Y)&&!G(Y))throw new TypeError;return G(Y)&&(Y=void 0),pe=he(pe),B(ne,se,pe,Y)}}t("decorate",x);function T(ne,se){function pe(Y,V){if(!te(Y))throw new TypeError;if(!P(V)&&!Ce(V))throw new TypeError;M(ne,se,Y,V)}return pe}t("metadata",T);function A(ne,se,pe,Y){if(!te(pe))throw new TypeError;return P(Y)||(Y=he(Y)),M(ne,se,pe,Y)}t("defineMetadata",A);function R(ne,se,pe){if(!te(se))throw new TypeError;return P(pe)||(pe=he(pe)),N(ne,se,pe)}t("hasMetadata",R);function $(ne,se,pe){if(!te(se))throw new TypeError;return P(pe)||(pe=he(pe)),j(ne,se,pe)}t("hasOwnMetadata",$);function O(ne,se,pe){if(!te(se))throw new TypeError;return P(pe)||(pe=he(pe)),H(ne,se,pe)}t("getMetadata",O);function I(ne,se,pe){if(!te(se))throw new TypeError;return P(pe)||(pe=he(pe)),X(ne,se,pe)}t("getOwnMetadata",I);function L(ne,se){if(!te(ne))throw new TypeError;return P(se)||(se=he(se)),Q(ne,se)}t("getMetadataKeys",L);function F(ne,se){if(!te(ne))throw new TypeError;return P(se)||(se=he(se)),W(ne,se)}t("getOwnMetadataKeys",F);function q(ne,se,pe){if(!te(se))throw new TypeError;if(P(pe)||(pe=he(pe)),!te(se))throw new TypeError;P(pe)||(pe=he(pe));var Y=ct(se,pe,!1);return P(Y)?!1:Y.OrdinaryDeleteMetadata(ne,se,pe)}t("deleteMetadata",q);function z(ne,se){for(var pe=ne.length-1;pe>=0;--pe){var Y=ne[pe],V=Y(se);if(!P(V)&&!G(V)){if(!Te(V))throw new TypeError;se=V}}return se}function B(ne,se,pe,Y){for(var V=ne.length-1;V>=0;--V){var ee=ne[V],Oe=ee(se,pe,Y);if(!P(Oe)&&!G(Oe)){if(!te(Oe))throw new TypeError;Y=Oe}}return Y}function N(ne,se,pe){var Y=j(ne,se,pe);if(Y)return!0;var V=ze(se);return G(V)?!1:N(ne,V,pe)}function j(ne,se,pe){var Y=ct(se,pe,!1);return P(Y)?!1:ae(Y.OrdinaryHasOwnMetadata(ne,se,pe))}function H(ne,se,pe){var Y=j(ne,se,pe);if(Y)return X(ne,se,pe);var V=ze(se);if(!G(V))return H(ne,V,pe)}function X(ne,se,pe){var Y=ct(se,pe,!1);if(!P(Y))return Y.OrdinaryGetOwnMetadata(ne,se,pe)}function M(ne,se,pe,Y){var V=ct(pe,Y,!0);V.OrdinaryDefineOwnMetadata(ne,se,pe,Y)}function Q(ne,se){var pe=W(ne,se),Y=ze(ne);if(Y===null)return pe;var V=Q(Y,se);if(V.length<=0)return pe;if(pe.length<=0)return V;for(var ee=new b,Oe=[],le=0,fe=pe;le<fe.length;le++){var ve=fe[le],Ie=ee.has(ve);Ie||(ee.add(ve),Oe.push(ve))}for(var De=0,Be=V;De<Be.length;De++){var ve=Be[De],Ie=ee.has(ve);Ie||(ee.add(ve),Oe.push(ve))}return Oe}function W(ne,se){var pe=ct(ne,se,!1);return pe?pe.OrdinaryOwnMetadataKeys(ne,se):[]}function D(ne){if(ne===null)return 1;switch(typeof ne){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return ne===null?1:6;default:return 6}}function P(ne){return ne===void 0}function G(ne){return ne===null}function Z(ne){return typeof ne=="symbol"}function te(ne){return typeof ne=="object"?ne!==null:typeof ne=="function"}function K(ne,se){switch(D(ne)){case 0:return ne;case 1:return ne;case 2:return ne;case 3:return ne;case 4:return ne;case 5:return ne}var pe="string",Y=$e(ne,o);if(Y!==void 0){var V=Y.call(ne,pe);if(te(V))throw new TypeError;return V}return be(ne)}function be(ne,se){var pe,Y,V;{var ee=ne.toString;if(we(ee)){var Y=ee.call(ne);if(!te(Y))return Y}var pe=ne.valueOf;if(we(pe)){var Y=pe.call(ne);if(!te(Y))return Y}}throw new TypeError}function ae(ne){return!!ne}function Se(ne){return""+ne}function he(ne){var se=K(ne);return Z(se)?se:Se(se)}function Ee(ne){return Array.isArray?Array.isArray(ne):ne instanceof Object?ne instanceof Array:Object.prototype.toString.call(ne)==="[object Array]"}function we(ne){return typeof ne=="function"}function Te(ne){return typeof ne=="function"}function Ce(ne){switch(D(ne)){case 3:return!0;case 4:return!0;default:return!1}}function _e(ne,se){return ne===se||ne!==ne&&se!==se}function $e(ne,se){var pe=ne[se];if(pe!=null){if(!we(pe))throw new TypeError;return pe}}function ke(ne){var se=$e(ne,s);if(!we(se))throw new TypeError;var pe=se.call(ne);if(!te(pe))throw new TypeError;return pe}function Ge(ne){return ne.value}function Qe(ne){var se=ne.next();return se.done?!1:se}function je(ne){var se=ne.return;se&&se.call(ne)}function ze(ne){var se=Object.getPrototypeOf(ne);if(typeof ne!="function"||ne===g||se!==g)return se;var pe=ne.prototype,Y=pe&&Object.getPrototypeOf(pe);if(Y==null||Y===Object.prototype)return se;var V=Y.constructor;return typeof V!="function"||V===ne?se:V}function Ye(){var ne;!P(S)&&typeof r.Reflect<"u"&&!(S in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(ne=Xe(r.Reflect));var se,pe,Y,V=new v,ee={registerProvider:Oe,getProvider:fe,setProvider:Ie};return ee;function Oe(De){if(!Object.isExtensible(ee))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case ne===De:break;case P(se):se=De;break;case se===De:break;case P(pe):pe=De;break;case pe===De:break;default:Y===void 0&&(Y=new b),Y.add(De);break}}function le(De,Be){if(!P(se)){if(se.isProviderFor(De,Be))return se;if(!P(pe)){if(pe.isProviderFor(De,Be))return se;if(!P(Y))for(var Ze=ke(Y);;){var et=Qe(Ze);if(!et)return;var tt=Ge(et);if(tt.isProviderFor(De,Be))return je(Ze),tt}}}if(!P(ne)&&ne.isProviderFor(De,Be))return ne}function fe(De,Be){var Ze=V.get(De),et;return P(Ze)||(et=Ze.get(Be)),P(et)&&(et=le(De,Be),P(et)||(P(Ze)&&(Ze=new h,V.set(De,Ze)),Ze.set(Be,et))),et}function ve(De){if(P(De))throw new TypeError;return se===De||pe===De||!P(Y)&&Y.has(De)}function Ie(De,Be,Ze){if(!ve(Ze))throw new Error("Metadata provider not registered.");var et=fe(De,Be);if(et!==Ze){if(!P(et))return!1;var tt=V.get(De);P(tt)&&(tt=new h,V.set(De,tt)),tt.set(Be,Ze)}return!0}}function Ue(){var ne;return!P(S)&&te(r.Reflect)&&Object.isExtensible(r.Reflect)&&(ne=r.Reflect[S]),P(ne)&&(ne=Ye()),!P(S)&&te(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,S,{enumerable:!1,configurable:!1,writable:!1,value:ne}),ne}function Re(ne){var se=new v,pe={isProviderFor:function(ve,Ie){var De=se.get(ve);return P(De)?!1:De.has(Ie)},OrdinaryDefineOwnMetadata:Oe,OrdinaryHasOwnMetadata:V,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:le,OrdinaryDeleteMetadata:fe};return y.registerProvider(pe),pe;function Y(ve,Ie,De){var Be=se.get(ve),Ze=!1;if(P(Be)){if(!De)return;Be=new h,se.set(ve,Be),Ze=!0}var et=Be.get(Ie);if(P(et)){if(!De)return;if(et=new h,Be.set(Ie,et),!ne.setProvider(ve,Ie,pe))throw Be.delete(Ie),Ze&&se.delete(ve),new Error("Wrong provider for target.")}return et}function V(ve,Ie,De){var Be=Y(Ie,De,!1);return P(Be)?!1:ae(Be.has(ve))}function ee(ve,Ie,De){var Be=Y(Ie,De,!1);if(!P(Be))return Be.get(ve)}function Oe(ve,Ie,De,Be){var Ze=Y(De,Be,!0);Ze.set(ve,Ie)}function le(ve,Ie){var De=[],Be=Y(ve,Ie,!1);if(P(Be))return De;for(var Ze=Be.keys(),et=ke(Ze),tt=0;;){var Bt=Qe(et);if(!Bt)return De.length=tt,De;var dt=Ge(Bt);try{De[tt]=dt}catch(gt){try{je(et)}finally{throw gt}}tt++}}function fe(ve,Ie,De){var Be=Y(Ie,De,!1);if(P(Be)||!Be.delete(ve))return!1;if(Be.size===0){var Ze=se.get(Ie);P(Ze)||(Ze.delete(De),Ze.size===0&&se.delete(Ze))}return!0}}function Xe(ne){var se=ne.defineMetadata,pe=ne.hasOwnMetadata,Y=ne.getOwnMetadata,V=ne.getOwnMetadataKeys,ee=ne.deleteMetadata,Oe=new v,le={isProviderFor:function(fe,ve){var Ie=Oe.get(fe);return!P(Ie)&&Ie.has(ve)?!0:V(fe,ve).length?(P(Ie)&&(Ie=new b,Oe.set(fe,Ie)),Ie.add(ve),!0):!1},OrdinaryDefineOwnMetadata:se,OrdinaryHasOwnMetadata:pe,OrdinaryGetOwnMetadata:Y,OrdinaryOwnMetadataKeys:V,OrdinaryDeleteMetadata:ee};return le}function ct(ne,se,pe){var Y=y.getProvider(ne,se);if(!P(Y))return Y;if(pe){if(y.setProvider(ne,se,E))return E;throw new Error("Illegal state.")}}function Pt(){var ne={},se=[],pe=(function(){function le(fe,ve,Ie){this._index=0,this._keys=fe,this._values=ve,this._selector=Ie}return le.prototype["@@iterator"]=function(){return this},le.prototype[s]=function(){return this},le.prototype.next=function(){var fe=this._index;if(fe>=0&&fe<this._keys.length){var ve=this._selector(this._keys[fe],this._values[fe]);return fe+1>=this._keys.length?(this._index=-1,this._keys=se,this._values=se):this._index++,{value:ve,done:!1}}return{value:void 0,done:!0}},le.prototype.throw=function(fe){throw this._index>=0&&(this._index=-1,this._keys=se,this._values=se),fe},le.prototype.return=function(fe){return this._index>=0&&(this._index=-1,this._keys=se,this._values=se),{value:fe,done:!0}},le})(),Y=(function(){function le(){this._keys=[],this._values=[],this._cacheKey=ne,this._cacheIndex=-2}return Object.defineProperty(le.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),le.prototype.has=function(fe){return this._find(fe,!1)>=0},le.prototype.get=function(fe){var ve=this._find(fe,!1);return ve>=0?this._values[ve]:void 0},le.prototype.set=function(fe,ve){var Ie=this._find(fe,!0);return this._values[Ie]=ve,this},le.prototype.delete=function(fe){var ve=this._find(fe,!1);if(ve>=0){for(var Ie=this._keys.length,De=ve+1;De<Ie;De++)this._keys[De-1]=this._keys[De],this._values[De-1]=this._values[De];return this._keys.length--,this._values.length--,_e(fe,this._cacheKey)&&(this._cacheKey=ne,this._cacheIndex=-2),!0}return!1},le.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=ne,this._cacheIndex=-2},le.prototype.keys=function(){return new pe(this._keys,this._values,V)},le.prototype.values=function(){return new pe(this._keys,this._values,ee)},le.prototype.entries=function(){return new pe(this._keys,this._values,Oe)},le.prototype["@@iterator"]=function(){return this.entries()},le.prototype[s]=function(){return this.entries()},le.prototype._find=function(fe,ve){if(!_e(this._cacheKey,fe)){this._cacheIndex=-1;for(var Ie=0;Ie<this._keys.length;Ie++)if(_e(this._keys[Ie],fe)){this._cacheIndex=Ie;break}}return this._cacheIndex<0&&ve&&(this._cacheIndex=this._keys.length,this._keys.push(fe),this._values.push(void 0)),this._cacheIndex},le})();return Y;function V(le,fe){return le}function ee(le,fe){return fe}function Oe(le,fe){return[le,fe]}}function ht(){var ne=(function(){function se(){this._map=new h}return Object.defineProperty(se.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),se.prototype.has=function(pe){return this._map.has(pe)},se.prototype.add=function(pe){return this._map.set(pe,pe),this},se.prototype.delete=function(pe){return this._map.delete(pe)},se.prototype.clear=function(){this._map.clear()},se.prototype.keys=function(){return this._map.keys()},se.prototype.values=function(){return this._map.keys()},se.prototype.entries=function(){return this._map.entries()},se.prototype["@@iterator"]=function(){return this.keys()},se.prototype[s]=function(){return this.keys()},se})();return ne}function Ft(){var ne=16,se=d.create(),pe=Y();return(function(){function fe(){this._key=Y()}return fe.prototype.has=function(ve){var Ie=V(ve,!1);return Ie!==void 0?d.has(Ie,this._key):!1},fe.prototype.get=function(ve){var Ie=V(ve,!1);return Ie!==void 0?d.get(Ie,this._key):void 0},fe.prototype.set=function(ve,Ie){var De=V(ve,!0);return De[this._key]=Ie,this},fe.prototype.delete=function(ve){var Ie=V(ve,!1);return Ie!==void 0?delete Ie[this._key]:!1},fe.prototype.clear=function(){this._key=Y()},fe})();function Y(){var fe;do fe="@@WeakMap@@"+le();while(d.has(se,fe));return se[fe]=!0,fe}function V(fe,ve){if(!n.call(fe,pe)){if(!ve)return;Object.defineProperty(fe,pe,{value:d.create()})}return fe[pe]}function ee(fe,ve){for(var Ie=0;Ie<ve;++Ie)fe[Ie]=Math.random()*255|0;return fe}function Oe(fe){if(typeof Uint8Array=="function"){var ve=new Uint8Array(fe);return typeof crypto<"u"?crypto.getRandomValues(ve):typeof msCrypto<"u"?msCrypto.getRandomValues(ve):ee(ve,fe),ve}return ee(new Array(fe),fe)}function le(){var fe=Oe(ne);fe[6]=fe[6]&79|64,fe[8]=fe[8]&191|128;for(var ve="",Ie=0;Ie<ne;++Ie){var De=fe[Ie];(Ie===4||Ie===6||Ie===8)&&(ve+="-"),De<16&&(ve+="0"),ve+=De.toString(16).toLowerCase()}return ve}}function It(ne){return ne.__=void 0,delete ne.__,ne}})})(qC||(qC={}));let ej=class{cla;ins;p1;p2;data;constructor(t,r,n,i,o){this.cla=t,this.ins=r,this.p1=n,this.p2=i,this.data=o??new Uint8Array}getRawApdu(){const t=Uint8Array.from([this.cla,this.ins,this.p1,this.p2,this.data.length]),r=new Uint8Array(t.length+this.data.length);return r.set(t,0),this.data.length>0&&r.set(this.data,t.length),r}};function GC(e){if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)return new Uint8Array;if(e.length%2!==0&&(e="0"+e),/^[0-9a-fA-F]*$/.test(e)===!1)return null;const t=e.match(/.{1,2}/g)?.map(r=>parseInt(r,16));return!t||t.some(isNaN)?null:new Uint8Array(t)}function dc(e,t=!0){return`${t?"0x":""}${Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}`}let Av=class{_tag="ValueOverflow";originalError;message;constructor(t,r=XI){this.message=`Value overflow for ${t}, max is ${r}`}},gd=class{_tag="DataOverflow";message;originalError;constructor(t,r=0){this.message=r===0?`this.data is already full (value: ${t})`:`this.data will overflow with "${t}", remaining bytes: ${r}`}},XC=class{_tag="HexaString";message;originalError;constructor(t){this.message=`Invalid encoded hexa string or length is null: ${t}`}};const tj=4294967295;let rj=class{constructor(t=tj){this.maxPayloadSize=t}data=new Uint8Array;errors=[];build=()=>this.data;tryBuild=()=>this.hasErrors()?void 0:this.data;add8BitUIntToData=t=>this.addNumberToData(t,8n,!1,!1);add16BitUIntToData=(t,r=!0)=>this.addNumberToData(t,16n,!1,r);add32BitUIntToData=(t,r=!0)=>this.addNumberToData(t,32n,!1,r);add64BitUIntToData=(t,r=!0)=>this.addNumberToData(t,64n,!1,r);add128BitUIntToData=(t,r=!0)=>this.addNumberToData(t,128n,!1,r);add256BitUIntToData=(t,r=!0)=>this.addNumberToData(t,256n,!1,r);add16BitIntToData=(t,r=!0)=>this.addNumberToData(t,16n,!0,r);add32BitIntToData=(t,r=!0)=>this.addNumberToData(t,32n,!0,r);add64BitIntToData=(t,r=!0)=>this.addNumberToData(t,64n,!0,r);add128BitIntToData=(t,r=!0)=>this.addNumberToData(t,128n,!0,r);add256BitIntToData=(t,r=!0)=>this.addNumberToData(t,256n,!0,r);addBufferToData=t=>this.hasEnoughLengthRemaining(t)?(this.data=Uint8Array.from([...this.data,...t]),this):(this.errors.push(new gd(t.toString())),this);addHexaStringToData=t=>{const r=GC(t);return r===null||r.length===0?(this.errors.push(new XC(t)),this):(this.addBufferToData(r),this)};addAsciiStringToData=t=>{const r=new TextEncoder().encode(t);return this.addBufferToData(r),this};encodeInLVFromHexa=t=>{const r=GC(t);return r===null||r.length===0?(this.errors.push(new XC(t)),this):this.hasEnoughLengthRemaining(r,!0)?(this.add8BitUIntToData(r.length),this.addBufferToData(r),this):(this.errors.push(new gd(t)),this)};encodeInLVFromBuffer=t=>this.hasEnoughLengthRemaining(t,!0)?(this.add8BitUIntToData(t.length),this.addBufferToData(t),this):(this.errors.push(new gd(t.toString())),this);encodeInLVFromAscii=t=>this.hasEnoughLengthRemaining(t,!0)?(this.add8BitUIntToData(t.length),this.addAsciiStringToData(t),this):(this.errors.push(new gd(t)),this);encodeInTLVFromAscii=(t,r)=>(this.add8BitUIntToData(t),this.encodeInLVFromAscii(r));encodeInTLVFromHexa=(t,r)=>(this.add8BitUIntToData(t),this.encodeInLVFromHexa(r));encodeInTLVFromBuffer=(t,r)=>(this.add8BitUIntToData(t),this.encodeInLVFromBuffer(r));encodeInTLVFromUInt8=(t,r)=>(this.add8BitUIntToData(t),this.add8BitUIntToData(1),this.add8BitUIntToData(r));encodeInTLVFromUInt16=(t,r,n=!0)=>(this.add8BitUIntToData(t),this.add8BitUIntToData(2),this.add16BitUIntToData(r,n));encodeInTLVFromUInt32=(t,r,n=!0)=>(this.add8BitUIntToData(t),this.add8BitUIntToData(4),this.add32BitUIntToData(r,n));encodeInTLVFromUInt64=(t,r,n=!0)=>(this.add8BitUIntToData(t),this.add8BitUIntToData(8),this.add64BitUIntToData(r,n));getAvailablePayloadLength=()=>this.maxPayloadSize-this.data.length;getErrors=()=>this.errors;hasErrors=()=>this.errors.length!==0;hasEnoughLengthRemaining=(t,r=!1)=>this.data.length+t.length+(r?1:0)<=this.maxPayloadSize;addNumberToData(t,r,n,i){let o=this.checkBoundsAndConvert(t,r,n);if(o===void 0)return this;const s=Number(r)/8,u=new Uint8Array(s);if(i)for(let c=s-1;c>=0;c--)u[c]=Number(o&0xffn),o>>=8n;else for(let c=0;c<s;c++)u[c]=Number(o&0xffn),o>>=8n;return this.addBufferToData(u)}checkBoundsAndConvert(t,r,n){if(typeof t=="number"){if(!Number.isInteger(t)||t>Number.MAX_SAFE_INTEGER){this.errors.push(new Av(t.toString()));return}t=BigInt(t)}if(n){const i=1n<<r-1n;if(t>=i||t<-i){this.errors.push(new Av(t.toString(),i-1n));return}if(t<0n){const o=(1n<<r)-1n;t=-t,t=(~t&o)+1n}}else{const i=1n<<r;if(t<0||t>=i){this.errors.push(new Av(t.toString(),i-1n));return}}return t}};const XI=255;let KI=class{_ins;_cla;_p1;p2;data=new rj(XI);constructor({ins:t,cla:r,p1:n,p2:i}){this._cla=r&255,this._ins=t&255,this._p1=n&255,this.p2=i&255}build=()=>new ej(this._cla,this._ins,this._p1,this.p2,this.data.build());add8BitUIntToData=t=>(this.data.add8BitUIntToData(t),this);add16BitUIntToData=t=>(this.data.add16BitUIntToData(t),this);add32BitUIntToData=t=>(this.data.add32BitUIntToData(t),this);add64BitUIntToData=(t,r=!0)=>(this.data.add64BitUIntToData(t,r),this);addBufferToData=t=>(this.data.addBufferToData(t),this);addHexaStringToData=t=>(this.data.addHexaStringToData(t),this);addAsciiStringToData=t=>(this.data.addAsciiStringToData(t),this);encodeInLVFromHexa=t=>(this.data.encodeInLVFromHexa(t),this);encodeInLVFromBuffer=t=>(this.data.encodeInLVFromBuffer(t),this);encodeInLVFromAscii=t=>(this.data.encodeInLVFromAscii(t),this);getAvailablePayloadLength=()=>this.data.getAvailablePayloadLength();getErrors=()=>this.data.getErrors()},nj=class{constructor(t){this.buffer=t}index=0;testMinimalLength(t){return t<=this.buffer.length-this.index}extract8BitUInt(){if(!this.outOfRange(1))return this.buffer[this.index++]}extract16BitUInt(t=!0){const r=this.extractNumber(16n,!1,t);return r===void 0?void 0:Number(r)}extract16BitInt(t=!0){const r=this.extractNumber(16n,!0,t);return r===void 0?void 0:Number(r)}extract32BitUInt(t=!0){const r=this.extractNumber(32n,!1,t);return r===void 0?void 0:Number(r)}extract32BitInt(t=!0){const r=this.extractNumber(32n,!0,t);return r===void 0?void 0:Number(r)}extract64BitUInt(t=!0){return this.extractNumber(64n,!1,t)}extract64BitInt(t=!0){return this.extractNumber(64n,!0,t)}extract128BitUInt(t=!0){return this.extractNumber(128n,!1,t)}extract128BitInt(t=!0){return this.extractNumber(128n,!0,t)}extract256BitUInt(t=!0){return this.extractNumber(256n,!1,t)}extract256BitInt(t=!0){return this.extractNumber(256n,!0,t)}extractFieldByLength(t){if(this.outOfRange(t))return;if(t===0)return new Uint8Array;const r=this.buffer.slice(this.index,this.index+t);return this.index+=t,r}extractFieldLVEncoded(){const t=this.extract8BitUInt();if(t===void 0)return;if(t===0)return new Uint8Array;const r=this.extractFieldByLength(t);return r===void 0&&this.index--,r}extractFieldTLVEncoded(){if(this.outOfRange(2))return;const t=this.index,r=this.extract8BitUInt(),n=this.extractFieldLVEncoded();if(r===void 0||n===void 0){this.index--;return}const i=this.index;return{tag:r,value:n,tlv:this.buffer.slice(t,i)}}encodeToHexaString(t,r=!1){if(t===void 0||t.length===0)return"";const n=dc(t);return r?n:n.slice(2)}encodeToString(t){let r="",n=0;if(!t)return r;for(;n<=t.length;){const i=t[n];i&&(r+=String.fromCharCode(i)),n++}return r}getCurrentIndex(){return this.index}resetIndex(){this.index=0}getUnparsedRemainingLength(){return this.buffer.length-this.index}outOfRange(t){return this.index+t>this.buffer.length}extractNumber(t,r,n){const i=Number(t)/8;if(this.outOfRange(i))return;let o=0n;if(n)for(let s=0;s<i;s++)o=o<<8n|BigInt(this.buffer[s+this.index]);else for(let s=i-1;s>=0;s--)o=o<<8n|BigInt(this.buffer[s+this.index]);if(r){const s=1n<<t-1n;o&s&&(o-=s<<1n)}return this.index+=i,o}},A1=class{parser;constructor(t){this.parser=new nj(t.data)}testMinimalLength=t=>this.parser.testMinimalLength(t);extract8BitUInt=()=>this.parser.extract8BitUInt();extract16BitUInt=()=>this.parser.extract16BitUInt();extract32BitUInt=()=>this.parser.extract32BitUInt();extractFieldByLength=t=>this.parser.extractFieldByLength(t);extractFieldLVEncoded=()=>this.parser.extractFieldLVEncoded();extractFieldTLVEncoded=()=>this.parser.extractFieldTLVEncoded();encodeToHexaString(t,r=!1){return r?this.parser.encodeToHexaString(t,!0):this.parser.encodeToHexaString(t,!1)}encodeToString=t=>this.parser.encodeToString(t);getUnparsedRemainingLength=()=>this.parser.getUnparsedRemainingLength()},ij=class{_tag="InvalidStatusWordError";originalError;constructor(t){this.originalError=new Error(t??"Invalid status word.")}},oj=class{_tag="InvalidResponseFormatError";originalError;constructor(t){this.originalError=new Error(t??"Invalid response format.")}};var aj=(e=>(e.Error="ERROR",e.Success="SUCCESS",e))(aj||{});function us({data:e,error:t}){return t?{status:"ERROR",error:t}:{status:"SUCCESS",data:e}}function sj(e){return e.status==="SUCCESS"}let $1=class hl{static isValidStatusCode(t){return t.length===2}static isSuccessResponse({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===144&&t[1]===0:!1}static isLockedDeviceResponse({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===85&&t[1]===21||t[0]===105&&t[1]===130||t[0]===83&&t[1]===3:!1}static isRefusedByUser({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===85&&t[1]===1||t[0]===105&&t[1]===133:!1}static isAppAlreadyInstalled({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===106&&t[1]===128||t[0]===106&&t[1]===129||t[0]===106&&t[1]===142||t[0]===106&&t[1]===143:!1}static isOutOfMemory({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===106&&t[1]===132||t[0]===106&&t[1]===133||t[0]===81&&t[1]===2||t[0]===81&&t[1]===3:!1}static isApduThatTriggersDisconnection(t){const r=new Map;return r.set("openApp",new Uint8Array([224,216,0,0])),r.set("closeApp",new Uint8Array([176,167,0,0])),Array.from(r.values()).some(n=>{for(let i=0;i<4;i++)if(n[i]!==t[i])return!1;return!0})}},lj=class{_tag;originalError;errorCode;message;constructor({tag:t,errorCode:r,originalError:n,message:i}){this._tag=t,this.originalError=n,this.errorCode=r,this.message=i??"An error occured during device exchange."}},uj=class{_tag="UnknownDeviceExchangeError";originalError;message;constructor(t){this.originalError=t,this.message="Unexpected device exchange error happened."}};const cj=(e,t)=>Object.keys(t).includes(e);let fj=class extends lj{constructor(t){super({tag:"GlobalCommandError",...t})}};const KC={5515:{message:"Device is locked.",tag:"DeviceLockedError"},5501:{message:"Action refused on device.",tag:"ActionRefusedError"},5502:{message:"Pin is not set",tag:"PinNotSetError"},5223:{message:"Device internal error",tag:"DeviceInternalError"},"6e00":{message:"CLA not supported",tag:"DeviceInternalError"},"6d00":{message:"INS not supported",tag:"DeviceInternalError"}};let YI=class{static handle(t){const r=new A1(t).encodeToHexaString(t.statusCode);return cj(r,KC)?new fj({...KC[r],errorCode:r}):new uj({message:"UnknownError",errorCode:r})}},YC=class{name="getAppAndVersion";args=void 0;getApdu(){const t={cla:176,ins:1,p1:0,p2:0};return new KI(t).build()}parseResponse(t){if(!$1.isSuccessResponse(t))return us({error:YI.handle(t)});const r=new A1(t);if(r.extract8BitUInt()!==1)return us({error:new oj("getAppAndVersion: format not supported")});const n=r.encodeToString(r.extractFieldLVEncoded()),i=r.encodeToString(r.extractFieldLVEncoded());if(r.getUnparsedRemainingLength()===0)return us({data:{name:n,version:i}});const o=r.extractFieldLVEncoded();return us({data:{name:n,version:i,flags:o}})}};var dj=(e=>(e[e.BATTERY_PERCENTAGE=0]="BATTERY_PERCENTAGE",e[e.BATTERY_VOLTAGE=1]="BATTERY_VOLTAGE",e[e.BATTERY_TEMPERATURE=2]="BATTERY_TEMPERATURE",e[e.BATTERY_CURRENT=3]="BATTERY_CURRENT",e[e.BATTERY_FLAGS=4]="BATTERY_FLAGS",e))(dj||{}),pj=(e=>(e[e.NONE=0]="NONE",e[e.USB=1]="USB",e[e.QI=2]="QI",e))(pj||{}),vd={exports:{}},$v,JC;function Hp(){if(JC)return $v;JC=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,i=t-6;return $v={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},$v}var Iv,QC;function Wp(){if(QC)return Iv;QC=1;var e={};return Iv=typeof process=="object"&&e&&e.NODE_DEBUG&&/\bsemver\b/i.test(e.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{},Iv}var ZC;function kc(){return ZC||(ZC=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Hp(),o=Wp();t=e.exports={};const s=t.re=[],u=t.safeRe=[],c=t.src=[],f=t.safeSrc=[],d=t.t={};let g=0;const h="[a-zA-Z0-9-]",b=[["\\s",1],["\\d",i],[h,n]],v=y=>{for(const[E,x]of b)y=y.split(`${E}*`).join(`${E}{0,${x}}`).split(`${E}+`).join(`${E}{1,${x}}`);return y},S=(y,E,x)=>{const T=v(E),A=g++;o(y,A,E),d[y]=A,c[A]=E,f[A]=T,s[A]=new RegExp(E,x?"g":void 0),u[A]=new RegExp(T,x?"g":void 0)};S("NUMERICIDENTIFIER","0|[1-9]\\d*"),S("NUMERICIDENTIFIERLOOSE","\\d+"),S("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),S("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),S("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),S("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),S("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),S("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),S("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),S("BUILDIDENTIFIER",`${h}+`),S("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),S("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),S("FULL",`^${c[d.FULLPLAIN]}$`),S("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),S("LOOSE",`^${c[d.LOOSEPLAIN]}$`),S("GTLT","((?:<|>)?=?)"),S("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),S("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),S("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),S("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),S("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),S("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),S("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),S("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),S("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?(?:${c[d.BUILD]})?(?:$|[^\\d])`),S("COERCERTL",c[d.COERCE],!0),S("COERCERTLFULL",c[d.COERCEFULL],!0),S("LONETILDE","(?:~>?)"),S("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",S("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),S("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),S("LONECARET","(?:\\^)"),S("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",S("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),S("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),S("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),S("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),S("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",S("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),S("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),S("STAR","(<|>)?=?\\s*\\*"),S("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),S("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(vd,vd.exports)),vd.exports}var Pv,eR;function I1(){if(eR)return Pv;eR=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return Pv=n=>n?typeof n!="object"?e:n:t,Pv}var kv,tR;function JI(){if(tR)return kv;tR=1;const e=/^[0-9]+$/,t=(n,i)=>{const o=e.test(n),s=e.test(i);return o&&s&&(n=+n,i=+i),n===i?0:o&&!s?-1:s&&!o?1:n<i?-1:1};return kv={compareIdentifiers:t,rcompareIdentifiers:(n,i)=>t(i,n)},kv}var Mv,rR;function vn(){if(rR)return Mv;rR=1;const e=Wp(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Hp(),{safeRe:n,t:i}=kc(),o=I1(),{compareIdentifiers:s}=JI();class u{constructor(f,d){if(d=o(d),f instanceof u){if(f.loose===!!d.loose&&f.includePrerelease===!!d.includePrerelease)return f;f=f.version}else if(typeof f!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof f}".`);if(f.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",f,d),this.options=d,this.loose=!!d.loose,this.includePrerelease=!!d.includePrerelease;const g=f.trim().match(d.loose?n[i.LOOSE]:n[i.FULL]);if(!g)throw new TypeError(`Invalid Version: ${f}`);if(this.raw=f,this.major=+g[1],this.minor=+g[2],this.patch=+g[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");g[4]?this.prerelease=g[4].split(".").map(h=>{if(/^[0-9]+$/.test(h)){const b=+h;if(b>=0&&b<r)return b}return h}):this.prerelease=[],this.build=g[5]?g[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(f){if(e("SemVer.compare",this.version,this.options,f),!(f instanceof u)){if(typeof f=="string"&&f===this.version)return 0;f=new u(f,this.options)}return f.version===this.version?0:this.compareMain(f)||this.comparePre(f)}compareMain(f){return f instanceof u||(f=new u(f,this.options)),s(this.major,f.major)||s(this.minor,f.minor)||s(this.patch,f.patch)}comparePre(f){if(f instanceof u||(f=new u(f,this.options)),this.prerelease.length&&!f.prerelease.length)return-1;if(!this.prerelease.length&&f.prerelease.length)return 1;if(!this.prerelease.length&&!f.prerelease.length)return 0;let d=0;do{const g=this.prerelease[d],h=f.prerelease[d];if(e("prerelease compare",d,g,h),g===void 0&&h===void 0)return 0;if(h===void 0)return 1;if(g===void 0)return-1;if(g===h)continue;return s(g,h)}while(++d)}compareBuild(f){f instanceof u||(f=new u(f,this.options));let d=0;do{const g=this.build[d],h=f.build[d];if(e("build compare",d,g,h),g===void 0&&h===void 0)return 0;if(h===void 0)return 1;if(g===void 0)return-1;if(g===h)continue;return s(g,h)}while(++d)}inc(f,d,g){if(f.startsWith("pre")){if(!d&&g===!1)throw new Error("invalid increment argument: identifier is empty");if(d){const h=`-${d}`.match(this.options.loose?n[i.PRERELEASELOOSE]:n[i.PRERELEASE]);if(!h||h[1]!==d)throw new Error(`invalid identifier: ${d}`)}}switch(f){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",d,g);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",d,g);break;case"prepatch":this.prerelease.length=0,this.inc("patch",d,g),this.inc("pre",d,g);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",d,g),this.inc("pre",d,g);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const h=Number(g)?1:0;if(this.prerelease.length===0)this.prerelease=[h];else{let b=this.prerelease.length;for(;--b>=0;)typeof this.prerelease[b]=="number"&&(this.prerelease[b]++,b=-2);if(b===-1){if(d===this.prerelease.join(".")&&g===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(h)}}if(d){let b=[d,h];g===!1&&(b=[d]),s(this.prerelease[0],d)===0?isNaN(this.prerelease[1])&&(this.prerelease=b):this.prerelease=b}break}default:throw new Error(`invalid increment argument: ${f}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Mv=u,Mv}var Dv,nR;function ql(){if(nR)return Dv;nR=1;const e=vn();return Dv=(r,n,i=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(o){if(!i)return null;throw o}},Dv}var Lv,iR;function hj(){if(iR)return Lv;iR=1;const e=ql();return Lv=(r,n)=>{const i=e(r,n);return i?i.version:null},Lv}var Fv,oR;function gj(){if(oR)return Fv;oR=1;const e=ql();return Fv=(r,n)=>{const i=e(r.trim().replace(/^[=v]+/,""),n);return i?i.version:null},Fv}var Nv,aR;function vj(){if(aR)return Nv;aR=1;const e=vn();return Nv=(r,n,i,o,s)=>{typeof i=="string"&&(s=o,o=i,i=void 0);try{return new e(r instanceof e?r.version:r,i).inc(n,o,s).version}catch{return null}},Nv}var jv,sR;function mj(){if(sR)return jv;sR=1;const e=ql();return jv=(r,n)=>{const i=e(r,null,!0),o=e(n,null,!0),s=i.compare(o);if(s===0)return null;const u=s>0,c=u?i:o,f=u?o:i,d=!!c.prerelease.length;if(!!f.prerelease.length&&!d){if(!f.patch&&!f.minor)return"major";if(f.compareMain(c)===0)return f.minor&&!f.patch?"minor":"patch"}const h=d?"pre":"";return i.major!==o.major?h+"major":i.minor!==o.minor?h+"minor":i.patch!==o.patch?h+"patch":"prerelease"},jv}var zv,lR;function yj(){if(lR)return zv;lR=1;const e=vn();return zv=(r,n)=>new e(r,n).major,zv}var Bv,uR;function bj(){if(uR)return Bv;uR=1;const e=vn();return Bv=(r,n)=>new e(r,n).minor,Bv}var Vv,cR;function Sj(){if(cR)return Vv;cR=1;const e=vn();return Vv=(r,n)=>new e(r,n).patch,Vv}var Uv,fR;function wj(){if(fR)return Uv;fR=1;const e=ql();return Uv=(r,n)=>{const i=e(r,n);return i&&i.prerelease.length?i.prerelease:null},Uv}var Hv,dR;function oo(){if(dR)return Hv;dR=1;const e=vn();return Hv=(r,n,i)=>new e(r,i).compare(new e(n,i)),Hv}var Wv,pR;function xj(){if(pR)return Wv;pR=1;const e=oo();return Wv=(r,n,i)=>e(n,r,i),Wv}var qv,hR;function Ej(){if(hR)return qv;hR=1;const e=oo();return qv=(r,n)=>e(r,n,!0),qv}var Gv,gR;function P1(){if(gR)return Gv;gR=1;const e=vn();return Gv=(r,n,i)=>{const o=new e(r,i),s=new e(n,i);return o.compare(s)||o.compareBuild(s)},Gv}var Xv,vR;function Cj(){if(vR)return Xv;vR=1;const e=P1();return Xv=(r,n)=>r.sort((i,o)=>e(i,o,n)),Xv}var Kv,mR;function Rj(){if(mR)return Kv;mR=1;const e=P1();return Kv=(r,n)=>r.sort((i,o)=>e(o,i,n)),Kv}var Yv,yR;function qp(){if(yR)return Yv;yR=1;const e=oo();return Yv=(r,n,i)=>e(r,n,i)>0,Yv}var Jv,bR;function k1(){if(bR)return Jv;bR=1;const e=oo();return Jv=(r,n,i)=>e(r,n,i)<0,Jv}var Qv,SR;function QI(){if(SR)return Qv;SR=1;const e=oo();return Qv=(r,n,i)=>e(r,n,i)===0,Qv}var Zv,wR;function ZI(){if(wR)return Zv;wR=1;const e=oo();return Zv=(r,n,i)=>e(r,n,i)!==0,Zv}var em,xR;function M1(){if(xR)return em;xR=1;const e=oo();return em=(r,n,i)=>e(r,n,i)>=0,em}var tm,ER;function D1(){if(ER)return tm;ER=1;const e=oo();return tm=(r,n,i)=>e(r,n,i)<=0,tm}var rm,CR;function e2(){if(CR)return rm;CR=1;const e=QI(),t=ZI(),r=qp(),n=M1(),i=k1(),o=D1();return rm=(u,c,f,d)=>{switch(c){case"===":return typeof u=="object"&&(u=u.version),typeof f=="object"&&(f=f.version),u===f;case"!==":return typeof u=="object"&&(u=u.version),typeof f=="object"&&(f=f.version),u!==f;case"":case"=":case"==":return e(u,f,d);case"!=":return t(u,f,d);case">":return r(u,f,d);case">=":return n(u,f,d);case"<":return i(u,f,d);case"<=":return o(u,f,d);default:throw new TypeError(`Invalid operator: ${c}`)}},rm}var nm,RR;function _j(){if(RR)return nm;RR=1;const e=vn(),t=ql(),{safeRe:r,t:n}=kc();return nm=(o,s)=>{if(o instanceof e)return o;if(typeof o=="number"&&(o=String(o)),typeof o!="string")return null;s=s||{};let u=null;if(!s.rtl)u=o.match(s.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const b=s.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let v;for(;(v=b.exec(o))&&(!u||u.index+u[0].length!==o.length);)(!u||v.index+v[0].length!==u.index+u[0].length)&&(u=v),b.lastIndex=v.index+v[1].length+v[2].length;b.lastIndex=-1}if(u===null)return null;const c=u[2],f=u[3]||"0",d=u[4]||"0",g=s.includePrerelease&&u[5]?`-${u[5]}`:"",h=s.includePrerelease&&u[6]?`+${u[6]}`:"";return t(`${c}.${f}.${d}${g}${h}`,s)},nm}var im,_R;function Oj(){if(_R)return im;_R=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const o=this.map.keys().next().value;this.delete(o)}this.map.set(r,n)}return this}}return im=e,im}var om,OR;function ao(){if(OR)return om;OR=1;const e=/\s+/g;class t{constructor(j,H){if(H=i(H),j instanceof t)return j.loose===!!H.loose&&j.includePrerelease===!!H.includePrerelease?j:new t(j.raw,H);if(j instanceof o)return this.raw=j.value,this.set=[[j]],this.formatted=void 0,this;if(this.options=H,this.loose=!!H.loose,this.includePrerelease=!!H.includePrerelease,this.raw=j.trim().replace(e," "),this.set=this.raw.split("||").map(X=>this.parseRange(X.trim())).filter(X=>X.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const X=this.set[0];if(this.set=this.set.filter(M=>!S(M[0])),this.set.length===0)this.set=[X];else if(this.set.length>1){for(const M of this.set)if(M.length===1&&y(M[0])){this.set=[M];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let j=0;j<this.set.length;j++){j>0&&(this.formatted+="||");const H=this.set[j];for(let X=0;X<H.length;X++)X>0&&(this.formatted+=" "),this.formatted+=H[X].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(j){const X=((this.options.includePrerelease&&b)|(this.options.loose&&v))+":"+j,M=n.get(X);if(M)return M;const Q=this.options.loose,W=Q?c[f.HYPHENRANGELOOSE]:c[f.HYPHENRANGE];j=j.replace(W,z(this.options.includePrerelease)),s("hyphen replace",j),j=j.replace(c[f.COMPARATORTRIM],d),s("comparator trim",j),j=j.replace(c[f.TILDETRIM],g),s("tilde trim",j),j=j.replace(c[f.CARETTRIM],h),s("caret trim",j);let D=j.split(" ").map(te=>x(te,this.options)).join(" ").split(/\s+/).map(te=>q(te,this.options));Q&&(D=D.filter(te=>(s("loose invalid filter",te,this.options),!!te.match(c[f.COMPARATORLOOSE])))),s("range list",D);const P=new Map,G=D.map(te=>new o(te,this.options));for(const te of G){if(S(te))return[te];P.set(te.value,te)}P.size>1&&P.has("")&&P.delete("");const Z=[...P.values()];return n.set(X,Z),Z}intersects(j,H){if(!(j instanceof t))throw new TypeError("a Range is required");return this.set.some(X=>E(X,H)&&j.set.some(M=>E(M,H)&&X.every(Q=>M.every(W=>Q.intersects(W,H)))))}test(j){if(!j)return!1;if(typeof j=="string")try{j=new u(j,this.options)}catch{return!1}for(let H=0;H<this.set.length;H++)if(B(this.set[H],j,this.options))return!0;return!1}}om=t;const r=Oj(),n=new r,i=I1(),o=Gp(),s=Wp(),u=vn(),{safeRe:c,t:f,comparatorTrimReplace:d,tildeTrimReplace:g,caretTrimReplace:h}=kc(),{FLAG_INCLUDE_PRERELEASE:b,FLAG_LOOSE:v}=Hp(),S=N=>N.value==="<0.0.0-0",y=N=>N.value==="",E=(N,j)=>{let H=!0;const X=N.slice();let M=X.pop();for(;H&&X.length;)H=X.every(Q=>M.intersects(Q,j)),M=X.pop();return H},x=(N,j)=>(s("comp",N,j),N=$(N,j),s("caret",N),N=A(N,j),s("tildes",N),N=I(N,j),s("xrange",N),N=F(N,j),s("stars",N),N),T=N=>!N||N.toLowerCase()==="x"||N==="*",A=(N,j)=>N.trim().split(/\s+/).map(H=>R(H,j)).join(" "),R=(N,j)=>{const H=j.loose?c[f.TILDELOOSE]:c[f.TILDE];return N.replace(H,(X,M,Q,W,D)=>{s("tilde",N,X,M,Q,W,D);let P;return T(M)?P="":T(Q)?P=`>=${M}.0.0 <${+M+1}.0.0-0`:T(W)?P=`>=${M}.${Q}.0 <${M}.${+Q+1}.0-0`:D?(s("replaceTilde pr",D),P=`>=${M}.${Q}.${W}-${D} <${M}.${+Q+1}.0-0`):P=`>=${M}.${Q}.${W} <${M}.${+Q+1}.0-0`,s("tilde return",P),P})},$=(N,j)=>N.trim().split(/\s+/).map(H=>O(H,j)).join(" "),O=(N,j)=>{s("caret",N,j);const H=j.loose?c[f.CARETLOOSE]:c[f.CARET],X=j.includePrerelease?"-0":"";return N.replace(H,(M,Q,W,D,P)=>{s("caret",N,M,Q,W,D,P);let G;return T(Q)?G="":T(W)?G=`>=${Q}.0.0${X} <${+Q+1}.0.0-0`:T(D)?Q==="0"?G=`>=${Q}.${W}.0${X} <${Q}.${+W+1}.0-0`:G=`>=${Q}.${W}.0${X} <${+Q+1}.0.0-0`:P?(s("replaceCaret pr",P),Q==="0"?W==="0"?G=`>=${Q}.${W}.${D}-${P} <${Q}.${W}.${+D+1}-0`:G=`>=${Q}.${W}.${D}-${P} <${Q}.${+W+1}.0-0`:G=`>=${Q}.${W}.${D}-${P} <${+Q+1}.0.0-0`):(s("no pr"),Q==="0"?W==="0"?G=`>=${Q}.${W}.${D}${X} <${Q}.${W}.${+D+1}-0`:G=`>=${Q}.${W}.${D}${X} <${Q}.${+W+1}.0-0`:G=`>=${Q}.${W}.${D} <${+Q+1}.0.0-0`),s("caret return",G),G})},I=(N,j)=>(s("replaceXRanges",N,j),N.split(/\s+/).map(H=>L(H,j)).join(" ")),L=(N,j)=>{N=N.trim();const H=j.loose?c[f.XRANGELOOSE]:c[f.XRANGE];return N.replace(H,(X,M,Q,W,D,P)=>{s("xRange",N,X,M,Q,W,D,P);const G=T(Q),Z=G||T(W),te=Z||T(D),K=te;return M==="="&&K&&(M=""),P=j.includePrerelease?"-0":"",G?M===">"||M==="<"?X="<0.0.0-0":X="*":M&&K?(Z&&(W=0),D=0,M===">"?(M=">=",Z?(Q=+Q+1,W=0,D=0):(W=+W+1,D=0)):M==="<="&&(M="<",Z?Q=+Q+1:W=+W+1),M==="<"&&(P="-0"),X=`${M+Q}.${W}.${D}${P}`):Z?X=`>=${Q}.0.0${P} <${+Q+1}.0.0-0`:te&&(X=`>=${Q}.${W}.0${P} <${Q}.${+W+1}.0-0`),s("xRange return",X),X})},F=(N,j)=>(s("replaceStars",N,j),N.trim().replace(c[f.STAR],"")),q=(N,j)=>(s("replaceGTE0",N,j),N.trim().replace(c[j.includePrerelease?f.GTE0PRE:f.GTE0],"")),z=N=>(j,H,X,M,Q,W,D,P,G,Z,te,K)=>(T(X)?H="":T(M)?H=`>=${X}.0.0${N?"-0":""}`:T(Q)?H=`>=${X}.${M}.0${N?"-0":""}`:W?H=`>=${H}`:H=`>=${H}${N?"-0":""}`,T(G)?P="":T(Z)?P=`<${+G+1}.0.0-0`:T(te)?P=`<${G}.${+Z+1}.0-0`:K?P=`<=${G}.${Z}.${te}-${K}`:N?P=`<${G}.${Z}.${+te+1}-0`:P=`<=${P}`,`${H} ${P}`.trim()),B=(N,j,H)=>{for(let X=0;X<N.length;X++)if(!N[X].test(j))return!1;if(j.prerelease.length&&!H.includePrerelease){for(let X=0;X<N.length;X++)if(s(N[X].semver),N[X].semver!==o.ANY&&N[X].semver.prerelease.length>0){const M=N[X].semver;if(M.major===j.major&&M.minor===j.minor&&M.patch===j.patch)return!0}return!1}return!0};return om}var am,TR;function Gp(){if(TR)return am;TR=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(d,g){if(g=r(g),d instanceof t){if(d.loose===!!g.loose)return d;d=d.value}d=d.trim().split(/\s+/).join(" "),s("comparator",d,g),this.options=g,this.loose=!!g.loose,this.parse(d),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(d){const g=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],h=d.match(g);if(!h)throw new TypeError(`Invalid comparator: ${d}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new u(h[2],this.options.loose):this.semver=e}toString(){return this.value}test(d){if(s("Comparator.test",d,this.options.loose),this.semver===e||d===e)return!0;if(typeof d=="string")try{d=new u(d,this.options)}catch{return!1}return o(d,this.operator,this.semver,this.options)}intersects(d,g){if(!(d instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(d.value,g).test(this.value):d.operator===""?d.value===""?!0:new c(this.value,g).test(d.semver):(g=r(g),g.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!g.includePrerelease&&(this.value.startsWith("<0.0.0")||d.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&d.operator.startsWith(">")||this.operator.startsWith("<")&&d.operator.startsWith("<")||this.semver.version===d.semver.version&&this.operator.includes("=")&&d.operator.includes("=")||o(this.semver,"<",d.semver,g)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||o(this.semver,">",d.semver,g)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}am=t;const r=I1(),{safeRe:n,t:i}=kc(),o=e2(),s=Wp(),u=vn(),c=ao();return am}var sm,AR;function Xp(){if(AR)return sm;AR=1;const e=ao();return sm=(r,n,i)=>{try{n=new e(n,i)}catch{return!1}return n.test(r)},sm}var lm,$R;function Tj(){if($R)return lm;$R=1;const e=ao();return lm=(r,n)=>new e(r,n).set.map(i=>i.map(o=>o.value).join(" ").trim().split(" ")),lm}var um,IR;function Aj(){if(IR)return um;IR=1;const e=vn(),t=ao();return um=(n,i,o)=>{let s=null,u=null,c=null;try{c=new t(i,o)}catch{return null}return n.forEach(f=>{c.test(f)&&(!s||u.compare(f)===-1)&&(s=f,u=new e(s,o))}),s},um}var cm,PR;function $j(){if(PR)return cm;PR=1;const e=vn(),t=ao();return cm=(n,i,o)=>{let s=null,u=null,c=null;try{c=new t(i,o)}catch{return null}return n.forEach(f=>{c.test(f)&&(!s||u.compare(f)===1)&&(s=f,u=new e(s,o))}),s},cm}var fm,kR;function Ij(){if(kR)return fm;kR=1;const e=vn(),t=ao(),r=qp();return fm=(i,o)=>{i=new t(i,o);let s=new e("0.0.0");if(i.test(s)||(s=new e("0.0.0-0"),i.test(s)))return s;s=null;for(let u=0;u<i.set.length;++u){const c=i.set[u];let f=null;c.forEach(d=>{const g=new e(d.semver.version);switch(d.operator){case">":g.prerelease.length===0?g.patch++:g.prerelease.push(0),g.raw=g.format();case"":case">=":(!f||r(g,f))&&(f=g);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${d.operator}`)}}),f&&(!s||r(s,f))&&(s=f)}return s&&i.test(s)?s:null},fm}var dm,MR;function Pj(){if(MR)return dm;MR=1;const e=ao();return dm=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},dm}var pm,DR;function L1(){if(DR)return pm;DR=1;const e=vn(),t=Gp(),{ANY:r}=t,n=ao(),i=Xp(),o=qp(),s=k1(),u=D1(),c=M1();return pm=(d,g,h,b)=>{d=new e(d,b),g=new n(g,b);let v,S,y,E,x;switch(h){case">":v=o,S=u,y=s,E=">",x=">=";break;case"<":v=s,S=c,y=o,E="<",x="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(d,g,b))return!1;for(let T=0;T<g.set.length;++T){const A=g.set[T];let R=null,$=null;if(A.forEach(O=>{O.semver===r&&(O=new t(">=0.0.0")),R=R||O,$=$||O,v(O.semver,R.semver,b)?R=O:y(O.semver,$.semver,b)&&($=O)}),R.operator===E||R.operator===x||(!$.operator||$.operator===E)&&S(d,$.semver))return!1;if($.operator===x&&y(d,$.semver))return!1}return!0},pm}var hm,LR;function kj(){if(LR)return hm;LR=1;const e=L1();return hm=(r,n,i)=>e(r,n,">",i),hm}var gm,FR;function Mj(){if(FR)return gm;FR=1;const e=L1();return gm=(r,n,i)=>e(r,n,"<",i),gm}var vm,NR;function Dj(){if(NR)return vm;NR=1;const e=ao();return vm=(r,n,i)=>(r=new e(r,i),n=new e(n,i),r.intersects(n,i)),vm}var mm,jR;function Lj(){if(jR)return mm;jR=1;const e=Xp(),t=oo();return mm=(r,n,i)=>{const o=[];let s=null,u=null;const c=r.sort((h,b)=>t(h,b,i));for(const h of c)e(h,n,i)?(u=h,s||(s=h)):(u&&o.push([s,u]),u=null,s=null);s&&o.push([s,null]);const f=[];for(const[h,b]of o)h===b?f.push(h):!b&&h===c[0]?f.push("*"):b?h===c[0]?f.push(`<=${b}`):f.push(`${h} - ${b}`):f.push(`>=${h}`);const d=f.join(" || "),g=typeof n.raw=="string"?n.raw:String(n);return d.length<g.length?d:n},mm}var ym,zR;function Fj(){if(zR)return ym;zR=1;const e=ao(),t=Gp(),{ANY:r}=t,n=Xp(),i=oo(),o=(g,h,b={})=>{if(g===h)return!0;g=new e(g,b),h=new e(h,b);let v=!1;e:for(const S of g.set){for(const y of h.set){const E=c(S,y,b);if(v=v||E!==null,E)continue e}if(v)return!1}return!0},s=[new t(">=0.0.0-0")],u=[new t(">=0.0.0")],c=(g,h,b)=>{if(g===h)return!0;if(g.length===1&&g[0].semver===r){if(h.length===1&&h[0].semver===r)return!0;b.includePrerelease?g=s:g=u}if(h.length===1&&h[0].semver===r){if(b.includePrerelease)return!0;h=u}const v=new Set;let S,y;for(const I of g)I.operator===">"||I.operator===">="?S=f(S,I,b):I.operator==="<"||I.operator==="<="?y=d(y,I,b):v.add(I.semver);if(v.size>1)return null;let E;if(S&&y){if(E=i(S.semver,y.semver,b),E>0)return null;if(E===0&&(S.operator!==">="||y.operator!=="<="))return null}for(const I of v){if(S&&!n(I,String(S),b)||y&&!n(I,String(y),b))return null;for(const L of h)if(!n(I,String(L),b))return!1;return!0}let x,T,A,R,$=y&&!b.includePrerelease&&y.semver.prerelease.length?y.semver:!1,O=S&&!b.includePrerelease&&S.semver.prerelease.length?S.semver:!1;$&&$.prerelease.length===1&&y.operator==="<"&&$.prerelease[0]===0&&($=!1);for(const I of h){if(R=R||I.operator===">"||I.operator===">=",A=A||I.operator==="<"||I.operator==="<=",S){if(O&&I.semver.prerelease&&I.semver.prerelease.length&&I.semver.major===O.major&&I.semver.minor===O.minor&&I.semver.patch===O.patch&&(O=!1),I.operator===">"||I.operator===">="){if(x=f(S,I,b),x===I&&x!==S)return!1}else if(S.operator===">="&&!n(S.semver,String(I),b))return!1}if(y){if($&&I.semver.prerelease&&I.semver.prerelease.length&&I.semver.major===$.major&&I.semver.minor===$.minor&&I.semver.patch===$.patch&&($=!1),I.operator==="<"||I.operator==="<="){if(T=d(y,I,b),T===I&&T!==y)return!1}else if(y.operator==="<="&&!n(y.semver,String(I),b))return!1}if(!I.operator&&(y||S)&&E!==0)return!1}return!(S&&A&&!y&&E!==0||y&&R&&!S&&E!==0||O||$)},f=(g,h,b)=>{if(!g)return h;const v=i(g.semver,h.semver,b);return v>0?g:v<0||h.operator===">"&&g.operator===">="?h:g},d=(g,h,b)=>{if(!g)return h;const v=i(g.semver,h.semver,b);return v<0?g:v>0||h.operator==="<"&&g.operator==="<="?h:g};return ym=o,ym}var bm,BR;function Nj(){if(BR)return bm;BR=1;const e=kc(),t=Hp(),r=vn(),n=JI(),i=ql(),o=hj(),s=gj(),u=vj(),c=mj(),f=yj(),d=bj(),g=Sj(),h=wj(),b=oo(),v=xj(),S=Ej(),y=P1(),E=Cj(),x=Rj(),T=qp(),A=k1(),R=QI(),$=ZI(),O=M1(),I=D1(),L=e2(),F=_j(),q=Gp(),z=ao(),B=Xp(),N=Tj(),j=Aj(),H=$j(),X=Ij(),M=Pj(),Q=L1(),W=kj(),D=Mj(),P=Dj(),G=Lj(),Z=Fj();return bm={parse:i,valid:o,clean:s,inc:u,diff:c,major:f,minor:d,patch:g,prerelease:h,compare:b,rcompare:v,compareLoose:S,compareBuild:y,sort:E,rsort:x,gt:T,lt:A,eq:R,neq:$,gte:O,lte:I,cmp:L,coerce:F,Comparator:q,Range:z,satisfies:B,toComparators:N,maxSatisfying:j,minSatisfying:H,minVersion:X,validRange:M,outside:Q,gtr:W,ltr:D,intersects:P,simplifyRange:G,subset:Z,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},bm}var Wn=Nj();const VR=Mr(Wn);var Zt=(e=>(e.NANO_S="nanoS",e.NANO_SP="nanoSP",e.NANO_X="nanoX",e.STAX="stax",e.FLEX="flex",e.APEX="apexp",e))(Zt||{});let t2=class{id;model;name;constructor({id:t,model:r,name:n}){this.id=t,this.model=r,this.name=n}},jj=class{constructor(t){if(this.seFlags=t,this.seFlags.length!==4)throw new Error("Invalid secure element flags length")}generalDeviceState(){const t=this.seFlags[0]??0;return{isPinValidated:this._checkNthBitInByte(t,1),hasMcuSerialNumber:this._checkNthBitInByte(t,2),hasValidCertificate:this._checkNthBitInByte(t,3),isCustomAuthorityConnectionAllowed:this._checkNthBitInByte(t,4),isSecureConnectionAllowed:this._checkNthBitInByte(t,5),isOnboarded:this._checkNthBitInByte(t,6),isMcuCodeSigned:this._checkNthBitInByte(t,7),isInRecoveryMode:this._checkNthBitInByte(t,8)}}endorsementInformation(){throw new Error("Not implemented")}wordsInformation(){throw new Error("Not implemented")}onboardingStatus(){throw new Error("Not implemented")}_checkNthBitInByte(t,r){return(t>>8-r&1)===1}},zj=class{name="getOsVersion";args=void 0;getApdu(){const t={cla:224,ins:1,p1:0,p2:0};return new KI(t).build()}parseResponse(t,r){if(!$1.isSuccessResponse(t))return us({error:YI.handle(t)});const n=new A1(t),i=n.extract32BitUInt();if(i===void 0)return us({error:new ij("Missing target ID in OS version")});let o=n.encodeToString(n.extractFieldLVEncoded()),s=n.extractFieldLVEncoded()??new Uint8Array(0);const u={...new jj(s).generalDeviceState()};o||(o="0.0.0",s=new Uint8Array);const c=(i&4026531840)!==805306368,f=o.includes("-osu");let d="",g="",h="",b="",v,S,y,E;if(c){h=o,v=i;const x=n.extractFieldLVEncoded();x&&(x.length>=5?(d=n.encodeToString(x),S=parseInt(n.encodeToHexaString(n.extractFieldLVEncoded()),16)):S=parseInt(n.encodeToHexaString(x),16))}else{if(d=o,S=i,g=n.encodeToString(n.extractFieldLVEncoded()),this.isBootloaderVersionSupported(d,r)&&(h=n.encodeToString(n.extractFieldLVEncoded())),this.isHardwareVersionSupported(d,r)?b=n.encodeToHexaString(n.extractFieldLVEncoded()):b="00",this.isLocalizationSupported(d,r)){const x=n.extractFieldLVEncoded();x!==void 0&&(y=parseInt(n.encodeToHexaString(x),16))}if(this.isRecoverSupported(d,r)){const x=n.extractFieldLVEncoded();x!==void 0&&(E=parseInt(n.encodeToHexaString(x),16))}}return us({data:{isBootloader:c,isOsu:f,targetId:i,seTargetId:S,mcuTargetId:v,seVersion:d,seFlags:s,mcuSephVersion:g,mcuBootloaderVersion:h,hwVersion:b,langId:y,recoverState:E,secureElementFlags:u}})}isBootloaderVersionSupported(t,r){const n=Wn.coerce(t)??"";switch(r){case Zt.NANO_S:case Zt.NANO_X:return Wn.gte(n,"2.0.0");default:return!0}}isHardwareVersionSupported(t,r){const n=Wn.coerce(t)??"";switch(r){case Zt.NANO_X:return Wn.gte(n,"2.0.0");default:return!1}}isLocalizationSupported(t,r){const n=Wn.coerce(t)??"";switch(r){case Zt.NANO_S:return!1;case Zt.NANO_SP:return Wn.gte(n,"1.1.0");case Zt.NANO_X:return Wn.gte(n,"2.1.0");default:return!0}}isRecoverSupported(t,r){const n=Wn.coerce(t)??"";switch(r){case Zt.NANO_S:return!1;case Zt.NANO_SP:return Wn.gte(n,"1.1.2");case Zt.NANO_X:return Wn.gte(n,"2.2.3");case Zt.STAX:return Wn.gte(n,"1.4.0");case Zt.FLEX:return Wn.gte(n,"1.0.1");default:return!0}}};var bo=(e=>(e.LOCKED="LOCKED",e.BUSY="BUSY",e.CONNECTED="CONNECTED",e.NOT_CONNECTED="NOT CONNECTED",e))(bo||{}),Bj=(e=>(e.NotStarted="not-started",e.Pending="pending",e.Stopped="stopped",e.Completed="completed",e.Error="error",e))(Bj||{}),Vj=(e=>(e.None="none",e.UnlockDevice="unlock-device",e.AllowSecureConnection="allow-secure-connection",e.ConfirmOpenApp="confirm-open-app",e.SignTransaction="sign-transaction",e.SignTypedData="sign-typed-data",e.AllowListApps="allow-list-apps",e.VerifyAddress="verify-address",e.SignPersonalMessage="sign-personal-message",e.SignDelegationAuthorization="sign-delegation-authorization",e.Web3ChecksOptIn="web3-checks-opt-in",e.VerifySafeAddress="verify-safe-address",e.RegisterWallet="register-wallet",e.ConfirmLoadImage="confirm-load-image",e.ConfirmCommitImage="confirm-commit-image",e.ConfirmRemoveImage="confirm-remove-image",e))(Vj||{});const Tn={of(e){return dn(e)},empty(){return Yt},zero(){return Yt},fromNullable(e){return e==null?Yt:dn(e)},fromFalsy(e){return e?dn(e):Yt},fromPredicate(e,t){switch(arguments.length){case 1:return r=>Tn.fromPredicate(e,r);default:return e(t)?dn(t):Yt}},mapMaybe(e,t){switch(arguments.length){case 1:return r=>Tn.mapMaybe(e,r);default:return Tn.catMaybes(t.map(e))}},catMaybes(e){let t=[];for(const r of e)r.isJust()&&t.push(r.extract());return t},encase(e){try{return dn(e())}catch{return Yt}},isMaybe(e){return e instanceof F1||e instanceof N1},sequence(e){let t=[];for(const r of e)if(r.isJust())t.push(r.extract());else return Yt;return dn(t)},"fantasy-land/of"(e){return this.of(e)},"fantasy-land/empty"(){return this.empty()},"fantasy-land/zero"(){return this.zero()}};class F1{constructor(t){this.__value=t,this["fantasy-land/equals"]=this.equals,this["fantasy-land/map"]=this.map,this["fantasy-land/ap"]=this.ap,this["fantasy-land/alt"]=this.alt,this["fantasy-land/chain"]=this.chain,this["fantasy-land/reduce"]=this.reduce,this["fantasy-land/extend"]=this.extend,this["fantasy-land/filter"]=this.filter}isJust(){return!0}isNothing(){return!1}inspect(){return`Just(${this.__value})`}toString(){return this.inspect()}toJSON(){const t=this.__value;return t instanceof Date?t.toJSON():t}equals(t){return this.extract()===t.extract()}map(t){return dn(t(this.__value))}ap(t){return t.isJust()?this.map(t.extract()):Yt}alt(t){return this}altLazy(t){return this}chain(t){return t(this.__value)}chainNullable(t){return Tn.fromNullable(t(this.__value))}join(){return this.__value}reduce(t,r){return t(r,this.__value)}extend(t){return dn(t(this))}unsafeCoerce(){return this.__value}caseOf(t){return"_"in t?t._():t.Just(this.__value)}orDefault(t){return this.__value}orDefaultLazy(t){return this.__value}toList(){return[this.__value]}mapOrDefault(t,r){return t(this.__value)}extract(){return this.__value}extractNullable(){return this.__value}toEither(t){return rn(this.__value)}ifJust(t){return t(this.__value),this}ifNothing(t){return this}filter(t){return t(this.__value)?dn(this.__value):Yt}}F1.prototype.constructor=Tn;class N1{constructor(){this["fantasy-land/equals"]=this.equals,this["fantasy-land/map"]=this.map,this["fantasy-land/ap"]=this.ap,this["fantasy-land/alt"]=this.alt,this["fantasy-land/chain"]=this.chain,this["fantasy-land/reduce"]=this.reduce,this["fantasy-land/extend"]=this.extend,this["fantasy-land/filter"]=this.filter}isJust(){return!1}isNothing(){return!0}inspect(){return"Nothing"}toString(){return this.inspect()}toJSON(){return this.__value}equals(t){return this.extract()===t.extract()}map(t){return Yt}ap(t){return Yt}alt(t){return t}altLazy(t){return t()}chain(t){return Yt}chainNullable(t){return Yt}join(){return Yt}reduce(t,r){return r}extend(t){return Yt}unsafeCoerce(){throw new Error("Maybe#unsafeCoerce was ran on a Nothing")}caseOf(t){return"_"in t?t._():t.Nothing()}orDefault(t){return t}orDefaultLazy(t){return t()}toList(){return[]}mapOrDefault(t,r){return r}extract(){}extractNullable(){return null}toEither(t){return tn(t)}ifJust(t){return this}ifNothing(t){return t(),this}filter(t){return Yt}}N1.prototype.constructor=Tn;const dn=e=>new F1(e),Yt=new N1,Jn={of(e){return rn(e)},lefts(e){let t=[];for(const r of e)r.isLeft()&&t.push(r.extract());return t},rights(e){let t=[];for(const r of e)r.isRight()&&t.push(r.extract());return t},encase(e){try{return rn(e())}catch(t){return tn(t)}},sequence(e){let t=[];for(const r of e){if(r.isLeft())return r;t.push(r.extract())}return rn(t)},isEither(e){return e instanceof z1||e instanceof j1},"fantasy-land/of"(e){return Jn.of(e)}};class j1{constructor(t){this.__value=t,this._="R",this["fantasy-land/bimap"]=this.bimap,this["fantasy-land/map"]=this.map,this["fantasy-land/ap"]=this.ap,this["fantasy-land/equals"]=this.equals,this["fantasy-land/chain"]=this.chain,this["fantasy-land/alt"]=this.alt,this["fantasy-land/reduce"]=this.reduce,this["fantasy-land/extend"]=this.extend}isLeft(){return!1}isRight(){return!0}toJSON(){return this.__value}inspect(){return`Right(${this.__value})`}toString(){return this.inspect()}bimap(t,r){return rn(r(this.__value))}map(t){return rn(t(this.__value))}mapLeft(t){return this}ap(t){return t.isRight()?this.map(t.extract()):t}equals(t){return t.isRight()?this.__value===t.extract():!1}chain(t){return t(this.__value)}chainLeft(t){return this}join(){return this.__value}alt(t){return this}altLazy(t){return this}reduce(t,r){return t(r,this.__value)}extend(t){return rn(t(this))}unsafeCoerce(){return this.__value}caseOf(t){return"_"in t?t._():t.Right(this.__value)}leftOrDefault(t){return t}orDefault(t){return this.__value}orDefaultLazy(t){return this.__value}leftOrDefaultLazy(t){return t()}ifLeft(t){return this}ifRight(t){return t(this.__value),this}toMaybe(){return dn(this.__value)}leftToMaybe(){return Yt}extract(){return this.__value}swap(){return tn(this.__value)}}j1.prototype.constructor=Jn;class z1{constructor(t){this.__value=t,this._="L",this["fantasy-land/bimap"]=this.bimap,this["fantasy-land/map"]=this.map,this["fantasy-land/ap"]=this.ap,this["fantasy-land/equals"]=this.equals,this["fantasy-land/chain"]=this.chain,this["fantasy-land/alt"]=this.alt,this["fantasy-land/reduce"]=this.reduce,this["fantasy-land/extend"]=this.extend}isLeft(){return!0}isRight(){return!1}toJSON(){return this.__value}inspect(){return`Left(${JSON.stringify(this.__value)})`}toString(){return this.inspect()}bimap(t,r){return tn(t(this.__value))}map(t){return this}mapLeft(t){return tn(t(this.__value))}ap(t){return t.isLeft()?t:this}equals(t){return t.isLeft()?t.extract()===this.__value:!1}chain(t){return this}chainLeft(t){return t(this.__value)}join(){return this}alt(t){return t}altLazy(t){return t()}reduce(t,r){return r}extend(t){return this}unsafeCoerce(){throw this.__value instanceof Error?this.__value:new Error("Either#unsafeCoerce was ran on a Left")}caseOf(t){return"_"in t?t._():t.Left(this.__value)}leftOrDefault(t){return this.__value}orDefault(t){return t}orDefaultLazy(t){return t()}leftOrDefaultLazy(t){return this.__value}ifLeft(t){return t(this.__value),this}ifRight(t){return this}toMaybe(){return Yt}leftToMaybe(){return dn(this.__value)}extract(){return this.__value}swap(){return rn(this.__value)}}z1.prototype.constructor=Jn;const tn=e=>new z1(e),rn=e=>new j1(e);var r2;const n2={liftEither(e){if(e.isRight())return Promise.resolve(e.extract());throw e.extract()},fromPromise(e){return e.then(n2.liftEither)},throwE(e){throw e}};class i2{constructor(t){this.runPromise=t,this[r2]="EitherAsync",this["fantasy-land/chain"]=this.chain,this["fantasy-land/alt"]=this.alt,this.then=(r,n)=>this.run().then(r,n)}leftOrDefault(t){return this.run().then(r=>r.leftOrDefault(t))}orDefault(t){return this.run().then(r=>r.orDefault(t))}join(){return mt(async t=>{const r=await this;if(r.isRight()){const n=await r.extract();return t.liftEither(n)}return t.liftEither(r)})}ap(t){return mt(async r=>{const n=await t;if(n.isRight()){const i=await this.run();return i.isRight()?n.extract()(i.extract()):r.liftEither(i)}return r.liftEither(n)})}alt(t){return mt(async r=>{const n=await this.run();if(n.isRight())return n.extract();{const i=await t;return r.liftEither(i)}})}extend(t){return mt(async r=>{const n=await this.run();if(n.isRight()){const i=mt.liftEither(n);return r.liftEither(rn(t(i)))}return r.liftEither(n)})}async run(){try{return rn(await this.runPromise(n2))}catch(t){return tn(t)}}bimap(t,r){return mt(async n=>{const i=await this.run();try{return await n.liftEither(i.bimap(t,r))}catch(o){throw await o}})}map(t){return mt(r=>this.runPromise(r).then(t))}mapLeft(t){return mt(async r=>{try{return await this.runPromise(r)}catch(n){throw await t(n)}})}chain(t){return mt(async r=>{const n=await this.runPromise(r);return r.fromPromise(t(n))})}chainLeft(t){return mt(async r=>{try{return await this.runPromise(r)}catch(n){return r.fromPromise(t(n))}})}toMaybeAsync(){return cn(async({liftMaybe:t})=>{const r=await this.run();return t(r.toMaybe())})}swap(){return mt(async t=>{const r=await this.run();return r.isRight()&&t.throwE(r.extract()),t.liftEither(rn(r.extract()))})}ifLeft(t){return mt(async r=>{const n=await this.run();return n.ifLeft(t),r.liftEither(n)})}ifRight(t){return mt(async r=>{const n=await this.run();return n.ifRight(t),r.liftEither(n)})}void(){return this.map(t=>{})}caseOf(t){return this.run().then(r=>r.caseOf(t))}finally(t){return mt(({fromPromise:r})=>r(this.run().finally(t)))}}r2=Symbol.toStringTag;const mt=Object.assign(e=>new i2(e),{fromPromise:e=>mt(({fromPromise:t})=>t(e())),liftEither:e=>mt(({liftEither:t})=>t(e)),lefts:e=>Promise.all(e.map(t=>t.run())).then(Jn.lefts),rights:e=>Promise.all(e.map(t=>t.run())).then(Jn.rights),sequence:e=>mt(async t=>{let r=[];for await(const n of e){if(n.isLeft())return t.liftEither(n);r.push(n.extract())}return t.liftEither(rn(r))}),all:e=>mt.fromPromise(async()=>Promise.all(e).then(Jn.sequence))});i2.prototype.constructor=mt;var o2;const a2={liftMaybe(e){if(e.isJust())return Promise.resolve(e.extract());throw Yt},fromPromise(e){return e.then(a2.liftMaybe)}};class s2{constructor(t){this.runPromise=t,this[o2]="MaybeAsync",this["fantasy-land/chain"]=this.chain,this["fantasy-land/filter"]=this.filter,this["fantasy-land/alt"]=this.alt}orDefault(t){return this.run().then(r=>r.orDefault(t))}join(){return cn(async t=>{const r=await this.run();if(r.isJust()){const n=await r.extract();return t.liftMaybe(n)}return t.liftMaybe(Yt)})}ap(t){return cn(async r=>{const n=await t;if(n.isJust()){const i=await this.run();return i.isJust()?n.extract()(i.extract()):r.liftMaybe(Yt)}return r.liftMaybe(Yt)})}alt(t){return cn(async r=>{const n=await this.run();if(n.isJust())return n.extract();{const i=await t;return r.liftMaybe(i)}})}extend(t){return cn(async r=>{const n=await this.run();if(n.isJust()){const i=cn.liftMaybe(n);return r.liftMaybe(dn(t(i)))}return r.liftMaybe(Yt)})}filter(t){return cn(async r=>{const n=await this.run();return r.liftMaybe(n.filter(t))})}async run(){try{return dn(await this.runPromise(a2))}catch{return Yt}}map(t){return cn(r=>this.runPromise(r).then(t))}chain(t){return cn(async r=>{const n=await this.runPromise(r);return r.fromPromise(t(n))})}toEitherAsync(t){return mt(async({liftEither:r})=>{const n=await this.run();return r(n.toEither(t))})}ifJust(t){return cn(async r=>{const n=await this.run();return n.ifJust(t),r.liftMaybe(n)})}ifNothing(t){return cn(async r=>{const n=await this.run();return n.ifNothing(t),r.liftMaybe(n)})}void(){return this.map(t=>{})}caseOf(t){return this.run().then(r=>r.caseOf(t))}finally(t){return cn(({fromPromise:r})=>r(this.run().finally(t)))}then(t,r){return this.run().then(t,r)}}o2=Symbol.toStringTag;const cn=Object.assign(e=>new s2(e),{catMaybes:e=>Promise.all(e).then(Tn.catMaybes),fromPromise:e=>cn(({fromPromise:t})=>t(e())),liftMaybe:e=>cn(({liftMaybe:t})=>t(e))});s2.prototype.constructor=cn;var Ky=function(e,t){return Ky=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Ky(e,t)};function To(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ky(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Uj(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(d){try{f(n.next(d))}catch(g){s(g)}}function c(d){try{f(n.throw(d))}catch(g){s(g)}}function f(d){d.done?o(d.value):i(d.value).then(u,c)}f((n=n.apply(e,t||[])).next())})}function l2(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(f){return function(d){return c([f,d])}}function c(f){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(r=0)),r;)try{if(n=1,i&&(o=f[0]&2?i.return:f[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,f[1])).done)return o;switch(i=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(d){f=[6,d],i=0}finally{n=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Al(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function $l(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}function Il(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function Cl(e){return this instanceof Cl?(this.v=e,this):new Cl(e)}function Hj(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(b){return function(v){return Promise.resolve(v).then(b,g)}}function u(b,v){n[b]&&(i[b]=function(S){return new Promise(function(y,E){o.push([b,S,y,E])>1||c(b,S)})},v&&(i[b]=v(i[b])))}function c(b,v){try{f(n[b](v))}catch(S){h(o[0][3],S)}}function f(b){b.value instanceof Cl?Promise.resolve(b.value.v).then(d,g):h(o[0][2],b)}function d(b){c("next",b)}function g(b){c("throw",b)}function h(b,v){b(v),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Wj(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Al=="function"?Al(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(u,c){s=e[o](s),i(u,c,s.done,s.value)})}}function i(o,s,u,c){Promise.resolve(c).then(function(f){o({value:f,done:u})},s)}}function pr(e){return typeof e=="function"}function Kp(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Sm=Kp(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
513
|
+
***************************************************************************** */var qC;(function(e){(function(t){var r=typeof globalThis=="object"?globalThis:typeof self=="object"||typeof self=="object"?self:typeof this=="object"?this:u(),n=i(e);typeof r.Reflect<"u"&&(n=i(r.Reflect,n)),t(n,r),typeof r.Reflect>"u"&&(r.Reflect=e);function i(c,f){return function(d,g){Object.defineProperty(c,d,{configurable:!0,writable:!0,value:g}),f&&f(d,g)}}function o(){try{return Function("return this;")()}catch{}}function s(){try{return(0,eval)("(function() { return this; })()")}catch{}}function u(){return o()||s()}})(function(t,r){var n=Object.prototype.hasOwnProperty,i=typeof Symbol=="function",o=i&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",s=i&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",u=typeof Object.create=="function",c={__proto__:[]}instanceof Array,f=!u&&!c,d={create:u?function(){return It(Object.create(null))}:c?function(){return It({__proto__:null})}:function(){return It({})},has:f?function(ne,se){return n.call(ne,se)}:function(ne,se){return se in ne},get:f?function(ne,se){return n.call(ne,se)?ne[se]:void 0}:function(ne,se){return ne[se]}},g=Object.getPrototypeOf(Function),h=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:Pt(),b=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:ht(),v=typeof WeakMap=="function"?WeakMap:Ft(),S=i?Symbol.for("@reflect-metadata:registry"):void 0,y=Ue(),E=Re(y);function x(ne,se,pe,Y){if(P(pe)){if(!Ee(ne))throw new TypeError;if(!Te(se))throw new TypeError;return z(ne,se)}else{if(!Ee(ne))throw new TypeError;if(!te(se))throw new TypeError;if(!te(Y)&&!P(Y)&&!G(Y))throw new TypeError;return G(Y)&&(Y=void 0),pe=he(pe),B(ne,se,pe,Y)}}t("decorate",x);function T(ne,se){function pe(Y,V){if(!te(Y))throw new TypeError;if(!P(V)&&!Ce(V))throw new TypeError;M(ne,se,Y,V)}return pe}t("metadata",T);function A(ne,se,pe,Y){if(!te(pe))throw new TypeError;return P(Y)||(Y=he(Y)),M(ne,se,pe,Y)}t("defineMetadata",A);function R(ne,se,pe){if(!te(se))throw new TypeError;return P(pe)||(pe=he(pe)),N(ne,se,pe)}t("hasMetadata",R);function $(ne,se,pe){if(!te(se))throw new TypeError;return P(pe)||(pe=he(pe)),j(ne,se,pe)}t("hasOwnMetadata",$);function O(ne,se,pe){if(!te(se))throw new TypeError;return P(pe)||(pe=he(pe)),H(ne,se,pe)}t("getMetadata",O);function I(ne,se,pe){if(!te(se))throw new TypeError;return P(pe)||(pe=he(pe)),X(ne,se,pe)}t("getOwnMetadata",I);function L(ne,se){if(!te(ne))throw new TypeError;return P(se)||(se=he(se)),Q(ne,se)}t("getMetadataKeys",L);function F(ne,se){if(!te(ne))throw new TypeError;return P(se)||(se=he(se)),W(ne,se)}t("getOwnMetadataKeys",F);function q(ne,se,pe){if(!te(se))throw new TypeError;if(P(pe)||(pe=he(pe)),!te(se))throw new TypeError;P(pe)||(pe=he(pe));var Y=ct(se,pe,!1);return P(Y)?!1:Y.OrdinaryDeleteMetadata(ne,se,pe)}t("deleteMetadata",q);function z(ne,se){for(var pe=ne.length-1;pe>=0;--pe){var Y=ne[pe],V=Y(se);if(!P(V)&&!G(V)){if(!Te(V))throw new TypeError;se=V}}return se}function B(ne,se,pe,Y){for(var V=ne.length-1;V>=0;--V){var ee=ne[V],Oe=ee(se,pe,Y);if(!P(Oe)&&!G(Oe)){if(!te(Oe))throw new TypeError;Y=Oe}}return Y}function N(ne,se,pe){var Y=j(ne,se,pe);if(Y)return!0;var V=ze(se);return G(V)?!1:N(ne,V,pe)}function j(ne,se,pe){var Y=ct(se,pe,!1);return P(Y)?!1:ae(Y.OrdinaryHasOwnMetadata(ne,se,pe))}function H(ne,se,pe){var Y=j(ne,se,pe);if(Y)return X(ne,se,pe);var V=ze(se);if(!G(V))return H(ne,V,pe)}function X(ne,se,pe){var Y=ct(se,pe,!1);if(!P(Y))return Y.OrdinaryGetOwnMetadata(ne,se,pe)}function M(ne,se,pe,Y){var V=ct(pe,Y,!0);V.OrdinaryDefineOwnMetadata(ne,se,pe,Y)}function Q(ne,se){var pe=W(ne,se),Y=ze(ne);if(Y===null)return pe;var V=Q(Y,se);if(V.length<=0)return pe;if(pe.length<=0)return V;for(var ee=new b,Oe=[],le=0,fe=pe;le<fe.length;le++){var ve=fe[le],Ie=ee.has(ve);Ie||(ee.add(ve),Oe.push(ve))}for(var De=0,Be=V;De<Be.length;De++){var ve=Be[De],Ie=ee.has(ve);Ie||(ee.add(ve),Oe.push(ve))}return Oe}function W(ne,se){var pe=ct(ne,se,!1);return pe?pe.OrdinaryOwnMetadataKeys(ne,se):[]}function D(ne){if(ne===null)return 1;switch(typeof ne){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return ne===null?1:6;default:return 6}}function P(ne){return ne===void 0}function G(ne){return ne===null}function Z(ne){return typeof ne=="symbol"}function te(ne){return typeof ne=="object"?ne!==null:typeof ne=="function"}function K(ne,se){switch(D(ne)){case 0:return ne;case 1:return ne;case 2:return ne;case 3:return ne;case 4:return ne;case 5:return ne}var pe="string",Y=$e(ne,o);if(Y!==void 0){var V=Y.call(ne,pe);if(te(V))throw new TypeError;return V}return be(ne)}function be(ne,se){var pe,Y,V;{var ee=ne.toString;if(we(ee)){var Y=ee.call(ne);if(!te(Y))return Y}var pe=ne.valueOf;if(we(pe)){var Y=pe.call(ne);if(!te(Y))return Y}}throw new TypeError}function ae(ne){return!!ne}function Se(ne){return""+ne}function he(ne){var se=K(ne);return Z(se)?se:Se(se)}function Ee(ne){return Array.isArray?Array.isArray(ne):ne instanceof Object?ne instanceof Array:Object.prototype.toString.call(ne)==="[object Array]"}function we(ne){return typeof ne=="function"}function Te(ne){return typeof ne=="function"}function Ce(ne){switch(D(ne)){case 3:return!0;case 4:return!0;default:return!1}}function _e(ne,se){return ne===se||ne!==ne&&se!==se}function $e(ne,se){var pe=ne[se];if(pe!=null){if(!we(pe))throw new TypeError;return pe}}function ke(ne){var se=$e(ne,s);if(!we(se))throw new TypeError;var pe=se.call(ne);if(!te(pe))throw new TypeError;return pe}function Ge(ne){return ne.value}function Qe(ne){var se=ne.next();return se.done?!1:se}function je(ne){var se=ne.return;se&&se.call(ne)}function ze(ne){var se=Object.getPrototypeOf(ne);if(typeof ne!="function"||ne===g||se!==g)return se;var pe=ne.prototype,Y=pe&&Object.getPrototypeOf(pe);if(Y==null||Y===Object.prototype)return se;var V=Y.constructor;return typeof V!="function"||V===ne?se:V}function Ye(){var ne;!P(S)&&typeof r.Reflect<"u"&&!(S in r.Reflect)&&typeof r.Reflect.defineMetadata=="function"&&(ne=Xe(r.Reflect));var se,pe,Y,V=new v,ee={registerProvider:Oe,getProvider:fe,setProvider:Ie};return ee;function Oe(De){if(!Object.isExtensible(ee))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case ne===De:break;case P(se):se=De;break;case se===De:break;case P(pe):pe=De;break;case pe===De:break;default:Y===void 0&&(Y=new b),Y.add(De);break}}function le(De,Be){if(!P(se)){if(se.isProviderFor(De,Be))return se;if(!P(pe)){if(pe.isProviderFor(De,Be))return se;if(!P(Y))for(var Ze=ke(Y);;){var et=Qe(Ze);if(!et)return;var tt=Ge(et);if(tt.isProviderFor(De,Be))return je(Ze),tt}}}if(!P(ne)&&ne.isProviderFor(De,Be))return ne}function fe(De,Be){var Ze=V.get(De),et;return P(Ze)||(et=Ze.get(Be)),P(et)&&(et=le(De,Be),P(et)||(P(Ze)&&(Ze=new h,V.set(De,Ze)),Ze.set(Be,et))),et}function ve(De){if(P(De))throw new TypeError;return se===De||pe===De||!P(Y)&&Y.has(De)}function Ie(De,Be,Ze){if(!ve(Ze))throw new Error("Metadata provider not registered.");var et=fe(De,Be);if(et!==Ze){if(!P(et))return!1;var tt=V.get(De);P(tt)&&(tt=new h,V.set(De,tt)),tt.set(Be,Ze)}return!0}}function Ue(){var ne;return!P(S)&&te(r.Reflect)&&Object.isExtensible(r.Reflect)&&(ne=r.Reflect[S]),P(ne)&&(ne=Ye()),!P(S)&&te(r.Reflect)&&Object.isExtensible(r.Reflect)&&Object.defineProperty(r.Reflect,S,{enumerable:!1,configurable:!1,writable:!1,value:ne}),ne}function Re(ne){var se=new v,pe={isProviderFor:function(ve,Ie){var De=se.get(ve);return P(De)?!1:De.has(Ie)},OrdinaryDefineOwnMetadata:Oe,OrdinaryHasOwnMetadata:V,OrdinaryGetOwnMetadata:ee,OrdinaryOwnMetadataKeys:le,OrdinaryDeleteMetadata:fe};return y.registerProvider(pe),pe;function Y(ve,Ie,De){var Be=se.get(ve),Ze=!1;if(P(Be)){if(!De)return;Be=new h,se.set(ve,Be),Ze=!0}var et=Be.get(Ie);if(P(et)){if(!De)return;if(et=new h,Be.set(Ie,et),!ne.setProvider(ve,Ie,pe))throw Be.delete(Ie),Ze&&se.delete(ve),new Error("Wrong provider for target.")}return et}function V(ve,Ie,De){var Be=Y(Ie,De,!1);return P(Be)?!1:ae(Be.has(ve))}function ee(ve,Ie,De){var Be=Y(Ie,De,!1);if(!P(Be))return Be.get(ve)}function Oe(ve,Ie,De,Be){var Ze=Y(De,Be,!0);Ze.set(ve,Ie)}function le(ve,Ie){var De=[],Be=Y(ve,Ie,!1);if(P(Be))return De;for(var Ze=Be.keys(),et=ke(Ze),tt=0;;){var Bt=Qe(et);if(!Bt)return De.length=tt,De;var dt=Ge(Bt);try{De[tt]=dt}catch(gt){try{je(et)}finally{throw gt}}tt++}}function fe(ve,Ie,De){var Be=Y(Ie,De,!1);if(P(Be)||!Be.delete(ve))return!1;if(Be.size===0){var Ze=se.get(Ie);P(Ze)||(Ze.delete(De),Ze.size===0&&se.delete(Ze))}return!0}}function Xe(ne){var se=ne.defineMetadata,pe=ne.hasOwnMetadata,Y=ne.getOwnMetadata,V=ne.getOwnMetadataKeys,ee=ne.deleteMetadata,Oe=new v,le={isProviderFor:function(fe,ve){var Ie=Oe.get(fe);return!P(Ie)&&Ie.has(ve)?!0:V(fe,ve).length?(P(Ie)&&(Ie=new b,Oe.set(fe,Ie)),Ie.add(ve),!0):!1},OrdinaryDefineOwnMetadata:se,OrdinaryHasOwnMetadata:pe,OrdinaryGetOwnMetadata:Y,OrdinaryOwnMetadataKeys:V,OrdinaryDeleteMetadata:ee};return le}function ct(ne,se,pe){var Y=y.getProvider(ne,se);if(!P(Y))return Y;if(pe){if(y.setProvider(ne,se,E))return E;throw new Error("Illegal state.")}}function Pt(){var ne={},se=[],pe=(function(){function le(fe,ve,Ie){this._index=0,this._keys=fe,this._values=ve,this._selector=Ie}return le.prototype["@@iterator"]=function(){return this},le.prototype[s]=function(){return this},le.prototype.next=function(){var fe=this._index;if(fe>=0&&fe<this._keys.length){var ve=this._selector(this._keys[fe],this._values[fe]);return fe+1>=this._keys.length?(this._index=-1,this._keys=se,this._values=se):this._index++,{value:ve,done:!1}}return{value:void 0,done:!0}},le.prototype.throw=function(fe){throw this._index>=0&&(this._index=-1,this._keys=se,this._values=se),fe},le.prototype.return=function(fe){return this._index>=0&&(this._index=-1,this._keys=se,this._values=se),{value:fe,done:!0}},le})(),Y=(function(){function le(){this._keys=[],this._values=[],this._cacheKey=ne,this._cacheIndex=-2}return Object.defineProperty(le.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),le.prototype.has=function(fe){return this._find(fe,!1)>=0},le.prototype.get=function(fe){var ve=this._find(fe,!1);return ve>=0?this._values[ve]:void 0},le.prototype.set=function(fe,ve){var Ie=this._find(fe,!0);return this._values[Ie]=ve,this},le.prototype.delete=function(fe){var ve=this._find(fe,!1);if(ve>=0){for(var Ie=this._keys.length,De=ve+1;De<Ie;De++)this._keys[De-1]=this._keys[De],this._values[De-1]=this._values[De];return this._keys.length--,this._values.length--,_e(fe,this._cacheKey)&&(this._cacheKey=ne,this._cacheIndex=-2),!0}return!1},le.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=ne,this._cacheIndex=-2},le.prototype.keys=function(){return new pe(this._keys,this._values,V)},le.prototype.values=function(){return new pe(this._keys,this._values,ee)},le.prototype.entries=function(){return new pe(this._keys,this._values,Oe)},le.prototype["@@iterator"]=function(){return this.entries()},le.prototype[s]=function(){return this.entries()},le.prototype._find=function(fe,ve){if(!_e(this._cacheKey,fe)){this._cacheIndex=-1;for(var Ie=0;Ie<this._keys.length;Ie++)if(_e(this._keys[Ie],fe)){this._cacheIndex=Ie;break}}return this._cacheIndex<0&&ve&&(this._cacheIndex=this._keys.length,this._keys.push(fe),this._values.push(void 0)),this._cacheIndex},le})();return Y;function V(le,fe){return le}function ee(le,fe){return fe}function Oe(le,fe){return[le,fe]}}function ht(){var ne=(function(){function se(){this._map=new h}return Object.defineProperty(se.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),se.prototype.has=function(pe){return this._map.has(pe)},se.prototype.add=function(pe){return this._map.set(pe,pe),this},se.prototype.delete=function(pe){return this._map.delete(pe)},se.prototype.clear=function(){this._map.clear()},se.prototype.keys=function(){return this._map.keys()},se.prototype.values=function(){return this._map.keys()},se.prototype.entries=function(){return this._map.entries()},se.prototype["@@iterator"]=function(){return this.keys()},se.prototype[s]=function(){return this.keys()},se})();return ne}function Ft(){var ne=16,se=d.create(),pe=Y();return(function(){function fe(){this._key=Y()}return fe.prototype.has=function(ve){var Ie=V(ve,!1);return Ie!==void 0?d.has(Ie,this._key):!1},fe.prototype.get=function(ve){var Ie=V(ve,!1);return Ie!==void 0?d.get(Ie,this._key):void 0},fe.prototype.set=function(ve,Ie){var De=V(ve,!0);return De[this._key]=Ie,this},fe.prototype.delete=function(ve){var Ie=V(ve,!1);return Ie!==void 0?delete Ie[this._key]:!1},fe.prototype.clear=function(){this._key=Y()},fe})();function Y(){var fe;do fe="@@WeakMap@@"+le();while(d.has(se,fe));return se[fe]=!0,fe}function V(fe,ve){if(!n.call(fe,pe)){if(!ve)return;Object.defineProperty(fe,pe,{value:d.create()})}return fe[pe]}function ee(fe,ve){for(var Ie=0;Ie<ve;++Ie)fe[Ie]=Math.random()*255|0;return fe}function Oe(fe){if(typeof Uint8Array=="function"){var ve=new Uint8Array(fe);return typeof crypto<"u"?crypto.getRandomValues(ve):typeof msCrypto<"u"?msCrypto.getRandomValues(ve):ee(ve,fe),ve}return ee(new Array(fe),fe)}function le(){var fe=Oe(ne);fe[6]=fe[6]&79|64,fe[8]=fe[8]&191|128;for(var ve="",Ie=0;Ie<ne;++Ie){var De=fe[Ie];(Ie===4||Ie===6||Ie===8)&&(ve+="-"),De<16&&(ve+="0"),ve+=De.toString(16).toLowerCase()}return ve}}function It(ne){return ne.__=void 0,delete ne.__,ne}})})(qC||(qC={}));let ej=class{cla;ins;p1;p2;data;constructor(t,r,n,i,o){this.cla=t,this.ins=r,this.p1=n,this.p2=i,this.data=o??new Uint8Array}getRawApdu(){const t=Uint8Array.from([this.cla,this.ins,this.p1,this.p2,this.data.length]),r=new Uint8Array(t.length+this.data.length);return r.set(t,0),this.data.length>0&&r.set(this.data,t.length),r}};function GC(e){if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)return new Uint8Array;if(e.length%2!==0&&(e="0"+e),/^[0-9a-fA-F]*$/.test(e)===!1)return null;const t=e.match(/.{1,2}/g)?.map(r=>parseInt(r,16));return!t||t.some(isNaN)?null:new Uint8Array(t)}function dc(e,t=!0){return`${t?"0x":""}${Array.from(e,r=>r.toString(16).padStart(2,"0")).join("")}`}let Av=class{_tag="ValueOverflow";originalError;message;constructor(t,r=XI){this.message=`Value overflow for ${t}, max is ${r}`}},gd=class{_tag="DataOverflow";message;originalError;constructor(t,r=0){this.message=r===0?`this.data is already full (value: ${t})`:`this.data will overflow with "${t}", remaining bytes: ${r}`}},XC=class{_tag="HexaString";message;originalError;constructor(t){this.message=`Invalid encoded hexa string or length is null: ${t}`}};const tj=4294967295;let rj=class{constructor(t=tj){this.maxPayloadSize=t}data=new Uint8Array;errors=[];build=()=>this.data;tryBuild=()=>this.hasErrors()?void 0:this.data;add8BitUIntToData=t=>this.addNumberToData(t,8n,!1,!1);add16BitUIntToData=(t,r=!0)=>this.addNumberToData(t,16n,!1,r);add32BitUIntToData=(t,r=!0)=>this.addNumberToData(t,32n,!1,r);add64BitUIntToData=(t,r=!0)=>this.addNumberToData(t,64n,!1,r);add128BitUIntToData=(t,r=!0)=>this.addNumberToData(t,128n,!1,r);add256BitUIntToData=(t,r=!0)=>this.addNumberToData(t,256n,!1,r);add16BitIntToData=(t,r=!0)=>this.addNumberToData(t,16n,!0,r);add32BitIntToData=(t,r=!0)=>this.addNumberToData(t,32n,!0,r);add64BitIntToData=(t,r=!0)=>this.addNumberToData(t,64n,!0,r);add128BitIntToData=(t,r=!0)=>this.addNumberToData(t,128n,!0,r);add256BitIntToData=(t,r=!0)=>this.addNumberToData(t,256n,!0,r);addBufferToData=t=>this.hasEnoughLengthRemaining(t)?(this.data=Uint8Array.from([...this.data,...t]),this):(this.errors.push(new gd(t.toString())),this);addHexaStringToData=t=>{const r=GC(t);return r===null||r.length===0?(this.errors.push(new XC(t)),this):(this.addBufferToData(r),this)};addAsciiStringToData=t=>{const r=new TextEncoder().encode(t);return this.addBufferToData(r),this};encodeInLVFromHexa=t=>{const r=GC(t);return r===null||r.length===0?(this.errors.push(new XC(t)),this):this.hasEnoughLengthRemaining(r,!0)?(this.add8BitUIntToData(r.length),this.addBufferToData(r),this):(this.errors.push(new gd(t)),this)};encodeInLVFromBuffer=t=>this.hasEnoughLengthRemaining(t,!0)?(this.add8BitUIntToData(t.length),this.addBufferToData(t),this):(this.errors.push(new gd(t.toString())),this);encodeInLVFromAscii=t=>this.hasEnoughLengthRemaining(t,!0)?(this.add8BitUIntToData(t.length),this.addAsciiStringToData(t),this):(this.errors.push(new gd(t)),this);encodeInTLVFromAscii=(t,r)=>(this.add8BitUIntToData(t),this.encodeInLVFromAscii(r));encodeInTLVFromHexa=(t,r)=>(this.add8BitUIntToData(t),this.encodeInLVFromHexa(r));encodeInTLVFromBuffer=(t,r)=>(this.add8BitUIntToData(t),this.encodeInLVFromBuffer(r));encodeInTLVFromUInt8=(t,r)=>(this.add8BitUIntToData(t),this.add8BitUIntToData(1),this.add8BitUIntToData(r));encodeInTLVFromUInt16=(t,r,n=!0)=>(this.add8BitUIntToData(t),this.add8BitUIntToData(2),this.add16BitUIntToData(r,n));encodeInTLVFromUInt32=(t,r,n=!0)=>(this.add8BitUIntToData(t),this.add8BitUIntToData(4),this.add32BitUIntToData(r,n));encodeInTLVFromUInt64=(t,r,n=!0)=>(this.add8BitUIntToData(t),this.add8BitUIntToData(8),this.add64BitUIntToData(r,n));getAvailablePayloadLength=()=>this.maxPayloadSize-this.data.length;getErrors=()=>this.errors;hasErrors=()=>this.errors.length!==0;hasEnoughLengthRemaining=(t,r=!1)=>this.data.length+t.length+(r?1:0)<=this.maxPayloadSize;addNumberToData(t,r,n,i){let o=this.checkBoundsAndConvert(t,r,n);if(o===void 0)return this;const s=Number(r)/8,u=new Uint8Array(s);if(i)for(let c=s-1;c>=0;c--)u[c]=Number(o&0xffn),o>>=8n;else for(let c=0;c<s;c++)u[c]=Number(o&0xffn),o>>=8n;return this.addBufferToData(u)}checkBoundsAndConvert(t,r,n){if(typeof t=="number"){if(!Number.isInteger(t)||t>Number.MAX_SAFE_INTEGER){this.errors.push(new Av(t.toString()));return}t=BigInt(t)}if(n){const i=1n<<r-1n;if(t>=i||t<-i){this.errors.push(new Av(t.toString(),i-1n));return}if(t<0n){const o=(1n<<r)-1n;t=-t,t=(~t&o)+1n}}else{const i=1n<<r;if(t<0||t>=i){this.errors.push(new Av(t.toString(),i-1n));return}}return t}};const XI=255;let KI=class{_ins;_cla;_p1;p2;data=new rj(XI);constructor({ins:t,cla:r,p1:n,p2:i}){this._cla=r&255,this._ins=t&255,this._p1=n&255,this.p2=i&255}build=()=>new ej(this._cla,this._ins,this._p1,this.p2,this.data.build());add8BitUIntToData=t=>(this.data.add8BitUIntToData(t),this);add16BitUIntToData=t=>(this.data.add16BitUIntToData(t),this);add32BitUIntToData=t=>(this.data.add32BitUIntToData(t),this);add64BitUIntToData=(t,r=!0)=>(this.data.add64BitUIntToData(t,r),this);addBufferToData=t=>(this.data.addBufferToData(t),this);addHexaStringToData=t=>(this.data.addHexaStringToData(t),this);addAsciiStringToData=t=>(this.data.addAsciiStringToData(t),this);encodeInLVFromHexa=t=>(this.data.encodeInLVFromHexa(t),this);encodeInLVFromBuffer=t=>(this.data.encodeInLVFromBuffer(t),this);encodeInLVFromAscii=t=>(this.data.encodeInLVFromAscii(t),this);getAvailablePayloadLength=()=>this.data.getAvailablePayloadLength();getErrors=()=>this.data.getErrors()},nj=class{constructor(t){this.buffer=t}index=0;testMinimalLength(t){return t<=this.buffer.length-this.index}extract8BitUInt(){if(!this.outOfRange(1))return this.buffer[this.index++]}extract16BitUInt(t=!0){const r=this.extractNumber(16n,!1,t);return r===void 0?void 0:Number(r)}extract16BitInt(t=!0){const r=this.extractNumber(16n,!0,t);return r===void 0?void 0:Number(r)}extract32BitUInt(t=!0){const r=this.extractNumber(32n,!1,t);return r===void 0?void 0:Number(r)}extract32BitInt(t=!0){const r=this.extractNumber(32n,!0,t);return r===void 0?void 0:Number(r)}extract64BitUInt(t=!0){return this.extractNumber(64n,!1,t)}extract64BitInt(t=!0){return this.extractNumber(64n,!0,t)}extract128BitUInt(t=!0){return this.extractNumber(128n,!1,t)}extract128BitInt(t=!0){return this.extractNumber(128n,!0,t)}extract256BitUInt(t=!0){return this.extractNumber(256n,!1,t)}extract256BitInt(t=!0){return this.extractNumber(256n,!0,t)}extractFieldByLength(t){if(this.outOfRange(t))return;if(t===0)return new Uint8Array;const r=this.buffer.slice(this.index,this.index+t);return this.index+=t,r}extractFieldLVEncoded(){const t=this.extract8BitUInt();if(t===void 0)return;if(t===0)return new Uint8Array;const r=this.extractFieldByLength(t);return r===void 0&&this.index--,r}extractFieldTLVEncoded(){if(this.outOfRange(2))return;const t=this.index,r=this.extract8BitUInt(),n=this.extractFieldLVEncoded();if(r===void 0||n===void 0){this.index--;return}const i=this.index;return{tag:r,value:n,tlv:this.buffer.slice(t,i)}}encodeToHexaString(t,r=!1){if(t===void 0||t.length===0)return"";const n=dc(t);return r?n:n.slice(2)}encodeToString(t){let r="",n=0;if(!t)return r;for(;n<=t.length;){const i=t[n];i&&(r+=String.fromCharCode(i)),n++}return r}getCurrentIndex(){return this.index}resetIndex(){this.index=0}getUnparsedRemainingLength(){return this.buffer.length-this.index}outOfRange(t){return this.index+t>this.buffer.length}extractNumber(t,r,n){const i=Number(t)/8;if(this.outOfRange(i))return;let o=0n;if(n)for(let s=0;s<i;s++)o=o<<8n|BigInt(this.buffer[s+this.index]);else for(let s=i-1;s>=0;s--)o=o<<8n|BigInt(this.buffer[s+this.index]);if(r){const s=1n<<t-1n;o&s&&(o-=s<<1n)}return this.index+=i,o}},A1=class{parser;constructor(t){this.parser=new nj(t.data)}testMinimalLength=t=>this.parser.testMinimalLength(t);extract8BitUInt=()=>this.parser.extract8BitUInt();extract16BitUInt=()=>this.parser.extract16BitUInt();extract32BitUInt=()=>this.parser.extract32BitUInt();extractFieldByLength=t=>this.parser.extractFieldByLength(t);extractFieldLVEncoded=()=>this.parser.extractFieldLVEncoded();extractFieldTLVEncoded=()=>this.parser.extractFieldTLVEncoded();encodeToHexaString(t,r=!1){return r?this.parser.encodeToHexaString(t,!0):this.parser.encodeToHexaString(t,!1)}encodeToString=t=>this.parser.encodeToString(t);getUnparsedRemainingLength=()=>this.parser.getUnparsedRemainingLength()},ij=class{_tag="InvalidStatusWordError";originalError;constructor(t){this.originalError=new Error(t??"Invalid status word.")}},oj=class{_tag="InvalidResponseFormatError";originalError;constructor(t){this.originalError=new Error(t??"Invalid response format.")}};var aj=(e=>(e.Error="ERROR",e.Success="SUCCESS",e))(aj||{});function us({data:e,error:t}){return t?{status:"ERROR",error:t}:{status:"SUCCESS",data:e}}function sj(e){return e.status==="SUCCESS"}const lj=(e,t)=>Object.keys(t).includes(e);let $1=class hl{static isValidStatusCode(t){return t.length===2}static isSuccessResponse({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===144&&t[1]===0:!1}static isLockedDeviceResponse({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===85&&t[1]===21||t[0]===105&&t[1]===130||t[0]===83&&t[1]===3:!1}static isRefusedByUser({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===85&&t[1]===1||t[0]===105&&t[1]===133:!1}static isAppAlreadyInstalled({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===106&&t[1]===128||t[0]===106&&t[1]===129||t[0]===106&&t[1]===142||t[0]===106&&t[1]===143:!1}static isOutOfMemory({statusCode:t}){return hl.isValidStatusCode(t)?t[0]===106&&t[1]===132||t[0]===106&&t[1]===133||t[0]===81&&t[1]===2||t[0]===81&&t[1]===3:!1}static isApduThatTriggersDisconnection(t){const r=new Map;return r.set("openApp",new Uint8Array([224,216,0,0])),r.set("closeApp",new Uint8Array([176,167,0,0])),Array.from(r.values()).some(n=>{for(let i=0;i<4;i++)if(n[i]!==t[i])return!1;return!0})}},uj=class{_tag;originalError;errorCode;message;constructor({tag:t,errorCode:r,originalError:n,message:i}){this._tag=t,this.originalError=n,this.errorCode=r,this.message=i??"An error occured during device exchange."}},cj=class{_tag="UnknownDeviceExchangeError";originalError;message;constructor(t){this.originalError=t,this.message="Unexpected device exchange error happened."}},fj=class extends uj{constructor(t){super({tag:"GlobalCommandError",...t})}};const KC={5515:{message:"Device is locked.",tag:"DeviceLockedError"},5501:{message:"Action refused on device.",tag:"ActionRefusedError"},5502:{message:"Pin is not set",tag:"PinNotSetError"},5223:{message:"Device internal error",tag:"DeviceInternalError"},"6e00":{message:"CLA not supported",tag:"DeviceInternalError"},"6d00":{message:"INS not supported",tag:"DeviceInternalError"}};let YI=class{static handle(t){const r=new A1(t).encodeToHexaString(t.statusCode);return lj(r,KC)?new fj({...KC[r],errorCode:r}):new cj({message:"UnknownError",errorCode:r})}},YC=class{name="getAppAndVersion";args=void 0;getApdu(){const t={cla:176,ins:1,p1:0,p2:0};return new KI(t).build()}parseResponse(t){if(!$1.isSuccessResponse(t))return us({error:YI.handle(t)});const r=new A1(t);if(r.extract8BitUInt()!==1)return us({error:new oj("getAppAndVersion: format not supported")});const n=r.encodeToString(r.extractFieldLVEncoded()),i=r.encodeToString(r.extractFieldLVEncoded());if(r.getUnparsedRemainingLength()===0)return us({data:{name:n,version:i}});const o=r.extractFieldLVEncoded();return us({data:{name:n,version:i,flags:o}})}};var dj=(e=>(e[e.BATTERY_PERCENTAGE=0]="BATTERY_PERCENTAGE",e[e.BATTERY_VOLTAGE=1]="BATTERY_VOLTAGE",e[e.BATTERY_TEMPERATURE=2]="BATTERY_TEMPERATURE",e[e.BATTERY_CURRENT=3]="BATTERY_CURRENT",e[e.BATTERY_FLAGS=4]="BATTERY_FLAGS",e))(dj||{}),pj=(e=>(e[e.NONE=0]="NONE",e[e.USB=1]="USB",e[e.QI=2]="QI",e))(pj||{}),vd={exports:{}},$v,JC;function Hp(){if(JC)return $v;JC=1;const e="2.0.0",t=256,r=Number.MAX_SAFE_INTEGER||9007199254740991,n=16,i=t-6;return $v={MAX_LENGTH:t,MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:i,MAX_SAFE_INTEGER:r,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:e,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},$v}var Iv,QC;function Wp(){if(QC)return Iv;QC=1;var e={};return Iv=typeof process=="object"&&e&&e.NODE_DEBUG&&/\bsemver\b/i.test(e.NODE_DEBUG)?(...r)=>console.error("SEMVER",...r):()=>{},Iv}var ZC;function kc(){return ZC||(ZC=1,(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Hp(),o=Wp();t=e.exports={};const s=t.re=[],u=t.safeRe=[],c=t.src=[],f=t.safeSrc=[],d=t.t={};let g=0;const h="[a-zA-Z0-9-]",b=[["\\s",1],["\\d",i],[h,n]],v=y=>{for(const[E,x]of b)y=y.split(`${E}*`).join(`${E}{0,${x}}`).split(`${E}+`).join(`${E}{1,${x}}`);return y},S=(y,E,x)=>{const T=v(E),A=g++;o(y,A,E),d[y]=A,c[A]=E,f[A]=T,s[A]=new RegExp(E,x?"g":void 0),u[A]=new RegExp(T,x?"g":void 0)};S("NUMERICIDENTIFIER","0|[1-9]\\d*"),S("NUMERICIDENTIFIERLOOSE","\\d+"),S("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),S("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),S("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),S("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),S("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),S("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),S("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),S("BUILDIDENTIFIER",`${h}+`),S("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),S("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),S("FULL",`^${c[d.FULLPLAIN]}$`),S("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),S("LOOSE",`^${c[d.LOOSEPLAIN]}$`),S("GTLT","((?:<|>)?=?)"),S("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),S("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),S("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),S("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),S("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),S("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),S("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),S("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),S("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?(?:${c[d.BUILD]})?(?:$|[^\\d])`),S("COERCERTL",c[d.COERCE],!0),S("COERCERTLFULL",c[d.COERCEFULL],!0),S("LONETILDE","(?:~>?)"),S("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",S("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),S("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),S("LONECARET","(?:\\^)"),S("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",S("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),S("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),S("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),S("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),S("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",S("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),S("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),S("STAR","(<|>)?=?\\s*\\*"),S("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),S("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(vd,vd.exports)),vd.exports}var Pv,eR;function I1(){if(eR)return Pv;eR=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return Pv=n=>n?typeof n!="object"?e:n:t,Pv}var kv,tR;function JI(){if(tR)return kv;tR=1;const e=/^[0-9]+$/,t=(n,i)=>{const o=e.test(n),s=e.test(i);return o&&s&&(n=+n,i=+i),n===i?0:o&&!s?-1:s&&!o?1:n<i?-1:1};return kv={compareIdentifiers:t,rcompareIdentifiers:(n,i)=>t(i,n)},kv}var Mv,rR;function vn(){if(rR)return Mv;rR=1;const e=Wp(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Hp(),{safeRe:n,t:i}=kc(),o=I1(),{compareIdentifiers:s}=JI();class u{constructor(f,d){if(d=o(d),f instanceof u){if(f.loose===!!d.loose&&f.includePrerelease===!!d.includePrerelease)return f;f=f.version}else if(typeof f!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof f}".`);if(f.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",f,d),this.options=d,this.loose=!!d.loose,this.includePrerelease=!!d.includePrerelease;const g=f.trim().match(d.loose?n[i.LOOSE]:n[i.FULL]);if(!g)throw new TypeError(`Invalid Version: ${f}`);if(this.raw=f,this.major=+g[1],this.minor=+g[2],this.patch=+g[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");g[4]?this.prerelease=g[4].split(".").map(h=>{if(/^[0-9]+$/.test(h)){const b=+h;if(b>=0&&b<r)return b}return h}):this.prerelease=[],this.build=g[5]?g[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(f){if(e("SemVer.compare",this.version,this.options,f),!(f instanceof u)){if(typeof f=="string"&&f===this.version)return 0;f=new u(f,this.options)}return f.version===this.version?0:this.compareMain(f)||this.comparePre(f)}compareMain(f){return f instanceof u||(f=new u(f,this.options)),s(this.major,f.major)||s(this.minor,f.minor)||s(this.patch,f.patch)}comparePre(f){if(f instanceof u||(f=new u(f,this.options)),this.prerelease.length&&!f.prerelease.length)return-1;if(!this.prerelease.length&&f.prerelease.length)return 1;if(!this.prerelease.length&&!f.prerelease.length)return 0;let d=0;do{const g=this.prerelease[d],h=f.prerelease[d];if(e("prerelease compare",d,g,h),g===void 0&&h===void 0)return 0;if(h===void 0)return 1;if(g===void 0)return-1;if(g===h)continue;return s(g,h)}while(++d)}compareBuild(f){f instanceof u||(f=new u(f,this.options));let d=0;do{const g=this.build[d],h=f.build[d];if(e("build compare",d,g,h),g===void 0&&h===void 0)return 0;if(h===void 0)return 1;if(g===void 0)return-1;if(g===h)continue;return s(g,h)}while(++d)}inc(f,d,g){if(f.startsWith("pre")){if(!d&&g===!1)throw new Error("invalid increment argument: identifier is empty");if(d){const h=`-${d}`.match(this.options.loose?n[i.PRERELEASELOOSE]:n[i.PRERELEASE]);if(!h||h[1]!==d)throw new Error(`invalid identifier: ${d}`)}}switch(f){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",d,g);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",d,g);break;case"prepatch":this.prerelease.length=0,this.inc("patch",d,g),this.inc("pre",d,g);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",d,g),this.inc("pre",d,g);break;case"release":if(this.prerelease.length===0)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{const h=Number(g)?1:0;if(this.prerelease.length===0)this.prerelease=[h];else{let b=this.prerelease.length;for(;--b>=0;)typeof this.prerelease[b]=="number"&&(this.prerelease[b]++,b=-2);if(b===-1){if(d===this.prerelease.join(".")&&g===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(h)}}if(d){let b=[d,h];g===!1&&(b=[d]),s(this.prerelease[0],d)===0?isNaN(this.prerelease[1])&&(this.prerelease=b):this.prerelease=b}break}default:throw new Error(`invalid increment argument: ${f}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Mv=u,Mv}var Dv,nR;function ql(){if(nR)return Dv;nR=1;const e=vn();return Dv=(r,n,i=!1)=>{if(r instanceof e)return r;try{return new e(r,n)}catch(o){if(!i)return null;throw o}},Dv}var Lv,iR;function hj(){if(iR)return Lv;iR=1;const e=ql();return Lv=(r,n)=>{const i=e(r,n);return i?i.version:null},Lv}var Fv,oR;function gj(){if(oR)return Fv;oR=1;const e=ql();return Fv=(r,n)=>{const i=e(r.trim().replace(/^[=v]+/,""),n);return i?i.version:null},Fv}var Nv,aR;function vj(){if(aR)return Nv;aR=1;const e=vn();return Nv=(r,n,i,o,s)=>{typeof i=="string"&&(s=o,o=i,i=void 0);try{return new e(r instanceof e?r.version:r,i).inc(n,o,s).version}catch{return null}},Nv}var jv,sR;function mj(){if(sR)return jv;sR=1;const e=ql();return jv=(r,n)=>{const i=e(r,null,!0),o=e(n,null,!0),s=i.compare(o);if(s===0)return null;const u=s>0,c=u?i:o,f=u?o:i,d=!!c.prerelease.length;if(!!f.prerelease.length&&!d){if(!f.patch&&!f.minor)return"major";if(f.compareMain(c)===0)return f.minor&&!f.patch?"minor":"patch"}const h=d?"pre":"";return i.major!==o.major?h+"major":i.minor!==o.minor?h+"minor":i.patch!==o.patch?h+"patch":"prerelease"},jv}var zv,lR;function yj(){if(lR)return zv;lR=1;const e=vn();return zv=(r,n)=>new e(r,n).major,zv}var Bv,uR;function bj(){if(uR)return Bv;uR=1;const e=vn();return Bv=(r,n)=>new e(r,n).minor,Bv}var Vv,cR;function Sj(){if(cR)return Vv;cR=1;const e=vn();return Vv=(r,n)=>new e(r,n).patch,Vv}var Uv,fR;function wj(){if(fR)return Uv;fR=1;const e=ql();return Uv=(r,n)=>{const i=e(r,n);return i&&i.prerelease.length?i.prerelease:null},Uv}var Hv,dR;function oo(){if(dR)return Hv;dR=1;const e=vn();return Hv=(r,n,i)=>new e(r,i).compare(new e(n,i)),Hv}var Wv,pR;function xj(){if(pR)return Wv;pR=1;const e=oo();return Wv=(r,n,i)=>e(n,r,i),Wv}var qv,hR;function Ej(){if(hR)return qv;hR=1;const e=oo();return qv=(r,n)=>e(r,n,!0),qv}var Gv,gR;function P1(){if(gR)return Gv;gR=1;const e=vn();return Gv=(r,n,i)=>{const o=new e(r,i),s=new e(n,i);return o.compare(s)||o.compareBuild(s)},Gv}var Xv,vR;function Cj(){if(vR)return Xv;vR=1;const e=P1();return Xv=(r,n)=>r.sort((i,o)=>e(i,o,n)),Xv}var Kv,mR;function Rj(){if(mR)return Kv;mR=1;const e=P1();return Kv=(r,n)=>r.sort((i,o)=>e(o,i,n)),Kv}var Yv,yR;function qp(){if(yR)return Yv;yR=1;const e=oo();return Yv=(r,n,i)=>e(r,n,i)>0,Yv}var Jv,bR;function k1(){if(bR)return Jv;bR=1;const e=oo();return Jv=(r,n,i)=>e(r,n,i)<0,Jv}var Qv,SR;function QI(){if(SR)return Qv;SR=1;const e=oo();return Qv=(r,n,i)=>e(r,n,i)===0,Qv}var Zv,wR;function ZI(){if(wR)return Zv;wR=1;const e=oo();return Zv=(r,n,i)=>e(r,n,i)!==0,Zv}var em,xR;function M1(){if(xR)return em;xR=1;const e=oo();return em=(r,n,i)=>e(r,n,i)>=0,em}var tm,ER;function D1(){if(ER)return tm;ER=1;const e=oo();return tm=(r,n,i)=>e(r,n,i)<=0,tm}var rm,CR;function e2(){if(CR)return rm;CR=1;const e=QI(),t=ZI(),r=qp(),n=M1(),i=k1(),o=D1();return rm=(u,c,f,d)=>{switch(c){case"===":return typeof u=="object"&&(u=u.version),typeof f=="object"&&(f=f.version),u===f;case"!==":return typeof u=="object"&&(u=u.version),typeof f=="object"&&(f=f.version),u!==f;case"":case"=":case"==":return e(u,f,d);case"!=":return t(u,f,d);case">":return r(u,f,d);case">=":return n(u,f,d);case"<":return i(u,f,d);case"<=":return o(u,f,d);default:throw new TypeError(`Invalid operator: ${c}`)}},rm}var nm,RR;function _j(){if(RR)return nm;RR=1;const e=vn(),t=ql(),{safeRe:r,t:n}=kc();return nm=(o,s)=>{if(o instanceof e)return o;if(typeof o=="number"&&(o=String(o)),typeof o!="string")return null;s=s||{};let u=null;if(!s.rtl)u=o.match(s.includePrerelease?r[n.COERCEFULL]:r[n.COERCE]);else{const b=s.includePrerelease?r[n.COERCERTLFULL]:r[n.COERCERTL];let v;for(;(v=b.exec(o))&&(!u||u.index+u[0].length!==o.length);)(!u||v.index+v[0].length!==u.index+u[0].length)&&(u=v),b.lastIndex=v.index+v[1].length+v[2].length;b.lastIndex=-1}if(u===null)return null;const c=u[2],f=u[3]||"0",d=u[4]||"0",g=s.includePrerelease&&u[5]?`-${u[5]}`:"",h=s.includePrerelease&&u[6]?`+${u[6]}`:"";return t(`${c}.${f}.${d}${g}${h}`,s)},nm}var im,_R;function Oj(){if(_R)return im;_R=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const o=this.map.keys().next().value;this.delete(o)}this.map.set(r,n)}return this}}return im=e,im}var om,OR;function ao(){if(OR)return om;OR=1;const e=/\s+/g;class t{constructor(j,H){if(H=i(H),j instanceof t)return j.loose===!!H.loose&&j.includePrerelease===!!H.includePrerelease?j:new t(j.raw,H);if(j instanceof o)return this.raw=j.value,this.set=[[j]],this.formatted=void 0,this;if(this.options=H,this.loose=!!H.loose,this.includePrerelease=!!H.includePrerelease,this.raw=j.trim().replace(e," "),this.set=this.raw.split("||").map(X=>this.parseRange(X.trim())).filter(X=>X.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const X=this.set[0];if(this.set=this.set.filter(M=>!S(M[0])),this.set.length===0)this.set=[X];else if(this.set.length>1){for(const M of this.set)if(M.length===1&&y(M[0])){this.set=[M];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let j=0;j<this.set.length;j++){j>0&&(this.formatted+="||");const H=this.set[j];for(let X=0;X<H.length;X++)X>0&&(this.formatted+=" "),this.formatted+=H[X].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(j){const X=((this.options.includePrerelease&&b)|(this.options.loose&&v))+":"+j,M=n.get(X);if(M)return M;const Q=this.options.loose,W=Q?c[f.HYPHENRANGELOOSE]:c[f.HYPHENRANGE];j=j.replace(W,z(this.options.includePrerelease)),s("hyphen replace",j),j=j.replace(c[f.COMPARATORTRIM],d),s("comparator trim",j),j=j.replace(c[f.TILDETRIM],g),s("tilde trim",j),j=j.replace(c[f.CARETTRIM],h),s("caret trim",j);let D=j.split(" ").map(te=>x(te,this.options)).join(" ").split(/\s+/).map(te=>q(te,this.options));Q&&(D=D.filter(te=>(s("loose invalid filter",te,this.options),!!te.match(c[f.COMPARATORLOOSE])))),s("range list",D);const P=new Map,G=D.map(te=>new o(te,this.options));for(const te of G){if(S(te))return[te];P.set(te.value,te)}P.size>1&&P.has("")&&P.delete("");const Z=[...P.values()];return n.set(X,Z),Z}intersects(j,H){if(!(j instanceof t))throw new TypeError("a Range is required");return this.set.some(X=>E(X,H)&&j.set.some(M=>E(M,H)&&X.every(Q=>M.every(W=>Q.intersects(W,H)))))}test(j){if(!j)return!1;if(typeof j=="string")try{j=new u(j,this.options)}catch{return!1}for(let H=0;H<this.set.length;H++)if(B(this.set[H],j,this.options))return!0;return!1}}om=t;const r=Oj(),n=new r,i=I1(),o=Gp(),s=Wp(),u=vn(),{safeRe:c,t:f,comparatorTrimReplace:d,tildeTrimReplace:g,caretTrimReplace:h}=kc(),{FLAG_INCLUDE_PRERELEASE:b,FLAG_LOOSE:v}=Hp(),S=N=>N.value==="<0.0.0-0",y=N=>N.value==="",E=(N,j)=>{let H=!0;const X=N.slice();let M=X.pop();for(;H&&X.length;)H=X.every(Q=>M.intersects(Q,j)),M=X.pop();return H},x=(N,j)=>(s("comp",N,j),N=$(N,j),s("caret",N),N=A(N,j),s("tildes",N),N=I(N,j),s("xrange",N),N=F(N,j),s("stars",N),N),T=N=>!N||N.toLowerCase()==="x"||N==="*",A=(N,j)=>N.trim().split(/\s+/).map(H=>R(H,j)).join(" "),R=(N,j)=>{const H=j.loose?c[f.TILDELOOSE]:c[f.TILDE];return N.replace(H,(X,M,Q,W,D)=>{s("tilde",N,X,M,Q,W,D);let P;return T(M)?P="":T(Q)?P=`>=${M}.0.0 <${+M+1}.0.0-0`:T(W)?P=`>=${M}.${Q}.0 <${M}.${+Q+1}.0-0`:D?(s("replaceTilde pr",D),P=`>=${M}.${Q}.${W}-${D} <${M}.${+Q+1}.0-0`):P=`>=${M}.${Q}.${W} <${M}.${+Q+1}.0-0`,s("tilde return",P),P})},$=(N,j)=>N.trim().split(/\s+/).map(H=>O(H,j)).join(" "),O=(N,j)=>{s("caret",N,j);const H=j.loose?c[f.CARETLOOSE]:c[f.CARET],X=j.includePrerelease?"-0":"";return N.replace(H,(M,Q,W,D,P)=>{s("caret",N,M,Q,W,D,P);let G;return T(Q)?G="":T(W)?G=`>=${Q}.0.0${X} <${+Q+1}.0.0-0`:T(D)?Q==="0"?G=`>=${Q}.${W}.0${X} <${Q}.${+W+1}.0-0`:G=`>=${Q}.${W}.0${X} <${+Q+1}.0.0-0`:P?(s("replaceCaret pr",P),Q==="0"?W==="0"?G=`>=${Q}.${W}.${D}-${P} <${Q}.${W}.${+D+1}-0`:G=`>=${Q}.${W}.${D}-${P} <${Q}.${+W+1}.0-0`:G=`>=${Q}.${W}.${D}-${P} <${+Q+1}.0.0-0`):(s("no pr"),Q==="0"?W==="0"?G=`>=${Q}.${W}.${D}${X} <${Q}.${W}.${+D+1}-0`:G=`>=${Q}.${W}.${D}${X} <${Q}.${+W+1}.0-0`:G=`>=${Q}.${W}.${D} <${+Q+1}.0.0-0`),s("caret return",G),G})},I=(N,j)=>(s("replaceXRanges",N,j),N.split(/\s+/).map(H=>L(H,j)).join(" ")),L=(N,j)=>{N=N.trim();const H=j.loose?c[f.XRANGELOOSE]:c[f.XRANGE];return N.replace(H,(X,M,Q,W,D,P)=>{s("xRange",N,X,M,Q,W,D,P);const G=T(Q),Z=G||T(W),te=Z||T(D),K=te;return M==="="&&K&&(M=""),P=j.includePrerelease?"-0":"",G?M===">"||M==="<"?X="<0.0.0-0":X="*":M&&K?(Z&&(W=0),D=0,M===">"?(M=">=",Z?(Q=+Q+1,W=0,D=0):(W=+W+1,D=0)):M==="<="&&(M="<",Z?Q=+Q+1:W=+W+1),M==="<"&&(P="-0"),X=`${M+Q}.${W}.${D}${P}`):Z?X=`>=${Q}.0.0${P} <${+Q+1}.0.0-0`:te&&(X=`>=${Q}.${W}.0${P} <${Q}.${+W+1}.0-0`),s("xRange return",X),X})},F=(N,j)=>(s("replaceStars",N,j),N.trim().replace(c[f.STAR],"")),q=(N,j)=>(s("replaceGTE0",N,j),N.trim().replace(c[j.includePrerelease?f.GTE0PRE:f.GTE0],"")),z=N=>(j,H,X,M,Q,W,D,P,G,Z,te,K)=>(T(X)?H="":T(M)?H=`>=${X}.0.0${N?"-0":""}`:T(Q)?H=`>=${X}.${M}.0${N?"-0":""}`:W?H=`>=${H}`:H=`>=${H}${N?"-0":""}`,T(G)?P="":T(Z)?P=`<${+G+1}.0.0-0`:T(te)?P=`<${G}.${+Z+1}.0-0`:K?P=`<=${G}.${Z}.${te}-${K}`:N?P=`<${G}.${Z}.${+te+1}-0`:P=`<=${P}`,`${H} ${P}`.trim()),B=(N,j,H)=>{for(let X=0;X<N.length;X++)if(!N[X].test(j))return!1;if(j.prerelease.length&&!H.includePrerelease){for(let X=0;X<N.length;X++)if(s(N[X].semver),N[X].semver!==o.ANY&&N[X].semver.prerelease.length>0){const M=N[X].semver;if(M.major===j.major&&M.minor===j.minor&&M.patch===j.patch)return!0}return!1}return!0};return om}var am,TR;function Gp(){if(TR)return am;TR=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(d,g){if(g=r(g),d instanceof t){if(d.loose===!!g.loose)return d;d=d.value}d=d.trim().split(/\s+/).join(" "),s("comparator",d,g),this.options=g,this.loose=!!g.loose,this.parse(d),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(d){const g=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],h=d.match(g);if(!h)throw new TypeError(`Invalid comparator: ${d}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new u(h[2],this.options.loose):this.semver=e}toString(){return this.value}test(d){if(s("Comparator.test",d,this.options.loose),this.semver===e||d===e)return!0;if(typeof d=="string")try{d=new u(d,this.options)}catch{return!1}return o(d,this.operator,this.semver,this.options)}intersects(d,g){if(!(d instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(d.value,g).test(this.value):d.operator===""?d.value===""?!0:new c(this.value,g).test(d.semver):(g=r(g),g.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!g.includePrerelease&&(this.value.startsWith("<0.0.0")||d.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&d.operator.startsWith(">")||this.operator.startsWith("<")&&d.operator.startsWith("<")||this.semver.version===d.semver.version&&this.operator.includes("=")&&d.operator.includes("=")||o(this.semver,"<",d.semver,g)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||o(this.semver,">",d.semver,g)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}am=t;const r=I1(),{safeRe:n,t:i}=kc(),o=e2(),s=Wp(),u=vn(),c=ao();return am}var sm,AR;function Xp(){if(AR)return sm;AR=1;const e=ao();return sm=(r,n,i)=>{try{n=new e(n,i)}catch{return!1}return n.test(r)},sm}var lm,$R;function Tj(){if($R)return lm;$R=1;const e=ao();return lm=(r,n)=>new e(r,n).set.map(i=>i.map(o=>o.value).join(" ").trim().split(" ")),lm}var um,IR;function Aj(){if(IR)return um;IR=1;const e=vn(),t=ao();return um=(n,i,o)=>{let s=null,u=null,c=null;try{c=new t(i,o)}catch{return null}return n.forEach(f=>{c.test(f)&&(!s||u.compare(f)===-1)&&(s=f,u=new e(s,o))}),s},um}var cm,PR;function $j(){if(PR)return cm;PR=1;const e=vn(),t=ao();return cm=(n,i,o)=>{let s=null,u=null,c=null;try{c=new t(i,o)}catch{return null}return n.forEach(f=>{c.test(f)&&(!s||u.compare(f)===1)&&(s=f,u=new e(s,o))}),s},cm}var fm,kR;function Ij(){if(kR)return fm;kR=1;const e=vn(),t=ao(),r=qp();return fm=(i,o)=>{i=new t(i,o);let s=new e("0.0.0");if(i.test(s)||(s=new e("0.0.0-0"),i.test(s)))return s;s=null;for(let u=0;u<i.set.length;++u){const c=i.set[u];let f=null;c.forEach(d=>{const g=new e(d.semver.version);switch(d.operator){case">":g.prerelease.length===0?g.patch++:g.prerelease.push(0),g.raw=g.format();case"":case">=":(!f||r(g,f))&&(f=g);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${d.operator}`)}}),f&&(!s||r(s,f))&&(s=f)}return s&&i.test(s)?s:null},fm}var dm,MR;function Pj(){if(MR)return dm;MR=1;const e=ao();return dm=(r,n)=>{try{return new e(r,n).range||"*"}catch{return null}},dm}var pm,DR;function L1(){if(DR)return pm;DR=1;const e=vn(),t=Gp(),{ANY:r}=t,n=ao(),i=Xp(),o=qp(),s=k1(),u=D1(),c=M1();return pm=(d,g,h,b)=>{d=new e(d,b),g=new n(g,b);let v,S,y,E,x;switch(h){case">":v=o,S=u,y=s,E=">",x=">=";break;case"<":v=s,S=c,y=o,E="<",x="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(i(d,g,b))return!1;for(let T=0;T<g.set.length;++T){const A=g.set[T];let R=null,$=null;if(A.forEach(O=>{O.semver===r&&(O=new t(">=0.0.0")),R=R||O,$=$||O,v(O.semver,R.semver,b)?R=O:y(O.semver,$.semver,b)&&($=O)}),R.operator===E||R.operator===x||(!$.operator||$.operator===E)&&S(d,$.semver))return!1;if($.operator===x&&y(d,$.semver))return!1}return!0},pm}var hm,LR;function kj(){if(LR)return hm;LR=1;const e=L1();return hm=(r,n,i)=>e(r,n,">",i),hm}var gm,FR;function Mj(){if(FR)return gm;FR=1;const e=L1();return gm=(r,n,i)=>e(r,n,"<",i),gm}var vm,NR;function Dj(){if(NR)return vm;NR=1;const e=ao();return vm=(r,n,i)=>(r=new e(r,i),n=new e(n,i),r.intersects(n,i)),vm}var mm,jR;function Lj(){if(jR)return mm;jR=1;const e=Xp(),t=oo();return mm=(r,n,i)=>{const o=[];let s=null,u=null;const c=r.sort((h,b)=>t(h,b,i));for(const h of c)e(h,n,i)?(u=h,s||(s=h)):(u&&o.push([s,u]),u=null,s=null);s&&o.push([s,null]);const f=[];for(const[h,b]of o)h===b?f.push(h):!b&&h===c[0]?f.push("*"):b?h===c[0]?f.push(`<=${b}`):f.push(`${h} - ${b}`):f.push(`>=${h}`);const d=f.join(" || "),g=typeof n.raw=="string"?n.raw:String(n);return d.length<g.length?d:n},mm}var ym,zR;function Fj(){if(zR)return ym;zR=1;const e=ao(),t=Gp(),{ANY:r}=t,n=Xp(),i=oo(),o=(g,h,b={})=>{if(g===h)return!0;g=new e(g,b),h=new e(h,b);let v=!1;e:for(const S of g.set){for(const y of h.set){const E=c(S,y,b);if(v=v||E!==null,E)continue e}if(v)return!1}return!0},s=[new t(">=0.0.0-0")],u=[new t(">=0.0.0")],c=(g,h,b)=>{if(g===h)return!0;if(g.length===1&&g[0].semver===r){if(h.length===1&&h[0].semver===r)return!0;b.includePrerelease?g=s:g=u}if(h.length===1&&h[0].semver===r){if(b.includePrerelease)return!0;h=u}const v=new Set;let S,y;for(const I of g)I.operator===">"||I.operator===">="?S=f(S,I,b):I.operator==="<"||I.operator==="<="?y=d(y,I,b):v.add(I.semver);if(v.size>1)return null;let E;if(S&&y){if(E=i(S.semver,y.semver,b),E>0)return null;if(E===0&&(S.operator!==">="||y.operator!=="<="))return null}for(const I of v){if(S&&!n(I,String(S),b)||y&&!n(I,String(y),b))return null;for(const L of h)if(!n(I,String(L),b))return!1;return!0}let x,T,A,R,$=y&&!b.includePrerelease&&y.semver.prerelease.length?y.semver:!1,O=S&&!b.includePrerelease&&S.semver.prerelease.length?S.semver:!1;$&&$.prerelease.length===1&&y.operator==="<"&&$.prerelease[0]===0&&($=!1);for(const I of h){if(R=R||I.operator===">"||I.operator===">=",A=A||I.operator==="<"||I.operator==="<=",S){if(O&&I.semver.prerelease&&I.semver.prerelease.length&&I.semver.major===O.major&&I.semver.minor===O.minor&&I.semver.patch===O.patch&&(O=!1),I.operator===">"||I.operator===">="){if(x=f(S,I,b),x===I&&x!==S)return!1}else if(S.operator===">="&&!n(S.semver,String(I),b))return!1}if(y){if($&&I.semver.prerelease&&I.semver.prerelease.length&&I.semver.major===$.major&&I.semver.minor===$.minor&&I.semver.patch===$.patch&&($=!1),I.operator==="<"||I.operator==="<="){if(T=d(y,I,b),T===I&&T!==y)return!1}else if(y.operator==="<="&&!n(y.semver,String(I),b))return!1}if(!I.operator&&(y||S)&&E!==0)return!1}return!(S&&A&&!y&&E!==0||y&&R&&!S&&E!==0||O||$)},f=(g,h,b)=>{if(!g)return h;const v=i(g.semver,h.semver,b);return v>0?g:v<0||h.operator===">"&&g.operator===">="?h:g},d=(g,h,b)=>{if(!g)return h;const v=i(g.semver,h.semver,b);return v<0?g:v>0||h.operator==="<"&&g.operator==="<="?h:g};return ym=o,ym}var bm,BR;function Nj(){if(BR)return bm;BR=1;const e=kc(),t=Hp(),r=vn(),n=JI(),i=ql(),o=hj(),s=gj(),u=vj(),c=mj(),f=yj(),d=bj(),g=Sj(),h=wj(),b=oo(),v=xj(),S=Ej(),y=P1(),E=Cj(),x=Rj(),T=qp(),A=k1(),R=QI(),$=ZI(),O=M1(),I=D1(),L=e2(),F=_j(),q=Gp(),z=ao(),B=Xp(),N=Tj(),j=Aj(),H=$j(),X=Ij(),M=Pj(),Q=L1(),W=kj(),D=Mj(),P=Dj(),G=Lj(),Z=Fj();return bm={parse:i,valid:o,clean:s,inc:u,diff:c,major:f,minor:d,patch:g,prerelease:h,compare:b,rcompare:v,compareLoose:S,compareBuild:y,sort:E,rsort:x,gt:T,lt:A,eq:R,neq:$,gte:O,lte:I,cmp:L,coerce:F,Comparator:q,Range:z,satisfies:B,toComparators:N,maxSatisfying:j,minSatisfying:H,minVersion:X,validRange:M,outside:Q,gtr:W,ltr:D,intersects:P,simplifyRange:G,subset:Z,SemVer:r,re:e.re,src:e.src,tokens:e.t,SEMVER_SPEC_VERSION:t.SEMVER_SPEC_VERSION,RELEASE_TYPES:t.RELEASE_TYPES,compareIdentifiers:n.compareIdentifiers,rcompareIdentifiers:n.rcompareIdentifiers},bm}var Wn=Nj();const VR=Mr(Wn);var Zt=(e=>(e.NANO_S="nanoS",e.NANO_SP="nanoSP",e.NANO_X="nanoX",e.STAX="stax",e.FLEX="flex",e.APEX="apexp",e))(Zt||{});let t2=class{id;model;name;constructor({id:t,model:r,name:n}){this.id=t,this.model=r,this.name=n}},jj=class{constructor(t){if(this.seFlags=t,this.seFlags.length!==4)throw new Error("Invalid secure element flags length")}generalDeviceState(){const t=this.seFlags[0]??0;return{isPinValidated:this._checkNthBitInByte(t,1),hasMcuSerialNumber:this._checkNthBitInByte(t,2),hasValidCertificate:this._checkNthBitInByte(t,3),isCustomAuthorityConnectionAllowed:this._checkNthBitInByte(t,4),isSecureConnectionAllowed:this._checkNthBitInByte(t,5),isOnboarded:this._checkNthBitInByte(t,6),isMcuCodeSigned:this._checkNthBitInByte(t,7),isInRecoveryMode:this._checkNthBitInByte(t,8)}}endorsementInformation(){throw new Error("Not implemented")}wordsInformation(){throw new Error("Not implemented")}onboardingStatus(){throw new Error("Not implemented")}_checkNthBitInByte(t,r){return(t>>8-r&1)===1}},zj=class{name="getOsVersion";args=void 0;getApdu(){const t={cla:224,ins:1,p1:0,p2:0};return new KI(t).build()}parseResponse(t,r){if(!$1.isSuccessResponse(t))return us({error:YI.handle(t)});const n=new A1(t),i=n.extract32BitUInt();if(i===void 0)return us({error:new ij("Missing target ID in OS version")});let o=n.encodeToString(n.extractFieldLVEncoded()),s=n.extractFieldLVEncoded()??new Uint8Array(0);const u={...new jj(s).generalDeviceState()};o||(o="0.0.0",s=new Uint8Array);const c=(i&4026531840)!==805306368,f=o.includes("-osu");let d="",g="",h="",b="",v,S,y,E;if(c){h=o,v=i;const x=n.extractFieldLVEncoded();x&&(x.length>=5?(d=n.encodeToString(x),S=parseInt(n.encodeToHexaString(n.extractFieldLVEncoded()),16)):S=parseInt(n.encodeToHexaString(x),16))}else{if(d=o,S=i,g=n.encodeToString(n.extractFieldLVEncoded()),this.isBootloaderVersionSupported(d,r)&&(h=n.encodeToString(n.extractFieldLVEncoded())),this.isHardwareVersionSupported(d,r)?b=n.encodeToHexaString(n.extractFieldLVEncoded()):b="00",this.isLocalizationSupported(d,r)){const x=n.extractFieldLVEncoded();x!==void 0&&(y=parseInt(n.encodeToHexaString(x),16))}if(this.isRecoverSupported(d,r)){const x=n.extractFieldLVEncoded();x!==void 0&&(E=parseInt(n.encodeToHexaString(x),16))}}return us({data:{isBootloader:c,isOsu:f,targetId:i,seTargetId:S,mcuTargetId:v,seVersion:d,seFlags:s,mcuSephVersion:g,mcuBootloaderVersion:h,hwVersion:b,langId:y,recoverState:E,secureElementFlags:u}})}isBootloaderVersionSupported(t,r){const n=Wn.coerce(t)??"";switch(r){case Zt.NANO_S:case Zt.NANO_X:return Wn.gte(n,"2.0.0");default:return!0}}isHardwareVersionSupported(t,r){const n=Wn.coerce(t)??"";switch(r){case Zt.NANO_X:return Wn.gte(n,"2.0.0");default:return!1}}isLocalizationSupported(t,r){const n=Wn.coerce(t)??"";switch(r){case Zt.NANO_S:return!1;case Zt.NANO_SP:return Wn.gte(n,"1.1.0");case Zt.NANO_X:return Wn.gte(n,"2.1.0");default:return!0}}isRecoverSupported(t,r){const n=Wn.coerce(t)??"";switch(r){case Zt.NANO_S:return!1;case Zt.NANO_SP:return Wn.gte(n,"1.1.2");case Zt.NANO_X:return Wn.gte(n,"2.2.3");case Zt.STAX:return Wn.gte(n,"1.4.0");case Zt.FLEX:return Wn.gte(n,"1.0.1");default:return!0}}};var bo=(e=>(e.LOCKED="LOCKED",e.BUSY="BUSY",e.CONNECTED="CONNECTED",e.NOT_CONNECTED="NOT CONNECTED",e))(bo||{}),Bj=(e=>(e.NotStarted="not-started",e.Pending="pending",e.Stopped="stopped",e.Completed="completed",e.Error="error",e))(Bj||{}),Vj=(e=>(e.None="none",e.UnlockDevice="unlock-device",e.AllowSecureConnection="allow-secure-connection",e.ConfirmOpenApp="confirm-open-app",e.SignTransaction="sign-transaction",e.SignTypedData="sign-typed-data",e.AllowListApps="allow-list-apps",e.VerifyAddress="verify-address",e.SignPersonalMessage="sign-personal-message",e.SignDelegationAuthorization="sign-delegation-authorization",e.Web3ChecksOptIn="web3-checks-opt-in",e.VerifySafeAddress="verify-safe-address",e.RegisterWallet="register-wallet",e.ConfirmLoadImage="confirm-load-image",e.ConfirmCommitImage="confirm-commit-image",e.ConfirmRemoveImage="confirm-remove-image",e))(Vj||{});const Tn={of(e){return dn(e)},empty(){return Yt},zero(){return Yt},fromNullable(e){return e==null?Yt:dn(e)},fromFalsy(e){return e?dn(e):Yt},fromPredicate(e,t){switch(arguments.length){case 1:return r=>Tn.fromPredicate(e,r);default:return e(t)?dn(t):Yt}},mapMaybe(e,t){switch(arguments.length){case 1:return r=>Tn.mapMaybe(e,r);default:return Tn.catMaybes(t.map(e))}},catMaybes(e){let t=[];for(const r of e)r.isJust()&&t.push(r.extract());return t},encase(e){try{return dn(e())}catch{return Yt}},isMaybe(e){return e instanceof F1||e instanceof N1},sequence(e){let t=[];for(const r of e)if(r.isJust())t.push(r.extract());else return Yt;return dn(t)},"fantasy-land/of"(e){return this.of(e)},"fantasy-land/empty"(){return this.empty()},"fantasy-land/zero"(){return this.zero()}};class F1{constructor(t){this.__value=t,this["fantasy-land/equals"]=this.equals,this["fantasy-land/map"]=this.map,this["fantasy-land/ap"]=this.ap,this["fantasy-land/alt"]=this.alt,this["fantasy-land/chain"]=this.chain,this["fantasy-land/reduce"]=this.reduce,this["fantasy-land/extend"]=this.extend,this["fantasy-land/filter"]=this.filter}isJust(){return!0}isNothing(){return!1}inspect(){return`Just(${this.__value})`}toString(){return this.inspect()}toJSON(){const t=this.__value;return t instanceof Date?t.toJSON():t}equals(t){return this.extract()===t.extract()}map(t){return dn(t(this.__value))}ap(t){return t.isJust()?this.map(t.extract()):Yt}alt(t){return this}altLazy(t){return this}chain(t){return t(this.__value)}chainNullable(t){return Tn.fromNullable(t(this.__value))}join(){return this.__value}reduce(t,r){return t(r,this.__value)}extend(t){return dn(t(this))}unsafeCoerce(){return this.__value}caseOf(t){return"_"in t?t._():t.Just(this.__value)}orDefault(t){return this.__value}orDefaultLazy(t){return this.__value}toList(){return[this.__value]}mapOrDefault(t,r){return t(this.__value)}extract(){return this.__value}extractNullable(){return this.__value}toEither(t){return rn(this.__value)}ifJust(t){return t(this.__value),this}ifNothing(t){return this}filter(t){return t(this.__value)?dn(this.__value):Yt}}F1.prototype.constructor=Tn;class N1{constructor(){this["fantasy-land/equals"]=this.equals,this["fantasy-land/map"]=this.map,this["fantasy-land/ap"]=this.ap,this["fantasy-land/alt"]=this.alt,this["fantasy-land/chain"]=this.chain,this["fantasy-land/reduce"]=this.reduce,this["fantasy-land/extend"]=this.extend,this["fantasy-land/filter"]=this.filter}isJust(){return!1}isNothing(){return!0}inspect(){return"Nothing"}toString(){return this.inspect()}toJSON(){return this.__value}equals(t){return this.extract()===t.extract()}map(t){return Yt}ap(t){return Yt}alt(t){return t}altLazy(t){return t()}chain(t){return Yt}chainNullable(t){return Yt}join(){return Yt}reduce(t,r){return r}extend(t){return Yt}unsafeCoerce(){throw new Error("Maybe#unsafeCoerce was ran on a Nothing")}caseOf(t){return"_"in t?t._():t.Nothing()}orDefault(t){return t}orDefaultLazy(t){return t()}toList(){return[]}mapOrDefault(t,r){return r}extract(){}extractNullable(){return null}toEither(t){return tn(t)}ifJust(t){return this}ifNothing(t){return t(),this}filter(t){return Yt}}N1.prototype.constructor=Tn;const dn=e=>new F1(e),Yt=new N1,Jn={of(e){return rn(e)},lefts(e){let t=[];for(const r of e)r.isLeft()&&t.push(r.extract());return t},rights(e){let t=[];for(const r of e)r.isRight()&&t.push(r.extract());return t},encase(e){try{return rn(e())}catch(t){return tn(t)}},sequence(e){let t=[];for(const r of e){if(r.isLeft())return r;t.push(r.extract())}return rn(t)},isEither(e){return e instanceof z1||e instanceof j1},"fantasy-land/of"(e){return Jn.of(e)}};class j1{constructor(t){this.__value=t,this._="R",this["fantasy-land/bimap"]=this.bimap,this["fantasy-land/map"]=this.map,this["fantasy-land/ap"]=this.ap,this["fantasy-land/equals"]=this.equals,this["fantasy-land/chain"]=this.chain,this["fantasy-land/alt"]=this.alt,this["fantasy-land/reduce"]=this.reduce,this["fantasy-land/extend"]=this.extend}isLeft(){return!1}isRight(){return!0}toJSON(){return this.__value}inspect(){return`Right(${this.__value})`}toString(){return this.inspect()}bimap(t,r){return rn(r(this.__value))}map(t){return rn(t(this.__value))}mapLeft(t){return this}ap(t){return t.isRight()?this.map(t.extract()):t}equals(t){return t.isRight()?this.__value===t.extract():!1}chain(t){return t(this.__value)}chainLeft(t){return this}join(){return this.__value}alt(t){return this}altLazy(t){return this}reduce(t,r){return t(r,this.__value)}extend(t){return rn(t(this))}unsafeCoerce(){return this.__value}caseOf(t){return"_"in t?t._():t.Right(this.__value)}leftOrDefault(t){return t}orDefault(t){return this.__value}orDefaultLazy(t){return this.__value}leftOrDefaultLazy(t){return t()}ifLeft(t){return this}ifRight(t){return t(this.__value),this}toMaybe(){return dn(this.__value)}leftToMaybe(){return Yt}extract(){return this.__value}swap(){return tn(this.__value)}}j1.prototype.constructor=Jn;class z1{constructor(t){this.__value=t,this._="L",this["fantasy-land/bimap"]=this.bimap,this["fantasy-land/map"]=this.map,this["fantasy-land/ap"]=this.ap,this["fantasy-land/equals"]=this.equals,this["fantasy-land/chain"]=this.chain,this["fantasy-land/alt"]=this.alt,this["fantasy-land/reduce"]=this.reduce,this["fantasy-land/extend"]=this.extend}isLeft(){return!0}isRight(){return!1}toJSON(){return this.__value}inspect(){return`Left(${JSON.stringify(this.__value)})`}toString(){return this.inspect()}bimap(t,r){return tn(t(this.__value))}map(t){return this}mapLeft(t){return tn(t(this.__value))}ap(t){return t.isLeft()?t:this}equals(t){return t.isLeft()?t.extract()===this.__value:!1}chain(t){return this}chainLeft(t){return t(this.__value)}join(){return this}alt(t){return t}altLazy(t){return t()}reduce(t,r){return r}extend(t){return this}unsafeCoerce(){throw this.__value instanceof Error?this.__value:new Error("Either#unsafeCoerce was ran on a Left")}caseOf(t){return"_"in t?t._():t.Left(this.__value)}leftOrDefault(t){return this.__value}orDefault(t){return t}orDefaultLazy(t){return t()}leftOrDefaultLazy(t){return this.__value}ifLeft(t){return t(this.__value),this}ifRight(t){return this}toMaybe(){return Yt}leftToMaybe(){return dn(this.__value)}extract(){return this.__value}swap(){return rn(this.__value)}}z1.prototype.constructor=Jn;const tn=e=>new z1(e),rn=e=>new j1(e);var r2;const n2={liftEither(e){if(e.isRight())return Promise.resolve(e.extract());throw e.extract()},fromPromise(e){return e.then(n2.liftEither)},throwE(e){throw e}};class i2{constructor(t){this.runPromise=t,this[r2]="EitherAsync",this["fantasy-land/chain"]=this.chain,this["fantasy-land/alt"]=this.alt,this.then=(r,n)=>this.run().then(r,n)}leftOrDefault(t){return this.run().then(r=>r.leftOrDefault(t))}orDefault(t){return this.run().then(r=>r.orDefault(t))}join(){return mt(async t=>{const r=await this;if(r.isRight()){const n=await r.extract();return t.liftEither(n)}return t.liftEither(r)})}ap(t){return mt(async r=>{const n=await t;if(n.isRight()){const i=await this.run();return i.isRight()?n.extract()(i.extract()):r.liftEither(i)}return r.liftEither(n)})}alt(t){return mt(async r=>{const n=await this.run();if(n.isRight())return n.extract();{const i=await t;return r.liftEither(i)}})}extend(t){return mt(async r=>{const n=await this.run();if(n.isRight()){const i=mt.liftEither(n);return r.liftEither(rn(t(i)))}return r.liftEither(n)})}async run(){try{return rn(await this.runPromise(n2))}catch(t){return tn(t)}}bimap(t,r){return mt(async n=>{const i=await this.run();try{return await n.liftEither(i.bimap(t,r))}catch(o){throw await o}})}map(t){return mt(r=>this.runPromise(r).then(t))}mapLeft(t){return mt(async r=>{try{return await this.runPromise(r)}catch(n){throw await t(n)}})}chain(t){return mt(async r=>{const n=await this.runPromise(r);return r.fromPromise(t(n))})}chainLeft(t){return mt(async r=>{try{return await this.runPromise(r)}catch(n){return r.fromPromise(t(n))}})}toMaybeAsync(){return cn(async({liftMaybe:t})=>{const r=await this.run();return t(r.toMaybe())})}swap(){return mt(async t=>{const r=await this.run();return r.isRight()&&t.throwE(r.extract()),t.liftEither(rn(r.extract()))})}ifLeft(t){return mt(async r=>{const n=await this.run();return n.ifLeft(t),r.liftEither(n)})}ifRight(t){return mt(async r=>{const n=await this.run();return n.ifRight(t),r.liftEither(n)})}void(){return this.map(t=>{})}caseOf(t){return this.run().then(r=>r.caseOf(t))}finally(t){return mt(({fromPromise:r})=>r(this.run().finally(t)))}}r2=Symbol.toStringTag;const mt=Object.assign(e=>new i2(e),{fromPromise:e=>mt(({fromPromise:t})=>t(e())),liftEither:e=>mt(({liftEither:t})=>t(e)),lefts:e=>Promise.all(e.map(t=>t.run())).then(Jn.lefts),rights:e=>Promise.all(e.map(t=>t.run())).then(Jn.rights),sequence:e=>mt(async t=>{let r=[];for await(const n of e){if(n.isLeft())return t.liftEither(n);r.push(n.extract())}return t.liftEither(rn(r))}),all:e=>mt.fromPromise(async()=>Promise.all(e).then(Jn.sequence))});i2.prototype.constructor=mt;var o2;const a2={liftMaybe(e){if(e.isJust())return Promise.resolve(e.extract());throw Yt},fromPromise(e){return e.then(a2.liftMaybe)}};class s2{constructor(t){this.runPromise=t,this[o2]="MaybeAsync",this["fantasy-land/chain"]=this.chain,this["fantasy-land/filter"]=this.filter,this["fantasy-land/alt"]=this.alt}orDefault(t){return this.run().then(r=>r.orDefault(t))}join(){return cn(async t=>{const r=await this.run();if(r.isJust()){const n=await r.extract();return t.liftMaybe(n)}return t.liftMaybe(Yt)})}ap(t){return cn(async r=>{const n=await t;if(n.isJust()){const i=await this.run();return i.isJust()?n.extract()(i.extract()):r.liftMaybe(Yt)}return r.liftMaybe(Yt)})}alt(t){return cn(async r=>{const n=await this.run();if(n.isJust())return n.extract();{const i=await t;return r.liftMaybe(i)}})}extend(t){return cn(async r=>{const n=await this.run();if(n.isJust()){const i=cn.liftMaybe(n);return r.liftMaybe(dn(t(i)))}return r.liftMaybe(Yt)})}filter(t){return cn(async r=>{const n=await this.run();return r.liftMaybe(n.filter(t))})}async run(){try{return dn(await this.runPromise(a2))}catch{return Yt}}map(t){return cn(r=>this.runPromise(r).then(t))}chain(t){return cn(async r=>{const n=await this.runPromise(r);return r.fromPromise(t(n))})}toEitherAsync(t){return mt(async({liftEither:r})=>{const n=await this.run();return r(n.toEither(t))})}ifJust(t){return cn(async r=>{const n=await this.run();return n.ifJust(t),r.liftMaybe(n)})}ifNothing(t){return cn(async r=>{const n=await this.run();return n.ifNothing(t),r.liftMaybe(n)})}void(){return this.map(t=>{})}caseOf(t){return this.run().then(r=>r.caseOf(t))}finally(t){return cn(({fromPromise:r})=>r(this.run().finally(t)))}then(t,r){return this.run().then(t,r)}}o2=Symbol.toStringTag;const cn=Object.assign(e=>new s2(e),{catMaybes:e=>Promise.all(e).then(Tn.catMaybes),fromPromise:e=>cn(({fromPromise:t})=>t(e())),liftMaybe:e=>cn(({liftMaybe:t})=>t(e))});s2.prototype.constructor=cn;var Ky=function(e,t){return Ky=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Ky(e,t)};function To(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Ky(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}function Uj(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function u(d){try{f(n.next(d))}catch(g){s(g)}}function c(d){try{f(n.throw(d))}catch(g){s(g)}}function f(d){d.done?o(d.value):i(d.value).then(u,c)}f((n=n.apply(e,t||[])).next())})}function l2(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(f){return function(d){return c([f,d])}}function c(f){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,f[0]&&(r=0)),r;)try{if(n=1,i&&(o=f[0]&2?i.return:f[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,f[1])).done)return o;switch(i=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return r.label++,{value:f[1],done:!1};case 5:r.label++,i=f[1],f=[0];continue;case 7:f=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){r=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){r.label=f[1];break}if(f[0]===6&&r.label<o[1]){r.label=o[1],o=f;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(f);break}o[2]&&r.ops.pop(),r.trys.pop();continue}f=t.call(e,r)}catch(d){f=[6,d],i=0}finally{n=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}}function Al(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function $l(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o}function Il(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}function Cl(e){return this instanceof Cl?(this.v=e,this):new Cl(e)}function Hj(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),u("next"),u("throw"),u("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(b){return function(v){return Promise.resolve(v).then(b,g)}}function u(b,v){n[b]&&(i[b]=function(S){return new Promise(function(y,E){o.push([b,S,y,E])>1||c(b,S)})},v&&(i[b]=v(i[b])))}function c(b,v){try{f(n[b](v))}catch(S){h(o[0][3],S)}}function f(b){b.value instanceof Cl?Promise.resolve(b.value.v).then(d,g):h(o[0][2],b)}function d(b){c("next",b)}function g(b){c("throw",b)}function h(b,v){b(v),o.shift(),o.length&&c(o[0][0],o[0][1])}}function Wj(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Al=="function"?Al(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(u,c){s=e[o](s),i(u,c,s.done,s.value)})}}function i(o,s,u,c){Promise.resolve(c).then(function(f){o({value:f,done:u})},s)}}function pr(e){return typeof e=="function"}function Kp(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var Sm=Kp(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
514
514
|
`+r.map(function(n,i){return i+1+") "+n.toString()}).join(`
|
|
515
515
|
`):"",this.name="UnsubscriptionError",this.errors=r}});function Sp(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Mc=(function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,i,o;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var u=Al(s),c=u.next();!c.done;c=u.next()){var f=c.value;f.remove(this)}}catch(S){t={error:S}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}else s.remove(this);var d=this.initialTeardown;if(pr(d))try{d()}catch(S){o=S instanceof Sm?S.errors:[S]}var g=this._finalizers;if(g){this._finalizers=null;try{for(var h=Al(g),b=h.next();!b.done;b=h.next()){var v=b.value;try{UR(v)}catch(S){o=o??[],S instanceof Sm?o=Il(Il([],$l(o)),$l(S.errors)):o.push(S)}}}catch(S){n={error:S}}finally{try{b&&!b.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}}if(o)throw new Sm(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)UR(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Sp(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Sp(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=(function(){var t=new e;return t.closed=!0,t})(),e})(),u2=Mc.EMPTY;function c2(e){return e instanceof Mc||e&&"closed"in e&&pr(e.remove)&&pr(e.add)&&pr(e.unsubscribe)}function UR(e){pr(e)?e():e.unsubscribe()}var qj={Promise:void 0},Gj={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,Il([e,t],$l(r)))},clearTimeout:function(e){return clearTimeout(e)},delegate:void 0};function f2(e){Gj.setTimeout(function(){throw e})}function Yy(){}function Jd(e){e()}var B1=(function(e){To(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,c2(r)&&r.add(n)):n.destination=Yj,n}return t.create=function(r,n,i){return new Jy(r,n,i)},t.prototype.next=function(r){this.isStopped||this._next(r)},t.prototype.error=function(r){this.isStopped||(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t})(Mc),Xj=(function(){function e(t){this.partialObserver=t}return e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){md(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){md(n)}else md(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){md(r)}},e})(),Jy=(function(e){To(t,e);function t(r,n,i){var o=e.call(this)||this,s;return pr(r)||!r?s={next:r??void 0,error:n??void 0,complete:i??void 0}:s=r,o.destination=new Xj(s),o}return t})(B1);function md(e){f2(e)}function Kj(e){throw e}var Yj={closed:!0,next:Yy,error:Kj,complete:Yy},V1=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Dc(e){return e}function Jj(e){return e.length===0?Dc:e.length===1?e[0]:function(r){return e.reduce(function(n,i){return i(n)},r)}}var Zn=(function(){function e(t){t&&(this._subscribe=t)}return e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var i=this,o=Zj(t)?t:new Jy(t,r,n);return Jd(function(){var s=i,u=s.operator,c=s.source;o.add(u?u.call(o,c):c?i._subscribe(o):i._trySubscribe(o))}),o},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=HR(r),new r(function(i,o){var s=new Jy({next:function(u){try{t(u)}catch(c){o(c),s.unsubscribe()}},error:o,complete:i});n.subscribe(s)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[V1]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return Jj(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=HR(t),new t(function(n,i){var o;r.subscribe(function(s){return o=s},function(s){return i(s)},function(){return n(o)})})},e.create=function(t){return new e(t)},e})();function HR(e){var t;return(t=e??qj.Promise)!==null&&t!==void 0?t:Promise}function Qj(e){return e&&pr(e.next)&&pr(e.error)&&pr(e.complete)}function Zj(e){return e&&e instanceof B1||Qj(e)&&c2(e)}function ez(e){return pr(e?.lift)}function Pi(e){return function(t){if(ez(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function io(e,t,r,n,i){return new tz(e,t,r,n,i)}var tz=(function(e){To(t,e);function t(r,n,i,o,s,u){var c=e.call(this,r)||this;return c.onFinalize=s,c.shouldUnsubscribe=u,c._next=n?function(f){try{n(f)}catch(d){r.error(d)}}:e.prototype._next,c._error=o?function(f){try{o(f)}catch(d){r.error(d)}finally{this.unsubscribe()}}:e.prototype._error,c._complete=i?function(){try{i()}catch(f){r.error(f)}finally{this.unsubscribe()}}:e.prototype._complete,c}return t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t})(B1),rz=Kp(function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}}),Gl=(function(e){To(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return t.prototype.lift=function(r){var n=new WR(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new rz},t.prototype.next=function(r){var n=this;Jd(function(){var i,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=Al(n.currentObservers),u=s.next();!u.done;u=s.next()){var c=u.value;c.next(r)}}catch(f){i={error:f}}finally{try{u&&!u.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}}})},t.prototype.error=function(r){var n=this;Jd(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var i=n.observers;i.length;)i.shift().error(r)}})},t.prototype.complete=function(){var r=this;Jd(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,i=this,o=i.hasError,s=i.isStopped,u=i.observers;return o||s?u2:(this.currentObservers=null,u.push(r),new Mc(function(){n.currentObservers=null,Sp(u,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,i=n.hasError,o=n.thrownError,s=n.isStopped;i?r.error(o):s&&r.complete()},t.prototype.asObservable=function(){var r=new Zn;return r.source=this,r},t.create=function(r,n){return new WR(r,n)},t})(Zn),WR=(function(e){To(t,e);function t(r,n){var i=e.call(this)||this;return i.destination=r,i.source=n,i}return t.prototype.next=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.next)===null||i===void 0||i.call(n,r)},t.prototype.error=function(r){var n,i;(i=(n=this.destination)===null||n===void 0?void 0:n.error)===null||i===void 0||i.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,i;return(i=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&i!==void 0?i:u2},t})(Gl),nz=(function(e){To(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,i=r.thrownError,o=r._value;if(n)throw i;return this._throwIfClosed(),o},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t})(Gl),U1={now:function(){return(U1.delegate||Date).now()},delegate:void 0},d2=(function(e){To(t,e);function t(r,n,i){r===void 0&&(r=1/0),n===void 0&&(n=1/0),i===void 0&&(i=U1);var o=e.call(this)||this;return o._bufferSize=r,o._windowTime=n,o._timestampProvider=i,o._buffer=[],o._infiniteTimeWindow=!0,o._infiniteTimeWindow=n===1/0,o._bufferSize=Math.max(1,r),o._windowTime=Math.max(1,n),o}return t.prototype.next=function(r){var n=this,i=n.isStopped,o=n._buffer,s=n._infiniteTimeWindow,u=n._timestampProvider,c=n._windowTime;i||(o.push(r),!s&&o.push(u.now()+c)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),i=this,o=i._infiniteTimeWindow,s=i._buffer,u=s.slice(),c=0;c<u.length&&!r.closed;c+=o?1:2)r.next(u[c]);return this._checkFinalizedStatuses(r),n},t.prototype._trimBuffer=function(){var r=this,n=r._bufferSize,i=r._timestampProvider,o=r._buffer,s=r._infiniteTimeWindow,u=(s?1:2)*n;if(n<1/0&&u<o.length&&o.splice(0,o.length-u),!s){for(var c=i.now(),f=0,d=1;d<o.length&&o[d]<=c;d+=2)f=d;f&&o.splice(0,f+1)}},t})(Gl),iz=(function(e){To(t,e);function t(r,n){return e.call(this)||this}return t.prototype.schedule=function(r,n){return this},t})(Mc),qR={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setInterval.apply(void 0,Il([e,t],$l(r)))},clearInterval:function(e){return clearInterval(e)},delegate:void 0},oz=(function(e){To(t,e);function t(r,n){var i=e.call(this,r,n)||this;return i.scheduler=r,i.work=n,i.pending=!1,i}return t.prototype.schedule=function(r,n){var i;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var o=this.id,s=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(s,o,n)),this.pending=!0,this.delay=n,this.id=(i=this.id)!==null&&i!==void 0?i:this.requestAsyncId(s,this.id,n),this},t.prototype.requestAsyncId=function(r,n,i){return i===void 0&&(i=0),qR.setInterval(r.flush.bind(r,this),i)},t.prototype.recycleAsyncId=function(r,n,i){if(i===void 0&&(i=0),i!=null&&this.delay===i&&this.pending===!1)return n;n!=null&&qR.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var i=this._execute(r,n);if(i)return i;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var i=!1,o;try{this.work(r)}catch(s){i=!0,o=s||new Error("Scheduled action threw falsy error")}if(i)return this.unsubscribe(),o},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,i=r.scheduler,o=i.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Sp(o,this),n!=null&&(this.id=this.recycleAsyncId(i,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t})(iz),GR=(function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return e.prototype.schedule=function(t,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,t).schedule(n,r)},e.now=U1.now,e})(),az=(function(e){To(t,e);function t(r,n){n===void 0&&(n=GR.now);var i=e.call(this,r,n)||this;return i.actions=[],i._active=!1,i}return t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var i;this._active=!0;do if(i=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,i){for(;r=n.shift();)r.unsubscribe();throw i}},t})(GR),p2=new az(oz),sz=p2,lz=new Zn(function(e){return e.complete()});function h2(e){return e&&pr(e.schedule)}function H1(e){return e[e.length-1]}function uz(e){return pr(H1(e))?e.pop():void 0}function Yp(e){return h2(H1(e))?e.pop():void 0}function cz(e,t){return typeof H1(e)=="number"?e.pop():t}var g2=(function(e){return e&&typeof e.length=="number"&&typeof e!="function"});function v2(e){return pr(e?.then)}function m2(e){return pr(e[V1])}function y2(e){return Symbol.asyncIterator&&pr(e?.[Symbol.asyncIterator])}function b2(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function fz(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var S2=fz();function w2(e){return pr(e?.[S2])}function x2(e){return Hj(this,arguments,function(){var r,n,i,o;return l2(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Cl(r.read())];case 3:return n=s.sent(),i=n.value,o=n.done,o?[4,Cl(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Cl(i)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function E2(e){return pr(e?.getReader)}function Va(e){if(e instanceof Zn)return e;if(e!=null){if(m2(e))return dz(e);if(g2(e))return pz(e);if(v2(e))return hz(e);if(y2(e))return C2(e);if(w2(e))return gz(e);if(E2(e))return vz(e)}throw b2(e)}function dz(e){return new Zn(function(t){var r=e[V1]();if(pr(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function pz(e){return new Zn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}function hz(e){return new Zn(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,f2)})}function gz(e){return new Zn(function(t){var r,n;try{for(var i=Al(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(t.next(s),t.closed)return}}catch(u){r={error:u}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}t.complete()})}function C2(e){return new Zn(function(t){mz(e,t).catch(function(r){return t.error(r)})})}function vz(e){return C2(x2(e))}function mz(e,t){var r,n,i,o;return Uj(this,void 0,void 0,function(){var s,u;return l2(this,function(c){switch(c.label){case 0:c.trys.push([0,5,6,11]),r=Wj(e),c.label=1;case 1:return[4,r.next()];case 2:if(n=c.sent(),!!n.done)return[3,4];if(s=n.value,t.next(s),t.closed)return[2];c.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=c.sent(),i={error:u},[3,11];case 6:return c.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:c.sent(),c.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}function La(e,t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1);var o=t.schedule(function(){r(),i?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!i)return o}function R2(e,t){return t===void 0&&(t=0),Pi(function(r,n){r.subscribe(io(n,function(i){return La(n,e,function(){return n.next(i)},t)},function(){return La(n,e,function(){return n.complete()},t)},function(i){return La(n,e,function(){return n.error(i)},t)}))})}function _2(e,t){return t===void 0&&(t=0),Pi(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}function yz(e,t){return Va(e).pipe(_2(t),R2(t))}function bz(e,t){return Va(e).pipe(_2(t),R2(t))}function Sz(e,t){return new Zn(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}function wz(e,t){return new Zn(function(r){var n;return La(r,t,function(){n=e[S2](),La(r,t,function(){var i,o,s;try{i=n.next(),o=i.value,s=i.done}catch(u){r.error(u);return}s?r.complete():r.next(o)},0,!0)}),function(){return pr(n?.return)&&n.return()}})}function O2(e,t){if(!e)throw new Error("Iterable cannot be null");return new Zn(function(r){La(r,t,function(){var n=e[Symbol.asyncIterator]();La(r,t,function(){n.next().then(function(i){i.done?r.complete():r.next(i.value)})},0,!0)})})}function xz(e,t){return O2(x2(e),t)}function Ez(e,t){if(e!=null){if(m2(e))return yz(e,t);if(g2(e))return Sz(e,t);if(v2(e))return bz(e,t);if(y2(e))return O2(e,t);if(w2(e))return wz(e,t);if(E2(e))return xz(e,t)}throw b2(e)}function Pl(e,t){return t?Ez(e,t):Va(e)}function T2(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Yp(e);return Pl(e,r)}var Cz=Kp(function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}});function XR(e,t){return new Promise(function(r,n){var i=!1,o;e.subscribe({next:function(s){o=s,i=!0},error:n,complete:function(){i?r(o):n(new Cz)}})})}function A2(e){return e instanceof Date&&!isNaN(e)}var Rz=Kp(function(e){return function(r){r===void 0&&(r=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=r}});function KR(e,t){var r=A2(e)?{first:e}:typeof e=="number"?{each:e}:e,n=r.first,i=r.each,o=r.with,s=o===void 0?_z:o,u=r.scheduler,c=u===void 0?p2:u,f=r.meta,d=f===void 0?null:f;if(n==null&&i==null)throw new TypeError("No timeout provided.");return Pi(function(g,h){var b,v,S=null,y=0,E=function(x){v=La(h,c,function(){try{b.unsubscribe(),Va(s({meta:d,lastValue:S,seen:y})).subscribe(h)}catch(T){h.error(T)}},x)};b=g.subscribe(io(h,function(x){v?.unsubscribe(),y++,h.next(S=x),i>0&&E(i)},void 0,void 0,function(){v?.closed||v?.unsubscribe(),S=null})),!y&&E(n!=null?typeof n=="number"?n:+n-c.now():i)})}function _z(e){throw new Rz(e)}function Fa(e,t){return Pi(function(r,n){var i=0;r.subscribe(io(n,function(o){n.next(e.call(t,o,i++))}))})}function Oz(e,t,r,n,i,o,s,u){var c=[],f=0,d=0,g=!1,h=function(){g&&!c.length&&!f&&t.complete()},b=function(S){return f<n?v(S):c.push(S)},v=function(S){f++;var y=!1;Va(r(S,d++)).subscribe(io(t,function(E){t.next(E)},function(){y=!0},void 0,function(){if(y)try{f--;for(var E=function(){var x=c.shift();s||v(x)};c.length&&f<n;)E();h()}catch(x){t.error(x)}}))};return e.subscribe(io(t,b,function(){g=!0,h()})),function(){}}function W1(e,t,r){return r===void 0&&(r=1/0),pr(t)?W1(function(n,i){return Fa(function(o,s){return t(n,o,i,s)})(Va(e(n,i)))},r):(typeof t=="number"&&(r=t),Pi(function(n,i){return Oz(n,i,e,r)}))}function $2(e){return e===void 0&&(e=1/0),W1(Dc,e)}function Tz(){return $2(1)}function YR(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tz()(Pl(e,Yp(e)))}function Az(e,t,r){r===void 0&&(r=sz);var n=-1;return t!=null&&(h2(t)?r=t:n=t),new Zn(function(i){var o=A2(e)?+e-r.now():e;o<0&&(o=0);var s=0;return r.schedule(function(){i.closed||(i.next(s++),0<=n?this.schedule(void 0,n):i.complete())},o)})}function $z(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Yp(e),n=cz(e,1/0),i=e;return i.length?i.length===1?Va(i[0]):$2(n)(Pl(i,r)):lz}function JR(e,t){return Pi(function(r,n){var i=0;r.subscribe(io(n,function(o){return e.call(t,o,i++)&&n.next(o)}))})}function Iz(e,t,r,n,i){return function(o,s){var u=r,c=t,f=0;o.subscribe(io(s,function(d){var g=f++;c=u?e(c,d,g):(u=!0,d),s.next(c)},i))}}function Pz(e,t){return t===void 0&&(t=Dc),e=e??kz,Pi(function(r,n){var i,o=!0;r.subscribe(io(n,function(s){var u=t(s);(o||!e(i,u))&&(o=!1,i=u,n.next(s))}))})}function kz(e,t){return e===t}function Mz(e){return Pi(function(t,r){try{t.subscribe(r)}finally{r.add(e)}})}function Dz(e,t){return Pi(Iz(e,t,arguments.length>=2,!0))}function Lz(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=Yp(e);return Pi(function(n,i){(r?YR(e,n,r):YR(e,n)).subscribe(i)})}function QR(e,t,r){var n=pr(e)||t||r?{next:e,error:t,complete:r}:e;return n?Pi(function(i,o){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var u=!0;i.subscribe(io(o,function(c){var f;(f=n.next)===null||f===void 0||f.call(n,c),o.next(c)},function(){var c;u=!1,(c=n.complete)===null||c===void 0||c.call(n),o.complete()},function(c){var f;u=!1,(f=n.error)===null||f===void 0||f.call(n,c),o.error(c)},function(){var c,f;u&&((c=n.unsubscribe)===null||c===void 0||c.call(n)),(f=n.finalize)===null||f===void 0||f.call(n)}))}):Dc}function Fz(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=uz(e);return Pi(function(n,i){for(var o=e.length,s=new Array(o),u=e.map(function(){return!1}),c=!1,f=function(g){Va(e[g]).subscribe(io(i,function(h){s[g]=h,!c&&!u[g]&&(u[g]=!0,(c=u.every(Dc))&&(u=null))},Yy))},d=0;d<o;d++)f(d);n.subscribe(io(i,function(g){if(c){var h=Il([g],$l(s));i.next(r?r.apply(void 0,Il([],$l(h))):h)}}))})}var pc=(e=>(e[e.Connected=0]="Connected",e[e.ReadyWithoutSecureChannel=1]="ReadyWithoutSecureChannel",e[e.ReadyWithSecureChannel=2]="ReadyWithSecureChannel",e))(pc||{});let Lc=class{_tag="GeneralDmkError";originalError;constructor(t){t instanceof Error?this.originalError=t:t!==void 0&&(this.originalError=new Error(String(t)))}},q1=class extends Lc{constructor(t){super(t),this.err=t}_tag="TransportNotSupportedError"},Nz=class extends Lc{constructor(t){super(t),this.err=t}_tag="SendApduTimeoutError"},jz=class extends Lc{constructor(t){super(t),this.err=t}_tag="SendCommandTimeoutError"},zz=class extends Lc{constructor(t){super(t),this.err=t}_tag="TransportAlreadyExistsError"},Bz=class extends Lc{constructor(t){super(t),this.err=t}_tag="NoTransportProvidedError"};var gl=null;typeof WebSocket<"u"?gl=WebSocket:typeof MozWebSocket<"u"?gl=MozWebSocket:typeof self<"u"?gl=self.WebSocket||self.MozWebSocket:typeof window<"u"?gl=window.WebSocket||window.MozWebSocket:typeof self<"u"&&(gl=self.WebSocket||self.MozWebSocket);const Vz=gl;var Uz=(e=>(e.GenuineCheck="GenuineCheck",e.ListInstalledApps="ListInstalledApps",e.UpdateMcu="UpdateMcu",e.UpdateFirmware="UpdateFirmware",e.InstallApp="InstallApp",e.UninstallApp="UninstallApp",e))(Uz||{}),Hz=(e=>(e.EXCHANGE="exchange",e.BULK="bulk",e.ERROR="error",e.WARNING="warning",e.SUCCESS="success",e))(Hz||{}),Wz=(e=>(e.SUCCESS="success",e.ERROR="error",e))(Wz||{}),qz=(e=>(e.Opened="opened",e.Closed="closed",e.PermissionRequested="permission-requested",e.PermissionGranted="permission-granted",e.PreExchange="pre-exchange",e.Exchange="exchange",e.DeviceId="device-id",e.Progress="progress",e.Warning="warning",e.Error="error",e.Result="result",e))(qz||{}),Gz=(e=>(e[e.AppAlreadyInstalled=0]="AppAlreadyInstalled",e[e.DeviceLocked=1]="DeviceLocked",e[e.OutOfMemory=2]="OutOfMemory",e[e.RefusedByUser=3]="RefusedByUser",e[e.Unknown=4]="Unknown",e))(Gz||{});let Xz=class{constructor(t){this.error=t,this.originalError=t}_tag="WebSocketConnectionError";originalError};function G1(e,t){return Reflect.getOwnMetadata(t,e)}function Kz(e,t,r){Reflect.defineMetadata(t,r,e)}function Yu(e,t,r,n){const i=n(G1(e,t)??r());Reflect.defineMetadata(t,i,e)}var ZR,e_,t_;(function(e){e.moduleId="moduleId",e.serviceId="serviceId"})(ZR||(ZR={}));(function(e){e.id="id",e.moduleId="moduleId",e.serviceId="serviceId"})(e_||(e_={}));(function(e){e.moduleId="moduleId",e.serviceId="serviceId"})(t_||(t_={}));const Qd="@inversifyjs/core/classMetadataReflectKey";function Zd(){return{constructorArguments:[],lifecycle:{postConstructMethodName:void 0,preDestroyMethodName:void 0},properties:new Map,scope:void 0}}const Yz="@inversifyjs/core/pendingClassMetadataCountReflectKey",wm=Symbol.for("@inversifyjs/core/InversifyCoreError");let Na=class I2 extends Error{[wm];kind;constructor(t,r,n){super(r,n),this[wm]=!0,this.kind=t}static is(t){return typeof t=="object"&&t!==null&&t[wm]===!0}static isErrorOfKind(t,r){return I2.is(t)&&t.kind===r}};var Ro,wp,hc;function Jz(){return 0}function Qz(e){return t=>{t!==void 0&&t.kind===wp.unknown&&Yu(e,Yz,Jz,(r=>r-1))}}function Zz(e,t){return(...r)=>n=>{if(n===void 0)return e(...r);if(n.kind===hc.unmanaged)throw new Na(Ro.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found");return t(n,...r)}}function e8(e){if(e.kind!==wp.unknown&&e.isFromTypescriptParamType!==!0)throw new Na(Ro.injectionDecoratorConflict,"Unexpected injection found. Multiple @inject, @multiInject or @unmanaged decorators found")}(function(e){e[e.injectionDecoratorConflict=0]="injectionDecoratorConflict",e[e.missingInjectionDecorator=1]="missingInjectionDecorator",e[e.planning=2]="planning",e[e.resolution=3]="resolution",e[e.unknown=4]="unknown"})(Ro||(Ro={})),(function(e){e[e.unknown=32]="unknown"})(wp||(wp={})),(function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection",e[e.unmanaged=2]="unmanaged"})(hc||(hc={}));const t8=Zz((function(e,t){return{kind:e,name:void 0,optional:!1,tags:new Map,value:t}}),(function(e,t,r){return e8(e),{...e,kind:t,value:r}}));function r_(e,t){return r=>{const n=r.properties.get(t);return r.properties.set(t,e(n)),r}}var Aa;function r8(e,t,r,n){if(Na.isErrorOfKind(n,Ro.injectionDecoratorConflict)){const i=(function(o,s,u){if(u===void 0){if(s===void 0)throw new Na(Ro.unknown,"Unexpected undefined property and index values");return{kind:Aa.property,property:s,targetClass:o.constructor}}return typeof u=="number"?{index:u,kind:Aa.parameter,targetClass:o}:{kind:Aa.method,method:s,targetClass:o}})(e,t,r);throw new Na(Ro.injectionDecoratorConflict,`Unexpected injection error.
|
|
516
516
|
|
|
@@ -522,7 +522,7 @@ Details
|
|
|
522
522
|
|
|
523
523
|
${(function(o){switch(o.kind){case Aa.method:return`[class: "${o.targetClass.name}", method: "${o.method.toString()}"]`;case Aa.parameter:return`[class: "${o.targetClass.name}", index: "${o.index.toString()}"]`;case Aa.property:return`[class: "${o.targetClass.name}", property: "${o.property.toString()}"]`}})(i)}`,{cause:n})}throw n}function n8(e,t){return(r,n,i)=>{try{i===void 0?(function(o,s){const u=xm(o,s);return(c,f)=>{Yu(c.constructor,Qd,Zd,r_(u(c),f))}})(e,t)(r,n):typeof i=="number"?(function(o,s){const u=xm(o,s);return(c,f,d)=>{if(!(function(g,h){return typeof g=="function"&&h===void 0})(c,f))throw new Na(Ro.injectionDecoratorConflict,`Found an @inject decorator in a non constructor parameter.
|
|
524
524
|
Found @inject decorator at method "${f?.toString()??""}" at class "${c.constructor.name}"`);Yu(c,Qd,Zd,(function(g,h){return b=>{const v=b.constructorArguments[h];return b.constructorArguments[h]=g(v),b}})(u(c),d))}})(e,t)(r,n,i):(function(o,s){const u=xm(o,s);return(c,f,d)=>{if(!(function(g){return g.set!==void 0})(d))throw new Na(Ro.injectionDecoratorConflict,`Found an @inject decorator in a non setter property method.
|
|
525
|
-
Found @inject decorator at method "${f.toString()}" at class "${c.constructor.name}"`);Yu(c.constructor,Qd,Zd,r_(u(c),f))}})(e,t)(r,n,i)}catch(o){r8(r,n,i,o)}}}function xm(e,t){return r=>{const n=t(r);return i=>(n(i),e(i))}}function rt(e){return n8(t8(hc.singleInjection,e),Qz)}(function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property"})(Aa||(Aa={}));const n_="@inversifyjs/core/classIsInjectableFlagReflectKey",i8=[Array,BigInt,Boolean,Function,Number,Object,String];function o8(e){const t=G1(e,"design:paramtypes");t!==void 0&&Yu(e,Qd,Zd,(function(r){return n=>(r.forEach(((i,o)=>{var s;n.constructorArguments[o]!==void 0||(s=i,i8.includes(s))||(n.constructorArguments[o]=(function(u){return{isFromTypescriptParamType:!0,kind:hc.singleInjection,name:void 0,optional:!1,tags:new Map,value:u}})(i))})),n)})(t))}function Rt(e){return t=>{(function(r){if(G1(r,n_)!==void 0)throw new Na(Ro.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${r.name}"`);Kz(r,n_,!0)})(t),o8(t)}}var i_;(function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection"})(i_||(i_={}));var o_;(function(e){e[e.singleMandatory=0]="singleMandatory",e[e.singleOptional=1]="singleOptional",e[e.multipleMandatory=2]="multipleMandatory",e[e.multipleOptional=3]="multipleOptional",e[e.length=4]="length"})(o_||(o_={}));let a8=class{constructor(t,r,n,i,o){this.deviceModel=t,this.serviceUuid=r,this.writeUuid=n,this.writeCmdUuid=i,this.notifyUuid=o}},tl=class{id;productName;usbProductId;bootloaderUsbProductId;usbOnly;memorySize;getBlockSize;masks;bluetoothSpec;constructor(t){this.id=t.id,this.productName=t.productName,this.usbProductId=t.usbProductId,this.bootloaderUsbProductId=t.bootloaderUsbProductId,this.usbOnly=t.usbOnly,this.memorySize=t.memorySize,this.getBlockSize=t.getBlockSize,this.masks=t.masks,this.bluetoothSpec=t.bluetoothSpec}};var s8=Object.defineProperty,l8=(e,t,r)=>t in e?s8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},c8=(e,t,r)=>l8(e,t+"",r);let cs=class{getAllDeviceModels(){return Object.values(cs.deviceModelByIds)}getDeviceModel(t){return cs.deviceModelByIds[t.id]}filterDeviceModels(t){return this.getAllDeviceModels().filter(r=>Object.entries(t).every(([n,i])=>r[n]===i))}getBluetoothServicesInfos(){return Object.values(cs.deviceModelByIds).reduce((t,r)=>{const{bluetoothSpec:n}=r;return n?{...t,...n.reduce((i,o)=>({...i,[o.serviceUuid]:new a8(r,o.serviceUuid,o.writeUuid,o.writeCmdUuid,o.notifyUuid)}),{})}:t},{})}getBluetoothServices(){return Object.values(cs.deviceModelByIds).map(t=>(t.bluetoothSpec||[]).map(r=>r.serviceUuid)).flat().filter(t=>!!t)}};c8(cs,"deviceModelByIds",{[Zt.NANO_S]:new tl({id:Zt.NANO_S,productName:"Ledger Nano S",usbProductId:16,bootloaderUsbProductId:1,usbOnly:!0,memorySize:320*1024,getBlockSize:e=>VR.lt(VR.coerce(e.firmwareVersion)??"","2.0.0")?4*1024:2*1024,masks:[823132160]}),[Zt.NANO_SP]:new tl({id:Zt.NANO_SP,productName:"Ledger Nano S Plus",usbProductId:80,bootloaderUsbProductId:5,usbOnly:!0,memorySize:1533*1024,getBlockSize:()=>32,masks:[856686592]}),[Zt.NANO_X]:new tl({id:Zt.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,getBlockSize:()=>4*1024,masks:[855638016],bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]}),[Zt.STAX]:new tl({id:Zt.STAX,productName:"Ledger Stax",usbProductId:96,bootloaderUsbProductId:6,usbOnly:!1,memorySize:1533*1024,getBlockSize:()=>32,masks:[857735168],bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]}),[Zt.FLEX]:new tl({id:Zt.FLEX,productName:"Ledger Flex",usbProductId:112,bootloaderUsbProductId:7,usbOnly:!1,memorySize:1533*1024,getBlockSize:()=>32,masks:[858783744],bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]}),[Zt.APEX]:new tl({id:Zt.APEX,productName:"Ledger Nano Gen5",usbProductId:128,bootloaderUsbProductId:8,usbOnly:!1,memorySize:1533*1024,getBlockSize:()=>32,masks:[859832320],bluetoothSpec:[{serviceUuid:"13d63400-2c97-8004-0000-4c6564676572",notifyUuid:"13d63400-2c97-8004-0001-4c6564676572",writeUuid:"13d63400-2c97-8004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-8004-0003-4c6564676572"},{serviceUuid:"13d63400-2c97-9004-0000-4c6564676572",notifyUuid:"13d63400-2c97-9004-0001-4c6564676572",writeUuid:"13d63400-2c97-9004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-9004-0003-4c6564676572"}]})}),cs=u8([Rt()],cs);let f8=class{statusCode;data;constructor({statusCode:t,data:r}){this.statusCode=t,this.data=r}};const d8=5,as=1,Qy=2,bl=2,Zy=2,zr=[];for(let e=0;e<256;++e)zr.push((e+256).toString(16).slice(1));function p8(e,t=0){return(zr[e[t+0]]+zr[e[t+1]]+zr[e[t+2]]+zr[e[t+3]]+"-"+zr[e[t+4]]+zr[e[t+5]]+"-"+zr[e[t+6]]+zr[e[t+7]]+"-"+zr[e[t+8]]+zr[e[t+9]]+"-"+zr[e[t+10]]+zr[e[t+11]]+zr[e[t+12]]+zr[e[t+13]]+zr[e[t+14]]+zr[e[t+15]]).toLowerCase()}let Em;const h8=new Uint8Array(16);function g8(){if(!Em){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Em=crypto.getRandomValues.bind(crypto)}return Em(h8)}const v8=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),a_={randomUUID:v8};function Jp(e,t,r){if(a_.randomUUID&&!e)return a_.randomUUID();e=e||{};const n=e.random||(e.rng||g8)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,p8(n)}const gs={getLastBytesFrom(e,t){return e.slice(-t)},getFirstBytesFrom(e,t){return e.slice(0,t)},bytesToNumber(e){return e.reduce((t,r,n)=>t+r*Math.pow(256,e.length-1-n),0)},numberToByteArray(e,t){return new Uint8Array(t).map((r,n)=>e>>8*(t-1-n)&255)}},s_=2,Cm=800;let l_=class{_tag="FramerOverflowError";originalError;constructor(){this.originalError=new Error("Frame header length is greater than frame size")}},m8=class{_tag="FramerApduError";originalError;constructor(){this.originalError=new Error("Frame offset is greater than apdu length")}},u_=class{_tag="ReceiverApduError";originalError;constructor(t){this.originalError=new Error(t??"Unable to parse apdu")}},c_=class{_tag="DeviceSessionNotFound";originalError;constructor(t){this.originalError=t??new Error("Device session not found")}},P2=class{_header;_data;constructor({header:t,data:r}){this._header=t,this._data=r}toString(){return JSON.stringify({header:this._header.toString(),data:dc(this._data)},null,2)}getRawData(){const t=this._header.getRawData(),r=new Uint8Array(t.length+this._data.length);return r.set(t,0),r.set(this._data,t.length),r}getHeader(){return this._header}getData(){return this._data}},k2=class{_uuid;_channel;_headTag;_index;_length;_dataLength;constructor({uuid:t,dataSize:r,index:n,headTag:i,length:o,channel:s}){this._uuid=t,this._dataLength=r,this._index=n,this._headTag=i,this._length=o,this._channel=s}getDataLength(){return this._dataLength.map(t=>gs.bytesToNumber(t))}setDataSize(t){return this._dataLength=t,this}getLength(){return this._length}toString(){return JSON.stringify({uuid:this._uuid.toString(),dataSize:this._dataLength.extract()?.toString(),index:this._index.toString(),headTag:this._headTag.toString(),length:this._length.toString(),channel:this._channel.extract()?.toString()})}getRawData(){return new Uint8Array([...this._channel.caseOf({Just:t=>[...t],Nothing:()=>[]}),...this._headTag,...this._index,...this._dataLength.caseOf({Just:t=>[...t],Nothing:()=>[]})])}};const _r={LoggerPublisherServiceFactory:Symbol.for("LoggerPublisherServiceFactory")};var y8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},b8=(e,t)=>(r,n)=>t(r,n,e);let f_=class{_channel;_logger;_pendingFrames;constructor({channel:t=Tn.zero()},r){this._channel=t,this._logger=r("ApduReceiverService"),this._pendingFrames=[]}handleFrame(t){return this.getFrameFromBytes(t).map(r=>{if(this._pendingFrames.push(r),!this._pendingFrames[0])return Yt;const n=this._pendingFrames[0].getHeader().getDataLength();return this.getCompleteFrame(n)})}getCompleteFrame(t){return t.chain(r=>{if(!this.isComplete(r))return this._logger.debug("frame is not complete, waiting for more"),Yt;const n=gs.getFirstBytesFrom(this.concatFrames(this._pendingFrames),r),i=gs.getFirstBytesFrom(n,n.length-s_),o=gs.getLastBytesFrom(n,s_);return this._pendingFrames=[],dn(new f8({data:i,statusCode:o}))})}getFrameFromBytes(t){const r=this._channel.caseOf({Just:()=>Qy,Nothing:()=>0}),n=t.slice(r,r+as),i=t.slice(r+as,r+as+bl),o=i.reduce((h,b)=>h+b,0)===0;if(!o&&this._pendingFrames.length===0)return tn(new u_);const s=r+as+bl,u=o?Zy:0;if(t.length<r+as+bl+u)return tn(new u_("Unable to parse header from apdu"));const c=o?dn(t.slice(s,s+u)):Yt,f=s+u,d=t.slice(f),g=new P2({header:new k2({uuid:Jp(),channel:this._channel,dataSize:c,headTag:n,index:i,length:r+as+bl+u}),data:d});return rn(g)}isComplete(t){return this._pendingFrames.reduce((r,n)=>r+n.getData().length,0)>=t}concatFrames(t){return t.reduce((r,n)=>Uint8Array.from([...r,...n.getData()]),new Uint8Array(0))}};f_=y8([Rt(),b8(1,rt(_r.LoggerPublisherServiceFactory))],f_);var S8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},w8=(e,t)=>(r,n)=>t(r,n,e);let d_=class{_frameSize;_channel;_padding;_logger;constructor({frameSize:t,channel:r=Tn.zero(),padding:n=!1},i){this._frameSize=t,this._channel=r,this._padding=n,this._logger=i("DefaultApduSenderService")}getFrames(t){const r=[];let n=0,i=this.getFrameAtIndex(t,n);for(;i.isRight();)r.push(i.extract()),n+=1,i=this.getFrameAtIndex(t,n).mapLeft(o=>(o instanceof l_||this._logger.error("Error while parsing frame",{data:{error:o}}),o));return r}getFrameAtIndex(t,r){const n=this.getFrameHeaderFrom(r,t.length),i=r===0?0:r*this._frameSize-this.getHeaderSizeSumFrom(r);if(i>=t.length)return tn(new l_);if(n.getLength()>this._frameSize)return tn(new m8);const o=this._frameSize-n.getLength(),s=t.slice(i,i+this._frameSize-n.getLength()),u=this._padding?new Uint8Array(o).fill(0):new Uint8Array(s.length<o?s.length:o);u.set(s,0);const c=new P2({header:n,data:u});return rn(c)}getFrameHeaderFrom(t,r){const n=new k2({uuid:Jp(),channel:this._channel.map(i=>gs.getLastBytesFrom(i,Qy)),headTag:new Uint8Array([d8]),index:gs.numberToByteArray(t,bl),length:this.getFrameHeaderSizeFromIndex(t),dataSize:Tn.zero()});return t===0&&n.setDataSize(Tn.of(gs.numberToByteArray(r,Zy))),n}getHeaderSizeSumFrom(t){let r=this.getFrameHeaderSizeFromIndex(0),n=1;for(;n<t;)r+=this.getFrameHeaderSizeFromIndex(n),n+=1;return r}getFrameHeaderSizeFromIndex(t){return this._channel.caseOf({Just:()=>Qy,Nothing:()=>0})+bl+as+(t===0?Zy:0)}};d_=S8([Rt(),w8(1,rt(_r.LoggerPublisherServiceFactory))],d_);const eb={LocalConfigDataSource:Symbol.for("LocalConfigDataSource"),RemoteConfigDataSource:Symbol.for("RemoteConfigDataSource"),ConfigService:Symbol.for("ConfigService")},gn={ApduSenderServiceFactory:Symbol.for("ApduSenderServiceFactory"),ApduReceiverServiceFactory:Symbol.for("ApduReceiverServiceFactory"),DeviceSessionService:Symbol.for("DeviceSessionService")},p_={ConnectUseCase:Symbol.for("ConnectUseCase"),DisconnectUseCase:Symbol.for("DisconnectUseCase")},Qp={ManagerApiService:Symbol.for("ManagerApiService"),ManagerApiDataSource:Symbol.for("ManagerApiDataSource"),DmkConfig:Symbol.for("ManagerApiDmkConfig")},ja={DmkConfig:Symbol.for("TransportDmkConfig"),TransportService:Symbol.for("TransportService"),TransportsInput:Symbol.for("TransportsInput")};var x8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},h_=(e,t)=>(r,n)=>t(r,n,e);let g_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("SendCommandUseCase")}async execute({sessionId:t,command:r,abortTimeout:n}){return this._sessionService.getDeviceSessionById(t).caseOf({Right:async i=>await i.sendCommand(r,n),Left:i=>{throw this._logger.error("Error getting session",{data:{error:i}}),i}})}};g_=x8([Rt(),h_(0,rt(gn.DeviceSessionService)),h_(1,rt(_r.LoggerPublisherServiceFactory))],g_);var E8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let v_=class{execute=vi.fn(()=>"stub")};v_=E8([Rt()],v_);var C8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},m_=(e,t)=>(r,n)=>t(r,n,e);let y_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("ExecuteDeviceActionUseCase")}execute({sessionId:t,deviceAction:r}){return this._sessionService.getDeviceSessionById(t).caseOf({Right:n=>n.executeDeviceAction(r),Left:n=>{throw this._logger.error("Error getting session",{data:{error:n}}),n}})}};y_=C8([Rt(),m_(0,rt(gn.DeviceSessionService)),m_(1,rt(_r.LoggerPublisherServiceFactory))],y_);function R8(e){return typeof e=="object"&&e!==null&&"version"in e&&"name"in e&&typeof e.version=="string"&&typeof e.name=="string"}let b_=class{constructor(t){this.err=t,this.originalError=t}_tag="ApiCallError";originalError},_8=class{constructor(t){this.err=t,this.originalError=t}_tag="ParseResponseError";originalError},M2=class{constructor(t){this.err=t,this.originalError=t}_tag="JSONParseError";originalError},O8=class{constructor(t){this.err=t,this.originalError=t}_tag="ReadFileError";originalError};const T8="@ledgerhq/device-management-kit",A8="0.0.0-develop-20260401001841",S_={name:T8,version:A8};var $8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};const I8={name:S_.name,version:S_.version},P8=()=>JSON.stringify(I8);let w_=class{getConfig(){return Jn.encase(()=>P8()).mapLeft(t=>new O8(t)).chain(t=>Jn.encase(()=>{const r=JSON.parse(t);if(R8(r))return r;throw new Error("Invalid config file")}).mapLeft(r=>new M2(r)))}};w_=$8([Rt()],w_);var k8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let x_=class{getConfig(){return Jn.of({name:"DeviceSDK",version:"0.0.0-stub.1"})}};x_=k8([Rt()],x_);var M8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let E_=class{async getConfig(){const t=await this._callApi();if(t.isLeft())return tn(new b_(t.extract()));if(!t.extract().ok)return tn(new b_(new Error("response not ok")));const r=await t.extract().json();return r.isLeft()?tn(new M2):r.chain(n=>this._parseResponse(n)).map(n=>n)}_parseResponse(t){const{name:r,version:n}=t;return!r||!n?tn(new _8):Jn.of({name:r,version:n})}_callApi(){return new Promise(t=>{t(Jn.of({ok:!0,json:async()=>new Promise(r=>{r(Jn.of({name:"DeviceSDK",version:"0.0.0-fake.1",yolo:"yolo"}))})}))})}};E_=M8([Rt()],E_);var D8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let C_=class{async getConfig(){return new Promise(t=>t(Jn.of({name:"DeviceSDK",version:"0.0.0-fake.2"})))}};C_=D8([Rt()],C_);var L8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},Rm=(e,t)=>(r,n)=>t(r,n,e);let R_=class{_local;_remote;_logger;constructor(t,r,n){this._local=t,this._remote=r,this._logger=n("config")}async getDmkConfig(){const t=this._local.getConfig().ifLeft(r=>{this._logger.error("Local config not available",{data:{error:r}})});if(t.isRight()){const r=t.extract();return this._logger.info("Local config available",{data:{config:r}}),r}return this._remote.getConfig().then(r=>r.mapLeft(n=>(this._logger.error("Local config available",{data:{error:n}}),{name:"DeadDmk",version:"0.0.0-dead.1"})).extract())}};R_=L8([Rt(),Rm(0,rt(eb.LocalConfigDataSource)),Rm(1,rt(eb.RemoteConfigDataSource)),Rm(2,rt(_r.LoggerPublisherServiceFactory))],R_);var F8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},N8=(e,t)=>(r,n)=>t(r,n,e);let __=class{_configService;constructor(t){this._configService=t}async getDmkVersion(){return(await this._configService.getDmkConfig()).version}};__=F8([Rt(),N8(0,rt(eb.ConfigService))],__);const j8={DeviceModelDataSource:Symbol.for("DeviceModelDataSource")};var z8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},O_=(e,t)=>(r,n)=>t(r,n,e);let T_=class{constructor(t,r){this._sessionService=t,this._logger=r("DisableDeviceSessionRefresherUseCase")}_logger;execute({sessionId:t,blockerId:r}){return this._sessionService.getDeviceSessionById(t).caseOf({Left:n=>{throw this._logger.error("Error getting device session",{data:{error:n}}),n},Right:n=>n.disableRefresher(r)})}};T_=z8([Rt(),O_(0,rt(gn.DeviceSessionService)),O_(1,rt(_r.LoggerPublisherServiceFactory))],T_);var B8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},V8=(e,t)=>(r,n)=>t(r,n,e);let A_=class{_sessions;_sessionsSubject;_logger;constructor(t){this._sessions=[],this._sessionsSubject=new d2,this._logger=t("DeviceSessionService")}get sessionsObs(){return this._sessionsSubject.asObservable()}addDeviceSession(t){return this._sessions.find(r=>r.id===t.id)?(this._logger.warn("DeviceSession already exists",{data:{deviceSession:t}}),this):(this._sessions.push(t),this._sessionsSubject.next(t),this._logger.info("DeviceSession added",{data:{sessionId:t.id}}),this)}removeDeviceSession(t){const r=this._sessions.find(n=>n.id===t);return r?(r.close(),this._sessions=this._sessions.filter(n=>n.id!==t),this._logger.info("DeviceSession removed",{data:{sessionId:t}}),this):(this._logger.warn("DeviceSession not found",{data:{sessionId:t}}),this)}getDeviceSessionById(t){return Tn.fromNullable(this._sessions.find(r=>r.id===t)).toEither(new c_)}getDeviceSessionsByDeviceId(t){return Tn.fromPredicate(({length:r})=>r>0,this._sessions.filter(r=>r.connectedDevice.id===t)).toEither(new c_)}getDeviceSessions(){return this._sessions}};A_=B8([Rt(),V8(0,rt(_r.LoggerPublisherServiceFactory))],A_);var U8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},$_=(e,t)=>(r,n)=>t(r,n,e);let I_=class{_sessionService;_transportService;constructor(t,r){this._sessionService=t,this._transportService=r}execute(){const t=this._sessionService.getDeviceSessions();for(const r of t)this._transportService.closeConnection(r.connectedDevice),this._sessionService.removeDeviceSession(r.id)}};I_=U8([Rt(),$_(0,rt(gn.DeviceSessionService)),$_(1,rt(ja.TransportService))],I_);var H8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},P_=(e,t)=>(r,n)=>t(r,n,e);let k_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("GetDeviceSessionStateUseCase")}execute({sessionId:t}){return this._sessionService.getDeviceSessionById(t).caseOf({Left:r=>{throw this._logger.error("Error getting session device",{data:{error:r}}),r},Right:r=>r.state})}};k_=H8([Rt(),P_(0,rt(gn.DeviceSessionService)),P_(1,rt(_r.LoggerPublisherServiceFactory))],k_);var W8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},M_=(e,t)=>(r,n)=>t(r,n,e);let D_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("UnsafeBypassIntentQueueUseCase")}execute({sessionId:t,bypass:r}){this._sessionService.getDeviceSessionById(t).caseOf({Left:n=>{throw this._logger.error("Error getting session",{data:{error:n}}),n},Right:n=>{this._logger.warn(`UNSAFE: ${r?"Enabling":"Disabling"} intent queue bypass for session ${t}`),n._unsafeBypassIntentQueue(r)}})}};D_=W8([Rt(),M_(0,rt(gn.DeviceSessionService)),M_(1,rt(_r.LoggerPublisherServiceFactory))],D_);function q8(e){return`[will send APDU] ~...> ${dc(e,!1)}`}function G8(e){return`[exchange] <= ${dc(e.data,!1)}${dc(e.statusCode,!1)}`}const tb=1e3,_m=1e3,X8={isRefresherDisabled:!1,pollingInterval:1e3};var dr=(e=>(e.NEW_STATE="NEW_STATE",e.REFRESH_NEEDED="REFRESH_NEEDED",e.COMMAND_SUCCEEDED="COMMAND_SUCCEEDED",e.DEVICE_STATE_UPDATE_BUSY="DEVICE_STATE_UPDATE_BUSY",e.DEVICE_STATE_UPDATE_LOCKED="DEVICE_STATE_UPDATE_LOCKED",e.DEVICE_STATE_UPDATE_CONNECTED="DEVICE_STATE_UPDATE_CONNECTED",e.DEVICE_STATE_UPDATE_UNKNOWN="DEVICE_STATE_UPDATE_UNKNOWN",e))(dr||{});let K8=class{_eventEmitter=new Gl;listen(){return this._eventEmitter.asObservable()}dispatch(t){this._eventEmitter.next(t)}},Y8=class{constructor(t,r){this.loggerModuleFactory=t,this.sessionEventDispatcher=r,this._logger=this.loggerModuleFactory("IntentQueueService")}_logger;_queue=[];_isProcessing=!1;_currentSubscription=null;enqueue(t){this._logger.debug("Enqueueing intent",{data:{type:t.type}});const r=new Gl,n={intent:t,subject:r,isCancelled:!1};this._queue.push(n);const i=()=>{this._logger.debug("Cancelling intent",{data:{type:t.type}}),n.isCancelled=!0,this._queue[0]===n&&this._currentSubscription?(this._currentSubscription.unsubscribe(),this._currentSubscription=null,r.complete(),this._queue.shift(),this._isProcessing=!1,this._processQueue()):(!this._isProcessing||this._queue[0]!==n)&&r.complete()};return this._isProcessing||this._processQueue(),{observable:r.asObservable().pipe(Mz(()=>{this._logger.debug("Intent observable finalized",{data:{type:t.type}})})),cancel:i}}_processQueue(){if(this._isProcessing)return;if(this._queue.length===0){this.sessionEventDispatcher.dispatch({eventName:dr.NEW_STATE});return}this.sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_BUSY}),this._isProcessing=!0;const t=this._queue[0];if(t.isCancelled){this._logger.debug("Skipping cancelled intent",{data:{type:t.intent.type}}),t.subject.complete(),this._queue.shift(),this._isProcessing=!1,this._processQueue();return}this._logger.debug("Processing intent",{data:{type:t.intent.type}}),this._currentSubscription=t.intent.execute().subscribe({next:r=>{t.isCancelled||t.subject.next(r)},error:r=>{t.isCancelled||t.subject.error(r),this._onIntentComplete()},complete:()=>{t.isCancelled||t.subject.complete(),this._onIntentComplete()}})}_onIntentComplete(){this._logger.debug("Intent completed"),this._currentSubscription=null,this._queue.shift(),this._isProcessing=!1,this._processQueue()}},J8=class{constructor(t,r){this._refresher=r,this._logger=t("refresher-service")}_refresherBlockers=new Set;_logger;disableRefresher(t){const r=`${t}-${Jp()}`;this.addRefresherBlocker(r),this._logger.debug("Refresher disabled",{data:{blockerId:r,blockers:Array.from(this._refresherBlockers)}});let n=!1;return()=>{n||(n=!0,this.removeRefresherBlocker(r),this._logger.debug("Refresher re-enabled",{data:{blockerId:r,blockers:Array.from(this._refresherBlockers)}}))}}addRefresherBlocker(t){const r=this._refresherBlockers.size;this._refresherBlockers.add(t),r===0&&this._refresher.stop()}removeRefresherBlocker(t){const r=this._refresherBlockers.size;this._refresherBlockers.delete(t),r>0&&this._refresherBlockers.size===0&&this._refresher.start()}},Q8=class{constructor(t,r,n,i){this.connectedDevice=r,this._sessionEventDispatcher=n,this._sendCommandFunction=i,this._logger=t("device-pinger"),this._subscription=this._sessionEventDispatcher.listen().subscribe(async o=>await this.mapEventAction(o))}_sendCommandFunction;_subscription;_logger;async ping(){try{return await this.mapDevicePingAction(this.connectedDevice.deviceModel.id)}catch(t){return this._logger.error("Error while pinging device",{data:{error:t}}),null}}mapEventAction=async t=>{switch(t.eventName){case dr.REFRESH_NEEDED:return await this.ping();default:return null}};async mapDevicePingAction(t){switch(t){case Zt.NANO_S:{const r=async()=>{const o=await this._sendCommandFunction(new YC,Cm);return this._sendCommandFunction(new zj,Cm),o},n=new Promise(o=>{setTimeout(()=>o(null),tb*2+100)}),i=await Promise.race([r(),n]);return i?this._sessionEventDispatcher.dispatch({eventName:dr.COMMAND_SUCCEEDED,eventData:i}):this._sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_LOCKED}),i}default:{const r=await this._sendCommandFunction(new YC,Cm);return this._sessionEventDispatcher.dispatch({eventName:dr.COMMAND_SUCCEEDED,eventData:r}),r}}}unsubscribe(){this._subscription.unsubscribe()}},Z8=class{constructor(t,r,n,i){this._sessionEventDispatcher=n,this._refresherOptions=r,this._logger=t("device-session-refresher"),this._connectedDeviceID=i.deviceModel.id}_refresherSubscription;_refresherOptions;_logger;_connectedDeviceID;startRefresher(){if(this._refresherOptions.isRefresherDisabled||this._refresherSubscription)return;const t=this.getValidPollingInterval(this._refresherOptions,this._logger)*2,r=this._sessionEventDispatcher.listen().pipe(JR(n=>n.eventName===dr.DEVICE_STATE_UPDATE_BUSY||n.eventName===dr.NEW_STATE),Fa(n=>n.eventName===dr.DEVICE_STATE_UPDATE_BUSY),Lz(!1),Pz());this._refresherSubscription=Az(0,t).pipe(Fz(r),QR(([n,i])=>{i&&this._logger.debug("Refresh skipped: device is busy")}),JR(([n,i])=>!i),QR(()=>this._sessionEventDispatcher.dispatch({eventName:dr.REFRESH_NEEDED}))).subscribe(),this._logger.info("Refresher started.")}stopRefresher(){this._refresherSubscription&&(this._refresherSubscription.unsubscribe(),this._refresherSubscription=void 0,this._logger.info("Refresher stopped."))}restartRefresher(){this.stopRefresher(),this.startRefresher(),this._logger.info("Refresher restarted.")}getValidPollingInterval=(t,r)=>{const{pollingInterval:n}=t;switch(this._connectedDeviceID){case Zt.NANO_S:{const i=tb*2;return n!==void 0&&n<i?(r.warn(`Polling interval of ${n} is too low, setting to minimum as ${i}`),i):n??i}default:return n!==void 0&&n<_m?(r.warn(`Polling interval of ${n} is too low, setting to minimum as ${_m}`),_m):n??tb}}},eB=class{constructor(t,r,n,i,o){this._sessionEventDispatcher=r,this._connectedDevice=n,this._deviceState=i,this.setDeviceSessionState=o,this._subscription=this._sessionEventDispatcher.listen().subscribe(s=>this.mapEventAction(s)),this._logger=t("device-session-state-handler")}_subscription;_logger;_pendingDeviceStatus=bo.BUSY;_updateDeviceState(t){const r=this._parseDeviceStatus(t);if(r){const{sessionStateType:n,deviceStatus:i,currentApp:o}=r,s=this._deviceState.getValue();s.sessionStateType===pc.Connected?this.setDeviceSessionState({sessionStateType:n,deviceStatus:i,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:o,installedApps:[],isSecureConnectionAllowed:!1}):this.setDeviceSessionState({...s,sessionStateType:n,deviceStatus:i,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:o})}}mapEventAction=t=>{const{eventName:r}=t;switch(r){case dr.COMMAND_SUCCEEDED:return this._updateDeviceState(t.eventData);case dr.DEVICE_STATE_UPDATE_BUSY:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:bo.BUSY});case dr.DEVICE_STATE_UPDATE_LOCKED:this._pendingDeviceStatus=bo.LOCKED;return;case dr.DEVICE_STATE_UPDATE_CONNECTED:this._pendingDeviceStatus=bo.CONNECTED;return;case dr.NEW_STATE:{const n=this._pendingDeviceStatus;return this._pendingDeviceStatus=bo.BUSY,this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:n})}case dr.DEVICE_STATE_UPDATE_UNKNOWN:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:bo.BUSY});case dr.REFRESH_NEEDED:return;default:{const n=r;throw new Error(`Unhandled context type ${n}`)}}};_parseDeviceStatus(t){return sj(t)?{sessionStateType:pc.ReadyWithoutSecureChannel,deviceStatus:bo.CONNECTED,currentApp:{name:t.data.name,version:t.data.version}}:(this._logger.debug("Error while parsing APDU response",{data:{parsedResponse:t}}),null)}unsubscribe(){this._subscription.unsubscribe()}},tB=class{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_loggerModuleFactory;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_intentQueueService;_sessionEventDispatcher=new K8;_bypassIntentQueue=!1;constructor({connectedDevice:t,id:r=Jp()},n,i,o,s,u=c=>new Y8(n,c)){this._id=r,this._connectedDevice=t,this._loggerModuleFactory=n,this._logger=n("device-session"),this._managerApiService=i,this._intentQueueService=u(this._sessionEventDispatcher),this._secureChannelService=o,this._refresherOptions={...X8,...s},this._deviceState=new nz({sessionStateType:pc.Connected,deviceStatus:bo.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new Q8(n,t,this._sessionEventDispatcher,(c,f)=>this.sendCommand(c,f)),this._deviceSessionRefresher=new Z8(n,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new eB(n,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,c=>this.setDeviceSessionState(c)),this._refresherService=new J8(n,{start:()=>this._deviceSessionRefresher.restartRefresher(),stop:()=>this._deviceSessionRefresher.stopRefresher()})}async initialiseSession(){try{this._refresherOptions.isRefresherDisabled?await this._pinger.ping():this._deviceSessionRefresher.startRefresher()}catch(t){throw this._logger.error("Error while initialising session",{data:{error:t}}),t}}get id(){return this._id}get connectedDevice(){return this._connectedDevice}get state(){return this._deviceState.asObservable()}getDeviceSessionState(){return this._deviceState.getValue()}setDeviceSessionState(t){this._deviceState.next(t)}sendApdu(t,r={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){return this._bypassIntentQueue?this._unsafeInternalSendApdu(t,r):this._internalSendApdu(t,r)}_internalSendApdu(t,r){const n=r.abortTimeout,i=Date.now(),{observable:o,cancel:s}=this._intentQueueService.enqueue({type:"send-apdu",execute:()=>Pl((async()=>{const c=Date.now()-i;return await this._unsafeInternalSendApdu(t,{isPolling:r.isPolling,triggersDisconnection:r.triggersDisconnection,abortTimeout:n?n-c:void 0})})())}),u=n?o.pipe(KR({each:n,with:()=>{throw s(),new Nz}})):o;return XR(u)}async _unsafeInternalSendApdu(t,r={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){return this._logger.debug(q8(t)),(await this._connectedDevice.sendApdu(t,r.triggersDisconnection,r.abortTimeout)).ifRight(n=>{this._logger.debug(G8(n)),$1.isLockedDeviceResponse(n)?this._sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_UNKNOWN})})}sendCommand(t,r){return this._logger.debug(`[sendCommand] ${t.name}`),this._bypassIntentQueue?this._unsafeInternalSendCommand(t,r):this._internalSendCommand(t,r)}_internalSendCommand(t,r){const n=Date.now(),{observable:i,cancel:o}=this._intentQueueService.enqueue({type:"send-command",execute:()=>Pl((async()=>{const u=Date.now()-n;return await this._unsafeInternalSendCommand(t,r?r-u:void 0)})())}),s=r?i.pipe(KR({each:r,with:()=>{throw o(),new jz}})):i;return XR(s)}async _unsafeInternalSendCommand(t,r){const n=t.getApdu();return(await this._unsafeInternalSendApdu(n.getRawApdu(),{isPolling:!1,triggersDisconnection:t.triggersDisconnection??!1,abortTimeout:r})).caseOf({Left:i=>{throw this._logger.error("[sendCommand] error",{data:{err:i}}),i},Right:i=>{const o=t.parseResponse(i,this._connectedDevice.deviceModel.id);return this._logger.debug("[sendCommand] result",{data:{result:o}}),o}})}executeDeviceAction(t){return this._bypassIntentQueue?this._unsafeInternalExecuteDeviceAction(t):this._internalExecuteDeviceAction(t)}_internalExecuteDeviceAction(t){let r;const{observable:n,cancel:i}=this._intentQueueService.enqueue({type:"device-action",execute:()=>{const{observable:o,cancel:s}=this._unsafeInternalExecuteDeviceAction(t);return r=s,o}});return{observable:n,cancel:()=>{r?.(),i()}}}_unsafeInternalExecuteDeviceAction(t){const{observable:r,cancel:n}=t._execute({sendApdu:async i=>this._unsafeInternalSendApdu(i),sendCommand:async i=>this._unsafeInternalSendCommand(i),getDeviceModel:()=>this._connectedDevice.deviceModel,getDeviceSessionState:()=>this._deviceState.getValue(),getDeviceSessionStateObservable:()=>this.state,setDeviceSessionState:i=>(this.setDeviceSessionState(i),this._deviceState.getValue()),getManagerApiService:()=>this._managerApiService,getSecureChannelService:()=>this._secureChannelService,loggerFactory:this._loggerModuleFactory});return{observable:r,cancel:n}}close(){this._updateDeviceStatus(bo.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher(),this._pinger.unsubscribe()}disableRefresher(t){return this._refresherService.disableRefresher(t)}_unsafeBypassIntentQueue(t){this._bypassIntentQueue=t}_updateDeviceStatus(t){const r=this._deviceState.getValue();this._deviceState.next({...r,deviceStatus:t})}};const X1={SecureChannelService:Symbol.for("SecureChannelService"),SecureChannelDataSource:Symbol.for("SecureChannelDataSource"),DmkConfig:Symbol.for("SecureChannelDmkConfig")};var rB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},$u=(e,t)=>(r,n)=>t(r,n,e);let L_=class{_transportService;_sessionService;_loggerFactory;_managerApi;_secureChannel;_logger;constructor(t,r,n,i,o){this._sessionService=r,this._transportService=t,this._loggerFactory=n,this._logger=n("ConnectUseCase"),this._managerApi=i,this._secureChannel=o}handleDeviceDisconnect(t){this._sessionService.getDeviceSessionsByDeviceId(t).ifRight(r=>{r.forEach(n=>{this._sessionService.removeDeviceSession(n.id),this._logger.info("Session removed",{data:{deviceId:t,sessionId:n.id}})})})}async execute({device:t,sessionRefresherOptions:r}){const n=this._transportService.getTransport(t.transport),i="sessionId"in t?t.sessionId:void 0;return mt.liftEither(n.toEither(new q1(new Error("Unknown transport")))).chain(async o=>o.connect({deviceId:t.id,onDisconnect:s=>this.handleDeviceDisconnect(s)})).ifLeft(o=>{this._logger.error("Error connecting to device")}).map(async o=>{const s=new tB({connectedDevice:o,id:i},this._loggerFactory,this._managerApi,this._secureChannel,r);return this._sessionService.addDeviceSession(s),await s.initialiseSession(),s.id}).caseOf({Left:o=>{throw o},Right:o=>o})}};L_=rB([Rt(),$u(0,rt(ja.TransportService)),$u(1,rt(gn.DeviceSessionService)),$u(2,rt(_r.LoggerPublisherServiceFactory)),$u(3,rt(Qp.ManagerApiService)),$u(4,rt(X1.SecureChannelService))],L_);var nB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},Om=(e,t)=>(r,n)=>t(r,n,e);let F_=class{_transportService;_sessionService;_logger;constructor(t,r,n){this._sessionService=r,this._transportService=t,this._logger=n("DisconnectUseCase")}async execute({sessionId:t}){return this._logger.debug("Disconnecting from device",{data:{test:this._sessionService.getDeviceSessions().map(r=>r.id)}}),mt(async({liftEither:r})=>{const n=await r(this._sessionService.getDeviceSessionById(t).ifLeft(s=>{this._logger.error("Device session not found",{data:{sessionId:t,error:s}})})),i=n.connectedDevice.transport,o=await r(this._transportService.getTransport(i).toEither(new q1(new Error("Unknown transport"))));n.close(),this._sessionService.removeDeviceSession(t),await o.disconnect({connectedDevice:n.connectedDevice})}).caseOf({Left:r=>{throw this._logger.error("Error disconnecting from device",{data:{error:r}}),r},Right:()=>{}})}};F_=nB([Rt(),Om(0,rt(ja.TransportService)),Om(1,rt(gn.DeviceSessionService)),Om(2,rt(_r.LoggerPublisherServiceFactory))],F_);let K1=class{id;sessionId;modelId;name;type;transport;constructor({transportConnectedDevice:{id:t,deviceModel:{id:r,productName:n},type:i,transport:o,name:s},sessionId:u}){this.id=t,this.sessionId=u,this.modelId=r,this.name=s??n,this.type=i,this.transport=o}};var iB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},N_=(e,t)=>(r,n)=>t(r,n,e);let j_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("GetConnectedDeviceUseCase")}execute({sessionId:t}){return this._sessionService.getDeviceSessionById(t).caseOf({Right:r=>new K1({sessionId:r.id,transportConnectedDevice:r.connectedDevice}),Left:r=>{throw this._logger.error("Error getting session",{data:{error:r}}),r}})}};j_=iB([Rt(),N_(0,rt(gn.DeviceSessionService)),N_(1,rt(_r.LoggerPublisherServiceFactory))],j_);var oB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},z_=(e,t)=>(r,n)=>t(r,n,e);let B_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("ListConnectedDeviceUseCase")}execute(){return this._logger.info("Listing connected devices"),this._sessionService.getDeviceSessions().map(t=>new K1({transportConnectedDevice:t.connectedDevice,sessionId:t.id}))}};B_=oB([Rt(),z_(0,rt(gn.DeviceSessionService)),z_(1,rt(_r.LoggerPublisherServiceFactory))],B_);var aB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},V_=(e,t)=>(r,n)=>t(r,n,e);let U_=class{_transports;_transportService;_logger;constructor(t,r){this._transports=t.getAllTransports(),this._transportService=t,this._logger=r("ListenToAvailableDevicesUseCase")}mapTransportDiscoveredDeviceToDiscoveredDevice(t){const r=new t2({id:t.id,model:t.deviceModel.id,name:t.deviceModel.productName});return{id:t.id,deviceModel:r,transport:t.transport,name:t.name||r.name,rssi:t.rssi}}execute({transport:t}={}){if(this._logger.info("Listening to available devices"),this._transports.length===0)return this._logger.warn("No transports available"),Pl([[]]);if(!t){this._logger.info("Discovering all available transports");const r=this._transports.map((n,i)=>n.listenToAvailableDevices().pipe(Fa(o=>({index:i,arr:o}))));return $z(...r).pipe(Dz((n,{index:i,arr:o})=>(n[i]=o,n),{}),Fa(n=>Object.values(n).flat().map(this.mapTransportDiscoveredDeviceToDiscoveredDevice)))}return this._logger.info(`Discovering devices on transport ${t}`),this._transportService.getTransport(t).caseOf({Nothing:()=>(this._logger.error(`Transport ${t} not found`),T2([])),Just:r=>r.listenToAvailableDevices().pipe(Fa(n=>n.map(this.mapTransportDiscoveredDeviceToDiscoveredDevice)))})}};U_=aB([Rt(),V_(0,rt(ja.TransportService)),V_(1,rt(_r.LoggerPublisherServiceFactory))],U_);var sB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},H_=(e,t)=>(r,n)=>t(r,n,e);let W_=class{constructor(t,r){this._sessionService=t,this._logger=r("ListenToConnectedDeviceUseCase")}_logger;execute(){return this._logger.info("Observe connected devices"),this._sessionService.sessionsObs.pipe(Fa(t=>new K1({transportConnectedDevice:t.connectedDevice,sessionId:t.id})))}};W_=sB([Rt(),H_(0,rt(gn.DeviceSessionService)),H_(1,rt(_r.LoggerPublisherServiceFactory))],W_);var lB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},Tm=(e,t)=>(r,n)=>t(r,n,e);let q_=class{constructor(t,r,n){this.connectUseCase=t,this.disconnectUseCase=r,this._logger=n("ReconnectUseCase")}_logger;async execute({device:t,sessionRefresherOptions:r}){return this._logger.debug("Reconnecting device session",{data:{deviceId:t.id,transport:t.transport}}),await this.disconnectUseCase.execute({sessionId:t.sessionId}),this.connectUseCase.execute({device:t,sessionRefresherOptions:r})}};q_=lB([Rt(),Tm(0,rt(p_.ConnectUseCase)),Tm(1,rt(p_.DisconnectUseCase)),Tm(2,rt(_r.LoggerPublisherServiceFactory))],q_);var uB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},cB=(e,t)=>(r,n)=>t(r,n,e);let G_=class{constructor(t){this._transportService=t}mapDiscoveredDevice(t){const r=new t2({id:t.id,model:t.deviceModel.id,name:t.deviceModel.productName});return{id:t.id,deviceModel:r,transport:t.transport,name:t.name||r.name,rssi:t.rssi}}execute({transport:t}={}){if(!t){const r=this._transportService.getAllTransports();return T2(...r).pipe(W1(n=>n.startDiscovering().pipe(Fa(i=>this.mapDiscoveredDevice(i)))))}return this._transportService.getTransport(t).caseOf({Just:r=>r.startDiscovering().pipe(Fa(n=>this.mapDiscoveredDevice(n))),Nothing:()=>{throw new q1(new Error("Unknown transport"))}})}};G_=uB([Rt(),cB(0,rt(ja.TransportService))],G_);var fB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},X_=(e,t)=>(r,n)=>t(r,n,e);let K_=class{constructor(t,r){this.transportService=t,this._logger=r("StopDiscoveringUseCase")}_logger;async execute(){this._logger.debug("Stopping discovering devices");for(const t of this.transportService.getAllTransports())await t.stopDiscovering()}};K_=fB([Rt(),X_(0,rt(ja.TransportService)),X_(1,rt(_r.LoggerPublisherServiceFactory))],K_);var zu=(e=>(e[e.Fatal=0]="Fatal",e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e))(zu||{});let dB=class{format(t){return Array.isArray(t)?t.map(r=>`[${r}]`).join(" "):`[${t}]`}};function rb(e,t){if(typeof e=="bigint")return e.toString();if(Array.isArray(e))return t.has(e)?"[Circular]":(t.add(e),e.map(r=>rb(r,t)));if(e!==null&&typeof e=="object"){if(t.has(e))return"[Circular]";t.add(e);const r={};for(const[n,i]of Object.entries(e))r[n]=rb(i,t);return r}return e}function pB(e){const t=new WeakSet;t.add(e);const r={};for(const[n,i]of Object.entries(e))r[n]=rb(i,t);return r}var hB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let Y_=class{subscribers;tag;tagFormatter;constructor(t,r,n=new dB){this.subscribers=t,this.tag=r,this.tagFormatter=n}_log(t,r,n){const i=n?.data?pB(n.data):void 0,o=n?.tag??this.tag,s=this.tagFormatter.format(o);this.subscribers.forEach(u=>{const c={timestamp:n?.timestamp??Date.now(),tag:s,data:i};u.log(t,r,c)})}info(t,r){this._log(zu.Info,t,r)}warn(t,r){this._log(zu.Warning,t,r)}debug(t,r){this._log(zu.Debug,t,r)}error(t,r){this._log(zu.Error,t,r)}};Y_=hB([Rt()],Y_);function D2(e,t){return function(){return e.apply(t,arguments)}}const{toString:gB}=Object.prototype,{getPrototypeOf:Y1}=Object,{iterator:Zp,toStringTag:L2}=Symbol,eh=(e=>t=>{const r=gB.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),so=e=>(e=e.toLowerCase(),t=>eh(t)===e),th=e=>t=>typeof t===e,{isArray:Xl}=Array,kl=th("undefined");function Fc(e){return e!==null&&!kl(e)&&e.constructor!==null&&!kl(e.constructor)&&An(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const F2=so("ArrayBuffer");function vB(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&F2(e.buffer),t}const mB=th("string"),An=th("function"),N2=th("number"),Nc=e=>e!==null&&typeof e=="object",yB=e=>e===!0||e===!1,ep=e=>{if(eh(e)!=="object")return!1;const t=Y1(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(L2 in e)&&!(Zp in e)},bB=e=>{if(!Nc(e)||Fc(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},SB=so("Date"),wB=so("File"),xB=so("Blob"),EB=so("FileList"),CB=e=>Nc(e)&&An(e.pipe),RB=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||An(e.append)&&((t=eh(e))==="formdata"||t==="object"&&An(e.toString)&&e.toString()==="[object FormData]"))},_B=so("URLSearchParams"),[OB,TB,AB,$B]=["ReadableStream","Request","Response","Headers"].map(so),IB=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jc(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Xl(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(Fc(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let u;for(n=0;n<s;n++)u=o[n],t.call(null,e[u],u,e)}}function j2(e,t){if(Fc(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const fs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:self,z2=e=>!kl(e)&&e!==fs;function nb(){const{caseless:e,skipUndefined:t}=z2(this)&&this||{},r={},n=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const s=e&&j2(r,o)||o;ep(r[s])&&ep(i)?r[s]=nb(r[s],i):ep(i)?r[s]=nb({},i):Xl(i)?r[s]=i.slice():(!t||!kl(i))&&(r[s]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&jc(arguments[i],n);return r}const PB=(e,t,r,{allOwnKeys:n}={})=>(jc(t,(i,o)=>{r&&An(i)?Object.defineProperty(e,o,{value:D2(i,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),kB=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),MB=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},DB=(e,t,r,n)=>{let i,o,s;const u={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!u[s]&&(t[s]=e[s],u[s]=!0);e=r!==!1&&Y1(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},LB=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},FB=e=>{if(!e)return null;if(Xl(e))return e;let t=e.length;if(!N2(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},NB=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Y1(Uint8Array)),jB=(e,t)=>{const n=(e&&e[Zp]).call(e);let i;for(;(i=n.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},zB=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},BB=so("HTMLFormElement"),VB=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),J_=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),UB=so("RegExp"),B2=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};jc(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},HB=e=>{B2(e,(t,r)=>{if(An(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(An(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},WB=(e,t)=>{const r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Xl(e)?n(e):n(String(e).split(t)),r},qB=()=>{},GB=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function XB(e){return!!(e&&An(e.append)&&e[L2]==="FormData"&&e[Zp])}const KB=e=>{const t=new Array(10),r=(n,i)=>{if(Nc(n)){if(t.indexOf(n)>=0)return;if(Fc(n))return n;if(!("toJSON"in n)){t[i]=n;const o=Xl(n)?[]:{};return jc(n,(s,u)=>{const c=r(s,i+1);!kl(c)&&(o[u]=c)}),t[i]=void 0,o}}return n};return r(e,0)},YB=so("AsyncFunction"),JB=e=>e&&(Nc(e)||An(e))&&An(e.then)&&An(e.catch),V2=((e,t)=>e?setImmediate:t?((r,n)=>(fs.addEventListener("message",({source:i,data:o})=>{i===fs&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),fs.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",An(fs.postMessage)),QB=typeof queueMicrotask<"u"?queueMicrotask.bind(fs):typeof process<"u"&&process.nextTick||V2,ZB=e=>e!=null&&An(e[Zp]),ye={isArray:Xl,isArrayBuffer:F2,isBuffer:Fc,isFormData:RB,isArrayBufferView:vB,isString:mB,isNumber:N2,isBoolean:yB,isObject:Nc,isPlainObject:ep,isEmptyObject:bB,isReadableStream:OB,isRequest:TB,isResponse:AB,isHeaders:$B,isUndefined:kl,isDate:SB,isFile:wB,isBlob:xB,isRegExp:UB,isFunction:An,isStream:CB,isURLSearchParams:_B,isTypedArray:NB,isFileList:EB,forEach:jc,merge:nb,extend:PB,trim:IB,stripBOM:kB,inherits:MB,toFlatObject:DB,kindOf:eh,kindOfTest:so,endsWith:LB,toArray:FB,forEachEntry:jB,matchAll:zB,isHTMLForm:BB,hasOwnProperty:J_,hasOwnProp:J_,reduceDescriptors:B2,freezeMethods:HB,toObjectSet:WB,toCamelCase:VB,noop:qB,toFiniteNumber:GB,findKey:j2,global:fs,isContextDefined:z2,isSpecCompliantForm:XB,toJSONObject:KB,isAsyncFn:YB,isThenable:JB,setImmediate:V2,asap:QB,isIterable:ZB};let ut=class U2 extends Error{static from(t,r,n,i,o,s){const u=new U2(t.message,r||t.code,n,i,o);return u.cause=t,u.name=t.name,s&&Object.assign(u,s),u}constructor(t,r,n,i,o){super(t),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status)}toJSON(){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:ye.toJSONObject(this.config),code:this.code,status:this.status}}};ut.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";ut.ERR_BAD_OPTION="ERR_BAD_OPTION";ut.ECONNABORTED="ECONNABORTED";ut.ETIMEDOUT="ETIMEDOUT";ut.ERR_NETWORK="ERR_NETWORK";ut.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";ut.ERR_DEPRECATED="ERR_DEPRECATED";ut.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";ut.ERR_BAD_REQUEST="ERR_BAD_REQUEST";ut.ERR_CANCELED="ERR_CANCELED";ut.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";ut.ERR_INVALID_URL="ERR_INVALID_URL";const eV=null;function ib(e){return ye.isPlainObject(e)||ye.isArray(e)}function H2(e){return ye.endsWith(e,"[]")?e.slice(0,-2):e}function Q_(e,t,r){return e?e.concat(t).map(function(i,o){return i=H2(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function tV(e){return ye.isArray(e)&&!e.some(ib)}const rV=ye.toFlatObject(ye,{},null,function(t){return/^is[A-Z]/.test(t)});function rh(e,t,r){if(!ye.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=ye.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,y){return!ye.isUndefined(y[S])});const n=r.metaTokens,i=r.visitor||d,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&ye.isSpecCompliantForm(t);if(!ye.isFunction(i))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(ye.isDate(v))return v.toISOString();if(ye.isBoolean(v))return v.toString();if(!c&&ye.isBlob(v))throw new ut("Blob is not supported. Use a Buffer instead.");return ye.isArrayBuffer(v)||ye.isTypedArray(v)?c&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function d(v,S,y){let E=v;if(v&&!y&&typeof v=="object"){if(ye.endsWith(S,"{}"))S=n?S:S.slice(0,-2),v=JSON.stringify(v);else if(ye.isArray(v)&&tV(v)||(ye.isFileList(v)||ye.endsWith(S,"[]"))&&(E=ye.toArray(v)))return S=H2(S),E.forEach(function(T,A){!(ye.isUndefined(T)||T===null)&&t.append(s===!0?Q_([S],A,o):s===null?S:S+"[]",f(T))}),!1}return ib(v)?!0:(t.append(Q_(y,S,o),f(v)),!1)}const g=[],h=Object.assign(rV,{defaultVisitor:d,convertValue:f,isVisitable:ib});function b(v,S){if(!ye.isUndefined(v)){if(g.indexOf(v)!==-1)throw Error("Circular reference detected in "+S.join("."));g.push(v),ye.forEach(v,function(E,x){(!(ye.isUndefined(E)||E===null)&&i.call(t,E,ye.isString(x)?x.trim():x,S,h))===!0&&b(E,S?S.concat(x):[x])}),g.pop()}}if(!ye.isObject(e))throw new TypeError("data must be an object");return b(e),t}function Z_(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function J1(e,t){this._pairs=[],e&&rh(e,this,t)}const W2=J1.prototype;W2.append=function(t,r){this._pairs.push([t,r])};W2.toString=function(t){const r=t?function(n){return t.call(this,n,Z_)}:Z_;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function nV(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function q2(e,t,r){if(!t)return e;const n=r&&r.encode||nV,i=ye.isFunction(r)?{serialize:r}:r,o=i&&i.serialize;let s;if(o?s=o(t,i):s=ye.isURLSearchParams(t)?t.toString():new J1(t,i).toString(n),s){const u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class eO{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ye.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Q1={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},iV=typeof URLSearchParams<"u"?URLSearchParams:J1,oV=typeof FormData<"u"?FormData:null,aV=typeof Blob<"u"?Blob:null,sV={isBrowser:!0,classes:{URLSearchParams:iV,FormData:oV,Blob:aV},protocols:["http","https","file","blob","url","data"]},Z1=typeof window<"u"&&typeof document<"u",ob=typeof navigator=="object"&&navigator||void 0,lV=Z1&&(!ob||["ReactNative","NativeScript","NS"].indexOf(ob.product)<0),uV=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",cV=Z1&&window.location.href||"http://localhost",fV=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Z1,hasStandardBrowserEnv:lV,hasStandardBrowserWebWorkerEnv:uV,navigator:ob,origin:cV},Symbol.toStringTag,{value:"Module"})),en={...fV,...sV};function dV(e,t){return rh(e,new en.classes.URLSearchParams,{visitor:function(r,n,i,o){return en.isNode&&ye.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function pV(e){return ye.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function hV(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function G2(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;const u=Number.isFinite(+s),c=o>=r.length;return s=!s&&ye.isArray(i)?i.length:s,c?(ye.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!u):((!i[s]||!ye.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&ye.isArray(i[s])&&(i[s]=hV(i[s])),!u)}if(ye.isFormData(e)&&ye.isFunction(e.entries)){const r={};return ye.forEachEntry(e,(n,i)=>{t(pV(n),i,r,0)}),r}return null}function gV(e,t,r){if(ye.isString(e))try{return(t||JSON.parse)(e),ye.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const zc={transitional:Q1,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=ye.isObject(t);if(o&&ye.isHTMLForm(t)&&(t=new FormData(t)),ye.isFormData(t))return i?JSON.stringify(G2(t)):t;if(ye.isArrayBuffer(t)||ye.isBuffer(t)||ye.isStream(t)||ye.isFile(t)||ye.isBlob(t)||ye.isReadableStream(t))return t;if(ye.isArrayBufferView(t))return t.buffer;if(ye.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let u;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return dV(t,this.formSerializer).toString();if((u=ye.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return rh(u?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),gV(t)):t}],transformResponse:[function(t){const r=this.transitional||zc.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(ye.isResponse(t)||ye.isReadableStream(t))return t;if(t&&ye.isString(t)&&(n&&!this.responseType||i)){const s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(u){if(s)throw u.name==="SyntaxError"?ut.from(u,ut.ERR_BAD_RESPONSE,this,null,this.response):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:en.classes.FormData,Blob:en.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ye.forEach(["delete","get","head","post","put","patch"],e=>{zc.headers[e]={}});const vV=ye.toObjectSet(["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"]),mV=e=>{const t={};let r,n,i;return e&&e.split(`
|
|
525
|
+
Found @inject decorator at method "${f.toString()}" at class "${c.constructor.name}"`);Yu(c.constructor,Qd,Zd,r_(u(c),f))}})(e,t)(r,n,i)}catch(o){r8(r,n,i,o)}}}function xm(e,t){return r=>{const n=t(r);return i=>(n(i),e(i))}}function rt(e){return n8(t8(hc.singleInjection,e),Qz)}(function(e){e[e.method=0]="method",e[e.parameter=1]="parameter",e[e.property=2]="property"})(Aa||(Aa={}));const n_="@inversifyjs/core/classIsInjectableFlagReflectKey",i8=[Array,BigInt,Boolean,Function,Number,Object,String];function o8(e){const t=G1(e,"design:paramtypes");t!==void 0&&Yu(e,Qd,Zd,(function(r){return n=>(r.forEach(((i,o)=>{var s;n.constructorArguments[o]!==void 0||(s=i,i8.includes(s))||(n.constructorArguments[o]=(function(u){return{isFromTypescriptParamType:!0,kind:hc.singleInjection,name:void 0,optional:!1,tags:new Map,value:u}})(i))})),n)})(t))}function Rt(e){return t=>{(function(r){if(G1(r,n_)!==void 0)throw new Na(Ro.injectionDecoratorConflict,`Cannot apply @injectable decorator multiple times at class "${r.name}"`);Kz(r,n_,!0)})(t),o8(t)}}var i_;(function(e){e[e.multipleInjection=0]="multipleInjection",e[e.singleInjection=1]="singleInjection"})(i_||(i_={}));var o_;(function(e){e[e.singleMandatory=0]="singleMandatory",e[e.singleOptional=1]="singleOptional",e[e.multipleMandatory=2]="multipleMandatory",e[e.multipleOptional=3]="multipleOptional",e[e.length=4]="length"})(o_||(o_={}));let a8=class{constructor(t,r,n,i,o){this.deviceModel=t,this.serviceUuid=r,this.writeUuid=n,this.writeCmdUuid=i,this.notifyUuid=o}},tl=class{id;productName;usbProductId;bootloaderUsbProductId;usbOnly;memorySize;getBlockSize;masks;bluetoothSpec;constructor(t){this.id=t.id,this.productName=t.productName,this.usbProductId=t.usbProductId,this.bootloaderUsbProductId=t.bootloaderUsbProductId,this.usbOnly=t.usbOnly,this.memorySize=t.memorySize,this.getBlockSize=t.getBlockSize,this.masks=t.masks,this.bluetoothSpec=t.bluetoothSpec}};var s8=Object.defineProperty,l8=(e,t,r)=>t in e?s8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},c8=(e,t,r)=>l8(e,t+"",r);let cs=class{getAllDeviceModels(){return Object.values(cs.deviceModelByIds)}getDeviceModel(t){return cs.deviceModelByIds[t.id]}filterDeviceModels(t){return this.getAllDeviceModels().filter(r=>Object.entries(t).every(([n,i])=>r[n]===i))}getBluetoothServicesInfos(){return Object.values(cs.deviceModelByIds).reduce((t,r)=>{const{bluetoothSpec:n}=r;return n?{...t,...n.reduce((i,o)=>({...i,[o.serviceUuid]:new a8(r,o.serviceUuid,o.writeUuid,o.writeCmdUuid,o.notifyUuid)}),{})}:t},{})}getBluetoothServices(){return Object.values(cs.deviceModelByIds).map(t=>(t.bluetoothSpec||[]).map(r=>r.serviceUuid)).flat().filter(t=>!!t)}};c8(cs,"deviceModelByIds",{[Zt.NANO_S]:new tl({id:Zt.NANO_S,productName:"Ledger Nano S",usbProductId:16,bootloaderUsbProductId:1,usbOnly:!0,memorySize:320*1024,getBlockSize:e=>VR.lt(VR.coerce(e.firmwareVersion)??"","2.0.0")?4*1024:2*1024,masks:[823132160]}),[Zt.NANO_SP]:new tl({id:Zt.NANO_SP,productName:"Ledger Nano S Plus",usbProductId:80,bootloaderUsbProductId:5,usbOnly:!0,memorySize:1533*1024,getBlockSize:()=>32,masks:[856686592]}),[Zt.NANO_X]:new tl({id:Zt.NANO_X,productName:"Ledger Nano X",usbProductId:64,bootloaderUsbProductId:4,usbOnly:!1,memorySize:2*1024*1024,getBlockSize:()=>4*1024,masks:[855638016],bluetoothSpec:[{serviceUuid:"13d63400-2c97-0004-0000-4c6564676572",notifyUuid:"13d63400-2c97-0004-0001-4c6564676572",writeUuid:"13d63400-2c97-0004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-0004-0003-4c6564676572"}]}),[Zt.STAX]:new tl({id:Zt.STAX,productName:"Ledger Stax",usbProductId:96,bootloaderUsbProductId:6,usbOnly:!1,memorySize:1533*1024,getBlockSize:()=>32,masks:[857735168],bluetoothSpec:[{serviceUuid:"13d63400-2c97-6004-0000-4c6564676572",notifyUuid:"13d63400-2c97-6004-0001-4c6564676572",writeUuid:"13d63400-2c97-6004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-6004-0003-4c6564676572"}]}),[Zt.FLEX]:new tl({id:Zt.FLEX,productName:"Ledger Flex",usbProductId:112,bootloaderUsbProductId:7,usbOnly:!1,memorySize:1533*1024,getBlockSize:()=>32,masks:[858783744],bluetoothSpec:[{serviceUuid:"13d63400-2c97-3004-0000-4c6564676572",notifyUuid:"13d63400-2c97-3004-0001-4c6564676572",writeUuid:"13d63400-2c97-3004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-3004-0003-4c6564676572"}]}),[Zt.APEX]:new tl({id:Zt.APEX,productName:"Ledger Nano Gen5",usbProductId:128,bootloaderUsbProductId:8,usbOnly:!1,memorySize:1533*1024,getBlockSize:()=>32,masks:[859832320],bluetoothSpec:[{serviceUuid:"13d63400-2c97-8004-0000-4c6564676572",notifyUuid:"13d63400-2c97-8004-0001-4c6564676572",writeUuid:"13d63400-2c97-8004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-8004-0003-4c6564676572"},{serviceUuid:"13d63400-2c97-9004-0000-4c6564676572",notifyUuid:"13d63400-2c97-9004-0001-4c6564676572",writeUuid:"13d63400-2c97-9004-0002-4c6564676572",writeCmdUuid:"13d63400-2c97-9004-0003-4c6564676572"}]})}),cs=u8([Rt()],cs);let f8=class{statusCode;data;constructor({statusCode:t,data:r}){this.statusCode=t,this.data=r}};const d8=5,as=1,Qy=2,bl=2,Zy=2,zr=[];for(let e=0;e<256;++e)zr.push((e+256).toString(16).slice(1));function p8(e,t=0){return(zr[e[t+0]]+zr[e[t+1]]+zr[e[t+2]]+zr[e[t+3]]+"-"+zr[e[t+4]]+zr[e[t+5]]+"-"+zr[e[t+6]]+zr[e[t+7]]+"-"+zr[e[t+8]]+zr[e[t+9]]+"-"+zr[e[t+10]]+zr[e[t+11]]+zr[e[t+12]]+zr[e[t+13]]+zr[e[t+14]]+zr[e[t+15]]).toLowerCase()}let Em;const h8=new Uint8Array(16);function g8(){if(!Em){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Em=crypto.getRandomValues.bind(crypto)}return Em(h8)}const v8=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),a_={randomUUID:v8};function Jp(e,t,r){if(a_.randomUUID&&!e)return a_.randomUUID();e=e||{};const n=e.random||(e.rng||g8)();return n[6]=n[6]&15|64,n[8]=n[8]&63|128,p8(n)}const gs={getLastBytesFrom(e,t){return e.slice(-t)},getFirstBytesFrom(e,t){return e.slice(0,t)},bytesToNumber(e){return e.reduce((t,r,n)=>t+r*Math.pow(256,e.length-1-n),0)},numberToByteArray(e,t){return new Uint8Array(t).map((r,n)=>e>>8*(t-1-n)&255)}},s_=2,Cm=800;let l_=class{_tag="FramerOverflowError";originalError;constructor(){this.originalError=new Error("Frame header length is greater than frame size")}},m8=class{_tag="FramerApduError";originalError;constructor(){this.originalError=new Error("Frame offset is greater than apdu length")}},u_=class{_tag="ReceiverApduError";originalError;constructor(t){this.originalError=new Error(t??"Unable to parse apdu")}},c_=class{_tag="DeviceSessionNotFound";originalError;constructor(t){this.originalError=t??new Error("Device session not found")}},P2=class{_header;_data;constructor({header:t,data:r}){this._header=t,this._data=r}toString(){return JSON.stringify({header:this._header.toString(),data:dc(this._data)},null,2)}getRawData(){const t=this._header.getRawData(),r=new Uint8Array(t.length+this._data.length);return r.set(t,0),r.set(this._data,t.length),r}getHeader(){return this._header}getData(){return this._data}},k2=class{_uuid;_channel;_headTag;_index;_length;_dataLength;constructor({uuid:t,dataSize:r,index:n,headTag:i,length:o,channel:s}){this._uuid=t,this._dataLength=r,this._index=n,this._headTag=i,this._length=o,this._channel=s}getDataLength(){return this._dataLength.map(t=>gs.bytesToNumber(t))}setDataSize(t){return this._dataLength=t,this}getLength(){return this._length}toString(){return JSON.stringify({uuid:this._uuid.toString(),dataSize:this._dataLength.extract()?.toString(),index:this._index.toString(),headTag:this._headTag.toString(),length:this._length.toString(),channel:this._channel.extract()?.toString()})}getRawData(){return new Uint8Array([...this._channel.caseOf({Just:t=>[...t],Nothing:()=>[]}),...this._headTag,...this._index,...this._dataLength.caseOf({Just:t=>[...t],Nothing:()=>[]})])}};const _r={LoggerPublisherServiceFactory:Symbol.for("LoggerPublisherServiceFactory")};var y8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},b8=(e,t)=>(r,n)=>t(r,n,e);let f_=class{_channel;_logger;_pendingFrames;constructor({channel:t=Tn.zero()},r){this._channel=t,this._logger=r("ApduReceiverService"),this._pendingFrames=[]}handleFrame(t){return this.getFrameFromBytes(t).map(r=>{if(this._pendingFrames.push(r),!this._pendingFrames[0])return Yt;const n=this._pendingFrames[0].getHeader().getDataLength();return this.getCompleteFrame(n)})}getCompleteFrame(t){return t.chain(r=>{if(!this.isComplete(r))return this._logger.debug("frame is not complete, waiting for more"),Yt;const n=gs.getFirstBytesFrom(this.concatFrames(this._pendingFrames),r),i=gs.getFirstBytesFrom(n,n.length-s_),o=gs.getLastBytesFrom(n,s_);return this._pendingFrames=[],dn(new f8({data:i,statusCode:o}))})}getFrameFromBytes(t){const r=this._channel.caseOf({Just:()=>Qy,Nothing:()=>0}),n=t.slice(r,r+as),i=t.slice(r+as,r+as+bl),o=i.reduce((h,b)=>h+b,0)===0;if(!o&&this._pendingFrames.length===0)return tn(new u_);const s=r+as+bl,u=o?Zy:0;if(t.length<r+as+bl+u)return tn(new u_("Unable to parse header from apdu"));const c=o?dn(t.slice(s,s+u)):Yt,f=s+u,d=t.slice(f),g=new P2({header:new k2({uuid:Jp(),channel:this._channel,dataSize:c,headTag:n,index:i,length:r+as+bl+u}),data:d});return rn(g)}isComplete(t){return this._pendingFrames.reduce((r,n)=>r+n.getData().length,0)>=t}concatFrames(t){return t.reduce((r,n)=>Uint8Array.from([...r,...n.getData()]),new Uint8Array(0))}};f_=y8([Rt(),b8(1,rt(_r.LoggerPublisherServiceFactory))],f_);var S8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},w8=(e,t)=>(r,n)=>t(r,n,e);let d_=class{_frameSize;_channel;_padding;_logger;constructor({frameSize:t,channel:r=Tn.zero(),padding:n=!1},i){this._frameSize=t,this._channel=r,this._padding=n,this._logger=i("DefaultApduSenderService")}getFrames(t){const r=[];let n=0,i=this.getFrameAtIndex(t,n);for(;i.isRight();)r.push(i.extract()),n+=1,i=this.getFrameAtIndex(t,n).mapLeft(o=>(o instanceof l_||this._logger.error("Error while parsing frame",{data:{error:o}}),o));return r}getFrameAtIndex(t,r){const n=this.getFrameHeaderFrom(r,t.length),i=r===0?0:r*this._frameSize-this.getHeaderSizeSumFrom(r);if(i>=t.length)return tn(new l_);if(n.getLength()>this._frameSize)return tn(new m8);const o=this._frameSize-n.getLength(),s=t.slice(i,i+this._frameSize-n.getLength()),u=this._padding?new Uint8Array(o).fill(0):new Uint8Array(s.length<o?s.length:o);u.set(s,0);const c=new P2({header:n,data:u});return rn(c)}getFrameHeaderFrom(t,r){const n=new k2({uuid:Jp(),channel:this._channel.map(i=>gs.getLastBytesFrom(i,Qy)),headTag:new Uint8Array([d8]),index:gs.numberToByteArray(t,bl),length:this.getFrameHeaderSizeFromIndex(t),dataSize:Tn.zero()});return t===0&&n.setDataSize(Tn.of(gs.numberToByteArray(r,Zy))),n}getHeaderSizeSumFrom(t){let r=this.getFrameHeaderSizeFromIndex(0),n=1;for(;n<t;)r+=this.getFrameHeaderSizeFromIndex(n),n+=1;return r}getFrameHeaderSizeFromIndex(t){return this._channel.caseOf({Just:()=>Qy,Nothing:()=>0})+bl+as+(t===0?Zy:0)}};d_=S8([Rt(),w8(1,rt(_r.LoggerPublisherServiceFactory))],d_);const eb={LocalConfigDataSource:Symbol.for("LocalConfigDataSource"),RemoteConfigDataSource:Symbol.for("RemoteConfigDataSource"),ConfigService:Symbol.for("ConfigService")},gn={ApduSenderServiceFactory:Symbol.for("ApduSenderServiceFactory"),ApduReceiverServiceFactory:Symbol.for("ApduReceiverServiceFactory"),DeviceSessionService:Symbol.for("DeviceSessionService")},p_={ConnectUseCase:Symbol.for("ConnectUseCase"),DisconnectUseCase:Symbol.for("DisconnectUseCase")},Qp={ManagerApiService:Symbol.for("ManagerApiService"),ManagerApiDataSource:Symbol.for("ManagerApiDataSource"),DmkConfig:Symbol.for("ManagerApiDmkConfig")},ja={DmkConfig:Symbol.for("TransportDmkConfig"),TransportService:Symbol.for("TransportService"),TransportsInput:Symbol.for("TransportsInput")};var x8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},h_=(e,t)=>(r,n)=>t(r,n,e);let g_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("SendCommandUseCase")}async execute({sessionId:t,command:r,abortTimeout:n}){return this._sessionService.getDeviceSessionById(t).caseOf({Right:async i=>await i.sendCommand(r,n),Left:i=>{throw this._logger.error("Error getting session",{data:{error:i}}),i}})}};g_=x8([Rt(),h_(0,rt(gn.DeviceSessionService)),h_(1,rt(_r.LoggerPublisherServiceFactory))],g_);var E8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let v_=class{execute=vi.fn(()=>"stub")};v_=E8([Rt()],v_);var C8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},m_=(e,t)=>(r,n)=>t(r,n,e);let y_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("ExecuteDeviceActionUseCase")}execute({sessionId:t,deviceAction:r}){return this._sessionService.getDeviceSessionById(t).caseOf({Right:n=>n.executeDeviceAction(r),Left:n=>{throw this._logger.error("Error getting session",{data:{error:n}}),n}})}};y_=C8([Rt(),m_(0,rt(gn.DeviceSessionService)),m_(1,rt(_r.LoggerPublisherServiceFactory))],y_);function R8(e){return typeof e=="object"&&e!==null&&"version"in e&&"name"in e&&typeof e.version=="string"&&typeof e.name=="string"}let b_=class{constructor(t){this.err=t,this.originalError=t}_tag="ApiCallError";originalError},_8=class{constructor(t){this.err=t,this.originalError=t}_tag="ParseResponseError";originalError},M2=class{constructor(t){this.err=t,this.originalError=t}_tag="JSONParseError";originalError},O8=class{constructor(t){this.err=t,this.originalError=t}_tag="ReadFileError";originalError};const T8="@ledgerhq/device-management-kit",A8="0.0.0-develop-20260403001844",S_={name:T8,version:A8};var $8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};const I8={name:S_.name,version:S_.version},P8=()=>JSON.stringify(I8);let w_=class{getConfig(){return Jn.encase(()=>P8()).mapLeft(t=>new O8(t)).chain(t=>Jn.encase(()=>{const r=JSON.parse(t);if(R8(r))return r;throw new Error("Invalid config file")}).mapLeft(r=>new M2(r)))}};w_=$8([Rt()],w_);var k8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let x_=class{getConfig(){return Jn.of({name:"DeviceSDK",version:"0.0.0-stub.1"})}};x_=k8([Rt()],x_);var M8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let E_=class{async getConfig(){const t=await this._callApi();if(t.isLeft())return tn(new b_(t.extract()));if(!t.extract().ok)return tn(new b_(new Error("response not ok")));const r=await t.extract().json();return r.isLeft()?tn(new M2):r.chain(n=>this._parseResponse(n)).map(n=>n)}_parseResponse(t){const{name:r,version:n}=t;return!r||!n?tn(new _8):Jn.of({name:r,version:n})}_callApi(){return new Promise(t=>{t(Jn.of({ok:!0,json:async()=>new Promise(r=>{r(Jn.of({name:"DeviceSDK",version:"0.0.0-fake.1",yolo:"yolo"}))})}))})}};E_=M8([Rt()],E_);var D8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let C_=class{async getConfig(){return new Promise(t=>t(Jn.of({name:"DeviceSDK",version:"0.0.0-fake.2"})))}};C_=D8([Rt()],C_);var L8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},Rm=(e,t)=>(r,n)=>t(r,n,e);let R_=class{_local;_remote;_logger;constructor(t,r,n){this._local=t,this._remote=r,this._logger=n("config")}async getDmkConfig(){const t=this._local.getConfig().ifLeft(r=>{this._logger.error("Local config not available",{data:{error:r}})});if(t.isRight()){const r=t.extract();return this._logger.info("Local config available",{data:{config:r}}),r}return this._remote.getConfig().then(r=>r.mapLeft(n=>(this._logger.error("Local config available",{data:{error:n}}),{name:"DeadDmk",version:"0.0.0-dead.1"})).extract())}};R_=L8([Rt(),Rm(0,rt(eb.LocalConfigDataSource)),Rm(1,rt(eb.RemoteConfigDataSource)),Rm(2,rt(_r.LoggerPublisherServiceFactory))],R_);var F8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},N8=(e,t)=>(r,n)=>t(r,n,e);let __=class{_configService;constructor(t){this._configService=t}async getDmkVersion(){return(await this._configService.getDmkConfig()).version}};__=F8([Rt(),N8(0,rt(eb.ConfigService))],__);const j8={DeviceModelDataSource:Symbol.for("DeviceModelDataSource")};var z8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},O_=(e,t)=>(r,n)=>t(r,n,e);let T_=class{constructor(t,r){this._sessionService=t,this._logger=r("DisableDeviceSessionRefresherUseCase")}_logger;execute({sessionId:t,blockerId:r}){return this._sessionService.getDeviceSessionById(t).caseOf({Left:n=>{throw this._logger.error("Error getting device session",{data:{error:n}}),n},Right:n=>n.disableRefresher(r)})}};T_=z8([Rt(),O_(0,rt(gn.DeviceSessionService)),O_(1,rt(_r.LoggerPublisherServiceFactory))],T_);var B8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},V8=(e,t)=>(r,n)=>t(r,n,e);let A_=class{_sessions;_sessionsSubject;_logger;constructor(t){this._sessions=[],this._sessionsSubject=new d2,this._logger=t("DeviceSessionService")}get sessionsObs(){return this._sessionsSubject.asObservable()}addDeviceSession(t){return this._sessions.find(r=>r.id===t.id)?(this._logger.warn("DeviceSession already exists",{data:{deviceSession:t}}),this):(this._sessions.push(t),this._sessionsSubject.next(t),this._logger.info("DeviceSession added",{data:{sessionId:t.id}}),this)}removeDeviceSession(t){const r=this._sessions.find(n=>n.id===t);return r?(r.close(),this._sessions=this._sessions.filter(n=>n.id!==t),this._logger.info("DeviceSession removed",{data:{sessionId:t}}),this):(this._logger.warn("DeviceSession not found",{data:{sessionId:t}}),this)}getDeviceSessionById(t){return Tn.fromNullable(this._sessions.find(r=>r.id===t)).toEither(new c_)}getDeviceSessionsByDeviceId(t){return Tn.fromPredicate(({length:r})=>r>0,this._sessions.filter(r=>r.connectedDevice.id===t)).toEither(new c_)}getDeviceSessions(){return this._sessions}};A_=B8([Rt(),V8(0,rt(_r.LoggerPublisherServiceFactory))],A_);var U8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},$_=(e,t)=>(r,n)=>t(r,n,e);let I_=class{_sessionService;_transportService;constructor(t,r){this._sessionService=t,this._transportService=r}execute(){const t=this._sessionService.getDeviceSessions();for(const r of t)this._transportService.closeConnection(r.connectedDevice),this._sessionService.removeDeviceSession(r.id)}};I_=U8([Rt(),$_(0,rt(gn.DeviceSessionService)),$_(1,rt(ja.TransportService))],I_);var H8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},P_=(e,t)=>(r,n)=>t(r,n,e);let k_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("GetDeviceSessionStateUseCase")}execute({sessionId:t}){return this._sessionService.getDeviceSessionById(t).caseOf({Left:r=>{throw this._logger.error("Error getting session device",{data:{error:r}}),r},Right:r=>r.state})}};k_=H8([Rt(),P_(0,rt(gn.DeviceSessionService)),P_(1,rt(_r.LoggerPublisherServiceFactory))],k_);var W8=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},M_=(e,t)=>(r,n)=>t(r,n,e);let D_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("UnsafeBypassIntentQueueUseCase")}execute({sessionId:t,bypass:r}){this._sessionService.getDeviceSessionById(t).caseOf({Left:n=>{throw this._logger.error("Error getting session",{data:{error:n}}),n},Right:n=>{this._logger.warn(`UNSAFE: ${r?"Enabling":"Disabling"} intent queue bypass for session ${t}`),n._unsafeBypassIntentQueue(r)}})}};D_=W8([Rt(),M_(0,rt(gn.DeviceSessionService)),M_(1,rt(_r.LoggerPublisherServiceFactory))],D_);function q8(e){return`[will send APDU] ~...> ${dc(e,!1)}`}function G8(e){return`[exchange] <= ${dc(e.data,!1)}${dc(e.statusCode,!1)}`}const tb=1e3,_m=1e3,X8={isRefresherDisabled:!1,pollingInterval:1e3};var dr=(e=>(e.NEW_STATE="NEW_STATE",e.REFRESH_NEEDED="REFRESH_NEEDED",e.COMMAND_SUCCEEDED="COMMAND_SUCCEEDED",e.DEVICE_STATE_UPDATE_BUSY="DEVICE_STATE_UPDATE_BUSY",e.DEVICE_STATE_UPDATE_LOCKED="DEVICE_STATE_UPDATE_LOCKED",e.DEVICE_STATE_UPDATE_CONNECTED="DEVICE_STATE_UPDATE_CONNECTED",e.DEVICE_STATE_UPDATE_UNKNOWN="DEVICE_STATE_UPDATE_UNKNOWN",e))(dr||{});let K8=class{_eventEmitter=new Gl;listen(){return this._eventEmitter.asObservable()}dispatch(t){this._eventEmitter.next(t)}},Y8=class{constructor(t,r){this.loggerModuleFactory=t,this.sessionEventDispatcher=r,this._logger=this.loggerModuleFactory("IntentQueueService")}_logger;_queue=[];_isProcessing=!1;_currentSubscription=null;enqueue(t){this._logger.debug("Enqueueing intent",{data:{type:t.type}});const r=new Gl,n={intent:t,subject:r,isCancelled:!1};this._queue.push(n);const i=()=>{this._logger.debug("Cancelling intent",{data:{type:t.type}}),n.isCancelled=!0,this._queue[0]===n&&this._currentSubscription?(this._currentSubscription.unsubscribe(),this._currentSubscription=null,r.complete(),this._queue.shift(),this._isProcessing=!1,this._processQueue()):(!this._isProcessing||this._queue[0]!==n)&&r.complete()};return this._isProcessing||this._processQueue(),{observable:r.asObservable().pipe(Mz(()=>{this._logger.debug("Intent observable finalized",{data:{type:t.type}})})),cancel:i}}_processQueue(){if(this._isProcessing)return;if(this._queue.length===0){this.sessionEventDispatcher.dispatch({eventName:dr.NEW_STATE});return}this.sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_BUSY}),this._isProcessing=!0;const t=this._queue[0];if(t.isCancelled){this._logger.debug("Skipping cancelled intent",{data:{type:t.intent.type}}),t.subject.complete(),this._queue.shift(),this._isProcessing=!1,this._processQueue();return}this._logger.debug("Processing intent",{data:{type:t.intent.type}}),this._currentSubscription=t.intent.execute().subscribe({next:r=>{t.isCancelled||t.subject.next(r)},error:r=>{t.isCancelled||t.subject.error(r),this._onIntentComplete()},complete:()=>{t.isCancelled||t.subject.complete(),this._onIntentComplete()}})}_onIntentComplete(){this._logger.debug("Intent completed"),this._currentSubscription=null,this._queue.shift(),this._isProcessing=!1,this._processQueue()}},J8=class{constructor(t,r){this._refresher=r,this._logger=t("refresher-service")}_refresherBlockers=new Set;_logger;disableRefresher(t){const r=`${t}-${Jp()}`;this.addRefresherBlocker(r),this._logger.debug("Refresher disabled",{data:{blockerId:r,blockers:Array.from(this._refresherBlockers)}});let n=!1;return()=>{n||(n=!0,this.removeRefresherBlocker(r),this._logger.debug("Refresher re-enabled",{data:{blockerId:r,blockers:Array.from(this._refresherBlockers)}}))}}addRefresherBlocker(t){const r=this._refresherBlockers.size;this._refresherBlockers.add(t),r===0&&this._refresher.stop()}removeRefresherBlocker(t){const r=this._refresherBlockers.size;this._refresherBlockers.delete(t),r>0&&this._refresherBlockers.size===0&&this._refresher.start()}},Q8=class{constructor(t,r,n,i){this.connectedDevice=r,this._sessionEventDispatcher=n,this._sendCommandFunction=i,this._logger=t("device-pinger"),this._subscription=this._sessionEventDispatcher.listen().subscribe(async o=>await this.mapEventAction(o))}_sendCommandFunction;_subscription;_logger;async ping(){try{return await this.mapDevicePingAction(this.connectedDevice.deviceModel.id)}catch(t){return this._logger.error("Error while pinging device",{data:{error:t}}),null}}mapEventAction=async t=>{switch(t.eventName){case dr.REFRESH_NEEDED:return await this.ping();default:return null}};async mapDevicePingAction(t){switch(t){case Zt.NANO_S:{const r=async()=>{const o=await this._sendCommandFunction(new YC,Cm);return this._sendCommandFunction(new zj,Cm),o},n=new Promise(o=>{setTimeout(()=>o(null),tb*2+100)}),i=await Promise.race([r(),n]);return i?this._sessionEventDispatcher.dispatch({eventName:dr.COMMAND_SUCCEEDED,eventData:i}):this._sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_LOCKED}),i}default:{const r=await this._sendCommandFunction(new YC,Cm);return this._sessionEventDispatcher.dispatch({eventName:dr.COMMAND_SUCCEEDED,eventData:r}),r}}}unsubscribe(){this._subscription.unsubscribe()}},Z8=class{constructor(t,r,n,i){this._sessionEventDispatcher=n,this._refresherOptions=r,this._logger=t("device-session-refresher"),this._connectedDeviceID=i.deviceModel.id}_refresherSubscription;_refresherOptions;_logger;_connectedDeviceID;startRefresher(){if(this._refresherOptions.isRefresherDisabled||this._refresherSubscription)return;const t=this.getValidPollingInterval(this._refresherOptions,this._logger)*2,r=this._sessionEventDispatcher.listen().pipe(JR(n=>n.eventName===dr.DEVICE_STATE_UPDATE_BUSY||n.eventName===dr.NEW_STATE),Fa(n=>n.eventName===dr.DEVICE_STATE_UPDATE_BUSY),Lz(!1),Pz());this._refresherSubscription=Az(0,t).pipe(Fz(r),QR(([n,i])=>{i&&this._logger.debug("Refresh skipped: device is busy")}),JR(([n,i])=>!i),QR(()=>this._sessionEventDispatcher.dispatch({eventName:dr.REFRESH_NEEDED}))).subscribe(),this._logger.info("Refresher started.")}stopRefresher(){this._refresherSubscription&&(this._refresherSubscription.unsubscribe(),this._refresherSubscription=void 0,this._logger.info("Refresher stopped."))}restartRefresher(){this.stopRefresher(),this.startRefresher(),this._logger.info("Refresher restarted.")}getValidPollingInterval=(t,r)=>{const{pollingInterval:n}=t;switch(this._connectedDeviceID){case Zt.NANO_S:{const i=tb*2;return n!==void 0&&n<i?(r.warn(`Polling interval of ${n} is too low, setting to minimum as ${i}`),i):n??i}default:return n!==void 0&&n<_m?(r.warn(`Polling interval of ${n} is too low, setting to minimum as ${_m}`),_m):n??tb}}},eB=class{constructor(t,r,n,i,o){this._sessionEventDispatcher=r,this._connectedDevice=n,this._deviceState=i,this.setDeviceSessionState=o,this._subscription=this._sessionEventDispatcher.listen().subscribe(s=>this.mapEventAction(s)),this._logger=t("device-session-state-handler")}_subscription;_logger;_pendingDeviceStatus=bo.BUSY;_updateDeviceState(t){const r=this._parseDeviceStatus(t);if(r){const{sessionStateType:n,deviceStatus:i,currentApp:o}=r,s=this._deviceState.getValue();s.sessionStateType===pc.Connected?this.setDeviceSessionState({sessionStateType:n,deviceStatus:i,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:o,installedApps:[],isSecureConnectionAllowed:!1}):this.setDeviceSessionState({...s,sessionStateType:n,deviceStatus:i,deviceModelId:this._connectedDevice.deviceModel.id,currentApp:o})}}mapEventAction=t=>{const{eventName:r}=t;switch(r){case dr.COMMAND_SUCCEEDED:return this._updateDeviceState(t.eventData);case dr.DEVICE_STATE_UPDATE_BUSY:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:bo.BUSY});case dr.DEVICE_STATE_UPDATE_LOCKED:this._pendingDeviceStatus=bo.LOCKED;return;case dr.DEVICE_STATE_UPDATE_CONNECTED:this._pendingDeviceStatus=bo.CONNECTED;return;case dr.NEW_STATE:{const n=this._pendingDeviceStatus;return this._pendingDeviceStatus=bo.BUSY,this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:n})}case dr.DEVICE_STATE_UPDATE_UNKNOWN:return this.setDeviceSessionState({...this._deviceState.getValue(),deviceStatus:bo.BUSY});case dr.REFRESH_NEEDED:return;default:{const n=r;throw new Error(`Unhandled context type ${n}`)}}};_parseDeviceStatus(t){return sj(t)?{sessionStateType:pc.ReadyWithoutSecureChannel,deviceStatus:bo.CONNECTED,currentApp:{name:t.data.name,version:t.data.version}}:(this._logger.debug("Error while parsing APDU response",{data:{parsedResponse:t}}),null)}unsubscribe(){this._subscription.unsubscribe()}},tB=class{_id;_connectedDevice;_deviceState;_managerApiService;_secureChannelService;_logger;_loggerModuleFactory;_refresherOptions;_pinger;_deviceSessionRefresher;_refresherService;_intentQueueService;_sessionEventDispatcher=new K8;_bypassIntentQueue=!1;constructor({connectedDevice:t,id:r=Jp()},n,i,o,s,u=c=>new Y8(n,c)){this._id=r,this._connectedDevice=t,this._loggerModuleFactory=n,this._logger=n("device-session"),this._managerApiService=i,this._intentQueueService=u(this._sessionEventDispatcher),this._secureChannelService=o,this._refresherOptions={...X8,...s},this._deviceState=new nz({sessionStateType:pc.Connected,deviceStatus:bo.CONNECTED,deviceModelId:this._connectedDevice.deviceModel.id}),this._pinger=new Q8(n,t,this._sessionEventDispatcher,(c,f)=>this.sendCommand(c,f)),this._deviceSessionRefresher=new Z8(n,this._refresherOptions,this._sessionEventDispatcher,this._connectedDevice),new eB(n,this._sessionEventDispatcher,this._connectedDevice,this._deviceState,c=>this.setDeviceSessionState(c)),this._refresherService=new J8(n,{start:()=>this._deviceSessionRefresher.restartRefresher(),stop:()=>this._deviceSessionRefresher.stopRefresher()})}async initialiseSession(){try{this._refresherOptions.isRefresherDisabled?await this._pinger.ping():this._deviceSessionRefresher.startRefresher()}catch(t){throw this._logger.error("Error while initialising session",{data:{error:t}}),t}}get id(){return this._id}get connectedDevice(){return this._connectedDevice}get state(){return this._deviceState.asObservable()}getDeviceSessionState(){return this._deviceState.getValue()}setDeviceSessionState(t){this._deviceState.next(t)}sendApdu(t,r={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){return this._bypassIntentQueue?this._unsafeInternalSendApdu(t,r):this._internalSendApdu(t,r)}_internalSendApdu(t,r){const n=r.abortTimeout,i=Date.now(),{observable:o,cancel:s}=this._intentQueueService.enqueue({type:"send-apdu",execute:()=>Pl((async()=>{const c=Date.now()-i;return await this._unsafeInternalSendApdu(t,{isPolling:r.isPolling,triggersDisconnection:r.triggersDisconnection,abortTimeout:n?n-c:void 0})})())}),u=n?o.pipe(KR({each:n,with:()=>{throw s(),new Nz}})):o;return XR(u)}async _unsafeInternalSendApdu(t,r={isPolling:!1,triggersDisconnection:!1,abortTimeout:void 0}){return this._logger.debug(q8(t)),(await this._connectedDevice.sendApdu(t,r.triggersDisconnection,r.abortTimeout)).ifRight(n=>{this._logger.debug(G8(n)),$1.isLockedDeviceResponse(n)?this._sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_LOCKED}):this._sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_CONNECTED})}).ifLeft(()=>{this._sessionEventDispatcher.dispatch({eventName:dr.DEVICE_STATE_UPDATE_UNKNOWN})})}sendCommand(t,r){return this._logger.debug(`[sendCommand] ${t.name}`),this._bypassIntentQueue?this._unsafeInternalSendCommand(t,r):this._internalSendCommand(t,r)}_internalSendCommand(t,r){const n=Date.now(),{observable:i,cancel:o}=this._intentQueueService.enqueue({type:"send-command",execute:()=>Pl((async()=>{const u=Date.now()-n;return await this._unsafeInternalSendCommand(t,r?r-u:void 0)})())}),s=r?i.pipe(KR({each:r,with:()=>{throw o(),new jz}})):i;return XR(s)}async _unsafeInternalSendCommand(t,r){const n=t.getApdu();return(await this._unsafeInternalSendApdu(n.getRawApdu(),{isPolling:!1,triggersDisconnection:t.triggersDisconnection??!1,abortTimeout:r})).caseOf({Left:i=>{throw this._logger.error("[sendCommand] error",{data:{err:i}}),i},Right:i=>{const o=t.parseResponse(i,this._connectedDevice.deviceModel.id);return this._logger.debug("[sendCommand] result",{data:{result:o}}),o}})}executeDeviceAction(t){return this._bypassIntentQueue?this._unsafeInternalExecuteDeviceAction(t):this._internalExecuteDeviceAction(t)}_internalExecuteDeviceAction(t){let r;const{observable:n,cancel:i}=this._intentQueueService.enqueue({type:"device-action",execute:()=>{const{observable:o,cancel:s}=this._unsafeInternalExecuteDeviceAction(t);return r=s,o}});return{observable:n,cancel:()=>{r?.(),i()}}}_unsafeInternalExecuteDeviceAction(t){const{observable:r,cancel:n}=t._execute({sendApdu:async i=>this._unsafeInternalSendApdu(i),sendCommand:async i=>this._unsafeInternalSendCommand(i),getDeviceModel:()=>this._connectedDevice.deviceModel,getDeviceSessionState:()=>this._deviceState.getValue(),getDeviceSessionStateObservable:()=>this.state,setDeviceSessionState:i=>(this.setDeviceSessionState(i),this._deviceState.getValue()),getManagerApiService:()=>this._managerApiService,getSecureChannelService:()=>this._secureChannelService,loggerFactory:this._loggerModuleFactory});return{observable:r,cancel:n}}close(){this._updateDeviceStatus(bo.NOT_CONNECTED),this._deviceState.complete(),this._deviceSessionRefresher.stopRefresher(),this._pinger.unsubscribe()}disableRefresher(t){return this._refresherService.disableRefresher(t)}_unsafeBypassIntentQueue(t){this._bypassIntentQueue=t}_updateDeviceStatus(t){const r=this._deviceState.getValue();this._deviceState.next({...r,deviceStatus:t})}};const X1={SecureChannelService:Symbol.for("SecureChannelService"),SecureChannelDataSource:Symbol.for("SecureChannelDataSource"),DmkConfig:Symbol.for("SecureChannelDmkConfig")};var rB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},$u=(e,t)=>(r,n)=>t(r,n,e);let L_=class{_transportService;_sessionService;_loggerFactory;_managerApi;_secureChannel;_logger;constructor(t,r,n,i,o){this._sessionService=r,this._transportService=t,this._loggerFactory=n,this._logger=n("ConnectUseCase"),this._managerApi=i,this._secureChannel=o}handleDeviceDisconnect(t){this._sessionService.getDeviceSessionsByDeviceId(t).ifRight(r=>{r.forEach(n=>{this._sessionService.removeDeviceSession(n.id),this._logger.info("Session removed",{data:{deviceId:t,sessionId:n.id}})})})}async execute({device:t,sessionRefresherOptions:r}){const n=this._transportService.getTransport(t.transport),i="sessionId"in t?t.sessionId:void 0;return mt.liftEither(n.toEither(new q1(new Error("Unknown transport")))).chain(async o=>o.connect({deviceId:t.id,onDisconnect:s=>this.handleDeviceDisconnect(s)})).ifLeft(o=>{this._logger.error("Error connecting to device")}).map(async o=>{const s=new tB({connectedDevice:o,id:i},this._loggerFactory,this._managerApi,this._secureChannel,r);return this._sessionService.addDeviceSession(s),await s.initialiseSession(),s.id}).caseOf({Left:o=>{throw o},Right:o=>o})}};L_=rB([Rt(),$u(0,rt(ja.TransportService)),$u(1,rt(gn.DeviceSessionService)),$u(2,rt(_r.LoggerPublisherServiceFactory)),$u(3,rt(Qp.ManagerApiService)),$u(4,rt(X1.SecureChannelService))],L_);var nB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},Om=(e,t)=>(r,n)=>t(r,n,e);let F_=class{_transportService;_sessionService;_logger;constructor(t,r,n){this._sessionService=r,this._transportService=t,this._logger=n("DisconnectUseCase")}async execute({sessionId:t}){return this._logger.debug("Disconnecting from device",{data:{test:this._sessionService.getDeviceSessions().map(r=>r.id)}}),mt(async({liftEither:r})=>{const n=await r(this._sessionService.getDeviceSessionById(t).ifLeft(s=>{this._logger.error("Device session not found",{data:{sessionId:t,error:s}})})),i=n.connectedDevice.transport,o=await r(this._transportService.getTransport(i).toEither(new q1(new Error("Unknown transport"))));n.close(),this._sessionService.removeDeviceSession(t),await o.disconnect({connectedDevice:n.connectedDevice})}).caseOf({Left:r=>{throw this._logger.error("Error disconnecting from device",{data:{error:r}}),r},Right:()=>{}})}};F_=nB([Rt(),Om(0,rt(ja.TransportService)),Om(1,rt(gn.DeviceSessionService)),Om(2,rt(_r.LoggerPublisherServiceFactory))],F_);let K1=class{id;sessionId;modelId;name;type;transport;constructor({transportConnectedDevice:{id:t,deviceModel:{id:r,productName:n},type:i,transport:o,name:s},sessionId:u}){this.id=t,this.sessionId=u,this.modelId=r,this.name=s??n,this.type=i,this.transport=o}};var iB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},N_=(e,t)=>(r,n)=>t(r,n,e);let j_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("GetConnectedDeviceUseCase")}execute({sessionId:t}){return this._sessionService.getDeviceSessionById(t).caseOf({Right:r=>new K1({sessionId:r.id,transportConnectedDevice:r.connectedDevice}),Left:r=>{throw this._logger.error("Error getting session",{data:{error:r}}),r}})}};j_=iB([Rt(),N_(0,rt(gn.DeviceSessionService)),N_(1,rt(_r.LoggerPublisherServiceFactory))],j_);var oB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},z_=(e,t)=>(r,n)=>t(r,n,e);let B_=class{_sessionService;_logger;constructor(t,r){this._sessionService=t,this._logger=r("ListConnectedDeviceUseCase")}execute(){return this._logger.info("Listing connected devices"),this._sessionService.getDeviceSessions().map(t=>new K1({transportConnectedDevice:t.connectedDevice,sessionId:t.id}))}};B_=oB([Rt(),z_(0,rt(gn.DeviceSessionService)),z_(1,rt(_r.LoggerPublisherServiceFactory))],B_);var aB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},V_=(e,t)=>(r,n)=>t(r,n,e);let U_=class{_transports;_transportService;_logger;constructor(t,r){this._transports=t.getAllTransports(),this._transportService=t,this._logger=r("ListenToAvailableDevicesUseCase")}mapTransportDiscoveredDeviceToDiscoveredDevice(t){const r=new t2({id:t.id,model:t.deviceModel.id,name:t.deviceModel.productName});return{id:t.id,deviceModel:r,transport:t.transport,name:t.name||r.name,rssi:t.rssi}}execute({transport:t}={}){if(this._logger.info("Listening to available devices"),this._transports.length===0)return this._logger.warn("No transports available"),Pl([[]]);if(!t){this._logger.info("Discovering all available transports");const r=this._transports.map((n,i)=>n.listenToAvailableDevices().pipe(Fa(o=>({index:i,arr:o}))));return $z(...r).pipe(Dz((n,{index:i,arr:o})=>(n[i]=o,n),{}),Fa(n=>Object.values(n).flat().map(this.mapTransportDiscoveredDeviceToDiscoveredDevice)))}return this._logger.info(`Discovering devices on transport ${t}`),this._transportService.getTransport(t).caseOf({Nothing:()=>(this._logger.error(`Transport ${t} not found`),T2([])),Just:r=>r.listenToAvailableDevices().pipe(Fa(n=>n.map(this.mapTransportDiscoveredDeviceToDiscoveredDevice)))})}};U_=aB([Rt(),V_(0,rt(ja.TransportService)),V_(1,rt(_r.LoggerPublisherServiceFactory))],U_);var sB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},H_=(e,t)=>(r,n)=>t(r,n,e);let W_=class{constructor(t,r){this._sessionService=t,this._logger=r("ListenToConnectedDeviceUseCase")}_logger;execute(){return this._logger.info("Observe connected devices"),this._sessionService.sessionsObs.pipe(Fa(t=>new K1({transportConnectedDevice:t.connectedDevice,sessionId:t.id})))}};W_=sB([Rt(),H_(0,rt(gn.DeviceSessionService)),H_(1,rt(_r.LoggerPublisherServiceFactory))],W_);var lB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},Tm=(e,t)=>(r,n)=>t(r,n,e);let q_=class{constructor(t,r,n){this.connectUseCase=t,this.disconnectUseCase=r,this._logger=n("ReconnectUseCase")}_logger;async execute({device:t,sessionRefresherOptions:r}){return this._logger.debug("Reconnecting device session",{data:{deviceId:t.id,transport:t.transport}}),await this.disconnectUseCase.execute({sessionId:t.sessionId}),this.connectUseCase.execute({device:t,sessionRefresherOptions:r})}};q_=lB([Rt(),Tm(0,rt(p_.ConnectUseCase)),Tm(1,rt(p_.DisconnectUseCase)),Tm(2,rt(_r.LoggerPublisherServiceFactory))],q_);var uB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},cB=(e,t)=>(r,n)=>t(r,n,e);let G_=class{constructor(t){this._transportService=t}mapDiscoveredDevice(t){const r=new t2({id:t.id,model:t.deviceModel.id,name:t.deviceModel.productName});return{id:t.id,deviceModel:r,transport:t.transport,name:t.name||r.name,rssi:t.rssi}}execute({transport:t}={}){if(!t){const r=this._transportService.getAllTransports();return T2(...r).pipe(W1(n=>n.startDiscovering().pipe(Fa(i=>this.mapDiscoveredDevice(i)))))}return this._transportService.getTransport(t).caseOf({Just:r=>r.startDiscovering().pipe(Fa(n=>this.mapDiscoveredDevice(n))),Nothing:()=>{throw new q1(new Error("Unknown transport"))}})}};G_=uB([Rt(),cB(0,rt(ja.TransportService))],G_);var fB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i},X_=(e,t)=>(r,n)=>t(r,n,e);let K_=class{constructor(t,r){this.transportService=t,this._logger=r("StopDiscoveringUseCase")}_logger;async execute(){this._logger.debug("Stopping discovering devices");for(const t of this.transportService.getAllTransports())await t.stopDiscovering()}};K_=fB([Rt(),X_(0,rt(ja.TransportService)),X_(1,rt(_r.LoggerPublisherServiceFactory))],K_);var zu=(e=>(e[e.Fatal=0]="Fatal",e[e.Error=1]="Error",e[e.Warning=2]="Warning",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e))(zu||{});let dB=class{format(t){return Array.isArray(t)?t.map(r=>`[${r}]`).join(" "):`[${t}]`}};function rb(e,t){if(typeof e=="bigint")return e.toString();if(Array.isArray(e))return t.has(e)?"[Circular]":(t.add(e),e.map(r=>rb(r,t)));if(e!==null&&typeof e=="object"){if(t.has(e))return"[Circular]";t.add(e);const r={};for(const[n,i]of Object.entries(e))r[n]=rb(i,t);return r}return e}function pB(e){const t=new WeakSet;t.add(e);const r={};for(const[n,i]of Object.entries(e))r[n]=rb(i,t);return r}var hB=(e,t,r,n)=>{for(var i=t,o=e.length-1,s;o>=0;o--)(s=e[o])&&(i=s(i)||i);return i};let Y_=class{subscribers;tag;tagFormatter;constructor(t,r,n=new dB){this.subscribers=t,this.tag=r,this.tagFormatter=n}_log(t,r,n){const i=n?.data?pB(n.data):void 0,o=n?.tag??this.tag,s=this.tagFormatter.format(o);this.subscribers.forEach(u=>{const c={timestamp:n?.timestamp??Date.now(),tag:s,data:i};u.log(t,r,c)})}info(t,r){this._log(zu.Info,t,r)}warn(t,r){this._log(zu.Warning,t,r)}debug(t,r){this._log(zu.Debug,t,r)}error(t,r){this._log(zu.Error,t,r)}};Y_=hB([Rt()],Y_);function D2(e,t){return function(){return e.apply(t,arguments)}}const{toString:gB}=Object.prototype,{getPrototypeOf:Y1}=Object,{iterator:Zp,toStringTag:L2}=Symbol,eh=(e=>t=>{const r=gB.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),so=e=>(e=e.toLowerCase(),t=>eh(t)===e),th=e=>t=>typeof t===e,{isArray:Xl}=Array,kl=th("undefined");function Fc(e){return e!==null&&!kl(e)&&e.constructor!==null&&!kl(e.constructor)&&An(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const F2=so("ArrayBuffer");function vB(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&F2(e.buffer),t}const mB=th("string"),An=th("function"),N2=th("number"),Nc=e=>e!==null&&typeof e=="object",yB=e=>e===!0||e===!1,ep=e=>{if(eh(e)!=="object")return!1;const t=Y1(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(L2 in e)&&!(Zp in e)},bB=e=>{if(!Nc(e)||Fc(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},SB=so("Date"),wB=so("File"),xB=so("Blob"),EB=so("FileList"),CB=e=>Nc(e)&&An(e.pipe),RB=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||An(e.append)&&((t=eh(e))==="formdata"||t==="object"&&An(e.toString)&&e.toString()==="[object FormData]"))},_B=so("URLSearchParams"),[OB,TB,AB,$B]=["ReadableStream","Request","Response","Headers"].map(so),IB=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function jc(e,t,{allOwnKeys:r=!1}={}){if(e===null||typeof e>"u")return;let n,i;if(typeof e!="object"&&(e=[e]),Xl(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(Fc(e))return;const o=r?Object.getOwnPropertyNames(e):Object.keys(e),s=o.length;let u;for(n=0;n<s;n++)u=o[n],t.call(null,e[u],u,e)}}function j2(e,t){if(Fc(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n=r.length,i;for(;n-- >0;)if(i=r[n],t===i.toLowerCase())return i;return null}const fs=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:self,z2=e=>!kl(e)&&e!==fs;function nb(){const{caseless:e,skipUndefined:t}=z2(this)&&this||{},r={},n=(i,o)=>{if(o==="__proto__"||o==="constructor"||o==="prototype")return;const s=e&&j2(r,o)||o;ep(r[s])&&ep(i)?r[s]=nb(r[s],i):ep(i)?r[s]=nb({},i):Xl(i)?r[s]=i.slice():(!t||!kl(i))&&(r[s]=i)};for(let i=0,o=arguments.length;i<o;i++)arguments[i]&&jc(arguments[i],n);return r}const PB=(e,t,r,{allOwnKeys:n}={})=>(jc(t,(i,o)=>{r&&An(i)?Object.defineProperty(e,o,{value:D2(i,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,o,{value:i,writable:!0,enumerable:!0,configurable:!0})},{allOwnKeys:n}),e),kB=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),MB=(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},DB=(e,t,r,n)=>{let i,o,s;const u={};if(t=t||{},e==null)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],(!n||n(s,e,t))&&!u[s]&&(t[s]=e[s],u[s]=!0);e=r!==!1&&Y1(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},LB=(e,t,r)=>{e=String(e),(r===void 0||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return n!==-1&&n===r},FB=e=>{if(!e)return null;if(Xl(e))return e;let t=e.length;if(!N2(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},NB=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&Y1(Uint8Array)),jB=(e,t)=>{const n=(e&&e[Zp]).call(e);let i;for(;(i=n.next())&&!i.done;){const o=i.value;t.call(e,o[0],o[1])}},zB=(e,t)=>{let r;const n=[];for(;(r=e.exec(t))!==null;)n.push(r);return n},BB=so("HTMLFormElement"),VB=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(r,n,i){return n.toUpperCase()+i}),J_=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),UB=so("RegExp"),B2=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};jc(r,(i,o)=>{let s;(s=t(i,o,e))!==!1&&(n[o]=s||i)}),Object.defineProperties(e,n)},HB=e=>{B2(e,(t,r)=>{if(An(e)&&["arguments","caller","callee"].indexOf(r)!==-1)return!1;const n=e[r];if(An(n)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")})}})},WB=(e,t)=>{const r={},n=i=>{i.forEach(o=>{r[o]=!0})};return Xl(e)?n(e):n(String(e).split(t)),r},qB=()=>{},GB=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function XB(e){return!!(e&&An(e.append)&&e[L2]==="FormData"&&e[Zp])}const KB=e=>{const t=new Array(10),r=(n,i)=>{if(Nc(n)){if(t.indexOf(n)>=0)return;if(Fc(n))return n;if(!("toJSON"in n)){t[i]=n;const o=Xl(n)?[]:{};return jc(n,(s,u)=>{const c=r(s,i+1);!kl(c)&&(o[u]=c)}),t[i]=void 0,o}}return n};return r(e,0)},YB=so("AsyncFunction"),JB=e=>e&&(Nc(e)||An(e))&&An(e.then)&&An(e.catch),V2=((e,t)=>e?setImmediate:t?((r,n)=>(fs.addEventListener("message",({source:i,data:o})=>{i===fs&&o===r&&n.length&&n.shift()()},!1),i=>{n.push(i),fs.postMessage(r,"*")}))(`axios@${Math.random()}`,[]):r=>setTimeout(r))(typeof setImmediate=="function",An(fs.postMessage)),QB=typeof queueMicrotask<"u"?queueMicrotask.bind(fs):typeof process<"u"&&process.nextTick||V2,ZB=e=>e!=null&&An(e[Zp]),ye={isArray:Xl,isArrayBuffer:F2,isBuffer:Fc,isFormData:RB,isArrayBufferView:vB,isString:mB,isNumber:N2,isBoolean:yB,isObject:Nc,isPlainObject:ep,isEmptyObject:bB,isReadableStream:OB,isRequest:TB,isResponse:AB,isHeaders:$B,isUndefined:kl,isDate:SB,isFile:wB,isBlob:xB,isRegExp:UB,isFunction:An,isStream:CB,isURLSearchParams:_B,isTypedArray:NB,isFileList:EB,forEach:jc,merge:nb,extend:PB,trim:IB,stripBOM:kB,inherits:MB,toFlatObject:DB,kindOf:eh,kindOfTest:so,endsWith:LB,toArray:FB,forEachEntry:jB,matchAll:zB,isHTMLForm:BB,hasOwnProperty:J_,hasOwnProp:J_,reduceDescriptors:B2,freezeMethods:HB,toObjectSet:WB,toCamelCase:VB,noop:qB,toFiniteNumber:GB,findKey:j2,global:fs,isContextDefined:z2,isSpecCompliantForm:XB,toJSONObject:KB,isAsyncFn:YB,isThenable:JB,setImmediate:V2,asap:QB,isIterable:ZB};let ut=class U2 extends Error{static from(t,r,n,i,o,s){const u=new U2(t.message,r||t.code,n,i,o);return u.cause=t,u.name=t.name,s&&Object.assign(u,s),u}constructor(t,r,n,i,o){super(t),this.name="AxiosError",this.isAxiosError=!0,r&&(this.code=r),n&&(this.config=n),i&&(this.request=i),o&&(this.response=o,this.status=o.status)}toJSON(){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:ye.toJSONObject(this.config),code:this.code,status:this.status}}};ut.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE";ut.ERR_BAD_OPTION="ERR_BAD_OPTION";ut.ECONNABORTED="ECONNABORTED";ut.ETIMEDOUT="ETIMEDOUT";ut.ERR_NETWORK="ERR_NETWORK";ut.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS";ut.ERR_DEPRECATED="ERR_DEPRECATED";ut.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE";ut.ERR_BAD_REQUEST="ERR_BAD_REQUEST";ut.ERR_CANCELED="ERR_CANCELED";ut.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT";ut.ERR_INVALID_URL="ERR_INVALID_URL";const eV=null;function ib(e){return ye.isPlainObject(e)||ye.isArray(e)}function H2(e){return ye.endsWith(e,"[]")?e.slice(0,-2):e}function Q_(e,t,r){return e?e.concat(t).map(function(i,o){return i=H2(i),!r&&o?"["+i+"]":i}).join(r?".":""):t}function tV(e){return ye.isArray(e)&&!e.some(ib)}const rV=ye.toFlatObject(ye,{},null,function(t){return/^is[A-Z]/.test(t)});function rh(e,t,r){if(!ye.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,r=ye.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,function(S,y){return!ye.isUndefined(y[S])});const n=r.metaTokens,i=r.visitor||d,o=r.dots,s=r.indexes,c=(r.Blob||typeof Blob<"u"&&Blob)&&ye.isSpecCompliantForm(t);if(!ye.isFunction(i))throw new TypeError("visitor must be a function");function f(v){if(v===null)return"";if(ye.isDate(v))return v.toISOString();if(ye.isBoolean(v))return v.toString();if(!c&&ye.isBlob(v))throw new ut("Blob is not supported. Use a Buffer instead.");return ye.isArrayBuffer(v)||ye.isTypedArray(v)?c&&typeof Blob=="function"?new Blob([v]):Buffer.from(v):v}function d(v,S,y){let E=v;if(v&&!y&&typeof v=="object"){if(ye.endsWith(S,"{}"))S=n?S:S.slice(0,-2),v=JSON.stringify(v);else if(ye.isArray(v)&&tV(v)||(ye.isFileList(v)||ye.endsWith(S,"[]"))&&(E=ye.toArray(v)))return S=H2(S),E.forEach(function(T,A){!(ye.isUndefined(T)||T===null)&&t.append(s===!0?Q_([S],A,o):s===null?S:S+"[]",f(T))}),!1}return ib(v)?!0:(t.append(Q_(y,S,o),f(v)),!1)}const g=[],h=Object.assign(rV,{defaultVisitor:d,convertValue:f,isVisitable:ib});function b(v,S){if(!ye.isUndefined(v)){if(g.indexOf(v)!==-1)throw Error("Circular reference detected in "+S.join("."));g.push(v),ye.forEach(v,function(E,x){(!(ye.isUndefined(E)||E===null)&&i.call(t,E,ye.isString(x)?x.trim():x,S,h))===!0&&b(E,S?S.concat(x):[x])}),g.pop()}}if(!ye.isObject(e))throw new TypeError("data must be an object");return b(e),t}function Z_(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(n){return t[n]})}function J1(e,t){this._pairs=[],e&&rh(e,this,t)}const W2=J1.prototype;W2.append=function(t,r){this._pairs.push([t,r])};W2.toString=function(t){const r=t?function(n){return t.call(this,n,Z_)}:Z_;return this._pairs.map(function(i){return r(i[0])+"="+r(i[1])},"").join("&")};function nV(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function q2(e,t,r){if(!t)return e;const n=r&&r.encode||nV,i=ye.isFunction(r)?{serialize:r}:r,o=i&&i.serialize;let s;if(o?s=o(t,i):s=ye.isURLSearchParams(t)?t.toString():new J1(t,i).toString(n),s){const u=e.indexOf("#");u!==-1&&(e=e.slice(0,u)),e+=(e.indexOf("?")===-1?"?":"&")+s}return e}class eO{constructor(){this.handlers=[]}use(t,r,n){return this.handlers.push({fulfilled:t,rejected:r,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){ye.forEach(this.handlers,function(n){n!==null&&t(n)})}}const Q1={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0},iV=typeof URLSearchParams<"u"?URLSearchParams:J1,oV=typeof FormData<"u"?FormData:null,aV=typeof Blob<"u"?Blob:null,sV={isBrowser:!0,classes:{URLSearchParams:iV,FormData:oV,Blob:aV},protocols:["http","https","file","blob","url","data"]},Z1=typeof window<"u"&&typeof document<"u",ob=typeof navigator=="object"&&navigator||void 0,lV=Z1&&(!ob||["ReactNative","NativeScript","NS"].indexOf(ob.product)<0),uV=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",cV=Z1&&window.location.href||"http://localhost",fV=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:Z1,hasStandardBrowserEnv:lV,hasStandardBrowserWebWorkerEnv:uV,navigator:ob,origin:cV},Symbol.toStringTag,{value:"Module"})),en={...fV,...sV};function dV(e,t){return rh(e,new en.classes.URLSearchParams,{visitor:function(r,n,i,o){return en.isNode&&ye.isBuffer(r)?(this.append(n,r.toString("base64")),!1):o.defaultVisitor.apply(this,arguments)},...t})}function pV(e){return ye.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function hV(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}function G2(e){function t(r,n,i,o){let s=r[o++];if(s==="__proto__")return!0;const u=Number.isFinite(+s),c=o>=r.length;return s=!s&&ye.isArray(i)?i.length:s,c?(ye.hasOwnProp(i,s)?i[s]=[i[s],n]:i[s]=n,!u):((!i[s]||!ye.isObject(i[s]))&&(i[s]=[]),t(r,n,i[s],o)&&ye.isArray(i[s])&&(i[s]=hV(i[s])),!u)}if(ye.isFormData(e)&&ye.isFunction(e.entries)){const r={};return ye.forEachEntry(e,(n,i)=>{t(pV(n),i,r,0)}),r}return null}function gV(e,t,r){if(ye.isString(e))try{return(t||JSON.parse)(e),ye.trim(e)}catch(n){if(n.name!=="SyntaxError")throw n}return(r||JSON.stringify)(e)}const zc={transitional:Q1,adapter:["xhr","http","fetch"],transformRequest:[function(t,r){const n=r.getContentType()||"",i=n.indexOf("application/json")>-1,o=ye.isObject(t);if(o&&ye.isHTMLForm(t)&&(t=new FormData(t)),ye.isFormData(t))return i?JSON.stringify(G2(t)):t;if(ye.isArrayBuffer(t)||ye.isBuffer(t)||ye.isStream(t)||ye.isFile(t)||ye.isBlob(t)||ye.isReadableStream(t))return t;if(ye.isArrayBufferView(t))return t.buffer;if(ye.isURLSearchParams(t))return r.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let u;if(o){if(n.indexOf("application/x-www-form-urlencoded")>-1)return dV(t,this.formSerializer).toString();if((u=ye.isFileList(t))||n.indexOf("multipart/form-data")>-1){const c=this.env&&this.env.FormData;return rh(u?{"files[]":t}:t,c&&new c,this.formSerializer)}}return o||i?(r.setContentType("application/json",!1),gV(t)):t}],transformResponse:[function(t){const r=this.transitional||zc.transitional,n=r&&r.forcedJSONParsing,i=this.responseType==="json";if(ye.isResponse(t)||ye.isReadableStream(t))return t;if(t&&ye.isString(t)&&(n&&!this.responseType||i)){const s=!(r&&r.silentJSONParsing)&&i;try{return JSON.parse(t,this.parseReviver)}catch(u){if(s)throw u.name==="SyntaxError"?ut.from(u,ut.ERR_BAD_RESPONSE,this,null,this.response):u}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:en.classes.FormData,Blob:en.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ye.forEach(["delete","get","head","post","put","patch"],e=>{zc.headers[e]={}});const vV=ye.toObjectSet(["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"]),mV=e=>{const t={};let r,n,i;return e&&e.split(`
|
|
526
526
|
`).forEach(function(s){i=s.indexOf(":"),r=s.substring(0,i).trim().toLowerCase(),n=s.substring(i+1).trim(),!(!r||t[r]&&vV[r])&&(r==="set-cookie"?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)}),t},tO=Symbol("internals");function Iu(e){return e&&String(e).trim().toLowerCase()}function tp(e){return e===!1||e==null?e:ye.isArray(e)?e.map(tp):String(e)}function yV(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}const bV=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function Am(e,t,r,n,i){if(ye.isFunction(n))return n.call(this,t,r);if(i&&(t=r),!!ye.isString(t)){if(ye.isString(n))return t.indexOf(n)!==-1;if(ye.isRegExp(n))return n.test(t)}}function SV(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,r,n)=>r.toUpperCase()+n)}function wV(e,t){const r=ye.toCamelCase(" "+t);["get","set","has"].forEach(n=>{Object.defineProperty(e,n+r,{value:function(i,o,s){return this[n].call(this,t,i,o,s)},configurable:!0})})}let $n=class{constructor(t){t&&this.set(t)}set(t,r,n){const i=this;function o(u,c,f){const d=Iu(c);if(!d)throw new Error("header name must be a non-empty string");const g=ye.findKey(i,d);(!g||i[g]===void 0||f===!0||f===void 0&&i[g]!==!1)&&(i[g||c]=tp(u))}const s=(u,c)=>ye.forEach(u,(f,d)=>o(f,d,c));if(ye.isPlainObject(t)||t instanceof this.constructor)s(t,r);else if(ye.isString(t)&&(t=t.trim())&&!bV(t))s(mV(t),r);else if(ye.isObject(t)&&ye.isIterable(t)){let u={},c,f;for(const d of t){if(!ye.isArray(d))throw TypeError("Object iterator must return a key-value pair");u[f=d[0]]=(c=u[f])?ye.isArray(c)?[...c,d[1]]:[c,d[1]]:d[1]}s(u,r)}else t!=null&&o(r,t,n);return this}get(t,r){if(t=Iu(t),t){const n=ye.findKey(this,t);if(n){const i=this[n];if(!r)return i;if(r===!0)return yV(i);if(ye.isFunction(r))return r.call(this,i,n);if(ye.isRegExp(r))return r.exec(i);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,r){if(t=Iu(t),t){const n=ye.findKey(this,t);return!!(n&&this[n]!==void 0&&(!r||Am(this,this[n],n,r)))}return!1}delete(t,r){const n=this;let i=!1;function o(s){if(s=Iu(s),s){const u=ye.findKey(n,s);u&&(!r||Am(n,n[u],u,r))&&(delete n[u],i=!0)}}return ye.isArray(t)?t.forEach(o):o(t),i}clear(t){const r=Object.keys(this);let n=r.length,i=!1;for(;n--;){const o=r[n];(!t||Am(this,this[o],o,t,!0))&&(delete this[o],i=!0)}return i}normalize(t){const r=this,n={};return ye.forEach(this,(i,o)=>{const s=ye.findKey(n,o);if(s){r[s]=tp(i),delete r[o];return}const u=t?SV(o):String(o).trim();u!==o&&delete r[o],r[u]=tp(i),n[u]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const r=Object.create(null);return ye.forEach(this,(n,i)=>{n!=null&&n!==!1&&(r[i]=t&&ye.isArray(n)?n.join(", "):n)}),r}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,r])=>t+": "+r).join(`
|
|
527
527
|
`)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...r){const n=new this(t);return r.forEach(i=>n.set(i)),n}static accessor(t){const n=(this[tO]=this[tO]={accessors:{}}).accessors,i=this.prototype;function o(s){const u=Iu(s);n[u]||(wV(i,s),n[u]=!0)}return ye.isArray(t)?t.forEach(o):o(t),this}};$n.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);ye.reduceDescriptors($n.prototype,({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(n){this[r]=n}}});ye.freezeMethods($n);function $m(e,t){const r=this||zc,n=t||r,i=$n.from(n.headers);let o=n.data;return ye.forEach(e,function(u){o=u.call(r,o,i.normalize(),t?t.status:void 0)}),i.normalize(),o}function X2(e){return!!(e&&e.__CANCEL__)}let Bc=class extends ut{constructor(t,r,n){super(t??"canceled",ut.ERR_CANCELED,r,n),this.name="CanceledError",this.__CANCEL__=!0}};function K2(e,t,r){const n=r.config.validateStatus;!r.status||!n||n(r.status)?e(r):t(new ut("Request failed with status code "+r.status,[ut.ERR_BAD_REQUEST,ut.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r))}function xV(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function EV(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i=0,o=0,s;return t=t!==void 0?t:1e3,function(c){const f=Date.now(),d=n[o];s||(s=f),r[i]=c,n[i]=f;let g=o,h=0;for(;g!==i;)h+=r[g++],g=g%e;if(i=(i+1)%e,i===o&&(o=(o+1)%e),f-s<t)return;const b=d&&f-d;return b?Math.round(h*1e3/b):void 0}}function CV(e,t){let r=0,n=1e3/t,i,o;const s=(f,d=Date.now())=>{r=d,i=null,o&&(clearTimeout(o),o=null),e(...f)};return[(...f)=>{const d=Date.now(),g=d-r;g>=n?s(f,d):(i=f,o||(o=setTimeout(()=>{o=null,s(i)},n-g)))},()=>i&&s(i)]}const xp=(e,t,r=3)=>{let n=0;const i=EV(50,250);return CV(o=>{const s=o.loaded,u=o.lengthComputable?o.total:void 0,c=s-n,f=i(c),d=s<=u;n=s;const g={loaded:s,total:u,progress:u?s/u:void 0,bytes:c,rate:f||void 0,estimated:f&&u&&d?(u-s)/f:void 0,event:o,lengthComputable:u!=null,[t?"download":"upload"]:!0};e(g)},r)},rO=(e,t)=>{const r=e!=null;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},nO=e=>(...t)=>ye.asap(()=>e(...t)),RV=en.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,en.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(en.origin),en.navigator&&/(msie|trident)/i.test(en.navigator.userAgent)):()=>!0,_V=en.hasStandardBrowserEnv?{write(e,t,r,n,i,o,s){if(typeof document>"u")return;const u=[`${e}=${encodeURIComponent(t)}`];ye.isNumber(r)&&u.push(`expires=${new Date(r).toUTCString()}`),ye.isString(n)&&u.push(`path=${n}`),ye.isString(i)&&u.push(`domain=${i}`),o===!0&&u.push("secure"),ye.isString(s)&&u.push(`SameSite=${s}`),document.cookie=u.join("; ")},read(e){if(typeof document>"u")return null;const t=document.cookie.match(new RegExp("(?:^|; )"+e+"=([^;]*)"));return t?decodeURIComponent(t[1]):null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read(){return null},remove(){}};function OV(e){return typeof e!="string"?!1:/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function TV(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function Y2(e,t,r){let n=!OV(t);return e&&(n||r==!1)?TV(e,t):t}const iO=e=>e instanceof $n?{...e}:e;function Es(e,t){t=t||{};const r={};function n(f,d,g,h){return ye.isPlainObject(f)&&ye.isPlainObject(d)?ye.merge.call({caseless:h},f,d):ye.isPlainObject(d)?ye.merge({},d):ye.isArray(d)?d.slice():d}function i(f,d,g,h){if(ye.isUndefined(d)){if(!ye.isUndefined(f))return n(void 0,f,g,h)}else return n(f,d,g,h)}function o(f,d){if(!ye.isUndefined(d))return n(void 0,d)}function s(f,d){if(ye.isUndefined(d)){if(!ye.isUndefined(f))return n(void 0,f)}else return n(void 0,d)}function u(f,d,g){if(g in t)return n(f,d);if(g in e)return n(void 0,f)}const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:u,headers:(f,d,g)=>i(iO(f),iO(d),g,!0)};return ye.forEach(Object.keys({...e,...t}),function(d){if(d==="__proto__"||d==="constructor"||d==="prototype")return;const g=ye.hasOwnProp(c,d)?c[d]:i,h=g(e[d],t[d],d);ye.isUndefined(h)&&g!==u||(r[d]=h)}),r}const J2=e=>{const t=Es({},e);let{data:r,withXSRFToken:n,xsrfHeaderName:i,xsrfCookieName:o,headers:s,auth:u}=t;if(t.headers=s=$n.from(s),t.url=q2(Y2(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),u&&s.set("Authorization","Basic "+btoa((u.username||"")+":"+(u.password?unescape(encodeURIComponent(u.password)):""))),ye.isFormData(r)){if(en.hasStandardBrowserEnv||en.hasStandardBrowserWebWorkerEnv)s.setContentType(void 0);else if(ye.isFunction(r.getHeaders)){const c=r.getHeaders(),f=["content-type","content-length"];Object.entries(c).forEach(([d,g])=>{f.includes(d.toLowerCase())&&s.set(d,g)})}}if(en.hasStandardBrowserEnv&&(n&&ye.isFunction(n)&&(n=n(t)),n||n!==!1&&RV(t.url))){const c=i&&o&&_V.read(o);c&&s.set(i,c)}return t},AV=typeof XMLHttpRequest<"u",$V=AV&&function(e){return new Promise(function(r,n){const i=J2(e);let o=i.data;const s=$n.from(i.headers).normalize();let{responseType:u,onUploadProgress:c,onDownloadProgress:f}=i,d,g,h,b,v;function S(){b&&b(),v&&v(),i.cancelToken&&i.cancelToken.unsubscribe(d),i.signal&&i.signal.removeEventListener("abort",d)}let y=new XMLHttpRequest;y.open(i.method.toUpperCase(),i.url,!0),y.timeout=i.timeout;function E(){if(!y)return;const T=$n.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),R={data:!u||u==="text"||u==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:T,config:e,request:y};K2(function(O){r(O),S()},function(O){n(O),S()},R),y=null}"onloadend"in y?y.onloadend=E:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(E)},y.onabort=function(){y&&(n(new ut("Request aborted",ut.ECONNABORTED,e,y)),y=null)},y.onerror=function(A){const R=A&&A.message?A.message:"Network Error",$=new ut(R,ut.ERR_NETWORK,e,y);$.event=A||null,n($),y=null},y.ontimeout=function(){let A=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const R=i.transitional||Q1;i.timeoutErrorMessage&&(A=i.timeoutErrorMessage),n(new ut(A,R.clarifyTimeoutError?ut.ETIMEDOUT:ut.ECONNABORTED,e,y)),y=null},o===void 0&&s.setContentType(null),"setRequestHeader"in y&&ye.forEach(s.toJSON(),function(A,R){y.setRequestHeader(R,A)}),ye.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),u&&u!=="json"&&(y.responseType=i.responseType),f&&([h,v]=xp(f,!0),y.addEventListener("progress",h)),c&&y.upload&&([g,b]=xp(c),y.upload.addEventListener("progress",g),y.upload.addEventListener("loadend",b)),(i.cancelToken||i.signal)&&(d=T=>{y&&(n(!T||T.type?new Bc(null,e,y):T),y.abort(),y=null)},i.cancelToken&&i.cancelToken.subscribe(d),i.signal&&(i.signal.aborted?d():i.signal.addEventListener("abort",d)));const x=xV(i.url);if(x&&en.protocols.indexOf(x)===-1){n(new ut("Unsupported protocol "+x+":",ut.ERR_BAD_REQUEST,e));return}y.send(o||null)})},IV=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let n=new AbortController,i;const o=function(f){if(!i){i=!0,u();const d=f instanceof Error?f:this.reason;n.abort(d instanceof ut?d:new Bc(d instanceof Error?d.message:d))}};let s=t&&setTimeout(()=>{s=null,o(new ut(`timeout of ${t}ms exceeded`,ut.ETIMEDOUT))},t);const u=()=>{e&&(s&&clearTimeout(s),s=null,e.forEach(f=>{f.unsubscribe?f.unsubscribe(o):f.removeEventListener("abort",o)}),e=null)};e.forEach(f=>f.addEventListener("abort",o));const{signal:c}=n;return c.unsubscribe=()=>ye.asap(u),c}},PV=function*(e,t){let r=e.byteLength;if(r<t){yield e;return}let n=0,i;for(;n<r;)i=n+t,yield e.slice(n,i),n=i},kV=async function*(e,t){for await(const r of MV(e))yield*PV(r,t)},MV=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:r,value:n}=await t.read();if(r)break;yield n}}finally{await t.cancel()}},oO=(e,t,r,n)=>{const i=kV(e,t);let o=0,s,u=c=>{s||(s=!0,n&&n(c))};return new ReadableStream({async pull(c){try{const{done:f,value:d}=await i.next();if(f){u(),c.close();return}let g=d.byteLength;if(r){let h=o+=g;r(h)}c.enqueue(new Uint8Array(d))}catch(f){throw u(f),f}},cancel(c){return u(c),i.return()}},{highWaterMark:2})},aO=64*1024,{isFunction:yd}=ye,DV=(({Request:e,Response:t})=>({Request:e,Response:t}))(ye.global),{ReadableStream:sO,TextEncoder:lO}=ye.global,uO=(e,...t)=>{try{return!!e(...t)}catch{return!1}},LV=e=>{e=ye.merge.call({skipUndefined:!0},DV,e);const{fetch:t,Request:r,Response:n}=e,i=t?yd(t):typeof fetch=="function",o=yd(r),s=yd(n);if(!i)return!1;const u=i&&yd(sO),c=i&&(typeof lO=="function"?(v=>S=>v.encode(S))(new lO):async v=>new Uint8Array(await new r(v).arrayBuffer())),f=o&&u&&uO(()=>{let v=!1;const S=new r(en.origin,{body:new sO,method:"POST",get duplex(){return v=!0,"half"}}).headers.has("Content-Type");return v&&!S}),d=s&&u&&uO(()=>ye.isReadableStream(new n("").body)),g={stream:d&&(v=>v.body)};i&&["text","arrayBuffer","blob","formData","stream"].forEach(v=>{!g[v]&&(g[v]=(S,y)=>{let E=S&&S[v];if(E)return E.call(S);throw new ut(`Response type '${v}' is not supported`,ut.ERR_NOT_SUPPORT,y)})});const h=async v=>{if(v==null)return 0;if(ye.isBlob(v))return v.size;if(ye.isSpecCompliantForm(v))return(await new r(en.origin,{method:"POST",body:v}).arrayBuffer()).byteLength;if(ye.isArrayBufferView(v)||ye.isArrayBuffer(v))return v.byteLength;if(ye.isURLSearchParams(v)&&(v=v+""),ye.isString(v))return(await c(v)).byteLength},b=async(v,S)=>{const y=ye.toFiniteNumber(v.getContentLength());return y??h(S)};return async v=>{let{url:S,method:y,data:E,signal:x,cancelToken:T,timeout:A,onDownloadProgress:R,onUploadProgress:$,responseType:O,headers:I,withCredentials:L="same-origin",fetchOptions:F}=J2(v),q=t||fetch;O=O?(O+"").toLowerCase():"text";let z=IV([x,T&&T.toAbortSignal()],A),B=null;const N=z&&z.unsubscribe&&(()=>{z.unsubscribe()});let j;try{if($&&f&&y!=="get"&&y!=="head"&&(j=await b(I,E))!==0){let D=new r(S,{method:"POST",body:E,duplex:"half"}),P;if(ye.isFormData(E)&&(P=D.headers.get("content-type"))&&I.setContentType(P),D.body){const[G,Z]=rO(j,xp(nO($)));E=oO(D.body,aO,G,Z)}}ye.isString(L)||(L=L?"include":"omit");const H=o&&"credentials"in r.prototype,X={...F,signal:z,method:y.toUpperCase(),headers:I.normalize().toJSON(),body:E,duplex:"half",credentials:H?L:void 0};B=o&&new r(S,X);let M=await(o?q(B,F):q(S,X));const Q=d&&(O==="stream"||O==="response");if(d&&(R||Q&&N)){const D={};["status","statusText","headers"].forEach(te=>{D[te]=M[te]});const P=ye.toFiniteNumber(M.headers.get("content-length")),[G,Z]=R&&rO(P,xp(nO(R),!0))||[];M=new n(oO(M.body,aO,G,()=>{Z&&Z(),N&&N()}),D)}O=O||"text";let W=await g[ye.findKey(g,O)||"text"](M,v);return!Q&&N&&N(),await new Promise((D,P)=>{K2(D,P,{data:W,headers:$n.from(M.headers),status:M.status,statusText:M.statusText,config:v,request:B})})}catch(H){throw N&&N(),H&&H.name==="TypeError"&&/Load failed|fetch/i.test(H.message)?Object.assign(new ut("Network Error",ut.ERR_NETWORK,v,B,H&&H.response),{cause:H.cause||H}):ut.from(H,H&&H.code,v,B,H&&H.response)}}},FV=new Map,Q2=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:i}=t,o=[n,i,r];let s=o.length,u=s,c,f,d=FV;for(;u--;)c=o[u],f=d.get(c),f===void 0&&d.set(c,f=u?new Map:LV(t)),d=f;return f};Q2();const eS={http:eV,xhr:$V,fetch:{get:Q2}};ye.forEach(eS,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const cO=e=>`- ${e}`,NV=e=>ye.isFunction(e)||e===null||e===!1;function jV(e,t){e=ye.isArray(e)?e:[e];const{length:r}=e;let n,i;const o={};for(let s=0;s<r;s++){n=e[s];let u;if(i=n,!NV(n)&&(i=eS[(u=String(n)).toLowerCase()],i===void 0))throw new ut(`Unknown adapter '${u}'`);if(i&&(ye.isFunction(i)||(i=i.get(t))))break;o[u||"#"+s]=i}if(!i){const s=Object.entries(o).map(([c,f])=>`adapter ${c} `+(f===!1?"is not supported by the environment":"is not available in the build"));let u=r?s.length>1?`since :
|
|
528
528
|
`+s.map(cO).join(`
|
package/dist/rozenite.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@ledgerhq/device-management-kit-devtools-rozenite","version":"0.0.0-develop-
|
|
1
|
+
{"name":"@ledgerhq/device-management-kit-devtools-rozenite","version":"0.0.0-develop-20260403001844","description":"Inspect and debug your integration of the Device Management Kit","panels":[{"name":"DMK DevTools","source":"/index.html"}]}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"dependencies": {
|
|
3
3
|
"@rozenite/plugin-bridge": "1.1.0",
|
|
4
4
|
"rxjs": "7.8.2",
|
|
5
|
-
"@ledgerhq/device-management-kit-devtools-ui": "0.0.0-develop-
|
|
5
|
+
"@ledgerhq/device-management-kit-devtools-ui": "0.0.0-develop-20260403001844"
|
|
6
6
|
},
|
|
7
7
|
"description": "Inspect and debug your integration of the Device Management Kit",
|
|
8
8
|
"devDependencies": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"rozenite": "1.1.0",
|
|
16
16
|
"typescript": "5.9.2",
|
|
17
17
|
"vite": "7.1.6",
|
|
18
|
-
"@ledgerhq/device-management-kit-devtools-core": "0.0.0-develop-
|
|
18
|
+
"@ledgerhq/device-management-kit-devtools-core": "0.0.0-develop-20260403001844"
|
|
19
19
|
},
|
|
20
20
|
"files": [
|
|
21
21
|
"./dist"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "*",
|
|
29
29
|
"react-native": "*",
|
|
30
|
-
"@ledgerhq/device-management-kit-devtools-core": "0.0.0-develop-
|
|
30
|
+
"@ledgerhq/device-management-kit-devtools-core": "0.0.0-develop-20260403001844"
|
|
31
31
|
},
|
|
32
32
|
"private": false,
|
|
33
33
|
"repository": {
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"type": "module",
|
|
38
38
|
"types": "./dist/react-native.d.ts",
|
|
39
|
-
"version": "0.0.0-develop-
|
|
39
|
+
"version": "0.0.0-develop-20260403001844",
|
|
40
40
|
"scripts": {
|
|
41
41
|
"build": "rozenite build",
|
|
42
42
|
"dev": "rozenite dev"
|