@learncard/idx-plugin 1.0.31 → 1.0.33
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.
- package/dist/idx-plugin.cjs.development.js +4 -2
- package/dist/idx-plugin.cjs.development.js.map +2 -2
- package/dist/idx-plugin.cjs.production.min.js +2 -2
- package/dist/idx-plugin.cjs.production.min.js.map +2 -2
- package/dist/idx-plugin.esm.js +4 -2
- package/dist/idx-plugin.esm.js.map +2 -2
- package/package.json +4 -4
|
@@ -21,7 +21,7 @@ if (cid) {
|
|
|
21
21
|
`;var Gg={};En(Gg,{base36:()=>to,base36upper:()=>LO});var to=Ka({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),LO=Ka({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var v8={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function UO(e){let t=v8[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(UO,"codeByName");function FO(e){let t=Object.entries(v8).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(FO,"nameByCode");var ro=class{};i(ro,"StreamType");ro.nameByCode=FO;ro.codeByName=UO;var kv=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((o,s)=>o+s.length,0));let r=bf(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return fu(r)}i(wf,"concat");var Zg={};En(Zg,{identity:()=>QO});var QO=uu({prefix:"\0",name:"identity",encode:e=>f8(e),decode:e=>l8(e)});var Yg={};En(Yg,{base2:()=>eN});var eN=Br({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Xg={};En(Xg,{base8:()=>tN});var tN=Br({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Qg={};En(Qg,{base10:()=>rN});var rN=Ka({prefix:"9",name:"base10",alphabet:"0123456789"});var ev={};En(ev,{base16:()=>nN,base16upper:()=>iN});var nN=Br({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),iN=Br({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var tv={};En(tv,{base64:()=>oN,base64pad:()=>aN,base64url:()=>sN,base64urlpad:()=>cN});var oN=Br({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),aN=Br({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),sN=Br({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),cN=Br({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var rv={};En(rv,{base256emoji:()=>hN});var C8=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}"),uN=C8.reduce((e,t,r)=>(e[r]=t,e),[]),lN=C8.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function fN(e){return e.reduce((t,r)=>(t+=uN[r],t),"")}i(fN,"encode");function dN(e){let t=[];for(let r of e){let n=lN[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}i(dN,"decode");var hN=uu({prefix:"\u{1F680}",name:"base256emoji",encode:fN,decode:dN});var ov={};En(ov,{sha256:()=>iv,sha512:()=>pN});var nv=i(({name:e,code:t,encode:r})=>new op(e,t,r),"from"),op=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(op,"Hasher");var I8=i(e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),"sha"),iv=nv({name:"sha2-256",code:18,encode:I8("SHA-256")}),pN=nv({name:"sha2-512",code:19,encode:I8("SHA-512")});var av={};En(av,{identity:()=>vN});var k8=0,mN="identity",D8=da,gN=i(e=>Vs(k8,D8(e)),"digest"),vN={code:k8,name:mN,encode:D8,digest:gN};var jK=new TextEncoder,$K=new TextDecoder;var sv={...Zg,...Yg,...Xg,...Qg,...ev,...Kg,...Gg,...Vg,...tv,...rv},VK={...ov,...av};function O8(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}i(O8,"createCodec");var R8=O8("utf8","u",e=>{let t=new TextDecoder("utf8");return"u"+t.decode(e)},e=>new TextEncoder().encode(e.substring(1))),cv=O8("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}),wN={utf8:R8,"utf-8":R8,hex:sv.base16,latin1:cv,ascii:cv,binary:cv,...sv},uv=wN;function lv(e,t="utf8"){let r=uv[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(lv,"toString");function ui(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(o,s,c)=>{if(c.value!=null)c.value=N8(c.value,t,r,n);else if(c.get!=null)c.get=N8(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(ui,"Memoize");var fv=new Map;function N8(e,t,r=0,n){let o=Symbol("__memoized_map__");return function(...s){let c;this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let l=this[o];if(Array.isArray(n))for(let h of n)fv.has(h)?fv.get(h).push(l):fv.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(N8,"getNewFunction");var ap=i(({enumerable:e=!0,configurable:t=!1}={})=>({enumerable:e,configurable:t,writable:!1}),"readonly"),dv=i(function*(e,t){if(e!=null&&!(e instanceof Uint8Array))for(let[r,n]of Object.entries(e)){let o=[...t,r];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[s,c]of n.entries()){let l=[...o,s],h=Ft.asCID(c);h?yield[l.join("/"),h]:typeof c=="object"&&(yield*dv(c,l))}else{let s=Ft.asCID(n);s?yield[o.join("/"),s]:yield*dv(n,o)}}},"links"),hv=i(function*(e,t){if(e!=null)for(let[r,n]of Object.entries(e)){let o=[...t,r];if(yield o.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=[...o,s];yield l.join("/"),typeof c=="object"&&!Ft.asCID(c)&&(yield*hv(c,l))}else yield*hv(n,o)}},"tree"),EN=i((e,t)=>{let r=e;for(let[n,o]of t.entries()){if(r=r[o],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:ap(),bytes:ap(),value:ap(),asBlock:ap()})}links(){return dv(this.value,[])}tree(){return hv(this.value,[])}get(t="/"){return EN(this.value,t.split("/").filter(Boolean))}};i(sp,"Block");var P8=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),o=await r.digest(n),s=Ft.create(1,t.code,o);return new sp({value:e,bytes:n,cid:s})},"encode");var Mv=Hs(ip(),1);var bp={};En(bp,{code:()=>aP,decode:()=>sP,encode:()=>Av,name:()=>oP});var SN=["string","number","bigint","symbol"],xN=["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 B8(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(SN.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(TN(e))return"Buffer";let r=CN(e);return r||"Object"}i(B8,"is");function TN(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}i(TN,"isBuffer");function CN(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(xN.includes(t))return t}i(CN,"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",MN=new TextDecoder,IN=new TextEncoder;function cp(e){return du&&globalThis.Buffer.isBuffer(e)}i(cp,"isBuffer");function pv(e){return e instanceof Uint8Array?cp(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}i(pv,"asU8A");var j8=du?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):U8(e,t,r):(e,t,r)=>r-t>64?MN.decode(e.subarray(t,r)):U8(e,t,r),$8=du?e=>e.length>64?globalThis.Buffer.from(e):L8(e):e=>e.length>64?IN.encode(e):L8(e),Oo=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),z8=du?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),pv(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let o of e)n+o.length>r.length&&(o=o.subarray(0,r.length-n)),r.set(o,n),n+=o.length;return r},H8=du?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function q8(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(q8,"compare");function L8(e,t=1/0){let r,n=e.length,o=null,s=[];for(let c=0;c<n;++c){if(r=e.charCodeAt(c),r>55295&&r<57344){if(!o){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}o=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&s.push(239,191,189);if(o=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(L8,"utf8ToBytes");function U8(e,t,r){let n=[];for(;t<r;){let o=e[t],s=null,c=o>239?4:o>223?3:o>191?2:1;if(t+c<=r){let l,h,p,g;switch(c){case 1:o<128&&(s=o);break;case 2:l=e[t+1],(l&192)===128&&(g=(o&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=(o&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=(o&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 kN(n)}i(U8,"utf8Slice");var F8=4096;function kN(e){let t=e.length;if(t<=F8)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=F8));return r}i(kN,"decodeCodePointsArray");var DN=256,pu=class{constructor(t=DN){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 o=r.length-(this.maxCursor-this.cursor)-1;r.set(t,o)}else{if(r){let o=r.length-(this.maxCursor-this.cursor)-1;o<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,o),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=H8(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=z8(this.chunks,this.cursor);return t&&this.reset(),r}};i(pu,"Bl");var It="CBOR decode error:",mv="CBOR encode error:",_f=[];_f[23]=1;_f[24]=2;_f[25]=3;_f[26]=5;_f[27]=9;function ha(e,t,r){if(e.length-t<r)throw new Error(`${It} not enough data for type`)}i(ha,"assertEnoughData");var Qr=[24,256,65536,4294967296,BigInt("18446744073709551616")];function li(e,t,r){ha(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){ha(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){ha(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){ha(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],s=(BigInt(n)<<BigInt(32))+BigInt(o);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 V8(e,t,r,n){return new Qe(Ne.uint,li(e,t+1,n),2)}i(V8,"decodeUint8");function K8(e,t,r,n){return new Qe(Ne.uint,fi(e,t+1,n),3)}i(K8,"decodeUint16");function G8(e,t,r,n){return new Qe(Ne.uint,di(e,t+1,n),5)}i(G8,"decodeUint32");function W8(e,t,r,n){return new Qe(Ne.uint,hi(e,t+1,n),9)}i(W8,"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 o=[t|27,0,0,0,0,0,0,0],s=Number(n&BigInt(4294967295)),c=Number(n>>BigInt(32)&BigInt(4294967295));o[8]=s&255,s=s>>8,o[7]=s&255,s=s>>8,o[6]=s&255,s=s>>8,o[5]=s&255,o[4]=c&255,c=c>>8,o[3]=c&255,c=c>>8,o[2]=c&255,c=c>>8,o[1]=c&255,e.push(o)}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 J8(e,t,r,n){return new Qe(Ne.negint,-1-li(e,t+1,n),2)}i(J8,"decodeNegint8");function Z8(e,t,r,n){return new Qe(Ne.negint,-1-fi(e,t+1,n),3)}i(Z8,"decodeNegint16");function Y8(e,t,r,n){return new Qe(Ne.negint,-1-di(e,t+1,n),5)}i(Y8,"decodeNegint32");var gv=BigInt(-1),X8=BigInt(1);function Q8(e,t,r,n){let o=hi(e,t+1,n);if(typeof o!="bigint"){let s=-1-o;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,gv-BigInt(o),9)}i(Q8,"decodeNegint64");function up(e,t){let r=t.value,n=typeof r=="bigint"?r*gv-X8: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*gv-X8: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){ha(e,t,r+n);let o=hu(e,t+r,t+r+n);return new Qe(Ne.bytes,o,r+n)}i(Ef,"toToken");function eE(e,t,r,n){return Ef(e,t,1,r)}i(eE,"decodeBytesCompact");function tE(e,t,r,n){return Ef(e,t,2,li(e,t+1,n))}i(tE,"decodeBytes8");function rE(e,t,r,n){return Ef(e,t,3,fi(e,t+1,n))}i(rE,"decodeBytes16");function nE(e,t,r,n){return Ef(e,t,5,di(e,t+1,n))}i(nE,"decodeBytes32");function iE(e,t,r,n){let o=hi(e,t+1,n);if(typeof o=="bigint")throw new Error(`${It} 64-bit integer bytes lengths not supported`);return Ef(e,t,9,o)}i(iE,"decodeBytes64");function lp(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Ne.string?$8(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 ON(lp(t),lp(r))},"compareTokens");function ON(e,t){return e.length<t.length?-1:e.length>t.length?1:q8(e,t)}i(ON,"compareBytes");function Af(e,t,r,n,o){let s=r+n;ha(e,t,s);let c=new Qe(Ne.string,j8(e,t+r,t+s),s);return o.retainStringBytes===!0&&(c.byteValue=hu(e,t+r,t+s)),c}i(Af,"toToken");function oE(e,t,r,n){return Af(e,t,1,r,n)}i(oE,"decodeStringCompact");function aE(e,t,r,n){return Af(e,t,2,li(e,t+1,n),n)}i(aE,"decodeString8");function sE(e,t,r,n){return Af(e,t,3,fi(e,t+1,n),n)}i(sE,"decodeString16");function cE(e,t,r,n){return Af(e,t,5,di(e,t+1,n),n)}i(cE,"decodeString32");function uE(e,t,r,n){let o=hi(e,t+1,n);if(typeof o=="bigint")throw new Error(`${It} 64-bit integer string lengths not supported`);return Af(e,t,9,o,n)}i(uE,"decodeString64");var lE=mu;function gu(e,t,r,n){return new Qe(Ne.array,n,r)}i(gu,"toToken");function fE(e,t,r,n){return gu(e,t,1,r)}i(fE,"decodeArrayCompact");function dE(e,t,r,n){return gu(e,t,2,li(e,t+1,n))}i(dE,"decodeArray8");function hE(e,t,r,n){return gu(e,t,3,fi(e,t+1,n))}i(hE,"decodeArray16");function pE(e,t,r,n){return gu(e,t,5,di(e,t+1,n))}i(pE,"decodeArray32");function mE(e,t,r,n){let o=hi(e,t+1,n);if(typeof o=="bigint")throw new Error(`${It} 64-bit integer array lengths not supported`);return gu(e,t,9,o)}i(mE,"decodeArray64");function gE(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(gE,"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 vE(e,t,r,n){return vu(e,t,1,r)}i(vE,"decodeMapCompact");function yE(e,t,r,n){return vu(e,t,2,li(e,t+1,n))}i(yE,"decodeMap8");function bE(e,t,r,n){return vu(e,t,3,fi(e,t+1,n))}i(bE,"decodeMap16");function wE(e,t,r,n){return vu(e,t,5,di(e,t+1,n))}i(wE,"decodeMap32");function _E(e,t,r,n){let o=hi(e,t+1,n);if(typeof o=="bigint")throw new Error(`${It} 64-bit integer map lengths not supported`);return vu(e,t,9,o)}i(_E,"decodeMap64");function EE(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(EE,"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 AE(e,t,r,n){return new Qe(Ne.tag,r,1)}i(AE,"decodeTagCompact");function SE(e,t,r,n){return new Qe(Ne.tag,li(e,t+1,n),2)}i(SE,"decodeTag8");function xE(e,t,r,n){return new Qe(Ne.tag,fi(e,t+1,n),3)}i(xE,"decodeTag16");function TE(e,t,r,n){return new Qe(Ne.tag,di(e,t+1,n),5)}i(TE,"decodeTag32");function CE(e,t,r,n){return new Qe(Ne.tag,hi(e,t+1,n),9)}i(CE,"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 FN=20,jN=21,$N=22,zN=23;function ME(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(ME,"decodeUndefined");function IE(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(IE,"decodeBreak");function vv(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(vv,"createToken");function kE(e,t,r,n){return vv(yv(e,t+1),3,n)}i(kE,"decodeFloat16");function DE(e,t,r,n){return vv(bv(e,t+1),5,n)}i(DE,"decodeFloat32");function RE(e,t,r,n){return vv(BE(e,t+1),9,n)}i(RE,"decodeFloat64");function pp(e,t,r){let n=t.value;if(n===!1)e.push([Ne.float.majorEncoded|FN]);else if(n===!0)e.push([Ne.float.majorEncoded|jN]);else if(n===null)e.push([Ne.float.majorEncoded|$N]);else if(n===void 0)e.push([Ne.float.majorEncoded|zN]);else{let o,s=!1;(!r||r.float64!==!0)&&(NE(n),o=yv(no,1),n===o||Number.isNaN(n)?(no[0]=249,e.push(no.slice(0,3)),s=!0):(PE(n),o=bv(no,1),n===o&&(no[0]=250,e.push(no.slice(0,5)),s=!0))),s||(HN(n),o=BE(no,1),no[0]=251,e.push(no.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){NE(n);let o=yv(no,1);if(n===o||Number.isNaN(n))return 3;if(PE(n),o=bv(no,1),n===o)return 5}return 9},"encodedSize");var OE=new ArrayBuffer(9),Ui=new DataView(OE,1),no=new Uint8Array(OE,0);function NE(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 o=r-127;o<-24?Ui.setUint16(0,0):o<-14?Ui.setUint16(0,(t&2147483648)>>16|1<<24+o,!1):Ui.setUint16(0,(t&2147483648)>>16|o+15<<10|n>>13,!1)}}}i(NE,"encodeFloat16");function yv(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,o=r&1023,s;return n===0?s=o*2**-24:n!==31?s=(o+1024)*2**(n-25):s=o===0?1/0:NaN,r&32768?-s:s}i(yv,"readFloat16");function PE(e){Ui.setFloat32(0,e,!1)}i(PE,"encodeFloat32");function bv(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(bv,"readFloat32");function HN(e){Ui.setFloat64(0,e,!1)}i(HN,"encodeFloat64");function BE(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(BE,"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]=V8;We[25]=K8;We[26]=G8;We[27]=W8;We[28]=ur;We[29]=ur;We[30]=ur;We[31]=ur;for(let e=32;e<=55;e++)We[e]=ur;We[56]=J8;We[57]=Z8;We[58]=Y8;We[59]=Q8;We[60]=ur;We[61]=ur;We[62]=ur;We[63]=ur;for(let e=64;e<=87;e++)We[e]=eE;We[88]=tE;We[89]=rE;We[90]=nE;We[91]=iE;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]=oE;We[120]=aE;We[121]=sE;We[122]=cE;We[123]=uE;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]=fE;We[152]=dE;We[153]=hE;We[154]=pE;We[155]=mE;We[156]=ur;We[157]=ur;We[158]=ur;We[159]=gE;for(let e=160;e<=183;e++)We[e]=vE;We[184]=yE;We[185]=bE;We[186]=wE;We[187]=_E;We[188]=ur;We[189]=ur;We[190]=ur;We[191]=EE;for(let e=192;e<=215;e++)We[e]=AE;We[216]=SE;We[217]=xE;We[218]=TE;We[219]=CE;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]=ME;We[248]=mp("simple values are not supported");We[249]=kE;We[250]=DE;We[251]=RE;We[252]=ur;We[253]=ur;We[254]=ur;We[255]=IE;var io=[];for(let e=0;e<24;e++)io[e]=new Qe(Ne.uint,e,1);for(let e=-1;e>=-24;e--)io[31-e]=new Qe(Ne.negint,e,1);io[64]=new Qe(Ne.bytes,new Uint8Array(0),1);io[96]=new Qe(Ne.string,"",1);io[128]=new Qe(Ne.array,0,1);io[160]=new Qe(Ne.map,0,1);io[244]=new Qe(Ne.false,!1,1);io[245]=new Qe(Ne.true,!0,1);io[246]=new Qe(Ne.null,null,1);function LE(e){switch(e.type){case Ne.false:return Oo([244]);case Ne.true:return Oo([245]);case Ne.null:return Oo([246]);case Ne.bytes:return e.value.length?void 0:Oo([64]);case Ne.string:return e.value===""?Oo([96]):void 0;case Ne.array:return e.value===0?Oo([128]):void 0;case Ne.map:return e.value===0?Oo([160]):void 0;case Ne.uint:return e.value<24?Oo([Number(e.value)]):void 0;case Ne.negint:if(e.value>=-24)return Oo([31-Number(e.value)])}}i(LE,"quickEncodeToken");var VN={float64:!1,mapSorter:WN,quickEncodeToken:LE};function KN(){let e=[];return e[Ne.uint.major]=Li,e[Ne.negint.major]=up,e[Ne.bytes.major]=mu,e[Ne.string.major]=lE,e[Ne.array.major]=fp,e[Ne.map.major]=dp,e[Ne.tag.major]=hp,e[Ne.float.major]=pp,e}i(KN,"makeCborEncoders");var UE=KN(),wv=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(`${mv} object contains circular references`);return new Gs(r,t)}};i(Gs,"Ref");var Ga={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)},Wa={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?Ga.true:Ga.false},null(e,t,r,n){return Ga.null},undefined(e,t,r,n){return Ga.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?[Ga.emptyArray,new Qe(Ne.break)]:Ga.emptyArray;n=Gs.createCheck(n,e);let o=[],s=0;for(let c of e)o[s++]=gp(c,r,n);return r.addBreakTokens?[new Qe(Ne.array,e.length),o,new Qe(Ne.break)]:[new Qe(Ne.array,e.length),o]},Object(e,t,r,n){let o=t!=="Object",s=o?e.keys():Object.keys(e),c=o?e.size:s.length;if(!c)return r.addBreakTokens===!0?[Ga.emptyMap,new Qe(Ne.break)]:Ga.emptyMap;n=Gs.createCheck(n,e);let l=[],h=0;for(let p of s)l[h++]=[gp(p,r,n),gp(o?e.get(p):e[p],r,n)];return GN(l,r),r.addBreakTokens?[new Qe(Ne.map,c),l,new Qe(Ne.break)]:[new Qe(Ne.map,c),l]}};Wa.Map=Wa.Object;Wa.Buffer=Wa.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Wa[`${e}Array`]=Wa.DataView;function gp(e,t={},r){let n=B8(e),o=t&&t.typeEncoders&&t.typeEncoders[n]||Wa[n];if(typeof o=="function"){let c=o(e,n,t,r);if(c!=null)return c}let s=Wa[n];if(!s)throw new Error(`${mv} unsupported type: ${n}`);return s(e,n,t,r)}i(gp,"objectToTokens");function GN(e,t){t.mapSorter&&e.sort(t.mapSorter)}i(GN,"sortMapEntries");function WN(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 o=r.type.major,s=UE[o].compareTokens(r,n);return s===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),s}i(WN,"mapSorter");function FE(e,t,r,n){if(Array.isArray(t))for(let o of t)FE(e,o,r,n);else r[t.type.major](e,t,n)}i(FE,"tokensToEncoded");function JN(e,t,r){let n=gp(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let o=r.quickEncodeToken(n);if(o)return o;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 pv(l.chunks[0])}}return wv.reset(),FE(wv,n,t,r),wv.toBytes(!0)}i(JN,"encodeCustom");function _v(e,t){return t=Object.assign({},VN,t),JN(e,UE,t)}i(_v,"encode");var ZN={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=io[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 o=t&31;r=n(this.data,this.pos,o,this.options)}return this.pos+=r.encodedLength,r}};i(vp,"Tokeniser");var Sf=Symbol.for("DONE"),yp=Symbol.for("BREAK");function YN(e,t,r){let n=[];for(let o=0;o<e.value;o++){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 ${o}, expected ${e.value})`);n[o]=s}return n}i(YN,"tokenToArray");function XN(e,t,r){let n=r.useMaps===!0,o=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 o))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):o[l]=h}return n?s:o}i(XN,"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 YN(r,e,t);if(r.type===Ne.map)return XN(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 Ev(e,t){if(!(e instanceof Uint8Array))throw new Error(`${It} data to decode must be a Uint8Array`);t=Object.assign({},ZN,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(Ev,"decode");var jE=42;function eP(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,jE),new Qe(Ne.bytes,r)]}i(eP,"cidEncoder");function tP(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}i(tP,"undefinedEncoder");function rP(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(rP,"numberEncoder");var nP={float64:!0,typeEncoders:{Object:eP,undefined:tP,number:rP}};function iP(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ft.decode(e.subarray(1))}i(iP,"cidDecoder");var $E={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};$E.tags[jE]=iP;var oP="dag-cbor",aP=113,Av=i(e=>_v(e,nP),"encode"),sP=i(e=>Ev(e,$E),"decode");function yu(e){try{return e()}catch(t){return t}}i(yu,"tryCatch");var Sv=Hs(ip(),1);function Ws(e){let t=Sv.default.decode(e),r=Sv.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(Ws,"readVarint");function cP(e){return e===0||e===1}i(cP,"isCidVersion");function xv(e){let[t,r]=Ws(e);if(!cP(t))throw new Error(`Unknown CID version ${t}`);let[n,o]=Ws(r),[,s,c]=Ws(o),[l,,h]=Ws(s),p=o.subarray(0,c+h+l),g=o.subarray(c+h+l);return[Ft.create(t,n,Yh(p)),g]}i(xv,"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[o,s]=Ws(n),c=xv(s),[l,h]=c;if(h.length===0)return{kind:"stream-id",type:o,genesis:l};if(h.length===1&&h[0]===0)return{kind:"commit-id",type:o,genesis:l,commit:null};{let[p]=xv(h);return{kind:"commit-id",type:o,genesis:l,commit:p}}}i(Js,"fromBytes");var uP=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function bu(e,t="StreamRef"){let r=uP.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let o=to.decode(n),s=Js(o),c=r[4];return c?{kind:"commit-id",type:s.type,genesis:s.genesis,commit:Tv(s.genesis,c)}:s}i(bu,"fromString");function lP(e){try{return typeof e=="string"?Ft.parse(e):Ft.asCID(e)}catch{return null}}i(lP,"parseCID");function Tv(e,t=null){if(!t||t==="0")return null;let r=lP(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(Tv,"parseCommit");var Tf=function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>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 ${to.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 qE(e){let t=Js(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new wp(e)}i(qE,"fromBytes");function fP(e){return yu(()=>qE(e))}i(fP,"fromBytesNoThrow");function VE(e){let t=bu(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new _p(e)}i(VE,"fromString");function dP(e){return yu(()=>VE(e))}i(dP,"fromStringNoThrow");var HE=Symbol.for("@ceramicnetwork/streamid/StreamID"),Yt=class{constructor(t,r){if(this._tag=HE,!(t||t===0))throw new Error("StreamID constructor: type required");if(!r)throw new Error("StreamID constructor: cid required");this._type=typeof t=="string"?ro.codeByName(t):t,this._cid=typeof r=="string"?Ft.parse(r):r}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===HE}static async fromGenesis(t,r){let n=await P8({value:r,codec:bp,hasher:iv});return new Yt(t,n.cid)}get type(){return this._type}get typeName(){return ro.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let t=Mv.default.encode(206),r=Mv.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 to.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=qE;Yt.fromBytesNoThrow=fP;Yt.fromString=VE;Yt.fromStringNoThrow=dP;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 o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>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)},Iv=function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},pa=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 ${to.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 GE(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(GE,"fromBytes");function hP(e){return yu(()=>GE(e))}i(hP,"fromBytesNoThrow");function WE(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(WE,"fromString");function pP(e){return yu(()=>WE(e))}i(pP,"fromStringNoThrow");var KE=Symbol.for("@ceramicnetwork/streamid/CommitID");function mP(e,t){return new hr(e.type,e.cid,t)}i(mP,"make");var hr=class{constructor(t,r,n=null){if(this._tag=KE,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");Iv(this,wu,typeof t=="string"?ro.codeByName(t):t,"f"),Iv(this,Zs,typeof r=="string"?Ft.parse(r):r,"f"),Iv(this,Cf,Tv(pa(this,Zs,"f"),n),"f")}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===KE}get baseID(){return new Yt(pa(this,wu,"f"),pa(this,Zs,"f"))}get type(){return pa(this,wu,"f")}get typeName(){return ro.nameByCode(pa(this,wu,"f"))}get cid(){return pa(this,Zs,"f")}get commit(){return pa(this,Cf,"f")||pa(this,Zs,"f")}get bytes(){let t=kv.default.encode(206),r=kv.default.encode(this.type),n=pa(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 to.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=GE;hr.fromBytesNoThrow=hP;hr.fromString=WE;hr.fromStringNoThrow=pP;hr.make=mP;_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(o){let s=Js(o);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: ${to.encode(o)}`)}}i(t,"fromBytes"),e.fromBytes=t;function r(o){let s=bu(o);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: ${o}`)}}i(r,"fromString"),e.fromString=r;function n(o){if(Yt.isInstance(o)||hr.isInstance(o))return o;if(o instanceof Uint8Array)return t(o);if(typeof o=="string")return r(o);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(o)}`)}i(n,"from"),e.from=n})(Ys||(Ys={}));var JE="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",Sp="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var Dv={};En(Dv,{JsonPatchError:()=>Lr,_areEquals:()=>kf,applyOperation:()=>Xs,applyPatch:()=>Dp,applyReducer:()=>wP,deepClone:()=>yP,getValueByPointer:()=>Ip,validate:()=>YE,validator:()=>kp});var gP=function(){var e=i(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[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)}}(),vP=Object.prototype.hasOwnProperty;function Tp(e,t){return vP.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 o in e)Tp(e,o)&&n.push(o);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 No(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(No,"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),o=n.length,s=0;s<o;s++)if(xp(e[n[s]]))return!0}}return!1}i(xp,"hasUndefined");function ZE(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
|
|
22
22
|
`)}i(ZE,"patchErrorMessageFormatter");var If=function(e){gP(t,e);function t(r,n,o,s,c){var l=this.constructor,h=e.call(this,ZE(r,{name:n,index:o,operation:s,tree:c}))||this;return h.name=n,h.index=o,h.operation=s,h.tree=c,Object.setPrototypeOf(h,l.prototype),h.message=ZE(r,{name:n,index:o,operation:s,tree:c}),h}return i(t,"PatchError"),t}(Error);var Lr=If,yP=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 o=Xs(r,{op:"remove",path:this.from}).removed;return Xs(r,{op:"add",path:this.path,value:o}),{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}}},bP={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,o,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!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(_)),o&&(_=="__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=bP[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,o){if(n===void 0&&(n=!0),o===void 0&&(o=!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,o,c),e=s[c].newDocument;return s.newDocument=e,s}i(Dp,"applyPatch");function wP(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(wP,"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 o=e.path.split("/").length,s=n.split("/").length;if(o!==s+1&&o!==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=YE([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 YE(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(o){if(o instanceof Lr)return o;throw o}}i(YE,"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),o,s,c;if(r&&n){if(s=e.length,s!=t.length)return!1;for(o=s;o--!==0;)if(!kf(e[o],t[o]))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(o=s;o--!==0;)if(!t.hasOwnProperty(l[o]))return!1;for(o=s;o--!==0;)if(c=l[o],!kf(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(kf,"_areEquals");var Pv={};En(Pv,{compare:()=>MP,generate:()=>Rv,observe:()=>CP,unobserve:()=>TP});var Ov=new WeakMap,_P=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror"),e}(),EP=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo"),e}();function AP(e){return Ov.get(e)}i(AP,"getMirror");function SP(e,t){return e.observers.get(t)}i(SP,"getObserverFromMirror");function xP(e,t){e.observers.delete(t.callback)}i(xP,"removeObserverFromMirror");function TP(e,t){t.unobserve()}i(TP,"unobserve");function CP(e,t){var r=[],n,o=AP(e);if(!o)o=new _P(e),Ov.set(e,o);else{var s=SP(o,t);n=s&&s.observer}if(n)return n;if(n={},o.value=un(e),t){n.callback=t,n.next=null;var c=i(function(){Rv(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(){Rv(n),clearTimeout(n.next),xP(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},o.observers.set(t,new EP(t,n)),n}i(CP,"observe");function Rv(e,t){t===void 0&&(t=!1);var r=Ov.get(e.object);Nv(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(Rv,"generate");function Nv(e,t,r,n,o){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)?Nv(v,y,r,n+"/"+No(g),o):v!==y&&(l=!0,o&&r.push({op:"test",path:n+"/"+No(g),value:un(v)}),r.push({op:"replace",path:n+"/"+No(g),value:un(y)}))}else Array.isArray(e)===Array.isArray(t)?(o&&r.push({op:"test",path:n+"/"+No(g),value:un(v)}),r.push({op:"remove",path:n+"/"+No(g)}),h=!0):(o&&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+"/"+No(g),value:un(t[g])})}}}i(Nv,"_generate");function MP(e,t,r){r===void 0&&(r=!1);var n=[];return Nv(e,t,n,"",r),n}i(MP,"compare");var XE=Object.assign({},Dv,Pv,{JsonPatchError:If,deepClone:un,escapePathComponent:No,unescapePathComponent:Mf});var b7=Hs(Zv(),1);var w7=Hs(t7(),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 py=Hs(Zv(),1);var iy=i(function(e,t){return iy=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},iy(e,t)},"extendStatics");function oy(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");iy(e,t);function r(){this.constructor=e}i(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(oy,"__extends");function ay(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(ay,"__values");function Cu(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,s=[],c;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(l){c={error:l}}finally{try{o&&!o.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,o=t.length,s;n<o;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 r7(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(r7,"createErrorClass");var Wp=r7(function(e){return i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
23
23
|
`+r.map(function(n,o){return o+1+") "+n.toString()}).join(`
|
|
24
|
-
`):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function sy(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(sy,"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,o,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=ay(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=ay(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{n7(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&&(o=y.return)&&o.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)n7(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)&&sy(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&sy(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var EJ=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 n7(e){ji(e)?e():e.unsubscribe()}i(n7,"execFinalizer");var oo={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 o=Iu.delegate;return o?.setTimeout?o.setTimeout.apply(o,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 i7(e){Iu.setTimeout(function(){var t=oo.onUnhandledError;if(t)t(e);else throw e})}i(i7,"reportUnhandledError");function cy(){}i(cy,"noop");var o7=function(){return uy("C",void 0,void 0)}();function a7(e){return uy("E",void 0,e)}i(a7,"errorNotification");function s7(e){return uy("N",e,void 0)}i(s7,"nextNotification");function uy(e,t,r){return{kind:e,value:t,error:r}}i(uy,"createNotification");var nc=null;function c7(e){if(oo.useDeprecatedSynchronousErrorHandling){var t=!nc;if(t&&(nc={errorThrown:!1,error:null}),e(),t){var r=nc,n=r.errorThrown,o=r.error;if(nc=null,n)throw o}}else e()}i(c7,"errorContext");function u7(e){oo.useDeprecatedSynchronousErrorHandling&&nc&&(nc.errorThrown=!0,nc.error=e)}i(u7,"captureError");var dy=function(e){oy(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=FL,n}return i(t,"Subscriber"),t.create=function(r,n,o){return new Xp(r,n,o)},t.prototype.next=function(r){this.isStopped?fy(s7(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?fy(a7(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?fy(o7,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 BL=Function.prototype.bind;function ly(e,t){return BL.call(e,t)}i(ly,"bind");var LL=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){oy(t,e);function t(r,n,o){var s=e.call(this)||this,c;if(ji(r)||!r)c={next:r??void 0,error:n??void 0,complete:o??void 0};else{var l;s&&oo.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&ly(r.next,l),error:r.error&&ly(r.error,l),complete:r.complete&&ly(r.complete,l)}):c=r}return s.destination=new LL(c),s}return i(t,"SafeSubscriber"),t}(dy);function Yp(e){oo.useDeprecatedSynchronousErrorHandling?u7(e):i7(e)}i(Yp,"handleUnhandledError");function UL(e){throw e}i(UL,"defaultErrorHandler");function fy(e,t){var r=oo.onStoppedNotification;r&&Iu.setTimeout(function(){return r(e,t)})}i(fy,"handleStoppedNotification");var FL={closed:!0,next:cy,error:UL,complete:cy};var l7=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function f7(e){return e}i(f7,"identity");function d7(e){return e.length===0?f7:e.length===1?e[0]:i(function(r){return e.reduce(function(n,o){return o(n)},r)},"piped")}i(d7,"pipeFromArray");var hy=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 o=this,s=$L(t)?t:new Xp(t,r,n);return c7(function(){var c=o,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?o._subscribe(s):o._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=h7(r),new r(function(o,s){var c=new Xp({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:o});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[l7]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return d7(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=h7(t),new t(function(n,o){var s;r.subscribe(function(c){return s=c},function(c){return o(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function h7(e){var t;return(t=e??oo.Promise)!==null&&t!==void 0?t:Promise}i(h7,"getPromiseCtor");function jL(e){return e&&ji(e.next)&&ji(e.error)&&ji(e.complete)}i(jL,"isObserver");function $L(e){return e&&e instanceof dy||jL(e)&&Zp(e)}i($L,"isSubscriber");var p7;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(p7||(p7={}));var m7;(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"})(m7||(m7={}));var my;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(my||(my={}));var Nf=class extends hy{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,py.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===my.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,py.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 g7(){return e=>{}}i(g7,"StreamStatic");var zL=function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},mi,gy={anchor:!0,publish:!0,pin:!0,sync:rc.PREFER_CACHE},HL={sync:rc.PREFER_CACHE},v7={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function vy(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=lv((0,w7.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(vy,"headerFromMetadata");async function y7(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(y7,"getAuthenticatedDID");async function yy(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(yy,"throwReadOnlyError");var Za=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,b7.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,o={}){o={...gy,...o},!n?.deterministic&&o.syncTimeoutSeconds==null&&(o.syncTimeoutSeconds=0);let s=o.asDID?{did:o.asDID}:t,c=await mi.makeGenesis(s,r,n);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,c,o)}static async createFromGenesis(t,r,n={}){n={...gy,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let o=r.data?await mi._signDagJWS(t,r):r;return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,o,n)}static async deterministic(t,r,n={}){if(n={...gy,...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 o=await mi.makeGenesis(t,null,r);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...HL,...n};let o=Ys.from(r);if(o.type!=mi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${mi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...v7,...n};let o=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(o,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...v7,...r};let o={header:vy(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await mi._signDagJWS(this.api,o),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=yy,this.patch=yy,this.sync=yy,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let o=await this._makeRawCommit(r,n);return mi._signDagJWS(t,o)}async _makeRawCommit(t,r){r||(r={});let n=vy(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 o=XE.compare(this.content,t),s=this.state.log[0];return{header:n,data:o,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 y7(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 o=vy(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:o};return Av(c),c}let s={data:r,header:o};return mi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await y7(t)).createDagJWS(r)}},"TileDocument");Za.STREAM_TYPE_NAME="tile";Za.STREAM_TYPE_ID=0;Za=mi=zL([g7()],Za);var C7=Hs(A7(),1);function QL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(QL,"_checkPrivateRedeclaration");function eU(e,t){return t.get?t.get.call(e):t.value}i(eU,"_classApplyDescriptorGet");function tU(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(tU,"_classApplyDescriptorSet");function T7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(T7,"_classExtractFieldDescriptor");function Ey(e,t){var r=T7(e,t,"get");return eU(e,r)}i(Ey,"_classPrivateFieldGet");function S7(e,t,r){QL(e,t),t.set(e,r)}i(S7,"_classPrivateFieldInit");function x7(e,t,r){var n=T7(e,t,"set");return tU(e,n,r),r}i(x7,"_classPrivateFieldSet");function rU(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(rU,"keyToQuery");function Ay(e){return typeof e=="string"?Ys.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(Ay,"keyToString");async function xy(e){let t=await Za.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(xy,"getDeterministicQuery");var nU=i(()=>Promise.resolve([]),"tempBatchLoadFn"),Qp=new WeakMap,Sy=new WeakMap,ic=class extends C7.default{cache(t){if(!Ey(this,Sy))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let o=await Za.create(Ey(this,Qp),t,r,n);return this.cache(o),o}async deterministic(t,r){let n=await xy(t);try{return await super.load(n)}catch{let s=await Za.createFromGenesis(Ey(this,Qp),n.genesis,r);return this.cache(s),s}}async load(t){return await super.load(t)}async update(t,r,n,o){let s=Ay(t);this.clear(s);let c=await this.load({streamId:s});return await c.update(r,n,o),c}constructor(t){super(nU,{cache:!0,cacheKeyFn:Ay,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),S7(this,Qp,{writable:!0,value:void 0}),S7(this,Sy,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(rU),t.multiqueryTimeout);return r.map(o=>{let s=Ay(o),c=n[s];return c||new Error(`Failed to load stream: ${s}`)})},x7(this,Qp,t.ceramic),x7(this,Sy,!!t.cache)}};i(ic,"TileLoader");function iU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(iU,"_checkPrivateRedeclaration");function oU(e,t){return t.get?t.get.call(e):t.value}i(oU,"_classApplyDescriptorGet");function aU(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(aU,"_classApplyDescriptorSet");function I7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(I7,"_classExtractFieldDescriptor");function oc(e,t){var r=I7(e,t,"get");return oU(e,r)}i(oc,"_classPrivateFieldGet");function M7(e,t,r){iU(e,t),t.set(e,r)}i(M7,"_classPrivateFieldInit");function Ty(e,t,r){var n=I7(e,t,"set");return aU(e,n,r),r}i(Ty,"_classPrivateFieldSet");var ku=new WeakMap,Du=new WeakMap,Ru=class{get aliases(){return oc(this,ku)}get loader(){return oc(this,Du)}getDefinitionID(t){return oc(this,ku).definitions[t]??null}getSchemaURL(t){return oc(this,ku).schemas[t]??null}getTileID(t){return oc(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 oc(this,Du).load(r)}async createTile(t,r,n={}){let o=this.getSchemaURL(t);if(o==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:s,...c}=n,l={schema:o};return s!=null&&(l.controllers=[s]),await oc(this,Du).create(r,l,c)}constructor(t){if(M7(this,ku,{writable:!0,value:void 0}),M7(this,Du,{writable:!0,value:void 0}),Ty(this,ku,t.aliases),t.loader!=null)Ty(this,Du,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");Ty(this,Du,new ic({ceramic:t.ceramic,cache:t.cache}))}}};i(Ru,"DataModel");function sU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(sU,"_checkPrivateRedeclaration");function cU(e,t){return t.get?t.get.call(e):t.value}i(cU,"_classApplyDescriptorGet");function uU(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(uU,"_classApplyDescriptorSet");function k7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(k7,"_classExtractFieldDescriptor");function Po(e,t){var r=k7(e,t,"get");return cU(e,r)}i(Po,"_classPrivateFieldGet");function e0(e,t,r){sU(e,t),t.set(e,r)}i(e0,"_classPrivateFieldInit");function t0(e,t,r){var n=k7(e,t,"set");return uU(e,n,r),r}i(t0,"_classPrivateFieldSet");var r0=new WeakMap,ac=new WeakMap,Cy=new WeakMap,n0=new WeakMap,Pf=class{_createValuePromise(){t0(this,Cy,new Promise((t,r)=>{t0(this,n0,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let o=i(async s=>{try{let c=await t(s);r(),this._next(c)}catch(c){n(c),this._next(s)}},"run");Po(this,ac).push({reject:n,run:o}),Po(this,ac).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 Po(this,ac).length===0?await Po(this,r0).call(this):await Po(this,Cy)}async _start(){try{let t=await Po(this,r0).call(this);this._next(t)}catch(t){Po(this,ac).forEach(r=>{r.reject(t)}),t0(this,ac,[]),Po(this,n0).reject(t),this._createValuePromise()}}_next(t){let r=Po(this,ac).shift();r==null?this._end(t):r.run(t)}_end(t){Po(this,n0).resolve(t),this._createValuePromise()}constructor(t){e0(this,r0,{writable:!0,value:void 0}),e0(this,ac,{writable:!0,value:[]}),e0(this,Cy,{writable:!0,value:void 0}),e0(this,n0,{writable:!0,value:void 0}),t0(this,r0,t),this._createValuePromise()}};i(Pf,"TileProxy");var lU=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function fU(e){return lU.test(e)}i(fU,"isDIDstring");function dU(e){if(!fU(e))throw new Error(`Invalid DID: ${e}`)}i(dU,"assertDIDstring");function My(e){return dU(e),{controllers:[e],family:"IDX"}}i(My,"getIDXMetadata");function hU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(hU,"_checkPrivateRedeclaration");function pU(e,t){return t.get?t.get.call(e):t.value}i(pU,"_classApplyDescriptorGet");function mU(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(mU,"_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 $r(e,t){var r=D7(e,t,"get");return pU(e,r)}i($r,"_classPrivateFieldGet");function Bf(e,t,r){hU(e,t),t.set(e,r)}i(Bf,"_classPrivateFieldInit");function i0(e,t,r){var n=D7(e,t,"set");return mU(e,n,r),r}i(i0,"_classPrivateFieldSet");var va=new WeakMap,o0=new WeakMap,Iy=new WeakMap,Bo=new WeakMap,a0=new WeakMap,Lf=class{get authenticated(){return $r(this,va).did!=null}get ceramic(){return $r(this,va)}get id(){if($r(this,o0)!=null)return $r(this,o0);if($r(this,va).did==null)throw new Error("Ceramic instance is not authenticated");return $r(this,va).did.hasParent?$r(this,va).did.parent:$r(this,va).did.id}get loader(){return $r(this,Bo)}get model(){return $r(this,a0)}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),o=await Promise.all(r.map(async l=>{let{genesis:h,streamId:p}=await xy(My(l));return{genesis:h,streamId:p.toString(),paths:[n]}})),s=await $r(this,va).multiQuery(o),c=[];for(let l of o){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 o=this.getDefinitionID(t),[s,c]=await this._setRecordOnly(o,r,n);return s&&await this._setReference(n.controller??this.id,o,c),c}async merge(t,r,n={}){let o=this.getDefinitionID(t),s=await this.getRecord(o),c=s?{...s,...r}:r;return await this.setRecord(o,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()??{},o=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(o)).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[o,s]=r[n++],c=await $r(this,Bo).load(s);return{done:!1,value:{key:o,id:s,record:c.content}}}}}async _createIDXDoc(t){return await $r(this,Bo).deterministic(My(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,Iy)[t];return r==null&&(r=new Pf(async()=>await this._getOwnIDXDoc(t)),$r(this,Iy)[t]=r),r}getDefinitionID(t){return $r(this,a0).getDefinitionID(t)??t}async getDefinition(t){let r=await $r(this,Bo).load(t);if(r.metadata.schema!==JE)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,Bo).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[o,s]=await this._setRecordOnly(t,r,n);return o&&await this._setReference(n.controller??this.id,t,s),s}async _setRecordOnly(t,r,n){let o=await this.getRecordID(t,n.controller??this.id);if(o==null){let s=await this.getDefinition(t),c=await this._createRecord(s,r,n);return[!0,c]}else{let s=await $r(this,Bo).update(o,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:o}){let s=await $r(this,Bo).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:o});return await s.update(r,{schema:t.schema}),s.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(o=>({...o,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Bf(this,va,{writable:!0,value:void 0}),Bf(this,o0,{writable:!0,value:void 0}),Bf(this,Iy,{writable:!0,value:{}}),Bf(this,Bo,{writable:!0,value:void 0}),Bf(this,a0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:o,loader:s,model:c}=t;i0(this,va,n),i0(this,o0,o),i0(this,Bo,s??new ic({ceramic:n,cache:r})),i0(this,a0,c instanceof Ru?c:new Ru({loader:$r(this,Bo),aliases:c}))}};i(Lf,"DIDDataStore");var rr;(function(e){e.assertEqual=o=>o;function t(o){}i(t,"assertIs"),e.assertIs=t;function r(o){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let c of o)s[c]=c;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),c={};for(let l of s)c[l]=o[l];return e.objectValues(c)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let c in o)Object.prototype.hasOwnProperty.call(o,c)&&s.push(c);return s},e.find=(o,s)=>{for(let c of o)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(o,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"]),Ya=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"]),gU=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:[]},o=i(s=>{for(let c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(o);else if(c.code==="invalid_return_type")o(c.returnTypeError);else if(c.code==="invalid_arguments")o(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 o(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 o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));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"),P7=Ff;function vU(e){P7=e}i(vU,"setErrorMap");function c0(){return P7}i(c0,"getErrorMap");var u0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],c={...o,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...o,path:s,message:o.message||l}},"makeIssue"),yU=[];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 o of r){if(o.status==="aborted")return Dt;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r)n.push({key:await o.key,value:await o.value});return en.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:s,value:c}=o;if(s.status==="aborted"||c.status==="aborted")return Dt;s.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),(typeof c.value<"u"||o.alwaysSet)&&(n[s.value]=c.value)}return{status:t.value,value:n}}};i(en,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),B7=i(e=>({status:"dirty",value:e}),"DIRTY"),Sn=i(e=>({status:"valid",value:e}),"OK"),ky=i(e=>e.status==="aborted","isAborted"),Dy=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,o){this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._path.concat(this._key)}};i(gi,"ParseInputLazyPath");var R7=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:o}=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:o}:{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:o}}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 Ya(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ya(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:Ya(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 o={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:Ya(t)},s=this._parseSync({data:t,path:o.path,parent:o});return R7(o,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:Ya(t)},o=this._parse({data:t,path:n.path,parent:n}),s=await(f0(o)?o:Promise.resolve(o));return R7(n,s)}refine(t,r){let n=i(o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r,"getIssueProperties");return this._refinement((o,s)=>{let c=t(o),l=i(()=>s.addIssue({code:Ke.custom,...n(o)}),"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,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):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 jo.create(this)}nullish(){return this.optional().nullable()}array(){return Gn.create(this)}promise(){return wa.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 bU=/^c[^\s-]{8,}$/i,wU=/^([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,_U=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,EU=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(o=>t.test(o),{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,o;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{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&&(o=this._getOrReturnCtx(t,o),vt(o,{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)&&(o=this._getOrReturnCtx(t,o),c?vt(o,{code:Ke.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&vt(o,{code:Ke.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")_U.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"email",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")wU.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"uuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")bU.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"cuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),vt(o,{validation:"url",code:Ke.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{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)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?EU(s).test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{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 AU(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),c=parseInt(t.toFixed(o).replace(".",""));return s%c/Math.pow(10,o)}i(AU,"floatSafeRemainder");var ao=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,o=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}),o.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}),o.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}),o.dirty()):s.kind==="multipleOf"?AU(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_finite,message:s.message}),o.dirty()):rr.assertNever(s);return{status:o.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,o){return new ao({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Wt.toString(o)}]})}_addCheck(t){return new ao({...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(ao,"ZodNumber");ao.create=e=>new ao({checks:[],typeName:xt.ZodNumber,coerce:e?.coerce||!1,...Vt(e)});var Xa=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(Xa,"ZodBigInt");Xa.create=e=>{var t;return new Xa({typeName:xt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};var Qa=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(Qa,"ZodBoolean");Qa.create=e=>new Qa({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Vt(e)});var Lo=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,o;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{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&&(o=this._getOrReturnCtx(t,o),vt(o,{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 Lo({...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(Lo,"ZodDate");Lo.create=e=>new Lo({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 ya=class extends Bt{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};i(ya,"ZodAny");ya.create=e=>new ya({typeName:xt.ZodAny,...Vt(e)});var Uo=class extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};i(Uo,"ZodUnknown");Uo.create=e=>new Uo({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),o=this._def;if(r.parsedType!==tt.array)return vt(r,{code:Ke.invalid_type,expected:tt.array,received:r.parsedType}),Dt;if(o.exactLength!==null){let c=r.data.length>o.exactLength.value,l=r.data.length<o.exactLength.value;(c||l)&&(vt(r,{code:c?Ke.too_big:Ke.too_small,minimum:l?o.exactLength.value:void 0,maximum:c?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(vt(r,{code:Ke.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(vt(r,{code:Ke.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((c,l)=>o.type._parseAsync(new gi(r,c,r.path,l)))).then(c=>en.mergeArray(n,c));let s=r.data.map((c,l)=>o.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 O7=i(e=>t=>new wr({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function Ou(e){if(e instanceof wr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=yi.create(Ou(n))}return new wr({...e._def,shape:()=>t})}else return e instanceof Gn?Gn.create(Ou(e.element)):e instanceof yi?yi.create(Ou(e.unwrap())):e instanceof jo?jo.create(Ou(e.unwrap())):e instanceof vi?vi.create(e.items.map(t=>Ou(t))):e}i(Ou,"deepPartialify");var wr=class extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=O7(this._def),this.extend=O7(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:o}=this._processInputParams(t),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof Hi&&this._def.unknownKeys==="strip"))for(let p in o.data)c.includes(p)||l.push(p);let h=[];for(let p of c){let g=s[p],v=o.data[p];h.push({key:{status:"valid",value:p},value:g._parse(new gi(o,v,o.path,p)),alwaysSet:p in o.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:o.data[g]}});else if(p==="strict")l.length>0&&(vt(o,{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=o.data[g];h.push({key:{status:"valid",value:g},value:p._parse(new gi(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.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 wr({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var o,s,c,l;let h=(c=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,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 wr({...this._def,unknownKeys:"strip"})}passthrough(){return new wr({...this._def,unknownKeys:"passthrough"})}setKey(t,r){return this.augment({[t]:r})}merge(t){return new wr({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>d0.mergeShapes(this._def.shape(),t._def.shape()),typeName:xt.ZodObject})}catchall(t){return new wr({...this._def,catchall:t})}pick(t){let r={};return rr.objectKeys(t).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new wr({...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 wr({...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 wr({...this._def,shape:()=>r});for(let n in this.shape){let o=this.shape[n];r[n]=o.optional()}return new wr({...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 wr({...this._def,shape:()=>r})}keyof(){return L7(rr.objectKeys(this.shape))}};i(wr,"ZodObject");wr.create=(e,t)=>new wr({shape:()=>e,unknownKeys:"strip",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});wr.strictCreate=(e,t)=>new wr({shape:()=>e,unknownKeys:"strict",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});wr.lazycreate=(e,t)=>new wr({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 o(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(o,"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(o);{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 os?s0(e.schema):e instanceof Wn?s0(e.innerType()):e instanceof as?[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,o=r.data[n],s=this.optionsMap.get(o);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 o=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(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,s)}}return new uc({typeName:xt.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Vt(n)})}};i(uc,"ZodDiscriminatedUnion");function Ry(e,t){let r=Ya(e),n=Ya(t);if(e===t)return{valid:!0,data:e};if(r===tt.object&&n===tt.object){let o=rr.objectKeys(t),s=rr.objectKeys(e).filter(l=>o.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=Ry(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 o=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=Ry(c,l);if(!h.valid)return{valid:!1};o.push(h.data)}return{valid:!0,data:o}}else return r===tt.date&&n===tt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Ry,"mergeValues");var ns=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=i((s,c)=>{if(ky(s)||ky(c))return Dt;let l=Ry(s.value,c.value);return l.valid?((Dy(s)||Dy(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])=>o(s,c)):o(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 o=[],s=this._def.keyType,c=this._def.valueType;for(let l in n.data)o.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,o):en.mergeObjectSync(r,o)}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 o=this._def.keyType,s=this._def.valueType,c=[...n.data.entries()].map(([l,h],p)=>({key:o._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 Fo=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 o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(vt(n,{code:Ke.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(vt(n,{code:Ke.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.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 Fo({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Fo({...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(Fo,"ZodSet");Fo.create=(e,t)=>new Fo({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Vt(t)});var ba=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 o(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(o,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},c=r.data;return this._def.returns instanceof wa?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(o(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([o(p,g.error)]);return g.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new ba({...this._def,args:vi.create(t).rest(Uo.create())})}returns(t){return new ba({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new ba({args:t||vi.create([]).rest(Uo.create()),returns:r||Uo.create(),typeName:xt.ZodFunction,...Vt(n)})}};i(ba,"ZodFunction");var os=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(os,"ZodLazy");os.create=(e,t)=>new os({getter:e,typeName:xt.ZodLazy,...Vt(t)});var as=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(as,"ZodLiteral");as.create=(e,t)=>new as({value:e,typeName:xt.ZodLiteral,...Vt(t)});function L7(e,t){return new ss({values:e,typeName:xt.ZodEnum,...Vt(t)})}i(L7,"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=L7;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 o=rr.objectValues(r);return vt(n,{expected:rr.joinValues(o),received:n.parsedType,code:Ke.invalid_type}),Dt}if(r.indexOf(t.data)===-1){let o=rr.objectValues(r);return vt(n,{received:n.data,code:Ke.invalid_enum_value,options:o}),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 wa=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(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(wa,"ZodPromise");wa.create=(e,t)=>new wa({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),o=this._def.effect||null;if(o.type==="preprocess"){let c=o.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),o.type==="refinement"){let c=i(l=>{let h=o.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(o.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=o.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(o.transform(c.value,s)).then(l=>({status:r.value,value:l})):c);rr.assertNever(o)}};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 jo=class extends Bt{_parse(t){return this._getType(t)===tt.null?Sn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(jo,"ZodNullable");jo.create=(e,t)=>new jo({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(o=>({status:"valid",value:o.status==="valid"?o.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 SU=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(),B7(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Dt:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new ls({in:t,out:r,typeName:xt.ZodPipeline})}};i(ls,"ZodPipeline");var U7=i((e,t={},r)=>e?ya.create().superRefine((n,o)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...c,fatal:r})}}):ya.create(),"custom"),xU={object:wr.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 TU=i((e,t={message:`Input not instance of ${e.name}`})=>U7(r=>r instanceof e,t,!0),"instanceOfType"),F7=zi.create,j7=ao.create,CU=dc.create,MU=Xa.create,$7=Qa.create,IU=Lo.create,kU=sc.create,DU=es.create,RU=ts.create,OU=ya.create,NU=Uo.create,PU=Hi.create,BU=cc.create,LU=Gn.create,UU=wr.create,FU=wr.strictCreate,jU=rs.create,$U=uc.create,zU=ns.create,HU=vi.create,qU=is.create,VU=lc.create,KU=Fo.create,GU=ba.create,WU=os.create,JU=as.create,ZU=ss.create,YU=cs.create,XU=wa.create,N7=Wn.create,QU=yi.create,eF=jo.create,tF=Wn.createWithPreprocess,rF=ls.create,nF=i(()=>F7().optional(),"ostring"),iF=i(()=>j7().optional(),"onumber"),oF=i(()=>$7().optional(),"oboolean"),aF={string:e=>zi.create({...e,coerce:!0}),number:e=>ao.create({...e,coerce:!0}),boolean:e=>Qa.create({...e,coerce:!0}),bigint:e=>Xa.create({...e,coerce:!0}),date:e=>Lo.create({...e,coerce:!0})},sF=Dt,z=Object.freeze({__proto__:null,defaultErrorMap:Ff,setErrorMap:vU,getErrorMap:c0,makeIssue:u0,EMPTY_PATH:yU,addIssueToContext:vt,ParseStatus:en,INVALID:Dt,DIRTY:B7,OK:Sn,isAborted:ky,isDirty:Dy,isValid:l0,isAsync:f0,get util(){return rr},ZodParsedType:tt,getParsedType:Ya,ZodType:Bt,ZodString:zi,ZodNumber:ao,ZodBigInt:Xa,ZodBoolean:Qa,ZodDate:Lo,ZodSymbol:sc,ZodUndefined:es,ZodNull:ts,ZodAny:ya,ZodUnknown:Uo,ZodNever:Hi,ZodVoid:cc,ZodArray:Gn,get objectUtil(){return d0},ZodObject:wr,ZodUnion:rs,ZodDiscriminatedUnion:uc,ZodIntersection:ns,ZodTuple:vi,ZodRecord:is,ZodMap:lc,ZodSet:Fo,ZodFunction:ba,ZodLazy:os,ZodLiteral:as,ZodEnum:ss,ZodNativeEnum:cs,ZodPromise:wa,ZodEffects:Wn,ZodTransformer:Wn,ZodOptional:yi,ZodNullable:jo,ZodDefault:us,ZodCatch:fc,ZodNaN:dc,BRAND:SU,ZodBranded:Uf,ZodPipeline:ls,custom:U7,Schema:Bt,ZodSchema:Bt,late:xU,get ZodFirstPartyTypeKind(){return xt},coerce:aF,any:OU,array:LU,bigint:MU,boolean:$7,date:IU,discriminatedUnion:$U,effect:N7,enum:ZU,function:GU,instanceof:TU,intersection:zU,lazy:WU,literal:JU,map:VU,nan:CU,nativeEnum:YU,never:PU,null:RU,nullable:eF,number:j7,object:UU,oboolean:oF,onumber:iF,optional:QU,ostring:nF,pipeline:rF,preprocess:tF,promise:XU,record:qU,set:KU,strictObject:FU,string:F7,symbol:kU,transformer:N7,tuple:HU,undefined:DU,union:jU,unknown:NU,void:BU,NEVER:sF,ZodIssueCode:Ke,quotelessJson:gU,ZodError:$i});var cF=Object.defineProperty,uF=i((e,t)=>cF(e,"name",{value:t,configurable:!0}),"__name"),m0=z.array(z.string().or(z.record(z.any()))),RZ=z.object({type:z.string().optional(),narrative:z.string().optional()}),g0=z.string().or(z.object({id:z.string(),type:z.string(),caption:z.string().optional()})),lF=z.object({type:z.string().min(1).or(z.string().array().nonempty()),latitude:z.number(),longitude:z.number()}),fF=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:lF.optional()}),dF=z.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(z.string()),V7=z.object({type:z.string().min(1).or(z.string().array().nonempty()),identifier:z.string(),identifierType:dF}),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:g0.optional(),email:z.string().email().optional(),address:fF.optional(),otherIdentifier:V7.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())),Oy=z.object({id:z.string().optional()}).catchall(z.any()),hF=z.object({type:z.string(),id:z.string()}).catchall(z.any()),pF=z.object({id:z.string(),type:z.string()}).catchall(z.any()),mF=z.object({id:z.string(),type:z.string()}).catchall(z.any()),h0=z.object({"@context":m0,id:z.string().optional(),type:z.string().array().nonempty(),issuer:jf,issuanceDate:z.string(),expirationDate:z.string().optional(),credentialSubject:Oy.or(Oy.array()),credentialStatus:hF.optional(),credentialSchema:pF.array().optional(),refreshService:mF.optional()}).catchall(z.any()),$o=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()),p0=h0.extend({proof:$o.or($o.array())}),gF=z.object({"@context":m0,id:z.string().optional(),type:z.string().or(z.string().array().nonempty()),verifiableCredential:p0.or(p0.array()).optional(),holder:z.string().optional()}).catchall(z.any()),OZ=gF.extend({proof:$o.or($o.array())}),By=z.object({kty:z.string(),crv:z.string(),x:z.string(),y:z.string().optional(),n:z.string().optional(),d:z.string().optional()}),BZ=By.omit({d:!0}).extend({d:z.string()}),vF=z.object({alg:z.string(),iv:z.string(),tag:z.string(),epk:By.partial().optional(),kid:z.string().optional(),apv:z.string().optional(),apu:z.string().optional()}),yF=z.object({header:vF,encrypted_key:z.string()}),bF=z.object({protected:z.string(),iv:z.string(),ciphertext:z.string(),tag:z.string(),aad:z.string().optional(),recipients:yF.array().optional()}),hc=z.string().or(z.object({"@context":m0.optional(),id:z.string(),type:z.string(),controller:z.string(),publicKeyJwk:By.optional(),publicKeyBase58:z.string().optional(),blockChainAccountId:z.string().optional()}).catchall(z.any())),wF=z.object({id:z.string(),type:z.string().or(z.string().array().nonempty()),serviceEndpoint:z.any().or(z.any().array().nonempty())}).catchall(z.any()),LZ=z.object({"@context":m0,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:wF.array().optional(),proof:$o.or($o.array()).optional()}).catchall(z.any()),_F=z.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(z.string()),v0=z.object({type:z.string().array().nonempty(),targetCode:z.string().optional(),targetDescription:z.string().optional(),targetName:z.string(),targetFramework:z.string().optional(),targetType:_F.optional(),targetUrl:z.string()}),EF=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"]),AF=EF.or(z.string()),SF=z.object({id:z.string().optional(),narrative:z.string().optional()}).catchall(z.any()),xF=z.object({id:z.string(),type:z.string().array().nonempty(),endorsementComment:z.string().optional()}),TF=h0.extend({credentialSubject:xF,proof:$o.or($o.array()).optional()}),CF=z.object({id:z.string(),"@language":z.string().optional(),version:z.string().optional()}),MF=z.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(z.string()),IF=z.object({id:z.string(),type:z.string().array().nonempty(),alignment:v0.array().optional(),description:z.string().optional(),level:z.string().optional(),name:z.string(),points:z.string().optional()}).catchall(z.any()),kF=z.object({id:z.string(),type:z.string().array().nonempty(),alignment:v0.array().optional(),allowedValue:z.string().array().optional(),name:z.string(),requiredLevel:z.string().optional(),requiredValue:z.string().optional(),resultType:MF,rubricCriterionLevel:IF.array().optional(),valueMax:z.string().optional(),valueMin:z.string().optional()}).catchall(z.any()),DF=z.object({id:z.string().optional(),type:z.string().array().nonempty(),alignment:v0.array().optional(),achievementType:AF.optional(),creator:jf.optional(),creditsAvailable:z.number().optional(),criteria:SF,description:z.string(),endorsement:TF.array().optional(),fieldOfStudy:z.string().optional(),humanCode:z.string().optional(),image:g0.optional(),"@language":z.string().optional(),name:z.string(),otherIdentifier:V7.array().optional(),related:CF.array().optional(),resultDescription:kF.array().optional(),specialization:z.string().optional(),tag:z.string().array().optional(),version:z.string().optional()}).catchall(z.any()),RF=z.object({type:z.string(),hashed:z.boolean(),identityHash:z.string(),identityType:z.string(),salt:z.string().optional()}),OF=z.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),NF=z.object({type:z.string().array().nonempty(),achievedLevel:z.string().optional(),alignment:v0.array().optional(),resultDescription:z.string().optional(),status:OF.optional(),value:z.string().optional()}).catchall(z.any()),z7=z.object({id:z.string().optional(),type:z.string().array().nonempty(),activityEndDate:z.string().optional(),activityStartDate:z.string().optional(),creditsEarned:z.number().optional(),achievement:DF.optional(),identifier:RF.array().optional(),image:g0.optional(),licenseNumber:z.string().optional(),narrative:z.string().optional(),result:NF.array().optional(),role:z.string().optional(),source:jf.optional(),term:z.string().optional()}).catchall(z.any()),PF=z.object({id:z.string().optional(),type: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()),BF=h0.extend({name:z.string().optional(),description:z.string().optional(),image:g0.optional(),credentialSubject:z7.or(z7.array()),endorsement:h0.array().optional(),evidence:PF.array().optional()}),FZ=BF.extend({proof:$o.or($o.array())}),$Z=z.object({checks:z.string().array(),warnings:z.string().array(),errors:z.string().array()}),K7=z.enum(["Success","Failed","Error"]),zZ=K7.enum,HZ=z.object({check:z.string(),status:K7,message:z.string().optional(),details:z.string().optional()}),qZ=z.object({title:z.string().optional(),createdAt:z.string().optional(),issuer:jf.optional(),issuee:jf.optional(),credentialSubject:Oy.optional()}),mc=z.object({id:z.string(),uri:z.string()}).catchall(z.any()),GZ=z.object({limit:z.number(),cursor:z.string().optional(),sort:z.string().optional()}),Jn=z.object({cursor:z.string().optional(),hasMore:z.boolean()}),G7=z.object({encryptedRecord:bF,fields:z.string().array()}).catchall(z.any()),WZ=Jn.extend({records:G7.array()}),LF=G7.extend({id:z.string()}),JZ=Jn.extend({records:LF.array()}),H7=uF(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),UF=z.instanceof(RegExp).or(z.string().refine(e=>{try{return H7(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=H7(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),_r=z.string().or(z.object({$in:z.string().array()})).or(z.object({$regex:UF})),FF=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:FF.optional()}),XZ=z.object({profileId:_r,displayName:_r,shortBio:_r,bio:_r,email:_r,websiteLink:_r,isServiceProfile:z.boolean(),type:_r}).partial(),QZ=Jn.extend({records:pc.array()}),eY=z.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),W7=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()}),tY=Jn.extend({records:W7.extend({did:z.string()}).array()}),rY=z.object({id:_r,displayName:_r,shortBio:_r,bio:_r,email:_r}).partial(),nY=Jn.extend({records:z.object({profile:pc,manager:W7.extend({did:z.string()}).optional()}).array()}),iY=z.object({uri:z.string(),to:z.string(),from:z.string(),sent:z.string().datetime(),received:z.string().datetime().optional()}),J7=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()}),jF=z.object({role:_r,canEdit:z.boolean(),canIssue:z.boolean(),canRevoke:z.boolean(),canManagePermissions:z.boolean(),canIssueChildren:_r,canCreateChildren:_r,canEditChildren:_r,canRevokeChildren:_r,canManageChildrenPermissions:_r,canManageChildrenProfiles:z.boolean(),canViewAnalytics:z.boolean()}).partial(),q7=z.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),$F=z.discriminatedUnion("type",[z.object({type:z.literal(q7.Values.GRANT_PERMISSIONS),data:z.object({claimUri:z.string(),targetUri:z.string(),permissions:J7.partial()})}),z.object({type:z.literal(q7.Values.ADD_ADMIN),data:z.object({claimUri:z.string(),targetUri:z.string()})})]),oY=z.object({type:_r,data:z.object({claimUri:_r,targetUri:_r,permissions:jF})}).deepPartial(),zF=z.object({id:z.string(),createdAt:z.string(),updatedAt:z.string()}).and($F),aY=Jn.extend({records:zF.array()}),Ny=z.enum(["DRAFT","LIVE"]),HF=z.object({uri:z.string(),name:z.string().optional(),type:z.string().optional(),category:z.string().optional(),status:Ny.optional(),autoConnectRecipients:z.boolean().optional(),meta:z.record(z.any()).optional(),claimPermissions:J7.optional()}),sY=z.object({uri:_r,name:_r,type:_r,category:_r,meta:z.record(_r),status:Ny.or(z.object({$in:Ny.array()})),autoConnectRecipients:z.boolean()}).partial(),cY=Jn.extend({records:HF.array()}),qF=z.object({to:pc,from:z.string(),received:z.string().optional(),uri:z.string().optional()}),uY=Jn.extend({records:qF.array()}),lY=z.object({endpoint:z.string(),name:z.string(),did:z.string().optional()}),fY=z.object({ttlSeconds:z.number().optional(),totalUses:z.number().optional()}),VF=z.object({endpoint:z.string()}),dY=z.object({signingAuthority:VF,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()})}),hY=z.object({boostUri:z.string(),signingAuthority:z.object({endpoint:z.string(),name:z.string()})}),KF=z.enum(["live","stale","withdrawn"]),GF=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({})}),Z7=z.object({contract:GF,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()}),pY=Jn.extend({records:Z7.omit({owner:!0}).array()}),WF=z.object({credentials:z.object({categories:z.record(z.string().array()).default({})}),personal:z.record(z.string()).default({}),date:z.string()}),mY=Jn.extend({records:WF.array()}),JF=z.object({credentials:z.object({category:z.string(),uri:z.string()}).array(),personal:z.record(z.string()).default({}),date:z.string(),contractUri:z.string()}),gY=Jn.extend({records:JF.array()}),Y7=z.object({sharing:z.boolean().optional(),shared:z.string().array().optional(),shareAll:z.boolean().optional(),shareUntil:z.string().optional()}),X7=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({shareAll:z.boolean().optional(),sharing:z.boolean().optional(),categories:z.record(Y7).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({})}),vY=Jn.extend({records:z.object({expiresAt:z.string().optional(),oneTime:z.boolean().optional(),terms:X7,contract:Z7,uri:z.string(),consenter:pc,status:KF}).array()}),yY=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()}),bY=z.object({anonymize:z.boolean().optional(),credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional()}),wY=z.object({credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional(),id:_r.optional()}),ZF=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({shareAll:z.boolean().optional(),sharing:z.boolean().optional(),categories:z.record(Y7.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()}),Py=z.enum(["consent","update","sync","withdraw","write"]),_Y=z.object({terms:ZF.optional(),action:Py.or(Py.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()}),Q7=z.object({expiresAt:z.string().optional(),oneTime:z.boolean().optional(),terms:X7.optional(),id:z.string(),action:Py,date:z.string(),uris:z.string().array().optional()}),EY=Jn.extend({records:Q7.array()}),YF=z.object({credentialUri:z.string(),termsUri:z.string(),contractUri:z.string(),boostUri:z.string(),category:z.string().optional(),date:z.string()}),AY=Jn.extend({records:YF.array()}),XF=z.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),QF=z.object({title:z.string().optional(),body:z.string().optional()}),ej=z.object({vcUris:z.array(z.string()).optional(),vpUris:z.array(z.string()).optional(),transaction:Q7.optional()}),SY=z.object({type:XF,to:pc.partial().and(z.object({did:z.string()})),from:pc.partial().and(z.object({did:z.string()})),message:QF.optional(),data:ej.optional(),sent:z.string().datetime().optional()});var tj=Object.create,bd=Object.defineProperty,rj=Object.getOwnPropertyDescriptor,u6=Object.getOwnPropertyNames,nj=Object.getPrototypeOf,ij=Object.prototype.hasOwnProperty,a=i((e,t)=>bd(e,"name",{value:t,configurable:!0}),"__name"),lb=(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')}),pr=i((e,t)=>i(function(){return e&&(t=(0,e[u6(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[u6(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"),yS=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of u6(t))!ij.call(e,o)&&o!==r&&bd(e,o,{get:()=>t[o],enumerable:!(n=rj(t,o))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?tj(nj(e)):{},yS(t||!e||!e.__esModule?bd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),Ly=i(e=>yS(bd({},"__esModule",{value:!0}),e),"__toCommonJS"),oj=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",o=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,H=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,q=A>>>1,I=[["ary",k],["bind",D],["bindKey",P],["curry",j],["curryRight",H],["flip",he],["partial",Q],["partialRight",Y],["rearg",K]],U="[object Arguments]",ge="[object Array]",L="[object AsyncFunction]",ne="[object Boolean]",ae="[object Date]",M="[object DOMException]",G="[object Error]",oe="[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,ar=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,it=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(Qt.source),et=/^\s+/,sr=/\s/,at=/\{(?:\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,on=/^(?:0|[1-9]\d*)$/,Nr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vr=/($^)/,an=/['\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",ea="A-Z\\xc0-\\xd6\\xd8-\\xde",ta="\\ufe0e\\ufe0f",ra=Un+ki+Di+Ri,Pa="['\u2019]",Pd="["+Cn+"]",_l="["+ra+"]",ks="["+Ln+"]",El="\\d+",Bd="["+pn+"]",Al="["+ri+"]",Sl="[^"+Cn+ra+El+pn+ri+ea+"]",Ds="\\ud83c[\\udffb-\\udfff]",Ld="(?:"+ks+"|"+Ds+")",xl="[^"+Cn+"]",na="(?:\\ud83c[\\udde6-\\uddff]){2}",Zi="[\\ud800-\\udbff][\\udc00-\\udfff]",ia="["+ea+"]",wo="\\u200d",Tl="(?:"+Al+"|"+Sl+")",Ud="(?:"+ia+"|"+Sl+")",Cl="(?:"+Pa+"(?:d|ll|m|re|s|t|ve))?",Ml="(?:"+Pa+"(?:D|LL|M|RE|S|T|VE))?",Il=Ld+"?",kl="["+ta+"]?",Dl="(?:"+wo+"(?:"+[xl,na,Zi].join("|")+")"+kl+Il+")*",_o="\\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,na,Zi].join("|")+")"+qc,Rl="(?:"+[xl+ks+"?",ks,na,Zi,Pd].join("|")+")",Ol=RegExp(Pa,"g"),$d=RegExp(ks,"g"),Nl=RegExp(Ds+"(?="+Ds+")|"+Rl+qc,"g"),Pl=RegExp([ia+"?"+Al+"+"+Cl+"(?="+[_l,ia,"$"].join("|")+")",Ud+"+"+Ml+"(?="+[_l,ia+Tl,"$"].join("|")+")",ia+"?"+Tl+"+"+Cl,ia+"+"+Ml,Fd,_o,El,jd].join("|"),"g"),zd=RegExp("["+wo+Cn+Ln+ta+"]"),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,yr={};yr[pe]=yr[re]=yr[le]=yr[_e]=yr[Te]=yr[Ce]=yr[Oe]=yr[Ct]=yr[Ve]=!0,yr[U]=yr[ge]=yr[qe]=yr[ne]=yr[ve]=yr[ae]=yr[G]=yr[oe]=yr[be]=yr[Re]=yr[N]=yr[ie]=yr[ee]=yr[ue]=yr[Ie]=!1;var mr={};mr[U]=mr[ge]=mr[qe]=mr[ve]=mr[ne]=mr[ae]=mr[pe]=mr[re]=mr[le]=mr[_e]=mr[Te]=mr[be]=mr[Re]=mr[N]=mr[ie]=mr[ee]=mr[ue]=mr[Ae]=mr[Ce]=mr[Oe]=mr[Ct]=mr[Ve]=!0,mr[G]=mr[oe]=mr[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={"&":"&","<":"<",">":">",'"':""","'":"'"},Le={"&":"&","<":"<",">":">",""":'"',"'":"'"},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")(),Eo=typeof e=="object"&&e&&!e.nodeType&&e,Ao=Eo&&typeof t=="object"&&t&&!t.nodeType&&t,Bl=Ao&&Ao.exports===Eo,Kc=Bl&&Mn.process,gn=function(){try{var Se=Ao&&Ao.require&&Ao.require("util").types;return Se||Kc&&Kc.binding&&Kc.binding("util")}catch{}}(),Os=gn&&gn.isArrayBuffer,q2=gn&&gn.isDate,V2=gn&&gn.isMap,K2=gn&&gn.isRegExp,G2=gn&&gn.isSet,W2=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"),a(Fn,"apply");function J2(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(J2,"arrayAggregator"),a(J2,"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"),a(ni,"arrayEach");function Z2(Se,Pe){for(var ke=Se==null?0:Se.length;ke--&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(Z2,"arrayEachRight"),a(Z2,"arrayEachRight");function n1(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(n1,"arrayEvery"),a(n1,"arrayEvery");function oa(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(oa,"arrayFilter"),a(oa,"arrayFilter");function Ll(Se,Pe){var ke=Se==null?0:Se.length;return!!ke&&Ns(Se,Pe,0)>-1}i(Ll,"arrayIncludes"),a(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"),a(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"),a(Mr,"arrayMap");function aa(Se,Pe){for(var ke=-1,ft=Pe.length,kt=Se.length;++ke<ft;)Se[kt+ke]=Pe[ke];return Se}i(aa,"arrayPush"),a(aa,"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"),a(Vd,"arrayReduce");function Y2(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(Y2,"arrayReduceRight"),a(Y2,"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"),a(Kd,"arraySome");var eD=Gd("length");function X2(Se){return Se.split("")}i(X2,"asciiToArray"),a(X2,"asciiToArray");function Q2(Se){return Se.match(st)||[]}i(Q2,"asciiWords"),a(Q2,"asciiWords");function i1(Se,Pe,ke){var ft;return ke(Se,function(kt,fr,Wr){if(Pe(kt,fr,Wr))return ft=fr,!1}),ft}i(i1,"baseFindKey"),a(i1,"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"),a(Ul,"baseFindIndex");function Ns(Se,Pe,ke){return Pe===Pe?u3(Se,Pe,ke):Ul(Se,o1,ke)}i(Ns,"baseIndexOf"),a(Ns,"baseIndexOf");function e3(Se,Pe,ke,ft){for(var kt=ke-1,fr=Se.length;++kt<fr;)if(ft(Se[kt],Pe))return kt;return-1}i(e3,"baseIndexOfWith"),a(e3,"baseIndexOfWith");function o1(Se){return Se!==Se}i(o1,"baseIsNaN"),a(o1,"baseIsNaN");function a1(Se,Pe){var ke=Se==null?0:Se.length;return ke?Jd(Se,Pe)/ke:C}i(a1,"baseMean"),a(a1,"baseMean");function Gd(Se){return function(Pe){return Pe==null?r:Pe[Se]}}i(Gd,"baseProperty"),a(Gd,"baseProperty");function Wd(Se){return function(Pe){return Se==null?r:Se[Pe]}}i(Wd,"basePropertyOf"),a(Wd,"basePropertyOf");function s1(Se,Pe,ke,ft,kt){return kt(Se,function(fr,Wr,br){ke=ft?(ft=!1,fr):Pe(ke,fr,Wr,br)}),ke}i(s1,"baseReduce"),a(s1,"baseReduce");function t3(Se,Pe){var ke=Se.length;for(Se.sort(Pe);ke--;)Se[ke]=Se[ke].value;return Se}i(t3,"baseSortBy"),a(t3,"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"),a(Jd,"baseSum");function Zd(Se,Pe){for(var ke=-1,ft=Array(Se);++ke<Se;)ft[ke]=Pe(ke);return ft}i(Zd,"baseTimes"),a(Zd,"baseTimes");function r3(Se,Pe){return Mr(Pe,function(ke){return[ke,Se[ke]]})}i(r3,"baseToPairs"),a(r3,"baseToPairs");function c1(Se){return Se&&Se.slice(0,d1(Se)+1).replace(et,"")}i(c1,"baseTrim"),a(c1,"baseTrim");function jn(Se){return function(Pe){return Se(Pe)}}i(jn,"baseUnary"),a(jn,"baseUnary");function Yd(Se,Pe){return Mr(Pe,function(ke){return Se[ke]})}i(Yd,"baseValues"),a(Yd,"baseValues");function Gc(Se,Pe){return Se.has(Pe)}i(Gc,"cacheHas"),a(Gc,"cacheHas");function u1(Se,Pe){for(var ke=-1,ft=Se.length;++ke<ft&&Ns(Pe,Se[ke],0)>-1;);return ke}i(u1,"charsStartIndex"),a(u1,"charsStartIndex");function l1(Se,Pe){for(var ke=Se.length;ke--&&Ns(Pe,Se[ke],0)>-1;);return ke}i(l1,"charsEndIndex"),a(l1,"charsEndIndex");function n3(Se,Pe){for(var ke=Se.length,ft=0;ke--;)Se[ke]===Pe&&++ft;return ft}i(n3,"countHolders"),a(n3,"countHolders");var tD=Wd(de),rD=Wd(Me);function i3(Se){return"\\"+ht[Se]}i(i3,"escapeStringChar"),a(i3,"escapeStringChar");function o3(Se,Pe){return Se==null?r:Se[Pe]}i(o3,"getValue"),a(o3,"getValue");function Ps(Se){return zd.test(Se)}i(Ps,"hasUnicode"),a(Ps,"hasUnicode");function a3(Se){return Rs.test(Se)}i(a3,"hasUnicodeWord"),a(a3,"hasUnicodeWord");function s3(Se){for(var Pe,ke=[];!(Pe=Se.next()).done;)ke.push(Pe.value);return ke}i(s3,"iteratorToArray"),a(s3,"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"),a(Xd,"mapToArray");function f1(Se,Pe){return function(ke){return Se(Pe(ke))}}i(f1,"overArg"),a(f1,"overArg");function sa(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(sa,"replaceHolders"),a(sa,"replaceHolders");function Fl(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Pe]=ft}),ke}i(Fl,"setToArray"),a(Fl,"setToArray");function c3(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Pe]=[ft,ft]}),ke}i(c3,"setToPairs"),a(c3,"setToPairs");function u3(Se,Pe,ke){for(var ft=ke-1,kt=Se.length;++ft<kt;)if(Se[ft]===Pe)return ft;return-1}i(u3,"strictIndexOf"),a(u3,"strictIndexOf");function l3(Se,Pe,ke){for(var ft=ke+1;ft--;)if(Se[ft]===Pe)return ft;return ft}i(l3,"strictLastIndexOf"),a(l3,"strictLastIndexOf");function Bs(Se){return Ps(Se)?f3(Se):eD(Se)}i(Bs,"stringSize"),a(Bs,"stringSize");function Oi(Se){return Ps(Se)?d3(Se):X2(Se)}i(Oi,"stringToArray"),a(Oi,"stringToArray");function d1(Se){for(var Pe=Se.length;Pe--&&sr.test(Se.charAt(Pe)););return Pe}i(d1,"trimmedEndIndex"),a(d1,"trimmedEndIndex");var nD=Wd(Le);function f3(Se){for(var Pe=Nl.lastIndex=0;Nl.test(Se);)++Pe;return Pe}i(f3,"unicodeSize"),a(f3,"unicodeSize");function d3(Se){return Se.match(Nl)||[]}i(d3,"unicodeToArray"),a(d3,"unicodeToArray");function h3(Se){return Se.match(Pl)||[]}i(h3,"unicodeWords"),a(h3,"unicodeWords");var iD=a(i(function Se(Pe){Pe=Pe==null?Fr:Ba.defaults(Fr.Object(),Pe,Ba.pick(Fr,Hd));var ke=Pe.Array,ft=Pe.Date,kt=Pe.Error,fr=Pe.Function,Wr=Pe.Math,br=Pe.Object,h1=Pe.RegExp,oD=Pe.String,Ni=Pe.TypeError,Qd=ke.prototype,aD=fr.prototype,Wc=br.prototype,eh=Pe["__core-js_shared__"],th=aD.toString,gr=Wc.hasOwnProperty,sD=0,p3=function(){var u=/[^.]+$/.exec(eh&&eh.keys&&eh.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),rh=Wc.toString,cD=th.call(br),uD=Fr._,lD=h1("^"+th.call(gr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nh=Bl?Pe.Buffer:r,La=Pe.Symbol,ih=Pe.Uint8Array,m3=nh?nh.allocUnsafe:r,oh=f1(br.getPrototypeOf,br),g3=br.create,v3=Wc.propertyIsEnumerable,ah=Qd.splice,y3=La?La.isConcatSpreadable:r,jl=La?La.iterator:r,Ls=La?La.toStringTag:r,sh=function(){try{var u=Ha(br,"defineProperty");return u({},"",{}),u}catch{}}(),fD=Pe.clearTimeout!==Fr.clearTimeout&&Pe.clearTimeout,dD=ft&&ft.now!==Fr.Date.now&&ft.now,hD=Pe.setTimeout!==Fr.setTimeout&&Pe.setTimeout,ch=Wr.ceil,uh=Wr.floor,p1=br.getOwnPropertySymbols,pD=nh?nh.isBuffer:r,b3=Pe.isFinite,mD=Qd.join,gD=f1(br.keys,br),Jr=Wr.max,vn=Wr.min,vD=ft.now,yD=Pe.parseInt,w3=Wr.random,bD=Qd.reverse,m1=Ha(Pe,"DataView"),$l=Ha(Pe,"Map"),g1=Ha(Pe,"Promise"),Jc=Ha(Pe,"Set"),zl=Ha(Pe,"WeakMap"),Hl=Ha(br,"create"),lh=zl&&new zl,Zc={},wD=qa(m1),_D=qa($l),ED=qa(g1),AD=qa(Jc),SD=qa(zl),fh=La?La.prototype:r,ql=fh?fh.valueOf:r,_3=fh?fh.toString:r;function se(u){if(Rr(u)&&!Nt(u)&&!(u instanceof Kt)){if(u instanceof ii)return u;if(gr.call(u,"__wrapped__"))return pg(u)}return new ii(u)}i(se,"lodash"),a(se,"lodash");var Yc=function(){function u(){}return i(u,"object"),a(u,"object"),function(d){if(!kr(d))return{};if(g3)return g3(d);u.prototype=d;var S=new u;return u.prototype=r,S}}();function Vl(){}i(Vl,"baseLodash"),a(Vl,"baseLodash");function ii(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=r}i(ii,"LodashWrapper"),a(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"),a(Kt,"LazyWrapper");function E3(){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(E3,"lazyClone"),a(E3,"lazyClone");function A3(){if(this.__filtered__){var u=new Kt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(A3,"lazyReverse"),a(A3,"lazyReverse");function S3(){var u=this.__wrapped__.value(),d=this.__dir__,S=Nt(u),$=d<0,te=S?u.length:0,ce=U5(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 U1(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(S3,"lazyValue"),a(S3,"lazyValue"),Kt.prototype=Yc(Vl.prototype),Kt.prototype.constructor=Kt;function Ua(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(Ua,"Hash"),a(Ua,"Hash");function x3(){this.__data__=Hl?Hl(null):{},this.size=0}i(x3,"hashClear"),a(x3,"hashClear");function T3(u){var d=this.has(u)&&delete this.__data__[u];return this.size-=d?1:0,d}i(T3,"hashDelete"),a(T3,"hashDelete");function C3(u){var d=this.__data__;if(Hl){var S=d[u];return S===h?r:S}return gr.call(d,u)?d[u]:r}i(C3,"hashGet"),a(C3,"hashGet");function M3(u){var d=this.__data__;return Hl?d[u]!==r:gr.call(d,u)}i(M3,"hashHas"),a(M3,"hashHas");function I3(u,d){var S=this.__data__;return this.size+=this.has(u)?0:1,S[u]=Hl&&d===r?h:d,this}i(I3,"hashSet"),a(I3,"hashSet"),Ua.prototype.clear=x3,Ua.prototype.delete=T3,Ua.prototype.get=C3,Ua.prototype.has=M3,Ua.prototype.set=I3;function So(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(So,"ListCache"),a(So,"ListCache");function k3(){this.__data__=[],this.size=0}i(k3,"listCacheClear"),a(k3,"listCacheClear");function D3(u){var d=this.__data__,S=Kl(d,u);if(S<0)return!1;var $=d.length-1;return S==$?d.pop():ah.call(d,S,1),--this.size,!0}i(D3,"listCacheDelete"),a(D3,"listCacheDelete");function R3(u){var d=this.__data__,S=Kl(d,u);return S<0?r:d[S][1]}i(R3,"listCacheGet"),a(R3,"listCacheGet");function O3(u){return Kl(this.__data__,u)>-1}i(O3,"listCacheHas"),a(O3,"listCacheHas");function N3(u,d){var S=this.__data__,$=Kl(S,u);return $<0?(++this.size,S.push([u,d])):S[$][1]=d,this}i(N3,"listCacheSet"),a(N3,"listCacheSet"),So.prototype.clear=k3,So.prototype.delete=D3,So.prototype.get=R3,So.prototype.has=O3,So.prototype.set=N3;function xo(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(xo,"MapCache"),a(xo,"MapCache");function P3(){this.size=0,this.__data__={hash:new Ua,map:new($l||So),string:new Ua}}i(P3,"mapCacheClear"),a(P3,"mapCacheClear");function B3(u){var d=of(this,u).delete(u);return this.size-=d?1:0,d}i(B3,"mapCacheDelete"),a(B3,"mapCacheDelete");function L3(u){return of(this,u).get(u)}i(L3,"mapCacheGet"),a(L3,"mapCacheGet");function U3(u){return of(this,u).has(u)}i(U3,"mapCacheHas"),a(U3,"mapCacheHas");function F3(u,d){var S=of(this,u),$=S.size;return S.set(u,d),this.size+=S.size==$?0:1,this}i(F3,"mapCacheSet"),a(F3,"mapCacheSet"),xo.prototype.clear=P3,xo.prototype.delete=B3,xo.prototype.get=L3,xo.prototype.has=U3,xo.prototype.set=F3;function Fa(u){var d=-1,S=u==null?0:u.length;for(this.__data__=new xo;++d<S;)this.add(u[d])}i(Fa,"SetCache"),a(Fa,"SetCache");function j3(u){return this.__data__.set(u,h),this}i(j3,"setCacheAdd"),a(j3,"setCacheAdd");function $3(u){return this.__data__.has(u)}i($3,"setCacheHas"),a($3,"setCacheHas"),Fa.prototype.add=Fa.prototype.push=j3,Fa.prototype.has=$3;function Pi(u){var d=this.__data__=new So(u);this.size=d.size}i(Pi,"Stack"),a(Pi,"Stack");function z3(){this.__data__=new So,this.size=0}i(z3,"stackClear"),a(z3,"stackClear");function H3(u){var d=this.__data__,S=d.delete(u);return this.size=d.size,S}i(H3,"stackDelete"),a(H3,"stackDelete");function q3(u){return this.__data__.get(u)}i(q3,"stackGet"),a(q3,"stackGet");function V3(u){return this.__data__.has(u)}i(V3,"stackHas"),a(V3,"stackHas");function K3(u,d){var S=this.__data__;if(S instanceof So){var $=S.__data__;if(!$l||$.length<o-1)return $.push([u,d]),this.size=++S.size,this;S=this.__data__=new xo($)}return S.set(u,d),this.size=S.size,this}i(K3,"stackSet"),a(K3,"stackSet"),Pi.prototype.clear=z3,Pi.prototype.delete=H3,Pi.prototype.get=q3,Pi.prototype.has=V3,Pi.prototype.set=K3;function v1(u,d){var S=Nt(u),$=!S&&$s(u),te=!S&&!$&&Va(u),ce=!S&&!$&&!te&&au(u),ye=S||$||te||ce,Ee=ye?Zd(u.length,oD):[],xe=Ee.length;for(var Ue in u)(d||gr.call(u,Ue))&&!(ye&&(Ue=="length"||te&&(Ue=="offset"||Ue=="parent")||ce&&(Ue=="buffer"||Ue=="byteLength"||Ue=="byteOffset")||Io(Ue,xe)))&&Ee.push(Ue);return Ee}i(v1,"arrayLikeKeys"),a(v1,"arrayLikeKeys");function y1(u){var d=u.length;return d?u[_h(0,d-1)]:r}i(y1,"arraySample"),a(y1,"arraySample");function G3(u,d){return sf(In(u),ja(d,0,u.length))}i(G3,"arraySampleSize"),a(G3,"arraySampleSize");function W3(u){return sf(In(u))}i(W3,"arrayShuffle"),a(W3,"arrayShuffle");function dh(u,d,S){(S!==r&&!Bi(u[d],S)||S===r&&!(d in u))&&To(u,d,S)}i(dh,"assignMergeValue"),a(dh,"assignMergeValue");function Xc(u,d,S){var $=u[d];(!(gr.call(u,d)&&Bi($,S))||S===r&&!(d in u))&&To(u,d,S)}i(Xc,"assignValue"),a(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"),a(Kl,"assocIndexOf");function J3(u,d,S,$){return $a(u,function(te,ce,ye){d($,te,S(te),ye)}),$}i(J3,"baseAggregator"),a(J3,"baseAggregator");function b1(u,d){return u&&Xi(d,Zr(d),u)}i(b1,"baseAssign"),a(b1,"baseAssign");function Z3(u,d){return u&&Xi(d,Dn(d),u)}i(Z3,"baseAssignIn"),a(Z3,"baseAssignIn");function To(u,d,S){d=="__proto__"&&sh?sh(u,d,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[d]=S}i(To,"baseAssignValue"),a(To,"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"),a(hh,"baseAt");function ja(u,d,S){return u===u&&(S!==r&&(u=u<=S?u:S),d!==r&&(u=u>=d?u:d)),u}i(ja,"baseClamp"),a(ja,"baseClamp");function oi(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=j5(u),!Ee)return In(u,ye)}else{var $e=bn(u),Ye=$e==oe||$e==fe;if(Va(u))return j1(u,Ee);if($e==N||$e==U||Ye&&!te){if(ye=xe||Ye?{}:ag(u),!Ee)return xe?I5(u,Z3(ye,u)):M5(u,b1(ye,u))}else{if(!mr[$e])return te?u:{};ye=$5(u,$e,Ee)}}ce||(ce=new Pi);var pt=ce.get(u);if(pt)return pt;ce.set(u,ye),L4(u)?u.forEach(function(_t){ye.add(oi(_t,d,S,_t,u,ce))}):I4(u)&&u.forEach(function(_t,Ht){ye.set(Ht,oi(_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,oi(_t,d,S,Ht,u,ce))}),ye}i(oi,"baseClone"),a(oi,"baseClone");function Y3(u){var d=Zr(u);return function(S){return w1(S,u,d)}}i(Y3,"baseConforms"),a(Y3,"baseConforms");function w1(u,d,S){var $=S.length;if(u==null)return!$;for(u=br(u);$--;){var te=S[$],ce=d[te],ye=u[te];if(ye===r&&!(te in u)||!ce(ye))return!1}return!0}i(w1,"baseConformsTo"),a(w1,"baseConformsTo");function _1(u,d,S){if(typeof u!="function")throw new Ni(c);return af(function(){u.apply(r,S)},d)}i(_1,"baseDelay"),a(_1,"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>=o&&(ce=Gc,ye=!1,d=new Fa(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"),a(Qc,"baseDifference");var $a=V1(Yi),X3=V1(ph,!0);function Q3(u,d){var S=!0;return $a(u,function($,te,ce){return S=!!d($,te,ce),S}),S}i(Q3,"baseEvery"),a(Q3,"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"),a(Gl,"baseExtremum");function e5(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:Pg($);S<$;)u[S++]=d;return u}i(e5,"baseFill"),a(e5,"baseFill");function E1(u,d){var S=[];return $a(u,function($,te,ce){d($,te,ce)&&S.push($)}),S}i(E1,"baseFilter"),a(E1,"baseFilter");function Xr(u,d,S,$,te){var ce=-1,ye=u.length;for(S||(S=H5),te||(te=[]);++ce<ye;){var Ee=u[ce];d>0&&S(Ee)?d>1?Xr(Ee,d-1,S,$,te):aa(te,Ee):$||(te[te.length]=Ee)}return te}i(Xr,"baseFlatten"),a(Xr,"baseFlatten");var A1=K1(),t5=K1(!0);function Yi(u,d){return u&&A1(u,d,Zr)}i(Yi,"baseForOwn"),a(Yi,"baseForOwn");function ph(u,d){return u&&t5(u,d,Zr)}i(ph,"baseForOwnRight"),a(ph,"baseForOwnRight");function Wl(u,d){return oa(d,function(S){return ko(u[S])})}i(Wl,"baseFunctions"),a(Wl,"baseFunctions");function za(u,d){d=ua(d,u);for(var S=0,$=d.length;u!=null&&S<$;)u=u[Qi(d[S++])];return S&&S==$?u:r}i(za,"baseGet"),a(za,"baseGet");function S1(u,d,S){var $=d(u);return Nt(u)?$:aa($,S(u))}i(S1,"baseGetAllKeys"),a(S1,"baseGetAllKeys");function yn(u){return u==null?u===r?De:X:Ls&&Ls in br(u)?B5(u):J5(u)}i(yn,"baseGetTag"),a(yn,"baseGetTag");function mh(u,d){return u>d}i(mh,"baseGt"),a(mh,"baseGt");function r5(u,d){return u!=null&&gr.call(u,d)}i(r5,"baseHas"),a(r5,"baseHas");function n5(u,d){return u!=null&&d in br(u)}i(n5,"baseHasIn"),a(n5,"baseHasIn");function i5(u,d,S){return u>=vn(d,S)&&u<Jr(d,S)}i(i5,"baseInRange"),a(i5,"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 Fa(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"),a(gh,"baseIntersection");function o5(u,d,S,$){return Yi(u,function(te,ce,ye){d($,S(te),ce,ye)}),$}i(o5,"baseInverter"),a(o5,"baseInverter");function eu(u,d,S){d=ua(d,u),u=lg(u,d);var $=u==null?u:u[Qi(si(d))];return $==null?r:Fn($,u,S)}i(eu,"baseInvoke"),a(eu,"baseInvoke");function x1(u){return Rr(u)&&yn(u)==U}i(x1,"baseIsArguments"),a(x1,"baseIsArguments");function a5(u){return Rr(u)&&yn(u)==qe}i(a5,"baseIsArrayBuffer"),a(a5,"baseIsArrayBuffer");function s5(u){return Rr(u)&&yn(u)==ae}i(s5,"baseIsDate"),a(s5,"baseIsDate");function tu(u,d,S,$,te){return u===d?!0:u==null||d==null||!Rr(u)&&!Rr(d)?u!==u&&d!==d:c5(u,d,S,$,tu,te)}i(tu,"baseIsEqual"),a(tu,"baseIsEqual");function c5(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&&Va(u)){if(!Va(d))return!1;ye=!0,Fe=!1}if(Ye&&!Fe)return ce||(ce=new Pi),ye||au(u)?rg(u,d,S,$,te,ce):N5(u,d,xe,S,$,te,ce);if(!(S&x)){var pt=Fe&&gr.call(u,"__wrapped__"),St=$e&&gr.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),P5(u,d,S,$,te,ce)):!1}i(c5,"baseIsEqualDeep"),a(c5,"baseIsEqualDeep");function u5(u){return Rr(u)&&bn(u)==be}i(u5,"baseIsMap"),a(u5,"baseIsMap");function vh(u,d,S,$){var te=S.length,ce=te,ye=!$;if(u==null)return!ce;for(u=br(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"),a(vh,"baseIsMatch");function T1(u){if(!kr(u)||V5(u))return!1;var d=ko(u)?lD:tr;return d.test(qa(u))}i(T1,"baseIsNative"),a(T1,"baseIsNative");function l5(u){return Rr(u)&&yn(u)==ie}i(l5,"baseIsRegExp"),a(l5,"baseIsRegExp");function f5(u){return Rr(u)&&bn(u)==ee}i(f5,"baseIsSet"),a(f5,"baseIsSet");function d5(u){return Rr(u)&&df(u.length)&&!!yr[yn(u)]}i(d5,"baseIsTypedArray"),a(d5,"baseIsTypedArray");function C1(u){return typeof u=="function"?u:u==null?Rn:typeof u=="object"?Nt(u)?k1(u[0],u[1]):I1(u):zg(u)}i(C1,"baseIteratee"),a(C1,"baseIteratee");function yh(u){if(!iu(u))return gD(u);var d=[];for(var S in br(u))gr.call(u,S)&&S!="constructor"&&d.push(S);return d}i(yh,"baseKeys"),a(yh,"baseKeys");function h5(u){if(!kr(u))return W5(u);var d=iu(u),S=[];for(var $ in u)$=="constructor"&&(d||!gr.call(u,$))||S.push($);return S}i(h5,"baseKeysIn"),a(h5,"baseKeysIn");function bh(u,d){return u<d}i(bh,"baseLt"),a(bh,"baseLt");function M1(u,d){var S=-1,$=kn(u)?ke(u.length):[];return $a(u,function(te,ce,ye){$[++S]=d(te,ce,ye)}),$}i(M1,"baseMap"),a(M1,"baseMap");function I1(u){var d=Oh(u);return d.length==1&&d[0][2]?cg(d[0][0],d[0][1]):function(S){return S===u||vh(S,u,d)}}i(I1,"baseMatches"),a(I1,"baseMatches");function k1(u,d){return Nh(u)&&sg(d)?cg(Qi(u),d):function(S){var $=zh(S,u);return $===r&&$===d?Hh(S,u):tu(d,$,x|O)}}i(k1,"baseMatchesProperty"),a(k1,"baseMatchesProperty");function Jl(u,d,S,$,te){u!==d&&A1(d,function(ce,ye){if(te||(te=new Pi),kr(ce))p5(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"),a(Jl,"baseMerge");function p5(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&&Va(xe),St=!Ye&&!pt&&au(xe);Fe=xe,Ye||pt||St?Nt(Ee)?Fe=Ee:Pr(Ee)?Fe=In(Ee):pt?($e=!1,Fe=j1(xe,!0)):St?($e=!1,Fe=$1(xe,!0)):Fe=[]:ou(xe)||$s(xe)?(Fe=Ee,$s(Ee)?Fe=Bg(Ee):(!kr(Ee)||ko(Ee))&&(Fe=ag(xe))):$e=!1}$e&&(ye.set(xe,Fe),te(Fe,xe,$,ce,ye),ye.delete(xe)),dh(u,S,Fe)}i(p5,"baseMergeDeep"),a(p5,"baseMergeDeep");function D1(u,d){var S=u.length;if(!!S)return d+=d<0?S:0,Io(d,S)?u[d]:r}i(D1,"baseNth"),a(D1,"baseNth");function R1(u,d,S){d.length?d=Mr(d,function(ce){return Nt(ce)?function(ye){return za(ye,ce.length===1?ce[0]:ce)}:ce}):d=[Rn];var $=-1;d=Mr(d,jn(wt()));var te=M1(u,function(ce,ye,Ee){var xe=Mr(d,function(Ue){return Ue(ce)});return{criteria:xe,index:++$,value:ce}});return t3(te,function(ce,ye){return C5(ce,ye,S)})}i(R1,"baseOrderBy"),a(R1,"baseOrderBy");function m5(u,d){return O1(u,d,function(S,$){return Hh(u,$)})}i(m5,"basePick"),a(m5,"basePick");function O1(u,d,S){for(var $=-1,te=d.length,ce={};++$<te;){var ye=d[$],Ee=za(u,ye);S(Ee,ye)&&ru(ce,ua(ye,u),Ee)}return ce}i(O1,"basePickBy"),a(O1,"basePickBy");function g5(u){return function(d){return za(d,u)}}i(g5,"basePropertyDeep"),a(g5,"basePropertyDeep");function wh(u,d,S,$){var te=$?e3: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&&ah.call(Ee,xe,1),ah.call(u,xe,1);return u}i(wh,"basePullAll"),a(wh,"basePullAll");function N1(u,d){for(var S=u?d.length:0,$=S-1;S--;){var te=d[S];if(S==$||te!==ce){var ce=te;Io(te)?ah.call(u,te,1):Sh(u,te)}}return u}i(N1,"basePullAt"),a(N1,"basePullAt");function _h(u,d){return u+uh(w3()*(d-u+1))}i(_h,"baseRandom"),a(_h,"baseRandom");function v5(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(v5,"baseRange"),a(v5,"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"),a(Eh,"baseRepeat");function Ut(u,d){return fg(ug(u,d,Rn),u+"")}i(Ut,"baseRest"),a(Ut,"baseRest");function y5(u){return y1(zs(u))}i(y5,"baseSample"),a(y5,"baseSample");function b5(u,d){var S=zs(u);return sf(S,ja(d,0,S.length))}i(b5,"baseSampleSize"),a(b5,"baseSampleSize");function ru(u,d,S,$){if(!kr(u))return u;d=ua(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:Io(d[te+1])?[]:{})}Xc(Ee,xe,Ue),Ee=Ee[xe]}return u}i(ru,"baseSet"),a(ru,"baseSet");var w5=lh?function(u,d){return lh.set(u,d),u}:Rn,xD=sh?function(u,d){return sh(u,"toString",{configurable:!0,enumerable:!1,value:qh(d),writable:!0})}:Rn;function _5(u){return sf(zs(u))}i(_5,"baseShuffle"),a(_5,"baseShuffle");function ai(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(ai,"baseSlice"),a(ai,"baseSlice");function E5(u,d){var S;return $a(u,function($,te,ce){return S=d($,te,ce),!S}),!!S}i(E5,"baseSome"),a(E5,"baseSome");function Zl(u,d,S){var $=0,te=u==null?$:u.length;if(typeof d=="number"&&d===d&&te<=q){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"),a(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"),a(Ah,"baseSortedIndexBy");function P1(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(P1,"baseSortedUniq"),a(P1,"baseSortedUniq");function B1(u){return typeof u=="number"?u:zn(u)?C:+u}i(B1,"baseToNumber"),a(B1,"baseToNumber");function $n(u){if(typeof u=="string")return u;if(Nt(u))return Mr(u,$n)+"";if(zn(u))return _3?_3.call(u):"";var d=u+"";return d=="0"&&1/u==-m?"-0":d}i($n,"baseToString"),a($n,"baseToString");function ca(u,d,S){var $=-1,te=Ll,ce=u.length,ye=!0,Ee=[],xe=Ee;if(S)ye=!1,te=qd;else if(ce>=o){var Ue=d?null:CD(u);if(Ue)return Fl(Ue);ye=!1,te=Gc,xe=new Fa}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(ca,"baseUniq"),a(ca,"baseUniq");function Sh(u,d){return d=ua(d,u),u=lg(u,d),u==null||delete u[Qi(si(d))]}i(Sh,"baseUnset"),a(Sh,"baseUnset");function L1(u,d,S,$){return ru(u,d,S(za(u,d)),$)}i(L1,"baseUpdate"),a(L1,"baseUpdate");function Yl(u,d,S,$){for(var te=u.length,ce=$?te:-1;($?ce--:++ce<te)&&d(u[ce],ce,u););return S?ai(u,$?0:ce,$?ce+1:te):ai(u,$?ce+1:0,$?te:ce)}i(Yl,"baseWhile"),a(Yl,"baseWhile");function U1(u,d){var S=u;return S instanceof Kt&&(S=S.value()),Vd(d,function($,te){return te.func.apply(te.thisArg,aa([$],te.args))},S)}i(U1,"baseWrapperValue"),a(U1,"baseWrapperValue");function xh(u,d,S){var $=u.length;if($<2)return $?ca(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 ca(Xr(ce,1),d,S)}i(xh,"baseXor"),a(xh,"baseXor");function F1(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(F1,"baseZipObject"),a(F1,"baseZipObject");function Th(u){return Pr(u)?u:[]}i(Th,"castArrayLikeObject"),a(Th,"castArrayLikeObject");function Ch(u){return typeof u=="function"?u:Rn}i(Ch,"castFunction"),a(Ch,"castFunction");function ua(u,d){return Nt(u)?u:Nh(u,d)?[u]:X5(dr(u))}i(ua,"castPath"),a(ua,"castPath");var TD=Ut;function la(u,d,S){var $=u.length;return S=S===r?$:S,!d&&S>=$?u:ai(u,d,S)}i(la,"castSlice"),a(la,"castSlice");var A5=fD||function(u){return Fr.clearTimeout(u)};function j1(u,d){if(d)return u.slice();var S=u.length,$=m3?m3(S):new u.constructor(S);return u.copy($),$}i(j1,"cloneBuffer"),a(j1,"cloneBuffer");function Mh(u){var d=new u.constructor(u.byteLength);return new ih(d).set(new ih(u)),d}i(Mh,"cloneArrayBuffer"),a(Mh,"cloneArrayBuffer");function S5(u,d){var S=d?Mh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.byteLength)}i(S5,"cloneDataView"),a(S5,"cloneDataView");function x5(u){var d=new u.constructor(u.source,yt.exec(u));return d.lastIndex=u.lastIndex,d}i(x5,"cloneRegExp"),a(x5,"cloneRegExp");function T5(u){return ql?br(ql.call(u)):{}}i(T5,"cloneSymbol"),a(T5,"cloneSymbol");function $1(u,d){var S=d?Mh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.length)}i($1,"cloneTypedArray"),a($1,"cloneTypedArray");function z1(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(z1,"compareAscending"),a(z1,"compareAscending");function C5(u,d,S){for(var $=-1,te=u.criteria,ce=d.criteria,ye=te.length,Ee=S.length;++$<ye;){var xe=z1(te[$],ce[$]);if(xe){if($>=Ee)return xe;var Ue=S[$];return xe*(Ue=="desc"?-1:1)}}return u.index-d.index}i(C5,"compareMultiple"),a(C5,"compareMultiple");function H1(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(H1,"composeArgs"),a(H1,"composeArgs");function q1(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(q1,"composeArgsRight"),a(q1,"composeArgsRight");function In(u,d){var S=-1,$=u.length;for(d||(d=ke($));++S<$;)d[S]=u[S];return d}i(In,"copyArray"),a(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?To(S,Ee,xe):Xc(S,Ee,xe)}return S}i(Xi,"copyObject"),a(Xi,"copyObject");function M5(u,d){return Xi(u,ig(u),d)}i(M5,"copySymbols"),a(M5,"copySymbols");function I5(u,d){return Xi(u,L5(u),d)}i(I5,"copySymbolsIn"),a(I5,"copySymbolsIn");function Xl(u,d){return function(S,$){var te=Nt(S)?J2:J3,ce=d?d():{};return te(S,u,wt($,2),ce)}}i(Xl,"createAggregator"),a(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=br(d);++$<te;){var Ee=S[$];Ee&&u(d,Ee,$,ce)}return d})}i(Us,"createAssigner"),a(Us,"createAssigner");function V1(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=br(S);(d?ce--:++ce<te)&&$(ye[ce],ce,ye)!==!1;);return S}}i(V1,"createBaseEach"),a(V1,"createBaseEach");function K1(u){return function(d,S,$){for(var te=-1,ce=br(d),ye=$(d),Ee=ye.length;Ee--;){var xe=ye[u?Ee:++te];if(S(ce[xe],xe,ce)===!1)break}return d}}i(K1,"createBaseFor"),a(K1,"createBaseFor");function k5(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"),a(ce,"wrapper"),ce}i(k5,"createBind"),a(k5,"createBind");function G1(u){return function(d){d=dr(d);var S=Ps(d)?Oi(d):r,$=S?S[0]:d.charAt(0),te=S?la(S,1).join(""):d.slice(1);return $[u]()+te}}i(G1,"createCaseFirst"),a(G1,"createCaseFirst");function Fs(u){return function(d){return Vd($g(Fg(d).replace(Ol,"")),u,"")}}i(Fs,"createCompounder"),a(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"),a(nu,"createCtor");function D5(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?[]:sa(ye,xe);if(ce-=Ue.length,ce<S)return X1(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"),a(te,"wrapper"),te}i(D5,"createCurry"),a(D5,"createCurry");function W1(u){return function(d,S,$){var te=br(d);if(!kn(d)){var ce=wt(S,3);d=Zr(d),S=a(function(Ee){return ce(te[Ee],Ee,te)},"predicate")}var ye=u(d,S,$);return ye>-1?te[ce?d[ye]:ye]:r}}i(W1,"createFind"),a(W1,"createFind");function J1(u){return Mo(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"?ng(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(J1,"createFlow"),a(J1,"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|H),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=n3(Gt,_n);if($&&(Gt=H1(Gt,$,te,pt)),ce&&(Gt=q1(Gt,ce,ye,pt)),Ht-=qn,pt&&Ht<Ue){var jr=sa(Gt,_n);return X1(u,d,Ql,_t.placeholder,S,Gt,jr,Ee,xe,Ue-Ht)}var eo=$e?S:this,fa=Ye?eo[u]:u;return Ht=Gt.length,Ee?Gt=Z5(Gt,Ee):St&&Ht>1&&Gt.reverse(),Fe&&xe<Ht&&(Gt.length=xe),this&&this!==Fr&&this instanceof _t&&(fa=Lt||nu(fa)),fa.apply(eo,Gt)}return i(_t,"wrapper"),a(_t,"wrapper"),_t}i(Ql,"createHybrid"),a(Ql,"createHybrid");function Z1(u,d){return function(S,$){return o5(S,u,d($),{})}}i(Z1,"createInverter"),a(Z1,"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=B1(S),$=B1($)),te=u(S,$)}return te}}i(ef,"createMathOperation"),a(ef,"createMathOperation");function Ih(u){return Mo(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"),a(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)?la(Oi($),0,u).join(""):$.slice(0,u)}i(tf,"createPadding"),a(tf,"createPadding");function R5(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"),a(ye,"wrapper"),ye}i(R5,"createPartial"),a(R5,"createPartial");function Y1(u){return function(d,S,$){return $&&typeof $!="number"&&wn(d,S,$)&&(S=$=r),d=Do(d),S===r?(S=d,d=0):S=Do(S),$=$===r?d<S?1:-1:Do($),v5(d,S,$,u)}}i(Y1,"createRange"),a(Y1,"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"),a(rf,"createRelationalOperation");function X1(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)&&Y5(_t,Lt),_t.placeholder=$,dg(_t,u,d)}i(X1,"createRecurry"),a(X1,"createRecurry");function kh(u){var d=Wr[u];return function(S,$){if(S=ci(S),$=$==null?0:vn(Pt($),292),$&&b3(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"),a(kh,"createRound");var CD=Jc&&1/Fl(new Jc([,-0]))[1]==m?function(u){return new Jc(u)}:Gh;function Q1(u){return function(d){var S=bn(d);return S==be?Xd(d):S==ee?c3(d):r3(d,u(d))}}i(Q1,"createToPairs"),a(Q1,"createToPairs");function Co(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:ng(u),pt=[u,d,S,$,te,Fe,$e,ce,ye,Ee];if(Ye&&G5(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|H)&&(d&=~(j|H)),!d||d==D)var St=k5(u,d,S);else d==j||d==H?St=D5(u,d,Ee):(d==Q||d==(D|Q))&&!te.length?St=R5(u,d,S,$):St=Ql.apply(r,pt);var Lt=Ye?w5:Y5;return dg(Lt(St,pt),u,d)}i(Co,"createWrap"),a(Co,"createWrap");function eg(u,d,S,$){return u===r||Bi(u,Wc[S])&&!gr.call($,S)?d:u}i(eg,"customDefaultsAssignIn"),a(eg,"customDefaultsAssignIn");function tg(u,d,S,$,te,ce){return kr(u)&&kr(d)&&(ce.set(d,u),Jl(u,d,r,tg,ce),ce.delete(d)),u}i(tg,"customDefaultsMerge"),a(tg,"customDefaultsMerge");function O5(u){return ou(u)?r:u}i(O5,"customOmitClone"),a(O5,"customOmitClone");function rg(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 Fa: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(rg,"equalArrays"),a(rg,"equalArrays");function N5(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 ae: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=rg(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(N5,"equalByTag"),a(N5,"equalByTag");function P5(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:gr.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(P5,"equalObjects"),a(P5,"equalObjects");function Mo(u){return fg(ug(u,r,vg),u+"")}i(Mo,"flatRest"),a(Mo,"flatRest");function Dh(u){return S1(u,Zr,ig)}i(Dh,"getAllKeys"),a(Dh,"getAllKeys");function Rh(u){return S1(u,Dn,L5)}i(Rh,"getAllKeysIn"),a(Rh,"getAllKeysIn");var ng=lh?function(u){return lh.get(u)}:Gh;function nf(u){for(var d=u.name+"",S=Zc[d],$=gr.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"),a(nf,"getFuncName");function js(u){var d=gr.call(se,"placeholder")?se:u;return d.placeholder}i(js,"getHolder"),a(js,"getHolder");function wt(){var u=se.iteratee||Vh;return u=u===Vh?C1:u,arguments.length?u(arguments[0],arguments[1]):u}i(wt,"getIteratee"),a(wt,"getIteratee");function of(u,d){var S=u.__data__;return q5(d)?S[typeof d=="string"?"string":"hash"]:S.map}i(of,"getMapData"),a(of,"getMapData");function Oh(u){for(var d=Zr(u),S=d.length;S--;){var $=d[S],te=u[$];d[S]=[$,te,sg(te)]}return d}i(Oh,"getMatchData"),a(Oh,"getMatchData");function Ha(u,d){var S=o3(u,d);return T1(S)?S:r}i(Ha,"getNative"),a(Ha,"getNative");function B5(u){var d=gr.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(B5,"getRawTag"),a(B5,"getRawTag");var ig=p1?function(u){return u==null?[]:(u=br(u),oa(p1(u),function(d){return v3.call(u,d)}))}:Wh,L5=p1?function(u){for(var d=[];u;)aa(d,ig(u)),u=oh(u);return d}:Wh,bn=yn;(m1&&bn(new m1(new ArrayBuffer(1)))!=ve||$l&&bn(new $l)!=be||g1&&bn(g1.resolve())!=F||Jc&&bn(new Jc)!=ee||zl&&bn(new zl)!=Ie)&&(bn=a(function(u){var d=yn(u),S=d==N?u.constructor:r,$=S?qa(S):"";if($)switch($){case wD:return ve;case _D:return be;case ED:return F;case AD:return ee;case SD:return Ie}return d},"getTag"));function U5(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(U5,"getView"),a(U5,"getView");function F5(u){var d=u.match(Ze);return d?d[1].split(cr):[]}i(F5,"getWrapDetails"),a(F5,"getWrapDetails");function og(u,d,S){d=ua(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)&&Io(ye,te)&&(Nt(u)||$s(u)))}i(og,"hasPath"),a(og,"hasPath");function j5(u){var d=u.length,S=new u.constructor(d);return d&&typeof u[0]=="string"&&gr.call(u,"index")&&(S.index=u.index,S.input=u.input),S}i(j5,"initCloneArray"),a(j5,"initCloneArray");function ag(u){return typeof u.constructor=="function"&&!iu(u)?Yc(oh(u)):{}}i(ag,"initCloneObject"),a(ag,"initCloneObject");function $5(u,d,S){var $=u.constructor;switch(d){case qe:return Mh(u);case ne:case ae:return new $(+u);case ve:return S5(u,S);case pe:case re:case le:case _e:case Te:case Ce:case Oe:case Ct:case Ve:return $1(u,S);case be:return new $;case Re:case ue:return new $(u);case ie:return x5(u);case ee:return new $;case Ae:return T5(u)}}i($5,"initCloneByTag"),a($5,"initCloneByTag");function z5(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(at,`{
|
|
24
|
+
`):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function sy(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(sy,"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,o,s;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var l=ay(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=ay(v),_=y.next();!_.done;_=y.next()){var x=_.value;try{n7(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&&(o=y.return)&&o.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)n7(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)&&sy(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&sy(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var EJ=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 n7(e){ji(e)?e():e.unsubscribe()}i(n7,"execFinalizer");var oo={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 o=Iu.delegate;return o?.setTimeout?o.setTimeout.apply(o,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 i7(e){Iu.setTimeout(function(){var t=oo.onUnhandledError;if(t)t(e);else throw e})}i(i7,"reportUnhandledError");function cy(){}i(cy,"noop");var o7=function(){return uy("C",void 0,void 0)}();function a7(e){return uy("E",void 0,e)}i(a7,"errorNotification");function s7(e){return uy("N",e,void 0)}i(s7,"nextNotification");function uy(e,t,r){return{kind:e,value:t,error:r}}i(uy,"createNotification");var nc=null;function c7(e){if(oo.useDeprecatedSynchronousErrorHandling){var t=!nc;if(t&&(nc={errorThrown:!1,error:null}),e(),t){var r=nc,n=r.errorThrown,o=r.error;if(nc=null,n)throw o}}else e()}i(c7,"errorContext");function u7(e){oo.useDeprecatedSynchronousErrorHandling&&nc&&(nc.errorThrown=!0,nc.error=e)}i(u7,"captureError");var dy=function(e){oy(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=FL,n}return i(t,"Subscriber"),t.create=function(r,n,o){return new Xp(r,n,o)},t.prototype.next=function(r){this.isStopped?fy(s7(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?fy(a7(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?fy(o7,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 BL=Function.prototype.bind;function ly(e,t){return BL.call(e,t)}i(ly,"bind");var LL=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){oy(t,e);function t(r,n,o){var s=e.call(this)||this,c;if(ji(r)||!r)c={next:r??void 0,error:n??void 0,complete:o??void 0};else{var l;s&&oo.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&ly(r.next,l),error:r.error&&ly(r.error,l),complete:r.complete&&ly(r.complete,l)}):c=r}return s.destination=new LL(c),s}return i(t,"SafeSubscriber"),t}(dy);function Yp(e){oo.useDeprecatedSynchronousErrorHandling?u7(e):i7(e)}i(Yp,"handleUnhandledError");function UL(e){throw e}i(UL,"defaultErrorHandler");function fy(e,t){var r=oo.onStoppedNotification;r&&Iu.setTimeout(function(){return r(e,t)})}i(fy,"handleStoppedNotification");var FL={closed:!0,next:cy,error:UL,complete:cy};var l7=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function f7(e){return e}i(f7,"identity");function d7(e){return e.length===0?f7:e.length===1?e[0]:i(function(r){return e.reduce(function(n,o){return o(n)},r)},"piped")}i(d7,"pipeFromArray");var hy=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 o=this,s=$L(t)?t:new Xp(t,r,n);return c7(function(){var c=o,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?o._subscribe(s):o._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=h7(r),new r(function(o,s){var c=new Xp({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:o});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[l7]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return d7(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=h7(t),new t(function(n,o){var s;r.subscribe(function(c){return s=c},function(c){return o(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function h7(e){var t;return(t=e??oo.Promise)!==null&&t!==void 0?t:Promise}i(h7,"getPromiseCtor");function jL(e){return e&&ji(e.next)&&ji(e.error)&&ji(e.complete)}i(jL,"isObserver");function $L(e){return e&&e instanceof dy||jL(e)&&Zp(e)}i($L,"isSubscriber");var p7;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(p7||(p7={}));var m7;(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"})(m7||(m7={}));var my;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(my||(my={}));var Nf=class extends hy{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,py.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===my.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,py.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 g7(){return e=>{}}i(g7,"StreamStatic");var zL=function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},mi,gy={anchor:!0,publish:!0,pin:!0,sync:rc.PREFER_CACHE},HL={sync:rc.PREFER_CACHE},v7={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function vy(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=lv((0,w7.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(vy,"headerFromMetadata");async function y7(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(y7,"getAuthenticatedDID");async function yy(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(yy,"throwReadOnlyError");var Za=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,b7.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,o={}){o={...gy,...o},!n?.deterministic&&o.syncTimeoutSeconds==null&&(o.syncTimeoutSeconds=0);let s=o.asDID?{did:o.asDID}:t,c=await mi.makeGenesis(s,r,n);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,c,o)}static async createFromGenesis(t,r,n={}){n={...gy,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let o=r.data?await mi._signDagJWS(t,r):r;return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,o,n)}static async deterministic(t,r,n={}){if(n={...gy,...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 o=await mi.makeGenesis(t,null,r);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...HL,...n};let o=Ys.from(r);if(o.type!=mi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${mi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...v7,...n};let o=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(o,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...v7,...r};let o={header:vy(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await mi._signDagJWS(this.api,o),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=yy,this.patch=yy,this.sync=yy,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let o=await this._makeRawCommit(r,n);return mi._signDagJWS(t,o)}async _makeRawCommit(t,r){r||(r={});let n=vy(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 o=XE.compare(this.content,t),s=this.state.log[0];return{header:n,data:o,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 y7(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 o=vy(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:o};return Av(c),c}let s={data:r,header:o};return mi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await y7(t)).createDagJWS(r)}},"TileDocument");Za.STREAM_TYPE_NAME="tile";Za.STREAM_TYPE_ID=0;Za=mi=zL([g7()],Za);var C7=Hs(A7(),1);function QL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(QL,"_checkPrivateRedeclaration");function eU(e,t){return t.get?t.get.call(e):t.value}i(eU,"_classApplyDescriptorGet");function tU(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(tU,"_classApplyDescriptorSet");function T7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(T7,"_classExtractFieldDescriptor");function Ey(e,t){var r=T7(e,t,"get");return eU(e,r)}i(Ey,"_classPrivateFieldGet");function S7(e,t,r){QL(e,t),t.set(e,r)}i(S7,"_classPrivateFieldInit");function x7(e,t,r){var n=T7(e,t,"set");return tU(e,n,r),r}i(x7,"_classPrivateFieldSet");function rU(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(rU,"keyToQuery");function Ay(e){return typeof e=="string"?Ys.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(Ay,"keyToString");async function xy(e){let t=await Za.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(xy,"getDeterministicQuery");var nU=i(()=>Promise.resolve([]),"tempBatchLoadFn"),Qp=new WeakMap,Sy=new WeakMap,ic=class extends C7.default{cache(t){if(!Ey(this,Sy))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let o=await Za.create(Ey(this,Qp),t,r,n);return this.cache(o),o}async deterministic(t,r){let n=await xy(t);try{return await super.load(n)}catch{let s=await Za.createFromGenesis(Ey(this,Qp),n.genesis,r);return this.cache(s),s}}async load(t){return await super.load(t)}async update(t,r,n,o){let s=Ay(t);this.clear(s);let c=await this.load({streamId:s});return await c.update(r,n,o),c}constructor(t){super(nU,{cache:!0,cacheKeyFn:Ay,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),S7(this,Qp,{writable:!0,value:void 0}),S7(this,Sy,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(rU),t.multiqueryTimeout);return r.map(o=>{let s=Ay(o),c=n[s];return c||new Error(`Failed to load stream: ${s}`)})},x7(this,Qp,t.ceramic),x7(this,Sy,!!t.cache)}};i(ic,"TileLoader");function iU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(iU,"_checkPrivateRedeclaration");function oU(e,t){return t.get?t.get.call(e):t.value}i(oU,"_classApplyDescriptorGet");function aU(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(aU,"_classApplyDescriptorSet");function I7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(I7,"_classExtractFieldDescriptor");function oc(e,t){var r=I7(e,t,"get");return oU(e,r)}i(oc,"_classPrivateFieldGet");function M7(e,t,r){iU(e,t),t.set(e,r)}i(M7,"_classPrivateFieldInit");function Ty(e,t,r){var n=I7(e,t,"set");return aU(e,n,r),r}i(Ty,"_classPrivateFieldSet");var ku=new WeakMap,Du=new WeakMap,Ru=class{get aliases(){return oc(this,ku)}get loader(){return oc(this,Du)}getDefinitionID(t){return oc(this,ku).definitions[t]??null}getSchemaURL(t){return oc(this,ku).schemas[t]??null}getTileID(t){return oc(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 oc(this,Du).load(r)}async createTile(t,r,n={}){let o=this.getSchemaURL(t);if(o==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:s,...c}=n,l={schema:o};return s!=null&&(l.controllers=[s]),await oc(this,Du).create(r,l,c)}constructor(t){if(M7(this,ku,{writable:!0,value:void 0}),M7(this,Du,{writable:!0,value:void 0}),Ty(this,ku,t.aliases),t.loader!=null)Ty(this,Du,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");Ty(this,Du,new ic({ceramic:t.ceramic,cache:t.cache}))}}};i(Ru,"DataModel");function sU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(sU,"_checkPrivateRedeclaration");function cU(e,t){return t.get?t.get.call(e):t.value}i(cU,"_classApplyDescriptorGet");function uU(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(uU,"_classApplyDescriptorSet");function k7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(k7,"_classExtractFieldDescriptor");function Po(e,t){var r=k7(e,t,"get");return cU(e,r)}i(Po,"_classPrivateFieldGet");function e0(e,t,r){sU(e,t),t.set(e,r)}i(e0,"_classPrivateFieldInit");function t0(e,t,r){var n=k7(e,t,"set");return uU(e,n,r),r}i(t0,"_classPrivateFieldSet");var r0=new WeakMap,ac=new WeakMap,Cy=new WeakMap,n0=new WeakMap,Pf=class{_createValuePromise(){t0(this,Cy,new Promise((t,r)=>{t0(this,n0,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let o=i(async s=>{try{let c=await t(s);r(),this._next(c)}catch(c){n(c),this._next(s)}},"run");Po(this,ac).push({reject:n,run:o}),Po(this,ac).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 Po(this,ac).length===0?await Po(this,r0).call(this):await Po(this,Cy)}async _start(){try{let t=await Po(this,r0).call(this);this._next(t)}catch(t){Po(this,ac).forEach(r=>{r.reject(t)}),t0(this,ac,[]),Po(this,n0).reject(t),this._createValuePromise()}}_next(t){let r=Po(this,ac).shift();r==null?this._end(t):r.run(t)}_end(t){Po(this,n0).resolve(t),this._createValuePromise()}constructor(t){e0(this,r0,{writable:!0,value:void 0}),e0(this,ac,{writable:!0,value:[]}),e0(this,Cy,{writable:!0,value:void 0}),e0(this,n0,{writable:!0,value:void 0}),t0(this,r0,t),this._createValuePromise()}};i(Pf,"TileProxy");var lU=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function fU(e){return lU.test(e)}i(fU,"isDIDstring");function dU(e){if(!fU(e))throw new Error(`Invalid DID: ${e}`)}i(dU,"assertDIDstring");function My(e){return dU(e),{controllers:[e],family:"IDX"}}i(My,"getIDXMetadata");function hU(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(hU,"_checkPrivateRedeclaration");function pU(e,t){return t.get?t.get.call(e):t.value}i(pU,"_classApplyDescriptorGet");function mU(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(mU,"_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 $r(e,t){var r=D7(e,t,"get");return pU(e,r)}i($r,"_classPrivateFieldGet");function Bf(e,t,r){hU(e,t),t.set(e,r)}i(Bf,"_classPrivateFieldInit");function i0(e,t,r){var n=D7(e,t,"set");return mU(e,n,r),r}i(i0,"_classPrivateFieldSet");var va=new WeakMap,o0=new WeakMap,Iy=new WeakMap,Bo=new WeakMap,a0=new WeakMap,Lf=class{get authenticated(){return $r(this,va).did!=null}get ceramic(){return $r(this,va)}get id(){if($r(this,o0)!=null)return $r(this,o0);if($r(this,va).did==null)throw new Error("Ceramic instance is not authenticated");return $r(this,va).did.hasParent?$r(this,va).did.parent:$r(this,va).did.id}get loader(){return $r(this,Bo)}get model(){return $r(this,a0)}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),o=await Promise.all(r.map(async l=>{let{genesis:h,streamId:p}=await xy(My(l));return{genesis:h,streamId:p.toString(),paths:[n]}})),s=await $r(this,va).multiQuery(o),c=[];for(let l of o){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 o=this.getDefinitionID(t),[s,c]=await this._setRecordOnly(o,r,n);return s&&await this._setReference(n.controller??this.id,o,c),c}async merge(t,r,n={}){let o=this.getDefinitionID(t),s=await this.getRecord(o),c=s?{...s,...r}:r;return await this.setRecord(o,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()??{},o=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(o)).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[o,s]=r[n++],c=await $r(this,Bo).load(s);return{done:!1,value:{key:o,id:s,record:c.content}}}}}async _createIDXDoc(t){return await $r(this,Bo).deterministic(My(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,Iy)[t];return r==null&&(r=new Pf(async()=>await this._getOwnIDXDoc(t)),$r(this,Iy)[t]=r),r}getDefinitionID(t){return $r(this,a0).getDefinitionID(t)??t}async getDefinition(t){let r=await $r(this,Bo).load(t);if(r.metadata.schema!==JE)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,Bo).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[o,s]=await this._setRecordOnly(t,r,n);return o&&await this._setReference(n.controller??this.id,t,s),s}async _setRecordOnly(t,r,n){let o=await this.getRecordID(t,n.controller??this.id);if(o==null){let s=await this.getDefinition(t),c=await this._createRecord(s,r,n);return[!0,c]}else{let s=await $r(this,Bo).update(o,r);return[!1,s.id]}}async _createRecord(t,r,{controller:n,pin:o}){let s=await $r(this,Bo).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:o});return await s.update(r,{schema:t.schema}),s.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(o=>({...o,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Bf(this,va,{writable:!0,value:void 0}),Bf(this,o0,{writable:!0,value:void 0}),Bf(this,Iy,{writable:!0,value:{}}),Bf(this,Bo,{writable:!0,value:void 0}),Bf(this,a0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:o,loader:s,model:c}=t;i0(this,va,n),i0(this,o0,o),i0(this,Bo,s??new ic({ceramic:n,cache:r})),i0(this,a0,c instanceof Ru?c:new Ru({loader:$r(this,Bo),aliases:c}))}};i(Lf,"DIDDataStore");var rr;(function(e){e.assertEqual=o=>o;function t(o){}i(t,"assertIs"),e.assertIs=t;function r(o){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let c of o)s[c]=c;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),c={};for(let l of s)c[l]=o[l];return e.objectValues(c)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let c in o)Object.prototype.hasOwnProperty.call(o,c)&&s.push(c);return s},e.find=(o,s)=>{for(let c of o)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(o,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"]),Ya=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"]),gU=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:[]},o=i(s=>{for(let c of s.issues)if(c.code==="invalid_union")c.unionErrors.map(o);else if(c.code==="invalid_return_type")o(c.returnTypeError);else if(c.code==="invalid_arguments")o(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 o(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 o of this.issues)o.path.length>0?(r[o.path[0]]=r[o.path[0]]||[],r[o.path[0]].push(t(o))):n.push(t(o));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"),P7=Ff;function vU(e){P7=e}i(vU,"setErrorMap");function c0(){return P7}i(c0,"getErrorMap");var u0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],c={...o,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...o,path:s,message:o.message||l}},"makeIssue"),yU=[];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 o of r){if(o.status==="aborted")return Dt;o.status==="dirty"&&t.dirty(),n.push(o.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let o of r)n.push({key:await o.key,value:await o.value});return en.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let o of r){let{key:s,value:c}=o;if(s.status==="aborted"||c.status==="aborted")return Dt;s.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),(typeof c.value<"u"||o.alwaysSet)&&(n[s.value]=c.value)}return{status:t.value,value:n}}};i(en,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),B7=i(e=>({status:"dirty",value:e}),"DIRTY"),Sn=i(e=>({status:"valid",value:e}),"OK"),ky=i(e=>e.status==="aborted","isAborted"),Dy=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,o){this.parent=t,this.data=r,this._path=n,this._key=o}get path(){return this._path.concat(this._key)}};i(gi,"ParseInputLazyPath");var R7=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:o}=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:o}:{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:o}}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 Ya(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:Ya(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:Ya(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 o={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:Ya(t)},s=this._parseSync({data:t,path:o.path,parent:o});return R7(o,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:Ya(t)},o=this._parse({data:t,path:n.path,parent:n}),s=await(f0(o)?o:Promise.resolve(o));return R7(n,s)}refine(t,r){let n=i(o=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(o):r,"getIssueProperties");return this._refinement((o,s)=>{let c=t(o),l=i(()=>s.addIssue({code:Ke.custom,...n(o)}),"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,o)=>t(n)?!0:(o.addIssue(typeof r=="function"?r(n,o):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 jo.create(this)}nullish(){return this.optional().nullable()}array(){return Gn.create(this)}promise(){return wa.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 bU=/^c[^\s-]{8,}$/i,wU=/^([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,_U=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,EU=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(o=>t.test(o),{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,o;for(let s of this._def.checks)if(s.kind==="min")t.data.length<s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{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&&(o=this._getOrReturnCtx(t,o),vt(o,{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)&&(o=this._getOrReturnCtx(t,o),c?vt(o,{code:Ke.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):l&&vt(o,{code:Ke.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")_U.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"email",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")wU.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"uuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")bU.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{validation:"cuid",code:Ke.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(t.data)}catch{o=this._getOrReturnCtx(t,o),vt(o,{validation:"url",code:Ke.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{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)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?t.data.endsWith(s.value)||(o=this._getOrReturnCtx(t,o),vt(o,{code:Ke.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?EU(s).test(t.data)||(o=this._getOrReturnCtx(t,o),vt(o,{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 AU(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),c=parseInt(t.toFixed(o).replace(".",""));return s%c/Math.pow(10,o)}i(AU,"floatSafeRemainder");var ao=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,o=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}),o.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}),o.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}),o.dirty()):s.kind==="multipleOf"?AU(t.data,s.value)!==0&&(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_multiple_of,multipleOf:s.value,message:s.message}),o.dirty()):s.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),vt(n,{code:Ke.not_finite,message:s.message}),o.dirty()):rr.assertNever(s);return{status:o.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,o){return new ao({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Wt.toString(o)}]})}_addCheck(t){return new ao({...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(ao,"ZodNumber");ao.create=e=>new ao({checks:[],typeName:xt.ZodNumber,coerce:e?.coerce||!1,...Vt(e)});var Xa=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(Xa,"ZodBigInt");Xa.create=e=>{var t;return new Xa({typeName:xt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Vt(e)})};var Qa=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(Qa,"ZodBoolean");Qa.create=e=>new Qa({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Vt(e)});var Lo=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,o;for(let s of this._def.checks)s.kind==="min"?t.data.getTime()<s.value&&(o=this._getOrReturnCtx(t,o),vt(o,{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&&(o=this._getOrReturnCtx(t,o),vt(o,{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 Lo({...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(Lo,"ZodDate");Lo.create=e=>new Lo({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 ya=class extends Bt{constructor(){super(...arguments),this._any=!0}_parse(t){return Sn(t.data)}};i(ya,"ZodAny");ya.create=e=>new ya({typeName:xt.ZodAny,...Vt(e)});var Uo=class extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Sn(t.data)}};i(Uo,"ZodUnknown");Uo.create=e=>new Uo({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),o=this._def;if(r.parsedType!==tt.array)return vt(r,{code:Ke.invalid_type,expected:tt.array,received:r.parsedType}),Dt;if(o.exactLength!==null){let c=r.data.length>o.exactLength.value,l=r.data.length<o.exactLength.value;(c||l)&&(vt(r,{code:c?Ke.too_big:Ke.too_small,minimum:l?o.exactLength.value:void 0,maximum:c?o.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:o.exactLength.message}),n.dirty())}if(o.minLength!==null&&r.data.length<o.minLength.value&&(vt(r,{code:Ke.too_small,minimum:o.minLength.value,type:"array",inclusive:!0,exact:!1,message:o.minLength.message}),n.dirty()),o.maxLength!==null&&r.data.length>o.maxLength.value&&(vt(r,{code:Ke.too_big,maximum:o.maxLength.value,type:"array",inclusive:!0,exact:!1,message:o.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((c,l)=>o.type._parseAsync(new gi(r,c,r.path,l)))).then(c=>en.mergeArray(n,c));let s=r.data.map((c,l)=>o.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 O7=i(e=>t=>new wr({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function Ou(e){if(e instanceof wr){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=yi.create(Ou(n))}return new wr({...e._def,shape:()=>t})}else return e instanceof Gn?Gn.create(Ou(e.element)):e instanceof yi?yi.create(Ou(e.unwrap())):e instanceof jo?jo.create(Ou(e.unwrap())):e instanceof vi?vi.create(e.items.map(t=>Ou(t))):e}i(Ou,"deepPartialify");var wr=class extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=O7(this._def),this.extend=O7(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:o}=this._processInputParams(t),{shape:s,keys:c}=this._getCached(),l=[];if(!(this._def.catchall instanceof Hi&&this._def.unknownKeys==="strip"))for(let p in o.data)c.includes(p)||l.push(p);let h=[];for(let p of c){let g=s[p],v=o.data[p];h.push({key:{status:"valid",value:p},value:g._parse(new gi(o,v,o.path,p)),alwaysSet:p in o.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:o.data[g]}});else if(p==="strict")l.length>0&&(vt(o,{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=o.data[g];h.push({key:{status:"valid",value:g},value:p._parse(new gi(o,v,o.path,g)),alwaysSet:g in o.data})}}return o.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 wr({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var o,s,c,l;let h=(c=(s=(o=this._def).errorMap)===null||s===void 0?void 0:s.call(o,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 wr({...this._def,unknownKeys:"strip"})}passthrough(){return new wr({...this._def,unknownKeys:"passthrough"})}setKey(t,r){return this.augment({[t]:r})}merge(t){return new wr({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>d0.mergeShapes(this._def.shape(),t._def.shape()),typeName:xt.ZodObject})}catchall(t){return new wr({...this._def,catchall:t})}pick(t){let r={};return rr.objectKeys(t).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new wr({...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 wr({...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 wr({...this._def,shape:()=>r});for(let n in this.shape){let o=this.shape[n];r[n]=o.optional()}return new wr({...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 wr({...this._def,shape:()=>r})}keyof(){return L7(rr.objectKeys(this.shape))}};i(wr,"ZodObject");wr.create=(e,t)=>new wr({shape:()=>e,unknownKeys:"strip",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});wr.strictCreate=(e,t)=>new wr({shape:()=>e,unknownKeys:"strict",catchall:Hi.create(),typeName:xt.ZodObject,...Vt(t)});wr.lazycreate=(e,t)=>new wr({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 o(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(o,"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(o);{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 os?s0(e.schema):e instanceof Wn?s0(e.innerType()):e instanceof as?[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,o=r.data[n],s=this.optionsMap.get(o);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 o=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(o.has(l))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(l)}`);o.set(l,s)}}return new uc({typeName:xt.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:o,...Vt(n)})}};i(uc,"ZodDiscriminatedUnion");function Ry(e,t){let r=Ya(e),n=Ya(t);if(e===t)return{valid:!0,data:e};if(r===tt.object&&n===tt.object){let o=rr.objectKeys(t),s=rr.objectKeys(e).filter(l=>o.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=Ry(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 o=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=Ry(c,l);if(!h.valid)return{valid:!1};o.push(h.data)}return{valid:!0,data:o}}else return r===tt.date&&n===tt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Ry,"mergeValues");var ns=class extends Bt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),o=i((s,c)=>{if(ky(s)||ky(c))return Dt;let l=Ry(s.value,c.value);return l.valid?((Dy(s)||Dy(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])=>o(s,c)):o(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 o=[],s=this._def.keyType,c=this._def.valueType;for(let l in n.data)o.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,o):en.mergeObjectSync(r,o)}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 o=this._def.keyType,s=this._def.valueType,c=[...n.data.entries()].map(([l,h],p)=>({key:o._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 Fo=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 o=this._def;o.minSize!==null&&n.data.size<o.minSize.value&&(vt(n,{code:Ke.too_small,minimum:o.minSize.value,type:"set",inclusive:!0,exact:!1,message:o.minSize.message}),r.dirty()),o.maxSize!==null&&n.data.size>o.maxSize.value&&(vt(n,{code:Ke.too_big,maximum:o.maxSize.value,type:"set",inclusive:!0,exact:!1,message:o.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 Fo({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Fo({...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(Fo,"ZodSet");Fo.create=(e,t)=>new Fo({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Vt(t)});var ba=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 o(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(o,"makeReturnsIssue");let s={errorMap:r.common.contextualErrorMap},c=r.data;return this._def.returns instanceof wa?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(o(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([o(p,g.error)]);return g.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new ba({...this._def,args:vi.create(t).rest(Uo.create())})}returns(t){return new ba({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new ba({args:t||vi.create([]).rest(Uo.create()),returns:r||Uo.create(),typeName:xt.ZodFunction,...Vt(n)})}};i(ba,"ZodFunction");var os=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(os,"ZodLazy");os.create=(e,t)=>new os({getter:e,typeName:xt.ZodLazy,...Vt(t)});var as=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(as,"ZodLiteral");as.create=(e,t)=>new as({value:e,typeName:xt.ZodLiteral,...Vt(t)});function L7(e,t){return new ss({values:e,typeName:xt.ZodEnum,...Vt(t)})}i(L7,"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=L7;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 o=rr.objectValues(r);return vt(n,{expected:rr.joinValues(o),received:n.parsedType,code:Ke.invalid_type}),Dt}if(r.indexOf(t.data)===-1){let o=rr.objectValues(r);return vt(n,{received:n.data,code:Ke.invalid_enum_value,options:o}),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 wa=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(o=>this._def.type.parseAsync(o,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(wa,"ZodPromise");wa.create=(e,t)=>new wa({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),o=this._def.effect||null;if(o.type==="preprocess"){let c=o.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),o.type==="refinement"){let c=i(l=>{let h=o.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(o.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=o.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(o.transform(c.value,s)).then(l=>({status:r.value,value:l})):c);rr.assertNever(o)}};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 jo=class extends Bt{_parse(t){return this._getType(t)===tt.null?Sn(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(jo,"ZodNullable");jo.create=(e,t)=>new jo({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(o=>({status:"valid",value:o.status==="valid"?o.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 SU=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(),B7(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})},"handleAsync")();{let o=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?Dt:o.status==="dirty"?(r.dirty(),{status:"dirty",value:o.value}):this._def.out._parseSync({data:o.value,path:n.path,parent:n})}}static create(t,r){return new ls({in:t,out:r,typeName:xt.ZodPipeline})}};i(ls,"ZodPipeline");var U7=i((e,t={},r)=>e?ya.create().superRefine((n,o)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...c,fatal:r})}}):ya.create(),"custom"),xU={object:wr.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 TU=i((e,t={message:`Input not instance of ${e.name}`})=>U7(r=>r instanceof e,t,!0),"instanceOfType"),F7=zi.create,j7=ao.create,CU=dc.create,MU=Xa.create,$7=Qa.create,IU=Lo.create,kU=sc.create,DU=es.create,RU=ts.create,OU=ya.create,NU=Uo.create,PU=Hi.create,BU=cc.create,LU=Gn.create,UU=wr.create,FU=wr.strictCreate,jU=rs.create,$U=uc.create,zU=ns.create,HU=vi.create,qU=is.create,VU=lc.create,KU=Fo.create,GU=ba.create,WU=os.create,JU=as.create,ZU=ss.create,YU=cs.create,XU=wa.create,N7=Wn.create,QU=yi.create,eF=jo.create,tF=Wn.createWithPreprocess,rF=ls.create,nF=i(()=>F7().optional(),"ostring"),iF=i(()=>j7().optional(),"onumber"),oF=i(()=>$7().optional(),"oboolean"),aF={string:e=>zi.create({...e,coerce:!0}),number:e=>ao.create({...e,coerce:!0}),boolean:e=>Qa.create({...e,coerce:!0}),bigint:e=>Xa.create({...e,coerce:!0}),date:e=>Lo.create({...e,coerce:!0})},sF=Dt,z=Object.freeze({__proto__:null,defaultErrorMap:Ff,setErrorMap:vU,getErrorMap:c0,makeIssue:u0,EMPTY_PATH:yU,addIssueToContext:vt,ParseStatus:en,INVALID:Dt,DIRTY:B7,OK:Sn,isAborted:ky,isDirty:Dy,isValid:l0,isAsync:f0,get util(){return rr},ZodParsedType:tt,getParsedType:Ya,ZodType:Bt,ZodString:zi,ZodNumber:ao,ZodBigInt:Xa,ZodBoolean:Qa,ZodDate:Lo,ZodSymbol:sc,ZodUndefined:es,ZodNull:ts,ZodAny:ya,ZodUnknown:Uo,ZodNever:Hi,ZodVoid:cc,ZodArray:Gn,get objectUtil(){return d0},ZodObject:wr,ZodUnion:rs,ZodDiscriminatedUnion:uc,ZodIntersection:ns,ZodTuple:vi,ZodRecord:is,ZodMap:lc,ZodSet:Fo,ZodFunction:ba,ZodLazy:os,ZodLiteral:as,ZodEnum:ss,ZodNativeEnum:cs,ZodPromise:wa,ZodEffects:Wn,ZodTransformer:Wn,ZodOptional:yi,ZodNullable:jo,ZodDefault:us,ZodCatch:fc,ZodNaN:dc,BRAND:SU,ZodBranded:Uf,ZodPipeline:ls,custom:U7,Schema:Bt,ZodSchema:Bt,late:xU,get ZodFirstPartyTypeKind(){return xt},coerce:aF,any:OU,array:LU,bigint:MU,boolean:$7,date:IU,discriminatedUnion:$U,effect:N7,enum:ZU,function:GU,instanceof:TU,intersection:zU,lazy:WU,literal:JU,map:VU,nan:CU,nativeEnum:YU,never:PU,null:RU,nullable:eF,number:j7,object:UU,oboolean:oF,onumber:iF,optional:QU,ostring:nF,pipeline:rF,preprocess:tF,promise:XU,record:qU,set:KU,strictObject:FU,string:F7,symbol:kU,transformer:N7,tuple:HU,undefined:DU,union:jU,unknown:NU,void:BU,NEVER:sF,ZodIssueCode:Ke,quotelessJson:gU,ZodError:$i});var cF=Object.defineProperty,uF=i((e,t)=>cF(e,"name",{value:t,configurable:!0}),"__name"),m0=z.array(z.string().or(z.record(z.any()))),RZ=z.object({type:z.string().optional(),narrative:z.string().optional()}),g0=z.string().or(z.object({id:z.string(),type:z.string(),caption:z.string().optional()})),lF=z.object({type:z.string().min(1).or(z.string().array().nonempty()),latitude:z.number(),longitude:z.number()}),fF=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:lF.optional()}),dF=z.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(z.string()),V7=z.object({type:z.string().min(1).or(z.string().array().nonempty()),identifier:z.string(),identifierType:dF}),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:g0.optional(),email:z.string().email().optional(),address:fF.optional(),otherIdentifier:V7.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())),Oy=z.object({id:z.string().optional()}).catchall(z.any()),hF=z.object({type:z.string(),id:z.string()}).catchall(z.any()),pF=z.object({id:z.string(),type:z.string()}).catchall(z.any()),mF=z.object({id:z.string(),type:z.string()}).catchall(z.any()),h0=z.object({"@context":m0,id:z.string().optional(),type:z.string().array().nonempty(),issuer:jf,issuanceDate:z.string(),expirationDate:z.string().optional(),credentialSubject:Oy.or(Oy.array()),credentialStatus:hF.optional(),credentialSchema:pF.array().optional(),refreshService:mF.optional()}).catchall(z.any()),$o=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()),p0=h0.extend({proof:$o.or($o.array())}),gF=z.object({"@context":m0,id:z.string().optional(),type:z.string().or(z.string().array().nonempty()),verifiableCredential:p0.or(p0.array()).optional(),holder:z.string().optional()}).catchall(z.any()),OZ=gF.extend({proof:$o.or($o.array())}),By=z.object({kty:z.string(),crv:z.string(),x:z.string(),y:z.string().optional(),n:z.string().optional(),d:z.string().optional()}),BZ=By.omit({d:!0}).extend({d:z.string()}),vF=z.object({alg:z.string(),iv:z.string(),tag:z.string(),epk:By.partial().optional(),kid:z.string().optional(),apv:z.string().optional(),apu:z.string().optional()}),yF=z.object({header:vF,encrypted_key:z.string()}),bF=z.object({protected:z.string(),iv:z.string(),ciphertext:z.string(),tag:z.string(),aad:z.string().optional(),recipients:yF.array().optional()}),hc=z.string().or(z.object({"@context":m0.optional(),id:z.string(),type:z.string(),controller:z.string(),publicKeyJwk:By.optional(),publicKeyBase58:z.string().optional(),blockChainAccountId:z.string().optional()}).catchall(z.any())),wF=z.object({id:z.string(),type:z.string().or(z.string().array().nonempty()),serviceEndpoint:z.any().or(z.any().array().nonempty())}).catchall(z.any()),LZ=z.object({"@context":m0,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:wF.array().optional(),proof:$o.or($o.array()).optional()}).catchall(z.any()),_F=z.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(z.string()),v0=z.object({type:z.string().array().nonempty(),targetCode:z.string().optional(),targetDescription:z.string().optional(),targetName:z.string(),targetFramework:z.string().optional(),targetType:_F.optional(),targetUrl:z.string()}),EF=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"]),AF=EF.or(z.string()),SF=z.object({id:z.string().optional(),narrative:z.string().optional()}).catchall(z.any()),xF=z.object({id:z.string(),type:z.string().array().nonempty(),endorsementComment:z.string().optional()}),TF=h0.extend({credentialSubject:xF,proof:$o.or($o.array()).optional()}),CF=z.object({id:z.string(),"@language":z.string().optional(),version:z.string().optional()}),MF=z.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(z.string()),IF=z.object({id:z.string(),type:z.string().array().nonempty(),alignment:v0.array().optional(),description:z.string().optional(),level:z.string().optional(),name:z.string(),points:z.string().optional()}).catchall(z.any()),kF=z.object({id:z.string(),type:z.string().array().nonempty(),alignment:v0.array().optional(),allowedValue:z.string().array().optional(),name:z.string(),requiredLevel:z.string().optional(),requiredValue:z.string().optional(),resultType:MF,rubricCriterionLevel:IF.array().optional(),valueMax:z.string().optional(),valueMin:z.string().optional()}).catchall(z.any()),DF=z.object({id:z.string().optional(),type:z.string().array().nonempty(),alignment:v0.array().optional(),achievementType:AF.optional(),creator:jf.optional(),creditsAvailable:z.number().optional(),criteria:SF,description:z.string(),endorsement:TF.array().optional(),fieldOfStudy:z.string().optional(),humanCode:z.string().optional(),image:g0.optional(),"@language":z.string().optional(),name:z.string(),otherIdentifier:V7.array().optional(),related:CF.array().optional(),resultDescription:kF.array().optional(),specialization:z.string().optional(),tag:z.string().array().optional(),version:z.string().optional()}).catchall(z.any()),RF=z.object({type:z.string(),hashed:z.boolean(),identityHash:z.string(),identityType:z.string(),salt:z.string().optional()}),OF=z.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),NF=z.object({type:z.string().array().nonempty(),achievedLevel:z.string().optional(),alignment:v0.array().optional(),resultDescription:z.string().optional(),status:OF.optional(),value:z.string().optional()}).catchall(z.any()),z7=z.object({id:z.string().optional(),type:z.string().array().nonempty(),activityEndDate:z.string().optional(),activityStartDate:z.string().optional(),creditsEarned:z.number().optional(),achievement:DF.optional(),identifier:RF.array().optional(),image:g0.optional(),licenseNumber:z.string().optional(),narrative:z.string().optional(),result:NF.array().optional(),role:z.string().optional(),source:jf.optional(),term:z.string().optional()}).catchall(z.any()),PF=z.object({id:z.string().optional(),type: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()),BF=h0.extend({name:z.string().optional(),description:z.string().optional(),image:g0.optional(),credentialSubject:z7.or(z7.array()),endorsement:h0.array().optional(),evidence:PF.array().optional()}),FZ=BF.extend({proof:$o.or($o.array())}),$Z=z.object({checks:z.string().array(),warnings:z.string().array(),errors:z.string().array()}),K7=z.enum(["Success","Failed","Error"]),zZ=K7.enum,HZ=z.object({check:z.string(),status:K7,message:z.string().optional(),details:z.string().optional()}),qZ=z.object({title:z.string().optional(),createdAt:z.string().optional(),issuer:jf.optional(),issuee:jf.optional(),credentialSubject:Oy.optional()}),mc=z.object({id:z.string(),uri:z.string()}).catchall(z.any()),GZ=z.object({limit:z.number(),cursor:z.string().optional(),sort:z.string().optional()}),Jn=z.object({cursor:z.string().optional(),hasMore:z.boolean()}),G7=z.object({encryptedRecord:bF,fields:z.string().array()}).catchall(z.any()),WZ=Jn.extend({records:G7.array()}),LF=G7.extend({id:z.string()}),JZ=Jn.extend({records:LF.array()}),H7=uF(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),UF=z.instanceof(RegExp).or(z.string().refine(e=>{try{return H7(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=H7(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),_r=z.string().or(z.object({$in:z.string().array()})).or(z.object({$regex:UF})),FF=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:FF.optional()}),XZ=z.object({profileId:_r,displayName:_r,shortBio:_r,bio:_r,email:_r,websiteLink:_r,isServiceProfile:z.boolean(),type:_r}).partial(),QZ=Jn.extend({records:pc.array()}),eY=z.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),W7=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()}),tY=Jn.extend({records:W7.extend({did:z.string()}).array()}),rY=z.object({id:_r,displayName:_r,shortBio:_r,bio:_r,email:_r}).partial(),nY=Jn.extend({records:z.object({profile:pc,manager:W7.extend({did:z.string()}).optional()}).array()}),iY=z.object({uri:z.string(),to:z.string(),from:z.string(),sent:z.string().datetime(),received:z.string().datetime().optional()}),J7=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()}),jF=z.object({role:_r,canEdit:z.boolean(),canIssue:z.boolean(),canRevoke:z.boolean(),canManagePermissions:z.boolean(),canIssueChildren:_r,canCreateChildren:_r,canEditChildren:_r,canRevokeChildren:_r,canManageChildrenPermissions:_r,canManageChildrenProfiles:z.boolean(),canViewAnalytics:z.boolean()}).partial(),q7=z.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),$F=z.discriminatedUnion("type",[z.object({type:z.literal(q7.Values.GRANT_PERMISSIONS),data:z.object({claimUri:z.string(),targetUri:z.string(),permissions:J7.partial()})}),z.object({type:z.literal(q7.Values.ADD_ADMIN),data:z.object({claimUri:z.string(),targetUri:z.string()})})]),oY=z.object({type:_r,data:z.object({claimUri:_r,targetUri:_r,permissions:jF})}).deepPartial(),zF=z.object({id:z.string(),createdAt:z.string(),updatedAt:z.string()}).and($F),aY=Jn.extend({records:zF.array()}),Ny=z.enum(["DRAFT","LIVE"]),HF=z.object({uri:z.string(),name:z.string().optional(),type:z.string().optional(),category:z.string().optional(),status:Ny.optional(),autoConnectRecipients:z.boolean().optional(),meta:z.record(z.any()).optional(),claimPermissions:J7.optional()}),sY=z.object({uri:_r,name:_r,type:_r,category:_r,meta:z.record(_r),status:Ny.or(z.object({$in:Ny.array()})),autoConnectRecipients:z.boolean()}).partial(),cY=Jn.extend({records:HF.array()}),qF=z.object({to:pc,from:z.string(),received:z.string().optional(),uri:z.string().optional()}),uY=Jn.extend({records:qF.array()}),lY=z.object({endpoint:z.string(),name:z.string(),did:z.string().optional()}),fY=z.object({ttlSeconds:z.number().optional(),totalUses:z.number().optional()}),VF=z.object({endpoint:z.string()}),dY=z.object({signingAuthority:VF,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()})}),hY=z.object({boostUri:z.string(),signingAuthority:z.object({endpoint:z.string(),name:z.string()})}),KF=z.enum(["live","stale","withdrawn"]),GF=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({})}),Z7=z.object({contract:GF,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()}),pY=Jn.extend({records:Z7.omit({owner:!0}).array()}),WF=z.object({credentials:z.object({categories:z.record(z.string().array()).default({})}),personal:z.record(z.string()).default({}),date:z.string()}),mY=Jn.extend({records:WF.array()}),JF=z.object({credentials:z.object({category:z.string(),uri:z.string()}).array(),personal:z.record(z.string()).default({}),date:z.string(),contractUri:z.string()}),gY=Jn.extend({records:JF.array()}),Y7=z.object({sharing:z.boolean().optional(),shared:z.string().array().optional(),shareAll:z.boolean().optional(),shareUntil:z.string().optional()}),X7=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({shareAll:z.boolean().optional(),sharing:z.boolean().optional(),categories:z.record(Y7).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({})}),vY=Jn.extend({records:z.object({expiresAt:z.string().optional(),oneTime:z.boolean().optional(),terms:X7,contract:Z7,uri:z.string(),consenter:pc,status:KF}).array()}),yY=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()}),bY=z.object({anonymize:z.boolean().optional(),credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional()}),wY=z.object({credentials:z.object({categories:z.record(z.boolean()).optional()}).optional(),personal:z.record(z.boolean()).optional(),id:_r.optional()}),ZF=z.object({read:z.object({anonymize:z.boolean().optional(),credentials:z.object({shareAll:z.boolean().optional(),sharing:z.boolean().optional(),categories:z.record(Y7.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()}),Py=z.enum(["consent","update","sync","withdraw","write"]),_Y=z.object({terms:ZF.optional(),action:Py.or(Py.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()}),Q7=z.object({expiresAt:z.string().optional(),oneTime:z.boolean().optional(),terms:X7.optional(),id:z.string(),action:Py,date:z.string(),uris:z.string().array().optional()}),EY=Jn.extend({records:Q7.array()}),YF=z.object({credentialUri:z.string(),termsUri:z.string(),contractUri:z.string(),boostUri:z.string(),category:z.string().optional(),date:z.string()}),AY=Jn.extend({records:YF.array()}),XF=z.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),QF=z.object({title:z.string().optional(),body:z.string().optional()}),ej=z.object({vcUris:z.array(z.string()).optional(),vpUris:z.array(z.string()).optional(),transaction:Q7.optional()}),SY=z.object({type:XF,to:pc.partial().and(z.object({did:z.string()})),from:pc.partial().and(z.object({did:z.string()})),message:QF.optional(),data:ej.optional(),sent:z.string().datetime().optional()});var tj=Object.create,bd=Object.defineProperty,rj=Object.getOwnPropertyDescriptor,u6=Object.getOwnPropertyNames,nj=Object.getPrototypeOf,ij=Object.prototype.hasOwnProperty,a=i((e,t)=>bd(e,"name",{value:t,configurable:!0}),"__name"),lb=(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')}),pr=i((e,t)=>i(function(){return e&&(t=(0,e[u6(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[u6(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"),yS=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of u6(t))!ij.call(e,o)&&o!==r&&bd(e,o,{get:()=>t[o],enumerable:!(n=rj(t,o))||n.enumerable});return e},"__copyProps"),ir=i((e,t,r)=>(r=e!=null?tj(nj(e)):{},yS(t||!e||!e.__esModule?bd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),Ly=i(e=>yS(bd({},"__esModule",{value:!0}),e),"__toCommonJS"),oj=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",o=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,H=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,q=A>>>1,I=[["ary",k],["bind",D],["bindKey",P],["curry",j],["curryRight",H],["flip",he],["partial",Q],["partialRight",Y],["rearg",K]],U="[object Arguments]",ge="[object Array]",L="[object AsyncFunction]",ne="[object Boolean]",ae="[object Date]",M="[object DOMException]",G="[object Error]",oe="[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,ar=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,it=/^\w*$/,Xe=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,ot=RegExp(Qt.source),et=/^\s+/,sr=/\s/,at=/\{(?:\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,on=/^(?:0|[1-9]\d*)$/,Nr=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Vr=/($^)/,an=/['\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",ea="A-Z\\xc0-\\xd6\\xd8-\\xde",ta="\\ufe0e\\ufe0f",ra=Un+ki+Di+Ri,Pa="['\u2019]",Pd="["+Cn+"]",_l="["+ra+"]",ks="["+Ln+"]",El="\\d+",Bd="["+pn+"]",Al="["+ri+"]",Sl="[^"+Cn+ra+El+pn+ri+ea+"]",Ds="\\ud83c[\\udffb-\\udfff]",Ld="(?:"+ks+"|"+Ds+")",xl="[^"+Cn+"]",na="(?:\\ud83c[\\udde6-\\uddff]){2}",Zi="[\\ud800-\\udbff][\\udc00-\\udfff]",ia="["+ea+"]",wo="\\u200d",Tl="(?:"+Al+"|"+Sl+")",Ud="(?:"+ia+"|"+Sl+")",Cl="(?:"+Pa+"(?:d|ll|m|re|s|t|ve))?",Ml="(?:"+Pa+"(?:D|LL|M|RE|S|T|VE))?",Il=Ld+"?",kl="["+ta+"]?",Dl="(?:"+wo+"(?:"+[xl,na,Zi].join("|")+")"+kl+Il+")*",_o="\\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,na,Zi].join("|")+")"+qc,Rl="(?:"+[xl+ks+"?",ks,na,Zi,Pd].join("|")+")",Ol=RegExp(Pa,"g"),$d=RegExp(ks,"g"),Nl=RegExp(Ds+"(?="+Ds+")|"+Rl+qc,"g"),Pl=RegExp([ia+"?"+Al+"+"+Cl+"(?="+[_l,ia,"$"].join("|")+")",Ud+"+"+Ml+"(?="+[_l,ia+Tl,"$"].join("|")+")",ia+"?"+Tl+"+"+Cl,ia+"+"+Ml,Fd,_o,El,jd].join("|"),"g"),zd=RegExp("["+wo+Cn+Ln+ta+"]"),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,yr={};yr[pe]=yr[re]=yr[le]=yr[_e]=yr[Te]=yr[Ce]=yr[Oe]=yr[Ct]=yr[Ve]=!0,yr[U]=yr[ge]=yr[qe]=yr[ne]=yr[ve]=yr[ae]=yr[G]=yr[oe]=yr[be]=yr[Re]=yr[N]=yr[ie]=yr[ee]=yr[ue]=yr[Ie]=!1;var mr={};mr[U]=mr[ge]=mr[qe]=mr[ve]=mr[ne]=mr[ae]=mr[pe]=mr[re]=mr[le]=mr[_e]=mr[Te]=mr[be]=mr[Re]=mr[N]=mr[ie]=mr[ee]=mr[ue]=mr[Ae]=mr[Ce]=mr[Oe]=mr[Ct]=mr[Ve]=!0,mr[G]=mr[oe]=mr[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={"&":"&","<":"<",">":">",'"':""","'":"'"},Le={"&":"&","<":"<",">":">",""":'"',"'":"'"},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")(),Eo=typeof e=="object"&&e&&!e.nodeType&&e,Ao=Eo&&typeof t=="object"&&t&&!t.nodeType&&t,Bl=Ao&&Ao.exports===Eo,Kc=Bl&&Mn.process,gn=function(){try{var Se=Ao&&Ao.require&&Ao.require("util").types;return Se||Kc&&Kc.binding&&Kc.binding("util")}catch{}}(),Os=gn&&gn.isArrayBuffer,q2=gn&&gn.isDate,V2=gn&&gn.isMap,K2=gn&&gn.isRegExp,G2=gn&&gn.isSet,W2=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"),a(Fn,"apply");function J2(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(J2,"arrayAggregator"),a(J2,"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"),a(ni,"arrayEach");function Z2(Se,Pe){for(var ke=Se==null?0:Se.length;ke--&&Pe(Se[ke],ke,Se)!==!1;);return Se}i(Z2,"arrayEachRight"),a(Z2,"arrayEachRight");function n1(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(n1,"arrayEvery"),a(n1,"arrayEvery");function oa(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(oa,"arrayFilter"),a(oa,"arrayFilter");function Ll(Se,Pe){var ke=Se==null?0:Se.length;return!!ke&&Ns(Se,Pe,0)>-1}i(Ll,"arrayIncludes"),a(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"),a(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"),a(Mr,"arrayMap");function aa(Se,Pe){for(var ke=-1,ft=Pe.length,kt=Se.length;++ke<ft;)Se[kt+ke]=Pe[ke];return Se}i(aa,"arrayPush"),a(aa,"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"),a(Vd,"arrayReduce");function Y2(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(Y2,"arrayReduceRight"),a(Y2,"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"),a(Kd,"arraySome");var eD=Gd("length");function X2(Se){return Se.split("")}i(X2,"asciiToArray"),a(X2,"asciiToArray");function Q2(Se){return Se.match(st)||[]}i(Q2,"asciiWords"),a(Q2,"asciiWords");function i1(Se,Pe,ke){var ft;return ke(Se,function(kt,fr,Wr){if(Pe(kt,fr,Wr))return ft=fr,!1}),ft}i(i1,"baseFindKey"),a(i1,"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"),a(Ul,"baseFindIndex");function Ns(Se,Pe,ke){return Pe===Pe?u3(Se,Pe,ke):Ul(Se,o1,ke)}i(Ns,"baseIndexOf"),a(Ns,"baseIndexOf");function e3(Se,Pe,ke,ft){for(var kt=ke-1,fr=Se.length;++kt<fr;)if(ft(Se[kt],Pe))return kt;return-1}i(e3,"baseIndexOfWith"),a(e3,"baseIndexOfWith");function o1(Se){return Se!==Se}i(o1,"baseIsNaN"),a(o1,"baseIsNaN");function a1(Se,Pe){var ke=Se==null?0:Se.length;return ke?Jd(Se,Pe)/ke:C}i(a1,"baseMean"),a(a1,"baseMean");function Gd(Se){return function(Pe){return Pe==null?r:Pe[Se]}}i(Gd,"baseProperty"),a(Gd,"baseProperty");function Wd(Se){return function(Pe){return Se==null?r:Se[Pe]}}i(Wd,"basePropertyOf"),a(Wd,"basePropertyOf");function s1(Se,Pe,ke,ft,kt){return kt(Se,function(fr,Wr,br){ke=ft?(ft=!1,fr):Pe(ke,fr,Wr,br)}),ke}i(s1,"baseReduce"),a(s1,"baseReduce");function t3(Se,Pe){var ke=Se.length;for(Se.sort(Pe);ke--;)Se[ke]=Se[ke].value;return Se}i(t3,"baseSortBy"),a(t3,"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"),a(Jd,"baseSum");function Zd(Se,Pe){for(var ke=-1,ft=Array(Se);++ke<Se;)ft[ke]=Pe(ke);return ft}i(Zd,"baseTimes"),a(Zd,"baseTimes");function r3(Se,Pe){return Mr(Pe,function(ke){return[ke,Se[ke]]})}i(r3,"baseToPairs"),a(r3,"baseToPairs");function c1(Se){return Se&&Se.slice(0,d1(Se)+1).replace(et,"")}i(c1,"baseTrim"),a(c1,"baseTrim");function jn(Se){return function(Pe){return Se(Pe)}}i(jn,"baseUnary"),a(jn,"baseUnary");function Yd(Se,Pe){return Mr(Pe,function(ke){return Se[ke]})}i(Yd,"baseValues"),a(Yd,"baseValues");function Gc(Se,Pe){return Se.has(Pe)}i(Gc,"cacheHas"),a(Gc,"cacheHas");function u1(Se,Pe){for(var ke=-1,ft=Se.length;++ke<ft&&Ns(Pe,Se[ke],0)>-1;);return ke}i(u1,"charsStartIndex"),a(u1,"charsStartIndex");function l1(Se,Pe){for(var ke=Se.length;ke--&&Ns(Pe,Se[ke],0)>-1;);return ke}i(l1,"charsEndIndex"),a(l1,"charsEndIndex");function n3(Se,Pe){for(var ke=Se.length,ft=0;ke--;)Se[ke]===Pe&&++ft;return ft}i(n3,"countHolders"),a(n3,"countHolders");var tD=Wd(de),rD=Wd(Me);function i3(Se){return"\\"+ht[Se]}i(i3,"escapeStringChar"),a(i3,"escapeStringChar");function o3(Se,Pe){return Se==null?r:Se[Pe]}i(o3,"getValue"),a(o3,"getValue");function Ps(Se){return zd.test(Se)}i(Ps,"hasUnicode"),a(Ps,"hasUnicode");function a3(Se){return Rs.test(Se)}i(a3,"hasUnicodeWord"),a(a3,"hasUnicodeWord");function s3(Se){for(var Pe,ke=[];!(Pe=Se.next()).done;)ke.push(Pe.value);return ke}i(s3,"iteratorToArray"),a(s3,"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"),a(Xd,"mapToArray");function f1(Se,Pe){return function(ke){return Se(Pe(ke))}}i(f1,"overArg"),a(f1,"overArg");function sa(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(sa,"replaceHolders"),a(sa,"replaceHolders");function Fl(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Pe]=ft}),ke}i(Fl,"setToArray"),a(Fl,"setToArray");function c3(Se){var Pe=-1,ke=Array(Se.size);return Se.forEach(function(ft){ke[++Pe]=[ft,ft]}),ke}i(c3,"setToPairs"),a(c3,"setToPairs");function u3(Se,Pe,ke){for(var ft=ke-1,kt=Se.length;++ft<kt;)if(Se[ft]===Pe)return ft;return-1}i(u3,"strictIndexOf"),a(u3,"strictIndexOf");function l3(Se,Pe,ke){for(var ft=ke+1;ft--;)if(Se[ft]===Pe)return ft;return ft}i(l3,"strictLastIndexOf"),a(l3,"strictLastIndexOf");function Bs(Se){return Ps(Se)?f3(Se):eD(Se)}i(Bs,"stringSize"),a(Bs,"stringSize");function Oi(Se){return Ps(Se)?d3(Se):X2(Se)}i(Oi,"stringToArray"),a(Oi,"stringToArray");function d1(Se){for(var Pe=Se.length;Pe--&&sr.test(Se.charAt(Pe)););return Pe}i(d1,"trimmedEndIndex"),a(d1,"trimmedEndIndex");var nD=Wd(Le);function f3(Se){for(var Pe=Nl.lastIndex=0;Nl.test(Se);)++Pe;return Pe}i(f3,"unicodeSize"),a(f3,"unicodeSize");function d3(Se){return Se.match(Nl)||[]}i(d3,"unicodeToArray"),a(d3,"unicodeToArray");function h3(Se){return Se.match(Pl)||[]}i(h3,"unicodeWords"),a(h3,"unicodeWords");var iD=a(i(function Se(Pe){Pe=Pe==null?Fr:Ba.defaults(Fr.Object(),Pe,Ba.pick(Fr,Hd));var ke=Pe.Array,ft=Pe.Date,kt=Pe.Error,fr=Pe.Function,Wr=Pe.Math,br=Pe.Object,h1=Pe.RegExp,oD=Pe.String,Ni=Pe.TypeError,Qd=ke.prototype,aD=fr.prototype,Wc=br.prototype,eh=Pe["__core-js_shared__"],th=aD.toString,gr=Wc.hasOwnProperty,sD=0,p3=function(){var u=/[^.]+$/.exec(eh&&eh.keys&&eh.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),rh=Wc.toString,cD=th.call(br),uD=Fr._,lD=h1("^"+th.call(gr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nh=Bl?Pe.Buffer:r,La=Pe.Symbol,ih=Pe.Uint8Array,m3=nh?nh.allocUnsafe:r,oh=f1(br.getPrototypeOf,br),g3=br.create,v3=Wc.propertyIsEnumerable,ah=Qd.splice,y3=La?La.isConcatSpreadable:r,jl=La?La.iterator:r,Ls=La?La.toStringTag:r,sh=function(){try{var u=Ha(br,"defineProperty");return u({},"",{}),u}catch{}}(),fD=Pe.clearTimeout!==Fr.clearTimeout&&Pe.clearTimeout,dD=ft&&ft.now!==Fr.Date.now&&ft.now,hD=Pe.setTimeout!==Fr.setTimeout&&Pe.setTimeout,ch=Wr.ceil,uh=Wr.floor,p1=br.getOwnPropertySymbols,pD=nh?nh.isBuffer:r,b3=Pe.isFinite,mD=Qd.join,gD=f1(br.keys,br),Jr=Wr.max,vn=Wr.min,vD=ft.now,yD=Pe.parseInt,w3=Wr.random,bD=Qd.reverse,m1=Ha(Pe,"DataView"),$l=Ha(Pe,"Map"),g1=Ha(Pe,"Promise"),Jc=Ha(Pe,"Set"),zl=Ha(Pe,"WeakMap"),Hl=Ha(br,"create"),lh=zl&&new zl,Zc={},wD=qa(m1),_D=qa($l),ED=qa(g1),AD=qa(Jc),SD=qa(zl),fh=La?La.prototype:r,ql=fh?fh.valueOf:r,_3=fh?fh.toString:r;function se(u){if(Rr(u)&&!Nt(u)&&!(u instanceof Kt)){if(u instanceof ii)return u;if(gr.call(u,"__wrapped__"))return pg(u)}return new ii(u)}i(se,"lodash"),a(se,"lodash");var Yc=function(){function u(){}return i(u,"object"),a(u,"object"),function(d){if(!kr(d))return{};if(g3)return g3(d);u.prototype=d;var S=new u;return u.prototype=r,S}}();function Vl(){}i(Vl,"baseLodash"),a(Vl,"baseLodash");function ii(u,d){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!d,this.__index__=0,this.__values__=r}i(ii,"LodashWrapper"),a(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"),a(Kt,"LazyWrapper");function E3(){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(E3,"lazyClone"),a(E3,"lazyClone");function A3(){if(this.__filtered__){var u=new Kt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(A3,"lazyReverse"),a(A3,"lazyReverse");function S3(){var u=this.__wrapped__.value(),d=this.__dir__,S=Nt(u),$=d<0,te=S?u.length:0,ce=U5(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 U1(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(S3,"lazyValue"),a(S3,"lazyValue"),Kt.prototype=Yc(Vl.prototype),Kt.prototype.constructor=Kt;function Ua(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(Ua,"Hash"),a(Ua,"Hash");function x3(){this.__data__=Hl?Hl(null):{},this.size=0}i(x3,"hashClear"),a(x3,"hashClear");function T3(u){var d=this.has(u)&&delete this.__data__[u];return this.size-=d?1:0,d}i(T3,"hashDelete"),a(T3,"hashDelete");function C3(u){var d=this.__data__;if(Hl){var S=d[u];return S===h?r:S}return gr.call(d,u)?d[u]:r}i(C3,"hashGet"),a(C3,"hashGet");function M3(u){var d=this.__data__;return Hl?d[u]!==r:gr.call(d,u)}i(M3,"hashHas"),a(M3,"hashHas");function I3(u,d){var S=this.__data__;return this.size+=this.has(u)?0:1,S[u]=Hl&&d===r?h:d,this}i(I3,"hashSet"),a(I3,"hashSet"),Ua.prototype.clear=x3,Ua.prototype.delete=T3,Ua.prototype.get=C3,Ua.prototype.has=M3,Ua.prototype.set=I3;function So(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(So,"ListCache"),a(So,"ListCache");function k3(){this.__data__=[],this.size=0}i(k3,"listCacheClear"),a(k3,"listCacheClear");function D3(u){var d=this.__data__,S=Kl(d,u);if(S<0)return!1;var $=d.length-1;return S==$?d.pop():ah.call(d,S,1),--this.size,!0}i(D3,"listCacheDelete"),a(D3,"listCacheDelete");function R3(u){var d=this.__data__,S=Kl(d,u);return S<0?r:d[S][1]}i(R3,"listCacheGet"),a(R3,"listCacheGet");function O3(u){return Kl(this.__data__,u)>-1}i(O3,"listCacheHas"),a(O3,"listCacheHas");function N3(u,d){var S=this.__data__,$=Kl(S,u);return $<0?(++this.size,S.push([u,d])):S[$][1]=d,this}i(N3,"listCacheSet"),a(N3,"listCacheSet"),So.prototype.clear=k3,So.prototype.delete=D3,So.prototype.get=R3,So.prototype.has=O3,So.prototype.set=N3;function xo(u){var d=-1,S=u==null?0:u.length;for(this.clear();++d<S;){var $=u[d];this.set($[0],$[1])}}i(xo,"MapCache"),a(xo,"MapCache");function P3(){this.size=0,this.__data__={hash:new Ua,map:new($l||So),string:new Ua}}i(P3,"mapCacheClear"),a(P3,"mapCacheClear");function B3(u){var d=of(this,u).delete(u);return this.size-=d?1:0,d}i(B3,"mapCacheDelete"),a(B3,"mapCacheDelete");function L3(u){return of(this,u).get(u)}i(L3,"mapCacheGet"),a(L3,"mapCacheGet");function U3(u){return of(this,u).has(u)}i(U3,"mapCacheHas"),a(U3,"mapCacheHas");function F3(u,d){var S=of(this,u),$=S.size;return S.set(u,d),this.size+=S.size==$?0:1,this}i(F3,"mapCacheSet"),a(F3,"mapCacheSet"),xo.prototype.clear=P3,xo.prototype.delete=B3,xo.prototype.get=L3,xo.prototype.has=U3,xo.prototype.set=F3;function Fa(u){var d=-1,S=u==null?0:u.length;for(this.__data__=new xo;++d<S;)this.add(u[d])}i(Fa,"SetCache"),a(Fa,"SetCache");function j3(u){return this.__data__.set(u,h),this}i(j3,"setCacheAdd"),a(j3,"setCacheAdd");function $3(u){return this.__data__.has(u)}i($3,"setCacheHas"),a($3,"setCacheHas"),Fa.prototype.add=Fa.prototype.push=j3,Fa.prototype.has=$3;function Pi(u){var d=this.__data__=new So(u);this.size=d.size}i(Pi,"Stack"),a(Pi,"Stack");function z3(){this.__data__=new So,this.size=0}i(z3,"stackClear"),a(z3,"stackClear");function H3(u){var d=this.__data__,S=d.delete(u);return this.size=d.size,S}i(H3,"stackDelete"),a(H3,"stackDelete");function q3(u){return this.__data__.get(u)}i(q3,"stackGet"),a(q3,"stackGet");function V3(u){return this.__data__.has(u)}i(V3,"stackHas"),a(V3,"stackHas");function K3(u,d){var S=this.__data__;if(S instanceof So){var $=S.__data__;if(!$l||$.length<o-1)return $.push([u,d]),this.size=++S.size,this;S=this.__data__=new xo($)}return S.set(u,d),this.size=S.size,this}i(K3,"stackSet"),a(K3,"stackSet"),Pi.prototype.clear=z3,Pi.prototype.delete=H3,Pi.prototype.get=q3,Pi.prototype.has=V3,Pi.prototype.set=K3;function v1(u,d){var S=Nt(u),$=!S&&$s(u),te=!S&&!$&&Va(u),ce=!S&&!$&&!te&&au(u),ye=S||$||te||ce,Ee=ye?Zd(u.length,oD):[],xe=Ee.length;for(var Ue in u)(d||gr.call(u,Ue))&&!(ye&&(Ue=="length"||te&&(Ue=="offset"||Ue=="parent")||ce&&(Ue=="buffer"||Ue=="byteLength"||Ue=="byteOffset")||Io(Ue,xe)))&&Ee.push(Ue);return Ee}i(v1,"arrayLikeKeys"),a(v1,"arrayLikeKeys");function y1(u){var d=u.length;return d?u[_h(0,d-1)]:r}i(y1,"arraySample"),a(y1,"arraySample");function G3(u,d){return sf(In(u),ja(d,0,u.length))}i(G3,"arraySampleSize"),a(G3,"arraySampleSize");function W3(u){return sf(In(u))}i(W3,"arrayShuffle"),a(W3,"arrayShuffle");function dh(u,d,S){(S!==r&&!Bi(u[d],S)||S===r&&!(d in u))&&To(u,d,S)}i(dh,"assignMergeValue"),a(dh,"assignMergeValue");function Xc(u,d,S){var $=u[d];(!(gr.call(u,d)&&Bi($,S))||S===r&&!(d in u))&&To(u,d,S)}i(Xc,"assignValue"),a(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"),a(Kl,"assocIndexOf");function J3(u,d,S,$){return $a(u,function(te,ce,ye){d($,te,S(te),ye)}),$}i(J3,"baseAggregator"),a(J3,"baseAggregator");function b1(u,d){return u&&Xi(d,Zr(d),u)}i(b1,"baseAssign"),a(b1,"baseAssign");function Z3(u,d){return u&&Xi(d,Dn(d),u)}i(Z3,"baseAssignIn"),a(Z3,"baseAssignIn");function To(u,d,S){d=="__proto__"&&sh?sh(u,d,{configurable:!0,enumerable:!0,value:S,writable:!0}):u[d]=S}i(To,"baseAssignValue"),a(To,"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"),a(hh,"baseAt");function ja(u,d,S){return u===u&&(S!==r&&(u=u<=S?u:S),d!==r&&(u=u>=d?u:d)),u}i(ja,"baseClamp"),a(ja,"baseClamp");function oi(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=j5(u),!Ee)return In(u,ye)}else{var $e=bn(u),Ye=$e==oe||$e==fe;if(Va(u))return j1(u,Ee);if($e==N||$e==U||Ye&&!te){if(ye=xe||Ye?{}:ag(u),!Ee)return xe?I5(u,Z3(ye,u)):M5(u,b1(ye,u))}else{if(!mr[$e])return te?u:{};ye=$5(u,$e,Ee)}}ce||(ce=new Pi);var pt=ce.get(u);if(pt)return pt;ce.set(u,ye),L4(u)?u.forEach(function(_t){ye.add(oi(_t,d,S,_t,u,ce))}):I4(u)&&u.forEach(function(_t,Ht){ye.set(Ht,oi(_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,oi(_t,d,S,Ht,u,ce))}),ye}i(oi,"baseClone"),a(oi,"baseClone");function Y3(u){var d=Zr(u);return function(S){return w1(S,u,d)}}i(Y3,"baseConforms"),a(Y3,"baseConforms");function w1(u,d,S){var $=S.length;if(u==null)return!$;for(u=br(u);$--;){var te=S[$],ce=d[te],ye=u[te];if(ye===r&&!(te in u)||!ce(ye))return!1}return!0}i(w1,"baseConformsTo"),a(w1,"baseConformsTo");function _1(u,d,S){if(typeof u!="function")throw new Ni(c);return af(function(){u.apply(r,S)},d)}i(_1,"baseDelay"),a(_1,"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>=o&&(ce=Gc,ye=!1,d=new Fa(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"),a(Qc,"baseDifference");var $a=V1(Yi),X3=V1(ph,!0);function Q3(u,d){var S=!0;return $a(u,function($,te,ce){return S=!!d($,te,ce),S}),S}i(Q3,"baseEvery"),a(Q3,"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"),a(Gl,"baseExtremum");function e5(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:Pg($);S<$;)u[S++]=d;return u}i(e5,"baseFill"),a(e5,"baseFill");function E1(u,d){var S=[];return $a(u,function($,te,ce){d($,te,ce)&&S.push($)}),S}i(E1,"baseFilter"),a(E1,"baseFilter");function Xr(u,d,S,$,te){var ce=-1,ye=u.length;for(S||(S=H5),te||(te=[]);++ce<ye;){var Ee=u[ce];d>0&&S(Ee)?d>1?Xr(Ee,d-1,S,$,te):aa(te,Ee):$||(te[te.length]=Ee)}return te}i(Xr,"baseFlatten"),a(Xr,"baseFlatten");var A1=K1(),t5=K1(!0);function Yi(u,d){return u&&A1(u,d,Zr)}i(Yi,"baseForOwn"),a(Yi,"baseForOwn");function ph(u,d){return u&&t5(u,d,Zr)}i(ph,"baseForOwnRight"),a(ph,"baseForOwnRight");function Wl(u,d){return oa(d,function(S){return ko(u[S])})}i(Wl,"baseFunctions"),a(Wl,"baseFunctions");function za(u,d){d=ua(d,u);for(var S=0,$=d.length;u!=null&&S<$;)u=u[Qi(d[S++])];return S&&S==$?u:r}i(za,"baseGet"),a(za,"baseGet");function S1(u,d,S){var $=d(u);return Nt(u)?$:aa($,S(u))}i(S1,"baseGetAllKeys"),a(S1,"baseGetAllKeys");function yn(u){return u==null?u===r?De:X:Ls&&Ls in br(u)?B5(u):J5(u)}i(yn,"baseGetTag"),a(yn,"baseGetTag");function mh(u,d){return u>d}i(mh,"baseGt"),a(mh,"baseGt");function r5(u,d){return u!=null&&gr.call(u,d)}i(r5,"baseHas"),a(r5,"baseHas");function n5(u,d){return u!=null&&d in br(u)}i(n5,"baseHasIn"),a(n5,"baseHasIn");function i5(u,d,S){return u>=vn(d,S)&&u<Jr(d,S)}i(i5,"baseInRange"),a(i5,"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 Fa(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"),a(gh,"baseIntersection");function o5(u,d,S,$){return Yi(u,function(te,ce,ye){d($,S(te),ce,ye)}),$}i(o5,"baseInverter"),a(o5,"baseInverter");function eu(u,d,S){d=ua(d,u),u=lg(u,d);var $=u==null?u:u[Qi(si(d))];return $==null?r:Fn($,u,S)}i(eu,"baseInvoke"),a(eu,"baseInvoke");function x1(u){return Rr(u)&&yn(u)==U}i(x1,"baseIsArguments"),a(x1,"baseIsArguments");function a5(u){return Rr(u)&&yn(u)==qe}i(a5,"baseIsArrayBuffer"),a(a5,"baseIsArrayBuffer");function s5(u){return Rr(u)&&yn(u)==ae}i(s5,"baseIsDate"),a(s5,"baseIsDate");function tu(u,d,S,$,te){return u===d?!0:u==null||d==null||!Rr(u)&&!Rr(d)?u!==u&&d!==d:c5(u,d,S,$,tu,te)}i(tu,"baseIsEqual"),a(tu,"baseIsEqual");function c5(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&&Va(u)){if(!Va(d))return!1;ye=!0,Fe=!1}if(Ye&&!Fe)return ce||(ce=new Pi),ye||au(u)?rg(u,d,S,$,te,ce):N5(u,d,xe,S,$,te,ce);if(!(S&x)){var pt=Fe&&gr.call(u,"__wrapped__"),St=$e&&gr.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),P5(u,d,S,$,te,ce)):!1}i(c5,"baseIsEqualDeep"),a(c5,"baseIsEqualDeep");function u5(u){return Rr(u)&&bn(u)==be}i(u5,"baseIsMap"),a(u5,"baseIsMap");function vh(u,d,S,$){var te=S.length,ce=te,ye=!$;if(u==null)return!ce;for(u=br(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"),a(vh,"baseIsMatch");function T1(u){if(!kr(u)||V5(u))return!1;var d=ko(u)?lD:tr;return d.test(qa(u))}i(T1,"baseIsNative"),a(T1,"baseIsNative");function l5(u){return Rr(u)&&yn(u)==ie}i(l5,"baseIsRegExp"),a(l5,"baseIsRegExp");function f5(u){return Rr(u)&&bn(u)==ee}i(f5,"baseIsSet"),a(f5,"baseIsSet");function d5(u){return Rr(u)&&df(u.length)&&!!yr[yn(u)]}i(d5,"baseIsTypedArray"),a(d5,"baseIsTypedArray");function C1(u){return typeof u=="function"?u:u==null?Rn:typeof u=="object"?Nt(u)?k1(u[0],u[1]):I1(u):zg(u)}i(C1,"baseIteratee"),a(C1,"baseIteratee");function yh(u){if(!iu(u))return gD(u);var d=[];for(var S in br(u))gr.call(u,S)&&S!="constructor"&&d.push(S);return d}i(yh,"baseKeys"),a(yh,"baseKeys");function h5(u){if(!kr(u))return W5(u);var d=iu(u),S=[];for(var $ in u)$=="constructor"&&(d||!gr.call(u,$))||S.push($);return S}i(h5,"baseKeysIn"),a(h5,"baseKeysIn");function bh(u,d){return u<d}i(bh,"baseLt"),a(bh,"baseLt");function M1(u,d){var S=-1,$=kn(u)?ke(u.length):[];return $a(u,function(te,ce,ye){$[++S]=d(te,ce,ye)}),$}i(M1,"baseMap"),a(M1,"baseMap");function I1(u){var d=Oh(u);return d.length==1&&d[0][2]?cg(d[0][0],d[0][1]):function(S){return S===u||vh(S,u,d)}}i(I1,"baseMatches"),a(I1,"baseMatches");function k1(u,d){return Nh(u)&&sg(d)?cg(Qi(u),d):function(S){var $=zh(S,u);return $===r&&$===d?Hh(S,u):tu(d,$,x|O)}}i(k1,"baseMatchesProperty"),a(k1,"baseMatchesProperty");function Jl(u,d,S,$,te){u!==d&&A1(d,function(ce,ye){if(te||(te=new Pi),kr(ce))p5(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"),a(Jl,"baseMerge");function p5(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&&Va(xe),St=!Ye&&!pt&&au(xe);Fe=xe,Ye||pt||St?Nt(Ee)?Fe=Ee:Pr(Ee)?Fe=In(Ee):pt?($e=!1,Fe=j1(xe,!0)):St?($e=!1,Fe=$1(xe,!0)):Fe=[]:ou(xe)||$s(xe)?(Fe=Ee,$s(Ee)?Fe=Bg(Ee):(!kr(Ee)||ko(Ee))&&(Fe=ag(xe))):$e=!1}$e&&(ye.set(xe,Fe),te(Fe,xe,$,ce,ye),ye.delete(xe)),dh(u,S,Fe)}i(p5,"baseMergeDeep"),a(p5,"baseMergeDeep");function D1(u,d){var S=u.length;if(!!S)return d+=d<0?S:0,Io(d,S)?u[d]:r}i(D1,"baseNth"),a(D1,"baseNth");function R1(u,d,S){d.length?d=Mr(d,function(ce){return Nt(ce)?function(ye){return za(ye,ce.length===1?ce[0]:ce)}:ce}):d=[Rn];var $=-1;d=Mr(d,jn(wt()));var te=M1(u,function(ce,ye,Ee){var xe=Mr(d,function(Ue){return Ue(ce)});return{criteria:xe,index:++$,value:ce}});return t3(te,function(ce,ye){return C5(ce,ye,S)})}i(R1,"baseOrderBy"),a(R1,"baseOrderBy");function m5(u,d){return O1(u,d,function(S,$){return Hh(u,$)})}i(m5,"basePick"),a(m5,"basePick");function O1(u,d,S){for(var $=-1,te=d.length,ce={};++$<te;){var ye=d[$],Ee=za(u,ye);S(Ee,ye)&&ru(ce,ua(ye,u),Ee)}return ce}i(O1,"basePickBy"),a(O1,"basePickBy");function g5(u){return function(d){return za(d,u)}}i(g5,"basePropertyDeep"),a(g5,"basePropertyDeep");function wh(u,d,S,$){var te=$?e3: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&&ah.call(Ee,xe,1),ah.call(u,xe,1);return u}i(wh,"basePullAll"),a(wh,"basePullAll");function N1(u,d){for(var S=u?d.length:0,$=S-1;S--;){var te=d[S];if(S==$||te!==ce){var ce=te;Io(te)?ah.call(u,te,1):Sh(u,te)}}return u}i(N1,"basePullAt"),a(N1,"basePullAt");function _h(u,d){return u+uh(w3()*(d-u+1))}i(_h,"baseRandom"),a(_h,"baseRandom");function v5(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(v5,"baseRange"),a(v5,"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"),a(Eh,"baseRepeat");function Ut(u,d){return fg(ug(u,d,Rn),u+"")}i(Ut,"baseRest"),a(Ut,"baseRest");function y5(u){return y1(zs(u))}i(y5,"baseSample"),a(y5,"baseSample");function b5(u,d){var S=zs(u);return sf(S,ja(d,0,S.length))}i(b5,"baseSampleSize"),a(b5,"baseSampleSize");function ru(u,d,S,$){if(!kr(u))return u;d=ua(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:Io(d[te+1])?[]:{})}Xc(Ee,xe,Ue),Ee=Ee[xe]}return u}i(ru,"baseSet"),a(ru,"baseSet");var w5=lh?function(u,d){return lh.set(u,d),u}:Rn,xD=sh?function(u,d){return sh(u,"toString",{configurable:!0,enumerable:!1,value:qh(d),writable:!0})}:Rn;function _5(u){return sf(zs(u))}i(_5,"baseShuffle"),a(_5,"baseShuffle");function ai(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(ai,"baseSlice"),a(ai,"baseSlice");function E5(u,d){var S;return $a(u,function($,te,ce){return S=d($,te,ce),!S}),!!S}i(E5,"baseSome"),a(E5,"baseSome");function Zl(u,d,S){var $=0,te=u==null?$:u.length;if(typeof d=="number"&&d===d&&te<=q){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"),a(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"),a(Ah,"baseSortedIndexBy");function P1(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(P1,"baseSortedUniq"),a(P1,"baseSortedUniq");function B1(u){return typeof u=="number"?u:zn(u)?C:+u}i(B1,"baseToNumber"),a(B1,"baseToNumber");function $n(u){if(typeof u=="string")return u;if(Nt(u))return Mr(u,$n)+"";if(zn(u))return _3?_3.call(u):"";var d=u+"";return d=="0"&&1/u==-m?"-0":d}i($n,"baseToString"),a($n,"baseToString");function ca(u,d,S){var $=-1,te=Ll,ce=u.length,ye=!0,Ee=[],xe=Ee;if(S)ye=!1,te=qd;else if(ce>=o){var Ue=d?null:CD(u);if(Ue)return Fl(Ue);ye=!1,te=Gc,xe=new Fa}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(ca,"baseUniq"),a(ca,"baseUniq");function Sh(u,d){return d=ua(d,u),u=lg(u,d),u==null||delete u[Qi(si(d))]}i(Sh,"baseUnset"),a(Sh,"baseUnset");function L1(u,d,S,$){return ru(u,d,S(za(u,d)),$)}i(L1,"baseUpdate"),a(L1,"baseUpdate");function Yl(u,d,S,$){for(var te=u.length,ce=$?te:-1;($?ce--:++ce<te)&&d(u[ce],ce,u););return S?ai(u,$?0:ce,$?ce+1:te):ai(u,$?ce+1:0,$?te:ce)}i(Yl,"baseWhile"),a(Yl,"baseWhile");function U1(u,d){var S=u;return S instanceof Kt&&(S=S.value()),Vd(d,function($,te){return te.func.apply(te.thisArg,aa([$],te.args))},S)}i(U1,"baseWrapperValue"),a(U1,"baseWrapperValue");function xh(u,d,S){var $=u.length;if($<2)return $?ca(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 ca(Xr(ce,1),d,S)}i(xh,"baseXor"),a(xh,"baseXor");function F1(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(F1,"baseZipObject"),a(F1,"baseZipObject");function Th(u){return Pr(u)?u:[]}i(Th,"castArrayLikeObject"),a(Th,"castArrayLikeObject");function Ch(u){return typeof u=="function"?u:Rn}i(Ch,"castFunction"),a(Ch,"castFunction");function ua(u,d){return Nt(u)?u:Nh(u,d)?[u]:X5(dr(u))}i(ua,"castPath"),a(ua,"castPath");var TD=Ut;function la(u,d,S){var $=u.length;return S=S===r?$:S,!d&&S>=$?u:ai(u,d,S)}i(la,"castSlice"),a(la,"castSlice");var A5=fD||function(u){return Fr.clearTimeout(u)};function j1(u,d){if(d)return u.slice();var S=u.length,$=m3?m3(S):new u.constructor(S);return u.copy($),$}i(j1,"cloneBuffer"),a(j1,"cloneBuffer");function Mh(u){var d=new u.constructor(u.byteLength);return new ih(d).set(new ih(u)),d}i(Mh,"cloneArrayBuffer"),a(Mh,"cloneArrayBuffer");function S5(u,d){var S=d?Mh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.byteLength)}i(S5,"cloneDataView"),a(S5,"cloneDataView");function x5(u){var d=new u.constructor(u.source,yt.exec(u));return d.lastIndex=u.lastIndex,d}i(x5,"cloneRegExp"),a(x5,"cloneRegExp");function T5(u){return ql?br(ql.call(u)):{}}i(T5,"cloneSymbol"),a(T5,"cloneSymbol");function $1(u,d){var S=d?Mh(u.buffer):u.buffer;return new u.constructor(S,u.byteOffset,u.length)}i($1,"cloneTypedArray"),a($1,"cloneTypedArray");function z1(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(z1,"compareAscending"),a(z1,"compareAscending");function C5(u,d,S){for(var $=-1,te=u.criteria,ce=d.criteria,ye=te.length,Ee=S.length;++$<ye;){var xe=z1(te[$],ce[$]);if(xe){if($>=Ee)return xe;var Ue=S[$];return xe*(Ue=="desc"?-1:1)}}return u.index-d.index}i(C5,"compareMultiple"),a(C5,"compareMultiple");function H1(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(H1,"composeArgs"),a(H1,"composeArgs");function q1(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(q1,"composeArgsRight"),a(q1,"composeArgsRight");function In(u,d){var S=-1,$=u.length;for(d||(d=ke($));++S<$;)d[S]=u[S];return d}i(In,"copyArray"),a(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?To(S,Ee,xe):Xc(S,Ee,xe)}return S}i(Xi,"copyObject"),a(Xi,"copyObject");function M5(u,d){return Xi(u,ig(u),d)}i(M5,"copySymbols"),a(M5,"copySymbols");function I5(u,d){return Xi(u,L5(u),d)}i(I5,"copySymbolsIn"),a(I5,"copySymbolsIn");function Xl(u,d){return function(S,$){var te=Nt(S)?J2:J3,ce=d?d():{};return te(S,u,wt($,2),ce)}}i(Xl,"createAggregator"),a(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=br(d);++$<te;){var Ee=S[$];Ee&&u(d,Ee,$,ce)}return d})}i(Us,"createAssigner"),a(Us,"createAssigner");function V1(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=br(S);(d?ce--:++ce<te)&&$(ye[ce],ce,ye)!==!1;);return S}}i(V1,"createBaseEach"),a(V1,"createBaseEach");function K1(u){return function(d,S,$){for(var te=-1,ce=br(d),ye=$(d),Ee=ye.length;Ee--;){var xe=ye[u?Ee:++te];if(S(ce[xe],xe,ce)===!1)break}return d}}i(K1,"createBaseFor"),a(K1,"createBaseFor");function k5(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"),a(ce,"wrapper"),ce}i(k5,"createBind"),a(k5,"createBind");function G1(u){return function(d){d=dr(d);var S=Ps(d)?Oi(d):r,$=S?S[0]:d.charAt(0),te=S?la(S,1).join(""):d.slice(1);return $[u]()+te}}i(G1,"createCaseFirst"),a(G1,"createCaseFirst");function Fs(u){return function(d){return Vd($g(Fg(d).replace(Ol,"")),u,"")}}i(Fs,"createCompounder"),a(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"),a(nu,"createCtor");function D5(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?[]:sa(ye,xe);if(ce-=Ue.length,ce<S)return X1(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"),a(te,"wrapper"),te}i(D5,"createCurry"),a(D5,"createCurry");function W1(u){return function(d,S,$){var te=br(d);if(!kn(d)){var ce=wt(S,3);d=Zr(d),S=a(function(Ee){return ce(te[Ee],Ee,te)},"predicate")}var ye=u(d,S,$);return ye>-1?te[ce?d[ye]:ye]:r}}i(W1,"createFind"),a(W1,"createFind");function J1(u){return Mo(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"?ng(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(J1,"createFlow"),a(J1,"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|H),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=n3(Gt,_n);if($&&(Gt=H1(Gt,$,te,pt)),ce&&(Gt=q1(Gt,ce,ye,pt)),Ht-=qn,pt&&Ht<Ue){var jr=sa(Gt,_n);return X1(u,d,Ql,_t.placeholder,S,Gt,jr,Ee,xe,Ue-Ht)}var eo=$e?S:this,fa=Ye?eo[u]:u;return Ht=Gt.length,Ee?Gt=Z5(Gt,Ee):St&&Ht>1&&Gt.reverse(),Fe&&xe<Ht&&(Gt.length=xe),this&&this!==Fr&&this instanceof _t&&(fa=Lt||nu(fa)),fa.apply(eo,Gt)}return i(_t,"wrapper"),a(_t,"wrapper"),_t}i(Ql,"createHybrid"),a(Ql,"createHybrid");function Z1(u,d){return function(S,$){return o5(S,u,d($),{})}}i(Z1,"createInverter"),a(Z1,"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=B1(S),$=B1($)),te=u(S,$)}return te}}i(ef,"createMathOperation"),a(ef,"createMathOperation");function Ih(u){return Mo(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"),a(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)?la(Oi($),0,u).join(""):$.slice(0,u)}i(tf,"createPadding"),a(tf,"createPadding");function R5(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"),a(ye,"wrapper"),ye}i(R5,"createPartial"),a(R5,"createPartial");function Y1(u){return function(d,S,$){return $&&typeof $!="number"&&wn(d,S,$)&&(S=$=r),d=Do(d),S===r?(S=d,d=0):S=Do(S),$=$===r?d<S?1:-1:Do($),v5(d,S,$,u)}}i(Y1,"createRange"),a(Y1,"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"),a(rf,"createRelationalOperation");function X1(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)&&Y5(_t,Lt),_t.placeholder=$,dg(_t,u,d)}i(X1,"createRecurry"),a(X1,"createRecurry");function kh(u){var d=Wr[u];return function(S,$){if(S=ci(S),$=$==null?0:vn(Pt($),292),$&&b3(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"),a(kh,"createRound");var CD=Jc&&1/Fl(new Jc([,-0]))[1]==m?function(u){return new Jc(u)}:Gh;function Q1(u){return function(d){var S=bn(d);return S==be?Xd(d):S==ee?c3(d):r3(d,u(d))}}i(Q1,"createToPairs"),a(Q1,"createToPairs");function Co(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:ng(u),pt=[u,d,S,$,te,Fe,$e,ce,ye,Ee];if(Ye&&G5(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|H)&&(d&=~(j|H)),!d||d==D)var St=k5(u,d,S);else d==j||d==H?St=D5(u,d,Ee):(d==Q||d==(D|Q))&&!te.length?St=R5(u,d,S,$):St=Ql.apply(r,pt);var Lt=Ye?w5:Y5;return dg(Lt(St,pt),u,d)}i(Co,"createWrap"),a(Co,"createWrap");function eg(u,d,S,$){return u===r||Bi(u,Wc[S])&&!gr.call($,S)?d:u}i(eg,"customDefaultsAssignIn"),a(eg,"customDefaultsAssignIn");function tg(u,d,S,$,te,ce){return kr(u)&&kr(d)&&(ce.set(d,u),Jl(u,d,r,tg,ce),ce.delete(d)),u}i(tg,"customDefaultsMerge"),a(tg,"customDefaultsMerge");function O5(u){return ou(u)?r:u}i(O5,"customOmitClone"),a(O5,"customOmitClone");function rg(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 Fa: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(rg,"equalArrays"),a(rg,"equalArrays");function N5(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 ae: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=rg(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(N5,"equalByTag"),a(N5,"equalByTag");function P5(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:gr.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(P5,"equalObjects"),a(P5,"equalObjects");function Mo(u){return fg(ug(u,r,vg),u+"")}i(Mo,"flatRest"),a(Mo,"flatRest");function Dh(u){return S1(u,Zr,ig)}i(Dh,"getAllKeys"),a(Dh,"getAllKeys");function Rh(u){return S1(u,Dn,L5)}i(Rh,"getAllKeysIn"),a(Rh,"getAllKeysIn");var ng=lh?function(u){return lh.get(u)}:Gh;function nf(u){for(var d=u.name+"",S=Zc[d],$=gr.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"),a(nf,"getFuncName");function js(u){var d=gr.call(se,"placeholder")?se:u;return d.placeholder}i(js,"getHolder"),a(js,"getHolder");function wt(){var u=se.iteratee||Vh;return u=u===Vh?C1:u,arguments.length?u(arguments[0],arguments[1]):u}i(wt,"getIteratee"),a(wt,"getIteratee");function of(u,d){var S=u.__data__;return q5(d)?S[typeof d=="string"?"string":"hash"]:S.map}i(of,"getMapData"),a(of,"getMapData");function Oh(u){for(var d=Zr(u),S=d.length;S--;){var $=d[S],te=u[$];d[S]=[$,te,sg(te)]}return d}i(Oh,"getMatchData"),a(Oh,"getMatchData");function Ha(u,d){var S=o3(u,d);return T1(S)?S:r}i(Ha,"getNative"),a(Ha,"getNative");function B5(u){var d=gr.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(B5,"getRawTag"),a(B5,"getRawTag");var ig=p1?function(u){return u==null?[]:(u=br(u),oa(p1(u),function(d){return v3.call(u,d)}))}:Wh,L5=p1?function(u){for(var d=[];u;)aa(d,ig(u)),u=oh(u);return d}:Wh,bn=yn;(m1&&bn(new m1(new ArrayBuffer(1)))!=ve||$l&&bn(new $l)!=be||g1&&bn(g1.resolve())!=F||Jc&&bn(new Jc)!=ee||zl&&bn(new zl)!=Ie)&&(bn=a(function(u){var d=yn(u),S=d==N?u.constructor:r,$=S?qa(S):"";if($)switch($){case wD:return ve;case _D:return be;case ED:return F;case AD:return ee;case SD:return Ie}return d},"getTag"));function U5(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(U5,"getView"),a(U5,"getView");function F5(u){var d=u.match(Ze);return d?d[1].split(cr):[]}i(F5,"getWrapDetails"),a(F5,"getWrapDetails");function og(u,d,S){d=ua(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)&&Io(ye,te)&&(Nt(u)||$s(u)))}i(og,"hasPath"),a(og,"hasPath");function j5(u){var d=u.length,S=new u.constructor(d);return d&&typeof u[0]=="string"&&gr.call(u,"index")&&(S.index=u.index,S.input=u.input),S}i(j5,"initCloneArray"),a(j5,"initCloneArray");function ag(u){return typeof u.constructor=="function"&&!iu(u)?Yc(oh(u)):{}}i(ag,"initCloneObject"),a(ag,"initCloneObject");function $5(u,d,S){var $=u.constructor;switch(d){case qe:return Mh(u);case ne:case ae:return new $(+u);case ve:return S5(u,S);case pe:case re:case le:case _e:case Te:case Ce:case Oe:case Ct:case Ve:return $1(u,S);case be:return new $;case Re:case ue:return new $(u);case ie:return x5(u);case ee:return new $;case Ae:return T5(u)}}i($5,"initCloneByTag"),a($5,"initCloneByTag");function z5(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(at,`{
|
|
25
25
|
/* [wrapped with `+d+`] */
|
|
26
26
|
`)}i(z5,"insertWrapDetails"),a(z5,"insertWrapDetails");function H5(u){return Nt(u)||$s(u)||!!(y3&&u&&u[y3])}i(H5,"isFlattenable"),a(H5,"isFlattenable");function Io(u,d){var S=typeof u;return d=d??E,!!d&&(S=="number"||S!="symbol"&&on.test(u))&&u>-1&&u%1==0&&u<d}i(Io,"isIndex"),a(Io,"isIndex");function wn(u,d,S){if(!kr(S))return!1;var $=typeof d;return($=="number"?kn(S)&&Io(d,S.length):$=="string"&&d in S)?Bi(S[d],u):!1}i(wn,"isIterateeCall"),a(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)||!ar.test(u)||d!=null&&u in br(d)}i(Nh,"isKey"),a(Nh,"isKey");function q5(u){var d=typeof u;return d=="string"||d=="number"||d=="symbol"||d=="boolean"?u!=="__proto__":u===null}i(q5,"isKeyable"),a(q5,"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 $=ng(S);return!!$&&u===$[0]}i(Ph,"isLaziable"),a(Ph,"isLaziable");function V5(u){return!!p3&&p3 in u}i(V5,"isMasked"),a(V5,"isMasked");var MD=eh?ko:Jh;function iu(u){var d=u&&u.constructor,S=typeof d=="function"&&d.prototype||Wc;return u===S}i(iu,"isPrototype"),a(iu,"isPrototype");function sg(u){return u===u&&!kr(u)}i(sg,"isStrictComparable"),a(sg,"isStrictComparable");function cg(u,d){return function(S){return S==null?!1:S[u]===d&&(d!==r||u in br(S))}}i(cg,"matchesStrictComparable"),a(cg,"matchesStrictComparable");function K5(u){var d=lf(u,function($){return S.size===p&&S.clear(),$}),S=d.cache;return d}i(K5,"memoizeCapped"),a(K5,"memoizeCapped");function G5(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?H1(xe,Ee,d[4]):Ee,u[4]=xe?sa(u[3],g):d[4]}return Ee=d[5],Ee&&(xe=u[5],u[5]=xe?q1(xe,Ee,d[6]):Ee,u[6]=xe?sa(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(G5,"mergeData"),a(G5,"mergeData");function W5(u){var d=[];if(u!=null)for(var S in br(u))d.push(S);return d}i(W5,"nativeKeysIn"),a(W5,"nativeKeysIn");function J5(u){return rh.call(u)}i(J5,"objectToString"),a(J5,"objectToString");function ug(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(ug,"overRest"),a(ug,"overRest");function lg(u,d){return d.length<2?u:za(u,ai(d,0,-1))}i(lg,"parent"),a(lg,"parent");function Z5(u,d){for(var S=u.length,$=vn(d.length,S),te=In(u);$--;){var ce=d[$];u[$]=Io(ce,S)?te[ce]:r}return u}i(Z5,"reorder"),a(Z5,"reorder");function Bh(u,d){if(!(d==="constructor"&&typeof u[d]=="function")&&d!="__proto__")return u[d]}i(Bh,"safeGet"),a(Bh,"safeGet");var Y5=hg(w5),af=hD||function(u,d){return Fr.setTimeout(u,d)},fg=hg(xD);function dg(u,d,S){var $=d+"";return fg(u,z5($,Q5(F5($),S)))}i(dg,"setWrapToString"),a(dg,"setWrapToString");function hg(u){var d=0,S=0;return function(){var $=vD(),te=w-($-S);if(S=$,te>0){if(++d>=Z)return arguments[0]}else d=0;return u.apply(r,arguments)}}i(hg,"shortOut"),a(hg,"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"),a(sf,"shuffleSelf");var X5=K5(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"),a(Qi,"toKey");function qa(u){if(u!=null){try{return th.call(u)}catch{}try{return u+""}catch{}}return""}i(qa,"toSource"),a(qa,"toSource");function Q5(u,d){return ni(I,function(S){var $="_."+S[0];d&S[1]&&!Ll(u,$)&&u.push($)}),u.sort()}i(Q5,"updateWrapDetails"),a(Q5,"updateWrapDetails");function pg(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(pg,"wrapperClone"),a(pg,"wrapperClone");function ew(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++]=ai(u,te,te+=d);return ye}i(ew,"chunk"),a(ew,"chunk");function tw(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(tw,"compact"),a(tw,"compact");function rw(){var u=arguments.length;if(!u)return[];for(var d=ke(u-1),S=arguments[0],$=u;$--;)d[$-1]=arguments[$];return aa(Nt(S)?In(S):[S],Xr(d,1))}i(rw,"concat4"),a(rw,"concat");var ID=Ut(function(u,d){return Pr(u)?Qc(u,Xr(d,1,Pr,!0)):[]}),kD=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)):[]}),DD=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 nw(u,d,S){var $=u==null?0:u.length;return $?(d=S||d===r?1:Pt(d),ai(u,d<0?0:d,$)):[]}i(nw,"drop"),a(nw,"drop");function iw(u,d,S){var $=u==null?0:u.length;return $?(d=S||d===r?1:Pt(d),d=$-d,ai(u,0,d<0?0:d)):[]}i(iw,"dropRight"),a(iw,"dropRight");function ow(u,d){return u&&u.length?Yl(u,wt(d,3),!0,!0):[]}i(ow,"dropRightWhile"),a(ow,"dropRightWhile");function aw(u,d){return u&&u.length?Yl(u,wt(d,3),!0):[]}i(aw,"dropWhile"),a(aw,"dropWhile");function sw(u,d,S,$){var te=u==null?0:u.length;return te?(S&&typeof S!="number"&&wn(u,d,S)&&(S=0,$=te),e5(u,d,S,$)):[]}i(sw,"fill"),a(sw,"fill");function mg(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(mg,"findIndex"),a(mg,"findIndex");function gg(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(gg,"findLastIndex"),a(gg,"findLastIndex");function vg(u){var d=u==null?0:u.length;return d?Xr(u,1):[]}i(vg,"flatten"),a(vg,"flatten");function cw(u){var d=u==null?0:u.length;return d?Xr(u,m):[]}i(cw,"flattenDeep"),a(cw,"flattenDeep");function uw(u,d){var S=u==null?0:u.length;return S?(d=d===r?1:Pt(d),Xr(u,d)):[]}i(uw,"flattenDepth"),a(uw,"flattenDepth");function lw(u){for(var d=-1,S=u==null?0:u.length,$={};++d<S;){var te=u[d];$[te[0]]=te[1]}return $}i(lw,"fromPairs"),a(lw,"fromPairs");function yg(u){return u&&u.length?u[0]:r}i(yg,"head"),a(yg,"head");function fw(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(fw,"indexOf"),a(fw,"indexOf");function dw(u){var d=u==null?0:u.length;return d?ai(u,0,-1):[]}i(dw,"initial"),a(dw,"initial");var RD=Ut(function(u){var d=Mr(u,Th);return d.length&&d[0]===u[0]?gh(d):[]}),OD=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)):[]}),ND=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 hw(u,d){return u==null?"":mD.call(u,d)}i(hw,"join"),a(hw,"join");function si(u){var d=u==null?0:u.length;return d?u[d-1]:r}i(si,"last2"),a(si,"last");function pw(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?l3(u,d,te):Ul(u,o1,te,!0)}i(pw,"lastIndexOf"),a(pw,"lastIndexOf");function mw(u,d){return u&&u.length?D1(u,Pt(d)):r}i(mw,"nth"),a(mw,"nth");var PD=Ut(bg);function bg(u,d){return u&&u.length&&d&&d.length?wh(u,d):u}i(bg,"pullAll"),a(bg,"pullAll");function gw(u,d,S){return u&&u.length&&d&&d.length?wh(u,d,wt(S,2)):u}i(gw,"pullAllBy"),a(gw,"pullAllBy");function vw(u,d,S){return u&&u.length&&d&&d.length?wh(u,d,r,S):u}i(vw,"pullAllWith"),a(vw,"pullAllWith");var BD=Mo(function(u,d){var S=u==null?0:u.length,$=hh(u,d);return N1(u,Mr(d,function(te){return Io(te,S)?+te:te}).sort(z1)),$});function yw(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 N1(u,te),S}i(yw,"remove"),a(yw,"remove");function Lh(u){return u==null?u:bD.call(u)}i(Lh,"reverse"),a(Lh,"reverse");function bw(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)),ai(u,d,S)):[]}i(bw,"slice2"),a(bw,"slice");function ww(u,d){return Zl(u,d)}i(ww,"sortedIndex"),a(ww,"sortedIndex");function _w(u,d,S){return Ah(u,d,wt(S,2))}i(_w,"sortedIndexBy"),a(_w,"sortedIndexBy");function Ew(u,d){var S=u==null?0:u.length;if(S){var $=Zl(u,d);if($<S&&Bi(u[$],d))return $}return-1}i(Ew,"sortedIndexOf"),a(Ew,"sortedIndexOf");function Aw(u,d){return Zl(u,d,!0)}i(Aw,"sortedLastIndex"),a(Aw,"sortedLastIndex");function Sw(u,d,S){return Ah(u,d,wt(S,2),!0)}i(Sw,"sortedLastIndexBy"),a(Sw,"sortedLastIndexBy");function xw(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(xw,"sortedLastIndexOf"),a(xw,"sortedLastIndexOf");function Tw(u){return u&&u.length?P1(u):[]}i(Tw,"sortedUniq"),a(Tw,"sortedUniq");function Cw(u,d){return u&&u.length?P1(u,wt(d,2)):[]}i(Cw,"sortedUniqBy"),a(Cw,"sortedUniqBy");function Mw(u){var d=u==null?0:u.length;return d?ai(u,1,d):[]}i(Mw,"tail"),a(Mw,"tail");function Iw(u,d,S){return u&&u.length?(d=S||d===r?1:Pt(d),ai(u,0,d<0?0:d)):[]}i(Iw,"take2"),a(Iw,"take");function kw(u,d,S){var $=u==null?0:u.length;return $?(d=S||d===r?1:Pt(d),d=$-d,ai(u,d<0?0:d,$)):[]}i(kw,"takeRight"),a(kw,"takeRight");function Dw(u,d){return u&&u.length?Yl(u,wt(d,3),!1,!0):[]}i(Dw,"takeRightWhile"),a(Dw,"takeRightWhile");function Rw(u,d){return u&&u.length?Yl(u,wt(d,3)):[]}i(Rw,"takeWhile"),a(Rw,"takeWhile");var LD=Ut(function(u){return ca(Xr(u,1,Pr,!0))}),UD=Ut(function(u){var d=si(u);return Pr(d)&&(d=r),ca(Xr(u,1,Pr,!0),wt(d,2))}),FD=Ut(function(u){var d=si(u);return d=typeof d=="function"?d:r,ca(Xr(u,1,Pr,!0),r,d)});function Ow(u){return u&&u.length?ca(u):[]}i(Ow,"uniq"),a(Ow,"uniq");function Nw(u,d){return u&&u.length?ca(u,wt(d,2)):[]}i(Nw,"uniqBy"),a(Nw,"uniqBy");function Pw(u,d){return d=typeof d=="function"?d:r,u&&u.length?ca(u,r,d):[]}i(Pw,"uniqWith"),a(Pw,"uniqWith");function Uh(u){if(!(u&&u.length))return[];var d=0;return u=oa(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"),a(Uh,"unzip");function wg(u,d){if(!(u&&u.length))return[];var S=Uh(u);return d==null?S:Mr(S,function($){return Fn(d,r,$)})}i(wg,"unzipWith"),a(wg,"unzipWith");var jD=Ut(function(u,d){return Pr(u)?Qc(u,d):[]}),$D=Ut(function(u){return xh(oa(u,Pr))}),zD=Ut(function(u){var d=si(u);return Pr(d)&&(d=r),xh(oa(u,Pr),wt(d,2))}),HD=Ut(function(u){var d=si(u);return d=typeof d=="function"?d:r,xh(oa(u,Pr),r,d)}),qD=Ut(Uh);function Bw(u,d){return F1(u||[],d||[],Xc)}i(Bw,"zipObject"),a(Bw,"zipObject");function Lw(u,d){return F1(u||[],d||[],ru)}i(Lw,"zipObjectDeep"),a(Lw,"zipObjectDeep");var VD=Ut(function(u){var d=u.length,S=d>1?u[d-1]:r;return S=typeof S=="function"?(u.pop(),S):r,wg(u,S)});function _g(u){var d=se(u);return d.__chain__=!0,d}i(_g,"chain"),a(_g,"chain");function Uw(u,d){return d(u),u}i(Uw,"tap"),a(Uw,"tap");function cf(u,d){return d(u)}i(cf,"thru"),a(cf,"thru");var KD=Mo(function(u){var d=u.length,S=d?u[0]:0,$=this.__wrapped__,te=a(function(ce){return hh(ce,u)},"interceptor");return d>1||this.__actions__.length||!($ instanceof Kt)||!Io(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 Fw(){return _g(this)}i(Fw,"wrapperChain"),a(Fw,"wrapperChain");function jw(){return new ii(this.value(),this.__chain__)}i(jw,"wrapperCommit"),a(jw,"wrapperCommit");function $w(){this.__values__===r&&(this.__values__=Ng(this.value()));var u=this.__index__>=this.__values__.length,d=u?r:this.__values__[this.__index__++];return{done:u,value:d}}i($w,"wrapperNext"),a($w,"wrapperNext");function zw(){return this}i(zw,"wrapperToIterator"),a(zw,"wrapperToIterator");function Hw(u){for(var d,S=this;S instanceof Vl;){var $=pg(S);$.__index__=0,$.__values__=r,d?te.__wrapped__=$:d=$;var te=$;S=S.__wrapped__}return te.__wrapped__=u,d}i(Hw,"wrapperPlant"),a(Hw,"wrapperPlant");function qw(){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(qw,"wrapperReverse"),a(qw,"wrapperReverse");function Vw(){return U1(this.__wrapped__,this.__actions__)}i(Vw,"wrapperValue"),a(Vw,"wrapperValue");var GD=Xl(function(u,d,S){gr.call(u,S)?++u[S]:To(u,S,1)});function Kw(u,d,S){var $=Nt(u)?n1:Q3;return S&&wn(u,d,S)&&(d=r),$(u,wt(d,3))}i(Kw,"every"),a(Kw,"every");function Gw(u,d){var S=Nt(u)?oa:E1;return S(u,wt(d,3))}i(Gw,"filter2"),a(Gw,"filter");var WD=W1(mg),JD=W1(gg);function Ww(u,d){return Xr(uf(u,d),1)}i(Ww,"flatMap"),a(Ww,"flatMap");function Jw(u,d){return Xr(uf(u,d),m)}i(Jw,"flatMapDeep"),a(Jw,"flatMapDeep");function Zw(u,d,S){return S=S===r?1:Pt(S),Xr(uf(u,d),S)}i(Zw,"flatMapDepth"),a(Zw,"flatMapDepth");function Eg(u,d){var S=Nt(u)?ni:$a;return S(u,wt(d,3))}i(Eg,"forEach"),a(Eg,"forEach");function Ag(u,d){var S=Nt(u)?Z2:X3;return S(u,wt(d,3))}i(Ag,"forEachRight"),a(Ag,"forEachRight");var ZD=Xl(function(u,d,S){gr.call(u,S)?u[S].push(d):To(u,S,[d])});function Yw(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(Yw,"includes"),a(Yw,"includes");var YD=Ut(function(u,d,S){var $=-1,te=typeof d=="function",ce=kn(u)?ke(u.length):[];return $a(u,function(ye){ce[++$]=te?Fn(d,ye,S):eu(ye,d,S)}),ce}),XD=Xl(function(u,d,S){To(u,S,d)});function uf(u,d){var S=Nt(u)?Mr:M1;return S(u,wt(d,3))}i(uf,"map2"),a(uf,"map");function Xw(u,d,S,$){return u==null?[]:(Nt(d)||(d=d==null?[]:[d]),S=$?r:S,Nt(S)||(S=S==null?[]:[S]),R1(u,d,S))}i(Xw,"orderBy"),a(Xw,"orderBy");var QD=Xl(function(u,d,S){u[S?0:1].push(d)},function(){return[[],[]]});function Qw(u,d,S){var $=Nt(u)?Vd:s1,te=arguments.length<3;return $(u,wt(d,4),S,te,$a)}i(Qw,"reduce"),a(Qw,"reduce");function e4(u,d,S){var $=Nt(u)?Y2:s1,te=arguments.length<3;return $(u,wt(d,4),S,te,X3)}i(e4,"reduceRight"),a(e4,"reduceRight");function t4(u,d){var S=Nt(u)?oa:E1;return S(u,ff(wt(d,3)))}i(t4,"reject"),a(t4,"reject");function r4(u){var d=Nt(u)?y1:y5;return d(u)}i(r4,"sample"),a(r4,"sample");function n4(u,d,S){(S?wn(u,d,S):d===r)?d=1:d=Pt(d);var $=Nt(u)?G3:b5;return $(u,d)}i(n4,"sampleSize"),a(n4,"sampleSize");function i4(u){var d=Nt(u)?W3:_5;return d(u)}i(i4,"shuffle"),a(i4,"shuffle");function o4(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(o4,"size"),a(o4,"size");function a4(u,d,S){var $=Nt(u)?Kd:E5;return S&&wn(u,d,S)&&(d=r),$(u,wt(d,3))}i(a4,"some"),a(a4,"some");var eR=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]]),R1(u,Xr(d,1),[])}),Fh=dD||function(){return Fr.Date.now()};function s4(u,d){if(typeof d!="function")throw new Ni(c);return u=Pt(u),function(){if(--u<1)return d.apply(this,arguments)}}i(s4,"after"),a(s4,"after");function Sg(u,d,S){return d=S?r:d,d=u&&d==null?u.length:d,Co(u,k,r,r,r,r,d)}i(Sg,"ary"),a(Sg,"ary");function xg(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(xg,"before"),a(xg,"before");var Tg=Ut(function(u,d,S){var $=D;if(S.length){var te=sa(S,js(Tg));$|=Q}return Co(u,$,d,S,te)}),c4=Ut(function(u,d,S){var $=D|P;if(S.length){var te=sa(S,js(c4));$|=Q}return Co(d,$,u,S,te)});function Cg(u,d,S){d=S?r:d;var $=Co(u,j,r,r,r,r,r,d);return $.placeholder=Cg.placeholder,$}i(Cg,"curry"),a(Cg,"curry");function Mg(u,d,S){d=S?r:d;var $=Co(u,H,r,r,r,r,r,d);return $.placeholder=Mg.placeholder,$}i(Mg,"curryRight"),a(Mg,"curryRight");function Ig(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 eo=$,fa=te;return $=te=r,Ue=jr,ye=u.apply(fa,eo),ye}i(pt,"invokeFunc"),a(pt,"invokeFunc");function St(jr){return Ue=jr,Ee=af(Ht,d),Fe?pt(jr):ye}i(St,"leadingEdge"),a(St,"leadingEdge");function Lt(jr){var eo=jr-xe,fa=jr-Ue,i8=d-eo;return $e?vn(i8,ce-fa):i8}i(Lt,"remainingWait"),a(Lt,"remainingWait");function _t(jr){var eo=jr-xe,fa=jr-Ue;return xe===r||eo>=d||eo<0||$e&&fa>=ce}i(_t,"shouldInvoke"),a(_t,"shouldInvoke");function Ht(){var jr=Fh();if(_t(jr))return Gt(jr);Ee=af(Ht,Lt(jr))}i(Ht,"timerExpired"),a(Ht,"timerExpired");function Gt(jr){return Ee=r,Ye&&$?pt(jr):($=te=r,ye)}i(Gt,"trailingEdge"),a(Gt,"trailingEdge");function Hn(){Ee!==r&&A5(Ee),Ue=0,$=xe=te=Ee=r}i(Hn,"cancel"),a(Hn,"cancel");function _n(){return Ee===r?ye:Gt(Fh())}i(_n,"flush"),a(_n,"flush");function qn(){var jr=Fh(),eo=_t(jr);if($=arguments,te=this,xe=jr,eo){if(Ee===r)return St(xe);if($e)return A5(Ee),Ee=af(Ht,d),pt(xe)}return Ee===r&&(Ee=af(Ht,d)),ye}return i(qn,"debounced"),a(qn,"debounced"),qn.cancel=Hn,qn.flush=_n,qn}i(Ig,"debounce"),a(Ig,"debounce");var tR=Ut(function(u,d){return _1(u,1,d)}),rR=Ut(function(u,d,S){return _1(u,ci(d)||0,S)});function u4(u){return Co(u,he)}i(u4,"flip"),a(u4,"flip");function lf(u,d){if(typeof u!="function"||d!=null&&typeof d!="function")throw new Ni(c);var S=a(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||xo),S}i(lf,"memoize"),a(lf,"memoize"),lf.Cache=xo;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"),a(ff,"negate");function l4(u){return xg(2,u)}i(l4,"once"),a(l4,"once");var nR=TD(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,$)})}),kg=Ut(function(u,d){var S=sa(d,js(kg));return Co(u,Q,r,d,S)}),f4=Ut(function(u,d){var S=sa(d,js(f4));return Co(u,Y,r,d,S)}),iR=Mo(function(u,d){return Co(u,K,r,r,r,d)});function d4(u,d){if(typeof u!="function")throw new Ni(c);return d=d===r?d:Pt(d),Ut(u,d)}i(d4,"rest"),a(d4,"rest");function h4(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=la(S,0,d);return $&&aa(te,$),Fn(u,this,te)})}i(h4,"spread"),a(h4,"spread");function p4(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),Ig(u,d,{leading:$,maxWait:d,trailing:te})}i(p4,"throttle2"),a(p4,"throttle");function m4(u){return Sg(u,1)}i(m4,"unary"),a(m4,"unary");function g4(u,d){return kg(Ch(d),u)}i(g4,"wrap"),a(g4,"wrap");function v4(){if(!arguments.length)return[];var u=arguments[0];return Nt(u)?u:[u]}i(v4,"castArray"),a(v4,"castArray");function y4(u){return oi(u,_)}i(y4,"clone"),a(y4,"clone");function b4(u,d){return d=typeof d=="function"?d:r,oi(u,_,d)}i(b4,"cloneWith"),a(b4,"cloneWith");function w4(u){return oi(u,v|_)}i(w4,"cloneDeep6"),a(w4,"cloneDeep");function _4(u,d){return d=typeof d=="function"?d:r,oi(u,v|_,d)}i(_4,"cloneDeepWith"),a(_4,"cloneDeepWith");function E4(u,d){return d==null||w1(u,d,Zr(d))}i(E4,"conformsTo"),a(E4,"conformsTo");function Bi(u,d){return u===d||u!==u&&d!==d}i(Bi,"eq4"),a(Bi,"eq");var oR=rf(mh),aR=rf(function(u,d){return u>=d}),$s=x1(function(){return arguments}())?x1:function(u){return Rr(u)&&gr.call(u,"callee")&&!v3.call(u,"callee")},Nt=ke.isArray,sR=Os?jn(Os):a5;function kn(u){return u!=null&&df(u.length)&&!ko(u)}i(kn,"isArrayLike2"),a(kn,"isArrayLike");function Pr(u){return Rr(u)&&kn(u)}i(Pr,"isArrayLikeObject"),a(Pr,"isArrayLikeObject");function A4(u){return u===!0||u===!1||Rr(u)&&yn(u)==ne}i(A4,"isBoolean"),a(A4,"isBoolean");var Va=pD||Jh,cR=q2?jn(q2):s5;function S4(u){return Rr(u)&&u.nodeType===1&&!ou(u)}i(S4,"isElement"),a(S4,"isElement");function x4(u){if(u==null)return!0;if(kn(u)&&(Nt(u)||typeof u=="string"||typeof u.splice=="function"||Va(u)||au(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(gr.call(u,S))return!1;return!0}i(x4,"isEmpty"),a(x4,"isEmpty");function T4(u,d){return tu(u,d)}i(T4,"isEqual"),a(T4,"isEqual");function C4(u,d,S){S=typeof S=="function"?S:r;var $=S?S(u,d):r;return $===r?tu(u,d,r,S):!!$}i(C4,"isEqualWith"),a(C4,"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"&&!ou(u)}i(jh,"isError"),a(jh,"isError");function M4(u){return typeof u=="number"&&b3(u)}i(M4,"isFinite2"),a(M4,"isFinite");function ko(u){if(!kr(u))return!1;var d=yn(u);return d==oe||d==fe||d==L||d==W}i(ko,"isFunction2"),a(ko,"isFunction");function Dg(u){return typeof u=="number"&&u==Pt(u)}i(Dg,"isInteger3"),a(Dg,"isInteger");function df(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=E}i(df,"isLength"),a(df,"isLength");function kr(u){var d=typeof u;return u!=null&&(d=="object"||d=="function")}i(kr,"isObject"),a(kr,"isObject");function Rr(u){return u!=null&&typeof u=="object"}i(Rr,"isObjectLike"),a(Rr,"isObjectLike");var I4=V2?jn(V2):u5;function k4(u,d){return u===d||vh(u,d,Oh(d))}i(k4,"isMatch"),a(k4,"isMatch");function D4(u,d,S){return S=typeof S=="function"?S:r,vh(u,d,Oh(d),S)}i(D4,"isMatchWith"),a(D4,"isMatchWith");function R4(u){return Rg(u)&&u!=+u}i(R4,"isNaN2"),a(R4,"isNaN");function O4(u){if(MD(u))throw new kt(s);return T1(u)}i(O4,"isNative"),a(O4,"isNative");function N4(u){return u===null}i(N4,"isNull"),a(N4,"isNull");function P4(u){return u==null}i(P4,"isNil"),a(P4,"isNil");function Rg(u){return typeof u=="number"||Rr(u)&&yn(u)==Re}i(Rg,"isNumber"),a(Rg,"isNumber");function ou(u){if(!Rr(u)||yn(u)!=N)return!1;var d=oh(u);if(d===null)return!0;var S=gr.call(d,"constructor")&&d.constructor;return typeof S=="function"&&S instanceof S&&th.call(S)==cD}i(ou,"isPlainObject"),a(ou,"isPlainObject");var Og=K2?jn(K2):l5;function B4(u){return Dg(u)&&u>=-E&&u<=E}i(B4,"isSafeInteger"),a(B4,"isSafeInteger");var L4=G2?jn(G2):f5;function hf(u){return typeof u=="string"||!Nt(u)&&Rr(u)&&yn(u)==ue}i(hf,"isString"),a(hf,"isString");function zn(u){return typeof u=="symbol"||Rr(u)&&yn(u)==Ae}i(zn,"isSymbol"),a(zn,"isSymbol");var au=W2?jn(W2):d5;function U4(u){return u===r}i(U4,"isUndefined"),a(U4,"isUndefined");function F4(u){return Rr(u)&&bn(u)==Ie}i(F4,"isWeakMap"),a(F4,"isWeakMap");function j4(u){return Rr(u)&&yn(u)==Be}i(j4,"isWeakSet"),a(j4,"isWeakSet");var uR=rf(bh),lR=rf(function(u,d){return u<=d});function Ng(u){if(!u)return[];if(kn(u))return hf(u)?Oi(u):In(u);if(jl&&u[jl])return s3(u[jl]());var d=bn(u),S=d==be?Xd:d==ee?Fl:zs;return S(u)}i(Ng,"toArray"),a(Ng,"toArray");function Do(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(Do,"toFinite"),a(Do,"toFinite");function Pt(u){var d=Do(u),S=d%1;return d===d?S?d-S:d:0}i(Pt,"toInteger"),a(Pt,"toInteger");function Pg(u){return u?ja(Pt(u),0,A):0}i(Pg,"toLength"),a(Pg,"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=c1(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"),a(ci,"toNumber");function Bg(u){return Xi(u,Dn(u))}i(Bg,"toPlainObject"),a(Bg,"toPlainObject");function $4(u){return u?ja(Pt(u),-E,E):u===0?u:0}i($4,"toSafeInteger"),a($4,"toSafeInteger");function dr(u){return u==null?"":$n(u)}i(dr,"toString4"),a(dr,"toString");var fR=Us(function(u,d){if(iu(d)||kn(d)){Xi(d,Zr(d),u);return}for(var S in d)gr.call(d,S)&&Xc(u,S,d[S])}),z4=Us(function(u,d){Xi(d,Dn(d),u)}),$h=Us(function(u,d,S,$){Xi(d,Dn(d),u,$)}),dR=Us(function(u,d,S,$){Xi(d,Zr(d),u,$)}),hR=Mo(hh);function H4(u,d){var S=Yc(u);return d==null?S:b1(S,d)}i(H4,"create2"),a(H4,"create");var pR=Ut(function(u,d){u=br(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])&&!gr.call(u,Ue))&&(u[Ue]=ce[Ue])}return u}),mR=Ut(function(u){return u.push(r,tg),Fn(t_,r,u)});function q4(u,d){return i1(u,wt(d,3),Yi)}i(q4,"findKey"),a(q4,"findKey");function V4(u,d){return i1(u,wt(d,3),ph)}i(V4,"findLastKey"),a(V4,"findLastKey");function K4(u,d){return u==null?u:A1(u,wt(d,3),Dn)}i(K4,"forIn"),a(K4,"forIn");function G4(u,d){return u==null?u:t5(u,wt(d,3),Dn)}i(G4,"forInRight"),a(G4,"forInRight");function W4(u,d){return u&&Yi(u,wt(d,3))}i(W4,"forOwn"),a(W4,"forOwn");function J4(u,d){return u&&ph(u,wt(d,3))}i(J4,"forOwnRight"),a(J4,"forOwnRight");function Z4(u){return u==null?[]:Wl(u,Zr(u))}i(Z4,"functions"),a(Z4,"functions");function Y4(u){return u==null?[]:Wl(u,Dn(u))}i(Y4,"functionsIn"),a(Y4,"functionsIn");function zh(u,d,S){var $=u==null?r:za(u,d);return $===r?S:$}i(zh,"get2"),a(zh,"get");function X4(u,d){return u!=null&&og(u,d,r5)}i(X4,"has"),a(X4,"has");function Hh(u,d){return u!=null&&og(u,d,n5)}i(Hh,"hasIn"),a(Hh,"hasIn");var gR=Z1(function(u,d,S){d!=null&&typeof d.toString!="function"&&(d=rh.call(d)),u[d]=S},qh(Rn)),vR=Z1(function(u,d,S){d!=null&&typeof d.toString!="function"&&(d=rh.call(d)),gr.call(u,d)?u[d].push(S):u[d]=[S]},wt),yR=Ut(eu);function Zr(u){return kn(u)?v1(u):yh(u)}i(Zr,"keys"),a(Zr,"keys");function Dn(u){return kn(u)?v1(u,!0):h5(u)}i(Dn,"keysIn"),a(Dn,"keysIn");function Q4(u,d){var S={};return d=wt(d,3),Yi(u,function($,te,ce){To(S,d($,te,ce),$)}),S}i(Q4,"mapKeys"),a(Q4,"mapKeys");function e_(u,d){var S={};return d=wt(d,3),Yi(u,function($,te,ce){To(S,te,d($,te,ce))}),S}i(e_,"mapValues"),a(e_,"mapValues");var bR=Us(function(u,d,S){Jl(u,d,S)}),t_=Us(function(u,d,S,$){Jl(u,d,S,$)}),wR=Mo(function(u,d){var S={};if(u==null)return S;var $=!1;d=Mr(d,function(ce){return ce=ua(ce,u),$||($=ce.length>1),ce}),Xi(u,Rh(u),S),$&&(S=oi(S,v|y|_,O5));for(var te=d.length;te--;)Sh(S,d[te]);return S});function r_(u,d){return Lg(u,ff(wt(d)))}i(r_,"omitBy"),a(r_,"omitBy");var _R=Mo(function(u,d){return u==null?{}:m5(u,d)});function Lg(u,d){if(u==null)return{};var S=Mr(Rh(u),function($){return[$]});return d=wt(d),O1(u,S,function($,te){return d($,te[0])})}i(Lg,"pickBy"),a(Lg,"pickBy");function n_(u,d,S){d=ua(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=ko(ce)?ce.call(u):ce}return u}i(n_,"result"),a(n_,"result");function i_(u,d,S){return u==null?u:ru(u,d,S)}i(i_,"set"),a(i_,"set");function o_(u,d,S,$){return $=typeof $=="function"?$:r,u==null?u:ru(u,d,S,$)}i(o_,"setWith"),a(o_,"setWith");var a_=Q1(Zr),s_=Q1(Dn);function c_(u,d,S){var $=Nt(u),te=$||Va(u)||au(u);if(d=wt(d,4),S==null){var ce=u&&u.constructor;te?S=$?new ce:[]:kr(u)?S=ko(ce)?Yc(oh(u)):{}:S={}}return(te?ni:Yi)(u,function(ye,Ee,xe){return d(S,ye,Ee,xe)}),S}i(c_,"transform"),a(c_,"transform");function u_(u,d){return u==null?!0:Sh(u,d)}i(u_,"unset"),a(u_,"unset");function l_(u,d,S){return u==null?u:L1(u,d,Ch(S))}i(l_,"update2"),a(l_,"update");function f_(u,d,S,$){return $=typeof $=="function"?$:r,u==null?u:L1(u,d,Ch(S),$)}i(f_,"updateWith"),a(f_,"updateWith");function zs(u){return u==null?[]:Yd(u,Zr(u))}i(zs,"values"),a(zs,"values");function d_(u){return u==null?[]:Yd(u,Dn(u))}i(d_,"valuesIn"),a(d_,"valuesIn");function h_(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),ja(ci(u),d,S)}i(h_,"clamp"),a(h_,"clamp");function p_(u,d,S){return d=Do(d),S===r?(S=d,d=0):S=Do(S),u=ci(u),i5(u,d,S)}i(p_,"inRange"),a(p_,"inRange");function m_(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=Do(u),d===r?(d=u,u=0):d=Do(d)),u>d){var $=u;u=d,d=$}if(S||u%1||d%1){var te=w3();return vn(u+te*(d-u+Kr("1e-"+((te+"").length-1))),d)}return _h(u,d)}i(m_,"random"),a(m_,"random");var ER=Fs(function(u,d,S){return d=d.toLowerCase(),u+(S?Ug(d):d)});function Ug(u){return jg(dr(u).toLowerCase())}i(Ug,"capitalize"),a(Ug,"capitalize");function Fg(u){return u=dr(u),u&&u.replace(Nr,tD).replace($d,"")}i(Fg,"deburr"),a(Fg,"deburr");function g_(u,d,S){u=dr(u),d=$n(d);var $=u.length;S=S===r?$:ja(Pt(S),0,$);var te=S;return S-=d.length,S>=0&&u.slice(S,te)==d}i(g_,"endsWith"),a(g_,"endsWith");function v_(u){return u=dr(u),u&&ut.test(u)?u.replace(Or,rD):u}i(v_,"escape"),a(v_,"escape");function y_(u){return u=dr(u),u&&ot.test(u)?u.replace(Qt,"\\$&"):u}i(y_,"escapeRegExp"),a(y_,"escapeRegExp");var AR=Fs(function(u,d,S){return u+(S?"-":"")+d.toLowerCase()}),SR=Fs(function(u,d,S){return u+(S?" ":"")+d.toLowerCase()}),xR=G1("toLowerCase");function b_(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(b_,"pad2"),a(b_,"pad");function w_(u,d,S){u=dr(u),d=Pt(d);var $=d?Bs(u):0;return d&&$<d?u+tf(d-$,S):u}i(w_,"padEnd"),a(w_,"padEnd");function __(u,d,S){u=dr(u),d=Pt(d);var $=d?Bs(u):0;return d&&$<d?tf(d-$,S)+u:u}i(__,"padStart"),a(__,"padStart");function E_(u,d,S){return S||d==null?d=0:d&&(d=+d),yD(dr(u).replace(et,""),d||0)}i(E_,"parseInt2"),a(E_,"parseInt");function A_(u,d,S){return(S?wn(u,d,S):d===r)?d=1:d=Pt(d),Eh(dr(u),d)}i(A_,"repeat"),a(A_,"repeat");function S_(){var u=arguments,d=dr(u[0]);return u.length<3?d:d.replace(u[1],u[2])}i(S_,"replace"),a(S_,"replace");var TR=Fs(function(u,d,S){return u+(S?"_":"")+d.toLowerCase()});function x_(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&&!Og(d))&&(d=$n(d),!d&&Ps(u))?la(Oi(u),0,S):u.split(d,S)):[]}i(x_,"split"),a(x_,"split");var CR=Fs(function(u,d,S){return u+(S?" ":"")+jg(d)});function T_(u,d,S){return u=dr(u),S=S==null?0:ja(Pt(S),0,u.length),d=$n(d),u.slice(S,S+d.length)==d}i(T_,"startsWith"),a(T_,"startsWith");function C_(u,d,S){var $=se.templateSettings;S&&wn(u,d,S)&&(d=r),u=dr(u),d=$h({},d,$,eg);var te=$h({},d.imports,$.imports,eg),ce=Zr(te),ye=Yd(te,ce),Ee,xe,Ue=0,Fe=d.interpolate||Vr,$e="__p += '",Ye=h1((d.escape||Vr).source+"|"+Fe.source+"|"+(Fe===nt?At:Vr).source+"|"+(d.evaluate||Vr).source+"|$","g"),pt="//# sourceURL="+(gr.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(an,i3),Ht&&(Ee=!0,$e+=`' +
|
|
@@ -842,7 +842,7 @@ HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
|
|
|
842
842
|
`;function iM(e){return typeof e=="string"&&(e=S0(e)),Fm(WC([S0($z),S0(String(e.length)),e]))}i(iM,"hashMessage");a(iM,"hashMessage");var Mt=ir(Dx()),Aa=ir(_m());function $c(e,t,r){return r={path:t,exports:{},require:function(n,o){return oM(n,o??r.path)}},e(r,r.exports),r.exports}i($c,"createCommonjsModule");a($c,"createCommonjsModule");function oM(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}i(oM,"commonjsRequire");a(oM,"commonjsRequire");var Y6=X6;function X6(e,t){if(!e)throw new Error(t||"Assertion failed")}i(X6,"assert");a(X6,"assert");X6.equal=a(i(function(t,r,n){if(t!=r)throw new Error(n||"Assertion failed: "+t+" != "+r)},"assertEqual"),"assertEqual");var ho=$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"),a(n,"toArray"),r.toArray=n;function o(c){return c.length===1?"0"+c:c}i(o,"zero2"),a(o,"zero2"),r.zero2=o;function s(c){for(var l="",h=0;h<c.length;h++)l+=o(c[h].toString(16));return l}i(s,"toHex"),a(s,"toHex"),r.toHex=s,r.encode=a(i(function(l,h){return h==="hex"?s(l):l},"encode9"),"encode")}),Si=$c(function(e,t){"use strict";var r=t;r.assert=Y6,r.toArray=ho.toArray,r.zero2=ho.zero2,r.toHex=ho.toHex,r.encode=ho.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"),a(n,"getNAF"),r.getNAF=n;function o(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(o,"getJSF2"),a(o,"getJSF"),r.getJSF=o;function s(h,p,g){var v="_"+p;h.prototype[p]=a(i(function(){return this[v]!==void 0?this[v]:this[v]=g.call(this)},"cachedProperty2"),"cachedProperty")}i(s,"cachedProperty"),a(s,"cachedProperty"),r.cachedProperty=s;function c(h){return typeof h=="string"?r.toArray(h,"hex"):h}i(c,"parseBytes"),a(c,"parseBytes"),r.parseBytes=c;function l(h){return new Mt.default(h,"hex","le")}i(l,"intFromLE"),a(l,"intFromLE"),r.intFromLE=l}),X0=Si.getNAF,zz=Si.getJSF,Q0=Si.assert;function Oa(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(Oa,"BaseCurve");a(Oa,"BaseCurve");var zc=Oa;Oa.prototype.point=a(i(function(){throw new Error("Not implemented")},"point"),"point");Oa.prototype.validate=a(i(function(){throw new Error("Not implemented")},"validate"),"validate");Oa.prototype._fixedNafMul=a(i(function(t,r){Q0(t.precomputed);var n=t._getDoubles(),o=X0(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<o.length;l+=n.step){h=0;for(var p=l+n.step-1;p>=l;p--)h=(h<<1)+o[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");Oa.prototype._wnafMul=a(i(function(t,r){var n=4,o=t._getNAFPoints(n);n=o.wnd;for(var s=o.points,c=X0(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];Q0(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");Oa.prototype._wnafMulAdd=a(i(function(t,r,n,o,s){var c=this._wnafT1,l=this._wnafT2,h=this._wnafT3,p=0,g,v,y;for(g=0;g<o;g++){y=r[g];var _=y._getNAFPoints(t);c[g]=_.wnd,l[g]=_.points}for(g=o-1;g>=1;g-=2){var x=g-1,O=g;if(c[x]!==1||c[O]!==1){h[x]=X0(n[x],c[x],this._bitLength),h[O]=X0(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=zz(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,H=J[1][v]|0;h[x][v]=P[(j+1)*3+(H+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<o;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<o;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<o;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");a(xi,"BasePoint");Oa.BasePoint=xi;xi.prototype.eq=a(i(function(){throw new Error("Not implemented")},"eq"),"eq");xi.prototype.validate=a(i(function(){return this.curve.validate(this)},"validate2"),"validate");Oa.prototype.decodePoint=a(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?Q0(t[t.length-1]%2===0):t[0]===7&&Q0(t[t.length-1]%2===1);var o=this.point(t.slice(1,1+n),t.slice(1+n,1+2*n));return o}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=a(i(function(t){return this.encode(t,!0)},"encodeCompressed"),"encodeCompressed");xi.prototype._encode=a(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=a(i(function(t,r){return Si.encode(this._encode(r),t)},"encode8"),"encode");xi.prototype.precompute=a(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=a(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=a(i(function(t,r){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],o=this,s=0;s<r;s+=t){for(var c=0;c<t;c++)o=o.dbl();n.push(o)}return{step:t,points:n}},"_getDoubles"),"_getDoubles");xi.prototype._getNAFPoints=a(i(function(t){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var r=[this],n=(1<<t)-1,o=n===1?null:this.dbl(),s=1;s<n;s++)r[s]=r[s-1].add(o);return{wnd:t,points:r}},"_getNAFPoints"),"_getNAFPoints");xi.prototype._getBeta=a(i(function(){return null},"_getBeta"),"_getBeta");xi.prototype.dblp=a(i(function(t){for(var r=this,n=0;n<t;n++)r=r.dbl();return r},"dblp"),"dblp");var Q6=$c(function(e){typeof Object.create=="function"?e.exports=a(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=a(i(function(r,n){if(n){r.super_=n;var o=a(function(){},"TempCtor");o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r}},"inherits"),"inherits")}),Hz=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");a(Ti,"ShortCurve");Q6(Ti,zc);var qz=Ti;Ti.prototype._getEndomorphism=a(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 o=this._getEndoRoots(this.p);r=o[0].cmp(o[1])<0?o[0]:o[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],Hz(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=a(i(function(t){var r=t===this.p?this.red:Mt.default.mont(t),n=new Mt.default(2).toRed(r).redInvm(),o=n.redNeg(),s=new Mt.default(3).toRed(r).redNeg().redSqrt().redMul(n),c=o.redAdd(s).fromRed(),l=o.redSub(s).fromRed();return[c,l]},"_getEndoRoots"),"_getEndoRoots");Ti.prototype._getEndoBasis=a(i(function(t){for(var r=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=t,o=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=o.div(n);P=o.sub(j.mul(n)),J=l.sub(j.mul(s));var H=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,o=n,n=P,l=s,s=J,h=c,c=H}_=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=a(i(function(t){var r=this.endo.basis,n=r[0],o=r[1],s=o.b.mul(t).divRound(this.n),c=n.b.neg().mul(t).divRound(this.n),l=s.mul(n.a),h=c.mul(o.a),p=s.mul(n.b),g=c.mul(o.b),v=t.sub(l).sub(h),y=p.add(g).neg();return{k1:v,k2:y}},"_endoSplit"),"_endoSplit");Ti.prototype.pointFromX=a(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),o=n.redSqrt();if(o.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var s=o.fromRed().isOdd();return(r&&!s||!r&&s)&&(o=o.redNeg()),this.point(t,o)},"pointFromX"),"pointFromX");Ti.prototype.validate=a(i(function(t){if(t.inf)return!0;var r=t.x,n=t.y,o=this.a.redMul(r),s=r.redSqr().redMul(r).redIAdd(o).redIAdd(this.b);return n.redSqr().redISub(s).cmpn(0)===0},"validate3"),"validate");Ti.prototype._endoWnafMulAdd=a(i(function(t,r,n){for(var o=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)),o[c*2]=h,o[c*2+1]=p,s[c*2]=l.k1,s[c*2+1]=l.k2}for(var g=this._wnafMulAdd(1,o,s,c*2,n),v=0;v<c*2;v++)o[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");a(Yr,"Point");Q6(Yr,zc.BasePoint);Ti.prototype.point=a(i(function(t,r,n){return new Yr(this,t,r,n)},"point2"),"point");Ti.prototype.pointFromJSON=a(i(function(t,r){return Yr.fromJSON(this,t,r)},"pointFromJSON"),"pointFromJSON");Yr.prototype._getBeta=a(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,o=a(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(o)},doubles:t.doubles&&{step:t.doubles.step,points:t.doubles.points.map(o)}}}return r}},"_getBeta2"),"_getBeta");Yr.prototype.toJSON=a(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=a(i(function(t,r,n){typeof r=="string"&&(r=JSON.parse(r));var o=t.point(r[0],r[1],n);if(!r[2])return o;function s(l){return t.point(l[0],l[1],n)}i(s,"obj2point"),a(s,"obj2point");var c=r[2];return o.precomputed={beta:null,doubles:c.doubles&&{step:c.doubles.step,points:[o].concat(c.doubles.points.map(s))},naf:c.naf&&{wnd:c.naf.wnd,points:[o].concat(c.naf.points.map(s))}},o},"fromJSON"),"fromJSON");Yr.prototype.inspect=a(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=a(i(function(){return this.inf},"isInfinity"),"isInfinity");Yr.prototype.add=a(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),o=r.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,o)},"add"),"add");Yr.prototype.dbl=a(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(),o=t.redInvm(),s=n.redAdd(n).redIAdd(n).redIAdd(r).redMul(o),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=a(i(function(){return this.x.fromRed()},"getX"),"getX");Yr.prototype.getY=a(i(function(){return this.y.fromRed()},"getY"),"getY");Yr.prototype.mul=a(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=a(i(function(t,r,n){var o=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(o,s):this.curve._wnafMulAdd(1,o,s,2)},"mulAdd"),"mulAdd");Yr.prototype.jmulAdd=a(i(function(t,r,n){var o=[this,r],s=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(o,s,!0):this.curve._wnafMulAdd(1,o,s,2,!0)},"jmulAdd"),"jmulAdd");Yr.prototype.eq=a(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=a(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,o=a(function(s){return s.neg()},"negate");r.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(o)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(o)}}}return r},"neg"),"neg");Yr.prototype.toJ=a(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");a(rn,"JPoint");Q6(rn,zc.BasePoint);Ti.prototype.jpoint=a(i(function(t,r,n){return new rn(this,t,r,n)},"jpoint"),"jpoint");rn.prototype.toP=a(i(function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),r=t.redSqr(),n=this.x.redMul(r),o=this.y.redMul(r).redMul(t);return this.curve.point(n,o)},"toP"),"toP");rn.prototype.neg=a(i(function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},"neg2"),"neg");rn.prototype.add=a(i(function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var r=t.z.redSqr(),n=this.z.redSqr(),o=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=o.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=o.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=a(i(function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var r=this.z.redSqr(),n=this.x,o=t.x.redMul(r),s=this.y,c=t.y.redMul(r).redMul(this.z),l=n.redSub(o),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=a(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 o=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(o.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=a(i(function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},"dbl2"),"dbl");rn.prototype._zeroDbl=a(i(function(){var t,r,n;if(this.zOne){var o=this.x.redSqr(),s=this.y.redSqr(),c=s.redSqr(),l=this.x.redAdd(s).redSqr().redISub(o).redISub(c);l=l.redIAdd(l);var h=o.redAdd(o).redIAdd(o),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=a(i(function(){var t,r,n;if(this.zOne){var o=this.x.redSqr(),s=this.y.redSqr(),c=s.redSqr(),l=this.x.redAdd(s).redSqr().redISub(o).redISub(c);l=l.redIAdd(l);var h=o.redAdd(o).redIAdd(o).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=a(i(function(){var t=this.curve.a,r=this.x,n=this.y,o=this.z,s=o.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(o);return this.curve.jpoint(v,x,O)},"_dbl"),"_dbl");rn.prototype.trpl=a(i(function(){if(!this.curve.zeroA)return this.dbl().add(this);var t=this.x.redSqr(),r=this.y.redSqr(),n=this.z.redSqr(),o=r.redSqr(),s=t.redAdd(t).redIAdd(t),c=s.redSqr(),l=this.x.redAdd(r).redSqr().redISub(t).redISub(o);l=l.redIAdd(l),l=l.redAdd(l).redIAdd(l),l=l.redISub(c);var h=l.redSqr(),p=o.redIAdd(o);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=a(i(function(t,r){return t=new Mt.default(t,r),this.curve._wnafMul(this,t)},"mul2"),"mul");rn.prototype.eq=a(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 o=r.redMul(this.z),s=n.redMul(t.z);return this.y.redMul(s).redISub(t.y.redMul(o)).cmpn(0)===0},"eq3"),"eq");rn.prototype.eqXToP=a(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 o=t.clone(),s=this.curve.redN.redMul(r);;){if(o.iadd(this.curve.n),o.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(s),this.x.cmp(n)===0)return!0}},"eqXToP"),"eqXToP");rn.prototype.inspect=a(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=a(i(function(){return this.z.cmpn(0)===0},"isInfinity2"),"isInfinity");var x0=$c(function(e,t){"use strict";var r=t;r.base=zc,r.short=qz,r.mont=null,r.edwards=null}),T0=$c(function(e,t){"use strict";var r=t,n=Si.assert;function o(l){l.type==="short"?this.curve=new x0.short(l):l.type==="edwards"?this.curve=new x0.edwards(l):this.curve=new x0.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(o,"PresetCurve"),a(o,"PresetCurve"),r.PresetCurve=o;function s(l,h){Object.defineProperty(r,l,{configurable:!0,enumerable:!0,get:function(){var p=new o(h);return Object.defineProperty(r,l,{configurable:!0,enumerable:!0,value:p}),p}})}i(s,"defineCurve"),a(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:Aa.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:Aa.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:Aa.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:Aa.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:Aa.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:Aa.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:Aa.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:Aa.default.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",c]})});function Ca(e){if(!(this instanceof Ca))return new Ca(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=ho.toArray(e.entropy,e.entropyEnc||"hex"),r=ho.toArray(e.nonce,e.nonceEnc||"hex"),n=ho.toArray(e.pers,e.persEnc||"hex");Y6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,r,n)}i(Ca,"HmacDRBG");a(Ca,"HmacDRBG");var aM=Ca;Ca.prototype._init=a(i(function(t,r,n){var o=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(o),this._reseed=1,this.reseedInterval=281474976710656},"init"),"init");Ca.prototype._hmac=a(i(function(){return new Aa.default.hmac(this.hash,this.K)},"hmac"),"hmac");Ca.prototype._update=a(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");Ca.prototype.reseed=a(i(function(t,r,n,o){typeof r!="string"&&(o=n,n=r,r=null),t=ho.toArray(t,r),n=ho.toArray(n,o),Y6(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1},"reseed"),"reseed");Ca.prototype.generate=a(i(function(t,r,n,o){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof r!="string"&&(o=n,n=r,r=null),n&&(n=ho.toArray(n,o||"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++,ho.encode(c,r)},"generate"),"generate");var Nb=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");a(fn,"KeyPair");var e2=fn;fn.fromPublic=a(i(function(t,r,n){return r instanceof fn?r:new fn(t,{pub:r,pubEnc:n})},"fromPublic"),"fromPublic");fn.fromPrivate=a(i(function(t,r,n){return r instanceof fn?r:new fn(t,{priv:r,privEnc:n})},"fromPrivate"),"fromPrivate");fn.prototype.validate=a(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=a(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=a(i(function(t){return t==="hex"?this.priv.toString(16,2):this.priv},"getPrivate"),"getPrivate");fn.prototype._importPrivate=a(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=a(i(function(t,r){if(t.x||t.y){this.ec.curve.type==="mont"?Nb(t.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&Nb(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=a(i(function(t){return t.validate()||Nb(t.validate(),"public point not validated"),t.mul(this.priv).getX()},"derive"),"derive");fn.prototype.sign=a(i(function(t,r,n){return this.ec.sign(t,this,r,n)},"sign2"),"sign");fn.prototype.verify=a(i(function(t,r,n){return this.ec.verify(t,r,this,void 0,n)},"verify2"),"verify");fn.prototype.inspect=a(i(function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"},"inspect3"),"inspect");var Vz=Si.assert;function Id(e,t){if(e instanceof Id)return e;this._importDER(e,t)||(Vz(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");a(Id,"Signature");var jm=Id;function sM(){this.place=0}i(sM,"Position");a(sM,"Position");function C0(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 o=0,s=0,c=t.place;s<n;s++,c++)o<<=8,o|=e[c],o>>>=0;return o<=127?!1:(t.place=c,o)}i(C0,"getLength");a(C0,"getLength");function Pb(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(Pb,"rmPadding");a(Pb,"rmPadding");Id.prototype._importDER=a(i(function(t,r){t=Si.toArray(t,r);var n=new sM;if(t[n.place++]!==48)return!1;var o=C0(t,n);if(o===!1||o+n.place!==t.length||t[n.place++]!==2)return!1;var s=C0(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=C0(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 M0(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(M0,"constructLength");a(M0,"constructLength");Id.prototype.toDER=a(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=Pb(r),n=Pb(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var o=[2];M0(o,r.length),o=o.concat(r),o.push(2),M0(o,n.length);var s=o.concat(n),c=[48];return M0(c,s.length),c=c.concat(s),Si.encode(c,t)},"toDER"),"toDER");var Kz=a(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(T0,e),"Unknown curve "+e),e=T0[e]),e instanceof T0.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");a(Ei,"EC");var Gz=Ei;Ei.prototype.keyPair=a(i(function(t){return new e2(this,t)},"keyPair"),"keyPair");Ei.prototype.keyFromPrivate=a(i(function(t,r){return e2.fromPrivate(this,t,r)},"keyFromPrivate"),"keyFromPrivate");Ei.prototype.keyFromPublic=a(i(function(t,r){return e2.fromPublic(this,t,r)},"keyFromPublic"),"keyFromPublic");Ei.prototype.genKeyPair=a(i(function(t){t||(t={});for(var r=new aM({hash:this.hash,pers:t.pers,persEnc:t.persEnc||"utf8",entropy:t.entropy||Kz(this.hash.hmacStrength),entropyEnc:t.entropy&&t.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),o=this.n.sub(new Mt.default(2));;){var s=new Mt.default(r.generate(n));if(!(s.cmp(o)>0))return s.iaddn(1),this.keyFromPrivate(s)}},"genKeyPair"),"genKeyPair");Ei.prototype._truncateToN=a(i(function(t,r,n){var o;if(Mt.default.isBN(t)||typeof t=="number")t=new Mt.default(t,16),o=t.byteLength();else if(typeof t=="object")o=t.length,t=new Mt.default(t,16);else{var s=t.toString();o=s.length+1>>>1,t=new Mt.default(s,16)}typeof n!="number"&&(n=o*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=a(i(function(t,r,n,o){if(typeof n=="object"&&(o=n,n=null),o||(o={}),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,o.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 aM({hash:this.hash,entropy:l,nonce:h,pers:o.pers,persEnc:o.persEnc||"utf8"}),g=this.n.sub(new Mt.default(1)),v=0;;v++){var y=o.k?o.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 o.canonical&&D.cmp(this.nh)>0&&(D=this.n.sub(D),P^=1),new jm({r:O,s:D,recoveryParam:P})}}}}}},"sign3"),"sign");Ei.prototype.verify=a(i(function(t,r,n,o,s){s||(s={}),t=this._truncateToN(t,!1,s.msgBitLength),n=this.keyFromPublic(n,o),r=new jm(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 jm(t,n);var o=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(o),v=o.sub(s).mul(g).umod(o),y=l.mul(g).umod(o);return this.g.mulAdd(v,c,y)};Ei.prototype.getKeyRecoveryParam=function(e,t,r,n){if(t=new jm(t,n),t.recoveryParam!==null)return t.recoveryParam;for(var o=0;o<4;o++){var s;try{s=this.recoverPubKey(e,t,o)}catch{continue}if(s.eq(r))return o}throw new Error("Unable to find valid recovery factor")};var Wz=$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=x0,r.curves=T0,r.ec=Gz,r.eddsa=null}),Jz=Wz.ec,Zz="signing-key/5.8.0",Bb=new vr(Zz),rb=null;function fo(){return rb||(rb=new Jz("secp256k1")),rb}i(fo,"getCurve");a(fo,"getCurve");var cM=i(class{constructor(e){Bu(this,"curve","secp256k1"),Bu(this,"privateKey",Nn(e)),ZC(this.privateKey)!==32&&Bb.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");let t=fo().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=fo().keyFromPublic(qr(this.publicKey)),r=fo().keyFromPublic(qr(e));return"0x"+t.pub.add(r.pub).encodeCompressed("hex")}signDigest(e){let t=fo().keyFromPrivate(qr(this.privateKey)),r=qr(e);r.length!==32&&Bb.throwArgumentError("bad digest length","digest",e);let n=t.sign(r,{canonical:!0});return W6({recoveryParam:n.recoveryParam,r:xc("0x"+n.r.toString(16),32),s:xc("0x"+n.s.toString(16),32)})}computeSharedSecret(e){let t=fo().keyFromPrivate(qr(this.privateKey)),r=fo().keyFromPublic(qr(t2(e)));return xc("0x"+t.derive(r.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}},"SigningKey");a(cM,"SigningKey");function uM(e,t){let r=W6(t),n={r:qr(r.r),s:qr(r.s)};return"0x"+fo().recoverPubKey(qr(e),n,r.recoveryParam).encode("hex",!1)}i(uM,"recoverPublicKey");a(uM,"recoverPublicKey");function t2(e,t){let r=qr(e);if(r.length===32){let n=new cM(r);return t?"0x"+fo().keyFromPrivate(r).getPublic(!0,"hex"):n.publicKey}else{if(r.length===33)return t?Nn(r):"0x"+fo().keyFromPublic(r).getPublic(!1,"hex");if(r.length===65)return t?"0x"+fo().keyFromPublic(r).getPublic(!0,"hex"):Nn(r)}return Bb.throwArgumentError("invalid public or private key","key","[REDACTED]")}i(t2,"computePublicKey");a(t2,"computePublicKey");var Yz="transactions/5.8.0",LY=new vr(Yz),HA;(function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"})(HA||(HA={}));function lM(e){let t=t2(e);return eM(Rb(Fm(Rb(t,1)),12))}i(lM,"computeAddress");a(lM,"computeAddress");function fM(e,t){return lM(uM(qr(e),t))}i(fM,"recoverAddress");a(fM,"recoverAddress");var Xz="wallet/5.8.0",UY=new vr(Xz);function Lb(e,t){return fM(iM(e),t)}i(Lb,"verifyMessage");a(Lb,"verifyMessage");function dM(){return{eip191:async(e,t)=>{hM(e,t)}}}i(dM,"getEIP191Verifier");a(dM,"getEIP191Verifier");var Qz=new Date("2022-09-20").valueOf();function hM(e,t){K6(e),VC(e,t);let n=[Lb(Ib.fromCacao(e).toMessage(),e.s.s).toLowerCase()];if(Date.parse(e.p.iat)<=Qz){let s=Lb(HC(Ib.fromCacao(e),"Ethereum"),e.s.s).toLowerCase();n.push(s)}let o=id.parse(e.p.iss.replace("did:pkh:","")).address.toLowerCase();if(!n.includes(o))throw new Error("Signature does not belong to issuer")}i(hM,"verifyEIP191Signature");a(hM,"verifyEIP191Signature");Ed();v6();var eH=ir(cl(),1);Ed();function pM(){return Ir((0,eH.randomBytes)(16),"base64")}i(pM,"randomString");a(pM,"randomString");var mM="base64pad",gM="base64url";function vM(e){return Ir(e,mM)}i(vM,"encodeBase64");a(vM,"encodeBase64");function yM(e){return Ir(e,gM)}i(yM,"encodeBase64Url");a(yM,"encodeBase64Url");function bM(e){return Cr(e,mM)}i(bM,"decodeBase64");a(bM,"decodeBase64");function I0(e){return JSON.parse(Ir(Cr(e,gM)))}i(I0,"base64urlToJSON");a(I0,"base64urlToJSON");function wM(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(wM,"fromDagJWS");a(wM,"fromDagJWS");function _M(e,t){if(t){let r=t.toISOString().split(".")[0]+"Z";return`${e}?versionTime=${r}`}else return e}i(_M,"didWithTime");a(_M,"didWithTime");function EM(e){return e?Array.isArray(e)?e:[e]:[]}i(EM,"extractControllers");a(EM,"extractControllers");var tH={...dM()};function AM(e){return"registry"in e&&"cache"in e}i(AM,"isResolver");a(AM,"isResolver");var SM=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 SM({provider:this._client?.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new Cb(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=AM(e)?e:new Lx(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=pM(),o=await this._client.request("did_authenticate",{nonce:n,aud:r,paths:t}),{kid:s}=await this.verifyJWS(o),c=I0(o.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 o=await Z0.fromCacao(this._capability),s=$t.asCID(o.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 EC(e),o=yM(r.bytes);Object.assign(t,{linkedBlock:vM(n)});let s=await this.createJWS(o,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 Z0.fromCacao(this._capability);return{jws:s,linkedBlock:n,cacaoBlock:l.bytes}}return{jws:s,linkedBlock:n}}async verifyJWS(e,t={}){t=Object.assign({verifiers:tH},t),typeof e!="string"&&(e=wM(e));let r=I0(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 J0.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=_M(t.issuer,t.atTime),g=(await this.resolve(h)).didDocument?.controller,v=EM(g);if(t.capability?.s&&t.capability.p.aud===s&&v.includes(t.capability.p.iss))await J0.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||[];Qx(e,c);let l;try{l=I0(e.split(".")[1])}catch{}return{kid:r,payload:l,didResolutionResult:n}}async createJWE(e,t,r={}){let n=await Q$(t,this._resolver);return X$(e,n,r.protectedHeader,r.aad)}async createDagJWE(e,t,r={}){let n=await TC(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 bM(r)}async decryptDagJWE(e){let t=await this.decryptJWE(e);return CC(t)}async resolve(e){let t=await this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:r,message:n}=t.didResolutionMetadata,o=n?`, ${n}`:"";throw new Error(`Failed to resolve ${e}: ${r}${o}`)}return t}constructor({provider:e,resolver:t={},resolverOptions:r,capability:n,parent:o}={}){if(e!=null&&(this._client=new Cb(e)),n){if(this._capability=n,this._parentId=this._capability.p.iss,o&&this._parentId!==o)throw new Error("Capability issuer and parent not equal")}else o&&(this._parentId=o);this.setResolver(t,r)}},"DID");a(SM,"DID");function rH(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(rH,"toUint8Array");a(rH,"toUint8Array");var qA=ir(Am(),1);d6();var xM={};xr(xM,{keyToDidDoc:()=>TM});function TM(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(TM,"keyToDidDoc");a(TM,"keyToDidDoc");var CM={};xr(CM,{keyToDidDoc:()=>IM});Ed();var nH=ir(b6(),1);function MM(e){let t=new Uint8Array(e.length+2);return t[0]=236,t[1]=1,t.set(e,2),`z${Ir(t,"base58btc")}`}i(MM,"encodeKey");a(MM,"encodeKey");function IM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=(0,nH.convertPublicKeyToX25519)(e),s=`${r}#${MM(o)}`;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(o,"base58btc")}]}}i(IM,"keyToDidDoc2");a(IM,"keyToDidDoc");var kM={};xr(kM,{keyToDidDoc:()=>qM,pubKeyBytesToXY:()=>o2});var DM={};xr(DM,{ECPointDecompress:()=>FM});function RM(e){return e>=0?e:-e}i(RM,"n");a(RM,"n");function OM(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,o=1n,s=0n;for(;e!==0n;){let c=t/e,l=t%e,h=r-o*c,p=n-s*c;t=e,e=l,r=o,n=s,o=h,s=p}return{g:t,x:r,y:n}}i(OM,"r");a(OM,"r");function od(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(od,"e");a(od,"e");function r2(e,t){let r=OM(od(e,t),t);if(r.g!==1n)throw new RangeError(`${e.toString()} does not have inverse modulo ${t.toString()}`);return od(r.x,t)}i(r2,"o");a(r2,"o");function NM(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((o,s)=>o*s,1n);return t.reduce((o,s,c)=>{let l=n/s;return od(o+l*r2(l,s)%n*e[c]%n,n)},0n)}i(NM,"i");a(NM,"i");function PM(e){return e.map(t=>t[0]**(t[1]-1n)*(t[0]-1n)).reduce((t,r)=>r*t,1n)}i(PM,"a");a(PM,"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=od(e,r),t<0n)return r2(Vu(e,RM(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=>PM([y])),v=g.map((y,_)=>Vu(s,c%y,p[_]));return NM(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 o=1n;for(;t>0;)t%2n===1n&&(o=o*e%r),t/=2n,e=e**2n%r;return o}i(Vu,"s");a(Vu,"s");var Yn={};xr(Yn,{pubKeyBytesToHex:()=>BM,publicKeyHexToUint8ArrayPointPair:()=>n2,publicKeyIntToUint8ArrayPointPair:()=>i2,publicKeyIntToXY:()=>UM,publicKeyToXY:()=>LM,testHexString:()=>$m,testUint8Array:()=>yl});h6();function BM(e){if(!yl(e))throw new TypeError("input must be a Uint8Array");return Ir(e,"base16")}i(BM,"pubKeyBytesToHex");a(BM,"pubKeyBytesToHex");function LM(e){if(!$m(e))throw new TypeError("input must be string with characters 0-9,A-F,a-f");let t=n2(e),r=zu.encode(t.xOctet).slice(1),n=zu.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(LM,"publicKeyToXY");a(LM,"publicKeyToXY");function n2(e){if(!$m(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"),o=Cr(r,"base16");return{xOctet:n,yOctet:o}}i(n2,"publicKeyHexToUint8ArrayPointPair");a(n2,"publicKeyHexToUint8ArrayPointPair");function $m(e){let t=/^[A-Fa-f0-9]+$/i;return!!(t.exec(e)!==null&&t.test(e)&&typeof e=="string")}i($m,"testHexString");a($m,"testHexString");function yl(e){return e==null?!1:e.constructor===Uint8Array}i(yl,"testUint8Array");a(yl,"testUint8Array");function UM(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=i2(e),r=zu.encode(t.xOctet).slice(1),n=zu.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(UM,"publicKeyIntToXY");a(UM,"publicKeyIntToXY");function i2(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"),o=Cr(r,"base10");return{xOctet:n,yOctet:o}}i(i2,"publicKeyIntToUint8ArrayPointPair");a(i2,"publicKeyIntToUint8ArrayPointPair");function FM(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,o=(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,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(FM,"ECPointDecompress");a(FM,"ECPointDecompress");var jM={};xr(jM,{ECPointDecompress:()=>$M});function $M(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,o=(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,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i($M,"ECPointDecompress2");a($M,"ECPointDecompress");var zM={};xr(zM,{ECPointDecompress:()=>HM});function HM(e){if(!yl(e))throw new TypeError("input must be a Uint8Array");let r=BigInt(2)**521n-1n,n=1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n,o=(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,o,r);return p%2n!==s&&(p=r-p),{x:l,y:p}}i(HM,"ECPointDecompress3");a(HM,"ECPointDecompress");function qM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=o2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-256",x:o.xm,y:o.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(qM,"keyToDidDoc3");a(qM,"keyToDidDoc");function o2(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"),o=DM.ECPointDecompress(n);return Yn.publicKeyIntToXY(o)}throw new Error("Unexpected pubKeyBytes")}i(o2,"pubKeyBytesToXY");a(o2,"pubKeyBytesToXY");var VM={};xr(VM,{keyToDidDoc:()=>KM,pubKeyBytesToXY:()=>a2});function KM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=a2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-384",x:o.xm,y:o.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(KM,"keyToDidDoc4");a(KM,"keyToDidDoc");function a2(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"),o=jM.ECPointDecompress(n);return Yn.publicKeyIntToXY(o)}throw new Error("Unexpected pubKeyBytes")}i(a2,"pubKeyBytesToXY2");a(a2,"pubKeyBytesToXY");var GM={};xr(GM,{keyToDidDoc:()=>WM,pubKeyBytesToXY:()=>s2});function WM(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,o=s2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-521",x:o.xm,y:o.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(WM,"keyToDidDoc5");a(WM,"keyToDidDoc");function s2(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=zM.ECPointDecompress(r);return Yn.publicKeyIntToXY(n)}throw new Error("Unexpected pubKeyBytes")}i(s2,"pubKeyBytesToXY3");a(s2,"pubKeyBytesToXY");var iH="application/did+ld+json",VA="application/did+json",oH={231:xM,237:CM,4608:kM,4609:VM,4610:GM};function aH(){return{key:async(e,t,r,n)=>{let o=n.accept||VA,s={didResolutionMetadata:{contentType:o},didDocument:null,didDocumentMetadata:{}};try{let c=uo.decode(t.id),l=qA.default.decode(c),h=c.slice(qA.default.decode.bytes),p=await oH[l].keyToDidDoc(h,t.id);o===iH?(p["@context"]="https://w3id.org/did/v1",s.didDocument=p):o===VA?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(aH,"getResolver");a(aH,"getResolver");var JM=ir(b6(),1),sH=ir(b$(),1),cH="base64pad";function Ub(e){return JSON.parse((0,sH.default)(e))}i(Ub,"toStableObject");a(Ub,"toStableObject");function ZM(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(ZM,"encodeDID");a(ZM,"encodeDID");function Fb(e){let[t,r,n]=e.split(".");return{payload:r,signatures:[{protected:t,signature:n}]}}i(Fb,"toGeneralJWS");a(Fb,"toGeneralJWS");var KA=a(async(e,t,r,n={})=>{let o=`${t}#${t.split(":")[2]}`,s=Wx(r),c=Ub(Object.assign(n,{kid:o,alg:"EdDSA"}));return J$(typeof e=="string"?e:Ub(e),s,c)},"sign"),uH={did_authenticate:async({did:e,secretKey:t},r)=>{let n=await KA({did:e,aud:r.aud,nonce:r.nonce,paths:r.paths,exp:Math.floor(Date.now()/1e3)+600},e,t);return Fb(n)},did_createJWS:async({did:e,secretKey:t},r)=>{if(r.did.split("#")[0]!==e)throw new bs(4100,`Unknown DID: ${e}`);let o=await KA(r.payload,e,t,r.protected);return{jws:Fb(o)}},did_decryptJWE:async({secretKey:e},t)=>{let r=sT((0,JM.convertSecretKeyToX25519)(e));try{let n=await Y$(t.jwe,r);return{cleartext:Ir(n,cH)}}catch(n){throw new bs(-32e3,n.message)}}},lH=i(class{constructor(e){let{secretKey:t,publicKey:r}=(0,JM.generateKeyPairFromSeed)(e),n=ZM(r),o=jC(uH);this._handle=async s=>await o({did:n,secretKey:t},s)}get isDidProvider(){return!0}async send(e){return await this._handle(e)}},"Ed25519Provider");a(lH,"Ed25519Provider");var YM={};xr(YM,{JsonPatchError:()=>Ur,_areEquals:()=>Ku,applyOperation:()=>ps,applyPatch:()=>zm,applyReducer:()=>QM,deepClone:()=>hH,getValueByPointer:()=>ad,validate:()=>u2,validator:()=>sd});var fH=function(){var e=a(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,o){n.__proto__=o}||function(n,o){for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s])},e(t,r)},"extendStatics");return function(t,r){e(t,r);function n(){this.constructor=t}i(n,"__"),a(n,"__"),t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),dH=Object.prototype.hasOwnProperty;function em(e,t){return dH.call(e,t)}i(em,"hasOwnProperty");a(em,"hasOwnProperty");function tm(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 o in e)em(e,o)&&n.push(o);return n}i(tm,"_objectKeys");a(tm,"_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");a(Xn,"_deepClone");function rm(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(rm,"isInteger2");a(rm,"isInteger");function ds(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(ds,"escapePathComponent");a(ds,"escapePathComponent");function c2(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i(c2,"unescapePathComponent");a(c2,"unescapePathComponent");function nm(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(nm(e[t]))return!0}else if(typeof e=="object"){for(var n=tm(e),o=n.length,s=0;s<o;s++)if(nm(e[n[s]]))return!0}}return!1}i(nm,"hasUndefined");a(nm,"hasUndefined");function jb(e,t){var r=[e];for(var n in t){var o=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof o<"u"&&r.push(n+": "+o)}return r.join(`
|
|
843
843
|
`)}i(jb,"patchErrorMessageFormatter");a(jb,"patchErrorMessageFormatter");var XM=function(e){fH(t,e);function t(r,n,o,s,c){var l=this.constructor,h=e.call(this,jb(r,{name:n,index:o,operation:s,tree:c}))||this;return h.name=n,h.index=o,h.operation=s,h.tree=c,Object.setPrototypeOf(h,l.prototype),h.message=jb(r,{name:n,index:o,operation:s,tree:c}),h}return i(t,"PatchError2"),a(t,"PatchError"),t}(Error),Ur=XM,hH=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=ad(r,this.path);n&&(n=Xn(n));var o=ps(r,{op:"remove",path:this.from}).removed;return ps(r,{op:"add",path:this.path,value:o}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=ad(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}}},pH={add:function(e,t,r){return rm(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 ad(e,t){if(t=="")return e;var r={op:"_get",path:t};return ps(e,r),r.value}i(ad,"getValueByPointer");a(ad,"getValueByPointer");function ps(e,t,r,n,o,s){if(r===void 0&&(r=!1),n===void 0&&(n=!0),o===void 0&&(o=!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=ad(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&&(_=c2(_)),o&&(_=="__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&&!rm(_))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);rm(_)&&(_=~~_)}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=pH[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");a(ps,"applyOperation");function zm(e,t,r,n,o){if(n===void 0&&(n=!0),o===void 0&&(o=!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,o,c),e=s[c].newDocument;return s.newDocument=e,s}i(zm,"applyPatch");a(zm,"applyPatch");function QM(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(QM,"applyReducer");a(QM,"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")&&nm(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 o=e.path.split("/").length,s=n.split("/").length;if(o!==s+1&&o!==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=u2([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");a(sd,"validator");function u2(e,t,r){try{if(!Array.isArray(e))throw new Ur("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)zm(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(o){if(o instanceof Ur)return o;throw o}}i(u2,"validate5");a(u2,"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),o,s,c;if(r&&n){if(s=e.length,s!=t.length)return!1;for(o=s;o--!==0;)if(!Ku(e[o],t[o]))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(o=s;o--!==0;)if(!t.hasOwnProperty(l[o]))return!1;for(o=s;o--!==0;)if(c=l[o],!Ku(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(Ku,"_areEquals");a(Ku,"_areEquals");var eI={};xr(eI,{compare:()=>aI,generate:()=>im,observe:()=>oI,unobserve:()=>iI});var l2=new WeakMap,mH=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror2"),a(e,"Mirror"),e}(),gH=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo2"),a(e,"ObserverInfo"),e}();function tI(e){return l2.get(e)}i(tI,"getMirror");a(tI,"getMirror");function rI(e,t){return e.observers.get(t)}i(rI,"getObserverFromMirror");a(rI,"getObserverFromMirror");function nI(e,t){e.observers.delete(t.callback)}i(nI,"removeObserverFromMirror");a(nI,"removeObserverFromMirror");function iI(e,t){t.unobserve()}i(iI,"unobserve");a(iI,"unobserve");function oI(e,t){var r=[],n,o=tI(e);if(!o)o=new mH(e),l2.set(e,o);else{var s=rI(o,t);n=s&&s.observer}if(n)return n;if(n={},o.value=Xn(e),t){n.callback=t,n.next=null;var c=a(function(){im(n)},"dirtyCheck"),l=a(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(){im(n),clearTimeout(n.next),nI(o,n),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},o.observers.set(t,new gH(t,n)),n}i(oI,"observe");a(oI,"observe");function im(e,t){t===void 0&&(t=!1);var r=l2.get(e.object);Hm(r.value,e.object,e.patches,"",t),e.patches.length&&zm(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(im,"generate2");a(im,"generate");function Hm(e,t,r,n,o){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var s=tm(t),c=tm(e),l=!1,h=!1,p=c.length-1;p>=0;p--){var g=c[p],v=e[g];if(em(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)?Hm(v,y,r,n+"/"+ds(g),o):v!==y&&(l=!0,o&&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)?(o&&r.push({op:"test",path:n+"/"+ds(g),value:Xn(v)}),r.push({op:"remove",path:n+"/"+ds(g)}),h=!0):(o&&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];!em(e,g)&&t[g]!==void 0&&r.push({op:"add",path:n+"/"+ds(g),value:Xn(t[g])})}}}i(Hm,"_generate");a(Hm,"_generate");function aI(e,t,r){r===void 0&&(r=!1);var n=[];return Hm(e,t,n,"",r),n}i(aI,"compare3");a(aI,"compare");var sI=Object.assign({},YM,eI,{JsonPatchError:XM,deepClone:Xn,escapePathComponent:ds,unescapePathComponent:c2}),vH=ir(Sd(),1),yH=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 GA=ir(Sd(),1);Wo();_d();var cI={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function uI(e){let t=cI[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(uI,"codeByName");a(uI,"codeByName");function lI(e){let t=Object.entries(cI).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(lI,"nameByCode");a(lI,"nameByCode");var Ma=i(class{},"StreamType");a(Ma,"StreamType");Ma.nameByCode=lI;Ma.codeByName=uI;var WA=ir(Am(),1);function Ji(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(o,s,c)=>{if(c.value!=null)c.value=$b(c.value,t,r,n);else if(c.get!=null)c.get=$b(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(Ji,"Memoize");a(Ji,"Memoize");var nb=new Map;function $b(e,t,r=0,n){let o=Symbol("__memoized_map__");return function(...s){let c;this.hasOwnProperty(o)||Object.defineProperty(this,o,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let l=this[o];if(Array.isArray(n))for(let h of n)nb.has(h)?nb.get(h).push(l):nb.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($b,"getNewFunction");a($b,"getNewFunction");var f2=206;Wo();_d();vm();var JA=ir(Am(),1);function kd(e){try{return e()}catch(t){return t}}i(kd,"tryCatch");a(kd,"tryCatch");Wo();var ZA=ir(Am(),1);ol();function _c(e){let t=ZA.default.decode(e),r=ZA.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(_c,"readVarint");a(_c,"readVarint");function fI(e){return e===0||e===1}i(fI,"isCidVersion");a(fI,"isCidVersion");function zb(e){let[t,r]=_c(e);if(!fI(t))throw new Error(`Unknown CID version ${t}`);let[n,o]=_c(r),[,s,c]=_c(o),[l,,h]=_c(s),p=o.subarray(0,c+h+l),g=o.subarray(c+h+l);return[$t.create(t,n,m6(p)),g]}i(zb,"readCid");a(zb,"readCid");Wo();_d();function Dd(e,t="StreamRef"){let[r,n]=_c(e);if(r!==f2)throw new Error(`Invalid ${t}, does not include streamid codec`);let[o,s]=_c(n),c=zb(s),[l,h]=c;if(h.length===0)return{kind:"stream-id",type:o,genesis:l};if(h.length===1&&h[0]===0)return{kind:"commit-id",type:o,genesis:l,commit:null};{let[p]=zb(h);return{kind:"commit-id",type:o,genesis:l,commit:p}}}i(Dd,"fromBytes");a(Dd,"fromBytes");var bH=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function qm(e,t="StreamRef"){let r=bH.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let o=Ss.decode(n),s=Dd(o),c=r[4];return c?{kind:"commit-id",type:s.type,genesis:s.genesis,commit:d2(s.genesis,c)}:s}i(qm,"fromString4");a(qm,"fromString");function dI(e){try{return typeof e=="string"?$t.parse(e):$t.asCID(e)}catch{return null}}i(dI,"parseCID");a(dI,"parseCID");function d2(e,t=null){if(!t||t==="0")return null;let r=dI(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(d2,"parseCommit");a(d2,"parseCommit");var Rd=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>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"),hI=i(class extends Error{constructor(e){super(`Invalid StreamID bytes ${Ss.encode(e)}: contains commit`)}},"InvalidStreamIDBytesError");a(hI,"InvalidStreamIDBytesError");var pI=i(class extends Error{constructor(e){super(`Invalid StreamID string ${e}: contains commit`)}},"InvalidStreamIDStringError");a(pI,"InvalidStreamIDStringError");function h2(e){let t=Dd(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new hI(e)}i(h2,"fromBytes2");a(h2,"fromBytes");function mI(e){return kd(()=>h2(e))}i(mI,"fromBytesNoThrow");a(mI,"fromBytesNoThrow");function p2(e){let t=qm(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new pI(e)}i(p2,"fromString5");a(p2,"fromString");function gI(e){return kd(()=>p2(e))}i(gI,"fromStringNoThrow");a(gI,"fromStringNoThrow");var YA=Symbol.for("@ceramicnetwork/streamid/StreamID"),Xt=i(class{constructor(e,t){if(this._tag=YA,!(e||e===0))throw new Error("StreamID constructor: type required");if(!t)throw new Error("StreamID constructor: cid required");this._type=typeof e=="string"?Ma.codeByName(e):e,this._cid=typeof t=="string"?$t.parse(t):t}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===YA}static async fromGenesis(e,t){let r=await Tm({value:t,codec:fl,hasher:al});return new Xt(e,r.cid)}get type(){return this._type}get typeName(){return Ma.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let e=JA.default.encode(f2),t=JA.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");a(Xt,"StreamID");Xt.fromBytes=h2;Xt.fromBytesNoThrow=mI;Xt.fromString=p2;Xt.fromStringNoThrow=gI;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 o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>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"),ib=i(function(e,t,r,n,o){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!o)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?o.call(e,r):o?o.value=r:t.set(e,r),r},"__classPrivateFieldSet"),Ea=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,vI=i(class extends Error{constructor(e){super(`Error while parsing CommitID from bytes ${Ss.encode(e)}: no commit information provided`)}},"InvalidCommitIDBytesError");a(vI,"InvalidCommitIDBytesError");var yI=i(class extends Error{constructor(e){super(`Error while parsing CommitID from string ${e}: no commit information provided`)}},"InvalidCommitIDStringError");a(yI,"InvalidCommitIDStringError");function m2(e){let t=Dd(e,"CommitID");if(t.kind==="commit-id")return new Ar(t.type,t.genesis,t.commit);throw new vI(e)}i(m2,"fromBytes3");a(m2,"fromBytes");function bI(e){return kd(()=>m2(e))}i(bI,"fromBytesNoThrow2");a(bI,"fromBytesNoThrow");function g2(e){let t=qm(e,"CommitID");if(t.kind==="commit-id")return new Ar(t.type,t.genesis,t.commit);throw new yI(e)}i(g2,"fromString6");a(g2,"fromString");function wI(e){return kd(()=>g2(e))}i(wI,"fromStringNoThrow2");a(wI,"fromStringNoThrow");var XA=Symbol.for("@ceramicnetwork/streamid/CommitID");function _I(e,t){return new Ar(e.type,e.cid,t)}i(_I,"make");a(_I,"make");var Ar=i(class{constructor(e,t,r=null){if(this._tag=XA,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");ib(this,Pu,typeof e=="string"?Ma.codeByName(e):e,"f"),ib(this,gc,typeof t=="string"?$t.parse(t):t,"f"),ib(this,qf,d2(Ea(this,gc,"f"),r),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===XA}get baseID(){return new Xt(Ea(this,Pu,"f"),Ea(this,gc,"f"))}get type(){return Ea(this,Pu,"f")}get typeName(){return Ma.nameByCode(Ea(this,Pu,"f"))}get cid(){return Ea(this,gc,"f")}get commit(){return Ea(this,qf,"f")||Ea(this,gc,"f")}get bytes(){let e=WA.default.encode(f2),t=WA.default.encode(this.type),r=Ea(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");a(Ar,"CommitID");Ar.fromBytes=m2;Ar.fromBytesNoThrow=bI;Ar.fromString=g2;Ar.fromStringNoThrow=wI;Ar.make=_I;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(o){let s=Dd(o);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(o)}`)}}i(t,"fromBytes4"),a(t,"fromBytes"),e.fromBytes=t;function r(o){let s=qm(o);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: ${o}`)}}i(r,"fromString7"),a(r,"fromString"),e.fromString=r;function n(o){if(Xt.isInstance(o)||Ar.isInstance(o))return o;if(o instanceof Uint8Array)return t(o);if(typeof o=="string")return r(o);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(o)}`)}i(n,"from4"),a(n,"from"),e.from=n})(ws||(ws={}));var Hb=a(function(e,t){return Hb=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(r[o]=n[o])},Hb(e,t)},"extendStatics");function Xo(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Hb(e,t);function r(){this.constructor=e}i(r,"__"),a(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(Xo,"__extends2");a(Xo,"__extends");function EI(e,t,r,n){function o(s){return s instanceof r?s:new r(function(c){c(s)})}return i(o,"adopt"),a(o,"adopt"),new(r||(r=Promise))(function(s,c){function l(g){try{p(n.next(g))}catch(v){c(v)}}i(l,"fulfilled"),a(l,"fulfilled");function h(g){try{p(n.throw(g))}catch(v){c(v)}}i(h,"rejected"),a(h,"rejected");function p(g){g.done?s(g.value):o(g.value).then(l,h)}i(p,"step"),a(p,"step"),p((n=n.apply(e,t||[])).next())})}i(EI,"__awaiter");a(EI,"__awaiter");function v2(e,t){var r={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]},n,o,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,o&&(s=p[0]&2?o.return:p[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,p[1])).done)return s;switch(o=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++,o=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],o=0}finally{n=s=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}i(v2,"__generator");a(v2,"__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");a(Mc,"__values");function Ia(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,s=[],c;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)s.push(o.value)}catch(l){c={error:l}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return s}i(Ia,"__read");a(Ia,"__read");function _s(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,s;n<o;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");a(_s,"__spreadArray");function Tc(e){return this instanceof Tc?(this.v=e,this):new Tc(e)}i(Tc,"__await");a(Tc,"__await");function AI(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),o,s=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),l("next"),l("throw"),l("return",c),o[Symbol.asyncIterator]=function(){return this},o;function c(_){return function(x){return Promise.resolve(x).then(_,v)}}function l(_,x){n[_]&&(o[_]=function(O){return new Promise(function(D,P){s.push([_,O,D,P])>1||h(_,O)})},x&&(o[_]=x(o[_])))}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(AI,"__asyncGenerator");a(AI,"__asyncGenerator");function SI(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),o(l,h,c.done,c.value)})}}function o(s,c,l,h){Promise.resolve(h).then(function(p){s({value:p,done:l})},c)}}i(SI,"__asyncValues");a(SI,"__asyncValues");function Sr(e){return typeof e=="function"}i(Sr,"isFunction");a(Sr,"isFunction");function Vm(e){var t=a(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(Vm,"createErrorClass");a(Vm,"createErrorClass");var ob=Vm(function(e){return a(i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
|
|
844
844
|
`+r.map(function(n,o){return o+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");a(cd,"arrRemove");var Od=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription2"),a(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,o,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 ob?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{qb(x)}catch(O){s=s??[],O instanceof ob?s=_s(_s([],Ia(s)),Ia(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}}if(s)throw new ob(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)qb(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}(),xI=Od.EMPTY;function y2(e){return e instanceof Od||e&&"closed"in e&&Sr(e.remove)&&Sr(e.add)&&Sr(e.unsubscribe)}i(y2,"isSubscription");a(y2,"isSubscription");function qb(e){Sr(e)?e():e.unsubscribe()}i(qb,"execFinalizer");a(qb,"execFinalizer");var Hc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},om={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=om.delegate;return o?.setTimeout?o.setTimeout.apply(o,_s([e,t],Ia(r))):setTimeout.apply(void 0,_s([e,t],Ia(r)))},clearTimeout:function(e){var t=om.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function b2(e){om.setTimeout(function(){var t=Hc.onUnhandledError;if(t)t(e);else throw e})}i(b2,"reportUnhandledError");a(b2,"reportUnhandledError");function Vb(){}i(Vb,"noop");a(Vb,"noop");var wH=function(){return Km("C",void 0,void 0)}();function TI(e){return Km("E",void 0,e)}i(TI,"errorNotification");a(TI,"errorNotification");function CI(e){return Km("N",e,void 0)}i(CI,"nextNotification");a(CI,"nextNotification");function Km(e,t,r){return{kind:e,value:t,error:r}}i(Km,"createNotification");a(Km,"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,o=r.error;if(Ec=null,n)throw o}}else e()}i(Yf,"errorContext");a(Yf,"errorContext");function MI(e){Hc.useDeprecatedSynchronousErrorHandling&&Ec&&(Ec.errorThrown=!0,Ec.error=e)}i(MI,"captureError");a(MI,"captureError");var w2=function(e){Xo(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,y2(r)&&r.add(n)):n.destination=AH,n}return i(t,"Subscriber2"),a(t,"Subscriber"),t.create=function(r,n,o){return new Kb(r,n,o)},t.prototype.next=function(r){this.isStopped?D0(CI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?D0(TI(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?D0(wH,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),_H=Function.prototype.bind;function k0(e,t){return _H.call(e,t)}i(k0,"bind");a(k0,"bind");var EH=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver2"),a(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}(),Kb=function(e){Xo(t,e);function t(r,n,o){var s=e.call(this)||this,c;if(Sr(r)||!r)c={next:r??void 0,error:n??void 0,complete:o??void 0};else{var l;s&&Hc.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&k0(r.next,l),error:r.error&&k0(r.error,l),complete:r.complete&&k0(r.complete,l)}):c=r}return s.destination=new EH(c),s}return i(t,"SafeSubscriber2"),a(t,"SafeSubscriber"),t}(w2);function Wf(e){Hc.useDeprecatedSynchronousErrorHandling?MI(e):b2(e)}i(Wf,"handleUnhandledError");a(Wf,"handleUnhandledError");function II(e){throw e}i(II,"defaultErrorHandler");a(II,"defaultErrorHandler");function D0(e,t){var r=Hc.onStoppedNotification;r&&om.setTimeout(function(){return r(e,t)})}i(D0,"handleStoppedNotification");a(D0,"handleStoppedNotification");var AH={closed:!0,next:Vb,error:II,complete:Vb},_2=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Gm(e){return e}i(Gm,"identity3");a(Gm,"identity");function kI(e){return e.length===0?Gm:e.length===1?e[0]:a(i(function(r){return e.reduce(function(n,o){return o(n)},r)},"piped"),"piped")}i(kI,"pipeFromArray");a(kI,"pipeFromArray");var dn=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable2"),a(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 o=this,s=RI(t)?t:new Kb(t,r,n);return Yf(function(){var c=o,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?o._subscribe(s):o._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=Gb(r),new r(function(o,s){var c=new Kb({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:o});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[_2]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return kI(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Gb(t),new t(function(n,o){var s;r.subscribe(function(c){return s=c},function(c){return o(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function Gb(e){var t;return(t=e??Hc.Promise)!==null&&t!==void 0?t:Promise}i(Gb,"getPromiseCtor");a(Gb,"getPromiseCtor");function DI(e){return e&&Sr(e.next)&&Sr(e.error)&&Sr(e.complete)}i(DI,"isObserver");a(DI,"isObserver");function RI(e){return e&&e instanceof w2||DI(e)&&y2(e)}i(RI,"isSubscriber");a(RI,"isSubscriber");function OI(e){return Sr(e?.lift)}i(OI,"hasLift");a(OI,"hasLift");function Qo(e){return function(t){if(OI(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(Qo,"operate");a(Qo,"operate");function vo(e,t,r,n,o){return new SH(e,t,r,n,o)}i(vo,"createOperatorSubscriber");a(vo,"createOperatorSubscriber");var SH=function(e){Xo(t,e);function t(r,n,o,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=o?function(){try{o()}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._complete,h}return i(t,"OperatorSubscriber2"),a(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}(w2),xH=Vm(function(e){return a(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),NI=function(e){Xo(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"),a(t,"Subject"),t.prototype.lift=function(r){var n=new QA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new xH},t.prototype.next=function(r){var n=this;Yf(function(){var o,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){o={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(o)throw o.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 o=n.observers;o.length;)o.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,o=this,s=o.hasError,c=o.isStopped,l=o.observers;return s||c?xI:(this.currentObservers=null,l.push(r),new Od(function(){n.currentObservers=null,cd(l,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,s=n.thrownError,c=n.isStopped;o?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 QA(r,n)},t}(dn),QA=function(e){Xo(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return i(t,"AnonymousSubject2"),a(t,"AnonymousSubject"),t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.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,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:xI},t}(NI),TH=function(e){Xo(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return i(t,"BehaviorSubject2"),a(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,o=r.thrownError,s=r._value;if(n)throw o;return this._throwIfClosed(),s},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(NI),PI={now:function(){return(PI.delegate||Date).now()},delegate:void 0},CH=function(e){Xo(t,e);function t(r,n){return e.call(this)||this}return i(t,"Action2"),a(t,"Action"),t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(Od),am={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=am.delegate;return o?.setInterval?o.setInterval.apply(o,_s([e,t],Ia(r))):setInterval.apply(void 0,_s([e,t],Ia(r)))},clearInterval:function(e){var t=am.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},MH=function(e){Xo(t,e);function t(r,n){var o=e.call(this,r,n)||this;return o.scheduler=r,o.work=n,o.pending=!1,o}return i(t,"AsyncAction2"),a(t,"AsyncAction"),t.prototype.schedule=function(r,n){var o;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=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,o){return o===void 0&&(o=0),am.setInterval(r.flush.bind(r,this),o)},t.prototype.recycleAsyncId=function(r,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&am.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(r,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var o=!1,s;try{this.work(r)}catch(c){o=!0,s=c||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,o=r.scheduler,s=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,cd(s,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(CH),eS=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return i(e,"Scheduler2"),a(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=PI.now,e}(),IH=function(e){Xo(t,e);function t(r,n){n===void 0&&(n=eS.now);var o=e.call(this,r,n)||this;return o.actions=[],o._active=!1,o}return i(t,"AsyncScheduler2"),a(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var o;this._active=!0;do if(o=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,o){for(;r=n.shift();)r.unsubscribe();throw o}},t}(eS),kH=new IH(MH),DH=kH,BI=new dn(function(e){return e.complete()});function E2(e){return e&&Sr(e.schedule)}i(E2,"isScheduler");a(E2,"isScheduler");function A2(e){return e[e.length-1]}i(A2,"last");a(A2,"last");function LI(e){return E2(A2(e))?e.pop():void 0}i(LI,"popScheduler");a(LI,"popScheduler");function UI(e,t){return typeof A2(e)=="number"?e.pop():t}i(UI,"popNumber");a(UI,"popNumber");var S2=a(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function x2(e){return Sr(e?.then)}i(x2,"isPromise");a(x2,"isPromise");function T2(e){return Sr(e[_2])}i(T2,"isInteropObservable");a(T2,"isInteropObservable");function C2(e){return Symbol.asyncIterator&&Sr(e?.[Symbol.asyncIterator])}i(C2,"isAsyncIterable");a(C2,"isAsyncIterable");function M2(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(M2,"createInvalidObservableTypeError");a(M2,"createInvalidObservableTypeError");function FI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(FI,"getSymbolIterator");a(FI,"getSymbolIterator");var jI=FI();function I2(e){return Sr(e?.[jI])}i(I2,"isIterable");a(I2,"isIterable");function k2(e){return AI(this,arguments,a(i(function(){var r,n,o,s;return v2(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(),o=n.value,s=n.done,s?[4,Tc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Tc(o)];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(k2,"readableStreamLikeToAsyncGenerator");a(k2,"readableStreamLikeToAsyncGenerator");function D2(e){return Sr(e?.getReader)}i(D2,"isReadableStreamLike");a(D2,"isReadableStreamLike");function Na(e){if(e instanceof dn)return e;if(e!=null){if(T2(e))return $I(e);if(S2(e))return zI(e);if(x2(e))return HI(e);if(C2(e))return R2(e);if(I2(e))return qI(e);if(D2(e))return VI(e)}throw M2(e)}i(Na,"innerFrom");a(Na,"innerFrom");function $I(e){return new dn(function(t){var r=e[_2]();if(Sr(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i($I,"fromInteropObservable");a($I,"fromInteropObservable");function zI(e){return new dn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(zI,"fromArrayLike");a(zI,"fromArrayLike");function HI(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,b2)})}i(HI,"fromPromise");a(HI,"fromPromise");function qI(e){return new dn(function(t){var r,n;try{for(var o=Mc(e),s=o.next();!s.done;s=o.next()){var c=s.value;if(t.next(c),t.closed)return}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}i(qI,"fromIterable");a(qI,"fromIterable");function R2(e){return new dn(function(t){KI(e,t).catch(function(r){return t.error(r)})})}i(R2,"fromAsyncIterable");a(R2,"fromAsyncIterable");function VI(e){return R2(k2(e))}i(VI,"fromReadableStreamLike");a(VI,"fromReadableStreamLike");function KI(e,t){var r,n,o,s;return EI(this,void 0,void 0,function(){var c,l;return v2(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),r=SI(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(),o={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(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(KI,"process2");a(KI,"process");function Ta(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}i(Ta,"executeSchedule");a(Ta,"executeSchedule");function O2(e,t){return t===void 0&&(t=0),Qo(function(r,n){r.subscribe(vo(n,function(o){return Ta(n,e,function(){return n.next(o)},t)},function(){return Ta(n,e,function(){return n.complete()},t)},function(o){return Ta(n,e,function(){return n.error(o)},t)}))})}i(O2,"observeOn");a(O2,"observeOn");function N2(e,t){return t===void 0&&(t=0),Qo(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(N2,"subscribeOn");a(N2,"subscribeOn");function GI(e,t){return Na(e).pipe(N2(t),O2(t))}i(GI,"scheduleObservable");a(GI,"scheduleObservable");function WI(e,t){return Na(e).pipe(N2(t),O2(t))}i(WI,"schedulePromise");a(WI,"schedulePromise");function JI(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(JI,"scheduleArray");a(JI,"scheduleArray");function ZI(e,t){return new dn(function(r){var n;return Ta(r,t,function(){n=e[jI](),Ta(r,t,function(){var o,s,c;try{o=n.next(),s=o.value,c=o.done}catch(l){r.error(l);return}c?r.complete():r.next(s)},0,!0)}),function(){return Sr(n?.return)&&n.return()}})}i(ZI,"scheduleIterable");a(ZI,"scheduleIterable");function P2(e,t){if(!e)throw new Error("Iterable cannot be null");return new dn(function(r){Ta(r,t,function(){var n=e[Symbol.asyncIterator]();Ta(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}i(P2,"scheduleAsyncIterable");a(P2,"scheduleAsyncIterable");function YI(e,t){return P2(k2(e),t)}i(YI,"scheduleReadableStreamLike");a(YI,"scheduleReadableStreamLike");function XI(e,t){if(e!=null){if(T2(e))return GI(e,t);if(S2(e))return JI(e,t);if(x2(e))return WI(e,t);if(C2(e))return P2(e,t);if(I2(e))return ZI(e,t);if(D2(e))return YI(e,t)}throw M2(e)}i(XI,"scheduled");a(XI,"scheduled");function QI(e,t){return t?XI(e,t):Na(e)}i(QI,"from3");a(QI,"from");var ek=Vm(function(e){return a(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function tk(e){return e instanceof Date&&!isNaN(e)}i(tk,"isValidDate");a(tk,"isValidDate");function B2(e,t){return Qo(function(r,n){var o=0;r.subscribe(vo(n,function(s){n.next(e.call(t,s,o++))}))})}i(B2,"map");a(B2,"map");var RH=Array.isArray;function rk(e,t){return RH(t)?e.apply(void 0,_s([],Ia(t))):e(t)}i(rk,"callOrApply");a(rk,"callOrApply");function nk(e){return B2(function(t){return rk(e,t)})}i(nk,"mapOneOrManyArgs");a(nk,"mapOneOrManyArgs");function ik(e,t,r,n,o,s,c,l){var h=[],p=0,g=0,v=!1,y=a(function(){v&&!h.length&&!p&&t.complete()},"checkComplete"),_=a(function(O){return p<n?x(O):h.push(O)},"outerNext"),x=a(function(O){s&&t.next(O),p++;var D=!1;Na(r(O,g++)).subscribe(vo(t,function(P){o?.(P),s?_(P):t.next(P)},function(){D=!0},void 0,function(){if(D)try{p--;for(var P=a(function(){var J=h.shift();c?Ta(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(vo(t,_,function(){v=!0,y()})),function(){l?.()}}i(ik,"mergeInternals");a(ik,"mergeInternals");function Wm(e,t,r){return r===void 0&&(r=1/0),Sr(t)?Wm(function(n,o){return B2(function(s,c){return t(n,s,o,c)})(Na(e(n,o)))},r):(typeof t=="number"&&(r=t),Qo(function(n,o){return ik(n,o,e,r)}))}i(Wm,"mergeMap");a(Wm,"mergeMap");function ok(e){return e===void 0&&(e=1/0),Wm(Gm,e)}i(ok,"mergeAll");a(ok,"mergeAll");var OH=["addListener","removeListener"],NH=["addEventListener","removeEventListener"],PH=["on","off"];function sm(e,t,r,n){if(Sr(r)&&(n=r,r=void 0),n)return sm(e,t,r).pipe(nk(n));var o=Ia(ck(e)?NH.map(function(l){return function(h){return e[l](t,h,r)}}):ak(e)?OH.map(Wb(e,t)):sk(e)?PH.map(Wb(e,t)):[],2),s=o[0],c=o[1];if(!s&&S2(e))return Wm(function(l){return sm(l,t,r)})(Na(e));if(!s)throw new TypeError("Invalid event target");return new dn(function(l){var h=a(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(sm,"fromEvent");a(sm,"fromEvent");function Wb(e,t){return function(r){return function(n){return e[r](t,n)}}}i(Wb,"toCommonHandlerRegistry");a(Wb,"toCommonHandlerRegistry");function ak(e){return Sr(e.addListener)&&Sr(e.removeListener)}i(ak,"isNodeStyleEventEmitter");a(ak,"isNodeStyleEventEmitter");function sk(e){return Sr(e.on)&&Sr(e.off)}i(sk,"isJQueryStyleEventEmitter");a(sk,"isJQueryStyleEventEmitter");function ck(e){return Sr(e.addEventListener)&&Sr(e.removeEventListener)}i(ck,"isEventTarget");a(ck,"isEventTarget");function L2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=DH);var n=-1;return t!=null&&(E2(t)?r=t:n=t),new dn(function(o){var s=tk(e)?+e-r.now():e;s<0&&(s=0);var c=0;return r.schedule(function(){o.closed||(o.next(c++),0<=n?this.schedule(void 0,n):o.complete())},s)})}i(L2,"timer");a(L2,"timer");function uk(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=LI(e),n=UI(e,1/0),o=e;return o.length?o.length===1?Na(o[0]):ok(n)(QI(o,r)):BI}i(uk,"merge");a(uk,"merge");function lk(e,t){return Qo(function(r,n){var o=0;r.subscribe(vo(n,function(s){return e.call(t,s,o++)&&n.next(s)}))})}i(lk,"filter");a(lk,"filter");function fk(e){return Qo(function(t,r){var n=!1;t.subscribe(vo(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}i(fk,"defaultIfEmpty");a(fk,"defaultIfEmpty");function dk(e){return e<=0?function(){return BI}:Qo(function(t,r){var n=0;t.subscribe(vo(r,function(o){++n<=e&&(r.next(o),e<=n&&r.complete())}))})}i(dk,"take");a(dk,"take");function hk(e){return e===void 0&&(e=pk),Qo(function(t,r){var n=!1;t.subscribe(vo(r,function(o){n=!0,r.next(o)},function(){return n?r.complete():r.error(e())}))})}i(hk,"throwIfEmpty");a(hk,"throwIfEmpty");function pk(){return new ek}i(pk,"defaultErrorFactory");a(pk,"defaultErrorFactory");function mk(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?lk(function(o,s){return e(o,s,n)}):Gm,dk(1),r?fk(t):hk(function(){return new ek}))}}i(mk,"first");a(mk,"first");function gk(e,t){return Qo(function(r,n){var o=t??{},s=o.leading,c=s===void 0?!0:s,l=o.trailing,h=l===void 0?!1:l,p=!1,g=null,v=null,y=!1,_=a(function(){v?.unsubscribe(),v=null,h&&(D(),y&&n.complete())},"endThrottling"),x=a(function(){v=null,y&&n.complete()},"cleanupThrottling"),O=a(function(P){return v=Na(e(P)).subscribe(vo(n,_,x))},"startThrottle"),D=a(function(){if(p){p=!1;var P=g;g=null,n.next(P),!y&&O(P)}},"send");r.subscribe(vo(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(gk,"throttle");a(gk,"throttle");var tS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(tS||(tS={}));var cm;(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"})(cm||(cm={}));var Jb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Jb||(Jb={}));var Jm=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,GA.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===Jb.ANCHOR).map(({cid:e})=>Ar.make(this.id,e))}get state(){return(0,GA.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");a(Jm,"Stream");function Zm(){return e=>{}}i(Zm,"StreamStatic");a(Zm,"StreamStatic");var BH=ir(w$(),1);function vk(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):(uk(...e.map(r=>sm(r,"abort"))).pipe(mk()).subscribe(()=>{t.abort()}),t.signal)}i(vk,"mergeAbortSignals");a(vk,"mergeAbortSignals");var yk=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=L2(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");a(yk,"TimedAbortSignal");async function bk(e,t){let r=new AbortController,n=a(()=>{r.abort()},"onAbort");return e.addEventListener("abort",n),e.aborted&&r.abort(),t(r.signal).finally(()=>{e.removeEventListener("abort",n)})}i(bk,"abortable2");a(bk,"abortable");var LH=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||LH,n=new yk(r),o=t.signal?vk([t.signal,n.signal]):n.signal,s=await bk(o,c=>(0,BH.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");a(_i,"fetchJson");var w0=ir(Sd(),1);Wo();function Sa(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(Sa,"toCID");a(Sa,"toCID");var rS=0,Hr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,w0.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,w0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=Sa(t.jws.link),t.linkedBlock=Cr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Cr(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(t)&&(t.link=Sa(t.link)),Hr.isAnchorCommit(t)&&(t.proof=Sa(t.proof)),t.id&&(t.id=Sa(t.id)),t.prev&&(t.prev=Sa(t.prev)),t.header?.model&&(t.header.model=Cr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,w0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=cm[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!=rS&&(t.metadata.unique=Ir(t.metadata.unique,"base64")),t.doctype=Ma.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,w0.default)(e);return t.doctype&&(t.type=Ma.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:Sa(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=Sa(t.anchorProof.txHash),t.anchorProof.root=Sa(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=cm[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!=rS&&(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");a(Hr,"StreamUtils");var wk=i(class extends TH{next(e){let t=this.value;Hr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");a(wk,"StreamStateSubject");var UH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate3"),bi,ab={anchor:!0,publish:!0,pin:!0,sync:ei.PREFER_CACHE},FH={sync:ei.PREFER_CACHE},nS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function R0(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,yH.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(R0,"headerFromMetadata");a(R0,"headerFromMetadata");async function Zb(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(Zb,"getAuthenticatedDID");a(Zb,"getAuthenticatedDID");async function O0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(O0,"throwReadOnlyError");a(O0,"throwReadOnlyError");var ka=bi=a(i(class extends Jm{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,vH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,o={}){o={...ab,...o},!n?.deterministic&&o.syncTimeoutSeconds==null&&(o.syncTimeoutSeconds=0);let s=o.asDID?{did:o.asDID}:t,c=await bi.makeGenesis(s,r,n);return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,c,o)}static async createFromGenesis(t,r,n={}){n={...ab,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let o=r.data?await bi._signDagJWS(t,r):r;return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,o,n)}static async deterministic(t,r,n={}){if(n={...ab,...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 o=await bi.makeGenesis(t,null,r);return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...FH,...n};let o=ws.from(r);if(o.type!=bi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${bi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...nS,...n};let o=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(o,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...nS,...r};let o={header:R0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await bi._signDagJWS(this.api,o),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=O0,this.patch=O0,this.sync=O0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let o=await this._makeRawCommit(r,n);return bi._signDagJWS(t,o)}async _makeRawCommit(t,r){r||(r={});let n=R0(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 o=sI.compare(this.content,t),s=this.state.log[0];return{header:n,data:o,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 Zb(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 o=R0(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:o};return Bm(c),c}let s={data:r,header:o};return bi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await Zb(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");ka.STREAM_TYPE_NAME="tile";ka.STREAM_TYPE_ID=0;ka=bi=UH([Zm()],ka);var jH=ir(_$(),1);function _k(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(_k,"_checkPrivateRedeclaration2");a(_k,"_checkPrivateRedeclaration");function Ek(e,t){return t.get?t.get.call(e):t.value}i(Ek,"_classApplyDescriptorGet2");a(Ek,"_classApplyDescriptorGet");function Ak(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(Ak,"_classApplyDescriptorSet2");a(Ak,"_classApplyDescriptorSet");function U2(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(U2,"_classExtractFieldDescriptor2");a(U2,"_classExtractFieldDescriptor");function N0(e,t){var r=U2(e,t,"get");return Ek(e,r)}i(N0,"_classPrivateFieldGet2");a(N0,"_classPrivateFieldGet");function Yb(e,t,r){_k(e,t),t.set(e,r)}i(Yb,"_classPrivateFieldInit2");a(Yb,"_classPrivateFieldInit");function Xb(e,t,r){var n=U2(e,t,"set");return Ak(e,n,r),r}i(Xb,"_classPrivateFieldSet2");a(Xb,"_classPrivateFieldSet");function Sk(e){return typeof e=="string"||Ar.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(Sk,"keyToQuery");a(Sk,"keyToQuery");function P0(e){return typeof e=="string"?ws.from(e).toString():Ar.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(P0,"keyToString");a(P0,"keyToString");async function xk(e){let t=await ka.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(xk,"getDeterministicQuery");a(xk,"getDeterministicQuery");var $H=a(()=>Promise.resolve([]),"tempBatchLoadFn"),_0=new WeakMap,sb=new WeakMap,zH=i(class extends jH.default{cache(e){if(!N0(this,sb))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await ka.create(N0(this,_0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await xk(e);try{return await super.load(r)}catch{let o=await ka.createFromGenesis(N0(this,_0),r.genesis,t);return this.cache(o),o}}async load(e){return await super.load(e)}async update(e,t,r,n){let o=P0(e);this.clear(o);let s=await this.load({streamId:o});return await s.update(t,r,n),s}constructor(e){super($H,{cache:!0,cacheKeyFn:P0,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),Yb(this,_0,{writable:!0,value:void 0}),Yb(this,sb,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(Sk),e.multiqueryTimeout);return t.map(n=>{let o=P0(n),s=r[o];return s||new Error(`Failed to load stream: ${o}`)})},Xb(this,_0,e.ceramic),Xb(this,sb,!!e.cache)}},"TileLoader");a(zH,"TileLoader");function Qb(e){return typeof e=="string"?Xt.fromString(e):e}i(Qb,"typeStreamID");a(Qb,"typeStreamID");function Tk(e,t){let r=new URL(e);for(let[n,o]of Object.entries(t))Xt.isInstance(o)?r.searchParams.set(n,o.toString()):typeof o=="object"?r.searchParams.set(n,JSON.stringify(o)):r.searchParams.set(n,o);return r}i(Tk,"serializeObjectToSearchParams");a(Tk,"serializeObjectToSearchParams");function e6(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(e6,"serializeObjectForHttpPost");a(e6,"serializeObjectForHttpPost");var Vi=i(class extends dn{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=L2(0,r).pipe(gk(()=>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 wk(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,o){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,o)}static async applyCommit(e,t,r,n,o){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,o)}static async _load(e,t,r){let n=Tk(new URL(`./streams/${e}`,t),r),{state:o}=await _i(n);return o}static async load(e,t,r,n){let o=await Vi._load(e,t,n);return new Vi(Hr.deserializeState(o),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await _i(r);return n.map(o=>({cid:o.cid,value:Hr.deserializeCommit(o.value)}))}complete(){this.state$.complete()}},"Document");a(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 iS=ir(Sd(),1),oS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(oS||(oS={}));var t6;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(t6||(t6={}));var Ck=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,iS.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===t6.ANCHOR).map(({cid:e})=>Ar.make(this.id,e))}get state(){return(0,iS.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");a(Ck,"Stream");function Mk(){return e=>{}}i(Mk,"StreamStatic2");a(Mk,"StreamStatic");function Ik(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(Ik,"normalizeAccountId");a(Ik,"normalizeAccountId");var HH="(?:%[0-9a-fA-F]{2})",aS=`(?:[a-zA-Z0-9._-]|${HH})`,qH="([a-z0-9]+)",VH=`((?:${aS}*:)*(${aS}+))`,sS="[a-zA-Z0-9_.:%-]",KH=`;${sS}+=${sS}*`,GH=`((${KH})*)`,WH="(/[^#?]*)?",JH="([?][^#]*)?",ZH="(#.*)?",YH=new RegExp(`^did:${qH}:${VH}${GH}${WH}${JH}${ZH}$`);function kk(e){if(e===""||!e)return null;let t=e.match(YH);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 o of n){let s=o.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(kk,"parse2");a(kk,"parse");var XH=ir(Sd(),1),QH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate4"),yc,cb=a(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),cS={anchor:!1,publish:!0,sync:ud.PREFER_CACHE},ub={anchor:!0,publish:!0},eq={sync:ud.PREFER_CACHE},Gu=yc=a(i(class extends Ck{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,XH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...cS,...n};let o=Ik(r),s=yc.makeGenesis(o);return yc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...cS,...n},t.createStreamFromGenesis(yc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...ub,...n};let o=typeof t=="string"?t.trim():t.id;if(kk(o)?.did!==o)throw new Error(`DID is not valid: '${o}'`);let c=await r.createLink(o);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...ub,...r};let n=this.makeCommit(t),o=await this.api.applyCommit(this.id,n,r);this.state$.next(o.state)}async clearDid(t,r={}){r={...ub,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...eq,...n};let o=ws.from(r);if(o.type!=yc.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${yc.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,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=cb,this.setDid=cb,this.sync=cb,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");Gu.STREAM_TYPE_NAME="caip10-link";Gu.STREAM_TYPE_ID=1;Gu=yc=QH([Mk()],Gu);Wo();ol();var tq=ir(R$(),1),rq=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate5"),zo,nq={sync:ei.PREFER_CACHE};async function r6(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(r6,"_ensureAuthenticated");a(r6,"_ensureAuthenticated");async function Dk(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(Dk,"throwReadOnlyError3");a(Dk,"throwReadOnlyError");var Ic=zo=a(i(class extends Jm{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:zo.MODEL}}static async create(t,r,n){zo.assertComplete(r);let o={publish:!0,anchor:!0,pin:!0,sync:ei.NEVER_SYNC,throwOnInvalidCommit:!0},s=await zo._makeGenesis(t,r,n);return await t.createStreamFromGenesis(zo.STREAM_TYPE_ID,s,o)}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={...nq,...n};let o=ws.from(r);if(o.type!=zo.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${zo.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return await t.loadStream(o,n)}static async _makeGenesis(t,r,n){let o=await this._makeRawGenesis(t,r,n);return zo._signDagJWS(t,o)}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 r6(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let o={controllers:[n.controller],model:zo.MODEL.bytes};return{data:r,header:o}}makeReadOnly(){this.sync=Dk,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await r6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Ic.STREAM_TYPE_NAME="model";Ic.STREAM_TYPE_ID=2;Ic.MODEL=function(){let e=Bm("model-v1"),t=tq.default.encode(e,"identity"),r=Hu(K0,t),n=$t.createV1(K0,r);return new Xt("UNLOADABLE",n)}();Ic=zo=rq([Zm()],Ic);var iq=ir(cl(),1),oq=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate6"),so,aq={anchor:!0,publish:!0,pin:!0,sync:ei.NEVER_SYNC,syncTimeoutSeconds:0},sq={anchor:!1,publish:!1,pin:!0,sync:ei.PREFER_CACHE},cq={sync:ei.PREFER_CACHE},uS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function n6(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(n6,"_ensureAuthenticated2");a(n6,"_ensureAuthenticated");async function B0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(B0,"throwReadOnlyError4");a(B0,"throwReadOnlyError");var Wu=so=a(i(class extends Jm{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,o={}){o={...aq,...o};let s=o.asDID?{did:o.asDID}:t,c=await so._makeGenesis(s,r,n);return t.createStreamFromGenesis(so.STREAM_TYPE_ID,c,o)}static async single(t,r,n={}){n={...sq,...n};let o=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await so._makeGenesis(o,null,r);return t.createStreamFromGenesis(so.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...cq,...n};let o=ws.from(r);if(o.type!=so.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${so.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async replace(t,r={}){r={...uS,...r};let n=r.asDID?{did:r.asDID}:this.api,o=await this._makeCommit(n,t),s=await this.api.applyCommit(this.id,o,r);this.state$.next(s.state)}async patch(t,r={}){r={...uS,...r};let n={data:t,prev:this.tip,id:this.id.cid},o=await so._signDagJWS(this.api,n),s=await this.api.applyCommit(this.id,o,r);this.state$.next(s.state)}makeReadOnly(){this.replace=B0,this.patch=B0,this.sync=B0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return so._signDagJWS(t,n)}_makeRawCommit(t){return{data:sI.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let o=await this._makeRawGenesis(t,r,n);return n.deterministic?(Bm(o),o):so._signDagJWS(t,o)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let o=n.controller;if(!o)if(t.did)await n6(t),o=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let s={controllers:[o],model:n.model.bytes};return n.deterministic||(s.unique=(0,iq.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await n6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");Wu.STREAM_TYPE_NAME="MID";Wu.STREAM_TYPE_ID=3;Wu=so=oq([Zm()],Wu);var Rk=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 o=0;return{next(){return o===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[o++],done:!1})}}}}}},"RemotePinApi");a(Rk,"RemotePinApi");var Ok=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:e6(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:e6(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:Hr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");a(Ok,"RemoteIndexApi");var Nk=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,o=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${o.signatures[0].protected}.${o.payload}.${o.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");a(Nk,"RemoteAdminApi");var uq="/api/v0/",lq="http://localhost:7007",fq={syncInterval:5e3},dq={anchor:!0,publish:!0,sync:ei.PREFER_CACHE},hq={anchor:!0,publish:!0,sync:ei.PREFER_CACHE},lS={sync:ei.PREFER_CACHE},pq=i(class{constructor(e=lq,t={}){this._config={...fq,...t},this._apiUrl=new URL(uq,e),this._streamCache=new Map,this.context={api:this},this.pin=new Rk(this._apiUrl),this.index=new Ok(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new Nk(this._apiUrl,r),this._streamConstructors={[Gu.STREAM_TYPE_ID]:Gu,[Ic.STREAM_TYPE_ID]:Ic,[Wu.STREAM_TYPE_ID]:Wu,[ka.STREAM_TYPE_ID]:ka}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...hq,...r};let n=await Vi.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),o=this._streamCache.get(n.id.toString());return o?(Hr.statesEqual(n.state,o.state)||o.next(n.state),this.buildStreamFromDocument(o)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...lS,...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),o=await _i(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(o).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=Qb(e);return Vi.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={...dq,...r};let n=Qb(e),o=await Vi.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),s=this._streamCache.get(n.toString());return s?(s.next(o.state),this.buildStreamFromDocument(o)):(this._streamCache.set(n.toString(),o),this.buildStreamFromDocument(o))}async requestAnchor(e,t={}){t={...lS,...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");a(pq,"CeramicClient");var nr;(function(e){e.assertEqual=o=>o;function t(o){}i(t,"assertIs"),a(t,"assertIs"),e.assertIs=t;function r(o){throw new Error}i(r,"assertNever"),a(r,"assertNever"),e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let c of o)s[c]=c;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),c={};for(let l of s)c[l]=o[l];return e.objectValues(c)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let c in o)Object.prototype.hasOwnProperty.call(o,c)&&s.push(c);return s},e.find=(o,s)=>{for(let c of o)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),a(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(o,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=a(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"]),mq=a(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ho=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(o){return o.message},r={_errors:[]},n=a(o=>{for(let s of o.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");a(Ho,"ZodError");Ho.create=e=>new Ho(e);var ld=a((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"),Pk=ld;function Bk(e){Pk=e}i(Bk,"setErrorMap");a(Bk,"setErrorMap");function fd(){return Pk}i(fd,"getErrorMap");a(fd,"getErrorMap");var um=a(e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],c={...o,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...o,path:s,message:o.message||l}},"makeIssue"),gq=[];function gt(e,t){let r=um({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");a(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:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return Rt;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),(typeof s.value<"u"||n.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},"ParseStatus");a(Bn,"ParseStatus");var Rt=Object.freeze({status:"aborted"}),Lk=a(e=>({status:"dirty",value:e}),"DIRTY"),xn=a(e=>({status:"valid",value:e}),"OK"),i6=a(e=>e.status==="aborted","isAborted"),o6=a(e=>e.status==="dirty","isDirty"),lm=a(e=>e.status==="valid","isValid"),fm=a(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 yo=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");a(yo,"ParseInputLazyPath");var fS=a((e,t)=>{if(lm(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Ho(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:o}=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:o}:{errorMap:a((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:o}}i(zt,"processCreateParams");a(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(fm(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)},o=this._parseSync({data:e,path:n.path,parent:n});return fS(n,o)}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}),o=await(fm(n)?n:Promise.resolve(n));return fS(r,o)}refine(e,t){let r=a(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,o)=>{let s=e(n),c=a(()=>o.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 go.create(this)}nullable(){return As.create(this)}nullish(){return this.optional().nullable()}array(){return mo.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 j2({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");a(jt,"ZodType");var vq=/^c[^\s-]{8,}$/i,yq=/^([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,bq=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,wq=a(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"),Da=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 Da({...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 o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.string,received:o.parsedType}),Rt}let r=new Bn,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,c=e.data.length<o.value;(s||c)&&(n=this._getOrReturnCtx(e,n),s?gt(n,{code:Ge.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):c&>(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")bq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"email",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")yq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"uuid",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")vq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"cuid",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),gt(n,{validation:"url",code:Ge.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"regex",code:Ge.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?wq(o).test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:"datetime",message:o.message}),r.dirty()):nr.assertNever(o);return{status:r.value,value:e.data}}_addCheck(e){return new Da({...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");a(Da,"ZodString");Da.create=e=>{var t;return new Da({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function Uk(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),c=parseInt(t.toFixed(o).replace(".",""));return s%c/Math.pow(10,o)}i(Uk,"floatSafeRemainder");a(Uk,"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 o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.number,received:o.parsedType}),Rt}let r,n=new Bn;for(let o of this._def.checks)o.kind==="int"?nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?Uk(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_finite,message:o.message}),n.dirty()):nr.assertNever(o);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");a(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");a(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");a(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 o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.date,received:o.parsedType}),Rt}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_date}),Rt}let r=new Bn,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):nr.assertNever(o);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");a(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");a(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");a(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");a(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");a(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");a(ms,"ZodUnknown");ms.create=e=>new ms({typeName:Tt.ZodUnknown,...zt(e)});var qo=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");a(qo,"ZodNever");qo.create=e=>new qo({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");a(hd,"ZodVoid");hd.create=e=>new hd({typeName:Tt.ZodVoid,...zt(e)});var mo=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 yo(t,s,t.path,c)))).then(s=>Bn.mergeArray(r,s));let o=t.data.map((s,c)=>n.type._parseSync(new yo(t,s,t.path,c)));return Bn.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new mo({...this._def,minLength:{value:e,message:Jt.toString(t)}})}max(e,t){return new mo({...this._def,maxLength:{value:e,message:Jt.toString(t)}})}length(e,t){return new mo({...this._def,exactLength:{value:e,message:Jt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");a(mo,"ZodArray");mo.create=(e,t)=>new mo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tt.ZodArray,...zt(t)});var dm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(dm||(dm={}));var dS=a(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]=go.create(wc(n))}return new Dr({...e._def,shape:()=>t})}else return e instanceof mo?mo.create(wc(e.element)):e instanceof go?go.create(wc(e.unwrap())):e instanceof As?As.create(wc(e.unwrap())):e instanceof Vo?Vo.create(e.items.map(t=>wc(t))):e}i(wc,"deepPartialify");a(wc,"deepPartialify");var Dr=i(class extends jt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=dS(this._def),this.extend=dS(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:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof qo&&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=o[h],g=n.data[h];l.push({key:{status:"valid",value:h},value:p._parse(new yo(n,g,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof qo){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 yo(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,o,s,c;let l=(s=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.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:()=>dm.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 o=this.shape[r];for(;o instanceof go;)o=o._def.innerType;t[r]=o}});else for(let r in this.shape){let o=this.shape[r];for(;o instanceof go;)o=o._def.innerType;t[r]=o}return new Dr({...this._def,shape:()=>t})}keyof(){return F2(nr.objectKeys(this.shape))}},"ZodObject");a(Dr,"ZodObject");Dr.create=(e,t)=>new Dr({shape:()=>e,unknownKeys:"strip",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});Dr.strictCreate=(e,t)=>new Dr({shape:()=>e,unknownKeys:"strict",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});Dr.lazycreate=(e,t)=>new Dr({shape:e,unknownKeys:"strip",catchall:qo.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(o){for(let c of o)if(c.result.status==="valid")return c.result;for(let c of o)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=o.map(c=>new Ho(c.ctx.common.issues));return gt(t,{code:Ge.invalid_union,unionErrors:s}),Rt}if(i(n,"handleResults"),a(n,"handleResults"),t.common.async)return Promise.all(r.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let o,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"&&!o&&(o={result:p,ctx:h}),h.common.issues.length&&s.push(h.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let c=s.map(l=>new Ho(l));return gt(t,{code:Ge.invalid_union,unionErrors:c}),Rt}}get options(){return this._def.options}},"ZodUnion");a(Qu,"ZodUnion");Qu.create=(e,t)=>new Qu({options:e,typeName:Tt.ZodUnion,...zt(t)});var L0=a(e=>e instanceof tl?L0(e.schema):e instanceof Gi?L0(e.innerType()):e instanceof rl?[e.value]:e instanceof wl?e.options:e instanceof nl?Object.keys(e.enum):e instanceof il?L0(e._def.innerType):e instanceof Yu?[void 0]:e instanceof Xu?[null]:null,"getDiscriminator"),Ym=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],o=this.optionsMap.get(n);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._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 o of t){let s=L0(o.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,o)}}return new Ym({typeName:Tt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...zt(r)})}},"ZodDiscriminatedUnion");a(Ym,"ZodDiscriminatedUnion");function hm(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 o=nr.objectKeys(t),s=nr.objectKeys(e).filter(l=>o.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=hm(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 o=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=hm(c,l);if(!h.valid)return{valid:!1};o.push(h.data)}return{valid:!0,data:o}}else return r===rt.date&&n===rt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(hm,"mergeValues");a(hm,"mergeValues");var el=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=a((o,s)=>{if(i6(o)||i6(s))return Rt;let c=hm(o.value,s.value);return c.valid?((o6(o)||o6(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(([o,s])=>n(o,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");a(el,"ZodIntersection");el.create=(e,t,r)=>new el({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var Vo=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 o=r.data.map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new yo(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Bn.mergeArray(t,s)):Bn.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Vo({...this._def,rest:e})}},"ZodTuple");a(Vo,"ZodTuple");Vo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vo({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=[],o=this._def.keyType,s=this._def.valueType;for(let c in r.data)n.push({key:o._parse(new yo(r,c,r.path,c)),value:s._parse(new yo(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:Da.create(),valueType:e,typeName:Tt.ZodRecord,...zt(t)})}},"ZodRecord");a(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,o=this._def.valueType,s=[...r.data.entries()].map(([c,l],h)=>({key:n._parse(new yo(r,c,r.path,[h,"key"])),value:o._parse(new yo(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");a(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 o=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"),a(s,"finalizeSet");let c=[...r.data.values()].map((l,h)=>o._parse(new yo(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");a(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 um({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"),a(r,"makeArgsIssue");function n(c,l){return um({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"),a(n,"makeReturnsIssue");let o={errorMap:t.common.contextualErrorMap},s=t.data;return this._def.returns instanceof Oc?xn(async(...c)=>{let l=new Ho([]),h=await this._def.args.parseAsync(c,o).catch(v=>{throw l.addIssue(r(c,v)),l}),p=await s(...h);return await this._def.returns._def.type.parseAsync(p,o).catch(v=>{throw l.addIssue(n(p,v)),l})}):xn((...c)=>{let l=this._def.args.safeParse(c,o);if(!l.success)throw new Ho([r(c,l.error)]);let h=s(...l.data),p=this._def.returns.safeParse(h,o);if(!p.success)throw new Ho([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:Vo.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||Vo.create([]).rest(ms.create()),returns:t||ms.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");a(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");a(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");a(rl,"ZodLiteral");rl.create=(e,t)=>new rl({value:e,typeName:Tt.ZodLiteral,...zt(t)});function F2(e,t){return new wl({values:e,typeName:Tt.ZodEnum,...zt(t)})}i(F2,"createZodEnum");a(F2,"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");a(wl,"ZodEnum");wl.create=F2;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");a(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");a(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 o={addIssue:s=>{gt(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="refinement"){let s=a(c=>{let l=n.refinement(c,o);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(!lm(s))return s;let c=n.transform(s.value,o);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=>lm(s)?Promise.resolve(n.transform(s.value,o)).then(c=>({status:t.value,value:c})):s);nr.assertNever(n)}},"ZodEffects");a(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 go=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");a(go,"ZodOptional");go.create=(e,t)=>new go({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");a(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");a(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 fm(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");a(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");a(vd,"ZodNaN");vd.create=e=>new vd({typeName:Tt.ZodNaN,...zt(e)});var _q=Symbol("zod_brand"),j2=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");a(j2,"ZodBranded");var Nd=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return a(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Rt:o.status==="dirty"?(t.dirty(),Lk(o.value)):this._def.out._parseAsync({data:o.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");a(Nd,"ZodPipeline");var Fk=a((e,t={},r)=>e?Dc.create().superRefine((n,o)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...c,fatal:r})}}):Dc.create(),"custom"),Eq={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 Aq=a((e,t={message:`Input not instance of ${e.name}`})=>Fk(r=>r instanceof e,t,!0),"instanceOfType"),jk=Da.create,$k=Es.create,Sq=vd.create,xq=Ju.create,zk=Zu.create,Tq=kc.create,Cq=dd.create,Mq=Yu.create,Iq=Xu.create,kq=Dc.create,Dq=ms.create,Rq=qo.create,Oq=hd.create,Nq=mo.create,Pq=Dr.create,Bq=Dr.strictCreate,Lq=Qu.create,Uq=Ym.create,Fq=el.create,jq=Vo.create,$q=pd.create,zq=md.create,Hq=Rc.create,qq=ju.create,Vq=tl.create,Kq=rl.create,Gq=wl.create,Wq=nl.create,Jq=Oc.create,hS=Gi.create,Zq=go.create,Yq=As.create,Xq=Gi.createWithPreprocess,Qq=Nd.create,eV=a(()=>jk().optional(),"ostring"),tV=a(()=>$k().optional(),"onumber"),rV=a(()=>zk().optional(),"oboolean"),nV={string:e=>Da.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})},iV=Rt,V=Object.freeze({__proto__:null,defaultErrorMap:ld,setErrorMap:Bk,getErrorMap:fd,makeIssue:um,EMPTY_PATH:gq,addIssueToContext:gt,ParseStatus:Bn,INVALID:Rt,DIRTY:Lk,OK:xn,isAborted:i6,isDirty:o6,isValid:lm,isAsync:fm,get util(){return nr},ZodParsedType:rt,getParsedType:hs,ZodType:jt,ZodString:Da,ZodNumber:Es,ZodBigInt:Ju,ZodBoolean:Zu,ZodDate:kc,ZodSymbol:dd,ZodUndefined:Yu,ZodNull:Xu,ZodAny:Dc,ZodUnknown:ms,ZodNever:qo,ZodVoid:hd,ZodArray:mo,get objectUtil(){return dm},ZodObject:Dr,ZodUnion:Qu,ZodDiscriminatedUnion:Ym,ZodIntersection:el,ZodTuple:Vo,ZodRecord:pd,ZodMap:md,ZodSet:Rc,ZodFunction:ju,ZodLazy:tl,ZodLiteral:rl,ZodEnum:wl,ZodNativeEnum:nl,ZodPromise:Oc,ZodEffects:Gi,ZodTransformer:Gi,ZodOptional:go,ZodNullable:As,ZodDefault:il,ZodCatch:gd,ZodNaN:vd,BRAND:_q,ZodBranded:j2,ZodPipeline:Nd,custom:Fk,Schema:jt,ZodSchema:jt,late:Eq,get ZodFirstPartyTypeKind(){return Tt},coerce:nV,any:kq,array:Nq,bigint:xq,boolean:zk,date:Tq,discriminatedUnion:Uq,effect:hS,enum:Gq,function:qq,instanceof:Aq,intersection:Fq,lazy:Vq,literal:Kq,map:zq,nan:Sq,nativeEnum:Wq,never:Rq,null:Iq,nullable:Yq,number:$k,object:Pq,oboolean:rV,onumber:tV,optional:Zq,ostring:eV,pipeline:Qq,preprocess:Xq,promise:Jq,record:$q,set:Hq,strictObject:Bq,string:jk,symbol:Cq,transformer:hS,tuple:jq,undefined:Mq,union:Lq,unknown:Dq,void:Oq,NEVER:iV,ZodIssueCode:Ge,quotelessJson:mq,ZodError:Ho}),oV=Object.defineProperty,aV=a((e,t)=>oV(e,"name",{value:t,configurable:!0}),"__name"),Xm=V.array(V.string().or(V.record(V.any()))),HY=V.object({type:V.string().optional(),narrative:V.string().optional()}),Qm=V.string().or(V.object({id:V.string(),type:V.string(),caption:V.string().optional()})),sV=V.object({type:V.string().min(1).or(V.string().array().nonempty()),latitude:V.number(),longitude:V.number()}),cV=V.object({type:V.string().min(1).or(V.string().array().nonempty()),addressCountry:V.string().optional(),addressCountryCode:V.string().optional(),addressRegion:V.string().optional(),addressLocality:V.string().optional(),streetAddress:V.string().optional(),postOfficeBoxNumber:V.string().optional(),postalCode:V.string().optional(),geo:sV.optional()}),uV=V.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(V.string()),Hk=V.object({type:V.string().min(1).or(V.string().array().nonempty()),identifier:V.string(),identifierType:uV}),yd=V.string().or(V.object({id:V.string().optional(),type:V.string().or(V.string().array().nonempty().optional()),name:V.string().optional(),url:V.string().optional(),phone:V.string().optional(),description:V.string().optional(),endorsement:V.any().array().optional(),image:Qm.optional(),email:V.string().email().optional(),address:cV.optional(),otherIdentifier:Hk.array().optional(),official:V.string().optional(),parentOrg:V.any().optional(),familyName:V.string().optional(),givenName:V.string().optional(),additionalName:V.string().optional(),patronymicName:V.string().optional(),honorificPrefix:V.string().optional(),honorificSuffix:V.string().optional(),familyNamePrefix:V.string().optional(),dateOfBirth:V.string().optional()}).catchall(V.any())),a6=V.object({id:V.string().optional()}).catchall(V.any()),lV=V.object({type:V.string(),id:V.string()}).catchall(V.any()),fV=V.object({id:V.string(),type:V.string()}).catchall(V.any()),dV=V.object({id:V.string(),type:V.string()}).catchall(V.any()),pm=V.object({"@context":Xm,id:V.string().optional(),type:V.string().array().nonempty(),issuer:yd,issuanceDate:V.string(),expirationDate:V.string().optional(),credentialSubject:a6.or(a6.array()),credentialStatus:lV.optional(),credentialSchema:fV.array().optional(),refreshService:dV.optional()}).catchall(V.any()),Ko=V.object({type:V.string(),created:V.string(),challenge:V.string().optional(),domain:V.string().optional(),nonce:V.string().optional(),proofPurpose:V.string(),verificationMethod:V.string(),jws:V.string().optional()}).catchall(V.any()),pS=pm.extend({proof:Ko.or(Ko.array())}),hV=V.object({"@context":Xm,id:V.string().optional(),type:V.string().or(V.string().array().nonempty()),verifiableCredential:pS.or(pS.array()).optional(),holder:V.string().optional()}).catchall(V.any()),qY=hV.extend({proof:Ko.or(Ko.array())}),$2=V.object({kty:V.string(),crv:V.string(),x:V.string(),y:V.string().optional(),n:V.string().optional(),d:V.string().optional()}),VY=$2.omit({d:!0}).extend({d:V.string()}),pV=V.object({alg:V.string(),iv:V.string(),tag:V.string(),epk:$2.partial().optional(),kid:V.string().optional(),apv:V.string().optional(),apu:V.string().optional()}),mV=V.object({header:pV,encrypted_key:V.string()}),gV=V.object({protected:V.string(),iv:V.string(),ciphertext:V.string(),tag:V.string(),aad:V.string().optional(),recipients:mV.array().optional()}),vc=V.string().or(V.object({"@context":Xm.optional(),id:V.string(),type:V.string(),controller:V.string(),publicKeyJwk:$2.optional(),publicKeyBase58:V.string().optional(),blockChainAccountId:V.string().optional()}).catchall(V.any())),vV=V.object({id:V.string(),type:V.string().or(V.string().array().nonempty()),serviceEndpoint:V.any().or(V.any().array().nonempty())}).catchall(V.any()),KY=V.object({"@context":Xm,id:V.string(),alsoKnownAs:V.string().optional(),controller:V.string().or(V.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:vV.array().optional(),proof:Ko.or(Ko.array()).optional()}).catchall(V.any()),yV=V.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(V.string()),e1=V.object({type:V.string().array().nonempty(),targetCode:V.string().optional(),targetDescription:V.string().optional(),targetName:V.string(),targetFramework:V.string().optional(),targetType:yV.optional(),targetUrl:V.string()}),bV=V.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"]),wV=bV.or(V.string()),_V=V.object({id:V.string().optional(),narrative:V.string().optional()}).catchall(V.any()),EV=V.object({id:V.string(),type:V.string().array().nonempty(),endorsementComment:V.string().optional()}),AV=pm.extend({credentialSubject:EV,proof:Ko.or(Ko.array()).optional()}),SV=V.object({id:V.string(),"@language":V.string().optional(),version:V.string().optional()}),xV=V.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(V.string()),TV=V.object({id:V.string(),type:V.string().array().nonempty(),alignment:e1.array().optional(),description:V.string().optional(),level:V.string().optional(),name:V.string(),points:V.string().optional()}).catchall(V.any()),CV=V.object({id:V.string(),type:V.string().array().nonempty(),alignment:e1.array().optional(),allowedValue:V.string().array().optional(),name:V.string(),requiredLevel:V.string().optional(),requiredValue:V.string().optional(),resultType:xV,rubricCriterionLevel:TV.array().optional(),valueMax:V.string().optional(),valueMin:V.string().optional()}).catchall(V.any()),MV=V.object({id:V.string().optional(),type:V.string().array().nonempty(),alignment:e1.array().optional(),achievementType:wV.optional(),creator:yd.optional(),creditsAvailable:V.number().optional(),criteria:_V,description:V.string(),endorsement:AV.array().optional(),fieldOfStudy:V.string().optional(),humanCode:V.string().optional(),image:Qm.optional(),"@language":V.string().optional(),name:V.string(),otherIdentifier:Hk.array().optional(),related:SV.array().optional(),resultDescription:CV.array().optional(),specialization:V.string().optional(),tag:V.string().array().optional(),version:V.string().optional()}).catchall(V.any()),IV=V.object({type:V.string(),hashed:V.boolean(),identityHash:V.string(),identityType:V.string(),salt:V.string().optional()}),kV=V.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),DV=V.object({type:V.string().array().nonempty(),achievedLevel:V.string().optional(),alignment:e1.array().optional(),resultDescription:V.string().optional(),status:kV.optional(),value:V.string().optional()}).catchall(V.any()),mS=V.object({id:V.string().optional(),type:V.string().array().nonempty(),activityEndDate:V.string().optional(),activityStartDate:V.string().optional(),creditsEarned:V.number().optional(),achievement:MV.optional(),identifier:IV.array().optional(),image:Qm.optional(),licenseNumber:V.string().optional(),narrative:V.string().optional(),result:DV.array().optional(),role:V.string().optional(),source:yd.optional(),term:V.string().optional()}).catchall(V.any()),RV=V.object({id:V.string().optional(),type:V.string().array().nonempty(),narrative:V.string().optional(),name:V.string().optional(),description:V.string().optional(),genre:V.string().optional(),audience:V.string().optional()}).catchall(V.any()),OV=pm.extend({name:V.string().optional(),description:V.string().optional(),image:Qm.optional(),credentialSubject:mS.or(mS.array()),endorsement:pm.array().optional(),evidence:RV.array().optional()}),GY=OV.extend({proof:Ko.or(Ko.array())}),WY=V.object({checks:V.string().array(),warnings:V.string().array(),errors:V.string().array()}),qk=V.enum(["Success","Failed","Error"]),JY=qk.enum,ZY=V.object({check:V.string(),status:qk,message:V.string().optional(),details:V.string().optional()}),YY=V.object({title:V.string().optional(),createdAt:V.string().optional(),issuer:yd.optional(),issuee:yd.optional(),credentialSubject:a6.optional()}),XY=V.object({id:V.string(),uri:V.string()}).catchall(V.any()),QY=V.object({limit:V.number(),cursor:V.string().optional(),sort:V.string().optional()}),ti=V.object({cursor:V.string().optional(),hasMore:V.boolean()}),Vk=V.object({encryptedRecord:gV,fields:V.string().array()}).catchall(V.any()),eX=ti.extend({records:Vk.array()}),NV=Vk.extend({id:V.string()}),tX=ti.extend({records:NV.array()}),gS=aV(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),PV=V.instanceof(RegExp).or(V.string().refine(e=>{try{return gS(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=gS(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),Er=V.string().or(V.object({$in:V.string().array()})).or(V.object({$regex:PV})),BV=V.object({backgroundColor:V.string().optional(),backgroundImage:V.string().optional(),fadeBackgroundImage:V.boolean().optional(),repeatBackgroundImage:V.boolean().optional(),fontColor:V.string().optional(),accentColor:V.string().optional(),accentFontColor:V.string().optional(),idBackgroundImage:V.string().optional(),fadeIdBackgroundImage:V.boolean().optional(),idBackgroundColor:V.string().optional(),repeatIdBackgroundImage:V.boolean().optional()}),Nc=V.object({profileId:V.string().min(3).max(40),displayName:V.string().default(""),shortBio:V.string().default(""),bio:V.string().default(""),did:V.string(),isPrivate:V.boolean().optional(),email:V.string().optional(),image:V.string().optional(),heroImage:V.string().optional(),websiteLink:V.string().optional(),isServiceProfile:V.boolean().default(!1).optional(),type:V.string().optional(),notificationsWebhook:V.string().url().startsWith("http").optional(),display:BV.optional()}),rX=V.object({profileId:Er,displayName:Er,shortBio:Er,bio:Er,email:Er,websiteLink:Er,isServiceProfile:V.boolean(),type:Er}).partial(),nX=ti.extend({records:Nc.array()}),iX=V.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Kk=V.object({id:V.string(),created:V.string(),displayName:V.string().default("").optional(),shortBio:V.string().default("").optional(),bio:V.string().default("").optional(),email:V.string().optional(),image:V.string().optional(),heroImage:V.string().optional()}),oX=ti.extend({records:Kk.extend({did:V.string()}).array()}),aX=V.object({id:Er,displayName:Er,shortBio:Er,bio:Er,email:Er}).partial(),sX=ti.extend({records:V.object({profile:Nc,manager:Kk.extend({did:V.string()}).optional()}).array()}),cX=V.object({uri:V.string(),to:V.string(),from:V.string(),sent:V.string().datetime(),received:V.string().datetime().optional()}),Gk=V.object({role:V.string(),canEdit:V.boolean(),canIssue:V.boolean(),canRevoke:V.boolean(),canManagePermissions:V.boolean(),canIssueChildren:V.string(),canCreateChildren:V.string(),canEditChildren:V.string(),canRevokeChildren:V.string(),canManageChildrenPermissions:V.string(),canManageChildrenProfiles:V.boolean().default(!1).optional(),canViewAnalytics:V.boolean()}),LV=V.object({role:Er,canEdit:V.boolean(),canIssue:V.boolean(),canRevoke:V.boolean(),canManagePermissions:V.boolean(),canIssueChildren:Er,canCreateChildren:Er,canEditChildren:Er,canRevokeChildren:Er,canManageChildrenPermissions:Er,canManageChildrenProfiles:V.boolean(),canViewAnalytics:V.boolean()}).partial(),vS=V.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),UV=V.discriminatedUnion("type",[V.object({type:V.literal(vS.Values.GRANT_PERMISSIONS),data:V.object({claimUri:V.string(),targetUri:V.string(),permissions:Gk.partial()})}),V.object({type:V.literal(vS.Values.ADD_ADMIN),data:V.object({claimUri:V.string(),targetUri:V.string()})})]),uX=V.object({type:Er,data:V.object({claimUri:Er,targetUri:Er,permissions:LV})}).deepPartial(),FV=V.object({id:V.string(),createdAt:V.string(),updatedAt:V.string()}).and(UV),lX=ti.extend({records:FV.array()}),s6=V.enum(["DRAFT","LIVE"]),jV=V.object({uri:V.string(),name:V.string().optional(),type:V.string().optional(),category:V.string().optional(),status:s6.optional(),autoConnectRecipients:V.boolean().optional(),meta:V.record(V.any()).optional(),claimPermissions:Gk.optional()}),fX=V.object({uri:Er,name:Er,type:Er,category:Er,meta:V.record(Er),status:s6.or(V.object({$in:s6.array()})),autoConnectRecipients:V.boolean()}).partial(),dX=ti.extend({records:jV.array()}),$V=V.object({to:Nc,from:V.string(),received:V.string().optional(),uri:V.string().optional()}),hX=ti.extend({records:$V.array()}),pX=V.object({endpoint:V.string(),name:V.string(),did:V.string().optional()}),mX=V.object({ttlSeconds:V.number().optional(),totalUses:V.number().optional()}),zV=V.object({endpoint:V.string()}),gX=V.object({signingAuthority:zV,relationship:V.object({name:V.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:V.string()})}),vX=V.object({boostUri:V.string(),signingAuthority:V.object({endpoint:V.string(),name:V.string()})}),HV=V.enum(["live","stale","withdrawn"]),qV=V.object({read:V.object({anonymize:V.boolean().optional(),credentials:V.object({categories:V.record(V.object({required:V.boolean()})).default({})}).default({}),personal:V.record(V.object({required:V.boolean()})).default({})}).default({}),write:V.object({credentials:V.object({categories:V.record(V.object({required:V.boolean()})).default({})}).default({}),personal:V.record(V.object({required:V.boolean()})).default({})}).default({})}),Wk=V.object({contract:qV,owner:Nc,name:V.string(),subtitle:V.string().optional(),description:V.string().optional(),reasonForAccessing:V.string().optional(),image:V.string().optional(),uri:V.string(),needsGuardianConsent:V.boolean().optional(),redirectUrl:V.string().optional(),frontDoorBoostUri:V.string().optional(),createdAt:V.string(),updatedAt:V.string(),expiresAt:V.string().optional()}),yX=ti.extend({records:Wk.omit({owner:!0}).array()}),VV=V.object({credentials:V.object({categories:V.record(V.string().array()).default({})}),personal:V.record(V.string()).default({}),date:V.string()}),bX=ti.extend({records:VV.array()}),KV=V.object({credentials:V.object({category:V.string(),uri:V.string()}).array(),personal:V.record(V.string()).default({}),date:V.string(),contractUri:V.string()}),wX=ti.extend({records:KV.array()}),Jk=V.object({sharing:V.boolean().optional(),shared:V.string().array().optional(),shareAll:V.boolean().optional(),shareUntil:V.string().optional()}),Zk=V.object({read:V.object({anonymize:V.boolean().optional(),credentials:V.object({shareAll:V.boolean().optional(),sharing:V.boolean().optional(),categories:V.record(Jk).default({})}).default({}),personal:V.record(V.string()).default({})}).default({}),write:V.object({credentials:V.object({categories:V.record(V.boolean()).default({})}).default({}),personal:V.record(V.boolean()).default({})}).default({})}),_X=ti.extend({records:V.object({expiresAt:V.string().optional(),oneTime:V.boolean().optional(),terms:Zk,contract:Wk,uri:V.string(),consenter:Nc,status:HV}).array()}),EX=V.object({read:V.object({anonymize:V.boolean().optional(),credentials:V.object({categories:V.record(V.object({required:V.boolean().optional()})).optional()}).optional(),personal:V.record(V.object({required:V.boolean().optional()})).optional()}).optional(),write:V.object({credentials:V.object({categories:V.record(V.object({required:V.boolean().optional()})).optional()}).optional(),personal:V.record(V.object({required:V.boolean().optional()})).optional()}).optional()}),AX=V.object({anonymize:V.boolean().optional(),credentials:V.object({categories:V.record(V.boolean()).optional()}).optional(),personal:V.record(V.boolean()).optional()}),SX=V.object({credentials:V.object({categories:V.record(V.boolean()).optional()}).optional(),personal:V.record(V.boolean()).optional(),id:Er.optional()}),GV=V.object({read:V.object({anonymize:V.boolean().optional(),credentials:V.object({shareAll:V.boolean().optional(),sharing:V.boolean().optional(),categories:V.record(Jk.optional()).optional()}).optional(),personal:V.record(V.string()).optional()}).optional(),write:V.object({credentials:V.object({categories:V.record(V.boolean()).optional()}).optional(),personal:V.record(V.boolean()).optional()}).optional()}),c6=V.enum(["consent","update","sync","withdraw","write"]),xX=V.object({terms:GV.optional(),action:c6.or(c6.array()).optional(),date:V.object({$gt:V.string()}).or(V.object({$lt:V.string()})).or(V.object({$eq:V.string()})).optional(),expiresAt:V.object({$gt:V.string()}).or(V.object({$lt:V.string()})).or(V.object({$eq:V.string()})).optional(),oneTime:V.boolean().optional()}),Yk=V.object({expiresAt:V.string().optional(),oneTime:V.boolean().optional(),terms:Zk.optional(),id:V.string(),action:c6,date:V.string(),uris:V.string().array().optional()}),TX=ti.extend({records:Yk.array()}),WV=V.object({credentialUri:V.string(),termsUri:V.string(),contractUri:V.string(),boostUri:V.string(),category:V.string().optional(),date:V.string()}),CX=ti.extend({records:WV.array()}),JV=V.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),ZV=V.object({title:V.string().optional(),body:V.string().optional()}),YV=V.object({vcUris:V.array(V.string()).optional(),vpUris:V.array(V.string()).optional(),transaction:Yk.optional()}),MX=V.object({type:JV,to:Nc.partial().and(V.object({did:V.string()})),from:Nc.partial().and(V.object({did:V.string()})),message:ZV.optional(),data:YV.optional(),sent:V.string().datetime().optional()}),t1=a(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),IX=V.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 z2=z.object({credentials:mc.array()}).catchall(z.any()),Xk=z.object({id:z.string(),title:z.string(),storageType:z.literal("ceramic").optional()}).catchall(z.any()),H2=z.object({credentials:mc.or(Xk).array()}).strict();var Qk={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials"};var r1=i(async(e,{modelData:t,credentialAlias:r}=Qk)=>{let n=e.invoke.getCeramicClient(),o=new Lf({ceramic:n,model:t}),s=i(async(g=r)=>{let v=await o.get(g);if(!v)return{credentials:[]};let y=await z2.spa(v);if(y.success)return y.data;let _=await H2.spa(v);if(_.success){let D={credentials:_.data.credentials.map(P=>{if("uri"in P)return P;let{title:J,id:j,storageType:H,...Q}=P;return{...Q,id:J,uri:`lc:ceramic:${j.replace("ceramic://","")}`}})};return await o.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),o.set(v,y)},"removeCredentialFromIdx"),l=i(async g=>(g||(g=r),o.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),t1(await o.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(_)})),t1(await o.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 p0.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),t1(await o.set(r,_))},removeVerifiableCredentialInIdx:async(g,v)=>c(v),removeAllVerifiableCredentialsInIdx:async()=>l(),getIDXIndex:async()=>o.get(r),setIDXIndex:async(g,v)=>o.set(r,v)}}},"getIDXPlugin");var XV=r1;
|
|
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");a(cd,"arrRemove");var Od=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return i(e,"Subscription2"),a(e,"Subscription"),e.prototype.unsubscribe=function(){var t,r,n,o,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 ob?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{qb(x)}catch(O){s=s??[],O instanceof ob?s=_s(_s([],Ia(s)),Ia(O.errors)):s.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(o=y.return)&&o.call(y)}finally{if(n)throw n.error}}}if(s)throw new ob(s)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)qb(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}(),xI=Od.EMPTY;function y2(e){return e instanceof Od||e&&"closed"in e&&Sr(e.remove)&&Sr(e.add)&&Sr(e.unsubscribe)}i(y2,"isSubscription");a(y2,"isSubscription");function qb(e){Sr(e)?e():e.unsubscribe()}i(qb,"execFinalizer");a(qb,"execFinalizer");var Hc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},om={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=om.delegate;return o?.setTimeout?o.setTimeout.apply(o,_s([e,t],Ia(r))):setTimeout.apply(void 0,_s([e,t],Ia(r)))},clearTimeout:function(e){var t=om.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function b2(e){om.setTimeout(function(){var t=Hc.onUnhandledError;if(t)t(e);else throw e})}i(b2,"reportUnhandledError");a(b2,"reportUnhandledError");function Vb(){}i(Vb,"noop");a(Vb,"noop");var wH=function(){return Km("C",void 0,void 0)}();function TI(e){return Km("E",void 0,e)}i(TI,"errorNotification");a(TI,"errorNotification");function CI(e){return Km("N",e,void 0)}i(CI,"nextNotification");a(CI,"nextNotification");function Km(e,t,r){return{kind:e,value:t,error:r}}i(Km,"createNotification");a(Km,"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,o=r.error;if(Ec=null,n)throw o}}else e()}i(Yf,"errorContext");a(Yf,"errorContext");function MI(e){Hc.useDeprecatedSynchronousErrorHandling&&Ec&&(Ec.errorThrown=!0,Ec.error=e)}i(MI,"captureError");a(MI,"captureError");var w2=function(e){Xo(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,y2(r)&&r.add(n)):n.destination=AH,n}return i(t,"Subscriber2"),a(t,"Subscriber"),t.create=function(r,n,o){return new Kb(r,n,o)},t.prototype.next=function(r){this.isStopped?D0(CI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?D0(TI(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?D0(wH,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),_H=Function.prototype.bind;function k0(e,t){return _H.call(e,t)}i(k0,"bind");a(k0,"bind");var EH=function(){function e(t){this.partialObserver=t}return i(e,"ConsumerObserver2"),a(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}(),Kb=function(e){Xo(t,e);function t(r,n,o){var s=e.call(this)||this,c;if(Sr(r)||!r)c={next:r??void 0,error:n??void 0,complete:o??void 0};else{var l;s&&Hc.useDeprecatedNextContext?(l=Object.create(r),l.unsubscribe=function(){return s.unsubscribe()},c={next:r.next&&k0(r.next,l),error:r.error&&k0(r.error,l),complete:r.complete&&k0(r.complete,l)}):c=r}return s.destination=new EH(c),s}return i(t,"SafeSubscriber2"),a(t,"SafeSubscriber"),t}(w2);function Wf(e){Hc.useDeprecatedSynchronousErrorHandling?MI(e):b2(e)}i(Wf,"handleUnhandledError");a(Wf,"handleUnhandledError");function II(e){throw e}i(II,"defaultErrorHandler");a(II,"defaultErrorHandler");function D0(e,t){var r=Hc.onStoppedNotification;r&&om.setTimeout(function(){return r(e,t)})}i(D0,"handleStoppedNotification");a(D0,"handleStoppedNotification");var AH={closed:!0,next:Vb,error:II,complete:Vb},_2=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Gm(e){return e}i(Gm,"identity3");a(Gm,"identity");function kI(e){return e.length===0?Gm:e.length===1?e[0]:a(i(function(r){return e.reduce(function(n,o){return o(n)},r)},"piped"),"piped")}i(kI,"pipeFromArray");a(kI,"pipeFromArray");var dn=function(){function e(t){t&&(this._subscribe=t)}return i(e,"Observable2"),a(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 o=this,s=RI(t)?t:new Kb(t,r,n);return Yf(function(){var c=o,l=c.operator,h=c.source;s.add(l?l.call(s,h):h?o._subscribe(s):o._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=Gb(r),new r(function(o,s){var c=new Kb({next:function(l){try{t(l)}catch(h){s(h),c.unsubscribe()}},error:s,complete:o});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[_2]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return kI(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=Gb(t),new t(function(n,o){var s;r.subscribe(function(c){return s=c},function(c){return o(c)},function(){return n(s)})})},e.create=function(t){return new e(t)},e}();function Gb(e){var t;return(t=e??Hc.Promise)!==null&&t!==void 0?t:Promise}i(Gb,"getPromiseCtor");a(Gb,"getPromiseCtor");function DI(e){return e&&Sr(e.next)&&Sr(e.error)&&Sr(e.complete)}i(DI,"isObserver");a(DI,"isObserver");function RI(e){return e&&e instanceof w2||DI(e)&&y2(e)}i(RI,"isSubscriber");a(RI,"isSubscriber");function OI(e){return Sr(e?.lift)}i(OI,"hasLift");a(OI,"hasLift");function Qo(e){return function(t){if(OI(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(Qo,"operate");a(Qo,"operate");function vo(e,t,r,n,o){return new SH(e,t,r,n,o)}i(vo,"createOperatorSubscriber");a(vo,"createOperatorSubscriber");var SH=function(e){Xo(t,e);function t(r,n,o,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=o?function(){try{o()}catch(p){r.error(p)}finally{this.unsubscribe()}}:e.prototype._complete,h}return i(t,"OperatorSubscriber2"),a(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}(w2),xH=Vm(function(e){return a(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),NI=function(e){Xo(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"),a(t,"Subject"),t.prototype.lift=function(r){var n=new QA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new xH},t.prototype.next=function(r){var n=this;Yf(function(){var o,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){o={error:p}}finally{try{l&&!l.done&&(s=c.return)&&s.call(c)}finally{if(o)throw o.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 o=n.observers;o.length;)o.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,o=this,s=o.hasError,c=o.isStopped,l=o.observers;return s||c?xI:(this.currentObservers=null,l.push(r),new Od(function(){n.currentObservers=null,cd(l,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,s=n.thrownError,c=n.isStopped;o?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 QA(r,n)},t}(dn),QA=function(e){Xo(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return i(t,"AnonymousSubject2"),a(t,"AnonymousSubject"),t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.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,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:xI},t}(NI),TH=function(e){Xo(t,e);function t(r){var n=e.call(this)||this;return n._value=r,n}return i(t,"BehaviorSubject2"),a(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,o=r.thrownError,s=r._value;if(n)throw o;return this._throwIfClosed(),s},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(NI),PI={now:function(){return(PI.delegate||Date).now()},delegate:void 0},CH=function(e){Xo(t,e);function t(r,n){return e.call(this)||this}return i(t,"Action2"),a(t,"Action"),t.prototype.schedule=function(r,n){return n===void 0&&(n=0),this},t}(Od),am={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var o=am.delegate;return o?.setInterval?o.setInterval.apply(o,_s([e,t],Ia(r))):setInterval.apply(void 0,_s([e,t],Ia(r)))},clearInterval:function(e){var t=am.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},MH=function(e){Xo(t,e);function t(r,n){var o=e.call(this,r,n)||this;return o.scheduler=r,o.work=n,o.pending=!1,o}return i(t,"AsyncAction2"),a(t,"AsyncAction"),t.prototype.schedule=function(r,n){var o;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=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,o){return o===void 0&&(o=0),am.setInterval(r.flush.bind(r,this),o)},t.prototype.recycleAsyncId=function(r,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&am.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(r,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var o=!1,s;try{this.work(r)}catch(c){o=!0,s=c||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),s},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,o=r.scheduler,s=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,cd(s,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(CH),eS=function(){function e(t,r){r===void 0&&(r=e.now),this.schedulerActionCtor=t,this.now=r}return i(e,"Scheduler2"),a(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=PI.now,e}(),IH=function(e){Xo(t,e);function t(r,n){n===void 0&&(n=eS.now);var o=e.call(this,r,n)||this;return o.actions=[],o._active=!1,o}return i(t,"AsyncScheduler2"),a(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var o;this._active=!0;do if(o=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,o){for(;r=n.shift();)r.unsubscribe();throw o}},t}(eS),kH=new IH(MH),DH=kH,BI=new dn(function(e){return e.complete()});function E2(e){return e&&Sr(e.schedule)}i(E2,"isScheduler");a(E2,"isScheduler");function A2(e){return e[e.length-1]}i(A2,"last");a(A2,"last");function LI(e){return E2(A2(e))?e.pop():void 0}i(LI,"popScheduler");a(LI,"popScheduler");function UI(e,t){return typeof A2(e)=="number"?e.pop():t}i(UI,"popNumber");a(UI,"popNumber");var S2=a(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function x2(e){return Sr(e?.then)}i(x2,"isPromise");a(x2,"isPromise");function T2(e){return Sr(e[_2])}i(T2,"isInteropObservable");a(T2,"isInteropObservable");function C2(e){return Symbol.asyncIterator&&Sr(e?.[Symbol.asyncIterator])}i(C2,"isAsyncIterable");a(C2,"isAsyncIterable");function M2(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(M2,"createInvalidObservableTypeError");a(M2,"createInvalidObservableTypeError");function FI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(FI,"getSymbolIterator");a(FI,"getSymbolIterator");var jI=FI();function I2(e){return Sr(e?.[jI])}i(I2,"isIterable");a(I2,"isIterable");function k2(e){return AI(this,arguments,a(i(function(){var r,n,o,s;return v2(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(),o=n.value,s=n.done,s?[4,Tc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,Tc(o)];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(k2,"readableStreamLikeToAsyncGenerator");a(k2,"readableStreamLikeToAsyncGenerator");function D2(e){return Sr(e?.getReader)}i(D2,"isReadableStreamLike");a(D2,"isReadableStreamLike");function Na(e){if(e instanceof dn)return e;if(e!=null){if(T2(e))return $I(e);if(S2(e))return zI(e);if(x2(e))return HI(e);if(C2(e))return R2(e);if(I2(e))return qI(e);if(D2(e))return VI(e)}throw M2(e)}i(Na,"innerFrom");a(Na,"innerFrom");function $I(e){return new dn(function(t){var r=e[_2]();if(Sr(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i($I,"fromInteropObservable");a($I,"fromInteropObservable");function zI(e){return new dn(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(zI,"fromArrayLike");a(zI,"fromArrayLike");function HI(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,b2)})}i(HI,"fromPromise");a(HI,"fromPromise");function qI(e){return new dn(function(t){var r,n;try{for(var o=Mc(e),s=o.next();!s.done;s=o.next()){var c=s.value;if(t.next(c),t.closed)return}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}t.complete()})}i(qI,"fromIterable");a(qI,"fromIterable");function R2(e){return new dn(function(t){KI(e,t).catch(function(r){return t.error(r)})})}i(R2,"fromAsyncIterable");a(R2,"fromAsyncIterable");function VI(e){return R2(k2(e))}i(VI,"fromReadableStreamLike");a(VI,"fromReadableStreamLike");function KI(e,t){var r,n,o,s;return EI(this,void 0,void 0,function(){var c,l;return v2(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),r=SI(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(),o={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(o)throw o.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(KI,"process2");a(KI,"process");function Ta(e,t,r,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var s=t.schedule(function(){r(),o?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(s),!o)return s}i(Ta,"executeSchedule");a(Ta,"executeSchedule");function O2(e,t){return t===void 0&&(t=0),Qo(function(r,n){r.subscribe(vo(n,function(o){return Ta(n,e,function(){return n.next(o)},t)},function(){return Ta(n,e,function(){return n.complete()},t)},function(o){return Ta(n,e,function(){return n.error(o)},t)}))})}i(O2,"observeOn");a(O2,"observeOn");function N2(e,t){return t===void 0&&(t=0),Qo(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(N2,"subscribeOn");a(N2,"subscribeOn");function GI(e,t){return Na(e).pipe(N2(t),O2(t))}i(GI,"scheduleObservable");a(GI,"scheduleObservable");function WI(e,t){return Na(e).pipe(N2(t),O2(t))}i(WI,"schedulePromise");a(WI,"schedulePromise");function JI(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(JI,"scheduleArray");a(JI,"scheduleArray");function ZI(e,t){return new dn(function(r){var n;return Ta(r,t,function(){n=e[jI](),Ta(r,t,function(){var o,s,c;try{o=n.next(),s=o.value,c=o.done}catch(l){r.error(l);return}c?r.complete():r.next(s)},0,!0)}),function(){return Sr(n?.return)&&n.return()}})}i(ZI,"scheduleIterable");a(ZI,"scheduleIterable");function P2(e,t){if(!e)throw new Error("Iterable cannot be null");return new dn(function(r){Ta(r,t,function(){var n=e[Symbol.asyncIterator]();Ta(r,t,function(){n.next().then(function(o){o.done?r.complete():r.next(o.value)})},0,!0)})})}i(P2,"scheduleAsyncIterable");a(P2,"scheduleAsyncIterable");function YI(e,t){return P2(k2(e),t)}i(YI,"scheduleReadableStreamLike");a(YI,"scheduleReadableStreamLike");function XI(e,t){if(e!=null){if(T2(e))return GI(e,t);if(S2(e))return JI(e,t);if(x2(e))return WI(e,t);if(C2(e))return P2(e,t);if(I2(e))return ZI(e,t);if(D2(e))return YI(e,t)}throw M2(e)}i(XI,"scheduled");a(XI,"scheduled");function QI(e,t){return t?XI(e,t):Na(e)}i(QI,"from3");a(QI,"from");var ek=Vm(function(e){return a(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function tk(e){return e instanceof Date&&!isNaN(e)}i(tk,"isValidDate");a(tk,"isValidDate");function B2(e,t){return Qo(function(r,n){var o=0;r.subscribe(vo(n,function(s){n.next(e.call(t,s,o++))}))})}i(B2,"map");a(B2,"map");var RH=Array.isArray;function rk(e,t){return RH(t)?e.apply(void 0,_s([],Ia(t))):e(t)}i(rk,"callOrApply");a(rk,"callOrApply");function nk(e){return B2(function(t){return rk(e,t)})}i(nk,"mapOneOrManyArgs");a(nk,"mapOneOrManyArgs");function ik(e,t,r,n,o,s,c,l){var h=[],p=0,g=0,v=!1,y=a(function(){v&&!h.length&&!p&&t.complete()},"checkComplete"),_=a(function(O){return p<n?x(O):h.push(O)},"outerNext"),x=a(function(O){s&&t.next(O),p++;var D=!1;Na(r(O,g++)).subscribe(vo(t,function(P){o?.(P),s?_(P):t.next(P)},function(){D=!0},void 0,function(){if(D)try{p--;for(var P=a(function(){var J=h.shift();c?Ta(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(vo(t,_,function(){v=!0,y()})),function(){l?.()}}i(ik,"mergeInternals");a(ik,"mergeInternals");function Wm(e,t,r){return r===void 0&&(r=1/0),Sr(t)?Wm(function(n,o){return B2(function(s,c){return t(n,s,o,c)})(Na(e(n,o)))},r):(typeof t=="number"&&(r=t),Qo(function(n,o){return ik(n,o,e,r)}))}i(Wm,"mergeMap");a(Wm,"mergeMap");function ok(e){return e===void 0&&(e=1/0),Wm(Gm,e)}i(ok,"mergeAll");a(ok,"mergeAll");var OH=["addListener","removeListener"],NH=["addEventListener","removeEventListener"],PH=["on","off"];function sm(e,t,r,n){if(Sr(r)&&(n=r,r=void 0),n)return sm(e,t,r).pipe(nk(n));var o=Ia(ck(e)?NH.map(function(l){return function(h){return e[l](t,h,r)}}):ak(e)?OH.map(Wb(e,t)):sk(e)?PH.map(Wb(e,t)):[],2),s=o[0],c=o[1];if(!s&&S2(e))return Wm(function(l){return sm(l,t,r)})(Na(e));if(!s)throw new TypeError("Invalid event target");return new dn(function(l){var h=a(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(sm,"fromEvent");a(sm,"fromEvent");function Wb(e,t){return function(r){return function(n){return e[r](t,n)}}}i(Wb,"toCommonHandlerRegistry");a(Wb,"toCommonHandlerRegistry");function ak(e){return Sr(e.addListener)&&Sr(e.removeListener)}i(ak,"isNodeStyleEventEmitter");a(ak,"isNodeStyleEventEmitter");function sk(e){return Sr(e.on)&&Sr(e.off)}i(sk,"isJQueryStyleEventEmitter");a(sk,"isJQueryStyleEventEmitter");function ck(e){return Sr(e.addEventListener)&&Sr(e.removeEventListener)}i(ck,"isEventTarget");a(ck,"isEventTarget");function L2(e,t,r){e===void 0&&(e=0),r===void 0&&(r=DH);var n=-1;return t!=null&&(E2(t)?r=t:n=t),new dn(function(o){var s=tk(e)?+e-r.now():e;s<0&&(s=0);var c=0;return r.schedule(function(){o.closed||(o.next(c++),0<=n?this.schedule(void 0,n):o.complete())},s)})}i(L2,"timer");a(L2,"timer");function uk(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=LI(e),n=UI(e,1/0),o=e;return o.length?o.length===1?Na(o[0]):ok(n)(QI(o,r)):BI}i(uk,"merge");a(uk,"merge");function lk(e,t){return Qo(function(r,n){var o=0;r.subscribe(vo(n,function(s){return e.call(t,s,o++)&&n.next(s)}))})}i(lk,"filter");a(lk,"filter");function fk(e){return Qo(function(t,r){var n=!1;t.subscribe(vo(r,function(o){n=!0,r.next(o)},function(){n||r.next(e),r.complete()}))})}i(fk,"defaultIfEmpty");a(fk,"defaultIfEmpty");function dk(e){return e<=0?function(){return BI}:Qo(function(t,r){var n=0;t.subscribe(vo(r,function(o){++n<=e&&(r.next(o),e<=n&&r.complete())}))})}i(dk,"take");a(dk,"take");function hk(e){return e===void 0&&(e=pk),Qo(function(t,r){var n=!1;t.subscribe(vo(r,function(o){n=!0,r.next(o)},function(){return n?r.complete():r.error(e())}))})}i(hk,"throwIfEmpty");a(hk,"throwIfEmpty");function pk(){return new ek}i(pk,"defaultErrorFactory");a(pk,"defaultErrorFactory");function mk(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?lk(function(o,s){return e(o,s,n)}):Gm,dk(1),r?fk(t):hk(function(){return new ek}))}}i(mk,"first");a(mk,"first");function gk(e,t){return Qo(function(r,n){var o=t??{},s=o.leading,c=s===void 0?!0:s,l=o.trailing,h=l===void 0?!1:l,p=!1,g=null,v=null,y=!1,_=a(function(){v?.unsubscribe(),v=null,h&&(D(),y&&n.complete())},"endThrottling"),x=a(function(){v=null,y&&n.complete()},"cleanupThrottling"),O=a(function(P){return v=Na(e(P)).subscribe(vo(n,_,x))},"startThrottle"),D=a(function(){if(p){p=!1;var P=g;g=null,n.next(P),!y&&O(P)}},"send");r.subscribe(vo(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(gk,"throttle");a(gk,"throttle");var tS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(tS||(tS={}));var cm;(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"})(cm||(cm={}));var Jb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Jb||(Jb={}));var Jm=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,GA.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===Jb.ANCHOR).map(({cid:e})=>Ar.make(this.id,e))}get state(){return(0,GA.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");a(Jm,"Stream");function Zm(){return e=>{}}i(Zm,"StreamStatic");a(Zm,"StreamStatic");var BH=ir(w$(),1);function vk(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):(uk(...e.map(r=>sm(r,"abort"))).pipe(mk()).subscribe(()=>{t.abort()}),t.signal)}i(vk,"mergeAbortSignals");a(vk,"mergeAbortSignals");var yk=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=L2(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");a(yk,"TimedAbortSignal");async function bk(e,t){let r=new AbortController,n=a(()=>{r.abort()},"onAbort");return e.addEventListener("abort",n),e.aborted&&r.abort(),t(r.signal).finally(()=>{e.removeEventListener("abort",n)})}i(bk,"abortable2");a(bk,"abortable");var LH=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||LH,n=new yk(r),o=t.signal?vk([t.signal,n.signal]):n.signal,s=await bk(o,c=>(0,BH.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");a(_i,"fetchJson");var w0=ir(Sd(),1);Wo();function Sa(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(Sa,"toCID");a(Sa,"toCID");var rS=0,Hr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,w0.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,w0.default)(e);return Hr.isSignedCommitContainer(t)?(t.jws.link=Sa(t.jws.link),t.linkedBlock=Cr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Cr(t.cacaoBlock,"base64")),t):(Hr.isSignedCommit(t)&&(t.link=Sa(t.link)),Hr.isAnchorCommit(t)&&(t.proof=Sa(t.proof)),t.id&&(t.id=Sa(t.id)),t.prev&&(t.prev=Sa(t.prev)),t.header?.model&&(t.header.model=Cr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,w0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=cm[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!=rS&&(t.metadata.unique=Ir(t.metadata.unique,"base64")),t.doctype=Ma.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,w0.default)(e);return t.doctype&&(t.type=Ma.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:Sa(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=Sa(t.anchorProof.txHash),t.anchorProof.root=Sa(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=cm[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!=rS&&(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");a(Hr,"StreamUtils");var wk=i(class extends TH{next(e){let t=this.value;Hr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");a(wk,"StreamStateSubject");var UH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate3"),bi,ab={anchor:!0,publish:!0,pin:!0,sync:ei.PREFER_CACHE},FH={sync:ei.PREFER_CACHE},nS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function R0(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,yH.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(R0,"headerFromMetadata");a(R0,"headerFromMetadata");async function Zb(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(Zb,"getAuthenticatedDID");a(Zb,"getAuthenticatedDID");async function O0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(O0,"throwReadOnlyError");a(O0,"throwReadOnlyError");var ka=bi=a(i(class extends Jm{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,vH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,o={}){o={...ab,...o},!n?.deterministic&&o.syncTimeoutSeconds==null&&(o.syncTimeoutSeconds=0);let s=o.asDID?{did:o.asDID}:t,c=await bi.makeGenesis(s,r,n);return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,c,o)}static async createFromGenesis(t,r,n={}){n={...ab,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let o=r.data?await bi._signDagJWS(t,r):r;return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,o,n)}static async deterministic(t,r,n={}){if(n={...ab,...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 o=await bi.makeGenesis(t,null,r);return t.createStreamFromGenesis(bi.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...FH,...n};let o=ws.from(r);if(o.type!=bi.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${bi.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async update(t,r,n={}){n={...nS,...n};let o=n.asDID?{did:n.asDID}:this.api,s=await this.makeCommit(o,t,r),c=await this.api.applyCommit(this.id,s,n);this.state$.next(c.state)}async patch(t,r={}){r={...nS,...r};let o={header:R0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},s=await bi._signDagJWS(this.api,o),c=await this.api.applyCommit(this.id,s,r);this.state$.next(c.state)}makeReadOnly(){this.update=O0,this.patch=O0,this.sync=O0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let o=await this._makeRawCommit(r,n);return bi._signDagJWS(t,o)}async _makeRawCommit(t,r){r||(r={});let n=R0(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 o=sI.compare(this.content,t),s=this.state.log[0];return{header:n,data:o,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 Zb(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 o=R0(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:o};return Bm(c),c}let s={data:r,header:o};return bi._signDagJWS(t,s)}static async _signDagJWS(t,r){return(await Zb(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");ka.STREAM_TYPE_NAME="tile";ka.STREAM_TYPE_ID=0;ka=bi=UH([Zm()],ka);var jH=ir(_$(),1);function _k(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(_k,"_checkPrivateRedeclaration2");a(_k,"_checkPrivateRedeclaration");function Ek(e,t){return t.get?t.get.call(e):t.value}i(Ek,"_classApplyDescriptorGet2");a(Ek,"_classApplyDescriptorGet");function Ak(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(Ak,"_classApplyDescriptorSet2");a(Ak,"_classApplyDescriptorSet");function U2(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(U2,"_classExtractFieldDescriptor2");a(U2,"_classExtractFieldDescriptor");function N0(e,t){var r=U2(e,t,"get");return Ek(e,r)}i(N0,"_classPrivateFieldGet2");a(N0,"_classPrivateFieldGet");function Yb(e,t,r){_k(e,t),t.set(e,r)}i(Yb,"_classPrivateFieldInit2");a(Yb,"_classPrivateFieldInit");function Xb(e,t,r){var n=U2(e,t,"set");return Ak(e,n,r),r}i(Xb,"_classPrivateFieldSet2");a(Xb,"_classPrivateFieldSet");function Sk(e){return typeof e=="string"||Ar.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(Sk,"keyToQuery");a(Sk,"keyToQuery");function P0(e){return typeof e=="string"?ws.from(e).toString():Ar.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(P0,"keyToString");a(P0,"keyToString");async function xk(e){let t=await ka.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(xk,"getDeterministicQuery");a(xk,"getDeterministicQuery");var $H=a(()=>Promise.resolve([]),"tempBatchLoadFn"),_0=new WeakMap,sb=new WeakMap,zH=i(class extends jH.default{cache(e){if(!N0(this,sb))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await ka.create(N0(this,_0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await xk(e);try{return await super.load(r)}catch{let o=await ka.createFromGenesis(N0(this,_0),r.genesis,t);return this.cache(o),o}}async load(e){return await super.load(e)}async update(e,t,r,n){let o=P0(e);this.clear(o);let s=await this.load({streamId:o});return await s.update(t,r,n),s}constructor(e){super($H,{cache:!0,cacheKeyFn:P0,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),Yb(this,_0,{writable:!0,value:void 0}),Yb(this,sb,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(Sk),e.multiqueryTimeout);return t.map(n=>{let o=P0(n),s=r[o];return s||new Error(`Failed to load stream: ${o}`)})},Xb(this,_0,e.ceramic),Xb(this,sb,!!e.cache)}},"TileLoader");a(zH,"TileLoader");function Qb(e){return typeof e=="string"?Xt.fromString(e):e}i(Qb,"typeStreamID");a(Qb,"typeStreamID");function Tk(e,t){let r=new URL(e);for(let[n,o]of Object.entries(t))Xt.isInstance(o)?r.searchParams.set(n,o.toString()):typeof o=="object"?r.searchParams.set(n,JSON.stringify(o)):r.searchParams.set(n,o);return r}i(Tk,"serializeObjectToSearchParams");a(Tk,"serializeObjectToSearchParams");function e6(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(e6,"serializeObjectForHttpPost");a(e6,"serializeObjectForHttpPost");var Vi=i(class extends dn{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=L2(0,r).pipe(gk(()=>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 wk(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,o){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,o)}static async applyCommit(e,t,r,n,o){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,o)}static async _load(e,t,r){let n=Tk(new URL(`./streams/${e}`,t),r),{state:o}=await _i(n);return o}static async load(e,t,r,n){let o=await Vi._load(e,t,n);return new Vi(Hr.deserializeState(o),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await _i(r);return n.map(o=>({cid:o.cid,value:Hr.deserializeCommit(o.value)}))}complete(){this.state$.complete()}},"Document");a(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 iS=ir(Sd(),1),oS;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(oS||(oS={}));var t6;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(t6||(t6={}));var Ck=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,iS.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===t6.ANCHOR).map(({cid:e})=>Ar.make(this.id,e))}get state(){return(0,iS.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");a(Ck,"Stream");function Mk(){return e=>{}}i(Mk,"StreamStatic2");a(Mk,"StreamStatic");function Ik(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(Ik,"normalizeAccountId");a(Ik,"normalizeAccountId");var HH="(?:%[0-9a-fA-F]{2})",aS=`(?:[a-zA-Z0-9._-]|${HH})`,qH="([a-z0-9]+)",VH=`((?:${aS}*:)*(${aS}+))`,sS="[a-zA-Z0-9_.:%-]",KH=`;${sS}+=${sS}*`,GH=`((${KH})*)`,WH="(/[^#?]*)?",JH="([?][^#]*)?",ZH="(#.*)?",YH=new RegExp(`^did:${qH}:${VH}${GH}${WH}${JH}${ZH}$`);function kk(e){if(e===""||!e)return null;let t=e.match(YH);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 o of n){let s=o.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(kk,"parse2");a(kk,"parse");var XH=ir(Sd(),1),QH=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate4"),yc,cb=a(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),cS={anchor:!1,publish:!0,sync:ud.PREFER_CACHE},ub={anchor:!0,publish:!0},eq={sync:ud.PREFER_CACHE},Gu=yc=a(i(class extends Ck{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,XH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...cS,...n};let o=Ik(r),s=yc.makeGenesis(o);return yc.fromGenesis(t,s,n)}static async fromGenesis(t,r,n={}){return n={...cS,...n},t.createStreamFromGenesis(yc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...ub,...n};let o=typeof t=="string"?t.trim():t.id;if(kk(o)?.did!==o)throw new Error(`DID is not valid: '${o}'`);let c=await r.createLink(o);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...ub,...r};let n=this.makeCommit(t),o=await this.api.applyCommit(this.id,n,r);this.state$.next(o.state)}async clearDid(t,r={}){r={...ub,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...eq,...n};let o=ws.from(r);if(o.type!=yc.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${yc.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,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=cb,this.setDid=cb,this.sync=cb,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");Gu.STREAM_TYPE_NAME="caip10-link";Gu.STREAM_TYPE_ID=1;Gu=yc=QH([Mk()],Gu);Wo();ol();var tq=ir(R$(),1),rq=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate5"),zo,nq={sync:ei.PREFER_CACHE};async function r6(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(r6,"_ensureAuthenticated");a(r6,"_ensureAuthenticated");async function Dk(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(Dk,"throwReadOnlyError3");a(Dk,"throwReadOnlyError");var Ic=zo=a(i(class extends Jm{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:zo.MODEL}}static async create(t,r,n){zo.assertComplete(r);let o={publish:!0,anchor:!0,pin:!0,sync:ei.NEVER_SYNC,throwOnInvalidCommit:!0},s=await zo._makeGenesis(t,r,n);return await t.createStreamFromGenesis(zo.STREAM_TYPE_ID,s,o)}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={...nq,...n};let o=ws.from(r);if(o.type!=zo.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${zo.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return await t.loadStream(o,n)}static async _makeGenesis(t,r,n){let o=await this._makeRawGenesis(t,r,n);return zo._signDagJWS(t,o)}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 r6(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let o={controllers:[n.controller],model:zo.MODEL.bytes};return{data:r,header:o}}makeReadOnly(){this.sync=Dk,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await r6(t),t.did.createDagJWS(r)}},"Model2"),"Model");Ic.STREAM_TYPE_NAME="model";Ic.STREAM_TYPE_ID=2;Ic.MODEL=function(){let e=Bm("model-v1"),t=tq.default.encode(e,"identity"),r=Hu(K0,t),n=$t.createV1(K0,r);return new Xt("UNLOADABLE",n)}();Ic=zo=rq([Zm()],Ic);var iq=ir(cl(),1),oq=i(function(e,t,r,n){var o=arguments.length,s=o<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=(o<3?c(s):o>3?c(t,r,s):c(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s},"__decorate6"),so,aq={anchor:!0,publish:!0,pin:!0,sync:ei.NEVER_SYNC,syncTimeoutSeconds:0},sq={anchor:!1,publish:!1,pin:!0,sync:ei.PREFER_CACHE},cq={sync:ei.PREFER_CACHE},uS={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function n6(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(n6,"_ensureAuthenticated2");a(n6,"_ensureAuthenticated");async function B0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(B0,"throwReadOnlyError4");a(B0,"throwReadOnlyError");var Wu=so=a(i(class extends Jm{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,o={}){o={...aq,...o};let s=o.asDID?{did:o.asDID}:t,c=await so._makeGenesis(s,r,n);return t.createStreamFromGenesis(so.STREAM_TYPE_ID,c,o)}static async single(t,r,n={}){n={...sq,...n};let o=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let s=await so._makeGenesis(o,null,r);return t.createStreamFromGenesis(so.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...cq,...n};let o=ws.from(r);if(o.type!=so.STREAM_TYPE_ID)throw new Error(`StreamID ${o.toString()} does not refer to a '${so.STREAM_TYPE_NAME}' stream, but to a ${o.typeName}`);return t.loadStream(o,n)}async replace(t,r={}){r={...uS,...r};let n=r.asDID?{did:r.asDID}:this.api,o=await this._makeCommit(n,t),s=await this.api.applyCommit(this.id,o,r);this.state$.next(s.state)}async patch(t,r={}){r={...uS,...r};let n={data:t,prev:this.tip,id:this.id.cid},o=await so._signDagJWS(this.api,n),s=await this.api.applyCommit(this.id,o,r);this.state$.next(s.state)}makeReadOnly(){this.replace=B0,this.patch=B0,this.sync=B0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return so._signDagJWS(t,n)}_makeRawCommit(t){return{data:sI.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let o=await this._makeRawGenesis(t,r,n);return n.deterministic?(Bm(o),o):so._signDagJWS(t,o)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let o=n.controller;if(!o)if(t.did)await n6(t),o=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let s={controllers:[o],model:n.model.bytes};return n.deterministic||(s.unique=(0,iq.randomBytes)(12)),{data:r,header:s}}static async _signDagJWS(t,r){return await n6(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");Wu.STREAM_TYPE_NAME="MID";Wu.STREAM_TYPE_ID=3;Wu=so=oq([Zm()],Wu);var Rk=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 o=0;return{next(){return o===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[o++],done:!1})}}}}}},"RemotePinApi");a(Rk,"RemotePinApi");var Ok=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:e6(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:e6(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:Hr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");a(Ok,"RemoteIndexApi");var Nk=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,o=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${o.signatures[0].protected}.${o.payload}.${o.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");a(Nk,"RemoteAdminApi");var uq="/api/v0/",lq="http://localhost:7007",fq={syncInterval:5e3},dq={anchor:!0,publish:!0,sync:ei.PREFER_CACHE},hq={anchor:!0,publish:!0,sync:ei.PREFER_CACHE},lS={sync:ei.PREFER_CACHE},pq=i(class{constructor(e=lq,t={}){this._config={...fq,...t},this._apiUrl=new URL(uq,e),this._streamCache=new Map,this.context={api:this},this.pin=new Rk(this._apiUrl),this.index=new Ok(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new Nk(this._apiUrl,r),this._streamConstructors={[Gu.STREAM_TYPE_ID]:Gu,[Ic.STREAM_TYPE_ID]:Ic,[Wu.STREAM_TYPE_ID]:Wu,[ka.STREAM_TYPE_ID]:ka}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...hq,...r};let n=await Vi.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),o=this._streamCache.get(n.id.toString());return o?(Hr.statesEqual(n.state,o.state)||o.next(n.state),this.buildStreamFromDocument(o)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...lS,...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),o=await _i(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(o).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=Qb(e);return Vi.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={...dq,...r};let n=Qb(e),o=await Vi.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),s=this._streamCache.get(n.toString());return s?(s.next(o.state),this.buildStreamFromDocument(o)):(this._streamCache.set(n.toString(),o),this.buildStreamFromDocument(o))}async requestAnchor(e,t={}){t={...lS,...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");a(pq,"CeramicClient");var nr;(function(e){e.assertEqual=o=>o;function t(o){}i(t,"assertIs"),a(t,"assertIs"),e.assertIs=t;function r(o){throw new Error}i(r,"assertNever"),a(r,"assertNever"),e.assertNever=r,e.arrayToEnum=o=>{let s={};for(let c of o)s[c]=c;return s},e.getValidEnumValues=o=>{let s=e.objectKeys(o).filter(l=>typeof o[o[l]]!="number"),c={};for(let l of s)c[l]=o[l];return e.objectValues(c)},e.objectValues=o=>e.objectKeys(o).map(function(s){return o[s]}),e.objectKeys=typeof Object.keys=="function"?o=>Object.keys(o):o=>{let s=[];for(let c in o)Object.prototype.hasOwnProperty.call(o,c)&&s.push(c);return s},e.find=(o,s)=>{for(let c of o)if(s(c))return c},e.isInteger=typeof Number.isInteger=="function"?o=>Number.isInteger(o):o=>typeof o=="number"&&isFinite(o)&&Math.floor(o)===o;function n(o,s=" | "){return o.map(c=>typeof c=="string"?`'${c}'`:c).join(s)}i(n,"joinValues"),a(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(o,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=a(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"]),mq=a(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ho=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(o){return o.message},r={_errors:[]},n=a(o=>{for(let s of o.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");a(Ho,"ZodError");Ho.create=e=>new Ho(e);var ld=a((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"),Pk=ld;function Bk(e){Pk=e}i(Bk,"setErrorMap");a(Bk,"setErrorMap");function fd(){return Pk}i(fd,"getErrorMap");a(fd,"getErrorMap");var um=a(e=>{let{data:t,path:r,errorMaps:n,issueData:o}=e,s=[...r,...o.path||[]],c={...o,path:s},l="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)l=p(c,{data:t,defaultError:l}).message;return{...o,path:s,message:o.message||l}},"makeIssue"),gq=[];function gt(e,t){let r=um({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");a(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:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return Rt;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),(typeof s.value<"u"||n.alwaysSet)&&(r[o.value]=s.value)}return{status:e.value,value:r}}},"ParseStatus");a(Bn,"ParseStatus");var Rt=Object.freeze({status:"aborted"}),Lk=a(e=>({status:"dirty",value:e}),"DIRTY"),xn=a(e=>({status:"valid",value:e}),"OK"),i6=a(e=>e.status==="aborted","isAborted"),o6=a(e=>e.status==="dirty","isDirty"),lm=a(e=>e.status==="valid","isValid"),fm=a(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 yo=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");a(yo,"ParseInputLazyPath");var fS=a((e,t)=>{if(lm(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Ho(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:o}=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:o}:{errorMap:a((c,l)=>c.code!=="invalid_type"?{message:l.defaultError}:typeof l.data>"u"?{message:n??l.defaultError}:{message:r??l.defaultError},"customMap"),description:o}}i(zt,"processCreateParams");a(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(fm(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)},o=this._parseSync({data:e,path:n.path,parent:n});return fS(n,o)}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}),o=await(fm(n)?n:Promise.resolve(n));return fS(r,o)}refine(e,t){let r=a(n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t,"getIssueProperties");return this._refinement((n,o)=>{let s=e(n),c=a(()=>o.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 go.create(this)}nullable(){return As.create(this)}nullish(){return this.optional().nullable()}array(){return mo.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 j2({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");a(jt,"ZodType");var vq=/^c[^\s-]{8,}$/i,yq=/^([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,bq=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,wq=a(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"),Da=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 Da({...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 o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.string,received:o.parsedType}),Rt}let r=new Bn,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,c=e.data.length<o.value;(s||c)&&(n=this._getOrReturnCtx(e,n),s?gt(n,{code:Ge.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):c&>(n,{code:Ge.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if(o.kind==="email")bq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"email",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="uuid")yq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"uuid",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="cuid")vq.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"cuid",code:Ge.invalid_string,message:o.message}),r.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),gt(n,{validation:"url",code:Ge.invalid_string,message:o.message}),r.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{validation:"regex",code:Ge.invalid_string,message:o.message}),r.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty()):o.kind==="datetime"?wq(o).test(e.data)||(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.invalid_string,validation:"datetime",message:o.message}),r.dirty()):nr.assertNever(o);return{status:r.value,value:e.data}}_addCheck(e){return new Da({...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");a(Da,"ZodString");Da.create=e=>{var t;return new Da({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function Uk(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,o=r>n?r:n,s=parseInt(e.toFixed(o).replace(".","")),c=parseInt(t.toFixed(o).replace(".",""));return s%c/Math.pow(10,o)}i(Uk,"floatSafeRemainder");a(Uk,"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 o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.number,received:o.parsedType}),Rt}let r,n=new Bn;for(let o of this._def.checks)o.kind==="int"?nr.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?Uk(e.data,o.value)!==0&&(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),gt(r,{code:Ge.not_finite,message:o.message}),n.dirty()):nr.assertNever(o);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");a(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");a(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");a(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 o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_type,expected:rt.date,received:o.parsedType}),Rt}if(isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return gt(o,{code:Ge.invalid_date}),Rt}let r=new Bn,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),r.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),gt(n,{code:Ge.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),r.dirty()):nr.assertNever(o);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");a(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");a(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");a(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");a(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");a(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");a(ms,"ZodUnknown");ms.create=e=>new ms({typeName:Tt.ZodUnknown,...zt(e)});var qo=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");a(qo,"ZodNever");qo.create=e=>new qo({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");a(hd,"ZodVoid");hd.create=e=>new hd({typeName:Tt.ZodVoid,...zt(e)});var mo=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 yo(t,s,t.path,c)))).then(s=>Bn.mergeArray(r,s));let o=t.data.map((s,c)=>n.type._parseSync(new yo(t,s,t.path,c)));return Bn.mergeArray(r,o)}get element(){return this._def.type}min(e,t){return new mo({...this._def,minLength:{value:e,message:Jt.toString(t)}})}max(e,t){return new mo({...this._def,maxLength:{value:e,message:Jt.toString(t)}})}length(e,t){return new mo({...this._def,exactLength:{value:e,message:Jt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");a(mo,"ZodArray");mo.create=(e,t)=>new mo({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tt.ZodArray,...zt(t)});var dm;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(dm||(dm={}));var dS=a(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]=go.create(wc(n))}return new Dr({...e._def,shape:()=>t})}else return e instanceof mo?mo.create(wc(e.element)):e instanceof go?go.create(wc(e.unwrap())):e instanceof As?As.create(wc(e.unwrap())):e instanceof Vo?Vo.create(e.items.map(t=>wc(t))):e}i(wc,"deepPartialify");a(wc,"deepPartialify");var Dr=i(class extends jt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=dS(this._def),this.extend=dS(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:o,keys:s}=this._getCached(),c=[];if(!(this._def.catchall instanceof qo&&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=o[h],g=n.data[h];l.push({key:{status:"valid",value:h},value:p._parse(new yo(n,g,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof qo){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 yo(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,o,s,c;let l=(s=(o=(n=this._def).errorMap)===null||o===void 0?void 0:o.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:()=>dm.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 o=this.shape[r];for(;o instanceof go;)o=o._def.innerType;t[r]=o}});else for(let r in this.shape){let o=this.shape[r];for(;o instanceof go;)o=o._def.innerType;t[r]=o}return new Dr({...this._def,shape:()=>t})}keyof(){return F2(nr.objectKeys(this.shape))}},"ZodObject");a(Dr,"ZodObject");Dr.create=(e,t)=>new Dr({shape:()=>e,unknownKeys:"strip",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});Dr.strictCreate=(e,t)=>new Dr({shape:()=>e,unknownKeys:"strict",catchall:qo.create(),typeName:Tt.ZodObject,...zt(t)});Dr.lazycreate=(e,t)=>new Dr({shape:e,unknownKeys:"strip",catchall:qo.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(o){for(let c of o)if(c.result.status==="valid")return c.result;for(let c of o)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let s=o.map(c=>new Ho(c.ctx.common.issues));return gt(t,{code:Ge.invalid_union,unionErrors:s}),Rt}if(i(n,"handleResults"),a(n,"handleResults"),t.common.async)return Promise.all(r.map(async o=>{let s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(n);{let o,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"&&!o&&(o={result:p,ctx:h}),h.common.issues.length&&s.push(h.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;let c=s.map(l=>new Ho(l));return gt(t,{code:Ge.invalid_union,unionErrors:c}),Rt}}get options(){return this._def.options}},"ZodUnion");a(Qu,"ZodUnion");Qu.create=(e,t)=>new Qu({options:e,typeName:Tt.ZodUnion,...zt(t)});var L0=a(e=>e instanceof tl?L0(e.schema):e instanceof Gi?L0(e.innerType()):e instanceof rl?[e.value]:e instanceof wl?e.options:e instanceof nl?Object.keys(e.enum):e instanceof il?L0(e._def.innerType):e instanceof Yu?[void 0]:e instanceof Xu?[null]:null,"getDiscriminator"),Ym=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],o=this.optionsMap.get(n);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._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 o of t){let s=L0(o.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,o)}}return new Ym({typeName:Tt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...zt(r)})}},"ZodDiscriminatedUnion");a(Ym,"ZodDiscriminatedUnion");function hm(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 o=nr.objectKeys(t),s=nr.objectKeys(e).filter(l=>o.indexOf(l)!==-1),c={...e,...t};for(let l of s){let h=hm(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 o=[];for(let s=0;s<e.length;s++){let c=e[s],l=t[s],h=hm(c,l);if(!h.valid)return{valid:!1};o.push(h.data)}return{valid:!0,data:o}}else return r===rt.date&&n===rt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(hm,"mergeValues");a(hm,"mergeValues");var el=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=a((o,s)=>{if(i6(o)||i6(s))return Rt;let c=hm(o.value,s.value);return c.valid?((o6(o)||o6(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(([o,s])=>n(o,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");a(el,"ZodIntersection");el.create=(e,t,r)=>new el({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var Vo=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 o=r.data.map((s,c)=>{let l=this._def.items[c]||this._def.rest;return l?l._parse(new yo(r,s,r.path,c)):null}).filter(s=>!!s);return r.common.async?Promise.all(o).then(s=>Bn.mergeArray(t,s)):Bn.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new Vo({...this._def,rest:e})}},"ZodTuple");a(Vo,"ZodTuple");Vo.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Vo({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=[],o=this._def.keyType,s=this._def.valueType;for(let c in r.data)n.push({key:o._parse(new yo(r,c,r.path,c)),value:s._parse(new yo(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:Da.create(),valueType:e,typeName:Tt.ZodRecord,...zt(t)})}},"ZodRecord");a(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,o=this._def.valueType,s=[...r.data.entries()].map(([c,l],h)=>({key:n._parse(new yo(r,c,r.path,[h,"key"])),value:o._parse(new yo(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");a(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 o=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"),a(s,"finalizeSet");let c=[...r.data.values()].map((l,h)=>o._parse(new yo(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");a(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 um({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"),a(r,"makeArgsIssue");function n(c,l){return um({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"),a(n,"makeReturnsIssue");let o={errorMap:t.common.contextualErrorMap},s=t.data;return this._def.returns instanceof Oc?xn(async(...c)=>{let l=new Ho([]),h=await this._def.args.parseAsync(c,o).catch(v=>{throw l.addIssue(r(c,v)),l}),p=await s(...h);return await this._def.returns._def.type.parseAsync(p,o).catch(v=>{throw l.addIssue(n(p,v)),l})}):xn((...c)=>{let l=this._def.args.safeParse(c,o);if(!l.success)throw new Ho([r(c,l.error)]);let h=s(...l.data),p=this._def.returns.safeParse(h,o);if(!p.success)throw new Ho([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:Vo.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||Vo.create([]).rest(ms.create()),returns:t||ms.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");a(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");a(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");a(rl,"ZodLiteral");rl.create=(e,t)=>new rl({value:e,typeName:Tt.ZodLiteral,...zt(t)});function F2(e,t){return new wl({values:e,typeName:Tt.ZodEnum,...zt(t)})}i(F2,"createZodEnum");a(F2,"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");a(wl,"ZodEnum");wl.create=F2;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");a(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");a(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 o={addIssue:s=>{gt(r,s),s.fatal?t.abort():t.dirty()},get path(){return r.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="refinement"){let s=a(c=>{let l=n.refinement(c,o);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(!lm(s))return s;let c=n.transform(s.value,o);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=>lm(s)?Promise.resolve(n.transform(s.value,o)).then(c=>({status:t.value,value:c})):s);nr.assertNever(n)}},"ZodEffects");a(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 go=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");a(go,"ZodOptional");go.create=(e,t)=>new go({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");a(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");a(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 fm(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");a(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");a(vd,"ZodNaN");vd.create=e=>new vd({typeName:Tt.ZodNaN,...zt(e)});var _q=Symbol("zod_brand"),j2=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");a(j2,"ZodBranded");var Nd=i(class extends jt{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return a(async()=>{let o=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?Rt:o.status==="dirty"?(t.dirty(),Lk(o.value)):this._def.out._parseAsync({data:o.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");a(Nd,"ZodPipeline");var Fk=a((e,t={},r)=>e?Dc.create().superRefine((n,o)=>{if(!e(n)){let s=typeof t=="function"?t(n):t,c=typeof s=="string"?{message:s}:s;o.addIssue({code:"custom",...c,fatal:r})}}):Dc.create(),"custom"),Eq={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 Aq=a((e,t={message:`Input not instance of ${e.name}`})=>Fk(r=>r instanceof e,t,!0),"instanceOfType"),jk=Da.create,$k=Es.create,Sq=vd.create,xq=Ju.create,zk=Zu.create,Tq=kc.create,Cq=dd.create,Mq=Yu.create,Iq=Xu.create,kq=Dc.create,Dq=ms.create,Rq=qo.create,Oq=hd.create,Nq=mo.create,Pq=Dr.create,Bq=Dr.strictCreate,Lq=Qu.create,Uq=Ym.create,Fq=el.create,jq=Vo.create,$q=pd.create,zq=md.create,Hq=Rc.create,qq=ju.create,Vq=tl.create,Kq=rl.create,Gq=wl.create,Wq=nl.create,Jq=Oc.create,hS=Gi.create,Zq=go.create,Yq=As.create,Xq=Gi.createWithPreprocess,Qq=Nd.create,eV=a(()=>jk().optional(),"ostring"),tV=a(()=>$k().optional(),"onumber"),rV=a(()=>zk().optional(),"oboolean"),nV={string:e=>Da.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})},iV=Rt,V=Object.freeze({__proto__:null,defaultErrorMap:ld,setErrorMap:Bk,getErrorMap:fd,makeIssue:um,EMPTY_PATH:gq,addIssueToContext:gt,ParseStatus:Bn,INVALID:Rt,DIRTY:Lk,OK:xn,isAborted:i6,isDirty:o6,isValid:lm,isAsync:fm,get util(){return nr},ZodParsedType:rt,getParsedType:hs,ZodType:jt,ZodString:Da,ZodNumber:Es,ZodBigInt:Ju,ZodBoolean:Zu,ZodDate:kc,ZodSymbol:dd,ZodUndefined:Yu,ZodNull:Xu,ZodAny:Dc,ZodUnknown:ms,ZodNever:qo,ZodVoid:hd,ZodArray:mo,get objectUtil(){return dm},ZodObject:Dr,ZodUnion:Qu,ZodDiscriminatedUnion:Ym,ZodIntersection:el,ZodTuple:Vo,ZodRecord:pd,ZodMap:md,ZodSet:Rc,ZodFunction:ju,ZodLazy:tl,ZodLiteral:rl,ZodEnum:wl,ZodNativeEnum:nl,ZodPromise:Oc,ZodEffects:Gi,ZodTransformer:Gi,ZodOptional:go,ZodNullable:As,ZodDefault:il,ZodCatch:gd,ZodNaN:vd,BRAND:_q,ZodBranded:j2,ZodPipeline:Nd,custom:Fk,Schema:jt,ZodSchema:jt,late:Eq,get ZodFirstPartyTypeKind(){return Tt},coerce:nV,any:kq,array:Nq,bigint:xq,boolean:zk,date:Tq,discriminatedUnion:Uq,effect:hS,enum:Gq,function:qq,instanceof:Aq,intersection:Fq,lazy:Vq,literal:Kq,map:zq,nan:Sq,nativeEnum:Wq,never:Rq,null:Iq,nullable:Yq,number:$k,object:Pq,oboolean:rV,onumber:tV,optional:Zq,ostring:eV,pipeline:Qq,preprocess:Xq,promise:Jq,record:$q,set:Hq,strictObject:Bq,string:jk,symbol:Cq,transformer:hS,tuple:jq,undefined:Mq,union:Lq,unknown:Dq,void:Oq,NEVER:iV,ZodIssueCode:Ge,quotelessJson:mq,ZodError:Ho}),oV=Object.defineProperty,aV=a((e,t)=>oV(e,"name",{value:t,configurable:!0}),"__name"),Xm=V.array(V.string().or(V.record(V.any()))),HY=V.object({type:V.string().optional(),narrative:V.string().optional()}),Qm=V.string().or(V.object({id:V.string(),type:V.string(),caption:V.string().optional()})),sV=V.object({type:V.string().min(1).or(V.string().array().nonempty()),latitude:V.number(),longitude:V.number()}),cV=V.object({type:V.string().min(1).or(V.string().array().nonempty()),addressCountry:V.string().optional(),addressCountryCode:V.string().optional(),addressRegion:V.string().optional(),addressLocality:V.string().optional(),streetAddress:V.string().optional(),postOfficeBoxNumber:V.string().optional(),postalCode:V.string().optional(),geo:sV.optional()}),uV=V.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(V.string()),Hk=V.object({type:V.string().min(1).or(V.string().array().nonempty()),identifier:V.string(),identifierType:uV}),yd=V.string().or(V.object({id:V.string().optional(),type:V.string().or(V.string().array().nonempty().optional()),name:V.string().optional(),url:V.string().optional(),phone:V.string().optional(),description:V.string().optional(),endorsement:V.any().array().optional(),image:Qm.optional(),email:V.string().email().optional(),address:cV.optional(),otherIdentifier:Hk.array().optional(),official:V.string().optional(),parentOrg:V.any().optional(),familyName:V.string().optional(),givenName:V.string().optional(),additionalName:V.string().optional(),patronymicName:V.string().optional(),honorificPrefix:V.string().optional(),honorificSuffix:V.string().optional(),familyNamePrefix:V.string().optional(),dateOfBirth:V.string().optional()}).catchall(V.any())),a6=V.object({id:V.string().optional()}).catchall(V.any()),lV=V.object({type:V.string(),id:V.string()}).catchall(V.any()),fV=V.object({id:V.string(),type:V.string()}).catchall(V.any()),dV=V.object({id:V.string(),type:V.string()}).catchall(V.any()),pm=V.object({"@context":Xm,id:V.string().optional(),type:V.string().array().nonempty(),issuer:yd,issuanceDate:V.string(),expirationDate:V.string().optional(),credentialSubject:a6.or(a6.array()),credentialStatus:lV.optional(),credentialSchema:fV.array().optional(),refreshService:dV.optional()}).catchall(V.any()),Ko=V.object({type:V.string(),created:V.string(),challenge:V.string().optional(),domain:V.string().optional(),nonce:V.string().optional(),proofPurpose:V.string(),verificationMethod:V.string(),jws:V.string().optional()}).catchall(V.any()),pS=pm.extend({proof:Ko.or(Ko.array())}),hV=V.object({"@context":Xm,id:V.string().optional(),type:V.string().or(V.string().array().nonempty()),verifiableCredential:pS.or(pS.array()).optional(),holder:V.string().optional()}).catchall(V.any()),qY=hV.extend({proof:Ko.or(Ko.array())}),$2=V.object({kty:V.string(),crv:V.string(),x:V.string(),y:V.string().optional(),n:V.string().optional(),d:V.string().optional()}),VY=$2.omit({d:!0}).extend({d:V.string()}),pV=V.object({alg:V.string(),iv:V.string(),tag:V.string(),epk:$2.partial().optional(),kid:V.string().optional(),apv:V.string().optional(),apu:V.string().optional()}),mV=V.object({header:pV,encrypted_key:V.string()}),gV=V.object({protected:V.string(),iv:V.string(),ciphertext:V.string(),tag:V.string(),aad:V.string().optional(),recipients:mV.array().optional()}),vc=V.string().or(V.object({"@context":Xm.optional(),id:V.string(),type:V.string(),controller:V.string(),publicKeyJwk:$2.optional(),publicKeyBase58:V.string().optional(),blockChainAccountId:V.string().optional()}).catchall(V.any())),vV=V.object({id:V.string(),type:V.string().or(V.string().array().nonempty()),serviceEndpoint:V.any().or(V.any().array().nonempty())}).catchall(V.any()),KY=V.object({"@context":Xm,id:V.string(),alsoKnownAs:V.string().optional(),controller:V.string().or(V.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:vV.array().optional(),proof:Ko.or(Ko.array()).optional()}).catchall(V.any()),yV=V.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(V.string()),e1=V.object({type:V.string().array().nonempty(),targetCode:V.string().optional(),targetDescription:V.string().optional(),targetName:V.string(),targetFramework:V.string().optional(),targetType:yV.optional(),targetUrl:V.string()}),bV=V.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"]),wV=bV.or(V.string()),_V=V.object({id:V.string().optional(),narrative:V.string().optional()}).catchall(V.any()),EV=V.object({id:V.string(),type:V.string().array().nonempty(),endorsementComment:V.string().optional()}),AV=pm.extend({credentialSubject:EV,proof:Ko.or(Ko.array()).optional()}),SV=V.object({id:V.string(),"@language":V.string().optional(),version:V.string().optional()}),xV=V.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(V.string()),TV=V.object({id:V.string(),type:V.string().array().nonempty(),alignment:e1.array().optional(),description:V.string().optional(),level:V.string().optional(),name:V.string(),points:V.string().optional()}).catchall(V.any()),CV=V.object({id:V.string(),type:V.string().array().nonempty(),alignment:e1.array().optional(),allowedValue:V.string().array().optional(),name:V.string(),requiredLevel:V.string().optional(),requiredValue:V.string().optional(),resultType:xV,rubricCriterionLevel:TV.array().optional(),valueMax:V.string().optional(),valueMin:V.string().optional()}).catchall(V.any()),MV=V.object({id:V.string().optional(),type:V.string().array().nonempty(),alignment:e1.array().optional(),achievementType:wV.optional(),creator:yd.optional(),creditsAvailable:V.number().optional(),criteria:_V,description:V.string(),endorsement:AV.array().optional(),fieldOfStudy:V.string().optional(),humanCode:V.string().optional(),image:Qm.optional(),"@language":V.string().optional(),name:V.string(),otherIdentifier:Hk.array().optional(),related:SV.array().optional(),resultDescription:CV.array().optional(),specialization:V.string().optional(),tag:V.string().array().optional(),version:V.string().optional()}).catchall(V.any()),IV=V.object({type:V.string(),hashed:V.boolean(),identityHash:V.string(),identityType:V.string(),salt:V.string().optional()}),kV=V.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),DV=V.object({type:V.string().array().nonempty(),achievedLevel:V.string().optional(),alignment:e1.array().optional(),resultDescription:V.string().optional(),status:kV.optional(),value:V.string().optional()}).catchall(V.any()),mS=V.object({id:V.string().optional(),type:V.string().array().nonempty(),activityEndDate:V.string().optional(),activityStartDate:V.string().optional(),creditsEarned:V.number().optional(),achievement:MV.optional(),identifier:IV.array().optional(),image:Qm.optional(),licenseNumber:V.string().optional(),narrative:V.string().optional(),result:DV.array().optional(),role:V.string().optional(),source:yd.optional(),term:V.string().optional()}).catchall(V.any()),RV=V.object({id:V.string().optional(),type:V.string().array().nonempty(),narrative:V.string().optional(),name:V.string().optional(),description:V.string().optional(),genre:V.string().optional(),audience:V.string().optional()}).catchall(V.any()),OV=pm.extend({name:V.string().optional(),description:V.string().optional(),image:Qm.optional(),credentialSubject:mS.or(mS.array()),endorsement:pm.array().optional(),evidence:RV.array().optional()}),GY=OV.extend({proof:Ko.or(Ko.array())}),WY=V.object({checks:V.string().array(),warnings:V.string().array(),errors:V.string().array()}),qk=V.enum(["Success","Failed","Error"]),JY=qk.enum,ZY=V.object({check:V.string(),status:qk,message:V.string().optional(),details:V.string().optional()}),YY=V.object({title:V.string().optional(),createdAt:V.string().optional(),issuer:yd.optional(),issuee:yd.optional(),credentialSubject:a6.optional()}),XY=V.object({id:V.string(),uri:V.string()}).catchall(V.any()),QY=V.object({limit:V.number(),cursor:V.string().optional(),sort:V.string().optional()}),ti=V.object({cursor:V.string().optional(),hasMore:V.boolean()}),Vk=V.object({encryptedRecord:gV,fields:V.string().array()}).catchall(V.any()),eX=ti.extend({records:Vk.array()}),NV=Vk.extend({id:V.string()}),tX=ti.extend({records:NV.array()}),gS=aV(e=>{let t=e.match(/^\/(.*)\/([gimsuy]*)$/);if(!t)throw new Error("Invalid RegExp string format");return{pattern:t[1],flags:t[2]}},"parseRegexString"),PV=V.instanceof(RegExp).or(V.string().refine(e=>{try{return gS(e),!0}catch{return!1}},{message:"Invalid RegExp string format. Must be in format '/pattern/flags'"}).transform(e=>{let{pattern:t,flags:r}=gS(e);try{return new RegExp(t,r)}catch(n){throw new Error(`Invalid RegExp: ${n.message}`)}})),Er=V.string().or(V.object({$in:V.string().array()})).or(V.object({$regex:PV})),BV=V.object({backgroundColor:V.string().optional(),backgroundImage:V.string().optional(),fadeBackgroundImage:V.boolean().optional(),repeatBackgroundImage:V.boolean().optional(),fontColor:V.string().optional(),accentColor:V.string().optional(),accentFontColor:V.string().optional(),idBackgroundImage:V.string().optional(),fadeIdBackgroundImage:V.boolean().optional(),idBackgroundColor:V.string().optional(),repeatIdBackgroundImage:V.boolean().optional()}),Nc=V.object({profileId:V.string().min(3).max(40),displayName:V.string().default(""),shortBio:V.string().default(""),bio:V.string().default(""),did:V.string(),isPrivate:V.boolean().optional(),email:V.string().optional(),image:V.string().optional(),heroImage:V.string().optional(),websiteLink:V.string().optional(),isServiceProfile:V.boolean().default(!1).optional(),type:V.string().optional(),notificationsWebhook:V.string().url().startsWith("http").optional(),display:BV.optional()}),rX=V.object({profileId:Er,displayName:Er,shortBio:Er,bio:Er,email:Er,websiteLink:Er,isServiceProfile:V.boolean(),type:Er}).partial(),nX=ti.extend({records:Nc.array()}),iX=V.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),Kk=V.object({id:V.string(),created:V.string(),displayName:V.string().default("").optional(),shortBio:V.string().default("").optional(),bio:V.string().default("").optional(),email:V.string().optional(),image:V.string().optional(),heroImage:V.string().optional()}),oX=ti.extend({records:Kk.extend({did:V.string()}).array()}),aX=V.object({id:Er,displayName:Er,shortBio:Er,bio:Er,email:Er}).partial(),sX=ti.extend({records:V.object({profile:Nc,manager:Kk.extend({did:V.string()}).optional()}).array()}),cX=V.object({uri:V.string(),to:V.string(),from:V.string(),sent:V.string().datetime(),received:V.string().datetime().optional()}),Gk=V.object({role:V.string(),canEdit:V.boolean(),canIssue:V.boolean(),canRevoke:V.boolean(),canManagePermissions:V.boolean(),canIssueChildren:V.string(),canCreateChildren:V.string(),canEditChildren:V.string(),canRevokeChildren:V.string(),canManageChildrenPermissions:V.string(),canManageChildrenProfiles:V.boolean().default(!1).optional(),canViewAnalytics:V.boolean()}),LV=V.object({role:Er,canEdit:V.boolean(),canIssue:V.boolean(),canRevoke:V.boolean(),canManagePermissions:V.boolean(),canIssueChildren:Er,canCreateChildren:Er,canEditChildren:Er,canRevokeChildren:Er,canManageChildrenPermissions:Er,canManageChildrenProfiles:V.boolean(),canViewAnalytics:V.boolean()}).partial(),vS=V.enum(["GRANT_PERMISSIONS","ADD_ADMIN"]),UV=V.discriminatedUnion("type",[V.object({type:V.literal(vS.Values.GRANT_PERMISSIONS),data:V.object({claimUri:V.string(),targetUri:V.string(),permissions:Gk.partial()})}),V.object({type:V.literal(vS.Values.ADD_ADMIN),data:V.object({claimUri:V.string(),targetUri:V.string()})})]),uX=V.object({type:Er,data:V.object({claimUri:Er,targetUri:Er,permissions:LV})}).deepPartial(),FV=V.object({id:V.string(),createdAt:V.string(),updatedAt:V.string()}).and(UV),lX=ti.extend({records:FV.array()}),s6=V.enum(["DRAFT","LIVE"]),jV=V.object({uri:V.string(),name:V.string().optional(),type:V.string().optional(),category:V.string().optional(),status:s6.optional(),autoConnectRecipients:V.boolean().optional(),meta:V.record(V.any()).optional(),claimPermissions:Gk.optional()}),fX=V.object({uri:Er,name:Er,type:Er,category:Er,meta:V.record(Er),status:s6.or(V.object({$in:s6.array()})),autoConnectRecipients:V.boolean()}).partial(),dX=ti.extend({records:jV.array()}),$V=V.object({to:Nc,from:V.string(),received:V.string().optional(),uri:V.string().optional()}),hX=ti.extend({records:$V.array()}),pX=V.object({endpoint:V.string(),name:V.string(),did:V.string().optional()}),mX=V.object({ttlSeconds:V.number().optional(),totalUses:V.number().optional()}),zV=V.object({endpoint:V.string()}),gX=V.object({signingAuthority:zV,relationship:V.object({name:V.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:V.string()})}),vX=V.object({boostUri:V.string(),signingAuthority:V.object({endpoint:V.string(),name:V.string()})}),HV=V.enum(["live","stale","withdrawn"]),qV=V.object({read:V.object({anonymize:V.boolean().optional(),credentials:V.object({categories:V.record(V.object({required:V.boolean()})).default({})}).default({}),personal:V.record(V.object({required:V.boolean()})).default({})}).default({}),write:V.object({credentials:V.object({categories:V.record(V.object({required:V.boolean()})).default({})}).default({}),personal:V.record(V.object({required:V.boolean()})).default({})}).default({})}),Wk=V.object({contract:qV,owner:Nc,name:V.string(),subtitle:V.string().optional(),description:V.string().optional(),reasonForAccessing:V.string().optional(),image:V.string().optional(),uri:V.string(),needsGuardianConsent:V.boolean().optional(),redirectUrl:V.string().optional(),frontDoorBoostUri:V.string().optional(),createdAt:V.string(),updatedAt:V.string(),expiresAt:V.string().optional(),autoBoosts:V.string().array().optional()}),yX=ti.extend({records:Wk.omit({owner:!0}).array()}),VV=V.object({credentials:V.object({categories:V.record(V.string().array()).default({})}),personal:V.record(V.string()).default({}),date:V.string()}),bX=ti.extend({records:VV.array()}),KV=V.object({credentials:V.object({category:V.string(),uri:V.string()}).array(),personal:V.record(V.string()).default({}),date:V.string(),contractUri:V.string()}),wX=ti.extend({records:KV.array()}),Jk=V.object({sharing:V.boolean().optional(),shared:V.string().array().optional(),shareAll:V.boolean().optional(),shareUntil:V.string().optional()}),Zk=V.object({read:V.object({anonymize:V.boolean().optional(),credentials:V.object({shareAll:V.boolean().optional(),sharing:V.boolean().optional(),categories:V.record(Jk).default({})}).default({}),personal:V.record(V.string()).default({})}).default({}),write:V.object({credentials:V.object({categories:V.record(V.boolean()).default({})}).default({}),personal:V.record(V.boolean()).default({})}).default({})}),_X=ti.extend({records:V.object({expiresAt:V.string().optional(),oneTime:V.boolean().optional(),terms:Zk,contract:Wk,uri:V.string(),consenter:Nc,status:HV}).array()}),EX=V.object({read:V.object({anonymize:V.boolean().optional(),credentials:V.object({categories:V.record(V.object({required:V.boolean().optional()})).optional()}).optional(),personal:V.record(V.object({required:V.boolean().optional()})).optional()}).optional(),write:V.object({credentials:V.object({categories:V.record(V.object({required:V.boolean().optional()})).optional()}).optional(),personal:V.record(V.object({required:V.boolean().optional()})).optional()}).optional()}),AX=V.object({anonymize:V.boolean().optional(),credentials:V.object({categories:V.record(V.boolean()).optional()}).optional(),personal:V.record(V.boolean()).optional()}),SX=V.object({credentials:V.object({categories:V.record(V.boolean()).optional()}).optional(),personal:V.record(V.boolean()).optional(),id:Er.optional()}),GV=V.object({read:V.object({anonymize:V.boolean().optional(),credentials:V.object({shareAll:V.boolean().optional(),sharing:V.boolean().optional(),categories:V.record(Jk.optional()).optional()}).optional(),personal:V.record(V.string()).optional()}).optional(),write:V.object({credentials:V.object({categories:V.record(V.boolean()).optional()}).optional(),personal:V.record(V.boolean()).optional()}).optional()}),c6=V.enum(["consent","update","sync","withdraw","write"]),xX=V.object({terms:GV.optional(),action:c6.or(c6.array()).optional(),date:V.object({$gt:V.string()}).or(V.object({$lt:V.string()})).or(V.object({$eq:V.string()})).optional(),expiresAt:V.object({$gt:V.string()}).or(V.object({$lt:V.string()})).or(V.object({$eq:V.string()})).optional(),oneTime:V.boolean().optional()}),Yk=V.object({expiresAt:V.string().optional(),oneTime:V.boolean().optional(),terms:Zk.optional(),id:V.string(),action:c6,date:V.string(),uris:V.string().array().optional()}),TX=ti.extend({records:Yk.array()}),WV=V.object({credentialUri:V.string(),termsUri:V.string(),contractUri:V.string(),boostUri:V.string(),category:V.string().optional(),date:V.string()}),CX=ti.extend({records:WV.array()}),JV=V.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED","CONSENT_FLOW_TRANSACTION"]),ZV=V.object({title:V.string().optional(),body:V.string().optional()}),YV=V.object({vcUris:V.array(V.string()).optional(),vpUris:V.array(V.string()).optional(),transaction:Yk.optional()}),MX=V.object({type:JV,to:Nc.partial().and(V.object({did:V.string()})),from:Nc.partial().and(V.object({did:V.string()})),message:ZV.optional(),data:YV.optional(),sent:V.string().datetime().optional()}),t1=a(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),IX=V.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 z2=z.object({credentials:mc.array()}).catchall(z.any()),Xk=z.object({id:z.string(),title:z.string(),storageType:z.literal("ceramic").optional()}).catchall(z.any()),H2=z.object({credentials:mc.or(Xk).array()}).strict();var Qk={modelData:{definitions:{MyVerifiableCredentials:"kjzl6cwe1jw14am5tu5hh412s19o4zm8aq3g2lpd6s4paxj2nly2lj4drp3pun2"},schemas:{AchievementVerifiableCredential:"ceramic://k3y52l7qbv1frylibw2725v8gem3hxs1onoh6pvux0szdduugczh0hddxo6qsd6o0",VerifiableCredentialsList:"ceramic://k3y52l7qbv1frxkcwfpyauky3fyl4n44izridy3blvjjzgftis40sk9w8g3remghs"},tiles:{}},credentialAlias:"MyVerifiableCredentials"};var r1=i(async(e,{modelData:t,credentialAlias:r}=Qk)=>{let n=e.invoke.getCeramicClient(),o=new Lf({ceramic:n,model:t}),s=i(async(g=r)=>{let v=await o.get(g);if(!v)return{credentials:[]};let y=await z2.spa(v);if(y.success)return y.data;let _=await H2.spa(v);if(_.success){let D={credentials:_.data.credentials.map(P=>{if("uri"in P)return P;let{title:J,id:j,storageType:H,...Q}=P;return{...Q,id:J,uri:`lc:ceramic:${j.replace("ceramic://","")}`}})};return await o.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),o.set(v,y)},"removeCredentialFromIdx"),l=i(async g=>(g||(g=r),o.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),t1(await o.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(_)})),t1(await o.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 p0.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),t1(await o.set(r,_))},removeVerifiableCredentialInIdx:async(g,v)=>c(v),removeAllVerifiableCredentialsInIdx:async()=>l(),getIDXIndex:async()=>o.get(r),setIDXIndex:async(g,v)=>o.set(r,v)}}},"getIDXPlugin");var XV=r1;
|
|
846
846
|
/*!
|
|
847
847
|
* The buffer module from node.js, for the browser.
|
|
848
848
|
*
|