@learncard/idx-plugin 1.0.8 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,7 +21,7 @@ if (cid) {
21
21
  `;var zv={};wn(zv,{base36:()=>Yi,base36upper:()=>fR});var Yi=Ua({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),fR=Ua({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var i8={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function dR(e){let t=i8[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(dR,"codeByName");function hR(e){let t=Object.entries(i8).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(hR,"nameByCode");var Xi=class{};i(Xi,"StreamType");Xi.nameByCode=hR;Xi.codeByName=dR;var xg=Uo(Qh(),1);function iu(e){return globalThis.Buffer!=null?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}i(iu,"asUint8Array");function pf(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?iu(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}i(pf,"allocUnsafe");function mf(e,t){t||(t=e.reduce((s,o)=>s+o.length,0));let r=pf(t),n=0;for(let s of e)r.set(s,n),n+=s.length;return iu(r)}i(mf,"concat");var Kv={};wn(Kv,{identity:()=>MR});var MR=ru({prefix:"\0",name:"identity",encode:e=>X_(e),decode:e=>Y_(e)});var Vv={};wn(Vv,{base2:()=>CR});var CR=Nr({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Gv={};wn(Gv,{base8:()=>IR});var IR=Nr({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Wv={};wn(Wv,{base10:()=>kR});var kR=Ua({prefix:"9",name:"base10",alphabet:"0123456789"});var Zv={};wn(Zv,{base16:()=>DR,base16upper:()=>OR});var DR=Nr({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),OR=Nr({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Jv={};wn(Jv,{base64:()=>RR,base64pad:()=>NR,base64url:()=>PR,base64urlpad:()=>BR});var RR=Nr({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),NR=Nr({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),PR=Nr({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),BR=Nr({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Yv={};wn(Yv,{base256emoji:()=>jR});var p8=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}"),LR=p8.reduce((e,t,r)=>(e[r]=t,e),[]),FR=p8.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);function UR(e){return e.reduce((t,r)=>(t+=LR[r],t),"")}i(UR,"encode");function $R(e){let t=[];for(let r of e){let n=FR[r.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${r}`);t.push(n)}return new Uint8Array(t)}i($R,"decode");var jR=ru({prefix:"\u{1F680}",name:"base256emoji",encode:UR,decode:$R});var eg={};wn(eg,{sha256:()=>Qv,sha512:()=>zR});var Xv=i(({name:e,code:t,encode:r})=>new ep(e,t,r),"from"),ep=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?jo(this.code,r):r.then(n=>jo(this.code,n))}else throw Error("Unknown type, must be binary type")}};i(ep,"Hasher");var v8=i(e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),"sha"),Qv=Xv({name:"sha2-256",code:18,encode:v8("SHA-256")}),zR=Xv({name:"sha2-512",code:19,encode:v8("SHA-512")});var tg={};wn(tg,{identity:()=>KR});var g8=0,HR="identity",b8=sa,qR=i(e=>jo(g8,b8(e)),"digest"),KR={code:g8,name:HR,encode:b8,digest:qR};var WK=new TextEncoder,ZK=new TextDecoder;var rg={...Kv,...Vv,...Gv,...Wv,...Zv,...jv,...zv,...$v,...Jv,...Yv},QK={...eg,...tg};function w8(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}i(w8,"createCodec");var y8=w8("utf8","u",e=>{let t=new TextDecoder("utf8");return"u"+t.decode(e)},e=>new TextEncoder().encode(e.substring(1))),ng=w8("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=pf(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),WR={utf8:y8,"utf-8":y8,hex:rg.base16,latin1:ng,ascii:ng,binary:ng,...rg},ig=WR;function sg(e,t="utf8"){let r=ig[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(sg,"toString");function si(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(s,o,c)=>{if(c.value!=null)c.value=_8(c.value,t,r,n);else if(c.get!=null)c.get=_8(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(si,"Memoize");var ag=new Map;function _8(e,t,r=0,n){let s=Symbol("__memoized_map__");return function(...o){let c;this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let f=this[s];if(Array.isArray(n))for(let h of n)ag.has(h)?ag.get(h).push(f):ag.set(h,[f]);if(t||o.length>0||r>0){let h;t===!0?h=o.map(y=>y.toString()).join("!"):t?h=t.apply(this,o):h=o[0];let p=`${h}__timestamp`,v=!1;if(r>0)if(!f.has(p))v=!0;else{let y=f.get(p);v=Date.now()-y>r}f.has(h)&&!v?c=f.get(h):(c=e.apply(this,o),f.set(h,c),r>0&&f.set(p,Date.now()))}else{let h=this;f.has(h)?c=f.get(h):(c=e.apply(this,o),f.set(h,c))}return c}}i(_8,"getNewFunction");var tp=i(({enumerable:e=!0,configurable:t=!1}={})=>({enumerable:e,configurable:t,writable:!1}),"readonly"),og=i(function*(e,t){if(e!=null&&!(e instanceof Uint8Array))for(let[r,n]of Object.entries(e)){let s=[...t,r];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let[o,c]of n.entries()){let f=[...s,o],h=Ut.asCID(c);h?yield[f.join("/"),h]:typeof c=="object"&&(yield*og(c,f))}else{let o=Ut.asCID(n);o?yield[s.join("/"),o]:yield*og(n,s)}}},"links"),cg=i(function*(e,t){if(e!=null)for(let[r,n]of Object.entries(e)){let s=[...t,r];if(yield s.join("/"),n!=null&&!(n instanceof Uint8Array)&&typeof n=="object"&&!Ut.asCID(n))if(Array.isArray(n))for(let[o,c]of n.entries()){let f=[...s,o];yield f.join("/"),typeof c=="object"&&!Ut.asCID(c)&&(yield*cg(c,f))}else yield*cg(n,s)}},"tree"),JR=i((e,t)=>{let r=e;for(let[n,s]of t.entries()){if(r=r[s],r==null)throw new Error(`Object has no property at ${t.slice(0,n+1).map(c=>`[${JSON.stringify(c)}]`).join("")}`);let o=Ut.asCID(r);if(o)return{value:o,remaining:t.slice(n+1).join("/")}}return{value:r}},"get"),rp=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:tp(),bytes:tp(),value:tp(),asBlock:tp()})}links(){return og(this.value,[])}tree(){return cg(this.value,[])}get(t="/"){return JR(this.value,t.split("/").filter(Boolean))}};i(rp,"Block");var E8=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),s=await r.digest(n),o=Ut.create(1,t.code,s);return new rp({value:e,bytes:n,cid:o})},"encode");var Ag=Uo(Qh(),1);var pp={};wn(pp,{code:()=>NN,decode:()=>PN,encode:()=>bg,name:()=>RN});var XR=["string","number","bigint","symbol"],QR=["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 A8(e){if(e===null)return"null";if(e===void 0)return"undefined";if(e===!0||e===!1)return"boolean";let t=typeof e;if(XR.includes(t))return t;if(t==="function")return"Function";if(Array.isArray(e))return"Array";if(eN(e))return"Buffer";let r=tN(e);return r||"Object"}i(A8,"is");function eN(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}i(eN,"isBuffer");function tN(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(QR.includes(t))return t}i(tN,"getObjectType");var Oe=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(Oe,"Type");Oe.uint=new Oe(0,"uint",!0);Oe.negint=new Oe(1,"negint",!0);Oe.bytes=new Oe(2,"bytes",!0);Oe.string=new Oe(3,"string",!0);Oe.array=new Oe(4,"array",!1);Oe.map=new Oe(5,"map",!1);Oe.tag=new Oe(6,"tag",!1);Oe.float=new Oe(7,"float",!0);Oe.false=new Oe(7,"false",!0);Oe.true=new Oe(7,"true",!0);Oe.null=new Oe(7,"null",!0);Oe.undefined=new Oe(7,"undefined",!0);Oe.break=new Oe(7,"break",!0);var Xe=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(Xe,"Token");var su=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer=="function",rN=new TextDecoder,nN=new TextEncoder;function np(e){return su&&globalThis.Buffer.isBuffer(e)}i(np,"isBuffer");function ug(e){return e instanceof Uint8Array?np(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}i(ug,"asU8A");var M8=su?(e,t,r)=>r-t>64?globalThis.Buffer.from(e.subarray(t,r)).toString("utf8"):x8(e,t,r):(e,t,r)=>r-t>64?rN.decode(e.subarray(t,r)):x8(e,t,r),C8=su?e=>e.length>64?globalThis.Buffer.from(e):S8(e):e=>e.length>64?nN.encode(e):S8(e),Cs=i(e=>Uint8Array.from(e),"fromArray"),au=su?(e,t,r)=>np(e)?new Uint8Array(e.subarray(t,r)):e.slice(t,r):(e,t,r)=>e.slice(t,r),I8=su?(e,t)=>(e=e.map(r=>r instanceof Uint8Array?r:globalThis.Buffer.from(r)),ug(globalThis.Buffer.concat(e,t))):(e,t)=>{let r=new Uint8Array(t),n=0;for(let s of e)n+s.length>r.length&&(s=s.subarray(0,r.length-n)),r.set(s,n),n+=s.length;return r},k8=su?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function D8(e,t){if(np(e)&&np(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(D8,"compare");function S8(e,t=1/0){let r,n=e.length,s=null,o=[];for(let c=0;c<n;++c){if(r=e.charCodeAt(c),r>55295&&r<57344){if(!s){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}else if(c+1===n){(t-=3)>-1&&o.push(239,191,189);continue}s=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),s=r;continue}r=(s-55296<<10|r-56320)+65536}else s&&(t-=3)>-1&&o.push(239,191,189);if(s=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}i(S8,"utf8ToBytes");function x8(e,t,r){let n=[];for(;t<r;){let s=e[t],o=null,c=s>239?4:s>223?3:s>191?2:1;if(t+c<=r){let f,h,p,v;switch(c){case 1:s<128&&(o=s);break;case 2:f=e[t+1],(f&192)===128&&(v=(s&31)<<6|f&63,v>127&&(o=v));break;case 3:f=e[t+1],h=e[t+2],(f&192)===128&&(h&192)===128&&(v=(s&15)<<12|(f&63)<<6|h&63,v>2047&&(v<55296||v>57343)&&(o=v));break;case 4:f=e[t+1],h=e[t+2],p=e[t+3],(f&192)===128&&(h&192)===128&&(p&192)===128&&(v=(s&15)<<18|(f&63)<<12|(h&63)<<6|p&63,v>65535&&v<1114112&&(o=v))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),t+=c}return iN(n)}i(x8,"utf8Slice");var T8=4096;function iN(e){let t=e.length;if(t<=T8)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=T8));return r}i(iN,"decodeCodePointsArray");var sN=256,ou=class{constructor(t=sN){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 s=r.length-(this.maxCursor-this.cursor)-1;r.set(t,s)}else{if(r){let s=r.length-(this.maxCursor-this.cursor)-1;s<r.length&&(this.chunks[this.chunks.length-1]=r.subarray(0,s),this.maxCursor=this.cursor-1)}t.length<64&&t.length<this.chunkSize?(r=k8(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=au(n,0,this.cursor)}else r=I8(this.chunks,this.cursor);return t&&this.reset(),r}};i(ou,"Bl");var Ct="CBOR decode error:",lg="CBOR encode error:",vf=[];vf[23]=1;vf[24]=2;vf[25]=3;vf[26]=5;vf[27]=9;function aa(e,t,r){if(e.length-t<r)throw new Error(`${Ct} not enough data for type`)}i(aa,"assertEnoughData");var Yr=[24,256,65536,4294967296,BigInt("18446744073709551616")];function ai(e,t,r){aa(e,t,1);let n=e[t];if(r.strict===!0&&n<Yr[0])throw new Error(`${Ct} integer encoded in more bytes than necessary (strict decode)`);return n}i(ai,"readUint8");function oi(e,t,r){aa(e,t,2);let n=e[t]<<8|e[t+1];if(r.strict===!0&&n<Yr[1])throw new Error(`${Ct} integer encoded in more bytes than necessary (strict decode)`);return n}i(oi,"readUint16");function ci(e,t,r){aa(e,t,4);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(r.strict===!0&&n<Yr[2])throw new Error(`${Ct} integer encoded in more bytes than necessary (strict decode)`);return n}i(ci,"readUint32");function ui(e,t,r){aa(e,t,8);let n=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],s=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],o=(BigInt(n)<<BigInt(32))+BigInt(s);if(r.strict===!0&&o<Yr[3])throw new Error(`${Ct} integer encoded in more bytes than necessary (strict decode)`);if(o<=Number.MAX_SAFE_INTEGER)return Number(o);if(r.allowBigInt===!0)return o;throw new Error(`${Ct} integers outside of the safe integer range are not supported`)}i(ui,"readUint64");function O8(e,t,r,n){return new Xe(Oe.uint,ai(e,t+1,n),2)}i(O8,"decodeUint8");function R8(e,t,r,n){return new Xe(Oe.uint,oi(e,t+1,n),3)}i(R8,"decodeUint16");function N8(e,t,r,n){return new Xe(Oe.uint,ci(e,t+1,n),5)}i(N8,"decodeUint32");function P8(e,t,r,n){return new Xe(Oe.uint,ui(e,t+1,n),9)}i(P8,"decodeUint64");function Ri(e,t){return an(e,0,t.value)}i(Ri,"encodeUint");function an(e,t,r){if(r<Yr[0]){let n=Number(r);e.push([t|n])}else if(r<Yr[1]){let n=Number(r);e.push([t|24,n])}else if(r<Yr[2]){let n=Number(r);e.push([t|25,n>>>8,n&255])}else if(r<Yr[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<Yr[4]){let s=[t|27,0,0,0,0,0,0,0],o=Number(n&BigInt(4294967295)),c=Number(n>>BigInt(32)&BigInt(4294967295));s[8]=o&255,o=o>>8,s[7]=o&255,o=o>>8,s[6]=o&255,o=o>>8,s[5]=o&255,s[4]=c&255,c=c>>8,s[3]=c&255,c=c>>8,s[2]=c&255,c=c>>8,s[1]=c&255,e.push(s)}else throw new Error(`${Ct} encountered BigInt larger than allowable range`)}}i(an,"encodeUintValue");Ri.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");an.encodedSize=i(function(t){return t<Yr[0]?1:t<Yr[1]?2:t<Yr[2]?3:t<Yr[3]?5:9},"encodedSize");Ri.compareTokens=i(function(t,r){return t.value<r.value?-1:t.value>r.value?1:0},"compareTokens");function B8(e,t,r,n){return new Xe(Oe.negint,-1-ai(e,t+1,n),2)}i(B8,"decodeNegint8");function L8(e,t,r,n){return new Xe(Oe.negint,-1-oi(e,t+1,n),3)}i(L8,"decodeNegint16");function F8(e,t,r,n){return new Xe(Oe.negint,-1-ci(e,t+1,n),5)}i(F8,"decodeNegint32");var fg=BigInt(-1),U8=BigInt(1);function $8(e,t,r,n){let s=ui(e,t+1,n);if(typeof s!="bigint"){let o=-1-s;if(o>=Number.MIN_SAFE_INTEGER)return new Xe(Oe.negint,o,9)}if(n.allowBigInt!==!0)throw new Error(`${Ct} integers outside of the safe integer range are not supported`);return new Xe(Oe.negint,fg-BigInt(s),9)}i($8,"decodeNegint64");function ip(e,t){let r=t.value,n=typeof r=="bigint"?r*fg-U8:r*-1-1;an(e,t.type.majorEncoded,n)}i(ip,"encodeNegint");ip.encodedSize=i(function(t){let r=t.value,n=typeof r=="bigint"?r*fg-U8:r*-1-1;return n<Yr[0]?1:n<Yr[1]?2:n<Yr[2]?3:n<Yr[3]?5:9},"encodedSize");ip.compareTokens=i(function(t,r){return t.value<r.value?1:t.value>r.value?-1:0},"compareTokens");function gf(e,t,r,n){aa(e,t,r+n);let s=au(e,t+r,t+r+n);return new Xe(Oe.bytes,s,r+n)}i(gf,"toToken");function j8(e,t,r,n){return gf(e,t,1,r)}i(j8,"decodeBytesCompact");function z8(e,t,r,n){return gf(e,t,2,ai(e,t+1,n))}i(z8,"decodeBytes8");function H8(e,t,r,n){return gf(e,t,3,oi(e,t+1,n))}i(H8,"decodeBytes16");function q8(e,t,r,n){return gf(e,t,5,ci(e,t+1,n))}i(q8,"decodeBytes32");function K8(e,t,r,n){let s=ui(e,t+1,n);if(typeof s=="bigint")throw new Error(`${Ct} 64-bit integer bytes lengths not supported`);return gf(e,t,9,s)}i(K8,"decodeBytes64");function sp(e){return e.encodedBytes===void 0&&(e.encodedBytes=e.type===Oe.string?C8(e.value):e.value),e.encodedBytes}i(sp,"tokenBytes");function cu(e,t){let r=sp(t);an(e,t.type.majorEncoded,r.length),e.push(r)}i(cu,"encodeBytes");cu.encodedSize=i(function(t){let r=sp(t);return an.encodedSize(r.length)+r.length},"encodedSize");cu.compareTokens=i(function(t,r){return oN(sp(t),sp(r))},"compareTokens");function oN(e,t){return e.length<t.length?-1:e.length>t.length?1:D8(e,t)}i(oN,"compareBytes");function bf(e,t,r,n,s){let o=r+n;aa(e,t,o);let c=new Xe(Oe.string,M8(e,t+r,t+o),o);return s.retainStringBytes===!0&&(c.byteValue=au(e,t+r,t+o)),c}i(bf,"toToken");function V8(e,t,r,n){return bf(e,t,1,r,n)}i(V8,"decodeStringCompact");function G8(e,t,r,n){return bf(e,t,2,ai(e,t+1,n),n)}i(G8,"decodeString8");function W8(e,t,r,n){return bf(e,t,3,oi(e,t+1,n),n)}i(W8,"decodeString16");function Z8(e,t,r,n){return bf(e,t,5,ci(e,t+1,n),n)}i(Z8,"decodeString32");function J8(e,t,r,n){let s=ui(e,t+1,n);if(typeof s=="bigint")throw new Error(`${Ct} 64-bit integer string lengths not supported`);return bf(e,t,9,s,n)}i(J8,"decodeString64");var Y8=cu;function uu(e,t,r,n){return new Xe(Oe.array,n,r)}i(uu,"toToken");function X8(e,t,r,n){return uu(e,t,1,r)}i(X8,"decodeArrayCompact");function Q8(e,t,r,n){return uu(e,t,2,ai(e,t+1,n))}i(Q8,"decodeArray8");function e9(e,t,r,n){return uu(e,t,3,oi(e,t+1,n))}i(e9,"decodeArray16");function t9(e,t,r,n){return uu(e,t,5,ci(e,t+1,n))}i(t9,"decodeArray32");function r9(e,t,r,n){let s=ui(e,t+1,n);if(typeof s=="bigint")throw new Error(`${Ct} 64-bit integer array lengths not supported`);return uu(e,t,9,s)}i(r9,"decodeArray64");function n9(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ct} indefinite length items not allowed`);return uu(e,t,1,1/0)}i(n9,"decodeArrayIndefinite");function ap(e,t){an(e,Oe.array.majorEncoded,t.value)}i(ap,"encodeArray");ap.compareTokens=Ri.compareTokens;ap.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");function lu(e,t,r,n){return new Xe(Oe.map,n,r)}i(lu,"toToken");function i9(e,t,r,n){return lu(e,t,1,r)}i(i9,"decodeMapCompact");function s9(e,t,r,n){return lu(e,t,2,ai(e,t+1,n))}i(s9,"decodeMap8");function a9(e,t,r,n){return lu(e,t,3,oi(e,t+1,n))}i(a9,"decodeMap16");function o9(e,t,r,n){return lu(e,t,5,ci(e,t+1,n))}i(o9,"decodeMap32");function c9(e,t,r,n){let s=ui(e,t+1,n);if(typeof s=="bigint")throw new Error(`${Ct} 64-bit integer map lengths not supported`);return lu(e,t,9,s)}i(c9,"decodeMap64");function u9(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ct} indefinite length items not allowed`);return lu(e,t,1,1/0)}i(u9,"decodeMapIndefinite");function op(e,t){an(e,Oe.map.majorEncoded,t.value)}i(op,"encodeMap");op.compareTokens=Ri.compareTokens;op.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");function l9(e,t,r,n){return new Xe(Oe.tag,r,1)}i(l9,"decodeTagCompact");function f9(e,t,r,n){return new Xe(Oe.tag,ai(e,t+1,n),2)}i(f9,"decodeTag8");function d9(e,t,r,n){return new Xe(Oe.tag,oi(e,t+1,n),3)}i(d9,"decodeTag16");function h9(e,t,r,n){return new Xe(Oe.tag,ci(e,t+1,n),5)}i(h9,"decodeTag32");function p9(e,t,r,n){return new Xe(Oe.tag,ui(e,t+1,n),9)}i(p9,"decodeTag64");function cp(e,t){an(e,Oe.tag.majorEncoded,t.value)}i(cp,"encodeTag");cp.compareTokens=Ri.compareTokens;cp.encodedSize=i(function(t){return an.encodedSize(t.value)},"encodedSize");var hN=20,pN=21,mN=22,vN=23;function m9(e,t,r,n){if(n.allowUndefined===!1)throw new Error(`${Ct} undefined values are not supported`);return n.coerceUndefinedToNull===!0?new Xe(Oe.null,null,1):new Xe(Oe.undefined,void 0,1)}i(m9,"decodeUndefined");function v9(e,t,r,n){if(n.allowIndefinite===!1)throw new Error(`${Ct} indefinite length items not allowed`);return new Xe(Oe.break,void 0,1)}i(v9,"decodeBreak");function dg(e,t,r){if(r){if(r.allowNaN===!1&&Number.isNaN(e))throw new Error(`${Ct} NaN values are not supported`);if(r.allowInfinity===!1&&(e===1/0||e===-1/0))throw new Error(`${Ct} Infinity values are not supported`)}return new Xe(Oe.float,e,t)}i(dg,"createToken");function g9(e,t,r,n){return dg(hg(e,t+1),3,n)}i(g9,"decodeFloat16");function b9(e,t,r,n){return dg(pg(e,t+1),5,n)}i(b9,"decodeFloat32");function y9(e,t,r,n){return dg(A9(e,t+1),9,n)}i(y9,"decodeFloat64");function up(e,t,r){let n=t.value;if(n===!1)e.push([Oe.float.majorEncoded|hN]);else if(n===!0)e.push([Oe.float.majorEncoded|pN]);else if(n===null)e.push([Oe.float.majorEncoded|mN]);else if(n===void 0)e.push([Oe.float.majorEncoded|vN]);else{let s,o=!1;(!r||r.float64!==!0)&&(_9(n),s=hg(Qi,1),n===s||Number.isNaN(n)?(Qi[0]=249,e.push(Qi.slice(0,3)),o=!0):(E9(n),s=pg(Qi,1),n===s&&(Qi[0]=250,e.push(Qi.slice(0,5)),o=!0))),o||(gN(n),s=A9(Qi,1),Qi[0]=251,e.push(Qi.slice(0,9)))}}i(up,"encodeFloat");up.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){_9(n);let s=hg(Qi,1);if(n===s||Number.isNaN(n))return 3;if(E9(n),s=pg(Qi,1),n===s)return 5}return 9},"encodedSize");var w9=new ArrayBuffer(9),Ni=new DataView(w9,1),Qi=new Uint8Array(w9,0);function _9(e){if(e===1/0)Ni.setUint16(0,31744,!1);else if(e===-1/0)Ni.setUint16(0,64512,!1);else if(Number.isNaN(e))Ni.setUint16(0,32256,!1);else{Ni.setFloat32(0,e);let t=Ni.getUint32(0),r=(t&2139095040)>>23,n=t&8388607;if(r===255)Ni.setUint16(0,31744,!1);else if(r===0)Ni.setUint16(0,(e&2147483648)>>16|n>>13,!1);else{let s=r-127;s<-24?Ni.setUint16(0,0):s<-14?Ni.setUint16(0,(t&2147483648)>>16|1<<24+s,!1):Ni.setUint16(0,(t&2147483648)>>16|s+15<<10|n>>13,!1)}}}i(_9,"encodeFloat16");function hg(e,t){if(e.length-t<2)throw new Error(`${Ct} 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,s=r&1023,o;return n===0?o=s*2**-24:n!==31?o=(s+1024)*2**(n-25):o=s===0?1/0:NaN,r&32768?-o:o}i(hg,"readFloat16");function E9(e){Ni.setFloat32(0,e,!1)}i(E9,"encodeFloat32");function pg(e,t){if(e.length-t<4)throw new Error(`${Ct} not enough data for float32`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,4).getFloat32(0,!1)}i(pg,"readFloat32");function gN(e){Ni.setFloat64(0,e,!1)}i(gN,"encodeFloat64");function A9(e,t){if(e.length-t<8)throw new Error(`${Ct} not enough data for float64`);let r=(e.byteOffset||0)+t;return new DataView(e.buffer,r,8).getFloat64(0,!1)}i(A9,"readFloat64");up.compareTokens=Ri.compareTokens;function ur(e,t,r){throw new Error(`${Ct} encountered invalid minor (${r}) for major ${e[t]>>>5}`)}i(ur,"invalidMinor");function lp(e){return()=>{throw new Error(`${Ct} ${e}`)}}i(lp,"errorer");var Ge=[];for(let e=0;e<=23;e++)Ge[e]=ur;Ge[24]=O8;Ge[25]=R8;Ge[26]=N8;Ge[27]=P8;Ge[28]=ur;Ge[29]=ur;Ge[30]=ur;Ge[31]=ur;for(let e=32;e<=55;e++)Ge[e]=ur;Ge[56]=B8;Ge[57]=L8;Ge[58]=F8;Ge[59]=$8;Ge[60]=ur;Ge[61]=ur;Ge[62]=ur;Ge[63]=ur;for(let e=64;e<=87;e++)Ge[e]=j8;Ge[88]=z8;Ge[89]=H8;Ge[90]=q8;Ge[91]=K8;Ge[92]=ur;Ge[93]=ur;Ge[94]=ur;Ge[95]=lp("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)Ge[e]=V8;Ge[120]=G8;Ge[121]=W8;Ge[122]=Z8;Ge[123]=J8;Ge[124]=ur;Ge[125]=ur;Ge[126]=ur;Ge[127]=lp("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)Ge[e]=X8;Ge[152]=Q8;Ge[153]=e9;Ge[154]=t9;Ge[155]=r9;Ge[156]=ur;Ge[157]=ur;Ge[158]=ur;Ge[159]=n9;for(let e=160;e<=183;e++)Ge[e]=i9;Ge[184]=s9;Ge[185]=a9;Ge[186]=o9;Ge[187]=c9;Ge[188]=ur;Ge[189]=ur;Ge[190]=ur;Ge[191]=u9;for(let e=192;e<=215;e++)Ge[e]=l9;Ge[216]=f9;Ge[217]=d9;Ge[218]=h9;Ge[219]=p9;Ge[220]=ur;Ge[221]=ur;Ge[222]=ur;Ge[223]=ur;for(let e=224;e<=243;e++)Ge[e]=lp("simple values are not supported");Ge[244]=ur;Ge[245]=ur;Ge[246]=ur;Ge[247]=m9;Ge[248]=lp("simple values are not supported");Ge[249]=g9;Ge[250]=b9;Ge[251]=y9;Ge[252]=ur;Ge[253]=ur;Ge[254]=ur;Ge[255]=v9;var es=[];for(let e=0;e<24;e++)es[e]=new Xe(Oe.uint,e,1);for(let e=-1;e>=-24;e--)es[31-e]=new Xe(Oe.negint,e,1);es[64]=new Xe(Oe.bytes,new Uint8Array(0),1);es[96]=new Xe(Oe.string,"",1);es[128]=new Xe(Oe.array,0,1);es[160]=new Xe(Oe.map,0,1);es[244]=new Xe(Oe.false,!1,1);es[245]=new Xe(Oe.true,!0,1);es[246]=new Xe(Oe.null,null,1);function S9(e){switch(e.type){case Oe.false:return Cs([244]);case Oe.true:return Cs([245]);case Oe.null:return Cs([246]);case Oe.bytes:return e.value.length?void 0:Cs([64]);case Oe.string:return e.value===""?Cs([96]):void 0;case Oe.array:return e.value===0?Cs([128]):void 0;case Oe.map:return e.value===0?Cs([160]):void 0;case Oe.uint:return e.value<24?Cs([Number(e.value)]):void 0;case Oe.negint:if(e.value>=-24)return Cs([31-Number(e.value)])}}i(S9,"quickEncodeToken");var yN={float64:!1,mapSorter:EN,quickEncodeToken:S9};function wN(){let e=[];return e[Oe.uint.major]=Ri,e[Oe.negint.major]=ip,e[Oe.bytes.major]=cu,e[Oe.string.major]=Y8,e[Oe.array.major]=ap,e[Oe.map.major]=op,e[Oe.tag.major]=cp,e[Oe.float.major]=up,e}i(wN,"makeCborEncoders");var x9=wN(),mg=new ou,Ho=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(`${lg} object contains circular references`);return new Ho(r,t)}};i(Ho,"Ref");var $a={null:new Xe(Oe.null,null),undefined:new Xe(Oe.undefined,void 0),true:new Xe(Oe.true,!0),false:new Xe(Oe.false,!1),emptyArray:new Xe(Oe.array,0),emptyMap:new Xe(Oe.map,0)},ja={number(e,t,r,n){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new Xe(Oe.float,e):e>=0?new Xe(Oe.uint,e):new Xe(Oe.negint,e)},bigint(e,t,r,n){return e>=BigInt(0)?new Xe(Oe.uint,e):new Xe(Oe.negint,e)},Uint8Array(e,t,r,n){return new Xe(Oe.bytes,e)},string(e,t,r,n){return new Xe(Oe.string,e)},boolean(e,t,r,n){return e?$a.true:$a.false},null(e,t,r,n){return $a.null},undefined(e,t,r,n){return $a.undefined},ArrayBuffer(e,t,r,n){return new Xe(Oe.bytes,new Uint8Array(e))},DataView(e,t,r,n){return new Xe(Oe.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,r,n){if(!e.length)return r.addBreakTokens===!0?[$a.emptyArray,new Xe(Oe.break)]:$a.emptyArray;n=Ho.createCheck(n,e);let s=[],o=0;for(let c of e)s[o++]=fp(c,r,n);return r.addBreakTokens?[new Xe(Oe.array,e.length),s,new Xe(Oe.break)]:[new Xe(Oe.array,e.length),s]},Object(e,t,r,n){let s=t!=="Object",o=s?e.keys():Object.keys(e),c=s?e.size:o.length;if(!c)return r.addBreakTokens===!0?[$a.emptyMap,new Xe(Oe.break)]:$a.emptyMap;n=Ho.createCheck(n,e);let f=[],h=0;for(let p of o)f[h++]=[fp(p,r,n),fp(s?e.get(p):e[p],r,n)];return _N(f,r),r.addBreakTokens?[new Xe(Oe.map,c),f,new Xe(Oe.break)]:[new Xe(Oe.map,c),f]}};ja.Map=ja.Object;ja.Buffer=ja.Uint8Array;for(let e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))ja[`${e}Array`]=ja.DataView;function fp(e,t={},r){let n=A8(e),s=t&&t.typeEncoders&&t.typeEncoders[n]||ja[n];if(typeof s=="function"){let c=s(e,n,t,r);if(c!=null)return c}let o=ja[n];if(!o)throw new Error(`${lg} unsupported type: ${n}`);return o(e,n,t,r)}i(fp,"objectToTokens");function _N(e,t){t.mapSorter&&e.sort(t.mapSorter)}i(_N,"sortMapEntries");function EN(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 s=r.type.major,o=x9[s].compareTokens(r,n);return o===0&&console.warn("WARNING: complex key types used, CBOR key sorting guarantees are gone"),o}i(EN,"mapSorter");function T9(e,t,r,n){if(Array.isArray(t))for(let s of t)T9(e,s,r,n);else r[t.type.major](e,t,n)}i(T9,"tokensToEncoded");function AN(e,t,r){let n=fp(e,r);if(!Array.isArray(n)&&r.quickEncodeToken){let s=r.quickEncodeToken(n);if(s)return s;let o=t[n.type.major];if(o.encodedSize){let c=o.encodedSize(n,r),f=new ou(c);if(o(f,n,r),f.chunks.length!==1)throw new Error(`Unexpected error: pre-calculated length for ${n} was wrong`);return ug(f.chunks[0])}}return mg.reset(),T9(mg,n,t,r),mg.toBytes(!0)}i(AN,"encodeCustom");function vg(e,t){return t=Object.assign({},yN,t),AN(e,x9,t)}i(vg,"encode");var SN={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},dp=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=es[t];if(r===void 0){let n=Ge[t];if(!n)throw new Error(`${Ct} no decoder for major type ${t>>>5} (byte 0x${t.toString(16).padStart(2,"0")})`);let s=t&31;r=n(this.data,this.pos,s,this.options)}return this.pos+=r.encodedLength,r}};i(dp,"Tokeniser");var yf=Symbol.for("DONE"),hp=Symbol.for("BREAK");function xN(e,t,r){let n=[];for(let s=0;s<e.value;s++){let o=wf(t,r);if(o===hp){if(e.value===1/0)break;throw new Error(`${Ct} got unexpected break to lengthed array`)}if(o===yf)throw new Error(`${Ct} found array but not enough entries (got ${s}, expected ${e.value})`);n[s]=o}return n}i(xN,"tokenToArray");function TN(e,t,r){let n=r.useMaps===!0,s=n?void 0:{},o=n?new Map:void 0;for(let c=0;c<e.value;c++){let f=wf(t,r);if(f===hp){if(e.value===1/0)break;throw new Error(`${Ct} got unexpected break to lengthed map`)}if(f===yf)throw new Error(`${Ct} found map but not enough entries (got ${c} [no key], expected ${e.value})`);if(n!==!0&&typeof f!="string")throw new Error(`${Ct} non-string keys not supported (got ${typeof f})`);if(r.rejectDuplicateMapKeys===!0&&(n&&o.has(f)||!n&&f in s))throw new Error(`${Ct} found repeat map key "${f}"`);let h=wf(t,r);if(h===yf)throw new Error(`${Ct} found map but not enough entries (got ${c} [no value], expected ${e.value})`);n?o.set(f,h):s[f]=h}return n?o:s}i(TN,"tokenToMap");function wf(e,t){if(e.done())return yf;let r=e.next();if(r.type===Oe.break)return hp;if(r.type.terminal)return r.value;if(r.type===Oe.array)return xN(r,e,t);if(r.type===Oe.map)return TN(r,e,t);if(r.type===Oe.tag){if(t.tags&&typeof t.tags[r.value]=="function"){let n=wf(e,t);return t.tags[r.value](n)}throw new Error(`${Ct} tag not supported (${r.value})`)}throw new Error("unsupported")}i(wf,"tokensToObject");function gg(e,t){if(!(e instanceof Uint8Array))throw new Error(`${Ct} data to decode must be a Uint8Array`);t=Object.assign({},SN,t);let r=t.tokenizer||new dp(e,t),n=wf(r,t);if(n===yf)throw new Error(`${Ct} did not find any content to decode`);if(n===hp)throw new Error(`${Ct} got unexpected break`);if(!r.done())throw new Error(`${Ct} too many terminals, data makes no sense`);return n}i(gg,"decode");var M9=42;function CN(e){if(e.asCID!==e)return null;let t=Ut.asCID(e);if(!t)return null;let r=new Uint8Array(t.bytes.byteLength+1);return r.set(t.bytes,1),[new Xe(Oe.tag,M9),new Xe(Oe.bytes,r)]}i(CN,"cidEncoder");function IN(){throw new Error("`undefined` is not supported by the IPLD Data Model and cannot be encoded")}i(IN,"undefinedEncoder");function kN(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(kN,"numberEncoder");var DN={float64:!0,typeEncoders:{Object:CN,undefined:IN,number:kN}};function ON(e){if(e[0]!==0)throw new Error("Invalid CID for CBOR tag 42; expected leading 0x00");return Ut.decode(e.subarray(1))}i(ON,"cidDecoder");var C9={allowIndefinite:!1,coerceUndefinedToNull:!0,allowNaN:!1,allowInfinity:!1,allowBigInt:!0,strict:!0,useMaps:!1,tags:[]};C9.tags[M9]=ON;var RN="dag-cbor",NN=113,bg=i(e=>vg(e,DN),"encode"),PN=i(e=>gg(e,C9),"decode");function fu(e){try{return e()}catch(t){return t}}i(fu,"tryCatch");var yg=Uo(Qh(),1);function qo(e){let t=yg.default.decode(e),r=yg.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(qo,"readVarint");function BN(e){return e===0||e===1}i(BN,"isCidVersion");function wg(e){let[t,r]=qo(e);if(!BN(t))throw new Error(`Unknown CID version ${t}`);let[n,s]=qo(r),[,o,c]=qo(s),[f,,h]=qo(o),p=s.subarray(0,c+h+f),v=s.subarray(c+h+f);return[Ut.create(t,n,Vh(p)),v]}i(wg,"readCid");function Ko(e,t="StreamRef"){let[r,n]=qo(e);if(r!==206)throw new Error(`Invalid ${t}, does not include streamid codec`);let[s,o]=qo(n),c=wg(o),[f,h]=c;if(h.length===0)return{kind:"stream-id",type:s,genesis:f};if(h.length===1&&h[0]===0)return{kind:"commit-id",type:s,genesis:f,commit:null};{let[p]=wg(h);return{kind:"commit-id",type:s,genesis:f,commit:p}}}i(Ko,"fromBytes");var LN=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function du(e,t="StreamRef"){let r=LN.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let s=Yi.decode(n),o=Ko(s),c=r[4];return c?{kind:"commit-id",type:o.type,genesis:o.genesis,commit:_g(o.genesis,c)}:o}i(du,"fromString");function FN(e){try{return typeof e=="string"?Ut.parse(e):Ut.asCID(e)}catch{return null}}i(FN,"parseCID");function _g(e,t=null){if(!t||t==="0")return null;let r=FN(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(_g,"parseCommit");var _f=function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},Pi=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},mp=class extends Error{constructor(t){super(`Invalid StreamID bytes ${Yi.encode(t)}: contains commit`)}};i(mp,"InvalidStreamIDBytesError");var vp=class extends Error{constructor(t){super(`Invalid StreamID string ${t}: contains commit`)}};i(vp,"InvalidStreamIDStringError");function D9(e){let t=Ko(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new mp(e)}i(D9,"fromBytes");function UN(e){return fu(()=>D9(e))}i(UN,"fromBytesNoThrow");function O9(e){let t=du(e,"StreamID");if(t.kind==="stream-id")return new Yt(t.type,t.genesis);throw new vp(e)}i(O9,"fromString");function $N(e){return fu(()=>O9(e))}i($N,"fromStringNoThrow");var k9=Symbol.for("@ceramicnetwork/streamid/StreamID"),Yt=class{constructor(t,r){if(this._tag=k9,!(t||t===0))throw new Error("StreamID constructor: type required");if(!r)throw new Error("StreamID constructor: cid required");this._type=typeof t=="string"?Xi.codeByName(t):t,this._cid=typeof r=="string"?Ut.parse(r):r}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===k9}static async fromGenesis(t,r){let n=await E8({value:r,codec:pp,hasher:Qv});return new Yt(t,n.cid)}get type(){return this._type}get typeName(){return Xi.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let t=Ag.default.encode(206),r=Ag.default.encode(this.type);return mf([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 Yi.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=D9;Yt.fromBytesNoThrow=UN;Yt.fromString=O9;Yt.fromStringNoThrow=$N;_f([si(),Pi("design:type",String),Pi("design:paramtypes",[])],Yt.prototype,"typeName",null);_f([si(),Pi("design:type",Uint8Array),Pi("design:paramtypes",[])],Yt.prototype,"bytes",null);_f([si(),Pi("design:type",Yt),Pi("design:paramtypes",[])],Yt.prototype,"baseID",null);_f([si(),Pi("design:type",Function),Pi("design:paramtypes",[]),Pi("design:returntype",String)],Yt.prototype,"toString",null);_f([si(),Pi("design:type",Function),Pi("design:paramtypes",[]),Pi("design:returntype",String)],Yt.prototype,"toUrl",null);var pu=function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},qn=function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},Sg=function(e,t,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(e,r):s?s.value=r:t.set(e,r),r},oa=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)},hu,Vo,Ef,gp=class extends Error{constructor(t){super(`Error while parsing CommitID from bytes ${Yi.encode(t)}: no commit information provided`)}};i(gp,"InvalidCommitIDBytesError");var bp=class extends Error{constructor(t){super(`Error while parsing CommitID from string ${t}: no commit information provided`)}};i(bp,"InvalidCommitIDStringError");function N9(e){let t=Ko(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new gp(e)}i(N9,"fromBytes");function jN(e){return fu(()=>N9(e))}i(jN,"fromBytesNoThrow");function P9(e){let t=du(e,"CommitID");if(t.kind==="commit-id")return new hr(t.type,t.genesis,t.commit);throw new bp(e)}i(P9,"fromString");function zN(e){return fu(()=>P9(e))}i(zN,"fromStringNoThrow");var R9=Symbol.for("@ceramicnetwork/streamid/CommitID");function HN(e,t){return new hr(e.type,e.cid,t)}i(HN,"make");var hr=class{constructor(t,r,n=null){if(this._tag=R9,hu.set(this,void 0),Vo.set(this,void 0),Ef.set(this,void 0),!t&&t!==0)throw new Error("constructor: type required");if(!r)throw new Error("constructor: cid required");Sg(this,hu,typeof t=="string"?Xi.codeByName(t):t,"f"),Sg(this,Vo,typeof r=="string"?Ut.parse(r):r,"f"),Sg(this,Ef,_g(oa(this,Vo,"f"),n),"f")}static isInstance(t){return typeof t=="object"&&"_tag"in t&&t._tag===R9}get baseID(){return new Yt(oa(this,hu,"f"),oa(this,Vo,"f"))}get type(){return oa(this,hu,"f")}get typeName(){return Xi.nameByCode(oa(this,hu,"f"))}get cid(){return oa(this,Vo,"f")}get commit(){return oa(this,Ef,"f")||oa(this,Vo,"f")}get bytes(){let t=xg.default.encode(206),r=xg.default.encode(this.type),n=oa(this,Ef,"f")?.bytes||new Uint8Array([0]);return mf([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 Yi.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(hu=new WeakMap,Vo=new WeakMap,Ef=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}};i(hr,"CommitID");hr.fromBytes=N9;hr.fromBytesNoThrow=jN;hr.fromString=P9;hr.fromStringNoThrow=zN;hr.make=HN;pu([si(),qn("design:type",Yt),qn("design:paramtypes",[])],hr.prototype,"baseID",null);pu([si(),qn("design:type",String),qn("design:paramtypes",[])],hr.prototype,"typeName",null);pu([si(),qn("design:type",Ut),qn("design:paramtypes",[])],hr.prototype,"commit",null);pu([si(),qn("design:type",Uint8Array),qn("design:paramtypes",[])],hr.prototype,"bytes",null);pu([si(),qn("design:type",Function),qn("design:paramtypes",[]),qn("design:returntype",String)],hr.prototype,"toString",null);pu([si(),qn("design:type",Function),qn("design:paramtypes",[]),qn("design:returntype",String)],hr.prototype,"toUrl",null);var Go;(function(e){function t(s){let o=Ko(s);switch(o.kind){case"commit-id":return new hr(o.type,o.genesis,o.commit);case"stream-id":return new Yt(o.type,o.genesis);default:throw new Error(`Malformed StreamRef bytes: ${Yi.encode(s)}`)}}i(t,"fromBytes"),e.fromBytes=t;function r(s){let o=du(s);switch(o.kind){case"commit-id":return new hr(o.type,o.genesis,o.commit);case"stream-id":return new Yt(o.type,o.genesis);default:throw new Error(`Malformed StreamRef string: ${s}`)}}i(r,"fromString"),e.fromString=r;function n(s){if(Yt.isInstance(s)||hr.isInstance(s))return s;if(s instanceof Uint8Array)return t(s);if(typeof s=="string")return r(s);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(s)}`)}i(n,"from"),e.from=n})(Go||(Go={}));var B9="ceramic://k3y52l7qbv1fry1fp4s0nwdarh0vahusarpposgevy0pemiykymd2ord6swtharcw",yp="ceramic://k3y52l7qbv1fryjn62sggjh1lpn11c56qfofzmty190d62hwk1cal1c7qc5he54ow";var Tg={};wn(Tg,{JsonPatchError:()=>Pr,_areEquals:()=>xf,applyOperation:()=>Wo,applyPatch:()=>Tp,applyReducer:()=>WN,deepClone:()=>VN,getValueByPointer:()=>Sp,validate:()=>F9,validator:()=>xp});var qN=function(){var e=i(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var o in s)s.hasOwnProperty(o)&&(n[o]=s[o])},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)}}(),KN=Object.prototype.hasOwnProperty;function _p(e,t){return KN.call(e,t)}i(_p,"hasOwnProperty");function Ep(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 s in e)_p(e,s)&&n.push(s);return n}i(Ep,"_objectKeys");function on(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(on,"_deepClone");function Ap(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(Ap,"isInteger");function Is(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(Is,"escapePathComponent");function Af(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i(Af,"unescapePathComponent");function wp(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(wp(e[t]))return!0}else if(typeof e=="object"){for(var n=Ep(e),s=n.length,o=0;o<s;o++)if(wp(e[n[o]]))return!0}}return!1}i(wp,"hasUndefined");function L9(e,t){var r=[e];for(var n in t){var s=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof s<"u"&&r.push(n+": "+s)}return r.join(`
22
22
  `)}i(L9,"patchErrorMessageFormatter");var Sf=function(e){qN(t,e);function t(r,n,s,o,c){var f=this.constructor,h=e.call(this,L9(r,{name:n,index:s,operation:o,tree:c}))||this;return h.name=n,h.index=s,h.operation=o,h.tree=c,Object.setPrototypeOf(h,f.prototype),h.message=L9(r,{name:n,index:s,operation:o,tree:c}),h}return i(t,"PatchError"),t}(Error);var Pr=Sf,VN=on,mu={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=Sp(r,this.path);n&&(n=on(n));var s=Wo(r,{op:"remove",path:this.from}).removed;return Wo(r,{op:"add",path:this.path,value:s}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=Sp(r,this.from);return Wo(r,{op:"add",path:this.path,value:on(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:xf(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},GN={add:function(e,t,r){return Ap(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:mu.move,copy:mu.copy,test:mu.test,_get:mu._get};function Sp(e,t){if(t=="")return e;var r={op:"_get",path:t};return Wo(e,r),r.value}i(Sp,"getValueByPointer");function Wo(e,t,r,n,s,o){if(r===void 0&&(r=!1),n===void 0&&(n=!0),s===void 0&&(s=!0),o===void 0&&(o=0),r&&(typeof r=="function"?r(t,0,e,t.path):xp(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=Sp(e,t.from),t.op==="move"&&(c.removed=e),c;if(t.op==="test"){if(c.test=xf(e,t.value),c.test===!1)throw new Pr("Test operation failed","TEST_OPERATION_FAILED",o,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 Pr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return c}}else{n||(e=on(e));var f=t.path||"",h=f.split("/"),p=e,v=1,y=h.length,b=void 0,_=void 0,T=void 0;for(typeof r=="function"?T=r:T=xp;;){if(_=h[v],_&&_.indexOf("~")!=-1&&(_=Af(_)),s&&(_=="__proto__"||_=="prototype"&&v>0&&h[v-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&&b===void 0&&(p[_]===void 0?b=h.slice(0,v).join("/"):v==y-1&&(b=t.path),b!==void 0&&T(t,0,e,b)),v++,Array.isArray(p)){if(_==="-")_=p.length;else{if(r&&!Ap(_))throw new Pr("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",o,t,e);Ap(_)&&(_=~~_)}if(v>=y){if(r&&t.op==="add"&&_>p.length)throw new Pr("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);var c=GN[t.op].call(t,p,_,e);if(c.test===!1)throw new Pr("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return c}}else if(v>=y){var c=mu[t.op].call(t,p,_,e);if(c.test===!1)throw new Pr("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return c}if(p=p[_],r&&v<y&&(!p||typeof p!="object"))throw new Pr("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}}i(Wo,"applyOperation");function Tp(e,t,r,n,s){if(n===void 0&&(n=!0),s===void 0&&(s=!0),r&&!Array.isArray(t))throw new Pr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=on(e));for(var o=new Array(t.length),c=0,f=t.length;c<f;c++)o[c]=Wo(e,t[c],r,!0,s,c),e=o[c].newDocument;return o.newDocument=e,o}i(Tp,"applyPatch");function WN(e,t,r){var n=Wo(e,t);if(n.test===!1)throw new Pr("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}i(WN,"applyReducer");function xp(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Pr("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(mu[e.op]){if(typeof e.path!="string")throw new Pr("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Pr('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 Pr("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 Pr("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")&&wp(e.value))throw new Pr("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 s=e.path.split("/").length,o=n.split("/").length;if(s!==o+1&&s!==o)throw new Pr("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 Pr("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},f=F9([c],r);if(f&&f.name==="OPERATION_PATH_UNRESOLVABLE")throw new Pr("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Pr("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}i(xp,"validator");function F9(e,t,r){try{if(!Array.isArray(e))throw new Pr("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Tp(on(t),on(e),r||!0);else{r=r||xp;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(s){if(s instanceof Pr)return s;throw s}}i(F9,"validate");function xf(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),s,o,c;if(r&&n){if(o=e.length,o!=t.length)return!1;for(s=o;s--!==0;)if(!xf(e[s],t[s]))return!1;return!0}if(r!=n)return!1;var f=Object.keys(e);if(o=f.length,o!==Object.keys(t).length)return!1;for(s=o;s--!==0;)if(!t.hasOwnProperty(f[s]))return!1;for(s=o;s--!==0;)if(c=f[s],!xf(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i(xf,"_areEquals");var kg={};wn(kg,{compare:()=>rP,generate:()=>Mg,observe:()=>tP,unobserve:()=>eP});var Cg=new WeakMap,ZN=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror"),e}(),JN=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo"),e}();function YN(e){return Cg.get(e)}i(YN,"getMirror");function XN(e,t){return e.observers.get(t)}i(XN,"getObserverFromMirror");function QN(e,t){e.observers.delete(t.callback)}i(QN,"removeObserverFromMirror");function eP(e,t){t.unobserve()}i(eP,"unobserve");function tP(e,t){var r=[],n,s=YN(e);if(!s)s=new ZN(e),Cg.set(e,s);else{var o=XN(s,t);n=o&&o.observer}if(n)return n;if(n={},s.value=on(e),t){n.callback=t,n.next=null;var c=i(function(){Mg(n)},"dirtyCheck"),f=i(function(){clearTimeout(n.next),n.next=setTimeout(c)},"fastCheck");typeof window<"u"&&(window.addEventListener("mouseup",f),window.addEventListener("keyup",f),window.addEventListener("mousedown",f),window.addEventListener("keydown",f),window.addEventListener("change",f))}return n.patches=r,n.object=e,n.unobserve=function(){Mg(n),clearTimeout(n.next),QN(s,n),typeof window<"u"&&(window.removeEventListener("mouseup",f),window.removeEventListener("keyup",f),window.removeEventListener("mousedown",f),window.removeEventListener("keydown",f),window.removeEventListener("change",f))},s.observers.set(t,new JN(t,n)),n}i(tP,"observe");function Mg(e,t){t===void 0&&(t=!1);var r=Cg.get(e.object);Ig(r.value,e.object,e.patches,"",t),e.patches.length&&Tp(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(Mg,"generate");function Ig(e,t,r,n,s){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var o=Ep(t),c=Ep(e),f=!1,h=!1,p=c.length-1;p>=0;p--){var v=c[p],y=e[v];if(_p(t,v)&&!(t[v]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var b=t[v];typeof y=="object"&&y!=null&&typeof b=="object"&&b!=null&&Array.isArray(y)===Array.isArray(b)?Ig(y,b,r,n+"/"+Is(v),s):y!==b&&(f=!0,s&&r.push({op:"test",path:n+"/"+Is(v),value:on(y)}),r.push({op:"replace",path:n+"/"+Is(v),value:on(b)}))}else Array.isArray(e)===Array.isArray(t)?(s&&r.push({op:"test",path:n+"/"+Is(v),value:on(y)}),r.push({op:"remove",path:n+"/"+Is(v)}),h=!0):(s&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),f=!0)}if(!(!h&&o.length==c.length))for(var p=0;p<o.length;p++){var v=o[p];!_p(e,v)&&t[v]!==void 0&&r.push({op:"add",path:n+"/"+Is(v),value:on(t[v])})}}}i(Ig,"_generate");function rP(e,t,r){r===void 0&&(r=!1);var n=[];return Ig(e,t,n,"",r),n}i(rP,"compare");var U9=Object.assign({},Tg,kg,{JsonPatchError:Sf,deepClone:on,escapePathComponent:Is,unescapePathComponent:Af});var a7=Uo(Kg(),1);var o7=Uo(zE(),1);var Xo;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(Xo||(Xo={}));var ub=Uo(Kg(),1);var Qg=i(function(e,t){return Qg=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},Qg(e,t)},"extendStatics");function eb(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");Qg(e,t);function r(){this.constructor=e}i(r,"__"),e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}i(eb,"__extends");function tb(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(tb,"__values");function wu(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,o=[],c;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(f){c={error:f}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return o}i(wu,"__read");function _u(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,o;n<s;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}i(_u,"__spreadArray");function Bi(e){return typeof e=="function"}i(Bi,"isFunction");function HE(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(HE,"createErrorClass");var Hp=HE(function(e){return i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
23
23
  `+r.map(function(n,s){return s+1+") "+n.toString()}).join(`
24
- `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function rb(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(rb,"arrRemove");var qp=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,s,o;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var f=tb(c),h=f.next();!h.done;h=f.next()){var p=h.value;p.remove(this)}}catch(O){t={error:O}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}else c.remove(this);var v=this.initialTeardown;if(Bi(v))try{v()}catch(O){o=O instanceof Hp?O.errors:[O]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=tb(y),_=b.next();!_.done;_=b.next()){var T=_.value;try{qE(T)}catch(O){o=o??[],O instanceof Hp?o=_u(_u([],wu(o)),wu(O.errors)):o.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(s=b.return)&&s.call(b)}finally{if(n)throw n.error}}}if(o)throw new Hp(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)qE(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)&&rb(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&rb(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var kW=qp.EMPTY;function Kp(e){return e instanceof qp||e&&"closed"in e&&Bi(e.remove)&&Bi(e.add)&&Bi(e.unsubscribe)}i(Kp,"isSubscription");function qE(e){Bi(e)?e():e.unsubscribe()}i(qE,"execFinalizer");var ts={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Eu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var s=Eu.delegate;return s?.setTimeout?s.setTimeout.apply(s,_u([e,t],wu(r))):setTimeout.apply(void 0,_u([e,t],wu(r)))},clearTimeout:function(e){var t=Eu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function KE(e){Eu.setTimeout(function(){var t=ts.onUnhandledError;if(t)t(e);else throw e})}i(KE,"reportUnhandledError");function nb(){}i(nb,"noop");var VE=function(){return ib("C",void 0,void 0)}();function GE(e){return ib("E",void 0,e)}i(GE,"errorNotification");function WE(e){return ib("N",e,void 0)}i(WE,"nextNotification");function ib(e,t,r){return{kind:e,value:t,error:r}}i(ib,"createNotification");var Qo=null;function ZE(e){if(ts.useDeprecatedSynchronousErrorHandling){var t=!Qo;if(t&&(Qo={errorThrown:!1,error:null}),e(),t){var r=Qo,n=r.errorThrown,s=r.error;if(Qo=null,n)throw s}}else e()}i(ZE,"errorContext");function JE(e){ts.useDeprecatedSynchronousErrorHandling&&Qo&&(Qo.errorThrown=!0,Qo.error=e)}i(JE,"captureError");var ob=function(e){eb(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Kp(r)&&r.add(n)):n.destination=hL,n}return i(t,"Subscriber"),t.create=function(r,n,s){return new Gp(r,n,s)},t.prototype.next=function(r){this.isStopped?ab(WE(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?ab(GE(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?ab(VE,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}(qp);var lL=Function.prototype.bind;function sb(e,t){return lL.call(e,t)}i(sb,"bind");var fL=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){Vp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Vp(n)}else Vp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Vp(r)}},e}(),Gp=function(e){eb(t,e);function t(r,n,s){var o=e.call(this)||this,c;if(Bi(r)||!r)c={next:r??void 0,error:n??void 0,complete:s??void 0};else{var f;o&&ts.useDeprecatedNextContext?(f=Object.create(r),f.unsubscribe=function(){return o.unsubscribe()},c={next:r.next&&sb(r.next,f),error:r.error&&sb(r.error,f),complete:r.complete&&sb(r.complete,f)}):c=r}return o.destination=new fL(c),o}return i(t,"SafeSubscriber"),t}(ob);function Vp(e){ts.useDeprecatedSynchronousErrorHandling?JE(e):KE(e)}i(Vp,"handleUnhandledError");function dL(e){throw e}i(dL,"defaultErrorHandler");function ab(e,t){var r=ts.onStoppedNotification;r&&Eu.setTimeout(function(){return r(e,t)})}i(ab,"handleStoppedNotification");var hL={closed:!0,next:nb,error:dL,complete:nb};var YE=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function XE(e){return e}i(XE,"identity");function QE(e){return e.length===0?XE:e.length===1?e[0]:i(function(r){return e.reduce(function(n,s){return s(n)},r)},"piped")}i(QE,"pipeFromArray");var cb=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 s=this,o=mL(t)?t:new Gp(t,r,n);return ZE(function(){var c=s,f=c.operator,h=c.source;o.add(f?f.call(o,h):h?s._subscribe(o):s._trySubscribe(o))}),o},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=e7(r),new r(function(s,o){var c=new Gp({next:function(f){try{t(f)}catch(h){o(h),c.unsubscribe()}},error:o,complete:s});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[YE]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return QE(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=e7(t),new t(function(n,s){var o;r.subscribe(function(c){return o=c},function(c){return s(c)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function e7(e){var t;return(t=e??ts.Promise)!==null&&t!==void 0?t:Promise}i(e7,"getPromiseCtor");function pL(e){return e&&Bi(e.next)&&Bi(e.error)&&Bi(e.complete)}i(pL,"isObserver");function mL(e){return e&&e instanceof ob||pL(e)&&Kp(e)}i(mL,"isSubscriber");var t7;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(t7||(t7={}));var r7;(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"})(r7||(r7={}));var lb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(lb||(lb={}));var If=class extends cb{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,ub.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===lb.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,ub.default)(this.state$.value)}async sync(t={}){t={sync:Xo.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(If,"Stream");function n7(){return e=>{}}i(n7,"StreamStatic");var vL=function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},fi,fb={anchor:!0,publish:!0,pin:!0,sync:Xo.PREFER_CACHE},gL={sync:Xo.PREFER_CACHE},i7={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function db(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=sg((0,o7.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(db,"headerFromMetadata");async function s7(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(s7,"getAuthenticatedDID");async function hb(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(hb,"throwReadOnlyError");var Ha=fi=i(class extends If{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,a7.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,s={}){s={...fb,...s},!n?.deterministic&&s.syncTimeoutSeconds==null&&(s.syncTimeoutSeconds=0);let o=s.asDID?{did:s.asDID}:t,c=await fi.makeGenesis(o,r,n);return t.createStreamFromGenesis(fi.STREAM_TYPE_ID,c,s)}static async createFromGenesis(t,r,n={}){n={...fb,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let s=r.data?await fi._signDagJWS(t,r):r;return t.createStreamFromGenesis(fi.STREAM_TYPE_ID,s,n)}static async deterministic(t,r,n={}){if(n={...fb,...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 s=await fi.makeGenesis(t,null,r);return t.createStreamFromGenesis(fi.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...gL,...n};let s=Go.from(r);if(s.type!=fi.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${fi.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return t.loadStream(s,n)}async update(t,r,n={}){n={...i7,...n};let s=n.asDID?{did:n.asDID}:this.api,o=await this.makeCommit(s,t,r),c=await this.api.applyCommit(this.id,o,n);this.state$.next(c.state)}async patch(t,r={}){r={...i7,...r};let s={header:db(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},o=await fi._signDagJWS(this.api,s),c=await this.api.applyCommit(this.id,o,r);this.state$.next(c.state)}makeReadOnly(){this.update=hb,this.patch=hb,this.sync=hb,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let s=await this._makeRawCommit(r,n);return fi._signDagJWS(t,s)}async _makeRawCommit(t,r){r||(r={});let n=db(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 s=U9.compare(this.content,t),o=this.state.log[0];return{header:n,data:s,prev:this.tip,id:o.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await s7(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 s=db(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:s};return bg(c),c}let o={data:r,header:s};return fi._signDagJWS(t,o)}static async _signDagJWS(t,r){return(await s7(t)).createDagJWS(r)}},"TileDocument");Ha.STREAM_TYPE_NAME="tile";Ha.STREAM_TYPE_ID=0;Ha=fi=vL([n7()],Ha);var p7=Uo(l7(),1);function ML(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(ML,"_checkPrivateRedeclaration");function CL(e,t){return t.get?t.get.call(e):t.value}i(CL,"_classApplyDescriptorGet");function IL(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(IL,"_classApplyDescriptorSet");function h7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(h7,"_classExtractFieldDescriptor");function gb(e,t){var r=h7(e,t,"get");return CL(e,r)}i(gb,"_classPrivateFieldGet");function f7(e,t,r){ML(e,t),t.set(e,r)}i(f7,"_classPrivateFieldInit");function d7(e,t,r){var n=h7(e,t,"set");return IL(e,n,r),r}i(d7,"_classPrivateFieldSet");function kL(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(kL,"keyToQuery");function bb(e){return typeof e=="string"?Go.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(bb,"keyToString");async function wb(e){let t=await Ha.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(wb,"getDeterministicQuery");var DL=i(()=>Promise.resolve([]),"tempBatchLoadFn"),Wp=new WeakMap,yb=new WeakMap,ec=class extends p7.default{cache(t){if(!gb(this,yb))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let s=await Ha.create(gb(this,Wp),t,r,n);return this.cache(s),s}async deterministic(t,r){let n=await wb(t);try{return await super.load(n)}catch{let o=await Ha.createFromGenesis(gb(this,Wp),n.genesis,r);return this.cache(o),o}}async load(t){return await super.load(t)}async update(t,r,n,s){let o=bb(t);this.clear(o);let c=await this.load({streamId:o});return await c.update(r,n,s),c}constructor(t){super(DL,{cache:!0,cacheKeyFn:bb,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),f7(this,Wp,{writable:!0,value:void 0}),f7(this,yb,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(kL),t.multiqueryTimeout);return r.map(s=>{let o=bb(s),c=n[o];return c||new Error(`Failed to load stream: ${o}`)})},d7(this,Wp,t.ceramic),d7(this,yb,!!t.cache)}};i(ec,"TileLoader");function OL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(OL,"_checkPrivateRedeclaration");function RL(e,t){return t.get?t.get.call(e):t.value}i(RL,"_classApplyDescriptorGet");function NL(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(NL,"_classApplyDescriptorSet");function v7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(v7,"_classExtractFieldDescriptor");function tc(e,t){var r=v7(e,t,"get");return RL(e,r)}i(tc,"_classPrivateFieldGet");function m7(e,t,r){OL(e,t),t.set(e,r)}i(m7,"_classPrivateFieldInit");function _b(e,t,r){var n=v7(e,t,"set");return NL(e,n,r),r}i(_b,"_classPrivateFieldSet");var Au=new WeakMap,Su=new WeakMap,xu=class{get aliases(){return tc(this,Au)}get loader(){return tc(this,Su)}getDefinitionID(t){return tc(this,Au).definitions[t]??null}getSchemaURL(t){return tc(this,Au).schemas[t]??null}getTileID(t){return tc(this,Au).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 tc(this,Su).load(r)}async createTile(t,r,n={}){let s=this.getSchemaURL(t);if(s==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:o,...c}=n,f={schema:s};return o!=null&&(f.controllers=[o]),await tc(this,Su).create(r,f,c)}constructor(t){if(m7(this,Au,{writable:!0,value:void 0}),m7(this,Su,{writable:!0,value:void 0}),_b(this,Au,t.aliases),t.loader!=null)_b(this,Su,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");_b(this,Su,new ec({ceramic:t.ceramic,cache:t.cache}))}}};i(xu,"DataModel");function PL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(PL,"_checkPrivateRedeclaration");function BL(e,t){return t.get?t.get.call(e):t.value}i(BL,"_classApplyDescriptorGet");function LL(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(LL,"_classApplyDescriptorSet");function g7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(g7,"_classExtractFieldDescriptor");function ks(e,t){var r=g7(e,t,"get");return BL(e,r)}i(ks,"_classPrivateFieldGet");function Zp(e,t,r){PL(e,t),t.set(e,r)}i(Zp,"_classPrivateFieldInit");function Jp(e,t,r){var n=g7(e,t,"set");return LL(e,n,r),r}i(Jp,"_classPrivateFieldSet");var Yp=new WeakMap,rc=new WeakMap,Eb=new WeakMap,Xp=new WeakMap,kf=class{_createValuePromise(){Jp(this,Eb,new Promise((t,r)=>{Jp(this,Xp,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let s=i(async o=>{try{let c=await t(o);r(),this._next(c)}catch(c){n(c),this._next(o)}},"run");ks(this,rc).push({reject:n,run:s}),ks(this,rc).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 ks(this,rc).length===0?await ks(this,Yp).call(this):await ks(this,Eb)}async _start(){try{let t=await ks(this,Yp).call(this);this._next(t)}catch(t){ks(this,rc).forEach(r=>{r.reject(t)}),Jp(this,rc,[]),ks(this,Xp).reject(t),this._createValuePromise()}}_next(t){let r=ks(this,rc).shift();r==null?this._end(t):r.run(t)}_end(t){ks(this,Xp).resolve(t),this._createValuePromise()}constructor(t){Zp(this,Yp,{writable:!0,value:void 0}),Zp(this,rc,{writable:!0,value:[]}),Zp(this,Eb,{writable:!0,value:void 0}),Zp(this,Xp,{writable:!0,value:void 0}),Jp(this,Yp,t),this._createValuePromise()}};i(kf,"TileProxy");var FL=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function UL(e){return FL.test(e)}i(UL,"isDIDstring");function $L(e){if(!UL(e))throw new Error(`Invalid DID: ${e}`)}i($L,"assertDIDstring");function Ab(e){return $L(e),{controllers:[e],family:"IDX"}}i(Ab,"getIDXMetadata");function jL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(jL,"_checkPrivateRedeclaration");function zL(e,t){return t.get?t.get.call(e):t.value}i(zL,"_classApplyDescriptorGet");function HL(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(HL,"_classApplyDescriptorSet");function b7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(b7,"_classExtractFieldDescriptor");function Ur(e,t){var r=b7(e,t,"get");return zL(e,r)}i(Ur,"_classPrivateFieldGet");function Df(e,t,r){jL(e,t),t.set(e,r)}i(Df,"_classPrivateFieldInit");function Qp(e,t,r){var n=b7(e,t,"set");return HL(e,n,r),r}i(Qp,"_classPrivateFieldSet");var la=new WeakMap,e0=new WeakMap,Sb=new WeakMap,Ds=new WeakMap,t0=new WeakMap,Of=class{get authenticated(){return Ur(this,la).did!=null}get ceramic(){return Ur(this,la)}get id(){if(Ur(this,e0)!=null)return Ur(this,e0);if(Ur(this,la).did==null)throw new Error("Ceramic instance is not authenticated");return Ur(this,la).did.hasParent?Ur(this,la).did.parent:Ur(this,la).did.id}get loader(){return Ur(this,Ds)}get model(){return Ur(this,t0)}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),s=await Promise.all(r.map(async f=>{let{genesis:h,streamId:p}=await wb(Ab(f));return{genesis:h,streamId:p.toString(),paths:[n]}})),o=await Ur(this,la).multiQuery(s),c=[];for(let f of s){let h=o[f.streamId]?.content?.[n],p=h?o[Yt.fromString(h).toString()]:null;c.push(p?.content??null)}return c}async set(t,r,n={}){let s=this.getDefinitionID(t),[o,c]=await this._setRecordOnly(s,r,n);return o&&await this._setReference(n.controller??this.id,s,c),c}async merge(t,r,n={}){let s=this.getDefinitionID(t),o=await this.getRecord(s),c=o?{...o,...r}:r;return await this.setRecord(s,c,n)}async setAll(t,r={}){let n=Object.entries(t).map(async([c,f])=>{let h=this.getDefinitionID(c),[p,v]=await this._setRecordOnly(h,f,r);return[p,h,v]}),o=(await Promise.all(n)).reduce((c,[f,h,p])=>(f&&(c[h]=p.toUrl()),c),{});return await this._setReferences(r.controller??this.id,o),o}async setDefaults(t,r={}){let n=await this.getIndex()??{},s=Object.entries(t).map(([f,h])=>[this.getDefinitionID(f),h]).filter(f=>n[f[0]]==null).map(async([f,h])=>{let p=await this.getDefinition(f),v=await this._createRecord(p,h,r);return{[f]:v.toUrl()}}),c=(await Promise.all(s)).reduce((f,h)=>Object.assign(f,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 f=await this.getIndex(t);r=Object.entries(f??{})}if(n===r.length)return{done:!0,value:null};let[s,o]=r[n++],c=await Ur(this,Ds).load(o);return{done:!1,value:{key:s,id:o,record:c.content}}}}}async _createIDXDoc(t){return await Ur(this,Ds).deterministic(Ab(t))}async _getIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)return null;if(r.metadata.schema!==yp)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:yp});else if(r.metadata.schema!==yp)throw new Error("Invalid document: schema is not IdentityIndex");return r}_getIndexProxy(t){let r=Ur(this,Sb)[t];return r==null&&(r=new kf(async()=>await this._getOwnIDXDoc(t)),Ur(this,Sb)[t]=r),r}getDefinitionID(t){return Ur(this,t0).getDefinitionID(t)??t}async getDefinition(t){let r=await Ur(this,Ds).load(t);if(r.metadata.schema!==B9)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 Ur(this,Ds).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[s,o]=await this._setRecordOnly(t,r,n);return s&&await this._setReference(n.controller??this.id,t,o),o}async _setRecordOnly(t,r,n){let s=await this.getRecordID(t,n.controller??this.id);if(s==null){let o=await this.getDefinition(t),c=await this._createRecord(o,r,n);return[!0,c]}else{let o=await Ur(this,Ds).update(s,r);return[!1,o.id]}}async _createRecord(t,r,{controller:n,pin:s}){let o=await Ur(this,Ds).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:s});return await o.update(r,{schema:t.schema}),o.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(s=>({...s,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Df(this,la,{writable:!0,value:void 0}),Df(this,e0,{writable:!0,value:void 0}),Df(this,Sb,{writable:!0,value:{}}),Df(this,Ds,{writable:!0,value:void 0}),Df(this,t0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:s,loader:o,model:c}=t;Qp(this,la,n),Qp(this,e0,s),Qp(this,Ds,o??new ec({ceramic:n,cache:r})),Qp(this,t0,c instanceof xu?c:new xu({loader:Ur(this,Ds),aliases:c}))}};i(Of,"DIDDataStore");var nr;(function(e){e.assertEqual=s=>s;function t(s){}i(t,"assertIs"),e.assertIs=t;function r(s){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=s=>{let o={};for(let c of s)o[c]=c;return o},e.getValidEnumValues=s=>{let o=e.objectKeys(s).filter(f=>typeof s[s[f]]!="number"),c={};for(let f of o)c[f]=s[f];return e.objectValues(c)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let c in s)Object.prototype.hasOwnProperty.call(s,c)&&o.push(c);return o},e.find=(s,o)=>{for(let c of s)if(o(c))return c},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(nr||(nr={}));var et=nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qa=i(e=>{switch(typeof e){case"undefined":return et.undefined;case"string":return et.string;case"number":return isNaN(e)?et.nan:et.number;case"boolean":return et.boolean;case"function":return et.function;case"bigint":return et.bigint;case"symbol":return et.symbol;case"object":return Array.isArray(e)?et.array:e===null?et.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?et.promise:typeof Map<"u"&&e instanceof Map?et.map:typeof Set<"u"&&e instanceof Set?et.set:typeof Date<"u"&&e instanceof Date?et.date:et.object;default:return et.unknown}},"getParsedType"),Ke=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"]),qL=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Li=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(o){return o.message},n={_errors:[]},s=i(o=>{for(let c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(s);else if(c.code==="invalid_return_type")s(c.returnTypeError);else if(c.code==="invalid_arguments")s(c.argumentsError);else if(c.path.length===0)n._errors.push(r(c));else{let f=n,h=0;for(;h<c.path.length;){let p=c.path[h];h===c.path.length-1?(f[p]=f[p]||{_errors:[]},f[p]._errors.push(r(c))):f[p]=f[p]||{_errors:[]},f=f[p],h++}}},"processError");return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,nr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i(Li,"ZodError");Li.create=e=>new Li(e);var Nf=i((e,t)=>{let r;switch(e.code){case Ke.invalid_type:e.received===et.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ke.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,nr.jsonStringifyReplacer)}`;break;case Ke.unrecognized_keys:r=`Unrecognized key(s) in object: ${nr.joinValues(e.keys,", ")}`;break;case Ke.invalid_union:r="Invalid input";break;case Ke.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nr.joinValues(e.options)}`;break;case Ke.invalid_enum_value:r=`Invalid enum value. Expected ${nr.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}"`:nr.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,nr.assertNever(e)}return{message:r}},"errorMap"),E7=Nf;function KL(e){E7=e}i(KL,"setErrorMap");function n0(){return E7}i(n0,"getErrorMap");var i0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],c={...s,path:o},f="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)f=p(c,{data:t,defaultError:f}).message;return{...s,path:o,message:s.message||f}},"makeIssue"),VL=[];function gt(e,t){let r=i0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n0(),Nf].filter(n=>!!n)});e.common.issues.push(r)}i(gt,"addIssueToContext");var Xr=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 s of r){if(s.status==="aborted")return kt;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let s of r)n.push({key:await s.key,value:await s.value});return Xr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let s of r){let{key:o,value:c}=s;if(o.status==="aborted"||c.status==="aborted")return kt;o.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),(typeof c.value<"u"||s.alwaysSet)&&(n[o.value]=c.value)}return{status:t.value,value:n}}};i(Xr,"ParseStatus");var kt=Object.freeze({status:"aborted"}),A7=i(e=>({status:"dirty",value:e}),"DIRTY"),En=i(e=>({status:"valid",value:e}),"OK"),xb=i(e=>e.status==="aborted","isAborted"),Tb=i(e=>e.status==="dirty","isDirty"),s0=i(e=>e.status==="valid","isValid"),a0=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 di=class{constructor(t,r,n,s){this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._path.concat(this._key)}};i(di,"ParseInputLazyPath");var y7=i((e,t)=>{if(s0(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Li(e.common.issues);return{success:!1,error:r}}},"handleResult");function Kt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:s}=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:s}:{errorMap:i((c,f)=>c.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:n??f.defaultError}:{message:r??f.defaultError},"customMap"),description:s}}i(Kt,"processCreateParams");var Pt=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 qa(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:qa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xr,ctx:{common:t.parent.common,data:t.data,parsedType:qa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(a0(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 s={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:qa(t)},o=this._parseSync({data:t,path:s.path,parent:s});return y7(s,o)}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:qa(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(a0(s)?s:Promise.resolve(s));return y7(n,o)}refine(t,r){let n=i(s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r,"getIssueProperties");return this._refinement((s,o)=>{let c=t(s),f=i(()=>o.addIssue({code:Ke.custom,...n(s)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(h=>h?!0:(f(),!1)):c?!0:(f(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new Vn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return pi.create(this)}nullable(){return Ps.create(this)}nullish(){return this.optional().nullable()}array(){return Kn.create(this)}promise(){return ha.create(this)}or(t){return Za.create([this,t])}and(t){return Ja.create(this,t)}transform(t){return new Vn({schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new ro({innerType:this,defaultValue:r,typeName:xt.ZodDefault})}brand(){return new Rf({typeName:xt.ZodBranded,type:this,...Kt(void 0)})}catch(t){let r=typeof t=="function"?t:()=>t;return new oc({innerType:this,defaultValue:r,typeName:xt.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return no.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i(Pt,"ZodType");var GL=/^c[^\s-]{8,}$/i,WL=/^([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,ZL=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,JL=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"),Fi=class extends Pt{constructor(){super(...arguments),this._regex=(t,r,n)=>this.refinement(s=>t.test(s),{validation:r,code:Ke.invalid_string,...Wt.errToObj(n)}),this.nonempty=t=>this.min(1,Wt.errToObj(t)),this.trim=()=>new Fi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==et.string){let o=this._getOrReturnCtx(t);return gt(o,{code:Ke.invalid_type,expected:et.string,received:o.parsedType}),kt}let n=new Xr,s;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let c=t.data.length>o.value,f=t.data.length<o.value;(c||f)&&(s=this._getOrReturnCtx(t,s),c?gt(s,{code:Ke.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):f&&gt(s,{code:Ke.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")ZL.test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{validation:"email",code:Ke.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")WL.test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{validation:"uuid",code:Ke.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")GL.test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{validation:"cuid",code:Ke.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),gt(s,{validation:"url",code:Ke.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{validation:"regex",code:Ke.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?JL(o).test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.invalid_string,validation:"datetime",message:o.message}),n.dirty()):nr.assertNever(o);return{status:n.value,value:t.data}}_addCheck(t){return new Fi({...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(Fi,"ZodString");Fi.create=e=>{var t;return new Fi({checks:[],typeName:xt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Kt(e)})};function YL(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),c=parseInt(t.toFixed(s).replace(".",""));return o%c/Math.pow(10,s)}i(YL,"floatSafeRemainder");var rs=class extends Pt{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)!==et.number){let o=this._getOrReturnCtx(t);return gt(o,{code:Ke.invalid_type,expected:et.number,received:o.parsedType}),kt}let n,s=new Xr;for(let o of this._def.checks)o.kind==="int"?nr.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?YL(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.not_finite,message:o.message}),s.dirty()):nr.assertNever(o);return{status:s.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,s){return new rs({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Wt.toString(s)}]})}_addCheck(t){return new rs({...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(rs,"ZodNumber");rs.create=e=>new rs({checks:[],typeName:xt.ZodNumber,coerce:e?.coerce||!1,...Kt(e)});var Ka=class extends Pt{_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==et.bigint){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.bigint,received:n.parsedType}),kt}return En(t.data)}};i(Ka,"ZodBigInt");Ka.create=e=>{var t;return new Ka({typeName:xt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Kt(e)})};var Va=class extends Pt{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==et.boolean){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.boolean,received:n.parsedType}),kt}return En(t.data)}};i(Va,"ZodBoolean");Va.create=e=>new Va({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Kt(e)});var Os=class extends Pt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==et.date){let o=this._getOrReturnCtx(t);return gt(o,{code:Ke.invalid_type,expected:et.date,received:o.parsedType}),kt}if(isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return gt(o,{code:Ke.invalid_date}),kt}let n=new Xr,s;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):nr.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Os({...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(Os,"ZodDate");Os.create=e=>new Os({checks:[],coerce:e?.coerce||!1,typeName:xt.ZodDate,...Kt(e)});var nc=class extends Pt{_parse(t){if(this._getType(t)!==et.symbol){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.symbol,received:n.parsedType}),kt}return En(t.data)}};i(nc,"ZodSymbol");nc.create=e=>new nc({typeName:xt.ZodSymbol,...Kt(e)});var Ga=class extends Pt{_parse(t){if(this._getType(t)!==et.undefined){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.undefined,received:n.parsedType}),kt}return En(t.data)}};i(Ga,"ZodUndefined");Ga.create=e=>new Ga({typeName:xt.ZodUndefined,...Kt(e)});var Wa=class extends Pt{_parse(t){if(this._getType(t)!==et.null){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.null,received:n.parsedType}),kt}return En(t.data)}};i(Wa,"ZodNull");Wa.create=e=>new Wa({typeName:xt.ZodNull,...Kt(e)});var fa=class extends Pt{constructor(){super(...arguments),this._any=!0}_parse(t){return En(t.data)}};i(fa,"ZodAny");fa.create=e=>new fa({typeName:xt.ZodAny,...Kt(e)});var Rs=class extends Pt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return En(t.data)}};i(Rs,"ZodUnknown");Rs.create=e=>new Rs({typeName:xt.ZodUnknown,...Kt(e)});var Ui=class extends Pt{_parse(t){let r=this._getOrReturnCtx(t);return gt(r,{code:Ke.invalid_type,expected:et.never,received:r.parsedType}),kt}};i(Ui,"ZodNever");Ui.create=e=>new Ui({typeName:xt.ZodNever,...Kt(e)});var ic=class extends Pt{_parse(t){if(this._getType(t)!==et.undefined){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.void,received:n.parsedType}),kt}return En(t.data)}};i(ic,"ZodVoid");ic.create=e=>new ic({typeName:xt.ZodVoid,...Kt(e)});var Kn=class extends Pt{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==et.array)return gt(r,{code:Ke.invalid_type,expected:et.array,received:r.parsedType}),kt;if(s.exactLength!==null){let c=r.data.length>s.exactLength.value,f=r.data.length<s.exactLength.value;(c||f)&&(gt(r,{code:c?Ke.too_big:Ke.too_small,minimum:f?s.exactLength.value:void 0,maximum:c?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(gt(r,{code:Ke.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(gt(r,{code:Ke.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((c,f)=>s.type._parseAsync(new di(r,c,r.path,f)))).then(c=>Xr.mergeArray(n,c));let o=r.data.map((c,f)=>s.type._parseSync(new di(r,c,r.path,f)));return Xr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new Kn({...this._def,minLength:{value:t,message:Wt.toString(r)}})}max(t,r){return new Kn({...this._def,maxLength:{value:t,message:Wt.toString(r)}})}length(t,r){return new Kn({...this._def,exactLength:{value:t,message:Wt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Kn,"ZodArray");Kn.create=(e,t)=>new Kn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,...Kt(t)});var o0;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(o0||(o0={}));var w7=i(e=>t=>new _r({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function Tu(e){if(e instanceof _r){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=pi.create(Tu(n))}return new _r({...e._def,shape:()=>t})}else return e instanceof Kn?Kn.create(Tu(e.element)):e instanceof pi?pi.create(Tu(e.unwrap())):e instanceof Ps?Ps.create(Tu(e.unwrap())):e instanceof hi?hi.create(e.items.map(t=>Tu(t))):e}i(Tu,"deepPartialify");var _r=class extends Pt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=w7(this._def),this.extend=w7(this._def)}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=nr.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==et.object){let p=this._getOrReturnCtx(t);return gt(p,{code:Ke.invalid_type,expected:et.object,received:p.parsedType}),kt}let{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:c}=this._getCached(),f=[];if(!(this._def.catchall instanceof Ui&&this._def.unknownKeys==="strip"))for(let p in s.data)c.includes(p)||f.push(p);let h=[];for(let p of c){let v=o[p],y=s.data[p];h.push({key:{status:"valid",value:p},value:v._parse(new di(s,y,s.path,p)),alwaysSet:p in s.data})}if(this._def.catchall instanceof Ui){let p=this._def.unknownKeys;if(p==="passthrough")for(let v of f)h.push({key:{status:"valid",value:v},value:{status:"valid",value:s.data[v]}});else if(p==="strict")f.length>0&&(gt(s,{code:Ke.unrecognized_keys,keys:f}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let v of f){let y=s.data[v];h.push({key:{status:"valid",value:v},value:p._parse(new di(s,y,s.path,v)),alwaysSet:v in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let p=[];for(let v of h){let y=await v.key;p.push({key:y,value:await v.value,alwaysSet:v.alwaysSet})}return p}).then(p=>Xr.mergeObjectSync(n,p)):Xr.mergeObjectSync(n,h)}get shape(){return this._def.shape()}strict(t){return Wt.errToObj,new _r({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,c,f;let h=(c=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&c!==void 0?c:n.defaultError;return r.code==="unrecognized_keys"?{message:(f=Wt.errToObj(t).message)!==null&&f!==void 0?f:h}:{message:h}}}:{}})}strip(){return new _r({...this._def,unknownKeys:"strip"})}passthrough(){return new _r({...this._def,unknownKeys:"passthrough"})}setKey(t,r){return this.augment({[t]:r})}merge(t){return new _r({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>o0.mergeShapes(this._def.shape(),t._def.shape()),typeName:xt.ZodObject})}catchall(t){return new _r({...this._def,catchall:t})}pick(t){let r={};return nr.objectKeys(t).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new _r({...this._def,shape:()=>r})}omit(t){let r={};return nr.objectKeys(this.shape).map(n=>{nr.objectKeys(t).indexOf(n)===-1&&(r[n]=this.shape[n])}),new _r({...this._def,shape:()=>r})}deepPartial(){return Tu(this)}partial(t){let r={};if(t)return nr.objectKeys(this.shape).map(n=>{nr.objectKeys(t).indexOf(n)===-1?r[n]=this.shape[n]:r[n]=this.shape[n].optional()}),new _r({...this._def,shape:()=>r});for(let n in this.shape){let s=this.shape[n];r[n]=s.optional()}return new _r({...this._def,shape:()=>r})}required(t){let r={};if(t)nr.objectKeys(this.shape).map(n=>{if(nr.objectKeys(t).indexOf(n)===-1)r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof pi;)o=o._def.innerType;r[n]=o}});else for(let n in this.shape){let o=this.shape[n];for(;o instanceof pi;)o=o._def.innerType;r[n]=o}return new _r({...this._def,shape:()=>r})}keyof(){return S7(nr.objectKeys(this.shape))}};i(_r,"ZodObject");_r.create=(e,t)=>new _r({shape:()=>e,unknownKeys:"strip",catchall:Ui.create(),typeName:xt.ZodObject,...Kt(t)});_r.strictCreate=(e,t)=>new _r({shape:()=>e,unknownKeys:"strict",catchall:Ui.create(),typeName:xt.ZodObject,...Kt(t)});_r.lazycreate=(e,t)=>new _r({shape:e,unknownKeys:"strip",catchall:Ui.create(),typeName:xt.ZodObject,...Kt(t)});var Za=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(let f of o)if(f.result.status==="valid")return f.result;for(let f of o)if(f.result.status==="dirty")return r.common.issues.push(...f.ctx.common.issues),f.result;let c=o.map(f=>new Li(f.ctx.common.issues));return gt(r,{code:Ke.invalid_union,unionErrors:c}),kt}if(i(s,"handleResults"),r.common.async)return Promise.all(n.map(async o=>{let c={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:c}),ctx:c}})).then(s);{let o,c=[];for(let h of n){let p={...r,common:{...r.common,issues:[]},parent:null},v=h._parseSync({data:r.data,path:r.path,parent:p});if(v.status==="valid")return v;v.status==="dirty"&&!o&&(o={result:v,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let f=c.map(h=>new Li(h));return gt(r,{code:Ke.invalid_union,unionErrors:f}),kt}}get options(){return this._def.options}};i(Za,"ZodUnion");Za.create=(e,t)=>new Za({options:e,typeName:xt.ZodUnion,...Kt(t)});var r0=i(e=>e instanceof Xa?r0(e.schema):e instanceof Vn?r0(e.innerType()):e instanceof Qa?[e.value]:e instanceof eo?e.options:e instanceof to?Object.keys(e.enum):e instanceof ro?r0(e._def.innerType):e instanceof Ga?[void 0]:e instanceof Wa?[null]:null,"getDiscriminator"),sc=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==et.object)return gt(r,{code:Ke.invalid_type,expected:et.object,received:r.parsedType}),kt;let n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(gt(r,{code:Ke.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),kt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let s=new Map;for(let o of r){let c=r0(o.shape[t]);if(!c)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let f of c){if(s.has(f))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(f)}`);s.set(f,o)}}return new sc({typeName:xt.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Kt(n)})}};i(sc,"ZodDiscriminatedUnion");function Mb(e,t){let r=qa(e),n=qa(t);if(e===t)return{valid:!0,data:e};if(r===et.object&&n===et.object){let s=nr.objectKeys(t),o=nr.objectKeys(e).filter(f=>s.indexOf(f)!==-1),c={...e,...t};for(let f of o){let h=Mb(e[f],t[f]);if(!h.valid)return{valid:!1};c[f]=h.data}return{valid:!0,data:c}}else if(r===et.array&&n===et.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let c=e[o],f=t[o],h=Mb(c,f);if(!h.valid)return{valid:!1};s.push(h.data)}return{valid:!0,data:s}}else return r===et.date&&n===et.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Mb,"mergeValues");var Ja=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),s=i((o,c)=>{if(xb(o)||xb(c))return kt;let f=Mb(o.value,c.value);return f.valid?((Tb(o)||Tb(c))&&r.dirty(),{status:r.value,value:f.data}):(gt(n,{code:Ke.invalid_intersection_types}),kt)},"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(([o,c])=>s(o,c)):s(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(Ja,"ZodIntersection");Ja.create=(e,t,r)=>new Ja({left:e,right:t,typeName:xt.ZodIntersection,...Kt(r)});var hi=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==et.array)return gt(n,{code:Ke.invalid_type,expected:et.array,received:n.parsedType}),kt;if(n.data.length<this._def.items.length)return gt(n,{code:Ke.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&n.data.length>this._def.items.length&&(gt(n,{code:Ke.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=n.data.map((c,f)=>{let h=this._def.items[f]||this._def.rest;return h?h._parse(new di(n,c,n.path,f)):null}).filter(c=>!!c);return n.common.async?Promise.all(o).then(c=>Xr.mergeArray(r,c)):Xr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new hi({...this._def,rest:t})}};i(hi,"ZodTuple");hi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hi({items:e,typeName:xt.ZodTuple,rest:null,...Kt(t)})};var Ya=class extends Pt{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!==et.object)return gt(n,{code:Ke.invalid_type,expected:et.object,received:n.parsedType}),kt;let s=[],o=this._def.keyType,c=this._def.valueType;for(let f in n.data)s.push({key:o._parse(new di(n,f,n.path,f)),value:c._parse(new di(n,n.data[f],n.path,f))});return n.common.async?Xr.mergeObjectAsync(r,s):Xr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Pt?new Ya({keyType:t,valueType:r,typeName:xt.ZodRecord,...Kt(n)}):new Ya({keyType:Fi.create(),valueType:t,typeName:xt.ZodRecord,...Kt(r)})}};i(Ya,"ZodRecord");var ac=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==et.map)return gt(n,{code:Ke.invalid_type,expected:et.map,received:n.parsedType}),kt;let s=this._def.keyType,o=this._def.valueType,c=[...n.data.entries()].map(([f,h],p)=>({key:s._parse(new di(n,f,n.path,[p,"key"])),value:o._parse(new di(n,h,n.path,[p,"value"]))}));if(n.common.async){let f=new Map;return Promise.resolve().then(async()=>{for(let h of c){let p=await h.key,v=await h.value;if(p.status==="aborted"||v.status==="aborted")return kt;(p.status==="dirty"||v.status==="dirty")&&r.dirty(),f.set(p.value,v.value)}return{status:r.value,value:f}})}else{let f=new Map;for(let h of c){let p=h.key,v=h.value;if(p.status==="aborted"||v.status==="aborted")return kt;(p.status==="dirty"||v.status==="dirty")&&r.dirty(),f.set(p.value,v.value)}return{status:r.value,value:f}}}};i(ac,"ZodMap");ac.create=(e,t,r)=>new ac({valueType:t,keyType:e,typeName:xt.ZodMap,...Kt(r)});var Ns=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==et.set)return gt(n,{code:Ke.invalid_type,expected:et.set,received:n.parsedType}),kt;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(gt(n,{code:Ke.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(gt(n,{code:Ke.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let o=this._def.valueType;function c(h){let p=new Set;for(let v of h){if(v.status==="aborted")return kt;v.status==="dirty"&&r.dirty(),p.add(v.value)}return{status:r.value,value:p}}i(c,"finalizeSet");let f=[...n.data.values()].map((h,p)=>o._parse(new di(n,h,n.path,p)));return n.common.async?Promise.all(f).then(h=>c(h)):c(f)}min(t,r){return new Ns({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Ns({...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(Ns,"ZodSet");Ns.create=(e,t)=>new Ns({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Kt(t)});var da=class extends Pt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==et.function)return gt(r,{code:Ke.invalid_type,expected:et.function,received:r.parsedType}),kt;function n(f,h){return i0({data:f,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,n0(),Nf].filter(p=>!!p),issueData:{code:Ke.invalid_arguments,argumentsError:h}})}i(n,"makeArgsIssue");function s(f,h){return i0({data:f,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,n0(),Nf].filter(p=>!!p),issueData:{code:Ke.invalid_return_type,returnTypeError:h}})}i(s,"makeReturnsIssue");let o={errorMap:r.common.contextualErrorMap},c=r.data;return this._def.returns instanceof ha?En(async(...f)=>{let h=new Li([]),p=await this._def.args.parseAsync(f,o).catch(b=>{throw h.addIssue(n(f,b)),h}),v=await c(...p);return await this._def.returns._def.type.parseAsync(v,o).catch(b=>{throw h.addIssue(s(v,b)),h})}):En((...f)=>{let h=this._def.args.safeParse(f,o);if(!h.success)throw new Li([n(f,h.error)]);let p=c(...h.data),v=this._def.returns.safeParse(p,o);if(!v.success)throw new Li([s(p,v.error)]);return v.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new da({...this._def,args:hi.create(t).rest(Rs.create())})}returns(t){return new da({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new da({args:t||hi.create([]).rest(Rs.create()),returns:r||Rs.create(),typeName:xt.ZodFunction,...Kt(n)})}};i(da,"ZodFunction");var Xa=class extends Pt{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(Xa,"ZodLazy");Xa.create=(e,t)=>new Xa({getter:e,typeName:xt.ZodLazy,...Kt(t)});var Qa=class extends Pt{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return gt(r,{code:Ke.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:t.data}}get value(){return this._def.value}};i(Qa,"ZodLiteral");Qa.create=(e,t)=>new Qa({value:e,typeName:xt.ZodLiteral,...Kt(t)});function S7(e,t){return new eo({values:e,typeName:xt.ZodEnum,...Kt(t)})}i(S7,"createZodEnum");var eo=class extends Pt{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return gt(r,{expected:nr.joinValues(n),received:r.parsedType,code:Ke.invalid_type}),kt}if(this._def.values.indexOf(t.data)===-1){let r=this._getOrReturnCtx(t),n=this._def.values;return gt(r,{received:r.data,code:Ke.invalid_enum_value,options:n}),kt}return En(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(eo,"ZodEnum");eo.create=S7;var to=class extends Pt{_parse(t){let r=nr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==et.string&&n.parsedType!==et.number){let s=nr.objectValues(r);return gt(n,{expected:nr.joinValues(s),received:n.parsedType,code:Ke.invalid_type}),kt}if(r.indexOf(t.data)===-1){let s=nr.objectValues(r);return gt(n,{received:n.data,code:Ke.invalid_enum_value,options:s}),kt}return En(t.data)}get enum(){return this._def.values}};i(to,"ZodNativeEnum");to.create=(e,t)=>new to({values:e,typeName:xt.ZodNativeEnum,...Kt(t)});var ha=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==et.promise&&r.common.async===!1)return gt(r,{code:Ke.invalid_type,expected:et.promise,received:r.parsedType}),kt;let n=r.parsedType===et.promise?r.data:Promise.resolve(r.data);return En(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(ha,"ZodPromise");ha.create=(e,t)=>new ha({type:e,typeName:xt.ZodPromise,...Kt(t)});var Vn=class extends Pt{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),s=this._def.effect||null;if(s.type==="preprocess"){let c=s.transform(n.data);return n.common.async?Promise.resolve(c).then(f=>this._def.schema._parseAsync({data:f,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}let o={addIssue:c=>{gt(n,c),c.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="refinement"){let c=i(f=>{let h=s.refinement(f,o);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 f},"executeRefinement");if(n.common.async===!1){let f=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return f.status==="aborted"?kt:(f.status==="dirty"&&r.dirty(),c(f.value),{status:r.value,value:f.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(f=>f.status==="aborted"?kt:(f.status==="dirty"&&r.dirty(),c(f.value).then(()=>({status:r.value,value:f.value}))))}if(s.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!s0(c))return c;let f=s.transform(c.value,o);if(f instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:f}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>s0(c)?Promise.resolve(s.transform(c.value,o)).then(f=>({status:r.value,value:f})):c);nr.assertNever(s)}};i(Vn,"ZodEffects");Vn.create=(e,t,r)=>new Vn({schema:e,typeName:xt.ZodEffects,effect:t,...Kt(r)});Vn.createWithPreprocess=(e,t,r)=>new Vn({schema:t,effect:{type:"preprocess",transform:e},typeName:xt.ZodEffects,...Kt(r)});var pi=class extends Pt{_parse(t){return this._getType(t)===et.undefined?En(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(pi,"ZodOptional");pi.create=(e,t)=>new pi({innerType:e,typeName:xt.ZodOptional,...Kt(t)});var Ps=class extends Pt{_parse(t){return this._getType(t)===et.null?En(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(Ps,"ZodNullable");Ps.create=(e,t)=>new Ps({innerType:e,typeName:xt.ZodNullable,...Kt(t)});var ro=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===et.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};i(ro,"ZodDefault");ro.create=(e,t)=>new ro({innerType:e,typeName:xt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Kt(t)});var oc=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.innerType._parse({data:r.data,path:r.path,parent:r});return a0(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};i(oc,"ZodCatch");oc.create=(e,t)=>new oc({innerType:e,typeName:xt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Kt(t)});var cc=class extends Pt{_parse(t){if(this._getType(t)!==et.nan){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.nan,received:n.parsedType}),kt}return{status:"valid",value:t.data}}};i(cc,"ZodNaN");cc.create=e=>new cc({typeName:xt.ZodNaN,...Kt(e)});var XL=Symbol("zod_brand"),Rf=class extends Pt{_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(Rf,"ZodBranded");var no=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return i(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?kt:o.status==="dirty"?(r.dirty(),A7(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})},"handleAsync")();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?kt:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new no({in:t,out:r,typeName:xt.ZodPipeline})}};i(no,"ZodPipeline");var x7=i((e,t={},r)=>e?fa.create().superRefine((n,s)=>{if(!e(n)){let o=typeof t=="function"?t(n):t,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:r})}}):fa.create(),"custom"),QL={object:_r.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 eF=i((e,t={message:`Input not instance of ${e.name}`})=>x7(r=>r instanceof e,t,!0),"instanceOfType"),T7=Fi.create,M7=rs.create,tF=cc.create,rF=Ka.create,C7=Va.create,nF=Os.create,iF=nc.create,sF=Ga.create,aF=Wa.create,oF=fa.create,cF=Rs.create,uF=Ui.create,lF=ic.create,fF=Kn.create,dF=_r.create,hF=_r.strictCreate,pF=Za.create,mF=sc.create,vF=Ja.create,gF=hi.create,bF=Ya.create,yF=ac.create,wF=Ns.create,_F=da.create,EF=Xa.create,AF=Qa.create,SF=eo.create,xF=to.create,TF=ha.create,_7=Vn.create,MF=pi.create,CF=Ps.create,IF=Vn.createWithPreprocess,kF=no.create,DF=i(()=>T7().optional(),"ostring"),OF=i(()=>M7().optional(),"onumber"),RF=i(()=>C7().optional(),"oboolean"),NF={string:e=>Fi.create({...e,coerce:!0}),number:e=>rs.create({...e,coerce:!0}),boolean:e=>Va.create({...e,coerce:!0}),bigint:e=>Ka.create({...e,coerce:!0}),date:e=>Os.create({...e,coerce:!0})},PF=kt,W=Object.freeze({__proto__:null,defaultErrorMap:Nf,setErrorMap:KL,getErrorMap:n0,makeIssue:i0,EMPTY_PATH:VL,addIssueToContext:gt,ParseStatus:Xr,INVALID:kt,DIRTY:A7,OK:En,isAborted:xb,isDirty:Tb,isValid:s0,isAsync:a0,get util(){return nr},ZodParsedType:et,getParsedType:qa,ZodType:Pt,ZodString:Fi,ZodNumber:rs,ZodBigInt:Ka,ZodBoolean:Va,ZodDate:Os,ZodSymbol:nc,ZodUndefined:Ga,ZodNull:Wa,ZodAny:fa,ZodUnknown:Rs,ZodNever:Ui,ZodVoid:ic,ZodArray:Kn,get objectUtil(){return o0},ZodObject:_r,ZodUnion:Za,ZodDiscriminatedUnion:sc,ZodIntersection:Ja,ZodTuple:hi,ZodRecord:Ya,ZodMap:ac,ZodSet:Ns,ZodFunction:da,ZodLazy:Xa,ZodLiteral:Qa,ZodEnum:eo,ZodNativeEnum:to,ZodPromise:ha,ZodEffects:Vn,ZodTransformer:Vn,ZodOptional:pi,ZodNullable:Ps,ZodDefault:ro,ZodCatch:oc,ZodNaN:cc,BRAND:XL,ZodBranded:Rf,ZodPipeline:no,custom:x7,Schema:Pt,ZodSchema:Pt,late:QL,get ZodFirstPartyTypeKind(){return xt},coerce:NF,any:oF,array:fF,bigint:rF,boolean:C7,date:nF,discriminatedUnion:mF,effect:_7,enum:SF,function:_F,instanceof:eF,intersection:vF,lazy:EF,literal:AF,map:yF,nan:tF,nativeEnum:xF,never:uF,null:aF,nullable:CF,number:M7,object:dF,oboolean:RF,onumber:OF,optional:MF,ostring:DF,pipeline:kF,preprocess:IF,promise:TF,record:bF,set:wF,strictObject:hF,string:T7,symbol:iF,transformer:_7,tuple:gF,undefined:sF,union:pF,unknown:cF,void:lF,NEVER:PF,ZodIssueCode:Ke,quotelessJson:qL,ZodError:Li});var k7=W.array(W.string().or(W.record(W.any()))),$Z=W.object({type:W.string().optional(),narrative:W.string().optional()}),l0=W.string().or(W.object({id:W.string(),type:W.string(),caption:W.string().optional()})),BF=W.object({type:W.string().min(1).or(W.string().array().nonempty()),latitude:W.number(),longitude:W.number()}),LF=W.object({type:W.string().min(1).or(W.string().array().nonempty()),addressCountry:W.string().optional(),addressCountryCode:W.string().optional(),addressRegion:W.string().optional(),addressLocality:W.string().optional(),streetAddress:W.string().optional(),postOfficeBoxNumber:W.string().optional(),postalCode:W.string().optional(),geo:BF.optional()}),FF=W.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(W.string()),D7=W.object({type:W.string().min(1).or(W.string().array().nonempty()),identifier:W.string(),identifierType:FF}),Pf=W.string().or(W.object({id:W.string().optional(),type:W.string().or(W.string().array().nonempty().optional()),name:W.string().optional(),url:W.string().optional(),phone:W.string().optional(),description:W.string().optional(),endorsement:W.any().array().optional(),image:l0.optional(),email:W.string().email().optional(),address:LF.optional(),otherIdentifier:D7.array().optional(),official:W.string().optional(),parentOrg:W.any().optional(),familyName:W.string().optional(),givenName:W.string().optional(),additionalName:W.string().optional(),patronymicName:W.string().optional(),honorificPrefix:W.string().optional(),honorificSuffix:W.string().optional(),familyNamePrefix:W.string().optional(),dateOfBirth:W.string().optional()}).catchall(W.any())),Cb=W.object({id:W.string().optional()}).catchall(W.any()),UF=W.object({type:W.string(),id:W.string()}).catchall(W.any()),$F=W.object({id:W.string(),type:W.string()}).catchall(W.any()),jF=W.object({id:W.string(),type:W.string()}).catchall(W.any()),c0=W.object({"@context":k7,id:W.string().optional(),type:W.string().array().nonempty(),issuer:Pf,issuanceDate:W.string(),expirationDate:W.string().optional(),credentialSubject:Cb.or(Cb.array()),credentialStatus:UF.optional(),credentialSchema:$F.array().optional(),refreshService:jF.optional()}).catchall(W.any()),io=W.object({type:W.string(),created:W.string(),challenge:W.string().optional(),domain:W.string().optional(),nonce:W.string().optional(),proofPurpose:W.string(),verificationMethod:W.string(),jws:W.string().optional()}).catchall(W.any()),u0=c0.extend({proof:io.or(io.array())}),zF=W.object({"@context":k7,id:W.string().optional(),type:W.string().or(W.string().array().nonempty()),verifiableCredential:u0.or(u0.array()).optional(),holder:W.string().optional()}).catchall(W.any()),jZ=zF.extend({proof:io.or(io.array())}),HF=W.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(W.string()),f0=W.object({type:W.string().array().nonempty(),targetCode:W.string().optional(),targetDescription:W.string().optional(),targetName:W.string(),targetFramework:W.string().optional(),targetType:HF.optional(),targetUrl:W.string()}),qF=W.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),KF=qF.or(W.string()),VF=W.object({id:W.string().optional(),narrative:W.string().optional()}).catchall(W.any()),GF=W.object({id:W.string(),type:W.string().array().nonempty(),endorsementComment:W.string().optional()}),WF=c0.extend({credentialSubject:GF,proof:io.or(io.array()).optional()}),ZF=W.object({id:W.string(),"@language":W.string().optional(),version:W.string().optional()}),JF=W.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(W.string()),YF=W.object({id:W.string(),type:W.string().array().nonempty(),alignment:f0.array().optional(),description:W.string().optional(),level:W.string().optional(),name:W.string(),points:W.string().optional()}).catchall(W.any()),XF=W.object({id:W.string(),type:W.string().array().nonempty(),alignment:f0.array().optional(),allowedValue:W.string().array().optional(),name:W.string(),requiredLevel:W.string().optional(),requiredValue:W.string().optional(),resultType:JF,rubricCriterionLevel:YF.array().optional(),valueMax:W.string().optional(),valueMin:W.string().optional()}).catchall(W.any()),QF=W.object({id:W.string().optional(),type:W.string().array().nonempty(),alignment:f0.array().optional(),achievementType:KF.optional(),creator:Pf.optional(),creditsAvailable:W.number().optional(),criteria:VF,description:W.string(),endorsement:WF.array().optional(),fieldOfStudy:W.string().optional(),humanCode:W.string().optional(),image:l0.optional(),"@language":W.string().optional(),name:W.string(),otherIdentifier:D7.array().optional(),related:ZF.array().optional(),resultDescription:XF.array().optional(),specialization:W.string().optional(),tag:W.string().array().optional(),version:W.string().optional()}).catchall(W.any()),eU=W.object({type:W.string(),hashed:W.boolean(),identityHash:W.string(),identityType:W.string(),salt:W.string().optional()}),tU=W.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),rU=W.object({type:W.string().array().nonempty(),achievedLevel:W.string().optional(),alignment:f0.array().optional(),resultDescription:W.string().optional(),status:tU.optional(),value:W.string().optional()}).catchall(W.any()),I7=W.object({id:W.string().optional(),type:W.string().array().nonempty(),activityEndDate:W.string().optional(),activityStartDate:W.string().optional(),creditsEarned:W.number().optional(),achievement:QF.optional(),identifier:eU.array().optional(),image:l0.optional(),licenseNumber:W.string().optional(),narrative:W.string().optional(),result:rU.array().optional(),role:W.string().optional(),source:Pf.optional(),term:W.string().optional()}).catchall(W.any()),nU=W.object({id:W.string().optional(),type:W.string().array().nonempty(),narrative:W.string().optional(),name:W.string().optional(),description:W.string().optional(),genre:W.string().optional(),audience:W.string().optional()}).catchall(W.any()),iU=c0.extend({name:W.string().optional(),description:W.string().optional(),image:l0.optional(),credentialSubject:I7.or(I7.array()),endorsement:c0.array().optional(),evidence:nU.array().optional()}),HZ=iU.extend({proof:io.or(io.array())}),KZ=W.object({checks:W.string().array(),warnings:W.string().array(),errors:W.string().array()}),O7=W.enum(["Success","Failed","Error"]),VZ=O7.enum,GZ=W.object({check:W.string(),status:O7,message:W.string().optional(),details:W.string().optional()}),WZ=W.object({title:W.string().optional(),createdAt:W.string().optional(),issuer:Pf.optional(),issuee:Pf.optional(),credentialSubject:Cb.optional()}),uc=W.object({id:W.string(),uri:W.string()}).catchall(W.any()),YZ=W.object({limit:W.number(),cursor:W.string().optional()}),lc=W.object({cursor:W.string().optional(),hasMore:W.boolean()}),sU=W.object({kty:W.string(),crv:W.string(),x:W.string(),y:W.string().optional(),n:W.string().optional(),d:W.string()}),aU=W.object({alg:W.string(),iv:W.string(),tag:W.string(),epk:sU.partial().optional(),kid:W.string().optional(),apv:W.string().optional(),apu:W.string().optional()}),oU=W.object({header:aU,encrypted_key:W.string()}),cU=W.object({protected:W.string(),iv:W.string(),ciphertext:W.string(),tag:W.string(),aad:W.string().optional(),recipients:oU.array().optional()}),R7=W.object({encryptedRecord:cU,fields:W.string().array()}).catchall(W.any()),QZ=lc.extend({records:R7.array()}),uU=R7.extend({id:W.string()}),eJ=lc.extend({records:uU.array()}),Mu=W.object({profileId:W.string().min(3).max(40),displayName:W.string().default(""),bio:W.string().default(""),did:W.string(),email:W.string().optional(),image:W.string().optional(),isServiceProfile:W.boolean().default(!1).optional(),notificationsWebhook:W.string().url().startsWith("https://").optional()}),rJ=lc.extend({records:Mu.array()}),nJ=W.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),iJ=W.object({uri:W.string(),to:W.string(),from:W.string(),sent:W.string().datetime(),received:W.string().datetime().optional()}),lU=W.enum(["DRAFT","LIVE"]),sJ=W.object({uri:W.string(),name:W.string().optional(),type:W.string().optional(),category:W.string().optional(),status:lU.optional(),autoConnectRecipients:W.boolean().optional()}),aJ=W.object({to:Mu,from:W.string(),received:W.string().optional()}),fU=W.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED"]),dU=W.object({title:W.string().optional(),body:W.string().optional()}),hU=W.object({vcUris:W.array(W.string()).optional(),vpUris:W.array(W.string()).optional()}),oJ=W.object({type:fU,to:Mu.partial().and(W.object({did:W.string()})),from:Mu.partial().and(W.object({did:W.string()})),message:dU.optional(),data:hU.optional(),sent:W.string().datetime().optional()}),cJ=W.object({endpoint:W.string(),name:W.string(),did:W.string().optional()}),uJ=W.object({ttlSeconds:W.number().optional(),totalUses:W.number().optional()}),pU=W.object({endpoint:W.string()}),lJ=W.object({signingAuthority:pU,relationship:W.object({name:W.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:W.string()})}),mU=W.enum(["live","stale","withdrawn"]),vU=W.object({read:W.object({anonymize:W.boolean().optional(),credentials:W.object({categories:W.record(W.object({required:W.boolean()})).default({})}).default({}),personal:W.record(W.object({required:W.boolean()})).default({})}).default({}),write:W.object({credentials:W.object({categories:W.record(W.object({required:W.boolean()})).default({})}).default({}),personal:W.record(W.object({required:W.boolean()})).default({})}).default({})}),N7=W.object({contract:vU,owner:Mu,name:W.string(),subtitle:W.string().optional(),description:W.string().optional(),reasonForAccessing:W.string().optional(),image:W.string().optional(),uri:W.string(),createdAt:W.string(),updatedAt:W.string(),expiresAt:W.string().optional()}),fJ=lc.extend({records:N7.omit({owner:!0}).array()}),gU=W.object({credentials:W.object({categories:W.record(W.string().array()).default({})}),personal:W.record(W.string()).default({}),date:W.string()}),dJ=lc.extend({records:gU.array()}),P7=W.object({read:W.object({anonymize:W.boolean().optional(),credentials:W.object({shareAll:W.boolean().optional(),sharing:W.boolean().optional(),categories:W.record(W.object({sharing:W.boolean().optional(),shared:W.string().array().optional(),shareAll:W.boolean().optional()})).default({})}).default({}),personal:W.record(W.string()).default({})}).default({}),write:W.object({credentials:W.object({categories:W.record(W.boolean()).default({})}).default({}),personal:W.record(W.boolean()).default({})}).default({})}),hJ=lc.extend({records:W.object({expiresAt:W.string().optional(),oneTime:W.boolean().optional(),terms:P7,contract:N7,uri:W.string(),consenter:Mu,status:mU}).array()}),pJ=W.object({read:W.object({anonymize:W.boolean().optional(),credentials:W.object({categories:W.record(W.object({required:W.boolean().optional()})).optional()}).optional(),personal:W.record(W.object({required:W.boolean().optional()})).optional()}).optional(),write:W.object({credentials:W.object({categories:W.record(W.object({required:W.boolean().optional()})).optional()}).optional(),personal:W.record(W.object({required:W.boolean().optional()})).optional()}).optional()}),bU=W.object({read:W.object({anonymize:W.boolean().optional(),credentials:W.object({shareAll:W.boolean().optional(),sharing:W.boolean().optional(),categories:W.record(W.object({sharing:W.boolean().optional(),shared:W.string().array().optional(),shareAll:W.boolean().optional()}).optional()).optional()}).optional(),personal:W.record(W.string()).optional()}).optional(),write:W.object({credentials:W.object({categories:W.record(W.boolean()).optional()}).optional(),personal:W.record(W.boolean()).optional()}).optional()}),Ib=W.enum(["consent","update","sync","withdraw"]),mJ=W.object({terms:bU.optional(),action:Ib.or(Ib.array()).optional(),date:W.object({$gt:W.string()}).or(W.object({$lt:W.string()})).or(W.object({$eq:W.string()})).optional(),expiresAt:W.object({$gt:W.string()}).or(W.object({$lt:W.string()})).or(W.object({$eq:W.string()})).optional(),oneTime:W.boolean().optional()}),yU=W.object({expiresAt:W.string().optional(),oneTime:W.boolean().optional(),terms:P7.optional(),id:W.string(),action:Ib,date:W.string()}),vJ=lc.extend({records:yU.array()});var wU=Object.create,hd=Object.defineProperty,_U=Object.getOwnPropertyDescriptor,t2=Object.getOwnPropertyNames,EU=Object.getPrototypeOf,AU=Object.prototype.hasOwnProperty,a=i((e,t)=>hd(e,"name",{value:t,configurable:!0}),"__name"),ny=(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[t2(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[t2(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),Sr=i((e,t)=>{for(var r in t)hd(e,r,{get:t[r],enumerable:!0})},"__export"),XA=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of t2(t))!AU.call(e,s)&&s!==r&&hd(e,s,{get:()=>t[s],enumerable:!(n=_U(t,s))||n.enumerable});return e},"__copyProps"),rr=i((e,t,r)=>(r=e!=null?wU(EU(e)):{},XA(t||!e||!e.__esModule?hd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),kb=i(e=>XA(hd({},"__esModule",{value:!0}),e),"__toCommonJS"),SU=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",s=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",f="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",p=500,v="__lodash_placeholder__",y=1,b=2,_=4,T=1,O=2,R=1,P=2,K=4,U=8,j=16,V=32,G=64,I=128,H=256,ae=512,ue=30,me="...",q=800,w=16,x=1,m=2,d=3,g=1/0,S=9007199254740991,D=17976931348623157e292,C=0/0,E=4294967295,B=E-1,$=E>>>1,k=[["ary",I],["bind",R],["bindKey",P],["curry",U],["curryRight",j],["flip",ae],["partial",V],["partialRight",G],["rearg",H]],F="[object Arguments]",he="[object Array]",N="[object AsyncFunction]",Q="[object Boolean]",X="[object Date]",M="[object DOMException]",z="[object Error]",ne="[object Function]",oe="[object GeneratorFunction]",ge="[object Map]",ke="[object Number]",_e="[object Null]",fe="[object Object]",Ce="[object Promise]",pe="[object Proxy]",we="[object RegExp]",te="[object Set]",ve="[object String]",Me="[object Symbol]",Ue="[object Undefined]",Re="[object WeakMap]",je="[object WeakSet]",rt="[object ArrayBuffer]",le="[object DataView]",ce="[object Float32Array]",Y="[object Float64Array]",ie="[object Int8Array]",be="[object Int16Array]",Se="[object Int32Array]",xe="[object Uint8Array]",De="[object Uint8ClampedArray]",Mt="[object Uint16Array]",qe="[object Uint32Array]",He=/\b__p \+= '';/g,Ot=/\b(__p \+=) '' \+/g,dt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,Dr=/[&<>"']/g,ct=RegExp(mt.source),ut=RegExp(Dr.source),lr=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,ar=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,it=/^\w*$/,Ye=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,st=RegExp(Qt.source),Qe=/^\s+/,or=/\s/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ze=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,ot=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Et=/[()=,{}\[\]\/\s]/,Sn=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,bt=/\w*$/,fn=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,tr=/^\[object .+?Constructor\]$/,tn=/^0o[0-7]+$/i,rn=/^(?:0|[1-9]\d*)$/,Or=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hr=/($^)/,nn=/['\n\r\u2028\u2029\\]/g,xn="\\ud800-\\udfff",Ai="\\u0300-\\u036f",Si="\\ufe20-\\ufe2f",xi="\\u20d0-\\u20ff",Pn=Ai+Si+xi,dn="\\u2700-\\u27bf",Xn="a-z\\xdf-\\xf6\\xf8-\\xff",Bn="\\xac\\xb1\\xd7\\xf7",Ti="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Mi="\\u2000-\\u206f",Ci=" \\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",Gs="A-Z\\xc0-\\xd6\\xd8-\\xde",Ws="\\ufe0e\\ufe0f",Zs=Bn+Ti+Mi+Ci,Ca="['\u2019]",kd="["+xn+"]",vl="["+Zs+"]",To="["+Pn+"]",gl="\\d+",Dd="["+dn+"]",bl="["+Xn+"]",yl="[^"+xn+Zs+gl+dn+Xn+Gs+"]",Mo="\\ud83c[\\udffb-\\udfff]",Od="(?:"+To+"|"+Mo+")",wl="[^"+xn+"]",Js="(?:\\ud83c[\\udde6-\\uddff]){2}",Vi="[\\ud800-\\udbff][\\udc00-\\udfff]",Ys="["+Gs+"]",ms="\\u200d",_l="(?:"+bl+"|"+yl+")",Rd="(?:"+Ys+"|"+yl+")",El="(?:"+Ca+"(?:d|ll|m|re|s|t|ve))?",Al="(?:"+Ca+"(?:D|LL|M|RE|S|T|VE))?",Sl=Od+"?",xl="["+Ws+"]?",Tl="(?:"+ms+"(?:"+[wl,Js,Vi].join("|")+")"+xl+Sl+")*",vs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Nd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lc=xl+Sl+Tl,Pd="(?:"+[Dd,Js,Vi].join("|")+")"+Lc,Ml="(?:"+[wl+To+"?",To,Js,Vi,kd].join("|")+")",Cl=RegExp(Ca,"g"),Bd=RegExp(To,"g"),Il=RegExp(Mo+"(?="+Mo+")|"+Ml+Lc,"g"),kl=RegExp([Ys+"?"+bl+"+"+El+"(?="+[vl,Ys,"$"].join("|")+")",Rd+"+"+Al+"(?="+[vl,Ys+_l,"$"].join("|")+")",Ys+"?"+_l+"+"+El,Ys+"+"+Al,Nd,vs,gl,Pd].join("|"),"g"),Ld=RegExp("["+ms+xn+Pn+Ws+"]"),Co=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Fd=["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"],Fc=-1,br={};br[ce]=br[Y]=br[ie]=br[be]=br[Se]=br[xe]=br[De]=br[Mt]=br[qe]=!0,br[F]=br[he]=br[rt]=br[Q]=br[le]=br[X]=br[z]=br[ne]=br[ge]=br[ke]=br[fe]=br[we]=br[te]=br[ve]=br[Re]=!1;var mr={};mr[F]=mr[he]=mr[rt]=mr[le]=mr[Q]=mr[X]=mr[ce]=mr[Y]=mr[ie]=mr[be]=mr[Se]=mr[ge]=mr[ke]=mr[fe]=mr[we]=mr[te]=mr[ve]=mr[Me]=mr[xe]=mr[De]=mr[Mt]=mr[qe]=!0,mr[z]=mr[ne]=mr[Re]=!1;var se={\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"},Te={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Pe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qr=parseFloat,sn=parseInt,Tn=typeof global=="object"&&global&&global.Object===Object&&global,hn=typeof self=="object"&&self&&self.Object===Object&&self,Lr=Tn||hn||Function("return this")(),gs=typeof e=="object"&&e&&!e.nodeType&&e,bs=gs&&typeof t=="object"&&t&&!t.nodeType&&t,Dl=bs&&bs.exports===gs,Uc=Dl&&Tn.process,pn=function(){try{var Ee=bs&&bs.require&&bs.require("util").types;return Ee||Uc&&Uc.binding&&Uc.binding("util")}catch{}}(),Io=pn&&pn.isArrayBuffer,D6=pn&&pn.isDate,O6=pn&&pn.isMap,R6=pn&&pn.isRegExp,N6=pn&&pn.isSet,P6=pn&&pn.isTypedArray;function Ln(Ee,Ne,Ie){switch(Ie.length){case 0:return Ee.call(Ne);case 1:return Ee.call(Ne,Ie[0]);case 2:return Ee.call(Ne,Ie[0],Ie[1]);case 3:return Ee.call(Ne,Ie[0],Ie[1],Ie[2])}return Ee.apply(Ne,Ie)}i(Ln,"apply"),a(Ln,"apply");function B6(Ee,Ne,Ie,ft){for(var It=-1,fr=Ee==null?0:Ee.length;++It<fr;){var Vr=Ee[It];Ne(ft,Vr,Ie(Vr),Ee)}return ft}i(B6,"arrayAggregator"),a(B6,"arrayAggregator");function Qn(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length;++Ie<ft&&Ne(Ee[Ie],Ie,Ee)!==!1;);return Ee}i(Qn,"arrayEach"),a(Qn,"arrayEach");function L6(Ee,Ne){for(var Ie=Ee==null?0:Ee.length;Ie--&&Ne(Ee[Ie],Ie,Ee)!==!1;);return Ee}i(L6,"arrayEachRight"),a(L6,"arrayEachRight");function Xm(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length;++Ie<ft;)if(!Ne(Ee[Ie],Ie,Ee))return!1;return!0}i(Xm,"arrayEvery"),a(Xm,"arrayEvery");function Xs(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length,It=0,fr=[];++Ie<ft;){var Vr=Ee[Ie];Ne(Vr,Ie,Ee)&&(fr[It++]=Vr)}return fr}i(Xs,"arrayFilter"),a(Xs,"arrayFilter");function Ol(Ee,Ne){var Ie=Ee==null?0:Ee.length;return!!Ie&&ko(Ee,Ne,0)>-1}i(Ol,"arrayIncludes"),a(Ol,"arrayIncludes");function Ud(Ee,Ne,Ie){for(var ft=-1,It=Ee==null?0:Ee.length;++ft<It;)if(Ie(Ne,Ee[ft]))return!0;return!1}i(Ud,"arrayIncludesWith"),a(Ud,"arrayIncludesWith");function Tr(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length,It=Array(ft);++Ie<ft;)It[Ie]=Ne(Ee[Ie],Ie,Ee);return It}i(Tr,"arrayMap"),a(Tr,"arrayMap");function Qs(Ee,Ne){for(var Ie=-1,ft=Ne.length,It=Ee.length;++Ie<ft;)Ee[It+Ie]=Ne[Ie];return Ee}i(Qs,"arrayPush"),a(Qs,"arrayPush");function $d(Ee,Ne,Ie,ft){var It=-1,fr=Ee==null?0:Ee.length;for(ft&&fr&&(Ie=Ee[++It]);++It<fr;)Ie=Ne(Ie,Ee[It],It,Ee);return Ie}i($d,"arrayReduce"),a($d,"arrayReduce");function F6(Ee,Ne,Ie,ft){var It=Ee==null?0:Ee.length;for(ft&&It&&(Ie=Ee[--It]);It--;)Ie=Ne(Ie,Ee[It],It,Ee);return Ie}i(F6,"arrayReduceRight"),a(F6,"arrayReduceRight");function jd(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length;++Ie<ft;)if(Ne(Ee[Ie],Ie,Ee))return!0;return!1}i(jd,"arraySome"),a(jd,"arraySome");var Ck=zd("length");function U6(Ee){return Ee.split("")}i(U6,"asciiToArray"),a(U6,"asciiToArray");function $6(Ee){return Ee.match(ot)||[]}i($6,"asciiWords"),a($6,"asciiWords");function Qm(Ee,Ne,Ie){var ft;return Ie(Ee,function(It,fr,Vr){if(Ne(It,fr,Vr))return ft=fr,!1}),ft}i(Qm,"baseFindKey"),a(Qm,"baseFindKey");function Rl(Ee,Ne,Ie,ft){for(var It=Ee.length,fr=Ie+(ft?1:-1);ft?fr--:++fr<It;)if(Ne(Ee[fr],fr,Ee))return fr;return-1}i(Rl,"baseFindIndex"),a(Rl,"baseFindIndex");function ko(Ee,Ne,Ie){return Ne===Ne?J6(Ee,Ne,Ie):Rl(Ee,e1,Ie)}i(ko,"baseIndexOf"),a(ko,"baseIndexOf");function j6(Ee,Ne,Ie,ft){for(var It=Ie-1,fr=Ee.length;++It<fr;)if(ft(Ee[It],Ne))return It;return-1}i(j6,"baseIndexOfWith"),a(j6,"baseIndexOfWith");function e1(Ee){return Ee!==Ee}i(e1,"baseIsNaN"),a(e1,"baseIsNaN");function t1(Ee,Ne){var Ie=Ee==null?0:Ee.length;return Ie?qd(Ee,Ne)/Ie:C}i(t1,"baseMean"),a(t1,"baseMean");function zd(Ee){return function(Ne){return Ne==null?r:Ne[Ee]}}i(zd,"baseProperty"),a(zd,"baseProperty");function Hd(Ee){return function(Ne){return Ee==null?r:Ee[Ne]}}i(Hd,"basePropertyOf"),a(Hd,"basePropertyOf");function r1(Ee,Ne,Ie,ft,It){return It(Ee,function(fr,Vr,wr){Ie=ft?(ft=!1,fr):Ne(Ie,fr,Vr,wr)}),Ie}i(r1,"baseReduce"),a(r1,"baseReduce");function z6(Ee,Ne){var Ie=Ee.length;for(Ee.sort(Ne);Ie--;)Ee[Ie]=Ee[Ie].value;return Ee}i(z6,"baseSortBy"),a(z6,"baseSortBy");function qd(Ee,Ne){for(var Ie,ft=-1,It=Ee.length;++ft<It;){var fr=Ne(Ee[ft]);fr!==r&&(Ie=Ie===r?fr:Ie+fr)}return Ie}i(qd,"baseSum"),a(qd,"baseSum");function Kd(Ee,Ne){for(var Ie=-1,ft=Array(Ee);++Ie<Ee;)ft[Ie]=Ne(Ie);return ft}i(Kd,"baseTimes"),a(Kd,"baseTimes");function H6(Ee,Ne){return Tr(Ne,function(Ie){return[Ie,Ee[Ie]]})}i(H6,"baseToPairs"),a(H6,"baseToPairs");function n1(Ee){return Ee&&Ee.slice(0,o1(Ee)+1).replace(Qe,"")}i(n1,"baseTrim"),a(n1,"baseTrim");function Fn(Ee){return function(Ne){return Ee(Ne)}}i(Fn,"baseUnary"),a(Fn,"baseUnary");function Vd(Ee,Ne){return Tr(Ne,function(Ie){return Ee[Ie]})}i(Vd,"baseValues"),a(Vd,"baseValues");function $c(Ee,Ne){return Ee.has(Ne)}i($c,"cacheHas"),a($c,"cacheHas");function i1(Ee,Ne){for(var Ie=-1,ft=Ee.length;++Ie<ft&&ko(Ne,Ee[Ie],0)>-1;);return Ie}i(i1,"charsStartIndex"),a(i1,"charsStartIndex");function s1(Ee,Ne){for(var Ie=Ee.length;Ie--&&ko(Ne,Ee[Ie],0)>-1;);return Ie}i(s1,"charsEndIndex"),a(s1,"charsEndIndex");function q6(Ee,Ne){for(var Ie=Ee.length,ft=0;Ie--;)Ee[Ie]===Ne&&++ft;return ft}i(q6,"countHolders"),a(q6,"countHolders");var Ik=Hd(se),kk=Hd(Te);function K6(Ee){return"\\"+ht[Ee]}i(K6,"escapeStringChar"),a(K6,"escapeStringChar");function V6(Ee,Ne){return Ee==null?r:Ee[Ne]}i(V6,"getValue"),a(V6,"getValue");function Do(Ee){return Ld.test(Ee)}i(Do,"hasUnicode"),a(Do,"hasUnicode");function G6(Ee){return Co.test(Ee)}i(G6,"hasUnicodeWord"),a(G6,"hasUnicodeWord");function W6(Ee){for(var Ne,Ie=[];!(Ne=Ee.next()).done;)Ie.push(Ne.value);return Ie}i(W6,"iteratorToArray"),a(W6,"iteratorToArray");function Gd(Ee){var Ne=-1,Ie=Array(Ee.size);return Ee.forEach(function(ft,It){Ie[++Ne]=[It,ft]}),Ie}i(Gd,"mapToArray"),a(Gd,"mapToArray");function a1(Ee,Ne){return function(Ie){return Ee(Ne(Ie))}}i(a1,"overArg"),a(a1,"overArg");function ea(Ee,Ne){for(var Ie=-1,ft=Ee.length,It=0,fr=[];++Ie<ft;){var Vr=Ee[Ie];(Vr===Ne||Vr===v)&&(Ee[Ie]=v,fr[It++]=Ie)}return fr}i(ea,"replaceHolders"),a(ea,"replaceHolders");function Nl(Ee){var Ne=-1,Ie=Array(Ee.size);return Ee.forEach(function(ft){Ie[++Ne]=ft}),Ie}i(Nl,"setToArray"),a(Nl,"setToArray");function Z6(Ee){var Ne=-1,Ie=Array(Ee.size);return Ee.forEach(function(ft){Ie[++Ne]=[ft,ft]}),Ie}i(Z6,"setToPairs"),a(Z6,"setToPairs");function J6(Ee,Ne,Ie){for(var ft=Ie-1,It=Ee.length;++ft<It;)if(Ee[ft]===Ne)return ft;return-1}i(J6,"strictIndexOf"),a(J6,"strictIndexOf");function Y6(Ee,Ne,Ie){for(var ft=Ie+1;ft--;)if(Ee[ft]===Ne)return ft;return ft}i(Y6,"strictLastIndexOf"),a(Y6,"strictLastIndexOf");function Oo(Ee){return Do(Ee)?X6(Ee):Ck(Ee)}i(Oo,"stringSize"),a(Oo,"stringSize");function Ii(Ee){return Do(Ee)?Q6(Ee):U6(Ee)}i(Ii,"stringToArray"),a(Ii,"stringToArray");function o1(Ee){for(var Ne=Ee.length;Ne--&&or.test(Ee.charAt(Ne)););return Ne}i(o1,"trimmedEndIndex"),a(o1,"trimmedEndIndex");var Dk=Hd(Pe);function X6(Ee){for(var Ne=Il.lastIndex=0;Il.test(Ee);)++Ne;return Ne}i(X6,"unicodeSize"),a(X6,"unicodeSize");function Q6(Ee){return Ee.match(Il)||[]}i(Q6,"unicodeToArray"),a(Q6,"unicodeToArray");function e3(Ee){return Ee.match(kl)||[]}i(e3,"unicodeWords"),a(e3,"unicodeWords");var Ok=a(i(function Ee(Ne){Ne=Ne==null?Lr:Ia.defaults(Lr.Object(),Ne,Ia.pick(Lr,Fd));var Ie=Ne.Array,ft=Ne.Date,It=Ne.Error,fr=Ne.Function,Vr=Ne.Math,wr=Ne.Object,c1=Ne.RegExp,Rk=Ne.String,ki=Ne.TypeError,Wd=Ie.prototype,Nk=fr.prototype,jc=wr.prototype,Zd=Ne["__core-js_shared__"],Jd=Nk.toString,vr=jc.hasOwnProperty,Pk=0,t3=function(){var u=/[^.]+$/.exec(Zd&&Zd.keys&&Zd.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),Yd=jc.toString,Bk=Jd.call(wr),Lk=Lr._,Fk=c1("^"+Jd.call(vr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xd=Dl?Ne.Buffer:r,ka=Ne.Symbol,Qd=Ne.Uint8Array,r3=Xd?Xd.allocUnsafe:r,eh=a1(wr.getPrototypeOf,wr),n3=wr.create,i3=jc.propertyIsEnumerable,th=Wd.splice,s3=ka?ka.isConcatSpreadable:r,Pl=ka?ka.iterator:r,Ro=ka?ka.toStringTag:r,rh=function(){try{var u=Ba(wr,"defineProperty");return u({},"",{}),u}catch{}}(),Uk=Ne.clearTimeout!==Lr.clearTimeout&&Ne.clearTimeout,$k=ft&&ft.now!==Lr.Date.now&&ft.now,jk=Ne.setTimeout!==Lr.setTimeout&&Ne.setTimeout,nh=Vr.ceil,ih=Vr.floor,u1=wr.getOwnPropertySymbols,zk=Xd?Xd.isBuffer:r,a3=Ne.isFinite,Hk=Wd.join,qk=a1(wr.keys,wr),Gr=Vr.max,mn=Vr.min,Kk=ft.now,Vk=Ne.parseInt,o3=Vr.random,Gk=Wd.reverse,l1=Ba(Ne,"DataView"),Bl=Ba(Ne,"Map"),f1=Ba(Ne,"Promise"),zc=Ba(Ne,"Set"),Ll=Ba(Ne,"WeakMap"),Fl=Ba(wr,"create"),sh=Ll&&new Ll,Hc={},Wk=La(l1),Zk=La(Bl),Jk=La(f1),Yk=La(zc),Xk=La(Ll),ah=ka?ka.prototype:r,Ul=ah?ah.valueOf:r,c3=ah?ah.toString:r;function ee(u){if(kr(u)&&!Rt(u)&&!(u instanceof Vt)){if(u instanceof ei)return u;if(vr.call(u,"__wrapped__"))return uv(u)}return new ei(u)}i(ee,"lodash"),a(ee,"lodash");var qc=function(){function u(){}return i(u,"object"),a(u,"object"),function(l){if(!Cr(l))return{};if(n3)return n3(l);u.prototype=l;var A=new u;return u.prototype=r,A}}();function $l(){}i($l,"baseLodash"),a($l,"baseLodash");function ei(u,l){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=r}i(ei,"LodashWrapper"),a(ei,"LodashWrapper"),ee.templateSettings={escape:lr,evaluate:lt,interpolate:nt,variable:"",imports:{_:ee}},ee.prototype=$l.prototype,ee.prototype.constructor=ee,ei.prototype=qc($l.prototype),ei.prototype.constructor=ei;function Vt(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=E,this.__views__=[]}i(Vt,"LazyWrapper"),a(Vt,"LazyWrapper");function u3(){var u=new Vt(this.__wrapped__);return u.__actions__=Mn(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=Mn(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=Mn(this.__views__),u}i(u3,"lazyClone"),a(u3,"lazyClone");function l3(){if(this.__filtered__){var u=new Vt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(l3,"lazyReverse"),a(l3,"lazyReverse");function f3(){var u=this.__wrapped__.value(),l=this.__dir__,A=Rt(u),L=l<0,Z=A?u.length:0,re=x5(0,Z,this.__views__),de=re.start,ye=re.end,Ae=ye-de,Be=L?ye:de-1,Le=this.__iteratees__,$e=Le.length,Je=0,pt=mn(Ae,this.__takeCount__);if(!A||!L&&Z==Ae&&pt==Ae)return R1(u,this.__actions__);var St=[];e:for(;Ae--&&Je<pt;){Be+=l;for(var Lt=-1,_t=u[Be];++Lt<$e;){var Ht=Le[Lt],Gt=Ht.iteratee,jn=Ht.type,yn=Gt(_t);if(jn==m)_t=yn;else if(!yn){if(jn==x)continue e;break e}}St[Je++]=_t}return St}i(f3,"lazyValue"),a(f3,"lazyValue"),Vt.prototype=qc($l.prototype),Vt.prototype.constructor=Vt;function Da(u){var l=-1,A=u==null?0:u.length;for(this.clear();++l<A;){var L=u[l];this.set(L[0],L[1])}}i(Da,"Hash"),a(Da,"Hash");function d3(){this.__data__=Fl?Fl(null):{},this.size=0}i(d3,"hashClear"),a(d3,"hashClear");function h3(u){var l=this.has(u)&&delete this.__data__[u];return this.size-=l?1:0,l}i(h3,"hashDelete"),a(h3,"hashDelete");function p3(u){var l=this.__data__;if(Fl){var A=l[u];return A===h?r:A}return vr.call(l,u)?l[u]:r}i(p3,"hashGet"),a(p3,"hashGet");function m3(u){var l=this.__data__;return Fl?l[u]!==r:vr.call(l,u)}i(m3,"hashHas"),a(m3,"hashHas");function v3(u,l){var A=this.__data__;return this.size+=this.has(u)?0:1,A[u]=Fl&&l===r?h:l,this}i(v3,"hashSet"),a(v3,"hashSet"),Da.prototype.clear=d3,Da.prototype.delete=h3,Da.prototype.get=p3,Da.prototype.has=m3,Da.prototype.set=v3;function ys(u){var l=-1,A=u==null?0:u.length;for(this.clear();++l<A;){var L=u[l];this.set(L[0],L[1])}}i(ys,"ListCache"),a(ys,"ListCache");function g3(){this.__data__=[],this.size=0}i(g3,"listCacheClear"),a(g3,"listCacheClear");function b3(u){var l=this.__data__,A=jl(l,u);if(A<0)return!1;var L=l.length-1;return A==L?l.pop():th.call(l,A,1),--this.size,!0}i(b3,"listCacheDelete"),a(b3,"listCacheDelete");function y3(u){var l=this.__data__,A=jl(l,u);return A<0?r:l[A][1]}i(y3,"listCacheGet"),a(y3,"listCacheGet");function w3(u){return jl(this.__data__,u)>-1}i(w3,"listCacheHas"),a(w3,"listCacheHas");function _3(u,l){var A=this.__data__,L=jl(A,u);return L<0?(++this.size,A.push([u,l])):A[L][1]=l,this}i(_3,"listCacheSet"),a(_3,"listCacheSet"),ys.prototype.clear=g3,ys.prototype.delete=b3,ys.prototype.get=y3,ys.prototype.has=w3,ys.prototype.set=_3;function ws(u){var l=-1,A=u==null?0:u.length;for(this.clear();++l<A;){var L=u[l];this.set(L[0],L[1])}}i(ws,"MapCache"),a(ws,"MapCache");function E3(){this.size=0,this.__data__={hash:new Da,map:new(Bl||ys),string:new Da}}i(E3,"mapCacheClear"),a(E3,"mapCacheClear");function A3(u){var l=Ql(this,u).delete(u);return this.size-=l?1:0,l}i(A3,"mapCacheDelete"),a(A3,"mapCacheDelete");function S3(u){return Ql(this,u).get(u)}i(S3,"mapCacheGet"),a(S3,"mapCacheGet");function x3(u){return Ql(this,u).has(u)}i(x3,"mapCacheHas"),a(x3,"mapCacheHas");function T3(u,l){var A=Ql(this,u),L=A.size;return A.set(u,l),this.size+=A.size==L?0:1,this}i(T3,"mapCacheSet"),a(T3,"mapCacheSet"),ws.prototype.clear=E3,ws.prototype.delete=A3,ws.prototype.get=S3,ws.prototype.has=x3,ws.prototype.set=T3;function Oa(u){var l=-1,A=u==null?0:u.length;for(this.__data__=new ws;++l<A;)this.add(u[l])}i(Oa,"SetCache"),a(Oa,"SetCache");function M3(u){return this.__data__.set(u,h),this}i(M3,"setCacheAdd"),a(M3,"setCacheAdd");function C3(u){return this.__data__.has(u)}i(C3,"setCacheHas"),a(C3,"setCacheHas"),Oa.prototype.add=Oa.prototype.push=M3,Oa.prototype.has=C3;function Di(u){var l=this.__data__=new ys(u);this.size=l.size}i(Di,"Stack"),a(Di,"Stack");function I3(){this.__data__=new ys,this.size=0}i(I3,"stackClear"),a(I3,"stackClear");function k3(u){var l=this.__data__,A=l.delete(u);return this.size=l.size,A}i(k3,"stackDelete"),a(k3,"stackDelete");function D3(u){return this.__data__.get(u)}i(D3,"stackGet"),a(D3,"stackGet");function O3(u){return this.__data__.has(u)}i(O3,"stackHas"),a(O3,"stackHas");function R3(u,l){var A=this.__data__;if(A instanceof ys){var L=A.__data__;if(!Bl||L.length<s-1)return L.push([u,l]),this.size=++A.size,this;A=this.__data__=new ws(L)}return A.set(u,l),this.size=A.size,this}i(R3,"stackSet"),a(R3,"stackSet"),Di.prototype.clear=I3,Di.prototype.delete=k3,Di.prototype.get=D3,Di.prototype.has=O3,Di.prototype.set=R3;function d1(u,l){var A=Rt(u),L=!A&&Lo(u),Z=!A&&!L&&Fa(u),re=!A&&!L&&!Z&&Qc(u),de=A||L||Z||re,ye=de?Kd(u.length,Rk):[],Ae=ye.length;for(var Be in u)(l||vr.call(u,Be))&&!(de&&(Be=="length"||Z&&(Be=="offset"||Be=="parent")||re&&(Be=="buffer"||Be=="byteLength"||Be=="byteOffset")||Ss(Be,Ae)))&&ye.push(Be);return ye}i(d1,"arrayLikeKeys"),a(d1,"arrayLikeKeys");function h1(u){var l=u.length;return l?u[vh(0,l-1)]:r}i(h1,"arraySample"),a(h1,"arraySample");function N3(u,l){return tf(Mn(u),Ra(l,0,u.length))}i(N3,"arraySampleSize"),a(N3,"arraySampleSize");function P3(u){return tf(Mn(u))}i(P3,"arrayShuffle"),a(P3,"arrayShuffle");function oh(u,l,A){(A!==r&&!Oi(u[l],A)||A===r&&!(l in u))&&_s(u,l,A)}i(oh,"assignMergeValue"),a(oh,"assignMergeValue");function Kc(u,l,A){var L=u[l];(!(vr.call(u,l)&&Oi(L,A))||A===r&&!(l in u))&&_s(u,l,A)}i(Kc,"assignValue"),a(Kc,"assignValue");function jl(u,l){for(var A=u.length;A--;)if(Oi(u[A][0],l))return A;return-1}i(jl,"assocIndexOf"),a(jl,"assocIndexOf");function B3(u,l,A,L){return Na(u,function(Z,re,de){l(L,Z,A(Z),de)}),L}i(B3,"baseAggregator"),a(B3,"baseAggregator");function p1(u,l){return u&&Wi(l,Wr(l),u)}i(p1,"baseAssign"),a(p1,"baseAssign");function L3(u,l){return u&&Wi(l,In(l),u)}i(L3,"baseAssignIn"),a(L3,"baseAssignIn");function _s(u,l,A){l=="__proto__"&&rh?rh(u,l,{configurable:!0,enumerable:!0,value:A,writable:!0}):u[l]=A}i(_s,"baseAssignValue"),a(_s,"baseAssignValue");function ch(u,l){for(var A=-1,L=l.length,Z=Ie(L),re=u==null;++A<L;)Z[A]=re?r:Lh(u,l[A]);return Z}i(ch,"baseAt"),a(ch,"baseAt");function Ra(u,l,A){return u===u&&(A!==r&&(u=u<=A?u:A),l!==r&&(u=u>=l?u:l)),u}i(Ra,"baseClamp"),a(Ra,"baseClamp");function ti(u,l,A,L,Z,re){var de,ye=l&y,Ae=l&b,Be=l&_;if(A&&(de=Z?A(u,L,Z,re):A(u)),de!==r)return de;if(!Cr(u))return u;var Le=Rt(u);if(Le){if(de=M5(u),!ye)return Mn(u,de)}else{var $e=gn(u),Je=$e==ne||$e==oe;if(Fa(u))return P1(u,ye);if($e==fe||$e==F||Je&&!Z){if(de=Ae||Je?{}:tv(u),!ye)return Ae?v5(u,L3(de,u)):m5(u,p1(de,u))}else{if(!mr[$e])return Z?u:{};de=C5(u,$e,ye)}}re||(re=new Di);var pt=re.get(u);if(pt)return pt;re.set(u,de),S4(u)?u.forEach(function(_t){de.add(ti(_t,l,A,_t,u,re))}):v4(u)&&u.forEach(function(_t,Ht){de.set(Ht,ti(_t,l,A,Ht,u,re))});var St=Be?Ae?Mh:Th:Ae?In:Wr,Lt=Le?r:St(u);return Qn(Lt||u,function(_t,Ht){Lt&&(Ht=_t,_t=u[Ht]),Kc(de,Ht,ti(_t,l,A,Ht,u,re))}),de}i(ti,"baseClone"),a(ti,"baseClone");function F3(u){var l=Wr(u);return function(A){return m1(A,u,l)}}i(F3,"baseConforms"),a(F3,"baseConforms");function m1(u,l,A){var L=A.length;if(u==null)return!L;for(u=wr(u);L--;){var Z=A[L],re=l[Z],de=u[Z];if(de===r&&!(Z in u)||!re(de))return!1}return!0}i(m1,"baseConformsTo"),a(m1,"baseConformsTo");function v1(u,l,A){if(typeof u!="function")throw new ki(c);return ef(function(){u.apply(r,A)},l)}i(v1,"baseDelay"),a(v1,"baseDelay");function Vc(u,l,A,L){var Z=-1,re=Ol,de=!0,ye=u.length,Ae=[],Be=l.length;if(!ye)return Ae;A&&(l=Tr(l,Fn(A))),L?(re=Ud,de=!1):l.length>=s&&(re=$c,de=!1,l=new Oa(l));e:for(;++Z<ye;){var Le=u[Z],$e=A==null?Le:A(Le);if(Le=L||Le!==0?Le:0,de&&$e===$e){for(var Je=Be;Je--;)if(l[Je]===$e)continue e;Ae.push(Le)}else re(l,$e,L)||Ae.push(Le)}return Ae}i(Vc,"baseDifference"),a(Vc,"baseDifference");var Na=$1(Gi),U3=$1(uh,!0);function $3(u,l){var A=!0;return Na(u,function(L,Z,re){return A=!!l(L,Z,re),A}),A}i($3,"baseEvery"),a($3,"baseEvery");function zl(u,l,A){for(var L=-1,Z=u.length;++L<Z;){var re=u[L],de=l(re);if(de!=null&&(ye===r?de===de&&!$n(de):A(de,ye)))var ye=de,Ae=re}return Ae}i(zl,"baseExtremum"),a(zl,"baseExtremum");function j3(u,l,A,L){var Z=u.length;for(A=Nt(A),A<0&&(A=-A>Z?0:Z+A),L=L===r||L>Z?Z:Nt(L),L<0&&(L+=Z),L=A>L?0:kv(L);A<L;)u[A++]=l;return u}i(j3,"baseFill"),a(j3,"baseFill");function g1(u,l){var A=[];return Na(u,function(L,Z,re){l(L,Z,re)&&A.push(L)}),A}i(g1,"baseFilter"),a(g1,"baseFilter");function Jr(u,l,A,L,Z){var re=-1,de=u.length;for(A||(A=k5),Z||(Z=[]);++re<de;){var ye=u[re];l>0&&A(ye)?l>1?Jr(ye,l-1,A,L,Z):Qs(Z,ye):L||(Z[Z.length]=ye)}return Z}i(Jr,"baseFlatten"),a(Jr,"baseFlatten");var b1=j1(),z3=j1(!0);function Gi(u,l){return u&&b1(u,l,Wr)}i(Gi,"baseForOwn"),a(Gi,"baseForOwn");function uh(u,l){return u&&z3(u,l,Wr)}i(uh,"baseForOwnRight"),a(uh,"baseForOwnRight");function Hl(u,l){return Xs(l,function(A){return xs(u[A])})}i(Hl,"baseFunctions"),a(Hl,"baseFunctions");function Pa(u,l){l=ra(l,u);for(var A=0,L=l.length;u!=null&&A<L;)u=u[Zi(l[A++])];return A&&A==L?u:r}i(Pa,"baseGet"),a(Pa,"baseGet");function y1(u,l,A){var L=l(u);return Rt(u)?L:Qs(L,A(u))}i(y1,"baseGetAllKeys"),a(y1,"baseGetAllKeys");function vn(u){return u==null?u===r?Ue:_e:Ro&&Ro in wr(u)?A5(u):B5(u)}i(vn,"baseGetTag"),a(vn,"baseGetTag");function lh(u,l){return u>l}i(lh,"baseGt"),a(lh,"baseGt");function H3(u,l){return u!=null&&vr.call(u,l)}i(H3,"baseHas"),a(H3,"baseHas");function q3(u,l){return u!=null&&l in wr(u)}i(q3,"baseHasIn"),a(q3,"baseHasIn");function K3(u,l,A){return u>=mn(l,A)&&u<Gr(l,A)}i(K3,"baseInRange"),a(K3,"baseInRange");function fh(u,l,A){for(var L=A?Ud:Ol,Z=u[0].length,re=u.length,de=re,ye=Ie(re),Ae=1/0,Be=[];de--;){var Le=u[de];de&&l&&(Le=Tr(Le,Fn(l))),Ae=mn(Le.length,Ae),ye[de]=!A&&(l||Z>=120&&Le.length>=120)?new Oa(de&&Le):r}Le=u[0];var $e=-1,Je=ye[0];e:for(;++$e<Z&&Be.length<Ae;){var pt=Le[$e],St=l?l(pt):pt;if(pt=A||pt!==0?pt:0,!(Je?$c(Je,St):L(Be,St,A))){for(de=re;--de;){var Lt=ye[de];if(!(Lt?$c(Lt,St):L(u[de],St,A)))continue e}Je&&Je.push(St),Be.push(pt)}}return Be}i(fh,"baseIntersection"),a(fh,"baseIntersection");function V3(u,l,A,L){return Gi(u,function(Z,re,de){l(L,A(Z),re,de)}),L}i(V3,"baseInverter"),a(V3,"baseInverter");function Gc(u,l,A){l=ra(l,u),u=sv(u,l);var L=u==null?u:u[Zi(ni(l))];return L==null?r:Ln(L,u,A)}i(Gc,"baseInvoke"),a(Gc,"baseInvoke");function w1(u){return kr(u)&&vn(u)==F}i(w1,"baseIsArguments"),a(w1,"baseIsArguments");function G3(u){return kr(u)&&vn(u)==rt}i(G3,"baseIsArrayBuffer"),a(G3,"baseIsArrayBuffer");function W3(u){return kr(u)&&vn(u)==X}i(W3,"baseIsDate"),a(W3,"baseIsDate");function Wc(u,l,A,L,Z){return u===l?!0:u==null||l==null||!kr(u)&&!kr(l)?u!==u&&l!==l:Z3(u,l,A,L,Wc,Z)}i(Wc,"baseIsEqual"),a(Wc,"baseIsEqual");function Z3(u,l,A,L,Z,re){var de=Rt(u),ye=Rt(l),Ae=de?he:gn(u),Be=ye?he:gn(l);Ae=Ae==F?fe:Ae,Be=Be==F?fe:Be;var Le=Ae==fe,$e=Be==fe,Je=Ae==Be;if(Je&&Fa(u)){if(!Fa(l))return!1;de=!0,Le=!1}if(Je&&!Le)return re||(re=new Di),de||Qc(u)?Y1(u,l,A,L,Z,re):_5(u,l,Ae,A,L,Z,re);if(!(A&T)){var pt=Le&&vr.call(u,"__wrapped__"),St=$e&&vr.call(l,"__wrapped__");if(pt||St){var Lt=pt?u.value():u,_t=St?l.value():l;return re||(re=new Di),Z(Lt,_t,A,L,re)}}return Je?(re||(re=new Di),E5(u,l,A,L,Z,re)):!1}i(Z3,"baseIsEqualDeep"),a(Z3,"baseIsEqualDeep");function J3(u){return kr(u)&&gn(u)==ge}i(J3,"baseIsMap"),a(J3,"baseIsMap");function dh(u,l,A,L){var Z=A.length,re=Z,de=!L;if(u==null)return!re;for(u=wr(u);Z--;){var ye=A[Z];if(de&&ye[2]?ye[1]!==u[ye[0]]:!(ye[0]in u))return!1}for(;++Z<re;){ye=A[Z];var Ae=ye[0],Be=u[Ae],Le=ye[1];if(de&&ye[2]){if(Be===r&&!(Ae in u))return!1}else{var $e=new Di;if(L)var Je=L(Be,Le,Ae,u,l,$e);if(!(Je===r?Wc(Le,Be,T|O,L,$e):Je))return!1}}return!0}i(dh,"baseIsMatch"),a(dh,"baseIsMatch");function _1(u){if(!Cr(u)||O5(u))return!1;var l=xs(u)?Fk:tr;return l.test(La(u))}i(_1,"baseIsNative"),a(_1,"baseIsNative");function Y3(u){return kr(u)&&vn(u)==we}i(Y3,"baseIsRegExp"),a(Y3,"baseIsRegExp");function X3(u){return kr(u)&&gn(u)==te}i(X3,"baseIsSet"),a(X3,"baseIsSet");function Q3(u){return kr(u)&&of(u.length)&&!!br[vn(u)]}i(Q3,"baseIsTypedArray"),a(Q3,"baseIsTypedArray");function E1(u){return typeof u=="function"?u:u==null?kn:typeof u=="object"?Rt(u)?x1(u[0],u[1]):S1(u):Lv(u)}i(E1,"baseIteratee"),a(E1,"baseIteratee");function hh(u){if(!Yc(u))return qk(u);var l=[];for(var A in wr(u))vr.call(u,A)&&A!="constructor"&&l.push(A);return l}i(hh,"baseKeys"),a(hh,"baseKeys");function e5(u){if(!Cr(u))return P5(u);var l=Yc(u),A=[];for(var L in u)L=="constructor"&&(l||!vr.call(u,L))||A.push(L);return A}i(e5,"baseKeysIn"),a(e5,"baseKeysIn");function ph(u,l){return u<l}i(ph,"baseLt"),a(ph,"baseLt");function A1(u,l){var A=-1,L=Cn(u)?Ie(u.length):[];return Na(u,function(Z,re,de){L[++A]=l(Z,re,de)}),L}i(A1,"baseMap"),a(A1,"baseMap");function S1(u){var l=Ch(u);return l.length==1&&l[0][2]?nv(l[0][0],l[0][1]):function(A){return A===u||dh(A,u,l)}}i(S1,"baseMatches"),a(S1,"baseMatches");function x1(u,l){return Ih(u)&&rv(l)?nv(Zi(u),l):function(A){var L=Lh(A,u);return L===r&&L===l?Fh(A,u):Wc(l,L,T|O)}}i(x1,"baseMatchesProperty"),a(x1,"baseMatchesProperty");function ql(u,l,A,L,Z){u!==l&&b1(l,function(re,de){if(Z||(Z=new Di),Cr(re))t5(u,l,de,A,ql,L,Z);else{var ye=L?L(Dh(u,de),re,de+"",u,l,Z):r;ye===r&&(ye=re),oh(u,de,ye)}},In)}i(ql,"baseMerge"),a(ql,"baseMerge");function t5(u,l,A,L,Z,re,de){var ye=Dh(u,A),Ae=Dh(l,A),Be=de.get(Ae);if(Be){oh(u,A,Be);return}var Le=re?re(ye,Ae,A+"",u,l,de):r,$e=Le===r;if($e){var Je=Rt(Ae),pt=!Je&&Fa(Ae),St=!Je&&!pt&&Qc(Ae);Le=Ae,Je||pt||St?Rt(ye)?Le=ye:Rr(ye)?Le=Mn(ye):pt?($e=!1,Le=P1(Ae,!0)):St?($e=!1,Le=B1(Ae,!0)):Le=[]:Xc(Ae)||Lo(Ae)?(Le=ye,Lo(ye)?Le=Dv(ye):(!Cr(ye)||xs(ye))&&(Le=tv(Ae))):$e=!1}$e&&(de.set(Ae,Le),Z(Le,Ae,L,re,de),de.delete(Ae)),oh(u,A,Le)}i(t5,"baseMergeDeep"),a(t5,"baseMergeDeep");function T1(u,l){var A=u.length;if(!!A)return l+=l<0?A:0,Ss(l,A)?u[l]:r}i(T1,"baseNth"),a(T1,"baseNth");function M1(u,l,A){l.length?l=Tr(l,function(re){return Rt(re)?function(de){return Pa(de,re.length===1?re[0]:re)}:re}):l=[kn];var L=-1;l=Tr(l,Fn(wt()));var Z=A1(u,function(re,de,ye){var Ae=Tr(l,function(Be){return Be(re)});return{criteria:Ae,index:++L,value:re}});return z6(Z,function(re,de){return p5(re,de,A)})}i(M1,"baseOrderBy"),a(M1,"baseOrderBy");function r5(u,l){return C1(u,l,function(A,L){return Fh(u,L)})}i(r5,"basePick"),a(r5,"basePick");function C1(u,l,A){for(var L=-1,Z=l.length,re={};++L<Z;){var de=l[L],ye=Pa(u,de);A(ye,de)&&Zc(re,ra(de,u),ye)}return re}i(C1,"basePickBy"),a(C1,"basePickBy");function n5(u){return function(l){return Pa(l,u)}}i(n5,"basePropertyDeep"),a(n5,"basePropertyDeep");function mh(u,l,A,L){var Z=L?j6:ko,re=-1,de=l.length,ye=u;for(u===l&&(l=Mn(l)),A&&(ye=Tr(u,Fn(A)));++re<de;)for(var Ae=0,Be=l[re],Le=A?A(Be):Be;(Ae=Z(ye,Le,Ae,L))>-1;)ye!==u&&th.call(ye,Ae,1),th.call(u,Ae,1);return u}i(mh,"basePullAll"),a(mh,"basePullAll");function I1(u,l){for(var A=u?l.length:0,L=A-1;A--;){var Z=l[A];if(A==L||Z!==re){var re=Z;Ss(Z)?th.call(u,Z,1):yh(u,Z)}}return u}i(I1,"basePullAt"),a(I1,"basePullAt");function vh(u,l){return u+ih(o3()*(l-u+1))}i(vh,"baseRandom"),a(vh,"baseRandom");function i5(u,l,A,L){for(var Z=-1,re=Gr(nh((l-u)/(A||1)),0),de=Ie(re);re--;)de[L?re:++Z]=u,u+=A;return de}i(i5,"baseRange"),a(i5,"baseRange");function gh(u,l){var A="";if(!u||l<1||l>S)return A;do l%2&&(A+=u),l=ih(l/2),l&&(u+=u);while(l);return A}i(gh,"baseRepeat"),a(gh,"baseRepeat");function Ft(u,l){return av(iv(u,l,kn),u+"")}i(Ft,"baseRest"),a(Ft,"baseRest");function s5(u){return h1(Fo(u))}i(s5,"baseSample"),a(s5,"baseSample");function a5(u,l){var A=Fo(u);return tf(A,Ra(l,0,A.length))}i(a5,"baseSampleSize"),a(a5,"baseSampleSize");function Zc(u,l,A,L){if(!Cr(u))return u;l=ra(l,u);for(var Z=-1,re=l.length,de=re-1,ye=u;ye!=null&&++Z<re;){var Ae=Zi(l[Z]),Be=A;if(Ae==="__proto__"||Ae==="constructor"||Ae==="prototype")return u;if(Z!=de){var Le=ye[Ae];Be=L?L(Le,Ae,ye):r,Be===r&&(Be=Cr(Le)?Le:Ss(l[Z+1])?[]:{})}Kc(ye,Ae,Be),ye=ye[Ae]}return u}i(Zc,"baseSet"),a(Zc,"baseSet");var o5=sh?function(u,l){return sh.set(u,l),u}:kn,Qk=rh?function(u,l){return rh(u,"toString",{configurable:!0,enumerable:!1,value:Uh(l),writable:!0})}:kn;function c5(u){return tf(Fo(u))}i(c5,"baseShuffle"),a(c5,"baseShuffle");function ri(u,l,A){var L=-1,Z=u.length;l<0&&(l=-l>Z?0:Z+l),A=A>Z?Z:A,A<0&&(A+=Z),Z=l>A?0:A-l>>>0,l>>>=0;for(var re=Ie(Z);++L<Z;)re[L]=u[L+l];return re}i(ri,"baseSlice"),a(ri,"baseSlice");function u5(u,l){var A;return Na(u,function(L,Z,re){return A=l(L,Z,re),!A}),!!A}i(u5,"baseSome"),a(u5,"baseSome");function Kl(u,l,A){var L=0,Z=u==null?L:u.length;if(typeof l=="number"&&l===l&&Z<=$){for(;L<Z;){var re=L+Z>>>1,de=u[re];de!==null&&!$n(de)&&(A?de<=l:de<l)?L=re+1:Z=re}return Z}return bh(u,l,kn,A)}i(Kl,"baseSortedIndex"),a(Kl,"baseSortedIndex");function bh(u,l,A,L){var Z=0,re=u==null?0:u.length;if(re===0)return 0;l=A(l);for(var de=l!==l,ye=l===null,Ae=$n(l),Be=l===r;Z<re;){var Le=ih((Z+re)/2),$e=A(u[Le]),Je=$e!==r,pt=$e===null,St=$e===$e,Lt=$n($e);if(de)var _t=L||St;else Be?_t=St&&(L||Je):ye?_t=St&&Je&&(L||!pt):Ae?_t=St&&Je&&!pt&&(L||!Lt):pt||Lt?_t=!1:_t=L?$e<=l:$e<l;_t?Z=Le+1:re=Le}return mn(re,B)}i(bh,"baseSortedIndexBy"),a(bh,"baseSortedIndexBy");function k1(u,l){for(var A=-1,L=u.length,Z=0,re=[];++A<L;){var de=u[A],ye=l?l(de):de;if(!A||!Oi(ye,Ae)){var Ae=ye;re[Z++]=de===0?0:de}}return re}i(k1,"baseSortedUniq"),a(k1,"baseSortedUniq");function D1(u){return typeof u=="number"?u:$n(u)?C:+u}i(D1,"baseToNumber"),a(D1,"baseToNumber");function Un(u){if(typeof u=="string")return u;if(Rt(u))return Tr(u,Un)+"";if($n(u))return c3?c3.call(u):"";var l=u+"";return l=="0"&&1/u==-g?"-0":l}i(Un,"baseToString"),a(Un,"baseToString");function ta(u,l,A){var L=-1,Z=Ol,re=u.length,de=!0,ye=[],Ae=ye;if(A)de=!1,Z=Ud;else if(re>=s){var Be=l?null:tD(u);if(Be)return Nl(Be);de=!1,Z=$c,Ae=new Oa}else Ae=l?[]:ye;e:for(;++L<re;){var Le=u[L],$e=l?l(Le):Le;if(Le=A||Le!==0?Le:0,de&&$e===$e){for(var Je=Ae.length;Je--;)if(Ae[Je]===$e)continue e;l&&Ae.push($e),ye.push(Le)}else Z(Ae,$e,A)||(Ae!==ye&&Ae.push($e),ye.push(Le))}return ye}i(ta,"baseUniq"),a(ta,"baseUniq");function yh(u,l){return l=ra(l,u),u=sv(u,l),u==null||delete u[Zi(ni(l))]}i(yh,"baseUnset"),a(yh,"baseUnset");function O1(u,l,A,L){return Zc(u,l,A(Pa(u,l)),L)}i(O1,"baseUpdate"),a(O1,"baseUpdate");function Vl(u,l,A,L){for(var Z=u.length,re=L?Z:-1;(L?re--:++re<Z)&&l(u[re],re,u););return A?ri(u,L?0:re,L?re+1:Z):ri(u,L?re+1:0,L?Z:re)}i(Vl,"baseWhile"),a(Vl,"baseWhile");function R1(u,l){var A=u;return A instanceof Vt&&(A=A.value()),$d(l,function(L,Z){return Z.func.apply(Z.thisArg,Qs([L],Z.args))},A)}i(R1,"baseWrapperValue"),a(R1,"baseWrapperValue");function wh(u,l,A){var L=u.length;if(L<2)return L?ta(u[0]):[];for(var Z=-1,re=Ie(L);++Z<L;)for(var de=u[Z],ye=-1;++ye<L;)ye!=Z&&(re[Z]=Vc(re[Z]||de,u[ye],l,A));return ta(Jr(re,1),l,A)}i(wh,"baseXor"),a(wh,"baseXor");function N1(u,l,A){for(var L=-1,Z=u.length,re=l.length,de={};++L<Z;){var ye=L<re?l[L]:r;A(de,u[L],ye)}return de}i(N1,"baseZipObject"),a(N1,"baseZipObject");function _h(u){return Rr(u)?u:[]}i(_h,"castArrayLikeObject"),a(_h,"castArrayLikeObject");function Eh(u){return typeof u=="function"?u:kn}i(Eh,"castFunction"),a(Eh,"castFunction");function ra(u,l){return Rt(u)?u:Ih(u,l)?[u]:U5(dr(u))}i(ra,"castPath"),a(ra,"castPath");var eD=Ft;function na(u,l,A){var L=u.length;return A=A===r?L:A,!l&&A>=L?u:ri(u,l,A)}i(na,"castSlice"),a(na,"castSlice");var l5=Uk||function(u){return Lr.clearTimeout(u)};function P1(u,l){if(l)return u.slice();var A=u.length,L=r3?r3(A):new u.constructor(A);return u.copy(L),L}i(P1,"cloneBuffer"),a(P1,"cloneBuffer");function Ah(u){var l=new u.constructor(u.byteLength);return new Qd(l).set(new Qd(u)),l}i(Ah,"cloneArrayBuffer"),a(Ah,"cloneArrayBuffer");function f5(u,l){var A=l?Ah(u.buffer):u.buffer;return new u.constructor(A,u.byteOffset,u.byteLength)}i(f5,"cloneDataView"),a(f5,"cloneDataView");function d5(u){var l=new u.constructor(u.source,bt.exec(u));return l.lastIndex=u.lastIndex,l}i(d5,"cloneRegExp"),a(d5,"cloneRegExp");function h5(u){return Ul?wr(Ul.call(u)):{}}i(h5,"cloneSymbol"),a(h5,"cloneSymbol");function B1(u,l){var A=l?Ah(u.buffer):u.buffer;return new u.constructor(A,u.byteOffset,u.length)}i(B1,"cloneTypedArray"),a(B1,"cloneTypedArray");function L1(u,l){if(u!==l){var A=u!==r,L=u===null,Z=u===u,re=$n(u),de=l!==r,ye=l===null,Ae=l===l,Be=$n(l);if(!ye&&!Be&&!re&&u>l||re&&de&&Ae&&!ye&&!Be||L&&de&&Ae||!A&&Ae||!Z)return 1;if(!L&&!re&&!Be&&u<l||Be&&A&&Z&&!L&&!re||ye&&A&&Z||!de&&Z||!Ae)return-1}return 0}i(L1,"compareAscending"),a(L1,"compareAscending");function p5(u,l,A){for(var L=-1,Z=u.criteria,re=l.criteria,de=Z.length,ye=A.length;++L<de;){var Ae=L1(Z[L],re[L]);if(Ae){if(L>=ye)return Ae;var Be=A[L];return Ae*(Be=="desc"?-1:1)}}return u.index-l.index}i(p5,"compareMultiple"),a(p5,"compareMultiple");function F1(u,l,A,L){for(var Z=-1,re=u.length,de=A.length,ye=-1,Ae=l.length,Be=Gr(re-de,0),Le=Ie(Ae+Be),$e=!L;++ye<Ae;)Le[ye]=l[ye];for(;++Z<de;)($e||Z<re)&&(Le[A[Z]]=u[Z]);for(;Be--;)Le[ye++]=u[Z++];return Le}i(F1,"composeArgs"),a(F1,"composeArgs");function U1(u,l,A,L){for(var Z=-1,re=u.length,de=-1,ye=A.length,Ae=-1,Be=l.length,Le=Gr(re-ye,0),$e=Ie(Le+Be),Je=!L;++Z<Le;)$e[Z]=u[Z];for(var pt=Z;++Ae<Be;)$e[pt+Ae]=l[Ae];for(;++de<ye;)(Je||Z<re)&&($e[pt+A[de]]=u[Z++]);return $e}i(U1,"composeArgsRight"),a(U1,"composeArgsRight");function Mn(u,l){var A=-1,L=u.length;for(l||(l=Ie(L));++A<L;)l[A]=u[A];return l}i(Mn,"copyArray"),a(Mn,"copyArray");function Wi(u,l,A,L){var Z=!A;A||(A={});for(var re=-1,de=l.length;++re<de;){var ye=l[re],Ae=L?L(A[ye],u[ye],ye,A,u):r;Ae===r&&(Ae=u[ye]),Z?_s(A,ye,Ae):Kc(A,ye,Ae)}return A}i(Wi,"copyObject"),a(Wi,"copyObject");function m5(u,l){return Wi(u,Q1(u),l)}i(m5,"copySymbols"),a(m5,"copySymbols");function v5(u,l){return Wi(u,S5(u),l)}i(v5,"copySymbolsIn"),a(v5,"copySymbolsIn");function Gl(u,l){return function(A,L){var Z=Rt(A)?B6:B3,re=l?l():{};return Z(A,u,wt(L,2),re)}}i(Gl,"createAggregator"),a(Gl,"createAggregator");function No(u){return Ft(function(l,A){var L=-1,Z=A.length,re=Z>1?A[Z-1]:r,de=Z>2?A[2]:r;for(re=u.length>3&&typeof re=="function"?(Z--,re):r,de&&bn(A[0],A[1],de)&&(re=Z<3?r:re,Z=1),l=wr(l);++L<Z;){var ye=A[L];ye&&u(l,ye,L,re)}return l})}i(No,"createAssigner"),a(No,"createAssigner");function $1(u,l){return function(A,L){if(A==null)return A;if(!Cn(A))return u(A,L);for(var Z=A.length,re=l?Z:-1,de=wr(A);(l?re--:++re<Z)&&L(de[re],re,de)!==!1;);return A}}i($1,"createBaseEach"),a($1,"createBaseEach");function j1(u){return function(l,A,L){for(var Z=-1,re=wr(l),de=L(l),ye=de.length;ye--;){var Ae=de[u?ye:++Z];if(A(re[Ae],Ae,re)===!1)break}return l}}i(j1,"createBaseFor"),a(j1,"createBaseFor");function g5(u,l,A){var L=l&R,Z=Jc(u);function re(){var de=this&&this!==Lr&&this instanceof re?Z:u;return de.apply(L?A:this,arguments)}return i(re,"wrapper"),a(re,"wrapper"),re}i(g5,"createBind"),a(g5,"createBind");function z1(u){return function(l){l=dr(l);var A=Do(l)?Ii(l):r,L=A?A[0]:l.charAt(0),Z=A?na(A,1).join(""):l.slice(1);return L[u]()+Z}}i(z1,"createCaseFirst"),a(z1,"createCaseFirst");function Po(u){return function(l){return $d(Bv(Nv(l).replace(Cl,"")),u,"")}}i(Po,"createCompounder"),a(Po,"createCompounder");function Jc(u){return function(){var l=arguments;switch(l.length){case 0:return new u;case 1:return new u(l[0]);case 2:return new u(l[0],l[1]);case 3:return new u(l[0],l[1],l[2]);case 4:return new u(l[0],l[1],l[2],l[3]);case 5:return new u(l[0],l[1],l[2],l[3],l[4]);case 6:return new u(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new u(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var A=qc(u.prototype),L=u.apply(A,l);return Cr(L)?L:A}}i(Jc,"createCtor"),a(Jc,"createCtor");function b5(u,l,A){var L=Jc(u);function Z(){for(var re=arguments.length,de=Ie(re),ye=re,Ae=Bo(Z);ye--;)de[ye]=arguments[ye];var Be=re<3&&de[0]!==Ae&&de[re-1]!==Ae?[]:ea(de,Ae);if(re-=Be.length,re<A)return G1(u,l,Wl,Z.placeholder,r,de,Be,r,r,A-re);var Le=this&&this!==Lr&&this instanceof Z?L:u;return Ln(Le,this,de)}return i(Z,"wrapper"),a(Z,"wrapper"),Z}i(b5,"createCurry"),a(b5,"createCurry");function H1(u){return function(l,A,L){var Z=wr(l);if(!Cn(l)){var re=wt(A,3);l=Wr(l),A=a(function(ye){return re(Z[ye],ye,Z)},"predicate")}var de=u(l,A,L);return de>-1?Z[re?l[de]:de]:r}}i(H1,"createFind"),a(H1,"createFind");function q1(u){return As(function(l){var A=l.length,L=A,Z=ei.prototype.thru;for(u&&l.reverse();L--;){var re=l[L];if(typeof re!="function")throw new ki(c);if(Z&&!de&&Xl(re)=="wrapper")var de=new ei([],!0)}for(L=de?L:A;++L<A;){re=l[L];var ye=Xl(re),Ae=ye=="wrapper"?X1(re):r;Ae&&kh(Ae[0])&&Ae[1]==(I|U|V|H)&&!Ae[4].length&&Ae[9]==1?de=de[Xl(Ae[0])].apply(de,Ae[3]):de=re.length==1&&kh(re)?de[ye]():de.thru(re)}return function(){var Be=arguments,Le=Be[0];if(de&&Be.length==1&&Rt(Le))return de.plant(Le).value();for(var $e=0,Je=A?l[$e].apply(this,Be):Le;++$e<A;)Je=l[$e].call(this,Je);return Je}})}i(q1,"createFlow"),a(q1,"createFlow");function Wl(u,l,A,L,Z,re,de,ye,Ae,Be){var Le=l&I,$e=l&R,Je=l&P,pt=l&(U|j),St=l&ae,Lt=Je?r:Jc(u);function _t(){for(var Ht=arguments.length,Gt=Ie(Ht),jn=Ht;jn--;)Gt[jn]=arguments[jn];if(pt)var yn=Bo(_t),zn=q6(Gt,yn);if(L&&(Gt=F1(Gt,L,Z,pt)),re&&(Gt=U1(Gt,re,de,pt)),Ht-=zn,pt&&Ht<Be){var Fr=ea(Gt,yn);return G1(u,l,Wl,_t.placeholder,A,Gt,Fr,ye,Ae,Be-Ht)}var Ji=$e?A:this,ia=Je?Ji[u]:u;return Ht=Gt.length,ye?Gt=L5(Gt,ye):St&&Ht>1&&Gt.reverse(),Le&&Ae<Ht&&(Gt.length=Ae),this&&this!==Lr&&this instanceof _t&&(ia=Lt||Jc(ia)),ia.apply(Ji,Gt)}return i(_t,"wrapper"),a(_t,"wrapper"),_t}i(Wl,"createHybrid"),a(Wl,"createHybrid");function K1(u,l){return function(A,L){return V3(A,u,l(L),{})}}i(K1,"createInverter"),a(K1,"createInverter");function Zl(u,l){return function(A,L){var Z;if(A===r&&L===r)return l;if(A!==r&&(Z=A),L!==r){if(Z===r)return L;typeof A=="string"||typeof L=="string"?(A=Un(A),L=Un(L)):(A=D1(A),L=D1(L)),Z=u(A,L)}return Z}}i(Zl,"createMathOperation"),a(Zl,"createMathOperation");function Sh(u){return As(function(l){return l=Tr(l,Fn(wt())),Ft(function(A){var L=this;return u(l,function(Z){return Ln(Z,L,A)})})})}i(Sh,"createOver"),a(Sh,"createOver");function Jl(u,l){l=l===r?" ":Un(l);var A=l.length;if(A<2)return A?gh(l,u):l;var L=gh(l,nh(u/Oo(l)));return Do(l)?na(Ii(L),0,u).join(""):L.slice(0,u)}i(Jl,"createPadding"),a(Jl,"createPadding");function y5(u,l,A,L){var Z=l&R,re=Jc(u);function de(){for(var ye=-1,Ae=arguments.length,Be=-1,Le=L.length,$e=Ie(Le+Ae),Je=this&&this!==Lr&&this instanceof de?re:u;++Be<Le;)$e[Be]=L[Be];for(;Ae--;)$e[Be++]=arguments[++ye];return Ln(Je,Z?A:this,$e)}return i(de,"wrapper"),a(de,"wrapper"),de}i(y5,"createPartial"),a(y5,"createPartial");function V1(u){return function(l,A,L){return L&&typeof L!="number"&&bn(l,A,L)&&(A=L=r),l=Ts(l),A===r?(A=l,l=0):A=Ts(A),L=L===r?l<A?1:-1:Ts(L),i5(l,A,L,u)}}i(V1,"createRange"),a(V1,"createRange");function Yl(u){return function(l,A){return typeof l=="string"&&typeof A=="string"||(l=ii(l),A=ii(A)),u(l,A)}}i(Yl,"createRelationalOperation"),a(Yl,"createRelationalOperation");function G1(u,l,A,L,Z,re,de,ye,Ae,Be){var Le=l&U,$e=Le?de:r,Je=Le?r:de,pt=Le?re:r,St=Le?r:re;l|=Le?V:G,l&=~(Le?G:V),l&K||(l&=~(R|P));var Lt=[u,l,Z,pt,$e,St,Je,ye,Ae,Be],_t=A.apply(r,Lt);return kh(u)&&F5(_t,Lt),_t.placeholder=L,ov(_t,u,l)}i(G1,"createRecurry"),a(G1,"createRecurry");function xh(u){var l=Vr[u];return function(A,L){if(A=ii(A),L=L==null?0:mn(Nt(L),292),L&&a3(A)){var Z=(dr(A)+"e").split("e"),re=l(Z[0]+"e"+(+Z[1]+L));return Z=(dr(re)+"e").split("e"),+(Z[0]+"e"+(+Z[1]-L))}return l(A)}}i(xh,"createRound"),a(xh,"createRound");var tD=zc&&1/Nl(new zc([,-0]))[1]==g?function(u){return new zc(u)}:zh;function W1(u){return function(l){var A=gn(l);return A==ge?Gd(l):A==te?Z6(l):H6(l,u(l))}}i(W1,"createToPairs"),a(W1,"createToPairs");function Es(u,l,A,L,Z,re,de,ye){var Ae=l&P;if(!Ae&&typeof u!="function")throw new ki(c);var Be=L?L.length:0;if(Be||(l&=~(V|G),L=Z=r),de=de===r?de:Gr(Nt(de),0),ye=ye===r?ye:Nt(ye),Be-=Z?Z.length:0,l&G){var Le=L,$e=Z;L=Z=r}var Je=Ae?r:X1(u),pt=[u,l,A,L,Z,Le,$e,re,de,ye];if(Je&&N5(pt,Je),u=pt[0],l=pt[1],A=pt[2],L=pt[3],Z=pt[4],ye=pt[9]=pt[9]===r?Ae?0:u.length:Gr(pt[9]-Be,0),!ye&&l&(U|j)&&(l&=~(U|j)),!l||l==R)var St=g5(u,l,A);else l==U||l==j?St=b5(u,l,ye):(l==V||l==(R|V))&&!Z.length?St=y5(u,l,A,L):St=Wl.apply(r,pt);var Lt=Je?o5:F5;return ov(Lt(St,pt),u,l)}i(Es,"createWrap"),a(Es,"createWrap");function Z1(u,l,A,L){return u===r||Oi(u,jc[A])&&!vr.call(L,A)?l:u}i(Z1,"customDefaultsAssignIn"),a(Z1,"customDefaultsAssignIn");function J1(u,l,A,L,Z,re){return Cr(u)&&Cr(l)&&(re.set(l,u),ql(u,l,r,J1,re),re.delete(l)),u}i(J1,"customDefaultsMerge"),a(J1,"customDefaultsMerge");function w5(u){return Xc(u)?r:u}i(w5,"customOmitClone"),a(w5,"customOmitClone");function Y1(u,l,A,L,Z,re){var de=A&T,ye=u.length,Ae=l.length;if(ye!=Ae&&!(de&&Ae>ye))return!1;var Be=re.get(u),Le=re.get(l);if(Be&&Le)return Be==l&&Le==u;var $e=-1,Je=!0,pt=A&O?new Oa:r;for(re.set(u,l),re.set(l,u);++$e<ye;){var St=u[$e],Lt=l[$e];if(L)var _t=de?L(Lt,St,$e,l,u,re):L(St,Lt,$e,u,l,re);if(_t!==r){if(_t)continue;Je=!1;break}if(pt){if(!jd(l,function(Ht,Gt){if(!$c(pt,Gt)&&(St===Ht||Z(St,Ht,A,L,re)))return pt.push(Gt)})){Je=!1;break}}else if(!(St===Lt||Z(St,Lt,A,L,re))){Je=!1;break}}return re.delete(u),re.delete(l),Je}i(Y1,"equalArrays"),a(Y1,"equalArrays");function _5(u,l,A,L,Z,re,de){switch(A){case le:if(u.byteLength!=l.byteLength||u.byteOffset!=l.byteOffset)return!1;u=u.buffer,l=l.buffer;case rt:return!(u.byteLength!=l.byteLength||!re(new Qd(u),new Qd(l)));case Q:case X:case ke:return Oi(+u,+l);case z:return u.name==l.name&&u.message==l.message;case we:case ve:return u==l+"";case ge:var ye=Gd;case te:var Ae=L&T;if(ye||(ye=Nl),u.size!=l.size&&!Ae)return!1;var Be=de.get(u);if(Be)return Be==l;L|=O,de.set(u,l);var Le=Y1(ye(u),ye(l),L,Z,re,de);return de.delete(u),Le;case Me:if(Ul)return Ul.call(u)==Ul.call(l)}return!1}i(_5,"equalByTag"),a(_5,"equalByTag");function E5(u,l,A,L,Z,re){var de=A&T,ye=Th(u),Ae=ye.length,Be=Th(l),Le=Be.length;if(Ae!=Le&&!de)return!1;for(var $e=Ae;$e--;){var Je=ye[$e];if(!(de?Je in l:vr.call(l,Je)))return!1}var pt=re.get(u),St=re.get(l);if(pt&&St)return pt==l&&St==u;var Lt=!0;re.set(u,l),re.set(l,u);for(var _t=de;++$e<Ae;){Je=ye[$e];var Ht=u[Je],Gt=l[Je];if(L)var jn=de?L(Gt,Ht,Je,l,u,re):L(Ht,Gt,Je,u,l,re);if(!(jn===r?Ht===Gt||Z(Ht,Gt,A,L,re):jn)){Lt=!1;break}_t||(_t=Je=="constructor")}if(Lt&&!_t){var yn=u.constructor,zn=l.constructor;yn!=zn&&"constructor"in u&&"constructor"in l&&!(typeof yn=="function"&&yn instanceof yn&&typeof zn=="function"&&zn instanceof zn)&&(Lt=!1)}return re.delete(u),re.delete(l),Lt}i(E5,"equalObjects"),a(E5,"equalObjects");function As(u){return av(iv(u,r,dv),u+"")}i(As,"flatRest"),a(As,"flatRest");function Th(u){return y1(u,Wr,Q1)}i(Th,"getAllKeys"),a(Th,"getAllKeys");function Mh(u){return y1(u,In,S5)}i(Mh,"getAllKeysIn"),a(Mh,"getAllKeysIn");var X1=sh?function(u){return sh.get(u)}:zh;function Xl(u){for(var l=u.name+"",A=Hc[l],L=vr.call(Hc,l)?A.length:0;L--;){var Z=A[L],re=Z.func;if(re==null||re==u)return Z.name}return l}i(Xl,"getFuncName"),a(Xl,"getFuncName");function Bo(u){var l=vr.call(ee,"placeholder")?ee:u;return l.placeholder}i(Bo,"getHolder"),a(Bo,"getHolder");function wt(){var u=ee.iteratee||$h;return u=u===$h?E1:u,arguments.length?u(arguments[0],arguments[1]):u}i(wt,"getIteratee"),a(wt,"getIteratee");function Ql(u,l){var A=u.__data__;return D5(l)?A[typeof l=="string"?"string":"hash"]:A.map}i(Ql,"getMapData"),a(Ql,"getMapData");function Ch(u){for(var l=Wr(u),A=l.length;A--;){var L=l[A],Z=u[L];l[A]=[L,Z,rv(Z)]}return l}i(Ch,"getMatchData"),a(Ch,"getMatchData");function Ba(u,l){var A=V6(u,l);return _1(A)?A:r}i(Ba,"getNative"),a(Ba,"getNative");function A5(u){var l=vr.call(u,Ro),A=u[Ro];try{u[Ro]=r;var L=!0}catch{}var Z=Yd.call(u);return L&&(l?u[Ro]=A:delete u[Ro]),Z}i(A5,"getRawTag"),a(A5,"getRawTag");var Q1=u1?function(u){return u==null?[]:(u=wr(u),Xs(u1(u),function(l){return i3.call(u,l)}))}:Hh,S5=u1?function(u){for(var l=[];u;)Qs(l,Q1(u)),u=eh(u);return l}:Hh,gn=vn;(l1&&gn(new l1(new ArrayBuffer(1)))!=le||Bl&&gn(new Bl)!=ge||f1&&gn(f1.resolve())!=Ce||zc&&gn(new zc)!=te||Ll&&gn(new Ll)!=Re)&&(gn=a(function(u){var l=vn(u),A=l==fe?u.constructor:r,L=A?La(A):"";if(L)switch(L){case Wk:return le;case Zk:return ge;case Jk:return Ce;case Yk:return te;case Xk:return Re}return l},"getTag"));function x5(u,l,A){for(var L=-1,Z=A.length;++L<Z;){var re=A[L],de=re.size;switch(re.type){case"drop":u+=de;break;case"dropRight":l-=de;break;case"take":l=mn(l,u+de);break;case"takeRight":u=Gr(u,l-de);break}}return{start:u,end:l}}i(x5,"getView"),a(x5,"getView");function T5(u){var l=u.match(Ze);return l?l[1].split(cr):[]}i(T5,"getWrapDetails"),a(T5,"getWrapDetails");function ev(u,l,A){l=ra(l,u);for(var L=-1,Z=l.length,re=!1;++L<Z;){var de=Zi(l[L]);if(!(re=u!=null&&A(u,de)))break;u=u[de]}return re||++L!=Z?re:(Z=u==null?0:u.length,!!Z&&of(Z)&&Ss(de,Z)&&(Rt(u)||Lo(u)))}i(ev,"hasPath"),a(ev,"hasPath");function M5(u){var l=u.length,A=new u.constructor(l);return l&&typeof u[0]=="string"&&vr.call(u,"index")&&(A.index=u.index,A.input=u.input),A}i(M5,"initCloneArray"),a(M5,"initCloneArray");function tv(u){return typeof u.constructor=="function"&&!Yc(u)?qc(eh(u)):{}}i(tv,"initCloneObject"),a(tv,"initCloneObject");function C5(u,l,A){var L=u.constructor;switch(l){case rt:return Ah(u);case Q:case X:return new L(+u);case le:return f5(u,A);case ce:case Y:case ie:case be:case Se:case xe:case De:case Mt:case qe:return B1(u,A);case ge:return new L;case ke:case ve:return new L(u);case we:return d5(u);case te:return new L;case Me:return h5(u)}}i(C5,"initCloneByTag"),a(C5,"initCloneByTag");function I5(u,l){var A=l.length;if(!A)return u;var L=A-1;return l[L]=(A>1?"& ":"")+l[L],l=l.join(A>2?", ":" "),u.replace(at,`{
24
+ `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl")});function rb(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(rb,"arrRemove");var qp=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,s,o;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var f=tb(c),h=f.next();!h.done;h=f.next()){var p=h.value;p.remove(this)}}catch(O){t={error:O}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}else c.remove(this);var v=this.initialTeardown;if(Bi(v))try{v()}catch(O){o=O instanceof Hp?O.errors:[O]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=tb(y),_=b.next();!_.done;_=b.next()){var T=_.value;try{qE(T)}catch(O){o=o??[],O instanceof Hp?o=_u(_u([],wu(o)),wu(O.errors)):o.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(s=b.return)&&s.call(b)}finally{if(n)throw n.error}}}if(o)throw new Hp(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)qE(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)&&rb(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&rb(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var kW=qp.EMPTY;function Kp(e){return e instanceof qp||e&&"closed"in e&&Bi(e.remove)&&Bi(e.add)&&Bi(e.unsubscribe)}i(Kp,"isSubscription");function qE(e){Bi(e)?e():e.unsubscribe()}i(qE,"execFinalizer");var ts={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var Eu={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var s=Eu.delegate;return s?.setTimeout?s.setTimeout.apply(s,_u([e,t],wu(r))):setTimeout.apply(void 0,_u([e,t],wu(r)))},clearTimeout:function(e){var t=Eu.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function KE(e){Eu.setTimeout(function(){var t=ts.onUnhandledError;if(t)t(e);else throw e})}i(KE,"reportUnhandledError");function nb(){}i(nb,"noop");var VE=function(){return ib("C",void 0,void 0)}();function GE(e){return ib("E",void 0,e)}i(GE,"errorNotification");function WE(e){return ib("N",e,void 0)}i(WE,"nextNotification");function ib(e,t,r){return{kind:e,value:t,error:r}}i(ib,"createNotification");var Qo=null;function ZE(e){if(ts.useDeprecatedSynchronousErrorHandling){var t=!Qo;if(t&&(Qo={errorThrown:!1,error:null}),e(),t){var r=Qo,n=r.errorThrown,s=r.error;if(Qo=null,n)throw s}}else e()}i(ZE,"errorContext");function JE(e){ts.useDeprecatedSynchronousErrorHandling&&Qo&&(Qo.errorThrown=!0,Qo.error=e)}i(JE,"captureError");var ob=function(e){eb(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,Kp(r)&&r.add(n)):n.destination=hL,n}return i(t,"Subscriber"),t.create=function(r,n,s){return new Gp(r,n,s)},t.prototype.next=function(r){this.isStopped?ab(WE(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?ab(GE(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?ab(VE,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}(qp);var lL=Function.prototype.bind;function sb(e,t){return lL.call(e,t)}i(sb,"bind");var fL=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){Vp(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Vp(n)}else Vp(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Vp(r)}},e}(),Gp=function(e){eb(t,e);function t(r,n,s){var o=e.call(this)||this,c;if(Bi(r)||!r)c={next:r??void 0,error:n??void 0,complete:s??void 0};else{var f;o&&ts.useDeprecatedNextContext?(f=Object.create(r),f.unsubscribe=function(){return o.unsubscribe()},c={next:r.next&&sb(r.next,f),error:r.error&&sb(r.error,f),complete:r.complete&&sb(r.complete,f)}):c=r}return o.destination=new fL(c),o}return i(t,"SafeSubscriber"),t}(ob);function Vp(e){ts.useDeprecatedSynchronousErrorHandling?JE(e):KE(e)}i(Vp,"handleUnhandledError");function dL(e){throw e}i(dL,"defaultErrorHandler");function ab(e,t){var r=ts.onStoppedNotification;r&&Eu.setTimeout(function(){return r(e,t)})}i(ab,"handleStoppedNotification");var hL={closed:!0,next:nb,error:dL,complete:nb};var YE=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function XE(e){return e}i(XE,"identity");function QE(e){return e.length===0?XE:e.length===1?e[0]:i(function(r){return e.reduce(function(n,s){return s(n)},r)},"piped")}i(QE,"pipeFromArray");var cb=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 s=this,o=mL(t)?t:new Gp(t,r,n);return ZE(function(){var c=s,f=c.operator,h=c.source;o.add(f?f.call(o,h):h?s._subscribe(o):s._trySubscribe(o))}),o},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=e7(r),new r(function(s,o){var c=new Gp({next:function(f){try{t(f)}catch(h){o(h),c.unsubscribe()}},error:o,complete:s});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[YE]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return QE(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=e7(t),new t(function(n,s){var o;r.subscribe(function(c){return o=c},function(c){return s(c)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function e7(e){var t;return(t=e??ts.Promise)!==null&&t!==void 0?t:Promise}i(e7,"getPromiseCtor");function pL(e){return e&&Bi(e.next)&&Bi(e.error)&&Bi(e.complete)}i(pL,"isObserver");function mL(e){return e&&e instanceof ob||pL(e)&&Kp(e)}i(mL,"isSubscriber");var t7;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(t7||(t7={}));var r7;(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"})(r7||(r7={}));var lb;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(lb||(lb={}));var If=class extends cb{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,ub.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===lb.ANCHOR).map(({cid:t})=>hr.make(this.id,t))}get state(){return(0,ub.default)(this.state$.value)}async sync(t={}){t={sync:Xo.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(If,"Stream");function n7(){return e=>{}}i(n7,"StreamStatic");var vL=function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},fi,fb={anchor:!0,publish:!0,pin:!0,sync:Xo.PREFER_CACHE},gL={sync:Xo.PREFER_CACHE},i7={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function db(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=sg((0,o7.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(db,"headerFromMetadata");async function s7(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(s7,"getAuthenticatedDID");async function hb(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(hb,"throwReadOnlyError");var Ha=fi=i(class extends If{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,a7.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,s={}){s={...fb,...s},!n?.deterministic&&s.syncTimeoutSeconds==null&&(s.syncTimeoutSeconds=0);let o=s.asDID?{did:s.asDID}:t,c=await fi.makeGenesis(o,r,n);return t.createStreamFromGenesis(fi.STREAM_TYPE_ID,c,s)}static async createFromGenesis(t,r,n={}){n={...fb,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let s=r.data?await fi._signDagJWS(t,r):r;return t.createStreamFromGenesis(fi.STREAM_TYPE_ID,s,n)}static async deterministic(t,r,n={}){if(n={...fb,...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 s=await fi.makeGenesis(t,null,r);return t.createStreamFromGenesis(fi.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...gL,...n};let s=Go.from(r);if(s.type!=fi.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${fi.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return t.loadStream(s,n)}async update(t,r,n={}){n={...i7,...n};let s=n.asDID?{did:n.asDID}:this.api,o=await this.makeCommit(s,t,r),c=await this.api.applyCommit(this.id,o,n);this.state$.next(c.state)}async patch(t,r={}){r={...i7,...r};let s={header:db(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},o=await fi._signDagJWS(this.api,s),c=await this.api.applyCommit(this.id,o,r);this.state$.next(c.state)}makeReadOnly(){this.update=hb,this.patch=hb,this.sync=hb,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let s=await this._makeRawCommit(r,n);return fi._signDagJWS(t,s)}async _makeRawCommit(t,r){r||(r={});let n=db(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 s=U9.compare(this.content,t),o=this.state.log[0];return{header:n,data:s,prev:this.tip,id:o.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await s7(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 s=db(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:s};return bg(c),c}let o={data:r,header:s};return fi._signDagJWS(t,o)}static async _signDagJWS(t,r){return(await s7(t)).createDagJWS(r)}},"TileDocument");Ha.STREAM_TYPE_NAME="tile";Ha.STREAM_TYPE_ID=0;Ha=fi=vL([n7()],Ha);var p7=Uo(l7(),1);function ML(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(ML,"_checkPrivateRedeclaration");function CL(e,t){return t.get?t.get.call(e):t.value}i(CL,"_classApplyDescriptorGet");function IL(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(IL,"_classApplyDescriptorSet");function h7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(h7,"_classExtractFieldDescriptor");function gb(e,t){var r=h7(e,t,"get");return CL(e,r)}i(gb,"_classPrivateFieldGet");function f7(e,t,r){ML(e,t),t.set(e,r)}i(f7,"_classPrivateFieldInit");function d7(e,t,r){var n=h7(e,t,"set");return IL(e,n,r),r}i(d7,"_classPrivateFieldSet");function kL(e){return typeof e=="string"||hr.isInstance(e)||Yt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(kL,"keyToQuery");function bb(e){return typeof e=="string"?Go.from(e).toString():hr.isInstance(e)||Yt.isInstance(e)?e.toString():e.streamId.toString()}i(bb,"keyToString");async function wb(e){let t=await Ha.makeGenesis({},null,{...e,deterministic:!0}),r=await Yt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(wb,"getDeterministicQuery");var DL=i(()=>Promise.resolve([]),"tempBatchLoadFn"),Wp=new WeakMap,yb=new WeakMap,ec=class extends p7.default{cache(t){if(!gb(this,yb))return!1;let r=t.id.toString();return this.clear(r).prime(r,t),!0}async create(t,r,n){let s=await Ha.create(gb(this,Wp),t,r,n);return this.cache(s),s}async deterministic(t,r){let n=await wb(t);try{return await super.load(n)}catch{let o=await Ha.createFromGenesis(gb(this,Wp),n.genesis,r);return this.cache(o),o}}async load(t){return await super.load(t)}async update(t,r,n,s){let o=bb(t);this.clear(o);let c=await this.load({streamId:o});return await c.update(r,n,s),c}constructor(t){super(DL,{cache:!0,cacheKeyFn:bb,cacheMap:t.cache!=null&&typeof t.cache!="boolean"?t.cache:void 0}),f7(this,Wp,{writable:!0,value:void 0}),f7(this,yb,{writable:!0,value:void 0}),this._batchLoadFn=async r=>{t.cache||this.clearAll();let n=await t.ceramic.multiQuery(r.map(kL),t.multiqueryTimeout);return r.map(s=>{let o=bb(s),c=n[o];return c||new Error(`Failed to load stream: ${o}`)})},d7(this,Wp,t.ceramic),d7(this,yb,!!t.cache)}};i(ec,"TileLoader");function OL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(OL,"_checkPrivateRedeclaration");function RL(e,t){return t.get?t.get.call(e):t.value}i(RL,"_classApplyDescriptorGet");function NL(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(NL,"_classApplyDescriptorSet");function v7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(v7,"_classExtractFieldDescriptor");function tc(e,t){var r=v7(e,t,"get");return RL(e,r)}i(tc,"_classPrivateFieldGet");function m7(e,t,r){OL(e,t),t.set(e,r)}i(m7,"_classPrivateFieldInit");function _b(e,t,r){var n=v7(e,t,"set");return NL(e,n,r),r}i(_b,"_classPrivateFieldSet");var Au=new WeakMap,Su=new WeakMap,xu=class{get aliases(){return tc(this,Au)}get loader(){return tc(this,Su)}getDefinitionID(t){return tc(this,Au).definitions[t]??null}getSchemaURL(t){return tc(this,Au).schemas[t]??null}getTileID(t){return tc(this,Au).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 tc(this,Su).load(r)}async createTile(t,r,n={}){let s=this.getSchemaURL(t);if(s==null)throw new Error(`Schema alias "${t}" is not defined`);let{controller:o,...c}=n,f={schema:s};return o!=null&&(f.controllers=[o]),await tc(this,Su).create(r,f,c)}constructor(t){if(m7(this,Au,{writable:!0,value:void 0}),m7(this,Su,{writable:!0,value:void 0}),_b(this,Au,t.aliases),t.loader!=null)_b(this,Su,t.loader);else{if(t.ceramic==null)throw new Error("Invalid DataModel parameters: missing ceramic or loader");_b(this,Su,new ec({ceramic:t.ceramic,cache:t.cache}))}}};i(xu,"DataModel");function PL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(PL,"_checkPrivateRedeclaration");function BL(e,t){return t.get?t.get.call(e):t.value}i(BL,"_classApplyDescriptorGet");function LL(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(LL,"_classApplyDescriptorSet");function g7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(g7,"_classExtractFieldDescriptor");function ks(e,t){var r=g7(e,t,"get");return BL(e,r)}i(ks,"_classPrivateFieldGet");function Zp(e,t,r){PL(e,t),t.set(e,r)}i(Zp,"_classPrivateFieldInit");function Jp(e,t,r){var n=g7(e,t,"set");return LL(e,n,r),r}i(Jp,"_classPrivateFieldSet");var Yp=new WeakMap,rc=new WeakMap,Eb=new WeakMap,Xp=new WeakMap,kf=class{_createValuePromise(){Jp(this,Eb,new Promise((t,r)=>{Jp(this,Xp,{resolve:t,reject:r})}))}change(t){return new Promise((r,n)=>{let s=i(async o=>{try{let c=await t(o);r(),this._next(c)}catch(c){n(c),this._next(o)}},"run");ks(this,rc).push({reject:n,run:s}),ks(this,rc).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 ks(this,rc).length===0?await ks(this,Yp).call(this):await ks(this,Eb)}async _start(){try{let t=await ks(this,Yp).call(this);this._next(t)}catch(t){ks(this,rc).forEach(r=>{r.reject(t)}),Jp(this,rc,[]),ks(this,Xp).reject(t),this._createValuePromise()}}_next(t){let r=ks(this,rc).shift();r==null?this._end(t):r.run(t)}_end(t){ks(this,Xp).resolve(t),this._createValuePromise()}constructor(t){Zp(this,Yp,{writable:!0,value:void 0}),Zp(this,rc,{writable:!0,value:[]}),Zp(this,Eb,{writable:!0,value:void 0}),Zp(this,Xp,{writable:!0,value:void 0}),Jp(this,Yp,t),this._createValuePromise()}};i(kf,"TileProxy");var FL=/^did:([A-Za-z0-9]+):([A-Za-z0-9.\-:_]+)$/;function UL(e){return FL.test(e)}i(UL,"isDIDstring");function $L(e){if(!UL(e))throw new Error(`Invalid DID: ${e}`)}i($L,"assertDIDstring");function Ab(e){return $L(e),{controllers:[e],family:"IDX"}}i(Ab,"getIDXMetadata");function jL(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(jL,"_checkPrivateRedeclaration");function zL(e,t){return t.get?t.get.call(e):t.value}i(zL,"_classApplyDescriptorGet");function HL(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(HL,"_classApplyDescriptorSet");function b7(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(b7,"_classExtractFieldDescriptor");function Ur(e,t){var r=b7(e,t,"get");return zL(e,r)}i(Ur,"_classPrivateFieldGet");function Df(e,t,r){jL(e,t),t.set(e,r)}i(Df,"_classPrivateFieldInit");function Qp(e,t,r){var n=b7(e,t,"set");return HL(e,n,r),r}i(Qp,"_classPrivateFieldSet");var la=new WeakMap,e0=new WeakMap,Sb=new WeakMap,Ds=new WeakMap,t0=new WeakMap,Of=class{get authenticated(){return Ur(this,la).did!=null}get ceramic(){return Ur(this,la)}get id(){if(Ur(this,e0)!=null)return Ur(this,e0);if(Ur(this,la).did==null)throw new Error("Ceramic instance is not authenticated");return Ur(this,la).did.hasParent?Ur(this,la).did.parent:Ur(this,la).did.id}get loader(){return Ur(this,Ds)}get model(){return Ur(this,t0)}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),s=await Promise.all(r.map(async f=>{let{genesis:h,streamId:p}=await wb(Ab(f));return{genesis:h,streamId:p.toString(),paths:[n]}})),o=await Ur(this,la).multiQuery(s),c=[];for(let f of s){let h=o[f.streamId]?.content?.[n],p=h?o[Yt.fromString(h).toString()]:null;c.push(p?.content??null)}return c}async set(t,r,n={}){let s=this.getDefinitionID(t),[o,c]=await this._setRecordOnly(s,r,n);return o&&await this._setReference(n.controller??this.id,s,c),c}async merge(t,r,n={}){let s=this.getDefinitionID(t),o=await this.getRecord(s),c=o?{...o,...r}:r;return await this.setRecord(s,c,n)}async setAll(t,r={}){let n=Object.entries(t).map(async([c,f])=>{let h=this.getDefinitionID(c),[p,v]=await this._setRecordOnly(h,f,r);return[p,h,v]}),o=(await Promise.all(n)).reduce((c,[f,h,p])=>(f&&(c[h]=p.toUrl()),c),{});return await this._setReferences(r.controller??this.id,o),o}async setDefaults(t,r={}){let n=await this.getIndex()??{},s=Object.entries(t).map(([f,h])=>[this.getDefinitionID(f),h]).filter(f=>n[f[0]]==null).map(async([f,h])=>{let p=await this.getDefinition(f),v=await this._createRecord(p,h,r);return{[f]:v.toUrl()}}),c=(await Promise.all(s)).reduce((f,h)=>Object.assign(f,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 f=await this.getIndex(t);r=Object.entries(f??{})}if(n===r.length)return{done:!0,value:null};let[s,o]=r[n++],c=await Ur(this,Ds).load(o);return{done:!1,value:{key:s,id:o,record:c.content}}}}}async _createIDXDoc(t){return await Ur(this,Ds).deterministic(Ab(t))}async _getIDXDoc(t){let r=await this._createIDXDoc(t);if(r.content==null||r.metadata.schema==null)return null;if(r.metadata.schema!==yp)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:yp});else if(r.metadata.schema!==yp)throw new Error("Invalid document: schema is not IdentityIndex");return r}_getIndexProxy(t){let r=Ur(this,Sb)[t];return r==null&&(r=new kf(async()=>await this._getOwnIDXDoc(t)),Ur(this,Sb)[t]=r),r}getDefinitionID(t){return Ur(this,t0).getDefinitionID(t)??t}async getDefinition(t){let r=await Ur(this,Ds).load(t);if(r.metadata.schema!==B9)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 Ur(this,Ds).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[s,o]=await this._setRecordOnly(t,r,n);return s&&await this._setReference(n.controller??this.id,t,o),o}async _setRecordOnly(t,r,n){let s=await this.getRecordID(t,n.controller??this.id);if(s==null){let o=await this.getDefinition(t),c=await this._createRecord(o,r,n);return[!0,c]}else{let o=await Ur(this,Ds).update(s,r);return[!1,o.id]}}async _createRecord(t,r,{controller:n,pin:s}){let o=await Ur(this,Ds).deterministic({controllers:[n??this.id],family:t.id.toString()},{pin:s});return await o.update(r,{schema:t.schema}),o.id}async _setReference(t,r,n){await this._getIndexProxy(t).changeContent(s=>({...s,[r]:n.toUrl()}))}async _setReferences(t,r){Object.keys(r).length!==0&&await this._getIndexProxy(t).changeContent(n=>({...n,...r}))}constructor(t){Df(this,la,{writable:!0,value:void 0}),Df(this,e0,{writable:!0,value:void 0}),Df(this,Sb,{writable:!0,value:{}}),Df(this,Ds,{writable:!0,value:void 0}),Df(this,t0,{writable:!0,value:void 0});let{cache:r,ceramic:n,id:s,loader:o,model:c}=t;Qp(this,la,n),Qp(this,e0,s),Qp(this,Ds,o??new ec({ceramic:n,cache:r})),Qp(this,t0,c instanceof xu?c:new xu({loader:Ur(this,Ds),aliases:c}))}};i(Of,"DIDDataStore");var nr;(function(e){e.assertEqual=s=>s;function t(s){}i(t,"assertIs"),e.assertIs=t;function r(s){throw new Error}i(r,"assertNever"),e.assertNever=r,e.arrayToEnum=s=>{let o={};for(let c of s)o[c]=c;return o},e.getValidEnumValues=s=>{let o=e.objectKeys(s).filter(f=>typeof s[s[f]]!="number"),c={};for(let f of o)c[f]=s[f];return e.objectValues(c)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let c in s)Object.prototype.hasOwnProperty.call(s,c)&&o.push(c);return o},e.find=(s,o)=>{for(let c of s)if(o(c))return c},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}i(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(nr||(nr={}));var et=nr.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),qa=i(e=>{switch(typeof e){case"undefined":return et.undefined;case"string":return et.string;case"number":return isNaN(e)?et.nan:et.number;case"boolean":return et.boolean;case"function":return et.function;case"bigint":return et.bigint;case"symbol":return et.symbol;case"object":return Array.isArray(e)?et.array:e===null?et.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?et.promise:typeof Map<"u"&&e instanceof Map?et.map:typeof Set<"u"&&e instanceof Set?et.set:typeof Date<"u"&&e instanceof Date?et.date:et.object;default:return et.unknown}},"getParsedType"),Ke=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"]),qL=i(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Li=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(o){return o.message},n={_errors:[]},s=i(o=>{for(let c of o.issues)if(c.code==="invalid_union")c.unionErrors.map(s);else if(c.code==="invalid_return_type")s(c.returnTypeError);else if(c.code==="invalid_arguments")s(c.argumentsError);else if(c.path.length===0)n._errors.push(r(c));else{let f=n,h=0;for(;h<c.path.length;){let p=c.path[h];h===c.path.length-1?(f[p]=f[p]||{_errors:[]},f[p]._errors.push(r(c))):f[p]=f[p]||{_errors:[]},f=f[p],h++}}},"processError");return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,nr.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=r=>r.message){let r={},n=[];for(let s of this.issues)s.path.length>0?(r[s.path[0]]=r[s.path[0]]||[],r[s.path[0]].push(t(s))):n.push(t(s));return{formErrors:n,fieldErrors:r}}get formErrors(){return this.flatten()}};i(Li,"ZodError");Li.create=e=>new Li(e);var Nf=i((e,t)=>{let r;switch(e.code){case Ke.invalid_type:e.received===et.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ke.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,nr.jsonStringifyReplacer)}`;break;case Ke.unrecognized_keys:r=`Unrecognized key(s) in object: ${nr.joinValues(e.keys,", ")}`;break;case Ke.invalid_union:r="Invalid input";break;case Ke.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${nr.joinValues(e.options)}`;break;case Ke.invalid_enum_value:r=`Invalid enum value. Expected ${nr.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}"`:nr.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,nr.assertNever(e)}return{message:r}},"errorMap"),E7=Nf;function KL(e){E7=e}i(KL,"setErrorMap");function n0(){return E7}i(n0,"getErrorMap");var i0=i(e=>{let{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],c={...s,path:o},f="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)f=p(c,{data:t,defaultError:f}).message;return{...s,path:o,message:s.message||f}},"makeIssue"),VL=[];function gt(e,t){let r=i0({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n0(),Nf].filter(n=>!!n)});e.common.issues.push(r)}i(gt,"addIssueToContext");var Xr=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 s of r){if(s.status==="aborted")return kt;s.status==="dirty"&&t.dirty(),n.push(s.value)}return{status:t.value,value:n}}static async mergeObjectAsync(t,r){let n=[];for(let s of r)n.push({key:await s.key,value:await s.value});return Xr.mergeObjectSync(t,n)}static mergeObjectSync(t,r){let n={};for(let s of r){let{key:o,value:c}=s;if(o.status==="aborted"||c.status==="aborted")return kt;o.status==="dirty"&&t.dirty(),c.status==="dirty"&&t.dirty(),(typeof c.value<"u"||s.alwaysSet)&&(n[o.value]=c.value)}return{status:t.value,value:n}}};i(Xr,"ParseStatus");var kt=Object.freeze({status:"aborted"}),A7=i(e=>({status:"dirty",value:e}),"DIRTY"),En=i(e=>({status:"valid",value:e}),"OK"),xb=i(e=>e.status==="aborted","isAborted"),Tb=i(e=>e.status==="dirty","isDirty"),s0=i(e=>e.status==="valid","isValid"),a0=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 di=class{constructor(t,r,n,s){this.parent=t,this.data=r,this._path=n,this._key=s}get path(){return this._path.concat(this._key)}};i(di,"ParseInputLazyPath");var y7=i((e,t)=>{if(s0(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Li(e.common.issues);return{success:!1,error:r}}},"handleResult");function Kt(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:s}=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:s}:{errorMap:i((c,f)=>c.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:n??f.defaultError}:{message:r??f.defaultError},"customMap"),description:s}}i(Kt,"processCreateParams");var Pt=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 qa(t.data)}_getOrReturnCtx(t,r){return r||{common:t.parent.common,data:t.data,parsedType:qa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Xr,ctx:{common:t.parent.common,data:t.data,parsedType:qa(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let r=this._parse(t);if(a0(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 s={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:qa(t)},o=this._parseSync({data:t,path:s.path,parent:s});return y7(s,o)}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:qa(t)},s=this._parse({data:t,path:n.path,parent:n}),o=await(a0(s)?s:Promise.resolve(s));return y7(n,o)}refine(t,r){let n=i(s=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(s):r,"getIssueProperties");return this._refinement((s,o)=>{let c=t(s),f=i(()=>o.addIssue({code:Ke.custom,...n(s)}),"setError");return typeof Promise<"u"&&c instanceof Promise?c.then(h=>h?!0:(f(),!1)):c?!0:(f(),!1)})}refinement(t,r){return this._refinement((n,s)=>t(n)?!0:(s.addIssue(typeof r=="function"?r(n,s):r),!1))}_refinement(t){return new Vn({schema:this,typeName:xt.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return pi.create(this)}nullable(){return Ps.create(this)}nullish(){return this.optional().nullable()}array(){return Kn.create(this)}promise(){return ha.create(this)}or(t){return Za.create([this,t])}and(t){return Ja.create(this,t)}transform(t){return new Vn({schema:this,typeName:xt.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let r=typeof t=="function"?t:()=>t;return new ro({innerType:this,defaultValue:r,typeName:xt.ZodDefault})}brand(){return new Rf({typeName:xt.ZodBranded,type:this,...Kt(void 0)})}catch(t){let r=typeof t=="function"?t:()=>t;return new oc({innerType:this,defaultValue:r,typeName:xt.ZodCatch})}describe(t){let r=this.constructor;return new r({...this._def,description:t})}pipe(t){return no.create(this,t)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};i(Pt,"ZodType");var GL=/^c[^\s-]{8,}$/i,WL=/^([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,ZL=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,JL=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"),Fi=class extends Pt{constructor(){super(...arguments),this._regex=(t,r,n)=>this.refinement(s=>t.test(s),{validation:r,code:Ke.invalid_string,...Wt.errToObj(n)}),this.nonempty=t=>this.min(1,Wt.errToObj(t)),this.trim=()=>new Fi({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==et.string){let o=this._getOrReturnCtx(t);return gt(o,{code:Ke.invalid_type,expected:et.string,received:o.parsedType}),kt}let n=new Xr,s;for(let o of this._def.checks)if(o.kind==="min")t.data.length<o.value&&(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="max")t.data.length>o.value&&(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),n.dirty());else if(o.kind==="length"){let c=t.data.length>o.value,f=t.data.length<o.value;(c||f)&&(s=this._getOrReturnCtx(t,s),c?gt(s,{code:Ke.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):f&&gt(s,{code:Ke.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),n.dirty())}else if(o.kind==="email")ZL.test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{validation:"email",code:Ke.invalid_string,message:o.message}),n.dirty());else if(o.kind==="uuid")WL.test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{validation:"uuid",code:Ke.invalid_string,message:o.message}),n.dirty());else if(o.kind==="cuid")GL.test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{validation:"cuid",code:Ke.invalid_string,message:o.message}),n.dirty());else if(o.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),gt(s,{validation:"url",code:Ke.invalid_string,message:o.message}),n.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{validation:"regex",code:Ke.invalid_string,message:o.message}),n.dirty())):o.kind==="trim"?t.data=t.data.trim():o.kind==="startsWith"?t.data.startsWith(o.value)||(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.invalid_string,validation:{startsWith:o.value},message:o.message}),n.dirty()):o.kind==="endsWith"?t.data.endsWith(o.value)||(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.invalid_string,validation:{endsWith:o.value},message:o.message}),n.dirty()):o.kind==="datetime"?JL(o).test(t.data)||(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.invalid_string,validation:"datetime",message:o.message}),n.dirty()):nr.assertNever(o);return{status:n.value,value:t.data}}_addCheck(t){return new Fi({...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(Fi,"ZodString");Fi.create=e=>{var t;return new Fi({checks:[],typeName:xt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Kt(e)})};function YL(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),c=parseInt(t.toFixed(s).replace(".",""));return o%c/Math.pow(10,s)}i(YL,"floatSafeRemainder");var rs=class extends Pt{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)!==et.number){let o=this._getOrReturnCtx(t);return gt(o,{code:Ke.invalid_type,expected:et.number,received:o.parsedType}),kt}let n,s=new Xr;for(let o of this._def.checks)o.kind==="int"?nr.isInteger(t.data)||(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.invalid_type,expected:"integer",received:"float",message:o.message}),s.dirty()):o.kind==="min"?(o.inclusive?t.data<o.value:t.data<=o.value)&&(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="max"?(o.inclusive?t.data>o.value:t.data>=o.value)&&(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),s.dirty()):o.kind==="multipleOf"?YL(t.data,o.value)!==0&&(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.not_multiple_of,multipleOf:o.value,message:o.message}),s.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(n=this._getOrReturnCtx(t,n),gt(n,{code:Ke.not_finite,message:o.message}),s.dirty()):nr.assertNever(o);return{status:s.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,s){return new rs({...this._def,checks:[...this._def.checks,{kind:t,value:r,inclusive:n,message:Wt.toString(s)}]})}_addCheck(t){return new rs({...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(rs,"ZodNumber");rs.create=e=>new rs({checks:[],typeName:xt.ZodNumber,coerce:e?.coerce||!1,...Kt(e)});var Ka=class extends Pt{_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==et.bigint){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.bigint,received:n.parsedType}),kt}return En(t.data)}};i(Ka,"ZodBigInt");Ka.create=e=>{var t;return new Ka({typeName:xt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...Kt(e)})};var Va=class extends Pt{_parse(t){if(this._def.coerce&&(t.data=Boolean(t.data)),this._getType(t)!==et.boolean){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.boolean,received:n.parsedType}),kt}return En(t.data)}};i(Va,"ZodBoolean");Va.create=e=>new Va({typeName:xt.ZodBoolean,coerce:e?.coerce||!1,...Kt(e)});var Os=class extends Pt{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==et.date){let o=this._getOrReturnCtx(t);return gt(o,{code:Ke.invalid_type,expected:et.date,received:o.parsedType}),kt}if(isNaN(t.data.getTime())){let o=this._getOrReturnCtx(t);return gt(o,{code:Ke.invalid_date}),kt}let n=new Xr,s;for(let o of this._def.checks)o.kind==="min"?t.data.getTime()<o.value&&(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),n.dirty()):o.kind==="max"?t.data.getTime()>o.value&&(s=this._getOrReturnCtx(t,s),gt(s,{code:Ke.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),n.dirty()):nr.assertNever(o);return{status:n.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Os({...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(Os,"ZodDate");Os.create=e=>new Os({checks:[],coerce:e?.coerce||!1,typeName:xt.ZodDate,...Kt(e)});var nc=class extends Pt{_parse(t){if(this._getType(t)!==et.symbol){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.symbol,received:n.parsedType}),kt}return En(t.data)}};i(nc,"ZodSymbol");nc.create=e=>new nc({typeName:xt.ZodSymbol,...Kt(e)});var Ga=class extends Pt{_parse(t){if(this._getType(t)!==et.undefined){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.undefined,received:n.parsedType}),kt}return En(t.data)}};i(Ga,"ZodUndefined");Ga.create=e=>new Ga({typeName:xt.ZodUndefined,...Kt(e)});var Wa=class extends Pt{_parse(t){if(this._getType(t)!==et.null){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.null,received:n.parsedType}),kt}return En(t.data)}};i(Wa,"ZodNull");Wa.create=e=>new Wa({typeName:xt.ZodNull,...Kt(e)});var fa=class extends Pt{constructor(){super(...arguments),this._any=!0}_parse(t){return En(t.data)}};i(fa,"ZodAny");fa.create=e=>new fa({typeName:xt.ZodAny,...Kt(e)});var Rs=class extends Pt{constructor(){super(...arguments),this._unknown=!0}_parse(t){return En(t.data)}};i(Rs,"ZodUnknown");Rs.create=e=>new Rs({typeName:xt.ZodUnknown,...Kt(e)});var Ui=class extends Pt{_parse(t){let r=this._getOrReturnCtx(t);return gt(r,{code:Ke.invalid_type,expected:et.never,received:r.parsedType}),kt}};i(Ui,"ZodNever");Ui.create=e=>new Ui({typeName:xt.ZodNever,...Kt(e)});var ic=class extends Pt{_parse(t){if(this._getType(t)!==et.undefined){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.void,received:n.parsedType}),kt}return En(t.data)}};i(ic,"ZodVoid");ic.create=e=>new ic({typeName:xt.ZodVoid,...Kt(e)});var Kn=class extends Pt{_parse(t){let{ctx:r,status:n}=this._processInputParams(t),s=this._def;if(r.parsedType!==et.array)return gt(r,{code:Ke.invalid_type,expected:et.array,received:r.parsedType}),kt;if(s.exactLength!==null){let c=r.data.length>s.exactLength.value,f=r.data.length<s.exactLength.value;(c||f)&&(gt(r,{code:c?Ke.too_big:Ke.too_small,minimum:f?s.exactLength.value:void 0,maximum:c?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&r.data.length<s.minLength.value&&(gt(r,{code:Ke.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&r.data.length>s.maxLength.value&&(gt(r,{code:Ke.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),r.common.async)return Promise.all(r.data.map((c,f)=>s.type._parseAsync(new di(r,c,r.path,f)))).then(c=>Xr.mergeArray(n,c));let o=r.data.map((c,f)=>s.type._parseSync(new di(r,c,r.path,f)));return Xr.mergeArray(n,o)}get element(){return this._def.type}min(t,r){return new Kn({...this._def,minLength:{value:t,message:Wt.toString(r)}})}max(t,r){return new Kn({...this._def,maxLength:{value:t,message:Wt.toString(r)}})}length(t,r){return new Kn({...this._def,exactLength:{value:t,message:Wt.toString(r)}})}nonempty(t){return this.min(1,t)}};i(Kn,"ZodArray");Kn.create=(e,t)=>new Kn({type:e,minLength:null,maxLength:null,exactLength:null,typeName:xt.ZodArray,...Kt(t)});var o0;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(o0||(o0={}));var w7=i(e=>t=>new _r({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function Tu(e){if(e instanceof _r){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=pi.create(Tu(n))}return new _r({...e._def,shape:()=>t})}else return e instanceof Kn?Kn.create(Tu(e.element)):e instanceof pi?pi.create(Tu(e.unwrap())):e instanceof Ps?Ps.create(Tu(e.unwrap())):e instanceof hi?hi.create(e.items.map(t=>Tu(t))):e}i(Tu,"deepPartialify");var _r=class extends Pt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=w7(this._def),this.extend=w7(this._def)}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),r=nr.objectKeys(t);return this._cached={shape:t,keys:r}}_parse(t){if(this._getType(t)!==et.object){let p=this._getOrReturnCtx(t);return gt(p,{code:Ke.invalid_type,expected:et.object,received:p.parsedType}),kt}let{status:n,ctx:s}=this._processInputParams(t),{shape:o,keys:c}=this._getCached(),f=[];if(!(this._def.catchall instanceof Ui&&this._def.unknownKeys==="strip"))for(let p in s.data)c.includes(p)||f.push(p);let h=[];for(let p of c){let v=o[p],y=s.data[p];h.push({key:{status:"valid",value:p},value:v._parse(new di(s,y,s.path,p)),alwaysSet:p in s.data})}if(this._def.catchall instanceof Ui){let p=this._def.unknownKeys;if(p==="passthrough")for(let v of f)h.push({key:{status:"valid",value:v},value:{status:"valid",value:s.data[v]}});else if(p==="strict")f.length>0&&(gt(s,{code:Ke.unrecognized_keys,keys:f}),n.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let p=this._def.catchall;for(let v of f){let y=s.data[v];h.push({key:{status:"valid",value:v},value:p._parse(new di(s,y,s.path,v)),alwaysSet:v in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let p=[];for(let v of h){let y=await v.key;p.push({key:y,value:await v.value,alwaysSet:v.alwaysSet})}return p}).then(p=>Xr.mergeObjectSync(n,p)):Xr.mergeObjectSync(n,h)}get shape(){return this._def.shape()}strict(t){return Wt.errToObj,new _r({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(r,n)=>{var s,o,c,f;let h=(c=(o=(s=this._def).errorMap)===null||o===void 0?void 0:o.call(s,r,n).message)!==null&&c!==void 0?c:n.defaultError;return r.code==="unrecognized_keys"?{message:(f=Wt.errToObj(t).message)!==null&&f!==void 0?f:h}:{message:h}}}:{}})}strip(){return new _r({...this._def,unknownKeys:"strip"})}passthrough(){return new _r({...this._def,unknownKeys:"passthrough"})}setKey(t,r){return this.augment({[t]:r})}merge(t){return new _r({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>o0.mergeShapes(this._def.shape(),t._def.shape()),typeName:xt.ZodObject})}catchall(t){return new _r({...this._def,catchall:t})}pick(t){let r={};return nr.objectKeys(t).map(n=>{this.shape[n]&&(r[n]=this.shape[n])}),new _r({...this._def,shape:()=>r})}omit(t){let r={};return nr.objectKeys(this.shape).map(n=>{nr.objectKeys(t).indexOf(n)===-1&&(r[n]=this.shape[n])}),new _r({...this._def,shape:()=>r})}deepPartial(){return Tu(this)}partial(t){let r={};if(t)return nr.objectKeys(this.shape).map(n=>{nr.objectKeys(t).indexOf(n)===-1?r[n]=this.shape[n]:r[n]=this.shape[n].optional()}),new _r({...this._def,shape:()=>r});for(let n in this.shape){let s=this.shape[n];r[n]=s.optional()}return new _r({...this._def,shape:()=>r})}required(t){let r={};if(t)nr.objectKeys(this.shape).map(n=>{if(nr.objectKeys(t).indexOf(n)===-1)r[n]=this.shape[n];else{let o=this.shape[n];for(;o instanceof pi;)o=o._def.innerType;r[n]=o}});else for(let n in this.shape){let o=this.shape[n];for(;o instanceof pi;)o=o._def.innerType;r[n]=o}return new _r({...this._def,shape:()=>r})}keyof(){return S7(nr.objectKeys(this.shape))}};i(_r,"ZodObject");_r.create=(e,t)=>new _r({shape:()=>e,unknownKeys:"strip",catchall:Ui.create(),typeName:xt.ZodObject,...Kt(t)});_r.strictCreate=(e,t)=>new _r({shape:()=>e,unknownKeys:"strict",catchall:Ui.create(),typeName:xt.ZodObject,...Kt(t)});_r.lazycreate=(e,t)=>new _r({shape:e,unknownKeys:"strip",catchall:Ui.create(),typeName:xt.ZodObject,...Kt(t)});var Za=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.options;function s(o){for(let f of o)if(f.result.status==="valid")return f.result;for(let f of o)if(f.result.status==="dirty")return r.common.issues.push(...f.ctx.common.issues),f.result;let c=o.map(f=>new Li(f.ctx.common.issues));return gt(r,{code:Ke.invalid_union,unionErrors:c}),kt}if(i(s,"handleResults"),r.common.async)return Promise.all(n.map(async o=>{let c={...r,common:{...r.common,issues:[]},parent:null};return{result:await o._parseAsync({data:r.data,path:r.path,parent:c}),ctx:c}})).then(s);{let o,c=[];for(let h of n){let p={...r,common:{...r.common,issues:[]},parent:null},v=h._parseSync({data:r.data,path:r.path,parent:p});if(v.status==="valid")return v;v.status==="dirty"&&!o&&(o={result:v,ctx:p}),p.common.issues.length&&c.push(p.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let f=c.map(h=>new Li(h));return gt(r,{code:Ke.invalid_union,unionErrors:f}),kt}}get options(){return this._def.options}};i(Za,"ZodUnion");Za.create=(e,t)=>new Za({options:e,typeName:xt.ZodUnion,...Kt(t)});var r0=i(e=>e instanceof Xa?r0(e.schema):e instanceof Vn?r0(e.innerType()):e instanceof Qa?[e.value]:e instanceof eo?e.options:e instanceof to?Object.keys(e.enum):e instanceof ro?r0(e._def.innerType):e instanceof Ga?[void 0]:e instanceof Wa?[null]:null,"getDiscriminator"),sc=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==et.object)return gt(r,{code:Ke.invalid_type,expected:et.object,received:r.parsedType}),kt;let n=this.discriminator,s=r.data[n],o=this.optionsMap.get(s);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(gt(r,{code:Ke.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),kt)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,r,n){let s=new Map;for(let o of r){let c=r0(o.shape[t]);if(!c)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let f of c){if(s.has(f))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(f)}`);s.set(f,o)}}return new sc({typeName:xt.ZodDiscriminatedUnion,discriminator:t,options:r,optionsMap:s,...Kt(n)})}};i(sc,"ZodDiscriminatedUnion");function Mb(e,t){let r=qa(e),n=qa(t);if(e===t)return{valid:!0,data:e};if(r===et.object&&n===et.object){let s=nr.objectKeys(t),o=nr.objectKeys(e).filter(f=>s.indexOf(f)!==-1),c={...e,...t};for(let f of o){let h=Mb(e[f],t[f]);if(!h.valid)return{valid:!1};c[f]=h.data}return{valid:!0,data:c}}else if(r===et.array&&n===et.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let c=e[o],f=t[o],h=Mb(c,f);if(!h.valid)return{valid:!1};s.push(h.data)}return{valid:!0,data:s}}else return r===et.date&&n===et.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(Mb,"mergeValues");var Ja=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t),s=i((o,c)=>{if(xb(o)||xb(c))return kt;let f=Mb(o.value,c.value);return f.valid?((Tb(o)||Tb(c))&&r.dirty(),{status:r.value,value:f.data}):(gt(n,{code:Ke.invalid_intersection_types}),kt)},"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(([o,c])=>s(o,c)):s(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(Ja,"ZodIntersection");Ja.create=(e,t,r)=>new Ja({left:e,right:t,typeName:xt.ZodIntersection,...Kt(r)});var hi=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==et.array)return gt(n,{code:Ke.invalid_type,expected:et.array,received:n.parsedType}),kt;if(n.data.length<this._def.items.length)return gt(n,{code:Ke.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),kt;!this._def.rest&&n.data.length>this._def.items.length&&(gt(n,{code:Ke.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=n.data.map((c,f)=>{let h=this._def.items[f]||this._def.rest;return h?h._parse(new di(n,c,n.path,f)):null}).filter(c=>!!c);return n.common.async?Promise.all(o).then(c=>Xr.mergeArray(r,c)):Xr.mergeArray(r,o)}get items(){return this._def.items}rest(t){return new hi({...this._def,rest:t})}};i(hi,"ZodTuple");hi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new hi({items:e,typeName:xt.ZodTuple,rest:null,...Kt(t)})};var Ya=class extends Pt{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!==et.object)return gt(n,{code:Ke.invalid_type,expected:et.object,received:n.parsedType}),kt;let s=[],o=this._def.keyType,c=this._def.valueType;for(let f in n.data)s.push({key:o._parse(new di(n,f,n.path,f)),value:c._parse(new di(n,n.data[f],n.path,f))});return n.common.async?Xr.mergeObjectAsync(r,s):Xr.mergeObjectSync(r,s)}get element(){return this._def.valueType}static create(t,r,n){return r instanceof Pt?new Ya({keyType:t,valueType:r,typeName:xt.ZodRecord,...Kt(n)}):new Ya({keyType:Fi.create(),valueType:t,typeName:xt.ZodRecord,...Kt(r)})}};i(Ya,"ZodRecord");var ac=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==et.map)return gt(n,{code:Ke.invalid_type,expected:et.map,received:n.parsedType}),kt;let s=this._def.keyType,o=this._def.valueType,c=[...n.data.entries()].map(([f,h],p)=>({key:s._parse(new di(n,f,n.path,[p,"key"])),value:o._parse(new di(n,h,n.path,[p,"value"]))}));if(n.common.async){let f=new Map;return Promise.resolve().then(async()=>{for(let h of c){let p=await h.key,v=await h.value;if(p.status==="aborted"||v.status==="aborted")return kt;(p.status==="dirty"||v.status==="dirty")&&r.dirty(),f.set(p.value,v.value)}return{status:r.value,value:f}})}else{let f=new Map;for(let h of c){let p=h.key,v=h.value;if(p.status==="aborted"||v.status==="aborted")return kt;(p.status==="dirty"||v.status==="dirty")&&r.dirty(),f.set(p.value,v.value)}return{status:r.value,value:f}}}};i(ac,"ZodMap");ac.create=(e,t,r)=>new ac({valueType:t,keyType:e,typeName:xt.ZodMap,...Kt(r)});var Ns=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.parsedType!==et.set)return gt(n,{code:Ke.invalid_type,expected:et.set,received:n.parsedType}),kt;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(gt(n,{code:Ke.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),r.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(gt(n,{code:Ke.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),r.dirty());let o=this._def.valueType;function c(h){let p=new Set;for(let v of h){if(v.status==="aborted")return kt;v.status==="dirty"&&r.dirty(),p.add(v.value)}return{status:r.value,value:p}}i(c,"finalizeSet");let f=[...n.data.values()].map((h,p)=>o._parse(new di(n,h,n.path,p)));return n.common.async?Promise.all(f).then(h=>c(h)):c(f)}min(t,r){return new Ns({...this._def,minSize:{value:t,message:Wt.toString(r)}})}max(t,r){return new Ns({...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(Ns,"ZodSet");Ns.create=(e,t)=>new Ns({valueType:e,minSize:null,maxSize:null,typeName:xt.ZodSet,...Kt(t)});var da=class extends Pt{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==et.function)return gt(r,{code:Ke.invalid_type,expected:et.function,received:r.parsedType}),kt;function n(f,h){return i0({data:f,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,n0(),Nf].filter(p=>!!p),issueData:{code:Ke.invalid_arguments,argumentsError:h}})}i(n,"makeArgsIssue");function s(f,h){return i0({data:f,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,n0(),Nf].filter(p=>!!p),issueData:{code:Ke.invalid_return_type,returnTypeError:h}})}i(s,"makeReturnsIssue");let o={errorMap:r.common.contextualErrorMap},c=r.data;return this._def.returns instanceof ha?En(async(...f)=>{let h=new Li([]),p=await this._def.args.parseAsync(f,o).catch(b=>{throw h.addIssue(n(f,b)),h}),v=await c(...p);return await this._def.returns._def.type.parseAsync(v,o).catch(b=>{throw h.addIssue(s(v,b)),h})}):En((...f)=>{let h=this._def.args.safeParse(f,o);if(!h.success)throw new Li([n(f,h.error)]);let p=c(...h.data),v=this._def.returns.safeParse(p,o);if(!v.success)throw new Li([s(p,v.error)]);return v.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new da({...this._def,args:hi.create(t).rest(Rs.create())})}returns(t){return new da({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,r,n){return new da({args:t||hi.create([]).rest(Rs.create()),returns:r||Rs.create(),typeName:xt.ZodFunction,...Kt(n)})}};i(da,"ZodFunction");var Xa=class extends Pt{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(Xa,"ZodLazy");Xa.create=(e,t)=>new Xa({getter:e,typeName:xt.ZodLazy,...Kt(t)});var Qa=class extends Pt{_parse(t){if(t.data!==this._def.value){let r=this._getOrReturnCtx(t);return gt(r,{code:Ke.invalid_literal,expected:this._def.value}),kt}return{status:"valid",value:t.data}}get value(){return this._def.value}};i(Qa,"ZodLiteral");Qa.create=(e,t)=>new Qa({value:e,typeName:xt.ZodLiteral,...Kt(t)});function S7(e,t){return new eo({values:e,typeName:xt.ZodEnum,...Kt(t)})}i(S7,"createZodEnum");var eo=class extends Pt{_parse(t){if(typeof t.data!="string"){let r=this._getOrReturnCtx(t),n=this._def.values;return gt(r,{expected:nr.joinValues(n),received:r.parsedType,code:Ke.invalid_type}),kt}if(this._def.values.indexOf(t.data)===-1){let r=this._getOrReturnCtx(t),n=this._def.values;return gt(r,{received:r.data,code:Ke.invalid_enum_value,options:n}),kt}return En(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(eo,"ZodEnum");eo.create=S7;var to=class extends Pt{_parse(t){let r=nr.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(t);if(n.parsedType!==et.string&&n.parsedType!==et.number){let s=nr.objectValues(r);return gt(n,{expected:nr.joinValues(s),received:n.parsedType,code:Ke.invalid_type}),kt}if(r.indexOf(t.data)===-1){let s=nr.objectValues(r);return gt(n,{received:n.data,code:Ke.invalid_enum_value,options:s}),kt}return En(t.data)}get enum(){return this._def.values}};i(to,"ZodNativeEnum");to.create=(e,t)=>new to({values:e,typeName:xt.ZodNativeEnum,...Kt(t)});var ha=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t);if(r.parsedType!==et.promise&&r.common.async===!1)return gt(r,{code:Ke.invalid_type,expected:et.promise,received:r.parsedType}),kt;let n=r.parsedType===et.promise?r.data:Promise.resolve(r.data);return En(n.then(s=>this._def.type.parseAsync(s,{path:r.path,errorMap:r.common.contextualErrorMap})))}};i(ha,"ZodPromise");ha.create=(e,t)=>new ha({type:e,typeName:xt.ZodPromise,...Kt(t)});var Vn=class extends Pt{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),s=this._def.effect||null;if(s.type==="preprocess"){let c=s.transform(n.data);return n.common.async?Promise.resolve(c).then(f=>this._def.schema._parseAsync({data:f,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}let o={addIssue:c=>{gt(n,c),c.fatal?r.abort():r.dirty()},get path(){return n.path}};if(o.addIssue=o.addIssue.bind(o),s.type==="refinement"){let c=i(f=>{let h=s.refinement(f,o);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 f},"executeRefinement");if(n.common.async===!1){let f=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return f.status==="aborted"?kt:(f.status==="dirty"&&r.dirty(),c(f.value),{status:r.value,value:f.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(f=>f.status==="aborted"?kt:(f.status==="dirty"&&r.dirty(),c(f.value).then(()=>({status:r.value,value:f.value}))))}if(s.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!s0(c))return c;let f=s.transform(c.value,o);if(f instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:f}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>s0(c)?Promise.resolve(s.transform(c.value,o)).then(f=>({status:r.value,value:f})):c);nr.assertNever(s)}};i(Vn,"ZodEffects");Vn.create=(e,t,r)=>new Vn({schema:e,typeName:xt.ZodEffects,effect:t,...Kt(r)});Vn.createWithPreprocess=(e,t,r)=>new Vn({schema:t,effect:{type:"preprocess",transform:e},typeName:xt.ZodEffects,...Kt(r)});var pi=class extends Pt{_parse(t){return this._getType(t)===et.undefined?En(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(pi,"ZodOptional");pi.create=(e,t)=>new pi({innerType:e,typeName:xt.ZodOptional,...Kt(t)});var Ps=class extends Pt{_parse(t){return this._getType(t)===et.null?En(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};i(Ps,"ZodNullable");Ps.create=(e,t)=>new Ps({innerType:e,typeName:xt.ZodNullable,...Kt(t)});var ro=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t),n=r.data;return r.parsedType===et.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};i(ro,"ZodDefault");ro.create=(e,t)=>new ro({innerType:e,typeName:xt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Kt(t)});var oc=class extends Pt{_parse(t){let{ctx:r}=this._processInputParams(t),n=this._def.innerType._parse({data:r.data,path:r.path,parent:r});return a0(n)?n.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.defaultValue()})):{status:"valid",value:n.status==="valid"?n.value:this._def.defaultValue()}}removeDefault(){return this._def.innerType}};i(oc,"ZodCatch");oc.create=(e,t)=>new oc({innerType:e,typeName:xt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Kt(t)});var cc=class extends Pt{_parse(t){if(this._getType(t)!==et.nan){let n=this._getOrReturnCtx(t);return gt(n,{code:Ke.invalid_type,expected:et.nan,received:n.parsedType}),kt}return{status:"valid",value:t.data}}};i(cc,"ZodNaN");cc.create=e=>new cc({typeName:xt.ZodNaN,...Kt(e)});var XL=Symbol("zod_brand"),Rf=class extends Pt{_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(Rf,"ZodBranded");var no=class extends Pt{_parse(t){let{status:r,ctx:n}=this._processInputParams(t);if(n.common.async)return i(async()=>{let o=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return o.status==="aborted"?kt:o.status==="dirty"?(r.dirty(),A7(o.value)):this._def.out._parseAsync({data:o.value,path:n.path,parent:n})},"handleAsync")();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?kt:s.status==="dirty"?(r.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(t,r){return new no({in:t,out:r,typeName:xt.ZodPipeline})}};i(no,"ZodPipeline");var x7=i((e,t={},r)=>e?fa.create().superRefine((n,s)=>{if(!e(n)){let o=typeof t=="function"?t(n):t,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:r})}}):fa.create(),"custom"),QL={object:_r.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 eF=i((e,t={message:`Input not instance of ${e.name}`})=>x7(r=>r instanceof e,t,!0),"instanceOfType"),T7=Fi.create,M7=rs.create,tF=cc.create,rF=Ka.create,C7=Va.create,nF=Os.create,iF=nc.create,sF=Ga.create,aF=Wa.create,oF=fa.create,cF=Rs.create,uF=Ui.create,lF=ic.create,fF=Kn.create,dF=_r.create,hF=_r.strictCreate,pF=Za.create,mF=sc.create,vF=Ja.create,gF=hi.create,bF=Ya.create,yF=ac.create,wF=Ns.create,_F=da.create,EF=Xa.create,AF=Qa.create,SF=eo.create,xF=to.create,TF=ha.create,_7=Vn.create,MF=pi.create,CF=Ps.create,IF=Vn.createWithPreprocess,kF=no.create,DF=i(()=>T7().optional(),"ostring"),OF=i(()=>M7().optional(),"onumber"),RF=i(()=>C7().optional(),"oboolean"),NF={string:e=>Fi.create({...e,coerce:!0}),number:e=>rs.create({...e,coerce:!0}),boolean:e=>Va.create({...e,coerce:!0}),bigint:e=>Ka.create({...e,coerce:!0}),date:e=>Os.create({...e,coerce:!0})},PF=kt,W=Object.freeze({__proto__:null,defaultErrorMap:Nf,setErrorMap:KL,getErrorMap:n0,makeIssue:i0,EMPTY_PATH:VL,addIssueToContext:gt,ParseStatus:Xr,INVALID:kt,DIRTY:A7,OK:En,isAborted:xb,isDirty:Tb,isValid:s0,isAsync:a0,get util(){return nr},ZodParsedType:et,getParsedType:qa,ZodType:Pt,ZodString:Fi,ZodNumber:rs,ZodBigInt:Ka,ZodBoolean:Va,ZodDate:Os,ZodSymbol:nc,ZodUndefined:Ga,ZodNull:Wa,ZodAny:fa,ZodUnknown:Rs,ZodNever:Ui,ZodVoid:ic,ZodArray:Kn,get objectUtil(){return o0},ZodObject:_r,ZodUnion:Za,ZodDiscriminatedUnion:sc,ZodIntersection:Ja,ZodTuple:hi,ZodRecord:Ya,ZodMap:ac,ZodSet:Ns,ZodFunction:da,ZodLazy:Xa,ZodLiteral:Qa,ZodEnum:eo,ZodNativeEnum:to,ZodPromise:ha,ZodEffects:Vn,ZodTransformer:Vn,ZodOptional:pi,ZodNullable:Ps,ZodDefault:ro,ZodCatch:oc,ZodNaN:cc,BRAND:XL,ZodBranded:Rf,ZodPipeline:no,custom:x7,Schema:Pt,ZodSchema:Pt,late:QL,get ZodFirstPartyTypeKind(){return xt},coerce:NF,any:oF,array:fF,bigint:rF,boolean:C7,date:nF,discriminatedUnion:mF,effect:_7,enum:SF,function:_F,instanceof:eF,intersection:vF,lazy:EF,literal:AF,map:yF,nan:tF,nativeEnum:xF,never:uF,null:aF,nullable:CF,number:M7,object:dF,oboolean:RF,onumber:OF,optional:MF,ostring:DF,pipeline:kF,preprocess:IF,promise:TF,record:bF,set:wF,strictObject:hF,string:T7,symbol:iF,transformer:_7,tuple:gF,undefined:sF,union:pF,unknown:cF,void:lF,NEVER:PF,ZodIssueCode:Ke,quotelessJson:qL,ZodError:Li});var k7=W.array(W.string().or(W.record(W.any()))),$Z=W.object({type:W.string().optional(),narrative:W.string().optional()}),l0=W.string().or(W.object({id:W.string(),type:W.string(),caption:W.string().optional()})),BF=W.object({type:W.string().min(1).or(W.string().array().nonempty()),latitude:W.number(),longitude:W.number()}),LF=W.object({type:W.string().min(1).or(W.string().array().nonempty()),addressCountry:W.string().optional(),addressCountryCode:W.string().optional(),addressRegion:W.string().optional(),addressLocality:W.string().optional(),streetAddress:W.string().optional(),postOfficeBoxNumber:W.string().optional(),postalCode:W.string().optional(),geo:BF.optional()}),FF=W.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(W.string()),D7=W.object({type:W.string().min(1).or(W.string().array().nonempty()),identifier:W.string(),identifierType:FF}),Pf=W.string().or(W.object({id:W.string().optional(),type:W.string().or(W.string().array().nonempty().optional()),name:W.string().optional(),url:W.string().optional(),phone:W.string().optional(),description:W.string().optional(),endorsement:W.any().array().optional(),image:l0.optional(),email:W.string().email().optional(),address:LF.optional(),otherIdentifier:D7.array().optional(),official:W.string().optional(),parentOrg:W.any().optional(),familyName:W.string().optional(),givenName:W.string().optional(),additionalName:W.string().optional(),patronymicName:W.string().optional(),honorificPrefix:W.string().optional(),honorificSuffix:W.string().optional(),familyNamePrefix:W.string().optional(),dateOfBirth:W.string().optional()}).catchall(W.any())),Cb=W.object({id:W.string().optional()}).catchall(W.any()),UF=W.object({type:W.string(),id:W.string()}).catchall(W.any()),$F=W.object({id:W.string(),type:W.string()}).catchall(W.any()),jF=W.object({id:W.string(),type:W.string()}).catchall(W.any()),c0=W.object({"@context":k7,id:W.string().optional(),type:W.string().array().nonempty(),issuer:Pf,issuanceDate:W.string(),expirationDate:W.string().optional(),credentialSubject:Cb.or(Cb.array()),credentialStatus:UF.optional(),credentialSchema:$F.array().optional(),refreshService:jF.optional()}).catchall(W.any()),io=W.object({type:W.string(),created:W.string(),challenge:W.string().optional(),domain:W.string().optional(),nonce:W.string().optional(),proofPurpose:W.string(),verificationMethod:W.string(),jws:W.string().optional()}).catchall(W.any()),u0=c0.extend({proof:io.or(io.array())}),zF=W.object({"@context":k7,id:W.string().optional(),type:W.string().or(W.string().array().nonempty()),verifiableCredential:u0.or(u0.array()).optional(),holder:W.string().optional()}).catchall(W.any()),jZ=zF.extend({proof:io.or(io.array())}),HF=W.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(W.string()),f0=W.object({type:W.string().array().nonempty(),targetCode:W.string().optional(),targetDescription:W.string().optional(),targetName:W.string(),targetFramework:W.string().optional(),targetType:HF.optional(),targetUrl:W.string()}),qF=W.enum(["Achievement","ApprenticeshipCertificate","Assessment","Assignment","AssociateDegree","Award","Badge","BachelorDegree","Certificate","CertificateOfCompletion","Certification","CommunityService","Competency","Course","CoCurricular","Degree","Diploma","DoctoralDegree","Fieldwork","GeneralEducationDevelopment","JourneymanCertificate","LearningProgram","License","Membership","ProfessionalDoctorate","QualityAssuranceCredential","MasterCertificate","MasterDegree","MicroCredential","ResearchDoctorate","SecondarySchoolDiploma"]),KF=qF.or(W.string()),VF=W.object({id:W.string().optional(),narrative:W.string().optional()}).catchall(W.any()),GF=W.object({id:W.string(),type:W.string().array().nonempty(),endorsementComment:W.string().optional()}),WF=c0.extend({credentialSubject:GF,proof:io.or(io.array()).optional()}),ZF=W.object({id:W.string(),"@language":W.string().optional(),version:W.string().optional()}),JF=W.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(W.string()),YF=W.object({id:W.string(),type:W.string().array().nonempty(),alignment:f0.array().optional(),description:W.string().optional(),level:W.string().optional(),name:W.string(),points:W.string().optional()}).catchall(W.any()),XF=W.object({id:W.string(),type:W.string().array().nonempty(),alignment:f0.array().optional(),allowedValue:W.string().array().optional(),name:W.string(),requiredLevel:W.string().optional(),requiredValue:W.string().optional(),resultType:JF,rubricCriterionLevel:YF.array().optional(),valueMax:W.string().optional(),valueMin:W.string().optional()}).catchall(W.any()),QF=W.object({id:W.string().optional(),type:W.string().array().nonempty(),alignment:f0.array().optional(),achievementType:KF.optional(),creator:Pf.optional(),creditsAvailable:W.number().optional(),criteria:VF,description:W.string(),endorsement:WF.array().optional(),fieldOfStudy:W.string().optional(),humanCode:W.string().optional(),image:l0.optional(),"@language":W.string().optional(),name:W.string(),otherIdentifier:D7.array().optional(),related:ZF.array().optional(),resultDescription:XF.array().optional(),specialization:W.string().optional(),tag:W.string().array().optional(),version:W.string().optional()}).catchall(W.any()),eU=W.object({type:W.string(),hashed:W.boolean(),identityHash:W.string(),identityType:W.string(),salt:W.string().optional()}),tU=W.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),rU=W.object({type:W.string().array().nonempty(),achievedLevel:W.string().optional(),alignment:f0.array().optional(),resultDescription:W.string().optional(),status:tU.optional(),value:W.string().optional()}).catchall(W.any()),I7=W.object({id:W.string().optional(),type:W.string().array().nonempty(),activityEndDate:W.string().optional(),activityStartDate:W.string().optional(),creditsEarned:W.number().optional(),achievement:QF.optional(),identifier:eU.array().optional(),image:l0.optional(),licenseNumber:W.string().optional(),narrative:W.string().optional(),result:rU.array().optional(),role:W.string().optional(),source:Pf.optional(),term:W.string().optional()}).catchall(W.any()),nU=W.object({id:W.string().optional(),type:W.string().array().nonempty(),narrative:W.string().optional(),name:W.string().optional(),description:W.string().optional(),genre:W.string().optional(),audience:W.string().optional()}).catchall(W.any()),iU=c0.extend({name:W.string().optional(),description:W.string().optional(),image:l0.optional(),credentialSubject:I7.or(I7.array()),endorsement:c0.array().optional(),evidence:nU.array().optional()}),HZ=iU.extend({proof:io.or(io.array())}),KZ=W.object({checks:W.string().array(),warnings:W.string().array(),errors:W.string().array()}),O7=W.enum(["Success","Failed","Error"]),VZ=O7.enum,GZ=W.object({check:W.string(),status:O7,message:W.string().optional(),details:W.string().optional()}),WZ=W.object({title:W.string().optional(),createdAt:W.string().optional(),issuer:Pf.optional(),issuee:Pf.optional(),credentialSubject:Cb.optional()}),uc=W.object({id:W.string(),uri:W.string()}).catchall(W.any()),YZ=W.object({limit:W.number(),cursor:W.string().optional(),sort:W.string().optional()}),lc=W.object({cursor:W.string().optional(),hasMore:W.boolean()}),sU=W.object({kty:W.string(),crv:W.string(),x:W.string(),y:W.string().optional(),n:W.string().optional(),d:W.string()}),aU=W.object({alg:W.string(),iv:W.string(),tag:W.string(),epk:sU.partial().optional(),kid:W.string().optional(),apv:W.string().optional(),apu:W.string().optional()}),oU=W.object({header:aU,encrypted_key:W.string()}),cU=W.object({protected:W.string(),iv:W.string(),ciphertext:W.string(),tag:W.string(),aad:W.string().optional(),recipients:oU.array().optional()}),R7=W.object({encryptedRecord:cU,fields:W.string().array()}).catchall(W.any()),QZ=lc.extend({records:R7.array()}),uU=R7.extend({id:W.string()}),eJ=lc.extend({records:uU.array()}),Mu=W.object({profileId:W.string().min(3).max(40),displayName:W.string().default(""),bio:W.string().default(""),did:W.string(),email:W.string().optional(),image:W.string().optional(),isServiceProfile:W.boolean().default(!1).optional(),notificationsWebhook:W.string().url().startsWith("https://").optional()}),rJ=lc.extend({records:Mu.array()}),nJ=W.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),iJ=W.object({uri:W.string(),to:W.string(),from:W.string(),sent:W.string().datetime(),received:W.string().datetime().optional()}),lU=W.enum(["DRAFT","LIVE"]),sJ=W.object({uri:W.string(),name:W.string().optional(),type:W.string().optional(),category:W.string().optional(),status:lU.optional(),autoConnectRecipients:W.boolean().optional()}),aJ=W.object({to:Mu,from:W.string(),received:W.string().optional()}),fU=W.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED"]),dU=W.object({title:W.string().optional(),body:W.string().optional()}),hU=W.object({vcUris:W.array(W.string()).optional(),vpUris:W.array(W.string()).optional()}),oJ=W.object({type:fU,to:Mu.partial().and(W.object({did:W.string()})),from:Mu.partial().and(W.object({did:W.string()})),message:dU.optional(),data:hU.optional(),sent:W.string().datetime().optional()}),cJ=W.object({endpoint:W.string(),name:W.string(),did:W.string().optional()}),uJ=W.object({ttlSeconds:W.number().optional(),totalUses:W.number().optional()}),pU=W.object({endpoint:W.string()}),lJ=W.object({signingAuthority:pU,relationship:W.object({name:W.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:W.string()})}),mU=W.enum(["live","stale","withdrawn"]),vU=W.object({read:W.object({anonymize:W.boolean().optional(),credentials:W.object({categories:W.record(W.object({required:W.boolean()})).default({})}).default({}),personal:W.record(W.object({required:W.boolean()})).default({})}).default({}),write:W.object({credentials:W.object({categories:W.record(W.object({required:W.boolean()})).default({})}).default({}),personal:W.record(W.object({required:W.boolean()})).default({})}).default({})}),N7=W.object({contract:vU,owner:Mu,name:W.string(),subtitle:W.string().optional(),description:W.string().optional(),reasonForAccessing:W.string().optional(),image:W.string().optional(),uri:W.string(),createdAt:W.string(),updatedAt:W.string(),expiresAt:W.string().optional()}),fJ=lc.extend({records:N7.omit({owner:!0}).array()}),gU=W.object({credentials:W.object({categories:W.record(W.string().array()).default({})}),personal:W.record(W.string()).default({}),date:W.string()}),dJ=lc.extend({records:gU.array()}),P7=W.object({read:W.object({anonymize:W.boolean().optional(),credentials:W.object({shareAll:W.boolean().optional(),sharing:W.boolean().optional(),categories:W.record(W.object({sharing:W.boolean().optional(),shared:W.string().array().optional(),shareAll:W.boolean().optional()})).default({})}).default({}),personal:W.record(W.string()).default({})}).default({}),write:W.object({credentials:W.object({categories:W.record(W.boolean()).default({})}).default({}),personal:W.record(W.boolean()).default({})}).default({})}),hJ=lc.extend({records:W.object({expiresAt:W.string().optional(),oneTime:W.boolean().optional(),terms:P7,contract:N7,uri:W.string(),consenter:Mu,status:mU}).array()}),pJ=W.object({read:W.object({anonymize:W.boolean().optional(),credentials:W.object({categories:W.record(W.object({required:W.boolean().optional()})).optional()}).optional(),personal:W.record(W.object({required:W.boolean().optional()})).optional()}).optional(),write:W.object({credentials:W.object({categories:W.record(W.object({required:W.boolean().optional()})).optional()}).optional(),personal:W.record(W.object({required:W.boolean().optional()})).optional()}).optional()}),bU=W.object({read:W.object({anonymize:W.boolean().optional(),credentials:W.object({shareAll:W.boolean().optional(),sharing:W.boolean().optional(),categories:W.record(W.object({sharing:W.boolean().optional(),shared:W.string().array().optional(),shareAll:W.boolean().optional()}).optional()).optional()}).optional(),personal:W.record(W.string()).optional()}).optional(),write:W.object({credentials:W.object({categories:W.record(W.boolean()).optional()}).optional(),personal:W.record(W.boolean()).optional()}).optional()}),Ib=W.enum(["consent","update","sync","withdraw"]),mJ=W.object({terms:bU.optional(),action:Ib.or(Ib.array()).optional(),date:W.object({$gt:W.string()}).or(W.object({$lt:W.string()})).or(W.object({$eq:W.string()})).optional(),expiresAt:W.object({$gt:W.string()}).or(W.object({$lt:W.string()})).or(W.object({$eq:W.string()})).optional(),oneTime:W.boolean().optional()}),yU=W.object({expiresAt:W.string().optional(),oneTime:W.boolean().optional(),terms:P7.optional(),id:W.string(),action:Ib,date:W.string()}),vJ=lc.extend({records:yU.array()});var wU=Object.create,hd=Object.defineProperty,_U=Object.getOwnPropertyDescriptor,t2=Object.getOwnPropertyNames,EU=Object.getPrototypeOf,AU=Object.prototype.hasOwnProperty,a=i((e,t)=>hd(e,"name",{value:t,configurable:!0}),"__name"),ny=(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[t2(e)[0]])(e=0)),t},"__init"),"__esm"),ze=i((e,t)=>i(function(){return t||(0,e[t2(e)[0]])((t={exports:{}}).exports,t),t.exports},"__require2"),"__commonJS"),Sr=i((e,t)=>{for(var r in t)hd(e,r,{get:t[r],enumerable:!0})},"__export"),XA=i((e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of t2(t))!AU.call(e,s)&&s!==r&&hd(e,s,{get:()=>t[s],enumerable:!(n=_U(t,s))||n.enumerable});return e},"__copyProps"),rr=i((e,t,r)=>(r=e!=null?wU(EU(e)):{},XA(t||!e||!e.__esModule?hd(r,"default",{value:e,enumerable:!0}):r,e)),"__toESM"),kb=i(e=>XA(hd({},"__esModule",{value:!0}),e),"__toCommonJS"),SU=ze({"../../../node_modules/.pnpm/lodash@4.17.21/node_modules/lodash/lodash.js"(e,t){(function(){var r,n="4.17.21",s=200,o="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",c="Expected a function",f="Invalid `variable` option passed into `_.template`",h="__lodash_hash_undefined__",p=500,v="__lodash_placeholder__",y=1,b=2,_=4,T=1,O=2,R=1,P=2,K=4,U=8,j=16,V=32,G=64,I=128,H=256,ae=512,ue=30,me="...",q=800,w=16,x=1,m=2,d=3,g=1/0,S=9007199254740991,D=17976931348623157e292,C=0/0,E=4294967295,B=E-1,$=E>>>1,k=[["ary",I],["bind",R],["bindKey",P],["curry",U],["curryRight",j],["flip",ae],["partial",V],["partialRight",G],["rearg",H]],F="[object Arguments]",he="[object Array]",N="[object AsyncFunction]",Q="[object Boolean]",X="[object Date]",M="[object DOMException]",z="[object Error]",ne="[object Function]",oe="[object GeneratorFunction]",ge="[object Map]",ke="[object Number]",_e="[object Null]",fe="[object Object]",Ce="[object Promise]",pe="[object Proxy]",we="[object RegExp]",te="[object Set]",ve="[object String]",Me="[object Symbol]",Ue="[object Undefined]",Re="[object WeakMap]",je="[object WeakSet]",rt="[object ArrayBuffer]",le="[object DataView]",ce="[object Float32Array]",Y="[object Float64Array]",ie="[object Int8Array]",be="[object Int16Array]",Se="[object Int32Array]",xe="[object Uint8Array]",De="[object Uint8ClampedArray]",Mt="[object Uint16Array]",qe="[object Uint32Array]",He=/\b__p \+= '';/g,Ot=/\b(__p \+=) '' \+/g,dt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,Dr=/[&<>"']/g,ct=RegExp(mt.source),ut=RegExp(Dr.source),lr=/<%-([\s\S]+?)%>/g,lt=/<%([\s\S]+?)%>/g,nt=/<%=([\s\S]+?)%>/g,ar=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,it=/^\w*$/,Ye=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Qt=/[\\^$.*+?()[\]{}|]/g,st=RegExp(Qt.source),Qe=/^\s+/,or=/\s/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Ze=/\{\n\/\* \[wrapped with (.+)\] \*/,cr=/,? & /,ot=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Et=/[()=,{}\[\]\/\s]/,Sn=/\\(\\)?/g,At=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,bt=/\w*$/,fn=/^[-+]0x[0-9a-f]+$/i,er=/^0b[01]+$/i,tr=/^\[object .+?Constructor\]$/,tn=/^0o[0-7]+$/i,rn=/^(?:0|[1-9]\d*)$/,Or=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Hr=/($^)/,nn=/['\n\r\u2028\u2029\\]/g,xn="\\ud800-\\udfff",Ai="\\u0300-\\u036f",Si="\\ufe20-\\ufe2f",xi="\\u20d0-\\u20ff",Pn=Ai+Si+xi,dn="\\u2700-\\u27bf",Xn="a-z\\xdf-\\xf6\\xf8-\\xff",Bn="\\xac\\xb1\\xd7\\xf7",Ti="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",Mi="\\u2000-\\u206f",Ci=" \\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",Gs="A-Z\\xc0-\\xd6\\xd8-\\xde",Ws="\\ufe0e\\ufe0f",Zs=Bn+Ti+Mi+Ci,Ca="['\u2019]",kd="["+xn+"]",vl="["+Zs+"]",To="["+Pn+"]",gl="\\d+",Dd="["+dn+"]",bl="["+Xn+"]",yl="[^"+xn+Zs+gl+dn+Xn+Gs+"]",Mo="\\ud83c[\\udffb-\\udfff]",Od="(?:"+To+"|"+Mo+")",wl="[^"+xn+"]",Js="(?:\\ud83c[\\udde6-\\uddff]){2}",Vi="[\\ud800-\\udbff][\\udc00-\\udfff]",Ys="["+Gs+"]",ms="\\u200d",_l="(?:"+bl+"|"+yl+")",Rd="(?:"+Ys+"|"+yl+")",El="(?:"+Ca+"(?:d|ll|m|re|s|t|ve))?",Al="(?:"+Ca+"(?:D|LL|M|RE|S|T|VE))?",Sl=Od+"?",xl="["+Ws+"]?",Tl="(?:"+ms+"(?:"+[wl,Js,Vi].join("|")+")"+xl+Sl+")*",vs="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Nd="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Lc=xl+Sl+Tl,Pd="(?:"+[Dd,Js,Vi].join("|")+")"+Lc,Ml="(?:"+[wl+To+"?",To,Js,Vi,kd].join("|")+")",Cl=RegExp(Ca,"g"),Bd=RegExp(To,"g"),Il=RegExp(Mo+"(?="+Mo+")|"+Ml+Lc,"g"),kl=RegExp([Ys+"?"+bl+"+"+El+"(?="+[vl,Ys,"$"].join("|")+")",Rd+"+"+Al+"(?="+[vl,Ys+_l,"$"].join("|")+")",Ys+"?"+_l+"+"+El,Ys+"+"+Al,Nd,vs,gl,Pd].join("|"),"g"),Ld=RegExp("["+ms+xn+Pn+Ws+"]"),Co=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Fd=["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"],Fc=-1,br={};br[ce]=br[Y]=br[ie]=br[be]=br[Se]=br[xe]=br[De]=br[Mt]=br[qe]=!0,br[F]=br[he]=br[rt]=br[Q]=br[le]=br[X]=br[z]=br[ne]=br[ge]=br[ke]=br[fe]=br[we]=br[te]=br[ve]=br[Re]=!1;var mr={};mr[F]=mr[he]=mr[rt]=mr[le]=mr[Q]=mr[X]=mr[ce]=mr[Y]=mr[ie]=mr[be]=mr[Se]=mr[ge]=mr[ke]=mr[fe]=mr[we]=mr[te]=mr[ve]=mr[Me]=mr[xe]=mr[De]=mr[Mt]=mr[qe]=!0,mr[z]=mr[ne]=mr[Re]=!1;var se={\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"},Te={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Pe={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},ht={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},qr=parseFloat,sn=parseInt,Tn=typeof global=="object"&&global&&global.Object===Object&&global,hn=typeof self=="object"&&self&&self.Object===Object&&self,Lr=Tn||hn||Function("return this")(),gs=typeof e=="object"&&e&&!e.nodeType&&e,bs=gs&&typeof t=="object"&&t&&!t.nodeType&&t,Dl=bs&&bs.exports===gs,Uc=Dl&&Tn.process,pn=function(){try{var Ee=bs&&bs.require&&bs.require("util").types;return Ee||Uc&&Uc.binding&&Uc.binding("util")}catch{}}(),Io=pn&&pn.isArrayBuffer,D6=pn&&pn.isDate,O6=pn&&pn.isMap,R6=pn&&pn.isRegExp,N6=pn&&pn.isSet,P6=pn&&pn.isTypedArray;function Ln(Ee,Ne,Ie){switch(Ie.length){case 0:return Ee.call(Ne);case 1:return Ee.call(Ne,Ie[0]);case 2:return Ee.call(Ne,Ie[0],Ie[1]);case 3:return Ee.call(Ne,Ie[0],Ie[1],Ie[2])}return Ee.apply(Ne,Ie)}i(Ln,"apply"),a(Ln,"apply");function B6(Ee,Ne,Ie,ft){for(var It=-1,fr=Ee==null?0:Ee.length;++It<fr;){var Vr=Ee[It];Ne(ft,Vr,Ie(Vr),Ee)}return ft}i(B6,"arrayAggregator"),a(B6,"arrayAggregator");function Qn(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length;++Ie<ft&&Ne(Ee[Ie],Ie,Ee)!==!1;);return Ee}i(Qn,"arrayEach"),a(Qn,"arrayEach");function L6(Ee,Ne){for(var Ie=Ee==null?0:Ee.length;Ie--&&Ne(Ee[Ie],Ie,Ee)!==!1;);return Ee}i(L6,"arrayEachRight"),a(L6,"arrayEachRight");function Xm(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length;++Ie<ft;)if(!Ne(Ee[Ie],Ie,Ee))return!1;return!0}i(Xm,"arrayEvery"),a(Xm,"arrayEvery");function Xs(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length,It=0,fr=[];++Ie<ft;){var Vr=Ee[Ie];Ne(Vr,Ie,Ee)&&(fr[It++]=Vr)}return fr}i(Xs,"arrayFilter"),a(Xs,"arrayFilter");function Ol(Ee,Ne){var Ie=Ee==null?0:Ee.length;return!!Ie&&ko(Ee,Ne,0)>-1}i(Ol,"arrayIncludes"),a(Ol,"arrayIncludes");function Ud(Ee,Ne,Ie){for(var ft=-1,It=Ee==null?0:Ee.length;++ft<It;)if(Ie(Ne,Ee[ft]))return!0;return!1}i(Ud,"arrayIncludesWith"),a(Ud,"arrayIncludesWith");function Tr(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length,It=Array(ft);++Ie<ft;)It[Ie]=Ne(Ee[Ie],Ie,Ee);return It}i(Tr,"arrayMap"),a(Tr,"arrayMap");function Qs(Ee,Ne){for(var Ie=-1,ft=Ne.length,It=Ee.length;++Ie<ft;)Ee[It+Ie]=Ne[Ie];return Ee}i(Qs,"arrayPush"),a(Qs,"arrayPush");function $d(Ee,Ne,Ie,ft){var It=-1,fr=Ee==null?0:Ee.length;for(ft&&fr&&(Ie=Ee[++It]);++It<fr;)Ie=Ne(Ie,Ee[It],It,Ee);return Ie}i($d,"arrayReduce"),a($d,"arrayReduce");function F6(Ee,Ne,Ie,ft){var It=Ee==null?0:Ee.length;for(ft&&It&&(Ie=Ee[--It]);It--;)Ie=Ne(Ie,Ee[It],It,Ee);return Ie}i(F6,"arrayReduceRight"),a(F6,"arrayReduceRight");function jd(Ee,Ne){for(var Ie=-1,ft=Ee==null?0:Ee.length;++Ie<ft;)if(Ne(Ee[Ie],Ie,Ee))return!0;return!1}i(jd,"arraySome"),a(jd,"arraySome");var Ck=zd("length");function U6(Ee){return Ee.split("")}i(U6,"asciiToArray"),a(U6,"asciiToArray");function $6(Ee){return Ee.match(ot)||[]}i($6,"asciiWords"),a($6,"asciiWords");function Qm(Ee,Ne,Ie){var ft;return Ie(Ee,function(It,fr,Vr){if(Ne(It,fr,Vr))return ft=fr,!1}),ft}i(Qm,"baseFindKey"),a(Qm,"baseFindKey");function Rl(Ee,Ne,Ie,ft){for(var It=Ee.length,fr=Ie+(ft?1:-1);ft?fr--:++fr<It;)if(Ne(Ee[fr],fr,Ee))return fr;return-1}i(Rl,"baseFindIndex"),a(Rl,"baseFindIndex");function ko(Ee,Ne,Ie){return Ne===Ne?J6(Ee,Ne,Ie):Rl(Ee,e1,Ie)}i(ko,"baseIndexOf"),a(ko,"baseIndexOf");function j6(Ee,Ne,Ie,ft){for(var It=Ie-1,fr=Ee.length;++It<fr;)if(ft(Ee[It],Ne))return It;return-1}i(j6,"baseIndexOfWith"),a(j6,"baseIndexOfWith");function e1(Ee){return Ee!==Ee}i(e1,"baseIsNaN"),a(e1,"baseIsNaN");function t1(Ee,Ne){var Ie=Ee==null?0:Ee.length;return Ie?qd(Ee,Ne)/Ie:C}i(t1,"baseMean"),a(t1,"baseMean");function zd(Ee){return function(Ne){return Ne==null?r:Ne[Ee]}}i(zd,"baseProperty"),a(zd,"baseProperty");function Hd(Ee){return function(Ne){return Ee==null?r:Ee[Ne]}}i(Hd,"basePropertyOf"),a(Hd,"basePropertyOf");function r1(Ee,Ne,Ie,ft,It){return It(Ee,function(fr,Vr,wr){Ie=ft?(ft=!1,fr):Ne(Ie,fr,Vr,wr)}),Ie}i(r1,"baseReduce"),a(r1,"baseReduce");function z6(Ee,Ne){var Ie=Ee.length;for(Ee.sort(Ne);Ie--;)Ee[Ie]=Ee[Ie].value;return Ee}i(z6,"baseSortBy"),a(z6,"baseSortBy");function qd(Ee,Ne){for(var Ie,ft=-1,It=Ee.length;++ft<It;){var fr=Ne(Ee[ft]);fr!==r&&(Ie=Ie===r?fr:Ie+fr)}return Ie}i(qd,"baseSum"),a(qd,"baseSum");function Kd(Ee,Ne){for(var Ie=-1,ft=Array(Ee);++Ie<Ee;)ft[Ie]=Ne(Ie);return ft}i(Kd,"baseTimes"),a(Kd,"baseTimes");function H6(Ee,Ne){return Tr(Ne,function(Ie){return[Ie,Ee[Ie]]})}i(H6,"baseToPairs"),a(H6,"baseToPairs");function n1(Ee){return Ee&&Ee.slice(0,o1(Ee)+1).replace(Qe,"")}i(n1,"baseTrim"),a(n1,"baseTrim");function Fn(Ee){return function(Ne){return Ee(Ne)}}i(Fn,"baseUnary"),a(Fn,"baseUnary");function Vd(Ee,Ne){return Tr(Ne,function(Ie){return Ee[Ie]})}i(Vd,"baseValues"),a(Vd,"baseValues");function $c(Ee,Ne){return Ee.has(Ne)}i($c,"cacheHas"),a($c,"cacheHas");function i1(Ee,Ne){for(var Ie=-1,ft=Ee.length;++Ie<ft&&ko(Ne,Ee[Ie],0)>-1;);return Ie}i(i1,"charsStartIndex"),a(i1,"charsStartIndex");function s1(Ee,Ne){for(var Ie=Ee.length;Ie--&&ko(Ne,Ee[Ie],0)>-1;);return Ie}i(s1,"charsEndIndex"),a(s1,"charsEndIndex");function q6(Ee,Ne){for(var Ie=Ee.length,ft=0;Ie--;)Ee[Ie]===Ne&&++ft;return ft}i(q6,"countHolders"),a(q6,"countHolders");var Ik=Hd(se),kk=Hd(Te);function K6(Ee){return"\\"+ht[Ee]}i(K6,"escapeStringChar"),a(K6,"escapeStringChar");function V6(Ee,Ne){return Ee==null?r:Ee[Ne]}i(V6,"getValue"),a(V6,"getValue");function Do(Ee){return Ld.test(Ee)}i(Do,"hasUnicode"),a(Do,"hasUnicode");function G6(Ee){return Co.test(Ee)}i(G6,"hasUnicodeWord"),a(G6,"hasUnicodeWord");function W6(Ee){for(var Ne,Ie=[];!(Ne=Ee.next()).done;)Ie.push(Ne.value);return Ie}i(W6,"iteratorToArray"),a(W6,"iteratorToArray");function Gd(Ee){var Ne=-1,Ie=Array(Ee.size);return Ee.forEach(function(ft,It){Ie[++Ne]=[It,ft]}),Ie}i(Gd,"mapToArray"),a(Gd,"mapToArray");function a1(Ee,Ne){return function(Ie){return Ee(Ne(Ie))}}i(a1,"overArg"),a(a1,"overArg");function ea(Ee,Ne){for(var Ie=-1,ft=Ee.length,It=0,fr=[];++Ie<ft;){var Vr=Ee[Ie];(Vr===Ne||Vr===v)&&(Ee[Ie]=v,fr[It++]=Ie)}return fr}i(ea,"replaceHolders"),a(ea,"replaceHolders");function Nl(Ee){var Ne=-1,Ie=Array(Ee.size);return Ee.forEach(function(ft){Ie[++Ne]=ft}),Ie}i(Nl,"setToArray"),a(Nl,"setToArray");function Z6(Ee){var Ne=-1,Ie=Array(Ee.size);return Ee.forEach(function(ft){Ie[++Ne]=[ft,ft]}),Ie}i(Z6,"setToPairs"),a(Z6,"setToPairs");function J6(Ee,Ne,Ie){for(var ft=Ie-1,It=Ee.length;++ft<It;)if(Ee[ft]===Ne)return ft;return-1}i(J6,"strictIndexOf"),a(J6,"strictIndexOf");function Y6(Ee,Ne,Ie){for(var ft=Ie+1;ft--;)if(Ee[ft]===Ne)return ft;return ft}i(Y6,"strictLastIndexOf"),a(Y6,"strictLastIndexOf");function Oo(Ee){return Do(Ee)?X6(Ee):Ck(Ee)}i(Oo,"stringSize"),a(Oo,"stringSize");function Ii(Ee){return Do(Ee)?Q6(Ee):U6(Ee)}i(Ii,"stringToArray"),a(Ii,"stringToArray");function o1(Ee){for(var Ne=Ee.length;Ne--&&or.test(Ee.charAt(Ne)););return Ne}i(o1,"trimmedEndIndex"),a(o1,"trimmedEndIndex");var Dk=Hd(Pe);function X6(Ee){for(var Ne=Il.lastIndex=0;Il.test(Ee);)++Ne;return Ne}i(X6,"unicodeSize"),a(X6,"unicodeSize");function Q6(Ee){return Ee.match(Il)||[]}i(Q6,"unicodeToArray"),a(Q6,"unicodeToArray");function e3(Ee){return Ee.match(kl)||[]}i(e3,"unicodeWords"),a(e3,"unicodeWords");var Ok=a(i(function Ee(Ne){Ne=Ne==null?Lr:Ia.defaults(Lr.Object(),Ne,Ia.pick(Lr,Fd));var Ie=Ne.Array,ft=Ne.Date,It=Ne.Error,fr=Ne.Function,Vr=Ne.Math,wr=Ne.Object,c1=Ne.RegExp,Rk=Ne.String,ki=Ne.TypeError,Wd=Ie.prototype,Nk=fr.prototype,jc=wr.prototype,Zd=Ne["__core-js_shared__"],Jd=Nk.toString,vr=jc.hasOwnProperty,Pk=0,t3=function(){var u=/[^.]+$/.exec(Zd&&Zd.keys&&Zd.keys.IE_PROTO||"");return u?"Symbol(src)_1."+u:""}(),Yd=jc.toString,Bk=Jd.call(wr),Lk=Lr._,Fk=c1("^"+Jd.call(vr).replace(Qt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xd=Dl?Ne.Buffer:r,ka=Ne.Symbol,Qd=Ne.Uint8Array,r3=Xd?Xd.allocUnsafe:r,eh=a1(wr.getPrototypeOf,wr),n3=wr.create,i3=jc.propertyIsEnumerable,th=Wd.splice,s3=ka?ka.isConcatSpreadable:r,Pl=ka?ka.iterator:r,Ro=ka?ka.toStringTag:r,rh=function(){try{var u=Ba(wr,"defineProperty");return u({},"",{}),u}catch{}}(),Uk=Ne.clearTimeout!==Lr.clearTimeout&&Ne.clearTimeout,$k=ft&&ft.now!==Lr.Date.now&&ft.now,jk=Ne.setTimeout!==Lr.setTimeout&&Ne.setTimeout,nh=Vr.ceil,ih=Vr.floor,u1=wr.getOwnPropertySymbols,zk=Xd?Xd.isBuffer:r,a3=Ne.isFinite,Hk=Wd.join,qk=a1(wr.keys,wr),Gr=Vr.max,mn=Vr.min,Kk=ft.now,Vk=Ne.parseInt,o3=Vr.random,Gk=Wd.reverse,l1=Ba(Ne,"DataView"),Bl=Ba(Ne,"Map"),f1=Ba(Ne,"Promise"),zc=Ba(Ne,"Set"),Ll=Ba(Ne,"WeakMap"),Fl=Ba(wr,"create"),sh=Ll&&new Ll,Hc={},Wk=La(l1),Zk=La(Bl),Jk=La(f1),Yk=La(zc),Xk=La(Ll),ah=ka?ka.prototype:r,Ul=ah?ah.valueOf:r,c3=ah?ah.toString:r;function ee(u){if(kr(u)&&!Rt(u)&&!(u instanceof Vt)){if(u instanceof ei)return u;if(vr.call(u,"__wrapped__"))return uv(u)}return new ei(u)}i(ee,"lodash"),a(ee,"lodash");var qc=function(){function u(){}return i(u,"object"),a(u,"object"),function(l){if(!Cr(l))return{};if(n3)return n3(l);u.prototype=l;var A=new u;return u.prototype=r,A}}();function $l(){}i($l,"baseLodash"),a($l,"baseLodash");function ei(u,l){this.__wrapped__=u,this.__actions__=[],this.__chain__=!!l,this.__index__=0,this.__values__=r}i(ei,"LodashWrapper"),a(ei,"LodashWrapper"),ee.templateSettings={escape:lr,evaluate:lt,interpolate:nt,variable:"",imports:{_:ee}},ee.prototype=$l.prototype,ee.prototype.constructor=ee,ei.prototype=qc($l.prototype),ei.prototype.constructor=ei;function Vt(u){this.__wrapped__=u,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=E,this.__views__=[]}i(Vt,"LazyWrapper"),a(Vt,"LazyWrapper");function u3(){var u=new Vt(this.__wrapped__);return u.__actions__=Mn(this.__actions__),u.__dir__=this.__dir__,u.__filtered__=this.__filtered__,u.__iteratees__=Mn(this.__iteratees__),u.__takeCount__=this.__takeCount__,u.__views__=Mn(this.__views__),u}i(u3,"lazyClone"),a(u3,"lazyClone");function l3(){if(this.__filtered__){var u=new Vt(this);u.__dir__=-1,u.__filtered__=!0}else u=this.clone(),u.__dir__*=-1;return u}i(l3,"lazyReverse"),a(l3,"lazyReverse");function f3(){var u=this.__wrapped__.value(),l=this.__dir__,A=Rt(u),L=l<0,Z=A?u.length:0,re=x5(0,Z,this.__views__),de=re.start,ye=re.end,Ae=ye-de,Be=L?ye:de-1,Le=this.__iteratees__,$e=Le.length,Je=0,pt=mn(Ae,this.__takeCount__);if(!A||!L&&Z==Ae&&pt==Ae)return R1(u,this.__actions__);var St=[];e:for(;Ae--&&Je<pt;){Be+=l;for(var Lt=-1,_t=u[Be];++Lt<$e;){var Ht=Le[Lt],Gt=Ht.iteratee,jn=Ht.type,yn=Gt(_t);if(jn==m)_t=yn;else if(!yn){if(jn==x)continue e;break e}}St[Je++]=_t}return St}i(f3,"lazyValue"),a(f3,"lazyValue"),Vt.prototype=qc($l.prototype),Vt.prototype.constructor=Vt;function Da(u){var l=-1,A=u==null?0:u.length;for(this.clear();++l<A;){var L=u[l];this.set(L[0],L[1])}}i(Da,"Hash"),a(Da,"Hash");function d3(){this.__data__=Fl?Fl(null):{},this.size=0}i(d3,"hashClear"),a(d3,"hashClear");function h3(u){var l=this.has(u)&&delete this.__data__[u];return this.size-=l?1:0,l}i(h3,"hashDelete"),a(h3,"hashDelete");function p3(u){var l=this.__data__;if(Fl){var A=l[u];return A===h?r:A}return vr.call(l,u)?l[u]:r}i(p3,"hashGet"),a(p3,"hashGet");function m3(u){var l=this.__data__;return Fl?l[u]!==r:vr.call(l,u)}i(m3,"hashHas"),a(m3,"hashHas");function v3(u,l){var A=this.__data__;return this.size+=this.has(u)?0:1,A[u]=Fl&&l===r?h:l,this}i(v3,"hashSet"),a(v3,"hashSet"),Da.prototype.clear=d3,Da.prototype.delete=h3,Da.prototype.get=p3,Da.prototype.has=m3,Da.prototype.set=v3;function ys(u){var l=-1,A=u==null?0:u.length;for(this.clear();++l<A;){var L=u[l];this.set(L[0],L[1])}}i(ys,"ListCache"),a(ys,"ListCache");function g3(){this.__data__=[],this.size=0}i(g3,"listCacheClear"),a(g3,"listCacheClear");function b3(u){var l=this.__data__,A=jl(l,u);if(A<0)return!1;var L=l.length-1;return A==L?l.pop():th.call(l,A,1),--this.size,!0}i(b3,"listCacheDelete"),a(b3,"listCacheDelete");function y3(u){var l=this.__data__,A=jl(l,u);return A<0?r:l[A][1]}i(y3,"listCacheGet"),a(y3,"listCacheGet");function w3(u){return jl(this.__data__,u)>-1}i(w3,"listCacheHas"),a(w3,"listCacheHas");function _3(u,l){var A=this.__data__,L=jl(A,u);return L<0?(++this.size,A.push([u,l])):A[L][1]=l,this}i(_3,"listCacheSet"),a(_3,"listCacheSet"),ys.prototype.clear=g3,ys.prototype.delete=b3,ys.prototype.get=y3,ys.prototype.has=w3,ys.prototype.set=_3;function ws(u){var l=-1,A=u==null?0:u.length;for(this.clear();++l<A;){var L=u[l];this.set(L[0],L[1])}}i(ws,"MapCache"),a(ws,"MapCache");function E3(){this.size=0,this.__data__={hash:new Da,map:new(Bl||ys),string:new Da}}i(E3,"mapCacheClear"),a(E3,"mapCacheClear");function A3(u){var l=Ql(this,u).delete(u);return this.size-=l?1:0,l}i(A3,"mapCacheDelete"),a(A3,"mapCacheDelete");function S3(u){return Ql(this,u).get(u)}i(S3,"mapCacheGet"),a(S3,"mapCacheGet");function x3(u){return Ql(this,u).has(u)}i(x3,"mapCacheHas"),a(x3,"mapCacheHas");function T3(u,l){var A=Ql(this,u),L=A.size;return A.set(u,l),this.size+=A.size==L?0:1,this}i(T3,"mapCacheSet"),a(T3,"mapCacheSet"),ws.prototype.clear=E3,ws.prototype.delete=A3,ws.prototype.get=S3,ws.prototype.has=x3,ws.prototype.set=T3;function Oa(u){var l=-1,A=u==null?0:u.length;for(this.__data__=new ws;++l<A;)this.add(u[l])}i(Oa,"SetCache"),a(Oa,"SetCache");function M3(u){return this.__data__.set(u,h),this}i(M3,"setCacheAdd"),a(M3,"setCacheAdd");function C3(u){return this.__data__.has(u)}i(C3,"setCacheHas"),a(C3,"setCacheHas"),Oa.prototype.add=Oa.prototype.push=M3,Oa.prototype.has=C3;function Di(u){var l=this.__data__=new ys(u);this.size=l.size}i(Di,"Stack"),a(Di,"Stack");function I3(){this.__data__=new ys,this.size=0}i(I3,"stackClear"),a(I3,"stackClear");function k3(u){var l=this.__data__,A=l.delete(u);return this.size=l.size,A}i(k3,"stackDelete"),a(k3,"stackDelete");function D3(u){return this.__data__.get(u)}i(D3,"stackGet"),a(D3,"stackGet");function O3(u){return this.__data__.has(u)}i(O3,"stackHas"),a(O3,"stackHas");function R3(u,l){var A=this.__data__;if(A instanceof ys){var L=A.__data__;if(!Bl||L.length<s-1)return L.push([u,l]),this.size=++A.size,this;A=this.__data__=new ws(L)}return A.set(u,l),this.size=A.size,this}i(R3,"stackSet"),a(R3,"stackSet"),Di.prototype.clear=I3,Di.prototype.delete=k3,Di.prototype.get=D3,Di.prototype.has=O3,Di.prototype.set=R3;function d1(u,l){var A=Rt(u),L=!A&&Lo(u),Z=!A&&!L&&Fa(u),re=!A&&!L&&!Z&&Qc(u),de=A||L||Z||re,ye=de?Kd(u.length,Rk):[],Ae=ye.length;for(var Be in u)(l||vr.call(u,Be))&&!(de&&(Be=="length"||Z&&(Be=="offset"||Be=="parent")||re&&(Be=="buffer"||Be=="byteLength"||Be=="byteOffset")||Ss(Be,Ae)))&&ye.push(Be);return ye}i(d1,"arrayLikeKeys"),a(d1,"arrayLikeKeys");function h1(u){var l=u.length;return l?u[vh(0,l-1)]:r}i(h1,"arraySample"),a(h1,"arraySample");function N3(u,l){return tf(Mn(u),Ra(l,0,u.length))}i(N3,"arraySampleSize"),a(N3,"arraySampleSize");function P3(u){return tf(Mn(u))}i(P3,"arrayShuffle"),a(P3,"arrayShuffle");function oh(u,l,A){(A!==r&&!Oi(u[l],A)||A===r&&!(l in u))&&_s(u,l,A)}i(oh,"assignMergeValue"),a(oh,"assignMergeValue");function Kc(u,l,A){var L=u[l];(!(vr.call(u,l)&&Oi(L,A))||A===r&&!(l in u))&&_s(u,l,A)}i(Kc,"assignValue"),a(Kc,"assignValue");function jl(u,l){for(var A=u.length;A--;)if(Oi(u[A][0],l))return A;return-1}i(jl,"assocIndexOf"),a(jl,"assocIndexOf");function B3(u,l,A,L){return Na(u,function(Z,re,de){l(L,Z,A(Z),de)}),L}i(B3,"baseAggregator"),a(B3,"baseAggregator");function p1(u,l){return u&&Wi(l,Wr(l),u)}i(p1,"baseAssign"),a(p1,"baseAssign");function L3(u,l){return u&&Wi(l,In(l),u)}i(L3,"baseAssignIn"),a(L3,"baseAssignIn");function _s(u,l,A){l=="__proto__"&&rh?rh(u,l,{configurable:!0,enumerable:!0,value:A,writable:!0}):u[l]=A}i(_s,"baseAssignValue"),a(_s,"baseAssignValue");function ch(u,l){for(var A=-1,L=l.length,Z=Ie(L),re=u==null;++A<L;)Z[A]=re?r:Lh(u,l[A]);return Z}i(ch,"baseAt"),a(ch,"baseAt");function Ra(u,l,A){return u===u&&(A!==r&&(u=u<=A?u:A),l!==r&&(u=u>=l?u:l)),u}i(Ra,"baseClamp"),a(Ra,"baseClamp");function ti(u,l,A,L,Z,re){var de,ye=l&y,Ae=l&b,Be=l&_;if(A&&(de=Z?A(u,L,Z,re):A(u)),de!==r)return de;if(!Cr(u))return u;var Le=Rt(u);if(Le){if(de=M5(u),!ye)return Mn(u,de)}else{var $e=gn(u),Je=$e==ne||$e==oe;if(Fa(u))return P1(u,ye);if($e==fe||$e==F||Je&&!Z){if(de=Ae||Je?{}:tv(u),!ye)return Ae?v5(u,L3(de,u)):m5(u,p1(de,u))}else{if(!mr[$e])return Z?u:{};de=C5(u,$e,ye)}}re||(re=new Di);var pt=re.get(u);if(pt)return pt;re.set(u,de),S4(u)?u.forEach(function(_t){de.add(ti(_t,l,A,_t,u,re))}):v4(u)&&u.forEach(function(_t,Ht){de.set(Ht,ti(_t,l,A,Ht,u,re))});var St=Be?Ae?Mh:Th:Ae?In:Wr,Lt=Le?r:St(u);return Qn(Lt||u,function(_t,Ht){Lt&&(Ht=_t,_t=u[Ht]),Kc(de,Ht,ti(_t,l,A,Ht,u,re))}),de}i(ti,"baseClone"),a(ti,"baseClone");function F3(u){var l=Wr(u);return function(A){return m1(A,u,l)}}i(F3,"baseConforms"),a(F3,"baseConforms");function m1(u,l,A){var L=A.length;if(u==null)return!L;for(u=wr(u);L--;){var Z=A[L],re=l[Z],de=u[Z];if(de===r&&!(Z in u)||!re(de))return!1}return!0}i(m1,"baseConformsTo"),a(m1,"baseConformsTo");function v1(u,l,A){if(typeof u!="function")throw new ki(c);return ef(function(){u.apply(r,A)},l)}i(v1,"baseDelay"),a(v1,"baseDelay");function Vc(u,l,A,L){var Z=-1,re=Ol,de=!0,ye=u.length,Ae=[],Be=l.length;if(!ye)return Ae;A&&(l=Tr(l,Fn(A))),L?(re=Ud,de=!1):l.length>=s&&(re=$c,de=!1,l=new Oa(l));e:for(;++Z<ye;){var Le=u[Z],$e=A==null?Le:A(Le);if(Le=L||Le!==0?Le:0,de&&$e===$e){for(var Je=Be;Je--;)if(l[Je]===$e)continue e;Ae.push(Le)}else re(l,$e,L)||Ae.push(Le)}return Ae}i(Vc,"baseDifference"),a(Vc,"baseDifference");var Na=$1(Gi),U3=$1(uh,!0);function $3(u,l){var A=!0;return Na(u,function(L,Z,re){return A=!!l(L,Z,re),A}),A}i($3,"baseEvery"),a($3,"baseEvery");function zl(u,l,A){for(var L=-1,Z=u.length;++L<Z;){var re=u[L],de=l(re);if(de!=null&&(ye===r?de===de&&!$n(de):A(de,ye)))var ye=de,Ae=re}return Ae}i(zl,"baseExtremum"),a(zl,"baseExtremum");function j3(u,l,A,L){var Z=u.length;for(A=Nt(A),A<0&&(A=-A>Z?0:Z+A),L=L===r||L>Z?Z:Nt(L),L<0&&(L+=Z),L=A>L?0:kv(L);A<L;)u[A++]=l;return u}i(j3,"baseFill"),a(j3,"baseFill");function g1(u,l){var A=[];return Na(u,function(L,Z,re){l(L,Z,re)&&A.push(L)}),A}i(g1,"baseFilter"),a(g1,"baseFilter");function Jr(u,l,A,L,Z){var re=-1,de=u.length;for(A||(A=k5),Z||(Z=[]);++re<de;){var ye=u[re];l>0&&A(ye)?l>1?Jr(ye,l-1,A,L,Z):Qs(Z,ye):L||(Z[Z.length]=ye)}return Z}i(Jr,"baseFlatten"),a(Jr,"baseFlatten");var b1=j1(),z3=j1(!0);function Gi(u,l){return u&&b1(u,l,Wr)}i(Gi,"baseForOwn"),a(Gi,"baseForOwn");function uh(u,l){return u&&z3(u,l,Wr)}i(uh,"baseForOwnRight"),a(uh,"baseForOwnRight");function Hl(u,l){return Xs(l,function(A){return xs(u[A])})}i(Hl,"baseFunctions"),a(Hl,"baseFunctions");function Pa(u,l){l=ra(l,u);for(var A=0,L=l.length;u!=null&&A<L;)u=u[Zi(l[A++])];return A&&A==L?u:r}i(Pa,"baseGet"),a(Pa,"baseGet");function y1(u,l,A){var L=l(u);return Rt(u)?L:Qs(L,A(u))}i(y1,"baseGetAllKeys"),a(y1,"baseGetAllKeys");function vn(u){return u==null?u===r?Ue:_e:Ro&&Ro in wr(u)?A5(u):B5(u)}i(vn,"baseGetTag"),a(vn,"baseGetTag");function lh(u,l){return u>l}i(lh,"baseGt"),a(lh,"baseGt");function H3(u,l){return u!=null&&vr.call(u,l)}i(H3,"baseHas"),a(H3,"baseHas");function q3(u,l){return u!=null&&l in wr(u)}i(q3,"baseHasIn"),a(q3,"baseHasIn");function K3(u,l,A){return u>=mn(l,A)&&u<Gr(l,A)}i(K3,"baseInRange"),a(K3,"baseInRange");function fh(u,l,A){for(var L=A?Ud:Ol,Z=u[0].length,re=u.length,de=re,ye=Ie(re),Ae=1/0,Be=[];de--;){var Le=u[de];de&&l&&(Le=Tr(Le,Fn(l))),Ae=mn(Le.length,Ae),ye[de]=!A&&(l||Z>=120&&Le.length>=120)?new Oa(de&&Le):r}Le=u[0];var $e=-1,Je=ye[0];e:for(;++$e<Z&&Be.length<Ae;){var pt=Le[$e],St=l?l(pt):pt;if(pt=A||pt!==0?pt:0,!(Je?$c(Je,St):L(Be,St,A))){for(de=re;--de;){var Lt=ye[de];if(!(Lt?$c(Lt,St):L(u[de],St,A)))continue e}Je&&Je.push(St),Be.push(pt)}}return Be}i(fh,"baseIntersection"),a(fh,"baseIntersection");function V3(u,l,A,L){return Gi(u,function(Z,re,de){l(L,A(Z),re,de)}),L}i(V3,"baseInverter"),a(V3,"baseInverter");function Gc(u,l,A){l=ra(l,u),u=sv(u,l);var L=u==null?u:u[Zi(ni(l))];return L==null?r:Ln(L,u,A)}i(Gc,"baseInvoke"),a(Gc,"baseInvoke");function w1(u){return kr(u)&&vn(u)==F}i(w1,"baseIsArguments"),a(w1,"baseIsArguments");function G3(u){return kr(u)&&vn(u)==rt}i(G3,"baseIsArrayBuffer"),a(G3,"baseIsArrayBuffer");function W3(u){return kr(u)&&vn(u)==X}i(W3,"baseIsDate"),a(W3,"baseIsDate");function Wc(u,l,A,L,Z){return u===l?!0:u==null||l==null||!kr(u)&&!kr(l)?u!==u&&l!==l:Z3(u,l,A,L,Wc,Z)}i(Wc,"baseIsEqual"),a(Wc,"baseIsEqual");function Z3(u,l,A,L,Z,re){var de=Rt(u),ye=Rt(l),Ae=de?he:gn(u),Be=ye?he:gn(l);Ae=Ae==F?fe:Ae,Be=Be==F?fe:Be;var Le=Ae==fe,$e=Be==fe,Je=Ae==Be;if(Je&&Fa(u)){if(!Fa(l))return!1;de=!0,Le=!1}if(Je&&!Le)return re||(re=new Di),de||Qc(u)?Y1(u,l,A,L,Z,re):_5(u,l,Ae,A,L,Z,re);if(!(A&T)){var pt=Le&&vr.call(u,"__wrapped__"),St=$e&&vr.call(l,"__wrapped__");if(pt||St){var Lt=pt?u.value():u,_t=St?l.value():l;return re||(re=new Di),Z(Lt,_t,A,L,re)}}return Je?(re||(re=new Di),E5(u,l,A,L,Z,re)):!1}i(Z3,"baseIsEqualDeep"),a(Z3,"baseIsEqualDeep");function J3(u){return kr(u)&&gn(u)==ge}i(J3,"baseIsMap"),a(J3,"baseIsMap");function dh(u,l,A,L){var Z=A.length,re=Z,de=!L;if(u==null)return!re;for(u=wr(u);Z--;){var ye=A[Z];if(de&&ye[2]?ye[1]!==u[ye[0]]:!(ye[0]in u))return!1}for(;++Z<re;){ye=A[Z];var Ae=ye[0],Be=u[Ae],Le=ye[1];if(de&&ye[2]){if(Be===r&&!(Ae in u))return!1}else{var $e=new Di;if(L)var Je=L(Be,Le,Ae,u,l,$e);if(!(Je===r?Wc(Le,Be,T|O,L,$e):Je))return!1}}return!0}i(dh,"baseIsMatch"),a(dh,"baseIsMatch");function _1(u){if(!Cr(u)||O5(u))return!1;var l=xs(u)?Fk:tr;return l.test(La(u))}i(_1,"baseIsNative"),a(_1,"baseIsNative");function Y3(u){return kr(u)&&vn(u)==we}i(Y3,"baseIsRegExp"),a(Y3,"baseIsRegExp");function X3(u){return kr(u)&&gn(u)==te}i(X3,"baseIsSet"),a(X3,"baseIsSet");function Q3(u){return kr(u)&&of(u.length)&&!!br[vn(u)]}i(Q3,"baseIsTypedArray"),a(Q3,"baseIsTypedArray");function E1(u){return typeof u=="function"?u:u==null?kn:typeof u=="object"?Rt(u)?x1(u[0],u[1]):S1(u):Lv(u)}i(E1,"baseIteratee"),a(E1,"baseIteratee");function hh(u){if(!Yc(u))return qk(u);var l=[];for(var A in wr(u))vr.call(u,A)&&A!="constructor"&&l.push(A);return l}i(hh,"baseKeys"),a(hh,"baseKeys");function e5(u){if(!Cr(u))return P5(u);var l=Yc(u),A=[];for(var L in u)L=="constructor"&&(l||!vr.call(u,L))||A.push(L);return A}i(e5,"baseKeysIn"),a(e5,"baseKeysIn");function ph(u,l){return u<l}i(ph,"baseLt"),a(ph,"baseLt");function A1(u,l){var A=-1,L=Cn(u)?Ie(u.length):[];return Na(u,function(Z,re,de){L[++A]=l(Z,re,de)}),L}i(A1,"baseMap"),a(A1,"baseMap");function S1(u){var l=Ch(u);return l.length==1&&l[0][2]?nv(l[0][0],l[0][1]):function(A){return A===u||dh(A,u,l)}}i(S1,"baseMatches"),a(S1,"baseMatches");function x1(u,l){return Ih(u)&&rv(l)?nv(Zi(u),l):function(A){var L=Lh(A,u);return L===r&&L===l?Fh(A,u):Wc(l,L,T|O)}}i(x1,"baseMatchesProperty"),a(x1,"baseMatchesProperty");function ql(u,l,A,L,Z){u!==l&&b1(l,function(re,de){if(Z||(Z=new Di),Cr(re))t5(u,l,de,A,ql,L,Z);else{var ye=L?L(Dh(u,de),re,de+"",u,l,Z):r;ye===r&&(ye=re),oh(u,de,ye)}},In)}i(ql,"baseMerge"),a(ql,"baseMerge");function t5(u,l,A,L,Z,re,de){var ye=Dh(u,A),Ae=Dh(l,A),Be=de.get(Ae);if(Be){oh(u,A,Be);return}var Le=re?re(ye,Ae,A+"",u,l,de):r,$e=Le===r;if($e){var Je=Rt(Ae),pt=!Je&&Fa(Ae),St=!Je&&!pt&&Qc(Ae);Le=Ae,Je||pt||St?Rt(ye)?Le=ye:Rr(ye)?Le=Mn(ye):pt?($e=!1,Le=P1(Ae,!0)):St?($e=!1,Le=B1(Ae,!0)):Le=[]:Xc(Ae)||Lo(Ae)?(Le=ye,Lo(ye)?Le=Dv(ye):(!Cr(ye)||xs(ye))&&(Le=tv(Ae))):$e=!1}$e&&(de.set(Ae,Le),Z(Le,Ae,L,re,de),de.delete(Ae)),oh(u,A,Le)}i(t5,"baseMergeDeep"),a(t5,"baseMergeDeep");function T1(u,l){var A=u.length;if(!!A)return l+=l<0?A:0,Ss(l,A)?u[l]:r}i(T1,"baseNth"),a(T1,"baseNth");function M1(u,l,A){l.length?l=Tr(l,function(re){return Rt(re)?function(de){return Pa(de,re.length===1?re[0]:re)}:re}):l=[kn];var L=-1;l=Tr(l,Fn(wt()));var Z=A1(u,function(re,de,ye){var Ae=Tr(l,function(Be){return Be(re)});return{criteria:Ae,index:++L,value:re}});return z6(Z,function(re,de){return p5(re,de,A)})}i(M1,"baseOrderBy"),a(M1,"baseOrderBy");function r5(u,l){return C1(u,l,function(A,L){return Fh(u,L)})}i(r5,"basePick"),a(r5,"basePick");function C1(u,l,A){for(var L=-1,Z=l.length,re={};++L<Z;){var de=l[L],ye=Pa(u,de);A(ye,de)&&Zc(re,ra(de,u),ye)}return re}i(C1,"basePickBy"),a(C1,"basePickBy");function n5(u){return function(l){return Pa(l,u)}}i(n5,"basePropertyDeep"),a(n5,"basePropertyDeep");function mh(u,l,A,L){var Z=L?j6:ko,re=-1,de=l.length,ye=u;for(u===l&&(l=Mn(l)),A&&(ye=Tr(u,Fn(A)));++re<de;)for(var Ae=0,Be=l[re],Le=A?A(Be):Be;(Ae=Z(ye,Le,Ae,L))>-1;)ye!==u&&th.call(ye,Ae,1),th.call(u,Ae,1);return u}i(mh,"basePullAll"),a(mh,"basePullAll");function I1(u,l){for(var A=u?l.length:0,L=A-1;A--;){var Z=l[A];if(A==L||Z!==re){var re=Z;Ss(Z)?th.call(u,Z,1):yh(u,Z)}}return u}i(I1,"basePullAt"),a(I1,"basePullAt");function vh(u,l){return u+ih(o3()*(l-u+1))}i(vh,"baseRandom"),a(vh,"baseRandom");function i5(u,l,A,L){for(var Z=-1,re=Gr(nh((l-u)/(A||1)),0),de=Ie(re);re--;)de[L?re:++Z]=u,u+=A;return de}i(i5,"baseRange"),a(i5,"baseRange");function gh(u,l){var A="";if(!u||l<1||l>S)return A;do l%2&&(A+=u),l=ih(l/2),l&&(u+=u);while(l);return A}i(gh,"baseRepeat"),a(gh,"baseRepeat");function Ft(u,l){return av(iv(u,l,kn),u+"")}i(Ft,"baseRest"),a(Ft,"baseRest");function s5(u){return h1(Fo(u))}i(s5,"baseSample"),a(s5,"baseSample");function a5(u,l){var A=Fo(u);return tf(A,Ra(l,0,A.length))}i(a5,"baseSampleSize"),a(a5,"baseSampleSize");function Zc(u,l,A,L){if(!Cr(u))return u;l=ra(l,u);for(var Z=-1,re=l.length,de=re-1,ye=u;ye!=null&&++Z<re;){var Ae=Zi(l[Z]),Be=A;if(Ae==="__proto__"||Ae==="constructor"||Ae==="prototype")return u;if(Z!=de){var Le=ye[Ae];Be=L?L(Le,Ae,ye):r,Be===r&&(Be=Cr(Le)?Le:Ss(l[Z+1])?[]:{})}Kc(ye,Ae,Be),ye=ye[Ae]}return u}i(Zc,"baseSet"),a(Zc,"baseSet");var o5=sh?function(u,l){return sh.set(u,l),u}:kn,Qk=rh?function(u,l){return rh(u,"toString",{configurable:!0,enumerable:!1,value:Uh(l),writable:!0})}:kn;function c5(u){return tf(Fo(u))}i(c5,"baseShuffle"),a(c5,"baseShuffle");function ri(u,l,A){var L=-1,Z=u.length;l<0&&(l=-l>Z?0:Z+l),A=A>Z?Z:A,A<0&&(A+=Z),Z=l>A?0:A-l>>>0,l>>>=0;for(var re=Ie(Z);++L<Z;)re[L]=u[L+l];return re}i(ri,"baseSlice"),a(ri,"baseSlice");function u5(u,l){var A;return Na(u,function(L,Z,re){return A=l(L,Z,re),!A}),!!A}i(u5,"baseSome"),a(u5,"baseSome");function Kl(u,l,A){var L=0,Z=u==null?L:u.length;if(typeof l=="number"&&l===l&&Z<=$){for(;L<Z;){var re=L+Z>>>1,de=u[re];de!==null&&!$n(de)&&(A?de<=l:de<l)?L=re+1:Z=re}return Z}return bh(u,l,kn,A)}i(Kl,"baseSortedIndex"),a(Kl,"baseSortedIndex");function bh(u,l,A,L){var Z=0,re=u==null?0:u.length;if(re===0)return 0;l=A(l);for(var de=l!==l,ye=l===null,Ae=$n(l),Be=l===r;Z<re;){var Le=ih((Z+re)/2),$e=A(u[Le]),Je=$e!==r,pt=$e===null,St=$e===$e,Lt=$n($e);if(de)var _t=L||St;else Be?_t=St&&(L||Je):ye?_t=St&&Je&&(L||!pt):Ae?_t=St&&Je&&!pt&&(L||!Lt):pt||Lt?_t=!1:_t=L?$e<=l:$e<l;_t?Z=Le+1:re=Le}return mn(re,B)}i(bh,"baseSortedIndexBy"),a(bh,"baseSortedIndexBy");function k1(u,l){for(var A=-1,L=u.length,Z=0,re=[];++A<L;){var de=u[A],ye=l?l(de):de;if(!A||!Oi(ye,Ae)){var Ae=ye;re[Z++]=de===0?0:de}}return re}i(k1,"baseSortedUniq"),a(k1,"baseSortedUniq");function D1(u){return typeof u=="number"?u:$n(u)?C:+u}i(D1,"baseToNumber"),a(D1,"baseToNumber");function Un(u){if(typeof u=="string")return u;if(Rt(u))return Tr(u,Un)+"";if($n(u))return c3?c3.call(u):"";var l=u+"";return l=="0"&&1/u==-g?"-0":l}i(Un,"baseToString"),a(Un,"baseToString");function ta(u,l,A){var L=-1,Z=Ol,re=u.length,de=!0,ye=[],Ae=ye;if(A)de=!1,Z=Ud;else if(re>=s){var Be=l?null:tD(u);if(Be)return Nl(Be);de=!1,Z=$c,Ae=new Oa}else Ae=l?[]:ye;e:for(;++L<re;){var Le=u[L],$e=l?l(Le):Le;if(Le=A||Le!==0?Le:0,de&&$e===$e){for(var Je=Ae.length;Je--;)if(Ae[Je]===$e)continue e;l&&Ae.push($e),ye.push(Le)}else Z(Ae,$e,A)||(Ae!==ye&&Ae.push($e),ye.push(Le))}return ye}i(ta,"baseUniq"),a(ta,"baseUniq");function yh(u,l){return l=ra(l,u),u=sv(u,l),u==null||delete u[Zi(ni(l))]}i(yh,"baseUnset"),a(yh,"baseUnset");function O1(u,l,A,L){return Zc(u,l,A(Pa(u,l)),L)}i(O1,"baseUpdate"),a(O1,"baseUpdate");function Vl(u,l,A,L){for(var Z=u.length,re=L?Z:-1;(L?re--:++re<Z)&&l(u[re],re,u););return A?ri(u,L?0:re,L?re+1:Z):ri(u,L?re+1:0,L?Z:re)}i(Vl,"baseWhile"),a(Vl,"baseWhile");function R1(u,l){var A=u;return A instanceof Vt&&(A=A.value()),$d(l,function(L,Z){return Z.func.apply(Z.thisArg,Qs([L],Z.args))},A)}i(R1,"baseWrapperValue"),a(R1,"baseWrapperValue");function wh(u,l,A){var L=u.length;if(L<2)return L?ta(u[0]):[];for(var Z=-1,re=Ie(L);++Z<L;)for(var de=u[Z],ye=-1;++ye<L;)ye!=Z&&(re[Z]=Vc(re[Z]||de,u[ye],l,A));return ta(Jr(re,1),l,A)}i(wh,"baseXor"),a(wh,"baseXor");function N1(u,l,A){for(var L=-1,Z=u.length,re=l.length,de={};++L<Z;){var ye=L<re?l[L]:r;A(de,u[L],ye)}return de}i(N1,"baseZipObject"),a(N1,"baseZipObject");function _h(u){return Rr(u)?u:[]}i(_h,"castArrayLikeObject"),a(_h,"castArrayLikeObject");function Eh(u){return typeof u=="function"?u:kn}i(Eh,"castFunction"),a(Eh,"castFunction");function ra(u,l){return Rt(u)?u:Ih(u,l)?[u]:U5(dr(u))}i(ra,"castPath"),a(ra,"castPath");var eD=Ft;function na(u,l,A){var L=u.length;return A=A===r?L:A,!l&&A>=L?u:ri(u,l,A)}i(na,"castSlice"),a(na,"castSlice");var l5=Uk||function(u){return Lr.clearTimeout(u)};function P1(u,l){if(l)return u.slice();var A=u.length,L=r3?r3(A):new u.constructor(A);return u.copy(L),L}i(P1,"cloneBuffer"),a(P1,"cloneBuffer");function Ah(u){var l=new u.constructor(u.byteLength);return new Qd(l).set(new Qd(u)),l}i(Ah,"cloneArrayBuffer"),a(Ah,"cloneArrayBuffer");function f5(u,l){var A=l?Ah(u.buffer):u.buffer;return new u.constructor(A,u.byteOffset,u.byteLength)}i(f5,"cloneDataView"),a(f5,"cloneDataView");function d5(u){var l=new u.constructor(u.source,bt.exec(u));return l.lastIndex=u.lastIndex,l}i(d5,"cloneRegExp"),a(d5,"cloneRegExp");function h5(u){return Ul?wr(Ul.call(u)):{}}i(h5,"cloneSymbol"),a(h5,"cloneSymbol");function B1(u,l){var A=l?Ah(u.buffer):u.buffer;return new u.constructor(A,u.byteOffset,u.length)}i(B1,"cloneTypedArray"),a(B1,"cloneTypedArray");function L1(u,l){if(u!==l){var A=u!==r,L=u===null,Z=u===u,re=$n(u),de=l!==r,ye=l===null,Ae=l===l,Be=$n(l);if(!ye&&!Be&&!re&&u>l||re&&de&&Ae&&!ye&&!Be||L&&de&&Ae||!A&&Ae||!Z)return 1;if(!L&&!re&&!Be&&u<l||Be&&A&&Z&&!L&&!re||ye&&A&&Z||!de&&Z||!Ae)return-1}return 0}i(L1,"compareAscending"),a(L1,"compareAscending");function p5(u,l,A){for(var L=-1,Z=u.criteria,re=l.criteria,de=Z.length,ye=A.length;++L<de;){var Ae=L1(Z[L],re[L]);if(Ae){if(L>=ye)return Ae;var Be=A[L];return Ae*(Be=="desc"?-1:1)}}return u.index-l.index}i(p5,"compareMultiple"),a(p5,"compareMultiple");function F1(u,l,A,L){for(var Z=-1,re=u.length,de=A.length,ye=-1,Ae=l.length,Be=Gr(re-de,0),Le=Ie(Ae+Be),$e=!L;++ye<Ae;)Le[ye]=l[ye];for(;++Z<de;)($e||Z<re)&&(Le[A[Z]]=u[Z]);for(;Be--;)Le[ye++]=u[Z++];return Le}i(F1,"composeArgs"),a(F1,"composeArgs");function U1(u,l,A,L){for(var Z=-1,re=u.length,de=-1,ye=A.length,Ae=-1,Be=l.length,Le=Gr(re-ye,0),$e=Ie(Le+Be),Je=!L;++Z<Le;)$e[Z]=u[Z];for(var pt=Z;++Ae<Be;)$e[pt+Ae]=l[Ae];for(;++de<ye;)(Je||Z<re)&&($e[pt+A[de]]=u[Z++]);return $e}i(U1,"composeArgsRight"),a(U1,"composeArgsRight");function Mn(u,l){var A=-1,L=u.length;for(l||(l=Ie(L));++A<L;)l[A]=u[A];return l}i(Mn,"copyArray"),a(Mn,"copyArray");function Wi(u,l,A,L){var Z=!A;A||(A={});for(var re=-1,de=l.length;++re<de;){var ye=l[re],Ae=L?L(A[ye],u[ye],ye,A,u):r;Ae===r&&(Ae=u[ye]),Z?_s(A,ye,Ae):Kc(A,ye,Ae)}return A}i(Wi,"copyObject"),a(Wi,"copyObject");function m5(u,l){return Wi(u,Q1(u),l)}i(m5,"copySymbols"),a(m5,"copySymbols");function v5(u,l){return Wi(u,S5(u),l)}i(v5,"copySymbolsIn"),a(v5,"copySymbolsIn");function Gl(u,l){return function(A,L){var Z=Rt(A)?B6:B3,re=l?l():{};return Z(A,u,wt(L,2),re)}}i(Gl,"createAggregator"),a(Gl,"createAggregator");function No(u){return Ft(function(l,A){var L=-1,Z=A.length,re=Z>1?A[Z-1]:r,de=Z>2?A[2]:r;for(re=u.length>3&&typeof re=="function"?(Z--,re):r,de&&bn(A[0],A[1],de)&&(re=Z<3?r:re,Z=1),l=wr(l);++L<Z;){var ye=A[L];ye&&u(l,ye,L,re)}return l})}i(No,"createAssigner"),a(No,"createAssigner");function $1(u,l){return function(A,L){if(A==null)return A;if(!Cn(A))return u(A,L);for(var Z=A.length,re=l?Z:-1,de=wr(A);(l?re--:++re<Z)&&L(de[re],re,de)!==!1;);return A}}i($1,"createBaseEach"),a($1,"createBaseEach");function j1(u){return function(l,A,L){for(var Z=-1,re=wr(l),de=L(l),ye=de.length;ye--;){var Ae=de[u?ye:++Z];if(A(re[Ae],Ae,re)===!1)break}return l}}i(j1,"createBaseFor"),a(j1,"createBaseFor");function g5(u,l,A){var L=l&R,Z=Jc(u);function re(){var de=this&&this!==Lr&&this instanceof re?Z:u;return de.apply(L?A:this,arguments)}return i(re,"wrapper"),a(re,"wrapper"),re}i(g5,"createBind"),a(g5,"createBind");function z1(u){return function(l){l=dr(l);var A=Do(l)?Ii(l):r,L=A?A[0]:l.charAt(0),Z=A?na(A,1).join(""):l.slice(1);return L[u]()+Z}}i(z1,"createCaseFirst"),a(z1,"createCaseFirst");function Po(u){return function(l){return $d(Bv(Nv(l).replace(Cl,"")),u,"")}}i(Po,"createCompounder"),a(Po,"createCompounder");function Jc(u){return function(){var l=arguments;switch(l.length){case 0:return new u;case 1:return new u(l[0]);case 2:return new u(l[0],l[1]);case 3:return new u(l[0],l[1],l[2]);case 4:return new u(l[0],l[1],l[2],l[3]);case 5:return new u(l[0],l[1],l[2],l[3],l[4]);case 6:return new u(l[0],l[1],l[2],l[3],l[4],l[5]);case 7:return new u(l[0],l[1],l[2],l[3],l[4],l[5],l[6])}var A=qc(u.prototype),L=u.apply(A,l);return Cr(L)?L:A}}i(Jc,"createCtor"),a(Jc,"createCtor");function b5(u,l,A){var L=Jc(u);function Z(){for(var re=arguments.length,de=Ie(re),ye=re,Ae=Bo(Z);ye--;)de[ye]=arguments[ye];var Be=re<3&&de[0]!==Ae&&de[re-1]!==Ae?[]:ea(de,Ae);if(re-=Be.length,re<A)return G1(u,l,Wl,Z.placeholder,r,de,Be,r,r,A-re);var Le=this&&this!==Lr&&this instanceof Z?L:u;return Ln(Le,this,de)}return i(Z,"wrapper"),a(Z,"wrapper"),Z}i(b5,"createCurry"),a(b5,"createCurry");function H1(u){return function(l,A,L){var Z=wr(l);if(!Cn(l)){var re=wt(A,3);l=Wr(l),A=a(function(ye){return re(Z[ye],ye,Z)},"predicate")}var de=u(l,A,L);return de>-1?Z[re?l[de]:de]:r}}i(H1,"createFind"),a(H1,"createFind");function q1(u){return As(function(l){var A=l.length,L=A,Z=ei.prototype.thru;for(u&&l.reverse();L--;){var re=l[L];if(typeof re!="function")throw new ki(c);if(Z&&!de&&Xl(re)=="wrapper")var de=new ei([],!0)}for(L=de?L:A;++L<A;){re=l[L];var ye=Xl(re),Ae=ye=="wrapper"?X1(re):r;Ae&&kh(Ae[0])&&Ae[1]==(I|U|V|H)&&!Ae[4].length&&Ae[9]==1?de=de[Xl(Ae[0])].apply(de,Ae[3]):de=re.length==1&&kh(re)?de[ye]():de.thru(re)}return function(){var Be=arguments,Le=Be[0];if(de&&Be.length==1&&Rt(Le))return de.plant(Le).value();for(var $e=0,Je=A?l[$e].apply(this,Be):Le;++$e<A;)Je=l[$e].call(this,Je);return Je}})}i(q1,"createFlow"),a(q1,"createFlow");function Wl(u,l,A,L,Z,re,de,ye,Ae,Be){var Le=l&I,$e=l&R,Je=l&P,pt=l&(U|j),St=l&ae,Lt=Je?r:Jc(u);function _t(){for(var Ht=arguments.length,Gt=Ie(Ht),jn=Ht;jn--;)Gt[jn]=arguments[jn];if(pt)var yn=Bo(_t),zn=q6(Gt,yn);if(L&&(Gt=F1(Gt,L,Z,pt)),re&&(Gt=U1(Gt,re,de,pt)),Ht-=zn,pt&&Ht<Be){var Fr=ea(Gt,yn);return G1(u,l,Wl,_t.placeholder,A,Gt,Fr,ye,Ae,Be-Ht)}var Ji=$e?A:this,ia=Je?Ji[u]:u;return Ht=Gt.length,ye?Gt=L5(Gt,ye):St&&Ht>1&&Gt.reverse(),Le&&Ae<Ht&&(Gt.length=Ae),this&&this!==Lr&&this instanceof _t&&(ia=Lt||Jc(ia)),ia.apply(Ji,Gt)}return i(_t,"wrapper"),a(_t,"wrapper"),_t}i(Wl,"createHybrid"),a(Wl,"createHybrid");function K1(u,l){return function(A,L){return V3(A,u,l(L),{})}}i(K1,"createInverter"),a(K1,"createInverter");function Zl(u,l){return function(A,L){var Z;if(A===r&&L===r)return l;if(A!==r&&(Z=A),L!==r){if(Z===r)return L;typeof A=="string"||typeof L=="string"?(A=Un(A),L=Un(L)):(A=D1(A),L=D1(L)),Z=u(A,L)}return Z}}i(Zl,"createMathOperation"),a(Zl,"createMathOperation");function Sh(u){return As(function(l){return l=Tr(l,Fn(wt())),Ft(function(A){var L=this;return u(l,function(Z){return Ln(Z,L,A)})})})}i(Sh,"createOver"),a(Sh,"createOver");function Jl(u,l){l=l===r?" ":Un(l);var A=l.length;if(A<2)return A?gh(l,u):l;var L=gh(l,nh(u/Oo(l)));return Do(l)?na(Ii(L),0,u).join(""):L.slice(0,u)}i(Jl,"createPadding"),a(Jl,"createPadding");function y5(u,l,A,L){var Z=l&R,re=Jc(u);function de(){for(var ye=-1,Ae=arguments.length,Be=-1,Le=L.length,$e=Ie(Le+Ae),Je=this&&this!==Lr&&this instanceof de?re:u;++Be<Le;)$e[Be]=L[Be];for(;Ae--;)$e[Be++]=arguments[++ye];return Ln(Je,Z?A:this,$e)}return i(de,"wrapper"),a(de,"wrapper"),de}i(y5,"createPartial"),a(y5,"createPartial");function V1(u){return function(l,A,L){return L&&typeof L!="number"&&bn(l,A,L)&&(A=L=r),l=Ts(l),A===r?(A=l,l=0):A=Ts(A),L=L===r?l<A?1:-1:Ts(L),i5(l,A,L,u)}}i(V1,"createRange"),a(V1,"createRange");function Yl(u){return function(l,A){return typeof l=="string"&&typeof A=="string"||(l=ii(l),A=ii(A)),u(l,A)}}i(Yl,"createRelationalOperation"),a(Yl,"createRelationalOperation");function G1(u,l,A,L,Z,re,de,ye,Ae,Be){var Le=l&U,$e=Le?de:r,Je=Le?r:de,pt=Le?re:r,St=Le?r:re;l|=Le?V:G,l&=~(Le?G:V),l&K||(l&=~(R|P));var Lt=[u,l,Z,pt,$e,St,Je,ye,Ae,Be],_t=A.apply(r,Lt);return kh(u)&&F5(_t,Lt),_t.placeholder=L,ov(_t,u,l)}i(G1,"createRecurry"),a(G1,"createRecurry");function xh(u){var l=Vr[u];return function(A,L){if(A=ii(A),L=L==null?0:mn(Nt(L),292),L&&a3(A)){var Z=(dr(A)+"e").split("e"),re=l(Z[0]+"e"+(+Z[1]+L));return Z=(dr(re)+"e").split("e"),+(Z[0]+"e"+(+Z[1]-L))}return l(A)}}i(xh,"createRound"),a(xh,"createRound");var tD=zc&&1/Nl(new zc([,-0]))[1]==g?function(u){return new zc(u)}:zh;function W1(u){return function(l){var A=gn(l);return A==ge?Gd(l):A==te?Z6(l):H6(l,u(l))}}i(W1,"createToPairs"),a(W1,"createToPairs");function Es(u,l,A,L,Z,re,de,ye){var Ae=l&P;if(!Ae&&typeof u!="function")throw new ki(c);var Be=L?L.length:0;if(Be||(l&=~(V|G),L=Z=r),de=de===r?de:Gr(Nt(de),0),ye=ye===r?ye:Nt(ye),Be-=Z?Z.length:0,l&G){var Le=L,$e=Z;L=Z=r}var Je=Ae?r:X1(u),pt=[u,l,A,L,Z,Le,$e,re,de,ye];if(Je&&N5(pt,Je),u=pt[0],l=pt[1],A=pt[2],L=pt[3],Z=pt[4],ye=pt[9]=pt[9]===r?Ae?0:u.length:Gr(pt[9]-Be,0),!ye&&l&(U|j)&&(l&=~(U|j)),!l||l==R)var St=g5(u,l,A);else l==U||l==j?St=b5(u,l,ye):(l==V||l==(R|V))&&!Z.length?St=y5(u,l,A,L):St=Wl.apply(r,pt);var Lt=Je?o5:F5;return ov(Lt(St,pt),u,l)}i(Es,"createWrap"),a(Es,"createWrap");function Z1(u,l,A,L){return u===r||Oi(u,jc[A])&&!vr.call(L,A)?l:u}i(Z1,"customDefaultsAssignIn"),a(Z1,"customDefaultsAssignIn");function J1(u,l,A,L,Z,re){return Cr(u)&&Cr(l)&&(re.set(l,u),ql(u,l,r,J1,re),re.delete(l)),u}i(J1,"customDefaultsMerge"),a(J1,"customDefaultsMerge");function w5(u){return Xc(u)?r:u}i(w5,"customOmitClone"),a(w5,"customOmitClone");function Y1(u,l,A,L,Z,re){var de=A&T,ye=u.length,Ae=l.length;if(ye!=Ae&&!(de&&Ae>ye))return!1;var Be=re.get(u),Le=re.get(l);if(Be&&Le)return Be==l&&Le==u;var $e=-1,Je=!0,pt=A&O?new Oa:r;for(re.set(u,l),re.set(l,u);++$e<ye;){var St=u[$e],Lt=l[$e];if(L)var _t=de?L(Lt,St,$e,l,u,re):L(St,Lt,$e,u,l,re);if(_t!==r){if(_t)continue;Je=!1;break}if(pt){if(!jd(l,function(Ht,Gt){if(!$c(pt,Gt)&&(St===Ht||Z(St,Ht,A,L,re)))return pt.push(Gt)})){Je=!1;break}}else if(!(St===Lt||Z(St,Lt,A,L,re))){Je=!1;break}}return re.delete(u),re.delete(l),Je}i(Y1,"equalArrays"),a(Y1,"equalArrays");function _5(u,l,A,L,Z,re,de){switch(A){case le:if(u.byteLength!=l.byteLength||u.byteOffset!=l.byteOffset)return!1;u=u.buffer,l=l.buffer;case rt:return!(u.byteLength!=l.byteLength||!re(new Qd(u),new Qd(l)));case Q:case X:case ke:return Oi(+u,+l);case z:return u.name==l.name&&u.message==l.message;case we:case ve:return u==l+"";case ge:var ye=Gd;case te:var Ae=L&T;if(ye||(ye=Nl),u.size!=l.size&&!Ae)return!1;var Be=de.get(u);if(Be)return Be==l;L|=O,de.set(u,l);var Le=Y1(ye(u),ye(l),L,Z,re,de);return de.delete(u),Le;case Me:if(Ul)return Ul.call(u)==Ul.call(l)}return!1}i(_5,"equalByTag"),a(_5,"equalByTag");function E5(u,l,A,L,Z,re){var de=A&T,ye=Th(u),Ae=ye.length,Be=Th(l),Le=Be.length;if(Ae!=Le&&!de)return!1;for(var $e=Ae;$e--;){var Je=ye[$e];if(!(de?Je in l:vr.call(l,Je)))return!1}var pt=re.get(u),St=re.get(l);if(pt&&St)return pt==l&&St==u;var Lt=!0;re.set(u,l),re.set(l,u);for(var _t=de;++$e<Ae;){Je=ye[$e];var Ht=u[Je],Gt=l[Je];if(L)var jn=de?L(Gt,Ht,Je,l,u,re):L(Ht,Gt,Je,u,l,re);if(!(jn===r?Ht===Gt||Z(Ht,Gt,A,L,re):jn)){Lt=!1;break}_t||(_t=Je=="constructor")}if(Lt&&!_t){var yn=u.constructor,zn=l.constructor;yn!=zn&&"constructor"in u&&"constructor"in l&&!(typeof yn=="function"&&yn instanceof yn&&typeof zn=="function"&&zn instanceof zn)&&(Lt=!1)}return re.delete(u),re.delete(l),Lt}i(E5,"equalObjects"),a(E5,"equalObjects");function As(u){return av(iv(u,r,dv),u+"")}i(As,"flatRest"),a(As,"flatRest");function Th(u){return y1(u,Wr,Q1)}i(Th,"getAllKeys"),a(Th,"getAllKeys");function Mh(u){return y1(u,In,S5)}i(Mh,"getAllKeysIn"),a(Mh,"getAllKeysIn");var X1=sh?function(u){return sh.get(u)}:zh;function Xl(u){for(var l=u.name+"",A=Hc[l],L=vr.call(Hc,l)?A.length:0;L--;){var Z=A[L],re=Z.func;if(re==null||re==u)return Z.name}return l}i(Xl,"getFuncName"),a(Xl,"getFuncName");function Bo(u){var l=vr.call(ee,"placeholder")?ee:u;return l.placeholder}i(Bo,"getHolder"),a(Bo,"getHolder");function wt(){var u=ee.iteratee||$h;return u=u===$h?E1:u,arguments.length?u(arguments[0],arguments[1]):u}i(wt,"getIteratee"),a(wt,"getIteratee");function Ql(u,l){var A=u.__data__;return D5(l)?A[typeof l=="string"?"string":"hash"]:A.map}i(Ql,"getMapData"),a(Ql,"getMapData");function Ch(u){for(var l=Wr(u),A=l.length;A--;){var L=l[A],Z=u[L];l[A]=[L,Z,rv(Z)]}return l}i(Ch,"getMatchData"),a(Ch,"getMatchData");function Ba(u,l){var A=V6(u,l);return _1(A)?A:r}i(Ba,"getNative"),a(Ba,"getNative");function A5(u){var l=vr.call(u,Ro),A=u[Ro];try{u[Ro]=r;var L=!0}catch{}var Z=Yd.call(u);return L&&(l?u[Ro]=A:delete u[Ro]),Z}i(A5,"getRawTag"),a(A5,"getRawTag");var Q1=u1?function(u){return u==null?[]:(u=wr(u),Xs(u1(u),function(l){return i3.call(u,l)}))}:Hh,S5=u1?function(u){for(var l=[];u;)Qs(l,Q1(u)),u=eh(u);return l}:Hh,gn=vn;(l1&&gn(new l1(new ArrayBuffer(1)))!=le||Bl&&gn(new Bl)!=ge||f1&&gn(f1.resolve())!=Ce||zc&&gn(new zc)!=te||Ll&&gn(new Ll)!=Re)&&(gn=a(function(u){var l=vn(u),A=l==fe?u.constructor:r,L=A?La(A):"";if(L)switch(L){case Wk:return le;case Zk:return ge;case Jk:return Ce;case Yk:return te;case Xk:return Re}return l},"getTag"));function x5(u,l,A){for(var L=-1,Z=A.length;++L<Z;){var re=A[L],de=re.size;switch(re.type){case"drop":u+=de;break;case"dropRight":l-=de;break;case"take":l=mn(l,u+de);break;case"takeRight":u=Gr(u,l-de);break}}return{start:u,end:l}}i(x5,"getView"),a(x5,"getView");function T5(u){var l=u.match(Ze);return l?l[1].split(cr):[]}i(T5,"getWrapDetails"),a(T5,"getWrapDetails");function ev(u,l,A){l=ra(l,u);for(var L=-1,Z=l.length,re=!1;++L<Z;){var de=Zi(l[L]);if(!(re=u!=null&&A(u,de)))break;u=u[de]}return re||++L!=Z?re:(Z=u==null?0:u.length,!!Z&&of(Z)&&Ss(de,Z)&&(Rt(u)||Lo(u)))}i(ev,"hasPath"),a(ev,"hasPath");function M5(u){var l=u.length,A=new u.constructor(l);return l&&typeof u[0]=="string"&&vr.call(u,"index")&&(A.index=u.index,A.input=u.input),A}i(M5,"initCloneArray"),a(M5,"initCloneArray");function tv(u){return typeof u.constructor=="function"&&!Yc(u)?qc(eh(u)):{}}i(tv,"initCloneObject"),a(tv,"initCloneObject");function C5(u,l,A){var L=u.constructor;switch(l){case rt:return Ah(u);case Q:case X:return new L(+u);case le:return f5(u,A);case ce:case Y:case ie:case be:case Se:case xe:case De:case Mt:case qe:return B1(u,A);case ge:return new L;case ke:case ve:return new L(u);case we:return d5(u);case te:return new L;case Me:return h5(u)}}i(C5,"initCloneByTag"),a(C5,"initCloneByTag");function I5(u,l){var A=l.length;if(!A)return u;var L=A-1;return l[L]=(A>1?"& ":"")+l[L],l=l.join(A>2?", ":" "),u.replace(at,`{
25
25
  /* [wrapped with `+l+`] */
26
26
  `)}i(I5,"insertWrapDetails"),a(I5,"insertWrapDetails");function k5(u){return Rt(u)||Lo(u)||!!(s3&&u&&u[s3])}i(k5,"isFlattenable"),a(k5,"isFlattenable");function Ss(u,l){var A=typeof u;return l=l??S,!!l&&(A=="number"||A!="symbol"&&rn.test(u))&&u>-1&&u%1==0&&u<l}i(Ss,"isIndex"),a(Ss,"isIndex");function bn(u,l,A){if(!Cr(A))return!1;var L=typeof l;return(L=="number"?Cn(A)&&Ss(l,A.length):L=="string"&&l in A)?Oi(A[l],u):!1}i(bn,"isIterateeCall"),a(bn,"isIterateeCall");function Ih(u,l){if(Rt(u))return!1;var A=typeof u;return A=="number"||A=="symbol"||A=="boolean"||u==null||$n(u)?!0:it.test(u)||!ar.test(u)||l!=null&&u in wr(l)}i(Ih,"isKey"),a(Ih,"isKey");function D5(u){var l=typeof u;return l=="string"||l=="number"||l=="symbol"||l=="boolean"?u!=="__proto__":u===null}i(D5,"isKeyable"),a(D5,"isKeyable");function kh(u){var l=Xl(u),A=ee[l];if(typeof A!="function"||!(l in Vt.prototype))return!1;if(u===A)return!0;var L=X1(A);return!!L&&u===L[0]}i(kh,"isLaziable"),a(kh,"isLaziable");function O5(u){return!!t3&&t3 in u}i(O5,"isMasked"),a(O5,"isMasked");var rD=Zd?xs:qh;function Yc(u){var l=u&&u.constructor,A=typeof l=="function"&&l.prototype||jc;return u===A}i(Yc,"isPrototype"),a(Yc,"isPrototype");function rv(u){return u===u&&!Cr(u)}i(rv,"isStrictComparable"),a(rv,"isStrictComparable");function nv(u,l){return function(A){return A==null?!1:A[u]===l&&(l!==r||u in wr(A))}}i(nv,"matchesStrictComparable"),a(nv,"matchesStrictComparable");function R5(u){var l=sf(u,function(L){return A.size===p&&A.clear(),L}),A=l.cache;return l}i(R5,"memoizeCapped"),a(R5,"memoizeCapped");function N5(u,l){var A=u[1],L=l[1],Z=A|L,re=Z<(R|P|I),de=L==I&&A==U||L==I&&A==H&&u[7].length<=l[8]||L==(I|H)&&l[7].length<=l[8]&&A==U;if(!(re||de))return u;L&R&&(u[2]=l[2],Z|=A&R?0:K);var ye=l[3];if(ye){var Ae=u[3];u[3]=Ae?F1(Ae,ye,l[4]):ye,u[4]=Ae?ea(u[3],v):l[4]}return ye=l[5],ye&&(Ae=u[5],u[5]=Ae?U1(Ae,ye,l[6]):ye,u[6]=Ae?ea(u[5],v):l[6]),ye=l[7],ye&&(u[7]=ye),L&I&&(u[8]=u[8]==null?l[8]:mn(u[8],l[8])),u[9]==null&&(u[9]=l[9]),u[0]=l[0],u[1]=Z,u}i(N5,"mergeData"),a(N5,"mergeData");function P5(u){var l=[];if(u!=null)for(var A in wr(u))l.push(A);return l}i(P5,"nativeKeysIn"),a(P5,"nativeKeysIn");function B5(u){return Yd.call(u)}i(B5,"objectToString"),a(B5,"objectToString");function iv(u,l,A){return l=Gr(l===r?u.length-1:l,0),function(){for(var L=arguments,Z=-1,re=Gr(L.length-l,0),de=Ie(re);++Z<re;)de[Z]=L[l+Z];Z=-1;for(var ye=Ie(l+1);++Z<l;)ye[Z]=L[Z];return ye[l]=A(de),Ln(u,this,ye)}}i(iv,"overRest"),a(iv,"overRest");function sv(u,l){return l.length<2?u:Pa(u,ri(l,0,-1))}i(sv,"parent"),a(sv,"parent");function L5(u,l){for(var A=u.length,L=mn(l.length,A),Z=Mn(u);L--;){var re=l[L];u[L]=Ss(re,A)?Z[re]:r}return u}i(L5,"reorder"),a(L5,"reorder");function Dh(u,l){if(!(l==="constructor"&&typeof u[l]=="function")&&l!="__proto__")return u[l]}i(Dh,"safeGet"),a(Dh,"safeGet");var F5=cv(o5),ef=jk||function(u,l){return Lr.setTimeout(u,l)},av=cv(Qk);function ov(u,l,A){var L=l+"";return av(u,I5(L,$5(T5(L),A)))}i(ov,"setWrapToString"),a(ov,"setWrapToString");function cv(u){var l=0,A=0;return function(){var L=Kk(),Z=w-(L-A);if(A=L,Z>0){if(++l>=q)return arguments[0]}else l=0;return u.apply(r,arguments)}}i(cv,"shortOut"),a(cv,"shortOut");function tf(u,l){var A=-1,L=u.length,Z=L-1;for(l=l===r?L:l;++A<l;){var re=vh(A,Z),de=u[re];u[re]=u[A],u[A]=de}return u.length=l,u}i(tf,"shuffleSelf"),a(tf,"shuffleSelf");var U5=R5(function(u){var l=[];return u.charCodeAt(0)===46&&l.push(""),u.replace(Ye,function(A,L,Z,re){l.push(Z?re.replace(Sn,"$1"):L||A)}),l});function Zi(u){if(typeof u=="string"||$n(u))return u;var l=u+"";return l=="0"&&1/u==-g?"-0":l}i(Zi,"toKey"),a(Zi,"toKey");function La(u){if(u!=null){try{return Jd.call(u)}catch{}try{return u+""}catch{}}return""}i(La,"toSource"),a(La,"toSource");function $5(u,l){return Qn(k,function(A){var L="_."+A[0];l&A[1]&&!Ol(u,L)&&u.push(L)}),u.sort()}i($5,"updateWrapDetails"),a($5,"updateWrapDetails");function uv(u){if(u instanceof Vt)return u.clone();var l=new ei(u.__wrapped__,u.__chain__);return l.__actions__=Mn(u.__actions__),l.__index__=u.__index__,l.__values__=u.__values__,l}i(uv,"wrapperClone"),a(uv,"wrapperClone");function j5(u,l,A){(A?bn(u,l,A):l===r)?l=1:l=Gr(Nt(l),0);var L=u==null?0:u.length;if(!L||l<1)return[];for(var Z=0,re=0,de=Ie(nh(L/l));Z<L;)de[re++]=ri(u,Z,Z+=l);return de}i(j5,"chunk"),a(j5,"chunk");function z5(u){for(var l=-1,A=u==null?0:u.length,L=0,Z=[];++l<A;){var re=u[l];re&&(Z[L++]=re)}return Z}i(z5,"compact"),a(z5,"compact");function H5(){var u=arguments.length;if(!u)return[];for(var l=Ie(u-1),A=arguments[0],L=u;L--;)l[L-1]=arguments[L];return Qs(Rt(A)?Mn(A):[A],Jr(l,1))}i(H5,"concat4"),a(H5,"concat");var nD=Ft(function(u,l){return Rr(u)?Vc(u,Jr(l,1,Rr,!0)):[]}),iD=Ft(function(u,l){var A=ni(l);return Rr(A)&&(A=r),Rr(u)?Vc(u,Jr(l,1,Rr,!0),wt(A,2)):[]}),sD=Ft(function(u,l){var A=ni(l);return Rr(A)&&(A=r),Rr(u)?Vc(u,Jr(l,1,Rr,!0),r,A):[]});function q5(u,l,A){var L=u==null?0:u.length;return L?(l=A||l===r?1:Nt(l),ri(u,l<0?0:l,L)):[]}i(q5,"drop"),a(q5,"drop");function K5(u,l,A){var L=u==null?0:u.length;return L?(l=A||l===r?1:Nt(l),l=L-l,ri(u,0,l<0?0:l)):[]}i(K5,"dropRight"),a(K5,"dropRight");function V5(u,l){return u&&u.length?Vl(u,wt(l,3),!0,!0):[]}i(V5,"dropRightWhile"),a(V5,"dropRightWhile");function G5(u,l){return u&&u.length?Vl(u,wt(l,3),!0):[]}i(G5,"dropWhile"),a(G5,"dropWhile");function W5(u,l,A,L){var Z=u==null?0:u.length;return Z?(A&&typeof A!="number"&&bn(u,l,A)&&(A=0,L=Z),j3(u,l,A,L)):[]}i(W5,"fill"),a(W5,"fill");function lv(u,l,A){var L=u==null?0:u.length;if(!L)return-1;var Z=A==null?0:Nt(A);return Z<0&&(Z=Gr(L+Z,0)),Rl(u,wt(l,3),Z)}i(lv,"findIndex"),a(lv,"findIndex");function fv(u,l,A){var L=u==null?0:u.length;if(!L)return-1;var Z=L-1;return A!==r&&(Z=Nt(A),Z=A<0?Gr(L+Z,0):mn(Z,L-1)),Rl(u,wt(l,3),Z,!0)}i(fv,"findLastIndex"),a(fv,"findLastIndex");function dv(u){var l=u==null?0:u.length;return l?Jr(u,1):[]}i(dv,"flatten"),a(dv,"flatten");function Z5(u){var l=u==null?0:u.length;return l?Jr(u,g):[]}i(Z5,"flattenDeep"),a(Z5,"flattenDeep");function J5(u,l){var A=u==null?0:u.length;return A?(l=l===r?1:Nt(l),Jr(u,l)):[]}i(J5,"flattenDepth"),a(J5,"flattenDepth");function Y5(u){for(var l=-1,A=u==null?0:u.length,L={};++l<A;){var Z=u[l];L[Z[0]]=Z[1]}return L}i(Y5,"fromPairs"),a(Y5,"fromPairs");function hv(u){return u&&u.length?u[0]:r}i(hv,"head"),a(hv,"head");function X5(u,l,A){var L=u==null?0:u.length;if(!L)return-1;var Z=A==null?0:Nt(A);return Z<0&&(Z=Gr(L+Z,0)),ko(u,l,Z)}i(X5,"indexOf"),a(X5,"indexOf");function Q5(u){var l=u==null?0:u.length;return l?ri(u,0,-1):[]}i(Q5,"initial"),a(Q5,"initial");var aD=Ft(function(u){var l=Tr(u,_h);return l.length&&l[0]===u[0]?fh(l):[]}),oD=Ft(function(u){var l=ni(u),A=Tr(u,_h);return l===ni(A)?l=r:A.pop(),A.length&&A[0]===u[0]?fh(A,wt(l,2)):[]}),cD=Ft(function(u){var l=ni(u),A=Tr(u,_h);return l=typeof l=="function"?l:r,l&&A.pop(),A.length&&A[0]===u[0]?fh(A,r,l):[]});function ew(u,l){return u==null?"":Hk.call(u,l)}i(ew,"join"),a(ew,"join");function ni(u){var l=u==null?0:u.length;return l?u[l-1]:r}i(ni,"last2"),a(ni,"last");function tw(u,l,A){var L=u==null?0:u.length;if(!L)return-1;var Z=L;return A!==r&&(Z=Nt(A),Z=Z<0?Gr(L+Z,0):mn(Z,L-1)),l===l?Y6(u,l,Z):Rl(u,e1,Z,!0)}i(tw,"lastIndexOf"),a(tw,"lastIndexOf");function rw(u,l){return u&&u.length?T1(u,Nt(l)):r}i(rw,"nth"),a(rw,"nth");var uD=Ft(pv);function pv(u,l){return u&&u.length&&l&&l.length?mh(u,l):u}i(pv,"pullAll"),a(pv,"pullAll");function nw(u,l,A){return u&&u.length&&l&&l.length?mh(u,l,wt(A,2)):u}i(nw,"pullAllBy"),a(nw,"pullAllBy");function iw(u,l,A){return u&&u.length&&l&&l.length?mh(u,l,r,A):u}i(iw,"pullAllWith"),a(iw,"pullAllWith");var lD=As(function(u,l){var A=u==null?0:u.length,L=ch(u,l);return I1(u,Tr(l,function(Z){return Ss(Z,A)?+Z:Z}).sort(L1)),L});function sw(u,l){var A=[];if(!(u&&u.length))return A;var L=-1,Z=[],re=u.length;for(l=wt(l,3);++L<re;){var de=u[L];l(de,L,u)&&(A.push(de),Z.push(L))}return I1(u,Z),A}i(sw,"remove"),a(sw,"remove");function Oh(u){return u==null?u:Gk.call(u)}i(Oh,"reverse"),a(Oh,"reverse");function aw(u,l,A){var L=u==null?0:u.length;return L?(A&&typeof A!="number"&&bn(u,l,A)?(l=0,A=L):(l=l==null?0:Nt(l),A=A===r?L:Nt(A)),ri(u,l,A)):[]}i(aw,"slice2"),a(aw,"slice");function ow(u,l){return Kl(u,l)}i(ow,"sortedIndex"),a(ow,"sortedIndex");function cw(u,l,A){return bh(u,l,wt(A,2))}i(cw,"sortedIndexBy"),a(cw,"sortedIndexBy");function uw(u,l){var A=u==null?0:u.length;if(A){var L=Kl(u,l);if(L<A&&Oi(u[L],l))return L}return-1}i(uw,"sortedIndexOf"),a(uw,"sortedIndexOf");function lw(u,l){return Kl(u,l,!0)}i(lw,"sortedLastIndex"),a(lw,"sortedLastIndex");function fw(u,l,A){return bh(u,l,wt(A,2),!0)}i(fw,"sortedLastIndexBy"),a(fw,"sortedLastIndexBy");function dw(u,l){var A=u==null?0:u.length;if(A){var L=Kl(u,l,!0)-1;if(Oi(u[L],l))return L}return-1}i(dw,"sortedLastIndexOf"),a(dw,"sortedLastIndexOf");function hw(u){return u&&u.length?k1(u):[]}i(hw,"sortedUniq"),a(hw,"sortedUniq");function pw(u,l){return u&&u.length?k1(u,wt(l,2)):[]}i(pw,"sortedUniqBy"),a(pw,"sortedUniqBy");function mw(u){var l=u==null?0:u.length;return l?ri(u,1,l):[]}i(mw,"tail"),a(mw,"tail");function vw(u,l,A){return u&&u.length?(l=A||l===r?1:Nt(l),ri(u,0,l<0?0:l)):[]}i(vw,"take2"),a(vw,"take");function gw(u,l,A){var L=u==null?0:u.length;return L?(l=A||l===r?1:Nt(l),l=L-l,ri(u,l<0?0:l,L)):[]}i(gw,"takeRight"),a(gw,"takeRight");function bw(u,l){return u&&u.length?Vl(u,wt(l,3),!1,!0):[]}i(bw,"takeRightWhile"),a(bw,"takeRightWhile");function yw(u,l){return u&&u.length?Vl(u,wt(l,3)):[]}i(yw,"takeWhile"),a(yw,"takeWhile");var fD=Ft(function(u){return ta(Jr(u,1,Rr,!0))}),dD=Ft(function(u){var l=ni(u);return Rr(l)&&(l=r),ta(Jr(u,1,Rr,!0),wt(l,2))}),hD=Ft(function(u){var l=ni(u);return l=typeof l=="function"?l:r,ta(Jr(u,1,Rr,!0),r,l)});function ww(u){return u&&u.length?ta(u):[]}i(ww,"uniq"),a(ww,"uniq");function _w(u,l){return u&&u.length?ta(u,wt(l,2)):[]}i(_w,"uniqBy"),a(_w,"uniqBy");function Ew(u,l){return l=typeof l=="function"?l:r,u&&u.length?ta(u,r,l):[]}i(Ew,"uniqWith"),a(Ew,"uniqWith");function Rh(u){if(!(u&&u.length))return[];var l=0;return u=Xs(u,function(A){if(Rr(A))return l=Gr(A.length,l),!0}),Kd(l,function(A){return Tr(u,zd(A))})}i(Rh,"unzip"),a(Rh,"unzip");function mv(u,l){if(!(u&&u.length))return[];var A=Rh(u);return l==null?A:Tr(A,function(L){return Ln(l,r,L)})}i(mv,"unzipWith"),a(mv,"unzipWith");var pD=Ft(function(u,l){return Rr(u)?Vc(u,l):[]}),mD=Ft(function(u){return wh(Xs(u,Rr))}),vD=Ft(function(u){var l=ni(u);return Rr(l)&&(l=r),wh(Xs(u,Rr),wt(l,2))}),gD=Ft(function(u){var l=ni(u);return l=typeof l=="function"?l:r,wh(Xs(u,Rr),r,l)}),bD=Ft(Rh);function Aw(u,l){return N1(u||[],l||[],Kc)}i(Aw,"zipObject"),a(Aw,"zipObject");function Sw(u,l){return N1(u||[],l||[],Zc)}i(Sw,"zipObjectDeep"),a(Sw,"zipObjectDeep");var yD=Ft(function(u){var l=u.length,A=l>1?u[l-1]:r;return A=typeof A=="function"?(u.pop(),A):r,mv(u,A)});function vv(u){var l=ee(u);return l.__chain__=!0,l}i(vv,"chain"),a(vv,"chain");function xw(u,l){return l(u),u}i(xw,"tap"),a(xw,"tap");function rf(u,l){return l(u)}i(rf,"thru"),a(rf,"thru");var wD=As(function(u){var l=u.length,A=l?u[0]:0,L=this.__wrapped__,Z=a(function(re){return ch(re,u)},"interceptor");return l>1||this.__actions__.length||!(L instanceof Vt)||!Ss(A)?this.thru(Z):(L=L.slice(A,+A+(l?1:0)),L.__actions__.push({func:rf,args:[Z],thisArg:r}),new ei(L,this.__chain__).thru(function(re){return l&&!re.length&&re.push(r),re}))});function Tw(){return vv(this)}i(Tw,"wrapperChain"),a(Tw,"wrapperChain");function Mw(){return new ei(this.value(),this.__chain__)}i(Mw,"wrapperCommit"),a(Mw,"wrapperCommit");function Cw(){this.__values__===r&&(this.__values__=Iv(this.value()));var u=this.__index__>=this.__values__.length,l=u?r:this.__values__[this.__index__++];return{done:u,value:l}}i(Cw,"wrapperNext"),a(Cw,"wrapperNext");function Iw(){return this}i(Iw,"wrapperToIterator"),a(Iw,"wrapperToIterator");function kw(u){for(var l,A=this;A instanceof $l;){var L=uv(A);L.__index__=0,L.__values__=r,l?Z.__wrapped__=L:l=L;var Z=L;A=A.__wrapped__}return Z.__wrapped__=u,l}i(kw,"wrapperPlant"),a(kw,"wrapperPlant");function Dw(){var u=this.__wrapped__;if(u instanceof Vt){var l=u;return this.__actions__.length&&(l=new Vt(this)),l=l.reverse(),l.__actions__.push({func:rf,args:[Oh],thisArg:r}),new ei(l,this.__chain__)}return this.thru(Oh)}i(Dw,"wrapperReverse"),a(Dw,"wrapperReverse");function Ow(){return R1(this.__wrapped__,this.__actions__)}i(Ow,"wrapperValue"),a(Ow,"wrapperValue");var _D=Gl(function(u,l,A){vr.call(u,A)?++u[A]:_s(u,A,1)});function Rw(u,l,A){var L=Rt(u)?Xm:$3;return A&&bn(u,l,A)&&(l=r),L(u,wt(l,3))}i(Rw,"every"),a(Rw,"every");function Nw(u,l){var A=Rt(u)?Xs:g1;return A(u,wt(l,3))}i(Nw,"filter2"),a(Nw,"filter");var ED=H1(lv),AD=H1(fv);function Pw(u,l){return Jr(nf(u,l),1)}i(Pw,"flatMap"),a(Pw,"flatMap");function Bw(u,l){return Jr(nf(u,l),g)}i(Bw,"flatMapDeep"),a(Bw,"flatMapDeep");function Lw(u,l,A){return A=A===r?1:Nt(A),Jr(nf(u,l),A)}i(Lw,"flatMapDepth"),a(Lw,"flatMapDepth");function gv(u,l){var A=Rt(u)?Qn:Na;return A(u,wt(l,3))}i(gv,"forEach"),a(gv,"forEach");function bv(u,l){var A=Rt(u)?L6:U3;return A(u,wt(l,3))}i(bv,"forEachRight"),a(bv,"forEachRight");var SD=Gl(function(u,l,A){vr.call(u,A)?u[A].push(l):_s(u,A,[l])});function Fw(u,l,A,L){u=Cn(u)?u:Fo(u),A=A&&!L?Nt(A):0;var Z=u.length;return A<0&&(A=Gr(Z+A,0)),cf(u)?A<=Z&&u.indexOf(l,A)>-1:!!Z&&ko(u,l,A)>-1}i(Fw,"includes"),a(Fw,"includes");var xD=Ft(function(u,l,A){var L=-1,Z=typeof l=="function",re=Cn(u)?Ie(u.length):[];return Na(u,function(de){re[++L]=Z?Ln(l,de,A):Gc(de,l,A)}),re}),TD=Gl(function(u,l,A){_s(u,A,l)});function nf(u,l){var A=Rt(u)?Tr:A1;return A(u,wt(l,3))}i(nf,"map2"),a(nf,"map");function Uw(u,l,A,L){return u==null?[]:(Rt(l)||(l=l==null?[]:[l]),A=L?r:A,Rt(A)||(A=A==null?[]:[A]),M1(u,l,A))}i(Uw,"orderBy"),a(Uw,"orderBy");var MD=Gl(function(u,l,A){u[A?0:1].push(l)},function(){return[[],[]]});function $w(u,l,A){var L=Rt(u)?$d:r1,Z=arguments.length<3;return L(u,wt(l,4),A,Z,Na)}i($w,"reduce"),a($w,"reduce");function jw(u,l,A){var L=Rt(u)?F6:r1,Z=arguments.length<3;return L(u,wt(l,4),A,Z,U3)}i(jw,"reduceRight"),a(jw,"reduceRight");function zw(u,l){var A=Rt(u)?Xs:g1;return A(u,af(wt(l,3)))}i(zw,"reject"),a(zw,"reject");function Hw(u){var l=Rt(u)?h1:s5;return l(u)}i(Hw,"sample"),a(Hw,"sample");function qw(u,l,A){(A?bn(u,l,A):l===r)?l=1:l=Nt(l);var L=Rt(u)?N3:a5;return L(u,l)}i(qw,"sampleSize"),a(qw,"sampleSize");function Kw(u){var l=Rt(u)?P3:c5;return l(u)}i(Kw,"shuffle"),a(Kw,"shuffle");function Vw(u){if(u==null)return 0;if(Cn(u))return cf(u)?Oo(u):u.length;var l=gn(u);return l==ge||l==te?u.size:hh(u).length}i(Vw,"size"),a(Vw,"size");function Gw(u,l,A){var L=Rt(u)?jd:u5;return A&&bn(u,l,A)&&(l=r),L(u,wt(l,3))}i(Gw,"some"),a(Gw,"some");var CD=Ft(function(u,l){if(u==null)return[];var A=l.length;return A>1&&bn(u,l[0],l[1])?l=[]:A>2&&bn(l[0],l[1],l[2])&&(l=[l[0]]),M1(u,Jr(l,1),[])}),Nh=$k||function(){return Lr.Date.now()};function Ww(u,l){if(typeof l!="function")throw new ki(c);return u=Nt(u),function(){if(--u<1)return l.apply(this,arguments)}}i(Ww,"after"),a(Ww,"after");function yv(u,l,A){return l=A?r:l,l=u&&l==null?u.length:l,Es(u,I,r,r,r,r,l)}i(yv,"ary"),a(yv,"ary");function wv(u,l){var A;if(typeof l!="function")throw new ki(c);return u=Nt(u),function(){return--u>0&&(A=l.apply(this,arguments)),u<=1&&(l=r),A}}i(wv,"before"),a(wv,"before");var _v=Ft(function(u,l,A){var L=R;if(A.length){var Z=ea(A,Bo(_v));L|=V}return Es(u,L,l,A,Z)}),Zw=Ft(function(u,l,A){var L=R|P;if(A.length){var Z=ea(A,Bo(Zw));L|=V}return Es(l,L,u,A,Z)});function Ev(u,l,A){l=A?r:l;var L=Es(u,U,r,r,r,r,r,l);return L.placeholder=Ev.placeholder,L}i(Ev,"curry"),a(Ev,"curry");function Av(u,l,A){l=A?r:l;var L=Es(u,j,r,r,r,r,r,l);return L.placeholder=Av.placeholder,L}i(Av,"curryRight"),a(Av,"curryRight");function Sv(u,l,A){var L,Z,re,de,ye,Ae,Be=0,Le=!1,$e=!1,Je=!0;if(typeof u!="function")throw new ki(c);l=ii(l)||0,Cr(A)&&(Le=!!A.leading,$e="maxWait"in A,re=$e?Gr(ii(A.maxWait)||0,l):re,Je="trailing"in A?!!A.trailing:Je);function pt(Fr){var Ji=L,ia=Z;return L=Z=r,Be=Fr,de=u.apply(ia,Ji),de}i(pt,"invokeFunc"),a(pt,"invokeFunc");function St(Fr){return Be=Fr,ye=ef(Ht,l),Le?pt(Fr):de}i(St,"leadingEdge"),a(St,"leadingEdge");function Lt(Fr){var Ji=Fr-Ae,ia=Fr-Be,K_=l-Ji;return $e?mn(K_,re-ia):K_}i(Lt,"remainingWait"),a(Lt,"remainingWait");function _t(Fr){var Ji=Fr-Ae,ia=Fr-Be;return Ae===r||Ji>=l||Ji<0||$e&&ia>=re}i(_t,"shouldInvoke"),a(_t,"shouldInvoke");function Ht(){var Fr=Nh();if(_t(Fr))return Gt(Fr);ye=ef(Ht,Lt(Fr))}i(Ht,"timerExpired"),a(Ht,"timerExpired");function Gt(Fr){return ye=r,Je&&L?pt(Fr):(L=Z=r,de)}i(Gt,"trailingEdge"),a(Gt,"trailingEdge");function jn(){ye!==r&&l5(ye),Be=0,L=Ae=Z=ye=r}i(jn,"cancel"),a(jn,"cancel");function yn(){return ye===r?de:Gt(Nh())}i(yn,"flush"),a(yn,"flush");function zn(){var Fr=Nh(),Ji=_t(Fr);if(L=arguments,Z=this,Ae=Fr,Ji){if(ye===r)return St(Ae);if($e)return l5(ye),ye=ef(Ht,l),pt(Ae)}return ye===r&&(ye=ef(Ht,l)),de}return i(zn,"debounced"),a(zn,"debounced"),zn.cancel=jn,zn.flush=yn,zn}i(Sv,"debounce"),a(Sv,"debounce");var ID=Ft(function(u,l){return v1(u,1,l)}),kD=Ft(function(u,l,A){return v1(u,ii(l)||0,A)});function Jw(u){return Es(u,ae)}i(Jw,"flip"),a(Jw,"flip");function sf(u,l){if(typeof u!="function"||l!=null&&typeof l!="function")throw new ki(c);var A=a(function(){var L=arguments,Z=l?l.apply(this,L):L[0],re=A.cache;if(re.has(Z))return re.get(Z);var de=u.apply(this,L);return A.cache=re.set(Z,de)||re,de},"memoized");return A.cache=new(sf.Cache||ws),A}i(sf,"memoize"),a(sf,"memoize"),sf.Cache=ws;function af(u){if(typeof u!="function")throw new ki(c);return function(){var l=arguments;switch(l.length){case 0:return!u.call(this);case 1:return!u.call(this,l[0]);case 2:return!u.call(this,l[0],l[1]);case 3:return!u.call(this,l[0],l[1],l[2])}return!u.apply(this,l)}}i(af,"negate"),a(af,"negate");function Yw(u){return wv(2,u)}i(Yw,"once"),a(Yw,"once");var DD=eD(function(u,l){l=l.length==1&&Rt(l[0])?Tr(l[0],Fn(wt())):Tr(Jr(l,1),Fn(wt()));var A=l.length;return Ft(function(L){for(var Z=-1,re=mn(L.length,A);++Z<re;)L[Z]=l[Z].call(this,L[Z]);return Ln(u,this,L)})}),xv=Ft(function(u,l){var A=ea(l,Bo(xv));return Es(u,V,r,l,A)}),Xw=Ft(function(u,l){var A=ea(l,Bo(Xw));return Es(u,G,r,l,A)}),OD=As(function(u,l){return Es(u,H,r,r,r,l)});function Qw(u,l){if(typeof u!="function")throw new ki(c);return l=l===r?l:Nt(l),Ft(u,l)}i(Qw,"rest"),a(Qw,"rest");function e4(u,l){if(typeof u!="function")throw new ki(c);return l=l==null?0:Gr(Nt(l),0),Ft(function(A){var L=A[l],Z=na(A,0,l);return L&&Qs(Z,L),Ln(u,this,Z)})}i(e4,"spread"),a(e4,"spread");function t4(u,l,A){var L=!0,Z=!0;if(typeof u!="function")throw new ki(c);return Cr(A)&&(L="leading"in A?!!A.leading:L,Z="trailing"in A?!!A.trailing:Z),Sv(u,l,{leading:L,maxWait:l,trailing:Z})}i(t4,"throttle2"),a(t4,"throttle");function r4(u){return yv(u,1)}i(r4,"unary"),a(r4,"unary");function n4(u,l){return xv(Eh(l),u)}i(n4,"wrap"),a(n4,"wrap");function i4(){if(!arguments.length)return[];var u=arguments[0];return Rt(u)?u:[u]}i(i4,"castArray"),a(i4,"castArray");function s4(u){return ti(u,_)}i(s4,"clone"),a(s4,"clone");function a4(u,l){return l=typeof l=="function"?l:r,ti(u,_,l)}i(a4,"cloneWith"),a(a4,"cloneWith");function o4(u){return ti(u,y|_)}i(o4,"cloneDeep6"),a(o4,"cloneDeep");function c4(u,l){return l=typeof l=="function"?l:r,ti(u,y|_,l)}i(c4,"cloneDeepWith"),a(c4,"cloneDeepWith");function u4(u,l){return l==null||m1(u,l,Wr(l))}i(u4,"conformsTo"),a(u4,"conformsTo");function Oi(u,l){return u===l||u!==u&&l!==l}i(Oi,"eq4"),a(Oi,"eq");var RD=Yl(lh),ND=Yl(function(u,l){return u>=l}),Lo=w1(function(){return arguments}())?w1:function(u){return kr(u)&&vr.call(u,"callee")&&!i3.call(u,"callee")},Rt=Ie.isArray,PD=Io?Fn(Io):G3;function Cn(u){return u!=null&&of(u.length)&&!xs(u)}i(Cn,"isArrayLike2"),a(Cn,"isArrayLike");function Rr(u){return kr(u)&&Cn(u)}i(Rr,"isArrayLikeObject"),a(Rr,"isArrayLikeObject");function l4(u){return u===!0||u===!1||kr(u)&&vn(u)==Q}i(l4,"isBoolean"),a(l4,"isBoolean");var Fa=zk||qh,BD=D6?Fn(D6):W3;function f4(u){return kr(u)&&u.nodeType===1&&!Xc(u)}i(f4,"isElement"),a(f4,"isElement");function d4(u){if(u==null)return!0;if(Cn(u)&&(Rt(u)||typeof u=="string"||typeof u.splice=="function"||Fa(u)||Qc(u)||Lo(u)))return!u.length;var l=gn(u);if(l==ge||l==te)return!u.size;if(Yc(u))return!hh(u).length;for(var A in u)if(vr.call(u,A))return!1;return!0}i(d4,"isEmpty"),a(d4,"isEmpty");function h4(u,l){return Wc(u,l)}i(h4,"isEqual"),a(h4,"isEqual");function p4(u,l,A){A=typeof A=="function"?A:r;var L=A?A(u,l):r;return L===r?Wc(u,l,r,A):!!L}i(p4,"isEqualWith"),a(p4,"isEqualWith");function Ph(u){if(!kr(u))return!1;var l=vn(u);return l==z||l==M||typeof u.message=="string"&&typeof u.name=="string"&&!Xc(u)}i(Ph,"isError"),a(Ph,"isError");function m4(u){return typeof u=="number"&&a3(u)}i(m4,"isFinite2"),a(m4,"isFinite");function xs(u){if(!Cr(u))return!1;var l=vn(u);return l==ne||l==oe||l==N||l==pe}i(xs,"isFunction2"),a(xs,"isFunction");function Tv(u){return typeof u=="number"&&u==Nt(u)}i(Tv,"isInteger3"),a(Tv,"isInteger");function of(u){return typeof u=="number"&&u>-1&&u%1==0&&u<=S}i(of,"isLength"),a(of,"isLength");function Cr(u){var l=typeof u;return u!=null&&(l=="object"||l=="function")}i(Cr,"isObject"),a(Cr,"isObject");function kr(u){return u!=null&&typeof u=="object"}i(kr,"isObjectLike"),a(kr,"isObjectLike");var v4=O6?Fn(O6):J3;function g4(u,l){return u===l||dh(u,l,Ch(l))}i(g4,"isMatch"),a(g4,"isMatch");function b4(u,l,A){return A=typeof A=="function"?A:r,dh(u,l,Ch(l),A)}i(b4,"isMatchWith"),a(b4,"isMatchWith");function y4(u){return Mv(u)&&u!=+u}i(y4,"isNaN2"),a(y4,"isNaN");function w4(u){if(rD(u))throw new It(o);return _1(u)}i(w4,"isNative"),a(w4,"isNative");function _4(u){return u===null}i(_4,"isNull"),a(_4,"isNull");function E4(u){return u==null}i(E4,"isNil"),a(E4,"isNil");function Mv(u){return typeof u=="number"||kr(u)&&vn(u)==ke}i(Mv,"isNumber"),a(Mv,"isNumber");function Xc(u){if(!kr(u)||vn(u)!=fe)return!1;var l=eh(u);if(l===null)return!0;var A=vr.call(l,"constructor")&&l.constructor;return typeof A=="function"&&A instanceof A&&Jd.call(A)==Bk}i(Xc,"isPlainObject"),a(Xc,"isPlainObject");var Cv=R6?Fn(R6):Y3;function A4(u){return Tv(u)&&u>=-S&&u<=S}i(A4,"isSafeInteger"),a(A4,"isSafeInteger");var S4=N6?Fn(N6):X3;function cf(u){return typeof u=="string"||!Rt(u)&&kr(u)&&vn(u)==ve}i(cf,"isString"),a(cf,"isString");function $n(u){return typeof u=="symbol"||kr(u)&&vn(u)==Me}i($n,"isSymbol"),a($n,"isSymbol");var Qc=P6?Fn(P6):Q3;function x4(u){return u===r}i(x4,"isUndefined"),a(x4,"isUndefined");function T4(u){return kr(u)&&gn(u)==Re}i(T4,"isWeakMap"),a(T4,"isWeakMap");function M4(u){return kr(u)&&vn(u)==je}i(M4,"isWeakSet"),a(M4,"isWeakSet");var LD=Yl(ph),FD=Yl(function(u,l){return u<=l});function Iv(u){if(!u)return[];if(Cn(u))return cf(u)?Ii(u):Mn(u);if(Pl&&u[Pl])return W6(u[Pl]());var l=gn(u),A=l==ge?Gd:l==te?Nl:Fo;return A(u)}i(Iv,"toArray"),a(Iv,"toArray");function Ts(u){if(!u)return u===0?u:0;if(u=ii(u),u===g||u===-g){var l=u<0?-1:1;return l*D}return u===u?u:0}i(Ts,"toFinite"),a(Ts,"toFinite");function Nt(u){var l=Ts(u),A=l%1;return l===l?A?l-A:l:0}i(Nt,"toInteger"),a(Nt,"toInteger");function kv(u){return u?Ra(Nt(u),0,E):0}i(kv,"toLength"),a(kv,"toLength");function ii(u){if(typeof u=="number")return u;if($n(u))return C;if(Cr(u)){var l=typeof u.valueOf=="function"?u.valueOf():u;u=Cr(l)?l+"":l}if(typeof u!="string")return u===0?u:+u;u=n1(u);var A=er.test(u);return A||tn.test(u)?sn(u.slice(2),A?2:8):fn.test(u)?C:+u}i(ii,"toNumber"),a(ii,"toNumber");function Dv(u){return Wi(u,In(u))}i(Dv,"toPlainObject"),a(Dv,"toPlainObject");function C4(u){return u?Ra(Nt(u),-S,S):u===0?u:0}i(C4,"toSafeInteger"),a(C4,"toSafeInteger");function dr(u){return u==null?"":Un(u)}i(dr,"toString4"),a(dr,"toString");var UD=No(function(u,l){if(Yc(l)||Cn(l)){Wi(l,Wr(l),u);return}for(var A in l)vr.call(l,A)&&Kc(u,A,l[A])}),I4=No(function(u,l){Wi(l,In(l),u)}),Bh=No(function(u,l,A,L){Wi(l,In(l),u,L)}),$D=No(function(u,l,A,L){Wi(l,Wr(l),u,L)}),jD=As(ch);function k4(u,l){var A=qc(u);return l==null?A:p1(A,l)}i(k4,"create2"),a(k4,"create");var zD=Ft(function(u,l){u=wr(u);var A=-1,L=l.length,Z=L>2?l[2]:r;for(Z&&bn(l[0],l[1],Z)&&(L=1);++A<L;)for(var re=l[A],de=In(re),ye=-1,Ae=de.length;++ye<Ae;){var Be=de[ye],Le=u[Be];(Le===r||Oi(Le,jc[Be])&&!vr.call(u,Be))&&(u[Be]=re[Be])}return u}),HD=Ft(function(u){return u.push(r,J1),Ln(z4,r,u)});function D4(u,l){return Qm(u,wt(l,3),Gi)}i(D4,"findKey"),a(D4,"findKey");function O4(u,l){return Qm(u,wt(l,3),uh)}i(O4,"findLastKey"),a(O4,"findLastKey");function R4(u,l){return u==null?u:b1(u,wt(l,3),In)}i(R4,"forIn"),a(R4,"forIn");function N4(u,l){return u==null?u:z3(u,wt(l,3),In)}i(N4,"forInRight"),a(N4,"forInRight");function P4(u,l){return u&&Gi(u,wt(l,3))}i(P4,"forOwn"),a(P4,"forOwn");function B4(u,l){return u&&uh(u,wt(l,3))}i(B4,"forOwnRight"),a(B4,"forOwnRight");function L4(u){return u==null?[]:Hl(u,Wr(u))}i(L4,"functions"),a(L4,"functions");function F4(u){return u==null?[]:Hl(u,In(u))}i(F4,"functionsIn"),a(F4,"functionsIn");function Lh(u,l,A){var L=u==null?r:Pa(u,l);return L===r?A:L}i(Lh,"get2"),a(Lh,"get");function U4(u,l){return u!=null&&ev(u,l,H3)}i(U4,"has"),a(U4,"has");function Fh(u,l){return u!=null&&ev(u,l,q3)}i(Fh,"hasIn"),a(Fh,"hasIn");var qD=K1(function(u,l,A){l!=null&&typeof l.toString!="function"&&(l=Yd.call(l)),u[l]=A},Uh(kn)),KD=K1(function(u,l,A){l!=null&&typeof l.toString!="function"&&(l=Yd.call(l)),vr.call(u,l)?u[l].push(A):u[l]=[A]},wt),VD=Ft(Gc);function Wr(u){return Cn(u)?d1(u):hh(u)}i(Wr,"keys"),a(Wr,"keys");function In(u){return Cn(u)?d1(u,!0):e5(u)}i(In,"keysIn"),a(In,"keysIn");function $4(u,l){var A={};return l=wt(l,3),Gi(u,function(L,Z,re){_s(A,l(L,Z,re),L)}),A}i($4,"mapKeys"),a($4,"mapKeys");function j4(u,l){var A={};return l=wt(l,3),Gi(u,function(L,Z,re){_s(A,Z,l(L,Z,re))}),A}i(j4,"mapValues"),a(j4,"mapValues");var GD=No(function(u,l,A){ql(u,l,A)}),z4=No(function(u,l,A,L){ql(u,l,A,L)}),WD=As(function(u,l){var A={};if(u==null)return A;var L=!1;l=Tr(l,function(re){return re=ra(re,u),L||(L=re.length>1),re}),Wi(u,Mh(u),A),L&&(A=ti(A,y|b|_,w5));for(var Z=l.length;Z--;)yh(A,l[Z]);return A});function H4(u,l){return Ov(u,af(wt(l)))}i(H4,"omitBy"),a(H4,"omitBy");var ZD=As(function(u,l){return u==null?{}:r5(u,l)});function Ov(u,l){if(u==null)return{};var A=Tr(Mh(u),function(L){return[L]});return l=wt(l),C1(u,A,function(L,Z){return l(L,Z[0])})}i(Ov,"pickBy"),a(Ov,"pickBy");function q4(u,l,A){l=ra(l,u);var L=-1,Z=l.length;for(Z||(Z=1,u=r);++L<Z;){var re=u==null?r:u[Zi(l[L])];re===r&&(L=Z,re=A),u=xs(re)?re.call(u):re}return u}i(q4,"result"),a(q4,"result");function K4(u,l,A){return u==null?u:Zc(u,l,A)}i(K4,"set"),a(K4,"set");function V4(u,l,A,L){return L=typeof L=="function"?L:r,u==null?u:Zc(u,l,A,L)}i(V4,"setWith"),a(V4,"setWith");var G4=W1(Wr),W4=W1(In);function Z4(u,l,A){var L=Rt(u),Z=L||Fa(u)||Qc(u);if(l=wt(l,4),A==null){var re=u&&u.constructor;Z?A=L?new re:[]:Cr(u)?A=xs(re)?qc(eh(u)):{}:A={}}return(Z?Qn:Gi)(u,function(de,ye,Ae){return l(A,de,ye,Ae)}),A}i(Z4,"transform"),a(Z4,"transform");function J4(u,l){return u==null?!0:yh(u,l)}i(J4,"unset"),a(J4,"unset");function Y4(u,l,A){return u==null?u:O1(u,l,Eh(A))}i(Y4,"update2"),a(Y4,"update");function X4(u,l,A,L){return L=typeof L=="function"?L:r,u==null?u:O1(u,l,Eh(A),L)}i(X4,"updateWith"),a(X4,"updateWith");function Fo(u){return u==null?[]:Vd(u,Wr(u))}i(Fo,"values"),a(Fo,"values");function Q4(u){return u==null?[]:Vd(u,In(u))}i(Q4,"valuesIn"),a(Q4,"valuesIn");function e_(u,l,A){return A===r&&(A=l,l=r),A!==r&&(A=ii(A),A=A===A?A:0),l!==r&&(l=ii(l),l=l===l?l:0),Ra(ii(u),l,A)}i(e_,"clamp"),a(e_,"clamp");function t_(u,l,A){return l=Ts(l),A===r?(A=l,l=0):A=Ts(A),u=ii(u),K3(u,l,A)}i(t_,"inRange"),a(t_,"inRange");function r_(u,l,A){if(A&&typeof A!="boolean"&&bn(u,l,A)&&(l=A=r),A===r&&(typeof l=="boolean"?(A=l,l=r):typeof u=="boolean"&&(A=u,u=r)),u===r&&l===r?(u=0,l=1):(u=Ts(u),l===r?(l=u,u=0):l=Ts(l)),u>l){var L=u;u=l,l=L}if(A||u%1||l%1){var Z=o3();return mn(u+Z*(l-u+qr("1e-"+((Z+"").length-1))),l)}return vh(u,l)}i(r_,"random"),a(r_,"random");var JD=Po(function(u,l,A){return l=l.toLowerCase(),u+(A?Rv(l):l)});function Rv(u){return Pv(dr(u).toLowerCase())}i(Rv,"capitalize"),a(Rv,"capitalize");function Nv(u){return u=dr(u),u&&u.replace(Or,Ik).replace(Bd,"")}i(Nv,"deburr"),a(Nv,"deburr");function n_(u,l,A){u=dr(u),l=Un(l);var L=u.length;A=A===r?L:Ra(Nt(A),0,L);var Z=A;return A-=l.length,A>=0&&u.slice(A,Z)==l}i(n_,"endsWith"),a(n_,"endsWith");function i_(u){return u=dr(u),u&&ut.test(u)?u.replace(Dr,kk):u}i(i_,"escape"),a(i_,"escape");function s_(u){return u=dr(u),u&&st.test(u)?u.replace(Qt,"\\$&"):u}i(s_,"escapeRegExp"),a(s_,"escapeRegExp");var YD=Po(function(u,l,A){return u+(A?"-":"")+l.toLowerCase()}),XD=Po(function(u,l,A){return u+(A?" ":"")+l.toLowerCase()}),QD=z1("toLowerCase");function a_(u,l,A){u=dr(u),l=Nt(l);var L=l?Oo(u):0;if(!l||L>=l)return u;var Z=(l-L)/2;return Jl(ih(Z),A)+u+Jl(nh(Z),A)}i(a_,"pad2"),a(a_,"pad");function o_(u,l,A){u=dr(u),l=Nt(l);var L=l?Oo(u):0;return l&&L<l?u+Jl(l-L,A):u}i(o_,"padEnd"),a(o_,"padEnd");function c_(u,l,A){u=dr(u),l=Nt(l);var L=l?Oo(u):0;return l&&L<l?Jl(l-L,A)+u:u}i(c_,"padStart"),a(c_,"padStart");function u_(u,l,A){return A||l==null?l=0:l&&(l=+l),Vk(dr(u).replace(Qe,""),l||0)}i(u_,"parseInt2"),a(u_,"parseInt");function l_(u,l,A){return(A?bn(u,l,A):l===r)?l=1:l=Nt(l),gh(dr(u),l)}i(l_,"repeat"),a(l_,"repeat");function f_(){var u=arguments,l=dr(u[0]);return u.length<3?l:l.replace(u[1],u[2])}i(f_,"replace"),a(f_,"replace");var eO=Po(function(u,l,A){return u+(A?"_":"")+l.toLowerCase()});function d_(u,l,A){return A&&typeof A!="number"&&bn(u,l,A)&&(l=A=r),A=A===r?E:A>>>0,A?(u=dr(u),u&&(typeof l=="string"||l!=null&&!Cv(l))&&(l=Un(l),!l&&Do(u))?na(Ii(u),0,A):u.split(l,A)):[]}i(d_,"split"),a(d_,"split");var tO=Po(function(u,l,A){return u+(A?" ":"")+Pv(l)});function h_(u,l,A){return u=dr(u),A=A==null?0:Ra(Nt(A),0,u.length),l=Un(l),u.slice(A,A+l.length)==l}i(h_,"startsWith"),a(h_,"startsWith");function p_(u,l,A){var L=ee.templateSettings;A&&bn(u,l,A)&&(l=r),u=dr(u),l=Bh({},l,L,Z1);var Z=Bh({},l.imports,L.imports,Z1),re=Wr(Z),de=Vd(Z,re),ye,Ae,Be=0,Le=l.interpolate||Hr,$e="__p += '",Je=c1((l.escape||Hr).source+"|"+Le.source+"|"+(Le===nt?At:Hr).source+"|"+(l.evaluate||Hr).source+"|$","g"),pt="//# sourceURL="+(vr.call(l,"sourceURL")?(l.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Fc+"]")+`
27
27
  `;u.replace(Je,function(_t,Ht,Gt,jn,yn,zn){return Gt||(Gt=jn),$e+=u.slice(Be,zn).replace(nn,K6),Ht&&(ye=!0,$e+=`' +
@@ -837,7 +837,7 @@ HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F"
837
837
  `)}i(qM,"asString");a(qM,"asString");var ky=i(class extends q2{toMessage(){return super.toMessage("Ethereum")}signMessage(){let e;switch(this.type){case Qf.PERSONAL_SIGNATURE:{e=this.toMessage();break}default:{e=this.toMessage();break}}return e}},"SiweMessage");a(ky,"SiweMessage");var KM=i(class extends q2{toMessage(){return super.toMessage("Solana")}signMessage(){let e;switch(this.type){case Qf.PERSONAL_SIGNATURE:{e=new TextEncoder().encode(this.toMessage());break}default:{e=new TextEncoder().encode(this.toMessage());break}}return e}},"SiwsMessage");a(KM,"SiwsMessage");var vz=5*60,gz=new Date("2022-09-20").valueOf(),K0;(function(e){function t(c){let f={h:{t:"eip4361"},p:{domain:c.domain,iat:c.issuedAt,iss:`did:pkh:eip155:${c.chainId}:${c.address}`,aud:c.uri,version:c.version,nonce:c.nonce}};return c.signature&&(f.s={t:"eip191",s:c.signature}),c.notBefore&&(f.p.nbf=c.notBefore),c.expirationTime&&(f.p.exp=c.expirationTime),c.statement&&(f.p.statement=c.statement),c.requestId&&(f.p.requestId=c.requestId),c.resources&&(f.p.resources=c.resources),f}i(t,"fromSiweMessage"),a(t,"fromSiweMessage");let r=a(function(c){try{return Promise.resolve(bj({bytes:c,codec:al,hasher:tl})).then(function(f){return f.value})}catch(f){return Promise.reject(f)}},"fromBlockBytes");e.fromSiweMessage=t;function n(c){let f={h:{t:"caip122"},p:{domain:c.domain,iat:c.issuedAt,iss:`did:pkh:solana:${c.chainId}:${c.address}`,aud:c.uri,version:c.version,nonce:c.nonce}};return c.signature&&(f.s={t:"solana:ed25519",s:c.signature}),c.notBefore&&(f.p.nbf=c.notBefore),c.expirationTime&&(f.p.exp=c.expirationTime),c.statement&&(f.p.statement=c.statement),c.requestId&&(f.p.requestId=c.requestId),c.resources&&(f.p.resources=c.resources),f}i(n,"fromSiwsMessage"),a(n,"fromSiwsMessage"),e.fromSiwsMessage=n,e.fromBlockBytes=r;function s(c,f={}){var h,p;if(((h=c.s)==null?void 0:h.t)==="eip191")return o(c,f);if(((p=c.s)==null?void 0:p.t)==="solana:ed25519")return VM(c,f);throw new Error("Unsupported CACAO signature type")}i(s,"verify5"),a(s,"verify"),e.verify=s;function o(c,f){if(!c.s)throw new Error("CACAO does not have a signature");let h=f.atTime?f.atTime.getTime():Date.now(),p=(f.clockSkewSecs??vz)*1e3;if(Date.parse(c.p.iat)>h+p||Date.parse(c.p.nbf)>h+p)throw new Error("CACAO is not valid yet");let v=f.revocationPhaseOutSecs?f.revocationPhaseOutSecs*1e3:0;if(!f.disableExpirationCheck&&Date.parse(c.p.exp)+v+p<h)throw new Error("CACAO has expired");let b=[Iy(ky.fromCacao(c).toMessage(),c.s.s).toLowerCase()];if(Date.parse(c.p.iat)<=gz){let T=Iy(HM(ky.fromCacao(c),"Ethereum"),c.s.s).toLowerCase();b.push(T)}let _=Uu.parse(c.p.iss.replace("did:pkh:","")).address.toLowerCase();if(!b.includes(_))throw new Error("Signature does not belong to issuer")}i(o,"verifyEIP191Signature"),a(o,"verifyEIP191Signature"),e.verifyEIP191Signature=o})(K0||(K0={}));function VM(e,t){if(!e.s)throw new Error("CACAO does not have a signature");let r=t.atTime?t.atTime.getTime():Date.now();if(Date.parse(e.p.iat)>r||Date.parse(e.p.nbf)>r)throw new Error("CACAO is not valid yet");let n=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0;if(!t.disableExpirationCheck&&Date.parse(e.p.exp)+n<r)throw new Error("CACAO has expired");let s=KM.fromCacao(e),o=e.s.s,c=s.signMessage(),f=yr(o,"base58btc"),h=Uu.parse(e.p.iss.replace("did:pkh:","")).address,p=yr(h,"base58btc");if(!(0,pz.verify)(p,c,f))throw new Error("Signature does not belong to issuer")}i(VM,"verifySolanaSignature");a(VM,"verifySolanaSignature");var V0;(function(e){function t(r){return Em({value:r,codec:al,hasher:tl})}i(t,"fromCacao"),a(t,"fromCacao"),e.fromCacao=t})(V0||(V0={}));vd();hm();var bz=rr(nl(),1);vd();function GM(){return Mr((0,bz.randomBytes)(16),"base64")}i(GM,"randomString");a(GM,"randomString");var WM="base64pad",ZM="base64url";function JM(e){return Mr(e,WM)}i(JM,"encodeBase64");a(JM,"encodeBase64");function YM(e){return Mr(e,ZM)}i(YM,"encodeBase64Url");a(YM,"encodeBase64Url");function XM(e){return yr(e,WM)}i(XM,"decodeBase64");a(XM,"decodeBase64");function A0(e){return JSON.parse(Mr(yr(e,ZM)))}i(A0,"base64urlToJSON");a(A0,"base64urlToJSON");function QM(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(QM,"fromDagJWS");a(QM,"fromDagJWS");function eC(e,t){if(t){let r=t.toISOString().split(".")[0]+"Z";return`${e}?versionTime=${r}`}else return e}i(eC,"didWithTime");a(eC,"didWithTime");function tC(e){return e?Array.isArray(e)?e:[e]:[]}i(tC,"extractControllers");a(tC,"extractControllers");function rC(e){return"registry"in e&&"cache"in e}i(rC,"isResolver");a(rC,"isResolver");var nC=i(class{constructor({provider:e,resolver:t={},resolverOptions:r,capability:n,parent:s}={}){if(e!=null&&(this._client=new wy(e)),n){if(this._capability=n,this._parentId=this._capability.p.iss,s&&this._parentId!==s)throw new Error("Capability issuer and parent not equal")}else s&&(this._parentId=s);this.setResolver(t,r)}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 nC({provider:this._client?.connection,resolver:this._resolver,capability:e,parent:this._parentId})}setProvider(e){if(this._client==null)this._client=new wy(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=rC(e)?e:new gx(e,t)}async authenticate({provider:e,paths:t=[],aud:r}={}){if(e!=null&&this.setProvider(e),this._client==null)throw new Error("No provider available");let n=GM(),s=await this._client.request("did_authenticate",{nonce:n,aud:r,paths:t}),{kid:o}=await this.verifyJWS(s),c=A0(s.payload);if(!o.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=await V0.fromCacao(this._capability),s=jt.asCID(n.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 rM(e),s=YM(r.bytes);Object.assign(t,{linkedBlock:JM(n)});let o=await this.createJWS(s,t),c=jt.asCID(r);if(!c)throw new Error("CID of the JWS cannot be set to the encoded payload cid as they are incompatible");if(o.link=c,this._capability){let f=await V0.fromCacao(this._capability);return{jws:o,linkedBlock:n,cacaoBlock:f.bytes}}return{jws:o,linkedBlock:n}}async verifyJWS(e,t={}){typeof e!="string"&&(e=QM(e));let r=A0(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 v=t.revocationPhaseOutSecs?t.revocationPhaseOutSecs*1e3:0,y=new Date(h).valueOf()+v;if(!(t.atTime&&t.atTime.getTime()<y))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 o=n.didDocument?.id;if(t.issuer&&t.issuer===t.capability?.p.iss&&o===t.capability.p.aud)K0.verify(t.capability,{atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs});else if(t.issuer&&t.issuer!==o){let h=eC(t.issuer,t.atTime),v=(await this.resolve(h)).didDocument?.controller,y=tC(v);if(t.capability?.s&&t.capability.p.aud===o&&y.includes(t.capability.p.iss))K0.verify(t.capability,{atTime:t.atTime?t.atTime:void 0,revocationPhaseOutSecs:t.revocationPhaseOutSecs});else if(!(o?y.includes(o):!1))throw new Error(`invalid_jws: not a valid verificationMethod for issuer: ${r}`)}let c=n.didDocument?.verificationMethod||[];Rx(e,c);let f;try{f=A0(e.split(".")[1])}catch{}return{kid:r,payload:f,didResolutionResult:n}}async createJWE(e,t,r={}){let n=await vj(t,this._resolver);return mj(e,n,r.protectedHeader,r.aad)}async createDagJWE(e,t,r={}){let n=await aM(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 XM(r)}async decryptDagJWE(e){let t=await this.decryptJWE(e);return oM(t)}async resolve(e){let t=await this._resolver.resolve(e);if(t.didResolutionMetadata.error){let{error:r,message:n}=t.didResolutionMetadata,s=n?`, ${n}`:"";throw new Error(`Failed to resolve ${e}: ${r}${s}`)}return t}},"DID");a(nC,"DID");function yz(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(yz,"toUint8Array");a(yz,"toUint8Array");var TA=rr(ym(),1);i2();var iC={};Sr(iC,{keyToDidDoc:()=>sC});function sC(e,t){let r=`did:key:${t}`,n=`${r}#${t}`;return{id:r,verificationMethod:[{id:n,type:"Secp256k1VerificationKey2018",controller:r,publicKeyBase58:Mr(e,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(sC,"keyToDidDoc");a(sC,"keyToDidDoc");var aC={};Sr(aC,{keyToDidDoc:()=>cC});vd();var wz=rr(gm(),1);function oC(e){let t=new Uint8Array(e.length+2);return t[0]=236,t[1]=1,t.set(e,2),`z${Mr(t,"base58btc")}`}i(oC,"encodeKey");a(oC,"encodeKey");function cC(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,s=(0,wz.convertPublicKeyToX25519)(e),o=`${r}#${oC(s)}`;return{id:r,verificationMethod:[{id:n,type:"Ed25519VerificationKey2018",controller:r,publicKeyBase58:Mr(e,"base58btc")}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n],keyAgreement:[{id:o,type:"X25519KeyAgreementKey2019",controller:r,publicKeyBase58:Mr(s,"base58btc")}]}}i(cC,"keyToDidDoc2");a(cC,"keyToDidDoc");var uC={};Sr(uC,{keyToDidDoc:()=>EC,pubKeyBytesToXY:()=>G2});var lC={};Sr(lC,{ECPointDecompress:()=>gC});function fC(e){return e>=0?e:-e}i(fC,"n");a(fC,"n");function dC(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,s=1n,o=0n;for(;e!==0n;){let c=t/e,f=t%e,h=r-s*c,p=n-o*c;t=e,e=f,r=s,n=o,s=h,o=p}return{g:t,x:r,y:n}}i(dC,"r");a(dC,"r");function G0(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(G0,"f");a(G0,"f");function hC(e,t){let r=dC(G0(e,t),t);if(r.g!==1n)throw new RangeError(`${e.toString()} does not have inverse modulo ${t.toString()}`);return G0(r.x,t)}i(hC,"g");a(hC,"g");function Sd(e,t,r){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=G0(e,r),t<0n)return hC(Sd(e,fC(t),r),r);let n=1n;for(;t>0;)t%2n===1n&&(n=n*e%r),t/=2n,e=e**2n%r;return n}i(Sd,"b");a(Sd,"b");var Wn={};Sr(Wn,{pubKeyBytesToHex:()=>pC,publicKeyHexToUint8ArrayPointPair:()=>K2,publicKeyIntToUint8ArrayPointPair:()=>V2,publicKeyIntToXY:()=>vC,publicKeyToXY:()=>mC,testHexString:()=>Lm,testUint8Array:()=>hl});s2();function pC(e){if(!hl(e))throw new TypeError("input must be a Uint8Array");return Mr(e,"base16")}i(pC,"pubKeyBytesToHex");a(pC,"pubKeyBytesToHex");function mC(e){if(!Lm(e))throw new TypeError("input must be string with characters 0-9,A-F,a-f");let t=K2(e),r=Bu.encode(t.xOctet).slice(1),n=Bu.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(mC,"publicKeyToXY");a(mC,"publicKeyToXY");function K2(e){if(!Lm(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=yr(t,"base16"),s=yr(r,"base16");return{xOctet:n,yOctet:s}}i(K2,"publicKeyHexToUint8ArrayPointPair");a(K2,"publicKeyHexToUint8ArrayPointPair");function Lm(e){let t=/^[A-Fa-f0-9]+$/i;return!!(t.exec(e)!==null&&t.test(e)&&typeof e=="string")}i(Lm,"testHexString");a(Lm,"testHexString");function hl(e){return e==null?!1:e.constructor===Uint8Array}i(hl,"testUint8Array");a(hl,"testUint8Array");function vC(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=V2(e),r=Bu.encode(t.xOctet).slice(1),n=Bu.encode(t.yOctet).slice(1);return{xm:r,ym:n}}i(vC,"publicKeyIntToXY");a(vC,"publicKeyIntToXY");function V2(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=yr(t,"base10"),s=yr(r,"base10");return{xOctet:n,yOctet:s}}i(V2,"publicKeyIntToUint8ArrayPointPair");a(V2,"publicKeyIntToUint8ArrayPointPair");function gC(e){if(!hl(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,s=(r+1n)/4n,o=BigInt(e[0]-2),c=e.subarray(1),f=BigInt(Mr(c,"base10")),h=f**3n-f*3n+n,p=Sd(h,s,r);return p%2n!==o&&(p=r-p),{x:f,y:p}}i(gC,"ECPointDecompress");a(gC,"ECPointDecompress");var bC={};Sr(bC,{ECPointDecompress:()=>yC});function yC(e){if(!hl(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,s=(r+1n)/4n,o=BigInt(e[0]-2),c=e.subarray(1),f=BigInt(Mr(c,"base10")),h=f**3n-f*3n+n,p=Sd(h,s,r);return p%2n!==o&&(p=r-p),{x:f,y:p}}i(yC,"ECPointDecompress2");a(yC,"ECPointDecompress");var wC={};Sr(wC,{ECPointDecompress:()=>_C});function _C(e){if(!hl(e))throw new TypeError("input must be a Uint8Array");let r=BigInt(2)**521n-1n,n=1093849038073734274511112390766805569936207598951683748994586394495953116150735016013708737573759623248592132296706313309438452531591012912142327488478985984n,s=(r+1n)/4n,o=BigInt(e[0]-2),c=e.subarray(1),f=BigInt(Mr(c,"base10")),h=f**3n-f*3n+n,p=Sd(h,s,r);return p%2n!==o&&(p=r-p),{x:f,y:p}}i(_C,"ECPointDecompress3");a(_C,"ECPointDecompress");function EC(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,s=G2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-256",x:s.xm,y:s.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(EC,"keyToDidDoc3");a(EC,"keyToDidDoc");function G2(e){if(!Wn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Wn.pubKeyBytesToHex(e),r=t.length/2;if(r==64)return Wn.publicKeyToXY(t);if(r==65&&t.slice(0,2)=="04"){let n=t.slice(2);return Wn.publicKeyToXY(n)}if(r==33&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=yr(t,"base16"),s=lC.ECPointDecompress(n);return Wn.publicKeyIntToXY(s)}throw new Error("Unexpected pubKeyBytes")}i(G2,"pubKeyBytesToXY");a(G2,"pubKeyBytesToXY");var AC={};Sr(AC,{keyToDidDoc:()=>SC,pubKeyBytesToXY:()=>W2});function SC(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,s=W2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-384",x:s.xm,y:s.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(SC,"keyToDidDoc4");a(SC,"keyToDidDoc");function W2(e){if(!Wn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Wn.pubKeyBytesToHex(e),r=t.length/2;if(r==96)return Wn.publicKeyToXY(t);if(r==97&&t.slice(0,2)=="04"){let n=t.slice(2);return Wn.publicKeyToXY(n)}if(r==49&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let n=yr(t,"base16"),s=bC.ECPointDecompress(n);return Wn.publicKeyIntToXY(s)}throw new Error("Unexpected pubKeyBytes")}i(W2,"pubKeyBytesToXY2");a(W2,"pubKeyBytesToXY");var xC={};Sr(xC,{keyToDidDoc:()=>TC,pubKeyBytesToXY:()=>Z2});function TC(e,t){let r=`did:key:${t}`,n=`${r}#${t}`,s=Z2(e);return{id:r,verificationMethod:[{id:n,type:"JsonWebKey2020",controller:r,publicKeyJwk:{kty:"EC",crv:"P-521",x:s.xm,y:s.ym}}],authentication:[n],assertionMethod:[n],capabilityDelegation:[n],capabilityInvocation:[n]}}i(TC,"keyToDidDoc5");a(TC,"keyToDidDoc");function Z2(e){if(!Wn.testUint8Array(e))throw new TypeError("input must be a Uint8Array");let t=Wn.pubKeyBytesToHex(e);if(132<=t.length&&t.length<=134&&(t.slice(0,2)=="03"||t.slice(0,2)=="02")){let r=yr(t,"base16"),n=wC.ECPointDecompress(r);return Wn.publicKeyIntToXY(n)}throw new Error("Unexpected pubKeyBytes")}i(Z2,"pubKeyBytesToXY3");a(Z2,"pubKeyBytesToXY");var _z="application/did+ld+json",MA="application/did+json",Ez={231:iC,237:aC,4608:uC,4609:AC,4610:xC};function Az(){return{key:async(e,t,r,n)=>{let s=n.accept||MA,o={didResolutionMetadata:{contentType:s},didDocument:null,didDocumentMetadata:{}};try{let c=ss.decode(t.id),f=TA.default.decode(c),h=c.slice(TA.default.decode.bytes),p=await Ez[f].keyToDidDoc(h,t.id);s===_z?(p["@context"]="https://w3id.org/did/v1",o.didDocument=p):s===MA?o.didDocument=p:(delete o.didResolutionMetadata.contentType,o.didResolutionMetadata.error="representationNotSupported")}catch(c){o.didResolutionMetadata.error="invalidDid",o.didResolutionMetadata.message=c.toString()}return o}}}i(Az,"getResolver");a(Az,"getResolver");var MC=rr(gm(),1),Sz=rr(B$(),1),xz="base64pad";function Dy(e){return JSON.parse((0,Sz.default)(e))}i(Dy,"toStableObject");a(Dy,"toStableObject");function CC(e){let t=new Uint8Array(e.length+2);return t[0]=237,t[1]=1,t.set(e,2),`did:key:z${Mr(t,"base58btc")}`}i(CC,"encodeDID");a(CC,"encodeDID");function Oy(e){let[t,r,n]=e.split(".");return{payload:r,signatures:[{protected:t,signature:n}]}}i(Oy,"toGeneralJWS");a(Oy,"toGeneralJWS");var CA=a(async(e,t,r,n={})=>{let s=`${t}#${t.split(":")[2]}`,o=Cx(r),c=Dy(Object.assign(n,{kid:s,alg:"EdDSA"}));return dj(typeof e=="string"?e:Dy(e),o,c)},"sign"),Tz={did_authenticate:async({did:e,secretKey:t},r)=>{let n=await CA({did:e,aud:r.aud,nonce:r.nonce,paths:r.paths,exp:Math.floor(Date.now()/1e3)+600},e,t);return Oy(n)},did_createJWS:async({did:e,secretKey:t},r)=>{if(r.did.split("#")[0]!==e)throw new po(4100,`Unknown DID: ${e}`);let s=await CA(r.payload,e,t,r.protected);return{jws:Oy(s)}},did_decryptJWE:async({secretKey:e},t)=>{let r=jx((0,MC.convertSecretKeyToX25519)(e));try{let n=await pj(t.jwe,r);return{cleartext:Mr(n,xz)}}catch(n){throw new po(-32e3,n.message)}}},Mz=i(class{constructor(e){let{secretKey:t,publicKey:r}=(0,MC.generateKeyPairFromSeed)(e),n=CC(r),s=wM(Tz);this._handle=async o=>await s({did:n,secretKey:t},o)}get isDidProvider(){return!0}async send(e){return await this._handle(e)}},"Ed25519Provider");a(Mz,"Ed25519Provider");var IC={};Sr(IC,{JsonPatchError:()=>Br,_areEquals:()=>$u,applyOperation:()=>co,applyPatch:()=>Fm,applyReducer:()=>DC,deepClone:()=>kz,getValueByPointer:()=>ed,validate:()=>Y2,validator:()=>td});var Cz=function(){var e=a(function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var o in s)s.hasOwnProperty(o)&&(n[o]=s[o])},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)}}(),Iz=Object.prototype.hasOwnProperty;function W0(e,t){return Iz.call(e,t)}i(W0,"hasOwnProperty");a(W0,"hasOwnProperty");function Z0(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 s in e)W0(e,s)&&n.push(s);return n}i(Z0,"_objectKeys");a(Z0,"_objectKeys");function Zn(e){switch(typeof e){case"object":return JSON.parse(JSON.stringify(e));case"undefined":return null;default:return e}}i(Zn,"_deepClone");a(Zn,"_deepClone");function J0(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(J0,"isInteger2");a(J0,"isInteger");function ao(e){return e.indexOf("/")===-1&&e.indexOf("~")===-1?e:e.replace(/~/g,"~0").replace(/\//g,"~1")}i(ao,"escapePathComponent");a(ao,"escapePathComponent");function J2(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}i(J2,"unescapePathComponent");a(J2,"unescapePathComponent");function Y0(e){if(e===void 0)return!0;if(e){if(Array.isArray(e)){for(var t=0,r=e.length;t<r;t++)if(Y0(e[t]))return!0}else if(typeof e=="object"){for(var n=Z0(e),s=n.length,o=0;o<s;o++)if(Y0(e[n[o]]))return!0}}return!1}i(Y0,"hasUndefined");a(Y0,"hasUndefined");function Ry(e,t){var r=[e];for(var n in t){var s=typeof t[n]=="object"?JSON.stringify(t[n],null,2):t[n];typeof s<"u"&&r.push(n+": "+s)}return r.join(`
838
838
  `)}i(Ry,"patchErrorMessageFormatter");a(Ry,"patchErrorMessageFormatter");var kC=function(e){Cz(t,e);function t(r,n,s,o,c){var f=this.constructor,h=e.call(this,Ry(r,{name:n,index:s,operation:o,tree:c}))||this;return h.name=n,h.index=s,h.operation=o,h.tree=c,Object.setPrototypeOf(h,f.prototype),h.message=Ry(r,{name:n,index:s,operation:o,tree:c}),h}return i(t,"PatchError2"),a(t,"PatchError"),t}(Error),Br=kC,kz=Zn,Ou={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=ed(r,this.path);n&&(n=Zn(n));var s=co(r,{op:"remove",path:this.from}).removed;return co(r,{op:"add",path:this.path,value:s}),{newDocument:r,removed:n}},copy:function(e,t,r){var n=ed(r,this.from);return co(r,{op:"add",path:this.path,value:Zn(n)}),{newDocument:r}},test:function(e,t,r){return{newDocument:r,test:$u(e[t],this.value)}},_get:function(e,t,r){return this.value=e[t],{newDocument:r}}},Dz={add:function(e,t,r){return J0(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:Ou.move,copy:Ou.copy,test:Ou.test,_get:Ou._get};function ed(e,t){if(t=="")return e;var r={op:"_get",path:t};return co(e,r),r.value}i(ed,"getValueByPointer");a(ed,"getValueByPointer");function co(e,t,r,n,s,o){if(r===void 0&&(r=!1),n===void 0&&(n=!0),s===void 0&&(s=!0),o===void 0&&(o=0),r&&(typeof r=="function"?r(t,0,e,t.path):td(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=ed(e,t.from),t.op==="move"&&(c.removed=e),c;if(t.op==="test"){if(c.test=$u(e,t.value),c.test===!1)throw new Br("Test operation failed","TEST_OPERATION_FAILED",o,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 Br("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",o,t,e);return c}}else{n||(e=Zn(e));var f=t.path||"",h=f.split("/"),p=e,v=1,y=h.length,b=void 0,_=void 0,T=void 0;for(typeof r=="function"?T=r:T=td;;){if(_=h[v],_&&_.indexOf("~")!=-1&&(_=J2(_)),s&&(_=="__proto__"||_=="prototype"&&v>0&&h[v-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&&b===void 0&&(p[_]===void 0?b=h.slice(0,v).join("/"):v==y-1&&(b=t.path),b!==void 0&&T(t,0,e,b)),v++,Array.isArray(p)){if(_==="-")_=p.length;else{if(r&&!J0(_))throw new Br("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",o,t,e);J0(_)&&(_=~~_)}if(v>=y){if(r&&t.op==="add"&&_>p.length)throw new Br("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",o,t,e);var c=Dz[t.op].call(t,p,_,e);if(c.test===!1)throw new Br("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return c}}else if(v>=y){var c=Ou[t.op].call(t,p,_,e);if(c.test===!1)throw new Br("Test operation failed","TEST_OPERATION_FAILED",o,t,e);return c}if(p=p[_],r&&v<y&&(!p||typeof p!="object"))throw new Br("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",o,t,e)}}}i(co,"applyOperation");a(co,"applyOperation");function Fm(e,t,r,n,s){if(n===void 0&&(n=!0),s===void 0&&(s=!0),r&&!Array.isArray(t))throw new Br("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");n||(e=Zn(e));for(var o=new Array(t.length),c=0,f=t.length;c<f;c++)o[c]=co(e,t[c],r,!0,s,c),e=o[c].newDocument;return o.newDocument=e,o}i(Fm,"applyPatch");a(Fm,"applyPatch");function DC(e,t,r){var n=co(e,t);if(n.test===!1)throw new Br("Test operation failed","TEST_OPERATION_FAILED",r,t,e);return n.newDocument}i(DC,"applyReducer");a(DC,"applyReducer");function td(e,t,r,n){if(typeof e!="object"||e===null||Array.isArray(e))throw new Br("Operation is not an object","OPERATION_NOT_AN_OBJECT",t,e,r);if(Ou[e.op]){if(typeof e.path!="string")throw new Br("Operation `path` property is not a string","OPERATION_PATH_INVALID",t,e,r);if(e.path.indexOf("/")!==0&&e.path.length>0)throw new Br('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 Br("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 Br("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")&&Y0(e.value))throw new Br("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 s=e.path.split("/").length,o=n.split("/").length;if(s!==o+1&&s!==o)throw new Br("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 Br("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},f=Y2([c],r);if(f&&f.name==="OPERATION_PATH_UNRESOLVABLE")throw new Br("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",t,e,r)}}}else throw new Br("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",t,e,r)}i(td,"validator");a(td,"validator");function Y2(e,t,r){try{if(!Array.isArray(e))throw new Br("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(t)Fm(Zn(t),Zn(e),r||!0);else{r=r||td;for(var n=0;n<e.length;n++)r(e[n],n,t,void 0)}}catch(s){if(s instanceof Br)return s;throw s}}i(Y2,"validate5");a(Y2,"validate");function $u(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),s,o,c;if(r&&n){if(o=e.length,o!=t.length)return!1;for(s=o;s--!==0;)if(!$u(e[s],t[s]))return!1;return!0}if(r!=n)return!1;var f=Object.keys(e);if(o=f.length,o!==Object.keys(t).length)return!1;for(s=o;s--!==0;)if(!t.hasOwnProperty(f[s]))return!1;for(s=o;s--!==0;)if(c=f[s],!$u(e[c],t[c]))return!1;return!0}return e!==e&&t!==t}i($u,"_areEquals");a($u,"_areEquals");var OC={};Sr(OC,{compare:()=>FC,generate:()=>X0,observe:()=>LC,unobserve:()=>BC});var X2=new WeakMap,Oz=function(){function e(t){this.observers=new Map,this.obj=t}return i(e,"Mirror2"),a(e,"Mirror"),e}(),Rz=function(){function e(t,r){this.callback=t,this.observer=r}return i(e,"ObserverInfo2"),a(e,"ObserverInfo"),e}();function RC(e){return X2.get(e)}i(RC,"getMirror");a(RC,"getMirror");function NC(e,t){return e.observers.get(t)}i(NC,"getObserverFromMirror");a(NC,"getObserverFromMirror");function PC(e,t){e.observers.delete(t.callback)}i(PC,"removeObserverFromMirror");a(PC,"removeObserverFromMirror");function BC(e,t){t.unobserve()}i(BC,"unobserve");a(BC,"unobserve");function LC(e,t){var r=[],n,s=RC(e);if(!s)s=new Oz(e),X2.set(e,s);else{var o=NC(s,t);n=o&&o.observer}if(n)return n;if(n={},s.value=Zn(e),t){n.callback=t,n.next=null;var c=a(function(){X0(n)},"dirtyCheck"),f=a(function(){clearTimeout(n.next),n.next=setTimeout(c)},"fastCheck");typeof window<"u"&&(window.addEventListener("mouseup",f),window.addEventListener("keyup",f),window.addEventListener("mousedown",f),window.addEventListener("keydown",f),window.addEventListener("change",f))}return n.patches=r,n.object=e,n.unobserve=function(){X0(n),clearTimeout(n.next),PC(s,n),typeof window<"u"&&(window.removeEventListener("mouseup",f),window.removeEventListener("keyup",f),window.removeEventListener("mousedown",f),window.removeEventListener("keydown",f),window.removeEventListener("change",f))},s.observers.set(t,new Rz(t,n)),n}i(LC,"observe");a(LC,"observe");function X0(e,t){t===void 0&&(t=!1);var r=X2.get(e.object);Um(r.value,e.object,e.patches,"",t),e.patches.length&&Fm(r.value,e.patches);var n=e.patches;return n.length>0&&(e.patches=[],e.callback&&e.callback(n)),n}i(X0,"generate2");a(X0,"generate");function Um(e,t,r,n,s){if(t!==e){typeof t.toJSON=="function"&&(t=t.toJSON());for(var o=Z0(t),c=Z0(e),f=!1,h=!1,p=c.length-1;p>=0;p--){var v=c[p],y=e[v];if(W0(t,v)&&!(t[v]===void 0&&y!==void 0&&Array.isArray(t)===!1)){var b=t[v];typeof y=="object"&&y!=null&&typeof b=="object"&&b!=null&&Array.isArray(y)===Array.isArray(b)?Um(y,b,r,n+"/"+ao(v),s):y!==b&&(f=!0,s&&r.push({op:"test",path:n+"/"+ao(v),value:Zn(y)}),r.push({op:"replace",path:n+"/"+ao(v),value:Zn(b)}))}else Array.isArray(e)===Array.isArray(t)?(s&&r.push({op:"test",path:n+"/"+ao(v),value:Zn(y)}),r.push({op:"remove",path:n+"/"+ao(v)}),h=!0):(s&&r.push({op:"test",path:n,value:e}),r.push({op:"replace",path:n,value:t}),f=!0)}if(!(!h&&o.length==c.length))for(var p=0;p<o.length;p++){var v=o[p];!W0(e,v)&&t[v]!==void 0&&r.push({op:"add",path:n+"/"+ao(v),value:Zn(t[v])})}}}i(Um,"_generate");a(Um,"_generate");function FC(e,t,r){r===void 0&&(r=!1);var n=[];return Um(e,t,n,"",r),n}i(FC,"compare3");a(FC,"compare");var UC=Object.assign({},IC,OC,{JsonPatchError:kC,deepClone:Zn,escapePathComponent:ao,unescapePathComponent:J2}),Nz=rr(bd(),1),Pz=rr(nl(),1),Yn;(function(e){e[e.PREFER_CACHE=0]="PREFER_CACHE",e[e.SYNC_ALWAYS=1]="SYNC_ALWAYS",e[e.NEVER_SYNC=2]="NEVER_SYNC"})(Yn||(Yn={}));var IA=rr(bd(),1);js();md();var $C={tile:0,"caip10-link":1,model:2,MID:3,UNLOADABLE:4};function jC(e){let t=$C[e];if(typeof t<"u")return t;throw new Error(`No stream type registered for name ${e}`)}i(jC,"codeByName");a(jC,"codeByName");function zC(e){let t=Object.entries($C).find(([,r])=>r===e);if(t)return t[0];throw new Error(`No stream type registered for index ${e}`)}i(zC,"nameByCode");a(zC,"nameByCode");var _a=i(class{},"StreamType");a(_a,"StreamType");_a.nameByCode=zC;_a.codeByName=jC;var kA=rr(ym(),1);function Ki(e){let t,r,n;return typeof e=="object"?(t=e.hashFunction,r=e.expiring,n=e.tags):t=e,(s,o,c)=>{if(c.value!=null)c.value=Ny(c.value,t,r,n);else if(c.get!=null)c.get=Ny(c.get,t,r,n);else throw"Only put a Memoize() decorator on a method or get accessor."}}i(Ki,"Memoize");a(Ki,"Memoize");var Jb=new Map;function Ny(e,t,r=0,n){let s=Symbol("__memoized_map__");return function(...o){let c;this.hasOwnProperty(s)||Object.defineProperty(this,s,{configurable:!1,enumerable:!1,writable:!1,value:new Map});let f=this[s];if(Array.isArray(n))for(let h of n)Jb.has(h)?Jb.get(h).push(f):Jb.set(h,[f]);if(t||o.length>0||r>0){let h;t===!0?h=o.map(y=>y.toString()).join("!"):t?h=t.apply(this,o):h=o[0];let p=`${h}__timestamp`,v=!1;if(r>0)if(!f.has(p))v=!0;else{let y=f.get(p);v=Date.now()-y>r}f.has(h)&&!v?c=f.get(h):(c=e.apply(this,o),f.set(h,c),r>0&&f.set(p,Date.now()))}else{let h=this;f.has(h)?c=f.get(h):(c=e.apply(this,o),f.set(h,c))}return c}}i(Ny,"getNewFunction");a(Ny,"getNewFunction");var Q2=206;js();md();fm();var DA=rr(ym(),1);function xd(e){try{return e()}catch(t){return t}}i(xd,"tryCatch");a(xd,"tryCatch");js();var OA=rr(ym(),1);el();function pc(e){let t=OA.default.decode(e),r=OA.default.decode.bytes,n=e.subarray(r);return[t,n,r]}i(pc,"readVarint");a(pc,"readVarint");function HC(e){return e===0||e===1}i(HC,"isCidVersion");a(HC,"isCidVersion");function Py(e){let[t,r]=pc(e);if(!HC(t))throw new Error(`Unknown CID version ${t}`);let[n,s]=pc(r),[,o,c]=pc(s),[f,,h]=pc(o),p=s.subarray(0,c+h+f),v=s.subarray(c+h+f);return[jt.create(t,n,o2(p)),v]}i(Py,"readCid");a(Py,"readCid");js();md();function Td(e,t="StreamRef"){let[r,n]=pc(e);if(r!==Q2)throw new Error(`Invalid ${t}, does not include streamid codec`);let[s,o]=pc(n),c=Py(o),[f,h]=c;if(h.length===0)return{kind:"stream-id",type:s,genesis:f};if(h.length===1&&h[0]===0)return{kind:"commit-id",type:s,genesis:f,commit:null};{let[p]=Py(h);return{kind:"commit-id",type:s,genesis:f,commit:p}}}i(Td,"fromBytes");a(Td,"fromBytes");var Bz=/(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;function $m(e,t="StreamRef"){let r=Bz.exec(e)||[],n=r[2];if(!n)throw new Error(`Malformed ${t} string: ${e}`);let s=wo.decode(n),o=Td(s),c=r[4];return c?{kind:"commit-id",type:o.type,genesis:o.genesis,commit:e6(o.genesis,c)}:o}i($m,"fromString4");a($m,"fromString");function qC(e){try{return typeof e=="string"?jt.parse(e):jt.asCID(e)}catch{return null}}i(qC,"parseCID");a(qC,"parseCID");function e6(e,t=null){if(!t||t==="0")return null;let r=qC(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(e6,"parseCommit");a(e6,"parseCommit");var Md=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate"),zi=i(function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},"__metadata"),KC=i(class extends Error{constructor(e){super(`Invalid StreamID bytes ${wo.encode(e)}: contains commit`)}},"InvalidStreamIDBytesError");a(KC,"InvalidStreamIDBytesError");var VC=i(class extends Error{constructor(e){super(`Invalid StreamID string ${e}: contains commit`)}},"InvalidStreamIDStringError");a(VC,"InvalidStreamIDStringError");function t6(e){let t=Td(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new KC(e)}i(t6,"fromBytes2");a(t6,"fromBytes");function GC(e){return xd(()=>t6(e))}i(GC,"fromBytesNoThrow");a(GC,"fromBytesNoThrow");function r6(e){let t=$m(e,"StreamID");if(t.kind==="stream-id")return new Xt(t.type,t.genesis);throw new VC(e)}i(r6,"fromString5");a(r6,"fromString");function WC(e){return xd(()=>r6(e))}i(WC,"fromStringNoThrow");a(WC,"fromStringNoThrow");var RA=Symbol.for("@ceramicnetwork/streamid/StreamID"),Xt=i(class{constructor(e,t){if(this._tag=RA,!(e||e===0))throw new Error("StreamID constructor: type required");if(!t)throw new Error("StreamID constructor: cid required");this._type=typeof e=="string"?_a.codeByName(e):e,this._cid=typeof t=="string"?jt.parse(t):t}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===RA}static async fromGenesis(e,t){let r=await Em({value:t,codec:al,hasher:tl});return new Xt(e,r.cid)}get type(){return this._type}get typeName(){return _a.nameByCode(this._type)}get cid(){return this._cid}get bytes(){let e=DA.default.encode(Q2),t=DA.default.encode(this.type);return lo([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 wo.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=t6;Xt.fromBytesNoThrow=GC;Xt.fromString=r6;Xt.fromStringNoThrow=WC;Md([Ki(),zi("design:type",String),zi("design:paramtypes",[])],Xt.prototype,"typeName",null);Md([Ki(),zi("design:type",Uint8Array),zi("design:paramtypes",[])],Xt.prototype,"bytes",null);Md([Ki(),zi("design:type",Xt),zi("design:paramtypes",[])],Xt.prototype,"baseID",null);Md([Ki(),zi("design:type",Function),zi("design:paramtypes",[]),zi("design:returntype",String)],Xt.prototype,"toString",null);Md([Ki(),zi("design:type",Function),zi("design:paramtypes",[]),zi("design:returntype",String)],Xt.prototype,"toUrl",null);var pl=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate2"),Jn=i(function(e,t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(e,t)},"__metadata2"),Yb=i(function(e,t,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!s:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(e,r):s?s.value=r:t.set(e,r),r},"__classPrivateFieldSet"),ma=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"),Iu,fc,Uf,ZC=i(class extends Error{constructor(e){super(`Error while parsing CommitID from bytes ${wo.encode(e)}: no commit information provided`)}},"InvalidCommitIDBytesError");a(ZC,"InvalidCommitIDBytesError");var JC=i(class extends Error{constructor(e){super(`Error while parsing CommitID from string ${e}: no commit information provided`)}},"InvalidCommitIDStringError");a(JC,"InvalidCommitIDStringError");function n6(e){let t=Td(e,"CommitID");if(t.kind==="commit-id")return new Er(t.type,t.genesis,t.commit);throw new ZC(e)}i(n6,"fromBytes3");a(n6,"fromBytes");function YC(e){return xd(()=>n6(e))}i(YC,"fromBytesNoThrow2");a(YC,"fromBytesNoThrow");function i6(e){let t=$m(e,"CommitID");if(t.kind==="commit-id")return new Er(t.type,t.genesis,t.commit);throw new JC(e)}i(i6,"fromString6");a(i6,"fromString");function XC(e){return xd(()=>i6(e))}i(XC,"fromStringNoThrow2");a(XC,"fromStringNoThrow");var NA=Symbol.for("@ceramicnetwork/streamid/CommitID");function QC(e,t){return new Er(e.type,e.cid,t)}i(QC,"make");a(QC,"make");var Er=i(class{constructor(e,t,r=null){if(this._tag=NA,Iu.set(this,void 0),fc.set(this,void 0),Uf.set(this,void 0),!e&&e!==0)throw new Error("constructor: type required");if(!t)throw new Error("constructor: cid required");Yb(this,Iu,typeof e=="string"?_a.codeByName(e):e,"f"),Yb(this,fc,typeof t=="string"?jt.parse(t):t,"f"),Yb(this,Uf,e6(ma(this,fc,"f"),r),"f")}static isInstance(e){return typeof e=="object"&&"_tag"in e&&e._tag===NA}get baseID(){return new Xt(ma(this,Iu,"f"),ma(this,fc,"f"))}get type(){return ma(this,Iu,"f")}get typeName(){return _a.nameByCode(ma(this,Iu,"f"))}get cid(){return ma(this,fc,"f")}get commit(){return ma(this,Uf,"f")||ma(this,fc,"f")}get bytes(){let e=kA.default.encode(Q2),t=kA.default.encode(this.type),r=ma(this,Uf,"f")?.bytes||new Uint8Array([0]);return lo([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 wo.encode(this.bytes)}toUrl(){return`ceramic://${this.toString()}`}[(Iu=new WeakMap,fc=new WeakMap,Uf=new WeakMap,Symbol.for("nodejs.util.inspect.custom"))](){return`CommitID(${this.toString()})`}[Symbol.toPrimitive](){return this.toString()}},"CommitID");a(Er,"CommitID");Er.fromBytes=n6;Er.fromBytesNoThrow=YC;Er.fromString=i6;Er.fromStringNoThrow=XC;Er.make=QC;pl([Ki(),Jn("design:type",Xt),Jn("design:paramtypes",[])],Er.prototype,"baseID",null);pl([Ki(),Jn("design:type",String),Jn("design:paramtypes",[])],Er.prototype,"typeName",null);pl([Ki(),Jn("design:type",jt),Jn("design:paramtypes",[])],Er.prototype,"commit",null);pl([Ki(),Jn("design:type",Uint8Array),Jn("design:paramtypes",[])],Er.prototype,"bytes",null);pl([Ki(),Jn("design:type",Function),Jn("design:paramtypes",[]),Jn("design:returntype",String)],Er.prototype,"toString",null);pl([Ki(),Jn("design:type",Function),Jn("design:paramtypes",[]),Jn("design:returntype",String)],Er.prototype,"toUrl",null);md();var mo;(function(e){function t(s){let o=Td(s);switch(o.kind){case"commit-id":return new Er(o.type,o.genesis,o.commit);case"stream-id":return new Xt(o.type,o.genesis);default:throw new Error(`Malformed StreamRef bytes: ${wo.encode(s)}`)}}i(t,"fromBytes4"),a(t,"fromBytes"),e.fromBytes=t;function r(s){let o=$m(s);switch(o.kind){case"commit-id":return new Er(o.type,o.genesis,o.commit);case"stream-id":return new Xt(o.type,o.genesis);default:throw new Error(`Malformed StreamRef string: ${s}`)}}i(r,"fromString7"),a(r,"fromString"),e.fromString=r;function n(s){if(Xt.isInstance(s)||Er.isInstance(s))return s;if(s instanceof Uint8Array)return t(s);if(typeof s=="string")return r(s);throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(s)}`)}i(n,"from4"),a(n,"from"),e.from=n})(mo||(mo={}));var By=a(function(e,t){return By=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},By(e,t)},"extendStatics");function Ks(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");By(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(Ks,"__extends2");a(Ks,"__extends");function eI(e,t,r,n){function s(o){return o instanceof r?o:new r(function(c){c(o)})}return i(s,"adopt"),a(s,"adopt"),new(r||(r=Promise))(function(o,c){function f(v){try{p(n.next(v))}catch(y){c(y)}}i(f,"fulfilled"),a(f,"fulfilled");function h(v){try{p(n.throw(v))}catch(y){c(y)}}i(h,"rejected"),a(h,"rejected");function p(v){v.done?o(v.value):s(v.value).then(f,h)}i(p,"step"),a(p,"step"),p((n=n.apply(e,t||[])).next())})}i(eI,"__awaiter");a(eI,"__awaiter");function s6(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,s,o,c;return c={next:f(0),throw:f(1),return:f(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function f(p){return function(v){return h([p,v])}}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,s&&(o=p[0]&2?s.return:p[0]?s.throw||((o=s.return)&&o.call(s),0):s.next)&&!(o=o.call(s,p[1])).done)return o;switch(s=0,o&&(p=[p[0]&2,o.value]),p[0]){case 0:case 1:o=p;break;case 4:return r.label++,{value:p[1],done:!1};case 5:r.label++,s=p[1],p=[0];continue;case 7:p=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]<o[3])){r.label=p[1];break}if(p[0]===6&&r.label<o[1]){r.label=o[1],o=p;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(p);break}o[2]&&r.ops.pop(),r.trys.pop();continue}p=t.call(e,r)}catch(v){p=[6,v],s=0}finally{n=o=0}if(p[0]&5)throw p[1];return{value:p[0]?p[1]:void 0,done:!0}}}i(s6,"__generator");a(s6,"__generator");function _c(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(_c,"__values");a(_c,"__values");function Ea(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),s,o=[],c;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)o.push(s.value)}catch(f){c={error:f}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(c)throw c.error}}return o}i(Ea,"__read");a(Ea,"__read");function vo(e,t,r){if(r||arguments.length===2)for(var n=0,s=t.length,o;n<s;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))}i(vo,"__spreadArray");a(vo,"__spreadArray");function yc(e){return this instanceof yc?(this.v=e,this):new yc(e)}i(yc,"__await");a(yc,"__await");function tI(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),s,o=[];return s={},c("next"),c("throw"),c("return"),s[Symbol.asyncIterator]=function(){return this},s;function c(b){n[b]&&(s[b]=function(_){return new Promise(function(T,O){o.push([b,_,T,O])>1||f(b,_)})})}function f(b,_){try{h(n[b](_))}catch(T){y(o[0][3],T)}}function h(b){b.value instanceof yc?Promise.resolve(b.value.v).then(p,v):y(o[0][2],b)}function p(b){f("next",b)}function v(b){f("throw",b)}function y(b,_){b(_),o.shift(),o.length&&f(o[0][0],o[0][1])}}i(tI,"__asyncGenerator");a(tI,"__asyncGenerator");function rI(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 _c=="function"?_c(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(c){return new Promise(function(f,h){c=e[o](c),s(f,h,c.done,c.value)})}}function s(o,c,f,h){Promise.resolve(h).then(function(p){o({value:p,done:f})},c)}}i(rI,"__asyncValues");a(rI,"__asyncValues");function Ar(e){return typeof e=="function"}i(Ar,"isFunction");a(Ar,"isFunction");function jm(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(jm,"createErrorClass");a(jm,"createErrorClass");var Xb=jm(function(e){return a(i(function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription:
839
839
  `+r.map(function(n,s){return s+1+") "+n.toString()}).join(`
840
- `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl"),"UnsubscriptionErrorImpl")});function rd(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(rd,"arrRemove");a(rd,"arrRemove");var Cd=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,s,o;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var f=_c(c),h=f.next();!h.done;h=f.next()){var p=h.value;p.remove(this)}}catch(O){t={error:O}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}else c.remove(this);var v=this.initialTeardown;if(Ar(v))try{v()}catch(O){o=O instanceof Xb?O.errors:[O]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=_c(y),_=b.next();!_.done;_=b.next()){var T=_.value;try{Ly(T)}catch(O){o=o??[],O instanceof Xb?o=vo(vo([],Ea(o)),Ea(O.errors)):o.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(s=b.return)&&s.call(b)}finally{if(n)throw n.error}}}if(o)throw new Xb(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Ly(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)&&rd(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&rd(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),nI=Cd.EMPTY;function a6(e){return e instanceof Cd||e&&"closed"in e&&Ar(e.remove)&&Ar(e.add)&&Ar(e.unsubscribe)}i(a6,"isSubscription");a(a6,"isSubscription");function Ly(e){Ar(e)?e():e.unsubscribe()}i(Ly,"execFinalizer");a(Ly,"execFinalizer");var Pc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Q0={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var s=Q0.delegate;return s?.setTimeout?s.setTimeout.apply(s,vo([e,t],Ea(r))):setTimeout.apply(void 0,vo([e,t],Ea(r)))},clearTimeout:function(e){var t=Q0.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function o6(e){Q0.setTimeout(function(){var t=Pc.onUnhandledError;if(t)t(e);else throw e})}i(o6,"reportUnhandledError");a(o6,"reportUnhandledError");function Fy(){}i(Fy,"noop");a(Fy,"noop");var Lz=function(){return zm("C",void 0,void 0)}();function iI(e){return zm("E",void 0,e)}i(iI,"errorNotification");a(iI,"errorNotification");function sI(e){return zm("N",e,void 0)}i(sI,"nextNotification");a(sI,"nextNotification");function zm(e,t,r){return{kind:e,value:t,error:r}}i(zm,"createNotification");a(zm,"createNotification");var mc=null;function Vf(e){if(Pc.useDeprecatedSynchronousErrorHandling){var t=!mc;if(t&&(mc={errorThrown:!1,error:null}),e(),t){var r=mc,n=r.errorThrown,s=r.error;if(mc=null,n)throw s}}else e()}i(Vf,"errorContext");a(Vf,"errorContext");function aI(e){Pc.useDeprecatedSynchronousErrorHandling&&mc&&(mc.errorThrown=!0,mc.error=e)}i(aI,"captureError");a(aI,"captureError");var c6=function(e){Ks(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,a6(r)&&r.add(n)):n.destination=$z,n}return i(t,"Subscriber2"),a(t,"Subscriber"),t.create=function(r,n,s){return new Uy(r,n,s)},t.prototype.next=function(r){this.isStopped?x0(sI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?x0(iI(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?x0(Lz,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}(Cd),Fz=Function.prototype.bind;function S0(e,t){return Fz.call(e,t)}i(S0,"bind");a(S0,"bind");var Uz=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){Hf(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Hf(n)}else Hf(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Hf(r)}},e}(),Uy=function(e){Ks(t,e);function t(r,n,s){var o=e.call(this)||this,c;if(Ar(r)||!r)c={next:r??void 0,error:n??void 0,complete:s??void 0};else{var f;o&&Pc.useDeprecatedNextContext?(f=Object.create(r),f.unsubscribe=function(){return o.unsubscribe()},c={next:r.next&&S0(r.next,f),error:r.error&&S0(r.error,f),complete:r.complete&&S0(r.complete,f)}):c=r}return o.destination=new Uz(c),o}return i(t,"SafeSubscriber2"),a(t,"SafeSubscriber"),t}(c6);function Hf(e){Pc.useDeprecatedSynchronousErrorHandling?aI(e):o6(e)}i(Hf,"handleUnhandledError");a(Hf,"handleUnhandledError");function oI(e){throw e}i(oI,"defaultErrorHandler");a(oI,"defaultErrorHandler");function x0(e,t){var r=Pc.onStoppedNotification;r&&Q0.setTimeout(function(){return r(e,t)})}i(x0,"handleStoppedNotification");a(x0,"handleStoppedNotification");var $z={closed:!0,next:Fy,error:oI,complete:Fy},u6=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Hm(e){return e}i(Hm,"identity3");a(Hm,"identity");function cI(e){return e.length===0?Hm:e.length===1?e[0]:a(i(function(r){return e.reduce(function(n,s){return s(n)},r)},"piped"),"piped")}i(cI,"pipeFromArray");a(cI,"pipeFromArray");var ln=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 s=this,o=lI(t)?t:new Uy(t,r,n);return Vf(function(){var c=s,f=c.operator,h=c.source;o.add(f?f.call(o,h):h?s._subscribe(o):s._trySubscribe(o))}),o},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=$y(r),new r(function(s,o){var c=new Uy({next:function(f){try{t(f)}catch(h){o(h),c.unsubscribe()}},error:o,complete:s});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[u6]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return cI(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=$y(t),new t(function(n,s){var o;r.subscribe(function(c){return o=c},function(c){return s(c)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function $y(e){var t;return(t=e??Pc.Promise)!==null&&t!==void 0?t:Promise}i($y,"getPromiseCtor");a($y,"getPromiseCtor");function uI(e){return e&&Ar(e.next)&&Ar(e.error)&&Ar(e.complete)}i(uI,"isObserver");a(uI,"isObserver");function lI(e){return e&&e instanceof c6||uI(e)&&a6(e)}i(lI,"isSubscriber");a(lI,"isSubscriber");function fI(e){return Ar(e?.lift)}i(fI,"hasLift");a(fI,"hasLift");function Vs(e){return function(t){if(fI(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(Vs,"operate");a(Vs,"operate");function ds(e,t,r,n,s){return new jz(e,t,r,n,s)}i(ds,"createOperatorSubscriber");a(ds,"createOperatorSubscriber");var jz=function(e){Ks(t,e);function t(r,n,s,o,c,f){var h=e.call(this,r)||this;return h.onFinalize=c,h.shouldUnsubscribe=f,h._next=n?function(p){try{n(p)}catch(v){r.error(v)}}:e.prototype._next,h._error=o?function(p){try{o(p)}catch(v){r.error(v)}finally{this.unsubscribe()}}:e.prototype._error,h._complete=s?function(){try{s()}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}(c6),zz=jm(function(e){return a(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),dI=function(e){Ks(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 PA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new zz},t.prototype.next=function(r){var n=this;Vf(function(){var s,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var c=_c(n.currentObservers),f=c.next();!f.done;f=c.next()){var h=f.value;h.next(r)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(s)throw s.error}}}})},t.prototype.error=function(r){var n=this;Vf(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var s=n.observers;s.length;)s.shift().error(r)}})},t.prototype.complete=function(){var r=this;Vf(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,s=this,o=s.hasError,c=s.isStopped,f=s.observers;return o||c?nI:(this.currentObservers=null,f.push(r),new Cd(function(){n.currentObservers=null,rd(f,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,s=n.hasError,o=n.thrownError,c=n.isStopped;s?r.error(o):c&&r.complete()},t.prototype.asObservable=function(){var r=new ln;return r.source=this,r},t.create=function(r,n){return new PA(r,n)},t}(ln),PA=function(e){Ks(t,e);function t(r,n){var s=e.call(this)||this;return s.destination=r,s.source=n,s}return i(t,"AnonymousSubject2"),a(t,"AnonymousSubject"),t.prototype.next=function(r){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,r)},t.prototype.error=function(r){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.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,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&s!==void 0?s:nI},t}(dI),Hz=function(e){Ks(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,s=r.thrownError,o=r._value;if(n)throw s;return this._throwIfClosed(),o},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(dI),hI={now:function(){return(hI.delegate||Date).now()},delegate:void 0},qz=function(e){Ks(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}(Cd),em={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var s=em.delegate;return s?.setInterval?s.setInterval.apply(s,vo([e,t],Ea(r))):setInterval.apply(void 0,vo([e,t],Ea(r)))},clearInterval:function(e){var t=em.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},Kz=function(e){Ks(t,e);function t(r,n){var s=e.call(this,r,n)||this;return s.scheduler=r,s.work=n,s.pending=!1,s}return i(t,"AsyncAction2"),a(t,"AsyncAction"),t.prototype.schedule=function(r,n){var s;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var o=this.id,c=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(c,o,n)),this.pending=!0,this.delay=n,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,s){return s===void 0&&(s=0),em.setInterval(r.flush.bind(r,this),s)},t.prototype.recycleAsyncId=function(r,n,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return n;n!=null&&em.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(r,n);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var s=!1,o;try{this.work(r)}catch(c){s=!0,o=c||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),o},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,s=r.scheduler,o=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,rd(o,this),n!=null&&(this.id=this.recycleAsyncId(s,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(qz),BA=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=hI.now,e}(),Vz=function(e){Ks(t,e);function t(r,n){n===void 0&&(n=BA.now);var s=e.call(this,r,n)||this;return s.actions=[],s._active=!1,s}return i(t,"AsyncScheduler2"),a(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var s;this._active=!0;do if(s=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,s){for(;r=n.shift();)r.unsubscribe();throw s}},t}(BA),Gz=new Vz(Kz),Wz=Gz,pI=new ln(function(e){return e.complete()});function l6(e){return e&&Ar(e.schedule)}i(l6,"isScheduler");a(l6,"isScheduler");function f6(e){return e[e.length-1]}i(f6,"last");a(f6,"last");function mI(e){return l6(f6(e))?e.pop():void 0}i(mI,"popScheduler");a(mI,"popScheduler");function vI(e,t){return typeof f6(e)=="number"?e.pop():t}i(vI,"popNumber");a(vI,"popNumber");var d6=a(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function h6(e){return Ar(e?.then)}i(h6,"isPromise");a(h6,"isPromise");function p6(e){return Ar(e[u6])}i(p6,"isInteropObservable");a(p6,"isInteropObservable");function m6(e){return Symbol.asyncIterator&&Ar(e?.[Symbol.asyncIterator])}i(m6,"isAsyncIterable");a(m6,"isAsyncIterable");function v6(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(v6,"createInvalidObservableTypeError");a(v6,"createInvalidObservableTypeError");function gI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(gI,"getSymbolIterator");a(gI,"getSymbolIterator");var bI=gI();function g6(e){return Ar(e?.[bI])}i(g6,"isIterable");a(g6,"isIterable");function b6(e){return tI(this,arguments,a(i(function(){var r,n,s,o;return s6(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,yc(r.read())];case 3:return n=c.sent(),s=n.value,o=n.done,o?[4,yc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,yc(s)];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(b6,"readableStreamLikeToAsyncGenerator");a(b6,"readableStreamLikeToAsyncGenerator");function y6(e){return Ar(e?.getReader)}i(y6,"isReadableStreamLike");a(y6,"isReadableStreamLike");function Ma(e){if(e instanceof ln)return e;if(e!=null){if(p6(e))return yI(e);if(d6(e))return wI(e);if(h6(e))return _I(e);if(m6(e))return w6(e);if(g6(e))return EI(e);if(y6(e))return AI(e)}throw v6(e)}i(Ma,"innerFrom");a(Ma,"innerFrom");function yI(e){return new ln(function(t){var r=e[u6]();if(Ar(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(yI,"fromInteropObservable");a(yI,"fromInteropObservable");function wI(e){return new ln(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(wI,"fromArrayLike");a(wI,"fromArrayLike");function _I(e){return new ln(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,o6)})}i(_I,"fromPromise");a(_I,"fromPromise");function EI(e){return new ln(function(t){var r,n;try{for(var s=_c(e),o=s.next();!o.done;o=s.next()){var c=o.value;if(t.next(c),t.closed)return}}catch(f){r={error:f}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}t.complete()})}i(EI,"fromIterable");a(EI,"fromIterable");function w6(e){return new ln(function(t){SI(e,t).catch(function(r){return t.error(r)})})}i(w6,"fromAsyncIterable");a(w6,"fromAsyncIterable");function AI(e){return w6(b6(e))}i(AI,"fromReadableStreamLike");a(AI,"fromReadableStreamLike");function SI(e,t){var r,n,s,o;return eI(this,void 0,void 0,function(){var c,f;return s6(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),r=rI(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 f=h.sent(),s={error:f},[3,11];case 6:return h.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:h.sent(),h.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(SI,"process2");a(SI,"process");function ya(e,t,r,n,s){n===void 0&&(n=0),s===void 0&&(s=!1);var o=t.schedule(function(){r(),s?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!s)return o}i(ya,"executeSchedule");a(ya,"executeSchedule");function _6(e,t){return t===void 0&&(t=0),Vs(function(r,n){r.subscribe(ds(n,function(s){return ya(n,e,function(){return n.next(s)},t)},function(){return ya(n,e,function(){return n.complete()},t)},function(s){return ya(n,e,function(){return n.error(s)},t)}))})}i(_6,"observeOn");a(_6,"observeOn");function E6(e,t){return t===void 0&&(t=0),Vs(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(E6,"subscribeOn");a(E6,"subscribeOn");function xI(e,t){return Ma(e).pipe(E6(t),_6(t))}i(xI,"scheduleObservable");a(xI,"scheduleObservable");function TI(e,t){return Ma(e).pipe(E6(t),_6(t))}i(TI,"schedulePromise");a(TI,"schedulePromise");function MI(e,t){return new ln(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}i(MI,"scheduleArray");a(MI,"scheduleArray");function CI(e,t){return new ln(function(r){var n;return ya(r,t,function(){n=e[bI](),ya(r,t,function(){var s,o,c;try{s=n.next(),o=s.value,c=s.done}catch(f){r.error(f);return}c?r.complete():r.next(o)},0,!0)}),function(){return Ar(n?.return)&&n.return()}})}i(CI,"scheduleIterable");a(CI,"scheduleIterable");function A6(e,t){if(!e)throw new Error("Iterable cannot be null");return new ln(function(r){ya(r,t,function(){var n=e[Symbol.asyncIterator]();ya(r,t,function(){n.next().then(function(s){s.done?r.complete():r.next(s.value)})},0,!0)})})}i(A6,"scheduleAsyncIterable");a(A6,"scheduleAsyncIterable");function II(e,t){return A6(b6(e),t)}i(II,"scheduleReadableStreamLike");a(II,"scheduleReadableStreamLike");function kI(e,t){if(e!=null){if(p6(e))return xI(e,t);if(d6(e))return MI(e,t);if(h6(e))return TI(e,t);if(m6(e))return A6(e,t);if(g6(e))return CI(e,t);if(y6(e))return II(e,t)}throw v6(e)}i(kI,"scheduled");a(kI,"scheduled");function DI(e,t){return t?kI(e,t):Ma(e)}i(DI,"from3");a(DI,"from");var OI=jm(function(e){return a(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function RI(e){return e instanceof Date&&!isNaN(e)}i(RI,"isValidDate");a(RI,"isValidDate");function S6(e,t){return Vs(function(r,n){var s=0;r.subscribe(ds(n,function(o){n.next(e.call(t,o,s++))}))})}i(S6,"map");a(S6,"map");var Zz=Array.isArray;function NI(e,t){return Zz(t)?e.apply(void 0,vo([],Ea(t))):e(t)}i(NI,"callOrApply");a(NI,"callOrApply");function PI(e){return S6(function(t){return NI(e,t)})}i(PI,"mapOneOrManyArgs");a(PI,"mapOneOrManyArgs");function BI(e,t,r,n,s,o,c,f){var h=[],p=0,v=0,y=!1,b=a(function(){y&&!h.length&&!p&&t.complete()},"checkComplete"),_=a(function(O){return p<n?T(O):h.push(O)},"outerNext"),T=a(function(O){o&&t.next(O),p++;var R=!1;Ma(r(O,v++)).subscribe(ds(t,function(P){s?.(P),o?_(P):t.next(P)},function(){R=!0},void 0,function(){if(R)try{p--;for(var P=a(function(){var K=h.shift();c?ya(t,c,function(){return T(K)}):T(K)},"_loop_1");h.length&&p<n;)P();b()}catch(K){t.error(K)}}))},"doInnerSub");return e.subscribe(ds(t,_,function(){y=!0,b()})),function(){f?.()}}i(BI,"mergeInternals");a(BI,"mergeInternals");function qm(e,t,r){return r===void 0&&(r=1/0),Ar(t)?qm(function(n,s){return S6(function(o,c){return t(n,o,s,c)})(Ma(e(n,s)))},r):(typeof t=="number"&&(r=t),Vs(function(n,s){return BI(n,s,e,r)}))}i(qm,"mergeMap");a(qm,"mergeMap");function LI(e){return e===void 0&&(e=1/0),qm(Hm,e)}i(LI,"mergeAll");a(LI,"mergeAll");var Jz=["addListener","removeListener"],Yz=["addEventListener","removeEventListener"],Xz=["on","off"];function tm(e,t,r,n){if(Ar(r)&&(n=r,r=void 0),n)return tm(e,t,r).pipe(PI(n));var s=Ea($I(e)?Yz.map(function(f){return function(h){return e[f](t,h,r)}}):FI(e)?Jz.map(jy(e,t)):UI(e)?Xz.map(jy(e,t)):[],2),o=s[0],c=s[1];if(!o&&d6(e))return qm(function(f){return tm(f,t,r)})(Ma(e));if(!o)throw new TypeError("Invalid event target");return new ln(function(f){var h=a(function(){for(var p=[],v=0;v<arguments.length;v++)p[v]=arguments[v];return f.next(1<p.length?p:p[0])},"handler");return o(h),function(){return c(h)}})}i(tm,"fromEvent");a(tm,"fromEvent");function jy(e,t){return function(r){return function(n){return e[r](t,n)}}}i(jy,"toCommonHandlerRegistry");a(jy,"toCommonHandlerRegistry");function FI(e){return Ar(e.addListener)&&Ar(e.removeListener)}i(FI,"isNodeStyleEventEmitter");a(FI,"isNodeStyleEventEmitter");function UI(e){return Ar(e.on)&&Ar(e.off)}i(UI,"isJQueryStyleEventEmitter");a(UI,"isJQueryStyleEventEmitter");function $I(e){return Ar(e.addEventListener)&&Ar(e.removeEventListener)}i($I,"isEventTarget");a($I,"isEventTarget");function x6(e,t,r){e===void 0&&(e=0),r===void 0&&(r=Wz);var n=-1;return t!=null&&(l6(t)?r=t:n=t),new ln(function(s){var o=RI(e)?+e-r.now():e;o<0&&(o=0);var c=0;return r.schedule(function(){s.closed||(s.next(c++),0<=n?this.schedule(void 0,n):s.complete())},o)})}i(x6,"timer");a(x6,"timer");function jI(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=mI(e),n=vI(e,1/0),s=e;return s.length?s.length===1?Ma(s[0]):LI(n)(DI(s,r)):pI}i(jI,"merge");a(jI,"merge");function zI(e,t){return Vs(function(r,n){var s=0;r.subscribe(ds(n,function(o){return e.call(t,o,s++)&&n.next(o)}))})}i(zI,"filter");a(zI,"filter");function HI(e){return Vs(function(t,r){var n=!1;t.subscribe(ds(r,function(s){n=!0,r.next(s)},function(){n||r.next(e),r.complete()}))})}i(HI,"defaultIfEmpty");a(HI,"defaultIfEmpty");function qI(e){return e<=0?function(){return pI}:Vs(function(t,r){var n=0;t.subscribe(ds(r,function(s){++n<=e&&(r.next(s),e<=n&&r.complete())}))})}i(qI,"take");a(qI,"take");function KI(e){return e===void 0&&(e=VI),Vs(function(t,r){var n=!1;t.subscribe(ds(r,function(s){n=!0,r.next(s)},function(){return n?r.complete():r.error(e())}))})}i(KI,"throwIfEmpty");a(KI,"throwIfEmpty");function VI(){return new OI}i(VI,"defaultErrorFactory");a(VI,"defaultErrorFactory");function GI(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?zI(function(s,o){return e(s,o,n)}):Hm,qI(1),r?HI(t):KI(function(){return new OI}))}}i(GI,"first");a(GI,"first");function WI(e,t){return Vs(function(r,n){var s=t??{},o=s.leading,c=o===void 0?!0:o,f=s.trailing,h=f===void 0?!1:f,p=!1,v=null,y=null,b=!1,_=a(function(){y?.unsubscribe(),y=null,h&&(R(),b&&n.complete())},"endThrottling"),T=a(function(){y=null,b&&n.complete()},"cleanupThrottling"),O=a(function(P){return y=Ma(e(P)).subscribe(ds(n,_,T))},"startThrottle"),R=a(function(){if(p){p=!1;var P=v;v=null,n.next(P),!b&&O(P)}},"send");r.subscribe(ds(n,function(P){p=!0,v=P,!(y&&!y.closed)&&(c?R():O(P))},function(){b=!0,!(h&&p&&y&&!y.closed)&&n.complete()}))})}i(WI,"throttle");a(WI,"throttle");var LA;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(LA||(LA={}));var rm;(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"})(rm||(rm={}));var zy;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(zy||(zy={}));var Km=i(class extends ln{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,IA.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Er.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Er.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===zy.ANCHOR).map(({cid:e})=>Er.make(this.id,e))}get state(){return(0,IA.default)(this.state$.value)}async sync(e={}){e={sync:Yn.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(Km,"Stream");function Vm(){return e=>{}}i(Vm,"StreamStatic");a(Vm,"StreamStatic");var Qz=rr(L$(),1);function ZI(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):(jI(...e.map(r=>tm(r,"abort"))).pipe(GI()).subscribe(()=>{t.abort()}),t.signal)}i(ZI,"mergeAbortSignals");a(ZI,"mergeAbortSignals");var JI=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=x6(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");a(JI,"TimedAbortSignal");async function YI(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(YI,"abortable2");a(YI,"abortable");var eH=60*1e3*3;async function gi(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||eH,n=new JI(r),s=t.signal?ZI([t.signal,n.signal]):n.signal,o=await YI(s,c=>(0,Qz.default)(String(e),{...t,signal:c})).finally(()=>n.clear());if(!o.ok){let c=await o.text();throw new Error(`HTTP request to '${e}' failed with status '${o.statusText}': ${c}`)}return o.json()}i(gi,"fetchJson");a(gi,"fetchJson");var p0=rr(bd(),1);js();function ga(e){let t=jt.asCID(e);if(t)return t;if(typeof e=="string")return jt.parse(e);if(e instanceof Uint8Array)return jt.decode(e);throw new Error(`${e} cannot be converted to a CID`)}i(ga,"toCID");a(ga,"toCID");var FA=0,jr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,p0.default)(e);return jr.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Mr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Mr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(e)&&(t.link=t.link.toString()),jr.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=Mr(e.header.model,"base64")),t)}static deserializeCommit(e){let t=(0,p0.default)(e);return jr.isSignedCommitContainer(t)?(t.jws.link=ga(t.jws.link),t.linkedBlock=yr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=yr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(t)&&(t.link=ga(t.link)),jr.isAnchorCommit(t)&&(t.proof=ga(t.proof)),t.id&&(t.id=ga(t.id)),t.prev&&(t.prev=ga(t.prev)),t.header?.model&&(t.header.model=yr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,p0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=rm[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!=FA&&(t.metadata.unique=Mr(t.metadata.unique,"base64")),t.doctype=_a.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,p0.default)(e);return t.doctype&&(t.type=_a.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:ga(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=ga(t.anchorProof.txHash),t.anchorProof.root=ga(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=rm[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!=FA&&(t.metadata.unique=yr(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(jr.serializeState(e))===JSON.stringify(jr.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(jr.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(jr,"StreamUtils");var XI=i(class extends Hz{next(e){let t=this.value;jr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");a(XI,"StreamStateSubject");var tH=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate3"),mi,Qb={anchor:!0,publish:!0,pin:!0,sync:Yn.PREFER_CACHE},rH={sync:Yn.PREFER_CACHE},UA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function T0(e,t){if(typeof e?.schema=="string")try{Er.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=Mr((0,Pz.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(T0,"headerFromMetadata");a(T0,"headerFromMetadata");async function Hy(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(Hy,"getAuthenticatedDID");a(Hy,"getAuthenticatedDID");async function M0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(M0,"throwReadOnlyError");a(M0,"throwReadOnlyError");var Aa=mi=a(i(class extends Km{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,Nz.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,s={}){s={...Qb,...s},!n?.deterministic&&s.syncTimeoutSeconds==null&&(s.syncTimeoutSeconds=0);let o=s.asDID?{did:s.asDID}:t,c=await mi.makeGenesis(o,r,n);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,c,s)}static async createFromGenesis(t,r,n={}){n={...Qb,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let s=r.data?await mi._signDagJWS(t,r):r;return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,s,n)}static async deterministic(t,r,n={}){if(n={...Qb,...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 s=await mi.makeGenesis(t,null,r);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...rH,...n};let s=mo.from(r);if(s.type!=mi.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${mi.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return t.loadStream(s,n)}async update(t,r,n={}){n={...UA,...n};let s=n.asDID?{did:n.asDID}:this.api,o=await this.makeCommit(s,t,r),c=await this.api.applyCommit(this.id,o,n);this.state$.next(c.state)}async patch(t,r={}){r={...UA,...r};let s={header:T0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},o=await mi._signDagJWS(this.api,s),c=await this.api.applyCommit(this.id,o,r);this.state$.next(c.state)}makeReadOnly(){this.update=M0,this.patch=M0,this.sync=M0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let s=await this._makeRawCommit(r,n);return mi._signDagJWS(t,s)}async _makeRawCommit(t,r){r||(r={});let n=T0(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 s=UC.compare(this.content,t),o=this.state.log[0];return{header:n,data:s,prev:this.tip,id:o.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await Hy(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 s=T0(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:s};return Om(c),c}let o={data:r,header:s};return mi._signDagJWS(t,o)}static async _signDagJWS(t,r){return(await Hy(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");Aa.STREAM_TYPE_NAME="tile";Aa.STREAM_TYPE_ID=0;Aa=mi=tH([Vm()],Aa);var nH=rr(F$(),1);function QI(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(QI,"_checkPrivateRedeclaration2");a(QI,"_checkPrivateRedeclaration");function ek(e,t){return t.get?t.get.call(e):t.value}i(ek,"_classApplyDescriptorGet2");a(ek,"_classApplyDescriptorGet");function tk(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(tk,"_classApplyDescriptorSet2");a(tk,"_classApplyDescriptorSet");function T6(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(T6,"_classExtractFieldDescriptor2");a(T6,"_classExtractFieldDescriptor");function C0(e,t){var r=T6(e,t,"get");return ek(e,r)}i(C0,"_classPrivateFieldGet2");a(C0,"_classPrivateFieldGet");function qy(e,t,r){QI(e,t),t.set(e,r)}i(qy,"_classPrivateFieldInit2");a(qy,"_classPrivateFieldInit");function Ky(e,t,r){var n=T6(e,t,"set");return tk(e,n,r),r}i(Ky,"_classPrivateFieldSet2");a(Ky,"_classPrivateFieldSet");function rk(e){return typeof e=="string"||Er.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(rk,"keyToQuery");a(rk,"keyToQuery");function I0(e){return typeof e=="string"?mo.from(e).toString():Er.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(I0,"keyToString");a(I0,"keyToString");async function nk(e){let t=await Aa.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(nk,"getDeterministicQuery");a(nk,"getDeterministicQuery");var iH=a(()=>Promise.resolve([]),"tempBatchLoadFn"),m0=new WeakMap,ey=new WeakMap,sH=i(class extends nH.default{cache(e){if(!C0(this,ey))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await Aa.create(C0(this,m0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await nk(e);try{return await super.load(r)}catch{let s=await Aa.createFromGenesis(C0(this,m0),r.genesis,t);return this.cache(s),s}}async load(e){return await super.load(e)}async update(e,t,r,n){let s=I0(e);this.clear(s);let o=await this.load({streamId:s});return await o.update(t,r,n),o}constructor(e){super(iH,{cache:!0,cacheKeyFn:I0,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),qy(this,m0,{writable:!0,value:void 0}),qy(this,ey,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(rk),e.multiqueryTimeout);return t.map(n=>{let s=I0(n),o=r[s];return o||new Error(`Failed to load stream: ${s}`)})},Ky(this,m0,e.ceramic),Ky(this,ey,!!e.cache)}},"TileLoader");a(sH,"TileLoader");function Vy(e){return typeof e=="string"?Xt.fromString(e):e}i(Vy,"typeStreamID");a(Vy,"typeStreamID");function ik(e,t){let r=new URL(e);for(let[n,s]of Object.entries(t))Xt.isInstance(s)?r.searchParams.set(n,s.toString()):typeof s=="object"?r.searchParams.set(n,JSON.stringify(s)):r.searchParams.set(n,s);return r}i(ik,"serializeObjectToSearchParams");a(ik,"serializeObjectToSearchParams");function Gy(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(Gy,"serializeObjectForHttpPost");a(Gy,"serializeObjectForHttpPost");var ji=i(class extends ln{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=x6(0,r).pipe(WI(()=>this._syncState(this.id,{sync:Yn.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new XI(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 ji._load(e,this._apiUrl,t);this.state$.next(jr.deserializeState(r))}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}static async createFromGenesis(e,t,r,n,s){let o=new URL("./streams",e),{state:c}=await gi(o,{method:"post",body:{type:t,genesis:jr.serializeCommit(r),opts:n}});return new ji(jr.deserializeState(c),e,s)}static async applyCommit(e,t,r,n,s){let o=new URL("./commits",e),{state:c}=await gi(o,{method:"post",body:{streamId:t.toString(),commit:jr.serializeCommit(r),opts:n}});return new ji(jr.deserializeState(c),e,s)}static async _load(e,t,r){let n=ik(new URL(`./streams/${e}`,t),r),{state:s}=await gi(n);return s}static async load(e,t,r,n){let s=await ji._load(e,t,n);return new ji(jr.deserializeState(s),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await gi(r);return n.map(s=>({cid:s.cid,value:jr.deserializeCommit(s.value)}))}complete(){this.state$.complete()}},"Document");a(ji,"Document");var nd;(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"})(nd||(nd={}));var $A=rr(bd(),1),jA;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(jA||(jA={}));var Wy;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Wy||(Wy={}));var sk=i(class extends ln{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,$A.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Er.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Er.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Wy.ANCHOR).map(({cid:e})=>Er.make(this.id,e))}get state(){return(0,$A.default)(this.state$.value)}async sync(e={}){e={sync:nd.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(sk,"Stream");function ak(){return e=>{}}i(ak,"StreamStatic2");a(ak,"StreamStatic");function ok(e){if(typeof e=="string"&&e.includes("@")){let[t,r]=e.split("@");if(!t||!r)throw new Error("Invalid accountId provided");return new Uu({address:t,chainId:r})}return new Uu(e)}i(ok,"normalizeAccountId");a(ok,"normalizeAccountId");var aH="(?:%[0-9a-fA-F]{2})",zA=`(?:[a-zA-Z0-9._-]|${aH})`,oH="([a-z0-9]+)",cH=`((?:${zA}*:)*(${zA}+))`,HA="[a-zA-Z0-9_.:%-]",uH=`;${HA}+=${HA}*`,lH=`((${uH})*)`,fH="(/[^#?]*)?",dH="([?][^#]*)?",hH="(#.*)?",pH=new RegExp(`^did:${oH}:${cH}${lH}${fH}${dH}${hH}$`);function ck(e){if(e===""||!e)return null;let t=e.match(pH);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 s of n){let o=s.split("=");r.params[o[0]]=o[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(ck,"parse2");a(ck,"parse");var mH=rr(bd(),1),vH=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate4"),dc,ty=a(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),qA={anchor:!1,publish:!0,sync:nd.PREFER_CACHE},ry={anchor:!0,publish:!0},gH={sync:nd.PREFER_CACHE},ju=dc=a(i(class extends sk{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,mH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...qA,...n};let s=ok(r),o=dc.makeGenesis(s);return dc.fromGenesis(t,o,n)}static async fromGenesis(t,r,n={}){return n={...qA,...n},t.createStreamFromGenesis(dc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...ry,...n};let s=typeof t=="string"?t.trim():t.id;if(ck(s)?.did!==s)throw new Error(`DID is not valid: '${s}'`);let c=await r.createLink(s);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...ry,...r};let n=this.makeCommit(t),s=await this.api.applyCommit(this.id,n,r);this.state$.next(s.state)}async clearDid(t,r={}){r={...ry,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...gH,...n};let s=mo.from(r);if(s.type!=dc.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${dc.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return t.loadStream(s,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=ty,this.setDid=ty,this.sync=ty,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");ju.STREAM_TYPE_NAME="caip10-link";ju.STREAM_TYPE_ID=1;ju=dc=vH([ak()],ju);js();el();var bH=rr(Z$(),1),yH=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate5"),Bs,wH={sync:Yn.PREFER_CACHE};async function Zy(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(Zy,"_ensureAuthenticated");a(Zy,"_ensureAuthenticated");async function uk(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(uk,"throwReadOnlyError3");a(uk,"throwReadOnlyError");var Ec=Bs=a(i(class extends Km{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:Bs.MODEL}}static async create(t,r,n){Bs.assertComplete(r);let s={publish:!0,anchor:!0,pin:!0,sync:Yn.NEVER_SYNC,throwOnInvalidCommit:!0},o=await Bs._makeGenesis(t,r,n);return await t.createStreamFromGenesis(Bs.STREAM_TYPE_ID,o,s)}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={...wH,...n};let s=mo.from(r);if(s.type!=Bs.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${Bs.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return await t.loadStream(s,n)}static async _makeGenesis(t,r,n){let s=await this._makeRawGenesis(t,r,n);return Bs._signDagJWS(t,s)}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 Zy(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let s={controllers:[n.controller],model:Bs.MODEL.bytes};return{data:r,header:s}}makeReadOnly(){this.sync=uk,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await Zy(t),t.did.createDagJWS(r)}},"Model2"),"Model");Ec.STREAM_TYPE_NAME="model";Ec.STREAM_TYPE_ID=2;Ec.MODEL=function(){let e=Om("model-v1"),t=bH.default.encode(e,"identity"),r=Lu($0,t),n=jt.createV1($0,r);return new Xt("UNLOADABLE",n)}();Ec=Bs=yH([Vm()],Ec);var _H=rr(nl(),1),EH=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate6"),ns,AH={anchor:!0,publish:!0,pin:!0,sync:Yn.NEVER_SYNC,syncTimeoutSeconds:0},SH={anchor:!1,publish:!1,pin:!0,sync:Yn.PREFER_CACHE},xH={sync:Yn.PREFER_CACHE},KA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function Jy(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(Jy,"_ensureAuthenticated2");a(Jy,"_ensureAuthenticated");async function k0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(k0,"throwReadOnlyError4");a(k0,"throwReadOnlyError");var zu=ns=a(i(class extends Km{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,s={}){s={...AH,...s};let o=s.asDID?{did:s.asDID}:t,c=await ns._makeGenesis(o,r,n);return t.createStreamFromGenesis(ns.STREAM_TYPE_ID,c,s)}static async single(t,r,n={}){n={...SH,...n};let s=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let o=await ns._makeGenesis(s,null,r);return t.createStreamFromGenesis(ns.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...xH,...n};let s=mo.from(r);if(s.type!=ns.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${ns.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return t.loadStream(s,n)}async replace(t,r={}){r={...KA,...r};let n=r.asDID?{did:r.asDID}:this.api,s=await this._makeCommit(n,t),o=await this.api.applyCommit(this.id,s,r);this.state$.next(o.state)}async patch(t,r={}){r={...KA,...r};let n={data:t,prev:this.tip,id:this.id.cid},s=await ns._signDagJWS(this.api,n),o=await this.api.applyCommit(this.id,s,r);this.state$.next(o.state)}makeReadOnly(){this.replace=k0,this.patch=k0,this.sync=k0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return ns._signDagJWS(t,n)}_makeRawCommit(t){return{data:UC.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let s=await this._makeRawGenesis(t,r,n);return n.deterministic?(Om(s),s):ns._signDagJWS(t,s)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let s=n.controller;if(!s)if(t.did)await Jy(t),s=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let o={controllers:[s],model:n.model.bytes};return n.deterministic||(o.unique=(0,_H.randomBytes)(12)),{data:r,header:o}}static async _signDagJWS(t,r){return await Jy(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");zu.STREAM_TYPE_NAME="MID";zu.STREAM_TYPE_ID=3;zu=ns=EH([Vm()],zu);var lk=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 gi(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await gi(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 gi(t),{pinnedStreamIds:n}=r;return{[Symbol.asyncIterator](){let s=0;return{next(){return s===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[s++],done:!1})}}}}}},"RemotePinApi");a(lk,"RemotePinApi");var fk=i(class{constructor(e){this._fetchJson=gi,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:Gy(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:Gy(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:jr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");a(fk,"RemoteIndexApi");var dk=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=gi,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(o=>o.toString())}:void 0,s=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${s.signatures[0].protected}.${s.payload}.${s.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(dk,"RemoteAdminApi");var TH="/api/v0/",MH="http://localhost:7007",CH={syncInterval:5e3},IH={anchor:!0,publish:!0,sync:Yn.PREFER_CACHE},kH={anchor:!0,publish:!0,sync:Yn.PREFER_CACHE},VA={sync:Yn.PREFER_CACHE},DH=i(class{constructor(e=MH,t={}){this._config={...CH,...t},this._apiUrl=new URL(TH,e),this._streamCache=new Map,this.context={api:this},this.pin=new lk(this._apiUrl),this.index=new fk(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new dk(this._apiUrl,r),this._streamConstructors={[ju.STREAM_TYPE_ID]:ju,[Ec.STREAM_TYPE_ID]:Ec,[zu.STREAM_TYPE_ID]:zu,[Aa.STREAM_TYPE_ID]:Aa}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...kH,...r};let n=await ji.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),s=this._streamCache.get(n.id.toString());return s?(jr.statesEqual(n.state,s.state)||s.next(n.state),this.buildStreamFromDocument(s)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...VA,...t};let r=mo.from(e),n=this._streamCache.get(r.baseID.toString());return n?await n._syncState(r,t):(n=await ji.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(o=>({...o,streamId:typeof o.streamId=="string"?o.streamId:o.streamId.toString()})),n=new URL("./multiqueries",this._apiUrl),s=await gi(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(s).reduce((o,c)=>{let[f,h]=c,p=jr.deserializeState(h),v=new ji(p,this._apiUrl,this._config.syncInterval);return o[f]=this.buildStreamFromDocument(v),o},{})}loadStreamCommits(e){let t=Vy(e);return ji.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={...IH,...r};let n=Vy(e),s=await ji.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),o=this._streamCache.get(n.toString());return o?(o.next(s.state),this.buildStreamFromDocument(s)):(this._streamCache.set(n.toString(),s),this.buildStreamFromDocument(s))}async requestAnchor(e,t={}){t={...VA,...t};let{anchorStatus:r}=await gi(`${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 ji(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 gi(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");a(DH,"CeramicClient");var ir;(function(e){e.assertEqual=s=>s;function t(s){}i(t,"assertIs"),a(t,"assertIs"),e.assertIs=t;function r(s){throw new Error}i(r,"assertNever"),a(r,"assertNever"),e.assertNever=r,e.arrayToEnum=s=>{let o={};for(let c of s)o[c]=c;return o},e.getValidEnumValues=s=>{let o=e.objectKeys(s).filter(f=>typeof s[s[f]]!="number"),c={};for(let f of o)c[f]=s[f];return e.objectValues(c)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let c in s)Object.prototype.hasOwnProperty.call(s,c)&&o.push(c);return o},e.find=(s,o)=>{for(let c of s)if(o(c))return c},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}i(n,"joinValues"),a(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ir||(ir={}));var tt=ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),oo=a(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"),Ve=ir.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"]),OH=a(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ls=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(s){return s.message},r={_errors:[]},n=a(s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let c=r,f=0;for(;f<o.path.length;){let h=o.path[f];f===o.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(t(o))):c[h]=c[h]||{_errors:[]},c=c[h],f++}}},"processError");return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,ir.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(Ls,"ZodError");Ls.create=e=>new Ls(e);var id=a((e,t)=>{let r;switch(e.code){case Ve.invalid_type:e.received===tt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ve.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ir.jsonStringifyReplacer)}`;break;case Ve.unrecognized_keys:r=`Unrecognized key(s) in object: ${ir.joinValues(e.keys,", ")}`;break;case Ve.invalid_union:r="Invalid input";break;case Ve.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ir.joinValues(e.options)}`;break;case Ve.invalid_enum_value:r=`Invalid enum value. Expected ${ir.joinValues(e.options)}, received '${e.received}'`;break;case Ve.invalid_arguments:r="Invalid function arguments";break;case Ve.invalid_return_type:r="Invalid function return type";break;case Ve.invalid_date:r="Invalid date";break;case Ve.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}"`:ir.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ve.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 Ve.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 Ve.custom:r="Invalid input";break;case Ve.invalid_intersection_types:r="Intersection results could not be merged";break;case Ve.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ve.not_finite:r="Number must be finite";break;default:r=t.defaultError,ir.assertNever(e)}return{message:r}},"errorMap"),hk=id;function pk(e){hk=e}i(pk,"setErrorMap");a(pk,"setErrorMap");function sd(){return hk}i(sd,"getErrorMap");a(sd,"getErrorMap");var nm=a(e=>{let{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],c={...s,path:o},f="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)f=p(c,{data:t,defaultError:f}).message;return{...s,path:o,message:s.message||f}},"makeIssue"),RH=[];function vt(e,t){let r=nm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,sd(),id].filter(n=>!!n)});e.common.issues.push(r)}i(vt,"addIssueToContext");a(vt,"addIssueToContext");var Nn=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 Dt;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 Nn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:s,value:o}=n;if(s.status==="aborted"||o.status==="aborted")return Dt;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),(typeof o.value<"u"||n.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}},"ParseStatus");a(Nn,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),mk=a(e=>({status:"dirty",value:e}),"DIRTY"),An=a(e=>({status:"valid",value:e}),"OK"),Yy=a(e=>e.status==="aborted","isAborted"),Xy=a(e=>e.status==="dirty","isDirty"),im=a(e=>e.status==="valid","isValid"),sm=a(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Zt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Zt||(Zt={}));var hs=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(hs,"ParseInputLazyPath");var GA=a((e,t)=>{if(im(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Ls(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:s}=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:s}:{errorMap:a((c,f)=>c.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:n??f.defaultError}:{message:r??f.defaultError},"customMap"),description:s}}i(zt,"processCreateParams");a(zt,"processCreateParams");var $t=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 oo(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:oo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Nn,ctx:{common:e.parent.common,data:e.data,parsedType:oo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(sm(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:oo(e)},s=this._parseSync({data:e,path:n.path,parent:n});return GA(n,s)}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:oo(e)},n=this._parse({data:e,path:r.path,parent:r}),s=await(sm(n)?n:Promise.resolve(n));return GA(r,s)}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,s)=>{let o=e(n),c=a(()=>s.addIssue({code:Ve.custom,...r(n)}),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(c(),!1)):o?!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 Hi({schema:this,typeName:Tt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return fs.create(this)}nullable(){return bo.create(this)}nullish(){return this.optional().nullable()}array(){return ls.create(this)}promise(){return Tc.create(this)}or(e){return Gu.create([this,e])}and(e){return Wu.create(this,e)}transform(e){return new Hi({schema:this,typeName:Tt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Xu({innerType:this,defaultValue:t,typeName:Tt.ZodDefault})}brand(){return new C6({typeName:Tt.ZodBranded,type:this,...zt(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ld({innerType:this,defaultValue:t,typeName:Tt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Id.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");a($t,"ZodType");var NH=/^c[^\s-]{8,}$/i,PH=/^([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,BH=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,LH=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"),Sa=i(class extends $t{constructor(){super(...arguments),this._regex=(e,t,r)=>this.refinement(n=>e.test(n),{validation:t,code:Ve.invalid_string,...Zt.errToObj(r)}),this.nonempty=e=>this.min(1,Zt.errToObj(e)),this.trim=()=>new Sa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==tt.string){let s=this._getOrReturnCtx(e);return vt(s,{code:Ve.invalid_type,expected:tt.string,received:s.parsedType}),Dt}let r=new Nn,n;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,c=e.data.length<s.value;(o||c)&&(n=this._getOrReturnCtx(e,n),o?vt(n,{code:Ve.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&vt(n,{code:Ve.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")BH.test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{validation:"email",code:Ve.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")PH.test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{validation:"uuid",code:Ve.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")NH.test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{validation:"cuid",code:Ve.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),vt(n,{validation:"url",code:Ve.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{validation:"regex",code:Ve.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?LH(s).test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.invalid_string,validation:"datetime",message:s.message}),r.dirty()):ir.assertNever(s);return{status:r.value,value:e.data}}_addCheck(e){return new Sa({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Zt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Zt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Zt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Zt.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,...Zt.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Zt.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Zt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Zt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Zt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Zt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Zt.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(Sa,"ZodString");Sa.create=e=>{var t;return new Sa({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function vk(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),c=parseInt(t.toFixed(s).replace(".",""));return o%c/Math.pow(10,s)}i(vk,"floatSafeRemainder");a(vk,"floatSafeRemainder");var go=i(class extends $t{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)!==tt.number){let s=this._getOrReturnCtx(e);return vt(s,{code:Ve.invalid_type,expected:tt.number,received:s.parsedType}),Dt}let r,n=new Nn;for(let s of this._def.checks)s.kind==="int"?ir.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?vk(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.not_finite,message:s.message}),n.dirty()):ir.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Zt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Zt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Zt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Zt.toString(t))}setLimit(e,t,r,n){return new go({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Zt.toString(n)}]})}_addCheck(e){return new go({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Zt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Zt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Zt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Zt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Zt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Zt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Zt.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(go,"ZodNumber");go.create=e=>new go({checks:[],typeName:Tt.ZodNumber,coerce:e?.coerce||!1,...zt(e)});var Hu=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==tt.bigint){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.bigint,received:r.parsedType}),Dt}return An(e.data)}},"ZodBigInt");a(Hu,"ZodBigInt");Hu.create=e=>{var t;return new Hu({typeName:Tt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};var qu=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==tt.boolean){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.boolean,received:r.parsedType}),Dt}return An(e.data)}},"ZodBoolean");a(qu,"ZodBoolean");qu.create=e=>new qu({typeName:Tt.ZodBoolean,coerce:e?.coerce||!1,...zt(e)});var Ac=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==tt.date){let s=this._getOrReturnCtx(e);return vt(s,{code:Ve.invalid_type,expected:tt.date,received:s.parsedType}),Dt}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return vt(s,{code:Ve.invalid_date}),Dt}let r=new Nn,n;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ir.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ac({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Zt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Zt.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(Ac,"ZodDate");Ac.create=e=>new Ac({checks:[],coerce:e?.coerce||!1,typeName:Tt.ZodDate,...zt(e)});var ad=i(class extends $t{_parse(e){if(this._getType(e)!==tt.symbol){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.symbol,received:r.parsedType}),Dt}return An(e.data)}},"ZodSymbol");a(ad,"ZodSymbol");ad.create=e=>new ad({typeName:Tt.ZodSymbol,...zt(e)});var Ku=i(class extends $t{_parse(e){if(this._getType(e)!==tt.undefined){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.undefined,received:r.parsedType}),Dt}return An(e.data)}},"ZodUndefined");a(Ku,"ZodUndefined");Ku.create=e=>new Ku({typeName:Tt.ZodUndefined,...zt(e)});var Vu=i(class extends $t{_parse(e){if(this._getType(e)!==tt.null){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.null,received:r.parsedType}),Dt}return An(e.data)}},"ZodNull");a(Vu,"ZodNull");Vu.create=e=>new Vu({typeName:Tt.ZodNull,...zt(e)});var Sc=i(class extends $t{constructor(){super(...arguments),this._any=!0}_parse(e){return An(e.data)}},"ZodAny");a(Sc,"ZodAny");Sc.create=e=>new Sc({typeName:Tt.ZodAny,...zt(e)});var uo=i(class extends $t{constructor(){super(...arguments),this._unknown=!0}_parse(e){return An(e.data)}},"ZodUnknown");a(uo,"ZodUnknown");uo.create=e=>new uo({typeName:Tt.ZodUnknown,...zt(e)});var Fs=i(class extends $t{_parse(e){let t=this._getOrReturnCtx(e);return vt(t,{code:Ve.invalid_type,expected:tt.never,received:t.parsedType}),Dt}},"ZodNever");a(Fs,"ZodNever");Fs.create=e=>new Fs({typeName:Tt.ZodNever,...zt(e)});var od=i(class extends $t{_parse(e){if(this._getType(e)!==tt.undefined){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.void,received:r.parsedType}),Dt}return An(e.data)}},"ZodVoid");a(od,"ZodVoid");od.create=e=>new od({typeName:Tt.ZodVoid,...zt(e)});var ls=i(class extends $t{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==tt.array)return vt(t,{code:Ve.invalid_type,expected:tt.array,received:t.parsedType}),Dt;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(o||c)&&(vt(t,{code:o?Ve.too_big:Ve.too_small,minimum:c?n.exactLength.value:void 0,maximum:o?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&&(vt(t,{code:Ve.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&&(vt(t,{code:Ve.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((o,c)=>n.type._parseAsync(new hs(t,o,t.path,c)))).then(o=>Nn.mergeArray(r,o));let s=t.data.map((o,c)=>n.type._parseSync(new hs(t,o,t.path,c)));return Nn.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new ls({...this._def,minLength:{value:e,message:Zt.toString(t)}})}max(e,t){return new ls({...this._def,maxLength:{value:e,message:Zt.toString(t)}})}length(e,t){return new ls({...this._def,exactLength:{value:e,message:Zt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");a(ls,"ZodArray");ls.create=(e,t)=>new ls({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tt.ZodArray,...zt(t)});var am;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(am||(am={}));var WA=a(e=>t=>new Ir({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function hc(e){if(e instanceof Ir){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=fs.create(hc(n))}return new Ir({...e._def,shape:()=>t})}else return e instanceof ls?ls.create(hc(e.element)):e instanceof fs?fs.create(hc(e.unwrap())):e instanceof bo?bo.create(hc(e.unwrap())):e instanceof Us?Us.create(e.items.map(t=>hc(t))):e}i(hc,"deepPartialify");a(hc,"deepPartialify");var Ir=i(class extends $t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=WA(this._def),this.extend=WA(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ir.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==tt.object){let h=this._getOrReturnCtx(e);return vt(h,{code:Ve.invalid_type,expected:tt.object,received:h.parsedType}),Dt}let{status:r,ctx:n}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof Fs&&this._def.unknownKeys==="strip"))for(let h in n.data)o.includes(h)||c.push(h);let f=[];for(let h of o){let p=s[h],v=n.data[h];f.push({key:{status:"valid",value:h},value:p._parse(new hs(n,v,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof Fs){let h=this._def.unknownKeys;if(h==="passthrough")for(let p of c)f.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(h==="strict")c.length>0&&(vt(n,{code:Ve.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 v=n.data[p];f.push({key:{status:"valid",value:p},value:h._parse(new hs(n,v,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let p of f){let v=await p.key;h.push({key:v,value:await p.value,alwaysSet:p.alwaysSet})}return h}).then(h=>Nn.mergeObjectSync(r,h)):Nn.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return Zt.errToObj,new Ir({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,s,o,c;let f=(o=(s=(n=this._def).errorMap)===null||s===void 0?void 0:s.call(n,t,r).message)!==null&&o!==void 0?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(c=Zt.errToObj(e).message)!==null&&c!==void 0?c:f}:{message:f}}}:{}})}strip(){return new Ir({...this._def,unknownKeys:"strip"})}passthrough(){return new Ir({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Ir({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>am.mergeShapes(this._def.shape(),e._def.shape()),typeName:Tt.ZodObject})}catchall(e){return new Ir({...this._def,catchall:e})}pick(e){let t={};return ir.objectKeys(e).map(r=>{this.shape[r]&&(t[r]=this.shape[r])}),new Ir({...this._def,shape:()=>t})}omit(e){let t={};return ir.objectKeys(this.shape).map(r=>{ir.objectKeys(e).indexOf(r)===-1&&(t[r]=this.shape[r])}),new Ir({...this._def,shape:()=>t})}deepPartial(){return hc(this)}partial(e){let t={};if(e)return ir.objectKeys(this.shape).map(r=>{ir.objectKeys(e).indexOf(r)===-1?t[r]=this.shape[r]:t[r]=this.shape[r].optional()}),new Ir({...this._def,shape:()=>t});for(let r in this.shape){let n=this.shape[r];t[r]=n.optional()}return new Ir({...this._def,shape:()=>t})}required(e){let t={};if(e)ir.objectKeys(this.shape).map(r=>{if(ir.objectKeys(e).indexOf(r)===-1)t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof fs;)s=s._def.innerType;t[r]=s}});else for(let r in this.shape){let s=this.shape[r];for(;s instanceof fs;)s=s._def.innerType;t[r]=s}return new Ir({...this._def,shape:()=>t})}keyof(){return M6(ir.objectKeys(this.shape))}},"ZodObject");a(Ir,"ZodObject");Ir.create=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strip",catchall:Fs.create(),typeName:Tt.ZodObject,...zt(t)});Ir.strictCreate=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strict",catchall:Fs.create(),typeName:Tt.ZodObject,...zt(t)});Ir.lazycreate=(e,t)=>new Ir({shape:e,unknownKeys:"strip",catchall:Fs.create(),typeName:Tt.ZodObject,...zt(t)});var Gu=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let o=s.map(c=>new Ls(c.ctx.common.issues));return vt(t,{code:Ve.invalid_union,unionErrors:o}),Dt}if(i(n,"handleResults"),a(n,"handleResults"),t.common.async)return Promise.all(r.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let s,o=[];for(let f of r){let h={...t,common:{...t.common,issues:[]},parent:null},p=f._parseSync({data:t.data,path:t.path,parent:h});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:h}),h.common.issues.length&&o.push(h.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let c=o.map(f=>new Ls(f));return vt(t,{code:Ve.invalid_union,unionErrors:c}),Dt}}get options(){return this._def.options}},"ZodUnion");a(Gu,"ZodUnion");Gu.create=(e,t)=>new Gu({options:e,typeName:Tt.ZodUnion,...zt(t)});var D0=a(e=>e instanceof Zu?D0(e.schema):e instanceof Hi?D0(e.innerType()):e instanceof Ju?[e.value]:e instanceof ml?e.options:e instanceof Yu?Object.keys(e.enum):e instanceof Xu?D0(e._def.innerType):e instanceof Ku?[void 0]:e instanceof Vu?[null]:null,"getDiscriminator"),Gm=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tt.object)return vt(t,{code:Ve.invalid_type,expected:tt.object,received:t.parsedType}),Dt;let r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(vt(t,{code:Ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Dt)}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 s of t){let o=D0(s.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of o){if(n.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);n.set(c,s)}}return new Gm({typeName:Tt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...zt(r)})}},"ZodDiscriminatedUnion");a(Gm,"ZodDiscriminatedUnion");function om(e,t){let r=oo(e),n=oo(t);if(e===t)return{valid:!0,data:e};if(r===tt.object&&n===tt.object){let s=ir.objectKeys(t),o=ir.objectKeys(e).filter(f=>s.indexOf(f)!==-1),c={...e,...t};for(let f of o){let h=om(e[f],t[f]);if(!h.valid)return{valid:!1};c[f]=h.data}return{valid:!0,data:c}}else if(r===tt.array&&n===tt.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let c=e[o],f=t[o],h=om(c,f);if(!h.valid)return{valid:!1};s.push(h.data)}return{valid:!0,data:s}}else return r===tt.date&&n===tt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(om,"mergeValues");a(om,"mergeValues");var Wu=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=a((s,o)=>{if(Yy(s)||Yy(o))return Dt;let c=om(s.value,o.value);return c.valid?((Xy(s)||Xy(o))&&t.dirty(),{status:t.value,value:c.data}):(vt(r,{code:Ve.invalid_intersection_types}),Dt)},"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(([s,o])=>n(s,o)):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(Wu,"ZodIntersection");Wu.create=(e,t,r)=>new Wu({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var Us=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tt.array)return vt(r,{code:Ve.invalid_type,expected:tt.array,received:r.parsedType}),Dt;if(r.data.length<this._def.items.length)return vt(r,{code:Ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dt;!this._def.rest&&r.data.length>this._def.items.length&&(vt(r,{code:Ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=r.data.map((o,c)=>{let f=this._def.items[c]||this._def.rest;return f?f._parse(new hs(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Nn.mergeArray(t,o)):Nn.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Us({...this._def,rest:e})}},"ZodTuple");a(Us,"ZodTuple");Us.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Us({items:e,typeName:Tt.ZodTuple,rest:null,...zt(t)})};var cd=i(class extends $t{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!==tt.object)return vt(r,{code:Ve.invalid_type,expected:tt.object,received:r.parsedType}),Dt;let n=[],s=this._def.keyType,o=this._def.valueType;for(let c in r.data)n.push({key:s._parse(new hs(r,c,r.path,c)),value:o._parse(new hs(r,r.data[c],r.path,c))});return r.common.async?Nn.mergeObjectAsync(t,n):Nn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof $t?new cd({keyType:e,valueType:t,typeName:Tt.ZodRecord,...zt(r)}):new cd({keyType:Sa.create(),valueType:e,typeName:Tt.ZodRecord,...zt(t)})}},"ZodRecord");a(cd,"ZodRecord");var ud=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tt.map)return vt(r,{code:Ve.invalid_type,expected:tt.map,received:r.parsedType}),Dt;let n=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([c,f],h)=>({key:n._parse(new hs(r,c,r.path,[h,"key"])),value:s._parse(new hs(r,f,r.path,[h,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let f of o){let h=await f.key,p=await f.value;if(h.status==="aborted"||p.status==="aborted")return Dt;(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 f of o){let h=f.key,p=f.value;if(h.status==="aborted"||p.status==="aborted")return Dt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}}}},"ZodMap");a(ud,"ZodMap");ud.create=(e,t,r)=>new ud({valueType:t,keyType:e,typeName:Tt.ZodMap,...zt(r)});var xc=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tt.set)return vt(r,{code:Ve.invalid_type,expected:tt.set,received:r.parsedType}),Dt;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(vt(r,{code:Ve.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&&(vt(r,{code:Ve.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let s=this._def.valueType;function o(f){let h=new Set;for(let p of f){if(p.status==="aborted")return Dt;p.status==="dirty"&&t.dirty(),h.add(p.value)}return{status:t.value,value:h}}i(o,"finalizeSet"),a(o,"finalizeSet");let c=[...r.data.values()].map((f,h)=>s._parse(new hs(r,f,r.path,h)));return r.common.async?Promise.all(c).then(f=>o(f)):o(c)}min(e,t){return new xc({...this._def,minSize:{value:e,message:Zt.toString(t)}})}max(e,t){return new xc({...this._def,maxSize:{value:e,message:Zt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},"ZodSet");a(xc,"ZodSet");xc.create=(e,t)=>new xc({valueType:e,minSize:null,maxSize:null,typeName:Tt.ZodSet,...zt(t)});var Nu=i(class extends $t{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tt.function)return vt(t,{code:Ve.invalid_type,expected:tt.function,received:t.parsedType}),Dt;function r(c,f){return nm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,sd(),id].filter(h=>!!h),issueData:{code:Ve.invalid_arguments,argumentsError:f}})}i(r,"makeArgsIssue"),a(r,"makeArgsIssue");function n(c,f){return nm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,sd(),id].filter(h=>!!h),issueData:{code:Ve.invalid_return_type,returnTypeError:f}})}i(n,"makeReturnsIssue"),a(n,"makeReturnsIssue");let s={errorMap:t.common.contextualErrorMap},o=t.data;return this._def.returns instanceof Tc?An(async(...c)=>{let f=new Ls([]),h=await this._def.args.parseAsync(c,s).catch(y=>{throw f.addIssue(r(c,y)),f}),p=await o(...h);return await this._def.returns._def.type.parseAsync(p,s).catch(y=>{throw f.addIssue(n(p,y)),f})}):An((...c)=>{let f=this._def.args.safeParse(c,s);if(!f.success)throw new Ls([r(c,f.error)]);let h=o(...f.data),p=this._def.returns.safeParse(h,s);if(!p.success)throw new Ls([n(h,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Nu({...this._def,args:Us.create(e).rest(uo.create())})}returns(e){return new Nu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Nu({args:e||Us.create([]).rest(uo.create()),returns:t||uo.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");a(Nu,"ZodFunction");var Zu=i(class extends $t{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(Zu,"ZodLazy");Zu.create=(e,t)=>new Zu({getter:e,typeName:Tt.ZodLazy,...zt(t)});var Ju=i(class extends $t{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return vt(t,{code:Ve.invalid_literal,expected:this._def.value}),Dt}return{status:"valid",value:e.data}}get value(){return this._def.value}},"ZodLiteral");a(Ju,"ZodLiteral");Ju.create=(e,t)=>new Ju({value:e,typeName:Tt.ZodLiteral,...zt(t)});function M6(e,t){return new ml({values:e,typeName:Tt.ZodEnum,...zt(t)})}i(M6,"createZodEnum");a(M6,"createZodEnum");var ml=i(class extends $t{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return vt(t,{expected:ir.joinValues(r),received:t.parsedType,code:Ve.invalid_type}),Dt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return vt(t,{received:t.data,code:Ve.invalid_enum_value,options:r}),Dt}return An(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(ml,"ZodEnum");ml.create=M6;var Yu=i(class extends $t{_parse(e){let t=ir.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==tt.string&&r.parsedType!==tt.number){let n=ir.objectValues(t);return vt(r,{expected:ir.joinValues(n),received:r.parsedType,code:Ve.invalid_type}),Dt}if(t.indexOf(e.data)===-1){let n=ir.objectValues(t);return vt(r,{received:r.data,code:Ve.invalid_enum_value,options:n}),Dt}return An(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");a(Yu,"ZodNativeEnum");Yu.create=(e,t)=>new Yu({values:e,typeName:Tt.ZodNativeEnum,...zt(t)});var Tc=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tt.promise&&t.common.async===!1)return vt(t,{code:Ve.invalid_type,expected:tt.promise,received:t.parsedType}),Dt;let r=t.parsedType===tt.promise?t.data:Promise.resolve(t.data);return An(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");a(Tc,"ZodPromise");Tc.create=(e,t)=>new Tc({type:e,typeName:Tt.ZodPromise,...zt(t)});var Hi=i(class extends $t{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 o=n.transform(r.data);return r.common.async?Promise.resolve(o).then(c=>this._def.schema._parseAsync({data:c,path:r.path,parent:r})):this._def.schema._parseSync({data:o,path:r.path,parent:r})}let s={addIssue:o=>{vt(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),n.type==="refinement"){let o=a(c=>{let f=n.refinement(c,s);if(r.common.async)return Promise.resolve(f);if(f 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"?Dt:(c.status==="dirty"&&t.dirty(),o(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"?Dt:(c.status==="dirty"&&t.dirty(),o(c.value).then(()=>({status:t.value,value:c.value}))))}if(n.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!im(o))return o;let c=n.transform(o.value,s);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(o=>im(o)?Promise.resolve(n.transform(o.value,s)).then(c=>({status:t.value,value:c})):o);ir.assertNever(n)}},"ZodEffects");a(Hi,"ZodEffects");Hi.create=(e,t,r)=>new Hi({schema:e,typeName:Tt.ZodEffects,effect:t,...zt(r)});Hi.createWithPreprocess=(e,t,r)=>new Hi({schema:t,effect:{type:"preprocess",transform:e},typeName:Tt.ZodEffects,...zt(r)});var fs=i(class extends $t{_parse(e){return this._getType(e)===tt.undefined?An(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");a(fs,"ZodOptional");fs.create=(e,t)=>new fs({innerType:e,typeName:Tt.ZodOptional,...zt(t)});var bo=i(class extends $t{_parse(e){return this._getType(e)===tt.null?An(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodNullable");a(bo,"ZodNullable");bo.create=(e,t)=>new bo({innerType:e,typeName:Tt.ZodNullable,...zt(t)});var Xu=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===tt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},"ZodDefault");a(Xu,"ZodDefault");Xu.create=(e,t)=>new Xu({innerType:e,typeName:Tt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var ld=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return sm(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(ld,"ZodCatch");ld.create=(e,t)=>new ld({innerType:e,typeName:Tt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var fd=i(class extends $t{_parse(e){if(this._getType(e)!==tt.nan){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.nan,received:r.parsedType}),Dt}return{status:"valid",value:e.data}}},"ZodNaN");a(fd,"ZodNaN");fd.create=e=>new fd({typeName:Tt.ZodNaN,...zt(e)});var FH=Symbol("zod_brand"),C6=i(class extends $t{_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(C6,"ZodBranded");var Id=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return a(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Dt:s.status==="dirty"?(t.dirty(),mk(s.value)):this._def.out._parseAsync({data:s.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"?Dt: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 Id({in:e,out:t,typeName:Tt.ZodPipeline})}},"ZodPipeline");a(Id,"ZodPipeline");var gk=a((e,t={},r)=>e?Sc.create().superRefine((n,s)=>{if(!e(n)){let o=typeof t=="function"?t(n):t,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:r})}}):Sc.create(),"custom"),UH={object:Ir.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 $H=a((e,t={message:`Input not instance of ${e.name}`})=>gk(r=>r instanceof e,t,!0),"instanceOfType"),bk=Sa.create,yk=go.create,jH=fd.create,zH=Hu.create,wk=qu.create,HH=Ac.create,qH=ad.create,KH=Ku.create,VH=Vu.create,GH=Sc.create,WH=uo.create,ZH=Fs.create,JH=od.create,YH=ls.create,XH=Ir.create,QH=Ir.strictCreate,eq=Gu.create,tq=Gm.create,rq=Wu.create,nq=Us.create,iq=cd.create,sq=ud.create,aq=xc.create,oq=Nu.create,cq=Zu.create,uq=Ju.create,lq=ml.create,fq=Yu.create,dq=Tc.create,ZA=Hi.create,hq=fs.create,pq=bo.create,mq=Hi.createWithPreprocess,vq=Id.create,gq=a(()=>bk().optional(),"ostring"),bq=a(()=>yk().optional(),"onumber"),yq=a(()=>wk().optional(),"oboolean"),wq={string:e=>Sa.create({...e,coerce:!0}),number:e=>go.create({...e,coerce:!0}),boolean:e=>qu.create({...e,coerce:!0}),bigint:e=>Hu.create({...e,coerce:!0}),date:e=>Ac.create({...e,coerce:!0})},_q=Dt,J=Object.freeze({__proto__:null,defaultErrorMap:id,setErrorMap:pk,getErrorMap:sd,makeIssue:nm,EMPTY_PATH:RH,addIssueToContext:vt,ParseStatus:Nn,INVALID:Dt,DIRTY:mk,OK:An,isAborted:Yy,isDirty:Xy,isValid:im,isAsync:sm,get util(){return ir},ZodParsedType:tt,getParsedType:oo,ZodType:$t,ZodString:Sa,ZodNumber:go,ZodBigInt:Hu,ZodBoolean:qu,ZodDate:Ac,ZodSymbol:ad,ZodUndefined:Ku,ZodNull:Vu,ZodAny:Sc,ZodUnknown:uo,ZodNever:Fs,ZodVoid:od,ZodArray:ls,get objectUtil(){return am},ZodObject:Ir,ZodUnion:Gu,ZodDiscriminatedUnion:Gm,ZodIntersection:Wu,ZodTuple:Us,ZodRecord:cd,ZodMap:ud,ZodSet:xc,ZodFunction:Nu,ZodLazy:Zu,ZodLiteral:Ju,ZodEnum:ml,ZodNativeEnum:Yu,ZodPromise:Tc,ZodEffects:Hi,ZodTransformer:Hi,ZodOptional:fs,ZodNullable:bo,ZodDefault:Xu,ZodCatch:ld,ZodNaN:fd,BRAND:FH,ZodBranded:C6,ZodPipeline:Id,custom:gk,Schema:$t,ZodSchema:$t,late:UH,get ZodFirstPartyTypeKind(){return Tt},coerce:wq,any:GH,array:YH,bigint:zH,boolean:wk,date:HH,discriminatedUnion:tq,effect:ZA,enum:lq,function:oq,instanceof:$H,intersection:rq,lazy:cq,literal:uq,map:sq,nan:jH,nativeEnum:fq,never:ZH,null:VH,nullable:pq,number:yk,object:XH,oboolean:yq,onumber:bq,optional:hq,ostring:gq,pipeline:vq,preprocess:mq,promise:dq,record:iq,set:aq,strictObject:QH,string:bk,symbol:qH,transformer:ZA,tuple:nq,undefined:KH,union:eq,unknown:WH,void:JH,NEVER:_q,ZodIssueCode:Ve,quotelessJson:OH,ZodError:Ls}),_k=J.array(J.string().or(J.record(J.any()))),NJ=J.object({type:J.string().optional(),narrative:J.string().optional()}),Wm=J.string().or(J.object({id:J.string(),type:J.string(),caption:J.string().optional()})),Eq=J.object({type:J.string().min(1).or(J.string().array().nonempty()),latitude:J.number(),longitude:J.number()}),Aq=J.object({type:J.string().min(1).or(J.string().array().nonempty()),addressCountry:J.string().optional(),addressCountryCode:J.string().optional(),addressRegion:J.string().optional(),addressLocality:J.string().optional(),streetAddress:J.string().optional(),postOfficeBoxNumber:J.string().optional(),postalCode:J.string().optional(),geo:Eq.optional()}),Sq=J.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(J.string()),Ek=J.object({type:J.string().min(1).or(J.string().array().nonempty()),identifier:J.string(),identifierType:Sq}),dd=J.string().or(J.object({id:J.string().optional(),type:J.string().or(J.string().array().nonempty().optional()),name:J.string().optional(),url:J.string().optional(),phone:J.string().optional(),description:J.string().optional(),endorsement:J.any().array().optional(),image:Wm.optional(),email:J.string().email().optional(),address:Aq.optional(),otherIdentifier:Ek.array().optional(),official:J.string().optional(),parentOrg:J.any().optional(),familyName:J.string().optional(),givenName:J.string().optional(),additionalName:J.string().optional(),patronymicName:J.string().optional(),honorificPrefix:J.string().optional(),honorificSuffix:J.string().optional(),familyNamePrefix:J.string().optional(),dateOfBirth:J.string().optional()}).catchall(J.any())),Qy=J.object({id:J.string().optional()}).catchall(J.any()),xq=J.object({type:J.string(),id:J.string()}).catchall(J.any()),Tq=J.object({id:J.string(),type:J.string()}).catchall(J.any()),Mq=J.object({id:J.string(),type:J.string()}).catchall(J.any()),cm=J.object({"@context":_k,id:J.string().optional(),type:J.string().array().nonempty(),issuer:dd,issuanceDate:J.string(),expirationDate:J.string().optional(),credentialSubject:Qy.or(Qy.array()),credentialStatus:xq.optional(),credentialSchema:Tq.array().optional(),refreshService:Mq.optional()}).catchall(J.any()),yo=J.object({type:J.string(),created:J.string(),challenge:J.string().optional(),domain:J.string().optional(),nonce:J.string().optional(),proofPurpose:J.string(),verificationMethod:J.string(),jws:J.string().optional()}).catchall(J.any()),JA=cm.extend({proof:yo.or(yo.array())}),Cq=J.object({"@context":_k,id:J.string().optional(),type:J.string().or(J.string().array().nonempty()),verifiableCredential:JA.or(JA.array()).optional(),holder:J.string().optional()}).catchall(J.any()),PJ=Cq.extend({proof:yo.or(yo.array())}),Iq=J.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(J.string()),Zm=J.object({type:J.string().array().nonempty(),targetCode:J.string().optional(),targetDescription:J.string().optional(),targetName:J.string(),targetFramework:J.string().optional(),targetType:Iq.optional(),targetUrl:J.string()}),kq=J.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"]),Dq=kq.or(J.string()),Oq=J.object({id:J.string().optional(),narrative:J.string().optional()}).catchall(J.any()),Rq=J.object({id:J.string(),type:J.string().array().nonempty(),endorsementComment:J.string().optional()}),Nq=cm.extend({credentialSubject:Rq,proof:yo.or(yo.array()).optional()}),Pq=J.object({id:J.string(),"@language":J.string().optional(),version:J.string().optional()}),Bq=J.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(J.string()),Lq=J.object({id:J.string(),type:J.string().array().nonempty(),alignment:Zm.array().optional(),description:J.string().optional(),level:J.string().optional(),name:J.string(),points:J.string().optional()}).catchall(J.any()),Fq=J.object({id:J.string(),type:J.string().array().nonempty(),alignment:Zm.array().optional(),allowedValue:J.string().array().optional(),name:J.string(),requiredLevel:J.string().optional(),requiredValue:J.string().optional(),resultType:Bq,rubricCriterionLevel:Lq.array().optional(),valueMax:J.string().optional(),valueMin:J.string().optional()}).catchall(J.any()),Uq=J.object({id:J.string().optional(),type:J.string().array().nonempty(),alignment:Zm.array().optional(),achievementType:Dq.optional(),creator:dd.optional(),creditsAvailable:J.number().optional(),criteria:Oq,description:J.string(),endorsement:Nq.array().optional(),fieldOfStudy:J.string().optional(),humanCode:J.string().optional(),image:Wm.optional(),"@language":J.string().optional(),name:J.string(),otherIdentifier:Ek.array().optional(),related:Pq.array().optional(),resultDescription:Fq.array().optional(),specialization:J.string().optional(),tag:J.string().array().optional(),version:J.string().optional()}).catchall(J.any()),$q=J.object({type:J.string(),hashed:J.boolean(),identityHash:J.string(),identityType:J.string(),salt:J.string().optional()}),jq=J.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),zq=J.object({type:J.string().array().nonempty(),achievedLevel:J.string().optional(),alignment:Zm.array().optional(),resultDescription:J.string().optional(),status:jq.optional(),value:J.string().optional()}).catchall(J.any()),YA=J.object({id:J.string().optional(),type:J.string().array().nonempty(),activityEndDate:J.string().optional(),activityStartDate:J.string().optional(),creditsEarned:J.number().optional(),achievement:Uq.optional(),identifier:$q.array().optional(),image:Wm.optional(),licenseNumber:J.string().optional(),narrative:J.string().optional(),result:zq.array().optional(),role:J.string().optional(),source:dd.optional(),term:J.string().optional()}).catchall(J.any()),Hq=J.object({id:J.string().optional(),type:J.string().array().nonempty(),narrative:J.string().optional(),name:J.string().optional(),description:J.string().optional(),genre:J.string().optional(),audience:J.string().optional()}).catchall(J.any()),qq=cm.extend({name:J.string().optional(),description:J.string().optional(),image:Wm.optional(),credentialSubject:YA.or(YA.array()),endorsement:cm.array().optional(),evidence:Hq.array().optional()}),BJ=qq.extend({proof:yo.or(yo.array())}),LJ=J.object({checks:J.string().array(),warnings:J.string().array(),errors:J.string().array()}),Ak=J.enum(["Success","Failed","Error"]),FJ=Ak.enum,UJ=J.object({check:J.string(),status:Ak,message:J.string().optional(),details:J.string().optional()}),$J=J.object({title:J.string().optional(),createdAt:J.string().optional(),issuer:dd.optional(),issuee:dd.optional(),credentialSubject:Qy.optional()}),jJ=J.object({id:J.string(),uri:J.string()}).catchall(J.any()),zJ=J.object({limit:J.number(),cursor:J.string().optional()}),Bc=J.object({cursor:J.string().optional(),hasMore:J.boolean()}),Kq=J.object({kty:J.string(),crv:J.string(),x:J.string(),y:J.string().optional(),n:J.string().optional(),d:J.string()}),Vq=J.object({alg:J.string(),iv:J.string(),tag:J.string(),epk:Kq.partial().optional(),kid:J.string().optional(),apv:J.string().optional(),apu:J.string().optional()}),Gq=J.object({header:Vq,encrypted_key:J.string()}),Wq=J.object({protected:J.string(),iv:J.string(),ciphertext:J.string(),tag:J.string(),aad:J.string().optional(),recipients:Gq.array().optional()}),Sk=J.object({encryptedRecord:Wq,fields:J.string().array()}).catchall(J.any()),HJ=Bc.extend({records:Sk.array()}),Zq=Sk.extend({id:J.string()}),qJ=Bc.extend({records:Zq.array()}),Qu=J.object({profileId:J.string().min(3).max(40),displayName:J.string().default(""),bio:J.string().default(""),did:J.string(),email:J.string().optional(),image:J.string().optional(),isServiceProfile:J.boolean().default(!1).optional(),notificationsWebhook:J.string().url().startsWith("https://").optional()}),KJ=Bc.extend({records:Qu.array()}),VJ=J.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),GJ=J.object({uri:J.string(),to:J.string(),from:J.string(),sent:J.string().datetime(),received:J.string().datetime().optional()}),Jq=J.enum(["DRAFT","LIVE"]),WJ=J.object({uri:J.string(),name:J.string().optional(),type:J.string().optional(),category:J.string().optional(),status:Jq.optional(),autoConnectRecipients:J.boolean().optional()}),ZJ=J.object({to:Qu,from:J.string(),received:J.string().optional()}),Yq=J.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED"]),Xq=J.object({title:J.string().optional(),body:J.string().optional()}),Qq=J.object({vcUris:J.array(J.string()).optional(),vpUris:J.array(J.string()).optional()}),JJ=J.object({type:Yq,to:Qu.partial().and(J.object({did:J.string()})),from:Qu.partial().and(J.object({did:J.string()})),message:Xq.optional(),data:Qq.optional(),sent:J.string().datetime().optional()}),YJ=J.object({endpoint:J.string(),name:J.string(),did:J.string().optional()}),XJ=J.object({ttlSeconds:J.number().optional(),totalUses:J.number().optional()}),eK=J.object({endpoint:J.string()}),QJ=J.object({signingAuthority:eK,relationship:J.object({name:J.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:J.string()})}),tK=J.enum(["live","stale","withdrawn"]),rK=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.object({required:J.boolean()})).default({})}).default({}),personal:J.record(J.object({required:J.boolean()})).default({})}).default({}),write:J.object({credentials:J.object({categories:J.record(J.object({required:J.boolean()})).default({})}).default({}),personal:J.record(J.object({required:J.boolean()})).default({})}).default({})}),xk=J.object({contract:rK,owner:Qu,name:J.string(),subtitle:J.string().optional(),description:J.string().optional(),reasonForAccessing:J.string().optional(),image:J.string().optional(),uri:J.string(),createdAt:J.string(),updatedAt:J.string(),expiresAt:J.string().optional()}),eY=Bc.extend({records:xk.omit({owner:!0}).array()}),nK=J.object({credentials:J.object({categories:J.record(J.string().array()).default({})}),personal:J.record(J.string()).default({}),date:J.string()}),tY=Bc.extend({records:nK.array()}),Tk=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({shareAll:J.boolean().optional(),sharing:J.boolean().optional(),categories:J.record(J.object({sharing:J.boolean().optional(),shared:J.string().array().optional(),shareAll:J.boolean().optional()})).default({})}).default({}),personal:J.record(J.string()).default({})}).default({}),write:J.object({credentials:J.object({categories:J.record(J.boolean()).default({})}).default({}),personal:J.record(J.boolean()).default({})}).default({})}),rY=Bc.extend({records:J.object({expiresAt:J.string().optional(),oneTime:J.boolean().optional(),terms:Tk,contract:xk,uri:J.string(),consenter:Qu,status:tK}).array()}),nY=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),personal:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),write:J.object({credentials:J.object({categories:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),personal:J.record(J.object({required:J.boolean().optional()})).optional()}).optional()}),iK=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({shareAll:J.boolean().optional(),sharing:J.boolean().optional(),categories:J.record(J.object({sharing:J.boolean().optional(),shared:J.string().array().optional(),shareAll:J.boolean().optional()}).optional()).optional()}).optional(),personal:J.record(J.string()).optional()}).optional(),write:J.object({credentials:J.object({categories:J.record(J.boolean()).optional()}).optional(),personal:J.record(J.boolean()).optional()}).optional()}),e2=J.enum(["consent","update","sync","withdraw"]),iY=J.object({terms:iK.optional(),action:e2.or(e2.array()).optional(),date:J.object({$gt:J.string()}).or(J.object({$lt:J.string()})).or(J.object({$eq:J.string()})).optional(),expiresAt:J.object({$gt:J.string()}).or(J.object({$lt:J.string()})).or(J.object({$eq:J.string()})).optional(),oneTime:J.boolean().optional()}),sK=J.object({expiresAt:J.string().optional(),oneTime:J.boolean().optional(),terms:Tk.optional(),id:J.string(),action:e2,date:J.string()}),sY=Bc.extend({records:sK.array()}),Jm=a(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),aY=J.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 I6=W.object({credentials:uc.array()}).catchall(W.any()),Mk=W.object({id:W.string(),title:W.string(),storageType:W.literal("ceramic").optional()}).catchall(W.any()),k6=W.object({credentials:uc.or(Mk).array()}).strict();var Ym=i(async(e,{modelData:t,credentialAlias:r})=>{let n=e.invoke.getCeramicClient(),s=new Of({ceramic:n,model:t}),o=i(async(v=r)=>{let y=await s.get(v);if(!y)return{credentials:[]};let b=await I6.spa(y);if(b.success)return b.data;let _=await k6.spa(y);if(_.success){let R={credentials:_.data.credentials.map(P=>{if("uri"in P)return P;let{title:K,id:U,storageType:j,...V}=P;return{...V,id:K,uri:`lc:ceramic:${U.replace("ceramic://","")}`}})};return await s.set(r,R),R}throw console.error(b.error),new Error("Invalid credentials list stored in IDX")},"getCredentialsListFromIdx"),c=i(async(v,y)=>{if(!v)throw new Error("Must provide id to remove");y||(y=r);let b=await o(y);return b.credentials=b.credentials.filter(_=>_.id!==v),s.set(y,b)},"removeCredentialFromIdx"),f=i(async v=>(v||(v=r),s.set(v,{credentials:[]})),"removeAllCredentialsFromIdx"),h=i(async v=>{let y=await uc.parseAsync(v);if(!y)throw new Error("record is required");if(!y.uri)throw Error("No URI provided");await e.read.get(y.uri);let b=await o(r),_=b.credentials.findIndex(T=>T.id===y.id);return _>-1?b.credentials[_]=y:b.credentials.push(y),Jm(await s.set(r,b))},"addCredentialInIdx"),p=i(async v=>{let y=uc.array().parse(v),b=await o(r);return await Promise.all(y.map(async _=>{await e.read.get(_.uri);let T=b.credentials.findIndex(O=>O.id===_.id);T>-1?b.credentials[T]=_:b.credentials.push(_)})),Jm(await s.set(r,b))},"addCredentialsInIdx");return{name:"IDX",displayName:"IDX",description:"Stores a bespoke index of credentials for an individual based on their did",index:{get:async v=>(v.debug?.("learnCard.index.IDX.get"),(await o()).credentials),add:async(v,y)=>{v.debug?.("learnCard.index.IDX.add");try{return await h(y),!0}catch(b){return console.error("Error adding credential with IDX:",b),!1}},addMany:async(v,y)=>{v.debug?.("learnCard.index.IDX.add");try{return await p(y),!0}catch(b){return console.error("Error adding credential with IDX:",b),!1}},update:async v=>(v.debug?.("learnCard.index.IDX.update"),!1),remove:async(v,y)=>{v.debug?.("learnCard.index.IDX.remove");try{return await c(y),!0}catch(b){return console.error("Error removing credential from IDX:",b),!1}},removeAll:async v=>{v.debug?.("learnCard.index.IDX.removeAll");try{return await f(),!0}catch(y){return console.error("Error removing credentials from IDX:",y),!1}}},methods:{getCredentialsListFromIdx:async(v,y=r)=>(await o(y)).credentials,getVerifiableCredentialFromIdx:async(v,y)=>{let _=(await o())?.credentials?.find(R=>R?.id===y),T=v.read.get(_?.uri),O=await u0.safeParseAsync(T);return O.success?O.data:void 0},getVerifiableCredentialsFromIdx:async v=>{let b=(await o())?.credentials?.map(_=>_?.uri)??[];return(await Promise.all(b.map(async _=>v.read.get(_)))).filter(_=>!!_)},addVerifiableCredentialInIdx:async(v,y)=>{let b=uc.parse(y);if(!b)throw new Error("record is required");if(!b.uri)throw Error("No URI provided");await v.read.get(b.uri);let _=await o(r),T=_.credentials.findIndex(O=>O.id===b.id);return T>-1?_.credentials[T]=b:_.credentials.push(b),Jm(await s.set(r,_))},removeVerifiableCredentialInIdx:async(v,y)=>c(y),removeAllVerifiableCredentialsInIdx:async()=>f(),getIDXIndex:async()=>s.get(r),setIDXIndex:async(v,y)=>s.set(r,y)}}},"getIDXPlugin");var aK=Ym;
840
+ `):"",this.name="UnsubscriptionError",this.errors=r},"UnsubscriptionErrorImpl"),"UnsubscriptionErrorImpl")});function rd(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}i(rd,"arrRemove");a(rd,"arrRemove");var Cd=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,s,o;if(!this.closed){this.closed=!0;var c=this._parentage;if(c)if(this._parentage=null,Array.isArray(c))try{for(var f=_c(c),h=f.next();!h.done;h=f.next()){var p=h.value;p.remove(this)}}catch(O){t={error:O}}finally{try{h&&!h.done&&(r=f.return)&&r.call(f)}finally{if(t)throw t.error}}else c.remove(this);var v=this.initialTeardown;if(Ar(v))try{v()}catch(O){o=O instanceof Xb?O.errors:[O]}var y=this._finalizers;if(y){this._finalizers=null;try{for(var b=_c(y),_=b.next();!_.done;_=b.next()){var T=_.value;try{Ly(T)}catch(O){o=o??[],O instanceof Xb?o=vo(vo([],Ea(o)),Ea(O.errors)):o.push(O)}}}catch(O){n={error:O}}finally{try{_&&!_.done&&(s=b.return)&&s.call(b)}finally{if(n)throw n.error}}}if(o)throw new Xb(o)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)Ly(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)&&rd(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&rd(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}(),nI=Cd.EMPTY;function a6(e){return e instanceof Cd||e&&"closed"in e&&Ar(e.remove)&&Ar(e.add)&&Ar(e.unsubscribe)}i(a6,"isSubscription");a(a6,"isSubscription");function Ly(e){Ar(e)?e():e.unsubscribe()}i(Ly,"execFinalizer");a(Ly,"execFinalizer");var Pc={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Q0={setTimeout:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var s=Q0.delegate;return s?.setTimeout?s.setTimeout.apply(s,vo([e,t],Ea(r))):setTimeout.apply(void 0,vo([e,t],Ea(r)))},clearTimeout:function(e){var t=Q0.delegate;return(t?.clearTimeout||clearTimeout)(e)},delegate:void 0};function o6(e){Q0.setTimeout(function(){var t=Pc.onUnhandledError;if(t)t(e);else throw e})}i(o6,"reportUnhandledError");a(o6,"reportUnhandledError");function Fy(){}i(Fy,"noop");a(Fy,"noop");var Lz=function(){return zm("C",void 0,void 0)}();function iI(e){return zm("E",void 0,e)}i(iI,"errorNotification");a(iI,"errorNotification");function sI(e){return zm("N",e,void 0)}i(sI,"nextNotification");a(sI,"nextNotification");function zm(e,t,r){return{kind:e,value:t,error:r}}i(zm,"createNotification");a(zm,"createNotification");var mc=null;function Vf(e){if(Pc.useDeprecatedSynchronousErrorHandling){var t=!mc;if(t&&(mc={errorThrown:!1,error:null}),e(),t){var r=mc,n=r.errorThrown,s=r.error;if(mc=null,n)throw s}}else e()}i(Vf,"errorContext");a(Vf,"errorContext");function aI(e){Pc.useDeprecatedSynchronousErrorHandling&&mc&&(mc.errorThrown=!0,mc.error=e)}i(aI,"captureError");a(aI,"captureError");var c6=function(e){Ks(t,e);function t(r){var n=e.call(this)||this;return n.isStopped=!1,r?(n.destination=r,a6(r)&&r.add(n)):n.destination=$z,n}return i(t,"Subscriber2"),a(t,"Subscriber"),t.create=function(r,n,s){return new Uy(r,n,s)},t.prototype.next=function(r){this.isStopped?x0(sI(r),this):this._next(r)},t.prototype.error=function(r){this.isStopped?x0(iI(r),this):(this.isStopped=!0,this._error(r))},t.prototype.complete=function(){this.isStopped?x0(Lz,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}(Cd),Fz=Function.prototype.bind;function S0(e,t){return Fz.call(e,t)}i(S0,"bind");a(S0,"bind");var Uz=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){Hf(n)}},e.prototype.error=function(t){var r=this.partialObserver;if(r.error)try{r.error(t)}catch(n){Hf(n)}else Hf(t)},e.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(r){Hf(r)}},e}(),Uy=function(e){Ks(t,e);function t(r,n,s){var o=e.call(this)||this,c;if(Ar(r)||!r)c={next:r??void 0,error:n??void 0,complete:s??void 0};else{var f;o&&Pc.useDeprecatedNextContext?(f=Object.create(r),f.unsubscribe=function(){return o.unsubscribe()},c={next:r.next&&S0(r.next,f),error:r.error&&S0(r.error,f),complete:r.complete&&S0(r.complete,f)}):c=r}return o.destination=new Uz(c),o}return i(t,"SafeSubscriber2"),a(t,"SafeSubscriber"),t}(c6);function Hf(e){Pc.useDeprecatedSynchronousErrorHandling?aI(e):o6(e)}i(Hf,"handleUnhandledError");a(Hf,"handleUnhandledError");function oI(e){throw e}i(oI,"defaultErrorHandler");a(oI,"defaultErrorHandler");function x0(e,t){var r=Pc.onStoppedNotification;r&&Q0.setTimeout(function(){return r(e,t)})}i(x0,"handleStoppedNotification");a(x0,"handleStoppedNotification");var $z={closed:!0,next:Fy,error:oI,complete:Fy},u6=function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"}();function Hm(e){return e}i(Hm,"identity3");a(Hm,"identity");function cI(e){return e.length===0?Hm:e.length===1?e[0]:a(i(function(r){return e.reduce(function(n,s){return s(n)},r)},"piped"),"piped")}i(cI,"pipeFromArray");a(cI,"pipeFromArray");var ln=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 s=this,o=lI(t)?t:new Uy(t,r,n);return Vf(function(){var c=s,f=c.operator,h=c.source;o.add(f?f.call(o,h):h?s._subscribe(o):s._trySubscribe(o))}),o},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=$y(r),new r(function(s,o){var c=new Uy({next:function(f){try{t(f)}catch(h){o(h),c.unsubscribe()}},error:o,complete:s});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[u6]=function(){return this},e.prototype.pipe=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];return cI(t)(this)},e.prototype.toPromise=function(t){var r=this;return t=$y(t),new t(function(n,s){var o;r.subscribe(function(c){return o=c},function(c){return s(c)},function(){return n(o)})})},e.create=function(t){return new e(t)},e}();function $y(e){var t;return(t=e??Pc.Promise)!==null&&t!==void 0?t:Promise}i($y,"getPromiseCtor");a($y,"getPromiseCtor");function uI(e){return e&&Ar(e.next)&&Ar(e.error)&&Ar(e.complete)}i(uI,"isObserver");a(uI,"isObserver");function lI(e){return e&&e instanceof c6||uI(e)&&a6(e)}i(lI,"isSubscriber");a(lI,"isSubscriber");function fI(e){return Ar(e?.lift)}i(fI,"hasLift");a(fI,"hasLift");function Vs(e){return function(t){if(fI(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(Vs,"operate");a(Vs,"operate");function ds(e,t,r,n,s){return new jz(e,t,r,n,s)}i(ds,"createOperatorSubscriber");a(ds,"createOperatorSubscriber");var jz=function(e){Ks(t,e);function t(r,n,s,o,c,f){var h=e.call(this,r)||this;return h.onFinalize=c,h.shouldUnsubscribe=f,h._next=n?function(p){try{n(p)}catch(v){r.error(v)}}:e.prototype._next,h._error=o?function(p){try{o(p)}catch(v){r.error(v)}finally{this.unsubscribe()}}:e.prototype._error,h._complete=s?function(){try{s()}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}(c6),zz=jm(function(e){return a(i(function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"},"ObjectUnsubscribedErrorImpl"),"ObjectUnsubscribedErrorImpl")}),dI=function(e){Ks(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 PA(this,this);return n.operator=r,n},t.prototype._throwIfClosed=function(){if(this.closed)throw new zz},t.prototype.next=function(r){var n=this;Vf(function(){var s,o;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var c=_c(n.currentObservers),f=c.next();!f.done;f=c.next()){var h=f.value;h.next(r)}}catch(p){s={error:p}}finally{try{f&&!f.done&&(o=c.return)&&o.call(c)}finally{if(s)throw s.error}}}})},t.prototype.error=function(r){var n=this;Vf(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=r;for(var s=n.observers;s.length;)s.shift().error(r)}})},t.prototype.complete=function(){var r=this;Vf(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,s=this,o=s.hasError,c=s.isStopped,f=s.observers;return o||c?nI:(this.currentObservers=null,f.push(r),new Cd(function(){n.currentObservers=null,rd(f,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,s=n.hasError,o=n.thrownError,c=n.isStopped;s?r.error(o):c&&r.complete()},t.prototype.asObservable=function(){var r=new ln;return r.source=this,r},t.create=function(r,n){return new PA(r,n)},t}(ln),PA=function(e){Ks(t,e);function t(r,n){var s=e.call(this)||this;return s.destination=r,s.source=n,s}return i(t,"AnonymousSubject2"),a(t,"AnonymousSubject"),t.prototype.next=function(r){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.next)===null||s===void 0||s.call(n,r)},t.prototype.error=function(r){var n,s;(s=(n=this.destination)===null||n===void 0?void 0:n.error)===null||s===void 0||s.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,s;return(s=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&s!==void 0?s:nI},t}(dI),Hz=function(e){Ks(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,s=r.thrownError,o=r._value;if(n)throw s;return this._throwIfClosed(),o},t.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},t}(dI),hI={now:function(){return(hI.delegate||Date).now()},delegate:void 0},qz=function(e){Ks(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}(Cd),em={setInterval:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var s=em.delegate;return s?.setInterval?s.setInterval.apply(s,vo([e,t],Ea(r))):setInterval.apply(void 0,vo([e,t],Ea(r)))},clearInterval:function(e){var t=em.delegate;return(t?.clearInterval||clearInterval)(e)},delegate:void 0},Kz=function(e){Ks(t,e);function t(r,n){var s=e.call(this,r,n)||this;return s.scheduler=r,s.work=n,s.pending=!1,s}return i(t,"AsyncAction2"),a(t,"AsyncAction"),t.prototype.schedule=function(r,n){var s;if(n===void 0&&(n=0),this.closed)return this;this.state=r;var o=this.id,c=this.scheduler;return o!=null&&(this.id=this.recycleAsyncId(c,o,n)),this.pending=!0,this.delay=n,this.id=(s=this.id)!==null&&s!==void 0?s:this.requestAsyncId(c,this.id,n),this},t.prototype.requestAsyncId=function(r,n,s){return s===void 0&&(s=0),em.setInterval(r.flush.bind(r,this),s)},t.prototype.recycleAsyncId=function(r,n,s){if(s===void 0&&(s=0),s!=null&&this.delay===s&&this.pending===!1)return n;n!=null&&em.clearInterval(n)},t.prototype.execute=function(r,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var s=this._execute(r,n);if(s)return s;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},t.prototype._execute=function(r,n){var s=!1,o;try{this.work(r)}catch(c){s=!0,o=c||new Error("Scheduled action threw falsy error")}if(s)return this.unsubscribe(),o},t.prototype.unsubscribe=function(){if(!this.closed){var r=this,n=r.id,s=r.scheduler,o=s.actions;this.work=this.state=this.scheduler=null,this.pending=!1,rd(o,this),n!=null&&(this.id=this.recycleAsyncId(s,n,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(qz),BA=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=hI.now,e}(),Vz=function(e){Ks(t,e);function t(r,n){n===void 0&&(n=BA.now);var s=e.call(this,r,n)||this;return s.actions=[],s._active=!1,s}return i(t,"AsyncScheduler2"),a(t,"AsyncScheduler"),t.prototype.flush=function(r){var n=this.actions;if(this._active){n.push(r);return}var s;this._active=!0;do if(s=r.execute(r.state,r.delay))break;while(r=n.shift());if(this._active=!1,s){for(;r=n.shift();)r.unsubscribe();throw s}},t}(BA),Gz=new Vz(Kz),Wz=Gz,pI=new ln(function(e){return e.complete()});function l6(e){return e&&Ar(e.schedule)}i(l6,"isScheduler");a(l6,"isScheduler");function f6(e){return e[e.length-1]}i(f6,"last");a(f6,"last");function mI(e){return l6(f6(e))?e.pop():void 0}i(mI,"popScheduler");a(mI,"popScheduler");function vI(e,t){return typeof f6(e)=="number"?e.pop():t}i(vI,"popNumber");a(vI,"popNumber");var d6=a(function(e){return e&&typeof e.length=="number"&&typeof e!="function"},"isArrayLike");function h6(e){return Ar(e?.then)}i(h6,"isPromise");a(h6,"isPromise");function p6(e){return Ar(e[u6])}i(p6,"isInteropObservable");a(p6,"isInteropObservable");function m6(e){return Symbol.asyncIterator&&Ar(e?.[Symbol.asyncIterator])}i(m6,"isAsyncIterable");a(m6,"isAsyncIterable");function v6(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(v6,"createInvalidObservableTypeError");a(v6,"createInvalidObservableTypeError");function gI(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}i(gI,"getSymbolIterator");a(gI,"getSymbolIterator");var bI=gI();function g6(e){return Ar(e?.[bI])}i(g6,"isIterable");a(g6,"isIterable");function b6(e){return tI(this,arguments,a(i(function(){var r,n,s,o;return s6(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,yc(r.read())];case 3:return n=c.sent(),s=n.value,o=n.done,o?[4,yc(void 0)]:[3,5];case 4:return[2,c.sent()];case 5:return[4,yc(s)];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(b6,"readableStreamLikeToAsyncGenerator");a(b6,"readableStreamLikeToAsyncGenerator");function y6(e){return Ar(e?.getReader)}i(y6,"isReadableStreamLike");a(y6,"isReadableStreamLike");function Ma(e){if(e instanceof ln)return e;if(e!=null){if(p6(e))return yI(e);if(d6(e))return wI(e);if(h6(e))return _I(e);if(m6(e))return w6(e);if(g6(e))return EI(e);if(y6(e))return AI(e)}throw v6(e)}i(Ma,"innerFrom");a(Ma,"innerFrom");function yI(e){return new ln(function(t){var r=e[u6]();if(Ar(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}i(yI,"fromInteropObservable");a(yI,"fromInteropObservable");function wI(e){return new ln(function(t){for(var r=0;r<e.length&&!t.closed;r++)t.next(e[r]);t.complete()})}i(wI,"fromArrayLike");a(wI,"fromArrayLike");function _I(e){return new ln(function(t){e.then(function(r){t.closed||(t.next(r),t.complete())},function(r){return t.error(r)}).then(null,o6)})}i(_I,"fromPromise");a(_I,"fromPromise");function EI(e){return new ln(function(t){var r,n;try{for(var s=_c(e),o=s.next();!o.done;o=s.next()){var c=o.value;if(t.next(c),t.closed)return}}catch(f){r={error:f}}finally{try{o&&!o.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}t.complete()})}i(EI,"fromIterable");a(EI,"fromIterable");function w6(e){return new ln(function(t){SI(e,t).catch(function(r){return t.error(r)})})}i(w6,"fromAsyncIterable");a(w6,"fromAsyncIterable");function AI(e){return w6(b6(e))}i(AI,"fromReadableStreamLike");a(AI,"fromReadableStreamLike");function SI(e,t){var r,n,s,o;return eI(this,void 0,void 0,function(){var c,f;return s6(this,function(h){switch(h.label){case 0:h.trys.push([0,5,6,11]),r=rI(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 f=h.sent(),s={error:f},[3,11];case 6:return h.trys.push([6,,9,10]),n&&!n.done&&(o=r.return)?[4,o.call(r)]:[3,8];case 7:h.sent(),h.label=8;case 8:return[3,10];case 9:if(s)throw s.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}})})}i(SI,"process2");a(SI,"process");function ya(e,t,r,n,s){n===void 0&&(n=0),s===void 0&&(s=!1);var o=t.schedule(function(){r(),s?e.add(this.schedule(null,n)):this.unsubscribe()},n);if(e.add(o),!s)return o}i(ya,"executeSchedule");a(ya,"executeSchedule");function _6(e,t){return t===void 0&&(t=0),Vs(function(r,n){r.subscribe(ds(n,function(s){return ya(n,e,function(){return n.next(s)},t)},function(){return ya(n,e,function(){return n.complete()},t)},function(s){return ya(n,e,function(){return n.error(s)},t)}))})}i(_6,"observeOn");a(_6,"observeOn");function E6(e,t){return t===void 0&&(t=0),Vs(function(r,n){n.add(e.schedule(function(){return r.subscribe(n)},t))})}i(E6,"subscribeOn");a(E6,"subscribeOn");function xI(e,t){return Ma(e).pipe(E6(t),_6(t))}i(xI,"scheduleObservable");a(xI,"scheduleObservable");function TI(e,t){return Ma(e).pipe(E6(t),_6(t))}i(TI,"schedulePromise");a(TI,"schedulePromise");function MI(e,t){return new ln(function(r){var n=0;return t.schedule(function(){n===e.length?r.complete():(r.next(e[n++]),r.closed||this.schedule())})})}i(MI,"scheduleArray");a(MI,"scheduleArray");function CI(e,t){return new ln(function(r){var n;return ya(r,t,function(){n=e[bI](),ya(r,t,function(){var s,o,c;try{s=n.next(),o=s.value,c=s.done}catch(f){r.error(f);return}c?r.complete():r.next(o)},0,!0)}),function(){return Ar(n?.return)&&n.return()}})}i(CI,"scheduleIterable");a(CI,"scheduleIterable");function A6(e,t){if(!e)throw new Error("Iterable cannot be null");return new ln(function(r){ya(r,t,function(){var n=e[Symbol.asyncIterator]();ya(r,t,function(){n.next().then(function(s){s.done?r.complete():r.next(s.value)})},0,!0)})})}i(A6,"scheduleAsyncIterable");a(A6,"scheduleAsyncIterable");function II(e,t){return A6(b6(e),t)}i(II,"scheduleReadableStreamLike");a(II,"scheduleReadableStreamLike");function kI(e,t){if(e!=null){if(p6(e))return xI(e,t);if(d6(e))return MI(e,t);if(h6(e))return TI(e,t);if(m6(e))return A6(e,t);if(g6(e))return CI(e,t);if(y6(e))return II(e,t)}throw v6(e)}i(kI,"scheduled");a(kI,"scheduled");function DI(e,t){return t?kI(e,t):Ma(e)}i(DI,"from3");a(DI,"from");var OI=jm(function(e){return a(i(function(){e(this),this.name="EmptyError",this.message="no elements in sequence"},"EmptyErrorImpl"),"EmptyErrorImpl")});function RI(e){return e instanceof Date&&!isNaN(e)}i(RI,"isValidDate");a(RI,"isValidDate");function S6(e,t){return Vs(function(r,n){var s=0;r.subscribe(ds(n,function(o){n.next(e.call(t,o,s++))}))})}i(S6,"map");a(S6,"map");var Zz=Array.isArray;function NI(e,t){return Zz(t)?e.apply(void 0,vo([],Ea(t))):e(t)}i(NI,"callOrApply");a(NI,"callOrApply");function PI(e){return S6(function(t){return NI(e,t)})}i(PI,"mapOneOrManyArgs");a(PI,"mapOneOrManyArgs");function BI(e,t,r,n,s,o,c,f){var h=[],p=0,v=0,y=!1,b=a(function(){y&&!h.length&&!p&&t.complete()},"checkComplete"),_=a(function(O){return p<n?T(O):h.push(O)},"outerNext"),T=a(function(O){o&&t.next(O),p++;var R=!1;Ma(r(O,v++)).subscribe(ds(t,function(P){s?.(P),o?_(P):t.next(P)},function(){R=!0},void 0,function(){if(R)try{p--;for(var P=a(function(){var K=h.shift();c?ya(t,c,function(){return T(K)}):T(K)},"_loop_1");h.length&&p<n;)P();b()}catch(K){t.error(K)}}))},"doInnerSub");return e.subscribe(ds(t,_,function(){y=!0,b()})),function(){f?.()}}i(BI,"mergeInternals");a(BI,"mergeInternals");function qm(e,t,r){return r===void 0&&(r=1/0),Ar(t)?qm(function(n,s){return S6(function(o,c){return t(n,o,s,c)})(Ma(e(n,s)))},r):(typeof t=="number"&&(r=t),Vs(function(n,s){return BI(n,s,e,r)}))}i(qm,"mergeMap");a(qm,"mergeMap");function LI(e){return e===void 0&&(e=1/0),qm(Hm,e)}i(LI,"mergeAll");a(LI,"mergeAll");var Jz=["addListener","removeListener"],Yz=["addEventListener","removeEventListener"],Xz=["on","off"];function tm(e,t,r,n){if(Ar(r)&&(n=r,r=void 0),n)return tm(e,t,r).pipe(PI(n));var s=Ea($I(e)?Yz.map(function(f){return function(h){return e[f](t,h,r)}}):FI(e)?Jz.map(jy(e,t)):UI(e)?Xz.map(jy(e,t)):[],2),o=s[0],c=s[1];if(!o&&d6(e))return qm(function(f){return tm(f,t,r)})(Ma(e));if(!o)throw new TypeError("Invalid event target");return new ln(function(f){var h=a(function(){for(var p=[],v=0;v<arguments.length;v++)p[v]=arguments[v];return f.next(1<p.length?p:p[0])},"handler");return o(h),function(){return c(h)}})}i(tm,"fromEvent");a(tm,"fromEvent");function jy(e,t){return function(r){return function(n){return e[r](t,n)}}}i(jy,"toCommonHandlerRegistry");a(jy,"toCommonHandlerRegistry");function FI(e){return Ar(e.addListener)&&Ar(e.removeListener)}i(FI,"isNodeStyleEventEmitter");a(FI,"isNodeStyleEventEmitter");function UI(e){return Ar(e.on)&&Ar(e.off)}i(UI,"isJQueryStyleEventEmitter");a(UI,"isJQueryStyleEventEmitter");function $I(e){return Ar(e.addEventListener)&&Ar(e.removeEventListener)}i($I,"isEventTarget");a($I,"isEventTarget");function x6(e,t,r){e===void 0&&(e=0),r===void 0&&(r=Wz);var n=-1;return t!=null&&(l6(t)?r=t:n=t),new ln(function(s){var o=RI(e)?+e-r.now():e;o<0&&(o=0);var c=0;return r.schedule(function(){s.closed||(s.next(c++),0<=n?this.schedule(void 0,n):s.complete())},o)})}i(x6,"timer");a(x6,"timer");function jI(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=mI(e),n=vI(e,1/0),s=e;return s.length?s.length===1?Ma(s[0]):LI(n)(DI(s,r)):pI}i(jI,"merge");a(jI,"merge");function zI(e,t){return Vs(function(r,n){var s=0;r.subscribe(ds(n,function(o){return e.call(t,o,s++)&&n.next(o)}))})}i(zI,"filter");a(zI,"filter");function HI(e){return Vs(function(t,r){var n=!1;t.subscribe(ds(r,function(s){n=!0,r.next(s)},function(){n||r.next(e),r.complete()}))})}i(HI,"defaultIfEmpty");a(HI,"defaultIfEmpty");function qI(e){return e<=0?function(){return pI}:Vs(function(t,r){var n=0;t.subscribe(ds(r,function(s){++n<=e&&(r.next(s),e<=n&&r.complete())}))})}i(qI,"take");a(qI,"take");function KI(e){return e===void 0&&(e=VI),Vs(function(t,r){var n=!1;t.subscribe(ds(r,function(s){n=!0,r.next(s)},function(){return n?r.complete():r.error(e())}))})}i(KI,"throwIfEmpty");a(KI,"throwIfEmpty");function VI(){return new OI}i(VI,"defaultErrorFactory");a(VI,"defaultErrorFactory");function GI(e,t){var r=arguments.length>=2;return function(n){return n.pipe(e?zI(function(s,o){return e(s,o,n)}):Hm,qI(1),r?HI(t):KI(function(){return new OI}))}}i(GI,"first");a(GI,"first");function WI(e,t){return Vs(function(r,n){var s=t??{},o=s.leading,c=o===void 0?!0:o,f=s.trailing,h=f===void 0?!1:f,p=!1,v=null,y=null,b=!1,_=a(function(){y?.unsubscribe(),y=null,h&&(R(),b&&n.complete())},"endThrottling"),T=a(function(){y=null,b&&n.complete()},"cleanupThrottling"),O=a(function(P){return y=Ma(e(P)).subscribe(ds(n,_,T))},"startThrottle"),R=a(function(){if(p){p=!1;var P=v;v=null,n.next(P),!b&&O(P)}},"send");r.subscribe(ds(n,function(P){p=!0,v=P,!(y&&!y.closed)&&(c?R():O(P))},function(){b=!0,!(h&&p&&y&&!y.closed)&&n.complete()}))})}i(WI,"throttle");a(WI,"throttle");var LA;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(LA||(LA={}));var rm;(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"})(rm||(rm={}));var zy;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(zy||(zy={}));var Km=i(class extends ln{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,IA.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Er.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Er.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===zy.ANCHOR).map(({cid:e})=>Er.make(this.id,e))}get state(){return(0,IA.default)(this.state$.value)}async sync(e={}){e={sync:Yn.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(Km,"Stream");function Vm(){return e=>{}}i(Vm,"StreamStatic");a(Vm,"StreamStatic");var Qz=rr(L$(),1);function ZI(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):(jI(...e.map(r=>tm(r,"abort"))).pipe(GI()).subscribe(()=>{t.abort()}),t.signal)}i(ZI,"mergeAbortSignals");a(ZI,"mergeAbortSignals");var JI=i(class{constructor(e){let t=new AbortController;if(this.signal=t.signal,e<=0){t.abort();return}this._subscription=x6(e).subscribe(()=>{t.abort()})}clear(){this._subscription?.unsubscribe()}},"TimedAbortSignal");a(JI,"TimedAbortSignal");async function YI(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(YI,"abortable2");a(YI,"abortable");var eH=60*1e3*3;async function gi(e,t={}){t.body&&Object.assign(t,{body:JSON.stringify(t.body),headers:{...t.headers,"Content-Type":"application/json"}});let r=t.timeout||eH,n=new JI(r),s=t.signal?ZI([t.signal,n.signal]):n.signal,o=await YI(s,c=>(0,Qz.default)(String(e),{...t,signal:c})).finally(()=>n.clear());if(!o.ok){let c=await o.text();throw new Error(`HTTP request to '${e}' failed with status '${o.statusText}': ${c}`)}return o.json()}i(gi,"fetchJson");a(gi,"fetchJson");var p0=rr(bd(),1);js();function ga(e){let t=jt.asCID(e);if(t)return t;if(typeof e=="string")return jt.parse(e);if(e instanceof Uint8Array)return jt.decode(e);throw new Error(`${e} cannot be converted to a CID`)}i(ga,"toCID");a(ga,"toCID");var FA=0,jr=i(class{static streamIdFromState(e){return new Xt(e.type,e.log[0].cid)}static serializeCommit(e){let t=(0,p0.default)(e);return jr.isSignedCommitContainer(t)?(t.jws.link=t.jws.link.toString(),t.linkedBlock=Mr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=Mr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(e)&&(t.link=t.link.toString()),jr.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=Mr(e.header.model,"base64")),t)}static deserializeCommit(e){let t=(0,p0.default)(e);return jr.isSignedCommitContainer(t)?(t.jws.link=ga(t.jws.link),t.linkedBlock=yr(t.linkedBlock,"base64"),t.cacaoBlock&&(t.cacaoBlock=yr(t.cacaoBlock,"base64")),t):(jr.isSignedCommit(t)&&(t.link=ga(t.link)),jr.isAnchorCommit(t)&&(t.proof=ga(t.proof)),t.id&&(t.id=ga(t.id)),t.prev&&(t.prev=ga(t.prev)),t.header?.model&&(t.header.model=yr(t.header.model,"base64")),t)}static serializeState(e){let t=(0,p0.default)(e);return t.log=t.log.map(r=>({...r,cid:r.cid.toString()})),t.anchorStatus!=null&&(t.anchorStatus=rm[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!=FA&&(t.metadata.unique=Mr(t.metadata.unique,"base64")),t.doctype=_a.nameByCode(t.type),t}static deserializeState(e){if(!e)return null;let t=(0,p0.default)(e);return t.doctype&&(t.type=_a.codeByName(t.doctype),delete t.doctype),t.log=t.log.map(r=>({...r,cid:ga(r.cid)})),t.anchorProof&&(t.anchorProof.txHash=ga(t.anchorProof.txHash),t.anchorProof.root=ga(t.anchorProof.root)),t.anchorStatus&&(t.anchorStatus=rm[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!=FA&&(t.metadata.unique=yr(e.metadata.unique,"base64")),t}static statesEqual(e,t){return JSON.stringify(jr.serializeState(e))===JSON.stringify(jr.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(jr.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(jr,"StreamUtils");var XI=i(class extends Hz{next(e){let t=this.value;jr.statesEqual(t,e)||super.next(e)}},"StreamStateSubject");a(XI,"StreamStateSubject");var tH=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate3"),mi,Qb={anchor:!0,publish:!0,pin:!0,sync:Yn.PREFER_CACHE},rH={sync:Yn.PREFER_CACHE},UA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};function T0(e,t){if(typeof e?.schema=="string")try{Er.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=Mr((0,Pz.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(T0,"headerFromMetadata");a(T0,"headerFromMetadata");async function Hy(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(Hy,"getAuthenticatedDID");a(Hy,"getAuthenticatedDID");async function M0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(M0,"throwReadOnlyError");a(M0,"throwReadOnlyError");var Aa=mi=a(i(class extends Km{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,Nz.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async create(t,r,n,s={}){s={...Qb,...s},!n?.deterministic&&s.syncTimeoutSeconds==null&&(s.syncTimeoutSeconds=0);let o=s.asDID?{did:s.asDID}:t,c=await mi.makeGenesis(o,r,n);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,c,s)}static async createFromGenesis(t,r,n={}){n={...Qb,...n},r.header?.unique&&n.syncTimeoutSeconds==null&&(n.syncTimeoutSeconds=0);let s=r.data?await mi._signDagJWS(t,r):r;return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,s,n)}static async deterministic(t,r,n={}){if(n={...Qb,...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 s=await mi.makeGenesis(t,null,r);return t.createStreamFromGenesis(mi.STREAM_TYPE_ID,s,n)}static async load(t,r,n={}){n={...rH,...n};let s=mo.from(r);if(s.type!=mi.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${mi.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return t.loadStream(s,n)}async update(t,r,n={}){n={...UA,...n};let s=n.asDID?{did:n.asDID}:this.api,o=await this.makeCommit(s,t,r),c=await this.api.applyCommit(this.id,o,n);this.state$.next(c.state)}async patch(t,r={}){r={...UA,...r};let s={header:T0(this.metadata,!1),data:t,prev:this.tip,id:this.id.cid},o=await mi._signDagJWS(this.api,s),c=await this.api.applyCommit(this.id,o,r);this.state$.next(c.state)}makeReadOnly(){this.update=M0,this.patch=M0,this.sync=M0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}async makeCommit(t,r,n){let s=await this._makeRawCommit(r,n);return mi._signDagJWS(t,s)}async _makeRawCommit(t,r){r||(r={});let n=T0(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 s=UC.compare(this.content,t),o=this.state.log[0];return{header:n,data:s,prev:this.tip,id:o.cid}}static async makeGenesis(t,r,n){if(n||(n={}),!n.controllers||n.controllers.length===0)if(t.did){let c=await Hy(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 s=T0(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:s};return Om(c),c}let o={data:r,header:s};return mi._signDagJWS(t,o)}static async _signDagJWS(t,r){return(await Hy(t)).createDagJWS(r)}},"TileDocument2"),"TileDocument");Aa.STREAM_TYPE_NAME="tile";Aa.STREAM_TYPE_ID=0;Aa=mi=tH([Vm()],Aa);var nH=rr(F$(),1);function QI(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}i(QI,"_checkPrivateRedeclaration2");a(QI,"_checkPrivateRedeclaration");function ek(e,t){return t.get?t.get.call(e):t.value}i(ek,"_classApplyDescriptorGet2");a(ek,"_classApplyDescriptorGet");function tk(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(tk,"_classApplyDescriptorSet2");a(tk,"_classApplyDescriptorSet");function T6(e,t,r){if(!t.has(e))throw new TypeError("attempted to "+r+" private field on non-instance");return t.get(e)}i(T6,"_classExtractFieldDescriptor2");a(T6,"_classExtractFieldDescriptor");function C0(e,t){var r=T6(e,t,"get");return ek(e,r)}i(C0,"_classPrivateFieldGet2");a(C0,"_classPrivateFieldGet");function qy(e,t,r){QI(e,t),t.set(e,r)}i(qy,"_classPrivateFieldInit2");a(qy,"_classPrivateFieldInit");function Ky(e,t,r){var n=T6(e,t,"set");return tk(e,n,r),r}i(Ky,"_classPrivateFieldSet2");a(Ky,"_classPrivateFieldSet");function rk(e){return typeof e=="string"||Er.isInstance(e)||Xt.isInstance(e)?{streamId:e}:{streamId:e.streamId,genesis:e.genesis}}i(rk,"keyToQuery");a(rk,"keyToQuery");function I0(e){return typeof e=="string"?mo.from(e).toString():Er.isInstance(e)||Xt.isInstance(e)?e.toString():e.streamId.toString()}i(I0,"keyToString");a(I0,"keyToString");async function nk(e){let t=await Aa.makeGenesis({},null,{...e,deterministic:!0}),r=await Xt.fromGenesis("tile",t);return{genesis:t,streamId:r}}i(nk,"getDeterministicQuery");a(nk,"getDeterministicQuery");var iH=a(()=>Promise.resolve([]),"tempBatchLoadFn"),m0=new WeakMap,ey=new WeakMap,sH=i(class extends nH.default{cache(e){if(!C0(this,ey))return!1;let t=e.id.toString();return this.clear(t).prime(t,e),!0}async create(e,t,r){let n=await Aa.create(C0(this,m0),e,t,r);return this.cache(n),n}async deterministic(e,t){let r=await nk(e);try{return await super.load(r)}catch{let s=await Aa.createFromGenesis(C0(this,m0),r.genesis,t);return this.cache(s),s}}async load(e){return await super.load(e)}async update(e,t,r,n){let s=I0(e);this.clear(s);let o=await this.load({streamId:s});return await o.update(t,r,n),o}constructor(e){super(iH,{cache:!0,cacheKeyFn:I0,cacheMap:e.cache!=null&&typeof e.cache!="boolean"?e.cache:void 0}),qy(this,m0,{writable:!0,value:void 0}),qy(this,ey,{writable:!0,value:void 0}),this._batchLoadFn=async t=>{e.cache||this.clearAll();let r=await e.ceramic.multiQuery(t.map(rk),e.multiqueryTimeout);return t.map(n=>{let s=I0(n),o=r[s];return o||new Error(`Failed to load stream: ${s}`)})},Ky(this,m0,e.ceramic),Ky(this,ey,!!e.cache)}},"TileLoader");a(sH,"TileLoader");function Vy(e){return typeof e=="string"?Xt.fromString(e):e}i(Vy,"typeStreamID");a(Vy,"typeStreamID");function ik(e,t){let r=new URL(e);for(let[n,s]of Object.entries(t))Xt.isInstance(s)?r.searchParams.set(n,s.toString()):typeof s=="object"?r.searchParams.set(n,JSON.stringify(s)):r.searchParams.set(n,s);return r}i(ik,"serializeObjectToSearchParams");a(ik,"serializeObjectToSearchParams");function Gy(e){let t={};for(let[r,n]of Object.entries(e))Xt.isInstance(n)?t[r]=n.toString():t[r]=n;return t}i(Gy,"serializeObjectForHttpPost");a(Gy,"serializeObjectForHttpPost");var ji=i(class extends ln{constructor(e,t,r){super(n=>{this.state$.observers.length===0&&(this.periodicSubscription=x6(0,r).pipe(WI(()=>this._syncState(this.id,{sync:Yn.PREFER_CACHE}))).subscribe()),this.state$.subscribe(n).add(()=>{this.state$.observers.length===0&&this.periodicSubscription?.unsubscribe()})}),this.state$=new XI(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 ji._load(e,this._apiUrl,t);this.state$.next(jr.deserializeState(r))}get id(){return new Xt(this.state$.value.type,this.state$.value.log[0].cid)}static async createFromGenesis(e,t,r,n,s){let o=new URL("./streams",e),{state:c}=await gi(o,{method:"post",body:{type:t,genesis:jr.serializeCommit(r),opts:n}});return new ji(jr.deserializeState(c),e,s)}static async applyCommit(e,t,r,n,s){let o=new URL("./commits",e),{state:c}=await gi(o,{method:"post",body:{streamId:t.toString(),commit:jr.serializeCommit(r),opts:n}});return new ji(jr.deserializeState(c),e,s)}static async _load(e,t,r){let n=ik(new URL(`./streams/${e}`,t),r),{state:s}=await gi(n);return s}static async load(e,t,r,n){let s=await ji._load(e,t,n);return new ji(jr.deserializeState(s),t,r)}static async loadStreamCommits(e,t){let r=new URL(`./commits/${e}`,t),{commits:n}=await gi(r);return n.map(s=>({cid:s.cid,value:jr.deserializeCommit(s.value)}))}complete(){this.state$.complete()}},"Document");a(ji,"Document");var nd;(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"})(nd||(nd={}));var $A=rr(bd(),1),jA;(function(e){e[e.GENESIS=0]="GENESIS",e[e.PARTIAL=1]="PARTIAL",e[e.SIGNED=2]="SIGNED"})(jA||(jA={}));var Wy;(function(e){e[e.GENESIS=0]="GENESIS",e[e.SIGNED=1]="SIGNED",e[e.ANCHOR=2]="ANCHOR"})(Wy||(Wy={}));var sk=i(class extends ln{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,$A.default)(e?.content??t)}get tip(){return this.state$.value.log[this.state$.value.log.length-1].cid}get commitId(){return Er.make(this.id,this.tip)}get allCommitIds(){return this.state$.value.log.map(({cid:e})=>Er.make(this.id,e))}get anchorCommitIds(){return this.state$.value.log.filter(({type:e})=>e===Wy.ANCHOR).map(({cid:e})=>Er.make(this.id,e))}get state(){return(0,$A.default)(this.state$.value)}async sync(e={}){e={sync:nd.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(sk,"Stream");function ak(){return e=>{}}i(ak,"StreamStatic2");a(ak,"StreamStatic");function ok(e){if(typeof e=="string"&&e.includes("@")){let[t,r]=e.split("@");if(!t||!r)throw new Error("Invalid accountId provided");return new Uu({address:t,chainId:r})}return new Uu(e)}i(ok,"normalizeAccountId");a(ok,"normalizeAccountId");var aH="(?:%[0-9a-fA-F]{2})",zA=`(?:[a-zA-Z0-9._-]|${aH})`,oH="([a-z0-9]+)",cH=`((?:${zA}*:)*(${zA}+))`,HA="[a-zA-Z0-9_.:%-]",uH=`;${HA}+=${HA}*`,lH=`((${uH})*)`,fH="(/[^#?]*)?",dH="([?][^#]*)?",hH="(#.*)?",pH=new RegExp(`^did:${oH}:${cH}${lH}${fH}${dH}${hH}$`);function ck(e){if(e===""||!e)return null;let t=e.match(pH);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 s of n){let o=s.split("=");r.params[o[0]]=o[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(ck,"parse2");a(ck,"parse");var mH=rr(bd(),1),vH=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate4"),dc,ty=a(()=>{throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")},"throwReadOnlyError"),qA={anchor:!1,publish:!0,sync:nd.PREFER_CACHE},ry={anchor:!0,publish:!0},gH={sync:nd.PREFER_CACHE},ju=dc=a(i(class extends sk{constructor(){super(...arguments),this._isReadOnly=!1}get did(){return this.content}get metadata(){let{next:t,metadata:r}=this.state$.value;return(0,mH.default)(t?.metadata??r)}get controllers(){return this.metadata.controllers}static async fromAccount(t,r,n={}){n={...qA,...n};let s=ok(r),o=dc.makeGenesis(s);return dc.fromGenesis(t,o,n)}static async fromGenesis(t,r,n={}){return n={...qA,...n},t.createStreamFromGenesis(dc.STREAM_TYPE_ID,r,n)}async setDid(t,r,n={}){n={...ry,...n};let s=typeof t=="string"?t.trim():t.id;if(ck(s)?.did!==s)throw new Error(`DID is not valid: '${s}'`);let c=await r.createLink(s);return this.setDidProof(c,n)}async setDidProof(t,r={}){r={...ry,...r};let n=this.makeCommit(t),s=await this.api.applyCommit(this.id,n,r);this.state$.next(s.state)}async clearDid(t,r={}){r={...ry,...r};let n=await t.createLink("");return this.setDidProof(n,r)}static async load(t,r,n={}){n={...gH,...n};let s=mo.from(r);if(s.type!=dc.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${dc.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return t.loadStream(s,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=ty,this.setDid=ty,this.sync=ty,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}},"Caip10Link2"),"Caip10Link");ju.STREAM_TYPE_NAME="caip10-link";ju.STREAM_TYPE_ID=1;ju=dc=vH([ak()],ju);js();el();var bH=rr(Z$(),1),yH=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate5"),Bs,wH={sync:Yn.PREFER_CACHE};async function Zy(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(Zy,"_ensureAuthenticated");a(Zy,"_ensureAuthenticated");async function uk(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(uk,"throwReadOnlyError3");a(uk,"throwReadOnlyError");var Ec=Bs=a(i(class extends Km{constructor(){super(...arguments),this._isReadOnly=!1}get content(){return super.content}get metadata(){return{controller:this.state$.value.metadata.controllers[0],model:Bs.MODEL}}static async create(t,r,n){Bs.assertComplete(r);let s={publish:!0,anchor:!0,pin:!0,sync:Yn.NEVER_SYNC,throwOnInvalidCommit:!0},o=await Bs._makeGenesis(t,r,n);return await t.createStreamFromGenesis(Bs.STREAM_TYPE_ID,o,s)}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={...wH,...n};let s=mo.from(r);if(s.type!=Bs.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${Bs.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return await t.loadStream(s,n)}static async _makeGenesis(t,r,n){let s=await this._makeRawGenesis(t,r,n);return Bs._signDagJWS(t,s)}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 Zy(t),n={controller:t.did.hasParent?t.did.parent:t.did.id};else throw new Error("No controller specified");let s={controllers:[n.controller],model:Bs.MODEL.bytes};return{data:r,header:s}}makeReadOnly(){this.sync=uk,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}static async _signDagJWS(t,r){return await Zy(t),t.did.createDagJWS(r)}},"Model2"),"Model");Ec.STREAM_TYPE_NAME="model";Ec.STREAM_TYPE_ID=2;Ec.MODEL=function(){let e=Om("model-v1"),t=bH.default.encode(e,"identity"),r=Lu($0,t),n=jt.createV1($0,r);return new Xt("UNLOADABLE",n)}();Ec=Bs=yH([Vm()],Ec);var _H=rr(nl(),1),EH=i(function(e,t,r,n){var s=arguments.length,o=s<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,c;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")o=Reflect.decorate(e,t,r,n);else for(var f=e.length-1;f>=0;f--)(c=e[f])&&(o=(s<3?c(o):s>3?c(t,r,o):c(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},"__decorate6"),ns,AH={anchor:!0,publish:!0,pin:!0,sync:Yn.NEVER_SYNC,syncTimeoutSeconds:0},SH={anchor:!1,publish:!1,pin:!0,sync:Yn.PREFER_CACHE},xH={sync:Yn.PREFER_CACHE},KA={anchor:!0,publish:!0,throwOnInvalidCommit:!0};async function Jy(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(Jy,"_ensureAuthenticated2");a(Jy,"_ensureAuthenticated");async function k0(){throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.")}i(k0,"throwReadOnlyError4");a(k0,"throwReadOnlyError");var zu=ns=a(i(class extends Km{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,s={}){s={...AH,...s};let o=s.asDID?{did:s.asDID}:t,c=await ns._makeGenesis(o,r,n);return t.createStreamFromGenesis(ns.STREAM_TYPE_ID,c,s)}static async single(t,r,n={}){n={...SH,...n};let s=n.asDID?{did:n.asDID}:t;r={...r,deterministic:!0};let o=await ns._makeGenesis(s,null,r);return t.createStreamFromGenesis(ns.STREAM_TYPE_ID,o,n)}static async load(t,r,n={}){n={...xH,...n};let s=mo.from(r);if(s.type!=ns.STREAM_TYPE_ID)throw new Error(`StreamID ${s.toString()} does not refer to a '${ns.STREAM_TYPE_NAME}' stream, but to a ${s.typeName}`);return t.loadStream(s,n)}async replace(t,r={}){r={...KA,...r};let n=r.asDID?{did:r.asDID}:this.api,s=await this._makeCommit(n,t),o=await this.api.applyCommit(this.id,s,r);this.state$.next(o.state)}async patch(t,r={}){r={...KA,...r};let n={data:t,prev:this.tip,id:this.id.cid},s=await ns._signDagJWS(this.api,n),o=await this.api.applyCommit(this.id,s,r);this.state$.next(o.state)}makeReadOnly(){this.replace=k0,this.patch=k0,this.sync=k0,this._isReadOnly=!0}get isReadOnly(){return this._isReadOnly}_makeCommit(t,r){let n=this._makeRawCommit(r);return ns._signDagJWS(t,n)}_makeRawCommit(t){return{data:UC.compare(this.content,t||{}),prev:this.tip,id:this.state.log[0].cid}}static async _makeGenesis(t,r,n){let s=await this._makeRawGenesis(t,r,n);return n.deterministic?(Om(s),s):ns._signDagJWS(t,s)}static async _makeRawGenesis(t,r,n){if(!n.model)throw new Error("Must specify a 'model' when creating a ModelInstanceDocument");let s=n.controller;if(!s)if(t.did)await Jy(t),s=t.did.hasParent?t.did.parent:t.did.id;else throw new Error("No controller specified");let o={controllers:[s],model:n.model.bytes};return n.deterministic||(o.unique=(0,_H.randomBytes)(12)),{data:r,header:o}}static async _signDagJWS(t,r){return await Jy(t),t.did.createDagJWS(r)}},"ModelInstanceDocument2"),"ModelInstanceDocument");zu.STREAM_TYPE_NAME="MID";zu.STREAM_TYPE_ID=3;zu=ns=EH([Vm()],zu);var lk=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 gi(n,{method:"post",body:r})}async rm(e,t){let r=new URL(`./pins/${e}`,this._apiUrl);await gi(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 gi(t),{pinnedStreamIds:n}=r;return{[Symbol.asyncIterator](){let s=0;return{next(){return s===n.length?Promise.resolve({value:null,done:!0}):Promise.resolve({value:n[s++],done:!1})}}}}}},"RemotePinApi");a(lk,"RemotePinApi");var fk=i(class{constructor(e){this._fetchJson=gi,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:Gy(e)})).count}async query(e){let t=await this._fetchJson(this._collectionURL,{method:"POST",body:Gy(e)});return{edges:t.edges.map(n=>({cursor:n.cursor,node:jr.deserializeState(n.node)})),pageInfo:t.pageInfo}}},"RemoteIndexApi");a(fk,"RemoteIndexApi");var dk=i(class{constructor(e,t){this._apiUrl=e,this._getDidFn=t,this._fetchJson=gi,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(o=>o.toString())}:void 0,s=await e.createJWS({code:t,requestPath:this.getModelsUrl().pathname,requestBody:n});return`${s.signatures[0].protected}.${s.payload}.${s.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(dk,"RemoteAdminApi");var TH="/api/v0/",MH="http://localhost:7007",CH={syncInterval:5e3},IH={anchor:!0,publish:!0,sync:Yn.PREFER_CACHE},kH={anchor:!0,publish:!0,sync:Yn.PREFER_CACHE},VA={sync:Yn.PREFER_CACHE},DH=i(class{constructor(e=MH,t={}){this._config={...CH,...t},this._apiUrl=new URL(TH,e),this._streamCache=new Map,this.context={api:this},this.pin=new lk(this._apiUrl),this.index=new fk(this._apiUrl);let r=(()=>this.did).bind(this);this.admin=new dk(this._apiUrl,r),this._streamConstructors={[ju.STREAM_TYPE_ID]:ju,[Ec.STREAM_TYPE_ID]:Ec,[zu.STREAM_TYPE_ID]:zu,[Aa.STREAM_TYPE_ID]:Aa}}get did(){return this.context.did}set did(e){this.context.did=e}async createStreamFromGenesis(e,t,r={}){r={...kH,...r};let n=await ji.createFromGenesis(this._apiUrl,e,t,r,this._config.syncInterval),s=this._streamCache.get(n.id.toString());return s?(jr.statesEqual(n.state,s.state)||s.next(n.state),this.buildStreamFromDocument(s)):(this._streamCache.set(n.id.toString(),n),this.buildStreamFromDocument(n))}async loadStream(e,t={}){t={...VA,...t};let r=mo.from(e),n=this._streamCache.get(r.baseID.toString());return n?await n._syncState(r,t):(n=await ji.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(o=>({...o,streamId:typeof o.streamId=="string"?o.streamId:o.streamId.toString()})),n=new URL("./multiqueries",this._apiUrl),s=await gi(n,{method:"post",body:{queries:r,timeout:t}});return Object.entries(s).reduce((o,c)=>{let[f,h]=c,p=jr.deserializeState(h),v=new ji(p,this._apiUrl,this._config.syncInterval);return o[f]=this.buildStreamFromDocument(v),o},{})}loadStreamCommits(e){let t=Vy(e);return ji.loadStreamCommits(t,this._apiUrl)}async applyCommit(e,t,r={}){r={...IH,...r};let n=Vy(e),s=await ji.applyCommit(this._apiUrl,n,t,r,this._config.syncInterval),o=this._streamCache.get(n.toString());return o?(o.next(s.state),this.buildStreamFromDocument(s)):(this._streamCache.set(n.toString(),s),this.buildStreamFromDocument(s))}async requestAnchor(e,t={}){t={...VA,...t};let{anchorStatus:r}=await gi(`${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 ji(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 gi(this._apiUrl+"/node/chains");return this._supportedChains=e,e}async close(){Array.from(this._streamCache).map(([,e])=>{e.complete()}),this._streamCache.clear()}},"CeramicClient");a(DH,"CeramicClient");var ir;(function(e){e.assertEqual=s=>s;function t(s){}i(t,"assertIs"),a(t,"assertIs"),e.assertIs=t;function r(s){throw new Error}i(r,"assertNever"),a(r,"assertNever"),e.assertNever=r,e.arrayToEnum=s=>{let o={};for(let c of s)o[c]=c;return o},e.getValidEnumValues=s=>{let o=e.objectKeys(s).filter(f=>typeof s[s[f]]!="number"),c={};for(let f of o)c[f]=s[f];return e.objectValues(c)},e.objectValues=s=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let o=[];for(let c in s)Object.prototype.hasOwnProperty.call(s,c)&&o.push(c);return o},e.find=(s,o)=>{for(let c of s)if(o(c))return c},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(o)}i(n,"joinValues"),a(n,"joinValues"),e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>typeof o=="bigint"?o.toString():o})(ir||(ir={}));var tt=ir.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),oo=a(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"),Ve=ir.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"]),OH=a(e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),Ls=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(s){return s.message},r={_errors:[]},n=a(s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let c=r,f=0;for(;f<o.path.length;){let h=o.path[f];f===o.path.length-1?(c[h]=c[h]||{_errors:[]},c[h]._errors.push(t(o))):c[h]=c[h]||{_errors:[]},c=c[h],f++}}},"processError");return n(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,ir.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(Ls,"ZodError");Ls.create=e=>new Ls(e);var id=a((e,t)=>{let r;switch(e.code){case Ve.invalid_type:e.received===tt.undefined?r="Required":r=`Expected ${e.expected}, received ${e.received}`;break;case Ve.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,ir.jsonStringifyReplacer)}`;break;case Ve.unrecognized_keys:r=`Unrecognized key(s) in object: ${ir.joinValues(e.keys,", ")}`;break;case Ve.invalid_union:r="Invalid input";break;case Ve.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${ir.joinValues(e.options)}`;break;case Ve.invalid_enum_value:r=`Invalid enum value. Expected ${ir.joinValues(e.options)}, received '${e.received}'`;break;case Ve.invalid_arguments:r="Invalid function arguments";break;case Ve.invalid_return_type:r="Invalid function return type";break;case Ve.invalid_date:r="Invalid date";break;case Ve.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}"`:ir.assertNever(e.validation):e.validation!=="regex"?r=`Invalid ${e.validation}`:r="Invalid";break;case Ve.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 Ve.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 Ve.custom:r="Invalid input";break;case Ve.invalid_intersection_types:r="Intersection results could not be merged";break;case Ve.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case Ve.not_finite:r="Number must be finite";break;default:r=t.defaultError,ir.assertNever(e)}return{message:r}},"errorMap"),hk=id;function pk(e){hk=e}i(pk,"setErrorMap");a(pk,"setErrorMap");function sd(){return hk}i(sd,"getErrorMap");a(sd,"getErrorMap");var nm=a(e=>{let{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],c={...s,path:o},f="",h=n.filter(p=>!!p).slice().reverse();for(let p of h)f=p(c,{data:t,defaultError:f}).message;return{...s,path:o,message:s.message||f}},"makeIssue"),RH=[];function vt(e,t){let r=nm({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,sd(),id].filter(n=>!!n)});e.common.issues.push(r)}i(vt,"addIssueToContext");a(vt,"addIssueToContext");var Nn=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 Dt;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 Nn.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:s,value:o}=n;if(s.status==="aborted"||o.status==="aborted")return Dt;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),(typeof o.value<"u"||n.alwaysSet)&&(r[s.value]=o.value)}return{status:e.value,value:r}}},"ParseStatus");a(Nn,"ParseStatus");var Dt=Object.freeze({status:"aborted"}),mk=a(e=>({status:"dirty",value:e}),"DIRTY"),An=a(e=>({status:"valid",value:e}),"OK"),Yy=a(e=>e.status==="aborted","isAborted"),Xy=a(e=>e.status==="dirty","isDirty"),im=a(e=>e.status==="valid","isValid"),sm=a(e=>typeof Promise!==void 0&&e instanceof Promise,"isAsync"),Zt;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(Zt||(Zt={}));var hs=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(hs,"ParseInputLazyPath");var GA=a((e,t)=>{if(im(t))return{success:!0,data:t.value};{if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");let r=new Ls(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:s}=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:s}:{errorMap:a((c,f)=>c.code!=="invalid_type"?{message:f.defaultError}:typeof f.data>"u"?{message:n??f.defaultError}:{message:r??f.defaultError},"customMap"),description:s}}i(zt,"processCreateParams");a(zt,"processCreateParams");var $t=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 oo(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:oo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Nn,ctx:{common:e.parent.common,data:e.data,parsedType:oo(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(sm(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:oo(e)},s=this._parseSync({data:e,path:n.path,parent:n});return GA(n,s)}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:oo(e)},n=this._parse({data:e,path:r.path,parent:r}),s=await(sm(n)?n:Promise.resolve(n));return GA(r,s)}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,s)=>{let o=e(n),c=a(()=>s.addIssue({code:Ve.custom,...r(n)}),"setError");return typeof Promise<"u"&&o instanceof Promise?o.then(f=>f?!0:(c(),!1)):o?!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 Hi({schema:this,typeName:Tt.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return fs.create(this)}nullable(){return bo.create(this)}nullish(){return this.optional().nullable()}array(){return ls.create(this)}promise(){return Tc.create(this)}or(e){return Gu.create([this,e])}and(e){return Wu.create(this,e)}transform(e){return new Hi({schema:this,typeName:Tt.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Xu({innerType:this,defaultValue:t,typeName:Tt.ZodDefault})}brand(){return new C6({typeName:Tt.ZodBranded,type:this,...zt(void 0)})}catch(e){let t=typeof e=="function"?e:()=>e;return new ld({innerType:this,defaultValue:t,typeName:Tt.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Id.create(this,e)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},"ZodType");a($t,"ZodType");var NH=/^c[^\s-]{8,}$/i,PH=/^([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,BH=/^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i,LH=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"),Sa=i(class extends $t{constructor(){super(...arguments),this._regex=(e,t,r)=>this.refinement(n=>e.test(n),{validation:t,code:Ve.invalid_string,...Zt.errToObj(r)}),this.nonempty=e=>this.min(1,Zt.errToObj(e)),this.trim=()=>new Sa({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==tt.string){let s=this._getOrReturnCtx(e);return vt(s,{code:Ve.invalid_type,expected:tt.string,received:s.parsedType}),Dt}let r=new Nn,n;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="max")e.data.length>s.value&&(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,c=e.data.length<s.value;(o||c)&&(n=this._getOrReturnCtx(e,n),o?vt(n,{code:Ve.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&vt(n,{code:Ve.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),r.dirty())}else if(s.kind==="email")BH.test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{validation:"email",code:Ve.invalid_string,message:s.message}),r.dirty());else if(s.kind==="uuid")PH.test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{validation:"uuid",code:Ve.invalid_string,message:s.message}),r.dirty());else if(s.kind==="cuid")NH.test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{validation:"cuid",code:Ve.invalid_string,message:s.message}),r.dirty());else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),vt(n,{validation:"url",code:Ve.invalid_string,message:s.message}),r.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{validation:"regex",code:Ve.invalid_string,message:s.message}),r.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="startsWith"?e.data.startsWith(s.value)||(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()):s.kind==="datetime"?LH(s).test(e.data)||(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.invalid_string,validation:"datetime",message:s.message}),r.dirty()):ir.assertNever(s);return{status:r.value,value:e.data}}_addCheck(e){return new Sa({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Zt.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Zt.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Zt.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Zt.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,...Zt.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Zt.errToObj(t)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Zt.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Zt.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Zt.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Zt.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Zt.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(Sa,"ZodString");Sa.create=e=>{var t;return new Sa({checks:[],typeName:Tt.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};function vk(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=parseInt(e.toFixed(s).replace(".","")),c=parseInt(t.toFixed(s).replace(".",""));return o%c/Math.pow(10,s)}i(vk,"floatSafeRemainder");a(vk,"floatSafeRemainder");var go=i(class extends $t{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)!==tt.number){let s=this._getOrReturnCtx(e);return vt(s,{code:Ve.invalid_type,expected:tt.number,received:s.parsedType}),Dt}let r,n=new Nn;for(let s of this._def.checks)s.kind==="int"?ir.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()):s.kind==="multipleOf"?vk(e.data,s.value)!==0&&(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),vt(r,{code:Ve.not_finite,message:s.message}),n.dirty()):ir.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Zt.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Zt.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Zt.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Zt.toString(t))}setLimit(e,t,r,n){return new go({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:Zt.toString(n)}]})}_addCheck(e){return new go({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Zt.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Zt.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Zt.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Zt.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Zt.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Zt.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Zt.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(go,"ZodNumber");go.create=e=>new go({checks:[],typeName:Tt.ZodNumber,coerce:e?.coerce||!1,...zt(e)});var Hu=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==tt.bigint){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.bigint,received:r.parsedType}),Dt}return An(e.data)}},"ZodBigInt");a(Hu,"ZodBigInt");Hu.create=e=>{var t;return new Hu({typeName:Tt.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...zt(e)})};var qu=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=Boolean(e.data)),this._getType(e)!==tt.boolean){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.boolean,received:r.parsedType}),Dt}return An(e.data)}},"ZodBoolean");a(qu,"ZodBoolean");qu.create=e=>new qu({typeName:Tt.ZodBoolean,coerce:e?.coerce||!1,...zt(e)});var Ac=i(class extends $t{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==tt.date){let s=this._getOrReturnCtx(e);return vt(s,{code:Ve.invalid_type,expected:tt.date,received:s.parsedType}),Dt}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return vt(s,{code:Ve.invalid_date}),Dt}let r=new Nn,n;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(n=this._getOrReturnCtx(e,n),vt(n,{code:Ve.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()):ir.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ac({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Zt.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Zt.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(Ac,"ZodDate");Ac.create=e=>new Ac({checks:[],coerce:e?.coerce||!1,typeName:Tt.ZodDate,...zt(e)});var ad=i(class extends $t{_parse(e){if(this._getType(e)!==tt.symbol){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.symbol,received:r.parsedType}),Dt}return An(e.data)}},"ZodSymbol");a(ad,"ZodSymbol");ad.create=e=>new ad({typeName:Tt.ZodSymbol,...zt(e)});var Ku=i(class extends $t{_parse(e){if(this._getType(e)!==tt.undefined){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.undefined,received:r.parsedType}),Dt}return An(e.data)}},"ZodUndefined");a(Ku,"ZodUndefined");Ku.create=e=>new Ku({typeName:Tt.ZodUndefined,...zt(e)});var Vu=i(class extends $t{_parse(e){if(this._getType(e)!==tt.null){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.null,received:r.parsedType}),Dt}return An(e.data)}},"ZodNull");a(Vu,"ZodNull");Vu.create=e=>new Vu({typeName:Tt.ZodNull,...zt(e)});var Sc=i(class extends $t{constructor(){super(...arguments),this._any=!0}_parse(e){return An(e.data)}},"ZodAny");a(Sc,"ZodAny");Sc.create=e=>new Sc({typeName:Tt.ZodAny,...zt(e)});var uo=i(class extends $t{constructor(){super(...arguments),this._unknown=!0}_parse(e){return An(e.data)}},"ZodUnknown");a(uo,"ZodUnknown");uo.create=e=>new uo({typeName:Tt.ZodUnknown,...zt(e)});var Fs=i(class extends $t{_parse(e){let t=this._getOrReturnCtx(e);return vt(t,{code:Ve.invalid_type,expected:tt.never,received:t.parsedType}),Dt}},"ZodNever");a(Fs,"ZodNever");Fs.create=e=>new Fs({typeName:Tt.ZodNever,...zt(e)});var od=i(class extends $t{_parse(e){if(this._getType(e)!==tt.undefined){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.void,received:r.parsedType}),Dt}return An(e.data)}},"ZodVoid");a(od,"ZodVoid");od.create=e=>new od({typeName:Tt.ZodVoid,...zt(e)});var ls=i(class extends $t{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==tt.array)return vt(t,{code:Ve.invalid_type,expected:tt.array,received:t.parsedType}),Dt;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,c=t.data.length<n.exactLength.value;(o||c)&&(vt(t,{code:o?Ve.too_big:Ve.too_small,minimum:c?n.exactLength.value:void 0,maximum:o?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&&(vt(t,{code:Ve.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&&(vt(t,{code:Ve.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((o,c)=>n.type._parseAsync(new hs(t,o,t.path,c)))).then(o=>Nn.mergeArray(r,o));let s=t.data.map((o,c)=>n.type._parseSync(new hs(t,o,t.path,c)));return Nn.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new ls({...this._def,minLength:{value:e,message:Zt.toString(t)}})}max(e,t){return new ls({...this._def,maxLength:{value:e,message:Zt.toString(t)}})}length(e,t){return new ls({...this._def,exactLength:{value:e,message:Zt.toString(t)}})}nonempty(e){return this.min(1,e)}},"ZodArray");a(ls,"ZodArray");ls.create=(e,t)=>new ls({type:e,minLength:null,maxLength:null,exactLength:null,typeName:Tt.ZodArray,...zt(t)});var am;(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(am||(am={}));var WA=a(e=>t=>new Ir({...e,shape:()=>({...e.shape(),...t})}),"AugmentFactory");function hc(e){if(e instanceof Ir){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=fs.create(hc(n))}return new Ir({...e._def,shape:()=>t})}else return e instanceof ls?ls.create(hc(e.element)):e instanceof fs?fs.create(hc(e.unwrap())):e instanceof bo?bo.create(hc(e.unwrap())):e instanceof Us?Us.create(e.items.map(t=>hc(t))):e}i(hc,"deepPartialify");a(hc,"deepPartialify");var Ir=i(class extends $t{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=WA(this._def),this.extend=WA(this._def)}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=ir.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==tt.object){let h=this._getOrReturnCtx(e);return vt(h,{code:Ve.invalid_type,expected:tt.object,received:h.parsedType}),Dt}let{status:r,ctx:n}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof Fs&&this._def.unknownKeys==="strip"))for(let h in n.data)o.includes(h)||c.push(h);let f=[];for(let h of o){let p=s[h],v=n.data[h];f.push({key:{status:"valid",value:h},value:p._parse(new hs(n,v,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof Fs){let h=this._def.unknownKeys;if(h==="passthrough")for(let p of c)f.push({key:{status:"valid",value:p},value:{status:"valid",value:n.data[p]}});else if(h==="strict")c.length>0&&(vt(n,{code:Ve.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 v=n.data[p];f.push({key:{status:"valid",value:p},value:h._parse(new hs(n,v,n.path,p)),alwaysSet:p in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let p of f){let v=await p.key;h.push({key:v,value:await p.value,alwaysSet:p.alwaysSet})}return h}).then(h=>Nn.mergeObjectSync(r,h)):Nn.mergeObjectSync(r,f)}get shape(){return this._def.shape()}strict(e){return Zt.errToObj,new Ir({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{var n,s,o,c;let f=(o=(s=(n=this._def).errorMap)===null||s===void 0?void 0:s.call(n,t,r).message)!==null&&o!==void 0?o:r.defaultError;return t.code==="unrecognized_keys"?{message:(c=Zt.errToObj(e).message)!==null&&c!==void 0?c:f}:{message:f}}}:{}})}strip(){return new Ir({...this._def,unknownKeys:"strip"})}passthrough(){return new Ir({...this._def,unknownKeys:"passthrough"})}setKey(e,t){return this.augment({[e]:t})}merge(e){return new Ir({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>am.mergeShapes(this._def.shape(),e._def.shape()),typeName:Tt.ZodObject})}catchall(e){return new Ir({...this._def,catchall:e})}pick(e){let t={};return ir.objectKeys(e).map(r=>{this.shape[r]&&(t[r]=this.shape[r])}),new Ir({...this._def,shape:()=>t})}omit(e){let t={};return ir.objectKeys(this.shape).map(r=>{ir.objectKeys(e).indexOf(r)===-1&&(t[r]=this.shape[r])}),new Ir({...this._def,shape:()=>t})}deepPartial(){return hc(this)}partial(e){let t={};if(e)return ir.objectKeys(this.shape).map(r=>{ir.objectKeys(e).indexOf(r)===-1?t[r]=this.shape[r]:t[r]=this.shape[r].optional()}),new Ir({...this._def,shape:()=>t});for(let r in this.shape){let n=this.shape[r];t[r]=n.optional()}return new Ir({...this._def,shape:()=>t})}required(e){let t={};if(e)ir.objectKeys(this.shape).map(r=>{if(ir.objectKeys(e).indexOf(r)===-1)t[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof fs;)s=s._def.innerType;t[r]=s}});else for(let r in this.shape){let s=this.shape[r];for(;s instanceof fs;)s=s._def.innerType;t[r]=s}return new Ir({...this._def,shape:()=>t})}keyof(){return M6(ir.objectKeys(this.shape))}},"ZodObject");a(Ir,"ZodObject");Ir.create=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strip",catchall:Fs.create(),typeName:Tt.ZodObject,...zt(t)});Ir.strictCreate=(e,t)=>new Ir({shape:()=>e,unknownKeys:"strict",catchall:Fs.create(),typeName:Tt.ZodObject,...zt(t)});Ir.lazycreate=(e,t)=>new Ir({shape:e,unknownKeys:"strip",catchall:Fs.create(),typeName:Tt.ZodObject,...zt(t)});var Gu=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let o=s.map(c=>new Ls(c.ctx.common.issues));return vt(t,{code:Ve.invalid_union,unionErrors:o}),Dt}if(i(n,"handleResults"),a(n,"handleResults"),t.common.async)return Promise.all(r.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let s,o=[];for(let f of r){let h={...t,common:{...t.common,issues:[]},parent:null},p=f._parseSync({data:t.data,path:t.path,parent:h});if(p.status==="valid")return p;p.status==="dirty"&&!s&&(s={result:p,ctx:h}),h.common.issues.length&&o.push(h.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let c=o.map(f=>new Ls(f));return vt(t,{code:Ve.invalid_union,unionErrors:c}),Dt}}get options(){return this._def.options}},"ZodUnion");a(Gu,"ZodUnion");Gu.create=(e,t)=>new Gu({options:e,typeName:Tt.ZodUnion,...zt(t)});var D0=a(e=>e instanceof Zu?D0(e.schema):e instanceof Hi?D0(e.innerType()):e instanceof Ju?[e.value]:e instanceof ml?e.options:e instanceof Yu?Object.keys(e.enum):e instanceof Xu?D0(e._def.innerType):e instanceof Ku?[void 0]:e instanceof Vu?[null]:null,"getDiscriminator"),Gm=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tt.object)return vt(t,{code:Ve.invalid_type,expected:tt.object,received:t.parsedType}),Dt;let r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):(vt(t,{code:Ve.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Dt)}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 s of t){let o=D0(s.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of o){if(n.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);n.set(c,s)}}return new Gm({typeName:Tt.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...zt(r)})}},"ZodDiscriminatedUnion");a(Gm,"ZodDiscriminatedUnion");function om(e,t){let r=oo(e),n=oo(t);if(e===t)return{valid:!0,data:e};if(r===tt.object&&n===tt.object){let s=ir.objectKeys(t),o=ir.objectKeys(e).filter(f=>s.indexOf(f)!==-1),c={...e,...t};for(let f of o){let h=om(e[f],t[f]);if(!h.valid)return{valid:!1};c[f]=h.data}return{valid:!0,data:c}}else if(r===tt.array&&n===tt.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let c=e[o],f=t[o],h=om(c,f);if(!h.valid)return{valid:!1};s.push(h.data)}return{valid:!0,data:s}}else return r===tt.date&&n===tt.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}i(om,"mergeValues");a(om,"mergeValues");var Wu=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=a((s,o)=>{if(Yy(s)||Yy(o))return Dt;let c=om(s.value,o.value);return c.valid?((Xy(s)||Xy(o))&&t.dirty(),{status:t.value,value:c.data}):(vt(r,{code:Ve.invalid_intersection_types}),Dt)},"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(([s,o])=>n(s,o)):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(Wu,"ZodIntersection");Wu.create=(e,t,r)=>new Wu({left:e,right:t,typeName:Tt.ZodIntersection,...zt(r)});var Us=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tt.array)return vt(r,{code:Ve.invalid_type,expected:tt.array,received:r.parsedType}),Dt;if(r.data.length<this._def.items.length)return vt(r,{code:Ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Dt;!this._def.rest&&r.data.length>this._def.items.length&&(vt(r,{code:Ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=r.data.map((o,c)=>{let f=this._def.items[c]||this._def.rest;return f?f._parse(new hs(r,o,r.path,c)):null}).filter(o=>!!o);return r.common.async?Promise.all(s).then(o=>Nn.mergeArray(t,o)):Nn.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new Us({...this._def,rest:e})}},"ZodTuple");a(Us,"ZodTuple");Us.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Us({items:e,typeName:Tt.ZodTuple,rest:null,...zt(t)})};var cd=i(class extends $t{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!==tt.object)return vt(r,{code:Ve.invalid_type,expected:tt.object,received:r.parsedType}),Dt;let n=[],s=this._def.keyType,o=this._def.valueType;for(let c in r.data)n.push({key:s._parse(new hs(r,c,r.path,c)),value:o._parse(new hs(r,r.data[c],r.path,c))});return r.common.async?Nn.mergeObjectAsync(t,n):Nn.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){return t instanceof $t?new cd({keyType:e,valueType:t,typeName:Tt.ZodRecord,...zt(r)}):new cd({keyType:Sa.create(),valueType:e,typeName:Tt.ZodRecord,...zt(t)})}},"ZodRecord");a(cd,"ZodRecord");var ud=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tt.map)return vt(r,{code:Ve.invalid_type,expected:tt.map,received:r.parsedType}),Dt;let n=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([c,f],h)=>({key:n._parse(new hs(r,c,r.path,[h,"key"])),value:s._parse(new hs(r,f,r.path,[h,"value"]))}));if(r.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let f of o){let h=await f.key,p=await f.value;if(h.status==="aborted"||p.status==="aborted")return Dt;(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 f of o){let h=f.key,p=f.value;if(h.status==="aborted"||p.status==="aborted")return Dt;(h.status==="dirty"||p.status==="dirty")&&t.dirty(),c.set(h.value,p.value)}return{status:t.value,value:c}}}},"ZodMap");a(ud,"ZodMap");ud.create=(e,t,r)=>new ud({valueType:t,keyType:e,typeName:Tt.ZodMap,...zt(r)});var xc=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==tt.set)return vt(r,{code:Ve.invalid_type,expected:tt.set,received:r.parsedType}),Dt;let n=this._def;n.minSize!==null&&r.data.size<n.minSize.value&&(vt(r,{code:Ve.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&&(vt(r,{code:Ve.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let s=this._def.valueType;function o(f){let h=new Set;for(let p of f){if(p.status==="aborted")return Dt;p.status==="dirty"&&t.dirty(),h.add(p.value)}return{status:t.value,value:h}}i(o,"finalizeSet"),a(o,"finalizeSet");let c=[...r.data.values()].map((f,h)=>s._parse(new hs(r,f,r.path,h)));return r.common.async?Promise.all(c).then(f=>o(f)):o(c)}min(e,t){return new xc({...this._def,minSize:{value:e,message:Zt.toString(t)}})}max(e,t){return new xc({...this._def,maxSize:{value:e,message:Zt.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}},"ZodSet");a(xc,"ZodSet");xc.create=(e,t)=>new xc({valueType:e,minSize:null,maxSize:null,typeName:Tt.ZodSet,...zt(t)});var Nu=i(class extends $t{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tt.function)return vt(t,{code:Ve.invalid_type,expected:tt.function,received:t.parsedType}),Dt;function r(c,f){return nm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,sd(),id].filter(h=>!!h),issueData:{code:Ve.invalid_arguments,argumentsError:f}})}i(r,"makeArgsIssue"),a(r,"makeArgsIssue");function n(c,f){return nm({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,sd(),id].filter(h=>!!h),issueData:{code:Ve.invalid_return_type,returnTypeError:f}})}i(n,"makeReturnsIssue"),a(n,"makeReturnsIssue");let s={errorMap:t.common.contextualErrorMap},o=t.data;return this._def.returns instanceof Tc?An(async(...c)=>{let f=new Ls([]),h=await this._def.args.parseAsync(c,s).catch(y=>{throw f.addIssue(r(c,y)),f}),p=await o(...h);return await this._def.returns._def.type.parseAsync(p,s).catch(y=>{throw f.addIssue(n(p,y)),f})}):An((...c)=>{let f=this._def.args.safeParse(c,s);if(!f.success)throw new Ls([r(c,f.error)]);let h=o(...f.data),p=this._def.returns.safeParse(h,s);if(!p.success)throw new Ls([n(h,p.error)]);return p.data})}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Nu({...this._def,args:Us.create(e).rest(uo.create())})}returns(e){return new Nu({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Nu({args:e||Us.create([]).rest(uo.create()),returns:t||uo.create(),typeName:Tt.ZodFunction,...zt(r)})}},"ZodFunction");a(Nu,"ZodFunction");var Zu=i(class extends $t{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(Zu,"ZodLazy");Zu.create=(e,t)=>new Zu({getter:e,typeName:Tt.ZodLazy,...zt(t)});var Ju=i(class extends $t{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return vt(t,{code:Ve.invalid_literal,expected:this._def.value}),Dt}return{status:"valid",value:e.data}}get value(){return this._def.value}},"ZodLiteral");a(Ju,"ZodLiteral");Ju.create=(e,t)=>new Ju({value:e,typeName:Tt.ZodLiteral,...zt(t)});function M6(e,t){return new ml({values:e,typeName:Tt.ZodEnum,...zt(t)})}i(M6,"createZodEnum");a(M6,"createZodEnum");var ml=i(class extends $t{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return vt(t,{expected:ir.joinValues(r),received:t.parsedType,code:Ve.invalid_type}),Dt}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),r=this._def.values;return vt(t,{received:t.data,code:Ve.invalid_enum_value,options:r}),Dt}return An(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(ml,"ZodEnum");ml.create=M6;var Yu=i(class extends $t{_parse(e){let t=ir.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==tt.string&&r.parsedType!==tt.number){let n=ir.objectValues(t);return vt(r,{expected:ir.joinValues(n),received:r.parsedType,code:Ve.invalid_type}),Dt}if(t.indexOf(e.data)===-1){let n=ir.objectValues(t);return vt(r,{received:r.data,code:Ve.invalid_enum_value,options:n}),Dt}return An(e.data)}get enum(){return this._def.values}},"ZodNativeEnum");a(Yu,"ZodNativeEnum");Yu.create=(e,t)=>new Yu({values:e,typeName:Tt.ZodNativeEnum,...zt(t)});var Tc=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==tt.promise&&t.common.async===!1)return vt(t,{code:Ve.invalid_type,expected:tt.promise,received:t.parsedType}),Dt;let r=t.parsedType===tt.promise?t.data:Promise.resolve(t.data);return An(r.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}},"ZodPromise");a(Tc,"ZodPromise");Tc.create=(e,t)=>new Tc({type:e,typeName:Tt.ZodPromise,...zt(t)});var Hi=i(class extends $t{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 o=n.transform(r.data);return r.common.async?Promise.resolve(o).then(c=>this._def.schema._parseAsync({data:c,path:r.path,parent:r})):this._def.schema._parseSync({data:o,path:r.path,parent:r})}let s={addIssue:o=>{vt(r,o),o.fatal?t.abort():t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),n.type==="refinement"){let o=a(c=>{let f=n.refinement(c,s);if(r.common.async)return Promise.resolve(f);if(f 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"?Dt:(c.status==="dirty"&&t.dirty(),o(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"?Dt:(c.status==="dirty"&&t.dirty(),o(c.value).then(()=>({status:t.value,value:c.value}))))}if(n.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!im(o))return o;let c=n.transform(o.value,s);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(o=>im(o)?Promise.resolve(n.transform(o.value,s)).then(c=>({status:t.value,value:c})):o);ir.assertNever(n)}},"ZodEffects");a(Hi,"ZodEffects");Hi.create=(e,t,r)=>new Hi({schema:e,typeName:Tt.ZodEffects,effect:t,...zt(r)});Hi.createWithPreprocess=(e,t,r)=>new Hi({schema:t,effect:{type:"preprocess",transform:e},typeName:Tt.ZodEffects,...zt(r)});var fs=i(class extends $t{_parse(e){return this._getType(e)===tt.undefined?An(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodOptional");a(fs,"ZodOptional");fs.create=(e,t)=>new fs({innerType:e,typeName:Tt.ZodOptional,...zt(t)});var bo=i(class extends $t{_parse(e){return this._getType(e)===tt.null?An(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}},"ZodNullable");a(bo,"ZodNullable");bo.create=(e,t)=>new bo({innerType:e,typeName:Tt.ZodNullable,...zt(t)});var Xu=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===tt.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}},"ZodDefault");a(Xu,"ZodDefault");Xu.create=(e,t)=>new Xu({innerType:e,typeName:Tt.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var ld=i(class extends $t{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.innerType._parse({data:t.data,path:t.path,parent:t});return sm(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(ld,"ZodCatch");ld.create=(e,t)=>new ld({innerType:e,typeName:Tt.ZodCatch,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...zt(t)});var fd=i(class extends $t{_parse(e){if(this._getType(e)!==tt.nan){let r=this._getOrReturnCtx(e);return vt(r,{code:Ve.invalid_type,expected:tt.nan,received:r.parsedType}),Dt}return{status:"valid",value:e.data}}},"ZodNaN");a(fd,"ZodNaN");fd.create=e=>new fd({typeName:Tt.ZodNaN,...zt(e)});var FH=Symbol("zod_brand"),C6=i(class extends $t{_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(C6,"ZodBranded");var Id=i(class extends $t{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return a(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Dt:s.status==="dirty"?(t.dirty(),mk(s.value)):this._def.out._parseAsync({data:s.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"?Dt: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 Id({in:e,out:t,typeName:Tt.ZodPipeline})}},"ZodPipeline");a(Id,"ZodPipeline");var gk=a((e,t={},r)=>e?Sc.create().superRefine((n,s)=>{if(!e(n)){let o=typeof t=="function"?t(n):t,c=typeof o=="string"?{message:o}:o;s.addIssue({code:"custom",...c,fatal:r})}}):Sc.create(),"custom"),UH={object:Ir.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 $H=a((e,t={message:`Input not instance of ${e.name}`})=>gk(r=>r instanceof e,t,!0),"instanceOfType"),bk=Sa.create,yk=go.create,jH=fd.create,zH=Hu.create,wk=qu.create,HH=Ac.create,qH=ad.create,KH=Ku.create,VH=Vu.create,GH=Sc.create,WH=uo.create,ZH=Fs.create,JH=od.create,YH=ls.create,XH=Ir.create,QH=Ir.strictCreate,eq=Gu.create,tq=Gm.create,rq=Wu.create,nq=Us.create,iq=cd.create,sq=ud.create,aq=xc.create,oq=Nu.create,cq=Zu.create,uq=Ju.create,lq=ml.create,fq=Yu.create,dq=Tc.create,ZA=Hi.create,hq=fs.create,pq=bo.create,mq=Hi.createWithPreprocess,vq=Id.create,gq=a(()=>bk().optional(),"ostring"),bq=a(()=>yk().optional(),"onumber"),yq=a(()=>wk().optional(),"oboolean"),wq={string:e=>Sa.create({...e,coerce:!0}),number:e=>go.create({...e,coerce:!0}),boolean:e=>qu.create({...e,coerce:!0}),bigint:e=>Hu.create({...e,coerce:!0}),date:e=>Ac.create({...e,coerce:!0})},_q=Dt,J=Object.freeze({__proto__:null,defaultErrorMap:id,setErrorMap:pk,getErrorMap:sd,makeIssue:nm,EMPTY_PATH:RH,addIssueToContext:vt,ParseStatus:Nn,INVALID:Dt,DIRTY:mk,OK:An,isAborted:Yy,isDirty:Xy,isValid:im,isAsync:sm,get util(){return ir},ZodParsedType:tt,getParsedType:oo,ZodType:$t,ZodString:Sa,ZodNumber:go,ZodBigInt:Hu,ZodBoolean:qu,ZodDate:Ac,ZodSymbol:ad,ZodUndefined:Ku,ZodNull:Vu,ZodAny:Sc,ZodUnknown:uo,ZodNever:Fs,ZodVoid:od,ZodArray:ls,get objectUtil(){return am},ZodObject:Ir,ZodUnion:Gu,ZodDiscriminatedUnion:Gm,ZodIntersection:Wu,ZodTuple:Us,ZodRecord:cd,ZodMap:ud,ZodSet:xc,ZodFunction:Nu,ZodLazy:Zu,ZodLiteral:Ju,ZodEnum:ml,ZodNativeEnum:Yu,ZodPromise:Tc,ZodEffects:Hi,ZodTransformer:Hi,ZodOptional:fs,ZodNullable:bo,ZodDefault:Xu,ZodCatch:ld,ZodNaN:fd,BRAND:FH,ZodBranded:C6,ZodPipeline:Id,custom:gk,Schema:$t,ZodSchema:$t,late:UH,get ZodFirstPartyTypeKind(){return Tt},coerce:wq,any:GH,array:YH,bigint:zH,boolean:wk,date:HH,discriminatedUnion:tq,effect:ZA,enum:lq,function:oq,instanceof:$H,intersection:rq,lazy:cq,literal:uq,map:sq,nan:jH,nativeEnum:fq,never:ZH,null:VH,nullable:pq,number:yk,object:XH,oboolean:yq,onumber:bq,optional:hq,ostring:gq,pipeline:vq,preprocess:mq,promise:dq,record:iq,set:aq,strictObject:QH,string:bk,symbol:qH,transformer:ZA,tuple:nq,undefined:KH,union:eq,unknown:WH,void:JH,NEVER:_q,ZodIssueCode:Ve,quotelessJson:OH,ZodError:Ls}),_k=J.array(J.string().or(J.record(J.any()))),NJ=J.object({type:J.string().optional(),narrative:J.string().optional()}),Wm=J.string().or(J.object({id:J.string(),type:J.string(),caption:J.string().optional()})),Eq=J.object({type:J.string().min(1).or(J.string().array().nonempty()),latitude:J.number(),longitude:J.number()}),Aq=J.object({type:J.string().min(1).or(J.string().array().nonempty()),addressCountry:J.string().optional(),addressCountryCode:J.string().optional(),addressRegion:J.string().optional(),addressLocality:J.string().optional(),streetAddress:J.string().optional(),postOfficeBoxNumber:J.string().optional(),postalCode:J.string().optional(),geo:Eq.optional()}),Sq=J.enum(["sourcedId","systemId","productId","userName","accountId","emailAddress","nationalIdentityNumber","isbn","issn","lisSourcedId","oneRosterSourcedId","sisSourcedId","ltiContextId","ltiDeploymentId","ltiToolId","ltiPlatformId","ltiUserId","identifier"]).or(J.string()),Ek=J.object({type:J.string().min(1).or(J.string().array().nonempty()),identifier:J.string(),identifierType:Sq}),dd=J.string().or(J.object({id:J.string().optional(),type:J.string().or(J.string().array().nonempty().optional()),name:J.string().optional(),url:J.string().optional(),phone:J.string().optional(),description:J.string().optional(),endorsement:J.any().array().optional(),image:Wm.optional(),email:J.string().email().optional(),address:Aq.optional(),otherIdentifier:Ek.array().optional(),official:J.string().optional(),parentOrg:J.any().optional(),familyName:J.string().optional(),givenName:J.string().optional(),additionalName:J.string().optional(),patronymicName:J.string().optional(),honorificPrefix:J.string().optional(),honorificSuffix:J.string().optional(),familyNamePrefix:J.string().optional(),dateOfBirth:J.string().optional()}).catchall(J.any())),Qy=J.object({id:J.string().optional()}).catchall(J.any()),xq=J.object({type:J.string(),id:J.string()}).catchall(J.any()),Tq=J.object({id:J.string(),type:J.string()}).catchall(J.any()),Mq=J.object({id:J.string(),type:J.string()}).catchall(J.any()),cm=J.object({"@context":_k,id:J.string().optional(),type:J.string().array().nonempty(),issuer:dd,issuanceDate:J.string(),expirationDate:J.string().optional(),credentialSubject:Qy.or(Qy.array()),credentialStatus:xq.optional(),credentialSchema:Tq.array().optional(),refreshService:Mq.optional()}).catchall(J.any()),yo=J.object({type:J.string(),created:J.string(),challenge:J.string().optional(),domain:J.string().optional(),nonce:J.string().optional(),proofPurpose:J.string(),verificationMethod:J.string(),jws:J.string().optional()}).catchall(J.any()),JA=cm.extend({proof:yo.or(yo.array())}),Cq=J.object({"@context":_k,id:J.string().optional(),type:J.string().or(J.string().array().nonempty()),verifiableCredential:JA.or(JA.array()).optional(),holder:J.string().optional()}).catchall(J.any()),PJ=Cq.extend({proof:yo.or(yo.array())}),Iq=J.enum(["ceasn:Competency","ceterms:Credential","CFItem","CFRubric","CFRubricCriterion","CFRubricCriterionLevel","CTDL"]).or(J.string()),Zm=J.object({type:J.string().array().nonempty(),targetCode:J.string().optional(),targetDescription:J.string().optional(),targetName:J.string(),targetFramework:J.string().optional(),targetType:Iq.optional(),targetUrl:J.string()}),kq=J.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"]),Dq=kq.or(J.string()),Oq=J.object({id:J.string().optional(),narrative:J.string().optional()}).catchall(J.any()),Rq=J.object({id:J.string(),type:J.string().array().nonempty(),endorsementComment:J.string().optional()}),Nq=cm.extend({credentialSubject:Rq,proof:yo.or(yo.array()).optional()}),Pq=J.object({id:J.string(),"@language":J.string().optional(),version:J.string().optional()}),Bq=J.enum(["GradePointAverage","LetterGrade","Percent","PerformanceLevel","PredictedScore","RawScore","Result","RubricCriterion","RubricCriterionLevel","RubricScore","ScaledScore","Status"]).or(J.string()),Lq=J.object({id:J.string(),type:J.string().array().nonempty(),alignment:Zm.array().optional(),description:J.string().optional(),level:J.string().optional(),name:J.string(),points:J.string().optional()}).catchall(J.any()),Fq=J.object({id:J.string(),type:J.string().array().nonempty(),alignment:Zm.array().optional(),allowedValue:J.string().array().optional(),name:J.string(),requiredLevel:J.string().optional(),requiredValue:J.string().optional(),resultType:Bq,rubricCriterionLevel:Lq.array().optional(),valueMax:J.string().optional(),valueMin:J.string().optional()}).catchall(J.any()),Uq=J.object({id:J.string().optional(),type:J.string().array().nonempty(),alignment:Zm.array().optional(),achievementType:Dq.optional(),creator:dd.optional(),creditsAvailable:J.number().optional(),criteria:Oq,description:J.string(),endorsement:Nq.array().optional(),fieldOfStudy:J.string().optional(),humanCode:J.string().optional(),image:Wm.optional(),"@language":J.string().optional(),name:J.string(),otherIdentifier:Ek.array().optional(),related:Pq.array().optional(),resultDescription:Fq.array().optional(),specialization:J.string().optional(),tag:J.string().array().optional(),version:J.string().optional()}).catchall(J.any()),$q=J.object({type:J.string(),hashed:J.boolean(),identityHash:J.string(),identityType:J.string(),salt:J.string().optional()}),jq=J.enum(["Completed","Enrolled","Failed","InProgress","OnHold","Withdrew"]),zq=J.object({type:J.string().array().nonempty(),achievedLevel:J.string().optional(),alignment:Zm.array().optional(),resultDescription:J.string().optional(),status:jq.optional(),value:J.string().optional()}).catchall(J.any()),YA=J.object({id:J.string().optional(),type:J.string().array().nonempty(),activityEndDate:J.string().optional(),activityStartDate:J.string().optional(),creditsEarned:J.number().optional(),achievement:Uq.optional(),identifier:$q.array().optional(),image:Wm.optional(),licenseNumber:J.string().optional(),narrative:J.string().optional(),result:zq.array().optional(),role:J.string().optional(),source:dd.optional(),term:J.string().optional()}).catchall(J.any()),Hq=J.object({id:J.string().optional(),type:J.string().array().nonempty(),narrative:J.string().optional(),name:J.string().optional(),description:J.string().optional(),genre:J.string().optional(),audience:J.string().optional()}).catchall(J.any()),qq=cm.extend({name:J.string().optional(),description:J.string().optional(),image:Wm.optional(),credentialSubject:YA.or(YA.array()),endorsement:cm.array().optional(),evidence:Hq.array().optional()}),BJ=qq.extend({proof:yo.or(yo.array())}),LJ=J.object({checks:J.string().array(),warnings:J.string().array(),errors:J.string().array()}),Ak=J.enum(["Success","Failed","Error"]),FJ=Ak.enum,UJ=J.object({check:J.string(),status:Ak,message:J.string().optional(),details:J.string().optional()}),$J=J.object({title:J.string().optional(),createdAt:J.string().optional(),issuer:dd.optional(),issuee:dd.optional(),credentialSubject:Qy.optional()}),jJ=J.object({id:J.string(),uri:J.string()}).catchall(J.any()),zJ=J.object({limit:J.number(),cursor:J.string().optional(),sort:J.string().optional()}),Bc=J.object({cursor:J.string().optional(),hasMore:J.boolean()}),Kq=J.object({kty:J.string(),crv:J.string(),x:J.string(),y:J.string().optional(),n:J.string().optional(),d:J.string()}),Vq=J.object({alg:J.string(),iv:J.string(),tag:J.string(),epk:Kq.partial().optional(),kid:J.string().optional(),apv:J.string().optional(),apu:J.string().optional()}),Gq=J.object({header:Vq,encrypted_key:J.string()}),Wq=J.object({protected:J.string(),iv:J.string(),ciphertext:J.string(),tag:J.string(),aad:J.string().optional(),recipients:Gq.array().optional()}),Sk=J.object({encryptedRecord:Wq,fields:J.string().array()}).catchall(J.any()),HJ=Bc.extend({records:Sk.array()}),Zq=Sk.extend({id:J.string()}),qJ=Bc.extend({records:Zq.array()}),Qu=J.object({profileId:J.string().min(3).max(40),displayName:J.string().default(""),bio:J.string().default(""),did:J.string(),email:J.string().optional(),image:J.string().optional(),isServiceProfile:J.boolean().default(!1).optional(),notificationsWebhook:J.string().url().startsWith("https://").optional()}),KJ=Bc.extend({records:Qu.array()}),VJ=J.enum(["CONNECTED","PENDING_REQUEST_SENT","PENDING_REQUEST_RECEIVED","NOT_CONNECTED"]),GJ=J.object({uri:J.string(),to:J.string(),from:J.string(),sent:J.string().datetime(),received:J.string().datetime().optional()}),Jq=J.enum(["DRAFT","LIVE"]),WJ=J.object({uri:J.string(),name:J.string().optional(),type:J.string().optional(),category:J.string().optional(),status:Jq.optional(),autoConnectRecipients:J.boolean().optional()}),ZJ=J.object({to:Qu,from:J.string(),received:J.string().optional()}),Yq=J.enum(["CONNECTION_REQUEST","CONNECTION_ACCEPTED","CREDENTIAL_RECEIVED","CREDENTIAL_ACCEPTED","BOOST_RECEIVED","BOOST_ACCEPTED","PRESENTATION_REQUEST","PRESENTATION_RECEIVED"]),Xq=J.object({title:J.string().optional(),body:J.string().optional()}),Qq=J.object({vcUris:J.array(J.string()).optional(),vpUris:J.array(J.string()).optional()}),JJ=J.object({type:Yq,to:Qu.partial().and(J.object({did:J.string()})),from:Qu.partial().and(J.object({did:J.string()})),message:Xq.optional(),data:Qq.optional(),sent:J.string().datetime().optional()}),YJ=J.object({endpoint:J.string(),name:J.string(),did:J.string().optional()}),XJ=J.object({ttlSeconds:J.number().optional(),totalUses:J.number().optional()}),eK=J.object({endpoint:J.string()}),QJ=J.object({signingAuthority:eK,relationship:J.object({name:J.string().max(15).regex(/^[a-z0-9-]+$/,{message:"The input string must contain only lowercase letters, numbers, and hyphens."}),did:J.string()})}),tK=J.enum(["live","stale","withdrawn"]),rK=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.object({required:J.boolean()})).default({})}).default({}),personal:J.record(J.object({required:J.boolean()})).default({})}).default({}),write:J.object({credentials:J.object({categories:J.record(J.object({required:J.boolean()})).default({})}).default({}),personal:J.record(J.object({required:J.boolean()})).default({})}).default({})}),xk=J.object({contract:rK,owner:Qu,name:J.string(),subtitle:J.string().optional(),description:J.string().optional(),reasonForAccessing:J.string().optional(),image:J.string().optional(),uri:J.string(),createdAt:J.string(),updatedAt:J.string(),expiresAt:J.string().optional()}),eY=Bc.extend({records:xk.omit({owner:!0}).array()}),nK=J.object({credentials:J.object({categories:J.record(J.string().array()).default({})}),personal:J.record(J.string()).default({}),date:J.string()}),tY=Bc.extend({records:nK.array()}),Tk=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({shareAll:J.boolean().optional(),sharing:J.boolean().optional(),categories:J.record(J.object({sharing:J.boolean().optional(),shared:J.string().array().optional(),shareAll:J.boolean().optional()})).default({})}).default({}),personal:J.record(J.string()).default({})}).default({}),write:J.object({credentials:J.object({categories:J.record(J.boolean()).default({})}).default({}),personal:J.record(J.boolean()).default({})}).default({})}),rY=Bc.extend({records:J.object({expiresAt:J.string().optional(),oneTime:J.boolean().optional(),terms:Tk,contract:xk,uri:J.string(),consenter:Qu,status:tK}).array()}),nY=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({categories:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),personal:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),write:J.object({credentials:J.object({categories:J.record(J.object({required:J.boolean().optional()})).optional()}).optional(),personal:J.record(J.object({required:J.boolean().optional()})).optional()}).optional()}),iK=J.object({read:J.object({anonymize:J.boolean().optional(),credentials:J.object({shareAll:J.boolean().optional(),sharing:J.boolean().optional(),categories:J.record(J.object({sharing:J.boolean().optional(),shared:J.string().array().optional(),shareAll:J.boolean().optional()}).optional()).optional()}).optional(),personal:J.record(J.string()).optional()}).optional(),write:J.object({credentials:J.object({categories:J.record(J.boolean()).optional()}).optional(),personal:J.record(J.boolean()).optional()}).optional()}),e2=J.enum(["consent","update","sync","withdraw"]),iY=J.object({terms:iK.optional(),action:e2.or(e2.array()).optional(),date:J.object({$gt:J.string()}).or(J.object({$lt:J.string()})).or(J.object({$eq:J.string()})).optional(),expiresAt:J.object({$gt:J.string()}).or(J.object({$lt:J.string()})).or(J.object({$eq:J.string()})).optional(),oneTime:J.boolean().optional()}),sK=J.object({expiresAt:J.string().optional(),oneTime:J.boolean().optional(),terms:Tk.optional(),id:J.string(),action:e2,date:J.string()}),sY=Bc.extend({records:sK.array()}),Jm=a(e=>`lc:ceramic:${e}`,"streamIdToCeramicURI"),aY=J.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 I6=W.object({credentials:uc.array()}).catchall(W.any()),Mk=W.object({id:W.string(),title:W.string(),storageType:W.literal("ceramic").optional()}).catchall(W.any()),k6=W.object({credentials:uc.or(Mk).array()}).strict();var Ym=i(async(e,{modelData:t,credentialAlias:r})=>{let n=e.invoke.getCeramicClient(),s=new Of({ceramic:n,model:t}),o=i(async(v=r)=>{let y=await s.get(v);if(!y)return{credentials:[]};let b=await I6.spa(y);if(b.success)return b.data;let _=await k6.spa(y);if(_.success){let R={credentials:_.data.credentials.map(P=>{if("uri"in P)return P;let{title:K,id:U,storageType:j,...V}=P;return{...V,id:K,uri:`lc:ceramic:${U.replace("ceramic://","")}`}})};return await s.set(r,R),R}throw console.error(b.error),new Error("Invalid credentials list stored in IDX")},"getCredentialsListFromIdx"),c=i(async(v,y)=>{if(!v)throw new Error("Must provide id to remove");y||(y=r);let b=await o(y);return b.credentials=b.credentials.filter(_=>_.id!==v),s.set(y,b)},"removeCredentialFromIdx"),f=i(async v=>(v||(v=r),s.set(v,{credentials:[]})),"removeAllCredentialsFromIdx"),h=i(async v=>{let y=await uc.parseAsync(v);if(!y)throw new Error("record is required");if(!y.uri)throw Error("No URI provided");await e.read.get(y.uri);let b=await o(r),_=b.credentials.findIndex(T=>T.id===y.id);return _>-1?b.credentials[_]=y:b.credentials.push(y),Jm(await s.set(r,b))},"addCredentialInIdx"),p=i(async v=>{let y=uc.array().parse(v),b=await o(r);return await Promise.all(y.map(async _=>{await e.read.get(_.uri);let T=b.credentials.findIndex(O=>O.id===_.id);T>-1?b.credentials[T]=_:b.credentials.push(_)})),Jm(await s.set(r,b))},"addCredentialsInIdx");return{name:"IDX",displayName:"IDX",description:"Stores a bespoke index of credentials for an individual based on their did",index:{get:async v=>(v.debug?.("learnCard.index.IDX.get"),(await o()).credentials),add:async(v,y)=>{v.debug?.("learnCard.index.IDX.add");try{return await h(y),!0}catch(b){return console.error("Error adding credential with IDX:",b),!1}},addMany:async(v,y)=>{v.debug?.("learnCard.index.IDX.add");try{return await p(y),!0}catch(b){return console.error("Error adding credential with IDX:",b),!1}},update:async v=>(v.debug?.("learnCard.index.IDX.update"),!1),remove:async(v,y)=>{v.debug?.("learnCard.index.IDX.remove");try{return await c(y),!0}catch(b){return console.error("Error removing credential from IDX:",b),!1}},removeAll:async v=>{v.debug?.("learnCard.index.IDX.removeAll");try{return await f(),!0}catch(y){return console.error("Error removing credentials from IDX:",y),!1}}},methods:{getCredentialsListFromIdx:async(v,y=r)=>(await o(y)).credentials,getVerifiableCredentialFromIdx:async(v,y)=>{let _=(await o())?.credentials?.find(R=>R?.id===y),T=v.read.get(_?.uri),O=await u0.safeParseAsync(T);return O.success?O.data:void 0},getVerifiableCredentialsFromIdx:async v=>{let b=(await o())?.credentials?.map(_=>_?.uri)??[];return(await Promise.all(b.map(async _=>v.read.get(_)))).filter(_=>!!_)},addVerifiableCredentialInIdx:async(v,y)=>{let b=uc.parse(y);if(!b)throw new Error("record is required");if(!b.uri)throw Error("No URI provided");await v.read.get(b.uri);let _=await o(r),T=_.credentials.findIndex(O=>O.id===b.id);return T>-1?_.credentials[T]=b:_.credentials.push(b),Jm(await s.set(r,_))},removeVerifiableCredentialInIdx:async(v,y)=>c(y),removeAllVerifiableCredentialsInIdx:async()=>f(),getIDXIndex:async()=>s.get(r),setIDXIndex:async(v,y)=>s.set(r,y)}}},"getIDXPlugin");var aK=Ym;
841
841
  /*!
842
842
  * https://github.com/Starcounter-Jack/JSON-Patch
843
843
  * (c) 2017-2021 Joachim Wester