@ew-did-registry/did-ipfs-store
Version:
IPFS-based implementation of IDidStore
1 lines • 105 kB
JavaScript
(()=>{var e={928:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(512),n=r(619);const i=Function.prototype.apply.bind(n.mergeArrays,void 0),a=n.stringToArray("--"),s=n.stringToArray("\r\n");function l(e){const t=e.split(";").map((e=>e.trim()));if("form-data"!==t.shift())throw new Error('malformed content-disposition header: missing "form-data" in `'+JSON.stringify(t)+"`");const r={};for(const o of t){const t=o.split("=",2);if(2!==t.length)throw new Error("malformed content-disposition header: key-value pair not found - "+o+" in `"+e+"`");const[n,i]=t;if('"'===i[0]&&'"'===i[i.length-1])r[n]=i.slice(1,-1).replace(/\\"/g,'"');else if('"'!==i[0]&&'"'!==i[i.length-1])r[n]=i;else if('"'===i[0]&&'"'!==i[i.length-1]||'"'!==i[0]&&'"'===i[i.length-1])throw new Error("malformed content-disposition header: mismatched quotations in `"+e+"`")}if(!r.name)throw new Error("malformed content-disposition header: missing field name in `"+e+"`");return r}function c(e){const t=[];let r,o=!1;for(;void 0!==(r=e.shift());){const e=r.indexOf(":");if(-1===e)throw new Error("malformed multipart-form header: missing colon");const n=r.slice(0,e).trim().toLowerCase(),i=r.slice(e+1).trim();switch(n){case"content-disposition":o=!0,t.push(...Object.entries(l(i)));break;case"content-type":t.push(["contentType",i])}}if(!o)throw new Error("malformed multipart-form header: missing content-disposition");return Object.fromEntries(t)}async function u(e,t){let r=!0,l=!1;const c=[[]],u=new o.StreamSearch(s);for(;;){const d=await e.next();if(d.done)throw new Error("malformed multipart-form data: unexpected end of stream");if(r&&d.value!==o.MATCH&&n.arraysEqual(d.value.slice(0,2),a))return[void 0,new Uint8Array];let p;if(d.value!==o.MATCH)p=d.value;else{if(l)throw new Error("malformed multipart-form data: unexpected boundary");p=t}if(!p.length)continue;r&&(r=!1);const f=u.feed(p);for(const[e,t]of f.entries()){const r=t===o.MATCH;if(r||t.length){if(l&&r)return f.push(u.end()),[c.filter((e=>e.length)).map(i).map(n.arrayToString),n.mergeArrays(...f.slice(e+1).map((e=>e===o.MATCH?s:e)))];(l=r)?c.push([]):c[c.length-1].push(t)}}}}async function*d(e,t){const r=n.mergeArrays(a,n.stringToArray(t)),i=new o.ReadableStreamSearch(r,e)[Symbol.asyncIterator]();for(;;){const d=await i.next();if(d.done)return;if(d.value===o.MATCH)break}const l=new o.StreamSearch(s);for(;;){const[p,f]=await u(i,r);if(!p)return;async function h(){const e=await i.next();if(e.done)throw new Error("malformed multipart-form data: unexpected end of stream");return e}let m=!1;function b(e){const t=[];for(const r of l.feed(e))m&&t.push(s),(m=r===o.MATCH)||t.push(r);return n.mergeArrays(...t)}let y=!1;async function g(){const e=await h();let t;if(e.value!==o.MATCH)t=e.value;else{if(m)return y=!0,{value:l.end()};t=s}return{value:b(t)}}const _=[{value:b(f)}];for(yield{...c(p),data:{[Symbol.asyncIterator](){return this},async next(){for(;;){const e=_.shift();if(!e)break;if(e.value.length>0)return e}for(;;){if(y)return{done:y,value:void 0};const e=await g();if(e.value.length>0)return e}}}};!y;)_.push(await g())}}t.iterateMultipart=async function*(e,t){for await(const r of d(e,t)){const e=[];for await(const t of r.data)e.push(t);yield{...r,data:n.mergeArrays(...e)}}},t.streamMultipart=d},512:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(619);function n(e){return e instanceof Uint8Array?t=>e[t]:e}function i(e,t,r,o,i){const a=n(e),s=n(r);for(let e=0;e<i;++e)if(a(t+e)!==s(o+e))return!1;return!0}const a=Symbol("Match");class s{constructor(e){this._lookbehind=new Uint8Array,this._needle="string"==typeof e?e=o.stringToArray(e):e,this._lastChar=e[e.length-1],this._occ=function(e){const t=new Array(256).fill(e.length);if(e.length>1)for(let r=0;r<e.length-1;r++)t[e[r]]=e.length-1-r;return t}(e)}feed(e){let t,r=0;const o=[];for(;r!==e.length;)[r,...t]=this._feed(e,r),o.push(...t);return o}end(){const e=this._lookbehind;return this._lookbehind=new Uint8Array,e}_feed(e,t){const r=[];let o=-this._lookbehind.length;if(o<0){for(;o<0&&o<=e.length-this._needle.length;){const t=this._charAt(e,o+this._needle.length-1);if(t===this._lastChar&&this._memcmp(e,o,this._needle.length-1))return o>-this._lookbehind.length&&r.push(this._lookbehind.slice(0,this._lookbehind.length+o)),r.push(a),this._lookbehind=new Uint8Array,[o+this._needle.length,...r];o+=this._occ[t]}if(o<0)for(;o<0&&!this._memcmp(e,o,e.length-o);)o++;if(!(o>=0)){const t=this._lookbehind.length+o;return t>0&&(r.push(this._lookbehind.slice(0,t)),this._lookbehind=this._lookbehind.slice(t)),this._lookbehind=Uint8Array.from(new Array(this._lookbehind.length+e.length),((t,r)=>this._charAt(e,r-this._lookbehind.length))),[e.length,...r]}r.push(this._lookbehind),this._lookbehind=new Uint8Array}for(o+=t;o<=e.length-this._needle.length;){const n=e[o+this._needle.length-1];if(n===this._lastChar&&e[o]===this._needle[0]&&i(this._needle,0,e,o,this._needle.length-1))return o>t&&r.push(e.slice(t,o)),r.push(a),[o+this._needle.length,...r];o+=this._occ[n]}if(o<e.length){for(;o<e.length&&(e[o]!==this._needle[0]||!i(e,o,this._needle,0,e.length-o));)++o;o<e.length&&(this._lookbehind=e.slice(o))}return o>0&&r.push(e.slice(t,o<e.length?o:e.length)),[e.length,...r]}_charAt(e,t){return t<0?this._lookbehind[this._lookbehind.length+t]:e[t]}_memcmp(e,t,r){return i(this._charAt.bind(this,e),t,this._needle,0,r)}}class l{constructor(e,t){this._readableStream=t,this._search=new s(e)}async*[Symbol.asyncIterator](){const e=this._readableStream.getReader();try{for(;;){const t=await e.read();if(t.done)break;yield*this._search.feed(t.value)}const t=this._search.end();t.length&&(yield t)}finally{e.releaseLock()}}}const c=Symbol("End of Queue");class u{constructor(e){this._chunksQueue=[],this._closed=!1,this._search=new s(e)}push(...e){if(this._closed)throw new Error("cannot call push after close");this._chunksQueue.push(...e),this._notify&&this._notify()}close(){if(this._closed)throw new Error("close was already called");this._closed=!0,this._chunksQueue.push(c),this._notify&&this._notify()}async*[Symbol.asyncIterator](){for(;;){let e;for(;!(e=this._chunksQueue.shift());)await new Promise((e=>this._notify=e)),this._notify=void 0;if(e===c)break;yield*this._search.feed(e)}const e=this._search.end();e.length&&(yield e)}}function d(e,t){const r=new s(t),n=[[]];for(const t of e)for(const e of r.feed(t))e===a?n.push([]):n[n.length-1].push(e);const i=r.end();return n[n.length-1].push(i),n.map((e=>o.mergeArrays(...e)))}async function*p(e){let t=[];for await(const r of e)r===a?(yield t,t=[]):t.push(r);yield t}async function*f(e){for await(const t of p(e))yield t.map(o.arrayToString).join("")}t.MATCH=a,t.QueueableStreamSearch=u,t.ReadableStreamSearch=l,t.StreamSearch=s,t.allStrings=async function(e){const t=[];for await(const r of f(e))t.push(r);return t},t.arrayIterator=async function*(e){for await(const t of p(e))yield o.mergeArrays(...t)},t.chunksIterator=p,t.split=function(e,t){return d([e],t)},t.splitChunks=d,t.stringIterator=f},619:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arrayToString=function(e){const t=String.fromCharCode.apply(null,e);return decodeURIComponent(escape(t))},t.arraysEqual=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},t.mergeArrays=function(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;for(const o of e)t.set(o,r),r+=o.length;return t},t.stringToArray=function(e){const t=unescape(encodeURIComponent(e));return Uint8Array.from(t,((e,r)=>t.charCodeAt(r)))}},264:e=>{"use strict";e.exports=function(e){if(!/^data:/i.test(e))throw new TypeError('`uri` does not appear to be a Data URI (must begin with "data:")');const t=(e=e.replace(/\r?\n/g,"")).indexOf(",");if(-1===t||t<=4)throw new TypeError("malformed data: URI");const r=e.substring(5,t).split(";");let o="",n=!1;const i=r[0]||"text/plain";let a=i;for(let e=1;e<r.length;e++)"base64"===r[e]?n=!0:(a+=`;${r[e]}`,0===r[e].indexOf("charset=")&&(o=r[e].substring(8)));r[0]||o.length||(a+=";charset=US-ASCII",o="US-ASCII");const s=n?"base64":"ascii",l=unescape(e.substring(t+1)),c=Buffer.from(l,s);return c.type=i,c.typeFull=a,c.charset=o,c}},544:(e,t)=>{const r={ez:"application/andrew-inset",aw:"application/applixware",atom:"application/atom+xml",atomcat:"application/atomcat+xml",atomdeleted:"application/atomdeleted+xml",atomsvc:"application/atomsvc+xml",dwd:"application/atsc-dwd+xml",held:"application/atsc-held+xml",rsat:"application/atsc-rsat+xml",bdoc:"application/bdoc",xcs:"application/calendar+xml",ccxml:"application/ccxml+xml",cdfx:"application/cdfx+xml",cdmia:"application/cdmi-capability",cdmic:"application/cdmi-container",cdmid:"application/cdmi-domain",cdmio:"application/cdmi-object",cdmiq:"application/cdmi-queue",cu:"application/cu-seeme",mpd:"application/dash+xml",davmount:"application/davmount+xml",dbk:"application/docbook+xml",dssc:"application/dssc+der",xdssc:"application/dssc+xml",es:"application/ecmascript",ecma:"application/ecmascript",emma:"application/emma+xml",emotionml:"application/emotionml+xml",epub:"application/epub+zip",exi:"application/exi",fdt:"application/fdt+xml",pfr:"application/font-tdpfr",geojson:"application/geo+json",gml:"application/gml+xml",gpx:"application/gpx+xml",gxf:"application/gxf",gz:"application/gzip",hjson:"application/hjson",stk:"application/hyperstudio",ink:"application/inkml+xml",inkml:"application/inkml+xml",ipfix:"application/ipfix",its:"application/its+xml",jar:"application/java-archive",war:"application/java-archive",ear:"application/java-archive",ser:"application/java-serialized-object",class:"application/java-vm",js:"application/javascript",mjs:"application/javascript",json:"application/json",map:"application/json",json5:"application/json5",jsonml:"application/jsonml+json",jsonld:"application/ld+json",lgr:"application/lgr+xml",lostxml:"application/lost+xml",hqx:"application/mac-binhex40",cpt:"application/mac-compactpro",mads:"application/mads+xml",webmanifest:"application/manifest+json",mrc:"application/marc",mrcx:"application/marcxml+xml",ma:"application/mathematica",nb:"application/mathematica",mb:"application/mathematica",mathml:"application/mathml+xml",mbox:"application/mbox",mscml:"application/mediaservercontrol+xml",metalink:"application/metalink+xml",meta4:"application/metalink4+xml",mets:"application/mets+xml",maei:"application/mmt-aei+xml",musd:"application/mmt-usd+xml",mods:"application/mods+xml",m21:"application/mp21",mp21:"application/mp21",mp4s:"application/mp4",m4p:"application/mp4",doc:"application/msword",dot:"application/msword",mxf:"application/mxf",nq:"application/n-quads",nt:"application/n-triples",cjs:"application/node",bin:"application/octet-stream",dms:"application/octet-stream",lrf:"application/octet-stream",mar:"application/octet-stream",so:"application/octet-stream",dist:"application/octet-stream",distz:"application/octet-stream",pkg:"application/octet-stream",bpk:"application/octet-stream",dump:"application/octet-stream",elc:"application/octet-stream",deploy:"application/octet-stream",exe:"application/octet-stream",dll:"application/octet-stream",deb:"application/octet-stream",dmg:"application/octet-stream",iso:"application/octet-stream",img:"application/octet-stream",msi:"application/octet-stream",msp:"application/octet-stream",msm:"application/octet-stream",buffer:"application/octet-stream",oda:"application/oda",opf:"application/oebps-package+xml",ogx:"application/ogg",omdoc:"application/omdoc+xml",onetoc:"application/onenote",onetoc2:"application/onenote",onetmp:"application/onenote",onepkg:"application/onenote",oxps:"application/oxps",relo:"application/p2p-overlay+xml",xer:"application/patch-ops-error+xml",pdf:"application/pdf",pgp:"application/pgp-encrypted",asc:"application/pgp-signature",sig:"application/pgp-signature",prf:"application/pics-rules",p10:"application/pkcs10",p7m:"application/pkcs7-mime",p7c:"application/pkcs7-mime",p7s:"application/pkcs7-signature",p8:"application/pkcs8",ac:"application/pkix-attr-cert",cer:"application/pkix-cert",crl:"application/pkix-crl",pkipath:"application/pkix-pkipath",pki:"application/pkixcmp",pls:"application/pls+xml",ai:"application/postscript",eps:"application/postscript",ps:"application/postscript",provx:"application/provenance+xml",cww:"application/prs.cww",pskcxml:"application/pskc+xml",raml:"application/raml+yaml",rdf:"application/rdf+xml",owl:"application/rdf+xml",rif:"application/reginfo+xml",rnc:"application/relax-ng-compact-syntax",rl:"application/resource-lists+xml",rld:"application/resource-lists-diff+xml",rs:"application/rls-services+xml",rapd:"application/route-apd+xml",sls:"application/route-s-tsid+xml",rusd:"application/route-usd+xml",gbr:"application/rpki-ghostbusters",mft:"application/rpki-manifest",roa:"application/rpki-roa",rsd:"application/rsd+xml",rss:"application/rss+xml",rtf:"application/rtf",sbml:"application/sbml+xml",scq:"application/scvp-cv-request",scs:"application/scvp-cv-response",spq:"application/scvp-vp-request",spp:"application/scvp-vp-response",sdp:"application/sdp",senmlx:"application/senml+xml",sensmlx:"application/sensml+xml",setpay:"application/set-payment-initiation",setreg:"application/set-registration-initiation",shf:"application/shf+xml",siv:"application/sieve",sieve:"application/sieve",smi:"application/smil+xml",smil:"application/smil+xml",rq:"application/sparql-query",srx:"application/sparql-results+xml",gram:"application/srgs",grxml:"application/srgs+xml",sru:"application/sru+xml",ssdl:"application/ssdl+xml",ssml:"application/ssml+xml",swidtag:"application/swid+xml",tei:"application/tei+xml",teicorpus:"application/tei+xml",tfi:"application/thraud+xml",tsd:"application/timestamped-data",toml:"application/toml",trig:"application/trig",ttml:"application/ttml+xml",ubj:"application/ubjson",rsheet:"application/urc-ressheet+xml",td:"application/urc-targetdesc+xml",vxml:"application/voicexml+xml",wasm:"application/wasm",wgt:"application/widget",hlp:"application/winhlp",wsdl:"application/wsdl+xml",wspolicy:"application/wspolicy+xml",xaml:"application/xaml+xml",xav:"application/xcap-att+xml",xca:"application/xcap-caps+xml",xdf:"application/xcap-diff+xml",xel:"application/xcap-el+xml",xns:"application/xcap-ns+xml",xenc:"application/xenc+xml",xhtml:"application/xhtml+xml",xht:"application/xhtml+xml",xlf:"application/xliff+xml",xml:"application/xml",xsl:"application/xml",xsd:"application/xml",rng:"application/xml",dtd:"application/xml-dtd",xop:"application/xop+xml",xpl:"application/xproc+xml",xslt:"application/xml",xspf:"application/xspf+xml",mxml:"application/xv+xml",xhvml:"application/xv+xml",xvml:"application/xv+xml",xvm:"application/xv+xml",yang:"application/yang",yin:"application/yin+xml",zip:"application/zip","3gpp":"video/3gpp",adp:"audio/adpcm",amr:"audio/amr",au:"audio/basic",snd:"audio/basic",mid:"audio/midi",midi:"audio/midi",kar:"audio/midi",rmi:"audio/midi",mxmf:"audio/mobile-xmf",mp3:"audio/mpeg",m4a:"audio/mp4",mp4a:"audio/mp4",mpga:"audio/mpeg",mp2:"audio/mpeg",mp2a:"audio/mpeg",m2a:"audio/mpeg",m3a:"audio/mpeg",oga:"audio/ogg",ogg:"audio/ogg",spx:"audio/ogg",opus:"audio/ogg",s3m:"audio/s3m",sil:"audio/silk",wav:"audio/wav",weba:"audio/webm",xm:"audio/xm",ttc:"font/collection",otf:"font/otf",ttf:"font/ttf",woff:"font/woff",woff2:"font/woff2",exr:"image/aces",apng:"image/apng",avif:"image/avif",bmp:"image/bmp",cgm:"image/cgm",drle:"image/dicom-rle",emf:"image/emf",fits:"image/fits",g3:"image/g3fax",gif:"image/gif",heic:"image/heic",heics:"image/heic-sequence",heif:"image/heif",heifs:"image/heif-sequence",hej2:"image/hej2k",hsj2:"image/hsj2",ief:"image/ief",jls:"image/jls",jp2:"image/jp2",jpg2:"image/jp2",jpeg:"image/jpeg",jpg:"image/jpeg",jpe:"image/jpeg",jph:"image/jph",jhc:"image/jphc",jpm:"image/jpm",jpx:"image/jpx",jpf:"image/jpx",jxr:"image/jxr",jxra:"image/jxra",jxrs:"image/jxrs",jxs:"image/jxs",jxsc:"image/jxsc",jxsi:"image/jxsi",jxss:"image/jxss",ktx:"image/ktx",ktx2:"image/ktx2",png:"image/png",btif:"image/prs.btif",pti:"image/prs.pti",sgi:"image/sgi",svg:"image/svg+xml",svgz:"image/svg+xml",t38:"image/t38",tif:"image/tiff",tiff:"image/tiff",tfx:"image/tiff-fx",webp:"image/webp",wmf:"image/wmf","disposition-notification":"message/disposition-notification",u8msg:"message/global",u8dsn:"message/global-delivery-status",u8mdn:"message/global-disposition-notification",u8hdr:"message/global-headers",eml:"message/rfc822",mime:"message/rfc822","3mf":"model/3mf",gltf:"model/gltf+json",glb:"model/gltf-binary",igs:"model/iges",iges:"model/iges",msh:"model/mesh",mesh:"model/mesh",silo:"model/mesh",mtl:"model/mtl",obj:"model/obj",stpz:"model/step+zip",stpxz:"model/step-xml+zip",stl:"model/stl",wrl:"model/vrml",vrml:"model/vrml",x3db:"model/x3d+fastinfoset",x3dbz:"model/x3d+binary",x3dv:"model/x3d-vrml",x3dvz:"model/x3d+vrml",x3d:"model/x3d+xml",x3dz:"model/x3d+xml",appcache:"text/cache-manifest",manifest:"text/cache-manifest",ics:"text/calendar",ifb:"text/calendar",coffee:"text/coffeescript",litcoffee:"text/coffeescript",css:"text/css",csv:"text/csv",html:"text/html",htm:"text/html",shtml:"text/html",jade:"text/jade",jsx:"text/jsx",less:"text/less",markdown:"text/markdown",md:"text/markdown",mml:"text/mathml",mdx:"text/mdx",n3:"text/n3",txt:"text/plain",text:"text/plain",conf:"text/plain",def:"text/plain",list:"text/plain",log:"text/plain",in:"text/plain",ini:"text/plain",dsc:"text/prs.lines.tag",rtx:"text/richtext",sgml:"text/sgml",sgm:"text/sgml",shex:"text/shex",slim:"text/slim",slm:"text/slim",spdx:"text/spdx",stylus:"text/stylus",styl:"text/stylus",tsv:"text/tab-separated-values",t:"text/troff",tr:"text/troff",roff:"text/troff",man:"text/troff",me:"text/troff",ms:"text/troff",ttl:"text/turtle",uri:"text/uri-list",uris:"text/uri-list",urls:"text/uri-list",vcard:"text/vcard",vtt:"text/vtt",yaml:"text/yaml",yml:"text/yaml","3gp":"video/3gpp","3g2":"video/3gpp2",h261:"video/h261",h263:"video/h263",h264:"video/h264",m4s:"video/iso.segment",jpgv:"video/jpeg",jpgm:"image/jpm",mj2:"video/mj2",mjp2:"video/mj2",ts:"video/mp2t",mp4:"video/mp4",mp4v:"video/mp4",mpg4:"video/mp4",mpeg:"video/mpeg",mpg:"video/mpeg",mpe:"video/mpeg",m1v:"video/mpeg",m2v:"video/mpeg",ogv:"video/ogg",qt:"video/quicktime",mov:"video/quicktime",webm:"video/webm"};t.lookup=function(e){let t=(""+e).trim().toLowerCase(),o=t.lastIndexOf(".");return r[~o?t.substring(++o):t]},t.mimes=r},142:function(e,t,r){"use strict";var o=this&&this.__awaiter||function(e,t,r,o){return new(r||(r=Promise))((function(n,i){function a(e){try{l(o.next(e))}catch(e){i(e)}}function s(e){try{l(o.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}l((o=o.apply(e,t||[])).next())}))},n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.DidStore=void 0;const i=n(r(172)),a=r(557),s=r(543),l=r(742);t.DidStore=class{constructor(e,t={}){this.baseUrl=e,this.DEFAULT_GET_TIMEOUT=3e4,this.DEFAULT_IPFS_API_PATH="ipfs",this.params=this.encodeParams({"stream-channels":!1,"raw-leaves":!0,"cid-version":1});const{headers:r,apiPath:o}=t;this.headers=r,this.apiPath=o||this.DEFAULT_IPFS_API_PATH}save(e){return o(this,void 0,void 0,(function*(){const t=new s.Blob([e]),{cid:r}=yield this.add(t);return r.toString()}))}get(e,t=this.DEFAULT_GET_TIMEOUT){return o(this,void 0,void 0,(function*(){const r=new AbortController;setTimeout((()=>r.abort()),t);try{const t=yield this.request(`${this.apiPath}/${e}`,{method:"GET",signal:r.signal});if(200!==t.status)throw new l.ContentNotFound(e,t.statusText);return t.text()}catch(r){if(r.name===l.AbortErrorName)throw new l.ContentNotFound(e,`Timeout ${t} msec expired`);throw r}}))}delete(e){return o(this,void 0,void 0,(function*(){throw new Error("Not supported yet")}))}add(e){var t;return o(this,void 0,void 0,(function*(){const r=new a.FormData;r.append("file",e);try{const e=yield this.request("add",{method:"POST",body:r,params:this.params});if(!e.ok)throw new Error(e.statusText);const t=(yield e.json())[0];return Object.assign(Object.assign({},t),{cid:t.cid})}catch(e){const r=e;throw(null===(t=null==r?void 0:r.response)||void 0===t?void 0:t.ok)?new Error(`failed to parse response body from cluster add ${null==r?void 0:r.stack}`):r}}))}request(e,{method:t,body:r,params:n={},signal:a}){return o(this,void 0,void 0,(function*(){const o=new URL(e,this.baseUrl);for(const[e,t]of Object.entries(n))null!=t&&o.searchParams.set(e,String(t));return(0,i.default)(o.href,{method:t,headers:this.headers,body:r,signal:a})}))}encodeParams(e){return Object.fromEntries(Object.entries(e).filter((([,e])=>null!=e)))}}},742:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AbortErrorName=t.ContentNotFound=void 0;class r extends Error{constructor(e,t){super(`Content with identifier ${e} was not found in DID Store ${t?`: ${t}`:""}`)}}t.ContentNotFound=r,t.AbortErrorName="AbortError"},920:function(e,t,r){"use strict";var o=this&&this.__createBinding||(Object.create?function(e,t,r,o){void 0===o&&(o=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,o,n)}:function(e,t,r,o){void 0===o&&(o=r),e[o]=t[r]}),n=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||o(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),n(r(142),t),n(r(742),t)},693:(e,t,r)=>{"use strict";t.TextEncoder="undefined"!=typeof TextEncoder?TextEncoder:r(837).TextEncoder,t.TextDecoder="undefined"!=typeof TextDecoder?TextDecoder:r(837).TextDecoder},113:e=>{"use strict";e.exports=require("crypto")},147:e=>{"use strict";e.exports=require("fs")},685:e=>{"use strict";e.exports=require("http")},687:e=>{"use strict";e.exports=require("https")},781:e=>{"use strict";e.exports=require("stream")},356:e=>{"use strict";e.exports=require("stream/web")},310:e=>{"use strict";e.exports=require("url")},837:e=>{"use strict";e.exports=require("util")},796:e=>{"use strict";e.exports=require("zlib")},100:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(693),n=r(385);const i=class e{constructor(e=[],t={}){const r=[];let n=0;for(const t of e)if("string"==typeof t){const e=(new o.TextEncoder).encode(t);r.push(e),n+=e.byteLength}else if(t instanceof i)n+=t.size,r.push(...t._parts);else if(t instanceof ArrayBuffer)r.push(new Uint8Array(t)),n+=t.byteLength;else if(t instanceof Uint8Array)r.push(t),n+=t.byteLength;else if(ArrayBuffer.isView(t)){const{buffer:e,byteOffset:o,byteLength:i}=t;r.push(new Uint8Array(e,o,i)),n+=i}else{const e=(new o.TextEncoder).encode(String(t));r.push(e),n+=e.byteLength}this._size=n,this._type=c(t.type),this._parts=r,Object.defineProperties(this,{_size:{enumerable:!1},_type:{enumerable:!1},_parts:{enumerable:!1}})}get type(){return this._type}get size(){return this._size}slice(t=0,r=this.size,o=""){const{size:n,_parts:i}=this;let a=t<0?Math.max(n+t,0):Math.min(t,n),s=r<0?Math.max(n+r,0):Math.min(r,n);const l=Math.max(s-a,0),c=new e([],{type:o});if(0===l)return c;let u=0;const d=[];for(const e of i){const{byteLength:t}=e;if(a>0&&t<=a)a-=t,s-=t;else{const r=e.subarray(a,Math.min(t,s));if(d.push(r),u+=r.byteLength,a=0,u>=l)break}}return c._parts=d,c._size=u,c}async arrayBuffer(){const e=new ArrayBuffer(this.size),t=new Uint8Array(e);let r=0;for(const e of this._parts)t.set(e,r),r+=e.byteLength;return e}async text(){const e=new o.TextDecoder;let t="";for(const r of this._parts)t+=e.decode(r);return t}stream(){return new s(this._parts)}toString(){return"[object Blob]"}get[Symbol.toStringTag](){return"Blob"}},a=i;class s extends n.ReadableStream{constructor(e){super(new l(e.values()),{type:"bytes"}),this._chunks=e}async*[Symbol.asyncIterator](e){const t=this.getReader();yield*this._chunks,t.releaseLock()}}class l{constructor(e){this.chunks=e}start(e){this.work(e),this.isWorking=!1,this.isCancelled=!1}async work(e){const{chunks:t}=this;for(this.isWorking=!0;!this.isCancelled&&(e.desiredSize||0)>0;){let r=null;try{r=t.next()}catch(t){e.error(t);break}r&&(r.done||this.isCancelled?e.close():e.enqueue(r.value))}this.isWorking=!1}pull(e){this.isWorking||this.work(e)}cancel(){this.isCancelled=!0}}const c=(e="")=>{const t=String(e).toLowerCase();return/[^\u0020-\u007E]/.test(t)?"":t};Object.defineProperty(t,"TextDecoder",{enumerable:!0,get:function(){return o.TextDecoder}}),Object.defineProperty(t,"TextEncoder",{enumerable:!0,get:function(){return o.TextEncoder}}),Object.defineProperty(t,"ReadableStream",{enumerable:!0,get:function(){return n.ReadableStream}}),t.Blob=a},779:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(693),n=r(385),i=r(100);const a=globalThis.Blob||i.Blob;Object.defineProperty(t,"TextDecoder",{enumerable:!0,get:function(){return o.TextDecoder}}),Object.defineProperty(t,"TextEncoder",{enumerable:!0,get:function(){return o.TextEncoder}}),Object.defineProperty(t,"ReadableStream",{enumerable:!0,get:function(){return n.ReadableStream}}),t.Blob=a},385:(e,t,r)=>{try{e.exports=r(356)}catch(t){e.exports=r(993)}},172:(e,t,r)=>{"use strict";const o=r(685),n=r(687),i=r(796),a=r(147),s=r(544),l=r(264),c=r(781),u=r(837),d=r(779),p=r(557),f=r(113),h=r(928),m=r(310);class b extends Error{constructor(e,t){super(e),Error.captureStackTrace(this,this.constructor),this.type=t}get name(){return this.constructor.name}get[Symbol.toStringTag](){return this.constructor.name}}class y extends b{constructor(e,t,r){super(e,t),r&&(this.code=this.errno=r.code,this.erroredSysCall=r.syscall)}}const g=Symbol.toStringTag,_=e=>"object"==typeof e&&"function"==typeof e.arrayBuffer&&"string"==typeof e.type&&"function"==typeof e.stream&&"function"==typeof e.constructor&&/^(Blob|File)$/.test(e[g]),v="\r\n",w="-".repeat(2),S=Buffer.byteLength(v),x=e=>`${w}${e}${w}${v.repeat(2)}`;function T(e,t,r){let o="";if(o+=`${w}${e}${v}`,o+=`Content-Disposition: form-data; name="${t}"`,_(r)){const{name:e="blob",type:t}=r;o+=`; filename="${e}"${v}`,o+=`Content-Type: ${t||"application/octet-stream"}`}return`${o}${v.repeat(2)}`}const R=new u.TextEncoder,j=new u.TextDecoder,P=e=>R.encode(e),{readableHighWaterMark:E}=new c.Readable,k=Symbol("Body internals");class C{constructor(e,{size:t=0}={}){const r={body:null,type:null,size:null,boundary:null,disturbed:!1,error:null};if(this[k]=r,null===e)r.body=null,r.size=0;else if("object"==typeof(n=e)&&"function"==typeof n.append&&"function"==typeof n.delete&&"function"==typeof n.get&&"function"==typeof n.getAll&&"function"==typeof n.has&&"function"==typeof n.set&&"function"==typeof n.sort&&"URLSearchParams"===n[g]){const t=P(e.toString());r.body=B(t),r.size=t.byteLength,r.type="application/x-www-form-urlencoded;charset=UTF-8"}else if(_(e))r.size=e.size,r.type=e.type||null,r.body=e.stream();else if(e instanceof Uint8Array)r.body=B(e),r.size=e.byteLength;else if(u.types.isAnyArrayBuffer(e)){const t=new Uint8Array(e);r.body=B(t),r.size=t.byteLength}else if(ArrayBuffer.isView(e)){const t=new Uint8Array(e.buffer,e.byteOffset,e.byteLength);r.body=B(t),r.size=t.byteLength}else if("object"==typeof(o=e)&&"function"==typeof o.getReader&&"function"==typeof o.cancel&&"function"==typeof o.tee)r.body=e;else if(function(e){return"object"==typeof e&&"function"==typeof e.append&&"function"==typeof e.set&&"function"==typeof e.get&&"function"==typeof e.getAll&&"function"==typeof e.delete&&"function"==typeof e.keys&&"function"==typeof e.values&&"function"==typeof e.entries&&"function"==typeof e.constructor&&"FormData"===e[g]}(e)){const t=`NodeFetchFormDataBoundary${f.randomBytes(8).toString("hex")}`;r.type=`multipart/form-data; boundary=${t}`,r.size=function(e,t){let r=0;for(const[o,n]of e)r+=Buffer.byteLength(T(t,o,n)),_(n)?r+=n.size:r+=Buffer.byteLength(String(n)),r+=S;return r+=Buffer.byteLength(x(t)),r}(e,t),r.body=W(async function*(e,t){for(const[r,o]of e)yield T(t,r,o),_(o)?yield*o.stream():yield o,yield v;yield x(t)}(e,t))}else if((e=>e instanceof c==1&&"function"==typeof e.getBoundary&&"function"==typeof e.hasKnownLength&&"function"==typeof e.getLengthSync)(e))r.type=`multipart/form-data; boundary=${e.getBoundary()}`,r.size=e.hasKnownLength()?e.getLengthSync():null,r.body=I(e);else if(e instanceof c)r.body=I(e);else{const t=P(String(e));r.type="text/plain;charset=UTF-8",r.size=t.byteLength,r.body=B(t)}var o,n;this.size=t}get headers(){throw new TypeError("'get headers' called on an object that does not implements interface.")}get body(){return this[k].body}get bodyUsed(){return this[k].disturbed}async arrayBuffer(){const{buffer:e,byteOffset:t,byteLength:r}=await q(this);return e.slice(t,t+r)}async blob(){const e=this.headers&&this.headers.get("content-type")||this[k].body&&this[k].type||"",t=await q(this);return new d.Blob([t],{type:e})}async json(){return JSON.parse(await this.text())}async text(){return e=await q(this),j.decode(e);var e}async formData(){return(async e=>{let{body:t,headers:r}=e;const o=r?.get("Content-Type")||"";if(o.startsWith("application/x-www-form-urlencoded")&&null!=t){const t=new p.FormData;let r=await e.text();return new URLSearchParams(r).forEach(((e,r)=>t.append(r,e))),t}const[n,i]=o.split(/\s*;\s*boundary=/);if("multipart/form-data"===n&&null!=i&&null!=t){const e=new p.FormData,r=h.iterateMultipart(t,i);for await(const{name:t,data:o,filename:n,contentType:i}of r)n?e.append(t,new File([o],n,{type:i})):e.append(t,(new TextDecoder).decode(o),n);return e}throw new TypeError("Could not parse content as FormData.")})(this)}}async function q(e){const t=e[k];if(t.disturbed)throw new TypeError(`body used already for: ${e.url}`);if(t.disturbed=!0,t.error)throw t.error;const{body:r}=t;if(null===r)return new Uint8Array(0);const[o,n,i]=e.size>0?[new Uint8Array(e.size),[],e.size]:[null,[],1/0];let a=0;const s=L(r);try{for await(const t of s){const r=t instanceof Uint8Array?t:Buffer.from(t);if(a+r.byteLength>i){const t=new y(`content size at ${e.url} over limit: ${i}`,"max-size");throw s.throw(t),t}o?o.set(r,a):n.push(r),a+=r.byteLength}if(o){if(a<o.byteLength)throw new y(`Premature close of server response while trying to fetch ${e.url}`,"premature-close");return o}return F(new Uint8Array(a),n)}catch(t){if(t instanceof b)throw t;if(t&&"AbortError"===t.name)throw t;{const r=t;throw new y(`Invalid response body while trying to fetch ${e.url}: ${r.message}`,"system",r)}}}Object.defineProperties(C.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},formData:{enumerable:!0}});const O=e=>{const{body:t}=e;if(e.bodyUsed)throw new Error("cannot clone body after it is used");const[r,o]=t.tee();return e[k].body=r,o},A=e=>e[k].type;class z{constructor(e){this.stream=e,this.reader=null}[Symbol.asyncIterator](){return this}getReader(){if(this.reader)return this.reader;const e=this.stream.getReader();return this.reader=e,e}next(){return this.getReader().read()}async return(){return this.reader&&await this.reader.cancel(),{done:!0,value:void 0}}async throw(e){return await this.getReader().cancel(e),{done:!0,value:void 0}}}const L=e=>new z(e),F=(e,t)=>{let r=0;for(const o of t)e.set(o,r),r+=o.byteLength;return e},B=e=>new d.ReadableStream({start(t){t.enqueue(e),t.close()}}),W=e=>new d.ReadableStream(new M(e));class M{constructor(e){this.source=e[Symbol.asyncIterator]()}async pull(e){try{for(;e.desiredSize;){const t=await this.source.next();if(t.done){e.close();break}e.enqueue(t.value)}}catch(t){e.error(t)}}cancel(e){e&&"function"==typeof this.source.throw?this.source.throw(e):"function"==typeof this.source.return&&this.source.return()}}const I=e=>{const t=new D(e);return new d.ReadableStream(t,t)};class D{constructor(e){this.highWaterMark=e.readableHighWaterMark||E,this.accumalatedSize=0,this.stream=e,this.enqueue=this.enqueue.bind(this),this.error=this.error.bind(this),this.close=this.close.bind(this)}size(e){return e?.byteLength||0}start(e){this.controller=e,this.stream.on("data",this.enqueue),this.stream.once("error",this.error),this.stream.once("end",this.close),this.stream.once("close",this.close)}pull(){this.resume()}cancel(e){this.stream.destroy&&this.stream.destroy(e),this.stream.off("data",this.enqueue),this.stream.off("error",this.error),this.stream.off("end",this.close),this.stream.off("close",this.close)}enqueue(e){if(this.controller)try{const t=e instanceof Uint8Array?e:Buffer.from(e),r=(this.controller.desiredSize||0)-t.byteLength;this.controller.enqueue(t),r<=0&&this.pause()}catch{this.controller.error(new Error("Could not create Buffer, chunk must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object")),this.cancel()}}pause(){this.stream.pause&&this.stream.pause()}resume(){this.stream.readable&&this.stream.resume&&this.stream.resume()}close(){this.controller&&(this.controller.close(),delete this.controller)}error(e){this.controller&&(this.controller.error(e),delete this.controller)}}const U=o,H="function"==typeof U.validateHeaderName?U.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){const t=new TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_HTTP_TOKEN"}),t}},$="function"==typeof U.validateHeaderValue?U.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){const t=new TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,"code",{value:"ERR_INVALID_CHAR"}),t}};class N extends URLSearchParams{constructor(e){let t=[];if(e instanceof N){const r=e.raw();for(const[e,o]of Object.entries(r))t.push(...o.map((t=>[e,t])))}else if(null==e);else if((r=e)&&Symbol.iterator in r)t=[...e].map((e=>{if("object"!=typeof e||u.types.isBoxedPrimitive(e))throw new TypeError("Each header pair must be an iterable object");return[...e]})).map((e=>{if(2!==e.length)throw new TypeError("Each header pair must be a name/value tuple");return[...e]}));else{if("object"!=typeof e||null===e)throw new TypeError("Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)");t.push(...Object.entries(e))}var r;return t=t.length>0?t.map((([e,t])=>(H(e),$(e,String(t)),[String(e).toLowerCase(),String(t)]))):[],super(t),new Proxy(this,{get(e,t,r){switch(t){case"append":case"set":return(e,o)=>(H(e),$(e,String(o)),URLSearchParams.prototype[t].call(r,String(e).toLowerCase(),String(o)));case"delete":case"has":case"getAll":return e=>(H(e),URLSearchParams.prototype[t].call(r,String(e).toLowerCase()));case"keys":return()=>(e.sort(),new Set(URLSearchParams.prototype.keys.call(e)).keys());default:return Reflect.get(e,t,r)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){const t=this.getAll(e);if(0===t.length)return null;let r=t.join(", ");return/^content-encoding$/i.test(e)&&(r=r.toLowerCase()),r}forEach(e,t=void 0){for(const r of this.keys())Reflect.apply(e,t,[this.get(r),r,this])}*values(){for(const e of this.keys())yield this.get(e)}*entries(){for(const e of this.keys())yield[e,this.get(e)]}[Symbol.iterator](){return this.entries()}raw(){return[...this.keys()].reduce(((e,t)=>(e[t]=this.getAll(t),e)),{})}[Symbol.for("nodejs.util.inspect.custom")](){return[...this.keys()].reduce(((e,t)=>{const r=this.getAll(t);return e[t]="host"===t?r[0]:r.length>1?r:r[0],e}),{})}}Object.defineProperties(N.prototype,["get","entries","forEach","values"].reduce(((e,t)=>(e[t]={enumerable:!0},e)),{}));const Q=new Set([301,302,303,307,308]),V=e=>Q.has(e),Y=Symbol("Response internals");class G extends C{constructor(e=null,t={}){super(e,t);const r=t.status||200,o=new N(t.headers);if(null!==e&&!o.has("Content-Type")){const e=A(this);e&&o.append("Content-Type",e)}this[Y]={url:t.url,status:r,statusText:t.statusText||"",headers:o,counter:t.counter||0,highWaterMark:t.highWaterMark}}get type(){return"default"}get url(){return this[Y].url||""}get status(){return this[Y].status}get ok(){return this[Y].status>=200&&this[Y].status<300}get redirected(){return this[Y].counter>0}get statusText(){return this[Y].statusText}get headers(){return this[Y].headers}get highWaterMark(){return this[Y].highWaterMark}clone(){return new G(O(this),{url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,size:this.size})}static redirect(e,t=302){if(!V(t))throw new RangeError('Failed to execute "redirect" on "response": Invalid status code');return new G(null,{headers:{location:new URL(e).toString()},status:t})}get[Symbol.toStringTag](){return"Response"}}Object.defineProperties(G.prototype,{url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}});const K=Symbol("Request internals"),J=e=>"object"==typeof e&&"object"==typeof e[K];class Z extends C{constructor(e,t={}){let r,o;J(e)?(r=new URL(e.url),o=e):(r=new URL(e),o={});let n=t.method||o.method||"GET";n=n.toUpperCase();const i=null!=t.body?t.body:J(e)&&null!==e.body?O(e):null;if(null!=i&&("GET"===n||"HEAD"===n))throw new TypeError("Request with GET/HEAD method cannot have body");super(i,{size:t.size||o.size||0});const a=o,s=new N(t.headers||a.headers||{});if(null!==i&&!s.has("Content-Type")){const e=A(this);e&&s.append("Content-Type",e)}let l="signal"in t?t.signal:J(a)?a.signal:null;if(null!=l&&("object"!=typeof(c=l)||"AbortSignal"!==c[g]&&"EventTarget"!==c[g]))throw new TypeError("Expected signal to be an instanceof AbortSignal or EventTarget");var c;this[K]={method:n,redirect:t.redirect||a.redirect||"follow",headers:s,parsedURL:r,signal:l||null},this.keepalive,this.follow=void 0===t.follow?void 0===a.follow?20:a.follow:t.follow,this.compress=void 0===t.compress?void 0===a.compress||a.compress:t.compress,this.counter=t.counter||a.counter||0,this.agent=t.agent||a.agent,this.highWaterMark=t.highWaterMark||a.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||a.insecureHTTPParser||!1}get cache(){return"default"}get credentials(){return"same-origin"}get destination(){return""}get integrity(){return""}get mode(){return"cors"}get referrer(){return""}get referrerPolicy(){return""}get method(){return this[K].method}get url(){return m.format(this[K].parsedURL)}get headers(){return this[K].headers}get redirect(){return this[K].redirect}get signal(){return this[K].signal}clone(){return new Z(this)}get[Symbol.toStringTag](){return"Request"}}Object.defineProperties(Z.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0}});class X extends b{constructor(e,t="aborted"){super(e,t)}}const ee=new Set(["data:","http:","https:","file:"]),te="function"==typeof globalThis.fetch?globalThis.fetch.bind(globalThis):async function e(t,r={}){return new Promise(((u,p)=>{const f=new Z(t,r),h=(e=>{const{parsedURL:t}=e[K],r=new N(e[K].headers);r.has("Accept")||r.set("Accept","*/*");let o=null;if(null===e.body&&/^(post|put)$/i.test(e.method)&&(o="0"),null!==e.body){const t=e[k].size;"number"!=typeof t||Number.isNaN(t)||(o=String(t))}o&&r.set("Content-Length",o),r.has("User-Agent")||r.set("User-Agent","node-fetch"),e.compress&&!r.has("Accept-Encoding")&&r.set("Accept-Encoding","gzip,deflate,br");let{agent:n}=e;"function"==typeof n&&(n=n(t)),r.has("Connection")||n||r.set("Connection","close");const i=(e=>{if(e.search)return e.search;const t=e.href.length-1,r=e.hash||("#"===e.href[t]?"#":"");return"?"===e.href[t-r.length]?"?":""})(t);return{path:t.pathname+i,pathname:t.pathname,hostname:t.hostname,protocol:t.protocol,port:t.port,hash:t.hash,search:t.search,query:t.query,href:t.href,method:e.method,headers:r[Symbol.for("nodejs.util.inspect.custom")](),insecureHTTPParser:e.insecureHTTPParser,agent:n}})(f);if(!ee.has(h.protocol))throw new TypeError(`node-fetch cannot load ${t}. URL scheme "${h.protocol.replace(/:$/,"")}" is not supported.`);if("data:"===h.protocol){const e=l(f.url.toString()),t=new G(e,{headers:{"Content-Type":e.typeFull}});return void u(t)}if("file:"===h.protocol){const e=a.createReadStream(new URL(f.url)),t=s.lookup(f.url)||"application/octet-stream",r=new G(e,{headers:{"Content-Type":t}});return void u(r)}const m=("https:"===h.protocol?n:o).request,{signal:b}=f;let g=null,_=null;const v=()=>{const e=new X("The operation was aborted.");p(e),f.body&&f.body.cancel(e),_&&_.emit("error",e)};if(b&&b.aborted)return void v();const w=()=>{v(),x()},S=m(h);b&&b.addEventListener("abort",w);const x=()=>{S.abort(),b&&b.removeEventListener("abort",w)};S.on("error",(e=>{p(new y(`request to ${f.url} failed, reason: ${e.message}`,"system",e)),x()})),function(e,t){let r;e.on("socket",(e=>{r=e})),e.on("response",(e=>{const{headers:t}=e;"chunked"!==t["transfer-encoding"]||t["content-length"]||r.prependListener("close",(e=>{if(r.listenerCount("data")>0&&!e){(e=>{b&&b.aborted||_?.emit("error",e)})(Object.assign(new Error("Premature close"),{code:"ERR_STREAM_PREMATURE_CLOSE"}))}}))}))}(S),parseInt(process.version.substring(1))<14&&S.on("socket",(e=>{e.prependListener("close",(t=>{const r=e.listenerCount("data")>0;if(g&&r&&!t&&(!b||!b.aborted)){const e=Object.assign(new Error("Premature close"),{code:"ERR_STREAM_PREMATURE_CLOSE"});_?.emit("error",e)}}))})),S.on("response",(t=>{_=t,S.setTimeout(0);const o=function(e=[]){return new N(e.reduce(((e,t,r,o)=>(r%2==0&&e.push(o.slice(r,r+2)),e)),[]).filter((([e,t])=>{try{return H(e),$(e,String(t)),!0}catch{return!1}})))}(_.rawHeaders);if(V(Number(_.statusCode))){const t=o.get("Location"),n=null===t?null:new URL(t,f.url);switch(f.redirect){case"error":return p(new y(`uri requested responds with a redirect, redirect mode is set to error: ${f.url}`,"no-redirect")),void x();case"manual":null!==n&&o.set("Location",n.toString());break;case"follow":{if(null===n)break;if(f.counter>=f.follow)return p(new y(`maximum redirect reached at: ${f.url}`,"max-redirect")),void x();const t={headers:new N(f.headers),follow:f.follow,counter:f.counter+1,agent:f.agent,compress:f.compress,method:f.method,body:r.body,signal:f.signal,size:f.size},o=t.body instanceof d.ReadableStream||t.body instanceof c.Readable;return 303!==_.statusCode&&o?(p(new y("Cannot follow redirect with body being a readable stream","unsupported-redirect")),void x()):(303!==_.statusCode&&(301!==_.statusCode&&302!==_.statusCode||"POST"!==f.method)||(t.method="GET",t.body=void 0,t.headers.delete("content-length")),e(new Z(n.href,t)).then(u,p),void x())}default:return p(new TypeError(`Redirect option '${f.redirect}' is not a valid value of RequestRedirect`))}}b&&_.once("end",(()=>{b.removeEventListener("abort",w)}));let n=c.pipeline(_,new c.PassThrough,p);process.version<"v12.10"&&_.on("aborted",w);const a={url:f.url,status:_.statusCode,statusText:_.statusMessage,headers:o,size:f.size,counter:f.counter,highWaterMark:f.highWaterMark},s=o.get("Content-Encoding");if(!f.compress||"HEAD"===f.method||null===s||204===_.statusCode||304===_.statusCode)return g=new G(n,a),void u(g);const l={flush:i.Z_SYNC_FLUSH,finishFlush:i.Z_SYNC_FLUSH};if("gzip"===s||"x-gzip"===s)return n=c.pipeline(n,i.createGunzip(l),p),g=new G(W(n),a),void u(g);if("deflate"!==s&&"x-deflate"!==s){if("br"===s)return n=c.pipeline(n,i.createBrotliDecompress(),p),g=new G(W(n),a),void u(g);g=new G(W(n),a),u(g)}else c.pipeline(_,new c.PassThrough,p).once("data",(e=>{n=8==(15&e[0])?c.pipeline(n,i.createInflate(),p):c.pipeline(n,i.createInflateRaw(),p),g=new G(W(n),a),u(g)}))})),((e,{body:t})=>{null===t?e.end():c.Readable.from(L(t)).pipe(e)})(S,f)}))},re=globalThis.Headers||N,oe=globalThis.Request||Z,ne=globalThis.Response||G;Object.defineProperty(t,"Blob",{enumerable:!0,get:function(){return d.Blob}}),Object.defineProperty(t,"ReadableStream",{enumerable:!0,get:function(){return d.ReadableStream}}),Object.defineProperty(t,"FormData",{enumerable:!0,get:function(){return p.FormData}}),t.Headers=re,t.Request=oe,t.Response=ne,t.default=te,t.fetch=te,t=e.exports=Object.assign(te,t)},453:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(779);class n extends o.Blob{constructor(e,t=i(new TypeError("File constructor requires name argument")),r={}){super(e,r),this._name=t,this._lastModified=r.lastModified||Date.now()}get name(){return this._name}get webkitRelativePath(){return""}get lastModified(){return this._lastModified}get[Symbol.toStringTag](){return"File"}}const i=e=>{throw e};t.File=n},543:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(779),n=r(453);const i="function"==typeof globalThis.File?globalThis.File:n.File;Object.defineProperty(t,"Blob",{enumerable:!0,get:function(){return o.Blob}}),t.File=i},121:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});class r{constructor(e){if(void 0!==e)throw o(e)?new TypeError("FormData constructor: HTMLFormElement parameter is not supported, if you need it submit an issue"):new TypeError("FormData constructor: Argument 1 does not implement interface HTMLFormElement.");this._entries=[],Object.defineProperty(this,"_entries",{enumerable:!1})}get[Symbol.toStringTag](){return"FormData"}append(e,t=l(new TypeError("FormData.append: requires at least 2 arguments")),r){this._entries.push([e,n(t,r)])}delete(e=l(new TypeError("FormData.delete: requires string argument"))){const t=this._entries;let r=0;for(;r<t.length;){const[o]=t[r];o===e?t.splice(r,1):r++}}get(e=l(new TypeError("FormData.get: requires string argument"))){for(const[t,r]of this._entries)if(t===e)return r;return null}getAll(e=l(new TypeError("FormData.getAll: requires string argument"))){const t=[];for(const[r,o]of this._entries)r===e&&t.push(o);return t}has(e=l(new TypeError("FormData.has: requires string argument"))){for(const[t]of this._entries)if(t===e)return!0;return!1}set(e,t=l(new TypeError("FormData.set: requires at least 2 arguments")),r){let o=0;const{_entries:i}=this,a=n(t,r);let s=!1;for(;o<i.length;){const t=i[o];t[0]===e?s?i.splice(o,1):(s=!0,t[1]=a,o++):o++}s||i.push([e,a])}entries(){return this._entries.values()}*keys(){for(const[e]of this._entries)yield e}*values(){for(const[e,t]of this._entries)yield t}[Symbol.iterator](){return this._entries.values()}forEach(e,t){for(const[r,o]of this._entries)e.call(t,o,r,this)}}const o=e=>"[object HTMLFormElement]"===Object.prototype.toString.call(e),n=(e,t)=>{if(i(e))return null!=t?new s([e],t,e):e;if(a(e))return new s([e],null!=t?t:"blob");if(null!=t)throw new TypeError("filename is only supported when value is Blob or File");return`${e}`},i=e=>"[object File]"===Object.prototype.toString.call(e)&&"string"==typeof e.name,a=e=>"[object Blob]"===Object.prototype.toString.call(e),s=class{constructor([e],t,{lastModified:r=Date.now()}={}){this.blob=e,this.name=t,this.lastModified=r}get webkitRelativePath(){return""}get size(){return this.blob.size}get type(){return this.blob.type}slice(e,t,r){return this.blob.slice(e,t,r)}stream(){return this.blob.stream()}text(){return this.blob.text()}arrayBuffer(){return this.blob.arrayBuffer()}get[Symbol.toStringTag](){return"File"}},l=e=>{throw e};t.FormData=r},557:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=r(121);const n="function"==typeof globalThis.FormData?globalThis.FormData:o.FormData;t.FormData=n},993:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ByteLengthQueuingStrategy:()=>Cr,CountQueuingStrategy:()=>zr,ReadableByteStreamController:()=>ge,ReadableStream:()=>gr,ReadableStreamBYOBReader:()=>Ye,ReadableStreamBYOBRequest:()=>ye,ReadableStreamDefaultController:()=>er,ReadableStreamDefaultReader:()=>te,TransformStream:()=>Ir,TransformStreamDefaultController:()=>Nr,WritableStream:()=>lt,WritableStreamDefaultController:()=>Et,WritableStreamDefaultWriter:()=>wt});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol:function(e){return"Symbol("+e+")"};function n(){}var i="undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:void 0;function a(e){return"object"==typeof e&&null!==e||"function"==typeof e}var s=n,l=Promise,c=Promise.prototype.then,u=Promise.resolve.bind(l),d=Promise.reject.bind(l);function p(e){return new l(e)}function f(e){return u(e)}function h(e){return d(e)}function m(e,t,r){return c.call(e,t,r)}function b(e,t,r){m(m(e,t,r),void 0,s)}function y(e,t){b(e,t)}function g(e,t){b(e,void 0,t)}function _(e,t,r){return m(e,t,r)}function v(e){m(e,void 0,s)}var w=function(){var e=i&&i.queueMicrotask;if("function"==typeof e)return e;var t=f(void 0);return function(e){return m(t,e)}}();function S(e,t,r){if("function"!=typeof e)throw new TypeError("Argument is not a function");return Function.prototype.apply.call(e,t,r)}function x(e,t,r){try{return f(S(e,t,r))}catch(e){return h(e)}}var T=function(){function e(){this._cursor=0,this._size=0,this._front={_elements:[],_next:void 0},this._back=this._front,this._cursor=0,this._size=0}return Object.defineProperty(e.prototype,"length",{get:function(){return this._size},enumerable:!1,configurable:!0}),e.prototype.push=function(e){var t=this._back,r=t;16383===t._elements.length&&(r={_elements:[],_next:void 0}),t._elements.push(e),r!==t&&(this._back=r,t._next=r),++this._size},e.prototype.shift=function(){var e=this._front,t=e,r=this._cursor,o=r+1,n=e._elements,i=n[r];return 16384===o&&(t=e._next,o=0),--this._size,this._cursor=o,e!==t&&(this._front=t),n[r]=void 0,i},e.prototype.forEach=function(e){for(var t=this._cursor,r=this._front,o=r._elements;!(t===o.length&&void 0===r._next||t===o.length&&(t=0,0===(o=(r=r._next)._elements).length));)e(o[t]),++t},e.prototype.peek=function(){var e=this._front,t=this._cursor;return e._elements[t]},e}();function R(e,t){e._ownerReadableStream=t,t._reader=e,"readable"===t._state?k(e):"closed"===t._state?function(e){k(e),O(e)}(e):C(e,t._storedError)}function j(e,t){return Tr(e._ownerReadableStream,t)}function P(e){"readab