UNPKG

@walletconnect/utils

Version:
4 lines • 112 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var Ps=require("detect-browser"),We=require("@walletconnect/time"),ye=require("@walletconnect/window-getters"),ks=require("@walletconnect/window-metadata"),Qn=require("ox"),Ds=require("bs58"),er=require("@msgpack/msgpack"),Hs=require("@scure/base"),Vs=require("@walletconnect/relay-auth"),F=require("uint8arrays"),Ms=require("@walletconnect/relay-api"),qs=require("blakejs"),Ks=require("@walletconnect/logger");function Fs(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var ut=Fs(Ds);const Bt=":";function Wt(e){const[t,n]=e.split(Bt);return{namespace:t,reference:n}}function tr(e){const{namespace:t,reference:n}=e;return[t,n].join(Bt)}function Xt(e){const[t,n,r]=e.split(Bt);return{namespace:t,reference:n,address:r}}function nr(e){const{namespace:t,reference:n,address:r}=e;return[t,n,r].join(Bt)}function Jt(e,t){const n=[];return e.forEach(r=>{const o=t(r);n.includes(o)||n.push(o)}),n}function rr(e){const{address:t}=Xt(e);return t}function or(e){const{namespace:t,reference:n}=Xt(e);return tr({namespace:t,reference:n})}function Zs(e,t){const{namespace:n,reference:r}=Wt(t);return nr({namespace:n,reference:r,address:e})}function Gs(e){return Jt(e,rr)}function sr(e){return Jt(e,or)}function zs(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 Ys(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...sr(o.accounts))}),n}function Ws(e,t=[]){const n=[];return Object.keys(e).forEach(r=>{if(t.length&&!t.includes(r))return;const o=e[r];n.push(...St(r,o))}),n}function St(e,t){return e.includes(":")?[e]:t.chains||[]}var Xs=Object.defineProperty,Js=Object.defineProperties,Qs=Object.getOwnPropertyDescriptors,ir=Object.getOwnPropertySymbols,ei=Object.prototype.hasOwnProperty,ti=Object.prototype.propertyIsEnumerable,Qt=(e,t,n)=>t in e?Xs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cr=(e,t)=>{for(var n in t||(t={}))ei.call(t,n)&&Qt(e,n,t[n]);if(ir)for(var n of ir(t))ti.call(t,n)&&Qt(e,n,t[n]);return e},ni=(e,t)=>Js(e,Qs(t)),fr=(e,t,n)=>Qt(e,typeof t!="symbol"?t+"":t,n);const ar="ReactNative",ne={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},It=" ",ri=":",ur="/",en=2,oi=1e3,lr="js";function tn(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function Be(){return!ye.getDocument()&&!!ye.getNavigator()&&navigator.product===ar}function si(){return Be()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function ii(){return Be()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function Xe(){return!tn()&&!!ye.getNavigator()&&!!ye.getDocument()}function Ve(){return Be()?ne.reactNative:tn()?ne.node:Xe()?ne.browser:ne.unknown}function ci(){var e;try{return Be()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(e=global.Application)==null?void 0:e.applicationId:void 0}catch{return}}function dr(e,t){const n=new URLSearchParams(e);return Object.entries(t).sort(([r],[o])=>r.localeCompare(o)).forEach(([r,o])=>{o!=null&&n.set(r,String(o))}),n.toString()}function fi(e){var t,n;const r=hr();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!=="")),ni(cr(cr({},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 hr(){return ks.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function ai(e,t){var n;const r=Ve(),o={protocol:e,version:t,env:r};return r==="browser"&&(o.host=((n=ye.getLocation())==null?void 0:n.host)||"unknown"),o}function pr(){if(Ve()===ne.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=Ps.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 gr(){var e;const t=Ve();return t===ne.browser?[t,((e=ye.getLocation())==null?void 0:e.host)||"unknown"].join(":"):t}function br(e,t,n){const r=pr(),o=gr();return[[e,t].join("-"),[lr,n].join("-"),r,o].join("/")}function ui({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:o,projectId:s,useOnCloseEvent:i,bundleId:c,packageName:f}){const u=n.split("?"),a=br(e,t,r),l={auth:o,ua:a,projectId:s,useOnCloseEvent:i||void 0,packageName:f||void 0,bundleId:c||void 0},d=dr(u[1]||"",l);return u[0]+"?"+d}function li(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 di(e,t,n){if(!e[t]||typeof e[t]!==n)throw new Error(`Missing or invalid "${t}" param`)}function yr(e,t=en){return mr(e.split(ur),t)}function hi(e){return yr(e).join(It)}function Se(e,t){return e.filter(n=>t.includes(n)).length===e.length}function mr(e,t=en){return e.slice(Math.max(e.length-t,0))}function pi(e){return Object.fromEntries(e.entries())}function gi(e){return new Map(Object.entries(e))}function bi(e,t){const n={};return Object.keys(e).forEach(r=>{n[r]=t(e[r])}),n}const yi=e=>e;function wr(e){return e.trim().replace(/^\w/,t=>t.toUpperCase())}function mi(e){return e.split(It).map(t=>wr(t)).join(It)}function wi(e=We.FIVE_MINUTES,t){const n=We.toMiliseconds(e||We.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 vi(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 nn(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 Ei(e){return nn("topic",e)}function xi(e){return nn("id",e)}function Ai(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 Bi(e,t){return We.fromMiliseconds((t||Date.now())+We.toMiliseconds(e))}function Si(e){return Date.now()>=We.toMiliseconds(e)}function Ii(e,t){return`${e}${t?`:${t}`:""}`}function ae(e=[],t=[]){return[...new Set([...e,...t])]}async function Ni({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=vr(s,e,t),c=Ve();if(c===ne.browser){if(!((r=ye.getDocument())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Er(i)}else c===ne.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(i)}catch(o){console.error(o)}}function vr(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}${Br(r,!0)}`}else o=`${o}/wc?${r}`;return o}function Er(e){let t="_self";Ar()?t="_top":(xr()||e.startsWith("https://")||e.startsWith("http://"))&&(t="_blank"),window.open(e,t,"noreferrer noopener")}async function Oi(e,t){let n="";try{if(Xe()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(r){console.error(r)}return n}function rn(e,t){return e.filter(n=>t.includes(n))}function Ri(e,t){if(!e.includes(t))return null;const n=e.split(/([&,?,=])/),r=n.indexOf(t);return n[r+2]}function Ui(){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 _i(){return typeof process<"u"&&process.env.IS_VITEST==="true"}function xr(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Ar(){try{return window.self!==window.top}catch{return!1}}function Br(e,t=!1){const n=Buffer.from(e).toString("base64");return t?n.replace(/[=]/g,""):n}function on(e){return Buffer.from(e,"base64").toString("utf-8")}function Ti(e){return new Promise(t=>setTimeout(t,e))}class Ci{constructor({limit:t}){fr(this,"limit"),fr(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(t)}}has(t){return this.set.has(t)}}const Nt=BigInt(2**32-1),Sr=BigInt(32);function Ir(e,t=!1){return t?{h:Number(e&Nt),l:Number(e>>Sr&Nt)}:{h:Number(e>>Sr&Nt)|0,l:Number(e&Nt)|0}}function Nr(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}=Ir(e[s],t);[r[s],o[s]]=[i,c]}return[r,o]}const Or=(e,t,n)=>e>>>n,Rr=(e,t,n)=>e<<32-n|t>>>n,Ie=(e,t,n)=>e>>>n|t<<32-n,Ne=(e,t,n)=>e<<32-n|t>>>n,lt=(e,t,n)=>e<<64-n|t>>>n-32,dt=(e,t,n)=>e>>>n-32|t<<64-n,$i=(e,t)=>t,Li=(e,t)=>e,ji=(e,t,n)=>e<<n|t>>>32-n,Pi=(e,t,n)=>t<<n|e>>>32-n,ki=(e,t,n)=>t<<n-32|e>>>64-n,Di=(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 sn=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),cn=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,Hi=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),Vi=(e,t,n,r,o)=>t+n+r+o+(e/2**32|0)|0,Mi=(e,t,n,r,o)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(o>>>0),qi=(e,t,n,r,o,s)=>t+n+r+o+s+(e/2**32|0)|0,Je=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Ot(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 de(e,...t){if(!Ot(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 Rt(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 Oe(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 fn(e,t){de(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function ht(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ue(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function an(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ge(e,t){return e<<32-t|e>>>t}const Ur=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function _r(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}const we=Ur?e=>e:e=>_r(e);function Ki(e){for(let t=0;t<e.length;t++)e[t]=_r(e[t]);return e}const Re=Ur?e=>e:Ki,Tr=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Fi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Qe(e){if(de(e),Tr)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Fi[e[n]];return t}const ve={_0:48,_9:57,A:65,F:70,a:97,f:102};function Cr(e){if(e>=ve._0&&e<=ve._9)return e-ve._0;if(e>=ve.A&&e<=ve.F)return e-(ve.A-10);if(e>=ve.a&&e<=ve.f)return e-(ve.a-10)}function Ut(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Tr)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=Cr(e.charCodeAt(s)),c=Cr(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 $r(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function he(e){return typeof e=="string"&&(e=$r(e)),de(e),e}function Ue(...e){let t=0;for(let r=0;r<e.length;r++){const o=e[r];de(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 _t{}function pt(e){const t=r=>e().update(he(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Zi(e){const t=(r,o)=>e(o).update(he(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}function Me(e=32){if(Je&&typeof Je.getRandomValues=="function")return Je.getRandomValues(new Uint8Array(e));if(Je&&typeof Je.randomBytes=="function")return Uint8Array.from(Je.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Gi=BigInt(0),gt=BigInt(1),zi=BigInt(2),Yi=BigInt(7),Wi=BigInt(256),Xi=BigInt(113),Lr=[],jr=[],Pr=[];for(let e=0,t=gt,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Lr.push(2*(5*r+n)),jr.push((e+1)*(e+2)/2%64);let o=Gi;for(let s=0;s<7;s++)t=(t<<gt^(t>>Yi)*Xi)%Wi,t&zi&&(o^=gt<<(gt<<BigInt(s))-gt);Pr.push(o)}const kr=Nr(Pr,!0),Ji=kr[0],Qi=kr[1],Dr=(e,t,n)=>n>32?ki(e,t,n):ji(e,t,n),Hr=(e,t,n)=>n>32?Di(e,t,n):Pi(e,t,n);function ec(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=Dr(u,a,1)^n[c],d=Hr(u,a,1)^n[c+1];for(let h=0;h<50;h+=10)e[i+h]^=l,e[i+h+1]^=d}let o=e[2],s=e[3];for(let i=0;i<24;i++){const c=jr[i],f=Dr(o,s,c),u=Hr(o,s,c),a=Lr[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]^=Ji[r],e[1]^=Qi[r]}ue(n)}class Wn extends _t{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=ht(this.state)}clone(){return this._cloneInto()}keccak(){Re(this.state32),ec(this.state32,this.rounds),Re(this.state32),this.posOut=0,this.pos=0}update(t){Oe(this),t=he(t),de(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){Oe(this,!1),de(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(fn(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,ue(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:o,rounds:s,enableXOF:i}=this;return t||(t=new Wn(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 tc=(e,t,n)=>pt(()=>new Wn(t,e,n)),nc=tc(1,136,256/8);function rc(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 oc(e,t,n){return e&t^~e&n}function sc(e,t,n){return e&t^e&n^t&n}class Vr extends _t{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=an(this.buffer)}update(t){Oe(this),t=he(t),de(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=an(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){Oe(this),fn(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:o,isLE:s}=this;let{pos:i}=this;n[i++]=128,ue(this.buffer.subarray(i)),this.padOffset>o-i&&(this.process(r,0),i=0);for(let l=i;l<o;l++)n[l]=0;rc(r,o-8,BigInt(this.length*8),s),this.process(r,0);const c=an(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 _e=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),J=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Q=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),ic=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]),Te=new Uint32Array(64);class cc extends Vr{constructor(t=32){super(64,t,8,!1),this.A=_e[0]|0,this.B=_e[1]|0,this.C=_e[2]|0,this.D=_e[3]|0,this.E=_e[4]|0,this.F=_e[5]|0,this.G=_e[6]|0,this.H=_e[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)Te[l]=t.getUint32(n,!1);for(let l=16;l<64;l++){const d=Te[l-15],h=Te[l-2],y=ge(d,7)^ge(d,18)^d>>>3,m=ge(h,17)^ge(h,19)^h>>>10;Te[l]=m+Te[l-7]+y+Te[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 d=ge(c,6)^ge(c,11)^ge(c,25),h=a+d+oc(c,f,u)+ic[l]+Te[l]|0,m=(ge(r,2)^ge(r,13)^ge(r,22))+sc(r,o,s)|0;a=u,u=f,f=c,c=i+h|0,i=s,s=o,o=r,r=h+m|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(){ue(Te)}destroy(){this.set(0,0,0,0,0,0,0,0),ue(this.buffer)}}const Mr=Nr(["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))),fc=Mr[0],ac=Mr[1],Ce=new Uint32Array(80),$e=new Uint32Array(80);class un extends Vr{constructor(t=64){super(128,t,16,!1),this.Ah=Q[0]|0,this.Al=Q[1]|0,this.Bh=Q[2]|0,this.Bl=Q[3]|0,this.Ch=Q[4]|0,this.Cl=Q[5]|0,this.Dh=Q[6]|0,this.Dl=Q[7]|0,this.Eh=Q[8]|0,this.El=Q[9]|0,this.Fh=Q[10]|0,this.Fl=Q[11]|0,this.Gh=Q[12]|0,this.Gl=Q[13]|0,this.Hh=Q[14]|0,this.Hl=Q[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:d,Gh:h,Gl:y,Hh:m,Hl:w}=this;return[t,n,r,o,s,i,c,f,u,a,l,d,h,y,m,w]}set(t,n,r,o,s,i,c,f,u,a,l,d,h,y,m,w){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=d|0,this.Gh=h|0,this.Gl=y|0,this.Hh=m|0,this.Hl=w|0}process(t,n){for(let _=0;_<16;_++,n+=4)Ce[_]=t.getUint32(n),$e[_]=t.getUint32(n+=4);for(let _=16;_<80;_++){const G=Ce[_-15]|0,D=$e[_-15]|0,L=Ie(G,D,1)^Ie(G,D,8)^Or(G,D,7),j=Ne(G,D,1)^Ne(G,D,8)^Rr(G,D,7),P=Ce[_-2]|0,N=$e[_-2]|0,C=Ie(P,N,19)^lt(P,N,61)^Or(P,N,6),$=Ne(P,N,19)^dt(P,N,61)^Rr(P,N,6),U=Hi(j,$,$e[_-7],$e[_-16]),p=Vi(U,L,C,Ce[_-7],Ce[_-16]);Ce[_]=p|0,$e[_]=U|0}let{Ah:r,Al:o,Bh:s,Bl:i,Ch:c,Cl:f,Dh:u,Dl:a,Eh:l,El:d,Fh:h,Fl:y,Gh:m,Gl:w,Hh:R,Hl:Z}=this;for(let _=0;_<80;_++){const G=Ie(l,d,14)^Ie(l,d,18)^lt(l,d,41),D=Ne(l,d,14)^Ne(l,d,18)^dt(l,d,41),L=l&h^~l&m,j=d&y^~d&w,P=Mi(Z,D,j,ac[_],$e[_]),N=qi(P,R,G,L,fc[_],Ce[_]),C=P|0,$=Ie(r,o,28)^lt(r,o,34)^lt(r,o,39),U=Ne(r,o,28)^dt(r,o,34)^dt(r,o,39),p=r&s^r&c^s&c,b=o&i^o&f^i&f;R=m|0,Z=w|0,m=h|0,w=y|0,h=l|0,y=d|0,{h:l,l:d}=le(u|0,a|0,N|0,C|0),u=c|0,a=f|0,c=s|0,f=i|0,s=r|0,i=o|0;const g=sn(C,U,b);r=cn(g,N,$,p),o=g|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:d}=le(this.Eh|0,this.El|0,l|0,d|0),{h,l:y}=le(this.Fh|0,this.Fl|0,h|0,y|0),{h:m,l:w}=le(this.Gh|0,this.Gl|0,m|0,w|0),{h:R,l:Z}=le(this.Hh|0,this.Hl|0,R|0,Z|0),this.set(r,o,s,i,c,f,u,a,l,d,h,y,m,w,R,Z)}roundClean(){ue(Ce,$e)}destroy(){ue(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class uc extends un{constructor(){super(48),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 ee=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class lc extends un{constructor(){super(32),this.Ah=ee[0]|0,this.Al=ee[1]|0,this.Bh=ee[2]|0,this.Bl=ee[3]|0,this.Ch=ee[4]|0,this.Cl=ee[5]|0,this.Dh=ee[6]|0,this.Dl=ee[7]|0,this.Eh=ee[8]|0,this.El=ee[9]|0,this.Fh=ee[10]|0,this.Fl=ee[11]|0,this.Gh=ee[12]|0,this.Gl=ee[13]|0,this.Hh=ee[14]|0,this.Hl=ee[15]|0}}const Tt=pt(()=>new cc),dc=pt(()=>new un),hc=pt(()=>new uc),pc=pt(()=>new lc),gc=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]),Y=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),I=new Uint32Array(32);function Le(e,t,n,r,o,s){const i=o[s],c=o[s+1];let f=I[2*e],u=I[2*e+1],a=I[2*t],l=I[2*t+1],d=I[2*n],h=I[2*n+1],y=I[2*r],m=I[2*r+1],w=sn(f,a,i);u=cn(w,u,l,c),f=w|0,{Dh:m,Dl:y}={Dh:m^u,Dl:y^f},{Dh:m,Dl:y}={Dh:$i(m,y),Dl:Li(m)},{h,l:d}=le(h,d,m,y),{Bh:l,Bl:a}={Bh:l^h,Bl:a^d},{Bh:l,Bl:a}={Bh:Ie(l,a,24),Bl:Ne(l,a,24)},I[2*e]=f,I[2*e+1]=u,I[2*t]=a,I[2*t+1]=l,I[2*n]=d,I[2*n+1]=h,I[2*r]=y,I[2*r+1]=m}function je(e,t,n,r,o,s){const i=o[s],c=o[s+1];let f=I[2*e],u=I[2*e+1],a=I[2*t],l=I[2*t+1],d=I[2*n],h=I[2*n+1],y=I[2*r],m=I[2*r+1],w=sn(f,a,i);u=cn(w,u,l,c),f=w|0,{Dh:m,Dl:y}={Dh:m^u,Dl:y^f},{Dh:m,Dl:y}={Dh:Ie(m,y,16),Dl:Ne(m,y,16)},{h,l:d}=le(h,d,m,y),{Bh:l,Bl:a}={Bh:l^h,Bl:a^d},{Bh:l,Bl:a}={Bh:lt(l,a,63),Bl:dt(l,a,63)},I[2*e]=f,I[2*e+1]=u,I[2*t]=a,I[2*t+1]=l,I[2*n]=d,I[2*n+1]=h,I[2*r]=y,I[2*r+1]=m}function bc(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 yc extends _t{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=ht(this.buffer)}update(t){Oe(this),t=he(t),de(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&&(Re(o),this.compress(o,0,!1),Re(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));Re(l);for(let d=0;f+n<s;d+=o.length,f+=n)this.length+=n,this.compress(l,d,!1);Re(l);continue}r.set(t.subarray(f,f+u),this.pos),this.pos+=u,this.length+=u,f+=u}return this}digestInto(t){Oe(this),fn(t,this);const{pos:n,buffer32:r}=this;this.finished=!0,ue(this.buffer.subarray(n)),Re(r),this.compress(r,0,!0),Re(r);const o=ht(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 mc extends yc{constructor(t={}){const n=t.dkLen===void 0?64:t.dkLen;super(128,n),this.v0l=Y[0]|0,this.v0h=Y[1]|0,this.v1l=Y[2]|0,this.v1h=Y[3]|0,this.v2l=Y[4]|0,this.v2h=Y[5]|0,this.v3l=Y[6]|0,this.v3h=Y[7]|0,this.v4l=Y[8]|0,this.v4h=Y[9]|0,this.v5l=Y[10]|0,this.v5h=Y[11]|0,this.v6l=Y[12]|0,this.v6h=Y[13]|0,this.v7l=Y[14]|0,this.v7h=Y[15]|0,bc(n,t,64,16,16);let{key:r,personalization:o,salt:s}=t,i=0;if(r!==void 0&&(r=he(r),i=r.length),this.v0l^=this.outputLen|i<<8|65536|1<<24,s!==void 0){s=he(s);const c=ht(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=he(o);const c=ht(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:d,v6l:h,v6h:y,v7l:m,v7h:w}=this;return[t,n,r,o,s,i,c,f,u,a,l,d,h,y,m,w]}set(t,n,r,o,s,i,c,f,u,a,l,d,h,y,m,w){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=d|0,this.v6l=h|0,this.v6h=y|0,this.v7l=m|0,this.v7h=w|0}compress(t,n,r){this.get().forEach((f,u)=>I[u]=f),I.set(Y,16);let{h:o,l:s}=Ir(BigInt(this.length));I[24]=Y[8]^s,I[25]=Y[9]^o,r&&(I[28]=~I[28],I[29]=~I[29]);let i=0;const c=gc;for(let f=0;f<12;f++)Le(0,4,8,12,t,n+2*c[i++]),je(0,4,8,12,t,n+2*c[i++]),Le(1,5,9,13,t,n+2*c[i++]),je(1,5,9,13,t,n+2*c[i++]),Le(2,6,10,14,t,n+2*c[i++]),je(2,6,10,14,t,n+2*c[i++]),Le(3,7,11,15,t,n+2*c[i++]),je(3,7,11,15,t,n+2*c[i++]),Le(0,5,10,15,t,n+2*c[i++]),je(0,5,10,15,t,n+2*c[i++]),Le(1,6,11,12,t,n+2*c[i++]),je(1,6,11,12,t,n+2*c[i++]),Le(2,7,8,13,t,n+2*c[i++]),je(2,7,8,13,t,n+2*c[i++]),Le(3,4,9,14,t,n+2*c[i++]),je(3,4,9,14,t,n+2*c[i++]);this.v0l^=I[0]^I[16],this.v0h^=I[1]^I[17],this.v1l^=I[2]^I[18],this.v1h^=I[3]^I[19],this.v2l^=I[4]^I[20],this.v2h^=I[5]^I[21],this.v3l^=I[6]^I[22],this.v3h^=I[7]^I[23],this.v4l^=I[8]^I[24],this.v4h^=I[9]^I[25],this.v5l^=I[10]^I[26],this.v5h^=I[11]^I[27],this.v6l^=I[12]^I[28],this.v6h^=I[13]^I[29],this.v7l^=I[14]^I[30],this.v7h^=I[15]^I[31],ue(I)}destroy(){this.destroyed=!0,ue(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const wc=Zi(e=>new mc(e)),vc="https://rpc.walletconnect.org/v1";function ln(e){const t=`Ethereum Signed Message: ${e.length}`,n=new TextEncoder().encode(t+e);return"0x"+Buffer.from(nc(n)).toString("hex")}async function qr(e,t,n,r,o,s){switch(n.t){case"eip191":return await Kr(e,t,n.s);case"eip1271":return await Fr(e,t,n.s,r,o,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}function Kr(e,t,n){const r=Qn.Signature.fromHex(n);return Qn.Secp256k1.recoverAddress({payload:ln(t),signature:r}).toLowerCase()===e.toLowerCase()}async function Fr(e,t,n,r,o,s){const i=Wt(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:ln(t)).substring(2),d=c+l+f+a+u,h=await fetch(`${s||vc}/?chainId=${r}&projectId=${o}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Ec(),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:d},"latest"]})}),{result:y}=await h.json();return y?y.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function Ec(){return Date.now()+Math.floor(Math.random()*1e3)}function xc(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 ut.default.encode(s)}function Ac(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=wc(r,{dkLen:32});return ut.default.encode(o)}function Bc(e){const t=new Uint8Array(Tt(Zr(e)));return ut.default.encode(t)}function Zr(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 Sc(e){const t=Buffer.from(e,"base64"),n=er.decode(t).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const r=er.encode(n),o=Buffer.from("TX"),s=Buffer.concat([o,Buffer.from(r)]),i=pc(s);return Hs.base32.encode(i).replace(/=+$/,"")}function dn(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 Ic(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(dn(t.length)),o.push(t),o.push(Buffer.from([18])),o.push(dn(n.length)),o.push(n),o.push(Buffer.from([26])),o.push(dn(r.length)),o.push(r);const s=Buffer.concat(o),i=Tt(s);return Buffer.from(i).toString("hex").toUpperCase()}function Nc(e){var t,n;const r=[];try{if(typeof e=="string")return r.push(e),r;if(typeof e!="object")return r;e!=null&&e.id&&r.push(e.id);const o=(n=(t=e?.capabilities)==null?void 0:t.caip345)==null?void 0:n.transactionHashes;o&&r.push(...o)}catch(o){console.warn("getWalletSendCallsHashes failed: ",o)}return r}var Oc=Object.defineProperty,Rc=Object.defineProperties,Uc=Object.getOwnPropertyDescriptors,Gr=Object.getOwnPropertySymbols,_c=Object.prototype.hasOwnProperty,Tc=Object.prototype.propertyIsEnumerable,zr=(e,t,n)=>t in e?Oc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hn=(e,t)=>{for(var n in t||(t={}))_c.call(t,n)&&zr(e,n,t[n]);if(Gr)for(var n of Gr(t))Tc.call(t,n)&&zr(e,n,t[n]);return e},Yr=(e,t)=>Rc(e,Uc(t));const Wr="did:pkh:",Cc={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},$c=e=>e?Cc[e]||e:"",bt=e=>e?.split(":"),Xr=e=>{const t=e&&bt(e);if(t)return e.includes(Wr)?t[3]:t[1]},Jr=e=>{const t=e&&bt(e);if(t)return e.includes(Wr)?t[2]:t[0]},Qr=e=>{const t=e&&bt(e);if(t)return t[2]+":"+t[3]},pn=e=>{const t=e&&bt(e);if(t)return t.pop()};async function Lc(e){const{cacao:t,projectId:n}=e,{s:r,p:o}=t,s=eo(o,o.iss),i=pn(o.iss);return await qr(i,s,r,Qr(o.iss),n)}const eo=(e,t)=>{const n=Jr(t);if(!n)throw new Error("Invalid issuer: "+t);const r=`${e.domain} wants you to sign in with your ${$c(n)} account:`,o=pn(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let s=e.statement||void 0;const i=`URI: ${e.aud||e.uri}`,c=`Version: ${e.version}`,f=`Chain ID: ${Xr(t)}`,u=`Nonce: ${e.nonce}`,a=`Issued At: ${e.iat}`,l=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,h=e.requestId?`Request ID: ${e.requestId}`:void 0,y=e.resources?`Resources:${e.resources.map(w=>` - ${w}`).join("")}`:void 0,m=$t(e.resources);if(m){const w=Pe(m);s=yn(s,w)}return[r,o,"",s,"",i,c,f,u,a,l,d,h,y].filter(w=>w!=null).join(` `)};function jc(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 Pc(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=rn(i,r);if(!(c!=null&&c.length))throw new Error("No supported chains");const f=to(n.resources);if(!f)return n;be(f);const u=no(f,"eip155");let a=n?.resources||[];if(u!=null&&u.length){const l=ro(u),d=rn(l,o);if(!(d!=null&&d.length))throw new Error(`Supported methods don't satisfy the requested: ${JSON.stringify(l)}, supported: ${JSON.stringify(o)}`);const h=gn("request",d,{chains:c}),y=co(f,"eip155",h);a=((t=n?.resources)==null?void 0:t.slice(0,-1))||[],a.push(Ct(y))}return Yr(hn({},n),{statement:ao(s,$t(a)),chains:c,resources:n!=null&&n.resources||a.length>0?a:void 0})}function to(e){const t=$t(e);if(t&&bn(t))return Pe(t)}function kc(e,t){var n;return(n=e?.att)==null?void 0:n.hasOwnProperty(t)}function no(e,t){var n,r;return(n=e?.att)!=null&&n[t]?Object.keys((r=e?.att)==null?void 0:r[t]):[]}function Dc(e){return e?.map(t=>Object.keys(t))||[]}function ro(e){return e?.map(t=>{var n;return(n=t.split("/"))==null?void 0:n[1]})||[]}function oo(e){return Buffer.from(JSON.stringify(e)).toString("base64")}function so(e){return JSON.parse(Buffer.from(e,"base64").toString("utf-8"))}function be(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 io(e,t,n,r={}){return n?.sort((o,s)=>o.localeCompare(s)),{att:{[e]:gn(t,n,r)}}}function co(e,t,n){var r;e.att[t]=hn({},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 gn(e,t,n={}){t=t?.sort((o,s)=>o.localeCompare(s));const r=t.map(o=>({[`${e}/${o}`]:[n]}));return Object.assign({},...r)}function Ct(e){return be(e),`urn:recap:${oo(e).replace(/=/g,"")}`}function Pe(e){const t=so(e.replace("urn:recap:",""));return be(t),t}function Hc(e,t,n){const r=io(e,t,n);return Ct(r)}function bn(e){return e&&e.includes("urn:recap:")}function Vc(e,t){const n=Pe(e),r=Pe(t),o=fo(n,r);return Ct(o)}function fo(e,t){be(e),be(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]=Yr(hn({},r.att[o]),{[c]:((f=e.att[o])==null?void 0:f[c])||((u=t.att[o])==null?void 0:u[c])})})}),r}function yn(e="",t){be(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,d)=>l.action.localeCompare(d.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 Mc(e){var t;const n=Pe(e);be(n);const r=(t=n.att)==null?void 0:t.eip155;return r?Object.keys(r).map(o=>o.split("/")[1]):[]}function qc(e){const t=Pe(e);be(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 ao(e,t){if(!t)return e;const n=Pe(t);return be(n),yn(e,n)}function $t(e){if(!e)return;const t=e?.[e.length-1];return bn(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function uo(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function mn(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}function wn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function se(e,...t){if(!uo(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 lo(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 Kc(e,t){se(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function ke(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function et(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Fc(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}const Zc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Gc(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function vn(e){if(typeof e=="string")e=Gc(e);else if(uo(e))e=En(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function zc(e,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(e,t)}function Yc(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 Wc=(e,t)=>{function n(r,...o){if(se(r),!Zc)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?se(a):se(a,e.nonceLength)}const s=e.tagLength;s&&o[1]!==void 0&&se(o[1]);const i=t(r,...o),c=(a,l)=>{if(l!==void 0){if(a!==2)throw new Error("cipher output not supported");se(l)}};let f=!1;return{encrypt(a,l){if(f)throw new Error("cannot encrypt() twice with same key + nonce");return f=!0,se(a),c(i.encrypt.length,l),i.encrypt(a,l)},decrypt(a,l){if(se(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 ho(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&&!Jc(t))throw new Error("invalid output, must be aligned");return t}function po(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 Xc(e,t,n){mn(n);const r=new Uint8Array(16),o=Fc(r);return po(o,0,BigInt(t),n),po(o,8,BigInt(e),n),r}function Jc(e){return e.byteOffset%4===0}function En(e){return Uint8Array.from(e)}const go=e=>Uint8Array.from(e.split("").map(t=>t.charCodeAt(0))),Qc=go("expand 16-byte k"),ef=go("expand 32-byte k"),tf=ke(Qc),nf=ke(ef);function q(e,t){return e<<t|e>>>32-t}function xn(e){return e.byteOffset%4===0}const Lt=64,rf=16,bo=2**32-1,yo=new Uint32Array;function of(e,t,n,r,o,s,i,c){const f=o.length,u=new Uint8Array(Lt),a=ke(u),l=xn(o)&&xn(s),d=l?ke(o):yo,h=l?ke(s):yo;for(let y=0;y<f;i++){if(e(t,n,r,a,i,c),i>=bo)throw new Error("arx: counter overflow");const m=Math.min(Lt,f-y);if(l&&m===Lt){const w=y/4;if(y%4!==0)throw new Error("arx: invalid block position");for(let R=0,Z;R<rf;R++)Z=w+R,h[Z]=d[Z]^a[R];y+=Lt;continue}for(let w=0,R;w<m;w++)R=y+w,s[R]=o[R]^u[w];y+=m}}function sf(e,t){const{allowShortKeys:n,extendNonceFn:r,counterLength:o,counterRight:s,rounds:i}=zc({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return wn(o),wn(i),mn(s),mn(n),(c,f,u,a,l=0)=>{se(c),se(f),se(u);const d=u.length;if(a===void 0&&(a=new Uint8Array(d)),se(a),wn(l),l<0||l>=bo)throw new Error("arx: counter overflow");if(a.length<d)throw new Error(`arx: output (${a.length}) is shorter than data (${d})`);const h=[];let y=c.length,m,w;if(y===32)h.push(m=En(c)),w=nf;else if(y===16&&n)m=new Uint8Array(32),m.set(c),m.set(c,16),w=tf,h.push(m);else throw new Error(`arx: invalid 32-byte key, got length=${y}`);xn(f)||h.push(f=En(f));const R=ke(m);if(r){if(f.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(w,R,ke(f.subarray(0,16)),R),f=f.subarray(16)}const Z=16-o;if(Z!==f.length)throw new Error(`arx: nonce must be ${Z} or 16 bytes`);if(Z!==12){const G=new Uint8Array(12);G.set(f,s?0:12-f.length),f=G,h.push(f)}const _=ke(f);return of(e,w,R,_,u,a,l,i),et(...h),a}}const X=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class cf{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=vn(t),se(t,32);const n=X(t,0),r=X(t,2),o=X(t,4),s=X(t,6),i=X(t,8),c=X(t,10),f=X(t,12),u=X(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]=X(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],d=i[5],h=i[6],y=i[7],m=i[8],w=i[9],R=X(t,n+0),Z=X(t,n+2),_=X(t,n+4),G=X(t,n+6),D=X(t,n+8),L=X(t,n+10),j=X(t,n+12),P=X(t,n+14);let N=s[0]+(R&8191),C=s[1]+((R>>>13|Z<<3)&8191),$=s[2]+((Z>>>10|_<<6)&8191),U=s[3]+((_>>>7|G<<9)&8191),p=s[4]+((G>>>4|D<<12)&8191),b=s[5]+(D>>>1&8191),g=s[6]+((D>>>14|L<<2)&8191),E=s[7]+((L>>>11|j<<5)&8191),x=s[8]+((j>>>8|P<<8)&8191),B=s[9]+(P>>>5|o),v=0,A=v+N*c+C*(5*w)+$*(5*m)+U*(5*y)+p*(5*h);v=A>>>13,A&=8191,A+=b*(5*d)+g*(5*l)+E*(5*a)+x*(5*u)+B*(5*f),v+=A>>>13,A&=8191;let S=v+N*f+C*c+$*(5*w)+U*(5*m)+p*(5*y);v=S>>>13,S&=8191,S+=b*(5*h)+g*(5*d)+E*(5*l)+x*(5*a)+B*(5*u),v+=S>>>13,S&=8191;let O=v+N*u+C*f+$*c+U*(5*w)+p*(5*m);v=O>>>13,O&=8191,O+=b*(5*y)+g*(5*h)+E*(5*d)+x*(5*l)+B*(5*a),v+=O>>>13,O&=8191;let H=v+N*a+C*u+$*f+U*c+p*(5*w);v=H>>>13,H&=8191,H+=b*(5*m)+g*(5*y)+E*(5*h)+x*(5*d)+B*(5*l),v+=H>>>13,H&=8191;let k=v+N*l+C*a+$*u+U*f+p*c;v=k>>>13,k&=8191,k+=b*(5*w)+g*(5*m)+E*(5*y)+x*(5*h)+B*(5*d),v+=k>>>13,k&=8191;let T=v+N*d+C*l+$*a+U*u+p*f;v=T>>>13,T&=8191,T+=b*c+g*(5*w)+E*(5*m)+x*(5*y)+B*(5*h),v+=T>>>13,T&=8191;let V=v+N*h+C*d+$*l+U*a+p*u;v=V>>>13,V&=8191,V+=b*f+g*c+E*(5*w)+x*(5*m)+B*(5*y),v+=V>>>13,V&=8191;let K=v+N*y+C*h+$*d+U*l+p*a;v=K>>>13,K&=8191,K+=b*u+g*f+E*c+x*(5*w)+B*(5*m),v+=K>>>13,K&=8191;let z=v+N*m+C*y+$*h+U*d+p*l;v=z>>>13,z&=8191,z+=b*a+g*u+E*f+x*c+B*(5*w),v+=z>>>13,z&=8191;let M=v+N*w+C*m+$*y+U*h+p*d;v=M>>>13,M&=8191,M+=b*l+g*a+E*u+x*f+B*c,v+=M>>>13,M&=8191,v=(v<<2)+v|0,v=v+A|0,A=v&8191,v=v>>>13,S+=v,s[0]=A,s[1]=S,s[2]=O,s[3]=H,s[4]=k,s[5]=T,s[6]=V,s[7]=K,s[8]=z,s[9]=M}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;et(r)}update(t){lo(this),t=vn(t),se(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(){et(this.h,this.r,this.buffer,this.pad)}digestInto(t){lo(this),Kc(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 ff(e){const t=(r,o)=>e(o).update(vn(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}const af=ff(e=>new cf(e));function uf(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],d=t[2],h=t[3],y=t[4],m=t[5],w=t[6],R=t[7],Z=o,_=n[0],G=n[1],D=n[2],L=i,j=c,P=f,N=u,C=a,$=l,U=d,p=h,b=y,g=m,E=w,x=R,B=Z,v=_,A=G,S=D;for(let H=0;H<s;H+=2)L=L+C|0,B=q(B^L,16),b=b+B|0,C=q(C^b,12),L=L+C|0,B=q(B^L,8),b=b+B|0,C=q(C^b,7),j=j+$|0,v=q(v^j,16),g=g+v|0,$=q($^g,12),j=j+$|0,v=q(v^j,8),g=g+v|0,$=q($^g,7),P=P+U|0,A=q(A^P,16),E=E+A|0,U=q(U^E,12),P=P+U|0,A=q(A^P,8),E=E+A|0,U=q(U^E,7),N=N+p|0,S=q(S^N,16),x=x+S|0,p=q(p^x,12),N=N+p|0,S=q(S^N,8),x=x+S|0,p=q(p^x,7),L=L+$|0,S=q(S^L,16),E=E+S|0,$=q($^E,12),L=L+$|0,S=q(S^L,8),E=E+S|0,$=q($^E,7),j=j+U|0,B=q(B^j,16),x=x+B|0,U=q(U^x,12),j=j+U|0,B=q(B^j,8),x=x+B|0,U=q(U^x,7),P=P+p|0,v=q(v^P,16),b=b+v|0,p=q(p^b,12),P=P+p|0,v=q(v^P,8),b=b+v|0,p=q(p^b,7),N=N+C|0,A=q(A^N,16),g=g+A|0,C=q(C^g,12),N=N+C|0,A=q(A^N,8),g=g+A|0,C=q(C^g,7);let O=0;r[O++]=i+L|0,r[O++]=c+j|0,r[O++]=f+P|0,r[O++]=u+N|0,r[O++]=a+C|0,r[O++]=l+$|0,r[O++]=d+U|0,r[O++]=h+p|0,r[O++]=y+b|0,r[O++]=m+g|0,r[O++]=w+E|0,r[O++]=R+x|0,r[O++]=Z+B|0,r[O++]=_+v|0,r[O++]=G+A|0,r[O++]=D+S|0}const lf=sf(uf,{counterRight:!1,counterLength:4,allowShortKeys:!1}),df=new Uint8Arra