1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6904],{240:(e,t,r)=>{let a=r(44764),{MAX_LENGTH:n,MAX_SAFE_INTEGER:s}=r(36706),{safeRe:i,t:o}=r(82404),l=r(74371),{compareIdentifiers:u}=r(34747);class c{constructor(e,t){if(t=l(t),e instanceof c)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else e=e.version;else if("string"!=typeof e)throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>n)throw TypeError(`version is longer than ${n} characters`);a("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?i[o.LOOSE]:i[o.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>s||this.major<0)throw TypeError("Invalid major version");if(this.minor>s||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>s||this.patch<0)throw TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<s)return t}return e}):this.prerelease=[],this.build=r[5]?r[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(a("SemVer.compare",this.version,this.options,e),!(e instanceof c)){if("string"==typeof e&&e===this.version)return 0;e=new c(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof c||(e=new c(e,this.options)),u(this.major,e.major)||u(this.minor,e.minor)||u(this.patch,e.patch)}comparePre(e){if(e instanceof c||(e=new c(e,this.options)),this.prerelease.length&&!e.prerelease.length)return -1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(a("prerelease compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return -1;else if(r===n)continue;else return u(r,n)}while(++t)}compareBuild(e){e instanceof c||(e=new c(e,this.options));let t=0;do{let r=this.build[t],n=e.build[t];if(a("build compare",t,r,n),void 0===r&&void 0===n)return 0;if(void 0===n)return 1;if(void 0===r)return -1;else if(r===n)continue;else return u(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw Error("invalid increment argument: identifier is empty");if(t){let e=`-${t}`.match(this.options.loose?i[o.PRERELEASELOOSE]:i[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":(0!==this.minor||0!==this.patch||0===this.prerelease.length)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(0!==this.patch||0===this.prerelease.length)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{let e=+!!Number(r);if(0===this.prerelease.length)this.prerelease=[e];else{let a=this.prerelease.length;for(;--a>=0;)"number"==typeof this.prerelease[a]&&(this.prerelease[a]++,a=-2);if(-1===a){if(t===this.prerelease.join(".")&&!1===r)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let a=[t,e];!1===r&&(a=[t]),0===u(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=a):this.prerelease=a}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}
1e.exports=c},334:(e,t,r)=>{r.d(t,{$:()=>a});let a=async e=>{let t=await e.request({method:"zd_getUserOperationGasPrice",params:[]});return{maxFeePerGas:BigInt(t.standard.maxFeePerGas),maxPriorityFeePerGas:BigInt(t.standard.maxPriorityFeePerGas)}}},1185:(e,t,r)=>{let a=r(48390);e.exports=(e,t)=>a(e,t,!0)},2245:(e,t,r)=>{r.d(t,{w:()=>a});let a=[{type:"constructor",inputs:[{name:"_entrypoint",type:"address",internalType:"contract IEntryPoint"}],stateMutability:"nonpayable"},{type:"fallback",stateMutability:"payable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"accountId",inputs:[],outputs:[{name:"accountImplementationId",type:"string",internalType:"string"}],stateMutability:"pure"},{type:"function",name:"changeRootValidator",inputs:[{name:"_rootValidator",type:"bytes21",internalType:"ValidationId"},{name:"hook",type:"address",internalType:"contract IHook"},{name:"validatorData",type:"bytes",internalType:"bytes"},{name:"hookData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"currentNonce",inputs:[],outputs:[{name:"",type:"uint32",internalType:"uint32"}],stateMutability:"view"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"entrypoint",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IEntryPoint"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"execMode",type:"bytes32",internalType:"ExecMode"},{name:"executionCalldata",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeFromExecutor",inputs:[{name:"execMode",type:"bytes32",internalType:"ExecMode"},{name:"executionCalldata",type:"bytes",internalType:"bytes"}],outputs:[{name:"returnData",type:"bytes[]",internalType:"bytes[]"}],stateMutability:"payable"},{type:"function",name:"executeUserOp",inputs:[{name:"userOp",type:"tuple",internalType:"struct PackedUserOperation",components:[{name:"sender",type:"address",internalType:"address"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"initCode",type:"bytes",internalType:"bytes"},{name:"callData",type:"bytes",internalType:"bytes"},{name:"accountGasLimits",type:"bytes32",internalType:"bytes32"},{name:"preVerificationGas",type:"uint256",internalType:"uint256"},{name:"gasFees",type:"bytes32",internalType:"bytes32"},{name:"paymasterAndData",type:"bytes",internalType:"bytes"},{name:"signature",type:"bytes",internalType:"bytes"}]},{name:"userOpHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"payable"},{type:"function",name:"executorConfig",inputs:[{name:"executor",type:"address",internalType:"contract IExecutor"}],outputs:[{name:"",type:"tuple",internalType:"struct ExecutorManager.ExecutorConfig",components:[{name:"hook",type:"address",internalType:"contract IHook"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_rootValidator",type:"bytes21",internalType:"ValidationId"},{name:"hook",type:"address",internalType:"contract IHook"},{name:"validatorData",type:"bytes",internalType:"bytes"},{name:"hookData",type:"bytes",internalType:"bytes"},{name:"initConfig",type:"bytes[]",internalType:"bytes[]"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"installModule",inputs:[{name:"moduleType",type:"uint256",internalType:"uint256"},{name:"module",type:"address",internalType:"address"},{name:"initData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"installValidations",inputs:[{name:"vIds",type:"bytes21[]",internalType:"ValidationId[]"},{name:"configs",type:"tuple[]",internalType:"struct ValidationManager.ValidationConfig[]",components:[{name:"nonce",type:"uint32",internalType:"uint32"},{name:"hook",type:"address",internalType:"contract IHook"}]},{name:"validationData",type:"bytes[]",internalType:"bytes[]"},{name:"hookData",type:"bytes[]",internalType:"bytes[]"}],outputs:[],stateMutability:"payable"}
1,{type:"function",name:"invalidateNonce",inputs:[{name:"nonce",type:"uint32",internalType:"uint32"}],outputs:[],stateMutability:"payable"},{type:"function",name:"isAllowedSelector",inputs:[{name:"vId",type:"bytes21",internalType:"ValidationId"},{name:"selector",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"isModuleInstalled",inputs:[{name:"moduleType",type:"uint256",internalType:"uint256"},{name:"module",type:"address",internalType:"address"},{name:"additionalContext",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"isValidSignature",inputs:[{name:"hash",type:"bytes32",internalType:"bytes32"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"pure"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"pure"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"pure"},{type:"function",name:"permissionConfig",inputs:[{name:"pId",type:"bytes4",internalType:"PermissionId"}],outputs:[{name:"",type:"tuple",internalType:"struct ValidationManager.PermissionConfig",components:[{name:"permissionFlag",type:"bytes2",internalType:"PassFlag"},{name:"signer",type:"address",internalType:"contract ISigner"},{name:"policyData",type:"bytes22[]",internalType:"PolicyData[]"}]}],stateMutability:"view"},{type:"function",name:"rootValidator",inputs:[],outputs:[{name:"",type:"bytes21",internalType:"ValidationId"}],stateMutability:"view"},{type:"function",name:"selectorConfig",inputs:[{name:"selector",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"tuple",internalType:"struct SelectorManager.SelectorConfig",components:[{name:"hook",type:"address",internalType:"contract IHook"},{name:"target",type:"address",internalType:"address"},{name:"callType",type:"bytes1",internalType:"CallType"}]}],stateMutability:"view"},{type:"function",name:"supportsExecutionMode",inputs:[{name:"mode",type:"bytes32",internalType:"ExecMode"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"pure"},{type:"function",name:"supportsModule",inputs:[{name:"moduleTypeId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"pure"},{type:"function",name:"uninstallModule",inputs:[{name:"moduleType",type:"uint256",internalType:"uint256"},{name:"module",type:"address",internalType:"address"},{name:"deInitData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"uninstallValidation",inputs:[{name:"vId",type:"bytes21",internalType:"ValidationId"},{name:"deinitData",type:"bytes",internalType:"bytes"},{name:"hookDeinitData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"upgradeTo",inputs:[{name:"_newImplementation",type:"address",internalType:"address"}],outputs:[],stateMutability:"payable"},{type:"function",name:"validNonceFrom",inputs:[],outputs:[{name:"",type:"uint32",internalType:"uint32"}],stateMutability:"view"},{type:"function",name:"validateUserOp",inputs:[{name:"userOp",type:"tuple",internalType:"struct PackedUserOperation",components:[{name:"sender",type:"address",internalType:"address"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"initCode",type:"bytes",internalType:"bytes"},{name:"callData",type:"bytes",internalType:"bytes"},{name:"accountGasLimits",type:"bytes32",internalType:"bytes32"},{name:"preVerificationGas",type:"uint256",internalType:"uint256"},{name:"gasFees",type:"bytes32",internalType:"bytes32"},{name:"paymasterAndData",type:"bytes",internalType:"bytes"},{name:"signature",type:"bytes",internalType:"bytes"}]},{name:"userOpHash",type:"bytes32",internalType:"bytes32"},{name:"missingAccountFunds",type:"uint256",internalType:"uint256"}],outputs:[{name:"validationData",type:"uint256",internalType:"ValidationData"}],stateMutability:"payable"},{type:"function",name:"validationConfig",inputs:[{name:"vId",type:"bytes21",internalType:"ValidationId"}],outputs:[{name:"",type:"tuple",internalType:"struct ValidationManager.ValidationConfig",components:[{name:"nonce",type:"uint32",internalType:"uint32"},{name:"hook",type:"address",internalType:"contract IHook"}]}],stateMutability:"view"},{type:"event",name:"ModuleInstalled",inputs:[{name:"moduleTypeId",type:"uint256",indexed:!1,internalType:"uint256"},{name:"module",type:"address",indexed:!1,internalType:"address"}],anonymous:!1}
1,{type:"event",name:"ModuleUninstallResult",inputs:[{name:"module",type:"address",indexed:!1,internalType:"address"},{name:"result",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"ModuleUninstalled",inputs:[{name:"moduleTypeId",type:"uint256",indexed:!1,internalType:"uint256"},{name:"module",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"NonceInvalidated",inputs:[{name:"nonce",type:"uint32",indexed:!1,internalType:"uint32"}],anonymous:!1},{type:"event",name:"PermissionInstalled",inputs:[{name:"permission",type:"bytes4",indexed:!1,internalType:"PermissionId"},{name:"nonce",type:"uint32",indexed:!1,internalType:"uint32"}],anonymous:!1},{type:"event",name:"PermissionUninstalled",inputs:[{name:"permission",type:"bytes4",indexed:!1,internalType:"PermissionId"}],anonymous:!1},{type:"event",name:"Received",inputs:[{name:"sender",type:"address",indexed:!1,internalType:"address"},{name:"amount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"RootValidatorUpdated",inputs:[{name:"rootValidator",type:"bytes21",indexed:!1,internalType:"ValidationId"}],anonymous:!1},{type:"event",name:"SelectorSet",inputs:[{name:"selector",type:"bytes4",indexed:!1,internalType:"bytes4"},{name:"vId",type:"bytes21",indexed:!1,internalType:"ValidationId"},{name:"allowed",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"TryExecuteUnsuccessful",inputs:[{name:"batchExecutionindex",type:"uint256",indexed:!1,internalType:"uint256"},{name:"result",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"ValidatorInstalled",inputs:[{name:"validator",type:"address",indexed:!1,internalType:"contract IValidator"},{name:"nonce",type:"uint32",indexed:!1,internalType:"uint32"}],anonymous:!1},{type:"event",name:"ValidatorUninstalled",inputs:[{name:"validator",type:"address",indexed:!1,internalType:"contract IValidator"}],anonymous:!1},{type:"error",name:"EnableNotApproved",inputs:[]},{type:"error",name:"ExecutionReverted",inputs:[]},{type:"error",name:"InitConfigError",inputs:[{name:"idx",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidCallType",inputs:[]},{type:"error",name:"InvalidCaller",inputs:[]},{type:"error",name:"InvalidExecutor",inputs:[]},{type:"error",name:"InvalidFallback",inputs:[]},{type:"error",name:"InvalidMode",inputs:[]},{type:"error",name:"InvalidModuleType",inputs:[]},{type:"error",name:"InvalidNonce",inputs:[]},{type:"error",name:"InvalidSelector",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"InvalidValidationType",inputs:[]},{type:"error",name:"InvalidValidator",inputs:[]},{type:"error",name:"NonceInvalidationError",inputs:[]},{type:"error",name:"NotSupportedCallType",inputs:[]},{type:"error",name:"OnlyExecuteUserOp",inputs:[]},{type:"error",name:"PermissionDataLengthMismatch",inputs:[]},{type:"error",name:"PermissionNotAlllowedForSignature",inputs:[]},{type:"error",name:"PermissionNotAlllowedForUserOp",inputs:[]},{type:"error",name:"PolicyDataTooLarge",inputs:[]},{type:"error",name:"PolicyFailed",inputs:[{name:"i",type:"uint256",internalType:"uint256"}]},{type:"error",name:"PolicySignatureOrderError",inputs:[]},{type:"error",name:"RootValidatorCannotBeRemoved",inputs:[]},{type:"error",name:"SignerPrefixNotPresent",inputs:[]}]},3450:(e,t,r)=>{r.d(t,{t:()=>K});var a=r(13933),n=r(35326),s=r(41343);class i extends a.C{constructor({cause:e}){super("Smart Account is not deployed.",{cause:e,metaMessages:["This could arise when:","- No `factory`/`factoryData` or `initCode` properties are provided for Smart Account deployment.","- An incorrect `sender` address is provided."],name:"AccountNotDeployedError"})}}Object.defineProperty(i,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa20/});class o extends a.C{constructor({cause:e,data:t,message:r}={}){let a=r?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${a?`with reason: ${a}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}}Object.defineProperty(o,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32521}),Object.defineProperty(o,"message",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class l extends a.C{constructor({cause:e}){super("Failed to send funds to beneficiary.",{cause:e,name:"FailedToSendToBeneficiaryError"})}}Object.defineProperty(l,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa91/});class u extends a.C{constructor({cause:e}){super("Gas value overflowed.",{cause:e,metaMessages:["This could arise when:","- one of the gas values exceeded 2**120 (uint120)"].filter(
vendor: 8,384 bytes, line 1
1Boolean),name:"GasValuesOverflowError"})}}Object.defineProperty(u,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa94/});class c extends a.C{constructor({cause:e}){super("The `handleOps` function was called by the Bundler with a gas limit too low.",{cause:e,name:"HandleOpsOutOfGasError"})}}Object.defineProperty(c,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa95/});class d extends a.C{constructor({cause:e,factory:t,factoryData:r,initCode:a}){super("Failed to simulate deployment for Smart Account.",{cause:e,metaMessages:["This could arise when:","- Invalid `factory`/`factoryData` or `initCode` properties are present","- Smart Account deployment execution ran out of gas (low `verificationGasLimit` value)","- Smart Account deployment execution reverted with an error\n",t&&`factory: ${t}`,r&&`factoryData: ${r}`,a&&`initCode: ${a}`].filter(Boolean),name:"InitCodeFailedError"})}}Object.defineProperty(d,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa13/});class p extends a.C{constructor({cause:e,factory:t,factoryData:r,initCode:a}){super("Smart Account initialization implementation did not create an account.",{cause:e,metaMessages:["This could arise when:","- `factory`/`factoryData` or `initCode` properties are invalid","- Smart Account initialization implementation is incorrect\n",t&&`factory: ${t}`,r&&`factoryData: ${r}`,a&&`initCode: ${a}`].filter(Boolean),name:"InitCodeMustCreateSenderError"})}}Object.defineProperty(p,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa15/});class h extends a.C{constructor({cause:e,factory:t,factoryData:r,initCode:a,sender:n}){super("Smart Account initialization implementation does not return the expected sender.",{cause:e,metaMessages:["This could arise when:","Smart Account initialization implementation does not return a sender address\n",t&&`factory: ${t}`,r&&`factoryData: ${r}`,a&&`initCode: ${a}`,n&&`sender: ${n}`].filter(Boolean),name:"InitCodeMustReturnSenderError"})}}Object.defineProperty(h,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa14/});class y extends a.C{constructor({cause:e}){super("Smart Account does not have sufficient funds to execute the User Operation.",{cause:e,metaMessages:["This could arise when:","- the Smart Account does not have sufficient funds to cover the required prefund, or","- a Paymaster was not provided"].filter(Boolean),name:"InsufficientPrefundError"})}}Object.defineProperty(y,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa21/});class m extends a.C{constructor({cause:e}){super("Bundler attempted to call an invalid function on the EntryPoint.",{cause:e,name:"InternalCallOnlyError"})}}Object.defineProperty(m,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa92/});class f extends a.C{constructor({cause:e}){super("Bundler used an invalid aggregator for handling aggregated User Operations.",{cause:e,name:"InvalidAggregatorError"})}}Object.defineProperty(f,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa96/});class g extends a.C{constructor({cause:e,nonce:t}){super("Invalid Smart Account nonce used for User Operation.",{cause:e,metaMessages:[t&&`nonce: ${t}`].filter(Boolean),name:"InvalidAccountNonceError"})}}Object.defineProperty(g,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa25/});class b extends a.C{constructor({cause:e}){super("Bundler has not set a beneficiary address.",{cause:e,name:"InvalidBeneficiaryError"})}}Object.defineProperty(b,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa90/});class w extends a.C{constructor({cause:e}){super("Invalid fields set on User Operation.",{cause:e,name:"InvalidFieldsError"})}}Object.defineProperty(w,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class v extends a.C{constructor({cause:e,paymasterAndData:t}){super("Paymaster properties provided are invalid.",{cause:e,metaMessages:["This could arise when:","- the `paymasterAndData` property is of an incorrect length\n",t&&`paymasterAndData: ${t}`].filter(Boolean),name:"InvalidPaymasterAndDataError"})}}Object.defineProperty(v,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa93/});class T extends a.C{constructor({cause:e}){super("Paymaster deposit for the User Operation is too low.",{cause:e,metaMessages:["This could arise when:","- the Paymaster has deposited less than the expected amount via the `deposit` function"].filter(Boolean),name:"PaymasterDepositTooLowError"})}}Object.defineProperty(T,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32508}),Object.defineProperty(T,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa31/});class _ extends a.C{constructor({cause:e}){super("The `validatePaymasterUserOp` function on the Paymaster reverted.",{cause:e,name:"PaymasterFunctionRevertedError"})}}Object.defineProperty(_,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa33/});class E extends a.C{constructor({cause:e}){super("The Paymaster contract has not been deployed.",{cause:e,name:"PaymasterNotDeployedError"})}}Object.defineProperty(E,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa30/});class O extends a.C{constructor({cause:e}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:e,name:"PaymasterRateLimitError"})}}Object.defineProperty(O,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32504});class x extends a.C{constructor({cause:e}){super("UserOperation rejected because paymaster (or signature aggregator) is throttled/banned.",{cause:e,name:"PaymasterStakeTooLowError"})}}Object.defineProperty(x,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32505});class S extends a.C{constructor({cause:e}){super("Paymaster `postOp` function reverted.",{cause:e,name:"PaymasterPostOpFunctionRevertedError"})}}Object.defineProperty(S,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa50/});class I extends a.C{constructor({cause:e,factory:t,factoryData:r,initCode:a}){super("Smart Account has already been deployed.",{cause:e,metaMessages:["Remove the following properties and try again:",t&&"`factory`",r&&"`factoryData`",a&&"`initCode`"].filter(Boolean),name:"SenderAlreadyConstructedError"})}}Object.defineProperty(I,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa10/});class P extends a.C{constructor({cause:e}){super("UserOperation rejected because account signature check failed (or paymaster signature, if the paymaster uses its data as signature).",{cause:e,name:"SignatureCheckFailedError"})}}Object.defineProperty(P,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32507});class k extends a.C{constructor({cause:e}){super("The `validateUserOp` function on the Smart Account reverted.",{cause:e,name:"SmartAccountFunctionRevertedError"})}}Object.defineProperty(k,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa23/});class A extends a.C{constructor({cause:e}){super("UserOperation rejected because account specified unsupported signature aggregator.",{cause:e,name:"UnsupportedSignatureAggregatorError"})}}Object.defineProperty(A,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32506});class C extends a.C{constructor({cause:e}){super("User Operation expired.",{cause:e,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validateUserOp` on the Smart Account are not satisfied"].filter(Boolean),name:"UserOperationExpiredError"})}}Object.defineProperty(C,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa22/});class R extends a.C{constructor({cause:e}){super("Paymaster for User Operation expired.",{cause:e,metaMessages:["This could arise when:","- the `validAfter` or `validUntil` values returned from `validatePaymasterUserOp` on the Paymaster are not satisfied"].filter(Boolean),name:"UserOperationPaymasterExpiredError"})}}Object.defineProperty(R,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa32/});class $ extends a.C{constructor({cause:e}){super("Signature provided for the User Operation is invalid.",{cause:e,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Smart Account"].filter(Boolean),name:"UserOperationSignatureError"})}}Object.defineProperty($,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa24/});
1class j extends a.C{constructor({cause:e}){super("Signature provided for the User Operation is invalid.",{cause:e,metaMessages:["This could arise when:","- the `signature` for the User Operation is incorrectly computed, and unable to be verified by the Paymaster"].filter(Boolean),name:"UserOperationPaymasterSignatureError"})}}Object.defineProperty(j,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa34/});class D extends a.C{constructor({cause:e}){super("User Operation rejected by EntryPoint's `simulateValidation` during account creation or validation.",{cause:e,name:"UserOperationRejectedByEntryPointError"})}}Object.defineProperty(D,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32500});class L extends a.C{constructor({cause:e}){super("User Operation rejected by Paymaster's `validatePaymasterUserOp`.",{cause:e,name:"UserOperationRejectedByPaymasterError"})}}Object.defineProperty(L,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32501});class N extends a.C{constructor({cause:e}){super("User Operation rejected with op code validation error.",{cause:e,name:"UserOperationRejectedByOpCodeError"})}}Object.defineProperty(N,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32502});class U extends a.C{constructor({cause:e}){super("UserOperation out of time-range: either wallet or paymaster returned a time-range, and it is already expired (or will expire soon).",{cause:e,name:"UserOperationOutOfTimeRangeError"})}}Object.defineProperty(U,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32503});class M extends a.C{constructor({cause:e}){super(`An error occurred while executing user operation: ${e?.shortMessage}`,{cause:e,name:"UnknownBundlerError"})}}class G extends a.C{constructor({cause:e}){super("User Operation verification gas limit exceeded.",{cause:e,metaMessages:["This could arise when:","- the gas used for verification exceeded the `verificationGasLimit`"].filter(Boolean),name:"VerificationGasLimitExceededError"})}}Object.defineProperty(G,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa40/});class F extends a.C{constructor({cause:e}){super("User Operation verification gas limit is too low.",{cause:e,metaMessages:["This could arise when:","- the `verificationGasLimit` is too low to verify the User Operation"].filter(Boolean),name:"VerificationGasLimitTooLowError"})}}Object.defineProperty(F,"message",{enumerable:!0,configurable:!0,writable:!0,value:/aa41/});var V=r(71716);let B=[o,w,T,O,x,P,A,U,D,L,N];function K(e,{calls:t,docsPath:r,...K}){let q=(()=>{let r=function(e,t){let r=(e.details||"").toLowerCase();if(i.message.test(r))return new i({cause:e});if(l.message.test(r))return new l({cause:e});if(u.message.test(r))return new u({cause:e});if(c.message.test(r))return new c({cause:e});if(d.message.test(r))return new d({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(p.message.test(r))return new p({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(h.message.test(r))return new h({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode,sender:t.sender});if(y.message.test(r))return new y({cause:e});if(m.message.test(r))return new m({cause:e});if(g.message.test(r))return new g({cause:e,nonce:t.nonce});if(f.message.test(r))return new f({cause:e});if(b.message.test(r))return new b({cause:e});if(v.message.test(r))return new v({cause:e});if(T.message.test(r))return new T({cause:e});if(_.message.test(r))return new _({cause:e});if(E.message.test(r))return new E({cause:e});if(S.message.test(r))return new S({cause:e});if(k.message.test(r))return new k({cause:e});if(I.message.test(r))return new I({cause:e,factory:t.factory,factoryData:t.factoryData,initCode:t.initCode});if(C.message.test(r))return new C({cause:e});if(R.message.test(r))return new R({cause:e});if(j.message.test(r))return new j({cause:e});if($.message.test(r))return new $({cause:e});if(G.message.test(r))return new G({cause:e});if(F.message.test(r))return new F({cause:e});let a=e.walk(e=>B.some(t=>t.code===e.code));if(a){if(a.code===o.code)return new o({cause:e,data:a.data,message:a.details});if(a.code===w.code)return new w({cause:e});if(a.code===T.code)return new T({cause:e});if(a.code===O.code)return new O({cause:e});
1if(a.code===x.code)return new x({cause:e});if(a.code===P.code)return new P({cause:e});if(a.code===A.code)return new A({cause:e});if(a.code===U.code)return new U({cause:e});if(a.code===D.code)return new D({cause:e});if(a.code===L.code)return new L({cause:e});if(a.code===N.code)return new N({cause:e})}return new M({cause:e})}(e,K);if(t&&r instanceof o){let e,i=(r.walk(t=>{if("string"==typeof t.data||"string"==typeof t.data?.revertData||!(t instanceof a.C)&&"string"==typeof t.message){let r=(t.data?.revertData||t.data||t.message).match?.(/(0x[A-Za-z0-9]*)/);if(r)return e=r[1],!0}return!1}),e),o=t?.filter(e=>e.abi);if(i&&o.length>0)return function(e){let{calls:t,revertData:r}=e,{abi:a,functionName:i,args:o,to:l}=(()=>{let e=t?.filter(e=>!!e.abi);if(1===e.length)return e[0];let a=e.filter(e=>{try{return!!(0,s.W)({abi:e.abi,data:r})}catch{return!1}});return 1===a.length?a[0]:{abi:[],functionName:e.reduce((e,t)=>`${e?`${e} | `:""}${t.functionName}`,""),args:void 0,to:void 0}})(),u="0x"===r?new n.rR({functionName:i}):new n.M({abi:a,data:r,functionName:i});return new n.bG(u,{abi:a,args:o,contractAddress:l,functionName:i})}({calls:o,revertData:i})}return r})();return new V.tN(q,{docsPath:r,...K})}},3913:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=r(71450),n=a.__importDefault(r(93537)),s=a.__importDefault(r(5732));class i{constructor(e){var t,r;this.shouldThrowOnError=!1,this.method=e.method,this.url=e.url,this.headers=new Headers(e.headers),this.schema=e.schema,this.body=e.body,this.shouldThrowOnError=null!=(t=e.shouldThrowOnError)&&t,this.signal=e.signal,this.isMaybeSingle=null!=(r=e.isMaybeSingle)&&r,e.fetch?this.fetch=e.fetch:"undefined"==typeof fetch?this.fetch=n.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(e,t){return this.headers=new Headers(this.headers),this.headers.set(e,t),this}then(e,t){void 0===this.schema||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),"GET"!==this.method&&"HEAD"!==this.method&&this.headers.set("Content-Type","application/json");let r=(0,this.fetch)(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async e=>{var t,r,a,n;let i=null,o=null,l=null,u=e.status,c=e.statusText;if(e.ok){if("HEAD"!==this.method){let r=await e.text();""===r||(o="text/csv"===this.headers.get("Accept")||this.headers.get("Accept")&&(null==(t=this.headers.get("Accept"))?void 0:t.includes("application/vnd.pgrst.plan+text"))?r:JSON.parse(r))}let n=null==(r=this.headers.get("Prefer"))?void 0:r.match(/count=(exact|planned|estimated)/),s=null==(a=e.headers.get("content-range"))?void 0:a.split("/");n&&s&&s.length>1&&(l=parseInt(s[1])),this.isMaybeSingle&&"GET"===this.method&&Array.isArray(o)&&(o.length>1?(i={code:"PGRST116",details:`Results contain ${o.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},o=null,l=null,u=406,c="Not Acceptable"):o=1===o.length?o[0]:null)}else{let t=await e.text();try{i=JSON.parse(t),Array.isArray(i)&&404===e.status&&(o=[],i=null,u=200,c="OK")}catch(r){404===e.status&&""===t?(u=204,c="No Content"):i={message:t}}if(i&&this.isMaybeSingle&&(null==(n=null==i?void 0:i.details)?void 0:n.includes("0 rows"))&&(i=null,u=200,c="OK"),i&&this.shouldThrowOnError)throw new s.default(i)}return{error:i,data:o,count:l,status:u,statusText:c}});return this.shouldThrowOnError||(r=r.catch(e=>{var t,r,a;return{error:{message:`${null!=(t=null==e?void 0:e.name)?t:"FetchError"}: ${null==e?void 0:e.message}`,details:`${null!=(r=null==e?void 0:e.stack)?r:""}`,hint:"",code:`${null!=(a=null==e?void 0:e.code)?a:""}`},data:null,count:null,status:0,statusText:""}})),r.then(e,t)}returns(){return this}overrideTypes(){return this}}t.default=i},5009:(e,t,r)=>{r.d(t,{J8:()=>a,UX:()=>n,aU:()=>s});let a=[{type:"function",name:"initialize",inputs:[{name:"_rootValidator",type:"bytes21",internalType:"ValidationId"},{name:"hook",type:"address",internalType:"contract IHook"},{name:"validatorData",type:"bytes",internalType:"bytes"},{name:"hookData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"}],n=[{type:"function",name:"execute",inputs:[{name:"execMode",type:"bytes32",internalType:"ExecMode"},{name:"executionCalldata",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeFromExecutor",inputs:[{name:"execMode",type:"bytes32",internalType:"ExecMode"},{name:"executionCalldata",type:"bytes",internalType:"bytes"}],outputs:[{name:"returnData",type:"bytes[]",internalType:"bytes[]"}],stateMutability:"payable"},{type:"function",name:"executeUserOp",inputs:[{name:"userOp",type:"tuple",internalType:"struct PackedUserOperation",components:[{name:"sender",type:"address",internalType:"address"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"initCode",type:"bytes",internalType:"bytes"},{name:"callData",type:"bytes",internalType:"bytes"},{name:"accountGasLimits",type:"bytes32",internalType:"bytes32"},{name:"preVerificationGas",type:"uint256",internalType:"uint256"},{name:"gasFees",type:"bytes32",internalType:"bytes32"},{name:"paymasterAndData",type:"bytes",internalType:"bytes"},{name:"signature",type:"bytes",internalType:"bytes"}]},{name:"userOpHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"payable"}],s=[{type:"constructor",inputs:[{name:"_entrypoint",type:"address",internalType:"contract IEntryPoint"}],stateMutability:"nonpayable"},{type:"fallback",stateMutability:"payable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"accountId",inputs:[],outputs:[{name:"accountImplementationId",type:"string",internalType:"string"}],stateMutability:"pure"}
1,{type:"function",name:"currentNonce",inputs:[],outputs:[{name:"",type:"uint32",internalType:"uint32"}],stateMutability:"view"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"entrypoint",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IEntryPoint"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"execMode",type:"bytes32",internalType:"ExecMode"},{name:"executionCalldata",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeFromExecutor",inputs:[{name:"execMode",type:"bytes32",internalType:"ExecMode"},{name:"executionCalldata",type:"bytes",internalType:"bytes"}],outputs:[{name:"returnData",type:"bytes[]",internalType:"bytes[]"}],stateMutability:"payable"},{type:"function",name:"executeUserOp",inputs:[{name:"userOp",type:"tuple",internalType:"struct PackedUserOperation",components:[{name:"sender",type:"address",internalType:"address"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"initCode",type:"bytes",internalType:"bytes"},{name:"callData",type:"bytes",internalType:"bytes"},{name:"accountGasLimits",type:"bytes32",internalType:"bytes32"},{name:"preVerificationGas",type:"uint256",internalType:"uint256"},{name:"gasFees",type:"bytes32",internalType:"bytes32"},{name:"paymasterAndData",type:"bytes",internalType:"bytes"},{name:"signature",type:"bytes",internalType:"bytes"}]},{name:"userOpHash",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"payable"},{type:"function",name:"executorConfig",inputs:[{name:"executor",type:"address",internalType:"contract IExecutor"}],outputs:[{name:"",type:"tuple",internalType:"struct ExecutorManager.ExecutorConfig",components:[{name:"hook",type:"address",internalType:"contract IHook"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"_rootValidator",type:"bytes21",internalType:"ValidationId"},{name:"hook",type:"address",internalType:"contract IHook"},{name:"validatorData",type:"bytes",internalType:"bytes"},{name:"hookData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"installModule",inputs:[{name:"moduleType",type:"uint256",internalType:"uint256"},{name:"module",type:"address",internalType:"address"},{name:"initData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"installValidations",inputs:[{name:"vIds",type:"bytes21[]",internalType:"ValidationId[]"},{name:"configs",type:"tuple[]",internalType:"struct ValidationManager.ValidationConfig[]",components:[{name:"nonce",type:"uint32",internalType:"uint32"},{name:"hook",type:"address",internalType:"contract IHook"}]},{name:"validationData",type:"bytes[]",internalType:"bytes[]"},{name:"hookData",type:"bytes[]",internalType:"bytes[]"}],outputs:[],stateMutability:"payable"},{type:"function",name:"invalidateNonce",inputs:[{name:"nonce",type:"uint32",internalType:"uint32"}],outputs:[],stateMutability:"payable"},{type:"function",name:"isAllowedSelector",inputs:[{name:"vId",type:"bytes21",internalType:"ValidationId"},{name:"selector",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"isModuleInstalled",inputs:[{name:"moduleType",type:"uint256",internalType:"uint256"},{name:"module",type:"address",internalType:"address"},{name:"additionalContext",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"isValidSignature",inputs:[{name:"hash",type:"bytes32",internalType:"bytes32"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"permissionConfig",inputs:[{name:"pId",type:"bytes4",internalType:"PermissionId"}],outputs:[{name:"",type:"tuple",internalType:"struct ValidationManager.PermissionConfig",components:[{name:"permissionFlag",type:"bytes2",internalType:"PassFlag"},{name:"signer",type:"address",internalType:"contract ISigner"},{name:"policyData",type:"bytes22[]",internalType:"PolicyData[]"}]}],stateMutability:"view"},{type:"function",name:"rootValidator",inputs:[],outputs:[{name:"",type:"bytes21",internalType:"ValidationId"}],stateMutability:"view"},{type:"function",name:"selectorConfig",inputs:[{name:"selector",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"tuple",internalType:"struct SelectorManager.SelectorConfig",components:[{name:"hook",type:"address",internalType:"contract IHook"},{name:"target",type:"address",internalType:"address"},{name:"callType",type:"bytes1",internalType:"CallType"}]}],stateMutability:"view"}
1,{type:"function",name:"supportsExecutionMode",inputs:[{name:"mode",type:"bytes32",internalType:"ExecMode"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"pure"},{type:"function",name:"supportsModule",inputs:[{name:"moduleTypeId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"pure"},{type:"function",name:"uninstallModule",inputs:[{name:"moduleType",type:"uint256",internalType:"uint256"},{name:"module",type:"address",internalType:"address"},{name:"deInitData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"uninstallValidation",inputs:[{name:"vId",type:"bytes21",internalType:"ValidationId"},{name:"deinitData",type:"bytes",internalType:"bytes"},{name:"hookDeinitData",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"upgradeTo",inputs:[{name:"_newImplementation",type:"address",internalType:"address"}],outputs:[],stateMutability:"payable"},{type:"function",name:"validNonceFrom",inputs:[],outputs:[{name:"",type:"uint32",internalType:"uint32"}],stateMutability:"view"},{type:"function",name:"validateUserOp",inputs:[{name:"userOp",type:"tuple",internalType:"struct PackedUserOperation",components:[{name:"sender",type:"address",internalType:"address"},{name:"nonce",type:"uint256",internalType:"uint256"},{name:"initCode",type:"bytes",internalType:"bytes"},{name:"callData",type:"bytes",internalType:"bytes"},{name:"accountGasLimits",type:"bytes32",internalType:"bytes32"},{name:"preVerificationGas",type:"uint256",internalType:"uint256"},{name:"gasFees",type:"bytes32",internalType:"bytes32"},{name:"paymasterAndData",type:"bytes",internalType:"bytes"},{name:"signature",type:"bytes",internalType:"bytes"}]},{name:"userOpHash",type:"bytes32",internalType:"bytes32"},{name:"missingAccountFunds",type:"uint256",internalType:"uint256"}],outputs:[{name:"validationData",type:"uint256",internalType:"ValidationData"}],stateMutability:"payable"},{type:"function",name:"validationConfig",inputs:[{name:"vId",type:"bytes21",internalType:"ValidationId"}],outputs:[{name:"",type:"tuple",internalType:"struct ValidationManager.ValidationConfig",components:[{name:"nonce",type:"uint32",internalType:"uint32"},{name:"hook",type:"address",internalType:"contract IHook"}]}],stateMutability:"view"},{type:"event",name:"ModuleInstalled",inputs:[{name:"moduleTypeId",type:"uint256",indexed:!1,internalType:"uint256"},{name:"module",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"ModuleUninstallResult",inputs:[{name:"module",type:"address",indexed:!1,internalType:"address"},{name:"result",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"ModuleUninstalled",inputs:[{name:"moduleTypeId",type:"uint256",indexed:!1,internalType:"uint256"},{name:"module",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"NonceInvalidated",inputs:[{name:"nonce",type:"uint32",indexed:!1,internalType:"uint32"}],anonymous:!1},{type:"event",name:"PermissionInstalled",inputs:[{name:"permission",type:"bytes4",indexed:!1,internalType:"PermissionId"},{name:"nonce",type:"uint32",indexed:!1,internalType:"uint32"}],anonymous:!1},{type:"event",name:"PermissionUninstalled",inputs:[{name:"permission",type:"bytes4",indexed:!1,internalType:"PermissionId"}],anonymous:!1},{type:"event",name:"Received",inputs:[{name:"sender",type:"address",indexed:!1,internalType:"address"},{name:"amount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"RootValidatorUpdated",inputs:[{name:"rootValidator",type:"bytes21",indexed:!1,internalType:"ValidationId"}],anonymous:!1},{type:"event",name:"SelectorSet",inputs:[{name:"selector",type:"bytes4",indexed:!1,internalType:"bytes4"},{name:"vId",type:"bytes21",indexed:!1,internalType:"ValidationId"},{name:"allowed",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"TryExecuteUnsuccessful",inputs:[{name:"batchExecutionindex",type:"uint256",indexed:!1,internalType:"uint256"},{name:"result",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"ValidatorInstalled",inputs:[{name:"validator",type:"address",indexed:!1,internalType:"contract IValidator"},{name:"nonce",type:"uint32",indexed:!1,internalType:"uint32"}],anonymous:!1},{type:"event",name:"ValidatorUninstalled",inputs:[{name:"validator",type:"address",indexed:!1,internalType:"contract IValidator"}],anonymous:!1},{type:"error",name:"EnableNotApproved",inputs:[]},{type:"error",name:"ExecutionReverted",inputs:[]}
1,{type:"error",name:"InvalidCallType",inputs:[]},{type:"error",name:"InvalidCaller",inputs:[]},{type:"error",name:"InvalidExecutor",inputs:[]},{type:"error",name:"InvalidFallback",inputs:[]},{type:"error",name:"InvalidMode",inputs:[]},{type:"error",name:"InvalidModuleType",inputs:[]},{type:"error",name:"InvalidNonce",inputs:[]},{type:"error",name:"InvalidSelector",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"InvalidValidationType",inputs:[]},{type:"error",name:"InvalidValidator",inputs:[]},{type:"error",name:"NonceInvalidationError",inputs:[]},{type:"error",name:"NotSupportedCallType",inputs:[]},{type:"error",name:"OnlyExecuteUserOp",inputs:[]},{type:"error",name:"PermissionDataLengthMismatch",inputs:[]},{type:"error",name:"PermissionNotAlllowedForSignature",inputs:[]},{type:"error",name:"PermissionNotAlllowedForUserOp",inputs:[]},{type:"error",name:"PolicyDataTooLarge",inputs:[]},{type:"error",name:"PolicyFailed",inputs:[{name:"i",type:"uint256",internalType:"uint256"}]},{type:"error",name:"PolicySignatureOrderError",inputs:[]},{type:"error",name:"RootValidatorCannotBeRemoved",inputs:[]},{type:"error",name:"SignerPrefixNotPresent",inputs:[]}]},5732:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0});class r extends Error{constructor(e){super(e.message),this.name="PostgrestError",this.details=e.details,this.hint=e.hint,this.co
1de=e.code}}t.default=r},6563:(e,t,r)=>{let a=r(240),n=r(52376),{ANY:s}=n,i=r(76353),o=r(16088),l=r(18252),u=r(81947),c=r(68226),d=r(67199);e.exports=(e,t,r,p)=>{let h,y,m,f,g;switch(e=new a(e,p),t=new i(t,p),r){case">":h=l,y=c,m=u,f=">",g=">=";break;case"<":h=u,y=d,m=l,f="<",g="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(o(e,t,p))return!1;for(let r=0;r<t.set.length;++r){let a=t.set[r],i=null,o=null;if(a.forEach(e=>{e.semver===s&&(e=new n(">=0.0.0")),i=i||e,o=o||e,h(e.semver,i.semver,p)?i=e:m(e.semver,o.semver,p)&&(o=e)}),i.operator===f||i.operator===g||(!o.operator||o.operator===f)&&y(e,o.semver)||o.operator===g&&m(e,o.semver))return!1}return!0}},8185:(e,t,r)=>{r.d(t,{l:()=>i});var a=r(11914),n=r(34561),s=r(52539);async function i(e,t){let{chainId:r,entryPointAddress:i,context:o,...l}=t,u=(0,s.P)(l),{paymasterPostOpGasLimit:c,paymasterVerificationGasLimit:d,...p}=await e.request({method:"pm_getPaymasterData",params:[{...u,callGasLimit:u.callGasLimit??"0x0",verificationGasLimit:u.verificationGasLimit??"0x0",preVerificationGas:u.preVerificationGas??"0x0"},i,(0,n.cK)(r),o]});return{...p,...c&&{paymasterPostOpGasLimit:(0,a.uU)(c)},...d&&{paymasterVerificationGasLimit:(0,a.uU)(d)}}}},11204:(e,t,r)=>{r.d(t,{b:()=>i});var a=r(71716),n=r(52623),s=r(90523);async function i(e,{hash:t}){let r=await e.request({method:"eth_getUserOperationReceipt",params:[t]},{dedupe:!0});if(!r)throw new a.oX({hash:t});let i={...r};return r.actualGasCost&&(i.actualGasCost=BigInt(r.actualGasCost)),r.actualGasUsed&&(i.actualGasUsed=BigInt(r.actualGasUsed)),r.logs&&(i.logs=r.logs.map(e=>(0,n.e)(e))),r.receipt&&(i.receipt=(0,s.uL)(i.receipt)),i}},12948:(e,t,r)=>{let a=r(95934);e.exports=(e,t)=>{let r=a(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null}},15831:(e,t,r)=>{let a=r(95934);e.exports=(e,t)=>{let r=a(e,t);return r?r.version:null}},16088:(e,t,r)=>{let a=r(76353);e.exports=(e,t,r)=>{try{t=new a(t,r)}catch(e){return!1}return t.test(e)}},18252:(e,t,r)=>{let a=r(48390);e.exports=(e,t,r)=>a(e,t,r)>0},20403:(e,t,r)=>{r.d(t,{H:()=>l});var a=r(95089),n=r(8185),s=r(40721);function i(e){return{getPaymasterData:t=>(0,n.l)(e,t),getPaymasterStubData:t=>(0,s.L)(e,t)}}var o=r(60674);let l=e=>{let{key:t="public",name:r="ZeroDev Paymaster Client",transport:n}=e;return(0,a.U)({...e,transport:e=>n({...e,retryCount:0}),key:t,name:r,type:"zerodevPaymasterClient"}).extend(i).extend((0,o.r)())}},21641:(e,t,r)=>{r.d(t,{V:()=>u});var a=r(72757),n=r(87639),s=r(94788),i=r(59350),o=r(71716),l=r(11204);function u(e,t){let{hash:r,pollingInterval:u=e.pollingInterval,retryCount:c,timeout:d=12e4}=t,p=0,h=(0,i.A)(["waitForUserOperationReceipt",e.uid,r]);return new Promise((t,i)=>{let y=(0,n.lB)(h,{resolve:t,reject:i},t=>{let n=e=>{i(),e(),y()},i=(0,s.w)(async()=>{c&&p>=c&&n(()=>t.reject(new o.Wm({hash:r})));try{let s=await (0,a.T)(e,l.b,"getUserOperationReceipt")({hash:r});n(()=>t.resolve(s))}catch(e){"UserOperationReceiptNotFoundError"!==e.name&&n(()=>t.reject(e))}p++},{emitOnBegin:!0,interval:u});return d&&setTimeout(()=>n(()=>t.reject(new o.Wm({hash:r}))),d),i})})}},22747:(e,t,r)=>{r.d(t,{I:()=>d});var a=r(95355),n=r(44287),s=r(71415),i=r(27410),o=r(49304),l=r(35471),u=r(36369);let c={"0.0.2 - 0.2.4":"0xd9AB5096a832b9ce79914329DAEE236f8Eea0390","0.3.0":"0x8104e3Ad430EA6d354d013A6789fDFc71E671c43",">=0.3.1":"0x845ADb2C711129d4f3966735eD98a9F09fC4cE57"};async function d(e,{signer:t,entryPoint:r,kernelVersion:d,validatorAddress:p}){let h=((e,t,r)=>{(0,a.M5)(e.version,t);let n=Object.entries(c).find(([e])=>(0,a.jY)(t,e))?.[1];if(!n&&!r)throw Error(`Validator not found for Kernel version: ${t}`);return r??n??s.Xd})(r,d,p),y=await (0,n.q)({signer:t}),m=await (0,l.T)(e);return{...(0,o.t)({address:y.address,signMessage:async({message:t})=>(0,u.l)(e,{account:y,message:t}),async signTransaction(e,t){throw Error("Smart account signer doesn't need to sign transactions")},signTypedData:async e=>y.signTypedData(e)}),supportedKernelVersions:d,validatorType:"SECONDARY",address:h,source:"ECDSAValidator",getIdentifier:()=>h,getEnableData:async()=>y.address,getNonceKey:async(e,t)=>t||0n,async signUserOperation(t){let a=(0,i.Z)({userOperation:{...t,signature:"0x"},entryPointAddress:r.address,entryPointVersion:r.version,chainId:m});return await (0,u.l)(e,{account:y,message:{raw:a}})},getStubSignature:async()=>"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",isEnabled:async(e,t)=>!1}}},26301:(e,t,r)=>{let a=r(48390);e.exports=(e,t,r)=>0===a(e,t,r)},27410:(e,t,r)=>{r.d(t,{Z:()=>p});var a=r(41706),n=r(80329),s=r(32522),i=r(40290);function o(e){let{authorization:t,factory:r,factoryData:a}=e;if("0x7702"===r||"0x7702000000000000000000000000000000000000"===r){if(!t)return"0x7702000000000000000000000000000000000000";let e=t.address;return(0,i.xW)([e,a??"0x"])}return r?(0,i.xW)([r,a??"0x"]):"0x"}var l=r(72427),u=r(34561);function c(e){let{callGasLimit:t,callData:r,maxPriorityFeePerGas:a,maxFeePerGas:n,paymaster:s,paymasterData:c,paymasterPostOpGasLimit:d,paymasterVerificationGasLimit:p,sender:h,signature:y="0x",verificationGasLimit:m}=e,f=(0,i.xW)([(0,l.eV)((0,u.cK)(m||0n),{size:16}),(0,l.eV)((0,u.cK)(t||0n),{size:16})]),g=o(e),b=(0,i.xW)([(0,l.eV)((0,u.cK)(a||0n),{size:16}),(0,l.eV)((0,u.cK)(n||0n),{size:16})]),w=e.nonce??0n;return{accountGasLimits:f,callData:r,initCode:g,gasFees:b,nonce:w,paymasterAndData:s?(0,i.xW)([s,(0,l.eV)((0,u.cK)(p||0n),{size:16}),(0,l.eV)((0,u.cK)(d||0n),{size:16}),c||"0x"]):"0x",preVerificationGas:e.preVerificationGas??0n,sender:h,signature:y}}let d={PackedUserOperation:[{type:"address",name:"sender"},{type:"uint256",name:"nonce"},{type:"bytes",name:"initCode"},{type:"bytes",name:"callData"},{type:"bytes32",name:"accountGasLimits"},{type:"uint256",name:"preVerificationGas"},{type:"bytes32",name:"gasFees"},{type:"bytes",name:"paymasterAndData"}]};function p(e){let{chainId:t,entryPointAddress:r,entryPointVersion:i}=e,l=e.userOperation,{authorization:u,callData:p="0x",callGasLimit:h,maxFeePerGas:y,maxPriorityFeePerGas:m,nonce:f,paymasterAndData:g="0x",preVerificationGas:b,sender:w,verificationGasLimit:v}=l;if("0.8"===i)return(0,s.Zh)(function(e){let{chainId:t,entryPointAddress:r,userOperation:a}=e;return{types:d,primaryType:"PackedUserOperation",domain:{name:"ERC4337",version:"1",chainId:t,verifyingContract:r},message:c(a)}}({chainId:t,entryPointAddress:r,userOperation:l}));let T=(()=>
1{if("0.6"===i){let e=o({authorization:u,factory:l.initCode?.slice(0,42),factoryData:l.initCode?.slice(42)});return(0,a.h)([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"uint256"},{type:"bytes32"}],[w,f,(0,n.S)(e),(0,n.S)(p),h,v,b,y,m,(0,n.S)(g)])}if("0.7"===i){let e=c(l);return(0,a.h)([{type:"address"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"},{type:"bytes32"},{type:"uint256"},{type:"bytes32"},{type:"bytes32"}],[e.sender,e.nonce,(0,n.S)(e.initCode),(0,n.S)(e.callData),e.accountGasLimits,e.preVerificationGas,e.gasFees,(0,n.S)(e.paymasterAndData)])}throw Error(`entryPointVersion "${i}" not supported.`)})();return(0,n.S)((0,a.h)([{type:"bytes32"},{type:"address"},{type:"uint256"}],[(0,n.S)(T),r,BigInt(t)]))}},28951:(e,t,r)=>{let a=r(6563);e.exports=(e,t,r)=>a(e,t,">",r)},31098:(e,t,r)=>{let a=r(6563);e.exports=(e,t,r)=>a(e,t,"<",r)},32159:(e,t,r)=>{let a=r(93127);e.exports=(e,t)=>e.sort((e,r)=>a(r,e,t))},32528:(e,t,r)=>{let a=r(95934);e.exports=(e,t)=>{let r=a(e,null,!0),n=a(t,null,!0),s=r.compare(n);if(0===s)return null;let i=s>0,o=i?r:n,l=i?n:r,u=!!o.prerelease.length;if(l.prerelease.length&&!u){if(!l.patch&&!l.minor)return"major";if(0===l.compareMain(o))return l.minor&&!l.patch?"minor":"patch"}let c=u?"pre":"";return r.major!==n.major?c+"major":r.minor!==n.minor?c+"minor":r.patch!==n.patch?c+"patch":"prerelease"}},34747:e=>{let t=/^[0-9]+$/,r=(e,r)=>{let a=t.test(e),n=t.test(r);return a&&n&&(e*=1,r*=1),e===r?0:a&&!n?-1:n&&!a?1:e<r?-1:1};e.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}},36706:e=>{e.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||0x1fffffffffffff,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}},37338:(e,t,r)=>{let a=r(240),n=r(95934),{safeRe:s,t:i}=r(82404);e.exports=(e,t)=>{if(e instanceof a)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){let a,n=t.includePrerelease?s[i.COERCERTLFULL]:s[i.COERCERTL];for(;(a=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&a.index+a[0].length===r.index+r[0].length||(r=a),n.lastIndex=a.index+a[1].length+a[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?s[i.COERCEFULL]:s[i.COERCE]);if(null===r)return null;let o=r[2],l=r[3]||"0",u=r[4]||"0",c=t.includePrerelease&&r[5]?`-${r[5]}`:"",d=t.includePrerelease&&r[6]?`+${r[6]}`:"";return n(`${o}.${l}.${u}${c}${d}`,t)}},37402:(e,t,r)=>{let a=r(76353);e.exports=(e,t,r)=>(e=new a(e,r),t=new a(t,r),e.intersects(t,r))},37977:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=r(71450),n=a.__importDefault(r(72901)),s=a.__importDefault(r(54419));class i{constructor(e,{headers:t={},schema:r,fetch:a}={}){this.url=e,this.headers=new Headers(t),this.schemaName=r,this.fetch=a}from(e){let t=new URL(`${this.url}/${e}`);return new n.default(t,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(e){return new i(this.url,{headers:this.headers,schema:e,fetch:this.fetch})}rpc(e,t={},{head:r=!1,get:a=!1,count:n}={}){var i;let o,l,u=new URL(`${this.url}/rpc/${e}`);r||a?(o=r?"HEAD":"GET",Object.entries(t).filter(([e,t])=>void 0!==t).map(([e,t])=>[e,Array.isArray(t)?`{${t.join(",")}}`:`${t}`]).forEach(([e,t])=>{u.searchParams.append(e,t)})):(o="POST",l=t);let c=new Headers(this.headers);return n&&c.set("Prefer",`count=${n}`),new s.default({method:o,url:u,headers:c,schema:this.schemaName,body:l,fetch:null!=(i=this.fetch)?i:fetch})}}t.default=i},39955:(e,t,r)=>{r.d(t,{H:()=>eL});var a,n=r(91039),s=r(30931),i=r(71415),o=r(34561),l=r(32108),u=(r(6434),r(20390));function c(e){let{source:t}=e,r=new Map,a=new u.A(8192),n=new Map,s=({address:e,chainId:t})=>`${e}.${t}`;return{async consume({address:e,chainId:r,client:n}){let i=s({address:e,chainId:r}),o=this.get({address:e,chainId:r,client:n});this.increment({address:e,chainId:r});let l=await o;return await t.set({address:e,chainId:r},l),a.set(i,l),l}
vendor: 16,384 bytes, line 1
1,async increment({address:e,chainId:t}){let a=s({address:e,chainId:t}),n=r.get(a)??0;r.set(a,n+1)},async get({address:e,chainId:i,client:o}){let l=s({address:e,chainId:i}),u=n.get(l);return u||(u=(async()=>{try{let r=await t.get({address:e,chainId:i,client:o}),n=a.get(l)??0;if(n>0&&r<=n)return n+1;return a.delete(l),r}finally{this.reset({address:e,chainId:i})}})(),n.set(l,u)),(r.get(l)??0)+await u},reset({address:e,chainId:t}){let a=s({address:e,chainId:t});r.delete(a),n.delete(a)}}}var d=r(82323),p=r(40290),h=r(57001),y=r(32522),m=r(97338);let f=[{inputs:[{name:"preOpGas",type:"uint256"},{name:"paid",type:"uint256"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"targetSuccess",type:"bool"},{name:"targetResult",type:"bytes"}],name:"ExecutionResult",type:"error"},{inputs:[{name:"opIndex",type:"uint256"},{name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"}],name:"ValidationResult",type:"error"},{inputs:[{components:[{name:"preOpGas",type:"uint256"},{name:"prefund",type:"uint256"},{name:"sigFailed",type:"bool"},{name:"validAfter",type:"uint48"},{name:"validUntil",type:"uint48"},{name:"paymasterContext",type:"bytes"}],name:"returnInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"senderInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"factoryInfo",type:"tuple"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"paymasterInfo",type:"tuple"},{components:[{name:"aggregator",type:"address"},{components:[{name:"stake",type:"uint256"},{name:"unstakeDelaySec",type:"uint256"}],name:"stakeInfo",type:"tuple"}],name:"aggregatorInfo",type:"tuple"}],name:"ValidationResultWithAggregation",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"factory",type:"address"},{indexed:!1,name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalStaked",type:"uint256"},{indexed:!1,name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"paymaster",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"success",type:"bool"},{indexed:!1,name:"actualGasCost",type:"uint256"},{indexed:!1,name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[],name:"SIG_VALIDATION_FAILED",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"},{name:"sender",type:"address"},{name:"paymasterAndData",type:"bytes"}],name:"_validateSenderAndPaymaster",outputs:[],stateMutability:"view",type:"function"},{inputs:[{name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"",type:"address"}],name:"deposits",outputs:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{name:"deposit",type:"uint112"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{name:"sender",type:"address"},{name:"key",type:"uint192"}],name:"getNonce",outputs:[{name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOps",type:"tuple[]"},{name:"aggregator",type:"address"},{name:"signature",type:"bytes"}],name:"opsPerAggregator",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"ops",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"key",type:"uint192"}],name:"incrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"callData",type:"bytes"},{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"paymaster",type:"address"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"}],name:"mUserOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"prefund",type:"uint256"},{name:"contextOffset",type:"uint256"},{name:"preOpGas",type:"uint256"}],name:"opInfo",type:"tuple"},{name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"",type:"address"},{name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"op",type:"tuple"},{name:"target",type:"address"},{name:"targetCallData",type:"bytes"}],name:"simulateHandleOp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"callGasLimit",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"simulateValidation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"},{name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],g=[{inputs:[{name:"success",type:"bool"},{name:"ret",type:"bytes"}],name:"DelegateAndRevert",type:"error"},{inputs:[{name:"opIndex",type:"uint256"},{name:"reason",type:"string"}],name:"FailedOp",type:"error"},{inputs:[{name:"opIndex",type:"uint256"},{name:"reason",type:"string"},{name:"inner",type:"bytes"}],name:"FailedOpWithRevert",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"PostOpReverted",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[{name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{name:"aggregator",type:"address"}],name:"SignatureValidationFailed",type:"error"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"factory",type:"address"},{indexed:!1,name:"paymaster",type:"address"}],name:"AccountDeployed",type:"event"},{anonymous:!1,inputs:[],name:"BeforeExecution",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalDeposit",type:"uint256"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"revertReason",type:"bytes"}],name:"PostOpRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"aggregator",type:"address"}],name:"SignatureAggregatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"totalStaked",type:"uint256"},{indexed:!1,name:"unstakeDelaySec",type:"uint256"}],name:"StakeLocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawTime",type:"uint256"}],name:"StakeUnlocked",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"StakeWithdrawn",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!0,name:"paymaster",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"success",type:"bool"},{indexed:!1,name:"actualGasCost",type:"uint256"},{indexed:!1,name:"actualGasUsed",type:"uint256"}],name:"UserOperationEvent",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"}],name:"UserOperationPrefundTooLow",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"userOpHash",type:"bytes32"},{indexed:!0,name:"sender",type:"address"},{indexed:!1,name:"nonce",type:"uint256"},{indexed:!1,name:"revertReason",type:"bytes"}],name:"UserOperationRevertReason",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"account",type:"address"},{indexed:!1,name:"withdrawAddress",type:"address"},{indexed:!1,name:"amount",type:"uint256"}],name:"Withdrawn",type:"event"},{inputs:[{name:"unstakeDelaySec",type:"uint32"}],name:"addStake",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"target",type:"address"},{name:"data",type:"bytes"}],name:"delegateAndRevert",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"account",type:"address"}],name:"depositTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{name:"",type:"address"}],name:"deposits",outputs:[{name:"deposit",type:"uint256"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"getDepositInfo",outputs:[{components:[{name:"deposit",type:"uint256"},{name:"staked",type:"bool"},{name:"stake",type:"uint112"},{name:"unstakeDelaySec",type:"uint32"},{name:"withdrawTime",type:"uint48"}],name:"info",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{name:"sender",type:"address"},{name:"key",type:"uint192"}],name:"getNonce",outputs:[{name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"accountGasLimits",type:"bytes32"},{name:"preVerificationGas",type:"uint256"},{name:"gasFees",type:"bytes32"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOp",type:"tuple"}],name:"getUserOpHash",outputs:[{name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"accountGasLimits",type:"bytes32"},{name:"preVerificationGas",type:"uint256"},{name:"gasFees",type:"bytes32"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"userOps",type:"tuple[]"},{name:"aggregator",type:"address"},{name:"signature",type:"bytes"}],name:"opsPerAggregator",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleAggregatedOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"initCode",type:"bytes"},{name:"callData",type:"bytes"},{name:"accountGasLimits",type:"bytes32"},{name:"preVerificationGas",type:"uint256"},{name:"gasFees",type:"bytes32"},{name:"paymasterAndData",type:"bytes"},{name:"signature",type:"bytes"}],name:"ops",type:"tuple[]"},{name:"beneficiary",type:"address"}],name:"handleOps",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"key",type:"uint192"}],name:"i
1ncrementNonce",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"callData",type:"bytes"},{components:[{components:[{name:"sender",type:"address"},{name:"nonce",type:"uint256"},{name:"verificationGasLimit",type:"uint256"},{name:"callGasLimit",type:"uint256"},{name:"paymasterVerificationGasLimit",type:"uint256"},{name:"paymasterPostOpGasLimit",type:"uint256"},{name:"preVerificationGas",type:"uint256"},{name:"paymaster",type:"address"},{name:"maxFeePerGas",type:"uint256"},{name:"maxPriorityFeePerGas",type:"uint256"}],name:"mUserOp",type:"tuple"},{name:"userOpHash",type:"bytes32"},{name:"prefund",type:"uint256"},{name:"contextOffset",type:"uint256"},{name:"preOpGas",type:"uint256"}],name:"opInfo",type:"tuple"},{name:"context",type:"bytes"}],name:"innerHandleOp",outputs:[{name:"actualGasCost",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"",type:"address"},{name:"",type:"uint192"}],name:"nonceSequenceNumber",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"unlockStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"}],name:"withdrawStake",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{name:"withdrawAddress",type:"address"},{name:"withdrawAmount",type:"uint256"}],name:"withdrawTo",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];var b=r(68836),w=r(53108),v=r(25157),T=r(72757),_=r(41706),E=r(55563);function O(e){let{address:t,data:r,signature:a,to:n="hex"}=e,s=(0,p.aP)([(0,_.h)([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,r,a]),"0x6492649264926492649264926492649264926492649264926492649264926492"]);return"hex"===n?s:(0,E.aT)(s)}async function x(e){let{extend:t,nonceKeyManager:r=c({source:{get:()=>Date.now(),set(){}}}),...a}=e,n=!1,s=await e.getAddress();return{...t,...a,address:s,async getFactoryArgs(){return"isDeployed"in this&&await this.isDeployed()?{factory:void 0,factoryData:void 0}:e.getFactoryArgs()},async getNonce(t){let a=t?.key??BigInt(await r.consume({address:s,chainId:e.client.chain.id,client:e.client}));return e.getNonce?await e.getNonce({...t,key:a}):await (0,v.J)(e.client,{abi:(0,b.U)(["function getNonce(address, uint192) pure returns (uint256)"]),address:e.entryPoint.address,functionName:"getNonce",args:[s,a]})},isDeployed:async()=>!!n||(n=!!await (0,T.T)(e.client,w.Q,"getCode")({address:s})),...e.sign?{async sign(t){let[{factory:r,factoryData:a},n]=await Promise.all([this.getFactoryArgs(),e.sign(t)]);return r&&a?O({address:r,data:a,signature:n}):n}}:{},async signMessage(t){let[{factory:r,factoryData:a},n]=await Promise.all([this.getFactoryArgs(),e.signMessage(t)]);return r&&a&&"0x7702"!==r?O({address:r,data:a,signature:n}):n},async signTypedData(t){let[{factory:r,factoryData:a},n]=await Promise.all([this.getFactoryArgs(),e.signTypedData(t)]);return r&&a&&"0x7702"!==r?O({address:r,data:a,signature:n}):n},type:"smart"}}var S=r(35471),I=r(62735),P=r(84475),k=r(13933),A=r(35326),C=r(4058),R=r(73168),$=r(41343),j=r(34279);class D extends k.C{constructor({cause:e,entryPointAddress:t}={}){super(`The entry point address (\`entryPoint\`${t?` = ${t}`:""}) is not a valid entry point. getSenderAddress did not revert with a SenderAddressResult error.`,{cause:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidEntryPointError"})}}let L=async(e,t)=>{let{initCode:r,entryPointAddress:a,factory:n,factoryData:s}=t;if(!r&&!n&&!s)throw Error("Either `initCode` or `factory` and `factoryData` must be provided");try{await (0,T.T)(e,j.v,"simulateContract")({address:a,abi:[{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"},{inputs:[{internalType:"bytes",name:"initCode",type:"bytes"}],name:"getSenderAddress",outputs:[],stateMutability:"nonpayable",type:"function"}],functionName:"getSenderAddress",args:[r||(0,p.xW)([n,s])]})}catch(t){let e=t.walk(e=>e instanceof A.M||e instanceof C.J8||e instanceof R.Di||e instanceof R.MI);if(!e){let e=t.cause;if("SenderAddressResult"===(e?.data?.errorName??"")&&e?.data?.args&&e?.data?.args[0])return e.data?.args[0]}if(e instanceof A.M&&"SenderAddressResult"===(e.data?.errorName??"")&&e.data?.args&&e.data?.args[0])return e.data?.args[0];if(e instanceof C.J8){let t=e.cause.data.match(/0x[a-fA-F0-9]+/);if(!t)throw Error("Failed to parse revert bytes from RPC response");let r=t[0];return(0,$.W)({abi:[{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"}],data:r}).args[0]}if(e instanceof R.Di){let{data:e}=t instanceof A.$S?t:t instanceof k.C?t.walk(e=>"data"in e)||t.walk():{},r="string"==typeof e?e:e?.data;if(void 0===r)throw Error("Failed to parse revert bytes from RPC response");return(0,$.W)({abi:[{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"}],data:r}).args[0]}if(e instanceof R.MI){let t=JSON.parse(e.cause.body).error.data.match(/0x[a-fA-F0-9]+/);if(!t)throw Error("Failed to parse revert bytes from RPC response");let r=t[0];return(0,$.W)({abi:[{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"SenderAddressResult",type:"error"}],data:r}).args[0]}throw t}throw new D({entryPointAddress:a})},N=[{type:"function",name:"isInitialized",inputs:[{name:"smartAccount",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"}],U=[{inputs:[{internalType:"uint256",name:"moduleType",type:"uint256"},{internalType:"address",name:"module",type:"address"},{internalType:"bytes",name:"initData",type:"bytes"}],stateMutability:"payable",type:"function",name:"installModule"}],M=[{inputs:[{internalType:"uint256",name:"moduleType",type:"uint256"},{internalType:"address",name:"module",type:"address"},{internalType:"bytes",name:"additionalContext",type:"bytes"}],stateMutability:"view",type:"function",name:"isModuleInstalled",outputs:[{internalType:"bool",name:"",type:"bool"}]}],G=async(e,t)=>{let{address:r,plugin:a}=t,{type:n,address:s,data:i="0x"}=a;try{return await (0,T.T)(e,v.J,"readContract")({address:r,abi:M,functionName:"isModuleInstalled",args:[BigInt(n),s,i]})}catch(e){return!1}},F=async(e,t)=>{let{address:r,entryPointAddress:a,key:n=BigInt(0)}=t;return await (0,T.T)(e,v.J,"readContract")({address:a,abi:[{inputs:[{name:"sender",type:"address"},{name:"key",type:"uint192"}],name:"getNonce",outputs:[{name:"nonce",type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"getNonce",args:[r,n]})};var V=r(66707),B=r(95355),K=r(44287),q=r(49304),H=r(27410),W=r(36369);async function z(e,{signer:t,entryPoint:r,kernelVersion:a}){let n=await (0,K.q)({signer:t}),s=e.chain?.id??await (0,S.T)(e);return{...(0,q.t)({address:n.address,signMessage:async({message:t})=>(0,W.l)(e,{account:n,message:t}),async signTransaction(e,t){throw Error("Smart account signer doesn't need to sign transactions")},signTypedData:async e=>n.signTypedData(e)}),supportedKernelVersions:a,validatorType:"EIP7702",address:n.address,source:"EIP7702Validator",getIdentifier:()=>"0x",getEnableData:async()=>n.address,getNonceKey:async(e,t)=>t||0n,async signUserOperation(t){let a=(0,H.Z)({userOperation:{...t,signature:"0x"},entryPointAddress:r.address,entryPointVersion:r.version,chainId:s});return await (0,W.l)(e,{account:n,message:{raw:a}})},getStubSignature:async()=>"0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",isEnabled:async(e,t)=>!1}}var J=r(44016),X=r(72427);let Y=[{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"},{internalType:"enum Operation",name:"",type:"uint8"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct Call[]",name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"executeDelegateCall",outputs:[],stateMutability:"payable",type:"function"}],Q=[{inputs:[{internalType:"contract IKernelValidator",name:"_defaultValidator",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"}],Z=[{inputs:[{internalType:"contract IEntryPoint",name:"_entryPoint",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AlreadyInitialized",type:"error"},{inputs:[],name:"DisabledMode",type:"error"},{inputs:[],name:"NotAuthorizedCaller",type:"error"},{inputs:[],name:"NotEntryPoint",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldValidator",type:"address"},{indexed:!0,internalType:"address",name:"newValidator",type:"address"}],name:"DefaultValidatorChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes4",name:"selector",type:"bytes4"},{indexed:!0,internalType:"address",name:"executor",type:"address"},{indexed:!0,internalType:"address",name:"validator",type:"address"}],name:"ExecutionChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"sender",type:"address"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"Received",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newImplementation",type:"address"}],name:"Upgraded",type:"event"},{stateMutability:"payable",type:"fallback"},{inputs:[{internalType:"bytes4",name:"_disableFlag",type:"bytes4"}],name:"disableMode",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"entryPoint",outputs:[{internalType:"contract IEntryPoint",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"},{internalType:"enum Operation",name:"",type:"uint8"}],name:"execute",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],internalType:"struct Call[]",name:"calls",type:"tuple[]"}],name:"executeBatch",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"executeDelegateCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"getDefaultValidator",outputs:[{internalType:"contract IKernelValidator",name:"validator",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDisabledMode",outputs:[{internalType:"bytes4",name:"disabled",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"_selector",type:"bytes4"}],name:"getExecution",outputs:[{components:[{internalType:"ValidAfter",name:"validAfter",type:"uint48"},{internalType:"ValidUntil",name:"validUntil",type:"uint48"},{internalType:"address",name:"executor",type:"address"},{internalType:"contract IKernelValidator",name:"validator",type:"address"}],internalType:"struct ExecutionDetail",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLastDisabledTime",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint192",name:"key",type:"uint192"}],name:"getNonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getNonce",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IKernelValidator",name:"_defaultValidator",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"initialize",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes32",name:"hash",type:"bytes32"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"isValidSignature",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"uint256[]",name:"",type:"uint256[]"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155BatchReceived",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC1155Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"},{internalType:"address",name:"",type:"address"},{internalType:"uint256",name:"",type:"uint256"},{internalType:"bytes",name:"",type:"bytes"}],name:"onERC721Received",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"pure",type:"function"},{inputs:[{internalType:"contract IKernelValidator",name:"_defaultValidator",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"}],name:"setDefaultValidator",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"bytes4",name:"_selector",type:"bytes4"},{internalType:"address",name:"_executor",type:"address"},{internalType:"contract IKernelValidator",name:"_validator",type:"address"},{internalType:"ValidUntil",name:"_validUntil",type:"uint48"},{internalType:"ValidAfter",name:"_validAfter",type:"uint48"},{internalType:"bytes",name:"_enableData",type:"bytes"}],name:"setExecution",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"_newImplementation",type:"address"}],name:"upgradeTo",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"nonce",type:"uint256"},{internalType:"bytes",name:"initCode",type:"bytes"},{internalType:"bytes",name:"callData",type:"bytes"},{internalType:"uint256",name:"callGasLimit",type:"uint256"},{internalType:"uint256",name:"verificationGasLimit",type:"uint256"},{internalType:"uint256",name:"preVerificationGas",type:"uint256"},{internalType:"uint256",name:"maxFeePerGas",type:"uint256"},{internalType:"uint256",name:"maxPriorityFeePerGas",type:"uint256"},{internalType:"bytes",name:"paymasterAndData",type:"bytes"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct UserOperation",name:"_userOp",type:"tuple"},{internalType:"bytes32",name:"userOpHash",type:"bytes32"},{internalType:"uint256",name:"missingAccountFunds",type:"uint256"}],name:"validateUserOp",outputs:[{internalType:"ValidationData",name:"validationData",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[],name:"version",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{stateMutability:"payable",type:"receive"}],ee=e=>(0,s.p)({abi:Y,functionName:"executeDelegateCall",args:[e.to,e.data
1||"0x"]}),et=async(e,t)=>{if(e.length>1){if("delegatecall"===t)throw Error("Cannot batch delegatecall");return(0,s.p)({abi:Y,functionName:"executeBatch",args:[e.map(e=>({to:e.to,value:e.value||0n,data:e.data||"0x"}))]})}let r=0===e.length?void 0:e[0];if(!r)throw Error("No calls to encode");if(!t||"call"===t)return(e=>(0,s.p)({abi:Y,functionName:"execute",args:[e.to,e.value||0n,e.data||"0x",0]}))(r);if("delegatecall"===t)return ee({to:r.to,data:r.data});throw Error("Invalid call type")},er=async({accountAddress:e,enableData:t,executor:r,selector:a,validAfter:n,validUntil:i,validator:o})=>et([{to:e,value:0n,data:(0,s.p)({abi:Z,functionName:"setExecution",args:[a,r,o,i,n,t]})}],"call");!function(e){e.sudo="0x00000000",e.plugin="0x00000001",e.enable="0x00000002"}(a||(a={}));var ea=r(5009);let en=async(e,t)=>{try{let r=await (0,T.T)(e,v.J,"readContract")({abi:ea.aU,address:t,functionName:"currentNonce",args:[]});return 0===r?1:r}catch(e){return 1}};var es=r(32733),ei=r(90356);let eo=[{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"isValidSignature",inputs:[{name:"data",type:"bytes32",internalType:"bytes32"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"magicValue",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"}],el=async(e,t,r,a)=>{try{let r=await e.request({method:"eth_call",params:[{to:t,data:(0,s.p)({abi:eo,functionName:"eip712Domain"})},"latest"]});if("0x"!==r){let e=(0,es.e)({abi:[...eo],functionName:"eip712Domain",data:r});return{name:e[1],version:e[2],chainId:e[3]}}}catch(e){}return{name:V.ix,version:"0.3.0"===r?"0.3.0-beta":r,chainId:BigInt(a??(e.chain?e.chain.id:await e.extend(ei.$).getChainId()))}};var eu=r(88878),ec=r(1347);let ed=e=>{if("0.6"===e)return(0,eu.V)((0,ec.iY)({abi:Z,name:"execute"}));if("0.7"===e)return(0,eu.V)((0,ec.iY)({abi:ea.aU,name:"execute"}));throw Error("Unsupported entry point version")},ep=async({accountAddress:e,enableSignature:t,action:r,validator:n,validUntil:s,validAfter:i})=>{let l=await n.getEnableData(e),u=l.length/2-1;return(0,p.xW)([a.enable,(0,X.eV)((0,o.nj)(s,{size:6}),{size:6}),(0,X.eV)((0,o.nj)(i),{size:6}),(0,X.eV)(n.address,{size:20}),(0,X.eV)(r.address,{size:20}),(0,X.eV)((0,o.nj)(u),{size:32}),l,(0,X.eV)((0,o.nj)(t.length/2-1),{size:32}),t])};var eh=r(11914);let ey=async({accountAddress:e,chainId:t,kernelVersion:r,action:a,validator:n,validUntil:s,validAfter:i})=>({domain:{name:"Kernel",version:r,chainId:t,verifyingContract:e},types:{ValidatorApproved:[{name:"sig",type:"bytes4"},{name:"validatorData",type:"uint256"},{name:"executor",type:"address"},{name:"enableData",type:"bytes"}]},message:{sig:a.selector,validatorData:(0,eh.uU)((0,p.aP)([(0,X.eV)((0,o.nj)(s??0),{size:6}),(0,X.eV)((0,o.nj)(i??0),{size:6}),n.address]),{size:32}),executor:a.address,enableData:await n.getEnableData(e)},primaryType:"ValidatorApproved"});var em=r(86324);let ef=async({enableSignature:e,userOpSignature:t,action:r,enableData:a,hook:n})=>(0,p.xW)([n?.getIdentifier()??i.Xd,(0,_.h)((0,em.m)("bytes validatorData, bytes hookData, bytes selectorData, bytes enableSig, bytes userOpSig"),[a,await n?.getEnableData()??"0x",(0,p.xW)([r.selector,r.address,r.hook?.address??i.Xd,(0,_.h)((0,em.m)("bytes selectorInitData, bytes hookInitData"),[V.u7.DELEGATE_CALL,"0x0000"])]),e,t])]),eg=async({accountAddress:e,chainId:t,kernelVersion:r,action:a,hook:n,validator:s,validatorNonce:o})=>({domain:{name:"Kernel",version:"0.3.0"===r?"0.3.0-beta":r,chainId:t,verifyingContract:e},types:{Enable:[{name:"validationId",type:"bytes21"},{name:"nonce",type:"uint32"},{name:"hook",type:"address"},{name:"validatorData",type:"bytes"},{name:"hookData",type:"bytes"},{name:"selectorData",type:"bytes"}]},message:{validationId:(0,p.xW)([V.g8[s.validatorType],(0,X.eV)(s.getIdentifier(),{size:20,dir:"right"})]),nonce:o,hook:n?.getIdentifier()??i.Xd,validatorData:await s.getEnableData(e),hookData:await n?.getEnableData(e)??"0x",selectorData:(0,p.xW)([a.selector,a.address,a.hook?.address??i.Xd,(0,_.h)((0,em.m)("bytes selectorInitData, bytes hookInitData"),[V.u7.DELEGATE_CALL,"0x0000"])])},primaryType:"Enable"}),eb=async(e,t,r)=>{try{return await (0,T.T)(e,v.J,"readContract")({abi:N,address:r,functionName:"isInitialized",args:[t]})}catch(e){}return!1};function ew(e){return e?.getPluginEnableSignature!==void 0}async function ev(e,{sudo:t,regular:r,hook:s,pluginEnableSignature:l,validatorInitData:u,action:c,validAfter:d=0,validUntil:h=0,entryPoint:y,kernelVersion:m,chainId:f}){let g;if(t&&!(0,n.satisfies)(m,t?.supportedKernelVersions)||r&&!(0,n.satisfies)(m,r?.supp
1ortedKernelVersions))throw Error("Either sudo or/and regular validator version mismatch. Update to latest plugin package and use the proper plugin version");let b=r||t;if(!b)throw Error("One of `sudo` or `regular` validator must be set");if(c={selector:c?.selector??ed(y.version),address:c?.address??i.Xd},"0.7"===y.version&&(c.address.toLowerCase()!==i.Xd.toLowerCase()||c.selector.toLowerCase()!==ed(y.version).toLowerCase())&&"0.3.0"===m&&(c.hook={address:c.hook?.address??V.ry}),!c)throw Error("Action data must be set");let w=async(e,n,i="0x")=>{if(!c)throw Error("Action data must be set");if("0.6"===y.version)if(r){if(g||await v(e,n))return a.plugin;let t=await T(e);if(!t)throw Error("Enable signature not set");return ep({accountAddress:e,enableSignature:t,action:c,validator:r,validUntil:h,validAfter:d})}else if(t)return a.sudo;else throw Error("One of `sudo` or `regular` validator must be set");if(r)return g||await v(e,c.selector)?i:ef({enableSignature:await T(e),userOpSignature:i,action:c,enableData:await r.getEnableData(e),hook:s});if(t)return i;throw Error("One of `sudo` or `regular` validator must be set")},v=async(t,a)=>{if(!c)throw Error("Action data must be set");if(!r)throw Error("regular validator not set");if("0.6"===y.version)return r.isEnabled(t,a);let n=await r.isEnabled(t,c.selector)||await eb(e,t,r.address);return n&&(g=!0),n},T=async a=>{let n;if(!c)throw Error("Action data must be set");if(l)return l;if(!t)throw Error("sudo validator not set -- need it to enable the validator");if(!r)throw Error("regular validator not set");let{version:i}=await el(e,a,m);if(f||(f=e.chain?.id??await (0,S.T)(e)),"0.6"===y.version){let e=await ey({accountAddress:a,chainId:f,kernelVersion:i??m,action:c,validator:r,validUntil:h,validAfter:d});return l=n=await t.signTypedData(e),n}let o=await en(e,a),u=await eg({accountAddress:a,chainId:f,kernelVersion:i,action:c,hook:s,validator:r,validatorNonce:o});return l=n=await t.signTypedData(u),n},_=(e=!1)=>{let a=(e?t:r)??b;return(0,p.xW)([V.g8[a.validatorType],a.getIdentifier()])},E=async a=>{if(!c)throw Error("Action data must be set");if(!t)throw Error("sudo validator not set -- need it to enable the validator");if(!r)throw Error("regular validator not set");let{version:n}=await el(e,a,m),s=await en(e,a);return f||(f=e.chain?.id??await (0,S.T)(e)),await eg({accountAddress:a,chainId:f,kernelVersion:n,action:c,validator:r,validatorNonce:s})};return{sudoValidator:t,regularValidator:r,activeValidatorMode:t&&!r?"sudo":"regular",...b,hook:s,getIdentifier:_,encodeModuleInstallCallData:async e=>{if(!c)throw Error("Action data must be set");if(!r)throw Error("regular validator not set");if("0.6"===y.version)return await er({accountAddress:e,selector:c.selector,executor:c.address,validator:r?.address,validUntil:h,validAfter:d,enableData:await r.getEnableData(e)});throw Error("EntryPoint v0.7 not supported yet")},signUserOperation:async e=>{let t=await b.signUserOperation(e);return"0.6"===y.version?(0,p.aP)([await w(e.sender,e.callData.toString().slice(0,10)),t]):await w(e.sender,e.callData.toString().slice(0,10),t)},getAction:()=>{if(!c)throw Error("Action data must be set");return c},getValidityData:()=>({validAfter:d,validUntil:h}),getStubSignature:async e=>{let t=await b.getStubSignature(e);return"0.6"===y.version?(0,p.aP)([await w(e.sender,e.callData.toString().slice(0,10)),t]):await w(e.sender,e.callData.toString().slice(0,10),t)},getNonceKey:async(e=i.Xd,t=0n)=>{if(!c)throw Error("Action data must be set");if("0.6"===y.version){if(t>J.Pg)throw Error("Custom nonce key must be equal or less than maxUint192 for 0.6");return await b.getNonceKey(e,t)}if(t>J.Au)throw Error("Custom nonce key must be equal or less than 2 bytes(maxUint16) for v0.7");let a=!r||await v(e,c.selector)?V.xQ.DEFAULT:V.xQ.ENABLE,n=r?V.g8[r.validatorType]:V.g8.SUDO;return BigInt((0,X.eV)((0,p.aP)([a,n,(0,X.eV)(b.getIdentifier(),{size:20,dir:"right"}),(0,X.eV)((0,o.nj)(await b.getNonceKey(e,t)),{size:2})]),{size:24}))},getPluginEnableSignature:T,getPluginsEnableTypedData:E,getValidatorInitData:async()=>u||{validatorAddress:t?.address??b.address,enableData:await t?.getEnableData()??await b.getEnableData(),identifier:(0,X.eV)(_(!0),{size:21,dir:"right"})},signUserOperationWithActiveValidator:async e=>b.signUserOperation(e)}}let eT=[{type:"constructor",inputs:[{name:"_impl",type:"address",internalType:"address"}],stateMutability:"nonpayable"},{type:"function",name:"createAccount",inputs:[{name:"data",type:"bytes",internalType:"bytes"},{name:"salt",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"payable"},{type:"function",name:"getAddress",inputs:[{name:"data",type:"bytes",internalType:"bytes"},{name:"salt",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"implementation",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"error",name:"InitializeError",inputs:[]}],e_=[{type:"constructor",inputs:[{name:"_owner",type:"address",internalType:"address"}],stateMutability:"nonpayable"},{type:"function",name:"approveFactory",inputs:[{name:"factory",type:"address",internalType:"contract KernelFactory"},{name:"approval",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"payable"},{type:"function",name:"approved",inputs:[{name:"",type:"address",internalType:"contract KernelFactory"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"}
1,{type:"function",name:"cancelOwnershipHandover",inputs:[],outputs:[],stateMutability:"payable"},{type:"function",name:"completeOwnershipHandover",inputs:[{name:"pendingOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"payable"},{type:"function",name:"deployWithFactory",inputs:[{name:"factory",type:"address",internalType:"contract KernelFactory"},{name:"createData",type:"bytes",internalType:"bytes"},{name:"salt",type:"bytes32",internalType:"bytes32"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"payable"},{type:"function",name:"owner",inputs:[],outputs:[{name:"result",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownershipHandoverExpiresAt",inputs:[{name:"pendingOwner",type:"address",internalType:"address"}],outputs:[{name:"result",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"payable"},{type:"function",name:"requestOwnershipHandover",inputs:[],outputs:[],stateMutability:"payable"},{type:"function",name:"stake",inputs:[{name:"entryPoint",type:"address",internalType:"contract IEntryPoint"},{name:"unstakeDelay",type:"uint32",internalType:"uint32"}],outputs:[],stateMutability:"payable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"payable"}
1,{type:"function",name:"unlockStake",inputs:[{name:"entryPoint",type:"address",internalType:"contract IEntryPoint"}],outputs:[],stateMutability:"payable"},{type:"function",name:"withdrawStake",inputs:[{name:"entryPoint",type:"address",internalType:"contract IEntryPoint"},{name:"recipient",type:"address",internalType:"address payable"}],outputs:[],stateMutability:"payable"},{type:"event",name:"OwnershipHandoverCanceled",inputs:[{name:"pendingOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"OwnershipHandoverRequested",inputs:[{name:"pendingOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"oldOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AlreadyInitialized",inputs:[]},{type:"error",name:"NewOwnerIsZeroAddress",inputs:[]},{type:"error",name:"NoHandoverRequest",inputs:[]},{type:"error",name:"NotApprovedFactory",inputs:[]},{type:"error",name:"Unauthorized",inputs:[]}];var eE=r(2245),eO=r(6867);let ex=(0,b.U)(["function performCreate(uint256 value, bytes memory deploymentData) public returns (address newContract)","function performCreate2(uint256 value, bytes memory deploymentData, bytes32 salt) public returns (address newContract)"]),eS=e=>(0,s.p)({abi:ex,functionName:"performCreate",args:e}),eI=(e,t,r=!1)=>{let a;a="calldata"in e?e.calldata:(0,p.aP)([e.to,t.callType!==V.u7.DELEGATE_CALL?(0,o.nj)(e.value||0n,{size:32}):"0x",e.data||"0x"]);let n=(0,eu.V)((0,ec.iY)({abi:ea.UX,name:"executeUserOp"}));return r?(0,p.aP)([n,(0,s.p)({abi:ea.UX,functionName:"execute",args:[(0,B.vf)(t),a]})]):(0,s.p)({abi:ea.UX,functionName:"execute",args:[(0,B.vf)(t),a]})},eP=(e,t,r)=>eI(e,{callType:V.u7.DELEGATE_CALL,execType:t.execType},r),ek=async(e,t,r)=>{if(e.length>1){var a;if("delegatecall"===t)throw Error("Cannot batch delegatecall");return a={execType:V.NI.DEFAULT},eI({calldata:(0,_.h)([{name:"executionBatch",type:"tuple[]",components:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"callData",type:"bytes"}]}],[e.map(e=>({target:e.to,value:e.value||0n,callData:e.data||"0x"}))])},{callType:V.u7.BATCH,execType:a.execType},r)}let n=0===e.length?void 0:e[0];if(!n)throw Error("No calls to encode");if(!t||"call"===t){let e;return e={execType:V.NI.DEFAULT},eI(n,{callType:V.u7.SINGLE,execType:e.execType},r)}if("delegatecall"===t)return eP({to:n.to,data:n.data},{execType:V.NI.DEFAULT},r);throw Error("Invalid call type")};var eA=r(80329);let eC=async(e,t,r)=>{let a,{name:n,version:s,chainId:i,verifyingContract:l}=t;if(!(0,B.a_)(B.oG.ERC1271_SIG_WRAPPER,s))return e;let u=(0,B.a_)(B.oG.ERC1271_REPLAYABLE,s)&&r?0:i,c=(0,h.KU)({domain:{name:n,version:s,chainId:u,verifyingContract:l}}),d=e;return(0,B.a_)(B.oG.ERC1271_SIG_WRAPPER_WITH_WRAPPED_HASH,s)&&(a=d,d=(0,eA.S)((0,_.h)([{type:"bytes32"},{type:"bytes32"}],[(0,eA.S)((0,o.i3)("Kernel(bytes32 hash)")),a]))),(0,eA.S)((0,p.aP)(["0x1901",c,d]))},eR=(e,t)=>({to:e,data:(0,s.p)({abi:U,functionName:"installModule",args:[t.type,t.address,t.data]})}),e$=[{inputs:[{internalType:"address",name:"_implementation",type:"address"},{internalType:"bytes",name:"_data",type:"bytes"},{internalType:"uint256",name:"_index",type:"uint256"}],name:"createAccount",outputs:[{internalType:"address",name:"proxy",type:"address"}],stateMutability:"payable",type:"function"}],ej=async({entryPointVersion:e,kernelPluginManager:t,initHook:r,kernelVersion:a,initConfig:n})=>{let{enableData:o,identifier:l,validatorAddress:u,initConfig:c}=await t.getValidatorInitData();return"0.6"===e?(0,s.p)({abi:Q,functionName:"initialize",args:[u,o]}):"0.3.0"===a?(0,s.p)({abi:ea.J8,functionName:"initialize",args:[l,r&&t.hook?t.hook?.getIdentifier():i.Xd,o,r&&t.hook?await t.hook?.getEnableData():"0x"]}):(0,s.p)({abi:eE.w,functionName:"initialize",args:[l,r&&t.hook?t.hook?.getIdentifier():i.Xd,o,r&&t.hook?await t.hook?.getEnableData():"0x",n??c??[]]})},eD=async({index:e,factoryAddress:t,accountImplementationAddress:r,entryPointVersion:a,kernelPluginManager:n,initHook:i,kernelVersion:l,initConfig:u,useMetaFactory:c})=>{let d=await ej({entryPointVersion:a,kernelPluginManager:n,initHook:i,kernelVersion:l,initConfig:u});
1return"0.6"===a?(0,s.p)({abi:e$,functionName:"createAccount",args:[r,d,e]}):c?(0,s.p)({abi:e_,functionName:"deployWithFactory",args:[t,d,(0,o.nj)(e,{size:32})]}):(0,s.p)({abi:eT,functionName:"createAccount",args:[d,(0,o.nj)(e,{size:32})]})};async function eL(e,{plugins:t,entryPoint:r,index:a=0n,factoryAddress:s,accountImplementationAddress:o,metaFactoryAddress:u,address:b,kernelVersion:v,initConfig:_,useMetaFactory:E=!0,eip7702Auth:O,eip7702Account:k,pluginMigrations:A}){var C;let R,$,j,D=!!k||!!O;if(D&&!(0,n.satisfies)(v,">=0.3.3"))throw Error("EIP-7702 is recommended for kernel version >=0.3.3");let N=k?await (0,K.q)({signer:k,address:b}):void 0;N&&(R=await z(e,{signer:N,entryPoint:r,kernelVersion:v}));let U=E,{accountImplementationAddress:M,factoryAddress:H,metaFactoryAddress:W}=((e,t,{accountImplementationAddress:r,factoryAddress:a,metaFactoryAddress:n})=>{(0,B.M5)(e,t);let s=V.lH[t];if(!s)throw Error(`No addresses found for kernel version ${t}`);return{accountImplementationAddress:r??s.accountImplementationAddress,factoryAddress:a??s.factoryAddress,metaFactoryAddress:n??s.metaFactoryAddress??i.Xd}})(r.version,v,{accountImplementationAddress:o,factoryAddress:s,metaFactoryAddress:u}),J=async()=>$||($=e.chain?e.chain.id:await (0,T.T)(e,S.T,"getChainId")({})),X=async()=>j||(j=await el(e,ea,v,await J())),Y=ew(t)?t:await ev(e,{sudo:N?R:t?.sudo,regular:t?.regular,hook:t?.hook,action:t?.action,pluginEnableSignature:t?.pluginEnableSignature,entryPoint:r,kernelVersion:v,chainId:await J()}),Q=!!(ew(t)?t.hook&&t.getIdentifier()===t.sudoValidator?.getIdentifier():t?.hook&&!t?.regular),Z=async()=>{if(D)return"0x";if(!M||!H)throw Error("Missing account logic address or factory address");return eD({index:a,factoryAddress:H,accountImplementationAddress:M,entryPointVersion:r.version,kernelPluginManager:Y,initHook:Q,kernelVersion:v,initConfig:_,useMetaFactory:U})},er=async()=>D?{factory:void 0,factoryData:void 0}:{factory:"0.6"===r.version||!1===U?H:W,factoryData:await Z()},ea=b??(D?N?.address??i.Xd:await (async()=>{let{factory:t,factoryData:a}=await er();if(!t||!a)throw Error("Missing factory address or factory data");return await L(e,{factory:t,factoryData:a,entryPointAddress:r.address})})());(0,l.h)(ea,i.Xd)&&U&&(U=!1,ea=await L(e,{factory:H,factoryData:await Z(),entryPointAddress:r.address}),(0,l.h)(ea,i.Xd)&&(U=!0));let en={address:r?.address??m.oi,abi:(r?.version??"0.7")==="0.6"?f:g,version:r?.version??"0.7"},es={pendingPlugins:A||[],allInstalled:!1},ei=async()=>{if(!es.pendingPlugins.length||es.allInstalled){es.allInstalled=!0;return}let t=await Promise.all(es.pendingPlugins.map(t=>G(e,{address:ea,plugin:t})));es.pendingPlugins=es.pendingPlugins.filter((e,r)=>!t[r]),es.allInstalled=0===es.pendingPlugins.length},eo=async()=>{let t=await (0,w.Q)(e,{address:ea});if(!t||0===t.length||!t.toLowerCase().startsWith(`0xef0100${M.slice(2).toLowerCase()}`)){if(O&&!(0,l.h)(O.address,M))throw Error("EIP-7702 authorization delegate address does not match account implementation address");let t=O??await (0,I.V)(e,{account:N,address:M,chainId:await J()});if(!await (0,P.z)({authorization:t,address:ea}))throw Error("Authorization verification failed");return t}};return await ei(),x({authorization:D?{account:N??(C=ea,{...(0,q.t)({address:C,async signMessage(){throw Error("Method not supported")},async signTransaction(e){throw Error("Method not supported")},async signTypedData(e){throw Error("Method not supported")}}),publicKey:"0x",source:"empty"}),address:M}:void 0,kernelVersion:v,kernelPluginManager:Y,accountImplementationAddress:M,factoryAddress:(await er()).factory,generateInitCode:Z,encodeModuleInstallCallData:async()=>await Y.encodeModuleInstallCallData(ea),nonceKeyManager:c({source:{get:()=>0,set:()=>{}}}),client:e,entryPoint:en,getFactoryArgs:er,async getAddress(){if(ea)return ea;let{factory:t,factoryData:a}=await er();if(!t||!a)throw Error("Missing factory address or factory data");return ea=await L(e,{factory:t,factoryData:a,entryPointAddress:r.address})},encodeDeployCallData:async e=>"0.6"===r.version?ee({to:V.IR,data:eS([0n,(0,eO.m)(e)])}):eP({to:V.IR,data:eS([0n,(0,eO.m)(e)])},{execType:V.NI.DEFAULT}),async encodeCalls(e,a){if(await ei(),es.pendingPlugins.length>0&&"0.7"===r.version&&"sudo"===Y.activeValidatorMode){let r=[];for(let e of es.pendingPlugins)r.push(eR(ea,e));return ek([...e,...r],a,!!t?.hook||void 0)}return 1!==e.length||a&&"call"!==a||e[0].to.toLowerCase()!==ea.toLowerCase()?"0.6"===r.version?et(e,a):t?.hook?ek(e,a,!0):ek(e,a):e[0].data??"0x"},eip7702Authorization:eo,async sign({hash:e}){return this.signMessage({message:e})},async signMessage({message:e,useReplayableSignature:t}){let r,a=(0,d.A)(e),{name:n,chainId:s,version:i}=await X();if(D)r=await Y.signTypedData({message:{hash:a},primaryType:"Kernel",types:{Kernel:[{name:"hash",type:"bytes32"}]},domain:{name:n,version:i,chainId:t?0:Number(s),verifyingContract:ea}});else{let e=await eC(a,{name:n,chainId:Number(s),version:i,verifyingContract:ea},t);r=await Y.signMessage({message:{raw:e}})}return(0,B.a_)(B.oG.ERC1271_WITH_VALIDATOR,i)?(t&&(0,B.a_)(B.oG.ERC1271_REPLAYABLE,i)&&(r=(0,p.aP)([V.Qg,r])),(0,p.aP)([Y.getIdentifier(),r])):r},async signTypedData(e){let t,{message:r,primaryType:a,types:n,domain:s}=e,i={EIP712Domain:(0,h.H4)({domain:s}),...n};(0,h.$$)({domain:s,message:r,primaryType:a,types:i});let o=(0,y.Zh)(e),{name:l,chainId:u,version:c}=await X();if(D)t=await Y.signTypedData({message:{hash:o},primaryType:"Kernel",types:{Kernel:[{name:"hash",type:"bytes32"}]},domain:{name:l,version:c,chainId:Number(u),verifyingContract:ea}});else{let e=await eC(o,{name:l,chainId:Number(u),version:c,verifyingContract:ea});t=await Y.signMessage({message:{raw:e}})}return(0,B.a_)(B.oG.ERC1271_WITH_VALIDATOR,c)?(0,p.aP)([Y.getIdentifier(),t]):t},async getNonce(t){let a=await Y.getNonceKey(ea,t?.key);return F(e,{address:ea,entryPointAddress:r.address,key:a})},async getStubSignature(e){if(!e)throw Error("No user operation provided");return Y.getStubSignature(e)},async signUserOperation(e){let{chainId:t=await J(),...r}=e;return Y.signUserOperation({...r,sender:r.sender??await this.getAddress(),chainId:t})}})}},40649:(e,t,r)=>{let a=r(48390);e.exports=(e,t,r)=>0!==a(e,t,r)},40721:(e,t,r)=>{r.d(t,{L:()=>i});var a=r(11914),n=r(34561),s=r(52539);async function i(e,t){let{chainId:r,entryPointAddress:i,context:o,...l}=t,u=(0,s.P)(l),{paymasterPostOpGasLimit:c,paymasterVerificationGasLimit:d,...p}=await e.request({method:"pm_getPaymasterStubData",params:[{...u,callGasLimit:u.callGasLimit??"0x0",verificationGasLimit:u.verificationGasLimit??"0x0",preVerificationGas:u.preVerificationGas??"0x0"},i,(0,n.cK)(r),o]});return{...p,...c&&{paymasterPostOpGasLimit:(0,a.uU)(c)},...d&&{paymasterVerificationGasLimit:(0,a.uU)(d)}}}},41789:(e,t,r)=>{let a=r(240),n=r(76353),s=r(18252);e.exports=(e,t)=>{e=new n(e,t);let r=new a("0.0.0");if(e.test(r)||(r=new a("0.0.0-0"),e.test(r)))return r;r=null;for(let t=0;t<e.set.length;++t){let n=e.set[t],i=null;
1n.forEach(e=>{let t=new a(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":(!i||s(t,i))&&(i=t);break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),i&&(!r||s(r,i))&&(r=i)}return r&&e.test(r)?r:null}},42256:(e,t,r)=>{r.d(t,{C:()=>c});var a=r(97152),n=r(64664),s=r(72757),i=r(4274),o=r(3450),l=r(52539),u=r(55874);async function c(e,t){let{account:r=e.account,entryPointAddress:c,stateOverride:d}=t;if(!r&&!t.sender)throw new n.T;let p=r?(0,a.J)(r):void 0,h=(0,i.yH)(d),y=p?await (0,s.T)(e,u.u,"prepareUserOperation")({...t,parameters:["authorization","factory","nonce","paymaster","signature"]}):t;try{let t=[(0,l.P)(y),c??p?.entryPoint?.address];var m=await e.request({method:"eth_estimateUserOperationGas",params:h?[...t,h]:[...t]});let r={};return m.callGasLimit&&(r.callGasLimit=BigInt(m.callGasLimit)),m.preVerificationGas&&(r.preVerificationGas=BigInt(m.preVerificationGas)),m.verificationGasLimit&&(r.verificationGasLimit=BigInt(m.verificationGasLimit)),m.paymasterPostOpGasLimit&&(r.paymasterPostOpGasLimit=BigInt(m.paymasterPostOpGasLimit)),m.paymasterVerificationGasLimit&&(r.paymasterVerificationGasLimit=BigInt(m.paymasterVerificationGasLimit)),r}catch(r){let e=t.calls;throw(0,o.t)(r,{...y,...e?{calls:e}:{}})}}},43409:(e,t,r)=>{let a=r(95934);e.exports=(e,t)=>{let r=a(e,t);return r&&r.prerelease.length?r.prerelease:null}},43790:(e,t,r)=>{let a=r(48390);e.exports=(e,t,r)=>a(t,e,r)},44287:(e,t,r)=>{r.d(t,{q:()=>u});var a=r(49476),n=r(20034),s=r(49304),i=r(36369),o=r(81958),l=r(62735);async function u({signer:e,address:t}){let r;if("type"in e&&("local"===e.type||"smart"===e.type))return e;if("request"in e&&!e?.account){if(t||(t=(await Promise.any([e.request({method:"eth_requestAccounts"}),e.request({method:"eth_accounts"})]))[0]),!t)throw Error("address is required");r=(0,a.F)({account:t,transport:(0,n.I)(e)})}return r||(r=e),(0,s.t)({address:r.account.address,signMessage:async({message:e})=>(0,i.l)(r,{message:e}),async signTypedData(e){let{primaryType:t,domain:a,message:n,types:s}=e;return(0,o.C)(r,{primaryType:t,domain:a,message:n,types:s})},async signTransaction(e){throw Error("Smart account signer doesn't need to sign transactions")},signAuthorization:async e=>(0,l.V)(r,e)})}},44764:(e,t,r)=>{var a=r(87358);e.exports="object"==typeof a&&a.env&&a.env.NODE_DEBUG&&/\bsemver\b/i.test(a.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{}},48390:(e,t,r)=>{let a=r(240);e.exports=(e,t,r)=>new a(e,r).compare(new a(t,r))},49304:(e,t,r)=>{r.d(t,{t:()=>s});var a=r(76115),n=r(24784);function s(e){if("string"==typeof e){if(!(0,n.P)(e,{strict:!1}))throw new a.M({address:e});return{address:e,type:"json-rpc"}}if(!(0,n.P)(e.address,{strict:!1}))throw new a.M({address:e.address});return{address:e.address,nonceManager:e.nonceManager,sign:e.sign,signAuthorization:e.signAuthorization,signMessage:e.signMessage,signTransaction:e.signTransaction,signTypedData:e.signTypedData,source:"custom",type:"local"}}},52376:(e,t,r)=>{let a=Symbol("SemVer ANY");class n{static get ANY(){return a}constructor(e,t){if(t=s(t),e instanceof n)if(!!t.loose===e.loose)return e;else e=e.value;u("comparator",e=e.trim().split(/\s+/).join(" "),t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===a?this.value="":this.value=this.operator+this.semver.version,u("comp",this)}parse(e){let t=this.options.loose?i[o.COMPARATORLOOSE]:i[o.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=void 0!==r[1]?r[1]:"","="===this.operator&&(this.operator=""),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=a}toString(){return this.value}test(e){if(u("Comparator.test",e,this.options.loose),this.semver===a||e===a)return!0;if("string"==typeof e)try{e=new c(e,this.options)}catch(e){return!1}return l(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof n))throw TypeError("a Comparator is required");return""===this.operator?""===this.value||new d(e.value,t).test(this.value):""===e.operator?""===e.value||new d(this.value,t).test(e.semver):!((t=s(t)).includePrerelease&&("<0.0.0-0"===this.value||"<0.0.0-0"===e.value)||!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||l(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||l(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))}}e.exports=n;let s=r(74371),{safeRe:i,t:o}=r(82404),l=r(93569),u=r(44764),c=r(240),d=r(76353)},52539:(e,t,r)=>{r.d(t,{P:()=>s});var a=r(34561),n=r(72427);function s(e){var t;let r={};return void 0!==e.callData&&(r.callData=e.callData),void 0!==e.callGasLimit&&(r.callGasLimit=(0,a.cK)(e.callGasLimit)),void 0!==e.factory&&(r.factory=e.factory),void 0!==e.factoryData&&(r.factoryData=e.factoryData),void 0!==e.initCode&&(r.initCode=e.initCode),void 0!==e.maxFeePerGas&&(r.maxFeePerGas=(0,a.cK)(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=(0,a.cK)(e.maxPriorityFeePerGas)),void 0!==e.nonce&&(r.nonce=(0,a.cK)(e.nonce)),void 0!==e.paymaster&&(r.paymaster=e.paymaster),void 0!==e.paymasterAndData&&(r.paymasterAndData=e.paymasterAndData||"0x"),void 0!==e.paymasterData&&(r.paymasterData=e.paymasterData),void 0!==e.paymasterPostOpGasLimit&&(r.paymasterPostOpGasLimit=(0,a.cK)(e.paymasterPostOpGasLimit)),void 0!==e.paymasterVerificationGasLimit&&(r.paymasterVerificationGasLimit=(0,a.cK)(e.paymasterVerificationGasLimit)),void 0!==e.preVerificationGas&&(r.preVerificationGas=(0,a.cK)(e.preVerificationGas)),void 0!==e.sender&&(r.sender=e.sender),void 0!==e.signature&&(r.signature=e.signature),void 0!==e.verificationGasLimit&&(r.verificationGasLimit=(0,a.cK)(e.verificationGasLimit)),void 0!==e.authorization&&(r.eip7702Auth={address:(t=e.authorization).address,chainId:(0,a.cK)(t.chainId),nonce:(0,a.cK)(t.nonce),r:t.r?(0,a.cK)(BigInt(t.r),{size:32}):(0,n.eV)("0x",{size:32}),s:t.s?(0,a.cK)(BigInt(t.s),{size:32}):(0,n.eV)("0x",{size:32}),yParity:t.yParity?(0,a.cK)(t.yParity,{size:1}):(0,n.eV)("0x",{size:32})}),r}},52770:(e,t,r)=>{let a=r(76353),n=r(52376),{ANY:s}=n,i=r(16088),o=r(48390),l=[new n(">=0.0.0-0")],u=[new n(">=0.0.0")],c=(e,t,r)=>{let a,n,c,h,y,m,f;if(e===t)return!0;
1if(1===e.length&&e[0].semver===s)if(1===t.length&&t[0].semver===s)return!0;else e=r.includePrerelease?l:u;if(1===t.length&&t[0].semver===s)if(r.includePrerelease)return!0;else t=u;let g=new Set;for(let t of e)">"===t.operator||">="===t.operator?a=d(a,t,r):"<"===t.operator||"<="===t.operator?n=p(n,t,r):g.add(t.semver);if(g.size>1)return null;if(a&&n&&((c=o(a.semver,n.semver,r))>0||0===c&&(">="!==a.operator||"<="!==n.operator)))return null;for(let e of g){if(a&&!i(e,String(a),r)||n&&!i(e,String(n),r))return null;for(let a of t)if(!i(e,String(a),r))return!1;return!0}let b=!!n&&!r.includePrerelease&&!!n.semver.prerelease.length&&n.semver,w=!!a&&!r.includePrerelease&&!!a.semver.prerelease.length&&a.semver;for(let e of(b&&1===b.prerelease.length&&"<"===n.operator&&0===b.prerelease[0]&&(b=!1),t)){if(f=f||">"===e.operator||">="===e.operator,m=m||"<"===e.operator||"<="===e.operator,a){if(w&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===w.major&&e.semver.minor===w.minor&&e.semver.patch===w.patch&&(w=!1),">"===e.operator||">="===e.operator){if((h=d(a,e,r))===e&&h!==a)return!1}else if(">="===a.operator&&!i(a.semver,String(e),r))return!1}if(n){if(b&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===b.major&&e.semver.minor===b.minor&&e.semver.patch===b.patch&&(b=!1),"<"===e.operator||"<="===e.operator){if((y=p(n,e,r))===e&&y!==n)return!1}else if("<="===n.operator&&!i(n.semver,String(e),r))return!1}if(!e.operator&&(n||a)&&0!==c)return!1}return(!a||!m||!!n||0===c)&&(!n||!f||!!a||0===c)&&!w&&!b&&!0},d=(e,t,r)=>{if(!e)return t;let a=o(e.semver,t.semver,r);return a>0?e:a<0||">"===t.operator&&">="===e.operator?t:e},p=(e,t,r)=>{if(!e)return t;let a=o(e.semver,t.semver,r);return a<0?e:a>0||"<"===t.operator&&"<="===e.operator?t:e};e.exports=(e,t,r={})=>{if(e===t)return!0;e=new a(e,r),t=new a(t,r);let n=!1;e:for(let a of e.set){for(let e of t.set){let t=c(a,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0}},53519:(e,t,r)=>{async function a(e,t){return BigInt(await e.request({method:"eth_gasPrice",params:[t]}))}async function n(e,t){return BigInt(await e.request({method:"eth_maxPriorityFeePerGas",params:[t]}))}r.d(t,{A:()=>L});var s=r(11914),i=r(61936),o=r(15885),l=r(74750),u=r(42438);function c(e){return 0===e||0n===e||null==e||"0"===e||""===e||"string"==typeof e&&("0x"===(0,u.B)(e).toLowerCase()||"0x00"===(0,u.B)(e).toLowerCase())}function d(e){return"cip64"===e.type||void 0!==e.maxFeePerGas&&void 0!==e.maxPriorityFeePerGas&&!c(e.feeCurrency)}let p={block:(0,i.R)({format:e=>({transactions:e.transactions?.map(e=>"string"==typeof e?e:{...(0,o.uP)(e),...e.gatewayFee?{gatewayFee:(0,s.uU)(e.gatewayFee),gatewayFeeRecipient:e.gatewayFeeRecipient}:{},feeCurrency:e.feeCurrency})})}),transaction:(0,o.gU)({format(e){if("0x7e"===e.type)return{isSystemTx:e.isSystemTx,mint:e.mint?(0,s.uU)(e.mint):void 0,sourceHash:e.sourceHash,type:"deposit"};let t={feeCurrency:e.feeCurrency};return"0x7b"===e.type?t.type="cip64":("0x7c"===e.type&&(t.type="cip42"),t.gatewayFee=e.gatewayFee?(0,s.uU)(e.gatewayFee):null,t.gatewayFeeRecipient=e.gatewayFeeRecipient),t}}),transactionRequest:(0,l.bm)({format(e){let t={};return e.feeCurrency&&(t.feeCurrency=e.feeCurrency),d(e)&&(t.type="0x7b"),t}})};var h=r(44016),y=r(76115),m=r(13933),f=r(29454),g=r(88737),b=r(24784),w=r(40290),v=r(34561),T=r(88210),_=r(50879),E=r(30718),O=r(17679),x=r(45686),S=r(35766),I=r(19781),P=r(5082),k=r(16871),A=r(44352);function C(e){let{chainId:t,maxPriorityFeePerGas:r,maxFeePerGas:a,to:n}=e;if(t<=0)throw new f.qD({chainId:t});if(n&&!(0,b.P)(n))throw new y.M({address:n});if(a&&a>h.Ao)throw new g.BG({maxFeePerGas:a});if(r&&a&&r>a)throw new g.lN({maxFeePerGas:a,maxPriorityFeePerGas:r})}var R=r(90656);function $(e){if(!e||0===e.length)return[];let t=[];for(let r=0;r<e.length;r++){let{address:a,storageKeys:n}=e[r];for(let e=0;e<n.length;e++)if(n[e].length-2!=64)throw new _.fZ({storageKey:n[e]});if(!(0,b.P)(a,{strict:!1}))throw new y.M({address:a});t.push([a,n])}return t}function j(e,t){let r=t??e,{v:a,yParity:n}=r;if(void 0===r.r||void 0===r.s||void 0===a&&void 0===n)return[];let s=(0,u.B)(r.r),i=(0,u.B)(r.s);return["number"==typeof n?n?(0,v.cK)(1):"0x":0n===a?"0x":1n===a?(0,v.cK)(1):27n===a?"0x":(0,v.cK)(1),"0x00"===s?"0x":s,"0x00"===i?"0x":i]}let D=h.Ao,L=(0,r(91053).x)({blockTime:1e3,contracts:{gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"}
1,l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters:p,serializers:{transaction:function(e,t){if(d(e)){var r,a=e,n=t,i=a;let{chainId:s,maxPriorityFeePerGas:o,gasPrice:l,maxFeePerGas:u,to:d,feeCurrency:p}=i;if(s<=0)throw new f.qD({chainId:s});if(d&&!(0,b.P)(d))throw new y.M({address:d});if(l)throw new m.C("`gasPrice` is not a valid CIP-64 Transaction attribute.");if(!c(u)&&u>D)throw new g.BG({maxFeePerGas:u});if(!c(o)&&!c(u)&&o>u)throw new g.lN({maxFeePerGas:u,maxPriorityFeePerGas:o});if(!c(p)&&!(0,b.P)(p))throw new m.C("`feeCurrency` MUST be a token address for CIP-64 transactions.");if(c(p))throw new m.C("`feeCurrency` must be provided for CIP-64 transactions.");let{chainId:h,gas:_,nonce:E,to:O,value:x,maxFeePerGas:S,maxPriorityFeePerGas:I,accessList:P,feeCurrency:k,data:A}=a,C=[(0,v.nj)(h),E?(0,v.nj)(E):"0x",I?(0,v.nj)(I):"0x",S?(0,v.nj)(S):"0x",_?(0,v.nj)(_):"0x",O??"0x",x?(0,v.nj)(x):"0x",A??"0x",$(P),k,...j(a,n)];return(0,w.aP)(["0x7b",(0,T.EQ)(C)])}if("deposit"===(r=e).type||void 0!==r.sourceHash){var o=e,l=o;let{from:t,to:r}=l;if(t&&!(0,b.P)(t))throw new y.M({address:t});if(r&&!(0,b.P)(r))throw new y.M({address:r});let{sourceHash:a,data:n,from:s,gas:i,isSystemTx:u,mint:c,to:d,value:p}=o,h=[a,s,d??"0x",c?(0,v.nj)(c):"0x",p?(0,v.nj)(p):"0x",i?(0,v.nj)(i):"0x",u?"0x1":"0x",n??"0x"];return(0,w.aP)(["0x7e",(0,T.EQ)(h)])}let p=(0,R.L)(e);return"eip1559"===p?function(e,t){let{chainId:r,gas:a,nonce:n,to:s,value:i,maxFeePerGas:o,maxPriorityFeePerGas:l,accessList:u,data:c}=e;C(e);let d=$(u),p=[(0,v.cK)(r),n?(0,v.cK)(n):"0x",l?(0,v.cK)(l):"0x",o?(0,v.cK)(o):"0x",a?(0,v.cK)(a):"0x",s??"0x",i?(0,v.cK)(i):"0x",c??"0x",d,...j(e,t)];return(0,w.aP)(["0x02",(0,T.EQ)(p)])}(e,t):"eip2930"===p?function(e,t){let{chainId:r,gas:a,data:n,nonce:s,to:i,value:o,accessList:l,gasPrice:u}=e,{chainId:c,maxPriorityFeePerGas:d,gasPrice:p,maxFeePerGas:_,to:E}=e;if(c<=0)throw new f.qD({chainId:c});if(E&&!(0,b.P)(E))throw new y.M({address:E});if(d||_)throw new m.C("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(p&&p>h.Ao)throw new g.BG({maxFeePerGas:p});let O=$(l),x=[(0,v.cK)(r),s?(0,v.cK)(s):"0x",u?(0,v.cK)(u):"0x",a?(0,v.cK)(a):"0x",i??"0x",o?(0,v.cK)(o):"0x",n??"0x",O,...j(e,t)];return(0,w.aP)(["0x01",(0,T.EQ)(x)])}(e,t):"eip4844"===p?function(e,t){let{chainId:r,gas:a,nonce:n,to:i,value:o,maxFeePerBlobGas:l,maxFeePerGas:u,maxPriorityFeePerGas:c,accessList:d,data:p}=e,{blobVersionedHashes:h}=e;if(h){if(0===h.length)throw new P.zF;for(let e of h){let t=(0,k.E)(e),r=(0,s.ME)((0,A.di)(e,0,1));if(32!==t)throw new P.uP({hash:e,size:t});if(r!==I.E)throw new P.PK({hash:e,version:r})}}C(e);let y=e.blobVersionedHashes,m=e.sidecars;if(e.blobs&&(void 0===y||void 0===m)){let t="string"==typeof e.blobs[0]?e.blobs:e.blobs.map(e=>(0,v.My)(e)),r=e.kzg,a=(0,E.S)({blobs:t,kzg:r});if(void 0===y&&(y=(0,x.d)({commitments:a})),void 0===m){let e=(0,O.t)({blobs:t,commitments:a,kzg:r});m=(0,S.T)({blobs:t,commitments:a,proofs:e})}}let f=$(d),g=[(0,v.cK)(r),n?(0,v.cK)(n):"0x",c?(0,v.cK)(c):"0x",u?(0,v.cK)(u):"0x",a?(0,v.cK)(a):"0x",i??"0x",o?(0,v.cK)(o):"0x",p??"0x",f,l?(0,v.cK)(l):"0x",y??[],...j(e,t)],b=[],_=[],R=[];if(m)for(let e=0;e<m.length;e++){let{blob:t,commitment:r,proof:a}=m[e];b.push(t),_.push(r),R.push(a)}return(0,w.aP)(["0x03",m?(0,T.EQ)([g,b,_,R]):(0,T.EQ)(g)])}(e,t):"eip7702"===p?function(e,t){let{authorizationList:r,chainId:a,gas:n,nonce:s,to:i,value:o,maxFeePerGas:l,maxPriorityFeePerGas:u,accessList:c,data:d}=e,{authorizationList:p}=e;if(p)for(let e of p){let{chainId:t}=e,r=e.address;if(!(0,b.P)(r))throw new y.M({address:r});if(t<0)throw new f.qD({chainId:t})}C(e);let h=$(c),m=function(e){if(!e||0===e.length)return[];let t=[];for(let r of e){let{chainId:e,nonce:a,...n}=r,s=r.address;t.push([e?(0,v.nj)(e):"0x",s,a?(0,v.nj)(a):"0x",...j({},n)])}return t}(r);return(0,w.aP)(["0x04",(0,T.EQ)([(0,v.cK)(a),s?(0,v.cK)(s):"0x",u?(0,v.cK)(u):"0x",l?(0,v.cK)(l):"0x",n?(0,v.cK)(n):"0x",i??"0x",o?(0,v.cK)(o):"0x",d??"0x",h,m,...j(e,t)])])}(e,t):function(e,t){let{chainId:r=0,gas:a,data:n,nonce:s,to:i,value:o,gasPrice:l}=e,{chainId:c,maxPriorityFeePerGas:d,gasPrice:p,maxFeePerGas:w,to:E}=e;if(E&&!(0,b.P)(E))throw new y.M({address:E});if(void 0!==c&&c<=0)throw new f.qD({chainId:c});if(d||w)throw new m.C("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(p&&p>h.Ao)throw new g.BG({maxFeePerGas:p});let O=[s?(0,v.cK)(s):"0x",l?(0,v.cK)(l):"0x",a?(0,v.cK)(a):"0x",i??"0x",o?(0,v.cK)(o):"0x",n??"0x"];if(t){let e=(()=>
1{if(t.v>=35n)return(t.v-35n)/2n>0?t.v:27n+(35n===t.v?0n:1n);if(r>0)return BigInt(2*r)+BigInt(35n+t.v-27n);let e=27n+(27n===t.v?0n:1n);if(t.v!==e)throw new _.zW({v:t.v});return e})(),a=(0,u.B)(t.r),n=(0,u.B)(t.s);O=[...O,(0,v.cK)(e),"0x00"===a?"0x":a,"0x00"===n?"0x":n]}else r>0&&(O=[...O,(0,v.cK)(r),"0x","0x"]);return(0,T.EQ)(O)}(e,t)}},fees:{estimateFeesPerGas:async e=>{if(!e.request?.feeCurrency)return null;let[t,r]=await Promise.all([a(e.client,e.request.feeCurrency),n(e.client,e.request.feeCurrency)]);return{maxFeePerGas:e.multiply(t-r)+r,maxPriorityFeePerGas:r}}},id:42220,name:"Celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://celoscan.io",apiUrl:"https://api.celoscan.io/api"}},contracts:{multicall3:{address:"0xcA11bde05977b3631167028862bE2a173976CA11",blockCreated:0xc81517}},testnet:!1})},54419:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=r(71450).__importDefault(r(76373)),n=RegExp("[,()]");class s extends a.default{eq(e,t){return this.url.searchParams.append(e,`eq.${t}`),this}neq(e,t){return this.url.searchParams.append(e,`neq.${t}`),this}gt(e,t){return this.url.searchParams.append(e,`gt.${t}`),this}gte(e,t){return this.url.searchParams.append(e,`gte.${t}`),this}lt(e,t){return this.url.searchParams.append(e,`lt.${t}`),this}lte(e,t){return this.url.searchParams.append(e,`lte.${t}`),this}like(e,t){return this.url.searchParams.append(e,`like.${t}`),this}likeAllOf(e,t){return this.url.searchParams.append(e,`like(all).{${t.join(",")}}`),this}likeAnyOf(e,t){return this.url.searchParams.append(e,`like(any).{${t.join(",")}}`),this}ilike(e,t){return this.url.searchParams.append(e,`ilike.${t}`),this}ilikeAllOf(e,t){return this.url.searchParams.append(e,`ilike(all).{${t.join(",")}}`),this}ilikeAnyOf(e,t){return this.url.searchParams.append(e,`ilike(any).{${t.join(",")}}`),this}is(e,t){return this.url.searchParams.append(e,`is.${t}`),this}in(e,t){let r=Array.from(new Set(t)).map(e=>"string"==typeof e&&n.test(e)?`"${e}"`:`${e}`).join(",");return this.url.searchParams.append(e,`in.(${r})`),this}contains(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cs.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cs.{${t.join(",")}}`):this.url.searchParams.append(e,`cs.${JSON.stringify(t)}`),this}containedBy(e,t){return"string"==typeof t?this.url.searchParams.append(e,`cd.${t}`):Array.isArray(t)?this.url.searchParams.append(e,`cd.{${t.join(",")}}`):this.url.searchParams.append(e,`cd.${JSON.stringify(t)}`),this}rangeGt(e,t){return this.url.searchParams.append(e,`sr.${t}`),this}rangeGte(e,t){return this.url.searchParams.append(e,`nxl.${t}`),this}rangeLt(e,t){return this.url.searchParams.append(e,`sl.${t}`),this}rangeLte(e,t){return this.url.searchParams.append(e,`nxr.${t}`),this}rangeAdjacent(e,t){return this.url.searchParams.append(e,`adj.${t}`),this}overlaps(e,t){return"string"==typeof t?this.url.searchParams.append(e,`ov.${t}`):this.url.searchParams.append(e,`ov.{${t.join(",")}}`),this}textSearch(e,t,{config:r,type:a}={}){let n="";"plain"===a?n="pl":"phrase"===a?n="ph":"websearch"===a&&(n="w");let s=void 0===r?"":`(${r})`;return this.url.searchParams.append(e,`${n}fts${s}.${t}`),this}match(e){return Object.entries(e).forEach(([e,t])=>{this.url.searchParams.append(e,`eq.${t}`)}),this}not(e,t,r){return this.url.searchParams.append(e,`not.${t}.${r}`),this}or(e,{foreignTable:t,referencedTable:r=t}={}){let a=r?`${r}.or`:"or";return this.url.searchParams.append(a,`(${e})`),this}filter(e,t,r){return this.url.searchParams.append(e,`${t}.${r}`),this}}t.default=s},55874:(e,t,r)=>{r.d(t,{u:()=>m});var a=r(97152),n=r(7799),s=r(98292),i=r(35471),o=r(64664),l=r(30931),u=r(40290),c=r(72757),d=r(8185),p=r(40721),h=r(42256);let y=["factory","fees","gas","paymaster","nonce","signature","authorization"];async function m(e,t){let r,{account:m=e.account,parameters:f=y,stateOverride:g}=t;if(!m)throw new o.T;let b=(0,a.J)(m),w=t.paymaster??e?.paymaster,v="string"==typeof w?w:void 0,{getPaymasterStubData:T,getPaymasterData:_}=(()=>
1{if(!0===w)return{getPaymasterStubData:t=>(0,c.T)(e,p.L,"getPaymasterStubData")(t),getPaymasterData:t=>(0,c.T)(e,d.l,"getPaymasterData")(t)};if("object"==typeof w){let{getPaymasterStubData:e,getPaymasterData:t}=w;return{getPaymasterStubData:t&&e?e:t,getPaymasterData:t&&e?t:void 0}}return{getPaymasterStubData:void 0,getPaymasterData:void 0}})(),E=t.paymasterContext?t.paymasterContext:e?.paymasterContext,O={...t,paymaster:v,sender:b.address},[x,S,I,P,k]=await Promise.all([(async()=>t.calls?b.encodeCalls(t.calls.map(e=>e.abi?{data:(0,l.p)(e),to:e.to,value:e.value}:e)):t.callData)(),(async()=>{if(!f.includes("factory"))return;if(t.initCode)return{initCode:t.initCode};if(t.factory&&t.factoryData)return{factory:t.factory,factoryData:t.factoryData};let{factory:e,factoryData:r}=await b.getFactoryArgs();return"0.6"===b.entryPoint.version?{initCode:e&&r?(0,u.xW)([e,r]):void 0}:{factory:e,factoryData:r}})(),(async()=>{if(f.includes("fees")){if("bigint"==typeof t.maxFeePerGas&&"bigint"==typeof t.maxPriorityFeePerGas)return O;if(e?.userOperation?.estimateFeesPerGas){let t=await e.userOperation.estimateFeesPerGas({account:b,bundlerClient:e,userOperation:O});return{...O,...t}}try{let r=e.client??e,a=await (0,c.T)(r,s._,"estimateFeesPerGas")({chain:r.chain,type:"eip1559"});return{maxFeePerGas:"bigint"==typeof t.maxFeePerGas?t.maxFeePerGas:BigInt(2n*a.maxFeePerGas),maxPriorityFeePerGas:"bigint"==typeof t.maxPriorityFeePerGas?t.maxPriorityFeePerGas:BigInt(2n*a.maxPriorityFeePerGas)}}catch{return}}})(),(async()=>{if(f.includes("nonce"))return"bigint"==typeof t.nonce?t.nonce:b.getNonce()})(),(async()=>{if(f.includes("authorization")){if("object"==typeof t.authorization)return t.authorization;if(b.authorization&&!await b.isDeployed())return{...await (0,n.h)(b.client,b.authorization),r:"0xfffffffffffffffffffffffffffffff000000000000000000000000000000000",s:"0x7aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",yParity:1}}})()]);async function A(){return r||(e.chain?e.chain.id:r=await (0,c.T)(e,i.T,"getChainId")({}))}void 0!==x&&(O.callData=x),void 0!==S&&(O={...O,...S}),void 0!==I&&(O={...O,...I}),void 0!==P&&(O.nonce=P),void 0!==k&&(O.authorization=k),f.includes("signature")&&(void 0!==t.signature?O.signature=t.signature:O.signature=await b.getStubSignature(O)),"0.6"!==b.entryPoint.version||O.initCode||(O.initCode="0x");let C=!1;if(f.includes("paymaster")&&T&&!v&&!t.paymasterAndData){let{isFinal:e=!1,sponsor:t,...r}=await T({chainId:await A(),entryPointAddress:b.entryPoint.address,context:E,...O});C=e,O={...O,...r}}if("0.6"!==b.entryPoint.version||O.paymasterAndData||(O.paymasterAndData="0x"),f.includes("gas")){if(b.userOperation?.estimateGas){let e=await b.userOperation.estimateGas(O);O={...O,...e}}if(void 0===O.callGasLimit||void 0===O.preVerificationGas||void 0===O.verificationGasLimit||O.paymaster&&void 0===O.paymasterPostOpGasLimit||O.paymaster&&void 0===O.paymasterVerificationGasLimit){let t=await (0,c.T)(e,h.C,"estimateUserOperationGas")({account:b,callGasLimit:0n,preVerificationGas:0n,verificationGasLimit:0n,stateOverride:g,...O.paymaster?{paymasterPostOpGasLimit:0n,paymasterVerificationGasLimit:0n}:{},...O});O={...O,callGasLimit:O.callGasLimit??t.callGasLimit,preVerificationGas:O.preVerificationGas??t.preVerificationGas,verificationGasLimit:O.verificationGasLimit??t.verificationGasLimit,paymasterPostOpGasLimit:O.paymasterPostOpGasLimit??t.paymasterPostOpGasLimit,paymasterVerificationGasLimit:O.paymasterVerificationGasLimit??t.paymasterVerificationGasLimit}}}if(f.includes("paymaster")&&_&&!v&&!t.paymasterAndData&&!C){let e=await _({chainId:await A(),entryPointAddress:b.entryPoint.address,context:E,...O});O={...O,...e}}return delete O.calls,delete O.parameters,delete O.paymasterContext,"string"!=typeof O.paymaster&&delete O.paymaster,O}},60674:(e,t,r)=>{r.d(t,{J:()=>L,r:()=>D});var a=r(25157),n=r(97152),s=r(72757),i=r(5009),o=r(13933);class l extends o.C{constructor({docsPath:e}={}){super("Could not find an Account to execute with this Action.\nPlease provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client.",{docsPath:e,docsSlug:"account",name:"AccountNotFoundError"})}}async function u(e){let t=e.account;if(!t)throw new l({docsPath:"/docs/actions/wallet/sendTransaction"});let r=(0,n.J)(t);try{return await (0,s.T)(e,a.J,"readContract")({abi:i.aU,address:r.address,functionName:"
1currentNonce",args:[]})}catch(e){return 1}}o.C;var c=r(334),d=r(72951),p=r(30931);async function h(e,t){let{account:r=e.account,nonceToSet:a}=t;if(!r)throw new l({docsPath:"/docs/actions/wallet/sendTransaction"});let o=(0,n.J)(r);return await (0,s.T)(e,d.$,"sendUserOperation")({...t,calls:[{to:o.address,data:(0,p.p)({abi:i.aU,functionName:"invalidateNonce",args:[a]}),value:0n}],account:o})}var y=r(21641);async function m(e,t){let r;if("to"in t){let{account:a=e.account,data:i,maxFeePerGas:o,maxPriorityFeePerGas:u,to:c,value:p,nonce:h}=t;if(!a)throw new l({docsPath:"/docs/actions/wallet/sendTransaction"});let y=(0,n.J)(a);if(!c)throw Error("Missing to address");r=await (0,s.T)(e,d.$,"sendUserOperation")({calls:[{to:c,value:p||BigInt(0),data:i||"0x"}],account:y,maxFeePerGas:o,maxPriorityFeePerGas:u,nonce:h?BigInt(h):void 0})}else r=await (0,s.T)(e,d.$,"sendUserOperation")({...t});let a=await (0,s.T)(e,y.V,"waitForUserOperationReceipt")({hash:r});return a?.receipt.transactionHash}async function f(e,{account:t=e.account,message:r}){if(!t)throw new l({docsPath:"/docs/actions/wallet/signMessage"});return(0,n.J)(t).signMessage({message:r})}var g=r(57001);async function b(e,{account:t=e.account,domain:r,message:a,primaryType:s,types:i}){if(!t)throw new l({docsPath:"/docs/actions/wallet/signMessage"});let o=(0,n.J)(t),u={EIP712Domain:(0,g.H4)({domain:r}),...i};return(0,g.$$)({domain:r,message:a,primaryType:s,types:u}),o.signTypedData({domain:r,primaryType:s,types:u,message:a})}var w=r(66707),v=r(95355);async function T(e,t){let{account:r=e.account,kernelVersion:a}=t;if(!r)throw new l({docsPath:"/docs/actions/wallet/sendTransaction"});let o=(0,n.J)(r),u=function(e,t){(0,v.M5)(e.entryPoint.version,t);let r=w.lH[t].accountImplementationAddress;return{to:e.address,data:(0,p.p)({abi:i.aU,functionName:"upgradeTo",args:[r]}),value:0n}}(o,a);return await (0,s.T)(e,d.$,"sendUserOperation")({...t,calls:[u],account:o})}async function _(e,{abi:t,address:r,args:a,dataSuffix:n,functionName:i,...o}){let l=(0,p.p)({abi:t,args:a,functionName:i});return await (0,s.T)(e,m,"sendTransaction")({data:`${l}${n?n.replace("0x",""):""}`,to:r,...o})}var E=r(55874);async function O(e,t){let{account:r=e.account}=t;if(!r)throw new l({docsPath:"/docs/actions/wallet/sendTransaction"});let a=(0,n.J)(r),i=await (0,s.T)(e,E.u,"prepareUserOperation")({...t,account:a});return i.signature=await a.signUserOperation(i),i}var x=r(40290),S=r(72427);async function I(e,t){let r,{account:a=e.account,plugin:o,hook:u,...c}=t;if(!a)throw new l({docsPath:"/docs/actions/wallet/sendTransaction"});let h=(0,n.J)(a);if([w.g8.PERMISSION,w.g8.SECONDARY,w.g8.EIP7702].includes(w.g8[o.validatorType]))r=(0,x.aP)([w.g8[o.validatorType],(0,S.eV)(o.getIdentifier(),{size:20,dir:"right"})]);else throw Error(`Cannot uninstall ${o.validatorType} plugin`);let y=await o.getEnableData(h.address),m=await u?.getEnableData(h.address)??"0x";return await (0,s.T)(e,d.$,"sendUserOperation")({...c,calls:[{to:h.address,data:(0,p.p)({abi:i.aU,functionName:"uninstallValidation",args:[r,y,m]}),value:0n}],account:h})}var P=r(71415),k=r(2245);async function A(e,t){let r,{sudoValidator:a,hook:i,...o}=t,u=o.account??e.account;if(!u)throw new l({docsPath:"/docs/actions/wallet/sendTransaction"});let c=(0,n.J)(u);if([w.g8.PERMISSION,w.g8.SECONDARY,w.g8.EIP7702].includes(w.g8[a.validatorType]))r=(0,x.aP)([w.g8[a.validatorType],(0,S.eV)(a.getIdentifier(),{size:20,dir:"right"})]);else throw Error(`Cannot change sudo validator to type ${a.validatorType}`);let h=await a.getEnableData(c.address),y=i?.getIdentifier()??P.Xd,m=await i?.getEnableData(c.address)??"0x";return c.kernelVersion===w.b3?await (0,s.T)(e,d.$,"sendUserOperation")({...o,callData:await c.encodeCalls([{to:w.lH[w.iF].accountImplementationAddress,value:0n,data:(0,p.p)({abi:k.w,functionName:"changeRootValidator",args:[r,y,h,m]})}],"delegatecall")}):await (0,s.T)(e,d.$,"sendUserOperation")({...o,callData:await c.encodeCalls([{to:c.address,value:0n,data:(0,p.p)({abi:k.w,functionName:"changeRootValidator",args:[r,y,h,m]})}])})}var C=r(97338);let R=async(e,t)=>{let r=await e.request({method:"stackup_getERC20TokenQuotes",params:[{chainId:e.chain?.id,userOp:{...(0,v._f)(t.userOperation),initCode:t.userOperation.initCode||"0x"},tokenAddress:t.gasTokenAddress,entryPointAddress:t.entryPoint??C.B9}]}),a={maxGasCostToken:r.maxGasCostToken,tokenDecimals:r.tokenDecimals};return{amount:Number(a.maxGasCostToken)/10**Number(a.tokenDecimals)}};var $=r(32108);let j=async(e,t)=>{let{userOperation:{chainId:r,entryPointAddress:a,context:n,calls:s,account:i,...o}}=t,l=await e.request({method:"zd_sponsorUserOperation",params:[{chainId:e.chain?.id,userOp:(0,v._f)(o),entryPointAddress:a,gasTokenData:t.gasToken&&{tokenAddress:t.gasToken},shouldOverrideFee:t.shouldOverrideFee??!1,shouldConsume:t.shouldConsume??!0}]});return(0,$.h)(a,C.B9)?{paymasterAndData:l.paymasterAndData,preVerificationGas:BigInt(l.preVerificationGas),verificationGasLimit:BigInt(l.verificationGasLimit),callGasLimit:BigInt(l.callGasLimit),maxFeePerGas:l.maxFeePerGas?BigInt(l.maxFeePerGas):t.userOperation.maxFeePerGas,maxPriorityFeePerGas:l.maxPriorityFeePerGas?BigInt(l.maxPriorityFeePerGas):t.userOperation.maxPriorityFeePerGas}:{callGasLimit:BigInt(l.callGasLimit),verificationGasLimit:BigInt(l.verificationGasLimit),preVerificationGas:BigInt(l.preVerificationGas),paymaster:l.paymaster,paymasterVerificationGasLimit:BigInt(l.paymasterVerificationGasLimit),paymasterPostOpGasLimit:BigInt(l.paymasterPostOpGasLimit),paymasterData:l.paymasterData,maxFeePerGas:l.maxFeePerGas?BigInt(l.maxFeePerGas):t.userOperation.maxFeePerGas,maxPriorityFeePerGas:l.maxPriorityFeePerGas?BigInt(l.maxPriorityFeePerGas):t.userOperation.maxPriorityFeePerGas}},D=()=>e=>({sponsorUserOperation:async t=>j(e,{...t}),estimateGasInERC20:async t=>R(e,t)});function L(){return e=>({signUserOperation:t=>O(e,t),getUserOperationGasPrice:async()=>(0,c.$)(e),uninstallPlugin:async t=>I(e,t),changeSudoValidator:async t=>A(e,t),invalidateNonce:async t=>h(e,t),getKernelV3ModuleCurrentNonce:async()=>u(e),upgradeKernel:async t=>T(e,t),sendTransaction:t=>m(e,t),signMessage:t=>f(e,t),signTypedData:t=>b(e,t),writeContract:t=>_(e,t)})}},64255:(e,t,r)=>{let a=r(240);e.exports=(e,t)=>new a(e,t).patch},66707:(e,t,r)=>{r.d(t,{IR:()=>g,NI:()=>s,Qg:()=>l,b3:()=>p,bP:()=>b,g8:()=>f,iF:()=>h,ix:()=>m,lH:()=>d,ry:()=>y,u7:()=>n,xQ:()=>a});var a,n,s,i=r(71415),o=r(97338);
1let l="0x0555ad2729e8da1777a4e5020806f8bf7601c3db6bfe402f410a34958363a95a",u="0x5de4839a76cf55d0c90e2061ef4386d962E15ae3",c="0xee9d8350bd899dd261db689aafd87eb8a30f085adbaff48152399438ff4eed73",d={"0.0.2":{accountImplementationAddress:i.Xd,factoryAddress:"0xaee9762ce625e0a8f7b184670fb57c37bfe1d0f1"},"0.2.2":{accountImplementationAddress:"0x0DA6a956B9488eD4dd761E59f52FDc6c8068E6B5",factoryAddress:u,initCodeHash:c},"0.2.3":{accountImplementationAddress:"0xD3F582F6B4814E989Ee8E96bc3175320B5A540ab",factoryAddress:u,initCodeHash:c},"0.2.4":{accountImplementationAddress:"0xd3082872F8B06073A021b4602e022d5A070d7cfC",factoryAddress:u,initCodeHash:c},"0.3.0":{accountImplementationAddress:"0x94F097E1ebEB4ecA3AAE54cabb08905B239A7D27",factoryAddress:"0x6723b44Abeec4E71eBE3232BD5B455805baDD22f",metaFactoryAddress:"0xd703aaE79538628d27099B8c4f621bE4CCd142d5",initCodeHash:"0x6fe6e6ea30eddce942b9618033ab8429f9ddac594053bec8a6744fffc71976e2"},"0.3.1":{accountImplementationAddress:"0xBAC849bB641841b44E965fB01A4Bf5F074f84b4D",factoryAddress:"0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419",metaFactoryAddress:"0xd703aaE79538628d27099B8c4f621bE4CCd142d5",initCodeHash:"0x85d96aa1c9a65886d094915d76ccae85f14027a02c1647dde659f869460f03e6"},"0.3.2":{accountImplementationAddress:"0xD830D15D3dc0C269F3dBAa0F3e8626d33CFdaBe1",factoryAddress:"0x7a1dBAB750f12a90EB1B60D2Ae3aD17D4D81EfFe",metaFactoryAddress:"0xd703aaE79538628d27099B8c4f621bE4CCd142d5",initCodeHash:"0xc7c48c9dd12de68b8a4689b6f8c8c07b61d4d6fa4ddecdd86a6980d045fa67eb"},"0.3.3":{accountImplementationAddress:"0xd6CEDDe84be40893d153Be9d467CD6aD37875b28",factoryAddress:"0x2577507b78c2008Ff367261CB6285d44ba5eF2E9",metaFactoryAddress:"0xd703aaE79538628d27099B8c4f621bE4CCd142d5",initCodeHash:"0xc452397f1e7518f8cea0566ac057e243bb1643f6298aba8eec8cdee78ee3b3dd"}},p="0.3.0",h="0.3.1",y="0xb230f0A1C7C95fa11001647383c8C7a8F316b900",m="Kernel",f={SUDO:"0x00",SECONDARY:"0x01",PERMISSION:"0x02",EIP7702:"0x00"};!function(e){e.DEFAULT="0x00",e.ENABLE="0x01"}(a||(a={})),function(e){e.SINGLE="0x00",e.BATCH="0x01",e.DELEGATE_CALL="0xFF"}(n||(n={})),function(e){e.DEFAULT="0x00",e.TRY_EXEC="0x01"}(s||(s={}));let g="0x9b35Af71d77eaf8d7e40252370304687390A1A52",b=e=>"0.6"===e?{address:o.B9,version:e}:{address:o.oi,version:e}},67199:(e,t,r)=>{let a=r(48390);e.exports=(e,t,r)=>a(e,t,r)>=0},68226:(e,t,r)=>{let a=r(48390);e.exports=(e,t,r)=>0>=a(e,t,r)},71146:(e,t,r)=>{let a=r(240),n=r(76353);e.exports=(e,t,r)=>{let s=null,i=null,o=null;try{o=new n(t,r)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(!s||-1===i.compare(e))&&(i=new a(s=e,r))}),s}},71450:(e,t,r)=>{r.r(t),r.d(t,{__addDisposableResource:()=>D,__assign:()=>s,__asyncDelegator:()=>x,__asyncGenerator:()=>O,__asyncValues:()=>S,__await:()=>E,__awaiter:()=>y,__classPrivateFieldGet:()=>R,__classPrivateFieldIn:()=>j,__classPrivateFieldSet:()=>$,__createBinding:()=>f,__decorate:()=>o,__disposeResources:()=>N,__esDecorate:()=>u,__exportStar:()=>g,__extends:()=>n,__generator:()=>m,__importDefault:()=>C,__importStar:()=>
1A,__makeTemplateObject:()=>I,__metadata:()=>h,__param:()=>l,__propKey:()=>d,__read:()=>w,__rest:()=>i,__rewriteRelativeImportExtension:()=>U,__runInitializers:()=>c,__setFunctionName:()=>p,__spread:()=>v,__spreadArray:()=>_,__spreadArrays:()=>T,__values:()=>b,default:()=>M});var a=function(e,t){return(a=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function i(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&0>t.indexOf(a)&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,a=Object.getOwnPropertySymbols(e);n<a.length;n++)0>t.indexOf(a[n])&&Object.prototype.propertyIsEnumerable.call(e,a[n])&&(r[a[n]]=e[a[n]]);return r}function o(e,t,r,a){var n,s=arguments.length,i=s<3?t:null===a?a=Object.getOwnPropertyDescriptor(t,r):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,a);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(i=(s<3?n(i):s>3?n(t,r,i):n(t,r))||i);return s>3&&i&&Object.defineProperty(t,r,i),i}function l(e,t){return function(r,a){t(r,a,e)}}function u(e,t,r,a,n,s){function i(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var o,l=a.kind,u="getter"===l?"get":"setter"===l?"set":"value",c=!t&&e?a.static?e:e.prototype:null,d=t||(c?Object.getOwnPropertyDescriptor(c,a.name):{}),p=!1,h=r.length-1;h>=0;h--){var y={};for(var m in a)y[m]="access"===m?{}:a[m];for(var m in a.access)y.access[m]=a.access[m];y.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");s.push(i(e||null))};var f=(0,r[h])("accessor"===l?{get:d.get,set:d.set}:d[u],y);if("accessor"===l){if(void 0===f)continue;if(null===f||"object"!=typeof f)throw TypeError("Object expected");(o=i(f.get))&&(d.get=o),(o=i(f.set))&&(d.set=o),(o=i(f.init))&&n.unshift(o)}else(o=i(f))&&("field"===l?n.unshift(o):d[u]=o)}c&&Object.defineProperty(c,a.name,d),p=!0}function c(e,t,r){for(var a=arguments.length>2,n=0;n<t.length;n++)r=a?t[n].call(e,r):t[n].call(e);return a?r:void 0}function d(e){return"symbol"==typeof e?e:"".concat(e)}function p(e,t,r){return"symbol"==typeof t&&(t=t.description?"[".concat(t.description,"]"):""),Object.defineProperty(e,"name",{configurable:!0,value:r?"".concat(r," ",t):t})}function h(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function y(e,t,r,a){return new(r||(r=Promise))(function(n,s){function i(e){try{l(a.next(e))}catch(e){s(e)}}function o(e){try{l(a.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(i,o)}l((a=a.apply(e,t||[])).next())})}function m(e,t){var r,a,n,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(l){var u=[o,l];if(r)throw TypeError("Generator is already executing.");for(;i&&(i=0,u[0]&&(s=0)),s;)try{if(r=1,a&&(n=2&u[0]?a.return:u[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,u[1])).done)return n;switch(a=0,n&&(u=[2&u[0],n.value]),u[0]){case 0:case 1:n=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,a=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(n=(n=s.trys).length>0&&n[n.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!n||u[1]>n[0]&&u[1]<n[3])){s.label=u[1];break}if(6===u[0]&&s.label<n[1]){s.label=n[1],n=u;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(u);break}n[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],a=0}finally{r=n=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}var f=Object.create?function(e,t,r,a){void 0===a&&(a=r);var n=Object.getOwnPropertyDescriptor(t,r);
vendor: 4,267 bytes, line 1
1(!n||("get"in n?!t.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,a,n)}:function(e,t,r,a){void 0===a&&(a=r),e[a]=t[r]};function g(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||f(t,e,r)}function b(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],a=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&a>=e.length&&(e=void 0),{value:e&&e[a++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var a,n,s=r.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(a=s.next()).done;)i.push(a.value)}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return i}function v(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(w(arguments[t]));return e}function T(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var a=Array(e),n=0,t=0;t<r;t++)for(var s=arguments[t],i=0,o=s.length;i<o;i++,n++)a[n]=s[i];return a}function _(e,t,r){if(r||2==arguments.length)for(var a,n=0,s=t.length;n<s;n++)!a&&n in t||(a||(a=Array.prototype.slice.call(t,0,n)),a[n]=t[n]);return e.concat(a||Array.prototype.slice.call(t))}function E(e){return this instanceof E?(this.v=e,this):new E(e)}function O(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var a,n=r.apply(e,t||[]),s=[];return a=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),i("next"),i("throw"),i("return",function(e){return function(t){return Promise.resolve(t).then(e,u)}}),a[Symbol.asyncIterator]=function(){return this},a;function i(e,t){n[e]&&(a[e]=function(t){return new Promise(function(r,a){s.push([e,t,r,a])>1||o(e,t)})},t&&(a[e]=t(a[e])))}function o(e,t){try{var r;(r=n[e](t)).value instanceof E?Promise.resolve(r.value.v).then(l,u):c(s[0][2],r)}catch(e){c(s[0][3],e)}}function l(e){o("next",e)}function u(e){o("throw",e)}function c(e,t){e(t),s.shift(),s.length&&o(s[0][0],s[0][1])}}function x(e){var t,r;return t={},a("next"),a("throw",function(e){throw e}),a("return"),t[Symbol.iterator]=function(){return this},t;function a(a,n){t[a]=e[a]?function(t){return(r=!r)?{value:E(e[a](t)),done:!1}:n?n(t):t}:n}}function S(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=b(e),t={},a("next"),a("throw"),a("return"),t[Symbol.asyncIterator]=function(){return this},t);function a(r){t[r]=e[r]&&function(t){return new Promise(function(a,n){var s,i,o;s=a,i=n,o=(t=e[r](t)).done,Promise.resolve(t.value).then(function(e){s({value:e,done:o})},i)})}}}function I(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var P=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},k=function(e){return(k=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t})(e)};function A(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r=k(e),a=0;a<r.length;a++)"default"!==r[a]&&f(t,e,r[a]);return P(t,e),t}function C(e){return e&&e.__esModule?e:{default:e}}function R(e,t,r,a){if("a"===r&&!a)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!a:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?a:"a"===r?a.call(e):a?a.value:t.get(e)}function $(e,t,r,a,n){if("m"===a)throw TypeError("Private method is not writable");if("a"===a&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===a?n.call(e,r):n?n.value=r:t.set(e,r),r}function j(e,t){if(null===t||"object"!=typeof t&&"function"!=typeof t)throw TypeError("Cannot use 'in' operator on non-object");return"function"==typeof e?t===e:e.has(t)}function D(e,t,r){if(null!=t){var a,n;if("object"!=typeof t&&"function"!=typeof t)throw TypeError("Object expected.");
1if(r){if(!Symbol.asyncDispose)throw TypeError("Symbol.asyncDispose is not defined.");a=t[Symbol.asyncDispose]}if(void 0===a){if(!Symbol.dispose)throw TypeError("Symbol.dispose is not defined.");a=t[Symbol.dispose],r&&(n=a)}if("function"!=typeof a)throw TypeError("Object not disposable.");n&&(a=function(){try{n.call(this)}catch(e){return Promise.reject(e)}}),e.stack.push({value:t,dispose:a,async:r})}else r&&e.stack.push({async:!0});return t}var L="function"==typeof SuppressedError?SuppressedError:function(e,t,r){var a=Error(r);return a.name="SuppressedError",a.error=e,a.suppressed=t,a};function N(e){function t(t){e.error=e.hasError?new L(t,e.error,"An error was suppressed during disposal."):t,e.hasError=!0}var r,a=0;return function n(){for(;r=e.stack.pop();)try{if(!r.async&&1===a)return a=0,e.stack.push(r),Promise.resolve().then(n);if(r.dispose){var s=r.dispose.call(r.value);if(r.async)return a|=2,Promise.resolve(s).then(n,function(e){return t(e),n()})}else a|=1}catch(e){t(e)}if(1===a)return e.hasError?Promise.reject(e.error):Promise.resolve();if(e.hasError)throw e.error}()}function U(e,t){return"string"==typeof e&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(e,r,a,n,s){return r?t?".jsx":".js":!a||n&&s?a+n+"."+s.toLowerCase()+"js":e}):e}let M={__extends:n,__assign:s,__rest:i,__decorate:o,__param:l,__esDecorate:u,__runInitializers:c,__propKey:d,__setFunctionName:p,__metadata:h,__awaiter:y,__generator:m,__createBinding:f,__exportStar:g,__values:b,__read:w,__spread:v,__spreadArrays:T,__spreadArray:_,__await:E,__asyncGenerator:O,__asyncDelegator:x,__asyncValues:S,__makeTemplateOb
1ject:I,__importStar:A,__importDefault:C,__classPrivateFieldGet:R,__classPrivateFieldSet:$,__classPrivateFieldIn:j,__addDisposableResource:D,__disposeResources:N,__rewriteRelativeImportExtension:U}},71716:(e,t,r)=>{r.d(t,{Kh:()=>l,Wm:()=>u,oX:()=>o,tN:()=>i});var a=r(13933),n=r(50879),s=r(42503);class i extends a.C{constructor(e,{callData:t,callGasLimit:r,docsPath:a,factory:i,factoryData:o,initCode:l,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,paymaster:p,paymasterAndData:h,paymasterData:y,paymasterPostOpGasLimit:m,paymasterVerificationGasLimit:f,preVerificationGas:g,sender:b,signature:w,verificationGasLimit:v}){super(e.shortMessage,{cause:e,docsPath:a,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",(0,n.aO)({callData:t,callGasLimit:r,factory:i,factoryData:o,initCode:l,maxFeePerGas:void 0!==u&&`${(0,s.Q)(u)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${(0,s.Q)(c)} gwei`,nonce:d,paymaster:p,paymasterAndData:h,paymasterData:y,paymasterPostOpGasLimit:m,paymasterVerificationGasLimit:f,preVerificationGas:g,sender:b,signature:w,verificationGasLimit:v})].filter(Boolean),name:"UserOperationExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class o extends a.C{constructor({hash:e}){super(`User Operation receipt with hash "${e}" could not be found. The User Operation may not have been processed yet.`,{name:"UserOperationReceiptNotFoundError"})}}class l extends a.C{constructor({hash:e}){super(`User Operation with hash "${e}" could not be found.`,{name:"UserOperationNotFoundError"})}}class u extends a.C{constructor({hash:e}){super(`Timed out while waiting for User Operation with hash "${e}" to be confirmed.`,{name:"WaitForUserOperationReceiptTimeoutError"})}}},72119:(e,t,r)=>{let a=r(93127);e.exports=(e,t)=>e.sort((e,r)=>a(e,r,t))},72901:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=r(71450).__importDefault(r(54419));class n{constructor(e,{headers:t={},schema:r,fetch:a}){this.url=e,this.headers=new Headers(t),this.schema=r,this.fetch=a}select(e,t){let{head:r=!1,count:n}=null!=t?t:{},s=!1,i=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!s?"":('"'===e&&(s=!s),e)).join("");return this.url.searchParams.set("select",i),n&&this.headers.append("Prefer",`count=${n}`),new a.default({method:r?"HEAD":"GET",url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(e,{count:t,defaultToNull:r=!0}={}){var n;if(t&&this.headers.append("Prefer",`count=${t}`),r||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new a.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(n=this.fetch)?n:fetch})}upsert(e,{onConflict:t,ignoreDuplicates:r=!1,count:n,defaultToNull:s=!0}={}){var i;if(this.headers.append("Prefer",`resolution=${r?"ignore":"merge"}-duplicates`),void 0!==t&&this.url.searchParams.set("on_conflict",t),n&&this.headers.append("Prefer",`count=${n}`),s||this.headers.append("Prefer","missing=default"),Array.isArray(e)){let t=e.reduce((e,t)=>e.concat(Object.keys(t)),[]);if(t.length>0){let e=[...new Set(t)].map(e=>`"${e}"`);this.url.searchParams.set("columns",e.join(","))}}return new a.default({method:"POST",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(i=this.fetch)?i:fetch})}update(e,{count:t}={}){var r;return t&&this.headers.append("Prefer",`count=${t}`),new a.default({method:"PATCH",url:this.url,headers:this.headers,schema:this.schema,body:e,fetch:null!=(r=this.fetch)?r:fetch})}delete({count:e}={}){var t;return e&&this.headers.append("Prefer",`count=${e}`),new a.default({method:"DELETE",url:this.url,headers:this.headers,schema:this.schema,fetch:null!=(t=this.fetch)?t:fetch})}}t.default=n},72951:(e,t,r)=>{r.d(t,{$:()=>u});var a=r(97152),n=r(64664),s=r(72757),i=r(3450),o=r(52539),l=r(55874);async function u(e,t){let{account:r=e.account,entryPointAddress:u}=t;if(!r&&!t.sender)throw new n.T;
1let c=r?(0,a.J)(r):void 0,d=c?await (0,s.T)(e,l.u,"prepareUserOperation")(t):t,p=t.signature||await c?.signUserOperation?.(d),h=(0,o.P)({...d,signature:p});try{return await e.request({method:"eth_sendUserOperation",params:[h,u??c?.entryPoint?.address]},{retryCount:0})}catch(r){let e=t.calls;throw(0,i.t)(r,{...d,...e?{calls:e}:{},signature:p})}}},73046:(e,t,r)=>{let a=r(76353);e.exports=(e,t)=>{try{return new a(e,t).range||"*"}catch(e){return null}}},74371:e=>{let t=Object.freeze({loose:!0}),r=Object.freeze({});e.exports=e=>e?"object"!=typeof e?t:e:r},74609:(e,t,r)=>{let a=r(240);e.exports=(e,t,r,n,s)=>{"string"==typeof r&&(s=n,n=r,r=void 0);try{return new a(e instanceof a?e.version:e,r).inc(t,n,s).version}catch(e){return null}}},76353:(e,t,r)=>{let a=/\s+/g;class n{constructor(e,t){if(t=i(t),e instanceof n)if(!!t.loose===e.loose&&!!t.includePrerelease===e.includePrerelease)return e;else return new n(e.raw,t);if(e instanceof o)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(a," "),this.set=this.raw.split("||").map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!g(e[0])),0===this.set.length)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(1===e.length&&b(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let t=((this.options.includePrerelease&&m)|(this.options.loose&&f))+":"+e,r=s.get(t);if(r)return r;let a=this.options.loose,n=a?c[d.HYPHENRANGELOOSE]:c[d.HYPHENRANGE];l("hyphen replace",e=e.replace(n,A(this.options.includePrerelease))),l("comparator trim",e=e.replace(c[d.COMPARATORTRIM],p)),l("tilde trim",e=e.replace(c[d.TILDETRIM],h)),l("caret trim",e=e.replace(c[d.CARETTRIM],y));let i=e.split(" ").map(e=>v(e,this.options)).join(" ").split(/\s+/).map(e=>k(e,this.options));a&&(i=i.filter(e=>(l("loose invalid filter",e,this.options),!!e.match(c[d.COMPARATORLOOSE])))),l("range list",i);let u=new Map;for(let e of i.map(e=>new o(e,this.options))){if(g(e))return[e];u.set(e.value,e)}u.size>1&&u.has("")&&u.delete("");let b=[...u.values()];return s.set(t,b),b}intersects(e,t){if(!(e instanceof n))throw TypeError("a Range is required");return this.set.some(r=>w(r,t)&&e.set.some(e=>w(e,t)&&r.every(r=>e.every(e=>r.intersects(e,t)))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new u(e,this.options)}catch(e){return!1}for(let t=0;t<this.set.length;t++)if(C(this.set[t],e,this.options))return!0;return!1}}e.exports=n;let s=new(r(99908)),i=r(74371),o=r(52376),l=r(44764),u=r(240),{safeRe:c,t:d,comparatorTrimReplace:p,tildeTrimReplace:h,c
1aretTrimReplace:y}=r(82404),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:f}=r(36706),g=e=>"<0.0.0-0"===e.value,b=e=>""===e.value,w=(e,t)=>{let r=!0,a=e.slice(),n=a.pop();for(;r&&a.length;)r=a.every(e=>n.intersects(e,t)),n=a.pop();return r},v=(e,t)=>(l("comp",e,t),l("caret",e=O(e,t)),l("tildes",e=_(e,t)),l("xrange",e=S(e,t)),l("stars",e=P(e,t)),e),T=e=>!e||"x"===e.toLowerCase()||"*"===e,_=(e,t)=>e.trim().split(/\s+/).map(e=>E(e,t)).join(" "),E=(e,t)=>{let r=t.loose?c[d.TILDELOOSE]:c[d.TILDE];return e.replace(r,(t,r,a,n,s)=>{let i;return l("tilde",e,t,r,a,n,s),T(r)?i="":T(a)?i=`>=${r}.0.0 <${+r+1}.0.0-0`:T(n)?i=`>=${r}.${a}.0 <${r}.${+a+1}.0-0`:s?(l("replaceTilde pr",s),i=`>=${r}.${a}.${n}-${s} <${r}.${+a+1}.0-0`):i=`>=${r}.${a}.${n} <${r}.${+a+1}.0-0`,l("tilde return",i),i})},O=(e,t)=>e.trim().split(/\s+/).map(e=>x(e,t)).join(" "),x=(e,t)=>{l("caret",e,t);let r=t.loose?c[d.CARETLOOSE]:c[d.CARET],a=t.includePrerelease?"-0":"";return e.replace(r,(t,r,n,s,i)=>{let o;return l("caret",e,t,r,n,s,i),T(r)?o="":T(n)?o=`>=${r}.0.0${a} <${+r+1}.0.0-0`:T(s)?o="0"===r?`>=${r}.${n}.0${a} <${r}.${+n+1}.0-0`:`>=${r}.${n}.0${a} <${+r+1}.0.0-0`:i?(l("replaceCaret pr",i),o="0"===r?"0"===n?`>=${r}.${n}.${s}-${i} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}-${i} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s}-${i} <${+r+1}.0.0-0`):(l("no pr"),o="0"===r?"0"===n?`>=${r}.${n}.${s}${a} <${r}.${n}.${+s+1}-0`:`>=${r}.${n}.${s}${a} <${r}.${+n+1}.0-0`:`>=${r}.${n}.${s} <${+r+1}.0.0-0`),l("caret return",o),o})},S=(e,t)=>(l("replaceXRanges",e,t),e.split(/\s+/).map(e=>I(e,t)).join(" ")),I=(e,t)=>{e=e.trim();let r=t.loose?c[d.XRANGELOOSE]:c[d.XRANGE];return e.replace(r,(r,a,n,s,i,o)=>{l("xRange",e,r,a,n,s,i,o);let u=T(n),c=u||T(s),d=c||T(i);return"="===a&&d&&(a=""),o=t.includePrerelease?"-0":"",u?r=">"===a||"<"===a?"<0.0.0-0":"*":a&&d?(c&&(s=0),i=0,">"===a?(a=">=",c?(n=+n+1,s=0):s=+s+1,i=0):"<="===a&&(a="<",c?n=+n+1:s=+s+1),"<"===a&&(o="-0"),r=`${a+n}.${s}.${i}${o}`):c?r=`>=${n}.0.0${o} <${+n+1}.0.0-0`:d&&(r=`>=${n}.${s}.0${o} <${n}.${+s+1}.0-0`),l("xRange return",r),r})},P=(e,t)=>(l("replaceStars",e,t),e.trim().replace(c[d.STAR],"")),k=(e,t)=>(l("replaceGTE0",e,t),e.trim().replace(c[t.includePrerelease?d.GTE0PRE:d.GTE0],"")),A=e=>(t,r,a,n,s,i,o,l,u,c,d,p)=>(r=T(a)?"":T(n)?`>=${a}.0.0${e?"-0":""}`:T(s)?`>=${a}.${n}.0${e?"-0":""}`:i?`>=${r}`:`>=${r}${e?"-0":""}`,l=T(u)?"":T(c)?`<${+u+1}.0.0-0`:T(d)?`<${u}.${+c+1}.0-0`:p?`<=${u}.${c}.${d}-${p}`:e?`<${u}.${c}.${+d+1}-0`:`<=${l}`,`${r} ${l}`.trim()),C=(e,t,r)=>{for(let r=0;r<e.length;r++)if(!e[r].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let r=0;r<e.length;r++)if(l(e[r].semver),e[r].semver!==o.ANY&&e[r].semver.prerelease.length>0){let a=e[r].semver;if(a.major===t.major&&a.minor===t.minor&&a.patch===t.patch)return!0}return!1}return!0}},76373:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});let a=r(71450).__importDefault(r(3913));class n extends a.default{select(e){let t=!1,r=(null!=e?e:"*").split("").map(e=>/\s/.test(e)&&!t?"":('"'===e&&(t=!t),e)).join("");return this.url.searchParams.set("select",r),this.headers.append("Prefer","return=representation"),this}order(e,{ascending:t=!0,nullsFirst:r,foreignTable:a,referencedTable:n=a}={}){let s=n?`${n}.order`:"order",i=this.url.searchParams.get(s);return this.url.searchParams.set(s,`${i?`${i},`:""}${e}.${t?"asc":"desc"}${void 0===r?"":r?".nullsfirst":".nullslast"}`),this}limit(e,{foreignTable:t,referencedTable:r=t}={}){let a=void 0===r?"limit":`${r}.limit`;return this.url.searchParams.set(a,`${e}`),this}range(e,t,{foreignTable:r,referencedTable:a=r}={}){let n=void 0===a?"offset":`${a}.offset`,s=void 0===a?"limit":`${a}.limit`;return this.url.searchParams.set(n,`${e}`),this.url.searchParams.set(s,`${t-e+1}`),this}abortSignal(e){return this.signal=e,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return"GET"===this.method?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}
1explain({analyze:e=!1,verbose:t=!1,settings:r=!1,buffers:a=!1,wal:n=!1,format:s="text"}={}){var i;let o=[e?"analyze":null,t?"verbose":null,r?"settings":null,a?"buffers":null,n?"wal":null].filter(Boolean).join("|"),l=null!=(i=this.headers.get("Accept"))?i:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${s}; for="${l}"; options=${o};`),this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(e){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${e}`),this}}t.default=n},80456:(e,t,r)=>{let a=r(240),n=r(76353);e.exports=(e,t,r)=>{let s=null,i=null,o=null;try{o=new n(t,r)}catch(e){return null}return e.forEach(e=>{o.test(e)&&(!s||1===i.compare(e))&&(i=new a(s=e,r))}),s}},81947:(e,t,r)=>{let a=r(48390);e.exports=(e,t,r)=>0>a(e,t,r)},82404:(e,t,r)=>{let{MAX_SAFE_COMPONENT_LENGTH:a,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=r(36706),i=r(44764),o=(t=e.exports={}).re=[],l=t.safeRe=[],u=t.src=[],c=t.safeSrc=[],d=t.t={},p=0,h="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",s],[h,n]],m=(e,t,r)=>{let a=(e=>{for(let[t,r]of y)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),n=p++;i(e,n,t),d[e]=n,u[n]=t,c[n]=a,o[n]=new RegExp(t,r?"g":void 0),l[n]=new RegExp(a,r?"g":void 0)};m("NUMERICIDENTIFIER","0|[1-9]\\d*"),m("NUMERICIDENTIFIERLOOSE","\\d+"),m("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${h}*`),m("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),m("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),m("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),m("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),m("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),m("BUILDIDENTIFIER",`${h}+`),m("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),m("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),m("FULL",`^${u[d.FULLPLAIN]}$`),m("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),m("LOOSE",`^${u[d.LOOSEPLAIN]}$`),m("GTLT","((?:<|>)?=?)"),m("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),m("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),m("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),m("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),m("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),m("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),m("COERCEPLAIN",`(^|[^\\d])(\\d{1,${a}})(?:\\.(\\d{1,${a}}))?(?:\\.(\\d{1,${a}}))?`),m("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),m("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?`+`(?:${u[d.BUILD]})?`+"(?:$|[^\\d])"),m("COERCERTL",u[d.COERCE],!0),m("COERCERTLFULL",u[d.COERCEFULL],!0),m("LONETILDE","(?:~>?)"),m("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",m("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),m("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),m("LONECARET","(?:\\^)"),m("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",m("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),m("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),m("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),m("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),m("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",m("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),m("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]}
1)\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),m("STAR","(<|>)?=?\\s*\\*"),m("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),m("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")},84451:(e,t,r)=>{let a=r(16088),n=r(48390);e.exports=(e,t,r)=>{let s=[],i=null,o=null,l=e.sort((e,t)=>n(e,t,r));for(let e of l)a(e,t,r)?(o=e,i||(i=e)):(o&&s.push([i,o]),o=null,i=null);i&&s.push([i,null]);let u=[];for(let[e,t]of s)e===t?u.push(e):t||e!==l[0]?t?e===l[0]?u.push(`<=${t}`):u.push(`${e} - ${t}`):u.push(`>=${e}`):u.push("*");let c=u.join(" || "),d="string"==typeof t.raw?t.raw:String(t);return c.length<d.length?c:t}},85553:(e,t,r)=>{r.d(t,{UU:()=>t9});var a,n,s,i,o,l,u,c,d,p,h,y,m,f=r(71450);class g extends Error{constructor(e,t="FunctionsError",r){super(e),this.name=t,this.context=r}}class b extends g{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class w extends g{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class v extends g{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}!function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"}(a||(a={}));class T{constructor(e,{headers:t={},customFetch:n,region:s=a.Any}={}){this.url=e,this.headers=t,this.region=s,this.fetch=(e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)})(n)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return(0,f.__awaiter)(this,arguments,void 0,function*(e,t={}){var r;try{let a,{headers:n,method:s,body:i,signal:o}=t,l={},{region:u}=t;u||(u=this.region);let c=new URL(`${this.url}/${e}`);u&&"any"!==u&&(l["x-region"]=u,c.searchParams.set("forceFunctionRegion",u)),i&&(n&&!Object.prototype.hasOwnProperty.call(n,"Content-Type")||!n)?"undefined"!=typeof Blob&&i instanceof Blob||i instanceof ArrayBuffer?(l["Content-Type"]="application/octet-stream",a=i):"string"==typeof i?(l["Content-Type"]="text/plain",a=i):"undefined"!=typeof FormData&&i instanceof FormData?a=i:(l["Content-Type"]="application/json",a=JSON.stringify(i)):a=i;let d=yield this.fetch(c.toString(),{method:s||"POST",headers:Object.assign(Object.assign(Object.assign({},l),this.headers),n),body:a,signal:o}).catch(e=>{if("AbortError"===e.name)throw e;throw new b(e)}),p=d.headers.get("x-relay-error");if(p&&"true"===p)throw new w(d);if(!d.ok)throw new v(d);let h=(null!=(r=d.headers.get("Content-Type"))?r:"text/plain").split(";")[0].trim();return{data:"application/json"===h?yield d.json():"application/octet-stream"===h||"application/pdf"===h?yield d.blob():"text/event-stream"===h?d:"multipart/form-data"===h?yield d.formData():yield d.text(),error:null,response:d}}catch(e){if(e instanceof Error&&"AbortError"===e.name)return{data:null,error:new b(e)};return{data:null,error:e,response:e instanceof v||e instanceof w?e.context:void 0}}})}}var _=r(87843),E=r.t(_,2);let{PostgrestClient:O,PostgrestQueryBuilder:x,PostgrestFilterBuilder:S,PostgrestTransformBuilder:I,PostgrestBuilder:P,PostgrestError:k}=_||E;var A=r(87358);class C{static detectEnvironment(){var e;if("undefined"!=typeof WebSocket)return{type:"native",constructor:WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocket)return{type:"native",constructor:globalThis.WebSocket};if(void 0!==r.g&&void 0!==r.g.WebSocket)return{type:"native",constructor:r.g.WebSocket};if("undefined"!=typeof globalThis&&void 0!==globalThis.WebSocketPair&&void 0===globalThis.WebSocket)return{type:"cloudflare",error:"Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",workaround:"Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."};if("undefined"!=typeof globalThis&&globalThis.EdgeRuntime||"undefined"!=typeof navigator&&(null==(e=navigator.userAgent)?void 0:e.includes("Vercel-Edge")))return{type:"unsupported",error:"Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",workaround:"Use serverless functions or a different deployment target for WebSocket functionality."};if(void 0!==A){let e=A.versions;if(e&&e.node){let t=parseInt(e.node.replace(/^v/,"").split(".")[0]);return t>=22?void 0!==globalThis.WebSocket?{type:"native",constructor:globalThis.WebSocket}:{type:"unsupported",error:`Node.js ${t} detected but native WebSocket not found.`,workaround:"Provide a WebSocket implementation via the transport option."}:{type:"unsupported",error:`Node.js ${t} detected without native WebSocket support.`,workaround:'For Node.js < 22, install "ws" package and provide it via the transport option:\nimport ws from "ws"\nnew RealtimeClient(url, { transport: ws })'}}}return{type:"unsupported",error:"Unknown JavaScript runtime without WebSocket support.",workaround:"Ensure you're running in a supported environment (browser, Node.js, Deno) or provide a custom WebSocket implementation."}}static getWebSocketConstructor(){let e=this.detectEnvironment();if(e.constructor)return e.constructor;let t=e.error||"WebSocket not supported in this environment.";throw e.workaround&&(t+=` 2 3Suggested solution: ${e.workaround}`),Error(t)}static createWebSocket(e,t){return new(this.getWebSocketConstructor())(e,t)}static isWebSocketSupported(){try{let e=this.detectEnvironment();return"native"===e.type||"ws"===e.type}catch(e){return!1}}}!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(n||(n={})),function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"}(s||(s={})),function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"}(i||(i={})),(o||(o={})).websocket="websocket",function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"}(l||(l={}));class R{constructor(){this.HEADER_LENGTH=1}decode(e,t){return e.constructor===ArrayBuffer?t(this._binaryDecode(e)):"string"==typeof e?t(JSON.parse(e)):t({})}
3_binaryDecode(e){let t=new DataView(e),r=new TextDecoder;return this._decodeBroadcast(e,t,r)}_decodeBroadcast(e,t,r){let a=t.getUint8(1),n=t.getUint8(2),s=this.HEADER_LENGTH+2,i=r.decode(e.slice(s,s+a));s+=a;let o=r.decode(e.slice(s,s+n));return s+=n,{ref:null,topic:i,event:o,payload:JSON.parse(r.decode(e.slice(s,e.byteLength)))}}}class ${constructor(e,t){this.callback=e,this.timerCalc=t,this.timer=void 0,this.tries=0,this.callback=e,this.timerCalc=t}reset(){this.tries=0,clearTimeout(this.timer),this.timer=void 0}scheduleTimeout(){clearTimeout(this.timer),this.timer=setTimeout(()=>{this.tries=this.tries+1,this.callback()},this.timerCalc(this.tries+1))}}!function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"}(u||(u={}));let j=(e,t,r={})=>{var a;let n=null!=(a=r.skipTypes)?a:[];return t?Object.keys(t).reduce((r,a)=>(r[a]=D(a,e,t,n),r),{}):{}},D=(e,t,r,a)=>{let n=t.find(t=>t.name===e),s=null==n?void 0:n.type,i=r[e];return s&&!a.includes(s)?L(s,i):N(i)},L=(e,t)=>{if("_"===e.charAt(0))return F(t,e.slice(1,e.length));switch(e){case u.bool:return U(t);case u.float4:case u.float8:case u.int2:case u.int4:case u.int8:case u.numeric:case u.oid:return M(t);case u.json:case u.jsonb:return G(t);case u.timestamp:return V(t);case u.abstime:case u.date:case u.daterange:case u.int4range:case u.int8range:case u.money:case u.reltime:case u.text:case u.time:case u.timestamptz:case u.timetz:case u.tsrange:case u.tstzrange:default:return N(t)}},N=e=>e,U=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},M=e=>{if("string"==typeof e){let t=parseFloat(e);if(!Number.isNaN(t))return t}return e},G=e=>{if("string"==typeof e)try{return JSON.parse(e)}catch(e){console.log(`JSON parse error: ${e}`)}return e},F=(e,t)=>{if("string"!=typeof e)return e;let r=e.length-1,a=e[r];if("{"===e[0]&&"}"===a){let a,n=e.slice(1,r);try{a=JSON.parse("["+n+"]")}catch(e){a=n?n.split(","):[]}return a.map(e=>L(t,e))}return e},V=e=>"string"==typeof e?e.replace(" ","T"):e,B=e=>{let t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),""===t.pathname||"/"===t.pathname?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class K{constructor(e,t,r={},a=1e4){this.channel=e,this.event=t,this.payload=r,this.timeout=a,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,t){var r;return this._hasReceived(e)&&t(null==(r=this.receivedResp)?void 0:r.response),this.recHooks.push({status:e,callback:t}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);let e=e=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=e,this._matchReceive(e)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,t){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:t})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:t}
3){this.recHooks.filter(t=>t.status===e).forEach(e=>e.callback(t))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}!function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"}(c||(c={}));class q{constructor(e,t){this.channel=e,this.state={},this.pendingDiffs=[],this.joinRef=null,this.enabled=!1,this.caller={onJoin:()=>{},onLeave:()=>{},onSync:()=>{}};let r=(null==t?void 0:t.events)||{state:"presence_state",diff:"presence_diff"};this.channel._on(r.state,{},e=>{let{onJoin:t,onLeave:r,onSync:a}=this.caller;this.joinRef=this.channel._joinRef(),this.state=q.syncState(this.state,e,t,r),this.pendingDiffs.forEach(e=>{this.state=q.syncDiff(this.state,e,t,r)}),this.pendingDiffs=[],a()}),this.channel._on(r.diff,{},e=>{let{onJoin:t,onLeave:r,onSync:a}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(e):(this.state=q.syncDiff(this.state,e,t,r),a())}),this.onJoin((e,t,r)=>{this.channel._trigger("presence",{event:"join",key:e,currentPresences:t,newPresences:r})}),this.onLeave((e,t,r)=>{this.channel._trigger("presence",{event:"leave",key:e,currentPresences:t,leftPresences:r})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,t,r,a){let n=this.cloneDeep(e),s=this.transformState(t),i={},o={};return this.map(n,(e,t)=>{s[e]||(o[e]=t)}),this.map(s,(e,t)=>{let r=n[e];if(r){let a=t.map(e=>e.presence_ref),n=r.map(e=>e.presence_ref),s=t.filter(e=>0>n.indexOf(e.presence_ref)),l=r.filter(e=>0>a.indexOf(e.presence_ref));s.length>0&&(i[e]=s),l.length>0&&(o[e]=l)}else i[e]=t}),this.syncDiff(n,{joins:i,leaves:o},r,a)}static syncDiff(e,t,r,a){let{joins:n,leaves:s}={joins:this.transformState(t.joins),leaves:this.transformState(t.leaves)};return r||(r=()=>{}),a||(a=()=>{}),this.map(n,(t,a)=>{var n;let s=null!=(n=e[t])?n:[];if(e[t]=this.cloneDeep(a),s.length>0){let r=e[t].map(e=>e.presence_ref),a=s.filter(e=>0>r.indexOf(e.presence_ref));e[t].unshift(...a)}r(t,s,a)}),this.map(s,(t,r)=>{let n=e[t];if(!n)return;let s=r.map(e=>e.presence_ref);n=n.filter(e=>0>s.indexOf(e.presence_ref)),e[t]=n,a(t,n,r),0===n.length&&delete e[t]}),e}static map(e,t){return Object.getOwnPropertyNames(e).map(r=>t(r,e[r]))}static transformState(e){return Object.getOwnPropertyNames(e=this.cloneDeep(e)).reduce((t,r)=>{let a=e[r];return"metas"in a?t[r]=a.metas.map(e=>(e.presence_ref=e.phx_ref,delete e.phx_ref,delete e.phx_ref_prev,e)):t[r]=a,t},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}!function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"}(d||(d={})),function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"}(p||(p={})),function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"}(h||(h={}));class H{constructor(e,t={config:{}},r){var a,n;if(this.topic=e,this.params=t,this.socket=r,this.bindings={},this.state=s.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},t.config),this.timeout=this.socket.timeout,this.joinPush=new K(this,i.join,this.params,this.timeout),this.rejoinTimer=new $(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=s.joined,this.rejoinTimer.reset(),this.pushBuffer.forEach(e=>e.send()),this.pushBuffer=[]}),this._onClose(()=>{this.rejoinTimer.reset(),this.socket.log("channel",`close ${this.topic} ${this._joinRef()}`),this.state=s.closed,this.socket._remove(this)}),this._onError(e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=s.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=s.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",e=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,e),this.state=s.errored,this.rejoinTimer.scheduleTimeout())}),this._on(i.reply,{},(e,t)=>{this._trigger(this._replyEventName(t),e)}),this.presence=new q(this),this.broadcastEndpointURL=B(this.socket.endPoint),this.private=this.params.config.private||!1,!this.private&&(null==(n=null==(a=this.params.config)?void 0:a.broadcast)?void 0:n.replay))throw`tried to use replay on public channel '${this.topic}'. It must be a private channel.`}subscribe(e,t=this.timeout){var r,a,n;if(this.socket.isConnected()||this.socket.connect(),this.state==s.closed){let{config:{broadcast:i,presence:o,private:l}}=this.params,u=null!=(a=null==(r=this.bindings.postgres_changes)?void 0:r.map(e=>e.filter))?a:[],c=!!this.bindings[p.PRESENCE]&&this.bindings[p.PRESENCE].length>0||(null==(n=this.params.config.presence)?void 0:n.enabled)===!0,d={},y={broadcast:i,presence:Object.assign(Object.assign({},o),{enabled:c}),postgres_changes:u,private:l};this.socket.accessTokenValue&&(d.access_token=this.socket.accessTokenValue),this._onError(t=>null==e?void 0:e(h.CHANNEL_ERROR,t)),this._onClose(()=>null==e?void 0:e(h.CLOSED)),this.updateJoinPayload(Object.assign({config:y},d)),this.joinedOnce=!0,this._rejoin(t),this.joinPush.receive("ok",async({postgres_changes:t})=>{var r;if(this.socket.setAuth(),void 0===t){null==e||e(h.SUBSCRIBED);return}{let a=this.bindings.postgres_changes,n=null!=(r=null==a?void 0:a.length)?r:0,i=[];for(let r=0;r<n;r++){let n=a[r],{filter:{event:o,schema:l,table:u,filter:c}}=n,d=t&&t[r];if(d&&d.event===o&&d.schema===l&&d.table===u&&d.filter===c)i.push(Object.assign(Object.assign({},n),{id:d.id}));else{this.unsubscribe(),this.state=s.errored,null==e||e(h.CHANNEL_ERROR,Error("mismatch between server and client bindings for postgres changes"));return}}this.bindings.postgres_changes=i,e&&e(h.SUBSCRIBED);return}}).receive("error",t=>{this.state=s.errored,null==e||e(h.CHANNEL_ERROR,Error(JSON.stringify(Object.values(t).join(", ")||"error")))}).receive("timeout",()=>{null==e||e(h.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(e,t={}){return await this.send({type:"presence",event:"track",payload:e},t.timeout||this.timeout)}async untrack(e={}){return await this.send({type:"presence",event:"untrack"},e)}on(e,t,r){return this.state===s.joined&&e===p.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,t,r)}async httpSend(e,t,r={}){var a;let n=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(null==t)return Promise.reject("Payload is required for httpSend()");let s={method:"POST",headers:{Authorization:n,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:t,private:this.private}]})},i=await this._fetchWithTimeout(this.broadcastEndpointURL,s,null!=(a=r.timeout)?a:this.timeout);if(202===i.status)return{success:!0};let o=i.statusText;
3try{let e=await i.json();o=e.error||e.message||o}catch(e){}return Promise.reject(Error(o))}async send(e,t={}){var r,a;if(this._canPush()||"broadcast"!==e.type)return new Promise(r=>{var a,n,s;let i=this._push(e.type,e,t.timeout||this.timeout);"broadcast"!==e.type||(null==(s=null==(n=null==(a=this.params)?void 0:a.config)?void 0:n.broadcast)?void 0:s.ack)||r("ok"),i.receive("ok",()=>r("ok")),i.receive("error",()=>r("error")),i.receive("timeout",()=>r("timed out"))});{console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");let{event:n,payload:s}=e,i={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:n,payload:s,private:this.private}]})};try{let e=await this._fetchWithTimeout(this.broadcastEndpointURL,i,null!=(r=t.timeout)?r:this.timeout);return await (null==(a=e.body)?void 0:a.cancel()),e.ok?"ok":"error"}catch(e){if("AbortError"===e.name)return"timed out";return"error"}}}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=s.leaving;let t=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(i.close,"leave",this._joinRef())};this.joinPush.destroy();let r=null;return new Promise(a=>{(r=new K(this,i.leave,{},e)).receive("ok",()=>{t(),a("ok")}).receive("timeout",()=>{t(),a("timed out")}).receive("error",()=>{a("error")}),r.send(),this._canPush()||r.trigger("ok",{})}).finally(()=>{null==r||r.destroy()})}teardown(){this.pushBuffer.forEach(e=>e.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=s.closed,this.bindings={}}async _fetchWithTimeout(e,t,r){let a=new AbortController,n=setTimeout(()=>a.abort(),r),s=await this.socket.fetch(e,Object.assign(Object.assign({},t),{signal:a.signal}));return clearTimeout(n),s}_push(e,t,r=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new K(this,e,t,r);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>100){let e=this.pushBuffer.shift();e&&(e.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${e.event}`,e.payload))}}_onMessage(e,t,r){return t}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,t,r){var a,n;let s=e.toLocaleLowerCase(),{close:o,error:l,leave:u,join:c}=i;if(r&&[o,l,u,c].indexOf(s)>=0&&r!==this._joinRef())return;let d=this._onMessage(s,t,r);if(t&&!d)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(s)?null==(a=this.bindings.postgres_changes)||a.filter(e=>{var t,r,a;return(null==(t=e.filter)?void 0:t.event)==="*"||(null==(a=null==(r=e.filter)?void 0:r.event)?void 0:a.toLocaleLowerCase())===s}).map(e=>e.callback(d,r)):null==(n=this.bindings[s])||n.filter(e=>{var r,a,n,i,o,l;if(!["broadcast","presence","postgres_changes"].includes(s))return e.type.toLocaleLowerCase()===s;if("id"in e){let s=e.id,i=null==(r=e.filter)?void 0:r.event;return s&&(null==(a=t.ids)?void 0:a.includes(s))&&("*"===i||(null==i?void 0:i.toLocaleLowerCase())===(null==(n=t.data)?void 0:n.type.toLocaleLowerCase()))}{let r=null==(o=null==(i=null==e?void 0:e.filter)?void 0:i.event)?void 0:o.toLocaleLowerCase();return"*"===r||r===(null==(l=null==t?void 0:t.event)?void 0:l.toLocaleLowerCase())}}).map(e=>{if("object"==typeof d&&"ids"in d){let e=d.data,{schema:t,table:r,commit_timestamp:a,type:n,errors:s}=e;d=Object.assign(Object.assign({},{schema:t,table:r,commit_timestamp:a,eventType:n,new:{},old:{},errors:s}),this._getPayloadRecords(e))}e.callback(d,r)})}_isClosed(){return this.state===s.closed}_isJoined(){return this.state===s.joined}_isJoining(){return this.state===s.joining}_isLeaving(){return this.state===s.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,t,r){let a=e.toLocaleLowerCase(),n={type:a,filter:t,callback:r};return this.bindings[a]?this.bindings[a].push(n):this.bindings[a]=[n],this}_off(e,t){let r=e.toLocaleLowerCase();return this.bindings[r]&&(this.bindings[r]=this.bindings[r].filter(e=>{var a;return!((null==(a=e.type)?void 0:a.toLocaleLowerCase())===r&&H.isEqual(e.filter,t))})),this}static isEqual(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e)if(e[r]!==t[r])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(i.close,{},e)}_onError(e){this._on(i.error,{},t=>e(t))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=s.joining,this.joinPush.resend(e))}_getPayloadRecords(e){let t={new:{},old:{}};return("INSERT"===e.type||"UPDATE"===e.type)&&(t.new=j(e.columns,e.record)),("UPDATE"===e.type||"DELET
3E"===e.type)&&(t.old=j(e.columns,e.old_record)),t}}let W=()=>{},z={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},J=[1e3,2e3,5e3,1e4],X=` 4 addEventListener("message", (e) => { 5 if (e.data.event === "start") { 6 setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); 7 } 8 });`;class Y{constructor(e,t){var a;if(this.accessTokenValue=null,this.apiKey=null,this.channels=[],this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=1e4,this.transport=null,this.heartbeatIntervalMs=z.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=W,this.ref=0,this.reconnectTimer=null,this.logger=W,this.conn=null,this.sendBuffer=[],this.serializer=new R,this.stateChangeCallbacks={open:[],close:[],error:[],message:[]},this.accessToken=null,this._connectionState="disconnected",this._wasManualDisconnect=!1,this._authPromise=null,this._resolveFetch=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)).catch(e=>{throw Error(`Failed to load @supabase/node-fetch: ${e.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):fetch),(...e)=>t(...e)},!(null==(a=null==t?void 0:t.params)?void 0:a.apikey))throw Error("API key is required to connect to Realtime");this.apiKey=t.params.apikey,this.endPoint=`${e}/${o.websocket}`,this.httpEndpoint=B(e),this._initializeOptions(t),this._setupReconnectionTimer(),this.fetch=this._resolveFetch(null==t?void 0:t.fetch)}connect(){if(!(this.isConnecting()||this.isDisconnecting()||null!==this.conn&&this.isConnected())){if(this._setConnectionState("connecting"),this._setAuthSafely("connect"),this.transport)this.conn=new this.transport(this.endpointURL());else try{this.conn=C.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");let e=t.message;if(e.includes("Node.js"))throw Error(`${e} 9 10To use Realtime in Node.js, you need to provide a WebSocket implementation: 11 12Option 1: Use Node.js 22+ which has native WebSocket support 13Option 2: Install and provide the "ws" package: 14 15 npm install ws 16 17 import ws from "ws" 18 const client = new RealtimeClient(url, { 19 ...options, 20 transport: ws 21 })`);throw Error(`WebSocket not available: ${e}`)}this._setupConnectionHandlers()}}endpointURL(){return this._appendParams(this.endPoint,Object.assign({},this.params,{vsn:"1.0.0"}))}disconnect(e,t){if(!this.isDisconnecting())if(this._setConnectionState("disconnecting",!0),this.conn){let r=setTimeout(()=>{this._setConnectionState("disconnected")},100);this.conn.onclose=()=>{clearTimeout(r),this._setConnectionState("disconnected")},e?this.conn.close(e,null!=t?t:""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(e){let t=await e.unsubscribe();return 0===this.channels.length&&this.disconnect(),t}async removeAllChannels(){let e=await Promise.all(this.channels.map(e=>e.unsubscribe()));return this.channels=[],this.disconnect(),e}log(e,t,r){this.logger(e,t,r)}connectionState(){switch(this.conn&&this.conn.readyState){case n.connecting:return l.Connecting;case n.open:return l.Open;case n.closing:return l.Closing;default:return l.Closed}}isConnected(){return this.connectionState()===l.Open}isConnecting(){return"connecting"===this._connectionState}isDisconnecting(){return"disconnecting"===this._connectionState}channel(e,t={config:{}}){let r=`realtime:${e}`,a=this.getChannels().find(e=>e.topic===r);if(a)return a;{let r=new H(`realtime:${e}`,t,this);return this.channels.push(r),r}}push(e){let{topic:t,event:r,payload:a,ref:n}=e,s=()=>{this.encode(e,e=>{var t;null==(t=this.conn)||t.send(e)})};this.log("push",`${t} ${r} (${n})`,a),this.isConnected()?s():this.sendBuffer.push(s)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(e){this.log("error","error in heartbeat callback",e)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(e){this.log("error","error in heartbeat callback",e)}this._wasManualDisconnect=!1,null==(e=this.conn)||e.close(1e3,"heartbeat timeout"),setTimeout(()=>{var e;this.isConnected()||null==(e=this.reconnectTimer)||e.scheduleTimeout()},z.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(e){this.log("error","error in heartbeat callback",e)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>
210&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let t=this.channels.find(t=>t.topic===e&&(t._isJoined()||t._isJoining()));t&&(this.log("transport",`leaving duplicate topic "${e}"`),t.unsubscribe())}_remove(e){this.channels=this.channels.filter(t=>t.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,e=>{if("phoenix"===e.topic&&"phx_reply"===e.event)try{this.heartbeatCallback("ok"===e.payload.status?"ok":"error")}catch(e){this.log("error","error in heartbeat callback",e)}e.ref&&e.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);let{topic:t,event:r,payload:a,ref:n}=e,s=n?`(${n})`:"",i=a.status||"";this.log("receive",`${i} ${t} ${r} ${s}`.trim(),a),this.channels.filter(e=>e._isMember(t)).forEach(e=>e._trigger(r,a,n)),this._triggerStateCallbacks("message",e)})}_clearTimer(e){var t;"heartbeat"===e&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):"reconnect"===e&&(null==(t=this.reconnectTimer)||t.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");let e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=e=>{this.log("worker","worker error",e.message),this.workerRef.terminate()},this.workerRef.onmessage=e=>{"keepAlive"===e.data.event&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var t;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||null==(t=this.reconnectTimer)||t.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(i.error))}_appendParams(e,t){if(0===Object.keys(t).length)return e;let r=e.match(/\?/)?"&":"?",a=new URLSearchParams(t);return`${e}${r}${a}`}_workerObjectUrl(e){let t;if(e)t=e;else{let e=new Blob([X],{type:"application/javascript"});t=URL.createObjectURL(e)}return t}_setConnectionState(e,t=!1){this._connectionState=e,"connecting"===e?this._wasManualDisconnect=!1:"disconnecting"===e&&(this._wasManualDisconnect=t)}async _performAuth(e=null){let t;t=e||(this.accessToken?await this.accessToken():this.accessTokenValue),this.accessTokenValue!=t&&(this.accessTokenValue=t,this.channels.forEach(e=>{t&&e.updateJoinPayload({access_token:t,version:"realtime-js/2.78.0"}),e.joinedOnce&&e._isJoined()&&e._push(i.access_token,{access_token:t})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(e="general"){this.setAuth().catch(t=>{this.log("error",`error setting auth in ${e}`,t)})}_triggerStateCallbacks(e,t){try{this.stateChangeCallbacks[e].forEach(r=>{try{r(t)}catch(t){this.log("error",`error in ${e} callback`,t)}})}catch(t){this.log("error",`error triggering ${e} callbacks`,t)}}_setupReconnectionTimer(){this.reconnectTimer=new $(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},z.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var t,r,a,n,s,i,o,l,u;if(this.transport=null!=(t=null==e?void 0:e.transport)?t:null,this.timeout=null!=(r=null==e?void 0:e.timeout)?r:1e4,this.heartbeatIntervalMs=null!=(a=null==e?void 0:e.heartbeatIntervalMs)?a:z.HEARTBEAT_INTERVAL,this.worker=null!=(n=null==e?void 0:e.worker)&&n,this.accessToken=null!=(s=null==e?void 0:e.accessToken)?s:null,this.heartbeatCallback=null!=(i=null==e?void 0:e.heartbeatCallback)?i:W,(null==e?void 0:e.params)&&(this.params=e.params),(null==e?void 0:e.logger)&&(this.logger=e.logger),((null==e?void 0:e.logLevel)||(null==e?void 0:e.log_level))&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=null!=(o=null==e?void 0:e.reconnectAfterMs)?o:e=>J[e-1]||1e4,this.encode=null!=(l=null==e?void 0:e.encode)?l:(e,t)=>
21t(JSON.stringify(e)),this.decode=null!=(u=null==e?void 0:e.decode)?u:this.serializer.decode.bind(this.serializer),this.worker){if("undefined"!=typeof window&&!window.Worker)throw Error("Web Worker is not supported");this.workerUrl=null==e?void 0:e.workerUrl}}}class Q extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Z(e){return"object"==typeof e&&null!==e&&"__isStorageError"in e}class ee extends Q{constructor(e,t,r){super(e),this.name="StorageApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class et extends Q{constructor(e,t){super(e),this.name="StorageUnknownError",this.originalError=t}}let er=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},ea=e=>{if(Array.isArray(e))return e.map(e=>ea(e));if("function"==typeof e||e!==Object(e))return e;let t={};return Object.entries(e).forEach(([e,r])=>{t[e.replace(/([-_][a-z])/gi,e=>e.toUpperCase().replace(/[-_]/g,""))]=ea(r)}),t},en=e=>{var t;return e.msg||e.message||e.error_description||("string"==typeof e.error?e.error:null==(t=e.error)?void 0:t.message)||JSON.stringify(e)};function es(e,t,a,n,s,i){return(0,f.__awaiter)(this,void 0,void 0,function*(){return new Promise((o,l)=>{e(a,((e,t,r,a)=>{let n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&a?((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(a)?(n.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n.body=JSON.stringify(a)):n.body=a,(null==t?void 0:t.duplex)&&(n.duplex=t.duplex),Object.assign(Object.assign({},n),r)):n})(t,n,s,i)).then(e=>{if(!e.ok)throw e;return(null==n?void 0:n.noResolveJson)?e:e.json()}).then(e=>o(e)).catch(e=>(0,f.__awaiter)(void 0,void 0,void 0,function*(){e instanceof(yield(0,f.__awaiter)(void 0,void 0,void 0,function*(){return"undefined"==typeof Response?(yield Promise.resolve().then(r.bind(r,93537))).Response:Response}))&&!(null==n?void 0:n.noResolveJson)?e.json().then(t=>{let r=e.status||500,a=(null==t?void 0:t.statusCode)||r+"";l(new ee(en(t),r,a))}).catch(e=>{l(new et(en(e),e))}):l(new et(en(e),e))}))})})}function ei(e,t,r,a){return(0,f.__awaiter)(this,void 0,void 0,function*(){return es(e,"GET",t,r,a)})}function eo(e,t,r,a,n){return(0,f.__awaiter)(this,void 0,void 0,function*(){return es(e,"POST",t,a,n,r)})}function el(e,t,r,a,n){return(0,f.__awaiter)(this,void 0,void 0,function*(){return es(e,"PUT",t,a,n,r)})}function eu(e,t,r,a,n){return(0,f.__awaiter)(this,void 0,void 0,function*(){return es(e,"DELETE",t,a,n,r)})}class ec{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t}then(e,t){return this.execute().then(e,t)}execute(){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}}class ed{constructor(e,t){this.downloadFn=e,this.shouldThrowOnError=t,this[y]="BlobDownloadBuilder",this.promise=null}asStream(){return new ec(this.downloadFn,this.shouldThrowOnError)}then(e,t){return this.getPromise().then(e,t)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let e=yield this.downloadFn();return{data:yield e.blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}}y=Symbol.toStringTag;var ep=r(81029).Buffer;let eh={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},ey={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class em{constructor(e,t={},r,a){this.shouldThrowOnError=!1,this.url=e,this.headers=t,this.bucketId=r,this.fetch=er(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,t,r,a){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let n,s=Object.assign(Object.assign({},ey),a),i=Object.assign(Object.assign({},this.headers),"POST"===e&&{"x-upsert":String(s.upsert)}),o=s.metadata;"undefined"!=typeof Blob&&r instanceof Blob?((n=new FormData).append("cacheControl",s.cacheControl),o&&n.append("metadata",this.encodeMetadata(o)),n.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?((n=r).append("cacheControl",s.cacheControl),o&&n.append("metadata",this.encodeMetadata(o))):(n=r,i["cache-control"]=`max-age=${s.cacheControl}`,i["content-type"]=s.contentType,o&&(i["x-metadata"]=this.toBase64(this.encodeMetadata(o)))),(null==a?void 0:a.headers)&&(i=Object.assign(Object.assign({},i),a.headers));let l=this._removeEmptyFolders(t),u=this._getFinalPath(l),c=yield("PUT"==e?el:eo)(this.fetch,`${this.url}/object/${u}`,n,Object.assign({headers:i},(null==s?void 0:s.duplex)?{duplex:s.duplex}:{}));return{data:{path:l,id:c.Id,fullPath:c.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}upload(e,t,r){return(0,f.__awaiter)(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,t,r)})}uploadToSignedUrl(e,t,r,a){return(0,f.__awaiter)(this,void 0,void 0,function*(){let n=this._removeEmptyFolders(e),s=this._getFinalPath(n),i=new URL(this.url+`/object/upload/sign/${s}`);i.searchParams.set("token",t);try{let e,t=Object.assign({upsert:ey.upsert},a),s=Object.assign(Object.assign({},this.headers),{"x-upsert":String(t.upsert)});"undefined"!=typeof Blob&&r instanceof Blob?((e=new FormData).append("cacheControl",t.cacheControl),e.append("",r)):"undefined"!=typeof FormData&&r instanceof FormData?(e=r).append("cacheControl",t.cacheControl):(e=r,s["cache-control"]=`max-age=${t.cacheControl}`,s["content-type"]=t.contentType);let o=yield el(this.fetch,i.toString(),e,{headers:s});return{data:{path:n,fullPath:o.Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}createSignedUploadUrl(e,t){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let r=this._getFinalPath(e),a=Object.assign({},this.headers);(null==t?void 0:t.upsert)&&(a["x-upsert"]="true");let n=yield eo(this.fetch,`${this.url}/object/upload/sign/${r}`,{},{headers:a}),s=new URL(this.url+n.url),i=s.searchParams.get("token");if(!i)throw new Q("No token returned by API");return{data:{signedUrl:s.toString(),path:e,token:i},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}update(e,t,r){return(0,f.__awaiter)(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,t,r)})}move(e,t,r){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eo(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,de
21stinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}copy(e,t,r){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:{path:(yield eo(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:e,destinationKey:t,destinationBucket:null==r?void 0:r.destinationBucket},{headers:this.headers})).Key},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}createSignedUrl(e,t,r){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let a=this._getFinalPath(e),n=yield eo(this.fetch,`${this.url}/object/sign/${a}`,Object.assign({expiresIn:t},(null==r?void 0:r.transform)?{transform:r.transform}:{}),{headers:this.headers}),s=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:n={signedUrl:encodeURI(`${this.url}${n.signedURL}${s}`)},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}createSignedUrls(e,t,r){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let a=yield eo(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:t,paths:e},{headers:this.headers}),n=(null==r?void 0:r.download)?`&download=${!0===r.download?"":r.download}`:"";return{data:a.map(e=>Object.assign(Object.assign({},e),{signedUrl:e.signedURL?encodeURI(`${this.url}${e.signedURL}${n}`):null})),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}download(e,t){let r=void 0!==(null==t?void 0:t.transform)?"render/image/authenticated":"object",a=this.transformOptsToQueryString((null==t?void 0:t.transform)||{}),n=a?`?${a}`:"",s=this._getFinalPath(e);return new ed(()=>ei(this.fetch,`${this.url}/${r}/${s}${n}`,{headers:this.headers,noResolveJson:!0}),this.shouldThrowOnError)}info(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{let e=yield ei(this.fetch,`${this.url}/object/info/${t}`,{headers:this.headers});return{data:ea(e),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}exists(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){let t=this._getFinalPath(e);try{return yield function(e,t,r,a){return(0,f.__awaiter)(this,void 0,void 0,function*(){return es(e,"HEAD",t,Object.assign(Object.assign({},r),{noResolveJson:!0}),void 0)})}(this.fetch,`${this.url}/object/${t}`,{headers:this.headers}),{data:!0,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e)&&e instanceof et){let t=e.originalError;if([400,404].includes(null==t?void 0:t.status))return{data:!1,error:e}}throw e}})}getPublicUrl(e,t){let r=this._getFinalPath(e),a=[],n=(null==t?void 0:t.download)?`download=${!0===t.download?"":t.download}`:"";""!==n&&a.push(n);let s=void 0!==(null==t?void 0:t.transform),i=this.transformOptsToQueryString((null==t?void 0:t.transform)||{});""!==i&&a.push(i);let o=a.join("&");return""!==o&&(o=`?${o}`),{data:{publicUrl:encodeURI(`${this.url}/${s?"render/image":"object"}/public/${r}${o}`)}}}remove(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eu(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}list(e,t,r){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let a=Object.assign(Object.assign(Object.assign({},eh),t),{prefix:e||""});return{data:yield eo(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},r),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}listV2(e,t){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let r=Object.assign({},e);return{data:yield eo(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,r,{headers:this.headers},t),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}encodeMetadata(e){return JSON.stringify(e)}toBase64(e){return void 0!==ep?ep.from(e).toString("base64"):btoa(e)}_getFinalPath(e){return`${this.bucketId}/${e.replace(/^\/+/,"")}`}_removeEmptyFolders(e){return e.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(e){let t=[];return e.width&&t.push(`width=${e.width}`),e.height&&t.push(`height=${e.height}`),e.resize&&t.push(`resize=${e.resize}`),e.format&&t.push(`format=${e.format}`),e.quality&&t.push(`quality=${e.quality}`),t.join("&")}}let ef="2.78.0",eg={"X-Client-Info":`storage-js/${ef}`};class eb{constructor(e,t={},r,a){this.shouldThrowOnError=!1;let n=new URL(e);(null==a?void 0:a.useNewHostname)&&/supabase\.(co|in|red)$/.test(n.hostname)&&!n.hostname.includes("storage.supabase.")&&(n.hostname=n.hostname.replace("supabase.","storage.supabase.")),this.url=n.href.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},eg),t),this.fetch=er(r)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let t=this.listBucketOptionsToQueryString(e);return{data:yield ei(this.fetch,`${this.url}/bucket${t}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}getBucket(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield ei(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}createBucket(e){return(0,f.__awaiter)(this,arguments,void 0,function*(e,t={public:!1}){try{return{data:yield eo(this.fetch,`${this.url}/bucket`,{id:e,name:e,type:t.type,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}updateBucket(e,t){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield el(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:t.public,file_size_limit:t.fileSizeLimit,allowed_mime_types:t.allowedMimeTypes},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}emptyBucket(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eo(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}deleteBucket(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eu(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}listBucketOptionsToQueryString(e){let t={};return e&&("limit"in e&&(t.limit=String(e.limit)),"offset"in e&&(t.offset=String(e.offset)),e.search&&(t.search=e.search),e.sortColumn&&(t.sortColumn=e.sortColumn),e.sortOrder&&(t.sortOrder=e.sortOrder)),Object.keys(t).length>0?"?"+new URLSearchParams(t).toString():""}}class ew{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},eg),t),this.fetch=er(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eo(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}listBuckets(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{let t=new URLSearchParams;(null==e?void 0:e.limit)!==void 0&&t.set("limit",e.limit.toString()),(null==e?void 0:e.offset)!==void 0&&t.set("offset",e.offset.toString()),(null==e?void 0:e.sortColumn)&&t.set("sortColumn",e.sortColumn),(null==e?void 0:e.sortOrder)&&t.set("sortOrder",e.sortOrder),(null==e?void 0:e.search)&&t.set("search",e.search);let r=t.toString(),a=r?`${this.url}/bucket?${r}`:`${this.url}/bucket`;return{data:yield ei(this.fetch,a,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}deleteBucket(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eu(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Z(e))return{data:null,error:e};throw e}})}}let ev={"X-Client-Info":`storage-js/${ef}`,"Content-Type":"application/json"};
21class eT extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function e_(e){return"object"==typeof e&&null!==e&&"__isStorageVectorsError"in e}class eE extends eT{constructor(e,t,r){super(e),this.name="StorageVectorsApiError",this.status=t,this.statusCode=r}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class eO extends eT{constructor(e,t){super(e),this.name="StorageVectorsUnknownError",this.originalError=t}}!function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"}(m||(m={}));let ex=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},eS=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e);function eI(e,t,r,a,n){return(0,f.__awaiter)(this,void 0,void 0,function*(){return function(e,t,r,a,n,s){return(0,f.__awaiter)(this,void 0,void 0,function*(){return new Promise((i,o)=>{e(r,((e,t,r,a)=>{let n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"!==e&&a?((e=>{if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)})(a)?(n.headers=Object.assign({"Content-Type":"application/json"},null==t?void 0:t.headers),n.body=JSON.stringify(a)):n.body=a,Object.assign(Object.assign({},n),r)):n})(t,a,n,s)).then(e=>{if(!e.ok)throw e;if(null==a?void 0:a.noResolveJson)return e;let t=e.headers.get("content-type");return t&&t.includes("application/json")?e.json():{}}).then(e=>i(e)).catch(e=>(0,f.__awaiter)(void 0,void 0,void 0,function*(){if(!(e&&"object"==typeof e&&"status"in e&&"ok"in e&&"number"==typeof e.status)||(null==a?void 0:a.noResolveJson))o(new eO(eS(e),e));else{let t=e.status||500;"function"==typeof e.json?e.json().then(e=>{let r=(null==e?void 0:e.statusCode)||(null==e?void 0:e.code)||t+"";o(new eE(eS(e),t,r))}).catch(()=>{o(new eE(e.statusText||`HTTP ${t} error`,t,t+""))}):o(new eE(e.statusText||`HTTP ${t} error`,t,t+""))}}))})})}(e,"POST",t,a,n,r)})}class eP{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ev),t),this.fetch=ex(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield eI(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}getIndex(e,t){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eI(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}listIndexes(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eI(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}deleteIndex(e,t){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield eI(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:t},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}}class ek{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ev),t),this.fetch=ex(r)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw Error("Vector batch size must be between 1 and 500 items");return{data:(yield eI(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}getVectors(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eI(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}listVectors(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{if(void 0!==e.segmentCount){if(e.segmentCount<1||e.segmentCount>16)throw Error("segmentCount must be between 1 and 16");
21if(void 0!==e.segmentIndex&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield eI(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}queryVectors(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eI(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}deleteVectors(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw Error("Keys batch size must be between 1 and 500 items");return{data:(yield eI(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}}class eA{constructor(e,t={},r){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},ev),t),this.fetch=ex(r)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield eI(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}getBucket(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:yield eI(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}listBuckets(){return(0,f.__awaiter)(this,arguments,void 0,function*(e={}){try{return{data:yield eI(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}deleteBucket(e){return(0,f.__awaiter)(this,void 0,void 0,function*(){try{return{data:(yield eI(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(e_(e))return{data:null,error:e};throw e}})}}class eC extends eA{constructor(e,t={}){super(e,t.headers||{},t.fetch)}from(e){return new eR(this.url,this.headers,e,this.fetch)}}class eR extends eP{constructor(e,t,r,a){super(e,t,a),this.vectorBucketName=r}createIndex(e){let t=Object.create(null,{createIndex:{get:()=>super.createIndex}});return(0,f.__awaiter)(this,void 0,void 0,function*(){return t.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){let e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return(0,f.__awaiter)(this,arguments,void 0,function*(t={}){return e.listIndexes.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){let t=Object.create(null,{getIndex:{get:()=>super.getIndex}});return(0,f.__awaiter)(this,void 0,void 0,function*(){return t.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){let t=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return(0,f.__awaiter)(this,void 0,void 0,function*(){return t.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new e$(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}class e$ extends ek{constructor(e,t,r,a,n){super(e,t,n),this.vectorBucketName=r,this.indexName=a}putVectors(e){let t=Object.create(null,{putVectors:{get:()=>super.putVectors}});return(0,f.__awaiter)(this,void 0,void 0,function*(){return t.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){let t=Object.create(null,{getVectors:{get:()=>super.getVectors}});return(0,f.__awaiter)(this,void 0,void 0,function*(){return t.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){let e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return(0,f.__awaiter)(this,arguments,void 0,function*(t={}){return e.listVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){let t=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return(0,f.__awaiter)(this,void 0,void 0,function*(){return t.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){let t=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return(0,f.__awaiter)(this,void 0,void 0,function*(){return t.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class ej extends eb{constructor(e,t={},r,a){super(e,t,r,a)}from(e){return new em(this.url,this.headers,e,this.fetch)}get vectors(){return new eC(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new ew(this.url+"/iceberg",this.headers,this.fetch)}}let eD="";eD="undefined"!=typeof Deno?"deno":"undefined"!=typeof document?"web":"undefined"!=typeof navigator&&"ReactNative"===navigator.product?"react-native":"node";let eL={headers:{"X-Client-Info":`supabase-js-${eD}/2.78.0`}},eN={schema:"public"},eU={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},eM={};var eG=r(93537);let eF="2.78.0",eV={"X-Client-Info":`gotrue-js/${eF}`},eB="X-Supabase-Api-Version",eK={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},eq=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
21class eH extends Error{constructor(e,t,r){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=t,this.code=r}}function eW(e){return"object"==typeof e&&null!==e&&"__isAuthError"in e}class ez extends eH{constructor(e,t,r){super(e,t,r),this.name="AuthApiError",this.status=t,this.code=r}}class eJ extends eH{constructor(e,t){super(e),this.name="AuthUnknownError",this.originalError=t}}class eX extends eH{constructor(e,t,r,a){super(e,r,a),this.name=t,this.status=r}}class eY extends eX{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}class eQ extends eX{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class eZ extends eX{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class e0 extends eX{constructor(e,t=null){super(e,"AuthImplicitGrantRedirectError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class e2 extends eX{constructor(e,t=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=t}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class e1 extends eX{constructor(e,t){super(e,"AuthRetryableFetchError",t,void 0)}}function e5(e){return eW(e)&&"AuthRetryableFetchError"===e.name}class e6 extends eX{constructor(e,t,r){super(e,"AuthWeakPasswordError",t,"weak_password"),this.reasons=r}}class e3 extends eX{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}let e4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),e7=" \n\r=".split(""),e9=(()=>{let e=Array(128);for(let t=0;t<e.length;t+=1)e[t]=-1;for(let t=0;t<e7.length;t+=1)e[e7[t].charCodeAt(0)]=-2;for(let t=0;t<e4.length;t+=1)e[e4[t].charCodeAt(0)]=t;return e})();function e8(e,t,r){if(null!==e)for(t.queue=t.queue<<8|e,t.queuedBits+=8;t.queuedBits>=6;)r(e4[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6;else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;)r(e4[t.queue>>t.queuedBits-6&63]),t.queuedBits-=6}function te(e,t,r){let a=e9[e];if(a>-1)for(t.queue=t.queue<<6|a,t.queuedBits+=6;t.queuedBits>=8;)r(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else if(-2===a)return;else throw Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}function tt(e){let t=[],r=e=>{t.push(String.fromCodePoint(e))},a={utf8seq:0,codepoint:0},n={queue:0,queuedBits:0},s=e=>{!function(e,t,r){if(0===t.utf8seq){if(e<=127)return r(e);for(let r=1;r<6;r+=1)if((e>>7-r&1)==0){t.utf8seq=r;break}if(2===t.utf8seq)t.codepoint=31&e;else if(3===t.utf8seq)t.codepoint=15&e;else if(4===t.utf8seq)t.codepoint=7&e;else throw Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|63&e,t.utf8seq-=1,0===t.utf8seq&&r(t.codepoint)}}(e,a,r)};for(let t=0;t<e.length;t+=1)te(e.charCodeAt(t),n,s);return t.join("")}function tr(e){let t=[],r={queue:0,queuedBits:0},a=e=>{t.push(e)};for(let t=0;t<e.length;t+=1)te(e.charCodeAt(t),r,a);return new Uint8Array(t)}function ta(e){let t=[],r={queue:0,queuedBits:0},a=e=>{t.push(e)};return e.forEach(e=>e8(e,r,a)),e8(null,r,a),t.join("")}let tn=()=>"undefined"!=typeof window&&"undefined"!=typeof document,ts={tested:!1,writable:!1},ti=()=>{if(!tn())return!1;try{if("object"!=typeof globalThis.localStorage)return!1}catch(e){return!1}if(ts.tested)return ts.writable;let e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),ts.tested=!0,ts.writable=!0}catch(e){ts.tested=!0,ts.writable=!1}return ts.writable},to=e=>{let t;return t=e||("undefined"==typeof fetch?(...e)=>Promise.resolve().then(r.bind(r,93537)).then(({default:t})=>t(...e)):fetch),(...e)=>t(...e)},tl=async(e,t,r)=>{await e.setItem(t,JSON.stringify(r))},tu=async(e,t)=>{let r=await e.getItem(t);if(!r)return null;try{return JSON.parse(r)}catch(e){return r}},tc=async(e,t)=>{await e.removeItem(t)};class td{constructor(){this.promise=new td.promiseConstructor((e,t)=>{this.resolve=e,this.reject=t})}}function tp(e){let t=e.split(".");if(3!==t.length)throw new e3("Invalid JWT structure");for(let e=0;e<t.length;e++)if(!eq.test(t[e]))throw new e3("JWT not in base64url format");
21return{header:JSON.parse(tt(t[0])),payload:JSON.parse(tt(t[1])),signature:tr(t[2]),raw:{header:t[0],payload:t[1]}}}async function th(e){return await new Promise(t=>{setTimeout(()=>t(null),e)})}function ty(e){return("0"+e.toString(16)).substr(-2)}async function tm(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>String.fromCharCode(e)).join("")}async function tf(e){return"undefined"==typeof crypto||void 0===crypto.subtle||"undefined"==typeof TextEncoder?(console.warn("WebCrypto API is not supported. Code challenge method will default to use plain instead of sha256."),e):btoa(await tm(e)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function tg(e,t,r=!1){let a=function(){let e=new Uint32Array(56);if("undefined"==typeof crypto){let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-._~",t=e.length,r="";for(let a=0;a<56;a++)r+=e.charAt(Math.floor(Math.random()*t));return r}return crypto.getRandomValues(e),Array.from(e,ty).join("")}(),n=a;r&&(n+="/PASSWORD_RECOVERY"),await tl(e,`${t}-code-verifier`,n);let s=await tf(a),i=a===s?"plain":"s256";return[s,i]}td.promiseConstructor=Promise;let tb=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i,tw=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function tv(e){if(!tw.test(e))throw Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function tT(){return new Proxy({},{get:(e,t)=>{if("__isUserNotAvailableProxy"===t)return!0;if("symbol"==typeof t){let e=t.toString();if("Symbol(Symbol.toPrimitive)"===e||"Symbol(Symbol.toStringTag)"===e||"Symbol(util.inspect.custom)"===e)return}throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${t}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,t)=>{throw Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${t}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function t_(e){return JSON.parse(JSON.stringify(e))}let tE=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),tO=[502,503,504];async function tx(e){var t;let r,a;
21if(!("object"==typeof e&&null!==e&&"status"in e&&"ok"in e&&"json"in e&&"function"==typeof e.json))throw new e1(tE(e),0);if(tO.includes(e.status))throw new e1(tE(e),e.status);try{r=await e.json()}catch(e){throw new eJ(tE(e),e)}let n=function(e){let t=e.headers.get(eB);if(!t||!t.match(tb))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch(e){return null}}(e);if(n&&n.getTime()>=eK["2024-01-01"].timestamp&&"object"==typeof r&&r&&"string"==typeof r.code?a=r.code:"object"==typeof r&&r&&"string"==typeof r.error_code&&(a=r.error_code),a){if("weak_password"===a)throw new e6(tE(r),e.status,(null==(t=r.weak_password)?void 0:t.reasons)||[]);else if("session_not_found"===a)throw new eY}else if("object"==typeof r&&r&&"object"==typeof r.weak_password&&r.weak_password&&Array.isArray(r.weak_password.reasons)&&r.weak_password.reasons.length&&r.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0))throw new e6(tE(r),e.status,r.weak_password.reasons);throw new ez(tE(r),e.status||500,a)}async function tS(e,t,r,a){var n;let s=Object.assign({},null==a?void 0:a.headers);s[eB]||(s[eB]=eK["2024-01-01"].name),(null==a?void 0:a.jwt)&&(s.Authorization=`Bearer ${a.jwt}`);let i=null!=(n=null==a?void 0:a.query)?n:{};(null==a?void 0:a.redirectTo)&&(i.redirect_to=a.redirectTo);let o=Object.keys(i).length?"?"+new URLSearchParams(i).toString():"",l=await tI(e,t,r+o,{headers:s,noResolveJson:null==a?void 0:a.noResolveJson},{},null==a?void 0:a.body);return(null==a?void 0:a.xform)?null==a?void 0:a.xform(l):{data:Object.assign({},l),error:null}}async function tI(e,t,r,a,n,s){let i,o=((e,t,r,a)=>{let n={method:e,headers:(null==t?void 0:t.headers)||{}};return"GET"===e?n:(n.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},null==t?void 0:t.headers),n.body=JSON.stringify(a),Object.assign(Object.assign({},n),r))})(t,a,n,s);try{i=await e(r,Object.assign({},o))}catch(e){throw console.error(e),new e1(tE(e),0)}if(i.ok||await tx(i),null==a?void 0:a.noResolveJson)return i;try{return await i.json()}catch(e){await tx(e)}}function tP(e){var t,r,a;let n=null;(a=e).access_token&&a.refresh_token&&a.expires_in&&(n=Object.assign({},e),e.expires_at||(n.expires_at=(r=e.expires_in,Math.round(Date.now()/1e3)+r)));return{data:{session:n,user:null!=(t=e.user)?t:e},error:null}}function tk(e){let t=tP(e);return!t.error&&e.weak_password&&"object"==typeof e.weak_password&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&"string"==typeof e.weak_password.message&&e.weak_password.reasons.reduce((e,t)=>e&&"string"==typeof t,!0)&&(t.data.weak_password=e.weak_password),t}function tA(e){var t;return{data:{user:null!=(t=e.user)?t:e},error:null}}function tC(e){return{data:e,error:null}}function tR(e){let{action_link:t,email_otp:r,hashed_token:a,redirect_to:n,verification_type:s}=e;return{data:{properties:{action_link:t,email_otp:r,hashed_token:a,redirect_to:n,verification_type:s},user:Object.assign({},(0,f.__rest)(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]))},error:null}}function t$(e){return e}let tj=["global","local","others"];class tD{constructor({url:e="",headers:t={},fetch:r}){this.url=e,this.headers=t,this.fetch=to(r),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,t=tj[0]){if(0>tj.indexOf(t))throw Error(`@supabase/auth-js: Parameter scope must be one of ${tj.join(", ")}`);try{return await tS(this.fetch,"POST",`${this.url}/logout?scope=${t}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(e){if(eW(e))return{data:null,error:e};throw e}}async inviteUserByEmail(e,t={}){try{return await tS(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:t.data},headers:this.headers,redirectTo:t.redirectTo,xform:tA})}catch(e){if(eW(e))return{data:{user:null},error:e};throw e}}async generateLink(e){try{let{options:t}=e,r=(0,f.__rest)(e,["options"]),a=Object.assign(Object.assign({},r),t);return"newEmail"in r&&(a.new_email=null==r?void 0:r.newEmail,delete a.newEmail),await tS(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:tR,redirectTo:null==t?void 0:t.redirectTo})}catch(e){if(eW(e))return{data:{properties:null,user:null},error:e};throw e}}async createUser(e){try{return await tS(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:tA})}catch(e){if(eW(e))return{data:{user:null},error:e};throw e}}async listUsers(e){var t,r,a,n,s,i,o;try{let l={nextPage:null,lastPage:0,total:0},u=await tS(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(n=null==(a=null==e?void 0:e.perPage)?void 0:a.toString())?n:""},xform:t$});if(u.error)throw u.error;let c=await u.json(),d=null!=(s=u.headers.get("x-total-count"))?s:0,p=null!=(o=null==(i=u.headers.get("link"))?void 0:i.split(","))?o:[];return p.length>
210&&(p.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(d)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(eW(e))return{data:{users:[]},error:e};throw e}}async getUserById(e){tv(e);try{return await tS(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:tA})}catch(e){if(eW(e))return{data:{user:null},error:e};throw e}}async updateUserById(e,t){tv(e);try{return await tS(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:t,headers:this.headers,xform:tA})}catch(e){if(eW(e))return{data:{user:null},error:e};throw e}}async deleteUser(e,t=!1){tv(e);try{return await tS(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:t},xform:tA})}catch(e){if(eW(e))return{data:{user:null},error:e};throw e}}async _listFactors(e){tv(e.userId);try{let{data:t,error:r}=await tS(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:e=>({data:{factors:e},error:null})});return{data:t,error:r}}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _deleteFactor(e){tv(e.userId),tv(e.id);try{return{data:await tS(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _listOAuthClients(e){var t,r,a,n,s,i,o;try{let l={nextPage:null,lastPage:0,total:0},u=await tS(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:null!=(r=null==(t=null==e?void 0:e.page)?void 0:t.toString())?r:"",per_page:null!=(n=null==(a=null==e?void 0:e.perPage)?void 0:a.toString())?n:""},xform:t$});if(u.error)throw u.error;let c=await u.json(),d=null!=(s=u.headers.get("x-total-count"))?s:0,p=null!=(o=null==(i=u.headers.get("link"))?void 0:i.split(","))?o:[];return p.length>0&&(p.forEach(e=>{let t=parseInt(e.split(";")[0].split("=")[1].substring(0,1)),r=JSON.parse(e.split(";")[1].split("=")[1]);l[`${r}Page`]=t}),l.total=parseInt(d)),{data:Object.assign(Object.assign({},c),l),error:null}}catch(e){if(eW(e))return{data:{clients:[]},error:e};throw e}}async _createOAuthClient(e){try{return await tS(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _getOAuthClient(e){try{return await tS(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _updateOAuthClient(e,t){try{return await tS(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:t,headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _deleteOAuthClient(e){try{return await tS(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _regenerateOAuthClientSecret(e){try{return await tS(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:e=>({data:e,error:null})})}catch(e){if(eW(e))return{data:null,error:e};throw e}}}function tL(e={}){return{getItem:t=>e[t]||null,setItem:(t,r)=>{e[t]=r},removeItem:t=>{delete e[t]}}}let tN={debug:!!(globalThis&&ti()&&globalThis.localStorage&&"true"===globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug"))};class tU extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class tM extends tU{}async function tG(e,t,r){tN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);let a=new globalThis.AbortController;return t>0&&setTimeout(()=>{a.abort(),tN.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,0===t?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:a.signal},async a=>{if(a){tN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await r()}finally{tN.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}if(0===t)throw tN.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new tM(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(tN.debug)try{let e=await globalThis.navigator.locks.query();console.log("@supabase/gotrue-js: Navigator LockManager state",JSON.stringify(e,null," "))}catch(e){console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state",e)}return console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request"),await r()}))}function tF(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw Error(`@supabase/auth-js: Address "${e}
21" is invalid.`);return e.toLowerCase()}class tV extends Error{constructor({message:e,code:t,cause:r,name:a}){var n;super(e,{cause:r}),this.__isWebAuthnError=!0,this.name=null!=(n=null!=a?a:r instanceof Error?r.name:void 0)?n:"Unknown Error",this.code=t}}class tB extends tV{constructor(e,t){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t,message:e}),this.name="WebAuthnUnknownError",this.originalError=t}}class tK{createNewAbortSignal(){if(this.controller){let e=Error("Cancelling existing WebAuthn API call for new one");e.name="AbortError",this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error("Manually cancelling existing WebAuthn API call");e.name="AbortError",this.controller.abort(e),this.controller=void 0}}}let tq=new tK;function tH(e){return"localhost"===e||/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}$/i.test(e)}function tW(){var e,t;return!!(tn()&&"PublicKeyCredential"in window&&window.PublicKeyCredential&&"credentials"in navigator&&"function"==typeof(null==(e=null==navigator?void 0:navigator.credentials)?void 0:e.create)&&"function"==typeof(null==(t=null==navigator?void 0:navigator.credentials)?void 0:t.get))}async function tz(e){try{let t=await navigator.credentials.create(e);if(!t)return{data:null,error:new tB("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new tB("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){var r,a,n;let{publicKey:s}=t;if(!s)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new tV({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("ConstraintError"===e.name){if((null==(r=s.authenticatorSelection)?void 0:r.requireResidentKey)===!0)return new tV({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});else if("conditional"===t.mediation&&(null==(a=s.authenticatorSelection)?void 0:a.userVerification)==="required")return new tV({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});else if((null==(n=s.authenticatorSelection)?void 0:n.userVerification)==="required")return new tV({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else if("InvalidStateError"===e.name)return new tV({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});else if("NotAllowedError"===e.name)return new tV({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("NotSupportedError"===e.name)return new tV(0===s.pubKeyCredParams.filter(e=>"public-key"===e.type).length?{message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}:{message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!tH(t))return new tV({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(s.rp.id!==t)return new tV({message:`The RP ID "${s.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("TypeError"===e.name){if(s.user.id.byteLength<1||s.user.id.byteLength>64)return new tV({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if("UnknownError"===e.name)return new tV({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new tV({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}
21({error:t,options:e})}}}async function tJ(e){try{let t=await navigator.credentials.get(e);if(!t)return{data:null,error:new tB("Empty credential response",t)};if(!(t instanceof PublicKeyCredential))return{data:null,error:new tB("Browser returned unexpected credential type",t)};return{data:t,error:null}}catch(t){return{data:null,error:function({error:e,options:t}){let{publicKey:r}=t;if(!r)throw Error("options was missing required publicKey property");if("AbortError"===e.name){if(t.signal instanceof AbortSignal)return new tV({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if("NotAllowedError"===e.name)return new tV({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});else if("SecurityError"===e.name){let t=window.location.hostname;if(!tH(t))return new tV({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e});if(r.rpId!==t)return new tV({message:`The RP ID "${r.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else if("UnknownError"===e.name)return new tV({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e});return new tV({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}({error:t,options:e})}}}let tX={hints:["security-key"],authenticatorSelection:{authenticatorAttachment:"cross-platform",requireResidentKey:!1,userVerification:"preferred",residentKey:"discouraged"},attestation:"none"},tY={userVerification:"preferred",hints:["security-key"]};function tQ(...e){let t=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),r=e=>e instanceof ArrayBuffer||ArrayBuffer.isView(e),a={};for(let n of e)if(n)for(let e in n){let s=n[e];if(void 0!==s)if(Array.isArray(s))a[e]=s;else if(r(s))a[e]=s;else if(t(s)){let r=a[e];t(r)?a[e]=tQ(r,s):a[e]=tQ(s)}else a[e]=s}return a}class tZ{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:t,friendlyName:r,signal:a},n){try{var s,i,o,l;let{data:u,error:c}=await this.client.mfa.challenge({factorId:e,webauthn:t});if(!u)return{data:null,error:c};let d=null!=a?a:tq.createNewAbortSignal();if("create"===u.webauthn.type){let{user:e}=u.webauthn.credential_options.publicKey;e.name||(e.name=`${e.id}:${r}`),e.displayName||(e.displayName=e.name)}switch(u.webauthn.type){case"create":{let t=(s=u.webauthn.credential_options.publicKey,i=null==n?void 0:n.create,tQ(tX,s,i||{})),{data:r,error:a}=await tz({publicKey:t,signal:d});if(r)return{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:r}},error:null};return{data:null,error:a}}case"request":{let t=(o=u.webauthn.credential_options.publicKey,l=null==n?void 0:n.request,tQ(tY,o,l||{})),{data:r,error:a}=await tJ(Object.assign(Object.assign({},u.webauthn.credential_options),{publicKey:t,signal:d}));if(r)return{data:{factorId:e,challengeId:u.id,webauthn:{type:u.webauthn.type,credential_response:r}},error:null};return{data:null,error:a}}}}catch(e){if(eW(e))return{data:null,error:e};return{data:null,error:new eJ("Unexpected error in challenge",e)}}}async _verify({challengeId:e,factorId:t,webauthn:r}){return this.client.mfa.verify({factorId:t,challengeId:e,webauthn:r})}async _authenticate({factorId:e,webauthn:{rpId:t="undefined"!=typeof window?window.location.hostname:void 0,rpOrigins:r="undefined"!=typeof window?[window.location.origin]:void 0,signal:a}},n){if(!t)return{data:null,error:new eH("rpId is required for WebAuthn authentication")};try{if(!tW())return{data:null,error:new eJ("Browser does not support WebAuthn",null)};let{data:s,error:i}=await this.challenge({factorId:e,webauthn:{rpId:t,rpOrigins:r},signal:a},{request:n});if(!s)return{data:null,error:i};let{webauthn:o}=s;return this._verify({factorId:e,challengeId:s.challengeId,webauthn:{type:o.type,rpId:t,rpOrigins:r,credential_response:o.credential_response}})}catch(e){if(eW(e))return{data:null,error:e};return{data:null,error:new eJ("Unexpected error in authenticate",e)}}}async _register({friendlyName:e,rpId:t="undefined"!=typeof window?window.location.hostname:void 0,rpOrigins:r="undefined"!=typeof window?[window.location.origin]:void 0,signal:a},n){if(!t)return{data:null,error:new eH("rpId is required for WebAuthn registration")};try{if(!tW())return{data:null,error:new eJ("Browser does not support WebAuthn",null)};let{data:s,error:i}=await this._enroll({friendlyName:e});if(!s)return await this.client.mfa.listFactors().then(t=>{var r;return null==(r=t.data)?void 0:r.all.find(t=>"webauthn"===t.factor_type&&t.friendly_name===e&&"unverified"!==t.status)}).then(e=>e?this.client.mfa.unenroll({factorId:null==e?void 0:e.id}):void 0),{data:null,error:i};let{data:o,error:l}=await this._challenge({factorId:s.id,friendlyName:s.friendly_name,webauthn:{rpId:t,rpOrigins:r},signal:a},{create:n});if(!o)return{data:null,error:l};return this._verify({factorId:s.id,challengeId:o.challengeId,webauthn:{rpId:t,rpOrigins:r,type:o.webauthn.type,credential_response:o.webauthn.credential_response}})}catch(e){if(eW(e))return{data:null,error:e};return{data:null,error:new eJ("Unexpected error in register",e)}}}}if("object"!=typeof globalThis)try{Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__}catch(e){"undefined"!=typeof self&&(self.globalThis=self)}let t0={url:"http://localhost:9999",storageKey:"supabase.auth.token",autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:eV,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function t2(e,t,r){return await r()}let t1={};class t5{get jwks(){var e,t;return null!=(t=null==(e=t1[this.storageKey])?void 0:e.jwks)?t:{keys:[]}}set jwks(e){t1[this.storageKey]=Object.assign(Object.assign({},t1[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,t;return null!=(t=null==(e=t1[this.storageKey])?void 0:e.cachedAt)?t:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){t1[this.storageKey]=Object.assign(Object.assign({},t1[this.storageKey]),{cachedAt:e})}constructor(e){var t,r;this.userStorage=null,this.memoryStorage=null,this.stateChangeEmitters=new Map,this.autoRefreshTicker=null,this.visibilityChangedCallback=null,this.refreshingDeferred=null,this.initializePromise=null,this.detectSessionInUrl=!0,this.hasCustomAuthorizationHeader=!1,this.suppressGetSessionWarning=!1,this.lockAcquired=!1,this.pendingInLock=[],this.broadcastChannel=null,this.logger=console.log,this.instanceID=t5.nextInstanceID,t5.nextInstanceID+=1,this.instanceID>0&&tn()&&console.warn("Multiple GoTrueClient instances detected in the same browser context. It is not an error, but this should be avoided as it may produce undefined behavior when used concurrently under the same storage key.");let a=Object.assign(Object.assign({},t0),e);
21if(this.logDebugMessages=!!a.debug,"function"==typeof a.debug&&(this.logger=a.debug),this.persistSession=a.persistSession,this.storageKey=a.storageKey,this.autoRefreshToken=a.autoRefreshToken,this.admin=new tD({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=to(a.fetch),this.lock=a.lock||t2,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,a.lock?this.lock=a.lock:tn()&&(null==(t=null==globalThis?void 0:globalThis.navigator)?void 0:t.locks)?this.lock=tG:this.lock=t2,this.jwks||(this.jwks={keys:[]},this.jwks_cached_at=Number.MIN_SAFE_INTEGER),this.mfa={verify:this._verify.bind(this),enroll:this._enroll.bind(this),unenroll:this._unenroll.bind(this),challenge:this._challenge.bind(this),listFactors:this._listFactors.bind(this),challengeAndVerify:this._challengeAndVerify.bind(this),getAuthenticatorAssuranceLevel:this._getAuthenticatorAssuranceLevel.bind(this),webauthn:new tZ(this)},this.oauth={getAuthorizationDetails:this._getAuthorizationDetails.bind(this),approveAuthorization:this._approveAuthorization.bind(this),denyAuthorization:this._denyAuthorization.bind(this)},this.persistSession?(a.storage?this.storage=a.storage:ti()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=tL(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=tL(this.memoryStorage)),tn()&&globalThis.BroadcastChannel&&this.persistSession&&this.storageKey){try{this.broadcastChannel=new globalThis.BroadcastChannel(this.storageKey)}catch(e){console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available",e)}null==(r=this.broadcastChannel)||r.addEventListener("message",async e=>{this._debug("received broadcast notification from other tab or client",e),await this._notifyAllSubscribers(e.data.event,e.data.session,!1)})}this.initialize()}_debug(...e){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${eF}) ${new Date().toISOString()}`,...e),this}async initialize(){return this.initializePromise||(this.initializePromise=(async()=>await this._acquireLock(-1,async()=>await this._initialize()))()),await this.initializePromise}async _initialize(){var e;try{let t=function(e){let t={},r=new URL(e);if(r.hash&&"#"===r.hash[0])try{new URLSearchParams(r.hash.substring(1)).forEach((e,r)=>{t[r]=e})}catch(e){}return r.searchParams.forEach((e,r)=>{t[r]=e}),t}(window.location.href),r="none";if(this._isImplicitGrantCallback(t)?r="implicit":await this._isPKCECallback(t)&&(r="pkce"),tn()&&this.detectSessionInUrl&&"none"!==r){let{data:a,error:n}=await this._getSessionFromURL(t,r);if(n){if(this._debug("#_initialize()","error detecting session from URL",n),eW(n)&&"AuthImplicitGrantRedirectError"===n.name){let t=null==(e=n.details)?void 0:e.code;if("identity_already_exists"===t||"identity_not_found"===t||"single_identity_not_deletable"===t)return{error:n}}return await this._removeSession(),{error:n}}let{session:s,redirectType:i}=a;return this._debug("#_initialize()","detected session in URL",s,"redirect type",i),await this._saveSession(s),setTimeout(async()=>{"recovery"===i?await this._notifyAllSubscribers("PASSWORD_RECOVERY",s):await this._notifyAllSubscribers("SIGNED_IN",s)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(e){if(eW(e))return{error:e};return{error:new eJ("Unexpected error during initialization",e)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var t,r,a;try{let{data:n,error:s}=await tS(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:null!=(r=null==(t=null==e?void 0:e.options)?void 0:t.data)?r:{},gotrue_meta_security:{captcha_token:null==(a=null==e?void 0:e.options)?void 0:a.captchaToken}},xform:tP});if(s||!n)return{data:{user:null,session:null},error:s};let i=n.session,o=n.user;return n.session&&(await this._saveSession(n.session),await this._notifyAllSubscribers("SIGNED_IN",i)),{data:{user:o,session:i},error:null}}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async signUp(e){var t,r,a;try{let n;if("email"in e){let{email:r,password:a,options:s}=e,i=null,o=null;"pkce"===this.flowType&&([i,o]=await tg(this.storage,this.storageKey)),n=await tS(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:null==s?void 0:s.emailRedirectTo,body:{email:r,password:a,data:null!=(t=null==s?void 0:s.data)?t:{},gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken},code_challenge:i,code_challenge_method:o},xform:tP})}else if("phone"in e){let{phone:t,password:s,options:i}=e;n=await tS(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:t,password:s,data:null!=(r=null==i?void 0:i.data)?r:{},channel:null!=(a=null==i?void 0:i.channel)?a:"sms",gotrue_meta_security:{captcha_token:null==i?void 0:i.captchaToken}},xform:tP})}else throw new eZ("You must provide either an email or phone number and a password");let{data:s,error:i}=n;if(i||!s)return{data:{user:null,session:null},error:i};let o=s.session,l=s.user;return s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithPassword(e){try{let t;if("email"in e){let{email:r,password:a,options:n}=e;t=await tS(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:r,password:a,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:tk})}else if("phone"in e){let{phone:r,password:a,options:n}=e;t=await tS(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:r,password:a,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},xform:tk})}else throw new eZ("You must provide either an email or phone number and a password");let{data:r,error:a}=t;if(a)return{data:{user:null,session:null},error:a};if(!r||!r.session||!r.user)return{data:{user:null,session:null},error:new eQ};return r.session&&(await this._saveSession(r.session),await this._notifyAllSubscribers("SIGNED_IN",r.session)),{data:Object.assign({user:r.user,session:r.session},r.weak_password?{weakPassword:r.weak_password}:null),error:a}}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOAuth(e){var t,r,a,n;return await this._handleProviderSignIn(e.provider,{redirectTo:null==(t=e.options)?void 0:t.redirectTo,scopes:null==(r=e.options)?void 0:r.scopes,queryParams:null==(a=e.options)?void 0:a.queryParams,skipBrowserRedirect:null==(n=e.options)?void 0:n.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){let{chain:t}=e;switch(t){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw Error(`@supabase/auth-js: Unsupported chain "${t}"`)}}async signInWithEthereum(e){var t,r,a,n,s,i,o,l,u,c,d,p;let h,y;if("message"in e)h=e.message,y=e.signature;else{let c,{chain:d,wallet:m,statement:f,options:g}=e;if(tn())if("object"==typeof m)c=m;else{let e=window;if("ethereum"in e&&"object"==typeof e.ethereum&&"request"in e.ethereum&&"function"==typeof e.ethereum.request)c=e.ethereum;else throw Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof m||!(null==g?void 0:g.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");c=m}let b=new URL(null!=(t=null==g?void 0:g.url)?t:window.location.href),w=await c.request({method:"eth_requestAccounts"}).then(e=>e).catch(()=>{throw Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!w||0===w.length)throw Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");let v=tF(w[0]),T=null==(r=null==g?void 0:g.signInWithEthereum)?void 0:r.chainId;T||(T=parseInt(await c.request({method:"eth_chainId"}),16)),h=function(e){var t;let{chainId:r,domain:a,expirationTime:n,issuedAt:s=new Date,nonce:i,notBefore:o,requestId:l,resources:u,scheme:c,uri:d,version:p}=e;if(!Number.isInteger(r))throw Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${r}`);if(!a)throw Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(i&&i.length<8)throw Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${i}`);if(!d)throw Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if("1"!==p)throw Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${p}`);
21if(null==(t=e.statement)?void 0:t.includes("\n"))throw Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`);let h=tF(e.address),y=c?`${c}://${a}`:a,m=e.statement?`${e.statement} 22`:"",f=`${y} wants you to sign in with your Ethereum account: 23${h} 24 25${m}`,g=`URI: ${d} 26Version: ${p} 27Chain ID: ${r}${i?` 28Nonce: ${i}`:""} 29Issued At: ${s.toISOString()}`;if(n&&(g+=` 30Expiration Time: ${n.toISOString()}`),o&&(g+=` 31Not Before: ${o.toISOString()}`),l&&(g+=` 32Request ID: ${l}`),u){let e="\nResources:";for(let t of u){if(!t||"string"!=typeof t)throw Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${t}`);e+=` 33- ${t}`}g+=e}return`${f} 34${g}`}({domain:b.host,address:v,statement:f,uri:b.href,version:"1",chainId:T,nonce:null==(a=null==g?void 0:g.signInWithEthereum)?void 0:a.nonce,issuedAt:null!=(s=null==(n=null==g?void 0:g.signInWithEthereum)?void 0:n.issuedAt)?s:new Date,expirationTime:null==(i=null==g?void 0:g.signInWithEthereum)?void 0:i.expirationTime,notBefore:null==(o=null==g?void 0:g.signInWithEthereum)?void 0:o.notBefore,requestId:null==(l=null==g?void 0:g.signInWithEthereum)?void 0:l.requestId,resources:null==(u=null==g?void 0:g.signInWithEthereum)?void 0:u.resources}),y=await c.request({method:"personal_sign",params:[(p=h,"0x"+Array.from(new TextEncoder().encode(p),e=>e.toString(16).padStart(2,"0")).join("")),v]})}try{let{data:t,error:r}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:h,signature:y},(null==(c=e.options)?void 0:c.captchaToken)?{gotrue_meta_security:{captcha_token:null==(d=e.options)?void 0:d.captchaToken}}:null),xform:tP});if(r)throw r;if(!t||!t.session||!t.user)return{data:{user:null,session:null},error:new eQ};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign({},t),error:r}}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSolana(e){var t,r,a,n,s,i,o,l,u,c,d,p;let h,y;if("message"in e)h=e.message,y=e.signature;else{let d,{chain:p,wallet:m,statement:f,options:g}=e;if(tn())if("object"==typeof m)d=m;else{let e=window;if("solana"in e&&"object"==typeof e.solana&&("signIn"in e.solana&&"function"==typeof e.solana.signIn||"signMessage"in e.solana&&"function"==typeof e.solana.signMessage))d=e.solana;else throw Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if("object"!=typeof m||!(null==g?void 0:g.url))throw Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");d=m}let b=new URL(null!=(t=null==g?void 0:g.url)?t:window.location.href);if("signIn"in d&&d.signIn){let e,t=await d.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},null==g?void 0:g.signInWithSolana),{version:"1",domain:b.host,uri:b.href}),f?{statement:f}:null));if(Array.isArray(t)&&t[0]&&"object"==typeof t[0])e=t[0];else if(t&&"object"==typeof t&&"signedMessage"in t&&"signature"in t)e=t;else throw Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in e&&"signature"in e&&("string"==typeof e.signedMessage||e.signedMessage instanceof Uint8Array)&&e.signature instanceof Uint8Array)h="string"==typeof e.signedMessage?e.signedMessage:new TextDecoder().decode(e.signedMessage),y=e.signature;else throw Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in d)||"function"!=typeof d.signMessage||!("publicKey"in d)||"object"!=typeof d||!d.publicKey||!("toBase58"in d.publicKey)||"function"!=typeof d.publicKey.toBase58)throw Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");h=[`${b.host} wants you to sign in with your Solana account:`,d.publicKey.toBase58(),...f?["",f,""]:[""],"Version: 1",`URI: ${b.href}`,`Issued At: ${null!=(a=null==(r=null==g?void 0:g.signInWithSolana)?void 0:r.issuedAt)?a:new Date().toISOString()}`,...(null==(n=null==g?void 0:g.signInWithSolana)?void 0:n.notBefore)?[`Not Before: ${g.signInWithSolana.notBefore}`]:[],...(null==(s=null==g?void 0:g.signInWithSolana)?void 0:s.expirationTime)?[`Expiration Time: ${g.signInWithSolana.expirationTime}`]:[],...(null==(i=null==g?void 0:g.signInWithSolana)?void 0:i.chainId)?[`Chain ID: ${g.signInWithSolana.chainId}`]:[],...(null==(o=null==g?void 0:g.signInWithSolana)?void 0:o.nonce)?[`Nonce: ${g.signInWithSolana.nonce}`]:[],...(null==(l=null==g?void 0:g.signInWithSolana)?void 0:l.requestId)?[`Request ID: ${g.signInWithSolana.requestId}`]:[],...(null==(c=null==(u=null==g?void 0:g.signInWithSolana)?void 0:u.resources)?void 0:c.length)?["Resources",...g.signInWithSolana.resources.map(e=>`- ${e}`)]:[]].join("\n");let e=await d.signMessage(new TextEncoder().encode(h),"utf8");if(!e||!(e instanceof Uint8Array))throw Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");y=e}}try{let{data:t,error:r}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:h,signature:ta(y)},(null==(d=e.options)?void 0:d.captchaToken)?{gotrue_meta_security:{captcha_token:null==(p=e.options)?void 0:p.captchaToken}}:null),xform:tP});if(r)throw r;if(!t||!t.session||!t.user)return{data:{user:null,session:null},error:new eQ};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign({},t),error:r}}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async _exchangeCodeForSession(e){let t=await tu(this.storage,`${this.storageKey}-code-verifier`),[r,a]=(null!=t?t:"").split("/");try{let{data:t,error:n}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:r},xform:tP});if(await tc(this.storage,`${this.storageKey}-code-verifier`),n)throw n;if(!t||!t.session||!t.user)return{data:{user:null,session:null,redirectType:null},error:new eQ};return t.session&&(await this._saveSession(t.session),await this._notifyAllSubscribers("SIGNED_IN",t.session)),{data:Object.assign(Object.assign({},t),{redirectType:null!=a?a:null}),error:n}}catch(e){if(eW(e))return{data:{user:null,session:null,redirectType:null},error:e};throw e}}async signInWithIdToken(e){try{let{options:t,provider:r,token:a,access_token:n,nonce:s}=e,{data:i,error:o}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:r,id_token:a,access_token:n,nonce:s,gotrue_meta_security:{captcha_token:null==t?void 0:t.captchaToken}},xform:tP});if(o)return{data:{user:null,session:null},error:o};if(!i||!i.session||!i.user)return{data:{user:null,session:null},error:new eQ};return i.session&&(await this._saveSession(i.session),await this._notifyAllSubscribers("SIGNED_IN",i.session)),{data:i,error:o}}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithOtp(e){var t,r,a,n,s;try{if("email"in e){let{email:a,options:n}=e,s=null,i=null;"pkce"===this.flowType&&([s,i]=await tg(this.storage,this.storageKey));let{error:o}=await tS(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:a,data:null!=(t=null==n?void 0:n.data)?t:{},create_user:null==(r=null==n?void 0:n.shouldCreateUser)||r,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken},code_challenge:s,code_challenge_method:i},redirectTo:null==n?void 0:n.emailRedirectTo});return{data:{user:null,session:null},error:o}}if("phone"in e){let{phone:t,options:r}=e,{data:i,error:o}=await tS(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:t,data:null!=(a=null==r?void 0:r.data)?a:{},create_user:null==(n=null==r?void 0:r.shouldCreateUser)||n,gotrue_meta_security:{captcha_token:null==r?void 0:r.captchaToken},channel:null!=(s=null==r?void 0:r.channel)?s:"sms"}});return{data:{user:null,session:null,messageId:null==i?void 0:i.message_id},error:o}}throw new eZ("You must provide either an email or phone number.")}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async verifyOtp(e){var t,r;try{let a,n;"options"in e&&(a=null==(t=e.options)?void 0:t.redirectTo,n=null==(r=e.options)?void 0:r.captchaToken);let{data:s,error:i}=await tS(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:n}}),redirectTo:a,xform:tP});if(i)throw i;if(!s)throw Error("An error occurred on token verification.");let o=s.session,l=s.user;return(null==o?void 0:o.access_token)&&(await this._saveSession(o),await this._notifyAllSubscribers("recovery"==e.type?"PASSWORD_RECOVERY":"SIGNED_IN",o)),{data:{user:l,session:o},error:null}}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async signInWithSSO(e){var t,r,a;try{let n=null,s=null;return"pkce"===this.flowType&&([n,s]=await tg(this.storage,this.storageKey)),await tS(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:null!=(r=null==(t=e.options)?void 0:t.redirectTo)?r:void 0}),(null==(a=null==e?void 0:e.options)?void 0:a.captchaToken)?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:n,code_challenge_method:s}),headers:this.headers,xform:tC})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{let{data:{session:t},error:r}=e;if(r)throw r;if(!t)throw new eY;let{error:a}=await tS(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:t.access_token});return{data:{user:null,session:null},error:a}})}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{let t=`${this.url}/resend`;if("email"in e){let{email:r,type:a,options:n}=e,{error:s}=await tS(this.fetch,"POST",t,{headers:this.headers,body:{email:r,type:a,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}},redirectTo:null==n?void 0:n.emailRedirectTo});return{data:{user:null,session:null},error:s}}if("phone"in e){let{phone:r,type:a,options:n}=e,{data:s,error:i}=await tS(this.fetch,"POST",t,{headers:this.headers,body:{phone:r,type:a,gotrue_meta_security:{captcha_token:null==n?void 0:n.captchaToken}}});return{data:{user:null,session:null,messageId:null==s?void 0:s.message_id},error:i}}throw new eZ("You must provide either an email or phone number and a type")}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async e=>e))}async _acquireLock(e,t){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){let e=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),r=(async()=>(await e,await t()))();return this.pendingInLock.push((async()=>{try{await r}catch(e){}})()),r}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;let e=t();for(this.pendingInLock.push((async()=>{try{await e}catch(e){}})()),await e;this.pendingInLock.length;){let e=[...this.pendingInLock];await Promise.all(e),this.pendingInLock.splice(0,e.length)}return await e}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{let t=await this.__loadSession();return await e(t)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",Error().stack);try{let t=null,r=await tu(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",r),null!==r&&(this._isValidSession(r)?t=r:(this._debug("#getSession()","session from storage is not val
34id"),await this._removeSession())),!t)return{data:{session:null},error:null};let a=!!t.expires_at&&1e3*t.expires_at-Date.now()<9e4;if(this._debug("#__loadSession()",`session has${a?"":" not"} expired`,"expires_at",t.expires_at),!a){if(this.userStorage){let e=await tu(this.userStorage,this.storageKey+"-user");(null==e?void 0:e.user)?t.user=e.user:t.user=tT()}if(this.storage.isServer&&t.user&&!t.user.__isUserNotAvailableProxy){var e;let r={value:this.suppressGetSessionWarning};t.user=(e=t.user,new Proxy(e,{get:(e,t,a)=>{if("__isInsecureUserWarningProxy"===t)return!0;if("symbol"==typeof t){let r=t.toString();if("Symbol(Symbol.toPrimitive)"===r||"Symbol(Symbol.toStringTag)"===r||"Symbol(util.inspect.custom)"===r||"Symbol(nodejs.util.inspect.custom)"===r)return Reflect.get(e,t,a)}return r.value||"string"!=typeof t||(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),r.value=!0),Reflect.get(e,t,a)}})),r.value&&(this.suppressGetSessionWarning=!0)}return{data:{session:t},error:null}}let{data:n,error:s}=await this._callRefreshToken(t.refresh_token);if(s)return{data:{session:null},error:s};return{data:{session:n},error:null}}finally{this._debug("#__loadSession()","end")}}async getUser(e){return e?await this._getUser(e):(await this.initializePromise,await this._acquireLock(-1,async()=>await this._getUser()))}async _getUser(e){try{if(e)return await tS(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:tA});return await this._useSession(async e=>{var t,r,a;let{data:n,error:s}=e;if(s)throw s;return(null==(t=n.session)?void 0:t.access_token)||this.hasCustomAuthorizationHeader?await tS(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:null!=(a=null==(r=n.session)?void 0:r.access_token)?a:void 0,xform:tA}):{data:{user:null},error:new eY}})}catch(e){if(eW(e))return eW(e)&&"AuthSessionMissingError"===e.name&&(await this._removeSession(),await tc(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:e};throw e}}async updateUser(e,t={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(e,t))}async _updateUser(e,t={}){try{return await this._useSession(async r=>{let{data:a,error:n}=r;if(n)throw n;if(!a.session)throw new eY;let s=a.session,i=null,o=null;"pkce"===this.flowType&&null!=e.email&&([i,o]=await tg(this.storage,this.storageKey));let{data:l,error:u}=await tS(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:null==t?void 0:t.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:i,code_challenge_method:o}),jwt:s.access_token,xform:tA});if(u)throw u;return s.user=l.user,await this._saveSession(s),await this._notifyAllSubscribers("USER_UPDATED",s),{data:{user:s.user},error:null}})}catch(e){if(eW(e))return{data:{user:null},error:e};throw e}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new eY;let t=Date.now()/1e3,r=t,a=!0,n=null,{payload:s}=tp(e.access_token);if(s.exp&&(a=(r=s.exp)<=t),a){let{data:t,error:r}=await this._callRefreshToken(e.refresh_token);if(r)return{data:{user:null,session:null},error:r};if(!t)return{data:{user:null,session:null},error:null};n=t}else{let{data:a,error:s}=await this._getUser(e.access_token);if(s)throw s;n={access_token:e.access_token,refresh_token:e.refresh_token,user:a.user,token_type:"bearer",expires_in:r-t,expires_at:r},await this._saveSession(n),await this._notifyAllSubscribers("SIGNED_IN",n)}return{data:{user:n.user,session:n},error:null}}catch(e){if(eW(e))return{data:{session:null,user:null},error:e};throw e}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async t=>{var r;if(!e){let{data:a,error:n}=t;if(n)throw n;e=null!=(r=a.session)?r:void 0}if(!(null==e?void 0:e.refresh_token))throw new eY;let{data:a,error:n}=await this._callRefreshToken(e.refresh_token);return n?{data:{user:null,session:null},error:n}:a?{data:{user:a.user,session:a},error:null}:{data:{user:null,session:null},error:null}})}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}}async _getSessionFromURL(e,t){try{if(!tn())throw new e0("No browser detected.");
34if(e.error||e.error_description||e.error_code)throw new e0(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(t){case"implicit":if("pkce"===this.flowType)throw new e2("Not a valid PKCE flow url.");break;case"pkce":if("implicit"===this.flowType)throw new e0("Not a valid implicit grant flow url.")}if("pkce"===t){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new e2("No code detected.");let{data:t,error:r}=await this._exchangeCodeForSession(e.code);if(r)throw r;let a=new URL(window.location.href);return a.searchParams.delete("code"),window.history.replaceState(window.history.state,"",a.toString()),{data:{session:t.session,redirectType:null},error:null}}let{provider_token:r,provider_refresh_token:a,access_token:n,refresh_token:s,expires_in:i,expires_at:o,token_type:l}=e;if(!n||!i||!s||!l)throw new e0("No session defined in URL");let u=Math.round(Date.now()/1e3),c=parseInt(i),d=u+c;o&&(d=parseInt(o));let p=d-u;1e3*p<=3e4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${p}s, should have been closer to ${c}s`);let h=d-c;u-h>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",h,d,u):u-h<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",h,d,u);let{data:y,error:m}=await this._getUser(n);if(m)throw m;let f={provider_token:r,provider_refresh_token:a,access_token:n,expires_in:c,expires_at:d,refresh_token:s,token_type:l,user:y.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:f,redirectType:e.type},error:null}}catch(e){if(eW(e))return{data:{session:null,redirectType:null},error:e};throw e}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){let t=await tu(this.storage,`${this.storageKey}-code-verifier`);return!!(e.code&&t)}async signOut(e={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(e))}async _signOut({scope:e}={scope:"global"}){return await this._useSession(async t=>{var r;let{data:a,error:n}=t;if(n)return{error:n};let s=null==(r=a.session)?void 0:r.access_token;if(s){let{error:t}=await this.admin.signOut(s,e);if(t&&!(eW(t)&&"AuthApiError"===t.name&&(404===t.status||401===t.status||403===t.status)))return{error:t}}return"others"!==e&&(await this._removeSession(),await tc(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){let t="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){let t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)}),r={id:t,callback:e,unsubscribe:()=>{this._debug("#unsubscribe()","state change callback with id removed",t),this.stateChangeEmitters.delete(t)}};return this._debug("#onAuthStateChange()","registered callback with id",t),this.stateChangeEmitters.set(t,r),(async()=>{await this.initializePromise,await this._acquireLock(-1,async()=>{this._emitInitialSession(t)})})(),{data:{subscription:r}}}async _emitInitialSession(e){return await this._useSession(async t=>{var r,a;try{let{data:{session:a},error:n}=t;if(n)throw n;await (null==(r=this.stateChangeEmitters.get(e))?void 0:r.callback("INITIAL_SESSION",a)),this._debug("INITIAL_SESSION","callback id",e,"session",a)}catch(t){await (null==(a=this.stateChangeEmitters.get(e))?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",e,"error",t),console.error(t)}})}async resetPasswordForEmail(e,t={}){let r=null,a=null;"pkce"===this.flowType&&([r,a]=await tg(this.storage,this.storageKey,!0));try{return await tS(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:r,code_challenge_method:a,gotrue_meta_security:{captcha_token:t.captchaToken}},headers:this.headers,redirectTo:t.redirectTo})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async getUserIdentities(){var e;try{let{data:t,error:r}=await this.getUser();if(r)throw r;return{data:{identities:null!=(e=t.user.identities)?e:[]},error:null}}catch(e){if(eW(e))return{data:null,error:e};throw e}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var t;try{let{data:r,error:a}=await this._useSession(async t=>{var r,a,n,s,i;let{data:o,error:l}=t;if(l)throw l;let u=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:null==(r=e.options)?void 0:r.redirectTo,scopes:null==(a=e.options)?void 0:a.scopes,queryParams:null==(n=e.options)?void 0:n.queryParams,skipBrowserRedirect:!0});return await tS(this.fetch,"GET",u,{headers:this.headers,jwt:null!=(i=null==(s=o.session)?void 0:s.access_token)?i:void 0})});if(a)throw a;return!tn()||(null==(t=e.options)?void 0:t.skipBrowserRedirect)||window.location.assign(null==r?void 0:r.url),{data:{provider:e.provider,url:null==r?void 0:r.url},error:null}}catch(t){if(eW(t))return{data:{provider:e.provider,url:null},error:t};throw t}}async linkIdentityIdToken(e){return await this._useSession(async t=>{var r;try{let{error:a,data:{session:n}}=t;if(a)throw a;let{options:s,provider:i,token:o,access_token:l,nonce:u}=e,{data:c,error:d}=await tS(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:null!=(r=null==n?void 0:n.access_token)?r:void 0,body:{provider:i,id_token:o,access_token:l,nonce:u,link_identity:!0,gotrue_meta_security:{captcha_token:null==s?void 0:s.captchaToken}},xform:tP});if(d)return{data:{user:null,session:null},error:d};if(!c||!c.session||!c.user)return{data:{user:null,session:null},error:new eQ};return c.session&&(await this._saveSession(c.session),await this._notifyAllSubscribers("USER_UPDATED",c.session)),{data:c,error:d}}catch(e){if(eW(e))return{data:{user:null,session:null},error:e};throw e}})}async unlinkIdentity(e){try{return await this._useSession(async t=>{var r,a;let{data:n,error:s}=t;if(s)throw s;
34return await tS(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:null!=(a=null==(r=n.session)?void 0:r.access_token)?a:void 0})})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _refreshAccessToken(e){let t=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(t,"begin");try{var r,a;let n=Date.now();return await (r=async r=>(r>0&&await th(200*Math.pow(2,r-1)),this._debug(t,"refreshing attempt",r),await tS(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:tP})),a=(e,t)=>{let r=200*Math.pow(2,e);return t&&e5(t)&&Date.now()+r-n<3e4},new Promise((e,t)=>{(async()=>{for(let n=0;n<1/0;n++)try{let t=await r(n);if(!a(n,null,t))return void e(t)}catch(e){if(!a(n,e))return void t(e)}})()}))}catch(e){if(this._debug(t,"error",e),eW(e))return{data:{session:null,user:null},error:e};throw e}finally{this._debug(t,"end")}}_isValidSession(e){return"object"==typeof e&&null!==e&&"access_token"in e&&"refresh_token"in e&&"expires_at"in e}async _handleProviderSignIn(e,t){let r=await this._getUrlForProvider(`${this.url}/authorize`,e,{redirectTo:t.redirectTo,scopes:t.scopes,queryParams:t.queryParams});return this._debug("#_handleProviderSignIn()","provider",e,"options",t,"url",r),tn()&&!t.skipBrowserRedirect&&window.location.assign(r),{data:{provider:e,url:r},error:null}}async _recoverAndRefresh(){var e,t;let r="#_recoverAndRefresh()";this._debug(r,"begin");try{let a=await tu(this.storage,this.storageKey);if(a&&this.userStorage){let t=await tu(this.userStorage,this.storageKey+"-user");!this.storage.isServer&&Object.is(this.storage,this.userStorage)&&!t&&(t={user:a.user},await tl(this.userStorage,this.storageKey+"-user",t)),a.user=null!=(e=null==t?void 0:t.user)?e:tT()}else if(a&&!a.user&&!a.user){let e=await tu(this.storage,this.storageKey+"-user");e&&(null==e?void 0:e.user)?(a.user=e.user,await tc(this.storage,this.storageKey+"-user"),await tl(this.storage,this.storageKey,a)):a.user=tT()}if(this._debug(r,"session from storage",a),!this._isValidSession(a)){this._debug(r,"session is not valid"),null!==a&&await this._removeSession();return}let n=(null!=(t=a.expires_at)?t:1/0)*1e3-Date.now()<9e4;if(this._debug(r,`session has${n?"":" not"} expired with margin of 90000s`),n){if(this.autoRefreshToken&&a.refresh_token){let{error:e}=await this._callRefreshToken(a.refresh_token);e&&(console.error(e),e5(e)||(this._debug(r,"refresh failed with a non-retryable error, removing the session",e),await this._removeSession()))}}else if(a.user&&!0===a.user.__isUserNotAvailableProxy)try{let{data:e,error:t}=await this._getUser(a.access_token);!t&&(null==e?void 0:e.user)?(a.user=e.user,await this._saveSession(a),await this._notifyAllSubscribers("SIGNED_IN",a)):this._debug(r,"could not get user data, skipping SIGNED_IN notification")}catch(e){console.error("Error getting user data:",e),this._debug(r,"error getting user data, skipping SIGNED_IN notification",e)}else await this._notifyAllSubscribers("SIGNED_IN",a)}catch(e){this._debug(r,"error",e),console.error(e);return}finally{this._debug(r,"end")}}async _callRefreshToken(e){var t,r;if(!e)throw new eY;if(this.refreshingDeferred)return this.refreshingDeferred.promise;let a=`#_callRefreshToken(${e.substring(0,5)}...)`;this._debug(a,"begin");try{this.refreshingDeferred=new td;let{data:t,error:r}=await this._refreshAccessToken(e);if(r)throw r;if(!t.session)throw new eY;await this._saveSession(t.session),await this._notifyAllSubscribers("TOKEN_REFRESHED",t.session);let a={data:t.session,error:null};return this.refreshingDeferred.resolve(a),a}catch(e){if(this._debug(a,"error",e),eW(e)){let r={data:null,error:e};return e5(e)||await this._removeSession(),null==(t=this.refreshingDeferred)||t.resolve(r),r}throw null==(r=this.refreshingDeferred)||r.reject(e),e}finally{this.refreshingDeferred=null,this._debug(a,"end")}}async _notifyAllSubscribers(e,t,r=!0){let a=`#_notifyAllSubscribers(${e})`;this._debug(a,"begin",t,`broadcast = ${r}`);try{this.broadcastChannel&&r&&this.broadcastChannel.postMessage({event:e,session:t});let a=[],n=Array.from(this.stateChangeEmitters.values()).map(async r=>{try{await r.callback(e,t)}catch(e){a.push(e)}});if(await Promise.all(n),a.length>0){for(let e=0;e<a.length;e+=1)console.error(a[e]);throw a[0]}}finally{this._debug(a,"end")}}async _saveSession(e){this._debug("#_saveSession()",e),this.suppressGetSessionWarning=!0;let t=Object.assign({},e),r=t.user&&!0===t.user.__isUserNotAvailableProxy;if(this.userStorage){!r&&t.user&&await tl(this.userStorage,this.storageKey+"-user",{user:t.user});let e=Object.assign({},t);delete e.user;let a=t_(e);await tl(this.storage,this.storageKey,a)}else{let e=t_(t);await tl(this.storage,this.storageKey,e)}}async _removeSession(){this._debug("#_removeSession()"),await tc(this.storage,this.storageKey),await tc(this.storage,this.storageKey+"-code-verifier"),await tc(this.storage,this.storageKey+"-user"),this.userStorage&&await tc(this.userStorage,this.storageKey+"-user"),await this._notifyAllSubscribers("SIGNED_OUT",null)}_removeVisibilityChangedCallback(){this._debug("#_removeVisibilityChangedCallback()");let e=this.visibilityChangedCallback;this.visibilityChangedCallback=null;try{e&&tn()&&(null==window?void 0:window.removeEventListener)&&window.removeEventListener("visibilitychange",e)}
34catch(e){console.error("removing visibilitychange callback failed",e)}}async _startAutoRefresh(){await this._stopAutoRefresh(),this._debug("#_startAutoRefresh()");let e=setInterval(()=>this._autoRefreshTokenTick(),3e4);this.autoRefreshTicker=e,e&&"object"==typeof e&&"function"==typeof e.unref?e.unref():"undefined"!=typeof Deno&&"function"==typeof Deno.unrefTimer&&Deno.unrefTimer(e),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");let e=this.autoRefreshTicker;this.autoRefreshTicker=null,e&&clearInterval(e)}async startAutoRefresh(){this._removeVisibilityChangedCallback(),await this._startAutoRefresh()}async stopAutoRefresh(){this._removeVisibilityChangedCallback(),await this._stopAutoRefresh()}async _autoRefreshTokenTick(){this._debug("#_autoRefreshTokenTick()","begin");try{await this._acquireLock(0,async()=>{try{let e=Date.now();try{return await this._useSession(async t=>{let{data:{session:r}}=t;if(!r||!r.refresh_token||!r.expires_at)return void this._debug("#_autoRefreshTokenTick()","no session");let a=Math.floor((1e3*r.expires_at-e)/3e4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts 30000ms, refresh threshold is 3 ticks`),a<=3&&await this._callRefreshToken(r.refresh_token)})}catch(e){console.error("Auto refresh tick failed with error. This is likely a transient error.",e)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof tU)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!tn()||!(null==window?void 0:window.addEventListener))return this.autoRefreshToken&&this.startAutoRefresh(),!1;try{this.visibilityChangedCallback=async()=>await this._onVisibilityChanged(!1),null==window||window.addEventListener("visibilitychange",this.visibilityChangedCallback),await this._onVisibilityChanged(!0)}catch(e){console.error("_handleVisibilityChange",e)}}async _onVisibilityChanged(e){let t=`#_onVisibilityChanged(${e})`;this._debug(t,"visibilityState",document.visibilityState),"visible"===document.visibilityState?(this.autoRefreshToken&&this._startAutoRefresh(),e||(await this.initializePromise,await this._acquireLock(-1,async()=>{if("visible"!==document.visibilityState)return void this._debug(t,"acquired the lock to recover the session, but the browser visibilityState is no longer visible, aborting");await this._recoverAndRefresh()}))):"hidden"===document.visibilityState&&this.autoRefreshToken&&this._stopAutoRefresh()}async _getUrlForProvider(e,t,r){let a=[`provider=${encodeURIComponent(t)}`];if((null==r?void 0:r.redirectTo)&&a.push(`redirect_to=${encodeURIComponent(r.redirectTo)}`),(null==r?void 0:r.scopes)&&a.push(`scopes=${encodeURIComponent(r.scopes)}`),"pkce"===this.flowType){let[e,t]=await tg(this.storage,this.storageKey),r=new URLSearchParams({code_challenge:`${encodeURIComponent(e)}`,code_challenge_method:`${encodeURIComponent(t)}`});a.push(r.toString())}if(null==r?void 0:r.queryParams){let e=new URLSearchParams(r.queryParams);a.push(e.toString())}return(null==r?void 0:r.skipBrowserRedirect)&&a.push(`skip_http_redirect=${r.skipBrowserRedirect}`),`${e}?${a.join("&")}`}async _unenroll(e){try{return await this._useSession(async t=>{var r;let{data:a,error:n}=t;return n?{data:null,error:n}:await tS(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:null==(r=null==a?void 0:a.session)?void 0:r.access_token})})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _enroll(e){try{return await this._useSession(async t=>{var r,a;let{data:n,error:s}=t;if(s)return{data:null,error:s};let i=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},"phone"===e.factorType?{phone:e.phone}:"totp"===e.factorType?{issuer:e.issuer}:{}),{data:o,error:l}=await tS(this.fetch,"POST",`${this.url}/factors`,{body:i,headers:this.headers,jwt:null==(r=null==n?void 0:n.session)?void 0:r.access_token});return l?{data:null,error:l}:("totp"===e.factorType&&"totp"===o.type&&(null==(a=null==o?void 0:o.totp)?void 0:a.qr_code)&&(o.totp.qr_code=`data:image/svg+xml;utf-8,${o.totp.qr_code}`),{data:o,error:null})})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r,a,n;let{data:s,error:i}=t;if(i)return{data:null,error:i};let o=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:"create"===e.webauthn.type?(a=e.webauthn.credential_response,"toJSON"in a&&"function"==typeof a.toJSON?a.toJSON():{id:a.id,rawId:a.id,response:{attestationObject:ta(new Uint8Array(a.response.attestationObject)),clientDataJSON:ta(new Uint8Array(a.response.clientDataJSON))},type:"public-key",clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:null!=(n=a.authenticatorAttachment)?n:void 0}):function(e){var t;if("toJSON"in e&&"function"==typeof e.toJSON)return e.toJSON();let r=e.getClientExtensionResults(),a=e.response;return{id:e.id,rawId:e.id,response:{authenticatorData:ta(new Uint8Array(a.authenticatorData)),clientDataJSON:ta(new Uint8Array(a.clientDataJSON)),signature:ta(new Uint8Array(a.signature)),userHandle:a.userHandle?ta(new Uint8Array(a.userHandle)):void 0},type:"public-key",clientExtensionResults:r,authenticatorAttachment:null!=(t=e.authenticatorAttachment)?t:void 0}}(e.webauthn.credential_response)})}:{code:e.code}),{data:l,error:u}=await tS(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:o,headers:this.headers,jwt:null==(r=null==s?void 0:s.session)?void 0:r.access_token});return u?{data:null,error:u}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+l.expires_in},l)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",l),{data:l,error:u})})}catch(e){if(eW(e))return{data:null,error:e};throw e}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async t=>{var r;let{data:a,error:n}=t;if(n)return{data:null,error:n};let s=await tS(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:null==(r=null==a?void 0:a.session)?void 0:r.access_token});if(s.error)return s;let{data:i}=s;if("webauthn"!==i.type)return{data:i,error:null};switch(i.webauthn.type){case"create":return{data:Object.assign(Object.assign({},i),{webauthn:Object.assign(Object.assign({},i.webauthn),{credential_options:Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential creation options are required");if("undefined"!=typeof PublicKeyCredential&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseCreationOptionsFromJSON)return PublicKeyCredential.parseCreationOptionsFromJSON(e);let{challenge:t,user:r,excludeCredentials:a}=e,n=(0,f.__rest)(e,["challenge","user","excludeCredentials"]),s=tr(t).buffer,i=Object.assign(Object.assign({},r),{id:tr(r.id).buffer}),o=Object.assign(Object.assign({}
34,n),{challenge:s,user:i});if(a&&a.length>0){o.excludeCredentials=Array(a.length);for(let e=0;e<a.length;e++){let t=a[e];o.excludeCredentials[e]=Object.assign(Object.assign({},t),{id:tr(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return o}(i.webauthn.credential_options.publicKey)})})}),error:null};case"request":return{data:Object.assign(Object.assign({},i),{webauthn:Object.assign(Object.assign({},i.webauthn),{credential_options:Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:function(e){if(!e)throw Error("Credential request options are required");if("undefined"!=typeof PublicKeyCredential&&"parseRequestOptionsFromJSON"in PublicKeyCredential&&"function"==typeof PublicKeyCredential.parseRequestOptionsFromJSON)return PublicKeyCredential.parseRequestOptionsFromJSON(e);let{challenge:t,allowCredentials:r}=e,a=(0,f.__rest)(e,["challenge","allowCredentials"]),n=tr(t).buffer,s=Object.assign(Object.assign({},a),{challenge:n});if(r&&r.length>0){s.allowCredentials=Array(r.length);for(let e=0;e<r.length;e++){let t=r[e];s.allowCredentials[e]=Object.assign(Object.assign({},t),{id:tr(t.id).buffer,type:t.type||"public-key",transports:t.transports})}}return s}(i.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(e){if(eW(e))return{data:null,error:e};throw e}})}async _challengeAndVerify(e){let{data:t,error:r}=await this._challenge({factorId:e.factorId});return r?{data:null,error:r}:await this._verify({factorId:e.factorId,challengeId:t.id,code:e.code})}async _listFactors(){var e;let{data:{user:t},error:r}=await this.getUser();if(r)return{data:null,error:r};let a={all:[],phone:[],totp:[],webauthn:[]};for(let r of null!=(e=null==t?void 0:t.factors)?e:[])a.all.push(r),"verified"===r.status&&a[r.factor_type].push(r);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(){var e,t;let{data:{session:r},error:a}
34=await this.getSession();if(a)return{data:null,error:a};if(!r)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};let{payload:n}=tp(r.access_token),s=null;n.aal&&(s=n.aal);let i=s;return(null!=(t=null==(e=r.user.factors)?void 0:e.filter(e=>"verified"===e.status))?t:[]).length>0&&(i="aal2"),{data:{currentLevel:s,nextLevel:i,currentAuthenticationMethods:n.amr||[]},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async t=>{let{data:{session:r},error:a}=t;return a?{data:null,error:a}:r?await tS(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:r.access_token,xform:e=>({data:e,error:null})}):{data:null,error:new eY}})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _approveAuthorization(e,t){try{return await this._useSession(async r=>{let{data:{session:a},error:n}=r;if(n)return{data:null,error:n};if(!a)return{data:null,error:new eY};let s=await tS(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:e=>({data:e,error:null})});return s.data&&s.data.redirect_url&&tn()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(s.data.redirect_url),s})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async _denyAuthorization(e,t){try{return await this._useSession(async r=>{let{data:{session:a},error:n}=r;if(n)return{data:null,error:n};if(!a)return{data:null,error:new eY};let s=await tS(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:e=>({data:e,error:null})});return s.data&&s.data.redirect_url&&tn()&&!(null==t?void 0:t.skipBrowserRedirect)&&window.location.assign(s.data.redirect_url),s})}catch(e){if(eW(e))return{data:null,error:e};throw e}}async fetchJwk(e,t={keys:[]}){let r=t.keys.find(t=>t.kid===e);if(r)return r;let a=Date.now();if((r=this.jwks.keys.find(t=>t.kid===e))&&this.jwks_cached_at+6e5>a)return r;let{data:n,error:s}=await tS(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(s)throw s;return n.keys&&0!==n.keys.length&&(this.jwks=n,this.jwks_cached_at=a,r=n.keys.find(t=>t.kid===e))?r:null}async getClaims(e,t={}){try{let r=e;if(!r){let{data:e,error:t}
34=await this.getSession();if(t||!e.session)return{data:null,error:t};r=e.session.access_token}let{header:a,payload:n,signature:s,raw:{header:i,payload:o}}=tp(r);(null==t?void 0:t.allowExpired)||function(e){if(!e)throw Error("Missing exp claim");if(e<=Math.floor(Date.now()/1e3))throw Error("JWT has expired")}(n.exp);let l=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,(null==t?void 0:t.keys)?{keys:t.keys}:null==t?void 0:t.jwks);if(!l){let{error:e}=await this.getUser(r);if(e)throw e;return{data:{claims:n,header:a,signature:s},error:null}}let u=function(e){switch(e){case"RS256":return{name:"RSASSA-PKCS1-v1_5",hash:{name:"SHA-256"}};case"ES256":return{name:"ECDSA",namedCurve:"P-256",hash:{name:"SHA-256"}};default:throw Error("Invalid alg claim")}}(a.alg),c=await crypto.subtle.importKey("jwk",l,u,!0,["verify"]);if(!await crypto.subtle.verify(u,c,s,function(e){let t=[];return!function(e,t){for(let r=0;r<e.length;r+=1){let a=e.charCodeAt(r);if(a>55295&&a<=56319){let t=(a-55296)*1024&65535;a=(e.charCodeAt(r+1)-56320&65535|t)+65536,r+=1}!function(e,t){if(e<=127)return t(e);if(e<=2047){t(192|e>>6),t(128|63&e);return}if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|63&e);return}if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|63&e);return}throw Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}(a,t)}}(e,e=>t.push(e)),new Uint8Array(t)}(`${i}.${o}`)))throw new e3("Invalid JWT signature");return{data:{claims:n,header:a,signature:s},error:null}}catch(e){if(eW(e))return{data:null,error:e};throw e}}}t5.nextInstanceID=0;let t6=t5;class t3 extends t6{constructor(e){super(e)}}class t4{constructor(e,t,r){var a,n,s;this.supabaseUrl=e,this.supabaseKey=t;let i=function(e){let t=null==e?void 0:e.trim();if(!t)throw Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(t.endsWith("/")?t:t+"/")}catch(e){throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}(e);if(!t)throw Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);let o=`sb-${i.hostname.split(".")[0]}-auth-token`,l=function(e,t){var r,a;let{db:n,auth:s,realtime:i,global:o}=e,{db:l,auth:u,realtime:c,global:d}=t,p={db:Object.assign(Object.assign({},l),n),auth:Object.assign(Object.assign({},u),s),realtime:Object.assign(Object.assign({},c),i),storage:{},global:Object.assign(Object.assign(Object.assign({},d),o),{headers:Object.assign(Object.assign({},null!=(r=null==d?void 0:d.headers)?r:{}),null!=(a=null==o?void 0:o.headers)?a:{})}),accessToken:async()=>""};return e.accessToken?p.accessToken=e.accessToken:delete p.accessToken,p}(null!=r?r:{},{db:eN,realtime:eM,auth:Object.assign(Object.assign({},eU),{storageKey:o}),global:eL});this.storageKey=null!=(a=l.auth.storageKey)?a:"",this.headers=null!=(n=l.global.headers)?n:{},l.accessToken?(this.accessToken=l.accessToken,this.auth=new Proxy({},{get:(e,t)=>{throw Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(t)} is not possible`)}})):this.auth=this._initSupabaseAuthClient(null!=(s=l.auth)?s:{},this.headers,l.global.fetch),this.fetch=((e,t,r)=>{let a=(e=>{let t;return t=e||("undefined"==typeof fetch?eG.default:fetch),(...e)=>t(...e)})(r),n="undefined"==typeof Headers?eG.Headers:Headers;return async(r,s)=>{var i;let o=null!=(i=await t())?i:e,l=new n(null==s?void 0:s.headers);return l.has("apikey")||l.set("apikey",e),l.has("Authorization")||l.set("Authorization",`Bearer ${o}`),a(r,Object.assign(Object.assign({},s),{headers:l}))}})(t,this._getAccessToken.bind(this),l.global.fetch),this.realtime=this._initRealtimeClient(Object.assign({headers:this.headers,accessToken:this._getAccessToken.bind(this)},l.realtime)),this.rest=new O(new URL("rest/v1",i).href,{headers:this.headers,schema:l.db.schema,fetch:this.fetch}),this.storage=new ej(this.storageUrl.href,this.headers,this.fetch,null==r?void 0:r.storage),l.accessToken||this._listenForAuthEvents()}get functions(){return new T(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,t={},r={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,t,r)}
34channel(e,t={config:{}}){return this.realtime.channel(e,t)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,t;if(this.accessToken)return await this.accessToken();let{data:r}=await this.auth.getSession();return null!=(t=null==(e=r.session)?void 0:e.access_token)?t:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:a,userStorage:n,storageKey:s,flowType:i,lock:o,debug:l},u,c){let d={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new t3({url:this.authUrl.href,headers:Object.assign(Object.assign({},d),u),storageKey:s,autoRefreshToken:e,persistSession:t,detectSessionInUrl:r,storage:a,userStorage:n,flowType:i,lock:o,debug:l,fetch:c,hasCustomAuthorizationHeader:Object.keys(this.headers).some(e=>"authorization"===e.toLowerCase())})}_initRealtimeClient(e){return new Y(this.realtimeUrl.href,Object.assign(Object.assign({},e),{params:Object.assign({apikey:this.supabaseKey},null==e?void 0:e.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((e,t)=>{this._handleTokenChanged(e,"CLIENT",null==t?void 0:t.access_token)})}_handleTokenChanged(e,t,r){("TOKEN_REFRESHED"===e||"SIGNED_IN"===e)&&this.changedAccessToken!==r?(this.changedAccessToken=r,this.realtime.setAuth(r)):"SIGNED_OUT"===e&&(this.realtime.setAuth(),"STORAGE"==t&&this.auth.signOut(),this.changedAccessToken=void 0)}}var t7=r(87358);let t9=(e,t,r)=>new t4(e,t,r);(function(){if("undefined"!=typeof window||void 0===t7)return!1;let e=t7.version;if(null==e)return!1;let t=e.match(/^v(\d+)\./);return!!t&&18>=parseInt(t[1],10)})()&&console.warn(`â ï¸ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217`)},86457:(e,t,r)=>{let a=r(76353);e.exports=(e,t)=>new a(e,t).set.map(e=>e.map(e=>e.value).join(" ").trim().split(" "))},87843:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PostgrestError=t.PostgrestBuilder=t.PostgrestTransformBuilder=t.PostgrestFilterBuilder=t.PostgrestQueryBuilder=t.PostgrestClient=void 0;let a=r(71450),n=a.__importDefault(r(37977));t.PostgrestClient=n.default;let s=a.__importDefault(r(72901));t.PostgrestQueryBuilder=s.default;let i=a.__importDefault(r(54419));t.PostgrestFilterBuilder=i.default;let o=a.__importDefault(r(76373));t.PostgrestTransformBuilder=o.default;let l=a.__importDefault(r(3913));t.PostgrestBuilder=l.default;let u=a.__importDefault(r(5732));t.PostgrestError=u.default,t.default={PostgrestClient:n.default,PostgrestQueryBuilder:s.default,PostgrestFilterBuilder:i.default,PostgrestTransformBuilder:o.default,PostgrestBuilder:l.default,PostgrestError:u.default}},89024:(e,t,r)=>{r.d(t,{_:()=>m});var a=r(95089),n=r(35471),s=r(42256),i=r(71716);async function o(e,{hash:t}){let r=await e.request({method:"eth_getUserOperationByHash",params:[t]},{dedupe:!0});if(!r)throw new i.Kh({hash:t});let{blockHash:a,blockNumber:n,entryPoint:s,transactionHash:o,userOperation:l}=r;return{blockHash:a,blockNumber:BigInt(n),entryPoint:s,transactionHash:o,userOperation:function(e){let t={...e};return e.callGasLimit&&(t.callGasLimit=BigInt(e.callGasLimit)),e.maxFeePerGas&&(t.maxFeePerGas=BigInt(e.maxFeePerGas)),e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=BigInt(e.maxPriorityFeePerGas)),e.nonce&&(t.nonce=BigInt(e.nonce)),e.paymasterPostOpGasLimit&&(t.paymasterPostOpGasLimit=BigInt(e.paymasterPostOpGasLimit)),e.paymasterVerificationGasLimit&&(t.paymasterVerificationGasLimit=BigInt(e.paymasterVerificationGasLimit)),e.preVerificationGas&&(t.preVerificationGas=BigInt(e.preVerificationGas)),e.verificationGasLimit&&(t.verificationGasLimit=BigInt(e.verificationGasLimit)),t}(l)}}var l=r(11204),u=r(55874),c=r(72951),d=r(21641);function p(e){return{estimateUserOperationGas:t=>(0,s.C)(e,t),getChainId:()=>(0,n.T)(e),getSupportedEntryPoints:()=>e.request({method:"eth_supportedEntryPoints"}),getUserOperation:t=>o(e,t),getUserOperationReceipt:t=>(0,l.b)(e,t),prepareUserOperation:t=>(0,u.u)(e,t),sendUserOperation:t=>(0,c.$)(e,t),waitForUserOperationReceipt:t=>(0,d.V)(e,t)}}var h=r(334),y=r(60674);function m(e){let{client:t,key:r="Account",name:n="Kernel Account Client",paymaster:s,paymasterContext:i,bundlerTransport:o,userOperation:l}=e,c=Object.assign((0,a.U)({...e,chain:e.chain??t?.chain,transport:o,key:r,name:n,type:"kernelAccountClient",pollingInterval:e.pollingInterval??1e3}),{client:t,paymaster:s,paymasterContext:i,userOperation:l});if(e.userOperation?.prepareUserOperation){let t=e.userOperation.prepareUserOperation;return c.extend(p).extend(e=>({prepareUserOperation:r=>t(e,r)})).extend(p).extend(e=>({prepareUserOperation:r=>t(e,r)})).extend((0,y.J)())}return c.userOperation?.estimateFeesPerGas||(c.userOperation={...c.userOperation,estimateFeesPerGas:async({bundlerClient:e})=>await (0,h.$)(e)}),c.extend(p).extend(e=>({prepareUserOperation:async t=>{let r=t;if(e.account?.authorization){let a=t.authorization||await e.account?.eip7702Authorization?.();r={...t,authorization:a}}return await (0,u.u)(e,r)}})).extend(p).extend(e=>({prepareUserOperation:async t=>{let r=t;if(e.account?.authorization){let a=t.authorization||await e.account?.eip7702Authorization?.();r={...t,authorization:a}}return await (0,u.u)(e,r)}})).extend((0,y.J)())}},91039:(e,t,r)=>{let a=r(82404),n=r(36706),s=r(240),i=r(34747),o=r(95934),l=r(15831),u=r(12948),c=r(74609),d=r
34(32528),p=r(99032),h=r(95028),y=r(64255),m=r(43409),f=r(48390),g=r(43790),b=r(1185),w=r(93127),v=r(72119),T=r(32159),_=r(18252),E=r(81947),O=r(26301),x=r(40649),S=r(67199),I=r(68226),P=r(93569),k=r(37338),A=r(52376),C=r(76353),R=r(16088),$=r(86457),j=r(71146),D=r(80456),L=r(41789),N=r(73046),U=r(6563),M=r(28951),G=r(31098),F=r(37402);e.exports={parse:o,valid:l,clean:u,inc:c,diff:d,major:p,minor:h,patch:y,prerelease:m,compare:f,rcompare:g,compareLoose:b,compareBuild:w,sort:v,rsort:T,gt:_,lt:E,eq:O,neq:x,gte:S,lte:I,cmp:P,coerce:k,Comparator:A,Range:C,satisfies:R,toComparators:$,maxSatisfying:j,minSatisfying:D,minVersion:L,validRange:N,outside:U,gtr:M,ltr:G,intersects:F,simplifyRange:r(84451),subset:r(52770),SemVer:s,re:a.re,src:a.src,tokens:a.t,SEMVER_SPEC_VERSION:n.SEMVER_SPEC_VERSION,RELEASE_TYPES:n.RELEASE_TYPES,compareIdentifiers:i.compareIdentifiers,rcompareIdentifiers:i.rcompareIdentifiers}},91053:(e,t,r)=>{r.d(t,{x:()=>a});function a(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}},93127:(e,t,r)=>{let a=r(240);e.exports=(e,t,r)=>{let n=new a(e,r),s=new a(t,r);return n.compare(s)||n.compareBuild(s)}},93537:(e,t,r)=>{r.r(t),r.d(t,{Headers:()=>i,Request:()=>o,Response:()=>l,default:()=>s,fetch:()=>n});var a=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw Error("unable to locate global object")}();let n=a.fetch,s=a.fetch.bind(a),i=a.Headers,o=a.Request,l=a.Response},93569:(e,t,r)=>{let a=r(26301),n=r(40649),s=r(18252),i=r(67199),o=r(81947),l=r(68226);e.exports=(e,t,r,u)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return a(e,r,u);case"!=":return n(e,r,u);case">":return s(e,r,u);case">=":return i(e,r,u);case"<":return o(e,r,u);case"<=":return l(e,r,u);default:throw TypeError(`Invalid operator: ${t}`)}}},95028:(e,t,r)=>{let a=r(240);e.exports=(e,t)=>new a(e,t).minor},95355:(e,t,r)=>{r.d(t,{M5:()=>d,_f:()=>function e(t){if("function"!=typeof t)return null==t||"string"==typeof t||"boolean"==typeof t?t:"bigint"==typeof t||"number"==typeof t?(0,o.nj)(t):null!=t._isBigNumber||"object"!=typeof t?(0,o.nj)(t).replace(/^0x0/,"0x"):Array.isArray(t)?t.map(t=>e(t)):Object.keys(t).reduce((r,a)=>(r[a]=e(t[a]),r),{})},a_:()=>u,jY:()=>p,oG:()=>a,vf:()=>c});var a,n=r(91039),s=r(40290),i=r(72427),o=r(34561);!function(e){e.ERC1271_SIG_WRAPPER="ERC1271_SIG_WRAPPER",e.ERC1271_WITH_VALIDATOR="ERC1271_WITH_VALIDATOR",e.ERC1271_SIG_WRAPPER_WITH_WRAPPED_HASH="ERC1271_SIG_WRAPPER_WITH_WRAPPED_HASH",e.ERC1271_REPLAYABLE="ERC1271_REPLAYABLE"}(a||(a={}));let l={[a.ERC1271_SIG_WRAPPER]:">=0.2.3 || >=0.3.0-beta",[a.ERC1271_WITH_VALIDATOR]:">=0.3.0-beta",[a.ERC1271_SIG_WRAPPER_WITH_WRAPPED_HASH]:">=0.3.0-beta",[a.ERC1271_REPLAYABLE]:">=0.3.2"},u=(e,t)=>e in l&&(0,n.satisfies)(t,l[e]),c=({callType:e,execType:t})=>(0,s.aP)([e,t,"0x00000000","0x00000000",(0,i.eV)("0x00000000",{size:22})]),d=(e,t)=>{if("0.6"===e&&!(0,n.satisfies)(t,">=0.2.2 || <=0.2.4")||"0.7"===e&&!(0,n.satisfies)(t,">=0.3.0"))throw Error("KernelVersion should be >= 0.2.2 and <= 0.2.4 for EntryPointV0.6 and >= 0.3.0 for EntryPointV0.7")},p=(e,t)=>(0,n.satisfies)(e,t)},95934:(e,t,r)=>{let a=r(240);e.exports=(e,t,r=!1)=>{if(e instanceof a)return e;try{return new a(e,t)}catch(e){if(!r)return null;throw e}}},97338:(e,t,r)=>{r.d(t,{B9:()=>a,oi:()=>n});let a="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",n="0x0000000071727De22E5E9d8BAf0edAc6f37da032"},99032:(e,t,r)=>{let a=r(240);e.exports=(e,t)=>new a(e,t).major},99908:e=>{class t{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(void 0!==t)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}e.exports=t}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.