@webqit/fetch-plus 0.1.6 → 0.1.8

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
@@ -247,14 +247,16 @@ response.port.addEventListener('message', (event) => {
247
247
 
248
248
  `LiveResponse`-based backends are easy to build. This typically involves:
249
249
 
250
- 1. Creating the server-side port and exposing it – as `request.port` for example
251
- 2. Managing request + port lifecycles via abort signals
250
+ 1. Creating the server-side port and exposing it – e.g. as `request.port`
251
+ 2. Managing request + port lifecycles via an abort signal
252
252
  3. Converting `LiveResponse` to a standard response
253
253
  4. Adding the `X-Message-Port` header to the outgoing response
254
254
 
255
- See the sample Express.js integration below for a complete example.
255
+ Depending on your use case:
256
256
 
257
- For a framework with a live-mode-first architecture, see [Webflo](https://github.com/webqit/webflo).
257
+ + See the sample Express.js integration below for a custom integration example.
258
+ + See the [`@webqit/node-live-response`](https://github.com/webqit/node-live-response) package for a direct Node.js or Express.js integration.
259
+ + See [Webflo](https://github.com/webqit/webflo) for a framework with a live-mode-first architecture.
258
260
 
259
261
  #### Sample Express.js Integration
260
262
 
package/dist/main.js CHANGED
@@ -1,2 +1,2 @@
1
- (()=>{var Pr=Object.defineProperty;var Tt=(t,e)=>()=>(t&&(e=t(t=0)),e);var Re=(t,e)=>{for(var r in e)Pr(t,r,{get:e[r],enumerable:!0})};function Dt(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function tt(t,e=!1){let r=[],n=0;for(;n<t.length;){let s=t[n],i=y(function(a){if(!e)throw new TypeError(a);r.push({type:"INVALID_CHAR",index:n,value:t[n++]})},"ErrorOrInvalid");if(s==="*"){r.push({type:"ASTERISK",index:n,value:t[n++]});continue}if(s==="+"||s==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:t[n++]});continue}if(s==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});continue}if(s==="{"){r.push({type:"OPEN",index:n,value:t[n++]});continue}if(s==="}"){r.push({type:"CLOSE",index:n,value:t[n++]});continue}if(s===":"){let a="",o=n+1;for(;o<t.length;){let u=t.substr(o,1);if(o===n+1&&jr.test(u)||o!==n+1&&Tr.test(u)){a+=t[o++];continue}break}if(!a){i(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:a}),n=o;continue}if(s==="("){let a=1,o="",u=n+1,c=!1;if(t[u]==="?"){i(`Pattern cannot start with "?" at ${u}`);continue}for(;u<t.length;){if(!Dt(t[u],!1)){i(`Invalid character '${t[u]}' at ${u}.`),c=!0;break}if(t[u]==="\\"){o+=t[u++]+t[u++];continue}if(t[u]===")"){if(a--,a===0){u++;break}}else if(t[u]==="("&&(a++,t[u+1]!=="?")){i(`Capturing groups are not allowed at ${u}`),c=!0;break}o+=t[u++]}if(c)continue;if(a){i(`Unbalanced pattern at ${n}`);continue}if(!o){i(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:o}),n=u;continue}r.push({type:"CHAR",index:n,value:t[n++]})}return r.push({type:"END",index:n,value:""}),r}function rt(t,e={}){let r=tt(t);e.delimiter??="/#?",e.prefixes??="./";let n=`[^${R(e.delimiter)}]+?`,s=[],i=0,a=0,o="",u=new Set,c=y(d=>{if(a<r.length&&r[a].type===d)return r[a++].value},"tryConsume"),f=y(()=>c("OTHER_MODIFIER")??c("ASTERISK"),"tryConsumeModifier"),l=y(d=>{let P=c(d);if(P!==void 0)return P;let{type:E,index:N}=r[a];throw new TypeError(`Unexpected ${E} at ${N}, expected ${d}`)},"mustConsume"),p=y(()=>{let d="",P;for(;P=c("CHAR")??c("ESCAPED_CHAR");)d+=P;return d},"consumeText"),m=y(d=>d,"DefaultEncodePart"),h=e.encodePart||m,g="",b=y(d=>{g+=d},"appendToPendingFixedValue"),_=y(()=>{g.length&&(s.push(new be(3,"","",h(g),"",3)),g="")},"maybeAddPartFromPendingFixedValue"),w=y((d,P,E,N,U)=>{let D=3;switch(U){case"?":D=1;break;case"*":D=0;break;case"+":D=2;break}if(!P&&!E&&D===3){b(d);return}if(_(),!P&&!E){if(!d)return;s.push(new be(3,"","",h(d),"",D));return}let T;E?E==="*"?T=Ze:T=E:T=n;let ve=2;T===n?(ve=1,T=""):T===Ze&&(ve=0,T="");let Y;if(P?Y=P:E&&(Y=i++),u.has(Y))throw new TypeError(`Duplicate name '${Y}'.`);u.add(Y),s.push(new be(ve,Y,h(d),T,h(N),D))},"addPart");for(;a<r.length;){let d=c("CHAR"),P=c("NAME"),E=c("REGEX");if(!P&&!E&&(E=c("ASTERISK")),P||E){let U=d??"";e.prefixes.indexOf(U)===-1&&(b(U),U=""),_();let D=f();w(U,P,E,"",D);continue}let N=d??c("ESCAPED_CHAR");if(N){b(N);continue}if(c("OPEN")){let U=p(),D=c("NAME"),T=c("REGEX");!D&&!T&&(T=c("ASTERISK"));let ve=p();l("CLOSE");let Y=f();w(U,D,T,ve,Y);continue}_(),l("END")}return s}function R(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function Ye(t){return t&&t.ignoreCase?"ui":"u"}function kt(t,e,r){return nt(rt(t,r),e,r)}function ne(t){switch(t){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function nt(t,e,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith="";let n=r.start?"^":"";for(let o of t){if(o.type===3){o.modifier===3?n+=R(o.value):n+=`(?:${R(o.value)})${ne(o.modifier)}`;continue}e&&e.push(o.name);let u=`[^${R(r.delimiter)}]+?`,c=o.value;if(o.type===1?c=u:o.type===0&&(c=Ze),!o.prefix.length&&!o.suffix.length){o.modifier===3||o.modifier===1?n+=`(${c})${ne(o.modifier)}`:n+=`((?:${c})${ne(o.modifier)})`;continue}if(o.modifier===3||o.modifier===1){n+=`(?:${R(o.prefix)}(${c})${R(o.suffix)})`,n+=ne(o.modifier);continue}n+=`(?:${R(o.prefix)}`,n+=`((?:${c})(?:`,n+=R(o.suffix),n+=R(o.prefix),n+=`(?:${c}))*)${R(o.suffix)})`,o.modifier===0&&(n+="?")}let s=`[${R(r.endsWith)}]|$`,i=`[${R(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${i}?`),r.endsWith.length?n+=`(?=${s})`:n+="$",new RegExp(n,Ye(r));r.strict||(n+=`(?:${i}(?=${s}))?`);let a=!1;if(t.length){let o=t[t.length-1];o.type===3&&o.modifier===3&&(a=r.delimiter.indexOf(o)>-1)}return a||(n+=`(?=${i}|${s})`),new RegExp(n,Ye(r))}function qt(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1}function st(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function Nt(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}function ot(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}function it(t){if(!t)return!0;for(let e of Ut)if(t.test(e))return!0;return!1}function Ft(t,e){if(t=st(t,"#"),e||t==="")return t;let r=new URL("https://example.com");return r.hash=t,r.hash?r.hash.substring(1,r.hash.length):""}function Ht(t,e){if(t=st(t,"?"),e||t==="")return t;let r=new URL("https://example.com");return r.search=t,r.search?r.search.substring(1,r.search.length):""}function Wt(t,e){return e||t===""?t:ot(t)?ut(t):ct(t)}function Bt(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.password=t,r.password}function zt(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.username=t,r.username}function Vt(t,e,r){if(r||t==="")return t;if(e&&!Ut.includes(e))return new URL(`${e}:${t}`).pathname;let n=t[0]=="/";return t=new URL(n?t:"/-"+t,"https://example.com").pathname,n||(t=t.substring(2,t.length)),t}function Gt(t,e,r){return at(e)===t&&(t=""),r||t===""?t:ft(t)}function Jt(t,e){return t=Nt(t,":"),e||t===""?t:Le(t)}function at(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function Le(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function Kt(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}function Xt(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}function ct(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}function ut(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function ft(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function Qt(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname}function Zt(t){return t===""?t:new URL(`data:${t}`).pathname}function Yt(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function er(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}function et(t,e){if(typeof t!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(t,e);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==""?r.search.substring(1,r.search.length):void 0,hash:r.hash!==""?r.hash.substring(1,r.hash.length):void 0}}function F(t,e){return e?we(t):t}function ye(t,e,r){let n;if(typeof e.baseURL=="string")try{n=new URL(e.baseURL),e.protocol===void 0&&(t.protocol=F(n.protocol.substring(0,n.protocol.length-1),r)),!r&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&(t.username=F(n.username,r)),!r&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&e.password===void 0&&(t.password=F(n.password,r)),e.protocol===void 0&&e.hostname===void 0&&(t.hostname=F(n.hostname,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&(t.port=F(n.port,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&(t.pathname=F(n.pathname,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&(t.search=F(n.search.substring(1,n.search.length),r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&e.hash===void 0&&(t.hash=F(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=Jt(e.protocol,r)),typeof e.username=="string"&&(t.username=zt(e.username,r)),typeof e.password=="string"&&(t.password=Bt(e.password,r)),typeof e.hostname=="string"&&(t.hostname=Wt(e.hostname,r)),typeof e.port=="string"&&(t.port=Gt(e.port,t.protocol,r)),typeof e.pathname=="string"){if(t.pathname=e.pathname,n&&!qt(t.pathname,r)){let s=n.pathname.lastIndexOf("/");s>=0&&(t.pathname=F(n.pathname.substring(0,s+1),r)+t.pathname)}t.pathname=Vt(t.pathname,t.protocol,r)}return typeof e.search=="string"&&(t.search=Ht(e.search,r)),typeof e.hash=="string"&&(t.hash=Ft(e.hash,r)),t}function we(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function rr(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function nr(t,e){e.delimiter??="/#?",e.prefixes??="./",e.sensitive??=!1,e.strict??=!1,e.end??=!0,e.start??=!0,e.endsWith="";let r=".*",n=`[^${rr(e.delimiter)}]+?`,s=/[$_\u200C\u200D\p{ID_Continue}]/u,i="";for(let a=0;a<t.length;++a){let o=t[a];if(o.type===3){if(o.modifier===3){i+=we(o.value);continue}i+=`{${we(o.value)}}${ne(o.modifier)}`;continue}let u=o.hasCustomName(),c=!!o.suffix.length||!!o.prefix.length&&(o.prefix.length!==1||!e.prefixes.includes(o.prefix)),f=a>0?t[a-1]:null,l=a<t.length-1?t[a+1]:null;if(!c&&u&&o.type===1&&o.modifier===3&&l&&!l.prefix.length&&!l.suffix.length)if(l.type===3){let p=l.value.length>0?l.value[0]:"";c=s.test(p)}else c=!l.hasCustomName();if(!c&&!o.prefix.length&&f&&f.type===3){let p=f.value[f.value.length-1];c=e.prefixes.includes(p)}c&&(i+="{"),i+=we(o.prefix),u&&(i+=`:${o.name}`),o.type===2?i+=`(${o.value})`:o.type===1?u||(i+=`(${n})`):o.type===0&&(!u&&(!f||f.type===3||f.modifier!==3||c||o.prefix!=="")?i+="*":i+=`(${r})`),o.type===1&&u&&o.suffix.length&&s.test(o.suffix[0])&&(i+="\\"),i+=we(o.suffix),c&&(i+="}"),o.modifier!==3&&(i+=ne(o.modifier))}return i}var Rr,y,be,jr,Tr,Ze,te,Ir,Lr,Ut,tr,Qe,ee,De,sr=Tt(()=>{Rr=Object.defineProperty,y=(t,e)=>Rr(t,"name",{value:e,configurable:!0}),be=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,e,r,n,s,i){this.type=t,this.name=e,this.prefix=r,this.value=n,this.suffix=s,this.modifier=i}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};y(be,"Part");jr=/[$_\p{ID_Start}]/u,Tr=/[$_\u200C\u200D\p{ID_Continue}]/u,Ze=".*";y(Dt,"isASCII");y(tt,"lexer");y(rt,"parse");y(R,"escapeString");y(Ye,"flags");y(kt,"stringToRegexp");y(ne,"modifierToString");y(nt,"partsToRegexp");te={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ir={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Lr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};y(qt,"isAbsolutePathname");y(st,"maybeStripPrefix");y(Nt,"maybeStripSuffix");y(ot,"treatAsIPv6Hostname");Ut=["ftp","file","http","https","ws","wss"];y(it,"isSpecialScheme");y(Ft,"canonicalizeHash");y(Ht,"canonicalizeSearch");y(Wt,"canonicalizeHostname");y(Bt,"canonicalizePassword");y(zt,"canonicalizeUsername");y(Vt,"canonicalizePathname");y(Gt,"canonicalizePort");y(Jt,"canonicalizeProtocol");y(at,"defaultPortForProtocol");y(Le,"protocolEncodeCallback");y(Kt,"usernameEncodeCallback");y(Xt,"passwordEncodeCallback");y(ct,"hostnameEncodeCallback");y(ut,"ipv6HostnameEncodeCallback");y(ft,"portEncodeCallback");y(Qt,"standardURLPathnameEncodeCallback");y(Zt,"pathURLPathnameEncodeCallback");y(Yt,"searchEncodeCallback");y(er,"hashEncodeCallback");tr=class{#n;#t=[];#r={};#e=0;#o=1;#a=0;#i=0;#u=0;#h=0;#c=!1;constructor(t){this.#n=t}get result(){return this.#r}parse(){for(this.#t=tt(this.#n,!0);this.#e<this.#t.length;this.#e+=this.#o){if(this.#o=1,this.#t[this.#e].type==="END"){if(this.#i===0){this.#g(),this.#m()?this.#s(9,1):this.#y()?this.#s(8,1):this.#s(7,0);continue}else if(this.#i===2){this.#f(5);continue}this.#s(10,0);break}if(this.#u>0)if(this.#O())this.#u-=1;else continue;if(this.#S()){this.#u+=1;continue}switch(this.#i){case 0:this.#_()&&this.#f(1);break;case 1:if(this.#_()){this.#M();let t=7,e=1;this.#v()?(t=2,e=3):this.#c&&(t=2),this.#s(t,e)}break;case 2:this.#b()?this.#f(3):(this.#x()||this.#y()||this.#m())&&this.#f(5);break;case 3:this.#P()?this.#s(4,1):this.#b()&&this.#s(5,1);break;case 4:this.#b()&&this.#s(5,1);break;case 5:this.#A()?this.#h+=1:this.#C()&&(this.#h-=1),this.#E()&&!this.#h?this.#s(6,1):this.#x()?this.#s(7,0):this.#y()?this.#s(8,1):this.#m()&&this.#s(9,1);break;case 6:this.#x()?this.#s(7,0):this.#y()?this.#s(8,1):this.#m()&&this.#s(9,1);break;case 7:this.#y()?this.#s(8,1):this.#m()&&this.#s(9,1);break;case 8:this.#m()&&this.#s(9,1);break;case 9:break;case 10:break}}this.#r.hostname!==void 0&&this.#r.port===void 0&&(this.#r.port="")}#s(t,e){switch(this.#i){case 0:break;case 1:this.#r.protocol=this.#p();break;case 2:break;case 3:this.#r.username=this.#p();break;case 4:this.#r.password=this.#p();break;case 5:this.#r.hostname=this.#p();break;case 6:this.#r.port=this.#p();break;case 7:this.#r.pathname=this.#p();break;case 8:this.#r.search=this.#p();break;case 9:this.#r.hash=this.#p();break;case 10:break}this.#i!==0&&t!==10&&([1,2,3,4].includes(this.#i)&&[6,7,8,9].includes(t)&&(this.#r.hostname??=""),[1,2,3,4,5,6].includes(this.#i)&&[8,9].includes(t)&&(this.#r.pathname??=this.#c?"/":""),[1,2,3,4,5,6,7].includes(this.#i)&&t===9&&(this.#r.search??="")),this.#d(t,e)}#d(t,e){this.#i=t,this.#a=this.#e+e,this.#e+=e,this.#o=0}#g(){this.#e=this.#a,this.#o=0}#f(t){this.#g(),this.#i=t}#w(t){return t<0&&(t=this.#t.length-t),t<this.#t.length?this.#t[t]:this.#t[this.#t.length-1]}#l(t,e){let r=this.#w(t);return r.value===e&&(r.type==="CHAR"||r.type==="ESCAPED_CHAR"||r.type==="INVALID_CHAR")}#_(){return this.#l(this.#e,":")}#v(){return this.#l(this.#e+1,"/")&&this.#l(this.#e+2,"/")}#b(){return this.#l(this.#e,"@")}#P(){return this.#l(this.#e,":")}#E(){return this.#l(this.#e,":")}#x(){return this.#l(this.#e,"/")}#y(){if(this.#l(this.#e,"?"))return!0;if(this.#t[this.#e].value!=="?")return!1;let t=this.#w(this.#e-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}#m(){return this.#l(this.#e,"#")}#S(){return this.#t[this.#e].type=="OPEN"}#O(){return this.#t[this.#e].type=="CLOSE"}#A(){return this.#l(this.#e,"[")}#C(){return this.#l(this.#e,"]")}#p(){let t=this.#t[this.#e],e=this.#w(this.#a).index;return this.#n.substring(e,t.index)}#M(){let t={};Object.assign(t,te),t.encodePart=Le;let e=kt(this.#p(),void 0,t);this.#c=it(e)}};y(tr,"Parser");Qe=["protocol","username","password","hostname","port","pathname","search","hash"],ee="*";y(et,"extractValues");y(F,"processBaseURLString");y(ye,"applyInit");y(we,"escapePatternString");y(rr,"escapeRegexpString");y(nr,"partsToPattern");De=class{#n;#t={};#r={};#e={};#o={};#a=!1;constructor(t={},e,r){try{let n;if(typeof e=="string"?n=e:r=e,typeof t=="string"){let o=new tr(t);if(o.parse(),t=o.result,n===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=n}else{if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(n)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let s={ignoreCase:r.ignoreCase===!0},i={pathname:ee,protocol:ee,username:ee,password:ee,hostname:ee,port:ee,search:ee,hash:ee};this.#n=ye(i,t,!0),at(this.#n.protocol)===this.#n.port&&(this.#n.port="");let a;for(a of Qe){if(!(a in this.#n))continue;let o={},u=this.#n[a];switch(this.#r[a]=[],a){case"protocol":Object.assign(o,te),o.encodePart=Le;break;case"username":Object.assign(o,te),o.encodePart=Kt;break;case"password":Object.assign(o,te),o.encodePart=Xt;break;case"hostname":Object.assign(o,Ir),ot(u)?o.encodePart=ut:o.encodePart=ct;break;case"port":Object.assign(o,te),o.encodePart=ft;break;case"pathname":it(this.#t.protocol)?(Object.assign(o,Lr,s),o.encodePart=Qt):(Object.assign(o,te,s),o.encodePart=Zt);break;case"search":Object.assign(o,te,s),o.encodePart=Yt;break;case"hash":Object.assign(o,te,s),o.encodePart=er;break}try{this.#o[a]=rt(u,o),this.#t[a]=nt(this.#o[a],this.#r[a],o),this.#e[a]=nr(this.#o[a],o),this.#a=this.#a||this.#o[a].some(c=>c.type===2)}catch{throw new TypeError(`invalid ${a} pattern '${this.#n[a]}'.`)}}}catch(n){throw new TypeError(`Failed to construct 'URLPattern': ${n.message}`)}}get[Symbol.toStringTag](){return"URLPattern"}test(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{typeof t=="object"?r=ye(r,t,!1):r=ye(r,et(t,e),!1)}catch{return!1}let n;for(n of Qe)if(!this.#t[n].exec(r[n]))return!1;return!0}exec(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?r=ye(r,t,!1):r=ye(r,et(t,e),!1)}catch{return null}let n={};e?n.inputs=[t,e]:n.inputs=[t];let s;for(s of Qe){let i=this.#t[s].exec(r[s]);if(!i)return null;let a={};for(let[o,u]of this.#r[s].entries())if(typeof u=="string"||typeof u=="number"){let c=i[o+1];a[u]=c}n[s]={input:r[s]??"",groups:a}}return n}static compareComponent(t,e,r){let n=y((o,u)=>{for(let c of["type","modifier","prefix","value","suffix"]){if(o[c]<u[c])return-1;if(o[c]!==u[c])return 1}return 0},"comparePart"),s=new be(3,"","","","",3),i=new be(0,"","","","",3),a=y((o,u)=>{let c=0;for(;c<Math.min(o.length,u.length);++c){let f=n(o[c],u[c]);if(f)return f}return o.length===u.length?0:n(o[c]??s,u[c]??s)},"comparePartList");return!e.#e[t]&&!r.#e[t]?0:e.#e[t]&&!r.#e[t]?a(e.#o[t],[i]):!e.#e[t]&&r.#e[t]?a([i],r.#o[t]):a(e.#o[t],r.#o[t])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#a}};y(De,"URLPattern")});var or={};Re(or,{URLPattern:()=>De});var ir=Tt(()=>{sr();globalThis.URLPattern||(globalThis.URLPattern=De)});var jt={};Re(jt,{FormDataPlus:()=>B,HeadersPlus:()=>z,LiveResponse:()=>ze,Observer:()=>lr,RequestPlus:()=>He,ResponsePlus:()=>V,fetchPlus:()=>gr});function v(t){return!Array.isArray(t)&&typeof t=="object"&&t}function pe(t){return typeof t}function I(t){return Array.isArray(t)}function je(t){return t===!0||t===!1}function de(t){return typeof t=="function"}function Ve(t){return t===null||t===""}function re(t){return arguments.length&&(t===void 0||typeof t>"u")}function x(t){return Array.isArray(t)||typeof t=="object"&&t||de(t)}function Ge(t){return Ve(t)||re(t)||t===!1||t===0||x(t)&&!Object.keys(t).length}function G(t){return de(t)||t&&{}.toString.call(t)==="[object function]"}function me(t){return t instanceof Number||typeof t=="number"}function J(t){return me(t)||t!==!0&&t!==!1&&t!==null&&t!==""&&!isNaN(t*1)}function Je(t){return I(t)&&Object.getPrototypeOf(t)===Array.prototype}function Ke(t){return v(t)&&Object.getPrototypeOf(t)===Object.prototype}function K(t){return t instanceof String||typeof t=="string"&&t!==null}function Xe(t){return!K(t)&&!re(t.length)}function k(t,...e){if(!t||!["object","function"].includes(typeof t))throw new Error("Argument #1 must be of type object");let r=t[Symbol.for("wq")];if(r||(r=new Te,Object.defineProperty(t,Symbol.for("wq"),{value:r,enumerable:!1,configurable:!1,writable:!1})),!e.length)return r;let n,s;for(;n=e.shift();)(s=r)&&!(r=r.get(n))&&(r=new Te,s.set(n,r));return r}var Te=class extends Map{};function ge(t,e,r=!1){if(e=="")return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?"":t.substr(n+e.length)}function Ie(t,e,r=!1){if(e=="")return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?t:t.substr(0,n)}(async()=>typeof URLPattern>"u"&&await Promise.resolve().then(()=>(ir(),or)))();var lt=class extends URLPattern{#n;constructor(e,r=null){typeof e=="object"&&e?.baseURL&&({baseURL:r,...e}=e),super(e,r),this.#n=new URL(e,r)}isPattern(){let e=(s,i)=>{if(!s)return!1;let a=!1;for(let o of s){if(a){a=!1;continue}if(o==="\\"){a=!0;continue}if(i.has(o))return!0}return!1},r={protocol:new Set(["*"]),username:new Set(["*"]),password:new Set(["*"]),hostname:new Set(["*","{"]),port:new Set(["*","{"]),pathname:new Set(["*",":","{","("]),search:new Set(["*","{"]),hash:new Set(["*","{"])},n=this.#n;return e(n.protocol,r.protocol)||e(n.username,r.username)||e(n.password,r.password)||e(n.hostname,r.hostname)||e(n.port,r.port)||e(n.pathname,r.pathname)||e(n.search,r.search)||e(n.hash,r.hash)}exec(...e){let r=super.exec(...e);if(!r)return;let n={};for(let a of Object.values(r))a?.groups&&Object.assign(n,a.groups);let s={named:n};return{...r,vars:s,render:a=>a.replace(/\$(\$|[A-Z0-9_]+)/gi,(o,u)=>u==="$"?"$":s.named[u]??"")}}};var Ot={};Re(Ot,{any:()=>Kr,apply:()=>xt,batch:()=>St,construct:()=>bt,defineProperties:()=>Yr,defineProperty:()=>Oe,deleteProperties:()=>en,deleteProperty:()=>Ae,get:()=>Q,getOwnPropertyDescriptor:()=>qe,getOwnPropertyDescriptors:()=>Qr,getPrototypeOf:()=>gt,has:()=>Ne,intercept:()=>Xr,isExtensible:()=>yt,map:()=>Zr,observe:()=>Et,ownKeys:()=>wt,path:()=>Gr,preventExtensions:()=>vt,reduce:()=>Pt,set:()=>ie,setPrototypeOf:()=>_t,subtree:()=>Jr});function H(t,e=!0){return I(t)?t:!e&&v(t)?[t]:t!==!1&&t!==0&&Ge(t)?[]:Xe(t)?Array.prototype.slice.call(t):v(t)?Object.values(t):[t]}var O=(t,...e)=>k(t,"observerAPI",...e),xe=(t,e)=>t instanceof Promise?t.then(e):e(t),ke={};var se=class{constructor(e,r){this.registry=e,Object.assign(this,{...r,target:e.target}),this.params.signal&&this.params.signal.addEventListener("abort",()=>this.remove())}remove(){return this.removed=!0,this.registry.removeRegistration(this)}};var Pe=class extends se{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),ke.setMaxListeners?.(0,this.signal)}remove(){this.abortController.abort(),super.remove()}fire(e){if(this.emit.recursionTarget&&!["inject","force-async","force-sync"].includes(this.params.recursions))return;let r=e,n=this.filter;if(n!==1/0&&(n=H(n,!1))&&(r=e.filter(i=>n.includes(i.key))),this.params.diff&&(r=r.filter(i=>i.type!=="set"||i.value!==i.oldValue)),!r.length)return;if(["inject","defer"].includes(this.params.recursions)){if(this.emit.recursionTarget){this.emit.recursionTarget.push(...r);return}this.emit.recursionTarget=this.params.recursions==="inject"?r:[]}let s=this.filter===1/0||Array.isArray(this.filter)?this.emit(r,this):this.emit(r[0],this);return xe(s,i=>{let a=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&a?.length?this.emit.currentRegistration.fire(a):i})}};var oe=class{constructor(e){this.target=e,this.entries=[]}addRegistration(e){return this.entries.push(e),e}removeRegistration(e){this.entries=this.entries.filter(r=>r!==e)}static _getInstance(e,r,n=!0,s=this.__namespace){if(!x(r))throw new Error(`Subject must be of type object; "${pe(r)}" given!`);let i=this;return s&&O(globalThis,"observerAPI","namespaces").has(e+"-"+s)&&(i=O(globalThis,"observerAPI","namespaces").get(e+"-"+s),e+="-"+s),!O(r,"registry").has(e)&&n&&O(r,"registry").set(e,new i(r)),O(r,"registry").get(e)}static _namespace(e,r,n=null){if(e+="-"+r,arguments.length===2)return O(globalThis,"observerAPI","namespaces").get(e);if(!(n.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${r} must be a subclass of ${this.name}.`);O(globalThis,"observerAPI","namespaces").set(e,n),n.__namespace=r}};var A=class{constructor(e,r){if(this.target=e,!r.operation)throw new Error("Descriptor operation must be given in definition!");Object.assign(this,r)}};var L=class extends oe{static getInstance(e,r=!0,n=null){return super._getInstance("listeners",...arguments)}static namespace(e,r=null){return super._namespace("listeners",...arguments)}constructor(e){super(e),this.batches=[]}addRegistration(e,r,n){return super.addRegistration(new Pe(this,{filter:e,emit:r,params:n}))}emit(e,{eventsArePropertyDescriptors:r=!1,eventIsArrayMethodDescriptor:n=!1}={}){if(this.batches.length){let s=this.batches[0].params.arrayMethodName;this.batches[0].snapshots.push({events:[...e],arrayMethodName:s,eventsArePropertyDescriptors:r,eventIsArrayMethodDescriptor:n});return}this.$emit(this.entries,[{events:e,eventsArePropertyDescriptors:r,eventIsArrayMethodDescriptor:n}])}$emit(e,r){let n=0,s=0,i=0;for(let f of e)n+=1,f.params.withPropertyDescriptors&&(s+=1),f.params.withArrayMethodDescriptors&&(i+=1);let a=[],o=[],u=[],c=[];for(let f of r){let l=f.arrayMethodName,p=f.eventsArePropertyDescriptors,m=f.eventIsArrayMethodDescriptor;for(let h of f.events)if(l&&(h.operation=l),s&&(i&&a.push(h),m||i!==n&&o.push(h)),s!==n){let g=h;if(p){let{target:b,type:_,...w}=h;g=new A(b,{type:"set",...w}),Object.defineProperty(g,"value","get"in w.value?{get:()=>w.value.get()}:{value:w.value.value}),w.oldValue&&Object.defineProperty(g,"oldValue","get"in w.oldValue?{get:()=>w.oldValue.get()}:{value:w.oldValue.value})}i&&u.push(g),m||i!==n&&c.push(g)}}for(let f of e)f.params.withPropertyDescriptors?f.params.withArrayMethodDescriptors?a.length&&f.fire(a):o.length&&f.fire(o):f.params.withArrayMethodDescriptors?u.length&&f.fire(u):c.length&&f.fire(c)}batch(e,r={}){this.batches.unshift({entries:[...this.entries],snapshots:[],params:r});let n=e();return xe(n,s=>{let i=this.batches.shift();return i.snapshots.length&&this.$emit(i.entries,i.snapshots),s})}};var Ee=class extends se{exec(e,r,n){return this.running||!this.traps[e.operation]?r(...Array.prototype.slice.call(arguments,2)):(this.running=!0,this.traps[e.operation](e,n,(...s)=>(this.running=!1,r(...s))))}};var X=class extends oe{static getInstance(e,r=!0,n=null){return super._getInstance("traps",...arguments)}static namespace(e,r=null){return super._namespace("traps",...arguments)}addRegistration(e){return super.addRegistration(new Ee(this,e))}emit(e,r=null){let n=this;return function s(i,...a){let o=n.entries[i];return o?o.exec(e,(...u)=>s(i+1,...u),...a):r?r(e,...a):a[0]}(0)}};var mt={};Re(mt,{accessorize:()=>zr,proxy:()=>pt,unaccessorize:()=>Vr,unproxy:()=>Se});var ur=Symbol("wqOriginal");function zr(t,e,r={}){t=dt(t);let n=O(t,"accessorizedProps");function s(u){let c,f=t;do c=Object.getOwnPropertyDescriptor(f,u);while(!c&&(f=Object.getPrototypeOf(f)));return c?{proto:f,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function i(u){if(n.has(u+""))return!0;let c=s(u);c.getValue=function(p=!1){return p?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(p,m=!1){if(this.dirty=!0,m){this.descriptor=p;return}return this.descriptor.set?this.descriptor.set(p)!==!1:(this.descriptor.value=p,!0)},c.intact=function(){let p=Object.getOwnPropertyDescriptor(t,u);return p?.get===l.get&&p?.set===l.set&&n.get(u+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==t||!this.proto&&!this.dirty?delete t[u]:Object.defineProperty(t,u,this.descriptor),n.delete(u+""),!0):!1},n.set(isNaN(u)?u:parseInt(u),c);let{enumerable:f=!0}=c.descriptor,l={enumerable:f,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(l.set=function(p){return ie(this,u,p,r)}),("value"in c.descriptor||c.descriptor.get)&&(l.get=function(){return Q(this,u,r)});try{return Object.defineProperty(t,u,l),!0}catch{return n.delete(u+""),!1}}let o=(Array.isArray(e)?e:e===void 0?Object.keys(t):[e]).map(i);return e===void 0||Array.isArray(e)?o:o[0]}function Vr(t,e,r={}){t=dt(t);let n=O(t,"accessorizedProps");function s(o){return n.has(o+"")?n.get(o+"").restore():!0}let a=(Array.isArray(e)?e:e===void 0?Object.keys(t):[e]).map(s);return e===void 0||Array.isArray(e)?a:a[0]}function pt(t,e={},r=void 0){let n=dt(t);if(typeof e.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(e.membrane&&O(n,"membraneRef").has(e.membrane))return O(n,"membraneRef").get(e.membrane);let s={apply:(o,u,c)=>xt(o,u,c,void 0,e),construct:(o,u,c=null)=>bt(o,u,c,e),defineProperty:(o,u,c)=>Oe(o,u,c,e),deleteProperty:(o,u)=>Ae(o,u,e),get:(o,u,c=null)=>{if(u===ur)return n;let f={...e,receiver:c},l=Q(o,u,f);return Array.isArray(o)&&typeof l=="function"&&!/^class\s?/.test(Function.prototype.toString.call(l))?pt(l,{...e,arrayMethodName:u,membrane:c},r):e.chainable&&x(l)&&u!=="prototype"&&!(typeof l=="function"&&/^class\s?|\{\s\[native\scode\]\s\}$/.test(Function.prototype.toString.call(l)))?pt(l,e,r):l},getOwnPropertyDescriptor:(o,u)=>qe(o,u,e),getPrototypeOf:o=>gt(o,e),has:(o,u)=>Ne(o,u,e),isExtensible:o=>yt(o,e),ownKeys:o=>wt(o,e),preventExtensions:o=>vt(o,e),set:(o,u,c,f=null)=>ie(o,u,c,{...e,receiver:f}),setPrototypeOf:(o,u)=>_t(o,u,e)},i=r?.(s)||s,a=new Proxy(n,i);return e.membrane&&O(n,"membraneRef").set(e.membrane,a),a}function Se(t){return t&&t[ur]||t}function dt(t){if(!t||!x(t))throw new Error("Target must be of type object!");return Se(t)}var Ce=class extends Array{};function Gr(...t){return new Ce(...t)}var ae=class extends Array{};function Jr(){return new ae}function Kr(){return 1/0}function Pt(t,e,r,n=i=>i,s={}){let i=e instanceof ae;if(!(!i&&!e?.length))return function a(o,u,c,f){let l=f||u[c.level]instanceof ae,p=l?1/0:u[c.level],m=l?!1:c.level===u.length-1;return o instanceof A&&o.operation!=="get"?c={...c,probe:"always"}:c.probe!=="always"&&(c={...c,probe:!m}),r(o,p,(h,...g)=>{let b=d=>{d instanceof A&&(d.path="key"in d?[d.key]:[],o instanceof A&&(d.path="key"in d?o.path.concat(d.key):o.path.slice(0),Object.defineProperty(d,"context",{get:()=>o,configurable:!0})))},_=g[0]||{},w=d=>{if(d instanceof A&&"argumentsList"in d)return;let P=W(d,!1);return xe(P,E=>(d instanceof A?d.value=E:d=E,a(d,u,{...c,..._,keyInParent:d.key,level:c.level+1},l)))};if(Me(p)&&Array.isArray(h)){if(h.forEach(b),m)return n(h,...g);l&&h[0]instanceof A&&(h[0].operation!=="get"||s.asGet)&&n(h,...g);for(let d of h)w(d);return}return b(h),m?n(h,...g):w(h)},c)}(t,e.slice(0),{...s,level:0},i)}function Et(t,e,r,n={}){let s=W(t,!n.level);if(G(arguments[1])&&([,r,n={}]=arguments,e=1/0),!G(r))throw new Error(`Handler must be a function; "${pe(r)}" given!`);if(e instanceof Ce||e instanceof ae)return Pt(s,e,Et,r,n);if(n={...n,descripted:!0},delete n.live,!x(s))return n.probe&&Q(s,e,r,n)||void 0;let i=fr(s,e,r,n);return n.probe?Q(s,e,i,n):i()}function Xr(t,e,r={}){let n=W(t);return v(e)||([,,,r={}]=arguments,e={[arguments[1]]:arguments[2]}),X.getInstance(n,!0,r.namespace).addRegistration({traps:e,params:r})}function qe(t,e,r=s=>s,n={}){return q(t,"getOwnPropertyDescriptor",{key:e},r,n)}function Qr(t,e,r=s=>s,n={}){return q(t,"getOwnPropertyDescriptors",{key:e},r,n)}function gt(t,e=n=>n,r={}){return q(t,"getPrototypeOf",{},e,r)}function yt(t,e=n=>n,r={}){return q(t,"isExtensible",{},e,r)}function wt(t,e=n=>n,r={}){return q(t,"ownKeys",{},e,r)}function Ne(t,e,r=s=>s,n={}){return q(t,"has",{key:e},r,n)}function Q(t,e,r=s=>s,n={}){let s,i=W(t,!n.level);return v(r)?[n,r]=[r,a=>a]:n.live&&(s=!0),e instanceof Ce||e instanceof ae?Pt(i,e,Q,r,{...n,asGet:!0}):tn(i,e,a=>{let o=[...a];return function u(c,f,l){if(!f.length)return l(c);let p=f.shift();if(!["string","number","symbol"].includes(typeof p))throw new Error(`Property name/key ${p} invalid.`);function m(b,_=void 0){let w=E=>(b.value=E,u([...c,n.live||n.descripted?b:E],f,l));if(arguments.length>1)return w(_);if(!x(i))return w(i?.[b.key]);let d=O(i,"accessorizedProps",!1),P=d&&d.get(b.key);if(P&&P.intact())return w(P.getValue(n.withPropertyDescriptors));if(n.withPropertyDescriptors){let E=Object.getOwnPropertyDescriptor(i,b.key);return w(E)}return w(Reflect.get(i,b.key))}let h=new A(i,{type:"get",key:p,value:void 0,operation:"get",related:o});if(!x(i))return m(h);let g=X.getInstance(i,!1,n.namespace);return g?g.emit(h,m):m(h)}([],a.slice(0),u=>{let c=Me(e)?u:u[0];return s&&x(i)?fr(i,e,r,n,t.key)(c):r(c)})},n)}function St(t,e,r={}){let n=W(t);return L.getInstance(n,!0,r.namespace).batch(e,r)}function Zr(t,e,r={}){e=W(e),t=W(t);let n=(r.only||[]).slice(0),s=(r.except||[]).slice(0),i=Object.keys(r.spread?[...t]:t).map(c=>isNaN(c)?c:parseInt(c)),a=n.length?n.filter(c=>i.includes(c)):i.filter(c=>!s.includes(c)),o=c=>!Array.isArray(e)||isNaN(c)?c:c-s.filter(f=>f<c).length,u=c=>{let f=qe(t,c,r);"value"in f&&f.writable&&f.enumerable&&f.configurable?ie(e,o(c),f.value,r):(f.enumerable||r.onlyEnumerable===!1)&&Oe(e,c,{...f,configurable:!0},r)};return St(e,()=>{a.forEach(u)}),Et(t,c=>{c.filter(f=>n.length?n.includes(f.key):!s.includes(f.key)).forEach(f=>{if(f.type==="delete")return Ae(e,o(f.key),r);if(f.type==="def"){(f.value.enumerable||r.onlyEnumerable===!1)&&Oe(e,o(f.key),{...f.value,configurable:!0},r);return}u(f.key)})},{...r,withPropertyDescriptors:!0})}function ie(t,e,r,n=a=>a,s={},i=!1){let a=W(t),o=[[e,r]];v(e)&&([,,n=c=>c,s={},i=!1]=arguments,o=Object.entries(e)),v(n)&&([i,s,n]=[typeof s=="boolean"?s:i,n,c=>c]);let u=o.map(([c])=>c);return function c(f,l,p){if(!l.length)return p(f);let[m,h]=l.shift();function g(_,w=void 0){let d=N=>(_.status=N,c(f.concat(_),l,p));if(arguments.length>1)return d(_,w);let P=O(a,"accessorizedProps",!1),E=P&&P.get(_.key);return _.type==="def"?(E&&!E.restore()&&d(!1),Object.defineProperty(a,_.key,_.value),d(!0)):E&&E.intact()?d(E.setValue(_.value)):d(Reflect.set(a,_.key,_.value))}function b(_,w){if(s.diff&&h===w)return c(f,l,p);let d=new A(a,{type:i?"def":"set",key:m,value:h,isUpdate:_,oldValue:w,related:[...u],operation:i?"defineProperty":"set",detail:s.detail}),P=X.getInstance(a,!1,s.namespace);return P?P.emit(d,g):g(d)}return Ne(a,m,_=>{if(!_)return b(_);if(m==="length"&&Array.isArray(a)&&O(a).has("$length"))return b(!0,O(a).get("$length"));let w={...s,withPropertyDescriptors:i};return Q(a,m,d=>b(_,d),w)},s)}([],o.slice(0),c=>{let f=L.getInstance(a,!1,s.namespace);return f&&f.emit(c,{eventsArePropertyDescriptors:!!i}),n(Me(e)?c.map(l=>l.status):c[0]?.status)})}function Oe(t,e,r,n=i=>i,s={}){return ie(t,e,r,n,s,!0)}function Yr(t,e,r=s=>s,n={}){return ie(t,e,r,n,!0)}function Ae(t,e,r=s=>s,n={}){let s=W(t);v(r)&&([n,r]=[r,o=>o]);let i=H(e,!1),a=[...i];return function o(u,c,f){if(!c.length)return f(u);let l=c.shift();function p(h,g=void 0){let b=d=>(h.status=d,o(u.concat(h),c,f));if(arguments.length>1)return b(h,g);let _=O(s,"accessorizedProps",!1),w=_&&_.get(h.key);return w&&!w.restore()&&b(!1),b(Reflect.deleteProperty(s,h.key))}function m(h){let g=new A(s,{type:"delete",key:l,oldValue:h,related:[...a],operation:"deleteProperty",detail:n.detail}),b=X.getInstance(s,!1,n.namespace);return b?b.emit(g,p):p(g)}return Q(s,l,m,n)}([],i.slice(0),o=>{let u=L.getInstance(s,!1,n.namespace);return u&&u.emit(o),r(Me(e)?o.map(c=>c.status):o[0].status)})}function en(t,e,r=s=>s,n={}){return Ae(...arguments)}function bt(t,e,r=null,n=i=>i,s={}){return q(t,"construct",arguments.length>2?{argumentsList:e,newTarget:r}:{argumentsList:e},n,s)}function xt(t,e,r,n=i=>i,s={}){let i=Se(e),a;if(Array.isArray(e)){if(s.arrayMethodName){let o=new A(i,{operation:s.arrayMethodName,argumentsList:r});L.getInstance(i,!1,s.namespace)?.emit([o],{eventIsArrayMethodDescriptor:!0})}O(i).set("$length",i.length),a=St(i,()=>q(t,"apply",{thisArgument:e,argumentsList:r},n,s),s),O(i).delete("$length")}else a=q(t,"apply",{thisArgument:i,argumentsList:r},n,s);return a}function _t(t,e,r=s=>s,n={}){return q(t,"setPrototypeOf",{proto:e},r,n)}function vt(t,e=n=>n,r={}){return q(t,"preventExtensions",{},e,r)}function fr(t,e,r,n={}){let s=new AbortController;ke.setMaxListeners?.(0,s.signal),n.signal&&n.signal.addEventListener("abort",()=>s.abort());let i={...n,signal:s.signal},a=L.getInstance(t,!0,i.namespace),o=new Map;return function u(c=[],f=null){let l,p,m;if(Me(e)){if(f){m=!0,p=f;for(let h of c)o.get(h.key)?.remove(),o.delete(h.key)}else p=a.addRegistration(e,u,i);l={signal:p.signal,childRegistrations:o}}else f?.remove(),p=a.addRegistration(e,u,i),l={signal:p.signal};if(i.childRegistrations&&i.keyInParent&&i.childRegistrations.set(i.keyInParent,p),arguments.length){let h=r(c,l);if(arguments.length>1)return h}return s}}function q(t,e,r={},n=i=>i,s={}){t=W(t),v(n)&&([s,n]=[n,u=>u]);function i(u,c){return arguments.length>1?n(c):n((Reflect[e]||Object[e])(t,...Object.values(r)))}let a=new A(t,{operation:e,...r}),o=X.getInstance(t,!1,s.namespace);return o?o.emit(a,i):i(a)}function Me(t){return t===1/0||Array.isArray(t)}function W(t,e=!0,r=!0){if((!t||!x(t))&&e)throw new Error(`Object must be of type object or array! "${pe(t)}" given.`);return t instanceof A&&(t.type==="def"&&r?t=typeof t.value.get=="function"?t.value.get():t.value.value:t=t.value),t&&Se(t)}function tn(t,e,r,n={}){return e===1/0?n.level&&!x(t)?r([]):r(Object.entries(Object.getOwnPropertyDescriptors(t)).filter(([,s])=>s.writable!==!1&&!s.get&&!s.set).map(([s])=>s)):r(H(e,!1))}var S={...Ot,...mt},lr=S;var ce=class t extends URLSearchParams{#n;#t;get compatMode(){return this.#t}#r=new Set;#e;#o=!1;#a;_changeCallbackGC;constructor(e={},{compatMode:r=!0,prettyPrint:n=!1,changeCallback:s=null}={}){super(),this.#t=r,this.#e=n;let i;e instanceof t?(i=structuredClone(e.json()),r&&(this.#r=new Set(e.keys()))):e instanceof URLSearchParams||e instanceof FormData?(i=Object.fromEntries(e),r&&(this.#r=new Set(e.keys()))):K(e)?(e=decodeURIComponent(e.replace(/^\?/,"")),i=this.constructor.parse(e,!r),r&&(this.#r=new Set(e.split("&").map(a=>a.split("=")[0])))):Array.isArray(e)?(i=this.constructor.fromEntries(e),r&&(this.#r=new Set(e.map(([a])=>a)))):v(e)?(i=e,r&&this.constructor.reduceValue(e,"",(a,o,u)=>{if(u)return u;/\[\d+\]$/.test(o)&&([,o]=/^(.*)\[\d+\]$/.exec(o)),this.#r.add(o)})):i={},this._changeCallback=s,this._resetJson(i)}_resetJson(e){this.#n=S.proxy(e),this.#a&&(this._changeCallbackGC?.abort(),this._changeCallbackGC=S.observe(this.#n,S.subtree(),this.#a))}get(e){let r=this.#i(e);return this.#t&&Array.isArray(r)?r[0]:r}#i(e,r=!1){if(this.#t&&!this.#r.has(e))return null;let n=this.constructor.get(this.#n,e,r);return n===void 0?null:Array.isArray(n)?this.#t?n.map(s=>typeof s=="number"?s+"":s):n.map(s=>v(s)?new t(s,{compatMode:this.#t}):s):!this.#t&&v(n)?new t(n,{compatMode:this.#t}):this.#t&&typeof n=="number"?n+"":n}getAll(e){let r=this.#i(e,!0);return r===null?[]:Array.isArray(r)?r:[r]}set(e,r){return this.#t&&this.#r.add(e),this.constructor.set(this.#n,e,r),this}append(e,r){return this.#t&&this.#r.add(e),this.constructor.set(this.#n,e,r,!0),this}has(e){return this.#t&&!this.#r.has(e)?!1:this.constructor.get(this.#n,e)!==void 0}delete(e){if(this.#t&&!this.#r.has(e))return;let r=this.constructor.parsePath(e),n=r.pop(),s=r.length?this.constructor.get(this.#n,r):this.#n;v(s)&&S.deleteProperty(s,n)}sort(){return this.#o=!0,this}json(){return S.unproxy(this.#n)}stringify({prettyPrint:e=this.#e}={}){return this.constructor.stringify(this.#n,{only:this.#t&&this.#r,sorted:this.#o,prettyPrint:e})}toString(){return this.stringify()}entries(){let e=[];return this.constructor.reduceValue(this.#n,"",(r,n,s)=>{if(s)return s;if(this.#t&&!this.#r.has(n))if(/\[\d+\]$/.test(n)){if([,n]=/^(.*)\[\d+\]$/.exec(n),!this.#r.has(n)&&!this.#r.has(n=`${n}[]`))return}else return;this.#t&&typeof r=="number"&&(r=r+""),e.push([n,r])}),e[Symbol.iterator]()}keys(){return Array.from(this.entries(),([e])=>e)[Symbol.iterator]()}values(){return Array.from(this.entries(),([,e])=>e)[Symbol.iterator]()}forEach(e,r){for(let[n,s]of this.entries())e.call(r,s,n,this)}[Symbol.iterator](){return this.entries()}get size(){let e=0;return this.forEach(()=>e++),e}static parse(e,r=!1,n="&"){let s={};return(e.startsWith("?")?e.slice(1):e).split(n).filter(Boolean).forEach(i=>{let a=i.indexOf("="),o=a===-1?i:i.slice(0,a),u=a===-1?"":i.slice(a+1);this.set(s,o,u,!0,r)}),s}static fromEntries(e){let r={};for(let[n,s]of e)this.set(r,n,s,!0);return r}static stringify(e,{sorted:r=!1,only:n=null,prettyPrint:s=!1,delim:i="&"}={}){let a=[],o=Object.keys(e);return r&&o.sort(),o.forEach(u=>{this.reduceValue(e[u],u,(c,f,l)=>{if(l)return r?[...l].sort():l;if(n&&!n.has(f))if(/\[\d+\]$/.test(f)){if([,f]=/^(.*)\[\d+\]$/.exec(f),!n.has(f)&&!n.has(f=`${f}[]`))return}else return;s||(f=encodeURIComponent(f)),a.push(f+"="+encodeURIComponent(c))},!!s)}),a.join(i)}static get(e,r,n=!1){return this.reducePath(r,e,(s,i,a)=>a||(s===""?n?i:i?.[0]:i?.[s]))}static set(e,r,n,s=!1,i=!1){this.reducePath(r,e,(a,o,u)=>{let c=u??n;return i&&/^-?\d+(\.\d+)?$/.test(c+"")&&(c=parseFloat(c)),a===""&&Array.isArray(o)?S.proxy(o).push(c):s&&o?.[a]?Array.isArray(o[a])?S.proxy(o[a]).push(c):S.set(o,a,[o[a],c]):S.set(o,a,c),c})}static reduceValue(e,r,n,s=!1){if(x(e)){let i=Object.keys(e),a=n(e,r,i);if(Array.isArray(a)){a.forEach(o=>{s&&(o=encodeURIComponent(o)),this.reduceValue(e[o],r?`${r}[${o}]`:o,n,s)});return}}n(e,r)}static reducePath(e,r,n){let s=this.parsePath(e),i=r;for(let a=0;a<s.length;a++){let o=s[a];if(J(o)&&(o=+o),a===s.length-1)return n(o,i);if(!x(i))return;if(!x(i[o])){let u=s[a+1];i[o]=n(o,i,J(u)||u===""?[]:{})}i=i[o]}}static parsePath(e){if(Array.isArray(e))return e;if(!K(e))return[];let r=[];return e.replace(/\[([^\]]*)\]|([^[\]]+)/g,(n,s,i)=>{r.push(s??i)}),r}};var B=class t extends FormData{static upgradeInPlace(e){return e instanceof t?e:Object.setPrototypeOf(e,t.prototype)}static json(e={},{encodeLiterals:r=!0,meta:n=!1}={}){let s=new t,i=!0;return ce.reduceValue(e,"",(a,o,u=void 0)=>{if(u){let c=Ue(a)==="json";return i=i&&c,c&&u}r&&[!0,!1,null].includes(a)&&(a=new Blob([a+""],{type:"application/json"})),s.append(o,a)}),n?{result:s,isDirectlySerializable:i}:s}async json({decodeLiterals:e=!0,meta:r=!1}={}){let n=!0,s;for(let[i,a]of this.entries()){s||(s=J(Ie(i,"["))?[]:{});let o=Ue(a);if(e&&["Blob","File"].includes(o)&&a.type==="application/json"&&[4,5].includes(a.size)){let u=JSON.parse(await a.text());[null,!0,!1].includes(u)&&(a=u,o="json")}n=n&&o==="json",/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(a)&&(a=Number(a)),ce.set(s,i,a)}return r?{result:s,isDirectlySerializable:n}:s}};var ue=(t,...e)=>k(t,"fetch+",...e),C=(t,...e)=>k(t,"fetch+","meta",...e);function Fe(t){return class extends t{static from(e){let r=e.headers instanceof Headers?[...e.headers.entries()].reduce((i,[a,o])=>{let u=a.toLowerCase();return i[u]=i[u]?[].concat(i[u],o):o,i},{}):Object.keys(e.headers||{}).reduce((i,a)=>(i[a.toLowerCase()]=e.headers[a],i),{}),n=e.body,s=Ue(n);if(["Blob","File"].includes(s))r["content-type"]??=n.type,r["content-length"]??=n.size;else if(["Uint8Array","Uint16Array","Uint32Array","ArrayBuffer"].includes(s))r["content-length"]??=n.byteLength;else if(s==="json"&&x(n)){let{result:i,isDirectlySerializable:a}=B.json(n,{encodeLiterals:!0,meta:!0});a?(n=JSON.stringify(n,(o,u)=>u instanceof Error?{...u,message:u.message}:u),r["content-type"]="application/json",r["content-length"]=new Blob([n]).size):(n=i,s="FormData")}else["text","json"].includes(s)&&!r["content-length"]&&(r["content-length"]=new Blob([n]).size);return!["FormData"].includes(s)&&!["function"].includes(typeof n)&&!r["content-type"]&&(r["content-type"]="application/octet-stream"),{body:n,headers:new Headers(r),$type:s}}async formData(){let e=await super.formData();return B.upgradeInPlace(e),e}async any({to:e=null,memo:r=!1}={}){if(e&&!["blob","text","json","arrayBuffer","bytes","formData"].includes(e))throw new Error(`Invalid target type specified: ${e}`);let n=C(this,"cache"),s=async o=>{if(!r)return await this[o||"bytes"]();let u=f=>{if(f instanceof FormData){let l=new B;for(let[p,m]of f.entries())l.append(p,m);return l}return(!o||o==="json")&&(Ke(f)||Je(f))?structuredClone(f):f};if(!o&&n.has("original"))return u(n.has("original"));if(o??="bytes",n.has(o))return u(n.get(o));let c;return n.has("memo")?c=n.get("memo").clone()[o]():(n.set("memo",this.clone()),c=await this[o]()),n.set(o,c),u(c)},i=(this.headers.get("Content-Type")||"").split(";")[0].trim(),a;if((!e||["formData","json"].includes(e))&&["multipart/form-data","application/x-www-form-urlencoded"].includes(i)){let o=await s("formData");B.upgradeInPlace(o),e==="json"&&(o=await o.json({decodeLiterals:!0})),a=o}else if((!e||["formData","json"].includes(e))&&i==="application/json"){let o=await s("json");e==="formData"&&(o=B.json(o,{encodeLiterals:!0})),a=o}else if(!e&&(i.startsWith("image/")||i.startsWith("video/")||i.startsWith("audio/")||i.startsWith("application/")&&!["xml","json","javascript","x-www-form-urlencoded"].some(o=>i.includes(o))))a=await s("blob");else if(!e&&(i.startsWith("text/")||i.startsWith("application/")&&["xml","javascript"].some(o=>i.includes(o))))a=await s("text");else{if(["json","formData"].includes(e))throw new Error(`Cannot convert body of type ${i} to ${e}`);a=await s(e)}return a}forget(){C(this,"cache").clear()}}}function Ue(t){if(t instanceof FormData)return"FormData";if(t===null||me(t)||je(t))return"json";if(K(t))return"text";if(x(t)){let e=t[Symbol.toStringTag],r=["Uint8Array","Uint16Array","Uint32Array","ArrayBuffer","Blob","File","FormData","Stream","ReadableStream"].reduce((n,s)=>n||(e===s?s:null),null);if(r)return r;if(v(t)||Array.isArray(t))return"json";if("toString"in t)return"text"}return null}function nn(t){return t!==null&&typeof t=="object"&&typeof t.read=="function"&&typeof t.pipe=="function"&&typeof t.on=="function"}function At(t){return t instanceof ReadableStream||nn(t)}var z=class t extends Headers{static upgradeInPlace(e){return e instanceof t?e:Object.setPrototypeOf(e,t.prototype)}set(e,r){if(/^Set-Cookie$/i.test(e)){if(Array.isArray(r)){this.delete(e);for(let n of r)this.append(e,n);return}v(r)&&(r=Ct(r))}return/Cookie/i.test(e)&&(r=hr(r)),/^Content-Range$/i.test(e)&&(r=dr(r)),/^Range$/i.test(e)&&(r=pr(r)),/^Accept$/i.test(e)&&(r=mr(r)),super.set(e,r)}append(e,r){if(/^Set-Cookie$/i.test(e)){if(Array.isArray(r)){for(let n of r)this.append(e,n);return}v(r)&&(r=Ct(r))}return/Cookie/i.test(e)&&(r=hr(r)),/^Content-Range$/i.test(e)&&(r=dr(r)),/^Range$/i.test(e)&&(r=pr(r)),/^Accept$/i.test(e)&&(r=mr(r)),super.append(e,r)}get(e,r=!1){let n=super.get(e);if(/^Set-Cookie$/i.test(e)&&r&&(n=this.getSetCookie().map(s=>{let[i,...a]=s.split(";"),[o,u]=i.split("=").map(f=>f.trim()),c={name:o,value:u};return a.map(f=>f.trim().split("=")).forEach(f=>{c[f[0][0].toLowerCase()+f[0].substring(1).replace("-","")]=f.length===1?!0:f[1]}),c})),/^Cookie$/i.test(e)&&r&&(n=n?.split(";").map(s=>{let[i,a]=s.split("=").map(o=>o.trim());return{name:i,value:a}})||[]),/^Content-Range$/i.test(e)&&n&&r&&(n=ge(n,"bytes ").split("/")),/^Range$/i.test(e)&&r&&(n=n?ge(n,"bytes=").split(",").map(s=>{let i=s.trim().split("-").map(a=>a?parseInt(a,10):null);return i.resolveAgainst=a=>{let o=[...i];return o[1]===null?o[1]=a-1:o[1]=Math.min(o[1],a)-1,o[0]===null&&(o[0]=o[1]?a-o[1]-1:0),o},i.canResolveAgainst=(a,o)=>{let u=[typeof i[0]=="number"?i[0]:a,typeof i[1]=="number"?i[1]:o-1];return!(u[0]>u[1]||u[0]<a||u[1]>=o)},i.toString=()=>s,i}):[]),/^Accept$/i.test(e)&&n&&r){let s=a=>{let[o,u]=a.trim().split(";").map(c=>c.trim());return[o,parseFloat((u||"q=1").replace("q=",""))]},i=n;n=n.split(",").map(a=>s(a)).sort((a,o)=>a[1]>o[1]?-1:1)||[],n.match=a=>{if(!a)return 0;let o=c=>c.split("/").map(f=>f.trim()),u=o(a+"");return n.reduce((c,[f,l])=>{if(c)return c;let p=o(f);return[0,1].every(m=>u[m]===p[m]||u[m]==="*"||p[m]==="*")?l:0},0)},n.toString=()=>i}return n}};function Ct(t){let e=[`${t.name}=${t.value}`];for(let r in t){if(["name","value"].includes(r))continue;let n=r[0].toUpperCase()+r.substring(1);n==="MaxAge"&&(n="Max-Age"),e.push(t[r]===!0?n:`${n}=${t[r]}`)}return e.join("; ")}function hr(t){return x(t)&&(t=[].concat(t).map(Ct).join("; ")),t}function pr(t){let e=[];return H(t).forEach((r,n)=>{let s=Array.isArray(r)?r.map(i=>[null,void 0].includes(i)?"":i).join("-"):r+"";n===0&&!s.includes("bytes=")&&(s=`bytes=${s}`),e.push(s)}),e.join(", ")}function dr(t){if(Array.isArray(t)){if(t.length<2||!t[0].includes("-"))throw new Error("A Content-Range array must be in the format: [ 'start-end', 'total' ]");t=`bytes ${t.join("/")}`}return t}function mr(t){return Array.isArray(t)&&(t=t.map(e=>Array.isArray(e)?e.map((r,n)=>n===1&&(r=parseFloat(r),!0)?r===1?"":`;q=${r}`:r.trim()).join(""):e.trim()).join(",")),t}var V=class t extends Fe(Response){constructor(e,r={}){super(e,r),z.upgradeInPlace(this.headers)}static upgradeInPlace(e){return e instanceof t||(Object.setPrototypeOf(e,t.prototype),z.upgradeInPlace(e.headers)),e}static from(e,{memoize:r=!1,...n}={}){if(e instanceof Response)return e;let s;if(typeof e<"u"){let a;({body:e,headers:a,$type:s}=super.from({body:e,headers:n.headers})),n={...n,headers:a}}let i=new this(e,n);if(r){let a=C(i,"cache"),o={json:"json",FormData:"formData",text:"text",ArrayBuffer:"arrayBuffer",Blob:"blob",Bytes:"bytes"};a.set(o[s]||"original",e)}return i}get status(){return C(this).get("status")??super.status}clone(){let e=super.clone();t.upgradeInPlace(e);let r=C(this);return ue(e).set("meta",new Map(r)),C(e).has("cache")&&C(e).set("cache",new Map(r.get("cache"))),e}};async function gr(t,e={}){let r=await fetch(t,e);return V.upgradeInPlace(r),r}var He=class t extends Fe(Request){constructor(e,r={}){super(e,r),z.upgradeInPlace(this.headers)}static upgradeInPlace(e){return e instanceof t||(Object.setPrototypeOf(e,t.prototype),z.upgradeInPlace(e.headers)),e}static from(e,{memoize:r=!1,...n}={}){if(e instanceof Request)return e;let s,i=n.body;if("body"in n){let{body:o,headers:u,$type:c}=super.from(n);n={...n,body:o,headers:u},s=c}let a=new this(e,n);if(r){let o=C(a,"cache"),u={json:"json",FormData:"formData",text:"text",ArrayBuffer:"arrayBuffer",Blob:"blob",Bytes:"bytes"};o.set(u[s]||"original",i)}return a}static async copy(e,r={}){let s=["method","headers","mode","credentials","cache","redirect","referrer","integrity"].reduce((i,a)=>({...i,[a]:a in r?r[a]:a==="headers"?new Headers(e[a]):e[a]}),{});return["GET","HEAD"].includes(s.method.toUpperCase())?s.body=null:"body"in r?(s.body=r.body,"headers"in r||(s.headers.delete("Content-Type"),s.headers.delete("Content-Length"))):s.body=await e.clone().arrayBuffer(),s.mode==="navigate"&&(s.mode="cors"),{url:r.url||e.url,...s}}clone(){let e=super.clone();t.upgradeInPlace(e);let r=C(this);return ue(e).set("meta",new Map(r)),C(e).has("cache")&&C(e).set("cache",new Map(r.get("cache"))),e}};var j=class extends MessageEvent{#n;get originalTarget(){return this.#n}#t;get eventID(){return this.#t}#r;get data(){return this.#r}#e;get live(){return this.#e}#o;get bubbles(){return this.#o}#a;get forwarded(){return this.#a}#i;get honourDoneMutationFlags(){return this.#i}#u=[];get ports(){return this.#u}constructor(e,{originalTarget:r=null,type:n="message",eventID:s,live:i=!1,honourDoneMutationFlags:a=!1,bubbles:o=!1,forwarded:u=!1,ports:c=[]}={}){if(n&&typeof n!="string")throw new TypeError("Where specified, wqEventOptions.type must be a string");super(n),this.#r=e,this.#n=r,this.#t=s,this.#e=i,this.#o=o,this.#a=u,this.#i=a,this.#u=c;let f=this.#n&&Z(this.#n)||{};if(this.#u.forEach(l=>M.upgradeInPlace(l,{autoStart:f.autoStart,postAwaitsOpen:f.postAwaitsOpen})),x(this.#r)&&this.#e){if(typeof s!="string")throw new TypeError("eventID must be a non-empty string");Mt.call(r,this.#r,this.#t,{honourDoneMutationFlags:this.#i})}}#h=!1;get immediatePropagationStopped(){return this.#h}stopImmediatePropagation(){this.#h=!0,this.#c=!0,super.stopImmediatePropagation()}#c=!1;get propagationStopped(){return this.#c}stopPropagation(){this.#c=!0,super.stopPropagation()}#s=!1;get defaultPrevented(){return this.#s}preventDefault(){this.#s=!0,super.preventDefault()}respondWith(e,r=[]){for(let n of this.#u)n.postMessage(e,r);return!!this.#u.length}};var fe=class extends We(EventTarget){#n;constructor(e,{autoStart:r=!0,naturalOpen:n=!0,postAwaitsOpen:s=!1}={}){if(super(),this.#n=typeof e=="string"?new WebSocket(e):e,$(this).set("options",{autoStart:r,naturalOpen:n,postAwaitsOpen:s}),this.constructor.upgradeEvents(this.#n,this),n&&r&&this.#n.readyState===WebSocket.OPEN&&this.start(),this.#n.readyState===WebSocket.CLOSED)try{this.close()}catch{}}static _hydrateMessage(e,r){try{let n;if(typeof r.data=="string"&&v(n=JSON.parse(r.data))&&n[".wq"])return Object.defineProperty(r,"data",{value:n,configurable:!0}),super._hydrateMessage(e,r)}catch{}return r}__postMessage(e,r){this.#n.send(JSON.stringify(e),r)}};var yr=(t,...e)=>k(t,"port+",...e),$=(t,...e)=>k(t,"port+","meta",...e),Z=t=>k(t,"port+","meta").get("options")||{},wr=["addEventListener","addRequestListener","postMessage","postRequest","dispatchEvent","relay","start","readyStateChange","removeEventListener","close"],br=["options","readyState","onmessage","onmessageerror"],M=class extends xr(EventTarget){constructor(e={}){super(),yr(this,"meta").set("options",e)}static[Symbol.hasInstance](e){return Function.prototype[Symbol.hasInstance].call(this,e)?!0:wr.every(r=>typeof e[r]=="function")||br.every(r=>r in e)}};function xr(t){return class extends t{static upgradeInPlace(e,r={}){if(e instanceof M)return e;let n=this.prototype;for(let i of wr.concat("_autoStart")){let a=e[i],o=n[i];a&&Object.defineProperty(e,`_${i}`,{value:a.bind(e),configurable:!0}),Object.defineProperty(e,i,{value:o.bind(e),configurable:!0})}for(let i of br){let a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),i),o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),i);a&&Object.defineProperty(e,`_${i}`,{...a,configurable:!0}),Object.defineProperty(e,i,{...o,configurable:!0})}return yr(e,"meta").set("options",r),this.upgradeEvents(e),e}static upgradeEvents(e,r=null){r||(r=e);let n=$(e);if(n.get("events+"))return;let s=$(r),i=Z(r),a=he.call(r),o=le.call(r);e instanceof BroadcastChannel&&(i.clientServerMode==="server"?s.set("clients",new Set):i.clientServerMode==="client"&&s.set("client_id",`client-${(0|Math.random()*9e6).toString(36)}`));let u=l=>{if(l instanceof j)return;if(e===r&&l.stopImmediatePropagation?.(),l=this._hydrateMessage?.(r,l)||l,l.data.ping==="connect"&&typeof l.data?.[".wq"]?.eventID=="string"&&(!(e instanceof WebSocket)||!i.naturalOpen)){let g=!0;e instanceof BroadcastChannel&&(i.clientServerMode==="server"&&typeof l.data.id=="string"?(s.get("clients").add(l.data.id),g="server"):l.data.id==="server"&&s.has("client_id")&&(g=s.get("client_id"))),l.ports?.forEach(b=>b.postMessage(g)),s.set("remote.start.called",!0),r.start();return}if(l.data.ping==="disconnect"&&typeof l.data?.[".wq"]?.eventID=="string"){let g=()=>{s.set("remote.close.called",!0),r.close()};e instanceof BroadcastChannel?i.clientServerMode==="server"&&typeof l.data.id=="string"?(s.get("clients").delete(l.data.id),!s.get("clients").size&&i.autoClose&&!o.close.state&&g()):i.clientServerMode==="client"&&l.data.id==="server"&&g():e instanceof MessagePort&&g();return}let p=l.data,m={};typeof l.data?.[".wq"]?.eventID=="string"&&({message:p,".wq":m}=l.data);let h=new j(p,{originalTarget:e,...m,ports:l.ports});r.dispatchEvent(h)},c=l=>{e instanceof WebSocket&&i.naturalOpen&&!(l instanceof j)&&(s.set("remote.start.called",!0),r.start())},f=l=>{(e instanceof WebSocket||e instanceof MessagePort)&&!(l instanceof j)&&(s.set("remote.close.called",!0),r.close())};n.set("internal_call",!0),e.addEventListener("message",u),e.addEventListener("error",u),e.addEventListener("open",c),e.addEventListener("close",f),n.delete("internal_call"),n.set("events+",!0),a.add(()=>{e.removeEventListener("message",u),e.removeEventListener("error",u),e.removeEventListener("open",c),e.removeEventListener("close",f),n.set("events+",!1)})}get options(){return{...Z(this)}}get onmessageerror(){return typeof super.onmessageerror<"u"?super.onmessageerror:typeof this._onmessageerror<"u"?this._onmessageerror:null}set onmessageerror(e){if(typeof super.onmessageerror<"u"){super.onmessageerror=e;return}if(e!==null&&typeof e!="function")throw new TypeError("onmessageerror must be a function");if(Object.getOwnPropertyDescriptor(this,"_onmessageerror")?.set){this._onmessageerror=e;return}this._onmessageerror&&this.removeEventListener("messageerror",this._onmessageerror),this.addEventListener("messageerror",e),this._onmessageerror=e}get onmessage(){return typeof super.onmessage<"u"?super.onmessage:typeof this._onmessage<"u"?this._onmessage:null}set onmessage(e){if(this._autoStart(),typeof super.onmessage<"u"){super.onmessage=e;return}if(e!==null&&typeof e!="function")throw new TypeError("onmessage must be a function");if(Object.getOwnPropertyDescriptor(this,"_onmessage")?.set){this._onmessage=e;return}this._onmessage&&this.removeEventListener("message",this._onmessage),this.addEventListener("message",e),this._onmessage=e}addEventListener(...e){return this._autoStart(),he.call(this).add(()=>{this._removeEventListener?this._removeEventListener(...e):super.removeEventListener(...e)}),this._addEventListener?this._addEventListener(...e):super.addEventListener(...e)}dispatchEvent(e){let r=this._dispatchEvent?this._dispatchEvent(e):super.dispatchEvent(e);return e instanceof j&&sn.call(this,e),r}postMessage(e,r={}){this._autoStart();let n=le.call(this);n.messaging.state=!0,n.messaging.resolve(this);let s,{portOptions:i,wqOptions:{relayedFrom:a,...o}}=Be.call(this,e,r);(o.type!=="message"||o.live||o.bubbles||i.transfer?.length&&(this instanceof BroadcastChannel||this instanceof fe))&&(e={message:e,".wq":o}),r=i,s=a;let u=()=>{this._postMessage?this._postMessage(e,r,s):super.postMessage(e,r)};Z(this).postAwaitsOpen?n.open.promise.then(u):u()}addRequestListener(e,r,n={}){let s=async i=>{let a=await r(i);for(let o of i.ports)o.postMessage(a)};this.addEventListener(e,s,n)}postRequest(e,r,n={}){let s;v(r)&&(n={once:!0,...r},s=new Promise(f=>{r=f}));let i=new MessageChannel;this.constructor.upgradeEvents(i.port1),i.port1.start();let{signal:a=null,once:o=!1,transfer:u=[],...c}=n;return i.port1.addEventListener("message",f=>r(f),{signal:a,once:o}),a?.addEventListener("abort",()=>{i.port1.close(),i.port2.close()}),this.postMessage(e,{...c,transfer:[i.port2].concat(u)}),s}relay({to:e,from:r,types:n="*",channel:s=null,resolveMessage:i=null,bidirectional:a=!1}={}){if(e&&r)throw new Error('Only one of "to" and "from" may be specified');if(r?e=this:r=this,e===r)throw new Error("Source and target ports cannot be the same");if(!(r instanceof M)||!(e instanceof M))throw new Error("Both source and target ports must be instance of MessagePortPlus.");if(typeof n!="function"&&!(n=[].concat(n)).length)throw new Error("Event types must be specified.");if(typeof s=="string")s={from:s};else if(v(s)){if(Object.keys(s).filter(f=>!["from","to"].includes(f)).length)throw new Error('Channel must be a string or an object of "from"/"to" members')}else if(s)throw new Error("Invalid channel parameter");let o=_r.call(r),u={targetPort:e,types:n,channel:s,resolveMessage:i};o.add(u);let c;return a&&(c=e.relay({to:r,types:n,channel:s&&{to:s.from,from:s.to},resolveMessage:i,bidirectional:!1})),()=>{o.delete(u),c?.()}}channel(e,r=null){let n=new MessageChannel;return M.upgradeInPlace(n.port1,{autoStart:this.options.autoStart,postAwaitsOpen:this.options.postAwaitsOpen}),M.upgradeInPlace(n.port2,{autoStart:this.options.autoStart,postAwaitsOpen:this.options.postAwaitsOpen}),he.call(this).add(this.relay({channel:e,to:n.port1,bidirectional:!0,resolveMessage:r})),n.port1.start(),this.readyStateChange("close").then(()=>{n.port1.close()}),n.port2}projectMutations({from:e,to:r,...n}){if(!e||!r||typeof e=="string"&&typeof r=="string"||x(e)&&x(r))throw new Error('Invalid "from"/"to" parameters');if(typeof e=="string"){if(!x(r))throw new Error('Invalid "to" parameter. Object/array expected');return Mt.call(this,r,e,n)}if(typeof r=="string"){if(!x(e))throw new Error('Invalid "from" parameter. Object/array expected');return vr.call(this,e,r,n)}throw new Error('Invalid "from"/"to" parameters')}get readyState(){let e=le.call(this);return e.close.state?"closed":e.open.state?"open":"connecting"}readyStateChange(e){if(!["open","messaging","close"].includes(e))throw new Error(`Invalid readyState query "${e}"`);return le.call(this)[e].promise}_autoStart(){let e=$(this),r=Z(this);!e.get("internal_call")&&r.autoStart&&this.start()}start(){let e=le.call(this);if(e.open.state)return;let r,n=()=>{if(e.open.state)return;e.open.state=!0,e.open.resolve(this);let c=new j(null,{type:"open"});this._dispatchEvent?this._dispatchEvent(c):super.dispatchEvent(c),r?.port1.close(),r?.port2.close()},s=$(this),i=Z(this);if(s.get("remote.start.called")){n();return}if(s.get("start.called"))return;s.set("start.called",!0),this._start?this._start():super.start?.(),r=new MessageChannel,r.port1.onmessage=c=>{this instanceof BroadcastChannel&&i.clientServerMode==="server"&&typeof c.data=="string"&&s.get("clients").add(c.data),n()};let{wqOptions:a}=Be.call(this),o=i.clientServerMode==="server"?"server":i.clientServerMode==="client"?s.get("client_id"):null,u={".wq":a,ping:"connect",id:o};this._postMessage?this._postMessage(u,{transfer:[r.port2]}):super.postMessage(u,{transfer:[r.port2]})}close(...e){let r=le.call(this);if(r.close.state)return;r.close.state=!0;let n=$(this),s=Z(this);if(!n.get("remote.close.called")&&(this instanceof BroadcastChannel||this instanceof MessagePort)){let{wqOptions:a}=Be.call(this),o=s.clientServerMode==="server"?"server":s.clientServerMode==="client"?n.get("client_id"):null,u={".wq":a,ping:"disconnect",id:o};this._postMessage?this._postMessage(u):super.postMessage(u)}this._close?this._close(...e):super.close(...e),r.close.resolve(this);let i=new j(null,{type:"close"});this._dispatchEvent?this._dispatchEvent(i):super.dispatchEvent(i),on.call(this)}}}function We(t){return class extends xr(t){static _hydrateMessage(e,r){if(typeof r.data?.[".wq"]?.numPorts!="number"||typeof r.data[".wq"].eventID!="string")return r;let n=he.call(e),s=r.data[".wq"].numPorts;Object.defineProperty(r,"ports",{value:[],configurable:!0});for(let i=0;i<s;i++){let a=e.channel(`${r.data[".wq"].eventID}:${i}`);r.ports.push(a)}return r}_postMessage(e,r={}){let{transfer:n=[],...s}=r;if(typeof e?.[".wq"]?.eventID=="string"){let i=he.call(this),a=n.filter(u=>u instanceof MessagePort),o=a.length;for(let u=0;u<o;u++)M.upgradeInPlace(a[u]),i.add(this.relay({channel:`${e[".wq"].eventID}:${u}`,to:a[u],bidirectional:!0})),a[u].start(),a[u].readyStateChange("close").then(()=>{let{wqOptions:c}=Be.call(this),f={".wq":c,ping:"disconnect"};this.postMessage(f,{type:`${e[".wq"].eventID}:${u}:message`})});e[".wq"].numPorts=o}return this.__postMessage(e,s)}}}function sn(t){if(t.propagationStopped)return;let e=$(this);e.get("parentNode")instanceof EventTarget&&(t.bubbles||e.get("parentNode")?.findPort?.(n=>n===this)&&t instanceof j)&&e.get("parentNode").dispatchEvent(t);let r=_r.call(this);if(r.size&&t instanceof j){let{type:n,eventID:s,data:i,live:a,bubbles:o,ports:u}=t,c=new WeakSet;for(let{targetPort:f,types:l,channel:p,resolveMessage:m}of r){if(c.has(f))continue;let h=n;p.from&&([,h]=new RegExp(`^${p.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}:([^:]+)$`).exec(n)||[],!h)||!(typeof l=="function"?l(h,this,f,p):[].concat(l).find(b=>b===h||b==="*"))||(c.add(f),f.postMessage(m?m(i,this,f,p):i,{transfer:u,type:p.to?`${p.to}:${h}`:h,eventID:s,bubbles:o,live:a,forwarded:!0,relayedFrom:this}))}}}function he(){let t=$(this);return t.has("garbage_collection")||t.set("garbage_collection",new Set),t.get("garbage_collection")}function _r(){let t=$(this);return t.has("downstream_registry")||t.set("downstream_registry",new Set),t.get("downstream_registry")}function le(){let t=$(this);if(!t.has("readystate_registry")){let e=r=>(r.promise=new Promise((n,s)=>(r.resolve=n,r.reject=s)),r);t.set("readystate_registry",{open:e({}),messaging:e({}),close:e({})})}return t.get("readystate_registry")}function on(){let t=$(this);for(let e of t.get("garbage_collection")||[])e instanceof AbortController?e.abort():typeof e=="function"&&e();t.get("garbage_collection")?.clear(),t.get("downstream_registry")?.clear()}function Be(t=void 0,e={}){if(Array.isArray(e))e={transfer:e};else if(!e||typeof e!="object")throw new TypeError("transferOrOptions must be an array or an object");let{type:r="message",eventID:n=null,live:s=!1,observing:i=!1,bubbles:a=!1,forwarded:o=!1,relayedFrom:u=null,signal:c=null,withArrayMethodDescriptors:f=!1,honourDoneMutationFlags:l=!1,...p}=e;return n||(n=`${r}-${(0|Math.random()*9e6).toString(36)}`),!i&&!o&&x(t)&&s&&!r?.endsWith(".mutate")&&(vr.call(this,t,n,{signal:c,withArrayMethodDescriptors:f,honourDoneMutationFlags:l}),i=!0),{portOptions:p,wqOptions:{type:r,eventID:n,live:s,observing:i,honourDoneMutationFlags:l,bubbles:a,forwarded:o,relayedFrom:u}}}function vr(t,e,{signal:r,withArrayMethodDescriptors:n=!0,honourDoneMutationFlags:s=!1}={}){if(!x(t))throw new TypeError("data must be a plain object and not a stream");if(typeof e!="string")throw new TypeError("eventID must be a non-empty string");let i=u=>{let c;n&&Array.isArray(u[0].target)&&!u[0].argumentsList&&!["set","defineProperty","deleteProperty"].includes(u[0].operation)||(this.postMessage(u.map(f=>(c=!c&&s&&f.detail?.done,{...f,target:void 0})),{type:`${e}.mutate`}),c&&a.abort())},a=S.observe(t,S.subtree(),i,{signal:r,withArrayMethodDescriptors:n});return he.call(this).add(a),a}function Mt(t,e,{signal:r,honourDoneMutationFlags:n=!1}={}){if(!x(t))throw new TypeError("data must be a plain object and not a stream");if(typeof e!="string")throw new TypeError("eventID must be a non-empty string");let s=o=>{if(!o.data?.length)return;let u;S.batch(t,()=>{for(let c of o.data){if(u=!u&&n&&c.detail?.done,c.argumentsList){let f=c.path.length?S.get(t,S.path(...c.path)):t;S.proxy(f)[c.operation](...c.argumentsList);continue}if(c.key!=="length"||["set","defineProperty","deleteProperty"].includes(c.operation)){let f=c.path.length===1?t:S.get(t,S.path(...c.path.slice(0,-1)));c.type==="delete"?S.deleteProperty(f,c.key):S.set(f,c.key,c.value)}}}),u&&i()};this.addEventListener(`${e}.mutate`,s,{signal:r});let i=()=>this.removeEventListener(`${e}.mutate`,s);return he.call(this).add(i),i}var $e=class extends We(BroadcastChannel){constructor(e,{autoStart:r=!0,postAwaitsOpen:n=!1,clientServerMode:s=null,autoClose:i=!0}={}){super(e);let a=$(this);if(s&&!["server","client"].includes(s))throw new Error('clientServerMode must be "server" or "client"');a.set("options",{autoStart:r,postAwaitsOpen:n,clientServerMode:s,autoClose:i}),this.constructor.upgradeEvents(this)}__postMessage(e,r){BroadcastChannel.prototype.postMessage.call(this,e)}};var ze=class t extends EventTarget{static get xHeaderName(){return"X-Message-Port"}static test(e){return e instanceof t||e?.[Symbol.toStringTag]==="LiveResponse"?"LiveResponse":e?.[Symbol.toStringTag]==="LiveProgramHandle"?"LiveProgramHandle":e instanceof Response?"Response":cn(e)?"Generator":"Default"}static hasPort(e){return!!e.headers?.get?.(this.xHeaderName)?.trim()}static getPort(e,r=!1){if(!/Response/.test(this.test(e)))return;let n=C(e);if(!n.has("port")){let s=e.headers.get(this.xHeaderName)?.trim();if(!s)return;let[,i,a]=/^(socket|channel):\/\/(.*)$/.exec(s)||[];if(!i||!a)throw new Error(`Unknown port messaging protocol: ${s}`);let o=i==="channel"?new $e(a,{autoStart:r,postAwaitsOpen:!0,clientServerMode:"client"}):new fe(a,{autoStart:r,naturalOpen:!1,postAwaitsOpen:!0});n.set("port",o)}return n.get("port")}static attachPort(e,r){if(!(r instanceof M))throw new Error("Client must be a MessagePortPlus interface");C(e).set("port",r)}static from(e,...r){return this.test(e)==="LiveResponse"?e.clone(...r):new this(e,...r)}[Symbol.toStringTag]="LiveResponse";#n;constructor(e,...r){super(),this.#n=L.getInstance(this,!0);let s=_e.call(this).now;this.#f(s,e,...r).catch(i=>{s.reject(i)})}#t=null;get body(){return this.#t}#r=!1;get concurrent(){return this.#r}get bodyUsed(){return!0}#e=new Headers;get headers(){return this.#e}#o=200;get status(){return this.#o}#a="";get statusText(){return this.#a}#i="basic";get type(){return this.#i}#u=!1;get redirected(){return this.#u}#h=null;get url(){return this.#h}get ok(){return this.#o>=200&&this.#o<299}async now(){return _e.call(this).now.promise}get port(){return this.constructor.getPort(this,!0)}#c=new AbortController;#s=new AbortController;get readyState(){let e=_e.call(this);return e.done.state?"done":e.live.state?"live":"waiting"}readyStateChange(e){if(!["live","now","done"].includes(e))throw new Error(`Invalid readyState query "${e}"`);return _e.call(this)[e].promise}disconnect(e=!1){this.#c.abort(),this.#c=new AbortController,e&&(this.#s.abort(),this.#s=new AbortController)}#d;#g(e){let r=_e.call(this);if(r.done.state)throw new Error("Response already done.");return this.#d=e,e.then(n=>{this.#d===e&&(this.#d=null,r.done.state=!0,r.done.resolve(n))}).catch(n=>{this.#d===e&&(this.#d=null,r.done.state=!0,r.done.reject(n))}),e}async replaceWith(e,...r){if(this.readyState==="done")throw new Error("Response already done.");this.disconnect(),await this.#f(null,e,...r)}async#f(e,r,...n){let s=_e.call(this),i=e||s.now.refresh();if(r instanceof Promise)return this.#g(new Promise((m,h)=>{this.#c.signal.addEventListener("abort",()=>{i.aborted=!0,m()}),r.then(async g=>{await this.#f(i,g,...n),m()}).catch(g=>h(g))}));let a=(m,h)=>{if(h=Object.freeze({...h,ok:h.status>=200&&h.status<299,bodyUsed:!0}),m?.aborted){m.resolve(h);return}let g=m||s.now.refresh(),b=h.body;this.#o=h.status,this.#a=h.statusText;for(let[d]of[...this.#e.entries()])this.#e.delete(d);for(let[d,P]of h.headers.entries())this.#e.append(d,P);this.#i=h.type,this.#u=h.redirected,this.#h=h.url;let _=this.#t;this.#t=b,this.#r=!!h.concurrent,this.#r||(this.#s.abort(),this.#s=new AbortController);let w=new A(this,{type:"set",key:"body",value:b,oldValue:_,isUpdate:!0,related:[],operation:"set",detail:null});s.live.state=!0,s.live.resolve(this),g.resolve(h),this.#n.emit([w]),this.dispatchEvent(new $t(h))},o=(m,h,g)=>{a(m,{body:h,status:200,statusText:"",...g,headers:g.headers instanceof Headers?g.headers:new Headers(g.headers||{}),type:"basic",redirected:!1,url:null})},u=async(m,h,g)=>{let b,_=!1;try{b=h instanceof Response?await V.prototype.any.call(h,{to:"json"}):(await h.readyStateChange("live")).body,_=!0}catch{b=await V.prototype.any.call(h)}if(a(m,{body:b,status:h.status,statusText:h.statusText,headers:h.headers,concurrent:h.concurrent,...g,type:h.type,redirected:h.redirected,url:h.url}),this.constructor.test(h)==="LiveResponse"){let w=()=>{o(null,h.body,h)};return h.addEventListener("replace",w,{signal:this.#c.signal}),await h.readyStateChange("done"),h.removeEventListener("replace",w),h}if(this.constructor.hasPort(h)){let w=this.constructor.getPort(h);return w.start(),_&&w.projectMutations({from:"initial_response",to:b,signal:this.#s.signal}),new Promise(d=>{let P=E=>{let{body:N,...U}=E.data;o(null,N,{...U})};w.addEventListener("response.replace",P,{signal:this.#c.signal}),w.addEventListener("response.done",()=>{w.removeEventListener("response.replace",P),d(this)},{once:!0}),w.readyStateChange("close").then(d)})}},c=async(m,h,g)=>{let b=await h.next(),_=await b.value;await this.#f(m,_,{done:b.done,...g});let w=b,d=_;for(;!w.done&&!this.#c.signal.aborted;)w=await h.next(),d=await w.value,this.#c.signal.aborted||await this.#f(null,d,{concurrent:g.concurrent,done:g.done===!1?!1:w.done})},f=async(m,h,g)=>(await this.#f(m,h.value,g),S.observe(h,"value",b=>this.#f(null,b.value,{concurrent:g.concurrent,done:!1}),{signal:this.#c.signal}),new Promise(()=>{})),l=typeof n[0]=="function"?n.shift():null,p=v(n[0])?{...n.shift()}:{};if("status"in p&&(p.status=parseInt(p.status),p.status<200||p.status>599))throw new Error(`The status provided (${p.status}) is outside the range [200, 599].`);if("statusText"in p&&(p.statusText=String(p.statusText)),p.headers&&!(p.headers instanceof Headers)&&(p.headers=new Headers(p.headers)),"concurrent"in p&&(p.concurrent=!!p.concurrent),/Response/.test(this.constructor.test(r))){if(l)throw new Error("frameClosure is not supported for responses.");i.donePromise=u(i,r,p)}else if(this.constructor.test(r)==="Generator"){if(l)throw new Error("frameClosure is not supported for generators.");i.donePromise=c(i,r,p)}else if(this.constructor.test(r)==="LiveProgramHandle"){if(l)throw new Error("frameClosure is not supported for live program handles.");i.donePromise=f(i,r,p)}else if(i.donePromise=Promise.resolve(o(i,r,p)),l){let m=x(r)&&!At(r)?S.proxy(r,{chainable:!0,membrane:r}):r;i.donePromise=Promise.resolve(l.call(this,m,this.#s.signal))}return this.#g(p.done===!1?new Promise(()=>{}):i.donePromise),await new Promise((m,h)=>{this.#c.signal.addEventListener("abort",()=>m(!1)),i.donePromise.then(()=>m(!0)).catch(h)})}toResponse({port:e,signal:r}={}){if(e&&!(e instanceof M))throw new Error("Client must be a MessagePortPlus interface");let n=V.from(this.body,{status:this.#o,statusText:this.#a,headers:this.#e}),s=C(this);if(ue(n).set("meta",s),!e)return n;x(this.#t)&&!At(this.#t)&&e.projectMutations({from:this.#t,to:"initial_response",signal:AbortSignal.any([this.#s.signal].concat(r||[]))});let i=()=>{let a=Object.fromEntries([...this.headers.entries()]);a?.["set-cookie"]&&(delete a["set-cookie"],console.warn('Warning: The "set-cookie" header is not supported for security reasons and has been removed from the response.')),e.postMessage({body:this.#t,status:this.#o,statusText:this.#a,headers:a,concurrent:this.#r},{type:"response.replace",live:!0,signal:AbortSignal.any([this.#s.signal].concat(r||[]))})};return this.addEventListener("replace",i,{signal:r}),this.readyStateChange("done").then(()=>{e.postMessage(null,{type:"response.done"})}),n}async*toGenerator({signal:e}={}){do yield this.body;while(await new Promise(r=>{this.addEventListener("replace",()=>r(!0),{once:!0,signal:e}),this.readyStateChange("done").then(()=>r(!1))}))}toLiveProgramHandle({signal:e}={}){let r=new Rt,n=()=>S.defineProperty(r,"value",{value:this.body,enumerable:!1,configurable:!0});return this.addEventListener("replace",n,{signal:e}),n(),r}clone(e={}){let r=new this.constructor,n=C(this);return ue(r).set("meta",new Map(n)),r.replaceWith(this,e),r}},cn=t=>typeof t?.next=="function"&&typeof t?.throw=="function"&&typeof t?.return=="function";function _e(){let t=C(this);if(!t.has("readystate_registry")){let e=n=>(n.promise=new Promise((s,i)=>(n.resolve=s,n.reject=i)),n),r={live:e({}),done:e({})};(function n(){return r.now=e({}),r.now.refresh=n,r.now})(),t.set("readystate_registry",r)}return t.get("readystate_registry")}var $t=class extends Event{#n;get data(){return this.#n}constructor(e){super("replace"),this.#n=e}},Rt=class{[Symbol.toStringTag]="LiveProgramHandle";abort(){}};globalThis.webqit||(globalThis.webqit={});Object.assign(globalThis.webqit,jt);})();
1
+ (()=>{var Pr=Object.defineProperty;var Tt=(t,e)=>()=>(t&&(e=t(t=0)),e);var Re=(t,e)=>{for(var r in e)Pr(t,r,{get:e[r],enumerable:!0})};function Dt(t,e){return(e?/^[\x00-\xFF]*$/:/^[\x00-\x7F]*$/).test(t)}function tt(t,e=!1){let r=[],n=0;for(;n<t.length;){let s=t[n],i=y(function(a){if(!e)throw new TypeError(a);r.push({type:"INVALID_CHAR",index:n,value:t[n++]})},"ErrorOrInvalid");if(s==="*"){r.push({type:"ASTERISK",index:n,value:t[n++]});continue}if(s==="+"||s==="?"){r.push({type:"OTHER_MODIFIER",index:n,value:t[n++]});continue}if(s==="\\"){r.push({type:"ESCAPED_CHAR",index:n++,value:t[n++]});continue}if(s==="{"){r.push({type:"OPEN",index:n,value:t[n++]});continue}if(s==="}"){r.push({type:"CLOSE",index:n,value:t[n++]});continue}if(s===":"){let a="",o=n+1;for(;o<t.length;){let u=t.substr(o,1);if(o===n+1&&jr.test(u)||o!==n+1&&Tr.test(u)){a+=t[o++];continue}break}if(!a){i(`Missing parameter name at ${n}`);continue}r.push({type:"NAME",index:n,value:a}),n=o;continue}if(s==="("){let a=1,o="",u=n+1,c=!1;if(t[u]==="?"){i(`Pattern cannot start with "?" at ${u}`);continue}for(;u<t.length;){if(!Dt(t[u],!1)){i(`Invalid character '${t[u]}' at ${u}.`),c=!0;break}if(t[u]==="\\"){o+=t[u++]+t[u++];continue}if(t[u]===")"){if(a--,a===0){u++;break}}else if(t[u]==="("&&(a++,t[u+1]!=="?")){i(`Capturing groups are not allowed at ${u}`),c=!0;break}o+=t[u++]}if(c)continue;if(a){i(`Unbalanced pattern at ${n}`);continue}if(!o){i(`Missing pattern at ${n}`);continue}r.push({type:"REGEX",index:n,value:o}),n=u;continue}r.push({type:"CHAR",index:n,value:t[n++]})}return r.push({type:"END",index:n,value:""}),r}function rt(t,e={}){let r=tt(t);e.delimiter??="/#?",e.prefixes??="./";let n=`[^${R(e.delimiter)}]+?`,s=[],i=0,a=0,o="",u=new Set,c=y(d=>{if(a<r.length&&r[a].type===d)return r[a++].value},"tryConsume"),f=y(()=>c("OTHER_MODIFIER")??c("ASTERISK"),"tryConsumeModifier"),l=y(d=>{let P=c(d);if(P!==void 0)return P;let{type:E,index:N}=r[a];throw new TypeError(`Unexpected ${E} at ${N}, expected ${d}`)},"mustConsume"),p=y(()=>{let d="",P;for(;P=c("CHAR")??c("ESCAPED_CHAR");)d+=P;return d},"consumeText"),m=y(d=>d,"DefaultEncodePart"),h=e.encodePart||m,g="",b=y(d=>{g+=d},"appendToPendingFixedValue"),_=y(()=>{g.length&&(s.push(new be(3,"","",h(g),"",3)),g="")},"maybeAddPartFromPendingFixedValue"),w=y((d,P,E,N,U)=>{let D=3;switch(U){case"?":D=1;break;case"*":D=0;break;case"+":D=2;break}if(!P&&!E&&D===3){b(d);return}if(_(),!P&&!E){if(!d)return;s.push(new be(3,"","",h(d),"",D));return}let T;E?E==="*"?T=Ze:T=E:T=n;let ve=2;T===n?(ve=1,T=""):T===Ze&&(ve=0,T="");let Y;if(P?Y=P:E&&(Y=i++),u.has(Y))throw new TypeError(`Duplicate name '${Y}'.`);u.add(Y),s.push(new be(ve,Y,h(d),T,h(N),D))},"addPart");for(;a<r.length;){let d=c("CHAR"),P=c("NAME"),E=c("REGEX");if(!P&&!E&&(E=c("ASTERISK")),P||E){let U=d??"";e.prefixes.indexOf(U)===-1&&(b(U),U=""),_();let D=f();w(U,P,E,"",D);continue}let N=d??c("ESCAPED_CHAR");if(N){b(N);continue}if(c("OPEN")){let U=p(),D=c("NAME"),T=c("REGEX");!D&&!T&&(T=c("ASTERISK"));let ve=p();l("CLOSE");let Y=f();w(U,D,T,ve,Y);continue}_(),l("END")}return s}function R(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function Ye(t){return t&&t.ignoreCase?"ui":"u"}function kt(t,e,r){return nt(rt(t,r),e,r)}function ne(t){switch(t){case 0:return"*";case 1:return"?";case 2:return"+";case 3:return""}}function nt(t,e,r={}){r.delimiter??="/#?",r.prefixes??="./",r.sensitive??=!1,r.strict??=!1,r.end??=!0,r.start??=!0,r.endsWith="";let n=r.start?"^":"";for(let o of t){if(o.type===3){o.modifier===3?n+=R(o.value):n+=`(?:${R(o.value)})${ne(o.modifier)}`;continue}e&&e.push(o.name);let u=`[^${R(r.delimiter)}]+?`,c=o.value;if(o.type===1?c=u:o.type===0&&(c=Ze),!o.prefix.length&&!o.suffix.length){o.modifier===3||o.modifier===1?n+=`(${c})${ne(o.modifier)}`:n+=`((?:${c})${ne(o.modifier)})`;continue}if(o.modifier===3||o.modifier===1){n+=`(?:${R(o.prefix)}(${c})${R(o.suffix)})`,n+=ne(o.modifier);continue}n+=`(?:${R(o.prefix)}`,n+=`((?:${c})(?:`,n+=R(o.suffix),n+=R(o.prefix),n+=`(?:${c}))*)${R(o.suffix)})`,o.modifier===0&&(n+="?")}let s=`[${R(r.endsWith)}]|$`,i=`[${R(r.delimiter)}]`;if(r.end)return r.strict||(n+=`${i}?`),r.endsWith.length?n+=`(?=${s})`:n+="$",new RegExp(n,Ye(r));r.strict||(n+=`(?:${i}(?=${s}))?`);let a=!1;if(t.length){let o=t[t.length-1];o.type===3&&o.modifier===3&&(a=r.delimiter.indexOf(o)>-1)}return a||(n+=`(?=${i}|${s})`),new RegExp(n,Ye(r))}function qt(t,e){return t.length?t[0]==="/"?!0:!e||t.length<2?!1:(t[0]=="\\"||t[0]=="{")&&t[1]=="/":!1}function st(t,e){return t.startsWith(e)?t.substring(e.length,t.length):t}function Nt(t,e){return t.endsWith(e)?t.substr(0,t.length-e.length):t}function ot(t){return!t||t.length<2?!1:t[0]==="["||(t[0]==="\\"||t[0]==="{")&&t[1]==="["}function it(t){if(!t)return!0;for(let e of Ut)if(t.test(e))return!0;return!1}function Ft(t,e){if(t=st(t,"#"),e||t==="")return t;let r=new URL("https://example.com");return r.hash=t,r.hash?r.hash.substring(1,r.hash.length):""}function Ht(t,e){if(t=st(t,"?"),e||t==="")return t;let r=new URL("https://example.com");return r.search=t,r.search?r.search.substring(1,r.search.length):""}function Wt(t,e){return e||t===""?t:ot(t)?ut(t):ct(t)}function Bt(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.password=t,r.password}function zt(t,e){if(e||t==="")return t;let r=new URL("https://example.com");return r.username=t,r.username}function Vt(t,e,r){if(r||t==="")return t;if(e&&!Ut.includes(e))return new URL(`${e}:${t}`).pathname;let n=t[0]=="/";return t=new URL(n?t:"/-"+t,"https://example.com").pathname,n||(t=t.substring(2,t.length)),t}function Gt(t,e,r){return at(e)===t&&(t=""),r||t===""?t:ft(t)}function Jt(t,e){return t=Nt(t,":"),e||t===""?t:Le(t)}function at(t){switch(t){case"ws":case"http":return"80";case"wws":case"https":return"443";case"ftp":return"21";default:return""}}function Le(t){if(t==="")return t;if(/^[-+.A-Za-z0-9]*$/.test(t))return t.toLowerCase();throw new TypeError(`Invalid protocol '${t}'.`)}function Kt(t){if(t==="")return t;let e=new URL("https://example.com");return e.username=t,e.username}function Xt(t){if(t==="")return t;let e=new URL("https://example.com");return e.password=t,e.password}function ct(t){if(t==="")return t;if(/[\t\n\r #%/:<>?@[\]^\\|]/g.test(t))throw new TypeError(`Invalid hostname '${t}'`);let e=new URL("https://example.com");return e.hostname=t,e.hostname}function ut(t){if(t==="")return t;if(/[^0-9a-fA-F[\]:]/g.test(t))throw new TypeError(`Invalid IPv6 hostname '${t}'`);return t.toLowerCase()}function ft(t){if(t===""||/^[0-9]*$/.test(t)&&parseInt(t)<=65535)return t;throw new TypeError(`Invalid port '${t}'.`)}function Qt(t){if(t==="")return t;let e=new URL("https://example.com");return e.pathname=t[0]!=="/"?"/-"+t:t,t[0]!=="/"?e.pathname.substring(2,e.pathname.length):e.pathname}function Zt(t){return t===""?t:new URL(`data:${t}`).pathname}function Yt(t){if(t==="")return t;let e=new URL("https://example.com");return e.search=t,e.search.substring(1,e.search.length)}function er(t){if(t==="")return t;let e=new URL("https://example.com");return e.hash=t,e.hash.substring(1,e.hash.length)}function et(t,e){if(typeof t!="string")throw new TypeError("parameter 1 is not of type 'string'.");let r=new URL(t,e);return{protocol:r.protocol.substring(0,r.protocol.length-1),username:r.username,password:r.password,hostname:r.hostname,port:r.port,pathname:r.pathname,search:r.search!==""?r.search.substring(1,r.search.length):void 0,hash:r.hash!==""?r.hash.substring(1,r.hash.length):void 0}}function F(t,e){return e?we(t):t}function ye(t,e,r){let n;if(typeof e.baseURL=="string")try{n=new URL(e.baseURL),e.protocol===void 0&&(t.protocol=F(n.protocol.substring(0,n.protocol.length-1),r)),!r&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&(t.username=F(n.username,r)),!r&&e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.username===void 0&&e.password===void 0&&(t.password=F(n.password,r)),e.protocol===void 0&&e.hostname===void 0&&(t.hostname=F(n.hostname,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&(t.port=F(n.port,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&(t.pathname=F(n.pathname,r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&(t.search=F(n.search.substring(1,n.search.length),r)),e.protocol===void 0&&e.hostname===void 0&&e.port===void 0&&e.pathname===void 0&&e.search===void 0&&e.hash===void 0&&(t.hash=F(n.hash.substring(1,n.hash.length),r))}catch{throw new TypeError(`invalid baseURL '${e.baseURL}'.`)}if(typeof e.protocol=="string"&&(t.protocol=Jt(e.protocol,r)),typeof e.username=="string"&&(t.username=zt(e.username,r)),typeof e.password=="string"&&(t.password=Bt(e.password,r)),typeof e.hostname=="string"&&(t.hostname=Wt(e.hostname,r)),typeof e.port=="string"&&(t.port=Gt(e.port,t.protocol,r)),typeof e.pathname=="string"){if(t.pathname=e.pathname,n&&!qt(t.pathname,r)){let s=n.pathname.lastIndexOf("/");s>=0&&(t.pathname=F(n.pathname.substring(0,s+1),r)+t.pathname)}t.pathname=Vt(t.pathname,t.protocol,r)}return typeof e.search=="string"&&(t.search=Ht(e.search,r)),typeof e.hash=="string"&&(t.hash=Ft(e.hash,r)),t}function we(t){return t.replace(/([+*?:{}()\\])/g,"\\$1")}function rr(t){return t.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function nr(t,e){e.delimiter??="/#?",e.prefixes??="./",e.sensitive??=!1,e.strict??=!1,e.end??=!0,e.start??=!0,e.endsWith="";let r=".*",n=`[^${rr(e.delimiter)}]+?`,s=/[$_\u200C\u200D\p{ID_Continue}]/u,i="";for(let a=0;a<t.length;++a){let o=t[a];if(o.type===3){if(o.modifier===3){i+=we(o.value);continue}i+=`{${we(o.value)}}${ne(o.modifier)}`;continue}let u=o.hasCustomName(),c=!!o.suffix.length||!!o.prefix.length&&(o.prefix.length!==1||!e.prefixes.includes(o.prefix)),f=a>0?t[a-1]:null,l=a<t.length-1?t[a+1]:null;if(!c&&u&&o.type===1&&o.modifier===3&&l&&!l.prefix.length&&!l.suffix.length)if(l.type===3){let p=l.value.length>0?l.value[0]:"";c=s.test(p)}else c=!l.hasCustomName();if(!c&&!o.prefix.length&&f&&f.type===3){let p=f.value[f.value.length-1];c=e.prefixes.includes(p)}c&&(i+="{"),i+=we(o.prefix),u&&(i+=`:${o.name}`),o.type===2?i+=`(${o.value})`:o.type===1?u||(i+=`(${n})`):o.type===0&&(!u&&(!f||f.type===3||f.modifier!==3||c||o.prefix!=="")?i+="*":i+=`(${r})`),o.type===1&&u&&o.suffix.length&&s.test(o.suffix[0])&&(i+="\\"),i+=we(o.suffix),c&&(i+="}"),o.modifier!==3&&(i+=ne(o.modifier))}return i}var Rr,y,be,jr,Tr,Ze,te,Ir,Lr,Ut,tr,Qe,ee,De,sr=Tt(()=>{Rr=Object.defineProperty,y=(t,e)=>Rr(t,"name",{value:e,configurable:!0}),be=class{type=3;name="";prefix="";value="";suffix="";modifier=3;constructor(t,e,r,n,s,i){this.type=t,this.name=e,this.prefix=r,this.value=n,this.suffix=s,this.modifier=i}hasCustomName(){return this.name!==""&&typeof this.name!="number"}};y(be,"Part");jr=/[$_\p{ID_Start}]/u,Tr=/[$_\u200C\u200D\p{ID_Continue}]/u,Ze=".*";y(Dt,"isASCII");y(tt,"lexer");y(rt,"parse");y(R,"escapeString");y(Ye,"flags");y(kt,"stringToRegexp");y(ne,"modifierToString");y(nt,"partsToRegexp");te={delimiter:"",prefixes:"",sensitive:!0,strict:!0},Ir={delimiter:".",prefixes:"",sensitive:!0,strict:!0},Lr={delimiter:"/",prefixes:"/",sensitive:!0,strict:!0};y(qt,"isAbsolutePathname");y(st,"maybeStripPrefix");y(Nt,"maybeStripSuffix");y(ot,"treatAsIPv6Hostname");Ut=["ftp","file","http","https","ws","wss"];y(it,"isSpecialScheme");y(Ft,"canonicalizeHash");y(Ht,"canonicalizeSearch");y(Wt,"canonicalizeHostname");y(Bt,"canonicalizePassword");y(zt,"canonicalizeUsername");y(Vt,"canonicalizePathname");y(Gt,"canonicalizePort");y(Jt,"canonicalizeProtocol");y(at,"defaultPortForProtocol");y(Le,"protocolEncodeCallback");y(Kt,"usernameEncodeCallback");y(Xt,"passwordEncodeCallback");y(ct,"hostnameEncodeCallback");y(ut,"ipv6HostnameEncodeCallback");y(ft,"portEncodeCallback");y(Qt,"standardURLPathnameEncodeCallback");y(Zt,"pathURLPathnameEncodeCallback");y(Yt,"searchEncodeCallback");y(er,"hashEncodeCallback");tr=class{#r;#t=[];#n={};#e=0;#o=1;#a=0;#i=0;#u=0;#h=0;#c=!1;constructor(t){this.#r=t}get result(){return this.#n}parse(){for(this.#t=tt(this.#r,!0);this.#e<this.#t.length;this.#e+=this.#o){if(this.#o=1,this.#t[this.#e].type==="END"){if(this.#i===0){this.#g(),this.#m()?this.#s(9,1):this.#y()?this.#s(8,1):this.#s(7,0);continue}else if(this.#i===2){this.#f(5);continue}this.#s(10,0);break}if(this.#u>0)if(this.#O())this.#u-=1;else continue;if(this.#S()){this.#u+=1;continue}switch(this.#i){case 0:this.#_()&&this.#f(1);break;case 1:if(this.#_()){this.#M();let t=7,e=1;this.#v()?(t=2,e=3):this.#c&&(t=2),this.#s(t,e)}break;case 2:this.#b()?this.#f(3):(this.#x()||this.#y()||this.#m())&&this.#f(5);break;case 3:this.#P()?this.#s(4,1):this.#b()&&this.#s(5,1);break;case 4:this.#b()&&this.#s(5,1);break;case 5:this.#A()?this.#h+=1:this.#C()&&(this.#h-=1),this.#E()&&!this.#h?this.#s(6,1):this.#x()?this.#s(7,0):this.#y()?this.#s(8,1):this.#m()&&this.#s(9,1);break;case 6:this.#x()?this.#s(7,0):this.#y()?this.#s(8,1):this.#m()&&this.#s(9,1);break;case 7:this.#y()?this.#s(8,1):this.#m()&&this.#s(9,1);break;case 8:this.#m()&&this.#s(9,1);break;case 9:break;case 10:break}}this.#n.hostname!==void 0&&this.#n.port===void 0&&(this.#n.port="")}#s(t,e){switch(this.#i){case 0:break;case 1:this.#n.protocol=this.#p();break;case 2:break;case 3:this.#n.username=this.#p();break;case 4:this.#n.password=this.#p();break;case 5:this.#n.hostname=this.#p();break;case 6:this.#n.port=this.#p();break;case 7:this.#n.pathname=this.#p();break;case 8:this.#n.search=this.#p();break;case 9:this.#n.hash=this.#p();break;case 10:break}this.#i!==0&&t!==10&&([1,2,3,4].includes(this.#i)&&[6,7,8,9].includes(t)&&(this.#n.hostname??=""),[1,2,3,4,5,6].includes(this.#i)&&[8,9].includes(t)&&(this.#n.pathname??=this.#c?"/":""),[1,2,3,4,5,6,7].includes(this.#i)&&t===9&&(this.#n.search??="")),this.#d(t,e)}#d(t,e){this.#i=t,this.#a=this.#e+e,this.#e+=e,this.#o=0}#g(){this.#e=this.#a,this.#o=0}#f(t){this.#g(),this.#i=t}#w(t){return t<0&&(t=this.#t.length-t),t<this.#t.length?this.#t[t]:this.#t[this.#t.length-1]}#l(t,e){let r=this.#w(t);return r.value===e&&(r.type==="CHAR"||r.type==="ESCAPED_CHAR"||r.type==="INVALID_CHAR")}#_(){return this.#l(this.#e,":")}#v(){return this.#l(this.#e+1,"/")&&this.#l(this.#e+2,"/")}#b(){return this.#l(this.#e,"@")}#P(){return this.#l(this.#e,":")}#E(){return this.#l(this.#e,":")}#x(){return this.#l(this.#e,"/")}#y(){if(this.#l(this.#e,"?"))return!0;if(this.#t[this.#e].value!=="?")return!1;let t=this.#w(this.#e-1);return t.type!=="NAME"&&t.type!=="REGEX"&&t.type!=="CLOSE"&&t.type!=="ASTERISK"}#m(){return this.#l(this.#e,"#")}#S(){return this.#t[this.#e].type=="OPEN"}#O(){return this.#t[this.#e].type=="CLOSE"}#A(){return this.#l(this.#e,"[")}#C(){return this.#l(this.#e,"]")}#p(){let t=this.#t[this.#e],e=this.#w(this.#a).index;return this.#r.substring(e,t.index)}#M(){let t={};Object.assign(t,te),t.encodePart=Le;let e=kt(this.#p(),void 0,t);this.#c=it(e)}};y(tr,"Parser");Qe=["protocol","username","password","hostname","port","pathname","search","hash"],ee="*";y(et,"extractValues");y(F,"processBaseURLString");y(ye,"applyInit");y(we,"escapePatternString");y(rr,"escapeRegexpString");y(nr,"partsToPattern");De=class{#r;#t={};#n={};#e={};#o={};#a=!1;constructor(t={},e,r){try{let n;if(typeof e=="string"?n=e:r=e,typeof t=="string"){let o=new tr(t);if(o.parse(),t=o.result,n===void 0&&typeof t.protocol!="string")throw new TypeError("A base URL must be provided for a relative constructor string.");t.baseURL=n}else{if(!t||typeof t!="object")throw new TypeError("parameter 1 is not of type 'string' and cannot convert to dictionary.");if(n)throw new TypeError("parameter 1 is not of type 'string'.")}typeof r>"u"&&(r={ignoreCase:!1});let s={ignoreCase:r.ignoreCase===!0},i={pathname:ee,protocol:ee,username:ee,password:ee,hostname:ee,port:ee,search:ee,hash:ee};this.#r=ye(i,t,!0),at(this.#r.protocol)===this.#r.port&&(this.#r.port="");let a;for(a of Qe){if(!(a in this.#r))continue;let o={},u=this.#r[a];switch(this.#n[a]=[],a){case"protocol":Object.assign(o,te),o.encodePart=Le;break;case"username":Object.assign(o,te),o.encodePart=Kt;break;case"password":Object.assign(o,te),o.encodePart=Xt;break;case"hostname":Object.assign(o,Ir),ot(u)?o.encodePart=ut:o.encodePart=ct;break;case"port":Object.assign(o,te),o.encodePart=ft;break;case"pathname":it(this.#t.protocol)?(Object.assign(o,Lr,s),o.encodePart=Qt):(Object.assign(o,te,s),o.encodePart=Zt);break;case"search":Object.assign(o,te,s),o.encodePart=Yt;break;case"hash":Object.assign(o,te,s),o.encodePart=er;break}try{this.#o[a]=rt(u,o),this.#t[a]=nt(this.#o[a],this.#n[a],o),this.#e[a]=nr(this.#o[a],o),this.#a=this.#a||this.#o[a].some(c=>c.type===2)}catch{throw new TypeError(`invalid ${a} pattern '${this.#r[a]}'.`)}}}catch(n){throw new TypeError(`Failed to construct 'URLPattern': ${n.message}`)}}get[Symbol.toStringTag](){return"URLPattern"}test(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return!1;try{typeof t=="object"?r=ye(r,t,!1):r=ye(r,et(t,e),!1)}catch{return!1}let n;for(n of Qe)if(!this.#t[n].exec(r[n]))return!1;return!0}exec(t={},e){let r={pathname:"",protocol:"",username:"",password:"",hostname:"",port:"",search:"",hash:""};if(typeof t!="string"&&e)throw new TypeError("parameter 1 is not of type 'string'.");if(typeof t>"u")return;try{typeof t=="object"?r=ye(r,t,!1):r=ye(r,et(t,e),!1)}catch{return null}let n={};e?n.inputs=[t,e]:n.inputs=[t];let s;for(s of Qe){let i=this.#t[s].exec(r[s]);if(!i)return null;let a={};for(let[o,u]of this.#n[s].entries())if(typeof u=="string"||typeof u=="number"){let c=i[o+1];a[u]=c}n[s]={input:r[s]??"",groups:a}}return n}static compareComponent(t,e,r){let n=y((o,u)=>{for(let c of["type","modifier","prefix","value","suffix"]){if(o[c]<u[c])return-1;if(o[c]!==u[c])return 1}return 0},"comparePart"),s=new be(3,"","","","",3),i=new be(0,"","","","",3),a=y((o,u)=>{let c=0;for(;c<Math.min(o.length,u.length);++c){let f=n(o[c],u[c]);if(f)return f}return o.length===u.length?0:n(o[c]??s,u[c]??s)},"comparePartList");return!e.#e[t]&&!r.#e[t]?0:e.#e[t]&&!r.#e[t]?a(e.#o[t],[i]):!e.#e[t]&&r.#e[t]?a([i],r.#o[t]):a(e.#o[t],r.#o[t])}get protocol(){return this.#e.protocol}get username(){return this.#e.username}get password(){return this.#e.password}get hostname(){return this.#e.hostname}get port(){return this.#e.port}get pathname(){return this.#e.pathname}get search(){return this.#e.search}get hash(){return this.#e.hash}get hasRegExpGroups(){return this.#a}};y(De,"URLPattern")});var or={};Re(or,{URLPattern:()=>De});var ir=Tt(()=>{sr();globalThis.URLPattern||(globalThis.URLPattern=De)});var jt={};Re(jt,{FormDataPlus:()=>B,HeadersPlus:()=>z,LiveResponse:()=>ze,Observer:()=>lr,RequestPlus:()=>He,ResponsePlus:()=>V,fetchPlus:()=>gr});function v(t){return!Array.isArray(t)&&typeof t=="object"&&t}function pe(t){return typeof t}function I(t){return Array.isArray(t)}function je(t){return t===!0||t===!1}function de(t){return typeof t=="function"}function Ve(t){return t===null||t===""}function re(t){return arguments.length&&(t===void 0||typeof t>"u")}function x(t){return Array.isArray(t)||typeof t=="object"&&t||de(t)}function Ge(t){return Ve(t)||re(t)||t===!1||t===0||x(t)&&!Object.keys(t).length}function G(t){return de(t)||t&&{}.toString.call(t)==="[object function]"}function me(t){return t instanceof Number||typeof t=="number"}function J(t){return me(t)||t!==!0&&t!==!1&&t!==null&&t!==""&&!isNaN(t*1)}function Je(t){return I(t)&&Object.getPrototypeOf(t)===Array.prototype}function Ke(t){return v(t)&&Object.getPrototypeOf(t)===Object.prototype}function K(t){return t instanceof String||typeof t=="string"&&t!==null}function Xe(t){return!K(t)&&!re(t.length)}function k(t,...e){if(!t||!["object","function"].includes(typeof t))throw new Error("Argument #1 must be of type object");let r=t[Symbol.for("wq")];if(r||(r=new Te,Object.defineProperty(t,Symbol.for("wq"),{value:r,enumerable:!1,configurable:!1,writable:!1})),!e.length)return r;let n,s;for(;n=e.shift();)(s=r)&&!(r=r.get(n))&&(r=new Te,s.set(n,r));return r}var Te=class extends Map{};function ge(t,e,r=!1){if(e=="")return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?"":t.substr(n+e.length)}function Ie(t,e,r=!1){if(e=="")return t;var n=r?t.lastIndexOf(e):t.indexOf(e);return n===-1?t:t.substr(0,n)}(async()=>typeof URLPattern>"u"&&await Promise.resolve().then(()=>(ir(),or)))();var lt=class extends URLPattern{#r;constructor(e,r=null){typeof e=="object"&&e?.baseURL&&({baseURL:r,...e}=e),super(e,r),this.#r=new URL(e,r)}isPattern(){let e=(s,i)=>{if(!s)return!1;let a=!1;for(let o of s){if(a){a=!1;continue}if(o==="\\"){a=!0;continue}if(i.has(o))return!0}return!1},r={protocol:new Set(["*"]),username:new Set(["*"]),password:new Set(["*"]),hostname:new Set(["*","{"]),port:new Set(["*","{"]),pathname:new Set(["*",":","{","("]),search:new Set(["*","{"]),hash:new Set(["*","{"])},n=this.#r;return e(n.protocol,r.protocol)||e(n.username,r.username)||e(n.password,r.password)||e(n.hostname,r.hostname)||e(n.port,r.port)||e(n.pathname,r.pathname)||e(n.search,r.search)||e(n.hash,r.hash)}exec(...e){let r=super.exec(...e);if(!r)return;let n={};for(let a of Object.values(r))a?.groups&&Object.assign(n,a.groups);let s={named:n};return{...r,vars:s,render:a=>a.replace(/\$(\$|[A-Z0-9_]+)/gi,(o,u)=>u==="$"?"$":s.named[u]??"")}}};var Ot={};Re(Ot,{any:()=>Kr,apply:()=>xt,batch:()=>St,construct:()=>bt,defineProperties:()=>Yr,defineProperty:()=>Oe,deleteProperties:()=>en,deleteProperty:()=>Ae,get:()=>Q,getOwnPropertyDescriptor:()=>qe,getOwnPropertyDescriptors:()=>Qr,getPrototypeOf:()=>gt,has:()=>Ne,intercept:()=>Xr,isExtensible:()=>yt,map:()=>Zr,observe:()=>Et,ownKeys:()=>wt,path:()=>Gr,preventExtensions:()=>vt,reduce:()=>Pt,set:()=>ie,setPrototypeOf:()=>_t,subtree:()=>Jr});function H(t,e=!0){return I(t)?t:!e&&v(t)?[t]:t!==!1&&t!==0&&Ge(t)?[]:Xe(t)?Array.prototype.slice.call(t):v(t)?Object.values(t):[t]}var O=(t,...e)=>k(t,"observerAPI",...e),xe=(t,e)=>t instanceof Promise?t.then(e):e(t),ke={};var se=class{constructor(e,r){this.registry=e,Object.assign(this,{...r,target:e.target}),this.params.signal&&this.params.signal.addEventListener("abort",()=>this.remove())}remove(){return this.removed=!0,this.registry.removeRegistration(this)}};var Pe=class extends se{constructor(){super(...arguments),this.emit.currentRegistration=this,Object.defineProperty(this,"abortController",{value:new AbortController}),Object.defineProperty(this,"signal",{value:this.abortController.signal}),ke.setMaxListeners?.(0,this.signal)}remove(){this.abortController.abort(),super.remove()}fire(e){if(this.emit.recursionTarget&&!["inject","force-async","force-sync"].includes(this.params.recursions))return;let r=e,n=this.filter;if(n!==1/0&&(n=H(n,!1))&&(r=e.filter(i=>n.includes(i.key))),this.params.diff&&(r=r.filter(i=>i.type!=="set"||i.value!==i.oldValue)),!r.length)return;if(["inject","defer"].includes(this.params.recursions)){if(this.emit.recursionTarget){this.emit.recursionTarget.push(...r);return}this.emit.recursionTarget=this.params.recursions==="inject"?r:[]}let s=this.filter===1/0||Array.isArray(this.filter)?this.emit(r,this):this.emit(r[0],this);return xe(s,i=>{let a=this.emit.recursionTarget;return delete this.emit.recursionTarget,this.params.recursions==="defer"&&a?.length?this.emit.currentRegistration.fire(a):i})}};var oe=class{constructor(e){this.target=e,this.entries=[]}addRegistration(e){return this.entries.push(e),e}removeRegistration(e){this.entries=this.entries.filter(r=>r!==e)}static _getInstance(e,r,n=!0,s=this.__namespace){if(!x(r))throw new Error(`Subject must be of type object; "${pe(r)}" given!`);let i=this;return s&&O(globalThis,"observerAPI","namespaces").has(e+"-"+s)&&(i=O(globalThis,"observerAPI","namespaces").get(e+"-"+s),e+="-"+s),!O(r,"registry").has(e)&&n&&O(r,"registry").set(e,new i(r)),O(r,"registry").get(e)}static _namespace(e,r,n=null){if(e+="-"+r,arguments.length===2)return O(globalThis,"observerAPI","namespaces").get(e);if(!(n.prototype instanceof this))throw new Error(`The implementation of the namespace ${this.name}.${r} must be a subclass of ${this.name}.`);O(globalThis,"observerAPI","namespaces").set(e,n),n.__namespace=r}};var A=class{constructor(e,r){if(this.target=e,!r.operation)throw new Error("Descriptor operation must be given in definition!");Object.assign(this,r)}};var L=class extends oe{static getInstance(e,r=!0,n=null){return super._getInstance("listeners",...arguments)}static namespace(e,r=null){return super._namespace("listeners",...arguments)}constructor(e){super(e),this.batches=[]}addRegistration(e,r,n){return super.addRegistration(new Pe(this,{filter:e,emit:r,params:n}))}emit(e,{eventsArePropertyDescriptors:r=!1,eventIsArrayMethodDescriptor:n=!1}={}){if(this.batches.length){let s=this.batches[0].params.arrayMethodName;this.batches[0].snapshots.push({events:[...e],arrayMethodName:s,eventsArePropertyDescriptors:r,eventIsArrayMethodDescriptor:n});return}this.$emit(this.entries,[{events:e,eventsArePropertyDescriptors:r,eventIsArrayMethodDescriptor:n}])}$emit(e,r){let n=0,s=0,i=0;for(let f of e)n+=1,f.params.withPropertyDescriptors&&(s+=1),f.params.withArrayMethodDescriptors&&(i+=1);let a=[],o=[],u=[],c=[];for(let f of r){let l=f.arrayMethodName,p=f.eventsArePropertyDescriptors,m=f.eventIsArrayMethodDescriptor;for(let h of f.events)if(l&&(h.operation=l),s&&(i&&a.push(h),m||i!==n&&o.push(h)),s!==n){let g=h;if(p){let{target:b,type:_,...w}=h;g=new A(b,{type:"set",...w}),Object.defineProperty(g,"value","get"in w.value?{get:()=>w.value.get()}:{value:w.value.value}),w.oldValue&&Object.defineProperty(g,"oldValue","get"in w.oldValue?{get:()=>w.oldValue.get()}:{value:w.oldValue.value})}i&&u.push(g),m||i!==n&&c.push(g)}}for(let f of e)f.params.withPropertyDescriptors?f.params.withArrayMethodDescriptors?a.length&&f.fire(a):o.length&&f.fire(o):f.params.withArrayMethodDescriptors?u.length&&f.fire(u):c.length&&f.fire(c)}batch(e,r={}){this.batches.unshift({entries:[...this.entries],snapshots:[],params:r});let n=e();return xe(n,s=>{let i=this.batches.shift();return i.snapshots.length&&this.$emit(i.entries,i.snapshots),s})}};var Ee=class extends se{exec(e,r,n){return this.running||!this.traps[e.operation]?r(...Array.prototype.slice.call(arguments,2)):(this.running=!0,this.traps[e.operation](e,n,(...s)=>(this.running=!1,r(...s))))}};var X=class extends oe{static getInstance(e,r=!0,n=null){return super._getInstance("traps",...arguments)}static namespace(e,r=null){return super._namespace("traps",...arguments)}addRegistration(e){return super.addRegistration(new Ee(this,e))}emit(e,r=null){let n=this;return function s(i,...a){let o=n.entries[i];return o?o.exec(e,(...u)=>s(i+1,...u),...a):r?r(e,...a):a[0]}(0)}};var mt={};Re(mt,{accessorize:()=>zr,proxy:()=>pt,unaccessorize:()=>Vr,unproxy:()=>Se});var ur=Symbol("wqOriginal");function zr(t,e,r={}){t=dt(t);let n=O(t,"accessorizedProps");function s(u){let c,f=t;do c=Object.getOwnPropertyDescriptor(f,u);while(!c&&(f=Object.getPrototypeOf(f)));return c?{proto:f,descriptor:c}:{descriptor:{value:void 0,configurable:!0,enumerable:!0,writable:!0}}}function i(u){if(n.has(u+""))return!0;let c=s(u);c.getValue=function(p=!1){return p?this.descriptor:this.descriptor.get?this.descriptor.get():this.descriptor.value},c.setValue=function(p,m=!1){if(this.dirty=!0,m){this.descriptor=p;return}return this.descriptor.set?this.descriptor.set(p)!==!1:(this.descriptor.value=p,!0)},c.intact=function(){let p=Object.getOwnPropertyDescriptor(t,u);return p?.get===l.get&&p?.set===l.set&&n.get(u+"")===this},c.restore=function(){return this.intact()?(this.proto&&this.proto!==t||!this.proto&&!this.dirty?delete t[u]:Object.defineProperty(t,u,this.descriptor),n.delete(u+""),!0):!1},n.set(isNaN(u)?u:parseInt(u),c);let{enumerable:f=!0}=c.descriptor,l={enumerable:f,configurable:!0};("value"in c.descriptor||c.descriptor.set)&&(l.set=function(p){return ie(this,u,p,r)}),("value"in c.descriptor||c.descriptor.get)&&(l.get=function(){return Q(this,u,r)});try{return Object.defineProperty(t,u,l),!0}catch{return n.delete(u+""),!1}}let o=(Array.isArray(e)?e:e===void 0?Object.keys(t):[e]).map(i);return e===void 0||Array.isArray(e)?o:o[0]}function Vr(t,e,r={}){t=dt(t);let n=O(t,"accessorizedProps");function s(o){return n.has(o+"")?n.get(o+"").restore():!0}let a=(Array.isArray(e)?e:e===void 0?Object.keys(t):[e]).map(s);return e===void 0||Array.isArray(e)?a:a[0]}function pt(t,e={},r=void 0){let n=dt(t);if(typeof e.membrane=="boolean")throw new Error("The params.membrane parameter cannot be of type boolean.");if(e.membrane&&O(n,"membraneRef").has(e.membrane))return O(n,"membraneRef").get(e.membrane);let s={apply:(o,u,c)=>xt(o,u,c,void 0,e),construct:(o,u,c=null)=>bt(o,u,c,e),defineProperty:(o,u,c)=>Oe(o,u,c,e),deleteProperty:(o,u)=>Ae(o,u,e),get:(o,u,c=null)=>{if(u===ur)return n;let f={...e,receiver:c},l=Q(o,u,f);return Array.isArray(o)&&typeof l=="function"&&!/^class\s?/.test(Function.prototype.toString.call(l))?pt(l,{...e,arrayMethodName:u,membrane:c},r):e.chainable&&x(l)&&u!=="prototype"&&!(typeof l=="function"&&/^class\s?|\{\s\[native\scode\]\s\}$/.test(Function.prototype.toString.call(l)))?pt(l,e,r):l},getOwnPropertyDescriptor:(o,u)=>qe(o,u,e),getPrototypeOf:o=>gt(o,e),has:(o,u)=>Ne(o,u,e),isExtensible:o=>yt(o,e),ownKeys:o=>wt(o,e),preventExtensions:o=>vt(o,e),set:(o,u,c,f=null)=>ie(o,u,c,{...e,receiver:f}),setPrototypeOf:(o,u)=>_t(o,u,e)},i=r?.(s)||s,a=new Proxy(n,i);return e.membrane&&O(n,"membraneRef").set(e.membrane,a),a}function Se(t){return t&&t[ur]||t}function dt(t){if(!t||!x(t))throw new Error("Target must be of type object!");return Se(t)}var Ce=class extends Array{};function Gr(...t){return new Ce(...t)}var ae=class extends Array{};function Jr(){return new ae}function Kr(){return 1/0}function Pt(t,e,r,n=i=>i,s={}){let i=e instanceof ae;if(!(!i&&!e?.length))return function a(o,u,c,f){let l=f||u[c.level]instanceof ae,p=l?1/0:u[c.level],m=l?!1:c.level===u.length-1;return o instanceof A&&o.operation!=="get"?c={...c,probe:"always"}:c.probe!=="always"&&(c={...c,probe:!m}),r(o,p,(h,...g)=>{let b=d=>{d instanceof A&&(d.path="key"in d?[d.key]:[],o instanceof A&&(d.path="key"in d?o.path.concat(d.key):o.path.slice(0),Object.defineProperty(d,"context",{get:()=>o,configurable:!0})))},_=g[0]||{},w=d=>{if(d instanceof A&&"argumentsList"in d)return;let P=W(d,!1);return xe(P,E=>(d instanceof A?d.value=E:d=E,a(d,u,{...c,..._,keyInParent:d.key,level:c.level+1},l)))};if(Me(p)&&Array.isArray(h)){if(h.forEach(b),m)return n(h,...g);l&&h[0]instanceof A&&(h[0].operation!=="get"||s.asGet)&&n(h,...g);for(let d of h)w(d);return}return b(h),m?n(h,...g):w(h)},c)}(t,e.slice(0),{...s,level:0},i)}function Et(t,e,r,n={}){let s=W(t,!n.level);if(G(arguments[1])&&([,r,n={}]=arguments,e=1/0),!G(r))throw new Error(`Handler must be a function; "${pe(r)}" given!`);if(e instanceof Ce||e instanceof ae)return Pt(s,e,Et,r,n);if(n={...n,descripted:!0},delete n.live,!x(s))return n.probe&&Q(s,e,r,n)||void 0;let i=fr(s,e,r,n);return n.probe?Q(s,e,i,n):i()}function Xr(t,e,r={}){let n=W(t);return v(e)||([,,,r={}]=arguments,e={[arguments[1]]:arguments[2]}),X.getInstance(n,!0,r.namespace).addRegistration({traps:e,params:r})}function qe(t,e,r=s=>s,n={}){return q(t,"getOwnPropertyDescriptor",{key:e},r,n)}function Qr(t,e,r=s=>s,n={}){return q(t,"getOwnPropertyDescriptors",{key:e},r,n)}function gt(t,e=n=>n,r={}){return q(t,"getPrototypeOf",{},e,r)}function yt(t,e=n=>n,r={}){return q(t,"isExtensible",{},e,r)}function wt(t,e=n=>n,r={}){return q(t,"ownKeys",{},e,r)}function Ne(t,e,r=s=>s,n={}){return q(t,"has",{key:e},r,n)}function Q(t,e,r=s=>s,n={}){let s,i=W(t,!n.level);return v(r)?[n,r]=[r,a=>a]:n.live&&(s=!0),e instanceof Ce||e instanceof ae?Pt(i,e,Q,r,{...n,asGet:!0}):tn(i,e,a=>{let o=[...a];return function u(c,f,l){if(!f.length)return l(c);let p=f.shift();if(!["string","number","symbol"].includes(typeof p))throw new Error(`Property name/key ${p} invalid.`);function m(b,_=void 0){let w=E=>(b.value=E,u([...c,n.live||n.descripted?b:E],f,l));if(arguments.length>1)return w(_);if(!x(i))return w(i?.[b.key]);let d=O(i,"accessorizedProps",!1),P=d&&d.get(b.key);if(P&&P.intact())return w(P.getValue(n.withPropertyDescriptors));if(n.withPropertyDescriptors){let E=Object.getOwnPropertyDescriptor(i,b.key);return w(E)}return w(Reflect.get(i,b.key))}let h=new A(i,{type:"get",key:p,value:void 0,operation:"get",related:o});if(!x(i))return m(h);let g=X.getInstance(i,!1,n.namespace);return g?g.emit(h,m):m(h)}([],a.slice(0),u=>{let c=Me(e)?u:u[0];return s&&x(i)?fr(i,e,r,n,t.key)(c):r(c)})},n)}function St(t,e,r={}){let n=W(t);return L.getInstance(n,!0,r.namespace).batch(e,r)}function Zr(t,e,r={}){e=W(e),t=W(t);let n=(r.only||[]).slice(0),s=(r.except||[]).slice(0),i=Object.keys(r.spread?[...t]:t).map(c=>isNaN(c)?c:parseInt(c)),a=n.length?n.filter(c=>i.includes(c)):i.filter(c=>!s.includes(c)),o=c=>!Array.isArray(e)||isNaN(c)?c:c-s.filter(f=>f<c).length,u=c=>{let f=qe(t,c,r);"value"in f&&f.writable&&f.enumerable&&f.configurable?ie(e,o(c),f.value,r):(f.enumerable||r.onlyEnumerable===!1)&&Oe(e,c,{...f,configurable:!0},r)};return St(e,()=>{a.forEach(u)}),Et(t,c=>{c.filter(f=>n.length?n.includes(f.key):!s.includes(f.key)).forEach(f=>{if(f.type==="delete")return Ae(e,o(f.key),r);if(f.type==="def"){(f.value.enumerable||r.onlyEnumerable===!1)&&Oe(e,o(f.key),{...f.value,configurable:!0},r);return}u(f.key)})},{...r,withPropertyDescriptors:!0})}function ie(t,e,r,n=a=>a,s={},i=!1){let a=W(t),o=[[e,r]];v(e)&&([,,n=c=>c,s={},i=!1]=arguments,o=Object.entries(e)),v(n)&&([i,s,n]=[typeof s=="boolean"?s:i,n,c=>c]);let u=o.map(([c])=>c);return function c(f,l,p){if(!l.length)return p(f);let[m,h]=l.shift();function g(_,w=void 0){let d=N=>(_.status=N,c(f.concat(_),l,p));if(arguments.length>1)return d(_,w);let P=O(a,"accessorizedProps",!1),E=P&&P.get(_.key);return _.type==="def"?(E&&!E.restore()&&d(!1),Object.defineProperty(a,_.key,_.value),d(!0)):E&&E.intact()?d(E.setValue(_.value)):d(Reflect.set(a,_.key,_.value))}function b(_,w){if(s.diff&&h===w)return c(f,l,p);let d=new A(a,{type:i?"def":"set",key:m,value:h,isUpdate:_,oldValue:w,related:[...u],operation:i?"defineProperty":"set",detail:s.detail}),P=X.getInstance(a,!1,s.namespace);return P?P.emit(d,g):g(d)}return Ne(a,m,_=>{if(!_)return b(_);if(m==="length"&&Array.isArray(a)&&O(a).has("$length"))return b(!0,O(a).get("$length"));let w={...s,withPropertyDescriptors:i};return Q(a,m,d=>b(_,d),w)},s)}([],o.slice(0),c=>{let f=L.getInstance(a,!1,s.namespace);return f&&f.emit(c,{eventsArePropertyDescriptors:!!i}),n(Me(e)?c.map(l=>l.status):c[0]?.status)})}function Oe(t,e,r,n=i=>i,s={}){return ie(t,e,r,n,s,!0)}function Yr(t,e,r=s=>s,n={}){return ie(t,e,r,n,!0)}function Ae(t,e,r=s=>s,n={}){let s=W(t);v(r)&&([n,r]=[r,o=>o]);let i=H(e,!1),a=[...i];return function o(u,c,f){if(!c.length)return f(u);let l=c.shift();function p(h,g=void 0){let b=d=>(h.status=d,o(u.concat(h),c,f));if(arguments.length>1)return b(h,g);let _=O(s,"accessorizedProps",!1),w=_&&_.get(h.key);return w&&!w.restore()&&b(!1),b(Reflect.deleteProperty(s,h.key))}function m(h){let g=new A(s,{type:"delete",key:l,oldValue:h,related:[...a],operation:"deleteProperty",detail:n.detail}),b=X.getInstance(s,!1,n.namespace);return b?b.emit(g,p):p(g)}return Q(s,l,m,n)}([],i.slice(0),o=>{let u=L.getInstance(s,!1,n.namespace);return u&&u.emit(o),r(Me(e)?o.map(c=>c.status):o[0].status)})}function en(t,e,r=s=>s,n={}){return Ae(...arguments)}function bt(t,e,r=null,n=i=>i,s={}){return q(t,"construct",arguments.length>2?{argumentsList:e,newTarget:r}:{argumentsList:e},n,s)}function xt(t,e,r,n=i=>i,s={}){let i=Se(e),a;if(Array.isArray(e)){if(s.arrayMethodName){let o=new A(i,{operation:s.arrayMethodName,argumentsList:r});L.getInstance(i,!1,s.namespace)?.emit([o],{eventIsArrayMethodDescriptor:!0})}O(i).set("$length",i.length),a=St(i,()=>q(t,"apply",{thisArgument:e,argumentsList:r},n,s),s),O(i).delete("$length")}else a=q(t,"apply",{thisArgument:i,argumentsList:r},n,s);return a}function _t(t,e,r=s=>s,n={}){return q(t,"setPrototypeOf",{proto:e},r,n)}function vt(t,e=n=>n,r={}){return q(t,"preventExtensions",{},e,r)}function fr(t,e,r,n={}){let s=new AbortController;ke.setMaxListeners?.(0,s.signal),n.signal&&n.signal.addEventListener("abort",()=>s.abort());let i={...n,signal:s.signal},a=L.getInstance(t,!0,i.namespace),o=new Map;return function u(c=[],f=null){let l,p,m;if(Me(e)){if(f){m=!0,p=f;for(let h of c)o.get(h.key)?.remove(),o.delete(h.key)}else p=a.addRegistration(e,u,i);l={signal:p.signal,childRegistrations:o}}else f?.remove(),p=a.addRegistration(e,u,i),l={signal:p.signal};if(i.childRegistrations&&i.keyInParent&&i.childRegistrations.set(i.keyInParent,p),arguments.length){let h=r(c,l);if(arguments.length>1)return h}return s}}function q(t,e,r={},n=i=>i,s={}){t=W(t),v(n)&&([s,n]=[n,u=>u]);function i(u,c){return arguments.length>1?n(c):n((Reflect[e]||Object[e])(t,...Object.values(r)))}let a=new A(t,{operation:e,...r}),o=X.getInstance(t,!1,s.namespace);return o?o.emit(a,i):i(a)}function Me(t){return t===1/0||Array.isArray(t)}function W(t,e=!0,r=!0){if((!t||!x(t))&&e)throw new Error(`Object must be of type object or array! "${pe(t)}" given.`);return t instanceof A&&(t.type==="def"&&r?t=typeof t.value.get=="function"?t.value.get():t.value.value:t=t.value),t&&Se(t)}function tn(t,e,r,n={}){return e===1/0?n.level&&!x(t)?r([]):r(Object.entries(Object.getOwnPropertyDescriptors(t)).filter(([,s])=>s.writable!==!1&&!s.get&&!s.set).map(([s])=>s)):r(H(e,!1))}var S={...Ot,...mt},lr=S;var ce=class t extends URLSearchParams{#r;#t;get compatMode(){return this.#t}#n=new Set;#e;#o=!1;#a;_changeCallbackGC;constructor(e={},{compatMode:r=!0,prettyPrint:n=!1,changeCallback:s=null}={}){super(),this.#t=r,this.#e=n;let i;e instanceof t?(i=structuredClone(e.json()),r&&(this.#n=new Set(e.keys()))):e instanceof URLSearchParams||e instanceof FormData?(i=Object.fromEntries(e),r&&(this.#n=new Set(e.keys()))):K(e)?(e=decodeURIComponent(e.replace(/^\?/,"")),i=this.constructor.parse(e,!r),r&&(this.#n=new Set(e.split("&").map(a=>a.split("=")[0])))):Array.isArray(e)?(i=this.constructor.fromEntries(e),r&&(this.#n=new Set(e.map(([a])=>a)))):v(e)?(i=e,r&&this.constructor.reduceValue(e,"",(a,o,u)=>{if(u)return u;/\[\d+\]$/.test(o)&&([,o]=/^(.*)\[\d+\]$/.exec(o)),this.#n.add(o)})):i={},this._changeCallback=s,this._resetJson(i)}_resetJson(e){this.#r=S.proxy(e),this.#a&&(this._changeCallbackGC?.abort(),this._changeCallbackGC=S.observe(this.#r,S.subtree(),this.#a))}get(e){let r=this.#i(e);return this.#t&&Array.isArray(r)?r[0]:r}#i(e,r=!1){if(this.#t&&!this.#n.has(e))return null;let n=this.constructor.get(this.#r,e,r);return n===void 0?null:Array.isArray(n)?this.#t?n.map(s=>typeof s=="number"?s+"":s):n.map(s=>v(s)?new t(s,{compatMode:this.#t}):s):!this.#t&&v(n)?new t(n,{compatMode:this.#t}):this.#t&&typeof n=="number"?n+"":n}getAll(e){let r=this.#i(e,!0);return r===null?[]:Array.isArray(r)?r:[r]}set(e,r){return this.#t&&this.#n.add(e),this.constructor.set(this.#r,e,r),this}append(e,r){return this.#t&&this.#n.add(e),this.constructor.set(this.#r,e,r,!0),this}has(e){return this.#t&&!this.#n.has(e)?!1:this.constructor.get(this.#r,e)!==void 0}delete(e){if(this.#t&&!this.#n.has(e))return;let r=this.constructor.parsePath(e),n=r.pop(),s=r.length?this.constructor.get(this.#r,r):this.#r;v(s)&&S.deleteProperty(s,n)}sort(){return this.#o=!0,this}json(){return S.unproxy(this.#r)}stringify({prettyPrint:e=this.#e}={}){return this.constructor.stringify(this.#r,{only:this.#t&&this.#n,sorted:this.#o,prettyPrint:e})}toString(){return this.stringify()}entries(){let e=[];return this.constructor.reduceValue(this.#r,"",(r,n,s)=>{if(s)return s;if(this.#t&&!this.#n.has(n))if(/\[\d+\]$/.test(n)){if([,n]=/^(.*)\[\d+\]$/.exec(n),!this.#n.has(n)&&!this.#n.has(n=`${n}[]`))return}else return;this.#t&&typeof r=="number"&&(r=r+""),e.push([n,r])}),e[Symbol.iterator]()}keys(){return Array.from(this.entries(),([e])=>e)[Symbol.iterator]()}values(){return Array.from(this.entries(),([,e])=>e)[Symbol.iterator]()}forEach(e,r){for(let[n,s]of this.entries())e.call(r,s,n,this)}[Symbol.iterator](){return this.entries()}get size(){let e=0;return this.forEach(()=>e++),e}static parse(e,r=!1,n="&"){let s={};return(e.startsWith("?")?e.slice(1):e).split(n).filter(Boolean).forEach(i=>{let a=i.indexOf("="),o=a===-1?i:i.slice(0,a),u=a===-1?"":i.slice(a+1);this.set(s,o,u,!0,r)}),s}static fromEntries(e){let r={};for(let[n,s]of e)this.set(r,n,s,!0);return r}static stringify(e,{sorted:r=!1,only:n=null,prettyPrint:s=!1,delim:i="&"}={}){let a=[],o=Object.keys(e);return r&&o.sort(),o.forEach(u=>{this.reduceValue(e[u],u,(c,f,l)=>{if(l)return r?[...l].sort():l;if(n&&!n.has(f))if(/\[\d+\]$/.test(f)){if([,f]=/^(.*)\[\d+\]$/.exec(f),!n.has(f)&&!n.has(f=`${f}[]`))return}else return;s||(f=encodeURIComponent(f)),a.push(f+"="+encodeURIComponent(c))},!!s)}),a.join(i)}static get(e,r,n=!1){return this.reducePath(r,e,(s,i,a)=>a||(s===""?n?i:i?.[0]:i?.[s]))}static set(e,r,n,s=!1,i=!1){this.reducePath(r,e,(a,o,u)=>{let c=u??n;return i&&/^-?\d+(\.\d+)?$/.test(c+"")&&(c=parseFloat(c)),a===""&&Array.isArray(o)?S.proxy(o).push(c):s&&o?.[a]?Array.isArray(o[a])?S.proxy(o[a]).push(c):S.set(o,a,[o[a],c]):S.set(o,a,c),c})}static reduceValue(e,r,n,s=!1){if(x(e)){let i=Object.keys(e),a=n(e,r,i);if(Array.isArray(a)){a.forEach(o=>{s&&(o=encodeURIComponent(o)),this.reduceValue(e[o],r?`${r}[${o}]`:o,n,s)});return}}n(e,r)}static reducePath(e,r,n){let s=this.parsePath(e),i=r;for(let a=0;a<s.length;a++){let o=s[a];if(J(o)&&(o=+o),a===s.length-1)return n(o,i);if(!x(i))return;if(!x(i[o])){let u=s[a+1];i[o]=n(o,i,J(u)||u===""?[]:{})}i=i[o]}}static parsePath(e){if(Array.isArray(e))return e;if(!K(e))return[];let r=[];return e.replace(/\[([^\]]*)\]|([^[\]]+)/g,(n,s,i)=>{r.push(s??i)}),r}};var B=class t extends FormData{static upgradeInPlace(e){return e instanceof t?e:Object.setPrototypeOf(e,t.prototype)}static json(e={},{encodeLiterals:r=!0,meta:n=!1}={}){let s=new t,i=!0;return ce.reduceValue(e,"",(a,o,u=void 0)=>{if(u){let c=Ue(a)==="json";return i=i&&c,c&&u}r&&[!0,!1,null].includes(a)&&(a=new Blob([a+""],{type:"application/json"})),s.append(o,a)}),n?{result:s,isDirectlySerializable:i}:s}async json({decodeLiterals:e=!0,meta:r=!1}={}){let n=!0,s;for(let[i,a]of this.entries()){s||(s=J(Ie(i,"["))?[]:{});let o=Ue(a);if(e&&["Blob","File"].includes(o)&&a.type==="application/json"&&[4,5].includes(a.size)){let u=JSON.parse(await a.text());[null,!0,!1].includes(u)&&(a=u,o="json")}n=n&&o==="json",/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?$/.test(a)&&(a=Number(a)),ce.set(s,i,a)}return r?{result:s,isDirectlySerializable:n}:s}};var ue=(t,...e)=>k(t,"fetch+",...e),C=(t,...e)=>k(t,"fetch+","meta",...e);function Fe(t){return class extends t{static from(e){let r=e.headers instanceof Headers?[...e.headers.entries()].reduce((i,[a,o])=>{let u=a.toLowerCase();return i[u]=i[u]?[].concat(i[u],o):o,i},{}):Object.keys(e.headers||{}).reduce((i,a)=>(i[a.toLowerCase()]=e.headers[a],i),{}),n=e.body,s=Ue(n);if(["Blob","File"].includes(s))r["content-type"]??=n.type,r["content-length"]??=n.size;else if(["Uint8Array","Uint16Array","Uint32Array","ArrayBuffer"].includes(s))r["content-length"]??=n.byteLength;else if(s==="json"&&x(n)){let{result:i,isDirectlySerializable:a}=B.json(n,{encodeLiterals:!0,meta:!0});a?(n=JSON.stringify(n,(o,u)=>u instanceof Error?{...u,message:u.message}:u),r["content-type"]="application/json",r["content-length"]=new Blob([n]).size):(n=i,s="FormData")}else["text","json"].includes(s)&&!r["content-length"]&&(r["content-length"]=new Blob([n]).size);return!["FormData"].includes(s)&&!["function"].includes(typeof n)&&!r["content-type"]&&(r["content-type"]="application/octet-stream"),{body:n,headers:new Headers(r),$type:s}}async formData(){let e=await super.formData();return B.upgradeInPlace(e),e}async any({to:e=null,memo:r=!1}={}){if(e&&!["blob","text","json","arrayBuffer","bytes","formData"].includes(e))throw new Error(`Invalid target type specified: ${e}`);let n=C(this,"cache"),s=async o=>{if(!r)return await this[o||"bytes"]();let u=f=>{if(f instanceof FormData){let l=new B;for(let[p,m]of f.entries())l.append(p,m);return l}return(!o||o==="json")&&(Ke(f)||Je(f))?structuredClone(f):f};if(!o&&n.has("original"))return u(n.has("original"));if(o??="bytes",n.has(o))return u(n.get(o));let c;return n.has("memo")?c=n.get("memo").clone()[o]():(n.set("memo",this.clone()),c=await this[o]()),n.set(o,c),u(c)},i=(this.headers.get("Content-Type")||"").split(";")[0].trim(),a;if((!e||["formData","json"].includes(e))&&["multipart/form-data","application/x-www-form-urlencoded"].includes(i)){let o=await s("formData");B.upgradeInPlace(o),e==="json"&&(o=await o.json({decodeLiterals:!0})),a=o}else if((!e||["formData","json"].includes(e))&&i==="application/json"){let o=await s("json");e==="formData"&&(o=B.json(o,{encodeLiterals:!0})),a=o}else if(!e&&(i.startsWith("image/")||i.startsWith("video/")||i.startsWith("audio/")||i.startsWith("application/")&&!["xml","json","javascript","x-www-form-urlencoded"].some(o=>i.includes(o))))a=await s("blob");else if(!e&&(i.startsWith("text/")||i.startsWith("application/")&&["xml","javascript"].some(o=>i.includes(o))))a=await s("text");else{if(["json","formData"].includes(e))throw new Error(`Cannot convert body of type ${i} to ${e}`);a=await s(e)}return a}forget(){C(this,"cache").clear()}}}function Ue(t){if(t instanceof FormData)return"FormData";if(t===null||me(t)||je(t))return"json";if(K(t))return"text";if(x(t)){let e=t[Symbol.toStringTag],r=["Uint8Array","Uint16Array","Uint32Array","ArrayBuffer","Blob","File","FormData","Stream","ReadableStream"].reduce((n,s)=>n||(e===s?s:null),null);if(r)return r;if(v(t)||Array.isArray(t))return"json";if("toString"in t)return"text"}return null}function nn(t){return t!==null&&typeof t=="object"&&typeof t.read=="function"&&typeof t.pipe=="function"&&typeof t.on=="function"}function At(t){return t instanceof ReadableStream||nn(t)}var z=class t extends Headers{static upgradeInPlace(e){return e instanceof t?e:Object.setPrototypeOf(e,t.prototype)}set(e,r){if(/^Set-Cookie$/i.test(e)){if(Array.isArray(r)){this.delete(e);for(let n of r)this.append(e,n);return}v(r)&&(r=Ct(r))}return/Cookie/i.test(e)&&(r=hr(r)),/^Content-Range$/i.test(e)&&(r=dr(r)),/^Range$/i.test(e)&&(r=pr(r)),/^Accept$/i.test(e)&&(r=mr(r)),super.set(e,r)}append(e,r){if(/^Set-Cookie$/i.test(e)){if(Array.isArray(r)){for(let n of r)this.append(e,n);return}v(r)&&(r=Ct(r))}return/Cookie/i.test(e)&&(r=hr(r)),/^Content-Range$/i.test(e)&&(r=dr(r)),/^Range$/i.test(e)&&(r=pr(r)),/^Accept$/i.test(e)&&(r=mr(r)),super.append(e,r)}get(e,r=!1){let n=super.get(e);if(/^Set-Cookie$/i.test(e)&&r&&(n=this.getSetCookie().map(s=>{let[i,...a]=s.split(";"),[o,u]=i.split("=").map(f=>f.trim()),c={name:o,value:u};return a.map(f=>f.trim().split("=")).forEach(f=>{c[f[0][0].toLowerCase()+f[0].substring(1).replace("-","")]=f.length===1?!0:f[1]}),c})),/^Cookie$/i.test(e)&&r&&(n=n?.split(";").map(s=>{let[i,a]=s.split("=").map(o=>o.trim());return{name:i,value:a}})||[]),/^Content-Range$/i.test(e)&&n&&r&&(n=ge(n,"bytes ").split("/")),/^Range$/i.test(e)&&r&&(n=n?ge(n,"bytes=").split(",").map(s=>{let i=s.trim().split("-").map(a=>a?parseInt(a,10):null);return i.resolveAgainst=a=>{let o=[...i];return o[1]===null?o[1]=a-1:o[1]=Math.min(o[1],a)-1,o[0]===null&&(o[0]=o[1]?a-o[1]-1:0),o},i.canResolveAgainst=(a,o)=>{let u=[typeof i[0]=="number"?i[0]:a,typeof i[1]=="number"?i[1]:o-1];return!(u[0]>u[1]||u[0]<a||u[1]>=o)},i.toString=()=>s,i}):[]),/^Accept$/i.test(e)&&n&&r){let s=a=>{let[o,u]=a.trim().split(";").map(c=>c.trim());return[o,parseFloat((u||"q=1").replace("q=",""))]},i=n;n=n.split(",").map(a=>s(a)).sort((a,o)=>a[1]>o[1]?-1:1)||[],n.match=a=>{if(!a)return 0;let o=c=>c.split("/").map(f=>f.trim()),u=o(a+"");return n.reduce((c,[f,l])=>{if(c)return c;let p=o(f);return[0,1].every(m=>u[m]===p[m]||u[m]==="*"||p[m]==="*")?l:0},0)},n.toString=()=>i}return n}};function Ct(t){let e=[`${t.name}=${t.value}`];for(let r in t){if(["name","value"].includes(r))continue;let n=r[0].toUpperCase()+r.substring(1);n==="MaxAge"&&(n="Max-Age"),e.push(t[r]===!0?n:`${n}=${t[r]}`)}return e.join("; ")}function hr(t){return x(t)&&(t=[].concat(t).map(Ct).join("; ")),t}function pr(t){let e=[];return H(t).forEach((r,n)=>{let s=Array.isArray(r)?r.map(i=>[null,void 0].includes(i)?"":i).join("-"):r+"";n===0&&!s.includes("bytes=")&&(s=`bytes=${s}`),e.push(s)}),e.join(", ")}function dr(t){if(Array.isArray(t)){if(t.length<2||!t[0].includes("-"))throw new Error("A Content-Range array must be in the format: [ 'start-end', 'total' ]");t=`bytes ${t.join("/")}`}return t}function mr(t){return Array.isArray(t)&&(t=t.map(e=>Array.isArray(e)?e.map((r,n)=>n===1&&(r=parseFloat(r),!0)?r===1?"":`;q=${r}`:r.trim()).join(""):e.trim()).join(",")),t}var V=class t extends Fe(Response){constructor(e,r={}){super(e,r),z.upgradeInPlace(this.headers)}static upgradeInPlace(e){return e instanceof t||(Object.setPrototypeOf(e,t.prototype),z.upgradeInPlace(e.headers)),e}static from(e,{memoize:r=!1,...n}={}){if(e instanceof Response)return e;let s;if(typeof e<"u"){let a;({body:e,headers:a,$type:s}=super.from({body:e,headers:n.headers})),n={...n,headers:a}}let i=new this(e,n);if(r){let a=C(i,"cache"),o={json:"json",FormData:"formData",text:"text",ArrayBuffer:"arrayBuffer",Blob:"blob",Bytes:"bytes"};a.set(o[s]||"original",e)}return i}get status(){return C(this).get("status")??super.status}clone(){let e=super.clone();t.upgradeInPlace(e);let r=C(this);return ue(e).set("meta",new Map(r)),C(e).has("cache")&&C(e).set("cache",new Map(r.get("cache"))),e}};async function gr(t,e={}){let r=await fetch(t,e);return V.upgradeInPlace(r),r}var He=class t extends Fe(Request){constructor(e,r={}){super(e,r),z.upgradeInPlace(this.headers)}static upgradeInPlace(e){return e instanceof t||(Object.setPrototypeOf(e,t.prototype),z.upgradeInPlace(e.headers)),e}static from(e,{memoize:r=!1,...n}={}){if(e instanceof Request)return e;let s,i=n.body;if("body"in n){let{body:o,headers:u,$type:c}=super.from(n);n={...n,body:o,headers:u},s=c}let a=new this(e,n);if(r){let o=C(a,"cache"),u={json:"json",FormData:"formData",text:"text",ArrayBuffer:"arrayBuffer",Blob:"blob",Bytes:"bytes"};o.set(u[s]||"original",i)}return a}static async copy(e,r={}){let s=["method","headers","mode","credentials","cache","redirect","referrer","integrity"].reduce((i,a)=>({...i,[a]:a in r?r[a]:a==="headers"?new Headers(e[a]):e[a]}),{});return["GET","HEAD"].includes(s.method.toUpperCase())?s.body=null:"body"in r?(s.body=r.body,"headers"in r||(s.headers.delete("Content-Type"),s.headers.delete("Content-Length"))):s.body=await e.clone().arrayBuffer(),s.mode==="navigate"&&(s.mode="cors"),{url:r.url||e.url,...s}}clone(){let e=super.clone();t.upgradeInPlace(e);let r=C(this);return ue(e).set("meta",new Map(r)),C(e).has("cache")&&C(e).set("cache",new Map(r.get("cache"))),e}};var j=class extends MessageEvent{#r;get originalTarget(){return this.#r}#t;get eventID(){return this.#t}#n;get data(){return this.#n}#e;get live(){return this.#e}#o;get bubbles(){return this.#o}#a;get forwarded(){return this.#a}#i;get honourDoneMutationFlags(){return this.#i}#u=[];get ports(){return this.#u}constructor(e,{originalTarget:r=null,type:n="message",eventID:s,live:i=!1,honourDoneMutationFlags:a=!1,bubbles:o=!1,forwarded:u=!1,ports:c=[]}={}){if(n&&typeof n!="string")throw new TypeError("Where specified, wqEventOptions.type must be a string");super(n),this.#n=e,this.#r=r,this.#t=s,this.#e=i,this.#o=o,this.#a=u,this.#i=a,this.#u=c;let f=this.#r&&Z(this.#r)||{};if(this.#u.forEach(l=>M.upgradeInPlace(l,{autoStart:f.autoStart,postAwaitsOpen:f.postAwaitsOpen})),x(this.#n)&&this.#e){if(typeof s!="string")throw new TypeError("eventID must be a non-empty string");Mt.call(r,this.#n,this.#t,{honourDoneMutationFlags:this.#i})}}#h=!1;get immediatePropagationStopped(){return this.#h}stopImmediatePropagation(){this.#h=!0,this.#c=!0,super.stopImmediatePropagation()}#c=!1;get propagationStopped(){return this.#c}stopPropagation(){this.#c=!0,super.stopPropagation()}#s=!1;get defaultPrevented(){return this.#s}preventDefault(){this.#s=!0,super.preventDefault()}respondWith(e,r=[]){for(let n of this.#u)n.postMessage(e,r);return!!this.#u.length}};var fe=class extends We(EventTarget){#r;#t;constructor(e,{autoStart:r=!0,naturalOpen:n=!0,postAwaitsOpen:s=!1}={}){if(super(),this.#r=typeof e=="string"?new WebSocket(e):e,$(this).set("options",{autoStart:r,naturalOpen:n,postAwaitsOpen:s}),this.constructor.upgradeEvents(this.#r,this),n&&r&&this.#r.readyState===WebSocket.OPEN&&this.start(),this.#t=new Promise(a=>{this.#r.readyState===WebSocket.OPEN?a():this.#r.addEventListener("open",a)}),this.#r.readyState===WebSocket.CLOSED)try{this.close()}catch{}}static _hydrateMessage(e,r){try{let n;if(typeof r.data=="string"&&v(n=JSON.parse(r.data))&&n[".wq"])return Object.defineProperty(r,"data",{value:n,configurable:!0}),super._hydrateMessage(e,r)}catch{}return r}__postMessage(e,r){this.#t.then(()=>{this.#r.send(JSON.stringify(e),r)})}};var yr=(t,...e)=>k(t,"port+",...e),$=(t,...e)=>k(t,"port+","meta",...e),Z=t=>k(t,"port+","meta").get("options")||{},wr=["addEventListener","addRequestListener","postMessage","postRequest","dispatchEvent","relay","start","readyStateChange","removeEventListener","close"],br=["options","readyState","onmessage","onmessageerror"],M=class extends xr(EventTarget){constructor(e={}){super(),yr(this,"meta").set("options",e)}static[Symbol.hasInstance](e){return Function.prototype[Symbol.hasInstance].call(this,e)?!0:wr.every(r=>typeof e[r]=="function")||br.every(r=>r in e)}};function xr(t){return class extends t{static upgradeInPlace(e,r={}){if(e instanceof M)return e;let n=this.prototype;for(let i of wr.concat("_autoStart")){let a=e[i],o=n[i];a&&Object.defineProperty(e,`_${i}`,{value:a.bind(e),configurable:!0}),Object.defineProperty(e,i,{value:o.bind(e),configurable:!0})}for(let i of br){let a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),i),o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(n),i);a&&Object.defineProperty(e,`_${i}`,{...a,configurable:!0}),Object.defineProperty(e,i,{...o,configurable:!0})}return yr(e,"meta").set("options",r),this.upgradeEvents(e),e}static upgradeEvents(e,r=null){r||(r=e);let n=$(e);if(n.get("events+"))return;let s=$(r),i=Z(r),a=he.call(r),o=le.call(r);e instanceof BroadcastChannel&&(i.clientServerMode==="server"?s.set("clients",new Set):i.clientServerMode==="client"&&s.set("client_id",`client-${(0|Math.random()*9e6).toString(36)}`));let u=l=>{if(l instanceof j)return;if(e===r&&l.stopImmediatePropagation?.(),l=this._hydrateMessage?.(r,l)||l,l.data.ping==="connect"&&typeof l.data?.[".wq"]?.eventID=="string"&&(!(e instanceof WebSocket)||!i.naturalOpen)){let g=!0;e instanceof BroadcastChannel&&(i.clientServerMode==="server"&&typeof l.data.id=="string"?(s.get("clients").add(l.data.id),g="server"):l.data.id==="server"&&s.has("client_id")&&(g=s.get("client_id"))),l.ports?.forEach(b=>b.postMessage(g)),s.set("remote.start.called",!0),r.start();return}if(l.data.ping==="disconnect"&&typeof l.data?.[".wq"]?.eventID=="string"){let g=()=>{s.set("remote.close.called",!0),r.close()};e instanceof BroadcastChannel?i.clientServerMode==="server"&&typeof l.data.id=="string"?(s.get("clients").delete(l.data.id),!s.get("clients").size&&i.autoClose&&!o.close.state&&g()):i.clientServerMode==="client"&&l.data.id==="server"&&g():e instanceof MessagePort&&g();return}let p=l.data,m={};typeof l.data?.[".wq"]?.eventID=="string"&&({message:p,".wq":m}=l.data);let h=new j(p,{originalTarget:e,...m,ports:l.ports});r.dispatchEvent(h)},c=l=>{e instanceof WebSocket&&i.naturalOpen&&!(l instanceof j)&&(s.set("remote.start.called",!0),r.start())},f=l=>{(e instanceof WebSocket||e instanceof MessagePort)&&!(l instanceof j)&&(s.set("remote.close.called",!0),r.close())};n.set("internal_call",!0),e.addEventListener("message",u),e.addEventListener("error",u),e.addEventListener("open",c),e.addEventListener("close",f),n.delete("internal_call"),n.set("events+",!0),a.add(()=>{e.removeEventListener("message",u),e.removeEventListener("error",u),e.removeEventListener("open",c),e.removeEventListener("close",f),n.set("events+",!1)})}get options(){return{...Z(this)}}get onmessageerror(){return typeof super.onmessageerror<"u"?super.onmessageerror:typeof this._onmessageerror<"u"?this._onmessageerror:null}set onmessageerror(e){if(typeof super.onmessageerror<"u"){super.onmessageerror=e;return}if(e!==null&&typeof e!="function")throw new TypeError("onmessageerror must be a function");if(Object.getOwnPropertyDescriptor(this,"_onmessageerror")?.set){this._onmessageerror=e;return}this._onmessageerror&&this.removeEventListener("messageerror",this._onmessageerror),this.addEventListener("messageerror",e),this._onmessageerror=e}get onmessage(){return typeof super.onmessage<"u"?super.onmessage:typeof this._onmessage<"u"?this._onmessage:null}set onmessage(e){if(this._autoStart(),typeof super.onmessage<"u"){super.onmessage=e;return}if(e!==null&&typeof e!="function")throw new TypeError("onmessage must be a function");if(Object.getOwnPropertyDescriptor(this,"_onmessage")?.set){this._onmessage=e;return}this._onmessage&&this.removeEventListener("message",this._onmessage),this.addEventListener("message",e),this._onmessage=e}addEventListener(...e){return this._autoStart(),he.call(this).add(()=>{this._removeEventListener?this._removeEventListener(...e):super.removeEventListener(...e)}),this._addEventListener?this._addEventListener(...e):super.addEventListener(...e)}dispatchEvent(e){let r=this._dispatchEvent?this._dispatchEvent(e):super.dispatchEvent(e);return e instanceof j&&sn.call(this,e),r}postMessage(e,r={}){this._autoStart();let n=le.call(this);n.messaging.state=!0,n.messaging.resolve(this);let s,{portOptions:i,wqOptions:{relayedFrom:a,...o}}=Be.call(this,e,r);(o.type!=="message"||o.live||o.bubbles||i.transfer?.length&&(this instanceof BroadcastChannel||this instanceof fe))&&(e={message:e,".wq":o}),r=i,s=a;let u=()=>{this._postMessage?this._postMessage(e,r,s):super.postMessage(e,r)};Z(this).postAwaitsOpen?n.open.promise.then(u):u()}addRequestListener(e,r,n={}){let s=async i=>{let a=await r(i);for(let o of i.ports)o.postMessage(a)};this.addEventListener(e,s,n)}postRequest(e,r,n={}){let s;v(r)&&(n={once:!0,...r},s=new Promise(f=>{r=f}));let i=new MessageChannel;this.constructor.upgradeEvents(i.port1),i.port1.start();let{signal:a=null,once:o=!1,transfer:u=[],...c}=n;return i.port1.addEventListener("message",f=>r(f),{signal:a,once:o}),a?.addEventListener("abort",()=>{i.port1.close(),i.port2.close()}),this.postMessage(e,{...c,transfer:[i.port2].concat(u)}),s}relay({to:e,from:r,types:n="*",channel:s=null,resolveMessage:i=null,bidirectional:a=!1}={}){if(e&&r)throw new Error('Only one of "to" and "from" may be specified');if(r?e=this:r=this,e===r)throw new Error("Source and target ports cannot be the same");if(!(r instanceof M)||!(e instanceof M))throw new Error("Both source and target ports must be instance of MessagePortPlus.");if(typeof n!="function"&&!(n=[].concat(n)).length)throw new Error("Event types must be specified.");if(typeof s=="string")s={from:s};else if(v(s)){if(Object.keys(s).filter(f=>!["from","to"].includes(f)).length)throw new Error('Channel must be a string or an object of "from"/"to" members')}else if(s)throw new Error("Invalid channel parameter");let o=_r.call(r),u={targetPort:e,types:n,channel:s,resolveMessage:i};o.add(u);let c;return a&&(c=e.relay({to:r,types:n,channel:s&&{to:s.from,from:s.to},resolveMessage:i,bidirectional:!1})),()=>{o.delete(u),c?.()}}channel(e,r=null){let n=new MessageChannel;return M.upgradeInPlace(n.port1,{autoStart:this.options.autoStart,postAwaitsOpen:this.options.postAwaitsOpen}),M.upgradeInPlace(n.port2,{autoStart:this.options.autoStart,postAwaitsOpen:this.options.postAwaitsOpen}),he.call(this).add(this.relay({channel:e,to:n.port1,bidirectional:!0,resolveMessage:r})),n.port1.start(),this.readyStateChange("close").then(()=>{n.port1.close()}),n.port2}projectMutations({from:e,to:r,...n}){if(!e||!r||typeof e=="string"&&typeof r=="string"||x(e)&&x(r))throw new Error('Invalid "from"/"to" parameters');if(typeof e=="string"){if(!x(r))throw new Error('Invalid "to" parameter. Object/array expected');return Mt.call(this,r,e,n)}if(typeof r=="string"){if(!x(e))throw new Error('Invalid "from" parameter. Object/array expected');return vr.call(this,e,r,n)}throw new Error('Invalid "from"/"to" parameters')}get readyState(){let e=le.call(this);return e.close.state?"closed":e.open.state?"open":"connecting"}readyStateChange(e){if(!["open","messaging","close"].includes(e))throw new Error(`Invalid readyState query "${e}"`);return le.call(this)[e].promise}_autoStart(){let e=$(this),r=Z(this);!e.get("internal_call")&&r.autoStart&&this.start()}start(){let e=le.call(this);if(e.open.state)return;let r,n=()=>{if(e.open.state)return;e.open.state=!0,e.open.resolve(this);let c=new j(null,{type:"open"});this._dispatchEvent?this._dispatchEvent(c):super.dispatchEvent(c),r?.port1.close(),r?.port2.close()},s=$(this),i=Z(this);if(s.get("remote.start.called")){n();return}if(s.get("start.called"))return;s.set("start.called",!0),this._start?this._start():super.start?.(),r=new MessageChannel,r.port1.onmessage=c=>{this instanceof BroadcastChannel&&i.clientServerMode==="server"&&typeof c.data=="string"&&s.get("clients").add(c.data),n()};let{wqOptions:a}=Be.call(this),o=i.clientServerMode==="server"?"server":i.clientServerMode==="client"?s.get("client_id"):null,u={".wq":a,ping:"connect",id:o};this._postMessage?this._postMessage(u,{transfer:[r.port2]}):super.postMessage(u,{transfer:[r.port2]})}close(...e){let r=le.call(this);if(r.close.state)return;r.close.state=!0;let n=$(this),s=Z(this);if(!n.get("remote.close.called")&&(this instanceof BroadcastChannel||this instanceof MessagePort)){let{wqOptions:a}=Be.call(this),o=s.clientServerMode==="server"?"server":s.clientServerMode==="client"?n.get("client_id"):null,u={".wq":a,ping:"disconnect",id:o};this._postMessage?this._postMessage(u):super.postMessage(u)}this._close?this._close(...e):super.close(...e),r.close.resolve(this);let i=new j(null,{type:"close"});this._dispatchEvent?this._dispatchEvent(i):super.dispatchEvent(i),on.call(this)}}}function We(t){return class extends xr(t){static _hydrateMessage(e,r){if(typeof r.data?.[".wq"]?.numPorts!="number"||typeof r.data[".wq"].eventID!="string")return r;let n=he.call(e),s=r.data[".wq"].numPorts;Object.defineProperty(r,"ports",{value:[],configurable:!0});for(let i=0;i<s;i++){let a=e.channel(`${r.data[".wq"].eventID}:${i}`);r.ports.push(a)}return r}_postMessage(e,r={}){let{transfer:n=[],...s}=r;if(typeof e?.[".wq"]?.eventID=="string"){let i=he.call(this),a=n.filter(u=>u instanceof MessagePort),o=a.length;for(let u=0;u<o;u++)M.upgradeInPlace(a[u]),i.add(this.relay({channel:`${e[".wq"].eventID}:${u}`,to:a[u],bidirectional:!0})),a[u].start(),a[u].readyStateChange("close").then(()=>{let{wqOptions:c}=Be.call(this),f={".wq":c,ping:"disconnect"};this.postMessage(f,{type:`${e[".wq"].eventID}:${u}:message`})});e[".wq"].numPorts=o}return this.__postMessage(e,s)}}}function sn(t){if(t.propagationStopped)return;let e=$(this);e.get("parentNode")instanceof EventTarget&&(t.bubbles||e.get("parentNode")?.findPort?.(n=>n===this)&&t instanceof j)&&e.get("parentNode").dispatchEvent(t);let r=_r.call(this);if(r.size&&t instanceof j){let{type:n,eventID:s,data:i,live:a,bubbles:o,ports:u}=t,c=new WeakSet;for(let{targetPort:f,types:l,channel:p,resolveMessage:m}of r){if(c.has(f))continue;let h=n;p.from&&([,h]=new RegExp(`^${p.from.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}:([^:]+)$`).exec(n)||[],!h)||!(typeof l=="function"?l(h,this,f,p):[].concat(l).find(b=>b===h||b==="*"))||(c.add(f),f.postMessage(m?m(i,this,f,p):i,{transfer:u,type:p.to?`${p.to}:${h}`:h,eventID:s,bubbles:o,live:a,forwarded:!0,relayedFrom:this}))}}}function he(){let t=$(this);return t.has("garbage_collection")||t.set("garbage_collection",new Set),t.get("garbage_collection")}function _r(){let t=$(this);return t.has("downstream_registry")||t.set("downstream_registry",new Set),t.get("downstream_registry")}function le(){let t=$(this);if(!t.has("readystate_registry")){let e=r=>(r.promise=new Promise((n,s)=>(r.resolve=n,r.reject=s)),r);t.set("readystate_registry",{open:e({}),messaging:e({}),close:e({})})}return t.get("readystate_registry")}function on(){let t=$(this);for(let e of t.get("garbage_collection")||[])e instanceof AbortController?e.abort():typeof e=="function"&&e();t.get("garbage_collection")?.clear(),t.get("downstream_registry")?.clear()}function Be(t=void 0,e={}){if(Array.isArray(e))e={transfer:e};else if(!e||typeof e!="object")throw new TypeError("transferOrOptions must be an array or an object");let{type:r="message",eventID:n=null,live:s=!1,observing:i=!1,bubbles:a=!1,forwarded:o=!1,relayedFrom:u=null,signal:c=null,withArrayMethodDescriptors:f=!1,honourDoneMutationFlags:l=!1,...p}=e;return n||(n=`${r}-${(0|Math.random()*9e6).toString(36)}`),!i&&!o&&x(t)&&s&&!r?.endsWith(".mutate")&&(vr.call(this,t,n,{signal:c,withArrayMethodDescriptors:f,honourDoneMutationFlags:l}),i=!0),{portOptions:p,wqOptions:{type:r,eventID:n,live:s,observing:i,honourDoneMutationFlags:l,bubbles:a,forwarded:o,relayedFrom:u}}}function vr(t,e,{signal:r,withArrayMethodDescriptors:n=!0,honourDoneMutationFlags:s=!1}={}){if(!x(t))throw new TypeError("data must be a plain object and not a stream");if(typeof e!="string")throw new TypeError("eventID must be a non-empty string");let i=u=>{let c;n&&Array.isArray(u[0].target)&&!u[0].argumentsList&&!["set","defineProperty","deleteProperty"].includes(u[0].operation)||(this.postMessage(u.map(f=>(c=!c&&s&&f.detail?.done,{...f,target:void 0})),{type:`${e}.mutate`}),c&&a.abort())},a=S.observe(t,S.subtree(),i,{signal:r,withArrayMethodDescriptors:n});return he.call(this).add(a),a}function Mt(t,e,{signal:r,honourDoneMutationFlags:n=!1}={}){if(!x(t))throw new TypeError("data must be a plain object and not a stream");if(typeof e!="string")throw new TypeError("eventID must be a non-empty string");let s=o=>{if(!o.data?.length)return;let u;S.batch(t,()=>{for(let c of o.data){if(u=!u&&n&&c.detail?.done,c.argumentsList){let f=c.path.length?S.get(t,S.path(...c.path)):t;S.proxy(f)[c.operation](...c.argumentsList);continue}if(c.key!=="length"||["set","defineProperty","deleteProperty"].includes(c.operation)){let f=c.path.length===1?t:S.get(t,S.path(...c.path.slice(0,-1)));c.type==="delete"?S.deleteProperty(f,c.key):S.set(f,c.key,c.value)}}}),u&&i()};this.addEventListener(`${e}.mutate`,s,{signal:r});let i=()=>this.removeEventListener(`${e}.mutate`,s);return he.call(this).add(i),i}var $e=class extends We(BroadcastChannel){constructor(e,{autoStart:r=!0,postAwaitsOpen:n=!1,clientServerMode:s=null,autoClose:i=!0}={}){super(e);let a=$(this);if(s&&!["server","client"].includes(s))throw new Error('clientServerMode must be "server" or "client"');a.set("options",{autoStart:r,postAwaitsOpen:n,clientServerMode:s,autoClose:i}),this.constructor.upgradeEvents(this)}__postMessage(e,r){BroadcastChannel.prototype.postMessage.call(this,e)}};var ze=class t extends EventTarget{static get xHeaderName(){return"X-Message-Port"}static test(e){return e instanceof t||e?.[Symbol.toStringTag]==="LiveResponse"?"LiveResponse":e?.[Symbol.toStringTag]==="LiveProgramHandle"?"LiveProgramHandle":e instanceof Response?"Response":cn(e)?"Generator":"Default"}static hasPort(e){return!!e.headers?.get?.(this.xHeaderName)?.trim()}static getPort(e,r=!1){if(!/Response/.test(this.test(e)))return;let n=C(e);if(!n.has("port")){let s=e.headers.get(this.xHeaderName)?.trim();if(!s)return;let[,i,a]=/^(socket|channel):\/\/(.*)$/.exec(s)||[];if(!i||!a)throw new Error(`Unknown port messaging protocol: ${s}`);let o=i==="channel"?new $e(a,{autoStart:r,postAwaitsOpen:!0,clientServerMode:"client"}):new fe(a,{autoStart:r,naturalOpen:!1,postAwaitsOpen:!0});n.set("port",o)}return n.get("port")}static attachPort(e,r){if(!(r instanceof M))throw new Error("Client must be a MessagePortPlus interface");C(e).set("port",r)}static from(e,...r){return this.test(e)==="LiveResponse"?e.clone(...r):new this(e,...r)}[Symbol.toStringTag]="LiveResponse";#r;constructor(e,...r){super(),this.#r=L.getInstance(this,!0);let s=_e.call(this).now;this.#f(s,e,...r).catch(i=>{s.reject(i)})}#t=null;get body(){return this.#t}#n=!1;get concurrent(){return this.#n}get bodyUsed(){return!0}#e=new Headers;get headers(){return this.#e}#o=200;get status(){return this.#o}#a="";get statusText(){return this.#a}#i="basic";get type(){return this.#i}#u=!1;get redirected(){return this.#u}#h=null;get url(){return this.#h}get ok(){return this.#o>=200&&this.#o<299}async now(){return _e.call(this).now.promise}get port(){return this.constructor.getPort(this,!0)}#c=new AbortController;#s=new AbortController;get readyState(){let e=_e.call(this);return e.done.state?"done":e.live.state?"live":"waiting"}readyStateChange(e){if(!["live","now","done"].includes(e))throw new Error(`Invalid readyState query "${e}"`);return _e.call(this)[e].promise}disconnect(e=!1){this.#c.abort(),this.#c=new AbortController,e&&(this.#s.abort(),this.#s=new AbortController)}#d;#g(e){let r=_e.call(this);if(r.done.state)throw new Error("Response already done.");return this.#d=e,e.then(n=>{this.#d===e&&(this.#d=null,r.done.state=!0,r.done.resolve(n))}).catch(n=>{this.#d===e&&(this.#d=null,r.done.state=!0,r.done.reject(n))}),e}async replaceWith(e,...r){if(this.readyState==="done")throw new Error("Response already done.");this.disconnect(),await this.#f(null,e,...r)}async#f(e,r,...n){let s=_e.call(this),i=e||s.now.refresh();if(r instanceof Promise)return this.#g(new Promise((m,h)=>{this.#c.signal.addEventListener("abort",()=>{i.aborted=!0,m()}),r.then(async g=>{await this.#f(i,g,...n),m()}).catch(g=>h(g))}));let a=(m,h)=>{if(h=Object.freeze({...h,ok:h.status>=200&&h.status<299,bodyUsed:!0}),m?.aborted){m.resolve(h);return}let g=m||s.now.refresh(),b=h.body;this.#o=h.status,this.#a=h.statusText;for(let[d]of[...this.#e.entries()])this.#e.delete(d);for(let[d,P]of h.headers.entries())this.#e.append(d,P);this.#i=h.type,this.#u=h.redirected,this.#h=h.url;let _=this.#t;this.#t=b,this.#n=!!h.concurrent,this.#n||(this.#s.abort(),this.#s=new AbortController);let w=new A(this,{type:"set",key:"body",value:b,oldValue:_,isUpdate:!0,related:[],operation:"set",detail:null});s.live.state=!0,s.live.resolve(this),g.resolve(h),this.#r.emit([w]),this.dispatchEvent(new $t(h))},o=(m,h,g)=>{a(m,{body:h,status:200,statusText:"",...g,headers:g.headers instanceof Headers?g.headers:new Headers(g.headers||{}),type:"basic",redirected:!1,url:null})},u=async(m,h,g)=>{let b,_=!1;try{b=h instanceof Response?await V.prototype.any.call(h,{to:"json"}):(await h.readyStateChange("live")).body,_=!0}catch{b=await V.prototype.any.call(h)}if(a(m,{body:b,status:h.status,statusText:h.statusText,headers:h.headers,concurrent:h.concurrent,...g,type:h.type,redirected:h.redirected,url:h.url}),this.constructor.test(h)==="LiveResponse"){let w=()=>{o(null,h.body,h)};return h.addEventListener("replace",w,{signal:this.#c.signal}),await h.readyStateChange("done"),h.removeEventListener("replace",w),h}if(this.constructor.hasPort(h)){let w=this.constructor.getPort(h);return w.start(),_&&w.projectMutations({from:"initial_response",to:b,signal:this.#s.signal}),new Promise(d=>{let P=E=>{let{body:N,...U}=E.data;o(null,N,{...U})};w.addEventListener("response.replace",P,{signal:this.#c.signal}),w.addEventListener("response.done",()=>{w.removeEventListener("response.replace",P),d(this)},{once:!0}),w.readyStateChange("close").then(d)})}},c=async(m,h,g)=>{let b=await h.next(),_=await b.value;await this.#f(m,_,{done:b.done,...g});let w=b,d=_;for(;!w.done&&!this.#c.signal.aborted;)w=await h.next(),d=await w.value,this.#c.signal.aborted||await this.#f(null,d,{concurrent:g.concurrent,done:g.done===!1?!1:w.done})},f=async(m,h,g)=>(await this.#f(m,h.value,g),S.observe(h,"value",b=>this.#f(null,b.value,{concurrent:g.concurrent,done:!1}),{signal:this.#c.signal}),new Promise(()=>{})),l=typeof n[0]=="function"?n.shift():null,p=v(n[0])?{...n.shift()}:{};if("status"in p&&(p.status=parseInt(p.status),p.status<200||p.status>599))throw new Error(`The status provided (${p.status}) is outside the range [200, 599].`);if("statusText"in p&&(p.statusText=String(p.statusText)),p.headers&&!(p.headers instanceof Headers)&&(p.headers=new Headers(p.headers)),"concurrent"in p&&(p.concurrent=!!p.concurrent),/Response/.test(this.constructor.test(r))){if(l)throw new Error("frameClosure is not supported for responses.");i.donePromise=u(i,r,p)}else if(this.constructor.test(r)==="Generator"){if(l)throw new Error("frameClosure is not supported for generators.");i.donePromise=c(i,r,p)}else if(this.constructor.test(r)==="LiveProgramHandle"){if(l)throw new Error("frameClosure is not supported for live program handles.");i.donePromise=f(i,r,p)}else if(i.donePromise=Promise.resolve(o(i,r,p)),l){let m=x(r)&&!At(r)?S.proxy(r,{chainable:!0,membrane:r}):r;i.donePromise=Promise.resolve(l.call(this,m,this.#s.signal))}return this.#g(p.done===!1?new Promise(()=>{}):i.donePromise),await new Promise((m,h)=>{this.#c.signal.addEventListener("abort",()=>m(!1)),i.donePromise.then(()=>m(!0)).catch(h)})}toResponse({port:e,signal:r}={}){if(e&&!(e instanceof M))throw new Error("Client must be a MessagePortPlus interface");let n=V.from(this.body,{status:this.#o,statusText:this.#a,headers:this.#e}),s=C(this);if(ue(n).set("meta",s),!e)return n;x(this.#t)&&!At(this.#t)&&e.projectMutations({from:this.#t,to:"initial_response",signal:AbortSignal.any([this.#s.signal].concat(r||[]))});let i=()=>{let a=Object.fromEntries([...this.headers.entries()]);a?.["set-cookie"]&&(delete a["set-cookie"],console.warn('Warning: The "set-cookie" header is not supported for security reasons and has been removed from the response.')),e.postMessage({body:this.#t,status:this.#o,statusText:this.#a,headers:a,concurrent:this.#n},{type:"response.replace",live:!0,signal:AbortSignal.any([this.#s.signal].concat(r||[]))})};return this.addEventListener("replace",i,{signal:r}),this.readyStateChange("done").then(()=>{e.postMessage(null,{type:"response.done"})}),n}async*toGenerator({signal:e}={}){do yield this.body;while(await new Promise(r=>{this.addEventListener("replace",()=>r(!0),{once:!0,signal:e}),this.readyStateChange("done").then(()=>r(!1))}))}toLiveProgramHandle({signal:e}={}){let r=new Rt,n=()=>S.defineProperty(r,"value",{value:this.body,enumerable:!1,configurable:!0});return this.addEventListener("replace",n,{signal:e}),n(),r}clone(e={}){let r=new this.constructor,n=C(this);return ue(r).set("meta",new Map(n)),r.replaceWith(this,e),r}},cn=t=>typeof t?.next=="function"&&typeof t?.throw=="function"&&typeof t?.return=="function";function _e(){let t=C(this);if(!t.has("readystate_registry")){let e=n=>(n.promise=new Promise((s,i)=>(n.resolve=s,n.reject=i)),n),r={live:e({}),done:e({})};(function n(){return r.now=e({}),r.now.refresh=n,r.now})(),t.set("readystate_registry",r)}return t.get("readystate_registry")}var $t=class extends Event{#r;get data(){return this.#r}constructor(e){super("replace"),this.#r=e}},Rt=class{[Symbol.toStringTag]="LiveProgramHandle";abort(){}};globalThis.webqit||(globalThis.webqit={});Object.assign(globalThis.webqit,jt);})();
2
2
  //# sourceMappingURL=main.js.map