1var Gu=Object.defineProperty;var Yu=(t,e,r)=>e in t?Gu(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var Dt=(t,e,r)=>Yu(t,typeof e!="symbol"?e+"":e,r);import{r as Hu,b as Xu,i as Qu,c as ts,Y as ec,Z as rs,$ as Js,w as tc,x as Ui,S as rc,C as nc,y as ic,a0 as oc}from"./vendor-wagmi-Sf3uR9Qd.js";import{F as Gs,_ as sc,a as Ys,w as ac,b as Ji,c as ns,d as An,e as Gi,f as is,g as or,m as os,n as bn,p as uc,h as nr,i as qt,j as cc,s as fc}from"./vendor-web3-Ccf3ZxeP.js";import{b as lo,c as jt,g as Hs}from"./vendor-react-CIHY58rS.js";let Lr=class extends Error{constructor(r,n={}){super(r,n.cause?{cause:n.cause}:void 0);Dt(this,"name","BaseError");Dt(this,"cause");this.cause=n.cause}};class lc extends Lr{constructor(){super("Invalid domain manifest");Dt(this,"name","AddMiniApp.InvalidDomainManifest")}}let hc=class extends Lr{constructor(){super("Add miniapp rejected by user");Dt(this,"name","AddMiniApp.RejectedByUser")}},Xs=class extends Lr{constructor(){super("Sign in rejected by user");Dt(this,"name","SignIn.RejectedByUser")}};class dc extends Lr{constructor(){super("Sign manifest rejected by user");Dt(this,"name","SignManifest.RejectedByUser")}}class pc extends Lr{constructor(){super("Invalid domain provided");Dt(this,"name","SignManifest.InvalidDomain")}}class mc extends Lr{constructor(r="Manifest signing failed"){super(r);Dt(this,"name","SignManifest.GenericError")}}var ss;function U(t,e,r){function n(l,d){if(l._zod||Object.defineProperty(l,"_zod",{value:{def:d,constr:s,traits:new Set},enumerable:!1}),l._zod.traits.has(t))return;l._zod.traits.add(t),e(l,d);const E=s.prototype,x=Object.keys(E);for(let M=0;M<x.length;M++){const z=x[M];z in l||(l[z]=E[z].bind(l))}}const i=(r==null?void 0:r.Parent)??Object;class o extends i{}Object.defineProperty(o,"name",{value:t});function s(l){var d;const E=r!=null&&r.Parent?new o:this;n(E,l),(d=E._zod).deferred??(d.deferred=[]);for(const x of E._zod.deferred)x();return E}return Object.defineProperty(s,"init",{value:n}),Object.defineProperty(s,Symbol.hasInstance,{value:l=>{var d,E;return r!=null&&r.Parent&&l instanceof r.Parent?!0:(E=(d=l==null?void 0:l._zod)==null?void 0:d.traits)==null?void 0:E.has(t)}}),Object.defineProperty(s,"name",{value:t}),s}class Tr extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Qs extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}(ss=globalThis).__zod_globalConfig??(ss.__zod_globalConfig={});const ho=globalThis.__zod_globalConfig;function yr(t){return ho}function ea(t){const e=Object.values(t).filter(n=>typeof n=="number");return Object.entries(t).filter(([n,i])=>e.indexOf(+n)===-1).map(([n,i])=>i)}function Yi(t,e){return typeof e=="bigint"?e.toString():e}function ei(t){return{get value(){{const e=t();return Object.defineProperty(this,"value",{value:e}),e}}}}function po(t){return t==null}function mo(t){const e=t.startsWith("^")?1:0,r=t.endsWith("$")?t.length-1:t.length;return t.slice(e,r)}function gc(t,e){const r=t/e,n=Math.round(r),i=Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<i?0:r-n}const as=Symbol("evaluating");function we(t,e,r){let n;Object.defineProperty(t,e,{get(){if(n!==as)return n===void 0&&(n=as,n=r()),n},set(i){Object.defineProperty(t,e,{value:i})},configurable:!0})}function vr(t,e,r){Object.defineProperty(t,e,{value:r,writable:!0,enumerable:!0,configurable:!0})}function lr(...t){const e={};for(const r of t){const n=Object.getOwnPropertyDescriptors(r);Object.assign(e,n)}return Object.defineProperties({},e)}function us(t){return JSON.stringify(t)}function yc(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const ta="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function Gr(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}const wc=ei(()=>{var t;if(ho.jitless||typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)!=null&&t.includes("Cloudflare")))return!1;try{const e=Function;return new e(""),!0}catch{return!1}});function Yr(t){if(Gr(t)===!1)return!1;const e=t.constructor;if(e===void 0||typeof e!="function")return!0;const r=e.prototype;return!(Gr(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function ra(t){return Yr(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}const vc=new Set(["string","number","symbol"]);function $r(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function hr(t,e,r){const n=new t._zod.constr(e??t._zod.def);return(!e||r!=null&&r.parent)&&(n._zod.parent=t),n}function H(t){const e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};
vendor: 12,845 bytes, line 1
1if((e==null?void 0:e.message)!==void 0){if((e==null?void 0:e.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function bc(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}const _c={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Ec(t,e){const r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const o=lr(t._zod.def,{get shape(){const s={};for(const l in e){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&(s[l]=r.shape[l])}return vr(this,"shape",s),s},checks:[]});return hr(t,o)}function xc(t,e){const r=t._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const o=lr(t._zod.def,{get shape(){const s={...t._zod.def.shape};for(const l in e){if(!(l in r.shape))throw new Error(`Unrecognized key: "${l}"`);e[l]&&delete s[l]}return vr(this,"shape",s),s},checks:[]});return hr(t,o)}function Sc(t,e){if(!Yr(e))throw new Error("Invalid input to extend: expected a plain object");const r=t._zod.def.checks;if(r&&r.length>0){const o=t._zod.def.shape;for(const s in e)if(Object.getOwnPropertyDescriptor(o,s)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=lr(t._zod.def,{get shape(){const o={...t._zod.def.shape,...e};return vr(this,"shape",o),o}});return hr(t,i)}function Ic(t,e){if(!Yr(e))throw new Error("Invalid input to safeExtend: expected a plain object");const r=lr(t._zod.def,{get shape(){const n={...t._zod.def.shape,...e};return vr(this,"shape",n),n}});return hr(t,r)}function kc(t,e){var n;if((n=t._zod.def.checks)!=null&&n.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const r=lr(t._zod.def,{get shape(){const i={...t._zod.def.shape,...e._zod.def.shape};return vr(this,"shape",i),i},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return hr(t,r)}function Ac(t,e,r){const i=e._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=lr(e._zod.def,{get shape(){const l=e._zod.def.shape,d={...l};if(r)for(const E in r){if(!(E in l))throw new Error(`Unrecognized key: "${E}"`);r[E]&&(d[E]=t?new t({type:"optional",innerType:l[E]}):l[E])}else for(const E in l)d[E]=t?new t({type:"optional",innerType:l[E]}):l[E];return vr(this,"shape",d),d},checks:[]});return hr(e,s)}function Mc(t,e,r){const n=lr(e._zod.def,{get shape(){const i=e._zod.def.shape,o={...i};if(r)for(const s in r){if(!(s in o))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(o[s]=new t({type:"nonoptional",innerType:i[s]}))}else for(const s in i)o[s]=new t({type:"nonoptional",innerType:i[s]});return vr(this,"shape",o),o}});return hr(e,n)}function Rr(t,e=0){var r;if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(((r=t.issues[n])==null?void 0:r.continue)!==!0)return!0;return!1}function Bc(t,e=0){var r;if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(((r=t.issues[n])==null?void 0:r.continue)===!1)return!0;return!1}function na(t,e){return e.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(t),r})}function _n(t){return typeof t=="string"?t:t==null?void 0:t.message}function wr(t,e,r){var d,E,x,M,z,O;const n=t.message?t.message:_n((x=(E=(d=t.inst)==null?void 0:d._zod.def)==null?void 0:E.error)==null?void 0:x.call(E,t))??_n((M=e==null?void 0:e.error)==null?void 0:M.call(e,t))??_n((z=r.customError)==null?void 0:z.call(r,t))??_n((O=r.localeError)==null?void 0:O.call(r,t))??"Invalid input",{inst:i,continue:o,input:s,...l}=t;return l.path??(l.path=[]),l.message=n,e!=null&&e.reportInput&&(l.input=s),l}function go(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Hr(...t){const[e,r,n]=t;return typeof e=="string"?{message:e,code:"custom",input:r,inst:n}:{...e}}const ia=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Yi,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},oa=U("$ZodError",ia),sa=U("$ZodError",ia,{Parent:Error});function Oc(t,e=r=>r.message){const r={},n=[];for(const i of t.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(e(i))):n.push(e(i));return{formErrors:n,fieldErrors:r}}function Rc(t,e=r=>r.message){const r={_errors:[]},n=(i,o=[])=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(l=>n({issues:l},[...o,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...o,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...o,...s.path]);else{const l=[...o,...s.path];if(l.length===0)r._errors.push(e(s));else{let d=r,E=0;for(;E<l.length;){const x=l[E];E===l.length-1?(d[x]=d[x]||{_errors:[]},d[x]._errors.push(e(s))):d[x]=d[x]||{_errors:[]},d=d[x],E++}}}};return n(t),r}const yo=t=>(e,r,n,i)=>{const o=n?{...n,async:!1}:{async:!1},s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new Tr;if(s.issues.length){const l=new((i==null?void 0:i.Err)??t)(s.issues.map(d=>wr(d,o,yr())));throw ta(l,i==null?void 0:i.callee),l}return s.value},wo=t=>async(e,r,n,i)=>{const o=n?{...n,async:!0}:{async:!0};let s=e._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){const l=new((i==null?void 0:i.Err)??t)(s.issues.map(d=>wr(d,o,yr())));throw ta(l,i==null?void 0:i.callee),l}return s.value},ti=t=>(e,r,n)=>{const i=n?{...n,async:!1}:{async:!1},o=e._zod.run({value:r,issues:[]},i);if(o instanceof Promise)throw new Tr;return o.issues.length?{success:!1,error:new(t??oa)(o.issues.map(s=>wr(s,i,yr())))}:{success:!0,data:o.value}},zc=ti(sa),ri=t=>async(e,r,n)=>{const i=n?{...n,async:!0}:{async:!0};let o=e._zod.run({value:r,issues:[]},i);return o instanceof Promise&&(o=await o),o.issues.length?{success:!1,error:new t(o.issues.map(s=>wr(s,i,yr())))}:{success:!0,data:o.value}},Tc=ri(sa),Pc=t=>(e,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return yo(t)(e,r,i)},Uc=t=>(e,r,n)=>yo(t)(e,r,n),$c=t=>async(e,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return wo(t)(e,r,i)},Cc=t=>async(e,r,n)=>wo(t)(e,r,n),Nc=t=>(e,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return ti(t)(e,r,i)},Fc=t=>(e,r,n)=>ti(t)(e,r,n),Lc=t=>async(e,r,n)=>{const i=n?{...n,direction:"backward"}:{direction:"backward"};return ri(t)(e,r,i)},Dc=t=>async(e,r,n)=>ri(t)(e,r,n),Zc=/^[cC][0-9a-z]{6,}$/,jc=/^[0-9a-z]+$/,Kc=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vc=/^[0-9a-vA-V]{20}$/,qc=/^[A-Za-z0-9]{27}$/,Wc=/^[a-zA-Z0-9_-]{21}$/,Jc=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Gc=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,cs=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Yc=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Hc="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Xc(){return new RegExp(Hc,"u")}const Qc=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ef=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,tf=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,rf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,nf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,aa=/^[A-Za-z0-9_-]*$/,of=/^https?$/,sf=/^\+[1-9]\d{6,14}$/,ua="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",af=new RegExp(`^${ua}$`);function ca(t){const e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function uf(t){return new RegExp(`^${ca(t)}$`)}function cf(t){const e=ca({precision:t.precision}),r=["Z"];t.local&&r.push(""),t.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${e}(?:${r.join("|")})`;return new RegExp(`^${ua}T(?:${n})$`)}const ff=t=>{const e=t?`[\\s\\S]{${(t==null?void 0:t.minimum)??0},${(t==null?void 0:t.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)},lf=/^-?\d+$/,hf=/^-?\d+(?:\.\d+)?$/,df=/^(?:true|false)$/i,pf=/^[^A-Z]*$/,mf=/^[^a-z]*$/,Mt=U("$ZodCheck",(t,e)=>{var r;t._zod??(t._zod={}),t._zod.def=e,(r=t._zod).onattach??(r.onattach=[])}),fa={number:"number",bigint:"bigint",object:"date"},la=U("$ZodCheckLessThan",(t,e)=>{Mt.init(t,e);const r=fa[typeof e.value];t._zod.onattach.push(n=>{const i=n._zod.bag,o=(e.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<o&&(e.inclusive?i.maximum=e.value:i.exclusiveMaximum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value<=e.value:n.value<e.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),ha=U("$ZodCheckGreaterThan",(t,e)=>{Mt.init(t,e);const r=fa[typeof e.value];t._zod.onattach.push(n=>{const i=n._zod.bag,o=(e.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>o&&(e.inclusive?i.minimum=e.value:i.exclusiveMinimum=e.value)}),t._zod.check=n=>{(e.inclusive?n.value>=e.value:n.value>e.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:n.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),gf=U("$ZodCheckMultipleOf",(t,e)=>{Mt.init(t,e),t._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=e.value)}),t._zod.check=r=>{if(typeof r.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%e.value===BigInt(0):gc(r.value,e.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:e.value,input:r.value,inst:t,continue:!e.abort})}}),yf=U("$ZodCheckNumberFormat",(t,e)=>{var s;Mt.init(t,e),e.format=e.format||"float64";const r=(s=e.format)==null?void 0:s.includes("int"),n=r?"int":"number",[i,o]=_c[e.format];t._zod.onattach.push(l=>{const d=l._zod.bag;d.format=e.format,d.minimum=i,d.maximum=o,r&&(d.pattern=lf)}),t._zod.check=l=>{const d=l.value;if(r){if(!Number.isInteger(d)){l.issues.push({expected:n,format:e.format,code:"invalid_type",continue:!1,input:d,inst:t});return}if(!Number.isSafeInteger(d)){d>0?l.issues.push({input:d,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort}):l.issues.push({input:d,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:n,inclusive:!0,continue:!e.abort});return}}d<i&&l.issues.push({origin:"number",input:d,code:"too_small",minimum:i,inclusive:!0,inst:t,continue:!e.abort}),d>o&&l.issues.push({origin:"number",input:d,code:"too_big",maximum:o,inclusive:!0,inst:t,continue:!e.abort})}}),wf=U("$ZodCheckMaxLength",(t,e)=>{var r;Mt.init(t,e),(r=t._zod.def).when??(r.when=n=>{const i=n.value;return!po(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{const i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<i&&(n._zod.bag.maximum=e.maximum)}),t._zod.check=n=>{const i=n.value;if(i.length<=e.maximum)return;const s=go(i);n.issues.push({origin:s,code:"too_big",maximum:e.maximum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),vf=U("$ZodCheckMinLength",(t,e)=>{var r;Mt.init(t,e),(r=t._zod.def).when??(r.when=n=>{const i=n.value;return!po(i)&&i.length!==void 0}),t._zod.onattach.push(n=>
vendor: 4,232 bytes, lines 1-3
1{const i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>i&&(n._zod.bag.minimum=e.minimum)}),t._zod.check=n=>{const i=n.value;if(i.length>=e.minimum)return;const s=go(i);n.issues.push({origin:s,code:"too_small",minimum:e.minimum,inclusive:!0,input:i,inst:t,continue:!e.abort})}}),bf=U("$ZodCheckLengthEquals",(t,e)=>{var r;Mt.init(t,e),(r=t._zod.def).when??(r.when=n=>{const i=n.value;return!po(i)&&i.length!==void 0}),t._zod.onattach.push(n=>{const i=n._zod.bag;i.minimum=e.length,i.maximum=e.length,i.length=e.length}),t._zod.check=n=>{const i=n.value,o=i.length;if(o===e.length)return;const s=go(i),l=o>e.length;n.issues.push({origin:s,...l?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:n.value,inst:t,continue:!e.abort})}}),ni=U("$ZodCheckStringFormat",(t,e)=>{var r,n;Mt.init(t,e),t._zod.onattach.push(i=>{const o=i._zod.bag;o.format=e.format,e.pattern&&(o.patterns??(o.patterns=new Set),o.patterns.add(e.pattern))}),e.pattern?(r=t._zod).check??(r.check=i=>{e.pattern.lastIndex=0,!e.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:e.format,input:i.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(n=t._zod).check??(n.check=()=>{})}),_f=U("$ZodCheckRegex",(t,e)=>{ni.init(t,e),t._zod.check=r=>{e.pattern.lastIndex=0,!e.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),Ef=U("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=pf),ni.init(t,e)}),xf=U("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=mf),ni.init(t,e)}),Sf=U("$ZodCheckIncludes",(t,e)=>{Mt.init(t,e);const r=$r(e.includes),n=new RegExp(typeof e.position=="number"?`^.{${e.position}}${r}`:r);e.pattern=n,t._zod.onattach.push(i=>{const o=i._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=i=>{i.value.includes(e.includes,e.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:i.value,inst:t,continue:!e.abort})}}),If=U("$ZodCheckStartsWith",(t,e)=>{Mt.init(t,e);const r=new RegExp(`^${$r(e.prefix)}.*`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.startsWith(e.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:n.value,inst:t,continue:!e.abort})}}),kf=U("$ZodCheckEndsWith",(t,e)=>{Mt.init(t,e);const r=new RegExp(`.*${$r(e.suffix)}$`);e.pattern??(e.pattern=r),t._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),t._zod.check=n=>{n.value.endsWith(e.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:n.value,inst:t,continue:!e.abort})}}),Af=U("$ZodCheckOverwrite",(t,e)=>{Mt.init(t,e),t._zod.check=r=>{r.value=e.tx(r.value)}});class Mf{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const n=e.split(` 2`).filter(s=>s),i=Math.min(...n.map(s=>s.length-s.trimStart().length)),o=n.map(s=>s.slice(i)).map(s=>" ".repeat(this.indent*2)+s);for(const s of o)this.content.push(s)}compile(){const e=Function,r=this==null?void 0:this.args,i=[...((this==null?void 0:this.content)??[""]).map(o=>` ${o}`)];return new e(...r,i.join(` 3`))}}const Bf={major:4,minor:4,patch:3},Le=U("$ZodType",(t,e)=>{var i;var r;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=Bf;const n=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&n.unshift(t);for(const o of n)for(const s of o._zod.onattach)s(t);if(n.length===0)(r=t._zod).deferred??(r.deferred=[]),(i=t._zod.deferred)==null||i.push(()=>{t._zod.run=t._zod.parse});else{const o=(l,d,E)=>{let x=Rr(l),M;for(const z of d){if(z._zod.def.when){if(Bc(l)||!z._zod.def.when(l))continue}else if(x)continue;const O=l.issues.length,$=z._zod.check(l);if($ instanceof Promise&&(E==null?void 0:E.async)===!1)throw new Tr;if(M||$ instanceof Promise)M=(M??Promise.resolve()).then(async()=>
vendor: 35,859 bytes, lines 3-64
3{await $,l.issues.length!==O&&(x||(x=Rr(l,O)))});else{if(l.issues.length===O)continue;x||(x=Rr(l,O))}}return M?M.then(()=>l):l},s=(l,d,E)=>{if(Rr(l))return l.aborted=!0,l;const x=o(d,n,E);if(x instanceof Promise){if(E.async===!1)throw new Tr;return x.then(M=>t._zod.parse(M,E))}return t._zod.parse(x,E)};t._zod.run=(l,d)=>{if(d.skipChecks)return t._zod.parse(l,d);if(d.direction==="backward"){const x=t._zod.parse({value:l.value,issues:[]},{...d,skipChecks:!0});return x instanceof Promise?x.then(M=>s(M,l,d)):s(x,l,d)}const E=t._zod.parse(l,d);if(E instanceof Promise){if(d.async===!1)throw new Tr;return E.then(x=>o(x,n,d))}return o(E,n,d)}}we(t,"~standard",()=>({validate:o=>{var s;try{const l=zc(t,o);return l.success?{value:l.data}:{issues:(s=l.error)==null?void 0:s.issues}}catch{return Tc(t,o).then(d=>{var E;return d.success?{value:d.data}:{issues:(E=d.error)==null?void 0:E.issues}})}},vendor:"zod",version:1}))}),vo=U("$ZodString",(t,e)=>{var r;Le.init(t,e),t._zod.pattern=[...((r=t==null?void 0:t._zod.bag)==null?void 0:r.patterns)??[]].pop()??ff(t._zod.bag),t._zod.parse=(n,i)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),Me=U("$ZodStringFormat",(t,e)=>{ni.init(t,e),vo.init(t,e)}),Of=U("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Gc),Me.init(t,e)}),Rf=U("$ZodUUID",(t,e)=>{if(e.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(n===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=cs(n))}else e.pattern??(e.pattern=cs());Me.init(t,e)}),zf=U("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Yc),Me.init(t,e)}),Tf=U("$ZodURL",(t,e)=>{Me.init(t,e),t._zod.check=r=>{var n;try{const i=r.value.trim();if(!e.normalize&&((n=e.protocol)==null?void 0:n.source)===of.source&&!/^https?:\/\//i.test(i)){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:t,continue:!e.abort});return}const o=new URL(i);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:r.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:r.value,inst:t,continue:!e.abort})),e.normalize?r.value=o.href:r.value=i;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:t,continue:!e.abort})}}}),Pf=U("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=Xc()),Me.init(t,e)}),Uf=U("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Wc),Me.init(t,e)}),$f=U("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=Zc),Me.init(t,e)}),Cf=U("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=jc),Me.init(t,e)}),Nf=U("$ZodULID",(t,e)=>{e.pattern??(e.pattern=Kc),Me.init(t,e)}),Ff=U("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Vc),Me.init(t,e)}),Lf=U("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=qc),Me.init(t,e)}),Df=U("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=cf(e)),Me.init(t,e)}),Zf=U("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=af),Me.init(t,e)}),jf=U("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=uf(e)),Me.init(t,e)}),Kf=U("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=Jc),Me.init(t,e)}),Vf=U("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Qc),Me.init(t,e),t._zod.bag.format="ipv4"}),qf=U("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=ef),Me.init(t,e),t._zod.bag.format="ipv6",t._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:t,continue:!e.abort})}}}),Wf=U("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=tf),Me.init(t,e)}),Jf=U("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=rf),Me.init(t,e),t._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[i,o]=n;if(!o)throw new Error;const s=Number(o);if(`${s}`!==o)throw new Error;if(s<0||s>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:t,continue:!e.abort})}}});function da(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}const Gf=U("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=nf),Me.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=r=>{da(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:t,continue:!e.abort})}});function Yf(t){if(!aa.test(t))return!1;const e=t.replace(/[-_]/g,n=>n==="-"?"+":"/"),r=e.padEnd(Math.ceil(e.length/4)*4,"=");return da(r)}const Hf=U("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=aa),Me.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=r=>{Yf(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:t,continue:!e.abort})}}),Xf=U("$ZodE164",(t,e)=>{e.pattern??(e.pattern=sf),Me.init(t,e)});function Qf(t,e=null){try{const r=t.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const i=JSON.parse(atob(n));return!("typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||e&&(!("alg"in i)||i.alg!==e))}catch{return!1}}const el=U("$ZodJWT",(t,e)=>{Me.init(t,e),t._zod.check=r=>{Qf(r.value,e.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:t,continue:!e.abort})}}),pa=U("$ZodNumber",(t,e)=>{Le.init(t,e),t._zod.pattern=t._zod.bag.pattern??hf,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=Number(r.value)}catch{}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const o=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:t,...o?{received:o}:{}}),r}}),tl=U("$ZodNumberFormat",(t,e)=>{yf.init(t,e),pa.init(t,e)}),rl=U("$ZodBoolean",(t,e)=>{Le.init(t,e),t._zod.pattern=df,t._zod.parse=(r,n)=>{if(e.coerce)try{r.value=!!r.value}catch{}const i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:t}),r}}),nl=U("$ZodUnknown",(t,e)=>{Le.init(t,e),t._zod.parse=r=>r}),il=U("$ZodNever",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:t}),r)});function fs(t,e,r){t.issues.length&&e.issues.push(...na(r,t.issues)),e.value[r]=t.value}const ol=U("$ZodArray",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:t}),r;r.value=Array(i.length);const o=[];for(let s=0;s<i.length;s++){const l=i[s],d=e.element._zod.run({value:l,issues:[]},n);d instanceof Promise?o.push(d.then(E=>fs(E,r,s))):fs(d,r,s)}return o.length?Promise.all(o).then(()=>r):r}});function On(t,e,r,n,i,o){const s=r in n;if(t.issues.length){if(i&&o&&!s)return;e.issues.push(...na(r,t.issues))}if(!s&&!i){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}t.value===void 0?s&&(e.value[r]=void 0):e.value[r]=t.value}function ma(t){var n,i,o,s;const e=Object.keys(t.shape);for(const l of e)if(!((s=(o=(i=(n=t.shape)==null?void 0:n[l])==null?void 0:i._zod)==null?void 0:o.traits)!=null&&s.has("$ZodType")))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const r=bc(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(r)}}function ga(t,e,r,n,i,o){const s=[],l=i.keySet,d=i.catchall._zod,E=d.def.type,x=d.optin==="optional",M=d.optout==="optional";for(const z in e){if(z==="__proto__"||l.has(z))continue;if(E==="never"){s.push(z);continue}const O=d.run({value:e[z],issues:[]},n);O instanceof Promise?t.push(O.then($=>On($,r,z,e,x,M))):On(O,r,z,e,x,M)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:e,inst:o}),t.length?Promise.all(t).then(()=>r):r}const sl=U("$ZodObject",(t,e)=>{Le.init(t,e);const r=Object.getOwnPropertyDescriptor(e,"shape");if(!(r!=null&&r.get)){const l=e.shape;Object.defineProperty(e,"shape",{get:()=>{const d={...l};return Object.defineProperty(e,"shape",{value:d}),d}})}const n=ei(()=>ma(e));we(t._zod,"propValues",()=>{const l=e.shape,d={};for(const E in l){const x=l[E]._zod;if(x.values){d[E]??(d[E]=new Set);for(const M of x.values)d[E].add(M)}}return d});const i=Gr,o=e.catchall;let s;t._zod.parse=(l,d)=>{s??(s=n.value);const E=l.value;if(!i(E))return l.issues.push({expected:"object",code:"invalid_type",input:E,inst:t}),l;l.value={};const x=[],M=s.shape;for(const z of s.keys){const O=M[z],$=O._zod.optin==="optional",N=O._zod.optout==="optional",D=O._zod.run({value:E[z],issues:[]},d);D instanceof Promise?x.push(D.then(P=>On(P,l,z,E,$,N))):On(D,l,z,E,$,N)}return o?ga(x,E,l,d,n.value,t):x.length?Promise.all(x).then(()=>l):l}}),al=U("$ZodObjectJIT",(t,e)=>{sl.init(t,e);const r=t._zod.parse,n=ei(()=>ma(e)),i=z=>{var Z,W;const O=new Mf(["shape","payload","ctx"]),$=n.value,N=te=>{const V=us(te);return`shape[${V}]._zod.run({ value: input[${V}], issues: [] }, ctx)`};O.write("const input = payload.value;");const D=Object.create(null);let P=0;for(const te of $.keys)D[te]=`key_${P++}`;O.write("const newResult = {};");for(const te of $.keys){const V=D[te],Y=us(te),he=z[te],q=((Z=he==null?void 0:he._zod)==null?void 0:Z.optin)==="optional",X=((W=he==null?void 0:he._zod)==null?void 0:W.optout)==="optional";O.write(`const ${V} = ${N(te)};`),q&&X?O.write(` 4 if (${V}.issues.length) { 5 if (${Y} in input) { 6 payload.issues = payload.issues.concat(${V}.issues.map(iss => ({ 7 ...iss, 8 path: iss.path ? [${Y}, ...iss.path] : [${Y}] 9 }))); 10 } 11 } 12 13 if (${V}.value === undefined) { 14 if (${Y} in input) { 15 newResult[${Y}] = undefined; 16 } 17 } else { 18 newResult[${Y}] = ${V}.value; 19 } 20 21 `):q?O.write(` 22 if (${V}.issues.length) { 23 payload.issues = payload.issues.concat(${V}.issues.map(iss => ({ 24 ...iss, 25 path: iss.path ? [${Y}, ...iss.path] : [${Y}] 26 }))); 27 } 28 29 if (${V}.value === undefined) { 30 if (${Y} in input) { 31 newResult[${Y}] = undefined; 32 } 33 } else { 34 newResult[${Y}] = ${V}.value; 35 } 36 37 `):O.write(` 38 const ${V}_present = ${Y} in input; 39 if (${V}.issues.length) { 40 payload.issues = payload.issues.concat(${V}.issues.map(iss => ({ 41 ...iss, 42 path: iss.path ? [${Y}, ...iss.path] : [${Y}] 43 }))); 44 } 45 if (!${V}_present && !${V}.issues.length) { 46 payload.issues.push({ 47 code: "invalid_type", 48 expected: "nonoptional", 49 input: undefined, 50 path: [${Y}] 51 }); 52 } 53 54 if (${V}_present) { 55 if (${V}.value === undefined) { 56 newResult[${Y}] = undefined; 57 } else { 58 newResult[${Y}] = ${V}.value; 59 } 60 } 61 62 `)}O.write("payload.value = newResult;"),O.write("return payload;");const F=O.compile();return(te,V)=>F(z,te,V)};let o;const s=Gr,l=!ho.jitless,E=l&&wc.value,x=e.catchall;let M;t._zod.parse=(z,O)=>{M??(M=n.value);const $=z.value;return s($)?l&&E&&(O==null?void 0:O.async)===!1&&O.jitless!==!0?(o||(o=i(e.shape)),z=o(z,O),x?ga([],$,z,O,M,t):z):r(z,O):(z.issues.push({expected:"object",code:"invalid_type",input:$,inst:t}),z)}});function ls(t,e,r,n){for(const o of t)if(o.issues.length===0)return e.value=o.value,e;const i=t.filter(o=>!Rr(o));return i.length===1?(e.value=i[0].value,i[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:r,errors:t.map(o=>o.issues.map(s=>wr(s,n,yr())))}),e)}const ya=U("$ZodUnion",(t,e)=>{Le.init(t,e),we(t._zod,"optin",()=>e.options.some(n=>n._zod.optin==="optional")?"optional":void 0),we(t._zod,"optout",()=>e.options.some(n=>n._zod.optout==="optional")?"optional":void 0),we(t._zod,"values",()=>{if(e.options.every(n=>n._zod.values))return new Set(e.options.flatMap(n=>Array.from(n._zod.values)))}),we(t._zod,"pattern",()=>{if(e.options.every(n=>n._zod.pattern)){const n=e.options.map(i=>i._zod.pattern);return new RegExp(`^(${n.map(i=>mo(i.source)).join("|")})$`)}});const r=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(n,i)=>{if(r)return r(n,i);let o=!1;const s=[];for(const l of e.options){const d=l._zod.run({value:n.value,issues:[]},i);if(d instanceof Promise)s.push(d),o=!0;else{if(d.issues.length===0)return d;s.push(d)}}return o?Promise.all(s).then(l=>ls(l,n,t,i)):ls(s,n,t,i)}}),ul=U("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,ya.init(t,e);const r=t._zod.parse;we(t._zod,"propValues",()=>{const i={};for(const o of e.options){const s=o._zod.propValues;if(!s||Object.keys(s).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(o)}"`);for(const[l,d]of Object.entries(s)){i[l]||(i[l]=new Set);for(const E of d)i[l].add(E)}}return i});const n=ei(()=>{var s;const i=e.options,o=new Map;for(const l of i){const d=(s=l._zod.propValues)==null?void 0:s[e.discriminator];if(!d||d.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(l)}"`);for(const E of d){if(o.has(E))throw new Error(`Duplicate discriminator value "${String(E)}"`);o.set(E,l)}}return o});t._zod.parse=(i,o)=>{const s=i.value;if(!Gr(s))return i.issues.push({code:"invalid_type",expected:"object",input:s,inst:t}),i;const l=n.value.get(s==null?void 0:s[e.discriminator]);return l?l._zod.run(i,o):e.unionFallback||o.direction==="backward"?r(i,o):(i.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(n.value.keys()),input:s,path:[e.discriminator],inst:t}),i)}}),cl=U("$ZodIntersection",(t,e)=>{Le.init(t,e),t._zod.parse=(r,n)=>{const i=r.value,o=e.left._zod.run({value:i,issues:[]},n),s=e.right._zod.run({value:i,issues:[]},n);return o instanceof Promise||s instanceof Promise?Promise.all([o,s]).then(([d,E])=>hs(r,d,E)):hs(r,o,s)}});function Hi(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Yr(t)&&Yr(e)){const r=Object.keys(e),n=Object.keys(t).filter(o=>r.indexOf(o)!==-1),i={...t,...e};for(const o of n){const s=Hi(t[o],e[o]);if(!s.valid)return{valid:!1,mergeErrorPath:[o,...s.mergeErrorPath]};i[o]=s.data}return{valid:!0,data:i}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};const r=[];for(let n=0;n<t.length;n++){const i=t[n],o=e[n],s=Hi(i,o);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function hs(t,e,r){const n=new Map;let i;for(const l of e.issues)if(l.code==="unrecognized_keys"){i??(i=l);for(const d of l.keys)n.has(d)||n.set(d,{}),n.get(d).l=!0}else t.issues.push(l);for(const l of r.issues)if(l.code==="unrecognized_keys")for(const d of l.keys)n.has(d)||n.set(d,{}),n.get(d).r=!0;else t.issues.push(l);const o=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(o.length&&i&&t.issues.push({...i,keys:o}),Rr(t))return t;const s=Hi(e.value,r.value);if(!s.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(s.mergeErrorPath)}`);return t.value=s.data,t}const fl=U("$ZodEnum",(t,e)=>{Le.init(t,e);const r=ea(e.entries),n=new Set(r);t._zod.values=n,t._zod.pattern=new RegExp(`^(${r.filter(i=>vc.has(typeof i)).map(i=>typeof i=="string"?$r(i):i.toString()).join("|")})$`),t._zod.parse=(i,o)=>{const s=i.value;return n.has(s)||i.issues.push({code:"invalid_value",values:r,input:s,inst:t}),i}}),ll=U("$ZodLiteral",(t,e)=>{if(Le.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");const r=new Set(e.values);t._zod.values=r,t._zod.pattern=new RegExp(`^(${e.values.map(n=>typeof n=="string"?$r(n):n?$r(n.toString()):String(n)).join("|")})$`),t._zod.parse=(n,i)=>{const o=n.value;return r.has(o)||n.issues.push({code:"invalid_value",values:e.values,input:o,inst:t}),n}}),hl=U("$ZodTransform",(t,e)=>{Le.init(t,e),t._zod.optin="optional",t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Qs(t.constructor.name);const i=e.transform(r.value,r);if(n.async)return(i instanceof Promise?i:Promise.resolve(i)).then(s=>(r.value=s,r.fallback=!0,r));if(i instanceof Promise)throw new Tr;return r.value=i,r.fallback=!0,r}});function ds(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}const wa=U("$ZodOptional",(t,e)=>{Le.init(t,e),t._zod.optin="optional",t._zod.optout="optional",we(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),we(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${mo(r.source)})?$`):void 0}),t._zod.parse=(r,n)=>{if(e.innerType._zod.optin==="optional"){const i=r.value,o=e.innerType._zod.run(r,n);return o instanceof Promise?o.then(s=>ds(s,i)):ds(o,i)}return r.value===void 0?r:e.innerType._zod.run(r,n)}}),dl=U("$ZodExactOptional",(t,e)=>{wa.init(t,e),we(t._zod,"values",()=>e.innerType._zod.values),we(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(r,n)=>e.innerType._zod.run(r,n)}),pl=U("$ZodNullable",(t,e)=>{Le.init(t,e),we(t._zod,"optin",()=>e.innerType._zod.optin),we(t._zod,"optout",()=>e.innerType._zod.optout),we(t._zod,"pattern",()=>{const r=e.innerType._zod.pattern;return r?new RegExp(`^(${mo(r.source)}|null)$`):void 0}),we(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(r,n)=>r.value===null?r:e.innerType._zod.run(r,n)}),ml=U("$ZodDefault",(t,e)=>{Le.init(t,e),t._zod.optin="optional",we(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);if(r.value===void 0)return r.value=e.defaultValue,r;const i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>ps(o,e)):ps(i,e)}});function ps(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}const gl=U("$ZodPrefault",(t,e)=>{Le.init(t,e),t._zod.optin="optional",we(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>(n.direction==="backward"||r.value===void 0&&(r.value=e.defaultValue),e.innerType._zod.run(r,n))}),yl=U("$ZodNonOptional",(t,e)=>{Le.init(t,e),we(t._zod,"values",()=>{const r=e.innerType._zod.values;return r?new Set([...r].filter(n=>n!==void 0)):void 0}),t._zod.parse=(r,n)=>{const i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>ms(o,t)):ms(i,t)}});function ms(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}const wl=U("$ZodCatch",(t,e)=>{Le.init(t,e),t._zod.optin="optional",we(t._zod,"optout",()=>e.innerType._zod.optout),we(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(o=>(r.value=o.value,o.issues.length&&(r.value=e.catchValue({...r,error:{issues:o.issues.map(s=>wr(s,n,yr()))},input:r.value}),r.issues=[],r.fallback=!0),r)):(r.value=i.value,i.issues.length&&(r.value=e.catchValue({...r,error:{issues:i.issues.map(o=>wr(o,n,yr()))},input:r.value}),r.issues=[],r.fallback=!0),r)}}),vl=U("$ZodPipe",(t,e)=>{Le.init(t,e),we(t._zod,"values",()=>e.in._zod.values),we(t._zod,"optin",()=>e.in._zod.optin),we(t._zod,"optout",()=>e.out._zod.optout),we(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(r,n)=>{if(n.direction==="backward"){const o=e.out._zod.run(r,n);return o instanceof Promise?o.then(s=>En(s,e.in,n)):En(o,e.in,n)}const i=e.in._zod.run(r,n);return i instanceof Promise?i.then(o=>En(o,e.out,n)):En(i,e.out,n)}});function En(t,e,r){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},r)}const bl=U("$ZodReadonly",(t,e)=>{Le.init(t,e),we(t._zod,"propValues",()=>e.innerType._zod.propValues),we(t._zod,"values",()=>e.innerType._zod.values),we(t._zod,"optin",()=>{var r,n;return(n=(r=e.innerType)==null?void 0:r._zod)==null?void 0:n.optin}),we(t._zod,"optout",()=>{var r,n;return(n=(r=e.innerType)==null?void 0:r._zod)==null?void 0:n.optout}),t._zod.parse=(r,n)=>{if(n.direction==="backward")return e.innerType._zod.run(r,n);const i=e.innerType._zod.run(r,n);return i instanceof Promise?i.then(gs):gs(i)}});function gs(t){return t.value=Object.freeze(t.value),t}const _l=U("$ZodCustom",(t,e)=>{Mt.init(t,e),Le.init(t,e),t._zod.parse=(r,n)=>r,t._zod.check=r=>{const n=r.value,i=e.fn(n);if(i instanceof Promise)return i.then(o=>ys(o,r,n,t));ys(i,r,n,t)}});function ys(t,e,r,n){if(!t){const i={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(i.params=n._zod.def.params),e.issues.push(Hr(i))}}var ws;class El{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...r){const n=r[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const r=this._map.get(e);return r&&typeof r=="object"&&"id"in r&&this._idmap.delete(r.id),this._map.delete(e),this}get(e){const r=e._zod.parent;if(r){const n={...this.get(r)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function xl(){return new El}(ws=globalThis).__zod_globalRegistry??(ws.__zod_globalRegistry=xl());const Jr=globalThis.__zod_globalRegistry;function Sl(t,e){return new t({type:"string",...H(e)})}function Il(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...H(e)})}function vs(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...H(e)})}function kl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...H(e)})}function Al(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...H(e)})}function Ml(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...H(e)})}function Bl(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...H(e)})}function Ol(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...H(e)})}function Rl(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...H(e)})}function zl(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...H(e)})}function Tl(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...H(e)})}function Pl(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...H(e)})}function Ul(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...H(e)})}function $l(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...H(e)})}function Cl(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...H(e)})}function Nl(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...H(e)})}function Fl(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...H(e)})}function Ll(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...H(e)})}function Dl(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...H(e)})}function Zl(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...H(e)})}function jl(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...H(e)})}function Kl(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...H(e)})}function Vl(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...H(e)})}function ql(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...H(e)})}function Wl(t,e){return new t({type:"string",format:"date",check:"string_format",...H(e)})}function Jl(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...H(e)})}function Gl(t,e){return new t({type:"string",format:"duration",check:"string_format",...H(e)})}function Yl(t,e){return new t({type:"number",checks:[],...H(e)})}function Hl(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...H(e)})}function Xl(t,e){return new t({type:"boolean",...H(e)})}function Ql(t){return new t({type:"unknown"})}function eh(t,e){return new t({type:"never",...H(e)})}function bs(t,e){return new la({check:"less_than",...H(e),value:t,inclusive:!1})}function $i(t,e){return new la({check:"less_than",...H(e),value:t,inclusive:!0})}function _s(t,e){return new ha({check:"greater_than",...H(e),value:t,inclusive:!1})}function Ci(t,e){return new ha({check:"greater_than",...H(e),value:t,inclusive:!0})}function Es(t,e){return new gf({check:"multiple_of",...H(e),value:t})}function va(t,e){return new wf({check:"max_length",...H(e),maximum:t})}function Rn(t,e){return new vf({check:"min_length",...H(e),minimum:t})}function ba(t,e){return new bf({check:"length_equals",...H(e),length:t})}function th(t,e){return new _f({check:"string_format",format:"regex",...H(e),pattern:t})}function rh(t){return new Ef({check:"string_format",format:"lowercase",...H(t)})}function nh(t){return new xf({check:"string_format",format:"uppercase",...H(t)})}function ih(t,e){return new Sf({check:"string_format",format:"includes",...H(e),includes:t})}function oh(t,e){return new If({check:"string_format",format:"starts_with",...H(e),prefix:t})}function sh(t,e){return new kf({check:"string_format",format:"ends_with",...H(e),suffix:t})}function Dr(t){return new Af({check:"overwrite",tx:t})}function ah(t){return Dr(e=>e.normalize(t))}function uh(){return Dr(t=>t.trim())}function ch(){return Dr(t=>t.toLowerCase())}function fh(){return Dr(t=>t.toUpperCase())}function lh(){return Dr(t=>yc(t))}function hh(t,e,r){return new t({type:"array",element:e,...H(r)})}function dh(t,e,r){return new t({type:"custom",check:"custom",fn:e,...H(r)})}function ph(t,e){const r=mh(n=>(n.addIssue=i=>{if(typeof i=="string")n.issues.push(Hr(i,n.value,r._zod.def));else{const o=i;o.fatal&&(o.continue=!1),o.code??(o.code="custom"),o.input??(o.input=n.value),o.inst??(o.inst=r),o.continue??(o.continue=!r._zod.def.abort),n.issues.push(Hr(o))}},t(n.value,n)),e);return r}function mh(t,e){const r=new Mt({check:"custom",...H(e)});return r._zod.check=t,r}function _a(t){let e=(t==null?void 0:t.target)??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:(t==null?void 0:t.metadata)??Jr,target:e,unrepresentable:(t==null?void 0:t.unrepresentable)??"throw",override:(t==null?void 0:t.override)??(()=>{}),io:(t==null?void 0:t.io)??"output",counter:0,seen:new Map,cycles:(t==null?void 0:t.cycles)??"ref",reused:(t==null?void 0:t.reused)??"inline",external:(t==null?void 0:t.external)??void 0}}function lt(t,e,r={path:[],schemaPath:[]}){var x,M;var n;const i=t._zod.def,o=e.seen.get(t);if(o)return o.count++,r.schemaPath.includes(t)&&(o.cycle=r.path),o.schema;const s={schema:{},count:1,cycle:void 0,path:r.path};e.seen.set(t,s);const l=(M=(x=t._zod).toJSONSchema)==null?void 0:M.call(x);if(l)s.schema=l;else{const z={...r,schemaPath:[...r.schemaPath,t],path:r.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,s.schema,z);else{const $=s.schema,N=e.processors[i.type];if(!N)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);N(t,e,$,z)}const O=t._zod.parent;O&&(s.ref||(s.ref=O),lt(O,e,z),e.seen.get(O).isParent=!0)}const d=e.metadataRegistry.get(t);return d&&Object.assign(s.schema,d),e.io==="input"&&vt(t)&&(delete s.schema.examples,delete s.schema.default),e.io==="input"&&"_prefault"in s.schema&&((n=s.schema).default??(n.default=s.schema._prefault)),delete s.schema._prefault,e.seen.get(t).schema}function Ea(t,e){var s,l,d,E;const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=new Map;for(const x of t.seen.entries()){const M=(s=t.metadataRegistry.get(x[0]))==null?void 0:s.id;if(M){const z=n.get(M);if(z&&z!==x[0])throw new Error(`Duplicate schema id "${M}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(M,x[0])}}const i=x=>{var N;const M=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){const D=(N=t.external.registry.get(x[0]))==null?void 0:N.id,P=t.external.uri??(Z=>Z);if(D)return{ref:P(D)};const F=x[1].defId??x[1].schema.id??`schema${t.counter++}`;return x[1].defId=F,{defId:F,ref:`${P("__shared")}#/${M}/${F}`}}if(x[1]===r)return{ref:"#"};const O=`#/${M}/`,$=x[1].schema.id??`__schema${t.counter++}`;return{defId:$,ref:O+$}},o=x=>{if(x[1].schema.$ref)return;const M=x[1],{ref:z,defId:O}=i(x);M.def={...M.schema},O&&(M.defId=O);const $=M.schema;for(const N in $)delete $[N];$.$ref=z};if(t.cycles==="throw")for(const x of t.seen.entries()){const M=x[1];if(M.cycle)throw new Error(`Cycle detected: #/${(l=M.cycle)==null?void 0:l.join("/")}/<root> 63 64Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const x of t.seen.entries()){const M=x[1];if(e===x[0]){o(x);continue}if(t.external){const O=(d=t.external.registry.get(x[0]))==null?void 0:d.id;if(e!==x[0]&&O){o(x);continue}}if((E=t.metadataRegistry.get(x[0]))==null?void 0:E.id){o(x);continue}if(M.cycle){o(x);continue}if(M.count>1&&t.reused==="ref"){o(x);continue}}}function xa(t,e){var l,d,E,x;const r=t.seen.get(e);if(!r)throw new Error("Unprocessed schema. This is a bug in Zod.");const n=M=>{const z=t.seen.get(M);if(z.ref===null)return;const O=z.def??z.schema,$={...O},N=z.ref;if(z.ref=null,N){n(N);const P=t.seen.get(N),F=P.schema;if(F.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(O.allOf=O.allOf??[],O.allOf.push(F)):Object.assign(O,F),Object.assign(O,$),M._zod.parent===N)for(const W in O)W==="$ref"||W==="allOf"||W in $||delete O[W];if(F.$ref&&P.def)for(const W in O)W==="$ref"||W==="allOf"||W in P.def&&JSON.stringify(O[W])===JSON.stringify(P.def[W])&&delete O[W]}const D=M._zod.parent;if(D&&D!==N){n(D);const P=t.seen.get(D);if(P!=null&&P.schema.$ref&&(O.$ref=P.schema.$ref,P.def))for(const F in O)F==="$ref"||F==="allOf"||F in P.def&&JSON.stringify(O[F])===JSON.stringify(P.def[F])&&delete O[F]}t.override({zodSchema:M,jsonSchema:O,path:z.path??[]})};for(const M of[...t.seen.entries()].reverse())n(M[0]);const i={};if(t.target==="draft-2020-12"?i.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?i.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?i.$schema="http://json-schema.org/draft-04/schema#":t.target,(l=t.external)!=null&&l.uri){const M=(d=t.external.registry.get(e))==null?void 0:d.id;if(!M)throw new Error("Schema is missing an `id` property");i.$id=t.external.uri(M)}Object.assign(i,r.def??r.schema);const o=(E=t.metadataRegistry.get(e))==null?void 0:E.id;o!==void 0&&i.id===o&&delete i.id;const s=((x=t.external)==null?void 0:x.defs)??{};for(const M of t.seen.entries()){const z=M[1];z.def&&z.defId&&(z.def.id===z.defId&&delete z.def.id,s[z.defId]=z.def)}t.external||Object.keys(s).length>0&&(t.target==="draft-2020-12"?i.$defs=s:i.definitions=s);try{const M=JSON.parse(JSON.stringify(i));return Object.defineProperty(M,"~standard",{value:{...e["~standard"],jsonSchema:{input:zn(e,"input",t.processors),output:zn(e,"output",t.processors)}},enumerable:!1,writable:!1}),M}catch{throw new Error("Error converting schema to JSON.")}}function vt(t,e){const r=e??{seen:new Set};if(r.seen.has(t))return!1;r.seen.add(t);const n=t._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return vt(n.element,r);if(n.type==="set")return vt(n.valueType,r);if(n.type==="lazy")return vt(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault")return vt(n.innerType,r);if(n.type==="intersection")return vt(n.left,r)||vt(n.right,r);if(n.type==="record"||n.type==="map")return vt(n.keyType,r)||vt(n.valueType,r);if(n.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:vt(n.in,r)||vt(n.out,r);if(n.type==="object"){for(const i in n.shape)if(vt(n.shape[i],r))return!0;return!1}if(n.type==="union"){for(const i of n.options)if(vt(i,r))return!0;return!1}if(n.type==="tuple"){for(const i of n.items)if(vt(i,r))return!0;return!!(n.rest&&vt(n.rest,r))}return!1}const gh=(t,e={})=>r=>{const n=_a({...r,processors:e});return lt(t,n),Ea(n,t),xa(n,t)},zn=(t,e,r={})=>n=>{const{libraryOptions:i,target:o}=n??{},s=_a({...i??{},target:o,io:e,processors:r});return lt(t,s),Ea(s,t),xa(s,t)},yh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},wh=(t,e,r,n)=>{const i=r;i.type="string";const{minimum:o,maximum:s,format:l,patterns:d,contentEncoding:E}=t._zod.bag;if(typeof o=="number"&&(i.minLength=o),typeof s=="number"&&(i.maxLength=s),l&&(i.format=yh[l]??l,i.format===""&&delete i.format,l==="time"&&delete i.format),E&&(i.contentEncoding=E),d&&d.size>0){const x=[...d];x.length===1?i.pattern=x[0].source:x.length>1&&(i.allOf=[...x.map(M=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:M.source}))])}},vh=(t,e,r,n)=>{const i=r,{minimum:o,maximum:s,format:l,multipleOf:d,exclusiveMaximum:E,exclusiveMinimum:x}=t._zod.bag;typeof l=="string"&&l.includes("int")?i.type="integer":i.type="number";const M=typeof x=="number"&&x>=(o??Number.NEGATIVE_INFINITY),z=typeof E=="number"&&E<=(s??Number.POSITIVE_INFINITY),O=e.target==="draft-04"||e.target==="openapi-3.0";M?O?(i.minimum=x,i.exclusiveMinimum=!0):i.exclusiveMinimum=x:typeof o=="number"&&(i.minimum=o),z?O?(i.maximum=E,i.exclusiveMaximum=!0):i.exclusiveMaximum=E:typeof s=="number"&&(i.maximum=s),typeof d=="number"&&(i.multipleOf=d)},bh=(t,e,r,n)=>{r.type="boolean"},_h=(t,e,r,n)=>{r.not={}},Eh=(t,e,r,n)=>{},xh=(t,e,r,n)=>{const i=t._zod.def,o=ea(i.entries);o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),r.enum=o},Sh=(t,e,r,n)=>{const i=t._zod.def,o=[];for(const s of i.values)if(s===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof s=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");o.push(Number(s))}else o.push(s);if(o.length!==0)if(o.length===1){const s=o[0];r.type=s===null?"null":typeof s,e.target==="draft-04"||e.target==="openapi-3.0"?r.enum=[s]:r.const=s}else o.every(s=>typeof s=="number")&&(r.type="number"),o.every(s=>typeof s=="string")&&(r.type="string"),o.every(s=>typeof s=="boolean")&&(r.type="boolean"),o.every(s=>s===null)&&(r.type="null"),r.enum=o},Ih=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},kh=(t,e,r,n)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Ah=(t,e,r,n)=>{const i=r,o=t._zod.def,{minimum:s,maximum:l}=t._zod.bag;typeof s=="number"&&(i.minItems=s),typeof l=="number"&&(i.maxItems=l),i.type="array",i.items=lt(o.element,e,{...n,path:[...n.path,"items"]})},Mh=(t,e,r,n)=>{var E;const i=r,o=t._zod.def;i.type="object",i.properties={};const s=o.shape;for(const x in s)i.properties[x]=lt(s[x],e,{...n,path:[...n.path,"properties",x]});const l=new Set(Object.keys(s)),d=new Set([...l].filter(x=>{const M=o.shape[x]._zod;return e.io==="input"?M.optin===void 0:M.optout===void 0}));d.size>0&&(i.required=Array.from(d)),((E=o.catchall)==null?void 0:E._zod.def.type)==="never"?i.additionalProperties=!1:o.catchall?o.cat
vendor: 9,547 bytes, line 64
64chall&&(i.additionalProperties=lt(o.catchall,e,{...n,path:[...n.path,"additionalProperties"]})):e.io==="output"&&(i.additionalProperties=!1)},Bh=(t,e,r,n)=>{const i=t._zod.def,o=i.inclusive===!1,s=i.options.map((l,d)=>lt(l,e,{...n,path:[...n.path,o?"oneOf":"anyOf",d]}));o?r.oneOf=s:r.anyOf=s},Oh=(t,e,r,n)=>{const i=t._zod.def,o=lt(i.left,e,{...n,path:[...n.path,"allOf",0]}),s=lt(i.right,e,{...n,path:[...n.path,"allOf",1]}),l=E=>"allOf"in E&&Object.keys(E).length===1,d=[...l(o)?o.allOf:[o],...l(s)?s.allOf:[s]];r.allOf=d},Rh=(t,e,r,n)=>{const i=t._zod.def,o=lt(i.innerType,e,n),s=e.seen.get(t);e.target==="openapi-3.0"?(s.ref=i.innerType,r.nullable=!0):r.anyOf=[o,{type:"null"}]},zh=(t,e,r,n)=>{const i=t._zod.def;lt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType},Th=(t,e,r,n)=>{const i=t._zod.def;lt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType,r.default=JSON.parse(JSON.stringify(i.defaultValue))},Ph=(t,e,r,n)=>{const i=t._zod.def;lt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType,e.io==="input"&&(r._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Uh=(t,e,r,n)=>{const i=t._zod.def;lt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType;let s;try{s=i.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}r.default=s},$h=(t,e,r,n)=>{const i=t._zod.def,o=i.in._zod.traits.has("$ZodTransform"),s=e.io==="input"?o?i.out:i.in:i.out;lt(s,e,n);const l=e.seen.get(t);l.ref=s},Ch=(t,e,r,n)=>{const i=t._zod.def;lt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType,r.readOnly=!0},Sa=(t,e,r,n)=>{const i=t._zod.def;lt(i.innerType,e,n);const o=e.seen.get(t);o.ref=i.innerType},Nh=U("ZodISODateTime",(t,e)=>{Df.init(t,e),ze.init(t,e)});function Fh(t){return ql(Nh,t)}const Lh=U("ZodISODate",(t,e)=>{Zf.init(t,e),ze.init(t,e)});function Dh(t){return Wl(Lh,t)}const Zh=U("ZodISOTime",(t,e)=>{jf.init(t,e),ze.init(t,e)});function jh(t){return Jl(Zh,t)}const Kh=U("ZodISODuration",(t,e)=>{Kf.init(t,e),ze.init(t,e)});function Vh(t){return Gl(Kh,t)}const qh=(t,e)=>{oa.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:r=>Rc(t,r)},flatten:{value:r=>Oc(t,r)},addIssue:{value:r=>{t.issues.push(r),t.message=JSON.stringify(t.issues,Yi,2)}},addIssues:{value:r=>{t.issues.push(...r),t.message=JSON.stringify(t.issues,Yi,2)}},isEmpty:{get(){return t.issues.length===0}}})},Ft=U("ZodError",qh,{Parent:Error}),Wh=yo(Ft),Jh=wo(Ft),Gh=ti(Ft),Yh=ri(Ft),Hh=Pc(Ft),Xh=Uc(Ft),Qh=$c(Ft),ed=Cc(Ft),td=Nc(Ft),rd=Fc(Ft),nd=Lc(Ft),id=Dc(Ft),xs=new WeakMap;function dn(t,e,r){const n=Object.getPrototypeOf(t);let i=xs.get(n);if(i||(i=new Set,xs.set(n,i)),!i.has(e)){i.add(e);for(const o in r){const s=r[o];Object.defineProperty(n,o,{configurable:!0,enumerable:!1,get(){const l=s.bind(this);return Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:l}),l},set(l){Object.defineProperty(this,o,{configurable:!0,writable:!0,enumerable:!0,value:l})}})}}}const De=U("ZodType",(t,e)=>(Le.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:zn(t,"input"),output:zn(t,"output")}}),t.toJSONSchema=gh(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(r,n)=>Wh(t,r,n,{callee:t.parse}),t.safeParse=(r,n)=>Gh(t,r,n),t.parseAsync=async(r,n)=>Jh(t,r,n,{callee:t.parseAsync}),t.safeParseAsync=async(r,n)=>Yh(t,r,n),t.spa=t.safeParseAsync,t.encode=(r,n)=>Hh(t,r,n),t.decode=(r,n)=>Xh(t,r,n),t.encodeAsync=async(r,n)=>Qh(t,r,n),t.decodeAsync=async(r,n)=>ed(t,r,n),t.safeEncode=(r,n)=>td(t,r,n),t.safeDecode=(r,n)=>rd(t,r,n),t.safeEncodeAsync=async(r,n)=>nd(t,r,n),t.safeDecodeAsync=async(r,n)=>id(t,r,n),dn(t,"ZodType",{check(...r){const n=this.def;return this.clone(lr(n,{checks:[...n.checks??[],...r.map(i=>typeof i=="function"?{_zod:{check:i,def:{check:"custom"},onattach:[]}}:i)]}),{parent:!0})},with(...r){return this.check(...r)},clone(r,n){return hr(this,r,n)},brand(){return this},register(r,n){return r.add(this,n),this},refine(r,n){return this.check(Hd(r,n))},superRefine(r,n){return this.check(Xd(r,n))},overwrite(r){return this.check(Dr(r))},optional(){return As(this)},exactOptional(){return Nd(this)},nullable(){return Ms(this)},nullish(){return As(Ms(this))},nonoptional(r){return Kd(this,r)},array(){return cr(this)},or(r){return Xr([this,r])},and(r){return Td(this,r)},transform(r){return Bs(this,$d(r))},default(r){return Dd(this,r)},prefault(r){return jd(this,r)},catch(r){return qd(this,r)},pipe(r){return Bs(this,r)},readonly(){return Gd(this)},describe(r){const n=this.clone();return Jr.add(n,{description:r}),n},meta(...r){if(r.length===0)return Jr.get(this);const n=this.clone();return Jr.add(n,r[0]),n},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(r){return r(this)}}),Object.defineProperty(t,"description",{get(){var r;return(r=Jr.get(t))==null?void 0:r.description},configurable:!0}),t)),Ia=U("_ZodString",(t,e)=>{vo.init(t,e),De.init(t,e),t._zod.processJSONSchema=(n,i,o)=>wh(t,n,i);const r=t._zod.bag;t.format=r.format??null,t.minLength=r.minimum??null,t.maxLength=r.maximum??null,dn(t,"_ZodString",{regex(...n){return this.check(th(...n))},includes(...n){return this.check(ih(...n))},startsWith(...n){return this.check(oh(...n))},endsWith(...n){return this.check(sh(...n))},min(...n){return this.check(Rn(...n))},max(...n){return this.check(va(...n))},length(...n){return this.check(ba(...n))},nonempty(...n){return this.check(Rn(1,...n))},lowercase(n){return this.check(rh(n))},uppercase(n){return this.check(nh(n))},trim(){return this.check(uh())},normalize(...n){return this.check(ah(...n))},toLowerCase(){return this.check(ch())},toUpperCase(){return this.check(fh())},slugify(){return this.check(lh())}})}),od=U("ZodString",(t,e)=>{vo.init(t,e),Ia.init(t,e),t.email=r=>t.check(Il(sd,r)),t.url=r=>t.check(Ol(ad,r)),t.jwt=r=>t.check(Vl(Ed,r)),t.emoji=r=>t.check(Rl(ud,r)),t.guid=r=>t.check(vs(Ss,r)),t.uuid=r=>t.check(kl(xn,r)),t.uuidv4=r=>t.check(Al(xn,r)),t.uuidv6=r=>t.check(Ml(xn,r)),t.uuidv7=r=>t.check(Bl(xn,r)),t.nanoid=r=>t.check(zl(cd,r)),t.guid=r=>t.check(vs(Ss,r)),t.cuid=r=>t.check(Tl(fd,r)),t.cuid2=r=>t.check(Pl(ld,r)),t.ulid=r=>t.check(Ul(hd,r)),t.base64=r=>t.check(Zl(vd,r)),t.base64url=r=>t.check(jl(bd,r)),t.xid=r=>t.check($l(dd,r)),t.ksuid=r=>t.check(Cl(pd,r)),t.ipv4=r=>t.check(Nl(md,r)),t.ipv6=r=>t.check(Fl(gd,r)),t.cidrv4=r=>t.check(Ll(yd,r)),t.cidrv6=r=>t.check(Dl(wd,r)),t.e164=r=>t.check(Kl(_d,r)),t.datetime=r=>t.check(Fh(r)),t.date=r=>t.check(Dh(r)),t.time=r=>t.check(jh(r)),t.duration=r=>t.check(Vh(r))});function Ne(t){return Sl(od,t)}const ze=U("ZodStringFormat",(t,e)=>{Me.init(t,e),Ia.init(t,e)}),sd=U("ZodEmail",(t,e)=>{zf.init(t,e),ze.init(t,e)}),Ss=U("ZodGUID",(t,e)=>{Of.init(t,e),ze.init(t,e)}),xn=U("ZodUUID",(t,e)=>{Rf.init(t,e),ze.init(t,e)}),ad=U("ZodURL",(t,e)=>{Tf.init(t,e),ze.init(t,e)}),ud=U("ZodEmoji",(t,e)=>{Pf.init(t,e),ze.init(t,e)}),cd=U("ZodNanoID",(t,e)=>{Uf.init(t,e),ze.init(t,e)}),fd=U("ZodCUID",(t,e)=>{$f.init(t,e),ze.init(t,e)}),ld=U("ZodCUID2",(t,e)=>{Cf.init(t,e),ze.init(t,e)}),hd=U("ZodULID",(t,e)=>{Nf.init(t,e),ze.init(t,e)}),dd=U("ZodXID",(t,e)=>{Ff.init(t,e),ze.init(t,e)}),pd=U("ZodKSUID",(t,e)=>{Lf.init(t,e),ze.init(t,e)}),md=U("ZodIPv4",(t,e)=>{Vf.init(t,e),ze.init(t,e)}),gd=U("ZodIPv6",(t,e)=>{qf.init(t,e),ze.init(t,e)}),yd=U("ZodCIDRv4",(t,e)=>{Wf.init(t,e),ze.init(t,e)}),wd=U("ZodCIDRv6",(t,e)=>{Jf.init(t,e),ze.init(t,e)}),vd=U("ZodBase64",(t,e)=>{Gf.init(t,e),ze.init(t,e)}),bd=U("ZodBase64URL",(t,e)=>{Hf.init(t,e),ze.init(t,e)}),_d=U("ZodE164",(t,e)=>{Xf.init(t,e),ze.init(t,e)}),Ed=U("ZodJWT",(t,e)=>{el.init(t,e),ze.init(t,e)}),ka=U("ZodNumber",(t,e)=>{pa.init(t,e),De.init(t,e),t._zod.processJSONSchema=(n,i,o)=>vh(t,n,i),dn(t,"ZodNumber",{gt(n,i){return this.check(_s(n,i))},gte(n,i){return this.check(Ci(n,i))},min(n,i){return this.check(Ci(n,i))},lt(n,i){return this.check(bs(n,i))},lte(n,i){return this.check($i(n,i))},max(n,i){return this.check($i(n,i))},int(n){return this.check(Is(n))},safe(n){return this.check(Is(n))},positive(n){return this.check(_s(0,n))},nonnegative(n){return this.check(Ci(0,n))},negative(n){return this.check(bs(0,n))},nonpositive(n){return this.check($i(0,n))},multipleOf(n,i){return this.check(Es(n,i))},step(n,i){return this.check(Es(n,i))},finite(){return this}});const r=t._zod.bag;t.minValue=Math.max(r.minimum??Number.NEGATIVE_INFINITY,r.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(r.maximum??Number.POSITIVE_INFINITY,r.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(r.format??"").includes("int")||Number.isSafeInteger(r.multipleOf??.5),t.isFinite=!0,t.format=r.format??null});function Aa(t){return Yl(ka,t)}const xd=U("ZodNumberFormat",(t,e)=>{tl.init(t,e),ka.init(t,e)});function Is(t){return Hl(xd,t)}const Sd=U("ZodBoolean",(t,e)=>{rl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>bh(t,r,n)});function Id(t){return Xl(Sd,t)}const kd=U("ZodUnknown",(t,e)=>{nl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Eh()});function ks(){return Ql(kd)}const Ad=U("ZodNever",(t,e)=>{il.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>_h(t,r,n)});function Md(t){return eh(Ad,t)}const Bd=U("ZodArray",(t,e)=>{ol.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Ah(t,r,n,i),t.element=e.element,dn(t,"ZodArray",{min(r,n){return this.check(Rn(r,n))},nonempty(r){return this.check(Rn(1,r))},max(r,n){return this.check(va(r,n))},length(r,n){return this.check(ba(r,n))},unwrap(){return this.element}})});function cr(t,e){return hh(Bd,t,e)}
64const Od=U("ZodObject",(t,e)=>{al.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Mh(t,r,n,i),we(t,"shape",()=>e.shape),dn(t,"ZodObject",{keyof(){return ii(Object.keys(this._zod.def.shape))},catchall(r){return this.clone({...this._zod.def,catchall:r})},passthrough(){return this.clone({...this._zod.def,catchall:ks()})},loose(){return this.clone({...this._zod.def,catchall:ks()})},strict(){return this.clone({...this._zod.def,catchall:Md()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(r){return Sc(this,r)},safeExtend(r){return Ic(this,r)},merge(r){return kc(this,r)},pick(r){return Ec(this,r)},omit(r){return xc(this,r)},partial(...r){return Ac(Oa,this,r[0])},required(...r){return Mc(Ra,this,r[0])}})});function ht(t,e){const r={type:"object",shape:t??{},...H(e)};return new Od(r)}const Ma=U("ZodUnion",(t,e)=>{ya.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Bh(t,r,n,i),t.options=e.options});function Xr(t,e){return new Ma({type:"union",options:t,...H(e)})}const Rd=U("ZodDiscriminatedUnion",(t,e)=>{Ma.init(t,e),ul.init(t,e)});function Ba(t,e,r){return new Rd({type:"union",options:e,discriminator:t,...H(r)})}const zd=U("ZodIntersection",(t,e)=>{cl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Oh(t,r,n,i)});function Td(t,e){return new zd({type:"intersection",left:t,right:e})}const Xi=U("ZodEnum",(t,e)=>{fl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(n,i,o)=>xh(t,n,i),t.enum=e.entries,t.options=Object.values(e.entries);const r=new Set(Object.keys(e.entries));t.extract=(n,i)=>{const o={};for(const s of n)if(r.has(s))o[s]=e.entries[s];else throw new Error(`Key ${s} not found in enum`);return new Xi({...e,checks:[],...H(i),entries:o})},t.exclude=(n,i)=>{const o={...e.entries};for(const s of n)if(r.has(s))delete o[s];else throw new Error(`Key ${s} not found in enum`);return new Xi({...e,checks:[],...H(i),entries:o})}});function ii(t,e){const r=Array.isArray(t)?Object.fromEntries(t.map(n=>[n,n])):t;return new Xi({type:"enum",entries:r,...H(e)})}const Pd=U("ZodLiteral",(t,e)=>{ll.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Sh(t,r,n),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if
vendor: 1,834 bytes, line 64
64(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function wt(t,e){return new Pd({type:"literal",values:Array.isArray(t)?t:[t],...H(e)})}const Ud=U("ZodTransform",(t,e)=>{hl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>kh(t,r),t._zod.parse=(r,n)=>{if(n.direction==="backward")throw new Qs(t.constructor.name);r.addIssue=o=>{if(typeof o=="string")r.issues.push(Hr(o,r.value,e));else{const s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=t),r.issues.push(Hr(s))}};const i=e.transform(r.value,r);return i instanceof Promise?i.then(o=>(r.value=o,r.fallback=!0,r)):(r.value=i,r.fallback=!0,r)}});function $d(t){return new Ud({type:"transform",transform:t})}const Oa=U("ZodOptional",(t,e)=>{wa.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Sa(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function As(t){return new Oa({type:"optional",innerType:t})}const Cd=U("ZodExactOptional",(t,e)=>{dl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Sa(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Nd(t){return new Cd({type:"optional",innerType:t})}const Fd=U("ZodNullable",(t,e)=>{pl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Rh(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Ms(t){return new Fd({type:"nullable",innerType:t})}const Ld=U("ZodDefault",(t,e)=>{ml.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Th(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Dd(t,e){return new Ld({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():ra(e)}})}const Zd=U("ZodPrefault",(t,e)=>{gl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Ph(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});
64function jd(t,e){return new Zd({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():ra(e)}})}const Ra=U("ZodNonOptional",(t,e)=>{yl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>zh(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Kd(t,e){return new Ra({type:"nonoptional",innerType:t,...H(e)})}const Vd=U("ZodCatch",(t,e)=>{wl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Uh(t,r,n,i),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function qd(t,e){return new Vd({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}const Wd=U("ZodPipe",(t,e)=>{vl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>$h(t,r,n,i),t.in=e.in,t.out=e.out});function Bs(t,e){return new Wd({type:"pipe",in:t,out:e})}const Jd=U("ZodReadonly",(t,e)=>{bl.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Ch(t,r,n,i),t.unwrap=()=>t._zod.def.innerType});function Gd(t){return new Jd({type:"readonly",innerType:t})}const Yd=U("ZodCustom",(t,e)=>{_l.init(t,e),De.init(t,e),t._zod.processJSONSchema=(r,n,i)=>Ih(t,r)});function Hd(t,e={}){return dh(Yd,t,e)}function Xd(t,e){return ph(t,e)}const Qd=/[@#$%^&*+=/\\|~«»]/,e0=/(!{2,}|\?{2,}|-{2,})/,t0=/[\u{1F300}-\u{1F9FF}]|[\u{2702}-\u{27B0}]|[\u{2600}-\u{26FF}]|[\u{2B00}-\u{2BFF}]/u,Zr=({max:t,noSpaces:e}={})=>(e?Ne().max(t??Number.POSITIVE_INFINITY).regex(/^\S*$/,{message:"Spaces are not allowed"}):Ne().max(t??Number.POSITIVE_INFINITY)).refine(n=>!t0.test(n),{message:"Emojis and symbols are not allowed"}).refine(n=>!Qd.test(n),{message:"Special characters (@, #, $, %, ^, &, *, +, =, /, \\, |, ~, «, ») are not allowed"}).refine(n=>!e0.test(n),{message:"Repeated punctuations (!!, ??, --) are not allowed"}),bt=Ne().url().startsWith("https://",{message:"Must be an https url"}).max(1024).refine(t=>!t.includes(" "),{message:"URL must not contain spaces"}).refine(t=>{try{const e=new URL(t).hostname;return!(e==="localhost"||e.endsWith(".localhost")||/^(\d{1,3}\.){3}\d{1,3}$/.test(e)||e.startsWith("[")&&e.endsWith("]"))}catch{return!1}},{message:"URL must not use IP addresses or localhost"}),bo=Ne().max(32),za=Ne().max(32),r0=/^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}\/(?:[-a-z0-9]{3,8}:[-.%a-zA-Z0-9]{1,128}(?:\/[-.%a-zA-Z0-9]{1,78})?|native)$/,n0=Ne().regex(r0,{message:"Invalid CAIP-19 asset ID"}),_o=Ne().regex(/^#([0-9A-F]{3}|[0-9A-F]{6})$/i,{message:"Invalid hex color code. It should be in the format #RRGGBB or #RGB."}),i0=/^(?!.*\.\.)([a-zA-Z0-9]([a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$/,o0=Ne().max(1024).regex(i0,{message:"Must be a valid domain name (e.g., example.com, sub.example.com)"}).refine(t=>!t.includes("://"),{message:"Domain must not include protocol (http://, https://, etc.)"}).refine(t=>!t.includes("/"),{message:"Domain must not include path separators"}).refine(t=>!t.includes("@"),{message:"Domain must not include @ symbol"}).refine(t=>!t.includes(":"),{message:"Domain must not include port numbers"}),s0=Xr([wt("1:1"),wt("3:2")]),a0=ht({header:Ne(),payload:Ne(),signature:Ne()});ht({fid:Aa(),type:wt("app_key"),key:Ne().startsWith("0x")});const u0=ht({type:wt("launch_frame"),name:bo,url:bt.optional(),splashImageUrl:bt.optional(),splashBackgroundColor:_o.optional()}),c0=ht({type:wt("launch_miniapp"),name:bo,url:bt.optional(),splashImageUrl:bt.optional(),splashBackgroundColor:_o.optional()}),f0=ht({type:wt("view_token"),token:n0}),l0=Ba("type",[c0,f0,u0]),h0=ht({title:za,action:l0});ht({version:Xr([Ne(),Aa()]).transform(t=>String(t)).pipe(Xr([wt("next"),wt("1")])),imageUrl:bt,aspectRatio:s0.optional(),button:h0});const Ta=ht({url:Ne(),token:Ne()});ht({notificationId:Ne().max(128),title:Ne().max(32),body:Ne().max(128),targetUrl:bt,tokens:Ne().array().max(100)});ht({result:ht({successfulTokens:cr(Ne()),invalidTokens:cr(Ne()),rateLimitedTokens:cr(Ne())})});const d0=ht({event:wt("miniapp_added"),notificationDetails:Ta.optional()}),p0=ht({event:wt("miniapp_removed")}),m0=ht({event:wt("notifications_enabled"),notificationDetails:Ta.required()}),g0=ht({event:wt("notifications_disabled")});Ba("event",[d0,p0,m0,g0]);
vendor: 4,137 bytes, line 64
64const y0=["wallet.getEthereumProvider","wallet.getSolanaProvider","actions.ready","actions.openUrl","actions.close","actions.setPrimaryButton","actions.addMiniApp","actions.signIn","actions.viewCast","actions.viewProfile","actions.composeCast","actions.viewToken","actions.sendToken","actions.swapToken","actions.openMiniApp","actions.requestCameraAndMicrophoneAccess","experimental.signManifest","haptics.impactOccurred","haptics.notificationOccurred","haptics.selectionChanged","back"],w0=["games","social","finance","utility","productivity","health-fitness","news-media","music","shopping","education","developer-tools","entertainment","art-creativity"],v0=ii(w0),b0=Xr([wt("0.0.0"),wt("0.0.1"),wt("1"),wt("next")]),_0=Zr({max:30}),E0=Zr({max:170}),x0=cr(bt).max(3),S0=cr(Zr({max:20,noSpaces:!0})).max(5),I0=Zr({max:30}),k0=Zr({max:30}),A0=Zr({max:100}),M0=Id(),B0=["eip155:1","eip155:8453","eip155:42161","eip155:421614","eip155:84532","eip155:666666666","eip155:100","eip155:10","eip155:11155420","eip155:137","eip155:11155111","eip155:7777777","eip155:130","eip155:10143","eip155:42220","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"];function Pa(t){const e=new Set(t);return Array.from(e)}const O0=cr(ii(B0)).transform(Pa),R0=cr(ii(y0)).transform(Pa),Os=ht({version:b0,name:bo,iconUrl:bt,homeUrl:bt,imageUrl:bt.optional(),buttonTitle:za.optional(),splashImageUrl:bt.optional(),splashBackgroundColor:_o.optional(),webhookUrl:bt.optional(),subtitle:_0.optional(),description:E0.optional(),screenshotUrls:x0.optional(),primaryCategory:v0.optional(),tags:S0.optional(),heroImageUrl:bt.optional(),tagline:I0.optional(),ogTitle:k0.optional(),ogDescription:A0.optional(),ogImageUrl:bt.optional(),noindex:M0.optional(),requiredChains:O0.optional(),requiredCapabilities:R0.optional(),castShareUrl:bt.optional(),canonicalDomain:o0.optional()}).refine(t=>{if(t.castShareUrl===void 0)return!0;try{const e=new URL(t.homeUrl).hostname,r=new URL(t.castShareUrl).hostname;return e===r}catch{return!1}},{message:"castShareUrl must have the same domain as homeUrl",path:["castShareUrl"]});ht({accountAssociation:a0,miniapp:Os.optional(),frame:Os.optional()}).refine(t=>t.frame&&t.miniapp?JSON.stringify(t.frame)===JSON.stringify(t.miniapp):!0,{message:'If both "frame" and "miniapp" are provided, they must be identical',path:["frame","miniapp"]}).transform(t=>({...t,frame:t.frame??t.miniapp}));var le={},oi={};oi.byteLength=P0;oi.toByteArray=$0;oi.fromByteArray=F0;var Wt=[],$t=[],z0=typeof Uint8Array<"u"?Uint8Array:Array,Ni="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var Sr=0,T0=Ni.length;Sr<T0;++Sr)Wt[Sr]=Ni[Sr],$t[Ni.charCodeAt(Sr)]=Sr;$t[45]=62;$t[95]=63;function Ua(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function P0(t){var e=Ua(t),r=e[0],n=e[1];return(r+n)*3/4-n}function U0(t,e,r){return(e+r)*3/4-r}function $0(t){var e,r=Ua(t),n=r[0],i=r[1],o=new z0(U0(t,n,i)),s=0,l=i>0?n-4:n,d;for(d=0;d<l;d+=4)e=$t[t.charCodeAt(d)]<<18|$t[t.charCodeAt(d+1)]<<12|$t[t.charCodeAt(d+2)]<<6|$t[t.charCodeAt(d+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=$t[t.charCodeAt(d)]<<2|$t[t.charCodeAt(d+1)]>>4,o[s++]=e&255),i===1&&(e=$t[t.charCodeAt(d)]<<10|$t[t.charCodeAt(d+1)]<<4|$t[t.charCodeAt(d+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function C0(t){return Wt[t>>18&63]+Wt[t>>12&63]+Wt[t>>6&63]+Wt[t&63]}function N0(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(C0(n));return i.join("")}function F0(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,l=r-n;s<l;s+=o)i.push(N0(t,s,s+o>l?l:s+o));return n===1?(e=t[r-1],i.push(Wt[e>>2]+Wt[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Wt[e>>10]+Wt[e>>4&63]+Wt[e<<2&63]+"=")),i.join("")}var Eo={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Eo.read=function(t,e,r,n,i){var o,s,l=i*8-n-1,d=(1<<l)-1,E=d>>1,x=-7,M=r?i-1:0,z=r?-1:1,O=t[e+M];for(M+=z,o=O&(1<<-x)-1,O>>=-x,x+=l;x>0;o=o*256+t[e+M],M+=z,x-=8);for(s=o&(1<<-x)-1,o>>=-x,x+=n;x>0;
vendor: 21,900 bytes, lines 64-69
64s=s*256+t[e+M],M+=z,x-=8);if(o===0)o=1-E;else{if(o===d)return s?NaN:(O?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-E}return(O?-1:1)*s*Math.pow(2,o-n)};Eo.write=function(t,e,r,n,i,o){var s,l,d,E=o*8-i-1,x=(1<<E)-1,M=x>>1,z=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,O=n?0:o-1,$=n?1:-1,N=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(l=isNaN(e)?1:0,s=x):(s=Math.floor(Math.log(e)/Math.LN2),e*(d=Math.pow(2,-s))<1&&(s--,d*=2),s+M>=1?e+=z/d:e+=z*Math.pow(2,1-M),e*d>=2&&(s++,d/=2),s+M>=x?(l=0,s=x):s+M>=1?(l=(e*d-1)*Math.pow(2,i),s=s+M):(l=e*Math.pow(2,M-1)*Math.pow(2,i),s=0));i>=8;t[r+O]=l&255,O+=$,l/=256,i-=8);for(s=s<<i|l,E+=i;E>0;t[r+O]=s&255,O+=$,s/=256,E-=8);t[r+O-$]|=N*128};/*! 65 * The buffer module from node.js, for the browser. 66 * 67 * @author Feross Aboukhadijeh <https://feross.org> 68 * @license MIT 69 */(function(t){const e=oi,r=Eo,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=l,t.SlowBuffer=F,t.INSPECT_MAX_BYTES=50;const i=2147483647;t.kMaxLength=i,l.TYPED_ARRAY_SUPPORT=o(),!l.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{const p=new Uint8Array(1),u={foo:function(){return 42}};return Object.setPrototypeOf(u,Uint8Array.prototype),Object.setPrototypeOf(p,u),p.foo()===42}catch{return!1}}Object.defineProperty(l.prototype,"parent",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.buffer}}),Object.defineProperty(l.prototype,"offset",{enumerable:!0,get:function(){if(l.isBuffer(this))return this.byteOffset}});function s(p){if(p>i)throw new RangeError('The value "'+p+'" is invalid for option "size"');const u=new Uint8Array(p);return Object.setPrototypeOf(u,l.prototype),u}function l(p,u,c){if(typeof p=="number"){if(typeof u=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return M(p)}return d(p,u,c)}l.poolSize=8192;function d(p,u,c){if(typeof p=="string")return z(p,u);if(ArrayBuffer.isView(p))return $(p);if(p==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p);if(Bt(p,ArrayBuffer)||p&&Bt(p.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Bt(p,SharedArrayBuffer)||p&&Bt(p.buffer,SharedArrayBuffer)))return N(p,u,c);if(typeof p=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const g=p.valueOf&&p.valueOf();if(g!=null&&g!==p)return l.from(g,u,c);const I=D(p);if(I)return I;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof p[Symbol.toPrimitive]=="function")return l.from(p[Symbol.toPrimitive]("string"),u,c);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof p)}l.from=function(p,u,c){return d(p,u,c)},Object.setPrototypeOf(l.prototype,Uint8Array.prototype),Object.setPrototypeOf(l,Uint8Array);function E(p){if(typeof p!="number")throw new TypeError('"size" argument must be of type number');if(p<0)throw new RangeError('The value "'+p+'" is invalid for option "size"')}function x(p,u,c){return E(p),p<=0?s(p):u!==void 0?typeof c=="string"?s(p).fill(u,c):s(p).fill(u):s(p)}l.alloc=function(p,u,c){return x(p,u,c)};function M(p){return E(p),s(p<0?0:P(p)|0)}l.allocUnsafe=function(p){return M(p)},l.allocUnsafeSlow=function(p){return M(p)};function z(p,u){if((typeof u!="string"||u==="")&&(u="utf8"),!l.isEncoding(u))throw new TypeError("Unknown encoding: "+u);const c=Z(p,u)|0;let g=s(c);const I=g.write(p,u);return I!==c&&(g=g.slice(0,I)),g}function O(p){const u=p.length<0?0:P(p.length)|0,c=s(u);for(let g=0;g<u;g+=1)c[g]=p[g]&255;return c}function $(p){if(Bt(p,Uint8Array)){const u=new Uint8Array(p);return N(u.buffer,u.byteOffset,u.byteLength)}return O(p)}function N(p,u,c){if(u<0||p.byteLength<u)throw new RangeError('"offset" is outside of buffer bounds');if(p.byteLength<u+(c||0))throw new RangeError('"length" is outside of buffer bounds');let g;return u===void 0&&c===void 0?g=new Uint8Array(p):c===void 0?g=new Uint8Array(p,u):g=new Uint8Array(p,u,c),Object.setPrototypeOf(g,l.prototype),g}function D(p){if(l.isBuffer(p)){const u=P(p.length)|0,c=s(u);return c.length===0||p.copy(c,0,0,u),c}if(p.length!==void 0)return typeof p.length!="number"||Ae(p.length)?s(0):O(p);if(p.type==="Buffer"&&Array.isArray(p.data))return O(p.data)}function P(p){if(p>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return p|0}function F(p){return+p!=p&&(p=0),l.alloc(+p)}l.isBuffer=function(u){return u!=null&&u._isBuffer===!0&&u!==l.prototype},l.compare=function(u,c){if(Bt(u,Uint8Array)&&(u=l.from(u,u.offset,u.byteLength)),Bt(c,Uint8Array)&&(c=l.from(c,c.offset,c.byteLength)),!l.isBuffer(u)||!l.isBuffer(c))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(u===c)return 0;let g=u.length,I=c.length;for(let k=0,T=Math.min(g,I);k<T;++k)if(u[k]!==c[k]){g=u[k],I=c[k];break}return g<I?-1:I<g?1:0},l.isEncoding=function(u){switch(String(u).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(u,c){if(!Array.isArray(u))throw new TypeError('"list" argument must be an Array of Buffers');if(u.length===0)return l.alloc(0);let g;if(c===void 0)for(c=0,g=0;g<u.length;++g)c+=u[g].length;const I=l.allocUnsafe(c);let k=0;for(g=0;g<u.length;++g){let T=u[g];if(Bt(T,Uint8Array))k+T.length>I.length?(l.isBuffer(T)||(T=l.from(T)),T.copy(I,k)):Uint8Array.prototype.set.call(I,T,k);else if(l.isBuffer(T))T.copy(I,k);else throw new TypeError('"list" argument must be an Array of Buffers');k+=T.length}return I};function Z(p,u){if(l.isBuffer(p))return p.length;if(ArrayBuffer.isView(p)||Bt(p,ArrayBuffer))return p.byteLength;if(typeof p!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof p);const c=p.length,g=arguments.length>2&&arguments[2]===!0;if(!g&&c===0)return 0;let I=!1;for(;;)switch(u){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":return ke(p).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c*2;case"hex":return c>>>1;case"base64":return Oe(p).length;default:if(I)return g?-1:ke(p).length;u=(""+u).toLowerCase(),I=!0}}l.byteLength=Z;function W(p,u,c){let g=!1;if((u===void 0||u<0)&&(u=0),u>this.length||((c===void 0||c>this.length)&&(c=this.length),c<=0)||(c>>>=0,u>>>=0,c<=u))return"";for(p||(p="utf8");;)switch(p){case"hex":return S(this,u,c);case"utf8":case"utf-8":return a(this,u,c);case"ascii":return w(this,u,c);case"latin1":case"binary":return _(this,u,c);case"base64":return b(this,u,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return A(this,u,c);default:if(g)throw new TypeError("Unknown encoding: "+p);p=(p+"").toLowerCase(),g=!0}}l.prototype._isBuffer=!0;function te(p,u,c){const g=p[u];p[u]=p[c],p[c]=g}l.prototype.swap16=function(){const u=this.length;if(u%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let c=0;c<u;c+=2)te(this,c,c+1);return this},l.prototype.swap32=function(){const u=this.length;if(u%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let c=0;c<u;c+=4)te(this,c,c+3),te(this,c+1,c+2);return this},l.prototype.swap64=function(){const u=this.length;if(u%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let c=0;c<u;c+=8)te(this,c,c+7),te(this,c+1,c+6),te(this,c+2,c+5),te(this,c+3,c+4);return this},l.prototype.toString=function(){const u=this.length;return u===0?"":arguments.length===0?a(this,0,u):W.apply(this,arguments)},l.prototype.toLocaleString=l.prototype.toString,l.prototype.equals=function(u){if(!l.isBuffer(u))throw new TypeError("Argument must be a Buffer");return this===u?!0:l.compare(this,u)===0},l.prototype.inspect=function(){let u="";const c=t.INSPECT_MAX_BYTES;return u=this.toString("hex",0,c).replace(/(.{2})/g,"$1 ").trim(),this.length>c&&(u+=" ... "),"<Buffer "+u+">"},n&&(l.prototype[n]=l.prototype.inspect),l.prototype.compare=function(u,c,g,I,k){if(Bt(u,Uint8Array)&&(u=l.from(u,u.offset,u.byteLength)),!l.isBuffer(u))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof u);if(c===void 0&&(c=0),g===void 0&&(g=u?u.length:0),I===void 0&&(I=0),k===void 0&&(k=this.length),c<0||g>u.length||I<0||k>this.length)throw new RangeError("out of range index");if(I>=k&&c>=g)return 0;if(I>=k)return-1;if(c>=g)return 1;if(c>>>=0,g>>>=0,I>>>=0,k>>>=0,this===u)return 0;let T=k-I,fe=g-c;const ae=Math.min(T,fe),se=this.slice(I,k),Se=u.slice(c,g);for(let ie=0;ie<ae;++ie)if(se[ie]!==Se[ie]){T=se[ie],fe=Se[ie];break}return T<fe?-1:fe<T?1:0};function V(p,u,c,g,I){if(p.length===0)return-1;if(typeof c=="string"?(g=c,c=0):c>2147483647?c=2147483647:c<-2147483648&&(c=-2147483648),c=+c,Ae(c)&&(c=I?0:p.length-1),c<0&&(c=p.length+c),c>=p.length){if(I)return-1;c=p.length-1}else if(c<0)if(I)c=0;else return-1;if(typeof u=="string"&&(u=l.from(u,g)),l.isBuffer(u))return u.length===0?-1:Y(p,u,c,g,I);if(typeof u=="number")return u=u&255,typeof Uint8Array.prototype.indexOf=="function"?I?Uint8Array.prototype.indexOf.call(p,u,c):Uint8Array.prototype.lastIndexOf.call(p,u,c):Y(p,[u],c,g,I);throw new TypeError("val must be string, number or Buffer")}function Y(p,u,c,g,I){let k=1,T=p.length,fe=u.length;if(g!==void 0&&(g=String(g).toLowerCase(),g==="ucs2"||g==="ucs-2"||g==="utf16le"||g==="utf-16le")){if(p.length<2||u.length<2)return-1;k=2,T/=2,fe/=2,c/=2}function ae(Se,ie){return k===1?Se[ie]:Se.readUInt16BE(ie*k)}let se;if(I){let Se=-1;for(se=c;se<T;se++)if(ae(p,se)===ae(u,Se===-1?0:se-Se)){if(Se===-1&&(Se=se),se-Se+1===fe)return Se*k}else Se!==-1&&(se-=se-Se),Se=-1}else for(c+fe>T&&(c=T-fe),se=c;se>=0;se--){let Se=!0;for(let ie=0;ie<fe;ie++)if(ae(p,se+ie)!==ae(u,ie)){Se=!1;break}if(Se)return se}return-1}l.prototype.includes=function(u,c,g){return this.indexOf(u,c,g)!==-1},l.prototype.indexOf=function(u,c,g){return V(this,u,c,g,!0)},l.prototype.lastIndexOf=function(u,c,g){return V(this,u,c,g,!1)};function he(p,u,c,g){c=Number(c)||0;const I=p.length-c;g?(g=Number(g),g>I&&(g=I)):g=I;const k=u.length;g>k/2&&(g=k/2);let T;for(T=0;T<g;++T){const fe=parseInt(u.substr(T*2,2),16);if(Ae(fe))return T;p[c+T]=fe}return T}function q(p,u,c,g){return xe(ke(u,p.length-c),p,c,g)}function X(p,u,c,g){return xe(Ue(u),p,c,g)}function G(p,u,c,g){return xe(Oe(u),p,c,g)}function pe(p,u,c,g){return xe(vn(u,p.length-c),p,c,g)}l.prototype.write=function(u,c,g,I){if(c===void 0)I="utf8",g=this.length,c=0;else if(g===void 0&&typeof c=="string")I=c,g=this.length,c=0;else if(isFinite(c))c=c>>>0,isFinite(g)?(g=g>>>0,I===void 0&&(I="utf8")):(I=g,g=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const k=this.length-c;if((g===void 0||g>k)&&(g=k),u.length>0&&(g<0||c<0)||c>this.length)throw new RangeError("Attempt to write outside buffer bounds");I||(I="utf8");let T=!1;for(;;)switch(I){case"hex":return he(this,u,c,g);case"utf8":case"utf-8":return q(this,u,c,g);case"ascii":case"latin1":case"binary":return X(this,u,c,g);case"base64":return G(this,u,c,g);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pe(this,u,c,g);default:if(T)throw new TypeError("Unknown encoding: "+I);I=(""+I).toLowerCase(),T=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function b(p,u,c){return u===0&&c===p.length?e.fromByteArray(p):e.fromByteArray(p.slice(u,c))}function a(p,u,c){c=Math.min(p.length,c);const g=[];let I=u;for(;I<c;){const k=p[I];let T=null,fe=k>239?4:k>223?3:k>191?2:1;if(I+fe<=c){let ae,se,Se,ie;switch(fe){case 1:k<128&&(T=k);break;case 2:ae=p[I+1],(ae&192)===128&&(ie=(k&31)<<6|ae&63,ie>127&&(T=ie));break;case 3:ae=p[I+1],se=p[I+2],(ae&192)===128&&(se&192)===128&&(ie=(k&15)<<12|(ae&63)<<6|se&63,ie>2047&&(ie<55296||ie>57343)&&(T=ie));break;case 4:ae=p[I+1],se=p[I+2],Se=p[I+3],(ae&192)===128&&(se&192)===128&&(Se&192)===128&&(ie=(k&15)<<18|(ae&63)<<12|(se&63)<<6|Se&63,ie>65535&&ie<1114112&&(T=ie))}}T===null?(T=65533,fe=1):T>65535&&(T-=65536,g.push(T>>>10&1023|55296),T=56320|T&1023),g.push(T),I+=fe}return m(g)}const h=4096;function m(p){const u=p.length;if(u<=h)return String.fromCharCode.apply(String,p);let c="",g=0;for(;g<u;)c+=String.fromCharCode.apply(String,p.slice(g,g+=h));return c}function w(p,u,c){let g="";c=Math.min(p.length,c);for(let I=u;I<c;++I)g+=String.fromCharCode(p[I]&127);return g}function _(p,u,c){let g="";c=Math.min(p.length,c);for(let I=u;I<c;++I)g+=String.fromCharCode(p[I]);return g}function S(p,u,c){const g=p.length;(!u||u<0)&&(u=0),(!c||c<0||c>g)&&(c=g);let I="";for(let k=u;k<c;++k)I+=$e[p[k]];return I}function A(p,u,c){const g=p.slice(u,c);let I="";for(let k=0;k<g.length-1;k+=2)I+=String.fromCharCode(g[k]+g[k+1]*256);return I}l.prototype.slice=function(u,c){const g=this.length;u=~~u,c=c===void 0?g:~~c,u<0?(u+=g,u<0&&(u=0)):u>g&&(u=g),c<0?(c+=g,c<0&&(c=0)):c>g&&(c=g),c<u&&(c=u);const I=this.subarray(u,c);return Object.setPrototypeOf(I,l.prototype),I};function y(p,u,c){if(p%1!==0||p<0)throw new RangeError("offset is not uint");if(p+u>c)throw new RangeError("Trying to access beyond buffer length")}l.prototype.readUintLE=l.prototype.readUIntLE=function(u,c,g){u=u>>>0,c=c>>>0,g||y(u,c,this.length);let I=this[u],k=1,T=0;for(;++T<c&&(k*=256);)I+=this[u+T]*k;return I},l.prototype.readUintBE=l.prototype.readUIntBE=function(u,c,g){u=u>>>0,c=c>>>0,g||y(u,c,this.length);let I=this[u+--c],k=1;for(;c>0&&(k*=256);)I+=this[u+--c]*k;return I},l.prototype.readUint8=l.prototype.readUInt8=function(u,c){return u=u>>>0,c||y(u,1,this.length),this[u]},l.prototype.readUint16LE=l.prototype.readUInt16LE=function(u,c){return u=u>>>0,c||y(u,2,this.length),this[u]|this[u+1]<<8},l.prototype.readUint16BE=l.prototype.readUInt16BE=function(u,c){return u=u>>>0,c||y(u,2,this.length),this[u]<<8|this[u+1]},l.prototype.readUint32LE=l.prototype.readUInt32LE=function(u,c){return u=u>>>0,c||y(u,4,this.length),(this[u]|this[u+1]<<8|this[u+2]<<16)+this[u+3]*16777216},l.prototype.readUint32BE=l.prototype.readUInt32BE=function(u,c){return u=u>>>0,c||y(u,4,this.length),this[u]*16777216+(this[u+1]<<16|this[u+2]<<8|this[u+3])},l.prototype.readBigUInt64LE=Lt(function(u){u=u>>>0,Xt(u,"offset");const c=this[u],g=this[u+7];(c===void 0||g===void 0)&&_e(u,this.length-8);const I=c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24,k=this[++u]+this[++u]*2**8+this[++u]*2**16+g*2**24;return BigInt(I)+(BigInt(k)<<BigInt(32))}),l.prototype.readBigUInt64BE=Lt(function(u){u=u>>>0,Xt(u,"offset");const c=this[u],g=this[u+7];(c===void 0||g===void 0)&&_e(u,this.length-8);const I=c*2**24+this[++u]*2**16+this[++u]*2**8+this[++u],k=this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+g;return(BigInt(I)<<BigInt(32))+BigInt(k)}),l.prototype.readIntLE=function(u,c,g){u=u>>>0,c=c>>>0,g||y(u,c,this.length);let I=this[u],k=1,T=0;for(;++T<c&&(k*=256);)I+=this[u+T]*k;return k*=128,I>=k&&(I-=Math.pow(2,8*c)),I},l.prototype.readIntBE=function(u,c,g){u=u>>>0,c=c>>>0,g||y(u,c,this.length);let I=c,k=1,T=this[u+--I];for(;I>0&&(k*=256);)T+=this[u+--I]*k;return k*=128,T>=k&&(T-=Math.pow(2,8*c)),T},l.prototype.readInt8=function(u,c){return u=u>>>0,c||y(u,1,this.length),this[u]&128?(255-this[u]+1)*-1:this[u]},l.prototype.readInt16LE=function(u,c){u=u>>>0,c||y(u,2,this.length);const g=this[u]|this[u+1]<<8;return g&32768?g|4294901760:g},l.prototype.readInt16BE=function(u,c){u=u>>>0,c||y(u,2,this.length);const g=this[u+1]|this[u]<<8;return g&32768?g|4294901760:g},l.prototype.readInt32LE=function(u,c){return u=u>>>0,c||y(u,4,this.length),this[u]|this[u+1]<<8|this[u+2]<<16|this[u+3]<<24},l.prototype.readInt32BE=function(u,c){return u=u>>>0,c||y(u,4,this.length),this[u]<<24|this[u+1]<<16|this[u+2]<<8|this[u+3]},l.prototype.readBigInt64LE=Lt(function(u){u=u>>>0,Xt(u,"offset");const c=this[u],g=this[u+7];(c===void 0||g===void 0)&&_e(u,this.length-8);const I=this[u+4]+this[u+5]*2**8+this[u+6]*2**16+(g<<24);return(BigInt(I)<<BigInt(32))+BigInt(c+this[++u]*2**8+this[++u]*2**16+this[++u]*2**24)}),l.prototype.readBigInt64BE=Lt(function(u){u=u>>>0,Xt(u,"offset");const c=this[u],g=this[u+7];(c===void 0||g===void 0)&&_e(u,this.length-8);const I=(c<<24)+this[++u]*2**16+this[++u]*2**8+this[++u];return(BigInt(I)<<BigInt(32))+BigInt(this[++u]*2**24+this[++u]*2**16+this[++u]*2**8+g)}),l.prototype.readFloatLE=function(u,c){return u=u>>>0,c||y(u,4,this.length),r.read(this,u,!0,23,4)},l.prototype.readFloatBE=function(u,c){return u=u>>>0,c||y(u,4,this.length),r.read(this,u,!1,23,4)},l.prototype.readDoubleLE=function(u,c){return u=u>>>0,c||y(u,8,this.length),r.read(this,u,!0,52,8)},l.prototype.readDoubleBE=function(u,c){return u=u>>>0,c||y(u,8,this.length),r.read(this,u,!1,52,8)};function f(p,u,c,g,I,k){if(!l.isBuffer(p))throw new TypeError('"buffer" argument must be a Buffer instance');if(u>I||u<k)throw new RangeError('"value" argument is out of bounds');if(c+g>p.length)throw new RangeError("Index out of range")}l.prototype.writeUintLE=l.prototype.writeUIntLE=function(u,c,g,I){if(u=+u,c=c>>>0,g=g>>>0,!I){const fe=Math.pow(2,8*g)-1;f(this,u,c,g,fe,0)}let k=1,T=0;for(this[c]=u&255;++T<g&&(k*=256);)this[c+T]=u/k&255;return c+g},l.prototype.writeUintBE=l.prototype.writeUIntBE=function(u,c,g,I){if(u=+u,c=c>>>0,g=g>>>0,!I){const fe=Math.pow(2,8*g)-1;f(this,u,c,g,fe,0)}let k=g-1,T=1;for(this[c+k]=u&255;--k>=0&&(T*=256);)this[c+k]=u/T&255;return c+g},l.prototype.writeUint8=l.prototype.writeUInt8=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,1,255,0),this[c]=u&255,c+1},l.prototype.writeUint16LE=l.prototype.writeUInt16LE=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,2,65535,0),this[c]=u&255,this[c+1]=u>>>8,c+2},l.prototype.writeUint16BE=l.prototype.writeUInt16BE=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,2,65535,0),this[c]=u>>>8,this[c+1]=u&255,c+2},l.prototype.writeUint32LE=l.prototype.writeUInt32LE=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,4,4294967295,0),this[c+3]=u>>>24,this[c+2]=u>>>16,this[c+1]=u>>>8,this[c]=u&255,c+4},l.prototype.writeUint32BE=l.prototype.writeUInt32BE=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,4,4294967295,0),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4};function v(p,u,c,g,I){Be(u,g,I,p,c,7);let k=Number(u&BigInt(4294967295));p[c++]=k,k=k>>8,p[c++]=k,k=k>>8,p[c++]=k,k=k>>8,p[c++]=k;let T=Number(u>>BigInt(32)&BigInt(4294967295));return p[c++]=T,T=T>>8,p[c++]=T,T=T>>8,p[c++]=T,T=T>>8,p[c++]=T,c}function ne(p,u,c,g,I){Be(u,g,I,p,c,7);let k=Number(u&BigInt(4294967295));p[c+7]=k,k=k>>8,p[c+6]=k,k=k>>8,p[c+5]=k,k=k>>8,p[c+4]=k;let T=Number(u>>BigInt(32)&BigInt(4294967295));return p[c+3]=T,T=T>>8,p[c+2]=T,T=T>>8,p[c+1]=T,T=T>>8,p[c]=T,c+8}l.prototype.writeBigUInt64LE=Lt(function(u,c=0){return v(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeBigUInt64BE=Lt(function(u,c=0){return ne(this,u,c,BigInt(0),BigInt("0xffffffffffffffff"))}),l.prototype.writeIntLE=function(u,c,g,I){if(u=+u,c=c>>>0,!I){const ae=Math.pow(2,8*g-1);f(this,u,c,g,ae-1,-ae)}let k=0,T=1,fe=0;for(this[c]=u&255;++k<g&&(T*=256);)u<0&&fe===0&&this[c+k-1]!==0&&(fe=1),this[c+k]=(u/T>>0)-fe&255;return c+g},l.prototype.writeIntBE=function(u,c,g,I){if(u=+u,c=c>>>0,!I){const ae=Math.pow(2,8*g-1);f(this,u,c,g,ae-1,-ae)}let k=g-1,T=1,fe=0;for(this[c+k]=u&255;--k>=0&&(T*=256);)u<0&&fe===0&&this[c+k+1]!==0&&(fe=1),this[c+k]=(u/T>>0)-fe&255;return c+g},l.prototype.writeInt8=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,1,127,-128),u<0&&(u=255+u+1),this[c]=u&255,c+1},l.prototype.writeInt16LE=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,2,32767,-32768),this[c]=u&255,this[c+1]=u>>>8,c+2},l.prototype.writeInt16BE=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,2,32767,-32768),this[c]=u>>>8,this[c+1]=u&255,c+2},l.prototype.writeInt32LE=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,4,2147483647,-2147483648),this[c]=u&255,this[c+1]=u>>>8,this[c+2]=u>>>16,this[c+3]=u>>>24,c+4},l.prototype.writeInt32BE=function(u,c,g){return u=+u,c=c>>>0,g||f(this,u,c,4,2147483647,-2147483648),u<0&&(u=4294967295+u+1),this[c]=u>>>24,this[c+1]=u>>>16,this[c+2]=u>>>8,this[c+3]=u&255,c+4},l.prototype.writeBigInt64LE=Lt(function(u,c=0){return v(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),l.prototype.writeBigInt64BE=Lt(function(u,c=0){return ne(this,u,c,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function re(p,u,c,g,I,k){if(c+g>p.length)throw new RangeError("Index out of range");if(c<0)throw new RangeError("Index out of range")}function oe(p,u,c,g,I){return u=+u,c=c>>>0,I||re(p,u,c,4),r.write(p,u,c,g,23,4),c+4}l.prototype.writeFloatLE=function(u,c,g){return oe(this,u,c,!0,g)},l.prototype.writeFloatBE=function(u,c,g){return oe(this,u,c,!1,g)};function ot(p,u,c,g,I){return u=+u,c=c>>>0,I||re(p,u,c,8),r.write(p,u,c,g,52,8),c+8}l.prototype.writeDoubleLE=function(u,c,g){return ot(this,u,c,!0,g)},l.prototype.writeDoubleBE=function(u,c,g){return ot(this,u,c,!1,g)},l.prototype.copy=function(u,c,g,I){if(!l.isBuffer(u))throw new TypeError("argument should be a Buffer");if(g||(g=0),!I&&I!==0&&(I=this.length),c>=u.length&&(c=u.length),c||(c=0),I>0&&I<g&&(I=g),I===g||u.length===0||this.length===0)return 0;if(c<0)throw new RangeError("targetStart out of bounds");if(g<0||g>=this.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("sourceEnd out of bounds");I>this.length&&(I=this.length),u.length-c<I-g&&(I=u.length-c+g);const k=I-g;return this===u&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(c,g,I):Uint8Array.prototype.set.call(u,this.subarray(g,I),c),k}
vendor: 3,506 bytes, line 69
69,l.prototype.fill=function(u,c,g,I){if(typeof u=="string"){if(typeof c=="string"?(I=c,c=0,g=this.length):typeof g=="string"&&(I=g,g=this.length),I!==void 0&&typeof I!="string")throw new TypeError("encoding must be a string");if(typeof I=="string"&&!l.isEncoding(I))throw new TypeError("Unknown encoding: "+I);if(u.length===1){const T=u.charCodeAt(0);(I==="utf8"&&T<128||I==="latin1")&&(u=T)}}else typeof u=="number"?u=u&255:typeof u=="boolean"&&(u=Number(u));if(c<0||this.length<c||this.length<g)throw new RangeError("Out of range index");if(g<=c)return this;c=c>>>0,g=g===void 0?this.length:g>>>0,u||(u=0);let k;if(typeof u=="number")for(k=c;k<g;++k)this[k]=u;else{const T=l.isBuffer(u)?u:l.from(u,I),fe=T.length;if(fe===0)throw new TypeError('The value "'+u+'" is invalid for argument "value"');for(k=0;k<g-c;++k)this[k+c]=T[k%fe]}return this};const me={};function be(p,u,c){me[p]=class extends c{constructor(){super(),Object.defineProperty(this,"message",{value:u.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${p}]`,this.stack,delete this.name}get code(){return p}set code(I){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:I,writable:!0})}toString(){return`${this.name} [${p}]: ${this.message}`}}}be("ERR_BUFFER_OUT_OF_BOUNDS",function(p){return p?`${p} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),be("ERR_INVALID_ARG_TYPE",function(p,u){return`The "${p}" argument must be of type number. Received type ${typeof u}`},TypeError),be("ERR_OUT_OF_RANGE",function(p,u,c){let g=`The value of "${p}" is out of range.`,I=c;return Number.isInteger(c)&&Math.abs(c)>2**32?I=Wr(String(c)):typeof c=="bigint"&&(I=String(c),(c>BigInt(2)**BigInt(32)||c<-(BigInt(2)**BigInt(32)))&&(I=Wr(I)),I+="n"),g+=` It must be ${u}. Received ${I}`,g},RangeError);function Wr(p){let u="",c=p.length;const g=p[0]==="-"?1:0;for(;c>=g+4;c-=3)u=`_${p.slice(c-3,c)}${u}`;return`${p.slice(0,c)}${u}`}function Te(p,u,c){Xt(u,"offset"),(p[u]===void 0||p[u+c]===void 0)&&_e(u,p.length-(c+1))}function Be(p,u,c,g,I,k){if(p>c||p<u){const T=typeof u=="bigint"?"n":"";let fe;throw u===0||u===BigInt(0)?fe=`>= 0${T} and < 2${T} ** ${(k+1)*8}${T}`:fe=`>= -(2${T} ** ${(k+1)*8-1}${T}) and < 2 ** ${(k+1)*8-1}${T}`,new me.ERR_OUT_OF_RANGE("value",fe,p)}Te(g,I,k)}function Xt(p,u){if(typeof p!="number")throw new me.ERR_INVALID_ARG_TYPE(u,"number",p)}function _e(p,u,c){throw Math.floor(p)!==p?(Xt(p,c),new me.ERR_OUT_OF_RANGE("offset","an integer",p)):u<0?new me.ERR_BUFFER_OUT_OF_BOUNDS:new me.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${u}`,p)}const Pe=/[^+/0-9A-Za-z-_]/g;function wn(p){if(p=p.split("=")[0],p=p.trim().replace(Pe,""),p.length<2)return"";for(;p.length%4!==0;)p=p+"=";return p}function ke(p,u){u=u||1/0;let c;const g=p.length;let I=null;const k=[];for(let T=0;T<g;++T){if(c=p.charCodeAt(T),c>55295&&c<57344){if(!I){if(c>56319){(u-=3)>-1&&k.push(239,191,189);continue}else if(T+1===g){(u-=3)>-1&&k.push(239,191,189);continue}I=c;continue}if(c<56320){(u-=3)>-1&&k.push(239,191,189),I=c;continue}c=(I-55296<<10|c-56320)+65536}else I&&(u-=3)>-1&&k.push(239,191,189);if(I=null,c<128){if((u-=1)<0)break;k.push(c)}else if(c<2048){if((u-=2)<0)break;k.push(c>>6|192,c&63|128)}else if(c<65536){if((u-=3)<0)break;k.push(c>>12|224,c>>6&63|128,c&63|128)}else if(c<1114112){if((u-=4)<0)break;k.push(c>>18|240,c>>12&63|128,c>>6&63|128,c&63|128)}else throw new Error("Invalid code point")}return k}function Ue(p){const u=[];for(let c=0;c<p.length;
69++c)u.push(p.charCodeAt(c)&255);return u}function vn(p,u){let c,g,I;const k=[];for(let T=0;T<p.length&&!((u-=2)<0);++T)c=p.charCodeAt(T),g=c>>8,I=c%256,k.push(I),k.push(g);return k}function Oe(p){return e.toByteArray(wn(p))}function xe(p,u,c,g){let I;for(I=0;I<g&&!(I+c>=u.length||I>=p.length);++I)u[I+c]=p[I];return I}function Bt(p,u){return p instanceof u||p!=null&&p.constructor!=null&&p.constructor.name!=null&&p.constructor.name===u.name}function Ae(p){return p!==p}const $e=function(){const p="0123456789abcdef",u=new Array(256);for(let c=0;c<16;++c){const g=c*16;for(let I=0;I<16;++I)u[g+I]=p[c]+p[I]}return u}();function Lt(p){return typeof BigInt>"u"?Ce:p}function Ce(){throw new Error("BigInt not supported")}})(le);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ir=BigInt(0),at=BigInt(1),Fi=BigInt(2),L0=BigInt(8);function D0(t,e,r,n){const i=t.sqr(r),o=t.sqr(n),s=t.add(t.mul(e.a,i),o),l=t.add(t.ONE,t.mul(e.d,t.mul(i,o)));return t.eql(s,l)}function Z0(t,e={}){const r=sc("edwards",t,e,e.FpFnLE),{Fp:n,Fn:i}=r;let o=r.CURVE;const{h:s}=o;Ys(e,{},{uvRatio:"function"});const l=Fi<<BigInt(i.BYTES*8)-at,d=D=>n.create(D),E=e.uvRatio||((D,P)=>{try{return{isValid:!0,value:n.sqrt(n.div(D,P))}}catch{return{isValid:!1,value:ir}}});if(!D0(n,o,o.Gx,o.Gy))throw new Error("bad curve params: generator point");function x(D,P,F=!1){const Z=F?at:ir;return is("coordinate "+D,P,Z,l),P}function M(D){if(!(D instanceof $))throw new Error("ExtendedPoint expected")}const z=os((D,P)=>{const{X:F,Y:Z,Z:W}=D,te=D.is0();P==null&&(P=te?L0:n.inv(W));const V=d(F*P),Y=d(Z*P),he=n.mul(W,P);if(te)return{x:ir,y:at};if(he!==at)throw new Error("invZ was invalid");return{x:V,y:Y}}),O=os(D=>{const{a:P,d:F}=o;if(D.is0())throw new Error("bad point: ZERO");const{X:Z,Y:W,Z:te,T:V}=D,Y=d(Z*Z),he=d(W*W),q=d(te*te),X=d(q*q),G=d(Y*P),pe=d(q*d(G+he)),b=d(X+d(F*d(Y*he)));if(pe!==b)throw new Error("bad point: equation left != right (1)");const a=d(Z*W),h=d(te*V);if(a!==h)throw new Error("bad point: equation left != right (2)");return!0});class ${constructor(P,F,Z,W){this.X=x("x",P),this.Y=x("y",F),this.Z=x("z",Z,!0),this.T=x("t",W),Object.freeze(this)}static CURVE(){return o}static fromAffine(P){if(P instanceof $)throw new Error("extended point not allowed");const{x:F,y:Z}=P||{};return x("x",F),x("y",Z),new $(F,Z,at,d(F*Z))}static fromBytes(P,F=!1){const Z=n.BYTES,{a:W,d:te}=o;P=ns(An(P,Z,"point")),Ji(F,"zip215");const V=ns(P),Y=P[Z-1];V[Z-1]=Y&-129;const he=Gi(V),q=F?l:n.ORDER;is("point.y",he,ir,q);const X=d(he*he),G=d(X-at),pe=d(te*X-W);let{isValid:b,value:a}=E(G,pe);if(!b)throw new Error("bad point: invalid y coordinate");const h=(a&at)===at,m=(Y&128)!==0;if(!F&&a===ir&&m)throw new Error("bad point: x=0 and x_0=1");return m!==h&&(a=d(-a)),$.fromAffine({x:a,y:he})}static fromHex(P,F=!1){return $.fromBytes(or("point",P),F)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(P=8,F=!0){return N.createCache(this,P),F||this.multiply(Fi),this}assertValidity(){O(this)}equals(P){M(P);const{X:F,Y:Z,Z:W}=this,{X:te,Y:V,Z:Y}=P,he=d(F*Y),q=d(te*W),X=d(Z*Y),G=d(V*W);return he===q&&X===G}is0(){return this.equals($.ZERO)}negate(){return new $(d(-this.X),this.Y,this.Z,d(-this.T))}double(){const{a:P}=o,{X:F,Y:Z,Z:W}=this,te=d(F*F),V=d(Z*Z),Y=d(Fi*d(W*W)),he=d(P*te),q=F+Z,X=d(d(q*q)-te-V),G=he+V,pe=G-Y,b=he-V,a=d(X*pe),h=d(G*b),m=d(X*b),w=d(pe*G);return new $(a,h,w,m)}add(P){M(P);const{a:F,d:Z}=o,{X:W,Y:te,Z:V,T:Y}=this,{X:he,Y:q,Z:X,T:G}=P,pe=d(W*he),b=d(te*q),a=d(Y*Z*G),h=d(V*X),m=d((W+te)*(he+q)-pe-b),w=h-a,_=h+a,S=d(b-F*pe),A=d(m*w),y=d(_*S),f=d(m*S),v=d(w*_);return new $(A,y,v,f)}subtract(P){return this.add(P.negate())}multiply(P){if(!i.isValidNot0(P))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:F,f:Z}=N.cached(this,P,W=>bn($,W));return bn($,[F,Z])[0]}multiplyUnsafe(P,F=$.ZERO){if(!i.isValid(P))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return P===ir?$.ZERO:this.is0()||P===at?this:N.unsafe(this,P,Z=>bn($,Z),F)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}isTorsionFree(){return N.unsafe(this,o.n).is0()}toAffine(P){return z(this,P)}clearCofactor(){return s===at?this:this.multiplyUnsafe(s)}toBytes(){const{x:P,y:F}=this.toAffine(),Z=n.toBytes(F);return Z[Z.length-1]|=P&at?128:0,Z}toHex(){return Xu(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(P){return bn($,P)}static msm(P,F){return uc($,i,P,F)}
69_setWindowSize(P){this.precompute(P)}toRawBytes(){return this.toBytes()}}$.BASE=new $(o.Gx,o.Gy,at,d(o.Gx*o.Gy)),$.ZERO=new $(ir,at,at,ir),$.Fp=n,$.Fn=i;const N=new ac($,i.BITS);return $.BASE.precompute(8),$}function j0(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');Ys(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:n}=r,{BASE:i,Fp:o,Fn:s}=t,l=r.randomBytes||Hu,d=r.adjustScalarBytes||(q=>q),E=r.domain||((q,X,G)=>{if(Ji(G,"phflag"),X.length||G)throw new Error("Contexts/pre-hash are not supported");return q});function x(q){return s.create(Gi(q))}function M(q){const X=Z.secretKey;q=or("private key",q,X);const G=or("hashed private key",e(q),2*X),pe=d(G.slice(0,X)),b=G.slice(X,2*X),a=x(pe);return{head:pe,prefix:b,scalar:a}}function z(q){const{head:X,prefix:G,scalar:pe}=M(q),b=i.multiply(pe),a=b.toBytes();return{head:X,prefix:G,scalar:pe,point:b,pointBytes:a}}function O(q){return z(q).pointBytes}function $(q=Uint8Array.of(),...X){const G=ts(...X);return x(e(E(G,or("context",q),!!n)))}function N(q,X,G={}){q=or("message",q),n&&(q=n(q));const{prefix:pe,scalar:b,pointBytes:a}=z(X),h=$(G.context,pe,q),m=i.multiply(h).toBytes(),w=$(G.context,m,a,q),_=s.create(h+w*b);if(!s.isValid(_))throw new Error("sign failed: invalid s");const S=ts(m,s.toBytes(_));return An(S,Z.signature,"result")}const D={zip215:!0};function P(q,X,G,pe=D){const{context:b,zip215:a}=pe,h=Z.signature;q=or("signature",q,h),X=or("message",X),G=or("publicKey",G,Z.publicKey),a!==void 0&&Ji(a,"zip215"),n&&(X=n(X));const m=h/2,w=q.subarray(0,m),_=Gi(q.subarray(m,h));let S,A,y;try{S=t.fromBytes(G,a),A=t.fromBytes(w,a),y=i.multiplyUnsafe(_)}catch{return!1}if(!a&&S.isSmallOrder())return!1;const f=$(b,A.toBytes(),S.toBytes(),X);return A.add(S.multiplyUnsafe(f)).subtract(y).clearCofactor().is0()}const F=o.BYTES,Z={secretKey:F,publicKey:F,signature:2*F,seed:F};function W(q=l(Z.seed)){return An(q,Z.seed,"seed")}function te(q){const X=he.randomSecretKey(q);return{secretKey:X,publicKey:O(X)}}function V(q){return Qu(q)&&q.length===s.BYTES}function Y(q,X){try{return!!t.fromBytes(q,X)}catch{return!1}}const he={getExtendedPublicKey:z,randomSecretKey:W,isValidSecretKey:V,isValidPublicKey:Y,toMontgomery(q){const{y:X}=t.fromBytes(q),G=Z.publicKey,pe=G===32;if(!pe&&G!==57)throw new Error("only defined for 25519 and 448");const b=pe?o.div(at+X,at-X):o.div(X-at,X+at);return o.toBytes(b)},toMontgomerySecret(q){const X=Z.secretKey;An(q,X);const G=e(q.subarray(0,X));return d(G).subarray(0,X)},randomPrivateKey:W,precompute(q=8,X=t.BASE){return X.precompute(q,!1)}};return Object.freeze({keygen:te,getPublicKey:O,sign:N,verify:P,utils:he,Point:t,lengths:Z})}function K0(t){const e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=Gs(e.n,t.nBitLength,!0),i={Fp:r,Fn:n,uvRatio:t.uvRatio},o={randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:i,hash:t.hash,eddsaOpts:o}}function V0(t,e){const r=e.Point;return Object.assign({},e,{ExtendedPoint:r,CURVE:t,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}function q0(t){const{CURVE:e,curveOpts:r,hash:n,eddsaOpts:i}=K0(t),o=Z0(e,r),s=j0(o,n,i);return V0(t,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const W0=BigInt(1),Rs=BigInt(2);BigInt(3);const J0=BigInt(5),G0=BigInt(8),xo=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),$a={p:xo,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:G0,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Y0(t){const e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=xo,l=t*t%o*t%o,d=qt(l,Rs,o)*l%o,E=qt(d,W0,o)*t%o,x=qt(E,J0,o)*E%o,M=qt(x,e,o)*x%o,z=qt(
vendor: 16,827 bytes, line 69
69M,r,o)*M%o,O=qt(z,n,o)*z%o,$=qt(O,i,o)*O%o,N=qt($,i,o)*O%o,D=qt(N,e,o)*x%o;return{pow_p_5_8:qt(D,Rs,o)*t%o,b2:l}}function H0(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const zs=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function X0(t,e){const r=xo,n=nr(e*e*e,r),i=nr(n*n*e,r),o=Y0(t*i).pow_p_5_8;let s=nr(t*n*o,r);const l=nr(e*s*s,r),d=s,E=nr(s*zs,r),x=l===t,M=l===nr(-t,r),z=l===nr(-t*zs,r);return x&&(s=d),(M||z)&&(s=E),cc(s,r)&&(s=nr(-s,r)),{isValid:x||M,value:s}}const Q0=Gs($a.p,{isLE:!0}),ep={...$a,Fp:Q0,hash:ec,adjustScalarBytes:H0,uvRatio:X0},pn=q0(ep);var So={exports:{}};const tp={},rp=Object.freeze(Object.defineProperty({__proto__:null,default:tp},Symbol.toStringTag,{value:"Module"})),np=lo(rp);So.exports;(function(t){(function(e,r){function n(b,a){if(!b)throw new Error(a||"Assertion failed")}function i(b,a){b.super_=a;var h=function(){};h.prototype=a.prototype,b.prototype=new h,b.prototype.constructor=b}function o(b,a,h){if(o.isBN(b))return b;this.negative=0,this.words=null,this.length=0,this.red=null,b!==null&&((a==="le"||a==="be")&&(h=a,a=10),this._init(b||0,a||10,h||"be"))}typeof e=="object"?e.exports=o:r.BN=o,o.BN=o,o.wordSize=26;var s;try{typeof window<"u"&&typeof window.Buffer<"u"?s=window.Buffer:s=np.Buffer}catch{}o.isBN=function(a){return a instanceof o?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===o.wordSize&&Array.isArray(a.words)},o.max=function(a,h){return a.cmp(h)>0?a:h},o.min=function(a,h){return a.cmp(h)<0?a:h},o.prototype._init=function(a,h,m){if(typeof a=="number")return this._initNumber(a,h,m);if(typeof a=="object")return this._initArray(a,h,m);h==="hex"&&(h=16),n(h===(h|0)&&h>=2&&h<=36),a=a.toString().replace(/\s+/g,"");var w=0;a[0]==="-"&&(w++,this.negative=1),w<a.length&&(h===16?this._parseHex(a,w,m):(this._parseBase(a,h,w),m==="le"&&this._initArray(this.toArray(),h,m)))},o.prototype._initNumber=function(a,h,m){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(n(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),m==="le"&&this._initArray(this.toArray(),h,m)},o.prototype._initArray=function(a,h,m){if(n(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var _,S,A=0;if(m==="be")for(w=a.length-1,_=0;w>=0;w-=3)S=a[w]|a[w-1]<<8|a[w-2]<<16,this.words[_]|=S<<A&67108863,this.words[_+1]=S>>>26-A&67108863,A+=24,A>=26&&(A-=26,_++);else if(m==="le")for(w=0,_=0;w<a.length;w+=3)S=a[w]|a[w+1]<<8|a[w+2]<<16,this.words[_]|=S<<A&67108863,this.words[_+1]=S>>>26-A&67108863,A+=24,A>=26&&(A-=26,_++);return this._strip()};function l(b,a){var h=b.charCodeAt(a);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;n(!1,"Invalid character in "+b)}function d(b,a,h){var m=l(b,h);return h-1>=a&&(m|=l(b,h-1)<<4),m}o.prototype._parseHex=function(a,h,m){this.length=Math.ceil((a.length-h)/6),this.words=new Array(this.length);for(var w=0;w<this.length;w++)this.words[w]=0;var _=0,S=0,A;if(m==="be")for(w=a.length-1;w>=h;w-=2)A=d(a,h,w)<<_,this.words[S]|=A&67108863,_>=18?(_-=18,S+=1,this.words[S]|=A>>>26):_+=8;else{var y=a.length-h;for(w=y%2===0?h+1:h;w<a.length;w+=2)A=d(a,h,w)<<_,this.words[S]|=A&67108863,_>=18?(_-=18,S+=1,this.words[S]|=A>>>26):_+=8}this._strip()};function E(b,a,h,m){for(var w=0,_=0,S=Math.min(b.length,h),A=a;A<S;A++){var y=b.charCodeAt(A)-48;w*=m,y>=49?_=y-49+10:y>=17?_=y-17+10:_=y,n(y>=0&&_<m,"Invalid character"),w+=_}return w}o.prototype._parseBase=function(a,h,m){this.words=[0],this.length=1;for(var w=0,_=1;_<=67108863;_*=h)w++;w--,_=_/h|0;for(var S=a.length-m,A=S%w,y=Math.min(S,S-A)+m,f=0,v=m;v<y;v+=w)f=E(a,v,v+w,h),this.imuln(_),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(A!==0){var ne=1;for(f=E(a,v,a.length,h),v=0;v<A;v++)ne*=h;this.imuln(ne),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this._strip()},o.prototype.copy=function(a){a.words=new Array(this.length);for(var h=0;h<this.length;h++)a.words[h]=this.words[h];a.length=this.length,a.negative=this.negative,a.red=this.red};function x(b,a){b.words=a.words,b.length=a.length,b.negative=a.negative,b.red=a.red}if(o.prototype._move=function(a){x(a,this)},o.prototype.clone=function(){var a=new o(null);return this.copy(a),a},o.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},o.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{o.prototype[Symbol.for("nodejs.util.inspect.custom")]=M}catch{o.prototype.inspect=M}else o.prototype.inspect=M;function M(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var z=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],O=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],$=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];o.prototype.toString=function(a,h){a=a||10,h=h|0||1;var m;if(a===16||a==="hex"){m="";for(var w=0,_=0,S=0;S<this.length;S++){var A=this.words[S],y=((A<<w|_)&16777215).toString(16);_=A>>>24-w&16777215,w+=2,w>=26&&(w-=26,S--),_!==0||S!==this.length-1?m=z[6-y.length]+y+m:m=y+m}for(_!==0&&(m=_.toString(16)+m);m.length%h!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(a===(a|0)&&a>=2&&a<=36){var f=O[a],v=$[a];m="";var ne=this.clone();for(ne.negative=0;!ne.isZero();){var re=ne.modrn(v).toString(a);ne=ne.idivn(v),ne.isZero()?m=re+m:m=z[f-re.length]+re+m}for(this.isZero()&&(m="0"+m);m.length%h!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},o.prototype.toJSON=function(){return this.toString(16,2)},s&&(o.prototype.toBuffer=function(a,h){return this.toArrayLike(s,a,h)}),o.prototype.toArray=function(a,h){return this.toArrayLike(Array,a,h)};var N=function(a,h){return a.allocUnsafe?a.allocUnsafe(h):new a(h)};o.prototype.toArrayLike=function(a,h,m){this._strip();var w=this.byteLength(),_=m||Math.max(1,w);n(w<=_,"byte array longer than desired length"),n(_>0,"Requested array length <= 0");var S=N(a,_),A=h==="le"?"LE":"BE";return this["_toArrayLike"+A](S,w),S},o.prototype._toArrayLikeLE=function(a,h){for(var m=0,w=0,_=0,S=0;_<this.length;_++){var A=this.words[_]<<S|w;a[m++]=A&255,m<a.length&&(a[m++]=A>>8&255),m<a.length&&(a[m++]=A>>16&255),S===6?(m<a.length&&(a[m++]=A>>24&255),w=0,S=0):(w=A>>>24,S+=2)}if(m<a.length)for(a[m++]=w;m<a.length;)a[m++]=0},o.prototype._toArrayLikeBE=function(a,h){for(var m=a.length-1,w=0,_=0,S=0;_<this.length;_++){var A=this.words[_]<<S|w;a[m--]=A&255,m>=0&&(a[m--]=A>>8&255),m>=0&&(a[m--]=A>>16&255),S===6?(m>=0&&(a[m--]=A>>24&255),w=0,S=0):(w=A>>>24,S+=2)}if(m>=0)for(a[m--]=w;m>=0;)a[m--]=0},Math.clz32?o.prototype._countBits=function(a){return 32-Math.clz32(a)}:o.prototype._countBits=function(a){var h=a,m=0;return h>=4096&&(m+=13,h>>>=13),h>=64&&(m+=7,h>>>=7),h>=8&&(m+=4,h>>>=4),h>=2&&(m+=2,h>>>=2),m+h},o.prototype._zeroBits=function(a){if(a===0)return 26;var h=a,m=0;return h&8191||(m+=13,h>>>=13),h&127||(m+=7,h>>>=7),h&15||(m+=4,h>>>=4),h&3||(m+=2,h>>>=2),h&1||m++,m},o.prototype.bitLength=function(){var a=this.words[this.length-1],h=this._countBits(a);return(this.length-1)*26+h};function D(b){for(var a=new Array(b.bitLength()),h=0;h<a.length;h++){var m=h/26|0,w=h%26;a[h]=b.words[m]>>>w&1}return a}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,h=0;h<this.length;h++){var m=this._zeroBits(this.words[h]);if(a+=m,m!==26)break}return a},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},o.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var h=0;h<a.length;h++)this.words[h]=this.words[h]|a.words[h];return this._strip()},o.prototype.ior=function(a){return n((this.negative|a.negative)===0),this.iuor(a)},o.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},o.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},o.prototype.iuand=function(a){var h;this.length>a.length?h=a:h=this;for(var m=0;m<h.length;m++)this.words[m]=this.words[m]&a.words[m];return this.length=h.length,this._strip()},o.prototype.iand=function(a){return n((this.negative|a.negative)===0),this.iuand(a)},o.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},o.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},o.prototype.iuxor=function(a){var h,m;this.length>a.length?(h=this,m=a):(h=a,m=this);for(var w=0;w<m.length;w++)this.words[w]=h.words[w]^m.words[w];if(this!==h)for(;w<h.length;w++)this.words[w]=h.words[w];return this.length=h.length,this._strip()},o.prototype.ixor=function(a){return n((this.negative|a.negative)===0),this.iuxor(a)},o.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},o.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},o.prototype.inotn=function(a){n(typeof a=="number"&&a>=0);var h=Math.ceil(a/26)|0,m=a%26;this._expand(h),m>0&&h--;for(var w=0;w<h;w++)this.words[w]=~this.words[w]&67108863;return m>0&&(this.words[w]=~this.words[w]&67108863>>26-m),this._strip()},o.prototype.notn=function(a){return this.clone().inotn(a)},o.prototype.setn=function(a,h){n(typeof a=="number"&&a>=0);var m=a/26|0,w=a%26;return this._expand(m+1),h?this.words[m]=this.words[m]|1<<w:this.words[m]=this.words[m]&~(1<<w),this._strip()},o.prototype.iadd=function(a){var h;if(this.negative!==0&&a.negative===0)return this.negative=0,h=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,h=this.isub(a),a.negative=1,h._normSign();var m,w;this.length>a.length?(m=this,w=a):(m=a,w=this);for(var _=0,S=0;S<w.length;S++)h=(m.words[S]|0)+(w.words[S]|0)+_,this.words[S]=h&67108863,_=h>>>26;for(;_!==0&&S<m.length;S++)h=(m.words[S]|0)+_,this.words[S]=h&67108863,_=h>>>26;if(this.length=m.length,_!==0)this.words[this.length]=_,this.length++;else if(m!==this)for(;S<m.length;S++)this.words[S]=m.words[S];return this},o.prototype.add=function(a){var h;return a.negative!==0&&this.negative===0?(a.negative=0,h=this.sub(a),a.negative^=1,h):a.negative===0&&this.negative!==0?(this.negative=0,h=a.sub(this),this.negative=1,h):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},o.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var h=this.iadd(a);return a.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var m=this.cmp(a);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var w,_;m>0?(w=this,_=a):(w=a,_=this);for(var S=0,A=0;A<_.length;A++)h=(w.words[A]|0)-(_.words[A]|0)+S,S=h>>26,this.words[A]=h&67108863;for(;S!==0&&A<w.length;A++)h=(w.words[A]|0)+S,S=h>>26,this.words[A]=h&67108863;if(S===0&&A<w.length&&w!==this)for(;A<w.length;A++)this.words[A]=w.words[A];return this.length=Math.max(this.length,A),w!==this&&(this.negative=1),this._strip()},o.prototype.sub=function(a){return this.clone().isub(a)};function P(b,a,h){h.negative=a.negative^b.negative;var m=b.length+a.length|0;h.length=m,m=m-1|0;var w=b.words[0]|0,_=a.words[0]|0,S=w*_,A=S&67108863,y=S/67108864|0;h.words[0]=A;for(var f=1;f<m;f++){for(var v=y>>>26,ne=y&67108863,re=Math.min(f,a.length-1),oe=Math.max(0,f-b.length+1);oe<=re;oe++){var ot=f-oe|0;w=b.words[ot]|0,_=a.words[oe]|0,S=w*_+ne,v+=S/67108864|0,ne=S&67108863}h.words[f]=ne|0,y=v|0}return y!==0?h.words[f]=y|0:h.length--,h._strip()}var F=function(a,h,m){var w=a.words,_=h.words,S=m.words,A=0,y,f,v,ne=w[0]|0,re=ne&8191,oe=ne>>>13,ot=w[1]|0,me=ot&8191,be=ot>>>13,Wr=w[2]|0,Te=Wr&8191,Be=Wr>>>13,Xt=w[3]|0,_e=Xt&8191,Pe=Xt>>>13,wn=w[4]|0,ke=wn&8191,Ue=wn>>>13,vn=w[5]|0,Oe=vn&8191,xe=vn>>>13,Bt=w[6]|0,Ae=Bt&8191,$e=Bt>>>13,Lt=w[7]|0,Ce=Lt&8191,p=Lt>>>13,u=w[8]|0,c=u&8191,g=u>>>13,I=w[9]|0,k=I&8191,T=I>>>13,fe=_[0]|0,ae=fe&8191,se=fe>>>13,Se=_[1]|0,ie=Se&8191,Ze=Se>>>13,Wo=_[2]|0,je=Wo&8191,Ke=Wo>>>13,Jo=_[3]|0,Ve=Jo&8191,qe=Jo>>>13,Go=_[4]|0,We=Go&8191,Je=Go>>>13,Yo=_[5]|0,Ge=Yo&8191,Ye=Yo>>>13,Ho=_[6]|0,He=Ho&8191,Xe=Ho>>>13,Xo=_[7]|0,Qe=Xo&8191,et=Xo>>>13,Qo=_[8]|0,tt=Qo&8191,rt=Qo>>>13,es=_[9]|0,nt=es&8191,it=es>>>13;m.negative=a.negative^h.negative,m.length=19,y=Math.imul(re,ae),f=Math.imul(re,se),f=f+Math.imul(oe,ae)|0,v=Math.imul(oe,se);var gi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(gi>>>26)|0,gi&=67108863,y=Math.imul(me,ae),f=Math.imul(me,se),f=f+Math.imul(be,ae)|0,v=Math.imul(be,se),y=y+Math.imul(re,ie)|0,f=f+Math.imul(re,Ze)|0,f=f+Math.imul(oe,ie)|0,v=v+Math.imul(oe,Ze)|0;var yi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(yi>>>26)|0,yi&=67108863,y=Math.imul(Te,ae),f=Math.imul(Te,se),f=f+Math.imul(Be,ae)|0,v=Math.imul(Be,se),y=y+Math.imul(me,ie)|0,f=f+Math.imul(me,Ze)|0,f=f+Math.imul(be,ie)|0,v=v+Math.imul(be,Ze)|0,y=y+Math.imul(re,je)|0,f=f+Math.imul(re,Ke)|0,f=f+Math.imul(oe,je)|0,v=v+Math.imul(oe,Ke)|0;var wi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(wi>>>26)|0,wi&=67108863,y=Math.imul(_e,ae),f=Math.imul(_e,se),f=f+Math.imul(Pe,ae)|0,v=Math.imul(Pe,se),y=y+Math.imul(Te,ie)|0,f=f+Math.imul(Te,Ze)|0,f=f+Math.imul(Be,ie)|0,v=v+Math.imul(Be,Ze)|0,y=y+Math.imul(me,je)|0,f=f+Math.imul(me,Ke)|0,f=f+Math.imul(be,je)|0,v=v+Math.imul(be,Ke)|0,y=y+Math.imul(re,Ve)|0,f=f+Math.imul(re,qe)|0,f=f+Math.imul(oe,Ve)|0,v=v+Math.imul(oe,qe)|0;var vi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(vi>>>26)|0,vi&=67108863,y=Math.imul(ke,ae),f=Math.imul(ke,se),f=f+Math.imul(Ue,ae)|0,v=Math.imul(Ue,se),y=y+Math.imul(_e,ie)|0,f=f+Math.imul(_e,Ze)|0,f=f+Math.imul(Pe,ie)|0,v=v+Math.imul(Pe,Ze)|0,y=y+Math.imul(Te,je)|0,f=f+Math.imul(Te,Ke)|0,f=f+Math.imul(Be,je)|0,v=v+Math.imul(Be,Ke)|0,y=y+Math.imul(me,Ve)|0,f=f+Math.imul(me,qe)|0,f=f+Math.imul(be,Ve)|0,v=v+Math.imul(be,qe)|0,y=y+Math.imul(re,We)|0,f=f+Math.imul(re,Je)|0,f=f+Math.imul(oe,We)|0,v=v+Math.imul(oe,Je)|0;var bi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(bi>>>26)|0,bi&=67108863,y=Math.imul(Oe,ae),f=Math.imul(Oe,se),f=f+Math.imul(xe,ae)|0,v=Math.imul(xe,se),y=y+Math.imul(ke,ie)|0,f=f+Math.imul(ke,Ze)|0,f=f+Math.imul(Ue,ie)|0,v=v+Math.imul(Ue,Ze)|0,y=y+Math.imul(_e,je)|0,f=f+Math.imul(_e,Ke)|0,f=f+Math.imul(Pe,je)|0,v=v+Math.imul(Pe,Ke)|0,y=y+Math.imul(Te,Ve)|0,f=f+Math.imul(Te,qe)|0,f=f+Math.imul(Be,Ve)|0,v=v+Math.imul(Be,qe)|0,y=y+Math.imul(me,We)|0,f=f+Math.imul(me,Je)|0,f=f+Math.imul(be,We)|0,v=v+Math.imul(be,Je)|0,y=y+Math.imul(re,Ge)|0,f=f+Math.imul(re,Ye)|0,f=f+Math.imul(oe,Ge)|0,v=v+Math.imul(oe,Ye)|0;var _i=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(_i>>>26)|0,_i&=67108863,y=Math.imul(Ae,ae),f=Math.imul(Ae,se),f=f+Math.imul($e,ae)|0,v=Math.imul($e,se),y=y+Math.imul(Oe,ie)|0,f=f+Math.imul(Oe,Ze)|0,f=f+Math.imul(xe,ie)|0,v=v+Math.imul(xe,Ze)|0,y=y+Math.imul(ke,je)|0,f=f+Math.imul(ke,Ke)|0,f=f+Math.imul(Ue,je)|0,v=v+Math.imul(Ue,Ke)|0,y=y+Math.imul(_e,Ve)|0,f=f+Math.imul(_e,qe)|0,f=f+Math.imul(Pe,Ve)|0,v=v+Math.imul(Pe,qe)|0,y=y+Math.imul(Te,We)|0,f=f+Math.imul(Te,Je)|0,f=f+Math.imul(Be,We)|0,v=v+Math.imul(Be,Je)|0,y=y+Math.imul(me,Ge)|0,f=f+Math.imul(me,Ye)|0,f=f+Math.imul(be,Ge)|0,v=v+Math.imul(be,Ye)|0,y=y+Math.imul(re,He)|0,f=f+Math.imul(re,Xe)|0,f=f+Math.imul(oe,He)|0,v=v+Math.imul(oe,Xe)|0;var Ei=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Ei>
69>>26)|0,Ei&=67108863,y=Math.imul(Ce,ae),f=Math.imul(Ce,se),f=f+Math.imul(p,ae)|0,v=Math.imul(p,se),y=y+Math.imul(Ae,ie)|0,f=f+Math.imul(Ae,Ze)|0,f=f+Math.imul($e,ie)|0,v=v+Math.imul($e,Ze)|0,y=y+Math.imul(Oe,je)|0,f=f+Math.imul(Oe,Ke)|0,f=f+Math.imul(xe,je)|0,v=v+Math.imul(xe,Ke)|0,y=y+Math.imul(ke,Ve)|0,f=f+Math.imul(ke,qe)|0,f=f+Math.imul(Ue,Ve)|0,v=v+Math.imul(Ue,qe)|0,y=y+Math.imul(_e,We)|0,f=f+Math.imul(_e,Je)|0,f=f+Math.imul(Pe,We)|0,v=v+Math.imul(Pe,Je)|0,y=y+Math.imul(Te,Ge)|0,f=f+Math.imul(Te,Ye)|0,f=f+Math.imul(Be,Ge)|0,v=v+Math.imul(Be,Ye)|0,y=y+Math.imul(me,He)|0,f=f+Math.imul(me,Xe)|0,f=f+Math.imul(be,He)|0,v=v+Math.imul(be,Xe)|0,y=y+Math.imul(re,Qe)|0,f=f+Math.imul(re,et)|0,f=f+Math.imul(oe,Qe)|0,v=v+Math.imul(oe,et)|0;var xi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(xi>>>26)|0,xi&=67108863,y=Math.imul(c,ae),f=Math.imul(c,se),f=f+Math.imul(g,ae)|0,v=Math.imul(g,se),y=y+Math.imul(Ce,ie)|0,f=f+Math.imul(Ce,Ze)|0,f=f+Math.imul(p,ie)|0,v=v+Math.imul(p,Ze)|0,y=y+Math.imul(Ae,je)|0,f=f+Math.imul(Ae,Ke)|0,f=f+Math.imul($e,je)|0,v=v+Math.imul($e,Ke)|0,y=y+Math.imul(Oe,Ve)|0,f=f+Math.imul(Oe,qe)|0,f=f+Math.imul(xe,Ve)|0,v=v+Math.imul(xe,qe)|0,y=y+Math.imul(ke,We)|0,f=f+Math.imul(ke,Je)|0,f=f+Math.imul(Ue,We)|0,v=v+Math.imul(Ue,Je)|0,y=y+Math.imul(_e,Ge)|0,f=f+Math.imul(_e,Ye)|0,f=f+Math.imul(Pe,Ge)|0,v=v+Math.imul(Pe,Ye)|0,y=y+Math.imul(Te,He)|0,f=f+Math.imul(Te,Xe)|0,f=f+Math.imul(Be,He)|0,v=v+Math.imul(Be,Xe)|0,y=y+Math.imul(me,Qe)|0,f=f+Math.imul(me,et)|0,f=f+Math.imul(be,Qe)|0,v=v+Math.imul(be,et)|0,y=y+Math.imul(re,tt)|0,f=f+Math.imul(re,rt)|0,f=f+Math.imul(oe,tt)|0,v=v+Math.imul(oe,rt)|0;var Si=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Si>>>26)|0,Si&=67108863,y=Math.imul(k,ae),f=Math.imul(k,se),f=f+Math.imul(T,ae)|0,v=Math.imul(T,se),y=y+Math.imul(c,ie)|0,f=f+Math.imul(c,Ze)|0,f=f+Math.imul(g,ie)|0,v=v+Math.imul(g,Ze)|0,y=y+Math.imul(Ce,je)|0,f=f+Math.imul(Ce,Ke)|0,f=f+Math.imul(p,je)|0,v=v+Math.imul(p,Ke)|0,y=y+Math.imul(Ae,Ve)|0,f=f+Math.imul(Ae,qe)|0,f=f+Math.imul($e,Ve)|0,v=v+Math.imul($e,qe)|0,y=y+Math.imul(Oe,We)|0,f=f+Math.imul(Oe,Je)|0,f=f+Math.imul(xe,We)|0,v=v+Math.imul(xe,Je)|0,y=y+Math.imul(ke,Ge)|0,f=f+Math.imul(ke,Ye)|0,f=f+Math.imul(Ue,Ge)|0,v=v+Math.imul(Ue,Ye)|0,y=y+Math.imul(_e,He)|0,f=f+Math.imul(_e,Xe)|0,f=f+Math.imul(Pe,He)|0,v=v+Math.imul(Pe,Xe)|0,y=y+Math.imul(Te,Qe)|0,f=f+Math.imul(Te,et)|0,f=f+Math.imul(Be,Qe)|0,v=v+Math.imul(Be,et)|0,y=y+Math.imul(me,tt)|0,f=f+Math.imul(me,rt)|0,f=f+Math.imul(be,tt)|0,v=v+Math.imul(be,rt)|0,y=y+Math.imul(re,nt)|0,f=f+Math.imul(re,it)|0,f=f+Math.imul(oe,nt)|0,v=v+Math.imul(oe,it)|0;var Ii=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Ii>>>26)|0,Ii&=67108863,y=Math.imul(k,ie),f=Math.imul(k,Ze),f=f+Math.imul(T,ie)|0,v=Math.imul(T,Ze),y=y+Math.imul(c,je)|0,f=f+Math.imul(c,Ke)|0,f=f+Math.imul(g,je)|0,v=v+Math.imul(g,Ke)|0,y=y+Math.imul(Ce,Ve)|0,f=f+Math.imul(Ce,qe)|0,f=f+Math.imul(p,Ve)|0,v=v+Math.imul(p,qe)|0,y=y+Math.imul(Ae,We)|0,f=f+Math.imul(Ae,Je)|0,f=f+Math.imul($e,We)|0,v=v+Math.imul($e,Je)|0,y=y+Math.imul(Oe,Ge)|0,f=f+Math.imul(Oe,Ye)|0,f=f+Math.imul(xe,Ge)|0,v=v+Math.imul(xe,Ye)|0,y=y+Math.imul(ke,He)|0,f=f+Math.imul(ke,Xe)|0,f=f+Math.imul(Ue,He)|0,v=v+Math.imul(Ue,Xe)|0,y=y+Math.imul(_e,Qe)|0,f=f+Math.imul(_e,et)|0,f=f+Math.imul(Pe,Qe)|0,v=v+Math.imul(Pe,et)|0,y=y+Math.imul(Te,tt)|0,f=f+Math.imul(Te,rt)|0,f=f+Math.imul(Be,tt)|0,v=v+Math.imul(Be,rt)|0,y=y+Math.imul(me,nt)|0,f=f+Math.imul(me,it)|0,f=f+Math.imul(be,nt)|0,v=v+Math.imul(be,it)|0;var ki=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(ki>>>26)|0,ki&=67108863,y=Math.imul(k,je),f=Math.imul(k,Ke),f=f+Math.imul(T,je)|0,v=Math.imul(T,Ke),y=y+Math.imul(c,Ve)|0,f=f+Math.imul(c,qe)|0,f=f+Math.imul(g,Ve)|0,v=v+Math.imul(g,qe)|0,y=y+Math.imul(Ce,We)|0,f=f+Math.imul(Ce,Je)|0,f=f+Math.imul(p,We)|0,v=v+Math.imul(p,Je)|0,y=y+Math.imul(Ae,Ge)|0,f=f+Math.imul(Ae,Ye)|0,f=f+Math.imul($e,Ge)|0,v=v+Math.imul($e,Ye)|0,y=y+Math.imul(Oe,He)|0,f=f+Math.imul(Oe,Xe)|0,f=f+Math.imul(xe,He)|0,v=v+Math.imul(xe,Xe)|0,y=y+Math.imul(ke,Qe)|0,f=f+Math.imul(ke,et)|0,f=f+Math.imul(Ue,Qe)|0,v=v+Math.imul(Ue,et)|0,y=y+Math.imul(_e,tt)|0,f=f+Math.imul(_e,rt)|0,f=f+Math.imul(Pe,tt)|0,v=v+Math.imul(Pe,rt)|0,y=y+Math.imul(Te,nt)|0,f=f+Math.imul(Te,it)|0,f=f+Math.imul(Be,nt)|0,v=v+Math.imul(Be,it)|0;var Ai=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Ai>>>26)|0,Ai&=67108863,y=Math.imul(k,Ve),f=Math.imul(k,qe),f=f+Math.imul(T,Ve)|0,v=Math.imul(T,qe),y=y+Math.imul(c,We)|0,f=f+Math.imul(c,Je)|0,f=f+Math.imul(g,We)|0,v=v+Math.imul(g,Je)|0,y=y+Math.imul(Ce,Ge)|0,f=f+Math.imul(Ce,Ye)|0,f=f+Math.imul(p,Ge)|0,v=v+Math.imul(p,Ye)|0,y=y+Math.imul(Ae,He)|0,f=f+Math.imul(Ae,Xe)|0,f=f+Math.imul($e,He)|0,v=v+Math.imul($e,Xe)|0,y=y+Math.imul(Oe,Qe)|0,f=f+Math.imul(Oe,et)|0,f=f+Math.imul(xe,Qe)|0,v=v+Math.imul(xe,et)|0,y=y+Math.imul(ke,tt)|0,f=f+Math.imul(ke,rt)|0,f=f+Math.imul(Ue,tt)|0,v=v+Math.imul(Ue,rt)|0,y=y+Math.imul(_e,nt)|0,f=f+Math.imul(_e,it)|0,f=f+Math.imul(Pe,nt)|0,v=v+Math.imul(Pe,it)|0;var Mi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Mi>>>
vendor: 34,906 bytes, line 69
6926)|0,Mi&=67108863,y=Math.imul(k,We),f=Math.imul(k,Je),f=f+Math.imul(T,We)|0,v=Math.imul(T,Je),y=y+Math.imul(c,Ge)|0,f=f+Math.imul(c,Ye)|0,f=f+Math.imul(g,Ge)|0,v=v+Math.imul(g,Ye)|0,y=y+Math.imul(Ce,He)|0,f=f+Math.imul(Ce,Xe)|0,f=f+Math.imul(p,He)|0,v=v+Math.imul(p,Xe)|0,y=y+Math.imul(Ae,Qe)|0,f=f+Math.imul(Ae,et)|0,f=f+Math.imul($e,Qe)|0,v=v+Math.imul($e,et)|0,y=y+Math.imul(Oe,tt)|0,f=f+Math.imul(Oe,rt)|0,f=f+Math.imul(xe,tt)|0,v=v+Math.imul(xe,rt)|0,y=y+Math.imul(ke,nt)|0,f=f+Math.imul(ke,it)|0,f=f+Math.imul(Ue,nt)|0,v=v+Math.imul(Ue,it)|0;var Bi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Bi>>>26)|0,Bi&=67108863,y=Math.imul(k,Ge),f=Math.imul(k,Ye),f=f+Math.imul(T,Ge)|0,v=Math.imul(T,Ye),y=y+Math.imul(c,He)|0,f=f+Math.imul(c,Xe)|0,f=f+Math.imul(g,He)|0,v=v+Math.imul(g,Xe)|0,y=y+Math.imul(Ce,Qe)|0,f=f+Math.imul(Ce,et)|0,f=f+Math.imul(p,Qe)|0,v=v+Math.imul(p,et)|0,y=y+Math.imul(Ae,tt)|0,f=f+Math.imul(Ae,rt)|0,f=f+Math.imul($e,tt)|0,v=v+Math.imul($e,rt)|0,y=y+Math.imul(Oe,nt)|0,f=f+Math.imul(Oe,it)|0,f=f+Math.imul(xe,nt)|0,v=v+Math.imul(xe,it)|0;var Oi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Oi>>>26)|0,Oi&=67108863,y=Math.imul(k,He),f=Math.imul(k,Xe),f=f+Math.imul(T,He)|0,v=Math.imul(T,Xe),y=y+Math.imul(c,Qe)|0,f=f+Math.imul(c,et)|0,f=f+Math.imul(g,Qe)|0,v=v+Math.imul(g,et)|0,y=y+Math.imul(Ce,tt)|0,f=f+Math.imul(Ce,rt)|0,f=f+Math.imul(p,tt)|0,v=v+Math.imul(p,rt)|0,y=y+Math.imul(Ae,nt)|0,f=f+Math.imul(Ae,it)|0,f=f+Math.imul($e,nt)|0,v=v+Math.imul($e,it)|0;var Ri=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Ri>>>26)|0,Ri&=67108863,y=Math.imul(k,Qe),f=Math.imul(k,et),f=f+Math.imul(T,Qe)|0,v=Math.imul(T,et),y=y+Math.imul(c,tt)|0,f=f+Math.imul(c,rt)|0,f=f+Math.imul(g,tt)|0,v=v+Math.imul(g,rt)|0,y=y+Math.imul(Ce,nt)|0,f=f+Math.imul(Ce,it)|0,f=f+Math.imul(p,nt)|0,v=v+Math.imul(p,it)|0;var zi=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(zi>>>26)|0,zi&=67108863,y=Math.imul(k,tt),f=Math.imul(k,rt),f=f+Math.imul(T,tt)|0,v=Math.imul(T,rt),y=y+Math.imul(c,nt)|0,f=f+Math.imul(c,it)|0,f=f+Math.imul(g,nt)|0,v=v+Math.imul(g,it)|0;var Ti=(A+y|0)+((f&8191)<<13)|0;A=(v+(f>>>13)|0)+(Ti>>>26)|0,Ti&=67108863,y=Math.imul(k,nt),f=Math.imul(k,it),f=f+Math.imul(T,nt)|0,v=Math.imul(T,it);var Pi=(A+y|0)+((f&8191)<<13)|0;return A=(v+(f>>>13)|0)+(Pi>>>26)|0,Pi&=67108863,S[0]=gi,S[1]=yi,S[2]=wi,S[3]=vi,S[4]=bi,S[5]=_i,S[6]=Ei,S[7]=xi,S[8]=Si,S[9]=Ii,S[10]=ki,S[11]=Ai,S[12]=Mi,S[13]=Bi,S[14]=Oi,S[15]=Ri,S[16]=zi,S[17]=Ti,S[18]=Pi,A!==0&&(S[19]=A,m.length++),m};Math.imul||(F=P);function Z(b,a,h){h.negative=a.negative^b.negative,h.length=b.length+a.length;for(var m=0,w=0,_=0;_<h.length-1;_++){var S=w;w=0;for(var A=m&67108863,y=Math.min(_,a.length-1),f=Math.max(0,_-b.length+1);f<=y;f++){var v=_-f,ne=b.words[v]|0,re=a.words[f]|0,oe=ne*re,ot=oe&67108863;S=S+(oe/67108864|0)|0,ot=ot+A|0,A=ot&67108863,S=S+(ot>>>26)|0,w+=S>>>26,S&=67108863}h.words[_]=A,m=S,S=w}return m!==0?h.words[_]=m:h.length--,h._strip()}function W(b,a,h){return Z(b,a,h)}o.prototype.mulTo=function(a,h){var m,w=this.length+a.length;return this.length===10&&a.length===10?m=F(this,a,h):w<63?m=P(this,a,h):w<1024?m=Z(this,a,h):m=W(this,a,h),m},o.prototype.mul=function(a){var h=new o(null);return h.words=new Array(this.length+a.length),this.mulTo(a,h)},o.prototype.mulf=function(a){var h=new o(null);return h.words=new Array(this.length+a.length),W(this,a,h)},o.prototype.imul=function(a){return this.clone().mulTo(a,this)},o.prototype.imuln=function(a){var h=a<0;h&&(a=-a),n(typeof a=="number"),n(a<67108864);for(var m=0,w=0;w<this.length;w++){var _=(this.words[w]|0)*a,S=(_&67108863)+(m&67108863);m>>=26,m+=_/67108864|0,m+=S>>>26,this.words[w]=S&67108863}return m!==0&&(this.words[w]=m,this.length++),this.length=a===0?1:this.length,h?this.ineg():this},o.prototype.muln=function(a){return this.clone().imuln(a)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(a){var h=D(a);if(h.length===0)return new o(1);for(var m=this,w=0;w<h.length&&h[w]===0;w++,m=m.sqr());if(++w<h.length)for(var _=m.sqr();w<h.length;w++,_=_.sqr())h[w]!==0&&(m=m.mul(_));return m},o.prototype.iushln=function(a){n(typeof a=="number"&&a>=0);var h=a%26,m=(a-h)/26,w=67108863>>>26-h<<26-h,_;if(h!==0){var S=0;for(_=0;_<this.length;_++){var A=this.words[_]&w,y=(this.words[_]|0)-A<<h;this.words[_]=y|S,S=A>>>26-h}S&&(this.words[_]=S,this.length++)}if(m!==0){for(_=this.length-1;_>=0;_--)this.words[_+m]=this.words[_];for(_=0;_<m;_++)this.words[_]=0;this.length+=m}return this._strip()},o.prototype.ishln=function(a){return n(this.negative===0),this.iushln(a)},o.prototype.iushrn=function(a,h,m){n(typeof a=="number"&&a>=0);var w;h?w=(h-h%26)/26:w=0;var _=a%26,S=Math.min((a-_)/26,this.length),A=67108863^67108863>>>_<<_,y=m;if(w-=S,w=Math.max(0,w),y){for(var f=0;f<S;f++)y.words[f]=this.words[f];y.length=S}if(S!==0)if(this.length>S)for(this.length-=S,f=0;f<this.length;f++)this.words[f]=this.words[f+S];else this.words[0]=0,this.length=1;var v=0;for(f=this.length-1;f>=0&&(v!==0||f>=w);f--){var ne=this.words[f]|0;this.words[f]=v<<26-_|ne>>>_,v=ne&A}return y&&v!==0&&(y.words[y.length++]=v),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},o.prototype.ishrn=function(a,h,m){return n(this.negative===0),this.iushrn(a,h,m)},o.prototype.shln=function(a){return this.clone().ishln(a)},o.prototype.ushln=function(a){return this.clone().iushln(a)},o.prototype.shrn=function(a){return this.clone().ishrn(a)},o.prototype.ushrn=function(a){return this.clone().iushrn(a)},o.prototype.testn=function(a){n(typeof a=="number"&&a>=0);var h=a%26,m=(a-h)/26,w=1<<h;if(this.length<=m)return!1;var _=this.words[m];return!!(_&w)},o.prototype.imaskn=function(a){n(typeof a=="number"&&a>=0);var h=a%26,m=(a-h)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(h!==0&&m++,this.length=Math.min(m,this.length),h!==0){var w=67108863^67108863>>>h<<h;this.words[this.length-1]&=w}return this._strip()},o.prototype.maskn=function(a){return this.clone().imaskn(a)},o.prototype.iaddn=function(a){return n(typeof a=="number"),n(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<=a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},o.prototype._iaddn=function(a){this.words[0]+=a;for(var h=0;h<this.length&&this.words[h]>=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},o.prototype.isubn=function(a){if(n(typeof a=="number"),n(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h<this.length&&this.words[h]<0;h++)this.words[h]+=67108864,this.words[h+1]-=1;return this._strip()},o.prototype.addn=function(a){return this.clone().iaddn(a)},o.prototype.subn=function(a){return this.clone().isubn(a)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(a,h,m){var w=a.length+m,_;this._expand(w);var S,A=0;for(_=0;_<a.length;_++){S=(this.words[_+m]|0)+A;var y=(a.words[_]|0)*h;S-=y&67108863,A=(S>>26)-(y/67108864|0),this.words[_+m]=S&67108863}for(;_<this.length-m;_++)S=(this.words[_+m]|0)+A,A=S>>26,this.words[_+m]=S&67108863;if(A===0)return this._strip();for(n(A===-1),A=0,_=0;_<this.length;_++)S=-(this.words[_]|0)+A,A=S>>26,this.words[_]=S&67108863;return this.negative=1,this._strip()},o.prototype._wordDiv=function(a,h){var m=this.length-a.length,w=this.clone(),_=a,S=_.words[_.length-1]|0,A=this._countBits(S);m=26-A,m!==0&&(_=_.ushln(m),w.iushln(m),S=_.words[_.length-1]|0);var y=w.length-_.length,f;if(h!=="mod"){f=new o(null),f.length=y+1,f.words=new Array(f.length);for(var v=0;v<f.length;v++)f.words[v]=0}var ne=w.clone()._ishlnsubmul(_,1,y);ne.negative===0&&(w=ne,f&&(f.words[y]=1));for(var re=y-1;re>=0;re--){var oe=(w.words[_.length+re]|0)*67108864+(w.words[_.length+re-1]|0);for(oe=Math.min(oe/S|0,67108863),w._ishlnsubmul(_,oe,re);w.negative!==0;)oe--,w.negative=0,w._ishlnsubmul(_,1,re),w.isZero()||(w.negative^=1);f&&(f.words[re]=oe)}return f&&f._strip(),w._strip(),h!=="div"&&m!==0&&w.iushrn(m),{div:f||null,mod:w}},o.prototype.divmod=function(a,h,m){if(n(!a.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var w,_,S;return this.negative!==0&&a.negative===0?(S=this.neg().divmod(a,h),h!=="mod"&&(w=S.div.neg()),h!=="div"&&(_=S.mod.neg(),m&&_.negative!==0&&_.iadd(a)),{div:w,mod:_}):this.negative===0&&a.negative!==0?(S=this.divmod(a.neg(),h),h!=="mod"&&(w=S.div.neg()),{div:w,mod:S.mod}):this.negative&a.negative?(S=this.neg().divmod(a.neg(),h),h!=="div"&&(_=S.mod.neg(),m&&_.negative!==0&&_.isub(a)),{div:S.div,mod:_}):a.length>this.length||this.cmp(a)<0?{div:new o(0),mod:this}:a.length===1?h==="div"?{div:this.divn(a.words[0]),mod:null}:h==="mod"?{div:null,mod:new o(this.modrn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new o(this.modrn(a.words[0]))}:this._wordDiv(a,h)},o.prototype.div=function(a){return this.divmod(a,"div",!1).div},o.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},o.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},o.prototype.divRound=function(a){var h=this.divmod(a);if(h.mod.isZero())return h.div;var m=h.div.negative!==0?h.mod.isub(a):h.mod,w=a.ushrn(1),_=a.andln(1),S=m.cmp(w);return S<0||_===1&&S===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},o.prototype.modrn=function(a){var h=a<0;h&&(a=-a),n(a<=67108863);for(var m=(1<<26)%a,w=0,_=this.length-1;_>=0;_--)w=(m*w+(this.words[_]|0))%a;return h?-w:w},o.prototype.modn=function(a){return this.modrn(a)},o.prototype.idivn=function(a){var h=a<0;h&&(a=-a),n(a<=67108863);for(var m=0,w=this.length-1;w>=0;w--){var _=(this.words[w]|0)+m*67108864;this.words[w]=_/a|0,m=_%a}return this._strip(),h?this.ineg():this},o.prototype.divn=function(a){return this.clone().idivn(a)},o.prototype.egcd=function(a){n(a.negative===0),n(!a.isZero());var h=this,m=a.clone();h.negative!==0?h=h.umod(a):h=h.clone();for(var w=new o(1),_=new o(0),S=new o(0),A=new o(1),y=0;h.isEven()&&m.isEven();)h.iushrn(1),m.iushrn(1),++y;for(var f=m.clone(),v=h.clone();!h.isZero();){for(var ne=0,re=1;!(h.words[0]&re)&&ne<26;++ne,re<<=1);if(ne>0)for(h.iushrn(ne);ne-- >0;)(w.isOdd()||_.isOdd())&&(w.iadd(f),_.isub(v)),w.iushrn(1),_.iushrn(1);for(var oe=0,ot=1;!(m.words[0]&ot)&&oe<26;++oe,ot<<=1);if(oe>0)for(m.iushrn(oe);oe-- >0;)(S.isOdd()||A.isOdd())&&(S.iadd(f),A.isub(v)),S.iushrn(1),A.iushrn(1);h.cmp(m)>=0?(h.isub(m),w.isub(S),_.isub(A)):(m.isub(h),S.isub(w),A.isub(_))}return{a:S,b:A,gcd:m.iushln(y)}},o.prototype._invmp=function(a){n(a.negative===0),n(!a.isZero());var h=this,m=a.clone();h.negative!==0?h=h.umod(a):h=h.clone();for(var w=new o(1),_=new o(0),S=m.clone();h.cmpn(1)>0&&m.cmpn(1)>0;){for(var A=0,y=1;!(h.words[0]&y)&&A<26;++A,y<<=1);if(A>0)for(h.iushrn(A);A-- >0;)w.isOdd()&&w.iadd(S),w.iushrn(1);for(var f=0,v=1;!(m.words[0]&v)&&f<26;++f,v<<=1);if(f>0)for(m.iushrn(f);f-- >0;)_.isOdd()&&_.iadd(S),_.iushrn(1);h.cmp(m)>=0?(h.isub(m),w.isub(_)):(m.isub(h),_.isub(w))}var ne;return h.cmpn(1)===0?ne=w:ne=_,ne.cmpn(0)<0&&ne.iadd(a),ne},o.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var h=this.clone(),m=a.clone();h.negative=0,m.negative=0;for(var w=0;h.isEven()&&m.isEven();w++)h.iushrn(1),m.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;m.isEven();)m.iushrn(1);var _=h.cmp(m);if(_<0){var S=h;h=m,m=S}else if(_===0||m.cmpn(1)===0)break;h.isub(m)}while(!0);return m.iushln(w)},o.prototype.invm=function(a){return this.egcd(a).a.umod(a)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(a){return this.words[0]&a},o.prototype.bincn=function(a){n(typeof a=="number");var h=a%26,m=(a-h)/26,w=1<<h;if(this.length<=m)return this._expand(m+1),this.words[m]|=w,this;for(var _=w,S=m;_!==0&&S<this.length;S++){var A=this.words[S]|0;A+=_,_=A>>>26,A&=67108863,this.words[S]=A}return _!==0&&(this.words[S]=_,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(a){var h=a<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var m;if(this.length>1)m=1;else{h&&(a=-a),n(a<=67108863,"Number is too big");var w=this.words[0]|0;m=w===a?0:w<a?-1:1}return this.negative!==0?-m|0:m},o.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var h=this.ucmp(a);return this.negative!==0?-h|0:h},o.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var h=0,m=this.length-1;m>=0;m--){var w=this.words[m]|0,_=a.words[m]|0;if(w!==_){w<_?h=-1:w>_&&(h=1);break}}return h},o.prototype.gtn=function(a){return this.cmpn(a)===1},o.prototype.gt=function(a){return this.cmp(a)===1},o.prototype.gten=function(a){return this.cmpn(a)>=0},o.prototype.gte=function(a){return this.cmp(a)>=0},o.prototype.ltn=function(a){return this.cmpn(a)===-1},o.prototype.lt=function(a){return this.cmp(a)===-1},o.prototype.lten=function(a){return this.cmpn(a)<=0},o.prototype.lte=function(a){return this.cmp(a)<=0},o.prototype.eqn=function(a){return this.cmpn(a)===0},o.prototype.eq=function(a){return this.cmp(a)===0},o.red=function(a){return new G(a)},o.prototype.toRed=function(a){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},o.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(a){return this.red=a,this},o.prototype.forceRed=function(a){return n(!this.red,"Already a number in reduction context"),this._forceRed(a)},o.prototype.redAdd=function(a){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},o.prototype.redIAdd=function(a){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},o.prototype.redSub=function(a){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},o.prototype.redISub=function(a){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},o.prototype.redShl=function(a){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},o.prototype.redMul=function(a){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},o.prototype.redIMul=function(a){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},o.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(a){return n(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var te={k256:null,p224:null,p192:null,p25519:null};function V(b,a){this.name=b,this.p=new o(a,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}V.prototype._tmp=function(){var a=new o(null);return a.words=new Array(Math.ceil(this.n/13)),a},V.prototype.ireduce=function(a){var h=a,m;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),m=h.bitLength();while(m>this.n);var w=m<this.n?-1:h.ucmp(this.p);return w===0?(h.words[0]=0,h.length=1):w>0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},V.prototype.split=function(a,h){a.iushrn(this.n,0,h)},V.prototype.imulK=function(a){return a.imul(this.k)};function Y(){V.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(Y,V),Y.prototype.split=function(a,h){for(var m=4194303,w=Math.min(a.length,9),_=0;_<w;_++)h.words[_]=a.words[_];if(h.length=w,a.length<=9){a.words[0]=0,a.length=1;return}var S=a.words[9];for(h.words[h.length++]=S&m,_=10;_<a.length;_++){var A=a.words[_]|0;a.words[_-10]=(A&m)<<4|S>>>22,S=A}S>>>=22,a.words[_-10]=S,S===0&&a.length>10?a.length-=10:a.length-=9},Y.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var h=0,m=0;m<a.length;m++){var w=a.words[m]|0;h+=w*977,a.words[m]=h&67108863,h=w*64+(h/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function he(){V.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}i(he,V);function q(){V.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}i(q,V);function X(){V.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}i(X,V),X.prototype.imulK=function(a){for(var h=0,m=0;m<a.length;m++){var w=(a.words[m]|0)*19+h,_=w&67108863;w>>>=26,a.words[m]=_,h=w}return h!==0&&(a.words[a.length++]=h),a},o._prime=function(a){if(te[a])return te[a];var h;if(a==="k256")h=new Y;else if(a==="p224")h=new he;else if(a==="p192")h=new q;else if(a==="p25519")h=new X;else throw new Error("Unknown prime "+a);return te[a]=h,h};function G(b){if(typeof b=="string"){var a=o._prime(b);this.m=a.p,this.prime=a}else n(b.gtn(1),"modulus must be greater than 1"),this.m=b,this.prime=null}G.prototype._verify1=function(a){n(a.negative===0,"red works only with positives"),n(a.red,"red works only with red numbers")},G.prototype._verify2=function(a,h){n((a.negative|h.negative)===0,"red works only with positives"),n(a.red&&a.red===h.red,"red works only with red numbers")},G.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):(x(a,a.umod(this.m)._forceRed(this)),a)},G.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},G.prototype.add=function(a,h){this._verify2(a,h);var m=a.add(h);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},G.prototype.iadd=function(a,h){this._verify2(a,h);var m=a.iadd(h);return m.cmp(this.m)>=0&&m.isub(this.m),m},G.prototype.sub=function(a,h){this._verify2(a,h);var m=a.sub(h);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},G.prototype.isub=function(a,h){this._verify2(a,h);var m=a.isub(h);return m.cmpn(0)<0&&m.iadd(this.m),m},G.prototype.shl=function(a,h){return this._verify1(a),this.imod(a.ushln(h))},G.prototype.imul=function(a,h){return this._verify2(a,h),this.imod(a.imul(h))},G.prototype.mul=function(a,h){return this._verify2(a,h),this.imod(a.mul(h))},G.prototype.isqr=function(a){return this.imul(a,a.clone())},G.prototype.sqr=function(a){return this.mul(a,a)},G.prototype.sqrt=function(a){if(a.isZero())return a.clone();var h=this.m.andln(3);if(n(h%2===1),h===3){var m=this.m.add(new o(1)).iushrn(2);return this.pow(a,m)}for(var w=this.m.subn(1),_=0;!w.isZero()&&w.andln(1)===0;)_++,w.iushrn(1);n(!w.isZero());var S=new o(1).toRed(this),A=S.redNeg(),y=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);this.pow(f,y).cmp(A)!==0;)f.redIAdd(A);for(var v=this.pow(f,w),ne=this.pow(a,w.addn(1).iushrn(1)),re=this.pow(a,w),oe=_;re.cmp(S)!==0;){for(var ot=re,me=0;ot.cmp(S)!==0;me++)ot=ot.redSqr();n(me<oe);var be=this.pow(v,new o(1).iushln(oe-me-1));ne=ne.redMul(be),v=be.redSqr(),re=re.redMul(v),oe=me}return ne},G.prototype.invm=function(a){var h=a._invmp(this.m);return h.negative!==0?(h.negative=0,this.imod(h).redNeg()):this.imod(h)},G.prototype.pow=function(a,h){if(h.isZero())return new o(1).toRed(this);if(h.cmpn(1)===0)return a.clone();var m=4,w=new Array(1<<m);w[0]=new o(1).toRed(this),w[1]=a;for(var _=2;_<w.length;_++)w[_]=this.mul(w[_-1],a);var S=w[0],A=0,y=0,f=h.bitLength()%26;for(f===0&&(f=26),_=h.length-1;_>=0;_--){for(var v=h.words[_],ne=f-1;ne>=0;ne--){var re=v>>ne&1;if(S!==w[0]&&(S=this.sqr(S)),re===0&&A===0){y=0;continue}A<<=1,A|=re,y++,!(y!==m&&(_!==0||ne!==0))&&(S=this.mul(S,w[A]),y=0,A=0)}f=26}return S},G.prototype.convertTo=function(a){var h=a.umod(this.m);return h===a?h.clone():h},G.prototype.convertFrom=function(a){var h=a.clone();return h.red=null,h},o.mont=function(a){return new pe(a)};function pe(b){G.call(this,b),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(pe,G),pe.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},pe.prototype.convertFrom=function(a){var h=this.imod(a.mul(this.rinv));return h.red=null,h},pe.prototype.imul=function(a,h){if(a.isZero()||h.isZero())return a.words[0]=0,a.length=1,a;var m=a.imul(h),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=m.isub(w).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},pe.prototype.mul=function(a,h){if(a.isZero()||h.isZero())return new o(0)._forceRed(this);var m=a.mul(h),w=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),_=m.isub(w).iushrn(this.shift),S=_;return _.cmp(this.m)>=0?S=_.isub(this.m):_.cmpn(0)<0&&(S=_.iadd(this.m)),S._forceRed(this)},pe.prototype.invm=function(a){var h=this.imod(a._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(t,jt)})(So);var Ca=So.exports;const Ts=Hs(Ca);var Qi={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */(function(t,e){var r=le,n=r.Buffer;function i(s,l){for(var d in s)l[d]=s[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=r:(i(r,e),e.Buffer=o);function o(s,l,d){return n(s,l,d)}o.prototype=Object.create(n.prototype),i(n,o),o.from=function(s,l,d){if(typeof s=="number")throw new TypeError("Argument must not be a number");return n(s,l,d)},o.alloc=function(s,l,d){if(typeof s!="number")throw new TypeError("Argument must be a number");var E=n(s);return l!==void 0?typeof d=="string"?E.fill(l,d):E.fill(l):E.fill(0),E},o.allocUnsafe=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return n(s)},o.allocUnsafeSlow=function(s){if(typeof s!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(s)}})(Qi,Qi.exports);var ip=Qi.exports,Sn=ip.Buffer;function op(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),o=i.charCodeAt(0);if(e[o]!==255)throw new TypeError(i+" is ambiguous");e[o]=n}var s=t.length,l=t.charAt(0),d=Math.log(s)/Math.log(256),E=Math.log(256)/Math.log(s);function x(O){if((Array.isArray(O)||O instanceof Uint8Array)&&(O=Sn.from(O)),!Sn.isBuffer(O))throw new TypeError("Expected Buffer");if(O.length===0)return"";for(var $=0,N=0,D=0,P=O.length;D!==P&&O[D]===0;)D++,$++;for(var F=(P-D)*E+1>>>0,Z=new Uint8Array(F);D!==P;){for(var W=O[D],te=0,V=F-1;(W!==0||te<N)&&V!==-1;V--,te++)W+=256*Z[V]>>>0,Z[V]=W%s>>>0,W=W/s>>>0;if(W!==0)throw new Error("Non-zero carry");N=te,D++}for(var Y=F-N;Y!==F&&Z[Y]===0;)Y++;for(var he=l.repeat($);Y<F;++Y)he+=t.charAt(Z[Y]);return he}function M(O){if(typeof O!="string")throw new TypeError("Expected String");if(O.length===0)return Sn.alloc(0);for(var $=0,N=0,D=0;O[$]===l;)N++,$++;for(var P=(O.length-$)*d+1>>>0,F=new Uint8Array(P);$<O.length;){var Z=O.charCodeAt($);if(Z>255)return;var W=e[Z];if(W===255)return;for(var te=0,V=P-1;(W!==0||te<D)&&V!==-1;V--,te++)W+=s*F[V]>>>0,F[V]=W%256>>>0,W=W/256>>>0;if(W!==0)throw new Error("Non-zero carry");D=te,$++}for(var Y=P-D;Y!==P&&F[Y]===0;)Y++;var he=Sn.allocUnsafe(N+(P-Y));he.fill(0,0,N);for(var q=N;Y!==P;)he[q++]=F[Y++];return he}function z(O){var $=M(O);if($)return $;throw new Error("Non-base"+s+" character")}return{encode:x,decodeUnsafe:M,decode:z}}var sp=op,ap=sp,up="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Na=ap(up);const _t=Hs(Na);var ft={};function er(t,e,r){return e<=t&&t<=r}function si(t){if(t===void 0)return{};if(t===Object(t))return t;throw TypeError("Could not convert argument to dictionary")}function cp(t){for(var e=String(t),r=e.length,n=0,i=[];n<r;){var o=e.charCodeAt(n);if(o<55296||o>57343)i.push(o);else if(56320<=o&&o<=57343)i.push(65533);else if(55296<=o&&o<=56319)if(n===r-1)i.push(65533);else{var s=t.charCodeAt(n+1);if(56320<=s&&s<=57343){var l=o&1023,d=s&1023;i.push(65536+(l<<10)+d),n+=1}else i.push(65533)}n+=1}return i}function fp(t){for(var e="",r=0;r<t.length;++r){var n=t[r];n<=65535?e+=String.fromCharCode(n):(n-=65536,e+=String.fromCharCode((n>>10)+55296,(n&1023)+56320))}return e}var Tn=-1;function Io(t){this.tokens=[].slice.call(t)}Io.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():Tn},prepend:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(t)},push:function(t){if(Array.isArray(t))for(var e=t;e.length;)this.tokens.push(e.shift());else this.tokens.push(t)}};var Cr=-1;function Li(t,e){if(t)throw TypeError("Decoder error");return e||65533}var Pn="utf-8";function Un(t,e){if(!(this instanceof Un))return new Un(t,e);if(t=t!==void 0?String(t).toLowerCase():Pn,t!==Pn)throw new Error("Encoding not supported. Only utf-8 is supported");e=si(e),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!e.fatal,this._ignoreBOM=!!e.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}Un.prototype={decode:function(e,r){var n;typeof e=="object"&&e instanceof ArrayBuffer?n=new Uint8Array(e):typeof e=="object"&&"buffer"in e&&e.buffer instanceof ArrayBuffer?n=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):n=new Uint8Array(0),r=si(r),this._streaming||(this._decoder=new lp({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var i=new Io(n),o=[],s;!i.endOfStream()&&(s=this._decoder.handler(i,i.read()),s!==Cr);)s!==null&&(Array.isArray(s)?o.push.apply(o,s):o.push(s));if(!this._streaming){do{if(s=this._decoder.handler(i,i.read()),s===Cr)break;s!==null&&(Array.isArray(s)?o.push.apply(o,s):o.push(s))}while(!i.endOfStream());this._decoder=null}return o.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(o[0]===65279?(this._BOMseen=!0,o.shift()):this._BOMseen=!0),fp(o)}};function $n(t,e){if(!(this instanceof $n))return new $n(t,e);if(t=t!==void 0?String(t).toLowerCase():Pn,t!==Pn)throw new Error("Encoding not supported. Only utf-8 is supported");e=si(e),this._streaming=!1,this._encoder=null,this._options={fatal:!!e.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}$n.prototype={encode:function(e,r){e=e?String(e):"",r=si(r),this._streaming||(this._encoder=new hp(this._options)),this._streaming=!!r.stream;for(var n=[],i=new Io(cp(e)),o;!i.endOfStream()&&(o=this._encoder.handler(i,i.read()),o!==Cr);)Array.isArray(o)?n.push.apply(n,o):n.push(o);if(!this._streaming){for(;o=this._encoder.handler(i,i.read()),o!==Cr;)Array.isArray(o)?n.push.apply(n,o):n.push(o);this._encoder=null}return new Uint8Array(n)}};function lp(t){var e=t.fatal,r=0,n=0,i=0,o=128,s=191;this.handler=function(l,d){if(d===Tn&&i!==0)return i=0,Li(e);if(d===Tn)return Cr;if(i===0){if(er(d,0,127))return d;if(er(d,194,223))i=1,r=d-192;else if(er(d,224,239))d===224&&(o=160),d===237&&(s=159),i=2,r=d-224;else if(er(d,240,244))d===240&&(o=144),d===244&&(s=143),i=3,r=d-240;else return Li(e);return r=r<<6*i,null}if(!er(d,o,s))return r=i=n=0,o=128,s=191,l.prepend(d),Li(e);if(o=128,s=191,n+=1,r+=d-128<<6*(i-n),n!==i)return null;var E=r;return r=i=n=0,E}}function hp(t){t.fatal,this.handler=function(e,r){if(r===Tn)return Cr;if(er(r,0,127))return r;var n,i;er(r,128,2047)?(n=1,i=192):er(r,2048,65535)?(n=2,i=224):er(r,65536,1114111)&&(n=3,i=240);for(var o=[(r>>6*n)+i];n>0;){var s=r>>6*(n-1);o.push(128|s&63),n-=1}return o}}const dp=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:Un,TextEncoder:$n},Symbol.toStringTag,{value:"Module"})),pp=lo(dp);var mp=jt&&jt.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),gp=jt&&jt.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),Gt=jt&&jt.__decorate||function(t,e,r,n){var i=arguments.length,o=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(t,e,r,n);else for(var l=t.length-1;l>=0;l--)(s=t[l])&&(o=(i<3?s(o):i>3?s(e,r,o):s(e,r))||o);return i>3&&o&&Object.defineProperty(e,r,o),o},yp=jt&&jt.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&mp(e,t,r);return gp(e,t),e},Fa=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ft,"__esModule",{value:!0});var La=ft.deserializeUnchecked=qa=ft.deserialize=Va=ft.serialize=ft.BinaryReader=ft.BinaryWriter=ft.BorshError=ft.baseDecode=ft.baseEncode=void 0;const ar=Fa(Ca),Da=Fa(Na),wp=yp(pp),vp=typeof TextDecoder!="function"?wp.TextDecoder:TextDecoder,bp=new vp("utf-8",{fatal:!0});function _p(t){return typeof t=="string"&&(t=Buffer.from(t,"utf8")),Da.default.encode(Buffer.from(t))}ft.baseEncode=_p;function Ep(t){return Buffer.from(Da.default.decode(t))}ft.baseDecode=Ep;const Di=1024;class Et extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}ft.BorshError=Et;class Za{constructor(){this.buf=Buffer.alloc(Di),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(Di)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(Buffer.from(new ar.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(Buffer.from(new ar.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(Buffer.from(new ar.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(Buffer.from(new ar.default(e).toArray("le",64)))}writeBuffer(e){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),e,Buffer.alloc(Di)]),this.length+=e.length}writeString(e){this.maybeResize();const r=Buffer.from(e,"utf8");this.writeU32(r.length),this.writeBuffer(r)}writeFixedArray(e){this.writeBuffer(Buffer.from(e))}writeArray(e,r){this.maybeResize(),this.writeU32(e.length);for(const n of e)this.maybeResize(),r(n)}toArray(){return this.buf.subarray(0,this.length)}}ft.BinaryWriter=Za;function Yt(t,e,r){const n=r.value;r.value=function(...i){try{return n.apply(this,i)}catch(o){if(o instanceof RangeError){const s=o.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(s)>=0)throw new Et("Reached the end of buffer when deserializing")}throw o}}}class Pt{constructor(e){this.buf=e,this.offset=0}readU8(){const e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){const e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){const e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){const e=this.readBuffer(8);return new ar.default(e,"le")}readU128(){const e=this.readBuffer(16);return new ar.default(e,"le")}readU256(){const e=this.readBuffer(32);return new ar.default(e,"le")}readU512(){const e=this.readBuffer(64);return new ar.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new Et(`Expected buffer length ${e} isn't within bounds`);const r=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,r}readString(){const e=this.readU32(),r=this.readBuffer(e);try{return bp.decode(r)}catch(n){throw new Et(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){const r=this.readU32(),n=Array();for(let i=0;i<r;++i)n.push(e());return n}}Gt([Yt],Pt.prototype,"readU8",null);Gt([Yt],Pt.prototype,"readU16",null);Gt([Yt],Pt.prototype,"readU32",null);Gt([Yt],Pt.prototype,"readU64",null);Gt([Yt],Pt.prototype,"readU128",null);Gt([Yt],Pt.prototype,"readU256",null);Gt([Yt],Pt.prototype,"readU512",null);Gt([Yt],Pt.prototype,"readString",null);Gt([Yt],Pt.prototype,"readFixedArray",null);Gt([Yt],Pt.prototype,"readArray",null);ft.BinaryReader=Pt;function ja(t){return t.charAt(0).toUpperCase()+t.slice(1)}function dr(t,e,r,n,i){try{if(typeof n=="string")i[`write${ja(n)}`](r);else if(n instanceof Array)if(typeof n[0]=="number"){if(r.length!==n[0])throw new Et(`Expecting byte array of length ${n[0]}, but got ${r.length} bytes`);i.writeFixedArray(r)}else if(n.length===2&&typeof n[1]=="number"){if(r.length!==n[1])throw new Et(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let o=0;o<n[1];o++)dr(t,null,r[o],n[0],i)}else i.writeArray(r,o=>{dr(t,e,o,n[0],i)});else if(n.kind!==void 0)switch(n.kind){case"option":{r==null?i.writeU8(0):(i.writeU8(1),dr(t,e,r,n.type,i));break}case"map":{i.writeU32(r.size),r.forEach((o,s)=>{dr(t,e,s,n.key,i),dr(t,e,o,n.value,i)});break}default:throw new Et(`FieldType ${n} unrecognized`)}else Ka(t,r,i)}catch(o){throw o instanceof Et&&o.addToFieldPath(e),o}}function Ka(t,e,r){if(typeof e.borshSerialize=="function"){e.borshSerialize(r);return}const n=t.get(e.constructor);if(!n)throw new Et(`Class ${e.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([i,o])=>{dr(t,i,e[i],o,r)});else if(n.kind==="enum"){const i=e[n.field];for(let o=0;o<n.values.length;++o){const[s,l]=n.values[o];if(s===i){r.writeU8(o),dr(t,s,e[s],l,r);break}}}else throw new Et(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}function xp(t,e,r=Za){const n=new r;return Ka(t,e,n),n.toArray()}var Va=ft.serialize=xp;function pr(t,e,r,n){try{if(typeof r=="string")return n[`read${ja(r)}`]();if(r instanceof Array){if(typeof r[0]=="number")return n.readFixedArray(r[0]);if(typeof r[1]=="number"){const i=[];for(let o=0;o<r[1];
69o++)i.push(pr(t,null,r[0],n));return i}else return n.readArray(()=>pr(t,e,r[0],n))}if(r.kind==="option")return n.readU8()?pr(t,e,r.type,n):void 0;if(r.kind==="map"){let i=new Map;const o=n.readU32();for(let s=0;s<o;s++){const l=pr(t,e,r.key,n),d=pr(t,e,r.value,n);i.set(l,d)}return i}return ko(t,r,n)}catch(i){throw i instanceof Et&&i.addToFieldPath(e),i}}function ko(t,e,r){if(typeof e.borshDeserialize=="function")return e.borshDeserialize(r);const n=t.get(e);if(!n)throw new Et(`Class ${e.name} is missing in schema`);if(n.kind==="struct"){const i={};for(const[o,s]of t.get(e).fields)i[o]=pr(t,o,s,r);return new e(i)}if(n.kind==="enum"){const i=r.readU8();if(i>=n.values.length)throw new Et(`Enum index: ${i} is out of range`);const[o,s]=n.values[i],l=pr(t,o,s,r);return new e({[o]:l})}throw new Et(`Unexpected schema kind: ${n.kind} for ${e.constructor.name}`)}function Sp(t,e,r,n=Pt){const i=new n(r),o=ko(t,e,i);if(i.offset<r.length)throw new Et(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return o}var qa=ft.deserialize=Sp;function Ip(t,e,r,n=Pt){const i=new n(r);return ko(t,e,i)}La=ft.deserializeUnchecked=Ip;var R={};Object.defineProperty(R,"__esModule",{value:!0});R.s16=R.s8=R.nu64be=R.u48be=R.u40be=R.u32be=R.u24be=R.u16be=ct=R.nu64=R.u48=R.u40=ee=R.u32=R.u24=Ct=R.u16=ye=R.u8=gr=R.offset=R.greedy=R.Constant=R.UTF8=R.CString=R.Blob=R.Boolean=R.BitField=R.BitStructure=R.VariantLayout=R.Union=R.UnionLayoutDiscriminator=R.UnionDiscriminator=R.Structure=R.Sequence=R.DoubleBE=R.Double=R.FloatBE=R.Float=R.NearInt64BE=R.NearInt64=R.NearUInt64BE=R.NearUInt64=R.IntBE=R.Int=R.UIntBE=R.UInt=R.OffsetLayout=R.GreedyCount=R.ExternalLayout=R.bindConstructorLayout=R.nameWithProperty=R.Layout=R.uint8ArrayToBuffer=R.checkUint8Array=void 0;R.constant=R.utf8=R.cstr=Ie=R.blob=R.unionLayoutDiscriminator=R.union=xt=R.seq=R.bits=J=R.struct=R.f64be=R.f64=R.f32be=R.f32=R.ns64be=R.s48be=R.s40be=R.s32be=R.s24be=R.s16be=Ot=R.ns64=R.s48=R.s40=R.s32=R.s24=void 0;const Ao=le;function jr(t){if(!(t instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}R.checkUint8Array=jr;function ge(t){return jr(t),Ao.Buffer.from(t.buffer,t.byteOffset,t.length)}R.uint8ArrayToBuffer=ge;class ve{constructor(e,r){if(!Number.isInteger(e))throw new TypeError("span must be an integer");this.span=e,this.property=r}makeDestinationObject(){return{}}getSpan(e,r){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(e){const r=Object.create(this.constructor.prototype);return Object.assign(r,this),r.property=e,r}fromArray(e){}}R.Layout=ve;function Mo(t,e){return e.property?t+"["+e.property+"]":t}R.nameWithProperty=Mo;function kp(t,e){if(typeof t!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(t,"layout_"))throw new Error("Class is already bound to a layout");if(!(e&&e instanceof ve))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(e,"boundConstructor_"))throw new Error("layout is already bound to a constructor");t.layout_=e,e.boundConstructor_=t,e.makeDestinationObject=()=>new t,Object.defineProperty(t.prototype,"encode",{value(r,n){return e.encode(this,r,n)},writable:!0}),Object.defineProperty(t,"decode",{value(r,n){return e.decode(r,n)},writable:!0})}R.bindConstructorLayout=kp;class At extends ve{isCount(){throw new Error("ExternalLayout is abstract")}}R.ExternalLayout=At;class Wa extends At{constructor(e=1,r){if(!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");super(-1,r),this.elementSpan=e}isCount(){return!0}decode(e,r=0){jr(e);const n=e.length-r;return Math.floor(n/this.elementSpan)}encode(e,r,n){return 0}}R.GreedyCount=Wa;class Bo extends At{constructor(e,r=0,n){if(!(e instanceof ve))throw new TypeError("layout must be a Layout");if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");super(e.span,n||e.property),this.layout=e,this.offset=r}isCount(){return this.layout instanceof Nt||this.layout instanceof Zt}decode(e,r=0){return this.layout.decode(e,r+this.offset)}encode(e,r,n=0){return this.layout.encode(e,r,n+this.offset)}}R.OffsetLayout=Bo;class Nt extends ve{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return ge(e).readUIntLE(r,this.span)}encode(e,r,n=0){return ge(r).writeUIntLE(e,n,this.span),this.span}}R.UInt=Nt;class Zt extends ve{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return ge(e).readUIntBE(r,this.span)}encode(e,r,n=0){return ge(r).writeUIntBE(e,n,this.span),this.span}}R.UIntBE=Zt;class br extends ve{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return ge(e).readIntLE(r,this.span)}encode(e,r,n=0){return ge(r).writeIntLE(e,n,this.span),this.span}}R.Int=br;class Kr extends ve{constructor(e,r){if(super(e,r),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(e,r=0){return ge(e).readIntBE(r,this.span)}encode(e,r,n=0){return ge(r).writeIntBE(e,n,this.span),this.span}}R.IntBE=Kr;const eo=Math.pow(2,32);function ai(t){const e=Math.floor(t/eo),r=t-e*eo;return{hi32:e,lo32:r}}function ui(t,e){return t*eo+e}class Ja extends ve{constructor(e){super(8,e)}decode(e,r=0){const n=ge(e),i=n.readUInt32LE(r),o=n.readUInt32LE(r+4);return ui(o,i)}encode(e,r,n=0){const i=ai(e),o=ge(r);return o.writeUInt32LE(i.lo32,n),o.writeUInt32LE(i.hi32,n+4),8}}R.NearUInt64=Ja;class Ga extends ve{constructor(e){super(8,e)}decode(e,r=0){const n=ge(e),i=n.readUInt32BE(r),o=n.readUInt32BE(r+4);return ui(i,o)}encode(e,r,n=0){const i=ai(e),o=ge(r);return o.writeUInt32BE(i.hi32,n),o.writeUInt32BE(i.lo32,n+4),8}}R.NearUInt64BE=Ga;class Ya extends ve{constructor(e){super(8,e)}decode(e,r=0){const n=ge(e),i=n.readUInt32LE(r),o=n.readInt32LE(r+4);return ui(o,i)}encode(e,r,n=0){const i=ai(e),o=ge(r);return o.writeUInt32LE(i.lo32,n),o.writeInt32LE(i.hi32,n+4),8}}R.NearInt64=Ya;class Ha extends ve{constructor(e){super(8,e)}decode(e,r=0){const n=ge(e),i=n.readInt32BE(r),o=n.readUInt32BE(r+4);return ui(i,o)}encode(e,r,n=0){const i=ai(e),o=ge(r);return o.writeInt32BE(i.hi32,n),o.writeUInt32BE(i.lo32,n+4),8}}R.NearInt64BE=Ha;class Xa extends ve{constructor(e){super(4,e)}decode(e,r=0){return ge(e).readFloatLE(r)}encode(e,r,n=0){return ge(r).writeFloatLE(e,n),4}}R.Float=Xa;class Qa extends ve{constructor(e){super(4,e)}decode(e,r=0){return ge(e).readFloatBE(r)}encode(e,r,n=0){return ge(r).writeFloatBE(e,n),4}}R.FloatBE=Qa;class eu extends ve{constructor(e){super(8,e)}decode(e,r=0){return ge(e).readDoubleLE(r)}encode(e,r,n=0){return ge(r).writeDoubleLE(e,n),8}}R.Double=eu;class tu extends ve{constructor(e){super(8,e)}decode(e,r=0){return ge(e).readDoubleBE(r)}encode(e,r,n=0){return ge(r).writeDoubleBE(e,n),8}}R.DoubleBE=tu;class ru extends ve{constructor(e,r,n){if(!(e instanceof ve))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof At&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;!(r instanceof At)&&0<e.span&&(i=r*e.span),super(i,n),this.elementLayout=e,this.count=r}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0,i=this.count;if(i instanceof At&&(i=i.decode(e,r)),0<this.elementLayout.span)n=i*this.elementLayout.span;else{let o=0;for(;o<i;)n+=this.elementLayout.getSpan(e,r+n),++o}return n}decode(e,r=0){const n=[];let i=0,o=this.count;for(o instanceof At&&(o=o.decode(e,r));i<o;)n.push(this.elementLayout.decode(e,r)),r+=this.elementLayout.getSpan(e,r),i+=1;return n}encode(e,r,n=0){const i=this.elementLayout,o=e.reduce((s,l)=>s+i.encode(l,r,n+s),0);return this.count instanceof At&&this.count.encode(e.length,r,n),o}}R.Sequence=ru;class nu extends ve{constructor(e,r,n){if(!(Array.isArray(e)&&e.reduce((o,s)=>o&&s instanceof ve,!0)))throw new TypeError("fields must be array of Layout instances");typeof r=="boolean"&&n===void 0&&(n=r,r=void 0);for(const o of e)if(0>o.span&&o.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((o,s)=>
vendor: 28,642 bytes, line 69
69o+s.getSpan(),0)}catch{}super(i,r),this.fields=e,this.decodePrefixes=!!n}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((i,o)=>{const s=o.getSpan(e,r);return r+=s,i+s},0)}catch{throw new RangeError("indeterminate span")}return n}decode(e,r=0){jr(e);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(e,r)),r+=i.getSpan(e,r),this.decodePrefixes&&e.length===r)break;return n}encode(e,r,n=0){const i=n;let o=0,s=0;for(const l of this.fields){let d=l.span;if(s=0<d?d:0,l.property!==void 0){const E=e[l.property];E!==void 0&&(s=l.encode(E,r,n),0>d&&(d=l.getSpan(r,n)))}o=n,n+=d}return o+s-i}fromArray(e){const r=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0<e.length&&(r[n.property]=e.shift());return r}layoutFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(const r of this.fields)if(r.property===e)return r}offsetOf(e){if(typeof e!="string")throw new TypeError("property must be string");let r=0;for(const n of this.fields){if(n.property===e)return r;0>n.span?r=-1:0<=r&&(r+=n.span)}}}R.Structure=nu;class Oo{constructor(e){this.property=e}decode(e,r){throw new Error("UnionDiscriminator is abstract")}encode(e,r,n){throw new Error("UnionDiscriminator is abstract")}}R.UnionDiscriminator=Oo;class Cn extends Oo{constructor(e,r){if(!(e instanceof At&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(r||e.property||"variant"),this.layout=e}decode(e,r){return this.layout.decode(e,r)}encode(e,r,n){return this.layout.encode(e,r,n)}}R.UnionLayoutDiscriminator=Cn;class Ro extends ve{constructor(e,r,n){let i;if(e instanceof Nt||e instanceof Zt)i=new Cn(new Bo(e));else if(e instanceof At&&e.isCount())i=new Cn(e);else if(e instanceof Oo)i=e;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(r===void 0&&(r=null),!(r===null||r instanceof ve))throw new TypeError("defaultLayout must be null or a Layout");if(r!==null){if(0>r.span)throw new Error("defaultLayout must have constant span");r.property===void 0&&(r=r.replicate("content"))}let o=-1;r&&(o=r.span,0<=o&&(e instanceof Nt||e instanceof Zt)&&(o+=i.layout.span)),super(o,n),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof Nt||e instanceof Zt,this.defaultLayout=r,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return s(l)},this.configGetSourceVariant=function(l){s=l.bind(this)}}getSpan(e,r=0){if(0<=this.span)return this.span;const n=this.getVariant(e,r);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,r)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;const r=this.registry[e[this.discriminator.property]];if(r&&(!r.layout||r.property&&Object.prototype.hasOwnProperty.call(e,r.property)))return r}else for(const r in this.registry){const n=this.registry[r];if(n.property&&Object.prototype.hasOwnProperty.call(e,n.property))return n}throw new Error("unable to infer src variant")}decode(e,r=0){let n;const i=this.discriminator,o=i.decode(e,r),s=this.registry[o];if(s===void 0){const l=this.defaultLayout;let d=0;this.usesPrefixDiscriminator&&(d=i.layout.span),n=this.makeDestinationObject(),n[i.property]=o,n[l.property]=l.decode(e,r+d)}else n=s.decode(e,r);return n}encode(e,r,n=0){const i=this.getSourceVariant(e);if(i===void 0){const o=this.discriminator,s=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=o.layout.span),o.encode(e[o.property],r,n),l+s.encode(e[s.property],r,n+l)}return i.encode(e,r,n)}addVariant(e,r,n){const i=new iu(this,e,r,n);return this.registry[e]=i,i}getVariant(e,r=0){let n;return e instanceof Uint8Array?n=this.discriminator.decode(e,r):n=e,this.registry[n]}}R.Union=Ro;class iu extends ve{constructor(e,r,n,i){if(!(e instanceof Ro))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof ve))throw new TypeError("layout must be a Layout");if(e.defaultLayout!==null&&0<=n.span&&n.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let o=e.span;0>e.span&&(o=n?n.span:0,0<=o&&e.usesPrefixDiscriminator&&(o+=e.discriminator.layout.span)),super(o,i),this.union=e,this.variant=r,this.layout=n||null}getSpan(e,r=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(e,r+n)),n+i}decode(e,r=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(e,r))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,r+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(e,r,n=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,r,n);let o=i;if(this.layout&&(this.layout.encode(e[this.property],r,n+i),o+=this.layout.getSpan(r,n+i),0<=this.union.span&&o>this.union.span))throw new Error("encoded variant overruns containing union");return o}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}R.VariantLayout=iu;function Br(t){return 0>t&&(t+=4294967296),t}class zo extends ve{constructor(e,r,n){if(!(e instanceof Nt||e instanceof Zt))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof r=="string"&&n===void 0&&(n=r,r=!1),4<e.span)throw new RangeError("word cannot exceed 32 bits");super(e.span,n),this.word=e,this.msb=!!r,this.fields=[];let i=0;this._packedSetValue=function(o){return i=Br(o),this},this._packedGetValue=function(){return i}}decode(e,r=0){const n=this.makeDestinationObject(),i=this.word.decode(e,r);this._packedSetValue(i);for(const o of this.fields)o.property!==void 0&&(n[o.property]=o.decode(e));return n}encode(e,r,n=0){const i=this.word.decode(r,n);this._packedSetValue(i);for(const o of this.fields)if(o.property!==void 0){const s=e[o.property];s!==void 0&&o.encode(s)}return this.word.encode(this._packedGetValue(),r,n)}addField(e,r){const n=new To(this,e,r);return this.fields.push(n),n}addBoolean(e){const r=new ou(this,e);return this.fields.push(r),r}fieldFor(e){if(typeof e!="string")throw new TypeError("property must be string");for(const r of this.fields)if(r.property===e)return r}}R.BitStructure=zo;class To{constructor(e,r,n){if(!(e instanceof zo))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(r)||0>=r)throw new TypeError("bits must be positive integer");const i=8*e.span,o=e.fields.reduce((s,l)=>s+l.bits,0);if(r+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=e,this.bits=r,this.valueMask=(1<<r)-1,r===32&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-r),this.wordMask=Br(this.valueMask<<this.start),this.property=n}decode(e,r){const n=this.container._packedGetValue();return Br(n&this.wordMask)>>>this.start}encode(e){if(typeof e!="number"||!Number.isInteger(e)||e!==Br(e&this.valueMask))throw new TypeError(Mo("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const r=this.container._packedGetValue(),n=Br(e<<this.start);this.container._packedSetValue(Br(r&~this.wordMask)|n)}}R.BitField=To;let ou=class extends To{constructor(e,r){super(e,1,r)}decode(e,r){return!!super.decode(e,r)}encode(e){typeof e=="boolean"&&(e=+e),super.encode(e)}};R.Boolean=ou;class su extends ve{constructor(e,r){if(!(e instanceof At&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;e instanceof At||(n=e),super(n,r),this.length=e}getSpan(e,r){let n=this.span;return 0>n&&(n=this.length.decode(e,r)),n}decode(e,r=0){let n=this.span;return 0>n&&(n=this.length.decode(e,r)),ge(e).slice(r,r+n)}encode(e,r,n){let i=this.length;if(this.length instanceof At&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw new TypeError(Mo("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(n+i>r.length)throw new RangeError("encoding overruns Uint8Array");const o=ge(e);return ge(r).write(o.toString("hex"),n,i,"hex"),this.length instanceof At&&this.length.encode(i,r,n),i}}R.Blob=su;class au extends ve{constructor(e){super(-1,e)}getSpan(e,r=0){jr(e);let n=r;for(;n<e.length&&e[n]!==0;)n+=1;return 1+n-r}decode(e,r=0){const n=this.getSpan(e,r);return ge(e).slice(r,r+n-1).toString("utf-8")}encode(e,r,n=0){typeof e!="string"&&(e=String(e));const i=Ao.Buffer.from(e,"utf8"),o=i.length;if(n+o>r.length)throw new RangeError("encoding overruns Buffer");const s=ge(r);return i.copy(s,n),s[n+o]=0,o+1}}R.CString=au;class uu extends ve{constructor(e,r){if(typeof e=="string"&&r===void 0&&(r=e,e=void 0),e===void 0)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");super(-1,r),this.maxSpan=e}getSpan(e,r=0){return jr(e),e.length-r}decode(e,r=0){const n=this.getSpan(e,r);if(0<=this.maxSpan&&this.maxSpan<n)throw new RangeError("text length exceeds maxSpan");return ge(e).slice(r,r+n).toString("utf-8")}encode(e,r,n=0){typeof e!="string"&&(e=String(e));const i=Ao.Buffer.from(e,"utf8"),o=i.length;if(0<=this.maxSpan&&this.maxSpan<o)throw new RangeError("text length exceeds maxSpan");if(n+o>r.length)throw new RangeError("encoding overruns Buffer");return i.copy(ge(r),n),o}}R.UTF8=uu;class cu extends ve{constructor(e,r){super(0,r),this.value=e}decode(e,r){return this.value}encode(e,r,n){return 0}}R.Constant=cu;R.greedy=(t,e)=>new Wa(t,e);var gr=R.offset=(t,e,r)=>new Bo(t,e,r),ye=R.u8=t=>new Nt(1,t),Ct=R.u16=t=>new Nt(2,t);R.u24=t=>new Nt(3,t);var ee=R.u32=t=>new Nt(4,t);R.u40=t=>new Nt(5,t);R.u48=t=>new Nt(6,t);var ct=R.nu64=t=>new Ja(t);R.u16be=t=>new Zt(2,t);R.u24be=t=>new Zt(3,t);R.u32be=t=>new Zt(4,t);R.u40be=t=>new Zt(5,t);R.u48be=t=>new Zt(6,t);R.nu64be=t=>new Ga(t);R.s8=t=>new br(1,t);R.s16=t=>new br(2,t);R.s24=t=>new br(3,t);R.s32=t=>new br(4,t);R.s40=t=>new br(5,t);R.s48=t=>new br(6,t);var Ot=R.ns64=t=>new Ya(t);R.s16be=t=>new Kr(2,t);R.s24be=t=>new Kr(3,t);R.s32be=t=>new Kr(4,t);R.s40be=t=>new Kr(5,t);R.s48be=t=>new Kr(6,t);R.ns64be=t=>new Ha(t);R.f32=t=>new Xa(t);R.f32be=t=>new Qa(t);R.f64=t=>new eu(t);R.f64be=t=>new tu(t);var J=R.struct=(t,e,r)=>new nu(t,e,r);R.bits=(t,e,r)=>new zo(t,e,r);var xt=R.seq=(t,e,r)=>new ru(t,e,r);R.union=(t,e,r)=>new Ro(t,e,r);R.unionLayoutDiscriminator=(t,e)=>new Cn(t,e);var Ie=R.blob=(t,e)=>new su(t,e);R.cstr=t=>new au(t);R.utf8=(t,e)=>new uu(t,e);R.constant=(t,e)=>new cu(t,e);var Ap=8078e3,Mp=8078001,Bp=8078004,Op=8078005,Rp=8078006,zp=8078011;function fu(t){return Array.isArray(t)?"%5B"+t.map(fu).join("%2C%20")+"%5D":typeof t=="bigint"?`${t}n`:encodeURIComponent(String(t!=null&&Object.getPrototypeOf(t)===null?{...t}:t))}function Tp([t,e]){return`${t}=${fu(e)}`}function Pp(t){const e=Object.entries(t).map(Tp).join("&");return btoa(e)}function Up(t,e={}){{let r=`Solana error #${t}; Decode this error by running \`npx @solana/errors decode -- ${t}`;return Object.keys(e).length&&(r+=` '${Pp(e)}'`),`${r}\``}}var Pr=class extends Error{constructor(...[e,r]){let n,i;if(r){const{cause:s,...l}=r;s&&(i={cause:s}),Object.keys(l).length>0&&(n=l)}const o=Up(e,n);super(o,i);Dt(this,"cause",this.cause);Dt(this,"context");this.context={__code:e,...n},this.name="SolanaError"}};function $p(t,e){return"fixedSize"in e?e.fixedSize:e.getSizeFromValue(t)}function Cp(t){return Object.freeze({...t,encode:e=>{const r=new Uint8Array($p(e,t));return t.write(e,r,0),r}})}function Np(t){return Object.freeze({...t,decode:(e,r=0)=>t.read(e,r)[0]})}function Ir(t){return"fixedSize"in t&&typeof t.fixedSize=="number"}function Fp(t,e){if(Ir(t)!==Ir(e))throw new Pr(Bp);if(Ir(t)&&Ir(e)&&t.fixedSize!==e.fixedSize)throw new Pr(Op,{decoderFixedSize:e.fixedSize,encoderFixedSize:t.fixedSize});if(!Ir(t)&&!Ir(e)&&t.maxSize!==e.maxSize)throw new Pr(Rp,{decoderMaxSize:e.maxSize,encoderMaxSize:t.maxSize});return{...e,...t,decode:e.decode,encode:t.encode,read:e.read,write:t.write}}function Lp(t,e,r=0){if(e.length-r<=0)throw new Pr(Ap,{codecDescription:t})}function Dp(t,e,r,n=0){const i=r.length-n;if(i<e)throw new Pr(Mp,{bytesLength:i,codecDescription:t,expected:e})}function Zp(t,e,r,n){if(n<e||n>r)throw new Pr(zp,{codecDescription:t,max:r,min:e,value:n})}function lu(t){return(t==null?void 0:t.endian)!==1}function jp(t){return Cp({fixedSize:t.size,write(e,r,n){t.range&&Zp(t.name,t.range[0],t.range[1],e);const i=new ArrayBuffer(t.size);return t.set(new DataView(i),e,lu(t.config)),r.set(new Uint8Array(i),n),n+t.size}})}function Kp(t){return Np({fixedSize:t.size,read(e,r=0){Lp(t.name,e,r),Dp(t.name,t.size,e,r);const n=new DataView(Vp(e,r,t.size));return[t.get(n,lu(t.config)),r+t.size]}})}function Vp(t,e,r){const n=t.byteOffset+(e??0),i=r??t.byteLength;return t.buffer.slice(n,n+i)}var qp=(t={})=>jp({config:t,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,r,n)=>e.setBigUint64(0,BigInt(r),n),size:8}),Wp=(t={})=>Kp({config:t,get:(e,r)=>e.getBigUint64(0,r),name:"u64",size:8}),Jp=(t={})=>Fp(qp(t),Wp(t));class Gp extends TypeError{constructor(e,r){let n;const{message:i,explanation:o,...s}=e,{path:l}=e,d=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(o??d),o!=null&&(this.cause=d),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function Yp(t){return mn(t)&&typeof t[Symbol.iterator]=="function"}function mn(t){return typeof t=="object"&&t!=null}function Nn(t){return mn(t)&&!Array.isArray(t)}function Kt(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Hp(t){const{done:e,value:r}=t.next();return e?void 0:r}function Xp(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:o}=e,{type:s}=r,{refinement:l,message:d=`Expected a value of type \`${s}\`${l?` with refinement \`${l}\``:""}, but received: \`${Kt(n)}\``}=t;return{value:n,type:s,refinement:l,key:i[i.length-1],path:i,branch:o,...t,message:d}}function*Ps(t,e,r,n){Yp(t)||(t=[t]);for(const i of t){const o=Xp(i,e,r,n);o&&(yield o)}}function*Po(t,e,r={}){const{path:n=[],branch:i=[t],coerce:o=!1,mask:s=!1}=r,l={path:n,branch:i,mask:s};o&&(t=e.coercer(t,l));let d="valid";for(const E of e.validator(t,l))E.explanation=r.message,d="not_valid",yield[E,void 0];for(let[E,x,M]of e.entries(t,l)){const z=Po(x,M,{path:E===void 0?n:[...n,E],branch:E===void 0?i:[...i,x],coerce:o,mask:s,message:r.message});for(const O of z)O[0]?(d=O[0].refinement!=null?"not_refined":"not_valid",yield[O[0],void 0]):o&&(x=O[1],E===void 0?t=x:t instanceof Map?t.set(E,x):t instanceof Set?t.add(x):mn(t)&&(x!==void 0||E in t)&&(t[E]=x))}if(d!=="not_valid")for(const E of e.refiner(t,l))E.explanation=r.message,d="not_refined",yield[E,void 0];d==="valid"&&(yield[void 0,t])}let Ht=class{constructor(e){const{type:r,schema:n,validator:i,refiner:o,coercer:s=d=>d,entries:l=function*(){}}=e;this.type=r,this.schema=n,this.entries=l,this.coercer=s,i?this.validator=(d,E)=>{const x=i(d,E);return Ps(x,E,this,d)}:this.validator=()=>[],o?this.refiner=(d,E)=>{const x=o(d,E);return Ps(x,E,this,d)}:this.refiner=()=>[]}assert(e,r){return Qp(e,this,r)}create(e,r){return Qr(e,this,r)}is(e){return hu(e,this)}mask(e,r){return em(e,this,r)}validate(e,r={}){return gn(e,this,r)}};function Qp(t,e,r){const n=gn(t,e,{message:r});if(n[0])throw n[0]}function Qr(t,e,r){const n=gn(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function em(t,e,r){const n=gn(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function hu(t,e){return!gn(t,e)[0]}function gn(t,e,r={}){const n=Po(t,e,r),i=Hp(n);return i[0]?[new Gp(i[0],function*(){for(const s of n)s[0]&&(yield s[0])}),void 0]:[void 0,i[1]]}function _r(t,e){return new Ht({type:t,schema:null,validator:e})}function tm(){return _r("any",()=>!0)}function j(t){return new Ht({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${Kt(e)}`}})}function Jt(){return _r("boolean",t=>typeof t=="boolean")}function Uo(t){return _r("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${Kt(e)}`)}function Re(t){const e=Kt(t),r=typeof t;return new Ht({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${Kt(n)}`}})}function rm(){return _r("never",()=>!1)}function K(t){return new Ht({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function B(){return _r("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${Kt(t)}`)}function Q(t){return new Ht({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function du(t,e){return new Ht({type:"record",schema:null,*entries(r){if(mn(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return Nn(r)||`Expected an object, but received: ${Kt(r)}`},coercer(r){return Nn(r)?{...r}:r}})}function L(){return _r("string",t=>typeof t=="string"||`Expected a string, but received: ${Kt(t)}`)}function $o(t){const e=rm();return new Ht({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${Kt(r)}`},coercer(r){return Array.isArray(r)?r.slice():r}})}function C(t){const e=Object.keys(t);return new Ht({type:"type",schema:t,*entries(r){if(mn(r))for(const n of e)yield[n,r[n],t[n]]},validator(r){return Nn(r)||`Expected an object, but received: ${Kt(r)}`},coercer(r){return Nn(r)?{...r}:r}})}function St(t){const e=t.map(r=>r.type).join(" | ");return new Ht({type:"union",schema:null,coercer(r,n){for(const i of t){const[o,s]=i.validate(r,{coerce:!0,mask:n.mask});if(!o)return s}return r},validator(r,n){const i=[];for(const o of t){const[...s]=Po(r,o,n),[l]=s;if(l[0])for(const[d]of s)d&&i.push(d);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${Kt(r)}`,...i]}})}function Vr(){return _r("unknown",()=>!0)}function yn(t,e,r){return new Ht({...t,coercer:(n,i)=>hu(n,e)?t.coercer(r(n,i),i):t.coercer(n,i)})}var In,nm=new Uint8Array(16);function pu(){if(!In&&(In=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!In))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return In(nm)}const im=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function ci(t){return typeof t=="string"&&im.test(t)}var ut=[];for(var Zi=0;Zi<256;++Zi)ut.push((Zi+256).toString(16).substr(1));function fi(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(ut[t[e+0]]+ut[t[e+1]]+ut[t[e+2]]+ut[t[e+3]]+"-"+ut[t[e+4]]+ut[t[e+5]]+"-"+ut[t[e+6]]+ut[t[e+7]]+"-"+ut[t[e+8]]+ut[t[e+9]]+"-"+ut[t[e+10]]+ut[t[e+11]]+ut[t[e+12]]+ut[t[e+13]]+ut[t[e+14]]+ut[t[e+15]]).toLowerCase();if(!ci(r))throw TypeError("Stringified UUID is invalid");return r}var Us,ji,Ki=0,Vi=0;function om(t,e,r){var n=e&&r||0,i=e||new Array(16);t=t||{};var o=t.node||Us,s=t.clockseq!==void 0?t.clockseq:ji;if(o==null||s==null){var l=t.random||(t.rng||pu)();o==null&&(o=Us=[l[0]|1,l[1],l[2],l[3],l[4],l[5]]),s==null&&(s=ji=(l[6]<<8|l[7])&16383)}var d=t.msecs!==void 0?t.msecs:Date.now(),E=t.nsecs!==void 0?t.nsecs:Vi+1,x=d-Ki+(E-Vi)/1e4;if(x<0&&t.clockseq===void 0&&(s=s+1&16383),(x<0||d>Ki)&&t.nsecs===void 0&&(E=0),E>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Ki=d,Vi=E,ji=s,d+=122192928e5;var M=((d&268435455)*1e4+E)%4294967296;i[n++]=M>>>24&255,i[n++]=M>>>16&255,i[n++]=M>>>8&255,i[n++]=M&255;var z=d/4294967296*1e4&268435455;i[n++]=z>>>8&255,i[n++]=z&255,i[n++]=z>>>24&15|16,i[n++]=z>>>16&255,i[n++]=s>>>8|128,i[n++]=s&255;for(var O=0;O<6;++O)i[n+O]=o[O];return e||fi(i)}function mu(t){if(!ci(t))throw TypeError("Invalid UUID");var e,r=new Uint8Array(16);return r[0]=(e=parseInt(t.slice(0,8),16))>>>24,r[1]=e>>>16&255,r[2]=e>>>8&255,r[3]=e&255,r[4]=(e=parseInt(t.slice(9,13),16))>>>8,r[5]=e&255,r[6]=(e=parseInt(t.slice(14,18),16))>>>8,r[7]=e&255,r[8]=(e=parseInt(t.slice(19,23),16))>>>8,r[9]=e&255,r[10]=(e=parseInt(t.slice(24,36),16))/1099511627776&255,r[11]=e/4294967296&255,r[12]=e>>>24&255,r[13]=e>>>16&255,r[14]=e>>>8&255,r[15]=e&255,r}function sm(t){t=unescape(encodeURIComponent(t));for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e}var am="6ba7b810-9dad-11d1-80b4-00c04fd430c8",um="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function gu(t,e,r){function n(i,o,s,l){if(typeof i=="string"&&(i=sm(i)),typeof o=="string"&&(o=mu(o)),o.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var d=new Uint8Array(16+i.length);if(d.set(o),d.set(i,o.length),d=r(d),d[6]=d[6]&15|e,d[8]=d[8]&63|128,s){l=l||0;for(var E=0;E<16;++E)s[l+E]=d[E];return s}return fi(d)}try{n.name=t}catch{}return n.DNS=am,n.URL=um,n}function cm(t){if(typeof t=="string"){var e=unescape(encodeURIComponent(t));t=new Uint8Array(e.length);for(var r=0;r<e.length;++r)t[r]=e.charCodeAt(r)}return fm(lm(hm(t),t.length*8))}function fm(t){for(var e=[],r=t.length*32,n="0123456789abcdef",i=0;i<r;i+=8){var o=t[i>>5]>>>i%32&255,s=parseInt(n.charAt(o>>>4&15)+n.charAt(o&15),16);e.push(s)}return e}function yu(t){return(t+64>>>9<<4)+14+1}function lm(t,e){t[e>>5]|=128<<e%32,t[yu(e)-1]=e;for(var r=1732584193,n=-271733879,i=-1732584194,o=271733878,s=0;s<t.length;s+=16){var l=r,d=n,E=i,x=o;r=dt(r,n,i,o,t[s],7,-680876936),o=dt(o,r,n,i,t[s+1],12,-389564586),i=dt(i,o,r,n,t[s+2],17,606105819),n=dt(n,i,o,r,t[s+3],22,-1044525330),r=dt(r,n,i,o,t[s+4],7,-176418897),o=dt(o,r,n,i,t[s+5],12,1200080426),i=dt(i,o,r,n,t[s+6],17,-1473231341),n=dt(n,i,o,r,t[s+7],22,-45705983),r=dt(r,n,i,o,t[s+8],7,1770035416),o=dt(o,r,n,i,t[s+9],12,-1958414417),i=dt(i,o,r,n,t[s+10],17,-42063),n=dt(n,i,o,r,t[s+11],22,-1990404162),r=dt(r,n,i,o,t[s+12],7,1804603682),o=dt(o,r,n,i,t[s+13],12,-40341101),i=dt(i,o,r,n,t[s+14],17,-1502002290),n=dt(n,i,o,r,t[s+15],22,1236535329),r=pt(r,n,i,o,t[s+1],5,-165796510),o=pt(o,r,n,i,t[s+6],9,-1069501632),i=pt(i,o,r,n,t[s+11],14,643717713),n=pt(n,i,o,r,t[s],20,-373897302),r=pt(r,n,i,o,t[s+5],5,-701558691),o=pt(o,r,n,i,t[s+10],9,38016083),i=pt(i,o,r,n,t[s+15],14,-660478335),n=pt(n,i,o,r,t[s+4],20,-405537848),r=pt(r,n,i,o,t[s+9],5,568446438),o=pt(o,r,n,i,t[s+14],9,-1019803690),i=pt(i,o,r,n,t[s+3],14,-187363961),n=pt(n,i,o,r,t[s+8],20,1163531501),r=pt(r,n,i,o,t[s+13],5,-1444681467),o=pt(o,r,n,i,t[s+2],9,-51403784),i=pt(i,o,r,n,t[s+7],14,1735328473),n=pt(n,i,o,r,t[s+12],20,-1926607734),r=mt(r,n,i,o,t[s+5],4,-378558),o=mt(o,r,n,i,t[s+8],11,-2022574463),i=mt(i,o,r,n,t[s+11],16,1839030562),n=mt(n,i,o,r,t[s+14],23,-35309556),r=mt(r,n,i,o,t[s+1],4,-1530992060),o=mt(o,r,n,i,t[s+4],11,1272893353),i=mt(i,o,r,n,t[s+7],16,-155497632),n=mt(n,i,o,r,t[s+10],23,-1094730640),r=mt(r,n,i,o,t[s+13],4,681279174),o=mt(o,r,n,i,t[s],11,-358537222),i=mt(i,o,r,n,t[s+3],16,-722521979),n=mt(n,i,o,r,t[s+6],23,76029189),r=mt(r,n,i,o,t[s+9],4,-640364487),o=mt(o,r,n,i,t[s+12],11,-421815835),i=mt(i,o,r,n,t[s+15],16,530742520),n=mt(n,i,o,r,t[s+2],23,-995338651),r=gt(r,n,i,o,t[s],6,-198630844),o=gt(o,r,n,i,t[s+7],10,1126891415),i=gt(i,o,r,n,t[s+14],15,-1416354905),n=gt(n,i,o,r,t[s+5],21,-57434055),r=gt(r,n,i,o,t[s+12],6,1700485571),o=gt(o,r,n,i,t[s+3],10,-1894986606),i=gt(i,o,r,n,t[s+10],15,-1051523),n=gt(n,i,o,r,t[s+1],21,-2054922799),r=gt(r,n,i,o,t[s+8],6,1873313359),o=gt(o,r,n,i,t[s+15],10,-30611744),i=gt(i,o,r,n,t[s+6],15,-1560198380),n=gt(n,i,o,r,t[s+13],21,1309151649),r=gt(r,n,i,o,t[s+4],6,-145523070),o=gt(o,r,n,i,t[s+11],10,-1120210379),i=gt(i,o,r,n,t[s+2],15,718787259),n=gt(n,i,o,r,t[s+9],21,-343485551),r=ur(r,l),n=ur(n,d),i=ur(i,E),o=ur(o,x)}return[r,n,i,o]}function hm(t){if(t.length===0)return[];for(var e=t.length*8,r=new Uint32Array(yu(e)),n=0;n<e;n+=8)r[n>>5]|=(t[n/8]&255)<<n%32;return r}function ur(t,e){var r=(t&65535)+(e&65535),n=(t>>16)+(e>>16)+(r>>16);return n<<16|r&65535}function dm(t,e){return t<<e|t>>>32-e}function li(t,e,r,n,i,o){return ur(dm(ur(ur(e,t),ur(n,o)),i),r)}function dt(t,e,r,n,i,o,s){return li(e&r|~e&n,t,e,i,o,s)}function pt(t,e,r,n,i,o,s){return li(e&n|r&~n,t,e,i,o,s)}function mt(t,e,r,n,i,o,s){return li(e^r^n,t,e,i,o,s)}function gt(t,e,r,n,i,o,s){return li(r^(e|~n),t,e,i,o,s)}var pm=gu("v3",48,cm);function mm(t,e,r){t=t||{};var n=t.random||(t.rng||pu)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){r=r||0;for(var i=0;i<16;++i)e[r+i]=n[i];return e}return fi(n)}function gm(t,e,r,n){switch(t){case 0:return e&r^~e&n;case 1:return e^r^n;case 2:return e&r^e&n^r&n;case 3:return e^r^n}}function qi(t,e){return t<<e|t>>>32-e}function ym(t){var e=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof t=="string"){var n=unescape(encodeURIComponent(t));t=[];for(var i=0;i<n.length;++i)t.push(n.charCodeAt(i))}else Array.isArray(t)||(t=Array.prototype.slice.call(t));t.push(128);for(var o=t.length/4+2,s=Math.ceil(o/16),l=new Array(s),d=0;d<s;++d){for(var E=new Uint32Array(16),x=0;x<16;++x)E[x]=t[d*64+x*4]<<24|t[d*64+x*4+1]<<16|t[d*64+x*4+2]<<8|t[d*64+x*4+3];l[d]=E}l[s-1][14]=(t.length-1)*8/Math.pow(2,32),l[s-1][14]=Math.floor(l[s-1][14]),l[s-1][15]=(t.length-1)*8&4294967295;for(var M=0;M<s;++M){for(var z=new Uint32Array(80),O=0;O<16;++O)z[O]=l[M][O];for(var $=16;$<80;++$)z[$]=qi(z[$-3]^z[$-8]^z[$-14]^z[$-16],1);for(var N=r[0],D=r[1],P=r[2],F=r[3],Z=r[4],W=0;W<80;++W){var te=Math.floor(W/20),V=qi(N,5)+gm(te,D,P,F)+Z+e[te]+z[W]>>>0;Z=F,F=P,P=qi(D,30)>>>0,D=N,N=V}r[0]=r[0]+N>>>0,r[1]=r[1]+D>>>0,r[2]=r[2]+P>>>0,r[3]=r[3]+F>>>0,r[4]=r[4]+Z>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var wm=gu("v5",80,ym);const vm="00000000-0000-0000-0000-000000000000";function bm(t){if(!ci(t))throw TypeError("Invalid UUID");return parseInt(t.substr(14,1),16)}const _m=Object.freeze(Object.defineProperty({__proto__:null,NIL:vm,parse:mu,stringify:fi,v1:om,v3:pm,v4:mm,v5:wm,validate:ci,version:bm},Symbol.toStringTag,{value:"Module"})),wu=lo(_m),Em=wu.v4,xm=function(t,e,r,n){if(typeof t!="string")throw new TypeError(t+" must be a string");n=n||{};const i=typeof n.version=="number"?n.version:2;if(i!==1&&i!==2)throw new TypeError(i+" must be 1 or 2");const o={method:t};if(i===2&&(o.jsonrpc="2.0"),e){if(typeof e!="object"&&!Array.isArray(e))throw new TypeError(e+" must be an object, array or omitted");o.params=e}if(typeof r>"u"){const s=typeof n.generator=="function"?n.generator:function(){return Em()};o.id=s(o,n)}else i===2&&r===null?n.notificationIdNull&&(o.id=null):o.id=r;return o};var Sm=xm;const Im=wu.v4,km=Sm,Fn=function(t,e){if(!(this instanceof Fn))return new Fn(t,e);e||(e={}),this.options={reviver:typeof e.reviver<"u"?e.reviver:null,replacer:typeof e.replacer<"u"?e.replacer:null,generator:typeof e.generator<"u"?e.generator:function(){return Im()},version:typeof e.version<"u"?e.version:2,notificationIdNull:typeof e.notificationIdNull=="boolean"?e.notificationIdNull:!1},this.callServer=t};Fn.prototype.request=function(t,e,r,n){const i=this;let o=null;const s=Array.isArray(t)&&typeof e=="function";if(this.options.version===1&&s)throw new TypeError("JSON-RPC 1.0 does not support batching");if(s||!s&&t&&typeof t=="object"&&typeof e=="function")n=e,o=t;else{typeof r=="function"&&(n=r,r=void 0);const E=typeof n=="function";try{o=km(t,e,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}
69catch(x){if(E)return n(x);throw x}if(!E)return o}let d;try{d=JSON.stringify(o,this.options.replacer)}catch(E){return n(E)}return this.callServer(d,function(E,x){i._parseResponse(E,x,n)}),o};Fn.prototype._parseResponse=function(t,e,r){if(t){r(t);return}if(!e)return r();let n;try{n=JSON.parse(e,this.options.reviver)}catch(i){return r(i)}if(r.length===3)if(Array.isArray(n)){const i=function(s){return typeof s.error<"u"},o=function(s){return!i(s)};return r(null,n.filter(i),n.filter(o))}else return r(null,n.error,n.result);r(null,n)};pn.utils.randomPrivateKey;pn.getPublicKey;function $s(t){try{return pn.ExtendedPoint.fromHex(t),!0}catch{return!1}}const vu=(t,e)=>pn.sign(t,e.slice(0,32)),Am=pn.verify,Co=t=>le.Buffer.isBuffer(t)?t:t instanceof Uint8Array?le.Buffer.from(t.buffer,t.byteOffset,t.byteLength):le.Buffer.from(t);class Mm{constructor(e){Object.assign(this,e)}encode(){return le.Buffer.from(Va(Mn,this))}static decode(e){return qa(Mn,this,e)}static decodeUnchecked(e){return La(Mn,this,e)}}const Mn=new Map;var bu;const Bm=32,fr=32;function Om(t){return t._bn!==void 0}let Cs=1;class ce extends Mm{constructor(e){if(super({}),this._bn=void 0,Om(e))this._bn=e._bn;else{if(typeof e=="string"){const r=_t.decode(e);if(r.length!=fr)throw new Error("Invalid public key input");this._bn=new Ts(r)}else this._bn=new Ts(e);if(this._bn.byteLength()>fr)throw new Error("Invalid public key input")}}static unique(){const e=new ce(Cs);return Cs+=1,new ce(e.toBuffer())}equals(e){return this._bn.eq(e._bn)}toBase58(){return _t.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}toBuffer(){const e=this._bn.toArrayLike(le.Buffer);if(e.length===fr)return e;const r=le.Buffer.alloc(32);return e.copy(r,32-e.length),r}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(e,r,n){const i=le.Buffer.concat([e.toBuffer(),le.Buffer.from(r),n.toBuffer()]),o=rs(i);return new ce(o)}static createProgramAddressSync(e,r){let n=le.Buffer.alloc(0);e.forEach(function(o){if(o.length>Bm)throw new TypeError("Max seed length exceeded");n=le.Buffer.concat([n,Co(o)])}),n=le.Buffer.concat([n,r.toBuffer(),le.Buffer.from("ProgramDerivedAddress")]);const i=rs(n);if($s(i))throw new Error("Invalid seeds, address must fall off the curve");return new ce(i)}static async createProgramAddress(e,r){return this.createProgramAddressSync(e,r)}static findProgramAddressSync(e,r){let n=255,i;for(;n!=0;){try{const o=e.concat(le.Buffer.from([n]));i=this.createProgramAddressSync(o,r)}catch(o){if(o instanceof TypeError)throw o;n--;continue}return[i,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(e,r){return this.findProgramAddressSync(e,r)}static isOnCurve(e){const r=new ce(e);return $s(r.toBytes())}}bu=ce;ce.default=new bu("11111111111111111111111111111111");Mn.set(ce,{kind:"struct",fields:[["_bn","u256"]]});new ce("BPFLoader1111111111111111111111111111111111");const Ur=1232,No=127,Ln=64;class Dn{constructor(e,r){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=e,this.accountKeysFromLookups=r}keySegments(){const e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}get(e){for(const r of this.keySegments()){if(e<r.length)return r[e];e-=r.length}}get length(){return this.keySegments().flat().length}compileInstructions(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const n=new Map;this.keySegments().flat().forEach((o,s)=>{n.set(o.toBase58(),s)});const i=o=>{const s=n.get(o.toBase58());if(s===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return s};return e.map(o=>({programIdIndex:i(o.programId),accountKeyIndexes:o.keys.map(s=>i(s.pubkey)),data:o.data}))}}const de=(t="publicKey")=>Ie(32,t),Rm=(t="signature")=>Ie(64,t),zr=(t="string")=>{const e=J([ee("length"),ee("lengthPadding"),Ie(gr(ee(),-8),"chars")],t),r=e.decode.bind(e),n=e.encode.bind(e),i=e;return i.decode=(o,s)=>r(o,s).chars.toString(),i.encode=(o,s,l)=>{const d={chars:le.Buffer.from(o,"utf8")};return n(d,s,l)},i.alloc=o=>ee().span+ee().span+le.Buffer.from(o,"utf8").length,i},zm=(t="authorized")=>J([de("staker"),de("withdrawer")],t),Tm=(t="lockup")=>J([Ot("unixTimestamp"),Ot("epoch"),de("custodian")],t),Pm=(t="voteInit")=>J([de("nodePubkey"),de("authorizedVoter"),de("authorizedWithdrawer"),ye("commission")],t),Um=(t="voteAuthorizeWithSeedArgs")=>J([ee("voteAuthorizationType"),de("currentAuthorityDerivedKeyOwnerPubkey"),zr("currentAuthorityDerivedKeySeed"),de("newAuthorized")],t);function Rt(t){let e=0,r=0;for(;;){let n=t.shift();if(e|=(n&127)<<r*7,r+=1,!(n&128))break}return e}function zt(t,e){let r=e;for(;;){let n=r&127;if(r>>=7,r==0){t.push(n);break}else n|=128,t.push(n)}}function st(t,e){if(!t)throw new Error(e||"Assertion failed")}class hi{constructor(e,r){this.payer=void 0,this.keyMetaMap=void 0,this.payer=e,this.keyMetaMap=r}static compile(e,r){const n=new Map,i=s=>{const l=s.toBase58();let d=n.get(l);return d===void 0&&(d={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(l,d)),d},o=i(r);o.isSigner=!0,o.isWritable=!0;for(const s of e){i(s.programId).isInvoked=!0;for(const l of s.keys){const d=i(l.pubkey);d.isSigner||(d.isSigner=l.isSigner),d.isWritable||(d.isWritable=l.isWritable)}}return new hi(r,n)}getMessageComponents(){const e=[...this.keyMetaMap.entries()];st(e.length<=256,"Max static account keys length exceeded");const r=e.filter(([,d])=>d.isSigner&&d.isWritable),n=e.filter(([,d])=>d.isSigner&&!d.isWritable),i=e.filter(([,d])=>!d.isSigner&&d.isWritable),o=e.filter(([,d])=>!d.isSigner&&!d.isWritable),s={numRequiredSignatures:r.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:o.length};{st(r.length>0,"Expected at least one writable signer key");const[d]=r[0];st(d===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const l=[...r.map(([d])=>new ce(d)),...n.map(([d])=>new ce(d)),...i.map(([d])=>new ce(d)),...o.map(([d])=>new ce(d))];return[s,l]}extractTableLookup(e){const[r,n]=this.drainKeysFoundInLookupTable(e.state.addresses,s=>!s.isSigner&&!s.isInvoked&&s.isWritable),[i,o]=this.drainKeysFoundInLookupTable(e.state.addresses,s=>!s.isSigner&&!s.isInvoked&&!s.isWritable);if(!(r.length===0&&i.length===0))return[{accountKey:e.key,writableIndexes:r,readonlyIndexes:i},{writable:n,readonly:o}]}drainKeysFoundInLookupTable(e,r){const n=new Array,i=new Array;for(const[o,s]of this.keyMetaMap.entries())if(r(s)){const l=new ce(o),d=e.findIndex(E=>E.equals(l));d>=0&&(st(d<256,"Max lookup table index exceeded"),n.push(d),i.push(l),this.keyMetaMap.delete(o))}return[n,i]}}const _u="Reached end of buffer unexpectedly";function tr(t){if(t.length===0)throw new Error(_u);return t.shift()}function Tt(t,...e){const[r]=e;if(e.length===2?r+(e[1]??0)>t.length:r>=t.length)throw new Error(_u);return t.splice(...e)}class Nr{constructor(e){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=e.header,this.accountKeys=e.accountKeys.map(r=>new ce(r)),this.recentBlockhash=e.recentBlockhash,this.instructions=e.instructions,this.instructions.forEach(r=>this.indexToProgramIds.set(r.programIdIndex,this.accountKeys[r.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:_t.decode(e.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Dn(this.staticAccountKeys)}static compile(e){const r=hi.compile(e.instructions,e.payerKey),[n,i]=r.getMessageComponents(),s=new Dn(i).compileInstructions(e.instructions).map(l
69=>({programIdIndex:l.programIdIndex,accounts:l.accountKeyIndexes,data:_t.encode(l.data)}));return new Nr({header:n,accountKeys:i,recentBlockhash:e.recentBlockhash,instructions:s})}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const r=this.header.numRequiredSignatures;if(e>=this.header.numRequiredSignatures){const n=e-r,o=this.accountKeys.length-r-this.header.numReadonlyUnsignedAccounts;return n<o}else{const n=r-this.header.numReadonlySignedAccounts;return e<n}}isProgramId(e){return this.indexToProgramIds.has(e)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((e,r)=>!this.isProgramId(r))}serialize(){const e=this.accountKeys.length;let r=[];zt(r,e);const n=this.instructions.map(M=>{const{accounts:z,programIdIndex:O}=M,$=Array.from(_t.decode(M.data));let N=[];zt(N,z.length);let D=[];return zt(D,$.length),{programIdIndex:O,keyIndicesCount:le.Buffer.from(N),keyIndices:z,dataLength:le.Buffer.from(D),data:$}});let i=[];zt(i,n.length);let o=le.Buffer.alloc(Ur);le.Buffer.from(i).copy(o);let s=i.length;n.forEach(M=>{const O=J([ye("programIdIndex"),Ie(M.keyIndicesCount.length,"keyIndicesCount"),xt(ye("keyIndex"),M.keyIndices.length,"keyIndices"),Ie(M.dataLength.length,"dataLength"),xt(ye("userdatum"),M.data.length,"data")]).encode(M,o,s);s+=O}),o=o.slice(0,s);const l=J([Ie(1,"numRequiredSignatures"),Ie(1,"numReadonlySignedAccounts"),Ie(1,"numReadonlyUnsignedAccounts"),Ie(r.length,"keyCount"),xt(de("key"),e,"keys"),de("recentBlockhash")]),d={numRequiredSignatures:le.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:le.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:le.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:le.Buffer.from(r),keys:this.accountKeys.map(M=>Co(M.toBytes())),recentBlockhash:_t.decode(this.recentBlockhash)};let E=le.Buffer.alloc(2048);const x=l.encode(d,E);return o.copy(E,x),E.slice(0,x+o.length)}static from(e){let r=[...e];const n=tr(r);if(n!==(n&No))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=tr(r),o=tr(r),s=Rt(r);let l=[];for(let z=0;z<s;z++){const O=Tt(r,0,fr);l.push(new ce(le.Buffer.from(O)))}const d=Tt(r,0,fr),E=Rt(r);let x=[];for(let z=0;z<E;z++){const O=tr(r),$=Rt(r),N=Tt(r,0,$),D=Rt(r),P=Tt(r,0,D),F=_t.encode(le.Buffer.from(P));x.push({programIdIndex:O,accounts:N,data:F})}const M={header:{numRequiredSignatures:n,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:o},recentBlockhash:_t.encode(le.Buffer.from(d)),accountKeys:l,instructions:x};return new Nr(M)}}class Zn{constructor(e){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=e.header,this.staticAccountKeys=e.staticAccountKeys,this.recentBlockhash=e.recentBlockhash,this.compiledInstructions=e.compiledInstructions,this.addressTableLookups=e.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let e=0;for(const r of this.addressTableLookups)e+=r.readonlyIndexes.length+r.writableIndexes.length;return e}getAccountKeys(e){let r;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");r=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)r=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Dn(this.staticAccountKeys,r)}isAccountSigner(e){return e<this.header.numRequiredSignatures}isAccountWritable(e){const r=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;if(e>=n){const i=e-n,o=this.addressTableLookups.reduce((s,l)=>s+l.writableIndexes.length,0);return i<o}else if(e>
69=this.header.numRequiredSignatures){const i=e-r,s=n-r-this.header.numReadonlyUnsignedAccounts;return i<s}else{const i=r-this.header.numReadonlySignedAccounts;return e<i}}resolveAddressTableLookups(e){const r={writable:[],readonly:[]};for(const n of this.addressTableLookups){const i=e.find(o=>o.key.equals(n.accountKey));if(!i)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const o of n.writableIndexes)if(o<i.state.addresses.length)r.writable.push(i.state.addresses[o]);else throw new Error(`Failed to find address for index ${o} in address lookup table ${n.accountKey.toBase58()}`);for(const o of n.readonlyIndexes)if(o<i.state.addresses.length)r.readonly.push(i.state.addresses[o]);else throw new Error(`Failed to find address for index ${o} in address lookup table ${n.accountKey.toBase58()}`)}return r}static compile(e){const r=hi.compile(e.instructions,e.payerKey),n=new Array,i={writable:new Array,readonly:new Array},o=e.addressLookupTableAccounts||[];for(const x of o){const M=r.extractTableLookup(x);if(M!==void 0){const[z,{writable:O,readonly:$}]=M;n.push(z),i.writable.push(...O),i.readonly.push(...$)}}const[s,l]=r.getMessageComponents(),E=new Dn(l,i).compileInstructions(e.instructions);return new Zn({header:s,staticAccountKeys:l,recentBlockhash:e.recentBlockhash,compiledInstructions:E,addressTableLookups:n})}serialize(){const e=Array();zt(e,this.staticAccountKeys.length);const r=this.serializeInstructions(),n=Array();zt(n,this.compiledInstructions.length);const i=this.serializeAddressTableLookups(),o=Array();zt(o,this.addressTableLookups.length);const s=J([ye("prefix"),J([ye("numRequiredSignatures"),ye("numReadonlySignedAccounts"),ye("numReadonlyUnsignedAccounts")],"header"),Ie(e.length,"staticAccountKeysLength"),xt(de(),this.staticAccountKeys.length,"staticAccountKeys"),de("recentBlockhash"),Ie(n.length,"instructionsLength"),Ie(r.length,"serializedInstructions"),Ie(o.length,"addressTableLookupsLength"),Ie(i.length,"serializedAddressTableLookups")]),l=new Uint8Array(Ur),E=s.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map(x=>x.toBytes()),recentBlockhash:_t.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:r,addressTableLookupsLength:new Uint8Array(o),serializedAddressTableLookups:i},l);return l.slice(0,E)}serializeInstructions(){let e=0;const r=new Uint8Array(Ur);for(const n of this.compiledInstructions){const i=Array();zt(i,n.accountKeyIndexes.length);const o=Array();zt(o,n.data.length);const s=J([ye("programIdIndex"),Ie(i.length,"encodedAccountKeyIndexesLength"),xt(ye(),n.accountKeyIndexes.length,"accountKeyIndexes"),Ie(o.length,"encodedDataLength"),Ie(n.data.length,"data")]);e+=s.encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(o),data:n.data},r,e)}return r.slice(0,e)}serializeAddressTableLookups(){let e=0;const r=new Uint8Array(Ur);for(const n of this.addressTableLookups){const i=Array();zt(i,n.writableIndexes.length);const o=Array();zt(o,n.readonlyIndexes.length);const s=J([de("accountKey"),Ie(i.length,"encodedWritableIndexesLength"),xt(ye(),n.writableIndexes.length,"writableIndexes"),Ie(o.length,"encodedReadonlyIndexesLength"),xt(ye(),n.readonlyIndexes.length,"readonlyIndexes")]);e+=s.encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(o),readonlyIndexes:n.readonlyIndexes},r,e)}return r.slice(0,e)}static deserialize(e){let r=[...e];const n=tr(r),i=n&No;st(n!==i,"Expected versioned message but received legacy message");const o=i;st(o===0,`Expected versioned message with version 0 but found version ${o}`);const s={numRequiredSignatures:tr(r),numReadonlySignedAccounts:tr(r),numReadonlyUnsignedAccounts:tr(r)},l=[],d=Rt(r);for(let $=0;$<d;$++)l.push(new ce(Tt(r,0,fr)));const E=_t.encode(Tt(r,0,fr)),x=Rt(r),M=[];for(let $=0;$<x;$++){const N=tr(r),D=Rt(r),P=Tt(r,0,D),F=Rt(r),Z=new Uint8Array(Tt(r,0,F));M.push({programIdIndex:N,accountKeyIndexes:P,data:Z})}const z=Rt(r),O=[];for(let $=0;$<z;$++){const N=new ce(Tt(r,0,fr)),D=Rt(r),P=Tt(r,0,D),F=Rt(r),Z=Tt(r,0,F);O.push({accountKey:N,writableIndexes:P,readonlyIndexes:Z})}return new Zn({header:s,staticAccountKeys:l,recentBlockhash:E,compiledInstructions:M,addressTableLookups:O})}}const Fo={deserializeMessageVersion(t){const e=t[0],r=e&No;return r===e?"legacy":r},deserialize:t=>{const e=Fo.deserializeMessageVersion(t);if(e==="legacy")return Nr.from(t);if(e===0)return Zn.deserialize(t);throw new Error(`Transaction message version ${e} deserialization is not supported`)}},$m=le.Buffer.alloc(Ln).fill(0);class Ns{constructor(e){this.keys=void 0,this.programId=void 0,this.data=le.Buffer.alloc(0),this.programId=e.programId,this.keys=e.keys,e.data&&(this.data=e.data)}toJSON(){return{keys:this.keys.map(({pubkey:e,isSigner:r,isWritable:n})=>({pubkey:e.toJSON(),isSigner:r,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}}class jn{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(e){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!e)if(e.feePayer&&(this.feePayer=e.feePayer),e.signatures&&(this.signatures=e.signatures),Object.prototype.hasOwnProperty.call(e,"nonceInfo")){const{minContextSlot:r,nonceInfo:n}=e;this.minNonceContextSlot=r,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(e,"lastValidBlockHeight")){const{blockhash:r,lastValidBlockHeight:n}=e;this.recentBlockhash=r,this.lastValidBlockHeight=n}else{const{recentBlockhash:r,nonceInfo:n}=e;n&&(this.nonceInfo=n),this.recentBlockhash=r}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstru
vendor: 1,232 bytes, line 69
69ction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(e=>e.toJSON()),signers:this.signatures.map(({publicKey:e})=>e.toJSON())}}add(...e){if(e.length===0)throw new Error("No instructions");return e.forEach(r=>{"instructions"in r?this.instructions=this.instructions.concat(r.instructions):"data"in r&&"programId"in r&&"keys"in r?this.instructions.push(r):this.instructions.push(new Ns(r))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let e,r;if(this.nonceInfo?(e=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?r=[this.nonceInfo.nonceInstruction,...this.instructions]:r=this.instructions):(e=this.recentBlockhash,r=this.instructions),!e)throw new Error("Transaction recentBlockhash required");r.length<1&&console.warn("No instructions provided");let n;if(this.feePayer)n=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)n=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let N=0;N<r.length;N++)if(r[N].programId===void 0)throw new Error(`Transaction instruction index ${N} has undefined program id`);const i=[],o=[];r.forEach(N=>
69{N.keys.forEach(P=>{o.push({...P})});const D=N.programId.toString();i.includes(D)||i.push(D)}),i.forEach(N=>{o.push({pubkey:new ce(N),isSigner:!1,isWritable:!1})});const s=[];o.forEach(N=>{const D=N.pubkey.toString(),P=s.findIndex(F=>F.pubkey.toString()===D);P>-1?(s[P].isWritable=s[P].isWritable||N.isWritable,s[P].isSigner=s[P].isSigner||N.isSigner):s.push(N)}),s.sort(function(N,D){if(N.isSigner!==D.isSigner)return N.isSigner?-1:1;if(N.isWritable!==D.isWritable)return N.isWritable?-1:1;const P={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return N.pubkey.toBase58().localeCompare(D.pubkey.toBase58(),"en",P)});const l=s.findIndex(N=>N.pubkey.equals(n));if(l>-1){const[N]=s.splice(l,1);N.isSigner=!0,N.isWritable=!0,s.unshift(N)}else s.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const N of this.signatures){const D=s.findIndex(P=>P.pubkey.equals(N.publicKey));if(D>-1)s[D].isSigner||(s[D].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${N.publicKey.toString()}`)}let d=0,E=0,x=0;const M=[],z=[];s.forEach(({pubkey:N,isSigner:D,isWritable:P})=>{D?(M.push(N.toString()),d+=1,P||(E+=1)):(z.push(N.toString()),P||(x+=1))});const O=M.concat(z),$=r.map(N=>{const{data:D,programId:P}=N;return{programIdIndex:O.indexOf(P.toString()),accounts:N.keys.map(F=>O.indexOf(F.pubkey.toString())),data:_t.encode(D)}});return $.forEach(N=>{st(N.programIdIndex>=0),N.accounts.forEach(D=>st(D>=0))}),new Nr({header:{numRequiredSignatures:d,numReadonlySignedAccounts:E,numReadonlyUnsignedAccounts:x},accountKeys:O,recentBlockhash:e,instructions:$})}_compile(){const e=this.compileMessage(),r=e.accountKeys.slice(0,e.header.numRequiredSignatures);return this.signatures.length===r.length&&this.signatures.every((i,o)=>r[o].equals(i.publicKey))||(this.signatures=r.map(n=>({signature:null,publicKey:n}))),e}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(e){return(await e.getFeeForMessage(this.compileMessage())).value}setSigners(...e){if(e.length===0)throw new Error("No signers");const r=new Set;this.signatures=e.filter(n=>{const i=n.toString();return r.has(i)?!1:(r.add(i),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...e){if(e.length===0)throw new Error("No signers");const r=new Set,n=[];for(const o of e){const s=o.publicKey.toString();r.has(s)||(r.add(s),n.push(o))}this.signatures=n.map(o=>({signature:null,publicKey:o.publicKey}));const i=this._compile();this._partialSign(i,...n)}partialSign(...e){if(e.length===0)throw new Error("No signers");const r=new Set,n=[];for(const o of e){const s=o.publicKey.toString();r.has(s)||(r.add(s),n.push(o))}const i=this._compile();this._partialSign(i,...n)}_partialSign(e,...r){const n=e.serialize();r.forEach(i=>{const o=vu(n,i.secretKey);this._addSignature(i.publicKey,Co(o))})}addSignature(e,r){this._compile(),this._addSignature(e,r)}_addSignature(e,r){st(r.length===64);const n=this.signatures.findIndex(i=>e.equals(i.publicKey));if(n<0)throw new Error(`unknown signer: ${e.toString()}`);this.signatures[n].signature=le.Buffer.from(r)}verifySignatures(e=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),e)}_getMessageSignednessErrors(e,r){const n={};for(const{signature:i,publicKey:o}of this.signatures)i===null?r&&(n.missing||(n.missing=[])).push(o):Am(i,e,o.toBytes())||(n.invalid||(n.invalid=[])).push(o);return n.invalid||n.missing?n:void 0}serialize(e){const{requireAllSignatures:r,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),i=this.serializeMessage();if(n){const o=this._getMessageSignednessErrors(i,r);if(o){let s="Signature verification failed.";throw o.invalid&&(s+=` 70Invalid signature for public key${o.invalid.length===1?"":"(s)"} [\`${o.invalid.map(l=>l.toBase58()).join("`, `")}\`].`),o.missing&&(s+=` 71Missing signature for public key${o.missing.length===1?"":"(s)"} [\`${o.missing.map(l=>
71l.toBase58()).join("`, `")}\`].`),new Error(s)}}return this._serialize(i)}_serialize(e){const{signatures:r}=this,n=[];zt(n,r.length);const i=n.length+r.length*64+e.length,o=le.Buffer.alloc(i);return st(r.length<256),le.Buffer.from(n).copy(o,0),r.forEach(({signature:s},l)=>{s!==null&&(st(s.length===64,"signature has invalid length"),le.Buffer.from(s).copy(o,n.length+l*64))}),e.copy(o,n.length+r.length*64),st(o.length<=Ur,`Transaction too large: ${o.length} > ${Ur}`),o}get keys(){return st(this.instructions.length===1),this.instructions[0].keys.map(e=>e.pubkey)}get programId(){return st(this.instructions.length===1),this.instructions[0].programId}get data(){return st(this.instructions.length===1),this.instructions[0].data}static from(e){let r=[...e];const n=Rt(r);let i=[];for(let o=0;o<n;o++){const s=Tt(r,0,Ln);i.push(_t.encode(le.Buffer.from(s)))}return jn.populate(Nr.from(r),i)}static populate(e,r=[]){const n=new jn;return n.recentBlockhash=e.recentBlockhash,e.header.numRequiredSignatures>0&&(n.feePayer=e.accountKeys[0]),r.forEach((i,o)=>{const s={signature:i==_t.encode($m)?null:_t.decode(i),publicKey:e.accountKeys[o]};n.signatures.push(s)}),e.instructions.forEach(i=>{const o=i.accounts.map(s=>{const l=e.accountKeys[s];return{pubkey:l,isSigner:n.signatures.some(d=>d.publicKey.toString()===l.toString())||e.isAccountSigner(s),isWritable:e.isAccountWritable(s)}});n.instructions.push(new Ns({keys:o,programId:e.accountKeys[i.programIdIndex],data:_t.decode(i.data)}))}),n._message=e,n._json=n.toJSON(),n}}class Lo{get version(){return this.message.version}constructor(e,r){if(this.signatures=void 0,this.message=void 0,r!==void 0)st(r.length===e.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=r;else{const n=[];for(let i=0;i<e.header.numRequiredSignatures;i++)n.push(new Uint8Array(Ln));this.signatures=n}this.message=e}serialize(){const e=this.message.serialize(),r=Array();zt(r,this.signatures.length);const n=J([Ie(r.length,"encodedSignaturesLength"),xt(Rm(),this.signatures.length,"signatures"),Ie(e.length,"serializedMessage")]),i=new Uint8Array(2048),o=n.encode({encodedSignaturesLength:new Uint8Array(r),signatures:this.signatures,serializedMessage:e},i);return i.slice(0,o)}static deserialize(e){let r=[...e];const n=[],i=Rt(r);for(let s=0;s<i;s++)n.push(new Uint8Array(Tt(r,0,Ln)));const o=Fo.deserialize(new Uint8Array(r));return new Lo(o,n)}sign(e){const r=this.message.serialize(),n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(const i of e){const o=n.findIndex(s=>s.equals(i.publicKey));st(o>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[o]=vu(r,i.secretKey)}}addSignature(e,r){st(r.byteLength===64,"Signature must be 64 bytes long");const i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(o=>o.equals(e));st(i>=0,`Can not add signature; \`${e.toBase58()}\` is not required to sign this transaction`),this.signatures[i]=r}}new ce("SysvarC1ock11111111111111111111111111111111");new ce("SysvarEpochSchedu1e111111111111111111111111");new ce("Sysvar1nstructions1111111111111111111111111");new ce("SysvarRecentB1ockHashes11111111111111111111");new ce("SysvarRent111111111111111111111111111111111");new ce("SysvarRewards111111111111111111111111111111");new ce("SysvarS1otHashes111111111111111111111111111");new ce("SysvarS1otHistory11111111111111111111111111");new ce("SysvarStakeHistory1111111111111111111111111");const Cm=ct("lamportsPerSignature"),Nm=J([ee("version"),ee("state"),de("authorizedPubkey"),de("nonce"),J([Cm],"feeCalculator")]);Nm.span;function Fr(t){const e=Ie(8,t),r=e.decode.bind(e),n=e.encode.bind(e),i=e,o=Jp();return i.decode=(s,l)=>{const d=r(s,l);return o.decode(d)},i.encode=(s,l,d)=>{const E=o.encode(s);return n(E,l,d)},i}Object.freeze({Create:{index:0,layout:J([ee("instruction"),Ot("lamports"),Ot("space"),de("programId")])},Assign:{index:1,layout:J([ee("instruction"),de("programId")])},Transfer:{index:2,layout:J([ee("instruction"),Fr("lamports")])},CreateWithSeed:{index:3,layout:J([ee("instruction"),de("base"),zr("seed"),Ot("lamports"),Ot("space"),de("programId")])},AdvanceNonceAccount:{index:4,layout:J([ee("instruction")])},WithdrawNonceAccount:{index:5,layout:J([ee("instruction"),Ot("lamports")])},InitializeNonceAccount:{index:6,layout:J([ee("instruction"),de("authorized")])},AuthorizeNonceAccount:{index:7,layout:J([ee("instruction"),de("authorized")])},Allocate:{index:8,layout:J([ee("instruction"),Ot("space")])},AllocateWithSeed:{index:9,layout:J([ee("instruction"),de("base"),zr("seed"),Ot("space"),de("programId")])},AssignWithSeed:{index:10,layout:J([ee("instruction"),de("base"),zr("seed"),de("programId")])},TransferWithSeed:{index:11,layout:J([ee("instruction"),Fr("lamports"),zr("seed"),de("programId")])},UpgradeNonceAccount:{index:12,layout:J([ee("instruction")])}});new ce("11111111111111111111111111111111");new ce("BPFLoader2111111111111111111111111111111111");J([ee("typeIndex"),Fr("deactivationSlot"),ct("lastExtendedSlot"),ye("lastExtendedStartIndex"),ye(),xt(de(),gr(ye(),-1),"authority")]);const Fe=yn(Uo(ce),L(),t=>new ce(t)),Eu=$o([L(),Re("base64")]),Do=yn(Uo(le.Buffer),Eu,t=>le.Buffer.from(t[0],"base64"));function xu(t){return St([C({jsonrpc:Re("2.0"),id:L(),result:t}),C({jsonrpc:Re("2.0"),id:L(),error:C({code:Vr(),message:L(),data:Q(tm())})})])}const Fm=xu(Vr());function Ee(t){return yn(xu(t),Fm,e=>"error"in e?e:{...e,result:Qr(e.result,t)})}function Vt(t){return Ee(C({context:C({slot:B()}),value:t}))}function di(t){return C({context:C({slot:B()}),value:t})}const Lm=C({foundation:B(),foundationTerm:B(),initial:B(),taper:B(),terminal:B()});Ee(j(K(C({epoch:B(),effectiveSlot:B(),amount:B(),postBalance:B(),commission:Q(K(B()))}))));const Dm=j(C({slot:B(),prioritizationFee:B()})),Zm=C({total:B(),validator:B(),foundation:B(),epoch:B()}),jm=C({epoch:B(),slotIndex:B(),slotsInEpoch:B(),absoluteSlot:B(),blockHeight:Q(B()),transactionCount:Q(B())}),Km=C({slotsPerEpoch:B(),leaderScheduleSlotOffset:B(),warmup:Jt(),firstNormalEpoch:B(),firstNormalSlot:
71B()}),Vm=du(L(),j(B())),Er=K(St([C({}),L()])),qm=C({err:Er}),Wm=Re("receivedSignature");C({"solana-core":L(),"feature-set":Q(B())});const Jm=C({program:L(),programId:Fe,parsed:Vr()}),Gm=C({programId:Fe,accounts:j(Fe),data:L()});Vt(C({err:K(St([C({}),L()])),logs:K(j(L())),accounts:Q(K(j(K(C({executable:Jt(),owner:L(),lamports:B(),data:j(L()),rentEpoch:Q(B())}))))),unitsConsumed:Q(B()),returnData:Q(K(C({programId:L(),data:$o([L(),Re("base64")])}))),innerInstructions:Q(K(j(C({index:B(),instructions:j(St([Jm,Gm]))}))))}));Vt(C({byIdentity:du(L(),j(B())),range:C({firstSlot:B(),lastSlot:B()})}));Ee(Lm);Ee(Zm);Ee(Dm);Ee(jm);Ee(Km);Ee(Vm);Ee(B());Vt(C({total:B(),circulating:B(),nonCirculating:B(),nonCirculatingAccounts:j(Fe)}));const Ym=C({amount:L(),uiAmount:K(B()),decimals:B(),uiAmountString:Q(L())});Vt(j(C({address:Fe,amount:L(),uiAmount:K(B()),decimals:B(),uiAmountString:Q(L())})));Vt(j(C({pubkey:Fe,account:C({executable:Jt(),owner:Fe,lamports:B(),data:Do,rentEpoch:B()})})));const to=C({program:L(),parsed:Vr(),space:B()});Vt(j(C({pubkey:Fe,account:C({executable:Jt(),owner:Fe,lamports:B(),data:to,rentEpoch:B()})})));Vt(j(C({lamports:B(),address:Fe})));const Zo=C({executable:Jt(),owner:Fe,lamports:B(),data:Do,rentEpoch:B()});C({pubkey:Fe,account:Zo});const Hm=yn(St([Uo(le.Buffer),to]),St([Eu,to]),t=>Array.isArray(t)?Qr(t,Do):t),Xm=C({executable:Jt(),owner:Fe,lamports:B(),data:Hm,rentEpoch:B()});C({pubkey:Fe,account:Xm});C({state:St([Re("active"),Re("inactive"),Re("activating"),Re("deactivating")]),active:B(),inactive:B()});Ee(j(C({signature:L(),slot:B(),err:Er,memo:K(L()),blockTime:Q(K(B()))})));Ee(j(C({signature:L(),slot:B(),err:Er,memo:K(L()),blockTime:Q(K(B()))})));C({subscription:B(),result:di(Zo)});const Qm=C({pubkey:Fe,account:Zo});C({subscription:B(),result:di(Qm)});const eg=C({parent:B(),slot:B(),root:B()});C({subscription:B(),result:eg});const tg=St([C({type:St([Re("firstShredReceived"),Re("completed"),Re("optimisticConfirmation"),Re("root")]),slot:B(),timestamp:B()}),C({type:Re("createdBank"),parent:B(),slot:B(),timestamp:B()}),C({type:Re("frozen"),slot:B(),timestamp:B(),stats:C({numTransactionEntries:B(),numSuccessfulTransactions:B(),numFailedTransactions:B(),maxTransactionsPerEntry:B()})}),C({type:Re("dead"),slot:B(),timestamp:B(),err:L()})]);C({subscription:B(),result:tg});C({subscription:B(),result:di(St([qm,Wm]))});C({subscription:B(),result:B()});C({pubkey:L(),gossip:K(L()),tpu:K(L()),rpc:K(L()),version:K(L())});const Fs=C({votePubkey:L(),nodePubkey:L(),activatedStake:B(),epochVoteAccount:Jt(),epochCredits:j($o([B(),B(),B()])),commission:B(),lastVote:B(),rootSlot:K(B())});Ee(C({current:j(Fs),delinquent:j(Fs)}));const rg=St([Re("processed"),Re("confirmed"),Re("finalized")]),ng=C({slot:B(),confirmations:K(B()),err:Er,confirmationStatus:Q(rg)});Vt(j(K(ng)));Ee(B());const Su=C({accountKey:Fe,writableIndexes:j(B()),readonlyIndexes:j(B())}),jo=C({signatures:j(L()),message:C({accountKeys:j(L()),header:C({numRequiredSignatures:B(),numReadonlySignedAccounts:B(),numReadonlyUnsignedAccounts:B()}),instructions:j(C({accounts:j(B()),data:L(),programIdIndex:B()})),recentBlockhash:L(),addressTableLookups:Q(j(Su))})}),Iu=C({pubkey:Fe,signer:Jt(),writable:Jt(),source:Q(St([Re("transaction"),Re("lookupTable")]))}),ku=C({accountKeys:j(Iu),signatures:j(L())}),Au=C({parsed:Vr(),program:L(),programId:Fe}),Mu=C({accounts:j(Fe),data:L(),programId:Fe}),ig=St([Mu,Au]),og=St([C({parsed:Vr(),program:L(),programId:L()}),C({accounts:j(L()),data:L(),programId:L()})]),Bu=yn(ig,og,t=>"accounts"in t?Qr(t,Mu):Qr(t,Au)),Ou=C({signatures:j(L()),message:C({accountKeys:j(Iu),instructions:j(Bu),recentBlockhash:L(),addressTableLookups:Q(K(j(Su)))})}),Kn=C({accountIndex:B(),mint:L(),owner:Q(L()),programId:Q(L()),uiTokenAmount:Ym}),Ru=C({writable:j(Fe),readonly:j(Fe)}),pi=C({err:Er,fee:B(),innerInstructions:Q(K(j(C({index:B(),instructions:j(C({accounts:j(B()),data:L(),programIdIndex:B()}))})))),preBalances:j(B()),postBalances:j(B()),logMessages:Q(K(j(L()))),preTokenBalances:Q(K(j(Kn))),postTokenBalances:Q(K(j(Kn))),loadedAddresses:Q(Ru),computeUnitsConsumed:Q(B()),costUnits:Q(B())}),Ko=C({err:Er,fee:B(),innerInstructions:Q(K(j(C({index:B(),instructions:j(Bu)})))),preBalances:j(B()),postBalances:j(B()),logMessages:Q(K(j(L()))),preTokenBalances:Q(K(j(Kn))),postTokenBalances:Q(K(j(Kn))),loadedAddresses:Q(Ru),computeUnitsConsumed:Q(B()),costUnits:Q(B())}),qr=St([Re(0),Re("legacy")]),xr=C({pubkey:L(),lamports:B(),postBalance:K(B()),rewardType:K(L()),commission:Q(K(B()))});Ee(K(C({blockhash:L(),previousBlockhash:L(),parentSlot:B(),transactions:j(C({transaction:jo,meta:K(pi),version:Q(qr)})),rewards:Q(j(xr)),blockTime:K(B()),blockHeight:K(B())})));Ee(K(C({blockhash:L(),previousBlockhash:L(),parentSlot:B(),rewards:Q(j(xr)),blockTime:K(B()),blockHeight:K(B())})));Ee(K(C({blockhash:L(),previousBlockhash:L(),parentSlot:B(),transactions:j(C({transaction:ku,meta:K(pi),version:Q(qr)})),rewards:Q(j(xr)),blockTime:K(B()),blockHeight:K(B())})));Ee(K(C({blockhash:L(),previousBlockhash:L(),parentSlot:B(),transactions:j(C({transaction:Ou,meta:K(Ko),version:Q(qr)})),rewards:Q(j(xr)),blockTime:K(B()),blockHeight:K(B())})));Ee(K(C({blockhash:L(),previousBlockhash:L(),parentSlot:B(),transactions:j(C({transaction:ku,meta:K(Ko),version:Q(qr)})),rewards:Q(j(xr)),blockTime:K(B()),blockHeight:K(B())})));Ee(K(C({blockhash:L(),previousBlockhash:L(),parentSlot:B(),rewards:Q(j(xr)),blockTime:K(B()),blockHeight:K(B())})));Ee(K(C({blockhash:L(),previousBlockhash:L(),parentSlot:B(),transactions:j(C({transaction:jo,meta:K(pi)})),rewards:Q(j(xr)),blockTime:K(B())})));Ee(K(C({blockhash:L(),previousBlockhash:L(),parentSlot:B(),signatures:j(L()),blockTime:K(B())})));Ee(K(C({slot:B(),meta:K(pi),blockTime:Q(K(B())),transaction:jo,version:Q(qr)})));Ee(K(C({slot:B(),transaction:Ou,meta:K(Ko),blockTime:Q(K(B())),version:Q(qr)})));
71Vt(C({blockhash:L(),lastValidBlockHeight:B()}));Vt(Jt());const sg=C({slot:B(),numTransactions:B(),numSlots:B(),samplePeriodSecs:B()});Ee(j(sg));Vt(K(C({feeCalculator:C({lamportsPerSignature:B()})})));Ee(L());Ee(L());const ag=C({err:Er,logs:j(L()),signature:L()});C({result:di(ag),subscription:B()});Object.freeze({CreateLookupTable:{index:0,layout:J([ee("instruction"),Fr("recentSlot"),ye("bumpSeed")])},FreezeLookupTable:{index:1,layout:J([ee("instruction")])},ExtendLookupTable:{index:2,layout:J([ee("instruction"),Fr(),xt(de(),gr(ee(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:J([ee("instruction")])},CloseLookupTable:{index:4,layout:J([ee("instruction")])}});new ce("AddressLookupTab1e1111111111111111111111111");Object.freeze({RequestUnits:{index:0,layout:J([ye("instruction"),ee("units"),ee("additionalFee")])},RequestHeapFrame:{index:1,layout:J([ye("instruction"),ee("bytes")])},SetComputeUnitLimit:{index:2,layout:J([ye("instruction"),ee("units")])},SetComputeUnitPrice:{index:3,layout:J([ye("instruction"),Fr("microLamports")])}});new ce("ComputeBudget111111111111111111111111111111");J([ye("numSignatures"),ye("padding"),Ct("signatureOffset"),Ct("signatureInstructionIndex"),Ct("publicKeyOffset"),Ct("publicKeyInstructionIndex"),Ct("messageDataOffset"),Ct("messageDataSize"),Ct("messageInstructionIndex")]);new ce("Ed25519SigVerify111111111111111111111111111");fc.utils.isValidPrivateKey;J([ye("numSignatures"),Ct("signatureOffset"),ye("signatureInstructionIndex"),Ct("ethAddressOffset"),ye("ethAddressInstructionIndex"),Ct("messageDataOffset"),Ct("messageDataSize"),ye("messageInstructionIndex"),Ie(20,"ethAddress"),Ie(64,"signature"),ye("recoveryId")]);new ce("KeccakSecp256k11111111111111111111111111111");var zu;new ce("StakeConfig11111111111111111111111111111111");class Tu{constructor(e,r,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=e,this.epoch=r,this.custodian=n}}zu=Tu;Tu.default=new zu(0,0,ce.default);Object.freeze({Initialize:{index:0,layout:J([ee("instruction"),zm(),Tm()])},Authorize:{index:1,layout:J([ee("instruction"),de("newAuthorized"),ee("stakeAuthorizationType")])},Delegate:{index:2,layout:J([ee("instruction")])},Split:{index:3,layout:J([ee("instruction"),Ot("lamports")])},Withdraw:{index:4,layout:J([ee("instruction"),Ot("lamports")])},Deactivate:{index:5,layout:J([ee("instruction")])},Merge:{index:7,layout:J([ee("instruction")])},AuthorizeWithSeed:{index:8,layout:J([ee("instruction"),de("newAuthorized"),ee("stakeAuthorizationType"),zr("authoritySeed"),de("authorityOwner")])}});new ce("Stake11111111111111111111111111111111111111");Object.freeze({InitializeAccount:{index:0,layout:J([ee("instruction"),Pm()])},Authorize:{index:1,layout:J([ee("instruction"),de("newAuthorized"),ee("voteAuthorizationType")])},Withdraw:{index:3,layout:J([ee("instruction"),Ot("lamports")])},UpdateValidatorIdentity:{index:4,layout:J([ee("instruction")])},AuthorizeWithSeed:{index:10,layout:J([ee("instruction"),Um()])}});new ce("Vote111111111111111111111111111111111111111");new ce("Va1idator1nfo111111111111111111111111111111");C({name:L(),website:Q(L()),details:Q(L()),iconUrl:Q(L()),keybaseUsername:Q(L())});new ce("Vote111111111111111111111111111111111111111");J([de("nodePubkey"),de("authorizedWithdrawer"),ye("commission"),ct(),xt(J([ct("slot"),ee("confirmationCount")]),gr(ee(),-8),"votes"),ye("rootSlotValid"),ct("rootSlot"),ct(),xt(J([ct("epoch"),de("authorizedVoter")]),gr(ee(),-8),"authorizedVoters"),J([xt(J([de("authorizedPubkey"),ct("epochOfLastAuthorizedSwitch"),ct("targetEpoch")]),32,"buf"),ct("idx"),ye("isEmpty")],"priorVoters"),ct(),xt(J([ct("epoch"),ct("credits"),ct("prevCredits")]),gr(ee(),-8),"epochCredits"),J([ct("slot"),ct("timestamp")],"lastTimestamp")]);const ug=t=>({request:t,signMessage:e=>t({method:"signMessage",params:{message:e}}),signTransaction:e=>t({method:"signTransaction",params:{transaction:e}}),signAndSendTransaction:e=>t({method:"signAndSendTransaction",params:e})});function Ls(t){return Buffer.from(t.serialize({verifySignatures:!1})).toString("base64")}function cg(t){const e=Buffer.from(t,"base64");return Fo.deserializeMessageVersion(e)==="legacy"?Lo.deserialize(e):jn.from(e)}function fg(t){return async r=>{if(r.method==="connect")return await t(r);if(r.method==="signMessage")return await t(r);if(r.method==="signAndSendTransaction"){const{transaction:n}=r.params,i={transaction:Ls(n)};return await t({method:"signAndSendTransaction",params:i})}if(r.method==="signTransaction"){const{transaction:n}=r.params,i={transaction:Ls(n)},{signedTransaction:o}=await t({method:"signTransaction",params:i});return{signedTransaction:cg(o)}}}}const lg=({miniAppHost:t,emitter:e})=>{let r,n=null;return{visible:!1,get onback(){return n},set onback(i){n&&e.removeListener("backNavigationTriggered",n),n=i,i&&e.addListener("backNavigationTriggered",i)},async show(){await t.updateBackState({visible:!0}),this.visible=!0},async hide(){await t.updateBackState({visible:!1}),this.visible=!1},async enableWebNavigation(){r=hg({back:this,emitter:e})}
71,async disableWebNavigation(){r==null||r(),r=void 0}}};function hg({emitter:t,back:e}){const r=dg();if(r)return pg({emitter:t,back:e,navigation:r});if(typeof window<"u")return mg({emitter:t,back:e,window})}function dg(){if(typeof window<"u"&&window.navigation!==void 0)return window.navigation}function pg({emitter:t,back:e,navigation:r}){function n(){r.canGoBack?e.show():e.hide()}function i(){e.visible&&r.canGoBack&&r.back()}return r.addEventListener("navigatesuccess",n),t.addListener("backNavigationTriggered",i),()=>{r.removeEventListener("navigatesuccess",n),t.removeListener("backNavigationTriggered",i)}}function mg({emitter:t,back:e,window:r}){e.show();function n(){e.visible&&r.history.back()}return t.addListener("backNavigationTriggered",n),()=>{t.removeListener("backNavigationTriggered",n)}}const gg="0.1.1";function yg(){return gg}let Vn=class Qt extends Error{static setStaticOptions(e){Qt.prototype.docsOrigin=e.docsOrigin,Qt.prototype.showVersion=e.showVersion,Qt.prototype.version=e.version}constructor(e,r={}){const n=(()=>{var x;if(r.cause instanceof Qt){if(r.cause.details)return r.cause.details;if(r.cause.shortMessage)return r.cause.shortMessage}return r.cause&&"details"in r.cause&&typeof r.cause.details=="string"?r.cause.details:(x=r.cause)!=null&&x.message?r.cause.message:r.details})(),i=r.cause instanceof Qt&&r.cause.docsPath||r.docsPath,o=r.docsOrigin??Qt.prototype.docsOrigin,s=`${o}${i??""}`,l=!!(r.version??Qt.prototype.showVersion),d=r.version??Qt.prototype.version,E=[e||"An error occurred.",...r.metaMessages?["",...r.metaMessages]:[],...n||i||l?["",n?`Details: ${n}`:void 0,i?`See: ${s}`:void 0,l?`Version: ${d}`:void 0]:[]].filter(x=>typeof x=="string").join(` 72`);super(E,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=r.cause,this.details=n,this.docs=s,this.docsOrigin=o,this.docsPath=i,this.shortMessage=e,this.showVersion=l,this.version=d}walk(e){return Pu(this,e)}};Object.defineProperty(Vn,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:`ox@${yg()}`}});Vn.setStaticOptions(Vn.defaultStaticOptions);function Pu(t,e){return e!=null&&e(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause?Pu(t.cause,e):e?null:t}function Uu(t,e={}){const{raw:r=!1}=e,n=t;if(r)return t;if(n.error)throw $u(n.error);return n.result}function $u(t){const e=t;if(e instanceof Error&&!("code"in e))return new rr({cause:e,data:e,message:e.message,stack:e.stack});const{code:r}=e;return r===rr.code?new rr(e):r===en.code?new en(e):r===fn.code?new fn(e):r===un.code?new un(e):r===sn.code?new sn(e):r===cn.code?new cn(e):r===on.code?new on(e):r===ln.code?new ln(e):r===tn.code?new tn(e):r===rn.code?new rn(e):r===nn.code?new nn(e):r===an.code?new an(e):new rr({cause:e instanceof Error?e:void 0,data:e,message:e.message,stack:e instanceof Error?e.stack:void 0})}let Ut=class extends Error{constructor(e){const{cause:r,code:n,message:i,data:o,stack:s}=e;super(i,{cause:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.BaseError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"stack",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}
72),this.cause=r,this.code=n,this.data=o,this.stack=s??""}};class en extends Ut{constructor(e={}){super({code:en.code,data:e.data,message:e.message??"Missing or invalid parameters."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidInputError"})}}Object.defineProperty(en,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class tn extends Ut{constructor(e={}){super({code:tn.code,data:e.data,message:e.message??"Requested resource not found."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ResourceNotFoundError"})}}Object.defineProperty(tn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class rn extends Ut{constructor(e={}){super({code:rn.code,data:e.data,message:e.message??"Requested resource not available."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ResourceUnavailableError"})}}Object.defineProperty(rn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class nn extends Ut{constructor(e={}){super({code:nn.code,data:e.data,message:e.message??"Transaction creation failed."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.TransactionRejectedError"})}}Object.defineProperty(nn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class on extends Ut{constructor(e={}){super({code:on.code,data:e.data,message:e.message??"Method is not implemented."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.MethodNotSupportedError"})}}Object.defineProperty(on,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class sn extends Ut{constructor(e={}){super({code:sn.code,data:e.data,message:e.message??"Rate limit exceeded."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.LimitExceededError"})}}Object.defineProperty(sn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class an extends Ut{constructor(e={}){super({code:an.code,data:e.data,message:e.message??"JSON-RPC version not supported."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.VersionNotSupportedError"})}}Object.defineProperty(an,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class un extends Ut{constructor(e={}){super({code:un.code,data:e.data,message:e.message??"Input is not a valid JSON-RPC request."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidRequestError"})}}Object.defineProperty(un,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class cn extends Ut{constructor(e={}){super({code:cn.code,data:e.data,message:e.message??"Method does not exist."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.MethodNotFoundError"})}}Object.defineProperty(cn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class fn extends Ut{constructor(e={}){super({code:fn.code,data:e.data,message:e.message??"Invalid method parameters."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InvalidParamsError"})}}Object.defineProperty(fn,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class rr extends Ut{constructor(e={}){super({cause:e.cause,code:rr.code,data:e.data,message:e.message??"Internal JSON-RPC error.",stack:e.stack}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.InternalError"})}}Object.defineProperty(rr,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ln extends Ut{constructor(e={}){super({code:ln.code,data:e.data,message:e.message??"Failed to parse JSON-RPC response."}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcResponse.ParseError"})}}Object.defineProperty(ln,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});
72class It extends Error{constructor(e,r){super(r),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=e,this.details=r}}class qn extends It{constructor({message:e="The user rejected the request."}={}){super(4001,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UserRejectedRequestError"})}}Object.defineProperty(qn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Wn extends It{constructor({message:e="The requested method and/or account has not been authorized by the user."}={}){super(4100,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnauthorizedError"})}}Object.defineProperty(Wn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Jn extends It{constructor({message:e="The provider does not support the requested method."}={}){super(4200,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnsupportedMethodError"})}}Object.defineProperty(Jn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Gn extends It{constructor({message:e="The provider is disconnected from all chains."}={}){super(4900,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.DisconnectedError"})}}Object.defineProperty(Gn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Yn extends It{constructor({message:e="The provider is not connected to the requested chain."}={}){super(4901,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.ChainDisconnectedError"})}}Object.defineProperty(Yn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class ro extends It{constructor({message:e="An error occurred when attempting to switch chain."}={}){super(4902,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.SwitchChainError"})}}Object.defineProperty(ro,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class no extends It{constructor({message:e="This Wallet does not support a capability that was not marked as optional."}={}){super(5700,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnsupportedNonOptionalCapabilityError"})}}Object.defineProperty(no,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class io extends It{constructor({message:e="This Wallet does not support the requested chain ID."}={}){super(5710,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnsupportedChainIdError"})}}Object.defineProperty(io,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class oo extends It{constructor({message:e="There is already a bundle submitted with this ID."}={}){super(5720,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.DuplicateIdError"})}}Object.defineProperty(oo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class so extends It{constructor({message:e="This bundle id is unknown / has not been submitted."}={}){super(5730,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.UnknownBundleIdError"})}}Object.defineProperty(so,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class ao extends It{constructor({message:e="The call bundle is too large for the Wallet to process."}={}){super(5740,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.BundleTooLargeError"})}}Object.defineProperty(ao,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class uo extends It{constructor({message:e="The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."}={}){super(5750,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750}
vendor: 9,512 bytes, lines 72-76
72),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.AtomicReadyWalletRejectedUpgradeError"})}}Object.defineProperty(uo,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class co extends It{constructor({message:e="The wallet does not support atomic execution but the request requires it."}={}){super(5760,e),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.AtomicityNotSupportedError"})}}Object.defineProperty(co,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});function wg(){const t=new Js;return{get eventNames(){return t.eventNames.bind(t)},get listenerCount(){return t.listenerCount.bind(t)},get listeners(){return t.listeners.bind(t)},addListener:t.addListener.bind(t),emit:t.emit.bind(t),off:t.off.bind(t),on:t.on.bind(t),once:t.once.bind(t),removeAllListeners:t.removeAllListeners.bind(t),removeListener:t.removeListener.bind(t)}}function vg(t,e={}){if(!t)throw new _g;return{...t,async request(r){try{const n=await t.request(r);return n&&typeof n=="object"&&"jsonrpc"in n?Uu(n):n}catch(n){throw bg(n)}}}}function bg(t){const e=$u(t);if(e instanceof rr){if(!e.data)return e;const{code:r}=e.data;if(r===Gn.code)return new Gn(e);if(r===Yn.code)return new Yn(e);if(r===qn.code)return new qn(e);if(r===Wn.code)return new Wn(e);if(r===Jn.code)return new Jn(e);if(r===ro.code)return new ro(e);if(r===uo.code)return new uo(e);if(r===co.code)return new co(e);if(r===ao.code)return new ao(e);if(r===so.code)return new so(e);if(r===oo.code)return new oo(e);if(r===io.code)return new io(e);if(r===no.code)return new no(e)}return e}class _g extends Vn{constructor(){super("`provider` is undefined."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Provider.IsUndefinedError"})}}function Eg(t={}){let e=t.id??0;return{prepare(r){return xg({id:e++,...r})},get id(){return e}}}function xg(t){return{...t,jsonrpc:"2.0"}}/** 73 * @license 74 * Copyright 2019 Google LLC 75 * SPDX-License-Identifier: Apache-2.0 76 */const Cu=Symbol("Comlink.proxy"),Sg=Symbol("Comlink.endpoint"),Ig=Symbol("Comlink.releaseProxy"),Wi=Symbol("Comlink.finalizer"),Bn=Symbol("Comlink.thrown"),Nu=t=>typeof t=="object"&&t!==null||typeof t=="function",kg={canHandle:t=>Nu(t)&&t[Cu],serialize(t){const{port1:e,port2:r}=new MessageChannel;return Lu(t,e),[r,[r]]},deserialize(t){return t.start(),Zu(t)}},Ag={canHandle:t=>Nu(t)&&Bn in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},Fu=new Map([["proxy",kg],["throw",Ag]]);function Mg(t,e){for(const r of t)if(e===r||r==="*"||r instanceof RegExp&&r.test(e))return!0;return!1}function Lu(t,e=globalThis,r=["*"]){e.addEventListener("message",function n(i){if(!i||!i.data)return;if(!Mg(r,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:o,type:s,path:l}=Object.assign({path:[]},i.data),d=(i.data.argumentList||[]).map(mr);let E;try{const x=l.slice(0,-1).reduce((z,O)=>z[O],t),M=l.reduce((z,O)=>z[O],t);switch(s){case"GET":E=M;break;case"SET":x[l.slice(-1)[0]]=mr(i.data.value),E=!0;break;case"APPLY":E=M.apply(x,d);break;case"CONSTRUCT":{const z=new M(...d);E=Pg(z)}break;case"ENDPOINT":{const{port1:z,port2:O}=new MessageChannel;Lu(t,O),E=Tg(z,[z])}break;case"RELEASE":E=void 0;break;default:return}}catch(x){E={value:x,[Bn]:0}}Promise.resolve(E).catch(x=>({value:x,[Bn]:0})).then(x=>{const[M,z]=Qn(x);e.postMessage(Object.assign(Object.assign({},M),{id:o}),z),s==="RELEASE"&&(e.removeEventListener("message",n),Du(e),Wi in t&&typeof t[Wi]=="function"&&t[Wi]())}).catch(x=>{const[M,z]=Qn({value:new TypeError("Unserializable return value"),[Bn]:0});e.postMessage(Object.assign(Object.assign({},M),{id:o}),z)})}),e.start&&e.start()}function Bg(t){return t.constructor.name==="MessagePort"}function Du(t){Bg(t)&&t.close()}function Zu(t,e){const r=new Map;return t.addEventListener("message",function(i){const{data:o}=i;if(!o||!o.id)return;const s=r.get(o.id);if(s)try{s(o)}finally{r.delete(o.id)}}),fo(t,r,[],e)}function kn(t){if(t)throw new Error("Proxy has been released and is not useable")}function ju(t){return Or(t,new Map,{type:"RELEASE"}).then(()=>{Du(t)})}const Hn=new WeakMap,Xn="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(Hn.get(t)||0)-1;Hn.set(t,e),e===0&&ju(t)});function Og(t,e){const r=(Hn.get(e)||0)+1;Hn.set(e,r),Xn&&Xn.register(t,e,t)}function Rg(t){Xn&&Xn.unregister(t)}function fo(t,e,r=[],n=function(){}){let i=!1;const o=new Proxy(n,{get(s,l){if(kn(i),l===Ig)return()=>{Rg(o),ju(t),e.clear(),i=!0};if(l==="then"){if(r.length===0)return{then:()=>o};const d=Or(t,e,{type:"GET",path:r.map(E=>E.toString())}).then(mr);return d.then.bind(d)}return fo(t,e,[...r,l])},set(s,l,d){kn(i);const[E,x]=Qn(d);return Or(t,e,{type:"SET",path:[...r,l].map(M=>M.toString()),value:E},x).then(mr)},apply(s,l,d){kn(i);const E=r[r.length-1];if(E===Sg)return Or(t,e,{type:"ENDPOINT"}).then(mr);if(E==="bind")return fo(t,e,r.slice(0,-1));const[x,M]=Ds(d);return Or(t,e,{type:"APPLY",path:r.map(z=>z.toString()),argumentList:x},M).then(mr)},construct(s,l){kn(i);const[d,E]=Ds(l);return Or(t,e,{type:"CONSTRUCT",path:r.map(x=>x.toString()),argumentList:d},E).then(mr)}});return Og(o,t),o}function zg(t){return Array.prototype.concat.apply([],t)}function Ds(t){const e=t.map(Qn);return[e.map(r=>r[0]),zg(e.map(r=>r[1]))]}const Ku=new WeakMap;function Tg(t,e){return Ku.set(t,e),t}function Pg(t){return Object.assign(t,{[Cu]:!0})}function Ug(t,e=globalThis,r="*"){return{postMessage:(n,i)=>t.postMessage(n,r,i),addEventListener:e.addEventListener.bind(e),removeEventListener:e.removeEventListener.bind(e)}}function Qn(t){for(const[e,r]of Fu)if(r.canHandle(t)){const[n,i]=r.serialize(t);return[{type:"HANDLER",name:e,value:n},i]}return[{type:"RAW",value:t},Ku.get(t)||[]]}function mr(t){switch(t.type){case"HANDLER":return Fu.get(t.name).deserialize(t.value);case"RAW":return t.value}}function Or(t,e,r,n){return new Promise(i=>{const o=$g();e.set(o,i),t.start&&t.start(),t.postMessage(Object.assign({id:o},r),n)})}function $g(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}const Cg={postMessage(){},addEventListener:()=>{},removeEventListener:()=>{}},Ng={postMessage:t=>{window.ReactNativeWebView.postMessage(JSON.stringify(t))},addEventListener:(t,e,...r)=>{document.addEventListener("FarcasterFrameCallback",e,...r)},removeEventListener:(t,e)=>{document.removeEventListener("FarcasterFrameCallback",e)}},Fg=typeof window>"u"?Cg:window!=null&&window.ReactNativeWebView?Ng:Ug((window==null?void 0:window.parent)??window),ue=Zu(Fg),Vo=wg(),Lg=Eg();function Dg({code:t,details:e}){switch(t){case 4001:return new qn;case 4100:return new Wn;case 4200:return new Jn;case 4900:return new Gn;case 4901:return new Yn;default:return new It(t,e??"Unknown provider RPC error")}}const Zg={...Vo,async request(t){const e=Lg.prepare(t);try{const r=await ue.ethProviderRequestV2(e).then(n=>Uu(n,{request:e,raw:!0}));if(r.error)throw Dg(r.error);return r.result}catch(r){if(r instanceof Error&&r.message.match(/cannot read property 'apply'/i))return await ue.ethProviderRequest(e);throw r instanceof It||r instanceof Ut?r:new rr({message:r instanceof Error?r.message:void 0})}}},hn=vg(Zg);async function jg(){try{const t=await ue.getCapabilities();return!t.includes("wallet.getEthereumProvider")&&!t.includes("wallet.getEvmProvider")?void 0:hn}catch{return hn}}function Vu(t){const e=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(t)});window.dispatchEvent(e);const r=()=>window.dispatchEvent(e);return window.addEventListener("eip6963:requestProvider",r),()=>window.removeEventListener("eip6963:requestProvider",r)}typeof document<"u"&&(document.addEventListener("eip6963:requestProvider",()=>{ue.eip6963RequestProvider()}),document.addEventListener("FarcasterFrameEthProviderEvent",t=>{if(t instanceof MessageEvent){const e=t.data;Vo.emit(e.event,...e.params)}}),document.addEventListener("FarcasterFrameEvent",t=>{if(t instanceof MessageEvent){const e=t.data;e.event==="eip6963:announceProvider"&&Vu({info:e.info,provider:hn})}}));typeof window<"u"&&(window.addEventListener("eip6963:requestProvider",()=>{ue.eip6963RequestProvider()}),window.addEventListener("message",t=>{if(t instanceof MessageEvent&&t.data.type==="frameEthProviderEvent"){const e=t.data;Vo.emit(e.event,...e.params)}}),window.addEventListener("message",t=>{if(t instanceof MessageEvent&&t.data.type==="frameEvent"){const e=t.data.event;e.event==="eip6963:announceProvider"&&Vu({info:e.info,provider:hn})}}));new TextEncoder;const qu=new TextDecoder,Kg=t=>{const e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r},Vg=t=>{let e=t;e instanceof Uint8Array&&(e=qu.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return Kg(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}},qg=Vg;function Wg(t){return typeof t=="object"&&t!==null}function Jg(t){if(!Wg(t)||Object.prototype.toString.call(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}
76class kt extends Error{constructor(e,r){var n;super(e,r),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,(n=Error.captureStackTrace)==null||n.call(Error,this,this.constructor)}}kt.code="ERR_JOSE_GENERIC";class Gg extends kt{constructor(e,r,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:r}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=n,this.reason=i,this.payload=r}}Gg.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class Yg extends kt{constructor(e,r,n="unspecified",i="unspecified"){super(e,{cause:{claim:n,reason:i,payload:r}}),this.code="ERR_JWT_EXPIRED",this.claim=n,this.reason=i,this.payload=r}}Yg.code="ERR_JWT_EXPIRED";class Hg extends kt{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}Hg.code="ERR_JOSE_ALG_NOT_ALLOWED";class Xg extends kt{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}Xg.code="ERR_JOSE_NOT_SUPPORTED";class Qg extends kt{constructor(e="decryption operation failed",r){super(e,r),this.code="ERR_JWE_DECRYPTION_FAILED"}}Qg.code="ERR_JWE_DECRYPTION_FAILED";class ey extends kt{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}ey.code="ERR_JWE_INVALID";class ty extends kt{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}ty.code="ERR_JWS_INVALID";class sr extends kt{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}sr.code="ERR_JWT_INVALID";class ry extends kt{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}ry.code="ERR_JWK_INVALID";class ny extends kt{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}ny.code="ERR_JWKS_INVALID";class iy extends kt{constructor(e="no applicable key found in the JSON Web Key Set",r){super(e,r),this.code="ERR_JWKS_NO_MATCHING_KEY"}}iy.code="ERR_JWKS_NO_MATCHING_KEY";class oy extends kt{constructor(e="multiple matching keys found in the JSON Web Key Set",r){super(e,r),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}oy.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class sy extends kt{constructor(e="request timed out",r){super(e,r),this.code="ERR_JWKS_TIMEOUT"}}sy.code="ERR_JWKS_TIMEOUT";class ay extends kt{constructor(e="signature verification failed",r){super(e,r),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}ay.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function uy(t){if(typeof t!="string")throw new sr("JWTs must use Compact JWS serialization, JWT must be a string");const{1:e,length:r}=t.split(".");if(r===5)throw new sr("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new sr("Invalid JWT");if(!e)throw new sr("JWTs must contain a payload");let n;try{n=qg(e)}catch{throw new sr("Failed to base64url decode the payload")}let i;try{i=JSON.parse(qu.decode(n))}catch{throw new sr("Failed to parse the decoded payload as JSON")}if(!Jg(i))throw new sr("Invalid JWT Claims Set");return i}function cy(t){return uy(t)}class mi extends Error{constructor(e,r={}){const n=(()=>{var o;if(r.cause instanceof mi){if(r.cause.details)return r.cause.details;if(r.cause.shortMessage)return r.cause.shortMessage}return r.cause&&"details"in r.cause&&typeof r.cause.details=="string"?r.cause.details:(o=r.cause)!=null&&o.message?r.cause.message:r.details})(),i=[e||"An error occurred.",...r.metaMessages?["",...r.metaMessages]:[],...n?["",n?`Details: ${n}`:void 0]:[]].filter(o=>typeof o=="string").join(` 77`);super(i,r.cause?{cause:r.cause}:void 0),this.name="BaseError",this.cause=r.cause,this.details=n,this.shortMessage=e}}class Wu extends mi{constructor({status:e}){super(`Request failed with status ${e}`),this.name="RequestFailedError"}}class fy extends mi{constructor(e){super(e),this.name="InvalidToken"}}async function ly({origin:t}){const e=await fetch(`${t}/nonce`,{method:"POST"});if(!e.ok)throw new Wu({status:e.status});return await e.json()}async function hy({origin:t},e){const r=await fetch(`${t}/verify-siwf`,{method:"POST",headers:new Headers({"Content-Type":"application/json"}),body:JSON.stringify(e)});if(!r.ok)throw new Wu({status:r.status});const n=await r.json();if(n.valid===!1)throw new fy(n.message??"unknown");return{token:n.token}}function dy(t={}){return{origin:t.origin??"https://auth.farcaster.xyz"}}function py(t={}){const e=dy(t);return{generateNonce:()=>ly(e),verifySiwf:r=>hy(e,r)}}const my=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,gy=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function yy(t){var M,z,O;const{scheme:e,statement:r,...n}=((M=t.match(my))==null?void 0:M.groups)??{},{chainId:i,expirationTime:o,issuedAt:s,notBefore:l,requestId:d,...E}=((z=t.match(gy))==null?void 0:z.groups)??{},x=(O=t.split("Resources:")[1])==null?void 0:O.split(` 78- `).slice(1);return{...n,...E,...i?{chainId:Number(i)}:{},...o?{expirationTime:new Date(o)}:{},...s?{issuedAt:new Date(s)}:{},...l?{notBefore:new Date(l)}:{},...d?{requestId:d}:{},...x?{resources:x}:{},...e?{scheme:e}:{},...r?{statement:r}:{}}}const Zs=(()=>{let t,e;async function r(n){const i=py({origin:n.quickAuthServerOrigin}),{nonce:o}=await i.generateNonce(),s=await ue.signIn({nonce:o,acceptAuthAddress:!0});if(s.result){const l=yy(s.result.message);if(!l.domain)throw new Error("Missing domain on SIWE message");const d=await i.verifySiwf({domain:l.domain,message:s.result.message,signature:s.result.signature});return t={token:d.token,payload:cy(d.token)},d}throw s.error.type==="rejected_by_user"?new Xs:new Error("Unreachable")}return{get token(){if(t&&new Date(t.payload.exp*1e3)>new Date(Date.now()+15e3))return t.token},async getToken(n={}){const i=n.force??!1;return t&&!i&&new Date(t.payload.exp*1e3)>new Date(Date.now()+15e3)?{token:t.token}:(e||(e=r(n)),e.finally(()=>{e=void 0}),e)},async fetch(n,i){const{token:o}=await this.getToken(),s=new Headers(i==null?void 0:i.headers);return s.set("Authorization",`Bearer ${o}`),fetch(n,{...i,headers:s})}}})();function wy(){const t=new Js;return{get eventNames(){return t.eventNames.bind(t)},get listenerCount(){return t.listenerCount.bind(t)},get listeners(){return t.listeners.bind(t)},addListener:t.addListener.bind(t),emit:t.emit.bind(t),off:t.off.bind(t),on:t.on.bind(t),once:t.once.bind(t),removeAllListeners:t.removeAllListeners.bind(t),removeListener:t.removeListener.bind(t)}}
78const yt=wy(),{solanaProviderRequest:js}=ue;let Ju;js&&(Ju=ug(fg(js)));async function Ks(){let t;try{t=await ue.getCapabilities()}catch{}if(t!=null&&t.includes("wallet.getSolanaProvider"))return Ju}let Vs=null;async function vy(t=1e3){if(Vs===!0)return!0;if(typeof window>"u"||!window.ReactNativeWebView&&window===window.parent)return!1;const e=await Promise.race([ue.context.then(r=>!!r),new Promise(r=>{setTimeout(()=>r(!1),t)})]).catch(()=>!1);return e&&(Vs=!0),e}const qs=async()=>{const t=await ue.addFrame();if(t.result)return t.result;throw t.error.type==="invalid_domain_manifest"?new lc:t.error.type==="rejected_by_user"?new hc:new Error("Unreachable")},by={...yt,getCapabilities:ue.getCapabilities,getChains:ue.getChains,isInMiniApp:vy,context:ue.context,back:lg({miniAppHost:ue,emitter:yt}),quickAuth:Zs,actions:{setPrimaryButton:ue.setPrimaryButton.bind(ue),ready:async(t={})=>await ue.ready(t),close:ue.close.bind(ue),viewCast:ue.viewCast.bind(ue),viewProfile:ue.viewProfile.bind(ue),openMiniApp:ue.openMiniApp.bind(ue),signIn:async t=>{const e=await ue.signIn({...t,acceptAuthAddress:t.acceptAuthAddress??!0});if(e.result)return e.result;throw e.error.type==="rejected_by_user"?new Xs:new Error("Unreachable")},openUrl:t=>{const e=typeof t=="string"?t:t.url;return ue.openUrl(e.trim())},addFrame:qs,addMiniApp:qs,composeCast(t={}){return ue.composeCast(t)},viewToken:ue.viewToken.bind(ue),sendToken:ue.sendToken.bind(ue),swapToken:ue.swapToken.bind(ue),requestCameraAndMicrophoneAccess:ue.requestCameraAndMicrophoneAccess.bind(ue)},experimental:{getSolanaProvider:Ks,signManifest:async t=>{const e=await ue.signManifest(t);if(e.result)return e.result;throw e.error.type==="rejected_by_user"?new dc:e.error.type==="invalid_domain"?new pc:e.error.type==="generic_error"?new mc(e.error.message):new Error("Unreachable")},quickAuth(t){return Zs.getToken(t)}},wallet:{ethProvider:hn,getEthereumProvider:jg,getSolanaProvider:Ks},haptics:{impactOccurred:ue.impactOccurred.bind(ue),notificationOccurred:ue.notificationOccurred.bind(ue),selectionChanged:ue.selectionChanged.bind(ue)}};typeof document<"u"&&document.addEventListener("FarcasterFrameEvent",t=>{if(t instanceof MessageEvent){const e=t.data;e.event==="primary_button_clicked"?yt.emit("primaryButtonClicked"):e.event==="miniapp_added"?yt.emit("miniAppAdded",{notificationDetails:e.notificationDetails}):e.event==="miniapp_add_rejected"?yt.emit("miniAppAddRejected",{reason:e.reason}):e.event==="miniapp_removed"?yt.emit("miniAppRemoved"):e.event==="notifications_enabled"?yt.emit("notificationsEnabled",{notificationDetails:e.notificationDetails}):e.event==="notifications_disabled"?yt.emit("notificationsDisabled"):e.event==="back_navigation_triggered"&&yt.emit("backNavigationTriggered")}});typeof window<"u"&&window.addEventListener("message",t=>{if(t instanceof MessageEvent&&t.data.type==="frameEvent"){const e=t.data.event;e.event==="primary_button_clicked"?yt.emit("primaryButtonClicked"):e.event==="miniapp_added"?yt.emit("miniAppAdded",{notificationDetails:e.notificationDetails}):e.event==="miniapp_add_rejected"?yt.emit("miniAppAddRejected",{reason:e.reason}):e.event==="miniapp_removed"?yt.emit("miniAppRemoved"):e.event==="notifications_enabled"?yt.emit("notificationsEnabled",{notificationDetails:e.notificationDetails}):e.event==="notifications_disabled"?yt.emit("notificationsDisabled"):e.event==="back_navigation_triggered"&&yt.emit("backNavigationTriggered")}});qo.type="farcasterMiniApp";let kr,Ar,Mr;function Ws(t){if(typeof t.on!="function")throw new Error("MiniApp provider does not support event listeners.");if(typeof t.removeListener!="function")throw new Error("MiniApp provider does not support removing listeners.")}function qo(){return tc(t=>({id:"farcaster",name:"Farcaster",rdns:"xyz.farcaster.MiniAppWallet",icon:"https://imagedelivery.net/BXluQx4ige9GuW0Ia56BHw/055c25d6-7fe7-4a49-abf9-49772021cf00/original",type:qo.type,async connect({chainId:e}={}){var s,l;const r=await this.getProvider();Ws(r);const n=await r.request({method:"eth_requestAccounts"});let i=e;if(!i){const d=await((s=t.storage)==null?void 0:s.getItem("state"))??{};t.chains.some(x=>x.id===d.chainId)?i=d.chainId:i=(l=t.chains[0])==null?void 0:l.id}if(!i)throw new Error("No chains found on connector.");if(!kr){const d=this.onAccountsChanged.bind(this);kr=E=>d([...E]),r.on("accountsChanged",kr)}Ar||(Ar=this.onChainChanged.bind(this),r.on("chainChanged",Ar)),Mr||(Mr=this.onDisconnect.bind(this),r.on("disconnect",Mr));let o=await this.getChainId();return i&&o!==i&&(o=(await this.switchChain({chainId:i})).id),{accounts:n.map(d=>Ui(d)),chainId:o}},async disconnect(){const e=await this.getProvider();Ws(e),kr&&(e.removeListener("accountsChanged",kr),kr=void 0),Ar&&(e.removeListener("chainChanged",Ar),Ar=void 0),Mr&&(e.removeListener("disconnect",Mr),Mr=void 0)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(n=>Ui(n))},async getChainId(){const r=await(await this.getProvider()).request({method:"eth_chainId"});return oc(r,"number")},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({chainId:e}){const r=await this.getProvider(),n=t.chains.find(i=>i.id===e);if(!n)throw new rc(new nc);return await r.request({method:"wallet_switchEthereumChain",params:[{chainId:ic(e)}]}),t.emitter.emit("change",{chainId:e}),n},onAccountsChanged(e){e.length===0?this.onDisconnect():t.emitter.emit("change",{accounts:e.map(r=>Ui(r))})},onChainChanged(e){const r=Number(e);t.emitter.emit("change",{chainId:r})},async onDisconnect(){t.emitter.emit("disconnect")},async getProvider(){return by.wallet.ethProvider}}))}const _y=qo;_y.type="farcasterFrame";export{Ts as _,ci as a,Ca as b,le as c,by as d,qo as f,np as r,ip as s,mm as v};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.