@tsed/schema 8.9.1 → 8.9.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.
@@ -1,3 +1,3 @@
1
1
  /*! For license information please see schema.umd.min.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("change-case"),require("@tsed/core"),require("@tsed/hooks")):"function"==typeof define&&define.amd?define(["change-case","@tsed/core","@tsed/hooks"],t):"object"==typeof exports?exports["@tsed/schema"]=t(require("change-case"),require("@tsed/core"),require("@tsed/hooks")):e["@tsed/schema"]=t(e["change-case"],e["@tsed/core"],e["@tsed/hooks"])}(self,((e,t,r)=>(()=>{"use strict";var s={307:(e,t,r)=>{const s=r(393),n=r(366);function i(e,t,r=!1){return!t||null!==t.windows&&void 0!==t.windows||(t={...t,windows:n.isWindows()}),s(e,t,r)}Object.assign(i,s),e.exports=i},686:e=>{const t="\\\\/",r=`[^${t}]`,s="\\.",n="\\/",i="[^/]",o=`(?:${n}|$)`,a=`(?:^|${n})`,c=`${s}{1,2}${o}`,p={DOT_LITERAL:s,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:n,ONE_CHAR:"(?=.)",QMARK:i,END_ANCHOR:o,DOTS_SLASH:c,NO_DOT:`(?!${s})`,NO_DOTS:`(?!${a}${c})`,NO_DOT_SLASH:`(?!${s}{0,1}${o})`,NO_DOTS_SLASH:`(?!${c})`,QMARK_NO_DOT:`[^.${n}]`,STAR:`${i}*?`,START_ANCHOR:a,SEP:"/"},u={...p,SLASH_LITERAL:`[${t}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${s}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${s})`,NO_DOTS:`(?!(?:^|[${t}])${s}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${s}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${s}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?u:p}},284:(e,t,r)=>{const s=r(686),n=r(366),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:o,REGEX_NON_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_BACKREF:c,REPLACEMENTS:p}=s,u=(e,t)=>{if("function"==typeof t.expandRange)return t.expandRange(...e,t);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(t){return e.map((e=>n.escapeRegex(e))).join("..")}return r},h=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,l=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");e=p[e]||e;const r={...t},m="number"==typeof r.maxLength?Math.min(i,r.maxLength):i;let d=e.length;if(d>m)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${m}`);const f={type:"bos",value:"",output:r.prepend||""},g=[f],y=r.capture?"":"?:",O=s.globChars(r.windows),S=s.extglobChars(O),{DOT_LITERAL:b,PLUS_LITERAL:R,SLASH_LITERAL:A,ONE_CHAR:E,DOTS_SLASH:T,NO_DOT:P,NO_DOT_SLASH:v,NO_DOTS_SLASH:C,QMARK:x,QMARK_NO_DOT:$,STAR:M,START_ANCHOR:w}=O,_=e=>`(${y}(?:(?!${w}${e.dot?T:b}).)*?)`,N=r.dot?"":P,I=r.dot?x:$;let D=!0===r.bash?_(r):M;r.capture&&(D=`(${D})`),"boolean"==typeof r.noext&&(r.noextglob=r.noext);const L={input:e,index:-1,start:0,dot:!0===r.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};e=n.removePrefix(e,L),d=e.length;const k=[],j=[],H=[];let G,q=f;const B=()=>L.index===d-1,U=L.peek=(t=1)=>e[L.index+t],K=L.advance=()=>e[++L.index]||"",J=()=>e.slice(L.index+1),F=(e="",t=0)=>{L.consumed+=e,L.index+=t},V=e=>{L.output+=null!=e.output?e.output:e.value,F(e.value)},W=()=>{let e=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)K(),L.start++,e++;return e%2!=0&&(L.negated=!0,L.start++,!0)},X=e=>{L[e]++,H.push(e)},z=e=>{L[e]--,H.pop()},Y=e=>{if("globstar"===q.type){const t=L.braces>0&&("comma"===e.type||"brace"===e.type),r=!0===e.extglob||k.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||r||(L.output=L.output.slice(0,-q.output.length),q.type="star",q.value="*",q.output=D,L.output+=q.output)}if(k.length&&"paren"!==e.type&&(k[k.length-1].inner+=e.value),(e.value||e.output)&&V(e),q&&"text"===q.type&&"text"===e.type)return q.output=(q.output||q.value)+e.value,void(q.value+=e.value);e.prev=q,g.push(e),q=e},Q=(e,t)=>{const s={...S[t],conditions:1,inner:""};s.prev=q,s.parens=L.parens,s.output=L.output;const n=(r.capture?"(":"")+s.open;X("parens"),Y({type:e,value:t,output:L.output?"":E}),Y({type:"paren",extglob:!0,value:K(),output:n}),k.push(s)},Z=e=>{let s,n=e.close+(r.capture?")":"");if("negate"===e.type){let i=D;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(i=_(r)),(i!==D||B()||/^\)+$/.test(J()))&&(n=e.close=`)$))${i}`),e.inner.includes("*")&&(s=J())&&/^\.[^\\/.]+$/.test(s)){const r=l(s,{...t,fastpaths:!1}).output;n=e.close=`)${r})${i})`}"bos"===e.prev.type&&(L.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:G,output:n}),z("parens")};if(!1!==r.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(e)){let s=!1,i=e.replace(c,((e,t,r,n,i,o)=>"\\"===n?(s=!0,e):"?"===n?t?t+n+(i?x.repeat(i.length):""):0===o?I+(i?x.repeat(i.length):""):x.repeat(r.length):"."===n?b.repeat(r.length):"*"===n?t?t+n+(i?D:""):D:t?e:`\\${e}`));return!0===s&&(i=!0===r.unescape?i.replace(/\\/g,""):i.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),i===e&&!0===r.contains?(L.output=e,L):(L.output=n.wrapOutput(i,L,t),L)}for(;!B();){if(G=K(),"\0"===G)continue;if("\\"===G){const e=U();if("/"===e&&!0!==r.bash)continue;if("."===e||";"===e)continue;if(!e){G+="\\",Y({type:"text",value:G});continue}const t=/^\\+/.exec(J());let s=0;if(t&&t[0].length>2&&(s=t[0].length,L.index+=s,s%2!=0&&(G+="\\")),!0===r.unescape?G=K():G+=K(),0===L.brackets){Y({type:"text",value:G});continue}}if(L.brackets>0&&("]"!==G||"["===q.value||"[^"===q.value)){if(!1!==r.posix&&":"===G){const e=q.value.slice(1);if(e.includes("[")&&(q.posix=!0,e.includes(":"))){const e=q.value.lastIndexOf("["),t=q.value.slice(0,e),r=q.value.slice(e+2),s=o[r];if(s){q.value=t+s,L.backtrack=!0,K(),f.output||1!==g.indexOf(q)||(f.output=E);continue}}}("["===G&&":"!==U()||"-"===G&&"]"===U())&&(G=`\\${G}`),"]"!==G||"["!==q.value&&"[^"!==q.value||(G=`\\${G}`),!0===r.posix&&"!"===G&&"["===q.value&&(G="^"),q.value+=G,V({value:G});continue}if(1===L.quotes&&'"'!==G){G=n.escapeRegex(G),q.value+=G,V({value:G});continue}if('"'===G){L.quotes=1===L.quotes?0:1,!0===r.keepQuotes&&Y({type:"text",value:G});continue}if("("===G){X("parens"),Y({type:"paren",value:G});continue}if(")"===G){if(0===L.parens&&!0===r.strictBrackets)throw new SyntaxError(h("opening","("));const e=k[k.length-1];if(e&&L.parens===e.parens+1){Z(k.pop());continue}Y({type:"paren",value:G,output:L.parens?")":"\\)"}),z("parens");continue}if("["===G){if(!0!==r.nobracket&&J().includes("]"))X("brackets");else{if(!0!==r.nobracket&&!0===r.strictBrackets)throw new SyntaxError(h("closing","]"));G=`\\${G}`}Y({type:"bracket",value:G});continue}if("]"===G){if(!0===r.nobracket||q&&"bracket"===q.type&&1===q.value.length){Y({type:"text",value:G,output:`\\${G}`});continue}if(0===L.brackets){if(!0===r.strictBrackets)throw new SyntaxError(h("opening","["));Y({type:"text",value:G,output:`\\${G}`});continue}z("brackets");const e=q.value.slice(1);if(!0===q.posix||"^"!==e[0]||e.includes("/")||(G=`/${G}`),q.value+=G,V({value:G}),!1===r.literalBrackets||n.hasRegexChars(e))continue;const t=n.escapeRegex(q.value);if(L.output=L.output.slice(0,-q.value.length),!0===r.literalBrackets){L.output+=t,q.value=t;continue}q.value=`(${y}${t}|${q.value})`,L.output+=q.value;continue}if("{"===G&&!0!==r.nobrace){X("braces");const e={type:"brace",value:G,output:"(",outputIndex:L.output.length,tokensIndex:L.tokens.length};j.push(e),Y(e);continue}if("}"===G){const e=j[j.length-1];if(!0===r.nobrace||!e){Y({type:"text",value:G,output:G});continue}let t=")";if(!0===e.dots){const e=g.slice(),s=[];for(let t=e.length-1;t>=0&&(g.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&s.unshift(e[t].value);t=u(s,r),L.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const r=L.output.slice(0,e.outputIndex),s=L.tokens.slice(e.tokensIndex);e.value=e.output="\\{",G=t="\\}",L.output=r;for(const e of s)L.output+=e.output||e.value}Y({type:"brace",value:G,output:t}),z("braces"),j.pop();continue}if("|"===G){k.length>0&&k[k.length-1].conditions++,Y({type:"text",value:G});continue}if(","===G){let e=G;const t=j[j.length-1];t&&"braces"===H[H.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:G,output:e});continue}if("/"===G){if("dot"===q.type&&L.index===L.start+1){L.start=L.index+1,L.consumed="",L.output="",g.pop(),q=f;continue}Y({type:"slash",value:G,output:A});continue}if("."===G){if(L.braces>0&&"dot"===q.type){"."===q.value&&(q.output=b);const e=j[j.length-1];q.type="dots",q.output+=G,q.value+=G,e.dots=!0;continue}if(L.braces+L.parens===0&&"bos"!==q.type&&"slash"!==q.type){Y({type:"text",value:G,output:b});continue}Y({type:"dot",value:G,output:b});continue}if("?"===G){if((!q||"("!==q.value)&&!0!==r.noextglob&&"("===U()&&"?"!==U(2)){Q("qmark",G);continue}if(q&&"paren"===q.type){const e=U();let t=G;("("===q.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(J()))&&(t=`\\${G}`),Y({type:"text",value:G,output:t});continue}if(!0!==r.dot&&("slash"===q.type||"bos"===q.type)){Y({type:"qmark",value:G,output:$});continue}Y({type:"qmark",value:G,output:x});continue}if("!"===G){if(!0!==r.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){Q("negate",G);continue}if(!0!==r.nonegate&&0===L.index){W();continue}}if("+"===G){if(!0!==r.noextglob&&"("===U()&&"?"!==U(2)){Q("plus",G);continue}if(q&&"("===q.value||!1===r.regex){Y({type:"plus",value:G,output:R});continue}if(q&&("bracket"===q.type||"paren"===q.type||"brace"===q.type)||L.parens>0){Y({type:"plus",value:G});continue}Y({type:"plus",value:R});continue}if("@"===G){if(!0!==r.noextglob&&"("===U()&&"?"!==U(2)){Y({type:"at",extglob:!0,value:G,output:""});continue}Y({type:"text",value:G});continue}if("*"!==G){"$"!==G&&"^"!==G||(G=`\\${G}`);const e=a.exec(J());e&&(G+=e[0],L.index+=e[0].length),Y({type:"text",value:G});continue}if(q&&("globstar"===q.type||!0===q.star)){q.type="star",q.star=!0,q.value+=G,q.output=D,L.backtrack=!0,L.globstar=!0,F(G);continue}let t=J();if(!0!==r.noextglob&&/^\([^?]/.test(t)){Q("star",G);continue}if("star"===q.type){if(!0===r.noglobstar){F(G);continue}const s=q.prev,n=s.prev,i="slash"===s.type||"bos"===s.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===r.bash&&(!i||t[0]&&"/"!==t[0])){Y({type:"star",value:G,output:""});continue}const a=L.braces>0&&("comma"===s.type||"brace"===s.type),c=k.length&&("pipe"===s.type||"paren"===s.type);if(!i&&"paren"!==s.type&&!a&&!c){Y({type:"star",value:G,output:""});continue}for(;"/**"===t.slice(0,3);){const r=e[L.index+4];if(r&&"/"!==r)break;t=t.slice(3),F("/**",3)}if("bos"===s.type&&B()){q.type="globstar",q.value+=G,q.output=_(r),L.output=q.output,L.globstar=!0,F(G);continue}if("slash"===s.type&&"bos"!==s.prev.type&&!o&&B()){L.output=L.output.slice(0,-(s.output+q.output).length),s.output=`(?:${s.output}`,q.type="globstar",q.output=_(r)+(r.strictSlashes?")":"|$)"),q.value+=G,L.globstar=!0,L.output+=s.output+q.output,F(G);continue}if("slash"===s.type&&"bos"!==s.prev.type&&"/"===t[0]){const e=void 0!==t[1]?"|$":"";L.output=L.output.slice(0,-(s.output+q.output).length),s.output=`(?:${s.output}`,q.type="globstar",q.output=`${_(r)}${A}|${A}${e})`,q.value+=G,L.output+=s.output+q.output,L.globstar=!0,F(G+K()),Y({type:"slash",value:"/",output:""});continue}if("bos"===s.type&&"/"===t[0]){q.type="globstar",q.value+=G,q.output=`(?:^|${A}|${_(r)}${A})`,L.output=q.output,L.globstar=!0,F(G+K()),Y({type:"slash",value:"/",output:""});continue}L.output=L.output.slice(0,-q.output.length),q.type="globstar",q.output=_(r),q.value+=G,L.output+=q.output,L.globstar=!0,F(G);continue}const s={type:"star",value:G,output:D};!0!==r.bash?!q||"bracket"!==q.type&&"paren"!==q.type||!0!==r.regex?(L.index!==L.start&&"slash"!==q.type&&"dot"!==q.type||("dot"===q.type?(L.output+=v,q.output+=v):!0===r.dot?(L.output+=C,q.output+=C):(L.output+=N,q.output+=N),"*"!==U()&&(L.output+=E,q.output+=E)),Y(s)):(s.output=G,Y(s)):(s.output=".*?","bos"!==q.type&&"slash"!==q.type||(s.output=N+s.output),Y(s))}for(;L.brackets>0;){if(!0===r.strictBrackets)throw new SyntaxError(h("closing","]"));L.output=n.escapeLast(L.output,"["),z("brackets")}for(;L.parens>0;){if(!0===r.strictBrackets)throw new SyntaxError(h("closing",")"));L.output=n.escapeLast(L.output,"("),z("parens")}for(;L.braces>0;){if(!0===r.strictBrackets)throw new SyntaxError(h("closing","}"));L.output=n.escapeLast(L.output,"{"),z("braces")}if(!0===r.strictSlashes||"star"!==q.type&&"bracket"!==q.type||Y({type:"maybe_slash",value:"",output:`${A}?`}),!0===L.backtrack){L.output="";for(const e of L.tokens)L.output+=null!=e.output?e.output:e.value,e.suffix&&(L.output+=e.suffix)}return L};l.fastpaths=(e,t)=>{const r={...t},o="number"==typeof r.maxLength?Math.min(i,r.maxLength):i,a=e.length;if(a>o)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${o}`);e=p[e]||e;const{DOT_LITERAL:c,SLASH_LITERAL:u,ONE_CHAR:h,DOTS_SLASH:l,NO_DOT:m,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:y}=s.globChars(r.windows),O=r.dot?d:m,S=r.dot?f:m,b=r.capture?"":"?:";let R=!0===r.bash?".*?":g;r.capture&&(R=`(${R})`);const A=e=>!0===e.noglobstar?R:`(${b}(?:(?!${y}${e.dot?l:c}).)*?)`,E=e=>{switch(e){case"*":return`${O}${h}${R}`;case".*":return`${c}${h}${R}`;case"*.*":return`${O}${R}${c}${h}${R}`;case"*/*":return`${O}${R}${u}${h}${S}${R}`;case"**":return O+A(r);case"**/*":return`(?:${O}${A(r)}${u})?${S}${h}${R}`;case"**/*.*":return`(?:${O}${A(r)}${u})?${S}${R}${c}${h}${R}`;case"**/.*":return`(?:${O}${A(r)}${u})?${c}${h}${R}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const r=E(t[1]);if(!r)return;return r+c+t[2]}}},T=n.removePrefix(e,{negated:!1,prefix:""});let P=E(T);return P&&!0!==r.strictSlashes&&(P+=`${u}?`),P},e.exports=l},393:(e,t,r)=>{const s=r(498),n=r(284),i=r(366),o=r(686),a=(e,t,r=!1)=>{if(Array.isArray(e)){const s=e.map((e=>a(e,t,r))),n=e=>{for(const t of s){const r=t(e);if(r)return r}return!1};return n}const s=(n=e)&&"object"==typeof n&&!Array.isArray(n)&&e.tokens&&e.input;var n;if(""===e||"string"!=typeof e&&!s)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},o=i.windows,c=s?a.compileRe(e,t):a.makeRe(e,t,!1,!0),p=c.state;delete c.state;let u=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};u=a(i.ignore,e,r)}const h=(r,s=!1)=>{const{isMatch:n,match:h,output:l}=a.test(r,c,t,{glob:e,posix:o}),m={glob:e,state:p,regex:c,posix:o,input:r,output:l,match:h,isMatch:n};return"function"==typeof i.onResult&&i.onResult(m),!1===n?(m.isMatch=!1,!!s&&m):u(r)?("function"==typeof i.onIgnore&&i.onIgnore(m),m.isMatch=!1,!!s&&m):("function"==typeof i.onMatch&&i.onMatch(m),!s||m)};return r&&(h.state=p),h};a.test=(e,t,r,{glob:s,posix:n}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const o=r||{},c=o.format||(n?i.toPosixSlashes:null);let p=e===s,u=p&&c?c(e):e;return!1===p&&(u=c?c(e):e,p=u===s),!1!==p&&!0!==o.capture||(p=!0===o.matchBase||!0===o.basename?a.matchBase(e,t,r,n):t.exec(u)),{isMatch:Boolean(p),match:p,output:u}},a.matchBase=(e,t,r)=>(t instanceof RegExp?t:a.makeRe(t,r)).test(i.basename(e)),a.isMatch=(e,t,r)=>a(t,r)(e),a.parse=(e,t)=>Array.isArray(e)?e.map((e=>a.parse(e,t))):n(e,{...t,fastpaths:!1}),a.scan=(e,t)=>s(e,t),a.compileRe=(e,t,r=!1,s=!1)=>{if(!0===r)return e.output;const n=t||{},i=n.contains?"":"^",o=n.contains?"":"$";let c=`${i}(?:${e.output})${o}`;e&&!0===e.negated&&(c=`^(?!${c}).*$`);const p=a.toRegex(c,t);return!0===s&&(p.state=e),p},a.makeRe=(e,t={},r=!1,s=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(i.output=n.fastpaths(e,t)),i.output||(i=n(e,t)),a.compileRe(i,t,r,s)},a.toRegex=(e,t)=>{try{const r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},a.constants=o,e.exports=a},498:(e,t,r)=>{const s=r(366),{CHAR_ASTERISK:n,CHAR_AT:i,CHAR_BACKWARD_SLASH:o,CHAR_COMMA:a,CHAR_DOT:c,CHAR_EXCLAMATION_MARK:p,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:h,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:m,CHAR_PLUS:d,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:O}=r(686),S=e=>e===u||e===o,b=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};e.exports=(e,t)=>{const r=t||{},R=e.length-1,A=!0===r.parts||!0===r.scanToEnd,E=[],T=[],P=[];let v,C,x=e,$=-1,M=0,w=0,_=!1,N=!1,I=!1,D=!1,L=!1,k=!1,j=!1,H=!1,G=!1,q=!1,B=0,U={value:"",depth:0,isGlob:!1};const K=()=>$>=R,J=()=>(v=C,x.charCodeAt(++$));for(;$<R;){let e;if(C=J(),C!==o){if(!0===k||C===h){for(B++;!0!==K()&&(C=J());)if(C!==o)if(C!==h){if(!0!==k&&C===c&&(C=J())===c){if(_=U.isBrace=!0,I=U.isGlob=!0,q=!0,!0===A)continue;break}if(!0!==k&&C===a){if(_=U.isBrace=!0,I=U.isGlob=!0,q=!0,!0===A)continue;break}if(C===g&&(B--,0===B)){k=!1,_=U.isBrace=!0,q=!0;break}}else B++;else j=U.backslashes=!0,J();if(!0===A)continue;break}if(C!==u){if(!0!==r.noext&&!0==(C===d||C===i||C===n||C===f||C===p)&&x.charCodeAt($+1)===l){if(I=U.isGlob=!0,D=U.isExtglob=!0,q=!0,C===p&&$===M&&(G=!0),!0===A){for(;!0!==K()&&(C=J());)if(C!==o){if(C===y){I=U.isGlob=!0,q=!0;break}}else j=U.backslashes=!0,C=J();continue}break}if(C===n){if(v===n&&(L=U.isGlobstar=!0),I=U.isGlob=!0,q=!0,!0===A)continue;break}if(C===f){if(I=U.isGlob=!0,q=!0,!0===A)continue;break}if(C===m){for(;!0!==K()&&(e=J());)if(e!==o){if(e===O){N=U.isBracket=!0,I=U.isGlob=!0,q=!0;break}}else j=U.backslashes=!0,J();if(!0===A)continue;break}if(!0===r.nonegate||C!==p||$!==M){if(!0!==r.noparen&&C===l){if(I=U.isGlob=!0,!0===A){for(;!0!==K()&&(C=J());)if(C!==l){if(C===y){q=!0;break}}else j=U.backslashes=!0,C=J();continue}break}if(!0===I){if(q=!0,!0===A)continue;break}}else H=U.negated=!0,M++}else{if(E.push($),T.push(U),U={value:"",depth:0,isGlob:!1},!0===q)continue;if(v===c&&$===M+1){M+=2;continue}w=$+1}}else j=U.backslashes=!0,C=J(),C===h&&(k=!0)}!0===r.noext&&(D=!1,I=!1);let F=x,V="",W="";M>0&&(V=x.slice(0,M),x=x.slice(M),w-=M),F&&!0===I&&w>0?(F=x.slice(0,w),W=x.slice(w)):!0===I?(F="",W=x):F=x,F&&""!==F&&"/"!==F&&F!==x&&S(F.charCodeAt(F.length-1))&&(F=F.slice(0,-1)),!0===r.unescape&&(W&&(W=s.removeBackslashes(W)),F&&!0===j&&(F=s.removeBackslashes(F)));const X={prefix:V,input:e,start:M,base:F,glob:W,isBrace:_,isBracket:N,isGlob:I,isExtglob:D,isGlobstar:L,negated:H,negatedExtglob:G};if(!0===r.tokens&&(X.maxDepth=0,S(C)||T.push(U),X.tokens=T),!0===r.parts||!0===r.tokens){let t;for(let s=0;s<E.length;s++){const n=t?t+1:M,i=E[s],o=e.slice(n,i);r.tokens&&(0===s&&0!==M?(T[s].isPrefix=!0,T[s].value=V):T[s].value=o,b(T[s]),X.maxDepth+=T[s].depth),0===s&&""===o||P.push(o),t=i}if(t&&t+1<e.length){const s=e.slice(t+1);P.push(s),r.tokens&&(T[T.length-1].value=s,b(T[T.length-1]),X.maxDepth+=T[T.length-1].depth)}X.slashes=E,X.parts=P}return X}},366:(e,t,r)=>{const{REGEX_BACKSLASH:s,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:o}=r(686);t.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),t.hasRegexChars=e=>i.test(e),t.isRegexChar=e=>1===e.length&&t.hasRegexChars(e),t.escapeRegex=e=>e.replace(o,"\\$1"),t.toPosixSlashes=e=>e.replace(s,"/"),t.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){const e=navigator.platform.toLowerCase();return"win32"===e||"windows"===e}return!("undefined"==typeof process||!process.platform)&&"win32"===process.platform},t.removeBackslashes=e=>e.replace(n,(e=>"\\"===e?"":e)),t.escapeLast=(e,r,s)=>{const n=e.lastIndexOf(r,s);return-1===n?e:"\\"===e[n-1]?t.escapeLast(e,r,n-1):`${e.slice(0,n)}\\${e.slice(n)}`},t.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r},t.wrapOutput=(e,t={},r={})=>{let s=`${r.contains?"":"^"}(?:${e})${r.contains?"":"$"}`;return!0===t.negated&&(s=`(?:^(?!${s}).*$)`),s},t.basename=(e,{windows:t}={})=>{const r=e.split(t?/[\\/]/:"/"),s=r[r.length-1];return""===s?r[r.length-2]:s}},725:(e,t,r)=>{var s=r(880);function n(e){if(!Object.prototype.hasOwnProperty.call(i.message,e))throw new Error("invalid status code: "+e);return i.message[e]}function i(e){if("number"==typeof e)return n(e);if("string"!=typeof e)throw new TypeError("code must be a number or string");var t=parseInt(e,10);return isNaN(t)?function(e){var t=e.toLowerCase();if(!Object.prototype.hasOwnProperty.call(i.code,t))throw new Error('invalid status message: "'+e+'"');return i.code[t]}(e):n(t)}e.exports=i,i.message=s,i.code=function(e){var t={};return Object.keys(e).forEach((function(r){var s=e[r],n=Number(r);t[s.toLowerCase()]=n})),t}(s),i.codes=function(e){return Object.keys(e).map((function(e){return Number(e)}))}(s),i.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},i.empty={204:!0,205:!0,304:!0},i.retry={502:!0,503:!0,504:!0}},414:e=>{e.exports=t},171:e=>{e.exports=r},579:t=>{t.exports=e},880:e=>{e.exports=JSON.parse('{"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I\'m a Teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Too Early","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}')}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return s[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};i.r(o),i.d(o,{ARRAY_PROPERTIES:()=>De,AcceptMime:()=>Jr,AdditionalProperties:()=>Lt,All:()=>gs,AllOf:()=>kt,Allow:()=>Ht,Any:()=>Gt,AnyOf:()=>qt,ArrayOf:()=>Ct,BOOLEAN_PROPERTIES:()=>Ne,COMMON_PROPERTIES:()=>ke,Children:()=>Tt,CollectionContains:()=>$t,CollectionOf:()=>vt,Const:()=>Bt,Consumes:()=>Kr,ContentType:()=>Zr,Converter:()=>An,CustomKey:()=>Ut,CustomKeys:()=>Kt,DateFormat:()=>pr,DateTime:()=>cr,DecoratorContext:()=>Fr,Default:()=>Jt,DefaultMsg:()=>Vt,Delete:()=>bs,Deprecated:()=>es,Description:()=>Wt,Discriminator:()=>_,DiscriminatorKey:()=>Xt,DiscriminatorValue:()=>Pt,Email:()=>ar,EndpointMetadata:()=>V,Enum:()=>zt,ErrorMsg:()=>Ft,Example:()=>Yt,Examples:()=>Qt,ExclusiveMaximum:()=>tr,ExclusiveMinimum:()=>nr,For:()=>Nr,Format:()=>or,ForwardGroups:()=>mr,GenericOf:()=>Br,Generics:()=>Ur,Get:()=>ys,Groups:()=>Or,HTTP_STATUS_MESSAGES:()=>at,Head:()=>Rs,Header:()=>ts,Hidden:()=>Sr,Ignore:()=>br,In:()=>rs,InFile:()=>ss,Integer:()=>Rr,JSON_TYPES:()=>C,JsonClassStore:()=>L,JsonEntitiesContainer:()=>R,JsonEntityComponent:()=>E,JsonEntityFn:()=>Et,JsonEntityStore:()=>A,JsonFormatTypes:()=>ir,JsonLazyRef:()=>ye,JsonMap:()=>H,JsonMedia:()=>B,JsonMethodPath:()=>K,JsonMethodStore:()=>F,JsonOperation:()=>J,JsonOperationPathsMap:()=>se,JsonOperationRoute:()=>ws,JsonParameter:()=>Y,JsonParameterStore:()=>Q,JsonParameterTypes:()=>W,JsonPropertyStore:()=>ee,JsonRequestBody:()=>lt,JsonResponse:()=>U,JsonSchema:()=>D,LabelledAs:()=>Ar,Location:()=>ns,MANY_OF_PROPERTIES:()=>we,MapOf:()=>xt,Max:()=>er,MaxItems:()=>wt,MaxLength:()=>Er,MaxProperties:()=>_t,Maximum:()=>Zt,Min:()=>sr,MinItems:()=>Nt,MinLength:()=>Tr,MinProperties:()=>It,Minimum:()=>rr,MultipleOf:()=>Pr,NUMBER_PROPERTIES:()=>Ie,Name:()=>vr,Nullable:()=>Cr,OBJECT_PROPERTIES:()=>Le,OPERATION_HTTP_VERBS:()=>p,OPERATION_WS_VERBS:()=>u,OneOf:()=>xr,Operation:()=>cs,OperationId:()=>ps,OperationPath:()=>us,OperationVerbs:()=>a,Optional:()=>$r,Options:()=>Es,ParamMetadata:()=>Z,Partial:()=>hs,Patch:()=>As,Path:()=>ls,Pattern:()=>Mr,Post:()=>Os,Produces:()=>ms,Property:()=>jt,PropertyMetadata:()=>te,Publish:()=>ds,Put:()=>Ss,ReadOnly:()=>wr,RecordOf:()=>Ir,Redirect:()=>fs,Required:()=>Dr,RequiredGroups:()=>Lr,Returns:()=>Qr,STRING_PROPERTIES:()=>_e,Schema:()=>_r,Security:()=>Ts,SpecTypes:()=>pe,Status:()=>Ps,Subscribe:()=>vs,Summary:()=>Cs,Tags:()=>xs,TimeFormat:()=>ur,Title:()=>kr,TypeError:()=>jr,UniqueItems:()=>Dt,Uri:()=>hr,Url:()=>lr,View:()=>$s,WriteOnly:()=>Hr,allOf:()=>_s,alterIgnore:()=>He,alterOneOf:()=>Ve,alterRequiredGroups:()=>Ue,any:()=>Ns,anyMapper:()=>Re,anyOf:()=>Is,array:()=>Ls,boolean:()=>Ds,buildPath:()=>y,channelsMapper:()=>ce,classMapper:()=>Ae,concatParameters:()=>ft,concatPath:()=>Ms,createRef:()=>Se,createRefName:()=>Oe,date:()=>Hs,datetime:()=>Gs,defineStatusModel:()=>Wr,discriminatorMappingMapper:()=>Ee,email:()=>Bs,enums:()=>Us,enumsMapper:()=>Te,enumsRegistry:()=>P,execMapper:()=>d,execOneOfMapper:()=>g,formatParameterType:()=>X,from:()=>Gr,generateSpec:()=>Tn,genericsMapper:()=>Pe,getComputedType:()=>v,getGenericsMap:()=>le,getInheritedStores:()=>ne,getJsonEntityStore:()=>re,getJsonPathParameters:()=>gt,getJsonSchema:()=>vn,getJsonSchemaMapper:()=>m,getJsonType:()=>x,getOperationId:()=>St,getOperationsRoutes:()=>Cn,getOperationsStores:()=>ie,getProperties:()=>$n,getPropertiesStores:()=>xn,getSpec:()=>nn,getSpecType:()=>on,getSpecTypeFromSpec:()=>an,getStatusConstant:()=>ct,getStatusMessage:()=>pt,getStatusModel:()=>Xr,hasMapper:()=>f,inheritedClassMapper:()=>Ce,integer:()=>Ks,isParameterType:()=>z,isRedirectionStatus:()=>j,isSuccessStatus:()=>k,itemMapper:()=>xe,lazyRef:()=>Js,lazyRefMapper:()=>$e,makeOf:()=>ue,map:()=>ks,mapAliasedProperties:()=>Je,mapGenericsOptions:()=>me,mapHeaders:()=>G,mapMapper:()=>Me,mapOpenSpec:()=>hn,mapOpenSpec2:()=>pn,mapOpenSpec3:()=>un,mapOpenSpecInfo:()=>cn,mapOperationOptions:()=>os,matchGroups:()=>yr,mergeSpec:()=>rn,messageMapper:()=>he,nullableMapper:()=>je,nullableMapperOpenApi:()=>Ze,number:()=>Fs,object:()=>Vs,objectMapper:()=>Ge,ofMapper:()=>qe,oneOf:()=>Ws,operationIdFormatter:()=>Ot,operationInFilesMapper:()=>et,operationInParameterMapper:()=>tt,operationInParametersMapper:()=>rt,operationInQueryMapper:()=>nt,operationMapper:()=>ut,operationMediaMapper:()=>ht,operationRequestBodyMapper:()=>mt,operationResponseMapper:()=>dt,parameters:()=>Qs,pathsMapper:()=>At,payloadMapper:()=>fe,popGenerics:()=>de,propertiesMapper:()=>Be,registerJsonSchemaMapper:()=>l,removeHiddenOperation:()=>oe,requiredMapper:()=>Ke,responsePayloadMapper:()=>ge,schemaMapper:()=>ze,schemesReducer:()=>Ys,security:()=>Zs,serializeEnum:()=>$,serializeEnumValues:()=>M,set:()=>js,string:()=>qr,tagsReducer:()=>en,time:()=>qs,toJsonMapCollection:()=>q,toJsonRegex:()=>w,toRef:()=>be,transformInformation:()=>Rn,transformSecurity:()=>bn,transformToOS2:()=>En,uri:()=>Xs,url:()=>zs,withErrorMsg:()=>Mt,wrapEnumsMapper:()=>Ye});var a,c=i(579);!function(e){e.ALL="ALL",e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.HEAD="HEAD",e.DELETE="DELETE",e.OPTIONS="OPTIONS",e.TRACE="TRACE",e.PUBLISH="PUBLISH",e.SUBSCRIBE="SUBSCRIBE",e.CUSTOM="CUSTOM"}(a||(a={}));const p=[a.ALL,a.GET,a.POST,a.PUT,a.PATCH,a.HEAD,a.DELETE,a.OPTIONS,a.TRACE,a.CUSTOM],u=[a.PUBLISH,a.SUBSCRIBE],h=new Map;function l(e,t,r){return h.set(r?`${r}:${e}`:e,t)}function m(e,t){const r=h.get(`${t?.specType}:${e}`)||h.get(e);if(r)return r;throw new Error(`JsonSchema ${e} mapper doesn't exists`)}function d(e,t,r,s){return m(e,r)(...t,r,s)}function f(e){return h.has(e)}function g(e,t){return e.find((e=>h.has(`${t?.specType}:${e}`)))||e.find((e=>h.has(e)))}function y(e){return e.split("/").filter(Boolean).join("/")}var O=i(414);function S(e,t,r,s){var n,i=arguments.length,o=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(i<3?n(o):i>3?n(t,r,o):n(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function b(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const R=new Map;class A{constructor(e){this.isStore=!0;const{target:t,propertyKey:r,descriptor:s,index:n,decoratorType:i}=e;this.target=t,this.propertyKey=r,this.propertyName=String(r),this.descriptor=s,this.index=n,this.decoratorType=i,this.token=t,this.store=e.store,this.parent=this}get targetName(){return(0,O.nameOf)(this.token)}get isCollection(){return!!this.collectionType}get isArray(){return(0,O.isArrayOrArrayClass)(this.collectionType)}get discriminatorAncestor(){const e=(0,O.ancestorsOf)(this.target).find((e=>A.from(e).schema.isDiscriminator));return e&&A.from(e)}get isPrimitive(){return(0,O.isPrimitiveOrPrimitiveClass)(this._type)}get isDate(){return(0,O.isDate)(this.computedType)}get isObject(){return(0,O.isObject)(this.computedType)}get isClass(){return(0,O.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(){return this.schema.isDiscriminator&&this.discriminatorAncestor?.schema.discriminator().base!==this.target}static from(...e){if(e[0].isStore)return e[0];const t=e[0];e.length>1&&(e[0]=(0,O.prototypeOf)(e[0]));const r=O.Store.from(...e);if(!r.has("JsonEntityStore")){const s=(0,O.decoratorTypeOf)(e),n=new(R.get(s))({store:r,decoratorType:s,target:(0,O.classOf)(t),propertyKey:e[1],index:"number"==typeof e[2]?e[2]:void 0,descriptor:"object"==typeof e[2]?e[2]:void 0});n.build(),r.set("JsonEntityStore",n)}return r.get("JsonEntityStore")}static fromMethod(e,t){return this.from(e,t,(0,O.descriptorOf)(e,t))}static get(e,t,r){return A.from((0,O.prototypeOf)(e),t,r)}isGetterOnly(){return(0,O.isObject)(this.descriptor)&&!this.descriptor.value&&this.descriptor.get&&!this.descriptor.set}get(e,t){return this.store.get(e,t)}set(e,t){return this.store.set(e,t)}toString(){return[this.targetName,this.propertyName,this.index].filter((e=>void 0!==e)).join(":")}buildType(e){(0,O.isCollection)(e)?this.collectionType=e:(this._type=e,this._type&&(0,O.isPlainObject)(this._type)&&(this._type=String))}getBestType(){return this.itemSchema.hasDiscriminator?this.itemSchema.discriminator().base:(0,O.isClassObject)(this.type)?this.itemSchema.getTarget():(0,O.isArrowFn)(this.type)?this.type():this.type}}function E(e){return t=>{R.set(e,t)}}var T=i(171);const P=new Map;function v(e){return(0,O.isPromise)(e)||e===Function?Object:(0,O.isClass)(e)||(0,O.isSymbol)(e)||(0,O.isPrimitiveOrPrimitiveClass)(e)||(0,O.isClassObject)(e)||(0,O.isDate)(e)||(0,O.isCollection)(e)?(0,O.classOf)(e):(0,O.isArrowFn)(e)?e():e}const C=["string","number","integer","boolean","object","array","null","any"];function x(e){return null===e?"null":(0,O.isPrimitiveOrPrimitiveClass)(e)?C.indexOf(e)>-1?e:"string"==typeof e?"file"===e?"file":"generic":(0,O.primitiveOf)(e):e===Array?"array":(0,O.isArray)(e)?e.map(x):e===Set?"array":(0,O.isDate)(e)||(0,O.isBuffer)(e)?"string":"object"}const $=e=>(0,O.isObject)(e)&&null!==e?Object.entries(e).reduce(((e,[t,r])=>isNaN(+t)?e.concat(r):e),[]):e;function M(e){const t=e.reduce(((e,t)=>e.concat($(t))),[]),r=t.reduce(((e,t)=>e.add((e=>null===e?"null":typeof e)(t))),new Set);return{values:(0,O.uniq)(t),types:r}}function w(e){return String(e).replace(/^(\/)(.*)(\/)$/,"$2")}class _{constructor({base:e,propertyName:t,types:r,values:s}={}){this.values=new Map,this.types=new Map,Object.assign(this,(0,O.cleanObject)({base:e,propertyName:t,types:r?new Map(r):void 0,values:s?new Map(s):void 0}))}add(e,t){return t.forEach((t=>{this.values.set(t,e)})),this.types.set(e,t),this}getType(e){return this.values.get(e)||this.base}getValues(e){return this.types.get(e)}getDefaultValue(e){const t=this.types.get(e);return t?t[0]:void 0}children(){return[...new Set([...this.types.keys()])]}}function N(e){return e instanceof D?e:Object.entries(e).reduce(((e,[t,r])=>(e[w(t)]=I(r),e)),{})}function I(e){return(0,O.isArray)(e)?e.map(I):e.isStore||e.$isJsonDocument||e.isLazyRef?e:(0,O.classOf)(e)!==Object&&(0,O.isClass)(e)?A.from(e).schema:(0,O.isObject)(e)?D.from(e):(0,O.isPrimitiveClass)(e)?D.from({type:e}):e}class D extends Map{#e;#t;#r;#s;#n;#i;#o;#a;#c;#p;constructor(e={}){super(),this.$kind="schema",this.$isJsonDocument=!0,this.$hooks=new T.Hooks,this.$required=new Set,this.$allow=[],this.$forwardGroups=!1,this.$ignore=!1,this.isDiscriminatorKey=!1,this.isDiscriminator=!1,this.#e=!1,this.#t=null,this.#s=[],this.#n=new Map,this.#a=!1,this.#c=!1,this.#p=!1,e&&this.assign(e)}get alias(){return this.#n}get nestedGenerics(){return this.#s}set nestedGenerics(e){this.#s=e}get genericLabels(){return this.#r}set genericLabels(e){this.#r=e}get isClass(){return(0,O.isClass)(this.class)&&![Map,Array,Set,Object,Date,Boolean,Number,String].includes(this.#o)}get isCollection(){return this.#c}get isGeneric(){return this.#a}get discriminatorAncestor(){const e=(0,O.ancestorsOf)(this.#o).find((e=>A.from(e).schema.isDiscriminator));return e&&A.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 this.#p}get isNullable(){return this.#e}get isReadOnly(){return this.get("readOnly")}get isWriteOnly(){return this.get("writeOnly")}get hasDiscriminator(){return!!this.#t}static from(e={}){return new D(e)}nullable(e){this.#e=e}itemSchema(e={}){return this.#i=this.#i||I(e),this.#i.assign(e),this.#i}getAliasOf(e){return this.#n.get(e)}addAlias(e,t){return this.#n.set(e,t),this.#n.set(t,e),this}removeAlias(e){const t=this.#n.get(e);return t&&this.#n.delete(t),this.#n.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 this.#p=!0,super.set("name",e),this}name(e){return super.set("name",e),this}ignore(e){return"boolean"!=typeof e&&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,this.#t=this.#t||new _({base:this.#o})}discriminatorKey(e){return this.discriminator().propertyName=e,this.isDiscriminator=!0,this}discriminatorValue(...e){const t=this.discriminatorAncestor.discriminator();t.add(this.#o,e),this.isDiscriminator=!0;const r=this.get("properties"),s=r[t.propertyName]||new D({type:"string"});return 1===e.length?(s.const(e[0]),s.examples([e[0]])):(s.enum(...e),s.examples(e)),r[t.propertyName]=s,this.set("properties",r),this}additionalItems(e){return super.set("additionalItems",I(e)),this}contains(e){return super.set("contains",I(e)),this}examples(e){return super.set("examples",e),this}example(...e){return this.examples(e)}items(e){return super.set("items",this.#i=I(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((e=>{switch(e){case"":this.set("minLength",void 0);break;case null:this.any(...["null"].concat(this.getJsonType(),this.$allow.map((e=>typeof e))))}})),this.$allow.push(...e),this}required(e=!0){if(!(0,O.isArray)(e)){const t=this.clone();return t.$selfRequired=e,[].concat(t.getJsonType()).includes("string")&&t.minLength(1),t}return this.$required.clear(),e.forEach((e=>this.$required.add(e))),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",N(e)),this}addProperty(e,t){const r=this.get("properties")||{};return r[e]=t,super.set("properties",N(r)),this}patternProperties(e){return super.set("patternProperties",N(e)),this}additionalProperties(e){return super.set("additionalProperties",I(e)),this}unknown(e=!0){return this.additionalProperties(e)}dependencies(e){return super.set("dependencies",N(e)),this}propertyNames(e){return super.set("propertyNames",I(e)),this}enum(e,...t){if(P.has(e))return this.enum(P.get(e));if(e instanceof D)e.getName()?super.set("enum",e):super.set("enum",e.get("enum")).any(...e.get("enum").map((e=>typeof e)));else{const{values:r,types:s}=M([e,t].flat());super.set("enum",r).any(...s)}return this}definitions(e){return super.set("definitions",N(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",I(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",w(e)),this}format(e){return super.set("format",e),this}type(e){switch(e){case"map":case Map:super.set("type",x(e)),this.#o=e,this.#c=!0,this.has("additionalProperties")||super.set("additionalProperties",this.itemSchema({}));break;case"array":case Array:super.set("type",x(e)),this.#o=e,this.#c=!0,this.has("items")||super.set("items",this.itemSchema({}));break;case"set":case Set:super.set("type",x(e)),this.#o=e,this.#c=!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",x(e)),this.#o=e,this.has("properties")||super.set("properties",{});break;default:if((0,O.isClass)(e)||(0,O.isFunction)(e))super.set("type",void 0),this.#o=e,this.has("properties")||super.set("properties",{});else{const t=x(e);"generic"===t?(this.#a=!0,super.set("$ref",e)):super.set("type",t)}}return this}any(...e){return e=e.length?e:["integer","number","string","boolean","array","object","null"],(e=(0,O.uniq)(e).map((e=>(0,O.isClass)(e)?e:{type:x(e)}))).length>1?this.anyOf(e):this.type(e[0]?.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,t){return super.set(`#${e}`,t),this}toObject(e){return this.toJSON(e)}toJSON(e){return d("schema",[this],e)}assign(e={}){return(e instanceof D?[...e.entries()]:Object.entries(e)).forEach((([e,t])=>{this.set(e,t)})),e instanceof D&&(this.$selfRequired=e.$selfRequired,this.$allow.push(...e.$allow),e.$required.forEach((e=>{this.$required.add(e)})),this.#t=this.#t?new _(this.#t):null,this.isDiscriminator=e.isDiscriminator,this.isDiscriminatorKey=e.isDiscriminatorKey,this.#p=e.#p,this.#n=new Map(this.#n.entries()),e.#r&&(this.#r=[...e.#r]),this.#s=e.#s.map((e=>[...e])),this.#o=e.#o,this.#a=e.#a,this.#c=e.#c,this.#p=e.#p,this.#e=e.#e,super.set("type",e.get("type"))),this}set(e,t){return e in this?(0,O.isFunction)(this[e])&&this[e](t):super.set(e,t),this}getComputedType(){return v(this.#o)}getComputedItemType(){return this.#i?this.#i.getComputedType():this.getComputedType()}getJsonType(){return this.get("anyOf")?this.get("anyOf").map((e=>e.getJsonType())):this.get("type")||x(this.getComputedType())}getTarget(){return this.#o}getName(){return this.get("name")||((0,O.isClass)(this.#o)?(0,O.nameOf)((0,O.classOf)(this.getComputedType())):"")}clone(){return new D(this)}setManyOf(e,t){let r=t.filter((e=>"null"!==e?.type||(this.nullable(!0),!1))).map(I);if(!(1!==r.length||t[0]instanceof D||this.isNullable)){if(!r[0].hasDiscriminator)return this.type(t[0]);const e=r[0].discriminator().children();if(!e.length)return this.type(t[0]);r=e.map(I)}super.set(e,r);const s=r[0];if(s.isDiscriminator){const e=s.discriminatorAncestor.discriminator(),{propertyName:t}=e;super.set("discriminator",{propertyName:t,mapping:r.reduce(((t,r)=>(e.types.get(r.getTarget())?.forEach((e=>{t[e]=r})),t)),{})}),this.isDiscriminator=!0,this.#t=e}}}let L=class extends A{constructor(){super(...arguments),this.children=new Map}get path(){return this.store.get("path","/")}set path(e){this.store.set("path",e)}build(){this._type||this.buildType(this.target),this._type=this._type||Object,this._schema=D.from({type:this.type})}};L=S([E(O.DecoratorTypes.CLASS)],L);const k=e=>Number(e)&&200<=Number(e)&&Number(e)<300,j=e=>Number(e)&&300<=Number(e)&&Number(e)<400;class H extends Map{constructor(e={}){super(),this.$kind="map",this.$isJsonDocument=!0,this.assign(e)}assign(e={}){return Object.entries(e).forEach((([e,t])=>{(0,O.isFunction)(this[e])?this[e](t):this.set(e,t)})),this}toJSON(e){return d("map",[this],e)}}function G(e){return Object.keys(e).reduce(((t,r)=>{const s=e[r];let n=typeof s,i={example:s};return"object"===n&&(i=s,i.example=void 0===i.value?i.example:i.value,delete i.value,n=typeof i.example),i.type=i.type||n,t[r]=(0,O.cleanObject)(i),t}),{})}function q(e,t=H){return Object.entries(e).reduce(((e,[r,s])=>(e.set(r,new t(s)),e)),new H)}class B extends H{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 U extends H{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",G(e)),this}content(e){return this.set("content",q(e,B)),this}getContent(){return this.get("content")}getMedia(e,t=!0){return t&&this.addMedia(e),this.getContent()?.get(e)}addMedia(e){const t=this.get("content");return t.has(e)||t.set(e,new B),this}isBinary(){return this.getContent().has("application/octet-stream")}}class K extends H{constructor(e,t){super(),this.method=e,this.path=t}summary(e){return super.set("summary",e),this}description(e){return super.set("description",e),this}}class J extends H{#u;#h;constructor(e={}){super({parameters:[],responses:new H,...e}),this.$kind="operation",this.operationPaths=new Map,this.#h=!1}get response(){return this.getResponses().get(this.getStatus().toString())}get status(){return this.#u}tags(e){return super.set("tags",e),this}addTags(e){return e=(0,O.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 this.#u=e,this}getStatus(){return this.#u||200}setRedirection(e=302){return this.#h=!0,this.#u=e,this}isRedirection(e){return this.#h&&e?j(e):this.#h}addResponse(e,t){if((k(e)||j(e))&&!this.#u){const t=this.getResponseOf(200);this.getResponses().set(e.toString(),t).delete("200"),this.defaultStatus(Number(e))}const r="default"===e?this.getStatus().toString():e.toString(),s=this.getResponses().get(r);return s?(t.forEach(((e,t)=>{["content"].includes(t)||s.set(t,(0,O.deepMerge)(s.get(t),e))})),s.status=Number(r)):(t.status=Number(r),this.getResponses().set(r,t)),this}getResponses(){return this.get("responses")}getResponseOf(e){return("default"===e?this.response:this.getResponses().get(String(e)))||new U}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,t){const r=this.get("security")||{};return r[e]=(0,O.uniq)([...r[e]||[],...t]),this.security(r)}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,t){-1===e&&(e=this.get("parameters").length),this.get("parameters")[e]=t}consumes(e){return super.set("consumes",e),this}produces(e){return super.set("produces",e),this}addProduce(e){const t=(0,O.uniq)([].concat(this.get("produces"),e)).filter(Boolean);this.set("produces",t)}addOperationPath(e,t){const r=new K(e,t);return this.operationPaths.set(String(e)+String(t),r),r}getAllowedOperationPath(e){return e?[...this.operationPaths.values()].filter((({method:t})=>t&&e.includes(t.toUpperCase()))):[...this.operationPaths.values()]}}let F=class extends A{constructor(e){super({store:O.Store.fromMethod(e.target,e.propertyKey),descriptor:(0,O.descriptorOf)(e.target,e.propertyKey),...e}),this.parent=A.from(this.target),this.middlewares=[],this.beforeMiddlewares=[],this.afterMiddlewares=[],this.operation=new J,this.children=new Map;const{beforeMiddlewares:t=[],middlewares:r=[],afterMiddlewares:s=[]}=e;this.after(s),this.before(t),this.use(r)}get params(){return this.parameters}get view(){return this.store.get("view")}set view(e){this.store.set("view",e)}get acceptMimes(){return this.store.get("acceptMimes",[])}set acceptMimes(e){this.store.set("acceptMimes",e)}get parameters(){return[...this.children.values()]}get operationPaths(){return this.operation.operationPaths}static get(e,t,r){return r=r||(0,O.descriptorOf)((0,O.prototypeOf)(e),t),A.from((0,O.prototypeOf)(e),t,r)}getResponseOptions(e,{contentType:t="application/json",includes:r}={}){const s=this.operation.getResponseOf(e).getMedia(t,!1);if(s&&s.has("schema")){const e=s.get("schema");let t=s.groups;return r&&s.allowedGroups?.size&&(t=[...t||[],...r.filter((e=>s.allowedGroups.has(e)))]),{type:e.getComputedItemType(),groups:t}}return{type:this.type}}before(e){return this.beforeMiddlewares=this.beforeMiddlewares.concat(e).filter(O.isFunction),this}after(e){return this.afterMiddlewares=this.afterMiddlewares.concat(e).filter(O.isFunction),this}use(e){return this.middlewares=this.middlewares.concat(e).filter(O.isFunction),this}get(e){const t=O.Store.from(this.target).get(e);return(0,O.deepMerge)(t,this.store.get(e))}getParamTypes(){return[...this.children.values()].reduce(((e,t)=>({...e,[t.paramType]:!0})),{})}build(){if(!this._type){let e=O.Metadata.getReturnType(this.target,this.propertyKey);e=(0,O.isPromise)(e)?void 0:e,this.buildType(e)}this._type=this._type||Object,this.parent.children.set(this.propertyName,this),(0,O.isCollection)(this._type)&&(this.collectionType=this._type,delete this._type),this._schema=D.from({type:this.collectionType||this.type}),this.collectionType&&this._schema.itemSchema(this.type),this.parent.schema.addProperty(this.propertyName,this.schema)}};F=S([E(O.DecoratorTypes.METHOD),b("design:paramtypes",[Object])],F);const V=F;var W;function X(e){return String(e).toLowerCase().replace("raw_","").replace("cookies","cookie")}function z(e){return Object.values(W).includes(X(e))}!function(e){e.BODY="body",e.PATH="path",e.QUERY="query",e.HEADER="header",e.COOKIES="cookie",e.FILES="files"}(W||(W={}));class Y extends H{constructor(){super(...arguments),this.$kind="operationInParameter",this.nestedGenerics=[]}getName(){const e=this.get("name");return"files"===this.get("in")?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,t=""){return this.set("in",X(e)),this.expression=t,this}required(e){return this.set("required",e),this}schema(e){return this.$schema=e,this}toJSON(e){return d("operationInParameter",[this],e)}}let Q=class extends A{constructor(e){super(e),this.parameter=new Y,this.parent=A.fromMethod(this.target,this.propertyKey),this.pipes=e.pipes||[],this.paramType=e.paramType||this.paramType,this.expression=e.expression||this.expression,this.dataPath=e.dataPath||this.dataPath}get nestedGenerics(){return this.parameter.nestedGenerics}set nestedGenerics(e){this.parameter.nestedGenerics=e}get required(){return!!this.parameter.get("required")}set required(e){this.parameter.required(e)}get allowedRequiredValues(){return this.schema.$allow}static getParams(e,t){const r=[],s=(0,O.ancestorsOf)(e).reverse().find((e=>(0,O.isMethodDescriptor)(e,t)&&A.fromMethod(e,t).children.size));return s?(A.fromMethod(s,t).children.forEach(((e,t)=>{r[+t]=e})),r):[]}static get(e,t,r){return A.from((0,O.prototypeOf)(e),t,r)}isRequired(e){return this.required&&[void 0,null,""].includes(e)&&!this.allowedRequiredValues.includes(e)}getSchema(e){return(0,O.isCollection)(e)||!(0,O.isClass)(e)?D.from({type:e}):A.from(e).schema}build(){if(!this._type){const e=O.Metadata.getParamTypes((0,O.prototypeOf)(this.target),this.propertyKey)[this.index];this.buildType(e)}this._type=this._type||Object,this._schema||(this.parent.children.set(this.index,this),this._schema=this.getSchema(this.collectionType||this.type),this.parameter.schema(this._schema),this.collectionType&&this._schema.itemSchema(this.getSchema(this.type)),this.parent.operation.addParameter(this.index,this.parameter))}};Q=S([E(O.DecoratorTypes.PARAM),b("design:paramtypes",[Object])],Q);const Z=Q;let ee=class extends A{constructor(){super(...arguments),this.parent=A.from(this.target)}get required(){return this.parent.schema.isRequired(this.propertyKey)}set required(e){e?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(e){return this.required&&[void 0,null,""].includes(e)&&!this.allowedRequiredValues.includes(e)}build(){this._type||this.buildType(O.Metadata.getType((0,O.prototypeOf)(this.target),this.propertyKey)),this._type=this._type||Object;let e=this.parent.schema.get("properties")[this.propertyName];e||(this.parent.children.set(this.propertyName,this),e=D.from({type:this.collectionType||this.type}),this.collectionType&&e.itemSchema(this.type)),this.parent.schema.addProperty(this.propertyName,e),this._schema=e}static get(e,t){return A.from((0,O.prototypeOf)(e),t)}};ee=S([E(O.DecoratorTypes.PROP)],ee);const te=ee;function re(...e){return A.from(...e)}R.set(O.DecoratorTypes.CLASS,L),R.set(O.DecoratorTypes.PROP,ee),R.set(O.DecoratorTypes.PARAM,Q),R.set(O.DecoratorTypes.METHOD,F);class se extends Map{constructor(){super(...arguments),this.$kind="operationPaths",this.$isJsonDocument=!0,this.getKey=(e,t)=>`${e}-${t}`}setOperationPath(e){const t=this.getKey(e.method,e.path);this.set(t,e)}}function ne(e){const t=e.isStore?e:re(e);return t.$inherited||(t.$inherited=(0,O.ancestorsOf)(t.target).reverse().reduce(((e,t)=>e.set(t,re(t))),new Map)),t.$inherited}function ie(e){const t=e.isStore?e:re(e);if(!t.$operations){const e=new se;t.$operations=new Map,ne(t).forEach((e=>{e.children.forEach((e=>{e instanceof F&&!t.$operations.has(e.propertyKey)&&t.$operations.set(e.propertyKey,e)}))})),t.$operations.forEach((t=>{t.operation.operationPaths.forEach((t=>{e.setOperationPath(t)}))})),e.clear()}return t.$operations}function oe(e){return!e.store.get("hidden")}const ae=[a.PUBLISH,a.SUBSCRIBE];function ce(e,{channels:t,rootPath:r,...s}){const n=y(r+re(e).path);return s={...s,ctrlRootPath:n},[...ie(e).values()].filter(oe).flatMap((e=>{const t=e.operation.getAllowedOperationPath(ae);return 0===t.length?[]:t.map((t=>({operationPath:t,operationStore:e})))})).reduce(function(e){return(t,{operationPath:r,operationStore:s})=>{const n=e.ctrlRootPath||"/",i=r.method.toLowerCase(),o=(0,c.camelCase)(`${i.toLowerCase()} ${s.parent.schema.getName()}`),a=d("message",[s,r],e);return{...t,[n]:{...t[n],[i]:{...t[n]?.[i],operationId:o,message:{oneOf:[...t[n]?.[i]?.message?.oneOf||[],a]}}}}}}(s),t)}var pe;function ue(e,t){return t.length?1===t.length?t[0]:{[e]:t}:null}function he(e,t,{tags:r=[],defaultTags:s=[],...n}={}){const{path:i,method:o}=t,c=String(i);let p=(0,O.getValue)(n.components,"messages."+i,(0,O.cleanObject)({description:e.operation.get("description"),summary:e.operation.get("summary")}));if(o.toUpperCase()===a.PUBLISH){const r=d("payload",[e,t],n);r&&(p.payload=r);const s=e.operation.getAllowedOperationPath([a.SUBSCRIBE]).map((t=>d("message",[e,t],n))).filter(Boolean),i=ue("oneOf",s);i&&(p["x-response"]=i)}else{const r=d("response",[e,t],n);r&&(p["x-response"]=r)}return n.components.messages=n.components.messages||{},n.components.messages[c]=p,{$ref:`#/components/messages/${c}`}}function le(e,t){return e.reduce(((e,r,s)=>e.set(r,t[s])),new Map)}function me(e){if(e.genericLabels&&e.genericTypes){const{genericLabels:t,genericTypes:r,...s}=e;return{...s,generics:le(t,r)}}return e}function de(e){const[t,...r]=e.nestedGenerics;return{genericTypes:t,nestedGenerics:r}}function fe(e,t,r){const s=e.operation.get("parameters").filter((e=>z(e.get("in")))),n=(0,c.pascalCase)([t.path,t.method,"Payload"].join(" "));(0,O.setValue)(r,`components.schemas.${n}`,{});const i=s.map((e=>{const t=function(e,t={}){return{...t,groups:e.groups,groupsName:e.groupsName}}(e,r),s=d("item",[e.$schema],{...t,...de(e)});switch(e.get("in")){case W.BODY:return s;case W.QUERY:case W.PATH:case W.HEADER:return{type:"object",properties:{[e.get("name")]:s}}}return s}),{}).filter(Boolean);return ue("allOf",i)}function ge(e,t,r){const s=e.operation.getResponses(),n=[],i=[],o=[],a=[];[...s.entries()].forEach((([e,t])=>{const s=d("map",[t],r);if(n.push(+e),i.push(s.description),204!=+e){const{content:e}=s,t=e[Object.keys(e)[0]];o.push(t)}}));const p=(0,c.pascalCase)([t.path,t.method,"Response"].join(" ")),u={type:"object",properties:{status:{type:"number",enum:n},statusText:{type:"string",enum:i}},required:["status"]},h=ue("oneOf",o);h&&(0,O.setValue)(u,"properties.data",h);const l=ue("oneOf",a);return a.length&&(0,O.setValue)(u,"properties.error",l),(0,O.setValue)(r,`components.schemas.${p}`,u),{$ref:`#/components/schemas/${p}`}}l("channels",ce),function(e){e.JSON="jsonschema",e.SWAGGER="swagger2",e.OPENAPI="openapi3",e.ASYNCAPI="asyncapi2"}(pe||(pe={})),l("generate",(function(e,t){const r={channels:d("channels",[e],t)};return r.tags=(0,O.uniqBy)(t.tags,"name"),t.components?.schemas&&Object.keys(t.components.schemas).length&&(r.components={...t.components,schemas:t.components.schemas}),r}),pe.ASYNCAPI),l("message",he,pe.ASYNCAPI),l("payload",fe,pe.ASYNCAPI),l("response",ge,pe.ASYNCAPI);class ye{constructor(e){this.getType=e,this.isLazyRef=!0}get target(){return this.getType()}get schema(){return re(this.getType()).schema}get name(){return(0,O.nameOf)(this.getType())}}function Oe(e,t){return t.groups&&t.groups.length?(0,c.pascalCase)(`${e} ${t.groupsName||t.groups.join(" ")}`):e}function Se(e,t,r){const s=function(e){const{host:t="#/"+([pe.OPENAPI,pe.ASYNCAPI].includes(e.specType)?"components/schemas":"definitions")}=e;return t}(r),n={$ref:`${s}/${e}`},i=t.isReadOnly,o=t.isWriteOnly;return(0,O.cleanObject)({readOnly:!!i||void 0,writeOnly:!!o||void 0,...i||o?{anyOf:[n]}:n})}function be(e,t,r){const s=Oe(e.getName(),r);return t&&(0,O.setValue)(r,`components.schemas.${s}`,t),Se(s,e,r)}function Re(e,t={}){if("object"!=typeof e||null===e)return e;if(e instanceof ye)return d("lazyRef",[e],t);if(e instanceof D&&e.get("enum")instanceof D){const r=e.get("enum");return be(r,r.toJSON(t),t)}if(e.$kind&&e.$isJsonDocument){const r=d(g([e.$kind,"map"],t),[e],me(t));return e.canRef?be(e,r,t):r}return d("object",[e],t)}function Ae(e,t){const r=A.from(e.class),s=Oe(r.schema.getName()||e.getName(),t);if(e.hasGenerics){const{type:s,properties:n,additionalProperties:i,items:o,...a}=e.toJSON(t),c={...d("any",[r.schema],{...t,...de(e),root:!1}),...a};if(c.title){const r=Oe(c.title,t);return(0,O.setValue)(t.components,`schemas.${r}`,c),delete c.title,Se(r,e,t)}return c}return(0,O.getValue)(t,`components.schemas.${s}`)||((0,O.setValue)(t,`components.schemas.${s}`,{}),t.components.schemas[s]=d("any",[r.schema],me({...t,root:!1}))),Se(s,e,t)}function Ee(e,t,r){if(e.discriminator?.mapping){const t=Object.entries(e.discriminator.mapping),s={};for(const[e,n]of t)s[e]=(0,O.isString)(n)?n:be(n,null,r).$ref;e.discriminator.mapping=s}return e}function Te(e,t,r){return r.inlineEnums&&e.enum?.$isJsonDocument&&(e.enum=e.enum.toJSON().enum),e.enum&&(e.type="object"===e.type||void 0===e.type?"string":e.type),e}function Pe(e,t){const{generics:r}=t;if(r&&e.$ref&&r.has(e.$ref)){let s=r.get(e.$ref);if((0,O.isPrimitiveClass)(s))return{type:x(s)};if(s===Date)return{type:"string",format:"date-time"};if(s.toJSON)return s.toJSON({...t,generics:void 0});if(s===Object)return{type:"object"};if((0,O.isClass)(s)){const e={class:s};return 0===t.nestedGenerics.length?d("class",[e],{...t,generics:void 0}):d("schema",[A.from(e.class).schema],{...t,...de(t),root:!1})}}return e}function ve(e,t){if(t?.type&&t?.$ref){const{$ref:e,...r}=t;t={allOf:[{$ref:e},r]}}return t}function Ce(e,{target:t,...r}){const s=Array.from(ne(t).entries()).filter((([e])=>(0,O.classOf)(e)!==(0,O.classOf)(t)));if(s.length){const t=s.reduce(((e,[,t])=>(0,O.deepMerge)(e,d("schema",[t.schema],r),{alter:ve})),{});return(0,O.deepMerge)(t,e,{alter:ve})}return e}function xe(e,t){return e&&e.isClass?d("class",[e],t):d("any",[e],t)}function $e(e,t){const r=e.name;if(t.$refs?.find((t=>t===e.target)))return Se(r,e.schema,t);t.$refs=[...t.$refs||[],e.target];const s=e.getType()&&d("schema",[e.schema],me(t));return be(e.schema,s,t)}function Me(e,{ignore:t=[],...r}={}){return r=me(r),Array.from(e.entries()).reduce(((e,[s,n])=>(t.includes(s)||(e[s]=d("item",[n],r)),e)),{})}l("any",Re),l("class",Ae),l("discriminatorMapping",(function(e){return e.discriminator?.mapping&&delete e.discriminator.mapping,e})),l("enums",Te),l("generics",Pe),l("inheritedClass",Ce),l("item",xe),l("lazyRef",$e),l("map",Me);const we=["oneOf","allOf","anyOf"],_e=["minLength","maxLength","pattern","format"],Ne=[],Ie=["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"],De=["maxItems","minItems","uniqueItems","items","contains","maxContains","minContains"],Le=["maxItems","minItems","uniqueItems","items","contains","maxContains","minContains","patternProperties","dependencies"],ke=["const","enum"];function je(e,t){return t?.isNullable?(e.discriminator||(e.$ref?e=(0,O.cleanObject)({...e,$ref:void 0,anyOf:[{type:"null"},{$ref:e.$ref}]}):we.some((t=>{if(e[t])if(e[t]=e[t].filter((e=>"null"!==e.type)),1===e[t].length){const r=e[t];e=(0,O.cleanObject)({...e,...r[0],[t]:void 0,type:["null",Number.isInteger(e.multipleOf)?"integer":r[0].type]})}else e[t]=[{type:"null"}].concat(e[t]).map((e=>(Number.isInteger(e.multipleOf)&&(e.type="integer"),e))),delete e.type}))),e):e}function He(e,t){if((0,O.isBoolean)(e.$ignore)&&e.$ignore)return!0;let r=e?.$hooks?.alter("ignore",!1,[t]);return r||(!1!==t.groups?e?.$hooks?.alter("groups",!1,[t.groups]):r)}function Ge(e,t){const{specType:r,operationIdFormatter:s,root:n,components:i,genericTypes:o,nestedGenerics:a,useAlias:c,genericLabels:p,...u}=t;return Object.entries(e).reduce(((r,[s,n])=>{if(!1!==t.withIgnoredProps&&!He(n,u)){const i={...t,groups:e?.$forwardGroups||n?.$forwardGroups?t.groups:void 0};r[s]=d("item",[n],i),r[s]=d("nullable",[r[s],n],i)}return r}),(0,O.isArray)(e)?[]:{})}function qe(e,t,r){return e.map((e=>d("item",[e],{...t,genericLabels:r.genericLabels})))}function Be(e,t,r){return e.isClass?d("class",[e],t):d("any",[e],{...t,genericLabels:r.genericLabels})}function Ue(e,t,r){return!1!==r.groups?t?.$hooks?.alter("requiredGroups",e,[r.groups]):e}function Ke(e,t,r){if(r.groups&&r.groups.includes("partial"))return e.discriminator?{...e,required:[e.discriminator.propertyName]}:e;let s=function(e,t,r){let s=e.required||[];return s=[...s,...t.$required],t.get("properties")&&(s=Object.entries(t.get("properties")).reduce(((e,[t,r])=>r&&void 0!==r.$selfRequired?r.$selfRequired?e.concat(t):e.filter((e=>e===t)):e),s)),Ue((0,O.uniq)(s),t,r)}(e,t,r);return s=(0,O.uniq)(s).reduce(function(e,t,r={}){const{useAlias:s}=r,n=Object.keys(e.properties||{});return(e,r)=>{const i=s&&t.alias.get(r)||r;return n.includes(i)?e.concat(i):e}}(e,t,r),[]),e.discriminator&&s.push(e.discriminator.propertyName),s.length&&(e.required=s),e}function Je(e,t){return Object.entries(e).reduce(((e,[r,s])=>(e[r=t.get(r)||r]=s,e)),{})}l("nullable",je),l("object",Ge),l("anyOf",qe),l("allOf",qe),l("oneOf",qe),l("properties",Be),l("items",Be),l("additionalProperties",Be),l("propertyNames",Be),l("contains",Be),l("dependencies",Be),l("patternProperties",Be),l("additionalItems",Be),l("not",Be),l("definitions",Be),l("required",Ke);const Fe={string:{properties:_e,is:O.isString},number:{properties:Ie,is:O.isNumber},boolean:{properties:Ne,is:O.isBoolean},array:{properties:De,is:()=>!1},object:{properties:Le,is:()=>!1}};function Ve(e,t,r){const s=function(e){return we.find((t=>e[t]))}(e);return s&&(e[s].forEach((t=>{!function(e,t,r){const s=Fe[e];s?.properties.concat(ke).forEach((e=>{void 0!==t[e]&&(ke.includes(e)?r[e]=t[e].filter(s.is):(r[e]=t[e],delete t[e]))}))}(t.type,e,t)})),we.forEach((s=>{e[s]&&!1!==r.groups&&t.$hooks.has(s)&&(e={...e,[s]:t.$hooks.alter(s,e[s],[r.groups])})})),delete e.const,delete e.enum,e.items||e.properties||delete e.type),e}const We=["name","$required","$hooks","_nestedGenerics",pe.OPENAPI,pe.SWAGGER,pe.JSON],Xe=[];function ze(e,t){const{options:r,addDef:s}=function(e){let t=!1;e||(t=!0,e={components:{schemas:{}},inlineEnums:!0});const{useAlias:r=!0,components:s={schemas:{}}}=e;return{addDef:t,options:e={...e,useAlias:r,components:s}}}(t),n=function(e,t){let r=function(e,t){const{useAlias:r}=t;return[...e.keys()].filter((e=>!function(e,{specType:t=pe.JSON,customKeys:r=!1}){return We.includes(e)||e.startsWith("#")&&(!1===r||t!==pe.JSON)||t!==pe.JSON&&Xe.includes(e)}(e,t))).reduce(((s,n)=>{let i=e.get(n);if("type"===(n=n.replace(/^#/,"")))return s[n]=e.getJsonType(),s;if(function(e,t,r){return"examples"===e&&(0,O.isObject)(t)&&[pe.OPENAPI,pe.ASYNCAPI].includes(r.specType)}(n,i,t)&&(n="example",i=Object.values(i)[0]),i&&"object"==typeof i&&f(n)){if(i=d(n,[i],t,e),function(e,t){return"object"==typeof t&&["items","properties","additionalProperties"].includes(e)&&0===Object.keys(t).length}(n,i))return s;(function(e,t,r){return"object"==typeof t&&r&&["properties","additionalProperties"].includes(e)})(n,i,r)&&(i=Je(i,e.alias))}return s[n]=i,s}),{})}(e,t);return e.isClass&&(r=d("inheritedClass",[r],{...t,root:!1,target:e.getComputedType()})),r=d("generics",[r],{...t,root:!1}),e.has(t.specType)&&(r={...r,...e.get(t.specType).toJSON(t)}),(0,O.isFunction)(r.default)&&(r.default=r.default()),r=d("required",[r,e],t),r=d("nullable",[r,e],t),r=Ve(r,e,t),r=d("enums",[r,e],t),r=d("discriminatorMapping",[r,e],t),r}(e,r);return s&&Object.keys((0,O.getValue)(r,"components.schemas",{})).length&&(n.definitions=r.components.schemas),n}function Ye(e,t,r){return(e=Te(e,0,r)).const&&(e.enum=[e.const],delete e.const),e}function Qe(e,t){const r={paths:d("paths",[e],t={...t,specType:pe.OPENAPI})};return r.tags=(0,O.uniqBy)(t.tags,"name"),Object.keys((0,O.getValue)(t,"components.schemas",{})).length&&(r.components={schemas:t.components.schemas}),r}function Ze(e,t){return t?.isNullable?e.$ref?(0,O.cleanObject)({...e,...e.$ref&&{anyOf:[{$ref:e.$ref}],type:void 0},nullable:!0,$ref:void 0}):(0,O.cleanObject)({...e,...1===e.anyOf?.length?{...e.anyOf[0],anyOf:void 0,type:Number.isInteger(e.multipleOf)?"integer":e.anyOf[0]?.type}:{type:e.anyOf?.length>1?void 0:e.type,anyOf:e.anyOf?.map((e=>(Number.isInteger(e.multipleOf)&&(e.type="integer"),e)))},nullable:!0}):e}function et(e,{jsonSchema:t}){const r={type:"string",format:"binary",oneOf:void 0};return"array"===t.type?(t.items=(0,O.cleanObject)({...t.items,...r}),e.schema=t,e):(e.schema=(0,O.cleanObject)({...t,...r}),e)}function tt(e,t){const r=function(e,t={}){return{...t,groups:e.groups,groupsName:e.groupsName}}(e,t),s={...r.components?.schemas||{}},{type:n,schema:i,...o}=d("map",[e],r),a=d("item",[e.$schema],{...r,...de(e)});o.required=o.required||e.get("in")===W.PATH;const p={...r,jsonSchema:a,jsonParameter:e,oldSchemas:s},u=(0,c.camelCase)(`operationIn ${e.get("in")}`);return f(u)?d(u,[o],p):(o.schema=a,o)}function rt(e,t){return e.flatMap((e=>d("operationInParameter",[e],t))).filter(Boolean)}function st(e,t){if(!t)return;let r=!1;const s=Object.entries(t).reduce(((t,[s,{value:n,description:i,...o}])=>void 0===n[e]?t:(r=!0,{...t,[s]:{...o,value:n[e],description:i}})),{});return r?s:void 0}function nt(e,{jsonSchema:t,jsonParameters:r,...s}){if(t.$ref){if(!e.name)return function(e,{jsonParameter:t,...r}){const s=Oe(t.$schema.getName(),r),n=r.components?.schemas?.[s];return n&&!r.oldSchemas?.[s]&&delete r.components.schemas[t.$schema.getName()],Object.entries(n?.properties||{}).reduce(((t,[r,{description:s,...i}])=>[...t,(0,O.cleanObject)({...e,name:r,required:(n?.required||[]).includes(r),description:s,schema:i,style:i.$ref?"deepObject":void 0,examples:st(r,e.examples)})]),[])}(e,s);e.style="deepObject"}return e.schema=t,e}l("schema",ze),l("discriminatorMapping",Ee,pe.OPENAPI),l("discriminatorMapping",Ee,pe.SWAGGER),l("discriminatorMapping",Ee,pe.ASYNCAPI),l("enums",Ye,pe.OPENAPI),l("enums",Ye,pe.SWAGGER),l("enums",Ye,pe.ASYNCAPI),l("generate",Qe,pe.OPENAPI),l("generate",Qe,pe.SWAGGER),l("nullable",Ze,pe.OPENAPI),l("nullable",Ze,pe.SWAGGER),l("operationInFiles",et),l("operationInParameter",tt),l("operationInParameters",rt),l("operationInQuery",nt);var it=i(725),ot=i.n(it);const at=ot().codes.reduce(((e,t)=>{const r=String(ot()(t));return{...e,[String(t)]:{label:r,code:(0,c.constantCase)(r)}}}),{});function ct(e){return at[e]?.code}function pt(e){return at[e]?.label}function ut(e,{tags:t=[],defaultTags:r=[],...s}={}){const{consumes:n,produces:i,...o}=d("map",[e],{...s,ignore:["parameters"]});o.security&&(o.security=[].concat(o.security)),0===e.get("responses").size&&(o.responses={200:{description:pt(200)}});const a={...s,consumes:e.get("consumes")?.length?e.get("consumes"):["application/json"]},[c,p]=function(e){return e.get("parameters").filter((e=>z(e.get("in")))).reduce(((e,t)=>{const[r,s]=e;return[W.BODY,W.FILES].includes(t.get("in"))?[r,[...s,t]]:[[...r,t],s]}),[[],[]])}(e);o.parameters=d("operationInParameters",[c],s),p.length&&(o.requestBody=d("operationRequestBody",[p],a));const u=o.tags?.length?o.tags:r;return u.length&&(o.tags=u.map((({name:e})=>e))),t.push(...u),o}function ht(e,t){return d("map",[e],{...t,groups:[...e.groups||[]],groupsName:e.groupsName})}at[200].label="Success",at[200].code="SUCCESS",l("operation",ut),l("operationMedia",ht);class lt extends H{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",q(e)),this}addContent(e,t,r){const s=this.get("content"),n=new H;return n.set("schema",t),r&&n.set("examples",r),s.set(e,n),this}required(e){return this.set("required",e),this}}function mt(e,{consumes:t,...r}){const{schema:s,examples:n,in:i,...o}=function(e,t){let r=new D;const s={},n=[];let i=0;const o=e.some((e=>"files"===e.get("in")));return e.forEach((e=>{const a=e.getName();[...e.entries()].filter((([e])=>!["in","name"].includes(e))).forEach((([e,t])=>{void 0===s[e]&&(s[e]=t)}));const c=d("operationInParameter",[e],t);if(a){const t={...c.schema||{type:c.type}};o&&c.description&&(t.description=c.description),r.addProperty(a,t),e.get("required")&&r.addRequired(a),i++}else n.push(c)})),i||1!==n.length?(r.type("object"),s.description&&o&&delete s.description,{schema:r.toJSON(t),required:!1,...s}):n[0]}(e,r),a=new lt(o);return t.forEach((e=>{a.addContent(e,s,n)})),d("map",[a],r)}function dt(e,t={}){const r=d("map",[e],t);return 204===e.status&&delete r.content,r.headers&&Object.entries(r.headers).forEach((([e,{type:t,...s}])=>{r.headers[e]={...s,schema:{type:t}}})),r}function ft(e,t){return e.map((e=>t.parameters.find((t=>t.in===e.in&&t.name===e.name))||e)).concat(...t.parameters.filter((e=>"path"!==e.in)))}function gt(e,t=""){t instanceof RegExp&&(t=t.toString().replace(/^\//g,"").replace(/\/$/g,"").replace(/\\/g,""));const r=[],s=[];let n=!1,i="";return function(e){let t=0;return e.split("").filter((e=>{"("===e&&t++;const r=0===t;return")"===e&&t--,r})).join("").split("/").filter((e=>!!e))}(`${e}${t}`).map((e=>{const t=e.replace(":","").replace("?","");if(e.includes(":")){const o=e.includes("?");o&&!n&&(n=!0,s.push({path:i,parameters:[].concat(r)}));const{prefix:a,name:c,postfix:p}=function(e){const[t,r]=e.split("="),s=(r||t).split(".");return{prefix:r&&t?`${t}=`:"",name:s.splice(0,1)[0],postfix:s.length?`.${s.join(".")}`:""}}(t);i+=`/${a}{${c}}${p}`,r.push({in:"path",name:c,type:"string",required:!0}),o&&n&&s.push({path:i,parameters:[].concat(r)})}else i+=`/${e}`})),s.length?s:[{path:i,parameters:[].concat(r)}]}l("operationRequestBody",mt),l("operationResponse",dt);const yt="%c.%m";function Ot(e=""){const t=new Map;return(r,s,n="")=>{const i=((t,r)=>{const s=(e||yt).replace(/%c/,t).replace(/%m/,r);return""===e?(0,c.camelCase)(s):s})(r,s),o=r+s;if(!t.has(o))return t.set(o,0),i;const a=n.match(/{(\w+)}/gi);if(a){const e=r+s+a[0];if(!t.has(e))return t.set(e,0),(0,c.camelCase)(`${i} By ${a}`)}const p=t.get(o)+1;return t.set(o,p),`${i}_${p}`}}function St(e,{store:t,operationIdFormatter:r}){return r(t.parent.schema.get("name")||t.parent.targetName,t.propertyName,e)}const bt=[a.ALL,a.GET,a.POST,a.PUT,a.PATCH,a.HEAD,a.OPTIONS,a.DELETE,a.TRACE];function Rt(e,{path:t,method:r,operation:s}){return{...e,[t]:{...e[t],[r.toLowerCase()]:s}}}function At(e,{paths:t,rootPath:r,...s}){const n=y(r+re(e).path);return s={...s,ctrlRootPath:n},[...ie(e).values()].filter(oe).filter((e=>e.operation.getAllowedOperationPath(bt).length>0)).flatMap(function(e){return t=>{const r=t.operation.getAllowedOperationPath(bt);if(0===r.length)return[];const s=d("operation",[t.operation],e);return r.map((e=>({operationPath:e,operation:s,operationStore:t})))}}(s)).flatMap(function(e){return({operationPath:t,operation:r,operationStore:s})=>{const{path:n,method:i}=t;return gt(e.ctrlRootPath,n).map((({path:n,parameters:o})=>(n=n||"/",o=ft(o.map((({type:e,...t})=>({...t,schema:{type:e}}))),r),{operation:{...r,...t.toJSON(e),parameters:o,operationId:r.operationId||St(n,{...e,store:s})},method:i,path:n})))}}(s)).reduce(Rt,t)}function Et(e){return(...t)=>{const r=e(re(...t),t);"function"==typeof r&&r(...t)}}function Tt(...e){return Et((t=>{t.store.set("childrenControllers",e),e.forEach((e=>{O.Store.from(e).set("parentController",t.token)}))}))}function Pt(e,...t){return Et((r=>{e=e||(0,c.snakeCase)(r.targetName),r.discriminatorAncestor&&r.schema.discriminatorValue(e,...t)}))}function vt(e,t){if(!e)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 n=(...n)=>{const i=A.from(...n);t&&(i.collectionType=t,i.schema.type(t)),i.type=e,i.itemSchema.type(e),i.schema.assign(r),i.isArray&&s&&(i.schema.set("contains",i.schema.get("items")),i.schema.delete("items"))};return n.MinItems=e=>(r.minItems=e,n),n.MaxItems=e=>(r.maxItems=e,n),n.MinProperties=e=>(r.minProperties=e,n),n.MaxProperties=e=>(r.maxProperties=e,n),n.Contains=()=>(s=!0,n),n.UniqueItems=(e=!0)=>(r.uniqueItems=e,n),n}function Ct(e){return vt(e,Array)}function xt(e){return vt(e,Map)}function $t(e){return vt(e).Contains()}function Mt(e,t){const r={};return(...s)=>{const n=(0,O.useDecorators)(t(...s));return n.Error=t=>(r.message=t,(0,O.useDecorators)(n,r.message&&Et((r=>{const s=r.parentSchema.get("#errorMessage")||{};"required"===e?r.parentSchema.customKey("errorMessage",(0,O.deepMerge)(s,{[e]:{[r.propertyName]:t}})):r.itemSchema.customKey("errorMessage",(0,O.deepMerge)(s,{[e]:t}))})))),n}}l("paths",At);const wt=Mt("maxItems",(e=>{if(e<0)throw new Error("The value of maxItems MUST be a non-negative integer.");return Et((t=>{t.schema.maxItems(e)}))})),_t=Mt("maxProperties",(e=>{if(e<0)throw new Error("The value of maxProperties MUST be a non-negative integer.");return Et((t=>{t.isCollection?t.schema.maxProperties(e):t.itemSchema.maxProperties(e)}))})),Nt=Mt("minItems",(e=>{if(e<0)throw new Error("The value of minItems MUST be a non-negative integer.");return Et((t=>{t.schema.minItems(e)}))})),It=Mt("minProperties",(e=>{if(e<0)throw new Error("The value of minProperties MUST be a non-negative integer.");return Et((t=>{t.isCollection?t.schema.minProperties(e):t.itemSchema.minProperties(e)}))})),Dt=Mt("uniqueItems",((e=!0)=>Et((t=>{t.schema.uniqueItems(e)}))));function Lt(e){return Et(((t,r)=>{t.itemSchema.additionalProperties(e)}))}function kt(...e){return Et((t=>{t.itemSchema.allOf(e)}))}function jt(e){return Et((t=>{e&&(((0,O.isClass)(e)||(0,O.isArrowFn)(e))&&(t.type=e),t.itemSchema.type(e))}))}function Ht(...e){const t=e.find((e=>(0,O.isClass)(e)));return(0,O.useDecorators)(t&&jt(t),Et(((t,r)=>{t.decoratorType===O.DecoratorTypes.PARAM&&(t.required=!0),t.decoratorType===O.DecoratorTypes.PROP&&t.parentSchema.addRequired(t.propertyName),t.schema.allow(...e)})))}function Gt(...e){return Et((t=>{t.itemSchema.any(...e)}))}function qt(...e){return Et((t=>{t.itemSchema.anyOf(e)}))}function Bt(e){return Et((t=>{t.itemSchema.const(e)}))}function Ut(e,t){return Et((r=>{r.itemSchema.customKey(e,t)}))}function Kt(e){return Et((t=>{Object.entries(e).forEach((([e,r])=>{t.itemSchema.customKey(e,r)}))}))}function Jt(e){return Et((t=>{t.itemSchema.default(e)}))}function Ft(e){return Et((t=>{const r=t.parentSchema.get("#errorMessage")||{};t.parentSchema.customKey("errorMessage",{...r,...e})}))}function Vt(e){return(0,O.useDecorators)(Ft({_:e}))}function Wt(e){return Et(((t,r)=>{switch((0,O.decoratorTypeOf)(r)){case O.DecoratorTypes.PROP:case O.DecoratorTypes.CLASS:t.schema.description(e);break;case O.DecoratorTypes.PARAM:t.parameter.description(e);break;case O.DecoratorTypes.METHOD:t.operation?.description(e)}}))}function Xt(){return(0,O.useDecorators)(jt(),Et((e=>{e.discriminatorKey()})))}const zt=Mt("enum",(function(e,...t){return Et((r=>{r.itemSchema.enum(e,...t)}))}));function Yt(...e){return Et((t=>{t.schema.examples(e)}))}function Qt(e){return Et((t=>{t.parameter.examples(e)}))}const Zt=Mt("maximum",((e,t=!1)=>Et((r=>{t?r.itemSchema.exclusiveMaximum(e):r.itemSchema.maximum(e)})))),er=Zt,tr=Mt("exclusiveMaximum",((e,t=!0)=>Zt(e,t))),rr=Mt("minimum",((e,t=!1)=>Et((r=>{t?r.itemSchema.exclusiveMinimum(e):r.itemSchema.minimum(e)})))),sr=rr,nr=Mt("exclusiveMinimum",((e,t=!0)=>rr(e,t)));var ir;!function(e){e.DATE_TIME="date-time",e.DATE="date",e.TIME="time",e.EMAIL="email",e.HOSTNAME="hostname",e.IPV4="ipv4",e.IPV6="ipv6",e.URI="uri",e.URL="url",e.URI_REF="uri-reference",e.URI_TEMPLATE="uri-template",e.JSON_POINTER="json-pointer",e.RELATIVE_JSON_POINTER="relative-json-pointer",e.UUID="uuid",e.REGEX="regex"}(ir||(ir={}));const or=Mt("format",(e=>Et((t=>{t.itemSchema.format(e)})))),ar=Mt("format",(()=>or(ir.EMAIL))),cr=Mt("format",(()=>or(ir.DATE_TIME))),pr=Mt("format",(()=>or(ir.DATE))),ur=Mt("format",(()=>or(ir.TIME))),hr=Mt("format",(()=>or(ir.URI))),lr=Mt("format",(()=>or(ir.URL)));function mr(e=!0){return Et((t=>{t.schema.$forwardGroups=e}))}var dr=i(307),fr=i.n(dr);function gr(e,t){t=[].concat(t),e=[].concat(e);let r=new Set,s=new Set,n=new Set,i=0,o=e=>{n.add(e.output)};for(let n=0;n<t.length;n++){let a=fr()(String(t[n]),{onResult:o},!0),c=a.state.negated||a.state.negatedExtglob;c&&i++;for(let t of e){let e=a(t,!0);(c?!e.isMatch:e.isMatch)&&(c?r.add(e.output):(r.delete(e.output),s.add(e.output)))}}return!!(i===t.length?[...n]:[...s]).filter((e=>!r.has(e))).length}function yr(e,t=[]){const r=e.filter((e=>e.startsWith("!"))).map((e=>e.replace("!",""))),s=e.filter((e=>!e.startsWith("!")));return!!(r.length&&t.length&&gr(r,t))||!!s.length&&!gr(e.filter((e=>!e.startsWith("!"))),t)}function Or(...e){return Et((t=>{switch(t.decoratorType){case O.DecoratorTypes.CLASS:!function(e,t){const r=Object.entries(e[0]);t.children.forEach((e=>{Or(...r.filter((([,t])=>t.includes(e.propertyName))).map((([e])=>e)))(e.target,e.propertyKey)}))}(e,t);break;case O.DecoratorTypes.PROP:Ut("x-groups",e)(t.target,t.propertyKey),t.schema.$hooks.on("groups",((t,r)=>!(t||!yr(e,r))||t));break;case O.DecoratorTypes.PARAM:let r="";2==e.length&&(0,O.isArray)(e[1])&&(r=e[0],e=e[1]),t.parameter.groups=e,t.parameter.groupsName=r}}))}function Sr(){return(0,O.StoreSet)("hidden",!0)}function br(e=!0){return Et((t=>{t.schema.ignore(e)}))}function Rr(){return Et((e=>{e.itemSchema.type("integer")}))}function Ar(e,t=!1){return Et((r=>{t?r.schema.label(e):r.itemSchema.label(e)}))}const Er=Mt("maxLength",(e=>{if(e<0)throw new Error("The value of maxLength MUST be a non-negative integer.");return Et((t=>{t.itemSchema.maxLength(e)}))})),Tr=Mt("minLength",(e=>{if(e<0)throw new Error("The value of minLength MUST be a non-negative integer.");return Et((t=>{t.itemSchema.minLength(e)}))})),Pr=Mt("multipleOf",(e=>{if(e<=0)throw new Error("The value of multipleOf MUST be a number, strictly greater than 0.");return Et((t=>{t.itemSchema.multipleOf(e)}))}));function vr(e){return Et(((t,r)=>{switch((0,O.decoratorTypeOf)(r)){case O.DecoratorTypes.CLASS:t.schema.name(e);break;case O.DecoratorTypes.PARAM:t.parameter.name(e);break;default:t.parent.schema.addAlias(r[1],e)}}))}function Cr(e,...t){return t=[e,...t],(0,O.useDecorators)(1===t.length&&jt(t[0]),Gt(null,...t))}function xr(...e){return Et((t=>{t.itemSchema.oneOf(e),t.type=Object}))}function $r(){return Et((e=>{switch(e.decoratorType){case O.DecoratorTypes.PARAM:e.required=!1;break;case O.DecoratorTypes.PROP:e.parentSchema.removeRequired(e.propertyName)}}))}const Mr=Mt("pattern",(e=>Et((t=>{t.itemSchema.pattern(e)}))));function wr(e=!0){return Et((t=>{t.itemSchema.readOnly(e)}))}function _r(e){return Et((t=>{t.schema.assign(e)}))}function Nr(e,t){return Et((r=>{r.schema.set(e,t)}))}function Ir(e,...t){return _r({properties:{...t.reduce(((t,r)=>({...t,[r]:e})),{})}})}const Dr=Mt("required",((e=!0,...t)=>e?Ht(...t):$r()));function Lr(...e){return Et((t=>{t.parent.schema.$hooks.on("requiredGroups",((r,s)=>yr(e,s)?r.filter((e=>e!==t.propertyKey)):r))}))}function kr(e){return Et((t=>{t.schema.title(e)}))}function jr(e){return Et((()=>(0,O.useDecorators)(Ft({type:e}))))}function Hr(e=!0){return Et((t=>{t.itemSchema.writeOnly(e)}))}function Gr(e=Object){if((0,O.isClass)(e)){const{schema:t}=re(e);return t.properties=function(t){return Object.entries(t).forEach((([t,r])=>{re(e.prototype,t).schema.assign(r)})),this},t}return D.from({type:e})}function qr(){return Gr(String)}function Br(...e){const t=[e.map((e=>function(e){return(0,O.isObject)(e)&&!("toJSON"in e)}(e)?qr().enum(Object.values(e)):e))],r=(...e)=>{A.from(...e).nestedGenerics=t};return r.Nested=(...e)=>(t.push(e),r),r}function Ur(...e){return t=>{A.from(t).schema.genericLabels=e}}function Kr(...e){return Et(((t,r)=>{switch(t.decoratorType){case O.DecoratorTypes.METHOD:t.operation.consumes(e);break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(r[0],Kr(...e));break;default:throw new O.UnsupportedDecoratorType(Kr,r)}}))}function Jr(...e){return(0,O.useDecorators)(Kr(...e),(0,O.StoreSet)("acceptMimes",e))}class Fr extends Map{constructor(e={}){super(),this.actions=[],Object.entries(e).forEach((([e,t])=>{this.set(e,t)}))}addAction(e){return this.actions.push(e),this}build(){const e=(...t)=>this.bind(t,e),t=t=>{return r=(...e)=>{t in this?this[t](...e):this.set(t,e[0])},(...t)=>(r(...t),e);var r};return this.methods.forEach((r=>{e[(0,c.pascalCase)(r)]=t(r)})),e}toObject(){return[...this.entries()].reduce(((e,[t,r])=>({...e,[t]:r})),{})}getMergedKey(e,t){let r=this.get(e)||t;if(r)return this.decoratorType===O.DecoratorTypes.CLASS&&(r={...r,...t||{}}),{...t||{},...r}}bind(e,t){this.entity=A.from(...e),this.beforeInit(),this.onInit(e,t),this.afterInit()}onInit(e,t){this.forEach(((e,t)=>{this.onMapKey(t,e)}))}onMapKey(e,t){this.entity.set(e,t)}runActions(){return this.actions.forEach((e=>{e(this)})),this}beforeInit(){}afterInit(){}}const Vr=new Map;function Wr(e,t){Vr.set(e,t)}function Xr(e){return Vr.get(e)}function zr(e){return e.map((e=>function(e){return(0,O.isObject)(e)&&!("toJSON"in e)}(e)?qr().enum(Object.values(e)):e))}class Yr extends Fr{constructor({status:e,model:t}){super(),this.methods=["contentType","description","examples","type","status","of","ofInteger","oneOf","allOf","anyOf","nested","header","headers","schema","title","groups","allowedGroups","location","binary"],this.model(t),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&&pt(e)&&!this.get("description")&&(this.set("description",pt(e)),this.get("model")||this.model(Xr(+e))),this}headers(e){return this.set("headers",{...this.get("headers")||{},...G(e)}),this}header(e,t){return void 0===t&&(0,O.isString)(e)?this.headers({[e]:{type:"string"}}):this.headers({[e]:t})}location(e,t={}){return this.headers({Location:{...t,value:e}}),this}groups(...e){return 2===e.length&&(0,O.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 t=this.get("model");return this.checkPrimitive(t),this.checkCollection(t),this.addAction((t=>{this.get("schema").nestedGenerics.push(zr(e))})),this}of(...e){const t=this.get("model");return this.checkPrimitive(t),this.addAction((()=>{const r=this.get("schema");(0,O.isCollection)(t)?r?.itemSchema({type:e[0]}):r?.nestedGenerics.push(zr(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",(0,O.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((0,O.isPrimitiveOrPrimitiveClass)(e))throw new Error("Returns.Of cannot be used with the following primitive classes: String, Number, Boolean")}checkCollection(e){if((0,O.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 t=this.get("contentType");return(e&&!(0,O.isPlainObject)(e)&&!(0,O.isPrimitiveOrPrimitiveClass)(e)||this.hasOfTypes)&&(t=t||"application/json"),t}getStatus(){return this.get("status")||"default"}onInit(e,t){switch((0,O.decoratorTypeOf)(e)){case O.DecoratorTypes.METHOD:this.entity=A.from(...e),this.entity.operation&&this.map();break;case O.DecoratorTypes.CLASS:this.decoratorType=O.DecoratorTypes.CLASS,(0,O.decorateMethodsOf)(e[0],t)}}map(){const e=this.get("model"),{entity:t,decoratorType:r}=this,s=this.entity.operation,n=this.getStatus(),i=s.ensureResponseOf(n),o=this.getContentType();let{description:a=i.get("description")}=this.toObject();a&&(a=r===O.DecoratorTypes.CLASS&&i.get("description")||a,i.description(a));const c=this.getMergedKey("headers",i.get("headers"));return c&&i.headers(c),this.mapMedia(i),(k(this.get("status"))||"default"===n)&&e&&(t.type=e),o&&s.addProduce(o),this.runActions()}mapMedia(e){const t=this.getContentType(),r=this.get("model"),s=e.getMedia(t||"*/*"),n=s.get("schema")||new D({type:r}),i=this.get("groups"),o=this.get("groupsName"),a=this.get("allowedGroups"),c=this.entity.operation;if(r&&((0,O.isArray)(r)?n.oneOf(r.map((e=>({type:e})))):n.type(r)),this.set("schema",n),s.schema(n),s.groups=i,s.groupsName=o,a){s.allowedGroups=a;const e=new Y;e.in("query").name("includes"),e.schema(D.from({type:"array",items:{type:"string",enum:[...a]}})),c.addParameter(-1,e)}const p=this.get("examples");return p&&s.examples(p),s}manyOf(e,t){const r=this.get("model");return this.hasOfTypes=!0,this.addAction((()=>{const s=this.get("schema");(0,O.isCollection)(r)?(s.type(r||Object),s.itemSchema().set(e,t)):s.set(e,t)})),this}}function Qr(e,t){return new Yr({status:e,model:t}).build()}function Zr(e){return Qr().ContentType(e)}function es(e=!0){return Et(((t,r)=>{switch((0,O.decoratorTypeOf)(r)){case O.DecoratorTypes.METHOD:t.operation.deprecated(e);break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(r[0],es(e));break;case O.DecoratorTypes.PARAM:t.parameter.set("deprecated",e);break;case O.DecoratorTypes.PROP:t.schema.set("deprecated",e);break;default:throw new O.UnsupportedDecoratorType(es,r)}}))}function ts(e,t){return void 0!==t&&(e={[e]:t}),void 0===t&&(0,O.isString)(e)&&(e={[e]:{type:"string"}}),Qr().Headers(e)}function rs(e){const t=new Y,r={},s=(n,i,o)=>{const a=A.from(n,i,o);switch(a.decoratorType){case O.DecoratorTypes.PARAM:a.parameter.in(e);break;case O.DecoratorTypes.METHOD:t.in(e),a.operation.addParameter(-1,t),t.schema(D.from(r));break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(n,s);break;default:throw new O.UnsupportedDecoratorType(rs,[n,i,o])}};return s.Type=e=>(r.type=e,s),s.Name=e=>(t.name(e),s),s.Description=e=>(t.description(e),s),s.Required=(e=!0)=>(t.required(e),s),s.Pattern=e=>s.Schema({pattern:e.toString()}),s.Schema=e=>(Object.assign(r,e.toJSON?e.toJSON():e),s),s}function ss(e){return(...t)=>{const[r,s,n]=t,i=O.Metadata.getParamTypes(r,s)[n]===Array,o=[e="object"==typeof e?void 0:e,!i&&"0"].filter(Boolean).join(".");(0,O.useDecorators)(rs(W.FILES),vr(o),(0,O.useMethodDecorators)(Qr(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"),Kr("multipart/form-data")))(...t)}}function ns(e,t){return Qr().Location(e,t)}const is=new Set([...Object.keys(a).filter((e=>e!==a.CUSTOM)).map((e=>e.toLowerCase()))]);function os(e){let t,r;const s=e.filter((e=>"string"==typeof e&&is.has(e.toLowerCase())?(t=e.toLocaleUpperCase(),!1):"string"==typeof e||e instanceof RegExp?(r=e||"/",!1):!!e));return{path:r,method:t,use:s}}class as extends Fr{constructor(){super(...arguments),this.methods=["name","description","summary","method","id","use","useAfter","useBefore"]}beforeInit(){const e=this.get("path"),t=a[this.get("method")]||a.CUSTOM;e&&(this.operationPath=this.entity.operation.addOperationPath(t,e))}onMapKey(e,t){switch(e){case"name":case"id":return void this.entity.operation.operationId(t);case"summary":return this.operationPath?.summary(t),void this.entity.operation.summary(t);case"description":return this.operationPath?.description(t),void this.entity.operation.description(t);case"use":return void this.entity.use(t);case"useAfter":return void this.entity.after(t);case"useBefore":return void this.entity.before(t)}return super.onMapKey(e,t)}}function cs(...e){const t=os(e);return new as(t).build()}function ps(e){return Et(((t,r)=>{if(t.decoratorType!==O.DecoratorTypes.METHOD)throw new O.UnsupportedDecoratorType(ps,r);t.operation.operationId(e)}))}function us(e,t="/"){return Et(((r,s)=>{if(r.decoratorType!==O.DecoratorTypes.METHOD)throw new O.UnsupportedDecoratorType(us,s);r.operation.addOperationPath(e.toUpperCase(),t)}))}function hs(){return Or("partial")}function ls(e){return Et(((t,r)=>{if(t.decoratorType!==O.DecoratorTypes.CLASS)throw new O.UnsupportedDecoratorType(ls,r);t.path=e}))}function ms(...e){return Et(((t,r)=>{switch(t.decoratorType){case O.DecoratorTypes.METHOD:t.operation.produces(e);break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(r[0],ms(...e));break;default:throw new O.UnsupportedDecoratorType(ms,r)}}))}function ds(e){return cs(a.PUBLISH,e)}function fs(...e){const{status:t,url:r,meta:s}=e.reduce(((e,t)=>(0,O.isNumber)(t)?(e.status=t,e):(0,O.isString)(t)?(e.url=t,e):(e.meta=t,e)),{status:302,url:"",meta:{}});return(0,O.useDecorators)(Qr(t).Location(r,s),Et((e=>{e.operation?.setRedirection(t)})))}function gs(e="/",...t){return cs(...[a.ALL,e].concat(t))}function ys(e="/",...t){return cs(...[a.GET,e].concat(t))}function Os(e="/",...t){return cs(...[a.POST,e].concat(t))}function Ss(e="/",...t){return cs(...[a.PUT,e].concat(t))}function bs(e="/",...t){return cs(...[a.DELETE,e].concat(t))}function Rs(e="/",...t){return cs(...[a.HEAD,e].concat(t))}function As(e="/",...t){return cs(...[a.PATCH,e].concat(t))}function Es(e="/",...t){return cs(...[a.OPTIONS,e].concat(t))}function Ts(e,...t){return Et(((r,s)=>{switch(r.decoratorType){case O.DecoratorTypes.METHOD:Array.isArray(e)?r.operation.security(e):r.operation.addSecurityScopes(e,t);break;case O.DecoratorTypes.CLASS:Array.isArray(e)?(0,O.decorateMethodsOf)(s[0],Ts(e)):(0,O.decorateMethodsOf)(s[0],Ts(e,...t));break;default:throw new O.UnsupportedDecoratorType(Ts,s)}}))}function Ps(e,t){return Qr(e,t)}function vs(e){return cs(a.SUBSCRIBE,e)}function Cs(e){return Et(((t,r)=>{if(t.decoratorType!==O.DecoratorTypes.METHOD)throw new O.UnsupportedDecoratorType(Cs,r);t.operation.summary(e)}))}function xs(...e){return Et(((t,r)=>{switch(t.decoratorType){case O.DecoratorTypes.METHOD:t.operation.addTags(function(e){return e.map((e=>"string"==typeof e?{name:e}:e))}(e));break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(r[0],xs(...e));break;default:throw new O.UnsupportedDecoratorType(xs,r)}}))}function $s(e,t){return(0,O.StoreSet)("view",{path:e,options:t})}function Ms(e,t){if(e instanceof RegExp||t instanceof RegExp){if(!e)return t;if(!t)return e;const r=e instanceof RegExp?e:new RegExp(e,"gi"),s=t instanceof RegExp?t:new RegExp(t,"gi");return new RegExp(r.source+s.source,(r.global?"g":"")+(r.ignoreCase?"i":"")+(r.multiline?"m":""))}e&&t&&e.endsWith("/")&&t.startsWith("/")&&(t=t.slice(1));const r=(e||"")+(t||"");return r.endsWith("/")&&r.length>1?r.slice(0,-1):r}class ws{constructor(e){Object.assign(this,e),this.paramsTypes=this.endpoint.getParamTypes()}get url(){return this.fullPath}get path(){return this.operationPath?.path}get fullPath(){return Ms(this.basePath,this.path)}get method(){return this.operationPath?.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 _s(...e){return Gr().allOf(e)}function Ns(...e){return Gr().any(...e)}function Is(...e){return Gr().anyOf(e)}function Ds(){return Gr(Boolean)}function Ls(){return Gr(Array)}function ks(){return Gr(Map).unknown(!0)}function js(){return Gr(Array).uniqueItems(!0)}function Hs(){return Gr(Date).format(ir.DATE)}function Gs(){return Gr(Date).format(ir.DATE_TIME)}function qs(){return Gr(Date).format(ir.TIME)}function Bs(){return Gr(String).format(ir.EMAIL)}function Us(e){const t=qr().enum(e);return P.set(e,t),t}function Ks(){return Gr(Number).integer()}function Js(e){try{if(e())return A.from(e()).schema}catch(e){}return new ye(e)}function Fs(){return Gr(Number)}function Vs(e={}){return Gr(Object).properties(e)}function Ws(...e){return Gr().oneOf(e)}function Xs(){return Gr(String).format(ir.URI)}function zs(){return Gr(String).format(ir.URL)}const Ys=(0,O.mergeReducerBuilder)(((e,t)=>e.type&&e.type&&e.type===t.type&&"array"===t.type?JSON.stringify(e.items)===JSON.stringify(t.items):e.type&&e.type===t.type||e.$ref&&e.$ref===t.$ref)),Qs=(0,O.mergeReducerBuilder)(((e,t)=>e.in===t.in&&e.name===t.name)),Zs=(0,O.mergeReducerBuilder)(((e,t)=>!!Object.keys(t).find((t=>!!e[t])))),en=(0,O.mergeReducerBuilder)(((e,t)=>e.name===t.name)),tn={security:Zs,parameters:Qs,oneOf:Ys,anyOf:Ys,allOf:Ys,tags:en};function rn(e,t){return(0,O.deepMerge)(e,t,{reducers:tn,cleanUndefinedProps:!0})}const sn=new Map;function nn(e,t={}){if(t={specType:pe.OPENAPI,...t,tags:[],paths:{},channels:{},components:{},operationIdFormatter:t.operationIdFormatter||Ot(t.operationIdPattern),root:!1},(0,O.isArray)(e)){let r={};return t={...t,append(e){r=rn(r,e)}},e.forEach((({token:e,...r})=>{const s=nn(e,{...t,...r});t.append(s)})),r}return function(e,t,r){sn.has(e)||sn.set(e,new Map);const s=sn.get(e),n=JSON.stringify(t);return s.has(n)||s.set(n,r()),s.get(n)}(e,t,(()=>function(e,t){const r=re(e),{rootPath:s="/"}=t;return t={...t,rootPath:s,defaultTags:[(0,O.cleanObject)({name:r.schema.getName(),description:r.schema.get("description")})]},d("generate",[r],t)}(e,t)))}function on(e){return e.startsWith("3.")?pe.OPENAPI:pe.SWAGGER}function an(e){return"openapi"in e?pe.OPENAPI:pe.SWAGGER}function cn(e){const{title:t,description:r,version:s,termsOfService:n,contact:i,license:o}=e;return(0,O.cleanObject)({version:s,title:t,description:r,termsOfService:n,contact:i,license:o})}function pn(e,{version:t,specVersion:r,acceptMimes:s=["application/json"]}){const{paths:n,security:i,tags:o,host:a,basePath:c,schemes:p,consumes:u=[],produces:h=["application/json"],definitions:l,parameters:m,responses:d,securityDefinitions:f,externalDocs:g}=e;return{swagger:r,consumes:(0,O.uniq)([...s,...u]),produces:(0,O.uniq)([...h]),info:cn((0,O.getValue)(e,"info",{})),paths:n,host:a,basePath:c,schemes:p,definitions:l,parameters:m,responses:d,security:i,securityDefinitions:f,tags:o,externalDocs:g}}function un(e,{specVersion:t}){const{servers:r,paths:s,components:n,security:i,tags:o,externalDocs:a}=e;return{openapi:t,info:cn((0,O.getValue)(e,"info",{})),servers:r,paths:s,components:n,security:i,tags:o,externalDocs:a}}function hn(e,{fileSpec:t,acceptMimes:r,specVersion:s,version:n}){const i={specVersion:s=s||(0,O.getValue)(e,"openapi",(0,O.getValue)(e,"swagger","2.0")),acceptMimes:r};switch(on(s)){case pe.OPENAPI:e=un(e,i),t=t?un(t,i):t;break;default:case pe.SWAGGER:e=pn(e,i),t=t?pn(t,i):t}return e=rn(e,t),(0,O.setValue)(e,"info.title",(0,O.getValue)(e,"info.title","Api documentation")),(0,O.setValue)(e,"info.version",(0,O.getValue)(e,"info.version",n)),e}const ln=["get","put","post","delete","options","head","patch","trace"],mn=["format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","minLength","maxLength","multipleOf","minItems","maxItems","uniqueItems","minProperties","maxProperties","additionalProperties","pattern","enum","default"],dn=["type","items"],fn=/^(application\/json|[^;\/ \t]+\/[^;\/ \t]+[+]json)[ \t]*(;.*)?$/,gn={APPLICATION_X_WWW_URLENCODED:"application/x-www-form-urlencoded",MULTIPART_FORM_DATA:"multipart/form-data"};function yn(e){if(Array.isArray(e))e.forEach(yn);else if("object"==typeof e)for(let t in e)"$ref"===t?e.$ref=e.$ref.replace("#/components/schemas/","#/definitions/").replace("#/components/","#/x-components/"):yn(e[t])}function On(e){return new RegExp(fn,"i").test(e)}function Sn(e){const t=Object.keys(gn).map((e=>gn[e]));return Object.keys(e).filter((e=>t.indexOf(e)>-1||On(e)))}function bn(e){return Object.entries(e).reduce(((e,[t,r])=>{const s=function(e){const{scheme:t,type:r,name:s,bearerFormat:n,flows:i,...o}=e;switch(r){case"http":if("basic"===t)return{...o,type:t};if("bearer"===t)return{...o,type:"apiKey",name:"Authorization",in:"header"};break;case"oauth2":const e=Object.keys(i)[0],s=i[e];let n=e;return"clientCredentials"===n?n="application":"authorizationCode"===n&&(n="accessCode"),{type:r,flow:n,authorizationUrl:s.authorizationUrl,tokenUrl:s.tokenUrl,scopes:s.scopes}}}(r);return s&&(e[t]=s),e}),{})}function Rn(e){let t=e.url;const r=e.variables||{};for(const e in r){const s=r[e]||{};if(s.default){const r=RegExp(`{${e}}`,"g");t=t.replace(r,s.default)}}const s=new URL(t);return{host:s.host?s.host:void 0,basePath:s.pathname,schemes:null!==s.protocol?[s.protocol.substring(0,s.protocol.length-1)]:void 0}}class An{constructor(e){this.spec=JSON.parse(JSON.stringify(e))}convertInfos(){const e=this.spec.servers&&this.spec.servers[0];return e?Rn(e):{}}resolveReference(e,t,r){if(!t||!t.$ref)return t;const s=t.$ref;if(s.startsWith("#")){const t=s.split("/").map((e=>e.replace(/~1/g,"/").replace(/~0/g,"~")));t.shift();let n=e;return t.forEach((e=>{n=n[e]})),r?JSON.parse(JSON.stringify(n)):n}}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,yn(this.spec)),delete this.spec.servers,delete this.spec.openapi,delete this.spec["x-components"],(0,O.cleanObject)({...e,...this.spec})}convertOperations(e,t){return Object.entries(e).reduce(((e,[r,s])=>{const n=e[r]=this.resolveReference({...t,paths:e},s,!0);return this.convertParameters(n),Object.keys(n).forEach((r=>{if(ln.indexOf(r)>=0){const s=n[r]=this.resolveReference({...t,paths:e},n[r],!0);this.convertOperationParameters(s),this.convertResponses(s)}})),e}),e)}convertOperationParameters(e){let t,r,s,n;if(e.parameters=e.parameters||[],e.requestBody){let i=this.resolveReference(this.spec,e.requestBody,!0);if(e.requestBody.content){const t=Sn(e.requestBody.content)[0],r={content:{}},s=e.requestBody.content[t];s&&s.schema&&s.schema.$ref&&!s.schema.$ref.startsWith("#")&&(i=this.resolveReference(this.spec,s.schema,!0),r.content[`${t}`]={schema:i},i=r)}if(i.name="body",t=i.content,t&&Object.keys(t).length){if(s=Object.keys(t).filter((e=>e.indexOf("/")>0)),n=s.filter((e=>e.indexOf("*")<0)),r=Sn(t)[0],delete i.content,[gn.APPLICATION_X_WWW_URLENCODED,gn.MULTIPART_FORM_DATA].includes(r))if(e.consumes=n,i.in="formData",i.schema=t[r].schema,i.schema=this.resolveReference(this.spec,i.schema,!0),"object"===i.schema.type&&i.schema.properties){const t=i.schema.required||[];Object.keys(i.schema.properties).forEach((r=>{const s=i.schema.properties[r];if(!s.readOnly){const n={name:r,in:"formData",schema:s};t.indexOf(r)>=0&&(n.required=!0),e.parameters?.push(n)}}))}else e.parameters.push(i);else r?(e.consumes=n,i.in="body",i.schema=t[r].schema,e.parameters.push(i)):s&&(e.consumes=n||["application/octet-stream"],i.in="body",i.name=i.name||"file",delete i.type,i.schema=t[s[0]].schema||{type:"string",format:"binary"},e.parameters.push(i));i.schema&&this.convertSchema(i.schema,"request")}delete e.requestBody}this.convertParameters(e)}convertParameters(e){void 0!==e.parameters&&(e.parameters=e.parameters||[],(e.parameters||[]).forEach(((t,r)=>{if("body"!==(t=e.parameters[r]=this.resolveReference(this.spec,t,!1)).in){if(this.copySchemaProperties(t,mn),this.copySchemaProperties(t,dn),this.copySchemaXProperties(t),!t.description){const e=this.resolveReference(this.spec,t.schema,!1);e&&e.description&&(t.description=e.description)}void 0!==t.example&&(t["x-example"]=t.example),delete t.schema,delete t.allowReserved,delete t.example}if("array"===t.type)switch(t.style||("query"===t.in||"cookie"===t.in?"form":"simple")){case"matrix":t.collectionFormat=t.explode?void 0:"csv";break;case"label":t.collectionFormat=void 0;break;case"simple":t.collectionFormat="csv";break;case"spaceDelimited":t.collectionFormat="ssv";break;case"pipeDelimited":t.collectionFormat="pipes";break;case"deepOpbject":t.collectionFormat="multi";break;case"form":t.collectionFormat=!1===t.explode?"csv":"multi"}delete t.style,delete t.explode})))}copySchemaProperties(e,t){let r=this.resolveReference(this.spec,e.schema,!0);r&&t.forEach((t=>{const s=r[t];"additionalProperties"===t&&"boolean"==typeof s||void 0!==s&&(e[t]=s)}))}copySchemaXProperties(e){let t=this.resolveReference(this.spec,e.schema,!0);t&&Object.keys(t).forEach((r=>{Reflect.hasOwnProperty.call(t,r)&&!Reflect.hasOwnProperty.call(e,r)&&r.startsWith("x-")&&(e[r]=t[r])}))}convertResponses(e){Object.keys(e.responses||{}).forEach((t=>{const r=e.responses[t]=this.resolveReference(this.spec,e.responses[t],!0);if(r.content){let t=null,s=null;if(Object.keys(r.content).forEach((n=>{const i=n.indexOf("*")<0?n:"application/octet-stream";e.produces?e.produces.indexOf(i)<0&&e.produces.push(i):e.produces=[i];const o=r.content[n];t=t||o.schema,!s&&On(i)&&(s=o.schema),o.example&&(r.examples=r.examples||{},r.examples[i]=o.example)})),t){r.schema=s||t;const e=this.resolveReference(this.spec,r.schema,!0);e&&r.schema.$ref&&!r.schema.$ref.startsWith("#")&&(r.schema=e),this.convertSchema(r.schema,"response")}}Object.keys(r.headers||{}).forEach((e=>{const t=this.resolveReference(this.spec,r.headers[e],!0);t.schema&&(t.type=t.schema.type,t.format=t.schema.format,delete t.schema),r.headers[e]=t})),delete r.content}))}convertSchema(e,t){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 r in e.allOf)this.convertSchema(e.allOf[r],t);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((r=>{!0===e.properties[r].writeOnly&&"response"===t?delete e.properties[r]:(this.convertSchema(e.properties[r],t),delete e.properties[r].writeOnly)}));break;case"array":e.items&&this.convertSchema(e.items,t)}e.nullable&&(e["x-nullable"]=!0,delete e.nullable),void 0!==e.deprecated&&(void 0===e["x-deprecated"]&&(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((t=>{const r=e[t];if("string"!=typeof r)return void console.warn(`Ignoring ${r} for ${t} in discriminator.mapping.`);let s;if(/^[a-zA-Z0-9._-]+$/.test(r))try{s=this.resolveReference(this.spec,{$ref:`#/components/schemas/${r}`},!1)}catch(e){console.debug(`Error resolving ${r} for ${t} as schema name in discriminator.mapping: ${e}`)}if(!s)try{s=this.resolveReference(this.spec,{$ref:r},!1)}catch(e){console.debug(`Error resolving ${r} for ${t} in discriminator.mapping: ${e}`)}s?(s["x-discriminator-value"]=t,s["x-ms-discriminator-value"]=t):console.warn(`Unable to resolve ${r} for ${t} in discriminator.mapping.`)}))}convertSecurityDefinitions(){this.spec.components.securitySchemes&&(this.spec.securityDefinitions=bn(this.spec.components.securitySchemes),delete this.spec.components.securitySchemes)}}function En(e){return new An(e).convert()}function Tn({tokens:e,...t}){const{version:r="1.0.0",acceptMimes:s,fileSpec:n={},specVersion:i}=t,o=hn((0,O.getValue)(t,"spec",{}),{fileSpec:n,version:r,specVersion:i,acceptMimes:s}),a=an(o),c=rn(o,nn(e,t));return t.sortPaths&&(c.paths=Object.fromEntries(Object.entries(c.paths).sort((([e],[t])=>e.localeCompare(t))))),a===pe.SWAGGER?En(c):c}const Pn="$cache:schemes";function vn(e,t={}){const r=re(e),s=t.specType||pe.JSON;return t={endpoint:!0,groups:[],inlineEnums:s===pe.JSON,...t,specType:s,components:{schemas:{}}},"parameter"===r.decoratorType&&(t={...t,genericTypes:r.nestedGenerics[0],nestedGenerics:r.nestedGenerics,groups:r.parameter?.groups}),function(e,t){const r=e.store.get(Pn)||new Map,s=function(e){return JSON.stringify(e)}(t);if(!r.has(s)){const n=d("schema",[e.schema],t);Object.keys((0,O.getValue)(t,"components.schemas",{})).length&&(n.definitions=t.components.schemas),r.set(s,n)}return e.store.set(Pn,r),r.get(s)}(r,t)}function Cn(e,t={}){const r=e.isStore?e:re(e),s=Ms(t.basePath,r.path);let n=[];return t.withChildren&&(n=r.get("childrenControllers",[]).reduce(((e,r)=>e.concat(Cn(r,{...t,basePath:s}))),n)),[...ie(e).values()].reduce(((r,n)=>{const{operation:i}=n;return i&&i.getAllowedOperationPath(t.allowedVerbs).forEach((t=>{r.push(new ws({basePath:s,token:e,endpoint:n,operationPath:t}))})),r}),n)}function xn(e){const t=e.isStore?e:re(e);if(!t.$properties){const e=ne(t);t.$properties=new Map,e.forEach((e=>{e.children.forEach((e=>{t.$properties.has(e.propertyKey)||t.$properties.set(e.propertyKey,e)}))}))}return t.$properties}function $n(e,t={}){const r=xn(e),s=new Map;return r.forEach(((e,r)=>{!t.withIgnoredProps&&He(e.itemSchema,t)||s.set(r,e)})),s}return o})()));
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("change-case"),require("@tsed/core"),require("@tsed/hooks")):"function"==typeof define&&define.amd?define(["change-case","@tsed/core","@tsed/hooks"],t):"object"==typeof exports?exports["@tsed/schema"]=t(require("change-case"),require("@tsed/core"),require("@tsed/hooks")):e["@tsed/schema"]=t(e["change-case"],e["@tsed/core"],e["@tsed/hooks"])}(self,((e,t,r)=>(()=>{"use strict";var s={307:(e,t,r)=>{const s=r(393),n=r(366);function i(e,t,r=!1){return!t||null!==t.windows&&void 0!==t.windows||(t={...t,windows:n.isWindows()}),s(e,t,r)}Object.assign(i,s),e.exports=i},686:e=>{const t="\\\\/",r=`[^${t}]`,s="\\.",n="\\/",i="[^/]",o=`(?:${n}|$)`,a=`(?:^|${n})`,c=`${s}{1,2}${o}`,p={DOT_LITERAL:s,PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:n,ONE_CHAR:"(?=.)",QMARK:i,END_ANCHOR:o,DOTS_SLASH:c,NO_DOT:`(?!${s})`,NO_DOTS:`(?!${a}${c})`,NO_DOT_SLASH:`(?!${s}{0,1}${o})`,NO_DOTS_SLASH:`(?!${c})`,QMARK_NO_DOT:`[^.${n}]`,STAR:`${i}*?`,START_ANCHOR:a,SEP:"/"},u={...p,SLASH_LITERAL:`[${t}]`,QMARK:r,STAR:`${r}*?`,DOTS_SLASH:`${s}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${s})`,NO_DOTS:`(?!(?:^|[${t}])${s}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${s}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${s}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"};e.exports={MAX_LENGTH:65536,POSIX_REGEX_SOURCE:{alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"},REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars:e=>({"!":{type:"negate",open:"(?:(?!(?:",close:`))${e.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}),globChars:e=>!0===e?u:p}},284:(e,t,r)=>{const s=r(686),n=r(366),{MAX_LENGTH:i,POSIX_REGEX_SOURCE:o,REGEX_NON_SPECIAL_CHARS:a,REGEX_SPECIAL_CHARS_BACKREF:c,REPLACEMENTS:p}=s,u=(e,t)=>{if("function"==typeof t.expandRange)return t.expandRange(...e,t);e.sort();const r=`[${e.join("-")}]`;try{new RegExp(r)}catch(t){return e.map((e=>n.escapeRegex(e))).join("..")}return r},h=(e,t)=>`Missing ${e}: "${t}" - use "\\\\${t}" to match literal characters`,l=(e,t)=>{if("string"!=typeof e)throw new TypeError("Expected a string");e=p[e]||e;const r={...t},m="number"==typeof r.maxLength?Math.min(i,r.maxLength):i;let d=e.length;if(d>m)throw new SyntaxError(`Input length: ${d}, exceeds maximum allowed length: ${m}`);const f={type:"bos",value:"",output:r.prepend||""},g=[f],y=r.capture?"":"?:",O=s.globChars(r.windows),S=s.extglobChars(O),{DOT_LITERAL:b,PLUS_LITERAL:R,SLASH_LITERAL:A,ONE_CHAR:E,DOTS_SLASH:T,NO_DOT:P,NO_DOT_SLASH:v,NO_DOTS_SLASH:C,QMARK:x,QMARK_NO_DOT:$,STAR:M,START_ANCHOR:w}=O,_=e=>`(${y}(?:(?!${w}${e.dot?T:b}).)*?)`,N=r.dot?"":P,I=r.dot?x:$;let D=!0===r.bash?_(r):M;r.capture&&(D=`(${D})`),"boolean"==typeof r.noext&&(r.noextglob=r.noext);const L={input:e,index:-1,start:0,dot:!0===r.dot,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:g};e=n.removePrefix(e,L),d=e.length;const k=[],j=[],H=[];let G,q=f;const B=()=>L.index===d-1,U=L.peek=(t=1)=>e[L.index+t],K=L.advance=()=>e[++L.index]||"",J=()=>e.slice(L.index+1),F=(e="",t=0)=>{L.consumed+=e,L.index+=t},V=e=>{L.output+=null!=e.output?e.output:e.value,F(e.value)},W=()=>{let e=1;for(;"!"===U()&&("("!==U(2)||"?"===U(3));)K(),L.start++,e++;return e%2!=0&&(L.negated=!0,L.start++,!0)},X=e=>{L[e]++,H.push(e)},z=e=>{L[e]--,H.pop()},Y=e=>{if("globstar"===q.type){const t=L.braces>0&&("comma"===e.type||"brace"===e.type),r=!0===e.extglob||k.length&&("pipe"===e.type||"paren"===e.type);"slash"===e.type||"paren"===e.type||t||r||(L.output=L.output.slice(0,-q.output.length),q.type="star",q.value="*",q.output=D,L.output+=q.output)}if(k.length&&"paren"!==e.type&&(k[k.length-1].inner+=e.value),(e.value||e.output)&&V(e),q&&"text"===q.type&&"text"===e.type)return q.output=(q.output||q.value)+e.value,void(q.value+=e.value);e.prev=q,g.push(e),q=e},Q=(e,t)=>{const s={...S[t],conditions:1,inner:""};s.prev=q,s.parens=L.parens,s.output=L.output;const n=(r.capture?"(":"")+s.open;X("parens"),Y({type:e,value:t,output:L.output?"":E}),Y({type:"paren",extglob:!0,value:K(),output:n}),k.push(s)},Z=e=>{let s,n=e.close+(r.capture?")":"");if("negate"===e.type){let i=D;if(e.inner&&e.inner.length>1&&e.inner.includes("/")&&(i=_(r)),(i!==D||B()||/^\)+$/.test(J()))&&(n=e.close=`)$))${i}`),e.inner.includes("*")&&(s=J())&&/^\.[^\\/.]+$/.test(s)){const r=l(s,{...t,fastpaths:!1}).output;n=e.close=`)${r})${i})`}"bos"===e.prev.type&&(L.negatedExtglob=!0)}Y({type:"paren",extglob:!0,value:G,output:n}),z("parens")};if(!1!==r.fastpaths&&!/(^[*!]|[/()[\]{}"])/.test(e)){let s=!1,i=e.replace(c,((e,t,r,n,i,o)=>"\\"===n?(s=!0,e):"?"===n?t?t+n+(i?x.repeat(i.length):""):0===o?I+(i?x.repeat(i.length):""):x.repeat(r.length):"."===n?b.repeat(r.length):"*"===n?t?t+n+(i?D:""):D:t?e:`\\${e}`));return!0===s&&(i=!0===r.unescape?i.replace(/\\/g,""):i.replace(/\\+/g,(e=>e.length%2==0?"\\\\":e?"\\":""))),i===e&&!0===r.contains?(L.output=e,L):(L.output=n.wrapOutput(i,L,t),L)}for(;!B();){if(G=K(),"\0"===G)continue;if("\\"===G){const e=U();if("/"===e&&!0!==r.bash)continue;if("."===e||";"===e)continue;if(!e){G+="\\",Y({type:"text",value:G});continue}const t=/^\\+/.exec(J());let s=0;if(t&&t[0].length>2&&(s=t[0].length,L.index+=s,s%2!=0&&(G+="\\")),!0===r.unescape?G=K():G+=K(),0===L.brackets){Y({type:"text",value:G});continue}}if(L.brackets>0&&("]"!==G||"["===q.value||"[^"===q.value)){if(!1!==r.posix&&":"===G){const e=q.value.slice(1);if(e.includes("[")&&(q.posix=!0,e.includes(":"))){const e=q.value.lastIndexOf("["),t=q.value.slice(0,e),r=q.value.slice(e+2),s=o[r];if(s){q.value=t+s,L.backtrack=!0,K(),f.output||1!==g.indexOf(q)||(f.output=E);continue}}}("["===G&&":"!==U()||"-"===G&&"]"===U())&&(G=`\\${G}`),"]"!==G||"["!==q.value&&"[^"!==q.value||(G=`\\${G}`),!0===r.posix&&"!"===G&&"["===q.value&&(G="^"),q.value+=G,V({value:G});continue}if(1===L.quotes&&'"'!==G){G=n.escapeRegex(G),q.value+=G,V({value:G});continue}if('"'===G){L.quotes=1===L.quotes?0:1,!0===r.keepQuotes&&Y({type:"text",value:G});continue}if("("===G){X("parens"),Y({type:"paren",value:G});continue}if(")"===G){if(0===L.parens&&!0===r.strictBrackets)throw new SyntaxError(h("opening","("));const e=k[k.length-1];if(e&&L.parens===e.parens+1){Z(k.pop());continue}Y({type:"paren",value:G,output:L.parens?")":"\\)"}),z("parens");continue}if("["===G){if(!0!==r.nobracket&&J().includes("]"))X("brackets");else{if(!0!==r.nobracket&&!0===r.strictBrackets)throw new SyntaxError(h("closing","]"));G=`\\${G}`}Y({type:"bracket",value:G});continue}if("]"===G){if(!0===r.nobracket||q&&"bracket"===q.type&&1===q.value.length){Y({type:"text",value:G,output:`\\${G}`});continue}if(0===L.brackets){if(!0===r.strictBrackets)throw new SyntaxError(h("opening","["));Y({type:"text",value:G,output:`\\${G}`});continue}z("brackets");const e=q.value.slice(1);if(!0===q.posix||"^"!==e[0]||e.includes("/")||(G=`/${G}`),q.value+=G,V({value:G}),!1===r.literalBrackets||n.hasRegexChars(e))continue;const t=n.escapeRegex(q.value);if(L.output=L.output.slice(0,-q.value.length),!0===r.literalBrackets){L.output+=t,q.value=t;continue}q.value=`(${y}${t}|${q.value})`,L.output+=q.value;continue}if("{"===G&&!0!==r.nobrace){X("braces");const e={type:"brace",value:G,output:"(",outputIndex:L.output.length,tokensIndex:L.tokens.length};j.push(e),Y(e);continue}if("}"===G){const e=j[j.length-1];if(!0===r.nobrace||!e){Y({type:"text",value:G,output:G});continue}let t=")";if(!0===e.dots){const e=g.slice(),s=[];for(let t=e.length-1;t>=0&&(g.pop(),"brace"!==e[t].type);t--)"dots"!==e[t].type&&s.unshift(e[t].value);t=u(s,r),L.backtrack=!0}if(!0!==e.comma&&!0!==e.dots){const r=L.output.slice(0,e.outputIndex),s=L.tokens.slice(e.tokensIndex);e.value=e.output="\\{",G=t="\\}",L.output=r;for(const e of s)L.output+=e.output||e.value}Y({type:"brace",value:G,output:t}),z("braces"),j.pop();continue}if("|"===G){k.length>0&&k[k.length-1].conditions++,Y({type:"text",value:G});continue}if(","===G){let e=G;const t=j[j.length-1];t&&"braces"===H[H.length-1]&&(t.comma=!0,e="|"),Y({type:"comma",value:G,output:e});continue}if("/"===G){if("dot"===q.type&&L.index===L.start+1){L.start=L.index+1,L.consumed="",L.output="",g.pop(),q=f;continue}Y({type:"slash",value:G,output:A});continue}if("."===G){if(L.braces>0&&"dot"===q.type){"."===q.value&&(q.output=b);const e=j[j.length-1];q.type="dots",q.output+=G,q.value+=G,e.dots=!0;continue}if(L.braces+L.parens===0&&"bos"!==q.type&&"slash"!==q.type){Y({type:"text",value:G,output:b});continue}Y({type:"dot",value:G,output:b});continue}if("?"===G){if((!q||"("!==q.value)&&!0!==r.noextglob&&"("===U()&&"?"!==U(2)){Q("qmark",G);continue}if(q&&"paren"===q.type){const e=U();let t=G;("("===q.value&&!/[!=<:]/.test(e)||"<"===e&&!/<([!=]|\w+>)/.test(J()))&&(t=`\\${G}`),Y({type:"text",value:G,output:t});continue}if(!0!==r.dot&&("slash"===q.type||"bos"===q.type)){Y({type:"qmark",value:G,output:$});continue}Y({type:"qmark",value:G,output:x});continue}if("!"===G){if(!0!==r.noextglob&&"("===U()&&("?"!==U(2)||!/[!=<:]/.test(U(3)))){Q("negate",G);continue}if(!0!==r.nonegate&&0===L.index){W();continue}}if("+"===G){if(!0!==r.noextglob&&"("===U()&&"?"!==U(2)){Q("plus",G);continue}if(q&&"("===q.value||!1===r.regex){Y({type:"plus",value:G,output:R});continue}if(q&&("bracket"===q.type||"paren"===q.type||"brace"===q.type)||L.parens>0){Y({type:"plus",value:G});continue}Y({type:"plus",value:R});continue}if("@"===G){if(!0!==r.noextglob&&"("===U()&&"?"!==U(2)){Y({type:"at",extglob:!0,value:G,output:""});continue}Y({type:"text",value:G});continue}if("*"!==G){"$"!==G&&"^"!==G||(G=`\\${G}`);const e=a.exec(J());e&&(G+=e[0],L.index+=e[0].length),Y({type:"text",value:G});continue}if(q&&("globstar"===q.type||!0===q.star)){q.type="star",q.star=!0,q.value+=G,q.output=D,L.backtrack=!0,L.globstar=!0,F(G);continue}let t=J();if(!0!==r.noextglob&&/^\([^?]/.test(t)){Q("star",G);continue}if("star"===q.type){if(!0===r.noglobstar){F(G);continue}const s=q.prev,n=s.prev,i="slash"===s.type||"bos"===s.type,o=n&&("star"===n.type||"globstar"===n.type);if(!0===r.bash&&(!i||t[0]&&"/"!==t[0])){Y({type:"star",value:G,output:""});continue}const a=L.braces>0&&("comma"===s.type||"brace"===s.type),c=k.length&&("pipe"===s.type||"paren"===s.type);if(!i&&"paren"!==s.type&&!a&&!c){Y({type:"star",value:G,output:""});continue}for(;"/**"===t.slice(0,3);){const r=e[L.index+4];if(r&&"/"!==r)break;t=t.slice(3),F("/**",3)}if("bos"===s.type&&B()){q.type="globstar",q.value+=G,q.output=_(r),L.output=q.output,L.globstar=!0,F(G);continue}if("slash"===s.type&&"bos"!==s.prev.type&&!o&&B()){L.output=L.output.slice(0,-(s.output+q.output).length),s.output=`(?:${s.output}`,q.type="globstar",q.output=_(r)+(r.strictSlashes?")":"|$)"),q.value+=G,L.globstar=!0,L.output+=s.output+q.output,F(G);continue}if("slash"===s.type&&"bos"!==s.prev.type&&"/"===t[0]){const e=void 0!==t[1]?"|$":"";L.output=L.output.slice(0,-(s.output+q.output).length),s.output=`(?:${s.output}`,q.type="globstar",q.output=`${_(r)}${A}|${A}${e})`,q.value+=G,L.output+=s.output+q.output,L.globstar=!0,F(G+K()),Y({type:"slash",value:"/",output:""});continue}if("bos"===s.type&&"/"===t[0]){q.type="globstar",q.value+=G,q.output=`(?:^|${A}|${_(r)}${A})`,L.output=q.output,L.globstar=!0,F(G+K()),Y({type:"slash",value:"/",output:""});continue}L.output=L.output.slice(0,-q.output.length),q.type="globstar",q.output=_(r),q.value+=G,L.output+=q.output,L.globstar=!0,F(G);continue}const s={type:"star",value:G,output:D};!0!==r.bash?!q||"bracket"!==q.type&&"paren"!==q.type||!0!==r.regex?(L.index!==L.start&&"slash"!==q.type&&"dot"!==q.type||("dot"===q.type?(L.output+=v,q.output+=v):!0===r.dot?(L.output+=C,q.output+=C):(L.output+=N,q.output+=N),"*"!==U()&&(L.output+=E,q.output+=E)),Y(s)):(s.output=G,Y(s)):(s.output=".*?","bos"!==q.type&&"slash"!==q.type||(s.output=N+s.output),Y(s))}for(;L.brackets>0;){if(!0===r.strictBrackets)throw new SyntaxError(h("closing","]"));L.output=n.escapeLast(L.output,"["),z("brackets")}for(;L.parens>0;){if(!0===r.strictBrackets)throw new SyntaxError(h("closing",")"));L.output=n.escapeLast(L.output,"("),z("parens")}for(;L.braces>0;){if(!0===r.strictBrackets)throw new SyntaxError(h("closing","}"));L.output=n.escapeLast(L.output,"{"),z("braces")}if(!0===r.strictSlashes||"star"!==q.type&&"bracket"!==q.type||Y({type:"maybe_slash",value:"",output:`${A}?`}),!0===L.backtrack){L.output="";for(const e of L.tokens)L.output+=null!=e.output?e.output:e.value,e.suffix&&(L.output+=e.suffix)}return L};l.fastpaths=(e,t)=>{const r={...t},o="number"==typeof r.maxLength?Math.min(i,r.maxLength):i,a=e.length;if(a>o)throw new SyntaxError(`Input length: ${a}, exceeds maximum allowed length: ${o}`);e=p[e]||e;const{DOT_LITERAL:c,SLASH_LITERAL:u,ONE_CHAR:h,DOTS_SLASH:l,NO_DOT:m,NO_DOTS:d,NO_DOTS_SLASH:f,STAR:g,START_ANCHOR:y}=s.globChars(r.windows),O=r.dot?d:m,S=r.dot?f:m,b=r.capture?"":"?:";let R=!0===r.bash?".*?":g;r.capture&&(R=`(${R})`);const A=e=>!0===e.noglobstar?R:`(${b}(?:(?!${y}${e.dot?l:c}).)*?)`,E=e=>{switch(e){case"*":return`${O}${h}${R}`;case".*":return`${c}${h}${R}`;case"*.*":return`${O}${R}${c}${h}${R}`;case"*/*":return`${O}${R}${u}${h}${S}${R}`;case"**":return O+A(r);case"**/*":return`(?:${O}${A(r)}${u})?${S}${h}${R}`;case"**/*.*":return`(?:${O}${A(r)}${u})?${S}${R}${c}${h}${R}`;case"**/.*":return`(?:${O}${A(r)}${u})?${c}${h}${R}`;default:{const t=/^(.*?)\.(\w+)$/.exec(e);if(!t)return;const r=E(t[1]);if(!r)return;return r+c+t[2]}}},T=n.removePrefix(e,{negated:!1,prefix:""});let P=E(T);return P&&!0!==r.strictSlashes&&(P+=`${u}?`),P},e.exports=l},393:(e,t,r)=>{const s=r(498),n=r(284),i=r(366),o=r(686),a=(e,t,r=!1)=>{if(Array.isArray(e)){const s=e.map((e=>a(e,t,r))),n=e=>{for(const t of s){const r=t(e);if(r)return r}return!1};return n}const s=(n=e)&&"object"==typeof n&&!Array.isArray(n)&&e.tokens&&e.input;var n;if(""===e||"string"!=typeof e&&!s)throw new TypeError("Expected pattern to be a non-empty string");const i=t||{},o=i.windows,c=s?a.compileRe(e,t):a.makeRe(e,t,!1,!0),p=c.state;delete c.state;let u=()=>!1;if(i.ignore){const e={...t,ignore:null,onMatch:null,onResult:null};u=a(i.ignore,e,r)}const h=(r,s=!1)=>{const{isMatch:n,match:h,output:l}=a.test(r,c,t,{glob:e,posix:o}),m={glob:e,state:p,regex:c,posix:o,input:r,output:l,match:h,isMatch:n};return"function"==typeof i.onResult&&i.onResult(m),!1===n?(m.isMatch=!1,!!s&&m):u(r)?("function"==typeof i.onIgnore&&i.onIgnore(m),m.isMatch=!1,!!s&&m):("function"==typeof i.onMatch&&i.onMatch(m),!s||m)};return r&&(h.state=p),h};a.test=(e,t,r,{glob:s,posix:n}={})=>{if("string"!=typeof e)throw new TypeError("Expected input to be a string");if(""===e)return{isMatch:!1,output:""};const o=r||{},c=o.format||(n?i.toPosixSlashes:null);let p=e===s,u=p&&c?c(e):e;return!1===p&&(u=c?c(e):e,p=u===s),!1!==p&&!0!==o.capture||(p=!0===o.matchBase||!0===o.basename?a.matchBase(e,t,r,n):t.exec(u)),{isMatch:Boolean(p),match:p,output:u}},a.matchBase=(e,t,r)=>(t instanceof RegExp?t:a.makeRe(t,r)).test(i.basename(e)),a.isMatch=(e,t,r)=>a(t,r)(e),a.parse=(e,t)=>Array.isArray(e)?e.map((e=>a.parse(e,t))):n(e,{...t,fastpaths:!1}),a.scan=(e,t)=>s(e,t),a.compileRe=(e,t,r=!1,s=!1)=>{if(!0===r)return e.output;const n=t||{},i=n.contains?"":"^",o=n.contains?"":"$";let c=`${i}(?:${e.output})${o}`;e&&!0===e.negated&&(c=`^(?!${c}).*$`);const p=a.toRegex(c,t);return!0===s&&(p.state=e),p},a.makeRe=(e,t={},r=!1,s=!1)=>{if(!e||"string"!=typeof e)throw new TypeError("Expected a non-empty string");let i={negated:!1,fastpaths:!0};return!1===t.fastpaths||"."!==e[0]&&"*"!==e[0]||(i.output=n.fastpaths(e,t)),i.output||(i=n(e,t)),a.compileRe(i,t,r,s)},a.toRegex=(e,t)=>{try{const r=t||{};return new RegExp(e,r.flags||(r.nocase?"i":""))}catch(e){if(t&&!0===t.debug)throw e;return/$^/}},a.constants=o,e.exports=a},498:(e,t,r)=>{const s=r(366),{CHAR_ASTERISK:n,CHAR_AT:i,CHAR_BACKWARD_SLASH:o,CHAR_COMMA:a,CHAR_DOT:c,CHAR_EXCLAMATION_MARK:p,CHAR_FORWARD_SLASH:u,CHAR_LEFT_CURLY_BRACE:h,CHAR_LEFT_PARENTHESES:l,CHAR_LEFT_SQUARE_BRACKET:m,CHAR_PLUS:d,CHAR_QUESTION_MARK:f,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:y,CHAR_RIGHT_SQUARE_BRACKET:O}=r(686),S=e=>e===u||e===o,b=e=>{!0!==e.isPrefix&&(e.depth=e.isGlobstar?1/0:1)};e.exports=(e,t)=>{const r=t||{},R=e.length-1,A=!0===r.parts||!0===r.scanToEnd,E=[],T=[],P=[];let v,C,x=e,$=-1,M=0,w=0,_=!1,N=!1,I=!1,D=!1,L=!1,k=!1,j=!1,H=!1,G=!1,q=!1,B=0,U={value:"",depth:0,isGlob:!1};const K=()=>$>=R,J=()=>(v=C,x.charCodeAt(++$));for(;$<R;){let e;if(C=J(),C!==o){if(!0===k||C===h){for(B++;!0!==K()&&(C=J());)if(C!==o)if(C!==h){if(!0!==k&&C===c&&(C=J())===c){if(_=U.isBrace=!0,I=U.isGlob=!0,q=!0,!0===A)continue;break}if(!0!==k&&C===a){if(_=U.isBrace=!0,I=U.isGlob=!0,q=!0,!0===A)continue;break}if(C===g&&(B--,0===B)){k=!1,_=U.isBrace=!0,q=!0;break}}else B++;else j=U.backslashes=!0,J();if(!0===A)continue;break}if(C!==u){if(!0!==r.noext&&!0==(C===d||C===i||C===n||C===f||C===p)&&x.charCodeAt($+1)===l){if(I=U.isGlob=!0,D=U.isExtglob=!0,q=!0,C===p&&$===M&&(G=!0),!0===A){for(;!0!==K()&&(C=J());)if(C!==o){if(C===y){I=U.isGlob=!0,q=!0;break}}else j=U.backslashes=!0,C=J();continue}break}if(C===n){if(v===n&&(L=U.isGlobstar=!0),I=U.isGlob=!0,q=!0,!0===A)continue;break}if(C===f){if(I=U.isGlob=!0,q=!0,!0===A)continue;break}if(C===m){for(;!0!==K()&&(e=J());)if(e!==o){if(e===O){N=U.isBracket=!0,I=U.isGlob=!0,q=!0;break}}else j=U.backslashes=!0,J();if(!0===A)continue;break}if(!0===r.nonegate||C!==p||$!==M){if(!0!==r.noparen&&C===l){if(I=U.isGlob=!0,!0===A){for(;!0!==K()&&(C=J());)if(C!==l){if(C===y){q=!0;break}}else j=U.backslashes=!0,C=J();continue}break}if(!0===I){if(q=!0,!0===A)continue;break}}else H=U.negated=!0,M++}else{if(E.push($),T.push(U),U={value:"",depth:0,isGlob:!1},!0===q)continue;if(v===c&&$===M+1){M+=2;continue}w=$+1}}else j=U.backslashes=!0,C=J(),C===h&&(k=!0)}!0===r.noext&&(D=!1,I=!1);let F=x,V="",W="";M>0&&(V=x.slice(0,M),x=x.slice(M),w-=M),F&&!0===I&&w>0?(F=x.slice(0,w),W=x.slice(w)):!0===I?(F="",W=x):F=x,F&&""!==F&&"/"!==F&&F!==x&&S(F.charCodeAt(F.length-1))&&(F=F.slice(0,-1)),!0===r.unescape&&(W&&(W=s.removeBackslashes(W)),F&&!0===j&&(F=s.removeBackslashes(F)));const X={prefix:V,input:e,start:M,base:F,glob:W,isBrace:_,isBracket:N,isGlob:I,isExtglob:D,isGlobstar:L,negated:H,negatedExtglob:G};if(!0===r.tokens&&(X.maxDepth=0,S(C)||T.push(U),X.tokens=T),!0===r.parts||!0===r.tokens){let t;for(let s=0;s<E.length;s++){const n=t?t+1:M,i=E[s],o=e.slice(n,i);r.tokens&&(0===s&&0!==M?(T[s].isPrefix=!0,T[s].value=V):T[s].value=o,b(T[s]),X.maxDepth+=T[s].depth),0===s&&""===o||P.push(o),t=i}if(t&&t+1<e.length){const s=e.slice(t+1);P.push(s),r.tokens&&(T[T.length-1].value=s,b(T[T.length-1]),X.maxDepth+=T[T.length-1].depth)}X.slashes=E,X.parts=P}return X}},366:(e,t,r)=>{const{REGEX_BACKSLASH:s,REGEX_REMOVE_BACKSLASH:n,REGEX_SPECIAL_CHARS:i,REGEX_SPECIAL_CHARS_GLOBAL:o}=r(686);t.isObject=e=>null!==e&&"object"==typeof e&&!Array.isArray(e),t.hasRegexChars=e=>i.test(e),t.isRegexChar=e=>1===e.length&&t.hasRegexChars(e),t.escapeRegex=e=>e.replace(o,"\\$1"),t.toPosixSlashes=e=>e.replace(s,"/"),t.isWindows=()=>{if("undefined"!=typeof navigator&&navigator.platform){const e=navigator.platform.toLowerCase();return"win32"===e||"windows"===e}return!("undefined"==typeof process||!process.platform)&&"win32"===process.platform},t.removeBackslashes=e=>e.replace(n,(e=>"\\"===e?"":e)),t.escapeLast=(e,r,s)=>{const n=e.lastIndexOf(r,s);return-1===n?e:"\\"===e[n-1]?t.escapeLast(e,r,n-1):`${e.slice(0,n)}\\${e.slice(n)}`},t.removePrefix=(e,t={})=>{let r=e;return r.startsWith("./")&&(r=r.slice(2),t.prefix="./"),r},t.wrapOutput=(e,t={},r={})=>{let s=`${r.contains?"":"^"}(?:${e})${r.contains?"":"$"}`;return!0===t.negated&&(s=`(?:^(?!${s}).*$)`),s},t.basename=(e,{windows:t}={})=>{const r=e.split(t?/[\\/]/:"/"),s=r[r.length-1];return""===s?r[r.length-2]:s}},725:(e,t,r)=>{var s=r(880);function n(e){if(!Object.prototype.hasOwnProperty.call(i.message,e))throw new Error("invalid status code: "+e);return i.message[e]}function i(e){if("number"==typeof e)return n(e);if("string"!=typeof e)throw new TypeError("code must be a number or string");var t=parseInt(e,10);return isNaN(t)?function(e){var t=e.toLowerCase();if(!Object.prototype.hasOwnProperty.call(i.code,t))throw new Error('invalid status message: "'+e+'"');return i.code[t]}(e):n(t)}e.exports=i,i.message=s,i.code=function(e){var t={};return Object.keys(e).forEach((function(r){var s=e[r],n=Number(r);t[s.toLowerCase()]=n})),t}(s),i.codes=function(e){return Object.keys(e).map((function(e){return Number(e)}))}(s),i.redirect={300:!0,301:!0,302:!0,303:!0,305:!0,307:!0,308:!0},i.empty={204:!0,205:!0,304:!0},i.retry={502:!0,503:!0,504:!0}},414:e=>{e.exports=t},171:e=>{e.exports=r},579:t=>{t.exports=e},880:e=>{e.exports=JSON.parse('{"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I\'m a Teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Too Early","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"}')}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return s[e](r,r.exports,i),r.exports}i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};i.r(o),i.d(o,{ARRAY_PROPERTIES:()=>De,AcceptMime:()=>Jr,AdditionalProperties:()=>Lt,All:()=>gs,AllOf:()=>kt,Allow:()=>Ht,Any:()=>Gt,AnyOf:()=>qt,ArrayOf:()=>Ct,BOOLEAN_PROPERTIES:()=>Ne,COMMON_PROPERTIES:()=>ke,Children:()=>Tt,CollectionContains:()=>$t,CollectionOf:()=>vt,Const:()=>Bt,Consumes:()=>Kr,ContentType:()=>Zr,Converter:()=>An,CustomKey:()=>Ut,CustomKeys:()=>Kt,DateFormat:()=>pr,DateTime:()=>cr,DecoratorContext:()=>Fr,Default:()=>Jt,DefaultMsg:()=>Vt,Delete:()=>bs,Deprecated:()=>es,Description:()=>Wt,Discriminator:()=>_,DiscriminatorKey:()=>Xt,DiscriminatorValue:()=>Pt,Email:()=>ar,EndpointMetadata:()=>V,Enum:()=>zt,ErrorMsg:()=>Ft,Example:()=>Yt,Examples:()=>Qt,ExclusiveMaximum:()=>tr,ExclusiveMinimum:()=>nr,For:()=>Nr,Format:()=>or,ForwardGroups:()=>mr,GenericOf:()=>Br,Generics:()=>Ur,Get:()=>ys,Groups:()=>Or,HTTP_STATUS_MESSAGES:()=>at,Head:()=>Rs,Header:()=>ts,Hidden:()=>Sr,Ignore:()=>br,In:()=>rs,InFile:()=>ss,Integer:()=>Rr,JSON_TYPES:()=>C,JsonClassStore:()=>L,JsonEntitiesContainer:()=>R,JsonEntityComponent:()=>E,JsonEntityFn:()=>Et,JsonEntityStore:()=>A,JsonFormatTypes:()=>ir,JsonLazyRef:()=>ye,JsonMap:()=>H,JsonMedia:()=>B,JsonMethodPath:()=>K,JsonMethodStore:()=>F,JsonOperation:()=>J,JsonOperationPathsMap:()=>se,JsonOperationRoute:()=>ws,JsonParameter:()=>Y,JsonParameterStore:()=>Q,JsonParameterTypes:()=>W,JsonPropertyStore:()=>ee,JsonRequestBody:()=>lt,JsonResponse:()=>U,JsonSchema:()=>D,LabelledAs:()=>Ar,Location:()=>ns,MANY_OF_PROPERTIES:()=>we,MapOf:()=>xt,Max:()=>er,MaxItems:()=>wt,MaxLength:()=>Er,MaxProperties:()=>_t,Maximum:()=>Zt,Min:()=>sr,MinItems:()=>Nt,MinLength:()=>Tr,MinProperties:()=>It,Minimum:()=>rr,MultipleOf:()=>Pr,NUMBER_PROPERTIES:()=>Ie,Name:()=>vr,Nullable:()=>Cr,OBJECT_PROPERTIES:()=>Le,OPERATION_HTTP_VERBS:()=>p,OPERATION_WS_VERBS:()=>u,OneOf:()=>xr,Operation:()=>cs,OperationId:()=>ps,OperationPath:()=>us,OperationVerbs:()=>a,Optional:()=>$r,Options:()=>Es,ParamMetadata:()=>Z,Partial:()=>hs,Patch:()=>As,Path:()=>ls,Pattern:()=>Mr,Post:()=>Os,Produces:()=>ms,Property:()=>jt,PropertyMetadata:()=>te,Publish:()=>ds,Put:()=>Ss,ReadOnly:()=>wr,RecordOf:()=>Ir,Redirect:()=>fs,Required:()=>Dr,RequiredGroups:()=>Lr,Returns:()=>Qr,STRING_PROPERTIES:()=>_e,Schema:()=>_r,Security:()=>Ts,SpecTypes:()=>pe,Status:()=>Ps,Subscribe:()=>vs,Summary:()=>Cs,Tags:()=>xs,TimeFormat:()=>ur,Title:()=>kr,TypeError:()=>jr,UniqueItems:()=>Dt,Uri:()=>hr,Url:()=>lr,View:()=>$s,WriteOnly:()=>Hr,allOf:()=>_s,alterIgnore:()=>He,alterOneOf:()=>Ve,alterRequiredGroups:()=>Ue,any:()=>Ns,anyMapper:()=>Re,anyOf:()=>Is,array:()=>Ls,boolean:()=>Ds,buildPath:()=>y,channelsMapper:()=>ce,classMapper:()=>Ae,concatParameters:()=>ft,concatPath:()=>Ms,createRef:()=>Se,createRefName:()=>Oe,date:()=>Hs,datetime:()=>Gs,defineStatusModel:()=>Wr,discriminatorMappingMapper:()=>Ee,email:()=>Bs,enums:()=>Us,enumsMapper:()=>Te,enumsRegistry:()=>P,execMapper:()=>d,execOneOfMapper:()=>g,formatParameterType:()=>X,from:()=>Gr,generateSpec:()=>Tn,genericsMapper:()=>Pe,getComputedType:()=>v,getGenericsMap:()=>le,getInheritedStores:()=>ne,getJsonEntityStore:()=>re,getJsonPathParameters:()=>gt,getJsonSchema:()=>vn,getJsonSchemaMapper:()=>m,getJsonType:()=>x,getOperationId:()=>St,getOperationsRoutes:()=>Cn,getOperationsStores:()=>ie,getProperties:()=>$n,getPropertiesStores:()=>xn,getSpec:()=>nn,getSpecType:()=>on,getSpecTypeFromSpec:()=>an,getStatusConstant:()=>ct,getStatusMessage:()=>pt,getStatusModel:()=>Xr,hasMapper:()=>f,inheritedClassMapper:()=>Ce,integer:()=>Ks,isParameterType:()=>z,isRedirectionStatus:()=>j,isSuccessStatus:()=>k,itemMapper:()=>xe,lazyRef:()=>Js,lazyRefMapper:()=>$e,makeOf:()=>ue,map:()=>ks,mapAliasedProperties:()=>Je,mapGenericsOptions:()=>me,mapHeaders:()=>G,mapMapper:()=>Me,mapOpenSpec:()=>hn,mapOpenSpec2:()=>pn,mapOpenSpec3:()=>un,mapOpenSpecInfo:()=>cn,mapOperationOptions:()=>os,matchGroups:()=>yr,mergeSpec:()=>rn,messageMapper:()=>he,nullableMapper:()=>je,nullableMapperOpenApi:()=>Ze,number:()=>Fs,object:()=>Vs,objectMapper:()=>Ge,ofMapper:()=>qe,oneOf:()=>Ws,operationIdFormatter:()=>Ot,operationInFilesMapper:()=>et,operationInParameterMapper:()=>tt,operationInParametersMapper:()=>rt,operationInQueryMapper:()=>nt,operationMapper:()=>ut,operationMediaMapper:()=>ht,operationRequestBodyMapper:()=>mt,operationResponseMapper:()=>dt,parameters:()=>Qs,pathsMapper:()=>At,payloadMapper:()=>fe,popGenerics:()=>de,propertiesMapper:()=>Be,registerJsonSchemaMapper:()=>l,removeHiddenOperation:()=>oe,requiredMapper:()=>Ke,responsePayloadMapper:()=>ge,schemaMapper:()=>ze,schemesReducer:()=>Ys,security:()=>Zs,serializeEnum:()=>$,serializeEnumValues:()=>M,set:()=>js,string:()=>qr,tagsReducer:()=>en,time:()=>qs,toJsonMapCollection:()=>q,toJsonRegex:()=>w,toRef:()=>be,transformInformation:()=>Rn,transformSecurity:()=>bn,transformToOS2:()=>En,uri:()=>Xs,url:()=>zs,withErrorMsg:()=>Mt,wrapEnumsMapper:()=>Ye});var a,c=i(579);!function(e){e.ALL="ALL",e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.HEAD="HEAD",e.DELETE="DELETE",e.OPTIONS="OPTIONS",e.TRACE="TRACE",e.PUBLISH="PUBLISH",e.SUBSCRIBE="SUBSCRIBE",e.CUSTOM="CUSTOM"}(a||(a={}));const p=[a.ALL,a.GET,a.POST,a.PUT,a.PATCH,a.HEAD,a.DELETE,a.OPTIONS,a.TRACE,a.CUSTOM],u=[a.PUBLISH,a.SUBSCRIBE],h=new Map;function l(e,t,r){return h.set(r?`${r}:${e}`:e,t)}function m(e,t){const r=h.get(`${t?.specType}:${e}`)||h.get(e);if(r)return r;throw new Error(`JsonSchema ${e} mapper doesn't exists`)}function d(e,t,r,s){return m(e,r)(...t,r,s)}function f(e){return h.has(e)}function g(e,t){return e.find((e=>h.has(`${t?.specType}:${e}`)))||e.find((e=>h.has(e)))}function y(e){return e.split("/").filter(Boolean).join("/")}var O=i(414);function S(e,t,r,s){var n,i=arguments.length,o=i<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,r):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,s);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(i<3?n(o):i>3?n(t,r,o):n(t,r))||o);return i>3&&o&&Object.defineProperty(t,r,o),o}function b(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError;const R=new Map;class A{constructor(e){this.isStore=!0;const{target:t,propertyKey:r,descriptor:s,index:n,decoratorType:i}=e;this.target=t,this.propertyKey=r,this.propertyName=String(r),this.descriptor=s,this.index=n,this.decoratorType=i,this.token=t,this.store=e.store,this.parent=this}get targetName(){return(0,O.nameOf)(this.token)}get isCollection(){return!!this.collectionType}get isArray(){return(0,O.isArrayOrArrayClass)(this.collectionType)}get discriminatorAncestor(){const e=(0,O.ancestorsOf)(this.target).find((e=>A.from(e).schema.isDiscriminator));return e&&A.from(e)}get isPrimitive(){return(0,O.isPrimitiveOrPrimitiveClass)(this._type)}get isDate(){return(0,O.isDate)(this.computedType)}get isObject(){return(0,O.isObject)(this.computedType)}get isClass(){return(0,O.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(){return this.schema.isDiscriminator&&this.discriminatorAncestor?.schema.discriminator().base!==this.target}static from(...e){if(e[0].isStore)return e[0];const t=e[0];e.length>1&&(e[0]=(0,O.prototypeOf)(e[0]));const r=O.Store.from(...e);if(!r.has("JsonEntityStore")){const s=(0,O.decoratorTypeOf)(e),n=new(R.get(s))({store:r,decoratorType:s,target:(0,O.classOf)(t),propertyKey:e[1],index:"number"==typeof e[2]?e[2]:void 0,descriptor:"object"==typeof e[2]?e[2]:void 0});n.build(),r.set("JsonEntityStore",n)}return r.get("JsonEntityStore")}static fromMethod(e,t){return this.from(e,t,(0,O.descriptorOf)(e,t))}static get(e,t,r){return A.from((0,O.prototypeOf)(e),t,r)}isGetterOnly(){return(0,O.isObject)(this.descriptor)&&!this.descriptor.value&&this.descriptor.get&&!this.descriptor.set}get(e,t){return this.store.get(e,t)}set(e,t){return this.store.set(e,t)}toString(){return[this.targetName,this.propertyName,this.index].filter((e=>void 0!==e)).join(":")}buildType(e){(0,O.isCollection)(e)?this.collectionType=e:(this._type=e,this._type&&(0,O.isPlainObject)(this._type)&&(this._type=String))}getBestType(){return this.itemSchema.hasDiscriminator?this.itemSchema.discriminator().base:(0,O.isClassObject)(this.type)?this.itemSchema.getTarget():(0,O.isArrowFn)(this.type)?this.type():this.type}}function E(e){return t=>{R.set(e,t)}}var T=i(171);const P=new Map;function v(e){return(0,O.isPromise)(e)||e===Function?Object:(0,O.isClass)(e)||(0,O.isSymbol)(e)||(0,O.isPrimitiveOrPrimitiveClass)(e)||(0,O.isClassObject)(e)||(0,O.isDate)(e)||(0,O.isCollection)(e)?(0,O.classOf)(e):(0,O.isArrowFn)(e)?e():e}const C=["string","number","integer","boolean","object","array","null","any"];function x(e){return null===e?"null":(0,O.isPrimitiveOrPrimitiveClass)(e)?C.indexOf(e)>-1?e:"string"==typeof e?"file"===e?"file":"generic":(0,O.primitiveOf)(e):e===Array?"array":(0,O.isArray)(e)?e.map(x):e===Set?"array":(0,O.isDate)(e)||(0,O.isBuffer)(e)?"string":"object"}const $=e=>(0,O.isObject)(e)&&null!==e?Object.entries(e).reduce(((e,[t,r])=>isNaN(+t)?e.concat(r):e),[]):e;function M(e){const t=e.reduce(((e,t)=>e.concat($(t))),[]),r=t.reduce(((e,t)=>e.add((e=>null===e?"null":typeof e)(t))),new Set);return{values:(0,O.uniq)(t),types:r}}function w(e){return String(e).replace(/^(\/)(.*)(\/)$/,"$2")}class _{constructor({base:e,propertyName:t,types:r,values:s}={}){this.values=new Map,this.types=new Map,Object.assign(this,(0,O.cleanObject)({base:e,propertyName:t,types:r?new Map(r):void 0,values:s?new Map(s):void 0}))}add(e,t){return t.forEach((t=>{this.values.set(t,e)})),this.types.set(e,t),this}getType(e){return this.values.get(e)||this.base}getValues(e){return this.types.get(e)}getDefaultValue(e){const t=this.types.get(e);return t?t[0]:void 0}children(){return[...new Set([...this.types.keys()])]}}function N(e){return e instanceof D?e:Object.entries(e).reduce(((e,[t,r])=>(e[w(t)]=I(r),e)),{})}function I(e){return(0,O.isArray)(e)?e.map(I):e.isStore||e.$isJsonDocument||e.isLazyRef?e:(0,O.classOf)(e)!==Object&&(0,O.isClass)(e)?A.from(e).schema:(0,O.isObject)(e)?D.from(e):(0,O.isPrimitiveClass)(e)?D.from({type:e}):e}class D extends Map{#e;#t;#r;#s;#n;#i;#o;#a;#c;#p;constructor(e={}){super(),this.$kind="schema",this.$isJsonDocument=!0,this.$hooks=new T.Hooks,this.$required=new Set,this.$allow=[],this.$forwardGroups=!1,this.$ignore=!1,this.isDiscriminatorKey=!1,this.isDiscriminator=!1,this.#e=!1,this.#t=null,this.#s=[],this.#n=new Map,this.#a=!1,this.#c=!1,this.#p=!1,e&&this.assign(e)}get alias(){return this.#n}get nestedGenerics(){return this.#s}set nestedGenerics(e){this.#s=e}get genericLabels(){return this.#r}set genericLabels(e){this.#r=e}get isClass(){return(0,O.isClass)(this.class)&&![Map,Array,Set,Object,Date,Boolean,Number,String].includes(this.#o)}get isCollection(){return this.#c}get isGeneric(){return this.#a}get discriminatorAncestor(){const e=(0,O.ancestorsOf)(this.#o).find((e=>A.from(e).schema.isDiscriminator));return e&&A.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 this.#p}get isNullable(){return this.#e}get isReadOnly(){return this.get("readOnly")}get isWriteOnly(){return this.get("writeOnly")}get hasDiscriminator(){return!!this.#t}static from(e={}){return new D(e)}nullable(e){this.#e=e}itemSchema(e={}){return this.#i=this.#i||I(e),this.#i.assign(e),this.#i}getAliasOf(e){return this.#n.get(e)}addAlias(e,t){return this.#n.set(e,t),this.#n.set(t,e),this}removeAlias(e){const t=this.#n.get(e);return t&&this.#n.delete(t),this.#n.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 this.#p=!0,super.set("name",e),this}name(e){return super.set("name",e),this}ignore(e){return"boolean"!=typeof e&&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,this.#t=this.#t||new _({base:this.#o})}discriminatorKey(e){return this.discriminator().propertyName=e,this.isDiscriminator=!0,this}discriminatorValue(...e){const t=this.discriminatorAncestor.discriminator();t.add(this.#o,e),this.isDiscriminator=!0;const r=this.get("properties"),s=r[t.propertyName]||new D({type:"string"});return 1===e.length?(s.const(e[0]),s.examples([e[0]])):(s.enum(...e),s.examples(e)),r[t.propertyName]=s,this.set("properties",r),this}additionalItems(e){return super.set("additionalItems",I(e)),this}contains(e){return super.set("contains",I(e)),this}examples(e){return super.set("examples",e),this}example(...e){return this.examples(e)}items(e){return super.set("items",this.#i=I(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((e=>{switch(e){case"":this.set("minLength",void 0);break;case null:this.any(...["null"].concat(this.getJsonType(),this.$allow.map((e=>typeof e))))}})),this.$allow.push(...e),this}required(e=!0){if(!(0,O.isArray)(e)){const t=this.clone();return t.$selfRequired=e,[].concat(t.getJsonType()).includes("string")&&t.minLength(1),t}return this.$required.clear(),e.forEach((e=>this.$required.add(e))),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",N(e)),this}addProperty(e,t){const r=this.get("properties")||{};return r[e]=t,super.set("properties",N(r)),this}patternProperties(e){return super.set("patternProperties",N(e)),this}additionalProperties(e){return super.set("additionalProperties",I(e)),this}unknown(e=!0){return this.additionalProperties(e)}dependencies(e){return super.set("dependencies",N(e)),this}propertyNames(e){return super.set("propertyNames",I(e)),this}enum(e,...t){if(P.has(e))return this.enum(P.get(e));if(e instanceof D)e.getName()?super.set("enum",e):super.set("enum",e.get("enum")).any(...e.get("enum").map((e=>typeof e)));else{const{values:r,types:s}=M([e,t].flat());super.set("enum",r).any(...s)}return this}definitions(e){return super.set("definitions",N(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",I(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",w(e)),this}format(e){return super.set("format",e),this}type(e){switch(e){case"map":case Map:super.set("type",x(e)),this.#o=e,this.#c=!0,this.has("additionalProperties")||super.set("additionalProperties",this.itemSchema({}));break;case"array":case Array:super.set("type",x(e)),this.#o=e,this.#c=!0,this.has("items")||super.set("items",this.itemSchema({}));break;case"set":case Set:super.set("type",x(e)),this.#o=e,this.#c=!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",x(e)),this.#o=e,this.has("properties")||super.set("properties",{});break;default:if((0,O.isClass)(e)||(0,O.isFunction)(e))super.set("type",void 0),this.#o=e,this.has("properties")||super.set("properties",{});else{const t=x(e);"generic"===t?(this.#a=!0,super.set("$ref",e)):super.set("type",t)}}return this}any(...e){return e=e.length?e:["integer","number","string","boolean","array","object","null"],(e=(0,O.uniq)(e).map((e=>(0,O.isClass)(e)?e:{type:x(e)}))).length>1?this.anyOf(e):this.type(e[0]?.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,t){return super.set(`#${e}`,t),this}toObject(e){return this.toJSON(e)}toJSON(e){return d("schema",[this],e)}assign(e={}){return(e instanceof D?[...e.entries()]:Object.entries(e)).forEach((([e,t])=>{this.set(e,t)})),e instanceof D&&(this.$selfRequired=e.$selfRequired,this.$allow.push(...e.$allow),e.$required.forEach((e=>{this.$required.add(e)})),this.#t=this.#t?new _(this.#t):null,this.isDiscriminator=e.isDiscriminator,this.isDiscriminatorKey=e.isDiscriminatorKey,this.#p=e.#p,this.#n=new Map(this.#n.entries()),e.#r&&(this.#r=[...e.#r]),this.#s=e.#s.map((e=>[...e])),this.#o=e.#o,this.#a=e.#a,this.#c=e.#c,this.#p=e.#p,this.#e=e.#e,super.set("type",e.get("type"))),this}set(e,t){return e in this?(0,O.isFunction)(this[e])&&this[e](t):super.set(e,t),this}getComputedType(){return v(this.#o)}getComputedItemType(){return this.#i?this.#i.getComputedType():this.getComputedType()}getJsonType(){return this.get("anyOf")?this.get("anyOf").map((e=>e.getJsonType())):this.get("type")||x(this.getComputedType())}getTarget(){return this.#o}getName(){return this.get("name")||((0,O.isClass)(this.#o)?(0,O.nameOf)((0,O.classOf)(this.getComputedType())):"")}clone(){return new D(this)}setManyOf(e,t){let r=t.filter((e=>"null"!==e?.type||(this.nullable(!0),!1))).map(I);if(!(1!==r.length||t[0]instanceof D||this.isNullable)){if(!r[0].hasDiscriminator)return this.type(t[0]);const e=r[0].discriminator().children();if(!e.length)return this.type(t[0]);r=e.map(I)}super.set(e,r);const s=r[0];if(s.isDiscriminator){const e=s.discriminatorAncestor.discriminator(),{propertyName:t}=e;super.set("discriminator",{propertyName:t,mapping:r.reduce(((t,r)=>(e.types.get(r.getTarget())?.forEach((e=>{t[e]=r})),t)),{})}),this.isDiscriminator=!0,this.#t=e}}}let L=class extends A{constructor(){super(...arguments),this.children=new Map}get path(){return this.store.get("path","/")}set path(e){this.store.set("path",e)}build(){this._type||this.buildType(this.target),this._type=this._type||Object,this._schema=D.from({type:this.type})}};L=S([E(O.DecoratorTypes.CLASS)],L);const k=e=>Number(e)&&200<=Number(e)&&Number(e)<300,j=e=>Number(e)&&300<=Number(e)&&Number(e)<400;class H extends Map{constructor(e={}){super(),this.$kind="map",this.$isJsonDocument=!0,this.assign(e)}assign(e={}){return Object.entries(e).forEach((([e,t])=>{(0,O.isFunction)(this[e])?this[e](t):this.set(e,t)})),this}toJSON(e){return d("map",[this],e)}}function G(e){return Object.keys(e).reduce(((t,r)=>{const s=e[r];let n=typeof s,i={example:s};return"object"===n&&(i=s,i.example=void 0===i.value?i.example:i.value,delete i.value,n=typeof i.example),i.type=i.type||n,t[r]=(0,O.cleanObject)(i),t}),{})}function q(e,t=H){return Object.entries(e).reduce(((e,[r,s])=>(e.set(r,new t(s)),e)),new H)}class B extends H{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 U extends H{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",G(e)),this}content(e){return this.set("content",q(e,B)),this}getContent(){return this.get("content")}getMedia(e,t=!0){return t&&this.addMedia(e),this.getContent()?.get(e)}addMedia(e){const t=this.get("content");return t.has(e)||t.set(e,new B),this}isBinary(){return this.getContent().has("application/octet-stream")}}class K extends H{constructor(e,t){super(),this.method=e,this.path=t}summary(e){return super.set("summary",e),this}description(e){return super.set("description",e),this}}class J extends H{#u;#h;constructor(e={}){super({parameters:[],responses:new H,...e}),this.$kind="operation",this.operationPaths=new Map,this.#h=!1}get response(){return this.getResponses().get(this.getStatus().toString())}get status(){return this.#u}tags(e){return super.set("tags",e),this}addTags(e){return e=(0,O.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 this.#u=e,this}getStatus(){return this.#u||200}setRedirection(e=302){return this.#h=!0,this.#u=e,this}isRedirection(e){return this.#h&&e?j(e):this.#h}addResponse(e,t){if((k(e)||j(e))&&!this.#u){const t=this.getResponseOf(200);this.getResponses().set(e.toString(),t).delete("200"),this.defaultStatus(Number(e))}const r="default"===e?this.getStatus().toString():e.toString(),s=this.getResponses().get(r);return s?(t.forEach(((e,t)=>{["content"].includes(t)||s.set(t,(0,O.deepMerge)(s.get(t),e))})),s.status=Number(r)):(t.status=Number(r),this.getResponses().set(r,t)),this}getResponses(){return this.get("responses")}getResponseOf(e){return("default"===e?this.response:this.getResponses().get(String(e)))||new U}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,t){const r=this.get("security")||{};return r[e]=(0,O.uniq)([...r[e]||[],...t]),this.security(r)}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,t){-1===e&&(e=this.get("parameters").length),this.get("parameters")[e]=t}consumes(e){return super.set("consumes",e),this}produces(e){return super.set("produces",e),this}addProduce(e){const t=(0,O.uniq)([].concat(this.get("produces"),e)).filter(Boolean);this.set("produces",t)}addOperationPath(e,t){const r=new K(e,t);return this.operationPaths.set(String(e)+String(t),r),r}getAllowedOperationPath(e){return e?[...this.operationPaths.values()].filter((({method:t})=>t&&e.includes(t.toUpperCase()))):[...this.operationPaths.values()]}}let F=class extends A{constructor(e){super({store:O.Store.fromMethod(e.target,e.propertyKey),descriptor:(0,O.descriptorOf)(e.target,e.propertyKey),...e}),this.parent=A.from(this.target),this.middlewares=[],this.beforeMiddlewares=[],this.afterMiddlewares=[],this.operation=new J,this.children=new Map;const{beforeMiddlewares:t=[],middlewares:r=[],afterMiddlewares:s=[]}=e;this.after(s),this.before(t),this.use(r)}get params(){return this.parameters}get view(){return this.store.get("view")}set view(e){this.store.set("view",e)}get acceptMimes(){return this.store.get("acceptMimes",[])}set acceptMimes(e){this.store.set("acceptMimes",e)}get parameters(){return[...this.children.values()]}get operationPaths(){return this.operation.operationPaths}static get(e,t,r){return r=r||(0,O.descriptorOf)((0,O.prototypeOf)(e),t),A.from((0,O.prototypeOf)(e),t,r)}getResponseOptions(e,{contentType:t="application/json",includes:r}={}){const s=this.operation.getResponseOf(e).getMedia(t,!1);if(s&&s.has("schema")){const e=s.get("schema");let t=s.groups;return r&&s.allowedGroups?.size&&(t=[...t||[],...r.filter((e=>s.allowedGroups.has(e)))]),{type:e.getComputedItemType(),groups:t}}return{type:this.type}}before(e){return this.beforeMiddlewares=this.beforeMiddlewares.concat(e).filter(O.isFunction),this}after(e){return this.afterMiddlewares=this.afterMiddlewares.concat(e).filter(O.isFunction),this}use(e){return this.middlewares=this.middlewares.concat(e).filter(O.isFunction),this}get(e){const t=O.Store.from(this.target).get(e);return(0,O.deepMerge)(t,this.store.get(e))}getParamTypes(){return[...this.children.values()].reduce(((e,t)=>({...e,[t.paramType]:!0})),{})}build(){if(!this._type){let e=O.Metadata.getReturnType(this.target,this.propertyKey);e=(0,O.isPromise)(e)?void 0:e,this.buildType(e)}this._type=this._type||Object,this.parent.children.set(this.propertyName,this),(0,O.isCollection)(this._type)&&(this.collectionType=this._type,delete this._type),this._schema=D.from({type:this.collectionType||this.type}),this.collectionType&&this._schema.itemSchema(this.type),this.parent.schema.addProperty(this.propertyName,this.schema)}};F=S([E(O.DecoratorTypes.METHOD),b("design:paramtypes",[Object])],F);const V=F;var W;function X(e){return String(e).toLowerCase().replace("raw_","").replace("cookies","cookie")}function z(e){return Object.values(W).includes(X(e))}!function(e){e.BODY="body",e.PATH="path",e.QUERY="query",e.HEADER="header",e.COOKIES="cookie",e.FILES="files"}(W||(W={}));class Y extends H{constructor(){super(...arguments),this.$kind="operationInParameter",this.nestedGenerics=[],this.$schema=new D}getName(){const e=this.get("name");return"files"===this.get("in")?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,t=""){return this.set("in",X(e)),this.expression=t,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 d("operationInParameter",[this],e)}}let Q=class extends A{constructor(e){super(e),this.parameter=new Y,this.parent=A.fromMethod(this.target,this.propertyKey),this.pipes=e.pipes||[],this.paramType=e.paramType||this.paramType,this.expression=e.expression||this.expression,this.dataPath=e.dataPath||this.dataPath}get nestedGenerics(){return this.parameter.nestedGenerics}set nestedGenerics(e){this.parameter.nestedGenerics=e}get required(){return!!this.parameter.get("required")}set required(e){this.parameter.required(e)}get allowedRequiredValues(){return this.schema.$allow}get schema(){return this.parameter.$schema}static getParams(e,t){const r=[],s=(0,O.ancestorsOf)(e).reverse().find((e=>(0,O.isMethodDescriptor)(e,t)&&A.fromMethod(e,t).children.size));return s?(A.fromMethod(s,t).children.forEach(((e,t)=>{r[+t]=e})),r):[]}static get(e,t,r){return A.from((0,O.prototypeOf)(e),t,r)}isRequired(e){return this.required&&[void 0,null,""].includes(e)&&!this.allowedRequiredValues.includes(e)}build(){if(!this._type){const e=O.Metadata.getParamTypes((0,O.prototypeOf)(this.target),this.propertyKey)[this.index];this.buildType(e)}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),(0,O.isClass)(this._type)?this.parameter.itemSchema(A.from(this._type).schema):this.parameter.itemSchema().type(this._type)}};Q=S([E(O.DecoratorTypes.PARAM),b("design:paramtypes",[Object])],Q);const Z=Q;let ee=class extends A{constructor(){super(...arguments),this.parent=A.from(this.target)}get required(){return this.parent.schema.isRequired(this.propertyKey)}set required(e){e?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(e){return this.required&&[void 0,null,""].includes(e)&&!this.allowedRequiredValues.includes(e)}build(){this._type||this.buildType(O.Metadata.getType((0,O.prototypeOf)(this.target),this.propertyKey)),this._type=this._type||Object;let e=this.parent.schema.get("properties")[this.propertyName];e||(this.parent.children.set(this.propertyName,this),e=D.from({type:this.collectionType||this.type}),this.collectionType&&e.itemSchema(this.type)),this.parent.schema.addProperty(this.propertyName,e),this._schema=e}static get(e,t){return A.from((0,O.prototypeOf)(e),t)}};ee=S([E(O.DecoratorTypes.PROP)],ee);const te=ee;function re(...e){return A.from(...e)}R.set(O.DecoratorTypes.CLASS,L),R.set(O.DecoratorTypes.PROP,ee),R.set(O.DecoratorTypes.PARAM,Q),R.set(O.DecoratorTypes.METHOD,F);class se extends Map{constructor(){super(...arguments),this.$kind="operationPaths",this.$isJsonDocument=!0,this.getKey=(e,t)=>`${e}-${t}`}setOperationPath(e){const t=this.getKey(e.method,e.path);this.set(t,e)}}function ne(e){const t=e.isStore?e:re(e);return t.$inherited||(t.$inherited=(0,O.ancestorsOf)(t.target).reverse().reduce(((e,t)=>e.set(t,re(t))),new Map)),t.$inherited}function ie(e){const t=e.isStore?e:re(e);if(!t.$operations){const e=new se;t.$operations=new Map,ne(t).forEach((e=>{e.children.forEach((e=>{e instanceof F&&!t.$operations.has(e.propertyKey)&&t.$operations.set(e.propertyKey,e)}))})),t.$operations.forEach((t=>{t.operation.operationPaths.forEach((t=>{e.setOperationPath(t)}))})),e.clear()}return t.$operations}function oe(e){return!e.store.get("hidden")}const ae=[a.PUBLISH,a.SUBSCRIBE];function ce(e,{channels:t,rootPath:r,...s}){const n=y(r+re(e).path);return s={...s,ctrlRootPath:n},[...ie(e).values()].filter(oe).flatMap((e=>{const t=e.operation.getAllowedOperationPath(ae);return 0===t.length?[]:t.map((t=>({operationPath:t,operationStore:e})))})).reduce(function(e){return(t,{operationPath:r,operationStore:s})=>{const n=e.ctrlRootPath||"/",i=r.method.toLowerCase(),o=(0,c.camelCase)(`${i.toLowerCase()} ${s.parent.schema.getName()}`),a=d("message",[s,r],e);return{...t,[n]:{...t[n],[i]:{...t[n]?.[i],operationId:o,message:{oneOf:[...t[n]?.[i]?.message?.oneOf||[],a]}}}}}}(s),t)}var pe;function ue(e,t){return t.length?1===t.length?t[0]:{[e]:t}:null}function he(e,t,{tags:r=[],defaultTags:s=[],...n}={}){const{path:i,method:o}=t,c=String(i);let p=(0,O.getValue)(n.components,"messages."+i,(0,O.cleanObject)({description:e.operation.get("description"),summary:e.operation.get("summary")}));if(o.toUpperCase()===a.PUBLISH){const r=d("payload",[e,t],n);r&&(p.payload=r);const s=e.operation.getAllowedOperationPath([a.SUBSCRIBE]).map((t=>d("message",[e,t],n))).filter(Boolean),i=ue("oneOf",s);i&&(p["x-response"]=i)}else{const r=d("response",[e,t],n);r&&(p["x-response"]=r)}return n.components.messages=n.components.messages||{},n.components.messages[c]=p,{$ref:`#/components/messages/${c}`}}function le(e,t){return e.reduce(((e,r,s)=>e.set(r,t[s])),new Map)}function me(e){if(e.genericLabels&&e.genericTypes){const{genericLabels:t,genericTypes:r,...s}=e;return{...s,generics:le(t,r)}}return e}function de(e){const[t,...r]=e.nestedGenerics;return{genericTypes:t,nestedGenerics:r}}function fe(e,t,r){const s=e.operation.get("parameters").filter((e=>z(e.get("in")))),n=(0,c.pascalCase)([t.path,t.method,"Payload"].join(" "));(0,O.setValue)(r,`components.schemas.${n}`,{});const i=s.map((e=>{const t=function(e,t={}){return{...t,groups:e.groups,groupsName:e.groupsName}}(e,r),s=d("item",[e.$schema],{...t,...de(e)});switch(e.get("in")){case W.BODY:return s;case W.QUERY:case W.PATH:case W.HEADER:return{type:"object",properties:{[e.get("name")]:s}}}return s}),{}).filter(Boolean);return ue("allOf",i)}function ge(e,t,r){const s=e.operation.getResponses(),n=[],i=[],o=[],a=[];[...s.entries()].forEach((([e,t])=>{const s=d("map",[t],r);if(n.push(+e),i.push(s.description),204!=+e){const{content:e}=s,t=e[Object.keys(e)[0]];o.push(t)}}));const p=(0,c.pascalCase)([t.path,t.method,"Response"].join(" ")),u={type:"object",properties:{status:{type:"number",enum:n},statusText:{type:"string",enum:i}},required:["status"]},h=ue("oneOf",o);h&&(0,O.setValue)(u,"properties.data",h);const l=ue("oneOf",a);return a.length&&(0,O.setValue)(u,"properties.error",l),(0,O.setValue)(r,`components.schemas.${p}`,u),{$ref:`#/components/schemas/${p}`}}l("channels",ce),function(e){e.JSON="jsonschema",e.SWAGGER="swagger2",e.OPENAPI="openapi3",e.ASYNCAPI="asyncapi2"}(pe||(pe={})),l("generate",(function(e,t){const r={channels:d("channels",[e],t)};return r.tags=(0,O.uniqBy)(t.tags,"name"),t.components?.schemas&&Object.keys(t.components.schemas).length&&(r.components={...t.components,schemas:t.components.schemas}),r}),pe.ASYNCAPI),l("message",he,pe.ASYNCAPI),l("payload",fe,pe.ASYNCAPI),l("response",ge,pe.ASYNCAPI);class ye{constructor(e){this.getType=e,this.isLazyRef=!0}get target(){return this.getType()}get schema(){return re(this.getType()).schema}get name(){return(0,O.nameOf)(this.getType())}}function Oe(e,t){return t.groups&&t.groups.length?(0,c.pascalCase)(`${e} ${t.groupsName||t.groups.join(" ")}`):e}function Se(e,t,r){const s=function(e){const{host:t="#/"+([pe.OPENAPI,pe.ASYNCAPI].includes(e.specType)?"components/schemas":"definitions")}=e;return t}(r),n={$ref:`${s}/${e}`},i=t.isReadOnly,o=t.isWriteOnly;return(0,O.cleanObject)({readOnly:!!i||void 0,writeOnly:!!o||void 0,...i||o?{anyOf:[n]}:n})}function be(e,t,r){const s=Oe(e.getName(),r);return t&&(0,O.setValue)(r,`components.schemas.${s}`,t),Se(s,e,r)}function Re(e,t={}){if("object"!=typeof e||null===e)return e;if(e instanceof ye)return d("lazyRef",[e],t);if(e instanceof D&&e.get("enum")instanceof D){const r=e.get("enum");return be(r,r.toJSON(t),t)}if(e.$kind&&e.$isJsonDocument){const r=d(g([e.$kind,"map"],t),[e],me(t));return e.canRef?be(e,r,t):r}return d("object",[e],t)}function Ae(e,t){const r=A.from(e.class),s=Oe(r.schema.getName()||e.getName(),t);if(e.hasGenerics){const{type:s,properties:n,additionalProperties:i,items:o,...a}=e.toJSON(t),c={...d("any",[r.schema],{...t,...de(e),root:!1}),...a};if(c.title){const r=Oe(c.title,t);return(0,O.setValue)(t.components,`schemas.${r}`,c),delete c.title,Se(r,e,t)}return c}return(0,O.getValue)(t,`components.schemas.${s}`)||((0,O.setValue)(t,`components.schemas.${s}`,{}),t.components.schemas[s]=d("any",[r.schema],me({...t,root:!1}))),Se(s,e,t)}function Ee(e,t,r){if(e.discriminator?.mapping){const t=Object.entries(e.discriminator.mapping),s={};for(const[e,n]of t)s[e]=(0,O.isString)(n)?n:be(n,null,r).$ref;e.discriminator.mapping=s}return e}function Te(e,t,r){return r.inlineEnums&&e.enum?.$isJsonDocument&&(e.enum=e.enum.toJSON().enum),e.enum&&(e.type="object"===e.type||void 0===e.type?"string":e.type),e}function Pe(e,t){const{generics:r}=t;if(r&&e.$ref&&r.has(e.$ref)){let s=r.get(e.$ref);if((0,O.isPrimitiveClass)(s))return{type:x(s)};if(s===Date)return{type:"string",format:"date-time"};if(s.toJSON)return s.toJSON({...t,generics:void 0});if(s===Object)return{type:"object"};if((0,O.isClass)(s)){const e={class:s};return 0===t.nestedGenerics.length?d("class",[e],{...t,generics:void 0}):d("schema",[A.from(e.class).schema],{...t,...de(t),root:!1})}}return e}function ve(e,t){if(t?.type&&t?.$ref){const{$ref:e,...r}=t;t={allOf:[{$ref:e},r]}}return t}function Ce(e,{target:t,...r}){const s=Array.from(ne(t).entries()).filter((([e])=>(0,O.classOf)(e)!==(0,O.classOf)(t)));if(s.length){const t=s.reduce(((e,[,t])=>(0,O.deepMerge)(e,d("schema",[t.schema],r),{alter:ve})),{});return(0,O.deepMerge)(t,e,{alter:ve})}return e}function xe(e,t){return e&&e.isClass?d("class",[e],t):d("any",[e],t)}function $e(e,t){const r=e.name;if(t.$refs?.find((t=>t===e.target)))return Se(r,e.schema,t);t.$refs=[...t.$refs||[],e.target];const s=e.getType()&&d("schema",[e.schema],me(t));return be(e.schema,s,t)}function Me(e,{ignore:t=[],...r}={}){return r=me(r),Array.from(e.entries()).reduce(((e,[s,n])=>(t.includes(s)||(e[s]=d("item",[n],r)),e)),{})}l("any",Re),l("class",Ae),l("discriminatorMapping",(function(e){return e.discriminator?.mapping&&delete e.discriminator.mapping,e})),l("enums",Te),l("generics",Pe),l("inheritedClass",Ce),l("item",xe),l("lazyRef",$e),l("map",Me);const we=["oneOf","allOf","anyOf"],_e=["minLength","maxLength","pattern","format"],Ne=[],Ie=["minimum","maximum","exclusiveMinimum","exclusiveMaximum","multipleOf"],De=["maxItems","minItems","uniqueItems","items","contains","maxContains","minContains"],Le=["maxItems","minItems","uniqueItems","items","contains","maxContains","minContains","patternProperties","dependencies"],ke=["const","enum"];function je(e,t){return t?.isNullable?(e.discriminator||(e.$ref?e=(0,O.cleanObject)({...e,$ref:void 0,anyOf:[{type:"null"},{$ref:e.$ref}]}):we.some((t=>{if(e[t])if(e[t]=e[t].filter((e=>"null"!==e.type)),1===e[t].length){const r=e[t];e=(0,O.cleanObject)({...e,...r[0],[t]:void 0,type:["null",Number.isInteger(e.multipleOf)?"integer":r[0].type]})}else e[t]=[{type:"null"}].concat(e[t]).map((e=>(Number.isInteger(e.multipleOf)&&(e.type="integer"),e))),delete e.type}))),e):e}function He(e,t){if((0,O.isBoolean)(e.$ignore)&&e.$ignore)return!0;let r=e?.$hooks?.alter("ignore",!1,[t]);return r||(!1!==t.groups?e?.$hooks?.alter("groups",!1,[t.groups]):r)}function Ge(e,t){const{specType:r,operationIdFormatter:s,root:n,components:i,genericTypes:o,nestedGenerics:a,useAlias:c,genericLabels:p,...u}=t;return Object.entries(e).reduce(((r,[s,n])=>{if(!1!==t.withIgnoredProps&&!He(n,u)){const i={...t,groups:e?.$forwardGroups||n?.$forwardGroups?t.groups:void 0};r[s]=d("item",[n],i),r[s]=d("nullable",[r[s],n],i)}return r}),(0,O.isArray)(e)?[]:{})}function qe(e,t,r){return e.map((e=>d("item",[e],{...t,genericLabels:r.genericLabels})))}function Be(e,t,r){return e.isClass?d("class",[e],t):d("any",[e],{...t,genericLabels:r.genericLabels})}function Ue(e,t,r){return!1!==r.groups?t?.$hooks?.alter("requiredGroups",e,[r.groups]):e}function Ke(e,t,r){if(r.groups&&r.groups.includes("partial"))return e.discriminator?{...e,required:[e.discriminator.propertyName]}:e;let s=function(e,t,r){let s=e.required||[];return s=[...s,...t.$required],t.get("properties")&&(s=Object.entries(t.get("properties")).reduce(((e,[t,r])=>r&&void 0!==r.$selfRequired?r.$selfRequired?e.concat(t):e.filter((e=>e===t)):e),s)),Ue((0,O.uniq)(s),t,r)}(e,t,r);return s=(0,O.uniq)(s).reduce(function(e,t,r={}){const{useAlias:s}=r,n=Object.keys(e.properties||{});return(e,r)=>{const i=s&&t.alias.get(r)||r;return n.includes(i)?e.concat(i):e}}(e,t,r),[]),e.discriminator&&s.push(e.discriminator.propertyName),s.length&&(e.required=s),e}function Je(e,t){return Object.entries(e).reduce(((e,[r,s])=>(e[r=t.get(r)||r]=s,e)),{})}l("nullable",je),l("object",Ge),l("anyOf",qe),l("allOf",qe),l("oneOf",qe),l("properties",Be),l("items",Be),l("additionalProperties",Be),l("propertyNames",Be),l("contains",Be),l("dependencies",Be),l("patternProperties",Be),l("additionalItems",Be),l("not",Be),l("definitions",Be),l("required",Ke);const Fe={string:{properties:_e,is:O.isString},number:{properties:Ie,is:O.isNumber},boolean:{properties:Ne,is:O.isBoolean},array:{properties:De,is:()=>!1},object:{properties:Le,is:()=>!1}};function Ve(e,t,r){const s=function(e){return we.find((t=>e[t]))}(e);return s&&(e[s].forEach((t=>{!function(e,t,r){const s=Fe[e];s?.properties.concat(ke).forEach((e=>{void 0!==t[e]&&(ke.includes(e)?r[e]=t[e].filter(s.is):(r[e]=t[e],delete t[e]))}))}(t.type,e,t)})),we.forEach((s=>{e[s]&&!1!==r.groups&&t.$hooks.has(s)&&(e={...e,[s]:t.$hooks.alter(s,e[s],[r.groups])})})),delete e.const,delete e.enum,e.items||e.properties||delete e.type),e}const We=["name","$required","$hooks","_nestedGenerics",pe.OPENAPI,pe.SWAGGER,pe.JSON],Xe=[];function ze(e,t){const{options:r,addDef:s}=function(e){let t=!1;e||(t=!0,e={components:{schemas:{}},inlineEnums:!0});const{useAlias:r=!0,components:s={schemas:{}}}=e;return{addDef:t,options:e={...e,useAlias:r,components:s}}}(t),n=function(e,t){let r=function(e,t){const{useAlias:r}=t;return[...e.keys()].filter((e=>!function(e,{specType:t=pe.JSON,customKeys:r=!1}){return We.includes(e)||e.startsWith("#")&&(!1===r||t!==pe.JSON)||t!==pe.JSON&&Xe.includes(e)}(e,t))).reduce(((s,n)=>{let i=e.get(n);if("type"===(n=n.replace(/^#/,"")))return s[n]=e.getJsonType(),s;if(function(e,t,r){return"examples"===e&&(0,O.isObject)(t)&&[pe.OPENAPI,pe.ASYNCAPI].includes(r.specType)}(n,i,t)&&(n="example",i=Object.values(i)[0]),i&&"object"==typeof i&&f(n)){if(i=d(n,[i],t,e),function(e,t){return"object"==typeof t&&["items","properties","additionalProperties"].includes(e)&&0===Object.keys(t).length}(n,i))return s;(function(e,t,r){return"object"==typeof t&&r&&["properties","additionalProperties"].includes(e)})(n,i,r)&&(i=Je(i,e.alias))}return s[n]=i,s}),{})}(e,t);return e.isClass&&(r=d("inheritedClass",[r],{...t,root:!1,target:e.getComputedType()})),r=d("generics",[r],{...t,root:!1}),e.has(t.specType)&&(r={...r,...e.get(t.specType).toJSON(t)}),(0,O.isFunction)(r.default)&&(r.default=r.default()),r=d("required",[r,e],t),r=d("nullable",[r,e],t),r=Ve(r,e,t),r=d("enums",[r,e],t),r=d("discriminatorMapping",[r,e],t),r}(e,r);return s&&Object.keys((0,O.getValue)(r,"components.schemas",{})).length&&(n.definitions=r.components.schemas),n}function Ye(e,t,r){return(e=Te(e,0,r)).const&&(e.enum=[e.const],delete e.const),e}function Qe(e,t){const r={paths:d("paths",[e],t={...t,specType:pe.OPENAPI})};return r.tags=(0,O.uniqBy)(t.tags,"name"),Object.keys((0,O.getValue)(t,"components.schemas",{})).length&&(r.components={schemas:t.components.schemas}),r}function Ze(e,t){return t?.isNullable?e.$ref?(0,O.cleanObject)({...e,...e.$ref&&{anyOf:[{$ref:e.$ref}],type:void 0},nullable:!0,$ref:void 0}):(0,O.cleanObject)({...e,...1===e.anyOf?.length?{...e.anyOf[0],anyOf:void 0,type:Number.isInteger(e.multipleOf)?"integer":e.anyOf[0]?.type}:{type:e.anyOf?.length>1?void 0:e.type,anyOf:e.anyOf?.map((e=>(Number.isInteger(e.multipleOf)&&(e.type="integer"),e)))},nullable:!0}):e}function et(e,{jsonSchema:t}){const r={type:"string",format:"binary",oneOf:void 0};return"array"===t.type?(t.items=(0,O.cleanObject)({...t.items,...r}),e.schema=t,e):(e.schema=(0,O.cleanObject)({...t,...r}),e)}function tt(e,t){const r=function(e,t={}){return{...t,groups:e.groups,groupsName:e.groupsName}}(e,t),s={...r.components?.schemas||{}},{type:n,schema:i,...o}=d("map",[e],r),a=d("item",[e.$schema],{...r,...de(e)});o.required=o.required||e.get("in")===W.PATH;const p={...r,jsonSchema:a,jsonParameter:e,oldSchemas:s},u=(0,c.camelCase)(`operationIn ${e.get("in")}`);return f(u)?d(u,[o],p):(o.schema=a,o)}function rt(e,t){return e.flatMap((e=>d("operationInParameter",[e],t))).filter(Boolean)}function st(e,t){if(!t)return;let r=!1;const s=Object.entries(t).reduce(((t,[s,{value:n,description:i,...o}])=>void 0===n[e]?t:(r=!0,{...t,[s]:{...o,value:n[e],description:i}})),{});return r?s:void 0}function nt(e,{jsonSchema:t,jsonParameters:r,...s}){if(t.$ref){if(!e.name)return function(e,{jsonParameter:t,...r}){const s=Oe(t.$schema.getName(),r),n=r.components?.schemas?.[s];return n&&!r.oldSchemas?.[s]&&delete r.components.schemas[t.$schema.getName()],Object.entries(n?.properties||{}).reduce(((t,[r,{description:s,...i}])=>[...t,(0,O.cleanObject)({...e,name:r,required:(n?.required||[]).includes(r),description:s,schema:i,style:i.$ref?"deepObject":void 0,examples:st(r,e.examples)})]),[])}(e,s);e.style="deepObject"}return e.schema=t,e}l("schema",ze),l("discriminatorMapping",Ee,pe.OPENAPI),l("discriminatorMapping",Ee,pe.SWAGGER),l("discriminatorMapping",Ee,pe.ASYNCAPI),l("enums",Ye,pe.OPENAPI),l("enums",Ye,pe.SWAGGER),l("enums",Ye,pe.ASYNCAPI),l("generate",Qe,pe.OPENAPI),l("generate",Qe,pe.SWAGGER),l("nullable",Ze,pe.OPENAPI),l("nullable",Ze,pe.SWAGGER),l("operationInFiles",et),l("operationInParameter",tt),l("operationInParameters",rt),l("operationInQuery",nt);var it=i(725),ot=i.n(it);const at=ot().codes.reduce(((e,t)=>{const r=String(ot()(t));return{...e,[String(t)]:{label:r,code:(0,c.constantCase)(r)}}}),{});function ct(e){return at[e]?.code}function pt(e){return at[e]?.label}function ut(e,{tags:t=[],defaultTags:r=[],...s}={}){const{consumes:n,produces:i,...o}=d("map",[e],{...s,ignore:["parameters"]});o.security&&(o.security=[].concat(o.security)),0===e.get("responses").size&&(o.responses={200:{description:pt(200)}});const a={...s,consumes:e.get("consumes")?.length?e.get("consumes"):["application/json"]},[c,p]=function(e){return e.get("parameters").filter((e=>z(e.get("in")))).reduce(((e,t)=>{const[r,s]=e;return[W.BODY,W.FILES].includes(t.get("in"))?[r,[...s,t]]:[[...r,t],s]}),[[],[]])}(e);o.parameters=d("operationInParameters",[c],s),p.length&&(o.requestBody=d("operationRequestBody",[p],a));const u=o.tags?.length?o.tags:r;return u.length&&(o.tags=u.map((({name:e})=>e))),t.push(...u),o}function ht(e,t){return d("map",[e],{...t,groups:[...e.groups||[]],groupsName:e.groupsName})}at[200].label="Success",at[200].code="SUCCESS",l("operation",ut),l("operationMedia",ht);class lt extends H{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",q(e)),this}addContent(e,t,r){const s=this.get("content"),n=new H;return n.set("schema",t),r&&n.set("examples",r),s.set(e,n),this}required(e){return this.set("required",e),this}}function mt(e,{consumes:t,...r}){const{schema:s,description:n,examples:i,in:o,...a}=function(e,t){let r=new D;const s={},n=[];let i=0;const o=e.some((e=>"files"===e.get("in")));return e.forEach((e=>{const a=e.getName();[...e.entries()].filter((([e])=>!["in","name"].includes(e))).forEach((([e,t])=>{void 0===s[e]&&(s[e]=t)}));const c=d("operationInParameter",[e],t);if(a){const t={...c.schema||{type:c.type}};o&&c.description&&(t.description=c.description),r.addProperty(a,t),e.get("required")&&r.addRequired(a),i++}else n.push(c)})),i||1!==n.length?(r.type("object"),s.description&&o&&delete s.description,{schema:r.toJSON(t),required:!1,...s}):n[0]}(e,r),c=new lt(a);return n&&c.description(n),t.forEach((e=>{c.addContent(e,s,i)})),d("map",[c],r)}function dt(e,t={}){const r=d("map",[e],t);return 204===e.status&&delete r.content,r.headers&&Object.entries(r.headers).forEach((([e,{type:t,...s}])=>{r.headers[e]={...s,schema:{type:t}}})),r}function ft(e,t){return e.map((e=>t.parameters.find((t=>t.in===e.in&&t.name===e.name))||e)).concat(...t.parameters.filter((e=>"path"!==e.in)))}function gt(e,t=""){t instanceof RegExp&&(t=t.toString().replace(/^\//g,"").replace(/\/$/g,"").replace(/\\/g,""));const r=[],s=[];let n=!1,i="";return function(e){let t=0;return e.split("").filter((e=>{"("===e&&t++;const r=0===t;return")"===e&&t--,r})).join("").split("/").filter((e=>!!e))}(`${e}${t}`).map((e=>{const t=e.replace(":","").replace("?","");if(e.includes(":")){const o=e.includes("?");o&&!n&&(n=!0,s.push({path:i,parameters:[].concat(r)}));const{prefix:a,name:c,postfix:p}=function(e){const[t,r]=e.split("="),s=(r||t).split(".");return{prefix:r&&t?`${t}=`:"",name:s.splice(0,1)[0],postfix:s.length?`.${s.join(".")}`:""}}(t);i+=`/${a}{${c}}${p}`,r.push({in:"path",name:c,type:"string",required:!0}),o&&n&&s.push({path:i,parameters:[].concat(r)})}else i+=`/${e}`})),s.length?s:[{path:i,parameters:[].concat(r)}]}l("operationRequestBody",mt),l("operationResponse",dt);const yt="%c.%m";function Ot(e=""){const t=new Map;return(r,s,n="")=>{const i=((t,r)=>{const s=(e||yt).replace(/%c/,t).replace(/%m/,r);return""===e?(0,c.camelCase)(s):s})(r,s),o=r+s;if(!t.has(o))return t.set(o,0),i;const a=n.match(/{(\w+)}/gi);if(a){const e=r+s+a[0];if(!t.has(e))return t.set(e,0),(0,c.camelCase)(`${i} By ${a}`)}const p=t.get(o)+1;return t.set(o,p),`${i}_${p}`}}function St(e,{store:t,operationIdFormatter:r}){return r(t.parent.schema.get("name")||t.parent.targetName,t.propertyName,e)}const bt=[a.ALL,a.GET,a.POST,a.PUT,a.PATCH,a.HEAD,a.OPTIONS,a.DELETE,a.TRACE];function Rt(e,{path:t,method:r,operation:s}){return{...e,[t]:{...e[t],[r.toLowerCase()]:s}}}function At(e,{paths:t,rootPath:r,...s}){const n=y(r+re(e).path);return s={...s,ctrlRootPath:n},[...ie(e).values()].filter(oe).filter((e=>e.operation.getAllowedOperationPath(bt).length>0)).flatMap(function(e){return t=>{const r=t.operation.getAllowedOperationPath(bt);if(0===r.length)return[];const s=d("operation",[t.operation],e);return r.map((e=>({operationPath:e,operation:s,operationStore:t})))}}(s)).flatMap(function(e){return({operationPath:t,operation:r,operationStore:s})=>{const{path:n,method:i}=t;return gt(e.ctrlRootPath,n).map((({path:n,parameters:o})=>(n=n||"/",o=ft(o.map((({type:e,...t})=>({...t,schema:{type:e}}))),r),{operation:{...r,...t.toJSON(e),parameters:o,operationId:r.operationId||St(n,{...e,store:s})},method:i,path:n})))}}(s)).reduce(Rt,t)}function Et(e){return(...t)=>{const r=e(re(...t),t);"function"==typeof r&&r(...t)}}function Tt(...e){return Et((t=>{t.store.set("childrenControllers",e),e.forEach((e=>{O.Store.from(e).set("parentController",t.token)}))}))}function Pt(e,...t){return Et((r=>{e=e||(0,c.snakeCase)(r.targetName),r.discriminatorAncestor&&r.schema.discriminatorValue(e,...t)}))}function vt(e,t){if(!e)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 n=(...n)=>{const i=A.from(...n);t&&(i.collectionType=t,i.schema.type(t)),i.type=e,i.itemSchema.type(e),i.schema.assign(r),i.isArray&&s&&(i.schema.set("contains",i.schema.get("items")),i.schema.delete("items"))};return n.MinItems=e=>(r.minItems=e,n),n.MaxItems=e=>(r.maxItems=e,n),n.MinProperties=e=>(r.minProperties=e,n),n.MaxProperties=e=>(r.maxProperties=e,n),n.Contains=()=>(s=!0,n),n.UniqueItems=(e=!0)=>(r.uniqueItems=e,n),n}function Ct(e){return vt(e,Array)}function xt(e){return vt(e,Map)}function $t(e){return vt(e).Contains()}function Mt(e,t){const r={};return(...s)=>{const n=(0,O.useDecorators)(t(...s));return n.Error=t=>(r.message=t,(0,O.useDecorators)(n,r.message&&Et((r=>{const s=r.parentSchema.get("#errorMessage")||{};"required"===e?r.parentSchema.customKey("errorMessage",(0,O.deepMerge)(s,{[e]:{[r.propertyName]:t}})):r.itemSchema.customKey("errorMessage",(0,O.deepMerge)(s,{[e]:t}))})))),n}}l("paths",At);const wt=Mt("maxItems",(e=>{if(e<0)throw new Error("The value of maxItems MUST be a non-negative integer.");return Et((t=>{t.schema.maxItems(e)}))})),_t=Mt("maxProperties",(e=>{if(e<0)throw new Error("The value of maxProperties MUST be a non-negative integer.");return Et((t=>{t.isCollection?t.schema.maxProperties(e):t.itemSchema.maxProperties(e)}))})),Nt=Mt("minItems",(e=>{if(e<0)throw new Error("The value of minItems MUST be a non-negative integer.");return Et((t=>{t.schema.minItems(e)}))})),It=Mt("minProperties",(e=>{if(e<0)throw new Error("The value of minProperties MUST be a non-negative integer.");return Et((t=>{t.isCollection?t.schema.minProperties(e):t.itemSchema.minProperties(e)}))})),Dt=Mt("uniqueItems",((e=!0)=>Et((t=>{t.schema.uniqueItems(e)}))));function Lt(e){return Et(((t,r)=>{t.itemSchema.additionalProperties(e)}))}function kt(...e){return Et((t=>{t.itemSchema.allOf(e)}))}function jt(e){return Et((t=>{e&&(((0,O.isClass)(e)||(0,O.isArrowFn)(e))&&(t.type=e),t.itemSchema.type(e))}))}function Ht(...e){const t=e.find((e=>(0,O.isClass)(e)));return(0,O.useDecorators)(t&&jt(t),Et(((t,r)=>{t.decoratorType===O.DecoratorTypes.PARAM&&(t.required=!0),t.decoratorType===O.DecoratorTypes.PROP&&t.parentSchema.addRequired(t.propertyName),t.schema.allow(...e)})))}function Gt(...e){return Et((t=>{t.itemSchema.any(...e)}))}function qt(...e){return Et((t=>{t.itemSchema.anyOf(e)}))}function Bt(e){return Et((t=>{t.itemSchema.const(e)}))}function Ut(e,t){return Et((r=>{r.itemSchema.customKey(e,t)}))}function Kt(e){return Et((t=>{Object.entries(e).forEach((([e,r])=>{t.itemSchema.customKey(e,r)}))}))}function Jt(e){return Et((t=>{t.itemSchema.default(e)}))}function Ft(e){return Et((t=>{const r=t.parentSchema.get("#errorMessage")||{};t.parentSchema.customKey("errorMessage",{...r,...e})}))}function Vt(e){return(0,O.useDecorators)(Ft({_:e}))}function Wt(e){return Et(((t,r)=>{switch((0,O.decoratorTypeOf)(r)){case O.DecoratorTypes.PROP:case O.DecoratorTypes.CLASS:t.schema.description(e);break;case O.DecoratorTypes.PARAM:t.parameter.description(e);break;case O.DecoratorTypes.METHOD:t.operation?.description(e)}}))}function Xt(){return(0,O.useDecorators)(jt(),Et((e=>{e.discriminatorKey()})))}const zt=Mt("enum",(function(e,...t){return Et((r=>{r.itemSchema.enum(e,...t)}))}));function Yt(...e){return Et((t=>{t.schema.examples(e)}))}function Qt(e){return Et((t=>{t.parameter.examples(e)}))}const Zt=Mt("maximum",((e,t=!1)=>Et((r=>{t?r.itemSchema.exclusiveMaximum(e):r.itemSchema.maximum(e)})))),er=Zt,tr=Mt("exclusiveMaximum",((e,t=!0)=>Zt(e,t))),rr=Mt("minimum",((e,t=!1)=>Et((r=>{t?r.itemSchema.exclusiveMinimum(e):r.itemSchema.minimum(e)})))),sr=rr,nr=Mt("exclusiveMinimum",((e,t=!0)=>rr(e,t)));var ir;!function(e){e.DATE_TIME="date-time",e.DATE="date",e.TIME="time",e.EMAIL="email",e.HOSTNAME="hostname",e.IPV4="ipv4",e.IPV6="ipv6",e.URI="uri",e.URL="url",e.URI_REF="uri-reference",e.URI_TEMPLATE="uri-template",e.JSON_POINTER="json-pointer",e.RELATIVE_JSON_POINTER="relative-json-pointer",e.UUID="uuid",e.REGEX="regex"}(ir||(ir={}));const or=Mt("format",(e=>Et((t=>{t.itemSchema.format(e)})))),ar=Mt("format",(()=>or(ir.EMAIL))),cr=Mt("format",(()=>or(ir.DATE_TIME))),pr=Mt("format",(()=>or(ir.DATE))),ur=Mt("format",(()=>or(ir.TIME))),hr=Mt("format",(()=>or(ir.URI))),lr=Mt("format",(()=>or(ir.URL)));function mr(e=!0){return Et((t=>{t.schema.$forwardGroups=e}))}var dr=i(307),fr=i.n(dr);function gr(e,t){t=[].concat(t),e=[].concat(e);let r=new Set,s=new Set,n=new Set,i=0,o=e=>{n.add(e.output)};for(let n=0;n<t.length;n++){let a=fr()(String(t[n]),{onResult:o},!0),c=a.state.negated||a.state.negatedExtglob;c&&i++;for(let t of e){let e=a(t,!0);(c?!e.isMatch:e.isMatch)&&(c?r.add(e.output):(r.delete(e.output),s.add(e.output)))}}return!!(i===t.length?[...n]:[...s]).filter((e=>!r.has(e))).length}function yr(e,t=[]){const r=e.filter((e=>e.startsWith("!"))).map((e=>e.replace("!",""))),s=e.filter((e=>!e.startsWith("!")));return!!(r.length&&t.length&&gr(r,t))||!!s.length&&!gr(e.filter((e=>!e.startsWith("!"))),t)}function Or(...e){return Et((t=>{switch(t.decoratorType){case O.DecoratorTypes.CLASS:!function(e,t){const r=Object.entries(e[0]);t.children.forEach((e=>{Or(...r.filter((([,t])=>t.includes(e.propertyName))).map((([e])=>e)))(e.target,e.propertyKey)}))}(e,t);break;case O.DecoratorTypes.PROP:Ut("x-groups",e)(t.target,t.propertyKey),t.schema.$hooks.on("groups",((t,r)=>!(t||!yr(e,r))||t));break;case O.DecoratorTypes.PARAM:let r="";2==e.length&&(0,O.isArray)(e[1])&&(r=e[0],e=e[1]),t.parameter.groups=e,t.parameter.groupsName=r}}))}function Sr(){return(0,O.StoreSet)("hidden",!0)}function br(e=!0){return Et((t=>{t.schema.ignore(e)}))}function Rr(){return Et((e=>{e.itemSchema.type("integer")}))}function Ar(e,t=!1){return Et((r=>{t?r.schema.label(e):r.itemSchema.label(e)}))}const Er=Mt("maxLength",(e=>{if(e<0)throw new Error("The value of maxLength MUST be a non-negative integer.");return Et((t=>{t.itemSchema.maxLength(e)}))})),Tr=Mt("minLength",(e=>{if(e<0)throw new Error("The value of minLength MUST be a non-negative integer.");return Et((t=>{t.itemSchema.minLength(e)}))})),Pr=Mt("multipleOf",(e=>{if(e<=0)throw new Error("The value of multipleOf MUST be a number, strictly greater than 0.");return Et((t=>{t.itemSchema.multipleOf(e)}))}));function vr(e){return Et(((t,r)=>{switch((0,O.decoratorTypeOf)(r)){case O.DecoratorTypes.CLASS:t.schema.name(e);break;case O.DecoratorTypes.PARAM:t.parameter.name(e);break;default:t.parent.schema.addAlias(r[1],e)}}))}function Cr(e,...t){return t=[e,...t],(0,O.useDecorators)(1===t.length&&jt(t[0]),Gt(null,...t))}function xr(...e){return Et((t=>{t.itemSchema.oneOf(e)}))}function $r(){return Et((e=>{switch(e.decoratorType){case O.DecoratorTypes.PARAM:e.required=!1;break;case O.DecoratorTypes.PROP:e.parentSchema.removeRequired(e.propertyName)}}))}const Mr=Mt("pattern",(e=>Et((t=>{t.itemSchema.pattern(e)}))));function wr(e=!0){return Et((t=>{t.itemSchema.readOnly(e)}))}function _r(e){return Et((t=>{t.schema.assign(e)}))}function Nr(e,t){return Et((r=>{r.schema.set(e,t)}))}function Ir(e,...t){return _r({properties:{...t.reduce(((t,r)=>({...t,[r]:e})),{})}})}const Dr=Mt("required",((e=!0,...t)=>e?Ht(...t):$r()));function Lr(...e){return Et((t=>{t.parent.schema.$hooks.on("requiredGroups",((r,s)=>yr(e,s)?r.filter((e=>e!==t.propertyKey)):r))}))}function kr(e){return Et((t=>{t.schema.title(e)}))}function jr(e){return Et((()=>(0,O.useDecorators)(Ft({type:e}))))}function Hr(e=!0){return Et((t=>{t.itemSchema.writeOnly(e)}))}function Gr(e=Object){if((0,O.isClass)(e)){const{schema:t}=re(e);return t.properties=function(t){return Object.entries(t).forEach((([t,r])=>{re(e.prototype,t).schema.assign(r)})),this},t}return D.from({type:e})}function qr(){return Gr(String)}function Br(...e){const t=[e.map((e=>function(e){return(0,O.isObject)(e)&&!("toJSON"in e)}(e)?qr().enum(Object.values(e)):e))],r=(...e)=>{A.from(...e).nestedGenerics=t};return r.Nested=(...e)=>(t.push(e),r),r}function Ur(...e){return t=>{A.from(t).schema.genericLabels=e}}function Kr(...e){return Et(((t,r)=>{switch(t.decoratorType){case O.DecoratorTypes.METHOD:t.operation.consumes(e);break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(r[0],Kr(...e));break;default:throw new O.UnsupportedDecoratorType(Kr,r)}}))}function Jr(...e){return(0,O.useDecorators)(Kr(...e),(0,O.StoreSet)("acceptMimes",e))}class Fr extends Map{constructor(e={}){super(),this.actions=[],Object.entries(e).forEach((([e,t])=>{this.set(e,t)}))}addAction(e){return this.actions.push(e),this}build(){const e=(...t)=>this.bind(t,e),t=t=>{return r=(...e)=>{t in this?this[t](...e):this.set(t,e[0])},(...t)=>(r(...t),e);var r};return this.methods.forEach((r=>{e[(0,c.pascalCase)(r)]=t(r)})),e}toObject(){return[...this.entries()].reduce(((e,[t,r])=>({...e,[t]:r})),{})}getMergedKey(e,t){let r=this.get(e)||t;if(r)return this.decoratorType===O.DecoratorTypes.CLASS&&(r={...r,...t||{}}),{...t||{},...r}}bind(e,t){this.entity=A.from(...e),this.beforeInit(),this.onInit(e,t),this.afterInit()}onInit(e,t){this.forEach(((e,t)=>{this.onMapKey(t,e)}))}onMapKey(e,t){this.entity.set(e,t)}runActions(){return this.actions.forEach((e=>{e(this)})),this}beforeInit(){}afterInit(){}}const Vr=new Map;function Wr(e,t){Vr.set(e,t)}function Xr(e){return Vr.get(e)}function zr(e){return e.map((e=>function(e){return(0,O.isObject)(e)&&!("toJSON"in e)}(e)?qr().enum(Object.values(e)):e))}class Yr extends Fr{constructor({status:e,model:t}){super(),this.methods=["contentType","description","examples","type","status","of","ofInteger","oneOf","allOf","anyOf","nested","header","headers","schema","title","groups","allowedGroups","location","binary"],this.model(t),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&&pt(e)&&!this.get("description")&&(this.set("description",pt(e)),this.get("model")||this.model(Xr(+e))),this}headers(e){return this.set("headers",{...this.get("headers")||{},...G(e)}),this}header(e,t){return void 0===t&&(0,O.isString)(e)?this.headers({[e]:{type:"string"}}):this.headers({[e]:t})}location(e,t={}){return this.headers({Location:{...t,value:e}}),this}groups(...e){return 2===e.length&&(0,O.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 t=this.get("model");return this.checkPrimitive(t),this.checkCollection(t),this.addAction((t=>{this.get("schema").nestedGenerics.push(zr(e))})),this}of(...e){const t=this.get("model");return this.checkPrimitive(t),this.addAction((()=>{const r=this.get("schema");(0,O.isCollection)(t)?r?.itemSchema({type:e[0]}):r?.nestedGenerics.push(zr(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",(0,O.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((0,O.isPrimitiveOrPrimitiveClass)(e))throw new Error("Returns.Of cannot be used with the following primitive classes: String, Number, Boolean")}checkCollection(e){if((0,O.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 t=this.get("contentType");return(e&&!(0,O.isPlainObject)(e)&&!(0,O.isPrimitiveOrPrimitiveClass)(e)||this.hasOfTypes)&&(t=t||"application/json"),t}getStatus(){return this.get("status")||"default"}onInit(e,t){switch((0,O.decoratorTypeOf)(e)){case O.DecoratorTypes.METHOD:this.entity=A.from(...e),this.entity.operation&&this.map();break;case O.DecoratorTypes.CLASS:this.decoratorType=O.DecoratorTypes.CLASS,(0,O.decorateMethodsOf)(e[0],t)}}map(){const e=this.get("model"),{entity:t,decoratorType:r}=this,s=this.entity.operation,n=this.getStatus(),i=s.ensureResponseOf(n),o=this.getContentType();let{description:a=i.get("description")}=this.toObject();a&&(a=r===O.DecoratorTypes.CLASS&&i.get("description")||a,i.description(a));const c=this.getMergedKey("headers",i.get("headers"));return c&&i.headers(c),this.mapMedia(i),(k(this.get("status"))||"default"===n)&&e&&(t.type=e),o&&s.addProduce(o),this.runActions()}mapMedia(e){const t=this.getContentType(),r=this.get("model"),s=e.getMedia(t||"*/*"),n=s.get("schema")||new D({type:r}),i=this.get("groups"),o=this.get("groupsName"),a=this.get("allowedGroups"),c=this.entity.operation;if(r&&((0,O.isArray)(r)?n.oneOf(r.map((e=>({type:e})))):n.type(r)),this.set("schema",n),s.schema(n),s.groups=i,s.groupsName=o,a){s.allowedGroups=a;const e=new Y;e.in("query").name("includes"),e.schema(D.from({type:"array",items:{type:"string",enum:[...a]}})),c.addParameter(-1,e)}const p=this.get("examples");return p&&s.examples(p),s}manyOf(e,t){const r=this.get("model");return this.hasOfTypes=!0,this.addAction((()=>{const s=this.get("schema");(0,O.isCollection)(r)?(s.type(r||Object),s.itemSchema().set(e,t)):s.set(e,t)})),this}}function Qr(e,t){return new Yr({status:e,model:t}).build()}function Zr(e){return Qr().ContentType(e)}function es(e=!0){return Et(((t,r)=>{switch((0,O.decoratorTypeOf)(r)){case O.DecoratorTypes.METHOD:t.operation.deprecated(e);break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(r[0],es(e));break;case O.DecoratorTypes.PARAM:t.parameter.set("deprecated",e);break;case O.DecoratorTypes.PROP:t.schema.set("deprecated",e);break;default:throw new O.UnsupportedDecoratorType(es,r)}}))}function ts(e,t){return void 0!==t&&(e={[e]:t}),void 0===t&&(0,O.isString)(e)&&(e={[e]:{type:"string"}}),Qr().Headers(e)}function rs(e){const t=new Y,r={},s=(n,i,o)=>{const a=A.from(n,i,o);switch(a.decoratorType){case O.DecoratorTypes.PARAM:a.parameter.in(e);break;case O.DecoratorTypes.METHOD:t.in(e),a.operation.addParameter(-1,t),t.schema(D.from(r));break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(n,s);break;default:throw new O.UnsupportedDecoratorType(rs,[n,i,o])}};return s.Type=e=>(r.type=e,s),s.Name=e=>(t.name(e),s),s.Description=e=>(t.description(e),s),s.Required=(e=!0)=>(t.required(e),s),s.Pattern=e=>s.Schema({pattern:e.toString()}),s.Schema=e=>(Object.assign(r,e.toJSON?e.toJSON():e),s),s}function ss(e){return(...t)=>{const[r,s,n]=t,i=O.Metadata.getParamTypes(r,s)[n]===Array,o=[e="object"==typeof e?void 0:e,!i&&"0"].filter(Boolean).join(".");(0,O.useDecorators)(rs(W.FILES),vr(o),(0,O.useMethodDecorators)(Qr(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"),Kr("multipart/form-data")))(...t)}}function ns(e,t){return Qr().Location(e,t)}const is=new Set([...Object.keys(a).filter((e=>e!==a.CUSTOM)).map((e=>e.toLowerCase()))]);function os(e){let t,r;const s=e.filter((e=>"string"==typeof e&&is.has(e.toLowerCase())?(t=e.toLocaleUpperCase(),!1):"string"==typeof e||e instanceof RegExp?(r=e||"/",!1):!!e));return{path:r,method:t,use:s}}class as extends Fr{constructor(){super(...arguments),this.methods=["name","description","summary","method","id","use","useAfter","useBefore"]}beforeInit(){const e=this.get("path"),t=a[this.get("method")]||a.CUSTOM;e&&(this.operationPath=this.entity.operation.addOperationPath(t,e))}onMapKey(e,t){switch(e){case"name":case"id":return void this.entity.operation.operationId(t);case"summary":return this.operationPath?.summary(t),void this.entity.operation.summary(t);case"description":return this.operationPath?.description(t),void this.entity.operation.description(t);case"use":return void this.entity.use(t);case"useAfter":return void this.entity.after(t);case"useBefore":return void this.entity.before(t)}return super.onMapKey(e,t)}}function cs(...e){const t=os(e);return new as(t).build()}function ps(e){return Et(((t,r)=>{if(t.decoratorType!==O.DecoratorTypes.METHOD)throw new O.UnsupportedDecoratorType(ps,r);t.operation.operationId(e)}))}function us(e,t="/"){return Et(((r,s)=>{if(r.decoratorType!==O.DecoratorTypes.METHOD)throw new O.UnsupportedDecoratorType(us,s);r.operation.addOperationPath(e.toUpperCase(),t)}))}function hs(){return Or("partial")}function ls(e){return Et(((t,r)=>{if(t.decoratorType!==O.DecoratorTypes.CLASS)throw new O.UnsupportedDecoratorType(ls,r);t.path=e}))}function ms(...e){return Et(((t,r)=>{switch(t.decoratorType){case O.DecoratorTypes.METHOD:t.operation.produces(e);break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(r[0],ms(...e));break;default:throw new O.UnsupportedDecoratorType(ms,r)}}))}function ds(e){return cs(a.PUBLISH,e)}function fs(...e){const{status:t,url:r,meta:s}=e.reduce(((e,t)=>(0,O.isNumber)(t)?(e.status=t,e):(0,O.isString)(t)?(e.url=t,e):(e.meta=t,e)),{status:302,url:"",meta:{}});return(0,O.useDecorators)(Qr(t).Location(r,s),Et((e=>{e.operation?.setRedirection(t)})))}function gs(e="/",...t){return cs(...[a.ALL,e].concat(t))}function ys(e="/",...t){return cs(...[a.GET,e].concat(t))}function Os(e="/",...t){return cs(...[a.POST,e].concat(t))}function Ss(e="/",...t){return cs(...[a.PUT,e].concat(t))}function bs(e="/",...t){return cs(...[a.DELETE,e].concat(t))}function Rs(e="/",...t){return cs(...[a.HEAD,e].concat(t))}function As(e="/",...t){return cs(...[a.PATCH,e].concat(t))}function Es(e="/",...t){return cs(...[a.OPTIONS,e].concat(t))}function Ts(e,...t){return Et(((r,s)=>{switch(r.decoratorType){case O.DecoratorTypes.METHOD:Array.isArray(e)?r.operation.security(e):r.operation.addSecurityScopes(e,t);break;case O.DecoratorTypes.CLASS:Array.isArray(e)?(0,O.decorateMethodsOf)(s[0],Ts(e)):(0,O.decorateMethodsOf)(s[0],Ts(e,...t));break;default:throw new O.UnsupportedDecoratorType(Ts,s)}}))}function Ps(e,t){return Qr(e,t)}function vs(e){return cs(a.SUBSCRIBE,e)}function Cs(e){return Et(((t,r)=>{if(t.decoratorType!==O.DecoratorTypes.METHOD)throw new O.UnsupportedDecoratorType(Cs,r);t.operation.summary(e)}))}function xs(...e){return Et(((t,r)=>{switch(t.decoratorType){case O.DecoratorTypes.METHOD:t.operation.addTags(function(e){return e.map((e=>"string"==typeof e?{name:e}:e))}(e));break;case O.DecoratorTypes.CLASS:(0,O.decorateMethodsOf)(r[0],xs(...e));break;default:throw new O.UnsupportedDecoratorType(xs,r)}}))}function $s(e,t){return(0,O.StoreSet)("view",{path:e,options:t})}function Ms(e,t){if(e instanceof RegExp||t instanceof RegExp){if(!e)return t;if(!t)return e;const r=e instanceof RegExp?e:new RegExp(e,"gi"),s=t instanceof RegExp?t:new RegExp(t,"gi");return new RegExp(r.source+s.source,(r.global?"g":"")+(r.ignoreCase?"i":"")+(r.multiline?"m":""))}e&&t&&e.endsWith("/")&&t.startsWith("/")&&(t=t.slice(1));const r=(e||"")+(t||"");return r.endsWith("/")&&r.length>1?r.slice(0,-1):r}class ws{constructor(e){Object.assign(this,e),this.paramsTypes=this.endpoint.getParamTypes()}get url(){return this.fullPath}get path(){return this.operationPath?.path}get fullPath(){return Ms(this.basePath,this.path)}get method(){return this.operationPath?.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 _s(...e){return Gr().allOf(e)}function Ns(...e){return Gr().any(...e)}function Is(...e){return Gr().anyOf(e)}function Ds(){return Gr(Boolean)}function Ls(){return Gr(Array)}function ks(){return Gr(Map).unknown(!0)}function js(){return Gr(Array).uniqueItems(!0)}function Hs(){return Gr(Date).format(ir.DATE)}function Gs(){return Gr(Date).format(ir.DATE_TIME)}function qs(){return Gr(Date).format(ir.TIME)}function Bs(){return Gr(String).format(ir.EMAIL)}function Us(e){const t=qr().enum(e);return P.set(e,t),t}function Ks(){return Gr(Number).integer()}function Js(e){try{if(e())return A.from(e()).schema}catch(e){}return new ye(e)}function Fs(){return Gr(Number)}function Vs(e={}){return Gr(Object).properties(e)}function Ws(...e){return Gr().oneOf(e)}function Xs(){return Gr(String).format(ir.URI)}function zs(){return Gr(String).format(ir.URL)}const Ys=(0,O.mergeReducerBuilder)(((e,t)=>e.type&&e.type&&e.type===t.type&&"array"===t.type?JSON.stringify(e.items)===JSON.stringify(t.items):e.type&&e.type===t.type||e.$ref&&e.$ref===t.$ref)),Qs=(0,O.mergeReducerBuilder)(((e,t)=>e.in===t.in&&e.name===t.name)),Zs=(0,O.mergeReducerBuilder)(((e,t)=>!!Object.keys(t).find((t=>!!e[t])))),en=(0,O.mergeReducerBuilder)(((e,t)=>e.name===t.name)),tn={security:Zs,parameters:Qs,oneOf:Ys,anyOf:Ys,allOf:Ys,tags:en};function rn(e,t){return(0,O.deepMerge)(e,t,{reducers:tn,cleanUndefinedProps:!0})}const sn=new Map;function nn(e,t={}){if(t={specType:pe.OPENAPI,...t,tags:[],paths:{},channels:{},components:{},operationIdFormatter:t.operationIdFormatter||Ot(t.operationIdPattern),root:!1},(0,O.isArray)(e)){let r={};return t={...t,append(e){r=rn(r,e)}},e.forEach((({token:e,...r})=>{const s=nn(e,{...t,...r});t.append(s)})),r}return function(e,t,r){sn.has(e)||sn.set(e,new Map);const s=sn.get(e),n=JSON.stringify(t);return s.has(n)||s.set(n,r()),s.get(n)}(e,t,(()=>function(e,t){const r=re(e),{rootPath:s="/"}=t;return t={...t,rootPath:s,defaultTags:[(0,O.cleanObject)({name:r.schema.getName(),description:r.schema.get("description")})]},d("generate",[r],t)}(e,t)))}function on(e){return e.startsWith("3.")?pe.OPENAPI:pe.SWAGGER}function an(e){return"openapi"in e?pe.OPENAPI:pe.SWAGGER}function cn(e){const{title:t,description:r,version:s,termsOfService:n,contact:i,license:o}=e;return(0,O.cleanObject)({version:s,title:t,description:r,termsOfService:n,contact:i,license:o})}function pn(e,{version:t,specVersion:r,acceptMimes:s=["application/json"]}){const{paths:n,security:i,tags:o,host:a,basePath:c,schemes:p,consumes:u=[],produces:h=["application/json"],definitions:l,parameters:m,responses:d,securityDefinitions:f,externalDocs:g}=e;return{swagger:r,consumes:(0,O.uniq)([...s,...u]),produces:(0,O.uniq)([...h]),info:cn((0,O.getValue)(e,"info",{})),paths:n,host:a,basePath:c,schemes:p,definitions:l,parameters:m,responses:d,security:i,securityDefinitions:f,tags:o,externalDocs:g}}function un(e,{specVersion:t}){const{servers:r,paths:s,components:n,security:i,tags:o,externalDocs:a}=e;return{openapi:t,info:cn((0,O.getValue)(e,"info",{})),servers:r,paths:s,components:n,security:i,tags:o,externalDocs:a}}function hn(e,{fileSpec:t,acceptMimes:r,specVersion:s,version:n}){const i={specVersion:s=s||(0,O.getValue)(e,"openapi",(0,O.getValue)(e,"swagger","2.0")),acceptMimes:r};switch(on(s)){case pe.OPENAPI:e=un(e,i),t=t?un(t,i):t;break;default:case pe.SWAGGER:e=pn(e,i),t=t?pn(t,i):t}return e=rn(e,t),(0,O.setValue)(e,"info.title",(0,O.getValue)(e,"info.title","Api documentation")),(0,O.setValue)(e,"info.version",(0,O.getValue)(e,"info.version",n)),e}const ln=["get","put","post","delete","options","head","patch","trace"],mn=["format","minimum","maximum","exclusiveMinimum","exclusiveMaximum","minLength","maxLength","multipleOf","minItems","maxItems","uniqueItems","minProperties","maxProperties","additionalProperties","pattern","enum","default"],dn=["type","items"],fn=/^(application\/json|[^;\/ \t]+\/[^;\/ \t]+[+]json)[ \t]*(;.*)?$/,gn={APPLICATION_X_WWW_URLENCODED:"application/x-www-form-urlencoded",MULTIPART_FORM_DATA:"multipart/form-data"};function yn(e){if(Array.isArray(e))e.forEach(yn);else if("object"==typeof e)for(let t in e)"$ref"===t?e.$ref=e.$ref.replace("#/components/schemas/","#/definitions/").replace("#/components/","#/x-components/"):yn(e[t])}function On(e){return new RegExp(fn,"i").test(e)}function Sn(e){const t=Object.keys(gn).map((e=>gn[e]));return Object.keys(e).filter((e=>t.indexOf(e)>-1||On(e)))}function bn(e){return Object.entries(e).reduce(((e,[t,r])=>{const s=function(e){const{scheme:t,type:r,name:s,bearerFormat:n,flows:i,...o}=e;switch(r){case"http":if("basic"===t)return{...o,type:t};if("bearer"===t)return{...o,type:"apiKey",name:"Authorization",in:"header"};break;case"oauth2":const e=Object.keys(i)[0],s=i[e];let n=e;return"clientCredentials"===n?n="application":"authorizationCode"===n&&(n="accessCode"),{type:r,flow:n,authorizationUrl:s.authorizationUrl,tokenUrl:s.tokenUrl,scopes:s.scopes}}}(r);return s&&(e[t]=s),e}),{})}function Rn(e){let t=e.url;const r=e.variables||{};for(const e in r){const s=r[e]||{};if(s.default){const r=RegExp(`{${e}}`,"g");t=t.replace(r,s.default)}}const s=new URL(t);return{host:s.host?s.host:void 0,basePath:s.pathname,schemes:null!==s.protocol?[s.protocol.substring(0,s.protocol.length-1)]:void 0}}class An{constructor(e){this.spec=JSON.parse(JSON.stringify(e))}convertInfos(){const e=this.spec.servers&&this.spec.servers[0];return e?Rn(e):{}}resolveReference(e,t,r){if(!t||!t.$ref)return t;const s=t.$ref;if(s.startsWith("#")){const t=s.split("/").map((e=>e.replace(/~1/g,"/").replace(/~0/g,"~")));t.shift();let n=e;return t.forEach((e=>{n=n[e]})),r?JSON.parse(JSON.stringify(n)):n}}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,yn(this.spec)),delete this.spec.servers,delete this.spec.openapi,delete this.spec["x-components"],(0,O.cleanObject)({...e,...this.spec})}convertOperations(e,t){return Object.entries(e).reduce(((e,[r,s])=>{const n=e[r]=this.resolveReference({...t,paths:e},s,!0);return this.convertParameters(n),Object.keys(n).forEach((r=>{if(ln.indexOf(r)>=0){const s=n[r]=this.resolveReference({...t,paths:e},n[r],!0);this.convertOperationParameters(s),this.convertResponses(s)}})),e}),e)}convertOperationParameters(e){let t,r,s,n;if(e.parameters=e.parameters||[],e.requestBody){let i=this.resolveReference(this.spec,e.requestBody,!0);if(e.requestBody.content){const t=Sn(e.requestBody.content)[0],r={content:{}},s=e.requestBody.content[t];s&&s.schema&&s.schema.$ref&&!s.schema.$ref.startsWith("#")&&(i=this.resolveReference(this.spec,s.schema,!0),r.content[`${t}`]={schema:i},i=r)}if(i.name="body",t=i.content,t&&Object.keys(t).length){if(s=Object.keys(t).filter((e=>e.indexOf("/")>0)),n=s.filter((e=>e.indexOf("*")<0)),r=Sn(t)[0],delete i.content,[gn.APPLICATION_X_WWW_URLENCODED,gn.MULTIPART_FORM_DATA].includes(r))if(e.consumes=n,i.in="formData",i.schema=t[r].schema,i.schema=this.resolveReference(this.spec,i.schema,!0),"object"===i.schema.type&&i.schema.properties){const t=i.schema.required||[];Object.keys(i.schema.properties).forEach((r=>{const s=i.schema.properties[r];if(!s.readOnly){const n={name:r,in:"formData",schema:s};t.indexOf(r)>=0&&(n.required=!0),e.parameters?.push(n)}}))}else e.parameters.push(i);else r?(e.consumes=n,i.in="body",i.schema=t[r].schema,e.parameters.push(i)):s&&(e.consumes=n||["application/octet-stream"],i.in="body",i.name=i.name||"file",delete i.type,i.schema=t[s[0]].schema||{type:"string",format:"binary"},e.parameters.push(i));i.schema&&this.convertSchema(i.schema,"request")}delete e.requestBody}this.convertParameters(e)}convertParameters(e){void 0!==e.parameters&&(e.parameters=e.parameters||[],(e.parameters||[]).forEach(((t,r)=>{if("body"!==(t=e.parameters[r]=this.resolveReference(this.spec,t,!1)).in){if(this.copySchemaProperties(t,mn),this.copySchemaProperties(t,dn),this.copySchemaXProperties(t),!t.description){const e=this.resolveReference(this.spec,t.schema,!1);e&&e.description&&(t.description=e.description)}void 0!==t.example&&(t["x-example"]=t.example),delete t.schema,delete t.allowReserved,delete t.example}if("array"===t.type)switch(t.style||("query"===t.in||"cookie"===t.in?"form":"simple")){case"matrix":t.collectionFormat=t.explode?void 0:"csv";break;case"label":t.collectionFormat=void 0;break;case"simple":t.collectionFormat="csv";break;case"spaceDelimited":t.collectionFormat="ssv";break;case"pipeDelimited":t.collectionFormat="pipes";break;case"deepOpbject":t.collectionFormat="multi";break;case"form":t.collectionFormat=!1===t.explode?"csv":"multi"}delete t.style,delete t.explode})))}copySchemaProperties(e,t){let r=this.resolveReference(this.spec,e.schema,!0);r&&t.forEach((t=>{const s=r[t];"additionalProperties"===t&&"boolean"==typeof s||void 0!==s&&(e[t]=s)}))}copySchemaXProperties(e){let t=this.resolveReference(this.spec,e.schema,!0);t&&Object.keys(t).forEach((r=>{Reflect.hasOwnProperty.call(t,r)&&!Reflect.hasOwnProperty.call(e,r)&&r.startsWith("x-")&&(e[r]=t[r])}))}convertResponses(e){Object.keys(e.responses||{}).forEach((t=>{const r=e.responses[t]=this.resolveReference(this.spec,e.responses[t],!0);if(r.content){let t=null,s=null;if(Object.keys(r.content).forEach((n=>{const i=n.indexOf("*")<0?n:"application/octet-stream";e.produces?e.produces.indexOf(i)<0&&e.produces.push(i):e.produces=[i];const o=r.content[n];t=t||o.schema,!s&&On(i)&&(s=o.schema),o.example&&(r.examples=r.examples||{},r.examples[i]=o.example)})),t){r.schema=s||t;const e=this.resolveReference(this.spec,r.schema,!0);e&&r.schema.$ref&&!r.schema.$ref.startsWith("#")&&(r.schema=e),this.convertSchema(r.schema,"response")}}Object.keys(r.headers||{}).forEach((e=>{const t=this.resolveReference(this.spec,r.headers[e],!0);t.schema&&(t.type=t.schema.type,t.format=t.schema.format,delete t.schema),r.headers[e]=t})),delete r.content}))}convertSchema(e,t){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 r in e.allOf)this.convertSchema(e.allOf[r],t);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((r=>{!0===e.properties[r].writeOnly&&"response"===t?delete e.properties[r]:(this.convertSchema(e.properties[r],t),delete e.properties[r].writeOnly)}));break;case"array":e.items&&this.convertSchema(e.items,t)}e.nullable&&(e["x-nullable"]=!0,delete e.nullable),void 0!==e.deprecated&&(void 0===e["x-deprecated"]&&(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((t=>{const r=e[t];if("string"!=typeof r)return void console.warn(`Ignoring ${r} for ${t} in discriminator.mapping.`);let s;if(/^[a-zA-Z0-9._-]+$/.test(r))try{s=this.resolveReference(this.spec,{$ref:`#/components/schemas/${r}`},!1)}catch(e){console.debug(`Error resolving ${r} for ${t} as schema name in discriminator.mapping: ${e}`)}if(!s)try{s=this.resolveReference(this.spec,{$ref:r},!1)}catch(e){console.debug(`Error resolving ${r} for ${t} in discriminator.mapping: ${e}`)}s?(s["x-discriminator-value"]=t,s["x-ms-discriminator-value"]=t):console.warn(`Unable to resolve ${r} for ${t} in discriminator.mapping.`)}))}convertSecurityDefinitions(){this.spec.components.securitySchemes&&(this.spec.securityDefinitions=bn(this.spec.components.securitySchemes),delete this.spec.components.securitySchemes)}}function En(e){return new An(e).convert()}function Tn({tokens:e,...t}){const{version:r="1.0.0",acceptMimes:s,fileSpec:n={},specVersion:i}=t,o=hn((0,O.getValue)(t,"spec",{}),{fileSpec:n,version:r,specVersion:i,acceptMimes:s}),a=an(o),c=rn(o,nn(e,t));return t.sortPaths&&(c.paths=Object.fromEntries(Object.entries(c.paths).sort((([e],[t])=>e.localeCompare(t))))),a===pe.SWAGGER?En(c):c}const Pn="$cache:schemes";function vn(e,t={}){const r=re(e),s=t.specType||pe.JSON;return t={endpoint:!0,groups:[],inlineEnums:s===pe.JSON,...t,specType:s,components:{schemas:{}}},"parameter"===r.decoratorType&&(t={...t,genericTypes:r.nestedGenerics[0],nestedGenerics:r.nestedGenerics,groups:r.parameter?.groups}),function(e,t){const r=e.store.get(Pn)||new Map,s=function(e){return JSON.stringify(e)}(t);if(!r.has(s)){const n=d("schema",[e.schema],t);Object.keys((0,O.getValue)(t,"components.schemas",{})).length&&(n.definitions=t.components.schemas),r.set(s,n)}return e.store.set(Pn,r),r.get(s)}(r,t)}function Cn(e,t={}){const r=e.isStore?e:re(e),s=Ms(t.basePath,r.path);let n=[];return t.withChildren&&(n=r.get("childrenControllers",[]).reduce(((e,r)=>e.concat(Cn(r,{...t,basePath:s}))),n)),[...ie(e).values()].reduce(((r,n)=>{const{operation:i}=n;return i&&i.getAllowedOperationPath(t.allowedVerbs).forEach((t=>{r.push(new ws({basePath:s,token:e,endpoint:n,operationPath:t}))})),r}),n)}function xn(e){const t=e.isStore?e:re(e);if(!t.$properties){const e=ne(t);t.$properties=new Map,e.forEach((e=>{e.children.forEach((e=>{t.$properties.has(e.propertyKey)||t.$properties.set(e.propertyKey,e)}))}))}return t.$properties}function $n(e,t={}){const r=xn(e),s=new Map;return r.forEach(((e,r)=>{!t.withIgnoredProps&&He(e.itemSchema,t)||s.set(r,e)})),s}return o})()));
3
3
  //# sourceMappingURL=schema.umd.min.js.map