soonjs 0.0.34 → 0.1.1

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.
Files changed (61) hide show
  1. package/dist/deps/acorn-jU-39Pbw5W-u1bfg8xs1.js +3005 -0
  2. package/dist/deps/acorn-jU-39Pbw5W-xtcc0mcm8.js +16 -0
  3. package/dist/deps/angular-eXKcfordor-0ygbm9apc.js +3 -0
  4. package/dist/deps/angular-eXKcfordor-lxak3m3oa.js +2533 -0
  5. package/dist/deps/babel-QODt_XJZCU-4gvnd7es0.js +15 -0
  6. package/dist/deps/babel-QODt_XJZCU-nh2aovcen.js +7217 -0
  7. package/dist/deps/estree-_Gcr3virjH-1bpj2kcix.js +44 -0
  8. package/dist/deps/estree-_Gcr3virjH-rrazsks16.js +4528 -0
  9. package/dist/deps/flow-VkrRJr6lFd-mp3s51oq0.js +20 -0
  10. package/dist/deps/flow-VkrRJr6lFd-yovvyd1ma.js +27411 -0
  11. package/dist/deps/{glimmer-SKEURx3bl3-j891aljn1.js → glimmer-I6jyK4xw2I-izy00sbl3.js} +1409 -1462
  12. package/dist/deps/glimmer-I6jyK4xw2I-lpxioj9kk.js +37 -0
  13. package/dist/deps/graphql-F7JRnTC996-1vkxkg27g.js +28 -0
  14. package/dist/deps/graphql-F7JRnTC996-4l730c4g8.js +1221 -0
  15. package/dist/deps/html-C-ZYESkdqr-j3xdild5v.js +2791 -0
  16. package/dist/deps/html-C-ZYESkdqr-q28g9ydgp.js +25 -0
  17. package/dist/deps/markdown-4m9fGqwyBD-demptbrpo.js +3190 -0
  18. package/dist/deps/markdown-4m9fGqwyBD-imrswnrkg.js +62 -0
  19. package/dist/deps/meriyah-2XmgupY1jB-0fs5jh8tm.js +2645 -0
  20. package/dist/deps/meriyah-2XmgupY1jB-7adtk0vxn.js +5 -0
  21. package/dist/deps/postcss-UtIjNac23s-6repleub0.js +4739 -0
  22. package/dist/deps/postcss-UtIjNac23s-t5h4tlmc4.js +61 -0
  23. package/dist/deps/typescript-7W94NRN5-v-4or305h9a.js +21 -0
  24. package/dist/deps/typescript-7W94NRN5-v-npfcj3fw8.js +12947 -0
  25. package/dist/deps/yaml-GTMY6ek0xu-cn65bvv4v.js +4079 -0
  26. package/dist/deps/yaml-GTMY6ek0xu-fqkcyzhy7.js +159 -0
  27. package/dist/index.cjs +8 -8
  28. package/dist/index.js +1412 -1198
  29. package/dist/vite-plugin-soon-client.cjs +148 -156
  30. package/dist/vite-plugin-soon-client.js +33643 -38238
  31. package/dist/vite-plugin-soon-server.cjs +19 -20
  32. package/dist/vite-plugin-soon-server.d.ts +2 -2
  33. package/dist/vite-plugin-soon-server.js +1142 -1153
  34. package/package.json +12 -10
  35. package/dist/deps/acorn-MFuat2YCgG-b60r79xuq.js +0 -15
  36. package/dist/deps/acorn-MFuat2YCgG-znyzt9bsi.js +0 -2895
  37. package/dist/deps/angular-Nz7Izt9RB4-3agl5iuad.js +0 -1
  38. package/dist/deps/angular-Nz7Izt9RB4-k9gll1g2p.js +0 -1448
  39. package/dist/deps/babel-JaNXSJC73c-78chk7vt0.js +0 -6844
  40. package/dist/deps/babel-JaNXSJC73c-kufra91xr.js +0 -15
  41. package/dist/deps/estree-lrVsLbm9_D-ddquqk13a.js +0 -4265
  42. package/dist/deps/estree-lrVsLbm9_D-h2bhlvrak.js +0 -36
  43. package/dist/deps/flow-MAZ63dnw8p-9qklekr72.js +0 -19
  44. package/dist/deps/flow-MAZ63dnw8p-bkeo4owf1.js +0 -26221
  45. package/dist/deps/glimmer-SKEURx3bl3-igeybe6v2.js +0 -30
  46. package/dist/deps/graphql--N7MQg-wpp-gcvs9060v.js +0 -29
  47. package/dist/deps/graphql--N7MQg-wpp-tvobch3j0.js +0 -1212
  48. package/dist/deps/html-WW7XljTSl6-x8sxwnqcb.js +0 -2623
  49. package/dist/deps/html-WW7XljTSl6-ylw8ht4cg.js +0 -23
  50. package/dist/deps/markdown-i-DCK3AslU-gavz86jke.js +0 -62
  51. package/dist/deps/markdown-i-DCK3AslU-jj4g2i9mp.js +0 -3058
  52. package/dist/deps/meriyah-0-URq6zZ8n-bq3yx0s50.js +0 -4
  53. package/dist/deps/meriyah-0-URq6zZ8n-yvpkfa2jn.js +0 -2320
  54. package/dist/deps/postcss-urUw1vxeu1-rvrg58zgo.js +0 -52
  55. package/dist/deps/postcss-urUw1vxeu1-sr2tuk3a4.js +0 -4664
  56. package/dist/deps/typescript-5-LBeuVeDB-jbsjwqvq8.js +0 -20
  57. package/dist/deps/typescript-5-LBeuVeDB-wgvb9qpn3.js +0 -12794
  58. package/dist/deps/yaml-zChCAOpgM7-2tuvm27wb.js +0 -161
  59. package/dist/deps/yaml-zChCAOpgM7-8sl1vv60w.js +0 -4088
  60. /package/dist/deps/{soon-id-t25L9qRGGZ-xzfp84d25.js → soon-id-t25L9qRGGZ-3kxe385xx.js} +0 -0
  61. /package/dist/deps/{soon-id-t25L9qRGGZ-5apkd8o17.js → soon-id-t25L9qRGGZ-j2kn3bq83.js} +0 -0
