@learncard/idx-plugin 1.0.35 → 1.0.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,7 @@ if (cid) {
21
21
  `;var Jg={};En(Jg,{base36:()=>ta,base36upper:()=>GO});var ta=Ko({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),GO=Ko({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var b8={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function WO(e){let t=b8[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(WO,"codeByName");function JO(e){let t=Object.entries(b8).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(JO,"nameByCode");var ra=class{};i(ra,"StreamType");ra.nameByCode=JO;ra.codeByName=WO;var Rv=Hs(ip(),1);function fu(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}i(fu,"asUint8Array");function bf(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?fu(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}i(bf,"allocUnsafe");function wf(e,t){t||(t=e.reduce((a,s)=>a+s.length,0));let r=bf(t),n=0;for(let a of e)r.set(a,n),n+=a.length;return fu(r)}i(wf,"concat");var Xg={};En(Xg,{identity:()=>uN});var uN=uu({prefix:"\0",name:"identity",encode:e=>h8(e),decode:e=>d8(e)});var Qg={};En(Qg,{base2:()=>lN});var lN=Br({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ev={};En(ev,{base8:()=>fN});var fN=Br({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var tv={};En(tv,{base10:()=>dN});var dN=Ko({prefix:"9",name:"base10",alphabet:"0123456789"});var rv={};En(rv,{base16:()=>hN,base16upper:()=>pN});var hN=Br({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),pN=Br({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var nv={};En(nv,{base64:()=>mN,base64pad:()=>gN,base64url:()=>vN,base64urlpad:()=>yN});var mN=Br({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),gN=Br({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),vN=Br({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),yN=Br({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var iv={};En(iv,{base256emoji:()=>AN});var I8=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),bN=I8.reduce((e,t,r)=>(e[r]=t,e),[]),wN=I8.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function _N(e){return e.reduce((t,r)=>(t+=bN[r],t),"")}i(_N,"encode");function EN(e){let t=[];for(let r of e){let n=wN[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}i(EN,"decode");var AN=uu({prefix:"\u{1F680}",name:"base256emoji",encode:_N,decode:EN});var sv={};En(sv,{sha256:()=>ov,sha512:()=>SN});var av=i(({name:e,code:t,encode:r})=>new ap(e,t,r),"from"),ap=class{constructor(t,r,n){this.name=t,this.code=r,this.encode=n}digest(t){if(t instanceof Uint8Array){let r=this.encode(t);return r instanceof Uint8Array?Vs(this.code,r):r.then(n=>Vs(this.code,n))}else throw Error("Unknown type, must be binary type")}};i(ap,"Hasher");var D8=i(e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),"sha"),ov=av({name:"sha2-256",code:18,encode:D8("SHA-256")}),SN=av({name:"sha2-512",code:19,encode:D8("SHA-512")});var cv={};En(cv,{identity:()=>CN});var R8=0,xN="identity",O8=fo,TN=i(e=>Vs(R8,O8(e)),"digest"),CN={code:R8,name:xN,encode:O8,digest:TN};var WK=new TextEncoder,JK=new TextDecoder;var uv={...Xg,...Qg,...ev,...tv,...rv,...Wg,...Jg,...Gg,...nv,...iv},QK={...sv,...cv};function P8(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}i(P8,"createCodec");var N8=P8("utf8","u",e=>{let t=new TextDecoder("utf8");return"u"+t.decode(e)},e=>new TextEncoder().encode(e.substring(1))),lv=P8("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{e=e.substring(1);let t=bf(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),kN={utf8:N8,"utf-8":N8,hex:uv.base16,latin1:lv,ascii:lv,binary:lv,...uv},fv=kN;function dv(e,t="utf8"){let r=fv[t];if(!r)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}i(dv,"toString");function ui(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(a,s,c)=>{if(c.value!=null)c.value=B8(c.value,t,r,n);else if(c.get!=null)c.get=B8(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(ui,"Memoize");var hv=new Map;function B8(e,t,r=0,n){let a=Symbol("__memoized_map__");return function(...s){let c;this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let l=this[a];if(Array.isArray(n))for(let h of n)hv.has(h)?hv.get(h).push(l):hv.set(h,[l]);if(t||s.length>0||r>0){let h;t===!0?h=s.map(v=>v.toString()).join("!"):t?h=t.apply(this,s):h=s[0];let p=`${h}__timestamp`,g=!1;if(r>0)if(!l.has(p))g=!0;else{let v=l.get(p);g=Date.now()-v>r}l.has(h)&&!g?c=l.get(h):(c=e.apply(this,s),l.set(h,c),r>0&&l.set(p,Date.now()))}else{let h=this;l.has(h)?c=l.get(h):(c=e.apply(this,s),l.set(h,c))}return c}}i(B8,"getNewFunction");var op=i(({enumerable:e=!0,configurable:t=!1}={})=>({enumerable:e,configurable:t,writable:!1}),"readonly"),pv=i(function*(e,t){if(e!=null&&!(e instanceof Uint8Array))for(let[r,n]of Object.entries(e)){let a=[...t,r];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[s,c]of n.entries()){let l=[...a,s],h=Ft.asCID(c);h?yield[l.join("/"),h]:typeof c=="object"&&(yield*pv(c,l))}else{let s=Ft.asCID(n);s?yield[a.join("/"),s]:yield*pv(n,a)}}},"links"),mv=i(function*(e,t){if(e!=null)for(let[r,n]of Object.entries(e)){let a=[...t,r];if(yield a.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!Ft.asCID(n))if(Array.isArray(n))for(let[s,c]of n.entries()){let l=[...a,s];yield l.join("/"),typeof c=="object"&&!Ft.asCID(c)&&(yield*mv(c,l))}else yield*mv(n,a)}},"tree"),RN=i((e,t)=>{let r=e;for(let[n,a]of t.entries()){if(r=r[a],r==null)throw new Error(`Object has no property at ${t.slice(0,n+1).map(c=>`[${JSON.stringify(c)}]`).join("")}`);let s=Ft.asCID(r);if(s)return{value:s,remaining:t.slice(n+1).join("/")}}return{value:r}},"get"),sp=class{constructor({cid:t,bytes:r,value:n}){if(!t||!r||typeof n>"u")throw new Error("Missing required argument");this.cid=t,this.bytes=r,this.value=n,this.asBlock=this,Object.defineProperties(this,{cid:op(),bytes:op(),value:op(),asBlock:op()})}links(){return pv(this.value,[])}tree(){return mv(this.value,[])}get(t="/"){return RN(this.value,t.split("/").filter(Boolean))}};i(sp,"Block");var L8=i(async({value:e,codec:t,hasher:r})=>{if(typeof e>"u")throw new Error('Missing required argument "value"');if(!t||!r)throw new Error("Missing required argument: codec or hasher");let n=t.encode(e),a=await r.digest(n),s=Ft.create(1,t.code,a);return new sp({value:e,bytes:n,cid:s})},"encode");var kv=Hs(ip(),1);var bp={};En(bp,{code:()=>gP,decode:()=>vP,encode:()=>xv,name:()=>mP});var NN=["string","number","bigint","symbol"],PN=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function U8(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(NN.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(BN(e))return"Buffer";let r=LN(e);return r||"Object"}i(U8,"is");function BN(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}i(BN,"isBuffer");function LN(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(PN.includes(t))return t}i(LN,"getObjectType");var Ne=class{constructor(t,r,n){this.major=t,this.majorEncoded=t<<5,this.name=r,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(t){return this.major<t.major?-1:this.major>t.major?1:0}};i(Ne,"Type");Ne.uint=new Ne(0,"uint",!0);Ne.negint=new Ne(1,"negint",!0);Ne.bytes=new Ne(2,"bytes",!0);Ne.string=new Ne(3,"string",!0);Ne.array=new Ne(4,"array",!1);Ne.map=new Ne(5,"map",!1);Ne.tag=new Ne(6,"tag",!1);Ne.float=new Ne(7,"float",!0);Ne.false=new Ne(7,"false",!0);Ne.true=new Ne(7,"true",!0);Ne.null=new Ne(7,"null",!0);Ne.undefined=new Ne(7,"undefined",!0);Ne.break=new Ne(7,"break",!0);var Qe=class{constructor(t,r,n){this.type=t,this.value=r,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}};i(Qe,"Token");var du=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",UN=new TextDecoder,FN=new TextEncoder;function cp(e){return du&&globalThis.Buffer.isBuffer(e)}i(cp,"isBuffer");function gv(e){return e instanceof Uint8Array?cp(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}i(gv,"asU8A");var z8=du?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):j8(e,t,r):(e,t,r)=>r-t>64?UN.decode(e.subarray(t,r)):j8(e,t,r),H8=du?e=>e.length>64?globalThis.Buffer.from(e):F8(e):e=>e.length>64?FN.encode(e):F8(e),Ra=i(e=>Uint8Array.from(e),"fromArray"),hu=du?(e,t,r)=>cp(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),q8=du?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),gv(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let a of e)n+a.length>r.length&&(a=a.subarray(0,r.length-n)),r.set(a,n),n+=a.length;return r},V8=du?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function K8(e,t){if(cp(e)&&cp(t))return e.compare(t);for(let r=0;r<e.length;r++)if(e[r]!==t[r])return e[r]<t[r]?-1:1;return 0}i(K8,"compare");function F8(e,t=1/0){let r,n=e.length,a=null,s=[];for(let c=0;c<n;++c){if(r=e.charCodeAt(c),r>55295&&r<57344){if(!a){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(c+1===n){(t-=3)>-1&&s.push(239,191,189);continue}a=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),a=r;continue}r=(a-55296<<10|r-56320)+65536}else a&&(t-=3)>-1&&s.push(239,191,189);if(a=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}i(F8,"utf8ToBytes");function j8(e,t,r){let n=[];for(;t<r;){let a=e[t],s=null,c=a>239?4:a>223?3:a>191?2:1;if(t+c<=r){let l,h,p,g;switch(c){case 1:a<128&&(s=a);break;case 2:l=e[t+1],(l&192)===128&&(g=(a&31)<<6|l&63,g>127&&(s=g));break;case 3:l=e[t+1],h=e[t+2],(l&192)===128&&(h&192)===128&&(g=(a&15)<<12|(l&63)<<6|h&63,g>2047&&(g<55296||g>57343)&&(s=g));break;case 4:l=e[t+1],h=e[t+2],p=e[t+3],(l&192)===128&&(h&192)===128&&(p&192)===128&&(g=(a&15)<<18|(l&63)<<12|(h&63)<<6|p&63,g>65535&&g<1114112&&(s=g))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),t+=c}return jN(n)}i(j8,"utf8Slice");var $8=4096;function jN(e){let t=e.length;if(t<=$8)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=$8));return r}i(jN,"decodeCodePointsArray");var $N=256,pu=class{constructor(t=$N){this.chunkSize=t,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}push(t){let r=this.chunks[this.chunks.length-1];if(this.cursor+t.length<=this.maxCursor+1){let a=r.length-(this.maxCursor-this.cursor)-1;r.set(t,a)}else{if(r){let a=r.length-(this.maxCursor-this.cursor)-1;a<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,a),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=V8(this.chunkSize),this.chunks.push(r),this.maxCursor+=r.length,this._initReuseChunk===null&&(this._initReuseChunk=r),r.set(t,0)):(this.chunks.push(t),this.maxCursor+=t.length)}this.cursor+=t.length}toBytes(t=!1){let r;if(this.chunks.length===1){let n=this.chunks[0];t&&this.cursor>n.length/2?(r=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):r=hu(n,0,this.cursor)}else r=q8(this.chunks,this.cursor);return t&&this.reset(),r}};i(pu,"Bl");var It="CBOR decode error:",vv="CBOR encode error:",_f=[];_f[23]=1;_f[24]=2;_f[25]=3;_f[26]=5;_f[27]=9;function ho(e,t,r){if(e.length-t<r)throw new Error(`${It} not enough data for type`)}i(ho,"assertEnoughData");var Qr=[24,256,65536,4294967296,BigInt("18446744073709551616")];function li(e,t,r){ho(e,t,1);let n=e[t];if(r.strict===!0&&n<Qr[0])throw new Error(`${It} integer encoded in more bytes than necessary (strict decode)`);return n}i(li,"readUint8");function fi(e,t,r){ho(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Qr[1])throw new Error(`${It} integer encoded in more bytes than necessary (strict decode)`);return n}i(fi,"readUint16");function di(e,t,r){ho(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Qr[2])throw new Error(`${It} integer encoded in more bytes than necessary (strict decode)`);return n}i(di,"readUint32");function hi(e,t,r){ho(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],a=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],s=(BigInt(n)<<BigInt(32))+BigInt(a);if(r.strict===!0&&s<Qr[3])throw new Error(`${It} integer encoded in more bytes than necessary (strict decode)`);if(s<=Number.MAX_SAFE_INTEGER)return Number(s);if(r.allowBigInt===!0)return s;throw new Error(`${It} integers outside of the safe integer range are not supported`)}i(hi,"readUint64");function G8(e,t,r,n){return new Qe(Ne.uint,li(e,t+1,n),2)}i(G8,"decodeUint8");function W8(e,t,r,n){return new Qe(Ne.uint,fi(e,t+1,n),3)}i(W8,"decodeUint16");function J8(e,t,r,n){return new Qe(Ne.uint,di(e,t+1,n),5)}i(J8,"decodeUint32");function Z8(e,t,r,n){return new Qe(Ne.uint,hi(e,t+1,n),9)}i(Z8,"decodeUint64");function Li(e,t){return cn(e,0,t.value)}i(Li,"encodeUint");function cn(e,t,r){if(r<Qr[0]){let n=Number(r);e.push([t|n])}else if(r<Qr[1]){let n=Number(r);e.push([t|24,n])}else if(r<Qr[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Qr[3]){let n=Number(r);e.push([t|26,n>>>24&255,n>>>16&255,n>>>8&255,n&255])}else{let n=BigInt(r);if(n<Qr[4]){let a=[t|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),c=Number(n>>BigInt(32)&BigInt(4294967295));a[8]=s&255,s=s>>8,a[7]=s&255,s=s>>8,a[6]=s&255,s=s>>8,a[5]=s&255,a[4]=c&255,c=c>>8,a[3]=c&255,c=c>>8,a[2]=c&255,c=c>>8,a[1]=c&255,e.push(a)}else throw new Error(`${It} encountered BigInt larger than allowable range`)}}i(cn,"encodeUintValue");Li.encodedSize=i(function(t){return cn.encodedSize(t.value)},"encodedSize");cn.encodedSize=i(function(t){return t<Qr[0]?1:t<Qr[1]?2:t<Qr[2]?3:t<Qr[3]?5:9},"encodedSize");Li.compareTokens=i(function(t,r){return t.value<r.value?-1:t.value>r.value?1:0},"compareTokens");function Y8(e,t,r,n){return new Qe(Ne.negint,-1-li(e,t+1,n),2)}i(Y8,"decodeNegint8");function X8(e,t,r,n){return new Qe(Ne.negint,-1-fi(e,t+1,n),3)}i(X8,"decodeNegint16");function Q8(e,t,r,n){return new Qe(Ne.negint,-1-di(e,t+1,n),5)}i(Q8,"decodeNegint32");var yv=BigInt(-1),eE=BigInt(1);function tE(e,t,r,n){let a=hi(e,t+1,n);if(typeof a!="bigint"){let s=-1-a;if(s>=Number.MIN_SAFE_INTEGER)return new Qe(Ne.negint,s,9)}if(n.allowBigInt!==!0)throw new Error(`${It} integers outside of the safe integer range are not supported`);return new Qe(Ne.negint,yv-BigInt(a),9)}i(tE,"decodeNegint64");function up(e,t){let r=t.value,n=typeof r=="bigint"?r*yv-eE:r*-1-1;cn(e,t.type.majorEncoded,n)}i(up,"encodeNegint");up.encodedSize=i(function(t){let r=t.value,n=typeof r=="bigint"?r*yv-eE:r*-1-1;return n<Qr[0]?1:n<Qr[1]?2:n<Qr[2]?3:n<Qr[3]?5:9},"encodedSize");up.compareTokens=i(function(t,r){return t.value<r.value?1:t.value>r.value?-1:0},"compareTokens");function Ef(e,t,r,n){ho(e,t,r+n);let a=hu(e,t+r,t+r+n);return new Qe(Ne.bytes,a,r+n)}i(Ef,"toToken");function rE(e,t,r,n){return Ef(e,t,1,r)}i(rE,"decodeBytesCompact");function nE(e,t,r,n){return Ef(e,t,2,li(e,t+1,n))}i(nE,"decodeBytes8");function iE(e,t,r,n){return Ef(e,t,3,fi(e,t+1,n))}i(iE,"decodeBytes16");function aE(e,t,r,n){return Ef(e,t,5,di(e,t+1,n))}i(aE,"decodeBytes32");function oE(e,t,r,n){let a=hi(e,t+1,n);if(typeof a=="bigint")throw new Error(`${It} 64-bit integer bytes lengths not supported`);return Ef(e,t,9,a)}i(oE,"decodeBytes64");function lp(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Ne.string?H8(e.value):e.value),e.encodedBytes}i(lp,"tokenBytes");function mu(e,t){let r=lp(t);cn(e,t.type.majorEncoded,r.length),e.push(r)}i(mu,"encodeBytes");mu.encodedSize=i(function(t){let r=lp(t);return cn.encodedSize(r.length)+r.length},"encodedSize");mu.compareTokens=i(function(t,r){return HN(lp(t),lp(r))},"compareTokens");function HN(e,t){return e.length<t.length?-1:e.length>t.length?1:K8(e,t)}i(HN,"compareBytes");function Af(e,t,r,n,a){let s=r+n;ho(e,t,s);let c=new Qe(Ne.string,z8(e,t+r,t+s),s);return a.retainStringBytes===!0&&(c.byteValue=hu(e,t+r,t+s)),c}i(Af,"toToken");function sE(e,t,r,n){return Af(e,t,1,r,n)}i(sE,"decodeStringCompact");function cE(e,t,r,n){return Af(e,t,2,li(e,t+1,n),n)}i(cE,"decodeString8");function uE(e,t,r,n){return Af(e,t,3,fi(e,t+1,n),n)}i(uE,"decodeString16");function lE(e,t,r,n){return Af(e,t,5,di(e,t+1,n),n)}i(lE,"decodeString32");function fE(e,t,r,n){let a=hi(e,t+1,n);if(typeof a=="bigint")throw new Error(`${It} 64-bit integer string lengths not supported`);return Af(e,t,9,a,n)}i(fE,"decodeString64");var dE=mu;function gu(e,t,r,n){return new Qe(Ne.array,n,r)}i(gu,"toToken");function hE(e,t,r,n){return gu(e,t,1,r)}i(hE,"decodeArrayCompact");function pE(e,t,r,n){return gu(e,t,2,li(e,t+1,n))}i(pE,"decodeArray8");function mE(e,t,r,n){return gu(e,t,3,fi(e,t+1,n))}i(mE,"decodeArray16");function gE(e,t,r,n){return gu(e,t,5,di(e,t+1,n))}i(gE,"decodeArray32");function vE(e,t,r,n){let a=hi(e,t+1,n);if(typeof a=="bigint")throw new Error(`${It} 64-bit integer array lengths not supported`);return gu(e,t,9,a)}i(vE,"decodeArray64");function yE(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${It} indefinite length items not allowed`);return gu(e,t,1,1/0)}i(yE,"decodeArrayIndefinite");function fp(e,t){cn(e,Ne.array.majorEncoded,t.value)}i(fp,"encodeArray");fp.compareTokens=Li.compareTokens;fp.encodedSize=i(function(t){return cn.encodedSize(t.value)},"encodedSize");function vu(e,t,r,n){return new Qe(Ne.map,n,r)}i(vu,"toToken");function bE(e,t,r,n){return vu(e,t,1,r)}i(bE,"decodeMapCompact");function wE(e,t,r,n){return vu(e,t,2,li(e,t+1,n))}i(wE,"decodeMap8");function _E(e,t,r,n){return vu(e,t,3,fi(e,t+1,n))}i(_E,"decodeMap16");function EE(e,t,r,n){return vu(e,t,5,di(e,t+1,n))}i(EE,"decodeMap32");function AE(e,t,r,n){let a=hi(e,t+1,n);if(typeof a=="bigint")throw new Error(`${It} 64-bit integer map lengths not supported`);return vu(e,t,9,a)}i(AE,"decodeMap64");function SE(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${It} indefinite length items not allowed`);return vu(e,t,1,1/0)}i(SE,"decodeMapIndefinite");function dp(e,t){cn(e,Ne.map.majorEncoded,t.value)}i(dp,"encodeMap");dp.compareTokens=Li.compareTokens;dp.encodedSize=i(function(t){return cn.encodedSize(t.value)},"encodedSize");function xE(e,t,r,n){return new Qe(Ne.tag,r,1)}i(xE,"decodeTagCompact");function TE(e,t,r,n){return new Qe(Ne.tag,li(e,t+1,n),2)}i(TE,"decodeTag8");function CE(e,t,r,n){return new Qe(Ne.tag,fi(e,t+1,n),3)}i(CE,"decodeTag16");function ME(e,t,r,n){return new Qe(Ne.tag,di(e,t+1,n),5)}i(ME,"decodeTag32");function IE(e,t,r,n){return new Qe(Ne.tag,hi(e,t+1,n),9)}i(IE,"decodeTag64");function hp(e,t){cn(e,Ne.tag.majorEncoded,t.value)}i(hp,"encodeTag");hp.compareTokens=Li.compareTokens;hp.encodedSize=i(function(t){return cn.encodedSize(t.value)},"encodedSize");var JN=20,ZN=21,YN=22,XN=23;function kE(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${It} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Qe(Ne.null,null,1):new Qe(Ne.undefined,void 0,1)}i(kE,"decodeUndefined");function DE(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${It} indefinite length items not allowed`);return new Qe(Ne.break,void 0,1)}i(DE,"decodeBreak");function bv(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${It} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${It} Infinity values are not supported`)}return new Qe(Ne.float,e,t)}i(bv,"createToken");function RE(e,t,r,n){return bv(wv(e,t+1),3,n)}i(RE,"decodeFloat16");function OE(e,t,r,n){return bv(_v(e,t+1),5,n)}i(OE,"decodeFloat32");function NE(e,t,r,n){return bv(UE(e,t+1),9,n)}i(NE,"decodeFloat64");function pp(e,t,r){let n=t.value;if(n===!1)e.push([Ne.float.majorEncoded|JN]);else if(n===!0)e.push([Ne.float.majorEncoded|ZN]);else if(n===null)e.push([Ne.float.majorEncoded|YN]);else if(n===void 0)e.push([Ne.float.majorEncoded|XN]);else{let a,s=!1;(!r||r.float64!==!0)&&(BE(n),a=wv(na,1),n===a||Number.isNaN(n)?(na[0]=249,e.push(na.slice(0,3)),s=!0):(LE(n),a=_v(na,1),n===a&&(na[0]=250,e.push(na.slice(0,5)),s=!0))),s||(QN(n),a=UE(na,1),na[0]=251,e.push(na.slice(0,9)))}}i(pp,"encodeFloat");pp.encodedSize=i(function(t,r){let n=t.value;if(n===!1||n===!0||n===null||n===void 0)return 1;if(!r||r.float64!==!0){BE(n);let a=wv(na,1);if(n===a||Number.isNaN(n))return 3;if(LE(n),a=_v(na,1),n===a)return 5}return 9},"encodedSize");var PE=new ArrayBuffer(9),Ui=new DataView(PE,1),na=new Uint8Array(PE,0);function BE(e){if(e===1/0)Ui.setUint16(0,31744,!1);else if(e===-1/0)Ui.setUint16(0,64512,!1);else if(Number.isNaN(e))Ui.setUint16(0,32256,!1);else{Ui.setFloat32(0,e);let t=Ui.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Ui.setUint16(0,31744,!1);else if(r===0)Ui.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let a=r-127;a<-24?Ui.setUint16(0,0):a<-14?Ui.setUint16(0,(t&2147483648)>>16|1<<24+a,!1):Ui.setUint16(0,(t&2147483648)>>16|a+15<<10|n>>13,!1)}}}i(BE,"encodeFloat16");function wv(e,t){if(e.length-t<2)throw new Error(`${It} not enough data for float16`);let r=(e[t]<<8)+e[t+1];if(r===31744)return 1/0;if(r===64512)return-1/0;if(r===32256)return NaN;let n=r>>10&31,a=r&1023,s;return n===0?s=a*2**-24:n!==31?s=(a+1024)*2**(n-25):s=a===0?1/0:NaN,r&32768?-s:s}i(wv,"readFloat16");function LE(e){Ui.setFloat32(0,e,!1)}i(LE,"encodeFloat32");function _v(e,t){if(e.length-t<4)throw new Error(`${It} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}i(_v,"readFloat32");function QN(e){Ui.setFloat64(0,e,!1)}i(QN,"encodeFloat64");function UE(e,t){if(e.length-t<8)throw new Error(`${It} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}i(UE,"readFloat64");pp.compareTokens=Li.compareTokens;function ur(e,t,r){throw new Error(`${It} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}i(ur,"invalidMinor");function mp(e){return()=>{throw new Error(`${It} ${e}`)}}i(mp,"errorer");var We=[];for(let e=0;e<=23;e++)We[e]=ur;We[24]=G8;We[25]=W8;We[26]=J8;We[27]=Z8;We[28]=ur;We[29]=ur;We[30]=ur;We[31]=ur;for(let e=32;e<=55;e++)We[e]=ur;We[56]=Y8;We[57]=X8;We[58]=Q8;We[59]=tE;We[60]=ur;We[61]=ur;We[62]=ur;We[63]=ur;for(let e=64;e<=87;e++)We[e]=rE;We[88]=nE;We[89]=iE;We[90]=aE;We[91]=oE;We[92]=ur;We[93]=ur;We[94]=ur;We[95]=mp("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)We[e]=sE;We[120]=cE;We[121]=uE;We[122]=lE;We[123]=fE;We[124]=ur;We[125]=ur;We[126]=ur;We[127]=mp("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)We[e]=hE;We[152]=pE;We[153]=mE;We[154]=gE;We[155]=vE;We[156]=ur;We[157]=ur;We[158]=ur;We[159]=yE;for(let e=160;e<=183;e++)We[e]=bE;We[184]=wE;We[185]=_E;We[186]=EE;We[187]=AE;We[188]=ur;We[189]=ur;We[190]=ur;We[191]=SE;for(let e=192;e<=215;e++)We[e]=xE;We[216]=TE;We[217]=CE;We[218]=ME;We[219]=IE;We[220]=ur;We[221]=ur;We[222]=ur;We[223]=ur;for(let e=224;e<=243;e++)We[e]=mp("simple values are not supported");We[244]=ur;We[245]=ur;We[246]=ur;We[247]=kE;We[248]=mp("simple values are not supported");We[249]=RE;We[250]=OE;We[251]=NE;We[252]=ur;We[253]=ur;We[254]=ur;We[255]=DE;var ia=[];for(let e=0;e<24;e++)ia[e]=new Qe(Ne.uint,e,1);for(let e=-1;e>=-24;e--)ia[31-e]=new Qe(Ne.negint,e,1);ia[64]=new Qe(Ne.bytes,new Uint8Array(0),1);ia[96]=new Qe(Ne.string,"",1);ia[128]=new Qe(Ne.array,0,1);ia[160]=new Qe(Ne.map,0,1);ia[244]=new Qe(Ne.false,!1,1);ia[245]=new Qe(Ne.true,!0,1);ia[246]=new Qe(Ne.null,null,1);function FE(e){switch(e.type){case Ne.false:return Ra([244]);case Ne.true:return Ra([245]);case Ne.null:return Ra([246]);case Ne.bytes:return e.value.length?void 0:Ra([64]);case Ne.string:return e.value===""?Ra([96]):void 0;case Ne.array:return e.value===0?Ra([128]):void 0;case Ne.map:return e.value===0?Ra([160]):void 0;case Ne.uint:return e.value<24?Ra([Number(e.value)]):void 0;case Ne.negint:if(e.value>=-24)return Ra([31-Number(e.value)])}}i(FE,"quickEncodeToken");var tP={float64:!1,mapSorter:iP,quickEncodeToken:FE};function rP(){let e=[];return e[Ne.uint.major]=Li,e[Ne.negint.major]=up,e[Ne.bytes.major]=mu,e[Ne.string.major]=dE,e[Ne.array.major]=fp,e[Ne.map.major]=dp,e[Ne.tag.major]=hp,e[Ne.float.major]=pp,e}i(rP,"makeCborEncoders");var jE=rP(),Ev=new pu,Gs=class{constructor(t,r){this.obj=t,this.parent=r}includes(t){let r=this;do if(r.obj===t)return!0;while(r=r.parent);return!1}static createCheck(t,r){if(t&&t.includes(r))throw new Error(`${vv} object contains circular references`);return new Gs(r,t)}};i(Gs,"Ref");var Go={null:new Qe(Ne.null,null),undefined:new Qe(Ne.undefined,void 0),true:new Qe(Ne.true,!0),false:new Qe(Ne.false,!1),emptyArray:new Qe(Ne.array,0),emptyMap:new Qe(Ne.map,0)},Wo={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new Qe(Ne.float,e):e>=0?new Qe(Ne.uint,e):new Qe(Ne.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new Qe(Ne.uint,e):new Qe(Ne.negint,e)},Uint8Array(e,t,r,n){return new Qe(Ne.bytes,e)},string(e,t,r,n){return new Qe(Ne.string,e)},boolean(e,t,r,n){return e?Go.true:Go.false},null(e,t,r,n){return Go.null},undefined(e,t,r,n){return Go.undefined},ArrayBuffer(e,t,r,n){return new Qe(Ne.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new Qe(Ne.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[Go.emptyArray,new Qe(Ne.break)]:Go.emptyArray;n=Gs.createCheck(n,e);let a=[],s=0;for(let c of e)a[s++]=gp(c,r,n);return r.addBreakTokens?[new Qe(Ne.array,e.length),a,new Qe(Ne.break)]:[new Qe(Ne.array,e.length),a]},Object(e,t,r,n){let a=t!=="Object",s=a?e.keys():Object.keys(e),c=a?e.size:s.length;if(!c)return r.addBreakTokens===!0?[Go.emptyMap,new Qe(Ne.break)]:Go.emptyMap;n=Gs.createCheck(n,e);let l=[],h=0;for(let p of s)l[h++]=[gp(p,r,n),gp(a?e.get(p):e[p],r,n)];return nP(l,r),r.addBreakTokens?[new Qe(Ne.map,c),l,new Qe(Ne.break)]:[new Qe(Ne.map,c),l]}};Wo.Map=Wo.Object;Wo.Buffer=Wo.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Wo[`${e}Array`]=Wo.DataView;function gp(e,t={},r){let n=U8(e),a=t&&t.typeEncoders&&t.typeEncoders[n]||Wo[n];if(typeof a=="function"){let c=a(e,n,t,r);if(c!=null)return c}let s=Wo[n];if(!s)throw new Error(`${vv} unsupported type: ${n}`);return s(e,n,t,r)}i(gp,"objectToTokens");function nP(e,t){t.mapSorter&&e.sort(t.mapSorter)}i(nP,"sortMapEntries");function iP(e,t){let r=Array.isArray(e[0])?e[0][0]:e[0],n=Array.isArray(t[0])?t[0][0]:t[0];if(r.type!==n.type)return r.type.compare(n.type);let a=r.type.major,s=jE[a].compareTokens(r,n);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}i(iP,"mapSorter");function $E(e,t,r,n){if(Array.isArray(t))for(let a of t)$E(e,a,r,n);else r[t.type.major](e,t,n)}i($E,"tokensToEncoded");function aP(e,t,r){let n=gp(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let a=r.quickEncodeToken(n);if(a)return a;let s=t[n.type.major];if(s.encodedSize){let c=s.encodedSize(n,r),l=new pu(c);if(s(l,n,r),l.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return gv(l.chunks[0])}}return Ev.reset(),$E(Ev,n,t,r),Ev.toBytes(!0)}i(aP,"encodeCustom");function Av(e,t){return t=Object.assign({},tP,t),aP(e,jE,t)}i(Av,"encode");var oP={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},vp=class{constructor(t,r={}){this.pos=0,this.data=t,this.options=r}done(){return this.pos>=this.data.length}next(){let t=this.data[this.pos],r=ia[t];if(r===void 0){let n=We[t];if(!n)throw new Error(`${It} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let a=t&31;r=n(this.data,this.pos,a,this.options)}return this.pos+=r.encodedLength,r}};i(vp,"Tokeniser");var Sf=Symbol.for("DONE"),yp=Symbol.for("BREAK");function sP(e,t,r){let n=[];for(let a=0;a<e.value;a++){let s=xf(t,r);if(s===yp){if(e.value===1/0)break;throw new Error(`${It} got unexpected break to lengthed array`)}if(s===Sf)throw new Error(`${It} found array but not enough entries (got ${a}, expected ${e.value})`);n[a]=s}return n}i(sP,"tokenToArray");function cP(e,t,r){let n=r.useMaps===!0,a=n?void 0:{},s=n?new Map:void 0;for(let c=0;c<e.value;c++){let l=xf(t,r);if(l===yp){if(e.value===1/0)break;throw new Error(`${It} got unexpected break to lengthed map`)}if(l===Sf)throw new Error(`${It} found map but not enough entries (got ${c} [no key], expected ${e.value})`);if(n!==!0&&typeof l!="string")throw new Error(`${It} non-string keys not supported (got ${typeof l})`);if(r.rejectDuplicateMapKeys===!0&&(n&&s.has(l)||!n&&l in a))throw new Error(`${It} found repeat map key "${l}"`);let h=xf(t,r);if(h===Sf)throw new Error(`${It} found map but not enough entries (got ${c} [no value], expected ${e.value})`);n?s.set(l,h):a[l]=h}return n?s:a}i(cP,"tokenToMap");function xf(e,t){if(e.done())return Sf;let r=e.next();if(r.type===Ne.break)return yp;if(r.type.terminal)return r.value;if(r.type===Ne.array)return sP(r,e,t);if(r.type===Ne.map)return cP(r,e,t);if(r.type===Ne.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=xf(e,t);return t.tags[r.value](n)}throw new Error(`${It} tag not supported (${r.value})`)}throw new Error("unsupported")}i(xf,"tokensToObject");function Sv(e,t){if(!(e instanceof Uint8Array))throw new Error(`${It} data to decode must be a Uint8Array`);t=Object.assign({},oP,t);let r=t.tokenizer||new vp(e,t),n=xf(r,t);if(n===Sf)throw new Error(`${It} did not find any content to decode`);if(n===yp)throw new Error(`${It} got unexpected break`);if(!r.done())throw new Error(`${It} too many terminals, data makes no sense`);return n}i(Sv,"decode");var zE=42;function lP(e){if(e.asCID!==e)return null;let t=Ft.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new Qe(Ne.tag,zE),new Qe(Ne.bytes,r)]}i(lP,"cidEncoder");function fP(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}i(fP,"undefinedEncoder");function dP(e){if(Number.isNaN(e))throw new Error("`NaN` is not supported by the IPLD Data Model and cannot be encoded");if(e===1/0||e===-1/0)throw new Error("`Infinity` and `-Infinity` is not supported by the IPLD Data Model and cannot be encoded");return null}i(dP,"numberEncoder");var hP={float64:!0,typeEncoders:{Object:lP,undefined:fP,number:dP}};function pP(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ft.decode(e.subarray(1))}i(pP,"cidDecoder");var HE={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};HE.tags[zE]=pP;var mP="dag-cbor",gP=113,xv=i(e=>Av(e,hP),"encode"),vP=i(e=>Sv(e,HE),"decode");function yu(e){try{return e()}catch(t){return t}}i(yu,"tryCatch");var Tv=Hs(ip(),1);function Ws(e){let t=Tv.default.decode(e),r=Tv.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(Ws,"readVarint");function yP(e){return e===0||e===1}i(yP,"isCidVersion");function Cv(e){let[t,r]=Ws(e);if(!yP(t))throw new Error(`Unknown CID version ${t}`);let[n,a]=Ws(r),[,s,c]=Ws(a),[l,,h]=Ws(s),p=a.subarray(0,c+h+l),g=a.subarray(c+h+l);return[Ft.create(t,n,Yh(p)),g]}i(Cv,"readCid");function Js(e,t="StreamRef"){let[r,n]=Ws(e);if(r!==206)throw new Error(`Invalid ${t}, does not include streamid codec`);let[a,s]=Ws(n),c=Cv(s),[l,h]=c;if(h.length===0)return{kind:"stream-id",type:a,genesis:l};if(h.length===1&&h[0]===0)return{kind:"commit-id",type:a,genesis:l,commit:null};{let[p]=Cv(h);return{kind:"commit-id",type:a,genesis:l,commit:p}}}i(Js,"fromBytes");var bP=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function bu(e,t="StreamRef"){let r=bP.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let a=ta.decode(n),s=Js(a),c=r[4];return c?{kind:"commit-id",type:s.type,genesis:s.genesis,commit:Mv(s.genesis,c)}:s}i(bu,"fromString");function wP(e){try{return typeof e=="string"?Ft.parse(e):Ft.asCID(e)}catch{return null}}i(wP,"parseCID");function Mv(e,t=null){if(!t||t==="0")return null;let r=wP(t);if(r)return e.equals(r)?null:r;throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)")}i(Mv,"parseCommit");var Tf=function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},Fi=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},wp=class extends Error{constructor(t){super(`Invalid StreamID bytes ${ta.encode(t)}: contains commit`)}};i(wp,"InvalidStreamIDBytesError");var _p=class extends Error{constructor(t){super(`Invalid StreamID string ${t}: contains commit`)}};i(_p,"InvalidStreamIDStringError");function KE(e){let t=Js(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new wp(e)}i(KE,"fromBytes");function _P(e){return yu(()=>KE(e))}i(_P,"fromBytesNoThrow");function GE(e){let t=bu(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new _p(e)}i(GE,"fromString");function EP(e){return yu(()=>GE(e))}i(EP,"fromStringNoThrow");var VE=Symbol.for("@ceramicnetwork/streamid/StreamID"),Yt=class{constructor(t,r){if(this._tag=VE,!(t||t===0))throw new Error("StreamID constructor: type required");if(!r)throw new Error("StreamID constructor: cid required");this._type=typeof t=="string"?ra.codeByName(t):t,this._cid=typeof r=="string"?Ft.parse(r):r}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===VE}static async fromGenesis(t,r){let n=await L8({value:r,codec:bp,hasher:ov});return new Yt(t,n.cid)}get type(){return this._type}get typeName(){return ra.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let t=kv.default.encode(206),r=kv.default.encode(this.type);return wf([t,r,this.cid.bytes])}get baseID(){return new Yt(this._type,this._cid)}equals(t){return Yt.isInstance(t)?this.type===t.type&&this.cid.equals(t.cid):!1}toString(){return ta.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[Symbol.for("nodejs.util.inspect.custom")](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};i(Yt,"StreamID");Yt.fromBytes=KE;Yt.fromBytesNoThrow=_P;Yt.fromString=GE;Yt.fromStringNoThrow=EP;Tf([ui(),Fi("design:type",String),Fi("design:paramtypes",[])],Yt.prototype,"typeName",null);Tf([ui(),Fi("design:type",Uint8Array),Fi("design:paramtypes",[])],Yt.prototype,"bytes",null);Tf([ui(),Fi("design:type",Yt),Fi("design:paramtypes",[])],Yt.prototype,"baseID",null);Tf([ui(),Fi("design:type",Function),Fi("design:paramtypes",[]),Fi("design:returntype",String)],Yt.prototype,"toString",null);Tf([ui(),Fi("design:type",Function),Fi("design:paramtypes",[]),Fi("design:returntype",String)],Yt.prototype,"toUrl",null);var _u=function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},Kn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Dv=function(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r},po=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},wu,Zs,Cf,Ep=class extends Error{constructor(t){super(`Error while parsing CommitID from bytes ${ta.encode(t)}: no commit information provided`)}};i(Ep,"InvalidCommitIDBytesError");var Ap=class extends Error{constructor(t){super(`Error while parsing CommitID from string ${t}: no commit information provided`)}};i(Ap,"InvalidCommitIDStringError");function JE(e){let t=Js(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new Ep(e)}i(JE,"fromBytes");function AP(e){return yu(()=>JE(e))}i(AP,"fromBytesNoThrow");function ZE(e){let t=bu(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new Ap(e)}i(ZE,"fromString");function SP(e){return yu(()=>ZE(e))}i(SP,"fromStringNoThrow");var WE=Symbol.for("@ceramicnetwork/streamid/CommitID");function xP(e,t){return new hr(e.type,e.cid,t)}i(xP,"make");var hr=class{constructor(t,r,n=null){if(this._tag=WE,wu.set(this,void 0),Zs.set(this,void 0),Cf.set(this,void 0),!t&&t!==0)throw new Error("constructor: type required");if(!r)throw new Error("constructor: cid required");Dv(this,wu,typeof t=="string"?ra.codeByName(t):t,"f"),Dv(this,Zs,typeof r=="string"?Ft.parse(r):r,"f"),Dv(this,Cf,Mv(po(this,Zs,"f"),n),"f")}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===WE}get baseID(){return new Yt(po(this,wu,"f"),po(this,Zs,"f"))}get type(){return po(this,wu,"f")}get typeName(){return ra.nameByCode(po(this,wu,"f"))}get cid(){return po(this,Zs,"f")}get commit(){return po(this,Cf,"f")||po(this,Zs,"f")}get bytes(){let t=Rv.default.encode(206),r=Rv.default.encode(this.type),n=po(this,Cf,"f")?.bytes||new Uint8Array([0]);return wf([t,r,this.cid.bytes,n])}equals(t){return this.type===t.type&&this.cid.equals(t.cid)&&this.commit.equals(t.commit)}toString(){return ta.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(wu=new WeakMap,Zs=new WeakMap,Cf=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};i(hr,"CommitID");hr.fromBytes=JE;hr.fromBytesNoThrow=AP;hr.fromString=ZE;hr.fromStringNoThrow=SP;hr.make=xP;_u([ui(),Kn("design:type",Yt),Kn("design:paramtypes",[])],hr.prototype,"baseID",null);_u([ui(),Kn("design:type",String),Kn("design:paramtypes",[])],hr.prototype,"typeName",null);_u([ui(),Kn("design:type",Ft),Kn("design:paramtypes",[])],hr.prototype,"commit",null);_u([ui(),Kn("design:type",Uint8Array),Kn("design:paramtypes",[])],hr.prototype,"bytes",null);_u([ui(),Kn("design:type",Function),Kn("design:paramtypes",[]),Kn("design:returntype",String)],hr.prototype,"toString",null);_u([ui(),Kn("design:type",Function),Kn("design:paramtypes",[]),Kn("design:returntype",String)],hr.prototype,"toUrl",null);var Ys;(function(e){function t(a){let s=Js(a);switch(s.kind){case"commit-id":return new hr(s.type,s.genesis,s.commit);case"stream-id":return new Yt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef bytes: ${ta.encode(a)}`)}}i(t,"fromBytes"),e.fromBytes=t;function r(a){let s=bu(a);switch(s.kind){case"commit-id":return new hr(s.type,s.genesis,s.commit);case"stream-id":return new Yt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef string: ${a}`)}}i(r,"fromString"),e.fromString=r;function n(a){if(Yt.isInstance(a)||hr.isInstance(a))return a;if(a instanceof Uint8Array)return t(a);if(typeof a=="string")return r(a);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(a)}`)}i(n,"from"),e.from=n})(Ys||(Ys={}));var YE="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",Sp="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var Ov={};En(Ov,{JsonPatchError:()=>Lr,_areEquals:()=>kf,applyOperation:()=>Xs,applyPatch:()=>Dp,applyReducer:()=>kP,deepClone:()=>MP,getValueByPointer:()=>Ip,validate:()=>QE,validator:()=>kp});var TP=function(){var e=i(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},e(t,r)},"extendStatics");return function(t,r){e(t,r);function n(){this.constructor=t}i(n,"__"),t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),CP=Object.prototype.hasOwnProperty;function Tp(e,t){return CP.call(e,t)}i(Tp,"hasOwnProperty");function Cp(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var a in e)Tp(e,a)&&n.push(a);return n}i(Cp,"_objectKeys");function un(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(un,"_deepClone");function Mp(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}i(Mp,"isInteger");function Oa(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(Oa,"escapePathComponent");function Mf(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i(Mf,"unescapePathComponent");function xp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(xp(e[t]))return!0}else if(typeof e=="object"){for(var n=Cp(e),a=n.length,s=0;s<a;s++)if(xp(e[n[s]]))return!0}}return!1}i(xp,"hasUndefined");function XE(e,t){var r=[e];for(var n in t){var a=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof a<"u"&&r.push(n+": "+a)}return r.join(`
22
22
  `)}i(XE,"patchErrorMessageFormatter");var If=function(e){TP(t,e);function t(r,n,a,s,c){var l=this.constructor,h=e.call(this,XE(r,{name:n,index:a,operation:s,tree:c}))||this;return h.name=n,h.index=a,h.operation=s,h.tree=c,Object.setPrototypeOf(h,l.prototype),h.message=XE(r,{name:n,index:a,operation:s,tree:c}),h}return i(t,"PatchError"),t}(Error);var Lr=If,MP=un,Eu={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=Ip(r,this.path);n&&(n=un(n));var a=Xs(r,{op:"remove",path:this.from}).removed;return Xs(r,{op:"add",path:this.path,value:a}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Ip(r,this.from);return Xs(r,{op:"add",path:this.path,value:un(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:kf(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},IP={add:function(e,t,r){return Mp(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Eu.move,copy:Eu.copy,test:Eu.test,_get:Eu._get};function Ip(e,t){if(t=="")return e;var r={op:"_get",path:t};return Xs(e,r),r.value}i(Ip,"getValueByPointer");function Xs(e,t,r,n,a,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),a===void 0&&(a=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(t,0,e,t.path):kp(t,0)),t.path===""){var c={newDocument:e};if(t.op==="add")return c.newDocument=t.value,c;if(t.op==="replace")return c.newDocument=t.value,c.removed=e,c;if(t.op==="move"||t.op==="copy")return c.newDocument=Ip(e,t.from),t.op==="move"&&(c.removed=e),c;if(t.op==="test"){if(c.test=kf(e,t.value),c.test===!1)throw new Lr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c.newDocument=e,c}else{if(t.op==="remove")return c.removed=e,c.newDocument=null,c;if(t.op==="_get")return t.value=e,c;if(r)throw new Lr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e);return c}}else{n||(e=un(e));var l=t.path||"",h=l.split("/"),p=e,g=1,v=h.length,y=void 0,_=void 0,x=void 0;for(typeof r=="function"?x=r:x=kp;;){if(_=h[g],_&&_.indexOf("~")!=-1&&(_=Mf(_)),a&&(_=="__proto__"||_=="prototype"&&g>0&&h[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&y===void 0&&(p[_]===void 0?y=h.slice(0,g).join("/"):g==v-1&&(y=t.path),y!==void 0&&x(t,0,e,y)),g++,Array.isArray(p)){if(_==="-")_=p.length;else{if(r&&!Mp(_))throw new Lr("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,t,e);Mp(_)&&(_=~~_)}if(g>=v){if(r&&t.op==="add"&&_>p.length)throw new Lr("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);var c=IP[t.op].call(t,p,_,e);if(c.test===!1)throw new Lr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}}else if(g>=v){var c=Eu[t.op].call(t,p,_,e);if(c.test===!1)throw new Lr("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}if(p=p[_],r&&g<v&&(!p||typeof p!="object"))throw new Lr("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}}i(Xs,"applyOperation");function Dp(e,t,r,n,a){if(n===void 0&&(n=!0),a===void 0&&(a=!0),r&&!Array.isArray(t))throw new Lr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=un(e));for(var s=new Array(t.length),c=0,l=t.length;c<l;c++)s[c]=Xs(e,t[c],r,!0,a,c),e=s[c].newDocument;return s.newDocument=e,s}i(Dp,"applyPatch");function kP(e,t,r){var n=Xs(e,t);if(n.test===!1)throw new Lr("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}i(kP,"applyReducer");function kp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Lr("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Eu[e.op]){if(typeof e.path!="string")throw new Lr("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Lr('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Lr("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Lr("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&xp(e.value))throw new Lr("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var a=e.path.split("/").length,s=n.split("/").length;if(a!==s+1&&a!==s)throw new Lr("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Lr("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var c={op:"_get",path:e.from,value:void 0},l=QE([c],r);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new Lr("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Lr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}i(kp,"validator");function QE(e,t,r){try{if(!Array.isArray(e))throw new Lr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Dp(un(t),un(e),r||!0);else{r=r||kp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(a){if(a instanceof Lr)return a;throw a}}i(QE,"validate");function kf(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),a,s,c;if(r&&n){if(s=e.length,s!=t.length)return!1;for(a=s;a--!==0;)if(!kf(e[a],t[a]))return!1;return!0}if(r!=n)return!1;var l=Object.keys(e);if(s=l.length,s!==Object.keys(t).length)return!1;for(a=s;a--!==0;)if(!t.hasOwnProperty(l[a]))return!1;for(a=s;a--!==0;)if(c=l[a],!kf(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(kf,"_areEquals");var Lv={};En(Lv,{compare:()=>UP,generate:()=>Nv,observe:()=>LP,unobserve:()=>BP});var Pv=new WeakMap,DP=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror"),e}(),RP=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo"),e}();function OP(e){return Pv.get(e)}i(OP,"getMirror");function NP(e,t){return e.observers.get(t)}i(NP,"getObserverFromMirror");function PP(e,t){e.observers.delete(t.callback)}i(PP,"removeObserverFromMirror");function BP(e,t){t.unobserve()}i(BP,"unobserve");function LP(e,t){var r=[],n,a=OP(e);if(!a)a=new DP(e),Pv.set(e,a);else{var s=NP(a,t);n=s&&s.observer}if(n)return n;if(n={},a.value=un(e),t){n.callback=t,n.next=null;var c=i(function(){Nv(n)},"dirtyCheck"),l=i(function(){clearTimeout(n.next),n.next=setTimeout(c)},"fastCheck");typeof window<"u"&&(window.addEventListener("mouseup",l),window.addEventListener("keyup",l),window.addEventListener("mousedown",l),window.addEventListener("keydown",l),window.addEventListener("change",l))}return n.patches=r,n.object=e,n.unobserve=function(){Nv(n),clearTimeout(n.next),PP(a,n),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},a.observers.set(t,new RP(t,n)),n}i(LP,"observe");function Nv(e,t){t===void 0&&(t=!1);var r=Pv.get(e.object);Bv(r.value,e.object,e.patches,"",t),e.patches.length&&Dp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(Nv,"generate");function Bv(e,t,r,n,a){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=Cp(t),c=Cp(e),l=!1,h=!1,p=c.length-1;p>=0;p--){var g=c[p],v=e[g];if(Tp(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var y=t[g];typeof v=="object"&&v!=null&&typeof y=="object"&&y!=null&&Array.isArray(v)===Array.isArray(y)?Bv(v,y,r,n+"/"+Oa(g),a):v!==y&&(l=!0,a&&r.push({op:"test",path:n+"/"+Oa(g),value:un(v)}),r.push({op:"replace",path:n+"/"+Oa(g),value:un(y)}))}else Array.isArray(e)===Array.isArray(t)?(a&&r.push({op:"test",path:n+"/"+Oa(g),value:un(v)}),r.push({op:"remove",path:n+"/"+Oa(g)}),h=!0):(a&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),l=!0)}if(!(!h&&s.length==c.length))for(var p=0;p<s.length;p++){var g=s[p];!Tp(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+Oa(g),value:un(t[g])})}}}i(Bv,"_generate");function UP(e,t,r){r===void 0&&(r=!1);var n=[];return Bv(e,t,n,"",r),n}i(UP,"compare");var e9=Object.assign({},Ov,Lv,{JsonPatchError:If,deepClone:un,escapePathComponent:Oa,unescapePathComponent:Mf});var _7=Hs(Xv(),1);var E7=Hs(n7(),1);var rc;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(rc||(rc={}));var gy=Hs(Xv(),1);var oy=i(function(e,t){return oy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},oy(e,t)},"extendStatics");function sy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");oy(e,t);function r(){this.constructor=e}i(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(sy,"__extends");function cy(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}i(cy,"__values");function Cu(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),a,s=[],c;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)s.push(a.value)}catch(l){c={error:l}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}i(Cu,"__read");function Mu(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}i(Mu,"__spreadArray");function ji(e){return typeof e=="function"}i(ji,"isFunction");function i7(e){var t=i(function(n){Error.call(n),n.stack=new Error().stack},"_super"),r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}i(i7,"createErrorClass");var Wp=i7(function(e){return i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
23
23
  `+r.map(function(n,a){return a+1+") "+n.toString()}).join(`
24
- `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function uy(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(uy,"arrRemove");var Jp=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,a,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=cy(c),h=l.next();!h.done;h=l.next()){var p=h.value;p.remove(this)}}catch(O){t={error:O}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var g=this.initialTeardown;if(ji(g))try{g()}catch(O){s=O instanceof Wp?O.errors:[O]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=cy(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{a7(x)}catch(O){s=s??[],O instanceof Wp?s=Mu(Mu([],Cu(s)),Cu(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}if(s)throw new Wp(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)a7(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&uy(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&uy(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var kJ=Jp.EMPTY;function Zp(e){return e instanceof Jp||e&&"closed"in e&&ji(e.remove)&&ji(e.add)&&ji(e.unsubscribe)}i(Zp,"isSubscription");function a7(e){ji(e)?e():e.unsubscribe()}i(a7,"execFinalizer");var aa={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Iu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=Iu.delegate;return a?.setTimeout?a.setTimeout.apply(a,Mu([e,t],Cu(r))):setTimeout.apply(void 0,Mu([e,t],Cu(r)))},clearTimeout:function(e){var t=Iu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function o7(e){Iu.setTimeout(function(){var t=aa.onUnhandledError;if(t)t(e);else throw e})}i(o7,"reportUnhandledError");function ly(){}i(ly,"noop");var s7=function(){return fy("C",void 0,void 0)}();function c7(e){return fy("E",void 0,e)}i(c7,"errorNotification");function u7(e){return fy("N",e,void 0)}i(u7,"nextNotification");function fy(e,t,r){return{kind:e,value:t,error:r}}i(fy,"createNotification");var nc=null;function l7(e){if(aa.useDeprecatedSynchronousErrorHandling){var t=!nc;if(t&&(nc={errorThrown:!1,error:null}),e(),t){var r=nc,n=r.errorThrown,a=r.error;if(nc=null,n)throw a}}else e()}i(l7,"errorContext");function f7(e){aa.useDeprecatedSynchronousErrorHandling&&nc&&(nc.errorThrown=!0,nc.error=e)}i(f7,"captureError");var py=function(e){sy(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Zp(r)&&r.add(n)):n.destination=JL,n}return i(t,"Subscriber"),t.create=function(r,n,a){return new Xp(r,n,a)},t.prototype.next=function(r){this.isStopped?hy(u7(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?hy(c7(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?hy(s7,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Jp);var KL=Function.prototype.bind;function dy(e,t){return KL.call(e,t)}i(dy,"bind");var GL=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Yp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Yp(n)}else Yp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Yp(r)}},e}(),Xp=function(e){sy(t,e);function t(r,n,a){var s=e.call(this)||this,c;if(ji(r)||!r)c={next:r??void 0,error:n??void 0,complete:a??void 0};else{var l;s&&aa.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&dy(r.next,l),error:r.error&&dy(r.error,l),complete:r.complete&&dy(r.complete,l)}):c=r}return s.destination=new GL(c),s}return i(t,"SafeSubscriber"),t}(py);function Yp(e){aa.useDeprecatedSynchronousErrorHandling?f7(e):o7(e)}i(Yp,"handleUnhandledError");function WL(e){throw e}i(WL,"defaultErrorHandler");function hy(e,t){var r=aa.onStoppedNotification;r&&Iu.setTimeout(function(){return r(e,t)})}i(hy,"handleStoppedNotification");var JL={closed:!0,next:ly,error:WL,complete:ly};var d7=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function h7(e){return e}i(h7,"identity");function p7(e){return e.length===0?h7:e.length===1?e[0]:i(function(r){return e.reduce(function(n,a){return a(n)},r)},"piped")}i(p7,"pipeFromArray");var my=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable"),e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var a=this,s=YL(t)?t:new Xp(t,r,n);return l7(function(){var c=a,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?a._subscribe(s):a._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=m7(r),new r(function(a,s){var c=new Xp({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:a});n.subscribe(c)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[d7]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return p7(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=m7(t),new t(function(n,a){var s;r.subscribe(function(c){return s=c},function(c){return a(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function m7(e){var t;return(t=e??aa.Promise)!==null&&t!==void 0?t:Promise}i(m7,"getPromiseCtor");function ZL(e){return e&&ji(e.next)&&ji(e.error)&&ji(e.complete)}i(ZL,"isObserver");function YL(e){return e&&e instanceof py||ZL(e)&&Zp(e)}i(YL,"isSubscriber");var g7;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(g7||(g7={}));var v7;(function(e){e[e.NOT_REQUESTED=0]="NOT_REQUESTED",e[e.PENDING=1]="PENDING",e[e.PROCESSING=2]="PROCESSING",e[e.ANCHORED=3]="ANCHORED",e[e.FAILED=4]="FAILED"})(v7||(v7={}));var vy;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(vy||(vy={}));var Nf=class extends my{constructor(t,r){super(n=>{t.subscribe(n)}),this.state$=t,this._context=r}get id(){return new Yt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:t,content:r}=this.state$.value;return(0,gy.default)(t?.content??r)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return hr.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:t})=>hr.make(this.id,t))}get anchorCommitIds(){return this.state$.value.log.filter(({type:t})=>t===vy.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,gy.default)(this.state$.value)}async sync(t={}){t={sync:rc.PREFER_CACHE,...t};let r=await this.api.loadStream(this.id,t);this.state$.next(r.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}};i(Nf,"Stream");function y7(){return e=>{}}i(y7,"StreamStatic");var XL=function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},mi,yy={anchor:!0,publish:!0,pin:!0,sync:rc.PREFER_CACHE},QL={sync:rc.PREFER_CACHE},b7={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function by(e,t){if(typeof e?.schema=="string")try{hr.fromString(e.schema)}catch{throw new Error("Schema must be a CommitID")}let r={controllers:e?.controllers,family:e?.family,schema:e?.schema?.toString(),tags:e?.tags};if(t)e?.deterministic||(r.unique=dv((0,E7.randomBytes)(12),"base64")),e?.forbidControllerChange&&(r.forbidControllerChange=!0);else{if(e?.deterministic!==void 0||e?.unique!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if(e?.forbidControllerChange!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(r).forEach(n=>r[n]===void 0&&delete r[n]),r}i(by,"headerFromMetadata");async function w7(e){if(!e.did)throw new Error("No DID provided");return e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`)),e.did}i(w7,"getAuthenticatedDID");async function wy(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(wy,"throwReadOnlyError");var Zo=mi=i(class extends Nf{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,_7.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,a={}){a={...yy,...a},!n?.deterministic&&a.syncTimeoutSeconds==null&&(a.syncTimeoutSeconds=0);let s=a.asDID?{did:a.asDID}:t,c=await mi.makeGenesis(s,r,n);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,c,a)}static async createFromGenesis(t,r,n={}){n={...yy,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=r.data?await mi._signDagJWS(t,r):r;return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,a,n)}static async deterministic(t,r,n={}){if(n={...yy,...n},r={...r,deterministic:!0},r.family==null&&r.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=await mi.makeGenesis(t,null,r);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,a,n)}static async load(t,r,n={}){n={...QL,...n};let a=Ys.from(r);if(a.type!=mi.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${mi.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async update(t,r,n={}){n={...b7,...n};let a=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(a,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...b7,...r};let a={header:by(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await mi._signDagJWS(this.api,a),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=wy,this.patch=wy,this.sync=wy,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let a=await this._makeRawCommit(r,n);return mi._signDagJWS(t,a)}async _makeRawCommit(t,r){r||(r={});let n=by(r,!1);if(t==null&&(t=this.content),n.controllers){if(n.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!n.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let a=e9.compare(this.content,t),s=this.state.log[0];return{header:n,data:a,prev:this.tip,id:s.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await w7(t);n.controllers=[c.hasParent?c.parent:c.id]}else throw new Error("No controllers specified");if(n.controllers?.length!==1)throw new Error("Exactly one controller must be specified");let a=by(n,!0);if(n?.deterministic&&r)throw new Error("Initial content must be null when creating a deterministic Tile document");if(r==null){let c={header:a};return xv(c),c}let s={data:r,header:a};return mi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await w7(t)).createDagJWS(r)}},"TileDocument");Zo.STREAM_TYPE_NAME="tile";Zo.STREAM_TYPE_ID=0;Zo=mi=XL([y7()],Zo);var I7=Hs(x7(),1);function uU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(uU,"_checkPrivateRedeclaration");function lU(e,t){return t.get?t.get.call(e):t.value}i(lU,"_classApplyDescriptorGet");function fU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(fU,"_classApplyDescriptorSet");function M7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(M7,"_classExtractFieldDescriptor");function Sy(e,t){var r=M7(e,t,"get");return lU(e,r)}i(Sy,"_classPrivateFieldGet");function T7(e,t,r){uU(e,t),t.set(e,r)}i(T7,"_classPrivateFieldInit");function C7(e,t,r){var n=M7(e,t,"set");return fU(e,n,r),r}i(C7,"_classPrivateFieldSet");function dU(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(dU,"keyToQuery");function xy(e){return typeof e=="string"?Ys.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(xy,"keyToString");async function Cy(e){let t=await Zo.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(Cy,"getDeterministicQuery");var hU=i(()=>Promise.resolve([]),"tempBatchLoadFn"),Qp=new WeakMap,Ty=new WeakMap,ic=class extends I7.default{cache(t){if(!Sy(this,Ty))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let a=await Zo.create(Sy(this,Qp),t,r,n);return this.cache(a),a}async deterministic(t,r){let n=await Cy(t);try{return await super.load(n)}catch{let s=await Zo.createFromGenesis(Sy(this,Qp),n.genesis,r);return this.cache(s),s}}async load(t){return await super.load(t)}async update(t,r,n,a){let s=xy(t);this.clear(s);let c=await this.load({streamId:s});return await c.update(r,n,a),c}constructor(t){super(hU,{cache:!0,cacheKeyFn:xy,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),T7(this,Qp,{writable:!0,value:void 0}),T7(this,Ty,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(dU),t.multiqueryTimeout);return r.map(a=>{let s=xy(a),c=n[s];return c||new Error(`Failed to load stream: ${s}`)})},C7(this,Qp,t.ceramic),C7(this,Ty,!!t.cache)}};i(ic,"TileLoader");function pU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(pU,"_checkPrivateRedeclaration");function mU(e,t){return t.get?t.get.call(e):t.value}i(mU,"_classApplyDescriptorGet");function gU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(gU,"_classApplyDescriptorSet");function D7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(D7,"_classExtractFieldDescriptor");function ac(e,t){var r=D7(e,t,"get");return mU(e,r)}i(ac,"_classPrivateFieldGet");function k7(e,t,r){pU(e,t),t.set(e,r)}i(k7,"_classPrivateFieldInit");function My(e,t,r){var n=D7(e,t,"set");return gU(e,n,r),r}i(My,"_classPrivateFieldSet");var ku=new WeakMap,Du=new WeakMap,Ru=class{get aliases(){return ac(this,ku)}get loader(){return ac(this,Du)}getDefinitionID(t){return ac(this,ku).definitions[t]??null}getSchemaURL(t){return ac(this,ku).schemas[t]??null}getTileID(t){return ac(this,ku).tiles[t]??null}async loadTile(t){let r=this.getTileID(t);if(r==null)throw new Error(`Tile alias "${t}" is not defined`);return await ac(this,Du).load(r)}async createTile(t,r,n={}){let a=this.getSchemaURL(t);if(a==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:s,...c}=n,l={schema:a};return s!=null&&(l.controllers=[s]),await ac(this,Du).create(r,l,c)}constructor(t){if(k7(this,ku,{writable:!0,value:void 0}),k7(this,Du,{writable:!0,value:void 0}),My(this,ku,t.aliases),t.loader!=null)My(this,Du,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");My(this,Du,new ic({ceramic:t.ceramic,cache:t.cache}))}}};i(Ru,"DataModel");function vU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(vU,"_checkPrivateRedeclaration");function yU(e,t){return t.get?t.get.call(e):t.value}i(yU,"_classApplyDescriptorGet");function bU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(bU,"_classApplyDescriptorSet");function R7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(R7,"_classExtractFieldDescriptor");function Na(e,t){var r=R7(e,t,"get");return yU(e,r)}i(Na,"_classPrivateFieldGet");function e0(e,t,r){vU(e,t),t.set(e,r)}i(e0,"_classPrivateFieldInit");function t0(e,t,r){var n=R7(e,t,"set");return bU(e,n,r),r}i(t0,"_classPrivateFieldSet");var r0=new WeakMap,oc=new WeakMap,Iy=new WeakMap,n0=new WeakMap,Pf=class{_createValuePromise(){t0(this,Iy,new Promise((t,r)=>{t0(this,n0,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let a=i(async s=>{try{let c=await t(s);r(),this._next(c)}catch(c){n(c),this._next(s)}},"run");Na(this,oc).push({reject:n,run:a}),Na(this,oc).length===1&&this._start()})}async changeContent(t){let r=i(async n=>(await n.update(t(n.content),n.metadata),n),"mutation");return await this.change(r)}async get(){return Na(this,oc).length===0?await Na(this,r0).call(this):await Na(this,Iy)}async _start(){try{let t=await Na(this,r0).call(this);this._next(t)}catch(t){Na(this,oc).forEach(r=>{r.reject(t)}),t0(this,oc,[]),Na(this,n0).reject(t),this._createValuePromise()}}_next(t){let r=Na(this,oc).shift();r==null?this._end(t):r.run(t)}_end(t){Na(this,n0).resolve(t),this._createValuePromise()}constructor(t){e0(this,r0,{writable:!0,value:void 0}),e0(this,oc,{writable:!0,value:[]}),e0(this,Iy,{writable:!0,value:void 0}),e0(this,n0,{writable:!0,value:void 0}),t0(this,r0,t),this._createValuePromise()}};i(Pf,"TileProxy");var wU=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function _U(e){return wU.test(e)}i(_U,"isDIDstring");function EU(e){if(!_U(e))throw new Error(`Invalid DID: ${e}`)}i(EU,"assertDIDstring");function ky(e){return EU(e),{controllers:[e],family:"IDX"}}i(ky,"getIDXMetadata");function AU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(AU,"_checkPrivateRedeclaration");function SU(e,t){return t.get?t.get.call(e):t.value}i(SU,"_classApplyDescriptorGet");function xU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(xU,"_classApplyDescriptorSet");function O7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(O7,"_classExtractFieldDescriptor");function $r(e,t){var r=O7(e,t,"get");return SU(e,r)}i($r,"_classPrivateFieldGet");function Bf(e,t,r){AU(e,t),t.set(e,r)}i(Bf,"_classPrivateFieldInit");function i0(e,t,r){var n=O7(e,t,"set");return xU(e,n,r),r}i(i0,"_classPrivateFieldSet");var vo=new WeakMap,a0=new WeakMap,Dy=new WeakMap,Pa=new WeakMap,o0=new WeakMap,Lf=class{get authenticated(){return $r(this,vo).did!=null}get ceramic(){return $r(this,vo)}get id(){if($r(this,a0)!=null)return $r(this,a0);if($r(this,vo).did==null)throw new Error("Ceramic instance is not authenticated");return $r(this,vo).did.hasParent?$r(this,vo).did.parent:$r(this,vo).did.id}get loader(){return $r(this,Pa)}get model(){return $r(this,o0)}async has(t,r){let n=this.getDefinitionID(t);return await this.getRecordID(n,r)!=null}async get(t,r){let n=this.getDefinitionID(t);return await this.getRecord(n,r)}async getMultiple(t,r){let n=this.getDefinitionID(t),a=await Promise.all(r.map(async l=>{let{genesis:h,streamId:p}=await Cy(ky(l));return{genesis:h,streamId:p.toString(),paths:[n]}})),s=await $r(this,vo).multiQuery(a),c=[];for(let l of a){let h=s[l.streamId]?.content?.[n],p=h?s[Yt.fromString(h).toString()]:null;c.push(p?.content??null)}return c}async set(t,r,n={}){let a=this.getDefinitionID(t),[s,c]=await this._setRecordOnly(a,r,n);return s&&await this._setReference(n.controller??this.id,a,c),c}async merge(t,r,n={}){let a=this.getDefinitionID(t),s=await this.getRecord(a),c=s?{...s,...r}:r;return await this.setRecord(a,c,n)}async setAll(t,r={}){let n=Object.entries(t).map(async([c,l])=>{let h=this.getDefinitionID(c),[p,g]=await this._setRecordOnly(h,l,r);return[p,h,g]}),s=(await Promise.all(n)).reduce((c,[l,h,p])=>(l&&(c[h]=p.toUrl()),c),{});return await this._setReferences(r.controller??this.id,s),s}async setDefaults(t,r={}){let n=await this.getIndex()??{},a=Object.entries(t).map(([l,h])=>[this.getDefinitionID(l),h]).filter(l=>n[l[0]]==null).map(async([l,h])=>{let p=await this.getDefinition(l),g=await this._createRecord(p,h,r);return{[l]:g.toUrl()}}),c=(await Promise.all(a)).reduce((l,h)=>Object.assign(l,h),{});return await this._setReferences(r.controller??this.id,c),c}async remove(t,r=this.id){await this._getIndexProxy(r).changeContent(n=>(n!=null&&delete n[this.getDefinitionID(t)],n))}async getIndex(t=this.id){let r=this.authenticated&&t===this.id?await this._getIndexProxy(t).get():await this._getIDXDoc(t);return r?r.content:null}iterator(t){let r,n=0;return{[Symbol.asyncIterator](){return this},next:async()=>{if(r==null){let l=await this.getIndex(t);r=Object.entries(l??{})}if(n===r.length)return{done:!0,value:null};let[a,s]=r[n++],c=await $r(this,Pa).load(s);return{done:!1,value:{key:a,id:s,record:c.content}}}}}async _createIDXDoc(t){return await $r(this,Pa).deterministic(ky(t))}async _getIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)return null;if(r.metadata.schema!==Sp)throw new Error("Invalid document: schema is not IdentityIndex");return r}async _getOwnIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)await r.update({},{schema:Sp});else if(r.metadata.schema!==Sp)throw new Error("Invalid document: schema is not IdentityIndex");return r}_getIndexProxy(t){let r=$r(this,Dy)[t];return r==null&&(r=new Pf(async()=>await this._getOwnIDXDoc(t)),$r(this,Dy)[t]=r),r}getDefinitionID(t){return $r(this,o0).getDefinitionID(t)??t}async getDefinition(t){let r=await $r(this,Pa).load(t);if(r.metadata.schema!==YE)throw new Error("Invalid document: schema is not Definition");return{...r.content,id:r.id}}async getRecordID(t,r){return(await this.getIndex(r??this.id))?.[t]??null}async getRecordDocument(t,r){let n=await this.getRecordID(t,r);return n?await $r(this,Pa).load(n):null}async getRecord(t,r){let n=await this.getRecordDocument(t,r);return n?n.content:null}async setRecord(t,r,n={}){let[a,s]=await this._setRecordOnly(t,r,n);return a&&await this._setReference(n.controller??this.id,t,s),s}async _setRecordOnly(t,r,n){let a=await this.getRecordID(t,n.controller??this.id);if(a==null){let s=await this.getDefinition(t),c=await this._createRecord(s,r,n);return[!0,c]}else{let s=await $r(this,Pa).update(a,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:a}){let s=await $r(this,Pa).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:a});return await s.update(r,{schema:t.schema}),s.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(a=>({...a,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Bf(this,vo,{writable:!0,value:void 0}),Bf(this,a0,{writable:!0,value:void 0}),Bf(this,Dy,{writable:!0,value:{}}),Bf(this,Pa,{writable:!0,value:void 0}),Bf(this,o0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:a,loader:s,model:c}=t;i0(this,vo,n),i0(this,a0,a),i0(this,Pa,s??new ic({ceramic:n,cache:r})),i0(this,o0,c instanceof Ru?c:new Ru({loader:$r(this,Pa),aliases:c}))}};i(Lf,"DIDDataStore");var rr;(function(e){e.assertEqual=a=>a;function t(a){}i(t,"assertIs"),e.assertIs=t;function r(a){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=a=>{let s={};for(let c of a)s[c]=c;return s},e.getValidEnumValues=a=>{let s=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of s)c[l]=a[l];return e.objectValues(c)},e.objectValues=a=>e.objectKeys(a).map(function(s){return a[s]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&s.push(c);return s},e.find=(a,s)=>{for(let c of a)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(rr||(rr={}));var tt=rr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yo=i(e=>{switch(typeof e){case"undefined":return tt.undefined;case"string":return tt.string;case"number":return isNaN(e)?tt.nan:tt.number;case"boolean":return tt.boolean;case"function":return tt.function;case"bigint":return tt.bigint;case"symbol":return tt.symbol;case"object":return Array.isArray(e)?tt.array:e===null?tt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?tt.promise:typeof Map<"u"&&e instanceof Map?tt.map:typeof Set<"u"&&e instanceof Set?tt.set:typeof Date<"u"&&e instanceof Date?tt.date:tt.object;default:return tt.unknown}},"getParsedType"),Ke=rr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),TU=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),$i=class extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let r=t||function(s){return s.message},n={_errors:[]},a=i(s=>{for(let c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(a);else if(c.code==="invalid_return_type")a(c.returnTypeError);else if(c.code==="invalid_arguments")a(c.argumentsError);else if(c.path.length===0)n._errors.push(r(c));else{let l=n,h=0;for(;h<c.path.length;){let p=c.path[h];h===c.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(r(c))):l[p]=l[p]||{_errors:[]},l=l[p],h++}}},"processError");return a(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,rr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i($i,"ZodError");$i.create=e=>new $i(e);var Ff=i((e,t)=>{let r;switch(e.code){case Ke.invalid_type:e.received===tt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ke.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,rr.jsonStringifyReplacer)}`;break;case Ke.unrecognized_keys:r=`Unrecognized key(s) in object: ${rr.joinValues(e.keys,", ")}`;break;case Ke.invalid_union:r="Invalid input";break;case Ke.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rr.joinValues(e.options)}`;break;case Ke.invalid_enum_value:r=`Invalid enum value. Expected ${rr.joinValues(e.options)}, received '${e.received}'`;break;case Ke.invalid_arguments:r="Invalid function arguments";break;case Ke.invalid_return_type:r="Invalid function return type";break;case Ke.invalid_date:r="Invalid date";break;case Ke.invalid_string:typeof e.validation=="object"?"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:rr.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ke.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(e.minimum)}`:r="Invalid input";break;case Ke.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(e.maximum)}`:r="Invalid input";break;case Ke.custom:r="Invalid input";break;case Ke.invalid_intersection_types:r="Intersection results could not be merged";break;case Ke.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ke.not_finite:r="Number must be finite";break;default:r=t.defaultError,rr.assertNever(e)}return{message:r}},"errorMap"),L7=Ff;function CU(e){L7=e}i(CU,"setErrorMap");function c0(){return L7}i(c0,"getErrorMap");var u0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],c={...a,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...a,path:s,message:a.message||l}},"makeIssue"),MU=[];function vt(e,t){let r=u0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,c0(),Ff].filter(n=>!!n)});e.common.issues.push(r)}i(vt,"addIssueToContext");var en=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let a of r){if(a.status==="aborted")return Dt;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let a of r)n.push({key:await a.key,value:await a.value});return en.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let a of r){let{key:s,value:c}=a;if(s.status==="aborted"||c.status==="aborted")return Dt;s.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),(typeof c.value<"u"||a.alwaysSet)&&(n[s.value]=c.value)}return{status:t.value,value:n}}};i(en,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),U7=i(e=>({status:"dirty",value:e}),"DIRTY"),Sn=i(e=>({status:"valid",value:e}),"OK"),Ry=i(e=>e.status==="aborted","isAborted"),Oy=i(e=>e.status==="dirty","isDirty"),l0=i(e=>e.status==="valid","isValid"),f0=i(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Wt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Wt||(Wt={}));var gi=class{constructor(t,r,n,a){this.parent=t,this.data=r,this._path=n,this._key=a}get path(){return this._path.concat(this._key)}};i(gi,"ParseInputLazyPath");var N7=i((e,t)=>{if(l0(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new $i(e.common.issues);return{success:!1,error:r}}},"handleResult");function Vt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:i((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:a}}i(Vt,"processCreateParams");var Bt=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Yo(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Yo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new en,ctx:{common:t.parent.common,data:t.data,parsedType:Yo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(f0(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;let a={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yo(t)},s=this._parseSync({data:t,path:a.path,parent:a});return N7(a,s)}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yo(t)},a=this._parse({data:t,path:n.path,parent:n}),s=await(f0(a)?a:Promise.resolve(a));return N7(n,s)}refine(t,r){let n=i(a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r,"getIssueProperties");return this._refinement((a,s)=>{let c=t(a),l=i(()=>s.addIssue({code:Ke.custom,...n(a)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(h=>h?!0:(l(),!1)):c?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,a)=>t(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(t){return new Wn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return yi.create(this)}nullable(){return Fa.create(this)}nullish(){return this.optional().nullable()}array(){return Gn.create(this)}promise(){return wo.create(this)}or(t){return rs.create([this,t])}and(t){return ns.create(this,t)}transform(t){return new Wn({schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new us({innerType:this,defaultValue:r,typeName:xt.ZodDefault})}brand(){return new Uf({typeName:xt.ZodBranded,type:this,...Vt(void 0)})}catch(t){let r=typeof t=="function"?t:()=>t;return new fc({innerType:this,defaultValue:r,typeName:xt.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ls.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i(Bt,"ZodType");var IU=/^c[^\s-]{8,}$/i,kU=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,DU=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,RU=i(e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),zi=class extends Bt{constructor(){super(...arguments),this._regex=(t,r,n)=>this.refinement(a=>t.test(a),{validation:r,code:Ke.invalid_string,...Wt.errToObj(n)}),this.nonempty=t=>this.min(1,Wt.errToObj(t)),this.trim=()=>new zi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==tt.string){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.string,received:s.parsedType}),Dt}let n=new en,a;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let c=t.data.length>s.value,l=t.data.length<s.value;(c||l)&&(a=this._getOrReturnCtx(t,a),c?vt(a,{code:Ke.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&vt(a,{code:Ke.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")DU.test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{validation:"email",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")kU.test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{validation:"uuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")IU.test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{validation:"cuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),vt(a,{validation:"url",code:Ke.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{validation:"regex",code:Ke.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="startsWith"?t.data.startsWith(s.value)||(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?RU(s).test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.invalid_string,validation:"datetime",message:s.message}),n.dirty()):rr.assertNever(s);return{status:n.value,value:t.data}}_addCheck(t){return new zi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Wt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Wt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Wt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Wt.errToObj(t)})}datetime(t){var r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,...Wt.errToObj(t?.message)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Wt.errToObj(r)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Wt.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Wt.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Wt.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Wt.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Wt.errToObj(r)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};i(zi,"ZodString");zi.create=e=>{var t;return new zi({checks:[],typeName:xt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};function OU(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return s%c/Math.pow(10,a)}i(OU,"floatSafeRemainder");var oa=class extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==tt.number){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.number,received:s.parsedType}),Dt}let n,a=new en;for(let s of this._def.checks)s.kind==="int"?rr.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?OU(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_finite,message:s.message}),a.dirty()):rr.assertNever(s);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Wt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Wt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Wt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Wt.toString(r))}setLimit(t,r,n,a){return new oa({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Wt.toString(a)}]})}_addCheck(t){return new oa({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Wt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Wt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Wt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Wt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Wt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Wt.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Wt.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int")}};i(oa,"ZodNumber");oa.create=e=>new oa({checks:[],typeName:xt.ZodNumber,coerce:e?.coerce||!1,...Vt(e)});var Xo=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==tt.bigint){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.bigint,received:n.parsedType}),Dt}return Sn(t.data)}};i(Xo,"ZodBigInt");Xo.create=e=>{var t;return new Xo({typeName:xt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};var Qo=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==tt.boolean){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.boolean,received:n.parsedType}),Dt}return Sn(t.data)}};i(Qo,"ZodBoolean");Qo.create=e=>new Qo({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Vt(e)});var Ba=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==tt.date){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.date,received:s.parsedType}),Dt}if(isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_date}),Dt}let n=new en,a;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):rr.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ba({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Wt.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Wt.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};i(Ba,"ZodDate");Ba.create=e=>new Ba({checks:[],coerce:e?.coerce||!1,typeName:xt.ZodDate,...Vt(e)});var sc=class extends Bt{_parse(t){if(this._getType(t)!==tt.symbol){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.symbol,received:n.parsedType}),Dt}return Sn(t.data)}};i(sc,"ZodSymbol");sc.create=e=>new sc({typeName:xt.ZodSymbol,...Vt(e)});var es=class extends Bt{_parse(t){if(this._getType(t)!==tt.undefined){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.undefined,received:n.parsedType}),Dt}return Sn(t.data)}};i(es,"ZodUndefined");es.create=e=>new es({typeName:xt.ZodUndefined,...Vt(e)});var ts=class extends Bt{_parse(t){if(this._getType(t)!==tt.null){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.null,received:n.parsedType}),Dt}return Sn(t.data)}};i(ts,"ZodNull");ts.create=e=>new ts({typeName:xt.ZodNull,...Vt(e)});var yo=class extends Bt{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};i(yo,"ZodAny");yo.create=e=>new yo({typeName:xt.ZodAny,...Vt(e)});var La=class extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};i(La,"ZodUnknown");La.create=e=>new La({typeName:xt.ZodUnknown,...Vt(e)});var Hi=class extends Bt{_parse(t){let r=this._getOrReturnCtx(t);return vt(r,{code:Ke.invalid_type,expected:tt.never,received:r.parsedType}),Dt}};i(Hi,"ZodNever");Hi.create=e=>new Hi({typeName:xt.ZodNever,...Vt(e)});var cc=class extends Bt{_parse(t){if(this._getType(t)!==tt.undefined){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.void,received:n.parsedType}),Dt}return Sn(t.data)}};i(cc,"ZodVoid");cc.create=e=>new cc({typeName:xt.ZodVoid,...Vt(e)});var Gn=class extends Bt{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==tt.array)return vt(r,{code:Ke.invalid_type,expected:tt.array,received:r.parsedType}),Dt;if(a.exactLength!==null){let c=r.data.length>a.exactLength.value,l=r.data.length<a.exactLength.value;(c||l)&&(vt(r,{code:c?Ke.too_big:Ke.too_small,minimum:l?a.exactLength.value:void 0,maximum:c?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(vt(r,{code:Ke.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(vt(r,{code:Ke.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((c,l)=>a.type._parseAsync(new gi(r,c,r.path,l)))).then(c=>en.mergeArray(n,c));let s=r.data.map((c,l)=>a.type._parseSync(new gi(r,c,r.path,l)));return en.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new Gn({...this._def,minLength:{value:t,message:Wt.toString(r)}})}max(t,r){return new Gn({...this._def,maxLength:{value:t,message:Wt.toString(r)}})}length(t,r){return new Gn({...this._def,exactLength:{value:t,message:Wt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Gn,"ZodArray");Gn.create=(e,t)=>new Gn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,...Vt(t)});var d0;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(d0||(d0={}));var P7=i(e=>t=>new Er({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function Ou(e){if(e instanceof Er){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=yi.create(Ou(n))}return new Er({...e._def,shape:()=>t})}else return e instanceof Gn?Gn.create(Ou(e.element)):e instanceof yi?yi.create(Ou(e.unwrap())):e instanceof Fa?Fa.create(Ou(e.unwrap())):e instanceof vi?vi.create(e.items.map(t=>Ou(t))):e}i(Ou,"deepPartialify");var Er=class extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=P7(this._def),this.extend=P7(this._def)}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=rr.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==tt.object){let p=this._getOrReturnCtx(t);return vt(p,{code:Ke.invalid_type,expected:tt.object,received:p.parsedType}),Dt}let{status:n,ctx:a}=this._processInputParams(t),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof Hi&&this._def.unknownKeys==="strip"))for(let p in a.data)c.includes(p)||l.push(p);let h=[];for(let p of c){let g=s[p],v=a.data[p];h.push({key:{status:"valid",value:p},value:g._parse(new gi(a,v,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof Hi){let p=this._def.unknownKeys;if(p==="passthrough")for(let g of l)h.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(p==="strict")l.length>0&&(vt(a,{code:Ke.unrecognized_keys,keys:l}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let g of l){let v=a.data[g];h.push({key:{status:"valid",value:g},value:p._parse(new gi(a,v,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let g of h){let v=await g.key;p.push({key:v,value:await g.value,alwaysSet:g.alwaysSet})}return p}).then(p=>en.mergeObjectSync(n,p)):en.mergeObjectSync(n,h)}get shape(){return this._def.shape()}strict(t){return Wt.errToObj,new Er({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var a,s,c,l;let h=(c=(s=(a=this._def).errorMap)===null||s===void 0?void 0:s.call(a,r,n).message)!==null&&c!==void 0?c:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=Wt.errToObj(t).message)!==null&&l!==void 0?l:h}:{message:h}}}:{}})}strip(){return new Er({...this._def,unknownKeys:"strip"})}passthrough(){return new Er({...this._def,unknownKeys:"passthrough"})}setKey(t,r){return this.augment({[t]:r})}merge(t){return new Er({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>d0.mergeShapes(this._def.shape(),t._def.shape()),typeName:xt.ZodObject})}catchall(t){return new Er({...this._def,catchall:t})}pick(t){let r={};return rr.objectKeys(t).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new Er({...this._def,shape:()=>r})}omit(t){let r={};return rr.objectKeys(this.shape).map(n=>{rr.objectKeys(t).indexOf(n)===-1&&(r[n]=this.shape[n])}),new Er({...this._def,shape:()=>r})}deepPartial(){return Ou(this)}partial(t){let r={};if(t)return rr.objectKeys(this.shape).map(n=>{rr.objectKeys(t).indexOf(n)===-1?r[n]=this.shape[n]:r[n]=this.shape[n].optional()}),new Er({...this._def,shape:()=>r});for(let n in this.shape){let a=this.shape[n];r[n]=a.optional()}return new Er({...this._def,shape:()=>r})}required(t){let r={};if(t)rr.objectKeys(this.shape).map(n=>{if(rr.objectKeys(t).indexOf(n)===-1)r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof yi;)s=s._def.innerType;r[n]=s}});else for(let n in this.shape){let s=this.shape[n];for(;s instanceof yi;)s=s._def.innerType;r[n]=s}return new Er({...this._def,shape:()=>r})}keyof(){return F7(rr.objectKeys(this.shape))}};i(Er,"ZodObject");Er.create=(e,t)=>new Er({shape:()=>e,unknownKeys:"strip",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});Er.strictCreate=(e,t)=>new Er({shape:()=>e,unknownKeys:"strict",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});Er.lazycreate=(e,t)=>new Er({shape:e,unknownKeys:"strip",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});var rs=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function a(s){for(let l of s)if(l.result.status==="valid")return l.result;for(let l of s)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let c=s.map(l=>new $i(l.ctx.common.issues));return vt(r,{code:Ke.invalid_union,unionErrors:c}),Dt}if(i(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let c={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:c}),ctx:c}})).then(a);{let s,c=[];for(let h of n){let p={...r,common:{...r.common,issues:[]},parent:null},g=h._parseSync({data:r.data,path:r.path,parent:p});if(g.status==="valid")return g;g.status==="dirty"&&!s&&(s={result:g,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let l=c.map(h=>new $i(h));return vt(r,{code:Ke.invalid_union,unionErrors:l}),Dt}}get options(){return this._def.options}};i(rs,"ZodUnion");rs.create=(e,t)=>new rs({options:e,typeName:xt.ZodUnion,...Vt(t)});var s0=i(e=>e instanceof as?s0(e.schema):e instanceof Wn?s0(e.innerType()):e instanceof os?[e.value]:e instanceof ss?e.options:e instanceof cs?Object.keys(e.enum):e instanceof us?s0(e._def.innerType):e instanceof es?[void 0]:e instanceof ts?[null]:null,"getDiscriminator"),uc=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.object)return vt(r,{code:Ke.invalid_type,expected:tt.object,received:r.parsedType}),Dt;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(vt(r,{code:Ke.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Dt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let a=new Map;for(let s of r){let c=s0(s.shape[t]);if(!c)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of c){if(a.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);a.set(l,s)}}return new uc({typeName:xt.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...Vt(n)})}};i(uc,"ZodDiscriminatedUnion");function Ny(e,t){let r=Yo(e),n=Yo(t);if(e===t)return{valid:!0,data:e};if(r===tt.object&&n===tt.object){let a=rr.objectKeys(t),s=rr.objectKeys(e).filter(l=>a.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=Ny(e[l],t[l]);if(!h.valid)return{valid:!1};c[l]=h.data}return{valid:!0,data:c}}else if(r===tt.array&&n===tt.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=Ny(c,l);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return r===tt.date&&n===tt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Ny,"mergeValues");var ns=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),a=i((s,c)=>{if(Ry(s)||Ry(c))return Dt;let l=Ny(s.value,c.value);return l.valid?((Oy(s)||Oy(c))&&r.dirty(),{status:r.value,value:l.data}):(vt(n,{code:Ke.invalid_intersection_types}),Dt)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,c])=>a(s,c)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};i(ns,"ZodIntersection");ns.create=(e,t,r)=>new ns({left:e,right:t,typeName:xt.ZodIntersection,...Vt(r)});var vi=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.array)return vt(n,{code:Ke.invalid_type,expected:tt.array,received:n.parsedType}),Dt;if(n.data.length<this._def.items.length)return vt(n,{code:Ke.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dt;!this._def.rest&&n.data.length>this._def.items.length&&(vt(n,{code:Ke.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=n.data.map((c,l)=>{let h=this._def.items[l]||this._def.rest;return h?h._parse(new gi(n,c,n.path,l)):null}).filter(c=>!!c);return n.common.async?Promise.all(s).then(c=>en.mergeArray(r,c)):en.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new vi({...this._def,rest:t})}};i(vi,"ZodTuple");vi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vi({items:e,typeName:xt.ZodTuple,rest:null,...Vt(t)})};var is=class extends Bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.object)return vt(n,{code:Ke.invalid_type,expected:tt.object,received:n.parsedType}),Dt;let a=[],s=this._def.keyType,c=this._def.valueType;for(let l in n.data)a.push({key:s._parse(new gi(n,l,n.path,l)),value:c._parse(new gi(n,n.data[l],n.path,l))});return n.common.async?en.mergeObjectAsync(r,a):en.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Bt?new is({keyType:t,valueType:r,typeName:xt.ZodRecord,...Vt(n)}):new is({keyType:zi.create(),valueType:t,typeName:xt.ZodRecord,...Vt(r)})}};i(is,"ZodRecord");var lc=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.map)return vt(n,{code:Ke.invalid_type,expected:tt.map,received:n.parsedType}),Dt;let a=this._def.keyType,s=this._def.valueType,c=[...n.data.entries()].map(([l,h],p)=>({key:a._parse(new gi(n,l,n.path,[p,"key"])),value:s._parse(new gi(n,h,n.path,[p,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let h of c){let p=await h.key,g=await h.value;if(p.status==="aborted"||g.status==="aborted")return Dt;(p.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(p.value,g.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let h of c){let p=h.key,g=h.value;if(p.status==="aborted"||g.status==="aborted")return Dt;(p.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(p.value,g.value)}return{status:r.value,value:l}}}};i(lc,"ZodMap");lc.create=(e,t,r)=>new lc({valueType:t,keyType:e,typeName:xt.ZodMap,...Vt(r)});var Ua=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.set)return vt(n,{code:Ke.invalid_type,expected:tt.set,received:n.parsedType}),Dt;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(vt(n,{code:Ke.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(vt(n,{code:Ke.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function c(h){let p=new Set;for(let g of h){if(g.status==="aborted")return Dt;g.status==="dirty"&&r.dirty(),p.add(g.value)}return{status:r.value,value:p}}i(c,"finalizeSet");let l=[...n.data.values()].map((h,p)=>s._parse(new gi(n,h,n.path,p)));return n.common.async?Promise.all(l).then(h=>c(h)):c(l)}min(t,r){return new Ua({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Ua({...this._def,maxSize:{value:t,message:Wt.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};i(Ua,"ZodSet");Ua.create=(e,t)=>new Ua({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Vt(t)});var bo=class extends Bt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.function)return vt(r,{code:Ke.invalid_type,expected:tt.function,received:r.parsedType}),Dt;function n(l,h){return u0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,c0(),Ff].filter(p=>!!p),issueData:{code:Ke.invalid_arguments,argumentsError:h}})}i(n,"makeArgsIssue");function a(l,h){return u0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,c0(),Ff].filter(p=>!!p),issueData:{code:Ke.invalid_return_type,returnTypeError:h}})}i(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},c=r.data;return this._def.returns instanceof wo?Sn(async(...l)=>{let h=new $i([]),p=await this._def.args.parseAsync(l,s).catch(y=>{throw h.addIssue(n(l,y)),h}),g=await c(...p);return await this._def.returns._def.type.parseAsync(g,s).catch(y=>{throw h.addIssue(a(g,y)),h})}):Sn((...l)=>{let h=this._def.args.safeParse(l,s);if(!h.success)throw new $i([n(l,h.error)]);let p=c(...h.data),g=this._def.returns.safeParse(p,s);if(!g.success)throw new $i([a(p,g.error)]);return g.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new bo({...this._def,args:vi.create(t).rest(La.create())})}returns(t){return new bo({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new bo({args:t||vi.create([]).rest(La.create()),returns:r||La.create(),typeName:xt.ZodFunction,...Vt(n)})}};i(bo,"ZodFunction");var as=class extends Bt{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};i(as,"ZodLazy");as.create=(e,t)=>new as({getter:e,typeName:xt.ZodLazy,...Vt(t)});var os=class extends Bt{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return vt(r,{code:Ke.invalid_literal,expected:this._def.value}),Dt}return{status:"valid",value:t.data}}get value(){return this._def.value}};i(os,"ZodLiteral");os.create=(e,t)=>new os({value:e,typeName:xt.ZodLiteral,...Vt(t)});function F7(e,t){return new ss({values:e,typeName:xt.ZodEnum,...Vt(t)})}i(F7,"createZodEnum");var ss=class extends Bt{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return vt(r,{expected:rr.joinValues(n),received:r.parsedType,code:Ke.invalid_type}),Dt}if(this._def.values.indexOf(t.data)===-1){let r=this._getOrReturnCtx(t),n=this._def.values;return vt(r,{received:r.data,code:Ke.invalid_enum_value,options:n}),Dt}return Sn(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}};i(ss,"ZodEnum");ss.create=F7;var cs=class extends Bt{_parse(t){let r=rr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==tt.string&&n.parsedType!==tt.number){let a=rr.objectValues(r);return vt(n,{expected:rr.joinValues(a),received:n.parsedType,code:Ke.invalid_type}),Dt}if(r.indexOf(t.data)===-1){let a=rr.objectValues(r);return vt(n,{received:n.data,code:Ke.invalid_enum_value,options:a}),Dt}return Sn(t.data)}get enum(){return this._def.values}};i(cs,"ZodNativeEnum");cs.create=(e,t)=>new cs({values:e,typeName:xt.ZodNativeEnum,...Vt(t)});var wo=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.promise&&r.common.async===!1)return vt(r,{code:Ke.invalid_type,expected:tt.promise,received:r.parsedType}),Dt;let n=r.parsedType===tt.promise?r.data:Promise.resolve(r.data);return Sn(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(wo,"ZodPromise");wo.create=(e,t)=>new wo({type:e,typeName:xt.ZodPromise,...Vt(t)});var Wn=class extends Bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),a=this._def.effect||null;if(a.type==="preprocess"){let c=a.transform(n.data);return n.common.async?Promise.resolve(c).then(l=>this._def.schema._parseAsync({data:l,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}let s={addIssue:c=>{vt(n,c),c.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="refinement"){let c=i(l=>{let h=a.refinement(l,s);if(n.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Dt:(l.status==="dirty"&&r.dirty(),c(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Dt:(l.status==="dirty"&&r.dirty(),c(l.value).then(()=>({status:r.value,value:l.value}))))}if(a.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!l0(c))return c;let l=a.transform(c.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>l0(c)?Promise.resolve(a.transform(c.value,s)).then(l=>({status:r.value,value:l})):c);rr.assertNever(a)}};i(Wn,"ZodEffects");Wn.create=(e,t,r)=>new Wn({schema:e,typeName:xt.ZodEffects,effect:t,...Vt(r)});Wn.createWithPreprocess=(e,t,r)=>new Wn({schema:t,effect:{type:"preprocess",transform:e},typeName:xt.ZodEffects,...Vt(r)});var yi=class extends Bt{_parse(t){return this._getType(t)===tt.undefined?Sn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(yi,"ZodOptional");yi.create=(e,t)=>new yi({innerType:e,typeName:xt.ZodOptional,...Vt(t)});var Fa=class extends Bt{_parse(t){return this._getType(t)===tt.null?Sn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(Fa,"ZodNullable");Fa.create=(e,t)=>new Fa({innerType:e,typeName:xt.ZodNullable,...Vt(t)});var us=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===tt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};i(us,"ZodDefault");us.create=(e,t)=>new us({innerType:e,typeName:xt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Vt(t)});var fc=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.innerType._parse({data:r.data,path:r.path,parent:r});return f0(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};i(fc,"ZodCatch");fc.create=(e,t)=>new fc({innerType:e,typeName:xt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Vt(t)});var dc=class extends Bt{_parse(t){if(this._getType(t)!==tt.nan){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.nan,received:n.parsedType}),Dt}return{status:"valid",value:t.data}}};i(dc,"ZodNaN");dc.create=e=>new dc({typeName:xt.ZodNaN,...Vt(e)});var NU=Symbol("zod_brand"),Uf=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};i(Uf,"ZodBranded");var ls=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return i(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Dt:s.status==="dirty"?(r.dirty(),U7(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Dt:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,r){return new ls({in:t,out:r,typeName:xt.ZodPipeline})}};i(ls,"ZodPipeline");var j7=i((e,t={},r)=>e?yo.create().superRefine((n,a)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;a.addIssue({code:"custom",...c,fatal:r})}}):yo.create(),"custom"),PU={object:Er.lazycreate},xt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"})(xt||(xt={}));var BU=i((e,t={message:`Input not instance of ${e.name}`})=>j7(r=>r instanceof e,t,!0),"instanceOfType"),$7=zi.create,z7=oa.create,LU=dc.create,UU=Xo.create,H7=Qo.create,FU=Ba.create,jU=sc.create,$U=es.create,zU=ts.create,HU=yo.create,qU=La.create,VU=Hi.create,KU=cc.create,GU=Gn.create,WU=Er.create,JU=Er.strictCreate,ZU=rs.create,YU=uc.create,XU=ns.create,QU=vi.create,eF=is.create,tF=lc.create,rF=Ua.create,nF=bo.create,iF=as.create,aF=os.create,oF=ss.create,sF=cs.create,cF=wo.create,B7=Wn.create,uF=yi.create,lF=Fa.create,fF=Wn.createWithPreprocess,dF=ls.create,hF=i(()=>$7().optional(),"ostring"),pF=i(()=>z7().optional(),"onumber"),mF=i(()=>H7().optional(),"oboolean"),gF={string:e=>zi.create({...e,coerce:!0}),number:e=>oa.create({...e,coerce:!0}),boolean:e=>Qo.create({...e,coerce:!0}),bigint:e=>Xo.create({...e,coerce:!0}),date:e=>Ba.create({...e,coerce:!0})},vF=Dt,z=Object.freeze({__proto__:null,defaultErrorMap:Ff,setErrorMap:CU,getErrorMap:c0,makeIssue:u0,EMPTY_PATH:MU,addIssueToContext:vt,ParseStatus:en,INVALID:Dt,DIRTY:U7,OK:Sn,isAborted:Ry,isDirty:Oy,isValid:l0,isAsync:f0,get util(){return rr},ZodParsedType:tt,getParsedType:Yo,ZodType:Bt,ZodString:zi,ZodNumber:oa,ZodBigInt:Xo,ZodBoolean:Qo,ZodDate:Ba,ZodSymbol:sc,ZodUndefined:es,ZodNull:ts,ZodAny:yo,ZodUnknown:La,ZodNever:Hi,ZodVoid:cc,ZodArray:Gn,get objectUtil(){return d0},ZodObject:Er,ZodUnion:rs,ZodDiscriminatedUnion:uc,ZodIntersection:ns,ZodTuple:vi,ZodRecord:is,ZodMap:lc,ZodSet:Ua,ZodFunction:bo,ZodLazy:as,ZodLiteral:os,ZodEnum:ss,ZodNativeEnum:cs,ZodPromise:wo,ZodEffects:Wn,ZodTransformer:Wn,ZodOptional:yi,ZodNullable:Fa,ZodDefault:us,ZodCatch:fc,ZodNaN:dc,BRAND:NU,ZodBranded:Uf,ZodPipeline:ls,custom:j7,Schema:Bt,ZodSchema:Bt,late:PU,get ZodFirstPartyTypeKind(){return xt},coerce:gF,any:HU,array:GU,bigint:UU,boolean:H7,date:FU,discriminatedUnion:YU,effect:B7,enum:oF,function:nF,instanceof:BU,intersection:XU,lazy:iF,literal:aF,map:tF,nan:LU,nativeEnum:sF,never:VU,null:zU,nullable:lF,number:z7,object:WU,oboolean:mF,onumber:pF,optional:uF,ostring:hF,pipeline:dF,preprocess:fF,promise:cF,record:eF,set:rF,strictObject:JU,string:$7,symbol:jU,transformer:B7,tuple:QU,undefined:$U,union:ZU,unknown:qU,void:KU,NEVER:vF,ZodIssueCode:Ke,quotelessJson:TU,ZodError:$i});var yF=Object.defineProperty,bF=i((e,t)=>yF(e,"name",{value:t,configurable:!0}),"__name"),g0=z.array(z.string().or(z.record(z.any()))),jZ=z.object({type:z.string().optional(),narrative:z.string().optional()}),v0=z.string().or(z.object({id:z.string(),type:z.string(),caption:z.string().optional()})),wF=z.object({type:z.string().min(1).or(z.string().array().nonempty()),latitude:z.number(),longitude:z.number()}),_F=z.object({type:z.string().min(1).or(z.string().array().nonempty()),addressCountry:z.string().optional(),addressCountryCode:z.string().optional(),addressRegion:z.string().optional(),addressLocality:z.string().optional(),streetAddress:z.string().optional(),postOfficeBoxNumber:z.string().optional(),postalCode:z.string().optional(),geo:wF.optional()}),EF=z.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(z.string()),Y7=z.object({type:z.string().min(1).or(z.string().array().nonempty()),identifier:z.string(),identifierType:EF}),jf=z.string().or(z.object({id:z.string().optional(),type:z.string().or(z.string().array().nonempty().optional()),name:z.string().optional(),url:z.string().optional(),phone:z.string().optional(),description:z.string().optional(),endorsement:z.any().array().optional(),image:v0.optional(),email:z.string().email().optional(),address:_F.optional(),otherIdentifier:Y7.array().optional(),official:z.string().optional(),parentOrg:z.any().optional(),familyName:z.string().optional(),givenName:z.string().optional(),additionalName:z.string().optional(),patronymicName:z.string().optional(),honorificPrefix:z.string().optional(),honorificSuffix:z.string().optional(),familyNamePrefix:z.string().optional(),dateOfBirth:z.string().optional()}).catchall(z.any())),Py=z.object({id:z.string().optional()}).catchall(z.any()),h0=z.object({type:z.string(),id:z.string()}).catchall(z.any()),q7=z.object({id:z.string(),type:z.string()}).catchall(z.any()),V7=z.object({id:z.string().optional(),type:z.string()}).catchall(z.any()),K7=z.object({type:z.string(),id:z.string().optional()}).catchall(z.any()),G7=z.object({type:z.string().or(z.string().array().nonempty()),id:z.string().optional()}).catchall(z.any()),p0=z.object({"@context":g0,id:z.string().optional(),type:z.string().array().nonempty(),issuer:jf,credentialSubject:Py.or(Py.array()),refreshService:V7.or(V7.array()).optional(),credentialSchema:q7.or(q7.array()).optional(),issuanceDate:z.string().optional(),expirationDate:z.string().optional(),credentialStatus:h0.or(h0.array()).optional(),name:z.string().optional(),description:z.string().optional(),validFrom:z.string().optional(),validUntil:z.string().optional(),status:h0.or(h0.array()).optional(),termsOfUse:K7.or(K7.array()).optional(),evidence:G7.or(G7.array()).optional()}).catchall(z.any()),ja=z.object({type:z.string(),created:z.string(),challenge:z.string().optional(),domain:z.string().optional(),nonce:z.string().optional(),proofPurpose:z.string(),verificationMethod:z.string(),jws:z.string().optional()}).catchall(z.any()),m0=p0.extend({proof:ja.or(ja.array())}),AF=z.object({"@context":g0,id:z.string().optional(),type:z.string().or(z.string().array().nonempty()),verifiableCredential:m0.or(m0.array()).optional(),holder:z.string().optional()}).catchall(z.any()),$Z=AF.extend({proof:ja.or(ja.array())}),Uy=z.object({kty:z.string(),crv:z.string(),x:z.string(),y:z.string().optional(),n:z.string().optional(),d:z.string().optional()}),qZ=Uy.omit({d:!0}).extend({d:z.string()}),SF=z.object({alg:z.string(),iv:z.string(),tag:z.string(),epk:Uy.partial().optional(),kid:z.string().optional(),apv:z.string().optional(),apu:z.string().optional()}),xF=z.object({header:SF,encrypted_key:z.string()}),TF=z.object({protected:z.string(),iv:z.string(),ciphertext:z.string(),tag:z.string(),aad:z.string().optional(),recipients:xF.array().optional()}),hc=z.string().or(z.object({"@context":g0.optional(),id:z.string(),type:z.string(),controller:z.string(),publicKeyJwk:Uy.optional(),publicKeyBase58:z.string().optional(),blockChainAccountId:z.string().optional()}).catchall(z.any())),CF=z.object({id:z.string(),type:z.string().or(z.string().array().nonempty()),serviceEndpoint:z.any().or(z.any().array().nonempty())}).catchall(z.any()),VZ=z.object({"@context":g0,id:z.string(),alsoKnownAs:z.string().optional(),controller:z.string().or(z.string().array().nonempty()).optional(),verificationMethod:hc.array().optional(),authentication:hc.array().optional(),assertionMethod:hc.array().optional(),keyAgreement:hc.array().optional(),capabilityInvocation:hc.array().optional(),capabilityDelegation:hc.array().optional(),publicKey:hc.array().optional(),service:CF.array().optional(),proof:ja.or(ja.array()).optional()}).catchall(z.any()),MF=z.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(z.string()),y0=z.object({type:z.string().array().nonempty(),targetCode:z.string().optional(),targetDescription:z.string().optional(),targetName:z.string(),targetFramework:z.string().optional(),targetType:MF.optional(),targetUrl:z.string()}),IF=z.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),kF=IF.or(z.string()),DF=z.object({id:z.string().optional(),narrative:z.string().optional()}).catchall(z.any()),RF=z.object({id:z.string(),type:z.string().array().nonempty(),endorsementComment:z.string().optional()}),OF=p0.extend({credentialSubject:RF,proof:ja.or(ja.array()).optional()}),NF=z.object({id:z.string(),"@language":z.string().optional(),version:z.string().optional()}),PF=z.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(z.string()),BF=z.object({id:z.string(),type:z.string().array().nonempty(),alignment:y0.array().optional(),description:z.string().optional(),level:z.string().optional(),name:z.string(),points:z.string().optional()}).catchall(z.any()),LF=z.object({id:z.string(),type:z.string().array().nonempty(),alignment:y0.array().optional(),allowedValue:z.string().array().optional(),name:z.string(),requiredLevel:z.string().optional(),requiredValue:z.string().optional(),resultType:PF,rubricCriterionLevel:BF.array().optional(),valueMax:z.string().optional(),valueMin:z.string().optional()}).catchall(z.any()),UF=z.object({id:z.string().optional(),type:z.string().array().nonempty(),alignment:y0.array().optional(),achievementType:kF.optional(),creator:jf.optional(),creditsAvailable:z.number().optional(),criteria:DF,description:z.string(),endorsement:OF.array().optional(),fieldOfStudy:z.string().optional(),humanCode:z.string().optional(),image:v0.optional(),"@language":z.string().optional(),name:z.string(),otherIdentifier:Y7.array().optional(),related:NF.array().optional(),resultDescription:LF.array().optional(),specialization:z.string().optional(),tag:z.string().array().optional(),version:z.string().optional()}).catchall(z.any()),FF=z.object({type:z.string(),hashed:z.boolean(),identityHash:z.string(),identityType:z.string(),salt:z.string().optional()}),jF=z.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),$F=z.object({type:z.string().array().nonempty(),achievedLevel:z.string().optional(),alignment:y0.array().optional(),resultDescription:z.string().optional(),status:jF.optional(),value:z.string().optional()}).catchall(z.any()),W7=z.object({id:z.string().optional(),type:z.string().array().nonempty(),activityEndDate:z.string().optional(),activityStartDate:z.string().optional(),creditsEarned:z.number().optional(),achievement:UF.optional(),identifier:FF.array().optional(),image:v0.optional(),licenseNumber:z.string().optional(),narrative:z.string().optional(),result:$F.array().optional(),role:z.string().optional(),source:jf.optional(),term:z.string().optional()}).catchall(z.any()),zF=z.object({id:z.string().optional(),type:z.string().or(z.string().array().nonempty()),narrative:z.string().optional(),name:z.string().optional(),description:z.string().optional(),genre:z.string().optional(),audience:z.string().optional()}).catchall(z.any()),HF=p0.extend({name:z.string().optional(),description:z.string().optional(),image:v0.optional(),credentialSubject:W7.or(W7.array()),endorsement:p0.array().optional(),evidence:zF.array().optional()}),GZ=HF.extend({proof:ja.or(ja.array())}),JZ=z.object({checks:z.string().array(),warnings:z.string().array(),errors:z.string().array()}),X7=z.enum(["Success","Failed","Error"]),ZZ=X7.enum,YZ=z.object({check:z.string(),status:X7,message:z.string().optional(),details:z.string().optional()}),XZ=z.object({title:z.string().optional(),createdAt:z.string().optional(),issuer:jf.optional(),issuee:jf.optional(),credentialSubject:Py.optional()}),mc=z.object({id:z.string(),uri:z.string()}).catchall(z.any()),tY=z.object({limit:z.number(),cursor:z.string().optional(),sort:z.string().optional()}),Jn=z.object({cursor:z.string().optional(),hasMore:z.boolean()}),Q7=z.object({encryptedRecord:TF,fields:z.string().array()}).catchall(z.any()),rY=Jn.extend({records:Q7.array()}),qF=Q7.extend({id:z.string()}),nY=Jn.extend({records:qF.array()}),J7=bF(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),VF=z.instanceof(RegExp).or(z.string().refine(e=>{try{return J7(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=J7(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),pr=z.string().or(z.object({$in:z.string().array()})).or(z.object({$regex:VF})),KF=z.object({backgroundColor:z.string().optional(),backgroundImage:z.string().optional(),fadeBackgroundImage:z.boolean().optional(),repeatBackgroundImage:z.boolean().optional(),fontColor:z.string().optional(),accentColor:z.string().optional(),accentFontColor:z.string().optional(),idBackgroundImage:z.string().optional(),fadeIdBackgroundImage:z.boolean().optional(),idBackgroundColor:z.string().optional(),repeatIdBackgroundImage:z.boolean().optional()}),pc=z.object({profileId:z.string().min(3).max(40),displayName:z.string().default(""),shortBio:z.string().default(""),bio:z.string().default(""),did:z.string(),isPrivate:z.boolean().optional(),email:z.string().optional(),image:z.string().optional(),heroImage:z.string().optional(),websiteLink:z.string().optional(),isServiceProfile:z.boolean().default(!1).optional(),type:z.string().optional(),notificationsWebhook:z.string().url().startsWith("http").optional(),display:KF.optional()}),oY=z.object({profileId:pr,displayName:pr,shortBio:pr,bio:pr,email:pr,websiteLink:pr,isServiceProfile:z.boolean(),type:pr}).partial(),sY=Jn.extend({records:pc.array()}),cY=z.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),eA=z.object({id:z.string(),created:z.string(),displayName:z.string().default("").optional(),shortBio:z.string().default("").optional(),bio:z.string().default("").optional(),email:z.string().optional(),image:z.string().optional(),heroImage:z.string().optional()}),uY=Jn.extend({records:eA.extend({did:z.string()}).array()}),lY=z.object({id:pr,displayName:pr,shortBio:pr,bio:pr,email:pr}).partial(),fY=Jn.extend({records:z.object({profile:pc,manager:eA.extend({did:z.string()}).optional()}).array()}),dY=z.object({uri:z.string(),to:z.string(),from:z.string(),sent:z.string().datetime(),received:z.string().datetime().optional()}),tA=z.object({role:z.string(),canEdit:z.boolean(),canIssue:z.boolean(),canRevoke:z.boolean(),canManagePermissions:z.boolean(),canIssueChildren:z.string(),canCreateChildren:z.string(),canEditChildren:z.string(),canRevokeChildren:z.string(),canManageChildrenPermissions:z.string(),canManageChildrenProfiles:z.boolean().default(!1).optional(),canViewAnalytics:z.boolean()}),GF=z.object({role:pr,canEdit:z.boolean(),canIssue:z.boolean(),canRevoke:z.boolean(),canManagePermissions:z.boolean(),canIssueChildren:pr,canCreateChildren:pr,canEditChildren:pr,canRevokeChildren:pr,canManageChildrenPermissions:pr,canManageChildrenProfiles:z.boolean(),canViewAnalytics:z.boolean()}).partial(),Z7=z.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),WF=z.discriminatedUnion("type",[z.object({type:z.literal(Z7.Values.GRANT_PERMISSIONS),data:z.object({claimUri:z.string(),targetUri:z.string(),permissions:tA.partial()})}),z.object({type:z.literal(Z7.Values.ADD_ADMIN),data:z.object({claimUri:z.string(),targetUri:z.string()})})]),hY=z.object({type:pr,data:z.object({claimUri:pr,targetUri:pr,permissions:GF})}).deepPartial(),JF=z.object({id:z.string(),createdAt:z.string(),updatedAt:z.string()}).and(WF),pY=Jn.extend({records:JF.array()}),By=z.enum(["DRAFT","LIVE"]),ZF=z.object({uri:z.string(),name:z.string().optional(),type:z.string().optional(),category:z.string().optional(),status:By.optional(),autoConnectRecipients:z.boolean().optional(),meta:z.record(z.any()).optional(),claimPermissions:tA.optional()}),mY=z.object({uri:pr,name:pr,type:pr,category:pr,meta:z.record(pr),status:By.or(z.object({$in:By.array()})),autoConnectRecipients:z.boolean()}).partial(),gY=Jn.extend({records:ZF.array()}),YF=z.object({to:pc,from:z.string(),received:z.string().optional(),uri:z.string().optional()}),vY=Jn.extend({records:YF.array()}),yY=z.object({endpoint:z.string(),name:z.string(),did:z.string().optional()}),bY=z.object({ttlSeconds:z.number().optional(),totalUses:z.number().optional()}),XF=z.object({endpoint:z.string()}),wY=z.object({signingAuthority:XF,relationship:z.object({name:z.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:z.string()})}),_Y=z.object({boostUri:z.string(),signingAuthority:z.object({endpoint:z.string(),name:z.string()})}),QF=z.enum(["live","stale","withdrawn"]),ej=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({categories:z.record(z.object({required:z.boolean()})).default({})}).default({}),personal:z.record(z.object({required:z.boolean()})).default({})}).default({}),write:z.object({credentials:z.object({categories:z.record(z.object({required:z.boolean()})).default({})}).default({}),personal:z.record(z.object({required:z.boolean()})).default({})}).default({})}),rA=z.object({contract:ej,owner:pc,name:z.string(),subtitle:z.string().optional(),description:z.string().optional(),reasonForAccessing:z.string().optional(),image:z.string().optional(),uri:z.string(),needsGuardianConsent:z.boolean().optional(),redirectUrl:z.string().optional(),frontDoorBoostUri:z.string().optional(),createdAt:z.string(),updatedAt:z.string(),expiresAt:z.string().optional(),autoBoosts:z.string().array().optional()}),EY=Jn.extend({records:rA.omit({owner:!0}).array()}),tj=z.object({credentials:z.object({categories:z.record(z.string().array()).default({})}),personal:z.record(z.string()).default({}),date:z.string()}),AY=Jn.extend({records:tj.array()}),rj=z.object({credentials:z.object({category:z.string(),uri:z.string()}).array(),personal:z.record(z.string()).default({}),date:z.string(),contractUri:z.string()}),SY=Jn.extend({records:rj.array()}),nA=z.object({sharing:z.boolean().optional(),shared:z.string().array().optional(),shareAll:z.boolean().optional(),shareUntil:z.string().optional()}),iA=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({shareAll:z.boolean().optional(),sharing:z.boolean().optional(),categories:z.record(nA).default({})}).default({}),personal:z.record(z.string()).default({})}).default({}),write:z.object({credentials:z.object({categories:z.record(z.boolean()).default({})}).default({}),personal:z.record(z.boolean()).default({})}).default({})}),xY=Jn.extend({records:z.object({expiresAt:z.string().optional(),oneTime:z.boolean().optional(),terms:iA,contract:rA,uri:z.string(),consenter:pc,status:QF}).array()}),TY=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({categories:z.record(z.object({required:z.boolean().optional()})).optional()}).optional(),personal:z.record(z.object({required:z.boolean().optional()})).optional()}).optional(),write:z.object({credentials:z.object({categories:z.record(z.object({required:z.boolean().optional()})).optional()}).optional(),personal:z.record(z.object({required:z.boolean().optional()})).optional()}).optional()}),CY=z.object({anonymize:z.boolean().optional(),credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional()}),MY=z.object({credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional(),id:pr.optional()}),nj=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({shareAll:z.boolean().optional(),sharing:z.boolean().optional(),categories:z.record(nA.optional()).optional()}).optional(),personal:z.record(z.string()).optional()}).optional(),write:z.object({credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional()}).optional()}),Ly=z.enum(["consent","update","sync","withdraw","write"]),IY=z.object({terms:nj.optional(),action:Ly.or(Ly.array()).optional(),date:z.object({$gt:z.string()}).or(z.object({$lt:z.string()})).or(z.object({$eq:z.string()})).optional(),expiresAt:z.object({$gt:z.string()}).or(z.object({$lt:z.string()})).or(z.object({$eq:z.string()})).optional(),oneTime:z.boolean().optional()}),aA=z.object({expiresAt:z.string().optional(),oneTime:z.boolean().optional(),terms:iA.optional(),id:z.string(),action:Ly,date:z.string(),uris:z.string().array().optional()}),kY=Jn.extend({records:aA.array()}),ij=z.object({credentialUri:z.string(),termsUri:z.string(),contractUri:z.string(),boostUri:z.string(),category:z.string().optional(),date:z.string()}),DY=Jn.extend({records:ij.array()}),aj=z.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),oj=z.object({title:z.string().optional(),body:z.string().optional()}),sj=z.object({vcUris:z.array(z.string()).optional(),vpUris:z.array(z.string()).optional(),transaction:aA.optional()}),RY=z.object({type:aj,to:pc.partial().and(z.object({did:z.string()})),from:pc.partial().and(z.object({did:z.string()})),message:oj.optional(),data:sj.optional(),sent:z.string().datetime().optional()}),cj="auth-grant:",OY=z.object({id:z.string(),name:z.string(),description:z.string().optional(),challenge:z.string().startsWith(cj).min(10,{message:"Challenge is too short"}).max(100,{message:"Challenge is too long"}),status:z.enum(["revoked","active"],{required_error:"Status is required",invalid_type_error:"Status must be either active or revoked"}),scope:z.string(),createdAt:z.string().datetime({message:"createdAt must be a valid ISO 8601 datetime string"}),expiresAt:z.string().datetime({message:"expiresAt must be a valid ISO 8601 datetime string"}).nullish().optional()}),NY=z.object({id:z.string()}).catchall(z.any()),uj=z.enum(["active","revoked"]),PY=z.object({id:pr,name:pr,description:pr,status:uj}).partial();var lj=Object.create,bd=Object.defineProperty,fj=Object.getOwnPropertyDescriptor,f6=Object.getOwnPropertyNames,dj=Object.getPrototypeOf,hj=Object.prototype.hasOwnProperty,o=i((e,t)=>bd(e,"name",{value:t,configurable:!0}),"__name"),db=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),gr=i((e,t)=>i(function(){return e&&(t=(0,e[f6(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[f6(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),xr=i((e,t)=>{for(var r in t)bd(e,r,{get:t[r],enumerable:!0})},"__export"),MS=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of f6(t))!hj.call(e,a)&&a!==r&&bd(e,a,{get:()=>t[a],enumerable:!(n=fj(t,a))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?lj(dj(e)):{},MS(t||!e||!e.__esModule?bd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),Fy=i(e=>MS(bd({},"__esModule",{value:!0}),e),"__toCommonJS"),pj=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",a=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",p=500,g="__lodash_placeholder__",v=1,y=2,_=4,x=1,O=2,D=1,P=2,J=4,j=8,q=16,Q=32,Y=64,k=128,K=256,he=512,me=30,we="...",Z=800,w=16,T=1,b=2,f=3,m=1/0,E=9007199254740991,R=17976931348623157e292,C=0/0,A=4294967295,B=A-1,V=A>>>1,I=[["ary",k],["bind",D],["bindKey",P],["curry",j],["curryRight",q],["flip",he],["partial",Q],["partialRight",Y],["rearg",K]],U="[object Arguments]",ge="[object Array]",L="[object AsyncFunction]",ne="[object Boolean]",oe="[object Date]",M="[object DOMException]",G="[object Error]",ae="[object Function]",fe="[object GeneratorFunction]",be="[object Map]",Re="[object Number]",X="[object Null]",N="[object Object]",F="[object Promise]",W="[object Proxy]",ie="[object RegExp]",ee="[object Set]",ue="[object String]",Ae="[object Symbol]",De="[object Undefined]",Ie="[object WeakMap]",Be="[object WeakSet]",qe="[object ArrayBuffer]",ve="[object DataView]",pe="[object Float32Array]",re="[object Float64Array]",le="[object Int8Array]",_e="[object Int16Array]",Te="[object Int32Array]",Ce="[object Uint8Array]",Oe="[object Uint8ClampedArray]",Ct="[object Uint16Array]",Ve="[object Uint32Array]",He=/\b__p \+= '';/g,Ot=/\b(__p \+=) '' \+/g,dt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,Or=/[&<>"']/g,ct=RegExp(mt.source),ut=RegExp(Or.source),lr=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,or=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,it=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,at=RegExp(Qt.source),et=/^\s+/,sr=/\s/,ot=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ze=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Et=/[()=,{}\[\]\/\s]/,Tn=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,hn=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,tr=/^\[object .+?Constructor\]$/,nn=/^0o[0-7]+$/i,an=/^(?:0|[1-9]\d*)$/,Nr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vr=/($^)/,on=/['\n\r\u2028\u2029\\]/g,Cn="\\ud800-\\udfff",Ci="\\u0300-\\u036f",Mi="\\ufe20-\\ufe2f",Ii="\\u20d0-\\u20ff",Ln=Ci+Mi+Ii,pn="\\u2700-\\u27bf",ri="a-z\\xdf-\\xf6\\xf8-\\xff",Un="\\xac\\xb1\\xd7\\xf7",ki="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Di="\\u2000-\\u206f",Ri=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Qa="A-Z\\xc0-\\xd6\\xd8-\\xde",eo="\\ufe0e\\ufe0f",to=Un+ki+Di+Ri,Po="['\u2019]",Pd="["+Cn+"]",_l="["+to+"]",ks="["+Ln+"]",El="\\d+",Bd="["+pn+"]",Al="["+ri+"]",Sl="[^"+Cn+to+El+pn+ri+Qa+"]",Ds="\\ud83c[\\udffb-\\udfff]",Ld="(?:"+ks+"|"+Ds+")",xl="[^"+Cn+"]",ro="(?:\\ud83c[\\udde6-\\uddff]){2}",Zi="[\\ud800-\\udbff][\\udc00-\\udfff]",no="["+Qa+"]",ba="\\u200d",Tl="(?:"+Al+"|"+Sl+")",Ud="(?:"+no+"|"+Sl+")",Cl="(?:"+Po+"(?:d|ll|m|re|s|t|ve))?",Ml="(?:"+Po+"(?:D|LL|M|RE|S|T|VE))?",Il=Ld+"?",kl="["+eo+"]?",Dl="(?:"+ba+"(?:"+[xl,ro,Zi].join("|")+")"+kl+Il+")*",wa="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",qc=kl+Il+Dl,jd="(?:"+[Bd,ro,Zi].join("|")+")"+qc,Rl="(?:"+[xl+ks+"?",ks,ro,Zi,Pd].join("|")+")",Ol=RegExp(Po,"g"),$d=RegExp(ks,"g"),Nl=RegExp(Ds+"(?="+Ds+")|"+Rl+qc,"g"),Pl=RegExp([no+"?"+Al+"+"+Cl+"(?="+[_l,no,"$"].join("|")+")",Ud+"+"+Ml+"(?="+[_l,no+Tl,"$"].join("|")+")",no+"?"+Tl+"+"+Cl,no+"+"+Ml,Fd,wa,El,jd].join("|"),"g"),zd=RegExp("["+ba+Cn+Ln+eo+"]"),Rs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Hd=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Vc=-1,wr={};wr[pe]=wr[re]=wr[le]=wr[_e]=wr[Te]=wr[Ce]=wr[Oe]=wr[Ct]=wr[Ve]=!0,wr[U]=wr[ge]=wr[qe]=wr[ne]=wr[ve]=wr[oe]=wr[G]=wr[ae]=wr[be]=wr[Re]=wr[N]=wr[ie]=wr[ee]=wr[ue]=wr[Ie]=!1;var vr={};vr[U]=vr[ge]=vr[qe]=vr[ve]=vr[ne]=vr[oe]=vr[pe]=vr[re]=vr[le]=vr[_e]=vr[Te]=vr[be]=vr[Re]=vr[N]=vr[ie]=vr[ee]=vr[ue]=vr[Ae]=vr[Ce]=vr[Oe]=vr[Ct]=vr[Ve]=!0,vr[G]=vr[ae]=vr[Ie]=!1;var de={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Me={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Le={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Kr=parseFloat,sn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,mn=typeof self=="object"&&self&&self.Object===Object&&self,Fr=Mn||mn||Function("return this")(),_a=typeof e=="object"&&e&&!e.nodeType&&e,Ea=_a&&typeof t=="object"&&t&&!t.nodeType&&t,Bl=Ea&&Ea.exports===_a,Kc=Bl&&Mn.process,gn=function(){try{var Se=Ea&&Ea.require&&Ea.require("util").types;return Se||Kc&&Kc.binding&&Kc.binding("util")}catch{}}(),Os=gn&&gn.isArrayBuffer,K2=gn&&gn.isDate,G2=gn&&gn.isMap,W2=gn&&gn.isRegExp,J2=gn&&gn.isSet,Z2=gn&&gn.isTypedArray;function Fn(Se,Pe,ke){switch(ke.length){case 0:return Se.call(Pe);case 1:return Se.call(Pe,ke[0]);case 2:return Se.call(Pe,ke[0],ke[1]);case 3:return Se.call(Pe,ke[0],ke[1],ke[2])}return Se.apply(Pe,ke)}i(Fn,"apply"),o(Fn,"apply");function Y2(Se,Pe,ke,ft){for(var kt=-1,fr=Se==null?0:Se.length;++kt<fr;){var Wr=Se[kt];Pe(ft,Wr,ke(Wr),Se)}return ft}i(Y2,"arrayAggregator"),o(Y2,"arrayAggregator");function ni(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(ni,"arrayEach"),o(ni,"arrayEach");function X2(Se,Pe){for(var ke=Se==null?0:Se.length;ke--&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(X2,"arrayEachRight"),o(X2,"arrayEachRight");function a1(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft;)if(!Pe(Se[ke],ke,Se))return!1;return!0}i(a1,"arrayEvery"),o(a1,"arrayEvery");function io(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length,kt=0,fr=[];++ke<ft;){var Wr=Se[ke];Pe(Wr,ke,Se)&&(fr[kt++]=Wr)}return fr}i(io,"arrayFilter"),o(io,"arrayFilter");function Ll(Se,Pe){var ke=Se==null?0:Se.length;return!!ke&&Ns(Se,Pe,0)>-1}i(Ll,"arrayIncludes"),o(Ll,"arrayIncludes");function qd(Se,Pe,ke){for(var ft=-1,kt=Se==null?0:Se.length;++ft<kt;)if(ke(Pe,Se[ft]))return!0;return!1}i(qd,"arrayIncludesWith"),o(qd,"arrayIncludesWith");function Mr(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length,kt=Array(ft);++ke<ft;)kt[ke]=Pe(Se[ke],ke,Se);return kt}i(Mr,"arrayMap"),o(Mr,"arrayMap");function ao(Se,Pe){for(var ke=-1,ft=Pe.length,kt=Se.length;++ke<ft;)Se[kt+ke]=Pe[ke];return Se}i(ao,"arrayPush"),o(ao,"arrayPush");function Vd(Se,Pe,ke,ft){var kt=-1,fr=Se==null?0:Se.length;for(ft&&fr&&(ke=Se[++kt]);++kt<fr;)ke=Pe(ke,Se[kt],kt,Se);return ke}i(Vd,"arrayReduce"),o(Vd,"arrayReduce");function Q2(Se,Pe,ke,ft){var kt=Se==null?0:Se.length;for(ft&&kt&&(ke=Se[--kt]);kt--;)ke=Pe(ke,Se[kt],kt,Se);return ke}i(Q2,"arrayReduceRight"),o(Q2,"arrayReduceRight");function Kd(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft;)if(Pe(Se[ke],ke,Se))return!0;return!1}i(Kd,"arraySome"),o(Kd,"arraySome");var lD=Gd("length");function e3(Se){return Se.split("")}i(e3,"asciiToArray"),o(e3,"asciiToArray");function t3(Se){return Se.match(st)||[]}i(t3,"asciiWords"),o(t3,"asciiWords");function o1(Se,Pe,ke){var ft;return ke(Se,function(kt,fr,Wr){if(Pe(kt,fr,Wr))return ft=fr,!1}),ft}i(o1,"baseFindKey"),o(o1,"baseFindKey");function Ul(Se,Pe,ke,ft){for(var kt=Se.length,fr=ke+(ft?1:-1);ft?fr--:++fr<kt;)if(Pe(Se[fr],fr,Se))return fr;return-1}i(Ul,"baseFindIndex"),o(Ul,"baseFindIndex");function Ns(Se,Pe,ke){return Pe===Pe?f3(Se,Pe,ke):Ul(Se,s1,ke)}i(Ns,"baseIndexOf"),o(Ns,"baseIndexOf");function r3(Se,Pe,ke,ft){for(var kt=ke-1,fr=Se.length;++kt<fr;)if(ft(Se[kt],Pe))return kt;return-1}i(r3,"baseIndexOfWith"),o(r3,"baseIndexOfWith");function s1(Se){return Se!==Se}i(s1,"baseIsNaN"),o(s1,"baseIsNaN");function c1(Se,Pe){var ke=Se==null?0:Se.length;return ke?Jd(Se,Pe)/ke:C}i(c1,"baseMean"),o(c1,"baseMean");function Gd(Se){return function(Pe){return Pe==null?r:Pe[Se]}}i(Gd,"baseProperty"),o(Gd,"baseProperty");function Wd(Se){return function(Pe){return Se==null?r:Se[Pe]}}i(Wd,"basePropertyOf"),o(Wd,"basePropertyOf");function u1(Se,Pe,ke,ft,kt){return kt(Se,function(fr,Wr,_r){ke=ft?(ft=!1,fr):Pe(ke,fr,Wr,_r)}),ke}i(u1,"baseReduce"),o(u1,"baseReduce");function n3(Se,Pe){var ke=Se.length;for(Se.sort(Pe);ke--;)Se[ke]=Se[ke].value;return Se}i(n3,"baseSortBy"),o(n3,"baseSortBy");function Jd(Se,Pe){for(var ke,ft=-1,kt=Se.length;++ft<kt;){var fr=Pe(Se[ft]);fr!==r&&(ke=ke===r?fr:ke+fr)}return ke}i(Jd,"baseSum"),o(Jd,"baseSum");function Zd(Se,Pe){for(var ke=-1,ft=Array(Se);++ke<Se;)ft[ke]=Pe(ke);return ft}i(Zd,"baseTimes"),o(Zd,"baseTimes");function i3(Se,Pe){return Mr(Pe,function(ke){return[ke,Se[ke]]})}i(i3,"baseToPairs"),o(i3,"baseToPairs");function l1(Se){return Se&&Se.slice(0,p1(Se)+1).replace(et,"")}i(l1,"baseTrim"),o(l1,"baseTrim");function jn(Se){return function(Pe){return Se(Pe)}}i(jn,"baseUnary"),o(jn,"baseUnary");function Yd(Se,Pe){return Mr(Pe,function(ke){return Se[ke]})}i(Yd,"baseValues"),o(Yd,"baseValues");function Gc(Se,Pe){return Se.has(Pe)}i(Gc,"cacheHas"),o(Gc,"cacheHas");function f1(Se,Pe){for(var ke=-1,ft=Se.length;++ke<ft&&Ns(Pe,Se[ke],0)>-1;);return ke}i(f1,"charsStartIndex"),o(f1,"charsStartIndex");function d1(Se,Pe){for(var ke=Se.length;ke--&&Ns(Pe,Se[ke],0)>-1;);return ke}i(d1,"charsEndIndex"),o(d1,"charsEndIndex");function a3(Se,Pe){for(var ke=Se.length,ft=0;ke--;)Se[ke]===Pe&&++ft;return ft}i(a3,"countHolders"),o(a3,"countHolders");var fD=Wd(de),dD=Wd(Me);function o3(Se){return"\\"+ht[Se]}i(o3,"escapeStringChar"),o(o3,"escapeStringChar");function s3(Se,Pe){return Se==null?r:Se[Pe]}i(s3,"getValue"),o(s3,"getValue");function Ps(Se){return zd.test(Se)}i(Ps,"hasUnicode"),o(Ps,"hasUnicode");function c3(Se){return Rs.test(Se)}i(c3,"hasUnicodeWord"),o(c3,"hasUnicodeWord");function u3(Se){for(var Pe,ke=[];!(Pe=Se.next()).done;)ke.push(Pe.value);return ke}i(u3,"iteratorToArray"),o(u3,"iteratorToArray");function Xd(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft,kt){ke[++Pe]=[kt,ft]}),ke}i(Xd,"mapToArray"),o(Xd,"mapToArray");function h1(Se,Pe){return function(ke){return Se(Pe(ke))}}i(h1,"overArg"),o(h1,"overArg");function oo(Se,Pe){for(var ke=-1,ft=Se.length,kt=0,fr=[];++ke<ft;){var Wr=Se[ke];(Wr===Pe||Wr===g)&&(Se[ke]=g,fr[kt++]=ke)}return fr}i(oo,"replaceHolders"),o(oo,"replaceHolders");function Fl(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Pe]=ft}),ke}i(Fl,"setToArray"),o(Fl,"setToArray");function l3(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Pe]=[ft,ft]}),ke}i(l3,"setToPairs"),o(l3,"setToPairs");function f3(Se,Pe,ke){for(var ft=ke-1,kt=Se.length;++ft<kt;)if(Se[ft]===Pe)return ft;return-1}i(f3,"strictIndexOf"),o(f3,"strictIndexOf");function d3(Se,Pe,ke){for(var ft=ke+1;ft--;)if(Se[ft]===Pe)return ft;return ft}i(d3,"strictLastIndexOf"),o(d3,"strictLastIndexOf");function Bs(Se){return Ps(Se)?h3(Se):lD(Se)}i(Bs,"stringSize"),o(Bs,"stringSize");function Oi(Se){return Ps(Se)?p3(Se):e3(Se)}i(Oi,"stringToArray"),o(Oi,"stringToArray");function p1(Se){for(var Pe=Se.length;Pe--&&sr.test(Se.charAt(Pe)););return Pe}i(p1,"trimmedEndIndex"),o(p1,"trimmedEndIndex");var hD=Wd(Le);function h3(Se){for(var Pe=Nl.lastIndex=0;Nl.test(Se);)++Pe;return Pe}i(h3,"unicodeSize"),o(h3,"unicodeSize");function p3(Se){return Se.match(Nl)||[]}i(p3,"unicodeToArray"),o(p3,"unicodeToArray");function m3(Se){return Se.match(Pl)||[]}i(m3,"unicodeWords"),o(m3,"unicodeWords");var pD=o(i(function Se(Pe){Pe=Pe==null?Fr:Bo.defaults(Fr.Object(),Pe,Bo.pick(Fr,Hd));var ke=Pe.Array,ft=Pe.Date,kt=Pe.Error,fr=Pe.Function,Wr=Pe.Math,_r=Pe.Object,m1=Pe.RegExp,mD=Pe.String,Ni=Pe.TypeError,Qd=ke.prototype,gD=fr.prototype,Wc=_r.prototype,eh=Pe["__core-js_shared__"],th=gD.toString,yr=Wc.hasOwnProperty,vD=0,g3=function(){var u=/[^.]+$/.exec(eh&&eh.keys&&eh.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),rh=Wc.toString,yD=th.call(_r),bD=Fr._,wD=m1("^"+th.call(yr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nh=Bl?Pe.Buffer:r,Lo=Pe.Symbol,ih=Pe.Uint8Array,v3=nh?nh.allocUnsafe:r,ah=h1(_r.getPrototypeOf,_r),y3=_r.create,b3=Wc.propertyIsEnumerable,oh=Qd.splice,w3=Lo?Lo.isConcatSpreadable:r,jl=Lo?Lo.iterator:r,Ls=Lo?Lo.toStringTag:r,sh=function(){try{var u=Ho(_r,"defineProperty");return u({},"",{}),u}catch{}}(),_D=Pe.clearTimeout!==Fr.clearTimeout&&Pe.clearTimeout,ED=ft&&ft.now!==Fr.Date.now&&ft.now,AD=Pe.setTimeout!==Fr.setTimeout&&Pe.setTimeout,ch=Wr.ceil,uh=Wr.floor,g1=_r.getOwnPropertySymbols,SD=nh?nh.isBuffer:r,_3=Pe.isFinite,xD=Qd.join,TD=h1(_r.keys,_r),Jr=Wr.max,vn=Wr.min,CD=ft.now,MD=Pe.parseInt,E3=Wr.random,ID=Qd.reverse,v1=Ho(Pe,"DataView"),$l=Ho(Pe,"Map"),y1=Ho(Pe,"Promise"),Jc=Ho(Pe,"Set"),zl=Ho(Pe,"WeakMap"),Hl=Ho(_r,"create"),lh=zl&&new zl,Zc={},kD=qo(v1),DD=qo($l),RD=qo(y1),OD=qo(Jc),ND=qo(zl),fh=Lo?Lo.prototype:r,ql=fh?fh.valueOf:r,A3=fh?fh.toString:r;function se(u){if(Rr(u)&&!Nt(u)&&!(u instanceof Kt)){if(u instanceof ii)return u;if(yr.call(u,"__wrapped__"))return gg(u)}return new ii(u)}i(se,"lodash"),o(se,"lodash");var Yc=function(){function u(){}return i(u,"object"),o(u,"object"),function(d){if(!kr(d))return{};if(y3)return y3(d);u.prototype=d;var S=new u;return u.prototype=r,S}}();function Vl(){}i(Vl,"baseLodash"),o(Vl,"baseLodash");function ii(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=r}i(ii,"LodashWrapper"),o(ii,"LodashWrapper"),se.templateSettings={escape:lr,evaluate:lt,interpolate:nt,variable:"",imports:{_:se}},se.prototype=Vl.prototype,se.prototype.constructor=se,ii.prototype=Yc(Vl.prototype),ii.prototype.constructor=ii;function Kt(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}i(Kt,"LazyWrapper"),o(Kt,"LazyWrapper");function S3(){var u=new Kt(this.__wrapped__);return u.__actions__=In(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=In(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=In(this.__views__),u}i(S3,"lazyClone"),o(S3,"lazyClone");function x3(){if(this.__filtered__){var u=new Kt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(x3,"lazyReverse"),o(x3,"lazyReverse");function T3(){var u=this.__wrapped__.value(),d=this.__dir__,S=Nt(u),$=d<0,te=S?u.length:0,ce=j5(0,te,this.__views__),ye=ce.start,Ee=ce.end,xe=Ee-ye,Ue=$?Ee:ye-1,Fe=this.__iteratees__,$e=Fe.length,Ye=0,pt=vn(xe,this.__takeCount__);if(!S||!$&&te==xe&&pt==xe)return j1(u,this.__actions__);var St=[];e:for(;xe--&&Ye<pt;){Ue+=d;for(var Lt=-1,_t=u[Ue];++Lt<$e;){var Ht=Fe[Lt],Gt=Ht.iteratee,Hn=Ht.type,_n=Gt(_t);if(Hn==b)_t=_n;else if(!_n){if(Hn==T)continue e;break e}}St[Ye++]=_t}return St}i(T3,"lazyValue"),o(T3,"lazyValue"),Kt.prototype=Yc(Vl.prototype),Kt.prototype.constructor=Kt;function Uo(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(Uo,"Hash"),o(Uo,"Hash");function C3(){this.__data__=Hl?Hl(null):{},this.size=0}i(C3,"hashClear"),o(C3,"hashClear");function M3(u){var d=this.has(u)&&delete this.__data__[u];return this.size-=d?1:0,d}i(M3,"hashDelete"),o(M3,"hashDelete");function I3(u){var d=this.__data__;if(Hl){var S=d[u];return S===h?r:S}return yr.call(d,u)?d[u]:r}i(I3,"hashGet"),o(I3,"hashGet");function k3(u){var d=this.__data__;return Hl?d[u]!==r:yr.call(d,u)}i(k3,"hashHas"),o(k3,"hashHas");function D3(u,d){var S=this.__data__;return this.size+=this.has(u)?0:1,S[u]=Hl&&d===r?h:d,this}i(D3,"hashSet"),o(D3,"hashSet"),Uo.prototype.clear=C3,Uo.prototype.delete=M3,Uo.prototype.get=I3,Uo.prototype.has=k3,Uo.prototype.set=D3;function Aa(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(Aa,"ListCache"),o(Aa,"ListCache");function R3(){this.__data__=[],this.size=0}i(R3,"listCacheClear"),o(R3,"listCacheClear");function O3(u){var d=this.__data__,S=Kl(d,u);if(S<0)return!1;var $=d.length-1;return S==$?d.pop():oh.call(d,S,1),--this.size,!0}i(O3,"listCacheDelete"),o(O3,"listCacheDelete");function N3(u){var d=this.__data__,S=Kl(d,u);return S<0?r:d[S][1]}i(N3,"listCacheGet"),o(N3,"listCacheGet");function P3(u){return Kl(this.__data__,u)>-1}i(P3,"listCacheHas"),o(P3,"listCacheHas");function B3(u,d){var S=this.__data__,$=Kl(S,u);return $<0?(++this.size,S.push([u,d])):S[$][1]=d,this}i(B3,"listCacheSet"),o(B3,"listCacheSet"),Aa.prototype.clear=R3,Aa.prototype.delete=O3,Aa.prototype.get=N3,Aa.prototype.has=P3,Aa.prototype.set=B3;function Sa(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(Sa,"MapCache"),o(Sa,"MapCache");function L3(){this.size=0,this.__data__={hash:new Uo,map:new($l||Aa),string:new Uo}}i(L3,"mapCacheClear"),o(L3,"mapCacheClear");function U3(u){var d=af(this,u).delete(u);return this.size-=d?1:0,d}i(U3,"mapCacheDelete"),o(U3,"mapCacheDelete");function F3(u){return af(this,u).get(u)}i(F3,"mapCacheGet"),o(F3,"mapCacheGet");function j3(u){return af(this,u).has(u)}i(j3,"mapCacheHas"),o(j3,"mapCacheHas");function $3(u,d){var S=af(this,u),$=S.size;return S.set(u,d),this.size+=S.size==$?0:1,this}i($3,"mapCacheSet"),o($3,"mapCacheSet"),Sa.prototype.clear=L3,Sa.prototype.delete=U3,Sa.prototype.get=F3,Sa.prototype.has=j3,Sa.prototype.set=$3;function Fo(u){var d=-1,S=u==null?0:u.length;for(this.__data__=new Sa;++d<S;)this.add(u[d])}i(Fo,"SetCache"),o(Fo,"SetCache");function z3(u){return this.__data__.set(u,h),this}i(z3,"setCacheAdd"),o(z3,"setCacheAdd");function H3(u){return this.__data__.has(u)}i(H3,"setCacheHas"),o(H3,"setCacheHas"),Fo.prototype.add=Fo.prototype.push=z3,Fo.prototype.has=H3;function Pi(u){var d=this.__data__=new Aa(u);this.size=d.size}i(Pi,"Stack"),o(Pi,"Stack");function q3(){this.__data__=new Aa,this.size=0}i(q3,"stackClear"),o(q3,"stackClear");function V3(u){var d=this.__data__,S=d.delete(u);return this.size=d.size,S}i(V3,"stackDelete"),o(V3,"stackDelete");function K3(u){return this.__data__.get(u)}i(K3,"stackGet"),o(K3,"stackGet");function G3(u){return this.__data__.has(u)}i(G3,"stackHas"),o(G3,"stackHas");function W3(u,d){var S=this.__data__;if(S instanceof Aa){var $=S.__data__;if(!$l||$.length<a-1)return $.push([u,d]),this.size=++S.size,this;S=this.__data__=new Sa($)}return S.set(u,d),this.size=S.size,this}i(W3,"stackSet"),o(W3,"stackSet"),Pi.prototype.clear=q3,Pi.prototype.delete=V3,Pi.prototype.get=K3,Pi.prototype.has=G3,Pi.prototype.set=W3;function b1(u,d){var S=Nt(u),$=!S&&$s(u),te=!S&&!$&&Vo(u),ce=!S&&!$&&!te&&ou(u),ye=S||$||te||ce,Ee=ye?Zd(u.length,mD):[],xe=Ee.length;for(var Ue in u)(d||yr.call(u,Ue))&&!(ye&&(Ue=="length"||te&&(Ue=="offset"||Ue=="parent")||ce&&(Ue=="buffer"||Ue=="byteLength"||Ue=="byteOffset")||Ma(Ue,xe)))&&Ee.push(Ue);return Ee}i(b1,"arrayLikeKeys"),o(b1,"arrayLikeKeys");function w1(u){var d=u.length;return d?u[_h(0,d-1)]:r}i(w1,"arraySample"),o(w1,"arraySample");function J3(u,d){return sf(In(u),jo(d,0,u.length))}i(J3,"arraySampleSize"),o(J3,"arraySampleSize");function Z3(u){return sf(In(u))}i(Z3,"arrayShuffle"),o(Z3,"arrayShuffle");function dh(u,d,S){(S!==r&&!Bi(u[d],S)||S===r&&!(d in u))&&xa(u,d,S)}i(dh,"assignMergeValue"),o(dh,"assignMergeValue");function Xc(u,d,S){var $=u[d];(!(yr.call(u,d)&&Bi($,S))||S===r&&!(d in u))&&xa(u,d,S)}i(Xc,"assignValue"),o(Xc,"assignValue");function Kl(u,d){for(var S=u.length;S--;)if(Bi(u[S][0],d))return S;return-1}i(Kl,"assocIndexOf"),o(Kl,"assocIndexOf");function Y3(u,d,S,$){return $o(u,function(te,ce,ye){d($,te,S(te),ye)}),$}i(Y3,"baseAggregator"),o(Y3,"baseAggregator");function _1(u,d){return u&&Xi(d,Zr(d),u)}i(_1,"baseAssign"),o(_1,"baseAssign");function X3(u,d){return u&&Xi(d,Dn(d),u)}i(X3,"baseAssignIn"),o(X3,"baseAssignIn");function xa(u,d,S){d=="__proto__"&&sh?sh(u,d,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[d]=S}i(xa,"baseAssignValue"),o(xa,"baseAssignValue");function hh(u,d){for(var S=-1,$=d.length,te=ke($),ce=u==null;++S<$;)te[S]=ce?r:zh(u,d[S]);return te}i(hh,"baseAt"),o(hh,"baseAt");function jo(u,d,S){return u===u&&(S!==r&&(u=u<=S?u:S),d!==r&&(u=u>=d?u:d)),u}i(jo,"baseClamp"),o(jo,"baseClamp");function ai(u,d,S,$,te,ce){var ye,Ee=d&v,xe=d&y,Ue=d&_;if(S&&(ye=te?S(u,$,te,ce):S(u)),ye!==r)return ye;if(!kr(u))return u;var Fe=Nt(u);if(Fe){if(ye=z5(u),!Ee)return In(u,ye)}else{var $e=bn(u),Ye=$e==ae||$e==fe;if(Vo(u))return z1(u,Ee);if($e==N||$e==U||Ye&&!te){if(ye=xe||Ye?{}:cg(u),!Ee)return xe?D5(u,X3(ye,u)):k5(u,_1(ye,u))}else{if(!vr[$e])return te?u:{};ye=H5(u,$e,Ee)}}ce||(ce=new Pi);var pt=ce.get(u);if(pt)return pt;ce.set(u,ye),F4(u)?u.forEach(function(_t){ye.add(ai(_t,d,S,_t,u,ce))}):D4(u)&&u.forEach(function(_t,Ht){ye.set(Ht,ai(_t,d,S,Ht,u,ce))});var St=Ue?xe?Rh:Dh:xe?Dn:Zr,Lt=Fe?r:St(u);return ni(Lt||u,function(_t,Ht){Lt&&(Ht=_t,_t=u[Ht]),Xc(ye,Ht,ai(_t,d,S,Ht,u,ce))}),ye}i(ai,"baseClone"),o(ai,"baseClone");function Q3(u){var d=Zr(u);return function(S){return E1(S,u,d)}}i(Q3,"baseConforms"),o(Q3,"baseConforms");function E1(u,d,S){var $=S.length;if(u==null)return!$;for(u=_r(u);$--;){var te=S[$],ce=d[te],ye=u[te];if(ye===r&&!(te in u)||!ce(ye))return!1}return!0}i(E1,"baseConformsTo"),o(E1,"baseConformsTo");function A1(u,d,S){if(typeof u!="function")throw new Ni(c);return of(function(){u.apply(r,S)},d)}i(A1,"baseDelay"),o(A1,"baseDelay");function Qc(u,d,S,$){var te=-1,ce=Ll,ye=!0,Ee=u.length,xe=[],Ue=d.length;if(!Ee)return xe;S&&(d=Mr(d,jn(S))),$?(ce=qd,ye=!1):d.length>=a&&(ce=Gc,ye=!1,d=new Fo(d));e:for(;++te<Ee;){var Fe=u[te],$e=S==null?Fe:S(Fe);if(Fe=$||Fe!==0?Fe:0,ye&&$e===$e){for(var Ye=Ue;Ye--;)if(d[Ye]===$e)continue e;xe.push(Fe)}else ce(d,$e,$)||xe.push(Fe)}return xe}i(Qc,"baseDifference"),o(Qc,"baseDifference");var $o=G1(Yi),e5=G1(ph,!0);function t5(u,d){var S=!0;return $o(u,function($,te,ce){return S=!!d($,te,ce),S}),S}i(t5,"baseEvery"),o(t5,"baseEvery");function Gl(u,d,S){for(var $=-1,te=u.length;++$<te;){var ce=u[$],ye=d(ce);if(ye!=null&&(Ee===r?ye===ye&&!zn(ye):S(ye,Ee)))var Ee=ye,xe=ce}return xe}i(Gl,"baseExtremum"),o(Gl,"baseExtremum");function r5(u,d,S,$){var te=u.length;for(S=Pt(S),S<0&&(S=-S>te?0:te+S),$=$===r||$>te?te:Pt($),$<0&&($+=te),$=S>$?0:Lg($);S<$;)u[S++]=d;return u}i(r5,"baseFill"),o(r5,"baseFill");function S1(u,d){var S=[];return $o(u,function($,te,ce){d($,te,ce)&&S.push($)}),S}i(S1,"baseFilter"),o(S1,"baseFilter");function Xr(u,d,S,$,te){var ce=-1,ye=u.length;for(S||(S=V5),te||(te=[]);++ce<ye;){var Ee=u[ce];d>0&&S(Ee)?d>1?Xr(Ee,d-1,S,$,te):ao(te,Ee):$||(te[te.length]=Ee)}return te}i(Xr,"baseFlatten"),o(Xr,"baseFlatten");var x1=W1(),n5=W1(!0);function Yi(u,d){return u&&x1(u,d,Zr)}i(Yi,"baseForOwn"),o(Yi,"baseForOwn");function ph(u,d){return u&&n5(u,d,Zr)}i(ph,"baseForOwnRight"),o(ph,"baseForOwnRight");function Wl(u,d){return io(d,function(S){return Ia(u[S])})}i(Wl,"baseFunctions"),o(Wl,"baseFunctions");function zo(u,d){d=co(d,u);for(var S=0,$=d.length;u!=null&&S<$;)u=u[Qi(d[S++])];return S&&S==$?u:r}i(zo,"baseGet"),o(zo,"baseGet");function T1(u,d,S){var $=d(u);return Nt(u)?$:ao($,S(u))}i(T1,"baseGetAllKeys"),o(T1,"baseGetAllKeys");function yn(u){return u==null?u===r?De:X:Ls&&Ls in _r(u)?U5(u):Y5(u)}i(yn,"baseGetTag"),o(yn,"baseGetTag");function mh(u,d){return u>d}i(mh,"baseGt"),o(mh,"baseGt");function i5(u,d){return u!=null&&yr.call(u,d)}i(i5,"baseHas"),o(i5,"baseHas");function a5(u,d){return u!=null&&d in _r(u)}i(a5,"baseHasIn"),o(a5,"baseHasIn");function o5(u,d,S){return u>=vn(d,S)&&u<Jr(d,S)}i(o5,"baseInRange"),o(o5,"baseInRange");function gh(u,d,S){for(var $=S?qd:Ll,te=u[0].length,ce=u.length,ye=ce,Ee=ke(ce),xe=1/0,Ue=[];ye--;){var Fe=u[ye];ye&&d&&(Fe=Mr(Fe,jn(d))),xe=vn(Fe.length,xe),Ee[ye]=!S&&(d||te>=120&&Fe.length>=120)?new Fo(ye&&Fe):r}Fe=u[0];var $e=-1,Ye=Ee[0];e:for(;++$e<te&&Ue.length<xe;){var pt=Fe[$e],St=d?d(pt):pt;if(pt=S||pt!==0?pt:0,!(Ye?Gc(Ye,St):$(Ue,St,S))){for(ye=ce;--ye;){var Lt=Ee[ye];if(!(Lt?Gc(Lt,St):$(u[ye],St,S)))continue e}Ye&&Ye.push(St),Ue.push(pt)}}return Ue}i(gh,"baseIntersection"),o(gh,"baseIntersection");function s5(u,d,S,$){return Yi(u,function(te,ce,ye){d($,S(te),ce,ye)}),$}i(s5,"baseInverter"),o(s5,"baseInverter");function eu(u,d,S){d=co(d,u),u=dg(u,d);var $=u==null?u:u[Qi(si(d))];return $==null?r:Fn($,u,S)}i(eu,"baseInvoke"),o(eu,"baseInvoke");function C1(u){return Rr(u)&&yn(u)==U}i(C1,"baseIsArguments"),o(C1,"baseIsArguments");function c5(u){return Rr(u)&&yn(u)==qe}i(c5,"baseIsArrayBuffer"),o(c5,"baseIsArrayBuffer");function u5(u){return Rr(u)&&yn(u)==oe}i(u5,"baseIsDate"),o(u5,"baseIsDate");function tu(u,d,S,$,te){return u===d?!0:u==null||d==null||!Rr(u)&&!Rr(d)?u!==u&&d!==d:l5(u,d,S,$,tu,te)}i(tu,"baseIsEqual"),o(tu,"baseIsEqual");function l5(u,d,S,$,te,ce){var ye=Nt(u),Ee=Nt(d),xe=ye?ge:bn(u),Ue=Ee?ge:bn(d);xe=xe==U?N:xe,Ue=Ue==U?N:Ue;var Fe=xe==N,$e=Ue==N,Ye=xe==Ue;if(Ye&&Vo(u)){if(!Vo(d))return!1;ye=!0,Fe=!1}if(Ye&&!Fe)return ce||(ce=new Pi),ye||ou(u)?ig(u,d,S,$,te,ce):B5(u,d,xe,S,$,te,ce);if(!(S&x)){var pt=Fe&&yr.call(u,"__wrapped__"),St=$e&&yr.call(d,"__wrapped__");if(pt||St){var Lt=pt?u.value():u,_t=St?d.value():d;return ce||(ce=new Pi),te(Lt,_t,S,$,ce)}}return Ye?(ce||(ce=new Pi),L5(u,d,S,$,te,ce)):!1}i(l5,"baseIsEqualDeep"),o(l5,"baseIsEqualDeep");function f5(u){return Rr(u)&&bn(u)==be}i(f5,"baseIsMap"),o(f5,"baseIsMap");function vh(u,d,S,$){var te=S.length,ce=te,ye=!$;if(u==null)return!ce;for(u=_r(u);te--;){var Ee=S[te];if(ye&&Ee[2]?Ee[1]!==u[Ee[0]]:!(Ee[0]in u))return!1}for(;++te<ce;){Ee=S[te];var xe=Ee[0],Ue=u[xe],Fe=Ee[1];if(ye&&Ee[2]){if(Ue===r&&!(xe in u))return!1}else{var $e=new Pi;if($)var Ye=$(Ue,Fe,xe,u,d,$e);if(!(Ye===r?tu(Fe,Ue,x|O,$,$e):Ye))return!1}}return!0}i(vh,"baseIsMatch"),o(vh,"baseIsMatch");function M1(u){if(!kr(u)||G5(u))return!1;var d=Ia(u)?wD:tr;return d.test(qo(u))}i(M1,"baseIsNative"),o(M1,"baseIsNative");function d5(u){return Rr(u)&&yn(u)==ie}i(d5,"baseIsRegExp"),o(d5,"baseIsRegExp");function h5(u){return Rr(u)&&bn(u)==ee}i(h5,"baseIsSet"),o(h5,"baseIsSet");function p5(u){return Rr(u)&&df(u.length)&&!!wr[yn(u)]}i(p5,"baseIsTypedArray"),o(p5,"baseIsTypedArray");function I1(u){return typeof u=="function"?u:u==null?Rn:typeof u=="object"?Nt(u)?R1(u[0],u[1]):D1(u):qg(u)}i(I1,"baseIteratee"),o(I1,"baseIteratee");function yh(u){if(!iu(u))return TD(u);var d=[];for(var S in _r(u))yr.call(u,S)&&S!="constructor"&&d.push(S);return d}i(yh,"baseKeys"),o(yh,"baseKeys");function m5(u){if(!kr(u))return Z5(u);var d=iu(u),S=[];for(var $ in u)$=="constructor"&&(d||!yr.call(u,$))||S.push($);return S}i(m5,"baseKeysIn"),o(m5,"baseKeysIn");function bh(u,d){return u<d}i(bh,"baseLt"),o(bh,"baseLt");function k1(u,d){var S=-1,$=kn(u)?ke(u.length):[];return $o(u,function(te,ce,ye){$[++S]=d(te,ce,ye)}),$}i(k1,"baseMap"),o(k1,"baseMap");function D1(u){var d=Oh(u);return d.length==1&&d[0][2]?lg(d[0][0],d[0][1]):function(S){return S===u||vh(S,u,d)}}i(D1,"baseMatches"),o(D1,"baseMatches");function R1(u,d){return Nh(u)&&ug(d)?lg(Qi(u),d):function(S){var $=zh(S,u);return $===r&&$===d?Hh(S,u):tu(d,$,x|O)}}i(R1,"baseMatchesProperty"),o(R1,"baseMatchesProperty");function Jl(u,d,S,$,te){u!==d&&x1(d,function(ce,ye){if(te||(te=new Pi),kr(ce))g5(u,d,ye,S,Jl,$,te);else{var Ee=$?$(Bh(u,ye),ce,ye+"",u,d,te):r;Ee===r&&(Ee=ce),dh(u,ye,Ee)}},Dn)}i(Jl,"baseMerge"),o(Jl,"baseMerge");function g5(u,d,S,$,te,ce,ye){var Ee=Bh(u,S),xe=Bh(d,S),Ue=ye.get(xe);if(Ue){dh(u,S,Ue);return}var Fe=ce?ce(Ee,xe,S+"",u,d,ye):r,$e=Fe===r;if($e){var Ye=Nt(xe),pt=!Ye&&Vo(xe),St=!Ye&&!pt&&ou(xe);Fe=xe,Ye||pt||St?Nt(Ee)?Fe=Ee:Pr(Ee)?Fe=In(Ee):pt?($e=!1,Fe=z1(xe,!0)):St?($e=!1,Fe=H1(xe,!0)):Fe=[]:au(xe)||$s(xe)?(Fe=Ee,$s(Ee)?Fe=Ug(Ee):(!kr(Ee)||Ia(Ee))&&(Fe=cg(xe))):$e=!1}$e&&(ye.set(xe,Fe),te(Fe,xe,$,ce,ye),ye.delete(xe)),dh(u,S,Fe)}i(g5,"baseMergeDeep"),o(g5,"baseMergeDeep");function O1(u,d){var S=u.length;if(!!S)return d+=d<0?S:0,Ma(d,S)?u[d]:r}i(O1,"baseNth"),o(O1,"baseNth");function N1(u,d,S){d.length?d=Mr(d,function(ce){return Nt(ce)?function(ye){return zo(ye,ce.length===1?ce[0]:ce)}:ce}):d=[Rn];var $=-1;d=Mr(d,jn(wt()));var te=k1(u,function(ce,ye,Ee){var xe=Mr(d,function(Ue){return Ue(ce)});return{criteria:xe,index:++$,value:ce}});return n3(te,function(ce,ye){return I5(ce,ye,S)})}i(N1,"baseOrderBy"),o(N1,"baseOrderBy");function v5(u,d){return P1(u,d,function(S,$){return Hh(u,$)})}i(v5,"basePick"),o(v5,"basePick");function P1(u,d,S){for(var $=-1,te=d.length,ce={};++$<te;){var ye=d[$],Ee=zo(u,ye);S(Ee,ye)&&ru(ce,co(ye,u),Ee)}return ce}i(P1,"basePickBy"),o(P1,"basePickBy");function y5(u){return function(d){return zo(d,u)}}i(y5,"basePropertyDeep"),o(y5,"basePropertyDeep");function wh(u,d,S,$){var te=$?r3:Ns,ce=-1,ye=d.length,Ee=u;for(u===d&&(d=In(d)),S&&(Ee=Mr(u,jn(S)));++ce<ye;)for(var xe=0,Ue=d[ce],Fe=S?S(Ue):Ue;(xe=te(Ee,Fe,xe,$))>-1;)Ee!==u&&oh.call(Ee,xe,1),oh.call(u,xe,1);return u}i(wh,"basePullAll"),o(wh,"basePullAll");function B1(u,d){for(var S=u?d.length:0,$=S-1;S--;){var te=d[S];if(S==$||te!==ce){var ce=te;Ma(te)?oh.call(u,te,1):Sh(u,te)}}return u}i(B1,"basePullAt"),o(B1,"basePullAt");function _h(u,d){return u+uh(E3()*(d-u+1))}i(_h,"baseRandom"),o(_h,"baseRandom");function b5(u,d,S,$){for(var te=-1,ce=Jr(ch((d-u)/(S||1)),0),ye=ke(ce);ce--;)ye[$?ce:++te]=u,u+=S;return ye}i(b5,"baseRange"),o(b5,"baseRange");function Eh(u,d){var S="";if(!u||d<1||d>E)return S;do d%2&&(S+=u),d=uh(d/2),d&&(u+=u);while(d);return S}i(Eh,"baseRepeat"),o(Eh,"baseRepeat");function Ut(u,d){return hg(fg(u,d,Rn),u+"")}i(Ut,"baseRest"),o(Ut,"baseRest");function w5(u){return w1(zs(u))}i(w5,"baseSample"),o(w5,"baseSample");function _5(u,d){var S=zs(u);return sf(S,jo(d,0,S.length))}i(_5,"baseSampleSize"),o(_5,"baseSampleSize");function ru(u,d,S,$){if(!kr(u))return u;d=co(d,u);for(var te=-1,ce=d.length,ye=ce-1,Ee=u;Ee!=null&&++te<ce;){var xe=Qi(d[te]),Ue=S;if(xe==="__proto__"||xe==="constructor"||xe==="prototype")return u;if(te!=ye){var Fe=Ee[xe];Ue=$?$(Fe,xe,Ee):r,Ue===r&&(Ue=kr(Fe)?Fe:Ma(d[te+1])?[]:{})}Xc(Ee,xe,Ue),Ee=Ee[xe]}return u}i(ru,"baseSet"),o(ru,"baseSet");var E5=lh?function(u,d){return lh.set(u,d),u}:Rn,PD=sh?function(u,d){return sh(u,"toString",{configurable:!0,enumerable:!1,value:qh(d),writable:!0})}:Rn;function A5(u){return sf(zs(u))}i(A5,"baseShuffle"),o(A5,"baseShuffle");function oi(u,d,S){var $=-1,te=u.length;d<0&&(d=-d>te?0:te+d),S=S>te?te:S,S<0&&(S+=te),te=d>S?0:S-d>>>0,d>>>=0;for(var ce=ke(te);++$<te;)ce[$]=u[$+d];return ce}i(oi,"baseSlice"),o(oi,"baseSlice");function S5(u,d){var S;return $o(u,function($,te,ce){return S=d($,te,ce),!S}),!!S}i(S5,"baseSome"),o(S5,"baseSome");function Zl(u,d,S){var $=0,te=u==null?$:u.length;if(typeof d=="number"&&d===d&&te<=V){for(;$<te;){var ce=$+te>>>1,ye=u[ce];ye!==null&&!zn(ye)&&(S?ye<=d:ye<d)?$=ce+1:te=ce}return te}return Ah(u,d,Rn,S)}i(Zl,"baseSortedIndex"),o(Zl,"baseSortedIndex");function Ah(u,d,S,$){var te=0,ce=u==null?0:u.length;if(ce===0)return 0;d=S(d);for(var ye=d!==d,Ee=d===null,xe=zn(d),Ue=d===r;te<ce;){var Fe=uh((te+ce)/2),$e=S(u[Fe]),Ye=$e!==r,pt=$e===null,St=$e===$e,Lt=zn($e);if(ye)var _t=$||St;else Ue?_t=St&&($||Ye):Ee?_t=St&&Ye&&($||!pt):xe?_t=St&&Ye&&!pt&&($||!Lt):pt||Lt?_t=!1:_t=$?$e<=d:$e<d;_t?te=Fe+1:ce=Fe}return vn(ce,B)}i(Ah,"baseSortedIndexBy"),o(Ah,"baseSortedIndexBy");function L1(u,d){for(var S=-1,$=u.length,te=0,ce=[];++S<$;){var ye=u[S],Ee=d?d(ye):ye;if(!S||!Bi(Ee,xe)){var xe=Ee;ce[te++]=ye===0?0:ye}}return ce}i(L1,"baseSortedUniq"),o(L1,"baseSortedUniq");function U1(u){return typeof u=="number"?u:zn(u)?C:+u}i(U1,"baseToNumber"),o(U1,"baseToNumber");function $n(u){if(typeof u=="string")return u;if(Nt(u))return Mr(u,$n)+"";if(zn(u))return A3?A3.call(u):"";var d=u+"";return d=="0"&&1/u==-m?"-0":d}i($n,"baseToString"),o($n,"baseToString");function so(u,d,S){var $=-1,te=Ll,ce=u.length,ye=!0,Ee=[],xe=Ee;if(S)ye=!1,te=qd;else if(ce>=a){var Ue=d?null:LD(u);if(Ue)return Fl(Ue);ye=!1,te=Gc,xe=new Fo}else xe=d?[]:Ee;e:for(;++$<ce;){var Fe=u[$],$e=d?d(Fe):Fe;if(Fe=S||Fe!==0?Fe:0,ye&&$e===$e){for(var Ye=xe.length;Ye--;)if(xe[Ye]===$e)continue e;d&&xe.push($e),Ee.push(Fe)}else te(xe,$e,S)||(xe!==Ee&&xe.push($e),Ee.push(Fe))}return Ee}i(so,"baseUniq"),o(so,"baseUniq");function Sh(u,d){return d=co(d,u),u=dg(u,d),u==null||delete u[Qi(si(d))]}i(Sh,"baseUnset"),o(Sh,"baseUnset");function F1(u,d,S,$){return ru(u,d,S(zo(u,d)),$)}i(F1,"baseUpdate"),o(F1,"baseUpdate");function Yl(u,d,S,$){for(var te=u.length,ce=$?te:-1;($?ce--:++ce<te)&&d(u[ce],ce,u););return S?oi(u,$?0:ce,$?ce+1:te):oi(u,$?ce+1:0,$?te:ce)}i(Yl,"baseWhile"),o(Yl,"baseWhile");function j1(u,d){var S=u;return S instanceof Kt&&(S=S.value()),Vd(d,function($,te){return te.func.apply(te.thisArg,ao([$],te.args))},S)}i(j1,"baseWrapperValue"),o(j1,"baseWrapperValue");function xh(u,d,S){var $=u.length;if($<2)return $?so(u[0]):[];for(var te=-1,ce=ke($);++te<$;)for(var ye=u[te],Ee=-1;++Ee<$;)Ee!=te&&(ce[te]=Qc(ce[te]||ye,u[Ee],d,S));return so(Xr(ce,1),d,S)}i(xh,"baseXor"),o(xh,"baseXor");function $1(u,d,S){for(var $=-1,te=u.length,ce=d.length,ye={};++$<te;){var Ee=$<ce?d[$]:r;S(ye,u[$],Ee)}return ye}i($1,"baseZipObject"),o($1,"baseZipObject");function Th(u){return Pr(u)?u:[]}i(Th,"castArrayLikeObject"),o(Th,"castArrayLikeObject");function Ch(u){return typeof u=="function"?u:Rn}i(Ch,"castFunction"),o(Ch,"castFunction");function co(u,d){return Nt(u)?u:Nh(u,d)?[u]:ew(dr(u))}i(co,"castPath"),o(co,"castPath");var BD=Ut;function uo(u,d,S){var $=u.length;return S=S===r?$:S,!d&&S>=$?u:oi(u,d,S)}i(uo,"castSlice"),o(uo,"castSlice");var x5=_D||function(u){return Fr.clearTimeout(u)};function z1(u,d){if(d)return u.slice();var S=u.length,$=v3?v3(S):new u.constructor(S);return u.copy($),$}i(z1,"cloneBuffer"),o(z1,"cloneBuffer");function Mh(u){var d=new u.constructor(u.byteLength);return new ih(d).set(new ih(u)),d}i(Mh,"cloneArrayBuffer"),o(Mh,"cloneArrayBuffer");function T5(u,d){var S=d?Mh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.byteLength)}i(T5,"cloneDataView"),o(T5,"cloneDataView");function C5(u){var d=new u.constructor(u.source,yt.exec(u));return d.lastIndex=u.lastIndex,d}i(C5,"cloneRegExp"),o(C5,"cloneRegExp");function M5(u){return ql?_r(ql.call(u)):{}}i(M5,"cloneSymbol"),o(M5,"cloneSymbol");function H1(u,d){var S=d?Mh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.length)}i(H1,"cloneTypedArray"),o(H1,"cloneTypedArray");function q1(u,d){if(u!==d){var S=u!==r,$=u===null,te=u===u,ce=zn(u),ye=d!==r,Ee=d===null,xe=d===d,Ue=zn(d);if(!Ee&&!Ue&&!ce&&u>d||ce&&ye&&xe&&!Ee&&!Ue||$&&ye&&xe||!S&&xe||!te)return 1;if(!$&&!ce&&!Ue&&u<d||Ue&&S&&te&&!$&&!ce||Ee&&S&&te||!ye&&te||!xe)return-1}return 0}i(q1,"compareAscending"),o(q1,"compareAscending");function I5(u,d,S){for(var $=-1,te=u.criteria,ce=d.criteria,ye=te.length,Ee=S.length;++$<ye;){var xe=q1(te[$],ce[$]);if(xe){if($>=Ee)return xe;var Ue=S[$];return xe*(Ue=="desc"?-1:1)}}return u.index-d.index}i(I5,"compareMultiple"),o(I5,"compareMultiple");function V1(u,d,S,$){for(var te=-1,ce=u.length,ye=S.length,Ee=-1,xe=d.length,Ue=Jr(ce-ye,0),Fe=ke(xe+Ue),$e=!$;++Ee<xe;)Fe[Ee]=d[Ee];for(;++te<ye;)($e||te<ce)&&(Fe[S[te]]=u[te]);for(;Ue--;)Fe[Ee++]=u[te++];return Fe}i(V1,"composeArgs"),o(V1,"composeArgs");function K1(u,d,S,$){for(var te=-1,ce=u.length,ye=-1,Ee=S.length,xe=-1,Ue=d.length,Fe=Jr(ce-Ee,0),$e=ke(Fe+Ue),Ye=!$;++te<Fe;)$e[te]=u[te];for(var pt=te;++xe<Ue;)$e[pt+xe]=d[xe];for(;++ye<Ee;)(Ye||te<ce)&&($e[pt+S[ye]]=u[te++]);return $e}i(K1,"composeArgsRight"),o(K1,"composeArgsRight");function In(u,d){var S=-1,$=u.length;for(d||(d=ke($));++S<$;)d[S]=u[S];return d}i(In,"copyArray"),o(In,"copyArray");function Xi(u,d,S,$){var te=!S;S||(S={});for(var ce=-1,ye=d.length;++ce<ye;){var Ee=d[ce],xe=$?$(S[Ee],u[Ee],Ee,S,u):r;xe===r&&(xe=u[Ee]),te?xa(S,Ee,xe):Xc(S,Ee,xe)}return S}i(Xi,"copyObject"),o(Xi,"copyObject");function k5(u,d){return Xi(u,og(u),d)}i(k5,"copySymbols"),o(k5,"copySymbols");function D5(u,d){return Xi(u,F5(u),d)}i(D5,"copySymbolsIn"),o(D5,"copySymbolsIn");function Xl(u,d){return function(S,$){var te=Nt(S)?Y2:Y3,ce=d?d():{};return te(S,u,wt($,2),ce)}}i(Xl,"createAggregator"),o(Xl,"createAggregator");function Us(u){return Ut(function(d,S){var $=-1,te=S.length,ce=te>1?S[te-1]:r,ye=te>2?S[2]:r;for(ce=u.length>3&&typeof ce=="function"?(te--,ce):r,ye&&wn(S[0],S[1],ye)&&(ce=te<3?r:ce,te=1),d=_r(d);++$<te;){var Ee=S[$];Ee&&u(d,Ee,$,ce)}return d})}i(Us,"createAssigner"),o(Us,"createAssigner");function G1(u,d){return function(S,$){if(S==null)return S;if(!kn(S))return u(S,$);for(var te=S.length,ce=d?te:-1,ye=_r(S);(d?ce--:++ce<te)&&$(ye[ce],ce,ye)!==!1;);return S}}i(G1,"createBaseEach"),o(G1,"createBaseEach");function W1(u){return function(d,S,$){for(var te=-1,ce=_r(d),ye=$(d),Ee=ye.length;Ee--;){var xe=ye[u?Ee:++te];if(S(ce[xe],xe,ce)===!1)break}return d}}i(W1,"createBaseFor"),o(W1,"createBaseFor");function R5(u,d,S){var $=d&D,te=nu(u);function ce(){var ye=this&&this!==Fr&&this instanceof ce?te:u;return ye.apply($?S:this,arguments)}return i(ce,"wrapper"),o(ce,"wrapper"),ce}i(R5,"createBind"),o(R5,"createBind");function J1(u){return function(d){d=dr(d);var S=Ps(d)?Oi(d):r,$=S?S[0]:d.charAt(0),te=S?uo(S,1).join(""):d.slice(1);return $[u]()+te}}i(J1,"createCaseFirst"),o(J1,"createCaseFirst");function Fs(u){return function(d){return Vd(Hg($g(d).replace(Ol,"")),u,"")}}i(Fs,"createCompounder"),o(Fs,"createCompounder");function nu(u){return function(){var d=arguments;switch(d.length){case 0:return new u;case 1:return new u(d[0]);case 2:return new u(d[0],d[1]);case 3:return new u(d[0],d[1],d[2]);case 4:return new u(d[0],d[1],d[2],d[3]);case 5:return new u(d[0],d[1],d[2],d[3],d[4]);case 6:return new u(d[0],d[1],d[2],d[3],d[4],d[5]);case 7:return new u(d[0],d[1],d[2],d[3],d[4],d[5],d[6])}var S=Yc(u.prototype),$=u.apply(S,d);return kr($)?$:S}}i(nu,"createCtor"),o(nu,"createCtor");function O5(u,d,S){var $=nu(u);function te(){for(var ce=arguments.length,ye=ke(ce),Ee=ce,xe=js(te);Ee--;)ye[Ee]=arguments[Ee];var Ue=ce<3&&ye[0]!==xe&&ye[ce-1]!==xe?[]:oo(ye,xe);if(ce-=Ue.length,ce<S)return eg(u,d,Ql,te.placeholder,r,ye,Ue,r,r,S-ce);var Fe=this&&this!==Fr&&this instanceof te?$:u;return Fn(Fe,this,ye)}return i(te,"wrapper"),o(te,"wrapper"),te}i(O5,"createCurry"),o(O5,"createCurry");function Z1(u){return function(d,S,$){var te=_r(d);if(!kn(d)){var ce=wt(S,3);d=Zr(d),S=o(function(Ee){return ce(te[Ee],Ee,te)},"predicate")}var ye=u(d,S,$);return ye>-1?te[ce?d[ye]:ye]:r}}i(Z1,"createFind"),o(Z1,"createFind");function Y1(u){return Ca(function(d){var S=d.length,$=S,te=ii.prototype.thru;for(u&&d.reverse();$--;){var ce=d[$];if(typeof ce!="function")throw new Ni(c);if(te&&!ye&&nf(ce)=="wrapper")var ye=new ii([],!0)}for($=ye?$:S;++$<S;){ce=d[$];var Ee=nf(ce),xe=Ee=="wrapper"?ag(ce):r;xe&&Ph(xe[0])&&xe[1]==(k|j|Q|K)&&!xe[4].length&&xe[9]==1?ye=ye[nf(xe[0])].apply(ye,xe[3]):ye=ce.length==1&&Ph(ce)?ye[Ee]():ye.thru(ce)}return function(){var Ue=arguments,Fe=Ue[0];if(ye&&Ue.length==1&&Nt(Fe))return ye.plant(Fe).value();for(var $e=0,Ye=S?d[$e].apply(this,Ue):Fe;++$e<S;)Ye=d[$e].call(this,Ye);return Ye}})}i(Y1,"createFlow"),o(Y1,"createFlow");function Ql(u,d,S,$,te,ce,ye,Ee,xe,Ue){var Fe=d&k,$e=d&D,Ye=d&P,pt=d&(j|q),St=d&he,Lt=Ye?r:nu(u);function _t(){for(var Ht=arguments.length,Gt=ke(Ht),Hn=Ht;Hn--;)Gt[Hn]=arguments[Hn];if(pt)var _n=js(_t),qn=a3(Gt,_n);if($&&(Gt=V1(Gt,$,te,pt)),ce&&(Gt=K1(Gt,ce,ye,pt)),Ht-=qn,pt&&Ht<Ue){var jr=oo(Gt,_n);return eg(u,d,Ql,_t.placeholder,S,Gt,jr,Ee,xe,Ue-Ht)}var ea=$e?S:this,lo=Ye?ea[u]:u;return Ht=Gt.length,Ee?Gt=X5(Gt,Ee):St&&Ht>1&&Gt.reverse(),Fe&&xe<Ht&&(Gt.length=xe),this&&this!==Fr&&this instanceof _t&&(lo=Lt||nu(lo)),lo.apply(ea,Gt)}return i(_t,"wrapper"),o(_t,"wrapper"),_t}i(Ql,"createHybrid"),o(Ql,"createHybrid");function X1(u,d){return function(S,$){return s5(S,u,d($),{})}}i(X1,"createInverter"),o(X1,"createInverter");function ef(u,d){return function(S,$){var te;if(S===r&&$===r)return d;if(S!==r&&(te=S),$!==r){if(te===r)return $;typeof S=="string"||typeof $=="string"?(S=$n(S),$=$n($)):(S=U1(S),$=U1($)),te=u(S,$)}return te}}i(ef,"createMathOperation"),o(ef,"createMathOperation");function Ih(u){return Ca(function(d){return d=Mr(d,jn(wt())),Ut(function(S){var $=this;return u(d,function(te){return Fn(te,$,S)})})})}i(Ih,"createOver"),o(Ih,"createOver");function tf(u,d){d=d===r?" ":$n(d);var S=d.length;if(S<2)return S?Eh(d,u):d;var $=Eh(d,ch(u/Bs(d)));return Ps(d)?uo(Oi($),0,u).join(""):$.slice(0,u)}i(tf,"createPadding"),o(tf,"createPadding");function N5(u,d,S,$){var te=d&D,ce=nu(u);function ye(){for(var Ee=-1,xe=arguments.length,Ue=-1,Fe=$.length,$e=ke(Fe+xe),Ye=this&&this!==Fr&&this instanceof ye?ce:u;++Ue<Fe;)$e[Ue]=$[Ue];for(;xe--;)$e[Ue++]=arguments[++Ee];return Fn(Ye,te?S:this,$e)}return i(ye,"wrapper"),o(ye,"wrapper"),ye}i(N5,"createPartial"),o(N5,"createPartial");function Q1(u){return function(d,S,$){return $&&typeof $!="number"&&wn(d,S,$)&&(S=$=r),d=ka(d),S===r?(S=d,d=0):S=ka(S),$=$===r?d<S?1:-1:ka($),b5(d,S,$,u)}}i(Q1,"createRange"),o(Q1,"createRange");function rf(u){return function(d,S){return typeof d=="string"&&typeof S=="string"||(d=ci(d),S=ci(S)),u(d,S)}}i(rf,"createRelationalOperation"),o(rf,"createRelationalOperation");function eg(u,d,S,$,te,ce,ye,Ee,xe,Ue){var Fe=d&j,$e=Fe?ye:r,Ye=Fe?r:ye,pt=Fe?ce:r,St=Fe?r:ce;d|=Fe?Q:Y,d&=~(Fe?Y:Q),d&J||(d&=~(D|P));var Lt=[u,d,te,pt,$e,St,Ye,Ee,xe,Ue],_t=S.apply(r,Lt);return Ph(u)&&Q5(_t,Lt),_t.placeholder=$,pg(_t,u,d)}i(eg,"createRecurry"),o(eg,"createRecurry");function kh(u){var d=Wr[u];return function(S,$){if(S=ci(S),$=$==null?0:vn(Pt($),292),$&&_3(S)){var te=(dr(S)+"e").split("e"),ce=d(te[0]+"e"+(+te[1]+$));return te=(dr(ce)+"e").split("e"),+(te[0]+"e"+(+te[1]-$))}return d(S)}}i(kh,"createRound"),o(kh,"createRound");var LD=Jc&&1/Fl(new Jc([,-0]))[1]==m?function(u){return new Jc(u)}:Gh;function tg(u){return function(d){var S=bn(d);return S==be?Xd(d):S==ee?l3(d):i3(d,u(d))}}i(tg,"createToPairs"),o(tg,"createToPairs");function Ta(u,d,S,$,te,ce,ye,Ee){var xe=d&P;if(!xe&&typeof u!="function")throw new Ni(c);var Ue=$?$.length:0;if(Ue||(d&=~(Q|Y),$=te=r),ye=ye===r?ye:Jr(Pt(ye),0),Ee=Ee===r?Ee:Pt(Ee),Ue-=te?te.length:0,d&Y){var Fe=$,$e=te;$=te=r}var Ye=xe?r:ag(u),pt=[u,d,S,$,te,Fe,$e,ce,ye,Ee];if(Ye&&J5(pt,Ye),u=pt[0],d=pt[1],S=pt[2],$=pt[3],te=pt[4],Ee=pt[9]=pt[9]===r?xe?0:u.length:Jr(pt[9]-Ue,0),!Ee&&d&(j|q)&&(d&=~(j|q)),!d||d==D)var St=R5(u,d,S);else d==j||d==q?St=O5(u,d,Ee):(d==Q||d==(D|Q))&&!te.length?St=N5(u,d,S,$):St=Ql.apply(r,pt);var Lt=Ye?E5:Q5;return pg(Lt(St,pt),u,d)}i(Ta,"createWrap"),o(Ta,"createWrap");function rg(u,d,S,$){return u===r||Bi(u,Wc[S])&&!yr.call($,S)?d:u}i(rg,"customDefaultsAssignIn"),o(rg,"customDefaultsAssignIn");function ng(u,d,S,$,te,ce){return kr(u)&&kr(d)&&(ce.set(d,u),Jl(u,d,r,ng,ce),ce.delete(d)),u}i(ng,"customDefaultsMerge"),o(ng,"customDefaultsMerge");function P5(u){return au(u)?r:u}i(P5,"customOmitClone"),o(P5,"customOmitClone");function ig(u,d,S,$,te,ce){var ye=S&x,Ee=u.length,xe=d.length;if(Ee!=xe&&!(ye&&xe>Ee))return!1;var Ue=ce.get(u),Fe=ce.get(d);if(Ue&&Fe)return Ue==d&&Fe==u;var $e=-1,Ye=!0,pt=S&O?new Fo:r;for(ce.set(u,d),ce.set(d,u);++$e<Ee;){var St=u[$e],Lt=d[$e];if($)var _t=ye?$(Lt,St,$e,d,u,ce):$(St,Lt,$e,u,d,ce);if(_t!==r){if(_t)continue;Ye=!1;break}if(pt){if(!Kd(d,function(Ht,Gt){if(!Gc(pt,Gt)&&(St===Ht||te(St,Ht,S,$,ce)))return pt.push(Gt)})){Ye=!1;break}}else if(!(St===Lt||te(St,Lt,S,$,ce))){Ye=!1;break}}return ce.delete(u),ce.delete(d),Ye}i(ig,"equalArrays"),o(ig,"equalArrays");function B5(u,d,S,$,te,ce,ye){switch(S){case ve:if(u.byteLength!=d.byteLength||u.byteOffset!=d.byteOffset)return!1;u=u.buffer,d=d.buffer;case qe:return!(u.byteLength!=d.byteLength||!ce(new ih(u),new ih(d)));case ne:case oe:case Re:return Bi(+u,+d);case G:return u.name==d.name&&u.message==d.message;case ie:case ue:return u==d+"";case be:var Ee=Xd;case ee:var xe=$&x;if(Ee||(Ee=Fl),u.size!=d.size&&!xe)return!1;var Ue=ye.get(u);if(Ue)return Ue==d;$|=O,ye.set(u,d);var Fe=ig(Ee(u),Ee(d),$,te,ce,ye);return ye.delete(u),Fe;case Ae:if(ql)return ql.call(u)==ql.call(d)}return!1}i(B5,"equalByTag"),o(B5,"equalByTag");function L5(u,d,S,$,te,ce){var ye=S&x,Ee=Dh(u),xe=Ee.length,Ue=Dh(d),Fe=Ue.length;if(xe!=Fe&&!ye)return!1;for(var $e=xe;$e--;){var Ye=Ee[$e];if(!(ye?Ye in d:yr.call(d,Ye)))return!1}var pt=ce.get(u),St=ce.get(d);if(pt&&St)return pt==d&&St==u;var Lt=!0;ce.set(u,d),ce.set(d,u);for(var _t=ye;++$e<xe;){Ye=Ee[$e];var Ht=u[Ye],Gt=d[Ye];if($)var Hn=ye?$(Gt,Ht,Ye,d,u,ce):$(Ht,Gt,Ye,u,d,ce);if(!(Hn===r?Ht===Gt||te(Ht,Gt,S,$,ce):Hn)){Lt=!1;break}_t||(_t=Ye=="constructor")}if(Lt&&!_t){var _n=u.constructor,qn=d.constructor;_n!=qn&&"constructor"in u&&"constructor"in d&&!(typeof _n=="function"&&_n instanceof _n&&typeof qn=="function"&&qn instanceof qn)&&(Lt=!1)}return ce.delete(u),ce.delete(d),Lt}i(L5,"equalObjects"),o(L5,"equalObjects");function Ca(u){return hg(fg(u,r,bg),u+"")}i(Ca,"flatRest"),o(Ca,"flatRest");function Dh(u){return T1(u,Zr,og)}i(Dh,"getAllKeys"),o(Dh,"getAllKeys");function Rh(u){return T1(u,Dn,F5)}i(Rh,"getAllKeysIn"),o(Rh,"getAllKeysIn");var ag=lh?function(u){return lh.get(u)}:Gh;function nf(u){for(var d=u.name+"",S=Zc[d],$=yr.call(Zc,d)?S.length:0;$--;){var te=S[$],ce=te.func;if(ce==null||ce==u)return te.name}return d}i(nf,"getFuncName"),o(nf,"getFuncName");function js(u){var d=yr.call(se,"placeholder")?se:u;return d.placeholder}i(js,"getHolder"),o(js,"getHolder");function wt(){var u=se.iteratee||Vh;return u=u===Vh?I1:u,arguments.length?u(arguments[0],arguments[1]):u}i(wt,"getIteratee"),o(wt,"getIteratee");function af(u,d){var S=u.__data__;return K5(d)?S[typeof d=="string"?"string":"hash"]:S.map}i(af,"getMapData"),o(af,"getMapData");function Oh(u){for(var d=Zr(u),S=d.length;S--;){var $=d[S],te=u[$];d[S]=[$,te,ug(te)]}return d}i(Oh,"getMatchData"),o(Oh,"getMatchData");function Ho(u,d){var S=s3(u,d);return M1(S)?S:r}i(Ho,"getNative"),o(Ho,"getNative");function U5(u){var d=yr.call(u,Ls),S=u[Ls];try{u[Ls]=r;var $=!0}catch{}var te=rh.call(u);return $&&(d?u[Ls]=S:delete u[Ls]),te}i(U5,"getRawTag"),o(U5,"getRawTag");var og=g1?function(u){return u==null?[]:(u=_r(u),io(g1(u),function(d){return b3.call(u,d)}))}:Wh,F5=g1?function(u){for(var d=[];u;)ao(d,og(u)),u=ah(u);return d}:Wh,bn=yn;(v1&&bn(new v1(new ArrayBuffer(1)))!=ve||$l&&bn(new $l)!=be||y1&&bn(y1.resolve())!=F||Jc&&bn(new Jc)!=ee||zl&&bn(new zl)!=Ie)&&(bn=o(function(u){var d=yn(u),S=d==N?u.constructor:r,$=S?qo(S):"";if($)switch($){case kD:return ve;case DD:return be;case RD:return F;case OD:return ee;case ND:return Ie}return d},"getTag"));function j5(u,d,S){for(var $=-1,te=S.length;++$<te;){var ce=S[$],ye=ce.size;switch(ce.type){case"drop":u+=ye;break;case"dropRight":d-=ye;break;case"take":d=vn(d,u+ye);break;case"takeRight":u=Jr(u,d-ye);break}}return{start:u,end:d}}i(j5,"getView"),o(j5,"getView");function $5(u){var d=u.match(Ze);return d?d[1].split(cr):[]}i($5,"getWrapDetails"),o($5,"getWrapDetails");function sg(u,d,S){d=co(d,u);for(var $=-1,te=d.length,ce=!1;++$<te;){var ye=Qi(d[$]);if(!(ce=u!=null&&S(u,ye)))break;u=u[ye]}return ce||++$!=te?ce:(te=u==null?0:u.length,!!te&&df(te)&&Ma(ye,te)&&(Nt(u)||$s(u)))}i(sg,"hasPath"),o(sg,"hasPath");function z5(u){var d=u.length,S=new u.constructor(d);return d&&typeof u[0]=="string"&&yr.call(u,"index")&&(S.index=u.index,S.input=u.input),S}i(z5,"initCloneArray"),o(z5,"initCloneArray");function cg(u){return typeof u.constructor=="function"&&!iu(u)?Yc(ah(u)):{}}i(cg,"initCloneObject"),o(cg,"initCloneObject");function H5(u,d,S){var $=u.constructor;switch(d){case qe:return Mh(u);case ne:case oe:return new $(+u);case ve:return T5(u,S);case pe:case re:case le:case _e:case Te:case Ce:case Oe:case Ct:case Ve:return H1(u,S);case be:return new $;case Re:case ue:return new $(u);case ie:return C5(u);case ee:return new $;case Ae:return M5(u)}}i(H5,"initCloneByTag"),o(H5,"initCloneByTag");function q5(u,d){var S=d.length;if(!S)return u;var $=S-1;return d[$]=(S>1?"& ":"")+d[$],d=d.join(S>2?", ":" "),u.replace(ot,`{
24
+ `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function uy(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(uy,"arrRemove");var Jp=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,a,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=cy(c),h=l.next();!h.done;h=l.next()){var p=h.value;p.remove(this)}}catch(O){t={error:O}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var g=this.initialTeardown;if(ji(g))try{g()}catch(O){s=O instanceof Wp?O.errors:[O]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=cy(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{a7(x)}catch(O){s=s??[],O instanceof Wp?s=Mu(Mu([],Cu(s)),Cu(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}if(s)throw new Wp(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)a7(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&uy(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&uy(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var kJ=Jp.EMPTY;function Zp(e){return e instanceof Jp||e&&"closed"in e&&ji(e.remove)&&ji(e.add)&&ji(e.unsubscribe)}i(Zp,"isSubscription");function a7(e){ji(e)?e():e.unsubscribe()}i(a7,"execFinalizer");var aa={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Iu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=Iu.delegate;return a?.setTimeout?a.setTimeout.apply(a,Mu([e,t],Cu(r))):setTimeout.apply(void 0,Mu([e,t],Cu(r)))},clearTimeout:function(e){var t=Iu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function o7(e){Iu.setTimeout(function(){var t=aa.onUnhandledError;if(t)t(e);else throw e})}i(o7,"reportUnhandledError");function ly(){}i(ly,"noop");var s7=function(){return fy("C",void 0,void 0)}();function c7(e){return fy("E",void 0,e)}i(c7,"errorNotification");function u7(e){return fy("N",e,void 0)}i(u7,"nextNotification");function fy(e,t,r){return{kind:e,value:t,error:r}}i(fy,"createNotification");var nc=null;function l7(e){if(aa.useDeprecatedSynchronousErrorHandling){var t=!nc;if(t&&(nc={errorThrown:!1,error:null}),e(),t){var r=nc,n=r.errorThrown,a=r.error;if(nc=null,n)throw a}}else e()}i(l7,"errorContext");function f7(e){aa.useDeprecatedSynchronousErrorHandling&&nc&&(nc.errorThrown=!0,nc.error=e)}i(f7,"captureError");var py=function(e){sy(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Zp(r)&&r.add(n)):n.destination=JL,n}return i(t,"Subscriber"),t.create=function(r,n,a){return new Xp(r,n,a)},t.prototype.next=function(r){this.isStopped?hy(u7(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?hy(c7(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?hy(s7,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Jp);var KL=Function.prototype.bind;function dy(e,t){return KL.call(e,t)}i(dy,"bind");var GL=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Yp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Yp(n)}else Yp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Yp(r)}},e}(),Xp=function(e){sy(t,e);function t(r,n,a){var s=e.call(this)||this,c;if(ji(r)||!r)c={next:r??void 0,error:n??void 0,complete:a??void 0};else{var l;s&&aa.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&dy(r.next,l),error:r.error&&dy(r.error,l),complete:r.complete&&dy(r.complete,l)}):c=r}return s.destination=new GL(c),s}return i(t,"SafeSubscriber"),t}(py);function Yp(e){aa.useDeprecatedSynchronousErrorHandling?f7(e):o7(e)}i(Yp,"handleUnhandledError");function WL(e){throw e}i(WL,"defaultErrorHandler");function hy(e,t){var r=aa.onStoppedNotification;r&&Iu.setTimeout(function(){return r(e,t)})}i(hy,"handleStoppedNotification");var JL={closed:!0,next:ly,error:WL,complete:ly};var d7=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function h7(e){return e}i(h7,"identity");function p7(e){return e.length===0?h7:e.length===1?e[0]:i(function(r){return e.reduce(function(n,a){return a(n)},r)},"piped")}i(p7,"pipeFromArray");var my=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable"),e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var a=this,s=YL(t)?t:new Xp(t,r,n);return l7(function(){var c=a,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?a._subscribe(s):a._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=m7(r),new r(function(a,s){var c=new Xp({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:a});n.subscribe(c)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[d7]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return p7(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=m7(t),new t(function(n,a){var s;r.subscribe(function(c){return s=c},function(c){return a(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function m7(e){var t;return(t=e??aa.Promise)!==null&&t!==void 0?t:Promise}i(m7,"getPromiseCtor");function ZL(e){return e&&ji(e.next)&&ji(e.error)&&ji(e.complete)}i(ZL,"isObserver");function YL(e){return e&&e instanceof py||ZL(e)&&Zp(e)}i(YL,"isSubscriber");var g7;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(g7||(g7={}));var v7;(function(e){e[e.NOT_REQUESTED=0]="NOT_REQUESTED",e[e.PENDING=1]="PENDING",e[e.PROCESSING=2]="PROCESSING",e[e.ANCHORED=3]="ANCHORED",e[e.FAILED=4]="FAILED"})(v7||(v7={}));var vy;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(vy||(vy={}));var Nf=class extends my{constructor(t,r){super(n=>{t.subscribe(n)}),this.state$=t,this._context=r}get id(){return new Yt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:t,content:r}=this.state$.value;return(0,gy.default)(t?.content??r)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return hr.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:t})=>hr.make(this.id,t))}get anchorCommitIds(){return this.state$.value.log.filter(({type:t})=>t===vy.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,gy.default)(this.state$.value)}async sync(t={}){t={sync:rc.PREFER_CACHE,...t};let r=await this.api.loadStream(this.id,t);this.state$.next(r.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}};i(Nf,"Stream");function y7(){return e=>{}}i(y7,"StreamStatic");var XL=function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},mi,yy={anchor:!0,publish:!0,pin:!0,sync:rc.PREFER_CACHE},QL={sync:rc.PREFER_CACHE},b7={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function by(e,t){if(typeof e?.schema=="string")try{hr.fromString(e.schema)}catch{throw new Error("Schema must be a CommitID")}let r={controllers:e?.controllers,family:e?.family,schema:e?.schema?.toString(),tags:e?.tags};if(t)e?.deterministic||(r.unique=dv((0,E7.randomBytes)(12),"base64")),e?.forbidControllerChange&&(r.forbidControllerChange=!0);else{if(e?.deterministic!==void 0||e?.unique!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if(e?.forbidControllerChange!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(r).forEach(n=>r[n]===void 0&&delete r[n]),r}i(by,"headerFromMetadata");async function w7(e){if(!e.did)throw new Error("No DID provided");return e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`)),e.did}i(w7,"getAuthenticatedDID");async function wy(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(wy,"throwReadOnlyError");var Zo=mi=i(class extends Nf{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,_7.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,a={}){a={...yy,...a},!n?.deterministic&&a.syncTimeoutSeconds==null&&(a.syncTimeoutSeconds=0);let s=a.asDID?{did:a.asDID}:t,c=await mi.makeGenesis(s,r,n);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,c,a)}static async createFromGenesis(t,r,n={}){n={...yy,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=r.data?await mi._signDagJWS(t,r):r;return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,a,n)}static async deterministic(t,r,n={}){if(n={...yy,...n},r={...r,deterministic:!0},r.family==null&&r.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=await mi.makeGenesis(t,null,r);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,a,n)}static async load(t,r,n={}){n={...QL,...n};let a=Ys.from(r);if(a.type!=mi.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${mi.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async update(t,r,n={}){n={...b7,...n};let a=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(a,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...b7,...r};let a={header:by(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await mi._signDagJWS(this.api,a),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=wy,this.patch=wy,this.sync=wy,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let a=await this._makeRawCommit(r,n);return mi._signDagJWS(t,a)}async _makeRawCommit(t,r){r||(r={});let n=by(r,!1);if(t==null&&(t=this.content),n.controllers){if(n.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!n.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let a=e9.compare(this.content,t),s=this.state.log[0];return{header:n,data:a,prev:this.tip,id:s.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await w7(t);n.controllers=[c.hasParent?c.parent:c.id]}else throw new Error("No controllers specified");if(n.controllers?.length!==1)throw new Error("Exactly one controller must be specified");let a=by(n,!0);if(n?.deterministic&&r)throw new Error("Initial content must be null when creating a deterministic Tile document");if(r==null){let c={header:a};return xv(c),c}let s={data:r,header:a};return mi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await w7(t)).createDagJWS(r)}},"TileDocument");Zo.STREAM_TYPE_NAME="tile";Zo.STREAM_TYPE_ID=0;Zo=mi=XL([y7()],Zo);var I7=Hs(x7(),1);function uU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(uU,"_checkPrivateRedeclaration");function lU(e,t){return t.get?t.get.call(e):t.value}i(lU,"_classApplyDescriptorGet");function fU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(fU,"_classApplyDescriptorSet");function M7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(M7,"_classExtractFieldDescriptor");function Sy(e,t){var r=M7(e,t,"get");return lU(e,r)}i(Sy,"_classPrivateFieldGet");function T7(e,t,r){uU(e,t),t.set(e,r)}i(T7,"_classPrivateFieldInit");function C7(e,t,r){var n=M7(e,t,"set");return fU(e,n,r),r}i(C7,"_classPrivateFieldSet");function dU(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(dU,"keyToQuery");function xy(e){return typeof e=="string"?Ys.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(xy,"keyToString");async function Cy(e){let t=await Zo.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(Cy,"getDeterministicQuery");var hU=i(()=>Promise.resolve([]),"tempBatchLoadFn"),Qp=new WeakMap,Ty=new WeakMap,ic=class extends I7.default{cache(t){if(!Sy(this,Ty))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let a=await Zo.create(Sy(this,Qp),t,r,n);return this.cache(a),a}async deterministic(t,r){let n=await Cy(t);try{return await super.load(n)}catch{let s=await Zo.createFromGenesis(Sy(this,Qp),n.genesis,r);return this.cache(s),s}}async load(t){return await super.load(t)}async update(t,r,n,a){let s=xy(t);this.clear(s);let c=await this.load({streamId:s});return await c.update(r,n,a),c}constructor(t){super(hU,{cache:!0,cacheKeyFn:xy,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),T7(this,Qp,{writable:!0,value:void 0}),T7(this,Ty,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(dU),t.multiqueryTimeout);return r.map(a=>{let s=xy(a),c=n[s];return c||new Error(`Failed to load stream: ${s}`)})},C7(this,Qp,t.ceramic),C7(this,Ty,!!t.cache)}};i(ic,"TileLoader");function pU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(pU,"_checkPrivateRedeclaration");function mU(e,t){return t.get?t.get.call(e):t.value}i(mU,"_classApplyDescriptorGet");function gU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(gU,"_classApplyDescriptorSet");function D7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(D7,"_classExtractFieldDescriptor");function ac(e,t){var r=D7(e,t,"get");return mU(e,r)}i(ac,"_classPrivateFieldGet");function k7(e,t,r){pU(e,t),t.set(e,r)}i(k7,"_classPrivateFieldInit");function My(e,t,r){var n=D7(e,t,"set");return gU(e,n,r),r}i(My,"_classPrivateFieldSet");var ku=new WeakMap,Du=new WeakMap,Ru=class{get aliases(){return ac(this,ku)}get loader(){return ac(this,Du)}getDefinitionID(t){return ac(this,ku).definitions[t]??null}getSchemaURL(t){return ac(this,ku).schemas[t]??null}getTileID(t){return ac(this,ku).tiles[t]??null}async loadTile(t){let r=this.getTileID(t);if(r==null)throw new Error(`Tile alias "${t}" is not defined`);return await ac(this,Du).load(r)}async createTile(t,r,n={}){let a=this.getSchemaURL(t);if(a==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:s,...c}=n,l={schema:a};return s!=null&&(l.controllers=[s]),await ac(this,Du).create(r,l,c)}constructor(t){if(k7(this,ku,{writable:!0,value:void 0}),k7(this,Du,{writable:!0,value:void 0}),My(this,ku,t.aliases),t.loader!=null)My(this,Du,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");My(this,Du,new ic({ceramic:t.ceramic,cache:t.cache}))}}};i(Ru,"DataModel");function vU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(vU,"_checkPrivateRedeclaration");function yU(e,t){return t.get?t.get.call(e):t.value}i(yU,"_classApplyDescriptorGet");function bU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(bU,"_classApplyDescriptorSet");function R7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(R7,"_classExtractFieldDescriptor");function Na(e,t){var r=R7(e,t,"get");return yU(e,r)}i(Na,"_classPrivateFieldGet");function e0(e,t,r){vU(e,t),t.set(e,r)}i(e0,"_classPrivateFieldInit");function t0(e,t,r){var n=R7(e,t,"set");return bU(e,n,r),r}i(t0,"_classPrivateFieldSet");var r0=new WeakMap,oc=new WeakMap,Iy=new WeakMap,n0=new WeakMap,Pf=class{_createValuePromise(){t0(this,Iy,new Promise((t,r)=>{t0(this,n0,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let a=i(async s=>{try{let c=await t(s);r(),this._next(c)}catch(c){n(c),this._next(s)}},"run");Na(this,oc).push({reject:n,run:a}),Na(this,oc).length===1&&this._start()})}async changeContent(t){let r=i(async n=>(await n.update(t(n.content),n.metadata),n),"mutation");return await this.change(r)}async get(){return Na(this,oc).length===0?await Na(this,r0).call(this):await Na(this,Iy)}async _start(){try{let t=await Na(this,r0).call(this);this._next(t)}catch(t){Na(this,oc).forEach(r=>{r.reject(t)}),t0(this,oc,[]),Na(this,n0).reject(t),this._createValuePromise()}}_next(t){let r=Na(this,oc).shift();r==null?this._end(t):r.run(t)}_end(t){Na(this,n0).resolve(t),this._createValuePromise()}constructor(t){e0(this,r0,{writable:!0,value:void 0}),e0(this,oc,{writable:!0,value:[]}),e0(this,Iy,{writable:!0,value:void 0}),e0(this,n0,{writable:!0,value:void 0}),t0(this,r0,t),this._createValuePromise()}};i(Pf,"TileProxy");var wU=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function _U(e){return wU.test(e)}i(_U,"isDIDstring");function EU(e){if(!_U(e))throw new Error(`Invalid DID: ${e}`)}i(EU,"assertDIDstring");function ky(e){return EU(e),{controllers:[e],family:"IDX"}}i(ky,"getIDXMetadata");function AU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(AU,"_checkPrivateRedeclaration");function SU(e,t){return t.get?t.get.call(e):t.value}i(SU,"_classApplyDescriptorGet");function xU(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(xU,"_classApplyDescriptorSet");function O7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(O7,"_classExtractFieldDescriptor");function $r(e,t){var r=O7(e,t,"get");return SU(e,r)}i($r,"_classPrivateFieldGet");function Bf(e,t,r){AU(e,t),t.set(e,r)}i(Bf,"_classPrivateFieldInit");function i0(e,t,r){var n=O7(e,t,"set");return xU(e,n,r),r}i(i0,"_classPrivateFieldSet");var vo=new WeakMap,a0=new WeakMap,Dy=new WeakMap,Pa=new WeakMap,o0=new WeakMap,Lf=class{get authenticated(){return $r(this,vo).did!=null}get ceramic(){return $r(this,vo)}get id(){if($r(this,a0)!=null)return $r(this,a0);if($r(this,vo).did==null)throw new Error("Ceramic instance is not authenticated");return $r(this,vo).did.hasParent?$r(this,vo).did.parent:$r(this,vo).did.id}get loader(){return $r(this,Pa)}get model(){return $r(this,o0)}async has(t,r){let n=this.getDefinitionID(t);return await this.getRecordID(n,r)!=null}async get(t,r){let n=this.getDefinitionID(t);return await this.getRecord(n,r)}async getMultiple(t,r){let n=this.getDefinitionID(t),a=await Promise.all(r.map(async l=>{let{genesis:h,streamId:p}=await Cy(ky(l));return{genesis:h,streamId:p.toString(),paths:[n]}})),s=await $r(this,vo).multiQuery(a),c=[];for(let l of a){let h=s[l.streamId]?.content?.[n],p=h?s[Yt.fromString(h).toString()]:null;c.push(p?.content??null)}return c}async set(t,r,n={}){let a=this.getDefinitionID(t),[s,c]=await this._setRecordOnly(a,r,n);return s&&await this._setReference(n.controller??this.id,a,c),c}async merge(t,r,n={}){let a=this.getDefinitionID(t),s=await this.getRecord(a),c=s?{...s,...r}:r;return await this.setRecord(a,c,n)}async setAll(t,r={}){let n=Object.entries(t).map(async([c,l])=>{let h=this.getDefinitionID(c),[p,g]=await this._setRecordOnly(h,l,r);return[p,h,g]}),s=(await Promise.all(n)).reduce((c,[l,h,p])=>(l&&(c[h]=p.toUrl()),c),{});return await this._setReferences(r.controller??this.id,s),s}async setDefaults(t,r={}){let n=await this.getIndex()??{},a=Object.entries(t).map(([l,h])=>[this.getDefinitionID(l),h]).filter(l=>n[l[0]]==null).map(async([l,h])=>{let p=await this.getDefinition(l),g=await this._createRecord(p,h,r);return{[l]:g.toUrl()}}),c=(await Promise.all(a)).reduce((l,h)=>Object.assign(l,h),{});return await this._setReferences(r.controller??this.id,c),c}async remove(t,r=this.id){await this._getIndexProxy(r).changeContent(n=>(n!=null&&delete n[this.getDefinitionID(t)],n))}async getIndex(t=this.id){let r=this.authenticated&&t===this.id?await this._getIndexProxy(t).get():await this._getIDXDoc(t);return r?r.content:null}iterator(t){let r,n=0;return{[Symbol.asyncIterator](){return this},next:async()=>{if(r==null){let l=await this.getIndex(t);r=Object.entries(l??{})}if(n===r.length)return{done:!0,value:null};let[a,s]=r[n++],c=await $r(this,Pa).load(s);return{done:!1,value:{key:a,id:s,record:c.content}}}}}async _createIDXDoc(t){return await $r(this,Pa).deterministic(ky(t))}async _getIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)return null;if(r.metadata.schema!==Sp)throw new Error("Invalid document: schema is not IdentityIndex");return r}async _getOwnIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)await r.update({},{schema:Sp});else if(r.metadata.schema!==Sp)throw new Error("Invalid document: schema is not IdentityIndex");return r}_getIndexProxy(t){let r=$r(this,Dy)[t];return r==null&&(r=new Pf(async()=>await this._getOwnIDXDoc(t)),$r(this,Dy)[t]=r),r}getDefinitionID(t){return $r(this,o0).getDefinitionID(t)??t}async getDefinition(t){let r=await $r(this,Pa).load(t);if(r.metadata.schema!==YE)throw new Error("Invalid document: schema is not Definition");return{...r.content,id:r.id}}async getRecordID(t,r){return(await this.getIndex(r??this.id))?.[t]??null}async getRecordDocument(t,r){let n=await this.getRecordID(t,r);return n?await $r(this,Pa).load(n):null}async getRecord(t,r){let n=await this.getRecordDocument(t,r);return n?n.content:null}async setRecord(t,r,n={}){let[a,s]=await this._setRecordOnly(t,r,n);return a&&await this._setReference(n.controller??this.id,t,s),s}async _setRecordOnly(t,r,n){let a=await this.getRecordID(t,n.controller??this.id);if(a==null){let s=await this.getDefinition(t),c=await this._createRecord(s,r,n);return[!0,c]}else{let s=await $r(this,Pa).update(a,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:a}){let s=await $r(this,Pa).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:a});return await s.update(r,{schema:t.schema}),s.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(a=>({...a,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Bf(this,vo,{writable:!0,value:void 0}),Bf(this,a0,{writable:!0,value:void 0}),Bf(this,Dy,{writable:!0,value:{}}),Bf(this,Pa,{writable:!0,value:void 0}),Bf(this,o0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:a,loader:s,model:c}=t;i0(this,vo,n),i0(this,a0,a),i0(this,Pa,s??new ic({ceramic:n,cache:r})),i0(this,o0,c instanceof Ru?c:new Ru({loader:$r(this,Pa),aliases:c}))}};i(Lf,"DIDDataStore");var rr;(function(e){e.assertEqual=a=>a;function t(a){}i(t,"assertIs"),e.assertIs=t;function r(a){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=a=>{let s={};for(let c of a)s[c]=c;return s},e.getValidEnumValues=a=>{let s=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of s)c[l]=a[l];return e.objectValues(c)},e.objectValues=a=>e.objectKeys(a).map(function(s){return a[s]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&s.push(c);return s},e.find=(a,s)=>{for(let c of a)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(rr||(rr={}));var tt=rr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Yo=i(e=>{switch(typeof e){case"undefined":return tt.undefined;case"string":return tt.string;case"number":return isNaN(e)?tt.nan:tt.number;case"boolean":return tt.boolean;case"function":return tt.function;case"bigint":return tt.bigint;case"symbol":return tt.symbol;case"object":return Array.isArray(e)?tt.array:e===null?tt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?tt.promise:typeof Map<"u"&&e instanceof Map?tt.map:typeof Set<"u"&&e instanceof Set?tt.set:typeof Date<"u"&&e instanceof Date?tt.date:tt.object;default:return tt.unknown}},"getParsedType"),Ke=rr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),TU=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),$i=class extends Error{constructor(t){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let r=t||function(s){return s.message},n={_errors:[]},a=i(s=>{for(let c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(a);else if(c.code==="invalid_return_type")a(c.returnTypeError);else if(c.code==="invalid_arguments")a(c.argumentsError);else if(c.path.length===0)n._errors.push(r(c));else{let l=n,h=0;for(;h<c.path.length;){let p=c.path[h];h===c.path.length-1?(l[p]=l[p]||{_errors:[]},l[p]._errors.push(r(c))):l[p]=l[p]||{_errors:[]},l=l[p],h++}}},"processError");return a(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,rr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let a of this.issues)a.path.length>0?(r[a.path[0]]=r[a.path[0]]||[],r[a.path[0]].push(t(a))):n.push(t(a));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i($i,"ZodError");$i.create=e=>new $i(e);var Ff=i((e,t)=>{let r;switch(e.code){case Ke.invalid_type:e.received===tt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ke.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,rr.jsonStringifyReplacer)}`;break;case Ke.unrecognized_keys:r=`Unrecognized key(s) in object: ${rr.joinValues(e.keys,", ")}`;break;case Ke.invalid_union:r="Invalid input";break;case Ke.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${rr.joinValues(e.options)}`;break;case Ke.invalid_enum_value:r=`Invalid enum value. Expected ${rr.joinValues(e.options)}, received '${e.received}'`;break;case Ke.invalid_arguments:r="Invalid function arguments";break;case Ke.invalid_return_type:r="Invalid function return type";break;case Ke.invalid_date:r="Invalid date";break;case Ke.invalid_string:typeof e.validation=="object"?"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:rr.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ke.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(e.minimum)}`:r="Invalid input";break;case Ke.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(e.maximum)}`:r="Invalid input";break;case Ke.custom:r="Invalid input";break;case Ke.invalid_intersection_types:r="Intersection results could not be merged";break;case Ke.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ke.not_finite:r="Number must be finite";break;default:r=t.defaultError,rr.assertNever(e)}return{message:r}},"errorMap"),L7=Ff;function CU(e){L7=e}i(CU,"setErrorMap");function c0(){return L7}i(c0,"getErrorMap");var u0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],c={...a,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...a,path:s,message:a.message||l}},"makeIssue"),MU=[];function vt(e,t){let r=u0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,c0(),Ff].filter(n=>!!n)});e.common.issues.push(r)}i(vt,"addIssueToContext");var en=class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,r){let n=[];for(let a of r){if(a.status==="aborted")return Dt;a.status==="dirty"&&t.dirty(),n.push(a.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let a of r)n.push({key:await a.key,value:await a.value});return en.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let a of r){let{key:s,value:c}=a;if(s.status==="aborted"||c.status==="aborted")return Dt;s.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),(typeof c.value<"u"||a.alwaysSet)&&(n[s.value]=c.value)}return{status:t.value,value:n}}};i(en,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),U7=i(e=>({status:"dirty",value:e}),"DIRTY"),Sn=i(e=>({status:"valid",value:e}),"OK"),Ry=i(e=>e.status==="aborted","isAborted"),Oy=i(e=>e.status==="dirty","isDirty"),l0=i(e=>e.status==="valid","isValid"),f0=i(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Wt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Wt||(Wt={}));var gi=class{constructor(t,r,n,a){this.parent=t,this.data=r,this._path=n,this._key=a}get path(){return this._path.concat(this._key)}};i(gi,"ParseInputLazyPath");var N7=i((e,t)=>{if(l0(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new $i(e.common.issues);return{success:!1,error:r}}},"handleResult");function Vt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:i((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:a}}i(Vt,"processCreateParams");var Bt=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(t){return Yo(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Yo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new en,ctx:{common:t.parent.common,data:t.data,parsedType:Yo(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(f0(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(t){let r=this._parse(t);return Promise.resolve(r)}parse(t,r){let n=this.safeParse(t,r);if(n.success)return n.data;throw n.error}safeParse(t,r){var n;let a={common:{issues:[],async:(n=r?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yo(t)},s=this._parseSync({data:t,path:a.path,parent:a});return N7(a,s)}async parseAsync(t,r){let n=await this.safeParseAsync(t,r);if(n.success)return n.data;throw n.error}async safeParseAsync(t,r){let n={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Yo(t)},a=this._parse({data:t,path:n.path,parent:n}),s=await(f0(a)?a:Promise.resolve(a));return N7(n,s)}refine(t,r){let n=i(a=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(a):r,"getIssueProperties");return this._refinement((a,s)=>{let c=t(a),l=i(()=>s.addIssue({code:Ke.custom,...n(a)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(h=>h?!0:(l(),!1)):c?!0:(l(),!1)})}refinement(t,r){return this._refinement((n,a)=>t(n)?!0:(a.addIssue(typeof r=="function"?r(n,a):r),!1))}_refinement(t){return new Wn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return yi.create(this)}nullable(){return Fa.create(this)}nullish(){return this.optional().nullable()}array(){return Gn.create(this)}promise(){return wo.create(this)}or(t){return rs.create([this,t])}and(t){return ns.create(this,t)}transform(t){return new Wn({schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new us({innerType:this,defaultValue:r,typeName:xt.ZodDefault})}brand(){return new Uf({typeName:xt.ZodBranded,type:this,...Vt(void 0)})}catch(t){let r=typeof t=="function"?t:()=>t;return new fc({innerType:this,defaultValue:r,typeName:xt.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return ls.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i(Bt,"ZodType");var IU=/^c[^\s-]{8,}$/i,kU=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,DU=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,RU=i(e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),zi=class extends Bt{constructor(){super(...arguments),this._regex=(t,r,n)=>this.refinement(a=>t.test(a),{validation:r,code:Ke.invalid_string,...Wt.errToObj(n)}),this.nonempty=t=>this.min(1,Wt.errToObj(t)),this.trim=()=>new zi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==tt.string){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.string,received:s.parsedType}),Dt}let n=new en,a;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")t.data.length>s.value&&(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let c=t.data.length>s.value,l=t.data.length<s.value;(c||l)&&(a=this._getOrReturnCtx(t,a),c?vt(a,{code:Ke.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&vt(a,{code:Ke.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")DU.test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{validation:"email",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")kU.test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{validation:"uuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")IU.test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{validation:"cuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{a=this._getOrReturnCtx(t,a),vt(a,{validation:"url",code:Ke.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{validation:"regex",code:Ke.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?t.data=t.data.trim():s.kind==="startsWith"?t.data.startsWith(s.value)||(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?RU(s).test(t.data)||(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.invalid_string,validation:"datetime",message:s.message}),n.dirty()):rr.assertNever(s);return{status:n.value,value:t.data}}_addCheck(t){return new zi({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Wt.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Wt.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Wt.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Wt.errToObj(t)})}datetime(t){var r;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(r=t?.offset)!==null&&r!==void 0?r:!1,...Wt.errToObj(t?.message)})}regex(t,r){return this._addCheck({kind:"regex",regex:t,...Wt.errToObj(r)})}startsWith(t,r){return this._addCheck({kind:"startsWith",value:t,...Wt.errToObj(r)})}endsWith(t,r){return this._addCheck({kind:"endsWith",value:t,...Wt.errToObj(r)})}min(t,r){return this._addCheck({kind:"min",value:t,...Wt.errToObj(r)})}max(t,r){return this._addCheck({kind:"max",value:t,...Wt.errToObj(r)})}length(t,r){return this._addCheck({kind:"length",value:t,...Wt.errToObj(r)})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get minLength(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxLength(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}};i(zi,"ZodString");zi.create=e=>{var t;return new zi({checks:[],typeName:xt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};function OU(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return s%c/Math.pow(10,a)}i(OU,"floatSafeRemainder");var oa=class extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==tt.number){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.number,received:s.parsedType}),Dt}let n,a=new en;for(let s of this._def.checks)s.kind==="int"?rr.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.invalid_type,expected:"integer",received:"float",message:s.message}),a.dirty()):s.kind==="min"?(s.inclusive?t.data<s.value:t.data<=s.value)&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="max"?(s.inclusive?t.data>s.value:t.data>=s.value)&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),a.dirty()):s.kind==="multipleOf"?OU(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_multiple_of,multipleOf:s.value,message:s.message}),a.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_finite,message:s.message}),a.dirty()):rr.assertNever(s);return{status:a.value,value:t.data}}gte(t,r){return this.setLimit("min",t,!0,Wt.toString(r))}gt(t,r){return this.setLimit("min",t,!1,Wt.toString(r))}lte(t,r){return this.setLimit("max",t,!0,Wt.toString(r))}lt(t,r){return this.setLimit("max",t,!1,Wt.toString(r))}setLimit(t,r,n,a){return new oa({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Wt.toString(a)}]})}_addCheck(t){return new oa({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Wt.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Wt.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Wt.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Wt.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Wt.toString(t)})}multipleOf(t,r){return this._addCheck({kind:"multipleOf",value:t,message:Wt.toString(r)})}finite(t){return this._addCheck({kind:"finite",message:Wt.toString(t)})}get minValue(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t}get maxValue(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int")}};i(oa,"ZodNumber");oa.create=e=>new oa({checks:[],typeName:xt.ZodNumber,coerce:e?.coerce||!1,...Vt(e)});var Xo=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==tt.bigint){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.bigint,received:n.parsedType}),Dt}return Sn(t.data)}};i(Xo,"ZodBigInt");Xo.create=e=>{var t;return new Xo({typeName:xt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};var Qo=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==tt.boolean){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.boolean,received:n.parsedType}),Dt}return Sn(t.data)}};i(Qo,"ZodBoolean");Qo.create=e=>new Qo({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Vt(e)});var Ba=class extends Bt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==tt.date){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_type,expected:tt.date,received:s.parsedType}),Dt}if(isNaN(t.data.getTime())){let s=this._getOrReturnCtx(t);return vt(s,{code:Ke.invalid_date}),Dt}let n=new en,a;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?t.data.getTime()>s.value&&(a=this._getOrReturnCtx(t,a),vt(a,{code:Ke.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):rr.assertNever(s);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ba({...this._def,checks:[...this._def.checks,t]})}min(t,r){return this._addCheck({kind:"min",value:t.getTime(),message:Wt.toString(r)})}max(t,r){return this._addCheck({kind:"max",value:t.getTime(),message:Wt.toString(r)})}get minDate(){let t=null;for(let r of this._def.checks)r.kind==="min"&&(t===null||r.value>t)&&(t=r.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let r of this._def.checks)r.kind==="max"&&(t===null||r.value<t)&&(t=r.value);return t!=null?new Date(t):null}};i(Ba,"ZodDate");Ba.create=e=>new Ba({checks:[],coerce:e?.coerce||!1,typeName:xt.ZodDate,...Vt(e)});var sc=class extends Bt{_parse(t){if(this._getType(t)!==tt.symbol){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.symbol,received:n.parsedType}),Dt}return Sn(t.data)}};i(sc,"ZodSymbol");sc.create=e=>new sc({typeName:xt.ZodSymbol,...Vt(e)});var es=class extends Bt{_parse(t){if(this._getType(t)!==tt.undefined){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.undefined,received:n.parsedType}),Dt}return Sn(t.data)}};i(es,"ZodUndefined");es.create=e=>new es({typeName:xt.ZodUndefined,...Vt(e)});var ts=class extends Bt{_parse(t){if(this._getType(t)!==tt.null){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.null,received:n.parsedType}),Dt}return Sn(t.data)}};i(ts,"ZodNull");ts.create=e=>new ts({typeName:xt.ZodNull,...Vt(e)});var yo=class extends Bt{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};i(yo,"ZodAny");yo.create=e=>new yo({typeName:xt.ZodAny,...Vt(e)});var La=class extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};i(La,"ZodUnknown");La.create=e=>new La({typeName:xt.ZodUnknown,...Vt(e)});var Hi=class extends Bt{_parse(t){let r=this._getOrReturnCtx(t);return vt(r,{code:Ke.invalid_type,expected:tt.never,received:r.parsedType}),Dt}};i(Hi,"ZodNever");Hi.create=e=>new Hi({typeName:xt.ZodNever,...Vt(e)});var cc=class extends Bt{_parse(t){if(this._getType(t)!==tt.undefined){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.void,received:n.parsedType}),Dt}return Sn(t.data)}};i(cc,"ZodVoid");cc.create=e=>new cc({typeName:xt.ZodVoid,...Vt(e)});var Gn=class extends Bt{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),a=this._def;if(r.parsedType!==tt.array)return vt(r,{code:Ke.invalid_type,expected:tt.array,received:r.parsedType}),Dt;if(a.exactLength!==null){let c=r.data.length>a.exactLength.value,l=r.data.length<a.exactLength.value;(c||l)&&(vt(r,{code:c?Ke.too_big:Ke.too_small,minimum:l?a.exactLength.value:void 0,maximum:c?a.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:a.exactLength.message}),n.dirty())}if(a.minLength!==null&&r.data.length<a.minLength.value&&(vt(r,{code:Ke.too_small,minimum:a.minLength.value,type:"array",inclusive:!0,exact:!1,message:a.minLength.message}),n.dirty()),a.maxLength!==null&&r.data.length>a.maxLength.value&&(vt(r,{code:Ke.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((c,l)=>a.type._parseAsync(new gi(r,c,r.path,l)))).then(c=>en.mergeArray(n,c));let s=r.data.map((c,l)=>a.type._parseSync(new gi(r,c,r.path,l)));return en.mergeArray(n,s)}get element(){return this._def.type}min(t,r){return new Gn({...this._def,minLength:{value:t,message:Wt.toString(r)}})}max(t,r){return new Gn({...this._def,maxLength:{value:t,message:Wt.toString(r)}})}length(t,r){return new Gn({...this._def,exactLength:{value:t,message:Wt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Gn,"ZodArray");Gn.create=(e,t)=>new Gn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,...Vt(t)});var d0;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(d0||(d0={}));var P7=i(e=>t=>new Er({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function Ou(e){if(e instanceof Er){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=yi.create(Ou(n))}return new Er({...e._def,shape:()=>t})}else return e instanceof Gn?Gn.create(Ou(e.element)):e instanceof yi?yi.create(Ou(e.unwrap())):e instanceof Fa?Fa.create(Ou(e.unwrap())):e instanceof vi?vi.create(e.items.map(t=>Ou(t))):e}i(Ou,"deepPartialify");var Er=class extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=P7(this._def),this.extend=P7(this._def)}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=rr.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==tt.object){let p=this._getOrReturnCtx(t);return vt(p,{code:Ke.invalid_type,expected:tt.object,received:p.parsedType}),Dt}let{status:n,ctx:a}=this._processInputParams(t),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof Hi&&this._def.unknownKeys==="strip"))for(let p in a.data)c.includes(p)||l.push(p);let h=[];for(let p of c){let g=s[p],v=a.data[p];h.push({key:{status:"valid",value:p},value:g._parse(new gi(a,v,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof Hi){let p=this._def.unknownKeys;if(p==="passthrough")for(let g of l)h.push({key:{status:"valid",value:g},value:{status:"valid",value:a.data[g]}});else if(p==="strict")l.length>0&&(vt(a,{code:Ke.unrecognized_keys,keys:l}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let g of l){let v=a.data[g];h.push({key:{status:"valid",value:g},value:p._parse(new gi(a,v,a.path,g)),alwaysSet:g in a.data})}}return a.common.async?Promise.resolve().then(async()=>{let p=[];for(let g of h){let v=await g.key;p.push({key:v,value:await g.value,alwaysSet:g.alwaysSet})}return p}).then(p=>en.mergeObjectSync(n,p)):en.mergeObjectSync(n,h)}get shape(){return this._def.shape()}strict(t){return Wt.errToObj,new Er({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var a,s,c,l;let h=(c=(s=(a=this._def).errorMap)===null||s===void 0?void 0:s.call(a,r,n).message)!==null&&c!==void 0?c:n.defaultError;return r.code==="unrecognized_keys"?{message:(l=Wt.errToObj(t).message)!==null&&l!==void 0?l:h}:{message:h}}}:{}})}strip(){return new Er({...this._def,unknownKeys:"strip"})}passthrough(){return new Er({...this._def,unknownKeys:"passthrough"})}setKey(t,r){return this.augment({[t]:r})}merge(t){return new Er({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>d0.mergeShapes(this._def.shape(),t._def.shape()),typeName:xt.ZodObject})}catchall(t){return new Er({...this._def,catchall:t})}pick(t){let r={};return rr.objectKeys(t).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new Er({...this._def,shape:()=>r})}omit(t){let r={};return rr.objectKeys(this.shape).map(n=>{rr.objectKeys(t).indexOf(n)===-1&&(r[n]=this.shape[n])}),new Er({...this._def,shape:()=>r})}deepPartial(){return Ou(this)}partial(t){let r={};if(t)return rr.objectKeys(this.shape).map(n=>{rr.objectKeys(t).indexOf(n)===-1?r[n]=this.shape[n]:r[n]=this.shape[n].optional()}),new Er({...this._def,shape:()=>r});for(let n in this.shape){let a=this.shape[n];r[n]=a.optional()}return new Er({...this._def,shape:()=>r})}required(t){let r={};if(t)rr.objectKeys(this.shape).map(n=>{if(rr.objectKeys(t).indexOf(n)===-1)r[n]=this.shape[n];else{let s=this.shape[n];for(;s instanceof yi;)s=s._def.innerType;r[n]=s}});else for(let n in this.shape){let s=this.shape[n];for(;s instanceof yi;)s=s._def.innerType;r[n]=s}return new Er({...this._def,shape:()=>r})}keyof(){return F7(rr.objectKeys(this.shape))}};i(Er,"ZodObject");Er.create=(e,t)=>new Er({shape:()=>e,unknownKeys:"strip",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});Er.strictCreate=(e,t)=>new Er({shape:()=>e,unknownKeys:"strict",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});Er.lazycreate=(e,t)=>new Er({shape:e,unknownKeys:"strip",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});var rs=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function a(s){for(let l of s)if(l.result.status==="valid")return l.result;for(let l of s)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let c=s.map(l=>new $i(l.ctx.common.issues));return vt(r,{code:Ke.invalid_union,unionErrors:c}),Dt}if(i(a,"handleResults"),r.common.async)return Promise.all(n.map(async s=>{let c={...r,common:{...r.common,issues:[]},parent:null};return{result:await s._parseAsync({data:r.data,path:r.path,parent:c}),ctx:c}})).then(a);{let s,c=[];for(let h of n){let p={...r,common:{...r.common,issues:[]},parent:null},g=h._parseSync({data:r.data,path:r.path,parent:p});if(g.status==="valid")return g;g.status==="dirty"&&!s&&(s={result:g,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(s)return r.common.issues.push(...s.ctx.common.issues),s.result;let l=c.map(h=>new $i(h));return vt(r,{code:Ke.invalid_union,unionErrors:l}),Dt}}get options(){return this._def.options}};i(rs,"ZodUnion");rs.create=(e,t)=>new rs({options:e,typeName:xt.ZodUnion,...Vt(t)});var s0=i(e=>e instanceof as?s0(e.schema):e instanceof Wn?s0(e.innerType()):e instanceof os?[e.value]:e instanceof ss?e.options:e instanceof cs?Object.keys(e.enum):e instanceof us?s0(e._def.innerType):e instanceof es?[void 0]:e instanceof ts?[null]:null,"getDiscriminator"),uc=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.object)return vt(r,{code:Ke.invalid_type,expected:tt.object,received:r.parsedType}),Dt;let n=this.discriminator,a=r.data[n],s=this.optionsMap.get(a);return s?r.common.async?s._parseAsync({data:r.data,path:r.path,parent:r}):s._parseSync({data:r.data,path:r.path,parent:r}):(vt(r,{code:Ke.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),Dt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let a=new Map;for(let s of r){let c=s0(s.shape[t]);if(!c)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let l of c){if(a.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);a.set(l,s)}}return new uc({typeName:xt.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:a,...Vt(n)})}};i(uc,"ZodDiscriminatedUnion");function Ny(e,t){let r=Yo(e),n=Yo(t);if(e===t)return{valid:!0,data:e};if(r===tt.object&&n===tt.object){let a=rr.objectKeys(t),s=rr.objectKeys(e).filter(l=>a.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=Ny(e[l],t[l]);if(!h.valid)return{valid:!1};c[l]=h.data}return{valid:!0,data:c}}else if(r===tt.array&&n===tt.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=Ny(c,l);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return r===tt.date&&n===tt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Ny,"mergeValues");var ns=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),a=i((s,c)=>{if(Ry(s)||Ry(c))return Dt;let l=Ny(s.value,c.value);return l.valid?((Oy(s)||Oy(c))&&r.dirty(),{status:r.value,value:l.data}):(vt(n,{code:Ke.invalid_intersection_types}),Dt)},"handleParsed");return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,c])=>a(s,c)):a(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};i(ns,"ZodIntersection");ns.create=(e,t,r)=>new ns({left:e,right:t,typeName:xt.ZodIntersection,...Vt(r)});var vi=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.array)return vt(n,{code:Ke.invalid_type,expected:tt.array,received:n.parsedType}),Dt;if(n.data.length<this._def.items.length)return vt(n,{code:Ke.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dt;!this._def.rest&&n.data.length>this._def.items.length&&(vt(n,{code:Ke.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let s=n.data.map((c,l)=>{let h=this._def.items[l]||this._def.rest;return h?h._parse(new gi(n,c,n.path,l)):null}).filter(c=>!!c);return n.common.async?Promise.all(s).then(c=>en.mergeArray(r,c)):en.mergeArray(r,s)}get items(){return this._def.items}rest(t){return new vi({...this._def,rest:t})}};i(vi,"ZodTuple");vi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new vi({items:e,typeName:xt.ZodTuple,rest:null,...Vt(t)})};var is=class extends Bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.object)return vt(n,{code:Ke.invalid_type,expected:tt.object,received:n.parsedType}),Dt;let a=[],s=this._def.keyType,c=this._def.valueType;for(let l in n.data)a.push({key:s._parse(new gi(n,l,n.path,l)),value:c._parse(new gi(n,n.data[l],n.path,l))});return n.common.async?en.mergeObjectAsync(r,a):en.mergeObjectSync(r,a)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Bt?new is({keyType:t,valueType:r,typeName:xt.ZodRecord,...Vt(n)}):new is({keyType:zi.create(),valueType:t,typeName:xt.ZodRecord,...Vt(r)})}};i(is,"ZodRecord");var lc=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.map)return vt(n,{code:Ke.invalid_type,expected:tt.map,received:n.parsedType}),Dt;let a=this._def.keyType,s=this._def.valueType,c=[...n.data.entries()].map(([l,h],p)=>({key:a._parse(new gi(n,l,n.path,[p,"key"])),value:s._parse(new gi(n,h,n.path,[p,"value"]))}));if(n.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let h of c){let p=await h.key,g=await h.value;if(p.status==="aborted"||g.status==="aborted")return Dt;(p.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(p.value,g.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let h of c){let p=h.key,g=h.value;if(p.status==="aborted"||g.status==="aborted")return Dt;(p.status==="dirty"||g.status==="dirty")&&r.dirty(),l.set(p.value,g.value)}return{status:r.value,value:l}}}};i(lc,"ZodMap");lc.create=(e,t,r)=>new lc({valueType:t,keyType:e,typeName:xt.ZodMap,...Vt(r)});var Ua=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==tt.set)return vt(n,{code:Ke.invalid_type,expected:tt.set,received:n.parsedType}),Dt;let a=this._def;a.minSize!==null&&n.data.size<a.minSize.value&&(vt(n,{code:Ke.too_small,minimum:a.minSize.value,type:"set",inclusive:!0,exact:!1,message:a.minSize.message}),r.dirty()),a.maxSize!==null&&n.data.size>a.maxSize.value&&(vt(n,{code:Ke.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),r.dirty());let s=this._def.valueType;function c(h){let p=new Set;for(let g of h){if(g.status==="aborted")return Dt;g.status==="dirty"&&r.dirty(),p.add(g.value)}return{status:r.value,value:p}}i(c,"finalizeSet");let l=[...n.data.values()].map((h,p)=>s._parse(new gi(n,h,n.path,p)));return n.common.async?Promise.all(l).then(h=>c(h)):c(l)}min(t,r){return new Ua({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Ua({...this._def,maxSize:{value:t,message:Wt.toString(r)}})}size(t,r){return this.min(t,r).max(t,r)}nonempty(t){return this.min(1,t)}};i(Ua,"ZodSet");Ua.create=(e,t)=>new Ua({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Vt(t)});var bo=class extends Bt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.function)return vt(r,{code:Ke.invalid_type,expected:tt.function,received:r.parsedType}),Dt;function n(l,h){return u0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,c0(),Ff].filter(p=>!!p),issueData:{code:Ke.invalid_arguments,argumentsError:h}})}i(n,"makeArgsIssue");function a(l,h){return u0({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,c0(),Ff].filter(p=>!!p),issueData:{code:Ke.invalid_return_type,returnTypeError:h}})}i(a,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},c=r.data;return this._def.returns instanceof wo?Sn(async(...l)=>{let h=new $i([]),p=await this._def.args.parseAsync(l,s).catch(y=>{throw h.addIssue(n(l,y)),h}),g=await c(...p);return await this._def.returns._def.type.parseAsync(g,s).catch(y=>{throw h.addIssue(a(g,y)),h})}):Sn((...l)=>{let h=this._def.args.safeParse(l,s);if(!h.success)throw new $i([n(l,h.error)]);let p=c(...h.data),g=this._def.returns.safeParse(p,s);if(!g.success)throw new $i([a(p,g.error)]);return g.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new bo({...this._def,args:vi.create(t).rest(La.create())})}returns(t){return new bo({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new bo({args:t||vi.create([]).rest(La.create()),returns:r||La.create(),typeName:xt.ZodFunction,...Vt(n)})}};i(bo,"ZodFunction");var as=class extends Bt{get schema(){return this._def.getter()}_parse(t){let{ctx:r}=this._processInputParams(t);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};i(as,"ZodLazy");as.create=(e,t)=>new as({getter:e,typeName:xt.ZodLazy,...Vt(t)});var os=class extends Bt{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return vt(r,{code:Ke.invalid_literal,expected:this._def.value}),Dt}return{status:"valid",value:t.data}}get value(){return this._def.value}};i(os,"ZodLiteral");os.create=(e,t)=>new os({value:e,typeName:xt.ZodLiteral,...Vt(t)});function F7(e,t){return new ss({values:e,typeName:xt.ZodEnum,...Vt(t)})}i(F7,"createZodEnum");var ss=class extends Bt{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return vt(r,{expected:rr.joinValues(n),received:r.parsedType,code:Ke.invalid_type}),Dt}if(this._def.values.indexOf(t.data)===-1){let r=this._getOrReturnCtx(t),n=this._def.values;return vt(r,{received:r.data,code:Ke.invalid_enum_value,options:n}),Dt}return Sn(t.data)}get options(){return this._def.values}get enum(){let t={};for(let r of this._def.values)t[r]=r;return t}get Values(){let t={};for(let r of this._def.values)t[r]=r;return t}get Enum(){let t={};for(let r of this._def.values)t[r]=r;return t}};i(ss,"ZodEnum");ss.create=F7;var cs=class extends Bt{_parse(t){let r=rr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==tt.string&&n.parsedType!==tt.number){let a=rr.objectValues(r);return vt(n,{expected:rr.joinValues(a),received:n.parsedType,code:Ke.invalid_type}),Dt}if(r.indexOf(t.data)===-1){let a=rr.objectValues(r);return vt(n,{received:n.data,code:Ke.invalid_enum_value,options:a}),Dt}return Sn(t.data)}get enum(){return this._def.values}};i(cs,"ZodNativeEnum");cs.create=(e,t)=>new cs({values:e,typeName:xt.ZodNativeEnum,...Vt(t)});var wo=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==tt.promise&&r.common.async===!1)return vt(r,{code:Ke.invalid_type,expected:tt.promise,received:r.parsedType}),Dt;let n=r.parsedType===tt.promise?r.data:Promise.resolve(r.data);return Sn(n.then(a=>this._def.type.parseAsync(a,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(wo,"ZodPromise");wo.create=(e,t)=>new wo({type:e,typeName:xt.ZodPromise,...Vt(t)});var Wn=class extends Bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===xt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:r,ctx:n}=this._processInputParams(t),a=this._def.effect||null;if(a.type==="preprocess"){let c=a.transform(n.data);return n.common.async?Promise.resolve(c).then(l=>this._def.schema._parseAsync({data:l,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}let s={addIssue:c=>{vt(n,c),c.fatal?r.abort():r.dirty()},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),a.type==="refinement"){let c=i(l=>{let h=a.refinement(l,s);if(n.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(n.common.async===!1){let l=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return l.status==="aborted"?Dt:(l.status==="dirty"&&r.dirty(),c(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(l=>l.status==="aborted"?Dt:(l.status==="dirty"&&r.dirty(),c(l.value).then(()=>({status:r.value,value:l.value}))))}if(a.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!l0(c))return c;let l=a.transform(c.value,s);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>l0(c)?Promise.resolve(a.transform(c.value,s)).then(l=>({status:r.value,value:l})):c);rr.assertNever(a)}};i(Wn,"ZodEffects");Wn.create=(e,t,r)=>new Wn({schema:e,typeName:xt.ZodEffects,effect:t,...Vt(r)});Wn.createWithPreprocess=(e,t,r)=>new Wn({schema:t,effect:{type:"preprocess",transform:e},typeName:xt.ZodEffects,...Vt(r)});var yi=class extends Bt{_parse(t){return this._getType(t)===tt.undefined?Sn(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(yi,"ZodOptional");yi.create=(e,t)=>new yi({innerType:e,typeName:xt.ZodOptional,...Vt(t)});var Fa=class extends Bt{_parse(t){return this._getType(t)===tt.null?Sn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(Fa,"ZodNullable");Fa.create=(e,t)=>new Fa({innerType:e,typeName:xt.ZodNullable,...Vt(t)});var us=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===tt.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};i(us,"ZodDefault");us.create=(e,t)=>new us({innerType:e,typeName:xt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Vt(t)});var fc=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.innerType._parse({data:r.data,path:r.path,parent:r});return f0(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};i(fc,"ZodCatch");fc.create=(e,t)=>new fc({innerType:e,typeName:xt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Vt(t)});var dc=class extends Bt{_parse(t){if(this._getType(t)!==tt.nan){let n=this._getOrReturnCtx(t);return vt(n,{code:Ke.invalid_type,expected:tt.nan,received:n.parsedType}),Dt}return{status:"valid",value:t.data}}};i(dc,"ZodNaN");dc.create=e=>new dc({typeName:xt.ZodNaN,...Vt(e)});var NU=Symbol("zod_brand"),Uf=class extends Bt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return this._def.type._parse({data:n,path:r.path,parent:r})}unwrap(){return this._def.type}};i(Uf,"ZodBranded");var ls=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return i(async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?Dt:s.status==="dirty"?(r.dirty(),U7(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let a=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?Dt:a.status==="dirty"?(r.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:n.path,parent:n})}}static create(t,r){return new ls({in:t,out:r,typeName:xt.ZodPipeline})}};i(ls,"ZodPipeline");var j7=i((e,t={},r)=>e?yo.create().superRefine((n,a)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;a.addIssue({code:"custom",...c,fatal:r})}}):yo.create(),"custom"),PU={object:Er.lazycreate},xt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"})(xt||(xt={}));var BU=i((e,t={message:`Input not instance of ${e.name}`})=>j7(r=>r instanceof e,t,!0),"instanceOfType"),$7=zi.create,z7=oa.create,LU=dc.create,UU=Xo.create,H7=Qo.create,FU=Ba.create,jU=sc.create,$U=es.create,zU=ts.create,HU=yo.create,qU=La.create,VU=Hi.create,KU=cc.create,GU=Gn.create,WU=Er.create,JU=Er.strictCreate,ZU=rs.create,YU=uc.create,XU=ns.create,QU=vi.create,eF=is.create,tF=lc.create,rF=Ua.create,nF=bo.create,iF=as.create,aF=os.create,oF=ss.create,sF=cs.create,cF=wo.create,B7=Wn.create,uF=yi.create,lF=Fa.create,fF=Wn.createWithPreprocess,dF=ls.create,hF=i(()=>$7().optional(),"ostring"),pF=i(()=>z7().optional(),"onumber"),mF=i(()=>H7().optional(),"oboolean"),gF={string:e=>zi.create({...e,coerce:!0}),number:e=>oa.create({...e,coerce:!0}),boolean:e=>Qo.create({...e,coerce:!0}),bigint:e=>Xo.create({...e,coerce:!0}),date:e=>Ba.create({...e,coerce:!0})},vF=Dt,z=Object.freeze({__proto__:null,defaultErrorMap:Ff,setErrorMap:CU,getErrorMap:c0,makeIssue:u0,EMPTY_PATH:MU,addIssueToContext:vt,ParseStatus:en,INVALID:Dt,DIRTY:U7,OK:Sn,isAborted:Ry,isDirty:Oy,isValid:l0,isAsync:f0,get util(){return rr},ZodParsedType:tt,getParsedType:Yo,ZodType:Bt,ZodString:zi,ZodNumber:oa,ZodBigInt:Xo,ZodBoolean:Qo,ZodDate:Ba,ZodSymbol:sc,ZodUndefined:es,ZodNull:ts,ZodAny:yo,ZodUnknown:La,ZodNever:Hi,ZodVoid:cc,ZodArray:Gn,get objectUtil(){return d0},ZodObject:Er,ZodUnion:rs,ZodDiscriminatedUnion:uc,ZodIntersection:ns,ZodTuple:vi,ZodRecord:is,ZodMap:lc,ZodSet:Ua,ZodFunction:bo,ZodLazy:as,ZodLiteral:os,ZodEnum:ss,ZodNativeEnum:cs,ZodPromise:wo,ZodEffects:Wn,ZodTransformer:Wn,ZodOptional:yi,ZodNullable:Fa,ZodDefault:us,ZodCatch:fc,ZodNaN:dc,BRAND:NU,ZodBranded:Uf,ZodPipeline:ls,custom:j7,Schema:Bt,ZodSchema:Bt,late:PU,get ZodFirstPartyTypeKind(){return xt},coerce:gF,any:HU,array:GU,bigint:UU,boolean:H7,date:FU,discriminatedUnion:YU,effect:B7,enum:oF,function:nF,instanceof:BU,intersection:XU,lazy:iF,literal:aF,map:tF,nan:LU,nativeEnum:sF,never:VU,null:zU,nullable:lF,number:z7,object:WU,oboolean:mF,onumber:pF,optional:uF,ostring:hF,pipeline:dF,preprocess:fF,promise:cF,record:eF,set:rF,strictObject:JU,string:$7,symbol:jU,transformer:B7,tuple:QU,undefined:$U,union:ZU,unknown:qU,void:KU,NEVER:vF,ZodIssueCode:Ke,quotelessJson:TU,ZodError:$i});var yF=Object.defineProperty,bF=i((e,t)=>yF(e,"name",{value:t,configurable:!0}),"__name"),g0=z.array(z.string().or(z.record(z.any()))),jZ=z.object({type:z.string().optional(),narrative:z.string().optional()}),v0=z.string().or(z.object({id:z.string(),type:z.string(),caption:z.string().optional()})),wF=z.object({type:z.string().min(1).or(z.string().array().nonempty()),latitude:z.number(),longitude:z.number()}),_F=z.object({type:z.string().min(1).or(z.string().array().nonempty()),addressCountry:z.string().optional(),addressCountryCode:z.string().optional(),addressRegion:z.string().optional(),addressLocality:z.string().optional(),streetAddress:z.string().optional(),postOfficeBoxNumber:z.string().optional(),postalCode:z.string().optional(),geo:wF.optional()}),EF=z.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(z.string()),Y7=z.object({type:z.string().min(1).or(z.string().array().nonempty()),identifier:z.string(),identifierType:EF}),jf=z.string().or(z.object({id:z.string().optional(),type:z.string().or(z.string().array().nonempty().optional()),name:z.string().optional(),url:z.string().optional(),phone:z.string().optional(),description:z.string().optional(),endorsement:z.any().array().optional(),image:v0.optional(),email:z.string().email().optional(),address:_F.optional(),otherIdentifier:Y7.array().optional(),official:z.string().optional(),parentOrg:z.any().optional(),familyName:z.string().optional(),givenName:z.string().optional(),additionalName:z.string().optional(),patronymicName:z.string().optional(),honorificPrefix:z.string().optional(),honorificSuffix:z.string().optional(),familyNamePrefix:z.string().optional(),dateOfBirth:z.string().optional()}).catchall(z.any())),Py=z.object({id:z.string().optional()}).catchall(z.any()),h0=z.object({type:z.string(),id:z.string()}).catchall(z.any()),q7=z.object({id:z.string(),type:z.string()}).catchall(z.any()),V7=z.object({id:z.string().optional(),type:z.string()}).catchall(z.any()),K7=z.object({type:z.string(),id:z.string().optional()}).catchall(z.any()),G7=z.object({type:z.string().or(z.string().array().nonempty()),id:z.string().optional()}).catchall(z.any()),p0=z.object({"@context":g0,id:z.string().optional(),type:z.string().array().nonempty(),issuer:jf,credentialSubject:Py.or(Py.array()),refreshService:V7.or(V7.array()).optional(),credentialSchema:q7.or(q7.array()).optional(),issuanceDate:z.string().optional(),expirationDate:z.string().optional(),credentialStatus:h0.or(h0.array()).optional(),name:z.string().optional(),description:z.string().optional(),validFrom:z.string().optional(),validUntil:z.string().optional(),status:h0.or(h0.array()).optional(),termsOfUse:K7.or(K7.array()).optional(),evidence:G7.or(G7.array()).optional()}).catchall(z.any()),ja=z.object({type:z.string(),created:z.string(),challenge:z.string().optional(),domain:z.string().optional(),nonce:z.string().optional(),proofPurpose:z.string(),verificationMethod:z.string(),jws:z.string().optional()}).catchall(z.any()),m0=p0.extend({proof:ja.or(ja.array())}),AF=z.object({"@context":g0,id:z.string().optional(),type:z.string().or(z.string().array().nonempty()),verifiableCredential:m0.or(m0.array()).optional(),holder:z.string().optional()}).catchall(z.any()),$Z=AF.extend({proof:ja.or(ja.array())}),Uy=z.object({kty:z.string(),crv:z.string(),x:z.string(),y:z.string().optional(),n:z.string().optional(),d:z.string().optional()}),qZ=Uy.omit({d:!0}).extend({d:z.string()}),SF=z.object({alg:z.string(),iv:z.string(),tag:z.string(),epk:Uy.partial().optional(),kid:z.string().optional(),apv:z.string().optional(),apu:z.string().optional()}),xF=z.object({header:SF,encrypted_key:z.string()}),TF=z.object({protected:z.string(),iv:z.string(),ciphertext:z.string(),tag:z.string(),aad:z.string().optional(),recipients:xF.array().optional()}),hc=z.string().or(z.object({"@context":g0.optional(),id:z.string(),type:z.string(),controller:z.string(),publicKeyJwk:Uy.optional(),publicKeyBase58:z.string().optional(),blockChainAccountId:z.string().optional()}).catchall(z.any())),CF=z.object({id:z.string(),type:z.string().or(z.string().array().nonempty()),serviceEndpoint:z.any().or(z.any().array().nonempty())}).catchall(z.any()),VZ=z.object({"@context":g0,id:z.string(),alsoKnownAs:z.string().optional(),controller:z.string().or(z.string().array().nonempty()).optional(),verificationMethod:hc.array().optional(),authentication:hc.array().optional(),assertionMethod:hc.array().optional(),keyAgreement:hc.array().optional(),capabilityInvocation:hc.array().optional(),capabilityDelegation:hc.array().optional(),publicKey:hc.array().optional(),service:CF.array().optional(),proof:ja.or(ja.array()).optional()}).catchall(z.any()),MF=z.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(z.string()),y0=z.object({type:z.string().array().nonempty(),targetCode:z.string().optional(),targetDescription:z.string().optional(),targetName:z.string(),targetFramework:z.string().optional(),targetType:MF.optional(),targetUrl:z.string()}),IF=z.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),kF=IF.or(z.string()),DF=z.object({id:z.string().optional(),narrative:z.string().optional()}).catchall(z.any()),RF=z.object({id:z.string(),type:z.string().array().nonempty(),endorsementComment:z.string().optional()}),OF=p0.extend({credentialSubject:RF,proof:ja.or(ja.array()).optional()}),NF=z.object({id:z.string(),"@language":z.string().optional(),version:z.string().optional()}),PF=z.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(z.string()),BF=z.object({id:z.string(),type:z.string().array().nonempty(),alignment:y0.array().optional(),description:z.string().optional(),level:z.string().optional(),name:z.string(),points:z.string().optional()}).catchall(z.any()),LF=z.object({id:z.string(),type:z.string().array().nonempty(),alignment:y0.array().optional(),allowedValue:z.string().array().optional(),name:z.string(),requiredLevel:z.string().optional(),requiredValue:z.string().optional(),resultType:PF,rubricCriterionLevel:BF.array().optional(),valueMax:z.string().optional(),valueMin:z.string().optional()}).catchall(z.any()),UF=z.object({id:z.string().optional(),type:z.string().array().nonempty(),alignment:y0.array().optional(),achievementType:kF.optional(),creator:jf.optional(),creditsAvailable:z.number().optional(),criteria:DF,description:z.string(),endorsement:OF.array().optional(),fieldOfStudy:z.string().optional(),humanCode:z.string().optional(),image:v0.optional(),"@language":z.string().optional(),name:z.string(),otherIdentifier:Y7.array().optional(),related:NF.array().optional(),resultDescription:LF.array().optional(),specialization:z.string().optional(),tag:z.string().array().optional(),version:z.string().optional()}).catchall(z.any()),FF=z.object({type:z.string(),hashed:z.boolean(),identityHash:z.string(),identityType:z.string(),salt:z.string().optional()}),jF=z.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),$F=z.object({type:z.string().array().nonempty(),achievedLevel:z.string().optional(),alignment:y0.array().optional(),resultDescription:z.string().optional(),status:jF.optional(),value:z.string().optional()}).catchall(z.any()),W7=z.object({id:z.string().optional(),type:z.string().array().nonempty(),activityEndDate:z.string().optional(),activityStartDate:z.string().optional(),creditsEarned:z.number().optional(),achievement:UF.optional(),identifier:FF.array().optional(),image:v0.optional(),licenseNumber:z.string().optional(),narrative:z.string().optional(),result:$F.array().optional(),role:z.string().optional(),source:jf.optional(),term:z.string().optional()}).catchall(z.any()),zF=z.object({id:z.string().optional(),type:z.string().or(z.string().array().nonempty()),narrative:z.string().optional(),name:z.string().optional(),description:z.string().optional(),genre:z.string().optional(),audience:z.string().optional()}).catchall(z.any()),HF=p0.extend({name:z.string().optional(),description:z.string().optional(),image:v0.optional(),credentialSubject:W7.or(W7.array()),endorsement:p0.array().optional(),evidence:zF.array().optional()}),GZ=HF.extend({proof:ja.or(ja.array())}),JZ=z.object({checks:z.string().array(),warnings:z.string().array(),errors:z.string().array()}),X7=z.enum(["Success","Failed","Error"]),ZZ=X7.enum,YZ=z.object({check:z.string(),status:X7,message:z.string().optional(),details:z.string().optional()}),XZ=z.object({title:z.string().optional(),createdAt:z.string().optional(),issuer:jf.optional(),issuee:jf.optional(),credentialSubject:Py.optional()}),mc=z.object({id:z.string(),uri:z.string()}).catchall(z.any()),tY=z.object({limit:z.number(),cursor:z.string().optional(),sort:z.string().optional()}),Jn=z.object({cursor:z.string().optional(),hasMore:z.boolean()}),Q7=z.object({encryptedRecord:TF,fields:z.string().array()}).catchall(z.any()),rY=Jn.extend({records:Q7.array()}),qF=Q7.extend({id:z.string()}),nY=Jn.extend({records:qF.array()}),J7=bF(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),VF=z.instanceof(RegExp).or(z.string().refine(e=>{try{return J7(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=J7(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),pr=z.string().or(z.object({$in:z.string().array()})).or(z.object({$regex:VF})),KF=z.object({backgroundColor:z.string().optional(),backgroundImage:z.string().optional(),fadeBackgroundImage:z.boolean().optional(),repeatBackgroundImage:z.boolean().optional(),fontColor:z.string().optional(),accentColor:z.string().optional(),accentFontColor:z.string().optional(),idBackgroundImage:z.string().optional(),fadeIdBackgroundImage:z.boolean().optional(),idBackgroundColor:z.string().optional(),repeatIdBackgroundImage:z.boolean().optional()}),pc=z.object({profileId:z.string().min(3).max(40),displayName:z.string().default(""),shortBio:z.string().default(""),bio:z.string().default(""),did:z.string(),isPrivate:z.boolean().optional(),email:z.string().optional(),image:z.string().optional(),heroImage:z.string().optional(),websiteLink:z.string().optional(),isServiceProfile:z.boolean().default(!1).optional(),type:z.string().optional(),notificationsWebhook:z.string().url().startsWith("http").optional(),display:KF.optional(),role:z.string().default("").optional(),dob:z.string().default("").optional()}),oY=z.object({profileId:pr,displayName:pr,shortBio:pr,bio:pr,email:pr,websiteLink:pr,isServiceProfile:z.boolean(),type:pr}).partial(),sY=Jn.extend({records:pc.array()}),cY=z.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),eA=z.object({id:z.string(),created:z.string(),displayName:z.string().default("").optional(),shortBio:z.string().default("").optional(),bio:z.string().default("").optional(),email:z.string().optional(),image:z.string().optional(),heroImage:z.string().optional()}),uY=Jn.extend({records:eA.extend({did:z.string()}).array()}),lY=z.object({id:pr,displayName:pr,shortBio:pr,bio:pr,email:pr}).partial(),fY=Jn.extend({records:z.object({profile:pc,manager:eA.extend({did:z.string()}).optional()}).array()}),dY=z.object({uri:z.string(),to:z.string(),from:z.string(),sent:z.string().datetime(),received:z.string().datetime().optional()}),tA=z.object({role:z.string(),canEdit:z.boolean(),canIssue:z.boolean(),canRevoke:z.boolean(),canManagePermissions:z.boolean(),canIssueChildren:z.string(),canCreateChildren:z.string(),canEditChildren:z.string(),canRevokeChildren:z.string(),canManageChildrenPermissions:z.string(),canManageChildrenProfiles:z.boolean().default(!1).optional(),canViewAnalytics:z.boolean()}),GF=z.object({role:pr,canEdit:z.boolean(),canIssue:z.boolean(),canRevoke:z.boolean(),canManagePermissions:z.boolean(),canIssueChildren:pr,canCreateChildren:pr,canEditChildren:pr,canRevokeChildren:pr,canManageChildrenPermissions:pr,canManageChildrenProfiles:z.boolean(),canViewAnalytics:z.boolean()}).partial(),Z7=z.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),WF=z.discriminatedUnion("type",[z.object({type:z.literal(Z7.Values.GRANT_PERMISSIONS),data:z.object({claimUri:z.string(),targetUri:z.string(),permissions:tA.partial()})}),z.object({type:z.literal(Z7.Values.ADD_ADMIN),data:z.object({claimUri:z.string(),targetUri:z.string()})})]),hY=z.object({type:pr,data:z.object({claimUri:pr,targetUri:pr,permissions:GF})}).deepPartial(),JF=z.object({id:z.string(),createdAt:z.string(),updatedAt:z.string()}).and(WF),pY=Jn.extend({records:JF.array()}),By=z.enum(["DRAFT","LIVE"]),ZF=z.object({uri:z.string(),name:z.string().optional(),type:z.string().optional(),category:z.string().optional(),status:By.optional(),autoConnectRecipients:z.boolean().optional(),meta:z.record(z.any()).optional(),claimPermissions:tA.optional()}),mY=z.object({uri:pr,name:pr,type:pr,category:pr,meta:z.record(pr),status:By.or(z.object({$in:By.array()})),autoConnectRecipients:z.boolean()}).partial(),gY=Jn.extend({records:ZF.array()}),YF=z.object({to:pc,from:z.string(),received:z.string().optional(),uri:z.string().optional()}),vY=Jn.extend({records:YF.array()}),yY=z.object({endpoint:z.string(),name:z.string(),did:z.string().optional()}),bY=z.object({ttlSeconds:z.number().optional(),totalUses:z.number().optional()}),XF=z.object({endpoint:z.string()}),wY=z.object({signingAuthority:XF,relationship:z.object({name:z.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:z.string()})}),_Y=z.object({boostUri:z.string(),signingAuthority:z.object({endpoint:z.string(),name:z.string()})}),QF=z.enum(["live","stale","withdrawn"]),ej=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({categories:z.record(z.object({required:z.boolean()})).default({})}).default({}),personal:z.record(z.object({required:z.boolean()})).default({})}).default({}),write:z.object({credentials:z.object({categories:z.record(z.object({required:z.boolean()})).default({})}).default({}),personal:z.record(z.object({required:z.boolean()})).default({})}).default({})}),rA=z.object({contract:ej,owner:pc,name:z.string(),subtitle:z.string().optional(),description:z.string().optional(),reasonForAccessing:z.string().optional(),image:z.string().optional(),uri:z.string(),needsGuardianConsent:z.boolean().optional(),redirectUrl:z.string().optional(),frontDoorBoostUri:z.string().optional(),createdAt:z.string(),updatedAt:z.string(),expiresAt:z.string().optional(),autoBoosts:z.string().array().optional()}),EY=Jn.extend({records:rA.omit({owner:!0}).array()}),tj=z.object({credentials:z.object({categories:z.record(z.string().array()).default({})}),personal:z.record(z.string()).default({}),date:z.string()}),AY=Jn.extend({records:tj.array()}),rj=z.object({credentials:z.object({category:z.string(),uri:z.string()}).array(),personal:z.record(z.string()).default({}),date:z.string(),contractUri:z.string()}),SY=Jn.extend({records:rj.array()}),nA=z.object({sharing:z.boolean().optional(),shared:z.string().array().optional(),shareAll:z.boolean().optional(),shareUntil:z.string().optional()}),iA=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({shareAll:z.boolean().optional(),sharing:z.boolean().optional(),categories:z.record(nA).default({})}).default({}),personal:z.record(z.string()).default({})}).default({}),write:z.object({credentials:z.object({categories:z.record(z.boolean()).default({})}).default({}),personal:z.record(z.boolean()).default({})}).default({})}),xY=Jn.extend({records:z.object({expiresAt:z.string().optional(),oneTime:z.boolean().optional(),terms:iA,contract:rA,uri:z.string(),consenter:pc,status:QF}).array()}),TY=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({categories:z.record(z.object({required:z.boolean().optional()})).optional()}).optional(),personal:z.record(z.object({required:z.boolean().optional()})).optional()}).optional(),write:z.object({credentials:z.object({categories:z.record(z.object({required:z.boolean().optional()})).optional()}).optional(),personal:z.record(z.object({required:z.boolean().optional()})).optional()}).optional()}),CY=z.object({anonymize:z.boolean().optional(),credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional()}),MY=z.object({credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional(),id:pr.optional()}),nj=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({shareAll:z.boolean().optional(),sharing:z.boolean().optional(),categories:z.record(nA.optional()).optional()}).optional(),personal:z.record(z.string()).optional()}).optional(),write:z.object({credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional()}).optional()}),Ly=z.enum(["consent","update","sync","withdraw","write"]),IY=z.object({terms:nj.optional(),action:Ly.or(Ly.array()).optional(),date:z.object({$gt:z.string()}).or(z.object({$lt:z.string()})).or(z.object({$eq:z.string()})).optional(),expiresAt:z.object({$gt:z.string()}).or(z.object({$lt:z.string()})).or(z.object({$eq:z.string()})).optional(),oneTime:z.boolean().optional()}),aA=z.object({expiresAt:z.string().optional(),oneTime:z.boolean().optional(),terms:iA.optional(),id:z.string(),action:Ly,date:z.string(),uris:z.string().array().optional()}),kY=Jn.extend({records:aA.array()}),ij=z.object({credentialUri:z.string(),termsUri:z.string(),contractUri:z.string(),boostUri:z.string(),category:z.string().optional(),date:z.string()}),DY=Jn.extend({records:ij.array()}),aj=z.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),oj=z.object({title:z.string().optional(),body:z.string().optional()}),sj=z.object({vcUris:z.array(z.string()).optional(),vpUris:z.array(z.string()).optional(),transaction:aA.optional()}),RY=z.object({type:aj,to:pc.partial().and(z.object({did:z.string()})),from:pc.partial().and(z.object({did:z.string()})),message:oj.optional(),data:sj.optional(),sent:z.string().datetime().optional()}),cj="auth-grant:",OY=z.object({id:z.string(),name:z.string(),description:z.string().optional(),challenge:z.string().startsWith(cj).min(10,{message:"Challenge is too short"}).max(100,{message:"Challenge is too long"}),status:z.enum(["revoked","active"],{required_error:"Status is required",invalid_type_error:"Status must be either active or revoked"}),scope:z.string(),createdAt:z.string().datetime({message:"createdAt must be a valid ISO 8601 datetime string"}),expiresAt:z.string().datetime({message:"expiresAt must be a valid ISO 8601 datetime string"}).nullish().optional()}),NY=z.object({id:z.string()}).catchall(z.any()),uj=z.enum(["active","revoked"]),PY=z.object({id:pr,name:pr,description:pr,status:uj}).partial();var lj=Object.create,bd=Object.defineProperty,fj=Object.getOwnPropertyDescriptor,f6=Object.getOwnPropertyNames,dj=Object.getPrototypeOf,hj=Object.prototype.hasOwnProperty,o=i((e,t)=>bd(e,"name",{value:t,configurable:!0}),"__name"),db=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')}),gr=i((e,t)=>i(function(){return e&&(t=(0,e[f6(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[f6(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),xr=i((e,t)=>{for(var r in t)bd(e,r,{get:t[r],enumerable:!0})},"__export"),MS=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of f6(t))!hj.call(e,a)&&a!==r&&bd(e,a,{get:()=>t[a],enumerable:!(n=fj(t,a))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?lj(dj(e)):{},MS(t||!e||!e.__esModule?bd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),Fy=i(e=>MS(bd({},"__esModule",{value:!0}),e),"__toCommonJS"),pj=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",a=200,s="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",l="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",p=500,g="__lodash_placeholder__",v=1,y=2,_=4,x=1,O=2,D=1,P=2,J=4,j=8,q=16,Q=32,Y=64,k=128,K=256,he=512,me=30,we="...",Z=800,w=16,T=1,b=2,f=3,m=1/0,E=9007199254740991,R=17976931348623157e292,C=0/0,A=4294967295,B=A-1,V=A>>>1,I=[["ary",k],["bind",D],["bindKey",P],["curry",j],["curryRight",q],["flip",he],["partial",Q],["partialRight",Y],["rearg",K]],U="[object Arguments]",ge="[object Array]",L="[object AsyncFunction]",ne="[object Boolean]",oe="[object Date]",M="[object DOMException]",G="[object Error]",ae="[object Function]",fe="[object GeneratorFunction]",be="[object Map]",Re="[object Number]",X="[object Null]",N="[object Object]",F="[object Promise]",W="[object Proxy]",ie="[object RegExp]",ee="[object Set]",ue="[object String]",Ae="[object Symbol]",De="[object Undefined]",Ie="[object WeakMap]",Be="[object WeakSet]",qe="[object ArrayBuffer]",ve="[object DataView]",pe="[object Float32Array]",re="[object Float64Array]",le="[object Int8Array]",_e="[object Int16Array]",Te="[object Int32Array]",Ce="[object Uint8Array]",Oe="[object Uint8ClampedArray]",Ct="[object Uint16Array]",Ve="[object Uint32Array]",He=/\b__p \+= '';/g,Ot=/\b(__p \+=) '' \+/g,dt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,Or=/[&<>"']/g,ct=RegExp(mt.source),ut=RegExp(Or.source),lr=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,or=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,it=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,at=RegExp(Qt.source),et=/^\s+/,sr=/\s/,ot=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ze=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,st=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Et=/[()=,{}\[\]\/\s]/,Tn=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,yt=/\w*$/,hn=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,tr=/^\[object .+?Constructor\]$/,nn=/^0o[0-7]+$/i,an=/^(?:0|[1-9]\d*)$/,Nr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vr=/($^)/,on=/['\n\r\u2028\u2029\\]/g,Cn="\\ud800-\\udfff",Ci="\\u0300-\\u036f",Mi="\\ufe20-\\ufe2f",Ii="\\u20d0-\\u20ff",Ln=Ci+Mi+Ii,pn="\\u2700-\\u27bf",ri="a-z\\xdf-\\xf6\\xf8-\\xff",Un="\\xac\\xb1\\xd7\\xf7",ki="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Di="\\u2000-\\u206f",Ri=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Qa="A-Z\\xc0-\\xd6\\xd8-\\xde",eo="\\ufe0e\\ufe0f",to=Un+ki+Di+Ri,Po="['\u2019]",Pd="["+Cn+"]",_l="["+to+"]",ks="["+Ln+"]",El="\\d+",Bd="["+pn+"]",Al="["+ri+"]",Sl="[^"+Cn+to+El+pn+ri+Qa+"]",Ds="\\ud83c[\\udffb-\\udfff]",Ld="(?:"+ks+"|"+Ds+")",xl="[^"+Cn+"]",ro="(?:\\ud83c[\\udde6-\\uddff]){2}",Zi="[\\ud800-\\udbff][\\udc00-\\udfff]",no="["+Qa+"]",ba="\\u200d",Tl="(?:"+Al+"|"+Sl+")",Ud="(?:"+no+"|"+Sl+")",Cl="(?:"+Po+"(?:d|ll|m|re|s|t|ve))?",Ml="(?:"+Po+"(?:D|LL|M|RE|S|T|VE))?",Il=Ld+"?",kl="["+eo+"]?",Dl="(?:"+ba+"(?:"+[xl,ro,Zi].join("|")+")"+kl+Il+")*",wa="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Fd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",qc=kl+Il+Dl,jd="(?:"+[Bd,ro,Zi].join("|")+")"+qc,Rl="(?:"+[xl+ks+"?",ks,ro,Zi,Pd].join("|")+")",Ol=RegExp(Po,"g"),$d=RegExp(ks,"g"),Nl=RegExp(Ds+"(?="+Ds+")|"+Rl+qc,"g"),Pl=RegExp([no+"?"+Al+"+"+Cl+"(?="+[_l,no,"$"].join("|")+")",Ud+"+"+Ml+"(?="+[_l,no+Tl,"$"].join("|")+")",no+"?"+Tl+"+"+Cl,no+"+"+Ml,Fd,wa,El,jd].join("|"),"g"),zd=RegExp("["+ba+Cn+Ln+eo+"]"),Rs=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Hd=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Vc=-1,wr={};wr[pe]=wr[re]=wr[le]=wr[_e]=wr[Te]=wr[Ce]=wr[Oe]=wr[Ct]=wr[Ve]=!0,wr[U]=wr[ge]=wr[qe]=wr[ne]=wr[ve]=wr[oe]=wr[G]=wr[ae]=wr[be]=wr[Re]=wr[N]=wr[ie]=wr[ee]=wr[ue]=wr[Ie]=!1;var vr={};vr[U]=vr[ge]=vr[qe]=vr[ve]=vr[ne]=vr[oe]=vr[pe]=vr[re]=vr[le]=vr[_e]=vr[Te]=vr[be]=vr[Re]=vr[N]=vr[ie]=vr[ee]=vr[ue]=vr[Ae]=vr[Ce]=vr[Oe]=vr[Ct]=vr[Ve]=!0,vr[G]=vr[ae]=vr[Ie]=!1;var de={\u00C0:"A",\u00C1:"A",\u00C2:"A",\u00C3:"A",\u00C4:"A",\u00C5:"A",\u00E0:"a",\u00E1:"a",\u00E2:"a",\u00E3:"a",\u00E4:"a",\u00E5:"a",\u00C7:"C",\u00E7:"c",\u00D0:"D",\u00F0:"d",\u00C8:"E",\u00C9:"E",\u00CA:"E",\u00CB:"E",\u00E8:"e",\u00E9:"e",\u00EA:"e",\u00EB:"e",\u00CC:"I",\u00CD:"I",\u00CE:"I",\u00CF:"I",\u00EC:"i",\u00ED:"i",\u00EE:"i",\u00EF:"i",\u00D1:"N",\u00F1:"n",\u00D2:"O",\u00D3:"O",\u00D4:"O",\u00D5:"O",\u00D6:"O",\u00D8:"O",\u00F2:"o",\u00F3:"o",\u00F4:"o",\u00F5:"o",\u00F6:"o",\u00F8:"o",\u00D9:"U",\u00DA:"U",\u00DB:"U",\u00DC:"U",\u00F9:"u",\u00FA:"u",\u00FB:"u",\u00FC:"u",\u00DD:"Y",\u00FD:"y",\u00FF:"y",\u00C6:"Ae",\u00E6:"ae",\u00DE:"Th",\u00FE:"th",\u00DF:"ss",\u0100:"A",\u0102:"A",\u0104:"A",\u0101:"a",\u0103:"a",\u0105:"a",\u0106:"C",\u0108:"C",\u010A:"C",\u010C:"C",\u0107:"c",\u0109:"c",\u010B:"c",\u010D:"c",\u010E:"D",\u0110:"D",\u010F:"d",\u0111:"d",\u0112:"E",\u0114:"E",\u0116:"E",\u0118:"E",\u011A:"E",\u0113:"e",\u0115:"e",\u0117:"e",\u0119:"e",\u011B:"e",\u011C:"G",\u011E:"G",\u0120:"G",\u0122:"G",\u011D:"g",\u011F:"g",\u0121:"g",\u0123:"g",\u0124:"H",\u0126:"H",\u0125:"h",\u0127:"h",\u0128:"I",\u012A:"I",\u012C:"I",\u012E:"I",\u0130:"I",\u0129:"i",\u012B:"i",\u012D:"i",\u012F:"i",\u0131:"i",\u0134:"J",\u0135:"j",\u0136:"K",\u0137:"k",\u0138:"k",\u0139:"L",\u013B:"L",\u013D:"L",\u013F:"L",\u0141:"L",\u013A:"l",\u013C:"l",\u013E:"l",\u0140:"l",\u0142:"l",\u0143:"N",\u0145:"N",\u0147:"N",\u014A:"N",\u0144:"n",\u0146:"n",\u0148:"n",\u014B:"n",\u014C:"O",\u014E:"O",\u0150:"O",\u014D:"o",\u014F:"o",\u0151:"o",\u0154:"R",\u0156:"R",\u0158:"R",\u0155:"r",\u0157:"r",\u0159:"r",\u015A:"S",\u015C:"S",\u015E:"S",\u0160:"S",\u015B:"s",\u015D:"s",\u015F:"s",\u0161:"s",\u0162:"T",\u0164:"T",\u0166:"T",\u0163:"t",\u0165:"t",\u0167:"t",\u0168:"U",\u016A:"U",\u016C:"U",\u016E:"U",\u0170:"U",\u0172:"U",\u0169:"u",\u016B:"u",\u016D:"u",\u016F:"u",\u0171:"u",\u0173:"u",\u0174:"W",\u0175:"w",\u0176:"Y",\u0177:"y",\u0178:"Y",\u0179:"Z",\u017B:"Z",\u017D:"Z",\u017A:"z",\u017C:"z",\u017E:"z",\u0132:"IJ",\u0133:"ij",\u0152:"Oe",\u0153:"oe",\u0149:"'n",\u017F:"s"},Me={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Le={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Kr=parseFloat,sn=parseInt,Mn=typeof global=="object"&&global&&global.Object===Object&&global,mn=typeof self=="object"&&self&&self.Object===Object&&self,Fr=Mn||mn||Function("return this")(),_a=typeof e=="object"&&e&&!e.nodeType&&e,Ea=_a&&typeof t=="object"&&t&&!t.nodeType&&t,Bl=Ea&&Ea.exports===_a,Kc=Bl&&Mn.process,gn=function(){try{var Se=Ea&&Ea.require&&Ea.require("util").types;return Se||Kc&&Kc.binding&&Kc.binding("util")}catch{}}(),Os=gn&&gn.isArrayBuffer,K2=gn&&gn.isDate,G2=gn&&gn.isMap,W2=gn&&gn.isRegExp,J2=gn&&gn.isSet,Z2=gn&&gn.isTypedArray;function Fn(Se,Pe,ke){switch(ke.length){case 0:return Se.call(Pe);case 1:return Se.call(Pe,ke[0]);case 2:return Se.call(Pe,ke[0],ke[1]);case 3:return Se.call(Pe,ke[0],ke[1],ke[2])}return Se.apply(Pe,ke)}i(Fn,"apply"),o(Fn,"apply");function Y2(Se,Pe,ke,ft){for(var kt=-1,fr=Se==null?0:Se.length;++kt<fr;){var Wr=Se[kt];Pe(ft,Wr,ke(Wr),Se)}return ft}i(Y2,"arrayAggregator"),o(Y2,"arrayAggregator");function ni(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(ni,"arrayEach"),o(ni,"arrayEach");function X2(Se,Pe){for(var ke=Se==null?0:Se.length;ke--&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(X2,"arrayEachRight"),o(X2,"arrayEachRight");function a1(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft;)if(!Pe(Se[ke],ke,Se))return!1;return!0}i(a1,"arrayEvery"),o(a1,"arrayEvery");function io(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length,kt=0,fr=[];++ke<ft;){var Wr=Se[ke];Pe(Wr,ke,Se)&&(fr[kt++]=Wr)}return fr}i(io,"arrayFilter"),o(io,"arrayFilter");function Ll(Se,Pe){var ke=Se==null?0:Se.length;return!!ke&&Ns(Se,Pe,0)>-1}i(Ll,"arrayIncludes"),o(Ll,"arrayIncludes");function qd(Se,Pe,ke){for(var ft=-1,kt=Se==null?0:Se.length;++ft<kt;)if(ke(Pe,Se[ft]))return!0;return!1}i(qd,"arrayIncludesWith"),o(qd,"arrayIncludesWith");function Mr(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length,kt=Array(ft);++ke<ft;)kt[ke]=Pe(Se[ke],ke,Se);return kt}i(Mr,"arrayMap"),o(Mr,"arrayMap");function ao(Se,Pe){for(var ke=-1,ft=Pe.length,kt=Se.length;++ke<ft;)Se[kt+ke]=Pe[ke];return Se}i(ao,"arrayPush"),o(ao,"arrayPush");function Vd(Se,Pe,ke,ft){var kt=-1,fr=Se==null?0:Se.length;for(ft&&fr&&(ke=Se[++kt]);++kt<fr;)ke=Pe(ke,Se[kt],kt,Se);return ke}i(Vd,"arrayReduce"),o(Vd,"arrayReduce");function Q2(Se,Pe,ke,ft){var kt=Se==null?0:Se.length;for(ft&&kt&&(ke=Se[--kt]);kt--;)ke=Pe(ke,Se[kt],kt,Se);return ke}i(Q2,"arrayReduceRight"),o(Q2,"arrayReduceRight");function Kd(Se,Pe){for(var ke=-1,ft=Se==null?0:Se.length;++ke<ft;)if(Pe(Se[ke],ke,Se))return!0;return!1}i(Kd,"arraySome"),o(Kd,"arraySome");var lD=Gd("length");function e3(Se){return Se.split("")}i(e3,"asciiToArray"),o(e3,"asciiToArray");function t3(Se){return Se.match(st)||[]}i(t3,"asciiWords"),o(t3,"asciiWords");function o1(Se,Pe,ke){var ft;return ke(Se,function(kt,fr,Wr){if(Pe(kt,fr,Wr))return ft=fr,!1}),ft}i(o1,"baseFindKey"),o(o1,"baseFindKey");function Ul(Se,Pe,ke,ft){for(var kt=Se.length,fr=ke+(ft?1:-1);ft?fr--:++fr<kt;)if(Pe(Se[fr],fr,Se))return fr;return-1}i(Ul,"baseFindIndex"),o(Ul,"baseFindIndex");function Ns(Se,Pe,ke){return Pe===Pe?f3(Se,Pe,ke):Ul(Se,s1,ke)}i(Ns,"baseIndexOf"),o(Ns,"baseIndexOf");function r3(Se,Pe,ke,ft){for(var kt=ke-1,fr=Se.length;++kt<fr;)if(ft(Se[kt],Pe))return kt;return-1}i(r3,"baseIndexOfWith"),o(r3,"baseIndexOfWith");function s1(Se){return Se!==Se}i(s1,"baseIsNaN"),o(s1,"baseIsNaN");function c1(Se,Pe){var ke=Se==null?0:Se.length;return ke?Jd(Se,Pe)/ke:C}i(c1,"baseMean"),o(c1,"baseMean");function Gd(Se){return function(Pe){return Pe==null?r:Pe[Se]}}i(Gd,"baseProperty"),o(Gd,"baseProperty");function Wd(Se){return function(Pe){return Se==null?r:Se[Pe]}}i(Wd,"basePropertyOf"),o(Wd,"basePropertyOf");function u1(Se,Pe,ke,ft,kt){return kt(Se,function(fr,Wr,_r){ke=ft?(ft=!1,fr):Pe(ke,fr,Wr,_r)}),ke}i(u1,"baseReduce"),o(u1,"baseReduce");function n3(Se,Pe){var ke=Se.length;for(Se.sort(Pe);ke--;)Se[ke]=Se[ke].value;return Se}i(n3,"baseSortBy"),o(n3,"baseSortBy");function Jd(Se,Pe){for(var ke,ft=-1,kt=Se.length;++ft<kt;){var fr=Pe(Se[ft]);fr!==r&&(ke=ke===r?fr:ke+fr)}return ke}i(Jd,"baseSum"),o(Jd,"baseSum");function Zd(Se,Pe){for(var ke=-1,ft=Array(Se);++ke<Se;)ft[ke]=Pe(ke);return ft}i(Zd,"baseTimes"),o(Zd,"baseTimes");function i3(Se,Pe){return Mr(Pe,function(ke){return[ke,Se[ke]]})}i(i3,"baseToPairs"),o(i3,"baseToPairs");function l1(Se){return Se&&Se.slice(0,p1(Se)+1).replace(et,"")}i(l1,"baseTrim"),o(l1,"baseTrim");function jn(Se){return function(Pe){return Se(Pe)}}i(jn,"baseUnary"),o(jn,"baseUnary");function Yd(Se,Pe){return Mr(Pe,function(ke){return Se[ke]})}i(Yd,"baseValues"),o(Yd,"baseValues");function Gc(Se,Pe){return Se.has(Pe)}i(Gc,"cacheHas"),o(Gc,"cacheHas");function f1(Se,Pe){for(var ke=-1,ft=Se.length;++ke<ft&&Ns(Pe,Se[ke],0)>-1;);return ke}i(f1,"charsStartIndex"),o(f1,"charsStartIndex");function d1(Se,Pe){for(var ke=Se.length;ke--&&Ns(Pe,Se[ke],0)>-1;);return ke}i(d1,"charsEndIndex"),o(d1,"charsEndIndex");function a3(Se,Pe){for(var ke=Se.length,ft=0;ke--;)Se[ke]===Pe&&++ft;return ft}i(a3,"countHolders"),o(a3,"countHolders");var fD=Wd(de),dD=Wd(Me);function o3(Se){return"\\"+ht[Se]}i(o3,"escapeStringChar"),o(o3,"escapeStringChar");function s3(Se,Pe){return Se==null?r:Se[Pe]}i(s3,"getValue"),o(s3,"getValue");function Ps(Se){return zd.test(Se)}i(Ps,"hasUnicode"),o(Ps,"hasUnicode");function c3(Se){return Rs.test(Se)}i(c3,"hasUnicodeWord"),o(c3,"hasUnicodeWord");function u3(Se){for(var Pe,ke=[];!(Pe=Se.next()).done;)ke.push(Pe.value);return ke}i(u3,"iteratorToArray"),o(u3,"iteratorToArray");function Xd(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft,kt){ke[++Pe]=[kt,ft]}),ke}i(Xd,"mapToArray"),o(Xd,"mapToArray");function h1(Se,Pe){return function(ke){return Se(Pe(ke))}}i(h1,"overArg"),o(h1,"overArg");function oo(Se,Pe){for(var ke=-1,ft=Se.length,kt=0,fr=[];++ke<ft;){var Wr=Se[ke];(Wr===Pe||Wr===g)&&(Se[ke]=g,fr[kt++]=ke)}return fr}i(oo,"replaceHolders"),o(oo,"replaceHolders");function Fl(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Pe]=ft}),ke}i(Fl,"setToArray"),o(Fl,"setToArray");function l3(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Pe]=[ft,ft]}),ke}i(l3,"setToPairs"),o(l3,"setToPairs");function f3(Se,Pe,ke){for(var ft=ke-1,kt=Se.length;++ft<kt;)if(Se[ft]===Pe)return ft;return-1}i(f3,"strictIndexOf"),o(f3,"strictIndexOf");function d3(Se,Pe,ke){for(var ft=ke+1;ft--;)if(Se[ft]===Pe)return ft;return ft}i(d3,"strictLastIndexOf"),o(d3,"strictLastIndexOf");function Bs(Se){return Ps(Se)?h3(Se):lD(Se)}i(Bs,"stringSize"),o(Bs,"stringSize");function Oi(Se){return Ps(Se)?p3(Se):e3(Se)}i(Oi,"stringToArray"),o(Oi,"stringToArray");function p1(Se){for(var Pe=Se.length;Pe--&&sr.test(Se.charAt(Pe)););return Pe}i(p1,"trimmedEndIndex"),o(p1,"trimmedEndIndex");var hD=Wd(Le);function h3(Se){for(var Pe=Nl.lastIndex=0;Nl.test(Se);)++Pe;return Pe}i(h3,"unicodeSize"),o(h3,"unicodeSize");function p3(Se){return Se.match(Nl)||[]}i(p3,"unicodeToArray"),o(p3,"unicodeToArray");function m3(Se){return Se.match(Pl)||[]}i(m3,"unicodeWords"),o(m3,"unicodeWords");var pD=o(i(function Se(Pe){Pe=Pe==null?Fr:Bo.defaults(Fr.Object(),Pe,Bo.pick(Fr,Hd));var ke=Pe.Array,ft=Pe.Date,kt=Pe.Error,fr=Pe.Function,Wr=Pe.Math,_r=Pe.Object,m1=Pe.RegExp,mD=Pe.String,Ni=Pe.TypeError,Qd=ke.prototype,gD=fr.prototype,Wc=_r.prototype,eh=Pe["__core-js_shared__"],th=gD.toString,yr=Wc.hasOwnProperty,vD=0,g3=function(){var u=/[^.]+$/.exec(eh&&eh.keys&&eh.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),rh=Wc.toString,yD=th.call(_r),bD=Fr._,wD=m1("^"+th.call(yr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nh=Bl?Pe.Buffer:r,Lo=Pe.Symbol,ih=Pe.Uint8Array,v3=nh?nh.allocUnsafe:r,ah=h1(_r.getPrototypeOf,_r),y3=_r.create,b3=Wc.propertyIsEnumerable,oh=Qd.splice,w3=Lo?Lo.isConcatSpreadable:r,jl=Lo?Lo.iterator:r,Ls=Lo?Lo.toStringTag:r,sh=function(){try{var u=Ho(_r,"defineProperty");return u({},"",{}),u}catch{}}(),_D=Pe.clearTimeout!==Fr.clearTimeout&&Pe.clearTimeout,ED=ft&&ft.now!==Fr.Date.now&&ft.now,AD=Pe.setTimeout!==Fr.setTimeout&&Pe.setTimeout,ch=Wr.ceil,uh=Wr.floor,g1=_r.getOwnPropertySymbols,SD=nh?nh.isBuffer:r,_3=Pe.isFinite,xD=Qd.join,TD=h1(_r.keys,_r),Jr=Wr.max,vn=Wr.min,CD=ft.now,MD=Pe.parseInt,E3=Wr.random,ID=Qd.reverse,v1=Ho(Pe,"DataView"),$l=Ho(Pe,"Map"),y1=Ho(Pe,"Promise"),Jc=Ho(Pe,"Set"),zl=Ho(Pe,"WeakMap"),Hl=Ho(_r,"create"),lh=zl&&new zl,Zc={},kD=qo(v1),DD=qo($l),RD=qo(y1),OD=qo(Jc),ND=qo(zl),fh=Lo?Lo.prototype:r,ql=fh?fh.valueOf:r,A3=fh?fh.toString:r;function se(u){if(Rr(u)&&!Nt(u)&&!(u instanceof Kt)){if(u instanceof ii)return u;if(yr.call(u,"__wrapped__"))return gg(u)}return new ii(u)}i(se,"lodash"),o(se,"lodash");var Yc=function(){function u(){}return i(u,"object"),o(u,"object"),function(d){if(!kr(d))return{};if(y3)return y3(d);u.prototype=d;var S=new u;return u.prototype=r,S}}();function Vl(){}i(Vl,"baseLodash"),o(Vl,"baseLodash");function ii(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=r}i(ii,"LodashWrapper"),o(ii,"LodashWrapper"),se.templateSettings={escape:lr,evaluate:lt,interpolate:nt,variable:"",imports:{_:se}},se.prototype=Vl.prototype,se.prototype.constructor=se,ii.prototype=Yc(Vl.prototype),ii.prototype.constructor=ii;function Kt(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=A,this.__views__=[]}i(Kt,"LazyWrapper"),o(Kt,"LazyWrapper");function S3(){var u=new Kt(this.__wrapped__);return u.__actions__=In(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=In(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=In(this.__views__),u}i(S3,"lazyClone"),o(S3,"lazyClone");function x3(){if(this.__filtered__){var u=new Kt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(x3,"lazyReverse"),o(x3,"lazyReverse");function T3(){var u=this.__wrapped__.value(),d=this.__dir__,S=Nt(u),$=d<0,te=S?u.length:0,ce=j5(0,te,this.__views__),ye=ce.start,Ee=ce.end,xe=Ee-ye,Ue=$?Ee:ye-1,Fe=this.__iteratees__,$e=Fe.length,Ye=0,pt=vn(xe,this.__takeCount__);if(!S||!$&&te==xe&&pt==xe)return j1(u,this.__actions__);var St=[];e:for(;xe--&&Ye<pt;){Ue+=d;for(var Lt=-1,_t=u[Ue];++Lt<$e;){var Ht=Fe[Lt],Gt=Ht.iteratee,Hn=Ht.type,_n=Gt(_t);if(Hn==b)_t=_n;else if(!_n){if(Hn==T)continue e;break e}}St[Ye++]=_t}return St}i(T3,"lazyValue"),o(T3,"lazyValue"),Kt.prototype=Yc(Vl.prototype),Kt.prototype.constructor=Kt;function Uo(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(Uo,"Hash"),o(Uo,"Hash");function C3(){this.__data__=Hl?Hl(null):{},this.size=0}i(C3,"hashClear"),o(C3,"hashClear");function M3(u){var d=this.has(u)&&delete this.__data__[u];return this.size-=d?1:0,d}i(M3,"hashDelete"),o(M3,"hashDelete");function I3(u){var d=this.__data__;if(Hl){var S=d[u];return S===h?r:S}return yr.call(d,u)?d[u]:r}i(I3,"hashGet"),o(I3,"hashGet");function k3(u){var d=this.__data__;return Hl?d[u]!==r:yr.call(d,u)}i(k3,"hashHas"),o(k3,"hashHas");function D3(u,d){var S=this.__data__;return this.size+=this.has(u)?0:1,S[u]=Hl&&d===r?h:d,this}i(D3,"hashSet"),o(D3,"hashSet"),Uo.prototype.clear=C3,Uo.prototype.delete=M3,Uo.prototype.get=I3,Uo.prototype.has=k3,Uo.prototype.set=D3;function Aa(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(Aa,"ListCache"),o(Aa,"ListCache");function R3(){this.__data__=[],this.size=0}i(R3,"listCacheClear"),o(R3,"listCacheClear");function O3(u){var d=this.__data__,S=Kl(d,u);if(S<0)return!1;var $=d.length-1;return S==$?d.pop():oh.call(d,S,1),--this.size,!0}i(O3,"listCacheDelete"),o(O3,"listCacheDelete");function N3(u){var d=this.__data__,S=Kl(d,u);return S<0?r:d[S][1]}i(N3,"listCacheGet"),o(N3,"listCacheGet");function P3(u){return Kl(this.__data__,u)>-1}i(P3,"listCacheHas"),o(P3,"listCacheHas");function B3(u,d){var S=this.__data__,$=Kl(S,u);return $<0?(++this.size,S.push([u,d])):S[$][1]=d,this}i(B3,"listCacheSet"),o(B3,"listCacheSet"),Aa.prototype.clear=R3,Aa.prototype.delete=O3,Aa.prototype.get=N3,Aa.prototype.has=P3,Aa.prototype.set=B3;function Sa(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(Sa,"MapCache"),o(Sa,"MapCache");function L3(){this.size=0,this.__data__={hash:new Uo,map:new($l||Aa),string:new Uo}}i(L3,"mapCacheClear"),o(L3,"mapCacheClear");function U3(u){var d=af(this,u).delete(u);return this.size-=d?1:0,d}i(U3,"mapCacheDelete"),o(U3,"mapCacheDelete");function F3(u){return af(this,u).get(u)}i(F3,"mapCacheGet"),o(F3,"mapCacheGet");function j3(u){return af(this,u).has(u)}i(j3,"mapCacheHas"),o(j3,"mapCacheHas");function $3(u,d){var S=af(this,u),$=S.size;return S.set(u,d),this.size+=S.size==$?0:1,this}i($3,"mapCacheSet"),o($3,"mapCacheSet"),Sa.prototype.clear=L3,Sa.prototype.delete=U3,Sa.prototype.get=F3,Sa.prototype.has=j3,Sa.prototype.set=$3;function Fo(u){var d=-1,S=u==null?0:u.length;for(this.__data__=new Sa;++d<S;)this.add(u[d])}i(Fo,"SetCache"),o(Fo,"SetCache");function z3(u){return this.__data__.set(u,h),this}i(z3,"setCacheAdd"),o(z3,"setCacheAdd");function H3(u){return this.__data__.has(u)}i(H3,"setCacheHas"),o(H3,"setCacheHas"),Fo.prototype.add=Fo.prototype.push=z3,Fo.prototype.has=H3;function Pi(u){var d=this.__data__=new Aa(u);this.size=d.size}i(Pi,"Stack"),o(Pi,"Stack");function q3(){this.__data__=new Aa,this.size=0}i(q3,"stackClear"),o(q3,"stackClear");function V3(u){var d=this.__data__,S=d.delete(u);return this.size=d.size,S}i(V3,"stackDelete"),o(V3,"stackDelete");function K3(u){return this.__data__.get(u)}i(K3,"stackGet"),o(K3,"stackGet");function G3(u){return this.__data__.has(u)}i(G3,"stackHas"),o(G3,"stackHas");function W3(u,d){var S=this.__data__;if(S instanceof Aa){var $=S.__data__;if(!$l||$.length<a-1)return $.push([u,d]),this.size=++S.size,this;S=this.__data__=new Sa($)}return S.set(u,d),this.size=S.size,this}i(W3,"stackSet"),o(W3,"stackSet"),Pi.prototype.clear=q3,Pi.prototype.delete=V3,Pi.prototype.get=K3,Pi.prototype.has=G3,Pi.prototype.set=W3;function b1(u,d){var S=Nt(u),$=!S&&$s(u),te=!S&&!$&&Vo(u),ce=!S&&!$&&!te&&ou(u),ye=S||$||te||ce,Ee=ye?Zd(u.length,mD):[],xe=Ee.length;for(var Ue in u)(d||yr.call(u,Ue))&&!(ye&&(Ue=="length"||te&&(Ue=="offset"||Ue=="parent")||ce&&(Ue=="buffer"||Ue=="byteLength"||Ue=="byteOffset")||Ma(Ue,xe)))&&Ee.push(Ue);return Ee}i(b1,"arrayLikeKeys"),o(b1,"arrayLikeKeys");function w1(u){var d=u.length;return d?u[_h(0,d-1)]:r}i(w1,"arraySample"),o(w1,"arraySample");function J3(u,d){return sf(In(u),jo(d,0,u.length))}i(J3,"arraySampleSize"),o(J3,"arraySampleSize");function Z3(u){return sf(In(u))}i(Z3,"arrayShuffle"),o(Z3,"arrayShuffle");function dh(u,d,S){(S!==r&&!Bi(u[d],S)||S===r&&!(d in u))&&xa(u,d,S)}i(dh,"assignMergeValue"),o(dh,"assignMergeValue");function Xc(u,d,S){var $=u[d];(!(yr.call(u,d)&&Bi($,S))||S===r&&!(d in u))&&xa(u,d,S)}i(Xc,"assignValue"),o(Xc,"assignValue");function Kl(u,d){for(var S=u.length;S--;)if(Bi(u[S][0],d))return S;return-1}i(Kl,"assocIndexOf"),o(Kl,"assocIndexOf");function Y3(u,d,S,$){return $o(u,function(te,ce,ye){d($,te,S(te),ye)}),$}i(Y3,"baseAggregator"),o(Y3,"baseAggregator");function _1(u,d){return u&&Xi(d,Zr(d),u)}i(_1,"baseAssign"),o(_1,"baseAssign");function X3(u,d){return u&&Xi(d,Dn(d),u)}i(X3,"baseAssignIn"),o(X3,"baseAssignIn");function xa(u,d,S){d=="__proto__"&&sh?sh(u,d,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[d]=S}i(xa,"baseAssignValue"),o(xa,"baseAssignValue");function hh(u,d){for(var S=-1,$=d.length,te=ke($),ce=u==null;++S<$;)te[S]=ce?r:zh(u,d[S]);return te}i(hh,"baseAt"),o(hh,"baseAt");function jo(u,d,S){return u===u&&(S!==r&&(u=u<=S?u:S),d!==r&&(u=u>=d?u:d)),u}i(jo,"baseClamp"),o(jo,"baseClamp");function ai(u,d,S,$,te,ce){var ye,Ee=d&v,xe=d&y,Ue=d&_;if(S&&(ye=te?S(u,$,te,ce):S(u)),ye!==r)return ye;if(!kr(u))return u;var Fe=Nt(u);if(Fe){if(ye=z5(u),!Ee)return In(u,ye)}else{var $e=bn(u),Ye=$e==ae||$e==fe;if(Vo(u))return z1(u,Ee);if($e==N||$e==U||Ye&&!te){if(ye=xe||Ye?{}:cg(u),!Ee)return xe?D5(u,X3(ye,u)):k5(u,_1(ye,u))}else{if(!vr[$e])return te?u:{};ye=H5(u,$e,Ee)}}ce||(ce=new Pi);var pt=ce.get(u);if(pt)return pt;ce.set(u,ye),F4(u)?u.forEach(function(_t){ye.add(ai(_t,d,S,_t,u,ce))}):D4(u)&&u.forEach(function(_t,Ht){ye.set(Ht,ai(_t,d,S,Ht,u,ce))});var St=Ue?xe?Rh:Dh:xe?Dn:Zr,Lt=Fe?r:St(u);return ni(Lt||u,function(_t,Ht){Lt&&(Ht=_t,_t=u[Ht]),Xc(ye,Ht,ai(_t,d,S,Ht,u,ce))}),ye}i(ai,"baseClone"),o(ai,"baseClone");function Q3(u){var d=Zr(u);return function(S){return E1(S,u,d)}}i(Q3,"baseConforms"),o(Q3,"baseConforms");function E1(u,d,S){var $=S.length;if(u==null)return!$;for(u=_r(u);$--;){var te=S[$],ce=d[te],ye=u[te];if(ye===r&&!(te in u)||!ce(ye))return!1}return!0}i(E1,"baseConformsTo"),o(E1,"baseConformsTo");function A1(u,d,S){if(typeof u!="function")throw new Ni(c);return of(function(){u.apply(r,S)},d)}i(A1,"baseDelay"),o(A1,"baseDelay");function Qc(u,d,S,$){var te=-1,ce=Ll,ye=!0,Ee=u.length,xe=[],Ue=d.length;if(!Ee)return xe;S&&(d=Mr(d,jn(S))),$?(ce=qd,ye=!1):d.length>=a&&(ce=Gc,ye=!1,d=new Fo(d));e:for(;++te<Ee;){var Fe=u[te],$e=S==null?Fe:S(Fe);if(Fe=$||Fe!==0?Fe:0,ye&&$e===$e){for(var Ye=Ue;Ye--;)if(d[Ye]===$e)continue e;xe.push(Fe)}else ce(d,$e,$)||xe.push(Fe)}return xe}i(Qc,"baseDifference"),o(Qc,"baseDifference");var $o=G1(Yi),e5=G1(ph,!0);function t5(u,d){var S=!0;return $o(u,function($,te,ce){return S=!!d($,te,ce),S}),S}i(t5,"baseEvery"),o(t5,"baseEvery");function Gl(u,d,S){for(var $=-1,te=u.length;++$<te;){var ce=u[$],ye=d(ce);if(ye!=null&&(Ee===r?ye===ye&&!zn(ye):S(ye,Ee)))var Ee=ye,xe=ce}return xe}i(Gl,"baseExtremum"),o(Gl,"baseExtremum");function r5(u,d,S,$){var te=u.length;for(S=Pt(S),S<0&&(S=-S>te?0:te+S),$=$===r||$>te?te:Pt($),$<0&&($+=te),$=S>$?0:Lg($);S<$;)u[S++]=d;return u}i(r5,"baseFill"),o(r5,"baseFill");function S1(u,d){var S=[];return $o(u,function($,te,ce){d($,te,ce)&&S.push($)}),S}i(S1,"baseFilter"),o(S1,"baseFilter");function Xr(u,d,S,$,te){var ce=-1,ye=u.length;for(S||(S=V5),te||(te=[]);++ce<ye;){var Ee=u[ce];d>0&&S(Ee)?d>1?Xr(Ee,d-1,S,$,te):ao(te,Ee):$||(te[te.length]=Ee)}return te}i(Xr,"baseFlatten"),o(Xr,"baseFlatten");var x1=W1(),n5=W1(!0);function Yi(u,d){return u&&x1(u,d,Zr)}i(Yi,"baseForOwn"),o(Yi,"baseForOwn");function ph(u,d){return u&&n5(u,d,Zr)}i(ph,"baseForOwnRight"),o(ph,"baseForOwnRight");function Wl(u,d){return io(d,function(S){return Ia(u[S])})}i(Wl,"baseFunctions"),o(Wl,"baseFunctions");function zo(u,d){d=co(d,u);for(var S=0,$=d.length;u!=null&&S<$;)u=u[Qi(d[S++])];return S&&S==$?u:r}i(zo,"baseGet"),o(zo,"baseGet");function T1(u,d,S){var $=d(u);return Nt(u)?$:ao($,S(u))}i(T1,"baseGetAllKeys"),o(T1,"baseGetAllKeys");function yn(u){return u==null?u===r?De:X:Ls&&Ls in _r(u)?U5(u):Y5(u)}i(yn,"baseGetTag"),o(yn,"baseGetTag");function mh(u,d){return u>d}i(mh,"baseGt"),o(mh,"baseGt");function i5(u,d){return u!=null&&yr.call(u,d)}i(i5,"baseHas"),o(i5,"baseHas");function a5(u,d){return u!=null&&d in _r(u)}i(a5,"baseHasIn"),o(a5,"baseHasIn");function o5(u,d,S){return u>=vn(d,S)&&u<Jr(d,S)}i(o5,"baseInRange"),o(o5,"baseInRange");function gh(u,d,S){for(var $=S?qd:Ll,te=u[0].length,ce=u.length,ye=ce,Ee=ke(ce),xe=1/0,Ue=[];ye--;){var Fe=u[ye];ye&&d&&(Fe=Mr(Fe,jn(d))),xe=vn(Fe.length,xe),Ee[ye]=!S&&(d||te>=120&&Fe.length>=120)?new Fo(ye&&Fe):r}Fe=u[0];var $e=-1,Ye=Ee[0];e:for(;++$e<te&&Ue.length<xe;){var pt=Fe[$e],St=d?d(pt):pt;if(pt=S||pt!==0?pt:0,!(Ye?Gc(Ye,St):$(Ue,St,S))){for(ye=ce;--ye;){var Lt=Ee[ye];if(!(Lt?Gc(Lt,St):$(u[ye],St,S)))continue e}Ye&&Ye.push(St),Ue.push(pt)}}return Ue}i(gh,"baseIntersection"),o(gh,"baseIntersection");function s5(u,d,S,$){return Yi(u,function(te,ce,ye){d($,S(te),ce,ye)}),$}i(s5,"baseInverter"),o(s5,"baseInverter");function eu(u,d,S){d=co(d,u),u=dg(u,d);var $=u==null?u:u[Qi(si(d))];return $==null?r:Fn($,u,S)}i(eu,"baseInvoke"),o(eu,"baseInvoke");function C1(u){return Rr(u)&&yn(u)==U}i(C1,"baseIsArguments"),o(C1,"baseIsArguments");function c5(u){return Rr(u)&&yn(u)==qe}i(c5,"baseIsArrayBuffer"),o(c5,"baseIsArrayBuffer");function u5(u){return Rr(u)&&yn(u)==oe}i(u5,"baseIsDate"),o(u5,"baseIsDate");function tu(u,d,S,$,te){return u===d?!0:u==null||d==null||!Rr(u)&&!Rr(d)?u!==u&&d!==d:l5(u,d,S,$,tu,te)}i(tu,"baseIsEqual"),o(tu,"baseIsEqual");function l5(u,d,S,$,te,ce){var ye=Nt(u),Ee=Nt(d),xe=ye?ge:bn(u),Ue=Ee?ge:bn(d);xe=xe==U?N:xe,Ue=Ue==U?N:Ue;var Fe=xe==N,$e=Ue==N,Ye=xe==Ue;if(Ye&&Vo(u)){if(!Vo(d))return!1;ye=!0,Fe=!1}if(Ye&&!Fe)return ce||(ce=new Pi),ye||ou(u)?ig(u,d,S,$,te,ce):B5(u,d,xe,S,$,te,ce);if(!(S&x)){var pt=Fe&&yr.call(u,"__wrapped__"),St=$e&&yr.call(d,"__wrapped__");if(pt||St){var Lt=pt?u.value():u,_t=St?d.value():d;return ce||(ce=new Pi),te(Lt,_t,S,$,ce)}}return Ye?(ce||(ce=new Pi),L5(u,d,S,$,te,ce)):!1}i(l5,"baseIsEqualDeep"),o(l5,"baseIsEqualDeep");function f5(u){return Rr(u)&&bn(u)==be}i(f5,"baseIsMap"),o(f5,"baseIsMap");function vh(u,d,S,$){var te=S.length,ce=te,ye=!$;if(u==null)return!ce;for(u=_r(u);te--;){var Ee=S[te];if(ye&&Ee[2]?Ee[1]!==u[Ee[0]]:!(Ee[0]in u))return!1}for(;++te<ce;){Ee=S[te];var xe=Ee[0],Ue=u[xe],Fe=Ee[1];if(ye&&Ee[2]){if(Ue===r&&!(xe in u))return!1}else{var $e=new Pi;if($)var Ye=$(Ue,Fe,xe,u,d,$e);if(!(Ye===r?tu(Fe,Ue,x|O,$,$e):Ye))return!1}}return!0}i(vh,"baseIsMatch"),o(vh,"baseIsMatch");function M1(u){if(!kr(u)||G5(u))return!1;var d=Ia(u)?wD:tr;return d.test(qo(u))}i(M1,"baseIsNative"),o(M1,"baseIsNative");function d5(u){return Rr(u)&&yn(u)==ie}i(d5,"baseIsRegExp"),o(d5,"baseIsRegExp");function h5(u){return Rr(u)&&bn(u)==ee}i(h5,"baseIsSet"),o(h5,"baseIsSet");function p5(u){return Rr(u)&&df(u.length)&&!!wr[yn(u)]}i(p5,"baseIsTypedArray"),o(p5,"baseIsTypedArray");function I1(u){return typeof u=="function"?u:u==null?Rn:typeof u=="object"?Nt(u)?R1(u[0],u[1]):D1(u):qg(u)}i(I1,"baseIteratee"),o(I1,"baseIteratee");function yh(u){if(!iu(u))return TD(u);var d=[];for(var S in _r(u))yr.call(u,S)&&S!="constructor"&&d.push(S);return d}i(yh,"baseKeys"),o(yh,"baseKeys");function m5(u){if(!kr(u))return Z5(u);var d=iu(u),S=[];for(var $ in u)$=="constructor"&&(d||!yr.call(u,$))||S.push($);return S}i(m5,"baseKeysIn"),o(m5,"baseKeysIn");function bh(u,d){return u<d}i(bh,"baseLt"),o(bh,"baseLt");function k1(u,d){var S=-1,$=kn(u)?ke(u.length):[];return $o(u,function(te,ce,ye){$[++S]=d(te,ce,ye)}),$}i(k1,"baseMap"),o(k1,"baseMap");function D1(u){var d=Oh(u);return d.length==1&&d[0][2]?lg(d[0][0],d[0][1]):function(S){return S===u||vh(S,u,d)}}i(D1,"baseMatches"),o(D1,"baseMatches");function R1(u,d){return Nh(u)&&ug(d)?lg(Qi(u),d):function(S){var $=zh(S,u);return $===r&&$===d?Hh(S,u):tu(d,$,x|O)}}i(R1,"baseMatchesProperty"),o(R1,"baseMatchesProperty");function Jl(u,d,S,$,te){u!==d&&x1(d,function(ce,ye){if(te||(te=new Pi),kr(ce))g5(u,d,ye,S,Jl,$,te);else{var Ee=$?$(Bh(u,ye),ce,ye+"",u,d,te):r;Ee===r&&(Ee=ce),dh(u,ye,Ee)}},Dn)}i(Jl,"baseMerge"),o(Jl,"baseMerge");function g5(u,d,S,$,te,ce,ye){var Ee=Bh(u,S),xe=Bh(d,S),Ue=ye.get(xe);if(Ue){dh(u,S,Ue);return}var Fe=ce?ce(Ee,xe,S+"",u,d,ye):r,$e=Fe===r;if($e){var Ye=Nt(xe),pt=!Ye&&Vo(xe),St=!Ye&&!pt&&ou(xe);Fe=xe,Ye||pt||St?Nt(Ee)?Fe=Ee:Pr(Ee)?Fe=In(Ee):pt?($e=!1,Fe=z1(xe,!0)):St?($e=!1,Fe=H1(xe,!0)):Fe=[]:au(xe)||$s(xe)?(Fe=Ee,$s(Ee)?Fe=Ug(Ee):(!kr(Ee)||Ia(Ee))&&(Fe=cg(xe))):$e=!1}$e&&(ye.set(xe,Fe),te(Fe,xe,$,ce,ye),ye.delete(xe)),dh(u,S,Fe)}i(g5,"baseMergeDeep"),o(g5,"baseMergeDeep");function O1(u,d){var S=u.length;if(!!S)return d+=d<0?S:0,Ma(d,S)?u[d]:r}i(O1,"baseNth"),o(O1,"baseNth");function N1(u,d,S){d.length?d=Mr(d,function(ce){return Nt(ce)?function(ye){return zo(ye,ce.length===1?ce[0]:ce)}:ce}):d=[Rn];var $=-1;d=Mr(d,jn(wt()));var te=k1(u,function(ce,ye,Ee){var xe=Mr(d,function(Ue){return Ue(ce)});return{criteria:xe,index:++$,value:ce}});return n3(te,function(ce,ye){return I5(ce,ye,S)})}i(N1,"baseOrderBy"),o(N1,"baseOrderBy");function v5(u,d){return P1(u,d,function(S,$){return Hh(u,$)})}i(v5,"basePick"),o(v5,"basePick");function P1(u,d,S){for(var $=-1,te=d.length,ce={};++$<te;){var ye=d[$],Ee=zo(u,ye);S(Ee,ye)&&ru(ce,co(ye,u),Ee)}return ce}i(P1,"basePickBy"),o(P1,"basePickBy");function y5(u){return function(d){return zo(d,u)}}i(y5,"basePropertyDeep"),o(y5,"basePropertyDeep");function wh(u,d,S,$){var te=$?r3:Ns,ce=-1,ye=d.length,Ee=u;for(u===d&&(d=In(d)),S&&(Ee=Mr(u,jn(S)));++ce<ye;)for(var xe=0,Ue=d[ce],Fe=S?S(Ue):Ue;(xe=te(Ee,Fe,xe,$))>-1;)Ee!==u&&oh.call(Ee,xe,1),oh.call(u,xe,1);return u}i(wh,"basePullAll"),o(wh,"basePullAll");function B1(u,d){for(var S=u?d.length:0,$=S-1;S--;){var te=d[S];if(S==$||te!==ce){var ce=te;Ma(te)?oh.call(u,te,1):Sh(u,te)}}return u}i(B1,"basePullAt"),o(B1,"basePullAt");function _h(u,d){return u+uh(E3()*(d-u+1))}i(_h,"baseRandom"),o(_h,"baseRandom");function b5(u,d,S,$){for(var te=-1,ce=Jr(ch((d-u)/(S||1)),0),ye=ke(ce);ce--;)ye[$?ce:++te]=u,u+=S;return ye}i(b5,"baseRange"),o(b5,"baseRange");function Eh(u,d){var S="";if(!u||d<1||d>E)return S;do d%2&&(S+=u),d=uh(d/2),d&&(u+=u);while(d);return S}i(Eh,"baseRepeat"),o(Eh,"baseRepeat");function Ut(u,d){return hg(fg(u,d,Rn),u+"")}i(Ut,"baseRest"),o(Ut,"baseRest");function w5(u){return w1(zs(u))}i(w5,"baseSample"),o(w5,"baseSample");function _5(u,d){var S=zs(u);return sf(S,jo(d,0,S.length))}i(_5,"baseSampleSize"),o(_5,"baseSampleSize");function ru(u,d,S,$){if(!kr(u))return u;d=co(d,u);for(var te=-1,ce=d.length,ye=ce-1,Ee=u;Ee!=null&&++te<ce;){var xe=Qi(d[te]),Ue=S;if(xe==="__proto__"||xe==="constructor"||xe==="prototype")return u;if(te!=ye){var Fe=Ee[xe];Ue=$?$(Fe,xe,Ee):r,Ue===r&&(Ue=kr(Fe)?Fe:Ma(d[te+1])?[]:{})}Xc(Ee,xe,Ue),Ee=Ee[xe]}return u}i(ru,"baseSet"),o(ru,"baseSet");var E5=lh?function(u,d){return lh.set(u,d),u}:Rn,PD=sh?function(u,d){return sh(u,"toString",{configurable:!0,enumerable:!1,value:qh(d),writable:!0})}:Rn;function A5(u){return sf(zs(u))}i(A5,"baseShuffle"),o(A5,"baseShuffle");function oi(u,d,S){var $=-1,te=u.length;d<0&&(d=-d>te?0:te+d),S=S>te?te:S,S<0&&(S+=te),te=d>S?0:S-d>>>0,d>>>=0;for(var ce=ke(te);++$<te;)ce[$]=u[$+d];return ce}i(oi,"baseSlice"),o(oi,"baseSlice");function S5(u,d){var S;return $o(u,function($,te,ce){return S=d($,te,ce),!S}),!!S}i(S5,"baseSome"),o(S5,"baseSome");function Zl(u,d,S){var $=0,te=u==null?$:u.length;if(typeof d=="number"&&d===d&&te<=V){for(;$<te;){var ce=$+te>>>1,ye=u[ce];ye!==null&&!zn(ye)&&(S?ye<=d:ye<d)?$=ce+1:te=ce}return te}return Ah(u,d,Rn,S)}i(Zl,"baseSortedIndex"),o(Zl,"baseSortedIndex");function Ah(u,d,S,$){var te=0,ce=u==null?0:u.length;if(ce===0)return 0;d=S(d);for(var ye=d!==d,Ee=d===null,xe=zn(d),Ue=d===r;te<ce;){var Fe=uh((te+ce)/2),$e=S(u[Fe]),Ye=$e!==r,pt=$e===null,St=$e===$e,Lt=zn($e);if(ye)var _t=$||St;else Ue?_t=St&&($||Ye):Ee?_t=St&&Ye&&($||!pt):xe?_t=St&&Ye&&!pt&&($||!Lt):pt||Lt?_t=!1:_t=$?$e<=d:$e<d;_t?te=Fe+1:ce=Fe}return vn(ce,B)}i(Ah,"baseSortedIndexBy"),o(Ah,"baseSortedIndexBy");function L1(u,d){for(var S=-1,$=u.length,te=0,ce=[];++S<$;){var ye=u[S],Ee=d?d(ye):ye;if(!S||!Bi(Ee,xe)){var xe=Ee;ce[te++]=ye===0?0:ye}}return ce}i(L1,"baseSortedUniq"),o(L1,"baseSortedUniq");function U1(u){return typeof u=="number"?u:zn(u)?C:+u}i(U1,"baseToNumber"),o(U1,"baseToNumber");function $n(u){if(typeof u=="string")return u;if(Nt(u))return Mr(u,$n)+"";if(zn(u))return A3?A3.call(u):"";var d=u+"";return d=="0"&&1/u==-m?"-0":d}i($n,"baseToString"),o($n,"baseToString");function so(u,d,S){var $=-1,te=Ll,ce=u.length,ye=!0,Ee=[],xe=Ee;if(S)ye=!1,te=qd;else if(ce>=a){var Ue=d?null:LD(u);if(Ue)return Fl(Ue);ye=!1,te=Gc,xe=new Fo}else xe=d?[]:Ee;e:for(;++$<ce;){var Fe=u[$],$e=d?d(Fe):Fe;if(Fe=S||Fe!==0?Fe:0,ye&&$e===$e){for(var Ye=xe.length;Ye--;)if(xe[Ye]===$e)continue e;d&&xe.push($e),Ee.push(Fe)}else te(xe,$e,S)||(xe!==Ee&&xe.push($e),Ee.push(Fe))}return Ee}i(so,"baseUniq"),o(so,"baseUniq");function Sh(u,d){return d=co(d,u),u=dg(u,d),u==null||delete u[Qi(si(d))]}i(Sh,"baseUnset"),o(Sh,"baseUnset");function F1(u,d,S,$){return ru(u,d,S(zo(u,d)),$)}i(F1,"baseUpdate"),o(F1,"baseUpdate");function Yl(u,d,S,$){for(var te=u.length,ce=$?te:-1;($?ce--:++ce<te)&&d(u[ce],ce,u););return S?oi(u,$?0:ce,$?ce+1:te):oi(u,$?ce+1:0,$?te:ce)}i(Yl,"baseWhile"),o(Yl,"baseWhile");function j1(u,d){var S=u;return S instanceof Kt&&(S=S.value()),Vd(d,function($,te){return te.func.apply(te.thisArg,ao([$],te.args))},S)}i(j1,"baseWrapperValue"),o(j1,"baseWrapperValue");function xh(u,d,S){var $=u.length;if($<2)return $?so(u[0]):[];for(var te=-1,ce=ke($);++te<$;)for(var ye=u[te],Ee=-1;++Ee<$;)Ee!=te&&(ce[te]=Qc(ce[te]||ye,u[Ee],d,S));return so(Xr(ce,1),d,S)}i(xh,"baseXor"),o(xh,"baseXor");function $1(u,d,S){for(var $=-1,te=u.length,ce=d.length,ye={};++$<te;){var Ee=$<ce?d[$]:r;S(ye,u[$],Ee)}return ye}i($1,"baseZipObject"),o($1,"baseZipObject");function Th(u){return Pr(u)?u:[]}i(Th,"castArrayLikeObject"),o(Th,"castArrayLikeObject");function Ch(u){return typeof u=="function"?u:Rn}i(Ch,"castFunction"),o(Ch,"castFunction");function co(u,d){return Nt(u)?u:Nh(u,d)?[u]:ew(dr(u))}i(co,"castPath"),o(co,"castPath");var BD=Ut;function uo(u,d,S){var $=u.length;return S=S===r?$:S,!d&&S>=$?u:oi(u,d,S)}i(uo,"castSlice"),o(uo,"castSlice");var x5=_D||function(u){return Fr.clearTimeout(u)};function z1(u,d){if(d)return u.slice();var S=u.length,$=v3?v3(S):new u.constructor(S);return u.copy($),$}i(z1,"cloneBuffer"),o(z1,"cloneBuffer");function Mh(u){var d=new u.constructor(u.byteLength);return new ih(d).set(new ih(u)),d}i(Mh,"cloneArrayBuffer"),o(Mh,"cloneArrayBuffer");function T5(u,d){var S=d?Mh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.byteLength)}i(T5,"cloneDataView"),o(T5,"cloneDataView");function C5(u){var d=new u.constructor(u.source,yt.exec(u));return d.lastIndex=u.lastIndex,d}i(C5,"cloneRegExp"),o(C5,"cloneRegExp");function M5(u){return ql?_r(ql.call(u)):{}}i(M5,"cloneSymbol"),o(M5,"cloneSymbol");function H1(u,d){var S=d?Mh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.length)}i(H1,"cloneTypedArray"),o(H1,"cloneTypedArray");function q1(u,d){if(u!==d){var S=u!==r,$=u===null,te=u===u,ce=zn(u),ye=d!==r,Ee=d===null,xe=d===d,Ue=zn(d);if(!Ee&&!Ue&&!ce&&u>d||ce&&ye&&xe&&!Ee&&!Ue||$&&ye&&xe||!S&&xe||!te)return 1;if(!$&&!ce&&!Ue&&u<d||Ue&&S&&te&&!$&&!ce||Ee&&S&&te||!ye&&te||!xe)return-1}return 0}i(q1,"compareAscending"),o(q1,"compareAscending");function I5(u,d,S){for(var $=-1,te=u.criteria,ce=d.criteria,ye=te.length,Ee=S.length;++$<ye;){var xe=q1(te[$],ce[$]);if(xe){if($>=Ee)return xe;var Ue=S[$];return xe*(Ue=="desc"?-1:1)}}return u.index-d.index}i(I5,"compareMultiple"),o(I5,"compareMultiple");function V1(u,d,S,$){for(var te=-1,ce=u.length,ye=S.length,Ee=-1,xe=d.length,Ue=Jr(ce-ye,0),Fe=ke(xe+Ue),$e=!$;++Ee<xe;)Fe[Ee]=d[Ee];for(;++te<ye;)($e||te<ce)&&(Fe[S[te]]=u[te]);for(;Ue--;)Fe[Ee++]=u[te++];return Fe}i(V1,"composeArgs"),o(V1,"composeArgs");function K1(u,d,S,$){for(var te=-1,ce=u.length,ye=-1,Ee=S.length,xe=-1,Ue=d.length,Fe=Jr(ce-Ee,0),$e=ke(Fe+Ue),Ye=!$;++te<Fe;)$e[te]=u[te];for(var pt=te;++xe<Ue;)$e[pt+xe]=d[xe];for(;++ye<Ee;)(Ye||te<ce)&&($e[pt+S[ye]]=u[te++]);return $e}i(K1,"composeArgsRight"),o(K1,"composeArgsRight");function In(u,d){var S=-1,$=u.length;for(d||(d=ke($));++S<$;)d[S]=u[S];return d}i(In,"copyArray"),o(In,"copyArray");function Xi(u,d,S,$){var te=!S;S||(S={});for(var ce=-1,ye=d.length;++ce<ye;){var Ee=d[ce],xe=$?$(S[Ee],u[Ee],Ee,S,u):r;xe===r&&(xe=u[Ee]),te?xa(S,Ee,xe):Xc(S,Ee,xe)}return S}i(Xi,"copyObject"),o(Xi,"copyObject");function k5(u,d){return Xi(u,og(u),d)}i(k5,"copySymbols"),o(k5,"copySymbols");function D5(u,d){return Xi(u,F5(u),d)}i(D5,"copySymbolsIn"),o(D5,"copySymbolsIn");function Xl(u,d){return function(S,$){var te=Nt(S)?Y2:Y3,ce=d?d():{};return te(S,u,wt($,2),ce)}}i(Xl,"createAggregator"),o(Xl,"createAggregator");function Us(u){return Ut(function(d,S){var $=-1,te=S.length,ce=te>1?S[te-1]:r,ye=te>2?S[2]:r;for(ce=u.length>3&&typeof ce=="function"?(te--,ce):r,ye&&wn(S[0],S[1],ye)&&(ce=te<3?r:ce,te=1),d=_r(d);++$<te;){var Ee=S[$];Ee&&u(d,Ee,$,ce)}return d})}i(Us,"createAssigner"),o(Us,"createAssigner");function G1(u,d){return function(S,$){if(S==null)return S;if(!kn(S))return u(S,$);for(var te=S.length,ce=d?te:-1,ye=_r(S);(d?ce--:++ce<te)&&$(ye[ce],ce,ye)!==!1;);return S}}i(G1,"createBaseEach"),o(G1,"createBaseEach");function W1(u){return function(d,S,$){for(var te=-1,ce=_r(d),ye=$(d),Ee=ye.length;Ee--;){var xe=ye[u?Ee:++te];if(S(ce[xe],xe,ce)===!1)break}return d}}i(W1,"createBaseFor"),o(W1,"createBaseFor");function R5(u,d,S){var $=d&D,te=nu(u);function ce(){var ye=this&&this!==Fr&&this instanceof ce?te:u;return ye.apply($?S:this,arguments)}return i(ce,"wrapper"),o(ce,"wrapper"),ce}i(R5,"createBind"),o(R5,"createBind");function J1(u){return function(d){d=dr(d);var S=Ps(d)?Oi(d):r,$=S?S[0]:d.charAt(0),te=S?uo(S,1).join(""):d.slice(1);return $[u]()+te}}i(J1,"createCaseFirst"),o(J1,"createCaseFirst");function Fs(u){return function(d){return Vd(Hg($g(d).replace(Ol,"")),u,"")}}i(Fs,"createCompounder"),o(Fs,"createCompounder");function nu(u){return function(){var d=arguments;switch(d.length){case 0:return new u;case 1:return new u(d[0]);case 2:return new u(d[0],d[1]);case 3:return new u(d[0],d[1],d[2]);case 4:return new u(d[0],d[1],d[2],d[3]);case 5:return new u(d[0],d[1],d[2],d[3],d[4]);case 6:return new u(d[0],d[1],d[2],d[3],d[4],d[5]);case 7:return new u(d[0],d[1],d[2],d[3],d[4],d[5],d[6])}var S=Yc(u.prototype),$=u.apply(S,d);return kr($)?$:S}}i(nu,"createCtor"),o(nu,"createCtor");function O5(u,d,S){var $=nu(u);function te(){for(var ce=arguments.length,ye=ke(ce),Ee=ce,xe=js(te);Ee--;)ye[Ee]=arguments[Ee];var Ue=ce<3&&ye[0]!==xe&&ye[ce-1]!==xe?[]:oo(ye,xe);if(ce-=Ue.length,ce<S)return eg(u,d,Ql,te.placeholder,r,ye,Ue,r,r,S-ce);var Fe=this&&this!==Fr&&this instanceof te?$:u;return Fn(Fe,this,ye)}return i(te,"wrapper"),o(te,"wrapper"),te}i(O5,"createCurry"),o(O5,"createCurry");function Z1(u){return function(d,S,$){var te=_r(d);if(!kn(d)){var ce=wt(S,3);d=Zr(d),S=o(function(Ee){return ce(te[Ee],Ee,te)},"predicate")}var ye=u(d,S,$);return ye>-1?te[ce?d[ye]:ye]:r}}i(Z1,"createFind"),o(Z1,"createFind");function Y1(u){return Ca(function(d){var S=d.length,$=S,te=ii.prototype.thru;for(u&&d.reverse();$--;){var ce=d[$];if(typeof ce!="function")throw new Ni(c);if(te&&!ye&&nf(ce)=="wrapper")var ye=new ii([],!0)}for($=ye?$:S;++$<S;){ce=d[$];var Ee=nf(ce),xe=Ee=="wrapper"?ag(ce):r;xe&&Ph(xe[0])&&xe[1]==(k|j|Q|K)&&!xe[4].length&&xe[9]==1?ye=ye[nf(xe[0])].apply(ye,xe[3]):ye=ce.length==1&&Ph(ce)?ye[Ee]():ye.thru(ce)}return function(){var Ue=arguments,Fe=Ue[0];if(ye&&Ue.length==1&&Nt(Fe))return ye.plant(Fe).value();for(var $e=0,Ye=S?d[$e].apply(this,Ue):Fe;++$e<S;)Ye=d[$e].call(this,Ye);return Ye}})}i(Y1,"createFlow"),o(Y1,"createFlow");function Ql(u,d,S,$,te,ce,ye,Ee,xe,Ue){var Fe=d&k,$e=d&D,Ye=d&P,pt=d&(j|q),St=d&he,Lt=Ye?r:nu(u);function _t(){for(var Ht=arguments.length,Gt=ke(Ht),Hn=Ht;Hn--;)Gt[Hn]=arguments[Hn];if(pt)var _n=js(_t),qn=a3(Gt,_n);if($&&(Gt=V1(Gt,$,te,pt)),ce&&(Gt=K1(Gt,ce,ye,pt)),Ht-=qn,pt&&Ht<Ue){var jr=oo(Gt,_n);return eg(u,d,Ql,_t.placeholder,S,Gt,jr,Ee,xe,Ue-Ht)}var ea=$e?S:this,lo=Ye?ea[u]:u;return Ht=Gt.length,Ee?Gt=X5(Gt,Ee):St&&Ht>1&&Gt.reverse(),Fe&&xe<Ht&&(Gt.length=xe),this&&this!==Fr&&this instanceof _t&&(lo=Lt||nu(lo)),lo.apply(ea,Gt)}return i(_t,"wrapper"),o(_t,"wrapper"),_t}i(Ql,"createHybrid"),o(Ql,"createHybrid");function X1(u,d){return function(S,$){return s5(S,u,d($),{})}}i(X1,"createInverter"),o(X1,"createInverter");function ef(u,d){return function(S,$){var te;if(S===r&&$===r)return d;if(S!==r&&(te=S),$!==r){if(te===r)return $;typeof S=="string"||typeof $=="string"?(S=$n(S),$=$n($)):(S=U1(S),$=U1($)),te=u(S,$)}return te}}i(ef,"createMathOperation"),o(ef,"createMathOperation");function Ih(u){return Ca(function(d){return d=Mr(d,jn(wt())),Ut(function(S){var $=this;return u(d,function(te){return Fn(te,$,S)})})})}i(Ih,"createOver"),o(Ih,"createOver");function tf(u,d){d=d===r?" ":$n(d);var S=d.length;if(S<2)return S?Eh(d,u):d;var $=Eh(d,ch(u/Bs(d)));return Ps(d)?uo(Oi($),0,u).join(""):$.slice(0,u)}i(tf,"createPadding"),o(tf,"createPadding");function N5(u,d,S,$){var te=d&D,ce=nu(u);function ye(){for(var Ee=-1,xe=arguments.length,Ue=-1,Fe=$.length,$e=ke(Fe+xe),Ye=this&&this!==Fr&&this instanceof ye?ce:u;++Ue<Fe;)$e[Ue]=$[Ue];for(;xe--;)$e[Ue++]=arguments[++Ee];return Fn(Ye,te?S:this,$e)}return i(ye,"wrapper"),o(ye,"wrapper"),ye}i(N5,"createPartial"),o(N5,"createPartial");function Q1(u){return function(d,S,$){return $&&typeof $!="number"&&wn(d,S,$)&&(S=$=r),d=ka(d),S===r?(S=d,d=0):S=ka(S),$=$===r?d<S?1:-1:ka($),b5(d,S,$,u)}}i(Q1,"createRange"),o(Q1,"createRange");function rf(u){return function(d,S){return typeof d=="string"&&typeof S=="string"||(d=ci(d),S=ci(S)),u(d,S)}}i(rf,"createRelationalOperation"),o(rf,"createRelationalOperation");function eg(u,d,S,$,te,ce,ye,Ee,xe,Ue){var Fe=d&j,$e=Fe?ye:r,Ye=Fe?r:ye,pt=Fe?ce:r,St=Fe?r:ce;d|=Fe?Q:Y,d&=~(Fe?Y:Q),d&J||(d&=~(D|P));var Lt=[u,d,te,pt,$e,St,Ye,Ee,xe,Ue],_t=S.apply(r,Lt);return Ph(u)&&Q5(_t,Lt),_t.placeholder=$,pg(_t,u,d)}i(eg,"createRecurry"),o(eg,"createRecurry");function kh(u){var d=Wr[u];return function(S,$){if(S=ci(S),$=$==null?0:vn(Pt($),292),$&&_3(S)){var te=(dr(S)+"e").split("e"),ce=d(te[0]+"e"+(+te[1]+$));return te=(dr(ce)+"e").split("e"),+(te[0]+"e"+(+te[1]-$))}return d(S)}}i(kh,"createRound"),o(kh,"createRound");var LD=Jc&&1/Fl(new Jc([,-0]))[1]==m?function(u){return new Jc(u)}:Gh;function tg(u){return function(d){var S=bn(d);return S==be?Xd(d):S==ee?l3(d):i3(d,u(d))}}i(tg,"createToPairs"),o(tg,"createToPairs");function Ta(u,d,S,$,te,ce,ye,Ee){var xe=d&P;if(!xe&&typeof u!="function")throw new Ni(c);var Ue=$?$.length:0;if(Ue||(d&=~(Q|Y),$=te=r),ye=ye===r?ye:Jr(Pt(ye),0),Ee=Ee===r?Ee:Pt(Ee),Ue-=te?te.length:0,d&Y){var Fe=$,$e=te;$=te=r}var Ye=xe?r:ag(u),pt=[u,d,S,$,te,Fe,$e,ce,ye,Ee];if(Ye&&J5(pt,Ye),u=pt[0],d=pt[1],S=pt[2],$=pt[3],te=pt[4],Ee=pt[9]=pt[9]===r?xe?0:u.length:Jr(pt[9]-Ue,0),!Ee&&d&(j|q)&&(d&=~(j|q)),!d||d==D)var St=R5(u,d,S);else d==j||d==q?St=O5(u,d,Ee):(d==Q||d==(D|Q))&&!te.length?St=N5(u,d,S,$):St=Ql.apply(r,pt);var Lt=Ye?E5:Q5;return pg(Lt(St,pt),u,d)}i(Ta,"createWrap"),o(Ta,"createWrap");function rg(u,d,S,$){return u===r||Bi(u,Wc[S])&&!yr.call($,S)?d:u}i(rg,"customDefaultsAssignIn"),o(rg,"customDefaultsAssignIn");function ng(u,d,S,$,te,ce){return kr(u)&&kr(d)&&(ce.set(d,u),Jl(u,d,r,ng,ce),ce.delete(d)),u}i(ng,"customDefaultsMerge"),o(ng,"customDefaultsMerge");function P5(u){return au(u)?r:u}i(P5,"customOmitClone"),o(P5,"customOmitClone");function ig(u,d,S,$,te,ce){var ye=S&x,Ee=u.length,xe=d.length;if(Ee!=xe&&!(ye&&xe>Ee))return!1;var Ue=ce.get(u),Fe=ce.get(d);if(Ue&&Fe)return Ue==d&&Fe==u;var $e=-1,Ye=!0,pt=S&O?new Fo:r;for(ce.set(u,d),ce.set(d,u);++$e<Ee;){var St=u[$e],Lt=d[$e];if($)var _t=ye?$(Lt,St,$e,d,u,ce):$(St,Lt,$e,u,d,ce);if(_t!==r){if(_t)continue;Ye=!1;break}if(pt){if(!Kd(d,function(Ht,Gt){if(!Gc(pt,Gt)&&(St===Ht||te(St,Ht,S,$,ce)))return pt.push(Gt)})){Ye=!1;break}}else if(!(St===Lt||te(St,Lt,S,$,ce))){Ye=!1;break}}return ce.delete(u),ce.delete(d),Ye}i(ig,"equalArrays"),o(ig,"equalArrays");function B5(u,d,S,$,te,ce,ye){switch(S){case ve:if(u.byteLength!=d.byteLength||u.byteOffset!=d.byteOffset)return!1;u=u.buffer,d=d.buffer;case qe:return!(u.byteLength!=d.byteLength||!ce(new ih(u),new ih(d)));case ne:case oe:case Re:return Bi(+u,+d);case G:return u.name==d.name&&u.message==d.message;case ie:case ue:return u==d+"";case be:var Ee=Xd;case ee:var xe=$&x;if(Ee||(Ee=Fl),u.size!=d.size&&!xe)return!1;var Ue=ye.get(u);if(Ue)return Ue==d;$|=O,ye.set(u,d);var Fe=ig(Ee(u),Ee(d),$,te,ce,ye);return ye.delete(u),Fe;case Ae:if(ql)return ql.call(u)==ql.call(d)}return!1}i(B5,"equalByTag"),o(B5,"equalByTag");function L5(u,d,S,$,te,ce){var ye=S&x,Ee=Dh(u),xe=Ee.length,Ue=Dh(d),Fe=Ue.length;if(xe!=Fe&&!ye)return!1;for(var $e=xe;$e--;){var Ye=Ee[$e];if(!(ye?Ye in d:yr.call(d,Ye)))return!1}var pt=ce.get(u),St=ce.get(d);if(pt&&St)return pt==d&&St==u;var Lt=!0;ce.set(u,d),ce.set(d,u);for(var _t=ye;++$e<xe;){Ye=Ee[$e];var Ht=u[Ye],Gt=d[Ye];if($)var Hn=ye?$(Gt,Ht,Ye,d,u,ce):$(Ht,Gt,Ye,u,d,ce);if(!(Hn===r?Ht===Gt||te(Ht,Gt,S,$,ce):Hn)){Lt=!1;break}_t||(_t=Ye=="constructor")}if(Lt&&!_t){var _n=u.constructor,qn=d.constructor;_n!=qn&&"constructor"in u&&"constructor"in d&&!(typeof _n=="function"&&_n instanceof _n&&typeof qn=="function"&&qn instanceof qn)&&(Lt=!1)}return ce.delete(u),ce.delete(d),Lt}i(L5,"equalObjects"),o(L5,"equalObjects");function Ca(u){return hg(fg(u,r,bg),u+"")}i(Ca,"flatRest"),o(Ca,"flatRest");function Dh(u){return T1(u,Zr,og)}i(Dh,"getAllKeys"),o(Dh,"getAllKeys");function Rh(u){return T1(u,Dn,F5)}i(Rh,"getAllKeysIn"),o(Rh,"getAllKeysIn");var ag=lh?function(u){return lh.get(u)}:Gh;function nf(u){for(var d=u.name+"",S=Zc[d],$=yr.call(Zc,d)?S.length:0;$--;){var te=S[$],ce=te.func;if(ce==null||ce==u)return te.name}return d}i(nf,"getFuncName"),o(nf,"getFuncName");function js(u){var d=yr.call(se,"placeholder")?se:u;return d.placeholder}i(js,"getHolder"),o(js,"getHolder");function wt(){var u=se.iteratee||Vh;return u=u===Vh?I1:u,arguments.length?u(arguments[0],arguments[1]):u}i(wt,"getIteratee"),o(wt,"getIteratee");function af(u,d){var S=u.__data__;return K5(d)?S[typeof d=="string"?"string":"hash"]:S.map}i(af,"getMapData"),o(af,"getMapData");function Oh(u){for(var d=Zr(u),S=d.length;S--;){var $=d[S],te=u[$];d[S]=[$,te,ug(te)]}return d}i(Oh,"getMatchData"),o(Oh,"getMatchData");function Ho(u,d){var S=s3(u,d);return M1(S)?S:r}i(Ho,"getNative"),o(Ho,"getNative");function U5(u){var d=yr.call(u,Ls),S=u[Ls];try{u[Ls]=r;var $=!0}catch{}var te=rh.call(u);return $&&(d?u[Ls]=S:delete u[Ls]),te}i(U5,"getRawTag"),o(U5,"getRawTag");var og=g1?function(u){return u==null?[]:(u=_r(u),io(g1(u),function(d){return b3.call(u,d)}))}:Wh,F5=g1?function(u){for(var d=[];u;)ao(d,og(u)),u=ah(u);return d}:Wh,bn=yn;(v1&&bn(new v1(new ArrayBuffer(1)))!=ve||$l&&bn(new $l)!=be||y1&&bn(y1.resolve())!=F||Jc&&bn(new Jc)!=ee||zl&&bn(new zl)!=Ie)&&(bn=o(function(u){var d=yn(u),S=d==N?u.constructor:r,$=S?qo(S):"";if($)switch($){case kD:return ve;case DD:return be;case RD:return F;case OD:return ee;case ND:return Ie}return d},"getTag"));function j5(u,d,S){for(var $=-1,te=S.length;++$<te;){var ce=S[$],ye=ce.size;switch(ce.type){case"drop":u+=ye;break;case"dropRight":d-=ye;break;case"take":d=vn(d,u+ye);break;case"takeRight":u=Jr(u,d-ye);break}}return{start:u,end:d}}i(j5,"getView"),o(j5,"getView");function $5(u){var d=u.match(Ze);return d?d[1].split(cr):[]}i($5,"getWrapDetails"),o($5,"getWrapDetails");function sg(u,d,S){d=co(d,u);for(var $=-1,te=d.length,ce=!1;++$<te;){var ye=Qi(d[$]);if(!(ce=u!=null&&S(u,ye)))break;u=u[ye]}return ce||++$!=te?ce:(te=u==null?0:u.length,!!te&&df(te)&&Ma(ye,te)&&(Nt(u)||$s(u)))}i(sg,"hasPath"),o(sg,"hasPath");function z5(u){var d=u.length,S=new u.constructor(d);return d&&typeof u[0]=="string"&&yr.call(u,"index")&&(S.index=u.index,S.input=u.input),S}i(z5,"initCloneArray"),o(z5,"initCloneArray");function cg(u){return typeof u.constructor=="function"&&!iu(u)?Yc(ah(u)):{}}i(cg,"initCloneObject"),o(cg,"initCloneObject");function H5(u,d,S){var $=u.constructor;switch(d){case qe:return Mh(u);case ne:case oe:return new $(+u);case ve:return T5(u,S);case pe:case re:case le:case _e:case Te:case Ce:case Oe:case Ct:case Ve:return H1(u,S);case be:return new $;case Re:case ue:return new $(u);case ie:return C5(u);case ee:return new $;case Ae:return M5(u)}}i(H5,"initCloneByTag"),o(H5,"initCloneByTag");function q5(u,d){var S=d.length;if(!S)return u;var $=S-1;return d[$]=(S>1?"& ":"")+d[$],d=d.join(S>2?", ":" "),u.replace(ot,`{
25
25
  /* [wrapped with `+d+`] */
26
26
  `)}i(q5,"insertWrapDetails"),o(q5,"insertWrapDetails");function V5(u){return Nt(u)||$s(u)||!!(w3&&u&&u[w3])}i(V5,"isFlattenable"),o(V5,"isFlattenable");function Ma(u,d){var S=typeof u;return d=d??E,!!d&&(S=="number"||S!="symbol"&&an.test(u))&&u>-1&&u%1==0&&u<d}i(Ma,"isIndex"),o(Ma,"isIndex");function wn(u,d,S){if(!kr(S))return!1;var $=typeof d;return($=="number"?kn(S)&&Ma(d,S.length):$=="string"&&d in S)?Bi(S[d],u):!1}i(wn,"isIterateeCall"),o(wn,"isIterateeCall");function Nh(u,d){if(Nt(u))return!1;var S=typeof u;return S=="number"||S=="symbol"||S=="boolean"||u==null||zn(u)?!0:it.test(u)||!or.test(u)||d!=null&&u in _r(d)}i(Nh,"isKey"),o(Nh,"isKey");function K5(u){var d=typeof u;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?u!=="__proto__":u===null}i(K5,"isKeyable"),o(K5,"isKeyable");function Ph(u){var d=nf(u),S=se[d];if(typeof S!="function"||!(d in Kt.prototype))return!1;if(u===S)return!0;var $=ag(S);return!!$&&u===$[0]}i(Ph,"isLaziable"),o(Ph,"isLaziable");function G5(u){return!!g3&&g3 in u}i(G5,"isMasked"),o(G5,"isMasked");var UD=eh?Ia:Jh;function iu(u){var d=u&&u.constructor,S=typeof d=="function"&&d.prototype||Wc;return u===S}i(iu,"isPrototype"),o(iu,"isPrototype");function ug(u){return u===u&&!kr(u)}i(ug,"isStrictComparable"),o(ug,"isStrictComparable");function lg(u,d){return function(S){return S==null?!1:S[u]===d&&(d!==r||u in _r(S))}}i(lg,"matchesStrictComparable"),o(lg,"matchesStrictComparable");function W5(u){var d=lf(u,function($){return S.size===p&&S.clear(),$}),S=d.cache;return d}i(W5,"memoizeCapped"),o(W5,"memoizeCapped");function J5(u,d){var S=u[1],$=d[1],te=S|$,ce=te<(D|P|k),ye=$==k&&S==j||$==k&&S==K&&u[7].length<=d[8]||$==(k|K)&&d[7].length<=d[8]&&S==j;if(!(ce||ye))return u;$&D&&(u[2]=d[2],te|=S&D?0:J);var Ee=d[3];if(Ee){var xe=u[3];u[3]=xe?V1(xe,Ee,d[4]):Ee,u[4]=xe?oo(u[3],g):d[4]}return Ee=d[5],Ee&&(xe=u[5],u[5]=xe?K1(xe,Ee,d[6]):Ee,u[6]=xe?oo(u[5],g):d[6]),Ee=d[7],Ee&&(u[7]=Ee),$&k&&(u[8]=u[8]==null?d[8]:vn(u[8],d[8])),u[9]==null&&(u[9]=d[9]),u[0]=d[0],u[1]=te,u}i(J5,"mergeData"),o(J5,"mergeData");function Z5(u){var d=[];if(u!=null)for(var S in _r(u))d.push(S);return d}i(Z5,"nativeKeysIn"),o(Z5,"nativeKeysIn");function Y5(u){return rh.call(u)}i(Y5,"objectToString"),o(Y5,"objectToString");function fg(u,d,S){return d=Jr(d===r?u.length-1:d,0),function(){for(var $=arguments,te=-1,ce=Jr($.length-d,0),ye=ke(ce);++te<ce;)ye[te]=$[d+te];te=-1;for(var Ee=ke(d+1);++te<d;)Ee[te]=$[te];return Ee[d]=S(ye),Fn(u,this,Ee)}}i(fg,"overRest"),o(fg,"overRest");function dg(u,d){return d.length<2?u:zo(u,oi(d,0,-1))}i(dg,"parent"),o(dg,"parent");function X5(u,d){for(var S=u.length,$=vn(d.length,S),te=In(u);$--;){var ce=d[$];u[$]=Ma(ce,S)?te[ce]:r}return u}i(X5,"reorder"),o(X5,"reorder");function Bh(u,d){if(!(d==="constructor"&&typeof u[d]=="function")&&d!="__proto__")return u[d]}i(Bh,"safeGet"),o(Bh,"safeGet");var Q5=mg(E5),of=AD||function(u,d){return Fr.setTimeout(u,d)},hg=mg(PD);function pg(u,d,S){var $=d+"";return hg(u,q5($,tw($5($),S)))}i(pg,"setWrapToString"),o(pg,"setWrapToString");function mg(u){var d=0,S=0;return function(){var $=CD(),te=w-($-S);if(S=$,te>0){if(++d>=Z)return arguments[0]}else d=0;return u.apply(r,arguments)}}i(mg,"shortOut"),o(mg,"shortOut");function sf(u,d){var S=-1,$=u.length,te=$-1;for(d=d===r?$:d;++S<d;){var ce=_h(S,te),ye=u[ce];u[ce]=u[S],u[S]=ye}return u.length=d,u}i(sf,"shuffleSelf"),o(sf,"shuffleSelf");var ew=W5(function(u){var d=[];return u.charCodeAt(0)===46&&d.push(""),u.replace(Xe,function(S,$,te,ce){d.push(te?ce.replace(Tn,"$1"):$||S)}),d});function Qi(u){if(typeof u=="string"||zn(u))return u;var d=u+"";return d=="0"&&1/u==-m?"-0":d}i(Qi,"toKey"),o(Qi,"toKey");function qo(u){if(u!=null){try{return th.call(u)}catch{}try{return u+""}catch{}}return""}i(qo,"toSource"),o(qo,"toSource");function tw(u,d){return ni(I,function(S){var $="_."+S[0];d&S[1]&&!Ll(u,$)&&u.push($)}),u.sort()}i(tw,"updateWrapDetails"),o(tw,"updateWrapDetails");function gg(u){if(u instanceof Kt)return u.clone();var d=new ii(u.__wrapped__,u.__chain__);return d.__actions__=In(u.__actions__),d.__index__=u.__index__,d.__values__=u.__values__,d}i(gg,"wrapperClone"),o(gg,"wrapperClone");function rw(u,d,S){(S?wn(u,d,S):d===r)?d=1:d=Jr(Pt(d),0);var $=u==null?0:u.length;if(!$||d<1)return[];for(var te=0,ce=0,ye=ke(ch($/d));te<$;)ye[ce++]=oi(u,te,te+=d);return ye}i(rw,"chunk"),o(rw,"chunk");function nw(u){for(var d=-1,S=u==null?0:u.length,$=0,te=[];++d<S;){var ce=u[d];ce&&(te[$++]=ce)}return te}i(nw,"compact"),o(nw,"compact");function iw(){var u=arguments.length;if(!u)return[];for(var d=ke(u-1),S=arguments[0],$=u;$--;)d[$-1]=arguments[$];return ao(Nt(S)?In(S):[S],Xr(d,1))}i(iw,"concat4"),o(iw,"concat");var FD=Ut(function(u,d){return Pr(u)?Qc(u,Xr(d,1,Pr,!0)):[]}),jD=Ut(function(u,d){var S=si(d);return Pr(S)&&(S=r),Pr(u)?Qc(u,Xr(d,1,Pr,!0),wt(S,2)):[]}),$D=Ut(function(u,d){var S=si(d);return Pr(S)&&(S=r),Pr(u)?Qc(u,Xr(d,1,Pr,!0),r,S):[]});function aw(u,d,S){var $=u==null?0:u.length;return $?(d=S||d===r?1:Pt(d),oi(u,d<0?0:d,$)):[]}i(aw,"drop"),o(aw,"drop");function ow(u,d,S){var $=u==null?0:u.length;return $?(d=S||d===r?1:Pt(d),d=$-d,oi(u,0,d<0?0:d)):[]}i(ow,"dropRight"),o(ow,"dropRight");function sw(u,d){return u&&u.length?Yl(u,wt(d,3),!0,!0):[]}i(sw,"dropRightWhile"),o(sw,"dropRightWhile");function cw(u,d){return u&&u.length?Yl(u,wt(d,3),!0):[]}i(cw,"dropWhile"),o(cw,"dropWhile");function uw(u,d,S,$){var te=u==null?0:u.length;return te?(S&&typeof S!="number"&&wn(u,d,S)&&(S=0,$=te),r5(u,d,S,$)):[]}i(uw,"fill"),o(uw,"fill");function vg(u,d,S){var $=u==null?0:u.length;if(!$)return-1;var te=S==null?0:Pt(S);return te<0&&(te=Jr($+te,0)),Ul(u,wt(d,3),te)}i(vg,"findIndex"),o(vg,"findIndex");function yg(u,d,S){var $=u==null?0:u.length;if(!$)return-1;var te=$-1;return S!==r&&(te=Pt(S),te=S<0?Jr($+te,0):vn(te,$-1)),Ul(u,wt(d,3),te,!0)}i(yg,"findLastIndex"),o(yg,"findLastIndex");function bg(u){var d=u==null?0:u.length;return d?Xr(u,1):[]}i(bg,"flatten"),o(bg,"flatten");function lw(u){var d=u==null?0:u.length;return d?Xr(u,m):[]}i(lw,"flattenDeep"),o(lw,"flattenDeep");function fw(u,d){var S=u==null?0:u.length;return S?(d=d===r?1:Pt(d),Xr(u,d)):[]}i(fw,"flattenDepth"),o(fw,"flattenDepth");function dw(u){for(var d=-1,S=u==null?0:u.length,$={};++d<S;){var te=u[d];$[te[0]]=te[1]}return $}i(dw,"fromPairs"),o(dw,"fromPairs");function wg(u){return u&&u.length?u[0]:r}i(wg,"head"),o(wg,"head");function hw(u,d,S){var $=u==null?0:u.length;if(!$)return-1;var te=S==null?0:Pt(S);return te<0&&(te=Jr($+te,0)),Ns(u,d,te)}i(hw,"indexOf"),o(hw,"indexOf");function pw(u){var d=u==null?0:u.length;return d?oi(u,0,-1):[]}i(pw,"initial"),o(pw,"initial");var zD=Ut(function(u){var d=Mr(u,Th);return d.length&&d[0]===u[0]?gh(d):[]}),HD=Ut(function(u){var d=si(u),S=Mr(u,Th);return d===si(S)?d=r:S.pop(),S.length&&S[0]===u[0]?gh(S,wt(d,2)):[]}),qD=Ut(function(u){var d=si(u),S=Mr(u,Th);return d=typeof d=="function"?d:r,d&&S.pop(),S.length&&S[0]===u[0]?gh(S,r,d):[]});function mw(u,d){return u==null?"":xD.call(u,d)}i(mw,"join"),o(mw,"join");function si(u){var d=u==null?0:u.length;return d?u[d-1]:r}i(si,"last2"),o(si,"last");function gw(u,d,S){var $=u==null?0:u.length;if(!$)return-1;var te=$;return S!==r&&(te=Pt(S),te=te<0?Jr($+te,0):vn(te,$-1)),d===d?d3(u,d,te):Ul(u,s1,te,!0)}i(gw,"lastIndexOf"),o(gw,"lastIndexOf");function vw(u,d){return u&&u.length?O1(u,Pt(d)):r}i(vw,"nth"),o(vw,"nth");var VD=Ut(_g);function _g(u,d){return u&&u.length&&d&&d.length?wh(u,d):u}i(_g,"pullAll"),o(_g,"pullAll");function yw(u,d,S){return u&&u.length&&d&&d.length?wh(u,d,wt(S,2)):u}i(yw,"pullAllBy"),o(yw,"pullAllBy");function bw(u,d,S){return u&&u.length&&d&&d.length?wh(u,d,r,S):u}i(bw,"pullAllWith"),o(bw,"pullAllWith");var KD=Ca(function(u,d){var S=u==null?0:u.length,$=hh(u,d);return B1(u,Mr(d,function(te){return Ma(te,S)?+te:te}).sort(q1)),$});function ww(u,d){var S=[];if(!(u&&u.length))return S;var $=-1,te=[],ce=u.length;for(d=wt(d,3);++$<ce;){var ye=u[$];d(ye,$,u)&&(S.push(ye),te.push($))}return B1(u,te),S}i(ww,"remove"),o(ww,"remove");function Lh(u){return u==null?u:ID.call(u)}i(Lh,"reverse"),o(Lh,"reverse");function _w(u,d,S){var $=u==null?0:u.length;return $?(S&&typeof S!="number"&&wn(u,d,S)?(d=0,S=$):(d=d==null?0:Pt(d),S=S===r?$:Pt(S)),oi(u,d,S)):[]}i(_w,"slice2"),o(_w,"slice");function Ew(u,d){return Zl(u,d)}i(Ew,"sortedIndex"),o(Ew,"sortedIndex");function Aw(u,d,S){return Ah(u,d,wt(S,2))}i(Aw,"sortedIndexBy"),o(Aw,"sortedIndexBy");function Sw(u,d){var S=u==null?0:u.length;if(S){var $=Zl(u,d);if($<S&&Bi(u[$],d))return $}return-1}i(Sw,"sortedIndexOf"),o(Sw,"sortedIndexOf");function xw(u,d){return Zl(u,d,!0)}i(xw,"sortedLastIndex"),o(xw,"sortedLastIndex");function Tw(u,d,S){return Ah(u,d,wt(S,2),!0)}i(Tw,"sortedLastIndexBy"),o(Tw,"sortedLastIndexBy");function Cw(u,d){var S=u==null?0:u.length;if(S){var $=Zl(u,d,!0)-1;if(Bi(u[$],d))return $}return-1}i(Cw,"sortedLastIndexOf"),o(Cw,"sortedLastIndexOf");function Mw(u){return u&&u.length?L1(u):[]}i(Mw,"sortedUniq"),o(Mw,"sortedUniq");function Iw(u,d){return u&&u.length?L1(u,wt(d,2)):[]}i(Iw,"sortedUniqBy"),o(Iw,"sortedUniqBy");function kw(u){var d=u==null?0:u.length;return d?oi(u,1,d):[]}i(kw,"tail"),o(kw,"tail");function Dw(u,d,S){return u&&u.length?(d=S||d===r?1:Pt(d),oi(u,0,d<0?0:d)):[]}i(Dw,"take2"),o(Dw,"take");function Rw(u,d,S){var $=u==null?0:u.length;return $?(d=S||d===r?1:Pt(d),d=$-d,oi(u,d<0?0:d,$)):[]}i(Rw,"takeRight"),o(Rw,"takeRight");function Ow(u,d){return u&&u.length?Yl(u,wt(d,3),!1,!0):[]}i(Ow,"takeRightWhile"),o(Ow,"takeRightWhile");function Nw(u,d){return u&&u.length?Yl(u,wt(d,3)):[]}i(Nw,"takeWhile"),o(Nw,"takeWhile");var GD=Ut(function(u){return so(Xr(u,1,Pr,!0))}),WD=Ut(function(u){var d=si(u);return Pr(d)&&(d=r),so(Xr(u,1,Pr,!0),wt(d,2))}),JD=Ut(function(u){var d=si(u);return d=typeof d=="function"?d:r,so(Xr(u,1,Pr,!0),r,d)});function Pw(u){return u&&u.length?so(u):[]}i(Pw,"uniq"),o(Pw,"uniq");function Bw(u,d){return u&&u.length?so(u,wt(d,2)):[]}i(Bw,"uniqBy"),o(Bw,"uniqBy");function Lw(u,d){return d=typeof d=="function"?d:r,u&&u.length?so(u,r,d):[]}i(Lw,"uniqWith"),o(Lw,"uniqWith");function Uh(u){if(!(u&&u.length))return[];var d=0;return u=io(u,function(S){if(Pr(S))return d=Jr(S.length,d),!0}),Zd(d,function(S){return Mr(u,Gd(S))})}i(Uh,"unzip"),o(Uh,"unzip");function Eg(u,d){if(!(u&&u.length))return[];var S=Uh(u);return d==null?S:Mr(S,function($){return Fn(d,r,$)})}i(Eg,"unzipWith"),o(Eg,"unzipWith");var ZD=Ut(function(u,d){return Pr(u)?Qc(u,d):[]}),YD=Ut(function(u){return xh(io(u,Pr))}),XD=Ut(function(u){var d=si(u);return Pr(d)&&(d=r),xh(io(u,Pr),wt(d,2))}),QD=Ut(function(u){var d=si(u);return d=typeof d=="function"?d:r,xh(io(u,Pr),r,d)}),eR=Ut(Uh);function Uw(u,d){return $1(u||[],d||[],Xc)}i(Uw,"zipObject"),o(Uw,"zipObject");function Fw(u,d){return $1(u||[],d||[],ru)}i(Fw,"zipObjectDeep"),o(Fw,"zipObjectDeep");var tR=Ut(function(u){var d=u.length,S=d>1?u[d-1]:r;return S=typeof S=="function"?(u.pop(),S):r,Eg(u,S)});function Ag(u){var d=se(u);return d.__chain__=!0,d}i(Ag,"chain"),o(Ag,"chain");function jw(u,d){return d(u),u}i(jw,"tap"),o(jw,"tap");function cf(u,d){return d(u)}i(cf,"thru"),o(cf,"thru");var rR=Ca(function(u){var d=u.length,S=d?u[0]:0,$=this.__wrapped__,te=o(function(ce){return hh(ce,u)},"interceptor");return d>1||this.__actions__.length||!($ instanceof Kt)||!Ma(S)?this.thru(te):($=$.slice(S,+S+(d?1:0)),$.__actions__.push({func:cf,args:[te],thisArg:r}),new ii($,this.__chain__).thru(function(ce){return d&&!ce.length&&ce.push(r),ce}))});function $w(){return Ag(this)}i($w,"wrapperChain"),o($w,"wrapperChain");function zw(){return new ii(this.value(),this.__chain__)}i(zw,"wrapperCommit"),o(zw,"wrapperCommit");function Hw(){this.__values__===r&&(this.__values__=Bg(this.value()));var u=this.__index__>=this.__values__.length,d=u?r:this.__values__[this.__index__++];return{done:u,value:d}}i(Hw,"wrapperNext"),o(Hw,"wrapperNext");function qw(){return this}i(qw,"wrapperToIterator"),o(qw,"wrapperToIterator");function Vw(u){for(var d,S=this;S instanceof Vl;){var $=gg(S);$.__index__=0,$.__values__=r,d?te.__wrapped__=$:d=$;var te=$;S=S.__wrapped__}return te.__wrapped__=u,d}i(Vw,"wrapperPlant"),o(Vw,"wrapperPlant");function Kw(){var u=this.__wrapped__;if(u instanceof Kt){var d=u;return this.__actions__.length&&(d=new Kt(this)),d=d.reverse(),d.__actions__.push({func:cf,args:[Lh],thisArg:r}),new ii(d,this.__chain__)}return this.thru(Lh)}i(Kw,"wrapperReverse"),o(Kw,"wrapperReverse");function Gw(){return j1(this.__wrapped__,this.__actions__)}i(Gw,"wrapperValue"),o(Gw,"wrapperValue");var nR=Xl(function(u,d,S){yr.call(u,S)?++u[S]:xa(u,S,1)});function Ww(u,d,S){var $=Nt(u)?a1:t5;return S&&wn(u,d,S)&&(d=r),$(u,wt(d,3))}i(Ww,"every"),o(Ww,"every");function Jw(u,d){var S=Nt(u)?io:S1;return S(u,wt(d,3))}i(Jw,"filter2"),o(Jw,"filter");var iR=Z1(vg),aR=Z1(yg);function Zw(u,d){return Xr(uf(u,d),1)}i(Zw,"flatMap"),o(Zw,"flatMap");function Yw(u,d){return Xr(uf(u,d),m)}i(Yw,"flatMapDeep"),o(Yw,"flatMapDeep");function Xw(u,d,S){return S=S===r?1:Pt(S),Xr(uf(u,d),S)}i(Xw,"flatMapDepth"),o(Xw,"flatMapDepth");function Sg(u,d){var S=Nt(u)?ni:$o;return S(u,wt(d,3))}i(Sg,"forEach"),o(Sg,"forEach");function xg(u,d){var S=Nt(u)?X2:e5;return S(u,wt(d,3))}i(xg,"forEachRight"),o(xg,"forEachRight");var oR=Xl(function(u,d,S){yr.call(u,S)?u[S].push(d):xa(u,S,[d])});function Qw(u,d,S,$){u=kn(u)?u:zs(u),S=S&&!$?Pt(S):0;var te=u.length;return S<0&&(S=Jr(te+S,0)),hf(u)?S<=te&&u.indexOf(d,S)>-1:!!te&&Ns(u,d,S)>-1}i(Qw,"includes"),o(Qw,"includes");var sR=Ut(function(u,d,S){var $=-1,te=typeof d=="function",ce=kn(u)?ke(u.length):[];return $o(u,function(ye){ce[++$]=te?Fn(d,ye,S):eu(ye,d,S)}),ce}),cR=Xl(function(u,d,S){xa(u,S,d)});function uf(u,d){var S=Nt(u)?Mr:k1;return S(u,wt(d,3))}i(uf,"map2"),o(uf,"map");function e4(u,d,S,$){return u==null?[]:(Nt(d)||(d=d==null?[]:[d]),S=$?r:S,Nt(S)||(S=S==null?[]:[S]),N1(u,d,S))}i(e4,"orderBy"),o(e4,"orderBy");var uR=Xl(function(u,d,S){u[S?0:1].push(d)},function(){return[[],[]]});function t4(u,d,S){var $=Nt(u)?Vd:u1,te=arguments.length<3;return $(u,wt(d,4),S,te,$o)}i(t4,"reduce"),o(t4,"reduce");function r4(u,d,S){var $=Nt(u)?Q2:u1,te=arguments.length<3;return $(u,wt(d,4),S,te,e5)}i(r4,"reduceRight"),o(r4,"reduceRight");function n4(u,d){var S=Nt(u)?io:S1;return S(u,ff(wt(d,3)))}i(n4,"reject"),o(n4,"reject");function i4(u){var d=Nt(u)?w1:w5;return d(u)}i(i4,"sample"),o(i4,"sample");function a4(u,d,S){(S?wn(u,d,S):d===r)?d=1:d=Pt(d);var $=Nt(u)?J3:_5;return $(u,d)}i(a4,"sampleSize"),o(a4,"sampleSize");function o4(u){var d=Nt(u)?Z3:A5;return d(u)}i(o4,"shuffle"),o(o4,"shuffle");function s4(u){if(u==null)return 0;if(kn(u))return hf(u)?Bs(u):u.length;var d=bn(u);return d==be||d==ee?u.size:yh(u).length}i(s4,"size"),o(s4,"size");function c4(u,d,S){var $=Nt(u)?Kd:S5;return S&&wn(u,d,S)&&(d=r),$(u,wt(d,3))}i(c4,"some"),o(c4,"some");var lR=Ut(function(u,d){if(u==null)return[];var S=d.length;return S>1&&wn(u,d[0],d[1])?d=[]:S>2&&wn(d[0],d[1],d[2])&&(d=[d[0]]),N1(u,Xr(d,1),[])}),Fh=ED||function(){return Fr.Date.now()};function u4(u,d){if(typeof d!="function")throw new Ni(c);return u=Pt(u),function(){if(--u<1)return d.apply(this,arguments)}}i(u4,"after"),o(u4,"after");function Tg(u,d,S){return d=S?r:d,d=u&&d==null?u.length:d,Ta(u,k,r,r,r,r,d)}i(Tg,"ary"),o(Tg,"ary");function Cg(u,d){var S;if(typeof d!="function")throw new Ni(c);return u=Pt(u),function(){return--u>0&&(S=d.apply(this,arguments)),u<=1&&(d=r),S}}i(Cg,"before"),o(Cg,"before");var Mg=Ut(function(u,d,S){var $=D;if(S.length){var te=oo(S,js(Mg));$|=Q}return Ta(u,$,d,S,te)}),l4=Ut(function(u,d,S){var $=D|P;if(S.length){var te=oo(S,js(l4));$|=Q}return Ta(d,$,u,S,te)});function Ig(u,d,S){d=S?r:d;var $=Ta(u,j,r,r,r,r,r,d);return $.placeholder=Ig.placeholder,$}i(Ig,"curry"),o(Ig,"curry");function kg(u,d,S){d=S?r:d;var $=Ta(u,q,r,r,r,r,r,d);return $.placeholder=kg.placeholder,$}i(kg,"curryRight"),o(kg,"curryRight");function Dg(u,d,S){var $,te,ce,ye,Ee,xe,Ue=0,Fe=!1,$e=!1,Ye=!0;if(typeof u!="function")throw new Ni(c);d=ci(d)||0,kr(S)&&(Fe=!!S.leading,$e="maxWait"in S,ce=$e?Jr(ci(S.maxWait)||0,d):ce,Ye="trailing"in S?!!S.trailing:Ye);function pt(jr){var ea=$,lo=te;return $=te=r,Ue=jr,ye=u.apply(lo,ea),ye}i(pt,"invokeFunc"),o(pt,"invokeFunc");function St(jr){return Ue=jr,Ee=of(Ht,d),Fe?pt(jr):ye}i(St,"leadingEdge"),o(St,"leadingEdge");function Lt(jr){var ea=jr-xe,lo=jr-Ue,o8=d-ea;return $e?vn(o8,ce-lo):o8}i(Lt,"remainingWait"),o(Lt,"remainingWait");function _t(jr){var ea=jr-xe,lo=jr-Ue;return xe===r||ea>=d||ea<0||$e&&lo>=ce}i(_t,"shouldInvoke"),o(_t,"shouldInvoke");function Ht(){var jr=Fh();if(_t(jr))return Gt(jr);Ee=of(Ht,Lt(jr))}i(Ht,"timerExpired"),o(Ht,"timerExpired");function Gt(jr){return Ee=r,Ye&&$?pt(jr):($=te=r,ye)}i(Gt,"trailingEdge"),o(Gt,"trailingEdge");function Hn(){Ee!==r&&x5(Ee),Ue=0,$=xe=te=Ee=r}i(Hn,"cancel"),o(Hn,"cancel");function _n(){return Ee===r?ye:Gt(Fh())}i(_n,"flush"),o(_n,"flush");function qn(){var jr=Fh(),ea=_t(jr);if($=arguments,te=this,xe=jr,ea){if(Ee===r)return St(xe);if($e)return x5(Ee),Ee=of(Ht,d),pt(xe)}return Ee===r&&(Ee=of(Ht,d)),ye}return i(qn,"debounced"),o(qn,"debounced"),qn.cancel=Hn,qn.flush=_n,qn}i(Dg,"debounce"),o(Dg,"debounce");var fR=Ut(function(u,d){return A1(u,1,d)}),dR=Ut(function(u,d,S){return A1(u,ci(d)||0,S)});function f4(u){return Ta(u,he)}i(f4,"flip"),o(f4,"flip");function lf(u,d){if(typeof u!="function"||d!=null&&typeof d!="function")throw new Ni(c);var S=o(function(){var $=arguments,te=d?d.apply(this,$):$[0],ce=S.cache;if(ce.has(te))return ce.get(te);var ye=u.apply(this,$);return S.cache=ce.set(te,ye)||ce,ye},"memoized");return S.cache=new(lf.Cache||Sa),S}i(lf,"memoize"),o(lf,"memoize"),lf.Cache=Sa;function ff(u){if(typeof u!="function")throw new Ni(c);return function(){var d=arguments;switch(d.length){case 0:return!u.call(this);case 1:return!u.call(this,d[0]);case 2:return!u.call(this,d[0],d[1]);case 3:return!u.call(this,d[0],d[1],d[2])}return!u.apply(this,d)}}i(ff,"negate"),o(ff,"negate");function d4(u){return Cg(2,u)}i(d4,"once"),o(d4,"once");var hR=BD(function(u,d){d=d.length==1&&Nt(d[0])?Mr(d[0],jn(wt())):Mr(Xr(d,1),jn(wt()));var S=d.length;return Ut(function($){for(var te=-1,ce=vn($.length,S);++te<ce;)$[te]=d[te].call(this,$[te]);return Fn(u,this,$)})}),Rg=Ut(function(u,d){var S=oo(d,js(Rg));return Ta(u,Q,r,d,S)}),h4=Ut(function(u,d){var S=oo(d,js(h4));return Ta(u,Y,r,d,S)}),pR=Ca(function(u,d){return Ta(u,K,r,r,r,d)});function p4(u,d){if(typeof u!="function")throw new Ni(c);return d=d===r?d:Pt(d),Ut(u,d)}i(p4,"rest"),o(p4,"rest");function m4(u,d){if(typeof u!="function")throw new Ni(c);return d=d==null?0:Jr(Pt(d),0),Ut(function(S){var $=S[d],te=uo(S,0,d);return $&&ao(te,$),Fn(u,this,te)})}i(m4,"spread"),o(m4,"spread");function g4(u,d,S){var $=!0,te=!0;if(typeof u!="function")throw new Ni(c);return kr(S)&&($="leading"in S?!!S.leading:$,te="trailing"in S?!!S.trailing:te),Dg(u,d,{leading:$,maxWait:d,trailing:te})}i(g4,"throttle2"),o(g4,"throttle");function v4(u){return Tg(u,1)}i(v4,"unary"),o(v4,"unary");function y4(u,d){return Rg(Ch(d),u)}i(y4,"wrap"),o(y4,"wrap");function b4(){if(!arguments.length)return[];var u=arguments[0];return Nt(u)?u:[u]}i(b4,"castArray"),o(b4,"castArray");function w4(u){return ai(u,_)}i(w4,"clone"),o(w4,"clone");function _4(u,d){return d=typeof d=="function"?d:r,ai(u,_,d)}i(_4,"cloneWith"),o(_4,"cloneWith");function E4(u){return ai(u,v|_)}i(E4,"cloneDeep6"),o(E4,"cloneDeep");function A4(u,d){return d=typeof d=="function"?d:r,ai(u,v|_,d)}i(A4,"cloneDeepWith"),o(A4,"cloneDeepWith");function S4(u,d){return d==null||E1(u,d,Zr(d))}i(S4,"conformsTo"),o(S4,"conformsTo");function Bi(u,d){return u===d||u!==u&&d!==d}i(Bi,"eq4"),o(Bi,"eq");var mR=rf(mh),gR=rf(function(u,d){return u>=d}),$s=C1(function(){return arguments}())?C1:function(u){return Rr(u)&&yr.call(u,"callee")&&!b3.call(u,"callee")},Nt=ke.isArray,vR=Os?jn(Os):c5;function kn(u){return u!=null&&df(u.length)&&!Ia(u)}i(kn,"isArrayLike2"),o(kn,"isArrayLike");function Pr(u){return Rr(u)&&kn(u)}i(Pr,"isArrayLikeObject"),o(Pr,"isArrayLikeObject");function x4(u){return u===!0||u===!1||Rr(u)&&yn(u)==ne}i(x4,"isBoolean"),o(x4,"isBoolean");var Vo=SD||Jh,yR=K2?jn(K2):u5;function T4(u){return Rr(u)&&u.nodeType===1&&!au(u)}i(T4,"isElement"),o(T4,"isElement");function C4(u){if(u==null)return!0;if(kn(u)&&(Nt(u)||typeof u=="string"||typeof u.splice=="function"||Vo(u)||ou(u)||$s(u)))return!u.length;var d=bn(u);if(d==be||d==ee)return!u.size;if(iu(u))return!yh(u).length;for(var S in u)if(yr.call(u,S))return!1;return!0}i(C4,"isEmpty"),o(C4,"isEmpty");function M4(u,d){return tu(u,d)}i(M4,"isEqual"),o(M4,"isEqual");function I4(u,d,S){S=typeof S=="function"?S:r;var $=S?S(u,d):r;return $===r?tu(u,d,r,S):!!$}i(I4,"isEqualWith"),o(I4,"isEqualWith");function jh(u){if(!Rr(u))return!1;var d=yn(u);return d==G||d==M||typeof u.message=="string"&&typeof u.name=="string"&&!au(u)}i(jh,"isError"),o(jh,"isError");function k4(u){return typeof u=="number"&&_3(u)}i(k4,"isFinite2"),o(k4,"isFinite");function Ia(u){if(!kr(u))return!1;var d=yn(u);return d==ae||d==fe||d==L||d==W}i(Ia,"isFunction2"),o(Ia,"isFunction");function Og(u){return typeof u=="number"&&u==Pt(u)}i(Og,"isInteger3"),o(Og,"isInteger");function df(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=E}i(df,"isLength"),o(df,"isLength");function kr(u){var d=typeof u;return u!=null&&(d=="object"||d=="function")}i(kr,"isObject"),o(kr,"isObject");function Rr(u){return u!=null&&typeof u=="object"}i(Rr,"isObjectLike"),o(Rr,"isObjectLike");var D4=G2?jn(G2):f5;function R4(u,d){return u===d||vh(u,d,Oh(d))}i(R4,"isMatch"),o(R4,"isMatch");function O4(u,d,S){return S=typeof S=="function"?S:r,vh(u,d,Oh(d),S)}i(O4,"isMatchWith"),o(O4,"isMatchWith");function N4(u){return Ng(u)&&u!=+u}i(N4,"isNaN2"),o(N4,"isNaN");function P4(u){if(UD(u))throw new kt(s);return M1(u)}i(P4,"isNative"),o(P4,"isNative");function B4(u){return u===null}i(B4,"isNull"),o(B4,"isNull");function L4(u){return u==null}i(L4,"isNil"),o(L4,"isNil");function Ng(u){return typeof u=="number"||Rr(u)&&yn(u)==Re}i(Ng,"isNumber"),o(Ng,"isNumber");function au(u){if(!Rr(u)||yn(u)!=N)return!1;var d=ah(u);if(d===null)return!0;var S=yr.call(d,"constructor")&&d.constructor;return typeof S=="function"&&S instanceof S&&th.call(S)==yD}i(au,"isPlainObject"),o(au,"isPlainObject");var Pg=W2?jn(W2):d5;function U4(u){return Og(u)&&u>=-E&&u<=E}i(U4,"isSafeInteger"),o(U4,"isSafeInteger");var F4=J2?jn(J2):h5;function hf(u){return typeof u=="string"||!Nt(u)&&Rr(u)&&yn(u)==ue}i(hf,"isString"),o(hf,"isString");function zn(u){return typeof u=="symbol"||Rr(u)&&yn(u)==Ae}i(zn,"isSymbol"),o(zn,"isSymbol");var ou=Z2?jn(Z2):p5;function j4(u){return u===r}i(j4,"isUndefined"),o(j4,"isUndefined");function $4(u){return Rr(u)&&bn(u)==Ie}i($4,"isWeakMap"),o($4,"isWeakMap");function z4(u){return Rr(u)&&yn(u)==Be}i(z4,"isWeakSet"),o(z4,"isWeakSet");var bR=rf(bh),wR=rf(function(u,d){return u<=d});function Bg(u){if(!u)return[];if(kn(u))return hf(u)?Oi(u):In(u);if(jl&&u[jl])return u3(u[jl]());var d=bn(u),S=d==be?Xd:d==ee?Fl:zs;return S(u)}i(Bg,"toArray"),o(Bg,"toArray");function ka(u){if(!u)return u===0?u:0;if(u=ci(u),u===m||u===-m){var d=u<0?-1:1;return d*R}return u===u?u:0}i(ka,"toFinite"),o(ka,"toFinite");function Pt(u){var d=ka(u),S=d%1;return d===d?S?d-S:d:0}i(Pt,"toInteger"),o(Pt,"toInteger");function Lg(u){return u?jo(Pt(u),0,A):0}i(Lg,"toLength"),o(Lg,"toLength");function ci(u){if(typeof u=="number")return u;if(zn(u))return C;if(kr(u)){var d=typeof u.valueOf=="function"?u.valueOf():u;u=kr(d)?d+"":d}if(typeof u!="string")return u===0?u:+u;u=l1(u);var S=er.test(u);return S||nn.test(u)?sn(u.slice(2),S?2:8):hn.test(u)?C:+u}i(ci,"toNumber"),o(ci,"toNumber");function Ug(u){return Xi(u,Dn(u))}i(Ug,"toPlainObject"),o(Ug,"toPlainObject");function H4(u){return u?jo(Pt(u),-E,E):u===0?u:0}i(H4,"toSafeInteger"),o(H4,"toSafeInteger");function dr(u){return u==null?"":$n(u)}i(dr,"toString4"),o(dr,"toString");var _R=Us(function(u,d){if(iu(d)||kn(d)){Xi(d,Zr(d),u);return}for(var S in d)yr.call(d,S)&&Xc(u,S,d[S])}),q4=Us(function(u,d){Xi(d,Dn(d),u)}),$h=Us(function(u,d,S,$){Xi(d,Dn(d),u,$)}),ER=Us(function(u,d,S,$){Xi(d,Zr(d),u,$)}),AR=Ca(hh);function V4(u,d){var S=Yc(u);return d==null?S:_1(S,d)}i(V4,"create2"),o(V4,"create");var SR=Ut(function(u,d){u=_r(u);var S=-1,$=d.length,te=$>2?d[2]:r;for(te&&wn(d[0],d[1],te)&&($=1);++S<$;)for(var ce=d[S],ye=Dn(ce),Ee=-1,xe=ye.length;++Ee<xe;){var Ue=ye[Ee],Fe=u[Ue];(Fe===r||Bi(Fe,Wc[Ue])&&!yr.call(u,Ue))&&(u[Ue]=ce[Ue])}return u}),xR=Ut(function(u){return u.push(r,ng),Fn(n_,r,u)});function K4(u,d){return o1(u,wt(d,3),Yi)}i(K4,"findKey"),o(K4,"findKey");function G4(u,d){return o1(u,wt(d,3),ph)}i(G4,"findLastKey"),o(G4,"findLastKey");function W4(u,d){return u==null?u:x1(u,wt(d,3),Dn)}i(W4,"forIn"),o(W4,"forIn");function J4(u,d){return u==null?u:n5(u,wt(d,3),Dn)}i(J4,"forInRight"),o(J4,"forInRight");function Z4(u,d){return u&&Yi(u,wt(d,3))}i(Z4,"forOwn"),o(Z4,"forOwn");function Y4(u,d){return u&&ph(u,wt(d,3))}i(Y4,"forOwnRight"),o(Y4,"forOwnRight");function X4(u){return u==null?[]:Wl(u,Zr(u))}i(X4,"functions"),o(X4,"functions");function Q4(u){return u==null?[]:Wl(u,Dn(u))}i(Q4,"functionsIn"),o(Q4,"functionsIn");function zh(u,d,S){var $=u==null?r:zo(u,d);return $===r?S:$}i(zh,"get2"),o(zh,"get");function e_(u,d){return u!=null&&sg(u,d,i5)}i(e_,"has"),o(e_,"has");function Hh(u,d){return u!=null&&sg(u,d,a5)}i(Hh,"hasIn"),o(Hh,"hasIn");var TR=X1(function(u,d,S){d!=null&&typeof d.toString!="function"&&(d=rh.call(d)),u[d]=S},qh(Rn)),CR=X1(function(u,d,S){d!=null&&typeof d.toString!="function"&&(d=rh.call(d)),yr.call(u,d)?u[d].push(S):u[d]=[S]},wt),MR=Ut(eu);function Zr(u){return kn(u)?b1(u):yh(u)}i(Zr,"keys"),o(Zr,"keys");function Dn(u){return kn(u)?b1(u,!0):m5(u)}i(Dn,"keysIn"),o(Dn,"keysIn");function t_(u,d){var S={};return d=wt(d,3),Yi(u,function($,te,ce){xa(S,d($,te,ce),$)}),S}i(t_,"mapKeys"),o(t_,"mapKeys");function r_(u,d){var S={};return d=wt(d,3),Yi(u,function($,te,ce){xa(S,te,d($,te,ce))}),S}i(r_,"mapValues"),o(r_,"mapValues");var IR=Us(function(u,d,S){Jl(u,d,S)}),n_=Us(function(u,d,S,$){Jl(u,d,S,$)}),kR=Ca(function(u,d){var S={};if(u==null)return S;var $=!1;d=Mr(d,function(ce){return ce=co(ce,u),$||($=ce.length>1),ce}),Xi(u,Rh(u),S),$&&(S=ai(S,v|y|_,P5));for(var te=d.length;te--;)Sh(S,d[te]);return S});function i_(u,d){return Fg(u,ff(wt(d)))}i(i_,"omitBy"),o(i_,"omitBy");var DR=Ca(function(u,d){return u==null?{}:v5(u,d)});function Fg(u,d){if(u==null)return{};var S=Mr(Rh(u),function($){return[$]});return d=wt(d),P1(u,S,function($,te){return d($,te[0])})}i(Fg,"pickBy"),o(Fg,"pickBy");function a_(u,d,S){d=co(d,u);var $=-1,te=d.length;for(te||(te=1,u=r);++$<te;){var ce=u==null?r:u[Qi(d[$])];ce===r&&($=te,ce=S),u=Ia(ce)?ce.call(u):ce}return u}i(a_,"result"),o(a_,"result");function o_(u,d,S){return u==null?u:ru(u,d,S)}i(o_,"set"),o(o_,"set");function s_(u,d,S,$){return $=typeof $=="function"?$:r,u==null?u:ru(u,d,S,$)}i(s_,"setWith"),o(s_,"setWith");var c_=tg(Zr),u_=tg(Dn);function l_(u,d,S){var $=Nt(u),te=$||Vo(u)||ou(u);if(d=wt(d,4),S==null){var ce=u&&u.constructor;te?S=$?new ce:[]:kr(u)?S=Ia(ce)?Yc(ah(u)):{}:S={}}return(te?ni:Yi)(u,function(ye,Ee,xe){return d(S,ye,Ee,xe)}),S}i(l_,"transform"),o(l_,"transform");function f_(u,d){return u==null?!0:Sh(u,d)}i(f_,"unset"),o(f_,"unset");function d_(u,d,S){return u==null?u:F1(u,d,Ch(S))}i(d_,"update2"),o(d_,"update");function h_(u,d,S,$){return $=typeof $=="function"?$:r,u==null?u:F1(u,d,Ch(S),$)}i(h_,"updateWith"),o(h_,"updateWith");function zs(u){return u==null?[]:Yd(u,Zr(u))}i(zs,"values"),o(zs,"values");function p_(u){return u==null?[]:Yd(u,Dn(u))}i(p_,"valuesIn"),o(p_,"valuesIn");function m_(u,d,S){return S===r&&(S=d,d=r),S!==r&&(S=ci(S),S=S===S?S:0),d!==r&&(d=ci(d),d=d===d?d:0),jo(ci(u),d,S)}i(m_,"clamp"),o(m_,"clamp");function g_(u,d,S){return d=ka(d),S===r?(S=d,d=0):S=ka(S),u=ci(u),o5(u,d,S)}i(g_,"inRange"),o(g_,"inRange");function v_(u,d,S){if(S&&typeof S!="boolean"&&wn(u,d,S)&&(d=S=r),S===r&&(typeof d=="boolean"?(S=d,d=r):typeof u=="boolean"&&(S=u,u=r)),u===r&&d===r?(u=0,d=1):(u=ka(u),d===r?(d=u,u=0):d=ka(d)),u>d){var $=u;u=d,d=$}if(S||u%1||d%1){var te=E3();return vn(u+te*(d-u+Kr("1e-"+((te+"").length-1))),d)}return _h(u,d)}i(v_,"random"),o(v_,"random");var RR=Fs(function(u,d,S){return d=d.toLowerCase(),u+(S?jg(d):d)});function jg(u){return zg(dr(u).toLowerCase())}i(jg,"capitalize"),o(jg,"capitalize");function $g(u){return u=dr(u),u&&u.replace(Nr,fD).replace($d,"")}i($g,"deburr"),o($g,"deburr");function y_(u,d,S){u=dr(u),d=$n(d);var $=u.length;S=S===r?$:jo(Pt(S),0,$);var te=S;return S-=d.length,S>=0&&u.slice(S,te)==d}i(y_,"endsWith"),o(y_,"endsWith");function b_(u){return u=dr(u),u&&ut.test(u)?u.replace(Or,dD):u}i(b_,"escape"),o(b_,"escape");function w_(u){return u=dr(u),u&&at.test(u)?u.replace(Qt,"\\$&"):u}i(w_,"escapeRegExp"),o(w_,"escapeRegExp");var OR=Fs(function(u,d,S){return u+(S?"-":"")+d.toLowerCase()}),NR=Fs(function(u,d,S){return u+(S?" ":"")+d.toLowerCase()}),PR=J1("toLowerCase");function __(u,d,S){u=dr(u),d=Pt(d);var $=d?Bs(u):0;if(!d||$>=d)return u;var te=(d-$)/2;return tf(uh(te),S)+u+tf(ch(te),S)}i(__,"pad2"),o(__,"pad");function E_(u,d,S){u=dr(u),d=Pt(d);var $=d?Bs(u):0;return d&&$<d?u+tf(d-$,S):u}i(E_,"padEnd"),o(E_,"padEnd");function A_(u,d,S){u=dr(u),d=Pt(d);var $=d?Bs(u):0;return d&&$<d?tf(d-$,S)+u:u}i(A_,"padStart"),o(A_,"padStart");function S_(u,d,S){return S||d==null?d=0:d&&(d=+d),MD(dr(u).replace(et,""),d||0)}i(S_,"parseInt2"),o(S_,"parseInt");function x_(u,d,S){return(S?wn(u,d,S):d===r)?d=1:d=Pt(d),Eh(dr(u),d)}i(x_,"repeat"),o(x_,"repeat");function T_(){var u=arguments,d=dr(u[0]);return u.length<3?d:d.replace(u[1],u[2])}i(T_,"replace"),o(T_,"replace");var BR=Fs(function(u,d,S){return u+(S?"_":"")+d.toLowerCase()});function C_(u,d,S){return S&&typeof S!="number"&&wn(u,d,S)&&(d=S=r),S=S===r?A:S>>>0,S?(u=dr(u),u&&(typeof d=="string"||d!=null&&!Pg(d))&&(d=$n(d),!d&&Ps(u))?uo(Oi(u),0,S):u.split(d,S)):[]}i(C_,"split"),o(C_,"split");var LR=Fs(function(u,d,S){return u+(S?" ":"")+zg(d)});function M_(u,d,S){return u=dr(u),S=S==null?0:jo(Pt(S),0,u.length),d=$n(d),u.slice(S,S+d.length)==d}i(M_,"startsWith"),o(M_,"startsWith");function I_(u,d,S){var $=se.templateSettings;S&&wn(u,d,S)&&(d=r),u=dr(u),d=$h({},d,$,rg);var te=$h({},d.imports,$.imports,rg),ce=Zr(te),ye=Yd(te,ce),Ee,xe,Ue=0,Fe=d.interpolate||Vr,$e="__p += '",Ye=m1((d.escape||Vr).source+"|"+Fe.source+"|"+(Fe===nt?At:Vr).source+"|"+(d.evaluate||Vr).source+"|$","g"),pt="//# sourceURL="+(yr.call(d,"sourceURL")?(d.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Vc+"]")+`
27
27
  `;u.replace(Ye,function(_t,Ht,Gt,Hn,_n,qn){return Gt||(Gt=Hn),$e+=u.slice(Ue,qn).replace(on,o3),Ht&&(Ee=!0,$e+=`' +
@@ -842,7 +842,7 @@ HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
842
842
  `;function pM(e){return typeof e=="string"&&(e=T0(e)),$m(iM([T0(Zz),T0(String(e.length)),e]))}i(pM,"hashMessage");o(pM,"hashMessage");var Mt=ir($x()),Ao=ir(Am());function $c(e,t,r){return r={path:t,exports:{},require:function(n,a){return mM(n,a??r.path)}},e(r,r.exports),r.exports}i($c,"createCommonjsModule");o($c,"createCommonjsModule");function mM(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}i(mM,"commonjsRequire");o(mM,"commonjsRequire");var Q6=e2;function e2(e,t){if(!e)throw new Error(t||"Assertion failed")}i(e2,"assert");o(e2,"assert");e2.equal=o(i(function(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)},"assertEqual"),"assertEqual");var da=$c(function(e,t){"use strict";var r=t;function n(c,l){if(Array.isArray(c))return c.slice();if(!c)return[];var h=[];if(typeof c!="string"){for(var p=0;p<c.length;p++)h[p]=c[p]|0;return h}if(l==="hex"){c=c.replace(/[^a-z0-9]+/ig,""),c.length%2!==0&&(c="0"+c);for(var p=0;p<c.length;p+=2)h.push(parseInt(c[p]+c[p+1],16))}else for(var p=0;p<c.length;p++){var g=c.charCodeAt(p),v=g>>8,y=g&255;v?h.push(v,y):h.push(y)}return h}i(n,"toArray"),o(n,"toArray"),r.toArray=n;function a(c){return c.length===1?"0"+c:c}i(a,"zero2"),o(a,"zero2"),r.zero2=a;function s(c){for(var l="",h=0;h<c.length;h++)l+=a(c[h].toString(16));return l}i(s,"toHex"),o(s,"toHex"),r.toHex=s,r.encode=o(i(function(l,h){return h==="hex"?s(l):l},"encode9"),"encode")}),Si=$c(function(e,t){"use strict";var r=t;r.assert=Q6,r.toArray=da.toArray,r.zero2=da.zero2,r.toHex=da.toHex,r.encode=da.encode;function n(h,p,g){var v=new Array(Math.max(h.bitLength(),g)+1),y;for(y=0;y<v.length;y+=1)v[y]=0;var _=1<<p+1,x=h.clone();for(y=0;y<v.length;y++){var O,D=x.andln(_-1);x.isOdd()?(D>(_>>1)-1?O=(_>>1)-D:O=D,x.isubn(O)):O=0,v[y]=O,x.iushrn(1)}return v}i(n,"getNAF2"),o(n,"getNAF"),r.getNAF=n;function a(h,p){var g=[[],[]];h=h.clone(),p=p.clone();for(var v=0,y=0,_;h.cmpn(-v)>0||p.cmpn(-y)>0;){var x=h.andln(3)+v&3,O=p.andln(3)+y&3;x===3&&(x=-1),O===3&&(O=-1);var D;(x&1)===0?D=0:(_=h.andln(7)+v&7,(_===3||_===5)&&O===2?D=-x:D=x),g[0].push(D);var P;(O&1)===0?P=0:(_=p.andln(7)+y&7,(_===3||_===5)&&x===2?P=-O:P=O),g[1].push(P),2*v===D+1&&(v=1-v),2*y===P+1&&(y=1-y),h.iushrn(1),p.iushrn(1)}return g}i(a,"getJSF2"),o(a,"getJSF"),r.getJSF=a;function s(h,p,g){var v="_"+p;h.prototype[p]=o(i(function(){return this[v]!==void 0?this[v]:this[v]=g.call(this)},"cachedProperty2"),"cachedProperty")}i(s,"cachedProperty"),o(s,"cachedProperty"),r.cachedProperty=s;function c(h){return typeof h=="string"?r.toArray(h,"hex"):h}i(c,"parseBytes"),o(c,"parseBytes"),r.parseBytes=c;function l(h){return new Mt.default(h,"hex","le")}i(l,"intFromLE"),o(l,"intFromLE"),r.intFromLE=l}),em=Si.getNAF,Yz=Si.getJSF,tm=Si.assert;function Oo(e,t){this.type=e,this.p=new Mt.default(t.p,16),this.red=t.prime?Mt.default.red(t.prime):Mt.default.mont(this.p),this.zero=new Mt.default(0).toRed(this.red),this.one=new Mt.default(1).toRed(this.red),this.two=new Mt.default(2).toRed(this.red),this.n=t.n&&new Mt.default(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}i(Oo,"BaseCurve");o(Oo,"BaseCurve");var zc=Oo;Oo.prototype.point=o(i(function(){throw new Error("Not implemented")},"point"),"point");Oo.prototype.validate=o(i(function(){throw new Error("Not implemented")},"validate"),"validate");Oo.prototype._fixedNafMul=o(i(function(t,r){tm(t.precomputed);var n=t._getDoubles(),a=em(r,1,this._bitLength),s=(1<<n.step+1)-(n.step%2===0?2:1);s/=3;var c=[],l,h;for(l=0;l<a.length;l+=n.step){h=0;for(var p=l+n.step-1;p>=l;p--)h=(h<<1)+a[p];c.push(h)}for(var g=this.jpoint(null,null,null),v=this.jpoint(null,null,null),y=s;y>0;y--){for(l=0;l<c.length;l++)h=c[l],h===y?v=v.mixedAdd(n.points[l]):h===-y&&(v=v.mixedAdd(n.points[l].neg()));g=g.add(v)}return g.toP()},"_fixedNafMul"),"_fixedNafMul");Oo.prototype._wnafMul=o(i(function(t,r){var n=4,a=t._getNAFPoints(n);n=a.wnd;for(var s=a.points,c=em(r,n,this._bitLength),l=this.jpoint(null,null,null),h=c.length-1;h>=0;h--){for(var p=0;h>=0&&c[h]===0;h--)p++;if(h>=0&&p++,l=l.dblp(p),h<0)break;var g=c[h];tm(g!==0),t.type==="affine"?g>0?l=l.mixedAdd(s[g-1>>1]):l=l.mixedAdd(s[-g-1>>1].neg()):g>0?l=l.add(s[g-1>>1]):l=l.add(s[-g-1>>1].neg())}return t.type==="affine"?l.toP():l},"_wnafMul"),"_wnafMul");Oo.prototype._wnafMulAdd=o(i(function(t,r,n,a,s){var c=this._wnafT1,l=this._wnafT2,h=this._wnafT3,p=0,g,v,y;for(g=0;g<a;g++){y=r[g];var _=y._getNAFPoints(t);c[g]=_.wnd,l[g]=_.points}for(g=a-1;g>=1;g-=2){var x=g-1,O=g;if(c[x]!==1||c[O]!==1){h[x]=em(n[x],c[x],this._bitLength),h[O]=em(n[O],c[O],this._bitLength),p=Math.max(h[x].length,p),p=Math.max(h[O].length,p);continue}var D=[r[x],null,null,r[O]];r[x].y.cmp(r[O].y)===0?(D[1]=r[x].add(r[O]),D[2]=r[x].toJ().mixedAdd(r[O].neg())):r[x].y.cmp(r[O].y.redNeg())===0?(D[1]=r[x].toJ().mixedAdd(r[O]),D[2]=r[x].add(r[O].neg())):(D[1]=r[x].toJ().mixedAdd(r[O]),D[2]=r[x].toJ().mixedAdd(r[O].neg()));var P=[-3,-1,-5,-7,0,7,5,1,3],J=Yz(n[x],n[O]);for(p=Math.max(J[0].length,p),h[x]=new Array(p),h[O]=new Array(p),v=0;v<p;v++){var j=J[0][v]|0,q=J[1][v]|0;h[x][v]=P[(j+1)*3+(q+1)],h[O][v]=0,l[x]=D}}var Q=this.jpoint(null,null,null),Y=this._wnafT4;for(g=p;g>=0;g--){for(var k=0;g>=0;){var K=!0;for(v=0;v<a;v++)Y[v]=h[v][g]|0,Y[v]!==0&&(K=!1);if(!K)break;k++,g--}if(g>=0&&k++,Q=Q.dblp(k),g<0)break;for(v=0;v<a;v++){var he=Y[v];he!==0&&(he>0?y=l[v][he-1>>1]:he<0&&(y=l[v][-he-1>>1].neg()),y.type==="affine"?Q=Q.mixedAdd(y):Q=Q.add(y))}}for(g=0;g<a;g++)l[g]=null;return s?Q:Q.toP()},"_wnafMulAdd"),"_wnafMulAdd");function xi(e,t){this.curve=e,this.type=t,this.precomputed=null}i(xi,"BasePoint");o(xi,"BasePoint");Oo.BasePoint=xi;xi.prototype.eq=o(i(function(){throw new Error("Not implemented")},"eq"),"eq");xi.prototype.validate=o(i(function(){return this.curve.validate(this)},"validate2"),"validate");Oo.prototype.decodePoint=o(i(function(t,r){t=Si.toArray(t,r);var n=this.p.byteLength();if((t[0]===4||t[0]===6||t[0]===7)&&t.length-1===2*n){t[0]===6?tm(t[t.length-1]%2===0):t[0]===7&&tm(t[t.length-1]%2===1);var a=this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));return a}else if((t[0]===2||t[0]===3)&&t.length-1===n)return this.pointFromX(t.slice(1,1+n),t[0]===3);throw new Error("Unknown point format")},"decodePoint"),"decodePoint");xi.prototype.encodeCompressed=o(i(function(t){return this.encode(t,!0)},"encodeCompressed"),"encodeCompressed");xi.prototype._encode=o(i(function(t){var r=this.curve.p.byteLength(),n=this.getX().toArray("be",r);return t?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",r))},"_encode"),"_encode");xi.prototype.encode=o(i(function(t,r){return Si.encode(this._encode(r),t)},"encode8"),"encode");xi.prototype.precompute=o(i(function(t){if(this.precomputed)return this;var r={doubles:null,naf:null,beta:null};return r.naf=this._getNAFPoints(8),r.doubles=this._getDoubles(4,t),r.beta=this._getBeta(),this.precomputed=r,this},"precompute"),"precompute");xi.prototype._hasDoubles=o(i(function(t){if(!this.precomputed)return!1;var r=this.precomputed.doubles;return r?r.points.length>=Math.ceil((t.bitLength()+1)/r.step):!1},"_hasDoubles"),"_hasDoubles");xi.prototype._getDoubles=o(i(function(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],a=this,s=0;s<r;s+=t){for(var c=0;c<t;c++)a=a.dbl();n.push(a)}return{step:t,points:n}},"_getDoubles"),"_getDoubles");xi.prototype._getNAFPoints=o(i(function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<t)-1,a=n===1?null:this.dbl(),s=1;s<n;s++)r[s]=r[s-1].add(a);return{wnd:t,points:r}},"_getNAFPoints"),"_getNAFPoints");xi.prototype._getBeta=o(i(function(){return null},"_getBeta"),"_getBeta");xi.prototype.dblp=o(i(function(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r},"dblp"),"dblp");var t2=$c(function(e){typeof Object.create=="function"?e.exports=o(i(function(r,n){n&&(r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))},"inherits"),"inherits"):e.exports=o(i(function(r,n){if(n){r.super_=n;var a=o(function(){},"TempCtor");a.prototype=n.prototype,r.prototype=new a,r.prototype.constructor=r}},"inherits"),"inherits")}),Xz=Si.assert;function Ti(e){zc.call(this,"short",e),this.a=new Mt.default(e.a,16).toRed(this.red),this.b=new Mt.default(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}i(Ti,"ShortCurve");o(Ti,"ShortCurve");t2(Ti,zc);var Qz=Ti;Ti.prototype._getEndomorphism=o(i(function(t){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var r,n;if(t.beta)r=new Mt.default(t.beta,16).toRed(this.red);else{var a=this._getEndoRoots(this.p);r=a[0].cmp(a[1])<0?a[0]:a[1],r=r.toRed(this.red)}if(t.lambda)n=new Mt.default(t.lambda,16);else{var s=this._getEndoRoots(this.n);this.g.mul(s[0]).x.cmp(this.g.x.redMul(r))===0?n=s[0]:(n=s[1],Xz(this.g.mul(n).x.cmp(this.g.x.redMul(r))===0))}var c;return t.basis?c=t.basis.map(function(l){return{a:new Mt.default(l.a,16),b:new Mt.default(l.b,16)}}):c=this._getEndoBasis(n),{beta:r,lambda:n,basis:c}}},"_getEndomorphism"),"_getEndomorphism");Ti.prototype._getEndoRoots=o(i(function(t){var r=t===this.p?this.red:Mt.default.mont(t),n=new Mt.default(2).toRed(r).redInvm(),a=n.redNeg(),s=new Mt.default(3).toRed(r).redNeg().redSqrt().redMul(n),c=a.redAdd(s).fromRed(),l=a.redSub(s).fromRed();return[c,l]},"_getEndoRoots"),"_getEndoRoots");Ti.prototype._getEndoBasis=o(i(function(t){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=t,a=this.n.clone(),s=new Mt.default(1),c=new Mt.default(0),l=new Mt.default(0),h=new Mt.default(1),p,g,v,y,_,x,O,D=0,P,J;n.cmpn(0)!==0;){var j=a.div(n);P=a.sub(j.mul(n)),J=l.sub(j.mul(s));var q=h.sub(j.mul(c));if(!v&&P.cmp(r)<0)p=O.neg(),g=s,v=P.neg(),y=J;else if(v&&++D===2)break;O=P,a=n,n=P,l=s,s=J,h=c,c=q}_=P.neg(),x=J;var Q=v.sqr().add(y.sqr()),Y=_.sqr().add(x.sqr());return Y.cmp(Q)>=0&&(_=p,x=g),v.negative&&(v=v.neg(),y=y.neg()),_.negative&&(_=_.neg(),x=x.neg()),[{a:v,b:y},{a:_,b:x}]},"_getEndoBasis"),"_getEndoBasis");Ti.prototype._endoSplit=o(i(function(t){var r=this.endo.basis,n=r[0],a=r[1],s=a.b.mul(t).divRound(this.n),c=n.b.neg().mul(t).divRound(this.n),l=s.mul(n.a),h=c.mul(a.a),p=s.mul(n.b),g=c.mul(a.b),v=t.sub(l).sub(h),y=p.add(g).neg();return{k1:v,k2:y}},"_endoSplit"),"_endoSplit");Ti.prototype.pointFromX=o(i(function(t,r){t=new Mt.default(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),a=n.redSqrt();if(a.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=a.fromRed().isOdd();return(r&&!s||!r&&s)&&(a=a.redNeg()),this.point(t,a)},"pointFromX"),"pointFromX");Ti.prototype.validate=o(i(function(t){if(t.inf)return!0;var r=t.x,n=t.y,a=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(a).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},"validate3"),"validate");Ti.prototype._endoWnafMulAdd=o(i(function(t,r,n){for(var a=this._endoWnafT1,s=this._endoWnafT2,c=0;c<t.length;c++){var l=this._endoSplit(r[c]),h=t[c],p=h._getBeta();l.k1.negative&&(l.k1.ineg(),h=h.neg(!0)),l.k2.negative&&(l.k2.ineg(),p=p.neg(!0)),a[c*2]=h,a[c*2+1]=p,s[c*2]=l.k1,s[c*2+1]=l.k2}for(var g=this._wnafMulAdd(1,a,s,c*2,n),v=0;v<c*2;v++)a[v]=null,s[v]=null;return g},"_endoWnafMulAdd"),"_endoWnafMulAdd");function Yr(e,t,r,n){zc.BasePoint.call(this,e,"affine"),t===null&&r===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new Mt.default(t,16),this.y=new Mt.default(r,16),n&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}i(Yr,"Point");o(Yr,"Point");t2(Yr,zc.BasePoint);Ti.prototype.point=o(i(function(t,r,n){return new Yr(this,t,r,n)},"point2"),"point");Ti.prototype.pointFromJSON=o(i(function(t,r){return Yr.fromJSON(this,t,r)},"pointFromJSON"),"pointFromJSON");Yr.prototype._getBeta=o(i(function(){if(!!this.curve.endo){var t=this.precomputed;if(t&&t.beta)return t.beta;var r=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(t){var n=this.curve,a=o(function(s){return n.point(s.x.redMul(n.endo.beta),s.y)},"endoMul");t.beta=r,r.precomputed={beta:null,naf:t.naf&&{wnd:t.naf.wnd,points:t.naf.points.map(a)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(a)}}}return r}},"_getBeta2"),"_getBeta");Yr.prototype.toJSON=o(i(function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},"toJSON"),"toJSON");Yr.fromJSON=o(i(function(t,r,n){typeof r=="string"&&(r=JSON.parse(r));var a=t.point(r[0],r[1],n);if(!r[2])return a;function s(l){return t.point(l[0],l[1],n)}i(s,"obj2point"),o(s,"obj2point");var c=r[2];return a.precomputed={beta:null,doubles:c.doubles&&{step:c.doubles.step,points:[a].concat(c.doubles.points.map(s))},naf:c.naf&&{wnd:c.naf.wnd,points:[a].concat(c.naf.points.map(s))}},a},"fromJSON"),"fromJSON");Yr.prototype.inspect=o(i(function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},"inspect"),"inspect");Yr.prototype.isInfinity=o(i(function(){return this.inf},"isInfinity"),"isInfinity");Yr.prototype.add=o(i(function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var r=this.y.redSub(t.y);r.cmpn(0)!==0&&(r=r.redMul(this.x.redSub(t.x).redInvm()));var n=r.redSqr().redISub(this.x).redISub(t.x),a=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,a)},"add"),"add");Yr.prototype.dbl=o(i(function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var r=this.curve.a,n=this.x.redSqr(),a=t.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(a),c=s.redSqr().redISub(this.x.redAdd(this.x)),l=s.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,l)},"dbl"),"dbl");Yr.prototype.getX=o(i(function(){return this.x.fromRed()},"getX"),"getX");Yr.prototype.getY=o(i(function(){return this.y.fromRed()},"getY"),"getY");Yr.prototype.mul=o(i(function(t){return t=new Mt.default(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)},"mul"),"mul");Yr.prototype.mulAdd=o(i(function(t,r,n){var a=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(a,s):this.curve._wnafMulAdd(1,a,s,2)},"mulAdd"),"mulAdd");Yr.prototype.jmulAdd=o(i(function(t,r,n){var a=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(a,s,!0):this.curve._wnafMulAdd(1,a,s,2,!0)},"jmulAdd"),"jmulAdd");Yr.prototype.eq=o(i(function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)},"eq2"),"eq");Yr.prototype.neg=o(i(function(t){if(this.inf)return this;var r=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,a=o(function(s){return s.neg()},"negate");r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(a)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(a)}}}return r},"neg"),"neg");Yr.prototype.toJ=o(i(function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t},"toJ"),"toJ");function rn(e,t,r,n){zc.BasePoint.call(this,e,"jacobian"),t===null&&r===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Mt.default(0)):(this.x=new Mt.default(t,16),this.y=new Mt.default(r,16),this.z=new Mt.default(n,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}i(rn,"JPoint");o(rn,"JPoint");t2(rn,zc.BasePoint);Ti.prototype.jpoint=o(i(function(t,r,n){return new rn(this,t,r,n)},"jpoint"),"jpoint");rn.prototype.toP=o(i(function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),a=this.y.redMul(r).redMul(t);return this.curve.point(n,a)},"toP"),"toP");rn.prototype.neg=o(i(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg2"),"neg");rn.prototype.add=o(i(function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),a=this.x.redMul(r),s=t.x.redMul(n),c=this.y.redMul(r.redMul(t.z)),l=t.y.redMul(n.redMul(this.z)),h=a.redSub(s),p=c.redSub(l);if(h.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var g=h.redSqr(),v=g.redMul(h),y=a.redMul(g),_=p.redSqr().redIAdd(v).redISub(y).redISub(y),x=p.redMul(y.redISub(_)).redISub(c.redMul(v)),O=this.z.redMul(t.z).redMul(h);return this.curve.jpoint(_,x,O)},"add2"),"add");rn.prototype.mixedAdd=o(i(function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,a=t.x.redMul(r),s=this.y,c=t.y.redMul(r).redMul(this.z),l=n.redSub(a),h=s.redSub(c);if(l.cmpn(0)===0)return h.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var p=l.redSqr(),g=p.redMul(l),v=n.redMul(p),y=h.redSqr().redIAdd(g).redISub(v).redISub(v),_=h.redMul(v.redISub(y)).redISub(s.redMul(g)),x=this.z.redMul(l);return this.curve.jpoint(y,_,x)},"mixedAdd"),"mixedAdd");rn.prototype.dblp=o(i(function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var r;if(this.curve.zeroA||this.curve.threeA){var n=this;for(r=0;r<t;r++)n=n.dbl();return n}var a=this.curve.a,s=this.curve.tinv,c=this.x,l=this.y,h=this.z,p=h.redSqr().redSqr(),g=l.redAdd(l);for(r=0;r<t;r++){var v=c.redSqr(),y=g.redSqr(),_=y.redSqr(),x=v.redAdd(v).redIAdd(v).redIAdd(a.redMul(p)),O=c.redMul(y),D=x.redSqr().redISub(O.redAdd(O)),P=O.redISub(D),J=x.redMul(P);J=J.redIAdd(J).redISub(_);var j=g.redMul(h);r+1<t&&(p=p.redMul(_)),c=D,h=j,g=J}return this.curve.jpoint(c,g.redMul(s),h)},"dblp2"),"dblp");rn.prototype.dbl=o(i(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl2"),"dbl");rn.prototype._zeroDbl=o(i(function(){var t,r,n;if(this.zOne){var a=this.x.redSqr(),s=this.y.redSqr(),c=s.redSqr(),l=this.x.redAdd(s).redSqr().redISub(a).redISub(c);l=l.redIAdd(l);var h=a.redAdd(a).redIAdd(a),p=h.redSqr().redISub(l).redISub(l),g=c.redIAdd(c);g=g.redIAdd(g),g=g.redIAdd(g),t=p,r=h.redMul(l.redISub(p)).redISub(g),n=this.y.redAdd(this.y)}else{var v=this.x.redSqr(),y=this.y.redSqr(),_=y.redSqr(),x=this.x.redAdd(y).redSqr().redISub(v).redISub(_);x=x.redIAdd(x);var O=v.redAdd(v).redIAdd(v),D=O.redSqr(),P=_.redIAdd(_);P=P.redIAdd(P),P=P.redIAdd(P),t=D.redISub(x).redISub(x),r=O.redMul(x.redISub(t)).redISub(P),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(t,r,n)},"_zeroDbl"),"_zeroDbl");rn.prototype._threeDbl=o(i(function(){var t,r,n;if(this.zOne){var a=this.x.redSqr(),s=this.y.redSqr(),c=s.redSqr(),l=this.x.redAdd(s).redSqr().redISub(a).redISub(c);l=l.redIAdd(l);var h=a.redAdd(a).redIAdd(a).redIAdd(this.curve.a),p=h.redSqr().redISub(l).redISub(l);t=p;var g=c.redIAdd(c);g=g.redIAdd(g),g=g.redIAdd(g),r=h.redMul(l.redISub(p)).redISub(g),n=this.y.redAdd(this.y)}else{var v=this.z.redSqr(),y=this.y.redSqr(),_=this.x.redMul(y),x=this.x.redSub(v).redMul(this.x.redAdd(v));x=x.redAdd(x).redIAdd(x);var O=_.redIAdd(_);O=O.redIAdd(O);var D=O.redAdd(O);t=x.redSqr().redISub(D),n=this.y.redAdd(this.z).redSqr().redISub(y).redISub(v);var P=y.redSqr();P=P.redIAdd(P),P=P.redIAdd(P),P=P.redIAdd(P),r=x.redMul(O.redISub(t)).redISub(P)}return this.curve.jpoint(t,r,n)},"_threeDbl"),"_threeDbl");rn.prototype._dbl=o(i(function(){var t=this.curve.a,r=this.x,n=this.y,a=this.z,s=a.redSqr().redSqr(),c=r.redSqr(),l=n.redSqr(),h=c.redAdd(c).redIAdd(c).redIAdd(t.redMul(s)),p=r.redAdd(r);p=p.redIAdd(p);var g=p.redMul(l),v=h.redSqr().redISub(g.redAdd(g)),y=g.redISub(v),_=l.redSqr();_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_);var x=h.redMul(y).redISub(_),O=n.redAdd(n).redMul(a);return this.curve.jpoint(v,x,O)},"_dbl"),"_dbl");rn.prototype.trpl=o(i(function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),a=r.redSqr(),s=t.redAdd(t).redIAdd(t),c=s.redSqr(),l=this.x.redAdd(r).redSqr().redISub(t).redISub(a);l=l.redIAdd(l),l=l.redAdd(l).redIAdd(l),l=l.redISub(c);var h=l.redSqr(),p=a.redIAdd(a);p=p.redIAdd(p),p=p.redIAdd(p),p=p.redIAdd(p);var g=s.redIAdd(l).redSqr().redISub(c).redISub(h).redISub(p),v=r.redMul(g);v=v.redIAdd(v),v=v.redIAdd(v);var y=this.x.redMul(h).redISub(v);y=y.redIAdd(y),y=y.redIAdd(y);var _=this.y.redMul(g.redMul(p.redISub(g)).redISub(l.redMul(h)));_=_.redIAdd(_),_=_.redIAdd(_),_=_.redIAdd(_);var x=this.z.redAdd(l).redSqr().redISub(n).redISub(h);return this.curve.jpoint(y,_,x)},"trpl"),"trpl");rn.prototype.mul=o(i(function(t,r){return t=new Mt.default(t,r),this.curve._wnafMul(this,t)},"mul2"),"mul");rn.prototype.eq=o(i(function(t){if(t.type==="affine")return this.eq(t.toJ());if(this===t)return!0;var r=this.z.redSqr(),n=t.z.redSqr();if(this.x.redMul(n).redISub(t.x.redMul(r)).cmpn(0)!==0)return!1;var a=r.redMul(this.z),s=n.redMul(t.z);return this.y.redMul(s).redISub(t.y.redMul(a)).cmpn(0)===0},"eq3"),"eq");rn.prototype.eqXToP=o(i(function(t){var r=this.z.redSqr(),n=t.toRed(this.curve.red).redMul(r);if(this.x.cmp(n)===0)return!0;for(var a=t.clone(),s=this.curve.redN.redMul(r);;){if(a.iadd(this.curve.n),a.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},"eqXToP"),"eqXToP");rn.prototype.inspect=o(i(function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},"inspect2"),"inspect");rn.prototype.isInfinity=o(i(function(){return this.z.cmpn(0)===0},"isInfinity2"),"isInfinity");var C0=$c(function(e,t){"use strict";var r=t;r.base=zc,r.short=Qz,r.mont=null,r.edwards=null}),M0=$c(function(e,t){"use strict";var r=t,n=Si.assert;function a(l){l.type==="short"?this.curve=new C0.short(l):l.type==="edwards"?this.curve=new C0.edwards(l):this.curve=new C0.mont(l),this.g=this.curve.g,this.n=this.curve.n,this.hash=l.hash,n(this.g.validate(),"Invalid curve"),n(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}i(a,"PresetCurve"),o(a,"PresetCurve"),r.PresetCurve=a;function s(l,h){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var p=new a(h);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:p}),p}})}i(s,"defineCurve"),o(s,"defineCurve"),s("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Ao.default.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),s("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Ao.default.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),s("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Ao.default.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),s("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Ao.default.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),s("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Ao.default.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),s("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ao.default.sha256,gRed:!1,g:["9"]}),s("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Ao.default.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var c;try{c=null.crash()}catch{c=void 0}s("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Ao.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function Co(e){if(!(this instanceof Co))return new Co(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=da.toArray(e.entropy,e.entropyEnc||"hex"),r=da.toArray(e.nonce,e.nonceEnc||"hex"),n=da.toArray(e.pers,e.persEnc||"hex");Q6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}i(Co,"HmacDRBG");o(Co,"HmacDRBG");var gM=Co;Co.prototype._init=o(i(function(t,r,n){var a=t.concat(r).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var s=0;s<this.V.length;s++)this.K[s]=0,this.V[s]=1;this._update(a),this._reseed=1,this.reseedInterval=281474976710656},"init"),"init");Co.prototype._hmac=o(i(function(){return new Ao.default.hmac(this.hash,this.K)},"hmac"),"hmac");Co.prototype._update=o(i(function(t){var r=this._hmac().update(this.V).update([0]);t&&(r=r.update(t)),this.K=r.digest(),this.V=this._hmac().update(this.V).digest(),t&&(this.K=this._hmac().update(this.V).update([1]).update(t).digest(),this.V=this._hmac().update(this.V).digest())},"update"),"update");Co.prototype.reseed=o(i(function(t,r,n,a){typeof r!="string"&&(a=n,n=r,r=null),t=da.toArray(t,r),n=da.toArray(n,a),Q6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},"reseed"),"reseed");Co.prototype.generate=o(i(function(t,r,n,a){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(a=n,n=r,r=null),n&&(n=da.toArray(n,a||"hex"),this._update(n));for(var s=[];s.length<t;)this.V=this._hmac().update(this.V).digest(),s=s.concat(this.V);var c=s.slice(0,t);return this._update(n),this._reseed++,da.encode(c,r)},"generate"),"generate");var Bb=Si.assert;function fn(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}i(fn,"KeyPair");o(fn,"KeyPair");var r2=fn;fn.fromPublic=o(i(function(t,r,n){return r instanceof fn?r:new fn(t,{pub:r,pubEnc:n})},"fromPublic"),"fromPublic");fn.fromPrivate=o(i(function(t,r,n){return r instanceof fn?r:new fn(t,{priv:r,privEnc:n})},"fromPrivate"),"fromPrivate");fn.prototype.validate=o(i(function(){var t=this.getPublic();return t.isInfinity()?{result:!1,reason:"Invalid public key"}:t.validate()?t.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},"validate4"),"validate");fn.prototype.getPublic=o(i(function(t,r){return typeof t=="string"&&(r=t,t=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),r?this.pub.encode(r,t):this.pub},"getPublic"),"getPublic");fn.prototype.getPrivate=o(i(function(t){return t==="hex"?this.priv.toString(16,2):this.priv},"getPrivate"),"getPrivate");fn.prototype._importPrivate=o(i(function(t,r){this.priv=new Mt.default(t,r||16),this.priv=this.priv.umod(this.ec.curve.n)},"_importPrivate"),"_importPrivate");fn.prototype._importPublic=o(i(function(t,r){if(t.x||t.y){this.ec.curve.type==="mont"?Bb(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Bb(t.x&&t.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(t.x,t.y);return}this.pub=this.ec.curve.decodePoint(t,r)},"_importPublic"),"_importPublic");fn.prototype.derive=o(i(function(t){return t.validate()||Bb(t.validate(),"public point not validated"),t.mul(this.priv).getX()},"derive"),"derive");fn.prototype.sign=o(i(function(t,r,n){return this.ec.sign(t,this,r,n)},"sign2"),"sign");fn.prototype.verify=o(i(function(t,r,n){return this.ec.verify(t,r,this,void 0,n)},"verify2"),"verify");fn.prototype.inspect=o(i(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect3"),"inspect");var eH=Si.assert;function Id(e,t){if(e instanceof Id)return e;this._importDER(e,t)||(eH(e.r&&e.s,"Signature without r or s"),this.r=new Mt.default(e.r,16),this.s=new Mt.default(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}i(Id,"Signature");o(Id,"Signature");var zm=Id;function vM(){this.place=0}i(vM,"Position");o(vM,"Position");function I0(e,t){var r=e[t.place++];if(!(r&128))return r;var n=r&15;if(n===0||n>4||e[t.place]===0)return!1;for(var a=0,s=0,c=t.place;s<n;s++,c++)a<<=8,a|=e[c],a>>>=0;return a<=127?!1:(t.place=c,a)}i(I0,"getLength");o(I0,"getLength");function Lb(e){for(var t=0,r=e.length-1;!e[t]&&!(e[t+1]&128)&&t<r;)t++;return t===0?e:e.slice(t)}i(Lb,"rmPadding");o(Lb,"rmPadding");Id.prototype._importDER=o(i(function(t,r){t=Si.toArray(t,r);var n=new vM;if(t[n.place++]!==48)return!1;var a=I0(t,n);if(a===!1||a+n.place!==t.length||t[n.place++]!==2)return!1;var s=I0(t,n);if(s===!1||(t[n.place]&128)!==0)return!1;var c=t.slice(n.place,s+n.place);if(n.place+=s,t[n.place++]!==2)return!1;var l=I0(t,n);if(l===!1||t.length!==l+n.place||(t[n.place]&128)!==0)return!1;var h=t.slice(n.place,l+n.place);if(c[0]===0)if(c[1]&128)c=c.slice(1);else return!1;if(h[0]===0)if(h[1]&128)h=h.slice(1);else return!1;return this.r=new Mt.default(c),this.s=new Mt.default(h),this.recoveryParam=null,!0},"_importDER"),"_importDER");function k0(e,t){if(t<128){e.push(t);return}var r=1+(Math.log(t)/Math.LN2>>>3);for(e.push(r|128);--r;)e.push(t>>>(r<<3)&255);e.push(t)}i(k0,"constructLength");o(k0,"constructLength");Id.prototype.toDER=o(i(function(t){var r=this.r.toArray(),n=this.s.toArray();for(r[0]&128&&(r=[0].concat(r)),n[0]&128&&(n=[0].concat(n)),r=Lb(r),n=Lb(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var a=[2];k0(a,r.length),a=a.concat(r),a.push(2),k0(a,n.length);var s=a.concat(n),c=[48];return k0(c,s.length),c=c.concat(s),Si.encode(c,t)},"toDER"),"toDER");var tH=o(function(){throw new Error("unsupported")},"rand"),bc=Si.assert;function Ei(e){if(!(this instanceof Ei))return new Ei(e);typeof e=="string"&&(bc(Object.prototype.hasOwnProperty.call(M0,e),"Unknown curve "+e),e=M0[e]),e instanceof M0.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}i(Ei,"EC");o(Ei,"EC");var rH=Ei;Ei.prototype.keyPair=o(i(function(t){return new r2(this,t)},"keyPair"),"keyPair");Ei.prototype.keyFromPrivate=o(i(function(t,r){return r2.fromPrivate(this,t,r)},"keyFromPrivate"),"keyFromPrivate");Ei.prototype.keyFromPublic=o(i(function(t,r){return r2.fromPublic(this,t,r)},"keyFromPublic"),"keyFromPublic");Ei.prototype.genKeyPair=o(i(function(t){t||(t={});for(var r=new gM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||tH(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),a=this.n.sub(new Mt.default(2));;){var s=new Mt.default(r.generate(n));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},"genKeyPair"),"genKeyPair");Ei.prototype._truncateToN=o(i(function(t,r,n){var a;if(Mt.default.isBN(t)||typeof t=="number")t=new Mt.default(t,16),a=t.byteLength();else if(typeof t=="object")a=t.length,t=new Mt.default(t,16);else{var s=t.toString();a=s.length+1>>>1,t=new Mt.default(s,16)}typeof n!="number"&&(n=a*8);var c=n-this.n.bitLength();return c>0&&(t=t.ushrn(c)),!r&&t.cmp(this.n)>=0?t.sub(this.n):t},"_truncateToN"),"_truncateToN");Ei.prototype.sign=o(i(function(t,r,n,a){if(typeof n=="object"&&(a=n,n=null),a||(a={}),typeof t!="string"&&typeof t!="number"&&!Mt.default.isBN(t)){bc(typeof t=="object"&&t&&typeof t.length=="number","Expected message to be an array-like, a hex string, or a BN instance"),bc(t.length>>>0===t.length);for(var s=0;s<t.length;s++)bc((t[s]&255)===t[s])}r=this.keyFromPrivate(r,n),t=this._truncateToN(t,!1,a.msgBitLength),bc(!t.isNeg(),"Can not sign a negative message");var c=this.n.byteLength(),l=r.getPrivate().toArray("be",c),h=t.toArray("be",c);bc(new Mt.default(h).eq(t),"Can not sign message");for(var p=new gM({hash:this.hash,entropy:l,nonce:h,pers:a.pers,persEnc:a.persEnc||"utf8"}),g=this.n.sub(new Mt.default(1)),v=0;;v++){var y=a.k?a.k(v):new Mt.default(p.generate(this.n.byteLength()));if(y=this._truncateToN(y,!0),!(y.cmpn(1)<=0||y.cmp(g)>=0)){var _=this.g.mul(y);if(!_.isInfinity()){var x=_.getX(),O=x.umod(this.n);if(O.cmpn(0)!==0){var D=y.invm(this.n).mul(O.mul(r.getPrivate()).iadd(t));if(D=D.umod(this.n),D.cmpn(0)!==0){var P=(_.getY().isOdd()?1:0)|(x.cmp(O)!==0?2:0);return a.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),P^=1),new zm({r:O,s:D,recoveryParam:P})}}}}}},"sign3"),"sign");Ei.prototype.verify=o(i(function(t,r,n,a,s){s||(s={}),t=this._truncateToN(t,!1,s.msgBitLength),n=this.keyFromPublic(n,a),r=new zm(r,"hex");var c=r.r,l=r.s;if(c.cmpn(1)<0||c.cmp(this.n)>=0||l.cmpn(1)<0||l.cmp(this.n)>=0)return!1;var h=l.invm(this.n),p=h.mul(t).umod(this.n),g=h.mul(c).umod(this.n),v;return this.curve._maxwellTrick?(v=this.g.jmulAdd(p,n.getPublic(),g),v.isInfinity()?!1:v.eqXToP(c)):(v=this.g.mulAdd(p,n.getPublic(),g),v.isInfinity()?!1:v.getX().umod(this.n).cmp(c)===0)},"verify3"),"verify");Ei.prototype.recoverPubKey=function(e,t,r,n){bc((3&r)===r,"The recovery param is more than two bits"),t=new zm(t,n);var a=this.n,s=new Mt.default(e),c=t.r,l=t.s,h=r&1,p=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&p)throw new Error("Unable to find sencond key candinate");p?c=this.curve.pointFromX(c.add(this.curve.n),h):c=this.curve.pointFromX(c,h);var g=t.r.invm(a),v=a.sub(s).mul(g).umod(a),y=l.mul(g).umod(a);return this.g.mulAdd(v,c,y)};Ei.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new zm(t,n),t.recoveryParam!==null)return t.recoveryParam;for(var a=0;a<4;a++){var s;try{s=this.recoverPubKey(e,t,a)}catch{continue}if(s.eq(r))return a}throw new Error("Unable to find valid recovery factor")};var nH=$c(function(e,t){"use strict";var r=t;r.version="6.6.1",r.utils=Si,r.rand=function(){throw new Error("unsupported")},r.curve=C0,r.curves=M0,r.ec=rH,r.eddsa=null}),iH=nH.ec,aH="signing-key/5.8.0",Ub=new br(aH),ib=null;function fa(){return ib||(ib=new iH("secp256k1")),ib}i(fa,"getCurve");o(fa,"getCurve");var yM=i(class{constructor(e){Bu(this,"curve","secp256k1"),Bu(this,"privateKey",Nn(e)),oM(this.privateKey)!==32&&Ub.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let t=fa().keyFromPrivate(qr(this.privateKey));Bu(this,"publicKey","0x"+t.getPublic(!1,"hex")),Bu(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),Bu(this,"_isSigningKey",!0)}_addPoint(e){let t=fa().keyFromPublic(qr(this.publicKey)),r=fa().keyFromPublic(qr(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){let t=fa().keyFromPrivate(qr(this.privateKey)),r=qr(e);r.length!==32&&Ub.throwArgumentError("bad digest length","digest",e);let n=t.sign(r,{canonical:!0});return Z6({recoveryParam:n.recoveryParam,r:xc("0x"+n.r.toString(16),32),s:xc("0x"+n.s.toString(16),32)})}computeSharedSecret(e){let t=fa().keyFromPrivate(qr(this.privateKey)),r=fa().keyFromPublic(qr(n2(e)));return xc("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}},"SigningKey");o(yM,"SigningKey");function bM(e,t){let r=Z6(t),n={r:qr(r.r),s:qr(r.s)};return"0x"+fa().recoverPubKey(qr(e),n,r.recoveryParam).encode("hex",!1)}i(bM,"recoverPublicKey");o(bM,"recoverPublicKey");function n2(e,t){let r=qr(e);if(r.length===32){let n=new yM(r);return t?"0x"+fa().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return t?Nn(r):"0x"+fa().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return t?"0x"+fa().keyFromPublic(r).getPublic(!0,"hex"):Nn(r)}return Ub.throwArgumentError("invalid public or private key","key","[REDACTED]")}i(n2,"computePublicKey");o(n2,"computePublicKey");var oH="transactions/5.8.0",WY=new br(oH),JA;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(JA||(JA={}));function wM(e){let t=n2(e);return lM(Nb($m(Nb(t,1)),12))}i(wM,"computeAddress");o(wM,"computeAddress");function _M(e,t){return wM(bM(qr(e),t))}i(_M,"recoverAddress");o(_M,"recoverAddress");var sH="wallet/5.8.0",JY=new br(sH);function Fb(e,t){return _M(pM(e),t)}i(Fb,"verifyMessage");o(Fb,"verifyMessage");function EM(){return{eip191:async(e,t)=>{AM(e,t)}}}i(EM,"getEIP191Verifier");o(EM,"getEIP191Verifier");var cH=new Date("2022-09-20").valueOf();function AM(e,t){W6(e),tM(e,t);let n=[Fb(Db.fromCacao(e).toMessage(),e.s.s).toLowerCase()];if(Date.parse(e.p.iat)<=cH){let s=Fb(QC(Db.fromCacao(e),"Ethereum"),e.s.s).toLowerCase();n.push(s)}let a=id.parse(e.p.iss.replace("did:pkh:","")).address.toLowerCase();if(!n.includes(a))throw new Error("Signature does not belong to issuer")}i(AM,"verifyEIP191Signature");o(AM,"verifyEIP191Signature");Ed();b6();var uH=ir(cl(),1);Ed();function SM(){return Ir((0,uH.randomBytes)(16),"base64")}i(SM,"randomString");o(SM,"randomString");var xM="base64pad",TM="base64url";function CM(e){return Ir(e,xM)}i(CM,"encodeBase64");o(CM,"encodeBase64");function MM(e){return Ir(e,TM)}i(MM,"encodeBase64Url");o(MM,"encodeBase64Url");function IM(e){return Cr(e,xM)}i(IM,"decodeBase64");o(IM,"decodeBase64");function D0(e){return JSON.parse(Ir(Cr(e,TM)))}i(D0,"base64urlToJSON");o(D0,"base64urlToJSON");function kM(e){if(e.signatures.length>1)throw new Error("Cant convert to compact jws");return`${e.signatures[0].protected}.${e.payload}.${e.signatures[0].signature}`}i(kM,"fromDagJWS");o(kM,"fromDagJWS");function DM(e,t){if(t){let r=t.toISOString().split(".")[0]+"Z";return`${e}?versionTime=${r}`}else return e}i(DM,"didWithTime");o(DM,"didWithTime");function RM(e){return e?Array.isArray(e)?e:[e]:[]}i(RM,"extractControllers");o(RM,"extractControllers");var lH={...EM()};function OM(e){return"registry"in e&&"cache"in e}i(OM,"isResolver");o(OM,"isResolver");var NM=i(class{get capability(){if(!this._capability)throw new Error("DID has no capability attached");return this._capability}get hasCapability(){return this._capability!=null}get parent(){if(!this._parentId)throw new Error("DID has no parent DID");return this._parentId}get hasParent(){return this._parentId!=null}get id(){if(this._id==null)throw new Error("DID is not authenticated");return this._id}get authenticated(){return this._id!=null}withCapability(e){return new NM({provider:this._client?.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new Ib(e);else if(this._client.connection!==e)throw new Error("A different provider is already set, create a new DID instance to use another provider")}setResolver(e,t){this._resolver=OM(e)?e:new Gx(e,t)}async authenticate({provider:e,paths:t=[],aud:r}={}){if(e!=null&&this.setProvider(e),this._client==null)throw new Error("No provider available");let n=SM(),a=await this._client.request("did_authenticate",{nonce:n,aud:r,paths:t}),{kid:s}=await this.verifyJWS(a),c=D0(a.payload);if(!s.includes(c.did))throw new Error("Invalid authencation response, kid mismatch");if(c.nonce!==n)throw new Error("Invalid authencation response, wrong nonce");if(c.aud!==r)throw new Error("Invalid authencation response, wrong aud");if(c.exp<Date.now()/1e3)throw new Error("Invalid authencation response, expired");return this._id=c.did,this._id}async createJWS(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");if(this._capability){let n=this._capability.p.exp;if(n&&Date.parse(n)<Date.now())throw new Error("Capability is expired, cannot create a valid signature");let a=await X0.fromCacao(this._capability),s=$t.asCID(a.cid);if(!s)throw new Error("Capability CID of the JWS cannot be set to the capability payload cid as they are incompatible");t.protected=t.protected||{},t.protected.cap=`ipfs://${s?.toString()}`}let{jws:r}=await this._client.request("did_createJWS",{did:this._id,...t,payload:e});return r}async createDagJWS(e,t={}){let{cid:r,linkedBlock:n}=await RC(e),a=MM(r.bytes);Object.assign(t,{linkedBlock:CM(n)});let s=await this.createJWS(a,t),c=$t.asCID(r);if(!c)throw new Error("CID of the JWS cannot be set to the encoded payload cid as they are incompatible");if(s.link=c,this._capability){let l=await X0.fromCacao(this._capability);return{jws:s,linkedBlock:n,cacaoBlock:l.bytes}}return{jws:s,linkedBlock:n}}async verifyJWS(e,t={}){t=Object.assign({verifiers:lH},t),typeof e!="string"&&(e=kM(e));let r=D0(e.split(".")[0]).kid;if(!r)throw new Error('No "kid" found in jws');let n=await this.resolve(r);if(!t.disableTimecheck){let h=n.didDocumentMetadata?.nextUpdate;if(h){let g=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0,v=new Date(h).valueOf()+g;if(!(t.atTime&&t.atTime.getTime()<v))throw new Error(`invalid_jws: signature authored with a revoked DID version: ${r}`)}let p=n.didDocumentMetadata?.updated;if(p&&t.atTime&&t.atTime.getTime()<new Date(p).valueOf())throw new Error(`invalid_jws: signature authored before creation of DID version: ${r}`)}let s=n.didDocument?.id;if(t.issuer&&t.issuer===t.capability?.p.iss&&s===t.capability.p.aud){if(!t.verifiers)throw new Error("Registered verifiers needed for CACAO");await Y0.verify(t.capability,{disableExpirationCheck:t.disableTimecheck,atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs,verifiers:t.verifiers??{}})}else if(t.issuer&&t.issuer!==s){let h=DM(t.issuer,t.atTime),g=(await this.resolve(h)).didDocument?.controller,v=RM(g);if(t.capability?.s&&t.capability.p.aud===s&&v.includes(t.capability.p.iss))await Y0.verify(t.capability,{atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs,verifiers:t.verifiers??{}});else if(!(s?v.includes(s):!1))throw new Error(`invalid_jws: not a valid verificationMethod for issuer: ${r}`)}let c=n.didDocument?.verificationMethod||[];uT(e,c);let l;try{l=D0(e.split(".")[1])}catch{}return{kid:r,payload:l,didResolutionResult:n}}async createJWE(e,t,r={}){let n=await cz(t,this._resolver);return sz(e,n,r.protectedHeader,r.aad)}async createDagJWE(e,t,r={}){let n=await BC(e);return this.createJWE(n,t,r)}async decryptJWE(e,t={}){if(this._client==null)throw new Error("No provider available");if(this._id==null)throw new Error("DID is not authenticated");let{cleartext:r}=await this._client.request("did_decryptJWE",{did:this._id,...t,jwe:e});return IM(r)}async decryptDagJWE(e){let t=await this.decryptJWE(e);return LC(t)}async resolve(e){let t=await this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:r,message:n}=t.didResolutionMetadata,a=n?`, ${n}`:"";throw new Error(`Failed to resolve ${e}: ${r}${a}`)}return t}constructor({provider:e,resolver:t={},resolverOptions:r,capability:n,parent:a}={}){if(e!=null&&(this._client=new Ib(e)),n){if(this._capability=n,this._parentId=this._capability.p.iss,a&&this._parentId!==a)throw new Error("Capability issuer and parent not equal")}else a&&(this._parentId=a);this.setResolver(t,r)}},"DID");o(NM,"DID");function fH(e){var t=0,r=e.length,n=[];if(r%2)throw new Error("invalid hex:"+e);for(;t<r;t+=2)n.push(parseInt(e.substr(t,2),16));return new Uint8Array(n)}i(fH,"toUint8Array");o(fH,"toUint8Array");var ZA=ir(xm(),1);p6();var PM={};xr(PM,{keyToDidDoc:()=>BM});function BM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`;return{id:r,verificationMethod:[{id:n,type:"Secp256k1VerificationKey2018",controller:r,publicKeyBase58:Ir(e,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(BM,"keyToDidDoc");o(BM,"keyToDidDoc");var LM={};xr(LM,{keyToDidDoc:()=>FM});Ed();var dH=ir(_6(),1);function UM(e){let t=new Uint8Array(e.length+2);return t[0]=236,t[1]=1,t.set(e,2),`z${Ir(t,"base58btc")}`}i(UM,"encodeKey");o(UM,"encodeKey");function FM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,a=(0,dH.convertPublicKeyToX25519)(e),s=`${r}#${UM(a)}`;return{id:r,verificationMethod:[{id:n,type:"Ed25519VerificationKey2018",controller:r,publicKeyBase58:Ir(e,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n],keyAgreement:[{id:s,type:"X25519KeyAgreementKey2019",controller:r,publicKeyBase58:Ir(a,"base58btc")}]}}i(FM,"keyToDidDoc2");o(FM,"keyToDidDoc");var jM={};xr(jM,{keyToDidDoc:()=>eI,pubKeyBytesToXY:()=>s2});var $M={};xr($M,{ECPointDecompress:()=>JM});function zM(e){return e>=0?e:-e}i(zM,"n");o(zM,"n");function HM(e,t){if(typeof e=="number"&&(e=BigInt(e)),typeof t=="number"&&(t=BigInt(t)),e<=0n||t<=0n)throw new RangeError("a and b MUST be > 0");let r=0n,n=1n,a=1n,s=0n;for(;e!==0n;){let c=t/e,l=t%e,h=r-a*c,p=n-s*c;t=e,e=l,r=a,n=s,a=h,s=p}return{g:t,x:r,y:n}}i(HM,"r");o(HM,"r");function ad(e,t){if(typeof e=="number"&&(e=BigInt(e)),typeof t=="number"&&(t=BigInt(t)),t<=0n)throw new RangeError("n must be > 0");let r=e%t;return r<0n?r+t:r}i(ad,"e");o(ad,"e");function i2(e,t){let r=HM(ad(e,t),t);if(r.g!==1n)throw new RangeError(`${e.toString()} does not have inverse modulo ${t.toString()}`);return ad(r.x,t)}i(i2,"o");o(i2,"o");function qM(e,t,r){if(e.length!==t.length)throw new RangeError("The remainders and modulos arrays should have the same length");let n=r??t.reduce((a,s)=>a*s,1n);return t.reduce((a,s,c)=>{let l=n/s;return ad(a+l*i2(l,s)%n*e[c]%n,n)},0n)}i(qM,"i");o(qM,"i");function VM(e){return e.map(t=>t[0]**(t[1]-1n)*(t[0]-1n)).reduce((t,r)=>r*t,1n)}i(VM,"a");o(VM,"a");function Vu(e,t,r,n){if(typeof e=="number"&&(e=BigInt(e)),typeof t=="number"&&(t=BigInt(t)),typeof r=="number"&&(r=BigInt(r)),r<=0n)throw new RangeError("n must be > 0");if(r===1n)return 0n;if(e=ad(e,r),t<0n)return i2(Vu(e,zM(t),r,n),r);if(n!==void 0)return function(s,c,l,h){let p=h.map(y=>y[0]**y[1]),g=h.map(y=>VM([y])),v=g.map((y,_)=>Vu(s,c%y,p[_]));return qM(v,p,l)}(e,t,r,function(s){let c={};return s.forEach(l=>{if(typeof l=="bigint"||typeof l=="number"){let h=String(l);c[h]===void 0?c[h]={p:BigInt(l),k:1n}:c[h].k+=1n}else{let h=String(l[0]);c[h]===void 0?c[h]={p:BigInt(l[0]),k:BigInt(l[1])}:c[h].k+=BigInt(l[1])}}),Object.values(c).map(l=>[l.p,l.k])}(n));let a=1n;for(;t>0;)t%2n===1n&&(a=a*e%r),t/=2n,e=e**2n%r;return a}i(Vu,"s");o(Vu,"s");var Yn={};xr(Yn,{pubKeyBytesToHex:()=>KM,publicKeyHexToUint8ArrayPointPair:()=>a2,publicKeyIntToUint8ArrayPointPair:()=>o2,publicKeyIntToXY:()=>WM,publicKeyToXY:()=>GM,testHexString:()=>Hm,testUint8Array:()=>yl});m6();function KM(e){if(!yl(e))throw new TypeError("input must be a Uint8Array");return Ir(e,"base16")}i(KM,"pubKeyBytesToHex");o(KM,"pubKeyBytesToHex");function GM(e){if(!Hm(e))throw new TypeError("input must be string with characters 0-9,A-F,a-f");let t=a2(e),r=zu.encode(t.xOctet).slice(1),n=zu.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(GM,"publicKeyToXY");o(GM,"publicKeyToXY");function a2(e){if(!Hm(e))throw new TypeError("input must be string with characters 0-9,A-F,a-f");let t=e.slice(0,e.length/2),r=e.slice(e.length/2,e.length),n=Cr(t,"base16"),a=Cr(r,"base16");return{xOctet:n,yOctet:a}}i(a2,"publicKeyHexToUint8ArrayPointPair");o(a2,"publicKeyHexToUint8ArrayPointPair");function Hm(e){let t=/^[A-Fa-f0-9]+$/i;return!!(t.exec(e)!==null&&t.test(e)&&typeof e=="string")}i(Hm,"testHexString");o(Hm,"testHexString");function yl(e){return e==null?!1:e.constructor===Uint8Array}i(yl,"testUint8Array");o(yl,"testUint8Array");function WM(e){if(e==null)throw new TypeError("input cannot be null or undefined.");if(typeof e!="object")throw new TypeError("Input must be an object with properties x and y");if(!Object.prototype.hasOwnProperty.call(e,"x")||!Object.prototype.hasOwnProperty.call(e,"y"))throw new Error("Input must have properties x and y");if(typeof e.x!="bigint"&&typeof e.y!="bigint")throw new Error("Input coordinates must be BigInt");let t=o2(e),r=zu.encode(t.xOctet).slice(1),n=zu.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(WM,"publicKeyIntToXY");o(WM,"publicKeyIntToXY");function o2(e){if(e==null)throw new TypeError("input cannot be null or undefined.");if(typeof e!="object")throw new TypeError("Input must be an object with properties x and y");if(!Object.prototype.hasOwnProperty.call(e,"x")||!Object.prototype.hasOwnProperty.call(e,"y"))throw new Error("Input must have properties x and y");if(typeof e.x!="bigint"&&typeof e.y!="bigint")throw new Error("Input coordinates must be BigInt");let t=e.x.toString(),r=e.y.toString(),n=Cr(t,"base10"),a=Cr(r,"base10");return{xOctet:n,yOctet:a}}i(o2,"publicKeyIntToUint8ArrayPointPair");o(o2,"publicKeyIntToUint8ArrayPointPair");function JM(e){if(!yl(e))throw new TypeError("input must be a Uint8Array");let t=BigInt(2),r=t**256n-t**224n+t**192n+t**96n-1n,n=41058363725152142129326129780047268409114441015993725554835256314039467401291n,a=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Ir(c,"base10")),h=l**3n-l*3n+n,p=Vu(h,a,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(JM,"ECPointDecompress");o(JM,"ECPointDecompress");var ZM={};xr(ZM,{ECPointDecompress:()=>YM});function YM(e){if(!yl(e))throw new TypeError("input must be a Uint8Array");let t=BigInt(2),r=t**384n-t**128n-t**96n+t**32n-1n,n=27580193559959705877849011840389048093056905856361568521428707301988689241309860865136260764883745107765439761230575n,a=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Ir(c,"base10")),h=l**3n-l*3n+n,p=Vu(h,a,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(YM,"ECPointDecompress2");o(YM,"ECPointDecompress");var XM={};xr(XM,{ECPointDecompress:()=>QM});function QM(e){if(!yl(e))throw new TypeError("input must be a Uint8Array");let r=BigInt(2)**521n-1n,n=1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n,a=(r+1n)/4n,s=BigInt(e[0]-2),c=e.subarray(1),l=BigInt(Ir(c,"base10")),h=l**3n-l*3n+n,p=Vu(h,a,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(QM,"ECPointDecompress3");o(QM,"ECPointDecompress");function eI(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,a=s2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-256",x:a.xm,y:a.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(eI,"keyToDidDoc3");o(eI,"keyToDidDoc");function s2(e){if(!Yn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Yn.pubKeyBytesToHex(e),r=t.length/2;if(r==64)return Yn.publicKeyToXY(t);if(r==65&&t.slice(0,2)=="04"){let n=t.slice(2);return Yn.publicKeyToXY(n)}if(r==33&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=Cr(t,"base16"),a=$M.ECPointDecompress(n);return Yn.publicKeyIntToXY(a)}throw new Error("Unexpected pubKeyBytes")}i(s2,"pubKeyBytesToXY");o(s2,"pubKeyBytesToXY");var tI={};xr(tI,{keyToDidDoc:()=>rI,pubKeyBytesToXY:()=>c2});function rI(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,a=c2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-384",x:a.xm,y:a.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(rI,"keyToDidDoc4");o(rI,"keyToDidDoc");function c2(e){if(!Yn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Yn.pubKeyBytesToHex(e),r=t.length/2;if(r==96)return Yn.publicKeyToXY(t);if(r==97&&t.slice(0,2)=="04"){let n=t.slice(2);return Yn.publicKeyToXY(n)}if(r==49&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=Cr(t,"base16"),a=ZM.ECPointDecompress(n);return Yn.publicKeyIntToXY(a)}throw new Error("Unexpected pubKeyBytes")}i(c2,"pubKeyBytesToXY2");o(c2,"pubKeyBytesToXY");var nI={};xr(nI,{keyToDidDoc:()=>iI,pubKeyBytesToXY:()=>u2});function iI(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,a=u2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-521",x:a.xm,y:a.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(iI,"keyToDidDoc5");o(iI,"keyToDidDoc");function u2(e){if(!Yn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Yn.pubKeyBytesToHex(e);if(132<=t.length&&t.length<=134&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let r=Cr(t,"base16"),n=XM.ECPointDecompress(r);return Yn.publicKeyIntToXY(n)}throw new Error("Unexpected pubKeyBytes")}i(u2,"pubKeyBytesToXY3");o(u2,"pubKeyBytesToXY");var hH="application/did+ld+json",YA="application/did+json",pH={231:PM,237:LM,4608:jM,4609:tI,4610:nI};function mH(){return{key:async(e,t,r,n)=>{let a=n.accept||YA,s={didResolutionMetadata:{contentType:a},didDocument:null,didDocumentMetadata:{}};try{let c=ua.decode(t.id),l=ZA.default.decode(c),h=c.slice(ZA.default.decode.bytes),p=await pH[l].keyToDidDoc(h,t.id);a===hH?(p["@context"]="https://w3id.org/did/v1",s.didDocument=p):a===YA?s.didDocument=p:(delete s.didResolutionMetadata.contentType,s.didResolutionMetadata.error="representationNotSupported")}catch(c){s.didResolutionMetadata.error="invalidDid",s.didResolutionMetadata.message=c.toString()}return s}}}i(mH,"getResolver");o(mH,"getResolver");var aI=ir(_6(),1),gH=ir(M$(),1),vH="base64pad";function jb(e){return JSON.parse((0,gH.default)(e))}i(jb,"toStableObject");o(jb,"toStableObject");function oI(e){let t=new Uint8Array(e.length+2);return t[0]=237,t[1]=1,t.set(e,2),`did:key:z${Ir(t,"base58btc")}`}i(oI,"encodeDID");o(oI,"encodeDID");function $b(e){let[t,r,n]=e.split(".");return{payload:r,signatures:[{protected:t,signature:n}]}}i($b,"toGeneralJWS");o($b,"toGeneralJWS");var XA=o(async(e,t,r,n={})=>{let a=`${t}#${t.split(":")[2]}`,s=iT(r),c=jb(Object.assign(n,{kid:a,alg:"EdDSA"}));return iz(typeof e=="string"?e:jb(e),s,c)},"sign"),yH={did_authenticate:async({did:e,secretKey:t},r)=>{let n=await XA({did:e,aud:r.aud,nonce:r.nonce,paths:r.paths,exp:Math.floor(Date.now()/1e3)+600},e,t);return $b(n)},did_createJWS:async({did:e,secretKey:t},r)=>{if(r.did.split("#")[0]!==e)throw new bs(4100,`Unknown DID: ${e}`);let a=await XA(r.payload,e,t,r.protected);return{jws:$b(a)}},did_decryptJWE:async({secretKey:e},t)=>{let r=vT((0,aI.convertSecretKeyToX25519)(e));try{let n=await oz(t.jwe,r);return{cleartext:Ir(n,vH)}}catch(n){throw new bs(-32e3,n.message)}}},bH=i(class{constructor(e){let{secretKey:t,publicKey:r}=(0,aI.generateKeyPairFromSeed)(e),n=oI(r),a=ZC(yH);this._handle=async s=>await a({did:n,secretKey:t},s)}get isDidProvider(){return!0}async send(e){return await this._handle(e)}},"Ed25519Provider");o(bH,"Ed25519Provider");var sI={};xr(sI,{JsonPatchError:()=>Ur,_areEquals:()=>Ku,applyOperation:()=>ps,applyPatch:()=>qm,applyReducer:()=>uI,deepClone:()=>EH,getValueByPointer:()=>od,validate:()=>f2,validator:()=>sd});var wH=function(){var e=o(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,a){n.__proto__=a}||function(n,a){for(var s in a)a.hasOwnProperty(s)&&(n[s]=a[s])},e(t,r)},"extendStatics");return function(t,r){e(t,r);function n(){this.constructor=t}i(n,"__"),o(n,"__"),t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),_H=Object.prototype.hasOwnProperty;function rm(e,t){return _H.call(e,t)}i(rm,"hasOwnProperty");o(rm,"hasOwnProperty");function nm(e){if(Array.isArray(e)){for(var t=new Array(e.length),r=0;r<t.length;r++)t[r]=""+r;return t}if(Object.keys)return Object.keys(e);var n=[];for(var a in e)rm(e,a)&&n.push(a);return n}i(nm,"_objectKeys");o(nm,"_objectKeys");function Xn(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(Xn,"_deepClone");o(Xn,"_deepClone");function im(e){for(var t=0,r=e.length,n;t<r;){if(n=e.charCodeAt(t),n>=48&&n<=57){t++;continue}return!1}return!0}i(im,"isInteger2");o(im,"isInteger");function ds(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(ds,"escapePathComponent");o(ds,"escapePathComponent");function l2(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i(l2,"unescapePathComponent");o(l2,"unescapePathComponent");function am(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(am(e[t]))return!0}else if(typeof e=="object"){for(var n=nm(e),a=n.length,s=0;s<a;s++)if(am(e[n[s]]))return!0}}return!1}i(am,"hasUndefined");o(am,"hasUndefined");function zb(e,t){var r=[e];for(var n in t){var a=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof a<"u"&&r.push(n+": "+a)}return r.join(`
843
843
  `)}i(zb,"patchErrorMessageFormatter");o(zb,"patchErrorMessageFormatter");var cI=function(e){wH(t,e);function t(r,n,a,s,c){var l=this.constructor,h=e.call(this,zb(r,{name:n,index:a,operation:s,tree:c}))||this;return h.name=n,h.index=a,h.operation=s,h.tree=c,Object.setPrototypeOf(h,l.prototype),h.message=zb(r,{name:n,index:a,operation:s,tree:c}),h}return i(t,"PatchError2"),o(t,"PatchError"),t}(Error),Ur=cI,EH=Xn,Uu={add:function(e,t,r){return e[t]=this.value,{newDocument:r}},remove:function(e,t,r){var n=e[t];return delete e[t],{newDocument:r,removed:n}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:function(e,t,r){var n=od(r,this.path);n&&(n=Xn(n));var a=ps(r,{op:"remove",path:this.from}).removed;return ps(r,{op:"add",path:this.path,value:a}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=od(r,this.from);return ps(r,{op:"add",path:this.path,value:Xn(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:Ku(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},AH={add:function(e,t,r){return im(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:r,index:t}},remove:function(e,t,r){var n=e.splice(t,1);return{newDocument:r,removed:n[0]}},replace:function(e,t,r){var n=e[t];return e[t]=this.value,{newDocument:r,removed:n}},move:Uu.move,copy:Uu.copy,test:Uu.test,_get:Uu._get};function od(e,t){if(t=="")return e;var r={op:"_get",path:t};return ps(e,r),r.value}i(od,"getValueByPointer");o(od,"getValueByPointer");function ps(e,t,r,n,a,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),a===void 0&&(a=!0),s===void 0&&(s=0),r&&(typeof r=="function"?r(t,0,e,t.path):sd(t,0)),t.path===""){var c={newDocument:e};if(t.op==="add")return c.newDocument=t.value,c;if(t.op==="replace")return c.newDocument=t.value,c.removed=e,c;if(t.op==="move"||t.op==="copy")return c.newDocument=od(e,t.from),t.op==="move"&&(c.removed=e),c;if(t.op==="test"){if(c.test=Ku(e,t.value),c.test===!1)throw new Ur("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c.newDocument=e,c}else{if(t.op==="remove")return c.removed=e,c.newDocument=null,c;if(t.op==="_get")return t.value=e,c;if(r)throw new Ur("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,t,e);return c}}else{n||(e=Xn(e));var l=t.path||"",h=l.split("/"),p=e,g=1,v=h.length,y=void 0,_=void 0,x=void 0;for(typeof r=="function"?x=r:x=sd;;){if(_=h[g],_&&_.indexOf("~")!=-1&&(_=l2(_)),a&&(_=="__proto__"||_=="prototype"&&g>0&&h[g-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(r&&y===void 0&&(p[_]===void 0?y=h.slice(0,g).join("/"):g==v-1&&(y=t.path),y!==void 0&&x(t,0,e,y)),g++,Array.isArray(p)){if(_==="-")_=p.length;else{if(r&&!im(_))throw new Ur("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,t,e);im(_)&&(_=~~_)}if(g>=v){if(r&&t.op==="add"&&_>p.length)throw new Ur("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,t,e);var c=AH[t.op].call(t,p,_,e);if(c.test===!1)throw new Ur("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}}else if(g>=v){var c=Uu[t.op].call(t,p,_,e);if(c.test===!1)throw new Ur("Test operation failed","TEST_OPERATION_FAILED",s,t,e);return c}if(p=p[_],r&&g<v&&(!p||typeof p!="object"))throw new Ur("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,t,e)}}}i(ps,"applyOperation");o(ps,"applyOperation");function qm(e,t,r,n,a){if(n===void 0&&(n=!0),a===void 0&&(a=!0),r&&!Array.isArray(t))throw new Ur("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Xn(e));for(var s=new Array(t.length),c=0,l=t.length;c<l;c++)s[c]=ps(e,t[c],r,!0,a,c),e=s[c].newDocument;return s.newDocument=e,s}i(qm,"applyPatch");o(qm,"applyPatch");function uI(e,t,r){var n=ps(e,t);if(n.test===!1)throw new Ur("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}i(uI,"applyReducer");o(uI,"applyReducer");function sd(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Ur("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Uu[e.op]){if(typeof e.path!="string")throw new Ur("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Ur('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",t,e,r);if((e.op==="move"||e.op==="copy")&&typeof e.from!="string")throw new Ur("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&e.value===void 0)throw new Ur("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",t,e,r);if((e.op==="add"||e.op==="replace"||e.op==="test")&&am(e.value))throw new Ur("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",t,e,r);if(r){if(e.op=="add"){var a=e.path.split("/").length,s=n.split("/").length;if(a!==s+1&&a!==s)throw new Ur("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",t,e,r)}else if(e.op==="replace"||e.op==="remove"||e.op==="_get"){if(e.path!==n)throw new Ur("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",t,e,r)}else if(e.op==="move"||e.op==="copy"){var c={op:"_get",path:e.from,value:void 0},l=f2([c],r);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new Ur("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Ur("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}i(sd,"validator");o(sd,"validator");function f2(e,t,r){try{if(!Array.isArray(e))throw new Ur("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)qm(Xn(t),Xn(e),r||!0);else{r=r||sd;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(a){if(a instanceof Ur)return a;throw a}}i(f2,"validate5");o(f2,"validate");function Ku(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){var r=Array.isArray(e),n=Array.isArray(t),a,s,c;if(r&&n){if(s=e.length,s!=t.length)return!1;for(a=s;a--!==0;)if(!Ku(e[a],t[a]))return!1;return!0}if(r!=n)return!1;var l=Object.keys(e);if(s=l.length,s!==Object.keys(t).length)return!1;for(a=s;a--!==0;)if(!t.hasOwnProperty(l[a]))return!1;for(a=s;a--!==0;)if(c=l[a],!Ku(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(Ku,"_areEquals");o(Ku,"_areEquals");var lI={};xr(lI,{compare:()=>gI,generate:()=>om,observe:()=>mI,unobserve:()=>pI});var d2=new WeakMap,SH=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror2"),o(e,"Mirror"),e}(),xH=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo2"),o(e,"ObserverInfo"),e}();function fI(e){return d2.get(e)}i(fI,"getMirror");o(fI,"getMirror");function dI(e,t){return e.observers.get(t)}i(dI,"getObserverFromMirror");o(dI,"getObserverFromMirror");function hI(e,t){e.observers.delete(t.callback)}i(hI,"removeObserverFromMirror");o(hI,"removeObserverFromMirror");function pI(e,t){t.unobserve()}i(pI,"unobserve");o(pI,"unobserve");function mI(e,t){var r=[],n,a=fI(e);if(!a)a=new SH(e),d2.set(e,a);else{var s=dI(a,t);n=s&&s.observer}if(n)return n;if(n={},a.value=Xn(e),t){n.callback=t,n.next=null;var c=o(function(){om(n)},"dirtyCheck"),l=o(function(){clearTimeout(n.next),n.next=setTimeout(c)},"fastCheck");typeof window<"u"&&(window.addEventListener("mouseup",l),window.addEventListener("keyup",l),window.addEventListener("mousedown",l),window.addEventListener("keydown",l),window.addEventListener("change",l))}return n.patches=r,n.object=e,n.unobserve=function(){om(n),clearTimeout(n.next),hI(a,n),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},a.observers.set(t,new xH(t,n)),n}i(mI,"observe");o(mI,"observe");function om(e,t){t===void 0&&(t=!1);var r=d2.get(e.object);Vm(r.value,e.object,e.patches,"",t),e.patches.length&&qm(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(om,"generate2");o(om,"generate");function Vm(e,t,r,n,a){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=nm(t),c=nm(e),l=!1,h=!1,p=c.length-1;p>=0;p--){var g=c[p],v=e[g];if(rm(t,g)&&!(t[g]===void 0&&v!==void 0&&Array.isArray(t)===!1)){var y=t[g];typeof v=="object"&&v!=null&&typeof y=="object"&&y!=null&&Array.isArray(v)===Array.isArray(y)?Vm(v,y,r,n+"/"+ds(g),a):v!==y&&(l=!0,a&&r.push({op:"test",path:n+"/"+ds(g),value:Xn(v)}),r.push({op:"replace",path:n+"/"+ds(g),value:Xn(y)}))}else Array.isArray(e)===Array.isArray(t)?(a&&r.push({op:"test",path:n+"/"+ds(g),value:Xn(v)}),r.push({op:"remove",path:n+"/"+ds(g)}),h=!0):(a&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),l=!0)}if(!(!h&&s.length==c.length))for(var p=0;p<s.length;p++){var g=s[p];!rm(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+ds(g),value:Xn(t[g])})}}}i(Vm,"_generate");o(Vm,"_generate");function gI(e,t,r){r===void 0&&(r=!1);var n=[];return Vm(e,t,n,"",r),n}i(gI,"compare3");o(gI,"compare");var vI=Object.assign({},sI,lI,{JsonPatchError:cI,deepClone:Xn,escapePathComponent:ds,unescapePathComponent:l2}),TH=ir(Sd(),1),CH=ir(cl(),1),ei;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(ei||(ei={}));var QA=ir(Sd(),1);Ga();_d();var yI={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function bI(e){let t=yI[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(bI,"codeByName");o(bI,"codeByName");function wI(e){let t=Object.entries(yI).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(wI,"nameByCode");o(wI,"nameByCode");var Mo=i(class{},"StreamType");o(Mo,"StreamType");Mo.nameByCode=wI;Mo.codeByName=bI;var eS=ir(xm(),1);function Ji(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(a,s,c)=>{if(c.value!=null)c.value=Hb(c.value,t,r,n);else if(c.get!=null)c.get=Hb(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(Ji,"Memoize");o(Ji,"Memoize");var ab=new Map;function Hb(e,t,r=0,n){let a=Symbol("__memoized_map__");return function(...s){let c;this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let l=this[a];if(Array.isArray(n))for(let h of n)ab.has(h)?ab.get(h).push(l):ab.set(h,[l]);if(t||s.length>0||r>0){let h;t===!0?h=s.map(v=>v.toString()).join("!"):t?h=t.apply(this,s):h=s[0];let p=`${h}__timestamp`,g=!1;if(r>0)if(!l.has(p))g=!0;else{let v=l.get(p);g=Date.now()-v>r}l.has(h)&&!g?c=l.get(h):(c=e.apply(this,s),l.set(h,c),r>0&&l.set(p,Date.now()))}else{let h=this;l.has(h)?c=l.get(h):(c=e.apply(this,s),l.set(h,c))}return c}}i(Hb,"getNewFunction");o(Hb,"getNewFunction");var h2=206;Ga();_d();bm();var tS=ir(xm(),1);function kd(e){try{return e()}catch(t){return t}}i(kd,"tryCatch");o(kd,"tryCatch");Ga();var rS=ir(xm(),1);al();function _c(e){let t=rS.default.decode(e),r=rS.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(_c,"readVarint");o(_c,"readVarint");function _I(e){return e===0||e===1}i(_I,"isCidVersion");o(_I,"isCidVersion");function qb(e){let[t,r]=_c(e);if(!_I(t))throw new Error(`Unknown CID version ${t}`);let[n,a]=_c(r),[,s,c]=_c(a),[l,,h]=_c(s),p=a.subarray(0,c+h+l),g=a.subarray(c+h+l);return[$t.create(t,n,v6(p)),g]}i(qb,"readCid");o(qb,"readCid");Ga();_d();function Dd(e,t="StreamRef"){let[r,n]=_c(e);if(r!==h2)throw new Error(`Invalid ${t}, does not include streamid codec`);let[a,s]=_c(n),c=qb(s),[l,h]=c;if(h.length===0)return{kind:"stream-id",type:a,genesis:l};if(h.length===1&&h[0]===0)return{kind:"commit-id",type:a,genesis:l,commit:null};{let[p]=qb(h);return{kind:"commit-id",type:a,genesis:l,commit:p}}}i(Dd,"fromBytes");o(Dd,"fromBytes");var MH=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function Km(e,t="StreamRef"){let r=MH.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let a=Ss.decode(n),s=Dd(a),c=r[4];return c?{kind:"commit-id",type:s.type,genesis:s.genesis,commit:p2(s.genesis,c)}:s}i(Km,"fromString4");o(Km,"fromString");function EI(e){try{return typeof e=="string"?$t.parse(e):$t.asCID(e)}catch{return null}}i(EI,"parseCID");o(EI,"parseCID");function p2(e,t=null){if(!t||t==="0")return null;let r=EI(t);if(r)return e.equals(r)?null:r;throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)")}i(p2,"parseCommit");o(p2,"parseCommit");var Rd=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate"),Ki=i(function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},"__metadata"),AI=i(class extends Error{constructor(e){super(`Invalid StreamID bytes ${Ss.encode(e)}: contains commit`)}},"InvalidStreamIDBytesError");o(AI,"InvalidStreamIDBytesError");var SI=i(class extends Error{constructor(e){super(`Invalid StreamID string ${e}: contains commit`)}},"InvalidStreamIDStringError");o(SI,"InvalidStreamIDStringError");function m2(e){let t=Dd(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new AI(e)}i(m2,"fromBytes2");o(m2,"fromBytes");function xI(e){return kd(()=>m2(e))}i(xI,"fromBytesNoThrow");o(xI,"fromBytesNoThrow");function g2(e){let t=Km(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new SI(e)}i(g2,"fromString5");o(g2,"fromString");function TI(e){return kd(()=>g2(e))}i(TI,"fromStringNoThrow");o(TI,"fromStringNoThrow");var nS=Symbol.for("@ceramicnetwork/streamid/StreamID"),Xt=i(class{constructor(e,t){if(this._tag=nS,!(e||e===0))throw new Error("StreamID constructor: type required");if(!t)throw new Error("StreamID constructor: cid required");this._type=typeof e=="string"?Mo.codeByName(e):e,this._cid=typeof t=="string"?$t.parse(t):t}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===nS}static async fromGenesis(e,t){let r=await Mm({value:t,codec:fl,hasher:ol});return new Xt(e,r.cid)}get type(){return this._type}get typeName(){return Mo.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let e=tS.default.encode(h2),t=tS.default.encode(this.type);return gs([e,t,this.cid.bytes])}get baseID(){return new Xt(this._type,this._cid)}equals(e){return Xt.isInstance(e)?this.type===e.type&&this.cid.equals(e.cid):!1}toString(){return Ss.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[Symbol.for("nodejs.util.inspect.custom")](){return`StreamID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}},"StreamID");o(Xt,"StreamID");Xt.fromBytes=m2;Xt.fromBytesNoThrow=xI;Xt.fromString=g2;Xt.fromStringNoThrow=TI;Rd([Ji(),Ki("design:type",String),Ki("design:paramtypes",[])],Xt.prototype,"typeName",null);Rd([Ji(),Ki("design:type",Uint8Array),Ki("design:paramtypes",[])],Xt.prototype,"bytes",null);Rd([Ji(),Ki("design:type",Xt),Ki("design:paramtypes",[])],Xt.prototype,"baseID",null);Rd([Ji(),Ki("design:type",Function),Ki("design:paramtypes",[]),Ki("design:returntype",String)],Xt.prototype,"toString",null);Rd([Ji(),Ki("design:type",Function),Ki("design:paramtypes",[]),Ki("design:returntype",String)],Xt.prototype,"toUrl",null);var bl=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate2"),Qn=i(function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},"__metadata2"),ob=i(function(e,t,r,n,a){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?a.call(e,r):a?a.value=r:t.set(e,r),r},"__classPrivateFieldSet"),Eo=i(function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},"__classPrivateFieldGet"),Pu,gc,qf,CI=i(class extends Error{constructor(e){super(`Error while parsing CommitID from bytes ${Ss.encode(e)}: no commit information provided`)}},"InvalidCommitIDBytesError");o(CI,"InvalidCommitIDBytesError");var MI=i(class extends Error{constructor(e){super(`Error while parsing CommitID from string ${e}: no commit information provided`)}},"InvalidCommitIDStringError");o(MI,"InvalidCommitIDStringError");function v2(e){let t=Dd(e,"CommitID");if(t.kind==="commit-id")return new Ar(t.type,t.genesis,t.commit);throw new CI(e)}i(v2,"fromBytes3");o(v2,"fromBytes");function II(e){return kd(()=>v2(e))}i(II,"fromBytesNoThrow2");o(II,"fromBytesNoThrow");function y2(e){let t=Km(e,"CommitID");if(t.kind==="commit-id")return new Ar(t.type,t.genesis,t.commit);throw new MI(e)}i(y2,"fromString6");o(y2,"fromString");function kI(e){return kd(()=>y2(e))}i(kI,"fromStringNoThrow2");o(kI,"fromStringNoThrow");var iS=Symbol.for("@ceramicnetwork/streamid/CommitID");function DI(e,t){return new Ar(e.type,e.cid,t)}i(DI,"make");o(DI,"make");var Ar=i(class{constructor(e,t,r=null){if(this._tag=iS,Pu.set(this,void 0),gc.set(this,void 0),qf.set(this,void 0),!e&&e!==0)throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");ob(this,Pu,typeof e=="string"?Mo.codeByName(e):e,"f"),ob(this,gc,typeof t=="string"?$t.parse(t):t,"f"),ob(this,qf,p2(Eo(this,gc,"f"),r),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===iS}get baseID(){return new Xt(Eo(this,Pu,"f"),Eo(this,gc,"f"))}get type(){return Eo(this,Pu,"f")}get typeName(){return Mo.nameByCode(Eo(this,Pu,"f"))}get cid(){return Eo(this,gc,"f")}get commit(){return Eo(this,qf,"f")||Eo(this,gc,"f")}get bytes(){let e=eS.default.encode(h2),t=eS.default.encode(this.type),r=Eo(this,qf,"f")?.bytes||new Uint8Array([0]);return gs([e,t,this.cid.bytes,r])}equals(e){return this.type===e.type&&this.cid.equals(e.cid)&&this.commit.equals(e.commit)}toString(){return Ss.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(Pu=new WeakMap,gc=new WeakMap,qf=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}},"CommitID");o(Ar,"CommitID");Ar.fromBytes=v2;Ar.fromBytesNoThrow=II;Ar.fromString=y2;Ar.fromStringNoThrow=kI;Ar.make=DI;bl([Ji(),Qn("design:type",Xt),Qn("design:paramtypes",[])],Ar.prototype,"baseID",null);bl([Ji(),Qn("design:type",String),Qn("design:paramtypes",[])],Ar.prototype,"typeName",null);bl([Ji(),Qn("design:type",$t),Qn("design:paramtypes",[])],Ar.prototype,"commit",null);bl([Ji(),Qn("design:type",Uint8Array),Qn("design:paramtypes",[])],Ar.prototype,"bytes",null);bl([Ji(),Qn("design:type",Function),Qn("design:paramtypes",[]),Qn("design:returntype",String)],Ar.prototype,"toString",null);bl([Ji(),Qn("design:type",Function),Qn("design:paramtypes",[]),Qn("design:returntype",String)],Ar.prototype,"toUrl",null);_d();var ws;(function(e){function t(a){let s=Dd(a);switch(s.kind){case"commit-id":return new Ar(s.type,s.genesis,s.commit);case"stream-id":return new Xt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef bytes: ${Ss.encode(a)}`)}}i(t,"fromBytes4"),o(t,"fromBytes"),e.fromBytes=t;function r(a){let s=Km(a);switch(s.kind){case"commit-id":return new Ar(s.type,s.genesis,s.commit);case"stream-id":return new Xt(s.type,s.genesis);default:throw new Error(`Malformed StreamRef string: ${a}`)}}i(r,"fromString7"),o(r,"fromString"),e.fromString=r;function n(a){if(Xt.isInstance(a)||Ar.isInstance(a))return a;if(a instanceof Uint8Array)return t(a);if(typeof a=="string")return r(a);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(a)}`)}i(n,"from4"),o(n,"from"),e.from=n})(ws||(ws={}));var Vb=o(function(e,t){return Vb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])},Vb(e,t)},"extendStatics");function Ya(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Vb(e,t);function r(){this.constructor=e}i(r,"__"),o(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(Ya,"__extends2");o(Ya,"__extends");function RI(e,t,r,n){function a(s){return s instanceof r?s:new r(function(c){c(s)})}return i(a,"adopt"),o(a,"adopt"),new(r||(r=Promise))(function(s,c){function l(g){try{p(n.next(g))}catch(v){c(v)}}i(l,"fulfilled"),o(l,"fulfilled");function h(g){try{p(n.throw(g))}catch(v){c(v)}}i(h,"rejected"),o(h,"rejected");function p(g){g.done?s(g.value):a(g.value).then(l,h)}i(p,"step"),o(p,"step"),p((n=n.apply(e,t||[])).next())})}i(RI,"__awaiter");o(RI,"__awaiter");function b2(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,a,s,c=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return c.next=l(0),c.throw=l(1),c.return=l(2),typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(p){return function(g){return h([p,g])}}function h(p){if(n)throw new TypeError("Generator is already executing.");for(;c&&(c=0,p[0]&&(r=0)),r;)try{if(n=1,a&&(s=p[0]&2?a.return:p[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,p[1])).done)return s;switch(a=0,s&&(p=[p[0]&2,s.value]),p[0]){case 0:case 1:s=p;break;case 4:return r.label++,{value:p[1],done:!1};case 5:r.label++,a=p[1],p=[0];continue;case 7:p=r.ops.pop(),r.trys.pop();continue;default:if(s=r.trys,!(s=s.length>0&&s[s.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!s||p[1]>s[0]&&p[1]<s[3])){r.label=p[1];break}if(p[0]===6&&r.label<s[1]){r.label=s[1],s=p;break}if(s&&r.label<s[2]){r.label=s[2],r.ops.push(p);break}s[2]&&r.ops.pop(),r.trys.pop();continue}p=t.call(e,r)}catch(g){p=[6,g],a=0}finally{n=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}i(b2,"__generator");o(b2,"__generator");function Mc(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}i(Mc,"__values");o(Mc,"__values");function Io(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),a,s=[],c;try{for(;(t===void 0||t-- >0)&&!(a=n.next()).done;)s.push(a.value)}catch(l){c={error:l}}finally{try{a&&!a.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}i(Io,"__read");o(Io,"__read");function _s(e,t,r){if(r||arguments.length===2)for(var n=0,a=t.length,s;n<a;n++)(s||!(n in t))&&(s||(s=Array.prototype.slice.call(t,0,n)),s[n]=t[n]);return e.concat(s||Array.prototype.slice.call(t))}i(_s,"__spreadArray");o(_s,"__spreadArray");function Tc(e){return this instanceof Tc?(this.v=e,this):new Tc(e)}i(Tc,"__await");o(Tc,"__await");function OI(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),a,s=[];return a=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",c),a[Symbol.asyncIterator]=function(){return this},a;function c(_){return function(x){return Promise.resolve(x).then(_,v)}}function l(_,x){n[_]&&(a[_]=function(O){return new Promise(function(D,P){s.push([_,O,D,P])>1||h(_,O)})},x&&(a[_]=x(a[_])))}function h(_,x){try{p(n[_](x))}catch(O){y(s[0][3],O)}}function p(_){_.value instanceof Tc?Promise.resolve(_.value.v).then(g,v):y(s[0][2],_)}function g(_){h("next",_)}function v(_){h("throw",_)}function y(_,x){_(x),s.shift(),s.length&&h(s[0][0],s[0][1])}}i(OI,"__asyncGenerator");o(OI,"__asyncGenerator");function NI(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Mc=="function"?Mc(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(s){r[s]=e[s]&&function(c){return new Promise(function(l,h){c=e[s](c),a(l,h,c.done,c.value)})}}function a(s,c,l,h){Promise.resolve(h).then(function(p){s({value:p,done:l})},c)}}i(NI,"__asyncValues");o(NI,"__asyncValues");function Sr(e){return typeof e=="function"}i(Sr,"isFunction");o(Sr,"isFunction");function Gm(e){var t=o(function(n){Error.call(n),n.stack=new Error().stack},"_super"),r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}i(Gm,"createErrorClass");o(Gm,"createErrorClass");var sb=Gm(function(e){return o(i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
844
844
  `+r.map(function(n,a){return a+1+") "+n.toString()}).join(`
845
- `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl"),"UnsubscriptionErrorImpl")});function cd(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(cd,"arrRemove");o(cd,"arrRemove");var Od=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription2"),o(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,a,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Mc(c),h=l.next();!h.done;h=l.next()){var p=h.value;p.remove(this)}}catch(O){t={error:O}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var g=this.initialTeardown;if(Sr(g))try{g()}catch(O){s=O instanceof sb?O.errors:[O]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=Mc(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{Kb(x)}catch(O){s=s??[],O instanceof sb?s=_s(_s([],Io(s)),Io(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}if(s)throw new sb(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Kb(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&cd(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&cd(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),PI=Od.EMPTY;function w2(e){return e instanceof Od||e&&"closed"in e&&Sr(e.remove)&&Sr(e.add)&&Sr(e.unsubscribe)}i(w2,"isSubscription");o(w2,"isSubscription");function Kb(e){Sr(e)?e():e.unsubscribe()}i(Kb,"execFinalizer");o(Kb,"execFinalizer");var Hc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},sm={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=sm.delegate;return a?.setTimeout?a.setTimeout.apply(a,_s([e,t],Io(r))):setTimeout.apply(void 0,_s([e,t],Io(r)))},clearTimeout:function(e){var t=sm.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function _2(e){sm.setTimeout(function(){var t=Hc.onUnhandledError;if(t)t(e);else throw e})}i(_2,"reportUnhandledError");o(_2,"reportUnhandledError");function Gb(){}i(Gb,"noop");o(Gb,"noop");var IH=function(){return Wm("C",void 0,void 0)}();function BI(e){return Wm("E",void 0,e)}i(BI,"errorNotification");o(BI,"errorNotification");function LI(e){return Wm("N",e,void 0)}i(LI,"nextNotification");o(LI,"nextNotification");function Wm(e,t,r){return{kind:e,value:t,error:r}}i(Wm,"createNotification");o(Wm,"createNotification");var Ec=null;function Yf(e){if(Hc.useDeprecatedSynchronousErrorHandling){var t=!Ec;if(t&&(Ec={errorThrown:!1,error:null}),e(),t){var r=Ec,n=r.errorThrown,a=r.error;if(Ec=null,n)throw a}}else e()}i(Yf,"errorContext");o(Yf,"errorContext");function UI(e){Hc.useDeprecatedSynchronousErrorHandling&&Ec&&(Ec.errorThrown=!0,Ec.error=e)}i(UI,"captureError");o(UI,"captureError");var E2=function(e){Ya(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,w2(r)&&r.add(n)):n.destination=RH,n}return i(t,"Subscriber2"),o(t,"Subscriber"),t.create=function(r,n,a){return new Wb(r,n,a)},t.prototype.next=function(r){this.isStopped?O0(LI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?O0(BI(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?O0(IH,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Od),kH=Function.prototype.bind;function R0(e,t){return kH.call(e,t)}i(R0,"bind");o(R0,"bind");var DH=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver2"),o(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Wf(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Wf(n)}else Wf(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Wf(r)}},e}(),Wb=function(e){Ya(t,e);function t(r,n,a){var s=e.call(this)||this,c;if(Sr(r)||!r)c={next:r??void 0,error:n??void 0,complete:a??void 0};else{var l;s&&Hc.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&R0(r.next,l),error:r.error&&R0(r.error,l),complete:r.complete&&R0(r.complete,l)}):c=r}return s.destination=new DH(c),s}return i(t,"SafeSubscriber2"),o(t,"SafeSubscriber"),t}(E2);function Wf(e){Hc.useDeprecatedSynchronousErrorHandling?UI(e):_2(e)}i(Wf,"handleUnhandledError");o(Wf,"handleUnhandledError");function FI(e){throw e}i(FI,"defaultErrorHandler");o(FI,"defaultErrorHandler");function O0(e,t){var r=Hc.onStoppedNotification;r&&sm.setTimeout(function(){return r(e,t)})}i(O0,"handleStoppedNotification");o(O0,"handleStoppedNotification");var RH={closed:!0,next:Gb,error:FI,complete:Gb},A2=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Jm(e){return e}i(Jm,"identity3");o(Jm,"identity");function jI(e){return e.length===0?Jm:e.length===1?e[0]:o(i(function(r){return e.reduce(function(n,a){return a(n)},r)},"piped"),"piped")}i(jI,"pipeFromArray");o(jI,"pipeFromArray");var dn=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable2"),o(e,"Observable"),e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var a=this,s=zI(t)?t:new Wb(t,r,n);return Yf(function(){var c=a,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?a._subscribe(s):a._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=Jb(r),new r(function(a,s){var c=new Wb({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:a});n.subscribe(c)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[A2]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return jI(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Jb(t),new t(function(n,a){var s;r.subscribe(function(c){return s=c},function(c){return a(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function Jb(e){var t;return(t=e??Hc.Promise)!==null&&t!==void 0?t:Promise}i(Jb,"getPromiseCtor");o(Jb,"getPromiseCtor");function $I(e){return e&&Sr(e.next)&&Sr(e.error)&&Sr(e.complete)}i($I,"isObserver");o($I,"isObserver");function zI(e){return e&&e instanceof E2||$I(e)&&w2(e)}i(zI,"isSubscriber");o(zI,"isSubscriber");function HI(e){return Sr(e?.lift)}i(HI,"hasLift");o(HI,"hasLift");function Xa(e){return function(t){if(HI(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}i(Xa,"operate");o(Xa,"operate");function ga(e,t,r,n,a){return new OH(e,t,r,n,a)}i(ga,"createOperatorSubscriber");o(ga,"createOperatorSubscriber");var OH=function(e){Ya(t,e);function t(r,n,a,s,c,l){var h=e.call(this,r)||this;return h.onFinalize=c,h.shouldUnsubscribe=l,h._next=n?function(p){try{n(p)}catch(g){r.error(g)}}:e.prototype._next,h._error=s?function(p){try{s(p)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,h._complete=a?function(){try{a()}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._complete,h}return i(t,"OperatorSubscriber2"),o(t,"OperatorSubscriber"),t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(E2),NH=Gm(function(e){return o(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),qI=function(e){Ya(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return i(t,"Subject2"),o(t,"Subject"),t.prototype.lift=function(r){var n=new aS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new NH},t.prototype.next=function(r){var n=this;Yf(function(){var a,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var c=Mc(n.currentObservers),l=c.next();!l.done;l=c.next()){var h=l.value;h.next(r)}}catch(p){a={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}}})},t.prototype.error=function(r){var n=this;Yf(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var a=n.observers;a.length;)a.shift().error(r)}})},t.prototype.complete=function(){var r=this;Yf(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,a=this,s=a.hasError,c=a.isStopped,l=a.observers;return s||c?PI:(this.currentObservers=null,l.push(r),new Od(function(){n.currentObservers=null,cd(l,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,a=n.hasError,s=n.thrownError,c=n.isStopped;a?r.error(s):c&&r.complete()},t.prototype.asObservable=function(){var r=new dn;return r.source=this,r},t.create=function(r,n){return new aS(r,n)},t}(dn),aS=function(e){Ya(t,e);function t(r,n){var a=e.call(this)||this;return a.destination=r,a.source=n,a}return i(t,"AnonymousSubject2"),o(t,"AnonymousSubject"),t.prototype.next=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.next)===null||a===void 0||a.call(n,r)},t.prototype.error=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.error)===null||a===void 0||a.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,a;return(a=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&a!==void 0?a:PI},t}(qI),PH=function(e){Ya(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return i(t,"BehaviorSubject2"),o(t,"BehaviorSubject"),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,a=r.thrownError,s=r._value;if(n)throw a;return this._throwIfClosed(),s},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(qI),VI={now:function(){return(VI.delegate||Date).now()},delegate:void 0},BH=function(e){Ya(t,e);function t(r,n){return e.call(this)||this}return i(t,"Action2"),o(t,"Action"),t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(Od),cm={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=cm.delegate;return a?.setInterval?a.setInterval.apply(a,_s([e,t],Io(r))):setInterval.apply(void 0,_s([e,t],Io(r)))},clearInterval:function(e){var t=cm.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},LH=function(e){Ya(t,e);function t(r,n){var a=e.call(this,r,n)||this;return a.scheduler=r,a.work=n,a.pending=!1,a}return i(t,"AsyncAction2"),o(t,"AsyncAction"),t.prototype.schedule=function(r,n){var a;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var s=this.id,c=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(c,s,n)),this.pending=!0,this.delay=n,this.id=(a=this.id)!==null&&a!==void 0?a:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,a){return a===void 0&&(a=0),cm.setInterval(r.flush.bind(r,this),a)},t.prototype.recycleAsyncId=function(r,n,a){if(a===void 0&&(a=0),a!=null&&this.delay===a&&this.pending===!1)return n;n!=null&&cm.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var a=this._execute(r,n);if(a)return a;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var a=!1,s;try{this.work(r)}catch(c){a=!0,s=c||new Error("Scheduled action threw falsy error")}if(a)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,a=r.scheduler,s=a.actions;this.work=this.state=this.scheduler=null,this.pending=!1,cd(s,this),n!=null&&(this.id=this.recycleAsyncId(a,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(BH),oS=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return i(e,"Scheduler2"),o(e,"Scheduler"),e.prototype.schedule=function(t,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,t).schedule(n,r)},e.now=VI.now,e}(),UH=function(e){Ya(t,e);function t(r,n){n===void 0&&(n=oS.now);var a=e.call(this,r,n)||this;return a.actions=[],a._active=!1,a}return i(t,"AsyncScheduler2"),o(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var a;this._active=!0;do if(a=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,a){for(;r=n.shift();)r.unsubscribe();throw a}},t}(oS),FH=new UH(LH),jH=FH,KI=new dn(function(e){return e.complete()});function S2(e){return e&&Sr(e.schedule)}i(S2,"isScheduler");o(S2,"isScheduler");function x2(e){return e[e.length-1]}i(x2,"last");o(x2,"last");function GI(e){return S2(x2(e))?e.pop():void 0}i(GI,"popScheduler");o(GI,"popScheduler");function WI(e,t){return typeof x2(e)=="number"?e.pop():t}i(WI,"popNumber");o(WI,"popNumber");var T2=o(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function C2(e){return Sr(e?.then)}i(C2,"isPromise");o(C2,"isPromise");function M2(e){return Sr(e[A2])}i(M2,"isInteropObservable");o(M2,"isInteropObservable");function I2(e){return Symbol.asyncIterator&&Sr(e?.[Symbol.asyncIterator])}i(I2,"isAsyncIterable");o(I2,"isAsyncIterable");function k2(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}i(k2,"createInvalidObservableTypeError");o(k2,"createInvalidObservableTypeError");function JI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(JI,"getSymbolIterator");o(JI,"getSymbolIterator");var ZI=JI();function D2(e){return Sr(e?.[ZI])}i(D2,"isIterable");o(D2,"isIterable");function R2(e){return OI(this,arguments,o(i(function(){var r,n,a,s;return b2(this,function(c){switch(c.label){case 0:r=e.getReader(),c.label=1;case 1:c.trys.push([1,,9,10]),c.label=2;case 2:return[4,Tc(r.read())];case 3:return n=c.sent(),a=n.value,s=n.done,s?[4,Tc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Tc(a)];case 6:return[4,c.sent()];case 7:return c.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"),"readableStreamLikeToAsyncGenerator_1"))}i(R2,"readableStreamLikeToAsyncGenerator");o(R2,"readableStreamLikeToAsyncGenerator");function O2(e){return Sr(e?.getReader)}i(O2,"isReadableStreamLike");o(O2,"isReadableStreamLike");function No(e){if(e instanceof dn)return e;if(e!=null){if(M2(e))return YI(e);if(T2(e))return XI(e);if(C2(e))return QI(e);if(I2(e))return N2(e);if(D2(e))return ek(e);if(O2(e))return tk(e)}throw k2(e)}i(No,"innerFrom");o(No,"innerFrom");function YI(e){return new dn(function(t){var r=e[A2]();if(Sr(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(YI,"fromInteropObservable");o(YI,"fromInteropObservable");function XI(e){return new dn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(XI,"fromArrayLike");o(XI,"fromArrayLike");function QI(e){return new dn(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,_2)})}i(QI,"fromPromise");o(QI,"fromPromise");function ek(e){return new dn(function(t){var r,n;try{for(var a=Mc(e),s=a.next();!s.done;s=a.next()){var c=s.value;if(t.next(c),t.closed)return}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}t.complete()})}i(ek,"fromIterable");o(ek,"fromIterable");function N2(e){return new dn(function(t){rk(e,t).catch(function(r){return t.error(r)})})}i(N2,"fromAsyncIterable");o(N2,"fromAsyncIterable");function tk(e){return N2(R2(e))}i(tk,"fromReadableStreamLike");o(tk,"fromReadableStreamLike");function rk(e,t){var r,n,a,s;return RI(this,void 0,void 0,function(){var c,l;return b2(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),r=NI(e),h.label=1;case 1:return[4,r.next()];case 2:if(n=h.sent(),!!n.done)return[3,4];if(c=n.value,t.next(c),t.closed)return[2];h.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=h.sent(),a={error:l},[3,11];case 6:return h.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:h.sent(),h.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(rk,"process2");o(rk,"process");function To(e,t,r,n,a){n===void 0&&(n=0),a===void 0&&(a=!1);var s=t.schedule(function(){r(),a?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!a)return s}i(To,"executeSchedule");o(To,"executeSchedule");function P2(e,t){return t===void 0&&(t=0),Xa(function(r,n){r.subscribe(ga(n,function(a){return To(n,e,function(){return n.next(a)},t)},function(){return To(n,e,function(){return n.complete()},t)},function(a){return To(n,e,function(){return n.error(a)},t)}))})}i(P2,"observeOn");o(P2,"observeOn");function B2(e,t){return t===void 0&&(t=0),Xa(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(B2,"subscribeOn");o(B2,"subscribeOn");function nk(e,t){return No(e).pipe(B2(t),P2(t))}i(nk,"scheduleObservable");o(nk,"scheduleObservable");function ik(e,t){return No(e).pipe(B2(t),P2(t))}i(ik,"schedulePromise");o(ik,"schedulePromise");function ak(e,t){return new dn(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}i(ak,"scheduleArray");o(ak,"scheduleArray");function ok(e,t){return new dn(function(r){var n;return To(r,t,function(){n=e[ZI](),To(r,t,function(){var a,s,c;try{a=n.next(),s=a.value,c=a.done}catch(l){r.error(l);return}c?r.complete():r.next(s)},0,!0)}),function(){return Sr(n?.return)&&n.return()}})}i(ok,"scheduleIterable");o(ok,"scheduleIterable");function L2(e,t){if(!e)throw new Error("Iterable cannot be null");return new dn(function(r){To(r,t,function(){var n=e[Symbol.asyncIterator]();To(r,t,function(){n.next().then(function(a){a.done?r.complete():r.next(a.value)})},0,!0)})})}i(L2,"scheduleAsyncIterable");o(L2,"scheduleAsyncIterable");function sk(e,t){return L2(R2(e),t)}i(sk,"scheduleReadableStreamLike");o(sk,"scheduleReadableStreamLike");function ck(e,t){if(e!=null){if(M2(e))return nk(e,t);if(T2(e))return ak(e,t);if(C2(e))return ik(e,t);if(I2(e))return L2(e,t);if(D2(e))return ok(e,t);if(O2(e))return sk(e,t)}throw k2(e)}i(ck,"scheduled");o(ck,"scheduled");function uk(e,t){return t?ck(e,t):No(e)}i(uk,"from3");o(uk,"from");var lk=Gm(function(e){return o(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function fk(e){return e instanceof Date&&!isNaN(e)}i(fk,"isValidDate");o(fk,"isValidDate");function U2(e,t){return Xa(function(r,n){var a=0;r.subscribe(ga(n,function(s){n.next(e.call(t,s,a++))}))})}i(U2,"map");o(U2,"map");var $H=Array.isArray;function dk(e,t){return $H(t)?e.apply(void 0,_s([],Io(t))):e(t)}i(dk,"callOrApply");o(dk,"callOrApply");function hk(e){return U2(function(t){return dk(e,t)})}i(hk,"mapOneOrManyArgs");o(hk,"mapOneOrManyArgs");function pk(e,t,r,n,a,s,c,l){var h=[],p=0,g=0,v=!1,y=o(function(){v&&!h.length&&!p&&t.complete()},"checkComplete"),_=o(function(O){return p<n?x(O):h.push(O)},"outerNext"),x=o(function(O){s&&t.next(O),p++;var D=!1;No(r(O,g++)).subscribe(ga(t,function(P){a?.(P),s?_(P):t.next(P)},function(){D=!0},void 0,function(){if(D)try{p--;for(var P=o(function(){var J=h.shift();c?To(t,c,function(){return x(J)}):x(J)},"_loop_1");h.length&&p<n;)P();y()}catch(J){t.error(J)}}))},"doInnerSub");return e.subscribe(ga(t,_,function(){v=!0,y()})),function(){l?.()}}i(pk,"mergeInternals");o(pk,"mergeInternals");function Zm(e,t,r){return r===void 0&&(r=1/0),Sr(t)?Zm(function(n,a){return U2(function(s,c){return t(n,s,a,c)})(No(e(n,a)))},r):(typeof t=="number"&&(r=t),Xa(function(n,a){return pk(n,a,e,r)}))}i(Zm,"mergeMap");o(Zm,"mergeMap");function mk(e){return e===void 0&&(e=1/0),Zm(Jm,e)}i(mk,"mergeAll");o(mk,"mergeAll");var zH=["addListener","removeListener"],HH=["addEventListener","removeEventListener"],qH=["on","off"];function um(e,t,r,n){if(Sr(r)&&(n=r,r=void 0),n)return um(e,t,r).pipe(hk(n));var a=Io(yk(e)?HH.map(function(l){return function(h){return e[l](t,h,r)}}):gk(e)?zH.map(Zb(e,t)):vk(e)?qH.map(Zb(e,t)):[],2),s=a[0],c=a[1];if(!s&&T2(e))return Zm(function(l){return um(l,t,r)})(No(e));if(!s)throw new TypeError("Invalid event target");return new dn(function(l){var h=o(function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];return l.next(1<p.length?p:p[0])},"handler");return s(h),function(){return c(h)}})}i(um,"fromEvent");o(um,"fromEvent");function Zb(e,t){return function(r){return function(n){return e[r](t,n)}}}i(Zb,"toCommonHandlerRegistry");o(Zb,"toCommonHandlerRegistry");function gk(e){return Sr(e.addListener)&&Sr(e.removeListener)}i(gk,"isNodeStyleEventEmitter");o(gk,"isNodeStyleEventEmitter");function vk(e){return Sr(e.on)&&Sr(e.off)}i(vk,"isJQueryStyleEventEmitter");o(vk,"isJQueryStyleEventEmitter");function yk(e){return Sr(e.addEventListener)&&Sr(e.removeEventListener)}i(yk,"isEventTarget");o(yk,"isEventTarget");function F2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=jH);var n=-1;return t!=null&&(S2(t)?r=t:n=t),new dn(function(a){var s=fk(e)?+e-r.now():e;s<0&&(s=0);var c=0;return r.schedule(function(){a.closed||(a.next(c++),0<=n?this.schedule(void 0,n):a.complete())},s)})}i(F2,"timer");o(F2,"timer");function bk(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=GI(e),n=WI(e,1/0),a=e;return a.length?a.length===1?No(a[0]):mk(n)(uk(a,r)):KI}i(bk,"merge");o(bk,"merge");function wk(e,t){return Xa(function(r,n){var a=0;r.subscribe(ga(n,function(s){return e.call(t,s,a++)&&n.next(s)}))})}i(wk,"filter");o(wk,"filter");function _k(e){return Xa(function(t,r){var n=!1;t.subscribe(ga(r,function(a){n=!0,r.next(a)},function(){n||r.next(e),r.complete()}))})}i(_k,"defaultIfEmpty");o(_k,"defaultIfEmpty");function Ek(e){return e<=0?function(){return KI}:Xa(function(t,r){var n=0;t.subscribe(ga(r,function(a){++n<=e&&(r.next(a),e<=n&&r.complete())}))})}i(Ek,"take");o(Ek,"take");function Ak(e){return e===void 0&&(e=Sk),Xa(function(t,r){var n=!1;t.subscribe(ga(r,function(a){n=!0,r.next(a)},function(){return n?r.complete():r.error(e())}))})}i(Ak,"throwIfEmpty");o(Ak,"throwIfEmpty");function Sk(){return new lk}i(Sk,"defaultErrorFactory");o(Sk,"defaultErrorFactory");function xk(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?wk(function(a,s){return e(a,s,n)}):Jm,Ek(1),r?_k(t):Ak(function(){return new lk}))}}i(xk,"first");o(xk,"first");function Tk(e,t){return Xa(function(r,n){var a=t??{},s=a.leading,c=s===void 0?!0:s,l=a.trailing,h=l===void 0?!1:l,p=!1,g=null,v=null,y=!1,_=o(function(){v?.unsubscribe(),v=null,h&&(D(),y&&n.complete())},"endThrottling"),x=o(function(){v=null,y&&n.complete()},"cleanupThrottling"),O=o(function(P){return v=No(e(P)).subscribe(ga(n,_,x))},"startThrottle"),D=o(function(){if(p){p=!1;var P=g;g=null,n.next(P),!y&&O(P)}},"send");r.subscribe(ga(n,function(P){p=!0,g=P,!(v&&!v.closed)&&(c?D():O(P))},function(){y=!0,!(h&&p&&v&&!v.closed)&&n.complete()}))})}i(Tk,"throttle");o(Tk,"throttle");var sS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(sS||(sS={}));var lm;(function(e){e[e.NOT_REQUESTED=0]="NOT_REQUESTED",e[e.PENDING=1]="PENDING",e[e.PROCESSING=2]="PROCESSING",e[e.ANCHORED=3]="ANCHORED",e[e.FAILED=4]="FAILED"})(lm||(lm={}));var Yb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Yb||(Yb={}));var Ym=i(class extends dn{constructor(e,t){super(r=>{e.subscribe(r)}),this.state$=e,this._context=t}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:e,content:t}=this.state$.value;return(0,QA.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Ar.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Ar.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Yb.ANCHOR).map(({cid:e})=>Ar.make(this.id,e))}get state(){return(0,QA.default)(this.state$.value)}async sync(e={}){e={sync:ei.PREFER_CACHE,...e};let t=await this.api.loadStream(this.id,e);this.state$.next(t.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}},"Stream");o(Ym,"Stream");function Xm(){return e=>{}}i(Xm,"StreamStatic");o(Xm,"StreamStatic");var VH=ir(I$(),1);function Ck(e){let t=new AbortController;if(e.length===0)throw Error("Need abort signals to create a merged abort signal");return e.some(r=>r.aborted)?(t.abort(),t.signal):(bk(...e.map(r=>um(r,"abort"))).pipe(xk()).subscribe(()=>{t.abort()}),t.signal)}i(Ck,"mergeAbortSignals");o(Ck,"mergeAbortSignals");var Mk=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=F2(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");o(Mk,"TimedAbortSignal");async function Ik(e,t){let r=new AbortController,n=o(()=>{r.abort()},"onAbort");return e.addEventListener("abort",n),e.aborted&&r.abort(),t(r.signal).finally(()=>{e.removeEventListener("abort",n)})}i(Ik,"abortable2");o(Ik,"abortable");var KH=60*1e3*3;async function _i(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||KH,n=new Mk(r),a=t.signal?Ck([t.signal,n.signal]):n.signal,s=await Ik(a,c=>(0,VH.default)(String(e),{...t,signal:c})).finally(()=>n.clear());if(!s.ok){let c=await s.text();throw new Error(`HTTP request to '${e}' failed with status '${s.statusText}': ${c}`)}return s.json()}i(_i,"fetchJson");o(_i,"fetchJson");var _0=ir(Sd(),1);Ga();function So(e){let t=$t.asCID(e);if(t)return t;if(typeof e=="string")return $t.parse(e);if(e instanceof Uint8Array)return $t.decode(e);throw new Error(`${e} cannot be converted to a CID`)}i(So,"toCID");o(So,"toCID");var cS=0,Hr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,_0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Ir(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Ir(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(e)&&(t.link=t.link.toString()),Hr.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),e.header?.model&&(t.header.model=Ir(e.header.model,"base64")),t)}static deserializeCommit(e){let t=(0,_0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=So(t.jws.link),t.linkedBlock=Cr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Cr(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(t)&&(t.link=So(t.link)),Hr.isAnchorCommit(t)&&(t.proof=So(t.proof)),t.id&&(t.id=So(t.id)),t.prev&&(t.prev=So(t.prev)),t.header?.model&&(t.header.model=Cr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,_0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=lm[t.anchorStatus]),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),e.metadata?.model&&(t.metadata.model=e.metadata.model.toString()),e.next?.metadata?.model&&(t.next.metadata.model=e.next.metadata.model.toString()),e.metadata?.unique&&e.type!=cS&&(t.metadata.unique=Ir(t.metadata.unique,"base64")),t.doctype=Mo.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,_0.default)(e);return t.doctype&&(t.type=Mo.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:So(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=So(t.anchorProof.txHash),t.anchorProof.root=So(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=lm[t.anchorStatus]),e.metadata?.model&&(t.metadata.model=Xt.fromString(e.metadata.model)),e.next?.metadata?.model&&(t.next.metadata.model=Xt.fromString(e.next.metadata.model)),e.metadata?.unique&&e.type!=cS&&(t.metadata.unique=Cr(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(Hr.serializeState(e))===JSON.stringify(Hr.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let r in t.log)if(!e.log[r].cid.equals(t.log[r].cid))return!1;return!(e.log.length===t.log.length&&e.anchorStatus!=t.anchorStatus)}static assertCommitLinksToState(e,t){let r=this.streamIdFromState(e);if(t.id&&!t.id.equals(e.log[0].cid))throw new Error(`Invalid genesis CID in commit for StreamID ${r.toString()}. Found: ${t.id}, expected ${e.log[0].cid}`);let n=e.log[e.log.length-1].cid;if(!t.prev.equals(n))throw new Error(`Commit doesn't properly point to previous commit in log. Expected ${n}, found 'prev' ${t.prev}`)}static async convertCommitToSignedCommitContainer(e,t){if(Hr.isSignedCommit(e)){let r=await t.block.get(e.link);return{jws:e,linkedBlock:r}}return e}static isSignedCommitContainer(e){return e&&e.jws!==void 0}static isSignedCommit(e){return e&&e.link!==void 0}static isAnchorCommit(e){return e&&e.proof!==void 0}static isSignedCommitData(e){return e&&e.envelope!==void 0}static isAnchorCommitData(e){return e&&e.proof!==void 0}},"StreamUtils");o(Hr,"StreamUtils");var kk=i(class extends PH{next(e){let t=this.value;Hr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");o(kk,"StreamStateSubject");var GH=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate3"),bi,cb={anchor:!0,publish:!0,pin:!0,sync:ei.PREFER_CACHE},WH={sync:ei.PREFER_CACHE},uS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function N0(e,t){if(typeof e?.schema=="string")try{Ar.fromString(e.schema)}catch{throw new Error("Schema must be a CommitID")}let r={controllers:e?.controllers,family:e?.family,schema:e?.schema?.toString(),tags:e?.tags};if(t)e?.deterministic||(r.unique=Ir((0,CH.randomBytes)(12),"base64")),e?.forbidControllerChange&&(r.forbidControllerChange=!0);else{if(e?.deterministic!==void 0||e?.unique!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if(e?.forbidControllerChange!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(r).forEach(n=>r[n]===void 0&&delete r[n]),r}i(N0,"headerFromMetadata");o(N0,"headerFromMetadata");async function Xb(e){if(!e.did)throw new Error("No DID provided");return e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`)),e.did}i(Xb,"getAuthenticatedDID");o(Xb,"getAuthenticatedDID");async function P0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(P0,"throwReadOnlyError");o(P0,"throwReadOnlyError");var ko=bi=o(i(class extends Ym{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,TH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,a={}){a={...cb,...a},!n?.deterministic&&a.syncTimeoutSeconds==null&&(a.syncTimeoutSeconds=0);let s=a.asDID?{did:a.asDID}:t,c=await bi.makeGenesis(s,r,n);return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,c,a)}static async createFromGenesis(t,r,n={}){n={...cb,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=r.data?await bi._signDagJWS(t,r):r;return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,a,n)}static async deterministic(t,r,n={}){if(n={...cb,...n},r={...r,deterministic:!0},r.family==null&&r.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=await bi.makeGenesis(t,null,r);return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,a,n)}static async load(t,r,n={}){n={...WH,...n};let a=ws.from(r);if(a.type!=bi.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${bi.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async update(t,r,n={}){n={...uS,...n};let a=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(a,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...uS,...r};let a={header:N0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await bi._signDagJWS(this.api,a),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=P0,this.patch=P0,this.sync=P0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let a=await this._makeRawCommit(r,n);return bi._signDagJWS(t,a)}async _makeRawCommit(t,r){r||(r={});let n=N0(r,!1);if(t==null&&(t=this.content),n.controllers){if(n.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!n.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let a=vI.compare(this.content,t),s=this.state.log[0];return{header:n,data:a,prev:this.tip,id:s.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await Xb(t);n.controllers=[c.hasParent?c.parent:c.id]}else throw new Error("No controllers specified");if(n.controllers?.length!==1)throw new Error("Exactly one controller must be specified");let a=N0(n,!0);if(n?.deterministic&&r)throw new Error("Initial content must be null when creating a deterministic Tile document");if(r==null){let c={header:a};return Um(c),c}let s={data:r,header:a};return bi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await Xb(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");ko.STREAM_TYPE_NAME="tile";ko.STREAM_TYPE_ID=0;ko=bi=GH([Xm()],ko);var JH=ir(k$(),1);function Dk(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(Dk,"_checkPrivateRedeclaration2");o(Dk,"_checkPrivateRedeclaration");function Rk(e,t){return t.get?t.get.call(e):t.value}i(Rk,"_classApplyDescriptorGet2");o(Rk,"_classApplyDescriptorGet");function Ok(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(Ok,"_classApplyDescriptorSet2");o(Ok,"_classApplyDescriptorSet");function j2(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(j2,"_classExtractFieldDescriptor2");o(j2,"_classExtractFieldDescriptor");function B0(e,t){var r=j2(e,t,"get");return Rk(e,r)}i(B0,"_classPrivateFieldGet2");o(B0,"_classPrivateFieldGet");function Qb(e,t,r){Dk(e,t),t.set(e,r)}i(Qb,"_classPrivateFieldInit2");o(Qb,"_classPrivateFieldInit");function e6(e,t,r){var n=j2(e,t,"set");return Ok(e,n,r),r}i(e6,"_classPrivateFieldSet2");o(e6,"_classPrivateFieldSet");function Nk(e){return typeof e=="string"||Ar.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(Nk,"keyToQuery");o(Nk,"keyToQuery");function L0(e){return typeof e=="string"?ws.from(e).toString():Ar.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(L0,"keyToString");o(L0,"keyToString");async function Pk(e){let t=await ko.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(Pk,"getDeterministicQuery");o(Pk,"getDeterministicQuery");var ZH=o(()=>Promise.resolve([]),"tempBatchLoadFn"),E0=new WeakMap,ub=new WeakMap,YH=i(class extends JH.default{cache(e){if(!B0(this,ub))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await ko.create(B0(this,E0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await Pk(e);try{return await super.load(r)}catch{let a=await ko.createFromGenesis(B0(this,E0),r.genesis,t);return this.cache(a),a}}async load(e){return await super.load(e)}async update(e,t,r,n){let a=L0(e);this.clear(a);let s=await this.load({streamId:a});return await s.update(t,r,n),s}constructor(e){super(ZH,{cache:!0,cacheKeyFn:L0,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),Qb(this,E0,{writable:!0,value:void 0}),Qb(this,ub,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(Nk),e.multiqueryTimeout);return t.map(n=>{let a=L0(n),s=r[a];return s||new Error(`Failed to load stream: ${a}`)})},e6(this,E0,e.ceramic),e6(this,ub,!!e.cache)}},"TileLoader");o(YH,"TileLoader");function t6(e){return typeof e=="string"?Xt.fromString(e):e}i(t6,"typeStreamID");o(t6,"typeStreamID");function Bk(e,t){let r=new URL(e);for(let[n,a]of Object.entries(t))Xt.isInstance(a)?r.searchParams.set(n,a.toString()):typeof a=="object"?r.searchParams.set(n,JSON.stringify(a)):r.searchParams.set(n,a);return r}i(Bk,"serializeObjectToSearchParams");o(Bk,"serializeObjectToSearchParams");function r6(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(r6,"serializeObjectForHttpPost");o(r6,"serializeObjectForHttpPost");var Vi=i(class extends dn{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=F2(0,r).pipe(Tk(()=>this._syncState(this.id,{sync:ei.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new kk(e),this._apiUrl=new URL(t)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}async _syncState(e,t){let r=await Vi._load(e,this._apiUrl,t);this.state$.next(Hr.deserializeState(r))}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}static async createFromGenesis(e,t,r,n,a){let s=new URL("./streams",e),{state:c}=await _i(s,{method:"post",body:{type:t,genesis:Hr.serializeCommit(r),opts:n}});return new Vi(Hr.deserializeState(c),e,a)}static async applyCommit(e,t,r,n,a){let s=new URL("./commits",e),{state:c}=await _i(s,{method:"post",body:{streamId:t.toString(),commit:Hr.serializeCommit(r),opts:n}});return new Vi(Hr.deserializeState(c),e,a)}static async _load(e,t,r){let n=Bk(new URL(`./streams/${e}`,t),r),{state:a}=await _i(n);return a}static async load(e,t,r,n){let a=await Vi._load(e,t,n);return new Vi(Hr.deserializeState(a),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await _i(r);return n.map(a=>({cid:a.cid,value:Hr.deserializeCommit(a.value)}))}complete(){this.state$.complete()}},"Document");o(Vi,"Document");var ud;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC",e[e.SYNC_ON_ERROR=3]="SYNC_ON_ERROR"})(ud||(ud={}));var lS=ir(Sd(),1),fS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(fS||(fS={}));var n6;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(n6||(n6={}));var Lk=i(class extends dn{constructor(e,t){super(r=>{e.subscribe(r)}),this.state$=e,this._context=t}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:e,content:t}=this.state$.value;return(0,lS.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Ar.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Ar.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===n6.ANCHOR).map(({cid:e})=>Ar.make(this.id,e))}get state(){return(0,lS.default)(this.state$.value)}async sync(e={}){e={sync:ud.PREFER_CACHE,...e};let t=await this.api.loadStream(this.id,e);this.state$.next(t.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}},"Stream2");o(Lk,"Stream");function Uk(){return e=>{}}i(Uk,"StreamStatic2");o(Uk,"StreamStatic");function Fk(e){if(typeof e=="string"&&e.includes("@")){let[t,r]=e.split("@");if(!t||!r)throw new Error("Invalid accountId provided");return new id({address:t,chainId:r})}return new id(e)}i(Fk,"normalizeAccountId");o(Fk,"normalizeAccountId");var XH="(?:%[0-9a-fA-F]{2})",dS=`(?:[a-zA-Z0-9._-]|${XH})`,QH="([a-z0-9]+)",eq=`((?:${dS}*:)*(${dS}+))`,hS="[a-zA-Z0-9_.:%-]",tq=`;${hS}+=${hS}*`,rq=`((${tq})*)`,nq="(/[^#?]*)?",iq="([?][^#]*)?",aq="(#.*)?",oq=new RegExp(`^did:${QH}:${eq}${rq}${nq}${iq}${aq}$`);function jk(e){if(e===""||!e)return null;let t=e.match(oq);if(t){let r={did:`did:${t[1]}:${t[2]}`,method:t[1],id:t[2],didUrl:e};if(t[4]){let n=t[4].slice(1).split(";");r.params={};for(let a of n){let s=a.split("=");r.params[s[0]]=s[1]}}return t[6]&&(r.path=t[6]),t[7]&&(r.query=t[7].slice(1)),t[8]&&(r.fragment=t[8].slice(1)),r}return null}i(jk,"parse2");o(jk,"parse");var sq=ir(Sd(),1),cq=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate4"),yc,lb=o(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),pS={anchor:!1,publish:!0,sync:ud.PREFER_CACHE},fb={anchor:!0,publish:!0},uq={sync:ud.PREFER_CACHE},Gu=yc=o(i(class extends Lk{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,sq.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...pS,...n};let a=Fk(r),s=yc.makeGenesis(a);return yc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...pS,...n},t.createStreamFromGenesis(yc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...fb,...n};let a=typeof t=="string"?t.trim():t.id;if(jk(a)?.did!==a)throw new Error(`DID is not valid: '${a}'`);let c=await r.createLink(a);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...fb,...r};let n=this.makeCommit(t),a=await this.api.applyCommit(this.id,n,r);this.state$.next(a.state)}async clearDid(t,r={}){r={...fb,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...uq,...n};let a=ws.from(r);if(a.type!=yc.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${yc.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}static makeGenesis(t){return t.chainId.namespace==="eip155"&&(t.address=t.address.toLowerCase()),{header:{controllers:[`${t.address}@${t.chainId.toString()}`],family:`caip10-${t.chainId.toString()}`}}}makeCommit(t){return{data:t,prev:this.tip,id:this.id.cid}}makeReadOnly(){this.setDidProof=lb,this.setDid=lb,this.sync=lb,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");Gu.STREAM_TYPE_NAME="caip10-link";Gu.STREAM_TYPE_ID=1;Gu=yc=cq([Uk()],Gu);Ga();al();var lq=ir($$(),1),fq=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate5"),$a,dq={sync:ei.PREFER_CACHE};async function i6(e){if(e.did==null)throw new Error("No DID provided");e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`))}i(i6,"_ensureAuthenticated");o(i6,"_ensureAuthenticated");async function $k(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i($k,"throwReadOnlyError3");o($k,"throwReadOnlyError");var Ic=$a=o(i(class extends Ym{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:$a.MODEL}}static async create(t,r,n){$a.assertComplete(r);let a={publish:!0,anchor:!0,pin:!0,sync:ei.NEVER_SYNC,throwOnInvalidCommit:!0},s=await $a._makeGenesis(t,r,n);return await t.createStreamFromGenesis($a.STREAM_TYPE_ID,s,a)}static assertComplete(t,r){if(!t.name)throw r?new Error(`Model with StreamID ${r.toString()} is missing a 'name' field`):new Error("Model is missing a 'name' field");if(!t.schema)throw r?new Error(`Model ${t.name} (${r.toString()}) is missing a 'schema' field`):new Error(`Model ${t.name} is missing a 'schema' field`);if(!t.accountRelation)throw r?new Error(`Model ${t.name} (${r.toString()}) is missing a 'accountRelation' field`):new Error(`Model ${t.name} is missing a 'accountRelation' field`)}static async load(t,r,n={}){n={...dq,...n};let a=ws.from(r);if(a.type!=$a.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${$a.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return await t.loadStream(a,n)}static async _makeGenesis(t,r,n){let a=await this._makeRawGenesis(t,r,n);return $a._signDagJWS(t,a)}static async _makeRawGenesis(t,r,n){if(r==null)throw new Error("Genesis content cannot be null");if(!n||!n.controller)if(t.did)await i6(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let a={controllers:[n.controller],model:$a.MODEL.bytes};return{data:r,header:a}}makeReadOnly(){this.sync=$k,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await i6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Ic.STREAM_TYPE_NAME="model";Ic.STREAM_TYPE_ID=2;Ic.MODEL=function(){let e=Um("model-v1"),t=lq.default.encode(e,"identity"),r=Hu(W0,t),n=$t.createV1(W0,r);return new Xt("UNLOADABLE",n)}();Ic=$a=fq([Xm()],Ic);var hq=ir(cl(),1),pq=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate6"),sa,mq={anchor:!0,publish:!0,pin:!0,sync:ei.NEVER_SYNC,syncTimeoutSeconds:0},gq={anchor:!1,publish:!1,pin:!0,sync:ei.PREFER_CACHE},vq={sync:ei.PREFER_CACHE},mS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function a6(e){if(e.did==null)throw new Error("No DID provided");e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`))}i(a6,"_ensureAuthenticated2");o(a6,"_ensureAuthenticated");async function U0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(U0,"throwReadOnlyError4");o(U0,"throwReadOnlyError");var Wu=sa=o(i(class extends Ym{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let t=this.state$.value.metadata;return{controller:t.controllers[0],model:t.model}}static async create(t,r,n,a={}){a={...mq,...a};let s=a.asDID?{did:a.asDID}:t,c=await sa._makeGenesis(s,r,n);return t.createStreamFromGenesis(sa.STREAM_TYPE_ID,c,a)}static async single(t,r,n={}){n={...gq,...n};let a=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await sa._makeGenesis(a,null,r);return t.createStreamFromGenesis(sa.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...vq,...n};let a=ws.from(r);if(a.type!=sa.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${sa.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async replace(t,r={}){r={...mS,...r};let n=r.asDID?{did:r.asDID}:this.api,a=await this._makeCommit(n,t),s=await this.api.applyCommit(this.id,a,r);this.state$.next(s.state)}async patch(t,r={}){r={...mS,...r};let n={data:t,prev:this.tip,id:this.id.cid},a=await sa._signDagJWS(this.api,n),s=await this.api.applyCommit(this.id,a,r);this.state$.next(s.state)}makeReadOnly(){this.replace=U0,this.patch=U0,this.sync=U0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return sa._signDagJWS(t,n)}_makeRawCommit(t){return{data:vI.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let a=await this._makeRawGenesis(t,r,n);return n.deterministic?(Um(a),a):sa._signDagJWS(t,a)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let a=n.controller;if(!a)if(t.did)await a6(t),a=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let s={controllers:[a],model:n.model.bytes};return n.deterministic||(s.unique=(0,hq.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await a6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");Wu.STREAM_TYPE_NAME="MID";Wu.STREAM_TYPE_ID=3;Wu=sa=pq([Xm()],Wu);var zk=i(class{constructor(e){this._apiUrl=e}async add(e,t){let r={};t&&(r.force=!0);let n=new URL(`./pins/${e}`,this._apiUrl);await _i(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await _i(r,{method:"delete",body:{opts:t}})}async ls(e){let t=new URL("./pins",this._apiUrl);e&&(t=new URL(`./pins/${e.toString()}`,this._apiUrl));let r=await _i(t),{pinnedStreamIds:n}=r;return{[Symbol.asyncIterator](){let a=0;return{next(){return a===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[a++],done:!1})}}}}}},"RemotePinApi");o(zk,"RemotePinApi");var Hk=i(class{constructor(e){this._fetchJson=_i,this._collectionURL=new URL("./collection",e),this._countURL=new URL("./collection/count",e)}async count(e){return(await this._fetchJson(this._countURL,{method:"POST",body:r6(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:r6(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:Hr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");o(Hk,"RemoteIndexApi");var qk=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=_i,this.modelsPath="./admin/models",this.getCodePath="./admin/getCode"}getCodeUrl(){return new URL(this.getCodePath,this._apiUrl)}getModelsUrl(){return new URL(this.modelsPath,this._apiUrl)}async buildJWS(e,t,r){let n=r?{models:r.map(s=>s.toString())}:void 0,a=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${a.signatures[0].protected}.${a.payload}.${a.signatures[0].signature}`}async generateCode(){return(await this._fetchJson(this.getCodeUrl())).code}async startIndexingModels(e){let t=await this.generateCode();await this._fetchJson(this.getModelsUrl(),{method:"post",body:{jws:await this.buildJWS(this._getDidFn(),t,e)}})}async getIndexedModels(){let e=await this.generateCode();return(await this._fetchJson(this.getModelsUrl(),{headers:{Authorization:`Basic ${await this.buildJWS(this._getDidFn(),e)}`}})).models.map(r=>Xt.fromString(r))}async stopIndexingModels(e){let t=await this.generateCode();await this._fetchJson(this.getModelsUrl(),{method:"delete",body:{jws:await this.buildJWS(this._getDidFn(),t,e)}})}},"RemoteAdminApi");o(qk,"RemoteAdminApi");var yq="/api/v0/",bq="http://localhost:7007",wq={syncInterval:5e3},_q={anchor:!0,publish:!0,sync:ei.PREFER_CACHE},Eq={anchor:!0,publish:!0,sync:ei.PREFER_CACHE},gS={sync:ei.PREFER_CACHE},Aq=i(class{constructor(e=bq,t={}){this._config={...wq,...t},this._apiUrl=new URL(yq,e),this._streamCache=new Map,this.context={api:this},this.pin=new zk(this._apiUrl),this.index=new Hk(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new qk(this._apiUrl,r),this._streamConstructors={[Gu.STREAM_TYPE_ID]:Gu,[Ic.STREAM_TYPE_ID]:Ic,[Wu.STREAM_TYPE_ID]:Wu,[ko.STREAM_TYPE_ID]:ko}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...Eq,...r};let n=await Vi.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),a=this._streamCache.get(n.id.toString());return a?(Hr.statesEqual(n.state,a.state)||a.next(n.state),this.buildStreamFromDocument(a)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...gS,...t};let r=ws.from(e),n=this._streamCache.get(r.baseID.toString());return n?await n._syncState(r,t):(n=await Vi.load(r,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(n.id.toString(),n)),this.buildStreamFromDocument(n)}async multiQuery(e,t){let r=e.map(s=>({...s,streamId:typeof s.streamId=="string"?s.streamId:s.streamId.toString()})),n=new URL("./multiqueries",this._apiUrl),a=await _i(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(a).reduce((s,c)=>{let[l,h]=c,p=Hr.deserializeState(h),g=new Vi(p,this._apiUrl,this._config.syncInterval);return s[l]=this.buildStreamFromDocument(g),s},{})}loadStreamCommits(e){let t=t6(e);return Vi.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={..._q,...r};let n=t6(e),a=await Vi.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),s=this._streamCache.get(n.toString());return s?(s.next(a.state),this.buildStreamFromDocument(a)):(this._streamCache.set(n.toString(),a),this.buildStreamFromDocument(a))}async requestAnchor(e,t={}){t={...gS,...t};let{anchorStatus:r}=await _i(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return r}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}buildStreamFromState(e){let t=new Vi(e,this._apiUrl,this._config.syncInterval);return this.buildStreamFromDocument(t)}buildStreamFromDocument(e){let t=e.state.type,r=this._streamConstructors[t];if(!r)throw new Error(`Failed to find constructor for stream ${t}`);return new r(e,this.context)}async setDID(e){this.context.did=e}async getSupportedChains(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=await _i(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");o(Aq,"CeramicClient");var nr;(function(e){e.assertEqual=a=>a;function t(a){}i(t,"assertIs"),o(t,"assertIs"),e.assertIs=t;function r(a){throw new Error}i(r,"assertNever"),o(r,"assertNever"),e.assertNever=r,e.arrayToEnum=a=>{let s={};for(let c of a)s[c]=c;return s},e.getValidEnumValues=a=>{let s=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of s)c[l]=a[l];return e.objectValues(c)},e.objectValues=a=>e.objectKeys(a).map(function(s){return a[s]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&s.push(c);return s},e.find=(a,s)=>{for(let c of a)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),o(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(nr||(nr={}));var rt=nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hs=o(e=>{switch(typeof e){case"undefined":return rt.undefined;case"string":return rt.string;case"number":return isNaN(e)?rt.nan:rt.number;case"boolean":return rt.boolean;case"function":return rt.function;case"bigint":return rt.bigint;case"symbol":return rt.symbol;case"object":return Array.isArray(e)?rt.array:e===null?rt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?rt.promise:typeof Map<"u"&&e instanceof Map?rt.map:typeof Set<"u"&&e instanceof Set?rt.set:typeof Date<"u"&&e instanceof Date?rt.date:rt.object;default:return rt.unknown}},"getParsedType"),Ge=nr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Sq=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),za=i(class extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},r={_errors:[]},n=o(a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let c=r,l=0;for(;l<s.path.length;){let h=s.path[l];l===s.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(t(s))):c[h]=c[h]||{_errors:[]},c=c[h],l++}}},"processError");return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,nr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}},"ZodError");o(za,"ZodError");za.create=e=>new za(e);var ld=o((e,t)=>{let r;switch(e.code){case Ge.invalid_type:e.received===rt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ge.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,nr.jsonStringifyReplacer)}`;break;case Ge.unrecognized_keys:r=`Unrecognized key(s) in object: ${nr.joinValues(e.keys,", ")}`;break;case Ge.invalid_union:r="Invalid input";break;case Ge.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nr.joinValues(e.options)}`;break;case Ge.invalid_enum_value:r=`Invalid enum value. Expected ${nr.joinValues(e.options)}, received '${e.received}'`;break;case Ge.invalid_arguments:r="Invalid function arguments";break;case Ge.invalid_return_type:r="Invalid function return type";break;case Ge.invalid_date:r="Invalid date";break;case Ge.invalid_string:typeof e.validation=="object"?"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:nr.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ge.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(e.minimum)}`:r="Invalid input";break;case Ge.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(e.maximum)}`:r="Invalid input";break;case Ge.custom:r="Invalid input";break;case Ge.invalid_intersection_types:r="Intersection results could not be merged";break;case Ge.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ge.not_finite:r="Number must be finite";break;default:r=t.defaultError,nr.assertNever(e)}return{message:r}},"errorMap"),Vk=ld;function Kk(e){Vk=e}i(Kk,"setErrorMap");o(Kk,"setErrorMap");function fd(){return Vk}i(fd,"getErrorMap");o(fd,"getErrorMap");var fm=o(e=>{let{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],c={...a,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...a,path:s,message:a.message||l}},"makeIssue"),xq=[];function gt(e,t){let r=fm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,fd(),ld].filter(n=>!!n)});e.common.issues.push(r)}i(gt,"addIssueToContext");o(gt,"addIssueToContext");var Bn=i(class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return Rt;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t)r.push({key:await n.key,value:await n.value});return Bn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:a,value:s}=n;if(a.status==="aborted"||s.status==="aborted")return Rt;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),(typeof s.value<"u"||n.alwaysSet)&&(r[a.value]=s.value)}return{status:e.value,value:r}}},"ParseStatus");o(Bn,"ParseStatus");var Rt=Object.freeze({status:"aborted"}),Gk=o(e=>({status:"dirty",value:e}),"DIRTY"),xn=o(e=>({status:"valid",value:e}),"OK"),o6=o(e=>e.status==="aborted","isAborted"),s6=o(e=>e.status==="dirty","isDirty"),dm=o(e=>e.status==="valid","isValid"),hm=o(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Jt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Jt||(Jt={}));var va=i(class{constructor(e,t,r,n){this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._path.concat(this._key)}},"ParseInputLazyPath");o(va,"ParseInputLazyPath");var vS=o((e,t)=>{if(dm(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new za(e.common.issues);return{success:!1,error:r}}},"handleResult");function zt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:o((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:a}}i(zt,"processCreateParams");o(zt,"processCreateParams");var jt=i(class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return hs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Bn,ctx:{common:e.parent.common,data:e.data,parsedType:hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(hm(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:(r=t?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:hs(e)},a=this._parseSync({data:e,path:n.path,parent:n});return vS(n,a)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:hs(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(hm(n)?n:Promise.resolve(n));return vS(r,a)}refine(e,t){let r=o(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,a)=>{let s=e(n),c=o(()=>a.addIssue({code:Ge.custom,...r(n)}),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new Gi({schema:this,typeName:Tt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ma.create(this)}nullable(){return As.create(this)}nullish(){return this.optional().nullable()}array(){return pa.create(this)}promise(){return Oc.create(this)}or(e){return Qu.create([this,e])}and(e){return el.create(this,e)}transform(e){return new Gi({schema:this,typeName:Tt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new il({innerType:this,defaultValue:t,typeName:Tt.ZodDefault})}brand(){return new z2({typeName:Tt.ZodBranded,type:this,...zt(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new gd({innerType:this,defaultValue:t,typeName:Tt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Nd.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");o(jt,"ZodType");var Tq=/^c[^\s-]{8,}$/i,Cq=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Mq=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Iq=o(e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),Do=i(class extends jt{constructor(){super(...arguments),this._regex=(e,t,r)=>this.refinement(n=>e.test(n),{validation:t,code:Ge.invalid_string,...Jt.errToObj(r)}),this.nonempty=e=>this.min(1,Jt.errToObj(e)),this.trim=()=>new Do({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==rt.string){let a=this._getOrReturnCtx(e);return gt(a,{code:Ge.invalid_type,expected:rt.string,received:a.parsedType}),Rt}let r=new Bn,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,c=e.data.length<a.value;(s||c)&&(n=this._getOrReturnCtx(e,n),s?gt(n,{code:Ge.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&gt(n,{code:Ge.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Mq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"email",code:Ge.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Cq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"uuid",code:Ge.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Tq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"cuid",code:Ge.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),gt(n,{validation:"url",code:Ge.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"regex",code:Ge.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Iq(a).test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:"datetime",message:a.message}),r.dirty()):nr.assertNever(a);return{status:r.value,value:e.data}}_addCheck(e){return new Do({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Jt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Jt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Jt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Jt.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...Jt.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Jt.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Jt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Jt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Jt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Jt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Jt.errToObj(t)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}},"ZodString");o(Do,"ZodString");Do.create=e=>{var t;return new Do({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function Wk(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return s%c/Math.pow(10,a)}i(Wk,"floatSafeRemainder");o(Wk,"floatSafeRemainder");var Es=i(class extends jt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==rt.number){let a=this._getOrReturnCtx(e);return gt(a,{code:Ge.invalid_type,expected:rt.number,received:a.parsedType}),Rt}let r,n=new Bn;for(let a of this._def.checks)a.kind==="int"?nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Wk(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_finite,message:a.message}),n.dirty()):nr.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Jt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Jt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Jt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Jt.toString(t))}setLimit(e,t,r,n){return new Es({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Jt.toString(n)}]})}_addCheck(e){return new Es({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Jt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Jt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Jt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Jt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Jt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Jt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Jt.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}},"ZodNumber");o(Es,"ZodNumber");Es.create=e=>new Es({checks:[],typeName:Tt.ZodNumber,coerce:e?.coerce||!1,...zt(e)});var Ju=i(class extends jt{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==rt.bigint){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.bigint,received:r.parsedType}),Rt}return xn(e.data)}},"ZodBigInt");o(Ju,"ZodBigInt");Ju.create=e=>{var t;return new Ju({typeName:Tt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};var Zu=i(class extends jt{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==rt.boolean){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.boolean,received:r.parsedType}),Rt}return xn(e.data)}},"ZodBoolean");o(Zu,"ZodBoolean");Zu.create=e=>new Zu({typeName:Tt.ZodBoolean,coerce:e?.coerce||!1,...zt(e)});var kc=i(class extends jt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==rt.date){let a=this._getOrReturnCtx(e);return gt(a,{code:Ge.invalid_type,expected:rt.date,received:a.parsedType}),Rt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return gt(a,{code:Ge.invalid_date}),Rt}let r=new Bn,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):nr.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new kc({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Jt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Jt.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}},"ZodDate");o(kc,"ZodDate");kc.create=e=>new kc({checks:[],coerce:e?.coerce||!1,typeName:Tt.ZodDate,...zt(e)});var dd=i(class extends jt{_parse(e){if(this._getType(e)!==rt.symbol){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.symbol,received:r.parsedType}),Rt}return xn(e.data)}},"ZodSymbol");o(dd,"ZodSymbol");dd.create=e=>new dd({typeName:Tt.ZodSymbol,...zt(e)});var Yu=i(class extends jt{_parse(e){if(this._getType(e)!==rt.undefined){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.undefined,received:r.parsedType}),Rt}return xn(e.data)}},"ZodUndefined");o(Yu,"ZodUndefined");Yu.create=e=>new Yu({typeName:Tt.ZodUndefined,...zt(e)});var Xu=i(class extends jt{_parse(e){if(this._getType(e)!==rt.null){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.null,received:r.parsedType}),Rt}return xn(e.data)}},"ZodNull");o(Xu,"ZodNull");Xu.create=e=>new Xu({typeName:Tt.ZodNull,...zt(e)});var Dc=i(class extends jt{constructor(){super(...arguments),this._any=!0}_parse(e){return xn(e.data)}},"ZodAny");o(Dc,"ZodAny");Dc.create=e=>new Dc({typeName:Tt.ZodAny,...zt(e)});var ms=i(class extends jt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xn(e.data)}},"ZodUnknown");o(ms,"ZodUnknown");ms.create=e=>new ms({typeName:Tt.ZodUnknown,...zt(e)});var Ha=i(class extends jt{_parse(e){let t=this._getOrReturnCtx(e);return gt(t,{code:Ge.invalid_type,expected:rt.never,received:t.parsedType}),Rt}},"ZodNever");o(Ha,"ZodNever");Ha.create=e=>new Ha({typeName:Tt.ZodNever,...zt(e)});var hd=i(class extends jt{_parse(e){if(this._getType(e)!==rt.undefined){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.void,received:r.parsedType}),Rt}return xn(e.data)}},"ZodVoid");o(hd,"ZodVoid");hd.create=e=>new hd({typeName:Tt.ZodVoid,...zt(e)});var pa=i(class extends jt{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==rt.array)return gt(t,{code:Ge.invalid_type,expected:rt.array,received:t.parsedType}),Rt;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(s||c)&&(gt(t,{code:s?Ge.too_big:Ge.too_small,minimum:c?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(gt(t,{code:Ge.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(gt(t,{code:Ge.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all(t.data.map((s,c)=>n.type._parseAsync(new va(t,s,t.path,c)))).then(s=>Bn.mergeArray(r,s));let a=t.data.map((s,c)=>n.type._parseSync(new va(t,s,t.path,c)));return Bn.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new pa({...this._def,minLength:{value:e,message:Jt.toString(t)}})}max(e,t){return new pa({...this._def,maxLength:{value:e,message:Jt.toString(t)}})}length(e,t){return new pa({...this._def,exactLength:{value:e,message:Jt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");o(pa,"ZodArray");pa.create=(e,t)=>new pa({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tt.ZodArray,...zt(t)});var pm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(pm||(pm={}));var yS=o(e=>t=>new Dr({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function wc(e){if(e instanceof Dr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ma.create(wc(n))}return new Dr({...e._def,shape:()=>t})}else return e instanceof pa?pa.create(wc(e.element)):e instanceof ma?ma.create(wc(e.unwrap())):e instanceof As?As.create(wc(e.unwrap())):e instanceof qa?qa.create(e.items.map(t=>wc(t))):e}i(wc,"deepPartialify");o(wc,"deepPartialify");var Dr=i(class extends jt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=yS(this._def),this.extend=yS(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=nr.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==rt.object){let h=this._getOrReturnCtx(e);return gt(h,{code:Ge.invalid_type,expected:rt.object,received:h.parsedType}),Rt}let{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ha&&this._def.unknownKeys==="strip"))for(let h in n.data)s.includes(h)||c.push(h);let l=[];for(let h of s){let p=a[h],g=n.data[h];l.push({key:{status:"valid",value:h},value:p._parse(new va(n,g,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof Ha){let h=this._def.unknownKeys;if(h==="passthrough")for(let p of c)l.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(h==="strict")c.length>0&&(gt(n,{code:Ge.unrecognized_keys,keys:c}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let p of c){let g=n.data[p];l.push({key:{status:"valid",value:p},value:h._parse(new va(n,g,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let p of l){let g=await p.key;h.push({key:g,value:await p.value,alwaysSet:p.alwaysSet})}return h}).then(h=>Bn.mergeObjectSync(r,h)):Bn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Jt.errToObj,new Dr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,a,s,c;let l=(s=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,r).message)!==null&&s!==void 0?s:r.defaultError;return t.code==="unrecognized_keys"?{message:(c=Jt.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Dr({...this._def,unknownKeys:"strip"})}passthrough(){return new Dr({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Dr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>pm.mergeShapes(this._def.shape(),e._def.shape()),typeName:Tt.ZodObject})}catchall(e){return new Dr({...this._def,catchall:e})}pick(e){let t={};return nr.objectKeys(e).map(r=>{this.shape[r]&&(t[r]=this.shape[r])}),new Dr({...this._def,shape:()=>t})}omit(e){let t={};return nr.objectKeys(this.shape).map(r=>{nr.objectKeys(e).indexOf(r)===-1&&(t[r]=this.shape[r])}),new Dr({...this._def,shape:()=>t})}deepPartial(){return wc(this)}partial(e){let t={};if(e)return nr.objectKeys(this.shape).map(r=>{nr.objectKeys(e).indexOf(r)===-1?t[r]=this.shape[r]:t[r]=this.shape[r].optional()}),new Dr({...this._def,shape:()=>t});for(let r in this.shape){let n=this.shape[r];t[r]=n.optional()}return new Dr({...this._def,shape:()=>t})}required(e){let t={};if(e)nr.objectKeys(this.shape).map(r=>{if(nr.objectKeys(e).indexOf(r)===-1)t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof ma;)a=a._def.innerType;t[r]=a}});else for(let r in this.shape){let a=this.shape[r];for(;a instanceof ma;)a=a._def.innerType;t[r]=a}return new Dr({...this._def,shape:()=>t})}keyof(){return $2(nr.objectKeys(this.shape))}},"ZodObject");o(Dr,"ZodObject");Dr.create=(e,t)=>new Dr({shape:()=>e,unknownKeys:"strip",catchall:Ha.create(),typeName:Tt.ZodObject,...zt(t)});Dr.strictCreate=(e,t)=>new Dr({shape:()=>e,unknownKeys:"strict",catchall:Ha.create(),typeName:Tt.ZodObject,...zt(t)});Dr.lazycreate=(e,t)=>new Dr({shape:e,unknownKeys:"strip",catchall:Ha.create(),typeName:Tt.ZodObject,...zt(t)});var Qu=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(let c of a)if(c.result.status==="valid")return c.result;for(let c of a)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=a.map(c=>new za(c.ctx.common.issues));return gt(t,{code:Ge.invalid_union,unionErrors:s}),Rt}if(i(n,"handleResults"),o(n,"handleResults"),t.common.async)return Promise.all(r.map(async a=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let a,s=[];for(let l of r){let h={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:h});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:h}),h.common.issues.length&&s.push(h.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let c=s.map(l=>new za(l));return gt(t,{code:Ge.invalid_union,unionErrors:c}),Rt}}get options(){return this._def.options}},"ZodUnion");o(Qu,"ZodUnion");Qu.create=(e,t)=>new Qu({options:e,typeName:Tt.ZodUnion,...zt(t)});var F0=o(e=>e instanceof tl?F0(e.schema):e instanceof Gi?F0(e.innerType()):e instanceof rl?[e.value]:e instanceof wl?e.options:e instanceof nl?Object.keys(e.enum):e instanceof il?F0(e._def.innerType):e instanceof Yu?[void 0]:e instanceof Xu?[null]:null,"getDiscriminator"),Qm=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.object)return gt(t,{code:Ge.invalid_type,expected:rt.object,received:t.parsedType}),Rt;let r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(gt(t,{code:Ge.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Rt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let a of t){let s=F0(a.shape[e]);if(!s)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of s){if(n.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);n.set(c,a)}}return new Qm({typeName:Tt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...zt(r)})}},"ZodDiscriminatedUnion");o(Qm,"ZodDiscriminatedUnion");function mm(e,t){let r=hs(e),n=hs(t);if(e===t)return{valid:!0,data:e};if(r===rt.object&&n===rt.object){let a=nr.objectKeys(t),s=nr.objectKeys(e).filter(l=>a.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=mm(e[l],t[l]);if(!h.valid)return{valid:!1};c[l]=h.data}return{valid:!0,data:c}}else if(r===rt.array&&n===rt.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=mm(c,l);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return r===rt.date&&n===rt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(mm,"mergeValues");o(mm,"mergeValues");var el=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=o((a,s)=>{if(o6(a)||o6(s))return Rt;let c=mm(a.value,s.value);return c.valid?((s6(a)||s6(s))&&t.dirty(),{status:t.value,value:c.data}):(gt(r,{code:Ge.invalid_intersection_types}),Rt)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,s])=>n(a,s)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}},"ZodIntersection");o(el,"ZodIntersection");el.create=(e,t,r)=>new el({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var qa=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.array)return gt(r,{code:Ge.invalid_type,expected:rt.array,received:r.parsedType}),Rt;if(r.data.length<this._def.items.length)return gt(r,{code:Ge.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Rt;!this._def.rest&&r.data.length>this._def.items.length&&(gt(r,{code:Ge.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=r.data.map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new va(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(a).then(s=>Bn.mergeArray(t,s)):Bn.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new qa({...this._def,rest:e})}},"ZodTuple");o(qa,"ZodTuple");qa.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qa({items:e,typeName:Tt.ZodTuple,rest:null,...zt(t)})};var pd=i(class extends jt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.object)return gt(r,{code:Ge.invalid_type,expected:rt.object,received:r.parsedType}),Rt;let n=[],a=this._def.keyType,s=this._def.valueType;for(let c in r.data)n.push({key:a._parse(new va(r,c,r.path,c)),value:s._parse(new va(r,r.data[c],r.path,c))});return r.common.async?Bn.mergeObjectAsync(t,n):Bn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof jt?new pd({keyType:e,valueType:t,typeName:Tt.ZodRecord,...zt(r)}):new pd({keyType:Do.create(),valueType:e,typeName:Tt.ZodRecord,...zt(t)})}},"ZodRecord");o(pd,"ZodRecord");var md=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.map)return gt(r,{code:Ge.invalid_type,expected:rt.map,received:r.parsedType}),Rt;let n=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map(([c,l],h)=>({key:n._parse(new va(r,c,r.path,[h,"key"])),value:a._parse(new va(r,l,r.path,[h,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of s){let h=await l.key,p=await l.value;if(h.status==="aborted"||p.status==="aborted")return Rt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of s){let h=l.key,p=l.value;if(h.status==="aborted"||p.status==="aborted")return Rt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}}}},"ZodMap");o(md,"ZodMap");md.create=(e,t,r)=>new md({valueType:t,keyType:e,typeName:Tt.ZodMap,...zt(r)});var Rc=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.set)return gt(r,{code:Ge.invalid_type,expected:rt.set,received:r.parsedType}),Rt;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(gt(r,{code:Ge.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(gt(r,{code:Ge.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function s(l){let h=new Set;for(let p of l){if(p.status==="aborted")return Rt;p.status==="dirty"&&t.dirty(),h.add(p.value)}return{status:t.value,value:h}}i(s,"finalizeSet"),o(s,"finalizeSet");let c=[...r.data.values()].map((l,h)=>a._parse(new va(r,l,r.path,h)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new Rc({...this._def,minSize:{value:e,message:Jt.toString(t)}})}max(e,t){return new Rc({...this._def,maxSize:{value:e,message:Jt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},"ZodSet");o(Rc,"ZodSet");Rc.create=(e,t)=>new Rc({valueType:e,minSize:null,maxSize:null,typeName:Tt.ZodSet,...zt(t)});var ju=i(class extends jt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.function)return gt(t,{code:Ge.invalid_type,expected:rt.function,received:t.parsedType}),Rt;function r(c,l){return fm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fd(),ld].filter(h=>!!h),issueData:{code:Ge.invalid_arguments,argumentsError:l}})}i(r,"makeArgsIssue"),o(r,"makeArgsIssue");function n(c,l){return fm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fd(),ld].filter(h=>!!h),issueData:{code:Ge.invalid_return_type,returnTypeError:l}})}i(n,"makeReturnsIssue"),o(n,"makeReturnsIssue");let a={errorMap:t.common.contextualErrorMap},s=t.data;return this._def.returns instanceof Oc?xn(async(...c)=>{let l=new za([]),h=await this._def.args.parseAsync(c,a).catch(v=>{throw l.addIssue(r(c,v)),l}),p=await s(...h);return await this._def.returns._def.type.parseAsync(p,a).catch(v=>{throw l.addIssue(n(p,v)),l})}):xn((...c)=>{let l=this._def.args.safeParse(c,a);if(!l.success)throw new za([r(c,l.error)]);let h=s(...l.data),p=this._def.returns.safeParse(h,a);if(!p.success)throw new za([n(h,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ju({...this._def,args:qa.create(e).rest(ms.create())})}returns(e){return new ju({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ju({args:e||qa.create([]).rest(ms.create()),returns:t||ms.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");o(ju,"ZodFunction");var tl=i(class extends jt{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}},"ZodLazy");o(tl,"ZodLazy");tl.create=(e,t)=>new tl({getter:e,typeName:Tt.ZodLazy,...zt(t)});var rl=i(class extends jt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return gt(t,{code:Ge.invalid_literal,expected:this._def.value}),Rt}return{status:"valid",value:e.data}}get value(){return this._def.value}},"ZodLiteral");o(rl,"ZodLiteral");rl.create=(e,t)=>new rl({value:e,typeName:Tt.ZodLiteral,...zt(t)});function $2(e,t){return new wl({values:e,typeName:Tt.ZodEnum,...zt(t)})}i($2,"createZodEnum");o($2,"createZodEnum");var wl=i(class extends jt{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return gt(t,{expected:nr.joinValues(r),received:t.parsedType,code:Ge.invalid_type}),Rt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return gt(t,{received:t.data,code:Ge.invalid_enum_value,options:r}),Rt}return xn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}},"ZodEnum");o(wl,"ZodEnum");wl.create=$2;var nl=i(class extends jt{_parse(e){let t=nr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==rt.string&&r.parsedType!==rt.number){let n=nr.objectValues(t);return gt(r,{expected:nr.joinValues(n),received:r.parsedType,code:Ge.invalid_type}),Rt}if(t.indexOf(e.data)===-1){let n=nr.objectValues(t);return gt(r,{received:r.data,code:Ge.invalid_enum_value,options:n}),Rt}return xn(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");o(nl,"ZodNativeEnum");nl.create=(e,t)=>new nl({values:e,typeName:Tt.ZodNativeEnum,...zt(t)});var Oc=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.promise&&t.common.async===!1)return gt(t,{code:Ge.invalid_type,expected:rt.promise,received:t.parsedType}),Rt;let r=t.parsedType===rt.promise?t.data:Promise.resolve(t.data);return xn(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");o(Oc,"ZodPromise");Oc.create=(e,t)=>new Oc({type:e,typeName:Tt.ZodPromise,...zt(t)});var Gi=i(class extends jt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Tt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let s=n.transform(r.data);return r.common.async?Promise.resolve(s).then(c=>this._def.schema._parseAsync({data:c,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}let a={addIssue:s=>{gt(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="refinement"){let s=o(c=>{let l=n.refinement(c,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Rt:(c.status==="dirty"&&t.dirty(),s(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Rt:(c.status==="dirty"&&t.dirty(),s(c.value).then(()=>({status:t.value,value:c.value}))))}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!dm(s))return s;let c=n.transform(s.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>dm(s)?Promise.resolve(n.transform(s.value,a)).then(c=>({status:t.value,value:c})):s);nr.assertNever(n)}},"ZodEffects");o(Gi,"ZodEffects");Gi.create=(e,t,r)=>new Gi({schema:e,typeName:Tt.ZodEffects,effect:t,...zt(r)});Gi.createWithPreprocess=(e,t,r)=>new Gi({schema:t,effect:{type:"preprocess",transform:e},typeName:Tt.ZodEffects,...zt(r)});var ma=i(class extends jt{_parse(e){return this._getType(e)===rt.undefined?xn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");o(ma,"ZodOptional");ma.create=(e,t)=>new ma({innerType:e,typeName:Tt.ZodOptional,...zt(t)});var As=i(class extends jt{_parse(e){return this._getType(e)===rt.null?xn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodNullable");o(As,"ZodNullable");As.create=(e,t)=>new As({innerType:e,typeName:Tt.ZodNullable,...zt(t)});var il=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===rt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},"ZodDefault");o(il,"ZodDefault");il.create=(e,t)=>new il({innerType:e,typeName:Tt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var gd=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return hm(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()})):{status:"valid",value:r.status==="valid"?r.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}},"ZodCatch");o(gd,"ZodCatch");gd.create=(e,t)=>new gd({innerType:e,typeName:Tt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var vd=i(class extends jt{_parse(e){if(this._getType(e)!==rt.nan){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.nan,received:r.parsedType}),Rt}return{status:"valid",value:e.data}}},"ZodNaN");o(vd,"ZodNaN");vd.create=e=>new vd({typeName:Tt.ZodNaN,...zt(e)});var kq=Symbol("zod_brand"),z2=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},"ZodBranded");o(z2,"ZodBranded");var Nd=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return o(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Rt:a.status==="dirty"?(t.dirty(),Gk(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})},"handleAsync")();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?Rt:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new Nd({in:e,out:t,typeName:Tt.ZodPipeline})}},"ZodPipeline");o(Nd,"ZodPipeline");var Jk=o((e,t={},r)=>e?Dc.create().superRefine((n,a)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;a.addIssue({code:"custom",...c,fatal:r})}}):Dc.create(),"custom"),Dq={object:Dr.lazycreate},Tt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"})(Tt||(Tt={}));var Rq=o((e,t={message:`Input not instance of ${e.name}`})=>Jk(r=>r instanceof e,t,!0),"instanceOfType"),Zk=Do.create,Yk=Es.create,Oq=vd.create,Nq=Ju.create,Xk=Zu.create,Pq=kc.create,Bq=dd.create,Lq=Yu.create,Uq=Xu.create,Fq=Dc.create,jq=ms.create,$q=Ha.create,zq=hd.create,Hq=pa.create,qq=Dr.create,Vq=Dr.strictCreate,Kq=Qu.create,Gq=Qm.create,Wq=el.create,Jq=qa.create,Zq=pd.create,Yq=md.create,Xq=Rc.create,Qq=ju.create,eV=tl.create,tV=rl.create,rV=wl.create,nV=nl.create,iV=Oc.create,bS=Gi.create,aV=ma.create,oV=As.create,sV=Gi.createWithPreprocess,cV=Nd.create,uV=o(()=>Zk().optional(),"ostring"),lV=o(()=>Yk().optional(),"onumber"),fV=o(()=>Xk().optional(),"oboolean"),dV={string:e=>Do.create({...e,coerce:!0}),number:e=>Es.create({...e,coerce:!0}),boolean:e=>Zu.create({...e,coerce:!0}),bigint:e=>Ju.create({...e,coerce:!0}),date:e=>kc.create({...e,coerce:!0})},hV=Rt,H=Object.freeze({__proto__:null,defaultErrorMap:ld,setErrorMap:Kk,getErrorMap:fd,makeIssue:fm,EMPTY_PATH:xq,addIssueToContext:gt,ParseStatus:Bn,INVALID:Rt,DIRTY:Gk,OK:xn,isAborted:o6,isDirty:s6,isValid:dm,isAsync:hm,get util(){return nr},ZodParsedType:rt,getParsedType:hs,ZodType:jt,ZodString:Do,ZodNumber:Es,ZodBigInt:Ju,ZodBoolean:Zu,ZodDate:kc,ZodSymbol:dd,ZodUndefined:Yu,ZodNull:Xu,ZodAny:Dc,ZodUnknown:ms,ZodNever:Ha,ZodVoid:hd,ZodArray:pa,get objectUtil(){return pm},ZodObject:Dr,ZodUnion:Qu,ZodDiscriminatedUnion:Qm,ZodIntersection:el,ZodTuple:qa,ZodRecord:pd,ZodMap:md,ZodSet:Rc,ZodFunction:ju,ZodLazy:tl,ZodLiteral:rl,ZodEnum:wl,ZodNativeEnum:nl,ZodPromise:Oc,ZodEffects:Gi,ZodTransformer:Gi,ZodOptional:ma,ZodNullable:As,ZodDefault:il,ZodCatch:gd,ZodNaN:vd,BRAND:kq,ZodBranded:z2,ZodPipeline:Nd,custom:Jk,Schema:jt,ZodSchema:jt,late:Dq,get ZodFirstPartyTypeKind(){return Tt},coerce:dV,any:Fq,array:Hq,bigint:Nq,boolean:Xk,date:Pq,discriminatedUnion:Gq,effect:bS,enum:rV,function:Qq,instanceof:Rq,intersection:Wq,lazy:eV,literal:tV,map:Yq,nan:Oq,nativeEnum:nV,never:$q,null:Uq,nullable:oV,number:Yk,object:qq,oboolean:fV,onumber:lV,optional:aV,ostring:uV,pipeline:cV,preprocess:sV,promise:iV,record:Zq,set:Xq,strictObject:Vq,string:Zk,symbol:Bq,transformer:bS,tuple:Jq,undefined:Lq,union:Kq,unknown:jq,void:zq,NEVER:hV,ZodIssueCode:Ge,quotelessJson:Sq,ZodError:za}),pV=Object.defineProperty,mV=o((e,t)=>pV(e,"name",{value:t,configurable:!0}),"__name"),e1=H.array(H.string().or(H.record(H.any()))),eX=H.object({type:H.string().optional(),narrative:H.string().optional()}),t1=H.string().or(H.object({id:H.string(),type:H.string(),caption:H.string().optional()})),gV=H.object({type:H.string().min(1).or(H.string().array().nonempty()),latitude:H.number(),longitude:H.number()}),vV=H.object({type:H.string().min(1).or(H.string().array().nonempty()),addressCountry:H.string().optional(),addressCountryCode:H.string().optional(),addressRegion:H.string().optional(),addressLocality:H.string().optional(),streetAddress:H.string().optional(),postOfficeBoxNumber:H.string().optional(),postalCode:H.string().optional(),geo:gV.optional()}),yV=H.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(H.string()),Qk=H.object({type:H.string().min(1).or(H.string().array().nonempty()),identifier:H.string(),identifierType:yV}),yd=H.string().or(H.object({id:H.string().optional(),type:H.string().or(H.string().array().nonempty().optional()),name:H.string().optional(),url:H.string().optional(),phone:H.string().optional(),description:H.string().optional(),endorsement:H.any().array().optional(),image:t1.optional(),email:H.string().email().optional(),address:vV.optional(),otherIdentifier:Qk.array().optional(),official:H.string().optional(),parentOrg:H.any().optional(),familyName:H.string().optional(),givenName:H.string().optional(),additionalName:H.string().optional(),patronymicName:H.string().optional(),honorificPrefix:H.string().optional(),honorificSuffix:H.string().optional(),familyNamePrefix:H.string().optional(),dateOfBirth:H.string().optional()}).catchall(H.any())),c6=H.object({id:H.string().optional()}).catchall(H.any()),A0=H.object({type:H.string(),id:H.string()}).catchall(H.any()),wS=H.object({id:H.string(),type:H.string()}).catchall(H.any()),_S=H.object({id:H.string().optional(),type:H.string()}).catchall(H.any()),ES=H.object({type:H.string(),id:H.string().optional()}).catchall(H.any()),AS=H.object({type:H.string().or(H.string().array().nonempty()),id:H.string().optional()}).catchall(H.any()),gm=H.object({"@context":e1,id:H.string().optional(),type:H.string().array().nonempty(),issuer:yd,credentialSubject:c6.or(c6.array()),refreshService:_S.or(_S.array()).optional(),credentialSchema:wS.or(wS.array()).optional(),issuanceDate:H.string().optional(),expirationDate:H.string().optional(),credentialStatus:A0.or(A0.array()).optional(),name:H.string().optional(),description:H.string().optional(),validFrom:H.string().optional(),validUntil:H.string().optional(),status:A0.or(A0.array()).optional(),termsOfUse:ES.or(ES.array()).optional(),evidence:AS.or(AS.array()).optional()}).catchall(H.any()),Va=H.object({type:H.string(),created:H.string(),challenge:H.string().optional(),domain:H.string().optional(),nonce:H.string().optional(),proofPurpose:H.string(),verificationMethod:H.string(),jws:H.string().optional()}).catchall(H.any()),SS=gm.extend({proof:Va.or(Va.array())}),bV=H.object({"@context":e1,id:H.string().optional(),type:H.string().or(H.string().array().nonempty()),verifiableCredential:SS.or(SS.array()).optional(),holder:H.string().optional()}).catchall(H.any()),tX=bV.extend({proof:Va.or(Va.array())}),H2=H.object({kty:H.string(),crv:H.string(),x:H.string(),y:H.string().optional(),n:H.string().optional(),d:H.string().optional()}),rX=H2.omit({d:!0}).extend({d:H.string()}),wV=H.object({alg:H.string(),iv:H.string(),tag:H.string(),epk:H2.partial().optional(),kid:H.string().optional(),apv:H.string().optional(),apu:H.string().optional()}),_V=H.object({header:wV,encrypted_key:H.string()}),EV=H.object({protected:H.string(),iv:H.string(),ciphertext:H.string(),tag:H.string(),aad:H.string().optional(),recipients:_V.array().optional()}),vc=H.string().or(H.object({"@context":e1.optional(),id:H.string(),type:H.string(),controller:H.string(),publicKeyJwk:H2.optional(),publicKeyBase58:H.string().optional(),blockChainAccountId:H.string().optional()}).catchall(H.any())),AV=H.object({id:H.string(),type:H.string().or(H.string().array().nonempty()),serviceEndpoint:H.any().or(H.any().array().nonempty())}).catchall(H.any()),nX=H.object({"@context":e1,id:H.string(),alsoKnownAs:H.string().optional(),controller:H.string().or(H.string().array().nonempty()).optional(),verificationMethod:vc.array().optional(),authentication:vc.array().optional(),assertionMethod:vc.array().optional(),keyAgreement:vc.array().optional(),capabilityInvocation:vc.array().optional(),capabilityDelegation:vc.array().optional(),publicKey:vc.array().optional(),service:AV.array().optional(),proof:Va.or(Va.array()).optional()}).catchall(H.any()),SV=H.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(H.string()),r1=H.object({type:H.string().array().nonempty(),targetCode:H.string().optional(),targetDescription:H.string().optional(),targetName:H.string(),targetFramework:H.string().optional(),targetType:SV.optional(),targetUrl:H.string()}),xV=H.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),TV=xV.or(H.string()),CV=H.object({id:H.string().optional(),narrative:H.string().optional()}).catchall(H.any()),MV=H.object({id:H.string(),type:H.string().array().nonempty(),endorsementComment:H.string().optional()}),IV=gm.extend({credentialSubject:MV,proof:Va.or(Va.array()).optional()}),kV=H.object({id:H.string(),"@language":H.string().optional(),version:H.string().optional()}),DV=H.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(H.string()),RV=H.object({id:H.string(),type:H.string().array().nonempty(),alignment:r1.array().optional(),description:H.string().optional(),level:H.string().optional(),name:H.string(),points:H.string().optional()}).catchall(H.any()),OV=H.object({id:H.string(),type:H.string().array().nonempty(),alignment:r1.array().optional(),allowedValue:H.string().array().optional(),name:H.string(),requiredLevel:H.string().optional(),requiredValue:H.string().optional(),resultType:DV,rubricCriterionLevel:RV.array().optional(),valueMax:H.string().optional(),valueMin:H.string().optional()}).catchall(H.any()),NV=H.object({id:H.string().optional(),type:H.string().array().nonempty(),alignment:r1.array().optional(),achievementType:TV.optional(),creator:yd.optional(),creditsAvailable:H.number().optional(),criteria:CV,description:H.string(),endorsement:IV.array().optional(),fieldOfStudy:H.string().optional(),humanCode:H.string().optional(),image:t1.optional(),"@language":H.string().optional(),name:H.string(),otherIdentifier:Qk.array().optional(),related:kV.array().optional(),resultDescription:OV.array().optional(),specialization:H.string().optional(),tag:H.string().array().optional(),version:H.string().optional()}).catchall(H.any()),PV=H.object({type:H.string(),hashed:H.boolean(),identityHash:H.string(),identityType:H.string(),salt:H.string().optional()}),BV=H.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),LV=H.object({type:H.string().array().nonempty(),achievedLevel:H.string().optional(),alignment:r1.array().optional(),resultDescription:H.string().optional(),status:BV.optional(),value:H.string().optional()}).catchall(H.any()),xS=H.object({id:H.string().optional(),type:H.string().array().nonempty(),activityEndDate:H.string().optional(),activityStartDate:H.string().optional(),creditsEarned:H.number().optional(),achievement:NV.optional(),identifier:PV.array().optional(),image:t1.optional(),licenseNumber:H.string().optional(),narrative:H.string().optional(),result:LV.array().optional(),role:H.string().optional(),source:yd.optional(),term:H.string().optional()}).catchall(H.any()),UV=H.object({id:H.string().optional(),type:H.string().or(H.string().array().nonempty()),narrative:H.string().optional(),name:H.string().optional(),description:H.string().optional(),genre:H.string().optional(),audience:H.string().optional()}).catchall(H.any()),FV=gm.extend({name:H.string().optional(),description:H.string().optional(),image:t1.optional(),credentialSubject:xS.or(xS.array()),endorsement:gm.array().optional(),evidence:UV.array().optional()}),iX=FV.extend({proof:Va.or(Va.array())}),aX=H.object({checks:H.string().array(),warnings:H.string().array(),errors:H.string().array()}),eD=H.enum(["Success","Failed","Error"]),oX=eD.enum,sX=H.object({check:H.string(),status:eD,message:H.string().optional(),details:H.string().optional()}),cX=H.object({title:H.string().optional(),createdAt:H.string().optional(),issuer:yd.optional(),issuee:yd.optional(),credentialSubject:c6.optional()}),uX=H.object({id:H.string(),uri:H.string()}).catchall(H.any()),lX=H.object({limit:H.number(),cursor:H.string().optional(),sort:H.string().optional()}),ti=H.object({cursor:H.string().optional(),hasMore:H.boolean()}),tD=H.object({encryptedRecord:EV,fields:H.string().array()}).catchall(H.any()),fX=ti.extend({records:tD.array()}),jV=tD.extend({id:H.string()}),dX=ti.extend({records:jV.array()}),TS=mV(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),$V=H.instanceof(RegExp).or(H.string().refine(e=>{try{return TS(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=TS(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),mr=H.string().or(H.object({$in:H.string().array()})).or(H.object({$regex:$V})),zV=H.object({backgroundColor:H.string().optional(),backgroundImage:H.string().optional(),fadeBackgroundImage:H.boolean().optional(),repeatBackgroundImage:H.boolean().optional(),fontColor:H.string().optional(),accentColor:H.string().optional(),accentFontColor:H.string().optional(),idBackgroundImage:H.string().optional(),fadeIdBackgroundImage:H.boolean().optional(),idBackgroundColor:H.string().optional(),repeatIdBackgroundImage:H.boolean().optional()}),Nc=H.object({profileId:H.string().min(3).max(40),displayName:H.string().default(""),shortBio:H.string().default(""),bio:H.string().default(""),did:H.string(),isPrivate:H.boolean().optional(),email:H.string().optional(),image:H.string().optional(),heroImage:H.string().optional(),websiteLink:H.string().optional(),isServiceProfile:H.boolean().default(!1).optional(),type:H.string().optional(),notificationsWebhook:H.string().url().startsWith("http").optional(),display:zV.optional()}),hX=H.object({profileId:mr,displayName:mr,shortBio:mr,bio:mr,email:mr,websiteLink:mr,isServiceProfile:H.boolean(),type:mr}).partial(),pX=ti.extend({records:Nc.array()}),mX=H.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),rD=H.object({id:H.string(),created:H.string(),displayName:H.string().default("").optional(),shortBio:H.string().default("").optional(),bio:H.string().default("").optional(),email:H.string().optional(),image:H.string().optional(),heroImage:H.string().optional()}),gX=ti.extend({records:rD.extend({did:H.string()}).array()}),vX=H.object({id:mr,displayName:mr,shortBio:mr,bio:mr,email:mr}).partial(),yX=ti.extend({records:H.object({profile:Nc,manager:rD.extend({did:H.string()}).optional()}).array()}),bX=H.object({uri:H.string(),to:H.string(),from:H.string(),sent:H.string().datetime(),received:H.string().datetime().optional()}),nD=H.object({role:H.string(),canEdit:H.boolean(),canIssue:H.boolean(),canRevoke:H.boolean(),canManagePermissions:H.boolean(),canIssueChildren:H.string(),canCreateChildren:H.string(),canEditChildren:H.string(),canRevokeChildren:H.string(),canManageChildrenPermissions:H.string(),canManageChildrenProfiles:H.boolean().default(!1).optional(),canViewAnalytics:H.boolean()}),HV=H.object({role:mr,canEdit:H.boolean(),canIssue:H.boolean(),canRevoke:H.boolean(),canManagePermissions:H.boolean(),canIssueChildren:mr,canCreateChildren:mr,canEditChildren:mr,canRevokeChildren:mr,canManageChildrenPermissions:mr,canManageChildrenProfiles:H.boolean(),canViewAnalytics:H.boolean()}).partial(),CS=H.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),qV=H.discriminatedUnion("type",[H.object({type:H.literal(CS.Values.GRANT_PERMISSIONS),data:H.object({claimUri:H.string(),targetUri:H.string(),permissions:nD.partial()})}),H.object({type:H.literal(CS.Values.ADD_ADMIN),data:H.object({claimUri:H.string(),targetUri:H.string()})})]),wX=H.object({type:mr,data:H.object({claimUri:mr,targetUri:mr,permissions:HV})}).deepPartial(),VV=H.object({id:H.string(),createdAt:H.string(),updatedAt:H.string()}).and(qV),_X=ti.extend({records:VV.array()}),u6=H.enum(["DRAFT","LIVE"]),KV=H.object({uri:H.string(),name:H.string().optional(),type:H.string().optional(),category:H.string().optional(),status:u6.optional(),autoConnectRecipients:H.boolean().optional(),meta:H.record(H.any()).optional(),claimPermissions:nD.optional()}),EX=H.object({uri:mr,name:mr,type:mr,category:mr,meta:H.record(mr),status:u6.or(H.object({$in:u6.array()})),autoConnectRecipients:H.boolean()}).partial(),AX=ti.extend({records:KV.array()}),GV=H.object({to:Nc,from:H.string(),received:H.string().optional(),uri:H.string().optional()}),SX=ti.extend({records:GV.array()}),xX=H.object({endpoint:H.string(),name:H.string(),did:H.string().optional()}),TX=H.object({ttlSeconds:H.number().optional(),totalUses:H.number().optional()}),WV=H.object({endpoint:H.string()}),CX=H.object({signingAuthority:WV,relationship:H.object({name:H.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:H.string()})}),MX=H.object({boostUri:H.string(),signingAuthority:H.object({endpoint:H.string(),name:H.string()})}),JV=H.enum(["live","stale","withdrawn"]),ZV=H.object({read:H.object({anonymize:H.boolean().optional(),credentials:H.object({categories:H.record(H.object({required:H.boolean()})).default({})}).default({}),personal:H.record(H.object({required:H.boolean()})).default({})}).default({}),write:H.object({credentials:H.object({categories:H.record(H.object({required:H.boolean()})).default({})}).default({}),personal:H.record(H.object({required:H.boolean()})).default({})}).default({})}),iD=H.object({contract:ZV,owner:Nc,name:H.string(),subtitle:H.string().optional(),description:H.string().optional(),reasonForAccessing:H.string().optional(),image:H.string().optional(),uri:H.string(),needsGuardianConsent:H.boolean().optional(),redirectUrl:H.string().optional(),frontDoorBoostUri:H.string().optional(),createdAt:H.string(),updatedAt:H.string(),expiresAt:H.string().optional(),autoBoosts:H.string().array().optional()}),IX=ti.extend({records:iD.omit({owner:!0}).array()}),YV=H.object({credentials:H.object({categories:H.record(H.string().array()).default({})}),personal:H.record(H.string()).default({}),date:H.string()}),kX=ti.extend({records:YV.array()}),XV=H.object({credentials:H.object({category:H.string(),uri:H.string()}).array(),personal:H.record(H.string()).default({}),date:H.string(),contractUri:H.string()}),DX=ti.extend({records:XV.array()}),aD=H.object({sharing:H.boolean().optional(),shared:H.string().array().optional(),shareAll:H.boolean().optional(),shareUntil:H.string().optional()}),oD=H.object({read:H.object({anonymize:H.boolean().optional(),credentials:H.object({shareAll:H.boolean().optional(),sharing:H.boolean().optional(),categories:H.record(aD).default({})}).default({}),personal:H.record(H.string()).default({})}).default({}),write:H.object({credentials:H.object({categories:H.record(H.boolean()).default({})}).default({}),personal:H.record(H.boolean()).default({})}).default({})}),RX=ti.extend({records:H.object({expiresAt:H.string().optional(),oneTime:H.boolean().optional(),terms:oD,contract:iD,uri:H.string(),consenter:Nc,status:JV}).array()}),OX=H.object({read:H.object({anonymize:H.boolean().optional(),credentials:H.object({categories:H.record(H.object({required:H.boolean().optional()})).optional()}).optional(),personal:H.record(H.object({required:H.boolean().optional()})).optional()}).optional(),write:H.object({credentials:H.object({categories:H.record(H.object({required:H.boolean().optional()})).optional()}).optional(),personal:H.record(H.object({required:H.boolean().optional()})).optional()}).optional()}),NX=H.object({anonymize:H.boolean().optional(),credentials:H.object({categories:H.record(H.boolean()).optional()}).optional(),personal:H.record(H.boolean()).optional()}),PX=H.object({credentials:H.object({categories:H.record(H.boolean()).optional()}).optional(),personal:H.record(H.boolean()).optional(),id:mr.optional()}),QV=H.object({read:H.object({anonymize:H.boolean().optional(),credentials:H.object({shareAll:H.boolean().optional(),sharing:H.boolean().optional(),categories:H.record(aD.optional()).optional()}).optional(),personal:H.record(H.string()).optional()}).optional(),write:H.object({credentials:H.object({categories:H.record(H.boolean()).optional()}).optional(),personal:H.record(H.boolean()).optional()}).optional()}),l6=H.enum(["consent","update","sync","withdraw","write"]),BX=H.object({terms:QV.optional(),action:l6.or(l6.array()).optional(),date:H.object({$gt:H.string()}).or(H.object({$lt:H.string()})).or(H.object({$eq:H.string()})).optional(),expiresAt:H.object({$gt:H.string()}).or(H.object({$lt:H.string()})).or(H.object({$eq:H.string()})).optional(),oneTime:H.boolean().optional()}),sD=H.object({expiresAt:H.string().optional(),oneTime:H.boolean().optional(),terms:oD.optional(),id:H.string(),action:l6,date:H.string(),uris:H.string().array().optional()}),LX=ti.extend({records:sD.array()}),eK=H.object({credentialUri:H.string(),termsUri:H.string(),contractUri:H.string(),boostUri:H.string(),category:H.string().optional(),date:H.string()}),UX=ti.extend({records:eK.array()}),tK=H.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),rK=H.object({title:H.string().optional(),body:H.string().optional()}),nK=H.object({vcUris:H.array(H.string()).optional(),vpUris:H.array(H.string()).optional(),transaction:sD.optional()}),FX=H.object({type:tK,to:Nc.partial().and(H.object({did:H.string()})),from:Nc.partial().and(H.object({did:H.string()})),message:rK.optional(),data:nK.optional(),sent:H.string().datetime().optional()}),iK="auth-grant:",jX=H.object({id:H.string(),name:H.string(),description:H.string().optional(),challenge:H.string().startsWith(iK).min(10,{message:"Challenge is too short"}).max(100,{message:"Challenge is too long"}),status:H.enum(["revoked","active"],{required_error:"Status is required",invalid_type_error:"Status must be either active or revoked"}),scope:H.string(),createdAt:H.string().datetime({message:"createdAt must be a valid ISO 8601 datetime string"}),expiresAt:H.string().datetime({message:"expiresAt must be a valid ISO 8601 datetime string"}).nullish().optional()}),$X=H.object({id:H.string()}).catchall(H.any()),aK=H.enum(["active","revoked"]),zX=H.object({id:mr,name:mr,description:mr,status:aK}).partial(),n1=o(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),HX=H.string().refine(e=>e.split(":").length===3&&e.split(":")[0]==="lc","URI must be of the form lc:${storage}:${url}").refine(e=>e.split(":")[1]==="ceramic","URI must use storage type ceramic (i.e. must be lc:ceramic:${streamID})");var q2=z.object({credentials:mc.array()}).catchall(z.any()),cD=z.object({id:z.string(),title:z.string(),storageType:z.literal("ceramic").optional()}).catchall(z.any()),V2=z.object({credentials:mc.or(cD).array()}).strict();var uD={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials"};var i1=i(async(e,{modelData:t,credentialAlias:r}=uD)=>{let n=e.invoke.getCeramicClient(),a=new Lf({ceramic:n,model:t}),s=i(async(g=r)=>{let v=await a.get(g);if(!v)return{credentials:[]};let y=await q2.spa(v);if(y.success)return y.data;let _=await V2.spa(v);if(_.success){let D={credentials:_.data.credentials.map(P=>{if("uri"in P)return P;let{title:J,id:j,storageType:q,...Q}=P;return{...Q,id:J,uri:`lc:ceramic:${j.replace("ceramic://","")}`}})};return await a.set(r,D),D}throw console.error(y.error),new Error("Invalid credentials list stored in IDX")},"getCredentialsListFromIdx"),c=i(async(g,v)=>{if(!g)throw new Error("Must provide id to remove");v||(v=r);let y=await s(v);return y.credentials=y.credentials.filter(_=>_.id!==g),a.set(v,y)},"removeCredentialFromIdx"),l=i(async g=>(g||(g=r),a.set(g,{credentials:[]})),"removeAllCredentialsFromIdx"),h=i(async g=>{let v=await mc.parseAsync(g);if(!v)throw new Error("record is required");if(!v.uri)throw Error("No URI provided");await e.read.get(v.uri);let y=await s(r),_=y.credentials.findIndex(x=>x.id===v.id);return _>-1?y.credentials[_]=v:y.credentials.push(v),n1(await a.set(r,y))},"addCredentialInIdx"),p=i(async g=>{let v=mc.array().parse(g),y=await s(r);return await Promise.all(v.map(async _=>{await e.read.get(_.uri);let x=y.credentials.findIndex(O=>O.id===_.id);x>-1?y.credentials[x]=_:y.credentials.push(_)})),n1(await a.set(r,y))},"addCredentialsInIdx");return{name:"IDX",displayName:"IDX",description:"Stores a bespoke index of credentials for an individual based on their did",index:{get:async g=>(g.debug?.("learnCard.index.IDX.get"),(await s()).credentials),add:async(g,v)=>{g.debug?.("learnCard.index.IDX.add");try{return await h(v),!0}catch(y){return console.error("Error adding credential with IDX:",y),!1}},addMany:async(g,v)=>{g.debug?.("learnCard.index.IDX.add");try{return await p(v),!0}catch(y){return console.error("Error adding credential with IDX:",y),!1}},update:async g=>(g.debug?.("learnCard.index.IDX.update"),!1),remove:async(g,v)=>{g.debug?.("learnCard.index.IDX.remove");try{return await c(v),!0}catch(y){return console.error("Error removing credential from IDX:",y),!1}},removeAll:async g=>{g.debug?.("learnCard.index.IDX.removeAll");try{return await l(),!0}catch(v){return console.error("Error removing credentials from IDX:",v),!1}}},methods:{getCredentialsListFromIdx:async(g,v=r)=>(await s(v)).credentials,getVerifiableCredentialFromIdx:async(g,v)=>{let _=(await s())?.credentials?.find(D=>D?.id===v),x=g.read.get(_?.uri),O=await m0.safeParseAsync(x);return O.success?O.data:void 0},getVerifiableCredentialsFromIdx:async g=>{let y=(await s())?.credentials?.map(_=>_?.uri)??[];return(await Promise.all(y.map(async _=>g.read.get(_)))).filter(_=>!!_)},addVerifiableCredentialInIdx:async(g,v)=>{let y=mc.parse(v);if(!y)throw new Error("record is required");if(!y.uri)throw Error("No URI provided");await g.read.get(y.uri);let _=await s(r),x=_.credentials.findIndex(O=>O.id===y.id);return x>-1?_.credentials[x]=y:_.credentials.push(y),n1(await a.set(r,_))},removeVerifiableCredentialInIdx:async(g,v)=>c(v),removeAllVerifiableCredentialsInIdx:async()=>l(),getIDXIndex:async()=>a.get(r),setIDXIndex:async(g,v)=>a.set(r,v)}}},"getIDXPlugin");var oK=i1;
845
+ `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl"),"UnsubscriptionErrorImpl")});function cd(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(cd,"arrRemove");o(cd,"arrRemove");var Od=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription2"),o(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,a,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=Mc(c),h=l.next();!h.done;h=l.next()){var p=h.value;p.remove(this)}}catch(O){t={error:O}}finally{try{h&&!h.done&&(r=l.return)&&r.call(l)}finally{if(t)throw t.error}}else c.remove(this);var g=this.initialTeardown;if(Sr(g))try{g()}catch(O){s=O instanceof sb?O.errors:[O]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var y=Mc(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{Kb(x)}catch(O){s=s??[],O instanceof sb?s=_s(_s([],Io(s)),Io(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(a=y.return)&&a.call(y)}finally{if(n)throw n.error}}}if(s)throw new sb(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Kb(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&cd(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&cd(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),PI=Od.EMPTY;function w2(e){return e instanceof Od||e&&"closed"in e&&Sr(e.remove)&&Sr(e.add)&&Sr(e.unsubscribe)}i(w2,"isSubscription");o(w2,"isSubscription");function Kb(e){Sr(e)?e():e.unsubscribe()}i(Kb,"execFinalizer");o(Kb,"execFinalizer");var Hc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},sm={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=sm.delegate;return a?.setTimeout?a.setTimeout.apply(a,_s([e,t],Io(r))):setTimeout.apply(void 0,_s([e,t],Io(r)))},clearTimeout:function(e){var t=sm.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function _2(e){sm.setTimeout(function(){var t=Hc.onUnhandledError;if(t)t(e);else throw e})}i(_2,"reportUnhandledError");o(_2,"reportUnhandledError");function Gb(){}i(Gb,"noop");o(Gb,"noop");var IH=function(){return Wm("C",void 0,void 0)}();function BI(e){return Wm("E",void 0,e)}i(BI,"errorNotification");o(BI,"errorNotification");function LI(e){return Wm("N",e,void 0)}i(LI,"nextNotification");o(LI,"nextNotification");function Wm(e,t,r){return{kind:e,value:t,error:r}}i(Wm,"createNotification");o(Wm,"createNotification");var Ec=null;function Yf(e){if(Hc.useDeprecatedSynchronousErrorHandling){var t=!Ec;if(t&&(Ec={errorThrown:!1,error:null}),e(),t){var r=Ec,n=r.errorThrown,a=r.error;if(Ec=null,n)throw a}}else e()}i(Yf,"errorContext");o(Yf,"errorContext");function UI(e){Hc.useDeprecatedSynchronousErrorHandling&&Ec&&(Ec.errorThrown=!0,Ec.error=e)}i(UI,"captureError");o(UI,"captureError");var E2=function(e){Ya(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,w2(r)&&r.add(n)):n.destination=RH,n}return i(t,"Subscriber2"),o(t,"Subscriber"),t.create=function(r,n,a){return new Wb(r,n,a)},t.prototype.next=function(r){this.isStopped?O0(LI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?O0(BI(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?O0(IH,this):(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(r){this.destination.next(r)},t.prototype._error=function(r){try{this.destination.error(r)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Od),kH=Function.prototype.bind;function R0(e,t){return kH.call(e,t)}i(R0,"bind");o(R0,"bind");var DH=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver2"),o(e,"ConsumerObserver"),e.prototype.next=function(t){var r=this.partialObserver;if(r.next)try{r.next(t)}catch(n){Wf(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Wf(n)}else Wf(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Wf(r)}},e}(),Wb=function(e){Ya(t,e);function t(r,n,a){var s=e.call(this)||this,c;if(Sr(r)||!r)c={next:r??void 0,error:n??void 0,complete:a??void 0};else{var l;s&&Hc.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&R0(r.next,l),error:r.error&&R0(r.error,l),complete:r.complete&&R0(r.complete,l)}):c=r}return s.destination=new DH(c),s}return i(t,"SafeSubscriber2"),o(t,"SafeSubscriber"),t}(E2);function Wf(e){Hc.useDeprecatedSynchronousErrorHandling?UI(e):_2(e)}i(Wf,"handleUnhandledError");o(Wf,"handleUnhandledError");function FI(e){throw e}i(FI,"defaultErrorHandler");o(FI,"defaultErrorHandler");function O0(e,t){var r=Hc.onStoppedNotification;r&&sm.setTimeout(function(){return r(e,t)})}i(O0,"handleStoppedNotification");o(O0,"handleStoppedNotification");var RH={closed:!0,next:Gb,error:FI,complete:Gb},A2=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Jm(e){return e}i(Jm,"identity3");o(Jm,"identity");function jI(e){return e.length===0?Jm:e.length===1?e[0]:o(i(function(r){return e.reduce(function(n,a){return a(n)},r)},"piped"),"piped")}i(jI,"pipeFromArray");o(jI,"pipeFromArray");var dn=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable2"),o(e,"Observable"),e.prototype.lift=function(t){var r=new e;return r.source=this,r.operator=t,r},e.prototype.subscribe=function(t,r,n){var a=this,s=zI(t)?t:new Wb(t,r,n);return Yf(function(){var c=a,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?a._subscribe(s):a._trySubscribe(s))}),s},e.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(r){t.error(r)}},e.prototype.forEach=function(t,r){var n=this;return r=Jb(r),new r(function(a,s){var c=new Wb({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:a});n.subscribe(c)})},e.prototype._subscribe=function(t){var r;return(r=this.source)===null||r===void 0?void 0:r.subscribe(t)},e.prototype[A2]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return jI(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Jb(t),new t(function(n,a){var s;r.subscribe(function(c){return s=c},function(c){return a(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function Jb(e){var t;return(t=e??Hc.Promise)!==null&&t!==void 0?t:Promise}i(Jb,"getPromiseCtor");o(Jb,"getPromiseCtor");function $I(e){return e&&Sr(e.next)&&Sr(e.error)&&Sr(e.complete)}i($I,"isObserver");o($I,"isObserver");function zI(e){return e&&e instanceof E2||$I(e)&&w2(e)}i(zI,"isSubscriber");o(zI,"isSubscriber");function HI(e){return Sr(e?.lift)}i(HI,"hasLift");o(HI,"hasLift");function Xa(e){return function(t){if(HI(t))return t.lift(function(r){try{return e(r,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}i(Xa,"operate");o(Xa,"operate");function ga(e,t,r,n,a){return new OH(e,t,r,n,a)}i(ga,"createOperatorSubscriber");o(ga,"createOperatorSubscriber");var OH=function(e){Ya(t,e);function t(r,n,a,s,c,l){var h=e.call(this,r)||this;return h.onFinalize=c,h.shouldUnsubscribe=l,h._next=n?function(p){try{n(p)}catch(g){r.error(g)}}:e.prototype._next,h._error=s?function(p){try{s(p)}catch(g){r.error(g)}finally{this.unsubscribe()}}:e.prototype._error,h._complete=a?function(){try{a()}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._complete,h}return i(t,"OperatorSubscriber2"),o(t,"OperatorSubscriber"),t.prototype.unsubscribe=function(){var r;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&((r=this.onFinalize)===null||r===void 0||r.call(this))}},t}(E2),NH=Gm(function(e){return o(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),qI=function(e){Ya(t,e);function t(){var r=e.call(this)||this;return r.closed=!1,r.currentObservers=null,r.observers=[],r.isStopped=!1,r.hasError=!1,r.thrownError=null,r}return i(t,"Subject2"),o(t,"Subject"),t.prototype.lift=function(r){var n=new aS(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new NH},t.prototype.next=function(r){var n=this;Yf(function(){var a,s;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var c=Mc(n.currentObservers),l=c.next();!l.done;l=c.next()){var h=l.value;h.next(r)}}catch(p){a={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(a)throw a.error}}}})},t.prototype.error=function(r){var n=this;Yf(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var a=n.observers;a.length;)a.shift().error(r)}})},t.prototype.complete=function(){var r=this;Yf(function(){if(r._throwIfClosed(),!r.isStopped){r.isStopped=!0;for(var n=r.observers;n.length;)n.shift().complete()}})},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var r;return((r=this.observers)===null||r===void 0?void 0:r.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,a=this,s=a.hasError,c=a.isStopped,l=a.observers;return s||c?PI:(this.currentObservers=null,l.push(r),new Od(function(){n.currentObservers=null,cd(l,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,a=n.hasError,s=n.thrownError,c=n.isStopped;a?r.error(s):c&&r.complete()},t.prototype.asObservable=function(){var r=new dn;return r.source=this,r},t.create=function(r,n){return new aS(r,n)},t}(dn),aS=function(e){Ya(t,e);function t(r,n){var a=e.call(this)||this;return a.destination=r,a.source=n,a}return i(t,"AnonymousSubject2"),o(t,"AnonymousSubject"),t.prototype.next=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.next)===null||a===void 0||a.call(n,r)},t.prototype.error=function(r){var n,a;(a=(n=this.destination)===null||n===void 0?void 0:n.error)===null||a===void 0||a.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,a;return(a=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&a!==void 0?a:PI},t}(qI),PH=function(e){Ya(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return i(t,"BehaviorSubject2"),o(t,"BehaviorSubject"),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(r){var n=e.prototype._subscribe.call(this,r);return!n.closed&&r.next(this._value),n},t.prototype.getValue=function(){var r=this,n=r.hasError,a=r.thrownError,s=r._value;if(n)throw a;return this._throwIfClosed(),s},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(qI),VI={now:function(){return(VI.delegate||Date).now()},delegate:void 0},BH=function(e){Ya(t,e);function t(r,n){return e.call(this)||this}return i(t,"Action2"),o(t,"Action"),t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(Od),cm={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var a=cm.delegate;return a?.setInterval?a.setInterval.apply(a,_s([e,t],Io(r))):setInterval.apply(void 0,_s([e,t],Io(r)))},clearInterval:function(e){var t=cm.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},LH=function(e){Ya(t,e);function t(r,n){var a=e.call(this,r,n)||this;return a.scheduler=r,a.work=n,a.pending=!1,a}return i(t,"AsyncAction2"),o(t,"AsyncAction"),t.prototype.schedule=function(r,n){var a;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var s=this.id,c=this.scheduler;return s!=null&&(this.id=this.recycleAsyncId(c,s,n)),this.pending=!0,this.delay=n,this.id=(a=this.id)!==null&&a!==void 0?a:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,a){return a===void 0&&(a=0),cm.setInterval(r.flush.bind(r,this),a)},t.prototype.recycleAsyncId=function(r,n,a){if(a===void 0&&(a=0),a!=null&&this.delay===a&&this.pending===!1)return n;n!=null&&cm.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var a=this._execute(r,n);if(a)return a;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var a=!1,s;try{this.work(r)}catch(c){a=!0,s=c||new Error("Scheduled action threw falsy error")}if(a)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,a=r.scheduler,s=a.actions;this.work=this.state=this.scheduler=null,this.pending=!1,cd(s,this),n!=null&&(this.id=this.recycleAsyncId(a,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(BH),oS=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return i(e,"Scheduler2"),o(e,"Scheduler"),e.prototype.schedule=function(t,r,n){return r===void 0&&(r=0),new this.schedulerActionCtor(this,t).schedule(n,r)},e.now=VI.now,e}(),UH=function(e){Ya(t,e);function t(r,n){n===void 0&&(n=oS.now);var a=e.call(this,r,n)||this;return a.actions=[],a._active=!1,a}return i(t,"AsyncScheduler2"),o(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var a;this._active=!0;do if(a=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,a){for(;r=n.shift();)r.unsubscribe();throw a}},t}(oS),FH=new UH(LH),jH=FH,KI=new dn(function(e){return e.complete()});function S2(e){return e&&Sr(e.schedule)}i(S2,"isScheduler");o(S2,"isScheduler");function x2(e){return e[e.length-1]}i(x2,"last");o(x2,"last");function GI(e){return S2(x2(e))?e.pop():void 0}i(GI,"popScheduler");o(GI,"popScheduler");function WI(e,t){return typeof x2(e)=="number"?e.pop():t}i(WI,"popNumber");o(WI,"popNumber");var T2=o(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function C2(e){return Sr(e?.then)}i(C2,"isPromise");o(C2,"isPromise");function M2(e){return Sr(e[A2])}i(M2,"isInteropObservable");o(M2,"isInteropObservable");function I2(e){return Symbol.asyncIterator&&Sr(e?.[Symbol.asyncIterator])}i(I2,"isAsyncIterable");o(I2,"isAsyncIterable");function k2(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}i(k2,"createInvalidObservableTypeError");o(k2,"createInvalidObservableTypeError");function JI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(JI,"getSymbolIterator");o(JI,"getSymbolIterator");var ZI=JI();function D2(e){return Sr(e?.[ZI])}i(D2,"isIterable");o(D2,"isIterable");function R2(e){return OI(this,arguments,o(i(function(){var r,n,a,s;return b2(this,function(c){switch(c.label){case 0:r=e.getReader(),c.label=1;case 1:c.trys.push([1,,9,10]),c.label=2;case 2:return[4,Tc(r.read())];case 3:return n=c.sent(),a=n.value,s=n.done,s?[4,Tc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Tc(a)];case 6:return[4,c.sent()];case 7:return c.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})},"readableStreamLikeToAsyncGenerator_1"),"readableStreamLikeToAsyncGenerator_1"))}i(R2,"readableStreamLikeToAsyncGenerator");o(R2,"readableStreamLikeToAsyncGenerator");function O2(e){return Sr(e?.getReader)}i(O2,"isReadableStreamLike");o(O2,"isReadableStreamLike");function No(e){if(e instanceof dn)return e;if(e!=null){if(M2(e))return YI(e);if(T2(e))return XI(e);if(C2(e))return QI(e);if(I2(e))return N2(e);if(D2(e))return ek(e);if(O2(e))return tk(e)}throw k2(e)}i(No,"innerFrom");o(No,"innerFrom");function YI(e){return new dn(function(t){var r=e[A2]();if(Sr(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(YI,"fromInteropObservable");o(YI,"fromInteropObservable");function XI(e){return new dn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(XI,"fromArrayLike");o(XI,"fromArrayLike");function QI(e){return new dn(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,_2)})}i(QI,"fromPromise");o(QI,"fromPromise");function ek(e){return new dn(function(t){var r,n;try{for(var a=Mc(e),s=a.next();!s.done;s=a.next()){var c=s.value;if(t.next(c),t.closed)return}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}t.complete()})}i(ek,"fromIterable");o(ek,"fromIterable");function N2(e){return new dn(function(t){rk(e,t).catch(function(r){return t.error(r)})})}i(N2,"fromAsyncIterable");o(N2,"fromAsyncIterable");function tk(e){return N2(R2(e))}i(tk,"fromReadableStreamLike");o(tk,"fromReadableStreamLike");function rk(e,t){var r,n,a,s;return RI(this,void 0,void 0,function(){var c,l;return b2(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),r=NI(e),h.label=1;case 1:return[4,r.next()];case 2:if(n=h.sent(),!!n.done)return[3,4];if(c=n.value,t.next(c),t.closed)return[2];h.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return l=h.sent(),a={error:l},[3,11];case 6:return h.trys.push([6,,9,10]),n&&!n.done&&(s=r.return)?[4,s.call(r)]:[3,8];case 7:h.sent(),h.label=8;case 8:return[3,10];case 9:if(a)throw a.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(rk,"process2");o(rk,"process");function To(e,t,r,n,a){n===void 0&&(n=0),a===void 0&&(a=!1);var s=t.schedule(function(){r(),a?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!a)return s}i(To,"executeSchedule");o(To,"executeSchedule");function P2(e,t){return t===void 0&&(t=0),Xa(function(r,n){r.subscribe(ga(n,function(a){return To(n,e,function(){return n.next(a)},t)},function(){return To(n,e,function(){return n.complete()},t)},function(a){return To(n,e,function(){return n.error(a)},t)}))})}i(P2,"observeOn");o(P2,"observeOn");function B2(e,t){return t===void 0&&(t=0),Xa(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(B2,"subscribeOn");o(B2,"subscribeOn");function nk(e,t){return No(e).pipe(B2(t),P2(t))}i(nk,"scheduleObservable");o(nk,"scheduleObservable");function ik(e,t){return No(e).pipe(B2(t),P2(t))}i(ik,"schedulePromise");o(ik,"schedulePromise");function ak(e,t){return new dn(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}i(ak,"scheduleArray");o(ak,"scheduleArray");function ok(e,t){return new dn(function(r){var n;return To(r,t,function(){n=e[ZI](),To(r,t,function(){var a,s,c;try{a=n.next(),s=a.value,c=a.done}catch(l){r.error(l);return}c?r.complete():r.next(s)},0,!0)}),function(){return Sr(n?.return)&&n.return()}})}i(ok,"scheduleIterable");o(ok,"scheduleIterable");function L2(e,t){if(!e)throw new Error("Iterable cannot be null");return new dn(function(r){To(r,t,function(){var n=e[Symbol.asyncIterator]();To(r,t,function(){n.next().then(function(a){a.done?r.complete():r.next(a.value)})},0,!0)})})}i(L2,"scheduleAsyncIterable");o(L2,"scheduleAsyncIterable");function sk(e,t){return L2(R2(e),t)}i(sk,"scheduleReadableStreamLike");o(sk,"scheduleReadableStreamLike");function ck(e,t){if(e!=null){if(M2(e))return nk(e,t);if(T2(e))return ak(e,t);if(C2(e))return ik(e,t);if(I2(e))return L2(e,t);if(D2(e))return ok(e,t);if(O2(e))return sk(e,t)}throw k2(e)}i(ck,"scheduled");o(ck,"scheduled");function uk(e,t){return t?ck(e,t):No(e)}i(uk,"from3");o(uk,"from");var lk=Gm(function(e){return o(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function fk(e){return e instanceof Date&&!isNaN(e)}i(fk,"isValidDate");o(fk,"isValidDate");function U2(e,t){return Xa(function(r,n){var a=0;r.subscribe(ga(n,function(s){n.next(e.call(t,s,a++))}))})}i(U2,"map");o(U2,"map");var $H=Array.isArray;function dk(e,t){return $H(t)?e.apply(void 0,_s([],Io(t))):e(t)}i(dk,"callOrApply");o(dk,"callOrApply");function hk(e){return U2(function(t){return dk(e,t)})}i(hk,"mapOneOrManyArgs");o(hk,"mapOneOrManyArgs");function pk(e,t,r,n,a,s,c,l){var h=[],p=0,g=0,v=!1,y=o(function(){v&&!h.length&&!p&&t.complete()},"checkComplete"),_=o(function(O){return p<n?x(O):h.push(O)},"outerNext"),x=o(function(O){s&&t.next(O),p++;var D=!1;No(r(O,g++)).subscribe(ga(t,function(P){a?.(P),s?_(P):t.next(P)},function(){D=!0},void 0,function(){if(D)try{p--;for(var P=o(function(){var J=h.shift();c?To(t,c,function(){return x(J)}):x(J)},"_loop_1");h.length&&p<n;)P();y()}catch(J){t.error(J)}}))},"doInnerSub");return e.subscribe(ga(t,_,function(){v=!0,y()})),function(){l?.()}}i(pk,"mergeInternals");o(pk,"mergeInternals");function Zm(e,t,r){return r===void 0&&(r=1/0),Sr(t)?Zm(function(n,a){return U2(function(s,c){return t(n,s,a,c)})(No(e(n,a)))},r):(typeof t=="number"&&(r=t),Xa(function(n,a){return pk(n,a,e,r)}))}i(Zm,"mergeMap");o(Zm,"mergeMap");function mk(e){return e===void 0&&(e=1/0),Zm(Jm,e)}i(mk,"mergeAll");o(mk,"mergeAll");var zH=["addListener","removeListener"],HH=["addEventListener","removeEventListener"],qH=["on","off"];function um(e,t,r,n){if(Sr(r)&&(n=r,r=void 0),n)return um(e,t,r).pipe(hk(n));var a=Io(yk(e)?HH.map(function(l){return function(h){return e[l](t,h,r)}}):gk(e)?zH.map(Zb(e,t)):vk(e)?qH.map(Zb(e,t)):[],2),s=a[0],c=a[1];if(!s&&T2(e))return Zm(function(l){return um(l,t,r)})(No(e));if(!s)throw new TypeError("Invalid event target");return new dn(function(l){var h=o(function(){for(var p=[],g=0;g<arguments.length;g++)p[g]=arguments[g];return l.next(1<p.length?p:p[0])},"handler");return s(h),function(){return c(h)}})}i(um,"fromEvent");o(um,"fromEvent");function Zb(e,t){return function(r){return function(n){return e[r](t,n)}}}i(Zb,"toCommonHandlerRegistry");o(Zb,"toCommonHandlerRegistry");function gk(e){return Sr(e.addListener)&&Sr(e.removeListener)}i(gk,"isNodeStyleEventEmitter");o(gk,"isNodeStyleEventEmitter");function vk(e){return Sr(e.on)&&Sr(e.off)}i(vk,"isJQueryStyleEventEmitter");o(vk,"isJQueryStyleEventEmitter");function yk(e){return Sr(e.addEventListener)&&Sr(e.removeEventListener)}i(yk,"isEventTarget");o(yk,"isEventTarget");function F2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=jH);var n=-1;return t!=null&&(S2(t)?r=t:n=t),new dn(function(a){var s=fk(e)?+e-r.now():e;s<0&&(s=0);var c=0;return r.schedule(function(){a.closed||(a.next(c++),0<=n?this.schedule(void 0,n):a.complete())},s)})}i(F2,"timer");o(F2,"timer");function bk(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=GI(e),n=WI(e,1/0),a=e;return a.length?a.length===1?No(a[0]):mk(n)(uk(a,r)):KI}i(bk,"merge");o(bk,"merge");function wk(e,t){return Xa(function(r,n){var a=0;r.subscribe(ga(n,function(s){return e.call(t,s,a++)&&n.next(s)}))})}i(wk,"filter");o(wk,"filter");function _k(e){return Xa(function(t,r){var n=!1;t.subscribe(ga(r,function(a){n=!0,r.next(a)},function(){n||r.next(e),r.complete()}))})}i(_k,"defaultIfEmpty");o(_k,"defaultIfEmpty");function Ek(e){return e<=0?function(){return KI}:Xa(function(t,r){var n=0;t.subscribe(ga(r,function(a){++n<=e&&(r.next(a),e<=n&&r.complete())}))})}i(Ek,"take");o(Ek,"take");function Ak(e){return e===void 0&&(e=Sk),Xa(function(t,r){var n=!1;t.subscribe(ga(r,function(a){n=!0,r.next(a)},function(){return n?r.complete():r.error(e())}))})}i(Ak,"throwIfEmpty");o(Ak,"throwIfEmpty");function Sk(){return new lk}i(Sk,"defaultErrorFactory");o(Sk,"defaultErrorFactory");function xk(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?wk(function(a,s){return e(a,s,n)}):Jm,Ek(1),r?_k(t):Ak(function(){return new lk}))}}i(xk,"first");o(xk,"first");function Tk(e,t){return Xa(function(r,n){var a=t??{},s=a.leading,c=s===void 0?!0:s,l=a.trailing,h=l===void 0?!1:l,p=!1,g=null,v=null,y=!1,_=o(function(){v?.unsubscribe(),v=null,h&&(D(),y&&n.complete())},"endThrottling"),x=o(function(){v=null,y&&n.complete()},"cleanupThrottling"),O=o(function(P){return v=No(e(P)).subscribe(ga(n,_,x))},"startThrottle"),D=o(function(){if(p){p=!1;var P=g;g=null,n.next(P),!y&&O(P)}},"send");r.subscribe(ga(n,function(P){p=!0,g=P,!(v&&!v.closed)&&(c?D():O(P))},function(){y=!0,!(h&&p&&v&&!v.closed)&&n.complete()}))})}i(Tk,"throttle");o(Tk,"throttle");var sS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(sS||(sS={}));var lm;(function(e){e[e.NOT_REQUESTED=0]="NOT_REQUESTED",e[e.PENDING=1]="PENDING",e[e.PROCESSING=2]="PROCESSING",e[e.ANCHORED=3]="ANCHORED",e[e.FAILED=4]="FAILED"})(lm||(lm={}));var Yb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Yb||(Yb={}));var Ym=i(class extends dn{constructor(e,t){super(r=>{e.subscribe(r)}),this.state$=e,this._context=t}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:e,content:t}=this.state$.value;return(0,QA.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Ar.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Ar.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Yb.ANCHOR).map(({cid:e})=>Ar.make(this.id,e))}get state(){return(0,QA.default)(this.state$.value)}async sync(e={}){e={sync:ei.PREFER_CACHE,...e};let t=await this.api.loadStream(this.id,e);this.state$.next(t.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}},"Stream");o(Ym,"Stream");function Xm(){return e=>{}}i(Xm,"StreamStatic");o(Xm,"StreamStatic");var VH=ir(I$(),1);function Ck(e){let t=new AbortController;if(e.length===0)throw Error("Need abort signals to create a merged abort signal");return e.some(r=>r.aborted)?(t.abort(),t.signal):(bk(...e.map(r=>um(r,"abort"))).pipe(xk()).subscribe(()=>{t.abort()}),t.signal)}i(Ck,"mergeAbortSignals");o(Ck,"mergeAbortSignals");var Mk=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=F2(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");o(Mk,"TimedAbortSignal");async function Ik(e,t){let r=new AbortController,n=o(()=>{r.abort()},"onAbort");return e.addEventListener("abort",n),e.aborted&&r.abort(),t(r.signal).finally(()=>{e.removeEventListener("abort",n)})}i(Ik,"abortable2");o(Ik,"abortable");var KH=60*1e3*3;async function _i(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||KH,n=new Mk(r),a=t.signal?Ck([t.signal,n.signal]):n.signal,s=await Ik(a,c=>(0,VH.default)(String(e),{...t,signal:c})).finally(()=>n.clear());if(!s.ok){let c=await s.text();throw new Error(`HTTP request to '${e}' failed with status '${s.statusText}': ${c}`)}return s.json()}i(_i,"fetchJson");o(_i,"fetchJson");var _0=ir(Sd(),1);Ga();function So(e){let t=$t.asCID(e);if(t)return t;if(typeof e=="string")return $t.parse(e);if(e instanceof Uint8Array)return $t.decode(e);throw new Error(`${e} cannot be converted to a CID`)}i(So,"toCID");o(So,"toCID");var cS=0,Hr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,_0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Ir(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Ir(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(e)&&(t.link=t.link.toString()),Hr.isAnchorCommit(e)&&(t.proof=t.proof.toString()),t.id&&(t.id=t.id.toString()),t.prev&&(t.prev=t.prev.toString()),e.header?.model&&(t.header.model=Ir(e.header.model,"base64")),t)}static deserializeCommit(e){let t=(0,_0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=So(t.jws.link),t.linkedBlock=Cr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Cr(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(t)&&(t.link=So(t.link)),Hr.isAnchorCommit(t)&&(t.proof=So(t.proof)),t.id&&(t.id=So(t.id)),t.prev&&(t.prev=So(t.prev)),t.header?.model&&(t.header.model=Cr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,_0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=lm[t.anchorStatus]),t.anchorProof!=null&&(t.anchorProof.txHash=t.anchorProof.txHash.toString(),t.anchorProof.root=t.anchorProof.root.toString()),e.metadata?.model&&(t.metadata.model=e.metadata.model.toString()),e.next?.metadata?.model&&(t.next.metadata.model=e.next.metadata.model.toString()),e.metadata?.unique&&e.type!=cS&&(t.metadata.unique=Ir(t.metadata.unique,"base64")),t.doctype=Mo.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,_0.default)(e);return t.doctype&&(t.type=Mo.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:So(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=So(t.anchorProof.txHash),t.anchorProof.root=So(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=lm[t.anchorStatus]),e.metadata?.model&&(t.metadata.model=Xt.fromString(e.metadata.model)),e.next?.metadata?.model&&(t.next.metadata.model=Xt.fromString(e.next.metadata.model)),e.metadata?.unique&&e.type!=cS&&(t.metadata.unique=Cr(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(Hr.serializeState(e))===JSON.stringify(Hr.serializeState(t))}static isStateSupersetOf(e,t){if(e.log.length<t.log.length)return!1;for(let r in t.log)if(!e.log[r].cid.equals(t.log[r].cid))return!1;return!(e.log.length===t.log.length&&e.anchorStatus!=t.anchorStatus)}static assertCommitLinksToState(e,t){let r=this.streamIdFromState(e);if(t.id&&!t.id.equals(e.log[0].cid))throw new Error(`Invalid genesis CID in commit for StreamID ${r.toString()}. Found: ${t.id}, expected ${e.log[0].cid}`);let n=e.log[e.log.length-1].cid;if(!t.prev.equals(n))throw new Error(`Commit doesn't properly point to previous commit in log. Expected ${n}, found 'prev' ${t.prev}`)}static async convertCommitToSignedCommitContainer(e,t){if(Hr.isSignedCommit(e)){let r=await t.block.get(e.link);return{jws:e,linkedBlock:r}}return e}static isSignedCommitContainer(e){return e&&e.jws!==void 0}static isSignedCommit(e){return e&&e.link!==void 0}static isAnchorCommit(e){return e&&e.proof!==void 0}static isSignedCommitData(e){return e&&e.envelope!==void 0}static isAnchorCommitData(e){return e&&e.proof!==void 0}},"StreamUtils");o(Hr,"StreamUtils");var kk=i(class extends PH{next(e){let t=this.value;Hr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");o(kk,"StreamStateSubject");var GH=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate3"),bi,cb={anchor:!0,publish:!0,pin:!0,sync:ei.PREFER_CACHE},WH={sync:ei.PREFER_CACHE},uS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function N0(e,t){if(typeof e?.schema=="string")try{Ar.fromString(e.schema)}catch{throw new Error("Schema must be a CommitID")}let r={controllers:e?.controllers,family:e?.family,schema:e?.schema?.toString(),tags:e?.tags};if(t)e?.deterministic||(r.unique=Ir((0,CH.randomBytes)(12),"base64")),e?.forbidControllerChange&&(r.forbidControllerChange=!0);else{if(e?.deterministic!==void 0||e?.unique!==void 0)throw new Error("Cannot change 'deterministic' or 'unique' properties on existing Streams");if(e?.forbidControllerChange!==void 0)throw new Error("Cannot change 'forbidControllerChange' property on existing Streams")}return Object.keys(r).forEach(n=>r[n]===void 0&&delete r[n]),r}i(N0,"headerFromMetadata");o(N0,"headerFromMetadata");async function Xb(e){if(!e.did)throw new Error("No DID provided");return e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`)),e.did}i(Xb,"getAuthenticatedDID");o(Xb,"getAuthenticatedDID");async function P0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(P0,"throwReadOnlyError");o(P0,"throwReadOnlyError");var ko=bi=o(i(class extends Ym{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,TH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,a={}){a={...cb,...a},!n?.deterministic&&a.syncTimeoutSeconds==null&&(a.syncTimeoutSeconds=0);let s=a.asDID?{did:a.asDID}:t,c=await bi.makeGenesis(s,r,n);return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,c,a)}static async createFromGenesis(t,r,n={}){n={...cb,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let a=r.data?await bi._signDagJWS(t,r):r;return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,a,n)}static async deterministic(t,r,n={}){if(n={...cb,...n},r={...r,deterministic:!0},r.family==null&&r.tags==null)throw new Error("Family and/or tags are required when creating a deterministic tile document");let a=await bi.makeGenesis(t,null,r);return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,a,n)}static async load(t,r,n={}){n={...WH,...n};let a=ws.from(r);if(a.type!=bi.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${bi.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async update(t,r,n={}){n={...uS,...n};let a=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(a,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...uS,...r};let a={header:N0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await bi._signDagJWS(this.api,a),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=P0,this.patch=P0,this.sync=P0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let a=await this._makeRawCommit(r,n);return bi._signDagJWS(t,a)}async _makeRawCommit(t,r){r||(r={});let n=N0(r,!1);if(t==null&&(t=this.content),n.controllers){if(n.controllers.length!==1)throw new Error("Exactly one controller must be specified");if(!n.controllers[0])throw new Error("Controller cannot be updated to an undefined value.")}let a=vI.compare(this.content,t),s=this.state.log[0];return{header:n,data:a,prev:this.tip,id:s.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await Xb(t);n.controllers=[c.hasParent?c.parent:c.id]}else throw new Error("No controllers specified");if(n.controllers?.length!==1)throw new Error("Exactly one controller must be specified");let a=N0(n,!0);if(n?.deterministic&&r)throw new Error("Initial content must be null when creating a deterministic Tile document");if(r==null){let c={header:a};return Um(c),c}let s={data:r,header:a};return bi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await Xb(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");ko.STREAM_TYPE_NAME="tile";ko.STREAM_TYPE_ID=0;ko=bi=GH([Xm()],ko);var JH=ir(k$(),1);function Dk(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(Dk,"_checkPrivateRedeclaration2");o(Dk,"_checkPrivateRedeclaration");function Rk(e,t){return t.get?t.get.call(e):t.value}i(Rk,"_classApplyDescriptorGet2");o(Rk,"_classApplyDescriptorGet");function Ok(e,t,r){if(t.set)t.set.call(e,r);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=r}}i(Ok,"_classApplyDescriptorSet2");o(Ok,"_classApplyDescriptorSet");function j2(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(j2,"_classExtractFieldDescriptor2");o(j2,"_classExtractFieldDescriptor");function B0(e,t){var r=j2(e,t,"get");return Rk(e,r)}i(B0,"_classPrivateFieldGet2");o(B0,"_classPrivateFieldGet");function Qb(e,t,r){Dk(e,t),t.set(e,r)}i(Qb,"_classPrivateFieldInit2");o(Qb,"_classPrivateFieldInit");function e6(e,t,r){var n=j2(e,t,"set");return Ok(e,n,r),r}i(e6,"_classPrivateFieldSet2");o(e6,"_classPrivateFieldSet");function Nk(e){return typeof e=="string"||Ar.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(Nk,"keyToQuery");o(Nk,"keyToQuery");function L0(e){return typeof e=="string"?ws.from(e).toString():Ar.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(L0,"keyToString");o(L0,"keyToString");async function Pk(e){let t=await ko.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(Pk,"getDeterministicQuery");o(Pk,"getDeterministicQuery");var ZH=o(()=>Promise.resolve([]),"tempBatchLoadFn"),E0=new WeakMap,ub=new WeakMap,YH=i(class extends JH.default{cache(e){if(!B0(this,ub))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await ko.create(B0(this,E0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await Pk(e);try{return await super.load(r)}catch{let a=await ko.createFromGenesis(B0(this,E0),r.genesis,t);return this.cache(a),a}}async load(e){return await super.load(e)}async update(e,t,r,n){let a=L0(e);this.clear(a);let s=await this.load({streamId:a});return await s.update(t,r,n),s}constructor(e){super(ZH,{cache:!0,cacheKeyFn:L0,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),Qb(this,E0,{writable:!0,value:void 0}),Qb(this,ub,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(Nk),e.multiqueryTimeout);return t.map(n=>{let a=L0(n),s=r[a];return s||new Error(`Failed to load stream: ${a}`)})},e6(this,E0,e.ceramic),e6(this,ub,!!e.cache)}},"TileLoader");o(YH,"TileLoader");function t6(e){return typeof e=="string"?Xt.fromString(e):e}i(t6,"typeStreamID");o(t6,"typeStreamID");function Bk(e,t){let r=new URL(e);for(let[n,a]of Object.entries(t))Xt.isInstance(a)?r.searchParams.set(n,a.toString()):typeof a=="object"?r.searchParams.set(n,JSON.stringify(a)):r.searchParams.set(n,a);return r}i(Bk,"serializeObjectToSearchParams");o(Bk,"serializeObjectToSearchParams");function r6(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(r6,"serializeObjectForHttpPost");o(r6,"serializeObjectForHttpPost");var Vi=i(class extends dn{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=F2(0,r).pipe(Tk(()=>this._syncState(this.id,{sync:ei.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new kk(e),this._apiUrl=new URL(t)}get value(){return this.state$.value}get state(){return this.state$.value}next(e){this.state$.next(e)}async _syncState(e,t){let r=await Vi._load(e,this._apiUrl,t);this.state$.next(Hr.deserializeState(r))}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}static async createFromGenesis(e,t,r,n,a){let s=new URL("./streams",e),{state:c}=await _i(s,{method:"post",body:{type:t,genesis:Hr.serializeCommit(r),opts:n}});return new Vi(Hr.deserializeState(c),e,a)}static async applyCommit(e,t,r,n,a){let s=new URL("./commits",e),{state:c}=await _i(s,{method:"post",body:{streamId:t.toString(),commit:Hr.serializeCommit(r),opts:n}});return new Vi(Hr.deserializeState(c),e,a)}static async _load(e,t,r){let n=Bk(new URL(`./streams/${e}`,t),r),{state:a}=await _i(n);return a}static async load(e,t,r,n){let a=await Vi._load(e,t,n);return new Vi(Hr.deserializeState(a),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await _i(r);return n.map(a=>({cid:a.cid,value:Hr.deserializeCommit(a.value)}))}complete(){this.state$.complete()}},"Document");o(Vi,"Document");var ud;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC",e[e.SYNC_ON_ERROR=3]="SYNC_ON_ERROR"})(ud||(ud={}));var lS=ir(Sd(),1),fS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(fS||(fS={}));var n6;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(n6||(n6={}));var Lk=i(class extends dn{constructor(e,t){super(r=>{e.subscribe(r)}),this.state$=e,this._context=t}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}get api(){return this._context.api}get content(){let{next:e,content:t}=this.state$.value;return(0,lS.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Ar.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Ar.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===n6.ANCHOR).map(({cid:e})=>Ar.make(this.id,e))}get state(){return(0,lS.default)(this.state$.value)}async sync(e={}){e={sync:ud.PREFER_CACHE,...e};let t=await this.api.loadStream(this.id,e);this.state$.next(t.state)}async requestAnchor(){return this.api.requestAnchor(this.id)}},"Stream2");o(Lk,"Stream");function Uk(){return e=>{}}i(Uk,"StreamStatic2");o(Uk,"StreamStatic");function Fk(e){if(typeof e=="string"&&e.includes("@")){let[t,r]=e.split("@");if(!t||!r)throw new Error("Invalid accountId provided");return new id({address:t,chainId:r})}return new id(e)}i(Fk,"normalizeAccountId");o(Fk,"normalizeAccountId");var XH="(?:%[0-9a-fA-F]{2})",dS=`(?:[a-zA-Z0-9._-]|${XH})`,QH="([a-z0-9]+)",eq=`((?:${dS}*:)*(${dS}+))`,hS="[a-zA-Z0-9_.:%-]",tq=`;${hS}+=${hS}*`,rq=`((${tq})*)`,nq="(/[^#?]*)?",iq="([?][^#]*)?",aq="(#.*)?",oq=new RegExp(`^did:${QH}:${eq}${rq}${nq}${iq}${aq}$`);function jk(e){if(e===""||!e)return null;let t=e.match(oq);if(t){let r={did:`did:${t[1]}:${t[2]}`,method:t[1],id:t[2],didUrl:e};if(t[4]){let n=t[4].slice(1).split(";");r.params={};for(let a of n){let s=a.split("=");r.params[s[0]]=s[1]}}return t[6]&&(r.path=t[6]),t[7]&&(r.query=t[7].slice(1)),t[8]&&(r.fragment=t[8].slice(1)),r}return null}i(jk,"parse2");o(jk,"parse");var sq=ir(Sd(),1),cq=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate4"),yc,lb=o(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),pS={anchor:!1,publish:!0,sync:ud.PREFER_CACHE},fb={anchor:!0,publish:!0},uq={sync:ud.PREFER_CACHE},Gu=yc=o(i(class extends Lk{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,sq.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...pS,...n};let a=Fk(r),s=yc.makeGenesis(a);return yc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...pS,...n},t.createStreamFromGenesis(yc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...fb,...n};let a=typeof t=="string"?t.trim():t.id;if(jk(a)?.did!==a)throw new Error(`DID is not valid: '${a}'`);let c=await r.createLink(a);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...fb,...r};let n=this.makeCommit(t),a=await this.api.applyCommit(this.id,n,r);this.state$.next(a.state)}async clearDid(t,r={}){r={...fb,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...uq,...n};let a=ws.from(r);if(a.type!=yc.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${yc.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}static makeGenesis(t){return t.chainId.namespace==="eip155"&&(t.address=t.address.toLowerCase()),{header:{controllers:[`${t.address}@${t.chainId.toString()}`],family:`caip10-${t.chainId.toString()}`}}}makeCommit(t){return{data:t,prev:this.tip,id:this.id.cid}}makeReadOnly(){this.setDidProof=lb,this.setDid=lb,this.sync=lb,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");Gu.STREAM_TYPE_NAME="caip10-link";Gu.STREAM_TYPE_ID=1;Gu=yc=cq([Uk()],Gu);Ga();al();var lq=ir($$(),1),fq=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate5"),$a,dq={sync:ei.PREFER_CACHE};async function i6(e){if(e.did==null)throw new Error("No DID provided");e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`))}i(i6,"_ensureAuthenticated");o(i6,"_ensureAuthenticated");async function $k(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i($k,"throwReadOnlyError3");o($k,"throwReadOnlyError");var Ic=$a=o(i(class extends Ym{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:$a.MODEL}}static async create(t,r,n){$a.assertComplete(r);let a={publish:!0,anchor:!0,pin:!0,sync:ei.NEVER_SYNC,throwOnInvalidCommit:!0},s=await $a._makeGenesis(t,r,n);return await t.createStreamFromGenesis($a.STREAM_TYPE_ID,s,a)}static assertComplete(t,r){if(!t.name)throw r?new Error(`Model with StreamID ${r.toString()} is missing a 'name' field`):new Error("Model is missing a 'name' field");if(!t.schema)throw r?new Error(`Model ${t.name} (${r.toString()}) is missing a 'schema' field`):new Error(`Model ${t.name} is missing a 'schema' field`);if(!t.accountRelation)throw r?new Error(`Model ${t.name} (${r.toString()}) is missing a 'accountRelation' field`):new Error(`Model ${t.name} is missing a 'accountRelation' field`)}static async load(t,r,n={}){n={...dq,...n};let a=ws.from(r);if(a.type!=$a.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${$a.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return await t.loadStream(a,n)}static async _makeGenesis(t,r,n){let a=await this._makeRawGenesis(t,r,n);return $a._signDagJWS(t,a)}static async _makeRawGenesis(t,r,n){if(r==null)throw new Error("Genesis content cannot be null");if(!n||!n.controller)if(t.did)await i6(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let a={controllers:[n.controller],model:$a.MODEL.bytes};return{data:r,header:a}}makeReadOnly(){this.sync=$k,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await i6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Ic.STREAM_TYPE_NAME="model";Ic.STREAM_TYPE_ID=2;Ic.MODEL=function(){let e=Um("model-v1"),t=lq.default.encode(e,"identity"),r=Hu(W0,t),n=$t.createV1(W0,r);return new Xt("UNLOADABLE",n)}();Ic=$a=fq([Xm()],Ic);var hq=ir(cl(),1),pq=i(function(e,t,r,n){var a=arguments.length,s=a<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var l=e.length-1;l>=0;l--)(c=e[l])&&(s=(a<3?c(s):a>3?c(t,r,s):c(t,r))||s);return a>3&&s&&Object.defineProperty(t,r,s),s},"__decorate6"),sa,mq={anchor:!0,publish:!0,pin:!0,sync:ei.NEVER_SYNC,syncTimeoutSeconds:0},gq={anchor:!1,publish:!1,pin:!0,sync:ei.PREFER_CACHE},vq={sync:ei.PREFER_CACHE},mS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function a6(e){if(e.did==null)throw new Error("No DID provided");e.did.authenticated||(await e.did.authenticate(),e.loggerProvider&&e.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${e.did.id}`))}i(a6,"_ensureAuthenticated2");o(a6,"_ensureAuthenticated");async function U0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(U0,"throwReadOnlyError4");o(U0,"throwReadOnlyError");var Wu=sa=o(i(class extends Ym{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let t=this.state$.value.metadata;return{controller:t.controllers[0],model:t.model}}static async create(t,r,n,a={}){a={...mq,...a};let s=a.asDID?{did:a.asDID}:t,c=await sa._makeGenesis(s,r,n);return t.createStreamFromGenesis(sa.STREAM_TYPE_ID,c,a)}static async single(t,r,n={}){n={...gq,...n};let a=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await sa._makeGenesis(a,null,r);return t.createStreamFromGenesis(sa.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...vq,...n};let a=ws.from(r);if(a.type!=sa.STREAM_TYPE_ID)throw new Error(`StreamID ${a.toString()} does not refer to a '${sa.STREAM_TYPE_NAME}' stream, but to a ${a.typeName}`);return t.loadStream(a,n)}async replace(t,r={}){r={...mS,...r};let n=r.asDID?{did:r.asDID}:this.api,a=await this._makeCommit(n,t),s=await this.api.applyCommit(this.id,a,r);this.state$.next(s.state)}async patch(t,r={}){r={...mS,...r};let n={data:t,prev:this.tip,id:this.id.cid},a=await sa._signDagJWS(this.api,n),s=await this.api.applyCommit(this.id,a,r);this.state$.next(s.state)}makeReadOnly(){this.replace=U0,this.patch=U0,this.sync=U0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return sa._signDagJWS(t,n)}_makeRawCommit(t){return{data:vI.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let a=await this._makeRawGenesis(t,r,n);return n.deterministic?(Um(a),a):sa._signDagJWS(t,a)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let a=n.controller;if(!a)if(t.did)await a6(t),a=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let s={controllers:[a],model:n.model.bytes};return n.deterministic||(s.unique=(0,hq.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await a6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");Wu.STREAM_TYPE_NAME="MID";Wu.STREAM_TYPE_ID=3;Wu=sa=pq([Xm()],Wu);var zk=i(class{constructor(e){this._apiUrl=e}async add(e,t){let r={};t&&(r.force=!0);let n=new URL(`./pins/${e}`,this._apiUrl);await _i(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await _i(r,{method:"delete",body:{opts:t}})}async ls(e){let t=new URL("./pins",this._apiUrl);e&&(t=new URL(`./pins/${e.toString()}`,this._apiUrl));let r=await _i(t),{pinnedStreamIds:n}=r;return{[Symbol.asyncIterator](){let a=0;return{next(){return a===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[a++],done:!1})}}}}}},"RemotePinApi");o(zk,"RemotePinApi");var Hk=i(class{constructor(e){this._fetchJson=_i,this._collectionURL=new URL("./collection",e),this._countURL=new URL("./collection/count",e)}async count(e){return(await this._fetchJson(this._countURL,{method:"POST",body:r6(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:r6(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:Hr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");o(Hk,"RemoteIndexApi");var qk=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=_i,this.modelsPath="./admin/models",this.getCodePath="./admin/getCode"}getCodeUrl(){return new URL(this.getCodePath,this._apiUrl)}getModelsUrl(){return new URL(this.modelsPath,this._apiUrl)}async buildJWS(e,t,r){let n=r?{models:r.map(s=>s.toString())}:void 0,a=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${a.signatures[0].protected}.${a.payload}.${a.signatures[0].signature}`}async generateCode(){return(await this._fetchJson(this.getCodeUrl())).code}async startIndexingModels(e){let t=await this.generateCode();await this._fetchJson(this.getModelsUrl(),{method:"post",body:{jws:await this.buildJWS(this._getDidFn(),t,e)}})}async getIndexedModels(){let e=await this.generateCode();return(await this._fetchJson(this.getModelsUrl(),{headers:{Authorization:`Basic ${await this.buildJWS(this._getDidFn(),e)}`}})).models.map(r=>Xt.fromString(r))}async stopIndexingModels(e){let t=await this.generateCode();await this._fetchJson(this.getModelsUrl(),{method:"delete",body:{jws:await this.buildJWS(this._getDidFn(),t,e)}})}},"RemoteAdminApi");o(qk,"RemoteAdminApi");var yq="/api/v0/",bq="http://localhost:7007",wq={syncInterval:5e3},_q={anchor:!0,publish:!0,sync:ei.PREFER_CACHE},Eq={anchor:!0,publish:!0,sync:ei.PREFER_CACHE},gS={sync:ei.PREFER_CACHE},Aq=i(class{constructor(e=bq,t={}){this._config={...wq,...t},this._apiUrl=new URL(yq,e),this._streamCache=new Map,this.context={api:this},this.pin=new zk(this._apiUrl),this.index=new Hk(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new qk(this._apiUrl,r),this._streamConstructors={[Gu.STREAM_TYPE_ID]:Gu,[Ic.STREAM_TYPE_ID]:Ic,[Wu.STREAM_TYPE_ID]:Wu,[ko.STREAM_TYPE_ID]:ko}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...Eq,...r};let n=await Vi.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),a=this._streamCache.get(n.id.toString());return a?(Hr.statesEqual(n.state,a.state)||a.next(n.state),this.buildStreamFromDocument(a)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...gS,...t};let r=ws.from(e),n=this._streamCache.get(r.baseID.toString());return n?await n._syncState(r,t):(n=await Vi.load(r,this._apiUrl,this._config.syncInterval,t),this._streamCache.set(n.id.toString(),n)),this.buildStreamFromDocument(n)}async multiQuery(e,t){let r=e.map(s=>({...s,streamId:typeof s.streamId=="string"?s.streamId:s.streamId.toString()})),n=new URL("./multiqueries",this._apiUrl),a=await _i(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(a).reduce((s,c)=>{let[l,h]=c,p=Hr.deserializeState(h),g=new Vi(p,this._apiUrl,this._config.syncInterval);return s[l]=this.buildStreamFromDocument(g),s},{})}loadStreamCommits(e){let t=t6(e);return Vi.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={..._q,...r};let n=t6(e),a=await Vi.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),s=this._streamCache.get(n.toString());return s?(s.next(a.state),this.buildStreamFromDocument(a)):(this._streamCache.set(n.toString(),a),this.buildStreamFromDocument(a))}async requestAnchor(e,t={}){t={...gS,...t};let{anchorStatus:r}=await _i(`${this._apiUrl}/streams/${e.toString()}/anchor`,{method:"post",body:{opts:t}});return r}addStreamHandler(e){this._streamConstructors[e.name]=e.stream_constructor}buildStreamFromState(e){let t=new Vi(e,this._apiUrl,this._config.syncInterval);return this.buildStreamFromDocument(t)}buildStreamFromDocument(e){let t=e.state.type,r=this._streamConstructors[t];if(!r)throw new Error(`Failed to find constructor for stream ${t}`);return new r(e,this.context)}async setDID(e){this.context.did=e}async getSupportedChains(){if(this._supportedChains)return this._supportedChains;let{supportedChains:e}=await _i(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");o(Aq,"CeramicClient");var nr;(function(e){e.assertEqual=a=>a;function t(a){}i(t,"assertIs"),o(t,"assertIs"),e.assertIs=t;function r(a){throw new Error}i(r,"assertNever"),o(r,"assertNever"),e.assertNever=r,e.arrayToEnum=a=>{let s={};for(let c of a)s[c]=c;return s},e.getValidEnumValues=a=>{let s=e.objectKeys(a).filter(l=>typeof a[a[l]]!="number"),c={};for(let l of s)c[l]=a[l];return e.objectValues(c)},e.objectValues=a=>e.objectKeys(a).map(function(s){return a[s]}),e.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{let s=[];for(let c in a)Object.prototype.hasOwnProperty.call(a,c)&&s.push(c);return s},e.find=(a,s)=>{for(let c of a)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&isFinite(a)&&Math.floor(a)===a;function n(a,s=" | "){return a.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),o(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(a,s)=>typeof s=="bigint"?s.toString():s})(nr||(nr={}));var rt=nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),hs=o(e=>{switch(typeof e){case"undefined":return rt.undefined;case"string":return rt.string;case"number":return isNaN(e)?rt.nan:rt.number;case"boolean":return rt.boolean;case"function":return rt.function;case"bigint":return rt.bigint;case"symbol":return rt.symbol;case"object":return Array.isArray(e)?rt.array:e===null?rt.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?rt.promise:typeof Map<"u"&&e instanceof Map?rt.map:typeof Set<"u"&&e instanceof Set?rt.set:typeof Date<"u"&&e instanceof Date?rt.date:rt.object;default:return rt.unknown}},"getParsedType"),Ge=nr.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Sq=o(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),za=i(class extends Error{constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},r={_errors:[]},n=o(a=>{for(let s of a.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)r._errors.push(t(s));else{let c=r,l=0;for(;l<s.path.length;){let h=s.path[l];l===s.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(t(s))):c[h]=c[h]||{_errors:[]},c=c[h],l++}}},"processError");return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,nr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},r=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}},"ZodError");o(za,"ZodError");za.create=e=>new za(e);var ld=o((e,t)=>{let r;switch(e.code){case Ge.invalid_type:e.received===rt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ge.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,nr.jsonStringifyReplacer)}`;break;case Ge.unrecognized_keys:r=`Unrecognized key(s) in object: ${nr.joinValues(e.keys,", ")}`;break;case Ge.invalid_union:r="Invalid input";break;case Ge.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nr.joinValues(e.options)}`;break;case Ge.invalid_enum_value:r=`Invalid enum value. Expected ${nr.joinValues(e.options)}, received '${e.received}'`;break;case Ge.invalid_arguments:r="Invalid function arguments";break;case Ge.invalid_return_type:r="Invalid function return type";break;case Ge.invalid_date:r="Invalid date";break;case Ge.invalid_string:typeof e.validation=="object"?"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:nr.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ge.too_small:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(e.minimum)}`:r="Invalid input";break;case Ge.too_big:e.type==="array"?r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(e.maximum)}`:r="Invalid input";break;case Ge.custom:r="Invalid input";break;case Ge.invalid_intersection_types:r="Intersection results could not be merged";break;case Ge.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ge.not_finite:r="Number must be finite";break;default:r=t.defaultError,nr.assertNever(e)}return{message:r}},"errorMap"),Vk=ld;function Kk(e){Vk=e}i(Kk,"setErrorMap");o(Kk,"setErrorMap");function fd(){return Vk}i(fd,"getErrorMap");o(fd,"getErrorMap");var fm=o(e=>{let{data:t,path:r,errorMaps:n,issueData:a}=e,s=[...r,...a.path||[]],c={...a,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...a,path:s,message:a.message||l}},"makeIssue"),xq=[];function gt(e,t){let r=fm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,fd(),ld].filter(n=>!!n)});e.common.issues.push(r)}i(gt,"addIssueToContext");o(gt,"addIssueToContext");var Bn=i(class{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return Rt;n.status==="dirty"&&e.dirty(),r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t)r.push({key:await n.key,value:await n.value});return Bn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:a,value:s}=n;if(a.status==="aborted"||s.status==="aborted")return Rt;a.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),(typeof s.value<"u"||n.alwaysSet)&&(r[a.value]=s.value)}return{status:e.value,value:r}}},"ParseStatus");o(Bn,"ParseStatus");var Rt=Object.freeze({status:"aborted"}),Gk=o(e=>({status:"dirty",value:e}),"DIRTY"),xn=o(e=>({status:"valid",value:e}),"OK"),o6=o(e=>e.status==="aborted","isAborted"),s6=o(e=>e.status==="dirty","isDirty"),dm=o(e=>e.status==="valid","isValid"),hm=o(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Jt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Jt||(Jt={}));var va=i(class{constructor(e,t,r,n){this.parent=e,this.data=t,this._path=r,this._key=n}get path(){return this._path.concat(this._key)}},"ParseInputLazyPath");o(va,"ParseInputLazyPath");var vS=o((e,t)=>{if(dm(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new za(e.common.issues);return{success:!1,error:r}}},"handleResult");function zt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:a}=e;if(t&&(r||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:o((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:a}}i(zt,"processCreateParams");o(zt,"processCreateParams");var jt=i(class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return hs(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Bn,ctx:{common:e.parent.common,data:e.data,parsedType:hs(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(hm(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let n={common:{issues:[],async:(r=t?.async)!==null&&r!==void 0?r:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:hs(e)},a=this._parseSync({data:e,path:n.path,parent:n});return vS(n,a)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:hs(e)},n=this._parse({data:e,path:r.path,parent:r}),a=await(hm(n)?n:Promise.resolve(n));return vS(r,a)}refine(e,t){let r=o(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,a)=>{let s=e(n),c=o(()=>a.addIssue({code:Ge.custom,...r(n)}),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(l=>l?!0:(c(),!1)):s?!0:(c(),!1)})}refinement(e,t){return this._refinement((r,n)=>e(r)?!0:(n.addIssue(typeof t=="function"?t(r,n):t),!1))}_refinement(e){return new Gi({schema:this,typeName:Tt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ma.create(this)}nullable(){return As.create(this)}nullish(){return this.optional().nullable()}array(){return pa.create(this)}promise(){return Oc.create(this)}or(e){return Qu.create([this,e])}and(e){return el.create(this,e)}transform(e){return new Gi({schema:this,typeName:Tt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new il({innerType:this,defaultValue:t,typeName:Tt.ZodDefault})}brand(){return new z2({typeName:Tt.ZodBranded,type:this,...zt(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new gd({innerType:this,defaultValue:t,typeName:Tt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Nd.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");o(jt,"ZodType");var Tq=/^c[^\s-]{8,}$/i,Cq=/^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i,Mq=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,Iq=o(e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}:\\d{2})|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"),"datetimeRegex"),Do=i(class extends jt{constructor(){super(...arguments),this._regex=(e,t,r)=>this.refinement(n=>e.test(n),{validation:t,code:Ge.invalid_string,...Jt.errToObj(r)}),this.nonempty=e=>this.min(1,Jt.errToObj(e)),this.trim=()=>new Do({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==rt.string){let a=this._getOrReturnCtx(e);return gt(a,{code:Ge.invalid_type,expected:rt.string,received:a.parsedType}),Rt}let r=new Bn,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),r.dirty());else if(a.kind==="length"){let s=e.data.length>a.value,c=e.data.length<a.value;(s||c)&&(n=this._getOrReturnCtx(e,n),s?gt(n,{code:Ge.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):c&&gt(n,{code:Ge.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),r.dirty())}else if(a.kind==="email")Mq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"email",code:Ge.invalid_string,message:a.message}),r.dirty());else if(a.kind==="uuid")Cq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"uuid",code:Ge.invalid_string,message:a.message}),r.dirty());else if(a.kind==="cuid")Tq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"cuid",code:Ge.invalid_string,message:a.message}),r.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),gt(n,{validation:"url",code:Ge.invalid_string,message:a.message}),r.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"regex",code:Ge.invalid_string,message:a.message}),r.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{startsWith:a.value},message:a.message}),r.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{endsWith:a.value},message:a.message}),r.dirty()):a.kind==="datetime"?Iq(a).test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:"datetime",message:a.message}),r.dirty()):nr.assertNever(a);return{status:r.value,value:e.data}}_addCheck(e){return new Do({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Jt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Jt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Jt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Jt.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...Jt.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Jt.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Jt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Jt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Jt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Jt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Jt.errToObj(t)})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}},"ZodString");o(Do,"ZodString");Do.create=e=>{var t;return new Do({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function Wk(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,a=r>n?r:n,s=parseInt(e.toFixed(a).replace(".","")),c=parseInt(t.toFixed(a).replace(".",""));return s%c/Math.pow(10,a)}i(Wk,"floatSafeRemainder");o(Wk,"floatSafeRemainder");var Es=i(class extends jt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==rt.number){let a=this._getOrReturnCtx(e);return gt(a,{code:Ge.invalid_type,expected:rt.number,received:a.parsedType}),Rt}let r,n=new Bn;for(let a of this._def.checks)a.kind==="int"?nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Wk(e.data,a.value)!==0&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_finite,message:a.message}),n.dirty()):nr.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Jt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Jt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Jt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Jt.toString(t))}setLimit(e,t,r,n){return new Es({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Jt.toString(n)}]})}_addCheck(e){return new Es({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Jt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Jt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Jt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Jt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Jt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Jt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Jt.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int")}},"ZodNumber");o(Es,"ZodNumber");Es.create=e=>new Es({checks:[],typeName:Tt.ZodNumber,coerce:e?.coerce||!1,...zt(e)});var Ju=i(class extends jt{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==rt.bigint){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.bigint,received:r.parsedType}),Rt}return xn(e.data)}},"ZodBigInt");o(Ju,"ZodBigInt");Ju.create=e=>{var t;return new Ju({typeName:Tt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};var Zu=i(class extends jt{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==rt.boolean){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.boolean,received:r.parsedType}),Rt}return xn(e.data)}},"ZodBoolean");o(Zu,"ZodBoolean");Zu.create=e=>new Zu({typeName:Tt.ZodBoolean,coerce:e?.coerce||!1,...zt(e)});var kc=i(class extends jt{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==rt.date){let a=this._getOrReturnCtx(e);return gt(a,{code:Ge.invalid_type,expected:rt.date,received:a.parsedType}),Rt}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return gt(a,{code:Ge.invalid_date}),Rt}let r=new Bn,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),r.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),r.dirty()):nr.assertNever(a);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new kc({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Jt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Jt.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}},"ZodDate");o(kc,"ZodDate");kc.create=e=>new kc({checks:[],coerce:e?.coerce||!1,typeName:Tt.ZodDate,...zt(e)});var dd=i(class extends jt{_parse(e){if(this._getType(e)!==rt.symbol){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.symbol,received:r.parsedType}),Rt}return xn(e.data)}},"ZodSymbol");o(dd,"ZodSymbol");dd.create=e=>new dd({typeName:Tt.ZodSymbol,...zt(e)});var Yu=i(class extends jt{_parse(e){if(this._getType(e)!==rt.undefined){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.undefined,received:r.parsedType}),Rt}return xn(e.data)}},"ZodUndefined");o(Yu,"ZodUndefined");Yu.create=e=>new Yu({typeName:Tt.ZodUndefined,...zt(e)});var Xu=i(class extends jt{_parse(e){if(this._getType(e)!==rt.null){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.null,received:r.parsedType}),Rt}return xn(e.data)}},"ZodNull");o(Xu,"ZodNull");Xu.create=e=>new Xu({typeName:Tt.ZodNull,...zt(e)});var Dc=i(class extends jt{constructor(){super(...arguments),this._any=!0}_parse(e){return xn(e.data)}},"ZodAny");o(Dc,"ZodAny");Dc.create=e=>new Dc({typeName:Tt.ZodAny,...zt(e)});var ms=i(class extends jt{constructor(){super(...arguments),this._unknown=!0}_parse(e){return xn(e.data)}},"ZodUnknown");o(ms,"ZodUnknown");ms.create=e=>new ms({typeName:Tt.ZodUnknown,...zt(e)});var Ha=i(class extends jt{_parse(e){let t=this._getOrReturnCtx(e);return gt(t,{code:Ge.invalid_type,expected:rt.never,received:t.parsedType}),Rt}},"ZodNever");o(Ha,"ZodNever");Ha.create=e=>new Ha({typeName:Tt.ZodNever,...zt(e)});var hd=i(class extends jt{_parse(e){if(this._getType(e)!==rt.undefined){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.void,received:r.parsedType}),Rt}return xn(e.data)}},"ZodVoid");o(hd,"ZodVoid");hd.create=e=>new hd({typeName:Tt.ZodVoid,...zt(e)});var pa=i(class extends jt{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==rt.array)return gt(t,{code:Ge.invalid_type,expected:rt.array,received:t.parsedType}),Rt;if(n.exactLength!==null){let s=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(s||c)&&(gt(t,{code:s?Ge.too_big:Ge.too_small,minimum:c?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(gt(t,{code:Ge.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(gt(t,{code:Ge.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()),t.common.async)return Promise.all(t.data.map((s,c)=>n.type._parseAsync(new va(t,s,t.path,c)))).then(s=>Bn.mergeArray(r,s));let a=t.data.map((s,c)=>n.type._parseSync(new va(t,s,t.path,c)));return Bn.mergeArray(r,a)}get element(){return this._def.type}min(e,t){return new pa({...this._def,minLength:{value:e,message:Jt.toString(t)}})}max(e,t){return new pa({...this._def,maxLength:{value:e,message:Jt.toString(t)}})}length(e,t){return new pa({...this._def,exactLength:{value:e,message:Jt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");o(pa,"ZodArray");pa.create=(e,t)=>new pa({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tt.ZodArray,...zt(t)});var pm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(pm||(pm={}));var yS=o(e=>t=>new Dr({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function wc(e){if(e instanceof Dr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ma.create(wc(n))}return new Dr({...e._def,shape:()=>t})}else return e instanceof pa?pa.create(wc(e.element)):e instanceof ma?ma.create(wc(e.unwrap())):e instanceof As?As.create(wc(e.unwrap())):e instanceof qa?qa.create(e.items.map(t=>wc(t))):e}i(wc,"deepPartialify");o(wc,"deepPartialify");var Dr=i(class extends jt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=yS(this._def),this.extend=yS(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=nr.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==rt.object){let h=this._getOrReturnCtx(e);return gt(h,{code:Ge.invalid_type,expected:rt.object,received:h.parsedType}),Rt}let{status:r,ctx:n}=this._processInputParams(e),{shape:a,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof Ha&&this._def.unknownKeys==="strip"))for(let h in n.data)s.includes(h)||c.push(h);let l=[];for(let h of s){let p=a[h],g=n.data[h];l.push({key:{status:"valid",value:h},value:p._parse(new va(n,g,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof Ha){let h=this._def.unknownKeys;if(h==="passthrough")for(let p of c)l.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(h==="strict")c.length>0&&(gt(n,{code:Ge.unrecognized_keys,keys:c}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let p of c){let g=n.data[p];l.push({key:{status:"valid",value:p},value:h._parse(new va(n,g,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let p of l){let g=await p.key;h.push({key:g,value:await p.value,alwaysSet:p.alwaysSet})}return h}).then(h=>Bn.mergeObjectSync(r,h)):Bn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(e){return Jt.errToObj,new Dr({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,a,s,c;let l=(s=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,r).message)!==null&&s!==void 0?s:r.defaultError;return t.code==="unrecognized_keys"?{message:(c=Jt.errToObj(e).message)!==null&&c!==void 0?c:l}:{message:l}}}:{}})}strip(){return new Dr({...this._def,unknownKeys:"strip"})}passthrough(){return new Dr({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Dr({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>pm.mergeShapes(this._def.shape(),e._def.shape()),typeName:Tt.ZodObject})}catchall(e){return new Dr({...this._def,catchall:e})}pick(e){let t={};return nr.objectKeys(e).map(r=>{this.shape[r]&&(t[r]=this.shape[r])}),new Dr({...this._def,shape:()=>t})}omit(e){let t={};return nr.objectKeys(this.shape).map(r=>{nr.objectKeys(e).indexOf(r)===-1&&(t[r]=this.shape[r])}),new Dr({...this._def,shape:()=>t})}deepPartial(){return wc(this)}partial(e){let t={};if(e)return nr.objectKeys(this.shape).map(r=>{nr.objectKeys(e).indexOf(r)===-1?t[r]=this.shape[r]:t[r]=this.shape[r].optional()}),new Dr({...this._def,shape:()=>t});for(let r in this.shape){let n=this.shape[r];t[r]=n.optional()}return new Dr({...this._def,shape:()=>t})}required(e){let t={};if(e)nr.objectKeys(this.shape).map(r=>{if(nr.objectKeys(e).indexOf(r)===-1)t[r]=this.shape[r];else{let a=this.shape[r];for(;a instanceof ma;)a=a._def.innerType;t[r]=a}});else for(let r in this.shape){let a=this.shape[r];for(;a instanceof ma;)a=a._def.innerType;t[r]=a}return new Dr({...this._def,shape:()=>t})}keyof(){return $2(nr.objectKeys(this.shape))}},"ZodObject");o(Dr,"ZodObject");Dr.create=(e,t)=>new Dr({shape:()=>e,unknownKeys:"strip",catchall:Ha.create(),typeName:Tt.ZodObject,...zt(t)});Dr.strictCreate=(e,t)=>new Dr({shape:()=>e,unknownKeys:"strict",catchall:Ha.create(),typeName:Tt.ZodObject,...zt(t)});Dr.lazycreate=(e,t)=>new Dr({shape:e,unknownKeys:"strip",catchall:Ha.create(),typeName:Tt.ZodObject,...zt(t)});var Qu=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(a){for(let c of a)if(c.result.status==="valid")return c.result;for(let c of a)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=a.map(c=>new za(c.ctx.common.issues));return gt(t,{code:Ge.invalid_union,unionErrors:s}),Rt}if(i(n,"handleResults"),o(n,"handleResults"),t.common.async)return Promise.all(r.map(async a=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let a,s=[];for(let l of r){let h={...t,common:{...t.common,issues:[]},parent:null},p=l._parseSync({data:t.data,path:t.path,parent:h});if(p.status==="valid")return p;p.status==="dirty"&&!a&&(a={result:p,ctx:h}),h.common.issues.length&&s.push(h.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let c=s.map(l=>new za(l));return gt(t,{code:Ge.invalid_union,unionErrors:c}),Rt}}get options(){return this._def.options}},"ZodUnion");o(Qu,"ZodUnion");Qu.create=(e,t)=>new Qu({options:e,typeName:Tt.ZodUnion,...zt(t)});var F0=o(e=>e instanceof tl?F0(e.schema):e instanceof Gi?F0(e.innerType()):e instanceof rl?[e.value]:e instanceof wl?e.options:e instanceof nl?Object.keys(e.enum):e instanceof il?F0(e._def.innerType):e instanceof Yu?[void 0]:e instanceof Xu?[null]:null,"getDiscriminator"),Qm=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.object)return gt(t,{code:Ge.invalid_type,expected:rt.object,received:t.parsedType}),Rt;let r=this.discriminator,n=t.data[r],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(gt(t,{code:Ge.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Rt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let a of t){let s=F0(a.shape[e]);if(!s)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of s){if(n.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);n.set(c,a)}}return new Qm({typeName:Tt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...zt(r)})}},"ZodDiscriminatedUnion");o(Qm,"ZodDiscriminatedUnion");function mm(e,t){let r=hs(e),n=hs(t);if(e===t)return{valid:!0,data:e};if(r===rt.object&&n===rt.object){let a=nr.objectKeys(t),s=nr.objectKeys(e).filter(l=>a.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=mm(e[l],t[l]);if(!h.valid)return{valid:!1};c[l]=h.data}return{valid:!0,data:c}}else if(r===rt.array&&n===rt.array){if(e.length!==t.length)return{valid:!1};let a=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=mm(c,l);if(!h.valid)return{valid:!1};a.push(h.data)}return{valid:!0,data:a}}else return r===rt.date&&n===rt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(mm,"mergeValues");o(mm,"mergeValues");var el=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=o((a,s)=>{if(o6(a)||o6(s))return Rt;let c=mm(a.value,s.value);return c.valid?((s6(a)||s6(s))&&t.dirty(),{status:t.value,value:c.data}):(gt(r,{code:Ge.invalid_intersection_types}),Rt)},"handleParsed");return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,s])=>n(a,s)):n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}},"ZodIntersection");o(el,"ZodIntersection");el.create=(e,t,r)=>new el({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var qa=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.array)return gt(r,{code:Ge.invalid_type,expected:rt.array,received:r.parsedType}),Rt;if(r.data.length<this._def.items.length)return gt(r,{code:Ge.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Rt;!this._def.rest&&r.data.length>this._def.items.length&&(gt(r,{code:Ge.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=r.data.map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new va(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(a).then(s=>Bn.mergeArray(t,s)):Bn.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new qa({...this._def,rest:e})}},"ZodTuple");o(qa,"ZodTuple");qa.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new qa({items:e,typeName:Tt.ZodTuple,rest:null,...zt(t)})};var pd=i(class extends jt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.object)return gt(r,{code:Ge.invalid_type,expected:rt.object,received:r.parsedType}),Rt;let n=[],a=this._def.keyType,s=this._def.valueType;for(let c in r.data)n.push({key:a._parse(new va(r,c,r.path,c)),value:s._parse(new va(r,r.data[c],r.path,c))});return r.common.async?Bn.mergeObjectAsync(t,n):Bn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof jt?new pd({keyType:e,valueType:t,typeName:Tt.ZodRecord,...zt(r)}):new pd({keyType:Do.create(),valueType:e,typeName:Tt.ZodRecord,...zt(t)})}},"ZodRecord");o(pd,"ZodRecord");var md=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.map)return gt(r,{code:Ge.invalid_type,expected:rt.map,received:r.parsedType}),Rt;let n=this._def.keyType,a=this._def.valueType,s=[...r.data.entries()].map(([c,l],h)=>({key:n._parse(new va(r,c,r.path,[h,"key"])),value:a._parse(new va(r,l,r.path,[h,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let l of s){let h=await l.key,p=await l.value;if(h.status==="aborted"||p.status==="aborted")return Rt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}})}else{let c=new Map;for(let l of s){let h=l.key,p=l.value;if(h.status==="aborted"||p.status==="aborted")return Rt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}}}},"ZodMap");o(md,"ZodMap");md.create=(e,t,r)=>new md({valueType:t,keyType:e,typeName:Tt.ZodMap,...zt(r)});var Rc=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==rt.set)return gt(r,{code:Ge.invalid_type,expected:rt.set,received:r.parsedType}),Rt;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(gt(r,{code:Ge.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&r.data.size>n.maxSize.value&&(gt(r,{code:Ge.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function s(l){let h=new Set;for(let p of l){if(p.status==="aborted")return Rt;p.status==="dirty"&&t.dirty(),h.add(p.value)}return{status:t.value,value:h}}i(s,"finalizeSet"),o(s,"finalizeSet");let c=[...r.data.values()].map((l,h)=>a._parse(new va(r,l,r.path,h)));return r.common.async?Promise.all(c).then(l=>s(l)):s(c)}min(e,t){return new Rc({...this._def,minSize:{value:e,message:Jt.toString(t)}})}max(e,t){return new Rc({...this._def,maxSize:{value:e,message:Jt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},"ZodSet");o(Rc,"ZodSet");Rc.create=(e,t)=>new Rc({valueType:e,minSize:null,maxSize:null,typeName:Tt.ZodSet,...zt(t)});var ju=i(class extends jt{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.function)return gt(t,{code:Ge.invalid_type,expected:rt.function,received:t.parsedType}),Rt;function r(c,l){return fm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fd(),ld].filter(h=>!!h),issueData:{code:Ge.invalid_arguments,argumentsError:l}})}i(r,"makeArgsIssue"),o(r,"makeArgsIssue");function n(c,l){return fm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,fd(),ld].filter(h=>!!h),issueData:{code:Ge.invalid_return_type,returnTypeError:l}})}i(n,"makeReturnsIssue"),o(n,"makeReturnsIssue");let a={errorMap:t.common.contextualErrorMap},s=t.data;return this._def.returns instanceof Oc?xn(async(...c)=>{let l=new za([]),h=await this._def.args.parseAsync(c,a).catch(v=>{throw l.addIssue(r(c,v)),l}),p=await s(...h);return await this._def.returns._def.type.parseAsync(p,a).catch(v=>{throw l.addIssue(n(p,v)),l})}):xn((...c)=>{let l=this._def.args.safeParse(c,a);if(!l.success)throw new za([r(c,l.error)]);let h=s(...l.data),p=this._def.returns.safeParse(h,a);if(!p.success)throw new za([n(h,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ju({...this._def,args:qa.create(e).rest(ms.create())})}returns(e){return new ju({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new ju({args:e||qa.create([]).rest(ms.create()),returns:t||ms.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");o(ju,"ZodFunction");var tl=i(class extends jt{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}},"ZodLazy");o(tl,"ZodLazy");tl.create=(e,t)=>new tl({getter:e,typeName:Tt.ZodLazy,...zt(t)});var rl=i(class extends jt{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return gt(t,{code:Ge.invalid_literal,expected:this._def.value}),Rt}return{status:"valid",value:e.data}}get value(){return this._def.value}},"ZodLiteral");o(rl,"ZodLiteral");rl.create=(e,t)=>new rl({value:e,typeName:Tt.ZodLiteral,...zt(t)});function $2(e,t){return new wl({values:e,typeName:Tt.ZodEnum,...zt(t)})}i($2,"createZodEnum");o($2,"createZodEnum");var wl=i(class extends jt{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return gt(t,{expected:nr.joinValues(r),received:t.parsedType,code:Ge.invalid_type}),Rt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return gt(t,{received:t.data,code:Ge.invalid_enum_value,options:r}),Rt}return xn(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}},"ZodEnum");o(wl,"ZodEnum");wl.create=$2;var nl=i(class extends jt{_parse(e){let t=nr.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==rt.string&&r.parsedType!==rt.number){let n=nr.objectValues(t);return gt(r,{expected:nr.joinValues(n),received:r.parsedType,code:Ge.invalid_type}),Rt}if(t.indexOf(e.data)===-1){let n=nr.objectValues(t);return gt(r,{received:r.data,code:Ge.invalid_enum_value,options:n}),Rt}return xn(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");o(nl,"ZodNativeEnum");nl.create=(e,t)=>new nl({values:e,typeName:Tt.ZodNativeEnum,...zt(t)});var Oc=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==rt.promise&&t.common.async===!1)return gt(t,{code:Ge.invalid_type,expected:rt.promise,received:t.parsedType}),Rt;let r=t.parsedType===rt.promise?t.data:Promise.resolve(t.data);return xn(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");o(Oc,"ZodPromise");Oc.create=(e,t)=>new Oc({type:e,typeName:Tt.ZodPromise,...zt(t)});var Gi=i(class extends jt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Tt.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null;if(n.type==="preprocess"){let s=n.transform(r.data);return r.common.async?Promise.resolve(s).then(c=>this._def.schema._parseAsync({data:c,path:r.path,parent:r})):this._def.schema._parseSync({data:s,path:r.path,parent:r})}let a={addIssue:s=>{gt(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="refinement"){let s=o(c=>{let l=n.refinement(c,a);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c},"executeRefinement");if(r.common.async===!1){let c=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return c.status==="aborted"?Rt:(c.status==="dirty"&&t.dirty(),s(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(c=>c.status==="aborted"?Rt:(c.status==="dirty"&&t.dirty(),s(c.value).then(()=>({status:t.value,value:c.value}))))}if(n.type==="transform")if(r.common.async===!1){let s=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!dm(s))return s;let c=n.transform(s.value,a);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:c}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(s=>dm(s)?Promise.resolve(n.transform(s.value,a)).then(c=>({status:t.value,value:c})):s);nr.assertNever(n)}},"ZodEffects");o(Gi,"ZodEffects");Gi.create=(e,t,r)=>new Gi({schema:e,typeName:Tt.ZodEffects,effect:t,...zt(r)});Gi.createWithPreprocess=(e,t,r)=>new Gi({schema:t,effect:{type:"preprocess",transform:e},typeName:Tt.ZodEffects,...zt(r)});var ma=i(class extends jt{_parse(e){return this._getType(e)===rt.undefined?xn(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");o(ma,"ZodOptional");ma.create=(e,t)=>new ma({innerType:e,typeName:Tt.ZodOptional,...zt(t)});var As=i(class extends jt{_parse(e){return this._getType(e)===rt.null?xn(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodNullable");o(As,"ZodNullable");As.create=(e,t)=>new As({innerType:e,typeName:Tt.ZodNullable,...zt(t)});var il=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===rt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},"ZodDefault");o(il,"ZodDefault");il.create=(e,t)=>new il({innerType:e,typeName:Tt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var gd=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return hm(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()})):{status:"valid",value:r.status==="valid"?r.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}},"ZodCatch");o(gd,"ZodCatch");gd.create=(e,t)=>new gd({innerType:e,typeName:Tt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var vd=i(class extends jt{_parse(e){if(this._getType(e)!==rt.nan){let r=this._getOrReturnCtx(e);return gt(r,{code:Ge.invalid_type,expected:rt.nan,received:r.parsedType}),Rt}return{status:"valid",value:e.data}}},"ZodNaN");o(vd,"ZodNaN");vd.create=e=>new vd({typeName:Tt.ZodNaN,...zt(e)});var kq=Symbol("zod_brand"),z2=i(class extends jt{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}},"ZodBranded");o(z2,"ZodBranded");var Nd=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return o(async()=>{let a=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Rt:a.status==="dirty"?(t.dirty(),Gk(a.value)):this._def.out._parseAsync({data:a.value,path:r.path,parent:r})},"handleAsync")();{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?Rt:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new Nd({in:e,out:t,typeName:Tt.ZodPipeline})}},"ZodPipeline");o(Nd,"ZodPipeline");var Jk=o((e,t={},r)=>e?Dc.create().superRefine((n,a)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;a.addIssue({code:"custom",...c,fatal:r})}}):Dc.create(),"custom"),Dq={object:Dr.lazycreate},Tt;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline"})(Tt||(Tt={}));var Rq=o((e,t={message:`Input not instance of ${e.name}`})=>Jk(r=>r instanceof e,t,!0),"instanceOfType"),Zk=Do.create,Yk=Es.create,Oq=vd.create,Nq=Ju.create,Xk=Zu.create,Pq=kc.create,Bq=dd.create,Lq=Yu.create,Uq=Xu.create,Fq=Dc.create,jq=ms.create,$q=Ha.create,zq=hd.create,Hq=pa.create,qq=Dr.create,Vq=Dr.strictCreate,Kq=Qu.create,Gq=Qm.create,Wq=el.create,Jq=qa.create,Zq=pd.create,Yq=md.create,Xq=Rc.create,Qq=ju.create,eV=tl.create,tV=rl.create,rV=wl.create,nV=nl.create,iV=Oc.create,bS=Gi.create,aV=ma.create,oV=As.create,sV=Gi.createWithPreprocess,cV=Nd.create,uV=o(()=>Zk().optional(),"ostring"),lV=o(()=>Yk().optional(),"onumber"),fV=o(()=>Xk().optional(),"oboolean"),dV={string:e=>Do.create({...e,coerce:!0}),number:e=>Es.create({...e,coerce:!0}),boolean:e=>Zu.create({...e,coerce:!0}),bigint:e=>Ju.create({...e,coerce:!0}),date:e=>kc.create({...e,coerce:!0})},hV=Rt,H=Object.freeze({__proto__:null,defaultErrorMap:ld,setErrorMap:Kk,getErrorMap:fd,makeIssue:fm,EMPTY_PATH:xq,addIssueToContext:gt,ParseStatus:Bn,INVALID:Rt,DIRTY:Gk,OK:xn,isAborted:o6,isDirty:s6,isValid:dm,isAsync:hm,get util(){return nr},ZodParsedType:rt,getParsedType:hs,ZodType:jt,ZodString:Do,ZodNumber:Es,ZodBigInt:Ju,ZodBoolean:Zu,ZodDate:kc,ZodSymbol:dd,ZodUndefined:Yu,ZodNull:Xu,ZodAny:Dc,ZodUnknown:ms,ZodNever:Ha,ZodVoid:hd,ZodArray:pa,get objectUtil(){return pm},ZodObject:Dr,ZodUnion:Qu,ZodDiscriminatedUnion:Qm,ZodIntersection:el,ZodTuple:qa,ZodRecord:pd,ZodMap:md,ZodSet:Rc,ZodFunction:ju,ZodLazy:tl,ZodLiteral:rl,ZodEnum:wl,ZodNativeEnum:nl,ZodPromise:Oc,ZodEffects:Gi,ZodTransformer:Gi,ZodOptional:ma,ZodNullable:As,ZodDefault:il,ZodCatch:gd,ZodNaN:vd,BRAND:kq,ZodBranded:z2,ZodPipeline:Nd,custom:Jk,Schema:jt,ZodSchema:jt,late:Dq,get ZodFirstPartyTypeKind(){return Tt},coerce:dV,any:Fq,array:Hq,bigint:Nq,boolean:Xk,date:Pq,discriminatedUnion:Gq,effect:bS,enum:rV,function:Qq,instanceof:Rq,intersection:Wq,lazy:eV,literal:tV,map:Yq,nan:Oq,nativeEnum:nV,never:$q,null:Uq,nullable:oV,number:Yk,object:qq,oboolean:fV,onumber:lV,optional:aV,ostring:uV,pipeline:cV,preprocess:sV,promise:iV,record:Zq,set:Xq,strictObject:Vq,string:Zk,symbol:Bq,transformer:bS,tuple:Jq,undefined:Lq,union:Kq,unknown:jq,void:zq,NEVER:hV,ZodIssueCode:Ge,quotelessJson:Sq,ZodError:za}),pV=Object.defineProperty,mV=o((e,t)=>pV(e,"name",{value:t,configurable:!0}),"__name"),e1=H.array(H.string().or(H.record(H.any()))),eX=H.object({type:H.string().optional(),narrative:H.string().optional()}),t1=H.string().or(H.object({id:H.string(),type:H.string(),caption:H.string().optional()})),gV=H.object({type:H.string().min(1).or(H.string().array().nonempty()),latitude:H.number(),longitude:H.number()}),vV=H.object({type:H.string().min(1).or(H.string().array().nonempty()),addressCountry:H.string().optional(),addressCountryCode:H.string().optional(),addressRegion:H.string().optional(),addressLocality:H.string().optional(),streetAddress:H.string().optional(),postOfficeBoxNumber:H.string().optional(),postalCode:H.string().optional(),geo:gV.optional()}),yV=H.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(H.string()),Qk=H.object({type:H.string().min(1).or(H.string().array().nonempty()),identifier:H.string(),identifierType:yV}),yd=H.string().or(H.object({id:H.string().optional(),type:H.string().or(H.string().array().nonempty().optional()),name:H.string().optional(),url:H.string().optional(),phone:H.string().optional(),description:H.string().optional(),endorsement:H.any().array().optional(),image:t1.optional(),email:H.string().email().optional(),address:vV.optional(),otherIdentifier:Qk.array().optional(),official:H.string().optional(),parentOrg:H.any().optional(),familyName:H.string().optional(),givenName:H.string().optional(),additionalName:H.string().optional(),patronymicName:H.string().optional(),honorificPrefix:H.string().optional(),honorificSuffix:H.string().optional(),familyNamePrefix:H.string().optional(),dateOfBirth:H.string().optional()}).catchall(H.any())),c6=H.object({id:H.string().optional()}).catchall(H.any()),A0=H.object({type:H.string(),id:H.string()}).catchall(H.any()),wS=H.object({id:H.string(),type:H.string()}).catchall(H.any()),_S=H.object({id:H.string().optional(),type:H.string()}).catchall(H.any()),ES=H.object({type:H.string(),id:H.string().optional()}).catchall(H.any()),AS=H.object({type:H.string().or(H.string().array().nonempty()),id:H.string().optional()}).catchall(H.any()),gm=H.object({"@context":e1,id:H.string().optional(),type:H.string().array().nonempty(),issuer:yd,credentialSubject:c6.or(c6.array()),refreshService:_S.or(_S.array()).optional(),credentialSchema:wS.or(wS.array()).optional(),issuanceDate:H.string().optional(),expirationDate:H.string().optional(),credentialStatus:A0.or(A0.array()).optional(),name:H.string().optional(),description:H.string().optional(),validFrom:H.string().optional(),validUntil:H.string().optional(),status:A0.or(A0.array()).optional(),termsOfUse:ES.or(ES.array()).optional(),evidence:AS.or(AS.array()).optional()}).catchall(H.any()),Va=H.object({type:H.string(),created:H.string(),challenge:H.string().optional(),domain:H.string().optional(),nonce:H.string().optional(),proofPurpose:H.string(),verificationMethod:H.string(),jws:H.string().optional()}).catchall(H.any()),SS=gm.extend({proof:Va.or(Va.array())}),bV=H.object({"@context":e1,id:H.string().optional(),type:H.string().or(H.string().array().nonempty()),verifiableCredential:SS.or(SS.array()).optional(),holder:H.string().optional()}).catchall(H.any()),tX=bV.extend({proof:Va.or(Va.array())}),H2=H.object({kty:H.string(),crv:H.string(),x:H.string(),y:H.string().optional(),n:H.string().optional(),d:H.string().optional()}),rX=H2.omit({d:!0}).extend({d:H.string()}),wV=H.object({alg:H.string(),iv:H.string(),tag:H.string(),epk:H2.partial().optional(),kid:H.string().optional(),apv:H.string().optional(),apu:H.string().optional()}),_V=H.object({header:wV,encrypted_key:H.string()}),EV=H.object({protected:H.string(),iv:H.string(),ciphertext:H.string(),tag:H.string(),aad:H.string().optional(),recipients:_V.array().optional()}),vc=H.string().or(H.object({"@context":e1.optional(),id:H.string(),type:H.string(),controller:H.string(),publicKeyJwk:H2.optional(),publicKeyBase58:H.string().optional(),blockChainAccountId:H.string().optional()}).catchall(H.any())),AV=H.object({id:H.string(),type:H.string().or(H.string().array().nonempty()),serviceEndpoint:H.any().or(H.any().array().nonempty())}).catchall(H.any()),nX=H.object({"@context":e1,id:H.string(),alsoKnownAs:H.string().optional(),controller:H.string().or(H.string().array().nonempty()).optional(),verificationMethod:vc.array().optional(),authentication:vc.array().optional(),assertionMethod:vc.array().optional(),keyAgreement:vc.array().optional(),capabilityInvocation:vc.array().optional(),capabilityDelegation:vc.array().optional(),publicKey:vc.array().optional(),service:AV.array().optional(),proof:Va.or(Va.array()).optional()}).catchall(H.any()),SV=H.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(H.string()),r1=H.object({type:H.string().array().nonempty(),targetCode:H.string().optional(),targetDescription:H.string().optional(),targetName:H.string(),targetFramework:H.string().optional(),targetType:SV.optional(),targetUrl:H.string()}),xV=H.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),TV=xV.or(H.string()),CV=H.object({id:H.string().optional(),narrative:H.string().optional()}).catchall(H.any()),MV=H.object({id:H.string(),type:H.string().array().nonempty(),endorsementComment:H.string().optional()}),IV=gm.extend({credentialSubject:MV,proof:Va.or(Va.array()).optional()}),kV=H.object({id:H.string(),"@language":H.string().optional(),version:H.string().optional()}),DV=H.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(H.string()),RV=H.object({id:H.string(),type:H.string().array().nonempty(),alignment:r1.array().optional(),description:H.string().optional(),level:H.string().optional(),name:H.string(),points:H.string().optional()}).catchall(H.any()),OV=H.object({id:H.string(),type:H.string().array().nonempty(),alignment:r1.array().optional(),allowedValue:H.string().array().optional(),name:H.string(),requiredLevel:H.string().optional(),requiredValue:H.string().optional(),resultType:DV,rubricCriterionLevel:RV.array().optional(),valueMax:H.string().optional(),valueMin:H.string().optional()}).catchall(H.any()),NV=H.object({id:H.string().optional(),type:H.string().array().nonempty(),alignment:r1.array().optional(),achievementType:TV.optional(),creator:yd.optional(),creditsAvailable:H.number().optional(),criteria:CV,description:H.string(),endorsement:IV.array().optional(),fieldOfStudy:H.string().optional(),humanCode:H.string().optional(),image:t1.optional(),"@language":H.string().optional(),name:H.string(),otherIdentifier:Qk.array().optional(),related:kV.array().optional(),resultDescription:OV.array().optional(),specialization:H.string().optional(),tag:H.string().array().optional(),version:H.string().optional()}).catchall(H.any()),PV=H.object({type:H.string(),hashed:H.boolean(),identityHash:H.string(),identityType:H.string(),salt:H.string().optional()}),BV=H.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),LV=H.object({type:H.string().array().nonempty(),achievedLevel:H.string().optional(),alignment:r1.array().optional(),resultDescription:H.string().optional(),status:BV.optional(),value:H.string().optional()}).catchall(H.any()),xS=H.object({id:H.string().optional(),type:H.string().array().nonempty(),activityEndDate:H.string().optional(),activityStartDate:H.string().optional(),creditsEarned:H.number().optional(),achievement:NV.optional(),identifier:PV.array().optional(),image:t1.optional(),licenseNumber:H.string().optional(),narrative:H.string().optional(),result:LV.array().optional(),role:H.string().optional(),source:yd.optional(),term:H.string().optional()}).catchall(H.any()),UV=H.object({id:H.string().optional(),type:H.string().or(H.string().array().nonempty()),narrative:H.string().optional(),name:H.string().optional(),description:H.string().optional(),genre:H.string().optional(),audience:H.string().optional()}).catchall(H.any()),FV=gm.extend({name:H.string().optional(),description:H.string().optional(),image:t1.optional(),credentialSubject:xS.or(xS.array()),endorsement:gm.array().optional(),evidence:UV.array().optional()}),iX=FV.extend({proof:Va.or(Va.array())}),aX=H.object({checks:H.string().array(),warnings:H.string().array(),errors:H.string().array()}),eD=H.enum(["Success","Failed","Error"]),oX=eD.enum,sX=H.object({check:H.string(),status:eD,message:H.string().optional(),details:H.string().optional()}),cX=H.object({title:H.string().optional(),createdAt:H.string().optional(),issuer:yd.optional(),issuee:yd.optional(),credentialSubject:c6.optional()}),uX=H.object({id:H.string(),uri:H.string()}).catchall(H.any()),lX=H.object({limit:H.number(),cursor:H.string().optional(),sort:H.string().optional()}),ti=H.object({cursor:H.string().optional(),hasMore:H.boolean()}),tD=H.object({encryptedRecord:EV,fields:H.string().array()}).catchall(H.any()),fX=ti.extend({records:tD.array()}),jV=tD.extend({id:H.string()}),dX=ti.extend({records:jV.array()}),TS=mV(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),$V=H.instanceof(RegExp).or(H.string().refine(e=>{try{return TS(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=TS(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),mr=H.string().or(H.object({$in:H.string().array()})).or(H.object({$regex:$V})),zV=H.object({backgroundColor:H.string().optional(),backgroundImage:H.string().optional(),fadeBackgroundImage:H.boolean().optional(),repeatBackgroundImage:H.boolean().optional(),fontColor:H.string().optional(),accentColor:H.string().optional(),accentFontColor:H.string().optional(),idBackgroundImage:H.string().optional(),fadeIdBackgroundImage:H.boolean().optional(),idBackgroundColor:H.string().optional(),repeatIdBackgroundImage:H.boolean().optional()}),Nc=H.object({profileId:H.string().min(3).max(40),displayName:H.string().default(""),shortBio:H.string().default(""),bio:H.string().default(""),did:H.string(),isPrivate:H.boolean().optional(),email:H.string().optional(),image:H.string().optional(),heroImage:H.string().optional(),websiteLink:H.string().optional(),isServiceProfile:H.boolean().default(!1).optional(),type:H.string().optional(),notificationsWebhook:H.string().url().startsWith("http").optional(),display:zV.optional(),role:H.string().default("").optional(),dob:H.string().default("").optional()}),hX=H.object({profileId:mr,displayName:mr,shortBio:mr,bio:mr,email:mr,websiteLink:mr,isServiceProfile:H.boolean(),type:mr}).partial(),pX=ti.extend({records:Nc.array()}),mX=H.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),rD=H.object({id:H.string(),created:H.string(),displayName:H.string().default("").optional(),shortBio:H.string().default("").optional(),bio:H.string().default("").optional(),email:H.string().optional(),image:H.string().optional(),heroImage:H.string().optional()}),gX=ti.extend({records:rD.extend({did:H.string()}).array()}),vX=H.object({id:mr,displayName:mr,shortBio:mr,bio:mr,email:mr}).partial(),yX=ti.extend({records:H.object({profile:Nc,manager:rD.extend({did:H.string()}).optional()}).array()}),bX=H.object({uri:H.string(),to:H.string(),from:H.string(),sent:H.string().datetime(),received:H.string().datetime().optional()}),nD=H.object({role:H.string(),canEdit:H.boolean(),canIssue:H.boolean(),canRevoke:H.boolean(),canManagePermissions:H.boolean(),canIssueChildren:H.string(),canCreateChildren:H.string(),canEditChildren:H.string(),canRevokeChildren:H.string(),canManageChildrenPermissions:H.string(),canManageChildrenProfiles:H.boolean().default(!1).optional(),canViewAnalytics:H.boolean()}),HV=H.object({role:mr,canEdit:H.boolean(),canIssue:H.boolean(),canRevoke:H.boolean(),canManagePermissions:H.boolean(),canIssueChildren:mr,canCreateChildren:mr,canEditChildren:mr,canRevokeChildren:mr,canManageChildrenPermissions:mr,canManageChildrenProfiles:H.boolean(),canViewAnalytics:H.boolean()}).partial(),CS=H.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),qV=H.discriminatedUnion("type",[H.object({type:H.literal(CS.Values.GRANT_PERMISSIONS),data:H.object({claimUri:H.string(),targetUri:H.string(),permissions:nD.partial()})}),H.object({type:H.literal(CS.Values.ADD_ADMIN),data:H.object({claimUri:H.string(),targetUri:H.string()})})]),wX=H.object({type:mr,data:H.object({claimUri:mr,targetUri:mr,permissions:HV})}).deepPartial(),VV=H.object({id:H.string(),createdAt:H.string(),updatedAt:H.string()}).and(qV),_X=ti.extend({records:VV.array()}),u6=H.enum(["DRAFT","LIVE"]),KV=H.object({uri:H.string(),name:H.string().optional(),type:H.string().optional(),category:H.string().optional(),status:u6.optional(),autoConnectRecipients:H.boolean().optional(),meta:H.record(H.any()).optional(),claimPermissions:nD.optional()}),EX=H.object({uri:mr,name:mr,type:mr,category:mr,meta:H.record(mr),status:u6.or(H.object({$in:u6.array()})),autoConnectRecipients:H.boolean()}).partial(),AX=ti.extend({records:KV.array()}),GV=H.object({to:Nc,from:H.string(),received:H.string().optional(),uri:H.string().optional()}),SX=ti.extend({records:GV.array()}),xX=H.object({endpoint:H.string(),name:H.string(),did:H.string().optional()}),TX=H.object({ttlSeconds:H.number().optional(),totalUses:H.number().optional()}),WV=H.object({endpoint:H.string()}),CX=H.object({signingAuthority:WV,relationship:H.object({name:H.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:H.string()})}),MX=H.object({boostUri:H.string(),signingAuthority:H.object({endpoint:H.string(),name:H.string()})}),JV=H.enum(["live","stale","withdrawn"]),ZV=H.object({read:H.object({anonymize:H.boolean().optional(),credentials:H.object({categories:H.record(H.object({required:H.boolean()})).default({})}).default({}),personal:H.record(H.object({required:H.boolean()})).default({})}).default({}),write:H.object({credentials:H.object({categories:H.record(H.object({required:H.boolean()})).default({})}).default({}),personal:H.record(H.object({required:H.boolean()})).default({})}).default({})}),iD=H.object({contract:ZV,owner:Nc,name:H.string(),subtitle:H.string().optional(),description:H.string().optional(),reasonForAccessing:H.string().optional(),image:H.string().optional(),uri:H.string(),needsGuardianConsent:H.boolean().optional(),redirectUrl:H.string().optional(),frontDoorBoostUri:H.string().optional(),createdAt:H.string(),updatedAt:H.string(),expiresAt:H.string().optional(),autoBoosts:H.string().array().optional()}),IX=ti.extend({records:iD.omit({owner:!0}).array()}),YV=H.object({credentials:H.object({categories:H.record(H.string().array()).default({})}),personal:H.record(H.string()).default({}),date:H.string()}),kX=ti.extend({records:YV.array()}),XV=H.object({credentials:H.object({category:H.string(),uri:H.string()}).array(),personal:H.record(H.string()).default({}),date:H.string(),contractUri:H.string()}),DX=ti.extend({records:XV.array()}),aD=H.object({sharing:H.boolean().optional(),shared:H.string().array().optional(),shareAll:H.boolean().optional(),shareUntil:H.string().optional()}),oD=H.object({read:H.object({anonymize:H.boolean().optional(),credentials:H.object({shareAll:H.boolean().optional(),sharing:H.boolean().optional(),categories:H.record(aD).default({})}).default({}),personal:H.record(H.string()).default({})}).default({}),write:H.object({credentials:H.object({categories:H.record(H.boolean()).default({})}).default({}),personal:H.record(H.boolean()).default({})}).default({})}),RX=ti.extend({records:H.object({expiresAt:H.string().optional(),oneTime:H.boolean().optional(),terms:oD,contract:iD,uri:H.string(),consenter:Nc,status:JV}).array()}),OX=H.object({read:H.object({anonymize:H.boolean().optional(),credentials:H.object({categories:H.record(H.object({required:H.boolean().optional()})).optional()}).optional(),personal:H.record(H.object({required:H.boolean().optional()})).optional()}).optional(),write:H.object({credentials:H.object({categories:H.record(H.object({required:H.boolean().optional()})).optional()}).optional(),personal:H.record(H.object({required:H.boolean().optional()})).optional()}).optional()}),NX=H.object({anonymize:H.boolean().optional(),credentials:H.object({categories:H.record(H.boolean()).optional()}).optional(),personal:H.record(H.boolean()).optional()}),PX=H.object({credentials:H.object({categories:H.record(H.boolean()).optional()}).optional(),personal:H.record(H.boolean()).optional(),id:mr.optional()}),QV=H.object({read:H.object({anonymize:H.boolean().optional(),credentials:H.object({shareAll:H.boolean().optional(),sharing:H.boolean().optional(),categories:H.record(aD.optional()).optional()}).optional(),personal:H.record(H.string()).optional()}).optional(),write:H.object({credentials:H.object({categories:H.record(H.boolean()).optional()}).optional(),personal:H.record(H.boolean()).optional()}).optional()}),l6=H.enum(["consent","update","sync","withdraw","write"]),BX=H.object({terms:QV.optional(),action:l6.or(l6.array()).optional(),date:H.object({$gt:H.string()}).or(H.object({$lt:H.string()})).or(H.object({$eq:H.string()})).optional(),expiresAt:H.object({$gt:H.string()}).or(H.object({$lt:H.string()})).or(H.object({$eq:H.string()})).optional(),oneTime:H.boolean().optional()}),sD=H.object({expiresAt:H.string().optional(),oneTime:H.boolean().optional(),terms:oD.optional(),id:H.string(),action:l6,date:H.string(),uris:H.string().array().optional()}),LX=ti.extend({records:sD.array()}),eK=H.object({credentialUri:H.string(),termsUri:H.string(),contractUri:H.string(),boostUri:H.string(),category:H.string().optional(),date:H.string()}),UX=ti.extend({records:eK.array()}),tK=H.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),rK=H.object({title:H.string().optional(),body:H.string().optional()}),nK=H.object({vcUris:H.array(H.string()).optional(),vpUris:H.array(H.string()).optional(),transaction:sD.optional()}),FX=H.object({type:tK,to:Nc.partial().and(H.object({did:H.string()})),from:Nc.partial().and(H.object({did:H.string()})),message:rK.optional(),data:nK.optional(),sent:H.string().datetime().optional()}),iK="auth-grant:",jX=H.object({id:H.string(),name:H.string(),description:H.string().optional(),challenge:H.string().startsWith(iK).min(10,{message:"Challenge is too short"}).max(100,{message:"Challenge is too long"}),status:H.enum(["revoked","active"],{required_error:"Status is required",invalid_type_error:"Status must be either active or revoked"}),scope:H.string(),createdAt:H.string().datetime({message:"createdAt must be a valid ISO 8601 datetime string"}),expiresAt:H.string().datetime({message:"expiresAt must be a valid ISO 8601 datetime string"}).nullish().optional()}),$X=H.object({id:H.string()}).catchall(H.any()),aK=H.enum(["active","revoked"]),zX=H.object({id:mr,name:mr,description:mr,status:aK}).partial(),n1=o(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),HX=H.string().refine(e=>e.split(":").length===3&&e.split(":")[0]==="lc","URI must be of the form lc:${storage}:${url}").refine(e=>e.split(":")[1]==="ceramic","URI must use storage type ceramic (i.e. must be lc:ceramic:${streamID})");var q2=z.object({credentials:mc.array()}).catchall(z.any()),cD=z.object({id:z.string(),title:z.string(),storageType:z.literal("ceramic").optional()}).catchall(z.any()),V2=z.object({credentials:mc.or(cD).array()}).strict();var uD={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials"};var i1=i(async(e,{modelData:t,credentialAlias:r}=uD)=>{let n=e.invoke.getCeramicClient(),a=new Lf({ceramic:n,model:t}),s=i(async(g=r)=>{let v=await a.get(g);if(!v)return{credentials:[]};let y=await q2.spa(v);if(y.success)return y.data;let _=await V2.spa(v);if(_.success){let D={credentials:_.data.credentials.map(P=>{if("uri"in P)return P;let{title:J,id:j,storageType:q,...Q}=P;return{...Q,id:J,uri:`lc:ceramic:${j.replace("ceramic://","")}`}})};return await a.set(r,D),D}throw console.error(y.error),new Error("Invalid credentials list stored in IDX")},"getCredentialsListFromIdx"),c=i(async(g,v)=>{if(!g)throw new Error("Must provide id to remove");v||(v=r);let y=await s(v);return y.credentials=y.credentials.filter(_=>_.id!==g),a.set(v,y)},"removeCredentialFromIdx"),l=i(async g=>(g||(g=r),a.set(g,{credentials:[]})),"removeAllCredentialsFromIdx"),h=i(async g=>{let v=await mc.parseAsync(g);if(!v)throw new Error("record is required");if(!v.uri)throw Error("No URI provided");await e.read.get(v.uri);let y=await s(r),_=y.credentials.findIndex(x=>x.id===v.id);return _>-1?y.credentials[_]=v:y.credentials.push(v),n1(await a.set(r,y))},"addCredentialInIdx"),p=i(async g=>{let v=mc.array().parse(g),y=await s(r);return await Promise.all(v.map(async _=>{await e.read.get(_.uri);let x=y.credentials.findIndex(O=>O.id===_.id);x>-1?y.credentials[x]=_:y.credentials.push(_)})),n1(await a.set(r,y))},"addCredentialsInIdx");return{name:"IDX",displayName:"IDX",description:"Stores a bespoke index of credentials for an individual based on their did",index:{get:async g=>(g.debug?.("learnCard.index.IDX.get"),(await s()).credentials),add:async(g,v)=>{g.debug?.("learnCard.index.IDX.add");try{return await h(v),!0}catch(y){return console.error("Error adding credential with IDX:",y),!1}},addMany:async(g,v)=>{g.debug?.("learnCard.index.IDX.add");try{return await p(v),!0}catch(y){return console.error("Error adding credential with IDX:",y),!1}},update:async g=>(g.debug?.("learnCard.index.IDX.update"),!1),remove:async(g,v)=>{g.debug?.("learnCard.index.IDX.remove");try{return await c(v),!0}catch(y){return console.error("Error removing credential from IDX:",y),!1}},removeAll:async g=>{g.debug?.("learnCard.index.IDX.removeAll");try{return await l(),!0}catch(v){return console.error("Error removing credentials from IDX:",v),!1}}},methods:{getCredentialsListFromIdx:async(g,v=r)=>(await s(v)).credentials,getVerifiableCredentialFromIdx:async(g,v)=>{let _=(await s())?.credentials?.find(D=>D?.id===v),x=g.read.get(_?.uri),O=await m0.safeParseAsync(x);return O.success?O.data:void 0},getVerifiableCredentialsFromIdx:async g=>{let y=(await s())?.credentials?.map(_=>_?.uri)??[];return(await Promise.all(y.map(async _=>g.read.get(_)))).filter(_=>!!_)},addVerifiableCredentialInIdx:async(g,v)=>{let y=mc.parse(v);if(!y)throw new Error("record is required");if(!y.uri)throw Error("No URI provided");await g.read.get(y.uri);let _=await s(r),x=_.credentials.findIndex(O=>O.id===y.id);return x>-1?_.credentials[x]=y:_.credentials.push(y),n1(await a.set(r,_))},removeVerifiableCredentialInIdx:async(g,v)=>c(v),removeAllVerifiableCredentialsInIdx:async()=>l(),getIDXIndex:async()=>a.get(r),setIDXIndex:async(g,v)=>a.set(r,v)}}},"getIDXPlugin");var oK=i1;
846
846
  /*!
847
847
  * The buffer module from node.js, for the browser.
848
848
  *