@usezinq/core 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1 +1,24 @@
1
- # a javascript library to do the boring part of webdev
1
+ # ZINQ - ZINQ Is Not jQuery
2
+
3
+ a library to do stuff that jquery could do, and much more
4
+
5
+ **example:**
6
+
7
+ ```ts
8
+ import { $, signal } from "@usezinq/core";
9
+
10
+ $(() => {
11
+ $("#app")?.html(`
12
+ <span id="count"></span>
13
+ <button id="increase">increase count</button>
14
+ <button id="decrease">decrease count</button>
15
+ `);
16
+
17
+ const count = signal(0);
18
+
19
+ $("#increase")?.on("click", () => count.set(count.get() + 1));
20
+ $("#decrease")?.on("click", () => count.set(count.get() - 1));
21
+
22
+ count.subscribe((val) => $("#count")?.text(val.toString()));
23
+ });
24
+ ```
package/dist/index.d.mts CHANGED
@@ -98,32 +98,6 @@ declare class ZinqElement {
98
98
  */
99
99
  remove(): void;
100
100
  }
101
- /**
102
- * Represents a collection of ZinqElement instances.
103
- * Provides utilities to iterate and manipulate multiple elements at once.
104
- */
105
- declare class ZinqCollection {
106
- elements: ZinqElement[];
107
- constructor(elements: Element[]);
108
- /**
109
- * Iterates over each element in the collection.
110
- * @param callback A function called for each ZinqElement in the collection.
111
- * Receives the ZinqElement and its index in the collection.
112
- * @example
113
- * $(".multipleElements").each((el, index) => {
114
- * el.markdown(`# Example ${index}`);
115
- * });
116
- */
117
- each(callback: (el: ZinqElement, index: number) => void): this;
118
- }
119
- /**
120
- * Selects multiple elements and always returns a ZinqCollection.
121
- * @param selector A CSS selector string or a single HTMLElement.
122
- * @returns A ZinqCollection containing all matched elements.
123
- * @example
124
- * multi$(".multipleElements").each(el => el.markdown("# Example"));
125
- */
126
- declare function multi$(selector: string | HTMLElement): ZinqCollection;
127
101
  type EventHandlers = { [K in Extract<keyof GlobalEventHandlers, `on${string}`>]: K extends `on${infer E}` ? E : never }[Extract<keyof GlobalEventHandlers, `on${string}`>];
128
102
  //#endregion
129
- export { $, Signal, ZinqCollection, ZinqElement, effect, ofetch as fetch, multi$, signal };
103
+ export { $, Signal, ZinqElement, effect, ofetch as fetch, signal };
@@ -69,4 +69,4 @@ Content-Type: ${e.type||`application/octet-stream`}\r
69
69
  `)),r.push(`--${n}--`),new t(r,{type:`multipart/form-data; boundary=`+n})}async function Ht(e){if(e[J].disturbed)throw TypeError(`body used already for: ${e.url}`);if(e[J].disturbed=!0,e[J].error)throw e[J].error;let{body:t}=e;if(t===null||!(t instanceof i.default))return a.Buffer.alloc(0);let n=[],r=0;try{for await(let i of t){if(e.size>0&&r+i.length>e.size){let n=new q(`content size at ${e.url} over limit: ${e.size}`,`max-size`);throw t.destroy(n),n}r+=i.length,n.push(i)}}catch(t){throw t instanceof Zn?t:new q(`Invalid response body while trying to fetch ${e.url}: ${t.message}`,`system`,t)}if(t.readableEnded===!0||t._readableState.ended===!0)try{return n.every(e=>typeof e==`string`)?a.Buffer.from(n.join(``)):a.Buffer.concat(n,r)}catch(t){throw new q(`Could not create Buffer from response body for ${e.url}: ${t.message}`,`system`,t)}else throw new q(`Premature close of server response while trying to fetch ${e.url}`)}function Ut(e=[]){return new gr(e.reduce((e,t,n,r)=>(n%2==0&&e.push(r.slice(n,n+2)),e),[]).filter(([e,t])=>{try{return pr(e),mr(e,String(t)),!0}catch{return!1}}))}function Wt(e,t=!1){return e==null||(e=new URL(e),/^(about|blob|data):$/.test(e.protocol))?`no-referrer`:(e.username=``,e.password=``,e.hash=``,t&&(e.pathname=``,e.search=``),e)}function Gt(e){if(!Sr.has(e))throw TypeError(`Invalid referrerPolicy: ${e}`);return e}function Kt(e){if(/^(http|ws)s:$/.test(e.protocol))return!0;let t=e.host.replace(/(^\[)|(]$)/g,``),n=(0,c.isIP)(t);return n===4&&/^127\./.test(t)||n===6&&/^(((0+:){7})|(::(0+:){0,6}))0*1$/.test(t)?!0:e.host===`localhost`||e.host.endsWith(`.localhost`)?!1:e.protocol===`file:`}function qt(e){return/^about:(blank|srcdoc)$/.test(e)||e.protocol===`data:`||/^(blob|filesystem):$/.test(e.protocol)?!0:Kt(e)}function Jt(e,{referrerURLCallback:t,referrerOriginCallback:n}={}){if(e.referrer===`no-referrer`||e.referrerPolicy===``)return null;let r=e.referrerPolicy;if(e.referrer===`about:client`)return`no-referrer`;let i=e.referrer,a=Wt(i),o=Wt(i,!0);a.toString().length>4096&&(a=o),t&&(a=t(a)),n&&(o=n(o));let s=new URL(e.url);switch(r){case`no-referrer`:return`no-referrer`;case`origin`:return o;case`unsafe-url`:return a;case`strict-origin`:return qt(a)&&!qt(s)?`no-referrer`:o.toString();case`strict-origin-when-cross-origin`:return a.origin===s.origin?a:qt(a)&&!qt(s)?`no-referrer`:o;case`same-origin`:return a.origin===s.origin?a:`no-referrer`;case`origin-when-cross-origin`:return a.origin===s.origin?a:o;case`no-referrer-when-downgrade`:return qt(a)&&!qt(s)?`no-referrer`:a;default:throw TypeError(`Invalid referrerPolicy: ${r}`)}}function Yt(e){let t=(e.get(`referrer-policy`)||``).split(/[,\s]+/),n=``;for(let e of t)e&&Sr.has(e)&&(n=e);return n}function Xt(){if(Mr)return jr;if(Mr=1,!globalThis.DOMException)try{let{MessageChannel:e}=require(`worker_threads`),t=new e().port1,n=new ArrayBuffer;t.postMessage(n,[n,n])}catch(e){e.constructor.name===`DOMException`&&(globalThis.DOMException=e.constructor)}return jr=globalThis.DOMException,jr}async function Zt(e,a){return new Promise((o,s)=>{let c=new Dr(e,a),{parsedURL:l,options:u}=Or(c);if(!Rr.has(l.protocol))throw TypeError(`node-fetch cannot load ${e}. URL scheme "${l.protocol.replace(/:$/,``)}" is not supported.`);if(l.protocol===`data:`){let e=Lt(c.url);o(new br(e,{headers:{"Content-Type":e.typeFull}}));return}let d=(l.protocol===`https:`?n.default:t.default).request,{signal:f}=c,p=null,ee=z(()=>{let e=new Ar(`The operation was aborted.`);s(e),c.body&&c.body instanceof i.default.Readable&&c.body.destroy(e),!(!p||!p.body)&&p.body.emit(`error`,e)},`abort`);if(f&&f.aborted){ee();return}let m=z(()=>{ee(),g()},`abortAndFinalize`),h=d(l.toString(),u);f&&f.addEventListener(`abort`,m);let g=z(()=>{h.abort(),f&&f.removeEventListener(`abort`,m)},`finalize`);h.on(`error`,e=>{s(new q(`request to ${c.url} failed, reason: ${e.message}`,`system`,e)),g()}),Qt(h,e=>{p&&p.body&&p.body.destroy(e)}),process.version<`v14`&&h.on(`socket`,e=>{let t;e.prependListener(`end`,()=>{t=e._eventsCount}),e.prependListener(`close`,n=>{if(p&&t<e._eventsCount&&!n){let e=Error(`Premature close`);e.code=`ERR_STREAM_PREMATURE_CLOSE`,p.body.emit(`error`,e)}})}),h.on(`response`,e=>{h.setTimeout(0);let t=Ut(e.rawHeaders);if(vr(e.statusCode)){let n=t.get(`Location`),r=null;try{r=n===null?null:new URL(n,c.url)}catch{if(c.redirect!==`manual`){s(new q(`uri requested responds with an invalid redirect URL: ${n}`,`invalid-redirect`)),g();return}}switch(c.redirect){case`error`:s(new q(`uri requested responds with a redirect, redirect mode is set to error: ${c.url}`,`no-redirect`)),g();return;case`manual`:break;case`follow`:{if(r===null)break;if(c.counter>=c.follow){s(new q(`maximum redirect reached at: ${c.url}`,`max-redirect`)),g();return}let n={headers:new gr(c.headers),follow:c.follow,counter:c.counter+1,agent:c.agent,compress:c.compress,method:c.method,body:cr(c),signal:c.signal,size:c.size,referrer:c.referrer,referrerPolicy:c.referrerPolicy};if(!rr(c.url,r)||!ir(c.url,r))for(let e of[`authorization`,`www-authenticate`,`cookie`,`cookie2`])n.headers.delete(e);if(e.statusCode!==303&&c.body&&a.body instanceof i.default.Readable){s(new q(`Cannot follow redirect with body being a readable stream`,`unsupported-redirect`)),g();return}(e.statusCode===303||(e.statusCode===301||e.statusCode===302)&&c.method===`POST`)&&(n.method=`GET`,n.body=void 0,n.headers.delete(`content-length`));let l=Yt(t);l&&(n.referrerPolicy=l),o(Zt(new Dr(r,n))),g();return}default:return s(TypeError(`Redirect option '${c.redirect}' is not a valid value of RequestRedirect`))}}f&&e.once(`end`,()=>{f.removeEventListener(`abort`,m)});let n=(0,i.pipeline)(e,new i.PassThrough,e=>{e&&s(e)});process.version<`v12.10`&&e.on(`aborted`,m);let l={url:c.url,status:e.statusCode,statusText:e.statusMessage,headers:t,size:c.size,counter:c.counter,highWaterMark:c.highWaterMark},u=t.get(`Content-Encoding`);if(!c.compress||c.method===`HEAD`||u===null||e.statusCode===204||e.statusCode===304){p=new br(n,l),o(p);return}let d={flush:r.default.Z_SYNC_FLUSH,finishFlush:r.default.Z_SYNC_FLUSH};if(u===`gzip`||u===`x-gzip`){n=(0,i.pipeline)(n,r.default.createGunzip(d),e=>{e&&s(e)}),p=new br(n,l),o(p);return}if(u===`deflate`||u===`x-deflate`){let t=(0,i.pipeline)(e,new i.PassThrough,e=>{e&&s(e)});t.once(`data`,e=>{n=(e[0]&15)==8?(0,i.pipeline)(n,r.default.createInflate(),e=>{e&&s(e)}):(0,i.pipeline)(n,r.default.createInflateRaw(),e=>{e&&s(e)}),p=new br(n,l),o(p)}),t.once(`end`,()=>{p||(p=new br(n,l),o(p))});return}if(u===`br`){n=(0,i.pipeline)(n,r.default.createBrotliDecompress(),e=>{e&&s(e)}),p=new br(n,l),o(p);return}p=new br(n,l),o(p)}),fr(h,c).catch(s)})}function Qt(e,t){let n=a.Buffer.from(`0\r
70
70
  \r