package/dist/index.cjs CHANGED
@@ -1,15 +1,15 @@
1
- "use strict";var vt=Object.defineProperty;var gt=(r,e,t)=>e in r?vt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var x=(r,e,t)=>gt(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const wt=require("stream"),J=require("./deps/soon-id-t25L9qRGGZ-5apkd8o17.js"),bt=require("util");var k={};Object.defineProperty(k,"__esModule",{value:!0});k.TokenData=void 0;k.parse=Ce;k.compile=It;var St=k.match=Ot;k.pathToRegexp=_t;const Et="/",nr=r=>r,At=new RegExp("^\\p{XID_Continue}$","u"),fe="https://git.new/pathToRegexpError",Pt={"!":"!","@":"@",";":";",",":",","*":"*","+":"+","?":"?","{":"{","}":"}"};function $t(r){const e=[...r],t=[];let n=0;for(;n<e.length;){const a=e[n],o=Pt[a];if(o){t.push({type:o,index:n++,value:a});continue}if(a==="\\"){t.push({type:"ESCAPED",index:n++,value:e[n++]});continue}if(a===":"){let i="";for(;At.test(e[++n]);)i+=e[n];if(!i)throw new TypeError(`Missing parameter name at ${n}`);t.push({type:"NAME",index:n,value:i});continue}if(a==="("){const i=n++;let f=1,l="";if(e[n]==="?")throw new TypeError(`Pattern cannot start with "?" at ${n}`);for(;n<e.length;){if(e[n]==="\\"){l+=e[n++]+e[n++];continue}if(e[n]===")"){if(f--,f===0){n++;break}}else if(e[n]==="("&&(f++,e[n+1]!=="?"))throw new TypeError(`Capturing groups are not allowed at ${n}`);l+=e[n++]}if(f)throw new TypeError(`Unbalanced pattern at ${i}`);if(!l)throw new TypeError(`Missing pattern at ${i}`);t.push({type:"PATTERN",index:n,value:l});continue}t.push({type:"CHAR",index:n,value:e[n++]})}return t.push({type:"END",index:n,value:""}),new xt(t)}class xt{constructor(e){this.tokens=e,this.index=0}peek(){return this.tokens[this.index]}tryConsume(e){const t=this.peek();if(t.type===e)return this.index++,t.value}consume(e){const t=this.tryConsume(e);if(t!==void 0)return t;const{type:n,index:a}=this.peek();throw new TypeError(`Unexpected ${n} at ${a}, expected ${e}: ${fe}`)}text(){let e="",t;for(;t=this.tryConsume("CHAR")||this.tryConsume("ESCAPED");)e+=t;return e}modifier(){return this.tryConsume("?")||this.tryConsume("*")||this.tryConsume("+")}}class pe{constructor(e,t){this.tokens=e,this.delimiter=t}}k.TokenData=pe;function Ce(r,e={}){const{encodePath:t=nr,delimiter:n=t(Et)}=e,a=[],o=$t(r);let i=0;do{const f=o.text();f&&a.push(t(f));const l=o.tryConsume("NAME"),u=o.tryConsume("PATTERN");if(l||u){a.push({name:l||String(i++),pattern:u});const c=o.peek();if(c.type==="*")throw new TypeError(`Unexpected * at ${c.index}, you probably want \`/*\` or \`{/:foo}*\`: ${fe}`);continue}if(o.tryConsume("*")){a.push({name:String(i++),pattern:`(?:(?!${X(n)}).)*`,modifier:"*",separator:n});continue}if(o.tryConsume("{")){const c=o.text(),d=o.tryConsume("NAME"),y=o.tryConsume("PATTERN"),m=o.text(),g=o.tryConsume(";")&&o.text();o.consume("}");const S=o.modifier();a.push({name:d||(y?String(i++):""),prefix:t(c),suffix:t(m),pattern:y,modifier:S,separator:g});continue}o.consume("END");break}while(!0);return new pe(a,n)}function It(r,e={}){const t=r instanceof pe?r:Ce(r,e);return Ct(t,e)}function Tt(r,e){if(typeof r=="string")return()=>r;const t=e||nr,n=r.modifier==="+"||r.modifier==="*",a=r.modifier==="?"||r.modifier==="*",{prefix:o="",suffix:i="",separator:f=i+o}=r;if(e&&n){const u=(p,c)=>{if(typeof p!="string")throw new TypeError(`Expected "${r.name}/${c}" to be a string`);return t(p)},s=p=>{if(!Array.isArray(p))throw new TypeError(`Expected "${r.name}" to be an array`);return p.length===0?"":o+p.map(u).join(f)+i};return a?p=>{const c=p[r.name];return c==null?"":c.length?s(c):""}:p=>{const c=p[r.name];return s(c)}}const l=u=>{if(typeof u!="string")throw new TypeError(`Expected "${r.name}" to be a string`);return o+t(u)+i};return a?u=>{const s=u[r.name];return s==null?"":l(s)}:u=>{const s=u[r.name];return l(s)}}function Ct(r,e){const{encode:t=encodeURIComponent,loose:n=!0,validate:a=!0,strict:o=!1}=e,i=Lr(e),f=ar(n,r.delimiter),l=qr(r,f,[],i,o),u=r.tokens.map((s,p)=>{const c=Tt(s,t);if(!a||typeof s=="string")return c;const d=new RegExp(`^${l[p]}$`,i);return y=>{const m=c(y);if(!d.test(m))throw new TypeError(`Invalid value for "${s.name}": ${JSON.stringify(m)}`);return m}});return function(p={}){let c="";for(const d of u)c+=d(p);return c}}function Ot(r,e={}){const{decode:t=decodeURIComponent,loose:n=!0}=e,a=r instanceof pe?r:Ce(r,e),o=ar(n,a.delimiter),i=[],f=Wr(a,i,e),l=i.map(u=>{if(t&&(u.modifier==="+"||u.modifier==="*")){const{prefix:s="",suffix:p="",separator:c=p+s}=u,d=new RegExp(o(c),"g");return y=>y.split(d).map(t)}return t||nr});return function(s){const p=f.exec(s);if(!p)return!1;const{0:c,index:d}=p,y=Object.create(null);for(let m=1;m<p.length;m++){if(p[m]===void 0)continue;const g=i[m-1],S=l[m-1];y[g.name]=S(p[m])}return{path:c,index:d,params:y}}}function X(r){return r.replace(/([.+*?^${}()[\]|/\\])/g,"\\$1")}function Rt(r,e){const t=X(r);return e?`(?:${t})+(?!${t})`:t}function ar(r,e){if(!r)return X;const t=new RegExp(`(?:(?!${X(e)}).)+|(.)`,"g");return n=>n.replace(t,Rt)}function Lr(r){return r.sensitive?"":"i"}function Wr(r,e,t){const{trailing:n=!0,loose:a=!0,start:o=!0,end:i=!0,strict:f=!1}=t,l=Lr(t),u=ar(a,r.delimiter),s=qr(r,u,e,l,f);let p=o?"^":"";return p+=s.join(""),n&&(p+=`(?:${u(r.delimiter)})?`),p+=i?"$":`(?=${X(r.delimiter)}|$)`,new RegExp(p,l)}function qr(r,e,t,n,a){const o=`(?:(?!${X(r.delimiter)}).)+?`;let i="",f=!0;return r.tokens.map((l,u)=>{if(typeof l=="string")return i=l,e(l);const{prefix:s="",suffix:p="",separator:c=p+s,modifier:d=""}=l,y=e(s),m=e(p);if(l.name){const g=l.pattern?`(?:${l.pattern})`:o,S=Dt(g,l.name,n);if(f||(f=Me(S,s||i)),!f)throw new TypeError(`Ambiguous pattern for "${l.name}": ${fe}`);if(f=!a||Me(S,p),i="",t.push(l),d==="+"||d==="*"){const P=d==="*"?"?":"",h=e(c);if(!h)throw new TypeError(`Missing separator for "${l.name}": ${fe}`);if(f||(f=!a||Me(S,c)),!f)throw new TypeError(`Ambiguous pattern for "${l.name}" separator: ${fe}`);return f=!a,`(?:${y}(${g}(?:${h}${g})*)${m})${P}`}return`(?:${y}(${g})${m})${d}`}return`(?:${y}${m})${d}`})}function Dt(r,e,t){try{return new RegExp(`^${r}$`,t)}catch(n){throw new TypeError(`Invalid pattern for "${e}": ${n.message}`)}}function Me(r,e){return e?!r.test(e):!1}function _t(r,e={}){const t=r instanceof pe?r:Ce(r,e),n=[],a=Wr(t,n,e);return Object.assign(a,{keys:n})}var Oe={};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.Observable=void 0;const Gr=r=>!!Symbol[r],or=r=>Gr(r)?Symbol[r]:"@@"+r,Mt=or("iterator"),Qe=or("observable"),kr=or("species");function Pe(r,e){let t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function ie(r){let e=r.constructor;return e!==void 0&&(e=e[kr],e===null&&(e=void 0)),e!==void 0?e:Re}function Nt(r){return r instanceof Re}function Y(r){Y.log?Y.log(r):setTimeout(()=>{throw r})}function be(r){Promise.resolve().then(()=>{try{r()}catch(e){Y(e)}})}function zr(r){let e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{let t=Pe(e,"unsubscribe");t&&t.call(e)}}catch(t){Y(t)}}function je(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function Ut(r){let e=r._queue;if(e){r._queue=void 0,r._state="ready";for(let t=0;t<e.length&&(Hr(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Hr(r,e,t){r._state="running";let n=r._observer;try{let a=Pe(n,e);switch(e){case"next":a&&a.call(n,t);break;case"error":if(je(r),a)a.call(n,t);else throw t;break;case"complete":je(r),a&&a.call(n);break}}catch(a){Y(a)}r._state==="closed"?zr(r):r._state==="running"&&(r._state="ready")}function Ne(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],be(()=>Ut(r));return}Hr(r,e,t)}}class Bt{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,a={get closed(){return n._state==="closed"},next(o){Ne(n,"next",o)},error(o){Ne(n,"error",o)},complete(){Ne(n,"complete")}};try{this._cleanup=t.call(void 0,a)}catch(o){a.error(o)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(je(this),zr(this))}}let Re=class Se{constructor(e){if(!(this instanceof Se))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return(typeof e!="object"||e===null)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new Bt(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function a(){o.unsubscribe(),t()}let o=this.subscribe({next(i){try{e(i,a)}catch(f){n(f),o.unsubscribe()}},error:n,complete:t})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=ie(this);return new t(n=>this.subscribe({next(a){try{a=e(a)}catch(o){return n.error(o)}n.next(a)},error(a){n.error(a)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=ie(this);return new t(n=>this.subscribe({next(a){try{if(!e(a))return}catch(o){return n.error(o)}n.next(a)},error(a){n.error(a)},complete(){n.complete()}}))}reduce(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=ie(this),n=arguments.length>1,a=!1,i=arguments[1];return new t(f=>this.subscribe({next(l){let u=!a;if(a=!0,!u||n)try{i=e(i,l)}catch(s){return f.error(s)}else i=l},error(l){f.error(l)},complete(){if(!a&&!n)return f.error(new TypeError("Cannot reduce an empty sequence"));f.next(i),f.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=ie(this);return new t(n=>{let a,o=0;function i(f){a=f.subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){o===e.length?(a=void 0,n.complete()):i(t.from(e[o++]))}})}return i(this),()=>{a&&(a.unsubscribe(),a=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=ie(this);return new t(n=>{let a=[],o=this.subscribe({next(f){if(e)try{f=e(f)}catch(u){return n.error(u)}let l=t.from(f).subscribe({next(u){n.next(u)},error(u){n.error(u)},complete(){let u=a.indexOf(l);u>=0&&a.splice(u,1),i()}});a.push(l)},error(f){n.error(f)},complete(){i()}});function i(){o.closed&&a.length===0&&n.complete()}return()=>{a.forEach(f=>f.unsubscribe()),o.unsubscribe()}})}[Qe](){return this}static from(e){let t=typeof this=="function"?this:Se;if(e==null)throw new TypeError(e+" is not an object");let n=Pe(e,Qe);if(n){let a=n.call(e);if(Object(a)!==a)throw new TypeError(a+" is not an object");return Nt(a)&&a.constructor===t?a:new t(o=>a.subscribe(o))}if(Gr("iterator")&&(n=Pe(e,Mt),n))return new t(a=>{be(()=>{if(!a.closed){for(let o of n.call(e))if(a.next(o),a.closed)return;a.complete()}})});if(Array.isArray(e))return new t(a=>{be(()=>{if(!a.closed){for(let o=0;o<e.length;++o)if(a.next(e[o]),a.closed)return;a.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){let t=typeof this=="function"?this:Se;return new t(n=>{be(()=>{if(!n.closed){for(let a=0;a<e.length;++a)if(n.next(e[a]),n.closed)return;n.complete()}})})}static get[kr](){return this}};Oe.Observable=Re;Object.defineProperty(Re,Symbol("extensions"),{value:{symbol:Qe,hostReportError:Y},configurable:!0});var Ft=Oe.Observable;const ir=J.getDefaultExportFromCjs(Ft);var Lt=Error,Wt=EvalError,qt=RangeError,Gt=ReferenceError,Kr=SyntaxError,ye=TypeError,kt=URIError,zt=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(t in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var i=Object.getOwnPropertyDescriptor(e,t);if(i.value!==a||i.enumerable!==!0)return!1}return!0},mr=typeof Symbol<"u"&&Symbol,Ht=zt,Kt=function(){return typeof mr!="function"||typeof Symbol!="function"||typeof mr("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:Ht()},Ue={__proto__:null,foo:{}},Vt=Object,Qt=function(){return{__proto__:Ue}.foo===Ue.foo&&!(Ue instanceof Vt)},jt="Function.prototype.bind called on incompatible ",Jt=Object.prototype.toString,Xt=Math.max,Yt="[object Function]",hr=function(e,t){for(var n=[],a=0;a<e.length;a+=1)n[a]=e[a];for(var o=0;o<t.length;o+=1)n[o+e.length]=t[o];return n},Zt=function(e,t){for(var n=[],a=t,o=0;a<e.length;a+=1,o+=1)n[o]=e[a];return n},en=function(r,e){for(var t="",n=0;n<r.length;n+=1)t+=r[n],n+1<r.length&&(t+=e);return t},rn=function(e){var t=this;if(typeof t!="function"||Jt.apply(t)!==Yt)throw new TypeError(jt+t);for(var n=Zt(arguments,1),a,o=function(){if(this instanceof a){var s=t.apply(this,hr(n,arguments));return Object(s)===s?s:this}return t.apply(e,hr(n,arguments))},i=Xt(0,t.length-n.length),f=[],l=0;l<i;l++)f[l]="$"+l;if(a=Function("binder","return function ("+en(f,",")+"){ return binder.apply(this,arguments); }")(o),t.prototype){var u=function(){};u.prototype=t.prototype,a.prototype=new u,u.prototype=null}return a},tn=rn,lr=Function.prototype.bind||tn,nn=Function.prototype.call,an=Object.prototype.hasOwnProperty,on=lr,ln=on.call(nn,an),v,fn=Lt,un=Wt,cn=qt,sn=Gt,Z=Kr,j=ye,pn=kt,Vr=Function,Be=function(r){try{return Vr('"use strict"; return ('+r+").constructor;")()}catch{}},q=Object.getOwnPropertyDescriptor;if(q)try{q({},"")}catch{q=null}var Fe=function(){throw new j},yn=q?function(){try{return arguments.callee,Fe}catch{try{return q(arguments,"callee").get}catch{return Fe}}}():Fe,K=Kt(),dn=Qt(),A=Object.getPrototypeOf||(dn?function(r){return r.__proto__}:null),Q={},mn=typeof Uint8Array>"u"||!A?v:A(Uint8Array),G={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?v:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?v:ArrayBuffer,"%ArrayIteratorPrototype%":K&&A?A([][Symbol.iterator]()):v,"%AsyncFromSyncIteratorPrototype%":v,"%AsyncFunction%":Q,"%AsyncGenerator%":Q,"%AsyncGeneratorFunction%":Q,"%AsyncIteratorPrototype%":Q,"%Atomics%":typeof Atomics>"u"?v:Atomics,"%BigInt%":typeof BigInt>"u"?v:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?v:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?v:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?v:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":fn,"%eval%":eval,"%EvalError%":un,"%Float32Array%":typeof Float32Array>"u"?v:Float32Array,"%Float64Array%":typeof Float64Array>"u"?v:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?v:FinalizationRegistry,"%Function%":Vr,"%GeneratorFunction%":Q,"%Int8Array%":typeof Int8Array>"u"?v:Int8Array,"%Int16Array%":typeof Int16Array>"u"?v:Int16Array,"%Int32Array%":typeof Int32Array>"u"?v:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":K&&A?A(A([][Symbol.iterator]())):v,"%JSON%":typeof JSON=="object"?JSON:v,"%Map%":typeof Map>"u"?v:Map,"%MapIteratorPrototype%":typeof Map>"u"||!K||!A?v:A(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?v:Promise,"%Proxy%":typeof Proxy>"u"?v:Proxy,"%RangeError%":cn,"%ReferenceError%":sn,"%Reflect%":typeof Reflect>"u"?v:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?v:Set,"%SetIteratorPrototype%":typeof Set>"u"||!K||!A?v:A(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?v:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":K&&A?A(""[Symbol.iterator]()):v,"%Symbol%":K?Symbol:v,"%SyntaxError%":Z,"%ThrowTypeError%":yn,"%TypedArray%":mn,"%TypeError%":j,"%Uint8Array%":typeof Uint8Array>"u"?v:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?v:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?v:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?v:Uint32Array,"%URIError%":pn,"%WeakMap%":typeof WeakMap>"u"?v:WeakMap,"%WeakRef%":typeof WeakRef>"u"?v:WeakRef,"%WeakSet%":typeof WeakSet>"u"?v:WeakSet};if(A)try{null.error}catch(r){var hn=A(A(r));G["%Error.prototype%"]=hn}var vn=function r(e){var t;if(e==="%AsyncFunction%")t=Be("async function () {}");else if(e==="%GeneratorFunction%")t=Be("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=Be("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&A&&(t=A(a.prototype))}return G[e]=t,t},vr={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},de=lr,$e=ln,gn=de.call(Function.call,Array.prototype.concat),wn=de.call(Function.apply,Array.prototype.splice),gr=de.call(Function.call,String.prototype.replace),xe=de.call(Function.call,String.prototype.slice),bn=de.call(Function.call,RegExp.prototype.exec),Sn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,En=/\\(\\)?/g,An=function(e){var t=xe(e,0,1),n=xe(e,-1);if(t==="%"&&n!=="%")throw new Z("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new Z("invalid intrinsic syntax, expected opening `%`");var a=[];return gr(e,Sn,function(o,i,f,l){a[a.length]=f?gr(l,En,"$1"):i||o}),a},Pn=function(e,t){var n=e,a;if($e(vr,n)&&(a=vr[n],n="%"+a[0]+"%"),$e(G,n)){var o=G[n];if(o===Q&&(o=vn(n)),typeof o>"u"&&!t)throw new j("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:o}}throw new Z("intrinsic "+e+" does not exist!")},te=function(e,t){if(typeof e!="string"||e.length===0)throw new j("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new j('"allowMissing" argument must be a boolean');if(bn(/^%?[^%]*%?$/,e)===null)throw new Z("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=An(e),a=n.length>0?n[0]:"",o=Pn("%"+a+"%",t),i=o.name,f=o.value,l=!1,u=o.alias;u&&(a=u[0],wn(n,gn([0,1],u)));for(var s=1,p=!0;s<n.length;s+=1){var c=n[s],d=xe(c,0,1),y=xe(c,-1);if((d==='"'||d==="'"||d==="`"||y==='"'||y==="'"||y==="`")&&d!==y)throw new Z("property names with quotes must have matching quotes");if((c==="constructor"||!p)&&(l=!0),a+="."+c,i="%"+a+"%",$e(G,i))f=G[i];else if(f!=null){if(!(c in f)){if(!t)throw new j("base intrinsic for "+e+" exists, but the property is not available.");return}if(q&&s+1>=n.length){var m=q(f,c);p=!!m,p&&"get"in m&&!("originalValue"in m.get)?f=m.get:f=f[c]}else p=$e(f,c),f=f[c];p&&!l&&(G[i]=f)}}return f},Qr={exports:{}},Le,wr;function fr(){if(wr)return Le;wr=1;var r=te,e=r("%Object.defineProperty%",!0)||!1;if(e)try{e({},"a",{value:1})}catch{e=!1}return Le=e,Le}var $n=te,Ee=$n("%Object.getOwnPropertyDescriptor%",!0);if(Ee)try{Ee([],"length")}catch{Ee=null}var jr=Ee,br=fr(),xn=Kr,V=ye,Sr=jr,In=function(e,t,n){if(!e||typeof e!="object"&&typeof e!="function")throw new V("`obj` must be an object or a function`");if(typeof t!="string"&&typeof t!="symbol")throw new V("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new V("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new V("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new V("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new V("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,o=arguments.length>4?arguments[4]:null,i=arguments.length>5?arguments[5]:null,f=arguments.length>6?arguments[6]:!1,l=!!Sr&&Sr(e,t);if(br)br(e,t,{configurable:i===null&&l?l.configurable:!i,enumerable:a===null&&l?l.enumerable:!a,value:n,writable:o===null&&l?l.writable:!o});else if(f||!a&&!o&&!i)e[t]=n;else throw new xn("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},Je=fr(),Jr=function(){return!!Je};Jr.hasArrayLengthDefineBug=function(){if(!Je)return null;try{return Je([],"length",{value:1}).length!==1}catch{return!0}};var Tn=Jr,Cn=te,Er=In,On=Tn(),Ar=jr,Pr=ye,Rn=Cn("%Math.floor%"),Dn=function(e,t){if(typeof e!="function")throw new Pr("`fn` is not a function");if(typeof t!="number"||t<0||t>4294967295||Rn(t)!==t)throw new Pr("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],a=!0,o=!0;if("length"in e&&Ar){var i=Ar(e,"length");i&&!i.configurable&&(a=!1),i&&!i.writable&&(o=!1)}return(a||o||!n)&&(On?Er(e,"length",t,!0,!0):Er(e,"length",t)),e};(function(r){var e=lr,t=te,n=Dn,a=ye,o=t("%Function.prototype.apply%"),i=t("%Function.prototype.call%"),f=t("%Reflect.apply%",!0)||e.call(i,o),l=fr(),u=t("%Math.max%");r.exports=function(c){if(typeof c!="function")throw new a("a function is required");var d=f(e,i,arguments);return n(d,1+u(0,c.length-(arguments.length-1)),!0)};var s=function(){return f(e,o,arguments)};l?l(r.exports,"apply",{value:s}):r.exports.apply=s})(Qr);var _n=Qr.exports,Xr=te,Yr=_n,Mn=Yr(Xr("String.prototype.indexOf")),Nn=function(e,t){var n=Xr(e,!!t);return typeof n=="function"&&Mn(e,".prototype.")>-1?Yr(n):n},Un=bt.inspect,ur=typeof Map=="function"&&Map.prototype,We=Object.getOwnPropertyDescriptor&&ur?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,Ie=ur&&We&&typeof We.get=="function"?We.get:null,$r=ur&&Map.prototype.forEach,cr=typeof Set=="function"&&Set.prototype,qe=Object.getOwnPropertyDescriptor&&cr?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Te=cr&&qe&&typeof qe.get=="function"?qe.get:null,xr=cr&&Set.prototype.forEach,Bn=typeof WeakMap=="function"&&WeakMap.prototype,ue=Bn?WeakMap.prototype.has:null,Fn=typeof WeakSet=="function"&&WeakSet.prototype,ce=Fn?WeakSet.prototype.has:null,Ln=typeof WeakRef=="function"&&WeakRef.prototype,Ir=Ln?WeakRef.prototype.deref:null,Wn=Boolean.prototype.valueOf,qn=Object.prototype.toString,Gn=Function.prototype.toString,kn=String.prototype.match,sr=String.prototype.slice,U=String.prototype.replace,zn=String.prototype.toUpperCase,Tr=String.prototype.toLowerCase,Zr=RegExp.prototype.test,Cr=Array.prototype.concat,O=Array.prototype.join,Hn=Array.prototype.slice,Or=Math.floor,Xe=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ge=Object.getOwnPropertySymbols,Ye=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,ee=typeof Symbol=="function"&&typeof Symbol.iterator=="object",$=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===ee||!0)?Symbol.toStringTag:null,et=Object.prototype.propertyIsEnumerable,Rr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Dr(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||Zr.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-Or(-r):Or(r);if(n!==r){var a=String(n),o=sr.call(e,a.length+1);return U.call(a,t,"$&_")+"."+U.call(U.call(o,/([0-9]{3})/g,"$&_"),/_$/,"")}}return U.call(e,t,"$&_")}var Ze=Un,_r=Ze.custom,Mr=tt(_r)?_r:null,Kn=function r(e,t,n,a){var o=t||{};if(N(o,"quoteStyle")&&o.quoteStyle!=="single"&&o.quoteStyle!=="double")throw new TypeError('option "quoteStyle" must be "single" or "double"');if(N(o,"maxStringLength")&&(typeof o.maxStringLength=="number"?o.maxStringLength<0&&o.maxStringLength!==1/0:o.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var i=N(o,"customInspect")?o.customInspect:!0;if(typeof i!="boolean"&&i!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(N(o,"indent")&&o.indent!==null&&o.indent!==" "&&!(parseInt(o.indent,10)===o.indent&&o.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(N(o,"numericSeparator")&&typeof o.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var f=o.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return at(e,o);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return f?Dr(e,l):l}if(typeof e=="bigint"){var u=String(e)+"n";return f?Dr(e,u):u}var s=typeof o.depth>"u"?5:o.depth;if(typeof n>"u"&&(n=0),n>=s&&s>0&&typeof e=="object")return er(e)?"[Array]":"[Object]";var p=ca(o,n);if(typeof a>"u")a=[];else if(nt(a,e)>=0)return"[Circular]";function c(I,_,M){if(_&&(a=Hn.call(a),a.push(_)),M){var oe={depth:o.depth};return N(o,"quoteStyle")&&(oe.quoteStyle=o.quoteStyle),r(I,oe,n+1,a)}return r(I,o,n+1,a)}if(typeof e=="function"&&!Nr(e)){var d=ra(e),y=ve(e,c);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(y.length>0?" { "+O.call(y,", ")+" }":"")}if(tt(e)){var m=ee?U.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):Ye.call(e);return typeof e=="object"&&!ee?le(m):m}if(la(e)){for(var g="<"+Tr.call(String(e.nodeName)),S=e.attributes||[],P=0;P<S.length;P++)g+=" "+S[P].name+"="+rt(Vn(S[P].value),"double",o);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+Tr.call(String(e.nodeName))+">",g}if(er(e)){if(e.length===0)return"[]";var h=ve(e,c);return p&&!ua(h)?"["+rr(h,p)+"]":"[ "+O.call(h,", ")+" ]"}if(jn(e)){var R=ve(e,c);return!("cause"in Error.prototype)&&"cause"in e&&!et.call(e,"cause")?"{ ["+String(e)+"] "+O.call(Cr.call("[cause]: "+c(e.cause),R),", ")+" }":R.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+O.call(R,", ")+" }"}if(typeof e=="object"&&i){if(Mr&&typeof e[Mr]=="function"&&Ze)return Ze(e,{depth:s-n});if(i!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(ta(e)){var F=[];return $r&&$r.call(e,function(I,_){F.push(c(_,e,!0)+" => "+c(I,e))}),Ur("Map",Ie.call(e),F,p)}if(oa(e)){var ae=[];return xr&&xr.call(e,function(I){ae.push(c(I,e))}),Ur("Set",Te.call(e),ae,p)}if(na(e))return ke("WeakMap");if(ia(e))return ke("WeakSet");if(aa(e))return ke("WeakRef");if(Xn(e))return le(c(Number(e)));if(Zn(e))return le(c(Xe.call(e)));if(Yn(e))return le(Wn.call(e));if(Jn(e))return le(c(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof J.commonjsGlobal<"u"&&e===J.commonjsGlobal)return"{ [object globalThis] }";if(!Qn(e)&&!Nr(e)){var z=ve(e,c),me=Rr?Rr(e)===Object.prototype:e instanceof Object||e.constructor===Object,L=e instanceof Object?"":"null prototype",D=!me&&$&&Object(e)===e&&$ in e?sr.call(B(e),8,-1):L?"Object":"",he=me||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",H=he+(D||L?"["+O.call(Cr.call([],D||[],L||[]),": ")+"] ":"");return z.length===0?H+"{}":p?H+"{"+rr(z,p)+"}":H+"{ "+O.call(z,", ")+" }"}return String(e)};function rt(r,e,t){var n=(t.quoteStyle||e)==="double"?'"':"'";return n+r+n}function Vn(r){return U.call(String(r),/"/g,"&quot;")}function er(r){return B(r)==="[object Array]"&&(!$||!(typeof r=="object"&&$ in r))}function Qn(r){return B(r)==="[object Date]"&&(!$||!(typeof r=="object"&&$ in r))}function Nr(r){return B(r)==="[object RegExp]"&&(!$||!(typeof r=="object"&&$ in r))}function jn(r){return B(r)==="[object Error]"&&(!$||!(typeof r=="object"&&$ in r))}function Jn(r){return B(r)==="[object String]"&&(!$||!(typeof r=="object"&&$ in r))}function Xn(r){return B(r)==="[object Number]"&&(!$||!(typeof r=="object"&&$ in r))}function Yn(r){return B(r)==="[object Boolean]"&&(!$||!(typeof r=="object"&&$ in r))}function tt(r){if(ee)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!Ye)return!1;try{return Ye.call(r),!0}catch{}return!1}function Zn(r){if(!r||typeof r!="object"||!Xe)return!1;try{return Xe.call(r),!0}catch{}return!1}var ea=Object.prototype.hasOwnProperty||function(r){return r in this};function N(r,e){return ea.call(r,e)}function B(r){return qn.call(r)}function ra(r){if(r.name)return r.name;var e=kn.call(Gn.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function nt(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function ta(r){if(!Ie||!r||typeof r!="object")return!1;try{Ie.call(r);try{Te.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function na(r){if(!ue||!r||typeof r!="object")return!1;try{ue.call(r,ue);try{ce.call(r,ce)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function aa(r){if(!Ir||!r||typeof r!="object")return!1;try{return Ir.call(r),!0}catch{}return!1}function oa(r){if(!Te||!r||typeof r!="object")return!1;try{Te.call(r);try{Ie.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function ia(r){if(!ce||!r||typeof r!="object")return!1;try{ce.call(r,ce);try{ue.call(r,ue)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function la(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function at(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return at(sr.call(r,0,e.maxStringLength),e)+n}var a=U.call(U.call(r,/(['\\])/g,"\\$1"),/[\x00-\x1f]/g,fa);return rt(a,"single",e)}function fa(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+zn.call(e.toString(16))}function le(r){return"Object("+r+")"}function ke(r){return r+" { ? }"}function Ur(r,e,t,n){var a=n?rr(t,n):O.call(t,", ");return r+" ("+e+") {"+a+"}"}function ua(r){for(var e=0;e<r.length;e++)if(nt(r[e],`
2
- `)>=0)return!1;return!0}function ca(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=O.call(Array(r.indent+1)," ");else return null;return{base:t,prev:O.call(Array(e+1),t)}}function rr(r,e){if(r.length===0)return"";var t=`
3
- `+e.prev+e.base;return t+O.call(r,","+t)+`
4
- `+e.prev}function ve(r,e){var t=er(r),n=[];if(t){n.length=r.length;for(var a=0;a<r.length;a++)n[a]=N(r,a)?e(r[a],r):""}var o=typeof Ge=="function"?Ge(r):[],i;if(ee){i={};for(var f=0;f<o.length;f++)i["$"+o[f]]=o[f]}for(var l in r)N(r,l)&&(t&&String(Number(l))===l&&l<r.length||ee&&i["$"+l]instanceof Symbol||(Zr.call(/[^\w$]/,l)?n.push(e(l,r)+": "+e(r[l],r)):n.push(l+": "+e(r[l],r))));if(typeof Ge=="function")for(var u=0;u<o.length;u++)et.call(r,o[u])&&n.push("["+e(o[u])+"]: "+e(r[o[u]],r));return n}var ot=te,ne=Nn,sa=Kn,pa=ye,ge=ot("%WeakMap%",!0),we=ot("%Map%",!0),ya=ne("WeakMap.prototype.get",!0),da=ne("WeakMap.prototype.set",!0),ma=ne("WeakMap.prototype.has",!0),ha=ne("Map.prototype.get",!0),va=ne("Map.prototype.set",!0),ga=ne("Map.prototype.has",!0),pr=function(r,e){for(var t=r,n;(n=t.next)!==null;t=n)if(n.key===e)return t.next=n.next,n.next=r.next,r.next=n,n},wa=function(r,e){var t=pr(r,e);return t&&t.value},ba=function(r,e,t){var n=pr(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},Sa=function(r,e){return!!pr(r,e)},Ea=function(){var e,t,n,a={assert:function(o){if(!a.has(o))throw new pa("Side channel does not contain "+sa(o))},get:function(o){if(ge&&o&&(typeof o=="object"||typeof o=="function")){if(e)return ya(e,o)}else if(we){if(t)return ha(t,o)}else if(n)return wa(n,o)},has:function(o){if(ge&&o&&(typeof o=="object"||typeof o=="function")){if(e)return ma(e,o)}else if(we){if(t)return ga(t,o)}else if(n)return Sa(n,o);return!1},set:function(o,i){ge&&o&&(typeof o=="object"||typeof o=="function")?(e||(e=new ge),da(e,o,i)):we?(t||(t=new we),va(t,o,i)):(n||(n={key:{},next:null}),ba(n,o,i))}};return a},Aa=String.prototype.replace,Pa=/%20/g,ze={RFC1738:"RFC1738",RFC3986:"RFC3986"},yr={default:ze.RFC3986,formatters:{RFC1738:function(r){return Aa.call(r,Pa,"+")},RFC3986:function(r){return String(r)}},RFC1738:ze.RFC1738,RFC3986:ze.RFC3986},$a=yr,He=Object.prototype.hasOwnProperty,W=Array.isArray,T=function(){for(var r=[],e=0;e<256;++e)r.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return r}(),xa=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(W(n)){for(var a=[],o=0;o<n.length;++o)typeof n[o]<"u"&&a.push(n[o]);t.obj[t.prop]=a}}},it=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},a=0;a<e.length;++a)typeof e[a]<"u"&&(n[a]=e[a]);return n},Ia=function r(e,t,n){if(!t)return e;if(typeof t!="object"){if(W(e))e.push(t);else if(e&&typeof e=="object")(n&&(n.plainObjects||n.allowPrototypes)||!He.call(Object.prototype,t))&&(e[t]=!0);else return[e,t];return e}if(!e||typeof e!="object")return[e].concat(t);var a=e;return W(e)&&!W(t)&&(a=it(e,n)),W(e)&&W(t)?(t.forEach(function(o,i){if(He.call(e,i)){var f=e[i];f&&typeof f=="object"&&o&&typeof o=="object"?e[i]=r(f,o,n):e.push(o)}else e[i]=o}),e):Object.keys(t).reduce(function(o,i){var f=t[i];return He.call(o,i)?o[i]=r(o[i],f,n):o[i]=f,o},a)},Ta=function(e,t){return Object.keys(t).reduce(function(n,a){return n[a]=t[a],n},e)},Ca=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},Ke=1024,Oa=function(e,t,n,a,o){if(e.length===0)return e;var i=e;if(typeof e=="symbol"?i=Symbol.prototype.toString.call(e):typeof e!="string"&&(i=String(e)),n==="iso-8859-1")return escape(i).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var f="",l=0;l<i.length;l+=Ke){for(var u=i.length>=Ke?i.slice(l,l+Ke):i,s=[],p=0;p<u.length;++p){var c=u.charCodeAt(p);if(c===45||c===46||c===95||c===126||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122||o===$a.RFC1738&&(c===40||c===41)){s[s.length]=u.charAt(p);continue}if(c<128){s[s.length]=T[c];continue}if(c<2048){s[s.length]=T[192|c>>6]+T[128|c&63];continue}if(c<55296||c>=57344){s[s.length]=T[224|c>>12]+T[128|c>>6&63]+T[128|c&63];continue}p+=1,c=65536+((c&1023)<<10|u.charCodeAt(p)&1023),s[s.length]=T[240|c>>18]+T[128|c>>12&63]+T[128|c>>6&63]+T[128|c&63]}f+=s.join("")}return f},Ra=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],a=0;a<t.length;++a)for(var o=t[a],i=o.obj[o.prop],f=Object.keys(i),l=0;l<f.length;++l){var u=f[l],s=i[u];typeof s=="object"&&s!==null&&n.indexOf(s)===-1&&(t.push({obj:i,prop:u}),n.push(s))}return xa(t),e},Da=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},_a=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Ma=function(e,t){return[].concat(e,t)},Na=function(e,t){if(W(e)){for(var n=[],a=0;a<e.length;a+=1)n.push(t(e[a]));return n}return t(e)},lt={arrayToObject:it,assign:Ta,combine:Ma,compact:Ra,decode:Ca,encode:Oa,isBuffer:_a,isRegExp:Da,maybeMap:Na,merge:Ia},ft=Ea,Ae=lt,se=yr,Ua=Object.prototype.hasOwnProperty,ut={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},C=Array.isArray,Ba=Array.prototype.push,ct=function(r,e){Ba.apply(r,C(e)?e:[e])},Fa=Date.prototype.toISOString,Br=se.default,E={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Ae.encode,encodeValuesOnly:!1,format:Br,formatter:se.formatters[Br],indices:!1,serializeDate:function(e){return Fa.call(e)},skipNulls:!1,strictNullHandling:!1},La=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},Ve={},Wa=function r(e,t,n,a,o,i,f,l,u,s,p,c,d,y,m,g,S,P){for(var h=e,R=P,F=0,ae=!1;(R=R.get(Ve))!==void 0&&!ae;){var z=R.get(e);if(F+=1,typeof z<"u"){if(z===F)throw new RangeError("Cyclic object value");ae=!0}typeof R.get(Ve)>"u"&&(F=0)}if(typeof s=="function"?h=s(t,h):h instanceof Date?h=d(h):n==="comma"&&C(h)&&(h=Ae.maybeMap(h,function(_e){return _e instanceof Date?d(_e):_e})),h===null){if(i)return u&&!g?u(t,E.encoder,S,"key",y):t;h=""}if(La(h)||Ae.isBuffer(h)){if(u){var me=g?t:u(t,E.encoder,S,"key",y);return[m(me)+"="+m(u(h,E.encoder,S,"value",y))]}return[m(t)+"="+m(String(h))]}var L=[];if(typeof h>"u")return L;var D;if(n==="comma"&&C(h))g&&u&&(h=Ae.maybeMap(h,u)),D=[{value:h.length>0?h.join(",")||null:void 0}];else if(C(s))D=s;else{var he=Object.keys(h);D=p?he.sort(p):he}var H=l?t.replace(/\./g,"%2E"):t,I=a&&C(h)&&h.length===1?H+"[]":H;if(o&&C(h)&&h.length===0)return I+"[]";for(var _=0;_<D.length;++_){var M=D[_],oe=typeof M=="object"&&typeof M.value<"u"?M.value:h[M];if(!(f&&oe===null)){var De=c&&l?M.replace(/\./g,"%2E"):M,ht=C(h)?typeof n=="function"?n(I,De):I:I+(c?"."+De:"["+De+"]");P.set(e,F);var dr=ft();dr.set(Ve,P),ct(L,r(oe,ht,n,a,o,i,f,l,n==="comma"&&g&&C(h)?null:u,s,p,c,d,y,m,g,S,dr))}}return L},qa=function(e){if(!e)return E;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||E.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=se.default;if(typeof e.format<"u"){if(!Ua.call(se.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var a=se.formatters[n],o=E.filter;(typeof e.filter=="function"||C(e.filter))&&(o=e.filter);var i;if(e.arrayFormat in ut?i=e.arrayFormat:"indices"in e?i=e.indices?"indices":"repeat":i=E.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var f=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:E.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:E.addQueryPrefix,allowDots:f,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:E.allowEmptyArrays,arrayFormat:i,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:E.charsetSentinel,commaRoundTrip:e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?E.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:E.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:E.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:E.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:E.encodeValuesOnly,filter:o,format:n,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:E.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:E.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:E.strictNullHandling}},Ga=function(r,e){var t=r,n=qa(e),a,o;typeof n.filter=="function"?(o=n.filter,t=o("",t)):C(n.filter)&&(o=n.filter,a=o);var i=[];if(typeof t!="object"||t===null)return"";var f=ut[n.arrayFormat],l=f==="comma"&&n.commaRoundTrip;a||(a=Object.keys(t)),n.sort&&a.sort(n.sort);for(var u=ft(),s=0;s<a.length;++s){var p=a[s];n.skipNulls&&t[p]===null||ct(i,Wa(t[p],p,f,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,u))}var c=i.join(n.delimiter),d=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?d+="utf8=%26%2310003%3B&":d+="utf8=%E2%9C%93&"),c.length>0?d+c:""},re=lt,tr=Object.prototype.hasOwnProperty,ka=Array.isArray,b={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:re.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1},za=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},st=function(r,e){return r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1?r.split(","):r},Ha="utf8=%26%2310003%3B",Ka="utf8=%E2%9C%93",Va=function(e,t){var n={__proto__:null},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;a=a.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var o=t.parameterLimit===1/0?void 0:t.parameterLimit,i=a.split(t.delimiter,o),f=-1,l,u=t.charset;if(t.charsetSentinel)for(l=0;l<i.length;++l)i[l].indexOf("utf8=")===0&&(i[l]===Ka?u="utf-8":i[l]===Ha&&(u="iso-8859-1"),f=l,l=i.length);for(l=0;l<i.length;++l)if(l!==f){var s=i[l],p=s.indexOf("]="),c=p===-1?s.indexOf("="):p+1,d,y;c===-1?(d=t.decoder(s,b.decoder,u,"key"),y=t.strictNullHandling?null:""):(d=t.decoder(s.slice(0,c),b.decoder,u,"key"),y=re.maybeMap(st(s.slice(c+1),t),function(g){return t.decoder(g,b.decoder,u,"value")})),y&&t.interpretNumericEntities&&u==="iso-8859-1"&&(y=za(y)),s.indexOf("[]=")>-1&&(y=ka(y)?[y]:y);var m=tr.call(n,d);m&&t.duplicates==="combine"?n[d]=re.combine(n[d],y):(!m||t.duplicates==="last")&&(n[d]=y)}return n},Qa=function(r,e,t,n){for(var a=n?e:st(e,t),o=r.length-1;o>=0;--o){var i,f=r[o];if(f==="[]"&&t.parseArrays)i=t.allowEmptyArrays&&(a===""||t.strictNullHandling&&a===null)?[]:[].concat(a);else{i=t.plainObjects?Object.create(null):{};var l=f.charAt(0)==="["&&f.charAt(f.length-1)==="]"?f.slice(1,-1):f,u=t.decodeDotInKeys?l.replace(/%2E/g,"."):l,s=parseInt(u,10);!t.parseArrays&&u===""?i={0:a}:!isNaN(s)&&f!==u&&String(s)===u&&s>=0&&t.parseArrays&&s<=t.arrayLimit?(i=[],i[s]=a):u!=="__proto__"&&(i[u]=a)}a=i}return a},ja=function(e,t,n,a){if(e){var o=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,i=/(\[[^[\]]*])/,f=/(\[[^[\]]*])/g,l=n.depth>0&&i.exec(o),u=l?o.slice(0,l.index):o,s=[];if(u){if(!n.plainObjects&&tr.call(Object.prototype,u)&&!n.allowPrototypes)return;s.push(u)}for(var p=0;n.depth>0&&(l=f.exec(o))!==null&&p<n.depth;){if(p+=1,!n.plainObjects&&tr.call(Object.prototype,l[1].slice(1,-1))&&!n.allowPrototypes)return;s.push(l[1])}if(l){if(n.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+n.depth+" and strictDepth is true");s.push("["+o.slice(l.index)+"]")}return Qa(s,t,n,a)}},Ja=function(e){if(!e)return b;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=typeof e.charset>"u"?b.charset:e.charset,n=typeof e.duplicates>"u"?b.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var a=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:b.allowDots:!!e.allowDots;return{allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:b.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:b.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:b.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:b.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:b.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:b.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:b.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:b.decoder,delimiter:typeof e.delimiter=="string"||re.isRegExp(e.delimiter)?e.delimiter:b.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:b.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:b.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:b.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:b.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:b.strictDepth,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:b.strictNullHandling}},Xa=function(r,e){var t=Ja(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?Object.create(null):{};for(var n=typeof r=="string"?Va(r,t):r,a=t.plainObjects?Object.create(null):{},o=Object.keys(n),i=0;i<o.length;++i){var f=o[i],l=ja(f,n[f],t,typeof r=="string");a=re.merge(a,l,t)}return t.allowSparse===!0?a:re.compact(a)},Ya=Ga,Za=Xa,eo=yr,ro={formats:eo,parse:Za,stringify:Ya};const to=J.getDefaultExportFromCjs(ro);function Fr(r){if(!Array.isArray(r))throw new TypeError("Middleware stack must be an array!");for(const e of r)if(typeof e!="function")throw new TypeError("Middleware must be composed of functions!");return function(e,t){let n=-1;return a(0);function a(o){if(o<=n)return Promise.reject(new Error("next() called multiple times"));n=o;let i=r[o];if(o===r.length&&(i=t),!i)return Promise.resolve();try{return Promise.resolve(i(e,a.bind(null,o+1)))}catch(f){return Promise.reject(f)}}}}const w={app:null,appPending:!0,appCb:[],services:new Map,servicePending:new Map,serviceCb:new Map,config:null,configPending:!1,configCb:[]};async function no(r){if(w.config)return w.config;if(w.configPending)return new Promise(t=>{w.configCb.push(n=>t(n))});w.configPending=!0;const e=await r();return w.config=e,w.configCb.forEach(t=>t(e)),w.configCb=[],w.configPending=!1,e}class pt{constructor(e={},t){x(this,"options");x(this,"apis",[]);x(this,"middlewares",[]);x(this,"defaultMiddlewares",[async(e,t)=>{try{await t()}catch(n){e.res.body=n.message||""}}]);x(this,"api404");x(this,"fnMiddleware");x(this,"getId");x(this,"extensions",new Map);x(this,"onDestroyCbs",[]);x(this,"config");x(this,"apiList");this.options={...e,baseUrl:e.baseUrl??"/"},this.options.baseUrl=this.options.baseUrl.split("/").map(a=>encodeURIComponent(a)).join("/"),this.middlewares.push(...this.defaultMiddlewares),this.middlewares.push(...e.middlewares||[]);const n=((e==null?void 0:e.apis)??[]).sort((a,o)=>{const i=o.path.substr(-1,1),f=i==="*"?0:i==="/"?.1:.2,l=a.path.substr(-1,1),u=l==="*"?0:l==="/"?.1:.2;return o.path.split("/").length+f-(a.path.split("/").length+u)}).map(a=>({...a,method:a.method??(e==null?void 0:e.defaultMethod)??"post"}));this.apiList=n,this.apis=n.filter(a=>!a.disabled),this.api404={path:"*",method:"all",action:(a,o)=>{throw o.res.status=404,Error("Not Found")}},this.fnMiddleware=Fr(this.middlewares),this.getId=J.useSoonIdGen({workerId:e.workId}),this.init(t)}async init(e){var t,n,a,o;try{if(this.options.config){const i=await this.options.config();this.config=i}await((n=(t=this.options)==null?void 0:t.onInit)==null?void 0:n.call(t,this)),w.app=this,w.appPending=!1,w.appCb.forEach(i=>i(this)),await((o=(a=this.options)==null?void 0:a.onReady)==null?void 0:o.call(a,this)),e==null||e(null,this)}catch(i){e==null||e(i,this)}}async fetchRaw(e,t,n){var c,d;const a=(n==null?void 0:n.url)??e,o=new URL(a,"http://localhost"),i=this.getId(),f={baseUrl:this.options.baseUrl??"",headers:(n==null?void 0:n.headers)??{},method:(n==null?void 0:n.method)??this.options.defaultMethod??"post",body:(n==null?void 0:n.body)??t,params:{},path:o.pathname,queryString:n!=null&&n.query?"?"+to.stringify(n.query):o.search,query:(n==null?void 0:n.query)??Object.fromEntries(o.searchParams),url:a,reqId:i,requestId:i,ip:(n==null?void 0:n.ip)??"",namespace:(n==null?void 0:n.namespace)??"default"};let l=this.api404;for(let y=0;y<this.apis.length;y++){const m=this.apis[y];if((m.namespace??"default")===f.namespace&&(m.method==="all"||m.method===((d=(c=f.method)==null?void 0:c.toLowerCase)==null?void 0:d.call(c)))){const P=St((this.options.baseUrl??"")+m.path,{loose:!1,trailing:!1})(f.path);if(P){f.params=P.params,l=m;break}}}const u={body:void 0,headers:{},status:200},s={app:this,currentAPI:l,req:f,request:f,reqId:i,requestId:i,res:u,response:u,platform:n==null?void 0:n.platform,config:this.config,meta:l.meta??{},service:{}},p=async()=>{var g,S;let y=f.body;if(l.bodySchema)if((g=l.bodySchema)!=null&&g.parse)try{y=l.bodySchema.parse(f.body)}catch(P){u.status=400;const h=(S=P==null?void 0:P.issues)==null?void 0:S[0];throw h&&(h.message=(h.path??[]).join(".")+" "+h.message),h?{...h,code:0}:new Error("参数错误")}else throw u.status=500,new Error("bodySchema must be ZodType");const m=await l.action(y,s);m!==void 0&&(u.body=m)};if(l.middlewares&&l.middlewares.length>0){const y=Fr(l.middlewares),m=async()=>await y(s,p);n!=null&&n.noPublicMiddleware?await m:await this.fnMiddleware(s,m)}else n!=null&&n.noPublicMiddleware?await p():await this.fnMiddleware(s,p);return s.res}async fetch(e,t,n){return(await this.fetchRaw(e,t,n)).body}async action(e,t,n){const a={...n??{},noPublicMiddleware:!0},o=(n==null?void 0:n.url)??`${this.baseUrl}${e}`;return await this.fetch(o,t,a)}mount(e,t){this.extensions.set(e,t)}get(e){return this.extensions.get(e)}onUnloadService(e){this.onDestroyCbs.push(e)}async unloadService(){return Promise.all(this.onDestroyCbs.map(e=>e==null?void 0:e()))}get baseUrl(){return this.options.baseUrl??""}}const yt=Symbol("soon-api");function ao(r){const e={...r};return e._soon_symbol=yt,e}const dt=Symbol("soon-service");function oo(r){async function e(){var o;const t=r.service;let n=w.services.get(t);if(n)return n;if(w.servicePending.get(t)){let i=w.serviceCb.get(t);return i||(i=[],w.serviceCb.set(t,i)),new Promise(f=>{i.push(l=>f(l))})}return w.servicePending.set(t,!0),await new Promise(i=>{w.app?i(1):w.appCb.push(()=>i(1))}),n=await t(w.app),w.services.set(t,n),(o=w.serviceCb.get(t))==null||o.forEach(i=>i(n)),w.serviceCb.delete(t),w.servicePending.delete(t),n}return e._soon_symbol=dt,e.serviceName=(r==null?void 0:r.serviceName)??"",e.autoInject=(r==null?void 0:r.autoInject)??!1,e.enableClient=(r==null?void 0:r.enableClient)??!1,e}function io(r){return r}function lo(r){return async function(){return await no(r)}}async function fo(r){return await new Promise((e,t)=>{new pt(r,(n,a)=>{if(n){t(n);return}e(a)})})}class uo extends Error{constructor(t,n){super(t);x(this,"code");this.code=n}}class co extends Error{constructor(t,n){super(t);x(this,"status");this.status=n}}function so({pingTime:r=0,action:e}){let t=()=>null;const n=new ir(a=>{let o;r>0&&(o=setInterval(()=>{f.closed?clearInterval(o):a.next({event:"ping",message:`: ping
1
+ "use strict";var Kt=Object.defineProperty;var Vt=(r,e,t)=>e in r?Kt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var P=(r,e,t)=>Vt(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Qt=require("stream"),Y=require("./deps/soon-id-t25L9qRGGZ-j2kn3bq83.js"),Jt=require("util");var j={};Object.defineProperty(j,"__esModule",{value:!0});j.TokenData=void 0;j.parse=Ar;j.compile=tn;var Xt=j.match=on;j.pathToRegexp=pt;const ut="/",Er=r=>r,Yt=new RegExp("^\\p{XID_Continue}$","u"),ue="https://git.new/pathToRegexpError",Zt={"!":"!","@":"@",";":";",",":",","*":"*","+":"+","?":"?","{":"{","}":"}"};function en(r){const e=[...r],t=[];let n=0;for(;n<e.length;){const a=e[n],i=Zt[a];if(i){t.push({type:i,index:n++,value:a});continue}if(a==="\\"){t.push({type:"ESCAPED",index:n++,value:e[n++]});continue}if(a===":"){let o="";for(;Yt.test(e[++n]);)o+=e[n];if(!o)throw new TypeError(`Missing parameter name at ${n}`);t.push({type:"NAME",index:n,value:o});continue}if(a==="("){const o=n++;let u=1,l="";if(e[n]==="?")throw new TypeError(`Pattern cannot start with "?" at ${n}`);for(;n<e.length;){if(e[n]==="\\"){l+=e[n++]+e[n++];continue}if(e[n]===")"){if(u--,u===0){n++;break}}else if(e[n]==="("&&(u++,e[n+1]!=="?"))throw new TypeError(`Capturing groups are not allowed at ${n}`);l+=e[n++]}if(u)throw new TypeError(`Unbalanced pattern at ${o}`);if(!l)throw new TypeError(`Missing pattern at ${o}`);t.push({type:"PATTERN",index:n,value:l});continue}t.push({type:"CHAR",index:n,value:e[n++]})}return t.push({type:"END",index:n,value:""}),new rn(t)}class rn{constructor(e){this.tokens=e,this.index=0}peek(){return this.tokens[this.index]}tryConsume(e){const t=this.peek();if(t.type===e)return this.index++,t.value}consume(e){const t=this.tryConsume(e);if(t!==void 0)return t;const{type:n,index:a}=this.peek();throw new TypeError(`Unexpected ${n} at ${a}, expected ${e}: ${ue}`)}text(){let e="",t;for(;t=this.tryConsume("CHAR")||this.tryConsume("ESCAPED");)e+=t;return e}modifier(){return this.tryConsume("?")||this.tryConsume("*")||this.tryConsume("+")}}class De{constructor(e,t){this.tokens=e,this.delimiter=t}}j.TokenData=De;function Ar(r,e={}){const{encodePath:t=Er,delimiter:n=t(ut)}=e,a=[],i=en(r);let o=0;do{const u=i.text();u&&a.push(t(u));const l=i.tryConsume("NAME"),c=i.tryConsume("PATTERN");if(l||c){a.push({name:l||String(o++),pattern:c});const f=i.peek();if(f.type==="*")throw new TypeError(`Unexpected * at ${f.index}, you probably want \`/*\` or \`{/:foo}*\`: ${ue}`);continue}if(i.tryConsume("*")){a.push({name:String(o++),pattern:`(?:(?!${Z(n)}).)*`,modifier:"*",separator:n});continue}if(i.tryConsume("{")){const f=i.text(),d=i.tryConsume("NAME"),y=i.tryConsume("PATTERN"),h=i.text(),g=i.tryConsume(";")&&i.text();i.consume("}");const b=i.modifier();a.push({name:d||(y?String(o++):""),prefix:t(f),suffix:t(h),pattern:y,modifier:b,separator:g});continue}i.consume("END");break}while(!0);return new De(a,n)}function tn(r,e={}){const t=r instanceof De?r:Ar(r,e);return an(t,e)}function nn(r,e){if(typeof r=="string")return()=>r;const t=e||Er,n=r.modifier==="+"||r.modifier==="*",a=r.modifier==="?"||r.modifier==="*",{prefix:i="",suffix:o="",separator:u=o+i}=r;if(e&&n){const c=(p,f)=>{if(typeof p!="string")throw new TypeError(`Expected "${r.name}/${f}" to be a string`);return t(p)},s=p=>{if(!Array.isArray(p))throw new TypeError(`Expected "${r.name}" to be an array`);return p.length===0?"":i+p.map(c).join(u)+o};return a?p=>{const f=p[r.name];return f==null?"":f.length?s(f):""}:p=>{const f=p[r.name];return s(f)}}const l=c=>{if(typeof c!="string")throw new TypeError(`Expected "${r.name}" to be a string`);return i+t(c)+o};return a?c=>{const s=c[r.name];return s==null?"":l(s)}:c=>{const s=c[r.name];return l(s)}}function an(r,e){const{encode:t=encodeURIComponent,loose:n=!0,validate:a=!0,strict:i=!1}=e,o=ct(e),u=$r(n,r.delimiter),l=st(r,u,[],o,i),c=r.tokens.map((s,p)=>{const f=nn(s,t);if(!a||typeof s=="string")return f;const d=new RegExp(`^${l[p]}$`,o);return y=>{const h=f(y);if(!d.test(h))throw new TypeError(`Invalid value for "${s.name}": ${JSON.stringify(h)}`);return h}});return function(p={}){let f="";for(const d of c)f+=d(p);return f}}function on(r,e={}){const{decode:t=decodeURIComponent,loose:n=!0,delimiter:a=ut}=e,i=pt(r,e),o=$r(n,a),u=i.keys.map(l=>{if(t&&(l.modifier==="+"||l.modifier==="*")){const{prefix:c="",suffix:s="",separator:p=s+c}=l,f=new RegExp(o(p),"g");return d=>d.split(f).map(t)}return t||Er});return function(c){const s=i.exec(c);if(!s)return!1;const{0:p,index:f}=s,d=Object.create(null);for(let y=1;y<s.length;y++){if(s[y]===void 0)continue;const h=i.keys[y-1],g=u[y-1];d[h.name]=g(s[y])}return{path:p,index:f,params:d}}}function Z(r){return r.replace(/[.+*?^${}()[\]|/\\]/g,"\\$&")}function ln(r,e){const t=Z(r);return e?`(?:${t})+(?!${t})`:t}function $r(r,e){if(!r)return Z;const t=new RegExp(`(?:(?!${Z(e)}).)+|(.)`,"g");return n=>n.replace(t,ln)}function ct(r){return r.sensitive?"":"i"}function Dr(r,e,t,n){const a=r instanceof De?r:Ar(r,n),{trailing:i=!0,loose:o=!0,start:u=!0,end:l=!0,strict:c=!1}=n,s=$r(o,a.delimiter),p=st(a,s,e,t,c);let f=u?"^":"";return f+=p.join(""),i&&(f+=`(?:${s(a.delimiter)}$)?`),f+=l?"$":`(?=${Z(a.delimiter)}|$)`,f}function st(r,e,t,n,a){const i=`(?:(?!${Z(r.delimiter)}).)+?`;let o="",u=!0;return r.tokens.map(l=>{if(typeof l=="string")return o=l,e(l);const{prefix:c="",suffix:s="",separator:p=s+c,modifier:f=""}=l,d=e(c),y=e(s);if(l.name){const h=l.pattern?`(?:${l.pattern})`:i,g=fn(h,l.name,n);if(u||(u=He(g,c||o)),!u)throw new TypeError(`Ambiguous pattern for "${l.name}": ${ue}`);if(u=!a||He(g,s),o="",t.push(l),f==="+"||f==="*"){const b=f==="*"?"?":"",A=e(p);if(!A)throw new TypeError(`Missing separator for "${l.name}": ${ue}`);if(u||(u=!a||He(g,p)),!u)throw new TypeError(`Ambiguous pattern for "${l.name}" separator: ${ue}`);return u=!a,`(?:${d}(${h}(?:${A}${h})*)${y})${b}`}return`(?:${d}(${h})${y})${f}`}return`(?:${d}${y})${f}`})}function fn(r,e,t){try{return new RegExp(`^${r}$`,t)}catch(n){throw new TypeError(`Invalid pattern for "${e}": ${n.message}`)}}function He(r,e){return e?!r.test(e):!1}function pt(r,e={}){const t=[],n=ct(e);if(Array.isArray(r)){const i=r.map(o=>Dr(o,t,n,e));return Object.assign(new RegExp(i.join("|")),{keys:t})}const a=Dr(r,t,n,e);return Object.assign(new RegExp(a),{keys:t})}var Ne={};Object.defineProperty(Ne,"__esModule",{value:!0});Ne.Observable=void 0;const yt=r=>!!Symbol[r],Pr=r=>yt(r)?Symbol[r]:"@@"+r,un=Pr("iterator"),dr=Pr("observable"),dt=Pr("species");function Re(r,e){let t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function oe(r){let e=r.constructor;return e!==void 0&&(e=e[dt],e===null&&(e=void 0)),e!==void 0?e:Le}function cn(r){return r instanceof Le}function ee(r){ee.log?ee.log(r):setTimeout(()=>{throw r})}function Ae(r){Promise.resolve().then(()=>{try{r()}catch(e){ee(e)}})}function ht(r){let e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{let t=Re(e,"unsubscribe");t&&t.call(e)}}catch(t){ee(t)}}function hr(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function sn(r){let e=r._queue;if(e){r._queue=void 0,r._state="ready";for(let t=0;t<e.length&&(mt(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function mt(r,e,t){r._state="running";let n=r._observer;try{let a=Re(n,e);switch(e){case"next":a&&a.call(n,t);break;case"error":if(hr(r),a)a.call(n,t);else throw t;break;case"complete":hr(r),a&&a.call(n);break}}catch(a){ee(a)}r._state==="closed"?ht(r):r._state==="running"&&(r._state="ready")}function ze(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],Ae(()=>sn(r));return}mt(r,e,t)}}class pn{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,a={get closed(){return n._state==="closed"},next(i){ze(n,"next",i)},error(i){ze(n,"error",i)},complete(){ze(n,"complete")}};try{this._cleanup=t.call(void 0,a)}catch(i){a.error(i)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(hr(this),ht(this))}}let Le=class $e{constructor(e){if(!(this instanceof $e))throw new TypeError("Observable cannot be called as a function");if(typeof e!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return(typeof e!="object"||e===null)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new pn(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if(typeof e!="function"){n(new TypeError(e+" is not a function"));return}function a(){i.unsubscribe(),t()}let i=this.subscribe({next(o){try{e(o,a)}catch(u){n(u),i.unsubscribe()}},error:n,complete:t})})}map(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=oe(this);return new t(n=>this.subscribe({next(a){try{a=e(a)}catch(i){return n.error(i)}n.next(a)},error(a){n.error(a)},complete(){n.complete()}}))}filter(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=oe(this);return new t(n=>this.subscribe({next(a){try{if(!e(a))return}catch(i){return n.error(i)}n.next(a)},error(a){n.error(a)},complete(){n.complete()}}))}reduce(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=oe(this),n=arguments.length>1,a=!1,o=arguments[1];return new t(u=>this.subscribe({next(l){let c=!a;if(a=!0,!c||n)try{o=e(o,l)}catch(s){return u.error(s)}else o=l},error(l){u.error(l)},complete(){if(!a&&!n)return u.error(new TypeError("Cannot reduce an empty sequence"));u.next(o),u.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=oe(this);return new t(n=>{let a,i=0;function o(u){a=u.subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){i===e.length?(a=void 0,n.complete()):o(t.from(e[i++]))}})}return o(this),()=>{a&&(a.unsubscribe(),a=void 0)}})}flatMap(e){if(typeof e!="function")throw new TypeError(e+" is not a function");let t=oe(this);return new t(n=>{let a=[],i=this.subscribe({next(u){if(e)try{u=e(u)}catch(c){return n.error(c)}let l=t.from(u).subscribe({next(c){n.next(c)},error(c){n.error(c)},complete(){let c=a.indexOf(l);c>=0&&a.splice(c,1),o()}});a.push(l)},error(u){n.error(u)},complete(){o()}});function o(){i.closed&&a.length===0&&n.complete()}return()=>{a.forEach(u=>u.unsubscribe()),i.unsubscribe()}})}[dr](){return this}static from(e){let t=typeof this=="function"?this:$e;if(e==null)throw new TypeError(e+" is not an object");let n=Re(e,dr);if(n){let a=n.call(e);if(Object(a)!==a)throw new TypeError(a+" is not an object");return cn(a)&&a.constructor===t?a:new t(i=>a.subscribe(i))}if(yt("iterator")&&(n=Re(e,un),n))return new t(a=>{Ae(()=>{if(!a.closed){for(let i of n.call(e))if(a.next(i),a.closed)return;a.complete()}})});if(Array.isArray(e))return new t(a=>{Ae(()=>{if(!a.closed){for(let i=0;i<e.length;++i)if(a.next(e[i]),a.closed)return;a.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){let t=typeof this=="function"?this:$e;return new t(n=>{Ae(()=>{if(!n.closed){for(let a=0;a<e.length;++a)if(n.next(e[a]),n.closed)return;n.complete()}})})}static get[dt](){return this}};Ne.Observable=Le;Object.defineProperty(Le,Symbol("extensions"),{value:{symbol:dr,hostReportError:ee},configurable:!0});var yn=Ne.Observable;const xr=Y.getDefaultExportFromCjs(yn);var ne=TypeError,dn=Jt.inspect,Or=typeof Map=="function"&&Map.prototype,ke=Object.getOwnPropertyDescriptor&&Or?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,_e=Or&&ke&&typeof ke.get=="function"?ke.get:null,Nr=Or&&Map.prototype.forEach,Ir=typeof Set=="function"&&Set.prototype,Ke=Object.getOwnPropertyDescriptor&&Ir?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,Ce=Ir&&Ke&&typeof Ke.get=="function"?Ke.get:null,Lr=Ir&&Set.prototype.forEach,hn=typeof WeakMap=="function"&&WeakMap.prototype,ce=hn?WeakMap.prototype.has:null,mn=typeof WeakSet=="function"&&WeakSet.prototype,se=mn?WeakSet.prototype.has:null,vn=typeof WeakRef=="function"&&WeakRef.prototype,Br=vn?WeakRef.prototype.deref:null,gn=Boolean.prototype.valueOf,wn=Object.prototype.toString,Sn=Function.prototype.toString,bn=String.prototype.match,Rr=String.prototype.slice,L=String.prototype.replace,En=String.prototype.toUpperCase,Ur=String.prototype.toLowerCase,vt=RegExp.prototype.test,qr=Array.prototype.concat,R=Array.prototype.join,An=Array.prototype.slice,Wr=Math.floor,mr=typeof BigInt=="function"?BigInt.prototype.valueOf:null,Ve=Object.getOwnPropertySymbols,vr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Symbol.prototype.toString:null,re=typeof Symbol=="function"&&typeof Symbol.iterator=="object",pe=typeof Symbol=="function"&&Symbol.toStringTag&&(typeof Symbol.toStringTag===re||!0)?Symbol.toStringTag:null,gt=Object.prototype.propertyIsEnumerable,Fr=(typeof Reflect=="function"?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(r){return r.__proto__}:null);function Gr(r,e){if(r===1/0||r===-1/0||r!==r||r&&r>-1e3&&r<1e3||vt.call(/e/,e))return e;var t=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof r=="number"){var n=r<0?-Wr(-r):Wr(r);if(n!==r){var a=String(n),i=Rr.call(e,a.length+1);return L.call(a,t,"$&_")+"."+L.call(L.call(i,/([0-9]{3})/g,"$&_"),/_$/,"")}}return L.call(e,t,"$&_")}var gr=dn,jr=gr.custom,Hr=bt(jr)?jr:null,wt={__proto__:null,double:'"',single:"'"},$n={__proto__:null,double:/(["\\])/g,single:/(['\\])/g},Be=function r(e,t,n,a){var i=t||{};if(T(i,"quoteStyle")&&!T(wt,i.quoteStyle))throw new TypeError('option "quoteStyle" must be "single" or "double"');if(T(i,"maxStringLength")&&(typeof i.maxStringLength=="number"?i.maxStringLength<0&&i.maxStringLength!==1/0:i.maxStringLength!==null))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var o=T(i,"customInspect")?i.customInspect:!0;if(typeof o!="boolean"&&o!=="symbol")throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(T(i,"indent")&&i.indent!==null&&i.indent!==" "&&!(parseInt(i.indent,10)===i.indent&&i.indent>0))throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(T(i,"numericSeparator")&&typeof i.numericSeparator!="boolean")throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');var u=i.numericSeparator;if(typeof e>"u")return"undefined";if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="string")return At(e,i);if(typeof e=="number"){if(e===0)return 1/0/e>0?"0":"-0";var l=String(e);return u?Gr(e,l):l}if(typeof e=="bigint"){var c=String(e)+"n";return u?Gr(e,c):c}var s=typeof i.depth>"u"?5:i.depth;if(typeof n>"u"&&(n=0),n>=s&&s>0&&typeof e=="object")return wr(e)?"[Array]":"[Object]";var p=Gn(i,n);if(typeof a>"u")a=[];else if(Et(a,e)>=0)return"[Circular]";function f(x,N,C){if(N&&(a=An.call(a),a.push(N)),C){var ie={depth:i.depth};return T(i,"quoteStyle")&&(ie.quoteStyle=i.quoteStyle),r(x,ie,n+1,a)}return r(x,i,n+1,a)}if(typeof e=="function"&&!zr(e)){var d=Mn(e),y=be(e,f);return"[Function"+(d?": "+d:" (anonymous)")+"]"+(y.length>0?" { "+R.call(y,", ")+" }":"")}if(bt(e)){var h=re?L.call(String(e),/^(Symbol\(.*\))_[^)]*$/,"$1"):vr.call(e);return typeof e=="object"&&!re?le(h):h}if(qn(e)){for(var g="<"+Ur.call(String(e.nodeName)),b=e.attributes||[],A=0;A<b.length;A++)g+=" "+b[A].name+"="+St(Pn(b[A].value),"double",i);return g+=">",e.childNodes&&e.childNodes.length&&(g+="..."),g+="</"+Ur.call(String(e.nodeName))+">",g}if(wr(e)){if(e.length===0)return"[]";var m=be(e,f);return p&&!Fn(m)?"["+Sr(m,p)+"]":"[ "+R.call(m,", ")+" ]"}if(On(e)){var M=be(e,f);return!("cause"in Error.prototype)&&"cause"in e&&!gt.call(e,"cause")?"{ ["+String(e)+"] "+R.call(qr.call("[cause]: "+f(e.cause),M),", ")+" }":M.length===0?"["+String(e)+"]":"{ ["+String(e)+"] "+R.call(M,", ")+" }"}if(typeof e=="object"&&o){if(Hr&&typeof e[Hr]=="function"&&gr)return gr(e,{depth:s-n});if(o!=="symbol"&&typeof e.inspect=="function")return e.inspect()}if(Dn(e)){var U=[];return Nr&&Nr.call(e,function(x,N){U.push(f(N,e,!0)+" => "+f(x,e))}),kr("Map",_e.call(e),U,p)}if(Bn(e)){var ae=[];return Lr&&Lr.call(e,function(x){ae.push(f(x,e))}),kr("Set",Ce.call(e),ae,p)}if(Nn(e))return Qe("WeakMap");if(Un(e))return Qe("WeakSet");if(Ln(e))return Qe("WeakRef");if(Rn(e))return le(f(Number(e)));if(Cn(e))return le(f(mr.call(e)));if(_n(e))return le(gn.call(e));if(In(e))return le(f(String(e)));if(typeof window<"u"&&e===window)return"{ [object Window] }";if(typeof globalThis<"u"&&e===globalThis||typeof Y.commonjsGlobal<"u"&&e===Y.commonjsGlobal)return"{ [object globalThis] }";if(!xn(e)&&!zr(e)){var z=be(e,f),we=Fr?Fr(e)===Object.prototype:e instanceof Object||e.constructor===Object,q=e instanceof Object?"":"null prototype",D=!we&&pe&&Object(e)===e&&pe in e?Rr.call(B(e),8,-1):q?"Object":"",Se=we||typeof e.constructor!="function"?"":e.constructor.name?e.constructor.name+" ":"",k=Se+(D||q?"["+R.call(qr.call([],D||[],q||[]),": ")+"] ":"");return z.length===0?k+"{}":p?k+"{"+Sr(z,p)+"}":k+"{ "+R.call(z,", ")+" }"}return String(e)};function St(r,e,t){var n=t.quoteStyle||e,a=wt[n];return a+r+a}function Pn(r){return L.call(String(r),/"/g,"&quot;")}function H(r){return!pe||!(typeof r=="object"&&(pe in r||typeof r[pe]<"u"))}function wr(r){return B(r)==="[object Array]"&&H(r)}function xn(r){return B(r)==="[object Date]"&&H(r)}function zr(r){return B(r)==="[object RegExp]"&&H(r)}function On(r){return B(r)==="[object Error]"&&H(r)}function In(r){return B(r)==="[object String]"&&H(r)}function Rn(r){return B(r)==="[object Number]"&&H(r)}function _n(r){return B(r)==="[object Boolean]"&&H(r)}function bt(r){if(re)return r&&typeof r=="object"&&r instanceof Symbol;if(typeof r=="symbol")return!0;if(!r||typeof r!="object"||!vr)return!1;try{return vr.call(r),!0}catch{}return!1}function Cn(r){if(!r||typeof r!="object"||!mr)return!1;try{return mr.call(r),!0}catch{}return!1}var Tn=Object.prototype.hasOwnProperty||function(r){return r in this};function T(r,e){return Tn.call(r,e)}function B(r){return wn.call(r)}function Mn(r){if(r.name)return r.name;var e=bn.call(Sn.call(r),/^function\s*([\w$]+)/);return e?e[1]:null}function Et(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,n=r.length;t<n;t++)if(r[t]===e)return t;return-1}function Dn(r){if(!_e||!r||typeof r!="object")return!1;try{_e.call(r);try{Ce.call(r)}catch{return!0}return r instanceof Map}catch{}return!1}function Nn(r){if(!ce||!r||typeof r!="object")return!1;try{ce.call(r,ce);try{se.call(r,se)}catch{return!0}return r instanceof WeakMap}catch{}return!1}function Ln(r){if(!Br||!r||typeof r!="object")return!1;try{return Br.call(r),!0}catch{}return!1}function Bn(r){if(!Ce||!r||typeof r!="object")return!1;try{Ce.call(r);try{_e.call(r)}catch{return!0}return r instanceof Set}catch{}return!1}function Un(r){if(!se||!r||typeof r!="object")return!1;try{se.call(r,se);try{ce.call(r,ce)}catch{return!0}return r instanceof WeakSet}catch{}return!1}function qn(r){return!r||typeof r!="object"?!1:typeof HTMLElement<"u"&&r instanceof HTMLElement?!0:typeof r.nodeName=="string"&&typeof r.getAttribute=="function"}function At(r,e){if(r.length>e.maxStringLength){var t=r.length-e.maxStringLength,n="... "+t+" more character"+(t>1?"s":"");return At(Rr.call(r,0,e.maxStringLength),e)+n}var a=$n[e.quoteStyle||"single"];a.lastIndex=0;var i=L.call(L.call(r,a,"\\$1"),/[\x00-\x1f]/g,Wn);return St(i,"single",e)}function Wn(r){var e=r.charCodeAt(0),t={8:"b",9:"t",10:"n",12:"f",13:"r"}[e];return t?"\\"+t:"\\x"+(e<16?"0":"")+En.call(e.toString(16))}function le(r){return"Object("+r+")"}function Qe(r){return r+" { ? }"}function kr(r,e,t,n){var a=n?Sr(t,n):R.call(t,", ");return r+" ("+e+") {"+a+"}"}function Fn(r){for(var e=0;e<r.length;e++)if(Et(r[e],`
2
+ `)>=0)return!1;return!0}function Gn(r,e){var t;if(r.indent===" ")t=" ";else if(typeof r.indent=="number"&&r.indent>0)t=R.call(Array(r.indent+1)," ");else return null;return{base:t,prev:R.call(Array(e+1),t)}}function Sr(r,e){if(r.length===0)return"";var t=`
3
+ `+e.prev+e.base;return t+R.call(r,","+t)+`
4
+ `+e.prev}function be(r,e){var t=wr(r),n=[];if(t){n.length=r.length;for(var a=0;a<r.length;a++)n[a]=T(r,a)?e(r[a],r):""}var i=typeof Ve=="function"?Ve(r):[],o;if(re){o={};for(var u=0;u<i.length;u++)o["$"+i[u]]=i[u]}for(var l in r)T(r,l)&&(t&&String(Number(l))===l&&l<r.length||re&&o["$"+l]instanceof Symbol||(vt.call(/[^\w$]/,l)?n.push(e(l,r)+": "+e(r[l],r)):n.push(l+": "+e(r[l],r))));if(typeof Ve=="function")for(var c=0;c<i.length;c++)gt.call(r,i[c])&&n.push("["+e(i[c])+"]: "+e(r[i[c]],r));return n}var jn=Be,Hn=ne,Ue=function(r,e,t){for(var n=r,a;(a=n.next)!=null;n=a)if(a.key===e)return n.next=a.next,t||(a.next=r.next,r.next=a),a},zn=function(r,e){if(r){var t=Ue(r,e);return t&&t.value}},kn=function(r,e,t){var n=Ue(r,e);n?n.value=t:r.next={key:e,next:r.next,value:t}},Kn=function(r,e){return r?!!Ue(r,e):!1},Vn=function(r,e){if(r)return Ue(r,e,!0)},Qn=function(){var e,t={assert:function(n){if(!t.has(n))throw new Hn("Side channel does not contain "+jn(n))},delete:function(n){var a=e&&e.next,i=Vn(e,n);return i&&a&&a===i&&(e=void 0),!!i},get:function(n){return zn(e,n)},has:function(n){return Kn(e,n)},set:function(n,a){e||(e={next:void 0}),kn(e,n,a)}};return t},$t=Object,Jn=Error,Xn=EvalError,Yn=RangeError,Zn=ReferenceError,ea=SyntaxError,ra=URIError,ta=Math.abs,na=Math.floor,aa=Math.max,ia=Math.min,oa=Math.pow,la=Math.round,fa=Number.isNaN||function(e){return e!==e},ua=fa,ca=function(e){return ua(e)||e===0?e:e<0?-1:1},sa=Object.getOwnPropertyDescriptor,Pe=sa;if(Pe)try{Pe([],"length")}catch{Pe=null}var Pt=Pe,xe=Object.defineProperty||!1;if(xe)try{xe({},"a",{value:1})}catch{xe=!1}var pa=xe,Je,Kr;function ya(){return Kr||(Kr=1,Je=function(){if(typeof Symbol!="function"||typeof Object.getOwnPropertySymbols!="function")return!1;if(typeof Symbol.iterator=="symbol")return!0;var e={},t=Symbol("test"),n=Object(t);if(typeof t=="string"||Object.prototype.toString.call(t)!=="[object Symbol]"||Object.prototype.toString.call(n)!=="[object Symbol]")return!1;var a=42;e[t]=a;for(var i in e)return!1;if(typeof Object.keys=="function"&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames=="function"&&Object.getOwnPropertyNames(e).length!==0)return!1;var o=Object.getOwnPropertySymbols(e);if(o.length!==1||o[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor=="function"){var u=Object.getOwnPropertyDescriptor(e,t);if(u.value!==a||u.enumerable!==!0)return!1}return!0}),Je}var Xe,Vr;function da(){if(Vr)return Xe;Vr=1;var r=typeof Symbol<"u"&&Symbol,e=ya();return Xe=function(){return typeof r!="function"||typeof Symbol!="function"||typeof r("foo")!="symbol"||typeof Symbol("bar")!="symbol"?!1:e()},Xe}var Ye,Qr;function xt(){return Qr||(Qr=1,Ye=typeof Reflect<"u"&&Reflect.getPrototypeOf||null),Ye}var Ze,Jr;function Ot(){if(Jr)return Ze;Jr=1;var r=$t;return Ze=r.getPrototypeOf||null,Ze}var er,Xr;function ha(){if(Xr)return er;Xr=1;var r="Function.prototype.bind called on incompatible ",e=Object.prototype.toString,t=Math.max,n="[object Function]",a=function(l,c){for(var s=[],p=0;p<l.length;p+=1)s[p]=l[p];for(var f=0;f<c.length;f+=1)s[f+l.length]=c[f];return s},i=function(l,c){for(var s=[],p=c,f=0;p<l.length;p+=1,f+=1)s[f]=l[p];return s},o=function(u,l){for(var c="",s=0;s<u.length;s+=1)c+=u[s],s+1<u.length&&(c+=l);return c};return er=function(l){var c=this;if(typeof c!="function"||e.apply(c)!==n)throw new TypeError(r+c);for(var s=i(arguments,1),p,f=function(){if(this instanceof p){var b=c.apply(this,a(s,arguments));return Object(b)===b?b:this}return c.apply(l,a(s,arguments))},d=t(0,c.length-s.length),y=[],h=0;h<d;h++)y[h]="$"+h;if(p=Function("binder","return function ("+o(y,",")+"){ return binder.apply(this,arguments); }")(f),c.prototype){var g=function(){};g.prototype=c.prototype,p.prototype=new g,g.prototype=null}return p},er}var rr,Yr;function qe(){if(Yr)return rr;Yr=1;var r=ha();return rr=Function.prototype.bind||r,rr}var tr,Zr;function _r(){return Zr||(Zr=1,tr=Function.prototype.call),tr}var nr,et;function It(){return et||(et=1,nr=Function.prototype.apply),nr}var ma=typeof Reflect<"u"&&Reflect&&Reflect.apply,va=qe(),ga=It(),wa=_r(),Sa=ma,ba=Sa||va.call(wa,ga),Ea=qe(),Aa=ne,$a=_r(),Pa=ba,Rt=function(e){if(e.length<1||typeof e[0]!="function")throw new Aa("a function is required");return Pa(Ea,$a,e)},ar,rt;function xa(){if(rt)return ar;rt=1;var r=Rt,e=Pt,t;try{t=[].__proto__===Array.prototype}catch(o){if(!o||typeof o!="object"||!("code"in o)||o.code!=="ERR_PROTO_ACCESS")throw o}var n=!!t&&e&&e(Object.prototype,"__proto__"),a=Object,i=a.getPrototypeOf;return ar=n&&typeof n.get=="function"?r([n.get]):typeof i=="function"?function(u){return i(u==null?u:a(u))}:!1,ar}var ir,tt;function Oa(){if(tt)return ir;tt=1;var r=xt(),e=Ot(),t=xa();return ir=r?function(a){return r(a)}:e?function(a){if(!a||typeof a!="object"&&typeof a!="function")throw new TypeError("getProto: not an object");return e(a)}:t?function(a){return t(a)}:null,ir}var or,nt;function Ia(){if(nt)return or;nt=1;var r=Function.prototype.call,e=Object.prototype.hasOwnProperty,t=qe();return or=t.call(r,e),or}var v,Ra=$t,_a=Jn,Ca=Xn,Ta=Yn,Ma=Zn,te=ea,X=ne,Da=ra,Na=ta,La=na,Ba=aa,Ua=ia,qa=oa,Wa=la,Fa=ca,_t=Function,lr=function(r){try{return _t('"use strict"; return ('+r+").constructor;")()}catch{}},he=Pt,Ga=pa,fr=function(){throw new X},ja=he?function(){try{return arguments.callee,fr}catch{try{return he(arguments,"callee").get}catch{return fr}}}():fr,K=da()(),$=Oa(),Ha=Ot(),za=xt(),Ct=It(),me=_r(),Q={},ka=typeof Uint8Array>"u"||!$?v:$(Uint8Array),G={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?v:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?v:ArrayBuffer,"%ArrayIteratorPrototype%":K&&$?$([][Symbol.iterator]()):v,"%AsyncFromSyncIteratorPrototype%":v,"%AsyncFunction%":Q,"%AsyncGenerator%":Q,"%AsyncGeneratorFunction%":Q,"%AsyncIteratorPrototype%":Q,"%Atomics%":typeof Atomics>"u"?v:Atomics,"%BigInt%":typeof BigInt>"u"?v:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?v:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?v:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?v:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":_a,"%eval%":eval,"%EvalError%":Ca,"%Float16Array%":typeof Float16Array>"u"?v:Float16Array,"%Float32Array%":typeof Float32Array>"u"?v:Float32Array,"%Float64Array%":typeof Float64Array>"u"?v:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?v:FinalizationRegistry,"%Function%":_t,"%GeneratorFunction%":Q,"%Int8Array%":typeof Int8Array>"u"?v:Int8Array,"%Int16Array%":typeof Int16Array>"u"?v:Int16Array,"%Int32Array%":typeof Int32Array>"u"?v:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":K&&$?$($([][Symbol.iterator]())):v,"%JSON%":typeof JSON=="object"?JSON:v,"%Map%":typeof Map>"u"?v:Map,"%MapIteratorPrototype%":typeof Map>"u"||!K||!$?v:$(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Ra,"%Object.getOwnPropertyDescriptor%":he,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?v:Promise,"%Proxy%":typeof Proxy>"u"?v:Proxy,"%RangeError%":Ta,"%ReferenceError%":Ma,"%Reflect%":typeof Reflect>"u"?v:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?v:Set,"%SetIteratorPrototype%":typeof Set>"u"||!K||!$?v:$(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?v:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":K&&$?$(""[Symbol.iterator]()):v,"%Symbol%":K?Symbol:v,"%SyntaxError%":te,"%ThrowTypeError%":ja,"%TypedArray%":ka,"%TypeError%":X,"%Uint8Array%":typeof Uint8Array>"u"?v:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?v:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?v:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?v:Uint32Array,"%URIError%":Da,"%WeakMap%":typeof WeakMap>"u"?v:WeakMap,"%WeakRef%":typeof WeakRef>"u"?v:WeakRef,"%WeakSet%":typeof WeakSet>"u"?v:WeakSet,"%Function.prototype.call%":me,"%Function.prototype.apply%":Ct,"%Object.defineProperty%":Ga,"%Object.getPrototypeOf%":Ha,"%Math.abs%":Na,"%Math.floor%":La,"%Math.max%":Ba,"%Math.min%":Ua,"%Math.pow%":qa,"%Math.round%":Wa,"%Math.sign%":Fa,"%Reflect.getPrototypeOf%":za};if($)try{null.error}catch(r){var Ka=$($(r));G["%Error.prototype%"]=Ka}var Va=function r(e){var t;if(e==="%AsyncFunction%")t=lr("async function () {}");else if(e==="%GeneratorFunction%")t=lr("function* () {}");else if(e==="%AsyncGeneratorFunction%")t=lr("async function* () {}");else if(e==="%AsyncGenerator%"){var n=r("%AsyncGeneratorFunction%");n&&(t=n.prototype)}else if(e==="%AsyncIteratorPrototype%"){var a=r("%AsyncGenerator%");a&&$&&(t=$(a.prototype))}return G[e]=t,t},at={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},ve=qe(),Te=Ia(),Qa=ve.call(me,Array.prototype.concat),Ja=ve.call(Ct,Array.prototype.splice),it=ve.call(me,String.prototype.replace),Me=ve.call(me,String.prototype.slice),Xa=ve.call(me,RegExp.prototype.exec),Ya=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Za=/\\(\\)?/g,ei=function(e){var t=Me(e,0,1),n=Me(e,-1);if(t==="%"&&n!=="%")throw new te("invalid intrinsic syntax, expected closing `%`");if(n==="%"&&t!=="%")throw new te("invalid intrinsic syntax, expected opening `%`");var a=[];return it(e,Ya,function(i,o,u,l){a[a.length]=u?it(l,Za,"$1"):o||i}),a},ri=function(e,t){var n=e,a;if(Te(at,n)&&(a=at[n],n="%"+a[0]+"%"),Te(G,n)){var i=G[n];if(i===Q&&(i=Va(n)),typeof i>"u"&&!t)throw new X("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:a,name:n,value:i}}throw new te("intrinsic "+e+" does not exist!")},Cr=function(e,t){if(typeof e!="string"||e.length===0)throw new X("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof t!="boolean")throw new X('"allowMissing" argument must be a boolean');if(Xa(/^%?[^%]*%?$/,e)===null)throw new te("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ei(e),a=n.length>0?n[0]:"",i=ri("%"+a+"%",t),o=i.name,u=i.value,l=!1,c=i.alias;c&&(a=c[0],Ja(n,Qa([0,1],c)));for(var s=1,p=!0;s<n.length;s+=1){var f=n[s],d=Me(f,0,1),y=Me(f,-1);if((d==='"'||d==="'"||d==="`"||y==='"'||y==="'"||y==="`")&&d!==y)throw new te("property names with quotes must have matching quotes");if((f==="constructor"||!p)&&(l=!0),a+="."+f,o="%"+a+"%",Te(G,o))u=G[o];else if(u!=null){if(!(f in u)){if(!t)throw new X("base intrinsic for "+e+" exists, but the property is not available.");return}if(he&&s+1>=n.length){var h=he(u,f);p=!!h,p&&"get"in h&&!("originalValue"in h.get)?u=h.get:u=u[f]}else p=Te(u,f),u=u[f];p&&!l&&(G[o]=u)}}return u},Tt=Cr,Mt=Rt,ti=Mt([Tt("%String.prototype.indexOf%")]),Dt=function(e,t){var n=Tt(e,!!t);return typeof n=="function"&&ti(e,".prototype.")>-1?Mt([n]):n},ni=Cr,ge=Dt,ai=Be,ii=ne,ot=ni("%Map%",!0),oi=ge("Map.prototype.get",!0),li=ge("Map.prototype.set",!0),fi=ge("Map.prototype.has",!0),ui=ge("Map.prototype.delete",!0),ci=ge("Map.prototype.size",!0),Nt=!!ot&&function(){var e,t={assert:function(n){if(!t.has(n))throw new ii("Side channel does not contain "+ai(n))},delete:function(n){if(e){var a=ui(e,n);return ci(e)===0&&(e=void 0),a}return!1},get:function(n){if(e)return oi(e,n)},has:function(n){return e?fi(e,n):!1},set:function(n,a){e||(e=new ot),li(e,n,a)}};return t},si=Cr,We=Dt,pi=Be,Ee=Nt,yi=ne,V=si("%WeakMap%",!0),di=We("WeakMap.prototype.get",!0),hi=We("WeakMap.prototype.set",!0),mi=We("WeakMap.prototype.has",!0),vi=We("WeakMap.prototype.delete",!0),gi=V?function(){var e,t,n={assert:function(a){if(!n.has(a))throw new yi("Side channel does not contain "+pi(a))},delete:function(a){if(V&&a&&(typeof a=="object"||typeof a=="function")){if(e)return vi(e,a)}else if(Ee&&t)return t.delete(a);return!1},get:function(a){return V&&a&&(typeof a=="object"||typeof a=="function")&&e?di(e,a):t&&t.get(a)},has:function(a){return V&&a&&(typeof a=="object"||typeof a=="function")&&e?mi(e,a):!!t&&t.has(a)},set:function(a,i){V&&a&&(typeof a=="object"||typeof a=="function")?(e||(e=new V),hi(e,a,i)):Ee&&(t||(t=Ee()),t.set(a,i))}};return n}:Ee,wi=ne,Si=Be,bi=Qn,Ei=Nt,Ai=gi,$i=Ai||Ei||bi,Lt=function(){var e,t={assert:function(n){if(!t.has(n))throw new wi("Side channel does not contain "+Si(n))},delete:function(n){return!!e&&e.delete(n)},get:function(n){return e&&e.get(n)},has:function(n){return!!e&&e.has(n)},set:function(n,a){e||(e=$i()),e.set(n,a)}};return t},Pi=String.prototype.replace,xi=/%20/g,ur={RFC1738:"RFC1738",RFC3986:"RFC3986"},Tr={default:ur.RFC3986,formatters:{RFC1738:function(r){return Pi.call(r,xi,"+")},RFC3986:function(r){return String(r)}},RFC1738:ur.RFC1738,RFC3986:ur.RFC3986},Oi=Tr,Ii=Lt,cr=Object.prototype.hasOwnProperty,W=Array.isArray,Fe=Ii(),J=function(e,t){return Fe.set(e,t),e},F=function(e){return Fe.has(e)},fe=function(e){return Fe.get(e)},br=function(e,t){Fe.set(e,t)},O=function(){for(var r=[],e=0;e<256;++e)r[r.length]="%"+((e<16?"0":"")+e.toString(16)).toUpperCase();return r}(),Ri=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(W(n)){for(var a=[],i=0;i<n.length;++i)typeof n[i]<"u"&&(a[a.length]=n[i]);t.obj[t.prop]=a}}},ye=function(e,t){for(var n=t&&t.plainObjects?{__proto__:null}:{},a=0;a<e.length;++a)typeof e[a]<"u"&&(n[a]=e[a]);return n},_i=function r(e,t,n){if(!t)return e;if(typeof t!="object"&&typeof t!="function"){if(W(e)){var a=e.length;if(n&&typeof n.arrayLimit=="number"&&a>n.arrayLimit)return J(ye(e.concat(t),n),a);e[a]=t}else if(e&&typeof e=="object")if(F(e)){var i=fe(e)+1;e[i]=t,br(e,i)}else{if(n&&n.strictMerge)return[e,t];(n&&(n.plainObjects||n.allowPrototypes)||!cr.call(Object.prototype,t))&&(e[t]=!0)}else return[e,t];return e}if(!e||typeof e!="object"){if(F(t)){for(var o=Object.keys(t),u=n&&n.plainObjects?{__proto__:null,0:e}:{0:e},l=0;l<o.length;l++){var c=parseInt(o[l],10);u[c+1]=t[o[l]]}return J(u,fe(t)+1)}var s=[e].concat(t);return n&&typeof n.arrayLimit=="number"&&s.length>n.arrayLimit?J(ye(s,n),s.length-1):s}var p=e;return W(e)&&!W(t)&&(p=ye(e,n)),W(e)&&W(t)?(t.forEach(function(f,d){if(cr.call(e,d)){var y=e[d];y&&typeof y=="object"&&f&&typeof f=="object"?e[d]=r(y,f,n):e[e.length]=f}else e[d]=f}),e):Object.keys(t).reduce(function(f,d){var y=t[d];if(cr.call(f,d)?f[d]=r(f[d],y,n):f[d]=y,F(t)&&!F(f)&&J(f,fe(t)),F(f)){var h=parseInt(d,10);String(h)===d&&h>=0&&h>fe(f)&&br(f,h)}return f},p)},Ci=function(e,t){return Object.keys(t).reduce(function(n,a){return n[a]=t[a],n},e)},Ti=function(r,e,t){var n=r.replace(/\+/g," ");if(t==="iso-8859-1")return n.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(n)}catch{return n}},sr=1024,Mi=function(e,t,n,a,i){if(e.length===0)return e;var o=e;if(typeof e=="symbol"?o=Symbol.prototype.toString.call(e):typeof e!="string"&&(o=String(e)),n==="iso-8859-1")return escape(o).replace(/%u[0-9a-f]{4}/gi,function(d){return"%26%23"+parseInt(d.slice(2),16)+"%3B"});for(var u="",l=0;l<o.length;l+=sr){for(var c=o.length>=sr?o.slice(l,l+sr):o,s=[],p=0;p<c.length;++p){var f=c.charCodeAt(p);if(f===45||f===46||f===95||f===126||f>=48&&f<=57||f>=65&&f<=90||f>=97&&f<=122||i===Oi.RFC1738&&(f===40||f===41)){s[s.length]=c.charAt(p);continue}if(f<128){s[s.length]=O[f];continue}if(f<2048){s[s.length]=O[192|f>>6]+O[128|f&63];continue}if(f<55296||f>=57344){s[s.length]=O[224|f>>12]+O[128|f>>6&63]+O[128|f&63];continue}p+=1,f=65536+((f&1023)<<10|c.charCodeAt(p)&1023),s[s.length]=O[240|f>>18]+O[128|f>>12&63]+O[128|f>>6&63]+O[128|f&63]}u+=s.join("")}return u},Di=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],a=0;a<t.length;++a)for(var i=t[a],o=i.obj[i.prop],u=Object.keys(o),l=0;l<u.length;++l){var c=u[l],s=o[c];typeof s=="object"&&s!==null&&n.indexOf(s)===-1&&(t[t.length]={obj:o,prop:c},n[n.length]=s)}return Ri(t),e},Ni=function(e){return Object.prototype.toString.call(e)==="[object RegExp]"},Li=function(e){return!e||typeof e!="object"?!1:!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},Bi=function(e,t,n,a){if(F(e)){var i=fe(e)+1;return e[i]=t,br(e,i),e}var o=[].concat(e,t);return o.length>n?J(ye(o,{plainObjects:a}),o.length-1):o},Ui=function(e,t){if(W(e)){for(var n=[],a=0;a<e.length;a+=1)n[n.length]=t(e[a]);return n}return t(e)},Bt={arrayToObject:ye,assign:Ci,combine:Bi,compact:Di,decode:Ti,encode:Mi,isBuffer:Li,isOverflow:F,isRegExp:Ni,markOverflow:J,maybeMap:Ui,merge:_i},Ut=Lt,Oe=Bt,de=Tr,qi=Object.prototype.hasOwnProperty,qt={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},I=Array.isArray,Wi=Array.prototype.push,Wt=function(r,e){Wi.apply(r,I(e)?e:[e])},Fi=Date.prototype.toISOString,lt=de.default,E={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:Oe.encode,encodeValuesOnly:!1,filter:void 0,format:lt,formatter:de.formatters[lt],indices:!1,serializeDate:function(e){return Fi.call(e)},skipNulls:!1,strictNullHandling:!1},Gi=function(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e=="symbol"||typeof e=="bigint"},pr={},ji=function r(e,t,n,a,i,o,u,l,c,s,p,f,d,y,h,g,b,A){for(var m=e,M=A,U=0,ae=!1;(M=M.get(pr))!==void 0&&!ae;){var z=M.get(e);if(U+=1,typeof z<"u"){if(z===U)throw new RangeError("Cyclic object value");ae=!0}typeof M.get(pr)>"u"&&(U=0)}if(typeof s=="function"?m=s(t,m):m instanceof Date?m=d(m):n==="comma"&&I(m)&&(m=Oe.maybeMap(m,function(je){return je instanceof Date?d(je):je})),m===null){if(o)return c&&!g?c(t,E.encoder,b,"key",y):t;m=""}if(Gi(m)||Oe.isBuffer(m)){if(c){var we=g?t:c(t,E.encoder,b,"key",y);return[h(we)+"="+h(c(m,E.encoder,b,"value",y))]}return[h(t)+"="+h(String(m))]}var q=[];if(typeof m>"u")return q;var D;if(n==="comma"&&I(m))g&&c&&(m=Oe.maybeMap(m,c)),D=[{value:m.length>0?m.join(",")||null:void 0}];else if(I(s))D=s;else{var Se=Object.keys(m);D=p?Se.sort(p):Se}var k=l?String(t).replace(/\./g,"%2E"):String(t),x=a&&I(m)&&m.length===1?k+"[]":k;if(i&&I(m)&&m.length===0)return x+"[]";for(var N=0;N<D.length;++N){var C=D[N],ie=typeof C=="object"&&C&&typeof C.value<"u"?C.value:m[C];if(!(u&&ie===null)){var Ge=f&&l?String(C).replace(/\./g,"%2E"):String(C),kt=I(m)?typeof n=="function"?n(x,Ge):x:x+(f?"."+Ge:"["+Ge+"]");A.set(e,U);var Mr=Ut();Mr.set(pr,A),Wt(q,r(ie,kt,n,a,i,o,u,l,n==="comma"&&g&&I(m)?null:c,s,p,f,d,y,h,g,b,Mr))}}return q},Hi=function(e){if(!e)return E;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.encodeDotInKeys<"u"&&typeof e.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&typeof e.encoder<"u"&&typeof e.encoder!="function")throw new TypeError("Encoder has to be a function.");var t=e.charset||E.charset;if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=de.default;if(typeof e.format<"u"){if(!qi.call(de.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var a=de.formatters[n],i=E.filter;(typeof e.filter=="function"||I(e.filter))&&(i=e.filter);var o;if(e.arrayFormat in qt?o=e.arrayFormat:"indices"in e?o=e.indices?"indices":"repeat":o=E.arrayFormat,"commaRoundTrip"in e&&typeof e.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var u=typeof e.allowDots>"u"?e.encodeDotInKeys===!0?!0:E.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix=="boolean"?e.addQueryPrefix:E.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:E.allowEmptyArrays,arrayFormat:o,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:E.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:typeof e.delimiter>"u"?E.delimiter:e.delimiter,encode:typeof e.encode=="boolean"?e.encode:E.encode,encodeDotInKeys:typeof e.encodeDotInKeys=="boolean"?e.encodeDotInKeys:E.encodeDotInKeys,encoder:typeof e.encoder=="function"?e.encoder:E.encoder,encodeValuesOnly:typeof e.encodeValuesOnly=="boolean"?e.encodeValuesOnly:E.encodeValuesOnly,filter:i,format:n,formatter:a,serializeDate:typeof e.serializeDate=="function"?e.serializeDate:E.serializeDate,skipNulls:typeof e.skipNulls=="boolean"?e.skipNulls:E.skipNulls,sort:typeof e.sort=="function"?e.sort:null,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:E.strictNullHandling}},zi=function(r,e){var t=r,n=Hi(e),a,i;typeof n.filter=="function"?(i=n.filter,t=i("",t)):I(n.filter)&&(i=n.filter,a=i);var o=[];if(typeof t!="object"||t===null)return"";var u=qt[n.arrayFormat],l=u==="comma"&&n.commaRoundTrip;a||(a=Object.keys(t)),n.sort&&a.sort(n.sort);for(var c=Ut(),s=0;s<a.length;++s){var p=a[s],f=t[p];n.skipNulls&&f===null||Wt(o,ji(f,p,u,l,n.allowEmptyArrays,n.strictNullHandling,n.skipNulls,n.encodeDotInKeys,n.encode?n.encoder:null,n.filter,n.sort,n.allowDots,n.serializeDate,n.format,n.formatter,n.encodeValuesOnly,n.charset,c))}var d=o.join(n.delimiter),y=n.addQueryPrefix===!0?"?":"";return n.charsetSentinel&&(n.charset==="iso-8859-1"?y+="utf8=%26%2310003%3B&":y+="utf8=%E2%9C%93&"),d.length>0?y+d:""},_=Bt,Ie=Object.prototype.hasOwnProperty,yr=Array.isArray,S={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:_.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},ki=function(r){return r.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},Ft=function(r,e,t){if(r&&typeof r=="string"&&e.comma&&r.indexOf(",")>-1)return r.split(",");if(e.throwOnLimitExceeded&&t>=e.arrayLimit)throw new RangeError("Array limit exceeded. Only "+e.arrayLimit+" element"+(e.arrayLimit===1?"":"s")+" allowed in an array.");return r},Ki="utf8=%26%2310003%3B",Vi="utf8=%E2%9C%93",Qi=function(e,t){var n={__proto__:null},a=t.ignoreQueryPrefix?e.replace(/^\?/,""):e;a=a.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var i=t.parameterLimit===1/0?void 0:t.parameterLimit,o=a.split(t.delimiter,t.throwOnLimitExceeded?i+1:i);if(t.throwOnLimitExceeded&&o.length>i)throw new RangeError("Parameter limit exceeded. Only "+i+" parameter"+(i===1?"":"s")+" allowed.");var u=-1,l,c=t.charset;if(t.charsetSentinel)for(l=0;l<o.length;++l)o[l].indexOf("utf8=")===0&&(o[l]===Vi?c="utf-8":o[l]===Ki&&(c="iso-8859-1"),u=l,l=o.length);for(l=0;l<o.length;++l)if(l!==u){var s=o[l],p=s.indexOf("]="),f=p===-1?s.indexOf("="):p+1,d,y;if(f===-1?(d=t.decoder(s,S.decoder,c,"key"),y=t.strictNullHandling?null:""):(d=t.decoder(s.slice(0,f),S.decoder,c,"key"),d!==null&&(y=_.maybeMap(Ft(s.slice(f+1),t,yr(n[d])?n[d].length:0),function(g){return t.decoder(g,S.decoder,c,"value")}))),y&&t.interpretNumericEntities&&c==="iso-8859-1"&&(y=ki(String(y))),s.indexOf("[]=")>-1&&(y=yr(y)?[y]:y),t.comma&&yr(y)&&y.length>t.arrayLimit){if(t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");y=_.combine([],y,t.arrayLimit,t.plainObjects)}if(d!==null){var h=Ie.call(n,d);h&&(t.duplicates==="combine"||s.indexOf("[]=")>-1)?n[d]=_.combine(n[d],y,t.arrayLimit,t.plainObjects):(!h||t.duplicates==="last")&&(n[d]=y)}}return n},Ji=function(r,e,t,n){var a=0;if(r.length>0&&r[r.length-1]==="[]"){var i=r.slice(0,-1).join("");a=Array.isArray(e)&&e[i]?e[i].length:0}for(var o=n?e:Ft(e,t,a),u=r.length-1;u>=0;--u){var l,c=r[u];if(c==="[]"&&t.parseArrays)_.isOverflow(o)?l=o:l=t.allowEmptyArrays&&(o===""||t.strictNullHandling&&o===null)?[]:_.combine([],o,t.arrayLimit,t.plainObjects);else{l=t.plainObjects?{__proto__:null}:{};var s=c.charAt(0)==="["&&c.charAt(c.length-1)==="]"?c.slice(1,-1):c,p=t.decodeDotInKeys?s.replace(/%2E/g,"."):s,f=parseInt(p,10),d=!isNaN(f)&&c!==p&&String(f)===p&&f>=0&&t.parseArrays;if(!t.parseArrays&&p==="")l={0:o};else if(d&&f<t.arrayLimit)l=[],l[f]=o;else{if(d&&t.throwOnLimitExceeded)throw new RangeError("Array limit exceeded. Only "+t.arrayLimit+" element"+(t.arrayLimit===1?"":"s")+" allowed in an array.");d?(l[f]=o,_.markOverflow(l,f)):p!=="__proto__"&&(l[p]=o)}}o=l}return o},Xi=function(e,t){var n=t.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e;if(t.depth<=0)return!t.plainObjects&&Ie.call(Object.prototype,n)&&!t.allowPrototypes?void 0:[n];var a=/(\[[^[\]]*])/,i=/(\[[^[\]]*])/g,o=a.exec(n),u=o?n.slice(0,o.index):n,l=[];if(u){if(!t.plainObjects&&Ie.call(Object.prototype,u)&&!t.allowPrototypes)return;l[l.length]=u}for(var c=0;(o=i.exec(n))!==null&&c<t.depth;){c+=1;var s=o[1].slice(1,-1);if(!t.plainObjects&&Ie.call(Object.prototype,s)&&!t.allowPrototypes)return;l[l.length]=o[1]}if(o){if(t.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+t.depth+" and strictDepth is true");l[l.length]="["+n.slice(o.index)+"]"}return l},Yi=function(e,t,n,a){if(e){var i=Xi(e,n);if(i)return Ji(i,t,n,a)}},Zi=function(e){if(!e)return S;if(typeof e.allowEmptyArrays<"u"&&typeof e.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof e.decodeDotInKeys<"u"&&typeof e.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&typeof e.decoder<"u"&&typeof e.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof e.charset<"u"&&e.charset!=="utf-8"&&e.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof e.throwOnLimitExceeded<"u"&&typeof e.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var t=typeof e.charset>"u"?S.charset:e.charset,n=typeof e.duplicates>"u"?S.duplicates:e.duplicates;if(n!=="combine"&&n!=="first"&&n!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var a=typeof e.allowDots>"u"?e.decodeDotInKeys===!0?!0:S.allowDots:!!e.allowDots;return{allowDots:a,allowEmptyArrays:typeof e.allowEmptyArrays=="boolean"?!!e.allowEmptyArrays:S.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes=="boolean"?e.allowPrototypes:S.allowPrototypes,allowSparse:typeof e.allowSparse=="boolean"?e.allowSparse:S.allowSparse,arrayLimit:typeof e.arrayLimit=="number"?e.arrayLimit:S.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel=="boolean"?e.charsetSentinel:S.charsetSentinel,comma:typeof e.comma=="boolean"?e.comma:S.comma,decodeDotInKeys:typeof e.decodeDotInKeys=="boolean"?e.decodeDotInKeys:S.decodeDotInKeys,decoder:typeof e.decoder=="function"?e.decoder:S.decoder,delimiter:typeof e.delimiter=="string"||_.isRegExp(e.delimiter)?e.delimiter:S.delimiter,depth:typeof e.depth=="number"||e.depth===!1?+e.depth:S.depth,duplicates:n,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities=="boolean"?e.interpretNumericEntities:S.interpretNumericEntities,parameterLimit:typeof e.parameterLimit=="number"?e.parameterLimit:S.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects=="boolean"?e.plainObjects:S.plainObjects,strictDepth:typeof e.strictDepth=="boolean"?!!e.strictDepth:S.strictDepth,strictMerge:typeof e.strictMerge=="boolean"?!!e.strictMerge:S.strictMerge,strictNullHandling:typeof e.strictNullHandling=="boolean"?e.strictNullHandling:S.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded=="boolean"?e.throwOnLimitExceeded:!1}},eo=function(r,e){var t=Zi(e);if(r===""||r===null||typeof r>"u")return t.plainObjects?{__proto__:null}:{};for(var n=typeof r=="string"?Qi(r,t):r,a=t.plainObjects?{__proto__:null}:{},i=Object.keys(n),o=0;o<i.length;++o){var u=i[o],l=Yi(u,n[u],t,typeof r=="string");a=_.merge(a,l,t)}return t.allowSparse===!0?a:_.compact(a)},ro=zi,to=eo,no=Tr,ao={formats:no,parse:to,stringify:ro};const io=Y.getDefaultExportFromCjs(ao);function ft(r){if(!Array.isArray(r))throw new TypeError("Middleware stack must be an array!");for(const e of r)if(typeof e!="function")throw new TypeError("Middleware must be composed of functions!");return function(e,t){let n=-1;return a(0);function a(i){if(i<=n)return Promise.reject(new Error("next() called multiple times"));n=i;let o=r[i];if(i===r.length&&(o=t),!o)return Promise.resolve();try{return Promise.resolve(o(e,a.bind(null,i+1)))}catch(u){return Promise.reject(u)}}}}const w={app:null,appPending:!0,appCb:[],services:new Map,servicePending:new Map,serviceCb:new Map,config:null,configPending:!1,configCb:[]};async function oo(r){if(w.config)return w.config;if(w.configPending)return new Promise(t=>{w.configCb.push(n=>t(n))});w.configPending=!0;const e=await r();return w.config=e,w.configCb.forEach(t=>t(e)),w.configCb=[],w.configPending=!1,e}class Gt{constructor(e={},t){P(this,"options");P(this,"apis",[]);P(this,"middlewares",[]);P(this,"defaultMiddlewares",[async(e,t)=>{try{await t()}catch(n){e.res.body=n.message||""}}]);P(this,"api404");P(this,"fnMiddleware");P(this,"getId");P(this,"extensions",new Map);P(this,"onDestroyCbs",[]);P(this,"config");P(this,"apiList");this.options={...e,baseUrl:e.baseUrl??"/"},this.options.baseUrl=this.options.baseUrl.split("/").map(a=>encodeURIComponent(a)).join("/"),this.middlewares.push(...this.defaultMiddlewares),this.middlewares.push(...e.middlewares||[]);const n=((e==null?void 0:e.apis)??[]).sort((a,i)=>{const o=i.path.substr(-1,1),u=o==="*"?0:o==="/"?.1:.2,l=a.path.substr(-1,1),c=l==="*"?0:l==="/"?.1:.2;return i.path.split("/").length+u-(a.path.split("/").length+c)}).map(a=>({...a,method:a.method??(e==null?void 0:e.defaultMethod)??"post"}));this.apiList=n,this.apis=n.filter(a=>!a.disabled),this.api404={path:"*",method:"all",action:(a,i)=>{throw i.res.status=404,Error("Not Found")}},this.fnMiddleware=ft(this.middlewares),this.getId=Y.useSoonIdGen({workerId:e.workId}),this.init(t)}async init(e){var t,n,a,i;try{if(this.options.config){const o=await this.options.config();this.config=o}await((n=(t=this.options)==null?void 0:t.onInit)==null?void 0:n.call(t,this)),w.app=this,w.appPending=!1,w.appCb.forEach(o=>o(this)),await((i=(a=this.options)==null?void 0:a.onReady)==null?void 0:i.call(a,this)),e==null||e(null,this)}catch(o){e==null||e(o,this)}}async fetchRaw(e,t,n){var f,d;const a=(n==null?void 0:n.url)??e,i=new URL(a,"http://localhost"),o=this.getId(),u={baseUrl:this.options.baseUrl??"",headers:(n==null?void 0:n.headers)??{},method:(n==null?void 0:n.method)??this.options.defaultMethod??"post",body:(n==null?void 0:n.body)??t,params:{},path:i.pathname,queryString:n!=null&&n.query?"?"+io.stringify(n.query):i.search,query:(n==null?void 0:n.query)??Object.fromEntries(i.searchParams),url:a,reqId:o,requestId:o,ip:(n==null?void 0:n.ip)??"",namespace:(n==null?void 0:n.namespace)??"default"};let l=this.api404;for(let y=0;y<this.apis.length;y++){const h=this.apis[y];if((h.namespace??"default")===u.namespace&&(h.method==="all"||h.method===((d=(f=u.method)==null?void 0:f.toLowerCase)==null?void 0:d.call(f)))){const A=Xt((this.options.baseUrl??"")+h.path,{loose:!1,trailing:!1})(u.path);if(A){u.params=A.params,l=h;break}}}const c={body:void 0,headers:{},status:200},s={app:this,currentAPI:l,req:u,request:u,reqId:o,requestId:o,res:c,response:c,platform:n==null?void 0:n.platform,config:this.config,meta:l.meta??{},service:{}},p=async()=>{var g,b;let y=u.body;if(l.bodySchema)if((g=l.bodySchema)!=null&&g.parse)try{y=l.bodySchema.parse(u.body)}catch(A){c.status=400;const m=(b=A==null?void 0:A.issues)==null?void 0:b[0];throw m&&(m.message=(m.path??[]).join(".")+" "+m.message),m?{...m,code:0}:new Error("参数错误")}else throw c.status=500,new Error("bodySchema must be ZodType");const h=await l.action(y,s);h!==void 0&&(c.body=h)};if(l.middlewares&&l.middlewares.length>0){const y=ft(l.middlewares),h=async()=>await y(s,p);n!=null&&n.noPublicMiddleware?await h:await this.fnMiddleware(s,h)}else n!=null&&n.noPublicMiddleware?await p():await this.fnMiddleware(s,p);return s.res}async fetch(e,t,n){return(await this.fetchRaw(e,t,n)).body}async action(e,t,n){const a={...n??{},noPublicMiddleware:!0},i=(n==null?void 0:n.url)??`${this.baseUrl}${e}`;return await this.fetch(i,t,a)}mount(e,t){this.extensions.set(e,t)}get(e){return this.extensions.get(e)}onUnloadService(e){this.onDestroyCbs.push(e)}async unloadService(){return Promise.all(this.onDestroyCbs.map(e=>e==null?void 0:e()))}get baseUrl(){return this.options.baseUrl??""}}const jt=Symbol("soon-api");function lo(r){const e={...r};return e._soon_symbol=jt,e}const Ht=Symbol("soon-service");function fo(r){async function e(){var i;const t=r.service;let n=w.services.get(t);if(n)return n;if(w.servicePending.get(t)){let o=w.serviceCb.get(t);return o||(o=[],w.serviceCb.set(t,o)),new Promise(u=>{o.push(l=>u(l))})}return w.servicePending.set(t,!0),await new Promise(o=>{w.app?o(1):w.appCb.push(()=>o(1))}),n=await t(w.app),w.services.set(t,n),(i=w.serviceCb.get(t))==null||i.forEach(o=>o(n)),w.serviceCb.delete(t),w.servicePending.delete(t),n}return e._soon_symbol=Ht,e.serviceName=(r==null?void 0:r.serviceName)??"",e.autoInject=(r==null?void 0:r.autoInject)??!1,e.enableClient=(r==null?void 0:r.enableClient)??!1,e}function uo(r){return r}function co(r){return async function(){return await oo(r)}}async function so(r){return await new Promise((e,t)=>{new Gt(r,(n,a)=>{if(n){t(n);return}e(a)})})}class po extends Error{constructor(t,n){super(t);P(this,"code");this.code=n}}class yo extends Error{constructor(t,n){super(t);P(this,"status");this.status=n}}function ho({pingTime:r=0,action:e}){let t=()=>null;const n=new xr(a=>{let i;r>0&&(i=setInterval(()=>{u.closed?clearInterval(i):a.next({event:"ping",message:`: ping
5
5
 
6
- `})},r));const i=[],f={send(l){try{a.next({...l,message:`${l.event?`event: ${l.event}
6
+ `})},r));const o=[],u={send(l){try{a.next({...l,message:`${l.event?`event: ${l.event}
7
7
  `:""}data: ${typeof l.data=="string"?l.data:JSON.stringify(l.data)}
8
8
 
9
- `})}catch(u){f.error(u.message)}},error(l){a.next({event:"error",data:l,message:`event: error
9
+ `})}catch(c){u.error(c.message)}},error(l){a.next({event:"error",data:l,message:`event: error
10
10
  data: ${l}
11
11
 
12
- `}),a.complete(),f.closed=!0,i.forEach(u=>u==null?void 0:u())},close(){a.next({event:"close",message:`event: close
12
+ `}),a.complete(),u.closed=!0,o.forEach(c=>c==null?void 0:c())},close(){a.next({event:"close",message:`event: close
13
13
  data:
14
14
 
15
- `}),a.complete(),f.closed=!0,o&&clearInterval(o),i.forEach(l=>l==null?void 0:l())},closed:!1,onClosed(l){i.push(l)}};t=()=>{f.closed||f.close()},e(f)});return n.streamClose=()=>t==null?void 0:t(),n}function mt(r){return r instanceof ir}function po(r){if(mt(r)){const e=new wt.PassThrough;return r.subscribe({next(t){e.write(t.message)},complete(){e.closed||e.end()}}),e.on("close",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e.on("error",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e.on("end",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e}else throw new Error("Not a valid SSE body")}exports.useSoonIdGen=J.useSoonIdGen;exports.BizError=uo;exports.Observable=ir;exports.SoonApp=pt;exports.SoonError=co;exports.createSoonApp=fo;exports.defineApi=ao;exports.defineConfig=lo;exports.defineMiddleware=io;exports.defineService=oo;exports.isSSEBody=mt;exports.resolveSSEBody=po;exports.soonApiSymbol=yt;exports.soonServiceSymbol=dt;exports.useSSE=so;
15
+ `}),a.complete(),u.closed=!0,i&&clearInterval(i),o.forEach(l=>l==null?void 0:l())},closed:!1,onClosed(l){o.push(l)}};t=()=>{u.closed||u.close()},e(u)});return n.streamClose=()=>t==null?void 0:t(),n}function zt(r){return r instanceof xr}function mo(r){if(zt(r)){const e=new Qt.PassThrough;return r.subscribe({next(t){e.write(t.message)},complete(){e.closed||e.end()}}),e.on("close",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e.on("error",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e.on("end",()=>{var t;return(t=r==null?void 0:r.streamClose)==null?void 0:t.call(r)}),e}else throw new Error("Not a valid SSE body")}exports.useSoonIdGen=Y.useSoonIdGen;exports.BizError=po;exports.Observable=xr;exports.SoonApp=Gt;exports.SoonError=yo;exports.createSoonApp=so;exports.defineApi=lo;exports.defineConfig=co;exports.defineMiddleware=uo;exports.defineService=fo;exports.isSSEBody=zt;exports.resolveSSEBody=mo;exports.soonApiSymbol=jt;exports.soonServiceSymbol=Ht;exports.useSSE=ho;