@tsed/json-mapper 8.10.0-rc.1 → 8.10.0-rc.3

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 (53) hide show
  1. package/lib/browser/components/DateMapper.js +22 -0
  2. package/lib/browser/components/DateMapper.js.map +1 -0
  3. package/lib/browser/components/PrimitiveMapper.js +52 -0
  4. package/lib/browser/components/PrimitiveMapper.js.map +1 -0
  5. package/lib/browser/components/SymbolMapper.js +21 -0
  6. package/lib/browser/components/SymbolMapper.js.map +1 -0
  7. package/lib/browser/decorators/afterDeserialize.js +10 -0
  8. package/lib/browser/decorators/afterDeserialize.js.map +1 -0
  9. package/lib/browser/decorators/beforeDeserialize.js +10 -0
  10. package/lib/browser/decorators/beforeDeserialize.js.map +1 -0
  11. package/lib/browser/decorators/jsonMapper.js +12 -0
  12. package/lib/browser/decorators/jsonMapper.js.map +1 -0
  13. package/lib/browser/decorators/onDeserialize.js +10 -0
  14. package/lib/browser/decorators/onDeserialize.js.map +1 -0
  15. package/lib/browser/decorators/onSerialize.js +10 -0
  16. package/lib/browser/decorators/onSerialize.js.map +1 -0
  17. package/lib/browser/domain/JsonDeserializer.js +179 -0
  18. package/lib/browser/domain/JsonDeserializer.js.map +1 -0
  19. package/lib/browser/domain/JsonDeserializerOptions.js +2 -0
  20. package/lib/browser/domain/JsonDeserializerOptions.js.map +1 -0
  21. package/lib/browser/domain/JsonMapperCompiler.js +110 -0
  22. package/lib/browser/domain/JsonMapperCompiler.js.map +1 -0
  23. package/lib/browser/domain/JsonMapperGlobalOptions.js +2 -0
  24. package/lib/browser/domain/JsonMapperGlobalOptions.js.map +1 -0
  25. package/lib/browser/domain/JsonMapperSettings.js +9 -0
  26. package/lib/browser/domain/JsonMapperSettings.js.map +1 -0
  27. package/lib/browser/domain/JsonMapperTypesContainer.js +12 -0
  28. package/lib/browser/domain/JsonMapperTypesContainer.js.map +1 -0
  29. package/lib/browser/domain/JsonSerializer.js +164 -0
  30. package/lib/browser/domain/JsonSerializer.js.map +1 -0
  31. package/lib/browser/domain/JsonSerializerOptions.js +2 -0
  32. package/lib/browser/domain/JsonSerializerOptions.js.map +1 -0
  33. package/lib/browser/domain/Writer.js +124 -0
  34. package/lib/browser/domain/Writer.js.map +1 -0
  35. package/lib/browser/hooks/alterAfterDeserialize.js +8 -0
  36. package/lib/browser/hooks/alterAfterDeserialize.js.map +1 -0
  37. package/lib/browser/hooks/alterBeforeDeserialize.js +8 -0
  38. package/lib/browser/hooks/alterBeforeDeserialize.js.map +1 -0
  39. package/lib/browser/hooks/alterOnDeserialize.js +7 -0
  40. package/lib/browser/hooks/alterOnDeserialize.js.map +1 -0
  41. package/lib/browser/hooks/alterOnSerialize.js +7 -0
  42. package/lib/browser/hooks/alterOnSerialize.js.map +1 -0
  43. package/lib/browser/index.js +47 -0
  44. package/lib/browser/index.js.map +1 -0
  45. package/lib/browser/utils/deserialize.js +12 -0
  46. package/lib/browser/utils/deserialize.js.map +1 -0
  47. package/lib/browser/utils/getObjectProperties.js +8 -0
  48. package/lib/browser/utils/getObjectProperties.js.map +1 -0
  49. package/lib/browser/utils/serialize.js +12 -0
  50. package/lib/browser/utils/serialize.js.map +1 -0
  51. package/package.json +7 -7
  52. package/vite.config.mts +30 -4
  53. package/lib/browser/json-mapper.umd.cjs +0 -34
