@wormhole-foundation/wormhole-connect 4.0.0-beta.0-development → 4.0.0-beta.1-development
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-B1VSCmD9.mjs → aptos-5b4F4UXd.mjs} +4 -4
- package/lib/{aptos-DG7QN21P.js → aptos-B_Yz-0gh.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/{basic-BRYkcAmD.mjs → basic-BclwqsOq.mjs} +4 -4
- package/lib/{basic-CN2jAqvS.js → basic-BdiYk8Hf.js} +1 -1
- package/lib/{basic-DufHOLGA.js → basic-CuO6iz8a.js} +1 -1
- package/lib/{basic-Cw13RoYq.mjs → basic-HasHL_DG.mjs} +4 -4
- 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-DnbaS3cF.mjs} +3 -3
- package/lib/constants-abC7FLXq.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-COM78LTW.js} +3 -3
- package/lib/{core-ntLR7o2S.mjs → core-DT_3gIqi.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-C6xp3v8Z.mjs → evm-CUR4-a7F.mjs} +9 -9
- package/lib/{evm-B3G2Vkzg.js → evm-CoLwXequ.js} +2 -2
- package/lib/{evm-B20n3mf_.mjs → evm-DoVrPE_X.mjs} +7 -7
- package/lib/{evm-aSG_vFbw.js → evm-Dv-WYu07.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-DSmKiYkD.mjs → index-B1KwS33G.mjs} +5 -5
- package/lib/{index-vhQ5Q8ov.mjs → index-B2sVzSwb.mjs} +52 -97
- package/lib/{index-Bz7ogqhR.mjs → index-B3idKQJG.mjs} +1 -1
- package/lib/index-B7Afz_5P.js +1 -0
- 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-C3LC73WN.js → index-BaYN-RHF.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-DS8bl8fA.mjs → index-Bn0hkKKz.mjs} +4 -4
- 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-BJcbyvof.js → index-C8HxYDNY.js} +1 -1
- 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-BRyW-hBN.mjs → index-CTpINVAG.mjs} +2 -2
- package/lib/{index-bNUantLb.js → index-CjjP3Qp5.js} +1 -1
- package/lib/{index-CU73EUQW.js → index-CkGYgQTz.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-DMOY218i.js → index-CzRVzbTC.js} +1 -1
- package/lib/{index-B4S4sz6p.mjs → index-Czxl_5Tr.mjs} +5 -5
- package/lib/{index-D0XQIiQn.js → index-D6qJDbzm.js} +1 -1
- package/lib/{index-D-H8WyKb.mjs → index-DGzoIr_I.mjs} +1 -1
- package/lib/{index-BD0gcmCp.mjs → index-DPpi4Don.mjs} +5 -5
- package/lib/{index-7_BfcP8x.mjs → index-DZaOh3F9.mjs} +2105 -2021
- package/lib/{index-QlIJYJce.js → index-DaY7_eQ6.js} +66 -66
- package/lib/{index-C3L-xKvN.mjs → index-DlmQ0_RF.mjs} +4839 -4850
- 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-CSMunRpZ.mjs → index-NKV6j8zE.mjs} +3 -3
- package/lib/{index-BIYx5IBr.mjs → index-OlMuNft9.mjs} +3 -3
- package/lib/{index-tztRp3yJ.js → index-P9DbJOzh.js} +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-Cb9lswnP.js → index-cCBQV2Yv.js} +8 -8
- package/lib/{index-B9ybSY9R.mjs → index-cggXdVJu.mjs} +5 -5
- package/lib/{index.es-C476iHvN.mjs → index.es-5ecqX8B9.mjs} +4 -4
- package/lib/{index.es-CU6nhwJO.js → index.es-LBG64XJ6.js} +1 -1
- package/lib/{index.es-CkGpObng.js → index.es-owVcNlof.js} +3 -3
- package/lib/{index.es-CtiAoQ78.mjs → index.es-zNH_KzcH.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-BF6Vm50D.mjs} +1 -1
- package/lib/{secp256k1-C60XBS-e.js → secp256k1-Bb6lbAjK.js} +1 -1
- package/lib/{secp256k1-UnRv5Suy.mjs → secp256k1-BfK5OWRP.mjs} +1 -1
- package/lib/{secp256k1-BWFGSbjt.mjs → secp256k1-CqT-a-I8.mjs} +1 -1
- package/lib/{secp256k1-CFt7TfEF.js → secp256k1-DRTQ6WrU.js} +1 -1
- package/lib/{secp256k1-BIiWvuxu.js → secp256k1-D_GNj8sK.js} +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-C1puc64V.mjs} +11 -11
- package/lib/solana-C8xK8qJY.mjs +18 -0
- package/lib/solana-CRSliekb.js +1 -0
- package/lib/{solana-Cp49k9--.js → solana-CtBdJ6Wt.js} +4 -4
- package/lib/{solanaEmbed.esm-Cwa6cl_R.js → solanaEmbed.esm-BpIKVhXq.js} +1 -1
- package/lib/{solanaEmbed.esm-DBOqO9Ii.mjs → solanaEmbed.esm-NdE_DQuw.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-C2a1eehP.mjs → sui-BW7tMLZs.mjs} +4 -4
- package/lib/{sui-9gsoM56W.js → sui-DdujB9Bc.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/{tokens-BbFKf6Hv.mjs → tokens-DI-tPIbd.mjs} +3 -3
- package/lib/{tokens-LVHsSbYG.js → tokens-DJos2DwM.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-3qLkbPfi.mjs → w3m-modal-B2VF8j7W.mjs} +2 -2
- package/lib/{w3m-modal-D4-nrnEK.mjs → w3m-modal-C32eQxEe.mjs} +2 -2
- package/lib/{w3m-modal-CoTG8Zu4.js → w3m-modal-DSY2qJYP.js} +1 -1
- package/lib/{w3m-modal-xqVExHU-.js → w3m-modal-DgqSQLqZ.js} +1 -1
- 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
|
-
"use strict";const A=require("./web3-C1wK6wIV.js");function mr(r){if(r!==void 0)return{connection:r}}var Ee={},T={},Nt;function Mt(){if(Nt)return T;Nt=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){}}T.Layout=r;function t(g,o){return o.property?g+"["+o.property+"]":g}T.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})}T.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 v(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=v(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=v(o);return a.writeUInt32BE(E.hi32,f),a.writeUInt32BE(E.lo32,f+4),8}}class L 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=v(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=v(o);return a.writeInt32BE(E.hi32,f),a.writeUInt32BE(E.lo32,f+4),8}}class x 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 P 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 S 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 k 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 N 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 C=0;for(;C<E;)f+=this.elementLayout.getSpan(o,a+f),++C}return f}decode(o,a){a===void 0&&(a=0);const f=[];let E=0,C=this.count;for(C instanceof n&&(C=C.decode(o,a));E<C;)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,C=o.reduce((z,H)=>z+E.encode(H,a,f+z),0);return this.count instanceof n&&this.count.encode(o.length,a,f),C}}class q extends r{constructor(o,a,f){if(!(Array.isArray(o)&&o.reduce((C,z)=>C&&z 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 C of o)if(0>C.span&&C.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let E=-1;try{E=o.reduce((C,z)=>C+z.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,C)=>{const z=C.getSpan(o,a);return a+=z,E+z},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 C=0,z=0;for(const H of this.fields){let _e=H.span;if(z=0<_e?_e:0,H.property!==void 0){const Ut=o[H.property];Ut!==void 0&&(z=H.encode(Ut,a,f),0>_e&&(_e=H.getSpan(a,f)))}C=f,f+=_e}return C+z-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 B{constructor(o){this.property=o}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class j extends B{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 V extends r{constructor(o,a,f){const E=o instanceof u||o instanceof c;if(E)o=new j(new i(o));else if(o instanceof n&&o.isCount())o=new j(o);else if(!(o instanceof B))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 C=-1;a&&(C=a.span,0<=C&&E&&(C+=o.layout.span)),super(C,f),this.discriminator=o,this.usesPrefixDiscriminator=E,this.defaultLayout=a,this.registry={};let z=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(H){return z(H)},this.configGetSourceVariant=function(H){z=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,C=E.decode(o,a);let z=this.registry[C];if(z===void 0){let H=0;z=this.defaultLayout,this.usesPrefixDiscriminator&&(H=E.layout.span),f=this.makeDestinationObject(),f[E.property]=C,f[z.property]=this.defaultLayout.decode(o,a+H)}else f=z.decode(o,a);return f}encode(o,a,f){f===void 0&&(f=0);const E=this.getSourceVariant(o);if(E===void 0){const C=this.discriminator,z=this.defaultLayout;let H=0;return this.usesPrefixDiscriminator&&(H=C.layout.span),C.encode(o[C.property],a,f),H+z.encode(o[z.property],a,f+H)}return E.encode(o,a,f)}addVariant(o,a,f){const E=new M(this,o,a,f);return this.registry[o]=E,E}getVariant(o,a){let f=o;return A.Buffer.isBuffer(o)&&(a===void 0&&(a=0),f=this.discriminator.decode(o,a)),this.registry[f]}}class M extends r{constructor(o,a,f,E){if(!(o instanceof V))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 C=o.span;0>o.span&&(C=f?f.span:0,0<=C&&o.usesPrefixDiscriminator&&(C+=o.discriminator.layout.span)),super(C,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 C=E;if(this.layout&&(this.layout.encode(o[this.property],a,f+E),C+=this.layout.getSpan(a,f+E),0<=this.union.span&&C>this.union.span))throw new Error("encoded variant overruns containing union");return C}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(C){return E=D(C),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 C of this.fields)C.property!==void 0&&(f[C.property]=C.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 C of this.fields)if(C.property!==void 0){const z=o[C.property];z!==void 0&&C.encode(z)}return this.word.encode(this._packedGetValue(),a,f)}addField(o,a){const f=new I(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 I{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,C=o.fields.reduce((z,H)=>z+H.bits,0);if(a+C>E)throw new Error("bits too long for span remainder ("+(E-C)+" of "+E+" remain)");this.container=o,this.bits=a,this.valueMask=(1<<a)-1,a===32&&(this.valueMask=4294967295),this.start=C,this.container.msb&&(this.start=E-C-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 I{constructor(o,a){super(o,1,a)}decode(o,a){return!!I.prototype.decode.call(this,o,a)}encode(o){return typeof o=="boolean"&&(o=+o),I.prototype.encode.call(this,o)}}class b 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),!(A.Buffer.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 O extends r{constructor(o){super(-1,o)}getSpan(o,a){if(!A.Buffer.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 A.Buffer(o,"utf8"),C=E.length;if(f+C>a.length)throw new RangeError("encoding overruns Buffer");return E.copy(a,f),a[f+C]=0,C+1}}class F 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(!A.Buffer.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 A.Buffer(o,"utf8"),C=E.length;if(0<=this.maxSpan&&this.maxSpan<C)throw new RangeError("text length exceeds maxSpan");if(f+C>a.length)throw new RangeError("encoding overruns Buffer");return E.copy(a,f),C}}class Z 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 T.ExternalLayout=n,T.GreedyCount=s,T.OffsetLayout=i,T.UInt=u,T.UIntBE=c,T.Int=w,T.IntBE=l,T.Float=x,T.FloatBE=P,T.Double=S,T.DoubleBE=k,T.Sequence=N,T.Structure=q,T.UnionDiscriminator=B,T.UnionLayoutDiscriminator=j,T.Union=V,T.VariantLayout=M,T.BitStructure=R,T.BitField=I,T.Boolean=h,T.Blob=b,T.CString=O,T.UTF8=F,T.Constant=Z,T.greedy=((g,o)=>new s(g,o)),T.offset=((g,o,a)=>new i(g,o,a)),T.u8=(g=>new u(1,g)),T.u16=(g=>new u(2,g)),T.u24=(g=>new u(3,g)),T.u32=(g=>new u(4,g)),T.u40=(g=>new u(5,g)),T.u48=(g=>new u(6,g)),T.nu64=(g=>new p(g)),T.u16be=(g=>new c(2,g)),T.u24be=(g=>new c(3,g)),T.u32be=(g=>new c(4,g)),T.u40be=(g=>new c(5,g)),T.u48be=(g=>new c(6,g)),T.nu64be=(g=>new m(g)),T.s8=(g=>new w(1,g)),T.s16=(g=>new w(2,g)),T.s24=(g=>new w(3,g)),T.s32=(g=>new w(4,g)),T.s40=(g=>new w(5,g)),T.s48=(g=>new w(6,g)),T.ns64=(g=>new L(g)),T.s16be=(g=>new l(2,g)),T.s24be=(g=>new l(3,g)),T.s32be=(g=>new l(4,g)),T.s40be=(g=>new l(5,g)),T.s48be=(g=>new l(6,g)),T.ns64be=(g=>new _(g)),T.f32=(g=>new x(g)),T.f32be=(g=>new P(g)),T.f64=(g=>new S(g)),T.f64be=(g=>new k(g)),T.struct=((g,o,a)=>new q(g,o,a)),T.bits=((g,o,a)=>new R(g,o,a)),T.seq=((g,o,a)=>new N(g,o,a)),T.union=((g,o,a)=>new V(g,o,a)),T.unionLayoutDiscriminator=((g,o)=>new j(g,o)),T.blob=((g,o)=>new b(g,o)),T.cstr=(g=>new O(g)),T.utf8=((g,o)=>new F(g,o)),T.const=((g,o)=>new Z(g,o)),T}const br=A.getAugmentedNamespace(A.index_browser_esm);var $t;function vr(){return $t||($t=1,(function(r){var t=Ee&&Ee.__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=Mt(),n=br,s=t(A.requireBn());var i=Mt();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(I,h,b){super(I,b),this.blob=(0,e.blob)(I),this.signed=h}decode(I,h=0){const b=new s.default(this.blob.decode(I,h),10,"le");return this.signed?b.fromTwos(this.span*8).clone():b}encode(I,h,b=0){return this.signed&&(I=I.toTwos(this.span*8)),this.blob.encode(I.toArrayLike(A.Buffer,"le",this.span),h,b)}}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 v(R){return new u(32,!1,R)}r.u256=v;function y(R){return new u(32,!0,R)}r.i256=y;class p extends e.Layout{constructor(I,h,b,O){super(I.span,O),this.layout=I,this.decoder=h,this.encoder=b}decode(I,h){return this.decoder(this.layout.decode(I,h))}encode(I,h,b){return this.layout.encode(this.encoder(I),h,b)}getSpan(I,h){return this.layout.getSpan(I,h)}}function m(R){return new p((0,e.blob)(32),I=>new n.PublicKey(I),I=>I.toBuffer(),R)}r.publicKey=m;class L extends e.Layout{constructor(I,h){super(-1,h),this.layout=I,this.discriminator=(0,e.u8)()}encode(I,h,b=0){return I==null?this.discriminator.encode(0,h,b):(this.discriminator.encode(1,h,b),this.layout.encode(I,h,b+1)+1)}decode(I,h=0){const b=this.discriminator.decode(I,h);if(b===0)return null;if(b===1)return this.layout.decode(I,h+1);throw new Error("Invalid option "+this.property)}getSpan(I,h=0){const b=this.discriminator.decode(I,h);if(b===0)return 1;if(b===1)return this.layout.getSpan(I,h+1)+1;throw new Error("Invalid option "+this.property)}}function _(R,I){return new L(R,I)}r.option=_;function x(R){return new p((0,e.u8)(),P,S,R)}r.bool=x;function P(R){if(R===0)return!1;if(R===1)return!0;throw new Error("Invalid bool: "+R)}function S(R){return R?1:0}function k(R,I){const h=(0,e.u32)("length"),b=(0,e.struct)([h,(0,e.seq)(R,(0,e.offset)(h,-h.span),"values")]);return new p(b,({values:O})=>O,O=>({values:O}),I)}r.vec=k;function N(R,I,h){const b=(0,e.struct)([c("tag"),I.replicate("data")]);function O({tag:F,data:Z}){if(!F.eq(R))throw new Error("Invalid tag, expected: "+R.toString("hex")+", got: "+F.toString("hex"));return Z}return new p(b,O,F=>({tag:R,data:F}),h)}r.tagged=N;function q(R){const I=(0,e.u32)("length"),h=(0,e.struct)([I,(0,e.blob)((0,e.offset)(I,-I.span),"data")]);return new p(h,({data:b})=>b,b=>({data:b}),R)}r.vecU8=q;function B(R){return new p(q(),I=>I.toString("utf-8"),I=>A.Buffer.from(I,"utf-8"),R)}r.str=B;function j(R,I,h){const b=(0,e.union)(h??(0,e.u8)(),I);return R.forEach((O,F)=>b.addVariant(F,O,O.property)),b}r.rustEnum=j;function V(R,I,h){const b=(0,e.struct)([(0,e.seq)(R,I,"values")]);return new p(b,({values:O})=>O,O=>({values:O}),h)}r.array=V;class M extends e.Layout{constructor(I,h,b){super(I.span+h.span,b),this.keyLayout=I,this.valueLayout=h}decode(I,h){h=h||0;const b=this.keyLayout.decode(I,h),O=this.valueLayout.decode(I,h+this.keyLayout.getSpan(I,h));return[b,O]}encode(I,h,b){b=b||0;const O=this.keyLayout.encode(I[0],h,b),F=this.valueLayout.encode(I[1],h,b+O);return O+F}getSpan(I,h){return this.keyLayout.getSpan(I,h)+this.valueLayout.getSpan(I,h)}}function D(R,I,h){const b=(0,e.u32)("length"),O=(0,e.struct)([b,(0,e.seq)(new M(R,I),(0,e.offset)(b,-b.span),"values")]);return new p(O,({values:F})=>new Map(F),F=>({values:Array.from(F.entries())}),h)}r.map=D})(Ee)),Ee}var $=vr(),Be={exports:{}},jt;function _r(){if(jt)return Be.exports;jt=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 L=!1,_=!1,x=!1;for(let P=0;P<y.length;P++){const S=y[P];L&&r.test(S)?(y=y.slice(0,P)+"-"+y.slice(P),L=!1,x=_,_=!0,P++):_&&x&&t.test(S)?(y=y.slice(0,P-1)+"-"+y.slice(P-1),x=_,_=!1,L=!0):(L=p(S)===S&&m(S)!==S,x=_,_=m(S)===S&&p(S)!==S)}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,L)=>p(L)).replace(c,m=>p(m))),v=(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(x=>x.trim()).filter(x=>x.length).join("-"):y=y.trim(),y.length===0)return"";const m=p.locale===!1?x=>x.toLowerCase():x=>x.toLocaleLowerCase(p.locale),L=p.locale===!1?x=>x.toUpperCase():x=>x.toLocaleUpperCase(p.locale);return y.length===1?p.pascalCase?L(y):m(y):(y!==m(y)&&(y=w(y,m,L)),y=y.replace(i,""),p.preserveConsecutiveUppercase?y=l(y,m):y=m(y),p.pascalCase&&(y=L(y.charAt(0))+y.slice(1)),d(y,L))};return Be.exports=v,Be.exports.default=v,Be.exports}var Er=_r();const G=A.getDefaultExportFromCjs(Er);function ve(r){let t=r.length;for(;--t>=0;)r[t]=0}const Ar=3,xr=258,Tn=29,kr=256,Sr=kr+1+Tn,Cn=30,Ir=512,Lr=new Array((Sr+2)*2);ve(Lr);const Tr=new Array(Cn*2);ve(Tr);const Cr=new Array(Ir);ve(Cr);const Or=new Array(xr-Ar+1);ve(Or);const Rr=new Array(Tn);ve(Rr);const Pr=new Array(Cn);ve(Pr);const Br=(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 ft=Br;const Dr=()=>{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},Ur=new Uint32Array(Dr()),Nr=(r,t,e,n)=>{const s=Ur,i=n+e;r^=-1;for(let u=n;u<i;u++)r=r>>>8^s[(r^t[u])&255];return r^-1};var ne=Nr,ht={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"},On={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 Mr=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var $r=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)Mr(e,n)&&(r[n]=e[n])}}return r},jr=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},Rn={assign:$r,flattenChunks:jr};let Pn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Pn=!1}const Ie=new Uint8Array(256);for(let r=0;r<256;r++)Ie[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Ie[254]=Ie[254]=1;var Vr=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 Fr=(r,t)=>{if(t<65534&&r.subarray&&Pn)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 zr=(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=Ie[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 Fr(i,s)},qr=(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+Ie[r[e]]>t?e:t},pt={string2buf:Vr,buf2string:zr,utf8border:qr};function Kr(){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 Gr=Kr;const De=16209,Zr=16191;var Hr=function(t,e){let n,s,i,u,c,w,l,d,v,y,p,m,L,_,x,P,S,k,N,q,B,j,V,M;const D=t.state;n=t.next_in,V=t.input,s=n+(t.avail_in-5),i=t.next_out,M=t.output,u=i-(e-t.avail_out),c=i+(t.avail_out-257),w=D.dmax,l=D.wsize,d=D.whave,v=D.wnext,y=D.window,p=D.hold,m=D.bits,L=D.lencode,_=D.distcode,x=(1<<D.lenbits)-1,P=(1<<D.distbits)-1;e:do{m<15&&(p+=V[n++]<<m,m+=8,p+=V[n++]<<m,m+=8),S=L[p&x];t:for(;;){if(k=S>>>24,p>>>=k,m-=k,k=S>>>16&255,k===0)M[i++]=S&65535;else if(k&16){N=S&65535,k&=15,k&&(m<k&&(p+=V[n++]<<m,m+=8),N+=p&(1<<k)-1,p>>>=k,m-=k),m<15&&(p+=V[n++]<<m,m+=8,p+=V[n++]<<m,m+=8),S=_[p&P];n:for(;;){if(k=S>>>24,p>>>=k,m-=k,k=S>>>16&255,k&16){if(q=S&65535,k&=15,m<k&&(p+=V[n++]<<m,m+=8,m<k&&(p+=V[n++]<<m,m+=8)),q+=p&(1<<k)-1,q>w){t.msg="invalid distance too far back",D.mode=De;break e}if(p>>>=k,m-=k,k=i-u,q>k){if(k=q-k,k>d&&D.sane){t.msg="invalid distance too far back",D.mode=De;break e}if(B=0,j=y,v===0){if(B+=l-k,k<N){N-=k;do M[i++]=y[B++];while(--k);B=i-q,j=M}}else if(v<k){if(B+=l+v-k,k-=v,k<N){N-=k;do M[i++]=y[B++];while(--k);if(B=0,v<N){k=v,N-=k;do M[i++]=y[B++];while(--k);B=i-q,j=M}}}else if(B+=v-k,k<N){N-=k;do M[i++]=y[B++];while(--k);B=i-q,j=M}for(;N>2;)M[i++]=j[B++],M[i++]=j[B++],M[i++]=j[B++],N-=3;N&&(M[i++]=j[B++],N>1&&(M[i++]=j[B++]))}else{B=i-q;do M[i++]=M[B++],M[i++]=M[B++],M[i++]=M[B++],N-=3;while(N>2);N&&(M[i++]=M[B++],N>1&&(M[i++]=M[B++]))}}else if((k&64)===0){S=_[(S&65535)+(p&(1<<k)-1)];continue n}else{t.msg="invalid distance code",D.mode=De;break e}break}}else if((k&64)===0){S=L[(S&65535)+(p&(1<<k)-1)];continue t}else if(k&32){D.mode=Zr;break e}else{t.msg="invalid literal/length code",D.mode=De;break e}break}}while(n<s&&i<c);N=m>>3,n-=N,m-=N<<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 ye=15,Vt=852,Ft=592,zt=0,et=1,qt=2,Wr=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]),Xr=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]),Yr=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]),Jr=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]),Qr=(r,t,e,n,s,i,u,c)=>{const w=c.bits;let l=0,d=0,v=0,y=0,p=0,m=0,L=0,_=0,x=0,P=0,S,k,N,q,B,j=null,V;const M=new Uint16Array(ye+1),D=new Uint16Array(ye+1);let R=null,I,h,b;for(l=0;l<=ye;l++)M[l]=0;for(d=0;d<n;d++)M[t[e+d]]++;for(p=w,y=ye;y>=1&&M[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(v=1;v<y&&M[v]===0;v++);for(p<v&&(p=v),_=1,l=1;l<=ye;l++)if(_<<=1,_-=M[l],_<0)return-1;if(_>0&&(r===zt||y!==1))return-1;for(D[1]=0,l=1;l<ye;l++)D[l+1]=D[l]+M[l];for(d=0;d<n;d++)t[e+d]!==0&&(u[D[t[e+d]]++]=d);if(r===zt?(j=R=u,V=20):r===et?(j=Wr,R=Xr,V=257):(j=Yr,R=Jr,V=0),P=0,d=0,l=v,B=i,m=p,L=0,N=-1,x=1<<p,q=x-1,r===et&&x>Vt||r===qt&&x>Ft)return 1;for(;;){I=l-L,u[d]+1<V?(h=0,b=u[d]):u[d]>=V?(h=R[u[d]-V],b=j[u[d]-V]):(h=96,b=0),S=1<<l-L,k=1<<m,v=k;do k-=S,s[B+(P>>L)+k]=I<<24|h<<16|b|0;while(k!==0);for(S=1<<l-1;P&S;)S>>=1;if(S!==0?(P&=S-1,P+=S):P=0,d++,--M[l]===0){if(l===y)break;l=t[e+u[d]]}if(l>p&&(P&q)!==N){for(L===0&&(L=p),B+=v,m=l-L,_=1<<m;m+L<y&&(_-=M[m+L],!(_<=0));)m++,_<<=1;if(x+=1<<m,r===et&&x>Vt||r===qt&&x>Ft)return 1;N=P&q,s[N]=p<<24|m<<16|B-i|0}}return P!==0&&(s[B+P]=l-L<<24|64<<16|0),c.bits=p,0};var ke=Qr;const ei=0,Bn=1,Dn=2,{Z_FINISH:Kt,Z_BLOCK:ti,Z_TREES:Ue,Z_OK:pe,Z_STREAM_END:ni,Z_NEED_DICT:ri,Z_STREAM_ERROR:ee,Z_DATA_ERROR:Un,Z_MEM_ERROR:Nn,Z_BUF_ERROR:ii,Z_DEFLATED:Gt}=On,He=16180,Zt=16181,Ht=16182,Wt=16183,Xt=16184,Yt=16185,Jt=16186,Qt=16187,en=16188,tn=16189,ze=16190,ie=16191,tt=16192,nn=16193,nt=16194,rn=16195,sn=16196,on=16197,an=16198,Ne=16199,Me=16200,cn=16201,un=16202,ln=16203,dn=16204,fn=16205,rt=16206,hn=16207,pn=16208,K=16209,Mn=16210,$n=16211,si=852,oi=592,ai=15,ci=ai,wn=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function ui(){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 we=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode<He||t.mode>$n?1:0},jn=r=>{if(we(r))return ee;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=He,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(si),t.distcode=t.distdyn=new Int32Array(oi),t.sane=1,t.back=-1,pe},Vn=r=>{if(we(r))return ee;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,jn(r)},Fn=(r,t)=>{let e;if(we(r))return ee;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?ee:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,Vn(r))},zn=(r,t)=>{if(!r)return ee;const e=new ui;r.state=e,e.strm=r,e.window=null,e.mode=He;const n=Fn(r,t);return n!==pe&&(r.state=null),n},li=r=>zn(r,ci);let yn=!0,it,st;const di=r=>{if(yn){it=new Int32Array(512),st=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(ke(Bn,r.lens,0,288,it,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;ke(Dn,r.lens,0,32,st,0,r.work,{bits:5}),yn=!1}r.lencode=it,r.lenbits=9,r.distcode=st,r.distbits=5},qn=(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},fi=(r,t)=>{let e,n,s,i,u,c,w,l,d,v,y,p,m,L,_=0,x,P,S,k,N,q,B,j;const V=new Uint8Array(4);let M,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(we(r)||!r.output||!r.input&&r.avail_in!==0)return ee;e=r.state,e.mode===ie&&(e.mode=tt),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,v=c,y=w,j=pe;e:for(;;)switch(e.mode){case He:if(e.wrap===0){e.mode=tt;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,V[0]=l&255,V[1]=l>>>8&255,e.check=ne(e.check,V,2,0),l=0,d=0,e.mode=Zt;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",e.mode=K;break}if((l&15)!==Gt){r.msg="unknown compression method",e.mode=K;break}if(l>>>=4,d-=4,B=(l&15)+8,e.wbits===0&&(e.wbits=B),B>15||B>e.wbits){r.msg="invalid window size",e.mode=K;break}e.dmax=1<<e.wbits,e.flags=0,r.adler=e.check=1,e.mode=l&512?tn:ie,l=0,d=0;break;case Zt:for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.flags=l,(e.flags&255)!==Gt){r.msg="unknown compression method",e.mode=K;break}if(e.flags&57344){r.msg="unknown header flags set",e.mode=K;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&(V[0]=l&255,V[1]=l>>>8&255,e.check=ne(e.check,V,2,0)),l=0,d=0,e.mode=Ht;case Ht: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&&(V[0]=l&255,V[1]=l>>>8&255,V[2]=l>>>16&255,V[3]=l>>>24&255,e.check=ne(e.check,V,4,0)),l=0,d=0,e.mode=Wt;case Wt: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&&(V[0]=l&255,V[1]=l>>>8&255,e.check=ne(e.check,V,2,0)),l=0,d=0,e.mode=Xt;case Xt: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&&(V[0]=l&255,V[1]=l>>>8&255,e.check=ne(e.check,V,2,0)),l=0,d=0}else e.head&&(e.head.extra=null);e.mode=Yt;case Yt:if(e.flags&1024&&(p=e.length,p>c&&(p=c),p&&(e.head&&(B=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),B)),e.flags&512&&e.wrap&4&&(e.check=ne(e.check,n,p,i)),c-=p,i+=p,e.length-=p),e.length))break e;e.length=0,e.mode=Jt;case Jt:if(e.flags&2048){if(c===0)break e;p=0;do B=n[i+p++],e.head&&B&&e.length<65536&&(e.head.name+=String.fromCharCode(B));while(B&&p<c);if(e.flags&512&&e.wrap&4&&(e.check=ne(e.check,n,p,i)),c-=p,i+=p,B)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=Qt;case Qt:if(e.flags&4096){if(c===0)break e;p=0;do B=n[i+p++],e.head&&B&&e.length<65536&&(e.head.comment+=String.fromCharCode(B));while(B&&p<c);if(e.flags&512&&e.wrap&4&&(e.check=ne(e.check,n,p,i)),c-=p,i+=p,B)break e}else e.head&&(e.head.comment=null);e.mode=en;case en: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=K;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=ie;break;case tn:for(;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}r.adler=e.check=wn(l),l=0,d=0,e.mode=ze;case ze: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,ri;r.adler=e.check=1,e.mode=ie;case ie:if(t===ti||t===Ue)break e;case tt:if(e.last){l>>>=d&7,d-=d&7,e.mode=rt;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=nn;break;case 1:if(di(e),e.mode=Ne,t===Ue){l>>>=2,d-=2;break e}break;case 2:e.mode=sn;break;case 3:r.msg="invalid block type",e.mode=K}l>>>=2,d-=2;break;case nn: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=K;break}if(e.length=l&65535,l=0,d=0,e.mode=nt,t===Ue)break e;case nt:e.mode=rn;case rn: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=ie;break;case sn: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=K;break}e.have=0,e.mode=on;case on: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,M={bits:e.lenbits},j=ke(ei,e.lens,0,19,e.lencode,0,e.work,M),e.lenbits=M.bits,j){r.msg="invalid code lengths set",e.mode=K;break}e.have=0,e.mode=an;case an:for(;e.have<e.nlen+e.ndist;){for(;_=e.lencode[l&(1<<e.lenbits)-1],x=_>>>24,P=_>>>16&255,S=_&65535,!(x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(S<16)l>>>=x,d-=x,e.lens[e.have++]=S;else{if(S===16){for(D=x+2;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(l>>>=x,d-=x,e.have===0){r.msg="invalid bit length repeat",e.mode=K;break}B=e.lens[e.have-1],p=3+(l&3),l>>>=2,d-=2}else if(S===17){for(D=x+3;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=x,d-=x,B=0,p=3+(l&7),l>>>=3,d-=3}else{for(D=x+7;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=x,d-=x,B=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=K;break}for(;p--;)e.lens[e.have++]=B}}if(e.mode===K)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=K;break}if(e.lenbits=9,M={bits:e.lenbits},j=ke(Bn,e.lens,0,e.nlen,e.lencode,0,e.work,M),e.lenbits=M.bits,j){r.msg="invalid literal/lengths set",e.mode=K;break}if(e.distbits=6,e.distcode=e.distdyn,M={bits:e.distbits},j=ke(Dn,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,M),e.distbits=M.bits,j){r.msg="invalid distances set",e.mode=K;break}if(e.mode=Ne,t===Ue)break e;case Ne:e.mode=Me;case Me: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,Hr(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===ie&&(e.back=-1);break}for(e.back=0;_=e.lencode[l&(1<<e.lenbits)-1],x=_>>>24,P=_>>>16&255,S=_&65535,!(x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(P&&(P&240)===0){for(k=x,N=P,q=S;_=e.lencode[q+((l&(1<<k+N)-1)>>k)],x=_>>>24,P=_>>>16&255,S=_&65535,!(k+x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=k,d-=k,e.back+=k}if(l>>>=x,d-=x,e.back+=x,e.length=S,P===0){e.mode=fn;break}if(P&32){e.back=-1,e.mode=ie;break}if(P&64){r.msg="invalid literal/length code",e.mode=K;break}e.extra=P&15,e.mode=cn;case cn: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=un;case un:for(;_=e.distcode[l&(1<<e.distbits)-1],x=_>>>24,P=_>>>16&255,S=_&65535,!(x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if((P&240)===0){for(k=x,N=P,q=S;_=e.distcode[q+((l&(1<<k+N)-1)>>k)],x=_>>>24,P=_>>>16&255,S=_&65535,!(k+x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=k,d-=k,e.back+=k}if(l>>>=x,d-=x,e.back+=x,P&64){r.msg="invalid distance code",e.mode=K;break}e.offset=S,e.extra=P&15,e.mode=ln;case ln: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=K;break}e.mode=dn;case dn: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=K;break}p>e.wnext?(p-=e.wnext,m=e.wsize-p):m=e.wnext-p,p>e.length&&(p=e.length),L=e.window}else L=s,m=u-e.offset,p=e.length;p>w&&(p=w),w-=p,e.length-=p;do s[u++]=L[m++];while(--p);e.length===0&&(e.mode=Me);break;case fn:if(w===0)break e;s[u++]=e.length,w--,e.mode=Me;break;case rt: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?ne(e.check,s,y,u-y):ft(e.check,s,y,u-y)),y=w,e.wrap&4&&(e.flags?l:wn(l))!==e.check){r.msg="incorrect data check",e.mode=K;break}l=0,d=0}e.mode=hn;case hn: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=K;break}l=0,d=0}e.mode=pn;case pn:j=ni;break e;case K:j=Un;break e;case Mn:return Nn;case $n:default:return ee}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<K&&(e.mode<rt||t!==Kt))&&qn(r,r.output,r.next_out,y-r.avail_out),v-=r.avail_in,y-=r.avail_out,r.total_in+=v,r.total_out+=y,e.total+=y,e.wrap&4&&y&&(r.adler=e.check=e.flags?ne(e.check,s,y,r.next_out-y):ft(e.check,s,y,r.next_out-y)),r.data_type=e.bits+(e.last?64:0)+(e.mode===ie?128:0)+(e.mode===Ne||e.mode===nt?256:0),(v===0&&y===0||t===Kt)&&j===pe&&(j=ii),j},hi=r=>{if(we(r))return ee;let t=r.state;return t.window&&(t.window=null),r.state=null,pe},pi=(r,t)=>{if(we(r))return ee;const e=r.state;return(e.wrap&2)===0?ee:(e.head=t,t.done=!1,pe)},wi=(r,t)=>{const e=t.length;let n,s,i;return we(r)||(n=r.state,n.wrap!==0&&n.mode!==ze)?ee:n.mode===ze&&(s=1,s=ft(s,t,e,0),s!==n.check)?Un:(i=qn(r,t,e,e),i?(n.mode=Mn,Nn):(n.havedict=1,pe))};var yi=Vn,gi=Fn,mi=jn,bi=li,vi=zn,_i=fi,Ei=hi,Ai=pi,xi=wi,ki="pako inflate (from Nodeca project)",se={inflateReset:yi,inflateReset2:gi,inflateResetKeep:mi,inflateInit:bi,inflateInit2:vi,inflate:_i,inflateEnd:Ei,inflateGetHeader:Ai,inflateSetDictionary:xi,inflateInfo:ki};function Si(){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 Ii=Si;const Kn=Object.prototype.toString,{Z_NO_FLUSH:Li,Z_FINISH:Ti,Z_OK:Le,Z_STREAM_END:ot,Z_NEED_DICT:at,Z_STREAM_ERROR:Ci,Z_DATA_ERROR:gn,Z_MEM_ERROR:Oi}=On;function We(r){this.options=Rn.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 Gr,this.strm.avail_out=0;let e=se.inflateInit2(this.strm,t.windowBits);if(e!==Le)throw new Error(ht[e]);if(this.header=new Ii,se.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=pt.string2buf(t.dictionary):Kn.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=se.inflateSetDictionary(this.strm,t.dictionary),e!==Le)))throw new Error(ht[e])}We.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?Ti:Li,Kn.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=se.inflate(e,u),i===at&&s&&(i=se.inflateSetDictionary(e,s),i===Le?i=se.inflate(e,u):i===gn&&(i=at));e.avail_in>0&&i===ot&&e.state.wrap>0&&r[e.next_in]!==0;)se.inflateReset(e),i=se.inflate(e,u);switch(i){case Ci:case gn:case at:case Oi:return this.onEnd(i),this.ended=!0,!1}if(c=e.avail_out,e.next_out&&(e.avail_out===0||i===ot))if(this.options.to==="string"){let w=pt.utf8border(e.output,e.next_out),l=e.next_out-w,d=pt.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===Le&&c===0)){if(i===ot)return i=se.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};We.prototype.onData=function(r){this.chunks.push(r)};We.prototype.onEnd=function(r){r===Le&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Rn.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Ri(r,t){const e=new We(t);if(e.push(r),e.err)throw e.msg||ht[e.err];return e.result}var Pi=Ri,Bi={inflate:Pi};const{inflate:Di}=Bi;var Ui=Di,ct={exports:{}},mn;function Ni(){return mn||(mn=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,v,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,v||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,v;if(this._eventsCount===0)return l;for(v in d=this._events)t.call(d,v)&&l.push(e?v.slice(1):v);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},c.prototype.listeners=function(l){var d=e?e+l:l,v=this._events[d];if(!v)return[];if(v.fn)return[v.fn];for(var y=0,p=v.length,m=new Array(p);y<p;y++)m[y]=v[y].fn;return m},c.prototype.listenerCount=function(l){var d=e?e+l:l,v=this._events[d];return v?v.fn?1:v.length:0},c.prototype.emit=function(l,d,v,y,p,m){var L=e?e+l:l;if(!this._events[L])return!1;var _=this._events[L],x=arguments.length,P,S;if(_.fn){switch(_.once&&this.removeListener(l,_.fn,void 0,!0),x){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,v),!0;case 4:return _.fn.call(_.context,d,v,y),!0;case 5:return _.fn.call(_.context,d,v,y,p),!0;case 6:return _.fn.call(_.context,d,v,y,p,m),!0}for(S=1,P=new Array(x-1);S<x;S++)P[S-1]=arguments[S];_.fn.apply(_.context,P)}else{var k=_.length,N;for(S=0;S<k;S++)switch(_[S].once&&this.removeListener(l,_[S].fn,void 0,!0),x){case 1:_[S].fn.call(_[S].context);break;case 2:_[S].fn.call(_[S].context,d);break;case 3:_[S].fn.call(_[S].context,d,v);break;case 4:_[S].fn.call(_[S].context,d,v,y);break;default:if(!P)for(N=1,P=new Array(x-1);N<x;N++)P[N-1]=arguments[N];_[S].fn.apply(_[S].context,P)}}return!0},c.prototype.on=function(l,d,v){return i(this,l,d,v,!1)},c.prototype.once=function(l,d,v){return i(this,l,d,v,!0)},c.prototype.removeListener=function(l,d,v,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)&&(!v||m.context===v)&&u(this,p);else{for(var L=0,_=[],x=m.length;L<x;L++)(m[L].fn!==d||y&&!m[L].once||v&&m[L].context!==v)&&_.push(m[L]);_.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})(ct)),ct.exports}var Mi=Ni();const $i=A.getDefaultExportFromCjs(Mi);function ji(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const Ae=r=>"version"in r;function Vi(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function Fi(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?A.Buffer$1.from([]):A.Buffer$1.from(t.map(e=>parseInt(e,16)))}var zi=Object.freeze({__proto__:null,encode:Vi,decode:Fi});function Gn(r){return new TextDecoder("utf-8").decode(r)}function Zn(r){return new TextEncoder().encode(r)}var qi=Object.freeze({__proto__:null,decode:Gn,encode:Zn});function wt(r){return A.bs58.encode(r)}function Ki(r){return A.bs58.decode(r)}var Gi=Object.freeze({__proto__:null,encode:wt,decode:Ki});function yt(r){return r.toString("base64")}function kt(r){return A.Buffer$1.from(r,"base64")}var Zi=Object.freeze({__proto__:null,encode:yt,decode:kt}),Hi=Object.freeze({__proto__:null,hex:zi,utf8:qi,bs58:Gi,base64:Zi});function Hn(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 Wi(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 Wn(r,t={}){r.forEach(e=>{if("accounts"in e)Wn(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function J(r){return r instanceof A.PublicKey?r:new A.PublicKey(r)}class Xi 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 Yi(r){return me(r)&&typeof r[Symbol.iterator]=="function"}function me(r){return typeof r=="object"&&r!=null}function ue(r){return typeof r=="string"?JSON.stringify(r):""+r}function Ji(r){const{done:t,value:e}=r.next();return t?void 0:e}function Qi(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: `"+ue(n)+"`"}=r;return{value:n,type:u,refinement:c,key:s[s.length-1],path:s,branch:i,...r,message:w}}function*bn(r,t,e,n){Yi(r)||(r=[r]);for(const s of r){const i=Qi(s,t,e,n);i&&(yield i)}}function*St(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"&&me(t.schema)&&me(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,v]of t.entries(r,c)){const y=St(d,v,{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):me(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 le{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 bn(d,l,this,w)}:this.validator=()=>[],i?this.refiner=(w,l)=>{const d=i(w,l);return bn(d,l,this,w)}:this.refiner=()=>[]}assert(t){return es(t,this)}create(t){return It(t,this)}is(t){return Xn(t,this)}mask(t){return ts(t,this)}validate(t,e){return e===void 0&&(e={}),Ce(t,this,e)}}function es(r,t){const e=Ce(r,t);if(e[0])throw e[0]}function It(r,t){const e=Ce(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function ts(r,t){const e=Ce(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function Xn(r,t){return!Ce(r,t)[0]}function Ce(r,t,e){e===void 0&&(e={});const n=St(r,t,e),s=Ji(n);return s[0]?[new Xi(s[0],function*(){for(const u of n)u[0]&&(yield u[0])}),void 0]:[void 0,s[1]]}function Oe(r,t){return new le({type:r,schema:null,validator:t})}function ns(){return Oe("any",()=>!0)}function ut(r){return new le({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: "+ue(t)}})}function rs(){return Oe("boolean",r=>typeof r=="boolean")}function vn(r){const t=ue(r);return new le({type:"literal",schema:r,validator(e){return e===r||"Expected the literal `"+t+"`, but received: "+ue(e)}})}function $e(r){return new le({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function Ve(){return Oe("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ue(r))}function Fe(r){return new le({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function de(){return Oe("string",r=>typeof r=="string"||"Expected a string, but received: "+ue(r))}function ce(r){const t=Object.keys(r);return new le({type:"type",schema:r,*entries(e){if(me(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return me(e)||"Expected an object, but received: "+ue(e)}})}function Yn(r){const t=r.map(e=>e.type).join(" | ");return new le({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[u]=i.validate(e,{coerce:!0});return!u})||Lt()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...u]=St(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: "+ue(e),...s]}})}function Lt(){return Oe("unknown",()=>!0)}function is(r,t,e){return new le({...r,coercer:(n,s)=>Xn(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}async function ss(r,t,e,n){r=J(r),n||(n=qe());const s=new A.Transaction;if(s.add(new A.TransactionInstruction({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 _n=99;async function os(r,t,e){return(await Tt(r,t,e)).map(s=>s?{publicKey:s.publicKey,account:s.account}:null)}async function Tt(r,t,e){if(t.length<=_n)return await En(r,t,e);{const n=ji(t,_n);return(await Promise.all(n.map(i=>En(r,i,e)))).flat()}}async function En(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 Jn(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(L=>L.toBase58());d.accounts={encoding:"base64",addresses:m}}e&&(d.sigVerify=!0);const v=[l,d],y=await r._rpcRequest("simulateTransaction",v),p=It(y,ls);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 L=`
|
|
1
|
+
"use strict";const A=require("./web3-BKaP497Y.js");function mr(r){if(r!==void 0)return{connection:r}}var Ee={},T={},Nt;function Mt(){if(Nt)return T;Nt=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){}}T.Layout=r;function t(g,o){return o.property?g+"["+o.property+"]":g}T.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})}T.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 v(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=v(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=v(o);return a.writeUInt32BE(E.hi32,f),a.writeUInt32BE(E.lo32,f+4),8}}class L 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=v(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=v(o);return a.writeInt32BE(E.hi32,f),a.writeUInt32BE(E.lo32,f+4),8}}class x 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 P 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 S 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 k 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 N 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 C=0;for(;C<E;)f+=this.elementLayout.getSpan(o,a+f),++C}return f}decode(o,a){a===void 0&&(a=0);const f=[];let E=0,C=this.count;for(C instanceof n&&(C=C.decode(o,a));E<C;)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,C=o.reduce((z,H)=>z+E.encode(H,a,f+z),0);return this.count instanceof n&&this.count.encode(o.length,a,f),C}}class q extends r{constructor(o,a,f){if(!(Array.isArray(o)&&o.reduce((C,z)=>C&&z 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 C of o)if(0>C.span&&C.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let E=-1;try{E=o.reduce((C,z)=>C+z.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,C)=>{const z=C.getSpan(o,a);return a+=z,E+z},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 C=0,z=0;for(const H of this.fields){let _e=H.span;if(z=0<_e?_e:0,H.property!==void 0){const Ut=o[H.property];Ut!==void 0&&(z=H.encode(Ut,a,f),0>_e&&(_e=H.getSpan(a,f)))}C=f,f+=_e}return C+z-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 B{constructor(o){this.property=o}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class j extends B{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 V extends r{constructor(o,a,f){const E=o instanceof u||o instanceof c;if(E)o=new j(new i(o));else if(o instanceof n&&o.isCount())o=new j(o);else if(!(o instanceof B))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 C=-1;a&&(C=a.span,0<=C&&E&&(C+=o.layout.span)),super(C,f),this.discriminator=o,this.usesPrefixDiscriminator=E,this.defaultLayout=a,this.registry={};let z=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(H){return z(H)},this.configGetSourceVariant=function(H){z=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,C=E.decode(o,a);let z=this.registry[C];if(z===void 0){let H=0;z=this.defaultLayout,this.usesPrefixDiscriminator&&(H=E.layout.span),f=this.makeDestinationObject(),f[E.property]=C,f[z.property]=this.defaultLayout.decode(o,a+H)}else f=z.decode(o,a);return f}encode(o,a,f){f===void 0&&(f=0);const E=this.getSourceVariant(o);if(E===void 0){const C=this.discriminator,z=this.defaultLayout;let H=0;return this.usesPrefixDiscriminator&&(H=C.layout.span),C.encode(o[C.property],a,f),H+z.encode(o[z.property],a,f+H)}return E.encode(o,a,f)}addVariant(o,a,f){const E=new M(this,o,a,f);return this.registry[o]=E,E}getVariant(o,a){let f=o;return A.Buffer.isBuffer(o)&&(a===void 0&&(a=0),f=this.discriminator.decode(o,a)),this.registry[f]}}class M extends r{constructor(o,a,f,E){if(!(o instanceof V))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 C=o.span;0>o.span&&(C=f?f.span:0,0<=C&&o.usesPrefixDiscriminator&&(C+=o.discriminator.layout.span)),super(C,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 C=E;if(this.layout&&(this.layout.encode(o[this.property],a,f+E),C+=this.layout.getSpan(a,f+E),0<=this.union.span&&C>this.union.span))throw new Error("encoded variant overruns containing union");return C}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(C){return E=D(C),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 C of this.fields)C.property!==void 0&&(f[C.property]=C.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 C of this.fields)if(C.property!==void 0){const z=o[C.property];z!==void 0&&C.encode(z)}return this.word.encode(this._packedGetValue(),a,f)}addField(o,a){const f=new I(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 I{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,C=o.fields.reduce((z,H)=>z+H.bits,0);if(a+C>E)throw new Error("bits too long for span remainder ("+(E-C)+" of "+E+" remain)");this.container=o,this.bits=a,this.valueMask=(1<<a)-1,a===32&&(this.valueMask=4294967295),this.start=C,this.container.msb&&(this.start=E-C-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 I{constructor(o,a){super(o,1,a)}decode(o,a){return!!I.prototype.decode.call(this,o,a)}encode(o){return typeof o=="boolean"&&(o=+o),I.prototype.encode.call(this,o)}}class b 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),!(A.Buffer.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 O extends r{constructor(o){super(-1,o)}getSpan(o,a){if(!A.Buffer.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 A.Buffer(o,"utf8"),C=E.length;if(f+C>a.length)throw new RangeError("encoding overruns Buffer");return E.copy(a,f),a[f+C]=0,C+1}}class F 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(!A.Buffer.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 A.Buffer(o,"utf8"),C=E.length;if(0<=this.maxSpan&&this.maxSpan<C)throw new RangeError("text length exceeds maxSpan");if(f+C>a.length)throw new RangeError("encoding overruns Buffer");return E.copy(a,f),C}}class Z 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 T.ExternalLayout=n,T.GreedyCount=s,T.OffsetLayout=i,T.UInt=u,T.UIntBE=c,T.Int=w,T.IntBE=l,T.Float=x,T.FloatBE=P,T.Double=S,T.DoubleBE=k,T.Sequence=N,T.Structure=q,T.UnionDiscriminator=B,T.UnionLayoutDiscriminator=j,T.Union=V,T.VariantLayout=M,T.BitStructure=R,T.BitField=I,T.Boolean=h,T.Blob=b,T.CString=O,T.UTF8=F,T.Constant=Z,T.greedy=((g,o)=>new s(g,o)),T.offset=((g,o,a)=>new i(g,o,a)),T.u8=(g=>new u(1,g)),T.u16=(g=>new u(2,g)),T.u24=(g=>new u(3,g)),T.u32=(g=>new u(4,g)),T.u40=(g=>new u(5,g)),T.u48=(g=>new u(6,g)),T.nu64=(g=>new p(g)),T.u16be=(g=>new c(2,g)),T.u24be=(g=>new c(3,g)),T.u32be=(g=>new c(4,g)),T.u40be=(g=>new c(5,g)),T.u48be=(g=>new c(6,g)),T.nu64be=(g=>new m(g)),T.s8=(g=>new w(1,g)),T.s16=(g=>new w(2,g)),T.s24=(g=>new w(3,g)),T.s32=(g=>new w(4,g)),T.s40=(g=>new w(5,g)),T.s48=(g=>new w(6,g)),T.ns64=(g=>new L(g)),T.s16be=(g=>new l(2,g)),T.s24be=(g=>new l(3,g)),T.s32be=(g=>new l(4,g)),T.s40be=(g=>new l(5,g)),T.s48be=(g=>new l(6,g)),T.ns64be=(g=>new _(g)),T.f32=(g=>new x(g)),T.f32be=(g=>new P(g)),T.f64=(g=>new S(g)),T.f64be=(g=>new k(g)),T.struct=((g,o,a)=>new q(g,o,a)),T.bits=((g,o,a)=>new R(g,o,a)),T.seq=((g,o,a)=>new N(g,o,a)),T.union=((g,o,a)=>new V(g,o,a)),T.unionLayoutDiscriminator=((g,o)=>new j(g,o)),T.blob=((g,o)=>new b(g,o)),T.cstr=(g=>new O(g)),T.utf8=((g,o)=>new F(g,o)),T.const=((g,o)=>new Z(g,o)),T}const br=A.getAugmentedNamespace(A.index_browser_esm);var $t;function vr(){return $t||($t=1,(function(r){var t=Ee&&Ee.__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=Mt(),n=br,s=t(A.requireBn());var i=Mt();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(I,h,b){super(I,b),this.blob=(0,e.blob)(I),this.signed=h}decode(I,h=0){const b=new s.default(this.blob.decode(I,h),10,"le");return this.signed?b.fromTwos(this.span*8).clone():b}encode(I,h,b=0){return this.signed&&(I=I.toTwos(this.span*8)),this.blob.encode(I.toArrayLike(A.Buffer,"le",this.span),h,b)}}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 v(R){return new u(32,!1,R)}r.u256=v;function y(R){return new u(32,!0,R)}r.i256=y;class p extends e.Layout{constructor(I,h,b,O){super(I.span,O),this.layout=I,this.decoder=h,this.encoder=b}decode(I,h){return this.decoder(this.layout.decode(I,h))}encode(I,h,b){return this.layout.encode(this.encoder(I),h,b)}getSpan(I,h){return this.layout.getSpan(I,h)}}function m(R){return new p((0,e.blob)(32),I=>new n.PublicKey(I),I=>I.toBuffer(),R)}r.publicKey=m;class L extends e.Layout{constructor(I,h){super(-1,h),this.layout=I,this.discriminator=(0,e.u8)()}encode(I,h,b=0){return I==null?this.discriminator.encode(0,h,b):(this.discriminator.encode(1,h,b),this.layout.encode(I,h,b+1)+1)}decode(I,h=0){const b=this.discriminator.decode(I,h);if(b===0)return null;if(b===1)return this.layout.decode(I,h+1);throw new Error("Invalid option "+this.property)}getSpan(I,h=0){const b=this.discriminator.decode(I,h);if(b===0)return 1;if(b===1)return this.layout.getSpan(I,h+1)+1;throw new Error("Invalid option "+this.property)}}function _(R,I){return new L(R,I)}r.option=_;function x(R){return new p((0,e.u8)(),P,S,R)}r.bool=x;function P(R){if(R===0)return!1;if(R===1)return!0;throw new Error("Invalid bool: "+R)}function S(R){return R?1:0}function k(R,I){const h=(0,e.u32)("length"),b=(0,e.struct)([h,(0,e.seq)(R,(0,e.offset)(h,-h.span),"values")]);return new p(b,({values:O})=>O,O=>({values:O}),I)}r.vec=k;function N(R,I,h){const b=(0,e.struct)([c("tag"),I.replicate("data")]);function O({tag:F,data:Z}){if(!F.eq(R))throw new Error("Invalid tag, expected: "+R.toString("hex")+", got: "+F.toString("hex"));return Z}return new p(b,O,F=>({tag:R,data:F}),h)}r.tagged=N;function q(R){const I=(0,e.u32)("length"),h=(0,e.struct)([I,(0,e.blob)((0,e.offset)(I,-I.span),"data")]);return new p(h,({data:b})=>b,b=>({data:b}),R)}r.vecU8=q;function B(R){return new p(q(),I=>I.toString("utf-8"),I=>A.Buffer.from(I,"utf-8"),R)}r.str=B;function j(R,I,h){const b=(0,e.union)(h??(0,e.u8)(),I);return R.forEach((O,F)=>b.addVariant(F,O,O.property)),b}r.rustEnum=j;function V(R,I,h){const b=(0,e.struct)([(0,e.seq)(R,I,"values")]);return new p(b,({values:O})=>O,O=>({values:O}),h)}r.array=V;class M extends e.Layout{constructor(I,h,b){super(I.span+h.span,b),this.keyLayout=I,this.valueLayout=h}decode(I,h){h=h||0;const b=this.keyLayout.decode(I,h),O=this.valueLayout.decode(I,h+this.keyLayout.getSpan(I,h));return[b,O]}encode(I,h,b){b=b||0;const O=this.keyLayout.encode(I[0],h,b),F=this.valueLayout.encode(I[1],h,b+O);return O+F}getSpan(I,h){return this.keyLayout.getSpan(I,h)+this.valueLayout.getSpan(I,h)}}function D(R,I,h){const b=(0,e.u32)("length"),O=(0,e.struct)([b,(0,e.seq)(new M(R,I),(0,e.offset)(b,-b.span),"values")]);return new p(O,({values:F})=>new Map(F),F=>({values:Array.from(F.entries())}),h)}r.map=D})(Ee)),Ee}var $=vr(),Be={exports:{}},jt;function _r(){if(jt)return Be.exports;jt=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 L=!1,_=!1,x=!1;for(let P=0;P<y.length;P++){const S=y[P];L&&r.test(S)?(y=y.slice(0,P)+"-"+y.slice(P),L=!1,x=_,_=!0,P++):_&&x&&t.test(S)?(y=y.slice(0,P-1)+"-"+y.slice(P-1),x=_,_=!1,L=!0):(L=p(S)===S&&m(S)!==S,x=_,_=m(S)===S&&p(S)!==S)}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,L)=>p(L)).replace(c,m=>p(m))),v=(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(x=>x.trim()).filter(x=>x.length).join("-"):y=y.trim(),y.length===0)return"";const m=p.locale===!1?x=>x.toLowerCase():x=>x.toLocaleLowerCase(p.locale),L=p.locale===!1?x=>x.toUpperCase():x=>x.toLocaleUpperCase(p.locale);return y.length===1?p.pascalCase?L(y):m(y):(y!==m(y)&&(y=w(y,m,L)),y=y.replace(i,""),p.preserveConsecutiveUppercase?y=l(y,m):y=m(y),p.pascalCase&&(y=L(y.charAt(0))+y.slice(1)),d(y,L))};return Be.exports=v,Be.exports.default=v,Be.exports}var Er=_r();const G=A.getDefaultExportFromCjs(Er);function ve(r){let t=r.length;for(;--t>=0;)r[t]=0}const Ar=3,xr=258,Tn=29,kr=256,Sr=kr+1+Tn,Cn=30,Ir=512,Lr=new Array((Sr+2)*2);ve(Lr);const Tr=new Array(Cn*2);ve(Tr);const Cr=new Array(Ir);ve(Cr);const Or=new Array(xr-Ar+1);ve(Or);const Rr=new Array(Tn);ve(Rr);const Pr=new Array(Cn);ve(Pr);const Br=(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 ft=Br;const Dr=()=>{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},Ur=new Uint32Array(Dr()),Nr=(r,t,e,n)=>{const s=Ur,i=n+e;r^=-1;for(let u=n;u<i;u++)r=r>>>8^s[(r^t[u])&255];return r^-1};var ne=Nr,ht={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"},On={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 Mr=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var $r=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)Mr(e,n)&&(r[n]=e[n])}}return r},jr=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},Rn={assign:$r,flattenChunks:jr};let Pn=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Pn=!1}const Ie=new Uint8Array(256);for(let r=0;r<256;r++)Ie[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Ie[254]=Ie[254]=1;var Vr=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 Fr=(r,t)=>{if(t<65534&&r.subarray&&Pn)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 zr=(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=Ie[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 Fr(i,s)},qr=(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+Ie[r[e]]>t?e:t},pt={string2buf:Vr,buf2string:zr,utf8border:qr};function Kr(){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 Gr=Kr;const De=16209,Zr=16191;var Hr=function(t,e){let n,s,i,u,c,w,l,d,v,y,p,m,L,_,x,P,S,k,N,q,B,j,V,M;const D=t.state;n=t.next_in,V=t.input,s=n+(t.avail_in-5),i=t.next_out,M=t.output,u=i-(e-t.avail_out),c=i+(t.avail_out-257),w=D.dmax,l=D.wsize,d=D.whave,v=D.wnext,y=D.window,p=D.hold,m=D.bits,L=D.lencode,_=D.distcode,x=(1<<D.lenbits)-1,P=(1<<D.distbits)-1;e:do{m<15&&(p+=V[n++]<<m,m+=8,p+=V[n++]<<m,m+=8),S=L[p&x];t:for(;;){if(k=S>>>24,p>>>=k,m-=k,k=S>>>16&255,k===0)M[i++]=S&65535;else if(k&16){N=S&65535,k&=15,k&&(m<k&&(p+=V[n++]<<m,m+=8),N+=p&(1<<k)-1,p>>>=k,m-=k),m<15&&(p+=V[n++]<<m,m+=8,p+=V[n++]<<m,m+=8),S=_[p&P];n:for(;;){if(k=S>>>24,p>>>=k,m-=k,k=S>>>16&255,k&16){if(q=S&65535,k&=15,m<k&&(p+=V[n++]<<m,m+=8,m<k&&(p+=V[n++]<<m,m+=8)),q+=p&(1<<k)-1,q>w){t.msg="invalid distance too far back",D.mode=De;break e}if(p>>>=k,m-=k,k=i-u,q>k){if(k=q-k,k>d&&D.sane){t.msg="invalid distance too far back",D.mode=De;break e}if(B=0,j=y,v===0){if(B+=l-k,k<N){N-=k;do M[i++]=y[B++];while(--k);B=i-q,j=M}}else if(v<k){if(B+=l+v-k,k-=v,k<N){N-=k;do M[i++]=y[B++];while(--k);if(B=0,v<N){k=v,N-=k;do M[i++]=y[B++];while(--k);B=i-q,j=M}}}else if(B+=v-k,k<N){N-=k;do M[i++]=y[B++];while(--k);B=i-q,j=M}for(;N>2;)M[i++]=j[B++],M[i++]=j[B++],M[i++]=j[B++],N-=3;N&&(M[i++]=j[B++],N>1&&(M[i++]=j[B++]))}else{B=i-q;do M[i++]=M[B++],M[i++]=M[B++],M[i++]=M[B++],N-=3;while(N>2);N&&(M[i++]=M[B++],N>1&&(M[i++]=M[B++]))}}else if((k&64)===0){S=_[(S&65535)+(p&(1<<k)-1)];continue n}else{t.msg="invalid distance code",D.mode=De;break e}break}}else if((k&64)===0){S=L[(S&65535)+(p&(1<<k)-1)];continue t}else if(k&32){D.mode=Zr;break e}else{t.msg="invalid literal/length code",D.mode=De;break e}break}}while(n<s&&i<c);N=m>>3,n-=N,m-=N<<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 ye=15,Vt=852,Ft=592,zt=0,et=1,qt=2,Wr=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]),Xr=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]),Yr=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]),Jr=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]),Qr=(r,t,e,n,s,i,u,c)=>{const w=c.bits;let l=0,d=0,v=0,y=0,p=0,m=0,L=0,_=0,x=0,P=0,S,k,N,q,B,j=null,V;const M=new Uint16Array(ye+1),D=new Uint16Array(ye+1);let R=null,I,h,b;for(l=0;l<=ye;l++)M[l]=0;for(d=0;d<n;d++)M[t[e+d]]++;for(p=w,y=ye;y>=1&&M[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(v=1;v<y&&M[v]===0;v++);for(p<v&&(p=v),_=1,l=1;l<=ye;l++)if(_<<=1,_-=M[l],_<0)return-1;if(_>0&&(r===zt||y!==1))return-1;for(D[1]=0,l=1;l<ye;l++)D[l+1]=D[l]+M[l];for(d=0;d<n;d++)t[e+d]!==0&&(u[D[t[e+d]]++]=d);if(r===zt?(j=R=u,V=20):r===et?(j=Wr,R=Xr,V=257):(j=Yr,R=Jr,V=0),P=0,d=0,l=v,B=i,m=p,L=0,N=-1,x=1<<p,q=x-1,r===et&&x>Vt||r===qt&&x>Ft)return 1;for(;;){I=l-L,u[d]+1<V?(h=0,b=u[d]):u[d]>=V?(h=R[u[d]-V],b=j[u[d]-V]):(h=96,b=0),S=1<<l-L,k=1<<m,v=k;do k-=S,s[B+(P>>L)+k]=I<<24|h<<16|b|0;while(k!==0);for(S=1<<l-1;P&S;)S>>=1;if(S!==0?(P&=S-1,P+=S):P=0,d++,--M[l]===0){if(l===y)break;l=t[e+u[d]]}if(l>p&&(P&q)!==N){for(L===0&&(L=p),B+=v,m=l-L,_=1<<m;m+L<y&&(_-=M[m+L],!(_<=0));)m++,_<<=1;if(x+=1<<m,r===et&&x>Vt||r===qt&&x>Ft)return 1;N=P&q,s[N]=p<<24|m<<16|B-i|0}}return P!==0&&(s[B+P]=l-L<<24|64<<16|0),c.bits=p,0};var ke=Qr;const ei=0,Bn=1,Dn=2,{Z_FINISH:Kt,Z_BLOCK:ti,Z_TREES:Ue,Z_OK:pe,Z_STREAM_END:ni,Z_NEED_DICT:ri,Z_STREAM_ERROR:ee,Z_DATA_ERROR:Un,Z_MEM_ERROR:Nn,Z_BUF_ERROR:ii,Z_DEFLATED:Gt}=On,He=16180,Zt=16181,Ht=16182,Wt=16183,Xt=16184,Yt=16185,Jt=16186,Qt=16187,en=16188,tn=16189,ze=16190,ie=16191,tt=16192,nn=16193,nt=16194,rn=16195,sn=16196,on=16197,an=16198,Ne=16199,Me=16200,cn=16201,un=16202,ln=16203,dn=16204,fn=16205,rt=16206,hn=16207,pn=16208,K=16209,Mn=16210,$n=16211,si=852,oi=592,ai=15,ci=ai,wn=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function ui(){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 we=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode<He||t.mode>$n?1:0},jn=r=>{if(we(r))return ee;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=He,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(si),t.distcode=t.distdyn=new Int32Array(oi),t.sane=1,t.back=-1,pe},Vn=r=>{if(we(r))return ee;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,jn(r)},Fn=(r,t)=>{let e;if(we(r))return ee;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?ee:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,Vn(r))},zn=(r,t)=>{if(!r)return ee;const e=new ui;r.state=e,e.strm=r,e.window=null,e.mode=He;const n=Fn(r,t);return n!==pe&&(r.state=null),n},li=r=>zn(r,ci);let yn=!0,it,st;const di=r=>{if(yn){it=new Int32Array(512),st=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(ke(Bn,r.lens,0,288,it,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;ke(Dn,r.lens,0,32,st,0,r.work,{bits:5}),yn=!1}r.lencode=it,r.lenbits=9,r.distcode=st,r.distbits=5},qn=(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},fi=(r,t)=>{let e,n,s,i,u,c,w,l,d,v,y,p,m,L,_=0,x,P,S,k,N,q,B,j;const V=new Uint8Array(4);let M,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(we(r)||!r.output||!r.input&&r.avail_in!==0)return ee;e=r.state,e.mode===ie&&(e.mode=tt),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,v=c,y=w,j=pe;e:for(;;)switch(e.mode){case He:if(e.wrap===0){e.mode=tt;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,V[0]=l&255,V[1]=l>>>8&255,e.check=ne(e.check,V,2,0),l=0,d=0,e.mode=Zt;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",e.mode=K;break}if((l&15)!==Gt){r.msg="unknown compression method",e.mode=K;break}if(l>>>=4,d-=4,B=(l&15)+8,e.wbits===0&&(e.wbits=B),B>15||B>e.wbits){r.msg="invalid window size",e.mode=K;break}e.dmax=1<<e.wbits,e.flags=0,r.adler=e.check=1,e.mode=l&512?tn:ie,l=0,d=0;break;case Zt:for(;d<16;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(e.flags=l,(e.flags&255)!==Gt){r.msg="unknown compression method",e.mode=K;break}if(e.flags&57344){r.msg="unknown header flags set",e.mode=K;break}e.head&&(e.head.text=l>>8&1),e.flags&512&&e.wrap&4&&(V[0]=l&255,V[1]=l>>>8&255,e.check=ne(e.check,V,2,0)),l=0,d=0,e.mode=Ht;case Ht: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&&(V[0]=l&255,V[1]=l>>>8&255,V[2]=l>>>16&255,V[3]=l>>>24&255,e.check=ne(e.check,V,4,0)),l=0,d=0,e.mode=Wt;case Wt: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&&(V[0]=l&255,V[1]=l>>>8&255,e.check=ne(e.check,V,2,0)),l=0,d=0,e.mode=Xt;case Xt: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&&(V[0]=l&255,V[1]=l>>>8&255,e.check=ne(e.check,V,2,0)),l=0,d=0}else e.head&&(e.head.extra=null);e.mode=Yt;case Yt:if(e.flags&1024&&(p=e.length,p>c&&(p=c),p&&(e.head&&(B=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),B)),e.flags&512&&e.wrap&4&&(e.check=ne(e.check,n,p,i)),c-=p,i+=p,e.length-=p),e.length))break e;e.length=0,e.mode=Jt;case Jt:if(e.flags&2048){if(c===0)break e;p=0;do B=n[i+p++],e.head&&B&&e.length<65536&&(e.head.name+=String.fromCharCode(B));while(B&&p<c);if(e.flags&512&&e.wrap&4&&(e.check=ne(e.check,n,p,i)),c-=p,i+=p,B)break e}else e.head&&(e.head.name=null);e.length=0,e.mode=Qt;case Qt:if(e.flags&4096){if(c===0)break e;p=0;do B=n[i+p++],e.head&&B&&e.length<65536&&(e.head.comment+=String.fromCharCode(B));while(B&&p<c);if(e.flags&512&&e.wrap&4&&(e.check=ne(e.check,n,p,i)),c-=p,i+=p,B)break e}else e.head&&(e.head.comment=null);e.mode=en;case en: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=K;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=ie;break;case tn:for(;d<32;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}r.adler=e.check=wn(l),l=0,d=0,e.mode=ze;case ze: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,ri;r.adler=e.check=1,e.mode=ie;case ie:if(t===ti||t===Ue)break e;case tt:if(e.last){l>>>=d&7,d-=d&7,e.mode=rt;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=nn;break;case 1:if(di(e),e.mode=Ne,t===Ue){l>>>=2,d-=2;break e}break;case 2:e.mode=sn;break;case 3:r.msg="invalid block type",e.mode=K}l>>>=2,d-=2;break;case nn: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=K;break}if(e.length=l&65535,l=0,d=0,e.mode=nt,t===Ue)break e;case nt:e.mode=rn;case rn: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=ie;break;case sn: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=K;break}e.have=0,e.mode=on;case on: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,M={bits:e.lenbits},j=ke(ei,e.lens,0,19,e.lencode,0,e.work,M),e.lenbits=M.bits,j){r.msg="invalid code lengths set",e.mode=K;break}e.have=0,e.mode=an;case an:for(;e.have<e.nlen+e.ndist;){for(;_=e.lencode[l&(1<<e.lenbits)-1],x=_>>>24,P=_>>>16&255,S=_&65535,!(x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(S<16)l>>>=x,d-=x,e.lens[e.have++]=S;else{if(S===16){for(D=x+2;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(l>>>=x,d-=x,e.have===0){r.msg="invalid bit length repeat",e.mode=K;break}B=e.lens[e.have-1],p=3+(l&3),l>>>=2,d-=2}else if(S===17){for(D=x+3;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=x,d-=x,B=0,p=3+(l&7),l>>>=3,d-=3}else{for(D=x+7;d<D;){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=x,d-=x,B=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=K;break}for(;p--;)e.lens[e.have++]=B}}if(e.mode===K)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=K;break}if(e.lenbits=9,M={bits:e.lenbits},j=ke(Bn,e.lens,0,e.nlen,e.lencode,0,e.work,M),e.lenbits=M.bits,j){r.msg="invalid literal/lengths set",e.mode=K;break}if(e.distbits=6,e.distcode=e.distdyn,M={bits:e.distbits},j=ke(Dn,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,M),e.distbits=M.bits,j){r.msg="invalid distances set",e.mode=K;break}if(e.mode=Ne,t===Ue)break e;case Ne:e.mode=Me;case Me: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,Hr(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===ie&&(e.back=-1);break}for(e.back=0;_=e.lencode[l&(1<<e.lenbits)-1],x=_>>>24,P=_>>>16&255,S=_&65535,!(x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if(P&&(P&240)===0){for(k=x,N=P,q=S;_=e.lencode[q+((l&(1<<k+N)-1)>>k)],x=_>>>24,P=_>>>16&255,S=_&65535,!(k+x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=k,d-=k,e.back+=k}if(l>>>=x,d-=x,e.back+=x,e.length=S,P===0){e.mode=fn;break}if(P&32){e.back=-1,e.mode=ie;break}if(P&64){r.msg="invalid literal/length code",e.mode=K;break}e.extra=P&15,e.mode=cn;case cn: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=un;case un:for(;_=e.distcode[l&(1<<e.distbits)-1],x=_>>>24,P=_>>>16&255,S=_&65535,!(x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}if((P&240)===0){for(k=x,N=P,q=S;_=e.distcode[q+((l&(1<<k+N)-1)>>k)],x=_>>>24,P=_>>>16&255,S=_&65535,!(k+x<=d);){if(c===0)break e;c--,l+=n[i++]<<d,d+=8}l>>>=k,d-=k,e.back+=k}if(l>>>=x,d-=x,e.back+=x,P&64){r.msg="invalid distance code",e.mode=K;break}e.offset=S,e.extra=P&15,e.mode=ln;case ln: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=K;break}e.mode=dn;case dn: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=K;break}p>e.wnext?(p-=e.wnext,m=e.wsize-p):m=e.wnext-p,p>e.length&&(p=e.length),L=e.window}else L=s,m=u-e.offset,p=e.length;p>w&&(p=w),w-=p,e.length-=p;do s[u++]=L[m++];while(--p);e.length===0&&(e.mode=Me);break;case fn:if(w===0)break e;s[u++]=e.length,w--,e.mode=Me;break;case rt: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?ne(e.check,s,y,u-y):ft(e.check,s,y,u-y)),y=w,e.wrap&4&&(e.flags?l:wn(l))!==e.check){r.msg="incorrect data check",e.mode=K;break}l=0,d=0}e.mode=hn;case hn: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=K;break}l=0,d=0}e.mode=pn;case pn:j=ni;break e;case K:j=Un;break e;case Mn:return Nn;case $n:default:return ee}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<K&&(e.mode<rt||t!==Kt))&&qn(r,r.output,r.next_out,y-r.avail_out),v-=r.avail_in,y-=r.avail_out,r.total_in+=v,r.total_out+=y,e.total+=y,e.wrap&4&&y&&(r.adler=e.check=e.flags?ne(e.check,s,y,r.next_out-y):ft(e.check,s,y,r.next_out-y)),r.data_type=e.bits+(e.last?64:0)+(e.mode===ie?128:0)+(e.mode===Ne||e.mode===nt?256:0),(v===0&&y===0||t===Kt)&&j===pe&&(j=ii),j},hi=r=>{if(we(r))return ee;let t=r.state;return t.window&&(t.window=null),r.state=null,pe},pi=(r,t)=>{if(we(r))return ee;const e=r.state;return(e.wrap&2)===0?ee:(e.head=t,t.done=!1,pe)},wi=(r,t)=>{const e=t.length;let n,s,i;return we(r)||(n=r.state,n.wrap!==0&&n.mode!==ze)?ee:n.mode===ze&&(s=1,s=ft(s,t,e,0),s!==n.check)?Un:(i=qn(r,t,e,e),i?(n.mode=Mn,Nn):(n.havedict=1,pe))};var yi=Vn,gi=Fn,mi=jn,bi=li,vi=zn,_i=fi,Ei=hi,Ai=pi,xi=wi,ki="pako inflate (from Nodeca project)",se={inflateReset:yi,inflateReset2:gi,inflateResetKeep:mi,inflateInit:bi,inflateInit2:vi,inflate:_i,inflateEnd:Ei,inflateGetHeader:Ai,inflateSetDictionary:xi,inflateInfo:ki};function Si(){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 Ii=Si;const Kn=Object.prototype.toString,{Z_NO_FLUSH:Li,Z_FINISH:Ti,Z_OK:Le,Z_STREAM_END:ot,Z_NEED_DICT:at,Z_STREAM_ERROR:Ci,Z_DATA_ERROR:gn,Z_MEM_ERROR:Oi}=On;function We(r){this.options=Rn.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 Gr,this.strm.avail_out=0;let e=se.inflateInit2(this.strm,t.windowBits);if(e!==Le)throw new Error(ht[e]);if(this.header=new Ii,se.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=pt.string2buf(t.dictionary):Kn.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=se.inflateSetDictionary(this.strm,t.dictionary),e!==Le)))throw new Error(ht[e])}We.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?Ti:Li,Kn.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=se.inflate(e,u),i===at&&s&&(i=se.inflateSetDictionary(e,s),i===Le?i=se.inflate(e,u):i===gn&&(i=at));e.avail_in>0&&i===ot&&e.state.wrap>0&&r[e.next_in]!==0;)se.inflateReset(e),i=se.inflate(e,u);switch(i){case Ci:case gn:case at:case Oi:return this.onEnd(i),this.ended=!0,!1}if(c=e.avail_out,e.next_out&&(e.avail_out===0||i===ot))if(this.options.to==="string"){let w=pt.utf8border(e.output,e.next_out),l=e.next_out-w,d=pt.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===Le&&c===0)){if(i===ot)return i=se.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};We.prototype.onData=function(r){this.chunks.push(r)};We.prototype.onEnd=function(r){r===Le&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Rn.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Ri(r,t){const e=new We(t);if(e.push(r),e.err)throw e.msg||ht[e.err];return e.result}var Pi=Ri,Bi={inflate:Pi};const{inflate:Di}=Bi;var Ui=Di,ct={exports:{}},mn;function Ni(){return mn||(mn=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,v,y){if(typeof d!="function")throw new TypeError("The listener must be a function");var p=new s(d,v||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,v;if(this._eventsCount===0)return l;for(v in d=this._events)t.call(d,v)&&l.push(e?v.slice(1):v);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},c.prototype.listeners=function(l){var d=e?e+l:l,v=this._events[d];if(!v)return[];if(v.fn)return[v.fn];for(var y=0,p=v.length,m=new Array(p);y<p;y++)m[y]=v[y].fn;return m},c.prototype.listenerCount=function(l){var d=e?e+l:l,v=this._events[d];return v?v.fn?1:v.length:0},c.prototype.emit=function(l,d,v,y,p,m){var L=e?e+l:l;if(!this._events[L])return!1;var _=this._events[L],x=arguments.length,P,S;if(_.fn){switch(_.once&&this.removeListener(l,_.fn,void 0,!0),x){case 1:return _.fn.call(_.context),!0;case 2:return _.fn.call(_.context,d),!0;case 3:return _.fn.call(_.context,d,v),!0;case 4:return _.fn.call(_.context,d,v,y),!0;case 5:return _.fn.call(_.context,d,v,y,p),!0;case 6:return _.fn.call(_.context,d,v,y,p,m),!0}for(S=1,P=new Array(x-1);S<x;S++)P[S-1]=arguments[S];_.fn.apply(_.context,P)}else{var k=_.length,N;for(S=0;S<k;S++)switch(_[S].once&&this.removeListener(l,_[S].fn,void 0,!0),x){case 1:_[S].fn.call(_[S].context);break;case 2:_[S].fn.call(_[S].context,d);break;case 3:_[S].fn.call(_[S].context,d,v);break;case 4:_[S].fn.call(_[S].context,d,v,y);break;default:if(!P)for(N=1,P=new Array(x-1);N<x;N++)P[N-1]=arguments[N];_[S].fn.apply(_[S].context,P)}}return!0},c.prototype.on=function(l,d,v){return i(this,l,d,v,!1)},c.prototype.once=function(l,d,v){return i(this,l,d,v,!0)},c.prototype.removeListener=function(l,d,v,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)&&(!v||m.context===v)&&u(this,p);else{for(var L=0,_=[],x=m.length;L<x;L++)(m[L].fn!==d||y&&!m[L].once||v&&m[L].context!==v)&&_.push(m[L]);_.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})(ct)),ct.exports}var Mi=Ni();const $i=A.getDefaultExportFromCjs(Mi);function ji(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const Ae=r=>"version"in r;function Vi(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function Fi(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?A.Buffer$1.from([]):A.Buffer$1.from(t.map(e=>parseInt(e,16)))}var zi=Object.freeze({__proto__:null,encode:Vi,decode:Fi});function Gn(r){return new TextDecoder("utf-8").decode(r)}function Zn(r){return new TextEncoder().encode(r)}var qi=Object.freeze({__proto__:null,decode:Gn,encode:Zn});function wt(r){return A.bs58.encode(r)}function Ki(r){return A.bs58.decode(r)}var Gi=Object.freeze({__proto__:null,encode:wt,decode:Ki});function yt(r){return r.toString("base64")}function kt(r){return A.Buffer$1.from(r,"base64")}var Zi=Object.freeze({__proto__:null,encode:yt,decode:kt}),Hi=Object.freeze({__proto__:null,hex:zi,utf8:qi,bs58:Gi,base64:Zi});function Hn(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 Wi(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 Wn(r,t={}){r.forEach(e=>{if("accounts"in e)Wn(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function J(r){return r instanceof A.PublicKey?r:new A.PublicKey(r)}class Xi 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 Yi(r){return me(r)&&typeof r[Symbol.iterator]=="function"}function me(r){return typeof r=="object"&&r!=null}function ue(r){return typeof r=="string"?JSON.stringify(r):""+r}function Ji(r){const{done:t,value:e}=r.next();return t?void 0:e}function Qi(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: `"+ue(n)+"`"}=r;return{value:n,type:u,refinement:c,key:s[s.length-1],path:s,branch:i,...r,message:w}}function*bn(r,t,e,n){Yi(r)||(r=[r]);for(const s of r){const i=Qi(s,t,e,n);i&&(yield i)}}function*St(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"&&me(t.schema)&&me(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,v]of t.entries(r,c)){const y=St(d,v,{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):me(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 le{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 bn(d,l,this,w)}:this.validator=()=>[],i?this.refiner=(w,l)=>{const d=i(w,l);return bn(d,l,this,w)}:this.refiner=()=>[]}assert(t){return es(t,this)}create(t){return It(t,this)}is(t){return Xn(t,this)}mask(t){return ts(t,this)}validate(t,e){return e===void 0&&(e={}),Ce(t,this,e)}}function es(r,t){const e=Ce(r,t);if(e[0])throw e[0]}function It(r,t){const e=Ce(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function ts(r,t){const e=Ce(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function Xn(r,t){return!Ce(r,t)[0]}function Ce(r,t,e){e===void 0&&(e={});const n=St(r,t,e),s=Ji(n);return s[0]?[new Xi(s[0],function*(){for(const u of n)u[0]&&(yield u[0])}),void 0]:[void 0,s[1]]}function Oe(r,t){return new le({type:r,schema:null,validator:t})}function ns(){return Oe("any",()=>!0)}function ut(r){return new le({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: "+ue(t)}})}function rs(){return Oe("boolean",r=>typeof r=="boolean")}function vn(r){const t=ue(r);return new le({type:"literal",schema:r,validator(e){return e===r||"Expected the literal `"+t+"`, but received: "+ue(e)}})}function $e(r){return new le({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function Ve(){return Oe("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ue(r))}function Fe(r){return new le({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function de(){return Oe("string",r=>typeof r=="string"||"Expected a string, but received: "+ue(r))}function ce(r){const t=Object.keys(r);return new le({type:"type",schema:r,*entries(e){if(me(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return me(e)||"Expected an object, but received: "+ue(e)}})}function Yn(r){const t=r.map(e=>e.type).join(" | ");return new le({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[u]=i.validate(e,{coerce:!0});return!u})||Lt()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...u]=St(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: "+ue(e),...s]}})}function Lt(){return Oe("unknown",()=>!0)}function is(r,t,e){return new le({...r,coercer:(n,s)=>Xn(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}async function ss(r,t,e,n){r=J(r),n||(n=qe());const s=new A.Transaction;if(s.add(new A.TransactionInstruction({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 _n=99;async function os(r,t,e){return(await Tt(r,t,e)).map(s=>s?{publicKey:s.publicKey,account:s.account}:null)}async function Tt(r,t,e){if(t.length<=_n)return await En(r,t,e);{const n=ji(t,_n);return(await Promise.all(n.map(i=>En(r,i,e)))).flat()}}async function En(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 Jn(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(L=>L.toBase58());d.accounts={encoding:"base64",addresses:m}}e&&(d.sigVerify=!0);const v=[l,d],y=await r._rpcRequest("simulateTransaction",v),p=It(y,ls);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 L=`
|
|
2
2
|
`,_=L+m.join(L);console.error(p.error.message,_)}throw new A.SendTransactionError("failed to simulate transaction: "+p.error.message,m)}return p.result}function as(r){return is(Qn(r),cs,t=>"error"in t?t:{...t,result:It(t.result,r)})}const cs=Qn(Lt());function Qn(r){return Yn([ce({jsonrpc:vn("2.0"),id:de(),result:r}),ce({jsonrpc:vn("2.0"),id:de(),error:ce({code:Lt(),message:de(),data:Fe(ns())})})])}function us(r){return as(ce({context:ce({slot:Ve()}),value:r}))}const ls=us(ce({err:$e(Yn([ce({}),de()])),logs:$e(ut(de())),accounts:Fe($e(ut($e(ce({executable:rs(),owner:de(),lamports:Ve(),data:ut(de()),rentEpoch:Fe(Ve())}))))),unitsConsumed:Fe(Ve())}));var ds=Object.freeze({__proto__:null,invoke:ss,getMultipleAccounts:os,getMultipleAccountsAndContext:Tt,simulateTransaction:Jn});class fs{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),Ae(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 An(this.connection,w,n)}catch(l){if(l instanceof gt){const d=wt(Ae(t)?((i=t.signatures)===null||i===void 0?void 0:i[0])||new Uint8Array:(u=t.signature)!==null&&u!==void 0?u:new Uint8Array),v=await this.connection.getTransaction(d,{commitment:"confirmed"});if(v){const y=(c=v.meta)===null||c===void 0?void 0:c.logMessages;throw y?new A.SendTransactionError(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 v,y;if(Ae(d.tx)){let p=d.tx;return d.signers&&p.sign(d.signers),p}else{let p=d.tx,m=(v=d.signers)!==null&&v!==void 0?v:[];return p.feePayer=(y=p.feePayer)!==null&&y!==void 0?y:this.wallet.publicKey,p.recentBlockhash=u,m.forEach(L=>{p.partialSign(L)}),p}});const w=await this.wallet.signAllTransactions(c),l=[];for(let d=0;d<c.length;d+=1){const v=w[d],y=v.serialize();try{l.push(await An(this.connection,y,e))}catch(p){if(p instanceof gt){const m=wt(Ae(v)?((n=v.signatures)===null||n===void 0?void 0:n[0])||new Uint8Array:(s=v.signature)!==null&&s!==void 0?s:new Uint8Array),L=await this.connection.getTransaction(m,{commitment:"confirmed"});if(L){const _=(i=L.meta)===null||i===void 0?void 0:i.logMessages;throw _?new A.SendTransactionError(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(Ae(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 Jn(this.connection,t,e,n,s)),u.value.err)throw new hs(u.value);return u.value}}class hs extends Error{constructor(t,e){super(e),this.simulationResponse=t}}async function An(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 gt(`Raw transaction ${s} failed (${JSON.stringify(i)})`);return s}class gt extends Error{constructor(t){super(t)}}function qe(){return fs.local()}const ps=new Set(["anchor-deprecated-state","debug-logs"]),er=new Map;function ws(r){if(!ps.has(r))throw new Error("Invalid feature");er.set(r,!0)}function Ct(r){return er.get(r)!==void 0}var ys=Object.freeze({__proto__:null,set:ws,isSet:Ct});class Ke extends Error{constructor(t){super(t),this.name="IdlError"}}class Re{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 A.PublicKey(c))}return new Re(i)}}class Se 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=Re.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 A.PublicKey(p),new A.PublicKey(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),v=/^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),L={code:y,number:parseInt(p)};return new Se(L,m,s,t,void 0,i)}else if(l){const[y,p,m,L,_]=l.slice(1,6),x={code:m,number:parseInt(L)},P={file:y,line:parseInt(p)};return new Se(x,_,s,t,P,i)}else if(v){const[y,p,m,L]=v.slice(1,5),_=y,x={code:p,number:parseInt(m)};return new Se(x,L,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 Ge extends Error{constructor(t,e,n){super(),this.code=t,this.msg=e,this.logs=n,n&&(this._programErrorStack=Re.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 Ge(i,u,t.logs):(u=gs.get(i),u!==void 0?new Ge(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 Ot(r,t){Ct("debug-logs")&&console.log("Translating error:",r);const e=Se.parse(r.logs);if(e)return e;const n=Ge.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=Re.parse(r.logs),new Proxy(r,s)}return r}const U={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},gs=new Map([[U.InstructionMissing,"8 byte instruction identifier not provided"],[U.InstructionFallbackNotFound,"Fallback functions are not supported"],[U.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[U.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[U.IdlInstructionStub,"The program was compiled without idl instructions"],[U.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[U.ConstraintMut,"A mut constraint was violated"],[U.ConstraintHasOne,"A has one constraint was violated"],[U.ConstraintSigner,"A signer constraint was violated"],[U.ConstraintRaw,"A raw constraint was violated"],[U.ConstraintOwner,"An owner constraint was violated"],[U.ConstraintRentExempt,"A rent exemption constraint was violated"],[U.ConstraintSeeds,"A seeds constraint was violated"],[U.ConstraintExecutable,"An executable constraint was violated"],[U.ConstraintState,"Deprecated Error, feel free to replace with something else"],[U.ConstraintAssociated,"An associated constraint was violated"],[U.ConstraintAssociatedInit,"An associated init constraint was violated"],[U.ConstraintClose,"A close constraint was violated"],[U.ConstraintAddress,"An address constraint was violated"],[U.ConstraintZero,"Expected zero account discriminant"],[U.ConstraintTokenMint,"A token mint constraint was violated"],[U.ConstraintTokenOwner,"A token owner constraint was violated"],[U.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[U.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[U.ConstraintMintDecimals,"A mint decimals constraint was violated"],[U.ConstraintSpace,"A space constraint was violated"],[U.ConstraintAccountIsNone,"A required account for the constraint is None"],[U.RequireViolated,"A require expression was violated"],[U.RequireEqViolated,"A require_eq expression was violated"],[U.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[U.RequireNeqViolated,"A require_neq expression was violated"],[U.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[U.RequireGtViolated,"A require_gt expression was violated"],[U.RequireGteViolated,"A require_gte expression was violated"],[U.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[U.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[U.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[U.AccountDidNotDeserialize,"Failed to deserialize the account"],[U.AccountDidNotSerialize,"Failed to serialize the account"],[U.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[U.AccountNotMutable,"The given account is not mutable"],[U.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[U.InvalidProgramId,"Program ID was not as expected"],[U.InvalidProgramExecutable,"Program account is not executable"],[U.AccountNotSigner,"The given account did not sign"],[U.AccountNotSystemOwned,"The given account is not owned by the system program"],[U.AccountNotInitialized,"The program expected this account to be already initialized"],[U.AccountNotProgramData,"The given account is not a program data account"],[U.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[U.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[U.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[U.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[U.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[U.Deprecated,"The API being used is deprecated and should no longer be used"]]);var mt=function(){return mt=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},mt.apply(this,arguments)},bt=function(){return bt=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},bt.apply(this,arguments)};function ms(r){return r.toLowerCase()}var bs=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],vs=/[^A-Z0-9]+/gi;function _s(r,t){t===void 0&&(t={});for(var e=t.splitRegexp,n=e===void 0?bs:e,s=t.stripRegexp,i=s===void 0?vs:s,u=t.transform,c=u===void 0?ms:u,w=t.delimiter,l=w===void 0?" ":w,d=xn(xn(r,n,"$1\0$2"),i,"\0"),v=0,y=d.length;d.charAt(v)==="\0";)v++;for(;d.charAt(y-1)==="\0";)y--;return d.slice(v,y).split("\0").map(c).join(l)}function xn(r,t,e){return t instanceof RegExp?r.replace(t,e):t.reduce(function(n,s){return n.replace(s,e)},r)}function Es(r,t){return t===void 0&&(t={}),_s(r,bt({delimiter:"."},t))}function As(r,t){return t===void 0&&(t={}),Es(r,mt({delimiter:"_"},t))}class X{static fieldLayout(t,e){const n=t.name!==void 0?G(t.name):void 0;switch(t.type){case"bool":return $.bool(n);case"u8":return $.u8(n);case"i8":return $.i8(n);case"u16":return $.u16(n);case"i16":return $.i16(n);case"u32":return $.u32(n);case"i32":return $.i32(n);case"f32":return $.f32(n);case"u64":return $.u64(n);case"i64":return $.i64(n);case"f64":return $.f64(n);case"u128":return $.u128(n);case"i128":return $.i128(n);case"u256":return $.u256(n);case"i256":return $.i256(n);case"bytes":return $.vecU8(n);case"string":return $.str(n);case"publicKey":return $.publicKey(n);default:{if("vec"in t.type)return $.vec(X.fieldLayout({name:void 0,type:t.type.vec},e),n);if("option"in t.type)return $.option(X.fieldLayout({name:void 0,type:t.type.option},e),n);if("defined"in t.type){if(!e)throw new Ke("User defined types not provided");const s=t.type.defined,i=e.filter(u=>u.name===s);if(i.length!==1)throw new Ke(`Type not found: ${JSON.stringify(t)}`);return X.typeDefLayout(i[0],e,n)}else if("array"in t.type){let s=t.type.array[0],i=t.type.array[1],u=X.fieldLayout({name:void 0,type:s},e);return $.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=>X.fieldLayout(i,e));return $.struct(s,n)}case"enum":{let s=t.type.variants.map(i=>{const u=G(i.name);if(!i.fields)return $.struct([],u);const c=i.fields.map((w,l)=>w?.name?X.fieldLayout(w,e):X.fieldLayout({type:w,name:l.toString()},e));return $.struct(c,u)});return n!==void 0?$.rustEnum(s).replicate(n):$.rustEnum(s,n)}case"alias":return X.fieldLayout({type:t.type.value,name:t.name},e)}}}const kn="global";class Rt{constructor(t){this.idl=t,this.ixLayout=Rt.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const s=Sn(kn,n.name);e.set(A.bs58.encode(s),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(kn,t,e)}_encode(t,e,n){const s=A.Buffer$1.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 A.Buffer$1.concat([Sn(t,e),w])}static parseIxLayout(t){const e=t.instructions.map(n=>{let s=n.args.map(u=>{var c,w;return X.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,$.struct(s,i)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?A.Buffer$1.from(t,"hex"):A.bs58.decode(t));let n=A.bs58.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 re.format(t,e,this.idl)}}class re{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:re.formatIdlType(w.type),data:re.formatIdlData(w,t.data[w.name],n.types)})),u=re.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 re.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+": "+re.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 v=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+": "+re.formatIdlData(y,v,n)}).join(", "),w=G(i,{pascalCase:!0});return c.length===0?w:`${w} { ${c} }`}else return"Tuple formatting not yet implemented"}case"alias":return re.formatIdlType(t.type.value)}}static flattenIdlAccounts(t,e){return t.map(n=>{const s=xs(n.name);if(n.hasOwnProperty("accounts")){const i=e?`${e} > ${s}`:s;return re.flattenIdlAccounts(n.accounts,i)}else return{...n,name:e?`${e} > ${s}`:s}}).flat()}}function xs(r){const t=r.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}function Sn(r,t){let e=As(t),n=`${r}:${e}`;return A.Buffer$1.from(A.sha256(n).slice(0,8))}function tr(r,t){switch(t.type.kind){case"struct":return t.type.fields.map(e=>fe(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?fe(r,s.type):fe(r,s)).reduce((s,i)=>s+i,0):0);return Math.max(...e)+1}case"alias":return fe(r,t.type.value)}}function fe(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+fe(r,t.option);if("coption"in t)return 4+fe(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 Ke(`Type not found: ${JSON.stringify(t)}`);let i=s[0];return tr(r,i)}if("array"in t){let s=t.array[0],i=t.array[1];return fe(r,s)*i}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const vt=8;function nr(r){return A.Buffer.from(A.sha256(r).slice(0,vt))}class ge{constructor(t){if(t.accounts===void 0){this.accountLayouts=new Map;return}const e=t.accounts.map(n=>[n.name,X.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=A.Buffer$1.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=ge.accountDiscriminator(t);return A.Buffer$1.concat([c,u])}decode(t,e){if(ge.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=>ge.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(vt),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);return s.decode(n)}memcmp(t,e){const n=ge.accountDiscriminator(t);return{offset:0,bytes:A.bs58.encode(e?A.Buffer$1.concat([n,e]):n)}}size(t){var e;return vt+((e=tr(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){const e=`account:${G(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return nr(e)}}class ks{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,X.typeDefLayout(s,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[yt(Ss(n.name)),n.name]))}decode(t){let e;try{e=kt(t)}catch{return null}const n=yt(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 Ss(r){return nr(`event:${r}`)}class Is{constructor(t){if(t.types===void 0){this.typeLayouts=new Map;return}const e=t.types.map(n=>[n.name,X.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=A.Buffer$1.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 rr{constructor(t){this.instruction=new Rt(t),this.accounts=new ge(t),this.events=new ks(t),this.types=new Is(t)}}var Ls=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof A.global<"u"?A.global:typeof self<"u"?self:{};function Ts(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class Y{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 Xe=Y;function Cs(r,t){return t.property?r+"["+t.property+"]":r}class he extends Y{isCount(){throw new Error("ExternalLayout is abstract")}}class ir extends he{constructor(t,e,n){if(!(t instanceof Y))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 Ye||this.layout instanceof sr}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 Ye extends Y{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 sr extends Y{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 _t=Math.pow(2,32);function or(r){const t=Math.floor(r/_t),e=r-t*_t;return{hi32:t,lo32:e}}function ar(r,t){return r*_t+t}class Os extends Y{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),s=t.readUInt32LE(e+4);return ar(s,n)}encode(t,e,n){n===void 0&&(n=0);const s=or(t);return e.writeUInt32LE(s.lo32,n),e.writeUInt32LE(s.hi32,n+4),8}}class Rs extends Y{constructor(t){super(8,t)}decode(t,e){e===void 0&&(e=0);const n=t.readUInt32LE(e),s=t.readInt32LE(e+4);return ar(s,n)}encode(t,e,n){n===void 0&&(n=0);const s=or(t);return e.writeUInt32LE(s.lo32,n),e.writeInt32LE(s.hi32,n+4),8}}class Ps extends Y{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((i,u)=>i&&u instanceof Y,!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 cr{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class In extends cr{constructor(t,e){if(!(t instanceof he&&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 ur extends Y{constructor(t,e,n){const s=t instanceof Ye||t instanceof sr;if(s)t=new In(new ir(t));else if(t instanceof he&&t.isCount())t=new In(t);else if(!(t instanceof cr))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Y))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 Bs(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return A.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Bs extends Y{constructor(t,e,n,s){if(!(t instanceof ur))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 Y))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 Ds extends Y{constructor(t,e){if(!(t instanceof he&&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 he||(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 he&&(s=t.length),!(A.Buffer.isBuffer(t)&&s===t.length))throw new TypeError(Cs("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 he&&this.length.encode(s,e,n),s}}var Us=((r,t,e)=>new ir(r,t,e)),Ns=(r=>new Ye(1,r)),oe=(r=>new Ye(4,r)),Ms=(r=>new Os(r)),ae=(r=>new Rs(r)),W=((r,t,e)=>new Ps(r,t,e)),lr=((r,t,e)=>new ur(r,t,e)),Pe=((r,t)=>new Ds(r,t));class $s extends Xe{constructor(t){super(-1,t),this.property=t,this.layout=W([oe("length"),oe("lengthPadding"),Pe(Us(oe(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const s={chars:A.Buffer.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 oe().span+oe().span+new A.BN(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function Je(r){return new $s(r)}function te(r){return Pe(32,r)}const Q=lr(oe("instruction"));Q.addVariant(0,W([ae("lamports"),ae("space"),te("owner")]),"createAccount");Q.addVariant(1,W([te("owner")]),"assign");Q.addVariant(2,W([ae("lamports")]),"transfer");Q.addVariant(3,W([te("base"),Je("seed"),ae("lamports"),ae("space"),te("owner")]),"createAccountWithSeed");Q.addVariant(4,W([te("authorized")]),"advanceNonceAccount");Q.addVariant(5,W([ae("lamports")]),"withdrawNonceAccount");Q.addVariant(6,W([te("authorized")]),"initializeNonceAccount");Q.addVariant(7,W([te("authorized")]),"authorizeNonceAccount");Q.addVariant(8,W([ae("space")]),"allocate");Q.addVariant(9,W([te("base"),Je("seed"),ae("space"),te("owner")]),"allocateWithSeed");Q.addVariant(10,W([te("base"),Je("seed"),te("owner")]),"assignWithSeed");Q.addVariant(11,W([ae("lamports"),Je("seed"),te("owner")]),"transferWithSeed");Math.max(...Object.values(Q.registry).map(r=>r.span));class js extends Xe{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 Ln(r){return new js(Pe(32),t=>new A.PublicKey(t),t=>t.toBuffer(),r)}W([oe("version"),oe("state"),Ln("authorizedPubkey"),Ln("nonce"),W([Ms("lamportsPerSignature")],"feeCalculator")]);function Vs(r){return new TextDecoder().decode(A.sha256(r))}var Fs=Object.freeze({__proto__:null,hash:Vs});function zs(r,t,e){const n=A.Buffer$1.concat([r.toBuffer(),A.Buffer$1.from(t),e.toBuffer()]);return new A.PublicKey(A.sha256(n))}function dr(r,...t){let e=[A.Buffer$1.from([97,110,99,104,111,114])];t.forEach(s=>{e.push(s instanceof A.Buffer$1?s:J(s).toBuffer())});const[n]=A.PublicKey.findProgramAddressSync(e,J(r));return n}var qs=Object.freeze({__proto__:null,createWithSeedSync:zs,associated:dr});const Pt=new A.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Bt=new A.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function Ks({mint:r,owner:t}){return A.PublicKey.findProgramAddressSync([t.toBuffer(),Pt.toBuffer(),r.toBuffer()],Bt)[0]}var Gs=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Pt,ASSOCIATED_PROGRAM_ID:Bt,associatedAddress:Ks}),Et={exports:{}};(function(r,t){var e=typeof self<"u"?self:Ls,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 v(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 b={next:function(){var O=h.shift();return{done:O===void 0,value:O}}};return c.iterable&&(b[Symbol.iterator]=function(){return b}),b}function m(h){this.map={},h instanceof m?h.forEach(function(b,O){this.append(O,b)},this):Array.isArray(h)?h.forEach(function(b){this.append(b[0],b[1])},this):h&&Object.getOwnPropertyNames(h).forEach(function(b){this.append(b,h[b])},this)}m.prototype.append=function(h,b){h=v(h),b=y(b);var O=this.map[h];this.map[h]=O?O+", "+b:b},m.prototype.delete=function(h){delete this.map[v(h)]},m.prototype.get=function(h){return h=v(h),this.has(h)?this.map[h]:null},m.prototype.has=function(h){return this.map.hasOwnProperty(v(h))},m.prototype.set=function(h,b){this.map[v(h)]=y(b)},m.prototype.forEach=function(h,b){for(var O in this.map)this.map.hasOwnProperty(O)&&h.call(b,this.map[O],O,this)},m.prototype.keys=function(){var h=[];return this.forEach(function(b,O){h.push(O)}),p(h)},m.prototype.values=function(){var h=[];return this.forEach(function(b){h.push(b)}),p(h)},m.prototype.entries=function(){var h=[];return this.forEach(function(b,O){h.push([O,b])}),p(h)},c.iterable&&(m.prototype[Symbol.iterator]=m.prototype.entries);function L(h){if(h.bodyUsed)return Promise.reject(new TypeError("Already read"));h.bodyUsed=!0}function _(h){return new Promise(function(b,O){h.onload=function(){b(h.result)},h.onerror=function(){O(h.error)}})}function x(h){var b=new FileReader,O=_(b);return b.readAsArrayBuffer(h),O}function P(h){var b=new FileReader,O=_(b);return b.readAsText(h),O}function S(h){for(var b=new Uint8Array(h),O=new Array(b.length),F=0;F<b.length;F++)O[F]=String.fromCharCode(b[F]);return O.join("")}function k(h){if(h.slice)return h.slice(0);var b=new Uint8Array(h.byteLength);return b.set(new Uint8Array(h)),b.buffer}function N(){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=k(h.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):c.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(h)||d(h))?this._bodyArrayBuffer=k(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=L(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?L(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(x)}),this.text=function(){var h=L(this);if(h)return h;if(this._bodyBlob)return P(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(S(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(V)}),this.json=function(){return this.text().then(JSON.parse)},this}var q=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function B(h){var b=h.toUpperCase();return q.indexOf(b)>-1?b:h}function j(h,b){b=b||{};var O=b.body;if(h instanceof j){if(h.bodyUsed)throw new TypeError("Already read");this.url=h.url,this.credentials=h.credentials,b.headers||(this.headers=new m(h.headers)),this.method=h.method,this.mode=h.mode,this.signal=h.signal,!O&&h._bodyInit!=null&&(O=h._bodyInit,h.bodyUsed=!0)}else this.url=String(h);if(this.credentials=b.credentials||this.credentials||"same-origin",(b.headers||!this.headers)&&(this.headers=new m(b.headers)),this.method=B(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.signal=b.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&O)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(O)}j.prototype.clone=function(){return new j(this,{body:this._bodyInit})};function V(h){var b=new FormData;return h.trim().split("&").forEach(function(O){if(O){var F=O.split("="),Z=F.shift().replace(/\+/g," "),g=F.join("=").replace(/\+/g," ");b.append(decodeURIComponent(Z),decodeURIComponent(g))}}),b}function M(h){var b=new m,O=h.replace(/\r?\n[\t ]+/g," ");return O.split(/\r?\n/).forEach(function(F){var Z=F.split(":"),g=Z.shift().trim();if(g){var o=Z.join(":").trim();b.append(g,o)}}),b}N.call(j.prototype);function D(h,b){b||(b={}),this.type="default",this.status=b.status===void 0?200:b.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new m(b.headers),this.url=b.url||"",this._initBody(h)}N.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,b){if(R.indexOf(b)===-1)throw new RangeError("Invalid status code");return new D(null,{status:b,headers:{location:h}})},u.DOMException=i.DOMException;try{new u.DOMException}catch{u.DOMException=function(b,O){this.message=b,this.name=O;var F=Error(b);this.stack=F.stack},u.DOMException.prototype=Object.create(Error.prototype),u.DOMException.prototype.constructor=u.DOMException}function I(h,b){return new Promise(function(O,F){var Z=new j(h,b);if(Z.signal&&Z.signal.aborted)return F(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:M(g.getAllResponseHeaders()||"")};a.url="responseURL"in g?g.responseURL:a.headers.get("X-Request-URL");var f="response"in g?g.response:g.responseText;O(new D(f,a))},g.onerror=function(){F(new TypeError("Network request failed"))},g.ontimeout=function(){F(new TypeError("Network request failed"))},g.onabort=function(){F(new u.DOMException("Aborted","AbortError"))},g.open(Z.method,Z.url,!0),Z.credentials==="include"?g.withCredentials=!0:Z.credentials==="omit"&&(g.withCredentials=!1),"responseType"in g&&c.blob&&(g.responseType="blob"),Z.headers.forEach(function(a,f){g.setRequestHeader(f,a)}),Z.signal&&(Z.signal.addEventListener("abort",o),g.onreadystatechange=function(){g.readyState===4&&Z.signal.removeEventListener("abort",o)}),g.send(typeof Z._bodyInit>"u"?null:Z._bodyInit)})}return I.polyfill=!0,i.fetch||(i.fetch=I,i.Headers=m,i.Request=j,i.Response=D),u.Headers=m,u.Request=j,u.Response=D,u.fetch=I,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})(Et,Et.exports);var Zs=Ts(Et.exports);async function Hs(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[s,i]=await Promise.all([fr(r,t),Zs(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 fr(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=At(e.data),s=await r.getAccountInfo(n.programdataAddress);if(s===null)throw new Error("program data account not found");const{programData:i}=At(s.data);return i}const Ws=$.rustEnum([$.struct([],"uninitialized"),$.struct([$.option($.publicKey(),"authorityAddress")],"buffer"),$.struct([$.publicKey("programdataAddress")],"program"),$.struct([$.u64("slot"),$.option($.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,$.u32());function At(r){return Ws.decode(r)}var Xs=Object.freeze({__proto__:null,verifiedBuild:Hs,fetchData:fr,decodeUpgradeableLoaderState:At}),Ys=Object.freeze({__proto__:null,sha256:Fs,rpc:ds,publicKey:qs,bytes:Hi,token:Gs,features:ys,registry:Xs});function Js(r){return"accounts"in r}async function Qs(r){const t=(await A.PublicKey.findProgramAddress([],r))[0];return await A.PublicKey.createWithSeed(t,eo(),r)}function eo(){return"anchor:idl"}const to=$.struct([$.publicKey("authority"),$.vecU8("data")]);function no(r){return to.decode(r)}function Qe(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 Ze{static build(t,e,n){if(t.name==="_inner")throw new Ke("the _inner name is reserved");const s=(...i)=>{const[u,c]=Qe(t,[...i]);Wn(t.accounts,c.accounts),ro(t,...i);const w=s.accounts(c.accounts);return c.remainingAccounts!==void 0&&w.push(...c.remainingAccounts),Ct("debug-logs")&&console.log("Outgoing account metas:",w),new A.TransactionInstruction({keys:w,programId:n,data:e(t.name,Wi(t,...u))})};return s.accounts=i=>Ze.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 Ze.accountsArray(c,i.accounts,n,s).flat()}else{const c=i;let w;try{w=J(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,v=c.isSigner&&!l;return{pubkey:w,isWritable:d,isSigner:v}}}).flat():[]}}function ro(r,...t){}class io{static build(t,e){return(...s)=>{var i,u,c;const[,w]=Qe(t,[...s]),l=new A.Transaction;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 so{static build(t,e,n,s){return async(...u)=>{var c;const w=e(...u),[,l]=Qe(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 Ot(d,n)}}}}class oo{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 ao(t,c,n,s,e)}),u}}class ao{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??qe(),this._coder=i??new rr(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 Tt(this._provider.connection,t.map(s=>J(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 A.Buffer?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=xe.get(t.toString());if(n)return n.ee;const s=new $i;t=J(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 xe.set(t.toString(),{ee:s,listener:i}),s}async unsubscribe(t){let e=xe.get(t.toString());if(!e){console.warn("Address is not subscribed");return}xe&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{xe.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 A.SystemProgram.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 dr(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(J(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(J(t),e)}}const xe=new Map,xt="Program log: ",hr="Program data: ",co=xt.length,uo=hr.length;class lo{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new pr(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[,v]=d;v(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 pr{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new ho(t),s=new fo;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(xt)||t.startsWith(hr)){const n=t.startsWith(xt)?t.slice(co):t.slice(uo),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 fo{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 ho{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 po{static build(t,e,n,s,i,u,c){return async(...l)=>{var d;const v=e(...l),[,y]=Qe(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(v,y.signers,(d=y.options)===null||d===void 0?void 0:d.commitment)}catch(_){throw Ot(_,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 L=[];if(c.events){let _=new pr(u,i);for(const x of _.parseLogs(m))L.push(x)}return{events:L,raw:m}}}}function lt(r){return new wr(Pe(8),t=>Dt.fromBuffer(t),t=>t.toBuffer(),r)}function je(r){return new wr(Pe(32),t=>new A.PublicKey(t),t=>t.toBuffer(),r)}function dt(r,t){return new wo(r,t)}class wr extends Xe{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 wo extends Xe{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=oe()}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 Dt extends A.BN{toBuffer(){const t=super.toArray().reverse(),e=A.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=A.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new Dt([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const yo=W([je("mint"),je("owner"),lt("amount"),dt(je(),"delegate"),(r=>{const t=lr(Ns("discriminator"),null,r);return t.addVariant(0,W([]),"uninitialized"),t.addVariant(1,W([]),"initialized"),t.addVariant(2,W([]),"frozen"),t})("state"),dt(lt(),"isNative"),lt("delegatedAmount"),dt(je(),"closeAuthority")]);function go(r){return yo.decode(r)}class Te{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 mo(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&&(yr(u)?Js(s)?n[i]=this.resolveOptionalsHelper(u,s.accounts):n[i]=gr(u):u!==null?n[i]=J(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(Te.CONST_ACCOUNTS,c)&&!this.get([...e,c])&&this.set([...e,c],Te.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,A.PublicKey.findProgramAddressSync([A.Buffer.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 v=c.filter(y=>!this.get([...e,G(y)]));if(n+=v.length,v.length>0){const y=await this._accountStore.fetchAccount({publicKey:d});await Promise.all(v.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 A.PublicKey.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 A.PublicKey(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 A.Buffer.from([e]);case"u16":let n=A.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let s=A.Buffer.alloc(4);return s.writeUInt32LE(e),s;case"u64":let i=A.Buffer.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return A.Buffer.from(Zn(e));case"publicKey":return e.toBuffer();default:if(t.array)return A.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}Te.CONST_ACCOUNTS={associatedTokenProgram:Bt,rent:A.SYSVAR_RENT_PUBKEY,systemProgram:A.SystemProgram.programId,tokenProgram:Pt,clock:A.SYSVAR_CLOCK_PUBKEY};class mo{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 be.fetchIdl(t,this._provider);if(e){const n=new be(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=go(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 bo{static build(t,e,n,s,i,u,c,w,l,d,v){return(...y)=>new vo(y,s,i,u,c,w,t,e,n,l,d,v)}}function yr(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function gr(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]=yr(s)?gr(s):J(s)}return e}class vo{constructor(t,e,n,s,i,u,c,w,l,d,v,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 Te(t,this._accounts,c,w,l,d,v,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 _o{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 v=await n(...w);const y=`Program return: ${t} `;let p=v.raw.find(x=>x.startsWith(y));if(!p)throw new Error("View expected return log");let m=kt(p.slice(y.length)),L=e.returns;if(!L)throw new Error("View expected return type");return X.fieldLayout({type:L},Array.from([...(l=s.accounts)!==null&&l!==void 0?l:[],...(d=s.types)!==null&&d!==void 0?d:[]])).decode(m)}}}class Eo{static build(t,e,n,s,i){const u={},c={},w={},l={},d={},v={},y=Hn(t),p=t.accounts?oo.build(t,e,n,s):{};return t.instructions.forEach(m=>{const L=Ze.build(m,(q,B)=>e.instruction.encode(q,B),n),_=io.build(m,L),x=so.build(m,_,y,s),P=po.build(m,_,y,s,e,n,t),S=_o.build(n,m,P,t),k=bo.build(s,n,m,L,_,x,P,S,p,t.types||[],i&&i(m)),N=G(m.name);c[N]=L,w[N]=_,u[N]=x,l[N]=P,d[N]=k,S&&(v[N]=S)}),[u,c,w,p,l,d,v]}}class be{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=J(e),n||(n=qe()),this._idl=t,this._provider=n,this._programId=e,this._coder=s??new rr(t),this._events=new lo(this._programId,n,this._coder);const[u,c,w,l,d,v,y]=Eo.build(t,this._coder,e,n,i??(()=>{}));this.rpc=u,this.instruction=c,this.transaction=w,this.account=l,this.simulate=d,this.methods=v,this.views=y}static async at(t,e){const n=J(t),s=await be.fetchIdl(n,e);if(!s)throw new Error(`IDL not found for program: ${t.toString()}`);return new be(s,n,e)}static async fetchIdl(t,e){e=e??qe();const n=J(t),s=await Qs(n),i=await e.connection.getAccountInfo(s);if(!i)return null;let u=no(i.data.slice(8));const c=Ui(u.data);return JSON.parse(Gn(c))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}new A.PublicKey("11111111111111111111111111111111");exports.Program=be;exports.createReadOnlyProvider=mr;exports.distExports=$;exports.index=Ys;exports.parseIdlErrors=Hn;exports.translateError=Ot;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./web3-C1wK6wIV.js"),c=require("./index-bNUantLb.js"),d=require("./index-DfDB5FLw.js"),R=require("./index-Dq7WWqFe.js"),I=require("./unsignedTransaction-CiPKh85X.js"),G={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 E(r){return e.PublicKey.findProgramAddressSync([e.Buffer.from("redeemer")],new e.PublicKey(r))[0]}function V(r,i){const t=e.Buffer.alloc(8);return t.writeBigUInt64LE(i),e.PublicKey.findProgramAddressSync([e.Buffer.from("msg"),t],new e.PublicKey(r))[0]}function U(r,i){const t=e.Buffer.alloc(2);return t.writeUInt16LE(e.toChainId(i)),e.PublicKey.findProgramAddressSync([e.Buffer.from("gateway-info"),t],new e.PublicKey(r))[0]}const T=new e.PublicKey("Gj93RRt6QB7FjmyokAD5rcMAku7pq3Fk2Aa8y6nNbwsV");function D(){return e.PublicKey.findProgramAddressSync([e.Buffer.from("config")],T)[0]}function _(r){return e.PublicKey.findProgramAddressSync([e.Buffer.from("minter-info"),r.toBuffer()],T)[0]}const B=new e.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new e.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const b=new e.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new e.PublicKey("So11111111111111111111111111111111111111112");new e.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");class F extends Error{constructor(i){super(i)}}class z extends F{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const Y=e.LayoutExports.struct([e.LayoutExports.u32("mintAuthorityOption"),e.publicKey("mintAuthority"),e.u64("supply"),e.LayoutExports.u8("decimals"),e.bool("isInitialized"),e.LayoutExports.u32("freezeAuthorityOption"),e.publicKey("freezeAuthority")]);Y.span;async function M(r,i,t=!1,a=B,n=b){if(!t&&!e.PublicKey.isOnCurve(i.toBuffer()))throw new z;const[s]=await e.PublicKey.findProgramAddress([i.toBuffer(),a.toBuffer(),r.toBuffer()],n);return s}function H(r,i,t,a,n=B,s=b){return Z(r,i,t,a,e.Buffer.alloc(0),n,s)}function Z(r,i,t,a,n,s=B,o=b){const u=[{pubkey:r,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1},{pubkey:e.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new e.TransactionInstruction({keys:u,programId:o,data:n})}class h{network;chain;connection;contracts;gateway;tokenBridgeId;coreBridgeId;constructor(i,t,a,n){if(this.network=i,this.chain=t,this.connection=a,this.contracts=n,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 R.Program(G,this.contracts.tbtc,{connection:a}),this.tokenBridgeId=new e.PublicKey(this.contracts.tokenBridge),this.coreBridgeId=new e.PublicKey(this.contracts.coreBridge)}static async fromRpc(i,t){const[a,n]=await I.SolanaPlatform.chainFromRpc(i),s=t[n];if(s.network!==a)throw new Error(`Network mismatch: ${s.network} != ${a}`);return new h(a,n,i,s.contracts)}async*transfer(i,t,a){const n=new e.SolanaAddress(i).unwrap(),s=E(this.gateway.programId),{tbtcMint:o,wrappedTbtcToken:u,wrappedTbtcMint:g}=await this.gateway.account.custodian.fetch(s),p=d.deriveWrappedMetaKey(this.tokenBridgeId,g),m=d.deriveTokenBridgeConfigKey(this.tokenBridgeId),l=d.deriveAuthoritySignerKey(this.tokenBridgeId),A=c.deriveFeeCollectorKey(this.coreBridgeId),{sequence:y}=await c.getProgramSequenceTracker(this.connection,this.tokenBridgeId,this.coreBridgeId),w=V(this.gateway.programId,y),S=c.deriveWormholeBridgeDataKey(this.coreBridgeId),f=c.deriveWormholeEmitterKey(this.tokenBridgeId),k=c.deriveEmitterSequenceKey(f,this.coreBridgeId),K=U(this.gateway.programId,t.chain),x=d.deriveSenderAccountKey(this.gateway.programId),P={amount:new e.bnExports.BN(a.toString()),recipientChain:e.toChainId(t.chain),recipient:[...t.address.toUniversalAddress().toUint8Array()],nonce:0},W=await M(o,n),v=e.tbtc.get(this.network,t.chain),C={custodian:s,wrappedTbtcToken:u,wrappedTbtcMint:g,tbtcMint:o,senderToken:W,sender:n,tokenBridgeConfig:m,tokenBridgeWrappedAsset:p,tokenBridgeTransferAuthority:l,coreBridgeData:S,coreMessage:w,tokenBridgeCoreEmitter:f,coreEmitterSequence:k,coreFeeCollector:A,clock:e.SYSVAR_CLOCK_PUBKEY,rent:e.SYSVAR_RENT_PUBKEY,tokenBridgeProgram:this.tokenBridgeId,coreBridgeProgram:this.coreBridgeId},N=v?await this.gateway.methods.sendTbtcGateway({...P}).accounts({...C,gatewayInfo:K,tokenBridgeSender:x}).instruction():await this.gateway.methods.sendTbtcWrapped({...P,arbiterFee:new e.bnExports.BN(0)}).accounts(C).instruction(),{blockhash:L}=await this.connection.getLatestBlockhash(),q=e.MessageV0.compile({instructions:[N],payerKey:n,recentBlockhash:L}),O=new e.VersionedTransaction(q);yield this.createUnsignedTransaction({transaction:O},"TBTCBridge.Send")}async*redeem(i,t){if(t.payloadName!=="GatewayTransfer")throw new Error("Invalid VAA payload");yield*new c.SolanaWormholeCore(this.network,this.chain,this.connection,this.contracts).postVaa(i,t);const n=[],s=new e.SolanaAddress(i).unwrap(),o=t.payload.payload.recipient.toNative(this.chain).unwrap(),u=E(this.gateway.programId),{tbtcMint:g,wrappedTbtcToken:p,wrappedTbtcMint:m}=await this.gateway.account.custodian.fetch(u),l=await M(g,o);await this.connection.getAccountInfo(l)||n.push(H(s,l,o,g));const y=d.deriveWrappedMetaKey(this.tokenBridgeId,m),w=await M(m,o);n.push(await this.gateway.methods.receiveTbtc([...t.hash]).accounts({payer:s,custodian:u,postedVaa:c.derivePostedVaaKey(this.coreBridgeId,e.Buffer.from(t.hash)),tokenBridgeClaim:c.deriveClaimKey(this.tokenBridgeId,t.emitterAddress.toUint8Array(),e.toChainId(t.emitterChain),t.sequence),wrappedTbtcToken:p,wrappedTbtcMint:m,tbtcMint:g,recipientToken:l,recipient:o,recipientWrappedToken:w,tbtcConfig:D(),tbtcMinterInfo:_(u),tokenBridgeConfig:d.deriveTokenBridgeConfigKey(this.tokenBridgeId),tokenBridgeRegisteredEmitter:d.deriveEndpointKey(this.tokenBridgeId,e.toChainId(t.emitterChain),t.emitterAddress.toUint8Array()),tokenBridgeWrappedAsset:y,tokenBridgeMintAuthority:d.deriveMintAuthorityKey(this.tokenBridgeId),rent:e.SYSVAR_RENT_PUBKEY,tbtcProgram:T,tokenBridgeProgram:this.tokenBridgeId,coreBridgeProgram:this.coreBridgeId}).instruction());const{blockhash:S}=await this.connection.getLatestBlockhash(),f=e.MessageV0.compile({instructions:n,payerKey:s,recentBlockhash:S}),k=new e.VersionedTransaction(f);yield this.createUnsignedTransaction({transaction:k},"TBTCBridge.Send")}createUnsignedTransaction(i,t){return new I.SolanaUnsignedTransaction(i,this.network,this.chain,t,!1)}}e.registerProtocol(e._platform$1,"TBTCBridge",h);exports.SolanaTBTCBridge=h;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./web3-BKaP497Y.js"),c=require("./index-CjjP3Qp5.js"),d=require("./index-ClMpLrxa.js"),R=require("./index-B7HBnPLP.js"),I=require("./unsignedTransaction-DL3WyIkF.js"),G={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 E(r){return e.PublicKey.findProgramAddressSync([e.Buffer.from("redeemer")],new e.PublicKey(r))[0]}function V(r,i){const t=e.Buffer.alloc(8);return t.writeBigUInt64LE(i),e.PublicKey.findProgramAddressSync([e.Buffer.from("msg"),t],new e.PublicKey(r))[0]}function U(r,i){const t=e.Buffer.alloc(2);return t.writeUInt16LE(e.toChainId(i)),e.PublicKey.findProgramAddressSync([e.Buffer.from("gateway-info"),t],new e.PublicKey(r))[0]}const T=new e.PublicKey("Gj93RRt6QB7FjmyokAD5rcMAku7pq3Fk2Aa8y6nNbwsV");function D(){return e.PublicKey.findProgramAddressSync([e.Buffer.from("config")],T)[0]}function _(r){return e.PublicKey.findProgramAddressSync([e.Buffer.from("minter-info"),r.toBuffer()],T)[0]}const B=new e.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");new e.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");const b=new e.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new e.PublicKey("So11111111111111111111111111111111111111112");new e.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");class F extends Error{constructor(i){super(i)}}class z extends F{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}const Y=e.LayoutExports.struct([e.LayoutExports.u32("mintAuthorityOption"),e.publicKey("mintAuthority"),e.u64("supply"),e.LayoutExports.u8("decimals"),e.bool("isInitialized"),e.LayoutExports.u32("freezeAuthorityOption"),e.publicKey("freezeAuthority")]);Y.span;async function M(r,i,t=!1,a=B,n=b){if(!t&&!e.PublicKey.isOnCurve(i.toBuffer()))throw new z;const[s]=await e.PublicKey.findProgramAddress([i.toBuffer(),a.toBuffer(),r.toBuffer()],n);return s}function H(r,i,t,a,n=B,s=b){return Z(r,i,t,a,e.Buffer.alloc(0),n,s)}function Z(r,i,t,a,n,s=B,o=b){const u=[{pubkey:r,isSigner:!0,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!1},{pubkey:a,isSigner:!1,isWritable:!1},{pubkey:e.SystemProgram.programId,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!1,isWritable:!1}];return new e.TransactionInstruction({keys:u,programId:o,data:n})}class h{network;chain;connection;contracts;gateway;tokenBridgeId;coreBridgeId;constructor(i,t,a,n){if(this.network=i,this.chain=t,this.connection=a,this.contracts=n,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 R.Program(G,this.contracts.tbtc,{connection:a}),this.tokenBridgeId=new e.PublicKey(this.contracts.tokenBridge),this.coreBridgeId=new e.PublicKey(this.contracts.coreBridge)}static async fromRpc(i,t){const[a,n]=await I.SolanaPlatform.chainFromRpc(i),s=t[n];if(s.network!==a)throw new Error(`Network mismatch: ${s.network} != ${a}`);return new h(a,n,i,s.contracts)}async*transfer(i,t,a){const n=new e.SolanaAddress(i).unwrap(),s=E(this.gateway.programId),{tbtcMint:o,wrappedTbtcToken:u,wrappedTbtcMint:g}=await this.gateway.account.custodian.fetch(s),p=d.deriveWrappedMetaKey(this.tokenBridgeId,g),m=d.deriveTokenBridgeConfigKey(this.tokenBridgeId),l=d.deriveAuthoritySignerKey(this.tokenBridgeId),A=c.deriveFeeCollectorKey(this.coreBridgeId),{sequence:y}=await c.getProgramSequenceTracker(this.connection,this.tokenBridgeId,this.coreBridgeId),w=V(this.gateway.programId,y),S=c.deriveWormholeBridgeDataKey(this.coreBridgeId),f=c.deriveWormholeEmitterKey(this.tokenBridgeId),k=c.deriveEmitterSequenceKey(f,this.coreBridgeId),K=U(this.gateway.programId,t.chain),x=d.deriveSenderAccountKey(this.gateway.programId),P={amount:new e.bnExports.BN(a.toString()),recipientChain:e.toChainId(t.chain),recipient:[...t.address.toUniversalAddress().toUint8Array()],nonce:0},W=await M(o,n),v=e.tbtc.get(this.network,t.chain),C={custodian:s,wrappedTbtcToken:u,wrappedTbtcMint:g,tbtcMint:o,senderToken:W,sender:n,tokenBridgeConfig:m,tokenBridgeWrappedAsset:p,tokenBridgeTransferAuthority:l,coreBridgeData:S,coreMessage:w,tokenBridgeCoreEmitter:f,coreEmitterSequence:k,coreFeeCollector:A,clock:e.SYSVAR_CLOCK_PUBKEY,rent:e.SYSVAR_RENT_PUBKEY,tokenBridgeProgram:this.tokenBridgeId,coreBridgeProgram:this.coreBridgeId},N=v?await this.gateway.methods.sendTbtcGateway({...P}).accounts({...C,gatewayInfo:K,tokenBridgeSender:x}).instruction():await this.gateway.methods.sendTbtcWrapped({...P,arbiterFee:new e.bnExports.BN(0)}).accounts(C).instruction(),{blockhash:L}=await this.connection.getLatestBlockhash(),q=e.MessageV0.compile({instructions:[N],payerKey:n,recentBlockhash:L}),O=new e.VersionedTransaction(q);yield this.createUnsignedTransaction({transaction:O},"TBTCBridge.Send")}async*redeem(i,t){if(t.payloadName!=="GatewayTransfer")throw new Error("Invalid VAA payload");yield*new c.SolanaWormholeCore(this.network,this.chain,this.connection,this.contracts).postVaa(i,t);const n=[],s=new e.SolanaAddress(i).unwrap(),o=t.payload.payload.recipient.toNative(this.chain).unwrap(),u=E(this.gateway.programId),{tbtcMint:g,wrappedTbtcToken:p,wrappedTbtcMint:m}=await this.gateway.account.custodian.fetch(u),l=await M(g,o);await this.connection.getAccountInfo(l)||n.push(H(s,l,o,g));const y=d.deriveWrappedMetaKey(this.tokenBridgeId,m),w=await M(m,o);n.push(await this.gateway.methods.receiveTbtc([...t.hash]).accounts({payer:s,custodian:u,postedVaa:c.derivePostedVaaKey(this.coreBridgeId,e.Buffer.from(t.hash)),tokenBridgeClaim:c.deriveClaimKey(this.tokenBridgeId,t.emitterAddress.toUint8Array(),e.toChainId(t.emitterChain),t.sequence),wrappedTbtcToken:p,wrappedTbtcMint:m,tbtcMint:g,recipientToken:l,recipient:o,recipientWrappedToken:w,tbtcConfig:D(),tbtcMinterInfo:_(u),tokenBridgeConfig:d.deriveTokenBridgeConfigKey(this.tokenBridgeId),tokenBridgeRegisteredEmitter:d.deriveEndpointKey(this.tokenBridgeId,e.toChainId(t.emitterChain),t.emitterAddress.toUint8Array()),tokenBridgeWrappedAsset:y,tokenBridgeMintAuthority:d.deriveMintAuthorityKey(this.tokenBridgeId),rent:e.SYSVAR_RENT_PUBKEY,tbtcProgram:T,tokenBridgeProgram:this.tokenBridgeId,coreBridgeProgram:this.coreBridgeId}).instruction());const{blockhash:S}=await this.connection.getLatestBlockhash(),f=e.MessageV0.compile({instructions:n,payerKey:s,recentBlockhash:S}),k=new e.VersionedTransaction(f);yield this.createUnsignedTransaction({transaction:k},"TBTCBridge.Send")}createUnsignedTransaction(i,t){return new I.SolanaUnsignedTransaction(i,this.network,this.chain,t,!1)}}e.registerProtocol(e._platform$1,"TBTCBridge",h);exports.SolanaTBTCBridge=h;
|