@wormhole-foundation/wormhole-connect 4.0.0-beta.0-development → 4.0.0
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/assets/{aptos-CIKjhZ5R.js → aptos-CaGPw7HM.js} +2 -2
- package/dist/assets/create-54a95t1x.js +1 -0
- package/dist/assets/{evm-Ky_mCHhS.js → evm-Bv0RsFka.js} +2 -2
- package/dist/assets/{index-DW7sWcdW.js → index-B5JfIVKE.js} +1 -1
- package/dist/assets/{index-DHLr3HmO.js → index-BCD-VOiF.js} +1 -1
- package/dist/assets/index-BwhO0jGm.js +1 -0
- package/dist/assets/{index-DpM61P6H.js → index-CMULoTsT.js} +1 -1
- package/dist/assets/{index-DZpeOp3V.js → index-CO4HXUmy.js} +1 -1
- package/dist/assets/{index-Bg3NWSHL.js → index-COw2RtBx.js} +1 -1
- package/dist/assets/{index-DRk-Cj0P.js → index-ClrVAZUa.js} +1 -1
- package/dist/assets/{index-D7RgFG0F.js → index-CzQeh-hT.js} +1 -1
- package/dist/assets/{index-Csghphw2.js → index-DC4mZtDw.js} +1 -1
- package/dist/assets/{index-Cqs_fFht.js → index-DI-xN_q3.js} +1 -1
- package/dist/assets/{index-DVbfoP0w.js → index-DRsHBjoG.js} +1 -1
- package/dist/assets/{index-CdAFGcxx.js → index-DXcQbQ8r.js} +1 -1
- package/dist/assets/{index-DJ52h-dV.js → index-DxHhcWFS.js} +1 -1
- package/dist/assets/{index-g9iLhWvp.js → index-GKTf0CV7.js} +1 -1
- package/dist/assets/{index-DuR9wYhp.js → index-aoYIFErC.js} +1 -1
- package/dist/assets/{index-DfNgilHG.js → index-jixjwN_L.js} +1 -1
- package/dist/assets/{solana-jYIeIu4B.js → solana-DpD0VkQS.js} +2 -2
- package/dist/assets/{sui-B96bqBVv.js → sui-7K04yY2U.js} +2 -2
- package/dist/main.js +75 -75
- package/dist/src/components/TokenBalance.d.ts.map +1 -1
- package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
- package/dist/src/config/testnet/tokens.d.ts.map +1 -1
- package/dist/src/contexts/wallet/WalletProvider.d.ts.map +1 -1
- package/dist/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
- package/dist/src/hooks/useTokenListWithSearch.d.ts +1 -4
- package/dist/src/hooks/useTokenListWithSearch.d.ts.map +1 -1
- package/dist/src/routes/operator.d.ts.map +1 -1
- package/dist/src/routes/sdkv2/route.d.ts +2 -2
- package/dist/src/routes/sdkv2/route.d.ts.map +1 -1
- package/dist/src/telemetry/types.d.ts +1 -0
- package/dist/src/telemetry/types.d.ts.map +1 -1
- package/dist/src/utils/sdkv2.d.ts.map +1 -1
- package/dist/src/utils/wrappedNativeTokens.d.ts +12 -0
- package/dist/src/utils/wrappedNativeTokens.d.ts.map +1 -0
- package/dist/src/views/Terms.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/SearchableList/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/TokenSectionHeader.d.ts +2 -4
- package/dist/src/views/v3/Bridge/AssetPicker/TokenSectionHeader.d.ts.map +1 -1
- package/lib/{account-D0Q4K1CI.js → account-24z6tDMM.js} +1 -1
- package/lib/{account-BdDruAAr.mjs → account-BcnWVXmg.mjs} +1 -1
- package/lib/{address-fSXS9iww.mjs → address-BX2fIOro.mjs} +1 -1
- package/lib/{address-BO6rj6uK.js → address-Bc-5yO4D.js} +1 -1
- package/lib/{aptos-BnKScTtI.mjs → aptos-DO_Sexq-.mjs} +7 -7
- package/lib/{aptos-B3C7cnvM.js → aptos-DffuIzI0.js} +2 -2
- package/lib/{aptos-B1VSCmD9.mjs → aptos-Dol0ReEK.mjs} +4 -4
- package/lib/{aptos-DG7QN21P.js → aptos-eGdJuKke.js} +1 -1
- package/lib/{basic-CN2jAqvS.js → basic-B3aoOwRb.js} +1 -1
- package/lib/{basic-BRYkcAmD.mjs → basic-BI1HDLIO.mjs} +4 -4
- package/lib/{basic-Cw13RoYq.mjs → basic-C6oQe5cg.mjs} +4 -4
- package/lib/{basic-DufHOLGA.js → basic-pJmrDH53.js} +1 -1
- package/lib/{blake2b-CT6EW399.mjs → blake2b-CVpPk5O9.mjs} +1 -1
- package/lib/{blake2b-B_Q_lTGN.js → blake2b-DXExLbRg.js} +1 -1
- package/lib/{browser-ponyfill-CnfcLhK-.mjs → browser-ponyfill-DeOApqpH.mjs} +1 -1
- package/lib/{browser-ponyfill-DbGoEOBo.js → browser-ponyfill-VhIu9z_I.js} +1 -1
- package/lib/{chain-BCKkYvDb.js → chain-BxNUWKZE.js} +1 -1
- package/lib/{chain-_dXKRkCE.mjs → chain-CvZsIsLh.mjs} +1 -1
- package/lib/{chunk-KJH4KKG6-RA0hChr8.mjs → chunk-KJH4KKG6-BgebMATq.mjs} +2 -2
- package/lib/{chunk-KJH4KKG6-BXBLZwfY.js → chunk-KJH4KKG6-DNlN4p21.js} +1 -1
- package/lib/{constants-QsbOfMbk.mjs → constants-BPs5UFxq.mjs} +1 -1
- package/lib/constants-BqHCu7gS.js +1 -0
- package/lib/{contract-MkLF5rqi.js → contract-CTycrpaK.js} +1 -1
- package/lib/{contract-C_4H8x77.mjs → contract-KYuIk_vR.mjs} +1 -1
- package/lib/{core-Cpb3gtg_.js → core-BN_eDiBJ.js} +3 -3
- package/lib/{core-ntLR7o2S.mjs → core-BZzw8R4f.mjs} +6 -6
- package/lib/{create-naslyPfU.mjs → create-BvzkkBPW.mjs} +1 -1
- package/lib/{create-CfgTxAS-.js → create-CGZYy2vu.js} +1 -1
- package/lib/{evm-aSG_vFbw.js → evm-BdbjSrMR.js} +2 -2
- package/lib/{evm-B20n3mf_.mjs → evm-CUhPokEi.mjs} +7 -7
- package/lib/{evm-C6xp3v8Z.mjs → evm-IC5cigOX.mjs} +9 -9
- package/lib/{evm-B3G2Vkzg.js → evm-bdCQPjof.js} +2 -2
- package/lib/executor.js +1 -1
- package/lib/executor.mjs +815 -572
- package/lib/hosted.js +1 -1
- package/lib/hosted.mjs +1 -1
- package/lib/{index-B9ybSY9R.mjs → index-1boJ8yzF.mjs} +5 -5
- package/lib/{index-BJcbyvof.js → index-943_uCEO.js} +1 -1
- package/lib/{index-Dq7WWqFe.js → index-B7HBnPLP.js} +1 -1
- package/lib/{index-DQX74QAE.js → index-BFBwRlid.js} +1 -1
- package/lib/{index-C6XNAQ4w.js → index-BZZZ8OeS.js} +1 -1
- package/lib/{index-CU73EUQW.js → index-BeBO_sCU.js} +1 -1
- package/lib/{index-BTUx12aa.js → index-Bhwzpq1T.js} +1 -1
- package/lib/{index-MsaML_Ju.mjs → index-Bicx897u.mjs} +2 -2
- package/lib/{index-Dajw3Alx.mjs → index-BlWksu-f.mjs} +1 -1
- package/lib/{index-QlIJYJce.js → index-Blvg4PFN.js} +66 -66
- package/lib/{index-DS8bl8fA.mjs → index-Bn0hkKKz.mjs} +4 -4
- package/lib/{index-tztRp3yJ.js → index-BnMkdrhM.js} +1 -1
- package/lib/{index-BojkMsXD.js → index-BoKTcLq-.js} +1 -1
- package/lib/{index-BRYq_Nt2.mjs → index-Bp4ojxz6.mjs} +4 -4
- package/lib/{index-Cnznwcdb.js → index-BqabgGIh.js} +1 -1
- package/lib/{index-DxYgNWMY.mjs → index-BtEjOWoP.mjs} +3 -3
- package/lib/{index-Bhd_YhUf.js → index-C9Bk-rKp.js} +1 -1
- package/lib/{index-YAL4zolc.js → index-C9uGqcwH.js} +1 -1
- package/lib/{index-BQvEIlB2.mjs → index-CBGUPQXa.mjs} +3 -3
- package/lib/{index-IHxtA-NL.js → index-CGpn3INM.js} +1 -1
- package/lib/{index-DSmKiYkD.mjs → index-CQ0RB2r3.mjs} +5 -5
- package/lib/{index-7_BfcP8x.mjs → index-CR3DmYPt.mjs} +2105 -2021
- package/lib/{index-BRyW-hBN.mjs → index-CTpINVAG.mjs} +2 -2
- package/lib/{index-C3LC73WN.js → index-CbFvm_Mr.js} +1 -1
- package/lib/{index-bNUantLb.js → index-CjjP3Qp5.js} +1 -1
- package/lib/{index-DqzqJgVc.mjs → index-CkvxfaqA.mjs} +3 -3
- package/lib/{index-DfDB5FLw.js → index-ClMpLrxa.js} +1 -1
- package/lib/{index-B7VNYedX.mjs → index-CtU_hkYp.mjs} +4 -4
- package/lib/index-Cv9hvmqc.js +1 -0
- package/lib/{index-DMOY218i.js → index-CzRVzbTC.js} +1 -1
- package/lib/{index-B4S4sz6p.mjs → index-Czxl_5Tr.mjs} +5 -5
- package/lib/{index-Cb9lswnP.js → index-D61fXWwH.js} +8 -8
- package/lib/{index-D0XQIiQn.js → index-D6qJDbzm.js} +1 -1
- package/lib/{index-C3L-xKvN.mjs → index-DJs1h8_N.mjs} +4839 -4850
- package/lib/{index-BD0gcmCp.mjs → index-DPpi4Don.mjs} +5 -5
- package/lib/{index-D5ENAOm3.js → index-DmsirrTI.js} +1 -1
- package/lib/{index-DnO0ZdKy.mjs → index-DpN0dULN.mjs} +1 -1
- package/lib/{index-BNuKzxGJ.js → index-DydXCN0v.js} +1 -1
- package/lib/{index-D-H8WyKb.mjs → index-N8cPdMnf.mjs} +1 -1
- package/lib/{index-CSMunRpZ.mjs → index-NKV6j8zE.mjs} +3 -3
- package/lib/{index-BIYx5IBr.mjs → index-OlMuNft9.mjs} +3 -3
- package/lib/{index-Bz7ogqhR.mjs → index-UOvy4usi.mjs} +1 -1
- package/lib/{index-D1y-l93C.js → index-UbeUI3Ir.js} +1 -1
- package/lib/{index-BZYEbYGY.mjs → index-ZGgSxaDf.mjs} +3 -3
- package/lib/{index-DFpSbD7R.mjs → index-_e8uUnEK.mjs} +5 -5
- package/lib/{index-vhQ5Q8ov.mjs → index-dU3yVyBt.mjs} +52 -97
- package/lib/{index.es-C476iHvN.mjs → index.es-B5hLka3L.mjs} +4 -4
- package/lib/{index.es-CkGpObng.js → index.es-CSmeunOk.js} +3 -3
- package/lib/{index.es-CU6nhwJO.js → index.es-E2DQPkYK.js} +1 -1
- package/lib/{index.es-CtiAoQ78.mjs → index.es-Vlpe_OYB.mjs} +3 -3
- package/lib/index.js +1 -1
- package/lib/index.mjs +5 -5
- package/lib/mayan.js +1 -1
- package/lib/mayan.mjs +11 -11
- package/lib/{mint-zy6P38iu.js → mint-B4t2SvV6.js} +1 -1
- package/lib/{mint-DyoU9X22.mjs → mint-BGuU5y5m.mjs} +1 -1
- package/lib/ntt.js +1 -1
- package/lib/ntt.mjs +14 -12
- package/lib/{platform-x3ZBJ0YM.js → platform-Bkbg7A9d.js} +1 -1
- package/lib/{platform-BqpAMtgx.mjs → platform-C5gJAqtZ.mjs} +3 -3
- package/lib/{platform-BhspUaMJ.js → platform-C6QB7aIN.js} +1 -1
- package/lib/{platform-DQfpyXSV.mjs → platform-DBNvSsue.mjs} +4 -4
- package/lib/{platform-BHAZvZ_O.mjs → platform-DtB8gGMl.mjs} +4 -4
- package/lib/{platform-4nANkJAM.js → platform-qdbxkhTI.js} +1 -1
- package/lib/{provider-jsonrpc-DIXcAw4Q.mjs → provider-jsonrpc-BIIDy-Aw.mjs} +2 -2
- package/lib/{provider-jsonrpc-BCKoIijx.js → provider-jsonrpc-DHzam3ud.js} +1 -1
- package/lib/{secp256k1-CaaRyr2C.mjs → secp256k1-B-wUOgWh.mjs} +1 -1
- package/lib/{secp256k1-CFt7TfEF.js → secp256k1-BAjH_sHz.js} +1 -1
- package/lib/{secp256k1-UnRv5Suy.mjs → secp256k1-CpJIg24C.mjs} +1 -1
- package/lib/{secp256k1-C60XBS-e.js → secp256k1-Ds1M1Mtb.js} +1 -1
- package/lib/{secp256k1-BIiWvuxu.js → secp256k1-PbbUc2aU.js} +1 -1
- package/lib/{secp256k1-BWFGSbjt.mjs → secp256k1-YWWAmpaN.mjs} +1 -1
- package/lib/{signer-DhO2iGae.mjs → signer-BH3gAHuj.mjs} +2 -2
- package/lib/{signer-BFY1Ytf6.js → signer-MBixef_P.js} +1 -1
- package/lib/{solana-CQk4ocg8.mjs → solana-Bh5bkUXQ.mjs} +11 -11
- package/lib/solana-C8xK8qJY.mjs +18 -0
- package/lib/solana-CRSliekb.js +1 -0
- package/lib/{solana-Cp49k9--.js → solana-sjjxa4_B.js} +4 -4
- package/lib/{solanaEmbed.esm-Cwa6cl_R.js → solanaEmbed.esm-CDt8Bk0U.js} +1 -1
- package/lib/{solanaEmbed.esm-DBOqO9Ii.mjs → solanaEmbed.esm-DGgxfQDB.mjs} +3 -3
- package/lib/src/components/TokenBalance.d.ts.map +1 -1
- package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
- package/lib/src/config/testnet/tokens.d.ts.map +1 -1
- package/lib/src/contexts/wallet/WalletProvider.d.ts.map +1 -1
- package/lib/src/hooks/useFetchSupportedRoutes.d.ts.map +1 -1
- package/lib/src/hooks/useTokenListWithSearch.d.ts +1 -4
- package/lib/src/hooks/useTokenListWithSearch.d.ts.map +1 -1
- package/lib/src/routes/operator.d.ts.map +1 -1
- package/lib/src/routes/sdkv2/route.d.ts +2 -2
- package/lib/src/routes/sdkv2/route.d.ts.map +1 -1
- package/lib/src/telemetry/types.d.ts +1 -0
- package/lib/src/telemetry/types.d.ts.map +1 -1
- package/lib/src/utils/sdkv2.d.ts.map +1 -1
- package/lib/src/utils/wrappedNativeTokens.d.ts +12 -0
- package/lib/src/utils/wrappedNativeTokens.d.ts.map +1 -0
- package/lib/src/views/Terms.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/SearchableList/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/TokenList.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/TokenSectionHeader.d.ts +2 -4
- package/lib/src/views/v3/Bridge/AssetPicker/TokenSectionHeader.d.ts.map +1 -1
- package/lib/{sui-9gsoM56W.js → sui-Do5RtJvP.js} +1 -1
- package/lib/{sui-Cr98JBgS.js → sui-QcDjGW68.js} +1 -1
- package/lib/{sui-B4RvzEXx.mjs → sui-euceXgYf.mjs} +7 -7
- package/lib/{sui-C2a1eehP.mjs → sui-tKXg9e-c.mjs} +4 -4
- package/lib/{tokens-BbFKf6Hv.mjs → tokens-CNITO7DN.mjs} +3 -3
- package/lib/{tokens-LVHsSbYG.js → tokens-DhBcLH6x.js} +1 -1
- package/lib/{transfer-DZ-wNocj.js → transfer-BinEH6ml.js} +1 -1
- package/lib/{transfer-BV1ou1GP.mjs → transfer-DTvv5m_5.mjs} +2 -2
- package/lib/{units-BqUlbZ46.mjs → units-CVEv4txp.mjs} +2 -2
- package/lib/{units-D-oRQjOa.js → units-DtldPRXy.js} +1 -1
- package/lib/{unsignedTransaction-BmxD6VsY.mjs → unsignedTransaction-CVE7GUdC.mjs} +3 -3
- package/lib/{unsignedTransaction-CiPKh85X.js → unsignedTransaction-DL3WyIkF.js} +1 -1
- package/lib/{w3m-modal-CoTG8Zu4.js → w3m-modal-BUP-c20y.js} +1 -1
- package/lib/{w3m-modal-D4-nrnEK.mjs → w3m-modal-Bj2tG9wb.mjs} +2 -2
- package/lib/{w3m-modal-xqVExHU-.js → w3m-modal-CGeDlu49.js} +1 -1
- package/lib/{w3m-modal-3qLkbPfi.mjs → w3m-modal-D78VqEEI.mjs} +2 -2
- package/lib/{web3-C1wK6wIV.js → web3-BKaP497Y.js} +1 -1
- package/lib/{web3-BkEb7AgB.mjs → web3-BifDBsFp.mjs} +8 -4
- package/package.json +49 -44
- package/dist/assets/create-q7V6muDT.js +0 -1
- package/dist/assets/index-B59bCuJJ.js +0 -1
- package/lib/constants-BR_zyzqY.js +0 -1
- package/lib/index-CXsUtRJQ.js +0 -1
- package/lib/solana-Dv_mUYcl.mjs +0 -18
- package/lib/solana-g3YsP966.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{k as Z,o as Lr,dy as Tr,dz as Cr,g as Dn,P as X,bo as yt,dA as be,B as Y,R as Ye,ae as Bn,T as Un,dl as Nn,dm as Mn,dr as Rr,dq as Or,E as Vt}from"../main.js";function Mo(r){if(r!==void 0)return{connection:r}}var xe={},L={},Ft;function zt(){if(Ft)return L;Ft=1;class r{constructor(o,a){if(!Number.isInteger(o))throw new TypeError("span must be an integer");this.span=o,this.property=a}makeDestinationObject(){return{}}decode(o,a){throw new Error("Layout is abstract")}encode(o,a,f){throw new Error("Layout is abstract")}getSpan(o,a){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(o){const a=Object.create(this.constructor.prototype);return Object.assign(a,this),a.property=o,a}fromArray(o){}}L.Layout=r;function t(g,o){return o.property?g+"["+o.property+"]":g}L.nameWithProperty=t;function e(g,o){if(typeof g!="function")throw new TypeError("Class must be constructor");if(g.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(o&&o instanceof r))throw new TypeError("layout must be a Layout");if(o.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");g.layout_=o,o.boundConstructor_=g,o.makeDestinationObject=(()=>new g),Object.defineProperty(g.prototype,"encode",{value:function(a,f){return o.encode(this,a,f)},writable:!0}),Object.defineProperty(g,"decode",{value:function(a,f){return o.decode(a,f)},writable:!0})}L.bindConstructorLayout=e;class n extends r{isCount(){throw new Error("ExternalLayout is abstract")}}class s extends n{constructor(o,a){if(o===void 0&&(o=1),!Number.isInteger(o)||0>=o)throw new TypeError("elementSpan must be a (positive) integer");super(-1,a),this.elementSpan=o}isCount(){return!0}decode(o,a){a===void 0&&(a=0);const f=o.length-a;return Math.floor(f/this.elementSpan)}encode(o,a,f){return 0}}class i extends n{constructor(o,a,f){if(!(o instanceof r))throw new TypeError("layout must be a Layout");if(a===void 0)a=0;else if(!Number.isInteger(a))throw new TypeError("offset must be integer or undefined");super(o.span,f||o.property),this.layout=o,this.offset=a}isCount(){return this.layout instanceof u||this.layout instanceof c}decode(o,a){return a===void 0&&(a=0),this.layout.decode(o,a+this.offset)}encode(o,a,f){return f===void 0&&(f=0),this.layout.encode(o,a,f+this.offset)}}class u extends r{constructor(o,a){if(super(o,a),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(o,a){return a===void 0&&(a=0),o.readUIntLE(a,this.span)}encode(o,a,f){return f===void 0&&(f=0),a.writeUIntLE(o,f,this.span),this.span}}class c extends r{constructor(o,a){if(super(o,a),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(o,a){return a===void 0&&(a=0),o.readUIntBE(a,this.span)}encode(o,a,f){return f===void 0&&(f=0),a.writeUIntBE(o,f,this.span),this.span}}class w extends r{constructor(o,a){if(super(o,a),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(o,a){return a===void 0&&(a=0),o.readIntLE(a,this.span)}encode(o,a,f){return f===void 0&&(f=0),a.writeIntLE(o,f,this.span),this.span}}class l extends r{constructor(o,a){if(super(o,a),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(o,a){return a===void 0&&(a=0),o.readIntBE(a,this.span)}encode(o,a,f){return f===void 0&&(f=0),a.writeIntBE(o,f,this.span),this.span}}const d=Math.pow(2,32);function b(g){const o=Math.floor(g/d),a=g-o*d;return{hi32:o,lo32:a}}function y(g,o){return g*d+o}class p extends r{constructor(o){super(8,o)}decode(o,a){a===void 0&&(a=0);const f=o.readUInt32LE(a),E=o.readUInt32LE(a+4);return y(E,f)}encode(o,a,f){f===void 0&&(f=0);const E=b(o);return a.writeUInt32LE(E.lo32,f),a.writeUInt32LE(E.hi32,f+4),8}}class m extends r{constructor(o){super(8,o)}decode(o,a){a===void 0&&(a=0);const f=o.readUInt32BE(a),E=o.readUInt32BE(a+4);return y(f,E)}encode(o,a,f){f===void 0&&(f=0);const E=b(o);return a.writeUInt32BE(E.hi32,f),a.writeUInt32BE(E.lo32,f+4),8}}class I extends r{constructor(o){super(8,o)}decode(o,a){a===void 0&&(a=0);const f=o.readUInt32LE(a),E=o.readInt32LE(a+4);return y(E,f)}encode(o,a,f){f===void 0&&(f=0);const E=b(o);return a.writeUInt32LE(E.lo32,f),a.writeInt32LE(E.hi32,f+4),8}}class _ extends r{constructor(o){super(8,o)}decode(o,a){a===void 0&&(a=0);const f=o.readInt32BE(a),E=o.readUInt32BE(a+4);return y(f,E)}encode(o,a,f){f===void 0&&(f=0);const E=b(o);return a.writeInt32BE(E.hi32,f),a.writeUInt32BE(E.lo32,f+4),8}}class A extends r{constructor(o){super(4,o)}decode(o,a){return a===void 0&&(a=0),o.readFloatLE(a)}encode(o,a,f){return f===void 0&&(f=0),a.writeFloatLE(o,f),4}}class O extends r{constructor(o){super(4,o)}decode(o,a){return a===void 0&&(a=0),o.readFloatBE(a)}encode(o,a,f){return f===void 0&&(f=0),a.writeFloatBE(o,f),4}}class k extends r{constructor(o){super(8,o)}decode(o,a){return a===void 0&&(a=0),o.readDoubleLE(a)}encode(o,a,f){return f===void 0&&(f=0),a.writeDoubleLE(o,f),8}}class x extends r{constructor(o){super(8,o)}decode(o,a){return a===void 0&&(a=0),o.readDoubleBE(a)}encode(o,a,f){return f===void 0&&(f=0),a.writeDoubleBE(o,f),8}}class U extends r{constructor(o,a,f){if(!(o instanceof r))throw new TypeError("elementLayout must be a Layout");if(!(a instanceof n&&a.isCount()||Number.isInteger(a)&&0<=a))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let E=-1;!(a instanceof n)&&0<o.span&&(E=a*o.span),super(E,f),this.elementLayout=o,this.count=a}getSpan(o,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let f=0,E=this.count;if(E instanceof n&&(E=E.decode(o,a)),0<this.elementLayout.span)f=E*this.elementLayout.span;else{let T=0;for(;T<E;)f+=this.elementLayout.getSpan(o,a+f),++T}return f}decode(o,a){a===void 0&&(a=0);const f=[];let E=0,T=this.count;for(T instanceof n&&(T=T.decode(o,a));E<T;)f.push(this.elementLayout.decode(o,a)),a+=this.elementLayout.getSpan(o,a),E+=1;return f}encode(o,a,f){f===void 0&&(f=0);const E=this.elementLayout,T=o.reduce((F,H)=>F+E.encode(H,a,f+F),0);return this.count instanceof n&&this.count.encode(o.length,a,f),T}}class z extends r{constructor(o,a,f){if(!(Array.isArray(o)&&o.reduce((T,F)=>T&&F instanceof r,!0)))throw new TypeError("fields must be array of Layout instances");typeof a=="boolean"&&f===void 0&&(f=a,a=void 0);for(const T of o)if(0>T.span&&T.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let E=-1;try{E=o.reduce((T,F)=>T+F.getSpan(),0)}catch{}super(E,a),this.fields=o,this.decodePrefixes=!!f}getSpan(o,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let f=0;try{f=this.fields.reduce((E,T)=>{const F=T.getSpan(o,a);return a+=F,E+F},0)}catch{throw new RangeError("indeterminate span")}return f}decode(o,a){a===void 0&&(a=0);const f=this.makeDestinationObject();for(const E of this.fields)if(E.property!==void 0&&(f[E.property]=E.decode(o,a)),a+=E.getSpan(o,a),this.decodePrefixes&&o.length===a)break;return f}encode(o,a,f){f===void 0&&(f=0);const E=f;let T=0,F=0;for(const H of this.fields){let Ae=H.span;if(F=0<Ae?Ae:0,H.property!==void 0){const jt=o[H.property];jt!==void 0&&(F=H.encode(jt,a,f),0>Ae&&(Ae=H.getSpan(a,f)))}T=f,f+=Ae}return T+F-E}fromArray(o){const a=this.makeDestinationObject();for(const f of this.fields)f.property!==void 0&&0<o.length&&(a[f.property]=o.shift());return a}layoutFor(o){if(typeof o!="string")throw new TypeError("property must be string");for(const a of this.fields)if(a.property===o)return a}offsetOf(o){if(typeof o!="string")throw new TypeError("property must be string");let a=0;for(const f of this.fields){if(f.property===o)return a;0>f.span?a=-1:0<=a&&(a+=f.span)}}}class P{constructor(o){this.property=o}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class M extends P{constructor(o,a){if(!(o instanceof n&&o.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(a||o.property||"variant"),this.layout=o}decode(o,a){return this.layout.decode(o,a)}encode(o,a,f){return this.layout.encode(o,a,f)}}class $ extends r{constructor(o,a,f){const E=o instanceof u||o instanceof c;if(E)o=new M(new i(o));else if(o instanceof n&&o.isCount())o=new M(o);else if(!(o instanceof P))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(a===void 0&&(a=null),!(a===null||a instanceof r))throw new TypeError("defaultLayout must be null or a Layout");if(a!==null){if(0>a.span)throw new Error("defaultLayout must have constant span");a.property===void 0&&(a=a.replicate("content"))}let T=-1;a&&(T=a.span,0<=T&&E&&(T+=o.layout.span)),super(T,f),this.discriminator=o,this.usesPrefixDiscriminator=E,this.defaultLayout=a,this.registry={};let F=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(H){return F(H)},this.configGetSourceVariant=function(H){F=H.bind(this)}}getSpan(o,a){if(0<=this.span)return this.span;a===void 0&&(a=0);const f=this.getVariant(o,a);if(!f)throw new Error("unable to determine span for unrecognized variant");return f.getSpan(o,a)}defaultGetSourceVariant(o){if(o.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&o.hasOwnProperty(this.defaultLayout.property))return;const a=this.registry[o[this.discriminator.property]];if(a&&(!a.layout||o.hasOwnProperty(a.property)))return a}else for(const a in this.registry){const f=this.registry[a];if(o.hasOwnProperty(f.property))return f}throw new Error("unable to infer src variant")}decode(o,a){a===void 0&&(a=0);let f;const E=this.discriminator,T=E.decode(o,a);let F=this.registry[T];if(F===void 0){let H=0;F=this.defaultLayout,this.usesPrefixDiscriminator&&(H=E.layout.span),f=this.makeDestinationObject(),f[E.property]=T,f[F.property]=this.defaultLayout.decode(o,a+H)}else f=F.decode(o,a);return f}encode(o,a,f){f===void 0&&(f=0);const E=this.getSourceVariant(o);if(E===void 0){const T=this.discriminator,F=this.defaultLayout;let H=0;return this.usesPrefixDiscriminator&&(H=T.layout.span),T.encode(o[T.property],a,f),H+F.encode(o[F.property],a,f+H)}return E.encode(o,a,f)}addVariant(o,a,f){const E=new N(this,o,a,f);return this.registry[o]=E,E}getVariant(o,a){let f=o;return Z.isBuffer(o)&&(a===void 0&&(a=0),f=this.discriminator.decode(o,a)),this.registry[f]}}class N extends r{constructor(o,a,f,E){if(!(o instanceof $))throw new TypeError("union must be a Union");if(!Number.isInteger(a)||0>a)throw new TypeError("variant must be a (non-negative) integer");if(typeof f=="string"&&E===void 0&&(E=f,f=null),f){if(!(f instanceof r))throw new TypeError("layout must be a Layout");if(o.defaultLayout!==null&&0<=f.span&&f.span>o.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof E!="string")throw new TypeError("variant must have a String property")}let T=o.span;0>o.span&&(T=f?f.span:0,0<=T&&o.usesPrefixDiscriminator&&(T+=o.discriminator.layout.span)),super(T,E),this.union=o,this.variant=a,this.layout=f||null}getSpan(o,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let f=0;return this.union.usesPrefixDiscriminator&&(f=this.union.discriminator.layout.span),f+this.layout.getSpan(o,a+f)}decode(o,a){const f=this.makeDestinationObject();if(a===void 0&&(a=0),this!==this.union.getVariant(o,a))throw new Error("variant mismatch");let E=0;return this.union.usesPrefixDiscriminator&&(E=this.union.discriminator.layout.span),this.layout?f[this.property]=this.layout.decode(o,a+E):this.property?f[this.property]=!0:this.union.usesPrefixDiscriminator&&(f[this.union.discriminator.property]=this.variant),f}encode(o,a,f){f===void 0&&(f=0);let E=0;if(this.union.usesPrefixDiscriminator&&(E=this.union.discriminator.layout.span),this.layout&&!o.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,a,f);let T=E;if(this.layout&&(this.layout.encode(o[this.property],a,f+E),T+=this.layout.getSpan(a,f+E),0<=this.union.span&&T>this.union.span))throw new Error("encoded variant overruns containing union");return T}fromArray(o){if(this.layout)return this.layout.fromArray(o)}}function D(g){return 0>g&&(g+=4294967296),g}class R extends r{constructor(o,a,f){if(!(o instanceof u||o instanceof c))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof a=="string"&&f===void 0&&(f=a,a=void 0),4<o.span)throw new RangeError("word cannot exceed 32 bits");super(o.span,f),this.word=o,this.msb=!!a,this.fields=[];let E=0;this._packedSetValue=function(T){return E=D(T),this},this._packedGetValue=function(){return E}}decode(o,a){const f=this.makeDestinationObject();a===void 0&&(a=0);const E=this.word.decode(o,a);this._packedSetValue(E);for(const T of this.fields)T.property!==void 0&&(f[T.property]=T.decode(E));return f}encode(o,a,f){f===void 0&&(f=0);const E=this.word.decode(a,f);this._packedSetValue(E);for(const T of this.fields)if(T.property!==void 0){const F=o[T.property];F!==void 0&&T.encode(F)}return this.word.encode(this._packedGetValue(),a,f)}addField(o,a){const f=new S(this,o,a);return this.fields.push(f),f}addBoolean(o){const a=new h(this,o);return this.fields.push(a),a}fieldFor(o){if(typeof o!="string")throw new TypeError("property must be string");for(const a of this.fields)if(a.property===o)return a}}class S{constructor(o,a,f){if(!(o instanceof R))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(a)||0>=a)throw new TypeError("bits must be positive integer");const E=8*o.span,T=o.fields.reduce((F,H)=>F+H.bits,0);if(a+T>E)throw new Error("bits too long for span remainder ("+(E-T)+" of "+E+" remain)");this.container=o,this.bits=a,this.valueMask=(1<<a)-1,a===32&&(this.valueMask=4294967295),this.start=T,this.container.msb&&(this.start=E-T-a),this.wordMask=D(this.valueMask<<this.start),this.property=f}decode(){const o=this.container._packedGetValue();return D(o&this.wordMask)>>>this.start}encode(o){if(!Number.isInteger(o)||o!==D(o&this.valueMask))throw new TypeError(t("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const a=this.container._packedGetValue(),f=D(o<<this.start);this.container._packedSetValue(D(a&~this.wordMask)|f)}}class h extends S{constructor(o,a){super(o,1,a)}decode(o,a){return!!S.prototype.decode.call(this,o,a)}encode(o){return typeof o=="boolean"&&(o=+o),S.prototype.encode.call(this,o)}}class v extends r{constructor(o,a){if(!(o instanceof n&&o.isCount()||Number.isInteger(o)&&0<=o))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let f=-1;o instanceof n||(f=o),super(f,a),this.length=o}getSpan(o,a){let f=this.span;return 0>f&&(f=this.length.decode(o,a)),f}decode(o,a){a===void 0&&(a=0);let f=this.span;return 0>f&&(f=this.length.decode(o,a)),o.slice(a,a+f)}encode(o,a,f){let E=this.length;if(this.length instanceof n&&(E=o.length),!(Z.isBuffer(o)&&E===o.length))throw new TypeError(t("Blob.encode",this)+" requires (length "+E+") Buffer as src");if(f+E>a.length)throw new RangeError("encoding overruns Buffer");return a.write(o.toString("hex"),f,E,"hex"),this.length instanceof n&&this.length.encode(E,a,f),E}}class C extends r{constructor(o){super(-1,o)}getSpan(o,a){if(!Z.isBuffer(o))throw new TypeError("b must be a Buffer");a===void 0&&(a=0);let f=a;for(;f<o.length&&o[f]!==0;)f+=1;return 1+f-a}decode(o,a,f){a===void 0&&(a=0);let E=this.getSpan(o,a);return o.slice(a,a+E-1).toString("utf-8")}encode(o,a,f){f===void 0&&(f=0),typeof o!="string"&&(o=o.toString());const E=new Z(o,"utf8"),T=E.length;if(f+T>a.length)throw new RangeError("encoding overruns Buffer");return E.copy(a,f),a[f+T]=0,T+1}}class V extends r{constructor(o,a){if(typeof o=="string"&&a===void 0&&(a=o,o=void 0),o===void 0)o=-1;else if(!Number.isInteger(o))throw new TypeError("maxSpan must be an integer");super(-1,a),this.maxSpan=o}getSpan(o,a){if(!Z.isBuffer(o))throw new TypeError("b must be a Buffer");return a===void 0&&(a=0),o.length-a}decode(o,a,f){a===void 0&&(a=0);let E=this.getSpan(o,a);if(0<=this.maxSpan&&this.maxSpan<E)throw new RangeError("text length exceeds maxSpan");return o.slice(a,a+E).toString("utf-8")}encode(o,a,f){f===void 0&&(f=0),typeof o!="string"&&(o=o.toString());const E=new Z(o,"utf8"),T=E.length;if(0<=this.maxSpan&&this.maxSpan<T)throw new RangeError("text length exceeds maxSpan");if(f+T>a.length)throw new RangeError("encoding overruns Buffer");return E.copy(a,f),T}}class K extends r{constructor(o,a){super(0,a),this.value=o}decode(o,a,f){return this.value}encode(o,a,f){return 0}}return L.ExternalLayout=n,L.GreedyCount=s,L.OffsetLayout=i,L.UInt=u,L.UIntBE=c,L.Int=w,L.IntBE=l,L.Float=A,L.FloatBE=O,L.Double=k,L.DoubleBE=x,L.Sequence=U,L.Structure=z,L.UnionDiscriminator=P,L.UnionLayoutDiscriminator=M,L.Union=$,L.VariantLayout=N,L.BitStructure=R,L.BitField=S,L.Boolean=h,L.Blob=v,L.CString=C,L.UTF8=V,L.Constant=K,L.greedy=((g,o)=>new s(g,o)),L.offset=((g,o,a)=>new i(g,o,a)),L.u8=(g=>new u(1,g)),L.u16=(g=>new u(2,g)),L.u24=(g=>new u(3,g)),L.u32=(g=>new u(4,g)),L.u40=(g=>new u(5,g)),L.u48=(g=>new u(6,g)),L.nu64=(g=>new p(g)),L.u16be=(g=>new c(2,g)),L.u24be=(g=>new c(3,g)),L.u32be=(g=>new c(4,g)),L.u40be=(g=>new c(5,g)),L.u48be=(g=>new c(6,g)),L.nu64be=(g=>new m(g)),L.s8=(g=>new w(1,g)),L.s16=(g=>new w(2,g)),L.s24=(g=>new w(3,g)),L.s32=(g=>new w(4,g)),L.s40=(g=>new w(5,g)),L.s48=(g=>new w(6,g)),L.ns64=(g=>new I(g)),L.s16be=(g=>new l(2,g)),L.s24be=(g=>new l(3,g)),L.s32be=(g=>new l(4,g)),L.s40be=(g=>new l(5,g)),L.s48be=(g=>new l(6,g)),L.ns64be=(g=>new _(g)),L.f32=(g=>new A(g)),L.f32be=(g=>new O(g)),L.f64=(g=>new k(g)),L.f64be=(g=>new x(g)),L.struct=((g,o,a)=>new z(g,o,a)),L.bits=((g,o,a)=>new R(g,o,a)),L.seq=((g,o,a)=>new U(g,o,a)),L.union=((g,o,a)=>new $(g,o,a)),L.unionLayoutDiscriminator=((g,o)=>new M(g,o)),L.blob=((g,o)=>new v(g,o)),L.cstr=(g=>new C(g)),L.utf8=((g,o)=>new V(g,o)),L.const=((g,o)=>new K(g,o)),L}const Pr=Lr(Tr);var qt;function Dr(){return qt||(qt=1,(function(r){var t=xe&&xe.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=zt(),n=Pr,s=t(Cr());var i=zt();Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return i.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return i.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return i.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return i.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return i.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return i.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return i.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return i.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return i.struct}});class u extends e.Layout{constructor(S,h,v){super(S,v),this.blob=(0,e.blob)(S),this.signed=h}decode(S,h=0){const v=new s.default(this.blob.decode(S,h),10,"le");return this.signed?v.fromTwos(this.span*8).clone():v}encode(S,h,v=0){return this.signed&&(S=S.toTwos(this.span*8)),this.blob.encode(S.toArrayLike(Z,"le",this.span),h,v)}}function c(R){return new u(8,!1,R)}r.u64=c;function w(R){return new u(8,!0,R)}r.i64=w;function l(R){return new u(16,!1,R)}r.u128=l;function d(R){return new u(16,!0,R)}r.i128=d;function b(R){return new u(32,!1,R)}r.u256=b;function y(R){return new u(32,!0,R)}r.i256=y;class p extends e.Layout{constructor(S,h,v,C){super(S.span,C),this.layout=S,this.decoder=h,this.encoder=v}decode(S,h){return this.decoder(this.layout.decode(S,h))}encode(S,h,v){return this.layout.encode(this.encoder(S),h,v)}getSpan(S,h){return this.layout.getSpan(S,h)}}function m(R){return new p((0,e.blob)(32),S=>new n.PublicKey(S),S=>S.toBuffer(),R)}r.publicKey=m;class I extends e.Layout{constructor(S,h){super(-1,h),this.layout=S,this.discriminator=(0,e.u8)()}encode(S,h,v=0){return S==null?this.discriminator.encode(0,h,v):(this.discriminator.encode(1,h,v),this.layout.encode(S,h,v+1)+1)}decode(S,h=0){const v=this.discriminator.decode(S,h);if(v===0)return null;if(v===1)return this.layout.decode(S,h+1);throw new Error("Invalid option "+this.property)}getSpan(S,h=0){const v=this.discriminator.decode(S,h);if(v===0)return 1;if(v===1)return this.layout.getSpan(S,h+1)+1;throw new Error("Invalid option "+this.property)}}function _(R,S){return new I(R,S)}r.option=_;function A(R){return new p((0,e.u8)(),O,k,R)}r.bool=A;function O(R){if(R===0)return!1;if(R===1)return!0;throw new Error("Invalid bool: "+R)}function k(R){return R?1:0}function x(R,S){const h=(0,e.u32)("length"),v=(0,e.struct)([h,(0,e.seq)(R,(0,e.offset)(h,-h.span),"values")]);return new p(v,({values:C})=>C,C=>({values:C}),S)}r.vec=x;function U(R,S,h){const v=(0,e.struct)([c("tag"),S.replicate("data")]);function C({tag:V,data:K}){if(!V.eq(R))throw new Error("Invalid tag, expected: "+R.toString("hex")+", got: "+V.toString("hex"));return K}return new p(v,C,V=>({tag:R,data:V}),h)}r.tagged=U;function z(R){const S=(0,e.u32)("length"),h=(0,e.struct)([S,(0,e.blob)((0,e.offset)(S,-S.span),"data")]);return new p(h,({data:v})=>v,v=>({data:v}),R)}r.vecU8=z;function P(R){return new p(z(),S=>S.toString("utf-8"),S=>Z.from(S,"utf-8"),R)}r.str=P;function M(R,S,h){const v=(0,e.union)(h??(0,e.u8)(),S);return R.forEach((C,V)=>v.addVariant(V,C,C.property)),v}r.rustEnum=M;function $(R,S,h){const v=(0,e.struct)([(0,e.seq)(R,S,"values")]);return new p(v,({values:C})=>C,C=>({values:C}),h)}r.array=$;class N extends e.Layout{constructor(S,h,v){super(S.span+h.span,v),this.keyLayout=S,this.valueLayout=h}decode(S,h){h=h||0;const v=this.keyLayout.decode(S,h),C=this.valueLayout.decode(S,h+this.keyLayout.getSpan(S,h));return[v,C]}encode(S,h,v){v=v||0;const C=this.keyLayout.encode(S[0],h,v),V=this.valueLayout.encode(S[1],h,v+C);return C+V}getSpan(S,h){return this.keyLayout.getSpan(S,h)+this.valueLayout.getSpan(S,h)}}function D(R,S,h){const v=(0,e.u32)("length"),C=(0,e.struct)([v,(0,e.seq)(new N(R,S),(0,e.offset)(v,-v.span),"values")]);return new p(C,({values:V})=>new Map(V),V=>({values:Array.from(V.entries())}),h)}r.map=D})(xe)),xe}var j=Dr(),Ne={exports:{}},Gt;function Br(){if(Gt)return Ne.exports;Gt=1;const r=/[\p{Lu}]/u,t=/[\p{Ll}]/u,e=/^[\p{Lu}](?![\p{Lu}])/gu,n=/([\p{Alpha}\p{N}_]|$)/u,s=/[_.\- ]+/,i=new RegExp("^"+s.source),u=new RegExp(s.source+n.source,"gu"),c=new RegExp("\\d+"+n.source,"gu"),w=(y,p,m)=>{let I=!1,_=!1,A=!1;for(let O=0;O<y.length;O++){const k=y[O];I&&r.test(k)?(y=y.slice(0,O)+"-"+y.slice(O),I=!1,A=_,_=!0,O++):_&&A&&t.test(k)?(y=y.slice(0,O-1)+"-"+y.slice(O-1),A=_,_=!1,I=!0):(I=p(k)===k&&m(k)!==k,A=_,_=m(k)===k&&p(k)!==k)}return y},l=(y,p)=>(e.lastIndex=0,y.replace(e,m=>p(m))),d=(y,p)=>(u.lastIndex=0,c.lastIndex=0,y.replace(u,(m,I)=>p(I)).replace(c,m=>p(m))),b=(y,p)=>{if(!(typeof y=="string"||Array.isArray(y)))throw new TypeError("Expected the input to be `string | string[]`");if(p={pascalCase:!1,preserveConsecutiveUppercase:!1,...p},Array.isArray(y)?y=y.map(A=>A.trim()).filter(A=>A.length).join("-"):y=y.trim(),y.length===0)return"";const m=p.locale===!1?A=>A.toLowerCase():A=>A.toLocaleLowerCase(p.locale),I=p.locale===!1?A=>A.toUpperCase():A=>A.toLocaleUpperCase(p.locale);return y.length===1?p.pascalCase?I(y):m(y):(y!==m(y)&&(y=w(y,m,I)),y=y.replace(i,""),p.preserveConsecutiveUppercase?y=l(y,m):y=m(y),p.pascalCase&&(y=I(y.charAt(0))+y.slice(1)),d(y,I))};return Ne.exports=b,Ne.exports.default=b,Ne.exports}var Ur=Br();const G=Dn(Ur);function Ee(r){let t=r.length;for(;--t>=0;)r[t]=0}const Nr=3,Mr=258,$n=29,$r=256,jr=$r+1+$n,jn=30,Vr=512,Fr=new Array((jr+2)*2);Ee(Fr);const zr=new Array(jn*2);Ee(zr);const qr=new Array(Vr);Ee(qr);const Gr=new Array(Mr-Nr+1);Ee(Gr);const Kr=new Array($n);Ee(Kr);const Zr=new Array(jn);Ee(Zr);const Hr=(r,t,e,n)=>{let s=r&65535|0,i=r>>>16&65535|0,u=0;for(;e!==0;){u=e>2e3?2e3:e,e-=u;do s=s+t[n++]|0,i=i+s|0;while(--u);s%=65521,i%=65521}return s|i<<16|0};var gt=Hr;const Wr=()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t},Xr=new Uint32Array(Wr()),Yr=(r,t,e,n)=>{const s=Xr,i=n+e;r^=-1;for(let u=n;u<i;u++)r=r>>>8^s[(r^t[u])&255];return r^-1};var ie=Yr,mt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Vn={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const Jr=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var Qr=function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)Jr(e,n)&&(r[n]=e[n])}}return r},ei=r=>{let t=0;for(let n=0,s=r.length;n<s;n++)t+=r[n].length;const e=new Uint8Array(t);for(let n=0,s=0,i=r.length;n<i;n++){let u=r[n];e.set(u,s),s+=u.length}return e},Fn={assign:Qr,flattenChunks:ei};let zn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{zn=!1}const Te=new Uint8Array(256);for(let r=0;r<256;r++)Te[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Te[254]=Te[254]=1;var ti=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,s,i,u=r.length,c=0;for(s=0;s<u;s++)e=r.charCodeAt(s),(e&64512)===55296&&s+1<u&&(n=r.charCodeAt(s+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),s++)),c+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(c),i=0,s=0;i<c;s++)e=r.charCodeAt(s),(e&64512)===55296&&s+1<u&&(n=r.charCodeAt(s+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),s++)),e<128?t[i++]=e:e<2048?(t[i++]=192|e>>>6,t[i++]=128|e&63):e<65536?(t[i++]=224|e>>>12,t[i++]=128|e>>>6&63,t[i++]=128|e&63):(t[i++]=240|e>>>18,t[i++]=128|e>>>12&63,t[i++]=128|e>>>6&63,t[i++]=128|e&63);return t};const ni=(r,t)=>{if(t<65534&&r.subarray&&zn)return String.fromCharCode.apply(null,r.length===t?r:r.subarray(0,t));let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(r[n]);return e};var ri=(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,s;const i=new Array(e*2);for(s=0,n=0;n<e;){let u=r[n++];if(u<128){i[s++]=u;continue}let c=Te[u];if(c>4){i[s++]=65533,n+=c-1;continue}for(u&=c===2?31:c===3?15:7;c>1&&n<e;)u=u<<6|r[n++]&63,c--;if(c>1){i[s++]=65533;continue}u<65536?i[s++]=u:(u-=65536,i[s++]=55296|u>>10&1023,i[s++]=56320|u&1023)}return ni(i,s)},ii=(r,t)=>{t=t||r.length,t>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(r[e]&192)===128;)e--;return e<0||e===0?t:e+Te[r[e]]>t?e:t},vt={string2buf:ti,buf2string:ri,utf8border:ii};function si(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var oi=si;const Me=16209,ai=16191;var ci=function(t,e){let n,s,i,u,c,w,l,d,b,y,p,m,I,_,A,O,k,x,U,z,P,M,$,N;const D=t.state;n=t.next_in,$=t.input,s=n+(t.avail_in-5),i=t.next_out,N=t.output,u=i-(e-t.avail_out),c=i+(t.avail_out-257),w=D.dmax,l=D.wsize,d=D.whave,b=D.wnext,y=D.window,p=D.hold,m=D.bits,I=D.lencode,_=D.distcode,A=(1<<D.lenbits)-1,O=(1<<D.distbits)-1;e:do{m<15&&(p+=$[n++]<<m,m+=8,p+=$[n++]<<m,m+=8),k=I[p&A];t:for(;;){if(x=k>>>24,p>>>=x,m-=x,x=k>>>16&255,x===0)N[i++]=k&65535;else if(x&16){U=k&65535,x&=15,x&&(m<x&&(p+=$[n++]<<m,m+=8),U+=p&(1<<x)-1,p>>>=x,m-=x),m<15&&(p+=$[n++]<<m,m+=8,p+=$[n++]<<m,m+=8),k=_[p&O];n:for(;;){if(x=k>>>24,p>>>=x,m-=x,x=k>>>16&255,x&16){if(z=k&65535,x&=15,m<x&&(p+=$[n++]<<m,m+=8,m<x&&(p+=$[n++]<<m,m+=8)),z+=p&(1<<x)-1,z>w){t.msg="invalid distance too far back",D.mode=Me;break e}if(p>>>=x,m-=x,x=i-u,z>x){if(x=z-x,x>d&&D.sane){t.msg="invalid distance too far back",D.mode=Me;break e}if(P=0,M=y,b===0){if(P+=l-x,x<U){U-=x;do N[i++]=y[P++];while(--x);P=i-z,M=N}}else if(b<x){if(P+=l+b-x,x-=b,x<U){U-=x;do N[i++]=y[P++];while(--x);if(P=0,b<U){x=b,U-=x;do N[i++]=y[P++];while(--x);P=i-z,M=N}}}else if(P+=b-x,x<U){U-=x;do N[i++]=y[P++];while(--x);P=i-z,M=N}for(;U>2;)N[i++]=M[P++],N[i++]=M[P++],N[i++]=M[P++],U-=3;U&&(N[i++]=M[P++],U>1&&(N[i++]=M[P++]))}else{P=i-z;do N[i++]=N[P++],N[i++]=N[P++],N[i++]=N[P++],U-=3;while(U>2);U&&(N[i++]=N[P++],U>1&&(N[i++]=N[P++]))}}else if((x&64)===0){k=_[(k&65535)+(p&(1<<x)-1)];continue n}else{t.msg="invalid distance code",D.mode=Me;break e}break}}else if((x&64)===0){k=I[(k&65535)+(p&(1<<x)-1)];continue t}else if(x&32){D.mode=ai;break e}else{t.msg="invalid literal/length code",D.mode=Me;break e}break}}while(n<s&&i<c);U=m>>3,n-=U,m-=U<<3,p&=(1<<m)-1,t.next_in=n,t.next_out=i,t.avail_in=n<s?5+(s-n):5-(n-s),t.avail_out=i<c?257+(c-i):257-(i-c),D.hold=p,D.bits=m};const me=15,Kt=852,Zt=592,Ht=0,it=1,Wt=2,ui=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),li=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),di=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),fi=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),hi=(r,t,e,n,s,i,u,c)=>{const w=c.bits;let l=0,d=0,b=0,y=0,p=0,m=0,I=0,_=0,A=0,O=0,k,x,U,z,P,M=null,$;const N=new Uint16Array(me+1),D=new Uint16Array(me+1);let R=null,S,h,v;for(l=0;l<=me;l++)N[l]=0;for(d=0;d<n;d++)N[t[e+d]]++;for(p=w,y=me;y>=1&&N[y]===0;y--);if(p>y&&(p=y),y===0)return s[i++]=1<<24|64<<16|0,s[i++]=1<<24|64<<16|0,c.bits=1,0;for(b=1;b<y&&N[b]===0;b++);for(p<b&&(p=b),_=1,l=1;l<=me;l++)if(_<<=1,_-=N[l],_<0)return-1;if(_>0&&(r===Ht||y!==1))return-1;for(D[1]=0,l=1;l<me;l++)D[l+1]=D[l]+N[l];for(d=0;d<n;d++)t[e+d]!==0&&(u[D[t[e+d]]++]=d);if(r===Ht?(M=R=u,$=20):r===it?(M=ui,R=li,$=257):(M=di,R=fi,$=0),O=0,d=0,l=b,P=i,m=p,I=0,U=-1,A=1<<p,z=A-1,r===it&&A>Kt||r===Wt&&A>Zt)return 1;for(;;){S=l-I,u[d]+1<$?(h=0,v=u[d]):u[d]>=$?(h=R[u[d]-$],v=M[u[d]-$]):(h=96,v=0),k=1<<l-I,x=1<<m,b=x;do x-=k,s[P+(O>>I)+x]=S<<24|h<<16|v|0;while(x!==0);for(k=1<<l-1;O&k;)k>>=1;if(k!==0?(O&=k-1,O+=k):O=0,d++,--N[l]===0){if(l===y)break;l=t[e+u[d]]}if(l>p&&(O&z)!==U){for(I===0&&(I=p),P+=b,m=l-I,_=1<<m;m+I<y&&(_-=N[m+I],!(_<=0));)m++,_<<=1;if(A+=1<<m,r===it&&A>Kt||r===Wt&&A>Zt)return 1;U=O&z,s[U]=p<<24|m<<16|P-i|0}}return O!==0&&(s[P+O]=l-I<<24|64<<16|0),c.bits=p,0};var Ie=hi;const pi=0,qn=1,Gn=2,{Z_FINISH:Xt,Z_BLOCK:wi,Z_TREES:$e,Z_OK:ye,Z_STREAM_END:yi,Z_NEED_DICT:gi,Z_STREAM_ERROR:ne,Z_DATA_ERROR:Kn,Z_MEM_ERROR:Zn,Z_BUF_ERROR:mi,Z_DEFLATED:Yt}=Vn,Je=16180,Jt=16181,Qt=16182,en=16183,tn=16184,nn=16185,rn=16186,sn=16187,on=16188,an=16189,Ke=16190,oe=16191,st=16192,cn=16193,ot=16194,un=16195,ln=16196,dn=16197,fn=16198,je=16199,Ve=16200,hn=16201,pn=16202,wn=16203,yn=16204,gn=16205,at=16206,mn=16207,vn=16208,q=16209,Hn=16210,Wn=16211,vi=852,bi=592,_i=15,Ei=_i,bn=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Ai(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ge=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode<Je||t.mode>Wn?1:0},Xn=r=>{if(ge(r))return ne;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=t.wrap&1),t.mode=Je,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(vi),t.distcode=t.distdyn=new Int32Array(bi),t.sane=1,t.back=-1,ye},Yn=r=>{if(ge(r))return ne;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,Xn(r)},Jn=(r,t)=>{let e;if(ge(r))return ne;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?ne:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,Yn(r))},Qn=(r,t)=>{if(!r)return ne;const e=new Ai;r.state=e,e.strm=r,e.window=null,e.mode=Je;const n=Jn(r,t);return n!==ye&&(r.state=null),n},xi=r=>Qn(r,Ei);let _n=!0,ct,ut;const ki=r=>{if(_n){ct=new Int32Array(512),ut=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Ie(qn,r.lens,0,288,ct,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Ie(Gn,r.lens,0,32,ut,0,r.work,{bits:5}),_n=!1}r.lencode=ct,r.lenbits=9,r.distcode=ut,r.distbits=5},er=(r,t,e,n)=>{let s;const i=r.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),n>=i.wsize?(i.window.set(t.subarray(e-i.wsize,e),0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),i.window.set(t.subarray(e-n,e-n+s),i.wnext),n-=s,n?(i.window.set(t.subarray(e-n,e),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=s))),0},Si=(r,t)=>{let e,n,s,i,u,c,w,l,d,b,y,p,m,I,_=0,A,O,k,x,U,z,P,M;const $=new Uint8Array(4);let N,D;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ge(r)||!r.output||!r.input&&r.avail_in!==0)return ne;e=r.state,e.mode===oe&&(e.mode=st),u=r.next_out,s=r.output,w=r.avail_out,i=r.next_in,n=r.input,c=r.avail_in,l=e.hold,d=e.bits,b=c,y=w,M=ye;e:for(;;)switch(e.mode){case Je:if(e.wrap===0){e.mode=st;break}for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.wrap&2&&l===35615){e.wbits===0&&(e.wbits=15),e.check=0,$[0]=l&255,$[1]=l>>>8&255,e.check=ie(e.check,$,2,0),l=0,d=0,e.mode=Jt;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",e.mode=q;break}if((l&15)!==Yt){r.msg="unknown compression method",e.mode=q;break}if(l>>>=4,d-=4,P=(l&15)+8,e.wbits===0&&(e.wbits=P),P>15||P>e.wbits){r.msg="invalid window size",e.mode=q;break}e.dmax=1<<e.wbits,e.flags=0,r.adler=e.check=1,e.mode=l&512?an:oe,l=0,d=0;break;case Jt:for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.flags=l,(e.flags&255)!==Yt){r.msg="unknown compression method",e.mode=q;break}if(e.flags&57344){r.msg="unknown header flags set",e.mode=q;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ie(e.check,$,2,0)),l=0,d=0,e.mode=Qt;case Qt:for(;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.head&&(e.head.time=l),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,$[2]=l>>>16&255,$[3]=l>>>24&255,e.check=ie(e.check,$,4,0)),l=0,d=0,e.mode=en;case en:for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.head&&(e.head.xflags=l&255,e.head.os=l>>8),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ie(e.check,$,2,0)),l=0,d=0,e.mode=tn;case tn:if(e.flags&1024){for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.length=l,e.head&&(e.head.extra_len=l),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ie(e.check,$,2,0)),l=0,d=0}else e.head&&(e.head.extra=null);e.mode=nn;case nn:if(e.flags&1024&&(p=e.length,p>c&&(p=c),p&&(e.head&&(P=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(i,i+p),P)),e.flags&512&&e.wrap&4&&(e.check=ie(e.check,n,p,i)),c-=p,i+=p,e.length-=p),e.length))break e;e.length=0,e.mode=rn;case rn:if(e.flags&2048){if(c===0)break e;p=0;do P=n[i+p++],e.head&&P&&e.length<65536&&(e.head.name+=String.fromCharCode(P));while(P&&p<c);if(e.flags&512&&e.wrap&4&&(e.check=ie(e.check,n,p,i)),c-=p,i+=p,P)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=sn;case sn:if(e.flags&4096){if(c===0)break e;p=0;do P=n[i+p++],e.head&&P&&e.length<65536&&(e.head.comment+=String.fromCharCode(P));while(P&&p<c);if(e.flags&512&&e.wrap&4&&(e.check=ie(e.check,n,p,i)),c-=p,i+=p,P)break e}else e.head&&(e.head.comment=null);e.mode=on;case on:if(e.flags&512){for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.wrap&4&&l!==(e.check&65535)){r.msg="header crc mismatch",e.mode=q;break}l=0,d=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=oe;break;case an:for(;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}r.adler=e.check=bn(l),l=0,d=0,e.mode=Ke;case Ke:if(e.havedict===0)return r.next_out=u,r.avail_out=w,r.next_in=i,r.avail_in=c,e.hold=l,e.bits=d,gi;r.adler=e.check=1,e.mode=oe;case oe:if(t===wi||t===$e)break e;case st:if(e.last){l>>>=d&7,d-=d&7,e.mode=at;break}for(;d<3;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}switch(e.last=l&1,l>>>=1,d-=1,l&3){case 0:e.mode=cn;break;case 1:if(ki(e),e.mode=je,t===$e){l>>>=2,d-=2;break e}break;case 2:e.mode=ln;break;case 3:r.msg="invalid block type",e.mode=q}l>>>=2,d-=2;break;case cn:for(l>>>=d&7,d-=d&7;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if((l&65535)!==(l>>>16^65535)){r.msg="invalid stored block lengths",e.mode=q;break}if(e.length=l&65535,l=0,d=0,e.mode=ot,t===$e)break e;case ot:e.mode=un;case un:if(p=e.length,p){if(p>c&&(p=c),p>w&&(p=w),p===0)break e;s.set(n.subarray(i,i+p),u),c-=p,i+=p,w-=p,u+=p,e.length-=p;break}e.mode=oe;break;case ln:for(;d<14;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.nlen=(l&31)+257,l>>>=5,d-=5,e.ndist=(l&31)+1,l>>>=5,d-=5,e.ncode=(l&15)+4,l>>>=4,d-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=q;break}e.have=0,e.mode=dn;case dn:for(;e.have<e.ncode;){for(;d<3;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.lens[R[e.have++]]=l&7,l>>>=3,d-=3}for(;e.have<19;)e.lens[R[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,N={bits:e.lenbits},M=Ie(pi,e.lens,0,19,e.lencode,0,e.work,N),e.lenbits=N.bits,M){r.msg="invalid code lengths set",e.mode=q;break}e.have=0,e.mode=fn;case fn:for(;e.have<e.nlen+e.ndist;){for(;_=e.lencode[l&(1<<e.lenbits)-1],A=_>>>24,O=_>>>16&255,k=_&65535,!(A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(k<16)l>>>=A,d-=A,e.lens[e.have++]=k;else{if(k===16){for(D=A+2;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(l>>>=A,d-=A,e.have===0){r.msg="invalid bit length repeat",e.mode=q;break}P=e.lens[e.have-1],p=3+(l&3),l>>>=2,d-=2}else if(k===17){for(D=A+3;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=A,d-=A,P=0,p=3+(l&7),l>>>=3,d-=3}else{for(D=A+7;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=A,d-=A,P=0,p=11+(l&127),l>>>=7,d-=7}if(e.have+p>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=q;break}for(;p--;)e.lens[e.have++]=P}}if(e.mode===q)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=q;break}if(e.lenbits=9,N={bits:e.lenbits},M=Ie(qn,e.lens,0,e.nlen,e.lencode,0,e.work,N),e.lenbits=N.bits,M){r.msg="invalid literal/lengths set",e.mode=q;break}if(e.distbits=6,e.distcode=e.distdyn,N={bits:e.distbits},M=Ie(Gn,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,N),e.distbits=N.bits,M){r.msg="invalid distances set",e.mode=q;break}if(e.mode=je,t===$e)break e;case je:e.mode=Ve;case Ve:if(c>=6&&w>=258){r.next_out=u,r.avail_out=w,r.next_in=i,r.avail_in=c,e.hold=l,e.bits=d,ci(r,y),u=r.next_out,s=r.output,w=r.avail_out,i=r.next_in,n=r.input,c=r.avail_in,l=e.hold,d=e.bits,e.mode===oe&&(e.back=-1);break}for(e.back=0;_=e.lencode[l&(1<<e.lenbits)-1],A=_>>>24,O=_>>>16&255,k=_&65535,!(A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(O&&(O&240)===0){for(x=A,U=O,z=k;_=e.lencode[z+((l&(1<<x+U)-1)>>x)],A=_>>>24,O=_>>>16&255,k=_&65535,!(x+A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=x,d-=x,e.back+=x}if(l>>>=A,d-=A,e.back+=A,e.length=k,O===0){e.mode=gn;break}if(O&32){e.back=-1,e.mode=oe;break}if(O&64){r.msg="invalid literal/length code",e.mode=q;break}e.extra=O&15,e.mode=hn;case hn:if(e.extra){for(D=e.extra;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.length+=l&(1<<e.extra)-1,l>>>=e.extra,d-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=pn;case pn:for(;_=e.distcode[l&(1<<e.distbits)-1],A=_>>>24,O=_>>>16&255,k=_&65535,!(A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if((O&240)===0){for(x=A,U=O,z=k;_=e.distcode[z+((l&(1<<x+U)-1)>>x)],A=_>>>24,O=_>>>16&255,k=_&65535,!(x+A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=x,d-=x,e.back+=x}if(l>>>=A,d-=A,e.back+=A,O&64){r.msg="invalid distance code",e.mode=q;break}e.offset=k,e.extra=O&15,e.mode=wn;case wn:if(e.extra){for(D=e.extra;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.offset+=l&(1<<e.extra)-1,l>>>=e.extra,d-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=q;break}e.mode=yn;case yn:if(w===0)break e;if(p=y-w,e.offset>p){if(p=e.offset-p,p>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=q;break}p>e.wnext?(p-=e.wnext,m=e.wsize-p):m=e.wnext-p,p>e.length&&(p=e.length),I=e.window}else I=s,m=u-e.offset,p=e.length;p>w&&(p=w),w-=p,e.length-=p;do s[u++]=I[m++];while(--p);e.length===0&&(e.mode=Ve);break;case gn:if(w===0)break e;s[u++]=e.length,w--,e.mode=Ve;break;case at:if(e.wrap){for(;d<32;){if(c===0)break e;c--,l|=n[i++]<<d,d+=8}if(y-=w,r.total_out+=y,e.total+=y,e.wrap&4&&y&&(r.adler=e.check=e.flags?ie(e.check,s,y,u-y):gt(e.check,s,y,u-y)),y=w,e.wrap&4&&(e.flags?l:bn(l))!==e.check){r.msg="incorrect data check",e.mode=q;break}l=0,d=0}e.mode=mn;case mn:if(e.wrap&&e.flags){for(;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.wrap&4&&l!==(e.total&4294967295)){r.msg="incorrect length check",e.mode=q;break}l=0,d=0}e.mode=vn;case vn:M=yi;break e;case q:M=Kn;break e;case Hn:return Zn;case Wn:default:return ne}return r.next_out=u,r.avail_out=w,r.next_in=i,r.avail_in=c,e.hold=l,e.bits=d,(e.wsize||y!==r.avail_out&&e.mode<q&&(e.mode<at||t!==Xt))&&er(r,r.output,r.next_out,y-r.avail_out),b-=r.avail_in,y-=r.avail_out,r.total_in+=b,r.total_out+=y,e.total+=y,e.wrap&4&&y&&(r.adler=e.check=e.flags?ie(e.check,s,y,r.next_out-y):gt(e.check,s,y,r.next_out-y)),r.data_type=e.bits+(e.last?64:0)+(e.mode===oe?128:0)+(e.mode===je||e.mode===ot?256:0),(b===0&&y===0||t===Xt)&&M===ye&&(M=mi),M},Ii=r=>{if(ge(r))return ne;let t=r.state;return t.window&&(t.window=null),r.state=null,ye},Li=(r,t)=>{if(ge(r))return ne;const e=r.state;return(e.wrap&2)===0?ne:(e.head=t,t.done=!1,ye)},Ti=(r,t)=>{const e=t.length;let n,s,i;return ge(r)||(n=r.state,n.wrap!==0&&n.mode!==Ke)?ne:n.mode===Ke&&(s=1,s=gt(s,t,e,0),s!==n.check)?Kn:(i=er(r,t,e,e),i?(n.mode=Hn,Zn):(n.havedict=1,ye))};var Ci=Yn,Ri=Jn,Oi=Xn,Pi=xi,Di=Qn,Bi=Si,Ui=Ii,Ni=Li,Mi=Ti,$i="pako inflate (from Nodeca project)",ae={inflateReset:Ci,inflateReset2:Ri,inflateResetKeep:Oi,inflateInit:Pi,inflateInit2:Di,inflate:Bi,inflateEnd:Ui,inflateGetHeader:Ni,inflateSetDictionary:Mi,inflateInfo:$i};function ji(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Vi=ji;const tr=Object.prototype.toString,{Z_NO_FLUSH:Fi,Z_FINISH:zi,Z_OK:Ce,Z_STREAM_END:lt,Z_NEED_DICT:dt,Z_STREAM_ERROR:qi,Z_DATA_ERROR:En,Z_MEM_ERROR:Gi}=Vn;function Qe(r){this.options=Fn.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(r&&r.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new oi,this.strm.avail_out=0;let e=ae.inflateInit2(this.strm,t.windowBits);if(e!==Ce)throw new Error(mt[e]);if(this.header=new Vi,ae.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=vt.string2buf(t.dictionary):tr.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=ae.inflateSetDictionary(this.strm,t.dictionary),e!==Ce)))throw new Error(mt[e])}Qe.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let i,u,c;if(this.ended)return!1;for(t===~~t?u=t:u=t===!0?zi:Fi,tr.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),i=ae.inflate(e,u),i===dt&&s&&(i=ae.inflateSetDictionary(e,s),i===Ce?i=ae.inflate(e,u):i===En&&(i=dt));e.avail_in>0&&i===lt&&e.state.wrap>0&&r[e.next_in]!==0;)ae.inflateReset(e),i=ae.inflate(e,u);switch(i){case qi:case En:case dt:case Gi:return this.onEnd(i),this.ended=!0,!1}if(c=e.avail_out,e.next_out&&(e.avail_out===0||i===lt))if(this.options.to==="string"){let w=vt.utf8border(e.output,e.next_out),l=e.next_out-w,d=vt.buf2string(e.output,w);e.next_out=l,e.avail_out=n-l,l&&e.output.set(e.output.subarray(w,w+l),0),this.onData(d)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(i===Ce&&c===0)){if(i===lt)return i=ae.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};Qe.prototype.onData=function(r){this.chunks.push(r)};Qe.prototype.onEnd=function(r){r===Ce&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Fn.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Ki(r,t){const e=new Qe(t);if(e.push(r),e.err)throw e.msg||mt[e.err];return e.result}var Zi=Ki,Hi={inflate:Zi};const{inflate:Wi}=Hi;var Xi=Wi,ft={exports:{}},An;function Yi(){return An||(An=1,(function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function s(w,l,d){this.fn=w,this.context=l,this.once=d||!1}function i(w,l,d,b,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,b||w,y),m=e?e+l:l;return w._events[m]?w._events[m].fn?w._events[m]=[w._events[m],p]:w._events[m].push(p):(w._events[m]=p,w._eventsCount++),w}function u(w,l){--w._eventsCount===0?w._events=new n:delete w._events[l]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var l=[],d,b;if(this._eventsCount===0)return l;for(b in d=this._events)t.call(d,b)&&l.push(e?b.slice(1):b);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},c.prototype.listeners=function(l){var d=e?e+l:l,b=this._events[d];if(!b)return[];if(b.fn)return[b.fn];for(var y=0,p=b.length,m=new Array(p);y<p;y++)m[y]=b[y].fn;return m},c.prototype.listenerCount=function(l){var d=e?e+l:l,b=this._events[d];return b?b.fn?1:b.length:0},c.prototype.emit=function(l,d,b,y,p,m){var I=e?e+l:l;if(!this._events[I])return!1;var _=this._events[I],A=arguments.length,O,k;if(_.fn){switch(_.once&&this.removeListener(l,_.fn,void 0,!0),A){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,b),!0;case 4:return _.fn.call(_.context,d,b,y),!0;case 5:return _.fn.call(_.context,d,b,y,p),!0;case 6:return _.fn.call(_.context,d,b,y,p,m),!0}for(k=1,O=new Array(A-1);k<A;k++)O[k-1]=arguments[k];_.fn.apply(_.context,O)}else{var x=_.length,U;for(k=0;k<x;k++)switch(_[k].once&&this.removeListener(l,_[k].fn,void 0,!0),A){case 1:_[k].fn.call(_[k].context);break;case 2:_[k].fn.call(_[k].context,d);break;case 3:_[k].fn.call(_[k].context,d,b);break;case 4:_[k].fn.call(_[k].context,d,b,y);break;default:if(!O)for(U=1,O=new Array(A-1);U<A;U++)O[U-1]=arguments[U];_[k].fn.apply(_[k].context,O)}}return!0},c.prototype.on=function(l,d,b){return i(this,l,d,b,!1)},c.prototype.once=function(l,d,b){return i(this,l,d,b,!0)},c.prototype.removeListener=function(l,d,b,y){var p=e?e+l:l;if(!this._events[p])return this;if(!d)return u(this,p),this;var m=this._events[p];if(m.fn)m.fn===d&&(!y||m.once)&&(!b||m.context===b)&&u(this,p);else{for(var I=0,_=[],A=m.length;I<A;I++)(m[I].fn!==d||y&&!m[I].once||b&&m[I].context!==b)&&_.push(m[I]);_.length?this._events[p]=_.length===1?_[0]:_:u(this,p)}return this},c.prototype.removeAllListeners=function(l){var d;return l?(d=e?e+l:l,this._events[d]&&u(this,d)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,r.exports=c})(ft)),ft.exports}var Ji=Yi();const Qi=Dn(Ji);function es(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const ke=r=>"version"in r;function ts(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function ns(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2===1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?Y.from([]):Y.from(t.map(e=>parseInt(e,16)))}var rs=Object.freeze({__proto__:null,encode:ts,decode:ns});function nr(r){return new TextDecoder("utf-8").decode(r)}function rr(r){return new TextEncoder().encode(r)}var is=Object.freeze({__proto__:null,decode:nr,encode:rr});function bt(r){return be.encode(r)}function ss(r){return be.decode(r)}var os=Object.freeze({__proto__:null,encode:bt,decode:ss});function _t(r){return r.toString("base64")}function Ct(r){return Y.from(r,"base64")}var as=Object.freeze({__proto__:null,encode:_t,decode:Ct}),cs=Object.freeze({__proto__:null,hex:rs,utf8:is,bs58:os,base64:as});function us(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let s=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,s)}),t}function ls(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(s=>{e[s.name]=t[n],n+=1}),e}function ir(r,t={}){r.forEach(e=>{if("accounts"in e)ir(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function ee(r){return r instanceof X?r:new X(r)}class ds extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:u}=t,c=u.length===0?s:"At path: "+u.join(".")+" -- "+s;super(c),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var w;return(w=n)!=null?w:n=[t,...e()]}}}function fs(r){return _e(r)&&typeof r[Symbol.iterator]=="function"}function _e(r){return typeof r=="object"&&r!=null}function de(r){return typeof r=="string"?JSON.stringify(r):""+r}function hs(r){const{done:t,value:e}=r.next();return t?void 0:e}function ps(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:u}=e,{refinement:c,message:w="Expected a value of type `"+u+"`"+(c?" with refinement `"+c+"`":"")+", but received: `"+de(n)+"`"}=r;return{value:n,type:u,refinement:c,key:s[s.length-1],path:s,branch:i,...r,message:w}}function*xn(r,t,e,n){fs(r)||(r=[r]);for(const s of r){const i=ps(s,t,e,n);i&&(yield i)}}function*Rt(r,t,e){e===void 0&&(e={});const{path:n=[],branch:s=[r],coerce:i=!1,mask:u=!1}=e,c={path:n,branch:s};if(i&&(r=t.coercer(r,c),u&&t.type!=="type"&&_e(t.schema)&&_e(r)&&!Array.isArray(r)))for(const l in r)t.schema[l]===void 0&&delete r[l];let w=!0;for(const l of t.validator(r,c))w=!1,yield[l,void 0];for(let[l,d,b]of t.entries(r,c)){const y=Rt(d,b,{path:l===void 0?n:[...n,l],branch:l===void 0?s:[...s,d],coerce:i,mask:u});for(const p of y)p[0]?(w=!1,yield[p[0],void 0]):i&&(d=p[1],l===void 0?r=d:r instanceof Map?r.set(l,d):r instanceof Set?r.add(d):_e(r)&&(r[l]=d))}if(w)for(const l of t.refiner(r,c))w=!1,yield[l,void 0];w&&(yield[void 0,r])}class fe{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:n,validator:s,refiner:i,coercer:u=w=>w,entries:c=function*(){}}=t;this.type=e,this.schema=n,this.entries=c,this.coercer=u,s?this.validator=(w,l)=>{const d=s(w,l);return xn(d,l,this,w)}:this.validator=()=>[],i?this.refiner=(w,l)=>{const d=i(w,l);return xn(d,l,this,w)}:this.refiner=()=>[]}assert(t){return ws(t,this)}create(t){return Ot(t,this)}is(t){return sr(t,this)}mask(t){return ys(t,this)}validate(t,e){return e===void 0&&(e={}),Pe(t,this,e)}}function ws(r,t){const e=Pe(r,t);if(e[0])throw e[0]}function Ot(r,t){const e=Pe(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function ys(r,t){const e=Pe(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function sr(r,t){return!Pe(r,t)[0]}function Pe(r,t,e){e===void 0&&(e={});const n=Rt(r,t,e),s=hs(n);return s[0]?[new ds(s[0],function*(){for(const u of n)u[0]&&(yield u[0])}),void 0]:[void 0,s[1]]}function De(r,t){return new fe({type:r,schema:null,validator:t})}function gs(){return De("any",()=>!0)}function ht(r){return new fe({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+de(t)}})}function ms(){return De("boolean",r=>typeof r=="boolean")}function kn(r){const t=de(r);return new fe({type:"literal",schema:r,validator(e){return e===r||"Expected the literal `"+t+"`, but received: "+de(e)}})}function Fe(r){return new fe({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function qe(){return De("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+de(r))}function Ge(r){return new fe({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function he(){return De("string",r=>typeof r=="string"||"Expected a string, but received: "+de(r))}function le(r){const t=Object.keys(r);return new fe({type:"type",schema:r,*entries(e){if(_e(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return _e(e)||"Expected an object, but received: "+de(e)}})}function or(r){const t=r.map(e=>e.type).join(" | ");return new fe({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[u]=i.validate(e,{coerce:!0});return!u})||Pt()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...u]=Rt(e,i,n),[c]=u;if(c[0])for(const[w]of u)w&&s.push(w);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+de(e),...s]}})}function Pt(){return De("unknown",()=>!0)}function vs(r,t,e){return new fe({...r,coercer:(n,s)=>sr(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}async function bs(r,t,e,n){r=ee(r),n||(n=Ze());const s=new Bn;if(s.add(new Un({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(s,[])}const Sn=99;async function _s(r,t,e){return(await Dt(r,t,e)).map(s=>s?{publicKey:s.publicKey,account:s.account}:null)}async function Dt(r,t,e){if(t.length<=Sn)return await In(r,t,e);{const n=es(t,Sn);return(await Promise.all(n.map(i=>In(r,i,e)))).flat()}}async function In(r,t,e){const n=e??r.commitment,{value:s,context:i}=await r.getMultipleAccountsInfoAndContext(t,n);return s.map((c,w)=>c===null?null:{publicKey:t[w],account:c,context:i})}async function ar(r,t,e,n,s){var i;e&&e.length>0&&t.sign(...e);const u=t._compile(),c=u.serialize(),l=t._serialize(c).toString("base64"),d={encoding:"base64",commitment:n??r.commitment};if(s){const m=(Array.isArray(s)?s:u.nonProgramIds()).map(I=>I.toBase58());d.accounts={encoding:"base64",addresses:m}}e&&(d.sigVerify=!0);const b=[l,d],y=await r._rpcRequest("simulateTransaction",b),p=Ot(y,ks);if("error"in p){let m;if("data"in p.error&&(m=(i=p.error.data)===null||i===void 0?void 0:i.logs,m&&Array.isArray(m))){const I=`
|
|
1
|
+
import{k as Z,o as Lr,dz as Tr,dA as Cr,g as Dn,P as X,bo as yt,dB as be,B as Y,R as Ye,ae as Bn,T as Un,dm as Nn,dn as Mn,ds as Rr,dr as Or,E as Vt}from"../main.js";function Mo(r){if(r!==void 0)return{connection:r}}var xe={},L={},Ft;function zt(){if(Ft)return L;Ft=1;class r{constructor(o,a){if(!Number.isInteger(o))throw new TypeError("span must be an integer");this.span=o,this.property=a}makeDestinationObject(){return{}}decode(o,a){throw new Error("Layout is abstract")}encode(o,a,f){throw new Error("Layout is abstract")}getSpan(o,a){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(o){const a=Object.create(this.constructor.prototype);return Object.assign(a,this),a.property=o,a}fromArray(o){}}L.Layout=r;function t(g,o){return o.property?g+"["+o.property+"]":g}L.nameWithProperty=t;function e(g,o){if(typeof g!="function")throw new TypeError("Class must be constructor");if(g.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(o&&o instanceof r))throw new TypeError("layout must be a Layout");if(o.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");g.layout_=o,o.boundConstructor_=g,o.makeDestinationObject=(()=>new g),Object.defineProperty(g.prototype,"encode",{value:function(a,f){return o.encode(this,a,f)},writable:!0}),Object.defineProperty(g,"decode",{value:function(a,f){return o.decode(a,f)},writable:!0})}L.bindConstructorLayout=e;class n extends r{isCount(){throw new Error("ExternalLayout is abstract")}}class s extends n{constructor(o,a){if(o===void 0&&(o=1),!Number.isInteger(o)||0>=o)throw new TypeError("elementSpan must be a (positive) integer");super(-1,a),this.elementSpan=o}isCount(){return!0}decode(o,a){a===void 0&&(a=0);const f=o.length-a;return Math.floor(f/this.elementSpan)}encode(o,a,f){return 0}}class i extends n{constructor(o,a,f){if(!(o instanceof r))throw new TypeError("layout must be a Layout");if(a===void 0)a=0;else if(!Number.isInteger(a))throw new TypeError("offset must be integer or undefined");super(o.span,f||o.property),this.layout=o,this.offset=a}isCount(){return this.layout instanceof u||this.layout instanceof c}decode(o,a){return a===void 0&&(a=0),this.layout.decode(o,a+this.offset)}encode(o,a,f){return f===void 0&&(f=0),this.layout.encode(o,a,f+this.offset)}}class u extends r{constructor(o,a){if(super(o,a),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(o,a){return a===void 0&&(a=0),o.readUIntLE(a,this.span)}encode(o,a,f){return f===void 0&&(f=0),a.writeUIntLE(o,f,this.span),this.span}}class c extends r{constructor(o,a){if(super(o,a),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(o,a){return a===void 0&&(a=0),o.readUIntBE(a,this.span)}encode(o,a,f){return f===void 0&&(f=0),a.writeUIntBE(o,f,this.span),this.span}}class w extends r{constructor(o,a){if(super(o,a),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(o,a){return a===void 0&&(a=0),o.readIntLE(a,this.span)}encode(o,a,f){return f===void 0&&(f=0),a.writeIntLE(o,f,this.span),this.span}}class l extends r{constructor(o,a){if(super(o,a),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(o,a){return a===void 0&&(a=0),o.readIntBE(a,this.span)}encode(o,a,f){return f===void 0&&(f=0),a.writeIntBE(o,f,this.span),this.span}}const d=Math.pow(2,32);function b(g){const o=Math.floor(g/d),a=g-o*d;return{hi32:o,lo32:a}}function y(g,o){return g*d+o}class p extends r{constructor(o){super(8,o)}decode(o,a){a===void 0&&(a=0);const f=o.readUInt32LE(a),E=o.readUInt32LE(a+4);return y(E,f)}encode(o,a,f){f===void 0&&(f=0);const E=b(o);return a.writeUInt32LE(E.lo32,f),a.writeUInt32LE(E.hi32,f+4),8}}class m extends r{constructor(o){super(8,o)}decode(o,a){a===void 0&&(a=0);const f=o.readUInt32BE(a),E=o.readUInt32BE(a+4);return y(f,E)}encode(o,a,f){f===void 0&&(f=0);const E=b(o);return a.writeUInt32BE(E.hi32,f),a.writeUInt32BE(E.lo32,f+4),8}}class I extends r{constructor(o){super(8,o)}decode(o,a){a===void 0&&(a=0);const f=o.readUInt32LE(a),E=o.readInt32LE(a+4);return y(E,f)}encode(o,a,f){f===void 0&&(f=0);const E=b(o);return a.writeUInt32LE(E.lo32,f),a.writeInt32LE(E.hi32,f+4),8}}class _ extends r{constructor(o){super(8,o)}decode(o,a){a===void 0&&(a=0);const f=o.readInt32BE(a),E=o.readUInt32BE(a+4);return y(f,E)}encode(o,a,f){f===void 0&&(f=0);const E=b(o);return a.writeInt32BE(E.hi32,f),a.writeUInt32BE(E.lo32,f+4),8}}class A extends r{constructor(o){super(4,o)}decode(o,a){return a===void 0&&(a=0),o.readFloatLE(a)}encode(o,a,f){return f===void 0&&(f=0),a.writeFloatLE(o,f),4}}class O extends r{constructor(o){super(4,o)}decode(o,a){return a===void 0&&(a=0),o.readFloatBE(a)}encode(o,a,f){return f===void 0&&(f=0),a.writeFloatBE(o,f),4}}class k extends r{constructor(o){super(8,o)}decode(o,a){return a===void 0&&(a=0),o.readDoubleLE(a)}encode(o,a,f){return f===void 0&&(f=0),a.writeDoubleLE(o,f),8}}class x extends r{constructor(o){super(8,o)}decode(o,a){return a===void 0&&(a=0),o.readDoubleBE(a)}encode(o,a,f){return f===void 0&&(f=0),a.writeDoubleBE(o,f),8}}class U extends r{constructor(o,a,f){if(!(o instanceof r))throw new TypeError("elementLayout must be a Layout");if(!(a instanceof n&&a.isCount()||Number.isInteger(a)&&0<=a))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let E=-1;!(a instanceof n)&&0<o.span&&(E=a*o.span),super(E,f),this.elementLayout=o,this.count=a}getSpan(o,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let f=0,E=this.count;if(E instanceof n&&(E=E.decode(o,a)),0<this.elementLayout.span)f=E*this.elementLayout.span;else{let T=0;for(;T<E;)f+=this.elementLayout.getSpan(o,a+f),++T}return f}decode(o,a){a===void 0&&(a=0);const f=[];let E=0,T=this.count;for(T instanceof n&&(T=T.decode(o,a));E<T;)f.push(this.elementLayout.decode(o,a)),a+=this.elementLayout.getSpan(o,a),E+=1;return f}encode(o,a,f){f===void 0&&(f=0);const E=this.elementLayout,T=o.reduce((F,H)=>F+E.encode(H,a,f+F),0);return this.count instanceof n&&this.count.encode(o.length,a,f),T}}class z extends r{constructor(o,a,f){if(!(Array.isArray(o)&&o.reduce((T,F)=>T&&F instanceof r,!0)))throw new TypeError("fields must be array of Layout instances");typeof a=="boolean"&&f===void 0&&(f=a,a=void 0);for(const T of o)if(0>T.span&&T.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let E=-1;try{E=o.reduce((T,F)=>T+F.getSpan(),0)}catch{}super(E,a),this.fields=o,this.decodePrefixes=!!f}getSpan(o,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let f=0;try{f=this.fields.reduce((E,T)=>{const F=T.getSpan(o,a);return a+=F,E+F},0)}catch{throw new RangeError("indeterminate span")}return f}decode(o,a){a===void 0&&(a=0);const f=this.makeDestinationObject();for(const E of this.fields)if(E.property!==void 0&&(f[E.property]=E.decode(o,a)),a+=E.getSpan(o,a),this.decodePrefixes&&o.length===a)break;return f}encode(o,a,f){f===void 0&&(f=0);const E=f;let T=0,F=0;for(const H of this.fields){let Ae=H.span;if(F=0<Ae?Ae:0,H.property!==void 0){const jt=o[H.property];jt!==void 0&&(F=H.encode(jt,a,f),0>Ae&&(Ae=H.getSpan(a,f)))}T=f,f+=Ae}return T+F-E}fromArray(o){const a=this.makeDestinationObject();for(const f of this.fields)f.property!==void 0&&0<o.length&&(a[f.property]=o.shift());return a}layoutFor(o){if(typeof o!="string")throw new TypeError("property must be string");for(const a of this.fields)if(a.property===o)return a}offsetOf(o){if(typeof o!="string")throw new TypeError("property must be string");let a=0;for(const f of this.fields){if(f.property===o)return a;0>f.span?a=-1:0<=a&&(a+=f.span)}}}class P{constructor(o){this.property=o}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class M extends P{constructor(o,a){if(!(o instanceof n&&o.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(a||o.property||"variant"),this.layout=o}decode(o,a){return this.layout.decode(o,a)}encode(o,a,f){return this.layout.encode(o,a,f)}}class $ extends r{constructor(o,a,f){const E=o instanceof u||o instanceof c;if(E)o=new M(new i(o));else if(o instanceof n&&o.isCount())o=new M(o);else if(!(o instanceof P))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(a===void 0&&(a=null),!(a===null||a instanceof r))throw new TypeError("defaultLayout must be null or a Layout");if(a!==null){if(0>a.span)throw new Error("defaultLayout must have constant span");a.property===void 0&&(a=a.replicate("content"))}let T=-1;a&&(T=a.span,0<=T&&E&&(T+=o.layout.span)),super(T,f),this.discriminator=o,this.usesPrefixDiscriminator=E,this.defaultLayout=a,this.registry={};let F=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(H){return F(H)},this.configGetSourceVariant=function(H){F=H.bind(this)}}getSpan(o,a){if(0<=this.span)return this.span;a===void 0&&(a=0);const f=this.getVariant(o,a);if(!f)throw new Error("unable to determine span for unrecognized variant");return f.getSpan(o,a)}defaultGetSourceVariant(o){if(o.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&o.hasOwnProperty(this.defaultLayout.property))return;const a=this.registry[o[this.discriminator.property]];if(a&&(!a.layout||o.hasOwnProperty(a.property)))return a}else for(const a in this.registry){const f=this.registry[a];if(o.hasOwnProperty(f.property))return f}throw new Error("unable to infer src variant")}decode(o,a){a===void 0&&(a=0);let f;const E=this.discriminator,T=E.decode(o,a);let F=this.registry[T];if(F===void 0){let H=0;F=this.defaultLayout,this.usesPrefixDiscriminator&&(H=E.layout.span),f=this.makeDestinationObject(),f[E.property]=T,f[F.property]=this.defaultLayout.decode(o,a+H)}else f=F.decode(o,a);return f}encode(o,a,f){f===void 0&&(f=0);const E=this.getSourceVariant(o);if(E===void 0){const T=this.discriminator,F=this.defaultLayout;let H=0;return this.usesPrefixDiscriminator&&(H=T.layout.span),T.encode(o[T.property],a,f),H+F.encode(o[F.property],a,f+H)}return E.encode(o,a,f)}addVariant(o,a,f){const E=new N(this,o,a,f);return this.registry[o]=E,E}getVariant(o,a){let f=o;return Z.isBuffer(o)&&(a===void 0&&(a=0),f=this.discriminator.decode(o,a)),this.registry[f]}}class N extends r{constructor(o,a,f,E){if(!(o instanceof $))throw new TypeError("union must be a Union");if(!Number.isInteger(a)||0>a)throw new TypeError("variant must be a (non-negative) integer");if(typeof f=="string"&&E===void 0&&(E=f,f=null),f){if(!(f instanceof r))throw new TypeError("layout must be a Layout");if(o.defaultLayout!==null&&0<=f.span&&f.span>o.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof E!="string")throw new TypeError("variant must have a String property")}let T=o.span;0>o.span&&(T=f?f.span:0,0<=T&&o.usesPrefixDiscriminator&&(T+=o.discriminator.layout.span)),super(T,E),this.union=o,this.variant=a,this.layout=f||null}getSpan(o,a){if(0<=this.span)return this.span;a===void 0&&(a=0);let f=0;return this.union.usesPrefixDiscriminator&&(f=this.union.discriminator.layout.span),f+this.layout.getSpan(o,a+f)}decode(o,a){const f=this.makeDestinationObject();if(a===void 0&&(a=0),this!==this.union.getVariant(o,a))throw new Error("variant mismatch");let E=0;return this.union.usesPrefixDiscriminator&&(E=this.union.discriminator.layout.span),this.layout?f[this.property]=this.layout.decode(o,a+E):this.property?f[this.property]=!0:this.union.usesPrefixDiscriminator&&(f[this.union.discriminator.property]=this.variant),f}encode(o,a,f){f===void 0&&(f=0);let E=0;if(this.union.usesPrefixDiscriminator&&(E=this.union.discriminator.layout.span),this.layout&&!o.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,a,f);let T=E;if(this.layout&&(this.layout.encode(o[this.property],a,f+E),T+=this.layout.getSpan(a,f+E),0<=this.union.span&&T>this.union.span))throw new Error("encoded variant overruns containing union");return T}fromArray(o){if(this.layout)return this.layout.fromArray(o)}}function D(g){return 0>g&&(g+=4294967296),g}class R extends r{constructor(o,a,f){if(!(o instanceof u||o instanceof c))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof a=="string"&&f===void 0&&(f=a,a=void 0),4<o.span)throw new RangeError("word cannot exceed 32 bits");super(o.span,f),this.word=o,this.msb=!!a,this.fields=[];let E=0;this._packedSetValue=function(T){return E=D(T),this},this._packedGetValue=function(){return E}}decode(o,a){const f=this.makeDestinationObject();a===void 0&&(a=0);const E=this.word.decode(o,a);this._packedSetValue(E);for(const T of this.fields)T.property!==void 0&&(f[T.property]=T.decode(E));return f}encode(o,a,f){f===void 0&&(f=0);const E=this.word.decode(a,f);this._packedSetValue(E);for(const T of this.fields)if(T.property!==void 0){const F=o[T.property];F!==void 0&&T.encode(F)}return this.word.encode(this._packedGetValue(),a,f)}addField(o,a){const f=new S(this,o,a);return this.fields.push(f),f}addBoolean(o){const a=new h(this,o);return this.fields.push(a),a}fieldFor(o){if(typeof o!="string")throw new TypeError("property must be string");for(const a of this.fields)if(a.property===o)return a}}class S{constructor(o,a,f){if(!(o instanceof R))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(a)||0>=a)throw new TypeError("bits must be positive integer");const E=8*o.span,T=o.fields.reduce((F,H)=>F+H.bits,0);if(a+T>E)throw new Error("bits too long for span remainder ("+(E-T)+" of "+E+" remain)");this.container=o,this.bits=a,this.valueMask=(1<<a)-1,a===32&&(this.valueMask=4294967295),this.start=T,this.container.msb&&(this.start=E-T-a),this.wordMask=D(this.valueMask<<this.start),this.property=f}decode(){const o=this.container._packedGetValue();return D(o&this.wordMask)>>>this.start}encode(o){if(!Number.isInteger(o)||o!==D(o&this.valueMask))throw new TypeError(t("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const a=this.container._packedGetValue(),f=D(o<<this.start);this.container._packedSetValue(D(a&~this.wordMask)|f)}}class h extends S{constructor(o,a){super(o,1,a)}decode(o,a){return!!S.prototype.decode.call(this,o,a)}encode(o){return typeof o=="boolean"&&(o=+o),S.prototype.encode.call(this,o)}}class v extends r{constructor(o,a){if(!(o instanceof n&&o.isCount()||Number.isInteger(o)&&0<=o))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let f=-1;o instanceof n||(f=o),super(f,a),this.length=o}getSpan(o,a){let f=this.span;return 0>f&&(f=this.length.decode(o,a)),f}decode(o,a){a===void 0&&(a=0);let f=this.span;return 0>f&&(f=this.length.decode(o,a)),o.slice(a,a+f)}encode(o,a,f){let E=this.length;if(this.length instanceof n&&(E=o.length),!(Z.isBuffer(o)&&E===o.length))throw new TypeError(t("Blob.encode",this)+" requires (length "+E+") Buffer as src");if(f+E>a.length)throw new RangeError("encoding overruns Buffer");return a.write(o.toString("hex"),f,E,"hex"),this.length instanceof n&&this.length.encode(E,a,f),E}}class C extends r{constructor(o){super(-1,o)}getSpan(o,a){if(!Z.isBuffer(o))throw new TypeError("b must be a Buffer");a===void 0&&(a=0);let f=a;for(;f<o.length&&o[f]!==0;)f+=1;return 1+f-a}decode(o,a,f){a===void 0&&(a=0);let E=this.getSpan(o,a);return o.slice(a,a+E-1).toString("utf-8")}encode(o,a,f){f===void 0&&(f=0),typeof o!="string"&&(o=o.toString());const E=new Z(o,"utf8"),T=E.length;if(f+T>a.length)throw new RangeError("encoding overruns Buffer");return E.copy(a,f),a[f+T]=0,T+1}}class V extends r{constructor(o,a){if(typeof o=="string"&&a===void 0&&(a=o,o=void 0),o===void 0)o=-1;else if(!Number.isInteger(o))throw new TypeError("maxSpan must be an integer");super(-1,a),this.maxSpan=o}getSpan(o,a){if(!Z.isBuffer(o))throw new TypeError("b must be a Buffer");return a===void 0&&(a=0),o.length-a}decode(o,a,f){a===void 0&&(a=0);let E=this.getSpan(o,a);if(0<=this.maxSpan&&this.maxSpan<E)throw new RangeError("text length exceeds maxSpan");return o.slice(a,a+E).toString("utf-8")}encode(o,a,f){f===void 0&&(f=0),typeof o!="string"&&(o=o.toString());const E=new Z(o,"utf8"),T=E.length;if(0<=this.maxSpan&&this.maxSpan<T)throw new RangeError("text length exceeds maxSpan");if(f+T>a.length)throw new RangeError("encoding overruns Buffer");return E.copy(a,f),T}}class K extends r{constructor(o,a){super(0,a),this.value=o}decode(o,a,f){return this.value}encode(o,a,f){return 0}}return L.ExternalLayout=n,L.GreedyCount=s,L.OffsetLayout=i,L.UInt=u,L.UIntBE=c,L.Int=w,L.IntBE=l,L.Float=A,L.FloatBE=O,L.Double=k,L.DoubleBE=x,L.Sequence=U,L.Structure=z,L.UnionDiscriminator=P,L.UnionLayoutDiscriminator=M,L.Union=$,L.VariantLayout=N,L.BitStructure=R,L.BitField=S,L.Boolean=h,L.Blob=v,L.CString=C,L.UTF8=V,L.Constant=K,L.greedy=((g,o)=>new s(g,o)),L.offset=((g,o,a)=>new i(g,o,a)),L.u8=(g=>new u(1,g)),L.u16=(g=>new u(2,g)),L.u24=(g=>new u(3,g)),L.u32=(g=>new u(4,g)),L.u40=(g=>new u(5,g)),L.u48=(g=>new u(6,g)),L.nu64=(g=>new p(g)),L.u16be=(g=>new c(2,g)),L.u24be=(g=>new c(3,g)),L.u32be=(g=>new c(4,g)),L.u40be=(g=>new c(5,g)),L.u48be=(g=>new c(6,g)),L.nu64be=(g=>new m(g)),L.s8=(g=>new w(1,g)),L.s16=(g=>new w(2,g)),L.s24=(g=>new w(3,g)),L.s32=(g=>new w(4,g)),L.s40=(g=>new w(5,g)),L.s48=(g=>new w(6,g)),L.ns64=(g=>new I(g)),L.s16be=(g=>new l(2,g)),L.s24be=(g=>new l(3,g)),L.s32be=(g=>new l(4,g)),L.s40be=(g=>new l(5,g)),L.s48be=(g=>new l(6,g)),L.ns64be=(g=>new _(g)),L.f32=(g=>new A(g)),L.f32be=(g=>new O(g)),L.f64=(g=>new k(g)),L.f64be=(g=>new x(g)),L.struct=((g,o,a)=>new z(g,o,a)),L.bits=((g,o,a)=>new R(g,o,a)),L.seq=((g,o,a)=>new U(g,o,a)),L.union=((g,o,a)=>new $(g,o,a)),L.unionLayoutDiscriminator=((g,o)=>new M(g,o)),L.blob=((g,o)=>new v(g,o)),L.cstr=(g=>new C(g)),L.utf8=((g,o)=>new V(g,o)),L.const=((g,o)=>new K(g,o)),L}const Pr=Lr(Tr);var qt;function Dr(){return qt||(qt=1,(function(r){var t=xe&&xe.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=zt(),n=Pr,s=t(Cr());var i=zt();Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return i.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return i.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return i.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return i.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return i.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return i.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return i.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return i.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return i.struct}});class u extends e.Layout{constructor(S,h,v){super(S,v),this.blob=(0,e.blob)(S),this.signed=h}decode(S,h=0){const v=new s.default(this.blob.decode(S,h),10,"le");return this.signed?v.fromTwos(this.span*8).clone():v}encode(S,h,v=0){return this.signed&&(S=S.toTwos(this.span*8)),this.blob.encode(S.toArrayLike(Z,"le",this.span),h,v)}}function c(R){return new u(8,!1,R)}r.u64=c;function w(R){return new u(8,!0,R)}r.i64=w;function l(R){return new u(16,!1,R)}r.u128=l;function d(R){return new u(16,!0,R)}r.i128=d;function b(R){return new u(32,!1,R)}r.u256=b;function y(R){return new u(32,!0,R)}r.i256=y;class p extends e.Layout{constructor(S,h,v,C){super(S.span,C),this.layout=S,this.decoder=h,this.encoder=v}decode(S,h){return this.decoder(this.layout.decode(S,h))}encode(S,h,v){return this.layout.encode(this.encoder(S),h,v)}getSpan(S,h){return this.layout.getSpan(S,h)}}function m(R){return new p((0,e.blob)(32),S=>new n.PublicKey(S),S=>S.toBuffer(),R)}r.publicKey=m;class I extends e.Layout{constructor(S,h){super(-1,h),this.layout=S,this.discriminator=(0,e.u8)()}encode(S,h,v=0){return S==null?this.discriminator.encode(0,h,v):(this.discriminator.encode(1,h,v),this.layout.encode(S,h,v+1)+1)}decode(S,h=0){const v=this.discriminator.decode(S,h);if(v===0)return null;if(v===1)return this.layout.decode(S,h+1);throw new Error("Invalid option "+this.property)}getSpan(S,h=0){const v=this.discriminator.decode(S,h);if(v===0)return 1;if(v===1)return this.layout.getSpan(S,h+1)+1;throw new Error("Invalid option "+this.property)}}function _(R,S){return new I(R,S)}r.option=_;function A(R){return new p((0,e.u8)(),O,k,R)}r.bool=A;function O(R){if(R===0)return!1;if(R===1)return!0;throw new Error("Invalid bool: "+R)}function k(R){return R?1:0}function x(R,S){const h=(0,e.u32)("length"),v=(0,e.struct)([h,(0,e.seq)(R,(0,e.offset)(h,-h.span),"values")]);return new p(v,({values:C})=>C,C=>({values:C}),S)}r.vec=x;function U(R,S,h){const v=(0,e.struct)([c("tag"),S.replicate("data")]);function C({tag:V,data:K}){if(!V.eq(R))throw new Error("Invalid tag, expected: "+R.toString("hex")+", got: "+V.toString("hex"));return K}return new p(v,C,V=>({tag:R,data:V}),h)}r.tagged=U;function z(R){const S=(0,e.u32)("length"),h=(0,e.struct)([S,(0,e.blob)((0,e.offset)(S,-S.span),"data")]);return new p(h,({data:v})=>v,v=>({data:v}),R)}r.vecU8=z;function P(R){return new p(z(),S=>S.toString("utf-8"),S=>Z.from(S,"utf-8"),R)}r.str=P;function M(R,S,h){const v=(0,e.union)(h??(0,e.u8)(),S);return R.forEach((C,V)=>v.addVariant(V,C,C.property)),v}r.rustEnum=M;function $(R,S,h){const v=(0,e.struct)([(0,e.seq)(R,S,"values")]);return new p(v,({values:C})=>C,C=>({values:C}),h)}r.array=$;class N extends e.Layout{constructor(S,h,v){super(S.span+h.span,v),this.keyLayout=S,this.valueLayout=h}decode(S,h){h=h||0;const v=this.keyLayout.decode(S,h),C=this.valueLayout.decode(S,h+this.keyLayout.getSpan(S,h));return[v,C]}encode(S,h,v){v=v||0;const C=this.keyLayout.encode(S[0],h,v),V=this.valueLayout.encode(S[1],h,v+C);return C+V}getSpan(S,h){return this.keyLayout.getSpan(S,h)+this.valueLayout.getSpan(S,h)}}function D(R,S,h){const v=(0,e.u32)("length"),C=(0,e.struct)([v,(0,e.seq)(new N(R,S),(0,e.offset)(v,-v.span),"values")]);return new p(C,({values:V})=>new Map(V),V=>({values:Array.from(V.entries())}),h)}r.map=D})(xe)),xe}var j=Dr(),Ne={exports:{}},Gt;function Br(){if(Gt)return Ne.exports;Gt=1;const r=/[\p{Lu}]/u,t=/[\p{Ll}]/u,e=/^[\p{Lu}](?![\p{Lu}])/gu,n=/([\p{Alpha}\p{N}_]|$)/u,s=/[_.\- ]+/,i=new RegExp("^"+s.source),u=new RegExp(s.source+n.source,"gu"),c=new RegExp("\\d+"+n.source,"gu"),w=(y,p,m)=>{let I=!1,_=!1,A=!1;for(let O=0;O<y.length;O++){const k=y[O];I&&r.test(k)?(y=y.slice(0,O)+"-"+y.slice(O),I=!1,A=_,_=!0,O++):_&&A&&t.test(k)?(y=y.slice(0,O-1)+"-"+y.slice(O-1),A=_,_=!1,I=!0):(I=p(k)===k&&m(k)!==k,A=_,_=m(k)===k&&p(k)!==k)}return y},l=(y,p)=>(e.lastIndex=0,y.replace(e,m=>p(m))),d=(y,p)=>(u.lastIndex=0,c.lastIndex=0,y.replace(u,(m,I)=>p(I)).replace(c,m=>p(m))),b=(y,p)=>{if(!(typeof y=="string"||Array.isArray(y)))throw new TypeError("Expected the input to be `string | string[]`");if(p={pascalCase:!1,preserveConsecutiveUppercase:!1,...p},Array.isArray(y)?y=y.map(A=>A.trim()).filter(A=>A.length).join("-"):y=y.trim(),y.length===0)return"";const m=p.locale===!1?A=>A.toLowerCase():A=>A.toLocaleLowerCase(p.locale),I=p.locale===!1?A=>A.toUpperCase():A=>A.toLocaleUpperCase(p.locale);return y.length===1?p.pascalCase?I(y):m(y):(y!==m(y)&&(y=w(y,m,I)),y=y.replace(i,""),p.preserveConsecutiveUppercase?y=l(y,m):y=m(y),p.pascalCase&&(y=I(y.charAt(0))+y.slice(1)),d(y,I))};return Ne.exports=b,Ne.exports.default=b,Ne.exports}var Ur=Br();const G=Dn(Ur);function Ee(r){let t=r.length;for(;--t>=0;)r[t]=0}const Nr=3,Mr=258,$n=29,$r=256,jr=$r+1+$n,jn=30,Vr=512,Fr=new Array((jr+2)*2);Ee(Fr);const zr=new Array(jn*2);Ee(zr);const qr=new Array(Vr);Ee(qr);const Gr=new Array(Mr-Nr+1);Ee(Gr);const Kr=new Array($n);Ee(Kr);const Zr=new Array(jn);Ee(Zr);const Hr=(r,t,e,n)=>{let s=r&65535|0,i=r>>>16&65535|0,u=0;for(;e!==0;){u=e>2e3?2e3:e,e-=u;do s=s+t[n++]|0,i=i+s|0;while(--u);s%=65521,i%=65521}return s|i<<16|0};var gt=Hr;const Wr=()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t},Xr=new Uint32Array(Wr()),Yr=(r,t,e,n)=>{const s=Xr,i=n+e;r^=-1;for(let u=n;u<i;u++)r=r>>>8^s[(r^t[u])&255];return r^-1};var ie=Yr,mt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Vn={Z_NO_FLUSH:0,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_DEFLATED:8};const Jr=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var Qr=function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)Jr(e,n)&&(r[n]=e[n])}}return r},ei=r=>{let t=0;for(let n=0,s=r.length;n<s;n++)t+=r[n].length;const e=new Uint8Array(t);for(let n=0,s=0,i=r.length;n<i;n++){let u=r[n];e.set(u,s),s+=u.length}return e},Fn={assign:Qr,flattenChunks:ei};let zn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{zn=!1}const Te=new Uint8Array(256);for(let r=0;r<256;r++)Te[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Te[254]=Te[254]=1;var ti=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,s,i,u=r.length,c=0;for(s=0;s<u;s++)e=r.charCodeAt(s),(e&64512)===55296&&s+1<u&&(n=r.charCodeAt(s+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),s++)),c+=e<128?1:e<2048?2:e<65536?3:4;for(t=new Uint8Array(c),i=0,s=0;i<c;s++)e=r.charCodeAt(s),(e&64512)===55296&&s+1<u&&(n=r.charCodeAt(s+1),(n&64512)===56320&&(e=65536+(e-55296<<10)+(n-56320),s++)),e<128?t[i++]=e:e<2048?(t[i++]=192|e>>>6,t[i++]=128|e&63):e<65536?(t[i++]=224|e>>>12,t[i++]=128|e>>>6&63,t[i++]=128|e&63):(t[i++]=240|e>>>18,t[i++]=128|e>>>12&63,t[i++]=128|e>>>6&63,t[i++]=128|e&63);return t};const ni=(r,t)=>{if(t<65534&&r.subarray&&zn)return String.fromCharCode.apply(null,r.length===t?r:r.subarray(0,t));let e="";for(let n=0;n<t;n++)e+=String.fromCharCode(r[n]);return e};var ri=(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,s;const i=new Array(e*2);for(s=0,n=0;n<e;){let u=r[n++];if(u<128){i[s++]=u;continue}let c=Te[u];if(c>4){i[s++]=65533,n+=c-1;continue}for(u&=c===2?31:c===3?15:7;c>1&&n<e;)u=u<<6|r[n++]&63,c--;if(c>1){i[s++]=65533;continue}u<65536?i[s++]=u:(u-=65536,i[s++]=55296|u>>10&1023,i[s++]=56320|u&1023)}return ni(i,s)},ii=(r,t)=>{t=t||r.length,t>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(r[e]&192)===128;)e--;return e<0||e===0?t:e+Te[r[e]]>t?e:t},vt={string2buf:ti,buf2string:ri,utf8border:ii};function si(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var oi=si;const Me=16209,ai=16191;var ci=function(t,e){let n,s,i,u,c,w,l,d,b,y,p,m,I,_,A,O,k,x,U,z,P,M,$,N;const D=t.state;n=t.next_in,$=t.input,s=n+(t.avail_in-5),i=t.next_out,N=t.output,u=i-(e-t.avail_out),c=i+(t.avail_out-257),w=D.dmax,l=D.wsize,d=D.whave,b=D.wnext,y=D.window,p=D.hold,m=D.bits,I=D.lencode,_=D.distcode,A=(1<<D.lenbits)-1,O=(1<<D.distbits)-1;e:do{m<15&&(p+=$[n++]<<m,m+=8,p+=$[n++]<<m,m+=8),k=I[p&A];t:for(;;){if(x=k>>>24,p>>>=x,m-=x,x=k>>>16&255,x===0)N[i++]=k&65535;else if(x&16){U=k&65535,x&=15,x&&(m<x&&(p+=$[n++]<<m,m+=8),U+=p&(1<<x)-1,p>>>=x,m-=x),m<15&&(p+=$[n++]<<m,m+=8,p+=$[n++]<<m,m+=8),k=_[p&O];n:for(;;){if(x=k>>>24,p>>>=x,m-=x,x=k>>>16&255,x&16){if(z=k&65535,x&=15,m<x&&(p+=$[n++]<<m,m+=8,m<x&&(p+=$[n++]<<m,m+=8)),z+=p&(1<<x)-1,z>w){t.msg="invalid distance too far back",D.mode=Me;break e}if(p>>>=x,m-=x,x=i-u,z>x){if(x=z-x,x>d&&D.sane){t.msg="invalid distance too far back",D.mode=Me;break e}if(P=0,M=y,b===0){if(P+=l-x,x<U){U-=x;do N[i++]=y[P++];while(--x);P=i-z,M=N}}else if(b<x){if(P+=l+b-x,x-=b,x<U){U-=x;do N[i++]=y[P++];while(--x);if(P=0,b<U){x=b,U-=x;do N[i++]=y[P++];while(--x);P=i-z,M=N}}}else if(P+=b-x,x<U){U-=x;do N[i++]=y[P++];while(--x);P=i-z,M=N}for(;U>2;)N[i++]=M[P++],N[i++]=M[P++],N[i++]=M[P++],U-=3;U&&(N[i++]=M[P++],U>1&&(N[i++]=M[P++]))}else{P=i-z;do N[i++]=N[P++],N[i++]=N[P++],N[i++]=N[P++],U-=3;while(U>2);U&&(N[i++]=N[P++],U>1&&(N[i++]=N[P++]))}}else if((x&64)===0){k=_[(k&65535)+(p&(1<<x)-1)];continue n}else{t.msg="invalid distance code",D.mode=Me;break e}break}}else if((x&64)===0){k=I[(k&65535)+(p&(1<<x)-1)];continue t}else if(x&32){D.mode=ai;break e}else{t.msg="invalid literal/length code",D.mode=Me;break e}break}}while(n<s&&i<c);U=m>>3,n-=U,m-=U<<3,p&=(1<<m)-1,t.next_in=n,t.next_out=i,t.avail_in=n<s?5+(s-n):5-(n-s),t.avail_out=i<c?257+(c-i):257-(i-c),D.hold=p,D.bits=m};const me=15,Kt=852,Zt=592,Ht=0,it=1,Wt=2,ui=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),li=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),di=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),fi=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),hi=(r,t,e,n,s,i,u,c)=>{const w=c.bits;let l=0,d=0,b=0,y=0,p=0,m=0,I=0,_=0,A=0,O=0,k,x,U,z,P,M=null,$;const N=new Uint16Array(me+1),D=new Uint16Array(me+1);let R=null,S,h,v;for(l=0;l<=me;l++)N[l]=0;for(d=0;d<n;d++)N[t[e+d]]++;for(p=w,y=me;y>=1&&N[y]===0;y--);if(p>y&&(p=y),y===0)return s[i++]=1<<24|64<<16|0,s[i++]=1<<24|64<<16|0,c.bits=1,0;for(b=1;b<y&&N[b]===0;b++);for(p<b&&(p=b),_=1,l=1;l<=me;l++)if(_<<=1,_-=N[l],_<0)return-1;if(_>0&&(r===Ht||y!==1))return-1;for(D[1]=0,l=1;l<me;l++)D[l+1]=D[l]+N[l];for(d=0;d<n;d++)t[e+d]!==0&&(u[D[t[e+d]]++]=d);if(r===Ht?(M=R=u,$=20):r===it?(M=ui,R=li,$=257):(M=di,R=fi,$=0),O=0,d=0,l=b,P=i,m=p,I=0,U=-1,A=1<<p,z=A-1,r===it&&A>Kt||r===Wt&&A>Zt)return 1;for(;;){S=l-I,u[d]+1<$?(h=0,v=u[d]):u[d]>=$?(h=R[u[d]-$],v=M[u[d]-$]):(h=96,v=0),k=1<<l-I,x=1<<m,b=x;do x-=k,s[P+(O>>I)+x]=S<<24|h<<16|v|0;while(x!==0);for(k=1<<l-1;O&k;)k>>=1;if(k!==0?(O&=k-1,O+=k):O=0,d++,--N[l]===0){if(l===y)break;l=t[e+u[d]]}if(l>p&&(O&z)!==U){for(I===0&&(I=p),P+=b,m=l-I,_=1<<m;m+I<y&&(_-=N[m+I],!(_<=0));)m++,_<<=1;if(A+=1<<m,r===it&&A>Kt||r===Wt&&A>Zt)return 1;U=O&z,s[U]=p<<24|m<<16|P-i|0}}return O!==0&&(s[P+O]=l-I<<24|64<<16|0),c.bits=p,0};var Ie=hi;const pi=0,qn=1,Gn=2,{Z_FINISH:Xt,Z_BLOCK:wi,Z_TREES:$e,Z_OK:ye,Z_STREAM_END:yi,Z_NEED_DICT:gi,Z_STREAM_ERROR:ne,Z_DATA_ERROR:Kn,Z_MEM_ERROR:Zn,Z_BUF_ERROR:mi,Z_DEFLATED:Yt}=Vn,Je=16180,Jt=16181,Qt=16182,en=16183,tn=16184,nn=16185,rn=16186,sn=16187,on=16188,an=16189,Ke=16190,oe=16191,st=16192,cn=16193,ot=16194,un=16195,ln=16196,dn=16197,fn=16198,je=16199,Ve=16200,hn=16201,pn=16202,wn=16203,yn=16204,gn=16205,at=16206,mn=16207,vn=16208,q=16209,Hn=16210,Wn=16211,vi=852,bi=592,_i=15,Ei=_i,bn=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Ai(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const ge=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode<Je||t.mode>Wn?1:0},Xn=r=>{if(ge(r))return ne;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=t.wrap&1),t.mode=Je,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(vi),t.distcode=t.distdyn=new Int32Array(bi),t.sane=1,t.back=-1,ye},Yn=r=>{if(ge(r))return ne;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,Xn(r)},Jn=(r,t)=>{let e;if(ge(r))return ne;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?ne:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,Yn(r))},Qn=(r,t)=>{if(!r)return ne;const e=new Ai;r.state=e,e.strm=r,e.window=null,e.mode=Je;const n=Jn(r,t);return n!==ye&&(r.state=null),n},xi=r=>Qn(r,Ei);let _n=!0,ct,ut;const ki=r=>{if(_n){ct=new Int32Array(512),ut=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Ie(qn,r.lens,0,288,ct,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Ie(Gn,r.lens,0,32,ut,0,r.work,{bits:5}),_n=!1}r.lencode=ct,r.lenbits=9,r.distcode=ut,r.distbits=5},er=(r,t,e,n)=>{let s;const i=r.state;return i.window===null&&(i.wsize=1<<i.wbits,i.wnext=0,i.whave=0,i.window=new Uint8Array(i.wsize)),n>=i.wsize?(i.window.set(t.subarray(e-i.wsize,e),0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),i.window.set(t.subarray(e-n,e-n+s),i.wnext),n-=s,n?(i.window.set(t.subarray(e-n,e),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave<i.wsize&&(i.whave+=s))),0},Si=(r,t)=>{let e,n,s,i,u,c,w,l,d,b,y,p,m,I,_=0,A,O,k,x,U,z,P,M;const $=new Uint8Array(4);let N,D;const R=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ge(r)||!r.output||!r.input&&r.avail_in!==0)return ne;e=r.state,e.mode===oe&&(e.mode=st),u=r.next_out,s=r.output,w=r.avail_out,i=r.next_in,n=r.input,c=r.avail_in,l=e.hold,d=e.bits,b=c,y=w,M=ye;e:for(;;)switch(e.mode){case Je:if(e.wrap===0){e.mode=st;break}for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.wrap&2&&l===35615){e.wbits===0&&(e.wbits=15),e.check=0,$[0]=l&255,$[1]=l>>>8&255,e.check=ie(e.check,$,2,0),l=0,d=0,e.mode=Jt;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",e.mode=q;break}if((l&15)!==Yt){r.msg="unknown compression method",e.mode=q;break}if(l>>>=4,d-=4,P=(l&15)+8,e.wbits===0&&(e.wbits=P),P>15||P>e.wbits){r.msg="invalid window size",e.mode=q;break}e.dmax=1<<e.wbits,e.flags=0,r.adler=e.check=1,e.mode=l&512?an:oe,l=0,d=0;break;case Jt:for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.flags=l,(e.flags&255)!==Yt){r.msg="unknown compression method",e.mode=q;break}if(e.flags&57344){r.msg="unknown header flags set",e.mode=q;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ie(e.check,$,2,0)),l=0,d=0,e.mode=Qt;case Qt:for(;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.head&&(e.head.time=l),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,$[2]=l>>>16&255,$[3]=l>>>24&255,e.check=ie(e.check,$,4,0)),l=0,d=0,e.mode=en;case en:for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.head&&(e.head.xflags=l&255,e.head.os=l>>8),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ie(e.check,$,2,0)),l=0,d=0,e.mode=tn;case tn:if(e.flags&1024){for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.length=l,e.head&&(e.head.extra_len=l),e.flags&512&&e.wrap&4&&($[0]=l&255,$[1]=l>>>8&255,e.check=ie(e.check,$,2,0)),l=0,d=0}else e.head&&(e.head.extra=null);e.mode=nn;case nn:if(e.flags&1024&&(p=e.length,p>c&&(p=c),p&&(e.head&&(P=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(i,i+p),P)),e.flags&512&&e.wrap&4&&(e.check=ie(e.check,n,p,i)),c-=p,i+=p,e.length-=p),e.length))break e;e.length=0,e.mode=rn;case rn:if(e.flags&2048){if(c===0)break e;p=0;do P=n[i+p++],e.head&&P&&e.length<65536&&(e.head.name+=String.fromCharCode(P));while(P&&p<c);if(e.flags&512&&e.wrap&4&&(e.check=ie(e.check,n,p,i)),c-=p,i+=p,P)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=sn;case sn:if(e.flags&4096){if(c===0)break e;p=0;do P=n[i+p++],e.head&&P&&e.length<65536&&(e.head.comment+=String.fromCharCode(P));while(P&&p<c);if(e.flags&512&&e.wrap&4&&(e.check=ie(e.check,n,p,i)),c-=p,i+=p,P)break e}else e.head&&(e.head.comment=null);e.mode=on;case on:if(e.flags&512){for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.wrap&4&&l!==(e.check&65535)){r.msg="header crc mismatch",e.mode=q;break}l=0,d=0}e.head&&(e.head.hcrc=e.flags>>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=oe;break;case an:for(;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}r.adler=e.check=bn(l),l=0,d=0,e.mode=Ke;case Ke:if(e.havedict===0)return r.next_out=u,r.avail_out=w,r.next_in=i,r.avail_in=c,e.hold=l,e.bits=d,gi;r.adler=e.check=1,e.mode=oe;case oe:if(t===wi||t===$e)break e;case st:if(e.last){l>>>=d&7,d-=d&7,e.mode=at;break}for(;d<3;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}switch(e.last=l&1,l>>>=1,d-=1,l&3){case 0:e.mode=cn;break;case 1:if(ki(e),e.mode=je,t===$e){l>>>=2,d-=2;break e}break;case 2:e.mode=ln;break;case 3:r.msg="invalid block type",e.mode=q}l>>>=2,d-=2;break;case cn:for(l>>>=d&7,d-=d&7;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if((l&65535)!==(l>>>16^65535)){r.msg="invalid stored block lengths",e.mode=q;break}if(e.length=l&65535,l=0,d=0,e.mode=ot,t===$e)break e;case ot:e.mode=un;case un:if(p=e.length,p){if(p>c&&(p=c),p>w&&(p=w),p===0)break e;s.set(n.subarray(i,i+p),u),c-=p,i+=p,w-=p,u+=p,e.length-=p;break}e.mode=oe;break;case ln:for(;d<14;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.nlen=(l&31)+257,l>>>=5,d-=5,e.ndist=(l&31)+1,l>>>=5,d-=5,e.ncode=(l&15)+4,l>>>=4,d-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=q;break}e.have=0,e.mode=dn;case dn:for(;e.have<e.ncode;){for(;d<3;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.lens[R[e.have++]]=l&7,l>>>=3,d-=3}for(;e.have<19;)e.lens[R[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,N={bits:e.lenbits},M=Ie(pi,e.lens,0,19,e.lencode,0,e.work,N),e.lenbits=N.bits,M){r.msg="invalid code lengths set",e.mode=q;break}e.have=0,e.mode=fn;case fn:for(;e.have<e.nlen+e.ndist;){for(;_=e.lencode[l&(1<<e.lenbits)-1],A=_>>>24,O=_>>>16&255,k=_&65535,!(A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(k<16)l>>>=A,d-=A,e.lens[e.have++]=k;else{if(k===16){for(D=A+2;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(l>>>=A,d-=A,e.have===0){r.msg="invalid bit length repeat",e.mode=q;break}P=e.lens[e.have-1],p=3+(l&3),l>>>=2,d-=2}else if(k===17){for(D=A+3;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=A,d-=A,P=0,p=3+(l&7),l>>>=3,d-=3}else{for(D=A+7;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=A,d-=A,P=0,p=11+(l&127),l>>>=7,d-=7}if(e.have+p>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=q;break}for(;p--;)e.lens[e.have++]=P}}if(e.mode===q)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=q;break}if(e.lenbits=9,N={bits:e.lenbits},M=Ie(qn,e.lens,0,e.nlen,e.lencode,0,e.work,N),e.lenbits=N.bits,M){r.msg="invalid literal/lengths set",e.mode=q;break}if(e.distbits=6,e.distcode=e.distdyn,N={bits:e.distbits},M=Ie(Gn,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,N),e.distbits=N.bits,M){r.msg="invalid distances set",e.mode=q;break}if(e.mode=je,t===$e)break e;case je:e.mode=Ve;case Ve:if(c>=6&&w>=258){r.next_out=u,r.avail_out=w,r.next_in=i,r.avail_in=c,e.hold=l,e.bits=d,ci(r,y),u=r.next_out,s=r.output,w=r.avail_out,i=r.next_in,n=r.input,c=r.avail_in,l=e.hold,d=e.bits,e.mode===oe&&(e.back=-1);break}for(e.back=0;_=e.lencode[l&(1<<e.lenbits)-1],A=_>>>24,O=_>>>16&255,k=_&65535,!(A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(O&&(O&240)===0){for(x=A,U=O,z=k;_=e.lencode[z+((l&(1<<x+U)-1)>>x)],A=_>>>24,O=_>>>16&255,k=_&65535,!(x+A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=x,d-=x,e.back+=x}if(l>>>=A,d-=A,e.back+=A,e.length=k,O===0){e.mode=gn;break}if(O&32){e.back=-1,e.mode=oe;break}if(O&64){r.msg="invalid literal/length code",e.mode=q;break}e.extra=O&15,e.mode=hn;case hn:if(e.extra){for(D=e.extra;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.length+=l&(1<<e.extra)-1,l>>>=e.extra,d-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=pn;case pn:for(;_=e.distcode[l&(1<<e.distbits)-1],A=_>>>24,O=_>>>16&255,k=_&65535,!(A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if((O&240)===0){for(x=A,U=O,z=k;_=e.distcode[z+((l&(1<<x+U)-1)>>x)],A=_>>>24,O=_>>>16&255,k=_&65535,!(x+A<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=x,d-=x,e.back+=x}if(l>>>=A,d-=A,e.back+=A,O&64){r.msg="invalid distance code",e.mode=q;break}e.offset=k,e.extra=O&15,e.mode=wn;case wn:if(e.extra){for(D=e.extra;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}e.offset+=l&(1<<e.extra)-1,l>>>=e.extra,d-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=q;break}e.mode=yn;case yn:if(w===0)break e;if(p=y-w,e.offset>p){if(p=e.offset-p,p>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=q;break}p>e.wnext?(p-=e.wnext,m=e.wsize-p):m=e.wnext-p,p>e.length&&(p=e.length),I=e.window}else I=s,m=u-e.offset,p=e.length;p>w&&(p=w),w-=p,e.length-=p;do s[u++]=I[m++];while(--p);e.length===0&&(e.mode=Ve);break;case gn:if(w===0)break e;s[u++]=e.length,w--,e.mode=Ve;break;case at:if(e.wrap){for(;d<32;){if(c===0)break e;c--,l|=n[i++]<<d,d+=8}if(y-=w,r.total_out+=y,e.total+=y,e.wrap&4&&y&&(r.adler=e.check=e.flags?ie(e.check,s,y,u-y):gt(e.check,s,y,u-y)),y=w,e.wrap&4&&(e.flags?l:bn(l))!==e.check){r.msg="incorrect data check",e.mode=q;break}l=0,d=0}e.mode=mn;case mn:if(e.wrap&&e.flags){for(;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.wrap&4&&l!==(e.total&4294967295)){r.msg="incorrect length check",e.mode=q;break}l=0,d=0}e.mode=vn;case vn:M=yi;break e;case q:M=Kn;break e;case Hn:return Zn;case Wn:default:return ne}return r.next_out=u,r.avail_out=w,r.next_in=i,r.avail_in=c,e.hold=l,e.bits=d,(e.wsize||y!==r.avail_out&&e.mode<q&&(e.mode<at||t!==Xt))&&er(r,r.output,r.next_out,y-r.avail_out),b-=r.avail_in,y-=r.avail_out,r.total_in+=b,r.total_out+=y,e.total+=y,e.wrap&4&&y&&(r.adler=e.check=e.flags?ie(e.check,s,y,r.next_out-y):gt(e.check,s,y,r.next_out-y)),r.data_type=e.bits+(e.last?64:0)+(e.mode===oe?128:0)+(e.mode===je||e.mode===ot?256:0),(b===0&&y===0||t===Xt)&&M===ye&&(M=mi),M},Ii=r=>{if(ge(r))return ne;let t=r.state;return t.window&&(t.window=null),r.state=null,ye},Li=(r,t)=>{if(ge(r))return ne;const e=r.state;return(e.wrap&2)===0?ne:(e.head=t,t.done=!1,ye)},Ti=(r,t)=>{const e=t.length;let n,s,i;return ge(r)||(n=r.state,n.wrap!==0&&n.mode!==Ke)?ne:n.mode===Ke&&(s=1,s=gt(s,t,e,0),s!==n.check)?Kn:(i=er(r,t,e,e),i?(n.mode=Hn,Zn):(n.havedict=1,ye))};var Ci=Yn,Ri=Jn,Oi=Xn,Pi=xi,Di=Qn,Bi=Si,Ui=Ii,Ni=Li,Mi=Ti,$i="pako inflate (from Nodeca project)",ae={inflateReset:Ci,inflateReset2:Ri,inflateResetKeep:Oi,inflateInit:Pi,inflateInit2:Di,inflate:Bi,inflateEnd:Ui,inflateGetHeader:Ni,inflateSetDictionary:Mi,inflateInfo:$i};function ji(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var Vi=ji;const tr=Object.prototype.toString,{Z_NO_FLUSH:Fi,Z_FINISH:zi,Z_OK:Ce,Z_STREAM_END:lt,Z_NEED_DICT:dt,Z_STREAM_ERROR:qi,Z_DATA_ERROR:En,Z_MEM_ERROR:Gi}=Vn;function Qe(r){this.options=Fn.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(r&&r.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new oi,this.strm.avail_out=0;let e=ae.inflateInit2(this.strm,t.windowBits);if(e!==Ce)throw new Error(mt[e]);if(this.header=new Vi,ae.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=vt.string2buf(t.dictionary):tr.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=ae.inflateSetDictionary(this.strm,t.dictionary),e!==Ce)))throw new Error(mt[e])}Qe.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let i,u,c;if(this.ended)return!1;for(t===~~t?u=t:u=t===!0?zi:Fi,tr.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),i=ae.inflate(e,u),i===dt&&s&&(i=ae.inflateSetDictionary(e,s),i===Ce?i=ae.inflate(e,u):i===En&&(i=dt));e.avail_in>0&&i===lt&&e.state.wrap>0&&r[e.next_in]!==0;)ae.inflateReset(e),i=ae.inflate(e,u);switch(i){case qi:case En:case dt:case Gi:return this.onEnd(i),this.ended=!0,!1}if(c=e.avail_out,e.next_out&&(e.avail_out===0||i===lt))if(this.options.to==="string"){let w=vt.utf8border(e.output,e.next_out),l=e.next_out-w,d=vt.buf2string(e.output,w);e.next_out=l,e.avail_out=n-l,l&&e.output.set(e.output.subarray(w,w+l),0),this.onData(d)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(i===Ce&&c===0)){if(i===lt)return i=ae.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};Qe.prototype.onData=function(r){this.chunks.push(r)};Qe.prototype.onEnd=function(r){r===Ce&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Fn.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Ki(r,t){const e=new Qe(t);if(e.push(r),e.err)throw e.msg||mt[e.err];return e.result}var Zi=Ki,Hi={inflate:Zi};const{inflate:Wi}=Hi;var Xi=Wi,ft={exports:{}},An;function Yi(){return An||(An=1,(function(r){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function s(w,l,d){this.fn=w,this.context=l,this.once=d||!1}function i(w,l,d,b,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,b||w,y),m=e?e+l:l;return w._events[m]?w._events[m].fn?w._events[m]=[w._events[m],p]:w._events[m].push(p):(w._events[m]=p,w._eventsCount++),w}function u(w,l){--w._eventsCount===0?w._events=new n:delete w._events[l]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var l=[],d,b;if(this._eventsCount===0)return l;for(b in d=this._events)t.call(d,b)&&l.push(e?b.slice(1):b);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},c.prototype.listeners=function(l){var d=e?e+l:l,b=this._events[d];if(!b)return[];if(b.fn)return[b.fn];for(var y=0,p=b.length,m=new Array(p);y<p;y++)m[y]=b[y].fn;return m},c.prototype.listenerCount=function(l){var d=e?e+l:l,b=this._events[d];return b?b.fn?1:b.length:0},c.prototype.emit=function(l,d,b,y,p,m){var I=e?e+l:l;if(!this._events[I])return!1;var _=this._events[I],A=arguments.length,O,k;if(_.fn){switch(_.once&&this.removeListener(l,_.fn,void 0,!0),A){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,b),!0;case 4:return _.fn.call(_.context,d,b,y),!0;case 5:return _.fn.call(_.context,d,b,y,p),!0;case 6:return _.fn.call(_.context,d,b,y,p,m),!0}for(k=1,O=new Array(A-1);k<A;k++)O[k-1]=arguments[k];_.fn.apply(_.context,O)}else{var x=_.length,U;for(k=0;k<x;k++)switch(_[k].once&&this.removeListener(l,_[k].fn,void 0,!0),A){case 1:_[k].fn.call(_[k].context);break;case 2:_[k].fn.call(_[k].context,d);break;case 3:_[k].fn.call(_[k].context,d,b);break;case 4:_[k].fn.call(_[k].context,d,b,y);break;default:if(!O)for(U=1,O=new Array(A-1);U<A;U++)O[U-1]=arguments[U];_[k].fn.apply(_[k].context,O)}}return!0},c.prototype.on=function(l,d,b){return i(this,l,d,b,!1)},c.prototype.once=function(l,d,b){return i(this,l,d,b,!0)},c.prototype.removeListener=function(l,d,b,y){var p=e?e+l:l;if(!this._events[p])return this;if(!d)return u(this,p),this;var m=this._events[p];if(m.fn)m.fn===d&&(!y||m.once)&&(!b||m.context===b)&&u(this,p);else{for(var I=0,_=[],A=m.length;I<A;I++)(m[I].fn!==d||y&&!m[I].once||b&&m[I].context!==b)&&_.push(m[I]);_.length?this._events[p]=_.length===1?_[0]:_:u(this,p)}return this},c.prototype.removeAllListeners=function(l){var d;return l?(d=e?e+l:l,this._events[d]&&u(this,d)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=e,c.EventEmitter=c,r.exports=c})(ft)),ft.exports}var Ji=Yi();const Qi=Dn(Ji);function es(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const ke=r=>"version"in r;function ts(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function ns(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2===1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?Y.from([]):Y.from(t.map(e=>parseInt(e,16)))}var rs=Object.freeze({__proto__:null,encode:ts,decode:ns});function nr(r){return new TextDecoder("utf-8").decode(r)}function rr(r){return new TextEncoder().encode(r)}var is=Object.freeze({__proto__:null,decode:nr,encode:rr});function bt(r){return be.encode(r)}function ss(r){return be.decode(r)}var os=Object.freeze({__proto__:null,encode:bt,decode:ss});function _t(r){return r.toString("base64")}function Ct(r){return Y.from(r,"base64")}var as=Object.freeze({__proto__:null,encode:_t,decode:Ct}),cs=Object.freeze({__proto__:null,hex:rs,utf8:is,bs58:os,base64:as});function us(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let s=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,s)}),t}function ls(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(s=>{e[s.name]=t[n],n+=1}),e}function ir(r,t={}){r.forEach(e=>{if("accounts"in e)ir(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function ee(r){return r instanceof X?r:new X(r)}class ds extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:u}=t,c=u.length===0?s:"At path: "+u.join(".")+" -- "+s;super(c),this.value=void 0,this.key=void 0,this.type=void 0,this.refinement=void 0,this.path=void 0,this.branch=void 0,this.failures=void 0,Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var w;return(w=n)!=null?w:n=[t,...e()]}}}function fs(r){return _e(r)&&typeof r[Symbol.iterator]=="function"}function _e(r){return typeof r=="object"&&r!=null}function de(r){return typeof r=="string"?JSON.stringify(r):""+r}function hs(r){const{done:t,value:e}=r.next();return t?void 0:e}function ps(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:u}=e,{refinement:c,message:w="Expected a value of type `"+u+"`"+(c?" with refinement `"+c+"`":"")+", but received: `"+de(n)+"`"}=r;return{value:n,type:u,refinement:c,key:s[s.length-1],path:s,branch:i,...r,message:w}}function*xn(r,t,e,n){fs(r)||(r=[r]);for(const s of r){const i=ps(s,t,e,n);i&&(yield i)}}function*Rt(r,t,e){e===void 0&&(e={});const{path:n=[],branch:s=[r],coerce:i=!1,mask:u=!1}=e,c={path:n,branch:s};if(i&&(r=t.coercer(r,c),u&&t.type!=="type"&&_e(t.schema)&&_e(r)&&!Array.isArray(r)))for(const l in r)t.schema[l]===void 0&&delete r[l];let w=!0;for(const l of t.validator(r,c))w=!1,yield[l,void 0];for(let[l,d,b]of t.entries(r,c)){const y=Rt(d,b,{path:l===void 0?n:[...n,l],branch:l===void 0?s:[...s,d],coerce:i,mask:u});for(const p of y)p[0]?(w=!1,yield[p[0],void 0]):i&&(d=p[1],l===void 0?r=d:r instanceof Map?r.set(l,d):r instanceof Set?r.add(d):_e(r)&&(r[l]=d))}if(w)for(const l of t.refiner(r,c))w=!1,yield[l,void 0];w&&(yield[void 0,r])}class fe{constructor(t){this.TYPE=void 0,this.type=void 0,this.schema=void 0,this.coercer=void 0,this.validator=void 0,this.refiner=void 0,this.entries=void 0;const{type:e,schema:n,validator:s,refiner:i,coercer:u=w=>w,entries:c=function*(){}}=t;this.type=e,this.schema=n,this.entries=c,this.coercer=u,s?this.validator=(w,l)=>{const d=s(w,l);return xn(d,l,this,w)}:this.validator=()=>[],i?this.refiner=(w,l)=>{const d=i(w,l);return xn(d,l,this,w)}:this.refiner=()=>[]}assert(t){return ws(t,this)}create(t){return Ot(t,this)}is(t){return sr(t,this)}mask(t){return ys(t,this)}validate(t,e){return e===void 0&&(e={}),Pe(t,this,e)}}function ws(r,t){const e=Pe(r,t);if(e[0])throw e[0]}function Ot(r,t){const e=Pe(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function ys(r,t){const e=Pe(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function sr(r,t){return!Pe(r,t)[0]}function Pe(r,t,e){e===void 0&&(e={});const n=Rt(r,t,e),s=hs(n);return s[0]?[new ds(s[0],function*(){for(const u of n)u[0]&&(yield u[0])}),void 0]:[void 0,s[1]]}function De(r,t){return new fe({type:r,schema:null,validator:t})}function gs(){return De("any",()=>!0)}function ht(r){return new fe({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+de(t)}})}function ms(){return De("boolean",r=>typeof r=="boolean")}function kn(r){const t=de(r);return new fe({type:"literal",schema:r,validator(e){return e===r||"Expected the literal `"+t+"`, but received: "+de(e)}})}function Fe(r){return new fe({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function qe(){return De("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+de(r))}function Ge(r){return new fe({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function he(){return De("string",r=>typeof r=="string"||"Expected a string, but received: "+de(r))}function le(r){const t=Object.keys(r);return new fe({type:"type",schema:r,*entries(e){if(_e(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return _e(e)||"Expected an object, but received: "+de(e)}})}function or(r){const t=r.map(e=>e.type).join(" | ");return new fe({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[u]=i.validate(e,{coerce:!0});return!u})||Pt()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...u]=Rt(e,i,n),[c]=u;if(c[0])for(const[w]of u)w&&s.push(w);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+de(e),...s]}})}function Pt(){return De("unknown",()=>!0)}function vs(r,t,e){return new fe({...r,coercer:(n,s)=>sr(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}async function bs(r,t,e,n){r=ee(r),n||(n=Ze());const s=new Bn;if(s.add(new Un({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(s,[])}const Sn=99;async function _s(r,t,e){return(await Dt(r,t,e)).map(s=>s?{publicKey:s.publicKey,account:s.account}:null)}async function Dt(r,t,e){if(t.length<=Sn)return await In(r,t,e);{const n=es(t,Sn);return(await Promise.all(n.map(i=>In(r,i,e)))).flat()}}async function In(r,t,e){const n=e??r.commitment,{value:s,context:i}=await r.getMultipleAccountsInfoAndContext(t,n);return s.map((c,w)=>c===null?null:{publicKey:t[w],account:c,context:i})}async function ar(r,t,e,n,s){var i;e&&e.length>0&&t.sign(...e);const u=t._compile(),c=u.serialize(),l=t._serialize(c).toString("base64"),d={encoding:"base64",commitment:n??r.commitment};if(s){const m=(Array.isArray(s)?s:u.nonProgramIds()).map(I=>I.toBase58());d.accounts={encoding:"base64",addresses:m}}e&&(d.sigVerify=!0);const b=[l,d],y=await r._rpcRequest("simulateTransaction",b),p=Ot(y,ks);if("error"in p){let m;if("data"in p.error&&(m=(i=p.error.data)===null||i===void 0?void 0:i.logs,m&&Array.isArray(m))){const I=`
|
|
2
2
|
`,_=I+m.join(I);console.error(p.error.message,_)}throw new yt("failed to simulate transaction: "+p.error.message,m)}return p.result}function Es(r){return vs(cr(r),As,t=>"error"in t?t:{...t,result:Ot(t.result,r)})}const As=cr(Pt());function cr(r){return or([le({jsonrpc:kn("2.0"),id:he(),result:r}),le({jsonrpc:kn("2.0"),id:he(),error:le({code:Pt(),message:he(),data:Ge(gs())})})])}function xs(r){return Es(le({context:le({slot:qe()}),value:r}))}const ks=xs(le({err:Fe(or([le({}),he()])),logs:Fe(ht(he())),accounts:Ge(Fe(ht(Fe(le({executable:ms(),owner:he(),lamports:qe(),data:ht(he()),rentEpoch:Ge(qe())}))))),unitsConsumed:Ge(qe())}));var Ss=Object.freeze({__proto__:null,invoke:bs,getMultipleAccounts:_s,getMultipleAccountsAndContext:Dt,simulateTransaction:ar});class Is{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e?.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var s,i,u,c;if(n===void 0&&(n=this.opts),ke(t))e&&t.sign(e);else if(t.feePayer=(s=t.feePayer)!==null&&s!==void 0?s:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const l of e)t.partialSign(l);t=await this.wallet.signTransaction(t);const w=t.serialize();try{return await Ln(this.connection,w,n)}catch(l){if(l instanceof Et){const d=bt(ke(t)?((i=t.signatures)===null||i===void 0?void 0:i[0])||new Uint8Array:(u=t.signature)!==null&&u!==void 0?u:new Uint8Array),b=await this.connection.getTransaction(d,{commitment:"confirmed"});if(b){const y=(c=b.meta)===null||c===void 0?void 0:c.logMessages;throw y?new yt(l.message,y):l}else throw l}else throw l}}async sendAll(t,e){var n,s,i;e===void 0&&(e=this.opts);const u=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let c=t.map(d=>{var b,y;if(ke(d.tx)){let p=d.tx;return d.signers&&p.sign(d.signers),p}else{let p=d.tx,m=(b=d.signers)!==null&&b!==void 0?b:[];return p.feePayer=(y=p.feePayer)!==null&&y!==void 0?y:this.wallet.publicKey,p.recentBlockhash=u,m.forEach(I=>{p.partialSign(I)}),p}});const w=await this.wallet.signAllTransactions(c),l=[];for(let d=0;d<c.length;d+=1){const b=w[d],y=b.serialize();try{l.push(await Ln(this.connection,y,e))}catch(p){if(p instanceof Et){const m=bt(ke(b)?((n=b.signatures)===null||n===void 0?void 0:n[0])||new Uint8Array:(s=b.signature)!==null&&s!==void 0?s:new Uint8Array),I=await this.connection.getTransaction(m,{commitment:"confirmed"});if(I){const _=(i=I.meta)===null||i===void 0?void 0:i.logMessages;throw _?new yt(p.message,_):p}else throw p}else throw p}}return l}async simulate(t,e,n,s){let i=(await this.connection.getLatestBlockhash(n??this.connection.commitment)).blockhash,u;if(ke(t)?(e&&(t.sign(e),t=await this.wallet.signTransaction(t)),u=await this.connection.simulateTransaction(t,{commitment:n})):(t.feePayer=t.feePayer||this.wallet.publicKey,t.recentBlockhash=i,e&&(t=await this.wallet.signTransaction(t)),u=await ar(this.connection,t,e,n,s)),u.value.err)throw new Ls(u.value);return u.value}}class Ls extends Error{constructor(t,e){super(e),this.simulationResponse=t}}async function Ln(r,t,e){const n=e&&{skipPreflight:e.skipPreflight,preflightCommitment:e.preflightCommitment||e.commitment},s=await r.sendRawTransaction(t,n),i=(await r.confirmTransaction(s,e&&e.commitment)).value;if(i.err)throw new Et(`Raw transaction ${s} failed (${JSON.stringify(i)})`);return s}class Et extends Error{constructor(t){super(t)}}function Ze(){return Is.local()}const Ts=new Set(["anchor-deprecated-state","debug-logs"]),ur=new Map;function Cs(r){if(!Ts.has(r))throw new Error("Invalid feature");ur.set(r,!0)}function Bt(r){return ur.get(r)!==void 0}var Rs=Object.freeze({__proto__:null,set:Cs,isSet:Bt});class He extends Error{constructor(t){super(t),this.name="IdlError"}}class Be{constructor(t){this.stack=t}static parse(t){var e;const n=/^Program (\w*) invoke/,s=/^Program \w* success/,i=[];for(let u=0;u<t.length;u++){if(s.exec(t[u])){i.pop();continue}const c=(e=n.exec(t[u]))===null||e===void 0?void 0:e[1];c&&i.push(new X(c))}return new Be(i)}}class Le extends Error{constructor(t,e,n,s,i,u){super(n.join(`
|
|
3
3
|
`).replace("Program log: ","")),this.errorLogs=n,this.logs=s,this.error={errorCode:t,errorMessage:e,comparedValues:u,origin:i},this._programErrorStack=Be.parse(s)}static parse(t){if(!t)return null;const e=t.findIndex(y=>y.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],s=[n];let i;if(e+1<t.length){if(t[e+1]==="Program log: Left:"){const y=/^Program log: (.*)$/,p=y.exec(t[e+2])[1],m=y.exec(t[e+4])[1];i=[new X(p),new X(m)],s.push(...t.slice(e+1,e+5))}else if(t[e+1].startsWith("Program log: Left:")){const y=/^Program log: (Left|Right): (.*)$/,p=y.exec(t[e+1])[2],m=y.exec(t[e+2])[2];s.push(...t.slice(e+1,e+3)),i=[p,m]}}const c=/^Program log: AnchorError occurred\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),l=/^Program log: AnchorError thrown in (.*):(\d*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n),b=/^Program log: AnchorError caused by account: (.*)\. Error Code: (.*)\. Error Number: (\d*)\. Error Message: (.*)\./.exec(n);if(c){const[y,p,m]=c.slice(1,4),I={code:y,number:parseInt(p)};return new Le(I,m,s,t,void 0,i)}else if(l){const[y,p,m,I,_]=l.slice(1,6),A={code:m,number:parseInt(I)},O={file:y,line:parseInt(p)};return new Le(A,_,s,t,O,i)}else if(b){const[y,p,m,I]=b.slice(1,5),_=y,A={code:p,number:parseInt(m)};return new Le(A,I,s,t,_,i)}else return null}get program(){return this._programErrorStack.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){return this._programErrorStack.stack}toString(){return this.message}}class We extends Error{constructor(t,e,n){super(),this.code=t,this.msg=e,this.logs=n,n&&(this._programErrorStack=Be.parse(n))}static parse(t,e){const n=t.toString();let s;if(n.includes("custom program error:")){let c=n.split("custom program error: ");if(c.length!==2)return null;s=c[1]}else{const c=n.match(/"Custom":([0-9]+)}/g);if(!c||c.length>1)return null;s=c[0].match(/([0-9]+)/g)[0]}let i;try{i=parseInt(s)}catch{return null}let u=e.get(i);return u!==void 0?new We(i,u,t.logs):(u=Os.get(i),u!==void 0?new We(i,u,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function lr(r,t){Bt("debug-logs")&&console.log("Translating error:",r);const e=Le.parse(r.logs);if(e)return e;const n=We.parse(r,t);if(n)return n;if(r.logs){const s={get:function(i,u){return u==="programErrorStack"?i.programErrorStack.stack:u==="program"?i.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=Be.parse(r.logs),new Proxy(r,s)}return r}const B={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},Os=new Map([[B.InstructionMissing,"8 byte instruction identifier not provided"],[B.InstructionFallbackNotFound,"Fallback functions are not supported"],[B.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[B.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[B.IdlInstructionStub,"The program was compiled without idl instructions"],[B.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[B.ConstraintMut,"A mut constraint was violated"],[B.ConstraintHasOne,"A has one constraint was violated"],[B.ConstraintSigner,"A signer constraint was violated"],[B.ConstraintRaw,"A raw constraint was violated"],[B.ConstraintOwner,"An owner constraint was violated"],[B.ConstraintRentExempt,"A rent exemption constraint was violated"],[B.ConstraintSeeds,"A seeds constraint was violated"],[B.ConstraintExecutable,"An executable constraint was violated"],[B.ConstraintState,"Deprecated Error, feel free to replace with something else"],[B.ConstraintAssociated,"An associated constraint was violated"],[B.ConstraintAssociatedInit,"An associated init constraint was violated"],[B.ConstraintClose,"A close constraint was violated"],[B.ConstraintAddress,"An address constraint was violated"],[B.ConstraintZero,"Expected zero account discriminant"],[B.ConstraintTokenMint,"A token mint constraint was violated"],[B.ConstraintTokenOwner,"A token owner constraint was violated"],[B.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[B.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[B.ConstraintMintDecimals,"A mint decimals constraint was violated"],[B.ConstraintSpace,"A space constraint was violated"],[B.ConstraintAccountIsNone,"A required account for the constraint is None"],[B.RequireViolated,"A require expression was violated"],[B.RequireEqViolated,"A require_eq expression was violated"],[B.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[B.RequireNeqViolated,"A require_neq expression was violated"],[B.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[B.RequireGtViolated,"A require_gt expression was violated"],[B.RequireGteViolated,"A require_gte expression was violated"],[B.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[B.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[B.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[B.AccountDidNotDeserialize,"Failed to deserialize the account"],[B.AccountDidNotSerialize,"Failed to serialize the account"],[B.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[B.AccountNotMutable,"The given account is not mutable"],[B.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[B.InvalidProgramId,"Program ID was not as expected"],[B.InvalidProgramExecutable,"Program account is not executable"],[B.AccountNotSigner,"The given account did not sign"],[B.AccountNotSystemOwned,"The given account is not owned by the system program"],[B.AccountNotInitialized,"The program expected this account to be already initialized"],[B.AccountNotProgramData,"The given account is not a program data account"],[B.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[B.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[B.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[B.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[B.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[B.Deprecated,"The API being used is deprecated and should no longer be used"]]);var At=function(){return At=Object.assign||function(t){for(var e,n=1,s=arguments.length;n<s;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},At.apply(this,arguments)},xt=function(){return xt=Object.assign||function(t){for(var e,n=1,s=arguments.length;n<s;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},xt.apply(this,arguments)};function Ps(r){return r.toLowerCase()}var Ds=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],Bs=/[^A-Z0-9]+/gi;function Us(r,t){t===void 0&&(t={});for(var e=t.splitRegexp,n=e===void 0?Ds:e,s=t.stripRegexp,i=s===void 0?Bs:s,u=t.transform,c=u===void 0?Ps:u,w=t.delimiter,l=w===void 0?" ":w,d=Tn(Tn(r,n,"$1\0$2"),i,"\0"),b=0,y=d.length;d.charAt(b)==="\0";)b++;for(;d.charAt(y-1)==="\0";)y--;return d.slice(b,y).split("\0").map(c).join(l)}function Tn(r,t,e){return t instanceof RegExp?r.replace(t,e):t.reduce(function(n,s){return n.replace(s,e)},r)}function Ns(r,t){return t===void 0&&(t={}),Us(r,xt({delimiter:"."},t))}function Ms(r,t){return t===void 0&&(t={}),Ns(r,At({delimiter:"_"},t))}class J{static fieldLayout(t,e){const n=t.name!==void 0?G(t.name):void 0;switch(t.type){case"bool":return j.bool(n);case"u8":return j.u8(n);case"i8":return j.i8(n);case"u16":return j.u16(n);case"i16":return j.i16(n);case"u32":return j.u32(n);case"i32":return j.i32(n);case"f32":return j.f32(n);case"u64":return j.u64(n);case"i64":return j.i64(n);case"f64":return j.f64(n);case"u128":return j.u128(n);case"i128":return j.i128(n);case"u256":return j.u256(n);case"i256":return j.i256(n);case"bytes":return j.vecU8(n);case"string":return j.str(n);case"publicKey":return j.publicKey(n);default:{if("vec"in t.type)return j.vec(J.fieldLayout({name:void 0,type:t.type.vec},e),n);if("option"in t.type)return j.option(J.fieldLayout({name:void 0,type:t.type.option},e),n);if("defined"in t.type){if(!e)throw new He("User defined types not provided");const s=t.type.defined,i=e.filter(u=>u.name===s);if(i.length!==1)throw new He(`Type not found: ${JSON.stringify(t)}`);return J.typeDefLayout(i[0],e,n)}else if("array"in t.type){let s=t.type.array[0],i=t.type.array[1],u=J.fieldLayout({name:void 0,type:s},e);return j.array(u,i,n)}else throw new Error(`Not yet implemented: ${t}`)}}}static typeDefLayout(t,e=[],n){switch(t.type.kind){case"struct":{const s=t.type.fields.map(i=>J.fieldLayout(i,e));return j.struct(s,n)}case"enum":{let s=t.type.variants.map(i=>{const u=G(i.name);if(!i.fields)return j.struct([],u);const c=i.fields.map((w,l)=>w?.name?J.fieldLayout(w,e):J.fieldLayout({type:w,name:l.toString()},e));return j.struct(c,u)});return n!==void 0?j.rustEnum(s).replicate(n):j.rustEnum(s,n)}case"alias":return J.fieldLayout({type:t.type.value,name:t.name},e)}}}const Cn="global";class Ut{constructor(t){this.idl=t,this.ixLayout=Ut.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const s=Rn(Cn,n.name);e.set(be.encode(s),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(Cn,t,e)}_encode(t,e,n){const s=Y.alloc(1e3),i=G(e),u=this.ixLayout.get(i);if(!u)throw new Error(`Unknown method: ${i}`);const c=u.encode(n,s),w=s.slice(0,c);return Y.concat([Rn(t,e),w])}static parseIxLayout(t){const e=t.instructions.map(n=>{let s=n.args.map(u=>{var c,w;return J.fieldLayout(u,Array.from([...(c=t.accounts)!==null&&c!==void 0?c:[],...(w=t.types)!==null&&w!==void 0?w:[]]))});const i=G(n.name);return[i,j.struct(s,i)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?Y.from(t,"hex"):be.decode(t));let n=be.encode(t.slice(0,8)),s=t.slice(8);const i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(s),name:i.name}:null}format(t,e){return se.format(t,e,this.idl)}}class se{static format(t,e,n){const s=n.instructions.filter(w=>t.name===w.name)[0];if(s===void 0)return console.error("Invalid instruction given"),null;const i=s.args.map(w=>({name:w.name,type:se.formatIdlType(w.type),data:se.formatIdlData(w,t.data[w.name],n.types)})),u=se.flattenIdlAccounts(s.accounts),c=e.map((w,l)=>l<u.length?{name:u[l].name,...w}:{name:void 0,...w});return{args:i,accounts:c}}static formatIdlType(t){if(typeof t=="string")return t;if("vec"in t)return`Vec<${this.formatIdlType(t.vec)}>`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(s=>this.formatIdlData({name:"",type:t.type.vec},s)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const s=n.filter(i=>i.name===t.type.defined);if(s.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return se.formatIdlDataDefined(s[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){switch(t.type.kind){case"struct":{const s=t.type;return"{ "+Object.keys(e).map(u=>{const c=s.fields.find(w=>w.name===u);if(!c)throw new Error("Unable to find type");return u+": "+se.formatIdlData(c,e[u],n)}).join(", ")+" }"}case"enum":{if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const s=t.type.variants,i=Object.keys(e)[0],u=e[i],c=Object.keys(u).map(l=>{var d;const b=u[l],y=(d=s[i])===null||d===void 0?void 0:d.find(p=>p.name===l);if(!y)throw new Error("Unable to find variant");return l+": "+se.formatIdlData(y,b,n)}).join(", "),w=G(i,{pascalCase:!0});return c.length===0?w:`${w} { ${c} }`}else return"Tuple formatting not yet implemented"}case"alias":return se.formatIdlType(t.type.value)}}static flattenIdlAccounts(t,e){return t.map(n=>{const s=$s(n.name);if(n.hasOwnProperty("accounts")){const i=e?`${e} > ${s}`:s;return se.flattenIdlAccounts(n.accounts,i)}else return{...n,name:e?`${e} > ${s}`:s}}).flat()}}function $s(r){const t=r.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}function Rn(r,t){let e=Ms(t),n=`${r}:${e}`;return Y.from(Ye(n).slice(0,8))}function dr(r,t){switch(t.type.kind){case"struct":return t.type.fields.map(e=>pe(r,e.type)).reduce((e,n)=>e+n,0);case"enum":{const e=t.type.variants.map(n=>n.fields?n.fields.map(s=>typeof s=="object"&&"name"in s?pe(r,s.type):pe(r,s)).reduce((s,i)=>s+i,0):0);return Math.max(...e)+1}case"alias":return pe(r,t.type.value)}}function pe(r,t){var e,n;switch(t){case"bool":return 1;case"u8":return 1;case"i8":return 1;case"i16":return 2;case"u16":return 2;case"u32":return 4;case"i32":return 4;case"f32":return 4;case"u64":return 8;case"i64":return 8;case"f64":return 8;case"u128":return 16;case"i128":return 16;case"u256":return 32;case"i256":return 32;case"bytes":return 1;case"string":return 1;case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+pe(r,t.option);if("coption"in t)return 4+pe(r,t.coption);if("defined"in t){const s=(n=(e=r.types)===null||e===void 0?void 0:e.filter(u=>u.name===t.defined))!==null&&n!==void 0?n:[];if(s.length!==1)throw new He(`Type not found: ${JSON.stringify(t)}`);let i=s[0];return dr(r,i)}if("array"in t){let s=t.array[0],i=t.array[1];return pe(r,s)*i}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const kt=8;function fr(r){return Z.from(Ye(r).slice(0,kt))}class ve{constructor(t){if(t.accounts===void 0){this.accountLayouts=new Map;return}const e=t.accounts.map(n=>[n.name,J.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=Y.alloc(1e3),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);const i=s.encode(e,n);let u=n.slice(0,i),c=ve.accountDiscriminator(t);return Y.concat([c,u])}decode(t,e){if(ve.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(s=>ve.accountDiscriminator(s).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(kt),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);return s.decode(n)}memcmp(t,e){const n=ve.accountDiscriminator(t);return{offset:0,bytes:be.encode(e?Y.concat([n,e]):n)}}size(t){var e;return kt+((e=dr(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){const e=`account:${G(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return fr(e)}}class js{constructor(t){if(t.events===void 0){this.layouts=new Map;return}const e=t.events.map(n=>{let s={name:n.name,type:{kind:"struct",fields:n.fields.map(i=>({name:i.name,type:i.type}))}};return[n.name,J.typeDefLayout(s,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[_t(Vs(n.name)),n.name]))}decode(t){let e;try{e=Ct(t)}catch{return null}const n=_t(e.slice(0,8)),s=this.discriminators.get(n);if(s===void 0)return null;const i=this.layouts.get(s);if(!i)throw new Error(`Unknown event: ${s}`);return{data:i.decode(e.slice(8)),name:s}}}function Vs(r){return fr(`event:${r}`)}class Fs{constructor(t){if(t.types===void 0){this.typeLayouts=new Map;return}const e=t.types.map(n=>[n.name,J.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=Y.alloc(1e3),s=this.typeLayouts.get(t);if(!s)throw new Error(`Unknown type: ${t}`);const i=s.encode(e,n);return n.slice(0,i)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class hr{constructor(t){this.instruction=new Ut(t),this.accounts=new ve(t),this.events=new js(t),this.types=new Fs(t)}}var zs=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Vt<"u"?Vt:typeof self<"u"?self:{};function qs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class Q{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var et=Q;function Gs(r,t){return t.property?r+"["+t.property+"]":r}class we extends Q{isCount(){throw new Error("ExternalLayout is abstract")}}class pr extends we{constructor(t,e,n){if(!(t instanceof Q))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof tt||this.layout instanceof wr}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class tt extends Q{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntLE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntLE(t,n,this.span),this.span}}class wr extends Q{constructor(t,e){if(super(t,e),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(t,e){return e===void 0&&(e=0),t.readUIntBE(e,this.span)}encode(t,e,n){return n===void 0&&(n=0),e.writeUIntBE(t,n,this.span),this.span}}const St=Math.pow(2,32);function yr(r){const t=Math.floor(r/St),e=r-t*St;return{hi32:t,lo32:e}}function gr(r,t){return r*St+t}class Ks extends Q{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),s=t.readUInt32LE(e+4);return gr(s,n)}encode(t,e,n){n===void 0&&(n=0);const s=yr(t);return e.writeUInt32LE(s.lo32,n),e.writeUInt32LE(s.hi32,n+4),8}}class Zs extends Q{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),s=t.readInt32LE(e+4);return gr(s,n)}encode(t,e,n){n===void 0&&(n=0);const s=yr(t);return e.writeUInt32LE(s.lo32,n),e.writeInt32LE(s.hi32,n+4),8}}class Hs extends Q{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((i,u)=>i&&u instanceof Q,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,u)=>i+u.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const u=i.getSpan(t,e);return e+=u,s+u},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,u=0;for(const c of this.fields){let w=c.span;if(u=0<w?w:0,c.property!==void 0){const l=t[c.property];l!==void 0&&(u=c.encode(l,e,n),0>w&&(w=c.getSpan(e,n)))}i=n,n+=w}return i+u-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0<t.length&&(e[n.property]=t.shift());return e}layoutFor(t){if(typeof t!="string")throw new TypeError("property must be string");for(const e of this.fields)if(e.property===t)return e}offsetOf(t){if(typeof t!="string")throw new TypeError("property must be string");let e=0;for(const n of this.fields){if(n.property===t)return e;0>n.span?e=-1:0<=e&&(e+=n.span)}}}class mr{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class On extends mr{constructor(t,e){if(!(t instanceof we&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class vr extends Q{constructor(t,e,n){const s=t instanceof tt||t instanceof wr;if(s)t=new On(new pr(t));else if(t instanceof we&&t.isCount())t=new On(t);else if(!(t instanceof mr))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Q))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let u=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return u(c)},this.configGetSourceVariant=function(c){u=c.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const s=this.discriminator,i=s.decode(t,e);let u=this.registry[i];if(u===void 0){let c=0;u=this.defaultLayout,this.usesPrefixDiscriminator&&(c=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[u.property]=this.defaultLayout.decode(t,e+c)}else n=u.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,u=this.defaultLayout;let c=0;return this.usesPrefixDiscriminator&&(c=i.layout.span),i.encode(t[i.property],e,n),c+u.encode(t[u.property],e,n+c)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new Ws(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Z.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Ws extends Q{constructor(t,e,n,s){if(!(t instanceof vr))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Q))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class Xs extends Q{constructor(t,e){if(!(t instanceof we&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof we||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof we&&(s=t.length),!(Z.isBuffer(t)&&s===t.length))throw new TypeError(Gs("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof we&&this.length.encode(s,e,n),s}}var Ys=((r,t,e)=>new pr(r,t,e)),Js=(r=>new tt(1,r)),ce=(r=>new tt(4,r)),Qs=(r=>new Ks(r)),ue=(r=>new Zs(r)),W=((r,t,e)=>new Hs(r,t,e)),br=((r,t,e)=>new vr(r,t,e)),Ue=((r,t)=>new Xs(r,t));class eo extends et{constructor(t){super(-1,t),this.property=t,this.layout=W([ce("length"),ce("lengthPadding"),Ue(Ys(ce(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const s={chars:Z.from(t,"utf8")};return this.layout.encode(s,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return ce().span+ce().span+new Mn(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function nt(r){return new eo(r)}function re(r){return Ue(32,r)}const te=br(ce("instruction"));te.addVariant(0,W([ue("lamports"),ue("space"),re("owner")]),"createAccount");te.addVariant(1,W([re("owner")]),"assign");te.addVariant(2,W([ue("lamports")]),"transfer");te.addVariant(3,W([re("base"),nt("seed"),ue("lamports"),ue("space"),re("owner")]),"createAccountWithSeed");te.addVariant(4,W([re("authorized")]),"advanceNonceAccount");te.addVariant(5,W([ue("lamports")]),"withdrawNonceAccount");te.addVariant(6,W([re("authorized")]),"initializeNonceAccount");te.addVariant(7,W([re("authorized")]),"authorizeNonceAccount");te.addVariant(8,W([ue("space")]),"allocate");te.addVariant(9,W([re("base"),nt("seed"),ue("space"),re("owner")]),"allocateWithSeed");te.addVariant(10,W([re("base"),nt("seed"),re("owner")]),"assignWithSeed");te.addVariant(11,W([ue("lamports"),nt("seed"),re("owner")]),"transferWithSeed");Math.max(...Object.values(te.registry).map(r=>r.span));class to extends et{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function Pn(r){return new to(Ue(32),t=>new X(t),t=>t.toBuffer(),r)}W([ce("version"),ce("state"),Pn("authorizedPubkey"),Pn("nonce"),W([Qs("lamportsPerSignature")],"feeCalculator")]);function no(r){return new TextDecoder().decode(Ye(r))}var ro=Object.freeze({__proto__:null,hash:no});function io(r,t,e){const n=Y.concat([r.toBuffer(),Y.from(t),e.toBuffer()]);return new X(Ye(n))}function _r(r,...t){let e=[Y.from([97,110,99,104,111,114])];t.forEach(s=>{e.push(s instanceof Y?s:ee(s).toBuffer())});const[n]=X.findProgramAddressSync(e,ee(r));return n}var so=Object.freeze({__proto__:null,createWithSeedSync:io,associated:_r});const Nt=new X("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Mt=new X("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function oo({mint:r,owner:t}){return X.findProgramAddressSync([t.toBuffer(),Nt.toBuffer(),r.toBuffer()],Mt)[0]}var ao=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Nt,ASSOCIATED_PROGRAM_ID:Mt,associatedAddress:oo}),It={exports:{}};(function(r,t){var e=typeof self<"u"?self:zs,n=(function(){function i(){this.fetch=!1,this.DOMException=e.DOMException}return i.prototype=e,new i})();(function(i){(function(u){var c={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function w(h){return h&&DataView.prototype.isPrototypeOf(h)}if(c.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=ArrayBuffer.isView||function(h){return h&&l.indexOf(Object.prototype.toString.call(h))>-1};function b(h){if(typeof h!="string"&&(h=String(h)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(h))throw new TypeError("Invalid character in header field name");return h.toLowerCase()}function y(h){return typeof h!="string"&&(h=String(h)),h}function p(h){var v={next:function(){var C=h.shift();return{done:C===void 0,value:C}}};return c.iterable&&(v[Symbol.iterator]=function(){return v}),v}function m(h){this.map={},h instanceof m?h.forEach(function(v,C){this.append(C,v)},this):Array.isArray(h)?h.forEach(function(v){this.append(v[0],v[1])},this):h&&Object.getOwnPropertyNames(h).forEach(function(v){this.append(v,h[v])},this)}m.prototype.append=function(h,v){h=b(h),v=y(v);var C=this.map[h];this.map[h]=C?C+", "+v:v},m.prototype.delete=function(h){delete this.map[b(h)]},m.prototype.get=function(h){return h=b(h),this.has(h)?this.map[h]:null},m.prototype.has=function(h){return this.map.hasOwnProperty(b(h))},m.prototype.set=function(h,v){this.map[b(h)]=y(v)},m.prototype.forEach=function(h,v){for(var C in this.map)this.map.hasOwnProperty(C)&&h.call(v,this.map[C],C,this)},m.prototype.keys=function(){var h=[];return this.forEach(function(v,C){h.push(C)}),p(h)},m.prototype.values=function(){var h=[];return this.forEach(function(v){h.push(v)}),p(h)},m.prototype.entries=function(){var h=[];return this.forEach(function(v,C){h.push([C,v])}),p(h)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function I(h){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}function _(h){return new Promise(function(v,C){h.onload=function(){v(h.result)},h.onerror=function(){C(h.error)}})}function A(h){var v=new FileReader,C=_(v);return v.readAsArrayBuffer(h),C}function O(h){var v=new FileReader,C=_(v);return v.readAsText(h),C}function k(h){for(var v=new Uint8Array(h),C=new Array(v.length),V=0;V<v.length;V++)C[V]=String.fromCharCode(v[V]);return C.join("")}function x(h){if(h.slice)return h.slice(0);var v=new Uint8Array(h.byteLength);return v.set(new Uint8Array(h)),v.buffer}function U(){return this.bodyUsed=!1,this._initBody=function(h){this._bodyInit=h,h?typeof h=="string"?this._bodyText=h:c.blob&&Blob.prototype.isPrototypeOf(h)?this._bodyBlob=h:c.formData&&FormData.prototype.isPrototypeOf(h)?this._bodyFormData=h:c.searchParams&&URLSearchParams.prototype.isPrototypeOf(h)?this._bodyText=h.toString():c.arrayBuffer&&c.blob&&w(h)?(this._bodyArrayBuffer=x(h.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(h)||d(h))?this._bodyArrayBuffer=x(h):this._bodyText=h=Object.prototype.toString.call(h):this._bodyText="",this.headers.get("content-type")||(typeof h=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):c.searchParams&&URLSearchParams.prototype.isPrototypeOf(h)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},c.blob&&(this.blob=function(){var h=I(this);if(h)return h;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?I(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(A)}),this.text=function(){var h=I(this);if(h)return h;if(this._bodyBlob)return O(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(k(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},c.formData&&(this.formData=function(){return this.text().then($)}),this.json=function(){return this.text().then(JSON.parse)},this}var z=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function P(h){var v=h.toUpperCase();return z.indexOf(v)>-1?v:h}function M(h,v){v=v||{};var C=v.body;if(h instanceof M){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url,this.credentials=h.credentials,v.headers||(this.headers=new m(h.headers)),this.method=h.method,this.mode=h.mode,this.signal=h.signal,!C&&h._bodyInit!=null&&(C=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);if(this.credentials=v.credentials||this.credentials||"same-origin",(v.headers||!this.headers)&&(this.headers=new m(v.headers)),this.method=P(v.method||this.method||"GET"),this.mode=v.mode||this.mode||null,this.signal=v.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&C)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(C)}M.prototype.clone=function(){return new M(this,{body:this._bodyInit})};function $(h){var v=new FormData;return h.trim().split("&").forEach(function(C){if(C){var V=C.split("="),K=V.shift().replace(/\+/g," "),g=V.join("=").replace(/\+/g," ");v.append(decodeURIComponent(K),decodeURIComponent(g))}}),v}function N(h){var v=new m,C=h.replace(/\r?\n[\t ]+/g," ");return C.split(/\r?\n/).forEach(function(V){var K=V.split(":"),g=K.shift().trim();if(g){var o=K.join(":").trim();v.append(g,o)}}),v}U.call(M.prototype);function D(h,v){v||(v={}),this.type="default",this.status=v.status===void 0?200:v.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in v?v.statusText:"OK",this.headers=new m(v.headers),this.url=v.url||"",this._initBody(h)}U.call(D.prototype),D.prototype.clone=function(){return new D(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new m(this.headers),url:this.url})},D.error=function(){var h=new D(null,{status:0,statusText:""});return h.type="error",h};var R=[301,302,303,307,308];D.redirect=function(h,v){if(R.indexOf(v)===-1)throw new RangeError("Invalid status code");return new D(null,{status:v,headers:{location:h}})},u.DOMException=i.DOMException;try{new u.DOMException}catch{u.DOMException=function(v,C){this.message=v,this.name=C;var V=Error(v);this.stack=V.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function S(h,v){return new Promise(function(C,V){var K=new M(h,v);if(K.signal&&K.signal.aborted)return V(new u.DOMException("Aborted","AbortError"));var g=new XMLHttpRequest;function o(){g.abort()}g.onload=function(){var a={status:g.status,statusText:g.statusText,headers:N(g.getAllResponseHeaders()||"")};a.url="responseURL"in g?g.responseURL:a.headers.get("X-Request-URL");var f="response"in g?g.response:g.responseText;C(new D(f,a))},g.onerror=function(){V(new TypeError("Network request failed"))},g.ontimeout=function(){V(new TypeError("Network request failed"))},g.onabort=function(){V(new u.DOMException("Aborted","AbortError"))},g.open(K.method,K.url,!0),K.credentials==="include"?g.withCredentials=!0:K.credentials==="omit"&&(g.withCredentials=!1),"responseType"in g&&c.blob&&(g.responseType="blob"),K.headers.forEach(function(a,f){g.setRequestHeader(f,a)}),K.signal&&(K.signal.addEventListener("abort",o),g.onreadystatechange=function(){g.readyState===4&&K.signal.removeEventListener("abort",o)}),g.send(typeof K._bodyInit>"u"?null:K._bodyInit)})}return S.polyfill=!0,i.fetch||(i.fetch=S,i.Headers=m,i.Request=M,i.Response=D),u.Headers=m,u.Request=M,u.Response=D,u.fetch=S,Object.defineProperty(u,"__esModule",{value:!0}),u})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=n;t=s.fetch,t.default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,r.exports=t})(It,It.exports);var co=qs(It.exports);async function uo(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[s,i]=await Promise.all([Er(r,t),co(n)]),u=(await i.json()).filter(w=>!w.aborted&&w.state==="Built"&&w.verified==="Verified");if(u.length===0)return null;const c=u[0];return s.slot.toNumber()!==c.verified_slot?null:c}async function Er(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=Lt(e.data),s=await r.getAccountInfo(n.programdataAddress);if(s===null)throw new Error("program data account not found");const{programData:i}=Lt(s.data);return i}const lo=j.rustEnum([j.struct([],"uninitialized"),j.struct([j.option(j.publicKey(),"authorityAddress")],"buffer"),j.struct([j.publicKey("programdataAddress")],"program"),j.struct([j.u64("slot"),j.option(j.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,j.u32());function Lt(r){return lo.decode(r)}var fo=Object.freeze({__proto__:null,verifiedBuild:uo,fetchData:Er,decodeUpgradeableLoaderState:Lt}),$o=Object.freeze({__proto__:null,sha256:ro,rpc:Ss,publicKey:so,bytes:cs,token:ao,features:Rs,registry:fo});function ho(r){return"accounts"in r}async function po(r){const t=(await X.findProgramAddress([],r))[0];return await X.createWithSeed(t,wo(),r)}function wo(){return"anchor:idl"}const yo=j.struct([j.publicKey("authority"),j.vecU8("data")]);function go(r){return yo.decode(r)}function rt(r,t){var e,n;let s={};const i=r.args?r.args.length:0;if(t.length>i){if(t.length!==i+1)throw new Error(`provided too many arguments ${t} to instruction ${r?.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(u=>u.name))!==null&&n!==void 0?n:[]}`);s=t.pop()}return[t,s]}class Xe{static build(t,e,n){if(t.name==="_inner")throw new He("the _inner name is reserved");const s=(...i)=>{const[u,c]=rt(t,[...i]);ir(t.accounts,c.accounts),mo(t,...i);const w=s.accounts(c.accounts);return c.remainingAccounts!==void 0&&w.push(...c.remainingAccounts),Bt("debug-logs")&&console.log("Outgoing account metas:",w),new Un({keys:w,programId:n,data:e(t.name,ls(t,...u))})};return s.accounts=i=>Xe.accountsArray(i,t.accounts,n,t.name),s}static accountsArray(t,e,n,s){return t?e.map(i=>{if(("accounts"in i?i.accounts:void 0)!==void 0){const c=t[i.name];return Xe.accountsArray(c,i.accounts,n,s).flat()}else{const c=i;let w;try{w=ee(t[i.name])}catch{throw new Error(`Wrong input type for account "${i.name}" in the instruction accounts object${s!==void 0?' for instruction "'+s+'"':""}. Expected PublicKey or string.`)}const l=c.isOptional&&w.equals(n),d=c.isMut&&!l,b=c.isSigner&&!l;return{pubkey:w,isWritable:d,isSigner:b}}}).flat():[]}}function mo(r,...t){}class vo{static build(t,e){return(...s)=>{var i,u,c;const[,w]=rt(t,[...s]),l=new Bn;if(w.preInstructions&&w.instructions)throw new Error("instructions is deprecated, use preInstructions");return(i=w.preInstructions)===null||i===void 0||i.forEach(d=>l.add(d)),(u=w.instructions)===null||u===void 0||u.forEach(d=>l.add(d)),l.add(e(...s)),(c=w.postInstructions)===null||c===void 0||c.forEach(d=>l.add(d)),l}}}class bo{static build(t,e,n,s){return async(...u)=>{var c;const w=e(...u),[,l]=rt(t,[...u]);if(s.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await s.sendAndConfirm(w,(c=l.signers)!==null&&c!==void 0?c:[],l.options)}catch(d){throw lr(d,n)}}}}class _o{static build(t,e,n,s){var i;const u={};return(i=t.accounts)===null||i===void 0||i.forEach(c=>{const w=G(c.name);u[w]=new Eo(t,c,n,s,e)}),u}}class Eo{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,s,i){this._idlAccount=e,this._programId=n,this._provider=s??Ze(),this._coder=i??new hr(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:s,context:i}=n;return{data:s&&s.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,s.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:s}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:s}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(s=>s?s.data:null)}async fetchMultipleAndContext(t,e){return(await Dt(this._provider.connection,t.map(s=>ee(s)),e)).map(s=>{if(s==null)return null;const{account:i,context:u}=s;return{data:this._coder.accounts.decode(this._idlAccount.name,i.data),context:u}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof Z?t:void 0),n=[];return e?.offset!=null&&e?.bytes!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),e?.dataSize!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:i,account:u})=>({publicKey:i,account:this._coder.accounts.decode(this._idlAccount.name,u.data)}))}subscribe(t,e){const n=Se.get(t.toString());if(n)return n.ee;const s=new Qi;t=ee(t);const i=this._provider.connection.onAccountChange(t,u=>{const c=this._coder.accounts.decode(this._idlAccount.name,u.data);s.emit("change",c)},e);return Se.set(t.toString(),{ee:s,listener:i}),s}async unsubscribe(t){let e=Se.get(t.toString());if(!e){console.warn("Address is not subscribed");return}Se&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{Se.delete(t.toString())}).catch(console.error)}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return Nn.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await _r(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(ee(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(ee(t),e)}}const Se=new Map,Tt="Program log: ",Ar="Program data: ",Ao=Tt.length,xo=Ar.length;class ko{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new xr(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let s=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(s)),this._eventCallbacks.set(s,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(i,u)=>{if(!i.err)for(const c of this._eventParser.parseLogs(i.logs)){const w=this._eventListeners.get(c.name);w&&w.forEach(l=>{const d=this._eventCallbacks.get(l);if(d){const[,b]=d;b(c.data,u.slot,i.signature)}})}})),s}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let s=this._eventListeners.get(n);if(!s)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),s=s.filter(i=>i!==t),this._eventListeners.set(n,s),s.length===0&&this._eventListeners.delete(n),this._eventCallbacks.size===0){if(this._eventListeners.size!==0)throw new Error(`Expected event listeners size to be 0 but got ${this._eventListeners.size}`);this._onLogsSubscriptionId!==void 0&&(await this._provider.connection.removeOnLogsListener(this._onLogsSubscriptionId),this._onLogsSubscriptionId=void 0)}}}class xr{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new Io(t),s=new So;let i=n.next();for(;i!==null;){let[u,c,w]=this.handleLog(s,i,e);u&&(yield u),c&&s.push(c),w&&s.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(Tt)||t.startsWith(Ar)){const n=t.startsWith(Tt)?t.slice(Ao):t.slice(xo),s=this.coder.events.decode(n);if(e&&s===null)throw new Error(`Unable to decode event ${n}`);return[s,null,!1]}else return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class So{constructor(){this.stack=[]}program(){if(!this.stack.length)throw new Error("Expected the stack to have elements");return this.stack[this.stack.length-1]}push(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class Io{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class Lo{static build(t,e,n,s,i,u,c){return async(...l)=>{var d;const b=e(...l),[,y]=rt(t,[...l]);let p;if(s.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{p=await s.simulate(b,y.signers,(d=y.options)===null||d===void 0?void 0:d.commitment)}catch(_){throw lr(_,n)}if(p===void 0)throw new Error("Unable to simulate transaction");const m=p.logs;if(!m)throw new Error("Simulated logs not found");const I=[];if(c.events){let _=new xr(u,i);for(const A of _.parseLogs(m))I.push(A)}return{events:I,raw:m}}}}function pt(r){return new kr(Ue(8),t=>$t.fromBuffer(t),t=>t.toBuffer(),r)}function ze(r){return new kr(Ue(32),t=>new X(t),t=>t.toBuffer(),r)}function wt(r,t){return new To(r,t)}class kr extends et{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class To extends et{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=ce()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class $t extends Mn{toBuffer(){const t=super.toArray().reverse(),e=Z.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=Z.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new $t([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const Co=W([ze("mint"),ze("owner"),pt("amount"),wt(ze(),"delegate"),(r=>{const t=br(Js("discriminator"),null,r);return t.addVariant(0,W([]),"uninitialized"),t.addVariant(1,W([]),"initialized"),t.addVariant(2,W([]),"frozen"),t})("state"),wt(pt(),"isNative"),pt("delegatedAmount"),wt(ze(),"closeAuthority")]);function Ro(r){return Co.decode(r)}class Re{constructor(t,e,n,s,i,u,c,w){this._accounts=e,this._provider=n,this._programId=s,this._idlIx=i,this._idlTypes=c,this._customResolver=w,this._args=t,this._accountStore=new Oo(n,u,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const s of e){const i=s.name,u=t[i];u!==void 0&&(Sr(u)?ho(s)?n[i]=this.resolveOptionalsHelper(u,s.accounts):n[i]=Ir(u):u!==null?n[i]=ee(u):s.isOptional&&(n[i]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,s)=>n&&n[s],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((s,i)=>{i==t.length-1&&(n[s]=e),n[s]=n[s]||{},n=n[s]})}async resolveConst(t,e=[]){for(let n=0;n<t.length;n+=1){const s=t[n],i=s.accounts;i&&await this.resolveConst(i,[...e,G(s.name)]);const u=s,c=G(s.name);if(u.isSigner&&!this.get([...e,c])){if(this._provider.wallet===void 0)throw new Error("This function requires the Provider interface implementor to have a 'wallet' field.");this.set([...e,c],this._provider.wallet.publicKey)}Reflect.has(Re.CONST_ACCOUNTS,c)&&!this.get([...e,c])&&this.set([...e,c],Re.CONST_ACCOUNTS[c])}}_resolveEventCpi(t,e=[]){for(const n in t){const s=t[n],i=s.accounts;i&&this._resolveEventCpi(i,[...e,G(s.name)]);const u=+n+1;if(u===t.length)return;const c=G(t[n].name),w=G(t[u].name);if(c==="eventAuthority"&&w==="program"){const l=[...e,c],d=[...e,w];this.get(l)||this.set(l,X.findProgramAddressSync([Z.from("__event_authority")],this._programId)[0]),this.get(d)||this.set(d,this._programId);return}}}async resolvePdas(t,e=[]){let n=0;for(let s=0;s<t.length;s+=1){const i=t[s],u=i.accounts;u&&(n+=await this.resolvePdas(u,[...e,G(i.name)]));const c=i,w=G(i.name);c.pda&&c.pda.seeds.length>0&&!this.get([...e,w])&&await this.autoPopulatePda(c,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let s=0;s<t.length;s+=1){const i=t[s],u=i.accounts;u&&(n+=await this.resolveRelations(u,[...e,G(i.name)]));const c=i.relations||[],w=G(i.name),l=[...e,w],d=this.get(l);if(d){const b=c.filter(y=>!this.get([...e,G(y)]));if(n+=b.length,b.length>0){const y=await this._accountStore.fetchAccount({publicKey:d});await Promise.all(b.map(async p=>{const m=G(p);return this.set([...e,m],y[m]),y[m]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(u=>this.toBuffer(u,e)));if(n.some(u=>typeof u>"u"))return;const s=await this.parseProgramId(t,e);if(!s)return;const[i]=await X.findProgramAddress(n,s);this.set([...e,G(t.name)],i)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new X(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(u=>u.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const i=n.type.fields.find(u=>u.name===e[0]);return this.getType(i.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(!(typeof e>"u"))return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=G(e[0]),s=this._idlIx.args.findIndex(i=>i.name===n);if(s===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((i,u)=>(i||{})[u],this._args[s])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),s=n[0],i=this.get([...e,G(s)]);if(i===null)throw new Error("fieldPubkey is null");if(n.length===1)return i;const u=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(u,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[G(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return Z.from([e]);case"u16":let n=Z.alloc(2);return n.writeUInt16LE(e),n;case"u32":let s=Z.alloc(4);return s.writeUInt32LE(e),s;case"u64":let i=Z.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return Z.from(rr(e));case"publicKey":return e.toBuffer();default:if(t.array)return Z.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}Re.CONST_ACCOUNTS={associatedTokenProgram:Mt,rent:Or,systemProgram:Nn.programId,tokenProgram:Nt,clock:Rr};class Oo{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await Oe.fetchIdl(t,this._provider);if(e){const n=new Oe(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const s=t.toString();if(!this._cache.has(s))if(e==="TokenAccount"){const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const u=Ro(i.data);this._cache.set(s,u)}else if(e){const i=await this.ensureIdl(n);if(i){const u=i[G(e)];if(u){const c=await u.fetch(t);this._cache.set(s,c)}}}else{const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const u=i.data,c=await this.ensureIdl(i.owner);if(c){const w=Object.values(c)[0];if(!w)throw new Error("No accounts for this program");const l=w.coder.accounts.decodeAny(u);this._cache.set(s,l)}}return this._cache.get(s)}}class Po{static build(t,e,n,s,i,u,c,w,l,d,b){return(...y)=>new Do(y,s,i,u,c,w,t,e,n,l,d,b)}}function Sr(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function Ir(r,t){const e={};for(const n in r){const s=r[n];if(s===null)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");e[n]=Sr(s)?Ir(s):ee(s)}return e}class Do{constructor(t,e,n,s,i,u,c,w,l,d,b,y){this._ixFn=e,this._txFn=n,this._rpcFn=s,this._simulateFn=i,this._viewFn=u,this._programId=w,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new Re(t,this._accounts,c,w,l,d,b,y)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&await this._accountsResolver.resolve(),!this._viewFn)throw new Error("Method does not support views");return this._viewFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._ixFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}async prepare(){return{instruction:await this.instruction(),pubkeys:await this.pubkeys(),signers:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class Bo{static build(t,e,n,s){const i=e.accounts.find(w=>w.isMut),u=!!e.returns;return i||!u?void 0:async(...w)=>{var l,d;let b=await n(...w);const y=`Program return: ${t} `;let p=b.raw.find(A=>A.startsWith(y));if(!p)throw new Error("View expected return log");let m=Ct(p.slice(y.length)),I=e.returns;if(!I)throw new Error("View expected return type");return J.fieldLayout({type:I},Array.from([...(l=s.accounts)!==null&&l!==void 0?l:[],...(d=s.types)!==null&&d!==void 0?d:[]])).decode(m)}}}class Uo{static build(t,e,n,s,i){const u={},c={},w={},l={},d={},b={},y=us(t),p=t.accounts?_o.build(t,e,n,s):{};return t.instructions.forEach(m=>{const I=Xe.build(m,(z,P)=>e.instruction.encode(z,P),n),_=vo.build(m,I),A=bo.build(m,_,y,s),O=Lo.build(m,_,y,s,e,n,t),k=Bo.build(n,m,O,t),x=Po.build(s,n,m,I,_,A,O,k,p,t.types||[],i&&i(m)),U=G(m.name);c[U]=I,w[U]=_,u[U]=A,l[U]=O,d[U]=x,k&&(b[U]=k)}),[u,c,w,p,l,d,b]}}class Oe{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,s,i){e=ee(e),n||(n=Ze()),this._idl=t,this._provider=n,this._programId=e,this._coder=s??new hr(t),this._events=new ko(this._programId,n,this._coder);const[u,c,w,l,d,b,y]=Uo.build(t,this._coder,e,n,i??(()=>{}));this.rpc=u,this.instruction=c,this.transaction=w,this.account=l,this.simulate=d,this.methods=b,this.views=y}static async at(t,e){const n=ee(t),s=await Oe.fetchIdl(n,e);if(!s)throw new Error(`IDL not found for program: ${t.toString()}`);return new Oe(s,n,e)}static async fetchIdl(t,e){e=e??Ze();const n=ee(t),s=await po(n),i=await e.connection.getAccountInfo(s);if(!i)return null;let u=go(i.data.slice(8));const c=Xi(u.data);return JSON.parse(nr(c))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}new X("11111111111111111111111111111111");export{Oe as P,Mo as c,j as d,$o as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cY as a,cp as i,d4 as c}from"../main.js";import{S as d}from"./sui-
|
|
1
|
+
import{cY as a,cp as i,d4 as c}from"../main.js";import{S as d}from"./sui-7K04yY2U.js";import{c as h}from"./create-54a95t1x.js";import"./chain-gFcyni6Z.js";import"./blake2b-Co34_VaK.js";import"./index-CVw-_90u.js";class n{network;chain;provider;contracts;chainId;coreBridgePackageId;constructor(t,s,r,o){this.network=t,this.chain=s,this.provider=r,this.contracts=o,this.chainId=a(s);const e=o.coreBridge;if(!e)throw new Error(`CoreBridge contract Address for chain ${s} not found`);this.coreBridgePackageId=e}getGuardianSet(t){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(t,s){const[r,o]=await d.chainFromRpc(t),e=s[o];if(e.network!==r)throw new Error(`Network mismatch: ${e.network} !== ${r}`);return new n(r,o,t,e.contracts)}async*verifyMessage(t,s){throw new Error("Method not implemented.")}async*publishMessage(t,s){throw new Error("Method not implemented.")}async parseTransaction(t){return(await this.parseMessages(t)).map(r=>({emitter:r.emitterAddress,sequence:r.sequence,chain:this.chain}))}async getGuardianSetIndex(){throw new Error("Method not implemented.")}async parseMessages(t){const r=(await this.provider.getTransactionBlock({digest:t,options:{showEvents:!0,showEffects:!0,showInput:!0}})).events?.filter(o=>o.type.endsWith("WormholeMessage"));if(!r||r.length==0)throw new Error("WormholeMessage not found");return r.map(o=>{const e=o.parsedJson;return h("Uint8Array",{emitterChain:this.chain,emitterAddress:new i(e.sender).toUniversalAddress(),sequence:BigInt(e.sequence),guardianSet:0,timestamp:Number(e.timestamp),consistencyLevel:e.consistency_level,nonce:e.nonce,signatures:[],payload:new Uint8Array(e.payload)})})}}c("Sui","WormholeCore",n);export{n as SuiWormholeCore};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{P as n,k as c,cY as p,cT as l,cU as E,cV as H,cW as Y,T as Z,dl as Q,bh as W,dn as x,dp as X,dq as K,dr as j,a as N,V as v,d4 as J,bi as $}from"../main.js";import{d as ee,g as te,a as ie,b as ne,c as se,S as ae,e as re,f as oe}from"./index-DZpeOp3V.js";import{deriveWrappedMetaKey as G,deriveTokenBridgeConfigKey as O,deriveAuthoritySignerKey as ce,deriveSenderAccountKey as de,deriveMintAuthorityKey as ue,deriveEndpointKey as me}from"./index-DRk-Cj0P.js";import{P as ge}from"./index-g9iLhWvp.js";import{b as fe,e as le}from"./signer-Dl8_VMmx.js";import"./create-q7V6muDT.js";import"./chain-gFcyni6Z.js";const pe={version:"0.1.0",name:"wormhole_gateway",instructions:[{name:"initialize",accounts:[{name:"authority",isMut:!0,isSigner:!0},{name:"custodian",isMut:!0,isSigner:!1},{name:"tbtcMint",isMut:!1,isSigner:!1,docs:["TBTC Program's mint PDA address bump is saved in this program's config. Ordinarily, we would","not have to deserialize this account. But we do in this case to make sure the TBTC program","has been initialized before this program."]},{name:"wrappedTbtcMint",isMut:!1,isSigner:!1},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1},{name:"tokenBridgeSender",isMut:!1,isSigner:!1,docs:["sign for transferring via Token Bridge program with a message."]},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[{name:"mintingLimit",type:"u64"}]},{name:"changeAuthority",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"authority",isMut:!1,isSigner:!0},{name:"newAuthority",isMut:!1,isSigner:!1}],args:[]},{name:"cancelAuthorityChange",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"authority",isMut:!1,isSigner:!0}],args:[]},{name:"takeAuthority",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"pendingAuthority",isMut:!1,isSigner:!0}],args:[]},{name:"updateGatewayAddress",accounts:[{name:"custodian",isMut:!1,isSigner:!1},{name:"gatewayInfo",isMut:!0,isSigner:!1},{name:"authority",isMut:!0,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"UpdateGatewayAddressArgs"}}]},{name:"updateMintingLimit",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"authority",isMut:!1,isSigner:!0}],args:[{name:"newLimit",type:"u64"}]},{name:"receiveTbtc",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"custodian",isMut:!0,isSigner:!1},{name:"postedVaa",isMut:!1,isSigner:!1},{name:"tokenBridgeClaim",isMut:!0,isSigner:!1,docs:["transfer. By checking whether this account exists is a short-circuit way of bailing out","early if this transfer has already been redeemed (as opposed to letting the Token Bridge","instruction fail)."]},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1,docs:["Custody account."]},{name:"wrappedTbtcMint",isMut:!0,isSigner:!1,docs:["This mint is owned by the Wormhole Token Bridge program. This PDA address is stored in the","custodian account."]},{name:"tbtcMint",isMut:!0,isSigner:!1},{name:"recipientToken",isMut:!0,isSigner:!1,docs:["Token account for minted tBTC.","","NOTE: Because the recipient is encoded in the transfer message payload, we can check the","authority from the deserialized VAA. But we should still check whether the authority is the","zero address in access control."]},{name:"recipient",isMut:!1,isSigner:!1,docs:["be created for him."]},{name:"recipientWrappedToken",isMut:!0,isSigner:!1,docs:["The gateway will create an associated token account for the recipient if it doesn't exist.","","NOTE: When the minting limit increases, the recipient can use this token account to mint","tBTC using the deposit_wormhole_tbtc instruction."]},{name:"tbtcConfig",isMut:!1,isSigner:!1},{name:"tbtcMinterInfo",isMut:!1,isSigner:!1},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeRegisteredEmitter",isMut:!1,isSigner:!1},{name:"tokenBridgeWrappedAsset",isMut:!1,isSigner:!1},{name:"tokenBridgeMintAuthority",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"tbtcProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"coreBridgeProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"messageHash",type:{array:["u8",32]}}]},{name:"sendTbtcGateway",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"gatewayInfo",isMut:!1,isSigner:!1},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1,docs:["Custody account."]},{name:"wrappedTbtcMint",isMut:!0,isSigner:!1},{name:"tbtcMint",isMut:!0,isSigner:!1},{name:"senderToken",isMut:!0,isSigner:!1},{name:"sender",isMut:!0,isSigner:!0},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeWrappedAsset",isMut:!1,isSigner:!1},{name:"tokenBridgeTransferAuthority",isMut:!1,isSigner:!1},{name:"coreBridgeData",isMut:!0,isSigner:!1},{name:"coreMessage",isMut:!0,isSigner:!1},{name:"tokenBridgeCoreEmitter",isMut:!1,isSigner:!1},{name:"coreEmitterSequence",isMut:!0,isSigner:!1},{name:"coreFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"tokenBridgeSender",isMut:!1,isSigner:!1,docs:["sign for transferring via Token Bridge program with a message."]},{name:"rent",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"coreBridgeProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"SendTbtcGatewayArgs"}}]},{name:"sendTbtcWrapped",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1,docs:["Custody account."]},{name:"wrappedTbtcMint",isMut:!0,isSigner:!1},{name:"tbtcMint",isMut:!0,isSigner:!1},{name:"senderToken",isMut:!0,isSigner:!1},{name:"sender",isMut:!0,isSigner:!0},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeWrappedAsset",isMut:!1,isSigner:!1},{name:"tokenBridgeTransferAuthority",isMut:!1,isSigner:!1},{name:"coreBridgeData",isMut:!0,isSigner:!1},{name:"coreMessage",isMut:!0,isSigner:!1},{name:"tokenBridgeCoreEmitter",isMut:!1,isSigner:!1},{name:"coreEmitterSequence",isMut:!0,isSigner:!1},{name:"coreFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"coreBridgeProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"SendTbtcWrappedArgs"}}]},{name:"depositWormholeTbtc",accounts:[{name:"custodian",isMut:!0,isSigner:!1,docs:["NOTE: This account also acts as a minter for the TBTC program."]},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1,docs:["This token account is owned by this program, whose mint is the wrapped TBTC mint. This PDA","address is stored in the custodian account."]},{name:"wrappedTbtcMint",isMut:!1,isSigner:!1,docs:["This mint is owned by the Wormhole Token Bridge program. This PDA address is stored in the","custodian account."]},{name:"tbtcMint",isMut:!0,isSigner:!1,docs:["This mint is owned by the TBTC program. This PDA address is stored in the custodian account."]},{name:"recipientWrappedToken",isMut:!0,isSigner:!1},{name:"recipientToken",isMut:!0,isSigner:!1},{name:"recipient",isMut:!1,isSigner:!0,docs:["This program requires that the owner of the TBTC token account sign for TBTC being minted","into his account."]},{name:"tbtcConfig",isMut:!1,isSigner:!1},{name:"tbtcMinterInfo",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tbtcProgram",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"}]}],accounts:[{name:"custodian",type:{kind:"struct",fields:[{name:"bump",type:"u8"},{name:"authority",type:"publicKey"},{name:"pendingAuthority",type:{option:"publicKey"}},{name:"tbtcMint",type:"publicKey"},{name:"wrappedTbtcMint",type:"publicKey"},{name:"wrappedTbtcToken",type:"publicKey"},{name:"tokenBridgeSender",type:"publicKey"},{name:"tokenBridgeSenderBump",type:"u8"},{name:"mintingLimit",type:"u64"},{name:"mintedAmount",type:"u64"}]}},{name:"GatewayInfo",type:{kind:"struct",fields:[{name:"bump",type:"u8"},{name:"address",type:{array:["u8",32]}}]}}],types:[{name:"UpdateGatewayAddressArgs",type:{kind:"struct",fields:[{name:"chain",type:"u16"},{name:"address",type:{array:["u8",32]}}]}},{name:"SendTbtcGatewayArgs",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"recipientChain",type:"u16"},{name:"recipient",type:{array:["u8",32]}},{name:"nonce",type:"u32"}]}},{name:"SendTbtcWrappedArgs",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"recipientChain",type:"u16"},{name:"recipient",type:{array:["u8",32]}},{name:"arbiterFee",type:"u64"},{name:"nonce",type:"u32"}]}}],events:[{name:"WormholeTbtcReceived",fields:[{name:"receiver",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1}]},{name:"WormholeTbtcSent",fields:[{name:"amount",type:"u64",index:!1},{name:"recipientChain",type:"u16",index:!1},{name:"gateway",type:{array:["u8",32]},index:!1},{name:"recipient",type:{array:["u8",32]},index:!1},{name:"arbiterFee",type:"u64",index:!1},{name:"nonce",type:"u32",index:!1}]},{name:"WormholeTbtcDeposited",fields:[{name:"depositor",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1}]},{name:"GatewayAddressUpdated",fields:[{name:"chain",type:"u16",index:!1},{name:"gateway",type:{array:["u8",32]},index:!1}]},{name:"MintingLimitUpdated",fields:[{name:"mintingLimit",type:"u64",index:!1}]}],errors:[{code:6016,name:"MintingLimitExceeded",msg:"Cannot mint more than the minting limit"},{code:6032,name:"IsNotAuthority",msg:"Only custodian authority is permitted for this action"},{code:6034,name:"IsNotPendingAuthority",msg:"Not valid pending authority to take authority"},{code:6036,name:"NoPendingAuthorityChange",msg:"No pending authority"},{code:6048,name:"ZeroRecipient",msg:"0x0 recipient not allowed"},{code:6064,name:"NotEnoughWrappedTbtc",msg:"Not enough wormhole tBTC in the gateway to bridge"},{code:6080,name:"ZeroAmount",msg:"Amount must not be 0"},{code:6112,name:"TransferAlreadyRedeemed",msg:"Token Bridge transfer already redeemed"},{code:6128,name:"InvalidEthereumTbtc",msg:"Token chain and address do not match Ethereum's tBTC"},{code:6144,name:"NoTbtcTransferred",msg:"No tBTC transferred"},{code:6160,name:"RecipientZeroAddress",msg:"0x0 receiver not allowed"},{code:6176,name:"MintedAmountUnderflow",msg:"Not enough minted by the gateway to satisfy sending tBTC"},{code:6178,name:"MintedAmountOverflow",msg:"Minted amount after deposit exceeds u64"}]};function L(a){return n.findProgramAddressSync([c.from("redeemer")],new n(a))[0]}function he(a,t){const e=c.alloc(8);return e.writeBigUInt64LE(t),n.findProgramAddressSync([c.from("msg"),e],new n(a))[0]}function ye(a,t){const e=c.alloc(2);return e.writeUInt16LE(p(t)),n.findProgramAddressSync([c.from("gateway-info"),e],new n(a))[0]}const T=new n("Gj93RRt6QB7FjmyokAD5rcMAku7pq3Fk2Aa8y6nNbwsV");function we(){return n.findProgramAddressSync([c.from("config")],T)[0]}function Se(a){return n.findProgramAddressSync([c.from("minter-info"),a.toBuffer()],T)[0]}const B=new n("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new n("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const b=new n("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new n("So11111111111111111111111111111111111111112");new n("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");class ke extends Error{constructor(t){super(t)}}class Me extends ke{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const Te=l.struct([l.u32("mintAuthorityOption"),E("mintAuthority"),H("supply"),l.u8("decimals"),Y("isInitialized"),l.u32("freezeAuthorityOption"),E("freezeAuthority")]);Te.span;async function M(a,t,e=!1,r=B,i=b){if(!e&&!n.isOnCurve(t.toBuffer()))throw new Me;const[s]=await n.findProgramAddress([t.toBuffer(),r.toBuffer(),a.toBuffer()],i);return s}function Be(a,t,e,r,i=B,s=b){return be(a,t,e,r,c.alloc(0),i,s)}function be(a,t,e,r,i,s=B,o=b){const d=[{pubkey:a,isSigner:!0,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Q.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new Z({keys:d,programId:o,data:i})}class A{network;chain;connection;contracts;gateway;tokenBridgeId;coreBridgeId;constructor(t,e,r,i){if(this.network=t,this.chain=e,this.connection=r,this.contracts=i,this.network!=="Mainnet")throw new Error("TBTC is only supported on Mainnet");if(!this.contracts.tbtc)throw new Error("TBTC contract address is required");if(!this.contracts.tokenBridge)throw new Error("TokenBridge contract address is required");if(!this.contracts.coreBridge)throw new Error("CoreBridge contract address is required");this.gateway=new ge(pe,this.contracts.tbtc,{connection:r}),this.tokenBridgeId=new n(this.contracts.tokenBridge),this.coreBridgeId=new n(this.contracts.coreBridge)}static async fromRpc(t,e){const[r,i]=await fe.chainFromRpc(t),s=e[i];if(s.network!==r)throw new Error(`Network mismatch: ${s.network} != ${r}`);return new A(r,i,t,s.contracts)}async*transfer(t,e,r){const i=new W(t).unwrap(),s=L(this.gateway.programId),{tbtcMint:o,wrappedTbtcToken:d,wrappedTbtcMint:u}=await this.gateway.account.custodian.fetch(s),h=G(this.tokenBridgeId,u),m=O(this.tokenBridgeId),g=ce(this.tokenBridgeId),C=ee(this.coreBridgeId),{sequence:y}=await te(this.connection,this.tokenBridgeId,this.coreBridgeId),w=he(this.gateway.programId,y),S=ie(this.coreBridgeId),f=ne(this.tokenBridgeId),k=se(f,this.coreBridgeId),R=ye(this.gateway.programId,e.chain),U=de(this.gateway.programId),P={amount:new x.BN(r.toString()),recipientChain:p(e.chain),recipient:[...e.address.toUniversalAddress().toUint8Array()],nonce:0},V=await M(o,i),q=X.get(this.network,e.chain),I={custodian:s,wrappedTbtcToken:d,wrappedTbtcMint:u,tbtcMint:o,senderToken:V,sender:i,tokenBridgeConfig:m,tokenBridgeWrappedAsset:h,tokenBridgeTransferAuthority:g,coreBridgeData:S,coreMessage:w,tokenBridgeCoreEmitter:f,coreEmitterSequence:k,coreFeeCollector:C,clock:j,rent:K,tokenBridgeProgram:this.tokenBridgeId,coreBridgeProgram:this.coreBridgeId},D=q?await this.gateway.methods.sendTbtcGateway({...P}).accounts({...I,gatewayInfo:R,tokenBridgeSender:U}).instruction():await this.gateway.methods.sendTbtcWrapped({...P,arbiterFee:new x.BN(0)}).accounts(I).instruction(),{blockhash:_}=await this.connection.getLatestBlockhash(),F=N.compile({instructions:[D],payerKey:i,recentBlockhash:_}),z=new v(F);yield this.createUnsignedTransaction({transaction:z},"TBTCBridge.Send")}async*redeem(t,e){if(e.payloadName!=="GatewayTransfer")throw new Error("Invalid VAA payload");yield*new ae(this.network,this.chain,this.connection,this.contracts).postVaa(t,e);const i=[],s=new W(t).unwrap(),o=e.payload.payload.recipient.toNative(this.chain).unwrap(),d=L(this.gateway.programId),{tbtcMint:u,wrappedTbtcToken:h,wrappedTbtcMint:m}=await this.gateway.account.custodian.fetch(d),g=await M(u,o);await this.connection.getAccountInfo(g)||i.push(Be(s,g,o,u));const y=G(this.tokenBridgeId,m),w=await M(m,o);i.push(await this.gateway.methods.receiveTbtc([...e.hash]).accounts({payer:s,custodian:d,postedVaa:oe(this.coreBridgeId,c.from(e.hash)),tokenBridgeClaim:re(this.tokenBridgeId,e.emitterAddress.toUint8Array(),p(e.emitterChain),e.sequence),wrappedTbtcToken:h,wrappedTbtcMint:m,tbtcMint:u,recipientToken:g,recipient:o,recipientWrappedToken:w,tbtcConfig:we(),tbtcMinterInfo:Se(d),tokenBridgeConfig:O(this.tokenBridgeId),tokenBridgeRegisteredEmitter:me(this.tokenBridgeId,p(e.emitterChain),e.emitterAddress.toUint8Array()),tokenBridgeWrappedAsset:y,tokenBridgeMintAuthority:ue(this.tokenBridgeId),rent:K,tbtcProgram:T,tokenBridgeProgram:this.tokenBridgeId,coreBridgeProgram:this.coreBridgeId}).instruction());const{blockhash:S}=await this.connection.getLatestBlockhash(),f=N.compile({instructions:i,payerKey:s,recentBlockhash:S}),k=new v(f);yield this.createUnsignedTransaction({transaction:k},"TBTCBridge.Send")}createUnsignedTransaction(t,e){return new le(t,this.network,this.chain,e,!1)}}J($,"TBTCBridge",A);export{A as SolanaTBTCBridge};
|
|
1
|
+
import{P as n,k as c,cY as p,cT as l,cU as E,cV as H,cW as Y,T as Z,dm as Q,bh as W,dp as x,dq as X,dr as K,ds as j,a as N,V as v,d4 as J,bi as $}from"../main.js";import{d as ee,g as te,a as ie,b as ne,c as se,S as ae,e as re,f as oe}from"./index-CO4HXUmy.js";import{deriveWrappedMetaKey as G,deriveTokenBridgeConfigKey as O,deriveAuthoritySignerKey as ce,deriveSenderAccountKey as de,deriveMintAuthorityKey as ue,deriveEndpointKey as me}from"./index-ClrVAZUa.js";import{P as ge}from"./index-GKTf0CV7.js";import{b as fe,e as le}from"./signer-Dl8_VMmx.js";import"./create-54a95t1x.js";import"./chain-gFcyni6Z.js";const pe={version:"0.1.0",name:"wormhole_gateway",instructions:[{name:"initialize",accounts:[{name:"authority",isMut:!0,isSigner:!0},{name:"custodian",isMut:!0,isSigner:!1},{name:"tbtcMint",isMut:!1,isSigner:!1,docs:["TBTC Program's mint PDA address bump is saved in this program's config. Ordinarily, we would","not have to deserialize this account. But we do in this case to make sure the TBTC program","has been initialized before this program."]},{name:"wrappedTbtcMint",isMut:!1,isSigner:!1},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1},{name:"tokenBridgeSender",isMut:!1,isSigner:!1,docs:["sign for transferring via Token Bridge program with a message."]},{name:"systemProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1}],args:[{name:"mintingLimit",type:"u64"}]},{name:"changeAuthority",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"authority",isMut:!1,isSigner:!0},{name:"newAuthority",isMut:!1,isSigner:!1}],args:[]},{name:"cancelAuthorityChange",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"authority",isMut:!1,isSigner:!0}],args:[]},{name:"takeAuthority",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"pendingAuthority",isMut:!1,isSigner:!0}],args:[]},{name:"updateGatewayAddress",accounts:[{name:"custodian",isMut:!1,isSigner:!1},{name:"gatewayInfo",isMut:!0,isSigner:!1},{name:"authority",isMut:!0,isSigner:!0},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"UpdateGatewayAddressArgs"}}]},{name:"updateMintingLimit",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"authority",isMut:!1,isSigner:!0}],args:[{name:"newLimit",type:"u64"}]},{name:"receiveTbtc",accounts:[{name:"payer",isMut:!0,isSigner:!0},{name:"custodian",isMut:!0,isSigner:!1},{name:"postedVaa",isMut:!1,isSigner:!1},{name:"tokenBridgeClaim",isMut:!0,isSigner:!1,docs:["transfer. By checking whether this account exists is a short-circuit way of bailing out","early if this transfer has already been redeemed (as opposed to letting the Token Bridge","instruction fail)."]},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1,docs:["Custody account."]},{name:"wrappedTbtcMint",isMut:!0,isSigner:!1,docs:["This mint is owned by the Wormhole Token Bridge program. This PDA address is stored in the","custodian account."]},{name:"tbtcMint",isMut:!0,isSigner:!1},{name:"recipientToken",isMut:!0,isSigner:!1,docs:["Token account for minted tBTC.","","NOTE: Because the recipient is encoded in the transfer message payload, we can check the","authority from the deserialized VAA. But we should still check whether the authority is the","zero address in access control."]},{name:"recipient",isMut:!1,isSigner:!1,docs:["be created for him."]},{name:"recipientWrappedToken",isMut:!0,isSigner:!1,docs:["The gateway will create an associated token account for the recipient if it doesn't exist.","","NOTE: When the minting limit increases, the recipient can use this token account to mint","tBTC using the deposit_wormhole_tbtc instruction."]},{name:"tbtcConfig",isMut:!1,isSigner:!1},{name:"tbtcMinterInfo",isMut:!1,isSigner:!1},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeRegisteredEmitter",isMut:!1,isSigner:!1},{name:"tokenBridgeWrappedAsset",isMut:!1,isSigner:!1},{name:"tokenBridgeMintAuthority",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"tbtcProgram",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"coreBridgeProgram",isMut:!1,isSigner:!1},{name:"associatedTokenProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"messageHash",type:{array:["u8",32]}}]},{name:"sendTbtcGateway",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"gatewayInfo",isMut:!1,isSigner:!1},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1,docs:["Custody account."]},{name:"wrappedTbtcMint",isMut:!0,isSigner:!1},{name:"tbtcMint",isMut:!0,isSigner:!1},{name:"senderToken",isMut:!0,isSigner:!1},{name:"sender",isMut:!0,isSigner:!0},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeWrappedAsset",isMut:!1,isSigner:!1},{name:"tokenBridgeTransferAuthority",isMut:!1,isSigner:!1},{name:"coreBridgeData",isMut:!0,isSigner:!1},{name:"coreMessage",isMut:!0,isSigner:!1},{name:"tokenBridgeCoreEmitter",isMut:!1,isSigner:!1},{name:"coreEmitterSequence",isMut:!0,isSigner:!1},{name:"coreFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"tokenBridgeSender",isMut:!1,isSigner:!1,docs:["sign for transferring via Token Bridge program with a message."]},{name:"rent",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"coreBridgeProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"SendTbtcGatewayArgs"}}]},{name:"sendTbtcWrapped",accounts:[{name:"custodian",isMut:!0,isSigner:!1},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1,docs:["Custody account."]},{name:"wrappedTbtcMint",isMut:!0,isSigner:!1},{name:"tbtcMint",isMut:!0,isSigner:!1},{name:"senderToken",isMut:!0,isSigner:!1},{name:"sender",isMut:!0,isSigner:!0},{name:"tokenBridgeConfig",isMut:!1,isSigner:!1},{name:"tokenBridgeWrappedAsset",isMut:!1,isSigner:!1},{name:"tokenBridgeTransferAuthority",isMut:!1,isSigner:!1},{name:"coreBridgeData",isMut:!0,isSigner:!1},{name:"coreMessage",isMut:!0,isSigner:!1},{name:"tokenBridgeCoreEmitter",isMut:!1,isSigner:!1},{name:"coreEmitterSequence",isMut:!0,isSigner:!1},{name:"coreFeeCollector",isMut:!0,isSigner:!1},{name:"clock",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"tokenBridgeProgram",isMut:!1,isSigner:!1},{name:"coreBridgeProgram",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"systemProgram",isMut:!1,isSigner:!1}],args:[{name:"args",type:{defined:"SendTbtcWrappedArgs"}}]},{name:"depositWormholeTbtc",accounts:[{name:"custodian",isMut:!0,isSigner:!1,docs:["NOTE: This account also acts as a minter for the TBTC program."]},{name:"wrappedTbtcToken",isMut:!0,isSigner:!1,docs:["This token account is owned by this program, whose mint is the wrapped TBTC mint. This PDA","address is stored in the custodian account."]},{name:"wrappedTbtcMint",isMut:!1,isSigner:!1,docs:["This mint is owned by the Wormhole Token Bridge program. This PDA address is stored in the","custodian account."]},{name:"tbtcMint",isMut:!0,isSigner:!1,docs:["This mint is owned by the TBTC program. This PDA address is stored in the custodian account."]},{name:"recipientWrappedToken",isMut:!0,isSigner:!1},{name:"recipientToken",isMut:!0,isSigner:!1},{name:"recipient",isMut:!1,isSigner:!0,docs:["This program requires that the owner of the TBTC token account sign for TBTC being minted","into his account."]},{name:"tbtcConfig",isMut:!1,isSigner:!1},{name:"tbtcMinterInfo",isMut:!1,isSigner:!1},{name:"tokenProgram",isMut:!1,isSigner:!1},{name:"tbtcProgram",isMut:!1,isSigner:!1}],args:[{name:"amount",type:"u64"}]}],accounts:[{name:"custodian",type:{kind:"struct",fields:[{name:"bump",type:"u8"},{name:"authority",type:"publicKey"},{name:"pendingAuthority",type:{option:"publicKey"}},{name:"tbtcMint",type:"publicKey"},{name:"wrappedTbtcMint",type:"publicKey"},{name:"wrappedTbtcToken",type:"publicKey"},{name:"tokenBridgeSender",type:"publicKey"},{name:"tokenBridgeSenderBump",type:"u8"},{name:"mintingLimit",type:"u64"},{name:"mintedAmount",type:"u64"}]}},{name:"GatewayInfo",type:{kind:"struct",fields:[{name:"bump",type:"u8"},{name:"address",type:{array:["u8",32]}}]}}],types:[{name:"UpdateGatewayAddressArgs",type:{kind:"struct",fields:[{name:"chain",type:"u16"},{name:"address",type:{array:["u8",32]}}]}},{name:"SendTbtcGatewayArgs",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"recipientChain",type:"u16"},{name:"recipient",type:{array:["u8",32]}},{name:"nonce",type:"u32"}]}},{name:"SendTbtcWrappedArgs",type:{kind:"struct",fields:[{name:"amount",type:"u64"},{name:"recipientChain",type:"u16"},{name:"recipient",type:{array:["u8",32]}},{name:"arbiterFee",type:"u64"},{name:"nonce",type:"u32"}]}}],events:[{name:"WormholeTbtcReceived",fields:[{name:"receiver",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1}]},{name:"WormholeTbtcSent",fields:[{name:"amount",type:"u64",index:!1},{name:"recipientChain",type:"u16",index:!1},{name:"gateway",type:{array:["u8",32]},index:!1},{name:"recipient",type:{array:["u8",32]},index:!1},{name:"arbiterFee",type:"u64",index:!1},{name:"nonce",type:"u32",index:!1}]},{name:"WormholeTbtcDeposited",fields:[{name:"depositor",type:"publicKey",index:!1},{name:"amount",type:"u64",index:!1}]},{name:"GatewayAddressUpdated",fields:[{name:"chain",type:"u16",index:!1},{name:"gateway",type:{array:["u8",32]},index:!1}]},{name:"MintingLimitUpdated",fields:[{name:"mintingLimit",type:"u64",index:!1}]}],errors:[{code:6016,name:"MintingLimitExceeded",msg:"Cannot mint more than the minting limit"},{code:6032,name:"IsNotAuthority",msg:"Only custodian authority is permitted for this action"},{code:6034,name:"IsNotPendingAuthority",msg:"Not valid pending authority to take authority"},{code:6036,name:"NoPendingAuthorityChange",msg:"No pending authority"},{code:6048,name:"ZeroRecipient",msg:"0x0 recipient not allowed"},{code:6064,name:"NotEnoughWrappedTbtc",msg:"Not enough wormhole tBTC in the gateway to bridge"},{code:6080,name:"ZeroAmount",msg:"Amount must not be 0"},{code:6112,name:"TransferAlreadyRedeemed",msg:"Token Bridge transfer already redeemed"},{code:6128,name:"InvalidEthereumTbtc",msg:"Token chain and address do not match Ethereum's tBTC"},{code:6144,name:"NoTbtcTransferred",msg:"No tBTC transferred"},{code:6160,name:"RecipientZeroAddress",msg:"0x0 receiver not allowed"},{code:6176,name:"MintedAmountUnderflow",msg:"Not enough minted by the gateway to satisfy sending tBTC"},{code:6178,name:"MintedAmountOverflow",msg:"Minted amount after deposit exceeds u64"}]};function L(a){return n.findProgramAddressSync([c.from("redeemer")],new n(a))[0]}function he(a,t){const e=c.alloc(8);return e.writeBigUInt64LE(t),n.findProgramAddressSync([c.from("msg"),e],new n(a))[0]}function ye(a,t){const e=c.alloc(2);return e.writeUInt16LE(p(t)),n.findProgramAddressSync([c.from("gateway-info"),e],new n(a))[0]}const T=new n("Gj93RRt6QB7FjmyokAD5rcMAku7pq3Fk2Aa8y6nNbwsV");function we(){return n.findProgramAddressSync([c.from("config")],T)[0]}function Se(a){return n.findProgramAddressSync([c.from("minter-info"),a.toBuffer()],T)[0]}const B=new n("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new n("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const b=new n("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new n("So11111111111111111111111111111111111111112");new n("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");class ke extends Error{constructor(t){super(t)}}class Me extends ke{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const Te=l.struct([l.u32("mintAuthorityOption"),E("mintAuthority"),H("supply"),l.u8("decimals"),Y("isInitialized"),l.u32("freezeAuthorityOption"),E("freezeAuthority")]);Te.span;async function M(a,t,e=!1,r=B,i=b){if(!e&&!n.isOnCurve(t.toBuffer()))throw new Me;const[s]=await n.findProgramAddress([t.toBuffer(),r.toBuffer(),a.toBuffer()],i);return s}function Be(a,t,e,r,i=B,s=b){return be(a,t,e,r,c.alloc(0),i,s)}function be(a,t,e,r,i,s=B,o=b){const d=[{pubkey:a,isSigner:!0,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:Q.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new Z({keys:d,programId:o,data:i})}class A{network;chain;connection;contracts;gateway;tokenBridgeId;coreBridgeId;constructor(t,e,r,i){if(this.network=t,this.chain=e,this.connection=r,this.contracts=i,this.network!=="Mainnet")throw new Error("TBTC is only supported on Mainnet");if(!this.contracts.tbtc)throw new Error("TBTC contract address is required");if(!this.contracts.tokenBridge)throw new Error("TokenBridge contract address is required");if(!this.contracts.coreBridge)throw new Error("CoreBridge contract address is required");this.gateway=new ge(pe,this.contracts.tbtc,{connection:r}),this.tokenBridgeId=new n(this.contracts.tokenBridge),this.coreBridgeId=new n(this.contracts.coreBridge)}static async fromRpc(t,e){const[r,i]=await fe.chainFromRpc(t),s=e[i];if(s.network!==r)throw new Error(`Network mismatch: ${s.network} != ${r}`);return new A(r,i,t,s.contracts)}async*transfer(t,e,r){const i=new W(t).unwrap(),s=L(this.gateway.programId),{tbtcMint:o,wrappedTbtcToken:d,wrappedTbtcMint:u}=await this.gateway.account.custodian.fetch(s),h=G(this.tokenBridgeId,u),m=O(this.tokenBridgeId),g=ce(this.tokenBridgeId),C=ee(this.coreBridgeId),{sequence:y}=await te(this.connection,this.tokenBridgeId,this.coreBridgeId),w=he(this.gateway.programId,y),S=ie(this.coreBridgeId),f=ne(this.tokenBridgeId),k=se(f,this.coreBridgeId),R=ye(this.gateway.programId,e.chain),U=de(this.gateway.programId),P={amount:new x.BN(r.toString()),recipientChain:p(e.chain),recipient:[...e.address.toUniversalAddress().toUint8Array()],nonce:0},V=await M(o,i),q=X.get(this.network,e.chain),I={custodian:s,wrappedTbtcToken:d,wrappedTbtcMint:u,tbtcMint:o,senderToken:V,sender:i,tokenBridgeConfig:m,tokenBridgeWrappedAsset:h,tokenBridgeTransferAuthority:g,coreBridgeData:S,coreMessage:w,tokenBridgeCoreEmitter:f,coreEmitterSequence:k,coreFeeCollector:C,clock:j,rent:K,tokenBridgeProgram:this.tokenBridgeId,coreBridgeProgram:this.coreBridgeId},D=q?await this.gateway.methods.sendTbtcGateway({...P}).accounts({...I,gatewayInfo:R,tokenBridgeSender:U}).instruction():await this.gateway.methods.sendTbtcWrapped({...P,arbiterFee:new x.BN(0)}).accounts(I).instruction(),{blockhash:_}=await this.connection.getLatestBlockhash(),F=N.compile({instructions:[D],payerKey:i,recentBlockhash:_}),z=new v(F);yield this.createUnsignedTransaction({transaction:z},"TBTCBridge.Send")}async*redeem(t,e){if(e.payloadName!=="GatewayTransfer")throw new Error("Invalid VAA payload");yield*new ae(this.network,this.chain,this.connection,this.contracts).postVaa(t,e);const i=[],s=new W(t).unwrap(),o=e.payload.payload.recipient.toNative(this.chain).unwrap(),d=L(this.gateway.programId),{tbtcMint:u,wrappedTbtcToken:h,wrappedTbtcMint:m}=await this.gateway.account.custodian.fetch(d),g=await M(u,o);await this.connection.getAccountInfo(g)||i.push(Be(s,g,o,u));const y=G(this.tokenBridgeId,m),w=await M(m,o);i.push(await this.gateway.methods.receiveTbtc([...e.hash]).accounts({payer:s,custodian:d,postedVaa:oe(this.coreBridgeId,c.from(e.hash)),tokenBridgeClaim:re(this.tokenBridgeId,e.emitterAddress.toUint8Array(),p(e.emitterChain),e.sequence),wrappedTbtcToken:h,wrappedTbtcMint:m,tbtcMint:u,recipientToken:g,recipient:o,recipientWrappedToken:w,tbtcConfig:we(),tbtcMinterInfo:Se(d),tokenBridgeConfig:O(this.tokenBridgeId),tokenBridgeRegisteredEmitter:me(this.tokenBridgeId,p(e.emitterChain),e.emitterAddress.toUint8Array()),tokenBridgeWrappedAsset:y,tokenBridgeMintAuthority:ue(this.tokenBridgeId),rent:K,tbtcProgram:T,tokenBridgeProgram:this.tokenBridgeId,coreBridgeProgram:this.coreBridgeId}).instruction());const{blockhash:S}=await this.connection.getLatestBlockhash(),f=N.compile({instructions:i,payerKey:s,recentBlockhash:S}),k=new v(f);yield this.createUnsignedTransaction({transaction:k},"TBTCBridge.Send")}createUnsignedTransaction(t,e){return new le(t,this.network,this.chain,e,!1)}}J($,"TBTCBridge",A);export{A as SolanaTBTCBridge};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
import{a2 as r,bh as t,aZ as _,bi as n}from"../main.js";import{S as s,g as d,b as e}from"./signer-Dl8_VMmx.js";import"./chain-gFcyni6Z.js";const p={Address:t,Platform:e,getSigner:d,protocols:{WormholeCore:()=>r(()=>import("./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CO4HXUmy.js","main.js","main.css","assets/index-GKTf0CV7.js","assets/signer-Dl8_VMmx.js","assets/chain-gFcyni6Z.js","assets/create-54a95t1x.js","assets/index-ClrVAZUa.js","assets/index-CMULoTsT.js","assets/index-jixjwN_L.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a2 as r,bh as t,aZ as _,bi as n}from"../main.js";import{S as s,g as d,b as e}from"./signer-Dl8_VMmx.js";import"./chain-gFcyni6Z.js";const p={Address:t,Platform:e,getSigner:d,protocols:{WormholeCore:()=>r(()=>import("./index-CO4HXUmy.js").then(o=>o.t),__vite__mapDeps([0,1,2,3,4,5,6])),TokenBridge:()=>r(()=>import("./index-ClrVAZUa.js"),__vite__mapDeps([7,0,1,2,3,4,5,6])),CircleBridge:()=>r(()=>import("./index-CMULoTsT.js"),__vite__mapDeps([8,1,2,3,4,5])),TBTCBridge:()=>r(()=>import("./index-jixjwN_L.js"),__vite__mapDeps([9,1,2,0,3,4,5,6,7]))},getChain:(o,a,i)=>new s(a,new e(o,_(o,n,{[a]:i})))};export{p as default};
|