71
71
  `),r=!1,i=!1,o;e.on(`response`,e=>{let{headers:t}=e;r=t[`transfer-encoding`]===`chunked`&&!t[`content-length`]}),e.on(`socket`,s=>{let c=z(()=>{if(r&&!i){let e=Error(`Premature close`);e.code=`ERR_STREAM_PREMATURE_CLOSE`,t(e)}},`onSocketClose`),l=z(e=>{i=a.Buffer.compare(e.slice(-5),n)===0,!i&&o&&(i=a.Buffer.compare(o.slice(-3),n.slice(0,3))===0&&a.Buffer.compare(e.slice(-2),n.slice(3))===0),o=e},`onData`);s.prependListener(`close`,c),s.on(`data`,l),e.on(`close`,()=>{s.removeListener(`close`,c),s.removeListener(`data`,l)})})}function L(e){let t=zr.get(e);return console.assert(t!=null,`'this' is expected an Event object, but got`,e),t}function $t(e){if(e.passiveListener!=null){typeof console<`u`&&typeof console.error==`function`&&console.error(`Unable to preventDefault inside passive event listener invocation.`,e.passiveListener);return}e.event.cancelable&&(e.canceled=!0,typeof e.event.preventDefault==`function`&&e.event.preventDefault())}function en(e,t){zr.set(this,{eventTarget:e,event:t,eventPhase:2,currentTarget:e,canceled:!1,stopped:!1,immediateStopped:!1,passiveListener:null,timeStamp:t.timeStamp||Date.now()}),Object.defineProperty(this,`isTrusted`,{value:!1,enumerable:!0});let n=Object.keys(t);for(let e=0;e<n.length;++e){let t=n[e];t in this||Object.defineProperty(this,t,tn(t))}}function tn(e){return{get(){return L(this).event[e]},set(t){L(this).event[e]=t},configurable:!0,enumerable:!0}}function nn(e){return{value(){let t=L(this).event;return t[e].apply(t,arguments)},configurable:!0,enumerable:!0}}function rn(e,t){let n=Object.keys(t);if(n.length===0)return e;function r(t,n){e.call(this,t,n)}z(r,`CustomEvent`),r.prototype=Object.create(e.prototype,{constructor:{value:r,configurable:!0,writable:!0}});for(let i=0;i<n.length;++i){let a=n[i];if(!(a in e.prototype)){let e=typeof Object.getOwnPropertyDescriptor(t,a).value==`function`;Object.defineProperty(r.prototype,a,e?nn(a):tn(a))}}return r}function an(e){if(e==null||e===Object.prototype)return en;let t=Br.get(e);return t??(t=rn(an(Object.getPrototypeOf(e)),e),Br.set(e,t)),t}function on(e,t){return new(an(Object.getPrototypeOf(t)))(e,t)}function sn(e){return L(e).immediateStopped}function cn(e,t){L(e).eventPhase=t}function ln(e,t){L(e).currentTarget=t}function un(e,t){L(e).passiveListener=t}function dn(e){return typeof e==`object`&&!!e}function fn(e){let t=Vr.get(e);if(t==null)throw TypeError(`'this' is expected an EventTarget object, but got another value.`);return t}function pn(e){return{get(){let t=fn(this).get(e);for(;t!=null;){if(t.listenerType===Wr)return t.listener;t=t.next}return null},set(t){typeof t!=`function`&&!dn(t)&&(t=null);let n=fn(this),r=null,i=n.get(e);for(;i!=null;)i.listenerType===Wr?r===null?i.next===null?n.delete(e):n.set(e,i.next):r.next=i.next:r=i,i=i.next;if(t!==null){let i={listener:t,listenerType:Wr,passive:!1,once:!1,next:null};r===null?n.set(e,i):r.next=i}},configurable:!0,enumerable:!0}}function mn(e,t){Object.defineProperty(e,`on${t}`,pn(t))}function hn(e){function t(){R.call(this)}z(t,`CustomEventTarget`),t.prototype=Object.create(R.prototype,{constructor:{value:t,configurable:!0,writable:!0}});for(let n=0;n<e.length;++n)mn(t.prototype,e[n]);return t}function R(){if(this instanceof R){Vr.set(this,new Map);return}if(arguments.length===1&&Array.isArray(arguments[0]))return hn(arguments[0]);if(arguments.length>0){let e=Array(arguments.length);for(let t=0;t<arguments.length;++t)e[t]=arguments[t];return hn(e)}throw TypeError(`Cannot call a class as a function`)}function gn(){let e=Object.create(Kr.prototype);return R.call(e),qr.set(e,!1),e}function _n(e){qr.get(e)===!1&&(qr.set(e,!0),e.dispatchEvent({type:`abort`}))}function vn(e){let t=Yr.get(e);if(t==null)throw TypeError(`Expected 'this' to be an 'AbortController' object, but got ${e===null?`null`:typeof e}`);return t}function yn(){!globalThis.process?.versions?.node&&!globalThis.process?.env?.DISABLE_NODE_FETCH_NATIVE_WARN&&console.warn("[node-fetch-native] Node.js compatible build of `node-fetch-native` is being used in a non-Node.js environment. Please make sure you are using proper export conditions or report this issue to https://github.com/unjs/node-fetch-native. You can set `process.env.DISABLE_NODE_FETCH_NATIVE_WARN` to disable this warning.")}var bn,xn,z,Sn,B,V,H,Cn,wn,Tn,En,Dn,On,U,kn,W,An,jn,Mn,Nn,Pn,G,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,K,Yn,Xn,Zn,Qn,q,$n,er,tr,nr,rr,ir,ar,J,or,sr,cr,lr,ur,dr,fr,pr,mr,hr,gr,_r,vr,Y,yr,br,xr,Sr,Cr,X,wr,Tr,Er,Dr,Or,kr,Ar,jr,Mr,Z,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr,qr,Jr,Yr,Xr,Zr,Qr,$r=g((()=>{xt(),bn=Object.defineProperty,xn=e=>{throw TypeError(e)},z=(e,t)=>bn(e,`name`,{value:t,configurable:!0}),Sn=(e,t,n)=>t.has(e)||xn(`Cannot `+n),B=(e,t,n)=>(Sn(e,t,`read from private field`),n?n.call(e):t.get(e)),V=(e,t,n)=>t.has(e)?xn(`Cannot add the same private member more than once`):t instanceof WeakSet?t.add(e):t.set(e,n),H=(e,t,n,r)=>(Sn(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),z(Lt,`dataUriToBuffer`),Pn={},G={exports:{}},Fn=G.exports,z(Rt,`requirePonyfill_es2018`),z(zt,`requireStreams`),zt(),Rn=65536,z(Bt,`toIterator`),zn=(Dn=class{constructor(e=[],t={}){if(V(this,Cn,[]),V(this,wn,``),V(this,Tn,0),V(this,En,`transparent`),typeof e!=`object`||!e)throw TypeError(`Failed to construct 'Blob': The provided value cannot be converted to a sequence.`);if(typeof e[Symbol.iterator]!=`function`)throw TypeError(`Failed to construct 'Blob': The object must have a callable @@iterator property.`);if(typeof t!=`object`&&typeof t!=`function`)throw TypeError(`Failed to construct 'Blob': parameter 2 cannot convert to dictionary.`);t===null&&(t={});let n=new TextEncoder;for(let t of e){let e;e=ArrayBuffer.isView(t)?new Uint8Array(t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)):t instanceof ArrayBuffer?new Uint8Array(t.slice(0)):t instanceof Dn?t:n.encode(`${t}`),H(this,Tn,B(this,Tn)+(ArrayBuffer.isView(e)?e.byteLength:e.size)),B(this,Cn).push(e)}H(this,En,`${t.endings===void 0?`transparent`:t.endings}`);let r=t.type===void 0?``:String(t.type);H(this,wn,/^[\x20-\x7E]*$/.test(r)?r:``)}get size(){return B(this,Tn)}get type(){return B(this,wn)}async text(){let e=new TextDecoder,t=``;for await(let n of Bt(B(this,Cn),!1))t+=e.decode(n,{stream:!0});return t+=e.decode(),t}async arrayBuffer(){let e=new Uint8Array(this.size),t=0;for await(let n of Bt(B(this,Cn),!1))e.set(n,t),t+=n.length;return e.buffer}stream(){let e=Bt(B(this,Cn),!0);return new globalThis.ReadableStream({type:`bytes`,async pull(t){let n=await e.next();n.done?t.close():t.enqueue(n.value)},async cancel(){await e.return()}})}slice(e=0,t=this.size,n=``){let{size:r}=this,i=e<0?Math.max(r+e,0):Math.min(e,r),a=t<0?Math.max(r+t,0):Math.min(t,r),o=Math.max(a-i,0),s=B(this,Cn),c=[],l=0;for(let e of s){if(l>=o)break;let t=ArrayBuffer.isView(e)?e.byteLength:e.size;if(i&&t<=i)i-=t,a-=t;else{let n;ArrayBuffer.isView(e)?(n=e.subarray(i,Math.min(t,a)),l+=n.byteLength):(n=e.slice(i,Math.min(t,a)),l+=n.size),a-=t,c.push(n),i=0}}let u=new Dn([],{type:String(n).toLowerCase()});return H(u,Tn,o),H(u,Cn,c),u}get[Symbol.toStringTag](){return`Blob`}static[Symbol.hasInstance](e){return e&&typeof e==`object`&&typeof e.constructor==`function`&&(typeof e.stream==`function`||typeof e.arrayBuffer==`function`)&&/^(Blob|File)$/.test(e[Symbol.toStringTag])}},Cn=new WeakMap,wn=new WeakMap,Tn=new WeakMap,En=new WeakMap,z(Dn,`Blob`),Dn),Object.defineProperties(zn.prototype,{size:{enumerable:!0},type:{enumerable:!0},slice:{enumerable:!0}}),Bn=zn,Vn=(kn=class extends Bn{constructor(e,t,n={}){if(arguments.length<2)throw TypeError(`Failed to construct 'File': 2 arguments required, but only ${arguments.length} present.`);super(e,n),V(this,On,0),V(this,U,``),n===null&&(n={});let r=n.lastModified===void 0?Date.now():Number(n.lastModified);Number.isNaN(r)||H(this,On,r),H(this,U,String(t))}get name(){return B(this,U)}get lastModified(){return B(this,On)}get[Symbol.toStringTag](){return`File`}static[Symbol.hasInstance](e){return!!e&&e instanceof Bn&&/^(File)$/.test(e[Symbol.toStringTag])}},On=new WeakMap,U=new WeakMap,z(kn,`File`),kn),{toStringTag:Hn,iterator:Un,hasInstance:Wn}=Symbol,Gn=Math.random,Kn=`append,set,get,getAll,delete,keys,values,entries,forEach,constructor`.split(`,`),qn=z((e,t,n)=>(e+=``,/^(Blob|File)$/.test(t&&t[Hn])?[(n=n===void 0?t[Hn]==`File`?t.name:`blob`:n+``,e),t.name!==n||t[Hn]==`blob`?new Vn([t],n,t):t]:[e,t+``]),`f`),Jn=z((e,t)=>(t?e:e.replace(/\r?\n|\r/g,`\r
