@walletconnect/utils
Version:
Utilities for WalletConnect Protocol
4 lines • 106 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var hs=require("detect-browser"),ze=require("@walletconnect/time"),ye=require("@walletconnect/window-getters"),ps=require("@walletconnect/window-metadata"),gs=require("viem"),bs=require("bs58"),Vn=require("@msgpack/msgpack"),ys=require("@scure/base"),ms=require("@walletconnect/relay-auth"),M=require("uint8arrays"),ws=require("@walletconnect/relay-api"),xs=require("blakejs");function vs(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var rt=vs(bs);const wt=":";function qt(e){const[t,n]=e.split(wt);return{namespace:t,reference:n}}function Mn(e){const{namespace:t,reference:n}=e;return[t,n].join(wt)}function Ft(e){const[t,n,r]=e.split(wt);return{namespace:t,reference:n,address:r}}function qn(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join(wt)}function Kt(e,t){const n=[];return e.forEach(r=>{const o=t(r);n.includes(o)||n.push(o)}),n}function Fn(e){const{address:t}=Ft(e);return t}function Kn(e){const{namespace:t,reference:n}=Ft(e);return Mn({namespace:t,reference:n})}function Es(e,t){const{namespace:n,reference:r}=qt(t);return qn({namespace:n,reference:r,address:e})}function As(e){return Kt(e,Fn)}function zn(e){return Kt(e,Kn)}function Ss(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...o.accounts)}),n}function Bs(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...zn(o.accounts))}),n}function Is(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...xt(r,o))}),n}function xt(e,t){return e.includes(":")?[e]:t.chains||[]}var Ns=Object.defineProperty,Os=Object.defineProperties,Us=Object.getOwnPropertyDescriptors,Gn=Object.getOwnPropertySymbols,_s=Object.prototype.hasOwnProperty,Rs=Object.prototype.propertyIsEnumerable,Zn=(e,t,n)=>t in e?Ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Yn=(e,t)=>{for(var n in t||(t={}))_s.call(t,n)&&Zn(e,n,t[n]);if(Gn)for(var n of Gn(t))Rs.call(t,n)&&Zn(e,n,t[n]);return e},Ts=(e,t)=>Os(e,Us(t));const Wn="ReactNative",Q={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},vt=" ",Cs=":",Xn="/",zt=2,$s=1e3,Jn="js";function Gt(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Ae(){return!ye.getDocument()&&!!ye.getNavigator()&&navigator.product===Wn}function Ls(){return Ae()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function js(){return Ae()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Ge(){return!Gt()&&!!ye.getNavigator()&&!!ye.getDocument()}function ke(){return Ae()?Q.reactNative:Gt()?Q.node:Ge()?Q.browser:Q.unknown}function Ps(){var e;try{return Ae()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function Qn(e,t){const n=new URLSearchParams(e);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const o=t[r];o!==void 0&&n.set(r,o)}return n.toString()}function ks(e){var t,n;const r=er();try{return e!=null&&e.url&&r.url&&new URL(e.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),e.url=r.url),(t=e?.icons)!=null&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter(o=>o!=="")),Ts(Yn(Yn({},r),e),{url:e?.url||r.url,name:e?.name||r.name,description:e?.description||r.description,icons:(n=e?.icons)!=null&&n.length&&e.icons.length>0?e.icons:r.icons})}catch(o){return console.warn("Error populating app metadata",o),e||r}}function er(){return ps.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Ds(e,t){var n;const r=ke(),o={protocol:e,version:t,env:r};return r==="browser"&&(o.host=((n=ye.getLocation())==null?void 0:n.host)||"unknown"),o}function tr(){if(ke()===Q.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:n,Version:r}=global.Platform;return[n,r].join("-")}const e=hs.detect();if(e===null)return"unknown";const t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return e.type==="browser"?[t,e.name,e.version].join("-"):[t,e.version].join("-")}function nr(){var e;const t=ke();return t===Q.browser?[t,((e=ye.getLocation())==null?void 0:e.host)||"unknown"].join(":"):t}function rr(e,t,n){const r=tr(),o=nr();return[[e,t].join("-"),[Jn,n].join("-"),r,o].join("/")}function Hs({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:o,projectId:s,useOnCloseEvent:i,bundleId:c,packageName:f}){const u=n.split("?"),a=rr(e,t,r),l={auth:o,ua:a,projectId:s,useOnCloseEvent:i||void 0,packageName:f||void 0,bundleId:c||void 0},h=Qn(u[1]||"",l);return u[0]+"?"+h}function Vs(e){let t=(e.match(/^[^:]+(?=:\/\/)/gi)||[])[0];const n=typeof t<"u"?e.split("://")[1]:e;return t=t==="wss"?"https":"http",[t,n].join("://")}function Ms(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}function or(e,t=zt){return sr(e.split(Xn),t)}function qs(e){return or(e).join(vt)}function Se(e,t){return e.filter(n=>t.includes(n)).length===e.length}function sr(e,t=zt){return e.slice(Math.max(e.length-t,0))}function Fs(e){return Object.fromEntries(e.entries())}function Ks(e){return new Map(Object.entries(e))}function zs(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}const Gs=e=>e;function ir(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}function Zs(e){return e.split(vt).map(t=>ir(t)).join(vt)}function Ys(e=ze.FIVE_MINUTES,t){const n=ze.toMiliseconds(e||ze.FIVE_MINUTES);let r,o,s,i;return{resolve:c=>{s&&r&&(clearTimeout(s),r(c),i=Promise.resolve(c))},reject:c=>{s&&o&&(clearTimeout(s),o(c))},done:()=>new Promise((c,f)=>{if(i)return c(i);s=setTimeout(()=>{const u=new Error(t);i=Promise.reject(u),f(u)},n),r=c,o=f})}}function Ws(e,t,n){return new Promise(async(r,o)=>{const s=setTimeout(()=>o(new Error(n)),t);try{const i=await e;r(i)}catch(i){o(i)}clearTimeout(s)})}function Zt(e,t){if(typeof t=="string"&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(e.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${e}`)}function Xs(e){return Zt("topic",e)}function Js(e){return Zt("id",e)}function Qs(e){const[t,n]=e.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof n=="string")r.topic=n;else if(t==="id"&&Number.isInteger(Number(n)))r.id=Number(n);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function ei(e,t){return ze.fromMiliseconds((t||Date.now())+ze.toMiliseconds(e))}function ti(e){return Date.now()>=ze.toMiliseconds(e)}function ni(e,t){return`${e}${t?`:${t}`:""}`}function ce(e=[],t=[]){return[...new Set([...e,...t])]}async function ri({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;const o=typeof n=="string"?JSON.parse(n):n,s=o?.href;if(typeof s!="string")return;const i=cr(s,e,t),c=ke();if(c===Q.browser){if(!((r=ye.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}fr(i)}else c===Q.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(i)}catch(o){console.error(o)}}function cr(e,t,n){const r=`requestId=${t}&sessionTopic=${n}`;e.endsWith("/")&&(e=e.slice(0,-1));let o=`${e}`;if(e.startsWith("https://t.me")){const s=e.includes("?")?"&startapp=":"?startapp=";o=`${o}${s}${lr(r,!0)}`}else o=`${o}/wc?${r}`;return o}function fr(e){let t="_self";ur()?t="_top":(ar()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function oi(e,t){let n="";try{if(Ge()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function Yt(e,t){return e.filter(n=>t.includes(n))}function si(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function ii(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function ci(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function ar(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function ur(){try{return window.self!==window.top}catch{return!1}}function lr(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function Wt(e){return Buffer.from(e,"base64").toString("utf-8")}function fi(e){return new Promise(t=>setTimeout(t,e))}const Et=BigInt(2**32-1),dr=BigInt(32);function hr(e,t=!1){return t?{h:Number(e&Et),l:Number(e>>dr&Et)}:{h:Number(e>>dr&Et)|0,l:Number(e&Et)|0}}function pr(e,t=!1){const n=e.length;let r=new Uint32Array(n),o=new Uint32Array(n);for(let s=0;s<n;s++){const{h:i,l:c}=hr(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const gr=(e,t,n)=>e>>>n,br=(e,t,n)=>e<<32-n|t>>>n,Be=(e,t,n)=>e>>>n|t<<32-n,Ie=(e,t,n)=>e<<32-n|t>>>n,ot=(e,t,n)=>e<<64-n|t>>>n-32,st=(e,t,n)=>e>>>n-32|t<<64-n,ai=(e,t)=>t,ui=(e,t)=>e,li=(e,t,n)=>e<<n|t>>>32-n,di=(e,t,n)=>t<<n|e>>>32-n,hi=(e,t,n)=>t<<n-32|e>>>64-n,pi=(e,t,n)=>e<<n-32|t>>>64-n;function le(e,t,n,r){const o=(t>>>0)+(r>>>0);return{h:e+n+(o/2**32|0)|0,l:o|0}}const Xt=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),Jt=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,gi=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),bi=(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,yi=(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0),mi=(e,t,n,r,o,s)=>t+n+r+o+s+(e/2**32|0)|0,Ze=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Qt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function me(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function fe(e,...t){if(!Qt(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function en(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");me(e.outputLen),me(e.blockLen)}function Ne(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function tn(e,t){fe(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function it(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ae(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function nn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function pe(e,t){return e<<32-t|e>>>t}const yr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function mr(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const we=yr?e=>e:e=>mr(e);function wi(e){for(let t=0;t<e.length;t++)e[t]=mr(e[t]);return e}const Oe=yr?e=>e:wi,wr=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",xi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ct(e){if(fe(e),wr)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=xi[e[n]];return t}const xe={_0:48,_9:57,A:65,F:70,a:97,f:102};function xr(e){if(e>=xe._0&&e<=xe._9)return e-xe._0;if(e>=xe.A&&e<=xe.F)return e-(xe.A-10);if(e>=xe.a&&e<=xe.f)return e-(xe.a-10)}function rn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(wr)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let o=0,s=0;o<n;o++,s+=2){const i=xr(e.charCodeAt(s)),c=xr(e.charCodeAt(s+1));if(i===void 0||c===void 0){const f=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+s)}r[o]=i*16+c}return r}function vi(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function de(e){return typeof e=="string"&&(e=vi(e)),fe(e),e}function De(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];fe(o),t+=o.length}const n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){const s=e[r];n.set(s,o),o+=s.length}return n}class At{}function ft(e){const t=r=>e().update(de(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Ei(e){const t=(r,o)=>e(o).update(de(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function Ye(e=32){if(Ze&&typeof Ze.getRandomValues=="function")return Ze.getRandomValues(new Uint8Array(e));if(Ze&&typeof Ze.randomBytes=="function")return Uint8Array.from(Ze.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Ai=BigInt(0),at=BigInt(1),Si=BigInt(2),Bi=BigInt(7),Ii=BigInt(256),Ni=BigInt(113),vr=[],Er=[],Ar=[];for(let e=0,t=at,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],vr.push(2*(5*r+n)),Er.push((e+1)*(e+2)/2%64);let o=Ai;for(let s=0;s<7;s++)t=(t<<at^(t>>Bi)*Ni)%Ii,t&Si&&(o^=at<<(at<<BigInt(s))-at);Ar.push(o)}const Sr=pr(Ar,!0),Oi=Sr[0],Ui=Sr[1],Br=(e,t,n)=>n>32?hi(e,t,n):li(e,t,n),Ir=(e,t,n)=>n>32?pi(e,t,n):di(e,t,n);function _i(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){const c=(i+8)%10,f=(i+2)%10,u=n[f],a=n[f+1],l=Br(u,a,1)^n[c],h=Ir(u,a,1)^n[c+1];for(let g=0;g<50;g+=10)e[i+g]^=l,e[i+g+1]^=h}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=Er[i],f=Br(o,s,c),u=Ir(o,s,c),a=vr[i];o=e[a],s=e[a+1],e[a]=f,e[a+1]=u}for(let i=0;i<50;i+=10){for(let c=0;c<10;c++)n[c]=e[i+c];for(let c=0;c<10;c++)e[i+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=Oi[r],e[1]^=Ui[r]}ae(n)}class Hn extends At{constructor(t,n,r,o=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=s,me(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=it(this.state)}clone(){return this._cloneInto()}keccak(){Oe(this.state32),_i(this.state32,this.rounds),Oe(this.state32),this.posOut=0,this.pos=0}update(t){Ne(this),t=de(t),fe(t);const{blockLen:n,state:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(n-this.pos,o-s);for(let c=0;c<i;c++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,(n&128)!==0&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Ne(this,!1),fe(t),this.finish();const n=this.state,{blockLen:r}=this;for(let o=0,s=t.length;o<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-o);t.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return me(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(tn(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ae(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Hn(n,r,o,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=o,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Ri=(e,t,n)=>ft(()=>new Hn(t,e,n)),Ti=Ri(1,136,256/8);function Ci(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),f=r?4:0,u=r?0:4;e.setUint32(t+f,i,r),e.setUint32(t+u,c,r)}function $i(e,t,n){return e&t^~e&n}function Li(e,t,n){return e&t^e&n^t&n}class Nr extends At{constructor(t,n,r,o){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.buffer=new Uint8Array(t),this.view=nn(this.buffer)}update(t){Ne(this),t=de(t),fe(t);const{view:n,buffer:r,blockLen:o}=this,s=t.length;for(let i=0;i<s;){const c=Math.min(o-this.pos,s-i);if(c===o){const f=nn(t);for(;o<=s-i;i+=o)this.process(f,i);continue}r.set(t.subarray(i,i+c),this.pos),this.pos+=c,i+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ne(this),tn(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ae(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let l=i;l<o;l++)n[l]=0;Ci(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=nn(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=f/4,a=this.get();if(u>a.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<u;l++)c.setUint32(4*l,a[l],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:o,finished:s,destroyed:i,pos:c}=this;return t.destroyed=i,t.finished=s,t.length=o,t.pos=c,o%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Ue=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),W=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),X=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),ji=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),_e=new Uint32Array(64);class Pi extends Nr{constructor(t=32){super(64,t,8,!1),this.A=Ue[0]|0,this.B=Ue[1]|0,this.C=Ue[2]|0,this.D=Ue[3]|0,this.E=Ue[4]|0,this.F=Ue[5]|0,this.G=Ue[6]|0,this.H=Ue[7]|0}get(){const{A:t,B:n,C:r,D:o,E:s,F:i,G:c,H:f}=this;return[t,n,r,o,s,i,c,f]}set(t,n,r,o,s,i,c,f){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=s|0,this.F=i|0,this.G=c|0,this.H=f|0}process(t,n){for(let l=0;l<16;l++,n+=4)_e[l]=t.getUint32(n,!1);for(let l=16;l<64;l++){const h=_e[l-15],g=_e[l-2],m=pe(h,7)^pe(h,18)^h>>>3,b=pe(g,17)^pe(g,19)^g>>>10;_e[l]=b+_e[l-7]+m+_e[l-16]|0}let{A:r,B:o,C:s,D:i,E:c,F:f,G:u,H:a}=this;for(let l=0;l<64;l++){const h=pe(c,6)^pe(c,11)^pe(c,25),g=a+h+$i(c,f,u)+ji[l]+_e[l]|0,b=(pe(r,2)^pe(r,13)^pe(r,22))+Li(r,o,s)|0;a=u,u=f,f=c,c=i+g|0,i=s,s=o,o=r,r=g+b|0}r=r+this.A|0,o=o+this.B|0,s=s+this.C|0,i=i+this.D|0,c=c+this.E|0,f=f+this.F|0,u=u+this.G|0,a=a+this.H|0,this.set(r,o,s,i,c,f,u,a)}roundClean(){ae(_e)}destroy(){this.set(0,0,0,0,0,0,0,0),ae(this.buffer)}}const Or=pr(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))),ki=Or[0],Di=Or[1],Re=new Uint32Array(80),Te=new Uint32Array(80);class on extends Nr{constructor(t=64){super(128,t,16,!1),this.Ah=X[0]|0,this.Al=X[1]|0,this.Bh=X[2]|0,this.Bl=X[3]|0,this.Ch=X[4]|0,this.Cl=X[5]|0,this.Dh=X[6]|0,this.Dl=X[7]|0,this.Eh=X[8]|0,this.El=X[9]|0,this.Fh=X[10]|0,this.Fl=X[11]|0,this.Gh=X[12]|0,this.Gl=X[13]|0,this.Hh=X[14]|0,this.Hl=X[15]|0}get(){const{Ah:t,Al:n,Bh:r,Bl:o,Ch:s,Cl:i,Dh:c,Dl:f,Eh:u,El:a,Fh:l,Fl:h,Gh:g,Gl:m,Hh:b,Hl:v}=this;return[t,n,r,o,s,i,c,f,u,a,l,h,g,m,b,v]}set(t,n,r,o,s,i,c,f,u,a,l,h,g,m,b,v){this.Ah=t|0,this.Al=n|0,this.Bh=r|0,this.Bl=o|0,this.Ch=s|0,this.Cl=i|0,this.Dh=c|0,this.Dl=f|0,this.Eh=u|0,this.El=a|0,this.Fh=l|0,this.Fl=h|0,this.Gh=g|0,this.Gl=m|0,this.Hh=b|0,this.Hl=v|0}process(t,n){for(let $=0;$<16;$++,n+=4)Re[$]=t.getUint32(n),Te[$]=t.getUint32(n+=4);for(let $=16;$<80;$++){const D=Re[$-15]|0,_=Te[$-15]|0,P=Be(D,_,1)^Be(D,_,8)^gr(D,_,7),k=Ie(D,_,1)^Ie(D,_,8)^br(D,_,7),T=Re[$-2]|0,d=Te[$-2]|0,w=Be(T,d,19)^ot(T,d,61)^gr(T,d,6),p=Ie(T,d,19)^st(T,d,61)^br(T,d,6),y=gi(k,p,Te[$-7],Te[$-16]),x=bi(y,P,w,Re[$-7],Re[$-16]);Re[$]=x|0,Te[$]=y|0}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:c,Cl:f,Dh:u,Dl:a,Eh:l,El:h,Fh:g,Fl:m,Gh:b,Gl:v,Hh:L,Hl:q}=this;for(let $=0;$<80;$++){const D=Be(l,h,14)^Be(l,h,18)^ot(l,h,41),_=Ie(l,h,14)^Ie(l,h,18)^st(l,h,41),P=l&g^~l&b,k=h&m^~h&v,T=yi(q,_,k,Di[$],Te[$]),d=mi(T,L,D,P,ki[$],Re[$]),w=T|0,p=Be(r,o,28)^ot(r,o,34)^ot(r,o,39),y=Ie(r,o,28)^st(r,o,34)^st(r,o,39),x=r&s^r&c^s&c,A=o&i^o&f^i&f;L=b|0,q=v|0,b=g|0,v=m|0,g=l|0,m=h|0,{h:l,l:h}=le(u|0,a|0,d|0,w|0),u=c|0,a=f|0,c=s|0,f=i|0,s=r|0,i=o|0;const E=Xt(w,y,A);r=Jt(E,d,p,x),o=E|0}({h:r,l:o}=le(this.Ah|0,this.Al|0,r|0,o|0)),{h:s,l:i}=le(this.Bh|0,this.Bl|0,s|0,i|0),{h:c,l:f}=le(this.Ch|0,this.Cl|0,c|0,f|0),{h:u,l:a}=le(this.Dh|0,this.Dl|0,u|0,a|0),{h:l,l:h}=le(this.Eh|0,this.El|0,l|0,h|0),{h:g,l:m}=le(this.Fh|0,this.Fl|0,g|0,m|0),{h:b,l:v}=le(this.Gh|0,this.Gl|0,b|0,v|0),{h:L,l:q}=le(this.Hh|0,this.Hl|0,L|0,q|0),this.set(r,o,s,i,c,f,u,a,l,h,g,m,b,v,L,q)}roundClean(){ae(Re,Te)}destroy(){ae(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class Hi extends on{constructor(){super(48),this.Ah=W[0]|0,this.Al=W[1]|0,this.Bh=W[2]|0,this.Bl=W[3]|0,this.Ch=W[4]|0,this.Cl=W[5]|0,this.Dh=W[6]|0,this.Dl=W[7]|0,this.Eh=W[8]|0,this.El=W[9]|0,this.Fh=W[10]|0,this.Fl=W[11]|0,this.Gh=W[12]|0,this.Gl=W[13]|0,this.Hh=W[14]|0,this.Hl=W[15]|0}}const J=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Vi extends on{constructor(){super(32),this.Ah=J[0]|0,this.Al=J[1]|0,this.Bh=J[2]|0,this.Bl=J[3]|0,this.Ch=J[4]|0,this.Cl=J[5]|0,this.Dh=J[6]|0,this.Dl=J[7]|0,this.Eh=J[8]|0,this.El=J[9]|0,this.Fh=J[10]|0,this.Fl=J[11]|0,this.Gh=J[12]|0,this.Gl=J[13]|0,this.Hh=J[14]|0,this.Hl=J[15]|0}}const St=ft(()=>new Pi),Mi=ft(()=>new on),qi=ft(()=>new Hi),Fi=ft(()=>new Vi),Ki=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),z=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),N=new Uint32Array(32);function Ce(e,t,n,r,o,s){const i=o[s],c=o[s+1];let f=N[2*e],u=N[2*e+1],a=N[2*t],l=N[2*t+1],h=N[2*n],g=N[2*n+1],m=N[2*r],b=N[2*r+1],v=Xt(f,a,i);u=Jt(v,u,l,c),f=v|0,{Dh:b,Dl:m}={Dh:b^u,Dl:m^f},{Dh:b,Dl:m}={Dh:ai(b,m),Dl:ui(b)},{h:g,l:h}=le(g,h,b,m),{Bh:l,Bl:a}={Bh:l^g,Bl:a^h},{Bh:l,Bl:a}={Bh:Be(l,a,24),Bl:Ie(l,a,24)},N[2*e]=f,N[2*e+1]=u,N[2*t]=a,N[2*t+1]=l,N[2*n]=h,N[2*n+1]=g,N[2*r]=m,N[2*r+1]=b}function $e(e,t,n,r,o,s){const i=o[s],c=o[s+1];let f=N[2*e],u=N[2*e+1],a=N[2*t],l=N[2*t+1],h=N[2*n],g=N[2*n+1],m=N[2*r],b=N[2*r+1],v=Xt(f,a,i);u=Jt(v,u,l,c),f=v|0,{Dh:b,Dl:m}={Dh:b^u,Dl:m^f},{Dh:b,Dl:m}={Dh:Be(b,m,16),Dl:Ie(b,m,16)},{h:g,l:h}=le(g,h,b,m),{Bh:l,Bl:a}={Bh:l^g,Bl:a^h},{Bh:l,Bl:a}={Bh:ot(l,a,63),Bl:st(l,a,63)},N[2*e]=f,N[2*e+1]=u,N[2*t]=a,N[2*t+1]=l,N[2*n]=h,N[2*n+1]=g,N[2*r]=m,N[2*r+1]=b}function zi(e,t={},n,r,o){if(me(n),e<0||e>n)throw new Error("outputLen bigger than keyLen");const{key:s,salt:i,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>n))throw new Error("key length must be undefined or 1.."+n);if(i!==void 0&&i.length!==r)throw new Error("salt must be undefined or "+r);if(c!==void 0&&c.length!==o)throw new Error("personalization must be undefined or "+o)}class Gi extends At{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,me(t),me(n),this.blockLen=t,this.outputLen=n,this.buffer=new Uint8Array(t),this.buffer32=it(this.buffer)}update(t){Ne(this),t=de(t),fe(t);const{blockLen:n,buffer:r,buffer32:o}=this,s=t.length,i=t.byteOffset,c=t.buffer;for(let f=0;f<s;){this.pos===n&&(Oe(o),this.compress(o,0,!1),Oe(o),this.pos=0);const u=Math.min(n-this.pos,s-f),a=i+f;if(u===n&&!(a%4)&&f+u<s){const l=new Uint32Array(c,a,Math.floor((s-f)/4));Oe(l);for(let h=0;f+n<s;h+=o.length,f+=n)this.length+=n,this.compress(l,h,!1);Oe(l);continue}r.set(t.subarray(f,f+u),this.pos),this.pos+=u,this.length+=u,f+=u}return this}digestInto(t){Ne(this),tn(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,ae(this.buffer.subarray(n)),Oe(r),this.compress(r,0,!0),Oe(r);const o=it(t);this.get().forEach((s,i)=>o[i]=we(s))}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){const{buffer:n,length:r,finished:o,destroyed:s,outputLen:i,pos:c}=this;return t||(t=new this.constructor({dkLen:i})),t.set(...this.get()),t.buffer.set(n),t.destroyed=s,t.finished=o,t.length=r,t.pos=c,t.outputLen=i,t}clone(){return this._cloneInto()}}class Zi extends Gi{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=z[0]|0,this.v0h=z[1]|0,this.v1l=z[2]|0,this.v1h=z[3]|0,this.v2l=z[4]|0,this.v2h=z[5]|0,this.v3l=z[6]|0,this.v3h=z[7]|0,this.v4l=z[8]|0,this.v4h=z[9]|0,this.v5l=z[10]|0,this.v5h=z[11]|0,this.v6l=z[12]|0,this.v6h=z[13]|0,this.v7l=z[14]|0,this.v7h=z[15]|0,zi(n,t,64,16,16);let{key:r,personalization:o,salt:s}=t,i=0;if(r!==void 0&&(r=de(r),i=r.length),this.v0l^=this.outputLen|i<<8|65536|1<<24,s!==void 0){s=de(s);const c=it(s);this.v4l^=we(c[0]),this.v4h^=we(c[1]),this.v5l^=we(c[2]),this.v5h^=we(c[3])}if(o!==void 0){o=de(o);const c=it(o);this.v6l^=we(c[0]),this.v6h^=we(c[1]),this.v7l^=we(c[2]),this.v7h^=we(c[3])}if(r!==void 0){const c=new Uint8Array(this.blockLen);c.set(r),this.update(c)}}get(){let{v0l:t,v0h:n,v1l:r,v1h:o,v2l:s,v2h:i,v3l:c,v3h:f,v4l:u,v4h:a,v5l:l,v5h:h,v6l:g,v6h:m,v7l:b,v7h:v}=this;return[t,n,r,o,s,i,c,f,u,a,l,h,g,m,b,v]}set(t,n,r,o,s,i,c,f,u,a,l,h,g,m,b,v){this.v0l=t|0,this.v0h=n|0,this.v1l=r|0,this.v1h=o|0,this.v2l=s|0,this.v2h=i|0,this.v3l=c|0,this.v3h=f|0,this.v4l=u|0,this.v4h=a|0,this.v5l=l|0,this.v5h=h|0,this.v6l=g|0,this.v6h=m|0,this.v7l=b|0,this.v7h=v|0}compress(t,n,r){this.get().forEach((f,u)=>N[u]=f),N.set(z,16);let{h:o,l:s}=hr(BigInt(this.length));N[24]=z[8]^s,N[25]=z[9]^o,r&&(N[28]=~N[28],N[29]=~N[29]);let i=0;const c=Ki;for(let f=0;f<12;f++)Ce(0,4,8,12,t,n+2*c[i++]),$e(0,4,8,12,t,n+2*c[i++]),Ce(1,5,9,13,t,n+2*c[i++]),$e(1,5,9,13,t,n+2*c[i++]),Ce(2,6,10,14,t,n+2*c[i++]),$e(2,6,10,14,t,n+2*c[i++]),Ce(3,7,11,15,t,n+2*c[i++]),$e(3,7,11,15,t,n+2*c[i++]),Ce(0,5,10,15,t,n+2*c[i++]),$e(0,5,10,15,t,n+2*c[i++]),Ce(1,6,11,12,t,n+2*c[i++]),$e(1,6,11,12,t,n+2*c[i++]),Ce(2,7,8,13,t,n+2*c[i++]),$e(2,7,8,13,t,n+2*c[i++]),Ce(3,4,9,14,t,n+2*c[i++]),$e(3,4,9,14,t,n+2*c[i++]);this.v0l^=N[0]^N[16],this.v0h^=N[1]^N[17],this.v1l^=N[2]^N[18],this.v1h^=N[3]^N[19],this.v2l^=N[4]^N[20],this.v2h^=N[5]^N[21],this.v3l^=N[6]^N[22],this.v3h^=N[7]^N[23],this.v4l^=N[8]^N[24],this.v4h^=N[9]^N[25],this.v5l^=N[10]^N[26],this.v5h^=N[11]^N[27],this.v6l^=N[12]^N[28],this.v6h^=N[13]^N[29],this.v7l^=N[14]^N[30],this.v7h^=N[15]^N[31],ae(N)}destroy(){this.destroyed=!0,ae(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Yi=Ei(e=>new Zi(e)),Wi="https://rpc.walletconnect.org/v1";function sn(e){const t=`Ethereum Signed Message:
${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(Ti(n)).toString("hex")}async function Ur(e,t,n,r,o,s){switch(n.t){case"eip191":return await _r(e,t,n.s);case"eip1271":return await Rr(e,t,n.s,r,o,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}async function _r(e,t,n){return(await gs.recoverAddress({hash:sn(t),signature:n})).toLowerCase()===e.toLowerCase()}async function Rr(e,t,n,r,o,s){const i=qt(r);if(!i.namespace||!i.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const c="0x1626ba7e",f="0000000000000000000000000000000000000000000000000000000000000040",u=n.substring(2),a=(u.length/2).toString(16).padStart(64,"0"),l=(t.startsWith("0x")?t:sn(t)).substring(2),h=c+l+f+a+u,g=await fetch(`${s||Wi}/?chainId=${r}&projectId=${o}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Xi(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:h},"latest"]})}),{result:m}=await g.json();return m?m.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function Xi(){return Date.now()+Math.floor(Math.random()*1e3)}function Ji(e){const t=atob(e),n=new Uint8Array(t.length);for(let i=0;i<t.length;i++)n[i]=t.charCodeAt(i);const r=n[0];if(r===0)throw new Error("No signatures found");const o=1+r*64;if(n.length<o)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const s=Buffer.from(e,"base64").slice(1,65);return rt.default.encode(s)}function Qi(e){const t=new Uint8Array(Buffer.from(e,"base64")),n=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),r=new Uint8Array(n.length+t.length);r.set(n),r.set(t,n.length);const o=Yi(r,{dkLen:32});return rt.default.encode(o)}function ec(e){const t=new Uint8Array(St(Tr(e)));return rt.default.encode(t)}function Tr(e){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return new Uint8Array(e);if(typeof e=="object"&&e!=null&&e.data)return new Uint8Array(Object.values(e.data));if(typeof e=="object"&&e)return new Uint8Array(Object.values(e));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function tc(e){const t=Buffer.from(e,"base64"),n=Vn.decode(t).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const r=Vn.encode(n),o=Buffer.from("TX"),s=Buffer.concat([o,Buffer.from(r)]),i=Fi(s);return ys.base32.encode(i).replace(/=+$/,"")}function cn(e){const t=[];let n=BigInt(e);for(;n>=BigInt(128);)t.push(Number(n&BigInt(127)|BigInt(128))),n>>=BigInt(7);return t.push(Number(n)),Buffer.from(t)}function nc(e){const t=Buffer.from(e.signed.bodyBytes,"base64"),n=Buffer.from(e.signed.authInfoBytes,"base64"),r=Buffer.from(e.signature.signature,"base64"),o=[];o.push(Buffer.from([10])),o.push(cn(t.length)),o.push(t),o.push(Buffer.from([18])),o.push(cn(n.length)),o.push(n),o.push(Buffer.from([26])),o.push(cn(r.length)),o.push(r);const s=Buffer.concat(o),i=St(s);return Buffer.from(i).toString("hex").toUpperCase()}var rc=Object.defineProperty,oc=Object.defineProperties,sc=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertySymbols,ic=Object.prototype.hasOwnProperty,cc=Object.prototype.propertyIsEnumerable,$r=(e,t,n)=>t in e?rc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fn=(e,t)=>{for(var n in t||(t={}))ic.call(t,n)&&$r(e,n,t[n]);if(Cr)for(var n of Cr(t))cc.call(t,n)&&$r(e,n,t[n]);return e},Lr=(e,t)=>oc(e,sc(t));const fc="did:pkh:",Bt=e=>e?.split(":"),jr=e=>{const t=e&&Bt(e);if(t)return e.includes(fc)?t[3]:t[1]},Pr=e=>{const t=e&&Bt(e);if(t)return t[2]+":"+t[3]},an=e=>{const t=e&&Bt(e);if(t)return t.pop()};async function ac(e){const{cacao:t,projectId:n}=e,{s:r,p:o}=t,s=kr(o,o.iss),i=an(o.iss);return await Ur(i,s,r,Pr(o.iss),n)}const kr=(e,t)=>{const n=`${e.domain} wants you to sign in with your Ethereum account:`,r=an(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let o=e.statement||void 0;const s=`URI: ${e.aud||e.uri}`,i=`Version: ${e.version}`,c=`Chain ID: ${jr(t)}`,f=`Nonce: ${e.nonce}`,u=`Issued At: ${e.iat}`,a=e.exp?`Expiration Time: ${e.exp}`:void 0,l=e.nbf?`Not Before: ${e.nbf}`:void 0,h=e.requestId?`Request ID: ${e.requestId}`:void 0,g=e.resources?`Resources:${e.resources.map(b=>`
- ${b}`).join("")}`:void 0,m=Nt(e.resources);if(m){const b=Le(m);o=dn(o,b)}return[n,r,"",o,"",s,i,c,f,u,a,l,h,g].filter(b=>b!=null).join(`
`)};function uc(e,t,n){return n.includes("did:pkh:")||(n=`did:pkh:${n}`),{h:{t:"caip122"},p:{iss:n,domain:e.domain,aud:e.aud,version:e.version,nonce:e.nonce,iat:e.iat,statement:e.statement,requestId:e.requestId,resources:e.resources,nbf:e.nbf,exp:e.exp},s:t}}function lc(e){var t;const{authPayload:n,chains:r,methods:o}=e,s=n.statement||"";if(!(r!=null&&r.length))return n;const i=n.chains,c=Yt(i,r);if(!(c!=null&&c.length))throw new Error("No supported chains");const f=Dr(n.resources);if(!f)return n;ge(f);const u=Hr(f,"eip155");let a=n?.resources||[];if(u!=null&&u.length){const l=Vr(u),h=Yt(l,o);if(!(h!=null&&h.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(l)}, supported: ${JSON.stringify(o)}`);const g=un("request",h,{chains:c}),m=Kr(f,"eip155",g);a=((t=n?.resources)==null?void 0:t.slice(0,-1))||[],a.push(It(m))}return Lr(fn({},n),{statement:Gr(s,Nt(a)),chains:c,resources:n!=null&&n.resources||a.length>0?a:void 0})}function Dr(e){const t=Nt(e);if(t&&ln(t))return Le(t)}function dc(e,t){var n;return(n=e?.att)==null?void 0:n.hasOwnProperty(t)}function Hr(e,t){var n,r;return(n=e?.att)!=null&&n[t]?Object.keys((r=e?.att)==null?void 0:r[t]):[]}function hc(e){return e?.map(t=>Object.keys(t))||[]}function Vr(e){return e?.map(t=>{var n;return(n=t.split("/"))==null?void 0:n[1]})||[]}function Mr(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function qr(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function ge(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");const t=Object.keys(e.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(n=>{const r=e.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(o=>{const s=r[o];if(!Array.isArray(s))throw new Error(`Ability limits ${o} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${o} is empty array, must be an array with objects`);s.forEach(i=>{if(typeof i!="object")throw new Error(`Ability limits (${o}) must be an array of objects, found: ${i}`)})})})}function Fr(e,t,n,r={}){return n?.sort((o,s)=>o.localeCompare(s)),{att:{[e]:un(t,n,r)}}}function Kr(e,t,n){var r;e.att[t]=fn({},n);const o=(r=Object.keys(e.att))==null?void 0:r.sort((i,c)=>i.localeCompare(c)),s={att:{}};return o.reduce((i,c)=>(i.att[c]=e.att[c],i),s)}function un(e,t,n={}){t=t?.sort((o,s)=>o.localeCompare(s));const r=t.map(o=>({[`${e}/${o}`]:[n]}));return Object.assign({},...r)}function It(e){return ge(e),`urn:recap:${Mr(e).replace(/=/g,"")}`}function Le(e){const t=qr(e.replace("urn:recap:",""));return ge(t),t}function pc(e,t,n){const r=Fr(e,t,n);return It(r)}function ln(e){return e&&e.includes("urn:recap:")}function gc(e,t){const n=Le(e),r=Le(t),o=zr(n,r);return It(o)}function zr(e,t){ge(e),ge(t);const n=Object.keys(e.att).concat(Object.keys(t.att)).sort((o,s)=>o.localeCompare(s)),r={att:{}};return n.forEach(o=>{var s,i;Object.keys(((s=e.att)==null?void 0:s[o])||{}).concat(Object.keys(((i=t.att)==null?void 0:i[o])||{})).sort((c,f)=>c.localeCompare(f)).forEach(c=>{var f,u;r.att[o]=Lr(fn({},r.att[o]),{[c]:((f=e.att[o])==null?void 0:f[c])||((u=t.att[o])==null?void 0:u[c])})})}),r}function dn(e="",t){ge(t);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;const r=[];let o=0;Object.keys(t.att).forEach(c=>{const f=Object.keys(t.att[c]).map(l=>({ability:l.split("/")[0],action:l.split("/")[1]}));f.sort((l,h)=>l.action.localeCompare(h.action));const u={};f.forEach(l=>{u[l.ability]||(u[l.ability]=[]),u[l.ability].push(l.action)});const a=Object.keys(u).map(l=>(o++,`(${o}) '${l}': '${u[l].join("', '")}' for '${c}'.`));r.push(a.join(", ").replace(".,","."))});const s=r.join(" "),i=`${n}${s}`;return`${e?e+" ":""}${i}`}function bc(e){var t;const n=Le(e);ge(n);const r=(t=n.att)==null?void 0:t.eip155;return r?Object.keys(r).map(o=>o.split("/")[1]):[]}function yc(e){const t=Le(e);ge(t);const n=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(o=>{var s;(s=o?.[0])!=null&&s.chains&&n.push(o[0].chains)})}),[...new Set(n.flat())]}function Gr(e,t){if(!t)return e;const n=Le(t);return ge(n),dn(e,n)}function Nt(e){if(!e)return;const t=e?.[e.length-1];return ln(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function Zr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function hn(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function pn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function re(e,...t){if(!Zr(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Yr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function mc(e,t){re(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function je(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function We(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function wc(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const xc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function vc(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function gn(e){if(typeof e=="string")e=vc(e);else if(Zr(e))e=bn(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function Ec(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function Ac(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}const Sc=(e,t)=>{function n(r,...o){if(re(r),!xc)throw new Error("Non little-endian hardware is not yet supported");if(e.nonceLength!==void 0){const a=o[0];if(!a)throw new Error("nonce / iv required");e.varSizeNonce?re(a):re(a,e.nonceLength)}const s=e.tagLength;s&&o[1]!==void 0&&re(o[1]);const i=t(r,...o),c=(a,l)=>{if(l!==void 0){if(a!==2)throw new Error("cipher output not supported");re(l)}};let f=!1;return{encrypt(a,l){if(f)throw new Error("cannot encrypt() twice with same key + nonce");return f=!0,re(a),c(i.encrypt.length,l),i.encrypt(a,l)},decrypt(a,l){if(re(a),s&&a.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(i.decrypt.length,l),i.decrypt(a,l)}}}return Object.assign(n,e),n};function Wr(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw new Error("invalid output length, expected "+e+", got: "+t.length);if(n&&!Ic(t))throw new Error("invalid output, must be aligned");return t}function Xr(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const o=BigInt(32),s=BigInt(4294967295),i=Number(n>>o&s),c=Number(n&s),f=r?4:0,u=r?0:4;e.setUint32(t+f,i,r),e.setUint32(t+u,c,r)}function Bc(e,t,n){hn(n);const r=new Uint8Array(16),o=wc(r);return Xr(o,0,BigInt(t),n),Xr(o,8,BigInt(e),n),r}function Ic(e){return e.byteOffset%4===0}function bn(e){return Uint8Array.from(e)}const Jr=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),Nc=Jr("expand 16-byte k"),Oc=Jr("expand 32-byte k"),Uc=je(Nc),_c=je(Oc);function V(e,t){return e<<t|e>>>32-t}function yn(e){return e.byteOffset%4===0}const Ot=64,Rc=16,Qr=2**32-1,eo=new Uint32Array;function Tc(e,t,n,r,o,s,i,c){const f=o.length,u=new Uint8Array(Ot),a=je(u),l=yn(o)&&yn(s),h=l?je(o):eo,g=l?je(s):eo;for(let m=0;m<f;i++){if(e(t,n,r,a,i,c),i>=Qr)throw new Error("arx: counter overflow");const b=Math.min(Ot,f-m);if(l&&b===Ot){const v=m/4;if(m%4!==0)throw new Error("arx: invalid block position");for(let L=0,q;L<Rc;L++)q=v+L,g[q]=h[q]^a[L];m+=Ot;continue}for(let v=0,L;v<b;v++)L=m+v,s[L]=o[L]^u[v];m+=b}}function Cc(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:s,rounds:i}=Ec({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return pn(o),pn(i),hn(s),hn(n),(c,f,u,a,l=0)=>{re(c),re(f),re(u);const h=u.length;if(a===void 0&&(a=new Uint8Array(h)),re(a),pn(l),l<0||l>=Qr)throw new Error("arx: counter overflow");if(a.length<h)throw new Error(`arx: output (${a.length}) is shorter than data (${h})`);const g=[];let m=c.length,b,v;if(m===32)g.push(b=bn(c)),v=_c;else if(m===16&&n)b=new Uint8Array(32),b.set(c),b.set(c,16),v=Uc,g.push(b);else throw new Error(`arx: invalid 32-byte key, got length=${m}`);yn(f)||g.push(f=bn(f));const L=je(b);if(r){if(f.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(v,L,je(f.subarray(0,16)),L),f=f.subarray(16)}const q=16-o;if(q!==f.length)throw new Error(`arx: nonce must be ${q} or 16 bytes`);if(q!==12){const D=new Uint8Array(12);D.set(f,s?0:12-f.length),f=D,g.push(f)}const $=je(f);return Tc(e,v,L,$,u,a,l,i),We(...g),a}}const Z=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class $c{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=gn(t),re(t,32);const n=Z(t,0),r=Z(t,2),o=Z(t,4),s=Z(t,6),i=Z(t,8),c=Z(t,10),f=Z(t,12),u=Z(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|o<<6)&7939,this.r[3]=(o>>>7|s<<9)&8191,this.r[4]=(s>>>4|i<<12)&255,this.r[5]=i>>>1&8190,this.r[6]=(i>>>14|c<<2)&8191,this.r[7]=(c>>>11|f<<5)&8065,this.r[8]=(f>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let a=0;a<8;a++)this.pad[a]=Z(t,16+2*a)}process(t,n,r=!1){const o=r?0:2048,{h:s,r:i}=this,c=i[0],f=i[1],u=i[2],a=i[3],l=i[4],h=i[5],g=i[6],m=i[7],b=i[8],v=i[9],L=Z(t,n+0),q=Z(t,n+2),$=Z(t,n+4),D=Z(t,n+6),_=Z(t,n+8),P=Z(t,n+10),k=Z(t,n+12),T=Z(t,n+14);let d=s[0]+(L&8191),w=s[1]+((L>>>13|q<<3)&8191),p=s[2]+((q>>>10|$<<6)&8191),y=s[3]+(($>>>7|D<<9)&8191),x=s[4]+((D>>>4|_<<12)&8191),A=s[5]+(_>>>1&8191),E=s[6]+((_>>>14|P<<2)&8191),S=s[7]+((P>>>11|k<<5)&8191),I=s[8]+((k>>>8|T<<8)&8191),O=s[9]+(T>>>5|o),B=0,R=B+d*c+w*(5*v)+p*(5*b)+y*(5*m)+x*(5*g);B=R>>>13,R&=8191,R+=A*(5*h)+E*(5*l)+S*(5*a)+I*(5*u)+O*(5*f),B+=R>>>13,R&=8191;let U=B+d*f+w*c+p*(5*v)+y*(5*b)+x*(5*m);B=U>>>13,U&=8191,U+=A*(5*g)+E*(5*h)+S*(5*l)+I*(5*a)+O*(5*u),B+=U>>>13,U&=8191;let C=B+d*u+w*f+p*c+y*(5*v)+x*(5*b);B=C>>>13,C&=8191,C+=A*(5*m)+E*(5*g)+S*(5*h)+I*(5*l)+O*(5*a),B+=C>>>13,C&=8191;let H=B+d*a+w*u+p*f+y*c+x*(5*v);B=H>>>13,H&=8191,H+=A*(5*b)+E*(5*m)+S*(5*g)+I*(5*h)+O*(5*l),B+=H>>>13,H&=8191;let F=B+d*l+w*a+p*u+y*f+x*c;B=F>>>13,F&=8191,F+=A*(5*v)+E*(5*b)+S*(5*m)+I*(5*g)+O*(5*h),B+=F>>>13,F&=8191;let j=B+d*h+w*l+p*a+y*u+x*f;B=j>>>13,j&=8191,j+=A*c+E*(5*v)+S*(5*b)+I*(5*m)+O*(5*g),B+=j>>>13,j&=8191;let K=B+d*g+w*h+p*l+y*a+x*u;B=K>>>13,K&=8191,K+=A*f+E*c+S*(5*v)+I*(5*b)+O*(5*m),B+=K>>>13,K&=8191;let ne=B+d*m+w*g+p*h+y*l+x*a;B=ne>>>13,ne&=8191,ne+=A*u+E*f+S*c+I*(5*v)+O*(5*b),B+=ne>>>13,ne&=8191;let Y=B+d*b+w*m+p*g+y*h+x*l;B=Y>>>13,Y&=8191,Y+=A*a+E*u+S*f+I*c+O*(5*v),B+=Y>>>13,Y&=8191;let G=B+d*v+w*b+p*m+y*g+x*h;B=G>>>13,G&=8191,G+=A*l+E*a+S*u+I*f+O*c,B+=G>>>13,G&=8191,B=(B<<2)+B|0,B=B+R|0,R=B&8191,B=B>>>13,U+=B,s[0]=R,s[1]=U,s[2]=C,s[3]=H,s[4]=F,s[5]=j,s[6]=K,s[7]=ne,s[8]=Y,s[9]=G}finalize(){const{h:t,pad:n}=this,r=new Uint16Array(10);let o=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=o,o=t[c]>>>13,t[c]&=8191;t[0]+=o*5,o=t[0]>>>13,t[0]&=8191,t[1]+=o,o=t[1]>>>13,t[1]&=8191,t[2]+=o,r[0]=t[0]+5,o=r[0]>>>13,r[0]&=8191;for(let c=1;c<10;c++)r[c]=t[c]+o,o=r[c]>>>13,r[c]&=8191;r[9]-=8192;let s=(o^1)-1;for(let c=0;c<10;c++)r[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|r[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let i=t[0]+n[0];t[0]=i&65535;for(let c=1;c<8;c++)i=(t[c]+n[c]|0)+(i>>>16)|0,t[c]=i&65535;We(r)}update(t){Yr(this),t=gn(t),re(t);const{buffer:n,blockLen:r}=this,o=t.length;for(let s=0;s<o;){const i=Math.min(r-this.pos,o-s);if(i===r){for(;r<=o-s;s+=r)this.process(t,s);continue}n.set(t.subarray(s,s+i),this.pos),this.pos+=i,s+=i,this.pos===r&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){We(this.h,this.r,this.buffer,this.pad)}digestInto(t){Yr(this),mc(t,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:o}=this;if(o){for(n[o++]=1;o<16;o++)n[o]=0;this.process(n,0,!0)}this.finalize();let s=0;for(let i=0;i<8;i++)t[s++]=r[i]>>>0,t[s++]=r[i]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}}function Lc(e){const t=(r,o)=>e(o).update(gn(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const jc=Lc(e=>new $c(e));function Pc(e,t,n,r,o,s=20){let i=e[0],c=e[1],f=e[2],u=e[3],a=t[0],l=t[1],h=t[2],g=t[3],m=t[4],b=t[5],v=t[6],L=t[7],q=o,$=n[0],D=n[1],_=n[2],P=i,k=c,T=f,d=u,w=a,p=l,y=h,x=g,A=m,E=b,S=v,I=L,O=q,B=$,R=D,U=_;for(let H=0;H<s;H+=2)P=P+w|0,O=V(O^P,16),A=A+O|0,w=V(w^A,12),P=P+w|0,O=V(O^P,8),A=A+O|0,w=V(w^A,7),k=k+p|0,B=V(B^k,16),E=E+B|0,p=V(p^E,12),k=k+p|0,B=V(B^k,8),E=E+B|0,p=V(p^E,7),T=T+y|0,R=V(R^T,16),S=S+R|0,y=V(y^S,12),T=T+y|0,R=V(R^T,8),S=S+R|0,y=V(y^S,7),d=d+x|0,U=V(U^d,16),I=I+U|0,x=V(x^I,12),d=d+x|0,U=V(U^d,8),I=I+U|0,x=V(x^I,7),P=P+p|0,U=V(U^P,16),S=S+U|0,p=V(p^S,12),P=P+p|0,U=V(U^P,8),S=S+U|0,p=V(p^S,7),k=k+y|0,O=V(O^k,16),I=I+O|0,y=V(y^I,12),k=k+y|0,O=V(O^k,8),I=I+O|0,y=V(y^I,7),T=T+x|0,B=V(B^T,16),A=A+B|0,x=V(x^A,12),T=T+x|0,B=V(B^T,8),A=A+B|0,x=V(x^A,7),d=d+w|0,R=V(R^d,16),E=E+R|0,w=V(w^E,12),d=d+w|0,R=V(R^d,8),E=E+R|0,w=V(w^E,7);let C=0;r[C++]=i+P|0,r[C++]=c+k|0,r[C++]=f+T|0,r[C++]=u+d|0,r[C++]=a+w|0,r[C++]=l+p|0,r[C++]=h+y|0,r[C++]=g+x|0,r[C++]=m+A|0,r[C++]=b+E|0,r[C++]=v+S|0,r[C++]=L+I|0,r[C++]=q+O|0,r[C++]=$+B|0,r[C++]=D+R|0,r[C++]=_+U|0}const kc=Cc(Pc,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Dc=new Uint8Array(16),to=(e,t)=>{e.update(t);const n=t.length%16;n&&e.update(Dc.subarray(n))},Hc=new Uint8Array(32);function no(e,t,n,r,o){const s=e(t,n,Hc),i=jc.create(s);o&&to(i,o),to(i,r);const c=Bc(r.length,o?o.length:0,!0);i.update(c);const f=i.digest();return We(s,c),f}const Vc=e=>(t,n,r)=>({encrypt(s,i){const c=s.length;i=Wr(c+16,i,!1),i.set(s);const f=i.subarray(0,-16);e(t,n,f,f,1);const u=no(e,t,n,f,r);return i.set(u,c),We(u),i},decrypt(s,i){i=Wr(s.length-16,i,!1);const c=s.subarray(0,-16),f=s.subarray(-16),u=no(e,t,n,c,r);if(!Ac(f,u))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),e(t,n,i,i,1),We(u),i}}),ro=Sc({blockSize:64,nonceLength:12,tagLength:16},Vc(kc));class oo extends At{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,en(t);const r=de(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends u