@sentio/sdk-bundle 2.41.4 → 2.41.5

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.
Files changed (67) hide show
  1. package/lib/aptos/builtin/0x1.js +1 -1
  2. package/lib/aptos/builtin/0x3.js +1 -1
  3. package/lib/aptos/builtin/index.js +1 -1
  4. package/lib/aptos/ext/index.js +1 -1
  5. package/lib/aptos/index.js +1 -1
  6. package/lib/btc/index.js +1 -1
  7. package/lib/{chunk-SDJOH3KH.js → chunk-3C4YSA42.js} +2 -2
  8. package/lib/{chunk-QRNQPRH4.js → chunk-3KK6D6YO.js} +2 -2
  9. package/lib/{chunk-7IA5RTOB.js → chunk-4ACVSPIF.js} +2 -2
  10. package/lib/{chunk-GPETITBA.js → chunk-4QS3NUUW.js} +2 -2
  11. package/lib/{chunk-WL4SNWT6.js → chunk-BVDLKPY7.js} +2 -2
  12. package/lib/{chunk-63HPJECU.js → chunk-CJVPUD6U.js} +2 -2
  13. package/lib/{chunk-5WEQ4PSE.js → chunk-CSVBDVD7.js} +2 -2
  14. package/lib/{chunk-JGYBNJHX.js → chunk-JTQMVYTS.js} +9 -9
  15. package/lib/{chunk-JGYBNJHX.js.map → chunk-JTQMVYTS.js.map} +1 -1
  16. package/lib/{chunk-KY7NG4ER.js → chunk-KY5AFKV5.js} +2 -2
  17. package/lib/{chunk-RYFT36S5.js → chunk-LCUGDGMN.js} +2 -2
  18. package/lib/{chunk-5WM5D6EI.js → chunk-MGIOFRXM.js} +2 -2
  19. package/lib/{chunk-R7S4ZNCQ.js → chunk-PSYYSAEX.js} +2 -2
  20. package/lib/{chunk-EL6CQHDY.js → chunk-RDBX2EIJ.js} +2 -2
  21. package/lib/{chunk-SPZVAGFS.js → chunk-VEVTWG5S.js} +2 -2
  22. package/lib/{chunk-G6D6EDWO.js → chunk-VM5J6G66.js} +2 -2
  23. package/lib/{chunk-T5A3YPP2.js → chunk-X7K74U6O.js} +2 -2
  24. package/lib/{chunk-WGFT7DSU.js → chunk-XYISSQEU.js} +2 -2
  25. package/lib/{chunk-IQNZE4RM.js → chunk-XZRRBRMQ.js} +2 -2
  26. package/lib/core/index.js +1 -1
  27. package/lib/eth/builtin/eacaggregatorproxy.js +1 -1
  28. package/lib/eth/builtin/erc1155.js +1 -1
  29. package/lib/eth/builtin/erc20.js +1 -1
  30. package/lib/eth/builtin/erc721.js +1 -1
  31. package/lib/eth/builtin/index.js +1 -1
  32. package/lib/eth/builtin/weth9.js +1 -1
  33. package/lib/eth/codegen/index.js +1 -1
  34. package/lib/eth/index.js +1 -1
  35. package/lib/fuel/index.js +1 -1
  36. package/lib/index.js +1 -1
  37. package/lib/move/index.js +1 -1
  38. package/lib/solana/builtin/index.js +1 -1
  39. package/lib/solana/index.js +1 -1
  40. package/lib/stark/index.js +1 -1
  41. package/lib/store/index.js +1 -1
  42. package/lib/sui/builtin/0x1.js +1 -1
  43. package/lib/sui/builtin/0x2.js +1 -1
  44. package/lib/sui/builtin/0x3.js +1 -1
  45. package/lib/sui/builtin/index.js +1 -1
  46. package/lib/sui/ext/index.js +1 -1
  47. package/lib/sui/index.js +1 -1
  48. package/lib/testing/index.js +1 -1
  49. package/lib/utils/index.js +1 -1
  50. package/package.json +2 -2
  51. /package/lib/{chunk-SDJOH3KH.js.map → chunk-3C4YSA42.js.map} +0 -0
  52. /package/lib/{chunk-QRNQPRH4.js.map → chunk-3KK6D6YO.js.map} +0 -0
  53. /package/lib/{chunk-7IA5RTOB.js.map → chunk-4ACVSPIF.js.map} +0 -0
  54. /package/lib/{chunk-GPETITBA.js.map → chunk-4QS3NUUW.js.map} +0 -0
  55. /package/lib/{chunk-WL4SNWT6.js.map → chunk-BVDLKPY7.js.map} +0 -0
  56. /package/lib/{chunk-63HPJECU.js.map → chunk-CJVPUD6U.js.map} +0 -0
  57. /package/lib/{chunk-5WEQ4PSE.js.map → chunk-CSVBDVD7.js.map} +0 -0
  58. /package/lib/{chunk-KY7NG4ER.js.map → chunk-KY5AFKV5.js.map} +0 -0
  59. /package/lib/{chunk-RYFT36S5.js.map → chunk-LCUGDGMN.js.map} +0 -0
  60. /package/lib/{chunk-5WM5D6EI.js.map → chunk-MGIOFRXM.js.map} +0 -0
  61. /package/lib/{chunk-R7S4ZNCQ.js.map → chunk-PSYYSAEX.js.map} +0 -0
  62. /package/lib/{chunk-EL6CQHDY.js.map → chunk-RDBX2EIJ.js.map} +0 -0
  63. /package/lib/{chunk-SPZVAGFS.js.map → chunk-VEVTWG5S.js.map} +0 -0
  64. /package/lib/{chunk-G6D6EDWO.js.map → chunk-VM5J6G66.js.map} +0 -0
  65. /package/lib/{chunk-T5A3YPP2.js.map → chunk-X7K74U6O.js.map} +0 -0
  66. /package/lib/{chunk-WGFT7DSU.js.map → chunk-XYISSQEU.js.map} +0 -0
  67. /package/lib/{chunk-IQNZE4RM.js.map → chunk-XZRRBRMQ.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{a as Te}from"./chunk-SDJOH3KH.js";import{a as Oe,b as Ie}from"./chunk-QCAKDU3Q.js";import{a as Ce,b as be,c as Se,d as ve,f as C,g as w}from"./chunk-ZDHGKRIS.js";import{d as Q,e as ge}from"./chunk-7IA5RTOB.js";import{a as T,d as pe,f as fe,m as he,n as k,o as Z,x as me}from"./chunk-KBIQLRRR.js";import{a as ye}from"./chunk-7HVQTJAO.js";import{D as h,Hc as $,W as de,fa as le,gd as ue,pc as V,x as L,za as I}from"./chunk-JGYBNJHX.js";import{e as F,g as O}from"./chunk-LLHU72AA.js";import{ListStateStorage as Me,mergeProcessResults as Ae}from"@sentio/runtime";var u=F($(),1);var x=class extends me{bcs=new Ce(be());constructor(e){super(new Ie(e))}load(e,t){let n=this.moduleMapping.get(e.address+"::"+e.name),r=this.moduleMapping.get(t+"::"+e.name);return n&&r||(n=Oe(e),this.loadInternal(n,t)),n}async decode(e,t){switch(t.qname){case"0x1::ascii::Char":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).byte;return String.fromCharCode(r)}case"0x1::ascii::String":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).bytes;return new TextDecoder().decode(new Uint8Array(r))}case"0x2::object::ID":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).bytes;return ve(r)}case"0x2::url::Url":if(e!==void 0&&typeof e!="string")return(await super.decode(e,t)).url;case"0x2::coin::Coin":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).id.id.bytes;return new TextDecoder().decode(new Uint8Array(r))}return e;case"0x2::balance::Balance":return e.value?(await super.decode(e,t)).value:BigInt(e);case"0x1::option::Option":if(e===null)return e;if(e.vec){let r=await super.decode(e,t);return r=r.vec,r.length===0?null:r[0]}return this.decode(e,t.typeArgs[0]);case"Address":return Se(e);case"0x1::string::String":if(typeof e!="string")return new TextDecoder().decode(new Uint8Array(e.bytes));default:return super.decode(e,t)}}decodeEvent(e){return this.decodedStruct(e)}filterAndDecodeEvents(e,t){return typeof e=="string"&&(e=k(e)),this.filterAndDecodeStruct(e,t)}async getDynamicFields(e,t=Z,n=Z){let r=new he("0x2::dynamic_field::Field");return r.typeArgs=[t,n],(await this.filterAndDecodeObjects(r,e)).map(s=>s.data_decoded)}filterAndDecodeObjects(e,t){return this.filterAndDecodeStruct(e,t)}async decodeFunctionPayload(e,t){let n=[e.package,e.module,e.function].join(T),r=await this.getMoveFunction(n),o=this.adapter.getMeaningfulFunctionParams(r.params),s=[];for(let i of e.arguments||[]){let l=i;if("Input"in l){let g=l.Input,p=t[g];p.type==="pure"?s.push(p.value):(p.type==="object"||console.error("unexpected function arg value"),s.push(void 0))}else s.push(void 0)}let a=await this.decodeArray(s,o,!1);return{...e,arguments_decoded:a}}async _registerBCSType(e){if(this.bcs.hasType(e))return;let t=await this.getMoveStruct(e),n={};for(let s of t.fields)n[s.name]=s.type.getNormalizedSignature();let r=e,o=t.typeParams.map((s,a)=>"T"+a).join(", ");o&&(r=r+"<"+o+">"),this.bcs.registerStructType(r,n);for(let s of t.fields)await this.registerBCSTypes(s.type)}bcsRegistered=new Set;async registerBCSTypes(e){let t=e.getNormalizedSignature();if(!this.bcsRegistered.has(t)){this.bcsRegistered.add(t),await this._registerBCSType("0x1::string::String");for(let n of e.dependedTypes())await this._registerBCSType(n)}}async decodeBCS(e,t,n){return await this.registerBCSTypes(e),this.bcs.de(e.getNormalizedSignature(),t,n)}async decodeDevInspectResult(e){let t=[];if(e.results!=null)for(let n of e.results)if(n.returnValues)for(let r of n.returnValues){let o=k(r[1]),s=await this.decodeBCS(o,new Uint8Array(r[0])),a=await this.decodedType(s,o);t.push(a)}else t.push(null);return{...e,results_decoded:t}}};var we=new Map;function j(c=C.MAIN_NET){let e=we.get(c);return e||(e=new x(w(c)),we.set(c,e)),e}var f=class extends Q{moduleName;timestamp;checkpoint;transaction;eventIndex;coder;constructor(e,t,n,r,o,s,a,i){super(i),this.address=n.toLowerCase(),this.network=t,this.moduleName=e,this.timestamp=r,this.checkpoint=o,this.eventIndex=a,this.coder=j(t),s&&(this.transaction=s)}getChainId(){return this.network}getTimestamp(){return this.timestamp.getDate()}getMetaDataInternal(e,t){return{address:this.address,contractName:this.moduleName,blockNumber:this.checkpoint,transactionIndex:0,transactionHash:this.transaction?.digest||"",logIndex:this.eventIndex,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}},U=class extends Q{timestamp;checkpoint;coder;txDigest;constructor(e,t,n,r,o,s){super(s),this.address=t,this.network=e,this.timestamp=n,this.checkpoint=r,this.txDigest=o,this.coder=j(e)}getChainId(){return this.network}getTimestamp(){return this.timestamp.getDate()}getMetaDataInternal(e,t){return{address:this.address,contractName:"*",blockNumber:this.checkpoint,transactionIndex:-1,transactionHash:this.txDigest,logIndex:0,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}},X=class extends ge{address;network;checkpoint;timestamp;coder;contractName="address";constructor(e,t,n,r,o){super(o),this.address=t,this.network=e,this.checkpoint=n,this.timestamp=r,this.coder=j(e)}getChainId(){return this.network}getMetaDataInternal(e,t){return{address:this.address,contractName:this.contractName,blockNumber:this.checkpoint,transactionIndex:0,transactionHash:"",logIndex:0,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}getTimestamp(){return this.timestamp.getDate()}},G=class extends X{contractName="object";objectId;constructor(e,t,n,r,o){super(e,t,n,r,o),this.objectId=t}};function xe(c){let e=c.transaction?.data.transaction;if(!e)return[];let t=e.kind==="ProgrammableTransaction"?e:void 0;return t?t.transactions.flatMap(n=>{if("MoveCall"in n){let r=n.MoveCall;return r.package=pe(r.package),[r]}return[]}):[]}var P={resourceChanges:!1,allEvents:!1,inputs:!1};function q(c){return{startCheckpoint:c.startCheckpoint||0n,address:c.address==="*"?"*":fe(c.address),network:c.network||C.MAIN_NET,baseLabels:c.baseLabels}}var ee=class extends Me{},y=ee;O(y,"INSTANCE",new ee);var E=class{moduleName;config;eventHandlers=[];callHandlers=[];objectChangeHandlers=[];coder;constructor(e,t){this.moduleName=e,this.config=q(t),y.INSTANCE.addValue(this),this.coder=j(this.config.network)}getChainId(){return this.config.network}onMoveEvent(e,t,n){let r=[],o=I.fromPartial({...P,...n});Array.isArray(t)?r=t:r.push(t);let s=this,a=new Set(r.map(i=>i.type));return this.eventHandlers.push({handler:async function(i){if(!i.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"event is null");let l=i.transaction;if(!l.events||!l.events.length)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"no event in the transactions");let g=[];for(let p of l.events){let A=Number(p.id.eventSeq)||0,[ce,N,Y]=k(p.type).qname.split(T);if(!a.has([N,Y].join(T)))continue;let _=new f(s.moduleName,s.config.network,s.config.address,i.timestamp||new Date(0),i.slot,l,A,s.config.baseLabels),je=await s.coder.decodeEvent(p);await e(je||p,_),g.push(_.stopAndGetResult())}return Ae(g)},filters:r,fetchConfig:o}),this}onEntryFunctionCall(e,t,n){let r=[],o=I.fromPartial({...P,...n});Array.isArray(t)?r=t:r.push(t);let s=this,a=new Set(r.map(i=>i.function));return this.callHandlers.push({handler:async function(i){if(!i.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"call is null");let l=i.transaction,g=new f(s.moduleName,s.config.network,s.config.address,i.timestamp||new Date(0),i.slot,l,0,s.config.baseLabels);if(l){let p=xe(l),A=l.transaction?.data?.transaction;if(!A)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"Unexpected getTransactionKind get empty");let ce=A.kind==="ProgrammableTransaction"?A:void 0;for(let N of p){let Y=[N.module,N.function].join(T);if(!a.has(Y))continue;let _=await s.coder.decodeFunctionPayload(N,ce?.inputs||[]);await e(_,g)}}return g.stopAndGetResult()},filters:r,fetchConfig:o}),this}onEvent(e,t){return this.onMoveEvent(e,{type:""},t),this}onTransactionBlock(e,t,n){let r=I.fromPartial({...P,...n}),o=this;return this.callHandlers.push({handler:async function(s){if(!s.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"transaction is null");let a=s.transaction,i=new f(o.moduleName,o.config.network,o.config.address,s.timestamp||new Date(0),s.slot,a,0,o.config.baseLabels);return a&&await e(a,i),i.stopAndGetResult()},filters:[{...t,function:""}],fetchConfig:r}),this}onObjectChange(e,t){if(this.config.network===C.TEST_NET)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"object change not supported in testnet");let n=this;return this.objectChangeHandlers.push({handler:async function(r){let o=new U(n.config.network,n.config.address,r.timestamp||new Date(0),r.slot,r.txDigest,n.config.baseLabels);return await e(r.changes,o),o.stopAndGetResult()},type:t}),this}},D=class extends E{static bind(e){return new D("*",e)}},H=class extends E{static bind(e){return new H("*",{...e,address:"*"})}onTransactionBlock(e,t,n){return super.onTransactionBlock(e,t,n)}onObjectChange(e,t){return super.onObjectChange(e,t)}};import{ListStateStorage as Ne}from"@sentio/runtime";var z=F($(),1);var te={owned:!1},ne=class extends Ne{},M=ne;O(M,"INSTANCE",new ne);var R=class{config;ownerType;objectHandlers=[];constructor(e){this.config=q(e),this.ownerType=e.ownerType,M.INSTANCE.addValue(this)}getChainId(){return this.config.network}onInterval(e,t,n,r,o){let s=this;return this.objectHandlers.push({handler:async function(a){let i=new G(s.config.network,s.config.address,a.slot,a.timestamp||new Date(0),s.config.baseLabels);return await s.doHandle(e,a,i),i.stopAndGetResult()},timeIntervalInMinutes:t,checkPointInterval:n,type:r,fetchConfig:{...te,...o}}),this}onTimeInterval(e,t=60,n=240,r,o){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0,r,o)}onCheckpointInterval(e,t=1e5,n=4e5,r,o){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n},r,o)}},m=class extends R{callHandlers=[];static bind(e){return new m({...e,ownerType:L.ADDRESS})}doHandle(e,t,n){return e(t.objects,n)}onTransactionBlock(e,t,n){let r=I.fromPartial({...P,...n}),o={fromAndToAddress:{from:"",to:this.config.address},...t},s=this;return this.callHandlers.push({handler:async function(a){if(!a.transaction)throw new z.ServerError(z.Status.INVALID_ARGUMENT,"transaction is null");let i=a.transaction,l=new f("object",s.config.network,s.config.address,a.timestamp||new Date(0),a.slot,i,0,s.config.baseLabels);return i&&await e(i,l),l.stopAndGetResult()},filters:[{...o,function:""}],fetchConfig:r}),this}},b=class extends R{static bind(e){return new b({address:e.objectId,network:e.network,startCheckpoint:e.startCheckpoint,ownerType:L.OBJECT,baseLabels:e.baseLabels})}doHandle(e,t,n){if(!t.self){console.log(`Sui object not existed in ${n.checkpoint}, please specific a start time`);return}return e(t.self,t.objects,n)}},S=class extends R{static bind(e){return new S({address:e.objectId,network:e.network,startCheckpoint:e.startCheckpoint,ownerType:L.WRAPPED_OBJECT,baseLabels:e.baseLabels})}doHandle(e,t,n){return e(t.objects,n)}};import{ListStateStorage as ke}from"@sentio/runtime";var ie=class extends ke{},v=ie;O(v,"INSTANCE",new ie);var B=class{id;objectHandlers=[];binds=new Set;constructor(){this.id=v.INSTANCE.getValues().length,v.INSTANCE.addValue(this)}bind(e,t){e.network=e.network||t.network,e.startCheckpoint=e.startCheckpoint||t.checkpoint;let n=e.objectId||e.address,r=[e.network,n].join("_");if(this.binds.has(r)){console.log(`Same object id can be bind to one template only once, ignore duplicate bind: ${r}`);return}this.binds.add(r);let o=this.createProcessor(e);for(let a of this.objectHandlers)o.onInterval(a.handler,a.timeIntervalInMinutes,a.checkpointInterval,a.type,a.fetchConfig);let s=o.config;t.update({states:{configUpdated:!0}}),ue.INSTANCE.addValue({templateId:this.id,contract:{name:"",chainId:s.network,address:s.address,abi:""},startBlock:s.startCheckpoint,endBlock:0n,baseLabels:s.baseLabels})}onInterval(e,t,n,r,o){return this.objectHandlers.push({handler:e,timeIntervalInMinutes:t,checkpointInterval:n,type:r,fetchConfig:{...te,...o}}),this}onTimeInterval(e,t=60,n=240,r,o){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0,r,o)}onCheckpointInterval(e,t=1e5,n=4e5,r,o){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n},r,o)}};var re=class extends B{handlers=[];createProcessor(e){let t=m.bind(e);for(let n of this.handlers)t.onTransactionBlock(n.handler,n.filter,n.fetchConfig);return t}onTransactionBlock(e,t,n){return this.handlers.push({handler:e,filter:t,fetchConfig:n}),this}},oe=class extends B{createProcessor(e){return b.bind(e)}},se=class extends B{createProcessor(e){return S.bind(e)}};import{errorString as J,mergeProcessResults as K,Plugin as Pe,PluginManager as Ee,USER_PROCESSOR as De}from"@sentio/runtime";var d=F($(),1);var ae=F(ye(),1);var W=class extends Pe{name="SuiPlugin";handlers={suiCallHandlers:[],suiEventHandlers:[],suiObjectHandlers:[],suiObjectChangeHandlers:[]};async start(e){await Te(),console.log("total instances:",e.templateInstances.length);let t=new Set(Object.values(ae.SuiChainId));for(let n of e.templateInstances){if(!t.has(n.contract?.chainId||""))continue;console.log("start template instance",n.templateId),v.INSTANCE.getValues()[n.templateId].bind({address:n.contract?.address||"",objectId:n.contract?.address||"",network:n.contract?.chainId||C.MAIN_NET,startCheckpoint:n.startBlock||0n,baseLabels:n.baseLabels},He)}}async configure(e){let t={suiCallHandlers:[],suiEventHandlers:[],suiObjectHandlers:[],suiObjectChangeHandlers:[]};for(let n of y.INSTANCE.getValues()){let r=de.fromPartial({transactionConfig:[],processorType:De,contract:{name:n.moduleName,chainId:n.config.network,address:n.config.address,abi:""},startBlock:n.config.startCheckpoint});for(let o of n.eventHandlers){let s=t.suiEventHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({type:i.type,account:i.account||""})),fetchConfig:o.fetchConfig,handlerId:s};r.moveEventConfigs.push(a)}for(let o of n.callHandlers){let s=t.suiCallHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({function:i.function,typeArguments:i.typeArguments||[],withTypeArguments:!!i.typeArguments,includeFailed:i.includeFailed||!1,publicKeyPrefix:i.publicKeyPrefix||"",fromAndToAddress:i.fromAndToAddress})),fetchConfig:o.fetchConfig,handlerId:s};r.moveCallConfigs.push(a)}for(let o of n.objectChangeHandlers){let s=t.suiObjectChangeHandlers.push(o.handler)-1,a={type:o.type,handlerId:s};r.moveResourceChangeConfigs.push(a)}e.contractConfigs.push(r)}for(let n of M.INSTANCE.getValues()){let r=le.fromPartial({address:n.config.address,chainId:n.getChainId(),startBlock:n.config.startCheckpoint});for(let o of n.objectHandlers){let s=t.suiObjectHandlers.push(o.handler)-1;r.moveIntervalConfigs.push({intervalConfig:{handlerId:s,minutes:0,minutesInterval:o.timeIntervalInMinutes,slot:0,slotInterval:o.checkPointInterval,fetchConfig:void 0},type:o.type||"",ownerType:n.ownerType,fetchConfig:o.fetchConfig})}if(n instanceof m)for(let o of n.callHandlers){let s=t.suiCallHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({function:i.function,typeArguments:i.typeArguments||[],withTypeArguments:!!i.typeArguments,includeFailed:i.includeFailed||!1,publicKeyPrefix:i.publicKeyPrefix||"",fromAndToAddress:i.fromAndToAddress})),fetchConfig:o.fetchConfig,handlerId:s};r.moveCallConfigs.push(a)}e.accountConfigs.push(r)}this.handlers=t}async processSuiEvent(e){if(!e.data?.suiEvent)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Event can't be empty");let t=[],n=e.data.suiEvent;for(let r of e.handlerIds)t.push(this.handlers.suiEventHandlers[r](n).catch(o=>{throw new d.ServerError(d.Status.INTERNAL,"error processing event: "+JSON.stringify(n)+`
2
+ import{a as Te}from"./chunk-3C4YSA42.js";import{a as Oe,b as Ie}from"./chunk-QCAKDU3Q.js";import{a as Ce,b as be,c as Se,d as ve,f as C,g as w}from"./chunk-ZDHGKRIS.js";import{d as Q,e as ge}from"./chunk-4ACVSPIF.js";import{a as T,d as pe,f as fe,m as he,n as k,o as Z,x as me}from"./chunk-KBIQLRRR.js";import{a as ye}from"./chunk-7HVQTJAO.js";import{D as h,Hc as $,W as de,fa as le,gd as ue,pc as V,x as L,za as I}from"./chunk-JTQMVYTS.js";import{e as F,g as O}from"./chunk-LLHU72AA.js";import{ListStateStorage as Me,mergeProcessResults as Ae}from"@sentio/runtime";var u=F($(),1);var x=class extends me{bcs=new Ce(be());constructor(e){super(new Ie(e))}load(e,t){let n=this.moduleMapping.get(e.address+"::"+e.name),r=this.moduleMapping.get(t+"::"+e.name);return n&&r||(n=Oe(e),this.loadInternal(n,t)),n}async decode(e,t){switch(t.qname){case"0x1::ascii::Char":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).byte;return String.fromCharCode(r)}case"0x1::ascii::String":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).bytes;return new TextDecoder().decode(new Uint8Array(r))}case"0x2::object::ID":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).bytes;return ve(r)}case"0x2::url::Url":if(e!==void 0&&typeof e!="string")return(await super.decode(e,t)).url;case"0x2::coin::Coin":if(e!==void 0&&typeof e!="string"){let r=(await super.decode(e,t)).id.id.bytes;return new TextDecoder().decode(new Uint8Array(r))}return e;case"0x2::balance::Balance":return e.value?(await super.decode(e,t)).value:BigInt(e);case"0x1::option::Option":if(e===null)return e;if(e.vec){let r=await super.decode(e,t);return r=r.vec,r.length===0?null:r[0]}return this.decode(e,t.typeArgs[0]);case"Address":return Se(e);case"0x1::string::String":if(typeof e!="string")return new TextDecoder().decode(new Uint8Array(e.bytes));default:return super.decode(e,t)}}decodeEvent(e){return this.decodedStruct(e)}filterAndDecodeEvents(e,t){return typeof e=="string"&&(e=k(e)),this.filterAndDecodeStruct(e,t)}async getDynamicFields(e,t=Z,n=Z){let r=new he("0x2::dynamic_field::Field");return r.typeArgs=[t,n],(await this.filterAndDecodeObjects(r,e)).map(s=>s.data_decoded)}filterAndDecodeObjects(e,t){return this.filterAndDecodeStruct(e,t)}async decodeFunctionPayload(e,t){let n=[e.package,e.module,e.function].join(T),r=await this.getMoveFunction(n),o=this.adapter.getMeaningfulFunctionParams(r.params),s=[];for(let i of e.arguments||[]){let l=i;if("Input"in l){let g=l.Input,p=t[g];p.type==="pure"?s.push(p.value):(p.type==="object"||console.error("unexpected function arg value"),s.push(void 0))}else s.push(void 0)}let a=await this.decodeArray(s,o,!1);return{...e,arguments_decoded:a}}async _registerBCSType(e){if(this.bcs.hasType(e))return;let t=await this.getMoveStruct(e),n={};for(let s of t.fields)n[s.name]=s.type.getNormalizedSignature();let r=e,o=t.typeParams.map((s,a)=>"T"+a).join(", ");o&&(r=r+"<"+o+">"),this.bcs.registerStructType(r,n);for(let s of t.fields)await this.registerBCSTypes(s.type)}bcsRegistered=new Set;async registerBCSTypes(e){let t=e.getNormalizedSignature();if(!this.bcsRegistered.has(t)){this.bcsRegistered.add(t),await this._registerBCSType("0x1::string::String");for(let n of e.dependedTypes())await this._registerBCSType(n)}}async decodeBCS(e,t,n){return await this.registerBCSTypes(e),this.bcs.de(e.getNormalizedSignature(),t,n)}async decodeDevInspectResult(e){let t=[];if(e.results!=null)for(let n of e.results)if(n.returnValues)for(let r of n.returnValues){let o=k(r[1]),s=await this.decodeBCS(o,new Uint8Array(r[0])),a=await this.decodedType(s,o);t.push(a)}else t.push(null);return{...e,results_decoded:t}}};var we=new Map;function j(c=C.MAIN_NET){let e=we.get(c);return e||(e=new x(w(c)),we.set(c,e)),e}var f=class extends Q{moduleName;timestamp;checkpoint;transaction;eventIndex;coder;constructor(e,t,n,r,o,s,a,i){super(i),this.address=n.toLowerCase(),this.network=t,this.moduleName=e,this.timestamp=r,this.checkpoint=o,this.eventIndex=a,this.coder=j(t),s&&(this.transaction=s)}getChainId(){return this.network}getTimestamp(){return this.timestamp.getDate()}getMetaDataInternal(e,t){return{address:this.address,contractName:this.moduleName,blockNumber:this.checkpoint,transactionIndex:0,transactionHash:this.transaction?.digest||"",logIndex:this.eventIndex,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}},U=class extends Q{timestamp;checkpoint;coder;txDigest;constructor(e,t,n,r,o,s){super(s),this.address=t,this.network=e,this.timestamp=n,this.checkpoint=r,this.txDigest=o,this.coder=j(e)}getChainId(){return this.network}getTimestamp(){return this.timestamp.getDate()}getMetaDataInternal(e,t){return{address:this.address,contractName:"*",blockNumber:this.checkpoint,transactionIndex:-1,transactionHash:this.txDigest,logIndex:0,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}},X=class extends ge{address;network;checkpoint;timestamp;coder;contractName="address";constructor(e,t,n,r,o){super(o),this.address=t,this.network=e,this.checkpoint=n,this.timestamp=r,this.coder=j(e)}getChainId(){return this.network}getMetaDataInternal(e,t){return{address:this.address,contractName:this.contractName,blockNumber:this.checkpoint,transactionIndex:0,transactionHash:"",logIndex:0,chainId:this.getChainId(),name:e,labels:V(t)}}get client(){return w(this.network)}getTimestamp(){return this.timestamp.getDate()}},G=class extends X{contractName="object";objectId;constructor(e,t,n,r,o){super(e,t,n,r,o),this.objectId=t}};function xe(c){let e=c.transaction?.data.transaction;if(!e)return[];let t=e.kind==="ProgrammableTransaction"?e:void 0;return t?t.transactions.flatMap(n=>{if("MoveCall"in n){let r=n.MoveCall;return r.package=pe(r.package),[r]}return[]}):[]}var P={resourceChanges:!1,allEvents:!1,inputs:!1};function q(c){return{startCheckpoint:c.startCheckpoint||0n,address:c.address==="*"?"*":fe(c.address),network:c.network||C.MAIN_NET,baseLabels:c.baseLabels}}var ee=class extends Me{},y=ee;O(y,"INSTANCE",new ee);var E=class{moduleName;config;eventHandlers=[];callHandlers=[];objectChangeHandlers=[];coder;constructor(e,t){this.moduleName=e,this.config=q(t),y.INSTANCE.addValue(this),this.coder=j(this.config.network)}getChainId(){return this.config.network}onMoveEvent(e,t,n){let r=[],o=I.fromPartial({...P,...n});Array.isArray(t)?r=t:r.push(t);let s=this,a=new Set(r.map(i=>i.type));return this.eventHandlers.push({handler:async function(i){if(!i.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"event is null");let l=i.transaction;if(!l.events||!l.events.length)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"no event in the transactions");let g=[];for(let p of l.events){let A=Number(p.id.eventSeq)||0,[ce,N,Y]=k(p.type).qname.split(T);if(!a.has([N,Y].join(T)))continue;let _=new f(s.moduleName,s.config.network,s.config.address,i.timestamp||new Date(0),i.slot,l,A,s.config.baseLabels),je=await s.coder.decodeEvent(p);await e(je||p,_),g.push(_.stopAndGetResult())}return Ae(g)},filters:r,fetchConfig:o}),this}onEntryFunctionCall(e,t,n){let r=[],o=I.fromPartial({...P,...n});Array.isArray(t)?r=t:r.push(t);let s=this,a=new Set(r.map(i=>i.function));return this.callHandlers.push({handler:async function(i){if(!i.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"call is null");let l=i.transaction,g=new f(s.moduleName,s.config.network,s.config.address,i.timestamp||new Date(0),i.slot,l,0,s.config.baseLabels);if(l){let p=xe(l),A=l.transaction?.data?.transaction;if(!A)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"Unexpected getTransactionKind get empty");let ce=A.kind==="ProgrammableTransaction"?A:void 0;for(let N of p){let Y=[N.module,N.function].join(T);if(!a.has(Y))continue;let _=await s.coder.decodeFunctionPayload(N,ce?.inputs||[]);await e(_,g)}}return g.stopAndGetResult()},filters:r,fetchConfig:o}),this}onEvent(e,t){return this.onMoveEvent(e,{type:""},t),this}onTransactionBlock(e,t,n){let r=I.fromPartial({...P,...n}),o=this;return this.callHandlers.push({handler:async function(s){if(!s.transaction)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"transaction is null");let a=s.transaction,i=new f(o.moduleName,o.config.network,o.config.address,s.timestamp||new Date(0),s.slot,a,0,o.config.baseLabels);return a&&await e(a,i),i.stopAndGetResult()},filters:[{...t,function:""}],fetchConfig:r}),this}onObjectChange(e,t){if(this.config.network===C.TEST_NET)throw new u.ServerError(u.Status.INVALID_ARGUMENT,"object change not supported in testnet");let n=this;return this.objectChangeHandlers.push({handler:async function(r){let o=new U(n.config.network,n.config.address,r.timestamp||new Date(0),r.slot,r.txDigest,n.config.baseLabels);return await e(r.changes,o),o.stopAndGetResult()},type:t}),this}},D=class extends E{static bind(e){return new D("*",e)}},H=class extends E{static bind(e){return new H("*",{...e,address:"*"})}onTransactionBlock(e,t,n){return super.onTransactionBlock(e,t,n)}onObjectChange(e,t){return super.onObjectChange(e,t)}};import{ListStateStorage as Ne}from"@sentio/runtime";var z=F($(),1);var te={owned:!1},ne=class extends Ne{},M=ne;O(M,"INSTANCE",new ne);var R=class{config;ownerType;objectHandlers=[];constructor(e){this.config=q(e),this.ownerType=e.ownerType,M.INSTANCE.addValue(this)}getChainId(){return this.config.network}onInterval(e,t,n,r,o){let s=this;return this.objectHandlers.push({handler:async function(a){let i=new G(s.config.network,s.config.address,a.slot,a.timestamp||new Date(0),s.config.baseLabels);return await s.doHandle(e,a,i),i.stopAndGetResult()},timeIntervalInMinutes:t,checkPointInterval:n,type:r,fetchConfig:{...te,...o}}),this}onTimeInterval(e,t=60,n=240,r,o){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0,r,o)}onCheckpointInterval(e,t=1e5,n=4e5,r,o){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n},r,o)}},m=class extends R{callHandlers=[];static bind(e){return new m({...e,ownerType:L.ADDRESS})}doHandle(e,t,n){return e(t.objects,n)}onTransactionBlock(e,t,n){let r=I.fromPartial({...P,...n}),o={fromAndToAddress:{from:"",to:this.config.address},...t},s=this;return this.callHandlers.push({handler:async function(a){if(!a.transaction)throw new z.ServerError(z.Status.INVALID_ARGUMENT,"transaction is null");let i=a.transaction,l=new f("object",s.config.network,s.config.address,a.timestamp||new Date(0),a.slot,i,0,s.config.baseLabels);return i&&await e(i,l),l.stopAndGetResult()},filters:[{...o,function:""}],fetchConfig:r}),this}},b=class extends R{static bind(e){return new b({address:e.objectId,network:e.network,startCheckpoint:e.startCheckpoint,ownerType:L.OBJECT,baseLabels:e.baseLabels})}doHandle(e,t,n){if(!t.self){console.log(`Sui object not existed in ${n.checkpoint}, please specific a start time`);return}return e(t.self,t.objects,n)}},S=class extends R{static bind(e){return new S({address:e.objectId,network:e.network,startCheckpoint:e.startCheckpoint,ownerType:L.WRAPPED_OBJECT,baseLabels:e.baseLabels})}doHandle(e,t,n){return e(t.objects,n)}};import{ListStateStorage as ke}from"@sentio/runtime";var ie=class extends ke{},v=ie;O(v,"INSTANCE",new ie);var B=class{id;objectHandlers=[];binds=new Set;constructor(){this.id=v.INSTANCE.getValues().length,v.INSTANCE.addValue(this)}bind(e,t){e.network=e.network||t.network,e.startCheckpoint=e.startCheckpoint||t.checkpoint;let n=e.objectId||e.address,r=[e.network,n].join("_");if(this.binds.has(r)){console.log(`Same object id can be bind to one template only once, ignore duplicate bind: ${r}`);return}this.binds.add(r);let o=this.createProcessor(e);for(let a of this.objectHandlers)o.onInterval(a.handler,a.timeIntervalInMinutes,a.checkpointInterval,a.type,a.fetchConfig);let s=o.config;t.update({states:{configUpdated:!0}}),ue.INSTANCE.addValue({templateId:this.id,contract:{name:"",chainId:s.network,address:s.address,abi:""},startBlock:s.startCheckpoint,endBlock:0n,baseLabels:s.baseLabels})}onInterval(e,t,n,r,o){return this.objectHandlers.push({handler:e,timeIntervalInMinutes:t,checkpointInterval:n,type:r,fetchConfig:{...te,...o}}),this}onTimeInterval(e,t=60,n=240,r,o){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0,r,o)}onCheckpointInterval(e,t=1e5,n=4e5,r,o){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n},r,o)}};var re=class extends B{handlers=[];createProcessor(e){let t=m.bind(e);for(let n of this.handlers)t.onTransactionBlock(n.handler,n.filter,n.fetchConfig);return t}onTransactionBlock(e,t,n){return this.handlers.push({handler:e,filter:t,fetchConfig:n}),this}},oe=class extends B{createProcessor(e){return b.bind(e)}},se=class extends B{createProcessor(e){return S.bind(e)}};import{errorString as J,mergeProcessResults as K,Plugin as Pe,PluginManager as Ee,USER_PROCESSOR as De}from"@sentio/runtime";var d=F($(),1);var ae=F(ye(),1);var W=class extends Pe{name="SuiPlugin";handlers={suiCallHandlers:[],suiEventHandlers:[],suiObjectHandlers:[],suiObjectChangeHandlers:[]};async start(e){await Te(),console.log("total instances:",e.templateInstances.length);let t=new Set(Object.values(ae.SuiChainId));for(let n of e.templateInstances){if(!t.has(n.contract?.chainId||""))continue;console.log("start template instance",n.templateId),v.INSTANCE.getValues()[n.templateId].bind({address:n.contract?.address||"",objectId:n.contract?.address||"",network:n.contract?.chainId||C.MAIN_NET,startCheckpoint:n.startBlock||0n,baseLabels:n.baseLabels},He)}}async configure(e){let t={suiCallHandlers:[],suiEventHandlers:[],suiObjectHandlers:[],suiObjectChangeHandlers:[]};for(let n of y.INSTANCE.getValues()){let r=de.fromPartial({transactionConfig:[],processorType:De,contract:{name:n.moduleName,chainId:n.config.network,address:n.config.address,abi:""},startBlock:n.config.startCheckpoint});for(let o of n.eventHandlers){let s=t.suiEventHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({type:i.type,account:i.account||""})),fetchConfig:o.fetchConfig,handlerId:s};r.moveEventConfigs.push(a)}for(let o of n.callHandlers){let s=t.suiCallHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({function:i.function,typeArguments:i.typeArguments||[],withTypeArguments:!!i.typeArguments,includeFailed:i.includeFailed||!1,publicKeyPrefix:i.publicKeyPrefix||"",fromAndToAddress:i.fromAndToAddress})),fetchConfig:o.fetchConfig,handlerId:s};r.moveCallConfigs.push(a)}for(let o of n.objectChangeHandlers){let s=t.suiObjectChangeHandlers.push(o.handler)-1,a={type:o.type,handlerId:s};r.moveResourceChangeConfigs.push(a)}e.contractConfigs.push(r)}for(let n of M.INSTANCE.getValues()){let r=le.fromPartial({address:n.config.address,chainId:n.getChainId(),startBlock:n.config.startCheckpoint});for(let o of n.objectHandlers){let s=t.suiObjectHandlers.push(o.handler)-1;r.moveIntervalConfigs.push({intervalConfig:{handlerId:s,minutes:0,minutesInterval:o.timeIntervalInMinutes,slot:0,slotInterval:o.checkPointInterval,fetchConfig:void 0},type:o.type||"",ownerType:n.ownerType,fetchConfig:o.fetchConfig})}if(n instanceof m)for(let o of n.callHandlers){let s=t.suiCallHandlers.push(o.handler)-1,a={filters:o.filters.map(i=>({function:i.function,typeArguments:i.typeArguments||[],withTypeArguments:!!i.typeArguments,includeFailed:i.includeFailed||!1,publicKeyPrefix:i.publicKeyPrefix||"",fromAndToAddress:i.fromAndToAddress})),fetchConfig:o.fetchConfig,handlerId:s};r.moveCallConfigs.push(a)}e.accountConfigs.push(r)}this.handlers=t}async processSuiEvent(e){if(!e.data?.suiEvent)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Event can't be empty");let t=[],n=e.data.suiEvent;for(let r of e.handlerIds)t.push(this.handlers.suiEventHandlers[r](n).catch(o=>{throw new d.ServerError(d.Status.INTERNAL,"error processing event: "+JSON.stringify(n)+`
3
3
  `+J(o))}));return K(await Promise.all(t))}async processSuiFunctionCall(e){if(!e.data?.suiCall)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Call can't be empty");let t=e.data.suiCall,n=[];for(let r of e.handlerIds){let o=this.handlers.suiCallHandlers[r](t).catch(s=>{throw new d.ServerError(d.Status.INTERNAL,"error processing call: "+JSON.stringify(t)+`
4
4
  `+J(s))});n.push(o)}return K(await Promise.all(n))}async processSuiObject(e){if(!e.data?.suiObject)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Object can't be empty");let t=e.data.suiObject,n=[];for(let r of e.handlerIds)n.push(this.handlers.suiObjectHandlers[r](t).catch(o=>{throw new d.ServerError(d.Status.INTERNAL,"error processing object: "+JSON.stringify(t)+`
5
5
  `+J(o))}));return K(await Promise.all(n))}async processSuiObjectChange(e){if(!e.data?.suiObjectChange)throw new d.ServerError(d.Status.INVALID_ARGUMENT,"Object change can't be empty");let t=e.data.suiObjectChange,n=[];for(let r of e.handlerIds)n.push(this.handlers.suiObjectChangeHandlers[r](t).catch(o=>{throw new d.ServerError(d.Status.INTERNAL,"error processing object change: "+JSON.stringify(t)+`
6
6
  `+J(o))}));return K(await Promise.all(n))}supportedHandlers=[h.SUI_EVENT,h.SUI_CALL,h.SUI_OBJECT,h.SUI_OBJECT_CHANGE];processBinding(e){switch(e.handlerType){case h.SUI_EVENT:return this.processSuiEvent(e);case h.SUI_CALL:return this.processSuiFunctionCall(e);case h.SUI_OBJECT:return this.processSuiObject(e);case h.SUI_OBJECT_CHANGE:return this.processSuiObjectChange(e);default:throw new d.ServerError(d.Status.INVALID_ARGUMENT,"No handle type registered "+e.handlerType)}}};Ee.INSTANCE.register(new W);var He=new f("",ae.SuiChainId.SUI_MAINNET,"",new Date,0n,{},0,{});export{x as a,j as b,f as c,U as d,X as e,G as f,xe as g,E as h,D as i,H as j,m as k,b as l,S as m,re as n,oe as o,se as p,W as q};
7
- //# sourceMappingURL=chunk-T5A3YPP2.js.map
7
+ //# sourceMappingURL=chunk-X7K74U6O.js.map
@@ -1,5 +1,5 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{b as ed}from"./chunk-DEW7KMCM.js";import{a as Qf,b as r0}from"./chunk-SSMP6EWG.js";import{a as Zf}from"./chunk-7HVQTJAO.js";import{$b as Kt,D as _c,Hc as t0,Sb as $f,Tb as fi,Ub as xc,Vb as wr,W as Mf,Wb as vc,Xb as qf,Yb as Wf,Zb as Zg,_b as di,ac as Ht,bc as Hf,bd as Jf,cc as jf,dc as Vf,ec as Gf,fc as Xf,gc as Qg,hc as hi,ic as e0,pc as Yf}from"./chunk-JGYBNJHX.js";import{e as dn}from"./chunk-TW3ZXDJC.js";import{a as Kf,c as Jg}from"./chunk-NMFPLO65.js";import{c as Sc,d as Xg,h as kc,i as Yg}from"./chunk-GQE2JYJW.js";import{x as zf,y as Gg}from"./chunk-DJQ5RDDN.js";import{a as ae,b as We,c as oe,d as Ps,e as re,f as Ts,g as Df}from"./chunk-LLHU72AA.js";function l0(s){let e=Xf(s);return qf(s,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function id(s){let e=l0(s),{Fp:t,n:r,prehash:o,hash:n,randomBytes:i,nByteLength:c,h:l}=e,p=yi<<BigInt(c*8)-kt,f=t.create,b=e.uvRatio||((X,U)=>{try{return{isValid:!0,value:t.sqrt(X*t.inv(U))}}catch{return{isValid:!1,value:jt}}}),_=e.adjustScalarBytes||(X=>X),g=e.domain||((X,U,Z)=>{if(U.length||Z)throw new Error("Contexts/pre-hash are not supported");return X}),k=X=>typeof X=="bigint"&&jt<X,S=(X,U)=>k(X)&&k(U)&&X<U,A=X=>X===jt||S(X,p);function C(X,U){if(S(X,U))return X;throw new Error(`Expected valid scalar < ${U}, got ${typeof X} ${X}`)}function P(X){return X===jt?X:C(X,r)}let D=new Map;function V(X){if(!(X instanceof q))throw new Error("ExtendedPoint expected")}class q{constructor(U,Z,se,ye){if(this.ex=U,this.ey=Z,this.ez=se,this.et=ye,!A(U))throw new Error("x required");if(!A(Z))throw new Error("y required");if(!A(se))throw new Error("z required");if(!A(ye))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(U){if(U instanceof q)throw new Error("extended point not allowed");let{x:Z,y:se}=U||{};if(!A(Z)||!A(se))throw new Error("invalid affine point");return new q(Z,se,kt,f(Z*se))}static normalizeZ(U){let Z=t.invertBatch(U.map(se=>se.ez));return U.map((se,ye)=>se.toAffine(Z[ye])).map(q.fromAffine)}_setWindowSize(U){this._WINDOW_SIZE=U,D.delete(this)}assertValidity(){let{a:U,d:Z}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:se,ey:ye,ez:ge,et:ve}=this,Ce=f(se*se),Ee=f(ye*ye),Oe=f(ge*ge),Ve=f(Oe*Oe),nt=f(Ce*U),Lt=f(Oe*f(nt+Ee)),st=f(Ve+f(Z*f(Ce*Ee)));if(Lt!==st)throw new Error("bad point: equation left != right (1)");let er=f(se*ye),Wt=f(ge*ve);if(er!==Wt)throw new Error("bad point: equation left != right (2)")}equals(U){V(U);let{ex:Z,ey:se,ez:ye}=this,{ex:ge,ey:ve,ez:Ce}=U,Ee=f(Z*Ce),Oe=f(ge*ye),Ve=f(se*Ce),nt=f(ve*ye);return Ee===Oe&&Ve===nt}is0(){return this.equals(q.ZERO)}negate(){return new q(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:U}=e,{ex:Z,ey:se,ez:ye}=this,ge=f(Z*Z),ve=f(se*se),Ce=f(yi*f(ye*ye)),Ee=f(U*ge),Oe=Z+se,Ve=f(f(Oe*Oe)-ge-ve),nt=Ee+ve,Lt=nt-Ce,st=Ee-ve,er=f(Ve*Lt),Wt=f(nt*st),Mn=f(Ve*st),zn=f(Lt*nt);return new q(er,Wt,zn,Mn)}add(U){V(U);let{a:Z,d:se}=e,{ex:ye,ey:ge,ez:ve,et:Ce}=this,{ex:Ee,ey:Oe,ez:Ve,et:nt}=U;if(Z===BigInt(-1)){let ei=f((ge-ye)*(Oe+Ee)),vs=f((ge+ye)*(Oe-Ee)),Es=f(vs-ei);if(Es===jt)return this.double();let ti=f(ve*yi*nt),As=f(Ce*yi*Ve),ri=As+ti,ni=vs+ei,si=As-ti,uc=f(ri*Es),lc=f(ni*si),fc=f(ri*si),oi=f(Es*ni);return new q(uc,lc,oi,fc)}let Lt=f(ye*Ee),st=f(ge*Oe),er=f(Ce*se*nt),Wt=f(ve*Ve),Mn=f((ye+ge)*(Ee+Oe)-Lt-st),zn=Wt-er,$n=Wt+er,qn=f(st-Z*Lt),Zo=f(Mn*zn),ln=f($n*qn),fn=f(Mn*qn),Qo=f(zn*$n);return new q(Zo,ln,Qo,fn)}subtract(U){return this.add(U.negate())}wNAF(U){return Re.wNAFCached(this,D,U,q.normalizeZ)}multiply(U){let{p:Z,f:se}=this.wNAF(C(U,r));return q.normalizeZ([Z,se])[0]}multiplyUnsafe(U){let Z=P(U);return Z===jt?de:this.equals(de)||Z===kt?this:this.equals(fe)?this.wNAF(Z).p:Re.unsafeLadder(this,Z)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return Re.unsafeLadder(this,r).is0()}toAffine(U){let{ex:Z,ey:se,ez:ye}=this,ge=this.is0();U==null&&(U=ge?c0:t.inv(ye));let ve=f(Z*U),Ce=f(se*U),Ee=f(ye*U);if(ge)return{x:jt,y:kt};if(Ee!==kt)throw new Error("invZ was invalid");return{x:ve,y:Ce}}clearCofactor(){let{h:U}=e;return U===kt?this:this.multiplyUnsafe(U)}static fromHex(U,Z=!1){let{d:se,a:ye}=e,ge=t.BYTES;U=wr("pointHex",U,ge);let ve=U.slice(),Ce=U[ge-1];ve[ge-1]=Ce&-129;let Ee=fi(ve);Ee===jt||(Z?C(Ee,p):C(Ee,t.ORDER));let Oe=f(Ee*Ee),Ve=f(Oe-kt),nt=f(se*Oe-ye),{isValid:Lt,value:st}=b(Ve,nt);if(!Lt)throw new Error("Point.fromHex: invalid y coordinate");let er=(st&kt)===kt,Wt=(Ce&128)!==0;if(!Z&&st===jt&&Wt)throw new Error("Point.fromHex: x=0 and x_0=1");return Wt!==er&&(st=f(-st)),q.fromAffine({x:st,y:Ee})}static fromPrivateKey(U){return rt(U).point}toRawBytes(){let{x:U,y:Z}=this.toAffine(),se=xc(Z,t.BYTES);return se[se.length-1]|=U&kt?128:0,se}toHex(){return $f(this.toRawBytes())}}q.BASE=new q(e.Gx,e.Gy,kt,f(e.Gx*e.Gy)),q.ZERO=new q(jt,kt,kt,jt);let{BASE:fe,ZERO:de}=q,Re=Gf(q,c*8);function ut(X){return Kt(X,r)}function $e(X){return ut(fi(X))}function rt(X){let U=c;X=wr("private key",X,U);let Z=wr("hashed private key",n(X),2*U),se=_(Z.slice(0,U)),ye=Z.slice(U,2*U),ge=$e(se),ve=fe.multiply(ge),Ce=ve.toRawBytes();return{head:se,prefix:ye,scalar:ge,point:ve,pointBytes:Ce}}function Qt(X){return rt(X).pointBytes}function ks(X=new Uint8Array,...U){let Z=vc(...U);return $e(n(g(Z,wr("context",X),!!o)))}function Jo(X,U,Z={}){X=wr("message",X),o&&(X=o(X));let{prefix:se,scalar:ye,pointBytes:ge}=rt(U),ve=ks(Z.context,se,X),Ce=fe.multiply(ve).toRawBytes(),Ee=ks(Z.context,Ce,ge,X),Oe=ut(ve+Ee*ye);P(Oe);let Ve=vc(Ce,xc(Oe,t.BYTES));return wr("result",Ve,c*2)}let Dr=u0;function xs(X,U,Z,se=Dr){let{context:ye,zip215:ge}=se,ve=t.BYTES;X=wr("signature",X,2*ve),U=wr("message",U),o&&(U=o(U));let Ce=fi(X.slice(ve,2*ve)),Ee,Oe,Ve;try{Ee=q.fromHex(Z,ge),Oe=q.fromHex(X.slice(0,ve),ge),Ve=fe.multiplyUnsafe(Ce)}catch{return!1}if(!ge&&Ee.isSmallOrder())return!1;let nt=ks(ye,Oe.toRawBytes(),Ee.toRawBytes(),U);return Oe.add(Ee.multiplyUnsafe(nt)).subtract(Ve).clearCofactor().equals(q.ZERO)}return fe._setWindowSize(8),{CURVE:e,getPublicKey:Qt,sign:Jo,verify:xs,ExtendedPoint:q,utils:{getExtendedPublicKey:rt,randomPrivateKey:()=>i(t.BYTES),precompute(X=8,U=q.BASE){return U._setWindowSize(X),U.multiply(BigInt(3)),U}}}}var jt,kt,yi,c0,u0,ad=We(()=>{Qg();Vf();Wf();Wf();jt=BigInt(0),kt=BigInt(1),yi=BigInt(2),c0=BigInt(8),u0={zip215:!0}});function p0(s){let e=BigInt(10),t=BigInt(20),r=BigInt(40),o=BigInt(80),n=Ic,c=s*s%n*s%n,l=Ht(c,ud,n)*c%n,p=Ht(l,f0,n)*s%n,f=Ht(p,d0,n)*p%n,b=Ht(f,e,n)*f%n,_=Ht(b,t,n)*b%n,g=Ht(_,r,n)*_%n,k=Ht(g,o,n)*g%n,S=Ht(k,o,n)*g%n,A=Ht(S,e,n)*f%n;return{pow_p_5_8:Ht(A,ud,n)*s%n,b2:c}}function y0(s){return s[0]&=248,s[31]&=127,s[31]|=64,s}function m0(s,e){let t=Ic,r=Kt(e*e*e,t),o=Kt(r*r*e,t),n=p0(s*o).pow_p_5_8,i=Kt(s*r*n,t),c=Kt(e*i*i,t),l=i,p=Kt(i*cd,t),f=c===s,b=c===Kt(-s,t),_=c===Kt(-s*cd,t);return f&&(i=l),(b||_)&&(i=p),Hf(i,t)&&(i=Kt(-i,t)),{isValid:f||b,value:i}}var Ic,cd,mx,f0,ud,gx,d0,h0,g0,b0,pn,ld=We(()=>{r0();Gg();ad();Vf();Ic=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),cd=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),mx=BigInt(0),f0=BigInt(1),ud=BigInt(2),gx=BigInt(3),d0=BigInt(5),h0=BigInt(8);g0=(()=>jf(Ic,void 0,!0))(),b0=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:g0,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:h0,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Qf,randomBytes:zf,adjustScalarBytes:y0,uvRatio:m0}))(),pn=(()=>id(b0))()});var hd=oe((Bc,dd)=>{var mi=ae("buffer"),tr=mi.Buffer;function fd(s,e){for(var t in s)e[t]=s[t]}tr.from&&tr.alloc&&tr.allocUnsafe&&tr.allocUnsafeSlow?dd.exports=mi:(fd(mi,Bc),Bc.Buffer=yn);function yn(s,e,t){return tr(s,e,t)}yn.prototype=Object.create(tr.prototype);fd(tr,yn);yn.from=function(s,e,t){if(typeof s=="number")throw new TypeError("Argument must not be a number");return tr(s,e,t)};yn.alloc=function(s,e,t){if(typeof s!="number")throw new TypeError("Argument must be a number");var r=tr(s);return e!==void 0?typeof t=="string"?r.fill(e,t):r.fill(e):r.fill(0),r};yn.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return tr(s)};yn.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return mi.SlowBuffer(s)}});var yd=oe((wx,pd)=>{"use strict";var gi=hd().Buffer;function w0(s){if(s.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t<e.length;t++)e[t]=255;for(var r=0;r<s.length;r++){var o=s.charAt(r),n=o.charCodeAt(0);if(e[n]!==255)throw new TypeError(o+" is ambiguous");e[n]=r}var i=s.length,c=s.charAt(0),l=Math.log(i)/Math.log(256),p=Math.log(256)/Math.log(i);function f(g){if((Array.isArray(g)||g instanceof Uint8Array)&&(g=gi.from(g)),!gi.isBuffer(g))throw new TypeError("Expected Buffer");if(g.length===0)return"";for(var k=0,S=0,A=0,C=g.length;A!==C&&g[A]===0;)A++,k++;for(var P=(C-A)*p+1>>>0,D=new Uint8Array(P);A!==C;){for(var V=g[A],q=0,fe=P-1;(V!==0||q<S)&&fe!==-1;fe--,q++)V+=256*D[fe]>>>0,D[fe]=V%i>>>0,V=V/i>>>0;if(V!==0)throw new Error("Non-zero carry");S=q,A++}for(var de=P-S;de!==P&&D[de]===0;)de++;for(var Re=c.repeat(k);de<P;++de)Re+=s.charAt(D[de]);return Re}function b(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return gi.alloc(0);for(var k=0,S=0,A=0;g[k]===c;)S++,k++;for(var C=(g.length-k)*l+1>>>0,P=new Uint8Array(C);g[k];){var D=e[g.charCodeAt(k)];if(D===255)return;for(var V=0,q=C-1;(D!==0||V<A)&&q!==-1;q--,V++)D+=i*P[q]>>>0,P[q]=D%256>>>0,D=D/256>>>0;if(D!==0)throw new Error("Non-zero carry");A=V,k++}for(var fe=C-A;fe!==C&&P[fe]===0;)fe++;var de=gi.allocUnsafe(S+(C-fe));de.fill(0,0,S);for(var Re=S;fe!==C;)de[Re++]=P[fe++];return de}function _(g){var k=b(g);if(k)return k;throw new Error("Non-base"+i+" character")}return{encode:f,decodeUnsafe:b,decode:_}}pd.exports=w0});var Hn=oe((_x,md)=>{var _0=yd(),S0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";md.exports=_0(S0)});var gd=oe(Cc=>{"use strict";function _r(s,e,t){return e<=s&&s<=t}function ki(s){if(s===void 0)return{};if(s===Object(s))return s;throw TypeError("Could not convert argument to dictionary")}function k0(s){for(var e=String(s),t=e.length,r=0,o=[];r<t;){var n=e.charCodeAt(r);if(n<55296||n>57343)o.push(n);else if(56320<=n&&n<=57343)o.push(65533);else if(55296<=n&&n<=56319)if(r===t-1)o.push(65533);else{var i=s.charCodeAt(r+1);if(56320<=i&&i<=57343){var c=n&1023,l=i&1023;o.push(65536+(c<<10)+l),r+=1}else o.push(65533)}r+=1}return o}function x0(s){for(var e="",t=0;t<s.length;++t){var r=s[t];r<=65535?e+=String.fromCharCode(r):(r-=65536,e+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return e}var bi=-1;function Rc(s){this.tokens=[].slice.call(s)}Rc.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():bi},prepend:function(s){if(Array.isArray(s))for(var e=s;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(s)},push:function(s){if(Array.isArray(s))for(var e=s;e.length;)this.tokens.push(e.shift());else this.tokens.push(s)}};var jn=-1;function Lc(s,e){if(s)throw TypeError("Decoder error");return e||65533}var wi="utf-8";function _i(s,e){if(!(this instanceof _i))return new _i(s,e);if(s=s!==void 0?String(s).toLowerCase():wi,s!==wi)throw new Error("Encoding not supported. Only utf-8 is supported");e=ki(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}_i.prototype={decode:function(e,t){var r;typeof e=="object"&&e instanceof ArrayBuffer?r=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):r=new Uint8Array(0),t=ki(t),this._streaming||(this._decoder=new v0({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var o=new Rc(r),n=[],i;!o.endOfStream()&&(i=this._decoder.handler(o,o.read()),i!==jn);)i!==null&&(Array.isArray(i)?n.push.apply(n,i):n.push(i));if(!this._streaming){do{if(i=this._decoder.handler(o,o.read()),i===jn)break;i!==null&&(Array.isArray(i)?n.push.apply(n,i):n.push(i))}while(!o.endOfStream());this._decoder=null}return n.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(n[0]===65279?(this._BOMseen=!0,n.shift()):this._BOMseen=!0),x0(n)}};function Si(s,e){if(!(this instanceof Si))return new Si(s,e);if(s=s!==void 0?String(s).toLowerCase():wi,s!==wi)throw new Error("Encoding not supported. Only utf-8 is supported");e=ki(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}Si.prototype={encode:function(e,t){e=e?String(e):"",t=ki(t),this._streaming||(this._encoder=new E0(this._options)),this._streaming=!!t.stream;for(var r=[],o=new Rc(k0(e)),n;!o.endOfStream()&&(n=this._encoder.handler(o,o.read()),n!==jn);)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;n=this._encoder.handler(o,o.read()),n!==jn;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}};function v0(s){var e=s.fatal,t=0,r=0,o=0,n=128,i=191;this.handler=function(c,l){if(l===bi&&o!==0)return o=0,Lc(e);if(l===bi)return jn;if(o===0){if(_r(l,0,127))return l;if(_r(l,194,223))o=1,t=l-192;else if(_r(l,224,239))l===224&&(n=160),l===237&&(i=159),o=2,t=l-224;else if(_r(l,240,244))l===240&&(n=144),l===244&&(i=143),o=3,t=l-240;else return Lc(e);return t=t<<6*o,null}if(!_r(l,n,i))return t=o=r=0,n=128,i=191,c.prepend(l),Lc(e);if(n=128,i=191,r+=1,t+=l-128<<6*(o-r),r!==o)return null;var p=t;return t=o=r=0,p}}function E0(s){var e=s.fatal;this.handler=function(t,r){if(r===bi)return jn;if(_r(r,0,127))return r;var o,n;_r(r,128,2047)?(o=1,n=192):_r(r,2048,65535)?(o=2,n=224):_r(r,65536,1114111)&&(o=3,n=240);for(var i=[(r>>6*o)+n];o>0;){var c=r>>6*(o-1);i.push(128|c&63),o-=1}return i}}Cc.TextEncoder=Si;Cc.TextDecoder=_i});var kd=oe(Le=>{"use strict";var A0=Le&&Le.__createBinding||(Object.create?function(s,e,t,r){r===void 0&&(r=t),Object.defineProperty(s,r,{enumerable:!0,get:function(){return e[t]}})}:function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]}),I0=Le&&Le.__setModuleDefault||(Object.create?function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}:function(s,e){s.default=e}),rr=Le&&Le.__decorate||function(s,e,t,r){var o=arguments.length,n=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(s,e,t,r);else for(var c=s.length-1;c>=0;c--)(i=s[c])&&(n=(o<3?i(n):o>3?i(e,t,n):i(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n},B0=Le&&Le.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.hasOwnProperty.call(s,t)&&A0(e,s,t);return I0(e,s),e},bd=Le&&Le.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Le,"__esModule",{value:!0});Le.deserializeUnchecked=Le.deserialize=Le.serialize=Le.BinaryReader=Le.BinaryWriter=Le.BorshError=Le.baseDecode=Le.baseEncode=void 0;var $r=bd(dn()),wd=bd(Hn()),L0=B0(gd()),R0=typeof TextDecoder!="function"?L0.TextDecoder:TextDecoder,C0=new R0("utf-8",{fatal:!0});function P0(s){return typeof s=="string"&&(s=Buffer.from(s,"utf8")),wd.default.encode(Buffer.from(s))}Le.baseEncode=P0;function T0(s){return Buffer.from(wd.default.decode(s))}Le.baseDecode=T0;var Pc=1024,et=class extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Le.BorshError=et;var xi=class{constructor(){this.buf=Buffer.alloc(Pc),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(Pc)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),e,Buffer.alloc(Pc)]),this.length+=e.length}writeString(e){this.maybeResize();let t=Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(Buffer.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(let r of e)this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}};Le.BinaryWriter=xi;function nr(s,e,t){let r=t.value;t.value=function(...o){try{return r.apply(this,o)}catch(n){if(n instanceof RangeError){let i=n.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(i)>=0)throw new et("Reached the end of buffer when deserializing")}throw n}}}var lt=class{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new $r.default(e,"le")}readU128(){let e=this.readBuffer(16);return new $r.default(e,"le")}readU256(){let e=this.readBuffer(32);return new $r.default(e,"le")}readU512(){let e=this.readBuffer(64);return new $r.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new et(`Expected buffer length ${e} isn't within bounds`);let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return C0.decode(t)}catch(r){throw new et(`Error decoding UTF-8 string: ${r}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=Array();for(let o=0;o<t;++o)r.push(e());return r}};rr([nr],lt.prototype,"readU8",null);rr([nr],lt.prototype,"readU16",null);rr([nr],lt.prototype,"readU32",null);rr([nr],lt.prototype,"readU64",null);rr([nr],lt.prototype,"readU128",null);rr([nr],lt.prototype,"readU256",null);rr([nr],lt.prototype,"readU512",null);rr([nr],lt.prototype,"readString",null);rr([nr],lt.prototype,"readFixedArray",null);rr([nr],lt.prototype,"readArray",null);Le.BinaryReader=lt;function _d(s){return s.charAt(0).toUpperCase()+s.slice(1)}function mn(s,e,t,r,o){try{if(typeof r=="string")o[`write${_d(r)}`](t);else if(r instanceof Array)if(typeof r[0]=="number"){if(t.length!==r[0])throw new et(`Expecting byte array of length ${r[0]}, but got ${t.length} bytes`);o.writeFixedArray(t)}else if(r.length===2&&typeof r[1]=="number"){if(t.length!==r[1])throw new et(`Expecting byte array of length ${r[1]}, but got ${t.length} bytes`);for(let n=0;n<r[1];n++)mn(s,null,t[n],r[0],o)}else o.writeArray(t,n=>{mn(s,e,n,r[0],o)});else if(r.kind!==void 0)switch(r.kind){case"option":{t==null?o.writeU8(0):(o.writeU8(1),mn(s,e,t,r.type,o));break}case"map":{o.writeU32(t.size),t.forEach((n,i)=>{mn(s,e,i,r.key,o),mn(s,e,n,r.value,o)});break}default:throw new et(`FieldType ${r} unrecognized`)}else Sd(s,t,o)}catch(n){throw n instanceof et&&n.addToFieldPath(e),n}}function Sd(s,e,t){if(typeof e.borshSerialize=="function"){e.borshSerialize(t);return}let r=s.get(e.constructor);if(!r)throw new et(`Class ${e.constructor.name} is missing in schema`);if(r.kind==="struct")r.fields.map(([o,n])=>{mn(s,o,e[o],n,t)});else if(r.kind==="enum"){let o=e[r.field];for(let n=0;n<r.values.length;++n){let[i,c]=r.values[n];if(i===o){t.writeU8(n),mn(s,i,e[i],c,t);break}}}else throw new et(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}function O0(s,e,t=xi){let r=new t;return Sd(s,e,r),r.toArray()}Le.serialize=O0;function gn(s,e,t,r){try{if(typeof t=="string")return r[`read${_d(t)}`]();if(t instanceof Array){if(typeof t[0]=="number")return r.readFixedArray(t[0]);if(typeof t[1]=="number"){let o=[];for(let n=0;n<t[1];n++)o.push(gn(s,null,t[0],r));return o}else return r.readArray(()=>gn(s,e,t[0],r))}if(t.kind==="option")return r.readU8()?gn(s,e,t.type,r):void 0;if(t.kind==="map"){let o=new Map,n=r.readU32();for(let i=0;i<n;i++){let c=gn(s,e,t.key,r),l=gn(s,e,t.value,r);o.set(c,l)}return o}return Tc(s,t,r)}catch(o){throw o instanceof et&&o.addToFieldPath(e),o}}function Tc(s,e,t){if(typeof e.borshDeserialize=="function")return e.borshDeserialize(t);let r=s.get(e);if(!r)throw new et(`Class ${e.name} is missing in schema`);if(r.kind==="struct"){let o={};for(let[n,i]of s.get(e).fields)o[n]=gn(s,n,i,t);return new e(o)}if(r.kind==="enum"){let o=t.readU8();if(o>=r.values.length)throw new et(`Enum index: ${o} is out of range`);let[n,i]=r.values[o],c=gn(s,n,i,t);return new e({[n]:c})}throw new et(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}function N0(s,e,t,r=lt){let o=new r(t),n=Tc(s,e,o);if(o.offset<t.length)throw new et(`Unexpected ${t.length-o.offset} bytes after deserialized data`);return n}Le.deserialize=N0;function F0(s,e,t,r=lt){let o=new r(t);return Tc(s,e,o)}Le.deserializeUnchecked=F0});var Uc=oe(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.s16=E.s8=E.nu64be=E.u48be=E.u40be=E.u32be=E.u24be=E.u16be=E.nu64=E.u48=E.u40=E.u32=E.u24=E.u16=E.u8=E.offset=E.greedy=E.Constant=E.UTF8=E.CString=E.Blob=E.Boolean=E.BitField=E.BitStructure=E.VariantLayout=E.Union=E.UnionLayoutDiscriminator=E.UnionDiscriminator=E.Structure=E.Sequence=E.DoubleBE=E.Double=E.FloatBE=E.Float=E.NearInt64BE=E.NearInt64=E.NearUInt64BE=E.NearUInt64=E.IntBE=E.Int=E.UIntBE=E.UInt=E.OffsetLayout=E.GreedyCount=E.ExternalLayout=E.bindConstructorLayout=E.nameWithProperty=E.Layout=E.uint8ArrayToBuffer=E.checkUint8Array=void 0;E.constant=E.utf8=E.cstr=E.blob=E.unionLayoutDiscriminator=E.union=E.seq=E.bits=E.struct=E.f64be=E.f64=E.f32be=E.f32=E.ns64be=E.s48be=E.s40be=E.s32be=E.s24be=E.s16be=E.ns64=E.s48=E.s40=E.s32=E.s24=void 0;var Nc=ae("buffer");function Xn(s){if(!(s instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}E.checkUint8Array=Xn;function we(s){return Xn(s),Nc.Buffer.from(s.buffer,s.byteOffset,s.length)}E.uint8ArrayToBuffer=we;var ke=class{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}};E.Layout=ke;function Fc(s,e){return e.property?s+"["+e.property+"]":s}E.nameWithProperty=Fc;function U0(s,e){if(typeof s!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(s,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ke))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");s.layout_=e,e.boundConstructor_=s,e.makeDestinationObject=()=>new s,Object.defineProperty(s.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(s,"decode",{value(t,r){return e.decode(t,r)},writable:!0})}E.bindConstructorLayout=U0;var ot=class extends ke{isCount(){throw new Error("ExternalLayout is abstract")}};E.ExternalLayout=ot;var vi=class extends ot{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){Xn(e);let r=e.length-t;return Math.floor(r/this.elementSpan)}encode(e,t,r){return 0}};E.GreedyCount=vi;var Os=class extends ot{constructor(e,t=0,r){if(!(e instanceof ke))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof pt||this.layout instanceof xt}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}};E.OffsetLayout=Os;var pt=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readUIntLE(t,this.span)}encode(e,t,r=0){return we(t).writeUIntLE(e,r,this.span),this.span}};E.UInt=pt;var xt=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readUIntBE(t,this.span)}encode(e,t,r=0){return we(t).writeUIntBE(e,r,this.span),this.span}};E.UIntBE=xt;var Sr=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readIntLE(t,this.span)}encode(e,t,r=0){return we(t).writeIntLE(e,r,this.span),this.span}};E.Int=Sr;var qr=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readIntBE(t,this.span)}encode(e,t,r=0){return we(t).writeIntBE(e,r,this.span),this.span}};E.IntBE=qr;var Oc=Math.pow(2,32);function $i(s){let e=Math.floor(s/Oc),t=s-e*Oc;return{hi32:e,lo32:t}}function qi(s,e){return s*Oc+e}var Ei=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32LE(t),n=r.readUInt32LE(t+4);return qi(n,o)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32LE(o.lo32,r),n.writeUInt32LE(o.hi32,r+4),8}};E.NearUInt64=Ei;var Ai=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32BE(t),n=r.readUInt32BE(t+4);return qi(o,n)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32BE(o.hi32,r),n.writeUInt32BE(o.lo32,r+4),8}};E.NearUInt64BE=Ai;var Ii=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32LE(t),n=r.readInt32LE(t+4);return qi(n,o)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32LE(o.lo32,r),n.writeInt32LE(o.hi32,r+4),8}};E.NearInt64=Ii;var Bi=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readInt32BE(t),n=r.readUInt32BE(t+4);return qi(o,n)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeInt32BE(o.hi32,r),n.writeUInt32BE(o.lo32,r+4),8}};E.NearInt64BE=Bi;var Li=class extends ke{constructor(e){super(4,e)}decode(e,t=0){return we(e).readFloatLE(t)}encode(e,t,r=0){return we(t).writeFloatLE(e,r),4}};E.Float=Li;var Ri=class extends ke{constructor(e){super(4,e)}decode(e,t=0){return we(e).readFloatBE(t)}encode(e,t,r=0){return we(t).writeFloatBE(e,r),4}};E.FloatBE=Ri;var Ci=class extends ke{constructor(e){super(8,e)}decode(e,t=0){return we(e).readDoubleLE(t)}encode(e,t,r=0){return we(t).writeDoubleLE(e,r),8}};E.Double=Ci;var Pi=class extends ke{constructor(e){super(8,e)}decode(e,t=0){return we(e).readDoubleBE(t)}encode(e,t,r=0){return we(t).writeDoubleBE(e,r),8}};E.DoubleBE=Pi;var Ti=class extends ke{constructor(e,t,r){if(!(e instanceof ke))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof ot&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let o=-1;!(t instanceof ot)&&0<e.span&&(o=t*e.span),super(o,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,o=this.count;if(o instanceof ot&&(o=o.decode(e,t)),0<this.elementLayout.span)r=o*this.elementLayout.span;else{let n=0;for(;n<o;)r+=this.elementLayout.getSpan(e,t+r),++n}return r}decode(e,t=0){let r=[],o=0,n=this.count;for(n instanceof ot&&(n=n.decode(e,t));o<n;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),o+=1;return r}encode(e,t,r=0){let o=this.elementLayout,n=e.reduce((i,c)=>i+o.encode(c,t,r+i),0);return this.count instanceof ot&&this.count.encode(e.length,t,r),n}};E.Sequence=Ti;var Oi=class extends ke{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((n,i)=>n&&i instanceof ke,!0)))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&r===void 0&&(r=t,t=void 0);for(let n of e)if(0>n.span&&n.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let o=-1;try{o=e.reduce((n,i)=>n+i.getSpan(),0)}catch{}super(o,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((o,n)=>{let i=n.getSpan(e,t);return t+=i,o+i},0)}catch{throw new RangeError("indeterminate span")}return r}decode(e,t=0){Xn(e);let r=this.makeDestinationObject();for(let o of this.fields)if(o.property!==void 0&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){let o=r,n=0,i=0;for(let c of this.fields){let l=c.span;if(i=0<l?l:0,c.property!==void 0){let p=e[c.property];p!==void 0&&(i=c.encode(p,t,r),0>l&&(l=c.getSpan(t,r)))}n=r,r+=l}return n+i-o}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)r.property!==void 0&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if(typeof e!="string")throw new TypeError("property must be string");let t=0;for(let r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}};E.Structure=Oi;var Ns=class{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,r){throw new Error("UnionDiscriminator is abstract")}};E.UnionDiscriminator=Ns;var Gn=class extends Ns{constructor(e,t){if(!(e instanceof ot&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}};E.UnionLayoutDiscriminator=Gn;var Fs=class extends ke{constructor(e,t,r){let o;if(e instanceof pt||e instanceof xt)o=new Gn(new Os(e));else if(e instanceof ot&&e.isCount())o=new Gn(e);else if(e instanceof Ns)o=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(t===void 0&&(t=null),!(t===null||t instanceof ke))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let n=-1;t&&(n=t.span,0<=n&&(e instanceof pt||e instanceof xt)&&(n+=o.layout.span)),super(n,r),this.discriminator=o,this.usesPrefixDiscriminator=e instanceof pt||e instanceof xt,this.defaultLayout=t,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return i(c)},this.configGetSourceVariant=function(c){i=c.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw new Error("unable to infer src variant")}decode(e,t=0){let r,o=this.discriminator,n=o.decode(e,t),i=this.registry[n];if(i===void 0){let c=this.defaultLayout,l=0;this.usesPrefixDiscriminator&&(l=o.layout.span),r=this.makeDestinationObject(),r[o.property]=n,r[c.property]=c.decode(e,t+l)}else r=i.decode(e,t);return r}encode(e,t,r=0){let o=this.getSourceVariant(e);if(o===void 0){let n=this.discriminator,i=this.defaultLayout,c=0;return this.usesPrefixDiscriminator&&(c=n.layout.span),n.encode(e[n.property],t,r),c+i.encode(e[i.property],t,r+c)}return o.encode(e,t,r)}addVariant(e,t,r){let o=new Ni(this,e,t,r);return this.registry[e]=o,o}getVariant(e,t=0){let r;return e instanceof Uint8Array?r=this.discriminator.decode(e,t):r=e,this.registry[r]}};E.Union=Fs;var Ni=class extends ke{constructor(e,t,r,o){if(!(e instanceof Fs))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof r=="string"&&o===void 0&&(o=r,r=null),r){if(!(r instanceof ke))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=r.span&&r.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof o!="string")throw new TypeError("variant must have a String property")}let n=e.span;0>e.span&&(n=r?r.span:0,0<=n&&e.usesPrefixDiscriminator&&(n+=e.discriminator.layout.span)),super(n,o),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let o=0;return this.layout&&(o=this.layout.getSpan(e,t+r)),r+o}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let o=0;return this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+o):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let o=0;if(this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let n=o;if(this.layout&&(this.layout.encode(e[this.property],t,r+o),n+=this.layout.getSpan(t,r+o),0<=this.union.span&&n>this.union.span))throw new Error("encoded variant overruns containing union");return n}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};E.VariantLayout=Ni;function Vn(s){return 0>s&&(s+=4294967296),s}var Us=class extends ke{constructor(e,t,r){if(!(e instanceof pt||e instanceof xt))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof t=="string"&&r===void 0&&(r=t,t=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let o=0;this._packedSetValue=function(n){return o=Vn(n),this},this._packedGetValue=function(){return o}}decode(e,t=0){let r=this.makeDestinationObject(),o=this.word.decode(e,t);this._packedSetValue(o);for(let n of this.fields)n.property!==void 0&&(r[n.property]=n.decode(e));return r}encode(e,t,r=0){let o=this.word.decode(t,r);this._packedSetValue(o);for(let n of this.fields)if(n.property!==void 0){let i=e[n.property];i!==void 0&&n.encode(i)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new Ds(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new Fi(this,e);return this.fields.push(t),t}fieldFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}};E.BitStructure=Us;var Ds=class{constructor(e,t,r){if(!(e instanceof Us))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");let o=8*e.span,n=e.fields.reduce((i,c)=>i+c.bits,0);if(t+n>o)throw new Error("bits too long for span remainder ("+(o-n)+" of "+o+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,t===32&&(this.valueMask=4294967295),this.start=n,this.container.msb&&(this.start=o-n-t),this.wordMask=Vn(this.valueMask<<this.start),this.property=r}decode(e,t){let r=this.container._packedGetValue();return Vn(r&this.wordMask)>>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==Vn(e&this.valueMask))throw new TypeError(Fc("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=Vn(e<<this.start);this.container._packedSetValue(Vn(t&~this.wordMask)|r)}};E.BitField=Ds;var Fi=class extends Ds{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){typeof e=="boolean"&&(e=+e),super.encode(e)}};E.Boolean=Fi;var Ui=class extends ke{constructor(e,t){if(!(e instanceof ot&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof ot||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),we(e).slice(t,t+r)}encode(e,t,r){let o=this.length;if(this.length instanceof ot&&(o=e.length),!(e instanceof Uint8Array&&o===e.length))throw new TypeError(Fc("Blob.encode",this)+" requires (length "+o+") Uint8Array as src");if(r+o>t.length)throw new RangeError("encoding overruns Uint8Array");let n=we(e);return we(t).write(n.toString("hex"),r,o,"hex"),this.length instanceof ot&&this.length.encode(o,t,r),o}};E.Blob=Ui;var Di=class extends ke{constructor(e){super(-1,e)}getSpan(e,t=0){Xn(e);let r=t;for(;r<e.length&&e[r]!==0;)r+=1;return 1+r-t}decode(e,t=0){let r=this.getSpan(e,t);return we(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){typeof e!="string"&&(e=String(e));let o=Nc.Buffer.from(e,"utf8"),n=o.length;if(r+n>t.length)throw new RangeError("encoding overruns Buffer");let i=we(t);return o.copy(i,r),i[r+n]=0,n+1}};E.CString=Di;var Mi=class extends ke{constructor(e,t){if(typeof e=="string"&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return Xn(e),e.length-t}decode(e,t=0){let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return we(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){typeof e!="string"&&(e=String(e));let o=Nc.Buffer.from(e,"utf8"),n=o.length;if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");if(r+n>t.length)throw new RangeError("encoding overruns Buffer");return o.copy(we(t),r),n}};E.UTF8=Mi;var zi=class extends ke{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}};E.Constant=zi;E.greedy=(s,e)=>new vi(s,e);E.offset=(s,e,t)=>new Os(s,e,t);E.u8=s=>new pt(1,s);E.u16=s=>new pt(2,s);E.u24=s=>new pt(3,s);E.u32=s=>new pt(4,s);E.u40=s=>new pt(5,s);E.u48=s=>new pt(6,s);E.nu64=s=>new Ei(s);E.u16be=s=>new xt(2,s);E.u24be=s=>new xt(3,s);E.u32be=s=>new xt(4,s);E.u40be=s=>new xt(5,s);E.u48be=s=>new xt(6,s);E.nu64be=s=>new Ai(s);E.s8=s=>new Sr(1,s);E.s16=s=>new Sr(2,s);E.s24=s=>new Sr(3,s);E.s32=s=>new Sr(4,s);E.s40=s=>new Sr(5,s);E.s48=s=>new Sr(6,s);E.ns64=s=>new Ii(s);E.s16be=s=>new qr(2,s);E.s24be=s=>new qr(3,s);E.s32be=s=>new qr(4,s);E.s40be=s=>new qr(5,s);E.s48be=s=>new qr(6,s);E.ns64be=s=>new Bi(s);E.f32=s=>new Li(s);E.f32be=s=>new Ri(s);E.f64=s=>new Ci(s);E.f64be=s=>new Pi(s);E.struct=(s,e,t)=>new Oi(s,e,t);E.bits=(s,e,t)=>new Us(s,e,t);E.seq=(s,e,t)=>new Ti(s,e,t);E.union=(s,e,t)=>new Fs(s,e,t);E.unionLayoutDiscriminator=(s,e)=>new Gn(s,e);E.blob=(s,e)=>new Ui(s,e);E.cstr=s=>new Di(s);E.utf8=(s,e)=>new Mi(s,e);E.constant=(s,e)=>new zi(s,e)});var vd=oe((vx,xd)=>{var Wi=ae("path").sep||"/";xd.exports=D0;function D0(s){if(typeof s!="string"||s.length<=7||s.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var e=decodeURI(s.substring(7)),t=e.indexOf("/"),r=e.substring(0,t),o=e.substring(t+1);return r=="localhost"&&(r=""),r&&(r=Wi+Wi+r),o=o.replace(/^(.+)\|/,"$1:"),Wi=="\\"&&(o=o.replace(/\//g,"\\")),/^.+\:/.test(o)||(o=Wi+o),r+o}});var Bd=oe((Yn,Id)=>{var Dc=ae("fs"),Hi=ae("path"),M0=vd(),Ki=Hi.join,z0=Hi.dirname,Ed=Dc.accessSync&&function(s){try{Dc.accessSync(s)}catch{return!1}return!0}||Dc.existsSync||Hi.existsSync,Ad={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function $0(s){typeof s=="string"?s={bindings:s}:s||(s={}),Object.keys(Ad).map(function(l){l in s||(s[l]=Ad[l])}),s.module_root||(s.module_root=Yn.getRoot(Yn.getFileName())),Hi.extname(s.bindings)!=".node"&&(s.bindings+=".node");for(var e=typeof __webpack_require__=="function"?__non_webpack_require__:ae,t=[],r=0,o=s.try.length,n,i,c;r<o;r++){n=Ki.apply(null,s.try[r].map(function(l){return s[l]||l})),t.push(n);try{return i=s.path?e.resolve(n):e(n),s.path||(i.path=n),i}catch(l){if(l.code!=="MODULE_NOT_FOUND"&&l.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(l.message))throw l}}throw c=new Error(`Could not locate the bindings file. Tried:
2
+ import{b as ed}from"./chunk-DEW7KMCM.js";import{a as Qf,b as r0}from"./chunk-SSMP6EWG.js";import{a as Zf}from"./chunk-7HVQTJAO.js";import{$b as Kt,D as _c,Hc as t0,Sb as $f,Tb as fi,Ub as xc,Vb as wr,W as Mf,Wb as vc,Xb as qf,Yb as Wf,Zb as Zg,_b as di,ac as Ht,bc as Hf,bd as Jf,cc as jf,dc as Vf,ec as Gf,fc as Xf,gc as Qg,hc as hi,ic as e0,pc as Yf}from"./chunk-JTQMVYTS.js";import{e as dn}from"./chunk-TW3ZXDJC.js";import{a as Kf,c as Jg}from"./chunk-NMFPLO65.js";import{c as Sc,d as Xg,h as kc,i as Yg}from"./chunk-GQE2JYJW.js";import{x as zf,y as Gg}from"./chunk-DJQ5RDDN.js";import{a as ae,b as We,c as oe,d as Ps,e as re,f as Ts,g as Df}from"./chunk-LLHU72AA.js";function l0(s){let e=Xf(s);return qf(s,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function id(s){let e=l0(s),{Fp:t,n:r,prehash:o,hash:n,randomBytes:i,nByteLength:c,h:l}=e,p=yi<<BigInt(c*8)-kt,f=t.create,b=e.uvRatio||((X,U)=>{try{return{isValid:!0,value:t.sqrt(X*t.inv(U))}}catch{return{isValid:!1,value:jt}}}),_=e.adjustScalarBytes||(X=>X),g=e.domain||((X,U,Z)=>{if(U.length||Z)throw new Error("Contexts/pre-hash are not supported");return X}),k=X=>typeof X=="bigint"&&jt<X,S=(X,U)=>k(X)&&k(U)&&X<U,A=X=>X===jt||S(X,p);function C(X,U){if(S(X,U))return X;throw new Error(`Expected valid scalar < ${U}, got ${typeof X} ${X}`)}function P(X){return X===jt?X:C(X,r)}let D=new Map;function V(X){if(!(X instanceof q))throw new Error("ExtendedPoint expected")}class q{constructor(U,Z,se,ye){if(this.ex=U,this.ey=Z,this.ez=se,this.et=ye,!A(U))throw new Error("x required");if(!A(Z))throw new Error("y required");if(!A(se))throw new Error("z required");if(!A(ye))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(U){if(U instanceof q)throw new Error("extended point not allowed");let{x:Z,y:se}=U||{};if(!A(Z)||!A(se))throw new Error("invalid affine point");return new q(Z,se,kt,f(Z*se))}static normalizeZ(U){let Z=t.invertBatch(U.map(se=>se.ez));return U.map((se,ye)=>se.toAffine(Z[ye])).map(q.fromAffine)}_setWindowSize(U){this._WINDOW_SIZE=U,D.delete(this)}assertValidity(){let{a:U,d:Z}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:se,ey:ye,ez:ge,et:ve}=this,Ce=f(se*se),Ee=f(ye*ye),Oe=f(ge*ge),Ve=f(Oe*Oe),nt=f(Ce*U),Lt=f(Oe*f(nt+Ee)),st=f(Ve+f(Z*f(Ce*Ee)));if(Lt!==st)throw new Error("bad point: equation left != right (1)");let er=f(se*ye),Wt=f(ge*ve);if(er!==Wt)throw new Error("bad point: equation left != right (2)")}equals(U){V(U);let{ex:Z,ey:se,ez:ye}=this,{ex:ge,ey:ve,ez:Ce}=U,Ee=f(Z*Ce),Oe=f(ge*ye),Ve=f(se*Ce),nt=f(ve*ye);return Ee===Oe&&Ve===nt}is0(){return this.equals(q.ZERO)}negate(){return new q(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:U}=e,{ex:Z,ey:se,ez:ye}=this,ge=f(Z*Z),ve=f(se*se),Ce=f(yi*f(ye*ye)),Ee=f(U*ge),Oe=Z+se,Ve=f(f(Oe*Oe)-ge-ve),nt=Ee+ve,Lt=nt-Ce,st=Ee-ve,er=f(Ve*Lt),Wt=f(nt*st),Mn=f(Ve*st),zn=f(Lt*nt);return new q(er,Wt,zn,Mn)}add(U){V(U);let{a:Z,d:se}=e,{ex:ye,ey:ge,ez:ve,et:Ce}=this,{ex:Ee,ey:Oe,ez:Ve,et:nt}=U;if(Z===BigInt(-1)){let ei=f((ge-ye)*(Oe+Ee)),vs=f((ge+ye)*(Oe-Ee)),Es=f(vs-ei);if(Es===jt)return this.double();let ti=f(ve*yi*nt),As=f(Ce*yi*Ve),ri=As+ti,ni=vs+ei,si=As-ti,uc=f(ri*Es),lc=f(ni*si),fc=f(ri*si),oi=f(Es*ni);return new q(uc,lc,oi,fc)}let Lt=f(ye*Ee),st=f(ge*Oe),er=f(Ce*se*nt),Wt=f(ve*Ve),Mn=f((ye+ge)*(Ee+Oe)-Lt-st),zn=Wt-er,$n=Wt+er,qn=f(st-Z*Lt),Zo=f(Mn*zn),ln=f($n*qn),fn=f(Mn*qn),Qo=f(zn*$n);return new q(Zo,ln,Qo,fn)}subtract(U){return this.add(U.negate())}wNAF(U){return Re.wNAFCached(this,D,U,q.normalizeZ)}multiply(U){let{p:Z,f:se}=this.wNAF(C(U,r));return q.normalizeZ([Z,se])[0]}multiplyUnsafe(U){let Z=P(U);return Z===jt?de:this.equals(de)||Z===kt?this:this.equals(fe)?this.wNAF(Z).p:Re.unsafeLadder(this,Z)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return Re.unsafeLadder(this,r).is0()}toAffine(U){let{ex:Z,ey:se,ez:ye}=this,ge=this.is0();U==null&&(U=ge?c0:t.inv(ye));let ve=f(Z*U),Ce=f(se*U),Ee=f(ye*U);if(ge)return{x:jt,y:kt};if(Ee!==kt)throw new Error("invZ was invalid");return{x:ve,y:Ce}}clearCofactor(){let{h:U}=e;return U===kt?this:this.multiplyUnsafe(U)}static fromHex(U,Z=!1){let{d:se,a:ye}=e,ge=t.BYTES;U=wr("pointHex",U,ge);let ve=U.slice(),Ce=U[ge-1];ve[ge-1]=Ce&-129;let Ee=fi(ve);Ee===jt||(Z?C(Ee,p):C(Ee,t.ORDER));let Oe=f(Ee*Ee),Ve=f(Oe-kt),nt=f(se*Oe-ye),{isValid:Lt,value:st}=b(Ve,nt);if(!Lt)throw new Error("Point.fromHex: invalid y coordinate");let er=(st&kt)===kt,Wt=(Ce&128)!==0;if(!Z&&st===jt&&Wt)throw new Error("Point.fromHex: x=0 and x_0=1");return Wt!==er&&(st=f(-st)),q.fromAffine({x:st,y:Ee})}static fromPrivateKey(U){return rt(U).point}toRawBytes(){let{x:U,y:Z}=this.toAffine(),se=xc(Z,t.BYTES);return se[se.length-1]|=U&kt?128:0,se}toHex(){return $f(this.toRawBytes())}}q.BASE=new q(e.Gx,e.Gy,kt,f(e.Gx*e.Gy)),q.ZERO=new q(jt,kt,kt,jt);let{BASE:fe,ZERO:de}=q,Re=Gf(q,c*8);function ut(X){return Kt(X,r)}function $e(X){return ut(fi(X))}function rt(X){let U=c;X=wr("private key",X,U);let Z=wr("hashed private key",n(X),2*U),se=_(Z.slice(0,U)),ye=Z.slice(U,2*U),ge=$e(se),ve=fe.multiply(ge),Ce=ve.toRawBytes();return{head:se,prefix:ye,scalar:ge,point:ve,pointBytes:Ce}}function Qt(X){return rt(X).pointBytes}function ks(X=new Uint8Array,...U){let Z=vc(...U);return $e(n(g(Z,wr("context",X),!!o)))}function Jo(X,U,Z={}){X=wr("message",X),o&&(X=o(X));let{prefix:se,scalar:ye,pointBytes:ge}=rt(U),ve=ks(Z.context,se,X),Ce=fe.multiply(ve).toRawBytes(),Ee=ks(Z.context,Ce,ge,X),Oe=ut(ve+Ee*ye);P(Oe);let Ve=vc(Ce,xc(Oe,t.BYTES));return wr("result",Ve,c*2)}let Dr=u0;function xs(X,U,Z,se=Dr){let{context:ye,zip215:ge}=se,ve=t.BYTES;X=wr("signature",X,2*ve),U=wr("message",U),o&&(U=o(U));let Ce=fi(X.slice(ve,2*ve)),Ee,Oe,Ve;try{Ee=q.fromHex(Z,ge),Oe=q.fromHex(X.slice(0,ve),ge),Ve=fe.multiplyUnsafe(Ce)}catch{return!1}if(!ge&&Ee.isSmallOrder())return!1;let nt=ks(ye,Oe.toRawBytes(),Ee.toRawBytes(),U);return Oe.add(Ee.multiplyUnsafe(nt)).subtract(Ve).clearCofactor().equals(q.ZERO)}return fe._setWindowSize(8),{CURVE:e,getPublicKey:Qt,sign:Jo,verify:xs,ExtendedPoint:q,utils:{getExtendedPublicKey:rt,randomPrivateKey:()=>i(t.BYTES),precompute(X=8,U=q.BASE){return U._setWindowSize(X),U.multiply(BigInt(3)),U}}}}var jt,kt,yi,c0,u0,ad=We(()=>{Qg();Vf();Wf();Wf();jt=BigInt(0),kt=BigInt(1),yi=BigInt(2),c0=BigInt(8),u0={zip215:!0}});function p0(s){let e=BigInt(10),t=BigInt(20),r=BigInt(40),o=BigInt(80),n=Ic,c=s*s%n*s%n,l=Ht(c,ud,n)*c%n,p=Ht(l,f0,n)*s%n,f=Ht(p,d0,n)*p%n,b=Ht(f,e,n)*f%n,_=Ht(b,t,n)*b%n,g=Ht(_,r,n)*_%n,k=Ht(g,o,n)*g%n,S=Ht(k,o,n)*g%n,A=Ht(S,e,n)*f%n;return{pow_p_5_8:Ht(A,ud,n)*s%n,b2:c}}function y0(s){return s[0]&=248,s[31]&=127,s[31]|=64,s}function m0(s,e){let t=Ic,r=Kt(e*e*e,t),o=Kt(r*r*e,t),n=p0(s*o).pow_p_5_8,i=Kt(s*r*n,t),c=Kt(e*i*i,t),l=i,p=Kt(i*cd,t),f=c===s,b=c===Kt(-s,t),_=c===Kt(-s*cd,t);return f&&(i=l),(b||_)&&(i=p),Hf(i,t)&&(i=Kt(-i,t)),{isValid:f||b,value:i}}var Ic,cd,mx,f0,ud,gx,d0,h0,g0,b0,pn,ld=We(()=>{r0();Gg();ad();Vf();Ic=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),cd=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),mx=BigInt(0),f0=BigInt(1),ud=BigInt(2),gx=BigInt(3),d0=BigInt(5),h0=BigInt(8);g0=(()=>jf(Ic,void 0,!0))(),b0=(()=>({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:g0,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:h0,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Qf,randomBytes:zf,adjustScalarBytes:y0,uvRatio:m0}))(),pn=(()=>id(b0))()});var hd=oe((Bc,dd)=>{var mi=ae("buffer"),tr=mi.Buffer;function fd(s,e){for(var t in s)e[t]=s[t]}tr.from&&tr.alloc&&tr.allocUnsafe&&tr.allocUnsafeSlow?dd.exports=mi:(fd(mi,Bc),Bc.Buffer=yn);function yn(s,e,t){return tr(s,e,t)}yn.prototype=Object.create(tr.prototype);fd(tr,yn);yn.from=function(s,e,t){if(typeof s=="number")throw new TypeError("Argument must not be a number");return tr(s,e,t)};yn.alloc=function(s,e,t){if(typeof s!="number")throw new TypeError("Argument must be a number");var r=tr(s);return e!==void 0?typeof t=="string"?r.fill(e,t):r.fill(e):r.fill(0),r};yn.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return tr(s)};yn.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return mi.SlowBuffer(s)}});var yd=oe((wx,pd)=>{"use strict";var gi=hd().Buffer;function w0(s){if(s.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),t=0;t<e.length;t++)e[t]=255;for(var r=0;r<s.length;r++){var o=s.charAt(r),n=o.charCodeAt(0);if(e[n]!==255)throw new TypeError(o+" is ambiguous");e[n]=r}var i=s.length,c=s.charAt(0),l=Math.log(i)/Math.log(256),p=Math.log(256)/Math.log(i);function f(g){if((Array.isArray(g)||g instanceof Uint8Array)&&(g=gi.from(g)),!gi.isBuffer(g))throw new TypeError("Expected Buffer");if(g.length===0)return"";for(var k=0,S=0,A=0,C=g.length;A!==C&&g[A]===0;)A++,k++;for(var P=(C-A)*p+1>>>0,D=new Uint8Array(P);A!==C;){for(var V=g[A],q=0,fe=P-1;(V!==0||q<S)&&fe!==-1;fe--,q++)V+=256*D[fe]>>>0,D[fe]=V%i>>>0,V=V/i>>>0;if(V!==0)throw new Error("Non-zero carry");S=q,A++}for(var de=P-S;de!==P&&D[de]===0;)de++;for(var Re=c.repeat(k);de<P;++de)Re+=s.charAt(D[de]);return Re}function b(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return gi.alloc(0);for(var k=0,S=0,A=0;g[k]===c;)S++,k++;for(var C=(g.length-k)*l+1>>>0,P=new Uint8Array(C);g[k];){var D=e[g.charCodeAt(k)];if(D===255)return;for(var V=0,q=C-1;(D!==0||V<A)&&q!==-1;q--,V++)D+=i*P[q]>>>0,P[q]=D%256>>>0,D=D/256>>>0;if(D!==0)throw new Error("Non-zero carry");A=V,k++}for(var fe=C-A;fe!==C&&P[fe]===0;)fe++;var de=gi.allocUnsafe(S+(C-fe));de.fill(0,0,S);for(var Re=S;fe!==C;)de[Re++]=P[fe++];return de}function _(g){var k=b(g);if(k)return k;throw new Error("Non-base"+i+" character")}return{encode:f,decodeUnsafe:b,decode:_}}pd.exports=w0});var Hn=oe((_x,md)=>{var _0=yd(),S0="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";md.exports=_0(S0)});var gd=oe(Cc=>{"use strict";function _r(s,e,t){return e<=s&&s<=t}function ki(s){if(s===void 0)return{};if(s===Object(s))return s;throw TypeError("Could not convert argument to dictionary")}function k0(s){for(var e=String(s),t=e.length,r=0,o=[];r<t;){var n=e.charCodeAt(r);if(n<55296||n>57343)o.push(n);else if(56320<=n&&n<=57343)o.push(65533);else if(55296<=n&&n<=56319)if(r===t-1)o.push(65533);else{var i=s.charCodeAt(r+1);if(56320<=i&&i<=57343){var c=n&1023,l=i&1023;o.push(65536+(c<<10)+l),r+=1}else o.push(65533)}r+=1}return o}function x0(s){for(var e="",t=0;t<s.length;++t){var r=s[t];r<=65535?e+=String.fromCharCode(r):(r-=65536,e+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return e}var bi=-1;function Rc(s){this.tokens=[].slice.call(s)}Rc.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():bi},prepend:function(s){if(Array.isArray(s))for(var e=s;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(s)},push:function(s){if(Array.isArray(s))for(var e=s;e.length;)this.tokens.push(e.shift());else this.tokens.push(s)}};var jn=-1;function Lc(s,e){if(s)throw TypeError("Decoder error");return e||65533}var wi="utf-8";function _i(s,e){if(!(this instanceof _i))return new _i(s,e);if(s=s!==void 0?String(s).toLowerCase():wi,s!==wi)throw new Error("Encoding not supported. Only utf-8 is supported");e=ki(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}_i.prototype={decode:function(e,t){var r;typeof e=="object"&&e instanceof ArrayBuffer?r=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):r=new Uint8Array(0),t=ki(t),this._streaming||(this._decoder=new v0({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var o=new Rc(r),n=[],i;!o.endOfStream()&&(i=this._decoder.handler(o,o.read()),i!==jn);)i!==null&&(Array.isArray(i)?n.push.apply(n,i):n.push(i));if(!this._streaming){do{if(i=this._decoder.handler(o,o.read()),i===jn)break;i!==null&&(Array.isArray(i)?n.push.apply(n,i):n.push(i))}while(!o.endOfStream());this._decoder=null}return n.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(n[0]===65279?(this._BOMseen=!0,n.shift()):this._BOMseen=!0),x0(n)}};function Si(s,e){if(!(this instanceof Si))return new Si(s,e);if(s=s!==void 0?String(s).toLowerCase():wi,s!==wi)throw new Error("Encoding not supported. Only utf-8 is supported");e=ki(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}Si.prototype={encode:function(e,t){e=e?String(e):"",t=ki(t),this._streaming||(this._encoder=new E0(this._options)),this._streaming=!!t.stream;for(var r=[],o=new Rc(k0(e)),n;!o.endOfStream()&&(n=this._encoder.handler(o,o.read()),n!==jn);)Array.isArray(n)?r.push.apply(r,n):r.push(n);if(!this._streaming){for(;n=this._encoder.handler(o,o.read()),n!==jn;)Array.isArray(n)?r.push.apply(r,n):r.push(n);this._encoder=null}return new Uint8Array(r)}};function v0(s){var e=s.fatal,t=0,r=0,o=0,n=128,i=191;this.handler=function(c,l){if(l===bi&&o!==0)return o=0,Lc(e);if(l===bi)return jn;if(o===0){if(_r(l,0,127))return l;if(_r(l,194,223))o=1,t=l-192;else if(_r(l,224,239))l===224&&(n=160),l===237&&(i=159),o=2,t=l-224;else if(_r(l,240,244))l===240&&(n=144),l===244&&(i=143),o=3,t=l-240;else return Lc(e);return t=t<<6*o,null}if(!_r(l,n,i))return t=o=r=0,n=128,i=191,c.prepend(l),Lc(e);if(n=128,i=191,r+=1,t+=l-128<<6*(o-r),r!==o)return null;var p=t;return t=o=r=0,p}}function E0(s){var e=s.fatal;this.handler=function(t,r){if(r===bi)return jn;if(_r(r,0,127))return r;var o,n;_r(r,128,2047)?(o=1,n=192):_r(r,2048,65535)?(o=2,n=224):_r(r,65536,1114111)&&(o=3,n=240);for(var i=[(r>>6*o)+n];o>0;){var c=r>>6*(o-1);i.push(128|c&63),o-=1}return i}}Cc.TextEncoder=Si;Cc.TextDecoder=_i});var kd=oe(Le=>{"use strict";var A0=Le&&Le.__createBinding||(Object.create?function(s,e,t,r){r===void 0&&(r=t),Object.defineProperty(s,r,{enumerable:!0,get:function(){return e[t]}})}:function(s,e,t,r){r===void 0&&(r=t),s[r]=e[t]}),I0=Le&&Le.__setModuleDefault||(Object.create?function(s,e){Object.defineProperty(s,"default",{enumerable:!0,value:e})}:function(s,e){s.default=e}),rr=Le&&Le.__decorate||function(s,e,t,r){var o=arguments.length,n=o<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,i;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")n=Reflect.decorate(s,e,t,r);else for(var c=s.length-1;c>=0;c--)(i=s[c])&&(n=(o<3?i(n):o>3?i(e,t,n):i(e,t))||n);return o>3&&n&&Object.defineProperty(e,t,n),n},B0=Le&&Le.__importStar||function(s){if(s&&s.__esModule)return s;var e={};if(s!=null)for(var t in s)t!=="default"&&Object.hasOwnProperty.call(s,t)&&A0(e,s,t);return I0(e,s),e},bd=Le&&Le.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(Le,"__esModule",{value:!0});Le.deserializeUnchecked=Le.deserialize=Le.serialize=Le.BinaryReader=Le.BinaryWriter=Le.BorshError=Le.baseDecode=Le.baseEncode=void 0;var $r=bd(dn()),wd=bd(Hn()),L0=B0(gd()),R0=typeof TextDecoder!="function"?L0.TextDecoder:TextDecoder,C0=new R0("utf-8",{fatal:!0});function P0(s){return typeof s=="string"&&(s=Buffer.from(s,"utf8")),wd.default.encode(Buffer.from(s))}Le.baseEncode=P0;function T0(s){return Buffer.from(wd.default.decode(s))}Le.baseDecode=T0;var Pc=1024,et=class extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Le.BorshError=et;var xi=class{constructor(){this.buf=Buffer.alloc(Pc),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(Pc)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Buffer.from(new $r.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),e,Buffer.alloc(Pc)]),this.length+=e.length}writeString(e){this.maybeResize();let t=Buffer.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(Buffer.from(e))}writeArray(e,t){this.maybeResize(),this.writeU32(e.length);for(let r of e)this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}};Le.BinaryWriter=xi;function nr(s,e,t){let r=t.value;t.value=function(...o){try{return r.apply(this,o)}catch(n){if(n instanceof RangeError){let i=n.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(i)>=0)throw new et("Reached the end of buffer when deserializing")}throw n}}}var lt=class{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new $r.default(e,"le")}readU128(){let e=this.readBuffer(16);return new $r.default(e,"le")}readU256(){let e=this.readBuffer(32);return new $r.default(e,"le")}readU512(){let e=this.readBuffer(64);return new $r.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new et(`Expected buffer length ${e} isn't within bounds`);let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return C0.decode(t)}catch(r){throw new et(`Error decoding UTF-8 string: ${r}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=Array();for(let o=0;o<t;++o)r.push(e());return r}};rr([nr],lt.prototype,"readU8",null);rr([nr],lt.prototype,"readU16",null);rr([nr],lt.prototype,"readU32",null);rr([nr],lt.prototype,"readU64",null);rr([nr],lt.prototype,"readU128",null);rr([nr],lt.prototype,"readU256",null);rr([nr],lt.prototype,"readU512",null);rr([nr],lt.prototype,"readString",null);rr([nr],lt.prototype,"readFixedArray",null);rr([nr],lt.prototype,"readArray",null);Le.BinaryReader=lt;function _d(s){return s.charAt(0).toUpperCase()+s.slice(1)}function mn(s,e,t,r,o){try{if(typeof r=="string")o[`write${_d(r)}`](t);else if(r instanceof Array)if(typeof r[0]=="number"){if(t.length!==r[0])throw new et(`Expecting byte array of length ${r[0]}, but got ${t.length} bytes`);o.writeFixedArray(t)}else if(r.length===2&&typeof r[1]=="number"){if(t.length!==r[1])throw new et(`Expecting byte array of length ${r[1]}, but got ${t.length} bytes`);for(let n=0;n<r[1];n++)mn(s,null,t[n],r[0],o)}else o.writeArray(t,n=>{mn(s,e,n,r[0],o)});else if(r.kind!==void 0)switch(r.kind){case"option":{t==null?o.writeU8(0):(o.writeU8(1),mn(s,e,t,r.type,o));break}case"map":{o.writeU32(t.size),t.forEach((n,i)=>{mn(s,e,i,r.key,o),mn(s,e,n,r.value,o)});break}default:throw new et(`FieldType ${r} unrecognized`)}else Sd(s,t,o)}catch(n){throw n instanceof et&&n.addToFieldPath(e),n}}function Sd(s,e,t){if(typeof e.borshSerialize=="function"){e.borshSerialize(t);return}let r=s.get(e.constructor);if(!r)throw new et(`Class ${e.constructor.name} is missing in schema`);if(r.kind==="struct")r.fields.map(([o,n])=>{mn(s,o,e[o],n,t)});else if(r.kind==="enum"){let o=e[r.field];for(let n=0;n<r.values.length;++n){let[i,c]=r.values[n];if(i===o){t.writeU8(n),mn(s,i,e[i],c,t);break}}}else throw new et(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}function O0(s,e,t=xi){let r=new t;return Sd(s,e,r),r.toArray()}Le.serialize=O0;function gn(s,e,t,r){try{if(typeof t=="string")return r[`read${_d(t)}`]();if(t instanceof Array){if(typeof t[0]=="number")return r.readFixedArray(t[0]);if(typeof t[1]=="number"){let o=[];for(let n=0;n<t[1];n++)o.push(gn(s,null,t[0],r));return o}else return r.readArray(()=>gn(s,e,t[0],r))}if(t.kind==="option")return r.readU8()?gn(s,e,t.type,r):void 0;if(t.kind==="map"){let o=new Map,n=r.readU32();for(let i=0;i<n;i++){let c=gn(s,e,t.key,r),l=gn(s,e,t.value,r);o.set(c,l)}return o}return Tc(s,t,r)}catch(o){throw o instanceof et&&o.addToFieldPath(e),o}}function Tc(s,e,t){if(typeof e.borshDeserialize=="function")return e.borshDeserialize(t);let r=s.get(e);if(!r)throw new et(`Class ${e.name} is missing in schema`);if(r.kind==="struct"){let o={};for(let[n,i]of s.get(e).fields)o[n]=gn(s,n,i,t);return new e(o)}if(r.kind==="enum"){let o=t.readU8();if(o>=r.values.length)throw new et(`Enum index: ${o} is out of range`);let[n,i]=r.values[o],c=gn(s,n,i,t);return new e({[n]:c})}throw new et(`Unexpected schema kind: ${r.kind} for ${e.constructor.name}`)}function N0(s,e,t,r=lt){let o=new r(t),n=Tc(s,e,o);if(o.offset<t.length)throw new et(`Unexpected ${t.length-o.offset} bytes after deserialized data`);return n}Le.deserialize=N0;function F0(s,e,t,r=lt){let o=new r(t);return Tc(s,e,o)}Le.deserializeUnchecked=F0});var Uc=oe(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});E.s16=E.s8=E.nu64be=E.u48be=E.u40be=E.u32be=E.u24be=E.u16be=E.nu64=E.u48=E.u40=E.u32=E.u24=E.u16=E.u8=E.offset=E.greedy=E.Constant=E.UTF8=E.CString=E.Blob=E.Boolean=E.BitField=E.BitStructure=E.VariantLayout=E.Union=E.UnionLayoutDiscriminator=E.UnionDiscriminator=E.Structure=E.Sequence=E.DoubleBE=E.Double=E.FloatBE=E.Float=E.NearInt64BE=E.NearInt64=E.NearUInt64BE=E.NearUInt64=E.IntBE=E.Int=E.UIntBE=E.UInt=E.OffsetLayout=E.GreedyCount=E.ExternalLayout=E.bindConstructorLayout=E.nameWithProperty=E.Layout=E.uint8ArrayToBuffer=E.checkUint8Array=void 0;E.constant=E.utf8=E.cstr=E.blob=E.unionLayoutDiscriminator=E.union=E.seq=E.bits=E.struct=E.f64be=E.f64=E.f32be=E.f32=E.ns64be=E.s48be=E.s40be=E.s32be=E.s24be=E.s16be=E.ns64=E.s48=E.s40=E.s32=E.s24=void 0;var Nc=ae("buffer");function Xn(s){if(!(s instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}E.checkUint8Array=Xn;function we(s){return Xn(s),Nc.Buffer.from(s.buffer,s.byteOffset,s.length)}E.uint8ArrayToBuffer=we;var ke=class{constructor(e,t){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}};E.Layout=ke;function Fc(s,e){return e.property?s+"["+e.property+"]":s}E.nameWithProperty=Fc;function U0(s,e){if(typeof s!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(s,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ke))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");s.layout_=e,e.boundConstructor_=s,e.makeDestinationObject=()=>new s,Object.defineProperty(s.prototype,"encode",{value(t,r){return e.encode(this,t,r)},writable:!0}),Object.defineProperty(s,"decode",{value(t,r){return e.decode(t,r)},writable:!0})}E.bindConstructorLayout=U0;var ot=class extends ke{isCount(){throw new Error("ExternalLayout is abstract")}};E.ExternalLayout=ot;var vi=class extends ot{constructor(e=1,t){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,t),this.elementSpan=e}isCount(){return!0}decode(e,t=0){Xn(e);let r=e.length-t;return Math.floor(r/this.elementSpan)}encode(e,t,r){return 0}};E.GreedyCount=vi;var Os=class extends ot{constructor(e,t=0,r){if(!(e instanceof ke))throw new TypeError("layout must be a Layout");if(!Number.isInteger(t))throw new TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof pt||this.layout instanceof xt}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}};E.OffsetLayout=Os;var pt=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readUIntLE(t,this.span)}encode(e,t,r=0){return we(t).writeUIntLE(e,r,this.span),this.span}};E.UInt=pt;var xt=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readUIntBE(t,this.span)}encode(e,t,r=0){return we(t).writeUIntBE(e,r,this.span),this.span}};E.UIntBE=xt;var Sr=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readIntLE(t,this.span)}encode(e,t,r=0){return we(t).writeIntLE(e,r,this.span),this.span}};E.Int=Sr;var qr=class extends ke{constructor(e,t){if(super(e,t),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,t=0){return we(e).readIntBE(t,this.span)}encode(e,t,r=0){return we(t).writeIntBE(e,r,this.span),this.span}};E.IntBE=qr;var Oc=Math.pow(2,32);function $i(s){let e=Math.floor(s/Oc),t=s-e*Oc;return{hi32:e,lo32:t}}function qi(s,e){return s*Oc+e}var Ei=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32LE(t),n=r.readUInt32LE(t+4);return qi(n,o)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32LE(o.lo32,r),n.writeUInt32LE(o.hi32,r+4),8}};E.NearUInt64=Ei;var Ai=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32BE(t),n=r.readUInt32BE(t+4);return qi(o,n)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32BE(o.hi32,r),n.writeUInt32BE(o.lo32,r+4),8}};E.NearUInt64BE=Ai;var Ii=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readUInt32LE(t),n=r.readInt32LE(t+4);return qi(n,o)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeUInt32LE(o.lo32,r),n.writeInt32LE(o.hi32,r+4),8}};E.NearInt64=Ii;var Bi=class extends ke{constructor(e){super(8,e)}decode(e,t=0){let r=we(e),o=r.readInt32BE(t),n=r.readUInt32BE(t+4);return qi(o,n)}encode(e,t,r=0){let o=$i(e),n=we(t);return n.writeInt32BE(o.hi32,r),n.writeUInt32BE(o.lo32,r+4),8}};E.NearInt64BE=Bi;var Li=class extends ke{constructor(e){super(4,e)}decode(e,t=0){return we(e).readFloatLE(t)}encode(e,t,r=0){return we(t).writeFloatLE(e,r),4}};E.Float=Li;var Ri=class extends ke{constructor(e){super(4,e)}decode(e,t=0){return we(e).readFloatBE(t)}encode(e,t,r=0){return we(t).writeFloatBE(e,r),4}};E.FloatBE=Ri;var Ci=class extends ke{constructor(e){super(8,e)}decode(e,t=0){return we(e).readDoubleLE(t)}encode(e,t,r=0){return we(t).writeDoubleLE(e,r),8}};E.Double=Ci;var Pi=class extends ke{constructor(e){super(8,e)}decode(e,t=0){return we(e).readDoubleBE(t)}encode(e,t,r=0){return we(t).writeDoubleBE(e,r),8}};E.DoubleBE=Pi;var Ti=class extends ke{constructor(e,t,r){if(!(e instanceof ke))throw new TypeError("elementLayout must be a Layout");if(!(t instanceof ot&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let o=-1;!(t instanceof ot)&&0<e.span&&(o=t*e.span),super(o,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,o=this.count;if(o instanceof ot&&(o=o.decode(e,t)),0<this.elementLayout.span)r=o*this.elementLayout.span;else{let n=0;for(;n<o;)r+=this.elementLayout.getSpan(e,t+r),++n}return r}decode(e,t=0){let r=[],o=0,n=this.count;for(n instanceof ot&&(n=n.decode(e,t));o<n;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),o+=1;return r}encode(e,t,r=0){let o=this.elementLayout,n=e.reduce((i,c)=>i+o.encode(c,t,r+i),0);return this.count instanceof ot&&this.count.encode(e.length,t,r),n}};E.Sequence=Ti;var Oi=class extends ke{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((n,i)=>n&&i instanceof ke,!0)))throw new TypeError("fields must be array of Layout instances");typeof t=="boolean"&&r===void 0&&(r=t,t=void 0);for(let n of e)if(0>n.span&&n.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let o=-1;try{o=e.reduce((n,i)=>n+i.getSpan(),0)}catch{}super(o,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((o,n)=>{let i=n.getSpan(e,t);return t+=i,o+i},0)}catch{throw new RangeError("indeterminate span")}return r}decode(e,t=0){Xn(e);let r=this.makeDestinationObject();for(let o of this.fields)if(o.property!==void 0&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){let o=r,n=0,i=0;for(let c of this.fields){let l=c.span;if(i=0<l?l:0,c.property!==void 0){let p=e[c.property];p!==void 0&&(i=c.encode(p,t,r),0>l&&(l=c.getSpan(t,r)))}n=r,r+=l}return n+i-o}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)r.property!==void 0&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if(typeof e!="string")throw new TypeError("property must be string");let t=0;for(let r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}};E.Structure=Oi;var Ns=class{constructor(e){this.property=e}decode(e,t){throw new Error("UnionDiscriminator is abstract")}encode(e,t,r){throw new Error("UnionDiscriminator is abstract")}};E.UnionDiscriminator=Ns;var Gn=class extends Ns{constructor(e,t){if(!(e instanceof ot&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}};E.UnionLayoutDiscriminator=Gn;var Fs=class extends ke{constructor(e,t,r){let o;if(e instanceof pt||e instanceof xt)o=new Gn(new Os(e));else if(e instanceof ot&&e.isCount())o=new Gn(e);else if(e instanceof Ns)o=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(t===void 0&&(t=null),!(t===null||t instanceof ke))throw new TypeError("defaultLayout must be null or a Layout");if(t!==null){if(0>t.span)throw new Error("defaultLayout must have constant span");t.property===void 0&&(t=t.replicate("content"))}let n=-1;t&&(n=t.span,0<=n&&(e instanceof pt||e instanceof xt)&&(n+=o.layout.span)),super(n,r),this.discriminator=o,this.usesPrefixDiscriminator=e instanceof pt||e instanceof xt,this.defaultLayout=t,this.registry={};let i=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(c){return i(c)},this.configGetSourceVariant=function(c){i=c.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw new Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw new Error("unable to infer src variant")}decode(e,t=0){let r,o=this.discriminator,n=o.decode(e,t),i=this.registry[n];if(i===void 0){let c=this.defaultLayout,l=0;this.usesPrefixDiscriminator&&(l=o.layout.span),r=this.makeDestinationObject(),r[o.property]=n,r[c.property]=c.decode(e,t+l)}else r=i.decode(e,t);return r}encode(e,t,r=0){let o=this.getSourceVariant(e);if(o===void 0){let n=this.discriminator,i=this.defaultLayout,c=0;return this.usesPrefixDiscriminator&&(c=n.layout.span),n.encode(e[n.property],t,r),c+i.encode(e[i.property],t,r+c)}return o.encode(e,t,r)}addVariant(e,t,r){let o=new Ni(this,e,t,r);return this.registry[e]=o,o}getVariant(e,t=0){let r;return e instanceof Uint8Array?r=this.discriminator.decode(e,t):r=e,this.registry[r]}};E.Union=Fs;var Ni=class extends ke{constructor(e,t,r,o){if(!(e instanceof Fs))throw new TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw new TypeError("variant must be a (non-negative) integer");if(typeof r=="string"&&o===void 0&&(o=r,r=null),r){if(!(r instanceof ke))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=r.span&&r.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof o!="string")throw new TypeError("variant must have a String property")}let n=e.span;0>e.span&&(n=r?r.span:0,0<=n&&e.usesPrefixDiscriminator&&(n+=e.discriminator.layout.span)),super(n,o),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let o=0;return this.layout&&(o=this.layout.getSpan(e,t+r)),r+o}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw new Error("variant mismatch");let o=0;return this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+o):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let o=0;if(this.union.usesPrefixDiscriminator&&(o=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let n=o;if(this.layout&&(this.layout.encode(e[this.property],t,r+o),n+=this.layout.getSpan(t,r+o),0<=this.union.span&&n>this.union.span))throw new Error("encoded variant overruns containing union");return n}fromArray(e){if(this.layout)return this.layout.fromArray(e)}};E.VariantLayout=Ni;function Vn(s){return 0>s&&(s+=4294967296),s}var Us=class extends ke{constructor(e,t,r){if(!(e instanceof pt||e instanceof xt))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof t=="string"&&r===void 0&&(r=t,t=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let o=0;this._packedSetValue=function(n){return o=Vn(n),this},this._packedGetValue=function(){return o}}decode(e,t=0){let r=this.makeDestinationObject(),o=this.word.decode(e,t);this._packedSetValue(o);for(let n of this.fields)n.property!==void 0&&(r[n.property]=n.decode(e));return r}encode(e,t,r=0){let o=this.word.decode(t,r);this._packedSetValue(o);for(let n of this.fields)if(n.property!==void 0){let i=e[n.property];i!==void 0&&n.encode(i)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new Ds(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new Fi(this,e);return this.fields.push(t),t}fieldFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}};E.BitStructure=Us;var Ds=class{constructor(e,t,r){if(!(e instanceof Us))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw new TypeError("bits must be positive integer");let o=8*e.span,n=e.fields.reduce((i,c)=>i+c.bits,0);if(t+n>o)throw new Error("bits too long for span remainder ("+(o-n)+" of "+o+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,t===32&&(this.valueMask=4294967295),this.start=n,this.container.msb&&(this.start=o-n-t),this.wordMask=Vn(this.valueMask<<this.start),this.property=r}decode(e,t){let r=this.container._packedGetValue();return Vn(r&this.wordMask)>>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==Vn(e&this.valueMask))throw new TypeError(Fc("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=Vn(e<<this.start);this.container._packedSetValue(Vn(t&~this.wordMask)|r)}};E.BitField=Ds;var Fi=class extends Ds{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){typeof e=="boolean"&&(e=+e),super.encode(e)}};E.Boolean=Fi;var Ui=class extends ke{constructor(e,t){if(!(e instanceof ot&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof ot||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),we(e).slice(t,t+r)}encode(e,t,r){let o=this.length;if(this.length instanceof ot&&(o=e.length),!(e instanceof Uint8Array&&o===e.length))throw new TypeError(Fc("Blob.encode",this)+" requires (length "+o+") Uint8Array as src");if(r+o>t.length)throw new RangeError("encoding overruns Uint8Array");let n=we(e);return we(t).write(n.toString("hex"),r,o,"hex"),this.length instanceof ot&&this.length.encode(o,t,r),o}};E.Blob=Ui;var Di=class extends ke{constructor(e){super(-1,e)}getSpan(e,t=0){Xn(e);let r=t;for(;r<e.length&&e[r]!==0;)r+=1;return 1+r-t}decode(e,t=0){let r=this.getSpan(e,t);return we(e).slice(t,t+r-1).toString("utf-8")}encode(e,t,r=0){typeof e!="string"&&(e=String(e));let o=Nc.Buffer.from(e,"utf8"),n=o.length;if(r+n>t.length)throw new RangeError("encoding overruns Buffer");let i=we(t);return o.copy(i,r),i[r+n]=0,n+1}};E.CString=Di;var Mi=class extends ke{constructor(e,t){if(typeof e=="string"&&t===void 0&&(t=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,t),this.maxSpan=e}getSpan(e,t=0){return Xn(e),e.length-t}decode(e,t=0){let r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return we(e).slice(t,t+r).toString("utf-8")}encode(e,t,r=0){typeof e!="string"&&(e=String(e));let o=Nc.Buffer.from(e,"utf8"),n=o.length;if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");if(r+n>t.length)throw new RangeError("encoding overruns Buffer");return o.copy(we(t),r),n}};E.UTF8=Mi;var zi=class extends ke{constructor(e,t){super(0,t),this.value=e}decode(e,t){return this.value}encode(e,t,r){return 0}};E.Constant=zi;E.greedy=(s,e)=>new vi(s,e);E.offset=(s,e,t)=>new Os(s,e,t);E.u8=s=>new pt(1,s);E.u16=s=>new pt(2,s);E.u24=s=>new pt(3,s);E.u32=s=>new pt(4,s);E.u40=s=>new pt(5,s);E.u48=s=>new pt(6,s);E.nu64=s=>new Ei(s);E.u16be=s=>new xt(2,s);E.u24be=s=>new xt(3,s);E.u32be=s=>new xt(4,s);E.u40be=s=>new xt(5,s);E.u48be=s=>new xt(6,s);E.nu64be=s=>new Ai(s);E.s8=s=>new Sr(1,s);E.s16=s=>new Sr(2,s);E.s24=s=>new Sr(3,s);E.s32=s=>new Sr(4,s);E.s40=s=>new Sr(5,s);E.s48=s=>new Sr(6,s);E.ns64=s=>new Ii(s);E.s16be=s=>new qr(2,s);E.s24be=s=>new qr(3,s);E.s32be=s=>new qr(4,s);E.s40be=s=>new qr(5,s);E.s48be=s=>new qr(6,s);E.ns64be=s=>new Bi(s);E.f32=s=>new Li(s);E.f32be=s=>new Ri(s);E.f64=s=>new Ci(s);E.f64be=s=>new Pi(s);E.struct=(s,e,t)=>new Oi(s,e,t);E.bits=(s,e,t)=>new Us(s,e,t);E.seq=(s,e,t)=>new Ti(s,e,t);E.union=(s,e,t)=>new Fs(s,e,t);E.unionLayoutDiscriminator=(s,e)=>new Gn(s,e);E.blob=(s,e)=>new Ui(s,e);E.cstr=s=>new Di(s);E.utf8=(s,e)=>new Mi(s,e);E.constant=(s,e)=>new zi(s,e)});var vd=oe((vx,xd)=>{var Wi=ae("path").sep||"/";xd.exports=D0;function D0(s){if(typeof s!="string"||s.length<=7||s.substring(0,7)!="file://")throw new TypeError("must pass in a file:// URI to convert to a file path");var e=decodeURI(s.substring(7)),t=e.indexOf("/"),r=e.substring(0,t),o=e.substring(t+1);return r=="localhost"&&(r=""),r&&(r=Wi+Wi+r),o=o.replace(/^(.+)\|/,"$1:"),Wi=="\\"&&(o=o.replace(/\//g,"\\")),/^.+\:/.test(o)||(o=Wi+o),r+o}});var Bd=oe((Yn,Id)=>{var Dc=ae("fs"),Hi=ae("path"),M0=vd(),Ki=Hi.join,z0=Hi.dirname,Ed=Dc.accessSync&&function(s){try{Dc.accessSync(s)}catch{return!1}return!0}||Dc.existsSync||Hi.existsSync,Ad={arrow:process.env.NODE_BINDINGS_ARROW||" \u2192 ",compiled:process.env.NODE_BINDINGS_COMPILED_DIR||"compiled",platform:process.platform,arch:process.arch,nodePreGyp:"node-v"+process.versions.modules+"-"+process.platform+"-"+process.arch,version:process.versions.node,bindings:"bindings.node",try:[["module_root","build","bindings"],["module_root","build","Debug","bindings"],["module_root","build","Release","bindings"],["module_root","out","Debug","bindings"],["module_root","Debug","bindings"],["module_root","out","Release","bindings"],["module_root","Release","bindings"],["module_root","build","default","bindings"],["module_root","compiled","version","platform","arch","bindings"],["module_root","addon-build","release","install-root","bindings"],["module_root","addon-build","debug","install-root","bindings"],["module_root","addon-build","default","install-root","bindings"],["module_root","lib","binding","nodePreGyp","bindings"]]};function $0(s){typeof s=="string"?s={bindings:s}:s||(s={}),Object.keys(Ad).map(function(l){l in s||(s[l]=Ad[l])}),s.module_root||(s.module_root=Yn.getRoot(Yn.getFileName())),Hi.extname(s.bindings)!=".node"&&(s.bindings+=".node");for(var e=typeof __webpack_require__=="function"?__non_webpack_require__:ae,t=[],r=0,o=s.try.length,n,i,c;r<o;r++){n=Ki.apply(null,s.try[r].map(function(l){return s[l]||l})),t.push(n);try{return i=s.path?e.resolve(n):e(n),s.path||(i.path=n),i}catch(l){if(l.code!=="MODULE_NOT_FOUND"&&l.code!=="QUALIFIED_PATH_RESOLUTION_FAILED"&&!/not find/i.test(l.message))throw l}}throw c=new Error(`Could not locate the bindings file. Tried:
3
3
  `+t.map(function(l){return s.arrow+l}).join(`
4
4
  `)),c.tries=t,c}Id.exports=Yn=$0;Yn.getFileName=function(e){var t=Error.prepareStackTrace,r=Error.stackTraceLimit,o={},n;Error.stackTraceLimit=10,Error.prepareStackTrace=function(c,l){for(var p=0,f=l.length;p<f;p++)if(n=l[p].getFileName(),n!==__filename)if(e){if(n!==e)return}else return},Error.captureStackTrace(o),o.stack,Error.prepareStackTrace=t,Error.stackTraceLimit=r;var i="file://";return n.indexOf(i)===0&&(n=M0(n)),n};Yn.getRoot=function(e){for(var t=z0(e),r;;){if(t==="."&&(t=process.cwd()),Ed(Ki(t,"package.json"))||Ed(Ki(t,"node_modules")))return t;if(r===t)throw new Error('Could not find module root given file: "'+e+'". Do you have a `package.json` file? ');r=t,t=Ki(t,"..")}}});var Ld=oe(Jn=>{"use strict";Object.defineProperty(Jn,"__esModule",{value:!0});var kr;try{kr=Bd()("bigint_buffer")}catch{console.warn("bigint: Failed to load bindings, pure JS will be used (try npm run rebuild?)")}function q0(s){if(kr===void 0){let e=Buffer.from(s);e.reverse();let t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}return kr.toBigInt(s,!1)}Jn.toBigIntLE=q0;function W0(s){if(kr===void 0){let e=s.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}return kr.toBigInt(s,!0)}Jn.toBigIntBE=W0;function K0(s,e){if(kr===void 0){let t=s.toString(16),r=Buffer.from(t.padStart(e*2,"0").slice(0,e*2),"hex");return r.reverse(),r}return kr.fromBigInt(s,Buffer.allocUnsafe(e),!1)}Jn.toBufferLE=K0;function H0(s,e){if(kr===void 0){let t=s.toString(16);return Buffer.from(t.padStart(e*2,"0").slice(0,e*2),"hex")}return kr.fromBigInt(s,Buffer.allocUnsafe(e),!0)}Jn.toBufferBE=H0});function j0(s){return Wr(s)&&typeof s[Symbol.iterator]=="function"}function Wr(s){return typeof s=="object"&&s!=null}function Vt(s){return typeof s=="string"?JSON.stringify(s):""+s}function V0(s){let{done:e,value:t}=s.next();return e?void 0:t}function G0(s,e,t,r){if(s===!0)return;s===!1?s={}:typeof s=="string"&&(s={message:s});let{path:o,branch:n}=e,{type:i}=t,{refinement:c,message:l="Expected a value of type `"+i+"`"+(c?" with refinement `"+c+"`":"")+", but received: `"+Vt(r)+"`"}=s;return{value:r,type:i,refinement:c,key:o[o.length-1],path:o,branch:n,...s,message:l}}function*Rd(s,e,t,r){j0(s)||(s=[s]);for(let o of s){let n=G0(o,e,t,r);n&&(yield n)}}function*zc(s,e,t={}){let{path:r=[],branch:o=[s],coerce:n=!1,mask:i=!1}=t,c={path:r,branch:o};if(n&&(s=e.coercer(s,c),i&&e.type!=="type"&&Wr(e.schema)&&Wr(s)&&!Array.isArray(s)))for(let p in s)e.schema[p]===void 0&&delete s[p];let l=!0;for(let p of e.validator(s,c))l=!1,yield[p,void 0];for(let[p,f,b]of e.entries(s,c)){let _=zc(f,b,{path:p===void 0?r:[...r,p],branch:p===void 0?o:[...o,f],coerce:n,mask:i});for(let g of _)g[0]?(l=!1,yield[g[0],void 0]):n&&(f=g[1],p===void 0?s=f:s instanceof Map?s.set(p,f):s instanceof Set?s.add(f):Wr(s)&&(s[p]=f))}if(l)for(let p of e.refiner(s,c))l=!1,yield[p,void 0];l&&(yield[void 0,s])}function $c(s,e){let t=Ms(s,e);if(t[0])throw t[0]}function F(s,e){let t=Ms(s,e,{coerce:!0});if(t[0])throw t[0];return t[1]}function X0(s,e){let t=Ms(s,e,{coerce:!0,mask:!0});if(t[0])throw t[0];return t[1]}function Cd(s,e){return!Ms(s,e)[0]}function Ms(s,e,t={}){let r=zc(s,e,t),o=V0(r);return o[0]?[new Mc(o[0],function*(){for(let i of r)i[0]&&(yield i[0])}),void 0]:[void 0,o[1]]}function bn(s,e){return new Ot({type:s,schema:null,validator:e})}function Pd(){return bn("any",()=>!0)}function z(s){return new Ot({type:"array",schema:s,*entries(e){if(s&&Array.isArray(e))for(let[t,r]of e.entries())yield[t,r,s]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||"Expected an array value, but received: "+Vt(e)}})}function Gt(){return bn("boolean",s=>typeof s=="boolean")}function ji(s){return bn("instance",e=>e instanceof s||"Expected a `"+s.name+"` instance, but received: "+Vt(e))}function Fe(s){let e=Vt(s),t=typeof s;return new Ot({type:"literal",schema:t==="string"||t==="number"||t==="boolean"?s:null,validator(r){return r===s||"Expected the literal `"+e+"`, but received: "+Vt(r)}})}function Y0(){return bn("never",()=>!1)}function M(s){return new Ot({...s,validator:(e,t)=>e===null||s.validator(e,t),refiner:(e,t)=>e===null||s.refiner(e,t)})}function x(){return bn("number",s=>typeof s=="number"&&!isNaN(s)||"Expected a number, but received: "+Vt(s))}function Q(s){return new Ot({...s,validator:(e,t)=>e===void 0||s.validator(e,t),refiner:(e,t)=>e===void 0||s.refiner(e,t)})}function qc(s,e){return new Ot({type:"record",schema:null,*entries(t){if(Wr(t))for(let r in t){let o=t[r];yield[r,r,s],yield[r,o,e]}},validator(t){return Wr(t)||"Expected an object, but received: "+Vt(t)}})}function N(){return bn("string",s=>typeof s=="string"||"Expected a string, but received: "+Vt(s))}function Vi(s){let e=Y0();return new Ot({type:"tuple",schema:null,*entries(t){if(Array.isArray(t)){let r=Math.max(s.length,t.length);for(let o=0;o<r;o++)yield[o,t[o],s[o]||e]}},validator(t){return Array.isArray(t)||"Expected an array, but received: "+Vt(t)}})}function R(s){let e=Object.keys(s);return new Ot({type:"type",schema:s,*entries(t){if(Wr(t))for(let r of e)yield[r,t[r],s[r]]},validator(t){return Wr(t)||"Expected an object, but received: "+Vt(t)}})}function ft(s){let e=s.map(t=>t.type).join(" | ");return new Ot({type:"union",schema:null,validator(t,r){let o=[];for(let n of s){let[...i]=zc(t,n,r),[c]=i;if(c[0])for(let[l]of i)l&&o.push(l);else return[]}return["Expected the value to satisfy a union of `"+e+"`, but received: "+Vt(t),...o]}})}function Zn(){return bn("unknown",()=>!0)}function Qn(s,e,t){return new Ot({...s,coercer:(r,o)=>Cd(r,e)?s.coercer(t(r,o),o):s.coercer(r,o)})}var Mc,Ot,Td=We(()=>{Mc=class extends TypeError{constructor(e,t){let r,{message:o,...n}=e,{path:i}=e,c=i.length===0?o:"At path: "+i.join(".")+" -- "+o;super(c),Object.assign(this,n),this.name=this.constructor.name,this.failures=()=>{var l;return(l=r)!=null?l:r=[e,...t()]}}};Ot=class{constructor(e){let{type:t,schema:r,validator:o,refiner:n,coercer:i=l=>l,entries:c=function*(){}}=e;this.type=t,this.schema=r,this.entries=c,this.coercer=i,o?this.validator=(l,p)=>{let f=o(l,p);return Rd(f,p,this,l)}:this.validator=()=>[],n?this.refiner=(l,p)=>{let f=n(l,p);return Rd(f,p,this,l)}:this.refiner=()=>[]}assert(e){return $c(e,this)}create(e){return F(e,this)}is(e){return Cd(e,this)}mask(e){return X0(e,this)}validate(e,t={}){return Ms(e,this,t)}}});import J0 from"crypto";function zs(){return Gi>Xi.length-16&&(J0.randomFillSync(Xi),Gi=0),Xi.slice(Gi,Gi+=16)}var Xi,Gi,Wc=We(()=>{Xi=new Uint8Array(256),Gi=Xi.length});var Od,Nd=We(()=>{Od=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i});function Z0(s){return typeof s=="string"&&Od.test(s)}var Kr,$s=We(()=>{Nd();Kr=Z0});function Q0(s,e=0){let t=(tt[s[e+0]]+tt[s[e+1]]+tt[s[e+2]]+tt[s[e+3]]+"-"+tt[s[e+4]]+tt[s[e+5]]+"-"+tt[s[e+6]]+tt[s[e+7]]+"-"+tt[s[e+8]]+tt[s[e+9]]+"-"+tt[s[e+10]]+tt[s[e+11]]+tt[s[e+12]]+tt[s[e+13]]+tt[s[e+14]]+tt[s[e+15]]).toLowerCase();if(!Kr(t))throw TypeError("Stringified UUID is invalid");return t}var tt,Hr,qs=We(()=>{$s();tt=[];for(let s=0;s<256;++s)tt.push((s+256).toString(16).substr(1));Hr=Q0});function eb(s,e,t){let r=e&&t||0,o=e||new Array(16);s=s||{};let n=s.node||Fd,i=s.clockseq!==void 0?s.clockseq:Kc;if(n==null||i==null){let _=s.random||(s.rng||zs)();n==null&&(n=Fd=[_[0]|1,_[1],_[2],_[3],_[4],_[5]]),i==null&&(i=Kc=(_[6]<<8|_[7])&16383)}let c=s.msecs!==void 0?s.msecs:Date.now(),l=s.nsecs!==void 0?s.nsecs:jc+1,p=c-Hc+(l-jc)/1e4;if(p<0&&s.clockseq===void 0&&(i=i+1&16383),(p<0||c>Hc)&&s.nsecs===void 0&&(l=0),l>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Hc=c,jc=l,Kc=i,c+=122192928e5;let f=((c&268435455)*1e4+l)%4294967296;o[r++]=f>>>24&255,o[r++]=f>>>16&255,o[r++]=f>>>8&255,o[r++]=f&255;let b=c/4294967296*1e4&268435455;o[r++]=b>>>8&255,o[r++]=b&255,o[r++]=b>>>24&15|16,o[r++]=b>>>16&255,o[r++]=i>>>8|128,o[r++]=i&255;for(let _=0;_<6;++_)o[r+_]=n[_];return e||Hr(o)}var Fd,Kc,Hc,jc,Ud,Dd=We(()=>{Wc();qs();Hc=0,jc=0;Ud=eb});function tb(s){if(!Kr(s))throw TypeError("Invalid UUID");let e,t=new Uint8Array(16);return t[0]=(e=parseInt(s.slice(0,8),16))>>>24,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t[4]=(e=parseInt(s.slice(9,13),16))>>>8,t[5]=e&255,t[6]=(e=parseInt(s.slice(14,18),16))>>>8,t[7]=e&255,t[8]=(e=parseInt(s.slice(19,23),16))>>>8,t[9]=e&255,t[10]=(e=parseInt(s.slice(24,36),16))/1099511627776&255,t[11]=e/4294967296&255,t[12]=e>>>24&255,t[13]=e>>>16&255,t[14]=e>>>8&255,t[15]=e&255,t}var Yi,Vc=We(()=>{$s();Yi=tb});function rb(s){s=unescape(encodeURIComponent(s));let e=[];for(let t=0;t<s.length;++t)e.push(s.charCodeAt(t));return e}function Ji(s,e,t){function r(o,n,i,c){if(typeof o=="string"&&(o=rb(o)),typeof n=="string"&&(n=Yi(n)),n.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");let l=new Uint8Array(16+o.length);if(l.set(n),l.set(o,n.length),l=t(l),l[6]=l[6]&15|e,l[8]=l[8]&63|128,i){c=c||0;for(let p=0;p<16;++p)i[c+p]=l[p];return i}return Hr(l)}try{r.name=s}catch{}return r.DNS=nb,r.URL=sb,r}var nb,sb,Gc=We(()=>{qs();Vc();nb="6ba7b810-9dad-11d1-80b4-00c04fd430c8",sb="6ba7b811-9dad-11d1-80b4-00c04fd430c8"});import ob from"crypto";function ib(s){return Array.isArray(s)?s=Buffer.from(s):typeof s=="string"&&(s=Buffer.from(s,"utf8")),ob.createHash("md5").update(s).digest()}var Md,zd=We(()=>{Md=ib});var ab,$d,qd=We(()=>{Gc();zd();ab=Ji("v3",48,Md),$d=ab});function cb(s,e,t){s=s||{};let r=s.random||(s.rng||zs)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,e){t=t||0;for(let o=0;o<16;++o)e[t+o]=r[o];return e}return Hr(r)}var Wd,Kd=We(()=>{Wc();qs();Wd=cb});import ub from"crypto";function lb(s){return Array.isArray(s)?s=Buffer.from(s):typeof s=="string"&&(s=Buffer.from(s,"utf8")),ub.createHash("sha1").update(s).digest()}var Hd,jd=We(()=>{Hd=lb});var fb,Vd,Gd=We(()=>{Gc();jd();fb=Ji("v5",80,Hd),Vd=fb});var Xd,Yd=We(()=>{Xd="00000000-0000-0000-0000-000000000000"});function db(s){if(!Kr(s))throw TypeError("Invalid UUID");return parseInt(s.substr(14,1),16)}var Jd,Zd=We(()=>{$s();Jd=db});var Xc={};Ps(Xc,{NIL:()=>Xd,parse:()=>Yi,stringify:()=>Hr,v1:()=>Ud,v3:()=>$d,v4:()=>Wd,v5:()=>Vd,validate:()=>Kr,version:()=>Jd});var Yc=We(()=>{Dd();qd();Kd();Gd();Yd();Zd();$s();qs();Vc()});var eh=oe((pv,Qd)=>{"use strict";var hb=(Yc(),Ts(Xc)).v4,pb=function(s,e,t,r){if(typeof s!="string")throw new TypeError(s+" must be a string");r=r||{};let o=typeof r.version=="number"?r.version:2;if(o!==1&&o!==2)throw new TypeError(o+" must be 1 or 2");let n={method:s};if(o===2&&(n.jsonrpc="2.0"),e){if(typeof e!="object"&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");n.params=e}if(typeof t>"u"){let i=typeof r.generator=="function"?r.generator:function(){return hb()};n.id=i(n,r)}else o===2&&t===null?r.notificationIdNull&&(n.id=null):n.id=t;return n};Qd.exports=pb});var rh=oe((yv,th)=>{"use strict";var yb=(Yc(),Ts(Xc)).v4,mb=eh(),Ws=function(s,e){if(!(this instanceof Ws))return new Ws(s,e);e||(e={}),this.options={reviver:typeof e.reviver<"u"?e.reviver:null,replacer:typeof e.replacer<"u"?e.replacer:null,generator:typeof e.generator<"u"?e.generator:function(){return yb()},version:typeof e.version<"u"?e.version:2,notificationIdNull:typeof e.notificationIdNull=="boolean"?e.notificationIdNull:!1},this.callServer=s};th.exports=Ws;Ws.prototype.request=function(s,e,t,r){let o=this,n=null,i=Array.isArray(s)&&typeof e=="function";if(this.options.version===1&&i)throw new TypeError("JSON-RPC 1.0 does not support batching");if(i||!i&&s&&typeof s=="object"&&typeof e=="function")r=e,n=s;else{typeof t=="function"&&(r=t,t=void 0);let p=typeof r=="function";try{n=mb(s,e,t,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(f){if(p)return r(f);throw f}if(!p)return n}let l;try{l=JSON.stringify(n,this.options.replacer)}catch(p){return r(p)}return this.callServer(l,function(p,f){o._parseResponse(p,f,r)}),n};Ws.prototype._parseResponse=function(s,e,t){if(s){t(s);return}if(!e)return t();let r;try{r=JSON.parse(e,this.options.reviver)}catch(o){return t(o)}if(t.length===3)if(Array.isArray(r)){let o=function(i){return typeof i.error<"u"},n=function(i){return!o(i)};return t(null,r.filter(o),r.filter(n))}else return t(null,r.error,r.result);t(null,r)}});var Qi=oe((mv,Jc)=>{"use strict";var gb=Object.prototype.hasOwnProperty,dt="~";function Ks(){}Object.create&&(Ks.prototype=Object.create(null),new Ks().__proto__||(dt=!1));function bb(s,e,t){this.fn=s,this.context=e,this.once=t||!1}function nh(s,e,t,r,o){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new bb(t,r||s,o),i=dt?dt+e:e;return s._events[i]?s._events[i].fn?s._events[i]=[s._events[i],n]:s._events[i].push(n):(s._events[i]=n,s._eventsCount++),s}function Zi(s,e){--s._eventsCount===0?s._events=new Ks:delete s._events[e]}function it(){this._events=new Ks,this._eventsCount=0}it.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)gb.call(t,r)&&e.push(dt?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};it.prototype.listeners=function(e){var t=dt?dt+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var o=0,n=r.length,i=new Array(n);o<n;o++)i[o]=r[o].fn;return i};it.prototype.listenerCount=function(e){var t=dt?dt+e:e,r=this._events[t];return r?r.fn?1:r.length:0};it.prototype.emit=function(e,t,r,o,n,i){var c=dt?dt+e:e;if(!this._events[c])return!1;var l=this._events[c],p=arguments.length,f,b;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),p){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,o),!0;case 5:return l.fn.call(l.context,t,r,o,n),!0;case 6:return l.fn.call(l.context,t,r,o,n,i),!0}for(b=1,f=new Array(p-1);b<p;b++)f[b-1]=arguments[b];l.fn.apply(l.context,f)}else{var _=l.length,g;for(b=0;b<_;b++)switch(l[b].once&&this.removeListener(e,l[b].fn,void 0,!0),p){case 1:l[b].fn.call(l[b].context);break;case 2:l[b].fn.call(l[b].context,t);break;case 3:l[b].fn.call(l[b].context,t,r);break;case 4:l[b].fn.call(l[b].context,t,r,o);break;default:if(!f)for(g=1,f=new Array(p-1);g<p;g++)f[g-1]=arguments[g];l[b].fn.apply(l[b].context,f)}}return!0};it.prototype.on=function(e,t,r){return nh(this,e,t,r,!1)};it.prototype.once=function(e,t,r){return nh(this,e,t,r,!0)};it.prototype.removeListener=function(e,t,r,o){var n=dt?dt+e:e;if(!this._events[n])return this;if(!t)return Zi(this,n),this;var i=this._events[n];if(i.fn)i.fn===t&&(!o||i.once)&&(!r||i.context===r)&&Zi(this,n);else{for(var c=0,l=[],p=i.length;c<p;c++)(i[c].fn!==t||o&&!i[c].once||r&&i[c].context!==r)&&l.push(i[c]);l.length?this._events[n]=l.length===1?l[0]:l:Zi(this,n)}return this};it.prototype.removeAllListeners=function(e){var t;return e?(t=dt?dt+e:e,this._events[t]&&Zi(this,t)):(this._events=new Ks,this._eventsCount=0),this};it.prototype.off=it.prototype.removeListener;it.prototype.addListener=it.prototype.on;it.prefixed=dt;it.EventEmitter=it;typeof Jc<"u"&&(Jc.exports=it)});var sh=oe(es=>{"use strict";Object.defineProperty(es,"__esModule",{value:!0});es.createError=es.DefaultDataPack=void 0;var wb=new Map([[-32e3,"Event not provided"],[-32600,"Invalid Request"],[-32601,"Method not found"],[-32602,"Invalid params"],[-32603,"Internal error"],[-32604,"Params not found"],[-32605,"Method forbidden"],[-32606,"Event forbidden"],[-32700,"Parse error"]]),Zc=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}};es.DefaultDataPack=Zc;function _b(s,e){let t={code:s,message:wb.get(s)||"Internal Server Error"};return e&&(t.data=e),t}es.createError=_b});var oh=oe(eu=>{"use strict";Object.defineProperty(eu,"__esModule",{value:!0});var Sb=Qi(),kb=sh(),Qc=class extends Sb.EventEmitter{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:r=!0,reconnect:o=!0,reconnect_interval:n=1e3,max_reconnects:i=5,...c}={},l,p){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=r,this.ready=!1,this.reconnect=o,this.reconnect_timer_id=void 0,this.reconnect_interval=n,this.max_reconnects=i,this.rest_options=c,this.current_reconnects=0,this.generate_request_id=l||(()=>++this.rpc_id),p?this.dataPack=p:this.dataPack=new kb.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,r,o){return!o&&typeof r=="object"&&(o=r,r=null),new Promise((n,i)=>{if(!this.ready)return i(new Error("socket not ready"));let c=this.generate_request_id(e,t),l={jsonrpc:"2.0",method:e,params:t||void 0,id:c};this.socket.send(this.dataPack.encode(l),o,p=>{if(p)return i(p);this.queue[c]={promise:[n,i]},r&&(this.queue[c].timeout=setTimeout(()=>{delete this.queue[c],i(new Error("reply timeout"))},r))})})}async login(e){let t=await this.call("rpc.login",e);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise((r,o)=>{if(!this.ready)return o(new Error("socket not ready"));let n={jsonrpc:"2.0",method:e,params:t};this.socket.send(this.dataPack.encode(n),i=>{if(i)return o(i);r()})})}async subscribe(e){typeof e=="string"&&(e=[e]);let t=await this.call("rpc.on",e);if(typeof e=="string"&&t[e]!=="ok")throw new Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){typeof e=="string"&&(e=[e]);let t=await this.call("rpc.off",e);if(typeof e=="string"&&t[e]!=="ok")throw new Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:r})=>{r instanceof ArrayBuffer&&(r=Buffer.from(r).toString());try{r=this.dataPack.decode(r)}catch{return}if(r.notification&&this.listeners(r.notification).length){if(!Object.keys(r.params).length)return this.emit(r.notification);let o=[r.notification];if(r.params.constructor===Object)o.push(r.params);else for(let n=0;n<r.params.length;n++)o.push(r.params[n]);return Promise.resolve().then(()=>{this.emit.apply(this,o)})}if(!this.queue[r.id])return r.method?Promise.resolve().then(()=>{this.emit(r.method,r?.params)}):void 0;"error"in r=="result"in r&&this.queue[r.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[r.id].timeout&&clearTimeout(this.queue[r.id].timeout),r.error?this.queue[r.id].promise[1](r.error):this.queue[r.id].promise[0](r.result),delete this.queue[r.id]}),this.socket.addEventListener("error",r=>this.emit("error",r)),this.socket.addEventListener("close",({code:r,reason:o})=>{this.ready&&setTimeout(()=>this.emit("close",r,o),0),this.ready=!1,this.socket=void 0,r!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(e,t),this.reconnect_interval)))})}};eu.default=Qc});var jr=oe((wv,ih)=>{"use strict";ih.exports={BINARY_TYPES:["nodebuffer","arraybuffer","fragments"],EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var kh=oe((_v,Sh)=>{var lh=ae("fs"),xr=ae("path"),fh=ae("os"),dh=typeof __webpack_require__=="function"?__non_webpack_require__:ae,xb=process.config&&process.config.variables||{},vb=!!process.env.PREBUILDS_ONLY,ah=process.versions.modules,tu=Ib()?"electron":Ab()?"node-webkit":"node",ru=process.env.npm_config_arch||fh.arch(),nu=process.env.npm_config_platform||fh.platform(),hh=process.env.LIBC||(Bb(nu)?"musl":"glibc"),su=process.env.ARM_VERSION||(ru==="arm64"?"8":xb.arm_version)||"",ph=(process.versions.uv||"").split(".")[0];Sh.exports=sr;function sr(s){return dh(sr.resolve(s))}sr.resolve=sr.path=function(s){s=xr.resolve(s||".");try{var e=dh(xr.join(s,"package.json")).name.toUpperCase().replace(/-/g,"_");process.env[e+"_PREBUILD"]&&(s=process.env[e+"_PREBUILD"])}catch{}if(!vb){var t=ch(xr.join(s,"build/Release"),uh);if(t)return t;var r=ch(xr.join(s,"build/Debug"),uh);if(r)return r}var o=c(s);if(o)return o;var n=c(xr.dirname(process.execPath));if(n)return n;var i=["platform="+nu,"arch="+ru,"runtime="+tu,"abi="+ah,"uv="+ph,su?"armv="+su:"","libc="+hh,"node="+process.versions.node,process.versions.electron?"electron="+process.versions.electron:"",typeof __webpack_require__=="function"?"webpack=true":""].filter(Boolean).join(" ");throw new Error("No native build was found for "+i+`
5
5
  loaded from: `+s+`
@@ -268,4 +268,4 @@ buffer-layout/lib/Layout.js:
268
268
  * @see {@link https://github.com/pabigot/buffer-layout|buffer-layout on GitHub}
269
269
  *)
270
270
  */
271
- //# sourceMappingURL=chunk-WGFT7DSU.js.map
271
+ //# sourceMappingURL=chunk-XYISSQEU.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{B as m,S as L,T as D,U as E,V as g,b as f,g as P,h as O,j as d,r as S,u as B,v as A,w as I,x as N,z as U}from"./chunk-GPETITBA.js";import{d as j,g as w}from"./chunk-LLHU72AA.js";var _={};j(_,{ERC1155BoundContractView:()=>T,ERC1155ContractView:()=>F,ERC1155Processor:()=>v,ERC1155ProcessorTemplate:()=>R,ERC1155__factory:()=>m,getERC1155Contract:()=>p,getERC1155ContractOnContext:()=>V,mockApprovalForAllLog:()=>K,mockTransferBatchLog:()=>W,mockTransferSingleLog:()=>H,mockURILog:()=>M});var h=m.connect("0x0",D),u=new f(["function balanceOf(address account, uint256 id) view returns (uint256)","function balanceOfBatch(address[] accounts, uint256[] ids) view returns (uint256[])","function isApprovedForAll(address account, address operator) view returns (bool)","function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data) returns ()","function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data) returns ()","function setApprovalForAll(address operator, bool approved) returns ()","function supportsInterface(bytes4 interfaceId) view returns (bool)","function uri(uint256 id) view returns (string)"]),F=class extends P{constructor(t){super(t),this.callStatic.contract=t}async balanceOf(t,e,r,n,a){try{if(n?.ethCallResults&&a){let s=u.encodeFunctionData("balanceOf",[t,e]),o=g({context:a,calldata:s}),c=n.ethCallResults[o];if(c){let l=u.decodeFunctionResult("balanceOf",c).toArray();return l.length==1?l[0]:l}}return await this.contract.getFunction("balanceOf(address,uint256)")(t,e,r||{})}catch(s){let o=new Error().stack;throw d(s,void 0,o)}}async balanceOfBatch(t,e,r,n,a){try{if(n?.ethCallResults&&a){let s=u.encodeFunctionData("balanceOfBatch",[t,e]),o=g({context:a,calldata:s}),c=n.ethCallResults[o];if(c){let l=u.decodeFunctionResult("balanceOfBatch",c).toArray();return l.length==1?l[0]:l}}return await this.contract.getFunction("balanceOfBatch(address[],uint256[])")(t,e,r||{})}catch(s){let o=new Error().stack;throw d(s,void 0,o)}}async isApprovedForAll(t,e,r,n,a){try{if(n?.ethCallResults&&a){let s=u.encodeFunctionData("isApprovedForAll",[t,e]),o=g({context:a,calldata:s}),c=n.ethCallResults[o];if(c){let l=u.decodeFunctionResult("isApprovedForAll",c).toArray();return l.length==1?l[0]:l}}return await this.contract.getFunction("isApprovedForAll(address,address)")(t,e,r||{})}catch(s){let o=new Error().stack;throw d(s,void 0,o)}}async supportsInterface(t,e,r,n){try{if(r?.ethCallResults&&n){let a=u.encodeFunctionData("supportsInterface",[t]),s=g({context:n,calldata:a}),o=r.ethCallResults[s];if(o){let c=u.decodeFunctionResult("supportsInterface",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("supportsInterface(bytes4)")(t,e||{})}catch(a){let s=new Error().stack;throw d(a,void 0,s)}}async uri(t,e,r,n){try{if(r?.ethCallResults&&n){let a=u.encodeFunctionData("uri",[t]),s=g({context:n,calldata:a}),o=r.ethCallResults[s];if(o){let c=u.decodeFunctionResult("uri",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("uri(uint256)")(t,e||{})}catch(a){let s=new Error().stack;throw d(a,void 0,s)}}callStatic={contract:this.contract,async safeBatchTransferFrom(t,e,r,n,a,s,o,c){try{if(o?.ethCallResults&&c){let l=u.encodeFunctionData("safeBatchTransferFrom",[t,e,r,n,a]),C=g({context:c,calldata:l}),b=o.ethCallResults[C];if(b){let x=u.decodeFunctionResult("safeBatchTransferFrom",b).toArray();return x.length==1?x[0]:x}}return await this.contract.getFunction("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)").staticCall(t,e,r,n,a,s||{})}catch(l){let C=new Error().stack;throw d(l,void 0,C)}},async safeTransferFrom(t,e,r,n,a,s,o,c){try{if(o?.ethCallResults&&c){let l=u.encodeFunctionData("safeTransferFrom",[t,e,r,n,a]),C=g({context:c,calldata:l}),b=o.ethCallResults[C];if(b){let x=u.decodeFunctionResult("safeTransferFrom",b).toArray();return x.length==1?x[0]:x}}return await this.contract.getFunction("safeTransferFrom(address,address,uint256,uint256,bytes)").staticCall(t,e,r,n,a,s||{})}catch(l){let C=new Error().stack;throw d(l,void 0,C)}},async setApprovalForAll(t,e,r,n,a){try{if(n?.ethCallResults&&a){let s=u.encodeFunctionData("setApprovalForAll",[t,e]),o=g({context:a,calldata:s}),c=n.ethCallResults[o];if(c){let l=u.decodeFunctionResult("setApprovalForAll",c).toArray();return l.length==1?l[0]:l}}return await this.contract.getFunction("setApprovalForAll(address,bool)").staticCall(t,e,r||{})}catch(s){let o=new Error().stack;throw d(s,void 0,o)}}};encodeCall={balanceOf(t,e,r){try{let a=new f(["function balanceOf(address,uint256)"]).encodeFunctionData("balanceOf",[t,e]);return{context:r,calldata:a}}catch(n){let a=new Error().stack;throw d(n,void 0,a)}},balanceOfBatch(t,e,r){try{let a=new f(["function balanceOfBatch(address[],uint256[])"]).encodeFunctionData("balanceOfBatch",[t,e]);return{context:r,calldata:a}}catch(n){let a=new Error().stack;throw d(n,void 0,a)}},isApprovedForAll(t,e,r){try{let a=new f(["function isApprovedForAll(address,address)"]).encodeFunctionData("isApprovedForAll",[t,e]);return{context:r,calldata:a}}catch(n){let a=new Error().stack;throw d(n,void 0,a)}},safeBatchTransferFrom(t,e,r,n,a,s){try{let c=new f(["function safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)"]).encodeFunctionData("safeBatchTransferFrom",[t,e,r,n,a]);return{context:s,calldata:c}}catch(o){let c=new Error().stack;throw d(o,void 0,c)}},safeTransferFrom(t,e,r,n,a,s){try{let c=new f(["function safeTransferFrom(address,address,uint256,uint256,bytes)"]).encodeFunctionData("safeTransferFrom",[t,e,r,n,a]);return{context:s,calldata:c}}catch(o){let c=new Error().stack;throw d(o,void 0,c)}},setApprovalForAll(t,e,r){try{let a=new f(["function setApprovalForAll(address,bool)"]).encodeFunctionData("setApprovalForAll",[t,e]);return{context:r,calldata:a}}catch(n){let a=new Error().stack;throw d(n,void 0,a)}},supportsInterface(t,e){try{let n=new f(["function supportsInterface(bytes4)"]).encodeFunctionData("supportsInterface",[t]);return{context:e,calldata:n}}catch(r){let n=new Error().stack;throw d(r,void 0,n)}},uri(t,e){try{let n=new f(["function uri(uint256)"]).encodeFunctionData("uri",[t]);return{context:e,calldata:n}}catch(r){let n=new Error().stack;throw d(r,void 0,n)}}}},T=class extends O{async balanceOf(t,e,r){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.balanceOf(t,e,{blockTag:this.context.blockNumber,...r},this.context.preparedData,n)}async balanceOfBatch(t,e,r){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.balanceOfBatch(t,e,{blockTag:this.context.blockNumber,...r},this.context.preparedData,n)}async isApprovedForAll(t,e,r){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.isApprovedForAll(t,e,{blockTag:this.context.blockNumber,...r},this.context.preparedData,n)}async supportsInterface(t,e){let r={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.supportsInterface(t,{blockTag:this.context.blockNumber,...e},this.context.preparedData,r)}async uri(t,e){let r={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.uri(t,{blockTag:this.context.blockNumber,...e},this.context.preparedData,r)}callStatic={view:this.view,context:this.context,async safeBatchTransferFrom(t,e,r,n,a,s){let o={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.safeBatchTransferFrom(t,e,r,n,a,{blockTag:this.context.blockNumber,...s},this.context.preparedData,o)},async safeTransferFrom(t,e,r,n,a,s){let o={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.safeTransferFrom(t,e,r,n,a,{blockTag:this.context.blockNumber,...s},this.context.preparedData,o)},async setApprovalForAll(t,e,r){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.setApprovalForAll(t,e,{blockTag:this.context.blockNumber,...r},this.context.preparedData,n)}};encodeCall={view:this.view,context:this.context,balanceOf(t,e,r){let n="0x"+this.context.blockNumber.toString(16);return r?.blockTag&&(n=typeof r.blockTag=="string"?r.blockTag:"0x"+r.blockTag.toString(16)),this.view.encodeCall.balanceOf(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},balanceOfBatch(t,e,r){let n="0x"+this.context.blockNumber.toString(16);return r?.blockTag&&(n=typeof r.blockTag=="string"?r.blockTag:"0x"+r.blockTag.toString(16)),this.view.encodeCall.balanceOfBatch(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},isApprovedForAll(t,e,r){let n="0x"+this.context.blockNumber.toString(16);return r?.blockTag&&(n=typeof r.blockTag=="string"?r.blockTag:"0x"+r.blockTag.toString(16)),this.view.encodeCall.isApprovedForAll(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},safeBatchTransferFrom(t,e,r,n,a,s){let o="0x"+this.context.blockNumber.toString(16);return s?.blockTag&&(o=typeof s.blockTag=="string"?s.blockTag:"0x"+s.blockTag.toString(16)),this.view.encodeCall.safeBatchTransferFrom(t,e,r,n,a,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:o})},safeTransferFrom(t,e,r,n,a,s){let o="0x"+this.context.blockNumber.toString(16);return s?.blockTag&&(o=typeof s.blockTag=="string"?s.blockTag:"0x"+s.blockTag.toString(16)),this.view.encodeCall.safeTransferFrom(t,e,r,n,a,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:o})},setApprovalForAll(t,e,r){let n="0x"+this.context.blockNumber.toString(16);return r?.blockTag&&(n=typeof r.blockTag=="string"?r.blockTag:"0x"+r.blockTag.toString(16)),this.view.encodeCall.setApprovalForAll(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},supportsInterface(t,e){let r="0x"+this.context.blockNumber.toString(16);return e?.blockTag&&(r=typeof e.blockTag=="string"?e.blockTag:"0x"+e.blockTag.toString(16)),this.view.encodeCall.supportsInterface(t,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:r})},uri(t,e){let r="0x"+this.context.blockNumber.toString(16);return e?.blockTag&&(r=typeof e.blockTag=="string"?e.blockTag:"0x"+e.blockTag.toString(16)),this.view.encodeCall.uri(t,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:r})}}},y=class extends S{onEventApprovalForAll(t,e,r,n){return e||(e=h.filters["ApprovalForAll(address,address,bool)"](null,null,null)),super.onEthEvent(t,e,r,n)}onEventTransferBatch(t,e,r,n){return e||(e=h.filters["TransferBatch(address,address,address,uint256[],uint256[])"](null,null,null,null,null)),super.onEthEvent(t,e,r,n)}onEventTransferSingle(t,e,r,n){return e||(e=h.filters["TransferSingle(address,address,address,uint256,uint256)"](null,null,null,null,null)),super.onEthEvent(t,e,r,n)}onEventURI(t,e,r,n){return e||(e=h.filters["URI(string,uint256)"](null,null)),super.onEthEvent(t,e,r,n)}onCallBalanceOf(t,e,r){return super.onEthTrace("0x00fdd58e",t,e,r)}onCallBalanceOfBatch(t,e,r){return super.onEthTrace("0x4e1273f4",t,e,r)}onCallIsApprovedForAll(t,e,r){return super.onEthTrace("0xe985e9c5",t,e,r)}onCallSafeBatchTransferFrom(t,e,r){return super.onEthTrace("0x2eb2c2d6",t,e,r)}onCallSafeTransferFrom(t,e,r){return super.onEthTrace("0xf242432a",t,e,r)}onCallSetApprovalForAll(t,e,r){return super.onEthTrace("0xa22cb465",t,e,r)}onCallSupportsInterface(t,e,r){return super.onEthTrace("0x01ffc9a7",t,e,r)}onCallUri(t,e,r){return super.onEthTrace("0x0e89341c",t,e,r)}CreateBoundContractView(){let t=p(this.config.network,this.config.address);return new T(this.config.address,t)}static bind(t){t.name||(t.name="ERC1155");let e=B(t);return e||(e=new y(t),A(t,e)),e}},v=y;w(v,"filters",{ApprovalForAll(t,e,r){return h.filters["ApprovalForAll(address,address,bool)"](t,e,r)},TransferBatch(t,e,r,n,a){return h.filters["TransferBatch(address,address,address,uint256[],uint256[])"](t,e,r,n,a)},TransferSingle(t,e,r,n,a){return h.filters["TransferSingle(address,address,address,uint256,uint256)"](t,e,r,n,a)},URI(t,e){return h.filters["URI(string,uint256)"](t,e)}});var R=class extends U{bindInternal(t){t.name||(t.name="ERC1155");let e=B(t);return e||(e=new v(t),A(t,e)),e}onEventApprovalForAll(t,e,r,n){return e||(e=h.filters["ApprovalForAll(address,address,bool)"](null,null,null)),super.onEthEvent(t,e,r,n)}onEventTransferBatch(t,e,r,n){return e||(e=h.filters["TransferBatch(address,address,address,uint256[],uint256[])"](null,null,null,null,null)),super.onEthEvent(t,e,r,n)}onEventTransferSingle(t,e,r,n){return e||(e=h.filters["TransferSingle(address,address,address,uint256,uint256)"](null,null,null,null,null)),super.onEthEvent(t,e,r,n)}onEventURI(t,e,r,n){return e||(e=h.filters["URI(string,uint256)"](null,null)),super.onEthEvent(t,e,r,n)}};function p(i,t){let e=I("ERC1155",t,i);if(!e){let r=m.connect(t,L(i));e=new F(r),N("ERC1155",t,i,e)}return e}function V(i,t){let e=p(i.getChainId(),t),r=new T(t,e);return r.context=i,r.callStatic&&(r.callStatic.context=i),r}var k={blockHash:"0x0000000000000000000000000000000000000000000000000000000000000000",blockNumber:0,logIndex:0,removed:!1,transactionHash:"0x0000000000000000000000000000000000000000000000000000000000000000",transactionIndex:0};function K(i,t){let r=p(E.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("ApprovalForAll(address,address,bool)",[t.account,t.operator,t.approved]);return{...k,index:0,address:i,data:r.data,topics:r.topics}}function W(i,t){let r=p(E.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("TransferBatch(address,address,address,uint256[],uint256[])",[t.operator,t.from,t.to,t.ids,t.values]);return{...k,index:0,address:i,data:r.data,topics:r.topics}}function H(i,t){let r=p(E.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("TransferSingle(address,address,address,uint256,uint256)",[t.operator,t.from,t.to,t.id,t.value]);return{...k,index:0,address:i,data:r.data,topics:r.topics}}function M(i,t){let r=p(E.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("URI(string,uint256)",[t.value,t.id]);return{...k,index:0,address:i,data:r.data,topics:r.topics}}export{F as a,T as b,v as c,R as d,p as e,V as f,K as g,W as h,H as i,M as j,_ as k};
3
- //# sourceMappingURL=chunk-IQNZE4RM.js.map
2
+ import{B as m,S as L,T as D,U as E,V as g,b as f,g as P,h as O,j as d,r as S,u as B,v as A,w as I,x as N,z as U}from"./chunk-4QS3NUUW.js";import{d as j,g as w}from"./chunk-LLHU72AA.js";var _={};j(_,{ERC1155BoundContractView:()=>T,ERC1155ContractView:()=>F,ERC1155Processor:()=>v,ERC1155ProcessorTemplate:()=>R,ERC1155__factory:()=>m,getERC1155Contract:()=>p,getERC1155ContractOnContext:()=>V,mockApprovalForAllLog:()=>K,mockTransferBatchLog:()=>W,mockTransferSingleLog:()=>H,mockURILog:()=>M});var h=m.connect("0x0",D),u=new f(["function balanceOf(address account, uint256 id) view returns (uint256)","function balanceOfBatch(address[] accounts, uint256[] ids) view returns (uint256[])","function isApprovedForAll(address account, address operator) view returns (bool)","function safeBatchTransferFrom(address from, address to, uint256[] ids, uint256[] amounts, bytes data) returns ()","function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes data) returns ()","function setApprovalForAll(address operator, bool approved) returns ()","function supportsInterface(bytes4 interfaceId) view returns (bool)","function uri(uint256 id) view returns (string)"]),F=class extends P{constructor(t){super(t),this.callStatic.contract=t}async balanceOf(t,e,r,n,a){try{if(n?.ethCallResults&&a){let s=u.encodeFunctionData("balanceOf",[t,e]),o=g({context:a,calldata:s}),c=n.ethCallResults[o];if(c){let l=u.decodeFunctionResult("balanceOf",c).toArray();return l.length==1?l[0]:l}}return await this.contract.getFunction("balanceOf(address,uint256)")(t,e,r||{})}catch(s){let o=new Error().stack;throw d(s,void 0,o)}}async balanceOfBatch(t,e,r,n,a){try{if(n?.ethCallResults&&a){let s=u.encodeFunctionData("balanceOfBatch",[t,e]),o=g({context:a,calldata:s}),c=n.ethCallResults[o];if(c){let l=u.decodeFunctionResult("balanceOfBatch",c).toArray();return l.length==1?l[0]:l}}return await this.contract.getFunction("balanceOfBatch(address[],uint256[])")(t,e,r||{})}catch(s){let o=new Error().stack;throw d(s,void 0,o)}}async isApprovedForAll(t,e,r,n,a){try{if(n?.ethCallResults&&a){let s=u.encodeFunctionData("isApprovedForAll",[t,e]),o=g({context:a,calldata:s}),c=n.ethCallResults[o];if(c){let l=u.decodeFunctionResult("isApprovedForAll",c).toArray();return l.length==1?l[0]:l}}return await this.contract.getFunction("isApprovedForAll(address,address)")(t,e,r||{})}catch(s){let o=new Error().stack;throw d(s,void 0,o)}}async supportsInterface(t,e,r,n){try{if(r?.ethCallResults&&n){let a=u.encodeFunctionData("supportsInterface",[t]),s=g({context:n,calldata:a}),o=r.ethCallResults[s];if(o){let c=u.decodeFunctionResult("supportsInterface",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("supportsInterface(bytes4)")(t,e||{})}catch(a){let s=new Error().stack;throw d(a,void 0,s)}}async uri(t,e,r,n){try{if(r?.ethCallResults&&n){let a=u.encodeFunctionData("uri",[t]),s=g({context:n,calldata:a}),o=r.ethCallResults[s];if(o){let c=u.decodeFunctionResult("uri",o).toArray();return c.length==1?c[0]:c}}return await this.contract.getFunction("uri(uint256)")(t,e||{})}catch(a){let s=new Error().stack;throw d(a,void 0,s)}}callStatic={contract:this.contract,async safeBatchTransferFrom(t,e,r,n,a,s,o,c){try{if(o?.ethCallResults&&c){let l=u.encodeFunctionData("safeBatchTransferFrom",[t,e,r,n,a]),C=g({context:c,calldata:l}),b=o.ethCallResults[C];if(b){let x=u.decodeFunctionResult("safeBatchTransferFrom",b).toArray();return x.length==1?x[0]:x}}return await this.contract.getFunction("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)").staticCall(t,e,r,n,a,s||{})}catch(l){let C=new Error().stack;throw d(l,void 0,C)}},async safeTransferFrom(t,e,r,n,a,s,o,c){try{if(o?.ethCallResults&&c){let l=u.encodeFunctionData("safeTransferFrom",[t,e,r,n,a]),C=g({context:c,calldata:l}),b=o.ethCallResults[C];if(b){let x=u.decodeFunctionResult("safeTransferFrom",b).toArray();return x.length==1?x[0]:x}}return await this.contract.getFunction("safeTransferFrom(address,address,uint256,uint256,bytes)").staticCall(t,e,r,n,a,s||{})}catch(l){let C=new Error().stack;throw d(l,void 0,C)}},async setApprovalForAll(t,e,r,n,a){try{if(n?.ethCallResults&&a){let s=u.encodeFunctionData("setApprovalForAll",[t,e]),o=g({context:a,calldata:s}),c=n.ethCallResults[o];if(c){let l=u.decodeFunctionResult("setApprovalForAll",c).toArray();return l.length==1?l[0]:l}}return await this.contract.getFunction("setApprovalForAll(address,bool)").staticCall(t,e,r||{})}catch(s){let o=new Error().stack;throw d(s,void 0,o)}}};encodeCall={balanceOf(t,e,r){try{let a=new f(["function balanceOf(address,uint256)"]).encodeFunctionData("balanceOf",[t,e]);return{context:r,calldata:a}}catch(n){let a=new Error().stack;throw d(n,void 0,a)}},balanceOfBatch(t,e,r){try{let a=new f(["function balanceOfBatch(address[],uint256[])"]).encodeFunctionData("balanceOfBatch",[t,e]);return{context:r,calldata:a}}catch(n){let a=new Error().stack;throw d(n,void 0,a)}},isApprovedForAll(t,e,r){try{let a=new f(["function isApprovedForAll(address,address)"]).encodeFunctionData("isApprovedForAll",[t,e]);return{context:r,calldata:a}}catch(n){let a=new Error().stack;throw d(n,void 0,a)}},safeBatchTransferFrom(t,e,r,n,a,s){try{let c=new f(["function safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)"]).encodeFunctionData("safeBatchTransferFrom",[t,e,r,n,a]);return{context:s,calldata:c}}catch(o){let c=new Error().stack;throw d(o,void 0,c)}},safeTransferFrom(t,e,r,n,a,s){try{let c=new f(["function safeTransferFrom(address,address,uint256,uint256,bytes)"]).encodeFunctionData("safeTransferFrom",[t,e,r,n,a]);return{context:s,calldata:c}}catch(o){let c=new Error().stack;throw d(o,void 0,c)}},setApprovalForAll(t,e,r){try{let a=new f(["function setApprovalForAll(address,bool)"]).encodeFunctionData("setApprovalForAll",[t,e]);return{context:r,calldata:a}}catch(n){let a=new Error().stack;throw d(n,void 0,a)}},supportsInterface(t,e){try{let n=new f(["function supportsInterface(bytes4)"]).encodeFunctionData("supportsInterface",[t]);return{context:e,calldata:n}}catch(r){let n=new Error().stack;throw d(r,void 0,n)}},uri(t,e){try{let n=new f(["function uri(uint256)"]).encodeFunctionData("uri",[t]);return{context:e,calldata:n}}catch(r){let n=new Error().stack;throw d(r,void 0,n)}}}},T=class extends O{async balanceOf(t,e,r){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.balanceOf(t,e,{blockTag:this.context.blockNumber,...r},this.context.preparedData,n)}async balanceOfBatch(t,e,r){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.balanceOfBatch(t,e,{blockTag:this.context.blockNumber,...r},this.context.preparedData,n)}async isApprovedForAll(t,e,r){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.isApprovedForAll(t,e,{blockTag:this.context.blockNumber,...r},this.context.preparedData,n)}async supportsInterface(t,e){let r={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.supportsInterface(t,{blockTag:this.context.blockNumber,...e},this.context.preparedData,r)}async uri(t,e){let r={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.uri(t,{blockTag:this.context.blockNumber,...e},this.context.preparedData,r)}callStatic={view:this.view,context:this.context,async safeBatchTransferFrom(t,e,r,n,a,s){let o={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.safeBatchTransferFrom(t,e,r,n,a,{blockTag:this.context.blockNumber,...s},this.context.preparedData,o)},async safeTransferFrom(t,e,r,n,a,s){let o={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.safeTransferFrom(t,e,r,n,a,{blockTag:this.context.blockNumber,...s},this.context.preparedData,o)},async setApprovalForAll(t,e,r){let n={chainId:this.context.chainId,blockTag:"0x"+this.context.blockNumber.toString(16),address:this.context.address};return await this.view.callStatic.setApprovalForAll(t,e,{blockTag:this.context.blockNumber,...r},this.context.preparedData,n)}};encodeCall={view:this.view,context:this.context,balanceOf(t,e,r){let n="0x"+this.context.blockNumber.toString(16);return r?.blockTag&&(n=typeof r.blockTag=="string"?r.blockTag:"0x"+r.blockTag.toString(16)),this.view.encodeCall.balanceOf(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},balanceOfBatch(t,e,r){let n="0x"+this.context.blockNumber.toString(16);return r?.blockTag&&(n=typeof r.blockTag=="string"?r.blockTag:"0x"+r.blockTag.toString(16)),this.view.encodeCall.balanceOfBatch(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},isApprovedForAll(t,e,r){let n="0x"+this.context.blockNumber.toString(16);return r?.blockTag&&(n=typeof r.blockTag=="string"?r.blockTag:"0x"+r.blockTag.toString(16)),this.view.encodeCall.isApprovedForAll(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},safeBatchTransferFrom(t,e,r,n,a,s){let o="0x"+this.context.blockNumber.toString(16);return s?.blockTag&&(o=typeof s.blockTag=="string"?s.blockTag:"0x"+s.blockTag.toString(16)),this.view.encodeCall.safeBatchTransferFrom(t,e,r,n,a,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:o})},safeTransferFrom(t,e,r,n,a,s){let o="0x"+this.context.blockNumber.toString(16);return s?.blockTag&&(o=typeof s.blockTag=="string"?s.blockTag:"0x"+s.blockTag.toString(16)),this.view.encodeCall.safeTransferFrom(t,e,r,n,a,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:o})},setApprovalForAll(t,e,r){let n="0x"+this.context.blockNumber.toString(16);return r?.blockTag&&(n=typeof r.blockTag=="string"?r.blockTag:"0x"+r.blockTag.toString(16)),this.view.encodeCall.setApprovalForAll(t,e,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:n})},supportsInterface(t,e){let r="0x"+this.context.blockNumber.toString(16);return e?.blockTag&&(r=typeof e.blockTag=="string"?e.blockTag:"0x"+e.blockTag.toString(16)),this.view.encodeCall.supportsInterface(t,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:r})},uri(t,e){let r="0x"+this.context.blockNumber.toString(16);return e?.blockTag&&(r=typeof e.blockTag=="string"?e.blockTag:"0x"+e.blockTag.toString(16)),this.view.encodeCall.uri(t,{chainId:this.context.chainId.toString(),address:this.context.address,blockTag:r})}}},y=class extends S{onEventApprovalForAll(t,e,r,n){return e||(e=h.filters["ApprovalForAll(address,address,bool)"](null,null,null)),super.onEthEvent(t,e,r,n)}onEventTransferBatch(t,e,r,n){return e||(e=h.filters["TransferBatch(address,address,address,uint256[],uint256[])"](null,null,null,null,null)),super.onEthEvent(t,e,r,n)}onEventTransferSingle(t,e,r,n){return e||(e=h.filters["TransferSingle(address,address,address,uint256,uint256)"](null,null,null,null,null)),super.onEthEvent(t,e,r,n)}onEventURI(t,e,r,n){return e||(e=h.filters["URI(string,uint256)"](null,null)),super.onEthEvent(t,e,r,n)}onCallBalanceOf(t,e,r){return super.onEthTrace("0x00fdd58e",t,e,r)}onCallBalanceOfBatch(t,e,r){return super.onEthTrace("0x4e1273f4",t,e,r)}onCallIsApprovedForAll(t,e,r){return super.onEthTrace("0xe985e9c5",t,e,r)}onCallSafeBatchTransferFrom(t,e,r){return super.onEthTrace("0x2eb2c2d6",t,e,r)}onCallSafeTransferFrom(t,e,r){return super.onEthTrace("0xf242432a",t,e,r)}onCallSetApprovalForAll(t,e,r){return super.onEthTrace("0xa22cb465",t,e,r)}onCallSupportsInterface(t,e,r){return super.onEthTrace("0x01ffc9a7",t,e,r)}onCallUri(t,e,r){return super.onEthTrace("0x0e89341c",t,e,r)}CreateBoundContractView(){let t=p(this.config.network,this.config.address);return new T(this.config.address,t)}static bind(t){t.name||(t.name="ERC1155");let e=B(t);return e||(e=new y(t),A(t,e)),e}},v=y;w(v,"filters",{ApprovalForAll(t,e,r){return h.filters["ApprovalForAll(address,address,bool)"](t,e,r)},TransferBatch(t,e,r,n,a){return h.filters["TransferBatch(address,address,address,uint256[],uint256[])"](t,e,r,n,a)},TransferSingle(t,e,r,n,a){return h.filters["TransferSingle(address,address,address,uint256,uint256)"](t,e,r,n,a)},URI(t,e){return h.filters["URI(string,uint256)"](t,e)}});var R=class extends U{bindInternal(t){t.name||(t.name="ERC1155");let e=B(t);return e||(e=new v(t),A(t,e)),e}onEventApprovalForAll(t,e,r,n){return e||(e=h.filters["ApprovalForAll(address,address,bool)"](null,null,null)),super.onEthEvent(t,e,r,n)}onEventTransferBatch(t,e,r,n){return e||(e=h.filters["TransferBatch(address,address,address,uint256[],uint256[])"](null,null,null,null,null)),super.onEthEvent(t,e,r,n)}onEventTransferSingle(t,e,r,n){return e||(e=h.filters["TransferSingle(address,address,address,uint256,uint256)"](null,null,null,null,null)),super.onEthEvent(t,e,r,n)}onEventURI(t,e,r,n){return e||(e=h.filters["URI(string,uint256)"](null,null)),super.onEthEvent(t,e,r,n)}};function p(i,t){let e=I("ERC1155",t,i);if(!e){let r=m.connect(t,L(i));e=new F(r),N("ERC1155",t,i,e)}return e}function V(i,t){let e=p(i.getChainId(),t),r=new T(t,e);return r.context=i,r.callStatic&&(r.callStatic.context=i),r}var k={blockHash:"0x0000000000000000000000000000000000000000000000000000000000000000",blockNumber:0,logIndex:0,removed:!1,transactionHash:"0x0000000000000000000000000000000000000000000000000000000000000000",transactionIndex:0};function K(i,t){let r=p(E.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("ApprovalForAll(address,address,bool)",[t.account,t.operator,t.approved]);return{...k,index:0,address:i,data:r.data,topics:r.topics}}function W(i,t){let r=p(E.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("TransferBatch(address,address,address,uint256[],uint256[])",[t.operator,t.from,t.to,t.ids,t.values]);return{...k,index:0,address:i,data:r.data,topics:r.topics}}function H(i,t){let r=p(E.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("TransferSingle(address,address,address,uint256,uint256)",[t.operator,t.from,t.to,t.id,t.value]);return{...k,index:0,address:i,data:r.data,topics:r.topics}}function M(i,t){let r=p(E.EthChainId.ETHEREUM,i).rawContract.interface.encodeEventLog("URI(string,uint256)",[t.value,t.id]);return{...k,index:0,address:i,data:r.data,topics:r.topics}}export{F as a,T as b,v as c,R as d,p as e,V as f,K as g,W as h,H as i,M as j,_ as k};
3
+ //# sourceMappingURL=chunk-XZRRBRMQ.js.map
package/lib/core/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{Ac as n,Bc as o,Cc as p,Dc as q,bd as r,cd as s,dd as t,ed as u,fd as v,hd as w,oc as b,pc as c,qc as d,rc as e,sc as f,tc as g,uc as h,vc as i,wc as j,xc as k,yc as l,zc as m}from"../chunk-JGYBNJHX.js";import"../chunk-TW3ZXDJC.js";import"../chunk-PLLN42GP.js";import"../chunk-NMFPLO65.js";import"../chunk-K6FJLTBX.js";import"../chunk-GQE2JYJW.js";import"../chunk-DJQ5RDDN.js";import{a}from"../chunk-FC546GTB.js";import"../chunk-LLHU72AA.js";export{v as AccountEventTracker,r as BaseContext,g as BasicFieldType,a as BigDecimal,w as CorePlugin,m as Counter,n as CounterBinding,d as DatabaseSchema,i as EventLogger,f as EventLoggerBinding,e as EventLoggerState,u as EventTracker,t as EventTrackerState,s as Exporter,o as Gauge,p as GaugeBinding,q as Meter,l as MetricOptions,h as fieldsToProtos,c as normalizeLabels,b as scaleDown,k as toBigInteger,j as toMetricValue};
2
+ import{Ac as n,Bc as o,Cc as p,Dc as q,bd as r,cd as s,dd as t,ed as u,fd as v,hd as w,oc as b,pc as c,qc as d,rc as e,sc as f,tc as g,uc as h,vc as i,wc as j,xc as k,yc as l,zc as m}from"../chunk-JTQMVYTS.js";import"../chunk-TW3ZXDJC.js";import"../chunk-PLLN42GP.js";import"../chunk-NMFPLO65.js";import"../chunk-K6FJLTBX.js";import"../chunk-GQE2JYJW.js";import"../chunk-DJQ5RDDN.js";import{a}from"../chunk-FC546GTB.js";import"../chunk-LLHU72AA.js";export{v as AccountEventTracker,r as BaseContext,g as BasicFieldType,a as BigDecimal,w as CorePlugin,m as Counter,n as CounterBinding,d as DatabaseSchema,i as EventLogger,f as EventLoggerBinding,e as EventLoggerState,u as EventTracker,t as EventTrackerState,s as Exporter,o as Gauge,p as GaugeBinding,q as Meter,l as MetricOptions,h as fieldsToProtos,c as normalizeLabels,b as scaleDown,k as toBigInteger,j as toMetricValue};
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k}from"../../chunk-QRNQPRH4.js";import{A as a}from"../../chunk-GPETITBA.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JGYBNJHX.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as EACAggregatorProxyBoundContractView,b as EACAggregatorProxyContractView,d as EACAggregatorProxyProcessor,e as EACAggregatorProxyProcessorTemplate,a as EACAggregatorProxy__factory,f as getEACAggregatorProxyContract,g as getEACAggregatorProxyContractOnContext,h as mockAnswerUpdatedLog,i as mockNewRoundLog,j as mockOwnershipTransferRequestedLog,k as mockOwnershipTransferredLog};
2
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k}from"../../chunk-3KK6D6YO.js";import{A as a}from"../../chunk-4QS3NUUW.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JTQMVYTS.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as EACAggregatorProxyBoundContractView,b as EACAggregatorProxyContractView,d as EACAggregatorProxyProcessor,e as EACAggregatorProxyProcessorTemplate,a as EACAggregatorProxy__factory,f as getEACAggregatorProxyContract,g as getEACAggregatorProxyContractOnContext,h as mockAnswerUpdatedLog,i as mockNewRoundLog,j as mockOwnershipTransferRequestedLog,k as mockOwnershipTransferredLog};
3
3
  //# sourceMappingURL=eacaggregatorproxy.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k}from"../../chunk-IQNZE4RM.js";import{B as a}from"../../chunk-GPETITBA.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JGYBNJHX.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as ERC1155BoundContractView,b as ERC1155ContractView,d as ERC1155Processor,e as ERC1155ProcessorTemplate,a as ERC1155__factory,f as getERC1155Contract,g as getERC1155ContractOnContext,h as mockApprovalForAllLog,i as mockTransferBatchLog,j as mockTransferSingleLog,k as mockURILog};
2
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k}from"../../chunk-XZRRBRMQ.js";import{B as a}from"../../chunk-4QS3NUUW.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JTQMVYTS.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as ERC1155BoundContractView,b as ERC1155ContractView,d as ERC1155Processor,e as ERC1155ProcessorTemplate,a as ERC1155__factory,f as getERC1155Contract,g as getERC1155ContractOnContext,h as mockApprovalForAllLog,i as mockTransferBatchLog,j as mockTransferSingleLog,k as mockURILog};
3
3
  //# sourceMappingURL=erc1155.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{$ as g,C as a,W as b,X as c,Y as d,Z as e,_ as f,aa as h,ba as i,ca as j}from"../../chunk-GPETITBA.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JGYBNJHX.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as ERC20BoundContractView,b as ERC20ContractView,d as ERC20Processor,e as ERC20ProcessorTemplate,a as ERC20__factory,f as getERC20Contract,g as getERC20ContractOnContext,h as mockApprovalLog,i as mockOwnershipTransferredLog,j as mockTransferLog};
2
+ import{$ as g,C as a,W as b,X as c,Y as d,Z as e,_ as f,aa as h,ba as i,ca as j}from"../../chunk-4QS3NUUW.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JTQMVYTS.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as ERC20BoundContractView,b as ERC20ContractView,d as ERC20Processor,e as ERC20ProcessorTemplate,a as ERC20__factory,f as getERC20Contract,g as getERC20ContractOnContext,h as mockApprovalLog,i as mockOwnershipTransferredLog,j as mockTransferLog};
3
3
  //# sourceMappingURL=erc20.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{E as a,G as b,H as c,I as d,J as e,K as f,L as g,M as h,N as i,O as j}from"../../chunk-GPETITBA.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JGYBNJHX.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as ERC721BoundContractView,b as ERC721ContractView,d as ERC721Processor,e as ERC721ProcessorTemplate,a as ERC721__factory,f as getERC721Contract,g as getERC721ContractOnContext,i as mockApprovalForAllLog,h as mockApprovalLog,j as mockTransferLog};
2
+ import{E as a,G as b,H as c,I as d,J as e,K as f,L as g,M as h,N as i,O as j}from"../../chunk-4QS3NUUW.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JTQMVYTS.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as ERC721BoundContractView,b as ERC721ContractView,d as ERC721Processor,e as ERC721ProcessorTemplate,a as ERC721__factory,f as getERC721Contract,g as getERC721ContractOnContext,i as mockApprovalForAllLog,h as mockApprovalLog,j as mockTransferLog};
3
3
  //# sourceMappingURL=erc721.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{c as E,d as C,k as g}from"../../chunk-IQNZE4RM.js";import{c as R,d as T,k as l}from"../../chunk-5WEQ4PSE.js";import{a as m,b as a,d as c}from"../../chunk-RYFT36S5.js";import{c as x,d as P,k as f}from"../../chunk-QRNQPRH4.js";import{I as r,J as o,P as e,Y as s,Z as t,da as p}from"../../chunk-GPETITBA.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JGYBNJHX.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{x as EACAggregatorProxyProcessor,P as EACAggregatorProxyProcessorTemplate,E as ERC1155Processor,C as ERC1155ProcessorTemplate,m as ERC20BytesProcessor,a as ERC20BytesProcessorTemplate,s as ERC20Processor,t as ERC20ProcessorTemplate,r as ERC721Processor,o as ERC721ProcessorTemplate,R as WETH9Processor,T as WETH9ProcessorTemplate,f as eacaggregatorproxy,g as erc1155,p as erc20,c as erc20bytes,e as erc721,l as weth9};
2
+ import{c as E,d as C,k as g}from"../../chunk-XZRRBRMQ.js";import{c as R,d as T,k as l}from"../../chunk-CSVBDVD7.js";import{a as m,b as a,d as c}from"../../chunk-LCUGDGMN.js";import{c as x,d as P,k as f}from"../../chunk-3KK6D6YO.js";import{I as r,J as o,P as e,Y as s,Z as t,da as p}from"../../chunk-4QS3NUUW.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JTQMVYTS.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{x as EACAggregatorProxyProcessor,P as EACAggregatorProxyProcessorTemplate,E as ERC1155Processor,C as ERC1155ProcessorTemplate,m as ERC20BytesProcessor,a as ERC20BytesProcessorTemplate,s as ERC20Processor,t as ERC20ProcessorTemplate,r as ERC721Processor,o as ERC721ProcessorTemplate,R as WETH9Processor,T as WETH9ProcessorTemplate,f as eacaggregatorproxy,g as erc1155,p as erc20,c as erc20bytes,e as erc721,l as weth9};
3
3
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
1
  import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
2
- import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k}from"../../chunk-5WEQ4PSE.js";import{F as a}from"../../chunk-GPETITBA.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JGYBNJHX.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as WETH9BoundContractView,b as WETH9ContractView,d as WETH9Processor,e as WETH9ProcessorTemplate,a as WETH9__factory,f as getWETH9Contract,g as getWETH9ContractOnContext,h as mockApprovalLog,j as mockDepositLog,i as mockTransferLog,k as mockWithdrawalLog};
2
+ import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k}from"../../chunk-CSVBDVD7.js";import{F as a}from"../../chunk-4QS3NUUW.js";import"../../chunk-2GOCSOX5.js";import"../../chunk-7HVQTJAO.js";import"../../chunk-JTQMVYTS.js";import"../../chunk-TW3ZXDJC.js";import"../../chunk-PLLN42GP.js";import"../../chunk-NMFPLO65.js";import"../../chunk-K6FJLTBX.js";import"../../chunk-GQE2JYJW.js";import"../../chunk-DJQ5RDDN.js";import"../../chunk-FC546GTB.js";import"../../chunk-LLHU72AA.js";export{c as WETH9BoundContractView,b as WETH9ContractView,d as WETH9Processor,e as WETH9ProcessorTemplate,a as WETH9__factory,f as getWETH9Contract,g as getWETH9ContractOnContext,h as mockApprovalLog,j as mockDepositLog,i as mockTransferLog,k as mockWithdrawalLog};
3
3
  //# sourceMappingURL=weth9.js.map