@@ -1,34 +0,0 @@
1
- (function(Se,qe){typeof exports=="object"&&typeof module<"u"?qe(exports,require("\0/home/runner/work/tsed/tsed/node_modules/change-case/dist/index.js?commonjs-external"),require("\0/home/runner/work/tsed/tsed/node_modules/statuses/index.js?commonjs-external"),require("\0/home/runner/work/tsed/tsed/node_modules/picomatch/index.js?commonjs-external")):typeof define=="function"&&define.amd?define(["exports","\0/home/runner/work/tsed/tsed/node_modules/change-case/dist/index.js?commonjs-external","\0/home/runner/work/tsed/tsed/node_modules/statuses/index.js?commonjs-external","\0/home/runner/work/tsed/tsed/node_modules/picomatch/index.js?commonjs-external"],qe):(Se=typeof globalThis<"u"?globalThis:Se||self,qe(Se["@tsed/json-mapper"]={},Se.require$$0,Se.require$$1,Se.require$$2))})(this,function(exports,require$$0,require$$1,require$$2){"use strict";var qo=Se=>{throw TypeError(Se)};var ku=(Se,qe,P)=>qe.has(Se)||qo("Cannot "+P);var hi=(Se,qe,P)=>(ku(Se,qe,"read from private field"),P?P.call(Se):qe.get(Se)),Lo=(Se,qe,P)=>qe.has(Se)?qo("Cannot add the same private member more than once"):qe instanceof WeakSet?qe.add(Se):qe.set(Se,P);var qe;var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},core_umd$1={exports:{}},core_umd=core_umd$1.exports,hasRequiredCore_umd;function requireCore_umd(){return hasRequiredCore_umd||(hasRequiredCore_umd=1,function(P,c){(function(n,O){O(c)})(core_umd,function(n){var O=o=>{throw TypeError(o)},S=(o,l,h)=>l.has(o)||O("Cannot "+h),N=(o,l,h)=>(S(o,l,"read from private field"),h?h.call(o):l.get(o)),F=(o,l,h)=>l.has(o)?O("Cannot add the same private member more than once"):l instanceof WeakSet?l.add(o):l.set(o,h),B=(o,l,h,M)=>(S(o,l,"write to private field"),l.set(o,h),h),A,ne,G,ae,me=(o=>(o.PARAM="parameter",o.PARAM_CTOR="parameter.constructor",o.PARAM_STC="parameter.static",o.PROP="property",o.PROP_STC="property.static",o.METHOD="method",o.METHOD_STC="method.static",o.CLASS="class",o))(me||{});function $e(o){return o.prototype?o:o.constructor}function pe(o){return $e(o)}function _e(o){const[l,h,M]=o,$=V=>l!==pe(l)?V:`${V}.static`;return typeof M=="number"?h?$("parameter"):"parameter.constructor":M&&M.value?$("method"):h&&M===void 0||M?$("property"):me.CLASS}function Re(o){return o===Date||o instanceof Date&&!isNaN(+o)}function Me(o){return typeof o=="function"}function Xe(o){return o==null}function Ze(o){return typeof o=="boolean"||o instanceof Boolean||o===Boolean}function st(o){return typeof o=="boolean"||o instanceof Boolean||o===Boolean}function lt(o){return typeof o=="number"}function dt(o){return typeof o=="number"||o instanceof Number||o===Number}function ye(o){return typeof o=="string"}function _r(o){return typeof o=="string"||o instanceof String||o===String}function pn(o){return _r(o)||dt(o)||st(o)}function yt(o){return ye(o)||lt(o)||Ze(o)}function Q(o){return[String,Number,Boolean].includes(o)}function xr(o){return o instanceof RegExp}function Y(o){return typeof o=="symbol"}function Ar(o){return typeof o=="symbol"||o instanceof Symbol||o===Symbol}const ln=o=>Xe(o)||yt(o)||Y(o)||Me(o),ut=(o,l=new WeakMap)=>{if(ln(o))return o;const h=l.get(o);if(h)return h;if(ArrayBuffer.isView(o))return Buffer.isBuffer(o)?Buffer.from(o):new(pe(o))(o.buffer.slice(0),o.byteOffset,o.byteLength);if(Re(o))return new Date(o);if(xr(o))return new RegExp(o);if(Array.isArray(o)){const $=[];return l.set(o,$),o.forEach((V,ce)=>$[ce]=ut(V,l)),$}if(o instanceof Map){const $=new Map;return l.set(o,$),o.forEach((V,ce)=>$.set(ut(ce,l),ut(V,l))),$}if(o instanceof Set){const $=new Set;return l.set(o,$),o.forEach(V=>$.add(ut(V,l))),$}const M=Object.create(Reflect.getPrototypeOf(o));return l.set(o,M),Reflect.ownKeys(o).forEach($=>{const V=Object.getOwnPropertyDescriptor(o,$);V&&(Me(V.value)?Object.defineProperty(M,$,V):Object.defineProperty(M,$,{...V,value:ut(V.value,l)}))}),M};function or(o){return o?pe(o)!==Object?Object.create(o):{}:{}}function Mt(o){return["__proto__","constructor","prototype"].includes(o)}function $r(o){return Object.keys(o).filter(l=>!Mt(l))}function Rr(o){return(l,h,M)=>{const $=l.findIndex(V=>o(V,h));return $===-1?[...l,h]:(l[$]=ft(l[$],h,M),l)}}const fn=Rr((o,l)=>o===l);function p({reducers:o,parentKey:l}){return o?l&&o[l]?o[l]:o.default||fn:fn}function Et(o,l){return yt(o)||Y(o)||Me(o)||l===void 0}function Oe(o,l){return o==null||o===""&&l!==""}function ft(o,l,h={}){if(Oe(l,o))return o;if(Et(l,o))return l;if(Array.isArray(o)){const $=p(h);return[].concat(l).reduce((V,ce)=>$(V,ce,h),[...o])}const M=or(o);return[...$r(o),...$r(l)].reduce(($,V)=>{var ce;const De=o&&o[V],Ne=ft(De,l&&l[V],{...h,parentKey:V});return h.cleanUndefinedProps&&Ne===void 0||($[V]=((ce=h.alter)==null?void 0:ce.call(h,V,Ne))??Ne),$},M)}function it(o,l){return Reflect.getOwnPropertyDescriptor(o&&o.prototype||o,l)}function ys(o,l){var h;return(h=it(o,l))==null?void 0:h.value}function Dr(o){return typeof o=="function"?o.name:o.constructor.name}const hn=o=>o.toString().replace("Symbol(","").replace(")","");function gt(o){switch(typeof o){default:return""+o;case"symbol":return hn(o);case"function":return Dr(o)}}var Kt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:{},jr={};/*! *****************************************************************************
2
- Copyright (C) Microsoft. All rights reserved.
3
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4
- this file except in compliance with the License. You may obtain a copy of the
5
- License at http://www.apache.org/licenses/LICENSE-2.0
6
-
7
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10
- MERCHANTABLITY OR NON-INFRINGEMENT.
11
-
12
- See the Apache Version 2.0 License for specific language governing permissions
13
- and limitations under the License.
14
- ***************************************************************************** */var Cr;function pt(){if(Cr)return jr;Cr=1;var o;return function(l){(function(h){var M=typeof globalThis=="object"?globalThis:typeof Kt=="object"?Kt:typeof self=="object"?self:typeof this=="object"?this:Ne(),$=V(l);typeof M.Reflect<"u"&&($=V(M.Reflect,$)),h($,M),typeof M.Reflect>"u"&&(M.Reflect=l);function V(ot,_t){return function(Ot,Zt){Object.defineProperty(ot,Ot,{configurable:!0,writable:!0,value:Zt}),_t&&_t(Ot,Zt)}}function ce(){try{return Function("return this;")()}catch{}}function De(){try{return(0,eval)("(function() { return this; })()")}catch{}}function Ne(){return ce()||De()}})(function(h,M){var $=Object.prototype.hasOwnProperty,V=typeof Symbol=="function",ce=V&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",De=V&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",Ne=typeof Object.create=="function",ot={__proto__:[]}instanceof Array,_t=!Ne&&!ot,Ot={create:Ne?function(){return It(Object.create(null))}:ot?function(){return It({__proto__:null})}:function(){return It({})},has:_t?function(y,v){return $.call(y,v)}:function(y,v){return v in y},get:_t?function(y,v){return $.call(y,v)?y[v]:void 0}:function(y,v){return y[v]}},Zt=Object.getPrototypeOf(Function),Qt=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:$s(),zr=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Rs(),Ur=typeof WeakMap=="function"?WeakMap:Ds(),Ct=V?Symbol.for("@reflect-metadata:registry"):void 0,wr=_s(),Jn=xs(wr);function Bn(y,v,E,j){if(re(E)){if(!Yn(y))throw new TypeError;if(!Xn(v))throw new TypeError;return Fn(y,v)}else{if(!Yn(y))throw new TypeError;if(!Ce(v))throw new TypeError;if(!Ce(j)&&!re(j)&&!xt(j))throw new TypeError;return xt(j)&&(j=void 0),E=at(E),er(y,v,E,j)}}h("decorate",Bn);function Sr(y,v){function E(j,X){if(!Ce(j))throw new TypeError;if(!re(X)&&!Zn(X))throw new TypeError;Yr(y,v,j,X)}return E}h("metadata",Sr);function Gn(y,v,E,j){if(!Ce(E))throw new TypeError;return re(j)||(j=at(j)),Yr(y,v,E,j)}h("defineMetadata",Gn);function Hr(y,v,E){if(!Ce(v))throw new TypeError;return re(E)||(E=at(E)),Wn(y,v,E)}h("hasMetadata",Hr);function qn(y,v,E){if(!Ce(v))throw new TypeError;return re(E)||(E=at(E)),kt(y,v,E)}h("hasOwnMetadata",qn);function Ss(y,v,E){if(!Ce(v))throw new TypeError;return re(E)||(E=at(E)),zn(y,v,E)}h("getMetadata",Ss);function Ln(y,v,E){if(!Ce(v))throw new TypeError;return re(E)||(E=at(E)),Vr(y,v,E)}h("getOwnMetadata",Ln);function Kn(y,v){if(!Ce(y))throw new TypeError;return re(v)||(v=at(v)),Xr(y,v)}h("getMetadataKeys",Kn);function Ms(y,v){if(!Ce(y))throw new TypeError;return re(v)||(v=at(v)),Un(y,v)}h("getOwnMetadataKeys",Ms);function Es(y,v,E){if(!Ce(v))throw new TypeError;if(re(E)||(E=at(E)),!Ce(v))throw new TypeError;re(E)||(E=at(E));var j=rr(v,E,!1);return re(j)?!1:j.OrdinaryDeleteMetadata(y,v,E)}h("deleteMetadata",Es);function Fn(y,v){for(var E=y.length-1;E>=0;--E){var j=y[E],X=j(v);if(!re(X)&&!xt(X)){if(!Xn(X))throw new TypeError;v=X}}return v}function er(y,v,E,j){for(var X=y.length-1;X>=0;--X){var Je=y[X],ke=Je(v,E,j);if(!re(ke)&&!xt(ke)){if(!Ce(ke))throw new TypeError;j=ke}}return j}function Wn(y,v,E){var j=kt(y,v,E);if(j)return!0;var X=en(v);return xt(X)?!1:Wn(y,X,E)}function kt(y,v,E){var j=rr(v,E,!1);return re(j)?!1:Qr(j.OrdinaryHasOwnMetadata(y,v,E))}function zn(y,v,E){var j=kt(y,v,E);if(j)return Vr(y,v,E);var X=en(v);if(!xt(X))return zn(y,X,E)}function Vr(y,v,E){var j=rr(v,E,!1);if(!re(j))return j.OrdinaryGetOwnMetadata(y,v,E)}function Yr(y,v,E,j){var X=rr(E,j,!0);X.OrdinaryDefineOwnMetadata(y,v,E,j)}function Xr(y,v){var E=Un(y,v),j=en(y);if(j===null)return E;var X=Xr(j,v);if(X.length<=0)return E;if(E.length<=0)return X;for(var Je=new zr,ke=[],oe=0,k=E;oe<k.length;oe++){var q=k[oe],K=Je.has(q);K||(Je.add(q),ke.push(q))}for(var z=0,le=X;z<le.length;z++){var q=le[z],K=Je.has(q);K||(Je.add(q),ke.push(q))}return ke}function Un(y,v){var E=rr(y,v,!1);return E?E.OrdinaryOwnMetadataKeys(y,v):[]}function Zr(y){if(y===null)return 1;switch(typeof y){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return y===null?1:6;default:return 6}}function re(y){return y===void 0}function xt(y){return y===null}function Ps(y){return typeof y=="symbol"}function Ce(y){return typeof y=="object"?y!==null:typeof y=="function"}function Hn(y,v){switch(Zr(y)){case 0:return y;case 1:return y;case 2:return y;case 3:return y;case 4:return y;case 5:return y}var E="string",j=Qn(y,ce);if(j!==void 0){var X=j.call(y,E);if(Ce(X))throw new TypeError;return X}return Ts(y)}function Ts(y,v){var E,j;{var X=y.toString;if(Mr(X)){var j=X.call(y);if(!Ce(j))return j}var E=y.valueOf;if(Mr(E)){var j=E.call(y);if(!Ce(j))return j}}throw new TypeError}function Qr(y){return!!y}function Vn(y){return""+y}function at(y){var v=Hn(y);return Ps(v)?v:Vn(v)}function Yn(y){return Array.isArray?Array.isArray(y):y instanceof Object?y instanceof Array:Object.prototype.toString.call(y)==="[object Array]"}function Mr(y){return typeof y=="function"}function Xn(y){return typeof y=="function"}function Zn(y){switch(Zr(y)){case 3:return!0;case 4:return!0;default:return!1}}function U(y,v){return y===v||y!==y&&v!==v}function Qn(y,v){var E=y[v];if(E!=null){if(!Mr(E))throw new TypeError;return E}}function es(y){var v=Qn(y,De);if(!Mr(v))throw new TypeError;var E=v.call(y);if(!Ce(E))throw new TypeError;return E}function tr(y){return y.value}function ts(y){var v=y.next();return v.done?!1:v}function rs(y){var v=y.return;v&&v.call(y)}function en(y){var v=Object.getPrototypeOf(y);if(typeof y!="function"||y===Zt||v!==Zt)return v;var E=y.prototype,j=E&&Object.getPrototypeOf(E);if(j==null||j===Object.prototype)return v;var X=j.constructor;return typeof X!="function"||X===y?v:X}function xe(){var y;!re(Ct)&&typeof M.Reflect<"u"&&!(Ct in M.Reflect)&&typeof M.Reflect.defineMetadata=="function"&&(y=As(M.Reflect));var v,E,j,X=new Ur,Je={registerProvider:ke,getProvider:k,setProvider:K};return Je;function ke(z){if(!Object.isExtensible(Je))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case y===z:break;case re(v):v=z;break;case v===z:break;case re(E):E=z;break;case E===z:break;default:j===void 0&&(j=new zr),j.add(z);break}}function oe(z,le){if(!re(v)){if(v.isProviderFor(z,le))return v;if(!re(E)){if(E.isProviderFor(z,le))return v;if(!re(j))for(var Pe=es(j);;){var je=ts(Pe);if(!je)return;var Qe=tr(je);if(Qe.isProviderFor(z,le))return rs(Pe),Qe}}}if(!re(y)&&y.isProviderFor(z,le))return y}function k(z,le){var Pe=X.get(z),je;return re(Pe)||(je=Pe.get(le)),re(je)&&(je=oe(z,le),re(je)||(re(Pe)&&(Pe=new Qt,X.set(z,Pe)),Pe.set(le,je))),je}function q(z){if(re(z))throw new TypeError;return v===z||E===z||!re(j)&&j.has(z)}function K(z,le,Pe){if(!q(Pe))throw new Error("Metadata provider not registered.");var je=k(z,le);if(je!==Pe){if(!re(je))return!1;var Qe=X.get(z);re(Qe)&&(Qe=new Qt,X.set(z,Qe)),Qe.set(le,Pe)}return!0}}function _s(){var y;return!re(Ct)&&Ce(M.Reflect)&&Object.isExtensible(M.Reflect)&&(y=M.Reflect[Ct]),re(y)&&(y=xe()),!re(Ct)&&Ce(M.Reflect)&&Object.isExtensible(M.Reflect)&&Object.defineProperty(M.Reflect,Ct,{enumerable:!1,configurable:!1,writable:!1,value:y}),y}function xs(y){var v=new Ur,E={isProviderFor:function(q,K){var z=v.get(q);return re(z)?!1:z.has(K)},OrdinaryDefineOwnMetadata:ke,OrdinaryHasOwnMetadata:X,OrdinaryGetOwnMetadata:Je,OrdinaryOwnMetadataKeys:oe,OrdinaryDeleteMetadata:k};return wr.registerProvider(E),E;function j(q,K,z){var le=v.get(q),Pe=!1;if(re(le)){if(!z)return;le=new Qt,v.set(q,le),Pe=!0}var je=le.get(K);if(re(je)){if(!z)return;if(je=new Qt,le.set(K,je),!y.setProvider(q,K,E))throw le.delete(K),Pe&&v.delete(q),new Error("Wrong provider for target.")}return je}function X(q,K,z){var le=j(K,z,!1);return re(le)?!1:Qr(le.has(q))}function Je(q,K,z){var le=j(K,z,!1);if(!re(le))return le.get(q)}function ke(q,K,z,le){var Pe=j(z,le,!0);Pe.set(q,K)}function oe(q,K){var z=[],le=j(q,K,!1);if(re(le))return z;for(var Pe=le.keys(),je=es(Pe),Qe=0;;){var ns=ts(je);if(!ns)return z.length=Qe,z;var js=tr(ns);try{z[Qe]=js}catch(tn){try{rs(je)}finally{throw tn}}Qe++}}function k(q,K,z){var le=j(K,z,!1);if(re(le)||!le.delete(q))return!1;if(le.size===0){var Pe=v.get(K);re(Pe)||(Pe.delete(z),Pe.size===0&&v.delete(Pe))}return!0}}function As(y){var v=y.defineMetadata,E=y.hasOwnMetadata,j=y.getOwnMetadata,X=y.getOwnMetadataKeys,Je=y.deleteMetadata,ke=new Ur,oe={isProviderFor:function(k,q){var K=ke.get(k);return!re(K)&&K.has(q)?!0:X(k,q).length?(re(K)&&(K=new zr,ke.set(k,K)),K.add(q),!0):!1},OrdinaryDefineOwnMetadata:v,OrdinaryHasOwnMetadata:E,OrdinaryGetOwnMetadata:j,OrdinaryOwnMetadataKeys:X,OrdinaryDeleteMetadata:Je};return oe}function rr(y,v,E){var j=wr.getProvider(y,v);if(!re(j))return j;if(E){if(wr.setProvider(y,v,Jn))return Jn;throw new Error("Illegal state.")}}function $s(){var y={},v=[],E=function(){function oe(k,q,K){this._index=0,this._keys=k,this._values=q,this._selector=K}return oe.prototype["@@iterator"]=function(){return this},oe.prototype[De]=function(){return this},oe.prototype.next=function(){var k=this._index;if(k>=0&&k<this._keys.length){var q=this._selector(this._keys[k],this._values[k]);return k+1>=this._keys.length?(this._index=-1,this._keys=v,this._values=v):this._index++,{value:q,done:!1}}return{value:void 0,done:!0}},oe.prototype.throw=function(k){throw this._index>=0&&(this._index=-1,this._keys=v,this._values=v),k},oe.prototype.return=function(k){return this._index>=0&&(this._index=-1,this._keys=v,this._values=v),{value:k,done:!0}},oe}(),j=function(){function oe(){this._keys=[],this._values=[],this._cacheKey=y,this._cacheIndex=-2}return Object.defineProperty(oe.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),oe.prototype.has=function(k){return this._find(k,!1)>=0},oe.prototype.get=function(k){var q=this._find(k,!1);return q>=0?this._values[q]:void 0},oe.prototype.set=function(k,q){var K=this._find(k,!0);return this._values[K]=q,this},oe.prototype.delete=function(k){var q=this._find(k,!1);if(q>=0){for(var K=this._keys.length,z=q+1;z<K;z++)this._keys[z-1]=this._keys[z],this._values[z-1]=this._values[z];return this._keys.length--,this._values.length--,U(k,this._cacheKey)&&(this._cacheKey=y,this._cacheIndex=-2),!0}return!1},oe.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=y,this._cacheIndex=-2},oe.prototype.keys=function(){return new E(this._keys,this._values,X)},oe.prototype.values=function(){return new E(this._keys,this._values,Je)},oe.prototype.entries=function(){return new E(this._keys,this._values,ke)},oe.prototype["@@iterator"]=function(){return this.entries()},oe.prototype[De]=function(){return this.entries()},oe.prototype._find=function(k,q){if(!U(this._cacheKey,k)){this._cacheIndex=-1;for(var K=0;K<this._keys.length;K++)if(U(this._keys[K],k)){this._cacheIndex=K;break}}return this._cacheIndex<0&&q&&(this._cacheIndex=this._keys.length,this._keys.push(k),this._values.push(void 0)),this._cacheIndex},oe}();return j;function X(oe,k){return oe}function Je(oe,k){return k}function ke(oe,k){return[oe,k]}}function Rs(){var y=function(){function v(){this._map=new Qt}return Object.defineProperty(v.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),v.prototype.has=function(E){return this._map.has(E)},v.prototype.add=function(E){return this._map.set(E,E),this},v.prototype.delete=function(E){return this._map.delete(E)},v.prototype.clear=function(){this._map.clear()},v.prototype.keys=function(){return this._map.keys()},v.prototype.values=function(){return this._map.keys()},v.prototype.entries=function(){return this._map.entries()},v.prototype["@@iterator"]=function(){return this.keys()},v.prototype[De]=function(){return this.keys()},v}();return y}function Ds(){var y=16,v=Ot.create(),E=j();return function(){function k(){this._key=j()}return k.prototype.has=function(q){var K=X(q,!1);return K!==void 0?Ot.has(K,this._key):!1},k.prototype.get=function(q){var K=X(q,!1);return K!==void 0?Ot.get(K,this._key):void 0},k.prototype.set=function(q,K){var z=X(q,!0);return z[this._key]=K,this},k.prototype.delete=function(q){var K=X(q,!1);return K!==void 0?delete K[this._key]:!1},k.prototype.clear=function(){this._key=j()},k}();function j(){var k;do k="@@WeakMap@@"+oe();while(Ot.has(v,k));return v[k]=!0,k}function X(k,q){if(!$.call(k,E)){if(!q)return;Object.defineProperty(k,E,{value:Ot.create()})}return k[E]}function Je(k,q){for(var K=0;K<q;++K)k[K]=Math.random()*255|0;return k}function ke(k){if(typeof Uint8Array=="function"){var q=new Uint8Array(k);return typeof crypto<"u"?crypto.getRandomValues(q):typeof msCrypto<"u"?msCrypto.getRandomValues(q):Je(q,k),q}return Je(new Array(k),k)}function oe(){var k=ke(y);k[6]=k[6]&79|64,k[8]=k[8]&191|128;for(var q="",K=0;K<y;++K){var z=k[K];(K===4||K===6||K===8)&&(q+="-"),z<16&&(q+="0"),q+=z.toString(16).toLowerCase()}return q}}function It(y){return y.__=void 0,delete y.__,y}})}(o||(o={})),jr}pt();const ar="design:paramtypes",kr="design:type",cr="design:returntype",Pt=new Map,$t=class{static get(l,h,M){return Reflect.getMetadata(l,pe(h),M)}static getOwn(l,h,M){return Reflect.getOwnMetadata(l,pe(h),M)}static getType(l,h){return Reflect.getMetadata(kr,l,h)}static getOwnType(l,h){return Reflect.getMetadata(kr,l,h)}static getReturnType(l,h){return Reflect.getMetadata(cr,l,h)}static getOwnReturnType(l,h){return Reflect.getOwnMetadata(cr,l,h)}static has(l,h,M){try{return Reflect.hasMetadata(l,pe(h),M)}catch{}return!1}static hasOwn(l,h,M){return Reflect.hasOwnMetadata(l,pe(h),M)}static delete(l,h,M){return Reflect.deleteMetadata(l,pe(h),M)}static setParamTypes(l,h,M){return this.set(ar,M,l.prototype,h)}static set(l,h,M,$){const V=Pt.has(l)?Pt.get(l)||[]:[],ce=pe(M);V.indexOf(ce)===-1&&(V.push(ce),Pt.set(l,V)),Reflect.defineMetadata(l,h,pe(M),$)}static getParamTypes(l,h){return Reflect.getMetadata(ar,l,h)||[]}static getOwnParamTypes(l,h){return Reflect.getOwnMetadata(ar,l,h)||[]}};$t.getTargetsFromPropertyKey=o=>Pt.has(o)?Pt.get(o)||[]:[];let et=$t;const mn="tsed:class:store",We="tsed:method:store",dn="tsed:property:store",ur="tsed:param:store",Ft=new Map;function Ve(o,...l){if(Y(l[0]))return Ft.has(l[0])||Ft.set(l[0],new tt),Ft.get(l[0]);{const h=et;return h.hasOwn(o,...l)||h.set(o,new tt,...l),h.getOwn(o,...l)}}function Ir(o){const[l,h,M]=o;switch(_e(o)){case me.PARAM_CTOR:case me.PARAM_STC:case me.PARAM:const $=Ve(ur,l,h);return $.has(""+M)||$.set(""+M,new tt),$.get(""+M);case me.PROP:case me.PROP_STC:return Ve(dn,l,h);case me.METHOD:case me.METHOD_STC:return Ve(We,l,h);case me.CLASS:return Ve(mn,l)}}class tt{constructor(){this._entries=new Map}static from(...l){return Ir(l)}static fromMethod(l,h){return tt.from(l,h,it(l,h))}static mergeStoreFrom(l,h,...M){const $=tt.from(l,...M);return tt.from(h,...M)._entries.forEach((V,ce)=>{$.merge(ce,V)}),$}static mergeStoreMethodFrom(l,h,M){return this.mergeStoreFrom(l,h,M,it(l,M))}get(l,h){return this._entries.get(gt(l))||h}has(l){return this._entries.has(gt(l))}set(l,h){return this._entries.set(gt(l),h),this}delete(l){return this._entries.delete(gt(l))}merge(l,h,M=!1){let $=this.get(l);return $&&(h=ut(h),$=ut($),h=M?ft(h,$):ft($,h)),this.set(l,h),this}toJson(){return[...this._entries.entries()].reduce((l,[h,M])=>({...l,[h]:M}),{})}}function Wt(o){return(...l)=>{const h=tt.from(...l),M=o(h,l);return typeof M=="function"&&M(...l),l[2]}}function yn(o,l){return Wt(h=>{h.merge(o,l)})}function gn(o,l){return Wt(h=>{h.set(o,l)})}class pr extends Error{constructor(l,h){super(pr.buildMessage(l,h))}static buildMessage(l,h){const[M,$,V]=h,ce=_e(h),De=ce.split("/")[0],Ne=De==="parameter"?".["+V+"]":"",ot=$?"."+$:De==="parameter"?".constructor":"",_t=gt(pe(M))+ot+Ne;return`${l.name} cannot be used as ${ce} decorator on ${_t}`}}var Nr=(o=>(o.PROD="production",o.DEV="development",o.TEST="test",o))(Nr||{});const gs=Nr,rt=Function;commonjsGlobal.Type=rt;function zt(o){return o&&Object.getPrototypeOf(o)}function lr(o){return zt(o)}function Rt(o){const l=[];let h=pe(o);for(;h&&gt(h)!=="";)l.unshift(h),h=lr(h);return l}function fr(o){return typeof o=="object"}function On(o){return!!o&&typeof o.lift=="function"&&typeof o.subscribe=="function"}function Jr(o){return o===Promise||o instanceof Promise||!!o&&typeof o.subscribe!="function"&&typeof o.then=="function"}function hr(o){return o!==null&&typeof o=="object"&&typeof o.pipe=="function"}function He(o){return fr(o)&&"data"in o&&"headers"in o&&"status"in o&&"statusText"in o}var Br=(o=>(o.PENDING="PENDING",o.CANCELED="CANCELED",o.RESOLVED="RESOLVED",o.REJECTED="REJECTED",o))(Br||{}),Ut=(o=>(o.STREAM="STREAM",o.BUFFER="BUFFER",o.DATA="DATA",o))(Ut||{});class mr{constructor({hasNextFunction:l=!1}={}){F(this,A),F(this,ne),F(this,G),F(this,ae),this.status="PENDING",B(this,G,!1),B(this,G,l),B(this,ae,new Promise((h,M)=>{B(this,A,h),B(this,ne,M)}))}isDone(){return this.status!=="PENDING"}get next(){return B(this,G,!0),l=>{if(!this.isDone())return l?this.reject(l):this.resolve({type:"DATA"})}}call(l){if(this.isDone())return Promise.resolve(this);try{this.handle(l())}catch(h){this.reject(h)}return N(this,ae)}reject(l){this.isDone()||(this.done("REJECTED"),N(this,ne).call(this,l))}resolve(l={}){this.isDone()||(this.done("RESOLVED"),N(this,A).call(this,{...l,state:"RESOLVED"}))}destroy(){}cancel(){if(!this.isDone())return this.done("CANCELED"),N(this,A).call(this,{state:"CANCELED"})}done(l){this.destroy(),this.status=l}handle(l,h={}){if(!this.isDone()){if(l){if(this.isCanceledResponse(l))return this.cancel();if(On(l)&&(l=l.toPromise()),He(l))return this.handle(l.data,{...h,status:l.status,headers:l.headers});if(hr(l))return this.resolve({...h,type:"STREAM",data:l});if(hr(l)||Buffer.isBuffer(l))return this.resolve({...h,type:"BUFFER",data:l});if(Jr(l))return l.then(M=>this.handle(M,h)).catch(M=>M.response&&He(M.response)?this.handle(M.response):this.reject(M))}if(!N(this,G))return this.resolve({...h,data:l,type:"DATA"})}}isCanceledResponse(l){return l==="CANCELED"}}A=new WeakMap,ne=new WeakMap,G=new WeakMap,ae=new WeakMap;function Gr(o){try{o()}catch(l){return l}}async function Os(o){try{await o()}catch(l){return l}}function vs(o,l=[]){return Object.entries(o).reduce((h,[M,$])=>(Mt(M)||l.includes(M)||$===void 0||(h[M]=$),h),{})}function vn(o){return typeof o=="function"?o:o.constructor}function qr(o){return vn(o)}function ie(o){return pe(o)===o?o.prototype:o}function bn(o){const l=new Map;return o=pe(o),Rt(o).forEach(h=>{Reflect.ownKeys(ie(h)).forEach(M=>{var $;Y(M)||M==="constructor"||($=Object.getOwnPropertyDescriptor(ie(h),M))!=null&&$.get||l.set(M,{target:h,propertyKey:M})})}),Array.from(l.values())}function Ht(o,l){bn(o).forEach(({target:h,propertyKey:M})=>{const $=ie(o);h!==pe(o)&&(Object.defineProperty($,M,{writable:!0,configurable:!0,value(...De){return ie(h)[M].apply(this,De)}}),tt.mergeStoreMethodFrom(o,h,M));let V=it(o,M);const ce=l($,M,V)||V;ce&&Object.defineProperty($,M,ce)})}function wn(o,l){return[o,l,it(o,l)]}function dr(o){return Array.isArray(o)}function Tt(o){return o===Array||dr(o)}function Dt(o){return o&&Me(o)&&!o.prototype}function Sn(o){return o&&"isBuffer"in o&&typeof o.isBuffer=="function"?!0:Mn(o)}function Mn(o){return!!(o&&(o===Uint8Array||o instanceof Uint8Array))}function yr(o){return o===Object}function En(o){return yr(pe(o))&&o!==Object}function gr(o){return!o||Dt(o)?!1:!(Y(o)||pn(o)||yr(o)||Re(o)||Jr(o)||Tt(o)||Sn(o))}function bs(o){return gr(o)?pe(o):o}function jt(o){return`${(qr(o).toString().split(`
15
- `).find(l=>l.indexOf("constructor(")>-1)||"constructor()").replace("{","").trim()}`}function Vt(o){return jt(o).split("constructor(")[1].split(")")[0].split(", ").filter(Boolean).map(l=>l.trim())}function Yt(){return`e${Math.random().toString(36).substring(7)}`}const Pn=o=>{const[l,h,M,$="."]=o;return fr(h)||ye(l)?{expression:l,scope:h,defaultValue:M,separator:$}:{expression:h,scope:l,defaultValue:M,separator:$}};function Tn(...o){const l=Pn(o);let h=l.scope;const{expression:M,defaultValue:$,separator:V}=l;if(!M)return h;if(!h)return $;const ce=M.split(V),De=Ne=>{if(h){if(h[Ne]!==void 0||fr(h)&&Ne in h)return h[Ne];if(Me(h.get))return h.get(Ne)}};for(;(h=De(ce.shift()))&&ce.length;);return h===void 0?$:h}function Xt(o){return o&&typeof o.toJSON=="function"}function ws(o,l){let h="0.0.0.0",M=l;return typeof l=="string"&&l.indexOf(":")>-1&&([h,M]=l.split(":"),M=+M),{protocol:o,address:h,port:M,toString(){return[`${this.protocol}://${this.address}`,typeof this.port=="number"&&this.port].filter(Boolean).join(":")}}}function Or(o,l){for(const h of Rt(o)){const M=Object.getOwnPropertyDescriptor(h&&h.prototype||h,l);if(M)return M}}function _n(o){return Tt(o)||o===Map||o instanceof Map||o===Set||o instanceof Set||o===WeakMap||o instanceof WeakMap||o===WeakSet||o instanceof WeakSet}function xn(o){return o===""||Xe(o)}function An(o,l){const h=pe(o);if(h){const M=Or(h,l);if(M)return M.enumerable}return Object.prototype.propertyIsEnumerable.call(o,l)}function $n(o,l,h=5){if(!o||!l)return!1;for(o=pe(o),l=pe(l);gt(o)!=="";){if(!h)return!1;if(o===l)return!0;o=zt(o),h--}return!1}function Rn(o){return!!(o&&o!=null&&o._isAMomentObject)}function Lr(o){return o&&o._bsontype}function vr(o){return!!(Xt(o)&&o.$isMongooseModelPrototype||Lr(o))}function Dn(o){return!(Buffer.isBuffer(o)||hr(o)||Ze(o)||lt(o)||ye(o)||Xe(o))}function jn(o){return _r(o)?"string":dt(o)?"number":st(o)?"boolean":"any"}function Cn(o,l,h,M="."){const $=l.split(M),V=(ce,De)=>Mt(ce)?!1:De?(typeof o.set=="function"?o.set(ce,h):o[ce]=h,!1):(typeof o.set=="function"?(o.has(ce)||o.set(ce,{}),o=o.get(ce)):o=o[ce]=o[ce]||{},!0);for(;V($.shift(),!$.length););}function Kr(o){return o?ye(o)?l=>l[o]:o:(l,h)=>String(h)}function kn(o,l){if(dr(o)){const M=Kr(l||"id");return o.reduce(($,V,ce)=>([].concat(M(V,ce)).forEach(De=>{var Ne;const ot=$.get(De);V=((Ne=ot==null?void 0:ot.merge)==null?void 0:Ne.call(ot,V))||V,$.set(De,V)}),$),new Map)}const h=Kr(l);return Object.entries(o).reduce((M,[$,V])=>M.set(h(V,$),V),new Map)}function Fr(o){return Array.from(new Set(o).values())}function In(o,l="id"){const h=new Map;return o.forEach(M=>{h.set(M[l],M)}),Array.from(h.values())}function Wr(...o){return(...l)=>{const h=typeof l[2]=="object";if(o.filter(M=>!!M).forEach(M=>{const $=M(...l);h&&typeof $=="object"&&(l[2]=$)}),h)return l[2]}}function Nn(o){return(l,h)=>o(l,h,it(l,h))}function br(...o){return(l,h)=>{o.filter(Boolean).forEach(M=>M(l,h,it(l,h)))}}n.AnyToPromise=mr,n.AnyToPromiseResponseTypes=Ut,n.AnyToPromiseStatus=Br,n.CLASS_STORE=mn,n.DecoratorTypes=me,n.Env=Nr,n.EnvTypes=gs,n.METHOD_STORE=We,n.Metadata=et,n.PARAM_STORE=ur,n.PROPERTY_STORE=dn,n.Store=tt,n.StoreFn=Wt,n.StoreMerge=yn,n.StoreSet=gn,n.Type=rt,n.UnsupportedDecoratorType=pr,n.ancestorOf=zt,n.ancestorsOf=Rt,n.catchAsyncError=Os,n.catchError=Gr,n.classOf=pe,n.cleanObject=vs,n.constructorOf=qr,n.createInstance=or,n.decorateMethodsOf=Ht,n.decoratorArgs=wn,n.decoratorTypeOf=_e,n.deepClone=ut,n.deepMerge=ft,n.descriptorOf=it,n.getClass=$e,n.getClassOrSymbol=bs,n.getConstructor=vn,n.getConstructorArgNames=Vt,n.getHostInfoFromPort=ws,n.getInheritedClass=lr,n.getRandomId=Yt,n.getValue=Tn,n.hasJsonMethod=Xt,n.inheritedDescriptorOf=Or,n.isArray=dr,n.isArrayOrArrayClass=Tt,n.isArrowFn=Dt,n.isBoolean=Ze,n.isBooleanOrBooleanClass=st,n.isBuffer=Sn,n.isClass=gr,n.isClassObject=yr,n.isCollection=_n,n.isDate=Re,n.isEmpty=xn,n.isEnumerable=An,n.isFunction=Me,n.isInheritedFrom=$n,n.isMethodDescriptor=ys,n.isMomentObject=Rn,n.isMongooseObject=vr,n.isNil=Xe,n.isNumber=lt,n.isNumberOrNumberClass=dt,n.isObject=fr,n.isObjectID=Lr,n.isObservable=On,n.isPlainObject=En,n.isPrimitive=yt,n.isPrimitiveClass=Q,n.isPrimitiveOrPrimitiveClass=pn,n.isPromise=Jr,n.isProtectedKey=Mt,n.isRegExp=xr,n.isSerializable=Dn,n.isStream=hr,n.isString=ye,n.isStringOrStringClass=_r,n.isSymbol=Y,n.isSymbolOrSymbolClass=Ar,n.isUint8Array=Mn,n.mergeReducerBuilder=Rr,n.methodsOf=bn,n.nameOf=gt,n.nameOfClass=Dr,n.nameOfSymbol=hn,n.objectKeys=$r,n.primitiveOf=jn,n.prototypeOf=ie,n.setValue=Cn,n.toMap=kn,n.toStringConstructor=jt,n.uniq=Fr,n.uniqBy=In,n.useDecorators=Wr,n.useMethodDecorator=Nn,n.useMethodDecorators=br,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})})}(core_umd$1,core_umd$1.exports)),core_umd$1.exports}var core_umdExports=requireCore_umd();const JsonMapperTypesContainer=new Map;function registerJsonTypeMapper(P,c){JsonMapperTypesContainer.set(P,new c)}function getJsonMapperTypes(){return JsonMapperTypesContainer}function JsonMapper(...P){return c=>{P.forEach(n=>{registerJsonTypeMapper(n,c)})}}var __getOwnPropDesc$2=Object.getOwnPropertyDescriptor,__decorateClass$2=(P,c,n,O)=>{for(var S=O>1?void 0:O?__getOwnPropDesc$2(c,n):c,N=P.length-1,F;N>=0;N--)(F=P[N])&&(S=F(S)||S);return S};exports.DateMapper=class{deserialize(c){return core_umdExports.isBoolean(c)||c===null||c===void 0?c:new Date(c)}serialize(c){return c&&new Date(c).toISOString()}},exports.DateMapper=__decorateClass$2([JsonMapper(Date)],exports.DateMapper);var __getOwnPropDesc$1=Object.getOwnPropertyDescriptor,__decorateClass$1=(P,c,n,O)=>{for(var S=O>1?void 0:O?__getOwnPropDesc$1(c,n):c,N=P.length-1,F;N>=0;N--)(F=P[N])&&(S=F(S)||S);return S};function isNullish(P){return[null,"null"].includes(P)}class CastError extends Error{constructor(c){super(`Cast error. ${c}`),this.name="CAST_ERROR"}}exports.PrimitiveMapper=class{deserialize(c,n){return this[core_umdExports.nameOf(n.type)]?this[core_umdExports.nameOf(n.type)](c,n):void 0}serialize(c,n){return this[core_umdExports.nameOf(n==null?void 0:n.type)]&&typeof c!="object"?this[core_umdExports.nameOf(n.type)](c,n):c}String(c){return c===null?null:""+c}Boolean(c){if(["true","1",!0].includes(c))return!0;if(["false","0",!1].includes(c))return!1;if(isNullish(c))return null;if(c!==void 0)return!!c}Number(c){if(isNullish(c))return null;if(c===void 0)return c;const n=+c;if(isNaN(n))throw new CastError("Expression value is not a number.");return n}BigInt(c){return isNullish(c)?null:BigInt(c)}},exports.PrimitiveMapper=__decorateClass$1([JsonMapper(String,Number,Boolean,BigInt)],exports.PrimitiveMapper);var __getOwnPropDesc=Object.getOwnPropertyDescriptor,__decorateClass=(P,c,n,O)=>{for(var S=O>1?void 0:O?__getOwnPropDesc(c,n):c,N=P.length-1,F;N>=0;N--)(F=P[N])&&(S=F(S)||S);return S};exports.SymbolMapper=class{deserialize(c){return Symbol.for(c)}serialize(c){return c.toString().replace("Symbol(","").replace(")","")}},exports.SymbolMapper=__decorateClass([JsonMapper(Symbol)],exports.SymbolMapper);var schema_umd$1={exports:{}},schema_umd=schema_umd$1.exports,hasRequiredSchema_umd;function requireSchema_umd(){return hasRequiredSchema_umd||(hasRequiredSchema_umd=1,function(P,c){(function(n,O){O(c,require$$0,require$$1,require$$2)})(schema_umd,function(n,O,S,N){var F=t=>{throw TypeError(t)},B=(t,e,r)=>e.has(t)||F("Cannot "+r),A=(t,e,r)=>(B(t,e,"read from private field"),r?r.call(t):e.get(t)),ne=(t,e,r)=>e.has(t)?F("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),G=(t,e,r,s)=>(B(t,e,"write to private field"),e.set(t,r),r),ae,me,$e,pe,_e,Re,Me,Xe,Ze,st,lt,dt,ye=(t=>(t.ALL="ALL",t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH",t.HEAD="HEAD",t.DELETE="DELETE",t.OPTIONS="OPTIONS",t.TRACE="TRACE",t.PUBLISH="PUBLISH",t.SUBSCRIBE="SUBSCRIBE",t.CUSTOM="CUSTOM",t))(ye||{});const _r=["ALL","GET","POST","PUT","PATCH","HEAD","DELETE","OPTIONS","TRACE","CUSTOM"],pn=["PUBLISH","SUBSCRIBE"],yt=new Map;function Q(t,e,r){return yt.set(r?`${r}:${t}`:t,e)}function xr(t,e){const r=yt.get(`${e==null?void 0:e.specType}:${t}`)||yt.get(t);if(r)return r;throw new Error(`JsonSchema ${t} mapper doesn't exists`)}function Y(t,e,r,s){return xr(t,r)(...e,r,s)}function Ar(t){return yt.has(t)}function ln(t,e){return t.find(r=>yt.has(`${e==null?void 0:e.specType}:${r}`))||t.find(r=>yt.has(r))}function ut(t){return t.split("/").filter(Boolean).join("/")}var or=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof commonjsGlobal<"u"?commonjsGlobal:typeof self<"u"?self:{},Mt={exports:{}},$r=Mt.exports,Rr;function fn(){return Rr||(Rr=1,function(t,e){(function(r,s){s(e)})($r,function(r){var s=i=>{throw TypeError(i)},a=(i,f,d)=>f.has(i)||s("Cannot "+d),u=(i,f,d)=>(a(i,f,"read from private field"),d?d.call(i):f.get(i)),m=(i,f,d)=>f.has(i)?s("Cannot add the same private member more than once"):f instanceof WeakSet?f.add(i):f.set(i,d),w=(i,f,d,_)=>(a(i,f,"write to private field"),f.set(i,d),d),x,D,I,ee,Ee=(i=>(i.PARAM="parameter",i.PARAM_CTOR="parameter.constructor",i.PARAM_STC="parameter.static",i.PROP="property",i.PROP_STC="property.static",i.METHOD="method",i.METHOD_STC="method.static",i.CLASS="class",i))(Ee||{});function Ye(i){return i.prototype?i:i.constructor}function ve(i){return Ye(i)}function vt(i){const[f,d,_]=i,R=Z=>f!==ve(f)?Z:`${Z}.static`;return typeof _=="number"?d?R("parameter"):"parameter.constructor":_&&_.value?R("method"):d&&_===void 0||_?R("property"):Ee.CLASS}function At(i){return i===Date||i instanceof Date&&!isNaN(+i)}function Nt(i){return typeof i=="function"}function Ie(i){return i==null}function fe(i){return typeof i=="boolean"||i instanceof Boolean||i===Boolean}function ue(i){return typeof i=="boolean"||i instanceof Boolean||i===Boolean}function Te(i){return typeof i=="number"}function be(i){return typeof i=="number"||i instanceof Number||i===Number}function we(i){return typeof i=="string"}function ct(i){return typeof i=="string"||i instanceof String||i===String}function us(i){return ct(i)||be(i)||ue(i)}function Hs(i){return we(i)||Te(i)||fe(i)}function Mc(i){return[String,Number,Boolean].includes(i)}function Li(i){return i instanceof RegExp}function Er(i){return typeof i=="symbol"}function Ec(i){return typeof i=="symbol"||i instanceof Symbol||i===Symbol}const Pc=i=>Ie(i)||Hs(i)||Er(i)||Nt(i),Jt=(i,f=new WeakMap)=>{if(Pc(i))return i;const d=f.get(i);if(d)return d;if(ArrayBuffer.isView(i))return Buffer.isBuffer(i)?Buffer.from(i):new(ve(i))(i.buffer.slice(0),i.byteOffset,i.byteLength);if(At(i))return new Date(i);if(Li(i))return new RegExp(i);if(Array.isArray(i)){const R=[];return f.set(i,R),i.forEach((Z,ge)=>R[ge]=Jt(Z,f)),R}if(i instanceof Map){const R=new Map;return f.set(i,R),i.forEach((Z,ge)=>R.set(Jt(ge,f),Jt(Z,f))),R}if(i instanceof Set){const R=new Set;return f.set(i,R),i.forEach(Z=>R.add(Jt(Z,f))),R}const _=Object.create(Reflect.getPrototypeOf(i));return f.set(i,_),Reflect.ownKeys(i).forEach(R=>{const Z=Object.getOwnPropertyDescriptor(i,R);Z&&(Nt(Z.value)?Object.defineProperty(_,R,Z):Object.defineProperty(_,R,{...Z,value:Jt(Z.value,f)}))}),_};function Ki(i){return i?ve(i)!==Object?Object.create(i):{}:{}}function ps(i){return["__proto__","constructor","prototype"].includes(i)}function Vs(i){return Object.keys(i).filter(f=>!ps(f))}function Fi(i){return(f,d,_)=>{const R=f.findIndex(Z=>i(Z,d));return R===-1?[...f,d]:(f[R]=nn(f[R],d,_),f)}}const Wi=Fi((i,f)=>i===f);function Tc({reducers:i,parentKey:f}){return i?f&&i[f]?i[f]:i.default||Wi:Wi}function _c(i,f){return Hs(i)||Er(i)||Nt(i)||f===void 0}function xc(i,f){return i==null||i===""&&f!==""}function nn(i,f,d={}){if(xc(f,i))return i;if(_c(f,i))return f;if(Array.isArray(i)){const R=Tc(d);return[].concat(f).reduce((Z,ge)=>R(Z,ge,d),[...i])}const _=Ki(i);return[...Vs(i),...Vs(f)].reduce((R,Z)=>{var ge;const Be=i&&i[Z],ze=nn(Be,f&&f[Z],{...d,parentKey:Z});return d.cleanUndefinedProps&&ze===void 0||(R[Z]=((ge=d.alter)==null?void 0:ge.call(d,Z,ze))??ze),R},_)}function Bt(i,f){return Reflect.getOwnPropertyDescriptor(i&&i.prototype||i,f)}function Ac(i,f){var d;return(d=Bt(i,f))==null?void 0:d.value}function zi(i){return typeof i=="function"?i.name:i.constructor.name}const Ui=i=>i.toString().replace("Symbol(","").replace(")","");function Gt(i){switch(typeof i){default:return""+i;case"symbol":return Ui(i);case"function":return zi(i)}}var Hi=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof or<"u"?or:typeof self<"u"?self:{},Vi={};/*! *****************************************************************************
16
- Copyright (C) Microsoft. All rights reserved.
17
- Licensed under the Apache License, Version 2.0 (the "License"); you may not use
18
- this file except in compliance with the License. You may obtain a copy of the
19
- License at http://www.apache.org/licenses/LICENSE-2.0
20
-
21
- THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
22
- KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
23
- WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
24
- MERCHANTABLITY OR NON-INFRINGEMENT.
25
-
26
- See the Apache Version 2.0 License for specific language governing permissions
27
- and limitations under the License.
28
- ***************************************************************************** */var Yi;function $c(){if(Yi)return Vi;Yi=1;var i;return function(f){(function(d){var _=typeof globalThis=="object"?globalThis:typeof Hi=="object"?Hi:typeof self=="object"?self:typeof this=="object"?this:ze(),R=Z(f);typeof _.Reflect<"u"&&(R=Z(_.Reflect,R)),d(R,_),typeof _.Reflect>"u"&&(_.Reflect=f);function Z(wt,ir){return function(qt,an){Object.defineProperty(wt,qt,{configurable:!0,writable:!0,value:an}),ir&&ir(qt,an)}}function ge(){try{return Function("return this;")()}catch{}}function Be(){try{return(0,eval)("(function() { return this; })()")}catch{}}function ze(){return ge()||Be()}})(function(d,_){var R=Object.prototype.hasOwnProperty,Z=typeof Symbol=="function",ge=Z&&typeof Symbol.toPrimitive<"u"?Symbol.toPrimitive:"@@toPrimitive",Be=Z&&typeof Symbol.iterator<"u"?Symbol.iterator:"@@iterator",ze=typeof Object.create=="function",wt={__proto__:[]}instanceof Array,ir=!ze&&!wt,qt={create:ze?function(){return fi(Object.create(null))}:wt?function(){return fi({__proto__:null})}:function(){return fi({})},has:ir?function(g,b){return R.call(g,b)}:function(g,b){return b in g},get:ir?function(g,b){return R.call(g,b)?g[b]:void 0}:function(g,b){return g[b]}},an=Object.getPrototypeOf(Function),cn=typeof Map=="function"&&typeof Map.prototype.entries=="function"?Map:$u(),ai=typeof Set=="function"&&typeof Set.prototype.entries=="function"?Set:Ru(),ci=typeof WeakMap=="function"?WeakMap:Du(),Pr=Z?Symbol.for("@reflect-metadata:registry"):void 0,ms=_u(),Eo=xu(ms);function uu(g,b,T,C){if(se(T)){if(!jo(g))throw new TypeError;if(!Co(b))throw new TypeError;return vu(g,b)}else{if(!jo(g))throw new TypeError;if(!Ke(b))throw new TypeError;if(!Ke(C)&&!se(C)&&!Tr(C))throw new TypeError;return Tr(C)&&(C=void 0),T=St(T),bu(g,b,T,C)}}d("decorate",uu);function pu(g,b){function T(C,te){if(!Ke(C))throw new TypeError;if(!se(te)&&!Pu(te))throw new TypeError;xo(g,b,C,te)}return T}d("metadata",pu);function lu(g,b,T,C){if(!Ke(T))throw new TypeError;return se(C)||(C=St(C)),xo(g,b,T,C)}d("defineMetadata",lu);function fu(g,b,T){if(!Ke(b))throw new TypeError;return se(T)||(T=St(T)),Po(g,b,T)}d("hasMetadata",fu);function hu(g,b,T){if(!Ke(b))throw new TypeError;return se(T)||(T=St(T)),ui(g,b,T)}d("hasOwnMetadata",hu);function mu(g,b,T){if(!Ke(b))throw new TypeError;return se(T)||(T=St(T)),To(g,b,T)}d("getMetadata",mu);function du(g,b,T){if(!Ke(b))throw new TypeError;return se(T)||(T=St(T)),_o(g,b,T)}d("getOwnMetadata",du);function yu(g,b){if(!Ke(g))throw new TypeError;return se(b)||(b=St(b)),Ao(g,b)}d("getMetadataKeys",yu);function gu(g,b){if(!Ke(g))throw new TypeError;return se(b)||(b=St(b)),$o(g,b)}d("getOwnMetadataKeys",gu);function Ou(g,b,T){if(!Ke(b))throw new TypeError;if(se(T)||(T=St(T)),!Ke(b))throw new TypeError;se(T)||(T=St(T));var C=un(b,T,!1);return se(C)?!1:C.OrdinaryDeleteMetadata(g,b,T)}d("deleteMetadata",Ou);function vu(g,b){for(var T=g.length-1;T>=0;--T){var C=g[T],te=C(b);if(!se(te)&&!Tr(te)){if(!Co(te))throw new TypeError;b=te}}return b}function bu(g,b,T,C){for(var te=g.length-1;te>=0;--te){var Ue=g[te],Fe=Ue(b,T,C);if(!se(Fe)&&!Tr(Fe)){if(!Ke(Fe))throw new TypeError;C=Fe}}return C}function Po(g,b,T){var C=ui(g,b,T);if(C)return!0;var te=li(b);return Tr(te)?!1:Po(g,te,T)}function ui(g,b,T){var C=un(b,T,!1);return se(C)?!1:Do(C.OrdinaryHasOwnMetadata(g,b,T))}function To(g,b,T){var C=ui(g,b,T);if(C)return _o(g,b,T);var te=li(b);if(!Tr(te))return To(g,te,T)}function _o(g,b,T){var C=un(b,T,!1);if(!se(C))return C.OrdinaryGetOwnMetadata(g,b,T)}function xo(g,b,T,C){var te=un(T,C,!0);te.OrdinaryDefineOwnMetadata(g,b,T,C)}function Ao(g,b){var T=$o(g,b),C=li(g);if(C===null)return T;var te=Ao(C,b);if(te.length<=0)return T;if(T.length<=0)return te;for(var Ue=new ai,Fe=[],he=0,J=T;he<J.length;he++){var L=J[he],W=Ue.has(L);W||(Ue.add(L),Fe.push(L))}for(var H=0,de=te;H<de.length;H++){var L=de[H],W=Ue.has(L);W||(Ue.add(L),Fe.push(L))}return Fe}function $o(g,b){var T=un(g,b,!1);return T?T.OrdinaryOwnMetadataKeys(g,b):[]}function Ro(g){if(g===null)return 1;switch(typeof g){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return g===null?1:6;default:return 6}}function se(g){return g===void 0}function Tr(g){return g===null}function wu(g){return typeof g=="symbol"}function Ke(g){return typeof g=="object"?g!==null:typeof g=="function"}function Su(g,b){switch(Ro(g)){case 0:return g;case 1:return g;case 2:return g;case 3:return g;case 4:return g;case 5:return g}var T="string",C=ko(g,ge);if(C!==void 0){var te=C.call(g,T);if(Ke(te))throw new TypeError;return te}return Mu(g)}function Mu(g,b){var T,C;{var te=g.toString;if(ds(te)){var C=te.call(g);if(!Ke(C))return C}var T=g.valueOf;if(ds(T)){var C=T.call(g);if(!Ke(C))return C}}throw new TypeError}function Do(g){return!!g}function Eu(g){return""+g}function St(g){var b=Su(g);return wu(b)?b:Eu(b)}function jo(g){return Array.isArray?Array.isArray(g):g instanceof Object?g instanceof Array:Object.prototype.toString.call(g)==="[object Array]"}function ds(g){return typeof g=="function"}function Co(g){return typeof g=="function"}function Pu(g){switch(Ro(g)){case 3:return!0;case 4:return!0;default:return!1}}function pi(g,b){return g===b||g!==g&&b!==b}function ko(g,b){var T=g[b];if(T!=null){if(!ds(T))throw new TypeError;return T}}function Io(g){var b=ko(g,Be);if(!ds(b))throw new TypeError;var T=b.call(g);if(!Ke(T))throw new TypeError;return T}function No(g){return g.value}function Jo(g){var b=g.next();return b.done?!1:b}function Bo(g){var b=g.return;b&&b.call(g)}function li(g){var b=Object.getPrototypeOf(g);if(typeof g!="function"||g===an||b!==an)return b;var T=g.prototype,C=T&&Object.getPrototypeOf(T);if(C==null||C===Object.prototype)return b;var te=C.constructor;return typeof te!="function"||te===g?b:te}function Tu(){var g;!se(Pr)&&typeof _.Reflect<"u"&&!(Pr in _.Reflect)&&typeof _.Reflect.defineMetadata=="function"&&(g=Au(_.Reflect));var b,T,C,te=new ci,Ue={registerProvider:Fe,getProvider:J,setProvider:W};return Ue;function Fe(H){if(!Object.isExtensible(Ue))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case g===H:break;case se(b):b=H;break;case b===H:break;case se(T):T=H;break;case T===H:break;default:C===void 0&&(C=new ai),C.add(H);break}}function he(H,de){if(!se(b)){if(b.isProviderFor(H,de))return b;if(!se(T)){if(T.isProviderFor(H,de))return b;if(!se(C))for(var Ae=Io(C);;){var Ge=Jo(Ae);if(!Ge)return;var mt=No(Ge);if(mt.isProviderFor(H,de))return Bo(Ae),mt}}}if(!se(g)&&g.isProviderFor(H,de))return g}function J(H,de){var Ae=te.get(H),Ge;return se(Ae)||(Ge=Ae.get(de)),se(Ge)&&(Ge=he(H,de),se(Ge)||(se(Ae)&&(Ae=new cn,te.set(H,Ae)),Ae.set(de,Ge))),Ge}function L(H){if(se(H))throw new TypeError;return b===H||T===H||!se(C)&&C.has(H)}function W(H,de,Ae){if(!L(Ae))throw new Error("Metadata provider not registered.");var Ge=J(H,de);if(Ge!==Ae){if(!se(Ge))return!1;var mt=te.get(H);se(mt)&&(mt=new cn,te.set(H,mt)),mt.set(de,Ae)}return!0}}function _u(){var g;return!se(Pr)&&Ke(_.Reflect)&&Object.isExtensible(_.Reflect)&&(g=_.Reflect[Pr]),se(g)&&(g=Tu()),!se(Pr)&&Ke(_.Reflect)&&Object.isExtensible(_.Reflect)&&Object.defineProperty(_.Reflect,Pr,{enumerable:!1,configurable:!1,writable:!1,value:g}),g}function xu(g){var b=new ci,T={isProviderFor:function(L,W){var H=b.get(L);return se(H)?!1:H.has(W)},OrdinaryDefineOwnMetadata:Fe,OrdinaryHasOwnMetadata:te,OrdinaryGetOwnMetadata:Ue,OrdinaryOwnMetadataKeys:he,OrdinaryDeleteMetadata:J};return ms.registerProvider(T),T;function C(L,W,H){var de=b.get(L),Ae=!1;if(se(de)){if(!H)return;de=new cn,b.set(L,de),Ae=!0}var Ge=de.get(W);if(se(Ge)){if(!H)return;if(Ge=new cn,de.set(W,Ge),!g.setProvider(L,W,T))throw de.delete(W),Ae&&b.delete(L),new Error("Wrong provider for target.")}return Ge}function te(L,W,H){var de=C(W,H,!1);return se(de)?!1:Do(de.has(L))}function Ue(L,W,H){var de=C(W,H,!1);if(!se(de))return de.get(L)}function Fe(L,W,H,de){var Ae=C(H,de,!0);Ae.set(L,W)}function he(L,W){var H=[],de=C(L,W,!1);if(se(de))return H;for(var Ae=de.keys(),Ge=Io(Ae),mt=0;;){var Go=Jo(Ge);if(!Go)return H.length=mt,H;var ju=No(Go);try{H[mt]=ju}catch(Cu){try{Bo(Ge)}finally{throw Cu}}mt++}}function J(L,W,H){var de=C(W,H,!1);if(se(de)||!de.delete(L))return!1;if(de.size===0){var Ae=b.get(W);se(Ae)||(Ae.delete(H),Ae.size===0&&b.delete(Ae))}return!0}}function Au(g){var b=g.defineMetadata,T=g.hasOwnMetadata,C=g.getOwnMetadata,te=g.getOwnMetadataKeys,Ue=g.deleteMetadata,Fe=new ci,he={isProviderFor:function(J,L){var W=Fe.get(J);return!se(W)&&W.has(L)?!0:te(J,L).length?(se(W)&&(W=new ai,Fe.set(J,W)),W.add(L),!0):!1},OrdinaryDefineOwnMetadata:b,OrdinaryHasOwnMetadata:T,OrdinaryGetOwnMetadata:C,OrdinaryOwnMetadataKeys:te,OrdinaryDeleteMetadata:Ue};return he}function un(g,b,T){var C=ms.getProvider(g,b);if(!se(C))return C;if(T){if(ms.setProvider(g,b,Eo))return Eo;throw new Error("Illegal state.")}}function $u(){var g={},b=[],T=function(){function he(J,L,W){this._index=0,this._keys=J,this._values=L,this._selector=W}return he.prototype["@@iterator"]=function(){return this},he.prototype[Be]=function(){return this},he.prototype.next=function(){var J=this._index;if(J>=0&&J<this._keys.length){var L=this._selector(this._keys[J],this._values[J]);return J+1>=this._keys.length?(this._index=-1,this._keys=b,this._values=b):this._index++,{value:L,done:!1}}return{value:void 0,done:!0}},he.prototype.throw=function(J){throw this._index>=0&&(this._index=-1,this._keys=b,this._values=b),J},he.prototype.return=function(J){return this._index>=0&&(this._index=-1,this._keys=b,this._values=b),{value:J,done:!0}},he}(),C=function(){function he(){this._keys=[],this._values=[],this._cacheKey=g,this._cacheIndex=-2}return Object.defineProperty(he.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),he.prototype.has=function(J){return this._find(J,!1)>=0},he.prototype.get=function(J){var L=this._find(J,!1);return L>=0?this._values[L]:void 0},he.prototype.set=function(J,L){var W=this._find(J,!0);return this._values[W]=L,this},he.prototype.delete=function(J){var L=this._find(J,!1);if(L>=0){for(var W=this._keys.length,H=L+1;H<W;H++)this._keys[H-1]=this._keys[H],this._values[H-1]=this._values[H];return this._keys.length--,this._values.length--,pi(J,this._cacheKey)&&(this._cacheKey=g,this._cacheIndex=-2),!0}return!1},he.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=g,this._cacheIndex=-2},he.prototype.keys=function(){return new T(this._keys,this._values,te)},he.prototype.values=function(){return new T(this._keys,this._values,Ue)},he.prototype.entries=function(){return new T(this._keys,this._values,Fe)},he.prototype["@@iterator"]=function(){return this.entries()},he.prototype[Be]=function(){return this.entries()},he.prototype._find=function(J,L){if(!pi(this._cacheKey,J)){this._cacheIndex=-1;for(var W=0;W<this._keys.length;W++)if(pi(this._keys[W],J)){this._cacheIndex=W;break}}return this._cacheIndex<0&&L&&(this._cacheIndex=this._keys.length,this._keys.push(J),this._values.push(void 0)),this._cacheIndex},he}();return C;function te(he,J){return he}function Ue(he,J){return J}function Fe(he,J){return[he,J]}}function Ru(){var g=function(){function b(){this._map=new cn}return Object.defineProperty(b.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),b.prototype.has=function(T){return this._map.has(T)},b.prototype.add=function(T){return this._map.set(T,T),this},b.prototype.delete=function(T){return this._map.delete(T)},b.prototype.clear=function(){this._map.clear()},b.prototype.keys=function(){return this._map.keys()},b.prototype.values=function(){return this._map.keys()},b.prototype.entries=function(){return this._map.entries()},b.prototype["@@iterator"]=function(){return this.keys()},b.prototype[Be]=function(){return this.keys()},b}();return g}function Du(){var g=16,b=qt.create(),T=C();return function(){function J(){this._key=C()}return J.prototype.has=function(L){var W=te(L,!1);return W!==void 0?qt.has(W,this._key):!1},J.prototype.get=function(L){var W=te(L,!1);return W!==void 0?qt.get(W,this._key):void 0},J.prototype.set=function(L,W){var H=te(L,!0);return H[this._key]=W,this},J.prototype.delete=function(L){var W=te(L,!1);return W!==void 0?delete W[this._key]:!1},J.prototype.clear=function(){this._key=C()},J}();function C(){var J;do J="@@WeakMap@@"+he();while(qt.has(b,J));return b[J]=!0,J}function te(J,L){if(!R.call(J,T)){if(!L)return;Object.defineProperty(J,T,{value:qt.create()})}return J[T]}function Ue(J,L){for(var W=0;W<L;++W)J[W]=Math.random()*255|0;return J}function Fe(J){if(typeof Uint8Array=="function"){var L=new Uint8Array(J);return typeof crypto<"u"?crypto.getRandomValues(L):typeof msCrypto<"u"?msCrypto.getRandomValues(L):Ue(L,J),L}return Ue(new Array(J),J)}function he(){var J=Fe(g);J[6]=J[6]&79|64,J[8]=J[8]&191|128;for(var L="",W=0;W<g;++W){var H=J[W];(W===4||W===6||W===8)&&(L+="-"),H<16&&(L+="0"),L+=H.toString(16).toLowerCase()}return L}}function fi(g){return g.__=void 0,delete g.__,g}})}(i||(i={})),Vi}$c();const Ys="design:paramtypes",Xi="design:type",Zi="design:returntype",sn=new Map,Qi=class{static get(i,f,d){return Reflect.getMetadata(i,ve(f),d)}static getOwn(i,f,d){return Reflect.getOwnMetadata(i,ve(f),d)}static getType(i,f){return Reflect.getMetadata(Xi,i,f)}static getOwnType(i,f){return Reflect.getMetadata(Xi,i,f)}static getReturnType(i,f){return Reflect.getMetadata(Zi,i,f)}static getOwnReturnType(i,f){return Reflect.getOwnMetadata(Zi,i,f)}static has(i,f,d){try{return Reflect.hasMetadata(i,ve(f),d)}catch{}return!1}static hasOwn(i,f,d){return Reflect.hasOwnMetadata(i,ve(f),d)}static delete(i,f,d){return Reflect.deleteMetadata(i,ve(f),d)}static setParamTypes(i,f,d){return this.set(Ys,d,i.prototype,f)}static set(i,f,d,_){const R=sn.has(i)?sn.get(i)||[]:[],Z=ve(d);R.indexOf(Z)===-1&&(R.push(Z),sn.set(i,R)),Reflect.defineMetadata(i,f,ve(d),_)}static getParamTypes(i,f){return Reflect.getMetadata(Ys,i,f)||[]}static getOwnParamTypes(i,f){return Reflect.getOwnMetadata(Ys,i,f)||[]}};Qi.getTargetsFromPropertyKey=i=>sn.has(i)?sn.get(i)||[]:[];let eo=Qi;const to="tsed:class:store",ro="tsed:method:store",no="tsed:property:store",so="tsed:param:store",Xs=new Map;function ls(i,...f){if(Er(f[0]))return Xs.has(f[0])||Xs.set(f[0],new bt),Xs.get(f[0]);{const d=eo;return d.hasOwn(i,...f)||d.set(i,new bt,...f),d.getOwn(i,...f)}}function Rc(i){const[f,d,_]=i;switch(vt(i)){case Ee.PARAM_CTOR:case Ee.PARAM_STC:case Ee.PARAM:const R=ls(so,f,d);return R.has(""+_)||R.set(""+_,new bt),R.get(""+_);case Ee.PROP:case Ee.PROP_STC:return ls(no,f,d);case Ee.METHOD:case Ee.METHOD_STC:return ls(ro,f,d);case Ee.CLASS:return ls(to,f)}}class bt{constructor(){this._entries=new Map}static from(...f){return Rc(f)}static fromMethod(f,d){return bt.from(f,d,Bt(f,d))}static mergeStoreFrom(f,d,..._){const R=bt.from(f,..._);return bt.from(d,..._)._entries.forEach((Z,ge)=>{R.merge(ge,Z)}),R}static mergeStoreMethodFrom(f,d,_){return this.mergeStoreFrom(f,d,_,Bt(f,_))}get(f,d){return this._entries.get(Gt(f))||d}has(f){return this._entries.has(Gt(f))}set(f,d){return this._entries.set(Gt(f),d),this}delete(f){return this._entries.delete(Gt(f))}merge(f,d,_=!1){let R=this.get(f);return R&&(d=Jt(d),R=Jt(R),d=_?nn(d,R):nn(R,d)),this.set(f,d),this}toJson(){return[...this._entries.entries()].reduce((f,[d,_])=>({...f,[d]:_}),{})}}function Zs(i){return(...f)=>{const d=bt.from(...f),_=i(d,f);return typeof _=="function"&&_(...f),f[2]}}function Dc(i,f){return Zs(d=>{d.merge(i,f)})}function jc(i,f){return Zs(d=>{d.set(i,f)})}class Qs extends Error{constructor(f,d){super(Qs.buildMessage(f,d))}static buildMessage(f,d){const[_,R,Z]=d,ge=vt(d),Be=ge.split("/")[0],ze=Be==="parameter"?".["+Z+"]":"",wt=R?"."+R:Be==="parameter"?".constructor":"",ir=Gt(ve(_))+wt+ze;return`${f.name} cannot be used as ${ge} decorator on ${ir}`}}var ei=(i=>(i.PROD="production",i.DEV="development",i.TEST="test",i))(ei||{});const Cc=ei,io=Function;or.Type=io;function ti(i){return i&&Object.getPrototypeOf(i)}function oo(i){return ti(i)}function ri(i){const f=[];let d=ve(i);for(;d&&Gt(d)!=="";)f.unshift(d),d=oo(d);return f}function fs(i){return typeof i=="object"}function ao(i){return!!i&&typeof i.lift=="function"&&typeof i.subscribe=="function"}function ni(i){return i===Promise||i instanceof Promise||!!i&&typeof i.subscribe!="function"&&typeof i.then=="function"}function hs(i){return i!==null&&typeof i=="object"&&typeof i.pipe=="function"}function co(i){return fs(i)&&"data"in i&&"headers"in i&&"status"in i&&"statusText"in i}var uo=(i=>(i.PENDING="PENDING",i.CANCELED="CANCELED",i.RESOLVED="RESOLVED",i.REJECTED="REJECTED",i))(uo||{}),po=(i=>(i.STREAM="STREAM",i.BUFFER="BUFFER",i.DATA="DATA",i))(po||{});class kc{constructor({hasNextFunction:f=!1}={}){m(this,x),m(this,D),m(this,I),m(this,ee),this.status="PENDING",w(this,I,!1),w(this,I,f),w(this,ee,new Promise((d,_)=>{w(this,x,d),w(this,D,_)}))}isDone(){return this.status!=="PENDING"}get next(){return w(this,I,!0),f=>{if(!this.isDone())return f?this.reject(f):this.resolve({type:"DATA"})}}call(f){if(this.isDone())return Promise.resolve(this);try{this.handle(f())}catch(d){this.reject(d)}return u(this,ee)}reject(f){this.isDone()||(this.done("REJECTED"),u(this,D).call(this,f))}resolve(f={}){this.isDone()||(this.done("RESOLVED"),u(this,x).call(this,{...f,state:"RESOLVED"}))}destroy(){}cancel(){if(!this.isDone())return this.done("CANCELED"),u(this,x).call(this,{state:"CANCELED"})}done(f){this.destroy(),this.status=f}handle(f,d={}){if(!this.isDone()){if(f){if(this.isCanceledResponse(f))return this.cancel();if(ao(f)&&(f=f.toPromise()),co(f))return this.handle(f.data,{...d,status:f.status,headers:f.headers});if(hs(f))return this.resolve({...d,type:"STREAM",data:f});if(hs(f)||Buffer.isBuffer(f))return this.resolve({...d,type:"BUFFER",data:f});if(ni(f))return f.then(_=>this.handle(_,d)).catch(_=>_.response&&co(_.response)?this.handle(_.response):this.reject(_))}if(!u(this,I))return this.resolve({...d,data:f,type:"DATA"})}}isCanceledResponse(f){return f==="CANCELED"}}x=new WeakMap,D=new WeakMap,I=new WeakMap,ee=new WeakMap;function Ic(i){try{i()}catch(f){return f}}async function Nc(i){try{await i()}catch(f){return f}}function Jc(i,f=[]){return Object.entries(i).reduce((d,[_,R])=>(ps(_)||f.includes(_)||R===void 0||(d[_]=R),d),{})}function lo(i){return typeof i=="function"?i:i.constructor}function fo(i){return lo(i)}function on(i){return ve(i)===i?i.prototype:i}function ho(i){const f=new Map;return i=ve(i),ri(i).forEach(d=>{Reflect.ownKeys(on(d)).forEach(_=>{var R;Er(_)||_==="constructor"||(R=Object.getOwnPropertyDescriptor(on(d),_))!=null&&R.get||f.set(_,{target:d,propertyKey:_})})}),Array.from(f.values())}function Bc(i,f){ho(i).forEach(({target:d,propertyKey:_})=>{const R=on(i);d!==ve(i)&&(Object.defineProperty(R,_,{writable:!0,configurable:!0,value(...Be){return on(d)[_].apply(this,Be)}}),bt.mergeStoreMethodFrom(i,d,_));let Z=Bt(i,_);const ge=f(R,_,Z)||Z;ge&&Object.defineProperty(R,_,ge)})}function Gc(i,f){return[i,f,Bt(i,f)]}function si(i){return Array.isArray(i)}function ii(i){return i===Array||si(i)}function mo(i){return i&&Nt(i)&&!i.prototype}function yo(i){return i&&"isBuffer"in i&&typeof i.isBuffer=="function"?!0:go(i)}function go(i){return!!(i&&(i===Uint8Array||i instanceof Uint8Array))}function oi(i){return i===Object}function qc(i){return oi(ve(i))&&i!==Object}function Oo(i){return!i||mo(i)?!1:!(Er(i)||us(i)||oi(i)||At(i)||ni(i)||ii(i)||yo(i))}function Lc(i){return Oo(i)?ve(i):i}function vo(i){return`${(fo(i).toString().split(`
29
- `).find(f=>f.indexOf("constructor(")>-1)||"constructor()").replace("{","").trim()}`}function Kc(i){return vo(i).split("constructor(")[1].split(")")[0].split(", ").filter(Boolean).map(f=>f.trim())}function Fc(){return`e${Math.random().toString(36).substring(7)}`}const Wc=i=>{const[f,d,_,R="."]=i;return fs(d)||we(f)?{expression:f,scope:d,defaultValue:_,separator:R}:{expression:d,scope:f,defaultValue:_,separator:R}};function zc(...i){const f=Wc(i);let d=f.scope;const{expression:_,defaultValue:R,separator:Z}=f;if(!_)return d;if(!d)return R;const ge=_.split(Z),Be=ze=>{if(d){if(d[ze]!==void 0||fs(d)&&ze in d)return d[ze];if(Nt(d.get))return d.get(ze)}};for(;(d=Be(ge.shift()))&&ge.length;);return d===void 0?R:d}function bo(i){return i&&typeof i.toJSON=="function"}function Uc(i,f){let d="0.0.0.0",_=f;return typeof f=="string"&&f.indexOf(":")>-1&&([d,_]=f.split(":"),_=+_),{protocol:i,address:d,port:_,toString(){return[`${this.protocol}://${this.address}`,typeof this.port=="number"&&this.port].filter(Boolean).join(":")}}}function wo(i,f){for(const d of ri(i)){const _=Object.getOwnPropertyDescriptor(d&&d.prototype||d,f);if(_)return _}}function Hc(i){return ii(i)||i===Map||i instanceof Map||i===Set||i instanceof Set||i===WeakMap||i instanceof WeakMap||i===WeakSet||i instanceof WeakSet}function Vc(i){return i===""||Ie(i)}function Yc(i,f){const d=ve(i);if(d){const _=wo(d,f);if(_)return _.enumerable}return Object.prototype.propertyIsEnumerable.call(i,f)}function Xc(i,f,d=5){if(!i||!f)return!1;for(i=ve(i),f=ve(f);Gt(i)!=="";){if(!d)return!1;if(i===f)return!0;i=ti(i),d--}return!1}function Zc(i){return!!(i&&i!=null&&i._isAMomentObject)}function So(i){return i&&i._bsontype}function Qc(i){return!!(bo(i)&&i.$isMongooseModelPrototype||So(i))}function eu(i){return!(Buffer.isBuffer(i)||hs(i)||fe(i)||Te(i)||we(i)||Ie(i))}function tu(i){return ct(i)?"string":be(i)?"number":ue(i)?"boolean":"any"}function ru(i,f,d,_="."){const R=f.split(_),Z=(ge,Be)=>ps(ge)?!1:Be?(typeof i.set=="function"?i.set(ge,d):i[ge]=d,!1):(typeof i.set=="function"?(i.has(ge)||i.set(ge,{}),i=i.get(ge)):i=i[ge]=i[ge]||{},!0);for(;Z(R.shift(),!R.length););}function Mo(i){return i?we(i)?f=>f[i]:i:(f,d)=>String(d)}function nu(i,f){if(si(i)){const _=Mo(f||"id");return i.reduce((R,Z,ge)=>([].concat(_(Z,ge)).forEach(Be=>{var ze;const wt=R.get(Be);Z=((ze=wt==null?void 0:wt.merge)==null?void 0:ze.call(wt,Z))||Z,R.set(Be,Z)}),R),new Map)}const d=Mo(f);return Object.entries(i).reduce((_,[R,Z])=>_.set(d(Z,R),Z),new Map)}function su(i){return Array.from(new Set(i).values())}function iu(i,f="id"){const d=new Map;return i.forEach(_=>{d.set(_[f],_)}),Array.from(d.values())}function ou(...i){return(...f)=>{const d=typeof f[2]=="object";if(i.filter(_=>!!_).forEach(_=>{const R=_(...f);d&&typeof R=="object"&&(f[2]=R)}),d)return f[2]}}function au(i){return(f,d)=>i(f,d,Bt(f,d))}function cu(...i){return(f,d)=>{i.filter(Boolean).forEach(_=>_(f,d,Bt(f,d)))}}r.AnyToPromise=kc,r.AnyToPromiseResponseTypes=po,r.AnyToPromiseStatus=uo,r.CLASS_STORE=to,r.DecoratorTypes=Ee,r.Env=ei,r.EnvTypes=Cc,r.METHOD_STORE=ro,r.Metadata=eo,r.PARAM_STORE=so,r.PROPERTY_STORE=no,r.Store=bt,r.StoreFn=Zs,r.StoreMerge=Dc,r.StoreSet=jc,r.Type=io,r.UnsupportedDecoratorType=Qs,r.ancestorOf=ti,r.ancestorsOf=ri,r.catchAsyncError=Nc,r.catchError=Ic,r.classOf=ve,r.cleanObject=Jc,r.constructorOf=fo,r.createInstance=Ki,r.decorateMethodsOf=Bc,r.decoratorArgs=Gc,r.decoratorTypeOf=vt,r.deepClone=Jt,r.deepMerge=nn,r.descriptorOf=Bt,r.getClass=Ye,r.getClassOrSymbol=Lc,r.getConstructor=lo,r.getConstructorArgNames=Kc,r.getHostInfoFromPort=Uc,r.getInheritedClass=oo,r.getRandomId=Fc,r.getValue=zc,r.hasJsonMethod=bo,r.inheritedDescriptorOf=wo,r.isArray=si,r.isArrayOrArrayClass=ii,r.isArrowFn=mo,r.isBoolean=fe,r.isBooleanOrBooleanClass=ue,r.isBuffer=yo,r.isClass=Oo,r.isClassObject=oi,r.isCollection=Hc,r.isDate=At,r.isEmpty=Vc,r.isEnumerable=Yc,r.isFunction=Nt,r.isInheritedFrom=Xc,r.isMethodDescriptor=Ac,r.isMomentObject=Zc,r.isMongooseObject=Qc,r.isNil=Ie,r.isNumber=Te,r.isNumberOrNumberClass=be,r.isObject=fs,r.isObjectID=So,r.isObservable=ao,r.isPlainObject=qc,r.isPrimitive=Hs,r.isPrimitiveClass=Mc,r.isPrimitiveOrPrimitiveClass=us,r.isPromise=ni,r.isProtectedKey=ps,r.isRegExp=Li,r.isSerializable=eu,r.isStream=hs,r.isString=we,r.isStringOrStringClass=ct,r.isSymbol=Er,r.isSymbolOrSymbolClass=Ec,r.isUint8Array=go,r.mergeReducerBuilder=Fi,r.methodsOf=ho,r.nameOf=Gt,r.nameOfClass=zi,r.nameOfSymbol=Ui,r.objectKeys=Vs,r.primitiveOf=tu,r.prototypeOf=on,r.setValue=ru,r.toMap=nu,r.toStringConstructor=vo,r.uniq=su,r.uniqBy=iu,r.useDecorators=ou,r.useMethodDecorator=au,r.useMethodDecorators=cu,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})})}(Mt,Mt.exports)),Mt.exports}var p=fn();const Et=new Map;class Oe{constructor(e){this.isStore=!0;const{target:r,propertyKey:s,descriptor:a,index:u,decoratorType:m}=e;this.target=r,this.propertyKey=s,this.propertyName=String(s),this.descriptor=a,this.index=u,this.decoratorType=m,this.token=r,this.store=e.store,this.parent=this}get targetName(){return p.nameOf(this.token)}get isCollection(){return!!this.collectionType}get isArray(){return p.isArrayOrArrayClass(this.collectionType)}get discriminatorAncestor(){const e=p.ancestorsOf(this.target).find(r=>Oe.from(r).schema.isDiscriminator);return e&&Oe.from(e)}get isPrimitive(){return p.isPrimitiveOrPrimitiveClass(this._type)}get isDate(){return p.isDate(this.computedType)}get isObject(){return p.isObject(this.computedType)}get isClass(){return p.isClass(this.computedType)}get schema(){return this._schema}get nestedGenerics(){return this.schema.nestedGenerics}set nestedGenerics(e){this.schema.nestedGenerics=e}get type(){return this._type}set type(e){this._type=e,this.build()}get computedType(){return this.itemSchema.getComputedType()}get itemSchema(){return this.isCollection?this.schema.itemSchema():this.schema}get parentSchema(){return this.parent.schema}get isDiscriminatorChild(){var e;return this.schema.isDiscriminator&&((e=this.discriminatorAncestor)==null?void 0:e.schema.discriminator().base)!==this.target}static from(...e){if(e[0].isStore)return e[0];const r=e[0];e.length>1&&(e[0]=p.prototypeOf(e[0]));const s=p.Store.from(...e);if(!s.has("JsonEntityStore")){const a=p.decoratorTypeOf(e),u=Et.get(a),m=new u({store:s,decoratorType:a,target:p.classOf(r),propertyKey:e[1],index:typeof e[2]=="number"?e[2]:void 0,descriptor:typeof e[2]=="object"?e[2]:void 0});m.build(),s.set("JsonEntityStore",m)}return s.get("JsonEntityStore")}static fromMethod(e,r){return this.from(e,r,p.descriptorOf(e,r))}static get(e,r,s){return Oe.from(p.prototypeOf(e),r,s)}isGetterOnly(){return p.isObject(this.descriptor)&&!this.descriptor.value&&this.descriptor.get&&!this.descriptor.set}get(e,r){return this.store.get(e,r)}set(e,r){return this.store.set(e,r)}toString(){return[this.targetName,this.propertyName,this.index].filter(e=>e!==void 0).join(":")}buildType(e){p.isCollection(e)?this.collectionType=e:(this._type=e,this._type&&p.isPlainObject(this._type)&&(this._type=String))}set path(e){this.store.set("path",e)}get path(){return this.store.get("path")}getBestType(){return this.itemSchema.hasDiscriminator?this.itemSchema.discriminator().base:p.isClassObject(this.type)?this.itemSchema.getTarget():p.isArrowFn(this.type)?this.type():this.type}}function ft(t){return e=>{Et.set(t,e)}}var it={exports:{}},ys=it.exports,Dr;function hn(){return Dr||(Dr=1,function(t,e){(function(r,s){s(e)})(ys,function(r){var s=Ie=>{throw TypeError(Ie)},a=(Ie,fe,ue)=>fe.has(Ie)||s("Cannot "+ue),u=(Ie,fe,ue)=>(a(Ie,fe,"read from private field"),ue?ue.call(Ie):fe.get(Ie)),m=(Ie,fe,ue)=>fe.has(Ie)?s("Cannot add the same private member more than once"):fe instanceof WeakSet?fe.add(Ie):fe.set(Ie,ue),w;function x(Ie,fe){return!Ie||!fe.ref||Ie&&fe.ref===Ie}class D{constructor(){m(this,w,new Map)}has(fe){var ue;return!!((ue=u(this,w).get(fe))!=null&&ue.length)}on(fe,ue,Te){let be=ue;Te||(Te=be,be=void 0);const we=u(this,w).get(fe)||[];return we.push({cb:Te,ref:be}),u(this,w).set(fe,we),this}once(fe,ue,Te){Te||(Te=ue);const be=(...we)=>{Te(...we),this.off(fe,be)};return this.on(fe,ue,be),this}off(fe,ue){const Te=(be,we)=>{we.length?u(this,w).set(be,we):u(this,w).delete(be)};if(typeof fe=="string"&&ue){let be=u(this,w).get(fe);be&&Te(fe,be.filter(we=>we.cb!==ue))}else{const be=fe;u(this,w).forEach((we,ct)=>{Te(ct,we.filter(us=>us.ref!==be))})}return this}emit(fe,ue,Te){Array.isArray(ue)&&(Te=ue,ue=void 0),Te||(Te=[]);const be=u(this,w).get(fe);if(be!=null&&be.length)for(const we of be)x(ue,we)&&we.cb.apply(null,Te)}async asyncEmit(fe,ue,Te){Array.isArray(ue)&&(Te=ue,ue=void 0);const be=u(this,w).get(fe);if(be!=null&&be.length){const we=be.filter(ct=>x(ue,ct)).map(ct=>ct.cb.apply(null,Te));await Promise.all(we)}}alter(fe,ue,Te=[],be=null){const we=u(this,w).get(fe);if(we!=null&&we.length)for(const{cb:ct}of we)ue=ct.call(be,ue,...Te);return ue}async asyncAlter(fe,ue,Te=[],be=null){const we=u(this,w).get(fe);if(we!=null&&we.length)for(const ct of we)ue=await ct.cb.call(be,ue,...Te);return ue}destroy(){u(this,w).clear()}}w=new WeakMap;const I=new D,ee=I.on.bind(I),Ee=I.once.bind(I),Ye=I.off.bind(I),ve=I.emit.bind(I),vt=I.asyncEmit.bind(I),At=I.alter.bind(I),Nt=I.asyncAlter.bind(I);r.$alter=At,r.$asyncAlter=Nt,r.$asyncEmit=vt,r.$emit=ve,r.$off=Ye,r.$on=ee,r.$once=Ee,r.Hooks=D,r.hooks=I,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})})}(it,it.exports)),it.exports}var gt=hn();const Kt=new Map;function jr(t){return p.isPromise(t)||t===Function?Object:p.isClass(t)||p.isSymbol(t)||p.isPrimitiveOrPrimitiveClass(t)||p.isClassObject(t)||p.isDate(t)||p.isCollection(t)?p.classOf(t):p.isArrowFn(t)?t():t}const Cr=["string","number","integer","boolean","object","array","null","any"];function pt(t){return t===null?"null":p.isPrimitiveOrPrimitiveClass(t)?Cr.indexOf(t)>-1?t:typeof t=="string"?t==="file"?"file":"generic":p.primitiveOf(t):t===Array?"array":p.isArray(t)?t.map(pt):t===Set?"array":p.isDate(t)||p.isBuffer(t)?"string":"object"}const ar=t=>p.isObject(t)&&t!==null?Object.entries(t).reduce((e,[r,s])=>isNaN(+r)?e.concat(s):e,[]):t;function kr(t){const e=t.reduce((a,u)=>a.concat(ar(u)),[]),r=a=>a===null?"null":typeof a,s=e.reduce((a,u)=>a.add(r(u)),new Set);return{values:p.uniq(e),types:s}}function cr(t){return String(t).replace(/^(\/)(.*)(\/)$/,"$2")}class Pt{constructor({base:e,propertyName:r,types:s,values:a}={}){this.values=new Map,this.types=new Map,Object.assign(this,p.cleanObject({base:e,propertyName:r,types:s?new Map(s):void 0,values:a?new Map(a):void 0}))}add(e,r){return r.forEach(s=>{this.values.set(s,e)}),this.types.set(e,r),this}getType(e){return this.values.get(e)||this.base}getValues(e){return this.types.get(e)}getDefaultValue(e){const r=this.types.get(e);return r?r[0]:void 0}children(){return[...new Set([...this.types.keys()])]}}function $t(t){return t instanceof We?t:Object.entries(t).reduce((e,[r,s])=>(e[cr(r)]=et(s),e),{})}function et(t){return p.isArray(t)?t.map(et):t.isStore||t.$isJsonDocument||t.isLazyRef?t:p.classOf(t)!==Object&&p.isClass(t)?Oe.from(t).schema:p.isObject(t)?We.from(t):p.isPrimitiveClass(t)?We.from({type:t}):t}const mn=class Lt extends Map{constructor(e={}){super(),ne(this,ae),ne(this,me),ne(this,$e),ne(this,pe),ne(this,_e),ne(this,Re),ne(this,Me),ne(this,Xe),ne(this,Ze),ne(this,st),this.$kind="schema",this.$isJsonDocument=!0,this.$hooks=new gt.Hooks,this.$required=new Set,this.$allow=[],this.$forwardGroups=!1,this.$ignore=!1,this.isDiscriminatorKey=!1,this.isDiscriminator=!1,G(this,ae,!1),G(this,me,null),G(this,pe,[]),G(this,_e,new Map),G(this,Xe,!1),G(this,Ze,!1),G(this,st,!1),e&&this.assign(e)}get alias(){return A(this,_e)}get nestedGenerics(){return A(this,pe)}set nestedGenerics(e){G(this,pe,e)}get genericLabels(){return A(this,$e)}set genericLabels(e){G(this,$e,e)}get isClass(){return p.isClass(this.class)&&![Map,Array,Set,Object,Date,Boolean,Number,String].includes(A(this,Me))}get isCollection(){return A(this,Ze)}get isGeneric(){return A(this,Xe)}get discriminatorAncestor(){const e=p.ancestorsOf(A(this,Me)).find(r=>Oe.from(r).schema.isDiscriminator);return e&&Oe.from(e).schema}get hasGenerics(){return!!(this.nestedGenerics&&this.nestedGenerics.length)}get genericType(){return this.get("$ref")}get class(){return this.getComputedType()}get canRef(){return A(this,st)}get isNullable(){return A(this,ae)}get isReadOnly(){return this.get("readOnly")}get isWriteOnly(){return this.get("writeOnly")}get hasDiscriminator(){return!!A(this,me)}static from(e={}){return new Lt(e)}nullable(e){G(this,ae,e)}itemSchema(e={}){return G(this,Re,A(this,Re)||et(e)),A(this,Re).assign(e),A(this,Re)}getAliasOf(e){return A(this,_e).get(e)}addAlias(e,r){return A(this,_e).set(e,r),A(this,_e).set(r,e),this}removeAlias(e){const r=A(this,_e).get(e);return r&&A(this,_e).delete(r),A(this,_e).delete(e),this}$id(e){return super.set("$id",e),this}$ref(e){return super.set("$ref",e),this}$schema(e){return super.set("$schema",e),this}label(e){return G(this,st,!0),super.set("name",e),this}name(e){return super.set("name",e),this}ignore(e){return typeof e!="boolean"&&this.$hooks.on("ignore",e),this.$ignore=e,this}default(e){return super.set("default",e),this}const(e){return super.set("const",e),this}description(e){return super.set("description",e),this}discriminator(){return this.isDiscriminator=!0,G(this,me,A(this,me)||new Pt({base:A(this,Me)}))}discriminatorKey(e){return this.discriminator().propertyName=e,this.isDiscriminator=!0,this}discriminatorValue(...e){const r=this.discriminatorAncestor.discriminator();r.add(A(this,Me),e),this.isDiscriminator=!0;const s=this.get("properties"),a=s[r.propertyName]||new Lt({type:"string"});return e.length===1?(a.const(e[0]),a.examples([e[0]])):(a.enum(...e),a.examples(e)),s[r.propertyName]=a,this.set("properties",s),this}additionalItems(e){return super.set("additionalItems",et(e)),this}contains(e){return super.set("contains",et(e)),this}examples(e){return super.set("examples",e),this}example(...e){return this.examples(e)}items(e){return super.set("items",G(this,Re,et(e))),this}maxItems(e){return super.set("maxItems",e),this}minItems(e){return super.set("minItems",e),this}uniqueItems(e){return super.set("uniqueItems",e),this}maxProperties(e){return super.set("maxProperties",e),this}minProperties(e){return super.set("minProperties",e),this}allow(...e){return[].concat(this.getJsonType()).includes("string")&&!this.has("minLength")&&this.minLength(1),e.forEach(r=>{switch(r){case"":this.set("minLength",void 0);break;case null:this.any(...["null"].concat(this.getJsonType(),this.$allow.map(s=>typeof s)));break}}),this.$allow.push(...e),this}required(e=!0){if(p.isArray(e))this.$required.clear(),e.forEach(r=>this.$required.add(r));else{const r=this.clone();return r.$selfRequired=e,[].concat(r.getJsonType()).includes("string")&&r.minLength(1),r}return this}addRequired(e){return this.$required.add(e),this}removeRequired(e){return this.$required.delete(e),this}isRequired(e){return this.$required.has(e)}properties(e){return super.set("properties",$t(e)),this}addProperty(e,r){const s=this.get("properties")||{};return s[e]=r,super.set("properties",$t(s)),this}patternProperties(e){return super.set("patternProperties",$t(e)),this}additionalProperties(e){return super.set("additionalProperties",et(e)),this}unknown(e=!0){return this.additionalProperties(e)}dependencies(e){return super.set("dependencies",$t(e)),this}propertyNames(e){return super.set("propertyNames",et(e)),this}enum(e,...r){if(Kt.has(e))return this.enum(Kt.get(e));if(e instanceof Lt)e.getName()?super.set("enum",e):super.set("enum",e.get("enum")).any(...e.get("enum").map(s=>typeof s));else{const{values:s,types:a}=kr([e,r].flat());super.set("enum",s).any(...a)}return this}definitions(e){return super.set("definitions",$t(e)),this}allOf(e){return this.setManyOf("allOf",e),this}anyOf(e){return this.setManyOf("anyOf",e),this}oneOf(e){return this.setManyOf("oneOf",e),this}not(e){return super.set("not",et(e)),this}multipleOf(e){return super.set("multipleOf",e),this}maximum(e){return super.set("maximum",e),this}exclusiveMaximum(e){return super.set("exclusiveMaximum",e),this}minimum(e){return super.set("minimum",e),this}exclusiveMinimum(e){return super.set("exclusiveMinimum",e),this}maxLength(e){return super.set("maxLength",e),this}minLength(e){return super.set("minLength",e),this}pattern(e){return super.set("pattern",cr(e)),this}format(e){return super.set("format",e),this}type(e){switch(e){case"map":case Map:super.set("type",pt(e)),G(this,Me,e),G(this,Ze,!0),this.has("additionalProperties")||super.set("additionalProperties",this.itemSchema({}));break;case"array":case Array:super.set("type",pt(e)),G(this,Me,e),G(this,Ze,!0),this.has("items")||super.set("items",this.itemSchema({}));break;case"set":case Set:super.set("type",pt(e)),G(this,Me,e),G(this,Ze,!0),this.uniqueItems(!0),this.has("items")||super.set("items",this.itemSchema({}));break;case"integer":this.integer();break;case"number":case"string":case"boolean":case"object":case Object:case Date:case Boolean:case Number:case String:super.set("type",pt(e)),G(this,Me,e),this.has("properties")||super.set("properties",{});break;default:if(p.isClass(e)||p.isFunction(e))super.set("type",void 0),G(this,Me,e),this.has("properties")||super.set("properties",{});else{const r=pt(e);r==="generic"?(G(this,Xe,!0),super.set("$ref",e)):super.set("type",r)}}return this}any(...e){var r;return e=e.length?e:["integer","number","string","boolean","array","object","null"],e=p.uniq(e).map(s=>p.isClass(s)?s:{type:pt(s)}),e.length>1?this.anyOf(e):this.type(((r=e[0])==null?void 0:r.type)||e[0]),this}integer(){return super.set("type","integer"),super.set("multipleOf",1),this}title(e){return super.set("title",e),this}readOnly(e){return super.set("readOnly",e),this}writeOnly(e){return super.set("writeOnly",e),this}customKey(e,r){return super.set(`#${e}`,r),this}toObject(e){return this.toJSON(e)}toJSON(e){return Y("schema",[this],e)}assign(e={}){return(e instanceof Lt?[...e.entries()]:Object.entries(e)).forEach(([r,s])=>{this.set(r,s)}),e instanceof Lt&&(this.$selfRequired=e.$selfRequired,this.$allow.push(...e.$allow),e.$required.forEach(r=>{this.$required.add(r)}),G(this,me,A(this,me)?new Pt(A(this,me)):null),this.isDiscriminator=e.isDiscriminator,this.isDiscriminatorKey=e.isDiscriminatorKey,G(this,st,A(e,st)),G(this,_e,new Map(A(this,_e).entries())),A(e,$e)&&G(this,$e,[...A(e,$e)]),G(this,pe,A(e,pe).map(r=>[...r])),G(this,Me,A(e,Me)),G(this,Xe,A(e,Xe)),G(this,Ze,A(e,Ze)),G(this,st,A(e,st)),G(this,ae,A(e,ae)),super.set("type",e.get("type"))),this}set(e,r){return e in this?p.isFunction(this[e])&&this[e](r):super.set(e,r),this}getComputedType(){return jr(A(this,Me))}getComputedItemType(){return A(this,Re)?A(this,Re).getComputedType():this.getComputedType()}getJsonType(){return this.get("anyOf")?this.get("anyOf").map(e=>e.getJsonType()):this.get("type")||pt(this.getComputedType())}getTarget(){return A(this,Me)}getName(){return this.get("name")||(p.isClass(A(this,Me))?p.nameOf(p.classOf(this.getComputedType())):"")}clone(){return new Lt(this)}setManyOf(e,r){let s=r.filter(u=>(u==null?void 0:u.type)==="null"?(this.nullable(!0),!1):!0).map(et);if(s.length===1&&!(r[0]instanceof Lt)&&!this.isNullable){if(!s[0].hasDiscriminator)return this.type(r[0]);const u=s[0].discriminator().children();if(!u.length)return this.type(r[0]);s=u.map(et)}super.set(e,s);const a=s[0];if(a.isDiscriminator){const u=a.discriminatorAncestor.discriminator(),{propertyName:m}=u;super.set("discriminator",{propertyName:m,mapping:s.reduce((w,x)=>{var D;return(D=u.types.get(x.getTarget()))==null||D.forEach(I=>{w[I]=x}),w},{})}),this.isDiscriminator=!0,G(this,me,u)}}};ae=new WeakMap,me=new WeakMap,$e=new WeakMap,pe=new WeakMap,_e=new WeakMap,Re=new WeakMap,Me=new WeakMap,Xe=new WeakMap,Ze=new WeakMap,st=new WeakMap;let We=mn;var dn=(t,e,r,s)=>{for(var a=e,u=t.length-1,m;u>=0;u--)(m=t[u])&&(a=m(a)||a);return a};n.JsonClassStore=class extends Oe{constructor(){super(...arguments),this.children=new Map}get path(){return this.store.get("path","/")}set path(t){this.store.set("path",t)}build(){this._type||this.buildType(this.target),this._type=this._type||Object,this._schema=We.from({type:this.type})}},n.JsonClassStore=dn([ft(p.DecoratorTypes.CLASS)],n.JsonClassStore);const ur=t=>Number(t)&&200<=Number(t)&&Number(t)<300,Ft=t=>Number(t)&&300<=Number(t)&&Number(t)<400;class Ve extends Map{constructor(e={}){super(),this.$kind="map",this.$isJsonDocument=!0,this.assign(e)}assign(e={}){return Object.entries(e).forEach(([r,s])=>{p.isFunction(this[r])?this[r](s):this.set(r,s)}),this}toJSON(e){return Y("map",[this],e)}}function Ir(t){return Object.keys(t).reduce((e,r)=>{const s=t[r];let a=typeof s,u={example:s};return a==="object"&&(u=s,u.example=u.value===void 0?u.example:u.value,delete u.value,a=typeof u.example),u.type=u.type||a,e[r]=p.cleanObject(u),e},{})}function tt(t,e=Ve){return Object.entries(t).reduce((r,[s,a])=>(r.set(s,new e(a)),r),new Ve)}class Wt extends Ve{constructor(){super(...arguments),this.$kind="operationMedia",this.groups=[]}schema(e){return this.set("schema",e),this}examples(e){return this.set("examples",e),this}}class yn extends Ve{constructor(e={}){super(e),this.$kind="operationResponse",this.content(e.content||{})}description(e){return this.set("description",e),this}headers(e){return this.set("headers",Ir(e)),this}content(e){return this.set("content",tt(e,Wt)),this}getContent(){return this.get("content")}getMedia(e,r=!0){var s;return r&&this.addMedia(e),(s=this.getContent())==null?void 0:s.get(e)}addMedia(e){const r=this.get("content");return r.has(e)||r.set(e,new Wt),this}isBinary(){return this.getContent().has("application/octet-stream")}}class gn extends Ve{constructor(e,r){super(),this.method=e,this.path=r}summary(e){return super.set("summary",e),this}description(e){return super.set("description",e),this}}class pr extends Ve{constructor(e={}){super({parameters:[],responses:new Ve,...e}),ne(this,lt),ne(this,dt),this.$kind="operation",this.operationPaths=new Map,G(this,dt,!1)}get response(){return this.getResponses().get(this.getStatus().toString())}get status(){return A(this,lt)}tags(e){return super.set("tags",e),this}addTags(e){return e=p.uniqBy([...this.get("tags")||[],...e],"name"),this.tags(e)}summary(e){return super.set("summary",e),this}operationId(e){return this.set("operationId",e),this}responses(e){return this.set("responses",e),this}defaultStatus(e){return G(this,lt,e),this}getStatus(){return A(this,lt)||200}setRedirection(e=302){return G(this,dt,!0),G(this,lt,e),this}isRedirection(e){return A(this,dt)&&e?Ft(e):A(this,dt)}addResponse(e,r){if((ur(e)||Ft(e))&&!A(this,lt)){const u=this.getResponseOf(200);this.getResponses().set(e.toString(),u).delete("200"),this.defaultStatus(Number(e))}const s=e==="default"?this.getStatus().toString():e.toString(),a=this.getResponses().get(s);return a?(r.forEach((u,m)=>{["content"].includes(m)||a.set(m,p.deepMerge(a.get(m),u))}),a.status=Number(s)):(r.status=Number(s),this.getResponses().set(s,r)),this}getResponses(){return this.get("responses")}getResponseOf(e){return(e==="default"?this.response:this.getResponses().get(String(e)))||new yn}ensureResponseOf(e){return this.addResponse(e,this.getResponseOf(e)),this.getResponseOf(e)}getHeadersOf(e){return this.getResponseOf(e).get("headers")||{}}getContentTypeOf(e){return[...this.getResponseOf(e).get("content").keys()].slice(-1)[0]}security(e){return this.set("security",e),this}addSecurityScopes(e,r){const s=this.get("security")||{};return s[e]=p.uniq([...s[e]||[],...r]),this.security(s)}description(e){return super.set("description",e),this}deprecated(e){return super.set("deprecated",e),this}parameters(e){return super.set("parameters",e),this}addParameter(e,r){e===-1&&(e=this.get("parameters").length),this.get("parameters")[e]=r}consumes(e){return super.set("consumes",e),this}produces(e){return super.set("produces",e),this}addProduce(e){const r=p.uniq([].concat(this.get("produces"),e)).filter(Boolean);this.set("produces",r)}addOperationPath(e,r){const s=new gn(e,r);return this.operationPaths.set(String(e)+String(r),s),s}getAllowedOperationPath(e){return e?[...this.operationPaths.values()].filter(({method:r})=>r&&e.includes(r.toUpperCase())):[...this.operationPaths.values()]}}lt=new WeakMap,dt=new WeakMap;var Nr=(t,e,r,s)=>{for(var a=e,u=t.length-1,m;u>=0;u--)(m=t[u])&&(a=m(a)||a);return a};n.JsonMethodStore=class extends Oe{constructor(t){super({store:p.Store.fromMethod(t.target,t.propertyKey),descriptor:p.descriptorOf(t.target,t.propertyKey),...t}),this.parent=Oe.from(this.target),this.middlewares=[],this.beforeMiddlewares=[],this.afterMiddlewares=[],this.operation=new pr,this.children=new Map;const{beforeMiddlewares:e=[],middlewares:r=[],afterMiddlewares:s=[]}=t;this.after(s),this.before(e),this.use(r)}get params(){return this.parameters}get view(){return this.store.get("view")}set view(t){this.store.set("view",t)}get acceptMimes(){return this.store.get("acceptMimes",[])}set acceptMimes(t){this.store.set("acceptMimes",t)}get parameters(){return[...this.children.values()]}get operationPaths(){return this.operation.operationPaths}static get(t,e,r){return r=r||p.descriptorOf(p.prototypeOf(t),e),Oe.from(p.prototypeOf(t),e,r)}getResponseOptions(t,{contentType:e="application/json",includes:r}={}){var s;const a=this.operation.getResponseOf(t).getMedia(e,!1);if(a&&a.has("schema")){const u=a.get("schema");let m=a.groups;return r&&(s=a.allowedGroups)!=null&&s.size&&(m=[...m||[],...r.filter(w=>a.allowedGroups.has(w))]),{type:u.getComputedItemType(),groups:m}}return{type:this.type}}before(t){return this.beforeMiddlewares=this.beforeMiddlewares.concat(t).filter(p.isFunction),this}after(t){return this.afterMiddlewares=this.afterMiddlewares.concat(t).filter(p.isFunction),this}use(t){return this.middlewares=this.middlewares.concat(t).filter(p.isFunction),this}get(t){const e=p.Store.from(this.target).get(t);return p.deepMerge(e,this.store.get(t))}getParamTypes(){return[...this.children.values()].reduce((t,e)=>({...t,[e.paramType]:!0}),{})}build(){if(!this._type){let t=p.Metadata.getReturnType(this.target,this.propertyKey);t=p.isPromise(t)?void 0:t,this.buildType(t)}this._type=this._type||Object,this.parent.children.set(this.propertyName,this),p.isCollection(this._type)&&(this.collectionType=this._type,delete this._type),this._schema=We.from({type:this.collectionType||this.type}),this.collectionType&&this._schema.itemSchema(this.type),this.parent.schema.addProperty(this.propertyName,this.schema)}},n.JsonMethodStore=Nr([ft(p.DecoratorTypes.METHOD)],n.JsonMethodStore);const gs=n.JsonMethodStore;var rt=(t=>(t.BODY="body",t.PATH="path",t.QUERY="query",t.HEADER="header",t.COOKIES="cookie",t.FILES="files",t))(rt||{});function zt(t){return String(t).toLowerCase().replace("raw_","").replace("cookies","cookie")}function lr(t){return Object.values(rt).includes(zt(t))}class Rt extends Ve{constructor(){super(...arguments),this.$kind="operationInParameter",this.nestedGenerics=[],this.$schema=new We}getName(){const e=this.get("name");return this.get("in")==="files"?e.split(".")[0]:e}name(e){return this.set("name",e),this}examples(e){return super.set("examples",e),this}description(e){return this.set("description",e),this}in(e,r=""){return this.set("in",zt(e)),this.expression=r,this}required(e){return this.set("required",e),this}schema(e){return e?(this.$schema=e,this):this.$schema}itemSchema(e){return this.$schema.isCollection?(e&&this.$schema.itemSchema(e),this.$schema.itemSchema()):(e&&this.schema(e),this.schema())}toJSON(e){return Y("operationInParameter",[this],e)}}var fr=(t,e,r,s)=>{for(var a=e,u=t.length-1,m;u>=0;u--)(m=t[u])&&(a=m(a)||a);return a};n.JsonParameterStore=class extends Oe{constructor(t){super(t),this.parameter=new Rt,this.parent=Oe.fromMethod(this.target,this.propertyKey),this.pipes=t.pipes||[],this.paramType=t.paramType||this.paramType,this.expression=t.expression||this.expression,this.dataPath=t.dataPath||this.dataPath}get nestedGenerics(){return this.parameter.nestedGenerics}set nestedGenerics(t){this.parameter.nestedGenerics=t}get required(){return!!this.parameter.get("required")}set required(t){this.parameter.required(t)}get allowedRequiredValues(){return this.schema.$allow}get schema(){return this.parameter.$schema}static getParams(t,e){const r=[],s=p.ancestorsOf(t).reverse().find(a=>p.isMethodDescriptor(a,e)&&Oe.fromMethod(a,e).children.size);return s?(Oe.fromMethod(s,e).children.forEach((a,u)=>{r[+u]=a}),r):[]}static get(t,e,r){return Oe.from(p.prototypeOf(t),e,r)}isRequired(t){return this.required&&[void 0,null,""].includes(t)&&!this.allowedRequiredValues.includes(t)}build(){if(!this._type){const t=p.Metadata.getParamTypes(p.prototypeOf(this.target),this.propertyKey)[this.index];this.buildType(t)}this._type=this._type||Object,this.parent.children.set(this.index,this),this.parent.operation.addParameter(this.index,this.parameter),this.collectionType&&this.parameter.schema().type(this.collectionType),p.isClass(this._type)?this.parameter.itemSchema(Oe.from(this._type).schema):this.parameter.itemSchema().type(this._type)}},n.JsonParameterStore=fr([ft(p.DecoratorTypes.PARAM)],n.JsonParameterStore);const On=n.JsonParameterStore;var Jr=(t,e,r,s)=>{for(var a=e,u=t.length-1,m;u>=0;u--)(m=t[u])&&(a=m(a)||a);return a};n.JsonPropertyStore=class extends Oe{constructor(){super(...arguments),this.parent=Oe.from(this.target)}get required(){return this.parent.schema.isRequired(this.propertyKey)}set required(t){t?this.parent.schema.addRequired(this.propertyKey):this.parent.schema.removeRequired(this.propertyKey)}get allowedRequiredValues(){return this.schema.$allow}discriminatorKey(){return this.parent.schema.discriminatorKey(String(this.propertyKey)),this.itemSchema.isDiscriminatorKey=!0,this}isDiscriminatorKey(){return this.itemSchema.isDiscriminatorKey}isRequired(t){return this.required&&[void 0,null,""].includes(t)&&!this.allowedRequiredValues.includes(t)}build(){this._type||this.buildType(p.Metadata.getType(p.prototypeOf(this.target),this.propertyKey)),this._type=this._type||Object;let t=this.parent.schema.get("properties")[this.propertyName];t||(this.parent.children.set(this.propertyName,this),t=We.from({type:this.collectionType||this.type}),this.collectionType&&t.itemSchema(this.type)),this.parent.schema.addProperty(this.propertyName,t),this._schema=t}static get(t,e){return Oe.from(p.prototypeOf(t),e)}},n.JsonPropertyStore=Jr([ft(p.DecoratorTypes.PROP)],n.JsonPropertyStore);const hr=n.JsonPropertyStore;Et.set(p.DecoratorTypes.CLASS,n.JsonClassStore),Et.set(p.DecoratorTypes.PROP,n.JsonPropertyStore),Et.set(p.DecoratorTypes.PARAM,n.JsonParameterStore),Et.set(p.DecoratorTypes.METHOD,n.JsonMethodStore);function He(...t){return Oe.from(...t)}class Br extends Map{constructor(){super(...arguments),this.$kind="operationPaths",this.$isJsonDocument=!0,this.getKey=(e,r)=>`${e}-${r}`}setOperationPath(e){const r=this.getKey(e.method,e.path);this.set(r,e)}}function Ut(t){const e=t.isStore?t:He(t);return e.$inherited||(e.$inherited=p.ancestorsOf(e.target).reverse().reduce((r,s)=>r.set(s,He(s)),new Map)),e.$inherited}function mr(t){const e=t.isStore?t:He(t);if(!e.$operations){const r=new Br;e.$operations=new Map,Ut(e).forEach(s=>{s.children.forEach(a=>{a instanceof n.JsonMethodStore&&!e.$operations.has(a.propertyKey)&&e.$operations.set(a.propertyKey,a)})}),e.$operations.forEach(s=>{s.operation.operationPaths.forEach(a=>{r.setOperationPath(a)})}),r.clear()}return e.$operations}function Gr(t){return!t.store.get("hidden")}const Os=[ye.PUBLISH,ye.SUBSCRIBE];function vs(t){return(e,{operationPath:r,operationStore:s})=>{var a,u,m,w;const x=t.ctrlRootPath||"/",D=r.method.toLowerCase(),I=O.camelCase(`${D.toLowerCase()} ${s.parent.schema.getName()}`),ee=Y("message",[s,r],t);return{...e,[x]:{...e[x],[D]:{...(a=e[x])==null?void 0:a[D],operationId:I,message:{oneOf:[...((w=(m=(u=e[x])==null?void 0:u[D])==null?void 0:m.message)==null?void 0:w.oneOf)||[],ee]}}}}}}function vn(t){return e=>{const r=e.operation.getAllowedOperationPath(Os);return r.length===0?[]:r.map(s=>({operationPath:s,operationStore:e}))}}function qr(t,{channels:e,rootPath:r,...s}){const a=He(t).path,u=ut(r+a);return s={...s,ctrlRootPath:u},[...mr(t).values()].filter(Gr).flatMap(vn()).reduce(vs(s),e)}Q("channels",qr);var ie=(t=>(t.JSON="jsonschema",t.SWAGGER="swagger2",t.OPENAPI="openapi3",t.ASYNCAPI="asyncapi2",t))(ie||{});function bn(t,e){var r;const s={channels:Y("channels",[t],e)};return s.tags=p.uniqBy(e.tags,"name"),(r=e.components)!=null&&r.schemas&&Object.keys(e.components.schemas).length&&(s.components={...e.components,schemas:e.components.schemas}),s}Q("generate",bn,ie.ASYNCAPI);function Ht(t,e){return e.length?e.length===1?e[0]:{[t]:e}:null}function wn(t,e,{tags:r=[],defaultTags:s=[],...a}={}){const{path:u,method:m}=e,w=String(u);let x=p.getValue(a.components,"messages."+u,p.cleanObject({description:t.operation.get("description"),summary:t.operation.get("summary")}));if(m.toUpperCase()===ye.PUBLISH){const D=Y("payload",[t,e],a);D&&(x.payload=D);const I=t.operation.getAllowedOperationPath([ye.SUBSCRIBE]).map(Ee=>Y("message",[t,Ee],a)).filter(Boolean),ee=Ht("oneOf",I);ee&&(x["x-response"]=ee)}else{const D=Y("response",[t,e],a);D&&(x["x-response"]=D)}return a.components.messages=a.components.messages||{},a.components.messages[w]=x,{$ref:`#/components/messages/${w}`}}Q("message",wn,ie.ASYNCAPI);function dr(t,e){return t.reduce((r,s,a)=>r.set(s,e[a]),new Map)}function Tt(t){if(t.genericLabels&&t.genericTypes){const{genericLabels:e,genericTypes:r,...s}=t;return{...s,generics:dr(e,r)}}return t}function Dt(t){const[e,...r]=t.nestedGenerics;return{genericTypes:e,nestedGenerics:r}}function Sn(t,e={}){return{...e,groups:t.groups,groupsName:t.groupsName}}function Mn(t,e){return t.get("parameters").filter(r=>lr(r.get("in")))}function yr(t,e,r){const s=Mn(t.operation),a=O.pascalCase([e.path,e.method,"Payload"].join(" "));p.setValue(r,`components.schemas.${a}`,{});const u=s.map(m=>{const w=Sn(m,r),x=Y("item",[m.$schema],{...w,...Dt(m)});switch(m.get("in")){case rt.BODY:return x;case rt.QUERY:case rt.PATH:case rt.HEADER:return{type:"object",properties:{[m.get("name")]:x}}}return x},{}).filter(Boolean);return Ht("allOf",u)}Q("payload",yr,ie.ASYNCAPI);function En(t,e,r){const s=t.operation.getResponses(),a=[],u=[],m=[],w=[];[...s.entries()].forEach(([Ee,Ye])=>{const ve=Y("map",[Ye],r);if(a.push(+Ee),u.push(ve.description),+Ee!=204){const{content:vt}=ve,At=vt[Object.keys(vt)[0]];m.push(At)}});const x=O.pascalCase([e.path,e.method,"Response"].join(" ")),D={type:"object",properties:{status:{type:"number",enum:a},statusText:{type:"string",enum:u}},required:["status"]},I=Ht("oneOf",m);I&&p.setValue(D,"properties.data",I);const ee=Ht("oneOf",w);return w.length&&p.setValue(D,"properties.error",ee),p.setValue(r,`components.schemas.${x}`,D),{$ref:`#/components/schemas/${x}`}}Q("response",En,ie.ASYNCAPI);class gr{constructor(e){this.getType=e,this.isLazyRef=!0}get target(){return this.getType()}get schema(){return He(this.getType()).schema}get name(){return p.nameOf(this.getType())}}function bs(t){const{host:e=`#/${[ie.OPENAPI,ie.ASYNCAPI].includes(t.specType)?"components/schemas":"definitions"}`}=t;return e}function jt(t,e){return e.groups&&e.groups.length?O.pascalCase(`${t} ${e.groupsName||e.groups.join(" ")}`):t}function Vt(t,e,r){const s={$ref:`${bs(r)}/${t}`},a=e.isReadOnly,u=e.isWriteOnly;return p.cleanObject({readOnly:a?!0:void 0,writeOnly:u?!0:void 0,...a||u?{anyOf:[s]}:s})}function Yt(t,e,r){const s=jt(t.getName(),r);return e&&p.setValue(r,`components.schemas.${s}`,e),Vt(s,t,r)}function Pn(t,e={}){if(typeof t!="object"||t===null)return t;if(t instanceof gr)return Y("lazyRef",[t],e);if(t instanceof We&&t.get("enum")instanceof We){const r=t.get("enum");return Yt(r,r.toJSON(e),e)}if(t.$kind&&t.$isJsonDocument){const r=ln([t.$kind,"map"],e),s=Y(r,[t],Tt(e));return t.canRef?Yt(t,s,e):s}return Y("object",[t],e)}Q("any",Pn);function Tn(t,e){const r=Oe.from(t.class),s=jt(r.schema.getName()||t.getName(),e);if(t.hasGenerics){const{type:a,properties:u,additionalProperties:m,items:w,...x}=t.toJSON(e),D={...Y("any",[r.schema],{...e,...Dt(t),root:!1}),...x};if(D.title){const I=jt(D.title,e);return p.setValue(e.components,`schemas.${I}`,D),delete D.title,Vt(I,t,e)}return D}return p.getValue(e,`components.schemas.${s}`)||(p.setValue(e,`components.schemas.${s}`,{}),e.components.schemas[s]=Y("any",[r.schema],Tt({...e,root:!1}))),Vt(s,t,e)}Q("class",Tn);function Xt(t,e,r){var s;if((s=t.discriminator)!=null&&s.mapping){const a=Object.entries(t.discriminator.mapping),u={};for(const[m,w]of a)u[m]=p.isString(w)?w:Yt(w,null,r).$ref;t.discriminator.mapping=u}return t}function ws(t){var e;return(e=t.discriminator)!=null&&e.mapping&&delete t.discriminator.mapping,t}Q("discriminatorMapping",ws);function Or(t,e,r){var s;return r.inlineEnums&&(s=t.enum)!=null&&s.$isJsonDocument&&(t.enum=t.enum.toJSON().enum),t.enum&&(t.type=t.type==="object"||t.type===void 0?"string":t.type),t}Q("enums",Or);function _n(t,e){const{generics:r}=e;if(r&&t.$ref&&r.has(t.$ref)){let s=r.get(t.$ref);if(p.isPrimitiveClass(s))return{type:pt(s)};if(s===Date)return{type:"string",format:"date-time"};if(s.toJSON)return s.toJSON({...e,generics:void 0});if(s===Object)return{type:"object"};if(p.isClass(s)){const a={class:s};if(e.nestedGenerics.length===0)return Y("class",[a],{...e,generics:void 0});const u=Oe.from(a.class);return Y("schema",[u.schema],{...e,...Dt(e),root:!1})}}return t}Q("generics",_n);function xn(t,e){if(e!=null&&e.type&&e!=null&&e.$ref){const{$ref:r,...s}=e;e={allOf:[{$ref:r},s]}}return e}function An(t,{target:e,...r}){const s=Array.from(Ut(e).entries()).filter(([a])=>p.classOf(a)!==p.classOf(e));if(s.length){const a=s.reduce((u,[,m])=>p.deepMerge(u,Y("schema",[m.schema],r),{alter:xn}),{});return p.deepMerge(a,t,{alter:xn})}return t}Q("inheritedClass",An);function $n(t,e){return t&&t.isClass?Y("class",[t],e):Y("any",[t],e)}Q("item",$n);function Rn(t,e){var r;const s=t.name;if((r=e.$refs)!=null&&r.find(u=>u===t.target))return Vt(s,t.schema,e);e.$refs=[...e.$refs||[],t.target];const a=t.getType()&&Y("schema",[t.schema],Tt(e));return Yt(t.schema,a,e)}Q("lazyRef",Rn);function Lr(t,{ignore:e=[],...r}={}){return r=Tt(r),Array.from(t.entries()).reduce((s,[a,u])=>(e.includes(a)||(s[a]=Y("item",[u],r)),s),{})}Q("map",Lr);const vr=["oneOf","allOf","anyOf"],Dn=["minLength","maxLength","pattern","format"],jn=[],Cn=["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"],Kr=["maxItems","minItems","uniqueItems","items","contains","maxContains","minContains"],kn=["maxItems","minItems","uniqueItems","items","contains","maxContains","minContains","patternProperties","dependencies"],Fr=["const","enum"];function In(t,e){return e!=null&&e.isNullable&&(t.discriminator||(t.$ref?t=p.cleanObject({...t,$ref:void 0,anyOf:[{type:"null"},{$ref:t.$ref}]}):vr.some(r=>{if(t[r])if(t[r]=t[r].filter(s=>s.type!=="null"),t[r].length===1){const s=t[r];t=p.cleanObject({...t,...s[0],[r]:void 0,type:["null",Number.isInteger(t.multipleOf)?"integer":s[0].type]})}else t[r]=[{type:"null"}].concat(t[r]).map(s=>(Number.isInteger(s.multipleOf)&&(s.type="integer"),s)),delete t.type}))),t}Q("nullable",In);function Wr(t,e){var r,s;if(p.isBoolean(t.$ignore)&&t.$ignore)return!0;let a=(r=t==null?void 0:t.$hooks)==null?void 0:r.alter("ignore",!1,[e]);return a||(e.groups!==!1?(s=t==null?void 0:t.$hooks)==null?void 0:s.alter("groups",!1,[e.groups]):a)}function Nn(t,e){const{specType:r,operationIdFormatter:s,root:a,components:u,genericTypes:m,nestedGenerics:w,useAlias:x,genericLabels:D,...I}=e;return Object.entries(t).reduce((ee,[Ee,Ye])=>{if(e.withIgnoredProps!==!1&&!Wr(Ye,I)){const ve={...e,groups:t!=null&&t.$forwardGroups||Ye!=null&&Ye.$forwardGroups?e.groups:void 0};ee[Ee]=Y("item",[Ye],ve),ee[Ee]=Y("nullable",[ee[Ee],Ye],ve)}return ee},p.isArray(t)?[]:{})}Q("object",Nn);function br(t,e,r){return t.map(s=>Y("item",[s],{...e,genericLabels:r.genericLabels}))}Q("anyOf",br),Q("allOf",br),Q("oneOf",br);function o(t,e,r){return t.isClass?Y("class",[t],e):Y("any",[t],{...e,genericLabels:r.genericLabels})}Q("properties",o),Q("items",o),Q("additionalProperties",o),Q("propertyNames",o),Q("contains",o),Q("dependencies",o),Q("patternProperties",o),Q("additionalItems",o),Q("not",o),Q("definitions",o);function l(t,e,r){var s;return r.groups!==!1?(s=e==null?void 0:e.$hooks)==null?void 0:s.alter("requiredGroups",t,[r.groups]):t}function h(t,e,r={}){const{useAlias:s}=r,a=Object.keys(t.properties||{});return(u,m)=>{const w=s&&e.alias.get(m)||m;return a.includes(w)?u.concat(w):u}}function M(t,e,r){let s=t.required||[];return s=[...s,...e.$required],e.get("properties")&&(s=Object.entries(e.get("properties")).reduce((a,[u,m])=>m&&m.$selfRequired!==void 0?m.$selfRequired?a.concat(u):a.filter(w=>w===u):a,s)),l(p.uniq(s),e,r)}function $(t,e,r){if(r.groups&&r.groups.includes("partial"))return t.discriminator?{...t,required:[t.discriminator.propertyName]}:t;let s=M(t,e,r);return s=p.uniq(s).reduce(h(t,e,r),[]),t.discriminator&&s.push(t.discriminator.propertyName),s.length&&(t.required=s),t}Q("required",$);function V(t,e){return Object.entries(t).reduce((r,[s,a])=>(s=e.get(s)||s,r[s]=a,r),{})}function ce(t){return vr.find(e=>t[e])}const De={string:{properties:Dn,is:p.isString},number:{properties:Cn,is:p.isNumber},boolean:{properties:jn,is:p.isBoolean},array:{properties:Kr,is:()=>!1},object:{properties:kn,is:()=>!1}};function Ne(t,e,r){const s=De[t];s==null||s.properties.concat(Fr).forEach(a=>{e[a]!==void 0&&(Fr.includes(a)?r[a]=e[a].filter(s.is):(r[a]=e[a],delete e[a]))})}function ot(t,e,r){const s=ce(t);return s&&(t[s].forEach(a=>{Ne(a.type,t,a)}),vr.forEach(a=>{t[a]&&r.groups!==!1&&e.$hooks.has(a)&&(t={...t,[a]:e.$hooks.alter(a,t[a],[r.groups])})}),delete t.const,delete t.enum,t.items||t.properties||delete t.type),t}const _t=["name","$required","$hooks","_nestedGenerics",ie.OPENAPI,ie.SWAGGER,ie.JSON],Ot=[];function Zt(t,e){return typeof e=="object"&&["items","properties","additionalProperties"].includes(t)&&Object.keys(e).length===0}function Qt(t,e,r){return typeof e=="object"&&r&&["properties","additionalProperties"].includes(t)}function zr(t,{specType:e=ie.JSON,customKeys:r=!1}){return _t.includes(t)||t.startsWith("#")&&(r===!1||e!==ie.JSON)||e!==ie.JSON&&Ot.includes(t)}function Ur(t,e,r){return t==="examples"&&p.isObject(e)&&[ie.OPENAPI,ie.ASYNCAPI].includes(r.specType)}function Ct(t){let e=!1;t||(e=!0,t={components:{schemas:{}},inlineEnums:!0});const{useAlias:r=!0,components:s={schemas:{}}}=t;return t={...t,useAlias:r,components:s},{addDef:e,options:t}}function wr(t,e){const{useAlias:r}=e;return[...t.keys()].filter(s=>!zr(s,e)).reduce((s,a)=>{let u=t.get(a);if(a=a.replace(/^#/,""),a==="type")return s[a]=t.getJsonType(),s;if(Ur(a,u,e)&&(a="example",u=Object.values(u)[0]),u&&typeof u=="object"&&Ar(a)){if(u=Y(a,[u],e,t),Zt(a,u))return s;Qt(a,u,r)&&(u=V(u,t.alias))}return s[a]=u,s},{})}function Jn(t,e){let r=wr(t,e);return t.isClass&&(r=Y("inheritedClass",[r],{...e,root:!1,target:t.getComputedType()})),r=Y("generics",[r],{...e,root:!1}),t.has(e.specType)&&(r={...r,...t.get(e.specType).toJSON(e)}),p.isFunction(r.default)&&(r.default=r.default()),r=Y("required",[r,t],e),r=Y("nullable",[r,t],e),r=ot(r,t,e),r=Y("enums",[r,t],e),r=Y("discriminatorMapping",[r,t],e),r}function Bn(t,e){const{options:r,addDef:s}=Ct(e),a=Jn(t,r);return s&&Object.keys(p.getValue(r,"components.schemas",{})).length&&(a.definitions=r.components.schemas),a}Q("schema",Bn),Q("discriminatorMapping",Xt,ie.OPENAPI),Q("discriminatorMapping",Xt,ie.SWAGGER),Q("discriminatorMapping",Xt,ie.ASYNCAPI);function Sr(t,e,r){return t=Or(t,e,r),t.const&&(t.enum=[t.const],delete t.const),t}Q("enums",Sr,ie.OPENAPI),Q("enums",Sr,ie.SWAGGER),Q("enums",Sr,ie.ASYNCAPI);function Gn(t,e){e={...e,specType:ie.OPENAPI};const r={paths:Y("paths",[t],e)};return r.tags=p.uniqBy(e.tags,"name"),Object.keys(p.getValue(e,"components.schemas",{})).length&&(r.components={schemas:e.components.schemas}),r}Q("generate",Gn,ie.OPENAPI),Q("generate",Gn,ie.SWAGGER);function Hr(t,e){var r,s,a,u;return e!=null&&e.isNullable?t.$ref?p.cleanObject({...t,...t.$ref&&{anyOf:[{$ref:t.$ref}],type:void 0},nullable:!0,$ref:void 0}):p.cleanObject({...t,...((r=t.anyOf)==null?void 0:r.length)===1?{...t.anyOf[0],anyOf:void 0,type:Number.isInteger(t.multipleOf)?"integer":(s=t.anyOf[0])==null?void 0:s.type}:{type:((a=t.anyOf)==null?void 0:a.length)>1?void 0:t.type,anyOf:(u=t.anyOf)==null?void 0:u.map(m=>(Number.isInteger(m.multipleOf)&&(m.type="integer"),m))},nullable:!0}):t}Q("nullable",Hr,ie.OPENAPI),Q("nullable",Hr,ie.SWAGGER);function qn(t,{jsonSchema:e}){const r={type:"string",format:"binary",oneOf:void 0};return e.type==="array"?(e.items=p.cleanObject({...e.items,...r}),t.schema=e,t):(t.schema=p.cleanObject({...e,...r}),t)}Q("operationInFiles",qn);function Ss(t,e={}){return{...e,groups:t.groups,groupsName:t.groupsName}}function Ln(t,e){var r;const s=Ss(t,e),a={...((r=s.components)==null?void 0:r.schemas)||{}},{type:u,schema:m,...w}=Y("map",[t],s),x=Y("item",[t.$schema],{...s,...Dt(t)});w.required=w.required||t.get("in")===rt.PATH;const D={...s,jsonSchema:x,jsonParameter:t,oldSchemas:a},I=O.camelCase(`operationIn ${t.get("in")}`);return Ar(I)?Y(I,[w],D):(w.schema=x,w)}Q("operationInParameter",Ln);function Kn(t,e){return t.flatMap(r=>Y("operationInParameter",[r],e)).filter(Boolean)}Q("operationInParameters",Kn);function Ms(t,e){if(!e)return;let r=!1;const s=Object.entries(e).reduce((a,[u,{value:m,description:w,...x}])=>m[t]===void 0?a:(r=!0,{...a,[u]:{...x,value:m[t],description:w}}),{});return r?s:void 0}function Es(t,{jsonParameter:e,...r}){var s,a,u;const m=jt(e.$schema.getName(),r),w=(a=(s=r.components)==null?void 0:s.schemas)==null?void 0:a[m];return w&&!((u=r.oldSchemas)!=null&&u[m])&&delete r.components.schemas[e.$schema.getName()],Object.entries((w==null?void 0:w.properties)||{}).reduce((x,[D,{description:I,...ee}])=>[...x,p.cleanObject({...t,name:D,required:((w==null?void 0:w.required)||[]).includes(D),description:I,schema:ee,style:ee.$ref?"deepObject":void 0,examples:Ms(D,t.examples)})],[])}function Fn(t,{jsonSchema:e,jsonParameters:r,...s}){if(e.$ref){if(!t.name)return Es(t,s);t.style="deepObject"}return t.schema=e,t}Q("operationInQuery",Fn);const er=S.codes.reduce((t,e)=>{const r=String(S(e));return{...t,[String(e)]:{label:r,code:O.constantCase(r)}}},{});er[200].label="Success",er[200].code="SUCCESS";function Wn(t){var e;return(e=er[t])==null?void 0:e.code}function kt(t){var e;return(e=er[t])==null?void 0:e.label}function zn(t,e){return t.get("parameters").filter(r=>lr(r.get("in"))).reduce((r,s)=>{const[a,u]=r;return[rt.BODY,rt.FILES].includes(s.get("in"))?[a,[...u,s]]:[[...a,s],u]},[[],[]])}function Vr(t,{tags:e=[],defaultTags:r=[],...s}={}){var a,u;const{consumes:m,produces:w,...x}=Y("map",[t],{...s,ignore:["parameters"]});x.security&&(x.security=[].concat(x.security)),t.get("responses").size===0&&(x.responses={200:{description:kt(200)}});const D={...s,consumes:(a=t.get("consumes"))!=null&&a.length?t.get("consumes"):["application/json"]},[I,ee]=zn(t);x.parameters=Y("operationInParameters",[I],s),ee.length&&(x.requestBody=Y("operationRequestBody",[ee],D));const Ee=(u=x.tags)!=null&&u.length?x.tags:r;return Ee.length&&(x.tags=Ee.map(({name:Ye})=>Ye)),e.push(...Ee),x}Q("operation",Vr);function Yr(t,e){let r=[...t.groups||[]];return Y("map",[t],{...e,groups:r,groupsName:t.groupsName})}Q("operationMedia",Yr);class Xr extends Ve{constructor(e={}){super(e),this.$kind="operationRequestBody",this.content(e.content||{})}description(e){return this.set("description",e),this}content(e){return this.set("content",tt(e)),this}addContent(e,r,s){const a=this.get("content"),u=new Ve;return u.set("schema",r),s&&u.set("examples",s),a.set(e,u),this}required(e){return this.set("required",e),this}}function Un(t,e){let r=new We;const s={},a=[];let u=0;const m=t.some(w=>w.get("in")==="files");return t.forEach(w=>{const x=w.getName();[...w.entries()].filter(([I])=>!["in","name"].includes(I)).forEach(([I,ee])=>{s[I]===void 0&&(s[I]=ee)});const D=Y("operationInParameter",[w],e);if(x){const I={...D.schema||{type:D.type}};m&&D.description&&(I.description=D.description),r.addProperty(x,I),w.get("required")&&r.addRequired(x),u++}else a.push(D)}),!u&&a.length===1?a[0]:(r.type("object"),s.description&&m&&delete s.description,{schema:r.toJSON(e),required:!1,...s})}function Zr(t,{consumes:e,...r}){const{schema:s,description:a,examples:u,in:m,...w}=Un(t,r),x=new Xr(w);return a&&x.description(a),e.forEach(D=>{x.addContent(D,s,u)}),Y("map",[x],r)}Q("operationRequestBody",Zr);function re(t,e={}){const r=Y("map",[t],e);return t.status===204&&delete r.content,r.headers&&Object.entries(r.headers).forEach(([s,{type:a,...u}])=>{r.headers[s]={...u,schema:{type:a}}}),r}Q("operationResponse",re);function xt(t,e){return t.map(r=>e.parameters.find(s=>s.in===r.in&&s.name===r.name)||r).concat(...e.parameters.filter(r=>r.in!=="path"))}function Ps(t){const[e,r]=t.split("="),s=(r||e).split("."),a=s.splice(0,1)[0];return{prefix:r&&e?`${e}=`:"",name:a,postfix:s.length?`.${s.join(".")}`:""}}function Ce(t){let e=0;return t.split("").filter(r=>{r==="("&&e++;const s=e===0;return r===")"&&e--,s}).join("").split("/").filter(r=>!!r)}function Hn(t,e=""){e instanceof RegExp&&(e=e.toString().replace(/^\//g,"").replace(/\/$/g,"").replace(/\\/g,""));const r=[],s=[];let a=!1,u="";return Ce(`${t}${e}`).map(m=>{const w=m.replace(":","").replace("?","");if(m.includes(":")){const x=m.includes("?");x&&!a&&(a=!0,s.push({path:u,parameters:[].concat(r)}));const{prefix:D,name:I,postfix:ee}=Ps(w);u+=`/${D}{${I}}${ee}`,r.push({in:"path",name:I,type:"string",required:!0}),x&&a&&s.push({path:u,parameters:[].concat(r)})}else u+=`/${m}`}),s.length?s:[{path:u,parameters:[].concat(r)}]}const Ts="%c.%m";function Qr(t=""){const e=new Map,r=(s,a)=>{const u=(t||Ts).replace(/%c/,s).replace(/%m/,a);return t===""?O.camelCase(u):u};return(s,a,u="")=>{const m=r(s,a),w=s+a;if(!e.has(w))return e.set(w,0),m;const x=u.match(/{(\w+)}/gi);if(x){const I=s+a+x[0];if(!e.has(I))return e.set(I,0),O.camelCase(`${m} By ${x}`)}const D=e.get(w)+1;return e.set(w,D),`${m}_${D}`}}function Vn(t,{store:e,operationIdFormatter:r}){return r(e.parent.schema.get("name")||e.parent.targetName,e.propertyName,t)}const at=[ye.ALL,ye.GET,ye.POST,ye.PUT,ye.PATCH,ye.HEAD,ye.OPTIONS,ye.DELETE,ye.TRACE];function Yn(t,{path:e,method:r,operation:s}){return{...t,[e]:{...t[e],[r.toLowerCase()]:s}}}function Mr(t){return({operationPath:e,operation:r,operationStore:s})=>{const{path:a,method:u}=e;return Hn(t.ctrlRootPath,a).map(({path:m,parameters:w})=>(m=m||"/",w=xt(w.map(({type:x,...D})=>({...D,schema:{type:x}})),r),{operation:{...r,...e.toJSON(t),parameters:w,operationId:r.operationId||Vn(m,{...t,store:s})},method:u,path:m}))}}function Xn(t){return e=>{const r=e.operation.getAllowedOperationPath(at);if(r.length===0)return[];const s=Y("operation",[e.operation],t);return r.map(a=>({operationPath:a,operation:s,operationStore:e}))}}function Zn(t,{paths:e,rootPath:r,...s}){const a=He(t).path,u=ut(r+a);return s={...s,ctrlRootPath:u},[...mr(t).values()].filter(Gr).filter(m=>m.operation.getAllowedOperationPath(at).length>0).flatMap(Xn(s)).flatMap(Mr(s)).reduce(Yn,e)}Q("paths",Zn);function U(t){return(...e)=>{const r=t(He(...e),e);typeof r=="function"&&r(...e)}}function Qn(...t){return U(e=>{e.store.set("childrenControllers",t),t.forEach(r=>{p.Store.from(r).set("parentController",e.token)})})}function es(t,...e){return U(r=>{t=t||O.snakeCase(r.targetName),r.discriminatorAncestor&&r.schema.discriminatorValue(t,...e)})}function tr(t,e){if(!t)throw new Error("A type is required on `@CollectionOf(type)` decorator. Please give a type or wrap it inside an arrow function if you have a circular reference.");const r={};let s=!1;const a=(...u)=>{const m=Oe.from(...u);e&&(m.collectionType=e,m.schema.type(e)),m.type=t,m.itemSchema.type(t),m.schema.assign(r),m.isArray&&s&&(m.schema.set("contains",m.schema.get("items")),m.schema.delete("items"))};return a.MinItems=u=>(r.minItems=u,a),a.MaxItems=u=>(r.maxItems=u,a),a.MinProperties=u=>(r.minProperties=u,a),a.MaxProperties=u=>(r.maxProperties=u,a),a.Contains=()=>(s=!0,a),a.UniqueItems=(u=!0)=>(r.uniqueItems=u,a),a}function ts(t){return tr(t,Array)}function rs(t){return tr(t,Map)}function en(t){return tr(t).Contains()}function xe(t,e){const r={};return(...s)=>{const a=p.useDecorators(e(...s));return a.Error=u=>(r.message=u,p.useDecorators(a,r.message&&U(m=>{const w=m.parentSchema.get("#errorMessage")||{};t==="required"?m.parentSchema.customKey("errorMessage",p.deepMerge(w,{[t]:{[m.propertyName]:u}})):m.itemSchema.customKey("errorMessage",p.deepMerge(w,{[t]:u}))}))),a}}const _s=xe("maxItems",t=>{if(t<0)throw new Error("The value of maxItems MUST be a non-negative integer.");return U(e=>{e.schema.maxItems(t)})}),xs=xe("maxProperties",t=>{if(t<0)throw new Error("The value of maxProperties MUST be a non-negative integer.");return U(e=>{e.isCollection?e.schema.maxProperties(t):e.itemSchema.maxProperties(t)})}),As=xe("minItems",t=>{if(t<0)throw new Error("The value of minItems MUST be a non-negative integer.");return U(e=>{e.schema.minItems(t)})}),rr=xe("minProperties",t=>{if(t<0)throw new Error("The value of minProperties MUST be a non-negative integer.");return U(e=>{e.isCollection?e.schema.minProperties(t):e.itemSchema.minProperties(t)})}),$s=xe("uniqueItems",(t=!0)=>U(e=>{e.schema.uniqueItems(t)}));function Rs(t){return U((e,r)=>{e.itemSchema.additionalProperties(t)})}function Ds(...t){return U(e=>{e.itemSchema.allOf(t)})}function It(t){return U(e=>{t&&((p.isClass(t)||p.isArrowFn(t))&&(e.type=t),e.itemSchema.type(t))})}function y(...t){const e=t.find(r=>p.isClass(r));return p.useDecorators(e&&It(e),U((r,s)=>{r.decoratorType===p.DecoratorTypes.PARAM&&(r.required=!0),r.decoratorType===p.DecoratorTypes.PROP&&r.parentSchema.addRequired(r.propertyName),r.schema.allow(...t)}))}function v(...t){return U(e=>{e.itemSchema.any(...t)})}function E(...t){return U(e=>{e.itemSchema.anyOf(t)})}function j(t){return U(e=>{e.itemSchema.const(t)})}function X(t,e){return U(r=>{r.itemSchema.customKey(t,e)})}function Je(t){return U(e=>{Object.entries(t).forEach(([r,s])=>{e.itemSchema.customKey(r,s)})})}function ke(t){return U(e=>{e.itemSchema.default(t)})}function oe(t){return U(e=>{const r=e.parentSchema.get("#errorMessage")||{};e.parentSchema.customKey("errorMessage",{...r,...t})})}function k(t){return p.useDecorators(oe({_:t}))}function q(t){return U((e,r)=>{var s;switch(p.decoratorTypeOf(r)){case p.DecoratorTypes.PROP:case p.DecoratorTypes.CLASS:e.schema.description(t);break;case p.DecoratorTypes.PARAM:e.parameter.description(t);break;case p.DecoratorTypes.METHOD:(s=e.operation)==null||s.description(t);break}})}function K(){return p.useDecorators(It(),U(t=>{t.discriminatorKey()}))}function z(t,...e){return U(r=>{r.itemSchema.enum(t,...e)})}const le=xe("enum",z);function Pe(...t){return U(e=>{e.schema.examples(t)})}function je(t){return U(e=>{e.parameter.examples(t)})}const Qe=xe("maximum",(t,e=!1)=>U(r=>{e?r.itemSchema.exclusiveMaximum(t):r.itemSchema.maximum(t)})),ns=Qe,js=xe("exclusiveMaximum",(t,e=!0)=>Qe(t,e)),tn=xe("minimum",(t,e=!1)=>U(r=>{e?r.itemSchema.exclusiveMinimum(t):r.itemSchema.minimum(t)})),Ko=tn,Fo=xe("exclusiveMinimum",(t,e=!0)=>tn(t,e));var nt=(t=>(t.DATE_TIME="date-time",t.DATE="date",t.TIME="time",t.EMAIL="email",t.HOSTNAME="hostname",t.IPV4="ipv4",t.IPV6="ipv6",t.URI="uri",t.URL="url",t.URI_REF="uri-reference",t.URI_TEMPLATE="uri-template",t.JSON_POINTER="json-pointer",t.RELATIVE_JSON_POINTER="relative-json-pointer",t.UUID="uuid",t.REGEX="regex",t))(nt||{});const nr=xe("format",t=>U(e=>{e.itemSchema.format(t)})),Wo=xe("format",()=>nr(nt.EMAIL)),zo=xe("format",()=>nr(nt.DATE_TIME)),Uo=xe("format",()=>nr(nt.DATE)),Ho=xe("format",()=>nr(nt.TIME)),Vo=xe("format",()=>nr(nt.URI)),Yo=xe("format",()=>nr(nt.URL));function Xo(t=!0){return U(e=>{e.schema.$forwardGroups=t})}function mi(t,e){e=[].concat(e),t=[].concat(t);let r=new Set,s=new Set,a=new Set,u=0,m=w=>{a.add(w.output)};for(let w=0;w<e.length;w++){let x=N(String(e[w]),{onResult:m},!0),D=x.state.negated||x.state.negatedExtglob;D&&u++;for(let I of t){let ee=x(I,!0);(D?!ee.isMatch:ee.isMatch)&&(D?r.add(ee.output):(r.delete(ee.output),s.add(ee.output)))}}return!!(u===e.length?[...a]:[...s]).filter(w=>!r.has(w)).length}function Cs(t,e=[]){const r=t.filter(a=>a.startsWith("!")).map(a=>a.replace("!","")),s=t.filter(a=>!a.startsWith("!"));return r.length&&e.length&&mi(r,e)?!0:s.length?!mi(t.filter(a=>!a.startsWith("!")),e):!1}function Zo(t,e){const r=Object.entries(t[0]);e.children.forEach(s=>{const a=r.filter(([,u])=>u.includes(s.propertyName)).map(([u])=>u);ks(...a)(s.target,s.propertyKey)})}function ks(...t){return U(e=>{switch(e.decoratorType){case p.DecoratorTypes.CLASS:Zo(t,e);break;case p.DecoratorTypes.PROP:X("x-groups",t)(e.target,e.propertyKey),e.schema.$hooks.on("groups",(s,a)=>!s&&Cs(t,a)?!0:s);break;case p.DecoratorTypes.PARAM:let r="";t.length==2&&p.isArray(t[1])&&(r=t[0],t=t[1]),e.parameter.groups=t,e.parameter.groupsName=r;break}})}function Qo(){return p.StoreSet("hidden",!0)}function ea(t=!0){return U(e=>{e.schema.ignore(t)})}function ta(){return U(t=>{t.itemSchema.type("integer")})}function ra(t,e=!1){return U(r=>{e?r.schema.label(t):r.itemSchema.label(t)})}const na=xe("maxLength",t=>{if(t<0)throw new Error("The value of maxLength MUST be a non-negative integer.");return U(e=>{e.itemSchema.maxLength(t)})}),sa=xe("minLength",t=>{if(t<0)throw new Error("The value of minLength MUST be a non-negative integer.");return U(e=>{e.itemSchema.minLength(t)})}),ia=xe("multipleOf",t=>{if(t<=0)throw new Error("The value of multipleOf MUST be a number, strictly greater than 0.");return U(e=>{e.itemSchema.multipleOf(t)})});function di(t){return U((e,r)=>{switch(p.decoratorTypeOf(r)){case p.DecoratorTypes.CLASS:e.schema.name(t);break;case p.DecoratorTypes.PARAM:e.parameter.name(t);break;default:e.parent.schema.addAlias(r[1],t)}})}function oa(t,...e){return e=[t,...e],p.useDecorators(e.length===1&&It(e[0]),v(null,...e))}function aa(...t){return U(e=>{e.itemSchema.oneOf(t)})}function yi(){return U(t=>{switch(t.decoratorType){case p.DecoratorTypes.PARAM:t.required=!1;break;case p.DecoratorTypes.PROP:t.parentSchema.removeRequired(t.propertyName);break}})}const ca=xe("pattern",t=>U(e=>{e.itemSchema.pattern(t)}));function ua(t=!0){return U(e=>{e.itemSchema.readOnly(t)})}function gi(t){return U(e=>{e.schema.assign(t)})}function pa(t,e){return U(r=>{r.schema.set(t,e)})}function la(t,...e){return gi({properties:{...e.reduce((r,s)=>({...r,[s]:t}),{})}})}const fa=xe("required",(t=!0,...e)=>t?y(...e):yi());function ha(...t){return U(e=>{e.parent.schema.$hooks.on("requiredGroups",(r,s)=>Cs(t,s)?r.filter(a=>a!==e.propertyKey):r)})}function ma(t){return U(e=>{e.schema.title(t)})}function da(t){return U(()=>p.useDecorators(oe({type:t})))}function ya(t=!0){return U(e=>{e.itemSchema.writeOnly(t)})}function Le(t=Object){if(p.isClass(t)){const{schema:e}=He(t);return e.properties=function(r){return Object.entries(r).forEach(([s,a])=>{He(t.prototype,s).schema.assign(a)}),this},e}return We.from({type:t})}function ss(){return Le(String)}function ga(t){return p.isObject(t)&&!("toJSON"in t)}function Oa(...t){const e=[t.map(s=>ga(s)?ss().enum(Object.values(s)):s)],r=(...s)=>{const a=Oe.from(...s);a.nestedGenerics=e};return r.Nested=(...s)=>(e.push(s),r),r}function va(...t){return e=>{const r=Oe.from(e);r.schema.genericLabels=t}}function rn(...t){return U((e,r)=>{switch(e.decoratorType){case p.DecoratorTypes.METHOD:e.operation.consumes(t);break;case p.DecoratorTypes.CLASS:p.decorateMethodsOf(r[0],rn(...t));break;default:throw new p.UnsupportedDecoratorType(rn,r)}})}function ba(...t){return p.useDecorators(rn(...t),p.StoreSet("acceptMimes",t))}class Is extends Map{constructor(e={}){super(),this.actions=[],Object.entries(e).forEach(([r,s])=>{this.set(r,s)})}addAction(e){return this.actions.push(e),this}build(){const e=(...a)=>this.bind(a,e),r=a=>(...u)=>(a(...u),e),s=a=>r((...u)=>{a in this?this[a](...u):this.set(a,u[0])});return this.methods.forEach(a=>{e[O.pascalCase(a)]=s(a)}),e}toObject(){return[...this.entries()].reduce((e,[r,s])=>({...e,[r]:s}),{})}getMergedKey(e,r){let s=this.get(e)||r;if(s)return this.decoratorType===p.DecoratorTypes.CLASS&&(s={...s,...r||{}}),{...r||{},...s}}bind(e,r){this.entity=Oe.from(...e),this.beforeInit(),this.onInit(e,r),this.afterInit()}onInit(e,r){this.forEach((s,a)=>{this.onMapKey(a,s)})}onMapKey(e,r){this.entity.set(e,r)}runActions(){return this.actions.forEach(e=>{e(this)}),this}beforeInit(){}afterInit(){}}const Oi=new Map;function wa(t,e){Oi.set(t,e)}function vi(t){return Oi.get(t)}function Sa(t){return p.isObject(t)&&!("toJSON"in t)}function bi(t){return t.map(e=>Sa(e)?ss().enum(Object.values(e)):e)}class Ma extends Is{constructor({status:e,model:r}){super(),this.methods=["contentType","description","examples","type","status","of","ofInteger","oneOf","allOf","anyOf","nested","header","headers","schema","title","groups","allowedGroups","location","binary"],this.model(r),this.status(e)}type(e){return this.model(e)}model(e){return e&&this.set("model",e),this}status(e){return this.set("status",e),e&&kt(e)&&!this.get("description")&&(this.set("description",kt(e)),this.get("model")||this.model(vi(+e))),this}headers(e){return this.set("headers",{...this.get("headers")||{},...Ir(e)}),this}header(e,r){return r===void 0&&p.isString(e)?this.headers({[e]:{type:"string"}}):this.headers({[e]:r})}location(e,r={}){return this.headers({Location:{...r,value:e}}),this}groups(...e){return e.length===2&&p.isArray(e[1])?(this.set("groupsName",e[0]),this.set("groups",e[1])):this.set("groups",e),this}allowedGroups(...e){return this.set("allowedGroups",new Set(e)),this}nested(...e){const r=this.get("model");return this.checkPrimitive(r),this.checkCollection(r),this.addAction(s=>{this.get("schema").nestedGenerics.push(bi(e))}),this}of(...e){const r=this.get("model");return this.checkPrimitive(r),this.addAction(()=>{const s=this.get("schema");p.isCollection(r)?s==null||s.itemSchema({type:e[0]}):s==null||s.nestedGenerics.push(bi(e))}),this}ofInteger(){return this.of("integer")}oneOf(...e){return this.manyOf("oneOf",e)}allOf(...e){return this.manyOf("allOf",e)}anyOf(...e){return this.manyOf("anyOf",e)}schema(e){return this.addAction(()=>{this.get("schema").assign(e)}),this}examples(e){return this.set("examples",p.isString(e)?[e]:e),this}title(e){return this.schema({title:e})}binary(){return this.type(String),this.set("contentType","application/octet-stream"),this.schema({format:"binary"}),this}checkPrimitive(e){if(p.isPrimitiveOrPrimitiveClass(e))throw new Error("Returns.Of cannot be used with the following primitive classes: String, Number, Boolean")}checkCollection(e){if(p.isCollection(e))throw new Error("Returns.Nested cannot be used with the following classes: Map, Set, Array, String, Number, Boolean")}getContentType(){const e=this.get("model");let r=this.get("contentType");return(e&&!p.isPlainObject(e)&&!p.isPrimitiveOrPrimitiveClass(e)||this.hasOfTypes)&&(r=r||"application/json"),r}getStatus(){return this.get("status")||"default"}onInit(e,r){switch(p.decoratorTypeOf(e)){case p.DecoratorTypes.METHOD:this.entity=Oe.from(...e),this.entity.operation&&this.map();break;case p.DecoratorTypes.CLASS:this.decoratorType=p.DecoratorTypes.CLASS,p.decorateMethodsOf(e[0],r);break}}map(){const e=this.get("model"),{entity:r,decoratorType:s}=this,a=this.entity.operation,u=this.getStatus(),m=a.ensureResponseOf(u),w=this.getContentType();let{description:x=m.get("description")}=this.toObject();x&&(x=s===p.DecoratorTypes.CLASS&&m.get("description")||x,m.description(x));const D=this.getMergedKey("headers",m.get("headers"));return D&&m.headers(D),this.mapMedia(m),(ur(this.get("status"))||u==="default")&&e&&(r.type=e),w&&a.addProduce(w),this.runActions()}mapMedia(e){const r=this.getContentType(),s=this.get("model"),a=e.getMedia(r||"*/*"),u=a.get("schema")||new We({type:s}),m=this.get("groups"),w=this.get("groupsName"),x=this.get("allowedGroups"),D=this.entity.operation;if(s&&(p.isArray(s)?u.oneOf(s.map(ee=>({type:ee}))):u.type(s)),this.set("schema",u),a.schema(u),a.groups=m,a.groupsName=w,x){a.allowedGroups=x;const ee=new Rt;ee.in("query").name("includes"),ee.schema(We.from({type:"array",items:{type:"string",enum:[...x]}})),D.addParameter(-1,ee)}const I=this.get("examples");return I&&a.examples(I),a}manyOf(e,r){const s=this.get("model");return this.hasOfTypes=!0,this.addAction(()=>{const a=this.get("schema");p.isCollection(s)?(a.type(s||Object),a.itemSchema().set(e,r)):a.set(e,r)}),this}}function sr(t,e){return new Ma({status:t,model:e}).build()}function Ea(t){return sr().ContentType(t)}function Ns(t=!0){return U((e,r)=>{switch(p.decoratorTypeOf(r)){case p.DecoratorTypes.METHOD:e.operation.deprecated(t);break;case p.DecoratorTypes.CLASS:p.decorateMethodsOf(r[0],Ns(t));break;case p.DecoratorTypes.PARAM:e.parameter.set("deprecated",t);break;case p.DecoratorTypes.PROP:e.schema.set("deprecated",t);break;default:throw new p.UnsupportedDecoratorType(Ns,r)}})}function Pa(t,e){return e!==void 0&&(t={[t]:e}),e===void 0&&p.isString(t)&&(t={[t]:{type:"string"}}),sr().Headers(t)}function Js(t){const e=new Rt,r={},s=(a,u,m)=>{const w=Oe.from(a,u,m);switch(w.decoratorType){case p.DecoratorTypes.PARAM:w.parameter.in(t);break;case p.DecoratorTypes.METHOD:e.in(t),w.operation.addParameter(-1,e),e.schema(We.from(r));break;case p.DecoratorTypes.CLASS:p.decorateMethodsOf(a,s);break;default:throw new p.UnsupportedDecoratorType(Js,[a,u,m])}};return s.Type=a=>(r.type=a,s),s.Name=a=>(e.name(a),s),s.Description=a=>(e.description(a),s),s.Required=(a=!0)=>(e.required(a),s),s.Pattern=a=>s.Schema({pattern:a.toString()}),s.Schema=a=>(Object.assign(r,a.toJSON?a.toJSON():a),s),s}function Ta(t){return(...e)=>{const[r,s,a]=e,u=p.Metadata.getParamTypes(r,s)[a]===Array;t=typeof t=="object"?void 0:t;const m=[t,!u&&"0"].filter(Boolean).join(".");p.useDecorators(Js(rt.FILES),di(m),p.useMethodDecorators(sr(400).Description("<File too long | Too many parts | Too many files | Field name too long | Field value too long | Too many fields | Unexpected field> [fieldName] Example: File too long file1"),rn("multipart/form-data")))(...e)}}function _a(t,e){return sr().Location(t,e)}const xa=new Set([...Object.keys(ye).filter(t=>t!==ye.CUSTOM).map(t=>t.toLowerCase())]);function wi(t){let e,r;const s=t.filter(a=>typeof a=="string"&&xa.has(a.toLowerCase())?(e=a.toLocaleUpperCase(),!1):typeof a=="string"||a instanceof RegExp?(r=a||"/",!1):!!a);return{path:r,method:e,use:s}}class Aa extends Is{constructor(){super(...arguments),this.methods=["name","description","summary","method","id","use","useAfter","useBefore"]}beforeInit(){const e=this.get("path"),r=ye[this.get("method")]||ye.CUSTOM;e&&(this.operationPath=this.entity.operation.addOperationPath(r,e))}onMapKey(e,r){var s,a;switch(e){case"name":case"id":this.entity.operation.operationId(r);return;case"summary":(s=this.operationPath)==null||s.summary(r),this.entity.operation.summary(r);return;case"description":(a=this.operationPath)==null||a.description(r),this.entity.operation.description(r);return;case"use":this.entity.use(r);return;case"useAfter":this.entity.after(r);return;case"useBefore":this.entity.before(r);return}return super.onMapKey(e,r)}}function ht(...t){const e=wi(t);return new Aa(e).build()}function Si(t){return U((e,r)=>{if(e.decoratorType!==p.DecoratorTypes.METHOD)throw new p.UnsupportedDecoratorType(Si,r);e.operation.operationId(t)})}function Mi(t,e="/"){return U((r,s)=>{if(r.decoratorType!==p.DecoratorTypes.METHOD)throw new p.UnsupportedDecoratorType(Mi,s);r.operation.addOperationPath(t.toUpperCase(),e)})}function $a(){return ks("partial")}function Ei(t){return U((e,r)=>{if(e.decoratorType!==p.DecoratorTypes.CLASS)throw new p.UnsupportedDecoratorType(Ei,r);e.path=t})}function Bs(...t){return U((e,r)=>{switch(e.decoratorType){case p.DecoratorTypes.METHOD:e.operation.produces(t);break;case p.DecoratorTypes.CLASS:p.decorateMethodsOf(r[0],Bs(...t));break;default:throw new p.UnsupportedDecoratorType(Bs,r)}})}function Ra(t){return ht(ye.PUBLISH,t)}function Da(...t){const{status:e,url:r,meta:s}=t.reduce((a,u)=>p.isNumber(u)?(a.status=u,a):p.isString(u)?(a.url=u,a):(a.meta=u,a),{status:302,url:"",meta:{}});return p.useDecorators(sr(e).Location(r,s),U(a=>{var u;(u=a.operation)==null||u.setRedirection(e)}))}function ja(t="/",...e){return ht(...[ye.ALL,t].concat(e))}function Ca(t="/",...e){return ht(...[ye.GET,t].concat(e))}function ka(t="/",...e){return ht(...[ye.POST,t].concat(e))}function Ia(t="/",...e){return ht(...[ye.PUT,t].concat(e))}function Na(t="/",...e){return ht(...[ye.DELETE,t].concat(e))}function Ja(t="/",...e){return ht(...[ye.HEAD,t].concat(e))}function Ba(t="/",...e){return ht(...[ye.PATCH,t].concat(e))}function Ga(t="/",...e){return ht(...[ye.OPTIONS,t].concat(e))}function is(t,...e){return U((r,s)=>{switch(r.decoratorType){case p.DecoratorTypes.METHOD:Array.isArray(t)?r.operation.security(t):r.operation.addSecurityScopes(t,e);break;case p.DecoratorTypes.CLASS:Array.isArray(t)?p.decorateMethodsOf(s[0],is(t)):p.decorateMethodsOf(s[0],is(t,...e));break;default:throw new p.UnsupportedDecoratorType(is,s)}})}function qa(t,e){return sr(t,e)}function La(t){return ht(ye.SUBSCRIBE,t)}function Pi(t){return U((e,r)=>{if(e.decoratorType!==p.DecoratorTypes.METHOD)throw new p.UnsupportedDecoratorType(Pi,r);e.operation.summary(t)})}function Ka(t){return t.map(e=>typeof e=="string"?{name:e}:e)}function Gs(...t){return U((e,r)=>{switch(e.decoratorType){case p.DecoratorTypes.METHOD:e.operation.addTags(Ka(t));break;case p.DecoratorTypes.CLASS:p.decorateMethodsOf(r[0],Gs(...t));break;default:throw new p.UnsupportedDecoratorType(Gs,r)}})}function Fa(t,e){return p.StoreSet("view",{path:t,options:e})}function qs(t,e){if(t instanceof RegExp||e instanceof RegExp){if(!t)return e;if(!e)return t;const s=t instanceof RegExp?t:new RegExp(t,"gi"),a=e instanceof RegExp?e:new RegExp(e,"gi");return new RegExp(s.source+a.source,(s.global?"g":"")+(s.ignoreCase?"i":"")+(s.multiline?"m":""))}t&&e&&t.endsWith("/")&&e.startsWith("/")&&(e=e.slice(1));const r=(t||"")+(e||"");return r.endsWith("/")&&r.length>1?r.slice(0,-1):r}class Ti{constructor(e){Object.assign(this,e),this.paramsTypes=this.endpoint.getParamTypes()}get url(){return this.fullPath}get path(){var e;return(e=this.operationPath)==null?void 0:e.path}get fullPath(){return qs(this.basePath,this.path)}get method(){var e;return((e=this.operationPath)==null?void 0:e.method)||"USE"}get name(){return`${this.endpoint.targetName}.${this.methodClassName}()`}get className(){return this.endpoint.targetName}get methodClassName(){return this.propertyKey}get parameters(){return this.endpoint.parameters}get propertyKey(){return String(this.endpoint.propertyKey)}get propertyName(){return this.endpoint.propertyName}get store(){return this.endpoint.store}get operation(){return this.endpoint.operation}get operationId(){return this.operation.get("operationId")||this.endpoint.propertyKey}has(e){return this.paramsTypes[e]}}function Wa(...t){return Le().allOf(t)}function za(...t){return Le().any(...t)}function Ua(...t){return Le().anyOf(t)}function Ha(){return Le(Boolean)}function Va(){return Le(Array)}function Ya(){return Le(Map).unknown(!0)}function Xa(){return Le(Array).uniqueItems(!0)}function Za(){return Le(Date).format(nt.DATE)}function Qa(){return Le(Date).format(nt.DATE_TIME)}function ec(){return Le(Date).format(nt.TIME)}function tc(){return Le(String).format(nt.EMAIL)}function rc(t){const e=ss().enum(t);return Kt.set(t,e),e}function nc(){return Le(Number).integer()}function sc(t){try{if(t())return Oe.from(t()).schema}catch{}return new gr(t)}function ic(){return Le(Number)}function oc(t={}){return Le(Object).properties(t)}function ac(...t){return Le().oneOf(t)}function cc(){return Le(String).format(nt.URI)}function uc(){return Le(String).format(nt.URL)}const os=p.mergeReducerBuilder((t,e)=>t.type&&t.type&&t.type===e.type&&e.type==="array"?JSON.stringify(t.items)===JSON.stringify(e.items):t.type&&t.type===e.type||t.$ref&&t.$ref===e.$ref),_i=p.mergeReducerBuilder((t,e)=>t.in===e.in&&t.name===e.name),xi=p.mergeReducerBuilder((t,e)=>!!Object.keys(e).find(r=>!!t[r])),Ai=p.mergeReducerBuilder((t,e)=>t.name===e.name),pc={security:xi,parameters:_i,oneOf:os,anyOf:os,allOf:os,tags:Ai};function as(t,e){return p.deepMerge(t,e,{reducers:pc,cleanUndefinedProps:!0})}const Ls=new Map;function lc(t,e,r){Ls.has(t)||Ls.set(t,new Map);const s=Ls.get(t),a=JSON.stringify(e);return s.has(a)||s.set(a,r()),s.get(a)}function fc(t,e){const r=He(t),{rootPath:s="/"}=e;return e={...e,rootPath:s,defaultTags:[p.cleanObject({name:r.schema.getName(),description:r.schema.get("description")})]},Y("generate",[r],e)}function Ks(t,e={}){if(e={specType:ie.OPENAPI,...e,tags:[],paths:{},channels:{},components:{},operationIdFormatter:e.operationIdFormatter||Qr(e.operationIdPattern),root:!1},p.isArray(t)){let r={};return e={...e,append(s){r=as(r,s)}},t.forEach(({token:s,...a})=>{const u=Ks(s,{...e,...a});e.append(u)}),r}return lc(t,e,()=>fc(t,e))}function $i(t){return t.startsWith("3.")?ie.OPENAPI:ie.SWAGGER}function Ri(t){return"openapi"in t?ie.OPENAPI:ie.SWAGGER}function Fs(t){const{title:e,description:r,version:s,termsOfService:a,contact:u,license:m}=t;return p.cleanObject({version:s,title:e,description:r,termsOfService:a,contact:u,license:m})}function Ws(t,{version:e,specVersion:r,acceptMimes:s=["application/json"]}){const{paths:a,security:u,tags:m,host:w,basePath:x,schemes:D,consumes:I=[],produces:ee=["application/json"],definitions:Ee,parameters:Ye,responses:ve,securityDefinitions:vt,externalDocs:At}=t;return{swagger:r,consumes:p.uniq([...s,...I]),produces:p.uniq([...ee]),info:Fs(p.getValue(t,"info",{})),paths:a,host:w,basePath:x,schemes:D,definitions:Ee,parameters:Ye,responses:ve,security:u,securityDefinitions:vt,tags:m,externalDocs:At}}function zs(t,{specVersion:e}){const{servers:r,paths:s,components:a,security:u,tags:m,externalDocs:w}=t;return{openapi:e,info:Fs(p.getValue(t,"info",{})),servers:r,paths:s,components:a,security:u,tags:m,externalDocs:w}}function Di(t,{fileSpec:e,acceptMimes:r,specVersion:s,version:a}){s=s||p.getValue(t,"openapi",p.getValue(t,"swagger","2.0"));const u={specVersion:s,acceptMimes:r};switch($i(s)){case ie.OPENAPI:t=zs(t,u),e=e&&zs(e,u);break;default:case ie.SWAGGER:t=Ws(t,u),e=e&&Ws(e,u);break}return t=as(t,e),p.setValue(t,"info.title",p.getValue(t,"info.title","Api documentation")),p.setValue(t,"info.version",p.getValue(t,"info.version",a)),t}const hc=["get","put","post","delete","options","head","patch","trace"],mc=["format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","minLength","maxLength","multipleOf","minItems","maxItems","uniqueItems","minProperties","maxProperties","additionalProperties","pattern","enum","default"],dc=["type","items"],yc=/^(application\/json|[^;\/ \t]+\/[^;\/ \t]+[+]json)[ \t]*(;.*)?$/,cs={APPLICATION_X_WWW_URLENCODED:"application/x-www-form-urlencoded",MULTIPART_FORM_DATA:"multipart/form-data"};function gc(t){return t.replace("#/components/schemas/","#/definitions/").replace("#/components/","#/x-components/")}function Us(t){if(Array.isArray(t))t.forEach(Us);else if(typeof t=="object")for(let e in t)e==="$ref"?t.$ref=gc(t.$ref):Us(t[e])}function ji(t){return new RegExp(yc,"i").test(t)}function Ci(t){const e=Object.keys(cs).map(r=>cs[r]);return Object.keys(t).filter(r=>e.indexOf(r)>-1||ji(r))}function ki(t){function e(r){const{scheme:s,type:a,name:u,bearerFormat:m,flows:w,...x}=r;switch(a){case"http":if(s==="basic")return{...x,type:s};if(s==="bearer")return{...x,type:"apiKey",name:"Authorization",in:"header"};break;case"oauth2":const D=Object.keys(w)[0],I=w[D];let ee=D;return ee==="clientCredentials"?ee="application":ee==="authorizationCode"&&(ee="accessCode"),{type:a,flow:ee,authorizationUrl:I.authorizationUrl,tokenUrl:I.tokenUrl,scopes:I.scopes}}}return Object.entries(t).reduce((r,[s,a])=>{const u=e(a);return u&&(r[s]=u),r},{})}function Ii(t){let e=t.url;const r=t.variables||{};for(const a in r){const u=r[a]||{};if(u.default){const m=RegExp(`{${a}}`,"g");e=e.replace(m,u.default)}}const s=new URL(e);return{host:s.host?s.host:void 0,basePath:s.pathname,schemes:s.protocol!==null?[s.protocol.substring(0,s.protocol.length-1)]:void 0}}class Ni{constructor(e){this.spec=JSON.parse(JSON.stringify(e))}convertInfos(){const e=this.spec.servers&&this.spec.servers[0];return e?Ii(e):{}}resolveReference(e,r,s){if(!r||!r.$ref)return r;const a=r.$ref;if(a.startsWith("#")){const u=a.split("/").map(w=>w.replace(/~1/g,"/").replace(/~0/g,"~"));u.shift();let m=e;return u.forEach(w=>{m=m[w]}),s?JSON.parse(JSON.stringify(m)):m}}convert(){const e={swagger:"2.0",...this.convertInfos(),paths:this.spec.paths?this.convertOperations(this.spec.paths,this.spec):void 0};return this.spec.components&&(this.convertSchemas(),this.convertSecurityDefinitions(),this.spec["x-components"]=this.spec.components,delete this.spec.components,Us(this.spec)),delete this.spec.servers,delete this.spec.openapi,delete this.spec["x-components"],p.cleanObject({...e,...this.spec})}convertOperations(e,r){return Object.entries(e).reduce((s,[a,u])=>{const m=s[a]=this.resolveReference({...r,paths:s},u,!0);return this.convertParameters(m),Object.keys(m).forEach(w=>{if(hc.indexOf(w)>=0){const x=m[w]=this.resolveReference({...r,paths:s},m[w],!0);this.convertOperationParameters(x),this.convertResponses(x)}}),s},e)}convertOperationParameters(e){let r,s,a,u;if(e.parameters=e.parameters||[],e.requestBody){let m=this.resolveReference(this.spec,e.requestBody,!0);if(e.requestBody.content){const w=Ci(e.requestBody.content)[0],x={content:{}},D=e.requestBody.content[w];D&&D.schema&&D.schema.$ref&&!D.schema.$ref.startsWith("#")&&(m=this.resolveReference(this.spec,D.schema,!0),x.content[`${w}`]={schema:m},m=x)}if(m.name="body",r=m.content,r&&Object.keys(r).length){if(a=Object.keys(r).filter(w=>w.indexOf("/")>0),u=a.filter(w=>w.indexOf("*")<0),s=Ci(r)[0],delete m.content,[cs.APPLICATION_X_WWW_URLENCODED,cs.MULTIPART_FORM_DATA].includes(s))if(e.consumes=u,m.in="formData",m.schema=r[s].schema,m.schema=this.resolveReference(this.spec,m.schema,!0),m.schema.type==="object"&&m.schema.properties){const w=m.schema.required||[];Object.keys(m.schema.properties).forEach(x=>{var D;const I=m.schema.properties[x];if(!I.readOnly){const ee={name:x,in:"formData",schema:I};w.indexOf(x)>=0&&(ee.required=!0),(D=e.parameters)==null||D.push(ee)}})}else e.parameters.push(m);else s?(e.consumes=u,m.in="body",m.schema=r[s].schema,e.parameters.push(m)):a&&(e.consumes=u||["application/octet-stream"],m.in="body",m.name=m.name||"file",delete m.type,m.schema=r[a[0]].schema||{type:"string",format:"binary"},e.parameters.push(m));m.schema&&this.convertSchema(m.schema,"request")}delete e.requestBody}this.convertParameters(e)}convertParameters(e){e.parameters!==void 0&&(e.parameters=e.parameters||[],(e.parameters||[]).forEach((r,s)=>{if(r=e.parameters[s]=this.resolveReference(this.spec,r,!1),r.in!=="body"){if(this.copySchemaProperties(r,mc),this.copySchemaProperties(r,dc),this.copySchemaXProperties(r),!r.description){const a=this.resolveReference(this.spec,r.schema,!1);a&&a.description&&(r.description=a.description)}r.example!==void 0&&(r["x-example"]=r.example),delete r.schema,delete r.allowReserved,delete r.example}if(r.type==="array")switch(r.style||(r.in==="query"||r.in==="cookie"?"form":"simple")){case"matrix":r.collectionFormat=r.explode?void 0:"csv";break;case"label":r.collectionFormat=void 0;break;case"simple":r.collectionFormat="csv";break;case"spaceDelimited":r.collectionFormat="ssv";break;case"pipeDelimited":r.collectionFormat="pipes";break;case"deepOpbject":r.collectionFormat="multi";break;case"form":r.collectionFormat=r.explode===!1?"csv":"multi";break}delete r.style,delete r.explode}))}copySchemaProperties(e,r){let s=this.resolveReference(this.spec,e.schema,!0);s&&r.forEach(a=>{const u=s[a];a==="additionalProperties"&&typeof u=="boolean"||u!==void 0&&(e[a]=u)})}copySchemaXProperties(e){let r=this.resolveReference(this.spec,e.schema,!0);r&&Object.keys(r).forEach(s=>{Reflect.hasOwnProperty.call(r,s)&&!Reflect.hasOwnProperty.call(e,s)&&s.startsWith("x-")&&(e[s]=r[s])})}convertResponses(e){Object.keys(e.responses||{}).forEach(r=>{const s=e.responses[r]=this.resolveReference(this.spec,e.responses[r],!0);if(s.content){let a=null,u=null;if(Object.keys(s.content).forEach(m=>{const w=m.indexOf("*")<0?m:"application/octet-stream";e.produces?e.produces.indexOf(w)<0&&e.produces.push(w):e.produces=[w];const x=s.content[m];a=a||x.schema,!u&&ji(w)&&(u=x.schema),x.example&&(s.examples=s.examples||{},s.examples[w]=x.example)}),a){s.schema=u||a;const m=this.resolveReference(this.spec,s.schema,!0);m&&s.schema.$ref&&!s.schema.$ref.startsWith("#")&&(s.schema=m),this.convertSchema(s.schema,"response")}}Object.keys(s.headers||{}).forEach(a=>{const u=this.resolveReference(this.spec,s.headers[a],!0);u.schema&&(u.type=u.schema.type,u.format=u.schema.format,delete u.schema),s.headers[a]=u}),delete s.content})}convertSchema(e,r){if(e.oneOf&&(delete e.oneOf,e.discriminator&&delete e.discriminator),e.anyOf&&(delete e.anyOf,e.discriminator&&delete e.discriminator),e.allOf)for(const s in e.allOf)this.convertSchema(e.allOf[s],r);switch(e.discriminator&&(e.discriminator.mapping&&this.convertDiscriminatorMapping(e.discriminator.mapping),e.discriminator=e.discriminator.propertyName),e.type){case"object":e.properties&&Object.keys(e.properties).forEach(s=>{e.properties[s].writeOnly===!0&&r==="response"?delete e.properties[s]:(this.convertSchema(e.properties[s],r),delete e.properties[s].writeOnly)});break;case"array":e.items&&this.convertSchema(e.items,r)}e.nullable&&(e["x-nullable"]=!0,delete e.nullable),e.deprecated!==void 0&&(e["x-deprecated"]===void 0&&(e["x-deprecated"]=e.deprecated),delete e.deprecated)}convertSchemas(){this.spec.definitions=this.spec.components.schemas,Object.keys(this.spec.definitions||{}).forEach(e=>{this.convertSchema(this.spec.definitions[e])}),delete this.spec.components.schemas}convertDiscriminatorMapping(e){Object.keys(e).forEach(r=>{const s=e[r];if(typeof s!="string"){console.warn(`Ignoring ${s} for ${r} in discriminator.mapping.`);return}let a;if(/^[a-zA-Z0-9._-]+$/.test(s))try{a=this.resolveReference(this.spec,{$ref:`#/components/schemas/${s}`},!1)}catch(u){console.debug(`Error resolving ${s} for ${r} as schema name in discriminator.mapping: ${u}`)}if(!a)try{a=this.resolveReference(this.spec,{$ref:s},!1)}catch(u){console.debug(`Error resolving ${s} for ${r} in discriminator.mapping: ${u}`)}a?(a["x-discriminator-value"]=r,a["x-ms-discriminator-value"]=r):console.warn(`Unable to resolve ${s} for ${r} in discriminator.mapping.`)})}convertSecurityDefinitions(){this.spec.components.securitySchemes&&(this.spec.securityDefinitions=ki(this.spec.components.securitySchemes),delete this.spec.components.securitySchemes)}}function Ji(t){return new Ni(t).convert()}function Oc({tokens:t,...e}){const{version:r="1.0.0",acceptMimes:s,fileSpec:a={},specVersion:u}=e,m=Di(p.getValue(e,"spec",{}),{fileSpec:a,version:r,specVersion:u,acceptMimes:s}),w=Ri(m);let x=Ks(t,e);const D=as(m,x);return e.sortPaths&&(D.paths=Object.fromEntries(Object.entries(D.paths).sort(([I],[ee])=>I.localeCompare(ee)))),w===ie.SWAGGER?Ji(D):D}const Bi="$cache:schemes";function vc(t){return JSON.stringify(t)}function bc(t,e){const r=t.store.get(Bi)||new Map,s=vc(e);if(!r.has(s)){const a=Y("schema",[t.schema],e);Object.keys(p.getValue(e,"components.schemas",{})).length&&(a.definitions=e.components.schemas),r.set(s,a)}return t.store.set(Bi,r),r.get(s)}function wc(t,e={}){var r;const s=He(t),a=e.specType||ie.JSON;return e={endpoint:!0,groups:[],inlineEnums:a===ie.JSON,...e,specType:a,components:{schemas:{}}},s.decoratorType==="parameter"&&(e={...e,genericTypes:s.nestedGenerics[0],nestedGenerics:s.nestedGenerics,groups:(r=s.parameter)==null?void 0:r.groups}),bc(s,e)}function Gi(t,e={}){const r=t.isStore?t:He(t),s=qs(e.basePath,r.path);let a=[];return e.withChildren&&(a=r.get("childrenControllers",[]).reduce((u,m)=>u.concat(Gi(m,{...e,basePath:s})),a)),[...mr(t).values()].reduce((u,m)=>{const{operation:w}=m;return w&&w.getAllowedOperationPath(e.allowedVerbs).forEach(x=>{u.push(new Ti({basePath:s,token:t,endpoint:m,operationPath:x}))}),u},a)}function qi(t){const e=t.isStore?t:He(t);if(!e.$properties){const r=Ut(e);e.$properties=new Map,r.forEach(s=>{s.children.forEach(a=>{e.$properties.has(a.propertyKey)||e.$properties.set(a.propertyKey,a)})})}return e.$properties}function Sc(t,e={}){const r=qi(t),s=new Map;return r.forEach((a,u)=>{!e.withIgnoredProps&&Wr(a.itemSchema,e)||s.set(u,a)}),s}n.ARRAY_PROPERTIES=Kr,n.AcceptMime=ba,n.AdditionalProperties=Rs,n.All=ja,n.AllOf=Ds,n.Allow=y,n.Any=v,n.AnyOf=E,n.ArrayOf=ts,n.BOOLEAN_PROPERTIES=jn,n.COMMON_PROPERTIES=Fr,n.Children=Qn,n.CollectionContains=en,n.CollectionOf=tr,n.Const=j,n.Consumes=rn,n.ContentType=Ea,n.Converter=Ni,n.CustomKey=X,n.CustomKeys=Je,n.DateFormat=Uo,n.DateTime=zo,n.DecoratorContext=Is,n.Default=ke,n.DefaultMsg=k,n.Delete=Na,n.Deprecated=Ns,n.Description=q,n.Discriminator=Pt,n.DiscriminatorKey=K,n.DiscriminatorValue=es,n.Email=Wo,n.EndpointMetadata=gs,n.Enum=le,n.ErrorMsg=oe,n.Example=Pe,n.Examples=je,n.ExclusiveMaximum=js,n.ExclusiveMinimum=Fo,n.For=pa,n.Format=nr,n.ForwardGroups=Xo,n.GenericOf=Oa,n.Generics=va,n.Get=Ca,n.Groups=ks,n.HTTP_STATUS_MESSAGES=er,n.Head=Ja,n.Header=Pa,n.Hidden=Qo,n.Ignore=ea,n.In=Js,n.InFile=Ta,n.Integer=ta,n.JSON_TYPES=Cr,n.JsonEntitiesContainer=Et,n.JsonEntityComponent=ft,n.JsonEntityFn=U,n.JsonEntityStore=Oe,n.JsonFormatTypes=nt,n.JsonLazyRef=gr,n.JsonMap=Ve,n.JsonMedia=Wt,n.JsonMethodPath=gn,n.JsonOperation=pr,n.JsonOperationPathsMap=Br,n.JsonOperationRoute=Ti,n.JsonParameter=Rt,n.JsonParameterTypes=rt,n.JsonRequestBody=Xr,n.JsonResponse=yn,n.JsonSchema=We,n.LabelledAs=ra,n.Location=_a,n.MANY_OF_PROPERTIES=vr,n.MapOf=rs,n.Max=ns,n.MaxItems=_s,n.MaxLength=na,n.MaxProperties=xs,n.Maximum=Qe,n.Min=Ko,n.MinItems=As,n.MinLength=sa,n.MinProperties=rr,n.Minimum=tn,n.MultipleOf=ia,n.NUMBER_PROPERTIES=Cn,n.Name=di,n.Nullable=oa,n.OBJECT_PROPERTIES=kn,n.OPERATION_HTTP_VERBS=_r,n.OPERATION_WS_VERBS=pn,n.OneOf=aa,n.Operation=ht,n.OperationId=Si,n.OperationPath=Mi,n.OperationVerbs=ye,n.Optional=yi,n.Options=Ga,n.ParamMetadata=On,n.Partial=$a,n.Patch=Ba,n.Path=Ei,n.Pattern=ca,n.Post=ka,n.Produces=Bs,n.Property=It,n.PropertyMetadata=hr,n.Publish=Ra,n.Put=Ia,n.ReadOnly=ua,n.RecordOf=la,n.Redirect=Da,n.Required=fa,n.RequiredGroups=ha,n.Returns=sr,n.STRING_PROPERTIES=Dn,n.Schema=gi,n.Security=is,n.SpecTypes=ie,n.Status=qa,n.Subscribe=La,n.Summary=Pi,n.Tags=Gs,n.TimeFormat=Ho,n.Title=ma,n.TypeError=da,n.UniqueItems=$s,n.Uri=Vo,n.Url=Yo,n.View=Fa,n.WriteOnly=ya,n.allOf=Wa,n.alterIgnore=Wr,n.alterOneOf=ot,n.alterRequiredGroups=l,n.any=za,n.anyMapper=Pn,n.anyOf=Ua,n.array=Va,n.boolean=Ha,n.buildPath=ut,n.channelsMapper=qr,n.classMapper=Tn,n.concatParameters=xt,n.concatPath=qs,n.createRef=Vt,n.createRefName=jt,n.date=Za,n.datetime=Qa,n.defineStatusModel=wa,n.discriminatorMappingMapper=Xt,n.email=tc,n.enums=rc,n.enumsMapper=Or,n.enumsRegistry=Kt,n.execMapper=Y,n.execOneOfMapper=ln,n.formatParameterType=zt,n.from=Le,n.generateSpec=Oc,n.genericsMapper=_n,n.getComputedType=jr,n.getGenericsMap=dr,n.getInheritedStores=Ut,n.getJsonEntityStore=He,n.getJsonPathParameters=Hn,n.getJsonSchema=wc,n.getJsonSchemaMapper=xr,n.getJsonType=pt,n.getOperationId=Vn,n.getOperationsRoutes=Gi,n.getOperationsStores=mr,n.getProperties=Sc,n.getPropertiesStores=qi,n.getSpec=Ks,n.getSpecType=$i,n.getSpecTypeFromSpec=Ri,n.getStatusConstant=Wn,n.getStatusMessage=kt,n.getStatusModel=vi,n.hasMapper=Ar,n.inheritedClassMapper=An,n.integer=nc,n.isParameterType=lr,n.isRedirectionStatus=Ft,n.isSuccessStatus=ur,n.itemMapper=$n,n.lazyRef=sc,n.lazyRefMapper=Rn,n.makeOf=Ht,n.map=Ya,n.mapAliasedProperties=V,n.mapGenericsOptions=Tt,n.mapHeaders=Ir,n.mapMapper=Lr,n.mapOpenSpec=Di,n.mapOpenSpec2=Ws,n.mapOpenSpec3=zs,n.mapOpenSpecInfo=Fs,n.mapOperationOptions=wi,n.matchGroups=Cs,n.mergeSpec=as,n.messageMapper=wn,n.nullableMapper=In,n.nullableMapperOpenApi=Hr,n.number=ic,n.object=oc,n.objectMapper=Nn,n.ofMapper=br,n.oneOf=ac,n.operationIdFormatter=Qr,n.operationInFilesMapper=qn,n.operationInParameterMapper=Ln,n.operationInParametersMapper=Kn,n.operationInQueryMapper=Fn,n.operationMapper=Vr,n.operationMediaMapper=Yr,n.operationRequestBodyMapper=Zr,n.operationResponseMapper=re,n.parameters=_i,n.pathsMapper=Zn,n.payloadMapper=yr,n.popGenerics=Dt,n.propertiesMapper=o,n.registerJsonSchemaMapper=Q,n.removeHiddenOperation=Gr,n.requiredMapper=$,n.responsePayloadMapper=En,n.schemaMapper=Bn,n.schemesReducer=os,n.security=xi,n.serializeEnum=ar,n.serializeEnumValues=kr,n.set=Xa,n.string=ss,n.tagsReducer=Ai,n.time=ec,n.toJsonMapCollection=tt,n.toJsonRegex=cr,n.toRef=Yt,n.transformInformation=Ii,n.transformSecurity=ki,n.transformToOS2=Ji,n.uri=cc,n.url=uc,n.withErrorMsg=xe,n.wrapEnumsMapper=Sr,Object.defineProperty(n,Symbol.toStringTag,{value:"Module"})})}(schema_umd$1,schema_umd$1.exports)),schema_umd$1.exports}var schema_umdExports=requireSchema_umd();function AfterDeserialize(P){return schema_umdExports.JsonEntityFn(c=>{c.schema.$hooks.on("afterDeserialize",P)})}function BeforeDeserialize(P){return schema_umdExports.JsonEntityFn(c=>{c.schema.$hooks.on("beforeDeserialize",P)})}function OnDeserialize(P){return schema_umdExports.JsonEntityFn(c=>{c.schema.$hooks.on("onDeserialize",P)})}function OnSerialize(P){return schema_umdExports.JsonEntityFn(c=>{c.schema.$hooks.on("onSerialize",P)})}function alterAfterDeserialize(P,c,n){var O;return(O=c==null?void 0:c.$hooks)==null?void 0:O.alter("afterDeserialize",P,[n])}function alterBeforeDeserialize(P,c,n){var O;return(O=c==null?void 0:c.$hooks)==null?void 0:O.alter("beforeDeserialize",P,[n])}function alterOnDeserialize(P,c,n){return P.$hooks.alter("onDeserialize",c,[n])}class JsonMapperCompiler{constructor(){this.cache=new Map,this.mappers={},this.schemes={},this.constructors={},this.globals={isCollection:core_umdExports.isCollection,isClass:core_umdExports.isClass,isObject:core_umdExports.isObject,classOf:core_umdExports.classOf,nameOf:core_umdExports.nameOf,hasJsonMethod:core_umdExports.hasJsonMethod,isMongooseObject:core_umdExports.isMongooseObject,isNil:core_umdExports.isNil,isDate:core_umdExports.isDate,objectKeys:core_umdExports.objectKeys,isMomentObject:core_umdExports.isMomentObject},this.addGlobal("alterIgnore",this.alterIgnore.bind(this)),this.addGlobal("alterValue",this.alterValue.bind(this)),this.addGlobal("execMapper",this.execMapper.bind(this)),this.addGlobal("compileAndMap",this.map.bind(this))}addTypeMapper(P,c){const n=core_umdExports.nameOf(P);return this.cache.set(P,new Map().set("typeMapper",{id:n,fn:c})),this.mappers[n]=c,this}removeTypeMapper(P){const c=this.cache.get(P);if(c){const{id:n}=c.get("typeMapper");delete this.mappers[n],this.cache.delete(P)}}addGlobal(P,c){return this.globals[P]=c,this}eval(mapper,{id,groupsId,model}){this.addGlobal("cache",this.cache);const{globals,schemes}=this,injectGlobals=Object.keys(globals).map(P=>`const ${P} = globals.${P};`).join(`
30
- `);eval(`${injectGlobals};
31
-
32
- cache.get(model).set(groupsId, { id: '${id}', fn: ${mapper} })`);const store=this.cache.get(model).get(groupsId);return this.mappers[id]=store.fn,store}createContext(P){const{cache:c}=this;return{...P,cache:c}}compile(P,c,n={}){const O=core_umdExports.isString(P)?P:this.getType(P),S=this.getGroupsId(c);let N=this.cache.get(O)||this.cache.get(core_umdExports.nameOf(O));if(N||(N=new Map,this.cache.set(O,N)),N.has("typeMapper"))return N.get("typeMapper");if(!N.has(S)){const F=this.getId(O,S);N.set(S,{id:F});const B=n.mapper?n.mapper(F,c):this.createMapper(O,F,c);try{return this.eval(B,{id:F,model:O,groupsId:S})}catch(A){throw new Error(`Fail to compile mapper for ${core_umdExports.nameOf(P)}. See the error above: ${A.message}.
33
- ${B}`)}}return N.get(S)}execMapper(P,c,n){return core_umdExports.isObjectID(c)?c.toString():this.mappers[P||core_umdExports.nameOf(core_umdExports.classOf(c))](c,n)}getType(P){if(!P)return Object;if(core_umdExports.isClass(P)&&!core_umdExports.isCollection(P)){const c=[Array,Map,Set].find(n=>core_umdExports.ancestorsOf(P).includes(n));if(c)return c}return P}alterIgnore(P,c){var O,S;let n=(S=(O=this.schemes[P])==null?void 0:O.$hooks)==null?void 0:S.alter("ignore",!1,[c]);if(n)return n}alterGroups(P,c){return c!==!1?P.$hooks.alter("groups",!1,[c]):!1}getGroupsId(P){return P===!1?"default":P.length===0?"-":P.join(",")}getId(P,c){return`${core_umdExports.isString(P)?P:core_umdExports.nameOf(P)}:${core_umdExports.getRandomId()}:${c}`}getSchemaId(P,c){return`${P}:${c}`}}const JsonMapperSettings={disableUnsecureConstructor:!0,additionalProperties:!1,strictGroups:!1},Se=class Se{constructor(c){this.body=[],this._root=c}static indent(c){return c.map(n=>` ${n}`)}static mapper(c,n,O){return`execMapper('${c}', ${n}, ${O})`}static mapperFrom(c,n){return`execMapper(nameOf(classOf(${c})), ${c}, ${n})`}static options(...c){return c=c.filter(Boolean),c.length?Se.object.assign("...options",...c):"options"}add(...c){return c=c.filter(n=>n!==void 0),c.length&&this.body.push(...c),this}arrow(...c){this.add(`(${c}) => {`);const n=this.new();return this.add("}"),n}build(){const c=this.body.flatMap(n=>n instanceof Se?n.build():n);return this._indent?c.map(n=>" "+n):c}callMapper(c,n,...O){return this.set(n,Se.mapper(c,n,Se.options(...O)))}returnCallMapper(c,n,...O){return this.return(Se.mapper(c,n,Se.options(...O)))}const(c,n){return this.add(`const ${c} = ${n};`),this}each(c,n=[]){const O=this.add(c+".forEach(("+n.join(", ")+") => {").new();return this.add("});"),O}if(c){const n=new IfWriter(c,this);return this.add(n),n}switch(c){const n=new SwitchWriter(c);return this.add(n),n}indent(c){return this._indent=c,this}new(c=!0){const n=new Se(this.root());return n.indent(c),this.add(n),n}return(c){return this.add(`return ${c};`),this.root()}root(){return this._root||this}set(c,n){return this.add(`${c} = ${n};`),this}toString(){return this.build().join(`
34
- `)}};Se.object={assign(...c){return`{ ${c.filter(Boolean).join(", ")} }`}};let Writer=Se;class IfWriter extends Writer{constructor(c,n){super(),this.condition=c,this._root=n}else(){const c=new Writer(this._root);return this.elseWriter=c,c}build(){return[`if (${this.condition}) {`,...Writer.indent(super.build()),"}",this.elseWriter?["else {",...Writer.indent(this.elseWriter.build()),"}"]:[]].flat()}}class SwitchWriter extends Writer{constructor(n){super();Lo(this,qe,new Map);this.input=n}case(n){const O=new Writer;return hi(this,qe).set(n,O),O}build(){return[`switch (${this.input}) {`,...Writer.indent(Array.from(hi(this,qe).entries()).flatMap(([n,O])=>[n==="default"?`${n}:`:`case ${n}:`,...Writer.indent(O.build())])),"}"].flat()}}qe=new WeakMap;function isDeserializable(P,c){return c.collectionType&&core_umdExports.isNil(P)||P===void 0?!1:!(core_umdExports.isEmpty(c.type)||c.type===Object&&!c.collectionType)}function varKey$1(P){return`__${P}`}function mapParamStoreOptions(P,c){return{...c,store:void 0,type:P.getBestType(),collectionType:P.collectionType,groups:P.parameter.groups,generics:P.nestedGenerics}}function getGenericIndex(P){return P.parent.schema.genericLabels.indexOf(P.itemSchema.genericType)}class JsonDeserializer extends JsonMapperCompiler{constructor(){super(),this.constructors={},this.addGlobal("newInstanceOf",this.newInstanceOf.bind(this)),this.addGlobal("alterBeforeDeserialize",this.alterBeforeDeserialize.bind(this)),this.addGlobal("alterAfterDeserialize",this.alterAfterDeserialize.bind(this)),this.addTypeMapper(Object,this.mapObject.bind(this)),this.addTypeMapper(Array,this.mapArray.bind(this)),this.addTypeMapper(Map,this.mapMap.bind(this)),this.addTypeMapper(Set,this.mapSet.bind(this)),this.addTypeMapper("ObjectId",c=>String(c))}map(c,n={}){if(n=this.mapOptions(n),!isDeserializable(c,n))return c;!n.collectionType&&core_umdExports.isArray(c)&&(n.collectionType=Array);const O=n.type||core_umdExports.classOf(c),S=this.compile(O,n.groups);return n.collectionType?this.compile(n.collectionType,n.groups).fn(c,{...n,id:S.id}):S.fn(c,this.createContext(n))}compile(c,n){if([WeakMap,WeakSet].includes(c))throw new Error(`${core_umdExports.nameOf(c)} is not supported by JsonMapper.`);return super.compile(c,n)}eval(c,{id:n,groupsId:O,model:S}){return this.constructors[n]=S,super.eval(c,{id:n,groupsId:O,model:S})}newInstanceOf(c,n,O){try{return new this.constructors[c](O.disableUnsecureConstructor?{}:n)}catch{return n}}createMapper(c,n,O){var A,ne,G;const S=schema_umdExports.JsonEntityStore.from(c),N=new Set,F=[...schema_umdExports.getPropertiesStores(S).values()],B=new Writer().arrow("input","options");return B.if("isNil(input)").return("input"),S.schema.hasDiscriminator&&B.add(this.mapDiscriminator(S,O)),(A=S.schema.$hooks)!=null&&A.has("beforeDeserialize")&&(this.schemes[n]=S.schema,B.set("input",`alterBeforeDeserialize('${n}', input, options)`)),B.const("generics","options.generics[0]"),(ne=S.schema.genericLabels)!=null&&ne.length?B.set("options","{...options, self: input, generics: [...options.generics].slice(1)}"):B.set("options","{...options, self: input}"),B.const("obj",`newInstanceOf('${n}', input, options)`),B.add(...F.flatMap(ae=>{var $e,pe,_e,Re;const me=ae.propertyName;if(N.add(String(ae.parent.schema.getAliasOf(me)||me)),!(($e=ae.schema)!=null&&$e.$ignore&&core_umdExports.isBoolean((pe=ae.schema)==null?void 0:pe.$ignore)||ae.isGetterOnly()||(Re=(_e=ae.schema)==null?void 0:_e.$hooks)!=null&&Re.has("groups")&&this.alterGroups(ae.schema,O)))return this.mapProperty(ae,n,O)})),B.add(this.mapAdditionalProperties(S,N,O)),(G=S.schema.$hooks)!=null&&G.has("afterDeserialize")?(this.schemes[n]=S.schema,B.return(`alterAfterDeserialize('${n}', obj, options)`).root().toString()):B.return("obj").root().toString()}alterValue(c,n,O){return alterOnDeserialize(this.schemes[c],n,O)}mapDiscriminator(c,n){const O=new Writer,S=c.schema.discriminator(),N=O.switch(`input['${S.propertyName}']`);return S.values.forEach((F,B)=>{const A=this.compile(F,n);N.case(`'${B}'`).returnCallMapper(A.id,"input")}),O}mapProperty(c,n,O){var _e,Re,Me,Xe;const S=String(c.propertyKey),N=String(c.parent.schema.getAliasOf(S)||S),F=this.getSchemaId(n,S),B=c.itemSchema.get("format"),A=B&&`options: {format: '${B}'}`;let ne=new Writer().add(`// Map ${S} ${n} ${O||""}`);const G=S!==N?`options.useAlias ? '${N}' : '${S}'`:`'${S}'`;(Re=(_e=c.schema)==null?void 0:_e.$hooks)!=null&&Re.has("ignore")&&(this.schemes[F]=c.schema,ne=ne.if(`!alterIgnore('${F}', {...options, self: input})`));const ae=(Xe=(Me=c.schema)==null?void 0:Me.$hooks)==null?void 0:Xe.has("onDeserialize");let me=`input[${G}]`;if(ae){this.schemes[F]=c.schema;const Ze=Writer.options(A);me=`alterValue('${F}', input[${G}], ${Ze})`}const $e=ne.set(`let ${varKey$1(S)}`,me).if(`${varKey$1(S)} !== undefined`),pe=this.getPropertyFiller(c,n,O,A);return pe(ae?$e.if(`${varKey$1(S)} === input.${S}`):$e),$e.set(`obj.${S}`,varKey$1(S)),O&&O.includes("partial")&&$e.else().add(`delete obj.${S}`),ne.root()}getPropertyFiller(c,n,O,S){const N=String(c.propertyKey),F=this.getSchemaId(n,N),B=c.itemSchema.nestedGenerics;if(c.itemSchema.isGeneric&&!(B!=null&&B.length)){const ae=getGenericIndex(c),me=Writer.options(S,`type: generics[${ae}]`);return $e=>$e.set(varKey$1(N),`compileAndMap(${varKey$1(N)}, ${me})`)}const ne=c.itemSchema.hasDiscriminator?c.itemSchema.discriminator().base:c.getBestType(),G=this.compile(ne,O);return c.isCollection?ae=>ae.callMapper(core_umdExports.nameOf(c.collectionType),varKey$1(N),`id: '${G.id}'`,S):B!=null&&B.length?(this.schemes[F]=c.schema,ae=>ae.callMapper(G.id,varKey$1(N),S,`generics: schemes['${F}'].nestedGenerics`)):ae=>ae.callMapper(G.id,varKey$1(N),S)}mapOptions({groups:c,useAlias:n=!0,types:O,...S}){if(S.store instanceof schema_umdExports.JsonParameterStore)return this.mapOptions(mapParamStoreOptions(S.store,S));const N={};O=O||getJsonMapperTypes(),O.forEach((B,A)=>{if(![Array,Set,Map].includes(A)){const ne=core_umdExports.nameOf(A);core_umdExports.nameOf(A)in B?this.addTypeMapper(A,B[ne].bind(B)):this.addTypeMapper(A,(G,ae)=>B.deserialize(G,{...ae,type:A}))}});const F=S.strictGroups??JsonMapperSettings.strictGroups;return{...S,additionalProperties:S.additionalProperties??JsonMapperSettings.additionalProperties,disableUnsecureConstructor:S.disableUnsecureConstructor??JsonMapperSettings.disableUnsecureConstructor,groups:c===void 0?F?[]:!1:c||!1,useAlias:n,customMappers:N,generics:S.generics||[]}}mapAdditionalProperties(c,n,O){const S=c.schema.get("additionalProperties"),N=[...n.values()].map(A=>`'${A}'`).join(", "),F=new Writer;F.add("// add additional properties");let B=F.each("objectKeys(input)",["key"]);if(N.length&&(B=B.if(`![${N}].includes(key)`)),core_umdExports.isClass(S)){const A=this.compile(S.getComputedType(),O);return B.set("obj[key]",Writer.mapper(A.id,"input[key]","options")),F}return S?(B.set("obj[key]","input[key]"),F):(B.if("options.additionalProperties && obj[key] === undefined").set("obj[key]","input[key]"),F)}mapObject(c,n){return c}mapSet(c,n){if(core_umdExports.isNil(c))return c;const O=new Set;return core_umdExports.objectKeys(c).forEach(S=>{O.add(this.mapItem(c[S],n))}),O}mapArray(c,n){return core_umdExports.isNil(c)?c:[].concat(c).map(O=>this.mapItem(O,n))}mapMap(c,n){if(core_umdExports.isNil(c))return c;const O=new Map;return core_umdExports.objectKeys(c).forEach(S=>{O.set(S,this.mapItem(c[S],n))}),O}mapItem(c,{id:n,...O}){return this.execMapper(n,c,O)}alterBeforeDeserialize(c,n,O){return alterBeforeDeserialize(n,this.schemes[c],O)}alterAfterDeserialize(c,n,O){return alterAfterDeserialize(n,this.schemes[c],O)}}function alterOnSerialize(P,c,n){return P.$hooks.alter("onSerialize",c,[n])}function getObjectProperties(P){return Object.entries(P).filter(([,c])=>!core_umdExports.isFunction(c))}const getCollectionType=P=>core_umdExports.isArray(P)?"Array":P instanceof Set?"Set":P instanceof Map?"Map":void 0;function getBestType(P,c){const n=core_umdExports.classOf(c);return n&&!core_umdExports.isClassObject(n)&&!core_umdExports.isCollection(c)?n:P||Object}function varKey(P){return`__${P}`}class JsonSerializer extends JsonMapperCompiler{constructor(){super(),this.addTypeMapper(Object,this.mapObject.bind(this)),this.addTypeMapper(Array,this.mapArray.bind(this)),this.addTypeMapper(Map,this.mapMap.bind(this)),this.addTypeMapper(Set,this.mapSet.bind(this)),this.addGlobal("mapJSON",this.mapJSON.bind(this)),this.addTypeMapper("ObjectId",c=>String(c))}map(c,n={}){if(core_umdExports.isNil(c))return c;n=this.mapOptions(n);const O=getBestType(n.type,c);return this.compile(O,n.groups).fn(c,this.createContext(n))}alterValue(c,n,O){return alterOnSerialize(this.schemes[c],n,O)}createMapper(c,n,O){const S=schema_umdExports.JsonEntityStore.from(c),N=new Set,F=[...schema_umdExports.getPropertiesStores(S).values()],B=new Writer().arrow("input","options");return B.if("isNil(input)").return("input"),B.const("obj","{}"),B.set("options","{...options, self: input}"),B.add(this.mapPrecondition(n)),F.length?(B.add(...F.flatMap(A=>{var ne,G,ae,me;if(N.add(A.propertyKey),!((ne=A.schema)!=null&&ne.$ignore&&core_umdExports.isBoolean((G=A.schema)==null?void 0:G.$ignore)||(me=(ae=A.schema)==null?void 0:ae.$hooks)!=null&&me.has("groups")&&this.alterGroups(A.schema,O)))return this.mapProperty(A,n,O)})),B.add(this.mapDiscriminatorKeyValue(S)),B.add(this.mapAdditionalProperties(S,N)),B.return("obj").root().toString()):B.return("isObject(input) ? {...input} : input").root().toString()}mapOptions({groups:c,useAlias:n=!0,types:O,...S}){const N={};O=O||getJsonMapperTypes(),O.forEach((B,A)=>{[Array,Set,Map].includes(A)||this.addTypeMapper(A,(ne,G)=>B.serialize(ne,{...G,type:A}))});const F=S.strictGroups??JsonMapperSettings.strictGroups;return{...S,groups:c===void 0?F?[]:!1:c||!1,useAlias:n,customMappers:N}}mapProperty(c,n,O){var $e,pe,_e,Re;const S=String(c.propertyKey),N=String(c.parent.schema.getAliasOf(S)||S),F=this.getSchemaId(n,S),B=c.itemSchema.get("format"),A=B&&`options: {format: '${B}'}`;let ne=new Writer().add(`// Map ${S} ${n} ${O||""}`);(pe=($e=c.schema)==null?void 0:$e.$hooks)!=null&&pe.has("ignore")&&(this.schemes[F]=c.schema,ne=ne.if(`!alterIgnore('${F}', {...options, self: input})`));const G=(Re=(_e=c.schema)==null?void 0:_e.$hooks)==null?void 0:Re.has("onSerialize");let ae=`input.${S}`;if(G){this.schemes[F]=c.schema;const Me=Writer.options(A);ae=`alterValue('${F}', input.${S}, ${Me})`}ne=ne.set(`let ${varKey(S)}`,ae).if(`${varKey(S)} !== undefined`);const me=this.getPropertyFiller(c,S,O,A);return me(G?ne.if(`${varKey(S)} === input.${S}`):ne),N!==S?ne.set(`obj[options.useAlias ? '${N}' : '${S}']`,varKey(S)):ne.set(`obj.${S}`,varKey(S)),ne.root()}getPropertyFiller(c,n,O,S){const N=c.itemSchema.isGeneric,F=c.itemSchema.hasDiscriminator;if(c.isCollection){const A=c.getBestType();let ne;if(F){const G=c.parent.targetName;ne=this.compile(`Discriminator:${G}:${n}`,O,{mapper:()=>this.createDiscriminatorMapper(c,O)})}else ne=N?{id:""}:this.compile(A,O);return G=>G.callMapper(core_umdExports.nameOf(c.collectionType),varKey(n),`id: '${ne.id}'`,S)}if(N)return A=>A.set(varKey(n),`compileAndMap(${varKey(n)}, options)`);let B;if(F){const A=c.parent.targetName;B=this.compile(`Discriminator:${A}:${n}`,O,{mapper:()=>this.createDiscriminatorMapper(c,O)})}else B=this.compile(c.getBestType(),O);return A=>A.callMapper(B.id,varKey(n),S)}createDiscriminatorMapper(c,n){const O=c.itemSchema.discriminator(),S=new Writer().arrow("input","options"),N=S.switch("nameOf(classOf(input))");return O.values.forEach((F,B)=>{const A=this.compile(F,n);N.case(`'${core_umdExports.nameOf(F)}'`).returnCallMapper(A.id,"input")}),S.root().toString()}mapPrecondition(c){const n=new Writer;return n.if("input && isCollection(input)").return(Writer.mapperFrom("input",`{...options, id: '${c}'}`)),n.if("hasJsonMethod(input)").return(`mapJSON(input, {...options, id: '${c}'})`),n}mapDiscriminatorKeyValue(c){if(c.discriminatorAncestor){const n=c.discriminatorAncestor.schema.discriminator(),O=n.getDefaultValue(c.target);if(O){const S=new Writer;return S.if(`!obj.${n.propertyName}`).set(`obj.${n.propertyName}`,`'${O}'`),S}}}mapAdditionalProperties(c,n){if(!!c.schema.get("additionalProperties")){const S=[...n.values()].map(F=>`'${F}'`).join(", "),N=new Writer;return N.add("// add additional properties"),N.each("objectKeys(input)",["key"]).if(`![${S}].includes(key)`).set("obj[key]","input[key]"),N}}mapObject(c,{type:n,...O}){return c&&core_umdExports.isPrimitive(c)||!c?c:c&&core_umdExports.isCollection(c)?this.execMapper(getCollectionType(c),c,O):core_umdExports.hasJsonMethod(c)?this.mapJSON(c,O):getObjectProperties(c).filter(([,S])=>S!==void 0).reduce((S,[N,F])=>{if(core_umdExports.isNil(F))return{...S,[N]:F};const B=this.compile(core_umdExports.classOf(F),O.groups);return{...S,[N]:B.fn(F,O)}},{})}mapSet(c,n){return core_umdExports.isNil(c)?c:[...c.values()].map(O=>this.mapItem(O,n))}mapArray(c,n){return core_umdExports.isNil(c)?c:[].concat(c).map(O=>this.mapItem(O,n))}mapMap(c,n){return core_umdExports.isNil(c)?c:[...c.entries()].reduce((O,[S,N])=>({...O,[S]:this.mapItem(N,n)}),{})}mapItem(c,{id:n,...O}){return!n&&c?this.compile(core_umdExports.classOf(c),O.groups).fn(c,O):n?this.execMapper(n,c,O):c}mapJSON(c,{id:n,...O}){return core_umdExports.isMongooseObject(c)?c.toJSON({...O,self:void 0,id:n}):(n=n||core_umdExports.nameOf(core_umdExports.classOf(c)),this.mappers[n]&&(core_umdExports.isDate(c)||core_umdExports.isMomentObject(c))?this.execMapper(n,c,O):(c=c.toJSON(),core_umdExports.isObject(c)?this.execMapper(n,c,O):c))}}const deserializer=new JsonDeserializer;function deserialize(P,c){return deserializer.map(P,c)}const serializer=new JsonSerializer;function serialize(P,c){return serializer.map(P,c)}exports.AfterDeserialize=AfterDeserialize,exports.BeforeDeserialize=BeforeDeserialize,exports.CastError=CastError,exports.JsonDeserializer=JsonDeserializer,exports.JsonMapper=JsonMapper,exports.JsonMapperCompiler=JsonMapperCompiler,exports.JsonMapperSettings=JsonMapperSettings,exports.JsonSerializer=JsonSerializer,exports.OnDeserialize=OnDeserialize,exports.OnSerialize=OnSerialize,exports.Writer=Writer,exports.alterAfterDeserialize=alterAfterDeserialize,exports.alterBeforeDeserialize=alterBeforeDeserialize,exports.alterOnDeserialize=alterOnDeserialize,exports.alterOnSerialize=alterOnSerialize,exports.deserialize=deserialize,exports.getJsonMapperTypes=getJsonMapperTypes,exports.getObjectProperties=getObjectProperties,exports.registerJsonTypeMapper=registerJsonTypeMapper,exports.serialize=serialize,Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"})});