72
- `)).replace(/\n/g,`%0A`).replace(/\r/g,`%0D`).replace(/"/g,`%22`),`e$1`),K=z((e,t,n)=>{if(t.length<n)throw TypeError(`Failed to execute '${e}' on 'FormData': ${n} arguments required, but only ${t.length} present.`)},`x`),Yn=(An=class{constructor(...e){if(V(this,W,[]),e.length)throw TypeError(`Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.`)}get[Hn](){return`FormData`}[Un](){return this.entries()}static[Wn](e){return e&&typeof e==`object`&&e[Hn]===`FormData`&&!Kn.some(t=>typeof e[t]!=`function`)}append(...e){K(`append`,arguments,2),B(this,W).push(qn(...e))}delete(e){K(`delete`,arguments,1),e+=``,H(this,W,B(this,W).filter(([t])=>t!==e))}get(e){K(`get`,arguments,1),e+=``;for(var t=B(this,W),n=t.length,r=0;r<n;r++)if(t[r][0]===e)return t[r][1];return null}getAll(e,t){return K(`getAll`,arguments,1),t=[],e+=``,B(this,W).forEach(n=>n[0]===e&&t.push(n[1])),t}has(e){return K(`has`,arguments,1),e+=``,B(this,W).some(t=>t[0]===e)}forEach(e,t){K(`forEach`,arguments,1);for(var[n,r]of this)e.call(t,r,n,this)}set(...e){K(`set`,arguments,2);var t=[],n=!0;e=qn(...e),B(this,W).forEach(r=>{r[0]===e[0]?n&&=!t.push(e):t.push(r)}),n&&t.push(e),H(this,W,t)}*entries(){yield*B(this,W)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},W=new WeakMap,z(An,`FormData`),An),z(Vt,`formDataToBlob`),Xn=class 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}},z(Xn,`FetchBaseError`),Zn=Xn,Qn=class extends Zn{constructor(e,t,n){super(e,t),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}},z(Qn,`FetchError`),q=Qn,$n=Symbol.toStringTag,er=z(e=>typeof e==`object`&&typeof e.append==`function`&&typeof e.delete==`function`&&typeof e.get==`function`&&typeof e.getAll==`function`&&typeof e.has==`function`&&typeof e.set==`function`&&typeof e.sort==`function`&&e[$n]===`URLSearchParams`,`isURLSearchParameters`),tr=z(e=>e&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&typeof e.constructor==`function`&&/^(Blob|File)$/.test(e[$n]),`isBlob`),nr=z(e=>typeof e==`object`&&(e[$n]===`AbortSignal`||e[$n]===`EventTarget`),`isAbortSignal`),rr=z((e,t)=>{let n=new URL(t).hostname,r=new URL(e).hostname;return n===r||n.endsWith(`.${r}`)},`isDomainOrSubdomain`),ir=z((e,t)=>new URL(t).protocol===new URL(e).protocol,`isSameProtocol`),ar=(0,o.promisify)(i.default.pipeline),J=Symbol(`Body internals`),or=class{constructor(e,{size:t=0}={}){let n=null;e===null?e=null:er(e)?e=a.Buffer.from(e.toString()):tr(e)||a.Buffer.isBuffer(e)||(o.types.isAnyArrayBuffer(e)?e=a.Buffer.from(e):ArrayBuffer.isView(e)?e=a.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof i.default||(e instanceof Yn?(e=Vt(e),n=e.type.split(`=`)[1]):e=a.Buffer.from(String(e))));let r=e;a.Buffer.isBuffer(e)?r=i.default.Readable.from(e):tr(e)&&(r=i.default.Readable.from(e.stream())),this[J]={body:e,stream:r,boundary:n,disturbed:!1,error:null},this.size=t,e instanceof i.default&&e.on(`error`,e=>{let t=e instanceof Zn?e:new q(`Invalid response body while trying to fetch ${this.url}: ${e.message}`,`system`,e);this[J].error=t})}get body(){return this[J].stream}get bodyUsed(){return this[J].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:n}=await Ht(this);return e.slice(t,t+n)}async formData(){let e=this.headers.get(`content-type`);if(e.startsWith(`application/x-www-form-urlencoded`)){let e=new Yn,t=new URLSearchParams(await this.text());for(let[n,r]of t)e.append(n,r);return e}let{toFormData:t}=await Promise.resolve().then(()=>(It(),St));return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get(`content-type`)||this[J].body&&this[J].body.type||``;return new Bn([await this.arrayBuffer()],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await Ht(this);return new TextDecoder().decode(e)}buffer(){return Ht(this)}},z(or,`Body`),sr=or,sr.prototype.buffer=(0,o.deprecate)(sr.prototype.buffer,`Please use 'response.arrayBuffer()' instead of 'response.buffer()'`,`node-fetch#buffer`),Object.defineProperties(sr.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,o.deprecate)(()=>{},`data doesn't exist, use json(), text(), arrayBuffer(), or body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (response)`)}}),z(Ht,`consumeBody`),cr=z((e,t)=>{let n,r,{body:a}=e[J];if(e.bodyUsed)throw Error(`cannot clone body after it is used`);return a instanceof i.default&&typeof a.getBoundary!=`function`&&(n=new i.PassThrough({highWaterMark:t}),r=new i.PassThrough({highWaterMark:t}),a.pipe(n),a.pipe(r),e[J].stream=n,a=r),a},`clone`),lr=(0,o.deprecate)(e=>e.getBoundary(),`form-data doesn't follow the spec and requires special treatment. Use alternative package`,`https://github.com/node-fetch/node-fetch/issues/1167`),ur=z((e,t)=>e===null?null:typeof e==`string`?`text/plain;charset=UTF-8`:er(e)?`application/x-www-form-urlencoded;charset=UTF-8`:tr(e)?e.type||null:a.Buffer.isBuffer(e)||o.types.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof Yn?`multipart/form-data; boundary=${t[J].boundary}`:e&&typeof e.getBoundary==`function`?`multipart/form-data;boundary=${lr(e)}`:e instanceof i.default?null:`text/plain;charset=UTF-8`,`extractContentType`),dr=z(e=>{let{body:t}=e[J];return t===null?0:tr(t)?t.size:a.Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync==`function`&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},`getTotalBytes`),fr=z(async(e,{body:t})=>{t===null?e.end():await ar(t,e)},`writeToStream`),pr=typeof t.default.validateHeaderName==`function`?t.default.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_HTTP_TOKEN`}),t}},mr=typeof t.default.validateHeaderValue==`function`?t.default.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let t=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_CHAR`}),t}},hr=class e extends URLSearchParams{constructor(t){let n=[];if(t instanceof e){let e=t.raw();for(let[t,r]of Object.entries(e))n.push(...r.map(e=>[t,e]))}else if(t!=null)if(typeof t==`object`&&!o.types.isBoxedPrimitive(t)){let e=t[Symbol.iterator];if(e==null)n.push(...Object.entries(t));else{if(typeof e!=`function`)throw TypeError(`Header pairs must be iterable`);n=[...t].map(e=>{if(typeof e!=`object`||o.types.isBoxedPrimitive(e))throw TypeError(`Each header pair must be an iterable object`);return[...e]}).map(e=>{if(e.length!==2)throw TypeError(`Each header pair must be a name/value tuple`);return[...e]})}}else throw TypeError(`Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)`);return n=n.length>0?n.map(([e,t])=>(pr(e),mr(e,String(t)),[String(e).toLowerCase(),String(t)])):void 0,super(n),new Proxy(this,{get(e,t,n){switch(t){case`append`:case`set`:return(n,r)=>(pr(n),mr(n,String(r)),URLSearchParams.prototype[t].call(e,String(n).toLowerCase(),String(r)));case`delete`:case`has`:case`getAll`:return n=>(pr(n),URLSearchParams.prototype[t].call(e,String(n).toLowerCase()));case`keys`:return()=>(e.sort(),new Set(URLSearchParams.prototype.keys.call(e)).keys());default:return Reflect.get(e,t,n)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let t=this.getAll(e);if(t.length===0)return null;let n=t.join(`, `);return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,t=void 0){for(let n of this.keys())Reflect.apply(e,t,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let 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)=>{let n=this.getAll(t);return t===`host`?e[t]=n[0]:e[t]=n.length>1?n:n[0],e},{})}},z(hr,`Headers`),gr=hr,Object.defineProperties(gr.prototype,[`get`,`entries`,`forEach`,`values`].reduce((e,t)=>(e[t]={enumerable:!0},e),{})),z(Ut,`fromRawHeaders`),_r=new Set([301,302,303,307,308]),vr=z(e=>_r.has(e),`isRedirect`),Y=Symbol(`Response internals`),yr=class e extends sr{constructor(e=null,t={}){super(e,t);let n=t.status==null?200:t.status,r=new gr(t.headers);if(e!==null&&!r.has(`Content-Type`)){let t=ur(e,this);t&&r.append(`Content-Type`,t)}this[Y]={type:`default`,url:t.url,status:n,statusText:t.statusText||``,headers:r,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[Y].type}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 e(cr(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,n=302){if(!vr(n))throw RangeError(`Failed to execute "redirect" on "response": Invalid status code`);return new e(null,{headers:{location:new URL(t).toString()},status:n})}static error(){let t=new e(null,{status:0,statusText:``});return t[Y].type=`error`,t}static json(t=void 0,n={}){let r=JSON.stringify(t);if(r===void 0)throw TypeError(`data is not JSON serializable`);let i=new gr(n&&n.headers);return i.has(`content-type`)||i.set(`content-type`,`application/json`),new e(r,{...n,headers:i})}get[Symbol.toStringTag](){return`Response`}},z(yr,`Response`),br=yr,Object.defineProperties(br.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),xr=z(e=>{if(e.search)return e.search;let t=e.href.length-1,n=e.hash||(e.href[t]===`#`?`#`:``);return e.href[t-n.length]===`?`?`?`:``},`getSearch`),z(Wt,`stripURLForUseAsAReferrer`),Sr=new Set([``,`no-referrer`,`no-referrer-when-downgrade`,`same-origin`,`origin`,`strict-origin`,`origin-when-cross-origin`,`strict-origin-when-cross-origin`,`unsafe-url`]),Cr=`strict-origin-when-cross-origin`,z(Gt,`validateReferrerPolicy`),z(Kt,`isOriginPotentiallyTrustworthy`),z(qt,`isUrlPotentiallyTrustworthy`),z(Jt,`determineRequestsReferrer`),z(Yt,`parseReferrerPolicyFromHeader`),X=Symbol(`Request internals`),wr=z(e=>typeof e==`object`&&typeof e[X]==`object`,`isRequest`),Tr=(0,o.deprecate)(()=>{},`.data is not a valid RequestInit property, use .body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (request)`),Er=class e extends sr{constructor(e,t={}){let n;if(wr(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==``||n.password!==``)throw TypeError(`${n} is an url with embedded credentials.`);let r=t.method||e.method||`GET`;if(/^(delete|get|head|options|post|put)$/i.test(r)&&(r=r.toUpperCase()),!wr(t)&&`data`in t&&Tr(),(t.body!=null||wr(e)&&e.body!==null)&&(r===`GET`||r===`HEAD`))throw TypeError(`Request with GET/HEAD method cannot have body`);let i=t.body?t.body:wr(e)&&e.body!==null?cr(e):null;super(i,{size:t.size||e.size||0});let a=new gr(t.headers||e.headers||{});if(i!==null&&!a.has(`Content-Type`)){let e=ur(i,this);e&&a.set(`Content-Type`,e)}let o=wr(e)?e.signal:null;if(`signal`in t&&(o=t.signal),o!=null&&!nr(o))throw TypeError(`Expected signal to be an instanceof AbortSignal or EventTarget`);let s=t.referrer==null?e.referrer:t.referrer;if(s===``)s=`no-referrer`;else if(s){let e=new URL(s);s=/^about:(\/\/)?client$/.test(e)?`client`:e}else s=void 0;this[X]={method:r,redirect:t.redirect||e.redirect||`follow`,headers:a,parsedURL:n,signal:o,referrer:s},this.follow=t.follow===void 0?e.follow===void 0?20:e.follow:t.follow,this.compress=t.compress===void 0?e.compress===void 0?!0:e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||e.referrerPolicy||``}get method(){return this[X].method}get url(){return(0,s.format)(this[X].parsedURL)}get headers(){return this[X].headers}get redirect(){return this[X].redirect}get signal(){return this[X].signal}get referrer(){if(this[X].referrer===`no-referrer`)return``;if(this[X].referrer===`client`)return`about:client`;if(this[X].referrer)return this[X].referrer.toString()}get referrerPolicy(){return this[X].referrerPolicy}set referrerPolicy(e){this[X].referrerPolicy=Gt(e)}clone(){return new e(this)}get[Symbol.toStringTag](){return`Request`}},z(Er,`Request`),Dr=Er,Object.defineProperties(Dr.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}}),Or=z(e=>{let{parsedURL:t}=e[X],n=new gr(e[X].headers);n.has(`Accept`)||n.set(`Accept`,`*/*`);let r=null;if(e.body===null&&/^(post|put)$/i.test(e.method)&&(r=`0`),e.body!==null){let t=dr(e);typeof t==`number`&&!Number.isNaN(t)&&(r=String(t))}r&&n.set(`Content-Length`,r),e.referrerPolicy===``&&(e.referrerPolicy=Cr),e.referrer&&e.referrer!==`no-referrer`?e[X].referrer=Jt(e):e[X].referrer=`no-referrer`,e[X].referrer instanceof URL&&n.set(`Referer`,e.referrer),n.has(`User-Agent`)||n.set(`User-Agent`,`node-fetch`),e.compress&&!n.has(`Accept-Encoding`)&&n.set(`Accept-Encoding`,`gzip, deflate, br`);let{agent:i}=e;typeof i==`function`&&(i=i(t));let a=xr(t);return{parsedURL:t,options:{path:t.pathname+a,method:e.method,headers:n[Symbol.for(`nodejs.util.inspect.custom`)](),insecureHTTPParser:e.insecureHTTPParser,agent:i}}},`getNodeRequestOptions`),kr=class extends Zn{constructor(e,t=`aborted`){super(e,t)}},z(kr,`AbortError`),Ar=kr,z(Xt,`requireNodeDomexception`),Z=_t(Xt()),{stat:Nr}=l.promises,z((e,t)=>Pr((0,l.statSync)(e),e,t),`blobFromSync`),z((e,t)=>Nr(e).then(n=>Pr(n,e,t)),`blobFrom`),z((e,t)=>Nr(e).then(n=>Fr(n,e,t)),`fileFrom`),z((e,t)=>Fr((0,l.statSync)(e),e,t),`fileFromSync`),Pr=z((e,t,n=``)=>new Bn([new Lr({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],{type:n}),`fromBlob`),Fr=z((e,t,n=``)=>new Vn([new Lr({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],(0,u.basename)(t),{type:n,lastModified:e.mtimeMs}),`fromFile`),Ir=class e{constructor(e){V(this,jn),V(this,Mn),H(this,jn,e.path),H(this,Mn,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(t,n){return new e({path:B(this,jn),lastModified:this.lastModified,size:n-t,start:B(this,Mn)+t})}async*stream(){let{mtimeMs:e}=await Nr(B(this,jn));if(e>this.lastModified)throw new Z(`The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.`,`NotReadableError`);yield*(0,l.createReadStream)(B(this,jn),{start:B(this,Mn),end:B(this,Mn)+this.size-1})}get[Symbol.toStringTag](){return`Blob`}},jn=new WeakMap,Mn=new WeakMap,z(Ir,`BlobDataItem`),Lr=Ir,Rr=new Set([`data:`,`http:`,`https:`]),z(Zt,`fetch$1`),z(Qt,`fixResponseChunkedTransferBadEnding`),zr=new WeakMap,Br=new WeakMap,z(L,`pd`),z($t,`setCancelFlag`),z(en,`Event`),en.prototype={get type(){return L(this).event.type},get target(){return L(this).eventTarget},get currentTarget(){return L(this).currentTarget},composedPath(){let e=L(this).currentTarget;return e==null?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return L(this).eventPhase},stopPropagation(){let e=L(this);e.stopped=!0,typeof e.event.stopPropagation==`function`&&e.event.stopPropagation()},stopImmediatePropagation(){let e=L(this);e.stopped=!0,e.immediateStopped=!0,typeof e.event.stopImmediatePropagation==`function`&&e.event.stopImmediatePropagation()},get bubbles(){return!!L(this).event.bubbles},get cancelable(){return!!L(this).event.cancelable},preventDefault(){$t(L(this))},get defaultPrevented(){return L(this).canceled},get composed(){return!!L(this).event.composed},get timeStamp(){return L(this).timeStamp},get srcElement(){return L(this).eventTarget},get cancelBubble(){return L(this).stopped},set cancelBubble(e){if(!e)return;let t=L(this);t.stopped=!0,typeof t.event.cancelBubble==`boolean`&&(t.event.cancelBubble=!0)},get returnValue(){return!L(this).canceled},set returnValue(e){e||$t(L(this))},initEvent(){}},Object.defineProperty(en.prototype,`constructor`,{value:en,configurable:!0,writable:!0}),typeof window<`u`&&typeof window.Event<`u`&&(Object.setPrototypeOf(en.prototype,window.Event.prototype),Br.set(window.Event.prototype,en)),z(tn,`defineRedirectDescriptor`),z(nn,`defineCallDescriptor`),z(rn,`defineWrapper`),z(an,`getWrapper`),z(on,`wrapEvent`),z(sn,`isStopped`),z(cn,`setEventPhase`),z(ln,`setCurrentTarget`),z(un,`setPassiveListener`),Vr=new WeakMap,Hr=1,Ur=2,Wr=3,z(dn,`isObject`),z(fn,`getListeners`),z(pn,`defineEventAttributeDescriptor`),z(mn,`defineEventAttribute`),z(hn,`defineCustomEventTarget`),z(R,`EventTarget`),R.prototype={addEventListener(e,t,n){if(t==null)return;if(typeof t!=`function`&&!dn(t))throw TypeError(`'listener' should be a function or an object.`);let r=fn(this),i=dn(n),a=(i?n.capture:n)?Hr:Ur,o={listener:t,listenerType:a,passive:i&&!!n.passive,once:i&&!!n.once,next:null},s=r.get(e);if(s===void 0){r.set(e,o);return}let c=null;for(;s!=null;){if(s.listener===t&&s.listenerType===a)return;c=s,s=s.next}c.next=o},removeEventListener(e,t,n){if(t==null)return;let r=fn(this),i=(dn(n)?n.capture:n)?Hr:Ur,a=null,o=r.get(e);for(;o!=null;){if(o.listener===t&&o.listenerType===i){a===null?o.next===null?r.delete(e):r.set(e,o.next):a.next=o.next;return}a=o,o=o.next}},dispatchEvent(e){if(e==null||typeof e.type!=`string`)throw TypeError(`"event.type" should be a string.`);let t=fn(this),n=e.type,r=t.get(n);if(r==null)return!0;let i=on(this,e),a=null;for(;r!=null;){if(r.once?a===null?r.next===null?t.delete(n):t.set(n,r.next):a.next=r.next:a=r,un(i,r.passive?r.listener:null),typeof r.listener==`function`)try{r.listener.call(this,i)}catch(e){typeof console<`u`&&typeof console.error==`function`&&console.error(e)}else r.listenerType!==Wr&&typeof r.listener.handleEvent==`function`&&r.listener.handleEvent(i);if(sn(i))break;r=r.next}return un(i,null),cn(i,0),ln(i,null),!i.defaultPrevented}},Object.defineProperty(R.prototype,`constructor`,{value:R,configurable:!0,writable:!0}),typeof window<`u`&&typeof window.EventTarget<`u`&&Object.setPrototypeOf(R.prototype,window.EventTarget.prototype),Gr=class extends R{constructor(){throw super(),TypeError(`AbortSignal cannot be constructed directly`)}get aborted(){let e=qr.get(this);if(typeof e!=`boolean`)throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?`null`:typeof this}`);return e}},z(Gr,`AbortSignal`),Kr=Gr,mn(Kr.prototype,`abort`),z(gn,`createAbortSignal`),z(_n,`abortSignal`),qr=new WeakMap,Object.defineProperties(Kr.prototype,{aborted:{enumerable:!0}}),typeof Symbol==`function`&&typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Kr.prototype,Symbol.toStringTag,{configurable:!0,value:`AbortSignal`}),Jr=(Nn=class{constructor(){Yr.set(this,gn())}get signal(){return vn(this)}abort(){_n(vn(this))}},z(Nn,`AbortController`),Nn),Yr=new WeakMap,z(vn,`getSignal`),Object.defineProperties(Jr.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==`function`&&typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Jr.prototype,Symbol.toStringTag,{configurable:!0,value:`AbortController`}),Xr=Object.defineProperty,Zr=z((e,t)=>Xr(e,`name`,{value:t,configurable:!0}),`e`),Qr=Zt,yn(),z(yn,`s`),Zr(yn,`checkNodeEnvironment`)}));$r(),xt();let ei=!!globalThis.process?.env?.FORCE_NODE_FETCH,ti=!ei&&globalThis.fetch||Qr;!ei&&globalThis.Blob,!ei&&globalThis.File,!ei&&globalThis.FormData;let Q=!ei&&globalThis.Headers||gr;!ei&&globalThis.Request,!ei&&globalThis.Response;let ni=!ei&&globalThis.AbortController||Jr,ri=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,ii=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,ai=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function oi(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){$(e);return}return t}function $(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function si(e,t={}){if(typeof e!=`string`)return e;if(e[0]===`"`&&e[e.length-1]===`"`&&e.indexOf(`\\`)===-1)return e.slice(1,-1);let n=e.trim();if(n.length<=9)switch(n.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!ai.test(e)){if(t.strict)throw SyntaxError(`[destr] Invalid JSON`);return e}try{if(ri.test(e)||ii.test(e)){if(t.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(e,oi)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}String.fromCharCode;let ci=/#/g,li=/&/g,ui=/\//g,di=/=/g,fi=/\+/g,pi=/%5e/gi,mi=/%60/gi,hi=/%7c/gi,gi=/%20/gi;function _i(e){return encodeURI(``+e).replace(hi,`|`)}function vi(e){return _i(typeof e==`string`?e:JSON.stringify(e)).replace(fi,`%2B`).replace(gi,`+`).replace(ci,`%23`).replace(li,`%26`).replace(mi,"`").replace(pi,`^`).replace(ui,`%2F`)}function yi(e){return vi(e).replace(di,`%3D`)}function bi(e=``){try{return decodeURIComponent(``+e)}catch{return``+e}}function xi(e){return bi(e.replace(fi,` `))}function Si(e){return bi(e.replace(fi,` `))}function Ci(e=``){let t=Object.create(null);e[0]===`?`&&(e=e.slice(1));for(let n of e.split(`&`)){let e=n.match(/([^=]+)=?(.*)/)||[];if(e.length<2)continue;let r=xi(e[1]);if(r===`__proto__`||r===`constructor`)continue;let i=Si(e[2]||``);t[r]===void 0?t[r]=i:Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]}return t}function wi(e,t){return(typeof t==`number`||typeof t==`boolean`)&&(t=String(t)),t?Array.isArray(t)?t.map(t=>`${yi(e)}=${vi(t)}`).join(`&`):`${yi(e)}=${vi(t)}`:yi(e)}function Ti(e){return Object.keys(e).filter(t=>e[t]!==void 0).map(t=>wi(t,e[t])).filter(Boolean).join(`&`)}let Ei=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,Di=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,Oi=/^([/\\]\s*){2,}[^/\\]/,ki=/\/$|\/\?|\/#/,Ai=/^\.?\//;function ji(e,t={}){return typeof t==`boolean`&&(t={acceptRelative:t}),t.strict?Ei.test(e):Di.test(e)||(t.acceptRelative?Oi.test(e):!1)}function Mi(e=``,t){return t?ki.test(e):e.endsWith(`/`)}function Ni(e=``,t){if(!t)return(Mi(e)?e.slice(0,-1):e)||`/`;if(!Mi(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);i!==-1&&(n=e.slice(0,i),r=e.slice(i));let[a,...o]=n.split(`?`);return((a.endsWith(`/`)?a.slice(0,-1):a)||`/`)+(o.length>0?`?${o.join(`?`)}`:``)+r}function Pi(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(Mi(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function Fi(e,t){if(Li(t)||ji(e))return e;let n=Ni(t);if(e.startsWith(n)){let t=e[n.length];if(!t||t===`/`||t===`?`)return e}return zi(n,e)}function Ii(e,t){let n=Vi(e);return n.search=Ti({...Ci(n.search),...t}),Ui(n)}function Li(e){return!e||e===`/`}function Ri(e){return e&&e!==`/`}function zi(e,...t){let n=e||``;for(let e of t.filter(e=>Ri(e)))if(n){let t=e.replace(Ai,``);n=Pi(n)+t}else n=e;return n}let Bi=Symbol.for(`ufo:protocolRelative`);function Vi(e=``,t){let n=e.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(n){let[,e,t=``]=n;return{protocol:e.toLowerCase(),pathname:t,href:e+t,auth:``,host:``,search:``,hash:``}}if(!ji(e,{acceptRelative:!0}))return t?Vi(t+e):Hi(e);let[,r=``,i,a=``]=e.replace(/\\/g,`/`).match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,o=``,s=``]=a.match(/([^#/?]*)(.*)?/)||[];r===`file:`&&(s=s.replace(/\/(?=[A-Za-z]:)/,``));let{pathname:c,search:l,hash:u}=Hi(s);return{protocol:r.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):``,host:o,pathname:c,search:l,hash:u,[Bi]:!r}}function Hi(e=``){let[t=``,n=``,r=``]=(e.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:n,hash:r}}function Ui(e){let t=e.pathname||``,n=e.search?(e.search.startsWith(`?`)?``:`?`)+e.search:``,r=e.hash||``,i=e.auth?e.auth+`@`:``,a=e.host||``;return(e.protocol||e[Bi]?(e.protocol||``)+`//`:``)+i+a+t+n+r}var Wi=class extends Error{constructor(e,t){super(e,t),this.name=`FetchError`,t?.cause&&!this.cause&&(this.cause=t.cause)}};function Gi(e){let t=e.error?.message||e.error?.toString()||``,n=e.request?.method||e.options?.method||`GET`,r=e.request?.url||String(e.request)||`/`,i=new Wi(`${`[${n}] ${JSON.stringify(r)}`}: ${e.response?`${e.response.status} ${e.response.statusText}`:`<no response>`}${t?` ${t}`:``}`,e.error?{cause:e.error}:void 0);for(let t of[`request`,`options`,`response`])Object.defineProperty(i,t,{get(){return e[t]}});for(let[t,n]of[[`data`,`_data`],[`status`,`status`],[`statusCode`,`status`],[`statusText`,`statusText`],[`statusMessage`,`statusText`]])Object.defineProperty(i,t,{get(){return e.response&&e.response[n]}});return i}let Ki=new Set(Object.freeze([`PATCH`,`POST`,`PUT`,`DELETE`]));function qi(e=`GET`){return Ki.has(e.toUpperCase())}function Ji(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer||e instanceof FormData||e instanceof URLSearchParams?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}let Yi=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]),Xi=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Zi(e=``){if(!e)return`json`;let t=e.split(`;`).shift()||``;return Xi.test(t)?`json`:t===`text/event-stream`?`stream`:Yi.has(t)||t.startsWith(`text/`)?`text`:`blob`}function Qi(e,t,n,r){let i=$i(t?.headers??e?.headers,n?.headers,r),a;return(n?.query||n?.params||t?.params||t?.query)&&(a={...n?.params,...n?.query,...t?.params,...t?.query}),{...n,...t,query:a,params:a,headers:i}}function $i(e,t,n){if(!t)return new n(e);let r=new n(t);if(e)for(let[t,i]of Symbol.iterator in e||Array.isArray(e)?e:new n(e))r.set(t,i);return r}async function ea(e,t){if(t)if(Array.isArray(t))for(let n of t)await n(e);else await t(e)}let ta=new Set([408,409,425,429,500,502,503,504]),na=new Set([101,204,205,304]);function ra(e={}){let{fetch:t=globalThis.fetch,Headers:n=globalThis.Headers,AbortController:r=globalThis.AbortController}=e;async function i(e){let t=e.error&&e.error.name===`AbortError`&&!e.options.timeout||!1;if(e.options.retry!==!1&&!t){let t;t=typeof e.options.retry==`number`?e.options.retry:qi(e.options.method)?0:1;let n=e.response&&e.response.status||500;if(t>0&&(Array.isArray(e.options.retryStatusCodes)?e.options.retryStatusCodes.includes(n):ta.has(n))){let n=typeof e.options.retryDelay==`function`?e.options.retryDelay(e):e.options.retryDelay||0;return n>0&&await new Promise(e=>setTimeout(e,n)),a(e.request,{...e.options,retry:t-1})}}let n=Gi(e);throw Error.captureStackTrace&&Error.captureStackTrace(n,a),n}let a=async function(a,o={}){let s={request:a,options:Qi(a,o,e.defaults,n),response:void 0,error:void 0};if(s.options.method&&(s.options.method=s.options.method.toUpperCase()),s.options.onRequest&&(await ea(s,s.options.onRequest),s.options.headers instanceof n||(s.options.headers=new n(s.options.headers||{}))),typeof s.request==`string`&&(s.options.baseURL&&(s.request=Fi(s.request,s.options.baseURL)),s.options.query&&(s.request=Ii(s.request,s.options.query),delete s.options.query),`query`in s.options&&delete s.options.query,`params`in s.options&&delete s.options.params),s.options.body&&qi(s.options.method))if(Ji(s.options.body)){let e=s.options.headers.get(`content-type`);typeof s.options.body!=`string`&&(s.options.body=e===`application/x-www-form-urlencoded`?new URLSearchParams(s.options.body).toString():JSON.stringify(s.options.body)),e||s.options.headers.set(`content-type`,`application/json`),s.options.headers.has(`accept`)||s.options.headers.set(`accept`,`application/json`)}else (`pipeTo`in s.options.body&&typeof s.options.body.pipeTo==`function`||typeof s.options.body.pipe==`function`)&&(`duplex`in s.options||(s.options.duplex=`half`));let c;if(!s.options.signal&&s.options.timeout){let e=new r;c=setTimeout(()=>{let t=Error(`[TimeoutError]: The operation was aborted due to timeout`);t.name=`TimeoutError`,t.code=23,e.abort(t)},s.options.timeout),s.options.signal=e.signal}try{s.response=await t(s.request,s.options)}catch(e){return s.error=e,s.options.onRequestError&&await ea(s,s.options.onRequestError),await i(s)}finally{c&&clearTimeout(c)}if((s.response.body||s.response._bodyInit)&&!na.has(s.response.status)&&s.options.method!==`HEAD`){let e=(s.options.parseResponse?`json`:s.options.responseType)||Zi(s.response.headers.get(`content-type`)||``);switch(e){case`json`:{let e=await s.response.text(),t=s.options.parseResponse||si;s.response._data=t(e);break}case`stream`:s.response._data=s.response.body||s.response._bodyInit;break;default:s.response._data=await s.response[e]()}}return s.options.onResponse&&await ea(s,s.options.onResponse),!s.options.ignoreResponseError&&s.response.status>=400&&s.response.status<600?(s.options.onResponseError&&await ea(s,s.options.onResponseError),await i(s)):s.response},o=async function(e,t){return(await a(e,t))._data};return o.raw=a,o.native=(...e)=>t(...e),o.create=(t={},n={})=>ra({...e,...n,defaults:{...e.defaults,...n.defaults,...t}}),o}function ia(){if(!JSON.parse(process.env.FETCH_KEEP_ALIVE||`false`))return ti;let e={keepAlive:!0},r=new t.default.Agent(e),i=new n.default.Agent(e),a={agent(e){return e.protocol===`http:`?r:i}};return function(e,t){return ti(e,{...a,...t})}}let aa=ra({fetch:globalThis.fetch?(...e)=>globalThis.fetch(...e):ia(),Headers:globalThis.Headers||Q,AbortController:globalThis.AbortController||ni});function oa(e){let t=e,n=new Set;return{get(){return t},set(e){t=e,n.forEach(e=>e(t))},subscribe(e){return n.add(e),e(t),()=>n.delete(e)}}}function sa(e,t){return e.subscribe(t)}function ca(e){if(typeof e==`function`){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e();return}let t=document.querySelector(e);return t?new la(t):null}var la=class{constructor(e){this.element=e}element;on(e,t){return this.element.addEventListener(e,t),this}off(e,t){return this.element.removeEventListener(e,t),this}addClass(e){return this.element.classList.add(e),this}removeClass(e){return this.element.classList.remove(e),this}toggleClass(e){return this.element.classList.toggle(e),this}hidden=!1;hide(){return this.element.style.display=`none`,this.hidden=!0,this}show(){return this.element.style.display=``,this.hidden=!1,this}toggle(){return this.hidden?this.show():this.hide(),this}text(e){return e===void 0?this.element.textContent:(this.element.textContent=e,this)}attr(e,t){return t===void 0?this.element.getAttribute(e):(this.element.setAttribute(e,t),this)}val(e){return e===void 0?this.element.value:(this.element.value=e,this)}html(e){return e===void 0?this.element.innerHTML:(this.element.innerHTML=e,this)}markdown(e){this.element.innerHTML=A(e)}remove(){this.element.remove()}},ua=class{elements;constructor(e){this.elements=e.map(e=>new la(e))}each(e){return this.elements.forEach(e),this}};function da(e){let t=[];return typeof e==`string`?t=Array.from(document.querySelectorAll(e)):e instanceof HTMLElement&&(t=[e]),new ua(t)}return e.$=ca,e.ZinqCollection=ua,e.ZinqElement=la,e.effect=sa,e.fetch=aa,e.multi$=da,e.signal=oa,e})({},node_http,node_https,node_zlib,node_stream,node_buffer,node_util,node_url,node_net,node_fs,node_path);
72
+ `)).replace(/\n/g,`%0A`).replace(/\r/g,`%0D`).replace(/"/g,`%22`),`e$1`),K=z((e,t,n)=>{if(t.length<n)throw TypeError(`Failed to execute '${e}' on 'FormData': ${n} arguments required, but only ${t.length} present.`)},`x`),Yn=(An=class{constructor(...e){if(V(this,W,[]),e.length)throw TypeError(`Failed to construct 'FormData': parameter 1 is not of type 'HTMLFormElement'.`)}get[Hn](){return`FormData`}[Un](){return this.entries()}static[Wn](e){return e&&typeof e==`object`&&e[Hn]===`FormData`&&!Kn.some(t=>typeof e[t]!=`function`)}append(...e){K(`append`,arguments,2),B(this,W).push(qn(...e))}delete(e){K(`delete`,arguments,1),e+=``,H(this,W,B(this,W).filter(([t])=>t!==e))}get(e){K(`get`,arguments,1),e+=``;for(var t=B(this,W),n=t.length,r=0;r<n;r++)if(t[r][0]===e)return t[r][1];return null}getAll(e,t){return K(`getAll`,arguments,1),t=[],e+=``,B(this,W).forEach(n=>n[0]===e&&t.push(n[1])),t}has(e){return K(`has`,arguments,1),e+=``,B(this,W).some(t=>t[0]===e)}forEach(e,t){K(`forEach`,arguments,1);for(var[n,r]of this)e.call(t,r,n,this)}set(...e){K(`set`,arguments,2);var t=[],n=!0;e=qn(...e),B(this,W).forEach(r=>{r[0]===e[0]?n&&=!t.push(e):t.push(r)}),n&&t.push(e),H(this,W,t)}*entries(){yield*B(this,W)}*keys(){for(var[e]of this)yield e}*values(){for(var[,e]of this)yield e}},W=new WeakMap,z(An,`FormData`),An),z(Vt,`formDataToBlob`),Xn=class 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}},z(Xn,`FetchBaseError`),Zn=Xn,Qn=class extends Zn{constructor(e,t,n){super(e,t),n&&(this.code=this.errno=n.code,this.erroredSysCall=n.syscall)}},z(Qn,`FetchError`),q=Qn,$n=Symbol.toStringTag,er=z(e=>typeof e==`object`&&typeof e.append==`function`&&typeof e.delete==`function`&&typeof e.get==`function`&&typeof e.getAll==`function`&&typeof e.has==`function`&&typeof e.set==`function`&&typeof e.sort==`function`&&e[$n]===`URLSearchParams`,`isURLSearchParameters`),tr=z(e=>e&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&typeof e.constructor==`function`&&/^(Blob|File)$/.test(e[$n]),`isBlob`),nr=z(e=>typeof e==`object`&&(e[$n]===`AbortSignal`||e[$n]===`EventTarget`),`isAbortSignal`),rr=z((e,t)=>{let n=new URL(t).hostname,r=new URL(e).hostname;return n===r||n.endsWith(`.${r}`)},`isDomainOrSubdomain`),ir=z((e,t)=>new URL(t).protocol===new URL(e).protocol,`isSameProtocol`),ar=(0,o.promisify)(i.default.pipeline),J=Symbol(`Body internals`),or=class{constructor(e,{size:t=0}={}){let n=null;e===null?e=null:er(e)?e=a.Buffer.from(e.toString()):tr(e)||a.Buffer.isBuffer(e)||(o.types.isAnyArrayBuffer(e)?e=a.Buffer.from(e):ArrayBuffer.isView(e)?e=a.Buffer.from(e.buffer,e.byteOffset,e.byteLength):e instanceof i.default||(e instanceof Yn?(e=Vt(e),n=e.type.split(`=`)[1]):e=a.Buffer.from(String(e))));let r=e;a.Buffer.isBuffer(e)?r=i.default.Readable.from(e):tr(e)&&(r=i.default.Readable.from(e.stream())),this[J]={body:e,stream:r,boundary:n,disturbed:!1,error:null},this.size=t,e instanceof i.default&&e.on(`error`,e=>{let t=e instanceof Zn?e:new q(`Invalid response body while trying to fetch ${this.url}: ${e.message}`,`system`,e);this[J].error=t})}get body(){return this[J].stream}get bodyUsed(){return this[J].disturbed}async arrayBuffer(){let{buffer:e,byteOffset:t,byteLength:n}=await Ht(this);return e.slice(t,t+n)}async formData(){let e=this.headers.get(`content-type`);if(e.startsWith(`application/x-www-form-urlencoded`)){let e=new Yn,t=new URLSearchParams(await this.text());for(let[n,r]of t)e.append(n,r);return e}let{toFormData:t}=await Promise.resolve().then(()=>(It(),St));return t(this.body,e)}async blob(){let e=this.headers&&this.headers.get(`content-type`)||this[J].body&&this[J].body.type||``;return new Bn([await this.arrayBuffer()],{type:e})}async json(){let e=await this.text();return JSON.parse(e)}async text(){let e=await Ht(this);return new TextDecoder().decode(e)}buffer(){return Ht(this)}},z(or,`Body`),sr=or,sr.prototype.buffer=(0,o.deprecate)(sr.prototype.buffer,`Please use 'response.arrayBuffer()' instead of 'response.buffer()'`,`node-fetch#buffer`),Object.defineProperties(sr.prototype,{body:{enumerable:!0},bodyUsed:{enumerable:!0},arrayBuffer:{enumerable:!0},blob:{enumerable:!0},json:{enumerable:!0},text:{enumerable:!0},data:{get:(0,o.deprecate)(()=>{},`data doesn't exist, use json(), text(), arrayBuffer(), or body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (response)`)}}),z(Ht,`consumeBody`),cr=z((e,t)=>{let n,r,{body:a}=e[J];if(e.bodyUsed)throw Error(`cannot clone body after it is used`);return a instanceof i.default&&typeof a.getBoundary!=`function`&&(n=new i.PassThrough({highWaterMark:t}),r=new i.PassThrough({highWaterMark:t}),a.pipe(n),a.pipe(r),e[J].stream=n,a=r),a},`clone`),lr=(0,o.deprecate)(e=>e.getBoundary(),`form-data doesn't follow the spec and requires special treatment. Use alternative package`,`https://github.com/node-fetch/node-fetch/issues/1167`),ur=z((e,t)=>e===null?null:typeof e==`string`?`text/plain;charset=UTF-8`:er(e)?`application/x-www-form-urlencoded;charset=UTF-8`:tr(e)?e.type||null:a.Buffer.isBuffer(e)||o.types.isAnyArrayBuffer(e)||ArrayBuffer.isView(e)?null:e instanceof Yn?`multipart/form-data; boundary=${t[J].boundary}`:e&&typeof e.getBoundary==`function`?`multipart/form-data;boundary=${lr(e)}`:e instanceof i.default?null:`text/plain;charset=UTF-8`,`extractContentType`),dr=z(e=>{let{body:t}=e[J];return t===null?0:tr(t)?t.size:a.Buffer.isBuffer(t)?t.length:t&&typeof t.getLengthSync==`function`&&t.hasKnownLength&&t.hasKnownLength()?t.getLengthSync():null},`getTotalBytes`),fr=z(async(e,{body:t})=>{t===null?e.end():await ar(t,e)},`writeToStream`),pr=typeof t.default.validateHeaderName==`function`?t.default.validateHeaderName:e=>{if(!/^[\^`\-\w!#$%&'*+.|~]+$/.test(e)){let t=TypeError(`Header name must be a valid HTTP token [${e}]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_HTTP_TOKEN`}),t}},mr=typeof t.default.validateHeaderValue==`function`?t.default.validateHeaderValue:(e,t)=>{if(/[^\t\u0020-\u007E\u0080-\u00FF]/.test(t)){let t=TypeError(`Invalid character in header content ["${e}"]`);throw Object.defineProperty(t,`code`,{value:`ERR_INVALID_CHAR`}),t}},hr=class e extends URLSearchParams{constructor(t){let n=[];if(t instanceof e){let e=t.raw();for(let[t,r]of Object.entries(e))n.push(...r.map(e=>[t,e]))}else if(t!=null)if(typeof t==`object`&&!o.types.isBoxedPrimitive(t)){let e=t[Symbol.iterator];if(e==null)n.push(...Object.entries(t));else{if(typeof e!=`function`)throw TypeError(`Header pairs must be iterable`);n=[...t].map(e=>{if(typeof e!=`object`||o.types.isBoxedPrimitive(e))throw TypeError(`Each header pair must be an iterable object`);return[...e]}).map(e=>{if(e.length!==2)throw TypeError(`Each header pair must be a name/value tuple`);return[...e]})}}else throw TypeError(`Failed to construct 'Headers': The provided value is not of type '(sequence<sequence<ByteString>> or record<ByteString, ByteString>)`);return n=n.length>0?n.map(([e,t])=>(pr(e),mr(e,String(t)),[String(e).toLowerCase(),String(t)])):void 0,super(n),new Proxy(this,{get(e,t,n){switch(t){case`append`:case`set`:return(n,r)=>(pr(n),mr(n,String(r)),URLSearchParams.prototype[t].call(e,String(n).toLowerCase(),String(r)));case`delete`:case`has`:case`getAll`:return n=>(pr(n),URLSearchParams.prototype[t].call(e,String(n).toLowerCase()));case`keys`:return()=>(e.sort(),new Set(URLSearchParams.prototype.keys.call(e)).keys());default:return Reflect.get(e,t,n)}}})}get[Symbol.toStringTag](){return this.constructor.name}toString(){return Object.prototype.toString.call(this)}get(e){let t=this.getAll(e);if(t.length===0)return null;let n=t.join(`, `);return/^content-encoding$/i.test(e)&&(n=n.toLowerCase()),n}forEach(e,t=void 0){for(let n of this.keys())Reflect.apply(e,t,[this.get(n),n,this])}*values(){for(let e of this.keys())yield this.get(e)}*entries(){for(let 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)=>{let n=this.getAll(t);return t===`host`?e[t]=n[0]:e[t]=n.length>1?n:n[0],e},{})}},z(hr,`Headers`),gr=hr,Object.defineProperties(gr.prototype,[`get`,`entries`,`forEach`,`values`].reduce((e,t)=>(e[t]={enumerable:!0},e),{})),z(Ut,`fromRawHeaders`),_r=new Set([301,302,303,307,308]),vr=z(e=>_r.has(e),`isRedirect`),Y=Symbol(`Response internals`),yr=class e extends sr{constructor(e=null,t={}){super(e,t);let n=t.status==null?200:t.status,r=new gr(t.headers);if(e!==null&&!r.has(`Content-Type`)){let t=ur(e,this);t&&r.append(`Content-Type`,t)}this[Y]={type:`default`,url:t.url,status:n,statusText:t.statusText||``,headers:r,counter:t.counter,highWaterMark:t.highWaterMark}}get type(){return this[Y].type}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 e(cr(this,this.highWaterMark),{type:this.type,url:this.url,status:this.status,statusText:this.statusText,headers:this.headers,ok:this.ok,redirected:this.redirected,size:this.size,highWaterMark:this.highWaterMark})}static redirect(t,n=302){if(!vr(n))throw RangeError(`Failed to execute "redirect" on "response": Invalid status code`);return new e(null,{headers:{location:new URL(t).toString()},status:n})}static error(){let t=new e(null,{status:0,statusText:``});return t[Y].type=`error`,t}static json(t=void 0,n={}){let r=JSON.stringify(t);if(r===void 0)throw TypeError(`data is not JSON serializable`);let i=new gr(n&&n.headers);return i.has(`content-type`)||i.set(`content-type`,`application/json`),new e(r,{...n,headers:i})}get[Symbol.toStringTag](){return`Response`}},z(yr,`Response`),br=yr,Object.defineProperties(br.prototype,{type:{enumerable:!0},url:{enumerable:!0},status:{enumerable:!0},ok:{enumerable:!0},redirected:{enumerable:!0},statusText:{enumerable:!0},headers:{enumerable:!0},clone:{enumerable:!0}}),xr=z(e=>{if(e.search)return e.search;let t=e.href.length-1,n=e.hash||(e.href[t]===`#`?`#`:``);return e.href[t-n.length]===`?`?`?`:``},`getSearch`),z(Wt,`stripURLForUseAsAReferrer`),Sr=new Set([``,`no-referrer`,`no-referrer-when-downgrade`,`same-origin`,`origin`,`strict-origin`,`origin-when-cross-origin`,`strict-origin-when-cross-origin`,`unsafe-url`]),Cr=`strict-origin-when-cross-origin`,z(Gt,`validateReferrerPolicy`),z(Kt,`isOriginPotentiallyTrustworthy`),z(qt,`isUrlPotentiallyTrustworthy`),z(Jt,`determineRequestsReferrer`),z(Yt,`parseReferrerPolicyFromHeader`),X=Symbol(`Request internals`),wr=z(e=>typeof e==`object`&&typeof e[X]==`object`,`isRequest`),Tr=(0,o.deprecate)(()=>{},`.data is not a valid RequestInit property, use .body instead`,`https://github.com/node-fetch/node-fetch/issues/1000 (request)`),Er=class e extends sr{constructor(e,t={}){let n;if(wr(e)?n=new URL(e.url):(n=new URL(e),e={}),n.username!==``||n.password!==``)throw TypeError(`${n} is an url with embedded credentials.`);let r=t.method||e.method||`GET`;if(/^(delete|get|head|options|post|put)$/i.test(r)&&(r=r.toUpperCase()),!wr(t)&&`data`in t&&Tr(),(t.body!=null||wr(e)&&e.body!==null)&&(r===`GET`||r===`HEAD`))throw TypeError(`Request with GET/HEAD method cannot have body`);let i=t.body?t.body:wr(e)&&e.body!==null?cr(e):null;super(i,{size:t.size||e.size||0});let a=new gr(t.headers||e.headers||{});if(i!==null&&!a.has(`Content-Type`)){let e=ur(i,this);e&&a.set(`Content-Type`,e)}let o=wr(e)?e.signal:null;if(`signal`in t&&(o=t.signal),o!=null&&!nr(o))throw TypeError(`Expected signal to be an instanceof AbortSignal or EventTarget`);let s=t.referrer==null?e.referrer:t.referrer;if(s===``)s=`no-referrer`;else if(s){let e=new URL(s);s=/^about:(\/\/)?client$/.test(e)?`client`:e}else s=void 0;this[X]={method:r,redirect:t.redirect||e.redirect||`follow`,headers:a,parsedURL:n,signal:o,referrer:s},this.follow=t.follow===void 0?e.follow===void 0?20:e.follow:t.follow,this.compress=t.compress===void 0?e.compress===void 0?!0:e.compress:t.compress,this.counter=t.counter||e.counter||0,this.agent=t.agent||e.agent,this.highWaterMark=t.highWaterMark||e.highWaterMark||16384,this.insecureHTTPParser=t.insecureHTTPParser||e.insecureHTTPParser||!1,this.referrerPolicy=t.referrerPolicy||e.referrerPolicy||``}get method(){return this[X].method}get url(){return(0,s.format)(this[X].parsedURL)}get headers(){return this[X].headers}get redirect(){return this[X].redirect}get signal(){return this[X].signal}get referrer(){if(this[X].referrer===`no-referrer`)return``;if(this[X].referrer===`client`)return`about:client`;if(this[X].referrer)return this[X].referrer.toString()}get referrerPolicy(){return this[X].referrerPolicy}set referrerPolicy(e){this[X].referrerPolicy=Gt(e)}clone(){return new e(this)}get[Symbol.toStringTag](){return`Request`}},z(Er,`Request`),Dr=Er,Object.defineProperties(Dr.prototype,{method:{enumerable:!0},url:{enumerable:!0},headers:{enumerable:!0},redirect:{enumerable:!0},clone:{enumerable:!0},signal:{enumerable:!0},referrer:{enumerable:!0},referrerPolicy:{enumerable:!0}}),Or=z(e=>{let{parsedURL:t}=e[X],n=new gr(e[X].headers);n.has(`Accept`)||n.set(`Accept`,`*/*`);let r=null;if(e.body===null&&/^(post|put)$/i.test(e.method)&&(r=`0`),e.body!==null){let t=dr(e);typeof t==`number`&&!Number.isNaN(t)&&(r=String(t))}r&&n.set(`Content-Length`,r),e.referrerPolicy===``&&(e.referrerPolicy=Cr),e.referrer&&e.referrer!==`no-referrer`?e[X].referrer=Jt(e):e[X].referrer=`no-referrer`,e[X].referrer instanceof URL&&n.set(`Referer`,e.referrer),n.has(`User-Agent`)||n.set(`User-Agent`,`node-fetch`),e.compress&&!n.has(`Accept-Encoding`)&&n.set(`Accept-Encoding`,`gzip, deflate, br`);let{agent:i}=e;typeof i==`function`&&(i=i(t));let a=xr(t);return{parsedURL:t,options:{path:t.pathname+a,method:e.method,headers:n[Symbol.for(`nodejs.util.inspect.custom`)](),insecureHTTPParser:e.insecureHTTPParser,agent:i}}},`getNodeRequestOptions`),kr=class extends Zn{constructor(e,t=`aborted`){super(e,t)}},z(kr,`AbortError`),Ar=kr,z(Xt,`requireNodeDomexception`),Z=_t(Xt()),{stat:Nr}=l.promises,z((e,t)=>Pr((0,l.statSync)(e),e,t),`blobFromSync`),z((e,t)=>Nr(e).then(n=>Pr(n,e,t)),`blobFrom`),z((e,t)=>Nr(e).then(n=>Fr(n,e,t)),`fileFrom`),z((e,t)=>Fr((0,l.statSync)(e),e,t),`fileFromSync`),Pr=z((e,t,n=``)=>new Bn([new Lr({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],{type:n}),`fromBlob`),Fr=z((e,t,n=``)=>new Vn([new Lr({path:t,size:e.size,lastModified:e.mtimeMs,start:0})],(0,u.basename)(t),{type:n,lastModified:e.mtimeMs}),`fromFile`),Ir=class e{constructor(e){V(this,jn),V(this,Mn),H(this,jn,e.path),H(this,Mn,e.start),this.size=e.size,this.lastModified=e.lastModified}slice(t,n){return new e({path:B(this,jn),lastModified:this.lastModified,size:n-t,start:B(this,Mn)+t})}async*stream(){let{mtimeMs:e}=await Nr(B(this,jn));if(e>this.lastModified)throw new Z(`The requested file could not be read, typically due to permission problems that have occurred after a reference to a file was acquired.`,`NotReadableError`);yield*(0,l.createReadStream)(B(this,jn),{start:B(this,Mn),end:B(this,Mn)+this.size-1})}get[Symbol.toStringTag](){return`Blob`}},jn=new WeakMap,Mn=new WeakMap,z(Ir,`BlobDataItem`),Lr=Ir,Rr=new Set([`data:`,`http:`,`https:`]),z(Zt,`fetch$1`),z(Qt,`fixResponseChunkedTransferBadEnding`),zr=new WeakMap,Br=new WeakMap,z(L,`pd`),z($t,`setCancelFlag`),z(en,`Event`),en.prototype={get type(){return L(this).event.type},get target(){return L(this).eventTarget},get currentTarget(){return L(this).currentTarget},composedPath(){let e=L(this).currentTarget;return e==null?[]:[e]},get NONE(){return 0},get CAPTURING_PHASE(){return 1},get AT_TARGET(){return 2},get BUBBLING_PHASE(){return 3},get eventPhase(){return L(this).eventPhase},stopPropagation(){let e=L(this);e.stopped=!0,typeof e.event.stopPropagation==`function`&&e.event.stopPropagation()},stopImmediatePropagation(){let e=L(this);e.stopped=!0,e.immediateStopped=!0,typeof e.event.stopImmediatePropagation==`function`&&e.event.stopImmediatePropagation()},get bubbles(){return!!L(this).event.bubbles},get cancelable(){return!!L(this).event.cancelable},preventDefault(){$t(L(this))},get defaultPrevented(){return L(this).canceled},get composed(){return!!L(this).event.composed},get timeStamp(){return L(this).timeStamp},get srcElement(){return L(this).eventTarget},get cancelBubble(){return L(this).stopped},set cancelBubble(e){if(!e)return;let t=L(this);t.stopped=!0,typeof t.event.cancelBubble==`boolean`&&(t.event.cancelBubble=!0)},get returnValue(){return!L(this).canceled},set returnValue(e){e||$t(L(this))},initEvent(){}},Object.defineProperty(en.prototype,`constructor`,{value:en,configurable:!0,writable:!0}),typeof window<`u`&&typeof window.Event<`u`&&(Object.setPrototypeOf(en.prototype,window.Event.prototype),Br.set(window.Event.prototype,en)),z(tn,`defineRedirectDescriptor`),z(nn,`defineCallDescriptor`),z(rn,`defineWrapper`),z(an,`getWrapper`),z(on,`wrapEvent`),z(sn,`isStopped`),z(cn,`setEventPhase`),z(ln,`setCurrentTarget`),z(un,`setPassiveListener`),Vr=new WeakMap,Hr=1,Ur=2,Wr=3,z(dn,`isObject`),z(fn,`getListeners`),z(pn,`defineEventAttributeDescriptor`),z(mn,`defineEventAttribute`),z(hn,`defineCustomEventTarget`),z(R,`EventTarget`),R.prototype={addEventListener(e,t,n){if(t==null)return;if(typeof t!=`function`&&!dn(t))throw TypeError(`'listener' should be a function or an object.`);let r=fn(this),i=dn(n),a=(i?n.capture:n)?Hr:Ur,o={listener:t,listenerType:a,passive:i&&!!n.passive,once:i&&!!n.once,next:null},s=r.get(e);if(s===void 0){r.set(e,o);return}let c=null;for(;s!=null;){if(s.listener===t&&s.listenerType===a)return;c=s,s=s.next}c.next=o},removeEventListener(e,t,n){if(t==null)return;let r=fn(this),i=(dn(n)?n.capture:n)?Hr:Ur,a=null,o=r.get(e);for(;o!=null;){if(o.listener===t&&o.listenerType===i){a===null?o.next===null?r.delete(e):r.set(e,o.next):a.next=o.next;return}a=o,o=o.next}},dispatchEvent(e){if(e==null||typeof e.type!=`string`)throw TypeError(`"event.type" should be a string.`);let t=fn(this),n=e.type,r=t.get(n);if(r==null)return!0;let i=on(this,e),a=null;for(;r!=null;){if(r.once?a===null?r.next===null?t.delete(n):t.set(n,r.next):a.next=r.next:a=r,un(i,r.passive?r.listener:null),typeof r.listener==`function`)try{r.listener.call(this,i)}catch(e){typeof console<`u`&&typeof console.error==`function`&&console.error(e)}else r.listenerType!==Wr&&typeof r.listener.handleEvent==`function`&&r.listener.handleEvent(i);if(sn(i))break;r=r.next}return un(i,null),cn(i,0),ln(i,null),!i.defaultPrevented}},Object.defineProperty(R.prototype,`constructor`,{value:R,configurable:!0,writable:!0}),typeof window<`u`&&typeof window.EventTarget<`u`&&Object.setPrototypeOf(R.prototype,window.EventTarget.prototype),Gr=class extends R{constructor(){throw super(),TypeError(`AbortSignal cannot be constructed directly`)}get aborted(){let e=qr.get(this);if(typeof e!=`boolean`)throw TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this===null?`null`:typeof this}`);return e}},z(Gr,`AbortSignal`),Kr=Gr,mn(Kr.prototype,`abort`),z(gn,`createAbortSignal`),z(_n,`abortSignal`),qr=new WeakMap,Object.defineProperties(Kr.prototype,{aborted:{enumerable:!0}}),typeof Symbol==`function`&&typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Kr.prototype,Symbol.toStringTag,{configurable:!0,value:`AbortSignal`}),Jr=(Nn=class{constructor(){Yr.set(this,gn())}get signal(){return vn(this)}abort(){_n(vn(this))}},z(Nn,`AbortController`),Nn),Yr=new WeakMap,z(vn,`getSignal`),Object.defineProperties(Jr.prototype,{signal:{enumerable:!0},abort:{enumerable:!0}}),typeof Symbol==`function`&&typeof Symbol.toStringTag==`symbol`&&Object.defineProperty(Jr.prototype,Symbol.toStringTag,{configurable:!0,value:`AbortController`}),Xr=Object.defineProperty,Zr=z((e,t)=>Xr(e,`name`,{value:t,configurable:!0}),`e`),Qr=Zt,yn(),z(yn,`s`),Zr(yn,`checkNodeEnvironment`)}));$r(),xt();let ei=!!globalThis.process?.env?.FORCE_NODE_FETCH,ti=!ei&&globalThis.fetch||Qr;!ei&&globalThis.Blob,!ei&&globalThis.File,!ei&&globalThis.FormData;let Q=!ei&&globalThis.Headers||gr;!ei&&globalThis.Request,!ei&&globalThis.Response;let ni=!ei&&globalThis.AbortController||Jr,ri=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,ii=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,ai=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function oi(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){$(e);return}return t}function $(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function si(e,t={}){if(typeof e!=`string`)return e;if(e[0]===`"`&&e[e.length-1]===`"`&&e.indexOf(`\\`)===-1)return e.slice(1,-1);let n=e.trim();if(n.length<=9)switch(n.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!ai.test(e)){if(t.strict)throw SyntaxError(`[destr] Invalid JSON`);return e}try{if(ri.test(e)||ii.test(e)){if(t.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(e,oi)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}String.fromCharCode;let ci=/#/g,li=/&/g,ui=/\//g,di=/=/g,fi=/\+/g,pi=/%5e/gi,mi=/%60/gi,hi=/%7c/gi,gi=/%20/gi;function _i(e){return encodeURI(``+e).replace(hi,`|`)}function vi(e){return _i(typeof e==`string`?e:JSON.stringify(e)).replace(fi,`%2B`).replace(gi,`+`).replace(ci,`%23`).replace(li,`%26`).replace(mi,"`").replace(pi,`^`).replace(ui,`%2F`)}function yi(e){return vi(e).replace(di,`%3D`)}function bi(e=``){try{return decodeURIComponent(``+e)}catch{return``+e}}function xi(e){return bi(e.replace(fi,` `))}function Si(e){return bi(e.replace(fi,` `))}function Ci(e=``){let t=Object.create(null);e[0]===`?`&&(e=e.slice(1));for(let n of e.split(`&`)){let e=n.match(/([^=]+)=?(.*)/)||[];if(e.length<2)continue;let r=xi(e[1]);if(r===`__proto__`||r===`constructor`)continue;let i=Si(e[2]||``);t[r]===void 0?t[r]=i:Array.isArray(t[r])?t[r].push(i):t[r]=[t[r],i]}return t}function wi(e,t){return(typeof t==`number`||typeof t==`boolean`)&&(t=String(t)),t?Array.isArray(t)?t.map(t=>`${yi(e)}=${vi(t)}`).join(`&`):`${yi(e)}=${vi(t)}`:yi(e)}function Ti(e){return Object.keys(e).filter(t=>e[t]!==void 0).map(t=>wi(t,e[t])).filter(Boolean).join(`&`)}let Ei=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,Di=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,Oi=/^([/\\]\s*){2,}[^/\\]/,ki=/\/$|\/\?|\/#/,Ai=/^\.?\//;function ji(e,t={}){return typeof t==`boolean`&&(t={acceptRelative:t}),t.strict?Ei.test(e):Di.test(e)||(t.acceptRelative?Oi.test(e):!1)}function Mi(e=``,t){return t?ki.test(e):e.endsWith(`/`)}function Ni(e=``,t){if(!t)return(Mi(e)?e.slice(0,-1):e)||`/`;if(!Mi(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);i!==-1&&(n=e.slice(0,i),r=e.slice(i));let[a,...o]=n.split(`?`);return((a.endsWith(`/`)?a.slice(0,-1):a)||`/`)+(o.length>0?`?${o.join(`?`)}`:``)+r}function Pi(e=``,t){if(!t)return e.endsWith(`/`)?e:e+`/`;if(Mi(e,!0))return e||`/`;let n=e,r=``,i=e.indexOf(`#`);if(i!==-1&&(n=e.slice(0,i),r=e.slice(i),!n))return r;let[a,...o]=n.split(`?`);return a+`/`+(o.length>0?`?${o.join(`?`)}`:``)+r}function Fi(e,t){if(Li(t)||ji(e))return e;let n=Ni(t);if(e.startsWith(n)){let t=e[n.length];if(!t||t===`/`||t===`?`)return e}return zi(n,e)}function Ii(e,t){let n=Vi(e);return n.search=Ti({...Ci(n.search),...t}),Ui(n)}function Li(e){return!e||e===`/`}function Ri(e){return e&&e!==`/`}function zi(e,...t){let n=e||``;for(let e of t.filter(e=>Ri(e)))if(n){let t=e.replace(Ai,``);n=Pi(n)+t}else n=e;return n}let Bi=Symbol.for(`ufo:protocolRelative`);function Vi(e=``,t){let n=e.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(n){let[,e,t=``]=n;return{protocol:e.toLowerCase(),pathname:t,href:e+t,auth:``,host:``,search:``,hash:``}}if(!ji(e,{acceptRelative:!0}))return t?Vi(t+e):Hi(e);let[,r=``,i,a=``]=e.replace(/\\/g,`/`).match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,o=``,s=``]=a.match(/([^#/?]*)(.*)?/)||[];r===`file:`&&(s=s.replace(/\/(?=[A-Za-z]:)/,``));let{pathname:c,search:l,hash:u}=Hi(s);return{protocol:r.toLowerCase(),auth:i?i.slice(0,Math.max(0,i.length-1)):``,host:o,pathname:c,search:l,hash:u,[Bi]:!r}}function Hi(e=``){let[t=``,n=``,r=``]=(e.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:n,hash:r}}function Ui(e){let t=e.pathname||``,n=e.search?(e.search.startsWith(`?`)?``:`?`)+e.search:``,r=e.hash||``,i=e.auth?e.auth+`@`:``,a=e.host||``;return(e.protocol||e[Bi]?(e.protocol||``)+`//`:``)+i+a+t+n+r}var Wi=class extends Error{constructor(e,t){super(e,t),this.name=`FetchError`,t?.cause&&!this.cause&&(this.cause=t.cause)}};function Gi(e){let t=e.error?.message||e.error?.toString()||``,n=e.request?.method||e.options?.method||`GET`,r=e.request?.url||String(e.request)||`/`,i=new Wi(`${`[${n}] ${JSON.stringify(r)}`}: ${e.response?`${e.response.status} ${e.response.statusText}`:`<no response>`}${t?` ${t}`:``}`,e.error?{cause:e.error}:void 0);for(let t of[`request`,`options`,`response`])Object.defineProperty(i,t,{get(){return e[t]}});for(let[t,n]of[[`data`,`_data`],[`status`,`status`],[`statusCode`,`status`],[`statusText`,`statusText`],[`statusMessage`,`statusText`]])Object.defineProperty(i,t,{get(){return e.response&&e.response[n]}});return i}let Ki=new Set(Object.freeze([`PATCH`,`POST`,`PUT`,`DELETE`]));function qi(e=`GET`){return Ki.has(e.toUpperCase())}function Ji(e){if(e===void 0)return!1;let t=typeof e;return t===`string`||t===`number`||t===`boolean`||t===null?!0:t===`object`?Array.isArray(e)?!0:e.buffer||e instanceof FormData||e instanceof URLSearchParams?!1:e.constructor&&e.constructor.name===`Object`||typeof e.toJSON==`function`:!1}let Yi=new Set([`image/svg`,`application/xml`,`application/xhtml`,`application/html`]),Xi=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;function Zi(e=``){if(!e)return`json`;let t=e.split(`;`).shift()||``;return Xi.test(t)?`json`:t===`text/event-stream`?`stream`:Yi.has(t)||t.startsWith(`text/`)?`text`:`blob`}function Qi(e,t,n,r){let i=$i(t?.headers??e?.headers,n?.headers,r),a;return(n?.query||n?.params||t?.params||t?.query)&&(a={...n?.params,...n?.query,...t?.params,...t?.query}),{...n,...t,query:a,params:a,headers:i}}function $i(e,t,n){if(!t)return new n(e);let r=new n(t);if(e)for(let[t,i]of Symbol.iterator in e||Array.isArray(e)?e:new n(e))r.set(t,i);return r}async function ea(e,t){if(t)if(Array.isArray(t))for(let n of t)await n(e);else await t(e)}let ta=new Set([408,409,425,429,500,502,503,504]),na=new Set([101,204,205,304]);function ra(e={}){let{fetch:t=globalThis.fetch,Headers:n=globalThis.Headers,AbortController:r=globalThis.AbortController}=e;async function i(e){let t=e.error&&e.error.name===`AbortError`&&!e.options.timeout||!1;if(e.options.retry!==!1&&!t){let t;t=typeof e.options.retry==`number`?e.options.retry:qi(e.options.method)?0:1;let n=e.response&&e.response.status||500;if(t>0&&(Array.isArray(e.options.retryStatusCodes)?e.options.retryStatusCodes.includes(n):ta.has(n))){let n=typeof e.options.retryDelay==`function`?e.options.retryDelay(e):e.options.retryDelay||0;return n>0&&await new Promise(e=>setTimeout(e,n)),a(e.request,{...e.options,retry:t-1})}}let n=Gi(e);throw Error.captureStackTrace&&Error.captureStackTrace(n,a),n}let a=async function(a,o={}){let s={request:a,options:Qi(a,o,e.defaults,n),response:void 0,error:void 0};if(s.options.method&&(s.options.method=s.options.method.toUpperCase()),s.options.onRequest&&(await ea(s,s.options.onRequest),s.options.headers instanceof n||(s.options.headers=new n(s.options.headers||{}))),typeof s.request==`string`&&(s.options.baseURL&&(s.request=Fi(s.request,s.options.baseURL)),s.options.query&&(s.request=Ii(s.request,s.options.query),delete s.options.query),`query`in s.options&&delete s.options.query,`params`in s.options&&delete s.options.params),s.options.body&&qi(s.options.method))if(Ji(s.options.body)){let e=s.options.headers.get(`content-type`);typeof s.options.body!=`string`&&(s.options.body=e===`application/x-www-form-urlencoded`?new URLSearchParams(s.options.body).toString():JSON.stringify(s.options.body)),e||s.options.headers.set(`content-type`,`application/json`),s.options.headers.has(`accept`)||s.options.headers.set(`accept`,`application/json`)}else (`pipeTo`in s.options.body&&typeof s.options.body.pipeTo==`function`||typeof s.options.body.pipe==`function`)&&(`duplex`in s.options||(s.options.duplex=`half`));let c;if(!s.options.signal&&s.options.timeout){let e=new r;c=setTimeout(()=>{let t=Error(`[TimeoutError]: The operation was aborted due to timeout`);t.name=`TimeoutError`,t.code=23,e.abort(t)},s.options.timeout),s.options.signal=e.signal}try{s.response=await t(s.request,s.options)}catch(e){return s.error=e,s.options.onRequestError&&await ea(s,s.options.onRequestError),await i(s)}finally{c&&clearTimeout(c)}if((s.response.body||s.response._bodyInit)&&!na.has(s.response.status)&&s.options.method!==`HEAD`){let e=(s.options.parseResponse?`json`:s.options.responseType)||Zi(s.response.headers.get(`content-type`)||``);switch(e){case`json`:{let e=await s.response.text(),t=s.options.parseResponse||si;s.response._data=t(e);break}case`stream`:s.response._data=s.response.body||s.response._bodyInit;break;default:s.response._data=await s.response[e]()}}return s.options.onResponse&&await ea(s,s.options.onResponse),!s.options.ignoreResponseError&&s.response.status>=400&&s.response.status<600?(s.options.onResponseError&&await ea(s,s.options.onResponseError),await i(s)):s.response},o=async function(e,t){return(await a(e,t))._data};return o.raw=a,o.native=(...e)=>t(...e),o.create=(t={},n={})=>ra({...e,...n,defaults:{...e.defaults,...n.defaults,...t}}),o}function ia(){if(!JSON.parse(process.env.FETCH_KEEP_ALIVE||`false`))return ti;let e={keepAlive:!0},r=new t.default.Agent(e),i=new n.default.Agent(e),a={agent(e){return e.protocol===`http:`?r:i}};return function(e,t){return ti(e,{...a,...t})}}let aa=ra({fetch:globalThis.fetch?(...e)=>globalThis.fetch(...e):ia(),Headers:globalThis.Headers||Q,AbortController:globalThis.AbortController||ni});function oa(e){let t=e,n=new Set;return{get(){return t},set(e){t=e,n.forEach(e=>e(t))},subscribe(e){return n.add(e),e(t),()=>n.delete(e)}}}function sa(e,t){return e.subscribe(t)}function ca(e){if(typeof e==`function`){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e();return}let t=document.querySelector(e);return t?new la(t):null}var la=class{constructor(e){this.element=e}element;on(e,t){return this.element.addEventListener(e,t),this}off(e,t){return this.element.removeEventListener(e,t),this}addClass(e){return this.element.classList.add(e),this}removeClass(e){return this.element.classList.remove(e),this}toggleClass(e){return this.element.classList.toggle(e),this}hidden=!1;hide(){return this.element.style.display=`none`,this.hidden=!0,this}show(){return this.element.style.display=``,this.hidden=!1,this}toggle(){return this.hidden?this.show():this.hide(),this}text(e){return e===void 0?this.element.textContent:(this.element.textContent=e,this)}attr(e,t){return t===void 0?this.element.getAttribute(e):(this.element.setAttribute(e,t),this)}val(e){return e===void 0?this.element.value:(this.element.value=e,this)}html(e){return e===void 0?this.element.innerHTML:(this.element.innerHTML=e,this)}markdown(e){this.element.innerHTML=A(e)}remove(){this.element.remove()}};return e.$=ca,e.ZinqElement=la,e.effect=sa,e.fetch=aa,e.signal=oa,e})({},node_http,node_https,node_zlib,node_stream,node_buffer,node_util,node_url,node_net,node_fs,node_path);
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{marked as e}from"marked";import{ofetch as t}from"ofetch";function n(e){let t=e,n=new Set;return{get(){return t},set(e){t=e,n.forEach(e=>e(t))},subscribe(e){return n.add(e),e(t),()=>n.delete(e)}}}function r(e,t){return e.subscribe(t)}function i(e){if(typeof e==`function`){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e();return}let t=document.querySelector(e);return t?new a(t):null}var a=class{constructor(e){this.element=e}element;on(e,t){return this.element.addEventListener(e,t),this}off(e,t){return this.element.removeEventListener(e,t),this}addClass(e){return this.element.classList.add(e),this}removeClass(e){return this.element.classList.remove(e),this}toggleClass(e){return this.element.classList.toggle(e),this}hidden=!1;hide(){return this.element.style.display=`none`,this.hidden=!0,this}show(){return this.element.style.display=``,this.hidden=!1,this}toggle(){return this.hidden?this.show():this.hide(),this}text(e){return e===void 0?this.element.textContent:(this.element.textContent=e,this)}attr(e,t){return t===void 0?this.element.getAttribute(e):(this.element.setAttribute(e,t),this)}val(e){return e===void 0?this.element.value:(this.element.value=e,this)}html(e){return e===void 0?this.element.innerHTML:(this.element.innerHTML=e,this)}markdown(t){this.element.innerHTML=e(t)}remove(){this.element.remove()}},o=class{elements;constructor(e){this.elements=e.map(e=>new a(e))}each(e){return this.elements.forEach(e),this}};function s(e){let t=[];return typeof e==`string`?t=Array.from(document.querySelectorAll(e)):e instanceof HTMLElement&&(t=[e]),new o(t)}export{i as $,o as ZinqCollection,a as ZinqElement,r as effect,t as fetch,s as multi$,n as signal};
1
+ import{marked as e}from"marked";import{ofetch as t}from"ofetch";function n(e){let t=e,n=new Set;return{get(){return t},set(e){t=e,n.forEach(e=>e(t))},subscribe(e){return n.add(e),e(t),()=>n.delete(e)}}}function r(e,t){return e.subscribe(t)}function i(e){if(typeof e==`function`){document.readyState===`loading`?document.addEventListener(`DOMContentLoaded`,e):e();return}let t=document.querySelector(e);return t?new a(t):null}var a=class{constructor(e){this.element=e}element;on(e,t){return this.element.addEventListener(e,t),this}off(e,t){return this.element.removeEventListener(e,t),this}addClass(e){return this.element.classList.add(e),this}removeClass(e){return this.element.classList.remove(e),this}toggleClass(e){return this.element.classList.toggle(e),this}hidden=!1;hide(){return this.element.style.display=`none`,this.hidden=!0,this}show(){return this.element.style.display=``,this.hidden=!1,this}toggle(){return this.hidden?this.show():this.hide(),this}text(e){return e===void 0?this.element.textContent:(this.element.textContent=e,this)}attr(e,t){return t===void 0?this.element.getAttribute(e):(this.element.setAttribute(e,t),this)}val(e){return e===void 0?this.element.value:(this.element.value=e,this)}html(e){return e===void 0?this.element.innerHTML:(this.element.innerHTML=e,this)}markdown(t){this.element.innerHTML=e(t)}remove(){this.element.remove()}};export{i as $,a as ZinqElement,r as effect,t as fetch,n as signal};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@usezinq/core",
3
3
  "type": "module",
4
- "version": "0.1.4",
4
+ "version": "0.1.5",
5
5
  "description": "ZINQ Is Not jQuery.",
6
6
  "author": "loudsynth",
7
7
  "license": "MIT",